@songsid/agend 2.4.0-beta.22 → 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.
- package/dist/agent-cli-instructions.md +4 -3
- package/dist/agent-cli.js +32 -2
- package/dist/agent-cli.js.map +1 -1
- package/dist/agent-file-read.js +2 -2
- package/dist/agent-file-read.js.map +1 -1
- package/dist/agent-whats-new.js +17 -1
- package/dist/agent-whats-new.js.map +1 -1
- package/dist/auth-api.d.ts +2 -0
- package/dist/auth-api.js +5 -2
- package/dist/auth-api.js.map +1 -1
- package/dist/authority/web-authority.d.ts +17 -3
- package/dist/authority/web-authority.js +56 -3
- package/dist/authority/web-authority.js.map +1 -1
- package/dist/backend/claude-code.d.ts +15 -0
- package/dist/backend/claude-code.js +8 -3
- package/dist/backend/claude-code.js.map +1 -1
- package/dist/backend/claude-mcp-carry.d.ts +63 -0
- package/dist/backend/claude-mcp-carry.js +242 -0
- package/dist/backend/claude-mcp-carry.js.map +1 -0
- package/dist/build-provenance.json +1 -1
- package/dist/channel/mcp-tools.js +15 -7
- package/dist/channel/mcp-tools.js.map +1 -1
- package/dist/classic-channel-manager.d.ts +1 -1
- package/dist/classic-channel-manager.js +2 -2
- package/dist/classic-channel-manager.js.map +1 -1
- package/dist/config-validator.js +6 -0
- package/dist/config-validator.js.map +1 -1
- package/dist/contact-auth-api.js +3 -1
- package/dist/contact-auth-api.js.map +1 -1
- package/dist/contact-auth-service.js +1 -1
- package/dist/contact-auth-service.js.map +1 -1
- package/dist/contact-auth-store.d.ts +28 -2
- package/dist/contact-auth-store.js +72 -4
- package/dist/contact-auth-store.js.map +1 -1
- package/dist/contact-change-proposals.d.ts +18 -1
- package/dist/contact-change-proposals.js +38 -4
- package/dist/contact-change-proposals.js.map +1 -1
- package/dist/contact-state-view.d.ts +103 -0
- package/dist/contact-state-view.js +80 -0
- package/dist/contact-state-view.js.map +1 -0
- package/dist/daemon.d.ts +11 -0
- package/dist/daemon.js +66 -15
- package/dist/daemon.js.map +1 -1
- package/dist/dashboard-permissions.d.ts +8 -0
- package/dist/dashboard-permissions.js +8 -0
- package/dist/dashboard-permissions.js.map +1 -1
- package/dist/delivery-outbox.d.ts +15 -1
- package/dist/delivery-outbox.js +60 -2
- package/dist/delivery-outbox.js.map +1 -1
- package/dist/fleet-manager.d.ts +157 -15
- package/dist/fleet-manager.js +522 -78
- package/dist/fleet-manager.js.map +1 -1
- package/dist/general-knowledge/skills/admin/SKILL.md +52 -0
- package/dist/general-knowledge/skills/concepts/SKILL.md +31 -21
- package/dist/general-knowledge/skills/credential-profiles/SKILL.md +6 -0
- package/dist/general-knowledge/skills/cross-instance-messaging/SKILL.md +6 -3
- package/dist/general-knowledge/skills/fleet-config/SKILL.md +3 -3
- package/dist/general-knowledge/skills/hub/SKILL.md +6 -1
- package/dist/general-knowledge/skills/instance-lifecycle/SKILL.md +1 -1
- package/dist/general-knowledge/skills/task-board/SKILL.md +17 -0
- package/dist/general-knowledge/skills/web-appearance/SKILL.md +4 -0
- package/dist/general-knowledge/skills/web-dashboard/SKILL.md +75 -12
- package/dist/general-knowledge/skills/worker-collaboration/SKILL.md +1 -1
- package/dist/general-role.d.ts +1 -1
- package/dist/general-role.js +1 -0
- package/dist/general-role.js.map +1 -1
- package/dist/hub/client.js +6 -1
- package/dist/hub/client.js.map +1 -1
- package/dist/hub/compose/member.d.ts +2 -1
- package/dist/hub/compose/member.js +3 -2
- package/dist/hub/compose/member.js.map +1 -1
- package/dist/hub/compose/server.js +2 -1
- package/dist/hub/compose/server.js.map +1 -1
- package/dist/hub/http/compose.js +5 -0
- package/dist/hub/http/compose.js.map +1 -1
- package/dist/hub/protocol.d.ts +21 -0
- package/dist/hub/protocol.js +3 -0
- package/dist/hub/protocol.js.map +1 -1
- package/dist/hub/question-close-model.d.ts +17 -0
- package/dist/hub/question-close-model.js +7 -0
- package/dist/hub/question-close-model.js.map +1 -0
- package/dist/hub/representative.d.ts +5 -0
- package/dist/hub/representative.js +51 -1
- package/dist/hub/representative.js.map +1 -1
- package/dist/hub/rooms/direct-view.js +1 -0
- package/dist/hub/rooms/direct-view.js.map +1 -1
- package/dist/hub/rooms/types.d.ts +1 -1
- package/dist/hub/rooms.d.ts +3 -0
- package/dist/hub/rooms.js +27 -1
- package/dist/hub/rooms.js.map +1 -1
- package/dist/hub/server.js +6 -1
- package/dist/hub/server.js.map +1 -1
- package/dist/hub/types.d.ts +2 -2
- package/dist/human-delivery-receipts.d.ts +12 -2
- package/dist/human-delivery-receipts.js +19 -4
- package/dist/human-delivery-receipts.js.map +1 -1
- package/dist/instance-lifecycle.d.ts +2 -0
- package/dist/instance-lifecycle.js +29 -1
- package/dist/instance-lifecycle.js.map +1 -1
- package/dist/instructions.d.ts +1 -1
- package/dist/instructions.js +1 -1
- package/dist/instructions.js.map +1 -1
- package/dist/locale.js +110 -12
- package/dist/locale.js.map +1 -1
- package/dist/needs-you-hub.d.ts +3 -0
- package/dist/needs-you-hub.js +31 -5
- package/dist/needs-you-hub.js.map +1 -1
- package/dist/needs-you.d.ts +16 -1
- package/dist/needs-you.js +7 -1
- package/dist/needs-you.js.map +1 -1
- package/dist/office-share-page.js +2 -2
- package/dist/office-share-page.js.map +1 -1
- package/dist/office-share.js +2 -1
- package/dist/office-share.js.map +1 -1
- package/dist/outbound-handlers.d.ts +4 -0
- package/dist/outbound-handlers.js +69 -11
- package/dist/outbound-handlers.js.map +1 -1
- package/dist/outbound-schemas.d.ts +5 -1
- package/dist/outbound-schemas.js +10 -7
- package/dist/outbound-schemas.js.map +1 -1
- package/dist/public-web-gateway.js +21 -0
- package/dist/public-web-gateway.js.map +1 -1
- package/dist/reply-buttons-controller.d.ts +2 -1
- package/dist/reply-buttons-controller.js +1 -1
- package/dist/reply-buttons-controller.js.map +1 -1
- package/dist/request-context-compatibility.d.ts +20 -0
- package/dist/request-context-compatibility.js +74 -0
- package/dist/request-context-compatibility.js.map +1 -0
- package/dist/request-context-protocol.d.ts +137 -0
- package/dist/request-context-protocol.js +38 -0
- package/dist/request-context-protocol.js.map +1 -0
- package/dist/request-context-store.d.ts +25 -0
- package/dist/request-context-store.js +137 -0
- package/dist/request-context-store.js.map +1 -0
- package/dist/scheduler/db.js +26 -0
- package/dist/scheduler/db.js.map +1 -1
- package/dist/scheduler/task-board-text.d.ts +2 -0
- package/dist/scheduler/task-board-text.js +12 -0
- package/dist/scheduler/task-board-text.js.map +1 -1
- package/dist/scheduler/task-board.d.ts +102 -2
- package/dist/scheduler/task-board.js +242 -24
- package/dist/scheduler/task-board.js.map +1 -1
- package/dist/scheduler/task-files.d.ts +80 -0
- package/dist/scheduler/task-files.js +357 -0
- package/dist/scheduler/task-files.js.map +1 -0
- package/dist/settings-api.d.ts +2 -0
- package/dist/settings-api.js +6 -1
- package/dist/settings-api.js.map +1 -1
- package/dist/settings-baseline.d.ts +1 -0
- package/dist/settings-baseline.js +1 -1
- package/dist/settings-baseline.js.map +1 -1
- package/dist/settings-effect.d.ts +2 -0
- package/dist/settings-effect.js +5 -1
- package/dist/settings-effect.js.map +1 -1
- package/dist/task-attach-client.d.ts +43 -0
- package/dist/task-attach-client.js +125 -0
- package/dist/task-attach-client.js.map +1 -0
- package/dist/task-board-tool.d.ts +12 -0
- package/dist/task-board-tool.js +107 -6
- package/dist/task-board-tool.js.map +1 -1
- package/dist/task-file-limits.d.ts +15 -0
- package/dist/task-file-limits.js +21 -0
- package/dist/task-file-limits.js.map +1 -0
- package/dist/tool-permissions.d.ts +32 -0
- package/dist/tool-permissions.js +64 -1
- package/dist/tool-permissions.js.map +1 -1
- package/dist/types.d.ts +6 -0
- package/dist/ui/accounts-keepalive.js +2 -1
- package/dist/ui/agent-details-settings.js +7 -5
- package/dist/ui/agent-who-can-use-strings.js +125 -0
- package/dist/ui/agent-who-can-use.js +238 -0
- package/dist/ui/chat-activity.js +2 -1
- package/dist/ui/chat-pins.js +2 -1
- package/dist/ui/claude-credentials.js +2 -1
- package/dist/ui/contact-auth-strings.js +28 -17
- package/dist/ui/contact-authorizations.js +6 -4
- package/dist/ui/contact-needs.js +6 -1
- package/dist/ui/contact-permissions.js +6 -4
- package/dist/ui/contact-tool-groups.js +1 -1
- package/dist/ui/contact-verify-need.js +46 -0
- package/dist/ui/fleet-cache.js +2 -1
- package/dist/ui/fleet-office-card.js +23 -5
- package/dist/ui/fleet-office-editor.js +5 -5
- package/dist/ui/fleet-office-pack.d.ts +10 -0
- package/dist/ui/fleet-office-pack.js +65 -2
- package/dist/ui/fleet-office-skin.js +52 -14
- package/dist/ui/fleet-office-store.js +33 -2
- package/dist/ui/fleet-office-vehicles.js +130 -0
- package/dist/ui/fleet-office-zones.js +27 -10
- package/dist/ui/fleet-office.js +128 -40
- package/dist/ui/fleet-org.js +6 -1
- package/dist/ui/fleet-tab-icons.js +19 -0
- package/dist/ui/fleet-task-activity.js +11 -83
- package/dist/ui/fleet-task-archive.js +111 -0
- package/dist/ui/fleet-task-card.js +6 -4
- package/dist/ui/fleet-task-common.js +2 -2
- package/dist/ui/fleet-task-edit.js +8 -1
- package/dist/ui/fleet-task-files.js +196 -0
- package/dist/ui/fleet-task-md.js +98 -0
- package/dist/ui/fleet-task-menu.js +1 -1
- package/dist/ui/fleet-task-stats.js +2 -2
- package/dist/ui/fleet-task-view.js +14 -9
- package/dist/ui/fleet-tasks.js +42 -18
- package/dist/ui/fleet-usage.js +2 -1
- package/dist/ui/hub-admin-overview.js +2 -1
- package/dist/ui/hub-agent-intro.js +2 -1
- package/dist/ui/hub-assistant-admin.js +2 -1
- package/dist/ui/hub-directory-notices.js +2 -1
- package/dist/ui/hub-enrolment-code.js +2 -1
- package/dist/ui/hub-my-agents.js +2 -1
- package/dist/ui/hub-quick-pairing.js +2 -1
- package/dist/ui/hub-role-audit.js +2 -1
- package/dist/ui/hub-role-forms.js +3 -2
- package/dist/ui/hub-role-view.js +3 -2
- package/dist/ui/hub-roles.js +2 -1
- package/dist/ui/hub-room-agent-strings.js +2 -1
- package/dist/ui/hub-room-list.js +2 -1
- package/dist/ui/hub-room-owner-requests.js +2 -1
- package/dist/ui/hub-room-pins.js +2 -1
- package/dist/ui/hub-room-strings.js +2 -2
- package/dist/ui/hub-room-thread.js +1 -1
- package/dist/ui/log-row.js +4 -3
- package/dist/ui/office-share-dialog.js +2 -1
- package/dist/ui/office-share-page.js +2 -1
- package/dist/ui/page-share-dialog.js +3 -2
- package/dist/ui/panel-chat.js +2 -1
- package/dist/ui/panel-details.js +5 -2
- package/dist/ui/panel-fleet.js +10 -5
- package/dist/ui/panel-hub.js +2 -1
- package/dist/ui/panel-needs.js +34 -6
- package/dist/ui/panel-notices.js +2 -1
- package/dist/ui/panel-runtimes.js +2 -1
- package/dist/ui/panel-settings.js +15 -1
- package/dist/ui/panel-windows-cli.js +3 -2
- package/dist/ui/runtime-cli-install.js +2 -1
- package/dist/ui/settings-appearance.js +2 -1
- package/dist/ui/settings-guests.js +4 -3
- package/dist/ui/settings-hub-member-address.js +2 -1
- package/dist/ui/settings-hub-setup.js +2 -1
- package/dist/ui/settings-hub-web-address.js +2 -1
- package/dist/ui/settings-hub.js +2 -1
- package/dist/ui/settings-registry.js +1 -0
- package/dist/ui/settings-shared-strings.js +9 -0
- package/dist/ui/settings-shared.js +6 -1
- package/dist/ui/settings-update.js +2 -1
- package/dist/ui/settings-web-authority.js +2 -1
- package/dist/ui/shared/agent-sheet.js +2 -1
- package/dist/ui/shared/app-i18n.js +2 -2
- package/dist/ui/shared/app-needs.js +8 -1
- package/dist/ui/shared/app-session.js +4 -3
- package/dist/ui/shared/app-shell.js +6 -2
- package/dist/ui/shared/app.css +93 -11
- package/dist/ui/shared/chat-strings.js +4 -4
- package/dist/ui/shared/chat-time.js +7 -4
- package/dist/ui/shared/clock-text.js +57 -0
- package/dist/ui/shared/device-roles.js +6 -5
- package/dist/ui/shared/instance-nav.js +17 -22
- package/dist/ui/shared/task-board.css +64 -0
- package/dist/ui/shared/usage-dialog.js +2 -1
- package/dist/ui/shared/view-strings.js +0 -14
- package/dist/ui/shared/web-authorize.js +3 -2
- package/dist/ui/subagent-row.js +2 -1
- package/dist/web-api.d.ts +18 -2
- package/dist/web-api.js +159 -27
- package/dist/web-api.js.map +1 -1
- package/dist/web-login.d.ts +6 -1
- package/dist/web-login.js +8 -3
- package/dist/web-login.js.map +1 -1
- package/dist/web-office-acts.d.ts +16 -0
- package/dist/web-office-acts.js +27 -9
- package/dist/web-office-acts.js.map +1 -1
- package/dist/web-office-pack-read.js +1 -1
- package/dist/web-office-pack-read.js.map +1 -1
- package/dist/web-office-skins.d.ts +5 -3
- package/dist/web-office-skins.js +20 -16
- package/dist/web-office-skins.js.map +1 -1
- package/dist/web-session-authorization.d.ts +3 -0
- package/dist/web-session-authorization.js +1 -1
- package/dist/web-session-authorization.js.map +1 -1
- package/dist/web-settings-patch.d.ts +27 -0
- package/dist/web-settings-patch.js +67 -0
- package/dist/web-settings-patch.js.map +1 -1
- package/dist/workflow-templates/default.md +1 -0
- package/package.json +1 -1
package/dist/ui/fleet-office.js
CHANGED
|
@@ -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
|
-
|
|
487
|
-
|
|
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,16 +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
|
-
|
|
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
|
-
|
|
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
|
|
549
|
+
const titleDraws = []; // M-3722: and redrawn over a bubble's tail that crosses one
|
|
519
550
|
const up = still ? [] : p.flights.frame(ms, p.L);
|
|
520
551
|
// Mail from another office (#2564): flying in at the door, or on the floor until its person picks it up.
|
|
521
552
|
const post = still || !p.mail || !p.zones ? [] : p.mail.frame(ms > 0 ? ms : now(), p.L, p.walkers);
|
|
522
|
-
let walking = false;
|
|
553
|
+
let walking = false, carsOn = false;
|
|
523
554
|
if (p.zones) {
|
|
524
555
|
// Furniture under the people; the people (nearest last) with the furniture whose depth is "y" among them, by base
|
|
525
556
|
// y (a tie: the item first, the person in front); furniture over them; things in the air; the pack's foreground
|
|
@@ -537,6 +568,9 @@ export function drawPart(ctx, p, a, ox, oy, ms, still, hot, env, tagsOff = false
|
|
|
537
568
|
});
|
|
538
569
|
if (changed && typeof p.onSnacksChanged === "function") p.onSnacksChanged();
|
|
539
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;
|
|
540
574
|
const people = p.desks.map((d) => {
|
|
541
575
|
const at = p.walkers.at(d.node.name, t) || { ...d.seat, walking: false };
|
|
542
576
|
if (at.walking) walking = true;
|
|
@@ -545,7 +579,11 @@ export function drawPart(ctx, p, a, ox, oy, ms, still, hot, env, tagsOff = false
|
|
|
545
579
|
const furniture = strollFurniture(p.night ? nightFurniture(sk.pack.furniture) : sk.pack.furniture, (k) => p.walkers.at(k, t));
|
|
546
580
|
if (furniture.some((f) => f.walking)) walking = true;
|
|
547
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;
|
|
548
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 })),
|
|
549
587
|
...placedSnacks.map((sn) => ({ y: sn.y, k: 0.5, sn })),
|
|
550
588
|
...people.map((q) => ({ y: q.at.y, k: 1, p: q })),
|
|
551
589
|
...(p.ghosts ? ghostsOf(sk.pack, people).map((g) => ({ y: g.y, k: 1, g })) : []),
|
|
@@ -600,7 +638,9 @@ export function drawPart(ctx, p, a, ox, oy, ms, still, hot, env, tagsOff = false
|
|
|
600
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);
|
|
601
639
|
for (const it of post) if (it.t === 0) sk.drawProp(ctx, it, ms, env); // a letter on the floor: under the people
|
|
602
640
|
let heldPerson = null;
|
|
603
|
-
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; }
|
|
604
644
|
if (f) { sk.drawFurniture(ctx, f, f.asleep || live.active.has(f.id), ms, env); continue; }
|
|
605
645
|
if (sn) {
|
|
606
646
|
const sdef = p.snacksById && p.snacksById.get(sn.snackId);
|
|
@@ -617,6 +657,7 @@ export function drawPart(ctx, p, a, ox, oy, ms, still, hot, env, tagsOff = false
|
|
|
617
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; }
|
|
618
658
|
if (heldName && q.look.name === heldName) { heldPerson = q; continue; } // M-3445 (#4267): drawn lifted on top below
|
|
619
659
|
if (live.hidden.has(q.look.name)) continue; // #2698: drawn as the item (never while walking)
|
|
660
|
+
if (offView(q.at)) continue;
|
|
620
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 } };
|
|
621
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.
|
|
622
663
|
const posed = actPosed(p, q.look);
|
|
@@ -646,7 +687,8 @@ export function drawPart(ctx, p, a, ox, oy, ms, still, hot, env, tagsOff = false
|
|
|
646
687
|
}
|
|
647
688
|
for (const it of up) sk.drawProp(ctx, it, ms, env);
|
|
648
689
|
for (const it of post) if (it.t > 0) sk.drawProp(ctx, it, ms, env);
|
|
649
|
-
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);
|
|
650
692
|
// Who found no spot in an area: a count in its corner (never over its name).
|
|
651
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);
|
|
652
694
|
// M-3539: an area's name a figure stands on is written again over the people (休息區 under a crowd's heads).
|
|
@@ -663,9 +705,12 @@ export function drawPart(ctx, p, a, ox, oy, ms, still, hot, env, tagsOff = false
|
|
|
663
705
|
const over = p.L.over || new Set();
|
|
664
706
|
const pinned = (q) => q.d.key === hot || !!q.look.match;
|
|
665
707
|
const crowded = (q) => over.has(q.d.area) && !pinned(q);
|
|
666
|
-
|
|
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);
|
|
667
712
|
const keep = [...titles.map((x) => x.box), ...(env.keepClear || [])];
|
|
668
|
-
titleBoxes.push(...titles.map((x) => x.box));
|
|
713
|
+
titleBoxes.push(...titles.map((x) => x.box)); titleDraws.push(...titles);
|
|
669
714
|
const taken = [];
|
|
670
715
|
const touches = (b) => taken.some((o) => overlaps(b, o)) || keep.some((o) => overlaps(b, o));
|
|
671
716
|
// Under an open card (`p.cover`, bitmap px; #4379 review): no tag, its level badge included, rather than a piece of one
|
|
@@ -702,7 +747,7 @@ export function drawPart(ctx, p, a, ox, oy, ms, still, hot, env, tagsOff = false
|
|
|
702
747
|
const FULL_TRIES = [[0, false], [TAG_ROW, false], [0, true], [COMPACT_ROW, true]];
|
|
703
748
|
const tagOrder = people.filter((q) => !(live.hidden.has(q.look.name) && q.look.name !== heldName) && tagged(q))
|
|
704
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);
|
|
705
|
-
for (const { q, rank } of tagOrder) place(q.at.x, q.at.y, q
|
|
750
|
+
for (const { q, rank } of tagOrder) place(q.at.x, q.at.y, tagLook(q), FULL_TRIES, rank === 0);
|
|
706
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.
|
|
707
752
|
// #2698: an item hiding its people carries their tags too, in one row at its tag point (its own first; each keeps
|
|
708
753
|
// its place in the row while another's tag is left out), and their bubbles, over its picture. The tags drawn are
|
|
@@ -716,7 +761,7 @@ export function drawPart(ctx, p, a, ox, oy, ms, still, hot, env, tagsOff = false
|
|
|
716
761
|
}
|
|
717
762
|
const order = new Map((f.activeFor || []).map((n, i) => [n, i]));
|
|
718
763
|
on.sort((x, y) => (order.get(x.look.name) ?? 0) - (order.get(y.look.name) ?? 0));
|
|
719
|
-
const row = tagRow(ctx, f.x, f.y, [...(f.label ? [npcLook(p, f)] : []), ...on.map(
|
|
764
|
+
const row = tagRow(ctx, f.x, f.y, [...(f.label ? [npcLook(p, f)] : []), ...on.map(tagLook)]);
|
|
720
765
|
const top = f.sprite ? Math.min(f.y - 50, stripBox(f.activeSprite || f.sprite, f.x, f.y).y + 2) : f.y - 50;
|
|
721
766
|
for (const [i, r] of row.entries()) {
|
|
722
767
|
const q = f.label ? on[i - 1] : on[i];
|
|
@@ -797,27 +842,33 @@ export function drawPart(ctx, p, a, ox, oy, ms, still, hot, env, tagsOff = false
|
|
|
797
842
|
const ar = b && sk.ownCharacters && p.zones && sp.area != null ? p.L.areas && p.L.areas[sp.area] : null;
|
|
798
843
|
if (ar && ar.rect) { const bx = bubbleBox(ctx, sp.x, sp.y, b.text), min = ar.rect.y + BUBBLE_IN_AREA; if (bx.y < min) sp = { ...sp, y: sp.y + (min - bx.y) }; }
|
|
799
844
|
if (b) bubbles.push({ key: sp.look.name, area: sp.area, state: sp.look.state, calling: CALLING.has(sp.look.state), rank: own ? 0 : scText ? 1 : bubbleRank(sp.look.state), shown: b.shown, ...(raSays ? { keep: true } : {}),
|
|
800
|
-
box: bubbleBox(ctx, sp.x, sp.y, b.text), tail: { x: sp.x, y: sp.y }, sp, b });
|
|
845
|
+
box: bubbleBox(ctx, sp.x, sp.y, b.text), ...(CALLING.has(sp.look.state) ? { flipBox: bubbleBox(ctx, sp.x, sp.y, b.text, 0, true) } : {}), tail: { x: sp.x, y: sp.y }, sp, b });
|
|
801
846
|
}
|
|
802
847
|
// A crowded area speaks less (thinBubbles: calls, then work, a few at most); no bubble covers a name tag. `defer`
|
|
803
848
|
// (All offices): drawn after every tile, unclipped, so a bubble at a tile's edge is whole.
|
|
804
849
|
// M-3648: an area's name blocks chatter; a call may cover it (placeBubbles' `soft`): a name never keeps a call out.
|
|
805
|
-
|
|
850
|
+
// M-3722: and 3 px of air off a name, not just its plate (a call beside 求救區 touched its corner). A number here, not an
|
|
851
|
+
// import: a page still holding the older fleet-office-zones.js keeps linking (it just ignores it).
|
|
852
|
+
const placed = placeBubbles(thinBubbles(bubbles, p.zones ? p.L.over : null), 22, tags, titleBoxes, 3);
|
|
806
853
|
// M-3533 R2c: and after placing (which lifts a bubble clear of another), a room character's bubble still stays in its area.
|
|
807
|
-
const inArea = (sp, text, dy) => {
|
|
854
|
+
const inArea = (sp, text, dy, flip) => {
|
|
808
855
|
const ar = sk.ownCharacters && p.zones && sp.area != null ? p.L.areas && p.L.areas[sp.area] : null;
|
|
809
856
|
if (!ar || !ar.rect || !dy) return dy;
|
|
810
|
-
const over = ar.rect.y + BUBBLE_IN_AREA - bubbleBox(ctx, sp.x, sp.y, text, -dy).y;
|
|
857
|
+
const over = ar.rect.y + BUBBLE_IN_AREA - bubbleBox(ctx, sp.x, sp.y, text, -dy, flip).y;
|
|
811
858
|
return over > 0 ? Math.max(0, dy - over) : dy;
|
|
812
859
|
};
|
|
813
|
-
const say = () => { T(); for (const { sp, b, dy: lifted } of placed) {
|
|
814
|
-
const text = [...b.text].slice(0, b.shown).join(""), dy = inArea(sp, b.text, lifted);
|
|
815
|
-
sk.drawBubble(ctx, sp.x, sp.y, text, env, -dy);
|
|
860
|
+
const say = () => { T(); const tails = []; for (const { sp, b, dy: lifted, flip = false } of placed) {
|
|
861
|
+
const text = [...b.text].slice(0, b.shown).join(""), dy = inArea(sp, b.text, lifted, flip);
|
|
862
|
+
sk.drawBubble(ctx, sp.x, sp.y, text, env, -dy, flip);
|
|
863
|
+
if (text) { const box = bubbleBox(ctx, sp.x, sp.y, text, -dy, flip); tails.push({ x: sp.x - 1, y: box.y + box.h, w: 9, h: Math.max(0, sp.y - (box.y + box.h)) }); }
|
|
816
864
|
if (bubbleHits && text) {
|
|
817
|
-
const box = bubbleBox(ctx, sp.x, sp.y, text, -dy);
|
|
865
|
+
const box = bubbleBox(ctx, sp.x, sp.y, text, -dy, flip);
|
|
818
866
|
bubbleHits.push({ name: sp.look.name, box: { x: ox + box.x * a, y: oy + box.y * a, w: box.w * a, h: box.h * a } });
|
|
819
867
|
}
|
|
820
868
|
}
|
|
869
|
+
// M-3722: a bubble keeps its box off an area's name (placeBubbles); a tail that still crosses one has the name written
|
|
870
|
+
// again over it (as over a figure standing on it, M-3539), so the name always reads whole.
|
|
871
|
+
if (sk.drawAreaTitle) for (const { ar, box } of titleDraws) if (tails.some((t) => overlaps(t, box))) sk.drawAreaTitle(ctx, ar, env);
|
|
821
872
|
const bl = sk.pack && sk.pack.dialogBox ? sk.pack.dialogBox.bubble : null;
|
|
822
873
|
const im = bl && bl.frame && typeof sk.picture === "function" ? sk.picture(bl.frame, () => {}) : null;
|
|
823
874
|
for (const { sp, said } of replies) {
|
|
@@ -842,7 +893,7 @@ export function drawPart(ctx, p, a, ox, oy, ms, still, hot, env, tagsOff = false
|
|
|
842
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 } });
|
|
843
894
|
} };
|
|
844
895
|
if (defer) defer.push(say); else say();
|
|
845
|
-
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());
|
|
846
897
|
}
|
|
847
898
|
/**
|
|
848
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),
|
|
@@ -958,7 +1009,7 @@ function ensureDialogueStyle() {
|
|
|
958
1009
|
link.href = assetUrl("/assets/office-dialogue.css");
|
|
959
1010
|
link.setAttribute("data-office-dialogue-css", "1"); doc.head.appendChild(link);
|
|
960
1011
|
}
|
|
961
|
-
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,
|
|
962
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 }) {
|
|
963
1014
|
// M-3253: on a phone the page above (fleet-canvas.js) puts a ⋯ in its bar: `more` is that sheet open, `onMore(open)`;
|
|
964
1015
|
// `live` / `onLive` its Live toggle, which moves into the sheet. Without one (a share link's page) the bar stays.
|
|
@@ -1000,6 +1051,11 @@ export function Office({ view, traffic, q = "", lease, onOpen, assetUrl, assetIm
|
|
|
1000
1051
|
const [styleErr, setStyleErr] = useState("");
|
|
1001
1052
|
const style = canEdit ? hostStyle ?? ownStyle ?? "cozy" : ownStyle ?? hostStyle ?? "cozy";
|
|
1002
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]);
|
|
1003
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).
|
|
1004
1060
|
const [nightOn, setNightOn] = useState(() => store.nightOn());
|
|
1005
1061
|
const [keyOpen, setKeyOpen] = useState(() => store.keyOpen());
|
|
@@ -1062,6 +1118,7 @@ export function Office({ view, traffic, q = "", lease, onOpen, assetUrl, assetIm
|
|
|
1062
1118
|
fsRef.current = fs;
|
|
1063
1119
|
const flights = useMemo(() => createFlights(), []);
|
|
1064
1120
|
const walkers = useMemo(() => createWalkers(), []);
|
|
1121
|
+
const riders = useMemo(() => createRiders(), []);
|
|
1065
1122
|
const seatsRef = useRef(new Map()); // the zones layout's last seats: kept where they can be
|
|
1066
1123
|
const seatPrefsRef = useRef({}), seatKeyRef = useRef(""), seatDropRef = useRef(null);
|
|
1067
1124
|
const placedRef = useRef(null); // M-3539: the office and style the walkers were last placed for
|
|
@@ -1276,7 +1333,8 @@ export function Office({ view, traffic, q = "", lease, onOpen, assetUrl, assetIm
|
|
|
1276
1333
|
const size = { w: width, h: stageH > 0 ? stageH : SIZE0.h };
|
|
1277
1334
|
// The canvas bitmap's px per CSS px: the device's, unless the bitmap would be too big to paint (backingScale). Zoom
|
|
1278
1335
|
// snaps to whole numbers of these (fleet-office-view.js), so a pixel-level view maps a logical unit onto whole pixels.
|
|
1279
|
-
|
|
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));
|
|
1280
1338
|
|
|
1281
1339
|
// #2554: All offices — chosen, and at least two offices stored (else the whole fleet, as an office gone is).
|
|
1282
1340
|
const overview = choice === ALL_ID && overviewOk(stored);
|
|
@@ -1461,14 +1519,31 @@ export function Office({ view, traffic, q = "", lease, onOpen, assetUrl, assetIm
|
|
|
1461
1519
|
// An act's walk; not someone in bed for the night (#2568: bedtime wins, as for mail).
|
|
1462
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); }
|
|
1463
1521
|
for (const [name, at] of mail.targets(L, t)) to.set(name, at);
|
|
1464
|
-
for (const [name, at] of snacks.targets(t)) to.set(name, at);
|
|
1465
|
-
const held = hold.held(); // M-3293: carried: where the pointer is, no walk
|
|
1466
|
-
if (held) to.set(held.name, held.at);
|
|
1467
1522
|
// M-3539: a new office or style (a room's office reads its style after it opens) puts everyone at their place at
|
|
1468
1523
|
// once: walking there from the old one's seats drew the asleep standing in the help desk for seconds.
|
|
1469
1524
|
const placed = `${officeKey}\n${skin.id}`, fresh = placedRef.current !== placed;
|
|
1470
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
|
|
1471
1545
|
walkers.sync(to, t, L, still, fresh);
|
|
1546
|
+
for (const [name, seat] of boarding) walkers.ride(name, seat);
|
|
1472
1547
|
// Reduced motion has no loop: drawn again here, or an act's walk (set after the scene was drawn) never shows.
|
|
1473
1548
|
if (still) { if (scene.current && !globalThis.document?.hidden) draw(0); } else loop.current?.wake();
|
|
1474
1549
|
};
|
|
@@ -1477,7 +1552,7 @@ export function Office({ view, traffic, q = "", lease, onOpen, assetUrl, assetIm
|
|
|
1477
1552
|
if (still) return undefined;
|
|
1478
1553
|
const h = setInterval(go, WANDER.TICK);
|
|
1479
1554
|
return () => clearInterval(h);
|
|
1480
|
-
}, [L, wander, mail, skin, night, actsHere, visitMemo, ownArea]);
|
|
1555
|
+
}, [L, wander, mail, skin, night, actsHere, visitMemo, ownArea, riders]);
|
|
1481
1556
|
// …and in each tile on a zones style; the traffic within a tile is its own, between tiles the overview's.
|
|
1482
1557
|
useEffect(() => {
|
|
1483
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);
|
|
@@ -1680,6 +1755,7 @@ export function Office({ view, traffic, q = "", lease, onOpen, assetUrl, assetIm
|
|
|
1680
1755
|
store.saveFitMode(officeKey, next); setFitRev((n) => n + 1);
|
|
1681
1756
|
fit(next);
|
|
1682
1757
|
};
|
|
1758
|
+
useEffect(() => { if (!miniOff) mark(); }, [miniOff]); // shown again: placed on the view at once
|
|
1683
1759
|
/** + / −: the next pixel level about the stage's middle. */
|
|
1684
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)); };
|
|
1685
1761
|
/** Bring a box (logical units) into view, unchanged when it already is. */
|
|
@@ -1798,18 +1874,18 @@ export function Office({ view, traffic, q = "", lease, onOpen, assetUrl, assetIm
|
|
|
1798
1874
|
? Math.max(0, ...tiles.map((tl) => packMaxFps(tl.skin && tl.skin.pack)))
|
|
1799
1875
|
: packMaxFps(skin && skin.pack);
|
|
1800
1876
|
const fps = Math.max(FPS, Math.min(30, Math.ceil(maxPackFps)));
|
|
1801
|
-
const base = { ctx, ratio, BW, BH, matte, env, fps, dirty: true };
|
|
1877
|
+
const base = { ctx, ratio, BW, BH, matte, env, fps, dirty: true, namesOff };
|
|
1802
1878
|
if (overview) {
|
|
1803
1879
|
// Each tile a scene of its own, where the overview puts it (arranged.tiles, in the same order).
|
|
1804
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) }));
|
|
1805
1881
|
scene.current = { ...base, overview: true, parts, lay: arranged };
|
|
1806
1882
|
} else {
|
|
1807
|
-
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,
|
|
1808
1884
|
hold: play ? hold : null, seatDrop: seatDropRef,
|
|
1809
1885
|
snacks: play ? snacks : null, snacksById, ownArea, snackDrop: snackDropRef, onSnackClaim, onSnacksChanged: () => walkNow.current?.() } };
|
|
1810
1886
|
}
|
|
1811
1887
|
if (still) draw(0); else loop.current?.wake();
|
|
1812
|
-
}, [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]);
|
|
1813
1889
|
|
|
1814
1890
|
/** One frame at `ms` (0: still); whether anything is moving (in the air, or someone walking). */
|
|
1815
1891
|
function draw(ms) {
|
|
@@ -1838,7 +1914,7 @@ export function Office({ view, traffic, q = "", lease, onOpen, assetUrl, assetIm
|
|
|
1838
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;
|
|
1839
1915
|
} else s.part.cover = null;
|
|
1840
1916
|
const e0 = clocked(""), kc = keepClearOf(canvasRef.current, v);
|
|
1841
|
-
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);
|
|
1842
1918
|
if (seenClips) clipClocks.current.prune(seenClips);
|
|
1843
1919
|
return drawDialogue(ctx, s, ms) || moved;
|
|
1844
1920
|
}
|
|
@@ -1853,7 +1929,7 @@ export function Office({ view, traffic, q = "", lease, onOpen, assetUrl, assetIm
|
|
|
1853
1929
|
ctx.save();
|
|
1854
1930
|
ctx.setTransform(1, 0, 0, 1, 0, 0);
|
|
1855
1931
|
ctx.beginPath(); ctx.rect(tx, ty, tw, th); ctx.clip();
|
|
1856
|
-
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;
|
|
1857
1933
|
ctx.restore();
|
|
1858
1934
|
ctx.setTransform(1, 0, 0, 1, 0, 0);
|
|
1859
1935
|
ctx.strokeStyle = env.pal.border; ctx.lineWidth = 1;
|
|
@@ -1949,18 +2025,19 @@ export function Office({ view, traffic, q = "", lease, onOpen, assetUrl, assetIm
|
|
|
1949
2025
|
}, [dlgOn, dlgVisible, dlgSay, width, phone, ratio]);
|
|
1950
2026
|
|
|
1951
2027
|
// The loop: drawing only when the frame (FPS) changed or something is in the air; stopped while the tab is hidden,
|
|
1952
|
-
// gone with the view. Office review: while something walks or flies,
|
|
2028
|
+
// gone with the view. Office review: while something walks or flies, a frame every display frame up to AIR_FPS (the
|
|
1953
2029
|
// motion is smooth); when nothing moves, the poses change at most FPS times a second, so the loop sleeps (a timer)
|
|
1954
2030
|
// until the next frame's start instead of waking at the display's rate only to find nothing to draw.
|
|
1955
2031
|
useEffect(() => {
|
|
1956
2032
|
if (still || typeof requestAnimationFrame !== "function") return undefined;
|
|
1957
|
-
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;
|
|
1958
2034
|
const tick = () => {
|
|
1959
2035
|
raf = 0;
|
|
1960
2036
|
if (gone || globalThis.document?.hidden || !scene.current) return;
|
|
1961
2037
|
const fps = scene.current.fps || FPS;
|
|
1962
2038
|
const ms = now(), frame = Math.floor((ms / 1000) * fps); // the clock the trips started on
|
|
1963
|
-
|
|
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); }
|
|
1964
2041
|
if (air) { raf = requestAnimationFrame(tick); return; }
|
|
1965
2042
|
const wait = Math.max(1, Math.ceil(((frame + 1) * 1000) / fps - ms)); // until the next frame starts
|
|
1966
2043
|
if (fps > FPS && wait <= 16) { raf = requestAnimationFrame(tick); return; }
|
|
@@ -2477,8 +2554,9 @@ export function Office({ view, traffic, q = "", lease, onOpen, assetUrl, assetIm
|
|
|
2477
2554
|
const tipText = tipDesk ? nodeText(tipDesk.node) : null;
|
|
2478
2555
|
// #2661: the card's person (gone from the office, filtered out or the office changed: it closes).
|
|
2479
2556
|
const cardOf = card ? people.find((d) => d.key === card && d.node.i) || null : null;
|
|
2480
|
-
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;
|
|
2481
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
|
|
2482
2560
|
const closeCard = () => {
|
|
2483
2561
|
setCard(null);
|
|
2484
2562
|
const from = cardFrom.current; cardFrom.current = null;
|
|
@@ -2614,6 +2692,8 @@ export function Office({ view, traffic, q = "", lease, onOpen, assetUrl, assetIm
|
|
|
2614
2692
|
${packs.map((pk) => html`<option key=${`pack:${pk.id}`} value=${pk.id}>${pk.name}</option>`)}
|
|
2615
2693
|
</select></label>` : null}
|
|
2616
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>
|
|
2617
2697
|
${zones && !overview && !shared ? html`<label class="check oo-play"><input type="checkbox" checked=${playOn && !still} disabled=${still}
|
|
2618
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}
|
|
2619
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}
|
|
@@ -2642,8 +2722,15 @@ export function Office({ view, traffic, q = "", lease, onOpen, assetUrl, assetIm
|
|
|
2642
2722
|
${hasActions ? html`<hr class="oo-sheet-rule" />` : null}${actionItems}`;
|
|
2643
2723
|
// A room's dropdown hangs from the zoom stack's top, inside the stage (which clips): it is never taller than the
|
|
2644
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).
|
|
2645
2726
|
const fitPop = (el) => {
|
|
2646
|
-
if (!el ||
|
|
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;
|
|
2647
2734
|
const st = stageRef.current.getBoundingClientRect(), top = el.getBoundingClientRect().top;
|
|
2648
2735
|
if (st && st.height > 0) el.style.maxHeight = `${popMaxHeight(st.bottom, top)}px`;
|
|
2649
2736
|
};
|
|
@@ -2699,6 +2786,7 @@ export function Office({ view, traffic, q = "", lease, onOpen, assetUrl, assetIm
|
|
|
2699
2786
|
// #4379 review: the tags it covers (or uncovers) are judged at the next frame; a still scene draws one now.
|
|
2700
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(); } }}
|
|
2701
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}
|
|
2702
2790
|
onReact=${play ? (kind) => {
|
|
2703
2791
|
const n = cardOf.node.name;
|
|
2704
2792
|
if (kind === "feed" && !ASLEEP.has(cardOf.node.state) && !cardOf.box.night) {
|
|
@@ -2758,14 +2846,14 @@ export function Office({ view, traffic, q = "", lease, onOpen, assetUrl, assetIm
|
|
|
2758
2846
|
: snackDrag.kind === "place" ? html`<span class="oo-snack-hint">${to("snackPlace")}</span>` : null}
|
|
2759
2847
|
</div>` : null}
|
|
2760
2848
|
${fs ? html`<div class="oo-fs-bar">${oneOffice ? null : officeSelect("oo-fs-office")}${carChrome()}</div>` : null}
|
|
2761
|
-
|
|
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}>
|
|
2762
2850
|
<title>${to("overview")}</title>
|
|
2763
2851
|
<rect class="oo-mini-matte" x=${-L.width} y=${-L.height} width=${L.width * 3} height=${L.height * 3} fill=${matte} />
|
|
2764
2852
|
<rect class="oo-mini-scene" x="0" y="0" width=${L.width} height=${L.height} />
|
|
2765
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} />`)}
|
|
2766
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} />`)}
|
|
2767
2855
|
<rect ref=${miniViewRef} class="oc-mini-view oo-mini-view" />
|
|
2768
|
-
</svg
|
|
2856
|
+
</svg>`}
|
|
2769
2857
|
</div>
|
|
2770
2858
|
${zoneList.length ? html`<div class="oo-zone-pills" role="group" aria-label=${to("zones")} ref=${pillsRef} onScroll=${pillsCue}>
|
|
2771
2859
|
<button type="button" class="btn btn-sm oo-zone-all" onClick=${() => fit()}>${to("zoneAll")}</button>
|
package/dist/ui/fleet-org.js
CHANGED
|
@@ -78,7 +78,12 @@ export function nodeText(n) {
|
|
|
78
78
|
export function buildOrgView(org, app) {
|
|
79
79
|
const live = new Map((app.instances || []).map((i) => [i.name, i]));
|
|
80
80
|
const needs = new Map();
|
|
81
|
-
|
|
81
|
+
// M-3720 (the user, 11-25): a ClassicBot room's "can switch to restricted mode" suggestion is a low-key hint (Needs you
|
|
82
|
+
// folds them into one quiet group), not a call — it alone never sends the room to the Help desk. Every other item does.
|
|
83
|
+
for (const item of Array.isArray(app.needs) ? app.needs : []) {
|
|
84
|
+
if (item && item.type === "contact" && item.reason === "contact_restricted_suggestion") continue;
|
|
85
|
+
needs.set(item.instance, (needs.get(item.instance) || 0) + 1);
|
|
86
|
+
}
|
|
82
87
|
const awaiting = app.awaiting || {};
|
|
83
88
|
const info = (org && org.instances) || {};
|
|
84
89
|
const node = (name) => {
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// M-3722 (#4453 review): Fleet's tabs are icons only on a phone, so each tab has its own icon — Cache, Usage and Host
|
|
2
|
+
// health no longer share "chart". Those three drawings live here, not in the shared ui-icons.js: a page still holding an
|
|
3
|
+
// older ui-icons.js (cached by URL) would draw nothing for an unknown name, and a phone's tab, its name hidden, would be
|
|
4
|
+
// blank. Every other tab's icon is the shared one.
|
|
5
|
+
import { html } from "/assets/app-html.js";
|
|
6
|
+
import { Icon } from "/assets/ui-icons.js";
|
|
7
|
+
|
|
8
|
+
const OWN = {
|
|
9
|
+
database: () => html`<ellipse cx="12" cy="5" rx="9" ry="3"/><path d="M3 5v14c0 1.66 4 3 9 3s9-1.34 9-3V5"/><path d="M3 12c0 1.66 4 3 9 3s9-1.34 9-3"/>`,
|
|
10
|
+
gauge: () => html`<path d="M12 14l4-4"/><path d="M3.34 19a10 10 0 1 1 17.32 0"/>`,
|
|
11
|
+
pulse: () => html`<path d="M22 12h-4l-3 9L9 3l-3 9H2"/>`,
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
/** A Fleet tab's icon: one of the three drawn here, else the shared Icon (same size, stroke and look). */
|
|
15
|
+
export function TabIcon({ name, size = 16 }) {
|
|
16
|
+
if (!OWN[name]) return html`<${Icon} name=${name} size=${size} />`;
|
|
17
|
+
return html`<svg class="icon" width=${size} height=${size} viewBox="0 0 24 24" fill="none" stroke="currentColor"
|
|
18
|
+
stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false">${OWN[name]()}</svg>`;
|
|
19
|
+
}
|