@songsid/agend 2.4.0-beta.20 → 2.4.0-beta.22

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 (256) hide show
  1. package/dist/agent-cli-instructions.md +1 -1
  2. package/dist/backend/claude-carry.d.ts +11 -0
  3. package/dist/backend/claude-carry.js +88 -6
  4. package/dist/backend/claude-carry.js.map +1 -1
  5. package/dist/backend/claude-code.js +3 -0
  6. package/dist/backend/claude-code.js.map +1 -1
  7. package/dist/build-provenance.json +1 -1
  8. package/dist/cache-ledger.d.ts +23 -21
  9. package/dist/cache-ledger.js +70 -6
  10. package/dist/cache-ledger.js.map +1 -1
  11. package/dist/cache-prices.d.ts +8 -6
  12. package/dist/cache-prices.js +12 -5
  13. package/dist/cache-prices.js.map +1 -1
  14. package/dist/cache-service.d.ts +9 -5
  15. package/dist/cache-service.js +202 -50
  16. package/dist/cache-service.js.map +1 -1
  17. package/dist/channel/mcp-tools.js +6 -4
  18. package/dist/channel/mcp-tools.js.map +1 -1
  19. package/dist/cli-audited.js +2 -1
  20. package/dist/cli-audited.js.map +1 -1
  21. package/dist/cli.js +4 -1
  22. package/dist/cli.js.map +1 -1
  23. package/dist/contact-auth-policy.js +1 -1
  24. package/dist/contact-auth-policy.js.map +1 -1
  25. package/dist/contact-auth-service.js +8 -2
  26. package/dist/contact-auth-service.js.map +1 -1
  27. package/dist/contact-auth-store.d.ts +3 -0
  28. package/dist/contact-auth-store.js +34 -8
  29. package/dist/contact-auth-store.js.map +1 -1
  30. package/dist/contact-auth-types.d.ts +3 -2
  31. package/dist/contact-auth-types.js.map +1 -1
  32. package/dist/contact-change-proposals.d.ts +47 -0
  33. package/dist/contact-change-proposals.js +132 -0
  34. package/dist/contact-change-proposals.js.map +1 -0
  35. package/dist/daemon.d.ts +31 -0
  36. package/dist/daemon.js +149 -2
  37. package/dist/daemon.js.map +1 -1
  38. package/dist/delivery-outbox.d.ts +10 -0
  39. package/dist/delivery-outbox.js +21 -0
  40. package/dist/delivery-outbox.js.map +1 -1
  41. package/dist/fleet-manager.d.ts +65 -1
  42. package/dist/fleet-manager.js +338 -20
  43. package/dist/fleet-manager.js.map +1 -1
  44. package/dist/general-knowledge/skills/concepts/SKILL.md +2 -1
  45. package/dist/general-knowledge/skills/hub/SKILL.md +45 -5
  46. package/dist/general-knowledge/skills/task-board/SKILL.md +4 -0
  47. package/dist/general-knowledge/skills/web-appearance/SKILL.md +1 -1
  48. package/dist/general-knowledge/skills/web-dashboard/SKILL.md +16 -6
  49. package/dist/hub/agent-pictures-model.d.ts +275 -0
  50. package/dist/hub/agent-pictures-model.js +103 -0
  51. package/dist/hub/agent-pictures-model.js.map +1 -0
  52. package/dist/hub/agent-pictures.d.ts +64 -0
  53. package/dist/hub/agent-pictures.js +255 -0
  54. package/dist/hub/agent-pictures.js.map +1 -0
  55. package/dist/hub/client.d.ts +4 -0
  56. package/dist/hub/client.js +23 -2
  57. package/dist/hub/client.js.map +1 -1
  58. package/dist/hub/compose/member.d.ts +14 -3
  59. package/dist/hub/compose/member.js +46 -10
  60. package/dist/hub/compose/member.js.map +1 -1
  61. package/dist/hub/compose/server.d.ts +6 -5
  62. package/dist/hub/compose/server.js +7 -3
  63. package/dist/hub/compose/server.js.map +1 -1
  64. package/dist/hub/direct-posts-model.d.ts +1 -0
  65. package/dist/hub/direct-posts-model.js +2 -0
  66. package/dist/hub/direct-posts-model.js.map +1 -0
  67. package/dist/hub/direct-posts.d.ts +36 -0
  68. package/dist/hub/direct-posts.js +145 -0
  69. package/dist/hub/direct-posts.js.map +1 -0
  70. package/dist/hub/http/compose.d.ts +5 -0
  71. package/dist/hub/http/compose.js +158 -20
  72. package/dist/hub/http/compose.js.map +1 -1
  73. package/dist/hub/http/core.d.ts +9 -1
  74. package/dist/hub/http/core.js +21 -1
  75. package/dist/hub/http/core.js.map +1 -1
  76. package/dist/hub/http/deps.d.ts +1 -0
  77. package/dist/hub/http/schema.js +7 -0
  78. package/dist/hub/http/schema.js.map +1 -1
  79. package/dist/hub/init/text.js +1 -1
  80. package/dist/hub/join/service.d.ts +2 -0
  81. package/dist/hub/join/service.js +7 -3
  82. package/dist/hub/join/service.js.map +1 -1
  83. package/dist/hub/member/agent-pictures.d.ts +76 -0
  84. package/dist/hub/member/agent-pictures.js +196 -0
  85. package/dist/hub/member/agent-pictures.js.map +1 -0
  86. package/dist/hub/member/direct-rooms.d.ts +9 -0
  87. package/dist/hub/member/direct-rooms.js +14 -0
  88. package/dist/hub/member/direct-rooms.js.map +1 -0
  89. package/dist/hub/member/room-ask.d.ts +22 -1
  90. package/dist/hub/member/room-ask.js +99 -5
  91. package/dist/hub/member/room-ask.js.map +1 -1
  92. package/dist/hub/member/room-asker-store.d.ts +48 -0
  93. package/dist/hub/member/room-asker-store.js +181 -0
  94. package/dist/hub/member/room-asker-store.js.map +1 -0
  95. package/dist/hub/member/room-post.d.ts +11 -10
  96. package/dist/hub/member/room-post.js +51 -7
  97. package/dist/hub/member/room-post.js.map +1 -1
  98. package/dist/hub/policy.d.ts +11 -2
  99. package/dist/hub/policy.js +60 -7
  100. package/dist/hub/policy.js.map +1 -1
  101. package/dist/hub/protocol.d.ts +254 -1
  102. package/dist/hub/protocol.js +20 -8
  103. package/dist/hub/protocol.js.map +1 -1
  104. package/dist/hub/representative.d.ts +38 -0
  105. package/dist/hub/representative.js +140 -12
  106. package/dist/hub/representative.js.map +1 -1
  107. package/dist/hub/room-asker-identity-model.d.ts +53 -0
  108. package/dist/hub/room-asker-identity-model.js +14 -0
  109. package/dist/hub/room-asker-identity-model.js.map +1 -0
  110. package/dist/hub/room-asker-identity.d.ts +22 -0
  111. package/dist/hub/room-asker-identity.js +43 -0
  112. package/dist/hub/room-asker-identity.js.map +1 -0
  113. package/dist/hub/rooms/agents.d.ts +2 -0
  114. package/dist/hub/rooms/agents.js +30 -3
  115. package/dist/hub/rooms/agents.js.map +1 -1
  116. package/dist/hub/rooms/asker-identity.d.ts +21 -0
  117. package/dist/hub/rooms/asker-identity.js +86 -0
  118. package/dist/hub/rooms/asker-identity.js.map +1 -0
  119. package/dist/hub/rooms/direct-view.d.ts +3 -2
  120. package/dist/hub/rooms/direct-view.js +23 -8
  121. package/dist/hub/rooms/direct-view.js.map +1 -1
  122. package/dist/hub/rooms/office.d.ts +27 -0
  123. package/dist/hub/rooms/office.js +12 -2
  124. package/dist/hub/rooms/office.js.map +1 -1
  125. package/dist/hub/rooms/service.d.ts +38 -1
  126. package/dist/hub/rooms/service.js +56 -3
  127. package/dist/hub/rooms/service.js.map +1 -1
  128. package/dist/hub/rooms/types.d.ts +5 -2
  129. package/dist/hub/rooms.d.ts +9 -0
  130. package/dist/hub/rooms.js +97 -26
  131. package/dist/hub/rooms.js.map +1 -1
  132. package/dist/hub/runtime.d.ts +1 -1
  133. package/dist/hub/server.js +24 -2
  134. package/dist/hub/server.js.map +1 -1
  135. package/dist/hub/session-directory-transition.d.ts +1 -0
  136. package/dist/hub/session-directory-transition.js +15 -9
  137. package/dist/hub/session-directory-transition.js.map +1 -1
  138. package/dist/hub/session-limits.d.ts +58 -0
  139. package/dist/hub/session-limits.js +121 -0
  140. package/dist/hub/session-limits.js.map +1 -0
  141. package/dist/hub/sessions.d.ts +1 -1
  142. package/dist/hub/sessions.js +13 -7
  143. package/dist/hub/sessions.js.map +1 -1
  144. package/dist/hub/settings-directory-decision.js +1 -1
  145. package/dist/hub/settings-directory-decision.js.map +1 -1
  146. package/dist/hub/types.d.ts +9 -2
  147. package/dist/hub-character-plan.d.ts +47 -0
  148. package/dist/hub-character-plan.js +70 -0
  149. package/dist/hub-character-plan.js.map +1 -0
  150. package/dist/hub-contact-windows.d.ts +13 -1
  151. package/dist/hub-contact-windows.js +35 -2
  152. package/dist/hub-contact-windows.js.map +1 -1
  153. package/dist/hub-picture-reduce.d.ts +34 -0
  154. package/dist/hub-picture-reduce.js +101 -0
  155. package/dist/hub-picture-reduce.js.map +1 -0
  156. package/dist/hub-picture-worker.d.ts +1 -0
  157. package/dist/hub-picture-worker.js +19 -0
  158. package/dist/hub-picture-worker.js.map +1 -0
  159. package/dist/hub-report-target.d.ts +6 -0
  160. package/dist/hub-report-target.js +6 -0
  161. package/dist/hub-report-target.js.map +1 -1
  162. package/dist/locale.js +357 -265
  163. package/dist/locale.js.map +1 -1
  164. package/dist/ls-rows.d.ts +2 -0
  165. package/dist/ls-rows.js.map +1 -1
  166. package/dist/needs-you.d.ts +6 -0
  167. package/dist/needs-you.js +3 -1
  168. package/dist/needs-you.js.map +1 -1
  169. package/dist/outbound-handlers.d.ts +8 -0
  170. package/dist/outbound-handlers.js +53 -6
  171. package/dist/outbound-handlers.js.map +1 -1
  172. package/dist/outbound-schemas.d.ts +2 -0
  173. package/dist/outbound-schemas.js +6 -4
  174. package/dist/outbound-schemas.js.map +1 -1
  175. package/dist/runtime-cli-install.js +4 -4
  176. package/dist/runtime-cli-install.js.map +1 -1
  177. package/dist/task-board-tool.d.ts +17 -0
  178. package/dist/task-board-tool.js +58 -6
  179. package/dist/task-board-tool.js.map +1 -1
  180. package/dist/tips.js +3 -3
  181. package/dist/tool-permissions.js +2 -2
  182. package/dist/tool-permissions.js.map +1 -1
  183. package/dist/ui/agent-export-strings.js +1 -1
  184. package/dist/ui/agent-page-strings.js +5 -5
  185. package/dist/ui/contact-auth-client.js +2 -2
  186. package/dist/ui/contact-tool-groups.js +1 -1
  187. package/dist/ui/fleet-cache.js +5 -5
  188. package/dist/ui/fleet-canvas.js +3 -2
  189. package/dist/ui/fleet-office-card.js +46 -7
  190. package/dist/ui/fleet-office-dialogue.d.ts +6 -3
  191. package/dist/ui/fleet-office-dialogue.js +13 -3
  192. package/dist/ui/fleet-office-layout.js +15 -15
  193. package/dist/ui/fleet-office-model.js +3 -2
  194. package/dist/ui/fleet-office-overview.js +1 -1
  195. package/dist/ui/fleet-office-pack.d.ts +17 -7
  196. package/dist/ui/fleet-office-pack.js +106 -38
  197. package/dist/ui/fleet-office-play.js +11 -4
  198. package/dist/ui/fleet-office-skin.js +41 -11
  199. package/dist/ui/fleet-office-store.js +10 -1
  200. package/dist/ui/fleet-office-talk.js +423 -0
  201. package/dist/ui/fleet-office-view.js +58 -17
  202. package/dist/ui/fleet-office-zones.js +20 -12
  203. package/dist/ui/fleet-office.js +250 -65
  204. package/dist/ui/fleet-org.js +3 -3
  205. package/dist/ui/fleet-task-common.js +3 -3
  206. package/dist/ui/fleet-task-sort.js +88 -0
  207. package/dist/ui/fleet-task-view.js +38 -9
  208. package/dist/ui/fleet-tasks.js +47 -15
  209. package/dist/ui/fleet-usage.js +6 -6
  210. package/dist/ui/hub-admin-overview.js +1 -1
  211. package/dist/ui/hub-chat-store.js +4 -3
  212. package/dist/ui/hub-chat-strings.js +3 -1
  213. package/dist/ui/hub-client.js +3 -0
  214. package/dist/ui/hub-my-agents-strings.js +2 -2
  215. package/dist/ui/hub-my-agents.js +3 -0
  216. package/dist/ui/hub-room-composer.js +24 -4
  217. package/dist/ui/hub-room-members.js +7 -3
  218. package/dist/ui/hub-room-office.js +71 -2
  219. package/dist/ui/hub-room-presence.js +14 -0
  220. package/dist/ui/hub-room-strings.js +18 -2
  221. package/dist/ui/hub-room-thread.js +82 -13
  222. package/dist/ui/hub-room-working.js +37 -0
  223. package/dist/ui/hub-session-limits.js +79 -0
  224. package/dist/ui/panel-fleet.js +5 -5
  225. package/dist/ui/panel-hub.js +41 -6
  226. package/dist/ui/panel-log.js +3 -3
  227. package/dist/ui/panel-needs.js +28 -2
  228. package/dist/ui/panel-runtimes.js +2 -2
  229. package/dist/ui/runtime-cli-install.js +1 -1
  230. package/dist/ui/runtime-update-status.js +1 -1
  231. package/dist/ui/settings-access-strings.js +1 -1
  232. package/dist/ui/settings-hub-setup-strings.js +1 -1
  233. package/dist/ui/settings-layout.js +2 -2
  234. package/dist/ui/settings-named-test.js +16 -16
  235. package/dist/ui/settings-public-session-strings.js +2 -2
  236. package/dist/ui/settings-revoke-strings.js +1 -1
  237. package/dist/ui/settings-shared-strings.js +2 -2
  238. package/dist/ui/settings-strings.js +40 -40
  239. package/dist/ui/shared/app-shell.js +1 -1
  240. package/dist/ui/shared/app.css +106 -6
  241. package/dist/ui/shared/chat-strings.js +9 -9
  242. package/dist/ui/shared/hub-owner.css +5 -0
  243. package/dist/ui/shared/hub-rooms-u2.css +3 -0
  244. package/dist/ui/shared/instance-nav.js +36 -2
  245. package/dist/ui/shared/office-dialogue.css +110 -0
  246. package/dist/ui/shared/task-board.css +103 -7
  247. package/dist/ui/shared/view-strings.js +27 -9
  248. package/dist/web-api.d.ts +5 -0
  249. package/dist/web-api.js +29 -0
  250. package/dist/web-api.js.map +1 -1
  251. package/dist/web-office-skins.d.ts +8 -2
  252. package/dist/web-office-skins.js +33 -14
  253. package/dist/web-office-skins.js.map +1 -1
  254. package/dist/web-office-store.js +5 -3
  255. package/dist/web-office-store.js.map +1 -1
  256. package/package.json +1 -1
@@ -5,14 +5,15 @@
5
5
  // logical canvas, named areas with ordered seat slots, furniture with a depth, and a state → area map. No code or art of
6
6
  // it is used here — the idea of the format only.
7
7
  //
8
- // A pack is a JSON manifest plus images. Every coordinate is in logical units on a 1280×720 canvas (LOGICAL), which
9
- // the page shows whole, then pans and zooms (fleet-office-view.js). Images are pixel art, drawn unsmoothed at `scale` logical units per image pixel.
8
+ // A pack is a JSON manifest plus images. Every coordinate is in logical units on a 1280×720 canvas (LOGICAL), or on the
9
+ // pack's own `canvas: [w, h]` (#4405: 640×360 to 5120×2880, CANVAS), which the page shows whole, then pans and zooms (fleet-office-view.js). Images are pixel art, drawn unsmoothed at `scale` logical units per image pixel.
10
10
  //
11
11
  // {
12
12
  // "format": 1, required
13
13
  // "id": "cozy", letters, digits, - and _ (≤ 40); not a built-in skin's id
14
14
  // "scale": 2, 1–8 (default 2)
15
- // "background": "office.png", drawn over the whole 1280×720 canvas (16:9)
15
+ // "canvas": [2560, 1440], optional (#4405): the logical canvas, CANVAS.min to CANVAS.max
16
+ // "background": "office.png", drawn over the whole canvas (16:9; with "canvas", its shape)
16
17
  // "foreground": "front.png", optional, with stateZones: drawn over the whole canvas (16:9, as
17
18
  // the background) above the people, the furniture and the items in
18
19
  // the air, below the name tags, bubbles and "+n" counts (and Edit
@@ -119,6 +120,8 @@
119
120
  // { "idle", "working", "needs" } files; PNGs up to 1024×1536 (host)
120
121
  // "dialogBox": { "frame": "box.png", "slice": 8, "background": "#rrggbb", "border", "text", "name" }
121
122
  // optional (#2861): the box's 9-slice frame (≤ 512×512) and colours
123
+ // "bubble": { "frame", "slice" (default 6), "background", "border", "text", "name", "enter": "pop"|"fade"|"none" }
124
+ // optional: the reply over a head (talk "Over their head"), the same
122
125
  // "levels": { optional (#2661): the Office levels' words
123
126
  // "titles": [{ "from": 1, "name": "Intern" }, …], the title from each level up (≤ 32, `from` 0–100000
124
127
  // rising, a name 1–24 characters), in place of the page's own
@@ -136,11 +139,13 @@
136
139
  // walk, 1 for still furniture); played at `fps` (0: the first frame only — as reduced motion shows everything); (ax, ay)
137
140
  // the image point put on the position (a character's seat is where its feet are). Suggested sizes at scale 2: a
138
141
  // character 32×48, a prop 12×12, furniture as drawn. `src` is a file name in the pack: letters, digits, . _ - and /, no
139
- // "..". The check is strict: an unknown key, a value out of range or a name that refers to nothing refuses the pack,
142
+ // "..". Optional "row" and "col" (0–4095) cut the frames from a bigger sheet: frame i is the w×h cell at column col+i
143
+ // of row `row` (so several poses can share one picture, which must then be at least (col+frames)·w × (row+1)·h).
144
+ // The check is strict: an unknown key, a value out of range or a name that refers to nothing refuses the pack,
140
145
  // with where it broke.
141
146
  //
142
- // Its displayed size: w·scale × h·scale logical units, unless the strip says `dw` and/or `dh` (logical units, 1–1280 and
143
- // 1–720): its frame is then drawn dw × dh (still unsmoothed: nearest neighbour), and with only one of them the other keeps
147
+ // Its displayed size: w·scale × h·scale logical units, unless the strip says `dw` and/or `dh` (logical units, 1 to the
148
+ // canvas's width and 1 to its height): its frame is then drawn dw × dh (still unsmoothed: nearest neighbour), and with only one of them the other keeps
144
149
  // the frame's aspect. The anchor (ax, ay) stays in image pixels and moves with it. So art drawn at 120×120 px shows at
145
150
  // 96×96 with "dw": 96, "dh": 96 — whatever the pack's scale. What a person hovers or clicks is the box drawn (stripBox).
146
151
  //
@@ -150,7 +155,7 @@
150
155
  // (own()).
151
156
  //
152
157
  // The host keeps an uploaded pack whole and never changes it: every PNG starts with its signature, a STRIP's image is
153
- // exactly frames·w × h, the background and the foreground are 16:9, and each file and the pack have a size cap (web-office-skins.ts).
158
+ // exactly frames·w × h, the background and the foreground are 16:9 (or the pack's canvas's shape), and each file and the pack have a size cap (web-office-skins.ts).
154
159
  //
155
160
  // ── Layout overrides (the Office view's "Edit layout": a stored office's own positions on a zones pack) ──
156
161
  //
@@ -167,7 +172,7 @@
167
172
  // "waypoints": [{ "id": "hall", "x": 640, "y": 600 }, …], "edges": [["hall", "east"], …] }
168
173
  // the walkable graph, replaced whole (edges need waypoints)
169
174
  //
170
- // Every coordinate is on the same 1280×720 logical canvas, in the same ranges as the pack's. checkLayoutOverrides is
175
+ // Every coordinate is on the same logical canvas as the pack's (1280×720, or its own), in the same ranges. checkLayoutOverrides is
171
176
  // the shape (the host checks it on every PUT /ui/offices); applyOverrides puts them on a checked pack, refusing a
172
177
  // seat outside its area, an area or furniture the pack does not have, or a seat count that differs (the host checks
173
178
  // that too, for a pack it keeps). A night place goes on the item's `night` (its x, y), so at bedtime (nightFurniture)
@@ -176,16 +181,26 @@
176
181
  // office (#2665, web-office-store.ts).
177
182
 
178
183
  export const LOGICAL = { w: 1280, h: 720 };
184
+ /** A pack's own canvas (`canvas: [w, h]`, logical units): from CANVAS.min to CANVAS.max a side; without one, LOGICAL. */
185
+ export const CANVAS = { min: { w: 640, h: 360 }, max: { w: 5120, h: 2880 } };
186
+ /** The canvas a checked pack's scene is on: its own, else LOGICAL (every built-in style, every older pack). */
187
+ export const canvasOf = (pack) => (pack && pack.canvas) || LOGICAL;
188
+ // The canvas the manifest being checked declares (checkSkinPack), or an office's overrides are checked on
189
+ // (checkLayoutOverrides: its pack's, else CANVAS.max when the pack is not known yet; applyOverrides then keeps every
190
+ // point on the pack's own). Both checks are synchronous.
191
+ let C = LOGICAL;
192
+
179
193
  /** The people's depth: furniture below it is drawn under them, the rest over them. */
180
194
  export const CHAR_DEPTH = 1000;
181
195
  export const PACK_STATES = ["needs", "crashed", "stuck", "working", "idle", "paused", "stopped", "missing"];
182
196
  /** M-3293 (#4119): what a bubbles table may name — the states, and the Office's two reactions (a pat, a feed). */
183
197
  export const BUBBLE_KEYS = [...PACK_STATES, "pat", "feed"];
184
- const POSES = ["working", "idle", "paused", "needs", "walk", "walkDown", "walkUp", "walkSide"], PROPS = ["task", "send", "report", "broadcast"];
185
- /** A character set's strips: its poses, optional eat (M-3432 #4255) and dragged (M-3445 #4267) poses, and what its people send (#2562). */
186
- const SET_STRIPS = [...POSES, "eat", "dragged", "prop"];
198
+ const POSES = ["working", "idle", "paused", "needs", "walk", "walkDown", "walkUp", "walkSide", "walkLeft"], PROPS = ["task", "send", "report", "broadcast"];
199
+ /** A character set's strips: its poses, optional eat (M-3432 #4255), dragged (M-3445 #4267) and pat poses, a still `stand` (its card
200
+ * avatar), and what its people send (#2562). */
201
+ const SET_STRIPS = [...POSES, "eat", "dragged", "pat", "stand", "prop"];
187
202
  /** A furniture item's walking strips (#2596): a character set's walking poses. */
188
- const WALKS = ["walk", "walkDown", "walkUp", "walkSide"];
203
+ const WALKS = ["walk", "walkDown", "walkUp", "walkSide", "walkLeft"];
189
204
  const BUILT_IN = new Set(["pixel", "studio"]);
190
205
  /**
191
206
  * Ids built in after packs could be uploaded under them (#2631: "cozy"; #2947: "guild", "school"): a new upload is
@@ -212,9 +227,11 @@ export const CARD_AVATAR_SOURCES = ["sprite", "portrait"];
212
227
  export const CARD_HEADER_ALIGNS = ["left", "center"];
213
228
  export const CARD_SECTIONS = ["header", "level", "rows", "now", "tell", "actions"];
214
229
  export const CARD_ROWS = ["office", "model", "backend", "today", "firstSeen"];
230
+ /** How a pack's card pops up (card.motion.enter); "none" keeps it still. */
231
+ export const CARD_ENTERS = ["none", "fade", "pop", "rise", "slide", "bounce"];
215
232
  export const CARD_HIDE = ["instance", "title", "badge", "level", "xpBar", "office", "model", "backend", "today", "firstSeen", "now"];
216
233
  export const CARD_STYLE_COLORS = ["background", "border", "text", "muted", "accent", "barTrack", "barFill", "buttonBg", "buttonText", "buttonPrimaryBg", "buttonPrimaryText"];
217
- export const CARD_LIMITS = { widthMin: 280, widthMax: 400, sliceMax: 128, textContrast: 4.5, uiContrast: 3.0 };
234
+ export const CARD_LIMITS = { widthMin: 280, widthMax: 400, gapMax: 240, motionMsMin: 80, motionMsMax: 1200, sliceMax: 128, textContrast: 4.5, uiContrast: 3.0 };
218
235
  /** #2861: a person's account as the chat records it (`adapter:id`, web-chat-history.ts FROM). */
219
236
  const ACCOUNT = /^[^\s:]{1,64}:[^\s:]{1,128}$/;
220
237
 
@@ -233,7 +250,7 @@ function num(v, lo, hi, at) { if (typeof v !== "number" || !Number.isFinite(v) |
233
250
  function src(v, at) { if (typeof v !== "string" || !SRC.test(v) || v.includes("..") || v.startsWith("/")) throw new Refused(at, "a file name in the pack"); return v; }
234
251
  function point(v, at) {
235
252
  if (!Array.isArray(v) || v.length !== 2) throw new Refused(at, "[x, y]");
236
- return { x: num(v[0], 0, LOGICAL.w, `${at}[0]`), y: num(v[1], 0, LOGICAL.h, `${at}[1]`) };
253
+ return { x: num(v[0], 0, C.w, `${at}[0]`), y: num(v[1], 0, C.h, `${at}[1]`) };
237
254
  }
238
255
  /** Where an item sorts: by depth, a "y" one among the people (after every number under them, before the rest). */
239
256
  const order = (f) => (f.depth === "y" ? CHAR_DEPTH - 0.5 : f.depth);
@@ -270,17 +287,22 @@ export function contrastRatio(hexA, hexB) {
270
287
  */
271
288
  export function checkStrip(v, at = "strip", scale = 2) {
272
289
  obj(v, at);
273
- keys(v, ["src", "frames", "durations", "w", "h", "fps", "ax", "ay", "dw", "dh", "once", "loopFrom"], at);
290
+ keys(v, ["src", "frames", "durations", "w", "h", "fps", "ax", "ay", "dw", "dh", "once", "loopFrom", "row", "col"], at);
274
291
  const w = int(v.w, 1, 512, `${at}.w`), h = int(v.h, 1, 512, `${at}.h`);
275
- const dw0 = v.dw === undefined ? null : num(v.dw, 1, LOGICAL.w, `${at}.dw`), dh0 = v.dh === undefined ? null : num(v.dh, 1, LOGICAL.h, `${at}.dh`);
292
+ const dw0 = v.dw === undefined ? null : num(v.dw, 1, C.w, `${at}.dw`), dh0 = v.dh === undefined ? null : num(v.dh, 1, C.h, `${at}.dh`);
276
293
  const dw = dw0 ?? (dh0 !== null ? (dh0 * w) / h : w * scale), dh = dh0 ?? (dw0 !== null ? (dw0 * h) / w : h * scale);
277
294
  const ax = v.ax === undefined ? w / 2 : num(v.ax, 0, w, `${at}.ax`), ay = v.ay === undefined ? h : num(v.ay, 0, h, `${at}.ay`);
278
295
  if (v.once !== undefined && typeof v.once !== "boolean") throw new Refused(`${at}.once`, "true or false");
279
296
  const once = v.once === true;
297
+ // Sheet cells: frames start at column `col` of row `row` (w×h cells), so one picture can hold several poses. Either
298
+ // given marks the strip as cut from a larger sheet (its picture is then at least (col+frames)·w × (row+1)·h).
299
+ const row = v.row === undefined ? undefined : int(v.row, 0, 4095, `${at}.row`);
300
+ const col = v.col === undefined ? undefined : int(v.col, 0, 4095, `${at}.col`);
280
301
  let firstSrc, totalFrames, sheets = null, durations = null, fps = 4;
281
302
 
282
303
  if (v.src === undefined && Array.isArray(v.frames)) {
283
304
  // Form 3: explicit frame list [{ src, ms? }, …], each image 1 frame (w × h).
305
+ if (row !== undefined || col !== undefined) throw new Refused(`${at}.row`, "row and col need src (a sheet); a frame list has one picture per frame");
284
306
  if (v.durations !== undefined) throw new Refused(`${at}.durations`, "use ms on each entry in frames");
285
307
  const items = list(v.frames, STRIP_LIMITS.frames, `${at}.frames`);
286
308
  if (!items.length) throw new Refused(`${at}.frames`, "at least 1 frame");
@@ -348,6 +370,7 @@ export function checkStrip(v, at = "strip", scale = 2) {
348
370
 
349
371
  return {
350
372
  src: firstSrc, frames: totalFrames, w, h, fps, ax, ay, dw, dh,
373
+ ...(row !== undefined || col !== undefined ? { row: row ?? 0, col: col ?? 0 } : {}),
351
374
  ...(sheets ? { sheets } : {}),
352
375
  ...(durations ? { durations } : {}),
353
376
  ...(once ? { once: true } : {}),
@@ -358,7 +381,7 @@ export function checkStrip(v, at = "strip", scale = 2) {
358
381
  function nightOf(v, at, scale) {
359
382
  if (v === undefined) return null;
360
383
  obj(v, at); keys(v, ["sprite", "x", "y"], at);
361
- return { sprite: checkStrip(v.sprite, `${at}.sprite`, scale), x: v.x === undefined ? null : num(v.x, 0, LOGICAL.w, `${at}.x`), y: v.y === undefined ? null : num(v.y, 0, LOGICAL.h, `${at}.y`) };
384
+ return { sprite: checkStrip(v.sprite, `${at}.sprite`, scale), x: v.x === undefined ? null : num(v.x, 0, C.w, `${at}.x`), y: v.y === undefined ? null : num(v.y, 0, C.h, `${at}.y`) };
362
385
  }
363
386
  /** A furniture item's walk (#2596): its walking strips, picked by heading as a character set's (poseStrip); "walk" required. */
364
387
  function walkOf(v, at, scale) {
@@ -387,7 +410,7 @@ function seatOf(v, at, rect) {
387
410
  let p = null, extra = {};
388
411
  if (isObj(v)) {
389
412
  keys(v, ["x", "y", "for", "lend"], at);
390
- p = { x: num(v.x, 0, LOGICAL.w, `${at}.x`), y: num(v.y, 0, LOGICAL.h, `${at}.y`) };
413
+ p = { x: num(v.x, 0, C.w, `${at}.x`), y: num(v.y, 0, C.h, `${at}.y`) };
391
414
  if (v.lend !== undefined && typeof v.lend !== "boolean") throw new Refused(`${at}.lend`, "true or false");
392
415
  if (v.lend !== undefined && v.for === undefined) throw new Refused(`${at}.lend`, "only with for");
393
416
  if (v.for !== undefined) extra = { for: owners(v.for, `${at}.for`), lend: v.lend === true };
@@ -505,13 +528,29 @@ function portraitsOf(v, fids) {
505
528
  function dialogBoxOf(v) {
506
529
  if (v === undefined) return null;
507
530
  obj(v, "dialogBox");
508
- keys(v, ["frame", "slice", "background", "border", "text", "name"], "dialogBox");
509
- if (v.slice !== undefined && v.frame === undefined) throw new Refused("dialogBox.slice", "only with frame");
531
+ keys(v, ["frame", "slice", "background", "border", "text", "name", "bubble"], "dialogBox");
532
+ const out = boxLookOf(v, "dialogBox", 8);
533
+ if (v.bubble !== undefined) {
534
+ // The reply over a head (the Office's "Over their head" talk): the same look, and how it comes in.
535
+ obj(v.bubble, "dialogBox.bubble");
536
+ keys(v.bubble, ["frame", "slice", "background", "border", "text", "name", "enter"], "dialogBox.bubble");
537
+ out.bubble = boxLookOf(v.bubble, "dialogBox.bubble", 6);
538
+ if (v.bubble.enter !== undefined) {
539
+ if (!BUBBLE_ENTER.includes(v.bubble.enter)) throw new Refused("dialogBox.bubble.enter", `one of ${BUBBLE_ENTER.join(", ")}`);
540
+ out.bubble.enter = v.bubble.enter;
541
+ }
542
+ }
543
+ return out;
544
+ }
545
+ const BUBBLE_ENTER = ["pop", "fade", "none"];
546
+ /** A box's 9-slice frame (`slice` image px a side, else `slice0`) and colours (#rrggbb). */
547
+ function boxLookOf(v, at, slice0) {
548
+ if (v.slice !== undefined && v.frame === undefined) throw new Refused(`${at}.slice`, "only with frame");
510
549
  const out = {};
511
- if (v.frame !== undefined) { out.frame = src(v.frame, "dialogBox.frame"); out.slice = v.slice === undefined ? 8 : int(v.slice, 1, LIMIT.slice, "dialogBox.slice"); }
550
+ if (v.frame !== undefined) { out.frame = src(v.frame, `${at}.frame`); out.slice = v.slice === undefined ? slice0 : int(v.slice, 1, LIMIT.slice, `${at}.slice`); }
512
551
  for (const k of ["background", "border", "text", "name"]) {
513
552
  if (v[k] === undefined) continue;
514
- if (!matteOk(v[k])) throw new Refused(`dialogBox.${k}`, "a colour as #rrggbb");
553
+ if (!matteOk(v[k])) throw new Refused(`${at}.${k}`, "a colour as #rrggbb");
515
554
  out[k] = v[k].toLowerCase();
516
555
  }
517
556
  return out;
@@ -536,7 +575,7 @@ function uniqueEnumList(v, allowed, at) {
536
575
  function cardOf(v) {
537
576
  if (v === undefined) return null;
538
577
  obj(v, "card");
539
- keys(v, ["preset", "style", "layout"], "card");
578
+ keys(v, ["preset", "style", "layout", "motion"], "card");
540
579
  const out = {};
541
580
  if (v.preset !== undefined) {
542
581
  if (typeof v.preset !== "string" || !CARD_PRESETS.includes(v.preset)) throw new Refused("card.preset", `one of ${CARD_PRESETS.join(", ")}`);
@@ -580,7 +619,7 @@ function cardOf(v) {
580
619
  }
581
620
  if (v.layout !== undefined) {
582
621
  const l = obj(v.layout, "card.layout");
583
- keys(l, ["avatarSize", "avatarSource", "headerAlign", "width", "sections", "rows", "rowColumns", "hide"], "card.layout");
622
+ keys(l, ["avatarSize", "avatarSource", "headerAlign", "width", "gap", "sections", "rows", "rowColumns", "hide"], "card.layout");
584
623
  const ly = {};
585
624
  if (l.avatarSize !== undefined) {
586
625
  if (typeof l.avatarSize !== "string" || !CARD_AVATAR_SIZES.includes(l.avatarSize)) throw new Refused("card.layout.avatarSize", `one of ${CARD_AVATAR_SIZES.join(", ")}`);
@@ -595,6 +634,8 @@ function cardOf(v) {
595
634
  ly.headerAlign = l.headerAlign;
596
635
  }
597
636
  if (l.width !== undefined) ly.width = int(l.width, CARD_LIMITS.widthMin, CARD_LIMITS.widthMax, "card.layout.width");
637
+ // How far (CSS px) the floating card opens from its person, beside the person's own half-width; the page's is 12.
638
+ if (l.gap !== undefined) ly.gap = int(l.gap, 0, CARD_LIMITS.gapMax, "card.layout.gap");
598
639
  if (l.sections !== undefined) {
599
640
  const secs = uniqueEnumList(l.sections, CARD_SECTIONS, "card.layout.sections");
600
641
  if (!secs.includes("header") || !secs.includes("actions")) throw new Refused("card.layout.sections", 'must include "header" and "actions"');
@@ -608,6 +649,12 @@ function cardOf(v) {
608
649
  if (l.hide !== undefined) ly.hide = uniqueEnumList(l.hide, CARD_HIDE, "card.layout.hide");
609
650
  out.layout = ly;
610
651
  }
652
+ if (v.motion !== undefined) {
653
+ const mo = obj(v.motion, "card.motion");
654
+ keys(mo, ["enter", "ms"], "card.motion");
655
+ if (typeof mo.enter !== "string" || !CARD_ENTERS.includes(mo.enter)) throw new Refused("card.motion.enter", `one of ${CARD_ENTERS.join(", ")}`);
656
+ out.motion = { enter: mo.enter, ms: mo.ms === undefined ? 220 : int(mo.ms, CARD_LIMITS.motionMsMin, CARD_LIMITS.motionMsMax, "card.motion.ms") };
657
+ }
611
658
  return out;
612
659
  }
613
660
 
@@ -695,11 +742,17 @@ export function checkLevels(v) {
695
742
  export function checkSkinPack(x, { kept = false } = {}) {
696
743
  try {
697
744
  obj(x, "pack");
698
- keys(x, ["format", "id", "scale", "background", "foreground", "matte", "areas", "stateZones", "door", "mailDrop", "waypoints", "edges", "straight", "furniture", "characters", "byInstance", "props", "bubbles", "bubblesByInstance", "room", "desk", "levels", "portraits", "dialogBox", "idleVisits", "snacks", "card"], "pack");
745
+ keys(x, ["format", "id", "scale", "canvas", "background", "foreground", "matte", "areas", "stateZones", "door", "mailDrop", "waypoints", "edges", "straight", "furniture", "characters", "byInstance", "props", "bubbles", "bubblesByInstance", "room", "desk", "levels", "portraits", "dialogBox", "idleVisits", "snacks", "card"], "pack");
699
746
  if (x.format !== 1) throw new Refused("format", "1");
700
747
  if (typeof x.id !== "string" || !ID.test(x.id)) throw new Refused("id", "1–40 letters, digits, _ or -");
701
748
  if (BUILT_IN.has(x.id) || (!kept && RESERVED.has(x.id))) throw new Refused("id", "a built-in skin's id");
702
749
  const scale = x.scale === undefined ? 2 : int(x.scale, 1, 8, "scale");
750
+ let canvas = null;
751
+ if (x.canvas !== undefined) {
752
+ if (!Array.isArray(x.canvas) || x.canvas.length !== 2) throw new Refused("canvas", "[w, h]");
753
+ canvas = { w: int(x.canvas[0], CANVAS.min.w, CANVAS.max.w, "canvas[0]"), h: int(x.canvas[1], CANVAS.min.h, CANVAS.max.h, "canvas[1]") };
754
+ }
755
+ C = canvas || LOGICAL;
703
756
  if (x.matte !== undefined && !matteOk(x.matte)) throw new Refused("matte", "a colour as #rrggbb");
704
757
  if (x.straight !== undefined && typeof x.straight !== "boolean") throw new Refused("straight", "true or false");
705
758
  const areas = {};
@@ -710,8 +763,8 @@ export function checkSkinPack(x, { kept = false } = {}) {
710
763
  if (!nameOk(name)) throw new Refused(at, "a name of letters, digits, _ or - (not an inherited one)");
711
764
  obj(a, at); keys(a, ["rect", "seats"], at);
712
765
  if (!Array.isArray(a.rect) || a.rect.length !== 4) throw new Refused(`${at}.rect`, "[x, y, w, h]");
713
- const [rx, ry] = [num(a.rect[0], 0, LOGICAL.w, `${at}.rect[0]`), num(a.rect[1], 0, LOGICAL.h, `${at}.rect[1]`)];
714
- const rect = { x: rx, y: ry, w: num(a.rect[2], 1, LOGICAL.w - rx, `${at}.rect[2]`), h: num(a.rect[3], 1, LOGICAL.h - ry, `${at}.rect[3]`) };
766
+ const [rx, ry] = [num(a.rect[0], 0, C.w, `${at}.rect[0]`), num(a.rect[1], 0, C.h, `${at}.rect[1]`)];
767
+ const rect = { x: rx, y: ry, w: num(a.rect[2], 1, C.w - rx, `${at}.rect[2]`), h: num(a.rect[3], 1, C.h - ry, `${at}.rect[3]`) };
715
768
  const seats = list(a.seats, LIMIT.seats, `${at}.seats`).map((s, i) => seatOf(s, `${at}.seats[${i}]`, rect));
716
769
  if (!seats.length) throw new Refused(`${at}.seats`, "at least one seat");
717
770
  areas[name] = { name, rect, seats };
@@ -737,7 +790,7 @@ export function checkSkinPack(x, { kept = false } = {}) {
737
790
  obj(w, at); keys(w, ["id", "x", "y"], at);
738
791
  if (typeof w.id !== "string" || !ID.test(w.id) || ids.has(w.id)) throw new Refused(`${at}.id`, "a new name of letters, digits, _ or -");
739
792
  ids.add(w.id);
740
- waypoints.push({ id: w.id, x: num(w.x, 0, LOGICAL.w, `${at}.x`), y: num(w.y, 0, LOGICAL.h, `${at}.y`) });
793
+ waypoints.push({ id: w.id, x: num(w.x, 0, C.w, `${at}.x`), y: num(w.y, 0, C.h, `${at}.y`) });
741
794
  }
742
795
  const edges = list(x.edges ?? [], LIMIT.edges, "edges").map((e, i) => {
743
796
  if (!Array.isArray(e) || e.length !== 2 || !ids.has(e[0]) || !ids.has(e[1]) || e[0] === e[1]) throw new Refused(`edges[${i}]`, "two different waypoint ids");
@@ -757,7 +810,7 @@ export function checkSkinPack(x, { kept = false } = {}) {
757
810
  if (f.hides !== undefined && typeof f.hides !== "boolean") throw new Refused(`${at}.hides`, "true or false");
758
811
  if (f.hides !== undefined && f.activeFor === undefined) throw new Refused(`${at}.hides`, "only with activeFor");
759
812
  if (f.label !== undefined && (typeof f.label !== "string" || !f.label.trim() || [...f.label].length > LIMIT.line || /[\u0000-\u001f\u007f]/.test(f.label))) throw new Refused(`${at}.label`, `1–${LIMIT.line} characters`);
760
- return { id: f.id, sprite: checkStrip(f.sprite, `${at}.sprite`, scale), x: num(f.x, 0, LOGICAL.w, `${at}.x`), y: num(f.y, 0, LOGICAL.h, `${at}.y`),
813
+ return { id: f.id, sprite: checkStrip(f.sprite, `${at}.sprite`, scale), x: num(f.x, 0, C.w, `${at}.x`), y: num(f.y, 0, C.h, `${at}.y`),
761
814
  depth: f.depth === "y" ? "y" : depth(f.depth ?? 0, `${at}.depth`), activeWhen: f.activeWhen === undefined ? null : states(f.activeWhen, `${at}.activeWhen`),
762
815
  activeSprite: f.activeSprite === undefined ? null : checkStrip(f.activeSprite, `${at}.activeSprite`, scale),
763
816
  activeFor: f.activeFor === undefined ? null : names(f.activeFor, `${at}.activeFor`), loop: f.loop === true,
@@ -801,8 +854,8 @@ export function checkSkinPack(x, { kept = false } = {}) {
801
854
  keys(room, ["floor", "wall"], "room"); keys(desk, ["back", "front", "lit"], "desk");
802
855
  const opt = (v, at) => (v === undefined ? undefined : src(v, at));
803
856
  return { ok: true, pack: {
804
- format: 1, id: x.id, scale, background: opt(x.background, "background"), foreground: opt(x.foreground, "foreground"), matte: x.matte === undefined ? undefined : x.matte.toLowerCase(), areas, stateZones,
805
- door: x.door === undefined ? { x: LOGICAL.w / 2, y: LOGICAL.h - 10 } : point(x.door, "door"),
857
+ format: 1, id: x.id, scale, ...(canvas ? { canvas } : {}), background: opt(x.background, "background"), foreground: opt(x.foreground, "foreground"), matte: x.matte === undefined ? undefined : x.matte.toLowerCase(), areas, stateZones,
858
+ door: x.door === undefined ? { x: C.w / 2, y: C.h - 10 } : point(x.door, "door"),
806
859
  mailDrop: x.mailDrop === undefined ? null : point(x.mailDrop, "mailDrop"), waypoints, edges, straight: x.straight === true, furniture, characters, byInstance,
807
860
  props: x.props === undefined ? {} : strips(x.props, PROPS, "props", scale), bubbles,
808
861
  // #3681: only when the pack has them, so an older pack checks to exactly what it did.
@@ -815,6 +868,8 @@ export function checkSkinPack(x, { kept = false } = {}) {
815
868
  } catch (err) {
816
869
  if (err instanceof Refused) return { ok: false, error: err.message };
817
870
  throw err;
871
+ } finally {
872
+ C = LOGICAL;
818
873
  }
819
874
  }
820
875
  /** The checked pack, or null. */
@@ -823,7 +878,7 @@ export const skinPackOk = (x) => { const r = checkSkinPack(x); return r.ok ? r.p
823
878
  export const packPortraitImages = (pack) => {
824
879
  const p = pack.portraits, all = p ? [p.default, ...Object.values(p.byInstance), ...Object.values(p.byUser), ...Object.values(p.npc)] : [];
825
880
  const cs = pack.card && pack.card.style;
826
- return [...new Set([...all.flatMap((e) => (e ? Object.values(e) : [])), pack.dialogBox && pack.dialogBox.frame, cs && cs.backgroundImage, cs && cs.frame].filter(Boolean))];
881
+ return [...new Set([...all.flatMap((e) => (e ? Object.values(e) : [])), pack.dialogBox && pack.dialogBox.frame, pack.dialogBox && pack.dialogBox.bubble && pack.dialogBox.bubble.frame, cs && cs.backgroundImage, cs && cs.frame].filter(Boolean))];
827
882
  };
828
883
  /** The sheets a strip draws from, in order: `[{ src, frames }]` (single-sheet strips have one entry). */
829
884
  export const stripSheets = (st) => (st && Array.isArray(st.sheets) ? st.sheets : st && st.src ? [{ src: st.src, frames: st.frames }] : []);
@@ -866,7 +921,8 @@ const reservedOf = (s) => (s.for && s.for.length ? { for: [...s.for], lend: s.le
866
921
  /** A seat with reservation `r` ({ for, lend }; for [] or null: none) in place of its own. */
867
922
  const reserve = (s, r) => { const { for: _f, lend: _l, ...p } = s; return r && r.for.length ? { ...p, for: [...r.for], lend: r.lend === true } : p; };
868
923
  /** An office's layout overrides, strictly (their shape and ranges): { ok: true, overrides } or { ok: false, error }. */
869
- export function checkLayoutOverrides(x) {
924
+ export function checkLayoutOverrides(x, canvas = LOGICAL) {
925
+ C = canvas;
870
926
  try {
871
927
  obj(x, "overrides");
872
928
  keys(x, ["pack", "seats", "furniture", "furnitureNight", "seatFor", "door", "mailDrop", "waypoints", "edges"], "overrides");
@@ -934,7 +990,7 @@ export function checkLayoutOverrides(x) {
934
990
  obj(w, at); keys(w, ["id", "x", "y"], at);
935
991
  if (typeof w.id !== "string" || !ID.test(w.id) || ids.has(w.id)) throw new Refused(`${at}.id`, "a new name of letters, digits, _ or -");
936
992
  ids.add(w.id);
937
- return { id: w.id, x: num(w.x, 0, LOGICAL.w, `${at}.x`), y: num(w.y, 0, LOGICAL.h, `${at}.y`) };
993
+ return { id: w.id, x: num(w.x, 0, C.w, `${at}.x`), y: num(w.y, 0, C.h, `${at}.y`) };
938
994
  });
939
995
  const seen = new Set();
940
996
  out.edges = list(x.edges ?? [], OV_LIMIT.edges, "overrides.edges").map((e, i) => {
@@ -949,6 +1005,8 @@ export function checkLayoutOverrides(x) {
949
1005
  } catch (err) {
950
1006
  if (err instanceof Refused) return { ok: false, error: err.message };
951
1007
  throw err;
1008
+ } finally {
1009
+ C = LOGICAL;
952
1010
  }
953
1011
  }
954
1012
 
@@ -985,6 +1043,12 @@ export function applyOverrides(pack, ov) {
985
1043
  if (!q && !n) return f;
986
1044
  return { ...f, ...(q ? { x: q[0], y: q[1] } : {}), ...(n ? { night: { ...f.night, x: n[0], y: n[1] } } : {}) };
987
1045
  });
1046
+ // Every point on the pack's own canvas (overrides checked before their pack was known were held to the largest).
1047
+ const cv = canvasOf(pack), on = (q, at) => { if (q && (q[0] > cv.w || q[1] > cv.h)) throw new Refused(at, `a point on the canvas (${cv.w}×${cv.h})`); };
1048
+ for (const [id, q] of Object.entries(ov.furniture || {})) on(q, `overrides.furniture.${id}`);
1049
+ for (const [id, q] of Object.entries(ov.furnitureNight || {})) on(q, `overrides.furnitureNight.${id}`);
1050
+ on(ov.door, "overrides.door"); on(ov.mailDrop, "overrides.mailDrop");
1051
+ for (const [i, w] of (ov.waypoints || []).entries()) on([w.x, w.y], `overrides.waypoints[${i}]`);
988
1052
  const door = ov.door ? { x: ov.door[0], y: ov.door[1] } : pack.door;
989
1053
  const mailDrop = ov.mailDrop ? { x: ov.mailDrop[0], y: ov.mailDrop[1] } : pack.mailDrop ?? null;
990
1054
  const graph = ov.waypoints ? { waypoints: ov.waypoints.map((w) => ({ ...w })), edges: (ov.edges || []).map((e) => [e[0], e[1]]) } : { waypoints: pack.waypoints, edges: pack.edges };
@@ -1068,8 +1132,8 @@ export function overridesBetween(pack, edited) {
1068
1132
 
1069
1133
  /**
1070
1134
  * The strip a character set shows for `pose` (heading: the current step { dx, dy }, while walking): { strip, mirror }, or
1071
- * null (no set). Walking: |dy| > |dx| → walkDown (dy > 0) or walkUp, else walkSide (mirror: moving left); a missing one
1072
- * → "walk" (never mirrored) → idle. Any other pose: its own strip, else idle.
1135
+ * null (no set). Walking: |dy| > |dx| → walkDown (dy > 0) or walkUp, else walkSide (moving left: the set's own walkLeft,
1136
+ * else walkSide mirrored); a missing one → "walk" (never mirrored) → idle. Any other pose: its own strip, else idle.
1073
1137
  */
1074
1138
  export function poseStrip(set, pose, heading = null) {
1075
1139
  if (!set || typeof set !== "object") return null;
@@ -1077,6 +1141,8 @@ export function poseStrip(set, pose, heading = null) {
1077
1141
  const dx = Number(heading.dx) || 0, dy = Number(heading.dy) || 0;
1078
1142
  if (dx || dy) {
1079
1143
  const dir = Math.abs(dy) > Math.abs(dx) ? (dy > 0 ? "walkDown" : "walkUp") : "walkSide";
1144
+ const left = dir === "walkSide" && dx < 0 ? own(set, "walkLeft") : null;
1145
+ if (left) return { strip: left, mirror: false };
1080
1146
  const st = own(set, dir);
1081
1147
  if (st) return { strip: st, mirror: dir === "walkSide" && dx < 0 };
1082
1148
  }
@@ -1161,10 +1227,12 @@ export function stripFrameAt(st, ms) {
1161
1227
  /** Which image (`src`) and horizontal frame column (`col`) hold global frame index `frame` of `st`. */
1162
1228
  export function stripCell(st, frame) {
1163
1229
  const f = Math.max(0, Math.min((st && st.frames ? st.frames : 1) - 1, Math.floor(Number(frame) || 0)));
1164
- if (!st || !Array.isArray(st.sheets)) return { src: st ? st.src : "", col: f };
1230
+ // A strip cut from a sheet (row/col) also says its row; a classic strip's cell keeps its { src, col } shape.
1231
+ const cut = !!st && (st.row !== undefined || st.col !== undefined), c0 = cut ? st.col || 0 : 0, at = cut ? { row: st.row || 0 } : {};
1232
+ if (!st || !Array.isArray(st.sheets)) return { src: st ? st.src : "", col: c0 + f, ...at };
1165
1233
  const { sheets, starts, ends } = sheetIndex(st);
1166
1234
  const i = upperBound(ends, f);
1167
- return { src: sheets[i].src, col: f - starts[i] };
1235
+ return { src: sheets[i].src, col: c0 + f - starts[i], ...at };
1168
1236
  }
1169
1237
 
1170
1238
  /** The highest frame rate (frames/s) a strip needs for smooth playback; 0 when static. */
@@ -105,9 +105,15 @@ export function reactionAt(r, t, lang = "en") {
105
105
  return { f, hearts, say: reactWords(r.kind, lang) };
106
106
  }
107
107
 
108
- /** Reactions still showing at `t` (a Map name → { kind, t0 }), the rest dropped; whether any is left. */
108
+ /** The look while a pat `r` shows at `t` (its own clip, so each pat plays from frame 0), or null. */
109
+ export function patLook(posed, r, t) {
110
+ if (!r || r.kind !== "pat" || t < r.t0 || t >= (r.until ?? r.t0 + PLAY.REACT_MS)) return null;
111
+ return { ...posed, pose: "pat", basePose: posed.pose, clip: `#pat${r.t0}` };
112
+ }
113
+
114
+ /** Reactions still showing at `t` (a Map name → { kind, t0, until? }; `until`: a pat strip's end), the rest dropped; whether any is left. */
109
115
  export function pruneReactions(map, t) {
110
- for (const [n, r] of [...map]) if (t - r.t0 >= PLAY.REACT_MS || t < r.t0) map.delete(n);
116
+ for (const [n, r] of [...map]) if (t >= (r.until ?? r.t0 + PLAY.REACT_MS) || t < r.t0) map.delete(n);
111
117
  return map.size > 0;
112
118
  }
113
119
 
@@ -186,8 +192,9 @@ export function createSnacks() {
186
192
  feed,
187
193
  place(snack, at, t, ctx = {}) {
188
194
  if (!snack || !at) return null;
189
- const x = Math.max(16, Math.min(LOGICAL.w - 16, Math.round(at.x)));
190
- const y = Math.max(16, Math.min(LOGICAL.h - 16, Math.round(at.y)));
195
+ const cw = (ctx.graph && ctx.graph.width) || LOGICAL.w, ch = (ctx.graph && ctx.graph.height) || LOGICAL.h;
196
+ const x = Math.max(16, Math.min(cw - 16, Math.round(at.x)));
197
+ const y = Math.max(16, Math.min(ch - 16, Math.round(at.y)));
191
198
  while (placed.length >= SNACK.MAX_PLACED) placed.shift();
192
199
  const item = {
193
200
  id: `sn-${++seq}`,
@@ -24,9 +24,9 @@
24
24
  // @property {(ctx, room, env) => void} drawRoom desks: a room's floor, wall and name (room: autoLayout's)
25
25
  // @property {(ctx, desk, look, env) => void} drawDeskBack desks: behind the character — chair, desk top, screen, lamp
26
26
  // @property {(ctx, desk, look, env) => void} drawDeskFront desks: in front — the desk's front, its sign, folders, name tag
27
- // @property {(ctx, L, env) => void} [drawBackground] zones: the whole 1280×720 background, areas and their names
27
+ // @property {(ctx, L, env) => void} [drawBackground] zones: the whole canvas's background (1280×720, or a pack's own), areas and their names
28
28
  // @property {(ctx, item, active, ms, env) => void} [drawFurniture] zones: one furniture item (active: activeWhen holds)
29
- // @property {(ctx, L, env) => void} [drawForeground] zones: a pack's foreground over the whole 1280×720 scene, above
29
+ // @property {(ctx, L, env) => void} [drawForeground] zones: a pack's foreground over the whole scene (its canvas), above
30
30
  // the people, furniture and items in the air, below the crowd counts, name tags and bubbles
31
31
  // @property {(ctx, x, y, look, env, compact?) => void} [drawTag] zones: a name tag under feet at (x, y) (compact: #2860)
32
32
  // @property {(ctx, area, n, env) => void} [drawCrowd] zones: an area's "+n" (who found no spot in it)
@@ -47,7 +47,7 @@
47
47
  // among them by base y), then the foreground, then the crowd counts, tags and bubbles.
48
48
  import { t } from "/assets/app-i18n.js";
49
49
  import { frameAt, nameHash } from "./fleet-office-model.js";
50
- import { CHAR_DEPTH, LOGICAL, checkSkinPack, own, packPortraitImages, packSceneImages, poseStrip, stripBox, stripCell, stripFrameAt, stripImages, walkStrip } from "./fleet-office-pack.js";
50
+ import { CHAR_DEPTH, LOGICAL, canvasOf, checkSkinPack, own, packPortraitImages, packSceneImages, poseStrip, stripBox, stripCell, stripFrameAt, stripImages, walkStrip } from "./fleet-office-pack.js";
51
51
  import { tierColours } from "./fleet-office-levels.js";
52
52
  import { assetUrl } from "/assets/asset-url.js";
53
53
 
@@ -197,6 +197,7 @@ export function draggedMotion(ms) {
197
197
 
198
198
  function drawCharacter(ctx, d, look, ms, env) {
199
199
  if (look.pose === "away") return;
200
+ if (look.pose === "stand") look = { ...look, pose: "idle" }; // the card's still avatar: the pixel figure has only idle
200
201
  const h = nameHash(look.name), skin = SKIN_TONES[h % SKIN_TONES.length], hair = HAIR[(h >>> 3) % HAIR.length];
201
202
  const coat = look.coat, shirt = "#f4f1ea", eye = "#1d1d22";
202
203
  const f = frameAt(ms, FRAMES[look.pose] || 1, FPS);
@@ -525,7 +526,7 @@ const ZONE_FLOOR = {
525
526
  };
526
527
  function drawBackground(ctx, L, env) {
527
528
  const { pal } = env, F = ZONE_FLOOR[env.mode], T = 24;
528
- px(ctx, 0, 0, LOGICAL.w, LOGICAL.h, F.hall);
529
+ px(ctx, 0, 0, L.width || LOGICAL.w, L.height || LOGICAL.h, F.hall); // #4405: the whole canvas, a pack's own too (its picture not loaded)
529
530
  for (const a of Object.values(L.areas)) {
530
531
  const [c1, c2] = F[a.name] || F.desks, r = a.rect;
531
532
  px(ctx, r.x, r.y, r.w, r.h, c1);
@@ -669,8 +670,8 @@ export function spriteSkin(pack, images, base = pixelSkin) {
669
670
  const b = stripBox(st, x, y, mirror);
670
671
  ctx.save();
671
672
  ctx.imageSmoothingEnabled = false;
672
- if (mirror) { ctx.translate(b.x + b.w, b.y); ctx.scale(-1, 1); ctx.drawImage(im, cell.col * st.w, 0, st.w, st.h, 0, 0, b.w, b.h); }
673
- else ctx.drawImage(im, cell.col * st.w, 0, st.w, st.h, b.x, b.y, b.w, b.h);
673
+ if (mirror) { ctx.translate(b.x + b.w, b.y); ctx.scale(-1, 1); ctx.drawImage(im, cell.col * st.w, (cell.row || 0) * st.h, st.w, st.h, 0, 0, b.w, b.h); }
674
+ else ctx.drawImage(im, cell.col * st.w, (cell.row || 0) * st.h, st.w, st.h, b.x, b.y, b.w, b.h);
674
675
  ctx.restore();
675
676
  return true;
676
677
  };
@@ -685,6 +686,11 @@ export function spriteSkin(pack, images, base = pixelSkin) {
685
686
  const st = own(setOf({ name }) || {}, "dragged") || own(own(pack.characters, "default") || {}, "dragged") || null;
686
687
  return st && ready(st) ? st : null;
687
688
  };
689
+ /** Pat strip for `name` (their set's `pat`, else `default.pat`, else null): shown while a pat's hearts show. */
690
+ const patStripOf = (name) => {
691
+ const st = own(setOf({ name }) || {}, "pat") || own(own(pack.characters, "default") || {}, "pat") || null;
692
+ return st && ready(st) ? st : null;
693
+ };
688
694
  /** The strip a look shows (its pose; walking, by its heading), when all its pictures are loaded. */
689
695
  const shown = (look, walking = look.pose === "walk") => {
690
696
  if (!walking && look.pose === "dragged") {
@@ -693,6 +699,12 @@ export function spriteSkin(pack, images, base = pixelSkin) {
693
699
  const fallback = poseStrip(setOf(look), look.basePose || "idle", look.heading);
694
700
  return fallback && ready(fallback.strip) ? { ...fallback, customDragged: false } : null;
695
701
  }
702
+ if (!walking && look.pose === "pat") {
703
+ const patSt = patStripOf(look.name);
704
+ if (patSt) return { strip: patSt, mirror: false };
705
+ const fallback = poseStrip(setOf(look), look.basePose || "idle", look.heading);
706
+ return fallback && ready(fallback.strip) ? fallback : null;
707
+ }
696
708
  if (!walking && look.pose === "eat") {
697
709
  const eatSt = eatStripOf(look.name);
698
710
  if (eatSt) return { strip: eatSt, mirror: false };
@@ -733,12 +745,12 @@ export function spriteSkin(pack, images, base = pixelSkin) {
733
745
  drawBackground(ctx, L, env) {
734
746
  const im = img(pack.background);
735
747
  if (!im) { drawBackground(ctx, L, env); return; }
736
- ctx.save(); ctx.imageSmoothingEnabled = false; ctx.drawImage(im, 0, 0, LOGICAL.w, LOGICAL.h); ctx.restore();
748
+ ctx.save(); ctx.imageSmoothingEnabled = false; ctx.drawImage(im, 0, 0, canvasOf(pack).w, canvasOf(pack).h); ctx.restore();
737
749
  },
738
750
  drawForeground(ctx, L, env) {
739
751
  const im = img(pack.foreground);
740
752
  if (!im) return;
741
- ctx.save(); ctx.imageSmoothingEnabled = false; ctx.drawImage(im, 0, 0, LOGICAL.w, LOGICAL.h); ctx.restore();
753
+ ctx.save(); ctx.imageSmoothingEnabled = false; ctx.drawImage(im, 0, 0, canvasOf(pack).w, canvasOf(pack).h); ctx.restore();
742
754
  },
743
755
  drawFurniture(ctx, f, active, ms, env) {
744
756
  if (f.shape) { drawFurniture(ctx, f, active, ms, env); return; }
@@ -755,7 +767,7 @@ export function spriteSkin(pack, images, base = pixelSkin) {
755
767
  const ps = shown(look);
756
768
  ctx.save();
757
769
  if (look.dim) ctx.globalAlpha = 0.35;
758
- const cms = ps ? clipMs(env, `c:${look.name || (d && d.key) || ""}`, ps.strip, ms) : ms;
770
+ const cms = ps ? clipMs(env, `c:${look.name || (d && d.key) || ""}${look.clip || ""}`, ps.strip, ms) : ms;
759
771
  let done = false;
760
772
  if (ps && look.pose === "dragged") {
761
773
  // M-3445 (#4267): ground shadow under feet; custom `dragged` strip plays as authored, otherwise built-in lifted dangle.
@@ -779,12 +791,14 @@ export function spriteSkin(pack, images, base = pixelSkin) {
779
791
  done = !!ps && strip(ctx, ps.strip, cms, d.seat.x, d.seat.y, null, ps.mirror);
780
792
  }
781
793
  ctx.restore();
782
- if (!done) base.drawCharacter(ctx, d, look.pose === "eat" ? { ...look, pose: look.basePose || "idle" } : look, ms, env);
794
+ if (!done) base.drawCharacter(ctx, d, look.pose === "eat" || look.pose === "pat" ? { ...look, pose: look.basePose || "idle" } : look.pose === "stand" ? { ...look, pose: "idle" } : look, ms, env);
783
795
  },
784
796
  /** M-3432 (#4255): character's eating strip (set.eat → default.eat → null) when loaded. */
785
797
  eatStrip: eatStripOf,
786
798
  /** M-3445 (#4267): character's dragged strip (set.dragged → default.dragged → null) when loaded. */
787
799
  draggedStrip: draggedStripOf,
800
+ /** Character's pat strip (set.pat → default.pat → null) when loaded. */
801
+ patStrip: patStripOf,
788
802
  /** M-3432 (#4255): draw a snack strip (placed on floor or eat overlay) at logical (x, y). */
789
803
  drawSnack(ctx, st, ms, x, y, env, clipKey = null) {
790
804
  if (!st || !ready(st)) return false;
@@ -802,7 +816,7 @@ export function spriteSkin(pack, images, base = pixelSkin) {
802
816
  const dx = Math.round((size - dw) / 2), dy = Math.round((size - dh) / 2);
803
817
  ctx.save();
804
818
  ctx.imageSmoothingEnabled = false;
805
- ctx.drawImage(im, cell.col * st.w, 0, st.w, st.h, dx, dy, dw, dh);
819
+ ctx.drawImage(im, cell.col * st.w, (cell.row || 0) * st.h, st.w, st.h, dx, dy, dw, dh);
806
820
  ctx.restore();
807
821
  return true;
808
822
  },
@@ -969,6 +983,22 @@ export function loadBuiltInSkin(id, { image = defaultImage } = {}) {
969
983
  }, () => { p.job = null; return null; });
970
984
  return p.job;
971
985
  }
986
+ /**
987
+ * M-3533 R2c: a style with some people drawn in their own characters (a Hub room office: each agent's set from its owner's
988
+ * pack, hub-character-plan.ts). `sets`: name → { pose: strip } (strips as a checked pack's, each a single sheet);
989
+ * `images`: src → a loaded picture. Only the drawing of people changes — the style's scene, desks, tags and words are its
990
+ * own. Someone without a set, or whose set is not wholly loaded, is the style's figure. Set ids are made here, so a name
991
+ * (even "default") never becomes everyone's fallback.
992
+ */
993
+ export function withCharacters(base, sets, images) {
994
+ const names = sets ? Object.keys(sets) : [];
995
+ if (!names.length) return base;
996
+ const characters = Object.create(null), byInstance = Object.create(null);
997
+ names.forEach((name, i) => { characters[`set${i}`] = sets[name]; byInstance[name] = `set${i}`; });
998
+ const sk = spriteSkin({ id: base.id, characters, byInstance, props: {}, room: {}, desk: {} }, images, base);
999
+ // `ownCharacters`: the scene keeps their speech bubbles inside their area (a taller character's would rise above it).
1000
+ return { ...base, drawCharacter: sk.drawCharacter, charBox: sk.charBox, ownCharacters: true };
1001
+ }
972
1002
  /** #2631: the cozy's picture (loadBuiltInSkin for "cozy"). */
973
1003
  export const loadCozySkin = (opts = {}) => loadBuiltInSkin("cozy", opts);
974
1004
  /** A skin by id: a built-in one, else a pack loaded here (`packs`: id → skin), else the default (pixel). */
@@ -33,6 +33,8 @@ const LOBBY_KEY = "agend_org_office_lobby";
33
33
  const KEY_OPEN_KEY = "agend_org_office_key";
34
34
  /** #2861: whether the dialogue box shows here (default: off — nothing changes until a person ticks it). */
35
35
  const DIALOGUE_KEY = "agend_org_office_dialogue";
36
+ const TALK_KEY = "agend_org_office_talk";
37
+ const TALK_READ_KEY = "agend_org_office_talk_read";
36
38
  /** #4010: { ids, interval } — the offices in the carousel and the seconds each is shown (playing is not kept). */
37
39
  const CAROUSEL_KEY = "agend_org_office_carousel";
38
40
  /** #2540: { "<office>@<style>": [k, cx, cy] (and a 1 after them: a fit) } — the last VIEWS_MAX views, the most recent last. */
@@ -221,7 +223,8 @@ export function createOfficeStore({ fetch: get = globalThis.fetch, storage } = {
221
223
  * #2554's All offices (fleet-office-overview.js ALL_ID; with fewer than two offices stored: the auto office), or
222
224
  * #4010's carousel (fleet-office-carousel.js CAROUSEL_ID; with fewer than two ticked: the whole fleet).
223
225
  */
224
- choice: () => { const v = read(CHOICE_KEY); return typeof v === "string" && v && v.length <= 40 ? v : AUTO_ID; },
226
+ /** The office picked here, else `none` (by default the whole fleet's). */
227
+ choice: (none = AUTO_ID) => { const v = read(CHOICE_KEY); return typeof v === "string" && v && v.length <= 40 ? v : none; },
225
228
  saveChoice: (id) => write(CHOICE_KEY, String(id)),
226
229
  /** #4010: this browser's carousel pick ({ ids, interval }), or null (nothing saved here yet). */
227
230
  carousel: () => {
@@ -269,6 +272,12 @@ export function createOfficeStore({ fetch: get = globalThis.fetch, storage } = {
269
272
  /** #2861: whether the dialogue box shows here (default: off). */
270
273
  dialogueOn: () => read(DIALOGUE_KEY) === "1",
271
274
  saveDialogueOn: (v) => write(DIALOGUE_KEY, v ? "1" : "0"),
275
+ /** How a person is talked to from here (fleet-office-talk.js TALK_MODES), as kept; null: never picked. */
276
+ talkMode: () => read(TALK_KEY),
277
+ saveTalkMode: (v) => write(TALK_KEY, String(v)),
278
+ /** How a reply plays in the box and the bubble (fleet-office-talk.js READ_MODES), as kept; null: never picked. */
279
+ talkRead: () => read(TALK_READ_KEY),
280
+ saveTalkRead: (v) => write(TALK_READ_KEY, String(v)),
272
281
  saveLobbyTile: (v) => write(LOBBY_KEY, v ? "1" : "0"),
273
282
  /** The view kept for `key` (an office and its style): { k, cx, cy } (fleet-office-view.js savedOf), or null. */
274
283
  view: (key) => {