rpg-engine 0.7.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adventures/index.d.ts +1 -1
- package/dist/adventures/index.js +1 -1
- package/dist/adventures/source.js +13 -13
- package/dist/campaign/create-campaign.js +10 -1
- package/dist/campaign/host-files.d.ts +2 -1
- package/dist/campaign/host-files.js +11 -11
- package/dist/campaign/index.d.ts +1 -1
- package/dist/campaign/index.js +1 -1
- package/dist/campaign/settings.d.ts +55 -64
- package/dist/campaign/settings.js +171 -174
- package/dist/{cli.js → cli/cli.js} +3 -3
- package/dist/{command-line.d.ts → cli/command-line.d.ts} +1 -1
- package/dist/{command-line.js → cli/command-line.js} +21 -20
- package/dist/commands/advance.d.ts +1 -1
- package/dist/commands/advance.js +7 -7
- package/dist/commands/ask.d.ts +1 -8
- package/dist/commands/ask.js +16 -29
- package/dist/commands/{change.d.ts → change/change.d.ts} +2 -2
- package/dist/commands/{change.js → change/change.js} +46 -52
- package/dist/commands/{game-damage.d.ts → change/damage.d.ts} +2 -2
- package/dist/commands/{game-damage.js → change/damage.js} +3 -3
- package/dist/commands/{game-recipe-pace.d.ts → change/recipe-pace.d.ts} +2 -2
- package/dist/commands/{game-recipe-pace.js → change/recipe-pace.js} +4 -4
- package/dist/commands/config.d.ts +4 -4
- package/dist/commands/config.js +142 -138
- package/dist/commands/effect.d.ts +1 -1
- package/dist/commands/effect.js +11 -12
- package/dist/commands/find.d.ts +4 -4
- package/dist/commands/find.js +2 -2
- package/dist/commands/image.js +6 -6
- package/dist/commands/{import.d.ts → import/import.d.ts} +2 -2
- package/dist/commands/{import.js → import/import.js} +101 -101
- package/dist/commands/{game-import.d.ts → import/run.d.ts} +3 -3
- package/dist/commands/{game-import.js → import/run.js} +13 -12
- package/dist/commands/index.js +7 -7
- package/dist/commands/init.js +3 -3
- package/dist/commands/install.js +1 -1
- package/dist/commands/instructions.js +6 -6
- package/dist/commands/mode.d.ts +2 -2
- package/dist/commands/mode.js +8 -8
- package/dist/commands/mood.js +4 -4
- package/dist/commands/move.js +13 -20
- package/dist/commands/package.d.ts +2 -2
- package/dist/commands/package.js +138 -93
- package/dist/commands/rename.js +3 -3
- package/dist/commands/reveal.js +29 -18
- package/dist/commands/{roll.d.ts → roll/roll.d.ts} +4 -4
- package/dist/commands/{roll.js → roll/roll.js} +69 -69
- package/dist/commands/{game-tables.d.ts → roll/tables.d.ts} +2 -2
- package/dist/commands/{game-tables.js → roll/tables.js} +4 -4
- package/dist/commands/rules.d.ts +2 -2
- package/dist/commands/rules.js +3 -3
- package/dist/commands/save.d.ts +1 -1
- package/dist/commands/save.js +18 -18
- package/dist/commands/scene.d.ts +4 -4
- package/dist/commands/scene.js +31 -28
- package/dist/commands/{game-advance.d.ts → shared/advance.d.ts} +4 -4
- package/dist/commands/{game-advance.js → shared/advance.js} +27 -27
- package/dist/commands/{game-adventures.d.ts → shared/adventures.d.ts} +3 -3
- package/dist/commands/{game-adventures.js → shared/adventures.js} +20 -27
- package/dist/commands/{game-bonds.d.ts → shared/bonds.d.ts} +3 -3
- package/dist/commands/{game-bonds.js → shared/bonds.js} +2 -2
- package/dist/commands/{game-checks.d.ts → shared/checks.d.ts} +3 -3
- package/dist/commands/{game-checks.js → shared/checks.js} +7 -7
- package/dist/commands/{game-dice-pool.d.ts → shared/dice-pool.d.ts} +3 -3
- package/dist/commands/{game-dice-pool.js → shared/dice-pool.js} +19 -12
- package/dist/commands/{effect-layer.d.ts → shared/effect-layer.d.ts} +2 -2
- package/dist/commands/{effect-layer.js → shared/effect-layer.js} +12 -12
- package/dist/commands/{game-effects.d.ts → shared/effects.d.ts} +7 -7
- package/dist/commands/{game-effects.js → shared/effects.js} +19 -19
- package/dist/commands/{game-environment.d.ts → shared/environment.d.ts} +1 -1
- package/dist/commands/{game-environment.js → shared/environment.js} +3 -3
- package/dist/commands/{game-events.d.ts → shared/events.d.ts} +5 -5
- package/dist/commands/{game-events.js → shared/events.js} +20 -22
- package/dist/commands/{game-examples.d.ts → shared/examples.d.ts} +4 -8
- package/dist/commands/{game-examples.js → shared/examples.js} +23 -23
- package/dist/commands/{game-experience.d.ts → shared/experience.d.ts} +2 -2
- package/dist/commands/{game-experience.js → shared/experience.js} +8 -11
- package/dist/commands/{game-grid-moves.d.ts → shared/grid-moves.d.ts} +6 -6
- package/dist/commands/{game-grid-moves.js → shared/grid-moves.js} +5 -5
- package/dist/commands/{game-grids.d.ts → shared/grids.d.ts} +4 -9
- package/dist/commands/{game-grids.js → shared/grids.js} +20 -19
- package/dist/commands/{game-images.d.ts → shared/images.d.ts} +3 -3
- package/dist/commands/{game-images.js → shared/images.js} +7 -6
- package/dist/commands/shared/inputs.d.ts +9 -0
- package/dist/commands/shared/inputs.js +12 -0
- package/dist/commands/{game-journey.d.ts → shared/journey.d.ts} +4 -6
- package/dist/commands/{game-journey.js → shared/journey.js} +13 -15
- package/dist/commands/{game-knowledge.d.ts → shared/knowledge.d.ts} +15 -8
- package/dist/commands/{game-knowledge.js → shared/knowledge.js} +42 -42
- package/dist/{library-reader.js → commands/shared/library-reader.js} +4 -4
- package/dist/commands/{game-library.d.ts → shared/library.d.ts} +7 -4
- package/dist/commands/{game-library.js → shared/library.js} +70 -50
- package/dist/commands/{game-limits.d.ts → shared/limits.d.ts} +3 -3
- package/dist/commands/{game-limits.js → shared/limits.js} +3 -3
- package/dist/commands/{game-loot.d.ts → shared/loot.d.ts} +2 -2
- package/dist/commands/{game-loot.js → shared/loot.js} +3 -3
- package/dist/commands/{game-master-rolls.d.ts → shared/master-rolls.d.ts} +2 -2
- package/dist/commands/{game-master-rolls.js → shared/master-rolls.js} +6 -6
- package/dist/commands/{game-mode.d.ts → shared/mode.d.ts} +4 -6
- package/dist/commands/{game-mode.js → shared/mode.js} +10 -10
- package/dist/commands/{game-money.d.ts → shared/money.d.ts} +3 -3
- package/dist/commands/{game-money.js → shared/money.js} +4 -4
- package/dist/commands/{game-moods.d.ts → shared/moods.d.ts} +3 -3
- package/dist/commands/{game-moods.js → shared/moods.js} +3 -3
- package/dist/commands/{game-moves.d.ts → shared/moves.d.ts} +2 -2
- package/dist/commands/{game-moves.js → shared/moves.js} +5 -5
- package/dist/commands/{game-offers.d.ts → shared/offers.d.ts} +3 -3
- package/dist/commands/{game-offers.js → shared/offers.js} +9 -12
- package/dist/commands/{game-outside.d.ts → shared/outside.d.ts} +3 -3
- package/dist/commands/{game-outside.js → shared/outside.js} +9 -9
- package/dist/commands/{game-catalog.d.ts → shared/packages/catalog.d.ts} +1 -3
- package/dist/commands/{game-catalog.js → shared/packages/catalog.js} +17 -22
- package/dist/commands/{game-package-code.d.ts → shared/packages/code.d.ts} +10 -14
- package/dist/commands/{game-package-code.js → shared/packages/code.js} +156 -59
- package/dist/commands/{game-extension-list.d.ts → shared/packages/extensions.d.ts} +6 -6
- package/dist/commands/{game-extension-list.js → shared/packages/extensions.js} +43 -22
- package/dist/commands/{game-package-hooks.d.ts → shared/packages/hooks.d.ts} +3 -3
- package/dist/commands/{game-package-hooks.js → shared/packages/hooks.js} +3 -3
- package/dist/commands/{game-widgets.d.ts → shared/packages/widgets.d.ts} +6 -10
- package/dist/commands/{game-widgets.js → shared/packages/widgets.js} +57 -57
- package/dist/commands/{page-counters.d.ts → shared/page-counters.d.ts} +3 -3
- package/dist/commands/{page-counters.js → shared/page-counters.js} +5 -5
- package/dist/{page-words.d.ts → commands/shared/page-words.d.ts} +2 -2
- package/dist/{page-words.js → commands/shared/page-words.js} +5 -4
- package/dist/commands/{parts.d.ts → shared/parts.d.ts} +3 -3
- package/dist/commands/{parts.js → shared/parts.js} +4 -4
- package/dist/commands/{game-positions.d.ts → shared/positions.d.ts} +3 -5
- package/dist/commands/{game-positions.js → shared/positions.js} +6 -7
- package/dist/commands/{problems.d.ts → shared/problems.d.ts} +3 -3
- package/dist/commands/{problems.js → shared/problems.js} +21 -22
- package/dist/commands/{progression.d.ts → shared/progression.d.ts} +2 -2
- package/dist/commands/{progression.js → shared/progression.js} +4 -4
- package/dist/commands/{game-quests.d.ts → shared/quests.d.ts} +4 -4
- package/dist/commands/{game-quests.js → shared/quests.js} +6 -6
- package/dist/commands/{game-recipes.d.ts → shared/recipes.d.ts} +3 -3
- package/dist/commands/{game-recipes.js → shared/recipes.js} +3 -3
- package/dist/commands/{game-reminders.d.ts → shared/reminders.d.ts} +4 -4
- package/dist/commands/{game-reminders.js → shared/reminders.js} +4 -4
- package/dist/commands/{game-roads.d.ts → shared/roads.d.ts} +5 -5
- package/dist/commands/{game-roads.js → shared/roads.js} +43 -44
- package/dist/commands/{game-rules.d.ts → shared/rules.d.ts} +2 -2
- package/dist/commands/{game-rules.js → shared/rules.js} +4 -4
- package/dist/commands/{game-saves.d.ts → shared/saves.d.ts} +4 -4
- package/dist/commands/{game-saves.js → shared/saves.js} +51 -51
- package/dist/commands/{game-scene.d.ts → shared/scene.d.ts} +13 -3
- package/dist/commands/{game-scene.js → shared/scene.js} +41 -13
- package/dist/commands/{sheet.d.ts → shared/sheet.d.ts} +5 -5
- package/dist/commands/{sheet.js → shared/sheet.js} +76 -76
- package/dist/commands/{game-stacks.d.ts → shared/stacks.d.ts} +2 -9
- package/dist/commands/{game-stacks.js → shared/stacks.js} +22 -22
- package/dist/commands/{game-theme.d.ts → shared/theme.d.ts} +3 -3
- package/dist/commands/{game-theme.js → shared/theme.js} +2 -2
- package/dist/commands/{game-thoughts.d.ts → shared/thoughts.d.ts} +2 -4
- package/dist/commands/{game-thoughts.js → shared/thoughts.js} +6 -8
- package/dist/commands/{game-thresholds.d.ts → shared/thresholds.d.ts} +1 -1
- package/dist/commands/{game-thresholds.js → shared/thresholds.js} +4 -4
- package/dist/commands/{game-time.d.ts → shared/time.d.ts} +4 -4
- package/dist/commands/{game-time.js → shared/time.js} +6 -6
- package/dist/commands/{game-turn-uses.d.ts → shared/turn-uses.d.ts} +3 -3
- package/dist/commands/{game-turn-uses.js → shared/turn-uses.js} +12 -15
- package/dist/commands/{game-upkeep.d.ts → shared/upkeep.d.ts} +3 -3
- package/dist/commands/{game-upkeep.js → shared/upkeep.js} +69 -57
- package/dist/commands/{game-voices.d.ts → shared/voices.d.ts} +1 -1
- package/dist/commands/{game-voices.js → shared/voices.js} +2 -2
- package/dist/commands/{worked-out.d.ts → shared/worked-out.d.ts} +3 -8
- package/dist/commands/{worked-out.js → shared/worked-out.js} +238 -238
- package/dist/commands/{game-world.d.ts → shared/world.d.ts} +5 -14
- package/dist/commands/{game-world.js → shared/world.js} +72 -76
- package/dist/commands/show.d.ts +1 -1
- package/dist/commands/show.js +32 -17
- package/dist/commands/status.d.ts +1 -1
- package/dist/commands/status.js +28 -28
- package/dist/commands/thoughts.js +3 -3
- package/dist/commands/trade.js +9 -10
- package/dist/commands/translate.d.ts +1 -1
- package/dist/commands/translate.js +3 -3
- package/dist/commands/{game-open.d.ts → travel/open.d.ts} +3 -3
- package/dist/commands/{game-open.js → travel/open.js} +4 -5
- package/dist/commands/{route.d.ts → travel/route.d.ts} +1 -1
- package/dist/commands/{route.js → travel/route.js} +9 -10
- package/dist/commands/{travel.d.ts → travel/travel.d.ts} +2 -2
- package/dist/commands/{travel.js → travel/travel.js} +19 -21
- package/dist/commands/validate.js +5 -5
- package/dist/commands/{game-view-journal.d.ts → view/journal.d.ts} +5 -5
- package/dist/commands/{game-view-journal.js → view/journal.js} +5 -5
- package/dist/commands/{game-view-map.d.ts → view/map.d.ts} +3 -3
- package/dist/commands/{game-view-map.js → view/map.js} +15 -16
- package/dist/commands/{game-view-place.d.ts → view/place.d.ts} +6 -6
- package/dist/commands/{game-view-place.js → view/place.js} +108 -108
- package/dist/commands/{view.d.ts → view/view.d.ts} +16 -16
- package/dist/commands/{view.js → view/view.js} +35 -35
- package/dist/commands/{game-view-world.d.ts → view/world.d.ts} +4 -4
- package/dist/commands/{game-view-world.js → view/world.js} +7 -7
- package/dist/commands/{game-here.d.ts → write/here.d.ts} +5 -3
- package/dist/commands/{game-here.js → write/here.js} +18 -12
- package/dist/commands/{write.d.ts → write/write.d.ts} +6 -6
- package/dist/commands/{write.js → write/write.js} +44 -41
- package/dist/confirm/confirm.d.ts +2 -0
- package/dist/confirm/confirm.js +15 -5
- package/dist/core/consents.d.ts +3 -2
- package/dist/core/consents.js +43 -4
- package/dist/core/context.d.ts +8 -6
- package/dist/core/context.js +4 -2
- package/dist/core/download.js +16 -5
- package/dist/core/files.d.ts +6 -1
- package/dist/core/files.js +47 -21
- package/dist/core/formula.d.ts +7 -2
- package/dist/core/formula.js +63 -66
- package/dist/core/instruction-parts.js +1 -1
- package/dist/core/mood.d.ts +0 -1
- package/dist/core/mood.js +3 -3
- package/dist/core/package-api.d.ts +11 -0
- package/dist/core/package-api.js +2 -1
- package/dist/core/package-declarations.d.ts +9 -9
- package/dist/core/package-declarations.js +3 -3
- package/dist/core/process-mark.d.ts +8 -0
- package/dist/core/process-mark.js +72 -0
- package/dist/core/registry.d.ts +5 -0
- package/dist/core/registry.js +10 -0
- package/dist/core/session-store.d.ts +0 -1
- package/dist/core/session-store.js +11 -14
- package/dist/core/store.d.ts +4 -0
- package/dist/core/store.js +29 -8
- package/dist/core/text.d.ts +4 -0
- package/dist/core/text.js +11 -2
- package/dist/core/yaml-file.js +2 -2
- package/dist/dashboard/{acts.js → acts/acts.js} +2 -2
- package/dist/dashboard/{act-names.js → acts/names.js} +1 -1
- package/dist/dashboard/{act-sheet.js → acts/sheet.js} +3 -3
- package/dist/dashboard/{act-strip.js → acts/strip.js} +2 -2
- package/dist/dashboard/app.js +13 -13
- package/dist/dashboard/asked.js +1 -1
- package/dist/dashboard/dice/burn.js +1 -1
- package/dist/dashboard/dice/stage.js +1 -1
- package/dist/dashboard/{guide-blocks.js → help/blocks.js} +1 -1
- package/dist/dashboard/{help.js → help/help.js} +6 -6
- package/dist/dashboard/journal.js +1 -1
- package/dist/dashboard/kit.js +6 -5
- package/dist/dashboard/labels.js +7 -3
- package/dist/dashboard/markdown.js +1 -1
- package/dist/dashboard/{ask-card.js → packages/ask-card.js} +6 -6
- package/dist/dashboard/{package-page.js → packages/package-page.js} +3 -3
- package/dist/dashboard/{packages.js → packages/packages.js} +12 -12
- package/dist/dashboard/{page-code.js → packages/page-code.js} +4 -4
- package/dist/dashboard/{extension-widgets.js → packages/widgets.js} +5 -5
- package/dist/dashboard/party.js +1 -1
- package/dist/dashboard/person-panel.js +2 -13
- package/dist/dashboard/{map-sheet.js → place/map-sheet.js} +4 -4
- package/dist/dashboard/{place-map-view.js → place/map-view.js} +11 -11
- package/dist/dashboard/scene.js +4 -4
- package/dist/dashboard/settings.js +1 -1
- package/dist/dashboard/sheet.js +3 -3
- package/dist/dashboard/top.js +2 -2
- package/dist/dashboard/turns.js +2 -2
- package/dist/dashboard/widgets.js +1 -1
- package/dist/dashboard/{world-calendar.js → world/calendar.js} +7 -7
- package/dist/dashboard/{lore.js → world/known.js} +1 -1
- package/dist/dashboard/{world-lore.js → world/lore.js} +9 -9
- package/dist/dashboard/{world-map.js → world/map.js} +1 -1
- package/dist/dashboard/{world.js → world/world.js} +14 -14
- package/dist/dice/evaluate.js +1 -1
- package/dist/dice/index.d.ts +2 -2
- package/dist/dice/index.js +2 -2
- package/dist/dice/notation.d.ts +2 -0
- package/dist/dice/notation.js +22 -4
- package/dist/documents/markup.js +2 -2
- package/dist/documents/read.js +29 -13
- package/dist/effects/effect.js +2 -5
- package/dist/extensions/extension.js +6 -8
- package/dist/extensions/index.d.ts +1 -4
- package/dist/extensions/index.js +1 -4
- package/dist/extensions/words.js +2 -1
- package/dist/{pictures → helpers}/briefs.js +17 -14
- package/dist/{pictures → helpers}/claude.js +8 -18
- package/dist/{pictures → helpers}/codex.js +3 -15
- package/dist/helpers/index.d.ts +7 -0
- package/dist/helpers/index.js +9 -0
- package/dist/{pictures/helpers.d.ts → helpers/programs.d.ts} +6 -1
- package/dist/{pictures/helpers.js → helpers/programs.js} +16 -2
- package/dist/images/images.js +7 -5
- package/dist/images/index.d.ts +1 -1
- package/dist/images/index.js +1 -1
- package/dist/importer/index.d.ts +1 -1
- package/dist/importer/index.js +1 -1
- package/dist/importer/work.d.ts +0 -2
- package/dist/importer/work.js +9 -30
- package/dist/instructions/index.d.ts +2 -0
- package/dist/instructions/index.js +10 -0
- package/dist/languages/index.d.ts +1 -1
- package/dist/languages/index.js +1 -1
- package/dist/languages/language-pack.js +15 -3
- package/dist/library/books.js +29 -83
- package/dist/{extensions → packages}/engine.d.ts +1 -1
- package/dist/{extensions → packages}/engine.js +1 -1
- package/dist/packages/index.d.ts +3 -0
- package/dist/packages/index.js +4 -0
- package/dist/{extensions/packages.d.ts → packages/npm.d.ts} +2 -0
- package/dist/{extensions/packages.js → packages/npm.js} +74 -45
- package/dist/page.d.ts +9 -11
- package/dist/page.js +1 -2
- package/dist/pages/check.js +31 -40
- package/dist/pages/containers.js +20 -20
- package/dist/pages/environment.js +15 -15
- package/dist/pages/index.d.ts +9 -9
- package/dist/pages/index.js +9 -9
- package/dist/pages/inheritance.d.ts +2 -1
- package/dist/pages/inheritance.js +24 -24
- package/dist/pages/load.js +7 -7
- package/dist/pages/maps.d.ts +20 -0
- package/dist/pages/maps.js +51 -1
- package/dist/pages/markdown.d.ts +2 -0
- package/dist/pages/markdown.js +110 -79
- package/dist/pages/page-file.d.ts +2 -1
- package/dist/pages/page-file.js +31 -29
- package/dist/pages/rename-page.d.ts +4 -1
- package/dist/pages/rename-page.js +7 -3
- package/dist/pages/{stack-entry.d.ts → stacks/entry.d.ts} +0 -2
- package/dist/pages/{stack-entry.js → stacks/entry.js} +2 -6
- package/dist/pages/{stacks.d.ts → stacks/kinds.d.ts} +8 -1
- package/dist/pages/{stacks.js → stacks/kinds.js} +36 -41
- package/dist/pages/{stack-writes.d.ts → stacks/writes.d.ts} +2 -2
- package/dist/pages/{stack-writes.js → stacks/writes.js} +32 -32
- package/dist/pages/system-pages.js +15 -15
- package/dist/pages/world.js +25 -19
- package/dist/pages/write-page.js +35 -34
- package/dist/player-notes/index.d.ts +1 -1
- package/dist/player-notes/index.js +1 -1
- package/dist/rules/page-search.js +3 -4
- package/dist/rules/rule-book.js +1 -1
- package/dist/rules/search.js +21 -21
- package/dist/rules/shown.js +1 -3
- package/dist/saves/saves.d.ts +2 -2
- package/dist/saves/saves.js +15 -3
- package/dist/{bell-listener.js → server/bell-listener.js} +3 -3
- package/dist/server/dashboard/files.d.ts +59 -0
- package/dist/server/dashboard/files.js +326 -0
- package/dist/server/dashboard/index.d.ts +114 -0
- package/dist/server/dashboard/index.js +419 -0
- package/dist/server/dashboard/news.d.ts +39 -0
- package/dist/server/dashboard/news.js +390 -0
- package/dist/server/dashboard/player.d.ts +48 -0
- package/dist/server/dashboard/player.js +242 -0
- package/dist/server/dashboard/ports.d.ts +10 -0
- package/dist/server/dashboard/ports.js +15 -0
- package/dist/server/dashboard/writes.d.ts +58 -0
- package/dist/server/dashboard/writes.js +492 -0
- package/dist/{mcp-server.d.ts → server/mcp.d.ts} +2 -2
- package/dist/{mcp-server.js → server/mcp.js} +57 -42
- package/dist/systems/game-system.d.ts +5 -3
- package/dist/systems/game-system.js +178 -149
- package/dist/systems/index.d.ts +1 -1
- package/dist/systems/index.js +1 -1
- package/dist/{testing.d.ts → testing/index.d.ts} +6 -6
- package/dist/{testing.js → testing/index.js} +32 -18
- package/dist/{system-checks.js → testing/system-checks.js} +18 -12
- package/dist/themes/theme.d.ts +3 -3
- package/dist/themes/theme.js +14 -14
- package/dist/time/calendar.js +5 -2
- package/dist/triggers/trigger.js +5 -8
- package/instructions/dashboard-guide.md +2 -1
- package/instructions/play.md +1 -1
- package/package.json +5 -5
- package/dist/commands/game-maps.d.ts +0 -20
- package/dist/commands/game-maps.js +0 -51
- package/dist/dashboard-server.d.ts +0 -47
- package/dist/dashboard-server.js +0 -1830
- package/dist/pictures/index.d.ts +0 -7
- package/dist/pictures/index.js +0 -9
- /package/dist/{cli.d.ts → cli/cli.d.ts} +0 -0
- /package/dist/{library-reader.d.ts → commands/shared/library-reader.d.ts} +0 -0
- /package/dist/commands/{notes.d.ts → shared/notes.d.ts} +0 -0
- /package/dist/commands/{notes.js → shared/notes.js} +0 -0
- /package/dist/dashboard/{guide-markdown.js → help/markdown.js} +0 -0
- /package/dist/dashboard/{pack-card.js → packages/card.js} +0 -0
- /package/dist/dashboard/{people.js → packages/people.js} +0 -0
- /package/dist/dashboard/{place-map.js → place/map.js} +0 -0
- /package/dist/dashboard/{calendar.js → world/days.js} +0 -0
- /package/dist/{pictures → helpers}/briefs.d.ts +0 -0
- /package/dist/{pictures → helpers}/chosen.d.ts +0 -0
- /package/dist/{pictures → helpers}/chosen.js +0 -0
- /package/dist/{pictures → helpers}/claude.d.ts +0 -0
- /package/dist/{pictures → helpers}/codex.d.ts +0 -0
- /package/dist/{pictures → helpers}/stop.d.ts +0 -0
- /package/dist/{pictures → helpers}/stop.js +0 -0
- /package/dist/{pictures → helpers}/svg.d.ts +0 -0
- /package/dist/{pictures → helpers}/svg.js +0 -0
- /package/dist/{extensions → packages}/tarball.d.ts +0 -0
- /package/dist/{extensions → packages}/tarball.js +0 -0
- /package/dist/{bell-listener.d.ts → server/bell-listener.d.ts} +0 -0
- /package/dist/{player-acts.d.ts → server/player-acts.d.ts} +0 -0
- /package/dist/{player-acts.js → server/player-acts.js} +0 -0
- /package/dist/{system-checks.d.ts → testing/system-checks.d.ts} +0 -0
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { appendLogEntry } from "
|
|
2
|
-
import { comparableText } from "
|
|
3
|
-
import { formatPosition, pagesWithName, readStops, withPage, writePage } from "
|
|
4
|
-
import { journeyPoint, journeyStart, moversMap, moversNamed, readJourney, saveJourney } from "
|
|
5
|
-
import { movePages } from "
|
|
6
|
-
import { positionFromWrite, regionAt } from "
|
|
7
|
-
import { lengthText, roadsOf } from "
|
|
8
|
-
import { newDatedLogEntry } from "
|
|
1
|
+
import { appendLogEntry } from "../../core/log.js";
|
|
2
|
+
import { comparableText } from "../../core/text.js";
|
|
3
|
+
import { formatPosition, pagesWithName, readStops, withPage, writePage } from "../../pages/index.js";
|
|
4
|
+
import { journeyPoint, journeyStart, moversMap, moversNamed, readJourney, saveJourney } from "../shared/journey.js";
|
|
5
|
+
import { movePages } from "../shared/moves.js";
|
|
6
|
+
import { positionFromWrite, regionAt } from "../shared/positions.js";
|
|
7
|
+
import { lengthText, roadsOf } from "../shared/roads.js";
|
|
8
|
+
import { newDatedLogEntry } from "../shared/time.js";
|
|
9
9
|
/**
|
|
10
10
|
* Where the journey stopped, for a place written `here` (TRV-14): refused for a page that exists or is not a place, with a position given too, or without a
|
|
11
11
|
* journey stopped between two places, with how to write a place inside another.
|
|
@@ -24,7 +24,9 @@ export function hereOf(root, world, name, existing, type, change) {
|
|
|
24
24
|
if (journey === undefined || (on === undefined && at === undefined)) {
|
|
25
25
|
throw new Error(`here is where a journey stopped, on a road or in the open, and none did: to write ${name} inside a place, write ${name}, type place, then add contains=[[${name}]] to that place. Nothing changed.`);
|
|
26
26
|
}
|
|
27
|
-
|
|
27
|
+
// The road's stops worked out now, so that one that cannot take the place refuses before the page is written.
|
|
28
|
+
const stops = on === undefined ? undefined : splitStops(pagesWithName(world, on.road)[0], on, name);
|
|
29
|
+
return { journey, movers, on, ...(stops === undefined ? {} : { stops }), at };
|
|
28
30
|
}
|
|
29
31
|
/** The fields a place written `here` in the open takes: the point's position (TRV-14). */
|
|
30
32
|
export function hereFields(here, change) {
|
|
@@ -40,7 +42,7 @@ export function placeHere(root, context, world, page, here) {
|
|
|
40
42
|
const notes = [];
|
|
41
43
|
if (here.on !== undefined) {
|
|
42
44
|
const road = pagesWithName(now, here.on.road)[0];
|
|
43
|
-
const stops = splitStops(road, here.on, page.name);
|
|
45
|
+
const stops = here.stops ?? splitStops(road, here.on, page.name);
|
|
44
46
|
now = withPage(now, road, writePage(now, road.name, undefined, { set: { stops } }).page);
|
|
45
47
|
appendLogEntry(root, newDatedLogEntry(root, context, "page-updated", "hidden", { page: road.name, set: { stops }, why: `${page.name} written where the journey stopped` }));
|
|
46
48
|
notes.push(`${page.name} is now a stop of ${road.name}: ${stops.join(", ")}.`);
|
|
@@ -90,8 +92,12 @@ function splitStops(road, on, name) {
|
|
|
90
92
|
// The stretch by its place in the road, so that a road through the same two stops twice splits the right one.
|
|
91
93
|
const index = joins(on.index) ? on.index : read.stops.findIndex((_, at) => joins(at));
|
|
92
94
|
const length = read.lengths[index];
|
|
93
|
-
|
|
94
|
-
|
|
95
|
+
if (length < 2) {
|
|
96
|
+
throw new Error(`The stretch of ${road.name} where the party stopped is ${Math.round(length)} m long, too short to hold a place: write the place at one of its ends. Nothing changed.`);
|
|
97
|
+
}
|
|
98
|
+
const along = Math.min(Math.max(same(read.stops[index], on.from) ? on.done : length - on.done, 0), length);
|
|
99
|
+
// The point to the hundred metres, never at an end; to the metre on a stretch under 200 m.
|
|
100
|
+
const first = length < 200 ? Math.min(Math.max(Math.round(along), 1), length - 1) : Math.min(Math.max(Math.round(along / 100) * 100, 100), length - 100);
|
|
95
101
|
const metres = (value) => (value % 100 === 0 ? lengthText(value, { units: "metric", imperial: { mile: 0, foot: 0 } }) : `${Math.round(value)} m`);
|
|
96
102
|
const written = road.fields.stops.map(String);
|
|
97
103
|
// The stop at `index` is item 2 * index of the list; the length after it, 2 * index + 1.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import type { Context } from "
|
|
3
|
-
import { type Page, type PageType, type TextMode, type World } from "
|
|
2
|
+
import type { Context } from "../../core/context.ts";
|
|
3
|
+
import { type Page, type PageType, type TextMode, type World } from "../../pages/index.ts";
|
|
4
4
|
/** What a write did, on a page or on a copy in the open scene. */
|
|
5
5
|
interface WriteResult {
|
|
6
6
|
page: string;
|
|
@@ -27,15 +27,15 @@ interface WriteResult {
|
|
|
27
27
|
notes: string[];
|
|
28
28
|
problems: string[];
|
|
29
29
|
}
|
|
30
|
-
export declare const write: import("
|
|
30
|
+
export declare const write: import("../../core/registry.ts").Command<z.ZodObject<{
|
|
31
31
|
page: z.ZodString;
|
|
32
32
|
type: z.ZodOptional<z.ZodEnum<{
|
|
33
33
|
place: "place";
|
|
34
34
|
quest: "quest";
|
|
35
35
|
creature: "creature";
|
|
36
|
+
item: "item";
|
|
36
37
|
character: "character";
|
|
37
38
|
faction: "faction";
|
|
38
|
-
item: "item";
|
|
39
39
|
event: "event";
|
|
40
40
|
topic: "topic";
|
|
41
41
|
}>>;
|
|
@@ -51,8 +51,8 @@ export declare const write: import("../core/registry.ts").Command<z.ZodObject<{
|
|
|
51
51
|
why: z.ZodOptional<z.ZodString>;
|
|
52
52
|
}, z.core.$strip>, WriteResult>;
|
|
53
53
|
/**
|
|
54
|
-
* Sets fields on a page for a package's code, as write --set does (D-511, D-514): the same checks
|
|
55
|
-
* system works out left out, the maxima worked out again. In the log, counter-changed for a counter, public when the page concerns the player, and
|
|
54
|
+
* Sets fields on a page for a package's code, as write --set does (D-511, D-514): the same checks; a counter the page holds changes only with game.change, and
|
|
55
|
+
* one the system declares that the page lacks yet is written, with its counter-changed line; a field the system works out left out, the maxima worked out again. In the log, counter-changed for a counter, public when the page concerns the player, and
|
|
56
56
|
* page-updated for the other fields; nothing for a value that stays. It throws what write refuses, with how to fix it, and writes nothing.
|
|
57
57
|
*/
|
|
58
58
|
export declare function writePackageFields(root: string, context: Context, world: World, page: Page, values: Record<string, number | string>, why: string): void;
|
|
@@ -1,40 +1,39 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { requireCampaign } from "
|
|
3
|
-
import { fieldsRead, listItemNames, numberOf } from "
|
|
4
|
-
import { appendLogEntry } from "
|
|
5
|
-
import { defineCommand } from "
|
|
6
|
-
import { comparableText, sameName, valueNamed, withArticle } from "
|
|
7
|
-
import { formatCounter, readCounter } from "
|
|
8
|
-
import { readEffects } from "
|
|
9
|
-
import { formatAmount, namesCoins, readAmount } from "
|
|
10
|
-
import { alwaysInList, baseFieldOf, baseValue, changedEnvironment, changedFields, checkFieldChange, concernsPlayer, containerFieldOf, countedText as countInText, declaredKind, derivedPages, environmentAt, equippedNotes, findPage, followersOf, formatEnvironmentEntry, goodsFieldProblems, hidingMessage, holdsField, inheritedFields, introductionFollowersOf, introductionText, isCounterField, isDeclaredUncounted, isEmptyField, isNeverInherited, isPartyMember, isPlayerCharacter, isStandardField, keepersOf, linksIn, listFieldNames, misspelledFieldProblem, misspelledStandardField, namesakes, newBaseProblem, newPageFields, ownFieldChange, pageNamed, pagesWithName, pageTypeNames, parsePageReference, readEntry, readEnvironment, readFieldValue, readOnlyMessage, removedFieldName, sameAsBase, sectionFollowersOf, systemKnowsReason, systemLabel, systemPageNamed, textParts, textsIn, withPage, writePage, writtenFieldName, } from "
|
|
11
|
-
import { featureParts, mergedFeatures } from "
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import { conditionNotes, consequencesNotes, eventFieldsProblem, fireEvents, heldNote, nowDueNote, plannedEventDateProblem } from "
|
|
15
|
-
import { experienceOf, leastNotes, newLevelNotes } from "
|
|
16
|
-
import { gridNotes } from "
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import { checkLimits } from "
|
|
20
|
-
import { campaignCoins } from "
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
33
|
-
import {
|
|
2
|
+
import { requireCampaign } from "../../campaign/index.js";
|
|
3
|
+
import { fieldsRead, listItemNames, numberOf } from "../../core/formula.js";
|
|
4
|
+
import { appendLogEntry } from "../../core/log.js";
|
|
5
|
+
import { defineCommand } from "../../core/registry.js";
|
|
6
|
+
import { comparableText, sameName, valueNamed, withArticle } from "../../core/text.js";
|
|
7
|
+
import { formatCounter, readCounter } from "../../counters/index.js";
|
|
8
|
+
import { readEffects } from "../../effects/index.js";
|
|
9
|
+
import { formatAmount, namesCoins, readAmount } from "../../money/index.js";
|
|
10
|
+
import { alwaysInList, baseFieldOf, baseValue, changedEnvironment, changedFields, checkFieldChange, concernsPlayer, containerFieldOf, countedText as countInText, declaredKind, derivedPages, environmentAt, equippedNotes, findPage, followersOf, formatEnvironmentEntry, goodsFieldProblems, hidingMessage, holdsField, inheritedFields, introductionFollowersOf, introductionText, isCounterField, isDeclaredUncounted, isEmptyField, isNeverInherited, isPartyMember, isPlayerCharacter, isStandardField, keepersOf, linksIn, listFieldNames, misspelledFieldProblem, misspelledStandardField, namesakes, newBaseProblem, newPageFields, ownFieldChange, pageNamed, pagesWithName, pageTypeNames, parsePageReference, readEntry, readEnvironment, readFieldValue, readOnlyMessage, removedFieldName, sameAsBase, sectionFollowersOf, systemKnowsReason, systemLabel, systemPageNamed, textParts, textsIn, withPage, writePage, writtenFieldName, } from "../../pages/index.js";
|
|
11
|
+
import { featureParts, mergedFeatures } from "../../progression/index.js";
|
|
12
|
+
import { bondNotes, checkBonds } from "../shared/bonds.js";
|
|
13
|
+
import { effectiveFields, effectsField } from "../shared/effect-layer.js";
|
|
14
|
+
import { conditionNotes, consequencesNotes, eventFieldsProblem, fireEvents, heldNote, nowDueNote, plannedEventDateProblem } from "../shared/events.js";
|
|
15
|
+
import { experienceOf, leastNotes, newLevelNotes } from "../shared/experience.js";
|
|
16
|
+
import { gridNotes } from "../shared/grids.js";
|
|
17
|
+
import { questPictureNote } from "../shared/images.js";
|
|
18
|
+
import { fieldValues } from "../shared/inputs.js";
|
|
19
|
+
import { checkLimits } from "../shared/limits.js";
|
|
20
|
+
import { campaignCoins } from "../shared/money.js";
|
|
21
|
+
import { followersNote, keepersNote, skippedPagesNote } from "../shared/notes.js";
|
|
22
|
+
import { adventurePart, partText, partyPart, situationPart } from "../shared/parts.js";
|
|
23
|
+
import { mapLookNotes, shortRoadNotes } from "../shared/positions.js";
|
|
24
|
+
import { givenItems, progressionOf } from "../shared/progression.js";
|
|
25
|
+
import { adventureUnderWay, logQuestChange, newQuestNotes, tickedQuestNotes } from "../shared/quests.js";
|
|
26
|
+
import { deathNotes, isPlayerDead, partyDeathNotes } from "../shared/saves.js";
|
|
27
|
+
import { checkNotCopied, copyChanges, copyLink, copyName, copyPage, readOpenScene, updateScene } from "../shared/scene.js";
|
|
28
|
+
import { checkListValues, joiningNotes, weightlessNote } from "../shared/sheet.js";
|
|
29
|
+
import { diaryDueLine } from "../shared/thoughts.js";
|
|
30
|
+
import { thresholdNotes } from "../shared/thresholds.js";
|
|
31
|
+
import { newDatedLogEntry, readPresent } from "../shared/time.js";
|
|
32
|
+
import { computedField, counterLimits, directBonuses, hasSheet, isUse, itemLines, maximumHint, maximumSources, missingUses, signedText, startingAtZero, workedMaximum, workedParts } from "../shared/worked-out.js";
|
|
33
|
+
import { campaignSystem, campaignWorld, foreignSystemLanguage, leftOutNote, missingSystemHint, systemBaseHint, systemProblems, systemSearchHint } from "../shared/world.js";
|
|
34
|
+
import { hereFields, hereOf, placeHere, positionToWrite, writeOrigin } from "./here.js";
|
|
34
35
|
// How the output names each way of writing text.
|
|
35
36
|
const textChanges = { replace: "wrote", append: "added to", remove: "removed" };
|
|
36
|
-
// Fields arrive as field=value strings from a command line, or as an object through MCP.
|
|
37
|
-
const fieldValues = z.union([z.array(z.string()), z.record(z.string(), z.unknown())]);
|
|
38
37
|
export const write = defineCommand({
|
|
39
38
|
name: "write",
|
|
40
39
|
description: "Create or change a page of the world. "
|
|
@@ -247,8 +246,8 @@ export const write = defineCommand({
|
|
|
247
246
|
},
|
|
248
247
|
});
|
|
249
248
|
/**
|
|
250
|
-
* Sets fields on a page for a package's code, as write --set does (D-511, D-514): the same checks
|
|
251
|
-
* system works out left out, the maxima worked out again. In the log, counter-changed for a counter, public when the page concerns the player, and
|
|
249
|
+
* Sets fields on a page for a package's code, as write --set does (D-511, D-514): the same checks; a counter the page holds changes only with game.change, and
|
|
250
|
+
* one the system declares that the page lacks yet is written, with its counter-changed line; a field the system works out left out, the maxima worked out again. In the log, counter-changed for a counter, public when the page concerns the player, and
|
|
252
251
|
* page-updated for the other fields; nothing for a value that stays. It throws what write refuses, with how to fix it, and writes nothing.
|
|
253
252
|
*/
|
|
254
253
|
export function writePackageFields(root, context, world, page, values, why) {
|
|
@@ -445,7 +444,7 @@ function checkUses(world, system, page, set) {
|
|
|
445
444
|
if (list === undefined || isEmptyField(classes) || !hasSheet(world, after)) {
|
|
446
445
|
return;
|
|
447
446
|
}
|
|
448
|
-
const asked =
|
|
447
|
+
const asked = askedFields(system);
|
|
449
448
|
for (const field of Object.keys(set ?? {}).filter((name) => isUse(world, name) && !asked.has(comparableText(name)))) {
|
|
450
449
|
const counted = Object.keys(world.system?.formulas?.counters ?? {}).some((name) => comparableText(name) === comparableText(field));
|
|
451
450
|
const { max } = counterLimits(world, fields, field);
|
|
@@ -618,7 +617,7 @@ function followersOfWrite(now, before, after) {
|
|
|
618
617
|
if (!isBaseType(after.type)) {
|
|
619
618
|
return { pages: [], why: "" };
|
|
620
619
|
}
|
|
621
|
-
const changed =
|
|
620
|
+
const changed = before === undefined ? [] : changedNames(before, after);
|
|
622
621
|
if (before === undefined || changed.some((field) => comparableText(field) === baseFieldOf(after.type))) {
|
|
623
622
|
return { pages: derivedPages(now, after), why: `since they derive from ${after.name}` };
|
|
624
623
|
}
|
|
@@ -781,6 +780,10 @@ function givenFields(set, baseField) {
|
|
|
781
780
|
.filter(([field]) => comparableText(field) !== baseField)
|
|
782
781
|
.map(([field, value]) => `${field}=${Array.isArray(value) ? `[${value.map(String).join(", ")}]` : String(value)}`);
|
|
783
782
|
}
|
|
783
|
+
/** The fields the system's sheet asks of every character, its optional ones left out, as names are compared. */
|
|
784
|
+
function askedFields(system) {
|
|
785
|
+
return new Set((system?.sheet ?? []).flatMap((group) => group.entries.filter((entry) => !entry.optional).map((entry) => comparableText(entry.field))));
|
|
786
|
+
}
|
|
784
787
|
/** Whether pages of this type can be bases: creatures and items (INH-1). */
|
|
785
788
|
function isBaseType(type) {
|
|
786
789
|
return type === "creature" || type === "item";
|
|
@@ -822,7 +825,6 @@ function ownValuesNote(now, before, after, coins) {
|
|
|
822
825
|
function changedNames(before, after) {
|
|
823
826
|
return [...new Set([...Object.keys(before.fields), ...Object.keys(after.fields)])].filter((field) => JSON.stringify(before.fields[field]) !== JSON.stringify(after.fields[field]));
|
|
824
827
|
}
|
|
825
|
-
/** The value a page reads for a field, written in any case. */
|
|
826
828
|
/** A value as the outputs show it: a list as its items, anything else as written. */
|
|
827
829
|
function valueText(value) {
|
|
828
830
|
return Array.isArray(value) ? value.map(String).join(", ") : typeof value === "object" && value !== null ? JSON.stringify(value) : String(value);
|
|
@@ -898,7 +900,8 @@ function readFields(fields) {
|
|
|
898
900
|
}
|
|
899
901
|
/** Items for list fields: each value gives one item, or several when it is a list; the same field may come more than once. */
|
|
900
902
|
function readListItems(fields) {
|
|
901
|
-
|
|
903
|
+
// No prototype: a field named constructor or toString is a field like any other.
|
|
904
|
+
const items = Object.create(null);
|
|
902
905
|
for (const [name, given] of Array.isArray(fields) ? fields.map(readAssignment) : Object.entries(fields)) {
|
|
903
906
|
const value = listFromText(name, given);
|
|
904
907
|
items[name] = [...(items[name] ?? []), ...(Array.isArray(value) ? value : [value])];
|
|
@@ -1089,7 +1092,7 @@ function workedLimitsChange(system, before, existing, world, page) {
|
|
|
1089
1092
|
return [{ key, before: counter.max, value: formatCounter({ value, max: limit }), reads: formatCounter({ value: Math.min(value, limit), max: limit }), max: limit, lost: max === undefined }];
|
|
1090
1093
|
});
|
|
1091
1094
|
// Only a use that the lists give, such as rages from the classes, never one the sheet asks to write, as hp: it stays at any maximum.
|
|
1092
|
-
const asked =
|
|
1095
|
+
const asked = askedFields(system);
|
|
1093
1096
|
// A maximum from a class's row, with no formula, has no sources: the lists give it.
|
|
1094
1097
|
const givenByLists = (field) => {
|
|
1095
1098
|
const sources = maximumSources(world, field, fields);
|
|
@@ -24,6 +24,7 @@ export declare function dialogCommands(platform: string, env: Record<string, str
|
|
|
24
24
|
export declare function dialogAnswer(command: DialogCommand, ran: {
|
|
25
25
|
code: number | null;
|
|
26
26
|
out: string;
|
|
27
|
+
err?: string;
|
|
27
28
|
}): Confirmed;
|
|
28
29
|
/** A package's own words as a window shows them: no control or direction characters, which could hide or turn what it says, and no longer than `most`. */
|
|
29
30
|
export declare function plainText(text: string, most: number): string;
|
|
@@ -31,5 +32,6 @@ export declare function plainText(text: string, most: number): string;
|
|
|
31
32
|
declare function runDialog(command: DialogCommand, signal?: AbortSignal): Promise<{
|
|
32
33
|
code: number | null;
|
|
33
34
|
out: string;
|
|
35
|
+
err?: string;
|
|
34
36
|
} | "missing">;
|
|
35
37
|
export {};
|
package/dist/confirm/confirm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { spawn } from "node:child_process";
|
|
2
2
|
// The longest text a window shows: what the package says of itself is cut there.
|
|
3
|
-
const mostText =
|
|
3
|
+
const mostText = 1000;
|
|
4
4
|
// How long the window waits, as a form does.
|
|
5
5
|
const longestWait = 30 * 60 * 1000;
|
|
6
6
|
// The buttons of a window that asks nothing else: a package's install (D-478).
|
|
@@ -26,6 +26,10 @@ const macScript = [
|
|
|
26
26
|
export function systemConfirm(platform, env, run = runDialog) {
|
|
27
27
|
return {
|
|
28
28
|
ask: async (title, text, signal, answers) => {
|
|
29
|
+
// A call stopped before the window: nothing is asked, so no yes can come after the stop.
|
|
30
|
+
if (signal?.aborted === true) {
|
|
31
|
+
return "none";
|
|
32
|
+
}
|
|
29
33
|
for (const command of dialogCommands(platform, env, title, text, answers)) {
|
|
30
34
|
const ran = await run(command, signal);
|
|
31
35
|
if (ran !== "missing") {
|
|
@@ -61,6 +65,10 @@ export function dialogAnswer(command, ran) {
|
|
|
61
65
|
if (said) {
|
|
62
66
|
return "yes";
|
|
63
67
|
}
|
|
68
|
+
// macOS's script ends with -128 when the player turns it down; any other error is a window never shown, as with no desktop.
|
|
69
|
+
if (command.yes.out !== undefined && ran.code !== 0) {
|
|
70
|
+
return (ran.err ?? "").includes("(-128)") ? "no" : "none";
|
|
71
|
+
}
|
|
64
72
|
// Windows' script says when there is no desktop; anything else that ended is the player's no, or the window closed.
|
|
65
73
|
return command.yes.code === 10 && ran.code !== 11 ? "none" : "no";
|
|
66
74
|
}
|
|
@@ -72,8 +80,8 @@ export function plainText(text, most) {
|
|
|
72
80
|
/** Runs a window's program: how it ended and what it wrote; "missing" when it is not on this computer. Closed when the call is stopped, or after half an hour. */
|
|
73
81
|
function runDialog(command, signal) {
|
|
74
82
|
return new Promise((done) => {
|
|
75
|
-
const child = spawn(command.file, command.args, { env: { ...process.env, ...command.env }, stdio: ["ignore", "pipe", "
|
|
76
|
-
let out = "";
|
|
83
|
+
const child = spawn(command.file, command.args, { env: { ...process.env, ...command.env }, stdio: ["ignore", "pipe", "pipe"], windowsHide: false });
|
|
84
|
+
let [out, err] = ["", ""];
|
|
77
85
|
const stop = () => {
|
|
78
86
|
child.kill();
|
|
79
87
|
};
|
|
@@ -81,14 +89,16 @@ function runDialog(command, signal) {
|
|
|
81
89
|
signal?.addEventListener("abort", stop, { once: true });
|
|
82
90
|
child.stdout.setEncoding("utf8");
|
|
83
91
|
child.stdout.on("data", (chunk) => (out += chunk));
|
|
92
|
+
child.stderr.setEncoding("utf8");
|
|
93
|
+
child.stderr.on("data", (chunk) => (err += chunk));
|
|
84
94
|
child.on("error", (error) => {
|
|
85
95
|
clearTimeout(timer);
|
|
86
|
-
done(error.code === "ENOENT" ? "missing" : { code: null, out });
|
|
96
|
+
done(error.code === "ENOENT" ? "missing" : { code: null, out, err });
|
|
87
97
|
});
|
|
88
98
|
child.on("close", (code) => {
|
|
89
99
|
clearTimeout(timer);
|
|
90
100
|
signal?.removeEventListener("abort", stop);
|
|
91
|
-
done({ code, out });
|
|
101
|
+
done({ code, out, err });
|
|
92
102
|
});
|
|
93
103
|
});
|
|
94
104
|
}
|
package/dist/core/consents.d.ts
CHANGED
|
@@ -6,8 +6,9 @@ export declare const ourScope = "@rpgengine/";
|
|
|
6
6
|
*/
|
|
7
7
|
export declare function packageCodeMayRun(folder: string): boolean;
|
|
8
8
|
/**
|
|
9
|
-
* The fingerprint of a package's files as installed: every file but those npm or git keep beside them, by its
|
|
10
|
-
* a file's size or time changed: it is asked
|
|
9
|
+
* The fingerprint of a package's files as installed, and of its dependencies' as npm resolved them: every file but those npm or git keep beside them, by its
|
|
10
|
+
* path and its bytes, so that a dependency another install changed asks the yes again. Worked out again only when a file's size or time changed: it is asked
|
|
11
|
+
* at each load of the package's code.
|
|
11
12
|
*/
|
|
12
13
|
export declare function packageFingerprint(folder: string): string;
|
|
13
14
|
/** Records the player's yes to a package installed in a folder of npm's packages: its version and its files as they are now. */
|
package/dist/core/consents.js
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
// The player's yes to the code of a package not ours, an extension's or a game system's (D-478, D-510, D-511): kept on this computer beside the packages npm
|
|
2
2
|
// installed, never in a campaign, for the package, its version and the fingerprint of its files; any other version, or a file changed since, has no yes.
|
|
3
3
|
import { createHash } from "node:crypto";
|
|
4
|
-
import { readdirSync, readFileSync, statSync } from "node:fs";
|
|
4
|
+
import { existsSync, readdirSync, readFileSync, statSync } from "node:fs";
|
|
5
5
|
import { dirname, join, relative, sep } from "node:path";
|
|
6
6
|
import { installedFromFolder } from "./files.js";
|
|
7
7
|
import { files } from "./store.js";
|
|
8
8
|
/** The file of the yeses, beside the folder of the packages npm installed. */
|
|
9
9
|
const consentsFile = "consents.json";
|
|
10
|
+
// An npm package's name, as a dependency is listed: never a path.
|
|
11
|
+
const npmName = /^(@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/;
|
|
10
12
|
/** The npm scope of the packages RPG Engine publishes, verified: their code runs without a yes (D-441). */
|
|
11
13
|
export const ourScope = "@rpgengine/";
|
|
12
14
|
/**
|
|
@@ -26,11 +28,12 @@ export function packageCodeMayRun(folder) {
|
|
|
26
28
|
return consentsPath(folder) === undefined || linked || name.startsWith(ourScope) || hasConsent(folder, name, typeof manifest.version === "string" ? manifest.version : "");
|
|
27
29
|
}
|
|
28
30
|
/**
|
|
29
|
-
* The fingerprint of a package's files as installed: every file but those npm or git keep beside them, by its
|
|
30
|
-
* a file's size or time changed: it is asked
|
|
31
|
+
* The fingerprint of a package's files as installed, and of its dependencies' as npm resolved them: every file but those npm or git keep beside them, by its
|
|
32
|
+
* path and its bytes, so that a dependency another install changed asks the yes again. Worked out again only when a file's size or time changed: it is asked
|
|
33
|
+
* at each load of the package's code.
|
|
31
34
|
*/
|
|
32
35
|
export function packageFingerprint(folder) {
|
|
33
|
-
const paths =
|
|
36
|
+
const paths = withDependencies(folder).flatMap(packageFiles);
|
|
34
37
|
const signature = paths.map((path) => {
|
|
35
38
|
const stat = statSync(path);
|
|
36
39
|
return `${path}|${stat.size}|${stat.mtimeMs}`;
|
|
@@ -84,6 +87,42 @@ function readConsents(file) {
|
|
|
84
87
|
return {};
|
|
85
88
|
}
|
|
86
89
|
}
|
|
90
|
+
/** A package's folder and those of its dependencies, and theirs in turn, each found as Node finds it: in a node_modules here or in a folder above. */
|
|
91
|
+
function withDependencies(folder) {
|
|
92
|
+
const found = [folder];
|
|
93
|
+
for (let at = 0; at < found.length; at++) {
|
|
94
|
+
for (const name of dependencyNames(found[at])) {
|
|
95
|
+
const dependency = dependencyFolder(found[at], name);
|
|
96
|
+
if (dependency !== undefined && !found.includes(dependency)) {
|
|
97
|
+
found.push(dependency);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
return found;
|
|
102
|
+
}
|
|
103
|
+
/** The names of a package's dependencies, as its package.json lists them to run; none that is not an npm name. */
|
|
104
|
+
function dependencyNames(folder) {
|
|
105
|
+
try {
|
|
106
|
+
const manifest = JSON.parse(readFileSync(join(folder, "package.json"), "utf8"));
|
|
107
|
+
const listed = [manifest.dependencies, manifest.optionalDependencies].flatMap((list) => (typeof list === "object" && list !== null ? Object.keys(list) : []));
|
|
108
|
+
return listed.filter((name) => npmName.test(name)).sort();
|
|
109
|
+
}
|
|
110
|
+
catch {
|
|
111
|
+
return [];
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
/** Where Node finds a dependency of a package: the nearest node_modules that holds it, from the package's own folder up; undefined when none does. */
|
|
115
|
+
function dependencyFolder(from, name) {
|
|
116
|
+
for (let folder = from;; folder = dirname(folder)) {
|
|
117
|
+
const candidate = join(folder, "node_modules", ...name.split("/"));
|
|
118
|
+
if (existsSync(join(candidate, "package.json"))) {
|
|
119
|
+
return candidate;
|
|
120
|
+
}
|
|
121
|
+
if (dirname(folder) === folder) {
|
|
122
|
+
return undefined;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
87
126
|
/** A package's own files, in a fixed order: not those npm or git keep beside them. */
|
|
88
127
|
function packageFiles(folder) {
|
|
89
128
|
return readdirSync(folder, { withFileTypes: true })
|
package/dist/core/context.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { FileStore } from "./store.ts";
|
|
2
|
+
/** How long the player may take to click, on the page or in the host's form: as long as a host waits for a call that keeps reporting progress. */
|
|
3
|
+
export declare const playerWait: number;
|
|
2
4
|
/** What a command needs from the outside world: tests replace it to get repeatable results. */
|
|
3
5
|
export interface Context {
|
|
4
6
|
/** Folder the command runs in: commands look for the campaign here and in the folders above. */
|
|
@@ -63,9 +65,9 @@ export interface Context {
|
|
|
63
65
|
dashboard?: string;
|
|
64
66
|
/**
|
|
65
67
|
* What the player changed on the dashboard since the master's last call, taken for the head of the next call's answer, and given back when that answer
|
|
66
|
-
* never goes, as for a call the user stopped (D-341).
|
|
68
|
+
* never goes, as for a call the user stopped (D-341); the parts it tells count as told in `told`, the call's own.
|
|
67
69
|
*/
|
|
68
|
-
news?: () => {
|
|
70
|
+
news?: (told?: Set<string>) => {
|
|
69
71
|
lines: string[];
|
|
70
72
|
restore(): void;
|
|
71
73
|
};
|
|
@@ -249,10 +251,6 @@ export interface PictureMaker {
|
|
|
249
251
|
refused: string;
|
|
250
252
|
}>;
|
|
251
253
|
}
|
|
252
|
-
/**
|
|
253
|
-
* Asks the player one question with buttons: the index of the label they chose; undefined when no one answered; "unavailable" when the surface turned out
|
|
254
|
-
* unable to show the buttons, so that from then on the master asks in words; "absent" when no one is there to see them now, as a dashboard with no page open.
|
|
255
|
-
*/
|
|
256
254
|
/** The player's own words in place of a button, as the dashboard's page lets them write (ASK-10). */
|
|
257
255
|
export interface Said {
|
|
258
256
|
said: string;
|
|
@@ -326,6 +324,10 @@ export interface Spending {
|
|
|
326
324
|
spent(): string | undefined;
|
|
327
325
|
}
|
|
328
326
|
export interface Player {
|
|
327
|
+
/**
|
|
328
|
+
* Asks the player one question with buttons: the index of the label they chose; undefined when no one answered; "unavailable" when the surface turned out
|
|
329
|
+
* unable to show the buttons, so that from then on the master asks in words; "absent" when no one is there to see them now, as a dashboard with no page open.
|
|
330
|
+
*/
|
|
329
331
|
choose(question: string, title: string, labels: string[], signal?: AbortSignal, rows?: Rows): Promise<number | Said | undefined | "unavailable" | "absent">;
|
|
330
332
|
/** Asks where a player character, who, moves on the map of its place (ASK-11): the square, the change of mind as its one button (0), or the player's words; only a page can. */
|
|
331
333
|
chooseSquare?(question: string, title: string, change: string, who: string, signal?: AbortSignal): Promise<Picked | 0 | Said | undefined | "absent">;
|
package/dist/core/context.js
CHANGED
|
@@ -2,6 +2,8 @@ import { randomBytes, randomInt, randomUUID } from "node:crypto";
|
|
|
2
2
|
import { homedir } from "node:os";
|
|
3
3
|
import { dirname, join } from "node:path";
|
|
4
4
|
import { fileURLToPath } from "node:url";
|
|
5
|
+
/** How long the player may take to click, on the page or in the host's form: as long as a host waits for a call that keeps reporting progress. */
|
|
6
|
+
export const playerWait = 30 * 60 * 1000;
|
|
5
7
|
export function defaultContext(folder = process.cwd()) {
|
|
6
8
|
return {
|
|
7
9
|
folder,
|
|
@@ -36,7 +38,7 @@ export function packagesFolder() {
|
|
|
36
38
|
function userDataFolder() {
|
|
37
39
|
const home = homedir();
|
|
38
40
|
if (process.platform === "win32") {
|
|
39
|
-
return join(process.env.APPDATA
|
|
41
|
+
return join(process.env.APPDATA || join(home, "AppData", "Roaming"), "rpg-engine");
|
|
40
42
|
}
|
|
41
|
-
return process.platform === "darwin" ? join(home, "Library", "Application Support", "rpg-engine") : join(process.env.XDG_DATA_HOME
|
|
43
|
+
return process.platform === "darwin" ? join(home, "Library", "Application Support", "rpg-engine") : join(process.env.XDG_DATA_HOME || join(home, ".local", "share"), "rpg-engine");
|
|
42
44
|
}
|
package/dist/core/download.js
CHANGED
|
@@ -9,17 +9,28 @@ export async function downloadBytes(url, most, signal) {
|
|
|
9
9
|
.catch((error) => {
|
|
10
10
|
throw new Error(`${url} did not answer (${error instanceof Error ? error.message : String(error)}): check the address, or download it and give the file.`);
|
|
11
11
|
});
|
|
12
|
+
if (response.redirected && !/^https:\/\//i.test(response.url)) {
|
|
13
|
+
throw new Error(`${url} led to ${response.url}, which is not https: only https addresses are downloaded.`);
|
|
14
|
+
}
|
|
12
15
|
if (!response.ok || response.body === null) {
|
|
13
16
|
throw new Error(`${url} answered ${response.status}: check the address, or download it and give the file.`);
|
|
14
17
|
}
|
|
15
18
|
const chunks = [];
|
|
16
19
|
let size = 0;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
20
|
+
try {
|
|
21
|
+
for await (const chunk of response.body) {
|
|
22
|
+
size += chunk.length;
|
|
23
|
+
if (size > most) {
|
|
24
|
+
break;
|
|
25
|
+
}
|
|
26
|
+
chunks.push(chunk);
|
|
21
27
|
}
|
|
22
|
-
|
|
28
|
+
}
|
|
29
|
+
catch (error) {
|
|
30
|
+
throw new Error(`${url} stopped half way (${error instanceof Error ? error.message : String(error)}): check the address, or download it and give the file.`);
|
|
31
|
+
}
|
|
32
|
+
if (size > most) {
|
|
33
|
+
throw new Error(`${url} is more than ${most / 1024 / 1024} MB, more than an adventure may.`);
|
|
23
34
|
}
|
|
24
35
|
const bytes = new Uint8Array(size);
|
|
25
36
|
let at = 0;
|
package/dist/core/files.d.ts
CHANGED
|
@@ -2,12 +2,17 @@
|
|
|
2
2
|
export declare function foldersIn(folder: string): string[];
|
|
3
3
|
/** The full paths of the files in `folder` and in the folders inside it whose names `keep` takes; none when there is no such folder. */
|
|
4
4
|
export declare function filesIn(folder: string, keep: (name: string) => boolean): string[];
|
|
5
|
+
/** The order of a folder's files, the same on every system: those nearer the folder first, then by path, as Windows lists them, case aside. */
|
|
6
|
+
export declare function fileOrder(first: string, second: string): number;
|
|
5
7
|
/**
|
|
6
8
|
* The folders of the packages in these folders of npm's, in their scopes' folders too (@rpgengine/weather), links to folders included, as npm links a package
|
|
7
9
|
* installed from a folder (D-441); never followed further.
|
|
8
10
|
*/
|
|
9
11
|
export declare function packageFoldersIn(folders: string[]): string[];
|
|
10
|
-
/**
|
|
12
|
+
/**
|
|
13
|
+
* A path by the folders it really is in, through any link on the way, as Node resolves a module; one not there yet by the real path of the folder it would be
|
|
14
|
+
* in, as /var is /private/var on macOS.
|
|
15
|
+
*/
|
|
11
16
|
export declare function realPath(path: string): string;
|
|
12
17
|
/**
|
|
13
18
|
* Whether a package of npm's folder came from a folder or a file of this computer, never from npm (D-441, D-452): npm's package.json names it as file:, or it
|