rpg-engine 0.10.0 → 0.11.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 (119) hide show
  1. package/README.md +1 -1
  2. package/dist/adventures/placement.js +4 -0
  3. package/dist/campaign/find-campaign.js +18 -0
  4. package/dist/campaign/host-files.js +8 -6
  5. package/dist/campaign/index.d.ts +1 -1
  6. package/dist/campaign/index.js +1 -1
  7. package/dist/campaign/settings.d.ts +2 -0
  8. package/dist/campaign/settings.js +12 -5
  9. package/dist/commands/advance.js +1 -1
  10. package/dist/commands/ask.js +1 -1
  11. package/dist/commands/config.js +21 -32
  12. package/dist/commands/import/import.js +1 -1
  13. package/dist/commands/instructions.js +1 -1
  14. package/dist/commands/mode.js +1 -1
  15. package/dist/commands/mood.js +2 -3
  16. package/dist/commands/move.js +1 -1
  17. package/dist/commands/package.js +2 -2
  18. package/dist/commands/reveal.js +1 -1
  19. package/dist/commands/roll/roll.js +6 -12
  20. package/dist/commands/rules.js +0 -1
  21. package/dist/commands/scene.js +6 -8
  22. package/dist/commands/shared/adventures.js +1 -1
  23. package/dist/commands/shared/images.js +3 -1
  24. package/dist/commands/shared/knowledge.d.ts +8 -0
  25. package/dist/commands/shared/knowledge.js +41 -18
  26. package/dist/commands/shared/mode.d.ts +7 -4
  27. package/dist/commands/shared/mode.js +28 -15
  28. package/dist/commands/shared/packages/code.js +13 -2
  29. package/dist/commands/shared/page-words.d.ts +2 -0
  30. package/dist/commands/shared/page-words.js +13 -0
  31. package/dist/commands/shared/sheet.d.ts +3 -2
  32. package/dist/commands/shared/sheet.js +8 -5
  33. package/dist/commands/show.js +1 -1
  34. package/dist/commands/status.js +9 -5
  35. package/dist/commands/view/place.js +9 -3
  36. package/dist/commands/write/write.js +4 -3
  37. package/dist/core/archive-paths.js +1 -1
  38. package/dist/core/package-api.d.ts +1 -1
  39. package/dist/core/package-declarations.d.ts +3 -3
  40. package/dist/core/package-declarations.js +3 -3
  41. package/dist/core/store.d.ts +4 -0
  42. package/dist/core/store.js +20 -1
  43. package/dist/dashboard/guide/ar.md +13 -13
  44. package/dist/dashboard/guide/cs.md +11 -11
  45. package/dist/dashboard/guide/da.md +12 -12
  46. package/dist/dashboard/guide/de.md +11 -11
  47. package/dist/dashboard/guide/el.md +13 -13
  48. package/dist/dashboard/guide/en.md +2 -2
  49. package/dist/dashboard/guide/es.md +12 -12
  50. package/dist/dashboard/guide/fi.md +15 -15
  51. package/dist/dashboard/guide/fr.md +11 -11
  52. package/dist/dashboard/guide/he.md +10 -10
  53. package/dist/dashboard/guide/hi.md +15 -15
  54. package/dist/dashboard/guide/hu.md +12 -12
  55. package/dist/dashboard/guide/is.md +10 -10
  56. package/dist/dashboard/guide/it.md +3 -3
  57. package/dist/dashboard/guide/ja.md +11 -11
  58. package/dist/dashboard/guide/ko.md +14 -14
  59. package/dist/dashboard/guide/nb.md +12 -12
  60. package/dist/dashboard/guide/nl.md +13 -13
  61. package/dist/dashboard/guide/pl.md +12 -12
  62. package/dist/dashboard/guide/pt.md +9 -9
  63. package/dist/dashboard/guide/ro.md +12 -12
  64. package/dist/dashboard/guide/ru.md +11 -11
  65. package/dist/dashboard/guide/sv.md +11 -11
  66. package/dist/dashboard/guide/tr.md +14 -14
  67. package/dist/dashboard/guide/uk.md +11 -11
  68. package/dist/dashboard/guide/zh.md +13 -13
  69. package/dist/dashboard/i18n/ar.json +1 -0
  70. package/dist/dashboard/i18n/cs.json +1 -0
  71. package/dist/dashboard/i18n/da.json +1 -0
  72. package/dist/dashboard/i18n/de.json +1 -0
  73. package/dist/dashboard/i18n/el.json +1 -0
  74. package/dist/dashboard/i18n/es.json +1 -0
  75. package/dist/dashboard/i18n/fi.json +1 -0
  76. package/dist/dashboard/i18n/fr.json +1 -0
  77. package/dist/dashboard/i18n/he.json +1 -0
  78. package/dist/dashboard/i18n/hi.json +1 -0
  79. package/dist/dashboard/i18n/hu.json +1 -0
  80. package/dist/dashboard/i18n/is.json +1 -0
  81. package/dist/dashboard/i18n/it.json +1 -0
  82. package/dist/dashboard/i18n/ja.json +1 -0
  83. package/dist/dashboard/i18n/ko.json +1 -0
  84. package/dist/dashboard/i18n/nb.json +1 -0
  85. package/dist/dashboard/i18n/nl.json +1 -0
  86. package/dist/dashboard/i18n/pl.json +1 -0
  87. package/dist/dashboard/i18n/pt.json +1 -0
  88. package/dist/dashboard/i18n/ro.json +1 -0
  89. package/dist/dashboard/i18n/ru.json +1 -0
  90. package/dist/dashboard/i18n/sv.json +1 -0
  91. package/dist/dashboard/i18n/tr.json +1 -0
  92. package/dist/dashboard/i18n/uk.json +1 -0
  93. package/dist/dashboard/i18n/zh.json +1 -0
  94. package/dist/dice/index.d.ts +1 -1
  95. package/dist/dice/oracle.d.ts +5 -3
  96. package/dist/dice/oracle.js +7 -6
  97. package/dist/helpers/codex.js +1 -1
  98. package/dist/packages/npm.js +13 -2
  99. package/dist/pages/index.d.ts +1 -1
  100. package/dist/pages/index.js +1 -1
  101. package/dist/pages/markdown.d.ts +2 -0
  102. package/dist/pages/markdown.js +21 -0
  103. package/dist/pages/world.js +4 -0
  104. package/dist/server/dashboard/index.js +8 -4
  105. package/dist/server/mcp.d.ts +3 -1
  106. package/dist/server/mcp.js +20 -5
  107. package/dist/systems/game-system.d.ts +2 -0
  108. package/dist/systems/game-system.js +2 -0
  109. package/instructions/adventure.md +1 -1
  110. package/instructions/combat.md +1 -1
  111. package/instructions/core.md +2 -2
  112. package/instructions/import.md +1 -0
  113. package/instructions/session-zero.md +1 -1
  114. package/instructions/session.md +1 -1
  115. package/instructions/setup.md +1 -1
  116. package/package.json +2 -2
  117. package/systems/free/instructions/outcomes-rolled.md +1 -1
  118. package/systems/free/instructions/outcomes-tossed.md +1 -1
  119. package/systems/free/instructions/play.md +1 -2
@@ -1,4 +1,4 @@
1
- <!-- Translated from en.md, part by part, by npm run translate: c38df721 53ff5eaa 9f1774ef 4c5cd093 019e9516 8e136927 7da791ae 423af5fa 17577253 f699a840 2731ea0e 59c1a762. Change the English, then run it again. -->
1
+ <!-- Translated from en.md, part by part, by npm run translate: c38df721 53ff5eaa 9f1774ef 4c5cd093 019e9516 8e136927 95c609b6 423af5fa 17577253 4c3ea82e 2731ea0e 59c1a762. Change the English, then run it again. -->
2
2
  # RPG Engine:完整指南
3
3
 
4
4
  **RPG Engine** 让你和一位 **AI 主持人**一起玩桌面角色扮演游戏。你在**聊天**里和主持人交谈;RPG Engine 在幕后工作:它**记住世界**,**掷骰子**,**记账**。聊天旁边,你在浏览器里开着一个页面,也就是**仪表盘**,上面有你的角色卡、骰子、地图和日志。
@@ -214,29 +214,29 @@ RPG Engine 可以按**图片**设置,为你到达的地点、接下的任务
214
214
 
215
215
  ---
216
216
 
217
- ## 5. 游戏系统与自订规则 <!-- icon: dice -->
217
+ ## 5. 游戏系统与房规 <!-- icon: dice -->
218
218
 
219
219
  ### 5.1 什么是游戏系统
220
220
 
221
- 它是一款游戏的全部数据:角色卡、数值、生物、物品、法术和规则文本。每个战役使用一个系统。RPG Engine 负责计算角色卡,以及消耗和恢复的资源;某项能力如何生效,则由主持人阅读规则后裁定,就像在牌桌上一样。
221
+ 一款游戏的全部数据:角色卡、数值、生物、物品、法术和规则文本。每个战役只玩一种系统。RPG Engine 负责计算角色卡,以及消耗和恢复的资源;某项能力具体如何生效,由主持人查阅规则后裁定,就像在牌桌上一样。
222
222
 
223
223
  ### 5.2 第五版
224
224
 
225
- 包含 SRD 5.1 中的种族、职业、子职业、一个背景和一个专长;319 个法术,以及武器、护甲、魔法物品和怪物;还有规则章节,主持人会按其原文查阅;以及完整的角色卡,数值全部算好。
225
+ 包含 SRD 5.1 的种族、职业、子职业、一个背景和一个专长;319 个法术,以及武器、护甲、魔法物品和怪物;还有规则章节,主持人会按原文查阅;以及完整的、已算好的角色卡。
226
226
 
227
- 它是一个独立的包:你设置战役时,主持人会提议并安装它。使用它的战役,在一台没有安装它的电脑上首次打开时,会自动安装,主持人也会告诉你。
227
+ 它是一个独立的包:你设置战役时,主持人会提议使用它,并为你安装。玩这套系统的战役,第一次在没有安装它的电脑上打开时,会自动安装,主持人也会告诉你。
228
228
 
229
- 你也可以玩 SRD 里没有的内容,来源是你自己拥有的书:主持人会把它写成战役的页面,RPG Engine 会把它当作自己的内容来处理。RPG Engine 只附带开放内容;主持人所知道的则不受限制。
229
+ SRD 里没有的内容,你也可以玩,只要来自你自己拥有的书:主持人会把它写成你战役的页面,RPG Engine 将它们视为自己的内容。RPG Engine 只附带开放内容;主持人所知道的则不受此限。
230
230
 
231
- 你自己的手册可以作为你的资料库:告诉主持人它们在哪里,*[我的手册在 D:\Books\5e。]*,或者在 Packages › Library 中添加它们所在的文件夹,并在电脑弹出的窗口中点一次“是”。RPG Engine 会在这台电脑上读取它们;每个战役使用你在那里开启的文件夹。主持人在裁定规则时,会在查过 SRD 之后搜索这些文件夹,并注明书名和页码。文本格式最适合阅读,文字可选取的 PDF 也可以;扫描版 PDF 会通过页面图片来识别,仅限 Windows,需要几分钟,也会有少许错误。RPG Engine 绝不会修改你的手册,绝不会把其中的文字发送到任何地方,也绝不会把它们复制进战役。
231
+ 你自己的手册可以成为你的资料库:告诉主持人它们在哪里,*[我的手册在 D:\Books\5e。]*,或者在 Packages › Library 中添加它们所在的文件夹,并在电脑弹出的窗口里点一次“是”。RPG Engine 会在这台电脑上读取它们;每个战役使用你在那里打开的文件夹,主持人在裁定规则时会在 SRD 之后搜索这些手册,并注明书名和页码。纯文本,或文字可以选中的 PDF,读取效果最好;扫描版 PDF 则是根据页面图片来识别的,只支持 Windows,需要几分钟,也会有少量错误。RPG Engine 绝不会修改你的手册,绝不会把手册文字发送到任何地方,也绝不会把它复制进战役。
232
232
 
233
- ### 5.3 自订规则与你自己的补充
233
+ ### 5.3 房规与你自己的补充
234
234
 
235
- 请告诉主持人:*[自订规则:攻击掷出自然 1 时,武器会脱手。]* 主持人会把它记作牌桌上的约定;需要时,也会写一个页面,或在角色卡上写一个数值。已经写好的自订规则,可以作为文本文件放进战役的 `rules` 文件夹。
235
+ 对主持人说:*[房规:攻击掷出自然 1 时,武器会脱手。]* 主持人会把它记为牌桌上的约定;需要时,也会写成一个页面,或角色卡上的一个数值。已经写好的房规,可以作为文本文件放进战役的 `rules` 文件夹。
236
236
 
237
237
  ### 5.4 添加或导入你自己的游戏系统
238
238
 
239
- 游戏系统是一个包:主持人可以从 npm、文件夹或文件中安装它;不是我们提供的包,只有在你于电脑窗口中点“是”之后才会安装。制作游戏系统是开发者的工作,在 GitHub 上的 RPG Engine 文档中有说明。把你自己的一本书变成游戏系统,目前还做不到([后续计划](#9-coming-later))。
239
+ 游戏系统是一个包:主持人可以从 npm、文件夹或文件安装。不是我们提供的包,只有在你同意后才会安装,你可以在 AI 助手的表单或电脑的窗口中确认。制作游戏系统是开发者的工作,详见 RPG Engine 在 GitHub 上的文档。把你的书变成游戏系统,目前还不支持([后续推出](#9-coming-later))。
240
240
 
241
241
  ---
242
242
 
@@ -264,11 +264,11 @@ RPG Engine 可以按**图片**设置,为你到达的地点、接下的任务
264
264
 
265
265
  ## 8. 好奇者专区:战役文件夹 <!-- icon: list -->
266
266
 
267
- 你完全不需要打开它,而且里面藏着战役的秘密。其中有 `campaign.yaml`(你的设置)、`state.yaml`(游戏进行到哪里)、`world/`(每个角色、地点、任务等各有一个 markdown 页面)、`rules/`(你的房规)、`images/`、`log.jsonl`(每一次改动)、`.saves/`、`.player/`(你的笔记),以及告诉 AI 代理 RPG Engine 在哪里的几个小文件。页面采用 Obsidian 的格式。如果你手动修改了某个页面,主持人会在下一次回答时得知。
267
+ 你完全不需要打开它,而且里面存着你战役的秘密。其中有 `campaign.yaml`(你的设置)、`state.yaml`(游戏进行到哪里)、`world/`(每个角色、地点、任务等各占一页 markdown)、`rules/`(你的房规)、`images/`、`log.jsonl`(每一次改动)、`.saves/`、`.player/`(你的笔记),以及告诉 AI 助手 RPG Engine 在哪里的几个小文件。页面采用 Obsidian 的格式。如果你手动修改了某个页面,主持人会在下一次回答时得知。
268
268
 
269
- RPG Engine 只待在这个文件夹里:它只在这里读写游戏,绝不会碰你的其他文件;你放规则书的文件夹,它只读取。在此之外,它只保留自己的数据文件夹(仪表盘的翻译、从你的规则书中读出的文本,以及你允许安装时的 Codex 或 Claude Code),还有绘制图片时用到的临时文件夹。你的代理若想在电脑上做其他任何事,都会先征求你的同意。
269
+ RPG Engine 只在这个文件夹内活动:它只在这里读写游戏,绝不会碰你的其他文件;你的手册所在的文件夹,它只读取。在这个文件夹之外,它只保留自己的数据文件夹(仪表盘的翻译、它从你的手册中读出的文字,以及你允许安装的 Codex 或 Claude Code),还有绘制图片时用到的临时文件夹。你的 AI 助手若想在电脑上做别的事,都会先征求你的同意。游戏系统或扩展就是代码,和所有 npm 包一样:不是我们提供的包,会以你的权限在你的电脑上运行,RPG Engine 只有在你同意后才会安装,你可以在 AI 助手的表单或电脑的窗口中确认。只对你信任其作者的包说“是”。
270
270
 
271
- 主持人使用的每条命令,也都可以在战役文件夹里运行:`rpg --help` 会列出它们。许多命令会打印出战役的秘密。
271
+ 主持人用到的每一条命令,也都可以在战役文件夹里运行:`rpg --help` 会列出它们。许多命令会打印出战役的秘密。
272
272
 
273
273
  ---
274
274
 
@@ -946,6 +946,7 @@
946
946
  "The story starts on day {day}": "تبدأ القصة في اليوم {day}",
947
947
  "The story starts on day {day}, {time}": "تبدأ القصة في اليوم {day}، {time}",
948
948
  "The story starts with the first scene.": "تبدأ القصة بالمشهد الأول.",
949
+ "The text above lies behind the master's screen, forbidden to the players' eyes.": "النص أعلاه خلف حاجز مدير اللعبة، ومحظور على أعين اللاعبين.",
949
950
  "The title of the note {title}": "عنوان الملاحظة {title}",
950
951
  "the top bar": "الشريط العلوي",
951
952
  "the units of the story": "وحدات القياس في القصة",
@@ -946,6 +946,7 @@
946
946
  "The story starts on day {day}": "Příběh začíná dne {day}",
947
947
  "The story starts on day {day}, {time}": "Příběh začíná dne {day}, {time}",
948
948
  "The story starts with the first scene.": "Příběh začíná první scénou.",
949
+ "The text above lies behind the master's screen, forbidden to the players' eyes.": "Text výše je schovaný za zástěnou Pána jeskyně a hráčům je zakázáno ho vidět.",
949
950
  "The title of the note {title}": "Název poznámky {title}",
950
951
  "the top bar": "horní lišta",
951
952
  "the units of the story": "jednotky v příběhu",
@@ -946,6 +946,7 @@
946
946
  "The story starts on day {day}": "Historien begynder på dag {day}",
947
947
  "The story starts on day {day}, {time}": "Historien begynder på dag {day}, {time}",
948
948
  "The story starts with the first scene.": "Historien starter med den første scene.",
949
+ "The text above lies behind the master's screen, forbidden to the players' eyes.": "Teksten ovenfor ligger bag spillederens skærm og er forbudt for spillernes øjne.",
949
950
  "The title of the note {title}": "Titlen på noten {title}",
950
951
  "the top bar": "den øverste bjælke",
951
952
  "the units of the story": "historiens måleenheder",
@@ -946,6 +946,7 @@
946
946
  "The story starts on day {day}": "Die Geschichte beginnt an Tag {day}",
947
947
  "The story starts on day {day}, {time}": "Die Geschichte beginnt an Tag {day}, {time}",
948
948
  "The story starts with the first scene.": "Die Geschichte beginnt mit der ersten Szene.",
949
+ "The text above lies behind the master's screen, forbidden to the players' eyes.": "Der Text oben liegt hinter dem Schirm der Spielleitung und ist für die Augen der Spielenden tabu.",
949
950
  "The title of the note {title}": "Titel der Notiz {title}",
950
951
  "the top bar": "die obere Leiste",
951
952
  "the units of the story": "die Maßeinheiten der Geschichte",
@@ -946,6 +946,7 @@
946
946
  "The story starts on day {day}": "Η ιστορία ξεκινά την ημέρα {day}",
947
947
  "The story starts on day {day}, {time}": "Η ιστορία ξεκινά την ημέρα {day}, {time}",
948
948
  "The story starts with the first scene.": "Η ιστορία ξεκινά με την πρώτη σκηνή.",
949
+ "The text above lies behind the master's screen, forbidden to the players' eyes.": "Το κείμενο παραπάνω βρίσκεται πίσω από το παραβάν του αφηγητή, απαγορευμένο για τα μάτια των παικτών.",
949
950
  "The title of the note {title}": "Ο τίτλος της σημείωσης {title}",
950
951
  "the top bar": "η πάνω γραμμή",
951
952
  "the units of the story": "οι μονάδες μέτρησης της ιστορίας",
@@ -946,6 +946,7 @@
946
946
  "The story starts on day {day}": "La historia comienza el día {day}",
947
947
  "The story starts on day {day}, {time}": "La historia comienza el día {day}, {time}",
948
948
  "The story starts with the first scene.": "La historia empieza con la primera escena.",
949
+ "The text above lies behind the master's screen, forbidden to the players' eyes.": "El texto de arriba está detrás de la pantalla del máster, vetado a la vista de los jugadores.",
949
950
  "The title of the note {title}": "El título de la nota {title}",
950
951
  "the top bar": "la barra superior",
951
952
  "the units of the story": "las unidades de medida de la historia",
@@ -946,6 +946,7 @@
946
946
  "The story starts on day {day}": "Tarina alkaa päivänä {day}",
947
947
  "The story starts on day {day}, {time}": "Tarina alkaa päivänä {day}, {time}",
948
948
  "The story starts with the first scene.": "Tarina alkaa ensimmäisestä kohtauksesta.",
949
+ "The text above lies behind the master's screen, forbidden to the players' eyes.": "Yllä oleva teksti on pelinjohtajan suojan takana, pelaajien silmiltä kiellettynä.",
949
950
  "The title of the note {title}": "Muistiinpanon {title} otsikko",
950
951
  "the top bar": "yläpalkki",
951
952
  "the units of the story": "tarinan mittayksiköt",
@@ -946,6 +946,7 @@
946
946
  "The story starts on day {day}": "L'histoire commence au jour {day}",
947
947
  "The story starts on day {day}, {time}": "L'histoire commence au jour {day}, {time}",
948
948
  "The story starts with the first scene.": "L'histoire commence avec la première scène.",
949
+ "The text above lies behind the master's screen, forbidden to the players' eyes.": "Le texte ci-dessus se trouve derrière l'écran du MJ, interdit aux regards des joueurs.",
949
950
  "The title of the note {title}": "Le titre de la note {title}",
950
951
  "the top bar": "la barre du haut",
951
952
  "the units of the story": "les unités de l'histoire",
@@ -946,6 +946,7 @@
946
946
  "The story starts on day {day}": "הסיפור מתחיל ביום {day}",
947
947
  "The story starts on day {day}, {time}": "הסיפור מתחיל ביום {day}, {time}",
948
948
  "The story starts with the first scene.": "הסיפור מתחיל בסצנה הראשונה.",
949
+ "The text above lies behind the master's screen, forbidden to the players' eyes.": "הטקסט שלמעלה נמצא מאחורי מסך המנחה, אסור לעיני השחקנים.",
949
950
  "The title of the note {title}": "כותרת הפתק {title}",
950
951
  "the top bar": "הסרגל העליון",
951
952
  "the units of the story": "יחידות המידה של הסיפור",
@@ -946,6 +946,7 @@
946
946
  "The story starts on day {day}": "कहानी दिन {day} से शुरू होती है",
947
947
  "The story starts on day {day}, {time}": "कहानी दिन {day}, {time} से शुरू होती है",
948
948
  "The story starts with the first scene.": "कहानी पहले दृश्य से शुरू होती है।",
949
+ "The text above lies behind the master's screen, forbidden to the players' eyes.": "ऊपर का टेक्स्ट गेम मास्टर की स्क्रीन के पीछे है, खिलाड़ियों की नज़र से छिपा हुआ।",
949
950
  "The title of the note {title}": "नोट {title} का शीर्षक",
950
951
  "the top bar": "ऊपरी बार",
951
952
  "the units of the story": "कहानी की माप-इकाइयाँ",
@@ -946,6 +946,7 @@
946
946
  "The story starts on day {day}": "A történet a(z) {day}. napon kezdődik",
947
947
  "The story starts on day {day}, {time}": "A történet a(z) {day}. napon kezdődik, {time}",
948
948
  "The story starts with the first scene.": "A történet az első jelenettel indul.",
949
+ "The text above lies behind the master's screen, forbidden to the players' eyes.": "A fenti szöveg a mesélő paravánja mögött található, a játékosok elől elzárva.",
949
950
  "The title of the note {title}": "A(z) „{title}” jegyzet címe",
950
951
  "the top bar": "a felső sáv",
951
952
  "the units of the story": "a történet mértékegységei",
@@ -946,6 +946,7 @@
946
946
  "The story starts on day {day}": "Sagan hefst á degi {day}",
947
947
  "The story starts on day {day}, {time}": "Sagan hefst á degi {day}, {time}",
948
948
  "The story starts with the first scene.": "Sagan byrjar með fyrsta atriðinu.",
949
+ "The text above lies behind the master's screen, forbidden to the players' eyes.": "Textinn hér að ofan er á bak við skjá sögumannsins og bannaður augum leikmanna.",
949
950
  "The title of the note {title}": "Titill minnisblaðsins {title}",
950
951
  "the top bar": "efri stikan",
951
952
  "the units of the story": "mælieiningar sögunnar",
@@ -946,6 +946,7 @@
946
946
  "The story starts on day {day}": "La storia comincia il giorno {day}",
947
947
  "The story starts on day {day}, {time}": "La storia comincia il giorno {day}, {time}",
948
948
  "The story starts with the first scene.": "La storia comincia con la prima scena.",
949
+ "The text above lies behind the master's screen, forbidden to the players' eyes.": "Il testo qui sopra sta dietro lo schermo del master, proibito agli occhi dei giocatori.",
949
950
  "The title of the note {title}": "Il titolo della nota {title}",
950
951
  "the top bar": "la barra in alto",
951
952
  "the units of the story": "le unità di misura della storia",
@@ -946,6 +946,7 @@
946
946
  "The story starts on day {day}": "物語は{day}日目から始まります",
947
947
  "The story starts on day {day}, {time}": "物語は{day}日目の{time}から始まります",
948
948
  "The story starts with the first scene.": "ストーリーは最初のシーンから始まります。",
949
+ "The text above lies behind the master's screen, forbidden to the players' eyes.": "上の文章はGMスクリーンの裏側にあり、プレイヤーには見せられません。",
949
950
  "The title of the note {title}": "メモ「{title}」のタイトル",
950
951
  "the top bar": "上部バー",
951
952
  "the units of the story": "物語で使う単位",
@@ -946,6 +946,7 @@
946
946
  "The story starts on day {day}": "이야기는 {day}일에 시작돼요",
947
947
  "The story starts on day {day}, {time}": "이야기는 {day}일 {time}에 시작돼요",
948
948
  "The story starts with the first scene.": "이야기는 첫 장면과 함께 시작돼요.",
949
+ "The text above lies behind the master's screen, forbidden to the players' eyes.": "위 내용은 GM 스크린 뒤에 있는 내용이라 플레이어에게는 보이지 않아요.",
949
950
  "The title of the note {title}": "메모 {title}의 제목",
950
951
  "the top bar": "상단 바",
951
952
  "the units of the story": "이야기의 단위",
@@ -946,6 +946,7 @@
946
946
  "The story starts on day {day}": "Historien begynner på dag {day}",
947
947
  "The story starts on day {day}, {time}": "Historien begynner på dag {day}, {time}",
948
948
  "The story starts with the first scene.": "Historien begynner med den første scenen.",
949
+ "The text above lies behind the master's screen, forbidden to the players' eyes.": "Teksten ovenfor ligger bak spillederens skjerm, skjult for spillernes øyne.",
949
950
  "The title of the note {title}": "Tittelen på notatet {title}",
950
951
  "the top bar": "toppfeltet",
951
952
  "the units of the story": "enhetene i historien",
@@ -946,6 +946,7 @@
946
946
  "The story starts on day {day}": "Het verhaal begint op dag {day}",
947
947
  "The story starts on day {day}, {time}": "Het verhaal begint op dag {day}, {time}",
948
948
  "The story starts with the first scene.": "Het verhaal begint met de eerste scène.",
949
+ "The text above lies behind the master's screen, forbidden to the players' eyes.": "De tekst hierboven ligt achter het scherm van de spelleider, verboden voor de ogen van de spelers.",
949
950
  "The title of the note {title}": "De titel van de notitie {title}",
950
951
  "the top bar": "de bovenbalk",
951
952
  "the units of the story": "de eenheden van het verhaal",
@@ -946,6 +946,7 @@
946
946
  "The story starts on day {day}": "Historia zaczyna się w dniu {day}",
947
947
  "The story starts on day {day}, {time}": "Historia zaczyna się w dniu {day}, {time}",
948
948
  "The story starts with the first scene.": "Historia zaczyna się od pierwszej sceny.",
949
+ "The text above lies behind the master's screen, forbidden to the players' eyes.": "Tekst powyżej znajduje się za ekranem Mistrza Gry i jest ukryty przed oczami graczy.",
949
950
  "The title of the note {title}": "Tytuł notatki {title}",
950
951
  "the top bar": "górny pasek",
951
952
  "the units of the story": "jednostki miar w fabule",
@@ -946,6 +946,7 @@
946
946
  "The story starts on day {day}": "A história começa no dia {day}",
947
947
  "The story starts on day {day}, {time}": "A história começa no dia {day}, {time}",
948
948
  "The story starts with the first scene.": "A história começa com a primeira cena.",
949
+ "The text above lies behind the master's screen, forbidden to the players' eyes.": "O texto acima está atrás da tela do mestre, proibido aos olhos de quem joga.",
949
950
  "The title of the note {title}": "O título da nota {title}",
950
951
  "the top bar": "a barra superior",
951
952
  "the units of the story": "as unidades de medida da história",
@@ -946,6 +946,7 @@
946
946
  "The story starts on day {day}": "Povestea începe în ziua {day}",
947
947
  "The story starts on day {day}, {time}": "Povestea începe în ziua {day}, {time}",
948
948
  "The story starts with the first scene.": "Povestea începe cu prima scenă.",
949
+ "The text above lies behind the master's screen, forbidden to the players' eyes.": "Textul de mai sus se află în spatele paravanului maestrului de joc, ascuns privirilor jucătorilor.",
949
950
  "The title of the note {title}": "Titlul notiței {title}",
950
951
  "the top bar": "bara de sus",
951
952
  "the units of the story": "unitățile de măsură ale poveștii",
@@ -946,6 +946,7 @@
946
946
  "The story starts on day {day}": "История начинается в день {day}",
947
947
  "The story starts on day {day}, {time}": "История начинается в день {day}, {time}",
948
948
  "The story starts with the first scene.": "История начнётся с первой сцены.",
949
+ "The text above lies behind the master's screen, forbidden to the players' eyes.": "Текст выше скрыт за ширмой мастера — игрокам смотреть запрещено.",
949
950
  "The title of the note {title}": "Название заметки {title}",
950
951
  "the top bar": "верхняя панель",
951
952
  "the units of the story": "единицы измерения в истории",
@@ -946,6 +946,7 @@
946
946
  "The story starts on day {day}": "Berättelsen börjar dag {day}",
947
947
  "The story starts on day {day}, {time}": "Berättelsen börjar dag {day}, {time}",
948
948
  "The story starts with the first scene.": "Berättelsen börjar med den första scenen.",
949
+ "The text above lies behind the master's screen, forbidden to the players' eyes.": "Texten ovan ligger bakom spelledarens skärm, förbjuden för spelarnas ögon.",
949
950
  "The title of the note {title}": "Titeln på anteckningen {title}",
950
951
  "the top bar": "översta fältet",
951
952
  "the units of the story": "berättelsens måttenheter",
@@ -946,6 +946,7 @@
946
946
  "The story starts on day {day}": "Hikâye {day}. günde başlıyor",
947
947
  "The story starts on day {day}, {time}": "Hikâye {day}. gün, {time} saatinde başlıyor",
948
948
  "The story starts with the first scene.": "Hikâye ilk sahneyle başlar.",
949
+ "The text above lies behind the master's screen, forbidden to the players' eyes.": "Yukarıdaki metin oyun yöneticisinin ekranının arkasında duruyor; oyuncuların görmesi yasak.",
949
950
  "The title of the note {title}": "{title} notunun başlığı",
950
951
  "the top bar": "üst çubuk",
951
952
  "the units of the story": "hikâyenin ölçü birimleri",
@@ -946,6 +946,7 @@
946
946
  "The story starts on day {day}": "Історія починається в день {day}",
947
947
  "The story starts on day {day}, {time}": "Історія починається в день {day}, {time}",
948
948
  "The story starts with the first scene.": "Історія починається з першої сцени.",
949
+ "The text above lies behind the master's screen, forbidden to the players' eyes.": "Текст вище лежить за ширмою майстра, заборонений для очей гравців.",
949
950
  "The title of the note {title}": "Заголовок нотатки {title}",
950
951
  "the top bar": "верхня панель",
951
952
  "the units of the story": "одиниці виміру в історії",
@@ -946,6 +946,7 @@
946
946
  "The story starts on day {day}": "故事始于第{day}天",
947
947
  "The story starts on day {day}, {time}": "故事始于第{day}天{time}",
948
948
  "The story starts with the first scene.": "故事从第一个场景开始。",
949
+ "The text above lies behind the master's screen, forbidden to the players' eyes.": "以上文字位于主持人的屏风之后,玩家不得窥视。",
949
950
  "The title of the note {title}": "笔记“{title}”的标题",
950
951
  "the top bar": "顶栏",
951
952
  "the units of the story": "故事使用的单位",
@@ -1,6 +1,6 @@
1
1
  export { type CoinSide, coinSides, type CoinToss, mostCoins, tossCoins } from "./coins.ts";
2
2
  export { DiceError, diceProblem, parseNotation } from "./notation.ts";
3
- export { askOracle, type OracleAnswer, oracleResult } from "./oracle.ts";
3
+ export { askOracle, type OracleAnswer, oracleResult, type OracleYes } from "./oracle.ts";
4
4
  export { createProof, fingerprint, sha256 } from "./proof.ts";
5
5
  export { type DiceRoll, type FaceSource, rollDice, type ThrownDie } from "./roll-dice.ts";
6
6
  export { type RandomTable, readRandomTable, rollOnTable, type TableRoll, type TableRow } from "./tables.ts";
@@ -10,10 +10,12 @@ export interface OracleAnswer {
10
10
  extreme: boolean;
11
11
  text: string;
12
12
  }
13
+ /** Where a d100 says yes: low, up to the odds; high, above 100 less the odds, as Ironsworn's oracle. */
14
+ export type OracleYes = "low" | "high";
13
15
  /** Asks the oracle with the odds named, in any case, with hyphens for spaces too; refused, with the five odds, for any other. */
14
- export declare function askOracle(odds: string, source: FaceSource): OracleAnswer;
15
- /** Yes when the d100 is no higher than the chance; extreme on a double, 11 to 99 and 100 as 00. */
16
- export declare function oracleResult(chance: number, rolled: number): {
16
+ export declare function askOracle(odds: string, source: FaceSource, yesOn?: OracleYes): OracleAnswer;
17
+ /** Yes when the d100 is no higher than the chance, or above 100 less the chance when yes is high; extreme on a double, 11 to 99 and 100 as 00. */
18
+ export declare function oracleResult(chance: number, rolled: number, yesOn?: OracleYes): {
17
19
  yes: boolean;
18
20
  extreme: boolean;
19
21
  };
@@ -1,22 +1,23 @@
1
- // A yes/no oracle: a d100 against the odds, yes when it is no higher; a double (11, 22, … 00) makes the answer extreme.
1
+ // A yes/no oracle: a d100 against the odds, yes when it is no higher, or, in a game that reads it so, when it is above 100 less the odds; a double (11, 22, … 00)
2
+ // makes the answer extreme.
2
3
  import { DiceError } from "./notation.js";
3
4
  import { rollDice } from "./roll-dice.js";
4
5
  /** The odds an oracle is asked with, and the chance of a yes in a hundred. */
5
6
  export const oracleOdds = { "almost certain": 90, likely: 75, "50/50": 50, unlikely: 25, "small chance": 10 };
6
7
  /** Asks the oracle with the odds named, in any case, with hyphens for spaces too; refused, with the five odds, for any other. */
7
- export function askOracle(odds, source) {
8
+ export function askOracle(odds, source, yesOn = "low") {
8
9
  const name = odds.trim().toLowerCase().replace(/[-\s]+/g, " ");
9
10
  const chance = Object.hasOwn(oracleOdds, name) ? oracleOdds[name] : undefined;
10
11
  if (chance === undefined) {
11
12
  throw new DiceError(`"${odds}" are no odds of the oracle: give one of ${Object.keys(oracleOdds).join(", ")}.`);
12
13
  }
13
14
  const roll = rollDice("d100", source);
14
- const { yes, extreme } = oracleResult(chance, roll.total);
15
+ const { yes, extreme } = oracleResult(chance, roll.total, yesOn);
15
16
  const answer = yes ? (extreme ? "Yes, and more: something beyond what was asked." : "Yes.") : extreme ? "No, and worse." : "No.";
16
17
  const shown = `${name[0].toUpperCase()}${name.slice(1)} (${chance}%)`;
17
18
  return { odds: name, chance, roll, yes, extreme, text: `${shown}: [d100 = ${roll.total}] ${answer}` };
18
19
  }
19
- /** Yes when the d100 is no higher than the chance; extreme on a double, 11 to 99 and 100 as 00. */
20
- export function oracleResult(chance, rolled) {
21
- return { yes: rolled <= chance, extreme: rolled === 100 || (rolled % 11 === 0 && rolled < 100) };
20
+ /** Yes when the d100 is no higher than the chance, or above 100 less the chance when yes is high; extreme on a double, 11 to 99 and 100 as 00. */
21
+ export function oracleResult(chance, rolled, yesOn = "low") {
22
+ return { yes: yesOn === "high" ? rolled > 100 - chance : rolled <= chance, extreme: rolled === 100 || (rolled % 11 === 0 && rolled < 100) };
22
23
  }
@@ -130,7 +130,7 @@ function write(brief) {
130
130
  function read(folder, brief, _writable, signal) {
131
131
  const last = join(folder, ".last.txt");
132
132
  // The folder is the working one, never in the line: the shell would read a title's $(…) or %…% (Matteo's review, D-489).
133
- const line = `${codex} exec --ephemeral --skip-git-repo-check -s workspace-write -o .last.txt --ignore-user-config --ignore-rules -`;
133
+ const line = `${codex} exec --ephemeral --skip-git-repo-check -s workspace-write -c shell_environment_policy.inherit=core -o .last.txt --ignore-user-config --ignore-rules -`;
134
134
  return new Promise((done) => {
135
135
  const child = spawn(line, { shell: true, windowsHide: true, cwd: folder, env: helperEnvironment("codex"), stdio: ["pipe", "ignore", "pipe"] });
136
136
  // Dropped while it runs: the helper stops with all it started.
@@ -1,5 +1,5 @@
1
1
  import { spawn, spawnSync } from "node:child_process";
2
- import { cpSync, existsSync, mkdirSync, readdirSync, readFileSync, renameSync, rmSync } from "node:fs";
2
+ import { cpSync, existsSync, lstatSync, mkdirSync, readdirSync, readFileSync, renameSync, rmSync } from "node:fs";
3
3
  import { tmpdir } from "node:os";
4
4
  import { isAbsolute, join, resolve } from "node:path";
5
5
  import { ourScope } from "../core/consents.js";
@@ -298,7 +298,8 @@ async function installCopy(folder, spec, expected, run) {
298
298
  }
299
299
  else {
300
300
  // What npm or git keep beside a package's own files is no part of it.
301
- cpSync(resolve(spec), staged, { recursive: true, filter: (path) => !/[\\/](node_modules|\.git)([\\/]|$)/.test(path.slice(resolve(spec).length)) });
301
+ // A link would bring in what it points to, which is not what was asked about.
302
+ cpSync(resolve(spec), staged, { recursive: true, filter: (path) => !/[\\/](node_modules|\.git)([\\/]|$)/.test(path.slice(resolve(spec).length)) && plainEntry(path, spec) });
302
303
  }
303
304
  }
304
305
  catch (error) {
@@ -418,3 +419,13 @@ function stopTree(pid) {
418
419
  process.kill(pid, "SIGKILL");
419
420
  }
420
421
  }
422
+ /** True for a plain file or folder of the package folder `spec`; it throws for a link, which refuses the package whole, as a link in a .tgz does. */
423
+ function plainEntry(path, spec) {
424
+ if (lstatSync(path).isSymbolicLink() && resolve(path) === resolve(spec)) {
425
+ throw new Refusal(`${spec} is a link to another folder: give the folder it points to.`, "archive-link", { name: spec, entry: path });
426
+ }
427
+ if (lstatSync(path).isSymbolicLink()) {
428
+ throw new Refusal(`${spec} holds ${path}, which is a link to somewhere else: the package is refused whole. Replace the link with what it points to.`, "archive-link", { name: spec, entry: path });
429
+ }
430
+ return true;
431
+ }
@@ -4,7 +4,7 @@ export { changedEnvironment, environmentAt, type EnvironmentEntry, formatEnviron
4
4
  export { baseChain, baseFieldOf, baseValue, derivedPages, followersOf, holdsField, type Inherited, inheritedByBase, inheritedFields, introductionFollowersOf, isNeverInherited, keepersOf, newBaseProblem, ownField, ownFieldChange, removedFieldName, sameAsBase, sectionFollowersOf, shownPart, uniquePage, writtenFieldName, } from "./inheritance.ts";
5
5
  export { carriedWeight, type LoadRule, weightUnit } from "./load.ts";
6
6
  export { type MapField, mapKey, mapOf, mapProblems, type PlaceMap, readMapField, sameFrame } from "./maps.ts";
7
- export { everyGoalTicked, firstTable, goalsIn, introductionText, type Link, links, partContent, readSection, secretNames, sectionTitles, type TextMode, textParts, withLinksAsWords, withoutComments, withoutFencedBlocks, } from "./markdown.ts";
7
+ export { everyGoalTicked, firstTable, goalsIn, introductionText, type Link, links, partContent, readSection, secretNames, sectionTitles, type TextMode, textParts, withLinksAsWords, withoutComments, withoutFencedBlocks, withoutUnreadSecrets, } from "./markdown.ts";
8
8
  export { changedFields, type FieldChange, formatFields, linkListItems, readFields, readFieldValue, splitPageFile } from "./page-file.ts";
9
9
  export { type PageType, pageTypeNames, worldFolderName } from "./page-types.ts";
10
10
  export { formatPosition, type Position, readPosition } from "./positions.ts";
@@ -5,7 +5,7 @@ export { changedEnvironment, environmentAt, formatEnvironmentEntry, placesAround
5
5
  export { baseChain, baseFieldOf, baseValue, derivedPages, followersOf, holdsField, inheritedByBase, inheritedFields, introductionFollowersOf, isNeverInherited, keepersOf, newBaseProblem, ownField, ownFieldChange, removedFieldName, sameAsBase, sectionFollowersOf, shownPart, uniquePage, writtenFieldName, } from "./inheritance.js";
6
6
  export { carriedWeight, weightUnit } from "./load.js";
7
7
  export { mapKey, mapOf, mapProblems, readMapField, sameFrame } from "./maps.js";
8
- export { everyGoalTicked, firstTable, goalsIn, introductionText, links, partContent, readSection, secretNames, sectionTitles, textParts, withLinksAsWords, withoutComments, withoutFencedBlocks, } from "./markdown.js";
8
+ export { everyGoalTicked, firstTable, goalsIn, introductionText, links, partContent, readSection, secretNames, sectionTitles, textParts, withLinksAsWords, withoutComments, withoutFencedBlocks, withoutUnreadSecrets, } from "./markdown.js";
9
9
  export { changedFields, formatFields, linkListItems, readFields, readFieldValue, splitPageFile } from "./page-file.js";
10
10
  export { pageTypeNames, worldFolderName } from "./page-types.js";
11
11
  export { formatPosition, readPosition } from "./positions.js";
@@ -47,6 +47,8 @@ export declare function trimBlankLines(text: string): string;
47
47
  export declare function withoutComments(text: string): string;
48
48
  /** The lines, counted from 1, that mark a secret the engine does not read as one, as a callout four spaces in: written for a secret, read as public text. */
49
49
  export declare function unreadSecretLines(text: string): number[];
50
+ /** A text without the secrets the engine does not read as ones (unreadSecretLines), each with the rest of its quoted block: in doubt, hidden from the player. */
51
+ export declare function withoutUnreadSecrets(text: string): string;
50
52
  /** The goals a text lists as checkboxes, outside code blocks, each with whether it is ticked; and the text without them, for a quest's card (VIEW-8). */
51
53
  export declare function goalsIn(text: string): {
52
54
  goals: {
@@ -144,6 +144,27 @@ export function unreadSecretLines(text) {
144
144
  const views = lineViews(lines);
145
145
  return lines.flatMap((line, index) => (isProse(views[index]) && /\[!secret\]/i.test(line) && !secretPattern.test(line) ? [index + 1] : []));
146
146
  }
147
+ /** A text without the secrets the engine does not read as ones (unreadSecretLines), each with the rest of its quoted block: in doubt, hidden from the player. */
148
+ export function withoutUnreadSecrets(text) {
149
+ const unread = new Set(unreadSecretLines(text));
150
+ if (unread.size === 0) {
151
+ return text;
152
+ }
153
+ // The secret's block goes on while its lines are quoted as deep as its first, as > > for one inside a callout; one in a line of prose is that line alone.
154
+ let level = 0;
155
+ return text.split("\n").filter((line, index) => {
156
+ const quotes = (/^\s*((?:>\s*)*)/.exec(line)?.[1].match(/>/g) ?? []).length;
157
+ if (unread.has(index + 1)) {
158
+ level = quotes;
159
+ return false;
160
+ }
161
+ if (level > 0 && quotes >= level) {
162
+ return false;
163
+ }
164
+ level = 0;
165
+ return true;
166
+ }).join("\n");
167
+ }
147
168
  /** The goals a text lists as checkboxes, outside code blocks, each with whether it is ticked; and the text without them, for a quest's card (VIEW-8). */
148
169
  export function goalsIn(text) {
149
170
  const lines = text.replace(/\r\n/g, "\n").split("\n");
@@ -1,4 +1,5 @@
1
1
  import { basename, join, relative, resolve, sep } from "node:path";
2
+ import { isReservedName } from "../core/archive-paths.js";
2
3
  import { translationFolder } from "../core/files.js";
3
4
  import { frozen } from "../core/frozen.js";
4
5
  import { files } from "../core/store.js";
@@ -303,6 +304,9 @@ export function checkPageName(name) {
303
304
  if (name === "" || name.length > longestName || name.trim() !== name || name.endsWith(".") || forbiddenCharacters.test(name)) {
304
305
  throw new Error(`"${name}" cannot be a page name. Names become file names and links: at most ${longestName} characters, without \\ / : * ? " < > | # ^ [ ], line breaks, spaces at the ends or a final dot.`);
305
306
  }
307
+ if (isReservedName(name)) {
308
+ throw new Error(`"${name}" cannot be a page name: Windows keeps it for a device, as CON, NUL or COM1. Give it another name, as "${name} (place)".`);
309
+ }
306
310
  // A name that ends as a file does, as Bruna.md or Mappa.png, makes a page no link reaches (LNK-1).
307
311
  if (links(`[[${name}]]`)[0]?.page !== name) {
308
312
  const ending = /\.[a-z0-9]+$/i.test(name);
@@ -168,14 +168,18 @@ async function answer(request, response, served) {
168
168
  // Only the dashboard's own page, at its own address: no other site may read what the player sees, nor a name that leads elsewhere (D-272).
169
169
  const own = [`http://localhost:${served.port}`, `http://127.0.0.1:${served.port}`];
170
170
  const origin = request.headers.origin;
171
+ // An address that does not read, as //, is no page of the dashboard's.
172
+ const url = URL.parse(request.url ?? "/", own[0]) ?? new URL("/404", own[0]);
173
+ const path = url.pathname;
171
174
  // A request another site makes the browser send, as an image's, which carries no origin, says so in Sec-Fetch-Site: never ours, nor the hook's, which sends none.
172
- const crossSite = request.headers["sec-fetch-site"] === "cross-site";
173
- if (!own.includes(`http://${request.headers.host ?? ""}`) || (origin !== undefined && !own.includes(origin)) || crossSite) {
175
+ // Another program's page on this computer, at another port, is the same site: it may only open the page itself, as a link does, never the API, the bell or a frame.
176
+ const site = request.headers["sec-fetch-site"];
177
+ const visit = request.headers["sec-fetch-mode"] === "navigate" && request.headers["sec-fetch-dest"] === "document" && path === "/";
178
+ const foreign = site === "cross-site" || (site === "same-site" && !visit);
179
+ if (!own.includes(`http://${request.headers.host ?? ""}`) || (origin !== undefined && !own.includes(origin)) || foreign) {
174
180
  send(response, 403, "text/plain; charset=utf-8", `The dashboard answers only its own page, at http://localhost:${served.port}.`);
175
181
  return;
176
182
  }
177
- const url = new URL(request.url ?? "/", own[0]);
178
- const path = url.pathname;
179
183
  // The page answers the master's question with a click, and changes the player's settings: what it sends, and only from itself (D-279, D-341).
180
184
  if (request.method === "POST" && path === "/api/run" && origin !== undefined) {
181
185
  await runForPlayer(request, response, served);
@@ -1,8 +1,10 @@
1
1
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
2
  import { type Context } from "../core/context.ts";
3
3
  import { SessionStore } from "../core/session-store.ts";
4
+ /** The line that closes every answer of a tool, a phrase of the page's, so that its languages have it. */
5
+ export declare const masterScreenLine = "The text above lies behind the master's screen, forbidden to the players' eyes.";
4
6
  /**
5
- * The MCP server: every command becomes a tool with the same name, description and parameters, and answers with the same text as the command line. Its instructions send
7
+ * The MCP server: every command becomes a tool with the same name, description and parameters, and answers with the same text as the command line, closed by a line for the player's eyes (T-176). Its instructions send
6
8
  * the host to instructions, then status. The commands that ask the player appear for a host that shows forms, through which they ask (D-148), and wherever the
7
9
  * dashboard runs, whose page asks first (D-279).
8
10
  */
@@ -2,13 +2,14 @@ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
2
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
3
3
  import { spawn } from "node:child_process";
4
4
  import { z } from "zod";
5
- import { findCampaign, hasCharacterAgent, refreshHostFiles } from "../campaign/index.js";
5
+ import { findCampaign, hasCharacterAgent, readTextSetting, refreshHostFiles } from "../campaign/index.js";
6
6
  import { commands } from "../commands/index.js";
7
7
  import { installCampaignSystem } from "../commands/package.js";
8
8
  import { campaignExamples } from "../commands/shared/examples.js";
9
9
  import { libraryRunner } from "../commands/shared/library-reader.js";
10
10
  import { outsideNews, whileClosedNews } from "../commands/shared/outside.js";
11
11
  import { packageCommands } from "../commands/shared/packages/code.js";
12
+ import { pagePhrase } from "../commands/shared/page-words.js";
12
13
  import { newChatText, wentBackTo } from "../commands/shared/saves.js";
13
14
  import { campaignWorld } from "../commands/shared/world.js";
14
15
  import { systemConfirm } from "../confirm/index.js";
@@ -34,8 +35,10 @@ const tooFastForPerson = 1500;
34
35
  const entryPointsWithoutForms = ["claude-desktop"];
35
36
  // Hosts ask for the tools tens of milliseconds after initialized: the world, which takes a second or more to read in a large campaign, is read after that.
36
37
  const preloadAfter = 250;
38
+ /** The line that closes every answer of a tool, a phrase of the page's, so that its languages have it. */
39
+ export const masterScreenLine = "The text above lies behind the master's screen, forbidden to the players' eyes.";
37
40
  /**
38
- * The MCP server: every command becomes a tool with the same name, description and parameters, and answers with the same text as the command line. Its instructions send
41
+ * The MCP server: every command becomes a tool with the same name, description and parameters, and answers with the same text as the command line, closed by a line for the player's eyes (T-176). Its instructions send
39
42
  * the host to instructions, then status. The commands that ask the player appear for a host that shows forms, through which they ask (D-148), and wherever the
40
43
  * dashboard runs, whose page asks first (D-279).
41
44
  */
@@ -334,7 +337,7 @@ async function runTool(command, input, context, extra, prepare, installer, outsi
334
337
  const back = chatAfterLoad(context, command.name, input);
335
338
  if (back.refused !== undefined) {
336
339
  news = context.news?.(told);
337
- return { content: [{ type: "text", text: [...installed, ...(news?.lines ?? []), back.refused].join("\n\n") }], isError: true };
340
+ return { content: [{ type: "text", text: [...installed, ...(news?.lines ?? []), back.refused].join("\n\n") }, masterOnly(context)], isError: true };
338
341
  }
339
342
  const checked = checkedInput(command, input, examples.shown);
340
343
  // Stopped while the call was made ready, as while the system installed: the command never runs, so that calling it again does it once.
@@ -347,11 +350,11 @@ async function runTool(command, input, context, extra, prepare, installer, outsi
347
350
  const text = command.format(await command.run(checked, { ...context, told, signal: extra.signal }));
348
351
  // What the player changed on the dashboard comes first, once, what they changed while the call waited included (D-341).
349
352
  news = context.news?.(told);
350
- return { content: [{ type: "text", text: [...installed, ...(news?.lines ?? []), ...changedOutside, ...back.begun, text].join("\n\n") }] };
353
+ return { content: [{ type: "text", text: [...installed, ...(news?.lines ?? []), ...changedOutside, ...back.begun, text].join("\n\n") }, masterOnly(context)] };
351
354
  }
352
355
  catch (error) {
353
356
  news ??= context.news?.(told);
354
- return { content: [{ type: "text", text: [...installed, ...(news?.lines ?? []), ...changedOutside, error instanceof Error ? error.message : String(error)].join("\n\n") }], isError: true };
357
+ return { content: [{ type: "text", text: [...installed, ...(news?.lines ?? []), ...changedOutside, error instanceof Error ? error.message : String(error)].join("\n\n") }, masterOnly(context)], isError: true };
355
358
  }
356
359
  finally {
357
360
  clearInterval(keepAlive);
@@ -516,3 +519,15 @@ function keepTold(chat, before, after) {
516
519
  after.forEach((name) => (before.has(name) ? undefined : chat?.add(name)));
517
520
  before.forEach((name) => (after.has(name) ? undefined : chat?.delete(name)));
518
521
  }
522
+ /**
523
+ * The block that closes every answer (T-176): Codex shows the player the last three lines of a tool's answer, blank ones too, and these tell nothing of the
524
+ * game; in the campaign's language, English before it has one.
525
+ */
526
+ function masterOnly(context) {
527
+ const read = () => {
528
+ const root = findCampaign(context.folder);
529
+ return root === undefined ? undefined : readTextSetting(root, "language");
530
+ };
531
+ const language = context.files === undefined ? read() : withFiles(context.files, read);
532
+ return { type: "text", text: `\n\n${pagePhrase(context, language, masterScreenLine)}` };
533
+ }