@serene-pub/core-catalog 0.6.0-pr-2 → 0.6.0-pr-5
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 +21 -1
- package/components/{sessions → genres/chat}/authors-note/AuthorsNote.svelte +1 -1
- package/components/{sessions → genres/chat}/authors-note/AuthorsNoteWidget.svelte +1 -1
- package/components/{sessions/world-state/WorldState.svelte → shared/actions/Actions.svelte} +5 -5
- package/components/shared/actions/ActionsWidget.svelte +118 -0
- package/components/shared/actions/actions.ts +11 -0
- package/components/shared/album/Album.svelte +24 -0
- package/components/shared/album/AlbumWidget.svelte +163 -0
- package/components/shared/album/album.ts +10 -0
- package/components/shared/annex/Annex.svelte +24 -0
- package/components/shared/annex/AnnexWidget.svelte +151 -0
- package/components/shared/annex/annex.ts +10 -0
- package/components/shared/attendance/Attendance.svelte +24 -0
- package/components/shared/attendance/AttendanceWidget.svelte +136 -0
- package/components/shared/attendance/attendance.ts +12 -0
- package/components/shared/backdrop/Backdrop.svelte +24 -0
- package/components/shared/backdrop/BackdropWidget.svelte +345 -0
- package/components/shared/backdrop/backdrop.ts +10 -0
- package/components/shared/chronicle/Chronicle.svelte +36 -0
- package/components/shared/chronicle/ChronicleWidget.svelte +569 -0
- package/components/shared/chronicle/chronicle.ts +11 -0
- package/components/{sessions → shared}/lore-entries/LoreEntries.svelte +1 -1
- package/components/{sessions → shared}/lore-entries/LoreEntriesWidget.svelte +3 -3
- package/components/shared/map-canvas/MapCanvas.svelte +171 -0
- package/components/shared/map-canvas/index.ts +390 -0
- package/components/{sessions → shared}/messages/MessageComposer.svelte +1 -1
- package/components/{sessions → shared}/messages/MessageControls.svelte +42 -0
- package/components/{sessions → shared}/messages/MessageStateLedger.svelte +19 -8
- package/components/{sessions → shared}/messages/Messages.svelte +1 -1
- package/components/{sessions → shared}/messages/MessagesWidget.svelte +126 -40
- package/components/{sessions → shared}/messages/NextCharacterBlock.svelte +17 -14
- package/components/shared/messages/SceneCueChip.svelte +82 -0
- package/components/shared/messages/SceneDivider.svelte +399 -0
- package/components/{sessions → shared}/messages/SessionComposer.svelte +33 -9
- package/components/shared/messages/SessionContainer.svelte +651 -0
- package/components/{sessions → shared}/messages/SessionMessage.svelte +52 -7
- package/components/shared/messages/TurnLine.svelte +254 -0
- package/components/{sessions → shared}/messages/conversation.svelte.ts +191 -2
- package/components/shared/messages/sceneMarks.ts +397 -0
- package/components/shared/places/Places.svelte +24 -0
- package/components/shared/places/PlacesWidget.svelte +290 -0
- package/components/shared/places/places.ts +11 -0
- package/components/{sessions → shared}/scene-portraits/ScenePortraits.svelte +1 -1
- package/components/shared/scene-portraits/ScenePortraitsWidget.svelte +404 -0
- package/components/{sessions → shared}/state/SlotControl.svelte +9 -1
- package/components/{sessions → shared}/stats/Stats.svelte +1 -1
- package/components/shared/stats/StatsWidget.svelte +350 -0
- package/components/{sessions → shared}/stats/stats.ts +3 -2
- package/components/shared/turn-order/TurnOrder.svelte +24 -0
- package/components/shared/turn-order/TurnOrderWidget.svelte +167 -0
- package/components/shared/turn-order/turn-order.ts +11 -0
- package/components/{sessions/shared → shared}/widgetRef.svelte.ts +9 -2
- package/components/shared/world-state/WorldState.svelte +33 -0
- package/components/shared/world-state/world-state.ts +10 -0
- package/components/tsconfig.json +2 -2
- package/dist/components/actions.js +294 -0
- package/dist/components/actions.source.json +1 -0
- package/dist/components/album.js +386 -0
- package/dist/components/album.source.json +1 -0
- package/dist/components/annex.js +457 -0
- package/dist/components/annex.source.json +1 -0
- package/dist/components/attendance.js +353 -0
- package/dist/components/attendance.source.json +1 -0
- package/dist/components/authors-note.js +5 -5
- package/dist/components/authors-note.source.json +1 -1
- package/dist/components/backdrop.js +561 -0
- package/dist/components/backdrop.source.json +1 -0
- package/dist/components/chronicle.js +1141 -0
- package/dist/components/chronicle.source.json +1 -0
- package/dist/components/core-ui.json +1 -1
- package/dist/components/lore-entries.js +5 -5
- package/dist/components/lore-entries.source.json +1 -1
- package/dist/components/messages.js +3014 -2489
- package/dist/components/messages.source.json +1 -1
- package/dist/components/places.js +1133 -0
- package/dist/components/places.source.json +1 -0
- package/dist/components/scene-portraits.js +514 -345
- package/dist/components/scene-portraits.source.json +1 -1
- package/dist/components/shared-3K7SOGH7.js +16 -0
- package/dist/components/shared-452PIS46.js +156 -0
- package/dist/components/shared-GEDAMORM.js +45 -0
- package/dist/components/{shared-TCQZXBE3.js → shared-GXTL5G2H.js} +4 -3
- package/dist/components/shared-ITSLBJB5.js +478 -0
- package/dist/components/shared-NK7QSVMU.js +400 -0
- package/dist/components/shared-TDWKI2QV.js +58 -0
- package/dist/components/{shared-UAQVMZZK.js → shared-XBPH6USH.js} +586 -18
- package/dist/components/{shared-AINANAIA.js → shared-XISPHAKY.js} +502 -98
- package/dist/components/stats.js +8 -208
- package/dist/components/stats.source.json +1 -1
- package/dist/components/turn-order.js +461 -0
- package/dist/components/turn-order.source.json +1 -0
- package/dist/components/world-state.js +14 -202
- package/dist/components/world-state.source.json +1 -1
- package/dist/{answerForm.d.ts → factories/answerForm.d.ts} +4 -30
- package/dist/{answerForm.js → factories/answerForm.js} +10 -39
- package/dist/factories/once.d.ts +7 -0
- package/dist/factories/once.js +9 -0
- package/dist/{turnOrder.d.ts → factories/turnOrder.d.ts} +0 -22
- package/dist/{turnOrder.js → factories/turnOrder.js} +4 -104
- package/dist/genres/adventure/advanceTime.d.ts +18 -0
- package/dist/genres/adventure/advanceTime.js +24 -0
- package/dist/genres/adventure/answer.d.ts +23 -0
- package/dist/genres/adventure/answer.js +59 -0
- package/dist/genres/adventure/answerForm.d.ts +9 -0
- package/dist/genres/adventure/answerForm.js +11 -0
- package/dist/genres/adventure/ask.d.ts +73 -0
- package/dist/genres/adventure/ask.js +157 -0
- package/dist/genres/adventure/create.d.ts +36 -0
- package/dist/genres/adventure/create.js +62 -0
- package/dist/genres/adventure/illustrateScene.d.ts +7 -0
- package/dist/genres/adventure/illustrateScene.js +19 -0
- package/dist/genres/adventure/index.d.ts +45 -0
- package/dist/genres/adventure/index.js +45 -0
- package/dist/genres/adventure/keeperAction.d.ts +43 -0
- package/dist/genres/adventure/keeperAction.js +217 -0
- package/dist/genres/adventure/look.d.ts +45 -0
- package/dist/genres/adventure/look.js +209 -0
- package/dist/{adventure.d.ts → genres/adventure/respond.d.ts} +74 -65
- package/dist/{adventure.js → genres/adventure/respond.js} +125 -65
- package/dist/genres/adventure/rest.d.ts +10 -0
- package/dist/genres/adventure/rest.js +16 -0
- package/dist/genres/adventure/summarizeScene.d.ts +7 -0
- package/dist/genres/adventure/summarizeScene.js +14 -0
- package/dist/genres/adventure/turnOrder.d.ts +10 -0
- package/dist/genres/adventure/turnOrder.js +27 -0
- package/dist/genres/chat/advanceTime.d.ts +7 -0
- package/dist/genres/chat/advanceTime.js +17 -0
- package/dist/genres/chat/answerForm.d.ts +9 -0
- package/dist/genres/chat/answerForm.js +11 -0
- package/dist/genres/chat/create.d.ts +7 -0
- package/dist/{createChat.js → genres/chat/create.js} +6 -6
- package/dist/genres/chat/generateImage.d.ts +7 -0
- package/dist/{generateImage.js → genres/chat/generateImage.js} +26 -22
- package/dist/genres/chat/illustrateScene.d.ts +8 -0
- package/dist/genres/chat/illustrateScene.js +19 -0
- package/dist/genres/chat/index.d.ts +18 -0
- package/dist/genres/chat/index.js +19 -0
- package/dist/{narrate.d.ts → genres/chat/narrate.d.ts} +3 -3
- package/dist/{narrate.js → genres/chat/narrate.js} +37 -12
- package/dist/{narrateCharacter.d.ts → genres/chat/narrateCharacter.d.ts} +2 -2
- package/dist/{narrateCharacter.js → genres/chat/narrateCharacter.js} +39 -17
- package/dist/genres/chat/respond.d.ts +25 -0
- package/dist/{respond.js → genres/chat/respond.js} +91 -23
- package/dist/genres/chat/summarizeScene.d.ts +7 -0
- package/dist/genres/chat/summarizeScene.js +14 -0
- package/dist/genres/chat/turnOrder.d.ts +9 -0
- package/dist/genres/chat/turnOrder.js +28 -0
- package/dist/{ui/sessions → genres/chat/ui}/authors-note/index.d.ts +1 -1
- package/dist/genres/guide/answerForm.d.ts +9 -0
- package/dist/genres/guide/answerForm.js +11 -0
- package/dist/genres/guide/create.d.ts +24 -0
- package/dist/genres/guide/create.js +58 -0
- package/dist/genres/guide/index.d.ts +10 -0
- package/dist/genres/guide/index.js +10 -0
- package/dist/{guide.d.ts → genres/guide/respond.d.ts} +1 -20
- package/dist/{guide.js → genres/guide/respond.js} +32 -61
- package/dist/genres/guide/summarizeScene.d.ts +7 -0
- package/dist/genres/guide/summarizeScene.js +14 -0
- package/dist/genres/guide/turnOrder.d.ts +10 -0
- package/dist/genres/guide/turnOrder.js +27 -0
- package/dist/genres/index.d.ts +14 -0
- package/dist/genres/index.js +41 -0
- package/dist/genres/lair/advanceTime.d.ts +7 -0
- package/dist/genres/lair/advanceTime.js +17 -0
- package/dist/genres/lair/answerForm.d.ts +17 -0
- package/dist/genres/lair/answerForm.js +19 -0
- package/dist/genres/lair/buildRoom.d.ts +64 -0
- package/dist/genres/lair/buildRoom.js +244 -0
- package/dist/genres/lair/castellanAction.d.ts +27 -0
- package/dist/genres/lair/castellanAction.js +177 -0
- package/dist/genres/lair/create.d.ts +28 -0
- package/dist/genres/lair/create.js +69 -0
- package/dist/genres/lair/fileRoom.d.ts +53 -0
- package/dist/genres/lair/fileRoom.js +288 -0
- package/dist/genres/lair/index.d.ts +62 -0
- package/dist/genres/lair/index.js +63 -0
- package/dist/genres/lair/nudge.d.ts +25 -0
- package/dist/genres/lair/nudge.js +78 -0
- package/dist/{lair.d.ts → genres/lair/respond.d.ts} +46 -59
- package/dist/{lair.js → genres/lair/respond.js} +55 -76
- package/dist/genres/lair/reveal.d.ts +10 -0
- package/dist/genres/lair/reveal.js +18 -0
- package/dist/genres/lair/roomAnswer.d.ts +86 -0
- package/dist/genres/lair/roomAnswer.js +378 -0
- package/dist/genres/lair/summarizeScene.d.ts +39 -0
- package/dist/genres/lair/summarizeScene.js +51 -0
- package/dist/genres/lair/trap.d.ts +11 -0
- package/dist/genres/lair/trap.js +24 -0
- package/dist/genres/lair/turnOrder.d.ts +9 -0
- package/dist/genres/lair/turnOrder.js +36 -0
- package/dist/genres/lair/whisper.d.ts +35 -0
- package/dist/genres/lair/whisper.js +90 -0
- package/dist/index.d.ts +52 -29
- package/dist/index.js +192 -86
- package/dist/loadouts.d.ts +37 -0
- package/dist/loadouts.js +105 -0
- package/dist/{entries.d.ts → registry/entries.d.ts} +1 -1
- package/dist/{genres.js → registry/genres.js} +40 -6
- package/dist/{ui/sessions → registry}/layouts.d.ts +41 -27
- package/dist/{ui/sessions → registry}/layouts.js +90 -49
- package/dist/{ui/sessions → registry}/widgets.d.ts +22 -0
- package/dist/registry/widgets.js +1294 -0
- package/dist/{presets.js → seed/presets.js} +28 -13
- package/dist/{prompts.d.ts → seed/prompts.d.ts} +10 -5
- package/dist/{prompts.js → seed/prompts.js} +225 -176
- package/dist/{annexField.d.ts → shared/annexField.d.ts} +12 -8
- package/dist/{annexField.js → shared/annexField.js} +16 -15
- package/dist/shared/builtins/branch.d.ts +8 -0
- package/dist/shared/builtins/branch.js +13 -0
- package/dist/{builtins.d.ts → shared/builtins/builtIn.d.ts} +16 -21
- package/dist/{builtins.js → shared/builtins/builtIn.js} +3 -37
- package/dist/shared/builtins/delete.d.ts +8 -0
- package/dist/shared/builtins/delete.js +13 -0
- package/dist/shared/builtins/edit.d.ts +8 -0
- package/dist/shared/builtins/edit.js +13 -0
- package/dist/shared/builtins/hide.d.ts +8 -0
- package/dist/shared/builtins/hide.js +13 -0
- package/dist/shared/builtins/index.d.ts +11 -0
- package/dist/shared/builtins/index.js +11 -0
- package/dist/shared/builtins/swipe.d.ts +8 -0
- package/dist/shared/builtins/swipe.js +17 -0
- package/dist/shared/describeLikeness.d.ts +14 -0
- package/dist/shared/describeLikeness.js +65 -0
- package/dist/shared/illustrateScene.d.ts +28 -0
- package/dist/shared/illustrateScene.js +181 -0
- package/dist/shared/portrait.d.ts +21 -0
- package/dist/shared/portrait.js +101 -0
- package/dist/shared/spriteFill.d.ts +14 -0
- package/dist/shared/spriteFill.js +107 -0
- package/dist/shared/sprites.d.ts +34 -0
- package/dist/shared/sprites.js +98 -0
- package/dist/shared/summarize/character.d.ts +9 -0
- package/dist/shared/summarize/character.js +10 -0
- package/dist/shared/summarize/history.d.ts +9 -0
- package/dist/shared/summarize/history.js +10 -0
- package/dist/shared/summarize/index.d.ts +12 -0
- package/dist/shared/summarize/index.js +12 -0
- package/dist/shared/summarize/scene.d.ts +38 -0
- package/dist/shared/summarize/scene.js +42 -0
- package/dist/shared/summarize/sceneIds.d.ts +17 -0
- package/dist/shared/summarize/sceneIds.js +17 -0
- package/dist/shared/summarize/summarizeScene.d.ts +113 -0
- package/dist/shared/summarize/summarizeScene.js +234 -0
- package/dist/shared/summarize/summarizeSpec.d.ts +54 -0
- package/dist/{summarize.js → shared/summarize/summarizeSpec.js} +23 -53
- package/dist/shared/summarize/world.d.ts +8 -0
- package/dist/shared/summarize/world.js +9 -0
- package/dist/shared/timePasses.d.ts +56 -0
- package/dist/shared/timePasses.js +86 -0
- package/dist/{toolLoop.d.ts → shared/toolLoop.d.ts} +25 -3
- package/dist/{toolLoop.js → shared/toolLoop.js} +70 -14
- package/dist/shared/ui/actions/index.d.ts +117 -0
- package/dist/shared/ui/actions/index.js +154 -0
- package/dist/shared/ui/album/index.d.ts +115 -0
- package/dist/shared/ui/album/index.js +178 -0
- package/dist/shared/ui/annex/index.d.ts +163 -0
- package/dist/shared/ui/annex/index.js +273 -0
- package/dist/shared/ui/attendance/index.d.ts +97 -0
- package/dist/shared/ui/attendance/index.js +89 -0
- package/dist/shared/ui/backdrop/index.d.ts +78 -0
- package/dist/shared/ui/backdrop/index.js +98 -0
- package/dist/shared/ui/chronicle/index.d.ts +230 -0
- package/dist/shared/ui/chronicle/index.js +249 -0
- package/dist/shared/ui/conversation/dossier.d.ts +33 -0
- package/dist/shared/ui/conversation/dossier.js +31 -0
- package/dist/{ui/sessions → shared/ui}/conversation/index.d.ts +2 -1
- package/dist/{ui/sessions → shared/ui}/conversation/index.js +3 -1
- package/dist/{ui/sessions → shared/ui}/conversation/messageVerbState.d.ts +1 -1
- package/dist/shared/ui/conversation/storyDays.d.ts +21 -0
- package/dist/shared/ui/conversation/storyDays.js +23 -0
- package/dist/{ui/sessions → shared/ui}/coreWidgetsEntry.d.ts +1 -1
- package/dist/{ui/sessions → shared/ui}/coreWidgetsEntry.js +1 -1
- package/dist/{ui/sessions → shared/ui}/lore-entries/index.d.ts +2 -2
- package/dist/shared/ui/places/index.d.ts +148 -0
- package/dist/shared/ui/places/index.js +249 -0
- package/dist/{ui/sessions → shared/ui}/scene-portraits/index.d.ts +1 -1
- package/dist/{ui/sessions → shared/ui}/scene-portraits/index.js +1 -1
- package/dist/shared/ui/scene-portraits/portraits.d.ts +191 -0
- package/dist/shared/ui/scene-portraits/portraits.js +223 -0
- package/dist/shared/ui/session-state/index.d.ts +16 -0
- package/dist/shared/ui/session-state/index.js +16 -0
- package/dist/{ui/sessions → shared/ui}/session-state/shapes.d.ts +2 -2
- package/dist/shared/ui/session-state/stateView.d.ts +249 -0
- package/dist/shared/ui/session-state/stateView.js +247 -0
- package/dist/shared/ui/turn-order/index.d.ts +146 -0
- package/dist/shared/ui/turn-order/index.js +257 -0
- package/dist/{ui/sessions → shared/ui}/widgetContext.d.ts +19 -10
- package/package.json +69 -30
- package/components/sessions/messages/SessionContainer.svelte +0 -459
- package/components/sessions/scene-portraits/ScenePortraitsWidget.svelte +0 -249
- package/components/sessions/stats/StatsWidget.svelte +0 -112
- package/components/sessions/world-state/WorldStateWidget.svelte +0 -112
- package/components/sessions/world-state/world-state.ts +0 -10
- package/dist/adventureActions.d.ts +0 -169
- package/dist/adventureActions.js +0 -599
- package/dist/createChat.d.ts +0 -7
- package/dist/generateImage.d.ts +0 -7
- package/dist/lairActions.d.ts +0 -296
- package/dist/lairActions.js +0 -1287
- package/dist/respond.d.ts +0 -24
- package/dist/sprites.d.ts +0 -24
- package/dist/sprites.js +0 -102
- package/dist/summarize.d.ts +0 -76
- package/dist/ui/sessions/conversation/dossier.d.ts +0 -328
- package/dist/ui/sessions/conversation/dossier.js +0 -31
- package/dist/ui/sessions/scene-portraits/portraits.d.ts +0 -95
- package/dist/ui/sessions/scene-portraits/portraits.js +0 -115
- package/dist/ui/sessions/session-state/index.d.ts +0 -15
- package/dist/ui/sessions/session-state/index.js +0 -15
- package/dist/ui/sessions/session-state/stateView.d.ts +0 -155
- package/dist/ui/sessions/session-state/stateView.js +0 -141
- package/dist/ui/sessions/widgets.js +0 -567
- package/components/{sessions → genres/chat}/authors-note/authors-note.ts +0 -0
- package/components/{sessions/shared → shared}/context.ts +0 -0
- package/components/{sessions → shared}/lore-entries/lore-entries.ts +0 -0
- package/components/{sessions → shared}/messages/MessageBlocksView.svelte +0 -0
- package/components/{sessions → shared}/messages/MessageMediaStrip.svelte +0 -0
- package/components/{sessions → shared}/messages/MessagePartsView.svelte +0 -0
- package/components/{sessions → shared}/messages/StateProposalList.svelte +0 -0
- package/components/{sessions → shared}/messages/mediaStrip.ts +0 -0
- package/components/{sessions → shared}/messages/messages.ts +0 -0
- package/components/{sessions → shared}/scene-portraits/StatBars.svelte +0 -0
- package/components/{sessions → shared}/scene-portraits/scene-portraits.ts +0 -0
- package/components/{sessions → shared}/state/entryFinder.ts +0 -0
- package/components/{sessions → shared}/state/slotWriter.svelte.ts +0 -0
- package/dist/components/{shared-RJDGOAVC.js → shared-FTRGUE7G.js} +78 -78
- /package/dist/{ui/sessions → genres/chat/ui}/authors-note/index.js +0 -0
- /package/dist/{entries.js → registry/entries.js} +0 -0
- /package/dist/{genres.d.ts → registry/genres.d.ts} +0 -0
- /package/dist/{slots.d.ts → registry/slots.d.ts} +0 -0
- /package/dist/{slots.js → registry/slots.js} +0 -0
- /package/dist/{statShapes.d.ts → registry/statShapes.d.ts} +0 -0
- /package/dist/{statShapes.js → registry/statShapes.js} +0 -0
- /package/dist/{guideMascotImage.d.ts → seed/guideMascotImage.d.ts} +0 -0
- /package/dist/{guideMascotImage.js → seed/guideMascotImage.js} +0 -0
- /package/dist/{presets.d.ts → seed/presets.d.ts} +0 -0
- /package/dist/{graphBuild.d.ts → shared/graphBuild.d.ts} +0 -0
- /package/dist/{graphBuild.js → shared/graphBuild.js} +0 -0
- /package/dist/{ui/sessions → shared/ui}/conversation/actionsDisclosure.d.ts +0 -0
- /package/dist/{ui/sessions → shared/ui}/conversation/actionsDisclosure.js +0 -0
- /package/dist/{ui/sessions → shared/ui}/conversation/composerTray.d.ts +0 -0
- /package/dist/{ui/sessions → shared/ui}/conversation/composerTray.js +0 -0
- /package/dist/{ui/sessions → shared/ui}/conversation/formAnswer.d.ts +0 -0
- /package/dist/{ui/sessions → shared/ui}/conversation/formAnswer.js +0 -0
- /package/dist/{ui/sessions → shared/ui}/conversation/itemValues.d.ts +0 -0
- /package/dist/{ui/sessions → shared/ui}/conversation/itemValues.js +0 -0
- /package/dist/{ui/sessions → shared/ui}/conversation/messageOrder.d.ts +0 -0
- /package/dist/{ui/sessions → shared/ui}/conversation/messageOrder.js +0 -0
- /package/dist/{ui/sessions → shared/ui}/conversation/messageSpeaker.d.ts +0 -0
- /package/dist/{ui/sessions → shared/ui}/conversation/messageSpeaker.js +0 -0
- /package/dist/{ui/sessions → shared/ui}/conversation/messageVerbState.js +0 -0
- /package/dist/{ui/sessions → shared/ui}/conversation/slashPalette.d.ts +0 -0
- /package/dist/{ui/sessions → shared/ui}/conversation/slashPalette.js +0 -0
- /package/dist/{ui/sessions → shared/ui}/conversation/text.d.ts +0 -0
- /package/dist/{ui/sessions → shared/ui}/conversation/text.js +0 -0
- /package/dist/{ui/sessions → shared/ui}/lore-entries/index.js +0 -0
- /package/dist/{ui/sessions → shared/ui}/session-state/barMath.d.ts +0 -0
- /package/dist/{ui/sessions → shared/ui}/session-state/barMath.js +0 -0
- /package/dist/{ui/sessions → shared/ui}/session-state/shapes.js +0 -0
- /package/dist/{ui/sessions → shared/ui}/widgetContext.js +0 -0
|
@@ -0,0 +1,478 @@
|
|
|
1
|
+
import {
|
|
2
|
+
renderStatusText
|
|
3
|
+
} from "./shared-3K7SOGH7.js";
|
|
4
|
+
import {
|
|
5
|
+
CORE_VERB_REASONS,
|
|
6
|
+
evaluateEnabledWhen
|
|
7
|
+
} from "./shared-NK7QSVMU.js";
|
|
8
|
+
import {
|
|
9
|
+
audienceHolds,
|
|
10
|
+
envoySlugOfRef
|
|
11
|
+
} from "./shared-TDWKI2QV.js";
|
|
12
|
+
import {
|
|
13
|
+
refuseUnlessIdentical
|
|
14
|
+
} from "./shared-FTRGUE7G.js";
|
|
15
|
+
import {
|
|
16
|
+
CORE_ACTION_SPEC_ID,
|
|
17
|
+
i18nFindings,
|
|
18
|
+
i18nText,
|
|
19
|
+
localeMapOf
|
|
20
|
+
} from "./shared-XBPH6USH.js";
|
|
21
|
+
|
|
22
|
+
// ../sdk/dist/settingsSlot.js
|
|
23
|
+
var SETTINGS_SLOT = "settings";
|
|
24
|
+
var ENABLED_FIELD = Object.freeze({
|
|
25
|
+
type: "boolean",
|
|
26
|
+
default: true,
|
|
27
|
+
quick: true,
|
|
28
|
+
label: { en: "Use this source" },
|
|
29
|
+
description: {
|
|
30
|
+
en: "Off skips the step entirely rather than fetching and discarding it \u2014 cheaper than starving it with a zero share."
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
var ENABLED_STEP_FIELD = Object.freeze({
|
|
34
|
+
type: "boolean",
|
|
35
|
+
default: true,
|
|
36
|
+
quick: true,
|
|
37
|
+
label: { en: "Run this step" },
|
|
38
|
+
description: {
|
|
39
|
+
en: "Off skips the step entirely: nothing is called or charged, and the steps after it go on without what it would have made."
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
// ../sdk/dist/verdicts.js
|
|
44
|
+
var DOORS = [
|
|
45
|
+
"construction",
|
|
46
|
+
"registry",
|
|
47
|
+
"validate",
|
|
48
|
+
"publish",
|
|
49
|
+
"run",
|
|
50
|
+
"fire",
|
|
51
|
+
"write",
|
|
52
|
+
"list"
|
|
53
|
+
];
|
|
54
|
+
var VERDICT_ID = /^[a-z0-9]+(?:[.-][a-z0-9]+)*:verdict\/[a-z0-9]+(?:-[a-z0-9]+)*$/;
|
|
55
|
+
var registry = /* @__PURE__ */ new Map();
|
|
56
|
+
var doorSet = new Set(DOORS);
|
|
57
|
+
function defineVerdict(decl) {
|
|
58
|
+
if (typeof decl.id !== "string" || !VERDICT_ID.test(decl.id))
|
|
59
|
+
throw new Error(`'${String(decl.id)}' is not a verdict id \u2014 one is '<owner>:verdict/<slug>', the slug lowercase letters, digits and hyphens: core:verdict/effects-line`);
|
|
60
|
+
if (typeof decl.law !== "string" || !decl.law.trim())
|
|
61
|
+
throw new Error(`${decl.id} names no law \u2014 'law' is the label a Finding carries for this rule ('F39', 'R-20')`);
|
|
62
|
+
if (!Array.isArray(decl.doors) || decl.doors.length === 0)
|
|
63
|
+
throw new Error(`${decl.id} declares no door \u2014 list every place the rule is heard, one of ${DOORS.join(", ")}`);
|
|
64
|
+
const unknown = decl.doors.find((d) => !doorSet.has(d));
|
|
65
|
+
if (unknown !== void 0)
|
|
66
|
+
throw new Error(`${decl.id} declares the door '${String(unknown)}', which is not one \u2014 a door is one of ${DOORS.join(", ")}`);
|
|
67
|
+
if (typeof decl.judge !== "function" || typeof decl.failing !== "function")
|
|
68
|
+
throw new Error(`${decl.id} declares no judge or no failing input \u2014 a verdict is { id, law, doors, judge, failing }`);
|
|
69
|
+
const existing = registry.get(decl.id);
|
|
70
|
+
if (existing)
|
|
71
|
+
refuseUnlessIdentical(existing, decl, `duplicate verdict id: ${decl.id}`);
|
|
72
|
+
const verdict = Object.freeze({ ...decl, doors: Object.freeze([...decl.doors]) });
|
|
73
|
+
registry.set(decl.id, verdict);
|
|
74
|
+
return verdict;
|
|
75
|
+
}
|
|
76
|
+
var i18nVerdict = defineVerdict({
|
|
77
|
+
id: "core:verdict/i18n",
|
|
78
|
+
law: "R-20",
|
|
79
|
+
doors: ["construction", "registry", "validate", "publish", "run"],
|
|
80
|
+
judge({ value, where, required }) {
|
|
81
|
+
const [sentence] = i18nFindings(value, where, { required });
|
|
82
|
+
return sentence === void 0 ? { ok: true } : { ok: false, sentence };
|
|
83
|
+
},
|
|
84
|
+
// The field each door is asked about — the sentence names it, so the
|
|
85
|
+
// door's own address has to be the one the kit expects to hear back: a
|
|
86
|
+
// definition's name at the registry, a preset's label where a document
|
|
87
|
+
// is built, validated or published, a status's text at the run.
|
|
88
|
+
failing: (door) => ({
|
|
89
|
+
value: { fr: "Titre" },
|
|
90
|
+
where: door === "registry" ? "i18n.name" : door === "run" ? "status.i18n" : "presets[lore].label",
|
|
91
|
+
required: true
|
|
92
|
+
})
|
|
93
|
+
});
|
|
94
|
+
var enablementVerdict = defineVerdict({
|
|
95
|
+
id: "core:verdict/enablement",
|
|
96
|
+
law: "U5e",
|
|
97
|
+
doors: ["list", "fire"],
|
|
98
|
+
judge({ preds, doc }) {
|
|
99
|
+
const heard = evaluateEnabledWhen(preds, doc);
|
|
100
|
+
return heard.enabled ? { ok: true } : { ok: false, sentence: heard.reason };
|
|
101
|
+
},
|
|
102
|
+
failing: () => ({
|
|
103
|
+
preds: [
|
|
104
|
+
{
|
|
105
|
+
on: "state.world.conformance",
|
|
106
|
+
truthy: true,
|
|
107
|
+
reason: { en: "conformance: the enabled-when predicate refused this press" }
|
|
108
|
+
}
|
|
109
|
+
],
|
|
110
|
+
doc: { state: { world: { conformance: false } } }
|
|
111
|
+
})
|
|
112
|
+
});
|
|
113
|
+
var audienceVerdict = defineVerdict({
|
|
114
|
+
id: "core:verdict/audience",
|
|
115
|
+
law: "R-15",
|
|
116
|
+
doors: ["list", "fire"],
|
|
117
|
+
judge({ name, refs, portrayals, viewer, item }) {
|
|
118
|
+
if (audienceHolds(refs, portrayals, viewer, item))
|
|
119
|
+
return { ok: true };
|
|
120
|
+
return {
|
|
121
|
+
ok: false,
|
|
122
|
+
sentence: `'${name}' is not yours to use here \u2014 its audience is ${refs.length ? refs.join(", ") : "nobody"}.`
|
|
123
|
+
};
|
|
124
|
+
},
|
|
125
|
+
failing: () => ({
|
|
126
|
+
name: "grant",
|
|
127
|
+
refs: ["owner"],
|
|
128
|
+
portrayals: { owner: { by: "person", userId: "1" } },
|
|
129
|
+
viewer: { userId: 2 }
|
|
130
|
+
})
|
|
131
|
+
});
|
|
132
|
+
var isSettingsAddress = (name) => typeof name === "string" && (name === SETTINGS_SLOT || name.startsWith(`${SETTINGS_SLOT}.`));
|
|
133
|
+
var settingsTravelVerdict = defineVerdict({
|
|
134
|
+
id: "core:verdict/settings-travel",
|
|
135
|
+
law: "F39",
|
|
136
|
+
doors: ["registry", "validate", "run"],
|
|
137
|
+
judge(input) {
|
|
138
|
+
switch (input.kind) {
|
|
139
|
+
case "edge": {
|
|
140
|
+
if (!isSettingsAddress(input.fromPort))
|
|
141
|
+
return { ok: true };
|
|
142
|
+
const { from, fromPort, to, toPort } = input;
|
|
143
|
+
return {
|
|
144
|
+
ok: false,
|
|
145
|
+
sentence: `'${to}.${toPort}' reads '${from}.${fromPort}' \u2014 a setting, not a port; settings never travel, only data does`,
|
|
146
|
+
fix: `wire a port '${from}' publishes (what it DID with the setting), or declare the value '${to}' needs on its own params and share the owner's with slot.params({ node: '${from}' }) \u2014 the substrate's switches (enabled, review, mode) are read at their owner by the executor and are never a value`
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
case "reference": {
|
|
150
|
+
if (!isSettingsAddress(input.slot))
|
|
151
|
+
return { ok: true };
|
|
152
|
+
const { node, key, target } = input;
|
|
153
|
+
return {
|
|
154
|
+
ok: false,
|
|
155
|
+
sentence: `'${node}.${key}' references '${target}.${SETTINGS_SLOT}' \u2014 the substrate's switches, read at their owner by the executor and never a value; settings never travel, only data does`,
|
|
156
|
+
fix: `read a port '${target}' publishes, or declare the value '${node}' needs on its own params and share the owner's with slot.params({ node: '${target}' }) \u2014 a switch (enabled, review, mode) belongs to no reference`
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
case "port": {
|
|
160
|
+
if (!isSettingsAddress(input.port))
|
|
161
|
+
return { ok: true };
|
|
162
|
+
const { definitionId, port } = input;
|
|
163
|
+
return {
|
|
164
|
+
ok: false,
|
|
165
|
+
sentence: `${definitionId} declares an out-port named '${port}'. '<node>.${SETTINGS_SLOT}' (and paths under it) is the address of the substrate's own switches \u2014 \`enabled\`, \`review\`, \`mode\` \u2014 which the executor reads at the node and hands to nobody (F39: settings never travel), so an edge from a port of that name would be refused as a setting`,
|
|
166
|
+
fix: `name the port for what it publishes ('result', 'applied', 'chosen')`
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
default:
|
|
170
|
+
return {
|
|
171
|
+
ok: false,
|
|
172
|
+
sentence: `'${String(input.kind)}' is not a shape this verdict judges \u2014 one of 'edge', 'reference', 'port'.`
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
},
|
|
176
|
+
failing: (door) => door === "registry" ? { kind: "port", definitionId: "conformance:task/claims-settings-port@1", port: "settings.review" } : door === "run" ? { kind: "reference", node: "probe", key: "main", slot: SETTINGS_SLOT, target: "save" } : { kind: "edge", from: "save", fromPort: `${SETTINGS_SLOT}.review`, to: "probe", toPort: "main" }
|
|
177
|
+
});
|
|
178
|
+
var provisionalVerdict = defineVerdict({
|
|
179
|
+
id: "core:verdict/provisional",
|
|
180
|
+
law: "R-2",
|
|
181
|
+
doors: ["validate", "run", "registry"],
|
|
182
|
+
judge(input) {
|
|
183
|
+
switch (input.kind) {
|
|
184
|
+
case "placement": {
|
|
185
|
+
if (!input.provisional)
|
|
186
|
+
return { ok: true };
|
|
187
|
+
const { nodeKey, definitionId, definitionVersion } = input;
|
|
188
|
+
return {
|
|
189
|
+
ok: false,
|
|
190
|
+
sentence: `'${nodeKey}' places ${definitionId}@${definitionVersion}, which is provisional \u2014 declared, not bound: no handler runs it in this release (R-2)`,
|
|
191
|
+
fix: "bind it or remove the node"
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
case "publication": {
|
|
195
|
+
if (input.provisional || input.bound)
|
|
196
|
+
return { ok: true };
|
|
197
|
+
return {
|
|
198
|
+
ok: false,
|
|
199
|
+
sentence: `${input.definitionId} is published with no handler behind it and no plan claiming it \u2014 declared, not bound (R-2)`,
|
|
200
|
+
fix: "bind it in bindings.ts, mark it `provisional: true` under the plan that owns it, or cull it"
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
default:
|
|
204
|
+
return {
|
|
205
|
+
ok: false,
|
|
206
|
+
sentence: `'${String(input.kind)}' is not a shape this verdict judges \u2014 one of 'placement', 'publication'.`
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
},
|
|
210
|
+
failing: (door) => door === "registry" ? { kind: "publication", definitionId: "core:task/stray-unbound@1", provisional: false, bound: false } : {
|
|
211
|
+
kind: "placement",
|
|
212
|
+
nodeKey: "pending",
|
|
213
|
+
definitionId: "conformance:oracle/pending",
|
|
214
|
+
definitionVersion: 1,
|
|
215
|
+
provisional: true
|
|
216
|
+
}
|
|
217
|
+
});
|
|
218
|
+
|
|
219
|
+
// dist/shared/ui/conversation/itemValues.js
|
|
220
|
+
function itemSpeakerOf(row) {
|
|
221
|
+
const envoy = envoySlugOfRef(row.metadata?.speaker);
|
|
222
|
+
if (envoy)
|
|
223
|
+
return `envoy:${envoy}`;
|
|
224
|
+
if (row.personaId != null)
|
|
225
|
+
return `character:${row.personaId}`;
|
|
226
|
+
if (row.characterId != null)
|
|
227
|
+
return `character:${row.characterId}`;
|
|
228
|
+
return null;
|
|
229
|
+
}
|
|
230
|
+
function itemValuesOf(row, facts) {
|
|
231
|
+
const greeting = row.metadata?.isGreeting === true;
|
|
232
|
+
const swipes = row.metadata?.swipes;
|
|
233
|
+
const idx = swipes?.currentIdx;
|
|
234
|
+
const len = swipes?.history?.length ?? 0;
|
|
235
|
+
const hasNext = typeof idx === "number" && idx < len - 1;
|
|
236
|
+
const role = row.role ?? "";
|
|
237
|
+
const speaker = itemSpeakerOf(row);
|
|
238
|
+
return {
|
|
239
|
+
id: row.id,
|
|
240
|
+
isNewest: facts.isNewest,
|
|
241
|
+
hidden: row.isHidden === true,
|
|
242
|
+
generating: row.isGenerating === true,
|
|
243
|
+
role,
|
|
244
|
+
mine: facts.mine,
|
|
245
|
+
hasSwipes: greeting ? hasNext : true,
|
|
246
|
+
greeting,
|
|
247
|
+
channel: row.channel || "main",
|
|
248
|
+
speaker,
|
|
249
|
+
characterLine: role !== "user" && !!speaker?.startsWith("character:")
|
|
250
|
+
};
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
// dist/shared/ui/conversation/text.js
|
|
254
|
+
function statusTextIn(status, language, t) {
|
|
255
|
+
if (!status)
|
|
256
|
+
return "";
|
|
257
|
+
const i18n = localeMapOf(status.i18n);
|
|
258
|
+
if (i18n[language] !== void 0)
|
|
259
|
+
return renderStatusText(status, language);
|
|
260
|
+
return renderStatusText({ ...status, i18n: { en: t(i18n.en) } });
|
|
261
|
+
}
|
|
262
|
+
var resolve = (status) => status ? renderStatusText(status) : "";
|
|
263
|
+
var statusText = (status) => resolve(status);
|
|
264
|
+
function setStatusTextResolver(language, t) {
|
|
265
|
+
resolve = (status) => statusTextIn(status, language(), t);
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
// dist/shared/ui/conversation/messageVerbState.js
|
|
269
|
+
var isReply = (m) => m.role !== "user" && (!!m.characterId || !!m.isNarratorResponse);
|
|
270
|
+
var VERB_REASONS = Object.freeze({
|
|
271
|
+
notYours: "not yours to change",
|
|
272
|
+
editing: "finish the edit first",
|
|
273
|
+
generating: CORE_VERB_REASONS.generating.en,
|
|
274
|
+
hidden: CORE_VERB_REASONS.hidden.en,
|
|
275
|
+
notNewest: CORE_VERB_REASONS.notNewest.en,
|
|
276
|
+
noSwipe: CORE_VERB_REASONS.noSwipe.en
|
|
277
|
+
});
|
|
278
|
+
function notYoursToUse(action) {
|
|
279
|
+
const heard = audienceVerdict.judge({
|
|
280
|
+
name: action.name,
|
|
281
|
+
refs: action.act,
|
|
282
|
+
portrayals: {},
|
|
283
|
+
viewer: { userId: "" },
|
|
284
|
+
item: false
|
|
285
|
+
});
|
|
286
|
+
return heard.ok ? "" : i18nText(heard.sentence) ?? "";
|
|
287
|
+
}
|
|
288
|
+
var off = (...conditions) => {
|
|
289
|
+
for (const [holds, reason] of conditions)
|
|
290
|
+
if (holds)
|
|
291
|
+
return {
|
|
292
|
+
shown: true,
|
|
293
|
+
disabled: true,
|
|
294
|
+
...reason ? { reason } : {}
|
|
295
|
+
};
|
|
296
|
+
return { shown: true, disabled: false };
|
|
297
|
+
};
|
|
298
|
+
function enabledWhenState(ctx, opts = {}) {
|
|
299
|
+
if (ctx.enabled === false)
|
|
300
|
+
return [true, ctx.reason];
|
|
301
|
+
if (!ctx.itemPredicates?.length)
|
|
302
|
+
return [false, void 0];
|
|
303
|
+
const doc = {
|
|
304
|
+
item: itemValuesOf({
|
|
305
|
+
id: ctx.msg.id ?? 0,
|
|
306
|
+
isHidden: ctx.msg.isHidden,
|
|
307
|
+
isGenerating: ctx.msg.isGenerating,
|
|
308
|
+
role: ctx.msg.role,
|
|
309
|
+
channel: ctx.msg.channel,
|
|
310
|
+
characterId: ctx.msg.characterId,
|
|
311
|
+
personaId: ctx.msg.personaId,
|
|
312
|
+
metadata: ctx.msg.metadata
|
|
313
|
+
}, { isNewest: ctx.isLastMessage, mine: ctx.canControl })
|
|
314
|
+
};
|
|
315
|
+
const heard = enablementVerdict.judge({ preds: ctx.itemPredicates, doc });
|
|
316
|
+
if (heard.ok)
|
|
317
|
+
return [false, void 0];
|
|
318
|
+
return [true, (opts.statusText ?? statusText)({ i18n: heard.sentence }) || (i18nText(heard.sentence) ?? "")];
|
|
319
|
+
}
|
|
320
|
+
function coreVerbState(key, ctx) {
|
|
321
|
+
const m = ctx.msg;
|
|
322
|
+
const R = VERB_REASONS;
|
|
323
|
+
const when = enabledWhenState(ctx);
|
|
324
|
+
const busy = [when, [ctx.editing, R.editing]];
|
|
325
|
+
const shown = (visible, state) => visible ? state : { ...state, shown: false };
|
|
326
|
+
switch (key) {
|
|
327
|
+
case "stop":
|
|
328
|
+
return { shown: !!m.isGenerating, disabled: false };
|
|
329
|
+
case "retry":
|
|
330
|
+
return shown(isReply(m) && ctx.isLastMessage && !m.isGenerating, off([!ctx.canControl, R.notYours], when));
|
|
331
|
+
case "extend":
|
|
332
|
+
return shown(isReply(m) && ctx.isLastMessage && !m.isGenerating && !!m.content, off([!ctx.canControl, R.notYours], [!!ctx.extendRefusal, ctx.extendRefusal], ...busy));
|
|
333
|
+
case "edit":
|
|
334
|
+
return off([!ctx.canControl, R.notYours], ...busy);
|
|
335
|
+
case "branch":
|
|
336
|
+
return off([!ctx.canAct, ctx.canAct ? void 0 : notYoursToUse(ctx.action)], ...busy);
|
|
337
|
+
case "swipe":
|
|
338
|
+
return shown(isReply(m) && !m.isGenerating, off([!ctx.canControl, R.notYours], [ctx.editing, R.editing], when));
|
|
339
|
+
case "hide":
|
|
340
|
+
case "delete":
|
|
341
|
+
return off([!ctx.canControl, R.notYours], ...busy);
|
|
342
|
+
default: {
|
|
343
|
+
const notMine = !ctx.canAct || !!ctx.itemGated && !ctx.canControl;
|
|
344
|
+
return shown(!m.isGenerating, off(
|
|
345
|
+
[notMine, notMine ? notYoursToUse(ctx.action) : void 0],
|
|
346
|
+
...busy,
|
|
347
|
+
// A contributed action declares no busy rule of its own
|
|
348
|
+
// unless its author wrote one; the composer's guard
|
|
349
|
+
// (nothing runs while a reply streams, S5) holds here too.
|
|
350
|
+
[ctx.hasGeneratingMessage, R.generating]
|
|
351
|
+
));
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
var verbKeyOf = (a) => a.specSlug === "core" ? a.key : `contributed:${a.key}`;
|
|
356
|
+
var verdictOf = (a) => ({
|
|
357
|
+
canAct: a.canAct,
|
|
358
|
+
itemGated: a.itemGated,
|
|
359
|
+
action: { name: a.name, act: a.audience.act },
|
|
360
|
+
...a.enabled !== void 0 ? { enabled: a.enabled } : {},
|
|
361
|
+
...a.reason ? { reason: statusText(a.reason) || a.reason.i18n.en } : {},
|
|
362
|
+
...a.itemPredicates?.length ? { itemPredicates: a.itemPredicates } : {}
|
|
363
|
+
});
|
|
364
|
+
function quickRowActions(primary, ctx) {
|
|
365
|
+
return primary.filter((a) => !(a.specSlug === "core" && a.key === "stop")).map((a) => ({
|
|
366
|
+
action: a,
|
|
367
|
+
state: coreVerbState(verbKeyOf(a), { ...ctx, ...verdictOf(a) })
|
|
368
|
+
})).filter((q) => q.state.shown && !q.state.disabled);
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
// dist/shared/ui/conversation/slashPalette.js
|
|
372
|
+
function slashQueryOf(draft) {
|
|
373
|
+
const m = /^\/([^\s]*)$/.exec(draft);
|
|
374
|
+
return m ? m[1] : null;
|
|
375
|
+
}
|
|
376
|
+
function parseSlashCommand(draft) {
|
|
377
|
+
const m = /^\/([^\s]+)(?:\s+([\s\S]*))?$/.exec(draft);
|
|
378
|
+
if (!m)
|
|
379
|
+
return null;
|
|
380
|
+
const argument = m[2]?.trim() ?? "";
|
|
381
|
+
return { name: m[1], argument: argument || null };
|
|
382
|
+
}
|
|
383
|
+
function exactSlashCommand(actions, draft) {
|
|
384
|
+
const parsed = parseSlashCommand(draft);
|
|
385
|
+
if (!parsed)
|
|
386
|
+
return void 0;
|
|
387
|
+
const name = parsed.name.toLowerCase();
|
|
388
|
+
const action = dedupePaletteActions(actions).find((a) => a.slash.toLowerCase() === name);
|
|
389
|
+
return action ? { action, argument: parsed.argument } : void 0;
|
|
390
|
+
}
|
|
391
|
+
function slashArgumentHint(a) {
|
|
392
|
+
const text = a.collects?.text;
|
|
393
|
+
if (!text)
|
|
394
|
+
return void 0;
|
|
395
|
+
const label = text.label.trim().replace(/[.?!:…]+$/u, "");
|
|
396
|
+
const word = label ? label.charAt(0).toLowerCase() + label.slice(1) : "text";
|
|
397
|
+
return text.need === "optional" ? `[<${word}>]` : `<${word}>`;
|
|
398
|
+
}
|
|
399
|
+
function slashArgumentRefusal(a, argument) {
|
|
400
|
+
if (!argument?.trim() || a.collects?.text)
|
|
401
|
+
return null;
|
|
402
|
+
return `/${a.slash} takes no text`;
|
|
403
|
+
}
|
|
404
|
+
function dedupePaletteActions(actions) {
|
|
405
|
+
const rows = /* @__PURE__ */ new Map();
|
|
406
|
+
for (const a of actions) {
|
|
407
|
+
const held = rows.get(a.slash);
|
|
408
|
+
if (!held) {
|
|
409
|
+
rows.set(a.slash, a);
|
|
410
|
+
continue;
|
|
411
|
+
}
|
|
412
|
+
if (held.specSlug !== CORE_ACTION_SPEC_ID && a.specSlug === CORE_ACTION_SPEC_ID)
|
|
413
|
+
rows.set(a.slash, a);
|
|
414
|
+
}
|
|
415
|
+
return [...rows.values()];
|
|
416
|
+
}
|
|
417
|
+
function filterPaletteActions(actions, query) {
|
|
418
|
+
const q = query.trim().toLowerCase();
|
|
419
|
+
const unique = dedupePaletteActions(actions);
|
|
420
|
+
if (!q)
|
|
421
|
+
return unique;
|
|
422
|
+
const byName = unique.filter((a) => a.slash.toLowerCase().startsWith(q));
|
|
423
|
+
const byLabel = unique.filter((a) => !a.slash.toLowerCase().startsWith(q) && (a.name.toLowerCase().includes(q) || a.slash.toLowerCase().includes(q)));
|
|
424
|
+
return [...byName, ...byLabel];
|
|
425
|
+
}
|
|
426
|
+
function exactPaletteMatch(actions, draft) {
|
|
427
|
+
const q = slashQueryOf(draft);
|
|
428
|
+
if (!q)
|
|
429
|
+
return void 0;
|
|
430
|
+
return dedupePaletteActions(actions).find((a) => a.slash.toLowerCase() === q.toLowerCase());
|
|
431
|
+
}
|
|
432
|
+
function paletteRowState(a, opts) {
|
|
433
|
+
if (!a.canAct)
|
|
434
|
+
return { disabled: true, reason: notYoursToUse({ name: a.name, act: a.audience.act }) };
|
|
435
|
+
if (a.enabled === false)
|
|
436
|
+
return { disabled: true, ...a.reason ? { reason: a.reason } : {} };
|
|
437
|
+
if (a.itemPredicates?.length && opts.newest !== void 0) {
|
|
438
|
+
const actsOn = a.venue === "extra" ? opts.newest : null;
|
|
439
|
+
const heard = enablementVerdict.judge({
|
|
440
|
+
preds: a.itemPredicates,
|
|
441
|
+
doc: actsOn ? { item: actsOn } : {}
|
|
442
|
+
});
|
|
443
|
+
if (!heard.ok)
|
|
444
|
+
return {
|
|
445
|
+
disabled: true,
|
|
446
|
+
reason: (opts.statusText ?? statusText)({ i18n: heard.sentence }) || (i18nText(heard.sentence) ?? "")
|
|
447
|
+
};
|
|
448
|
+
}
|
|
449
|
+
if (opts.generating)
|
|
450
|
+
return { disabled: true, reason: VERB_REASONS.generating };
|
|
451
|
+
return { disabled: false };
|
|
452
|
+
}
|
|
453
|
+
function stepHighlight(current, count, delta) {
|
|
454
|
+
if (count <= 0)
|
|
455
|
+
return -1;
|
|
456
|
+
if (current < 0)
|
|
457
|
+
return delta === 1 ? 0 : count - 1;
|
|
458
|
+
return (current + delta + count) % count;
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
export {
|
|
462
|
+
defineVerdict,
|
|
463
|
+
statusTextIn,
|
|
464
|
+
setStatusTextResolver,
|
|
465
|
+
enabledWhenState,
|
|
466
|
+
coreVerbState,
|
|
467
|
+
verbKeyOf,
|
|
468
|
+
verdictOf,
|
|
469
|
+
quickRowActions,
|
|
470
|
+
slashQueryOf,
|
|
471
|
+
exactSlashCommand,
|
|
472
|
+
slashArgumentHint,
|
|
473
|
+
slashArgumentRefusal,
|
|
474
|
+
filterPaletteActions,
|
|
475
|
+
exactPaletteMatch,
|
|
476
|
+
paletteRowState,
|
|
477
|
+
stepHighlight
|
|
478
|
+
};
|