rpg-engine 0.19.1 → 0.21.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.
Files changed (229) hide show
  1. package/README.md +9 -6
  2. package/dist/adventures/index.d.ts +1 -1
  3. package/dist/adventures/index.js +1 -1
  4. package/dist/adventures/source.d.ts +3 -0
  5. package/dist/adventures/source.js +11 -49
  6. package/dist/campaign/create-campaign.d.ts +1 -1
  7. package/dist/campaign/create-campaign.js +4 -3
  8. package/dist/campaign/find-campaign.d.ts +6 -0
  9. package/dist/campaign/find-campaign.js +7 -1
  10. package/dist/campaign/host-files.js +22 -0
  11. package/dist/campaign/index.d.ts +2 -2
  12. package/dist/campaign/index.js +2 -2
  13. package/dist/campaign/last-choices.d.ts +10 -4
  14. package/dist/campaign/last-choices.js +43 -17
  15. package/dist/campaign/settings.d.ts +10 -2
  16. package/dist/campaign/settings.js +32 -8
  17. package/dist/chats/chat.d.ts +33 -0
  18. package/dist/chats/chat.js +50 -0
  19. package/dist/chats/claude-code.d.ts +5 -0
  20. package/dist/chats/claude-code.js +39 -0
  21. package/dist/chats/codex.d.ts +3 -0
  22. package/dist/chats/codex.js +42 -0
  23. package/dist/chats/index.d.ts +5 -0
  24. package/dist/chats/index.js +12 -0
  25. package/dist/chats/keep.d.ts +10 -0
  26. package/dist/chats/keep.js +50 -0
  27. package/dist/chats/read.d.ts +8 -0
  28. package/dist/chats/read.js +46 -0
  29. package/dist/cli/cli.js +6 -1
  30. package/dist/cli/command-line.js +3 -2
  31. package/dist/commands/book.d.ts +36 -0
  32. package/dist/commands/book.js +129 -0
  33. package/dist/commands/chats.d.ts +38 -0
  34. package/dist/commands/chats.js +93 -0
  35. package/dist/commands/config/config.js +2 -2
  36. package/dist/commands/config/dashboard.d.ts +8 -1
  37. package/dist/commands/config/dashboard.js +70 -16
  38. package/dist/commands/config/words.d.ts +1 -1
  39. package/dist/commands/config/words.js +18 -5
  40. package/dist/commands/find.js +1 -1
  41. package/dist/commands/image.d.ts +14 -0
  42. package/dist/commands/image.js +100 -20
  43. package/dist/commands/index.js +4 -0
  44. package/dist/commands/init.js +3 -3
  45. package/dist/commands/package/data.d.ts +35 -0
  46. package/dist/commands/package/data.js +117 -0
  47. package/dist/commands/package/here.d.ts +7 -2
  48. package/dist/commands/package/here.js +23 -11
  49. package/dist/commands/package/install.js +14 -15
  50. package/dist/commands/package/language.d.ts +15 -0
  51. package/dist/commands/package/language.js +109 -0
  52. package/dist/commands/package/package.js +20 -10
  53. package/dist/commands/package/result.d.ts +19 -0
  54. package/dist/commands/package/theme.d.ts +13 -0
  55. package/dist/commands/package/theme.js +66 -0
  56. package/dist/commands/package/uninstall.d.ts +4 -1
  57. package/dist/commands/package/uninstall.js +29 -9
  58. package/dist/commands/scene/close.d.ts +2 -0
  59. package/dist/commands/scene/close.js +20 -2
  60. package/dist/commands/scene/result.d.ts +2 -0
  61. package/dist/commands/scene/scene.d.ts +2 -0
  62. package/dist/commands/shared/books/adventures.d.ts +0 -4
  63. package/dist/commands/shared/books/adventures.js +2 -31
  64. package/dist/commands/shared/books/words.js +3 -2
  65. package/dist/commands/shared/campaign/book.d.ts +42 -0
  66. package/dist/commands/shared/campaign/book.js +118 -0
  67. package/dist/commands/shared/campaign/chats.d.ts +11 -0
  68. package/dist/commands/shared/campaign/chats.js +29 -0
  69. package/dist/commands/shared/campaign/images.js +7 -1
  70. package/dist/commands/shared/campaign/mode.js +3 -1
  71. package/dist/commands/shared/campaign/saves.js +13 -5
  72. package/dist/commands/shared/campaign/world.js +2 -1
  73. package/dist/commands/shared/packages/catalog.d.ts +3 -3
  74. package/dist/commands/shared/packages/catalog.js +98 -42
  75. package/dist/commands/shared/packages/unpacked.d.ts +50 -0
  76. package/dist/commands/shared/packages/unpacked.js +146 -0
  77. package/dist/commands/shared/sheet/sheet.d.ts +7 -0
  78. package/dist/commands/shared/sheet/sheet.js +27 -0
  79. package/dist/commands/status.d.ts +1 -0
  80. package/dist/commands/status.js +4 -0
  81. package/dist/commands/view/page.js +4 -3
  82. package/dist/commands/view/result.d.ts +2 -0
  83. package/dist/commands/view/view.d.ts +1 -0
  84. package/dist/commands/view/view.js +4 -0
  85. package/dist/core/archive.d.ts +13 -0
  86. package/dist/core/archive.js +76 -0
  87. package/dist/core/consents.d.ts +2 -2
  88. package/dist/core/consents.js +3 -3
  89. package/dist/core/context.d.ts +40 -2
  90. package/dist/core/context.js +1 -0
  91. package/dist/core/download.js +1 -1
  92. package/dist/core/store.d.ts +5 -1
  93. package/dist/core/store.js +15 -2
  94. package/dist/dashboard/acts/names.js +10 -5
  95. package/dist/dashboard/acts/sending.js +5 -2
  96. package/dist/dashboard/acts/sheet.js +66 -15
  97. package/dist/dashboard/api.js +27 -4
  98. package/dist/dashboard/app.js +9 -4
  99. package/dist/dashboard/guide/ar.md +16 -15
  100. package/dist/dashboard/guide/cs.md +15 -14
  101. package/dist/dashboard/guide/da.md +17 -16
  102. package/dist/dashboard/guide/de.md +17 -16
  103. package/dist/dashboard/guide/el.md +17 -16
  104. package/dist/dashboard/guide/en.md +14 -13
  105. package/dist/dashboard/guide/es.md +15 -14
  106. package/dist/dashboard/guide/fi.md +15 -14
  107. package/dist/dashboard/guide/fr.md +20 -19
  108. package/dist/dashboard/guide/he.md +15 -14
  109. package/dist/dashboard/guide/hi.md +15 -14
  110. package/dist/dashboard/guide/hu.md +19 -18
  111. package/dist/dashboard/guide/is.md +15 -14
  112. package/dist/dashboard/guide/it.md +18 -17
  113. package/dist/dashboard/guide/ja.md +15 -14
  114. package/dist/dashboard/guide/ko.md +16 -15
  115. package/dist/dashboard/guide/nb.md +17 -16
  116. package/dist/dashboard/guide/nl.md +15 -14
  117. package/dist/dashboard/guide/pl.md +16 -15
  118. package/dist/dashboard/guide/pt.md +16 -15
  119. package/dist/dashboard/guide/ro.md +15 -14
  120. package/dist/dashboard/guide/ru.md +16 -15
  121. package/dist/dashboard/guide/sv.md +15 -14
  122. package/dist/dashboard/guide/tr.md +18 -17
  123. package/dist/dashboard/guide/uk.md +19 -18
  124. package/dist/dashboard/guide/zh.md +16 -15
  125. package/dist/dashboard/i18n/ar.json +63 -9
  126. package/dist/dashboard/i18n/cs.json +63 -9
  127. package/dist/dashboard/i18n/da.json +63 -9
  128. package/dist/dashboard/i18n/de.json +63 -9
  129. package/dist/dashboard/i18n/el.json +63 -9
  130. package/dist/dashboard/i18n/es.json +63 -9
  131. package/dist/dashboard/i18n/fi.json +63 -9
  132. package/dist/dashboard/i18n/fr.json +63 -9
  133. package/dist/dashboard/i18n/he.json +63 -9
  134. package/dist/dashboard/i18n/hi.json +63 -9
  135. package/dist/dashboard/i18n/hu.json +63 -9
  136. package/dist/dashboard/i18n/is.json +63 -9
  137. package/dist/dashboard/i18n/it.json +64 -10
  138. package/dist/dashboard/i18n/ja.json +63 -9
  139. package/dist/dashboard/i18n/ko.json +63 -9
  140. package/dist/dashboard/i18n/nb.json +63 -9
  141. package/dist/dashboard/i18n/nl.json +63 -9
  142. package/dist/dashboard/i18n/pl.json +63 -9
  143. package/dist/dashboard/i18n/pt.json +63 -9
  144. package/dist/dashboard/i18n/ro.json +63 -9
  145. package/dist/dashboard/i18n/ru.json +63 -9
  146. package/dist/dashboard/i18n/sv.json +63 -9
  147. package/dist/dashboard/i18n/tr.json +63 -9
  148. package/dist/dashboard/i18n/uk.json +63 -9
  149. package/dist/dashboard/i18n/zh.json +63 -9
  150. package/dist/dashboard/journal/book.js +107 -0
  151. package/dist/dashboard/journal/journal.js +16 -12
  152. package/dist/dashboard/kit.js +1 -1
  153. package/dist/dashboard/packages/catalog.js +31 -14
  154. package/dist/dashboard/packages/engine.js +46 -2
  155. package/dist/dashboard/packages/installed.js +13 -0
  156. package/dist/dashboard/packages/outcomes.js +21 -0
  157. package/dist/dashboard/packages/packages.js +41 -18
  158. package/dist/dashboard/packages/rows.js +3 -1
  159. package/dist/dashboard/parts/icons.js +3 -0
  160. package/dist/dashboard/parts/labels.js +6 -0
  161. package/dist/dashboard/parts/picture.js +89 -0
  162. package/dist/dashboard/parts/refusals.js +8 -1
  163. package/dist/dashboard/parts/widgets.js +3 -2
  164. package/dist/dashboard/place/view.js +1 -1
  165. package/dist/dashboard/play/scene.js +8 -5
  166. package/dist/dashboard/settings/settings.js +32 -16
  167. package/dist/dashboard/settings/setup.js +5 -3
  168. package/dist/dashboard/sheet/party.js +5 -2
  169. package/dist/dashboard/sheet/sheet.js +10 -6
  170. package/dist/dashboard/shell/notices.js +2 -2
  171. package/dist/dashboard/shell/system-style.js +45 -12
  172. package/dist/dashboard/shell/tooltip.js +223 -0
  173. package/dist/dashboard/style.css +775 -261
  174. package/dist/dashboard/world/calendar.js +1 -1
  175. package/dist/dashboard/world/lore.js +5 -4
  176. package/dist/dashboard/world/place-card.js +2 -1
  177. package/dist/helpers/briefs.d.ts +5 -0
  178. package/dist/helpers/briefs.js +8 -0
  179. package/dist/helpers/chosen.d.ts +8 -2
  180. package/dist/helpers/chosen.js +110 -6
  181. package/dist/helpers/codex.js +2 -1
  182. package/dist/helpers/index.d.ts +2 -2
  183. package/dist/helpers/index.js +2 -2
  184. package/dist/images/images.d.ts +2 -0
  185. package/dist/images/images.js +16 -2
  186. package/dist/images/index.d.ts +1 -1
  187. package/dist/images/index.js +1 -1
  188. package/dist/languages/index.d.ts +1 -1
  189. package/dist/languages/index.js +1 -1
  190. package/dist/languages/pack.d.ts +4 -1
  191. package/dist/languages/pack.js +16 -5
  192. package/dist/packages/engine.d.ts +7 -0
  193. package/dist/packages/engine.js +32 -1
  194. package/dist/packages/index.d.ts +1 -1
  195. package/dist/packages/index.js +1 -1
  196. package/dist/server/approver.d.ts +6 -0
  197. package/dist/server/approver.js +28 -0
  198. package/dist/server/chats.d.ts +3 -0
  199. package/dist/server/chats.js +27 -0
  200. package/dist/server/dashboard/engine.d.ts +18 -0
  201. package/dist/server/dashboard/engine.js +31 -0
  202. package/dist/server/dashboard/files.d.ts +8 -1
  203. package/dist/server/dashboard/files.js +30 -10
  204. package/dist/server/dashboard/index.d.ts +3 -0
  205. package/dist/server/dashboard/index.js +10 -1
  206. package/dist/server/dashboard/news.js +36 -5
  207. package/dist/server/dashboard/pictures.d.ts +7 -0
  208. package/dist/server/dashboard/pictures.js +62 -0
  209. package/dist/server/dashboard/writes.d.ts +5 -3
  210. package/dist/server/dashboard/writes.js +45 -14
  211. package/dist/server/mcp.js +37 -6
  212. package/dist/server/player-acts.d.ts +7 -2
  213. package/dist/server/player-acts.js +10 -3
  214. package/dist/testing/index.js +1 -0
  215. package/dist/themes/index.d.ts +2 -1
  216. package/dist/themes/index.js +4 -2
  217. package/dist/themes/installed.d.ts +14 -0
  218. package/dist/themes/installed.js +28 -0
  219. package/dist/themes/theme.d.ts +7 -0
  220. package/dist/themes/theme.js +22 -0
  221. package/instructions/core.md +3 -3
  222. package/instructions/dashboard-guide.md +1 -0
  223. package/instructions/mentor-hints.md +1 -1
  224. package/instructions/mentor-tutorial.md +1 -1
  225. package/instructions/party.md +1 -1
  226. package/instructions/play.md +2 -2
  227. package/instructions/start.md +1 -1
  228. package/package.json +2 -2
  229. package/systems/free/instructions/outcomes-told.md +1 -1
@@ -1,7 +1,7 @@
1
1
  // The player's settings and the setup's questions as the dashboard shows them (D-341, D-370)
2
2
  import { customLevel, customLevels, customSettings, lastChoices, listSettingNames, readOneSetting, readSettings, setupSettingNames } from "../../campaign/index.js";
3
3
  import { comparableText } from "../../core/text.js";
4
- import { claudeSays, codexSays } from "../../helpers/index.js";
4
+ import { claudeSays, codexClient, codexSays } from "../../helpers/index.js";
5
5
  import { readBetweenSessions } from "../../time/index.js";
6
6
  import { heldSystemSettings, isLeading, offeredValues, playedEngineSetting } from "../shared/campaign/offers.js";
7
7
  import { playedSettingValue } from "../shared/campaign/world.js";
@@ -24,19 +24,23 @@ export function setupQuestions(root, context, writtenWorld) {
24
24
  // The value a system's setting suggests (DAT-17).
25
25
  const systemSuggests = Object.fromEntries(held.flatMap((setting) => setting.values.filter((value) => value.suggested === true).map((value) => [setting.name, value.value])));
26
26
  // The player's last choices first: how they like to play, from their last campaign on this computer (T-134).
27
- const last = lastChoices(context.home);
27
+ const last = lastChoices(context.home, root);
28
28
  const suggested = { ...suggestedValues, ...(difficulty === undefined ? {} : { lethality: suggestedLethality[difficulty] ?? "dice" }), ...systemSuggests, ...last };
29
29
  // The system's settings others depend on right after the mentor, before what they change (DAT-16, DAT-17).
30
30
  const leading = held.filter(isLeading).map((setting) => setting.name);
31
31
  const order = setupOrder.filter((name) => !writtenWorld || !worldSettingNames.includes(name));
32
32
  const others = system.filter((name) => !leading.includes(name));
33
- return [...order.slice(0, 1), ...leading, ...order.slice(1), ...others, "lines", "veils"].flatMap(named).map((question) => {
33
+ // How well the player knows the game, once the chat has chosen it: the question names it (T-211).
34
+ const game = settings.system;
35
+ const first = game === undefined ? [] : order.slice(0, 1);
36
+ return [...first, ...leading, ...order.slice(1), ...others, "lines", "veils"].flatMap(named).map((question) => {
34
37
  const suggestion = suggested[question.name];
35
38
  // A suggestion the game does not offer is none (DAT-16).
36
39
  const offered = suggestion !== undefined && (question.choices === undefined || question.choices.some((choice) => choice.value === suggestion));
37
40
  const asked = { ...question, ...(question.choices === undefined ? {} : { choices: question.choices.filter((choice) => choice.value !== customLevel) }) };
38
41
  const lastOne = offered && last[question.name] === suggestion ? { last: suggestion } : {};
39
- return { ...(question.name === "mentor" ? mentorQuestion(asked) : unsetUnanswered(asked, settings)), ...(offered ? { suggested: suggestion } : {}), ...lastOne };
42
+ const worded = Object.hasOwn(questionTexts, question.name) ? { question: questionTexts[question.name] } : {};
43
+ return { ...(question.name === "mentor" ? mentorQuestion(asked, game ?? "") : unsetUnanswered(asked, settings)), ...worded, ...(offered ? { suggested: suggestion } : {}), ...lastOne };
40
44
  });
41
45
  }
42
46
  /** A setting only the setup lets the dashboard change (D-370): how the character and the companions come, the preparation, the length, the name; undefined for any other. */
@@ -62,7 +66,7 @@ export function setupSettingNamed(root, name) {
62
66
  }
63
67
  /** The player's settings as the dashboard shows them (D-341): with what this computer lacks, as pictures without Codex, asked again. */
64
68
  export function shownPlayerSettings(root, context) {
65
- return playerSettings(root, context).map((setting) => (setting.name === "pictures" ? { ...setting, ...picturesReadyNote(context) } : setting));
69
+ return playerSettings(root, context).map((setting) => (setting.name === "pictures" ? { ...setting, ...withOwnPicture(picturesReadyNote(context)) } : setting));
66
70
  }
67
71
  /** The player's settings with their values, then those the game system adds (D-341). */
68
72
  export function playerSettings(root, context) {
@@ -91,7 +95,7 @@ export function playerSettings(root, context) {
91
95
  ...(choices === undefined ? {} : { choices }),
92
96
  ...(words.most === undefined ? {} : { most: words.most }),
93
97
  }];
94
- }).flatMap((setting) => offeredSetting(root, context, setting)),
98
+ }).flatMap((setting) => offeredSetting(root, context, setting)).map((setting) => (setting.name === "pictures-by" ? makersInChat(context, setting) : setting)),
95
99
  ...own,
96
100
  ];
97
101
  }
@@ -101,13 +105,15 @@ export function playerSettingNamed(root, context, name) {
101
105
  }
102
106
  // The setup's questions, in the order the player meets them on the dashboard: how well they know the game, how it plays, how it is rolled, who comes along,
103
107
  // the world and how long it plays, then the limits.
104
- const setupOrder = ["mentor", "difficulty", "lethality", "saves", "rigor", "dice", "master-rolls", "units", "character", "companions", "preparation", "length"];
108
+ const setupOrder = ["mentor", "difficulty", "lethality", "saves", "rigor", "dice", "master-rolls", "units", "character", "companions", "preparation", "length", "pictures", "pictures-by"];
109
+ // The questions the setup's cards ask in place of a setting's name (D-572).
110
+ const questionTexts = { pictures: "Do you want pictures of places and of those you meet?", "pictures-by": "Who makes them?" };
105
111
  // The mentor as the setup asks it (D-347): how well the player knows the game, each answer a way of the mentor, from the newest player's.
106
112
  const mentorAnswers = { tutorial: "never played it", hints: "a little", off: "I know it" };
107
113
  // What the setup asks only of a world not written (D-80, D-558): a written one has its own.
108
114
  const worldSettingNames = ["preparation", "length"];
109
115
  // The values the game suggests in the setup, as the design has them by default (D-370): never chosen for the player.
110
- const suggestedValues = { saves: "checkpoint", rigor: "smooth", "master-rolls": "behind the screen", character: "made with the player", preparation: "on the fly", length: "one evening" };
116
+ const suggestedValues = { saves: "checkpoint", rigor: "smooth", "master-rolls": "behind the screen", character: "made with the player", preparation: "on the fly", length: "one evening", "pictures-by": "chat" };
111
117
  // The lethality the difficulty suggests (D-141).
112
118
  const suggestedLethality = { story: "narrative", easy: "epic" };
113
119
  /** A question whose value is only the one shown while it is unset, as master-rolls behind the screen (D-287): still unanswered in the setup. */
@@ -115,11 +121,22 @@ function unsetUnanswered(question, settings) {
115
121
  const { value, ...unanswered } = question;
116
122
  return value !== undefined && wordsOf(question.name)?.unset === value && settings[question.name] === undefined ? unanswered : question;
117
123
  }
118
- /** The mentor as the setup asks it (D-347): how well the player knows the game, never played it first. */
119
- function mentorQuestion(question) {
124
+ /** The mentor as the setup asks it (D-347): how well the player knows the game, by the name of its system (T-211), never played it first. */
125
+ function mentorQuestion(question, game) {
120
126
  const order = Object.keys(mentorAnswers);
121
127
  const choices = (question.choices ?? []).map((choice) => ({ ...choice, label: mentorAnswers[choice.value] })).sort((one, other) => order.indexOf(one.value) - order.indexOf(other.value));
122
- return { ...question, question: "How well do you know this game?", about: "the master teaches it as much as you need", choices };
128
+ // Free play has no rules of its own to know: the question is about role-playing games.
129
+ const named = game === freePlay ? { question: "How well do you know role-playing games?" } : { question: "How well do you know {game}?", game };
130
+ return { ...question, ...named, about: "the master teaches it as much as you need", choices };
131
+ }
132
+ // The engine's own game system, free play, without rules of its own.
133
+ const freePlay = "free";
134
+ /** Who makes the pictures as the chat in use offers it (D-572): in Codex, Codex is the chat itself, so it is not offered, and a campaign that chose it plays chat. */
135
+ function makersInChat(context, setting) {
136
+ if (context.host?.() !== codexClient) {
137
+ return setting;
138
+ }
139
+ return { ...setting, ...(setting.value === "codex" ? { value: "chat" } : {}), choices: setting.choices?.filter((choice) => choice.value !== "codex") };
123
140
  }
124
141
  /** A player's setting as the game offers it (DAT-16): none where it plays one value alone; only the values it offers, and no value written that it does not. */
125
142
  function offeredSetting(root, context, setting) {
@@ -134,14 +151,51 @@ function offeredSetting(root, context, setting) {
134
151
  const kept = offered.some((one) => comparableText(one) === comparableText(value ?? "")) ? { value } : {};
135
152
  return [{ ...rest, ...kept, ...(setting.choices === undefined ? {} : { choices: setting.choices.filter((choice) => offered.some((one) => comparableText(one) === comparableText(choice.value))) }) }];
136
153
  }
137
- // Who makes the pictures on this computer, in the player's words (D-390).
138
- const madeBy = { Codex: "Codex makes them on this computer, from your ChatGPT plan.", Claude: "Claude draws them on this computer, as vector pictures, from your Claude plan." };
154
+ // Who makes the pictures on this computer, in the player's words (D-390, D-572).
155
+ const madeBy = {
156
+ Codex: "Codex makes them on this computer, from your ChatGPT plan.",
157
+ Claude: "Claude draws them on this computer, as vector pictures, from your Claude plan.",
158
+ Antigravity: "Antigravity makes them in your chat, from your Google plan.",
159
+ };
160
+ // The master makes them with an image tool of its own, as ElevenLabs's (D-572).
161
+ const madeWithTool = "The master makes them with {tool}.";
162
+ const toolAsked = "The master asks you in the chat which tool to use.";
163
+ // Where the maker the player chose made no picture, and the chat in use makes them (D-572): it refused one, with its own words, or it cannot.
164
+ const refusedNote = "{maker} refused the last picture: {why}. {by} makes them instead.";
165
+ const madeMeanwhile = "{by} makes them meanwhile.";
166
+ // Whoever makes them, the player may give a page a picture of their own (D-572 (3)).
167
+ const ownPicture = "You can also give a page you see a picture of your own: with its picture button, or dropped in the campaign's inbox folder for the master.";
139
168
  /** Every note the pictures' setting may have, which the dashboard writes in its language (D-394). */
140
- export const picturesNotes = [...Object.values(madeBy), ...[...Object.values(codexSays), ...Object.values(claudeSays)].map(notReadyText)];
141
- /** Whether this computer makes pictures, and with whose plan, in the player's words (D-308, D-390); why not and how to have them; nothing where no maker is asked. */
169
+ export const picturesNotes = [...Object.values(madeBy), madeWithTool, toolAsked, refusedNote, madeMeanwhile, ownPicture, ...[...Object.values(codexSays), ...Object.values(claudeSays)].map(notReadyText)];
170
+ /**
171
+ * Whether this computer makes pictures, and with whose plan, in the player's words (D-308, D-390); why not and how to have them; where the maker the player
172
+ * chose made none and the chat in use makes them, why (D-572); nothing where no maker is asked.
173
+ */
142
174
  function picturesReadyNote(context) {
143
175
  const ready = context.pictures?.ready(true);
144
- return ready === undefined ? {} : { note: ready.ready ? { text: madeBy[ready.maker ?? "Codex"] } : { text: notReadyText(ready), fix: true } };
176
+ if (ready === undefined) {
177
+ return {};
178
+ }
179
+ if (!ready.ready) {
180
+ return { note: { text: notReadyText(ready), fix: true } };
181
+ }
182
+ const instead = ready.instead;
183
+ if (instead !== undefined) {
184
+ return instead.refused === true
185
+ ? { note: { text: refusedNote, values: { maker: instead.maker, why: instead.why.replace(/\.$/, ""), by: instead.by } } }
186
+ : { note: { text: notReadyText(instead), fix: true, values: { by: instead.by }, also: [madeMeanwhile] } };
187
+ }
188
+ if (ready.tool !== undefined) {
189
+ return { note: { text: madeWithTool, values: { tool: ready.tool } } };
190
+ }
191
+ if (ready.askTool === true) {
192
+ return { note: { text: toolAsked } };
193
+ }
194
+ return { note: { text: madeBy[ready.maker === "Claude" || ready.maker === "Antigravity" ? ready.maker : "Codex"] } };
195
+ }
196
+ /** The pictures' note with the line that the player may give a picture of their own after it. */
197
+ function withOwnPicture(note) {
198
+ return note.note === undefined ? note : { note: { ...note.note, also: [...note.note.also ?? [], ownPicture] } };
145
199
  }
146
200
  /** How the player has pictures, or else why there are none. */
147
201
  function notReadyText(said) {
@@ -1,7 +1,7 @@
1
1
  export declare const styleSettingNames: string[];
2
2
  export declare const betweenSessionsWays: readonly ["stops", "1d per 7d", "1d per 1d"];
3
3
  /** The settings the player changes on the dashboard (D-341): how the game plays for them; the master's own, as house rules, coins and precedents, stay in the chat. */
4
- export declare const playerSettingNames: readonly ["difficulty", "custom-difficulty", "lethality", "saves", "rigor", "custom-rigor", "between-sessions", "mentor", "learned", "prose", "story", "author", "style", "dice", "master-rolls", "units", "voices", "pictures", "effort", "lines", "veils", "orders", "language"];
4
+ export declare const playerSettingNames: readonly ["difficulty", "custom-difficulty", "lethality", "saves", "rigor", "custom-rigor", "between-sessions", "mentor", "learned", "prose", "story", "author", "style", "dice", "master-rolls", "units", "voices", "pictures", "pictures-by", "effort", "lines", "veils", "orders", "language"];
5
5
  export declare const playerWords: Record<(typeof playerSettingNames)[number], PlayerWords>;
6
6
  /**
7
7
  * What a setting of the player's is to them, its values and what each means; what the master does when an item is added to a list or taken off it, or a text
@@ -1,5 +1,5 @@
1
1
  // What each player setting and setup question is, in the player's words
2
- import { characterWays, companionWays, customLevel, diceWays, difficulties, efforts, lengths, lethalities, listLimits, masterRollWays, mentorWays, pictureWays, preparations, proseWays, rigors, saveModes, storyWays, styleTextLengths, unitSystems, voiceWays, } from "../../campaign/index.js";
2
+ import { characterWays, companionWays, customLevel, diceWays, difficulties, efforts, lengths, lethalities, listLimits, masterRollWays, mentorWays, pictureMakers, pictureWays, preparations, proseWays, rigors, saveModes, storyWays, styleTextLengths, unitSystems, voiceWays, } from "../../campaign/index.js";
3
3
  export const styleSettingNames = ["prose", "story", "author", "style"];
4
4
  // The game time between sessions the dashboard offers (D-133): stopped, a day of the game for each real week, or as real time.
5
5
  export const betweenSessionsWays = ["stops", "1d per 7d", "1d per 1d"];
@@ -23,6 +23,7 @@ export const playerSettingNames = [
23
23
  "units",
24
24
  "voices",
25
25
  "pictures",
26
+ "pictures-by",
26
27
  "effort",
27
28
  "lines",
28
29
  "veils",
@@ -48,7 +49,7 @@ export const playerWords = {
48
49
  saves: {
49
50
  about: "when the game may go back",
50
51
  values: saveModes,
51
- means: { permadeath: "never: what happens stays; only starting the campaign over", checkpoint: "if your character dies: back to the end of the last scene", free: "back to any save, and a save whenever you ask" },
52
+ means: { permadeath: "never: what happens stays; only starting the campaign over", checkpoint: "only when all is lost: back to the end of the last scene", free: "back to any save, and a save whenever you ask" },
52
53
  },
53
54
  rigor: {
54
55
  about: "how closely food, light, fatigue and the like follow the rules",
@@ -76,7 +77,7 @@ export const playerWords = {
76
77
  about: "how much the master teaches the game, out of the story",
77
78
  values: mentorWays,
78
79
  means: {
79
- off: "only the story; ask in brackets whenever you want",
80
+ off: "only the story; ask in [OOC: …] whenever you want",
80
81
  hints: "a short note before big choices and when a rule slips by",
81
82
  tutorial: "each rule explained the first time, the numbers shown, a short review after fights",
82
83
  },
@@ -118,7 +119,7 @@ export const playerWords = {
118
119
  most: styleTextLengths.style,
119
120
  cleared: "their own words on how you write no longer hold",
120
121
  },
121
- dice: { about: "who rolls your character's dice", values: diceWays, means: { digital: "the engine rolls them", physical: "you roll your own and tell the values" } },
122
+ dice: { about: "who rolls your character's dice", values: diceWays, means: { digital: "rolled in the game, on the dashboard", physical: "you roll your own and tell the values" } },
122
123
  "master-rolls": {
123
124
  about: "the master's rolls for foes and the characters you meet; yours and your companions' are always in view",
124
125
  values: masterRollWays,
@@ -142,13 +143,25 @@ export const playerWords = {
142
143
  values: pictureWays,
143
144
  means: { none: "no pictures", "on request": "those you ask for", "new elements": "one for each new place and quest, and for each one you meet" },
144
145
  },
146
+ // Any other value names an image tool of the master's, which the page shows as written (D-572).
147
+ "pictures-by": {
148
+ about: "who makes the pictures",
149
+ values: pictureMakers,
150
+ means: {
151
+ chat: "your AI app, by its own means: Claude draws them as vector pictures, Codex and Antigravity paint them, each from your plan",
152
+ codex: "Codex paints them on this computer, from your ChatGPT plan (Plus or higher)",
153
+ elevenlabs: "the master makes them with ElevenLabs, connected to your AI app, from your ElevenLabs plan",
154
+ other: "another image tool connected to your AI app: the master asks you which in the chat",
155
+ },
156
+ unset: "chat",
157
+ },
145
158
  effort: {
146
159
  about: "how much the master thinks before each answer, from the next chat",
147
160
  values: [...efforts, "app"],
148
161
  means: { low: "quicker answers, a little less thought", medium: "the usual balance", high: "slower answers, more thought", app: "your AI app decides, as it does in any chat" },
149
162
  unset: "app",
150
163
  },
151
- lines: { about: "what never appears in the game" },
164
+ lines: { about: "what must never appear in the game" },
152
165
  veils: { about: "what happens only off screen, without details" },
153
166
  // The standing orders, always before the master: their longest item, which the page's field keeps to (D-563).
154
167
  orders: {
@@ -37,7 +37,7 @@ export const find = defineCommand({
37
37
  const found = [...lines, ...system];
38
38
  const note = systemNote(result, lines.length > 0);
39
39
  // A name said in play and never written is no page: the player who remembers it is right (D-266).
40
- const unwritten = result.withText ? " What was said in play and never written is not in the files: if the player remembers it, write it." : "";
40
+ const unwritten = result.withText ? " What was said in play and never written is not in the files: chats finds it in the past chats; if the player remembers it, write it." : "";
41
41
  const none = `${note === "" || result.withText ? "No page matches." : "No page of the campaign matches."}${unwritten}`;
42
42
  return [found.length > 0 ? found.join("\n") : none, note, skippedPagesNote(result.problems)].filter((block) => block !== "").join("\n\n");
43
43
  },
@@ -1,4 +1,7 @@
1
1
  import { z } from "zod";
2
+ import type { Context } from "../core/context.ts";
3
+ import { type ReadImage } from "../images/index.ts";
4
+ import { type Page, type World } from "../pages/index.ts";
2
5
  interface ImageResult {
3
6
  page: string;
4
7
  /** The picture now in the campaign, from its folder; undefined when the page's own was removed. */
@@ -10,10 +13,21 @@ interface ImageResult {
10
13
  changed: boolean;
11
14
  /** The picture is being made, and comes by itself (D-308). */
12
15
  making?: boolean;
16
+ /** The brief of the picture the chat makes itself with its own tool, as Antigravity (D-390). */
17
+ paint?: string;
18
+ /** The master's own image tool that makes it from the brief, as ElevenLabs (D-572); none for the chat's own. */
19
+ tool?: string;
20
+ /** The player chose another image tool and has not named it yet: the master asks which (D-572). */
21
+ askTool?: true;
22
+ /** Why the chat in use made it, or makes it, in place of the maker the player chose (D-572). */
23
+ instead?: string;
13
24
  }
14
25
  export declare const image: import("../core/registry.ts").Command<z.ZodObject<{
15
26
  page: z.ZodString;
16
27
  file: z.ZodOptional<z.ZodString>;
28
+ url: z.ZodOptional<z.ZodString>;
17
29
  describe: z.ZodOptional<z.ZodString>;
18
30
  }, z.core.$strip>, ImageResult>;
31
+ /** Writes a picture into the campaign's images folder and links it in the page, logging it; `from` is the file it was read from, if any. */
32
+ export declare function placeImage(root: string, context: Context, world: World, page: Page, picture: ReadImage, from?: string): ImageResult;
19
33
  export {};
@@ -5,7 +5,7 @@ import { appendLogEntry } from "../core/log.js";
5
5
  import { defineCommand } from "../core/registry.js";
6
6
  import { files, isInside } from "../core/store.js";
7
7
  import { comparableText, withArticle } from "../core/text.js";
8
- import { imageFileName, imageLink, imagesFolderName, readImage } from "../images/index.js";
8
+ import { imageFileName, imageLink, imageOfBytes, imagesFolderName, largestImage, readImage } from "../images/index.js";
9
9
  import { baseChain, findPage, isPartyMember, ownField, pageNamed, parsePageReference, writePage } from "../pages/index.js";
10
10
  import { imageFile, ownImage } from "./shared/campaign/images.js";
11
11
  import { campaignSystem, campaignWorld } from "./shared/campaign/world.js";
@@ -17,7 +17,8 @@ export const image = defineCommand({
17
17
  name: "image",
18
18
  description: "Give a page its picture: a portrait for a character, an image for a creature, an item or a place, as the dashboard will show it in a round token. "
19
19
  + "It copies the file into the campaign and links it in the page's image field; a page without one shows the picture of the page it derives from, such as a wolf's icon. "
20
- + "Use it when the player gives you a picture, or after you made or downloaded one with your own tools. "
20
+ + "Use it when the player gives you a picture, or after you made one with your own tools: its file, or url with the https address your tool gives, which the engine downloads. "
21
+ + "The player may drop pictures in the campaign's inbox folder: ask what each is for, give it, then delete it from the inbox. "
21
22
  + "For a place, a quest, a character or a creature of the campaign, describe instead of file has the picture made on this computer, as the campaign's pictures setting allows: "
22
23
  + "for the player character or a companion only when the player asks; for a creature once for each kind, whose copies show it. "
23
24
  + "Example: page Ettore, file C:\\Users\\me\\Pictures\\ettore.png.",
@@ -25,7 +26,8 @@ export const image = defineCommand({
25
26
  positionals: ["page", "file"],
26
27
  input: z.object({
27
28
  page: z.string().describe("the page that gets the picture"),
28
- file: z.string().optional().describe("the picture's file, PNG, JPEG, WebP or SVG up to 5 MB: its full path or one from the folder the command runs in; leave it out to remove the page's own picture"),
29
+ file: z.string().optional().describe("the picture's file, PNG, JPEG, WebP or SVG up to 5 MB: its full path or one from the folder the command runs in; leave it and url out to remove the page's own picture"),
30
+ url: z.string().optional().describe("instead of file, the picture's https address, as an image tool gives it: the engine downloads it, the same formats up to 5 MB"),
29
31
  describe: z.string().optional().describe("instead of file, in a few lines, never a victim or wounds: for a place, what the party sees arriving; for a quest, what the character knows of it; "
30
32
  + "for one of the party, their look, their people as this world has them and the rest as the player described it; for a character or a creature met, what the character sees of them, "
31
33
  + "a disguise as the disguise; never what the character does not know. The picture is made where it can be, and comes by itself"),
@@ -40,23 +42,36 @@ export const image = defineCommand({
40
42
  if (page.system !== undefined) {
41
43
  throw new Error(`${systemRefusal(page)} Nothing changed.`);
42
44
  }
45
+ const url = input.url?.trim() ?? "";
46
+ const file = input.file?.trim() ?? "";
43
47
  if (input.describe !== undefined && input.describe.trim() !== "") {
44
- if (input.file !== undefined && input.file.trim() !== "") {
45
- throw new Error("Give file or describe, not both: file is a picture you have, describe has one made. Nothing changed.");
48
+ if (file !== "" || url !== "") {
49
+ throw new Error("Give file, url or describe, one of them: file and url are a picture you have, describe has one made. Nothing changed.");
46
50
  }
47
51
  return madePicture(root, context, world, page, input.describe.trim());
48
52
  }
49
- if (input.file === undefined || input.file.trim() === "") {
53
+ if (url !== "") {
54
+ if (file !== "") {
55
+ throw new Error("Give file or url, not both: file is a picture on this computer, url one on the web. Nothing changed.");
56
+ }
57
+ return downloadedImage(root, context, world, page, url);
58
+ }
59
+ if (file === "") {
50
60
  return removeImage(root, context, world, page, imageFile(root, context, ownImage(page)));
51
61
  }
52
- return setImage(root, context, world, page, resolve(context.folder, input.file.trim()));
62
+ return setImage(root, context, world, page, resolve(context.folder, file));
53
63
  },
54
64
  format(result) {
65
+ if (result.paint !== undefined) {
66
+ const how = result.askTool === true ? askToolText(result.page) : paintText(result.page, result.tool);
67
+ return `${result.instead === undefined ? "" : `${result.instead} `}${how}\n\n${result.paint}`;
68
+ }
55
69
  if (result.making === true) {
56
70
  return `${result.page}'s picture is being made, in a minute or so: the player's dashboard shows it when it comes. Go on with the story.`;
57
71
  }
58
72
  if (result.image !== undefined) {
59
- return `${result.page}'s picture is now ${result.image}${result.from === undefined ? "" : `, copied from ${result.from}`}.`;
73
+ const now = `${result.page}'s picture is now ${result.image}${result.from === undefined ? "" : `, copied from ${result.from}`}.`;
74
+ return result.instead === undefined ? now : `${now} ${result.instead}`;
60
75
  }
61
76
  const shown = result.inheritedFrom === undefined ? "it has none now" : `it shows the picture of ${result.inheritedFrom}`;
62
77
  return result.changed ? `${result.page} has no picture of its own any more: ${shown}.` : `${result.page} has no picture of its own: ${shown}.`;
@@ -64,20 +79,46 @@ export const image = defineCommand({
64
79
  });
65
80
  /** Copies a picture into the campaign's images folder and links it in the page; the page's old picture goes when nothing else links it. */
66
81
  function setImage(root, context, world, page, from) {
67
- const old = imageFile(root, context, ownImage(page));
68
- const picture = readImage(from);
82
+ return placeImage(root, context, world, page, readImage(from), from);
83
+ }
84
+ /**
85
+ * The picture at an https address, as an image tool gives it (T-222), downloaded by the engine where the master has no shell, then taken as a file is.
86
+ * The address itself is neither logged nor kept: a signed one is a key.
87
+ */
88
+ async function downloadedImage(root, context, world, page, url) {
89
+ if (!/^https:\/\/[^\s/]+/i.test(url)) {
90
+ throw new Error("url takes the https address of the picture, as your image tool gives it, and that is not one: give the full https address, or the picture's file. Nothing changed.");
91
+ }
92
+ if (context.download === undefined) {
93
+ throw new Error("Here the engine cannot download: download the picture yourself and give it with file and its full path. Nothing changed.");
94
+ }
95
+ const signal = context.signal === undefined ? AbortSignal.timeout(longestDownload) : AbortSignal.any([context.signal, AbortSignal.timeout(longestDownload)]);
96
+ const bytes = await context.download(url, largestImage, signal).catch((error) => {
97
+ const why = error instanceof Error ? error.message : String(error);
98
+ throw new Error(`No picture came from the address: ${why} If it expired, as signed addresses do, ask your image tool for a new one. Nothing changed.`);
99
+ });
100
+ return placeImage(root, context, world, page, imageOfBytes(bytes, "What the address gave"));
101
+ }
102
+ /** Writes a picture into the campaign's images folder and links it in the page, logging it; `from` is the file it was read from, if any. */
103
+ export function placeImage(root, context, world, page, picture, from) {
69
104
  if ("problem" in picture) {
70
105
  throw new Error(`${picture.problem} Nothing changed.`);
71
106
  }
107
+ const old = imageFile(root, context, ownImage(page));
72
108
  const target = join(root, imagesFolderName, `${page.name}.${picture.extension}`);
73
- if (resolve(target) !== from) {
109
+ const copied = from !== undefined && resolve(target) !== from;
110
+ if (from === undefined || copied) {
74
111
  files().writeBytes(target, picture.bytes);
75
112
  }
76
113
  writePage(world, page.name, undefined, { set: { image: imageLink(`${page.name}.${picture.extension}`) } });
77
114
  removeUnused(root, world, page, old, target);
78
115
  appendLogEntry(root, newDatedLogEntry(root, context, "image-set", "public", { page: page.name, image: shownPath(root, target) }));
79
- return { page: page.name, image: shownPath(root, target), from: resolve(target) === from ? undefined : from, changed: true };
116
+ return { page: page.name, image: shownPath(root, target), from: copied ? from : undefined, changed: true };
80
117
  }
118
+ // Where nothing makes the picture, the player may give one of their own (D-572 (3)).
119
+ const playerGives = "ask the player for one of their own, given on the page in their dashboard or dropped in the campaign's inbox folder";
120
+ // How long a picture's download may take: a few megabytes come in seconds.
121
+ const longestDownload = 60 * 1000;
81
122
  /** Why a page of the game system takes no picture, and how to give one: to a page of the campaign that derives from it, which a creature's scenes then bring in. */
82
123
  function systemRefusal(page) {
83
124
  const readOnly = `${page.name} is ${withArticle(page.type ?? "page")} of the game system ${page.system}: read-only.`;
@@ -102,8 +143,8 @@ function copyRefusal(root, world, name) {
102
143
  /**
103
144
  * A place's picture made from what the party sees, a quest's from what the character knows of it, the portrait of one of the party as the player described
104
145
  * them, or the token of a character or a kind of creature met, from what the character sees (D-308, D-388, D-408, D-420, PIC-1–PIC-3), where the campaign's
105
- * setting allows it and this computer can: in the MCP server it comes by itself while the story goes on; on the command line the command waits for it. A refusal
106
- * is never tried again.
146
+ * setting allows it and this computer can: in the MCP server it comes by itself while the story goes on, and the master's next call says whether another
147
+ * maker drew it or none came (D-572); on the command line the command waits for it. A refusal is never tried again.
107
148
  */
108
149
  function madePicture(root, context, world, page, seen) {
109
150
  const kind = page.type === "place" || page.type === "quest" || page.type === "creature" ? page.type : page.type === "character" ? "portrait" : undefined;
@@ -116,20 +157,28 @@ function madePicture(root, context, world, page, seen) {
116
157
  }
117
158
  const ready = context.pictures?.ready(true) ?? { ready: false, why: "Nothing on this computer makes pictures" };
118
159
  if (!ready.ready || context.pictures === undefined) {
119
- throw new Error(`${ready.ready ? "Nothing on this computer makes pictures" : ready.why}. If your own tools make pictures, make one and give it with file; else go on without. Nothing changed.`);
160
+ throw new Error(`${ready.ready ? "Nothing on this computer makes pictures" : ready.why}. If your own tools make pictures, make one and give it with file; else ${playerGives}, or go on without. Nothing changed.`);
120
161
  }
121
162
  const unseen = [...readListSetting(root, "lines"), ...readListSetting(root, "veils")];
122
163
  const { name, who } = kind === "place" || kind === "quest" ? { name: page.name } : isPartyMember(page) ? { name: page.name, who: portraitWho(root, context, world, page) } : metWho(root, world, page);
123
- const making = context.pictures.make({ kind, name, ...(who === undefined ? {} : { who }), seen, unseen }).then((made) => {
164
+ const subject = { kind, name, ...(who === undefined ? {} : { who }), seen, unseen };
165
+ const paint = context.pictures.brief?.(subject);
166
+ // The chat paints it itself, with its own tool or one it names.
167
+ if (paint !== undefined) {
168
+ const instead = ready.instead === undefined ? {} : { instead: insteadText(page.name, ready.instead, false) };
169
+ const tool = ready.askTool === true ? { askTool: true } : ready.tool === undefined ? {} : { tool: ready.tool };
170
+ return { page: page.name, changed: false, paint, ...tool, ...instead };
171
+ }
172
+ const making = context.pictures.make(subject).then((made) => {
124
173
  if ("refused" in made) {
125
174
  appendLogEntry(root, newDatedLogEntry(root, context, "image-refused", "hidden", { page: page.name, why: made.refused }));
126
- throw new Error(`No picture of ${page.name}: ${made.refused}. Go on without, or give one with file.`);
175
+ throw new Error(`No picture of ${page.name}: ${made.refused}. Give one with file, or ${playerGives}, or go on without.`);
127
176
  }
128
177
  try {
129
178
  const world = campaignWorld(root, context);
130
179
  const now = world.pages.find((candidate) => candidate.path === page.path) ?? page;
131
180
  // Codex's own copy goes once copied: the picture is the campaign's.
132
- return { ...setImage(root, context, world, now, made.file), from: undefined };
181
+ return { ...setImage(root, context, world, now, made.file), from: undefined, ...(made.instead === undefined ? {} : { instead: insteadText(page.name, made.instead, true) }) };
133
182
  }
134
183
  finally {
135
184
  made.done();
@@ -138,10 +187,41 @@ function madePicture(root, context, world, page, seen) {
138
187
  if (context.files === undefined) {
139
188
  return making;
140
189
  }
141
- // The MCP server lives on: the picture comes by itself, and the dashboard shows it.
142
- making.catch(() => undefined);
190
+ // The MCP server lives on: the picture comes by itself, the dashboard shows it, and the master's next call hears what went otherwise.
191
+ void making.then((made) => {
192
+ if (made.instead !== undefined) {
193
+ context.later?.add(made.instead);
194
+ }
195
+ }, (error) => context.later?.add(error instanceof Error ? error.message : String(error)));
143
196
  return { page: page.name, changed: false, making: true };
144
197
  }
198
+ /** Why the chat in use made a picture, or makes it, in place of the maker the player chose, for the master (D-572). */
199
+ function insteadText(name, instead, made) {
200
+ const why = `${instead.maker} ${instead.refused === true ? "refused" : "could not make"} ${name}'s picture: ${instead.why.replace(/\.$/, "")}.`;
201
+ return made ? `${why} ${instead.by} made it instead.` : why;
202
+ }
203
+ /** How the master makes a picture from its brief: with their own image tool, with ElevenLabs's, or with the one the player named (D-390, D-572). */
204
+ function paintText(page, tool) {
205
+ const give = giveText(page);
206
+ if (tool === undefined) {
207
+ return `Make ${page}'s picture yourself with your own image tool, from this brief, then ${give}; if your tool makes none, go on without.`;
208
+ }
209
+ if (tool === "ElevenLabs") {
210
+ return `Make ${page}'s picture with your ElevenLabs image tool, from this brief: one picture (generations_count 1). Its view shows the player the progress, but the game needs the finished file: `
211
+ + `ask for the generation again every 15 seconds or so until it is completed, then give its full-resolution address with image, page ${page}, url, or download it and give file. `
212
+ + `If your ElevenLabs tools make no pictures, tell the player to add the full ElevenLabs connector, a custom connector at https://api.elevenlabs.io/v1/mcp; if it fails, tell them why and go on without.`;
213
+ }
214
+ return `Make ${page}'s picture with ${tool}, from this brief, then ${give}; if it makes none, tell the player why and go on without.`;
215
+ }
216
+ /** What the master does where the player chose another image tool without naming it (D-572): asks which, writes it, then makes the picture with it. */
217
+ function askToolText(page) {
218
+ return `The player chose another image tool for the pictures and has not named it: ask them which, set its name with config pictures-by, then make ${page}'s picture with it from this brief `
219
+ + `and ${giveText(page)}; if they have none, go on without.`;
220
+ }
221
+ /** How the master gives the picture its tool made: its file, or the address the tool gives where they cannot download it (T-222). */
222
+ function giveText(page) {
223
+ return `give it with image, page ${page}, file and its full path, or url and its https address where the tool gives one you cannot download`;
224
+ }
145
225
  /** What the game says one of the party is, for their portrait (D-408): what their page derives from, as their people, and the line under their name. */
146
226
  function portraitWho(root, context, world, page) {
147
227
  const said = [baseChain(world, page).map((base) => base.name).join(", "), sheetHeadline(world, campaignSystem(root, context), page) ?? ""].filter((part) => part !== "");
@@ -1,6 +1,8 @@
1
1
  import { advance } from "./advance.js";
2
2
  import { ask } from "./ask.js";
3
+ import { book } from "./book.js";
3
4
  import { change } from "./change/change.js";
5
+ import { chats } from "./chats.js";
4
6
  import { choices } from "./choices.js";
5
7
  import { config } from "./config/config.js";
6
8
  import { effect } from "./effect.js";
@@ -48,6 +50,8 @@ export const commands = [
48
50
  show,
49
51
  view,
50
52
  find,
53
+ chats,
54
+ book,
51
55
  rules,
52
56
  roll,
53
57
  ask,
@@ -33,15 +33,15 @@ export const init = defineCommand({
33
33
  createWorld(root);
34
34
  appendLogEntry(root, newLogEntry(context, "campaign-created", "public", settings));
35
35
  // What the next campaign's setup suggests (T-134).
36
- rememberChoice(context.home, "difficulty", settings.difficulty);
37
- rememberChoice(context.home, "lethality", settings.lethality);
36
+ rememberChoice(context.home, root, "difficulty", settings.difficulty);
37
+ rememberChoice(context.home, root, "lethality", settings.lethality);
38
38
  return { root, name: settings.name, note: input.master === true ? campaignNote(root, context) : "" };
39
39
  },
40
40
  // The player reads it, who made the campaign in a terminal: what to do next. What the master still agrees with them only when the master made it (T-185).
41
41
  format(result) {
42
42
  return [
43
43
  `Created the campaign "${result.name}" in ${result.root}.`,
44
- "To play, open Claude Code or Codex in this folder and say hello: the master asks you the rest.",
44
+ "To play, open Claude Code, Codex or Antigravity in this folder and say hello: the master asks you the rest.",
45
45
  ...(result.note === "" ? [] : ["", `For the master: ${result.note}`]),
46
46
  ].join("\n");
47
47
  },
@@ -0,0 +1,35 @@
1
+ import { type PackageEntry } from "../../core/archive.ts";
2
+ import type { Context } from "../../core/context.ts";
3
+ import type { PackageResult } from "./result.ts";
4
+ /** What a package of data alone is, by the file at its top. */
5
+ export type DataKind = "adventure" | "theme" | "language";
6
+ /** A package of data alone, read whole: what it is, what it was given as, and its files from its top. */
7
+ export interface DataPackage {
8
+ kind: DataKind;
9
+ label: string;
10
+ /** Where it came from, as a later update must: a GitHub repository's link, another link, a .zip's or a folder's path. */
11
+ source: string;
12
+ entries: PackageEntry[];
13
+ }
14
+ /**
15
+ * Whether what was given to package install is a package of data alone: a .zip, an https link, or a folder with adventure.yaml, theme.yaml, or language.yaml
16
+ * and no package.json for RPG Engine, which npm installs; a document says it is imported instead.
17
+ */
18
+ export declare function isDataSpec(spec: string): boolean;
19
+ /** The package of data a .zip, a folder or an https link gives: a GitHub repository is read as the zip of its default branch, or of the branch or tag its link names. */
20
+ export declare function readDataSpec(spec: string, context: Context): Promise<DataPackage>;
21
+ /**
22
+ * A GitHub repository's link, as the catalog gives it, and the address of its zip: of its default branch, or of the branch or tag after /tree/, each part of
23
+ * the name written as an address writes it. Undefined for a link that is not a repository's.
24
+ */
25
+ export declare function gitHubRepository(link: string): {
26
+ link: string;
27
+ zip: string;
28
+ } | undefined;
29
+ /**
30
+ * The package of data a .zip holds, at its top or inside one folder there, as GitHub zips a repository; it throws, saying why, when it is refused. Its names are
31
+ * read first: a theme's or a language's .zip that unpacks to more than they may is refused before any file is unpacked.
32
+ */
33
+ export declare function zipDataPackage(bytes: Uint8Array, label: string, source: string): DataPackage;
34
+ /** Installs a package of data alone, as the file at its top says it is: an adventure in the campaign, a theme or a language for every campaign on this computer. */
35
+ export declare function installDataPackage(root: string, context: Context, data: DataPackage, from: string): Promise<PackageResult>;