@songsid/agend 2.4.0-beta.23 → 2.4.0-beta.24

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 (152) hide show
  1. package/dist/agent-cli-instructions.md +4 -3
  2. package/dist/agent-cli.js +32 -2
  3. package/dist/agent-cli.js.map +1 -1
  4. package/dist/agent-file-read.js +2 -2
  5. package/dist/agent-file-read.js.map +1 -1
  6. package/dist/agent-whats-new.js +11 -1
  7. package/dist/agent-whats-new.js.map +1 -1
  8. package/dist/backend/claude-code.d.ts +15 -0
  9. package/dist/backend/claude-code.js +8 -3
  10. package/dist/backend/claude-code.js.map +1 -1
  11. package/dist/backend/claude-mcp-carry.d.ts +63 -0
  12. package/dist/backend/claude-mcp-carry.js +242 -0
  13. package/dist/backend/claude-mcp-carry.js.map +1 -0
  14. package/dist/build-provenance.json +1 -1
  15. package/dist/channel/mcp-tools.js +7 -6
  16. package/dist/channel/mcp-tools.js.map +1 -1
  17. package/dist/config-validator.js +6 -0
  18. package/dist/config-validator.js.map +1 -1
  19. package/dist/daemon.d.ts +11 -0
  20. package/dist/daemon.js +66 -15
  21. package/dist/daemon.js.map +1 -1
  22. package/dist/dashboard-permissions.d.ts +8 -0
  23. package/dist/dashboard-permissions.js +8 -0
  24. package/dist/dashboard-permissions.js.map +1 -1
  25. package/dist/delivery-outbox.d.ts +15 -1
  26. package/dist/delivery-outbox.js +60 -2
  27. package/dist/delivery-outbox.js.map +1 -1
  28. package/dist/fleet-manager.d.ts +14 -0
  29. package/dist/fleet-manager.js +67 -0
  30. package/dist/fleet-manager.js.map +1 -1
  31. package/dist/general-knowledge/skills/concepts/SKILL.md +22 -9
  32. package/dist/general-knowledge/skills/credential-profiles/SKILL.md +6 -0
  33. package/dist/general-knowledge/skills/fleet-config/SKILL.md +3 -3
  34. package/dist/general-knowledge/skills/instance-lifecycle/SKILL.md +1 -1
  35. package/dist/general-knowledge/skills/task-board/SKILL.md +17 -0
  36. package/dist/general-knowledge/skills/web-appearance/SKILL.md +4 -0
  37. package/dist/general-knowledge/skills/web-dashboard/SKILL.md +21 -3
  38. package/dist/hub/group-policy/resources.d.ts +1 -1
  39. package/dist/instance-lifecycle.d.ts +2 -0
  40. package/dist/instance-lifecycle.js +29 -1
  41. package/dist/instance-lifecycle.js.map +1 -1
  42. package/dist/locale.js +10 -0
  43. package/dist/locale.js.map +1 -1
  44. package/dist/needs-you-hub.d.ts +3 -0
  45. package/dist/needs-you-hub.js +31 -5
  46. package/dist/needs-you-hub.js.map +1 -1
  47. package/dist/needs-you.d.ts +14 -1
  48. package/dist/needs-you.js +5 -0
  49. package/dist/needs-you.js.map +1 -1
  50. package/dist/office-share-page.js +1 -1
  51. package/dist/office-share-page.js.map +1 -1
  52. package/dist/office-share.js +2 -1
  53. package/dist/office-share.js.map +1 -1
  54. package/dist/outbound-handlers.js +29 -6
  55. package/dist/outbound-handlers.js.map +1 -1
  56. package/dist/outbound-schemas.d.ts +3 -0
  57. package/dist/outbound-schemas.js +7 -5
  58. package/dist/outbound-schemas.js.map +1 -1
  59. package/dist/public-web-gateway.js +3 -0
  60. package/dist/public-web-gateway.js.map +1 -1
  61. package/dist/request-context-compatibility.d.ts +20 -0
  62. package/dist/request-context-compatibility.js +74 -0
  63. package/dist/request-context-compatibility.js.map +1 -0
  64. package/dist/request-context-protocol.d.ts +137 -0
  65. package/dist/request-context-protocol.js +38 -0
  66. package/dist/request-context-protocol.js.map +1 -0
  67. package/dist/request-context-store.d.ts +25 -0
  68. package/dist/request-context-store.js +137 -0
  69. package/dist/request-context-store.js.map +1 -0
  70. package/dist/scheduler/db.js +26 -0
  71. package/dist/scheduler/db.js.map +1 -1
  72. package/dist/scheduler/task-board-text.d.ts +2 -0
  73. package/dist/scheduler/task-board-text.js +12 -0
  74. package/dist/scheduler/task-board-text.js.map +1 -1
  75. package/dist/scheduler/task-board.d.ts +102 -2
  76. package/dist/scheduler/task-board.js +242 -24
  77. package/dist/scheduler/task-board.js.map +1 -1
  78. package/dist/scheduler/task-files.d.ts +80 -0
  79. package/dist/scheduler/task-files.js +357 -0
  80. package/dist/scheduler/task-files.js.map +1 -0
  81. package/dist/settings-api.d.ts +2 -0
  82. package/dist/settings-api.js +6 -1
  83. package/dist/settings-api.js.map +1 -1
  84. package/dist/settings-baseline.d.ts +1 -0
  85. package/dist/settings-baseline.js +1 -1
  86. package/dist/settings-baseline.js.map +1 -1
  87. package/dist/settings-effect.d.ts +2 -0
  88. package/dist/settings-effect.js +5 -1
  89. package/dist/settings-effect.js.map +1 -1
  90. package/dist/task-attach-client.d.ts +43 -0
  91. package/dist/task-attach-client.js +125 -0
  92. package/dist/task-attach-client.js.map +1 -0
  93. package/dist/task-board-tool.d.ts +12 -0
  94. package/dist/task-board-tool.js +107 -6
  95. package/dist/task-board-tool.js.map +1 -1
  96. package/dist/task-file-limits.d.ts +15 -0
  97. package/dist/task-file-limits.js +21 -0
  98. package/dist/task-file-limits.js.map +1 -0
  99. package/dist/tool-permissions.d.ts +32 -0
  100. package/dist/tool-permissions.js +63 -0
  101. package/dist/tool-permissions.js.map +1 -1
  102. package/dist/types.d.ts +6 -0
  103. package/dist/ui/agent-details-settings.js +7 -5
  104. package/dist/ui/agent-who-can-use-strings.js +125 -0
  105. package/dist/ui/agent-who-can-use.js +238 -0
  106. package/dist/ui/fleet-office-card.js +23 -5
  107. package/dist/ui/fleet-office-editor.js +5 -5
  108. package/dist/ui/fleet-office-pack.d.ts +10 -0
  109. package/dist/ui/fleet-office-pack.js +65 -2
  110. package/dist/ui/fleet-office-skin.js +42 -8
  111. package/dist/ui/fleet-office-store.js +33 -2
  112. package/dist/ui/fleet-office-vehicles.js +130 -0
  113. package/dist/ui/fleet-office-zones.js +5 -1
  114. package/dist/ui/fleet-office.js +112 -31
  115. package/dist/ui/fleet-task-activity.js +9 -82
  116. package/dist/ui/fleet-task-archive.js +111 -0
  117. package/dist/ui/fleet-task-card.js +6 -4
  118. package/dist/ui/fleet-task-common.js +2 -2
  119. package/dist/ui/fleet-task-edit.js +8 -1
  120. package/dist/ui/fleet-task-files.js +196 -0
  121. package/dist/ui/fleet-task-md.js +98 -0
  122. package/dist/ui/fleet-task-menu.js +1 -1
  123. package/dist/ui/fleet-task-stats.js +2 -2
  124. package/dist/ui/fleet-task-view.js +12 -8
  125. package/dist/ui/fleet-tasks.js +42 -18
  126. package/dist/ui/panel-details.js +3 -1
  127. package/dist/ui/panel-needs.js +3 -3
  128. package/dist/ui/panel-settings.js +15 -1
  129. package/dist/ui/settings-registry.js +1 -0
  130. package/dist/ui/settings-shared-strings.js +9 -0
  131. package/dist/ui/settings-shared.js +6 -1
  132. package/dist/ui/shared/app-i18n.js +2 -2
  133. package/dist/ui/shared/app-needs.js +8 -1
  134. package/dist/ui/shared/app.css +55 -3
  135. package/dist/ui/shared/chat-strings.js +4 -4
  136. package/dist/ui/shared/task-board.css +64 -0
  137. package/dist/web-api.d.ts +3 -0
  138. package/dist/web-api.js +97 -14
  139. package/dist/web-api.js.map +1 -1
  140. package/dist/web-office-acts.d.ts +16 -0
  141. package/dist/web-office-acts.js +27 -9
  142. package/dist/web-office-acts.js.map +1 -1
  143. package/dist/web-office-pack-read.js +1 -1
  144. package/dist/web-office-pack-read.js.map +1 -1
  145. package/dist/web-office-skins.d.ts +5 -3
  146. package/dist/web-office-skins.js +20 -16
  147. package/dist/web-office-skins.js.map +1 -1
  148. package/dist/web-settings-patch.d.ts +27 -0
  149. package/dist/web-settings-patch.js +67 -0
  150. package/dist/web-settings-patch.js.map +1 -1
  151. package/dist/workflow-templates/default.md +1 -0
  152. package/package.json +1 -1
@@ -72,6 +72,7 @@ import { hits, needle } from "./fleet-canvas-layout.js";
72
72
  import { AUTO_ID, LOBBY, autoLayout, backingScale, coatOf, createFlights, customLayout, deskAt, desksOf, filterOk, lampOf, layoutOk, lightOf, membersOf,
73
73
  officePose, officeRooms, signOf, workOn } from "./fleet-office-model.js";
74
74
  import { BUILT_IN_SKINS, CHAR_DEPTH, DEFAULT_PAL, PICTURE_SKINS, bubbleBox, pixelSkin, loadBuiltInSkin, loadPackSkin, modeOf, skinFor, tagBox, tagFootprint, withCharacters } from "./fleet-office-skin.js";
75
+ import { createRiders, facing, seatAt, vehicleAt } from "./fleet-office-vehicles.js";
75
76
  import { CALLING, activeFurniture, bubbleAt, hiddenBy, bubbleRank, NIGHT, WANDER, createMail, createWalkers, isNight, linesFor, npcKey, personAt, placeBubbles, routeStaysInArea, thinBubbles, walkTargets, zonesLayout } from "./fleet-office-zones.js";
76
77
  import { actsOk, createOfficeStore } from "./fleet-office-store.js";
77
78
  import { badgeOf, fixedOf, mergeLevels } from "./fleet-office-levels.js";
@@ -102,7 +103,7 @@ register("orgo", {
102
103
  b_working: "On it.|Typing…|Almost there|In the zone|One more test", b_idle: "Tea time|Ready when you are|Stretching|Anything for me?",
103
104
  b_paused: "Zzz…|Back later", b_stopped: "Off duty|Zzz…", b_needs: "Need you!|A question for you|Over here!",
104
105
  b_crashed: "Ouch, crashed|Help!", b_stuck: "Hmm, stuck?|Still thinking…",
105
- options: "Office options", hideAsleep: "Hide paused and stopped", nightOn: "Bedtime (0–6): idle agents sleep", playOn: "Drag and pat", playStill: "Off while reduced motion is on", layoutIgnored: "Its saved layout does not fit this style: drawn as the style's own.",
106
+ options: "Office options", hideAsleep: "Hide paused and stopped", hideNames: "Hide names and levels", hideMini: "Hide the minimap", nightOn: "Bedtime (0–6): idle agents sleep", playOn: "Drag and pat", playStill: "Off while reduced motion is on", layoutIgnored: "Its saved layout does not fit this style: drawn as the style's own.",
106
107
  styleForAll: "The whole fleet's style, for everyone: every device and share link", styleHere: "The whole fleet's style in this browser",
107
108
  styleFailed: "The style was not saved for everyone ({0}).", styleBusy: "Too many changes. Try again in a minute.",
108
109
  fit: "Fit the office", overview: "Overview: click to move there", fullscreen: "Fullscreen", exitFullscreen: "Exit fullscreen",
@@ -135,7 +136,7 @@ register("orgo", {
135
136
  b_working: "處理中|打字中…|快好了|專心中|再測一次", b_idle: "喝茶中|隨時可以開工|伸個懶腰|有事找我嗎?",
136
137
  b_paused: "Zzz…|晚點回來", b_stopped: "下班了|Zzz…", b_needs: "需要你!|有個問題|在這裡!",
137
138
  b_crashed: "糟糕,當掉了|救命!", b_stuck: "嗯,卡住了?|還在想…",
138
- options: "辦公室選項", hideAsleep: "隱藏暫停與停止的成員", nightOn: "0–6 點就寢:閒著的人去睡", playOn: "拖曳與摸頭", playStill: "開啟「減少動態效果」時關閉", layoutIgnored: "它儲存的配置不適用這個風格:以風格本身的配置顯示。",
139
+ options: "辦公室選項", hideAsleep: "隱藏暫停與停止的成員", hideNames: "隱藏名字和等級", hideMini: "隱藏小地圖", nightOn: "0–6 點就寢:閒著的人去睡", playOn: "拖曳與摸頭", playStill: "開啟「減少動態效果」時關閉", layoutIgnored: "它儲存的配置不適用這個風格:以風格本身的配置顯示。",
139
140
  styleForAll: "整個 fleet 的風格,所有人共用:每台裝置與分享連結都一樣", styleHere: "這個瀏覽器裡整個 fleet 的風格",
140
141
  styleFailed: "風格沒有替所有人儲存({0})。", styleBusy: "變更太頻繁,請一分鐘後再試。",
141
142
  fit: "顯示整個辦公室", overview: "總覽:點一下移到那裡", fullscreen: "全螢幕", exitFullscreen: "結束全螢幕",
@@ -287,6 +288,8 @@ export function nearestPerson(list, x, y, r) {
287
288
  }
288
289
  /** How often the picture can change when nothing is in the air (the poses loop at 4 fps; a bubble types faster). */
289
290
  const FPS = 12;
291
+ /** At most this many frames a second while anyone walks or anything moves. */
292
+ const AIR_FPS = 30;
290
293
  const STYLES = BUILT_IN_SKINS;
291
294
  /** Paused and stopped: left out when "Hide paused and stopped" is on. */
292
295
  const ASLEEP = new Set(["paused", "stopped"]);
@@ -332,6 +335,22 @@ function looksOf(L, work, q, mode, zones, badge = () => null) {
332
335
  badge: badge(n.name), fit: n.i && n.i.tag_fit && typeof n.i.tag_fit === "object" ? n.i.tag_fit : null }];
333
336
  }));
334
337
  }
338
+ /**
339
+ * #4466: whoever's card is open (`carded`, the page's cardDesk) stands where they are now: `to` gets their place. Not
340
+ * while carried (the hold sets that), and not while calling (#4467 review: a caller walks to the Help desk as usual).
341
+ */
342
+ export function cardStay(to, carded, held, walkers, t) {
343
+ if (!carded || !carded.walks || CALLING.has(carded.state) || (held && held.name === carded.name)) return;
344
+ const at = walkers.at(carded.name, t);
345
+ if (at) to.set(carded.name, { x: at.x, y: at.y });
346
+ }
347
+ /** `view` (buildOrgView's) with each renamed person's nickname set to the name this browser gives them. */
348
+ export function renamedView(view, renames) {
349
+ if (!view || !renames || !Object.keys(renames).length) return view;
350
+ const one = (n) => (n && n.i && Object.prototype.hasOwnProperty.call(renames, n.name) ? { ...n, i: { ...n.i, display_name: renames[n.name] } } : n);
351
+ return { ...view, top: (view.top || []).map(one), teams: (view.teams || []).map((t) => ({ ...t, nodes: (t.nodes || []).map(one) })),
352
+ rest: view.rest ? { ...view.rest, nodes: (view.rest.nodes || []).map(one) } : view.rest };
353
+ }
335
354
  /** A stored office's own layout on a zones style (its overrides); `ignored`: they do not fit this style. */
336
355
  function withOverrides(baseSkin, zones, office) {
337
356
  const ov = zones && office ? office.overrides : null;
@@ -442,6 +461,12 @@ export function actLive(a, state, at = Date.now(), seen = null) {
442
461
  if (state !== "working") { seen.add(k); return true; }
443
462
  return !seen.has(k) && (!a.state || a.state === "working");
444
463
  }
464
+ /**
465
+ * Whether an agent's ride (office_set `ride`) holds now: set and not past its end, the person neither asleep nor calling
466
+ * (#4415: nothing keeps a caller from the Help desk; the ride resumes when the call is over). Working or a new turn do
467
+ * not end it (it is where they choose to be); clearing it, a new office_set or its end do.
468
+ */
469
+ export const rideLive = (a, state, at = Date.now()) => !!a && !!a.ride && at < a.until && !ASLEEP.has(state) && !CALLING.has(state);
445
470
  /** How far beside the person an agent going to them stands. */
446
471
  const ACT_BESIDE = 48;
447
472
  /** Where an agent's act sends it at `t`: its point, beside the person it goes to (where they are now), or null. */
@@ -483,8 +508,9 @@ function paintLayers(p, env, ls, tagsOff = false) {
483
508
  for (const r of L.rooms) skin.drawRoom(g, r, env);
484
509
  for (const d of all) skin.drawDeskBack(g, d, looks.get(d.key), env);
485
510
  });
486
- const front = zones ? null : layer((g) => {
487
- for (const d of all) { const lk = looks.get(d.key); skin.drawDeskFront(g, d, tagsOff && lk && !lk.match ? { ...lk, notag: true } : lk, env); }
511
+ // Zones: the pack's foreground, painted once at the layer's scale (it was drawn from the full picture every frame).
512
+ const front = zones ? (skin.pack && skin.pack.foreground && skin.drawForeground ? layer((g) => skin.drawForeground(g, L, env)) : null) : layer((g) => {
513
+ for (const d of all) { const lk = looks.get(d.key); skin.drawDeskFront(g, d, !tagsOff || !lk || lk.match ? lk : tagsOff === "names" && CALLING.has(lk.state) ? { ...lk, badge: null } : { ...lk, notag: true }, env); }
488
514
  });
489
515
  return { ls, tagsOff, back, front };
490
516
  }
@@ -510,17 +536,21 @@ export function officeBubbleAt(hits, x, y, minSize = 0) {
510
536
  export function drawPart(ctx, p, a, ox, oy, ms, still, hot, env, tagsOff = false, defer = null, bubbleHits = null) {
511
537
  const sk = p.skin;
512
538
  const ls = layerScale(a, p.L.width, p.L.height);
513
- if (!p.layers || p.layers.ls !== ls || p.layers.tagsOff !== tagsOff) p.layers = paintLayers(p, env, ls, tagsOff);
539
+ // Zones zoomed in past the layers' budget (a big pack): the layer would be coarser than the screen and the picture,
540
+ // so the background and foreground are drawn from their pictures instead (only the part on screen is rasterised).
541
+ const direct = !!p.zones && ls < a - 1e-6;
542
+ if (!direct && (!p.layers || p.layers.ls !== ls || p.layers.tagsOff !== tagsOff)) p.layers = paintLayers(p, env, ls, tagsOff);
514
543
  const T = () => ctx.setTransform(a, 0, 0, a, ox, oy);
515
544
  const blit = (c) => { if (!c) return; ctx.setTransform(a / ls, 0, 0, a / ls, ox, oy); ctx.drawImage(c, 0, 0); T(); };
516
- blit(p.layers.back);
545
+ if (direct) { T(); ctx.fillStyle = env.pal.bg; ctx.fillRect(0, 0, p.L.width, p.L.height); sk.drawBackground(ctx, p.L, env); }
546
+ else blit(p.layers.back);
517
547
  T();
518
548
  const speakers = [], tags = [], titleBoxes = []; // M-3539: the area names bubbles keep off too
519
549
  const titleDraws = []; // M-3722: and redrawn over a bubble's tail that crosses one
520
550
  const up = still ? [] : p.flights.frame(ms, p.L);
521
551
  // Mail from another office (#2564): flying in at the door, or on the floor until its person picks it up.
522
552
  const post = still || !p.mail || !p.zones ? [] : p.mail.frame(ms > 0 ? ms : now(), p.L, p.walkers);
523
- let walking = false;
553
+ let walking = false, carsOn = false;
524
554
  if (p.zones) {
525
555
  // Furniture under the people; the people (nearest last) with the furniture whose depth is "y" among them, by base
526
556
  // y (a tie: the item first, the person in front); furniture over them; things in the air; the pack's foreground
@@ -538,6 +568,9 @@ export function drawPart(ctx, p, a, ox, oy, ms, still, hot, env, tagsOff = false
538
568
  });
539
569
  if (changed && typeof p.onSnacksChanged === "function") p.onSnacksChanged();
540
570
  }
571
+ // Off screen (the canvas in logical units, with room for the tallest sprite and its bubble): not drawn.
572
+ const cw = ctx.canvas && ctx.canvas.width, chh = ctx.canvas && ctx.canvas.height, M = 320;
573
+ const offView = cw ? (at) => at.x < -ox / a - M || at.x > (cw - ox) / a + M || at.y < -oy / a - M / 4 || at.y > (chh - oy) / a + M : () => false;
541
574
  const people = p.desks.map((d) => {
542
575
  const at = p.walkers.at(d.node.name, t) || { ...d.seat, walking: false };
543
576
  if (at.walking) walking = true;
@@ -546,7 +579,11 @@ export function drawPart(ctx, p, a, ox, oy, ms, still, hot, env, tagsOff = false
546
579
  const furniture = strollFurniture(p.night ? nightFurniture(sk.pack.furniture) : sk.pack.furniture, (k) => p.walkers.at(k, t));
547
580
  if (furniture.some((f) => f.walking)) walking = true;
548
581
  const placedSnacks = p.snacks ? p.snacks.placedList() : [];
582
+ const wall = Date.now(), cars = (sk.pack.vehicles || []).map((v) => ({ v, at: vehicleAt(v, wall) }));
583
+ carsOn = cars.length > 0;
549
584
  const band = [...furniture.filter((f) => f.depth === "y").map((f) => ({ y: f.y, k: 0, f })),
585
+ ...cars.map((c) => ({ y: c.at.y, k: 0.8, car: c })),
586
+ ...cars.map((c) => ({ y: Math.max(c.at.y, ...people.filter((q) => q.at.riding && p.riding && (p.riding(q.look.name) || {}).vehicle === c.v.id).map((q) => q.at.y)), k: 1.5, front: c })),
550
587
  ...placedSnacks.map((sn) => ({ y: sn.y, k: 0.5, sn })),
551
588
  ...people.map((q) => ({ y: q.at.y, k: 1, p: q })),
552
589
  ...(p.ghosts ? ghostsOf(sk.pack, people).map((g) => ({ y: g.y, k: 1, g })) : []),
@@ -601,7 +638,9 @@ export function drawPart(ctx, p, a, ox, oy, ms, still, hot, env, tagsOff = false
601
638
  for (const f of furniture) if (f.depth !== "y" && f.depth < CHAR_DEPTH) sk.drawFurniture(ctx, f, f.asleep || live.active.has(f.id), ms, env);
602
639
  for (const it of post) if (it.t === 0) sk.drawProp(ctx, it, ms, env); // a letter on the floor: under the people
603
640
  let heldPerson = null;
604
- for (const { f, p: q, g, n, sn } of band) {
641
+ for (const { f, p: q, g, n, sn, car, front } of band) {
642
+ if (car) { if (sk.drawVehicle) sk.drawVehicle(ctx, car.v, car.at, ms, env); continue; }
643
+ if (front) { if (sk.drawVehicleFront) sk.drawVehicleFront(ctx, front.v, front.at, ms, env); continue; }
605
644
  if (f) { sk.drawFurniture(ctx, f, f.asleep || live.active.has(f.id), ms, env); continue; }
606
645
  if (sn) {
607
646
  const sdef = p.snacksById && p.snacksById.get(sn.snackId);
@@ -618,6 +657,7 @@ export function drawPart(ctx, p, a, ox, oy, ms, still, hot, env, tagsOff = false
618
657
  if (g) { ctx.save(); ctx.globalAlpha = GHOST_ALPHA; sk.drawCharacter(ctx, { x: g.x - 44, y: g.y - 53, w: 88, h: 53, seat: g }, g.look, 0, env); ctx.restore(); continue; }
619
658
  if (heldName && q.look.name === heldName) { heldPerson = q; continue; } // M-3445 (#4267): drawn lifted on top below
620
659
  if (live.hidden.has(q.look.name)) continue; // #2698: drawn as the item (never while walking)
660
+ if (offView(q.at)) continue;
621
661
  const box = { ...q.d, x: q.at.x - 44, y: q.at.y - 53, w: 88, h: 53, seat: { x: q.at.x, y: q.at.y } };
622
662
  // An agent's own pose (office_set, #2578) while its act lasts and nothing calls it; walking is walking; M-3432: eating when fed.
623
663
  const posed = actPosed(p, q.look);
@@ -647,7 +687,8 @@ export function drawPart(ctx, p, a, ox, oy, ms, still, hot, env, tagsOff = false
647
687
  }
648
688
  for (const it of up) sk.drawProp(ctx, it, ms, env);
649
689
  for (const it of post) if (it.t > 0) sk.drawProp(ctx, it, ms, env);
650
- if (sk.drawForeground) sk.drawForeground(ctx, p.L, env);
690
+ if (direct) { if (sk.pack && sk.pack.foreground && sk.drawForeground) sk.drawForeground(ctx, p.L, env); }
691
+ else if (p.layers.front) blit(p.layers.front);
651
692
  // Who found no spot in an area: a count in its corner (never over its name).
652
693
  for (const [ar, n] of p.L.crowd || []) if (p.L.areas[ar] && sk.drawCrowd) sk.drawCrowd(ctx, p.L.areas[ar], n, env);
653
694
  // M-3539: an area's name a figure stands on is written again over the people (休息區 under a crowd's heads).
@@ -664,7 +705,10 @@ export function drawPart(ctx, p, a, ox, oy, ms, still, hot, env, tagsOff = false
664
705
  const over = p.L.over || new Set();
665
706
  const pinned = (q) => q.d.key === hot || !!q.look.match;
666
707
  const crowded = (q) => over.has(q.d.area) && !pinned(q);
667
- const tagged = (q) => pinned(q) || !(tagsOff || over.has(q.d.area));
708
+ // A caller keeps their tag with names hidden (#4467 review): the Help desk always says who needs you.
709
+ const tagged = (q) => pinned(q) || (tagsOff === "names" && CALLING.has(q.look.state)) || !(tagsOff || over.has(q.d.area));
710
+ // Names hidden: a caller's tag is their name only; the level stays hidden (the one hovered or found keeps it).
711
+ const tagLook = (q) => (tagsOff === "names" && !pinned(q) && q.look.badge ? { ...q.look, badge: null } : q.look);
668
712
  const keep = [...titles.map((x) => x.box), ...(env.keepClear || [])];
669
713
  titleBoxes.push(...titles.map((x) => x.box)); titleDraws.push(...titles);
670
714
  const taken = [];
@@ -703,7 +747,7 @@ export function drawPart(ctx, p, a, ox, oy, ms, still, hot, env, tagsOff = false
703
747
  const FULL_TRIES = [[0, false], [TAG_ROW, false], [0, true], [COMPACT_ROW, true]];
704
748
  const tagOrder = people.filter((q) => !(live.hidden.has(q.look.name) && q.look.name !== heldName) && tagged(q))
705
749
  .map((q, i) => ({ q, i, rank: pinned(q) ? 0 : q.at.walking ? 2 : 1 })).sort((x, y) => x.rank - y.rank || x.i - y.i);
706
- for (const { q, rank } of tagOrder) place(q.at.x, q.at.y, q.look, FULL_TRIES, rank === 0);
750
+ for (const { q, rank } of tagOrder) place(q.at.x, q.at.y, tagLook(q), FULL_TRIES, rank === 0);
707
751
  // A furniture item's own name (#2574: an NPC drawn as furniture), tagged like a person; none on a tile too small to read.
708
752
  // #2698: an item hiding its people carries their tags too, in one row at its tag point (its own first; each keeps
709
753
  // its place in the row while another's tag is left out), and their bubbles, over its picture. The tags drawn are
@@ -717,7 +761,7 @@ export function drawPart(ctx, p, a, ox, oy, ms, still, hot, env, tagsOff = false
717
761
  }
718
762
  const order = new Map((f.activeFor || []).map((n, i) => [n, i]));
719
763
  on.sort((x, y) => (order.get(x.look.name) ?? 0) - (order.get(y.look.name) ?? 0));
720
- const row = tagRow(ctx, f.x, f.y, [...(f.label ? [npcLook(p, f)] : []), ...on.map((q) => q.look)]);
764
+ const row = tagRow(ctx, f.x, f.y, [...(f.label ? [npcLook(p, f)] : []), ...on.map(tagLook)]);
721
765
  const top = f.sprite ? Math.min(f.y - 50, stripBox(f.activeSprite || f.sprite, f.x, f.y).y + 2) : f.y - 50;
722
766
  for (const [i, r] of row.entries()) {
723
767
  const q = f.label ? on[i - 1] : on[i];
@@ -849,7 +893,7 @@ export function drawPart(ctx, p, a, ox, oy, ms, still, hot, env, tagsOff = false
849
893
  if (bubbleHits) bubbleHits.push({ name: sp.look.name, reply: true, box: { x: ox + box.x * a, y: oy + box.y * a, w: box.w * a, h: box.h * a } });
850
894
  } };
851
895
  if (defer) defer.push(say); else say();
852
- return replies.length > 0 || walking || up.length > 0 || p.flights.size() > 0 || post.some((it) => it.t > 0) || rising.length > 0 || !!reacting || (!!p.snacks && p.snacks.active(t0)) || !!(p.snackDrop && p.snackDrop.current) || !!(p.hold && p.hold.held());
896
+ return replies.length > 0 || carsOn || walking || up.length > 0 || p.flights.size() > 0 || post.some((it) => it.t > 0) || rising.length > 0 || !!reacting || (!!p.snacks && p.snacks.active(t0)) || !!(p.snackDrop && p.snackDrop.current) || !!(p.hold && p.hold.held());
853
897
  }
854
898
  /**
855
899
  * #2661: an NPC's name tag (a furniture item's label) — with the title a pack pins on it (`levels.fixed` by its id),
@@ -965,7 +1009,7 @@ function ensureDialogueStyle() {
965
1009
  link.href = assetUrl("/assets/office-dialogue.css");
966
1010
  link.setAttribute("data-office-dialogue-css", "1"); doc.head.appendChild(link);
967
1011
  }
968
- export function Office({ view, traffic, q = "", lease, onOpen, assetUrl, assetImage, opening, talk, chatUi = null, more = false, onMore = null, live = null, onLive = null,
1012
+ export function Office({ view: given, traffic, q = "", lease, onOpen, assetUrl, assetImage, opening, talk, chatUi = null, more = false, onMore = null, live = null, onLive = null,
969
1013
  oneOffice = false, readOnly = false, stream = true, storage = undefined, cardRows = null, words = null, cardAction = null, cardName = null, officesKey = undefined, foldBar = false, cardPhoto = null, characters = null }) {
970
1014
  // M-3253: on a phone the page above (fleet-canvas.js) puts a ⋯ in its bar: `more` is that sheet open, `onMore(open)`;
971
1015
  // `live` / `onLive` its Live toggle, which moves into the sheet. Without one (a share link's page) the bar stays.
@@ -1007,6 +1051,11 @@ export function Office({ view, traffic, q = "", lease, onOpen, assetUrl, assetIm
1007
1051
  const [styleErr, setStyleErr] = useState("");
1008
1052
  const style = canEdit ? hostStyle ?? ownStyle ?? "cozy" : ownStyle ?? hostStyle ?? "cozy";
1009
1053
  const [hideAsleep, setHideAsleep] = useState(() => store.hideAsleep());
1054
+ const [namesOff, setNamesOff] = useState(() => store.namesOff());
1055
+ const [miniOff, setMiniOff] = useState(() => store.miniOff());
1056
+ // The names this browser gives people: each node's nickname replaced here, so the tags, the card and the dialogue follow.
1057
+ const [renames, setRenames] = useState(() => store.renames());
1058
+ const view = useMemo(() => renamedView(given, renames), [given, renames]);
1010
1059
  // Bedtime (#2568), when it is on here: the idle sleep from NIGHT.FROM to NIGHT.TO on this device's clock (read every NIGHT.TICK).
1011
1060
  const [nightOn, setNightOn] = useState(() => store.nightOn());
1012
1061
  const [keyOpen, setKeyOpen] = useState(() => store.keyOpen());
@@ -1069,6 +1118,7 @@ export function Office({ view, traffic, q = "", lease, onOpen, assetUrl, assetIm
1069
1118
  fsRef.current = fs;
1070
1119
  const flights = useMemo(() => createFlights(), []);
1071
1120
  const walkers = useMemo(() => createWalkers(), []);
1121
+ const riders = useMemo(() => createRiders(), []);
1072
1122
  const seatsRef = useRef(new Map()); // the zones layout's last seats: kept where they can be
1073
1123
  const seatPrefsRef = useRef({}), seatKeyRef = useRef(""), seatDropRef = useRef(null);
1074
1124
  const placedRef = useRef(null); // M-3539: the office and style the walkers were last placed for
@@ -1283,7 +1333,8 @@ export function Office({ view, traffic, q = "", lease, onOpen, assetUrl, assetIm
1283
1333
  const size = { w: width, h: stageH > 0 ? stageH : SIZE0.h };
1284
1334
  // The canvas bitmap's px per CSS px: the device's, unless the bitmap would be too big to paint (backingScale). Zoom
1285
1335
  // snaps to whole numbers of these (fleet-office-view.js), so a pixel-level view maps a logical unit onto whole pixels.
1286
- const ratio = backingScale(size.w, size.h, dpr);
1336
+ // At most 2 px per CSS px: a 3x phone screen would paint 2.25x the pixels every frame for little visible gain.
1337
+ const ratio = backingScale(size.w, size.h, Math.min(2, dpr));
1287
1338
 
1288
1339
  // #2554: All offices — chosen, and at least two offices stored (else the whole fleet, as an office gone is).
1289
1340
  const overview = choice === ALL_ID && overviewOk(stored);
@@ -1468,14 +1519,31 @@ export function Office({ view, traffic, q = "", lease, onOpen, assetUrl, assetIm
1468
1519
  // An act's walk; not someone in bed for the night (#2568: bedtime wins, as for mail).
1469
1520
  for (const d of desksOf(L)) { const a = actsHere.get(d.node.name), at = !d.night && actLive(a, d.node.state, Date.now(), actSeen.current) ? actTarget(a, L, walkers, t) : null; if (at) to.set(d.node.name, at); }
1470
1521
  for (const [name, at] of mail.targets(L, t)) to.set(name, at);
1471
- for (const [name, at] of snacks.targets(t)) to.set(name, at);
1472
- const held = hold.held(); // M-3293: carried: where the pointer is, no walk
1473
- if (held) to.set(held.name, held.at);
1474
1522
  // M-3539: a new office or style (a room's office reads its style after it opens) puts everyone at their place at
1475
1523
  // once: walking there from the old one's seats drew the asleep standing in the help desk for seconds.
1476
1524
  const placed = `${officeKey}\n${skin.id}`, fresh = placedRef.current !== placed;
1477
1525
  placedRef.current = placed;
1526
+ // A pack's vehicles: who wants to ride walks to the platform, boards when it stops there, gets off at a stop; a
1527
+ // caller gets off at once. Riders are set down where they are when their vehicle goes (fresh: the sync does).
1528
+ const vehicles = skin.pack.vehicles || [];
1529
+ let boarding = [];
1530
+ if (fresh) riders.clear();
1531
+ if (vehicles.length) {
1532
+ const byId = new Map(vehicles.map((v) => [v.id, v])), wall = Date.now(), here = desksOf(L);
1533
+ const wants = new Map(here.map((d) => { const a = actsHere.get(d.node.name); return [d.node.name, !d.night && rideLive(a, d.node.state, wall) ? a.ride : null]; }));
1534
+ const r = riders.step({ wants, vehicles: byId, wall, posOf: (n) => walkers.at(n, t), homeOf: (n) => (here.find((d) => d.node.name === n) || {}).seat || null,
1535
+ sinceOf: (n) => { const a = actsHere.get(n); return a && a.ride && typeof a.since === "number" ? a.since : null; },
1536
+ urgent: (n) => { const d = here.find((x) => x.node.name === n); return !!d && CALLING.has(d.node.state); } });
1537
+ for (const [name, at] of r.targets) to.set(name, at);
1538
+ boarding = r.board.map((b) => { const v = byId.get(b.vehicle); return [b.name, () => seatAt(v, vehicleAt(v, Date.now()), b.seat)]; });
1539
+ for (const a of r.alight) walkers.place(a.name, a.at);
1540
+ } else for (const n of riders.clear()) { const p = walkers.at(n, t); if (p) walkers.place(n, p); }
1541
+ for (const [name, at] of snacks.targets(t)) to.set(name, at);
1542
+ const held = hold.held(); // M-3293: carried: where the pointer is, no walk
1543
+ if (held) to.set(held.name, held.at);
1544
+ cardStay(to, cardDesk.current, held, walkers, t); // their card is open: no walk, unless calling
1478
1545
  walkers.sync(to, t, L, still, fresh);
1546
+ for (const [name, seat] of boarding) walkers.ride(name, seat);
1479
1547
  // Reduced motion has no loop: drawn again here, or an act's walk (set after the scene was drawn) never shows.
1480
1548
  if (still) { if (scene.current && !globalThis.document?.hidden) draw(0); } else loop.current?.wake();
1481
1549
  };
@@ -1484,7 +1552,7 @@ export function Office({ view, traffic, q = "", lease, onOpen, assetUrl, assetIm
1484
1552
  if (still) return undefined;
1485
1553
  const h = setInterval(go, WANDER.TICK);
1486
1554
  return () => clearInterval(h);
1487
- }, [L, wander, mail, skin, night, actsHere, visitMemo, ownArea]);
1555
+ }, [L, wander, mail, skin, night, actsHere, visitMemo, ownArea, riders]);
1488
1556
  // …and in each tile on a zones style; the traffic within a tile is its own, between tiles the overview's.
1489
1557
  useEffect(() => {
1490
1558
  for (const tl of tiles) if (tl.zones) tl.walkers.sync(new Map(desksOf(tl.L).map((d) => [d.node.name, d.seat])), now(), tl.L, still);
@@ -1687,6 +1755,7 @@ export function Office({ view, traffic, q = "", lease, onOpen, assetUrl, assetIm
1687
1755
  store.saveFitMode(officeKey, next); setFitRev((n) => n + 1);
1688
1756
  fit(next);
1689
1757
  };
1758
+ useEffect(() => { if (!miniOff) mark(); }, [miniOff]); // shown again: placed on the view at once
1690
1759
  /** + / −: the next pixel level about the stage's middle. */
1691
1760
  const zoomStep = (dir) => { const v = view0(), k = stepK(v.k, dir, ratio, kLo); raw.current = k; setView(zoomTo(v, k, size.w / 2, size.h / 2)); };
1692
1761
  /** Bring a box (logical units) into view, unchanged when it already is. */
@@ -1805,18 +1874,18 @@ export function Office({ view, traffic, q = "", lease, onOpen, assetUrl, assetIm
1805
1874
  ? Math.max(0, ...tiles.map((tl) => packMaxFps(tl.skin && tl.skin.pack)))
1806
1875
  : packMaxFps(skin && skin.pack);
1807
1876
  const fps = Math.max(FPS, Math.min(30, Math.ceil(maxPackFps)));
1808
- const base = { ctx, ratio, BW, BH, matte, env, fps, dirty: true };
1877
+ const base = { ctx, ratio, BW, BH, matte, env, fps, dirty: true, namesOff };
1809
1878
  if (overview) {
1810
1879
  // Each tile a scene of its own, where the overview puts it (arranged.tiles, in the same order).
1811
1880
  const parts = tiles.map((tl, i) => ({ ...partOf(tl.L, tileLooks[i], tl.skin, tl.zones, tl.walkers, tl.flights), night, key: tl.key, prefix: tl.prefix, tile: arranged.tiles[i], ups: ups.current, levelsOn: !!(lv && lv.enabled), levels: wordsOf(tl.skin) }));
1812
1881
  scene.current = { ...base, overview: true, parts, lay: arranged };
1813
1882
  } else {
1814
- scene.current = { ...base, overview: false, part: { ...partOf(L, looks, skin, zones, walkers, flights), ghosts, night, mail, acts: actsHere, actSeen: actSeen.current, ups: ups.current, levelsOn: !!(lv && lv.enabled), levels: wordsOf(skin), reacts: reacts.current,
1883
+ scene.current = { ...base, overview: false, part: { ...partOf(L, looks, skin, zones, walkers, flights), ghosts, night, mail, acts: actsHere, actSeen: actSeen.current, ups: ups.current, levelsOn: !!(lv && lv.enabled), levels: wordsOf(skin), reacts: reacts.current, riding: riders.riding,
1815
1884
  hold: play ? hold : null, seatDrop: seatDropRef,
1816
1885
  snacks: play ? snacks : null, snacksById, ownArea, snackDrop: snackDropRef, onSnackClaim, onSnacksChanged: () => walkNow.current?.() } };
1817
1886
  }
1818
1887
  if (still) draw(0); else loop.current?.wake();
1819
- }, [L, looks, skin, pal, size.w, size.h, ratio, matte, overview, tiles, tileLooks, arranged, ghosts, night, mail, actsHere, lv, wordsOf, play, snacksById, ownArea]);
1888
+ }, [L, looks, skin, pal, size.w, size.h, ratio, matte, overview, tiles, tileLooks, arranged, ghosts, night, mail, actsHere, lv, wordsOf, play, snacksById, ownArea, namesOff]);
1820
1889
 
1821
1890
  /** One frame at `ms` (0: still); whether anything is moving (in the air, or someone walking). */
1822
1891
  function draw(ms) {
@@ -1845,7 +1914,7 @@ export function Office({ view, traffic, q = "", lease, onOpen, assetUrl, assetIm
1845
1914
  s.part.cover = r.width > 0 && r.height > 0 ? { x: (r.left - c.left) * s.ratio, y: (r.top - c.top) * s.ratio, w: r.width * s.ratio, h: r.height * s.ratio } : null;
1846
1915
  } else s.part.cover = null;
1847
1916
  const e0 = clocked(""), kc = keepClearOf(canvasRef.current, v);
1848
- const moved = drawPart(ctx, s.part, a, ox, oy, ms, still, tipNow.current, kc.length ? { ...e0, keepClear: kc } : e0, false, null, s.bubbleHits);
1917
+ const moved = drawPart(ctx, s.part, a, ox, oy, ms, still, tipNow.current, kc.length ? { ...e0, keepClear: kc } : e0, s.namesOff ? "names" : false, null, s.bubbleHits);
1849
1918
  if (seenClips) clipClocks.current.prune(seenClips);
1850
1919
  return drawDialogue(ctx, s, ms) || moved;
1851
1920
  }
@@ -1860,7 +1929,7 @@ export function Office({ view, traffic, q = "", lease, onOpen, assetUrl, assetIm
1860
1929
  ctx.save();
1861
1930
  ctx.setTransform(1, 0, 0, 1, 0, 0);
1862
1931
  ctx.beginPath(); ctx.rect(tx, ty, tw, th); ctx.clip();
1863
- if (drawPart(ctx, p, a * tt.s, tx, ty, ms, still, hot && hot.startsWith(p.prefix) ? hot.slice(p.prefix.length) : null, clocked(p.prefix), v.k * tt.s < TAG_MIN_K, said, s.bubbleHits)) moving = true;
1932
+ if (drawPart(ctx, p, a * tt.s, tx, ty, ms, still, hot && hot.startsWith(p.prefix) ? hot.slice(p.prefix.length) : null, clocked(p.prefix), v.k * tt.s < TAG_MIN_K || (s.namesOff ? "names" : false), said, s.bubbleHits)) moving = true;
1864
1933
  ctx.restore();
1865
1934
  ctx.setTransform(1, 0, 0, 1, 0, 0);
1866
1935
  ctx.strokeStyle = env.pal.border; ctx.lineWidth = 1;
@@ -1956,18 +2025,19 @@ export function Office({ view, traffic, q = "", lease, onOpen, assetUrl, assetIm
1956
2025
  }, [dlgOn, dlgVisible, dlgSay, width, phone, ratio]);
1957
2026
 
1958
2027
  // The loop: drawing only when the frame (FPS) changed or something is in the air; stopped while the tab is hidden,
1959
- // gone with the view. Office review: while something walks or flies, one requestAnimationFrame per display frame (the
2028
+ // gone with the view. Office review: while something walks or flies, a frame every display frame up to AIR_FPS (the
1960
2029
  // motion is smooth); when nothing moves, the poses change at most FPS times a second, so the loop sleeps (a timer)
1961
2030
  // until the next frame's start instead of waking at the display's rate only to find nothing to draw.
1962
2031
  useEffect(() => {
1963
2032
  if (still || typeof requestAnimationFrame !== "function") return undefined;
1964
- let raf = 0, timer = 0, last = -1, lastFps = FPS, air = true, gone = false;
2033
+ let raf = 0, timer = 0, last = -1, lastFps = FPS, air = true, gone = false, drawnAt = -Infinity;
1965
2034
  const tick = () => {
1966
2035
  raf = 0;
1967
2036
  if (gone || globalThis.document?.hidden || !scene.current) return;
1968
2037
  const fps = scene.current.fps || FPS;
1969
2038
  const ms = now(), frame = Math.floor((ms / 1000) * fps); // the clock the trips started on
1970
- if (scene.current.dirty || frame !== last || fps !== lastFps || air) { scene.current.dirty = false; last = frame; lastFps = fps; air = draw(ms); }
2039
+ const due = air && ms - drawnAt >= 1000 / AIR_FPS - 4; // a 60/120 Hz screen: every 2nd/4th frame
2040
+ if (scene.current.dirty || frame !== last || fps !== lastFps || due) { scene.current.dirty = false; last = frame; lastFps = fps; drawnAt = ms; air = draw(ms); }
1971
2041
  if (air) { raf = requestAnimationFrame(tick); return; }
1972
2042
  const wait = Math.max(1, Math.ceil(((frame + 1) * 1000) / fps - ms)); // until the next frame starts
1973
2043
  if (fps > FPS && wait <= 16) { raf = requestAnimationFrame(tick); return; }
@@ -2484,8 +2554,9 @@ export function Office({ view, traffic, q = "", lease, onOpen, assetUrl, assetIm
2484
2554
  const tipText = tipDesk ? nodeText(tipDesk.node) : null;
2485
2555
  // #2661: the card's person (gone from the office, filtered out or the office changed: it closes).
2486
2556
  const cardOf = card ? people.find((d) => d.key === card && d.node.i) || null : null;
2487
- cardDesk.current = cardOf ? { name: cardOf.node.name, box: cardOf.box, walks: zones && !overview, skin: cardOf.skin } : null;
2557
+ cardDesk.current = cardOf ? { name: cardOf.node.name, state: cardOf.node.state, box: cardOf.box, walks: zones && !overview, skin: cardOf.skin } : null;
2488
2558
  useEffect(() => { if (card && !cardOf) setCard(null); }, [card, !!cardOf]);
2559
+ useEffect(() => { walkNow.current?.(); }, [cardOf ? cardOf.node.name : null]); // stop there now; walk again once it closes
2489
2560
  const closeCard = () => {
2490
2561
  setCard(null);
2491
2562
  const from = cardFrom.current; cardFrom.current = null;
@@ -2621,6 +2692,8 @@ export function Office({ view, traffic, q = "", lease, onOpen, assetUrl, assetIm
2621
2692
  ${packs.map((pk) => html`<option key=${`pack:${pk.id}`} value=${pk.id}>${pk.name}</option>`)}
2622
2693
  </select></label>` : null}
2623
2694
  <label class="check oo-hide-asleep"><input type="checkbox" checked=${hideAsleep} onChange=${() => { const v = !hideAsleep; store.saveHideAsleep(v); setHideAsleep(v); setTip(null); }} /><span>${to("hideAsleep")}</span></label>
2695
+ <label class="check oo-hide-names"><input type="checkbox" checked=${namesOff} onChange=${() => { const v = !namesOff; store.saveNamesOff(v); setNamesOff(v); }} /><span>${to("hideNames")}</span></label>
2696
+ <label class="check oo-hide-mini"><input type="checkbox" checked=${miniOff} onChange=${() => { const v = !miniOff; store.saveMiniOff(v); setMiniOff(v); }} /><span>${to("hideMini")}</span></label>
2624
2697
  ${zones && !overview && !shared ? html`<label class="check oo-play"><input type="checkbox" checked=${playOn && !still} disabled=${still}
2625
2698
  onChange=${() => { const v = !playOn; store.savePlayOn(v); setPlayOn(v); }} /><span>${to("playOn")}</span>${playStillOff ? html`<span class="muted oo-note oo-play-still">${to("playMotionOff")}</span>` : null}</label>` : null}
2626
2699
  ${zones || overview ? html`<label class="check oo-night"><input type="checkbox" checked=${nightOn} onChange=${() => { const v = !nightOn; store.saveNightOn(v); setNightOn(v); }} /><span>${to("nightOn")}</span></label>` : null}
@@ -2649,8 +2722,15 @@ export function Office({ view, traffic, q = "", lease, onOpen, assetUrl, assetIm
2649
2722
  ${hasActions ? html`<hr class="oo-sheet-rule" />` : null}${actionItems}`;
2650
2723
  // A room's dropdown hangs from the zoom stack's top, inside the stage (which clips): it is never taller than the
2651
2724
  // stage's room below its top (Prism #3556 P2: a 340 px stage); a longer list scrolls.
2725
+ // The bar's dropdown hangs below the bar: never past the window's bottom either (#4466: a longer list, a short window).
2652
2726
  const fitPop = (el) => {
2653
- if (!el || !roomGear || !stageRef.current || typeof el.getBoundingClientRect !== "function") return;
2727
+ if (!el || typeof el.getBoundingClientRect !== "function") return;
2728
+ if (!roomGear) {
2729
+ const vh = globalThis.innerHeight;
2730
+ if (vh > 0) el.style.maxHeight = `${Math.min(popMaxHeight(vh, el.getBoundingClientRect().top), Math.floor(vh * 0.7), 480)}px`;
2731
+ return;
2732
+ }
2733
+ if (!stageRef.current) return;
2654
2734
  const st = stageRef.current.getBoundingClientRect(), top = el.getBoundingClientRect().top;
2655
2735
  if (st && st.height > 0) el.style.maxHeight = `${popMaxHeight(st.bottom, top)}px`;
2656
2736
  };
@@ -2706,6 +2786,7 @@ export function Office({ view, traffic, q = "", lease, onOpen, assetUrl, assetIm
2706
2786
  // #4379 review: the tags it covers (or uncovers) are judged at the next frame; a still scene draws one now.
2707
2787
  if (was !== el && scene.current) { scene.current.dirty = true; const go = () => (still ? draw(0) : loop.current?.wake()); if (typeof requestAnimationFrame === "function") requestAnimationFrame(go); else go(); } }}
2708
2788
  onChat=${onOpen ? () => { const n = cardOf.node.name; setCard(null); open(n); } : null} onFind=${findCard} onClose=${closeCard}
2789
+ rename=${onOpen && !readOnly ? { value: renames[cardOf.node.name] || "", save: (v) => setRenames(store.saveRename(cardOf.node.name, v)) } : null}
2709
2790
  onReact=${play ? (kind) => {
2710
2791
  const n = cardOf.node.name;
2711
2792
  if (kind === "feed" && !ASLEEP.has(cardOf.node.state) && !cardOf.box.night) {
@@ -2765,14 +2846,14 @@ export function Office({ view, traffic, q = "", lease, onOpen, assetUrl, assetIm
2765
2846
  : snackDrag.kind === "place" ? html`<span class="oo-snack-hint">${to("snackPlace")}</span>` : null}
2766
2847
  </div>` : null}
2767
2848
  ${fs ? html`<div class="oo-fs-bar">${oneOffice ? null : officeSelect("oo-fs-office")}${carChrome()}</div>` : null}
2768
- <svg ref=${miniRef} class="oc-mini oo-mini" viewBox=${`0 0 ${Math.max(1, L.width)} ${Math.max(1, L.height)}`} aria-hidden="true" onClick=${onMini}>
2849
+ ${miniOff ? null : html`<svg ref=${miniRef} class="oc-mini oo-mini" viewBox=${`0 0 ${Math.max(1, L.width)} ${Math.max(1, L.height)}`} aria-hidden="true" onClick=${onMini}>
2769
2850
  <title>${to("overview")}</title>
2770
2851
  <rect class="oo-mini-matte" x=${-L.width} y=${-L.height} width=${L.width * 3} height=${L.height * 3} fill=${matte} />
2771
2852
  <rect class="oo-mini-scene" x="0" y="0" width=${L.width} height=${L.height} />
2772
2853
  ${miniRects.map((r) => html`<rect key=${r.key} class="oo-mini-room" x=${r.x} y=${r.y} width=${r.w} height=${r.h} />`)}
2773
2854
  ${people.map((d) => html`<circle key=${d.key} class=${`oo-mini-dot st-${d.node.state}${q && hits(d.node, q) ? " match" : ""}`} cx=${d.dot.x} cy=${d.dot.y} r=${dotR} />`)}
2774
2855
  <rect ref=${miniViewRef} class="oc-mini-view oo-mini-view" />
2775
- </svg>
2856
+ </svg>`}
2776
2857
  </div>
2777
2858
  ${zoneList.length ? html`<div class="oo-zone-pills" role="group" aria-label=${to("zones")} ref=${pillsRef} onScroll=${pillsCue}>
2778
2859
  <button type="button" class="btn btn-sm oo-zone-all" onClick=${() => fit()}>${to("zoneAll")}</button>
@@ -20,6 +20,11 @@ import { AgentTag } from "./fleet-task-run.js";
20
20
  import { WhoCard } from "./fleet-task-owner.js";
21
21
  import { insertAtTrigger, triggerAt, withoutCode } from "./trigger-complete.js";
22
22
  import { dateTimeText } from "/assets/clock-text.js";
23
+ import { FileList } from "./fleet-task-files.js";
24
+ import { MdBody, commentHtml, decorateCode, storedWrap } from "./fleet-task-md.js";
25
+
26
+ // The Markdown pieces moved to fleet-task-md.js (the card's fields draw them too); these stay importable from here.
27
+ export { MdBody, commentHtml, decorateCode };
23
28
 
24
29
  export const TIMELINE_FILTERS = ["all", "comments", "log", "history"];
25
30
  const RANK = { event: 0, log: 1, comment: 2 }; // at one instant: the move first, then the words that came with it
@@ -34,7 +39,8 @@ const when = (iso) => { const n = Date.parse(iso); return Number.isFinite(n) ? n
34
39
  */
35
40
  export function timelineOf(detail) {
36
41
  const out = [];
37
- for (const e of (detail && detail.comments) || []) out.push({ key: `c${e.id}`, type: "comment", at: e.at, who: e.author, by: e.authorKind || "", text: e.text, kind: e.kind, authorKind: e.authorKind });
42
+ const files = (detail && detail.attachments) || [];
43
+ for (const e of (detail && detail.comments) || []) out.push({ key: `c${e.id}`, type: "comment", at: e.at, who: e.author, by: e.authorKind || "", text: e.text, kind: e.kind, authorKind: e.authorKind, files: files.filter((f) => f.entryId === e.id) });
38
44
  for (const e of (detail && detail.logs) || []) out.push({ key: `l${e.id}`, type: "log", at: e.at, who: e.author, by: e.authorKind || "", text: e.text });
39
45
  for (const ev of (detail && detail.history) || []) {
40
46
  if (ev.type === "commented" || ev.type === "reordered") continue;
@@ -116,12 +122,6 @@ export function dayLabel(iso, now = Date.now()) {
116
122
  return d.toLocaleDateString(lang() === "zh-TW" ? "zh-TW" : "en-US", { weekday: "short", month: "short", day: "numeric", ...(sameYear ? {} : { year: "numeric" }) });
117
123
  }
118
124
 
119
- /** A comment's text as the chat draws a message (Markdown, escaped first); the plain text when the renderer is not there. */
120
- const commentHtml = (text) => {
121
- const r = globalThis.AgendChatRender;
122
- return r && typeof r.renderMarkdown === "function" ? { __html: r.renderMarkdown(text) } : null;
123
- };
124
-
125
125
  /**
126
126
  * The stream's items (pure: tests import it): what people and agents SAY — a comment, a progress note — is a card each; the
127
127
  * system's lines (history) between two cards are a run, of any length, and a run is folded into one "› N activities" row at first
@@ -143,80 +143,6 @@ export function streamOf(entries, group = true) {
143
143
 
144
144
  const timeOf = (entry) => html`<time class="muted tl-time" dateTime=${entry.at} title=${fullTime(entry.at)}>${relTime(entry.at)}</time>`;
145
145
 
146
- // ── A comment's text as the chat draws a message ─────────────
147
-
148
- /** The chat's copy: the clipboard, else a hidden text area (a plain-http page has no clipboard API). */
149
- async function copyText(text) {
150
- try { if (navigator.clipboard && globalThis.isSecureContext) { await navigator.clipboard.writeText(text); return true; } } catch { /* fall back */ }
151
- const ta = document.createElement("textarea"); ta.value = text; ta.setAttribute("readonly", ""); ta.className = "offscreen";
152
- document.body.appendChild(ta); ta.select();
153
- let ok = false; try { ok = document.execCommand("copy"); } catch { ok = false; }
154
- ta.remove();
155
- return ok;
156
- }
157
- const storedWrap = () => { try { return localStorage.getItem("agend_code_wrap") === "1"; } catch { return false; } };
158
-
159
- /**
160
- * Code blocks as the chat's thread draws them (chat-thread.js `decorateCode`, the same classes, so the same sheet styles them):
161
- * a header with the language, Wrap and Copy, and a block of more than CODE_FOLD_LINES lines folded until opened. Built from nodes.
162
- */
163
- export function decorateCode(root) {
164
- if (!root || typeof root.querySelectorAll !== "function") return;
165
- const doc = root.ownerDocument;
166
- const R = globalThis.AgendChatRender;
167
- const limit = R && Number.isFinite(R.CODE_FOLD_LINES) ? R.CODE_FOLD_LINES : 30;
168
- const lineCount = R && typeof R.lineCount === "function" ? R.lineCount : (c) => String(c).split("\n").length;
169
- for (const pre of root.querySelectorAll("pre")) {
170
- if (pre.parentNode && pre.parentNode.classList && pre.parentNode.classList.contains("codeblock")) continue;
171
- const box = doc.createElement("div"); box.className = "codeblock";
172
- const head = doc.createElement("div"); head.className = "cb-head";
173
- const lang = doc.createElement("span"); lang.className = "cb-lang"; lang.textContent = pre.dataset.lang || "text";
174
- const wrap = doc.createElement("button"); wrap.type = "button"; wrap.className = "chip-btn"; wrap.dataset.act = "toggleWrap"; wrap.textContent = t("chat.wrap");
175
- const copy = doc.createElement("button"); copy.type = "button"; copy.className = "chip-btn"; copy.dataset.act = "copyCode"; copy.textContent = t("chat.copy");
176
- head.append(lang, wrap, copy);
177
- pre.replaceWith(box); box.append(head, pre);
178
- const lines = lineCount(pre.textContent);
179
- if (lines > limit) {
180
- box.classList.add("folded");
181
- const more = doc.createElement("button"); more.type = "button"; more.className = "cb-more"; more.dataset.act = "toggleFold";
182
- more.dataset.lines = String(lines); more.textContent = t("chat.showAll", lines);
183
- box.append(more);
184
- }
185
- }
186
- }
187
-
188
- /** A click on one of a decorated block's buttons (Copy, Wrap, Show all), as the chat's thread answers it. */
189
- async function onCodeClick(e) {
190
- const el = e.target && e.target.closest ? e.target.closest("[data-act]") : null;
191
- if (!el) return;
192
- const act = el.dataset.act;
193
- if (act === "copyCode") {
194
- const pre = el.closest(".codeblock") && el.closest(".codeblock").querySelector("pre");
195
- if (!pre) return;
196
- const ok = await copyText(pre.textContent);
197
- const was = el.dataset.label || el.textContent; el.dataset.label = was;
198
- el.textContent = t(ok ? "chat.copied" : "chat.copyFailed");
199
- setTimeout(() => { el.textContent = was; }, 1200);
200
- } else if (act === "toggleWrap") {
201
- const stream = el.closest(".tl");
202
- if (!stream) return;
203
- const on = stream.classList.toggle("wrap-code");
204
- try { localStorage.setItem("agend_code_wrap", on ? "1" : "0"); } catch { /* this page only */ }
205
- } else if (act === "toggleFold") {
206
- const box = el.closest(".codeblock");
207
- if (!box) return;
208
- const folded = box.classList.toggle("folded");
209
- el.textContent = !folded ? t("chat.showLess") : t("chat.showAll", el.dataset.lines);
210
- }
211
- }
212
-
213
- /** A comment's body: the chat's Markdown, its code blocks decorated as the chat's are. */
214
- function MdBody({ body }) {
215
- const ref = useRef(null);
216
- useEffect(() => { decorateCode(ref.current); });
217
- return html`<div class="tl-body md" ref=${ref} onClick=${onCodeClick} dangerouslySetInnerHTML=${body}></div>`;
218
- }
219
-
220
146
  /**
221
147
  * One entry. A comment and a progress note are each a card (the same: a head with the avatar — an instance's with its state
222
148
  * dot —, the name, an "Agent" badge, a tag for what it is, and the time; the text under the name); a history line is a thin row
@@ -236,7 +162,8 @@ function Entry({ entry, describe, who }) {
236
162
  ${entry.kind === "reject" ? html`<span class="tb-tag st-blocked">${t("taskcard.rejectTag")}</span>` : null}
237
163
  ${entry.kind === "approve" ? html`<span class="tb-tag st-done">${t("taskcard.approveTag")}</span>` : null}
238
164
  ${time}</div>
239
- ${body ? html`<${MdBody} body=${body} />` : html`<div class="tl-body">${entry.text}</div>`}</li>`;
165
+ ${body ? html`<${MdBody} body=${body} />` : html`<div class="tl-body">${entry.text}</div>`}
166
+ ${entry.files && entry.files.length ? html`<${FileList} files=${entry.files} cls="tl-files" />` : null}</li>`;
240
167
  }
241
168
  if (entry.type === "log") {
242
169
  return html`<li class=${`tl-item tl-card tl-log${mark}`}>