@songsid/agend 2.4.0-beta.20 → 2.4.0-beta.21
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 +1 -1
- package/dist/backend/claude-carry.d.ts +11 -0
- package/dist/backend/claude-carry.js +88 -6
- package/dist/backend/claude-carry.js.map +1 -1
- package/dist/build-provenance.json +1 -1
- package/dist/channel/mcp-tools.js +6 -4
- package/dist/channel/mcp-tools.js.map +1 -1
- package/dist/contact-change-proposals.d.ts +47 -0
- package/dist/contact-change-proposals.js +131 -0
- package/dist/contact-change-proposals.js.map +1 -0
- package/dist/fleet-manager.d.ts +25 -1
- package/dist/fleet-manager.js +166 -3
- package/dist/fleet-manager.js.map +1 -1
- package/dist/general-knowledge/skills/concepts/SKILL.md +2 -1
- package/dist/general-knowledge/skills/hub/SKILL.md +39 -2
- package/dist/general-knowledge/skills/task-board/SKILL.md +4 -0
- package/dist/general-knowledge/skills/web-appearance/SKILL.md +1 -1
- package/dist/general-knowledge/skills/web-dashboard/SKILL.md +16 -6
- package/dist/hub/agent-pictures-model.d.ts +147 -0
- package/dist/hub/agent-pictures-model.js +64 -0
- package/dist/hub/agent-pictures-model.js.map +1 -0
- package/dist/hub/agent-pictures.d.ts +52 -0
- package/dist/hub/agent-pictures.js +202 -0
- package/dist/hub/agent-pictures.js.map +1 -0
- package/dist/hub/client.d.ts +2 -0
- package/dist/hub/client.js +16 -2
- package/dist/hub/client.js.map +1 -1
- package/dist/hub/compose/member.d.ts +10 -2
- package/dist/hub/compose/member.js +32 -8
- package/dist/hub/compose/member.js.map +1 -1
- package/dist/hub/compose/server.d.ts +1 -0
- package/dist/hub/compose/server.js +4 -2
- package/dist/hub/compose/server.js.map +1 -1
- package/dist/hub/direct-posts-model.d.ts +1 -0
- package/dist/hub/direct-posts-model.js +2 -0
- package/dist/hub/direct-posts-model.js.map +1 -0
- package/dist/hub/direct-posts.d.ts +36 -0
- package/dist/hub/direct-posts.js +145 -0
- package/dist/hub/direct-posts.js.map +1 -0
- package/dist/hub/http/compose.d.ts +2 -0
- package/dist/hub/http/compose.js +155 -19
- package/dist/hub/http/compose.js.map +1 -1
- package/dist/hub/http/core.d.ts +9 -1
- package/dist/hub/http/core.js +21 -1
- package/dist/hub/http/core.js.map +1 -1
- package/dist/hub/http/schema.js +6 -0
- package/dist/hub/http/schema.js.map +1 -1
- package/dist/hub/join/service.d.ts +2 -0
- package/dist/hub/join/service.js +7 -3
- package/dist/hub/join/service.js.map +1 -1
- package/dist/hub/mcp/policy.d.ts +1 -1
- package/dist/hub/member/agent-pictures.d.ts +43 -0
- package/dist/hub/member/agent-pictures.js +125 -0
- package/dist/hub/member/agent-pictures.js.map +1 -0
- package/dist/hub/member/direct-rooms.d.ts +9 -0
- package/dist/hub/member/direct-rooms.js +14 -0
- package/dist/hub/member/direct-rooms.js.map +1 -0
- package/dist/hub/member/room-post.d.ts +11 -10
- package/dist/hub/member/room-post.js +51 -7
- package/dist/hub/member/room-post.js.map +1 -1
- package/dist/hub/policy.d.ts +11 -2
- package/dist/hub/policy.js +60 -7
- package/dist/hub/policy.js.map +1 -1
- package/dist/hub/protocol.d.ts +123 -1
- package/dist/hub/protocol.js +17 -7
- package/dist/hub/protocol.js.map +1 -1
- package/dist/hub/representative.d.ts +28 -0
- package/dist/hub/representative.js +127 -12
- package/dist/hub/representative.js.map +1 -1
- package/dist/hub/rooms/agents.d.ts +2 -0
- package/dist/hub/rooms/agents.js +14 -3
- package/dist/hub/rooms/agents.js.map +1 -1
- package/dist/hub/rooms/direct-view.d.ts +3 -2
- package/dist/hub/rooms/direct-view.js +23 -8
- package/dist/hub/rooms/direct-view.js.map +1 -1
- package/dist/hub/rooms/office.d.ts +9 -0
- package/dist/hub/rooms/office.js +10 -2
- package/dist/hub/rooms/office.js.map +1 -1
- package/dist/hub/rooms/service.d.ts +32 -1
- package/dist/hub/rooms/service.js +37 -3
- package/dist/hub/rooms/service.js.map +1 -1
- package/dist/hub/rooms/types.d.ts +5 -2
- package/dist/hub/rooms.d.ts +9 -0
- package/dist/hub/rooms.js +97 -26
- package/dist/hub/rooms.js.map +1 -1
- package/dist/hub/runtime.d.ts +1 -1
- package/dist/hub/server.js +19 -2
- package/dist/hub/server.js.map +1 -1
- package/dist/hub/session-directory-transition.d.ts +1 -0
- package/dist/hub/session-directory-transition.js +15 -9
- package/dist/hub/session-directory-transition.js.map +1 -1
- package/dist/hub/session-limits.d.ts +58 -0
- package/dist/hub/session-limits.js +121 -0
- package/dist/hub/session-limits.js.map +1 -0
- package/dist/hub/sessions.d.ts +1 -1
- package/dist/hub/sessions.js +13 -7
- package/dist/hub/sessions.js.map +1 -1
- package/dist/hub/settings-directory-decision.js +1 -1
- package/dist/hub/settings-directory-decision.js.map +1 -1
- package/dist/hub/types.d.ts +8 -2
- package/dist/hub-picture-reduce.d.ts +14 -0
- package/dist/hub-picture-reduce.js +49 -0
- package/dist/hub-picture-reduce.js.map +1 -0
- package/dist/hub-picture-worker.d.ts +1 -0
- package/dist/hub-picture-worker.js +11 -0
- package/dist/hub-picture-worker.js.map +1 -0
- package/dist/hub-report-target.d.ts +6 -0
- package/dist/hub-report-target.js +6 -0
- package/dist/hub-report-target.js.map +1 -1
- package/dist/locale.js +90 -2
- package/dist/locale.js.map +1 -1
- package/dist/needs-you.d.ts +4 -0
- package/dist/needs-you.js +2 -0
- package/dist/needs-you.js.map +1 -1
- package/dist/outbound-handlers.d.ts +4 -0
- package/dist/outbound-handlers.js +37 -4
- package/dist/outbound-handlers.js.map +1 -1
- package/dist/outbound-schemas.d.ts +2 -0
- package/dist/outbound-schemas.js +6 -4
- package/dist/outbound-schemas.js.map +1 -1
- package/dist/task-board-tool.d.ts +17 -0
- package/dist/task-board-tool.js +58 -6
- package/dist/task-board-tool.js.map +1 -1
- package/dist/tool-permissions.js +2 -2
- package/dist/tool-permissions.js.map +1 -1
- package/dist/ui/contact-tool-groups.js +1 -1
- package/dist/ui/fleet-canvas.js +2 -1
- package/dist/ui/fleet-office-card.js +20 -5
- package/dist/ui/fleet-office-dialogue.d.ts +6 -3
- package/dist/ui/fleet-office-dialogue.js +13 -3
- package/dist/ui/fleet-office-layout.js +13 -13
- package/dist/ui/fleet-office-model.js +3 -2
- package/dist/ui/fleet-office-overview.js +1 -1
- package/dist/ui/fleet-office-pack.d.ts +17 -7
- package/dist/ui/fleet-office-pack.js +106 -38
- package/dist/ui/fleet-office-play.js +11 -4
- package/dist/ui/fleet-office-skin.js +25 -11
- package/dist/ui/fleet-office-store.js +10 -1
- package/dist/ui/fleet-office-talk.js +423 -0
- package/dist/ui/fleet-office-view.js +26 -17
- package/dist/ui/fleet-office-zones.js +20 -12
- package/dist/ui/fleet-office.js +173 -44
- package/dist/ui/fleet-task-common.js +1 -1
- package/dist/ui/fleet-task-sort.js +88 -0
- package/dist/ui/fleet-task-view.js +38 -9
- package/dist/ui/fleet-tasks.js +47 -15
- package/dist/ui/hub-chat-store.js +4 -3
- package/dist/ui/hub-chat-strings.js +2 -0
- package/dist/ui/hub-client.js +3 -0
- package/dist/ui/hub-my-agents-strings.js +2 -2
- package/dist/ui/hub-my-agents.js +3 -0
- package/dist/ui/hub-room-composer.js +24 -4
- package/dist/ui/hub-room-members.js +7 -3
- package/dist/ui/hub-room-office.js +2 -1
- package/dist/ui/hub-room-presence.js +9 -0
- package/dist/ui/hub-room-strings.js +18 -2
- package/dist/ui/hub-room-thread.js +82 -13
- package/dist/ui/hub-room-working.js +37 -0
- package/dist/ui/hub-session-limits.js +79 -0
- package/dist/ui/panel-hub.js +41 -6
- package/dist/ui/panel-needs.js +28 -2
- package/dist/ui/shared/app.css +84 -3
- package/dist/ui/shared/chat-strings.js +1 -1
- package/dist/ui/shared/hub-owner.css +5 -0
- package/dist/ui/shared/hub-rooms-u2.css +3 -0
- package/dist/ui/shared/office-dialogue.css +110 -0
- package/dist/ui/shared/task-board.css +103 -7
- package/dist/web-api.d.ts +5 -0
- package/dist/web-api.js +29 -0
- package/dist/web-api.js.map +1 -1
- package/dist/web-office-skins.d.ts +8 -2
- package/dist/web-office-skins.js +33 -14
- package/dist/web-office-skins.js.map +1 -1
- package/dist/web-office-store.js +5 -3
- package/dist/web-office-store.js.map +1 -1
- package/package.json +1 -1
|
@@ -101,7 +101,7 @@ const CARD_CSS_PROPS = [
|
|
|
101
101
|
"--oo-card-bg", "--oo-card-border", "--oo-card-text", "--oo-card-muted", "--oo-card-accent",
|
|
102
102
|
"--oo-card-bar-track", "--oo-card-bar-fill", "--oo-card-tile-bg", "--oo-card-btn-bg", "--oo-card-btn-text",
|
|
103
103
|
"--oo-card-btn-primary-bg", "--oo-card-btn-primary-text", "--oo-card-radius", "--oo-card-w",
|
|
104
|
-
"--oo-card-avatar", "--oo-card-frame-pad",
|
|
104
|
+
"--oo-card-avatar", "--oo-card-frame-pad", "--oo-card-enter-ms",
|
|
105
105
|
];
|
|
106
106
|
|
|
107
107
|
function fgFor(bgHex, minRatio = 4.5, light = "#f6f4f0", dark = "#18181b") {
|
|
@@ -257,7 +257,9 @@ export function resolveCardSpec(packCard) {
|
|
|
257
257
|
scrim: s.backgroundImage && bgRef ? scrimRgba(bgRef, dark ? 0.56 : 0.72) : null,
|
|
258
258
|
} : null;
|
|
259
259
|
|
|
260
|
-
|
|
260
|
+
const motion = packCard.motion && packCard.motion.enter !== "none" ? packCard.motion : null;
|
|
261
|
+
if (motion) cssVars["--oo-card-enter-ms"] = `${motion.ms}ms`;
|
|
262
|
+
return { preset, layout, avatarPx, hideSet: new Set(layout.hide), cssVars, backdrop, motion };
|
|
261
263
|
}
|
|
262
264
|
|
|
263
265
|
/** Ordered visible rows for `model` under `spec`; never restores fields stripped by `cardModel` on share links. */
|
|
@@ -328,9 +330,11 @@ function drawPortraitAvatar(cv, im, W) {
|
|
|
328
330
|
* sheet (a phone); `place(el)`: the page positions the popover (beside the person, following them); `onChat` (none on
|
|
329
331
|
* a share link), `onFind`, `onClose`; M-3293: `onReact(kind)` — Pat and Feed (only where play is on; none on a share
|
|
330
332
|
* link); M-3433: optional `packCard`, `picture` (lazy image loader), `portrait` (src), `packScale`; M-3533: `action`
|
|
331
|
-
* ({ label, title, run }) the card's own main action, from the page (a Hub room's office: "@ it", to ask it in the chat)
|
|
333
|
+
* ({ label, title, run }) the card's own main action, from the page (a Hub room's office: "@ it", to ask it in the chat);
|
|
334
|
+
* M-3533 R2b: `photo` (src) the agent's identity-card picture (a Hub room's), drawn as the pack portrait is, in place of
|
|
335
|
+
* the figure once it loads; the figure while it loads or when it fails.
|
|
332
336
|
*/
|
|
333
|
-
export function OfficeCard({ model: m, avatar, sheet, place, onChat, onFind, onClose, onReact = null, tell = null, packCard = null, picture = null, portrait = null, packScale = 2, action = null }) {
|
|
337
|
+
export function OfficeCard({ model: m, avatar, sheet, place, onChat, onFind, onClose, onReact = null, tell = null, packCard = null, picture = null, portrait = null, packScale = 2, action = null, photo = null }) {
|
|
334
338
|
// `action`: one, or a list (M-3565: a Hub room's "@ it" and "Chat with it one-to-one"); the first is the primary button.
|
|
335
339
|
const actions = Array.isArray(action) ? action.filter(Boolean) : action ? [action] : [];
|
|
336
340
|
const actionButtons = actions.map((a, i) => html`<button key=${i} type="button" class=${`btn btn-sm ${i === 0 ? "btn-primary " : ""}oo-card-action`} title=${a.title || undefined} aria-label=${a.title || undefined} onClick=${a.run}>${a.label}</button>`);
|
|
@@ -339,6 +343,16 @@ export function OfficeCard({ model: m, avatar, sheet, place, onChat, onFind, onC
|
|
|
339
343
|
const spec = useMemo(() => resolveCardSpec(packCard), [packCard]);
|
|
340
344
|
const avatarPx = spec ? spec.avatarPx : 56;
|
|
341
345
|
const wantPortrait = !!(spec && spec.layout.avatarSource === "portrait" && portrait && typeof picture === "function");
|
|
346
|
+
const [photoIm, setPhotoIm] = useState(null);
|
|
347
|
+
useEffect(() => {
|
|
348
|
+
setPhotoIm(null);
|
|
349
|
+
if (!photo || typeof Image === "undefined") return undefined;
|
|
350
|
+
let live = true;
|
|
351
|
+
const im = new Image();
|
|
352
|
+
im.onload = () => { if (live) setPhotoIm(im); };
|
|
353
|
+
im.src = photo;
|
|
354
|
+
return () => { live = false; };
|
|
355
|
+
}, [photo]);
|
|
342
356
|
|
|
343
357
|
useLayoutEffect(() => {
|
|
344
358
|
const el = box.current;
|
|
@@ -358,6 +372,7 @@ export function OfficeCard({ model: m, avatar, sheet, place, onChat, onFind, onC
|
|
|
358
372
|
useEffect(() => {
|
|
359
373
|
const cv = canvas.current;
|
|
360
374
|
if (!cv) return;
|
|
375
|
+
if (photoIm && drawPortraitAvatar(cv, photoIm, avatarPx)) return;
|
|
361
376
|
if (wantPortrait) {
|
|
362
377
|
const im = picture(portrait, () => setPicRev((n) => n + 1));
|
|
363
378
|
if (im && drawPortraitAvatar(cv, im, avatarPx)) return;
|
|
@@ -494,7 +509,7 @@ export function OfficeCard({ model: m, avatar, sheet, place, onChat, onFind, onC
|
|
|
494
509
|
return null;
|
|
495
510
|
};
|
|
496
511
|
|
|
497
|
-
return html`<div ref=${box} class=${classes} data-preset=${spec.preset} role="dialog" aria-modal="false" aria-label=${tc("card", m.name)}
|
|
512
|
+
return html`<div ref=${box} class=${classes} data-preset=${spec.preset} data-enter=${spec.motion ? spec.motion.enter : undefined} role="dialog" aria-modal="false" aria-label=${tc("card", m.name)}
|
|
498
513
|
onPointerDown=${down} onPointerUp=${up} onPointerCancel=${() => { swipe.current = null; }}>
|
|
499
514
|
${spec.backdrop ? html`<canvas ref=${bgCanvas} class="oo-card-bg" aria-hidden="true"></canvas>` : null}
|
|
500
515
|
<div class="oo-card-body">
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
// Types for fleet-office-dialogue.js (#2861): the Office's dialogue box — the page's module, read by tests.
|
|
2
|
-
export const DLG: { TEXT_MAX: number; FRESH_MS: number; HOLD_MS: number; FADE_MS: number; SLIDE_MS: number; WAIT_MS: number; CPS: number; MAX: number };
|
|
2
|
+
export const DLG: { TEXT_MAX: number; FULL_MAX: number; FRESH_MS: number; HOLD_MS: number; FADE_MS: number; SLIDE_MS: number; WAIT_MS: number; CPS: number; MAX: number };
|
|
3
3
|
export interface DialogPerson { name: string; account: string | null }
|
|
4
|
-
export interface Conversation { id: number; instance: string; person: DialogPerson | null; text: string | null; reply: string | null; heardAt: number; answeredAt: number | null; shownAt: number | null; replyShownAt: number | null
|
|
4
|
+
export interface Conversation { id: number; instance: string; person: DialogPerson | null; text: string | null; full: string | null; reply: string | null; replyFull: string | null; heardAt: number; answeredAt: number | null; shownAt: number | null; replyShownAt: number | null;
|
|
5
|
+
/** The click-through box (talk "Dialogue box"): the page shown, when it began typing, when it was whole. */
|
|
6
|
+
page: number; pageAt: number | null; wholeAt?: number | null }
|
|
5
7
|
export interface DialogLayout {
|
|
6
8
|
narrow: boolean; box: { x: number; y: number; w: number; h: number };
|
|
7
9
|
portrait: { h: number; foot: number; maxW: number; left: number; right: number };
|
|
@@ -12,7 +14,8 @@ export function clip(text: unknown, max?: number): string;
|
|
|
12
14
|
export function createDialogue(): {
|
|
13
15
|
heard(instance: string, person: DialogPerson | null, text: string | null, t: number): Conversation | null;
|
|
14
16
|
answered(instance: string, text: string | null, t: number): Conversation | null;
|
|
15
|
-
sweep(t: number, still?: boolean): boolean; list(): Conversation[]; size(): number; rev(): number; clear(): void;
|
|
17
|
+
sweep(t: number, still?: boolean, hold?: boolean): boolean; list(): Conversation[]; size(): number; rev(): number; clear(): void;
|
|
18
|
+
drop(instance: string): void; skip(): boolean;
|
|
16
19
|
};
|
|
17
20
|
export function pickFront(list: Conversation[], shown: (name: string) => boolean, asleep: (name: string) => boolean): { front: Conversation | null; more: number };
|
|
18
21
|
export function messageOf(m: unknown, serverNow: number): ({ kind: "heard"; instance: string; person: DialogPerson; text: string; files: boolean } | { kind: "answered"; instance: string; text: string; files: boolean }) | null;
|
|
@@ -17,6 +17,8 @@ import { own, PORTRAIT_STATES } from "./fleet-office-pack.js";
|
|
|
17
17
|
|
|
18
18
|
export const DLG = {
|
|
19
19
|
TEXT_MAX: 120,
|
|
20
|
+
/** The whole line kept for the click-through box (talk "Dialogue box"): read page by page. */
|
|
21
|
+
FULL_MAX: 4000,
|
|
20
22
|
/** A message older than this on the server's clock is not news (a replay, a catch-up). */
|
|
21
23
|
FRESH_MS: 90_000,
|
|
22
24
|
/** How long an answer stays before it fades. */
|
|
@@ -58,7 +60,8 @@ export function createDialogue() {
|
|
|
58
60
|
heard(instance, person, text, t) {
|
|
59
61
|
if (typeof instance !== "string" || !instance) return null;
|
|
60
62
|
convs.delete(instance);
|
|
61
|
-
const c = { id: ++seq, instance, person: person || null, text: text == null ? null : clip(text),
|
|
63
|
+
const c = { id: ++seq, instance, person: person || null, text: text == null ? null : clip(text), full: text == null ? null : clip(text, DLG.FULL_MAX),
|
|
64
|
+
reply: null, replyFull: null, heardAt: t, answeredAt: null, shownAt: null, replyShownAt: null, page: 0, pageAt: null };
|
|
62
65
|
convs.set(instance, c);
|
|
63
66
|
while (convs.size > DLG.MAX) convs.delete(convs.keys().next().value);
|
|
64
67
|
rev++;
|
|
@@ -68,7 +71,9 @@ export function createDialogue() {
|
|
|
68
71
|
const c = convs.get(instance);
|
|
69
72
|
if (!c || c.answeredAt !== null) return null;
|
|
70
73
|
c.reply = text == null ? null : clip(text);
|
|
74
|
+
c.replyFull = text == null ? null : clip(text, DLG.FULL_MAX);
|
|
71
75
|
c.answeredAt = t;
|
|
76
|
+
c.page = 0; c.pageAt = null; c.wholeAt = null; // the reply reads from its first page
|
|
72
77
|
rev++;
|
|
73
78
|
return c;
|
|
74
79
|
},
|
|
@@ -78,11 +83,12 @@ export function createDialogue() {
|
|
|
78
83
|
* comes; an answer never shown (its agent not drawn here, or waiting in the queue): WAIT_MS after it came. A
|
|
79
84
|
* conversation never answered: WAIT_MS after it was heard.
|
|
80
85
|
*/
|
|
81
|
-
sweep(t, still = false) {
|
|
86
|
+
sweep(t, still = false, hold = false) {
|
|
82
87
|
let gone = false;
|
|
83
88
|
for (const [k, c] of convs) {
|
|
89
|
+
// `hold` (the click-through box): an answer shown stays until it is clicked away (drop).
|
|
84
90
|
const over = c.answeredAt === null ? t >= c.heardAt + DLG.WAIT_MS
|
|
85
|
-
: c.replyShownAt !== null ? t >= c.replyShownAt + DLG.HOLD_MS + (still ? 0 : DLG.FADE_MS) : t >= c.answeredAt + DLG.WAIT_MS;
|
|
91
|
+
: c.replyShownAt !== null ? !hold && t >= c.replyShownAt + DLG.HOLD_MS + (still ? 0 : DLG.FADE_MS) : t >= c.answeredAt + DLG.WAIT_MS;
|
|
86
92
|
if (over) { convs.delete(k); gone = true; }
|
|
87
93
|
}
|
|
88
94
|
if (gone) rev++;
|
|
@@ -92,6 +98,10 @@ export function createDialogue() {
|
|
|
92
98
|
size: () => convs.size,
|
|
93
99
|
rev: () => rev,
|
|
94
100
|
clear() { if (convs.size) { convs.clear(); rev++; } },
|
|
101
|
+
/** One conversation clicked away (the click-through box's last page). */
|
|
102
|
+
drop(instance) { if (convs.delete(instance)) rev++; },
|
|
103
|
+
/** Skip: every answered conversation goes now (those still waiting for a reply stay). */
|
|
104
|
+
skip() { let gone = false; for (const [k, c] of convs) if (c.answeredAt !== null) { convs.delete(k); gone = true; } if (gone) rev++; return gone; },
|
|
95
105
|
};
|
|
96
106
|
}
|
|
97
107
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// furniture, the door and the walkable graph's waypoints — and adds or removes waypoints and the corridors between
|
|
3
3
|
// them. The pack stays as it was uploaded: what differs from it is kept as the office's `overrides` (fleet-office-pack.js
|
|
4
4
|
// overridesBetween), saved with the whole list and the rev read (PUT /ui/offices; a change made meanwhile is a 409).
|
|
5
|
-
// Reset goes back to the pack's own positions. A "show coordinates" overlay draws the 1280×720
|
|
5
|
+
// Reset goes back to the pack's own positions. A "show coordinates" overlay draws the logical grid (1280×720, or the pack's own canvas).
|
|
6
6
|
//
|
|
7
7
|
// #2665: an item with a `night` (#2568) has a night handle too — its night strip drawn faint on the canvas (as the
|
|
8
8
|
// seats' figures, #2558), a moon, and a thin line to its day place. One that sleeps in place shows it on its day place
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
import { html, useEffect, useLayoutEffect, useMemo, useRef, useState } from "/assets/app-html.js";
|
|
25
25
|
import { t, register } from "/assets/app-i18n.js";
|
|
26
26
|
import { SidePanel } from "/assets/side-panel.js";
|
|
27
|
-
import {
|
|
27
|
+
import { canvasOf, overridesBetween, own } from "./fleet-office-pack.js";
|
|
28
28
|
import { dropPoint } from "./fleet-office-zones.js";
|
|
29
29
|
|
|
30
30
|
register("orgl", {
|
|
@@ -75,7 +75,7 @@ export function handlesOf(pack) {
|
|
|
75
75
|
out.push({ key: `night:${f.id}`, kind: "night", label: tl("night", f.id), x: n.x, y: n.y, day: { x: f.x, y: f.y }, inPlace: !n.own });
|
|
76
76
|
}
|
|
77
77
|
out.push({ key: "door", kind: "door", label: tl("door"), x: pack.door.x, y: pack.door.y });
|
|
78
|
-
const md = pack.mailDrop || dropPoint({ areas: pack.areas, waypoints: pack.waypoints, width:
|
|
78
|
+
const md = pack.mailDrop || dropPoint({ areas: pack.areas, waypoints: pack.waypoints, width: canvasOf(pack).w, height: canvasOf(pack).h });
|
|
79
79
|
if (md) out.push({ key: "mail", kind: "mail", label: tl(pack.mailDrop ? "mail" : "mailAuto"), x: md.x, y: md.y, ...(pack.mailDrop ? {} : { auto: true }) });
|
|
80
80
|
for (const w of pack.waypoints) out.push({ key: `wp:${w.id}`, kind: "waypoint", label: tl("waypoint", w.id), x: w.x, y: w.y });
|
|
81
81
|
return out;
|
|
@@ -83,7 +83,7 @@ export function handlesOf(pack) {
|
|
|
83
83
|
/** The pack with handle `key` at (x, y), rounded and kept in range: a seat inside its area, anything else on the canvas. */
|
|
84
84
|
export function moveHandle(pack, key, x, y) {
|
|
85
85
|
const [kind, a, b] = key.split(":");
|
|
86
|
-
const inCanvas = () => ({ x: clamp(x, 0,
|
|
86
|
+
const cv = canvasOf(pack), inCanvas = () => ({ x: clamp(x, 0, cv.w), y: clamp(y, 0, cv.h) });
|
|
87
87
|
if (kind === "seat") {
|
|
88
88
|
const area = own(pack.areas, a), i = Number(b);
|
|
89
89
|
if (!area || !area.seats[i]) return pack;
|
|
@@ -98,12 +98,12 @@ export function moveHandle(pack, key, x, y) {
|
|
|
98
98
|
return pack;
|
|
99
99
|
}
|
|
100
100
|
/** A new waypoint at (x, y), named wp-<n> (a name no other waypoint has); returns { pack, id }. */
|
|
101
|
-
export function addWaypoint(pack, x =
|
|
101
|
+
export function addWaypoint(pack, x = canvasOf(pack).w / 2, y = canvasOf(pack).h / 2) {
|
|
102
102
|
const ids = new Set(pack.waypoints.map((w) => w.id));
|
|
103
103
|
let n = pack.waypoints.length + 1;
|
|
104
104
|
while (ids.has(`wp-${n}`)) n++;
|
|
105
105
|
const id = `wp-${n}`;
|
|
106
|
-
return { pack: { ...pack, waypoints: [...pack.waypoints, { id, x: clamp(x, 0,
|
|
106
|
+
return { pack: { ...pack, waypoints: [...pack.waypoints, { id, x: clamp(x, 0, canvasOf(pack).w), y: clamp(y, 0, canvasOf(pack).h) }] }, id };
|
|
107
107
|
}
|
|
108
108
|
/** The pack without waypoint `id` and its corridors. */
|
|
109
109
|
export function removeWaypoint(pack, id) {
|
|
@@ -171,7 +171,7 @@ export function LayoutEditor({ base, start, place = null, stale = "", dock = tru
|
|
|
171
171
|
const toLogical = (e) => {
|
|
172
172
|
const r = svg.current && svg.current.getBoundingClientRect ? svg.current.getBoundingClientRect() : null;
|
|
173
173
|
if (!r || !r.width || !r.height) return null;
|
|
174
|
-
return { x: ((e.clientX - r.left) / r.width) *
|
|
174
|
+
return { x: ((e.clientX - r.left) / r.width) * canvasOf(edited).w, y: ((e.clientY - r.top) / r.height) * canvasOf(edited).h };
|
|
175
175
|
};
|
|
176
176
|
const down = (key) => (e) => {
|
|
177
177
|
if (busy) return;
|
|
@@ -187,7 +187,7 @@ export function LayoutEditor({ base, start, place = null, stale = "", dock = tru
|
|
|
187
187
|
if ((e.key === "Delete" || e.key === "Backspace") && h.kind === "waypoint") { e.preventDefault(); change(removeWaypoint(edited, h.key.slice(3))); setSel(null); }
|
|
188
188
|
if (e.key === "Enter" || e.key === " ") { e.preventDefault(); setSel(h.key); }
|
|
189
189
|
};
|
|
190
|
-
const add = () => { const at = selected ? { x: selected.x + 40, y: selected.y } : { x:
|
|
190
|
+
const add = () => { const at = selected ? { x: selected.x + 40, y: selected.y } : { x: canvasOf(edited).w / 2, y: canvasOf(edited).h / 2 }; const r = addWaypoint(edited, at.x, at.y); change(r.pack); setSel(`wp:${r.id}`); };
|
|
191
191
|
const wpSel = selected && selected.kind === "waypoint" ? selected.key.slice(3) : null;
|
|
192
192
|
const nightSel = selected && selected.kind === "night" ? selected.key.slice(6) : null;
|
|
193
193
|
const seatSel = selected && selected.kind === "seat" ? selected : null;
|
|
@@ -209,10 +209,10 @@ export function LayoutEditor({ base, start, place = null, stale = "", dock = tru
|
|
|
209
209
|
const reset = () => { change(base); setSel(null); setMsg(""); };
|
|
210
210
|
const grid = [];
|
|
211
211
|
if (coords) {
|
|
212
|
-
for (let x = GRID; x <
|
|
213
|
-
for (let y = GRID; y <
|
|
214
|
-
for (let x = 0; x <
|
|
215
|
-
for (let y = LABEL; y <
|
|
212
|
+
for (let x = GRID; x < canvasOf(edited).w; x += GRID) grid.push(html`<line key=${`gx${x}`} class="ol-grid" x1=${x} y1="0" x2=${x} y2=${canvasOf(edited).h} />`);
|
|
213
|
+
for (let y = GRID; y < canvasOf(edited).h; y += GRID) grid.push(html`<line key=${`gy${y}`} class="ol-grid" x1="0" y1=${y} x2=${canvasOf(edited).w} y2=${y} />`);
|
|
214
|
+
for (let x = 0; x < canvasOf(edited).w; x += LABEL) grid.push(html`<text key=${`lx${x}`} class="ol-label" x=${x + 3} y="14">${x}</text>`);
|
|
215
|
+
for (let y = LABEL; y < canvasOf(edited).h; y += LABEL) grid.push(html`<text key=${`ly${y}`} class="ol-label" x="3" y=${y - 3}>${y}</text>`);
|
|
216
216
|
}
|
|
217
217
|
const at = new Map(edited.waypoints.map((w) => [w.id, w]));
|
|
218
218
|
const edgeKey = (e) => `${e[0]}\u0000${e[1]}`;
|
|
@@ -256,7 +256,7 @@ export function LayoutEditor({ base, start, place = null, stale = "", dock = tru
|
|
|
256
256
|
${msg ? html`<p class="note ol-msg" role="status">${msg}</p>` : null}`;
|
|
257
257
|
return html`<div class="ol" role="group" aria-label=${tl("title")} onKeyDown=${esc}>
|
|
258
258
|
<div class="ol-overlay" ref=${overlay}>
|
|
259
|
-
<svg ref=${svg} class="ol-svg" viewBox=${`0 0 ${
|
|
259
|
+
<svg ref=${svg} class="ol-svg" viewBox=${`0 0 ${canvasOf(edited).w} ${canvasOf(edited).h}`} width="100%" height="100%"
|
|
260
260
|
onPointerMove=${move} onPointerUp=${up} onPointerCancel=${up} onPointerLeave=${up}>
|
|
261
261
|
${grid}
|
|
262
262
|
${Object.values(edited.areas).map((a) => html`<rect key=${`a:${a.name}`} class="ol-area" x=${a.rect.x} y=${a.rect.y} width=${a.rect.w} height=${a.rect.h} />`)}
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
// the left margin) that traffic walks along (bfsPath).
|
|
16
16
|
// - Poses come from the org chart's states (fleet-org.js ORG_STATES / orgState); nothing here invents a status.
|
|
17
17
|
import { hue } from "./fleet-traffic.js";
|
|
18
|
-
import { checkLayoutOverrides } from "./fleet-office-pack.js";
|
|
18
|
+
import { CANVAS, checkLayoutOverrides } from "./fleet-office-pack.js";
|
|
19
19
|
|
|
20
20
|
// ── Poses: the org chart's states, as a character at a desk ──
|
|
21
21
|
|
|
@@ -125,7 +125,8 @@ export function officeOk(x) {
|
|
|
125
125
|
if (!x || typeof x !== "object" || typeof x.id !== "string" || !ID.test(x.id) || x.id === AUTO_ID) return null;
|
|
126
126
|
const name = typeof x.name === "string" && x.name.trim() ? x.name.trim().slice(0, 60) : x.id;
|
|
127
127
|
const skin = typeof x.skin === "string" && ID.test(x.skin) ? x.skin : "pixel";
|
|
128
|
-
|
|
128
|
+
// The host checked them against their pack's canvas; here the largest, so a big office's layout is kept.
|
|
129
|
+
const ov = x.overrides === undefined ? null : checkLayoutOverrides(x.overrides, CANVAS.max);
|
|
129
130
|
return { id: x.id, name, skin, members: nameList(x.members), layout: layoutOk(x.layout), ...(ov && ov.ok ? { overrides: ov.overrides } : {}),
|
|
130
131
|
...(x.stayInArea === true ? { stayInArea: true } : {}) }; // M-3286: idle people stay in their own area
|
|
131
132
|
}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
//
|
|
6
6
|
// - Shown when at least two offices are stored (overviewOk); an id no stored office can have (ALL_ID: '*' is not an
|
|
7
7
|
// office id's character), kept per device as any office pick is.
|
|
8
|
-
// - The tiles: each as large as its office's drawn content — a zones scene its 1280×720, a desks office its rooms'
|
|
8
|
+
// - The tiles: each as large as its office's drawn content — a zones scene its canvas (1280×720, or a pack's own), a desks office its rooms'
|
|
9
9
|
// bounds (cropToRooms: an office of three is small) — scaled down to at most CELL_W × CELL_H, never up; a LABEL band
|
|
10
10
|
// above each (the page's label sits there), GAP apart, M from the edge. Shelf packing in the stored order (the lobby
|
|
11
11
|
// last): a row takes tiles while they fit a row width, each row as tall as its tallest tile and centred across. The
|
|
@@ -13,6 +13,9 @@ export interface PackStrip {
|
|
|
13
13
|
once?: boolean;
|
|
14
14
|
/** M-3394 (#4231): intro plays `0 .. loopFrom - 1` once, then loops `loopFrom .. frames - 1`. */
|
|
15
15
|
loopFrom?: number;
|
|
16
|
+
/** Sheet cells: the strip starts at this row / column of w×h cells (both present when either was given). */
|
|
17
|
+
row?: number;
|
|
18
|
+
col?: number;
|
|
16
19
|
}
|
|
17
20
|
export interface PackPoint { x: number; y: number }
|
|
18
21
|
/** #2691: a seat reserved for `for` (lent while they are all elsewhere when `lend`); a plain seat has neither. */
|
|
@@ -22,7 +25,7 @@ export interface PackArea { name: string; rect: { x: number; y: number; w: numbe
|
|
|
22
25
|
export interface PackFurniture { id: string; sprite: PackStrip; x: number; y: number; depth: number | "y"; activeWhen: string[] | null; activeSprite: PackStrip | null;
|
|
23
26
|
activeFor?: string[] | null; loop?: boolean; activeOn?: "state" | "seated"; hides?: boolean; label: string | null }
|
|
24
27
|
export interface CheckedPack {
|
|
25
|
-
format: 1; id: string; scale: number; background?: string; foreground?: string; matte?: string;
|
|
28
|
+
format: 1; id: string; scale: number; /** Its own canvas (logical units), else 1280×720. */ canvas?: { w: number; h: number }; background?: string; foreground?: string; matte?: string;
|
|
26
29
|
areas: Record<string, PackArea>; stateZones: Record<string, string> | null; door: PackPoint;
|
|
27
30
|
/** #2736: where a letter from another office lands, or null (the waypoint nearest the middle). */
|
|
28
31
|
mailDrop: PackPoint | null;
|
|
@@ -38,7 +41,9 @@ export interface CheckedPack {
|
|
|
38
41
|
/** #2861: the dialogue box's faces — each an expression (idle, working, needs) → file. */
|
|
39
42
|
portraits?: { default?: PackPortrait; byInstance: Record<string, PackPortrait>; byUser: Record<string, PackPortrait>; npc: Record<string, PackPortrait> };
|
|
40
43
|
/** #2861: the dialogue box's look — a 9-slice frame and colours (#rrggbb). */
|
|
41
|
-
dialogBox?: { frame?: string; slice?: number; background?: string; border?: string; text?: string; name?: string
|
|
44
|
+
dialogBox?: { frame?: string; slice?: number; background?: string; border?: string; text?: string; name?: string;
|
|
45
|
+
/** The reply over a head (the Office's "Over their head" talk): its 9-slice frame, colours and entrance. */
|
|
46
|
+
bubble?: { frame?: string; slice?: number; background?: string; border?: string; text?: string; name?: string; enter?: "pop" | "fade" | "none" } };
|
|
42
47
|
/** #4256: optional agent profile card preset, visual style, and layout. */
|
|
43
48
|
card?: PackCard;
|
|
44
49
|
/** #3685: areas an idle person now and then visits (a free seat there, for minSeconds–maxSeconds); absent: none. */
|
|
@@ -69,10 +74,12 @@ export interface PackCardStyle {
|
|
|
69
74
|
backgroundImage?: string; frame?: string; slice?: number; radius?: CardRadius;
|
|
70
75
|
}
|
|
71
76
|
export interface PackCardLayout {
|
|
72
|
-
avatarSize?: CardAvatarSize; avatarSource?: CardAvatarSource; headerAlign?: CardHeaderAlign; width?: number;
|
|
77
|
+
avatarSize?: CardAvatarSize; avatarSource?: CardAvatarSource; headerAlign?: CardHeaderAlign; width?: number; gap?: number;
|
|
73
78
|
sections?: CardSection[]; rows?: CardRowKey[]; rowColumns?: 1 | 2; hide?: CardHideKey[];
|
|
74
79
|
}
|
|
75
|
-
export
|
|
80
|
+
export type CardEnter = "none" | "fade" | "pop" | "rise" | "slide" | "bounce";
|
|
81
|
+
export interface PackCardMotion { enter: CardEnter; ms: number }
|
|
82
|
+
export interface PackCard { preset?: CardPreset; style?: PackCardStyle; layout?: PackCardLayout; motion?: PackCardMotion }
|
|
76
83
|
/** #2861: a portrait's files by the state it is shown in (at least one). */
|
|
77
84
|
export type PackPortrait = Partial<Record<"idle" | "working" | "needs", string>>;
|
|
78
85
|
/** #2661: the Office levels' words (a pack's `levels`; #3679: the fleet-wide one too). */
|
|
@@ -92,6 +99,8 @@ export interface LayoutOverrides {
|
|
|
92
99
|
edges?: Array<[string, string]>;
|
|
93
100
|
}
|
|
94
101
|
export const LOGICAL: { w: number; h: number };
|
|
102
|
+
export const CANVAS: { min: { w: number; h: number }; max: { w: number; h: number } };
|
|
103
|
+
export function canvasOf(pack: unknown): { w: number; h: number };
|
|
95
104
|
export const CHAR_DEPTH: number;
|
|
96
105
|
export const PACK_STATES: string[];
|
|
97
106
|
export const BUBBLE_KEYS: string[];
|
|
@@ -105,6 +114,7 @@ export function matteOk(v: unknown): v is string;
|
|
|
105
114
|
export function relativeLuminance(hex: string): number | null;
|
|
106
115
|
export function contrastRatio(hexA: string, hexB: string): number;
|
|
107
116
|
export const CARD_PRESETS: CardPreset[];
|
|
117
|
+
export const CARD_ENTERS: CardEnter[];
|
|
108
118
|
export const CARD_RADII: CardRadius[];
|
|
109
119
|
export const CARD_AVATAR_SIZES: CardAvatarSize[];
|
|
110
120
|
export const CARD_AVATAR_SOURCES: CardAvatarSource[];
|
|
@@ -113,12 +123,12 @@ export const CARD_SECTIONS: CardSection[];
|
|
|
113
123
|
export const CARD_ROWS: CardRowKey[];
|
|
114
124
|
export const CARD_HIDE: CardHideKey[];
|
|
115
125
|
export const CARD_STYLE_COLORS: string[];
|
|
116
|
-
export const CARD_LIMITS: { widthMin: number; widthMax: number; sliceMax: number; textContrast: number; uiContrast: number };
|
|
126
|
+
export const CARD_LIMITS: { widthMin: number; widthMax: number; gapMax: number; motionMsMin: number; motionMsMax: number; sliceMax: number; textContrast: number; uiContrast: number };
|
|
117
127
|
export function checkStrip(v: unknown, at?: string, scale?: number): PackStrip;
|
|
118
128
|
export function stripSheets(st: PackStrip | null | undefined): PackStripSheet[];
|
|
119
129
|
export function stripImages(st: PackStrip | null | undefined): string[];
|
|
120
130
|
export function stripFrameAt(st: PackStrip | null | undefined, ms: number): number;
|
|
121
|
-
export function stripCell(st: PackStrip | null | undefined, frame: number): { src: string; col: number };
|
|
131
|
+
export function stripCell(st: PackStrip | null | undefined, frame: number): { src: string; col: number; row?: number };
|
|
122
132
|
export function stripMaxFps(st: PackStrip | null | undefined): number;
|
|
123
133
|
export function packMaxFps(pack: CheckedPack | null | undefined): number;
|
|
124
134
|
export function createClipClocks(): { elapsed(key: string, strip: PackStrip | null | undefined, ms: number): number; prune(seen: ReadonlySet<string>): void; clear(): void };
|
|
@@ -131,7 +141,7 @@ export function packSceneImages(pack: CheckedPack): string[];
|
|
|
131
141
|
export function packPortraitImages(pack: CheckedPack): string[];
|
|
132
142
|
export const PORTRAIT_STATES: string[];
|
|
133
143
|
export function packStrips(pack: CheckedPack): Array<{ at: string; strip: PackStrip }>;
|
|
134
|
-
export function checkLayoutOverrides(x: unknown): { ok: true; overrides: LayoutOverrides } | { ok: false; error: string };
|
|
144
|
+
export function checkLayoutOverrides(x: unknown, canvas?: { w: number; h: number }): { ok: true; overrides: LayoutOverrides } | { ok: false; error: string };
|
|
135
145
|
export function applyOverrides(pack: CheckedPack, ov: LayoutOverrides | null | undefined): { ok: true; pack: CheckedPack } | { ok: false; error: string };
|
|
136
146
|
export function fitNight<T extends LayoutOverrides | null | undefined>(pack: CheckedPack, ov: T): T;
|
|
137
147
|
export function fitSeatFor<T extends LayoutOverrides | null | undefined>(pack: CheckedPack, ov: T): T;
|