@maka/maka-cli 5.3.16 → 5.4.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 (220) hide show
  1. package/bundle/typescript/package.json +1 -1
  2. package/bundle/typescript/src/commands/create.js +1 -1
  3. package/bundle/typescript/src/commands/create.js.map +1 -1
  4. package/bundle/typescript/src/commands/game/sideQuest/archetypes.d.ts +43 -0
  5. package/bundle/typescript/src/commands/game/sideQuest/archetypes.js +131 -0
  6. package/bundle/typescript/src/commands/game/sideQuest/archetypes.js.map +1 -0
  7. package/bundle/typescript/src/commands/game/sideQuest/commands/assense.d.ts +14 -0
  8. package/bundle/typescript/src/commands/game/sideQuest/commands/assense.js +79 -0
  9. package/bundle/typescript/src/commands/game/sideQuest/commands/assense.js.map +1 -0
  10. package/bundle/typescript/src/commands/game/sideQuest/commands/attack.d.ts +42 -0
  11. package/bundle/typescript/src/commands/game/sideQuest/commands/attack.js +224 -0
  12. package/bundle/typescript/src/commands/game/sideQuest/commands/attack.js.map +1 -0
  13. package/bundle/typescript/src/commands/game/sideQuest/commands/bypass-command.d.ts +28 -0
  14. package/bundle/typescript/src/commands/game/sideQuest/commands/bypass-command.js +101 -0
  15. package/bundle/typescript/src/commands/game/sideQuest/commands/bypass-command.js.map +1 -0
  16. package/bundle/typescript/src/commands/game/sideQuest/commands/call.d.ts +19 -0
  17. package/bundle/typescript/src/commands/game/sideQuest/commands/call.js +149 -0
  18. package/bundle/typescript/src/commands/game/sideQuest/commands/call.js.map +1 -0
  19. package/bundle/typescript/src/commands/game/sideQuest/commands/cast.d.ts +58 -0
  20. package/bundle/typescript/src/commands/game/sideQuest/commands/cast.js +378 -0
  21. package/bundle/typescript/src/commands/game/sideQuest/commands/cast.js.map +1 -0
  22. package/bundle/typescript/src/commands/game/sideQuest/commands/command-registry.d.ts +11 -1
  23. package/bundle/typescript/src/commands/game/sideQuest/commands/command-registry.js +8 -3
  24. package/bundle/typescript/src/commands/game/sideQuest/commands/command-registry.js.map +1 -1
  25. package/bundle/typescript/src/commands/game/sideQuest/commands/command.d.ts +6 -0
  26. package/bundle/typescript/src/commands/game/sideQuest/commands/command.js +4 -0
  27. package/bundle/typescript/src/commands/game/sideQuest/commands/command.js.map +1 -1
  28. package/bundle/typescript/src/commands/game/sideQuest/commands/drone.d.ts +15 -0
  29. package/bundle/typescript/src/commands/game/sideQuest/commands/drone.js +60 -0
  30. package/bundle/typescript/src/commands/game/sideQuest/commands/drone.js.map +1 -0
  31. package/bundle/typescript/src/commands/game/sideQuest/commands/edge.d.ts +13 -0
  32. package/bundle/typescript/src/commands/game/sideQuest/commands/edge.js +31 -0
  33. package/bundle/typescript/src/commands/game/sideQuest/commands/edge.js.map +1 -0
  34. package/bundle/typescript/src/commands/game/sideQuest/commands/end-call.d.ts +6 -0
  35. package/bundle/typescript/src/commands/game/sideQuest/commands/end-call.js +27 -0
  36. package/bundle/typescript/src/commands/game/sideQuest/commands/end-call.js.map +1 -0
  37. package/bundle/typescript/src/commands/game/sideQuest/commands/equip.d.ts +4 -0
  38. package/bundle/typescript/src/commands/game/sideQuest/commands/equip.js +40 -0
  39. package/bundle/typescript/src/commands/game/sideQuest/commands/equip.js.map +1 -1
  40. package/bundle/typescript/src/commands/game/sideQuest/commands/equipment.d.ts +13 -0
  41. package/bundle/typescript/src/commands/game/sideQuest/commands/equipment.js +43 -0
  42. package/bundle/typescript/src/commands/game/sideQuest/commands/equipment.js.map +1 -0
  43. package/bundle/typescript/src/commands/game/sideQuest/commands/give.js +7 -1
  44. package/bundle/typescript/src/commands/game/sideQuest/commands/give.js.map +1 -1
  45. package/bundle/typescript/src/commands/game/sideQuest/commands/go.d.ts +11 -0
  46. package/bundle/typescript/src/commands/game/sideQuest/commands/go.js +115 -4
  47. package/bundle/typescript/src/commands/game/sideQuest/commands/go.js.map +1 -1
  48. package/bundle/typescript/src/commands/game/sideQuest/commands/hack.d.ts +25 -0
  49. package/bundle/typescript/src/commands/game/sideQuest/commands/hack.js +176 -0
  50. package/bundle/typescript/src/commands/game/sideQuest/commands/hack.js.map +1 -0
  51. package/bundle/typescript/src/commands/game/sideQuest/commands/inv.d.ts +12 -0
  52. package/bundle/typescript/src/commands/game/sideQuest/commands/inv.js +39 -0
  53. package/bundle/typescript/src/commands/game/sideQuest/commands/inv.js.map +1 -0
  54. package/bundle/typescript/src/commands/game/sideQuest/commands/jack.d.ts +17 -0
  55. package/bundle/typescript/src/commands/game/sideQuest/commands/jack.js +64 -0
  56. package/bundle/typescript/src/commands/game/sideQuest/commands/jack.js.map +1 -0
  57. package/bundle/typescript/src/commands/game/sideQuest/commands/kill.d.ts +10 -3
  58. package/bundle/typescript/src/commands/game/sideQuest/commands/kill.js +11 -33
  59. package/bundle/typescript/src/commands/game/sideQuest/commands/kill.js.map +1 -1
  60. package/bundle/typescript/src/commands/game/sideQuest/commands/look.js +35 -4
  61. package/bundle/typescript/src/commands/game/sideQuest/commands/look.js.map +1 -1
  62. package/bundle/typescript/src/commands/game/sideQuest/commands/map.d.ts +12 -0
  63. package/bundle/typescript/src/commands/game/sideQuest/commands/map.js +46 -0
  64. package/bundle/typescript/src/commands/game/sideQuest/commands/map.js.map +1 -0
  65. package/bundle/typescript/src/commands/game/sideQuest/commands/pan.d.ts +12 -0
  66. package/bundle/typescript/src/commands/game/sideQuest/commands/pan.js +55 -0
  67. package/bundle/typescript/src/commands/game/sideQuest/commands/pan.js.map +1 -0
  68. package/bundle/typescript/src/commands/game/sideQuest/commands/pick.d.ts +9 -0
  69. package/bundle/typescript/src/commands/game/sideQuest/commands/pick.js +18 -0
  70. package/bundle/typescript/src/commands/game/sideQuest/commands/pick.js.map +1 -0
  71. package/bundle/typescript/src/commands/game/sideQuest/commands/project.d.ts +19 -0
  72. package/bundle/typescript/src/commands/game/sideQuest/commands/project.js +54 -0
  73. package/bundle/typescript/src/commands/game/sideQuest/commands/project.js.map +1 -0
  74. package/bundle/typescript/src/commands/game/sideQuest/commands/read.js +6 -5
  75. package/bundle/typescript/src/commands/game/sideQuest/commands/read.js.map +1 -1
  76. package/bundle/typescript/src/commands/game/sideQuest/commands/reboot.d.ts +12 -0
  77. package/bundle/typescript/src/commands/game/sideQuest/commands/reboot.js +52 -0
  78. package/bundle/typescript/src/commands/game/sideQuest/commands/reboot.js.map +1 -0
  79. package/bundle/typescript/src/commands/game/sideQuest/commands/reload.d.ts +14 -0
  80. package/bundle/typescript/src/commands/game/sideQuest/commands/reload.js +40 -0
  81. package/bundle/typescript/src/commands/game/sideQuest/commands/reload.js.map +1 -0
  82. package/bundle/typescript/src/commands/game/sideQuest/commands/rest.d.ts +15 -0
  83. package/bundle/typescript/src/commands/game/sideQuest/commands/rest.js +59 -0
  84. package/bundle/typescript/src/commands/game/sideQuest/commands/rest.js.map +1 -0
  85. package/bundle/typescript/src/commands/game/sideQuest/commands/say.js +23 -2
  86. package/bundle/typescript/src/commands/game/sideQuest/commands/say.js.map +1 -1
  87. package/bundle/typescript/src/commands/game/sideQuest/commands/search.js +20 -3
  88. package/bundle/typescript/src/commands/game/sideQuest/commands/search.js.map +1 -1
  89. package/bundle/typescript/src/commands/game/sideQuest/commands/sheet.d.ts +12 -0
  90. package/bundle/typescript/src/commands/game/sideQuest/commands/sheet.js +49 -0
  91. package/bundle/typescript/src/commands/game/sideQuest/commands/sheet.js.map +1 -0
  92. package/bundle/typescript/src/commands/game/sideQuest/commands/silent.d.ts +13 -0
  93. package/bundle/typescript/src/commands/game/sideQuest/commands/silent.js +50 -0
  94. package/bundle/typescript/src/commands/game/sideQuest/commands/silent.js.map +1 -0
  95. package/bundle/typescript/src/commands/game/sideQuest/commands/solve.js +32 -11
  96. package/bundle/typescript/src/commands/game/sideQuest/commands/solve.js.map +1 -1
  97. package/bundle/typescript/src/commands/game/sideQuest/commands/spells.d.ts +14 -0
  98. package/bundle/typescript/src/commands/game/sideQuest/commands/spells.js +65 -0
  99. package/bundle/typescript/src/commands/game/sideQuest/commands/spells.js.map +1 -0
  100. package/bundle/typescript/src/commands/game/sideQuest/commands/stance.d.ts +12 -0
  101. package/bundle/typescript/src/commands/game/sideQuest/commands/stance.js +41 -0
  102. package/bundle/typescript/src/commands/game/sideQuest/commands/stance.js.map +1 -0
  103. package/bundle/typescript/src/commands/game/sideQuest/commands/subdue.d.ts +21 -0
  104. package/bundle/typescript/src/commands/game/sideQuest/commands/subdue.js +43 -0
  105. package/bundle/typescript/src/commands/game/sideQuest/commands/subdue.js.map +1 -0
  106. package/bundle/typescript/src/commands/game/sideQuest/commands/surrender.d.ts +20 -0
  107. package/bundle/typescript/src/commands/game/sideQuest/commands/surrender.js +45 -0
  108. package/bundle/typescript/src/commands/game/sideQuest/commands/surrender.js.map +1 -0
  109. package/bundle/typescript/src/commands/game/sideQuest/commands/take.d.ts +8 -0
  110. package/bundle/typescript/src/commands/game/sideQuest/commands/take.js +80 -1
  111. package/bundle/typescript/src/commands/game/sideQuest/commands/take.js.map +1 -1
  112. package/bundle/typescript/src/commands/game/sideQuest/commands/unlock.js +1 -0
  113. package/bundle/typescript/src/commands/game/sideQuest/commands/unlock.js.map +1 -1
  114. package/bundle/typescript/src/commands/game/sideQuest/commands/use.d.ts +24 -0
  115. package/bundle/typescript/src/commands/game/sideQuest/commands/use.js +101 -1
  116. package/bundle/typescript/src/commands/game/sideQuest/commands/use.js.map +1 -1
  117. package/bundle/typescript/src/commands/game/sideQuest/factories/item-factory.js +2 -1
  118. package/bundle/typescript/src/commands/game/sideQuest/factories/item-factory.js.map +1 -1
  119. package/bundle/typescript/src/commands/game/sideQuest/factories/npc-factory.js +7 -2
  120. package/bundle/typescript/src/commands/game/sideQuest/factories/npc-factory.js.map +1 -1
  121. package/bundle/typescript/src/commands/game/sideQuest/factories/puzzle-factory.js +2 -1
  122. package/bundle/typescript/src/commands/game/sideQuest/factories/puzzle-factory.js.map +1 -1
  123. package/bundle/typescript/src/commands/game/sideQuest/factories/room-factory.js +2 -0
  124. package/bundle/typescript/src/commands/game/sideQuest/factories/room-factory.js.map +1 -1
  125. package/bundle/typescript/src/commands/game/sideQuest/factories/scene-factory.d.ts +8 -1
  126. package/bundle/typescript/src/commands/game/sideQuest/factories/scene-factory.js +138 -21
  127. package/bundle/typescript/src/commands/game/sideQuest/factories/scene-factory.js.map +1 -1
  128. package/bundle/typescript/src/commands/game/sideQuest/factories/scene-seed-generator.d.ts +119 -0
  129. package/bundle/typescript/src/commands/game/sideQuest/factories/scene-seed-generator.js +816 -0
  130. package/bundle/typescript/src/commands/game/sideQuest/factories/scene-seed-generator.js.map +1 -0
  131. package/bundle/typescript/src/commands/game/sideQuest/game.d.ts +70 -9
  132. package/bundle/typescript/src/commands/game/sideQuest/game.js +403 -164
  133. package/bundle/typescript/src/commands/game/sideQuest/game.js.map +1 -1
  134. package/bundle/typescript/src/commands/game/sideQuest/minigames/hack-minigame.d.ts +16 -0
  135. package/bundle/typescript/src/commands/game/sideQuest/minigames/hack-minigame.js +101 -0
  136. package/bundle/typescript/src/commands/game/sideQuest/minigames/hack-minigame.js.map +1 -0
  137. package/bundle/typescript/src/commands/game/sideQuest/minigames/lockpick-minigame.d.ts +15 -0
  138. package/bundle/typescript/src/commands/game/sideQuest/minigames/lockpick-minigame.js +95 -0
  139. package/bundle/typescript/src/commands/game/sideQuest/minigames/lockpick-minigame.js.map +1 -0
  140. package/bundle/typescript/src/commands/game/sideQuest/models/door.d.ts +10 -0
  141. package/bundle/typescript/src/commands/game/sideQuest/models/door.js +15 -2
  142. package/bundle/typescript/src/commands/game/sideQuest/models/door.js.map +1 -1
  143. package/bundle/typescript/src/commands/game/sideQuest/models/inventory.d.ts +10 -0
  144. package/bundle/typescript/src/commands/game/sideQuest/models/inventory.js +54 -4
  145. package/bundle/typescript/src/commands/game/sideQuest/models/inventory.js.map +1 -1
  146. package/bundle/typescript/src/commands/game/sideQuest/models/item.d.ts +41 -0
  147. package/bundle/typescript/src/commands/game/sideQuest/models/item.js +106 -3
  148. package/bundle/typescript/src/commands/game/sideQuest/models/item.js.map +1 -1
  149. package/bundle/typescript/src/commands/game/sideQuest/models/npc.d.ts +25 -0
  150. package/bundle/typescript/src/commands/game/sideQuest/models/npc.js +220 -47
  151. package/bundle/typescript/src/commands/game/sideQuest/models/npc.js.map +1 -1
  152. package/bundle/typescript/src/commands/game/sideQuest/models/player.d.ts +213 -0
  153. package/bundle/typescript/src/commands/game/sideQuest/models/player.js +525 -9
  154. package/bundle/typescript/src/commands/game/sideQuest/models/player.js.map +1 -1
  155. package/bundle/typescript/src/commands/game/sideQuest/models/puzzle.d.ts +75 -1
  156. package/bundle/typescript/src/commands/game/sideQuest/models/puzzle.js +174 -6
  157. package/bundle/typescript/src/commands/game/sideQuest/models/puzzle.js.map +1 -1
  158. package/bundle/typescript/src/commands/game/sideQuest/models/room.d.ts +20 -0
  159. package/bundle/typescript/src/commands/game/sideQuest/models/room.js +39 -18
  160. package/bundle/typescript/src/commands/game/sideQuest/models/room.js.map +1 -1
  161. package/bundle/typescript/src/commands/game/sideQuest/models/scene.d.ts +69 -0
  162. package/bundle/typescript/src/commands/game/sideQuest/models/scene.js +175 -2
  163. package/bundle/typescript/src/commands/game/sideQuest/models/scene.js.map +1 -1
  164. package/bundle/typescript/src/commands/game/sideQuest/scenes/scene1.json +80 -1
  165. package/bundle/typescript/src/commands/game/sideQuest/scenes/scene2.json +7 -2
  166. package/bundle/typescript/src/commands/game/sideQuest/types/player-equipment.d.ts +1 -0
  167. package/bundle/typescript/src/commands/game/sideQuest/types/seed/exit-seed.d.ts +1 -0
  168. package/bundle/typescript/src/commands/game/sideQuest/types/seed/item-seed.d.ts +1 -0
  169. package/bundle/typescript/src/commands/game/sideQuest/types/seed/npc-seed.d.ts +1 -0
  170. package/bundle/typescript/src/commands/game/sideQuest/types/seed/player-seed.d.ts +34 -0
  171. package/bundle/typescript/src/commands/game/sideQuest/types/seed/puzzle-seed.d.ts +15 -1
  172. package/bundle/typescript/src/commands/game/sideQuest/types/seed/room-seed.d.ts +3 -0
  173. package/bundle/typescript/src/commands/game/sideQuest/types/seed/scene-seed.d.ts +5 -0
  174. package/bundle/typescript/src/commands/game/sideQuest/types/seed/win-condition-seed.d.ts +15 -0
  175. package/bundle/typescript/src/commands/game/sideQuest/types/seed/win-condition-seed.js +2 -0
  176. package/bundle/typescript/src/commands/game/sideQuest/types/seed/win-condition-seed.js.map +1 -0
  177. package/bundle/typescript/src/commands/game/sideQuest/types/shared/abstracts.d.ts +1 -0
  178. package/bundle/typescript/src/commands/game/sideQuest/types/shared/abstracts.js +5 -0
  179. package/bundle/typescript/src/commands/game/sideQuest/types/shared/abstracts.js.map +1 -1
  180. package/bundle/typescript/src/commands/game/sideQuest/types/shared/item-enum.d.ts +1 -0
  181. package/bundle/typescript/src/commands/game/sideQuest/types/shared/item-enum.js +1 -0
  182. package/bundle/typescript/src/commands/game/sideQuest/types/shared/item-enum.js.map +1 -1
  183. package/bundle/typescript/src/commands/game/sideQuest/ui.d.ts +3 -0
  184. package/bundle/typescript/src/commands/game/sideQuest/ui.js +95 -5
  185. package/bundle/typescript/src/commands/game/sideQuest/ui.js.map +1 -1
  186. package/bundle/typescript/src/commands/game/sideQuest/utilities/auto-fight.d.ts +60 -0
  187. package/bundle/typescript/src/commands/game/sideQuest/utilities/auto-fight.js +138 -0
  188. package/bundle/typescript/src/commands/game/sideQuest/utilities/auto-fight.js.map +1 -0
  189. package/bundle/typescript/src/commands/game/sideQuest/utilities/combat-exchange.d.ts +143 -0
  190. package/bundle/typescript/src/commands/game/sideQuest/utilities/combat-exchange.js +328 -0
  191. package/bundle/typescript/src/commands/game/sideQuest/utilities/combat-exchange.js.map +1 -0
  192. package/bundle/typescript/src/commands/game/sideQuest/utilities/comm-style.d.ts +2 -0
  193. package/bundle/typescript/src/commands/game/sideQuest/utilities/comm-style.js +12 -0
  194. package/bundle/typescript/src/commands/game/sideQuest/utilities/comm-style.js.map +1 -0
  195. package/bundle/typescript/src/commands/game/sideQuest/utilities/dice.d.ts +22 -0
  196. package/bundle/typescript/src/commands/game/sideQuest/utilities/dice.js +34 -0
  197. package/bundle/typescript/src/commands/game/sideQuest/utilities/dice.js.map +1 -0
  198. package/bundle/typescript/src/commands/game/sideQuest/utilities/fuzzy-match.d.ts +36 -0
  199. package/bundle/typescript/src/commands/game/sideQuest/utilities/fuzzy-match.js +92 -0
  200. package/bundle/typescript/src/commands/game/sideQuest/utilities/fuzzy-match.js.map +1 -0
  201. package/bundle/typescript/src/commands/game/sideQuest/utilities/planes.d.ts +44 -0
  202. package/bundle/typescript/src/commands/game/sideQuest/utilities/planes.js +193 -0
  203. package/bundle/typescript/src/commands/game/sideQuest/utilities/planes.js.map +1 -0
  204. package/bundle/typescript/src/commands/game/sideQuest/utilities/pursuit.d.ts +16 -0
  205. package/bundle/typescript/src/commands/game/sideQuest/utilities/pursuit.js +36 -0
  206. package/bundle/typescript/src/commands/game/sideQuest/utilities/pursuit.js.map +1 -0
  207. package/bundle/typescript/src/commands/game/sideQuest.sub.cmd.js +54 -7
  208. package/bundle/typescript/src/commands/game/sideQuest.sub.cmd.js.map +1 -1
  209. package/bundle/typescript/src/commands/set/global.sub.cmd.js +59 -5
  210. package/bundle/typescript/src/commands/set/global.sub.cmd.js.map +1 -1
  211. package/bundle/typescript/src/tools/ai/ai.class.d.ts +35 -0
  212. package/bundle/typescript/src/tools/ai/ai.class.js +112 -0
  213. package/bundle/typescript/src/tools/ai/ai.class.js.map +1 -0
  214. package/bundle/typescript/src/tools/fsi/fsi.interfaces.d.ts +1 -0
  215. package/bundle/typescript/src/tools/fsi/fsi.interfaces.js.map +1 -1
  216. package/bundle/typescript/src/tools/https/https.class.d.ts +2 -1
  217. package/bundle/typescript/src/tools/https/https.class.js +43 -0
  218. package/bundle/typescript/src/tools/https/https.class.js.map +1 -1
  219. package/bundle/typescript/src/tools/https/https.interface.d.ts +8 -0
  220. package/package.json +1 -1
@@ -0,0 +1,92 @@
1
+ /**
2
+ * Shared fuzzy name-matching, extracted from Inventory's item resolution so
3
+ * actor targeting (attack.ts, cast.ts) behaves the same way "take" does --
4
+ * found via a real session where "cast manabolt at mr krow" failed against
5
+ * "Mr. Krow" over a missing period. Three tiers, in order of confidence:
6
+ *
7
+ * 1. Exact match on the loosely-normalized strings (case, punctuation,
8
+ * and extra whitespace ignored -- "mr krow" == "Mr. Krow").
9
+ * 2. Substring containment, either direction -- short aliases ("krow"),
10
+ * or extra/missing words at the edges.
11
+ * 3. Word-overlap with light per-word typo tolerance (Levenshtein <= 1
12
+ * on words longer than 3 chars, stopwords ignored) -- misspellings
13
+ * and reordered/inserted words.
14
+ *
15
+ * A tier only matches when it produces exactly ONE candidate (or a clear
16
+ * best score) -- an ambiguous guess deliberately misses rather than
17
+ * picking someone at random.
18
+ */
19
+ export const STOPWORDS = new Set(['a', 'an', 'the', 'of', 'on', 'in', 'at', 'to', 'with']);
20
+ /** Lowercase, strip punctuation, collapse whitespace. */
21
+ export function normalizeLoose(s) {
22
+ return s.toLowerCase().replace(/[^\w\s]/g, '').replace(/\s+/g, ' ').trim();
23
+ }
24
+ export function significantWords(s) {
25
+ return s.split(/\s+/).filter(w => w.length > 0 && !STOPWORDS.has(w));
26
+ }
27
+ export function wordsAreCloseEnough(a, b) {
28
+ if (a === b)
29
+ return true;
30
+ if (a.length <= 3 || b.length <= 3)
31
+ return false; // too short for typo tolerance to be safe
32
+ return levenshteinDistance(a, b) <= 1;
33
+ }
34
+ /**
35
+ * Damerau-Levenshtein (OSA variant): like plain Levenshtein but a swap of
36
+ * two adjacent letters counts as ONE edit, not two -- transpositions
37
+ * ("jhonson" for "johnson", "teh" for "the") are the single most common
38
+ * typo class, and plain Levenshtein prices them out of the <=1 tolerance.
39
+ */
40
+ export function levenshteinDistance(a, b) {
41
+ const dp = Array.from({ length: a.length + 1 }, () => new Array(b.length + 1).fill(0));
42
+ for (let i = 0; i <= a.length; i++)
43
+ dp[i][0] = i;
44
+ for (let j = 0; j <= b.length; j++)
45
+ dp[0][j] = j;
46
+ for (let i = 1; i <= a.length; i++) {
47
+ for (let j = 1; j <= b.length; j++) {
48
+ const cost = a[i - 1] === b[j - 1] ? 0 : 1;
49
+ dp[i][j] = Math.min(dp[i - 1][j] + 1, dp[i][j - 1] + 1, dp[i - 1][j - 1] + cost);
50
+ if (i > 1 && j > 1 && a[i - 1] === b[j - 2] && a[i - 2] === b[j - 1]) {
51
+ dp[i][j] = Math.min(dp[i][j], dp[i - 2][j - 2] + cost);
52
+ }
53
+ }
54
+ }
55
+ return dp[a.length][b.length];
56
+ }
57
+ /**
58
+ * Picks the single name from `names` that `input` most plausibly refers
59
+ * to, or undefined when nothing (or more than one thing) qualifies.
60
+ * Returns the ORIGINAL name string, not the normalized form.
61
+ */
62
+ export function fuzzyPickName(input, names) {
63
+ const normalized = normalizeLoose(input);
64
+ if (normalized.length === 0)
65
+ return undefined;
66
+ const candidates = names.map(name => ({ name, norm: normalizeLoose(name) }));
67
+ const exact = candidates.filter(c => c.norm === normalized);
68
+ if (exact.length === 1)
69
+ return exact[0].name;
70
+ if (exact.length > 1)
71
+ return undefined;
72
+ const substring = candidates.filter(c => c.norm.includes(normalized) || normalized.includes(c.norm));
73
+ if (substring.length === 1)
74
+ return substring[0].name;
75
+ const inputWords = significantWords(normalized);
76
+ if (inputWords.length === 0)
77
+ return undefined;
78
+ const scored = candidates
79
+ .map(c => {
80
+ const nameWords = significantWords(c.norm);
81
+ const matched = inputWords.filter(iw => nameWords.some(nw => wordsAreCloseEnough(iw, nw))).length;
82
+ return { name: c.name, score: matched / inputWords.length };
83
+ })
84
+ .filter(s => s.score >= 0.6)
85
+ .sort((a, b) => b.score - a.score);
86
+ if (scored.length === 1)
87
+ return scored[0].name;
88
+ if (scored.length > 1 && scored[0].score > scored[1].score)
89
+ return scored[0].name; // clear winner
90
+ return undefined;
91
+ }
92
+ //# sourceMappingURL=fuzzy-match.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fuzzy-match.js","sourceRoot":"","sources":["../../../../../../../src/commands/game/sideQuest/utilities/fuzzy-match.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAi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MAAM,UAAU,GAAG,gBAAgB,CAAC,UAAU,CAAC,CAAC;IAChD,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,SAAS,CAAC;IAE9C,MAAM,MAAM,GAAG,UAAU;SACtB,GAAG,CAAC,CAAC,CAAC,EAAE;QACP,MAAM,SAAS,GAAG,gBAAgB,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;QAC3C,MAAM,OAAO,GAAG,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC,mBAAmB,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;QAClG,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,OAAO,GAAG,UAAU,CAAC,MAAM,EAAE,CAAC;IAC9D,CAAC,CAAC;SACD,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,IAAI,GAAG,CAAC;SAC3B,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC;IAErC,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAC/C,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK;QAAE,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,eAAe;IAElG,OAAO,SAAS,CAAC;AACnB,CAAC"}
@@ -0,0 +1,44 @@
1
+ import { Player, SimMode } from '../models/player.js';
2
+ import { NPC } from '../models/npc.js';
3
+ import { Scene } from '../models/scene.js';
4
+ import { Room } from '../models/room.js';
5
+ /**
6
+ * Plane transitions and their tolls -- the one place that moves an actor
7
+ * between meat, Matrix, and astral (see Player.plane for the model).
8
+ *
9
+ * The invariant every transition preserves: while off the meat plane, the
10
+ * actor's empty body slumps in `bodyRoom`, visible and attackable
11
+ * (resolveBodyAttack); snapping back -- voluntarily or forced -- returns
12
+ * the actor there and settles the toll:
13
+ *
14
+ * Matrix -- voluntary jack-out is clean; a forced dump is DUMPSHOCK,
15
+ * resisted with Willpower: stun in cold-sim, PHYSICAL in
16
+ * hot-sim. The persona's Matrix track resets either way (a
17
+ * rebooted persona comes back clean).
18
+ * Astral -- the longer you were out (astralTicks, one per room-move),
19
+ * the harder the snap-back: resist ceil(ticks/2) stun with
20
+ * Willpower + half Magic; a forced return adds +2 before the
21
+ * resist.
22
+ */
23
+ export declare function planeLabel(actor: Player): string;
24
+ /** Every off-plane actor whose empty body lies in this room. */
25
+ export declare function shellsInRoom(scene: Scene, room: Room): (Player | NPC)[];
26
+ export declare function enterMatrix(scene: Scene, actor: Player, mode: SimMode): string[];
27
+ export declare function leaveMatrix(scene: Scene, actor: Player, opts?: {
28
+ forced?: boolean;
29
+ reason?: string;
30
+ }): string[];
31
+ export declare function projectAstral(scene: Scene, actor: Player): string[];
32
+ export declare function returnToBody(scene: Scene, actor: Player, opts?: {
33
+ forced?: boolean;
34
+ reason?: string;
35
+ }): string[];
36
+ /**
37
+ * A meat-plane attack on an empty body: one UNANSWERED strike -- no
38
+ * defense roll (nobody's home), meat soak only (Body + worn armor; the
39
+ * plane-aware getSoakPool would wrongly price the persona's firewall) --
40
+ * then the owner is slammed back into a body under attack, paying the
41
+ * forced-return toll on top of whatever got through. Returns the full
42
+ * narration; the caller announces it.
43
+ */
44
+ export declare function resolveBodyAttack(scene: Scene, attacker: Player | NPC, victim: Player | NPC): string[];
@@ -0,0 +1,193 @@
1
+ import { Logger } from './logger.js';
2
+ import { rollPool, formatRoll } from './dice.js';
3
+ /**
4
+ * Plane transitions and their tolls -- the one place that moves an actor
5
+ * between meat, Matrix, and astral (see Player.plane for the model).
6
+ *
7
+ * The invariant every transition preserves: while off the meat plane, the
8
+ * actor's empty body slumps in `bodyRoom`, visible and attackable
9
+ * (resolveBodyAttack); snapping back -- voluntarily or forced -- returns
10
+ * the actor there and settles the toll:
11
+ *
12
+ * Matrix -- voluntary jack-out is clean; a forced dump is DUMPSHOCK,
13
+ * resisted with Willpower: stun in cold-sim, PHYSICAL in
14
+ * hot-sim. The persona's Matrix track resets either way (a
15
+ * rebooted persona comes back clean).
16
+ * Astral -- the longer you were out (astralTicks, one per room-move),
17
+ * the harder the snap-back: resist ceil(ticks/2) stun with
18
+ * Willpower + half Magic; a forced return adds +2 before the
19
+ * resist.
20
+ */
21
+ export function planeLabel(actor) {
22
+ if (actor.plane === 'matrix')
23
+ return `MATRIX (${actor.simMode ?? 'cold'}-sim)`;
24
+ if (actor.plane === 'astral')
25
+ return 'ASTRAL';
26
+ return 'MEAT';
27
+ }
28
+ /** Every off-plane actor whose empty body lies in this room. */
29
+ export function shellsInRoom(scene, room) {
30
+ return scene.allActors.filter(a => a.plane !== 'meat' && a.bodyRoom === room);
31
+ }
32
+ export function enterMatrix(scene, actor, mode) {
33
+ actor.bodyRoom = actor.currentLocation;
34
+ actor.plane = 'matrix';
35
+ actor.simMode = mode;
36
+ // The deck you ride in on is the deck that takes the damage (see
37
+ // Item's device condition monitor). Its existing dents come with it --
38
+ // hardware doesn't heal between runs.
39
+ actor.activeDeck = actor.getCyberdeck();
40
+ actor.performAction('jacks in', `slumping where they stand, eyes flickering (${mode}-sim)`);
41
+ scene.addWorldEvent(`${actor.name} jacked into the Matrix in ${actor.bodyRoom.name}.`);
42
+ Logger.getInstance().write(`${actor.name} entered the Matrix (${mode}-sim, ${actor.activeDeck?.name ?? (actor.isTechnomancer() ? 'living persona' : 'no deck?!')}) from ${actor.bodyRoom.name}.`);
43
+ const hotWarning = mode === 'hot'
44
+ ? ` Hot-sim: everything is faster and hits harder -- including what hits YOU. Ice biofeedback bleeds into your real stun track.`
45
+ : actor.isTechnomancer()
46
+ ? ` There is no deck between you and the ice -- every hit out here is YOUR mind taking it.`
47
+ : ` Cold-sim: the ice can only chew on your deck, not your brain.`;
48
+ const deckNote = actor.activeDeck && actor.activeDeck.deckDamage > 0
49
+ ? ` Your ${actor.activeDeck.name} is already scarred: ${actor.activeDeck.deckSummary()}.`
50
+ : '';
51
+ const entry = actor.isTechnomancer()
52
+ ? `You close your eyes and the Matrix is simply THERE -- no deck, no interface, just the resonance singing. Your body slumps where you stood in ${actor.bodyRoom.name}, empty.`
53
+ : `Your ${actor.activeDeck?.name ?? 'deck'} spins up and the room dissolves into geometry -- you're in. Your body slumps where you stood in ${actor.bodyRoom.name}, empty.`;
54
+ return [
55
+ `${entry}${hotWarning}${deckNote}`,
56
+ `Move with "go" (the grid overlays the world), "hack" inside a host node, "jack out" to return.`,
57
+ ];
58
+ }
59
+ export function leaveMatrix(scene, actor, opts) {
60
+ const lines = [];
61
+ const body = actor.bodyRoom;
62
+ const wasHot = actor.simMode === 'hot';
63
+ if (opts?.forced) {
64
+ // Dumpshock: 4 boxes resisted with Willpower -- stun in cold-sim,
65
+ // physical in hot-sim (your brain was IN there).
66
+ const resist = rollPool(actor.willpower);
67
+ const dealt = Math.max(0, 4 - resist.hits);
68
+ lines.push(opts.reason ?? `The connection is severed from the other side.`);
69
+ lines.push(` DUMPSHOCK -- resist: ${formatRoll(resist)}`);
70
+ if (dealt > 0) {
71
+ if (wasHot) {
72
+ actor.takeDamage(dealt);
73
+ lines.push(` The world tears loose -- ${dealt} box${dealt === 1 ? '' : 'es'} PHYSICAL (hot-sim): ${actor.conditionSummary()}`);
74
+ }
75
+ else {
76
+ actor.takeStun(dealt);
77
+ lines.push(` Your head rings like a struck bell -- ${dealt} stun: ${actor.stunSummary()}`);
78
+ }
79
+ }
80
+ else {
81
+ lines.push(` You ride it out -- no damage.`);
82
+ }
83
+ }
84
+ else {
85
+ lines.push(`You back out clean and unplug.`);
86
+ }
87
+ // Deck damage STAYS -- it's hardware, not a session variable. A bricked
88
+ // deck refuses the next jack-in until repaired (rest.ts).
89
+ if (actor.activeDeck?.isBricked) {
90
+ lines.push(`Your ${actor.activeDeck.name} is BRICKED -- dead boards, burnt trace. It repairs while you rest somewhere safe.`);
91
+ }
92
+ actor.plane = 'meat';
93
+ actor.simMode = undefined;
94
+ actor.activeDeck = undefined;
95
+ if (body) {
96
+ actor.currentLocation = body;
97
+ actor.bodyRoom = undefined;
98
+ lines.push(`You're back in your body in ${body.name}.`);
99
+ }
100
+ actor.performAction('jacks out', 'stirring awake');
101
+ scene.addWorldEvent(`${actor.name} jacked out of the Matrix.`);
102
+ scene.updateStatus();
103
+ return lines;
104
+ }
105
+ export function projectAstral(scene, actor) {
106
+ actor.bodyRoom = actor.currentLocation;
107
+ actor.plane = 'astral';
108
+ actor.astralTicks = 0;
109
+ actor.performAction('projects', 'body going slack, something vast leaving their eyes');
110
+ scene.addWorldEvent(`${actor.name} projected astrally from ${actor.bodyRoom.name}.`);
111
+ Logger.getInstance().write(`${actor.name} projected astrally from ${actor.bodyRoom.name}.`);
112
+ return [
113
+ `You slip free of your flesh. The world stays -- shifted: auras where faces were, glass-bright emotion, the meat world dim and untouchable below. Your body slumps in ${actor.bodyRoom.name}, empty.`,
114
+ `Move with "go" (locked doors mean nothing; wards do), "assense" what you see, "return" to your body. Every move out here is a debt the snap-back collects.`,
115
+ ];
116
+ }
117
+ export function returnToBody(scene, actor, opts) {
118
+ const lines = [];
119
+ const body = actor.bodyRoom;
120
+ const debt = Math.ceil(actor.astralTicks / 2) + (opts?.forced ? 2 : 0);
121
+ if (opts?.reason)
122
+ lines.push(opts.reason);
123
+ if (debt > 0) {
124
+ const resist = rollPool(actor.willpower + Math.floor(actor.magic / 2));
125
+ const dealt = Math.max(0, debt - resist.hits);
126
+ lines.push(` The snap-back (${debt}) -- resist: ${formatRoll(resist)}`);
127
+ if (dealt > 0) {
128
+ actor.takeStun(dealt);
129
+ lines.push(` Re-entry burns -- ${dealt} stun: ${actor.stunSummary()}`);
130
+ }
131
+ else {
132
+ lines.push(` You settle back into your flesh without a tremor.`);
133
+ }
134
+ }
135
+ else {
136
+ lines.push(`You flow back down the silver thread.`);
137
+ }
138
+ actor.plane = 'meat';
139
+ actor.astralTicks = 0;
140
+ if (body) {
141
+ actor.currentLocation = body;
142
+ actor.bodyRoom = undefined;
143
+ lines.push(`You open your own eyes in ${body.name}.`);
144
+ }
145
+ actor.performAction('returns to their body', 'drawing a sharp breath');
146
+ scene.addWorldEvent(`${actor.name} returned to their body.`);
147
+ scene.updateStatus();
148
+ return lines;
149
+ }
150
+ /**
151
+ * A meat-plane attack on an empty body: one UNANSWERED strike -- no
152
+ * defense roll (nobody's home), meat soak only (Body + worn armor; the
153
+ * plane-aware getSoakPool would wrongly price the persona's firewall) --
154
+ * then the owner is slammed back into a body under attack, paying the
155
+ * forced-return toll on top of whatever got through. Returns the full
156
+ * narration; the caller announces it.
157
+ */
158
+ export function resolveBodyAttack(scene, attacker, victim) {
159
+ const logger = Logger.getInstance();
160
+ const lines = [];
161
+ const wasPlane = victim.plane;
162
+ const weapon = attacker.getWeaponProfile();
163
+ const attack = rollPool(attacker.getAttackPool());
164
+ const soakPool = Math.max(0, victim.body + victim.getArmorValue());
165
+ lines.push(`${attacker.name} attacks ${victim.name}'s empty body with ${weapon.name} -- nobody's home to dodge:`);
166
+ lines.push(` Attack: ${formatRoll(attack)}`);
167
+ if (attack.hits === 0) {
168
+ lines.push(` Somehow, the blow goes wide of even a motionless target.`);
169
+ }
170
+ else {
171
+ const incoming = weapon.damage + attack.hits;
172
+ const soak = rollPool(soakPool);
173
+ const dealt = Math.max(0, incoming - soak.hits);
174
+ lines.push(` Hit! ${incoming} damage incoming.`);
175
+ lines.push(` Soak: ${formatRoll(soak)}`);
176
+ if (dealt === 0) {
177
+ lines.push(` The armor holds -- the body doesn't even rock.`);
178
+ }
179
+ else {
180
+ victim.takeDamage(dealt);
181
+ lines.push(` ${dealt} box${dealt === 1 ? '' : 'es'} into the defenseless flesh.`);
182
+ }
183
+ }
184
+ logger.write(`${attacker.name} attacked ${victim.name}'s empty body (${wasPlane}).`);
185
+ // The owner feels it and snaps back -- into a room with an attacker.
186
+ const reason = `Something is happening to your BODY --`;
187
+ const back = wasPlane === 'matrix'
188
+ ? leaveMatrix(scene, victim, { forced: true, reason })
189
+ : returnToBody(scene, victim, { forced: true, reason });
190
+ lines.push('', ...back);
191
+ return lines;
192
+ }
193
+ //# sourceMappingURL=planes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"planes.js","sourceRoot":"","sources":["../../../../../../../src/commands/game/sideQuest/utilities/planes.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAEjD;;;;;;;;;;;;;;;;;GAiBG;AAEH,MAAM,UAAU,UAAU,CAAC,KAAa;IACtC,IAAI,KAAK,CAAC,KAAK,KAAK,QAAQ;QAAE,OAAO,WAAW,KAAK,CAAC,OAAO,IAAI,MAAM,OAAO,CAAC;IAC/E,IAAI,KAAK,CAAC,KAAK,KAAK,QAAQ;QAAE,OAAO,QAAQ,CAAC;IAC9C,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,gEAAgE;AAChE,MAAM,UAAU,YAAY,CAAC,KAAY,EAAE,IAAU;IACnD,OAAO,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,MAAM,IAAI,CAAC,CAAC,QAAQ,KAAK,IAAI,CAAC,CAAC;AAChF,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,KAAY,EAAE,KAAa,EAAE,IAAa;IACpE,KAAK,CAAC,QAAQ,GAAG,KAAK,CAAC,eAAe,CAAC;IACvC,KAAK,CAAC,KAAK,GAAG,QAAQ,CAAC;IACvB,KAAK,CAAC,OAAO,GAAG,IAAI,CAAC;IACrB,iEAAiE;IACjE,u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,EAAE,CAAC,CAAC;IAC1D,KAAK,CAAC,IAAI,CAAC,EAAE,EAAE,GAAG,IAAI,CAAC,CAAC;IACxB,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -0,0 +1,16 @@
1
+ import { Scene } from '../models/scene.js';
2
+ import { Room } from '../models/room.js';
3
+ /**
4
+ * When a combat target isn't in the room, work out where they actually are
5
+ * and phrase it as something actionable -- found via a real session where a
6
+ * player ping-ponged between two rooms and the hostile NPC's AI loop just
7
+ * spammed dozens of failed "attack" commands at the empty room instead of
8
+ * chasing. The failed command's RESULT string is the one thing guaranteed
9
+ * to land in an NPC's AI history, so putting the literal next command in it
10
+ * ("go west" to chase) is what converts flailing into pursuit. Works for
11
+ * the player too: attacking someone who just fled tells you where they ran.
12
+ *
13
+ * Returns undefined when the name matches nobody in the scene at all --
14
+ * the caller keeps its ordinary "no such person" message for that.
15
+ */
16
+ export declare function describeFledTarget(scene: Scene, fromRoom: Room, targetName: string): string | undefined;
@@ -0,0 +1,36 @@
1
+ import { Door } from '../models/door.js';
2
+ import { fuzzyPickName } from './fuzzy-match.js';
3
+ /**
4
+ * When a combat target isn't in the room, work out where they actually are
5
+ * and phrase it as something actionable -- found via a real session where a
6
+ * player ping-ponged between two rooms and the hostile NPC's AI loop just
7
+ * spammed dozens of failed "attack" commands at the empty room instead of
8
+ * chasing. The failed command's RESULT string is the one thing guaranteed
9
+ * to land in an NPC's AI history, so putting the literal next command in it
10
+ * ("go west" to chase) is what converts flailing into pursuit. Works for
11
+ * the player too: attacking someone who just fled tells you where they ran.
12
+ *
13
+ * Returns undefined when the name matches nobody in the scene at all --
14
+ * the caller keeps its ordinary "no such person" message for that.
15
+ */
16
+ export function describeFledTarget(scene, fromRoom, targetName) {
17
+ const elsewhere = scene.allActors.filter(a => a.currentLocation !== fromRoom);
18
+ const pickedName = fuzzyPickName(targetName, elsewhere.map(a => a.name));
19
+ if (!pickedName)
20
+ return undefined;
21
+ const target = elsewhere.find(a => a.name === pickedName);
22
+ if (!target || !target.currentLocation)
23
+ return undefined;
24
+ const theirRoom = target.currentLocation;
25
+ // Adjacent? Name the direction and whether the way is open.
26
+ for (const [direction, exit] of fromRoom.exits.entries()) {
27
+ if (exit instanceof Door && exit.getOtherSide(fromRoom) === theirRoom) {
28
+ if (exit.checkIfLocked()) {
29
+ return `${target.name} isn't here -- they're through the ${direction} door in ${theirRoom.name}, but it's locked.`;
30
+ }
31
+ return `${target.name} isn't here -- they went ${direction}, to ${theirRoom.name}. ("go ${direction}" to chase them.)`;
32
+ }
33
+ }
34
+ return `${target.name} isn't here -- they're somewhere else (${theirRoom.name}), not within reach of this room.`;
35
+ }
36
+ //# sourceMappingURL=pursuit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pursuit.js","sourceRoot":"","sources":["../../../../../../../src/commands/game/sideQuest/utilities/pursuit.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,kBAAkB,CAAC,KAAY,EAAE,QAAc,EAAE,UAAkB;IACjF,MAAM,SAAS,GAAG,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,eAAe,KAAK,QAAQ,CAAC,CAAC;IAC9E,MAAM,UAAU,GAAG,aAAa,CAAC,UAAU,EAAE,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;IACzE,IAAI,CAAC,UAAU;QAAE,OAAO,SAAS,CAAC;IAElC,MAAM,MAAM,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,UAAU,CAAC,CAAC;IAC1D,IAAI,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,eAAe;QAAE,OAAO,SAAS,CAAC;IAEzD,MAAM,SAAS,GAAG,MAAM,CAAC,eAAe,CAAC;IAEzC,4DAA4D;IAC5D,KAAK,MAAM,CAAC,SAAS,EAAE,IAAI,CAAC,IAAI,QAAQ,CAAC,KAAK,CAAC,OAAO,EAAE,EAAE,CAAC;QACzD,IAAI,IAAI,YAAY,IAAI,IAAI,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,KAAK,SAAS,EAAE,CAAC;YACtE,IAAI,IAAI,CAAC,aAAa,EAAE,EAAE,CAAC;gBACzB,OAAO,GAAG,MAAM,CAAC,IAAI,sCAAsC,SAAS,YAAY,SAAS,CAAC,IAAI,oBAAoB,CAAC;YACrH,CAAC;YACD,OAAO,GAAG,MAAM,CAAC,IAAI,4BAA4B,SAAS,QAAQ,SAAS,CAAC,IAAI,UAAU,SAAS,mBAAmB,CAAC;QACzH,CAAC;IACH,CAAC;IAED,OAAO,GAAG,MAAM,CAAC,IAAI,0CAA0C,SAAS,CAAC,IAAI,mCAAmC,CAAC;AACnH,CAAC"}
@@ -6,6 +6,9 @@ import PlayCommand from './play.command.js';
6
6
  import { Command } from '../../command.js';
7
7
  import { Actions } from '../../tools/actions/actions.class.js';
8
8
  import { Log } from '../../tools/log/log.class.js';
9
+ import { SceneSeedGenerator } from './sideQuest/factories/scene-seed-generator.js';
10
+ import { ARCHETYPES } from './sideQuest/archetypes.js';
11
+ import { AI } from '../../tools/ai/ai.class.js';
9
12
  const shadowrunConfig1 = require('./sideQuest/scenes/scene1.json');
10
13
  const shadowrunConfig2 = require('./sideQuest/scenes/scene2.json');
11
14
  import { fileURLToPath } from 'url';
@@ -24,20 +27,64 @@ Command.create({
24
27
  }, async function (args, opts) {
25
28
  try {
26
29
  const makaDir = this.fsi.getGlobalMakaDir();
27
- const logFilePath = path.join(makaDir, 'side-quest.log');
30
+ // Each play session gets its own directory (timestamp-named) instead of
31
+ // appending to one ever-growing log file. Generated AI scenes are saved
32
+ // alongside the log for that same session -- see SceneSeedGenerator.
33
+ const sessionId = new Date().toISOString().replace(/[:.]/g, '-');
34
+ const sessionDir = path.join(makaDir, 'side-quest-sessions', sessionId);
35
+ const logFilePath = path.join(sessionDir, 'game.log');
28
36
  const playerName = (opts.player) ? opts.player : await Actions.ask('What is your name? [Maka]') || 'Maka';
37
+ // Pick who you are before what the job is -- the archetype spread
38
+ // becomes the player's full attribute sheet (see archetypes.ts), and
39
+ // the mage archetypes are the road to playing Awakened.
40
+ const archetypeName = await Actions.select({
41
+ message: 'Who are you on the street?',
42
+ name: 'archetypeName',
43
+ choices: ARCHETYPES.map(a => ({ name: `${a.name} -- ${a.description}`, value: a.name })),
44
+ });
29
45
  const gameOptions = {
30
46
  ...opts,
31
- logFilePath
47
+ logFilePath,
48
+ // Matches the convention NPC dialogue already uses elsewhere in this
49
+ // game: AI features turn on automatically whenever a key is
50
+ // configured, with no separate flag for the player to remember.
51
+ // AI.isConfigured() picks whichever provider is set up (OpenAI or
52
+ // Anthropic -- see tools/ai/ai.class.ts).
53
+ useAi: AI.isConfigured(),
54
+ archetype: archetypeName
32
55
  };
33
- const sideQuestAnswer = await Actions.select({
56
+ const GENERATE_NEW_RUN = 'GENERATE_NEW_RUN';
57
+ const choices = [
58
+ { name: shadowrunConfig1.name, value: shadowrunConfig1 },
59
+ { name: shadowrunConfig2.name, value: shadowrunConfig2 },
60
+ ];
61
+ if (gameOptions.useAi) {
62
+ choices.push({ name: 'Generate a new Run (AI)', value: GENERATE_NEW_RUN });
63
+ }
64
+ let sideQuestAnswer = await Actions.select({
34
65
  message: 'Which Run would you like to play?',
35
66
  name: 'sideQuestAnswer',
36
- choices: [
37
- { name: shadowrunConfig1.name, value: shadowrunConfig1 },
38
- { name: shadowrunConfig2.name, value: shadowrunConfig2 },
39
- ]
67
+ choices
40
68
  });
69
+ if (sideQuestAnswer === GENERATE_NEW_RUN) {
70
+ const spinner = Log.withSpinner();
71
+ spinner.start('Generating a new Run');
72
+ const generated = await SceneSeedGenerator.generate(logFilePath);
73
+ if (generated) {
74
+ spinner.success(`-- "${generated.name}" is ready.`);
75
+ sideQuestAnswer = generated;
76
+ }
77
+ else {
78
+ // The blessed UI takes over the terminal's alternate screen buffer
79
+ // as soon as the child process starts, so a spinner message printed
80
+ // here would be swallowed before the player ever sees it -- carry
81
+ // it into the game itself instead.
82
+ const notice = 'Could not generate a new AI run this time (after 3 attempts) -- starting "Seattle Underground" instead.';
83
+ spinner.failure(notice);
84
+ sideQuestAnswer = shadowrunConfig1;
85
+ gameOptions.generationNotice = notice;
86
+ }
87
+ }
41
88
  if (playerName && sideQuestAnswer) {
42
89
  // Spawn a new process to run your main function
43
90
  const child = spawn('node', [path.resolve(__dirname, './sideQuest/ui.js'), playerName, JSON.stringify(sideQuestAnswer), JSON.stringify(gameOptions)], {
@@ -1 +1 @@
1
- {"version":3,"file":"sideQuest.sub.cmd.js","sourceRoot":"","sources":["../../../../../src/commands/game/sideQuest.sub.cmd.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AACvC,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAE/C,OAAO,WAAW,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,sCAAsC,CAAC;AAC/D,OAAO,EAAE,GAAG,EAAE,MAAM,8BAA8B,CAAC;AAEnD,MAAM,gBAAgB,GAAG,OAAO,CAAC,gCAAgC,CAAC,CAAC;AACnE,MAAM,gBAAgB,GAAG,OAAO,CAAC,gCAAgC,CAAC,CAAC;AAMnE,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAE/B,MAAM,UAAU,GAAG,aAA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,CAAC,CAAC;YAC1D,CAAC,CAAC,CAAC;YAEH,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE;gBAChC,IAAI,IAAI,KAAK,CAAC,EAAE,CAAC;oBACf,GAAG,CAAC,MAAM,CAAC,qBAAqB,CAAC,CAAC;gBACpC,CAAC;qBAAM,IAAI,IAAI,KAAK,CAAC,EAAE,CAAC;oBACtB,GAAG,CAAC,MAAM,CAAC,+BAA+B,CAAC,CAAC;gBAC9C,CAAC;qBAAM,CAAC;oBACN,GAAG,CAAC,KAAK,CAAC,+BAA+B,IAAI,cAAc,MAAM,EAAE,CAAC,CAAC;gBACvE,CAAC;YACH,CAAC,CAAC,CAAC;QAEL,CAAC;IAEH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACrB,CAAC;AAEH,CAAC,EAAE,WAAW,CAAC,CAAC"}
@@ -1,7 +1,39 @@
1
1
  import path from 'path';
2
+ import { exec } from 'child_process';
2
3
  import SetCommand from './set.command.js';
3
4
  import { Command } from '../../command.js';
4
5
  import { Log } from '../../tools/log/log.class.js';
6
+ import { Actions } from '../../tools/actions/actions.class.js';
7
+ const API_KEY_URLS = {
8
+ openai: 'https://platform.openai.com/api-keys',
9
+ anthropic: 'https://console.anthropic.com/settings/keys',
10
+ };
11
+ /**
12
+ * Best-effort browser launch (no third-party dependency -- shells out to
13
+ * each OS's own "open a URL" command). Purely a convenience so the player
14
+ * doesn't have to go hunting for the API-key dashboard URL themselves;
15
+ * failure here is never fatal; the URL is still shown, so the prompt
16
+ * itself still works.
17
+ */
18
+ function openBrowser(url) {
19
+ const command = process.platform === 'win32'
20
+ ? `start "" "${url}"`
21
+ : process.platform === 'darwin'
22
+ ? `open "${url}"`
23
+ : `xdg-open "${url}"`;
24
+ exec(command, (err) => {
25
+ if (err) {
26
+ Log.notice(`Could not open a browser automatically. Please visit: ${url}`);
27
+ }
28
+ });
29
+ }
30
+ async function promptForKey(provider) {
31
+ const label = provider === 'openai' ? 'OpenAI' : 'Anthropic';
32
+ const url = API_KEY_URLS[provider];
33
+ Log.notice(`Opening ${url} so you can create/copy your ${label} API key...`);
34
+ openBrowser(url);
35
+ return Actions.ask(`${label} API Key:`, true);
36
+ }
5
37
  Command.create({
6
38
  name: 'global-config',
7
39
  usage: 'maka set:global-config',
@@ -26,7 +58,13 @@ Command.create({
26
58
  },
27
59
  {
28
60
  name: 'openai',
29
- boolFlag: false
61
+ boolFlag: false,
62
+ description: 'Set your OpenAI API key. Omit the value to open the API-key dashboard in your browser and be prompted for it (input hidden).'
63
+ },
64
+ {
65
+ name: 'anthropic',
66
+ boolFlag: false,
67
+ description: 'Set your Anthropic (Claude) API key. Omit the value to open the API-key dashboard in your browser and be prompted for it (input hidden).'
30
68
  },
31
69
  {
32
70
  name: 'help',
@@ -57,7 +95,11 @@ Command.create({
57
95
  'maka set:gc --insecure <path>',
58
96
  'maka set:gc --workspace <path>',
59
97
  'maka set:gc --guided=false',
60
- 'maka set:gc --guided=true'
98
+ 'maka set:gc --guided=true',
99
+ 'maka set:gc --openai <key>',
100
+ 'maka set:gc --openai # prompts for the key, input hidden',
101
+ 'maka set:gc --anthropic <key>',
102
+ 'maka set:gc --anthropic # prompts for the key, input hidden'
61
103
  ]
62
104
  }, async function (args, opts) {
63
105
  try {
@@ -86,11 +128,23 @@ Command.create({
86
128
  throw new Error('Could not find directory');
87
129
  }
88
130
  }
89
- if (opts.openai) {
131
+ if (opts.openai !== undefined) {
132
+ const key = typeof opts.openai === 'string' && opts.openai.length > 0
133
+ ? opts.openai
134
+ : await promptForKey('openai');
135
+ await this.cfg.setGlobalConfig({
136
+ openai: key
137
+ });
138
+ Log.success(`Set OpenAI API key.`);
139
+ }
140
+ if (opts.anthropic !== undefined) {
141
+ const key = typeof opts.anthropic === 'string' && opts.anthropic.length > 0
142
+ ? opts.anthropic
143
+ : await promptForKey('anthropic');
90
144
  await this.cfg.setGlobalConfig({
91
- openai: opts.openai
145
+ anthropic: key
92
146
  });
93
- Log.success(`Set OpenAI Key: ${opts.openai}`);
147
+ Log.success(`Set Anthropic API key.`);
94
148
  }
95
149
  if (opts.pallet) {
96
150
  await this.cfg.setGlobalConfig({
@@ -1 +1 @@
1
- {"version":3,"file":"global.sub.cmd.js","sourceRoot":"","sources":["../../../../../src/commands/set/global.sub.cmd.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,UAAU,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,GAAG,EAAE,MAAM,8BAA8B,CAAC;AAYnD,OAAO,CAAC,MAAM,CAAC;IACb,IAAI,EAAE,eAAe;IACrB,KAAK,EAAE,wBAAwB;IAC/B,OAAO,EAAE,CAAC,IAAI,CAAC;IACf,aAAa,EAAE,CAAC;IAChB,SAAS,EAAE;QACT;YACE,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,KAAK;SAChB;QACD;YACE,IAAI,EAAE,eAAe;YACrB,QAAQ,EAAE,IAAI;SACf;QACD;YACE,IAAI,EAAE,kBAAkB;YACxB,QAAQ,EAAE,IAAI;SACf;QACD;YACE,IAAI,EAAE,WAAW;YACjB,QAAQ,EAAE,KAAK;SAChB;QACD;YACE,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,KAAK;SAChB;QACD;YACE,IAAI,EAAE,MAAM;YACZ,QAAQ,EAAE,IAAI;SACf;QACD;YACE,IAAI,EAAE,QAAQ;YACd,MAAM,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC;SAC1B;QACD;YACE,IAAI,EAAE,QAAQ;YACd,MAAM,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC;YACzB,WAAW,EAAE,mFAAmF;SACjG;KACF;IACD,SAAS,EAAE,8BAA8B;IACzC,WAAW,EAAE;;;;;;;;GAQZ;IACD,QAAQ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