@songsid/agend 2.4.0-beta.19 → 2.4.0-beta.20
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 -0
- package/dist/agent-whats-new.js +6 -0
- package/dist/agent-whats-new.js.map +1 -1
- package/dist/build-provenance.json +1 -1
- package/dist/channel/mcp-tools.js +2 -1
- package/dist/channel/mcp-tools.js.map +1 -1
- package/dist/dashboard-permissions.d.ts +14 -0
- package/dist/dashboard-permissions.js +17 -1
- package/dist/dashboard-permissions.js.map +1 -1
- package/dist/general-knowledge/skills/web-dashboard/SKILL.md +5 -2
- package/dist/hub/compose/server.d.ts +1 -0
- package/dist/hub/compose/server.js +3 -1
- package/dist/hub/compose/server.js.map +1 -1
- package/dist/hub/http/compose.js +8 -1
- package/dist/hub/http/compose.js.map +1 -1
- package/dist/hub/http/core.js +5 -2
- package/dist/hub/http/core.js.map +1 -1
- package/dist/hub/http/deps.d.ts +2 -0
- package/dist/hub/http/schema.js +2 -1
- package/dist/hub/http/schema.js.map +1 -1
- package/dist/hub/rooms/office.d.ts +32 -0
- package/dist/hub/rooms/office.js +25 -0
- package/dist/hub/rooms/office.js.map +1 -1
- package/dist/hub/rooms/service.d.ts +44 -0
- package/dist/hub/rooms/service.js +44 -9
- package/dist/hub/rooms/service.js.map +1 -1
- package/dist/hub/rooms/types.d.ts +4 -0
- package/dist/instructions.js +2 -2
- package/dist/instructions.js.map +1 -1
- package/dist/ui/chat-task-refs.js +6 -4
- package/dist/ui/fleet-office-card.js +17 -8
- package/dist/ui/fleet-office-play.js +9 -0
- package/dist/ui/fleet-office-skin.js +111 -8
- package/dist/ui/fleet-office-zones.js +44 -9
- package/dist/ui/fleet-office.js +218 -67
- package/dist/ui/hub-my-agents-strings.js +2 -2
- package/dist/ui/hub-my-agents.js +8 -3
- package/dist/ui/hub-room-members.js +51 -4
- package/dist/ui/hub-room-office.js +16 -5
- package/dist/ui/hub-room-presence.js +5 -2
- package/dist/ui/hub-room-settings.js +45 -1
- package/dist/ui/hub-room-source.js +4 -2
- package/dist/ui/hub-room-strings.js +17 -4
- package/dist/ui/hub-room-thread.js +26 -6
- package/dist/ui/hub-strings.js +4 -4
- package/dist/ui/panel-chat.js +1 -1
- package/dist/ui/panel-hub.js +42 -5
- package/dist/ui/shared/app.css +44 -1
- package/dist/ui/shared/chat-render.js +4 -4
- package/dist/ui/shared/chat-thread.js +2 -2
- package/dist/ui/shared/hub-my-agents.css +6 -0
- package/dist/ui/shared/hub-rooms-u2.css +17 -0
- package/dist/web-api.d.ts +1 -0
- package/dist/web-api.js +1 -1
- package/dist/web-api.js.map +1 -1
- package/package.json +1 -1
package/dist/ui/fleet-office.js
CHANGED
|
@@ -76,7 +76,7 @@ import { CALLING, activeFurniture, bubbleAt, hiddenBy, bubbleRank, NIGHT, WANDER
|
|
|
76
76
|
import { actsOk, createOfficeStore } from "./fleet-office-store.js";
|
|
77
77
|
import { badgeOf, fixedOf, mergeLevels } from "./fleet-office-levels.js";
|
|
78
78
|
import { OfficeCard, cardModel } from "./fleet-office-card.js";
|
|
79
|
-
import { PLAY, applySeatDrop, clampDropForArea, createHold, createSnackDrag, createSnacks, findSeatDropTarget, playAllowed, pruneReactions, reactionAt, scatterWords, seatDropTargets } from "./fleet-office-play.js";
|
|
79
|
+
import { PLAY, applySeatDrop, clampDropForArea, createHold, createSnackDrag, createSnacks, findSeatDropTarget, playAllowed, playOffForMotion, pruneReactions, reactionAt, scatterWords, seatDropTargets } from "./fleet-office-play.js";
|
|
80
80
|
import { POLL_MS } from "./fleet-traffic.js";
|
|
81
81
|
import { OfficeEditor, officeForSave } from "./fleet-office-editor.js";
|
|
82
82
|
import { LayoutEditor, handlesOf } from "./fleet-office-layout.js";
|
|
@@ -92,6 +92,7 @@ import { OK_MAX, OK_MIN, clampPan, desksK, edgeMatte, edgeStrips, fitScene, laye
|
|
|
92
92
|
|
|
93
93
|
register("orgo", {
|
|
94
94
|
en: {
|
|
95
|
+
display: "Display options", playMotionOff: "Off: your system asks for reduced motion",
|
|
95
96
|
label: "Office: each team is a room and each instance a desk; General and the instances in no team are in the lobby. Drag to pan; the wheel, a pinch, + and − zoom, 0 fits, F is fullscreen.",
|
|
96
97
|
office: "Office", allOffice: "Whole fleet", show: "Show", allTeams: "All teams", lobby: "Lobby (General, no team)", lobbyRoom: "Lobby",
|
|
97
98
|
people: "People", peopleN: "People ({0})", findPerson: "Find a person", everyone: "Show everyone", nobody: "No one here matches this filter.",
|
|
@@ -101,7 +102,7 @@ register("orgo", {
|
|
|
101
102
|
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?",
|
|
102
103
|
b_paused: "Zzz…|Back later", b_stopped: "Off duty|Zzz…", b_needs: "Need you!|A question for you|Over here!",
|
|
103
104
|
b_crashed: "Ouch, crashed|Help!", b_stuck: "Hmm, stuck?|Still thinking…",
|
|
104
|
-
hideAsleep: "Hide paused and stopped", nightOn: "Bedtime 0–6:
|
|
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.",
|
|
105
106
|
styleForAll: "The whole fleet's style, for everyone: every device and share link", styleHere: "The whole fleet's style in this browser",
|
|
106
107
|
styleFailed: "The style was not saved for everyone ({0}).", styleBusy: "Too many changes. Try again in a minute.",
|
|
107
108
|
fit: "Fit the office", overview: "Overview: click to move there", fullscreen: "Fullscreen", exitFullscreen: "Exit fullscreen",
|
|
@@ -123,6 +124,7 @@ register("orgo", {
|
|
|
123
124
|
snackArm: "{0}: drag onto someone to feed, or onto the floor to place; click to select",
|
|
124
125
|
},
|
|
125
126
|
"zh-TW": {
|
|
127
|
+
display: "顯示選項", playMotionOff: "已關閉:系統開了「減少動態效果」",
|
|
126
128
|
label: "辦公室:每個 team 是一間房間,每個 Agent 一張桌子;General 和未加入 team 的 Agent 在大廳。拖曳平移;滾輪、雙指、+ 和 − 縮放,0 顯示整個場景,F 切換全螢幕。",
|
|
127
129
|
office: "辦公室", allOffice: "整個 fleet", show: "顯示", allTeams: "所有 team", lobby: "大廳(General、未加入 team)", lobbyRoom: "大廳",
|
|
128
130
|
people: "成員", peopleN: "成員({0})", findPerson: "尋找成員", everyone: "顯示全部", nobody: "沒有符合這個篩選的成員。",
|
|
@@ -132,7 +134,7 @@ register("orgo", {
|
|
|
132
134
|
b_working: "處理中|打字中…|快好了|專心中|再測一次", b_idle: "喝茶中|隨時可以開工|伸個懶腰|有事找我嗎?",
|
|
133
135
|
b_paused: "Zzz…|晚點回來", b_stopped: "下班了|Zzz…", b_needs: "需要你!|有個問題|在這裡!",
|
|
134
136
|
b_crashed: "糟糕,當掉了|救命!", b_stuck: "嗯,卡住了?|還在想…",
|
|
135
|
-
hideAsleep: "隱藏暫停與停止的成員", nightOn: "0–6 點就寢:閒著的人去睡", playOn: "拖曳與摸頭", playStill: "開啟「減少動態效果」時關閉", layoutIgnored: "它儲存的配置不適用這個風格:以風格本身的配置顯示。",
|
|
137
|
+
options: "辦公室選項", hideAsleep: "隱藏暫停與停止的成員", nightOn: "0–6 點就寢:閒著的人去睡", playOn: "拖曳與摸頭", playStill: "開啟「減少動態效果」時關閉", layoutIgnored: "它儲存的配置不適用這個風格:以風格本身的配置顯示。",
|
|
136
138
|
styleForAll: "整個 fleet 的風格,所有人共用:每台裝置與分享連結都一樣", styleHere: "這個瀏覽器裡整個 fleet 的風格",
|
|
137
139
|
styleFailed: "風格沒有替所有人儲存({0})。", styleBusy: "變更太頻繁,請一分鐘後再試。",
|
|
138
140
|
fit: "顯示整個辦公室", overview: "總覽:點一下移到那裡", fullscreen: "全螢幕", exitFullscreen: "結束全螢幕",
|
|
@@ -190,6 +192,8 @@ const CAPTION_OF_STATE = { starting: "capStarting", queued: "capQueued" };
|
|
|
190
192
|
/** What a pose says in words (the tooltip, the desk list); `state`, when its words differ from its pose's. */
|
|
191
193
|
export const caption = (pose, state) => to(CAPTION_OF_STATE[state] || CAPTION[pose] || "capIdle");
|
|
192
194
|
|
|
195
|
+
/** M-3556: the most a dropdown starting at `top` may be tall to end `margin` px above `bottom` (never under `min`). */
|
|
196
|
+
export const popMaxHeight = (bottom, top, margin = 8, min = 96) => Math.max(min, Math.floor(bottom - top - margin));
|
|
193
197
|
const reducedMotion = () => typeof matchMedia === "function" && matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
194
198
|
/** The device's ratio (CSS px → device px), kept sane. */
|
|
195
199
|
const deviceRatio = () => Math.max(0.5, Math.min(4, Number(globalThis.devicePixelRatio) || 1));
|
|
@@ -199,6 +203,26 @@ const SIZE0 = { w: 960, h: 600 };
|
|
|
199
203
|
const FIT_PAD = 60;
|
|
200
204
|
/** #2860: how far below its place a crowded area's compact tag drops when a neighbour's is in the way (a tag's height + 1). */
|
|
201
205
|
const COMPACT_ROW = 12;
|
|
206
|
+
/** M-3539: how far below its place a full name tag drops when another tag or an area's name is in the way (a tag's height + 2). */
|
|
207
|
+
const TAG_ROW = 16;
|
|
208
|
+
/** M-3539: the controls drawn over the scene that name tags keep clear of: the zoom stack, the minimap, and the phone's zone chips where they float over it. */
|
|
209
|
+
const KEEP_CLEAR = ".oo-zoom, .oo-mini, .oo-stage > .oo-zone-pills";
|
|
210
|
+
/** M-3539: those controls' boxes in the scene's logical units at the view `v` ({ k, x, y }: CSS px a unit, the origin), 4 CSS px round each. */
|
|
211
|
+
export function keepClearOf(cv, v) {
|
|
212
|
+
const root = cv && typeof cv.closest === "function" ? cv.closest(".oo") : null;
|
|
213
|
+
if (!root || typeof cv.getBoundingClientRect !== "function" || !(v.k > 0)) return [];
|
|
214
|
+
const c = cv.getBoundingClientRect(), out = [];
|
|
215
|
+
for (const el of root.querySelectorAll(KEEP_CLEAR)) {
|
|
216
|
+
const r = el.getBoundingClientRect();
|
|
217
|
+
if (!r.width || !r.height || r.right <= c.left || r.left >= c.right || r.bottom <= c.top || r.top >= c.bottom) continue;
|
|
218
|
+
out.push({ x: (r.left - c.left - 4 - v.x) / v.k, y: (r.top - c.top - 4 - v.y) / v.k, w: (r.width + 8) / v.k, h: (r.height + 8) / v.k });
|
|
219
|
+
}
|
|
220
|
+
return out;
|
|
221
|
+
}
|
|
222
|
+
/** Whether two boxes ({ x, y, w, h }) overlap. */
|
|
223
|
+
const overlaps = (a, b) => a.x < b.x + b.w && b.x < a.x + a.w && a.y < b.y + b.h && b.y < a.y + a.h;
|
|
224
|
+
/** M-3539: the box a person's figure covers where they are now (the skin's own, else the built-in figure's). */
|
|
225
|
+
const figureBox = (sk, q) => (sk.charBox ? sk.charBox(q.look, q.at) : { x: q.at.x - 24, y: q.at.y - 52, w: 48, h: 66 });
|
|
202
226
|
/** #2554: in All offices a tile's name tags show (always) from this many CSS px a unit up; below it on hover only. */
|
|
203
227
|
export const TAG_MIN_K = 0.75;
|
|
204
228
|
const PAN_KEYS = { ArrowLeft: [-1, 0], ArrowRight: [1, 0], ArrowUp: [0, -1], ArrowDown: [0, 1] };
|
|
@@ -301,7 +325,7 @@ function looksOf(L, work, q, mode, zones, badge = () => null) {
|
|
|
301
325
|
// At night (#2568) the idle are drawn asleep (their state stays idle: the tooltip and the list say so).
|
|
302
326
|
return [d.key, { name: n.name, label: nodeText(n).primary, state: n.state, pose: officePose(d.night ? "paused" : n.state), night: !!d.night, light: lightOf(n.state), lamp: lampOf(n.state),
|
|
303
327
|
sign: zones ? null : signOf(n.state), coat: coatOf(n.i, n.i ? identityOf(n.i) : null, mode), work: work.get(n.name) || 0, dim: !!q && !match, match, free: zones,
|
|
304
|
-
badge: badge(n.name) }];
|
|
328
|
+
badge: badge(n.name), fit: n.i && n.i.tag_fit && typeof n.i.tag_fit === "object" ? n.i.tag_fit : null }];
|
|
305
329
|
}));
|
|
306
330
|
}
|
|
307
331
|
/** A stored office's own layout on a zones style (its overrides); `ignored`: they do not fit this style. */
|
|
@@ -364,7 +388,7 @@ const hidingBox = (f) => {
|
|
|
364
388
|
/** #2698: name tags in one row centred on (x, y) — each { look, x } (its centre), TAG_GAP apart. */
|
|
365
389
|
const TAG_GAP = 4;
|
|
366
390
|
export function tagRow(ctx, x, y, looks) {
|
|
367
|
-
const ws = looks.map((l) => tagBox(ctx, x, y, l.label).w), total = ws.reduce((a, w) => a + w, 0) + TAG_GAP * Math.max(0, ws.length - 1);
|
|
391
|
+
const ws = looks.map((l) => tagBox(ctx, x, y, l.label, false, l.fit).w), total = ws.reduce((a, w) => a + w, 0) + TAG_GAP * Math.max(0, ws.length - 1);
|
|
368
392
|
let left = x - total / 2;
|
|
369
393
|
return looks.map((look, i) => { const cx = Math.round(left + ws[i] / 2); left += ws[i] + TAG_GAP; return { look, x: cx }; });
|
|
370
394
|
}
|
|
@@ -485,7 +509,7 @@ export function drawPart(ctx, p, a, ox, oy, ms, still, hot, env, tagsOff = false
|
|
|
485
509
|
const blit = (c) => { if (!c) return; ctx.setTransform(a / ls, 0, 0, a / ls, ox, oy); ctx.drawImage(c, 0, 0); T(); };
|
|
486
510
|
blit(p.layers.back);
|
|
487
511
|
T();
|
|
488
|
-
const speakers = [], tags = [];
|
|
512
|
+
const speakers = [], tags = [], titleBoxes = []; // M-3539: the area names bubbles keep off too
|
|
489
513
|
const up = still ? [] : p.flights.frame(ms, p.L);
|
|
490
514
|
// Mail from another office (#2564): flying in at the door, or on the floor until its person picks it up.
|
|
491
515
|
const post = still || !p.mail || !p.zones ? [] : p.mail.frame(ms > 0 ? ms : now(), p.L, p.walkers);
|
|
@@ -615,20 +639,60 @@ export function drawPart(ctx, p, a, ox, oy, ms, still, hot, env, tagsOff = false
|
|
|
615
639
|
if (sk.drawForeground) sk.drawForeground(ctx, p.L, env);
|
|
616
640
|
// Who found no spot in an area: a count in its corner (never over its name).
|
|
617
641
|
for (const [ar, n] of p.L.crowd || []) if (p.L.areas[ar] && sk.drawCrowd) sk.drawCrowd(ctx, p.L.areas[ar], n, env);
|
|
618
|
-
//
|
|
619
|
-
|
|
620
|
-
|
|
642
|
+
// M-3539: an area's name a figure stands on is written again over the people (休息區 under a crowd's heads).
|
|
643
|
+
const titles = sk.areaTitleBox ? Object.values(p.L.areas || {}).map((ar) => ({ ar, box: sk.areaTitleBox(ctx, ar, env) })) : [];
|
|
644
|
+
if (sk.drawAreaTitle) for (const { ar, box } of titles) {
|
|
645
|
+
if (people.some((q) => !live.hidden.has(q.look.name) && overlaps(figureBox(sk, q), box))) sk.drawAreaTitle(ctx, ar, env);
|
|
646
|
+
}
|
|
647
|
+
// Name tags never cover each other, an area's name or what the page keeps clear over the scene (`env.keepClear`:
|
|
648
|
+
// the zoom control, M-3539). In an area over capacity (#2513: a crowd's full tags covered each other) everyone keeps
|
|
649
|
+
// a compact tag (#2860: in Cozy, the default, most of a fleet is in a crowd, and hover-only hid names and levels).
|
|
650
|
+
// The full tags go first: the one hovered or found, then the people at their place, then those walking (a stroll
|
|
651
|
+
// passes others' tags, M-3539); each where it is, else a row lower, else compact (there, then a row lower); one
|
|
652
|
+
// that fits nowhere is left to hover or focus. Then an item's own name and the row it carries; then the crowd's.
|
|
621
653
|
const over = p.L.over || new Set();
|
|
622
|
-
const
|
|
623
|
-
const
|
|
654
|
+
const pinned = (q) => q.d.key === hot || !!q.look.match;
|
|
655
|
+
const crowded = (q) => over.has(q.d.area) && !pinned(q);
|
|
656
|
+
const tagged = (q) => pinned(q) || !(tagsOff || over.has(q.d.area));
|
|
657
|
+
const keep = [...titles.map((x) => x.box), ...(env.keepClear || [])];
|
|
658
|
+
titleBoxes.push(...titles.map((x) => x.box));
|
|
624
659
|
const taken = [];
|
|
625
|
-
const touches = (b) => taken.some((o) => b
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
660
|
+
const touches = (b) => taken.some((o) => overlaps(b, o)) || keep.some((o) => overlaps(b, o));
|
|
661
|
+
// Under an open card (`p.cover`, bitmap px; #4379 review): no tag, its level badge included, rather than a piece of one
|
|
662
|
+
// past the card's edge — a forced one (hovered, found) too.
|
|
663
|
+
const cv = p.cover ? { x: (p.cover.x - ox) / a, y: (p.cover.y - oy) / a, w: p.cover.w / a, h: p.cover.h / a } : null;
|
|
664
|
+
const covered = (b) => !!cv && overlaps(b, cv);
|
|
665
|
+
/**
|
|
666
|
+
* Draws `look`'s tag at (x, y) at the first of `tries` ([dy, compact]) clear of the others; `force`: at the first.
|
|
667
|
+
* None clear: slid sideways just past what it would touch of `keep` (an area's name, the minimap: never another
|
|
668
|
+
* tag), at most its own width, at its place — so a name beside the minimap reads instead of going (leader's check).
|
|
669
|
+
*/
|
|
670
|
+
const place = (x0, y, look, tries, force = false) => {
|
|
671
|
+
// M-3539: a tag stays within the sides of the area its person stands in (a wide name at a lounge's first column
|
|
672
|
+
// poked past its edge): moved in by what it would stick out.
|
|
673
|
+
const ar = Object.values(p.L.areas || {}).find((a) => a.rect && x0 >= a.rect.x && x0 <= a.rect.x + a.rect.w && y >= a.rect.y && y <= a.rect.y + a.rect.h);
|
|
674
|
+
const w0 = tagBox(ctx, x0, y, look.label, false, look.fit).w, x = !ar ? x0 : Math.min(Math.max(x0, ar.rect.x + 2 + w0 / 2), ar.rect.x + ar.rect.w - 2 - w0 / 2);
|
|
675
|
+
const at = (dx, dy, compact) => {
|
|
676
|
+
const box = tagBox(ctx, x + dx, y + dy, look.label, compact, look.fit), foot = tagFootprint(ctx, box, look.badge, compact);
|
|
677
|
+
if (covered(foot)) return null;
|
|
678
|
+
if (!force && touches(foot)) return null;
|
|
679
|
+
// Every place tried keeps within the area's sides, a slide's too (#4376 review): none there, hover or focus.
|
|
680
|
+
if (!force && ar && (box.x < ar.rect.x || box.x + box.w > ar.rect.x + ar.rect.w)) return null;
|
|
681
|
+
sk.drawTag(ctx, x + dx, y + dy, look, env, compact);
|
|
682
|
+
tags.push(box); taken.push(foot);
|
|
683
|
+
return box;
|
|
684
|
+
};
|
|
685
|
+
for (const [dy, compact] of tries) { const b = at(0, dy, compact); if (b) return b; }
|
|
686
|
+
const [dy0, c0] = tries[0], b0 = tagFootprint(ctx, tagBox(ctx, x, y + dy0, look.label, c0, look.fit), look.badge, c0);
|
|
687
|
+
for (const o of keep.filter((k) => overlaps(b0, k))) {
|
|
688
|
+
for (const dx of [o.x - (b0.x + b0.w) - 2, o.x + o.w - b0.x + 2]) if (Math.abs(dx) <= b0.w) { const b = at(dx, dy0, c0); if (b) return b; }
|
|
689
|
+
}
|
|
690
|
+
return null;
|
|
691
|
+
};
|
|
692
|
+
const FULL_TRIES = [[0, false], [TAG_ROW, false], [0, true], [COMPACT_ROW, true]];
|
|
693
|
+
const tagOrder = people.filter((q) => !(live.hidden.has(q.look.name) && q.look.name !== heldName) && tagged(q))
|
|
694
|
+
.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);
|
|
695
|
+
for (const { q, rank } of tagOrder) place(q.at.x, q.at.y, q.look, FULL_TRIES, rank === 0);
|
|
632
696
|
// A furniture item's own name (#2574: an NPC drawn as furniture), tagged like a person; none on a tile too small to read.
|
|
633
697
|
// #2698: an item hiding its people carries their tags too, in one row at its tag point (its own first; each keeps
|
|
634
698
|
// its place in the row while another's tag is left out), and their bubbles, over its picture. The tags drawn are
|
|
@@ -637,10 +701,7 @@ export function drawPart(ctx, p, a, ox, oy, ms, still, hot, env, tagsOff = false
|
|
|
637
701
|
for (const f of furniture) {
|
|
638
702
|
const on = people.filter((q) => live.hidden.get(q.look.name) === f.id && q.look.name !== heldName);
|
|
639
703
|
if (!on.length) {
|
|
640
|
-
if (!tagsOff && f.label)
|
|
641
|
-
const nl = npcLook(p, f), box = tagBox(ctx, f.x, f.y, nl.label);
|
|
642
|
-
sk.drawTag(ctx, f.x, f.y, nl, env); tags.push(box); taken.push(tagFootprint(ctx, box, nl.badge));
|
|
643
|
-
}
|
|
704
|
+
if (!tagsOff && f.label) place(f.x, f.y, npcLook(p, f), [[0, false], [TAG_ROW, false]]);
|
|
644
705
|
continue;
|
|
645
706
|
}
|
|
646
707
|
const order = new Map((f.activeFor || []).map((n, i) => [n, i]));
|
|
@@ -651,10 +712,9 @@ export function drawPart(ctx, p, a, ox, oy, ms, still, hot, env, tagsOff = false
|
|
|
651
712
|
const q = f.label ? on[i - 1] : on[i];
|
|
652
713
|
if (q) speakers.push({ look: q.look, x: r.x + 10, y: top, area: q.d.area });
|
|
653
714
|
if (q ? !tagged(q) : tagsOff) continue;
|
|
654
|
-
|
|
655
|
-
const box =
|
|
656
|
-
|
|
657
|
-
if (q) held.push({ name: q.look.name, id: f.id, box });
|
|
715
|
+
// The row stays one row (each keeps its place): drawn there, covering nothing else's, or left to hover.
|
|
716
|
+
const box = place(r.x, f.y, r.look, [[0, false]], !!q && pinned(q));
|
|
717
|
+
if (q && box) held.push({ name: q.look.name, id: f.id, box });
|
|
658
718
|
}
|
|
659
719
|
}
|
|
660
720
|
p.heldTags = held;
|
|
@@ -663,13 +723,7 @@ export function drawPart(ctx, p, a, ox, oy, ms, still, hot, env, tagsOff = false
|
|
|
663
723
|
// neighbour's tag goes a row lower (COMPACT_ROW) rather than out, so a row of people reads as two staggered rows.
|
|
664
724
|
if (!tagsOff) for (const q of people) {
|
|
665
725
|
if (live.hidden.has(q.look.name) || !crowded(q)) continue;
|
|
666
|
-
|
|
667
|
-
const box = tagBox(ctx, q.at.x, q.at.y + dy, q.look.label, true), foot = tagFootprint(ctx, box, q.look.badge, true);
|
|
668
|
-
if (touches(foot)) continue;
|
|
669
|
-
sk.drawTag(ctx, q.at.x, q.at.y + dy, q.look, env, true);
|
|
670
|
-
tags.push(box); taken.push(foot);
|
|
671
|
-
break;
|
|
672
|
-
}
|
|
726
|
+
place(q.at.x, q.at.y, q.look, [[0, true], [COMPACT_ROW, true]]);
|
|
673
727
|
}
|
|
674
728
|
} else {
|
|
675
729
|
for (const d of p.desks) { const look = p.looks.get(d.key); sk.drawCharacter(ctx, d, actPosed(p, look), ms, env); speakers.push({ look, x: d.x + 58, y: d.y + 12, area: p.roomOf.get(d.key) ?? null }); }
|
|
@@ -730,7 +784,7 @@ export function drawPart(ctx, p, a, ox, oy, ms, still, hot, env, tagsOff = false
|
|
|
730
784
|
}
|
|
731
785
|
// A crowded area speaks less (thinBubbles: calls, then work, a few at most); no bubble covers a name tag. `defer`
|
|
732
786
|
// (All offices): drawn after every tile, unclipped, so a bubble at a tile's edge is whole.
|
|
733
|
-
const placed = placeBubbles(thinBubbles(bubbles, p.zones ? p.L.over : null), 22, tags);
|
|
787
|
+
const placed = placeBubbles(thinBubbles(bubbles, p.zones ? p.L.over : null), 22, titleBoxes.length ? [...tags, ...titleBoxes] : tags);
|
|
734
788
|
const say = () => { T(); for (const { sp, b, dy } of placed) {
|
|
735
789
|
const text = [...b.text].slice(0, b.shown).join("");
|
|
736
790
|
sk.drawBubble(ctx, sp.x, sp.y, text, env, -dy);
|
|
@@ -842,7 +896,10 @@ export function OfficeKey({ pal }) {
|
|
|
842
896
|
* page's own stream (the fleet's offices, acts and skins); `storage` where this browser's choices are kept (not the
|
|
843
897
|
* Fleet office's); `cardRows(name)` a card's rows instead of the office's (the room's: owner, introduction); `words(node)`
|
|
844
898
|
* a person's state and activity in the page's own words ({ state, now }: the room's member list's), instead of the Fleet's;
|
|
845
|
-
* `
|
|
899
|
+
* `foldBar` (with `onMore`): no options row over the scene on a desk either — the options open in the sheet from a button
|
|
900
|
+
* in the zoom stack (a Hub room's office: the scene right under the room's header, M-3533 #4370);
|
|
901
|
+
* `cardAction(name)` a card's main action ({ label, title, run }: the room's "@ it"), or null; `cardName(name)` a card's
|
|
902
|
+
* title instead of the person's name (the room's: the agent's own, without the owner its scene label carries); `officesKey` read the offices
|
|
846
903
|
* again when it changes (a page with no stream: the room's office when an agent joins, leaves or is renamed).
|
|
847
904
|
*/
|
|
848
905
|
function ensureDialogueStyle() {
|
|
@@ -853,11 +910,11 @@ function ensureDialogueStyle() {
|
|
|
853
910
|
link.setAttribute("data-office-dialogue-css", "1"); doc.head.appendChild(link);
|
|
854
911
|
}
|
|
855
912
|
export function Office({ view, traffic, q = "", lease, onOpen, assetUrl, assetImage, opening, talk, more = false, onMore = null, live = null, onLive = null,
|
|
856
|
-
oneOffice = false, readOnly = false, stream = true, storage = undefined, cardRows = null, words = null, cardAction = null, officesKey = undefined }) {
|
|
913
|
+
oneOffice = false, readOnly = false, stream = true, storage = undefined, cardRows = null, words = null, cardAction = null, cardName = null, officesKey = undefined, foldBar = false }) {
|
|
857
914
|
// M-3253: on a phone the page above (fleet-canvas.js) puts a ⋯ in its bar: `more` is that sheet open, `onMore(open)`;
|
|
858
915
|
// `live` / `onLive` its Live toggle, which moves into the sheet. Without one (a share link's page) the bar stays.
|
|
859
916
|
useLayoutEffect(ensureDialogueStyle, []);
|
|
860
|
-
const phone = useOfficePhone(), compact = phone && typeof onMore === "function";
|
|
917
|
+
const phone = useOfficePhone(), compact = phone && typeof onMore === "function", folded = compact || (foldBar && typeof onMore === "function");
|
|
861
918
|
const store = useMemo(() => createOfficeStore({ ...(lease ? { fetch: (path, o) => lease.fetch(path, o) } : {}), ...(storage ? { storage } : {}) }), [lease, storage]);
|
|
862
919
|
const streamOn = () => (stream === false ? null : appStore.get().streamOn);
|
|
863
920
|
const stateOf = (node) => (words ? words(node).state : stateWords(node));
|
|
@@ -943,6 +1000,18 @@ export function Office({ view, traffic, q = "", lease, onOpen, assetUrl, assetIm
|
|
|
943
1000
|
const walkers = useMemo(() => createWalkers(), []);
|
|
944
1001
|
const seatsRef = useRef(new Map()); // the zones layout's last seats: kept where they can be
|
|
945
1002
|
const seatPrefsRef = useRef({}), seatKeyRef = useRef(""), seatDropRef = useRef(null);
|
|
1003
|
+
const placedRef = useRef(null); // M-3539: the office and style the walkers were last placed for
|
|
1004
|
+
// M-3539: the phone's zone chips scroll sideways when they do not fit (English); a fade at the side there is more
|
|
1005
|
+
// (data-more-left / data-more-right) says so.
|
|
1006
|
+
const pillsRef = useRef(null);
|
|
1007
|
+
const pillsCue = () => {
|
|
1008
|
+
const e = pillsRef.current;
|
|
1009
|
+
if (!e || typeof e.toggleAttribute !== "function") return;
|
|
1010
|
+
const more = e.scrollWidth - e.clientWidth;
|
|
1011
|
+
e.toggleAttribute("data-more-left", more > 1 && e.scrollLeft > 1);
|
|
1012
|
+
e.toggleAttribute("data-more-right", more > 1 && e.scrollLeft < more - 1);
|
|
1013
|
+
};
|
|
1014
|
+
useLayoutEffect(pillsCue);
|
|
946
1015
|
const [seatRev, setSeatRev] = useState(0);
|
|
947
1016
|
// #2554: All offices' tiles keep their own: seats (by tile and style), walkers and flights (by tile); and the items
|
|
948
1017
|
// flying between tiles.
|
|
@@ -1221,8 +1290,11 @@ export function Office({ view, traffic, q = "", lease, onOpen, assetUrl, assetIm
|
|
|
1221
1290
|
const nodes = all.filter(keep);
|
|
1222
1291
|
if (zones) {
|
|
1223
1292
|
const skKey = shared ? "" : officeKey;
|
|
1224
|
-
|
|
1225
|
-
|
|
1293
|
+
// M-3533 (#4370): the seats given restart when the office or its style changes — on a shared page too (a room's
|
|
1294
|
+
// office, a share link), whose per-device seat choices are not kept (skKey ""), so a style with more seats is not
|
|
1295
|
+
// drawn with the old one's overflow spots.
|
|
1296
|
+
if (seatKeyRef.current !== officeKey) {
|
|
1297
|
+
seatKeyRef.current = officeKey;
|
|
1226
1298
|
seatsRef.current = new Map();
|
|
1227
1299
|
seatPrefsRef.current = skKey ? store.seats(skKey) : {};
|
|
1228
1300
|
}
|
|
@@ -1284,6 +1356,8 @@ export function Office({ view, traffic, q = "", lease, onOpen, assetUrl, assetIm
|
|
|
1284
1356
|
// offices, the carousel or Edit layout. `hold`: the person picked up (carried where the pointer is, walked back from
|
|
1285
1357
|
// where they are dropped, or seated on another seat in their area: M-3445 #4266/#4267); `reacts`: pats and feeds showing.
|
|
1286
1358
|
const play = playAllowed({ on: playOn, still, zones, overview, layout: !!layout, shared }) && !carouselPick;
|
|
1359
|
+
// M-3547 / M-3556: off only for reduced motion — one line under Drag and pat in Display options says so (no override).
|
|
1360
|
+
const playStillOff = playOffForMotion({ on: playOn, still, zones, overview, layout: !!layout, shared }) && !carouselPick;
|
|
1287
1361
|
const hold = useMemo(() => createHold(), []), reacts = useRef(new Map()), walkNow = useRef(null), holdTimer = useRef(null);
|
|
1288
1362
|
// M-3432 (#4255): custom snacks from the active skin pack (client-local, only when play is enabled).
|
|
1289
1363
|
const snacks = useMemo(() => createSnacks(), []);
|
|
@@ -1313,7 +1387,11 @@ export function Office({ view, traffic, q = "", lease, onOpen, assetUrl, assetIm
|
|
|
1313
1387
|
for (const [name, at] of snacks.targets(t)) to.set(name, at);
|
|
1314
1388
|
const held = hold.held(); // M-3293: carried: where the pointer is, no walk
|
|
1315
1389
|
if (held) to.set(held.name, held.at);
|
|
1316
|
-
|
|
1390
|
+
// M-3539: a new office or style (a room's office reads its style after it opens) puts everyone at their place at
|
|
1391
|
+
// once: walking there from the old one's seats drew the asleep standing in the help desk for seconds.
|
|
1392
|
+
const placed = `${officeKey}\n${skin.id}`, fresh = placedRef.current !== placed;
|
|
1393
|
+
placedRef.current = placed;
|
|
1394
|
+
walkers.sync(to, t, L, still, fresh);
|
|
1317
1395
|
// Reduced motion has no loop: drawn again here, or an act's walk (set after the scene was drawn) never shows.
|
|
1318
1396
|
if (still) { if (scene.current && !globalThis.document?.hidden) draw(0); } else loop.current?.wake();
|
|
1319
1397
|
};
|
|
@@ -1627,7 +1705,15 @@ export function Office({ view, traffic, q = "", lease, onOpen, assetUrl, assetIm
|
|
|
1627
1705
|
ctx.fillStyle = s.matte; ctx.fillRect(0, 0, BW, BH);
|
|
1628
1706
|
ctx.imageSmoothingEnabled = false;
|
|
1629
1707
|
if (!s.overview) {
|
|
1630
|
-
|
|
1708
|
+
// #4379 review: an open card (beside its person, or a bottom sheet) covers part of the scene: a name tag under it is
|
|
1709
|
+
// left out whole, never a fragment showing past its edge. Its box in bitmap px, as the canvas lies on the page.
|
|
1710
|
+
const cardNow = cardEl.current, cvNow = canvasRef.current;
|
|
1711
|
+
if (cardNow && cvNow && typeof cardNow.getBoundingClientRect === "function" && typeof cvNow.getBoundingClientRect === "function") {
|
|
1712
|
+
const r = cardNow.getBoundingClientRect(), c = cvNow.getBoundingClientRect();
|
|
1713
|
+
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;
|
|
1714
|
+
} else s.part.cover = null;
|
|
1715
|
+
const e0 = clocked(""), kc = keepClearOf(canvasRef.current, v);
|
|
1716
|
+
const moved = drawPart(ctx, s.part, a, ox, oy, ms, still, tipNow.current, kc.length ? { ...e0, keepClear: kc } : e0, false, null, s.bubbleHits);
|
|
1631
1717
|
if (seenClips) clipClocks.current.prune(seenClips);
|
|
1632
1718
|
return drawDialogue(ctx, s, ms) || moved;
|
|
1633
1719
|
}
|
|
@@ -2289,30 +2375,54 @@ export function Office({ view, traffic, q = "", lease, onOpen, assetUrl, assetIm
|
|
|
2289
2375
|
n: people.filter((d) => d.area === areaName(key)).length })).filter((z) => z.rect && z.n > 0) : [];
|
|
2290
2376
|
const toZone = (z) => { const v = view0(); raw.current = ZONE_K; setView(centreOn({ ...v, k: ZONE_K }, size, z.rect.x + z.rect.w / 2, z.rect.y + z.rect.h / 2)); };
|
|
2291
2377
|
const closeMore = () => onMore && onMore(false);
|
|
2378
|
+
// M-3556: Display options (style, the toggles, the key) in a dropdown on a desk — non-modal, like Members: the office
|
|
2379
|
+
// stays in view, so a tick shows at once; a click elsewhere or Esc closes it. The Fleet office opens it from ⚙ in its
|
|
2380
|
+
// bar (open here); a Hub room's office (foldBar) from the gear in the zoom stack, open as its page says (`more`).
|
|
2381
|
+
const roomGear = folded && !compact;
|
|
2382
|
+
const [displayOpen, setDisplayOpen] = useState(false);
|
|
2383
|
+
const dispOpen = roomGear ? !!more : displayOpen;
|
|
2384
|
+
const setDisp = (v) => (roomGear ? onMore(v) : setDisplayOpen(v));
|
|
2385
|
+
const displayRef = useRef(null);
|
|
2386
|
+
useEffect(() => {
|
|
2387
|
+
if (!dispOpen) return undefined;
|
|
2388
|
+
const away = (e) => { if (displayRef.current && !displayRef.current.contains(e.target)) setDisp(false); };
|
|
2389
|
+
// Esc from inside it hands focus back to its button (as the sheet did), so the keyboard is not left on nothing.
|
|
2390
|
+
const esc = (e) => {
|
|
2391
|
+
if (e.key !== "Escape") return;
|
|
2392
|
+
const box = displayRef.current, back = !!box && typeof box.contains === "function" && box.contains(globalThis.document?.activeElement);
|
|
2393
|
+
setDisp(false);
|
|
2394
|
+
if (back) box.querySelector("button")?.focus?.();
|
|
2395
|
+
};
|
|
2396
|
+
document.addEventListener("pointerdown", away); document.addEventListener("keydown", esc);
|
|
2397
|
+
return () => { document.removeEventListener("pointerdown", away); document.removeEventListener("keydown", esc); };
|
|
2398
|
+
}, [dispOpen]);
|
|
2399
|
+
// M-3556: the phone sheet is taller than a phone: while more is below its fold, its foot fades (data-more on the body).
|
|
2400
|
+
useEffect(() => {
|
|
2401
|
+
if (!compact || !more) return undefined;
|
|
2402
|
+
const el = globalThis.document?.querySelector?.(".oo-sheet .dlg-body");
|
|
2403
|
+
if (!el || typeof el.addEventListener !== "function") return undefined;
|
|
2404
|
+
const upd = () => { const below = el.scrollTop + el.clientHeight < el.scrollHeight - 2; if (below) el.setAttribute("data-more", ""); else el.removeAttribute("data-more"); };
|
|
2405
|
+
const raf = globalThis.requestAnimationFrame ? globalThis.requestAnimationFrame(upd) : (upd(), 0);
|
|
2406
|
+
el.addEventListener("scroll", upd, { passive: true }); globalThis.addEventListener?.("resize", upd);
|
|
2407
|
+
// Its content can change while it is open (another office, All offices' lobby tile, a note): re-measure then too
|
|
2408
|
+
// (Prism #3556 r3 P3).
|
|
2409
|
+
const RO = globalThis.ResizeObserver, ro = typeof RO === "function" ? new RO(upd) : null;
|
|
2410
|
+
if (ro) { ro.observe(el); for (const c of el.children || []) ro.observe(c); }
|
|
2411
|
+
return () => { globalThis.cancelAnimationFrame?.(raf); el.removeEventListener("scroll", upd); globalThis.removeEventListener?.("resize", upd); ro?.disconnect(); };
|
|
2412
|
+
}, [compact, more]);
|
|
2292
2413
|
// In the sheet: Edit offices and Edit layout open their own editors (outside it): the sheet closes after their click.
|
|
2293
2414
|
const sheetClick = (e) => { if (typeof e.target?.closest === "function" && e.target.closest(".oo-edit, .oo-layout")) closeMore(); };
|
|
2294
2415
|
const tile = (icon, label, fn, cls, pressed) => html`<button type="button" class=${`oo-sheet-tile ${cls}`} aria-pressed=${pressed === undefined ? undefined : pressed ? "true" : "false"}
|
|
2295
2416
|
onClick=${fn}><${Icon} name=${icon} size=${20} /><span>${label}</span></button>`;
|
|
2296
|
-
|
|
2417
|
+
// M-3556: the bar in three groups — scope (which office, whom: left of the desk's one row), the display options (behind
|
|
2418
|
+
// ⚙) and the actions (right). A phone's ⋯ sheet lists all three in that order.
|
|
2419
|
+
const scopeItems = html`
|
|
2297
2420
|
${oneOffice ? null : html`<label class="oo-pick"><span class="oo-pick-label">${to("office")}</span>${officeSelect("oo-office")}</label>`}
|
|
2298
|
-
${auto ? html`<label class="oo-pick"><span class="oo-pick-label">${to("styleLabel")}</span>
|
|
2299
|
-
<select class="tb-select" value=${STYLES.includes(style) || packs.some((pk) => pk.id === style) ? style : skin.id} title=${to(canEdit ? "styleForAll" : "styleHere")} onChange=${(e) => pickStyle(e.target.value)}>
|
|
2300
|
-
${styles.map((id) => html`<option key=${id} value=${id}>${to(`style_${id}`)}</option>`)}
|
|
2301
|
-
${packs.map((pk) => html`<option key=${`pack:${pk.id}`} value=${pk.id}>${pk.name}</option>`)}
|
|
2302
|
-
</select></label>` : null}
|
|
2303
2421
|
${auto ? html`<label class="oo-pick"><span class="oo-pick-label">${to("show")}</span>
|
|
2304
|
-
<select class="tb-select" value=${teamValue} onChange=${(e) => { const o = opts.find((x) => x.value === e.target.value); setF({ ...f, team: o ? o.team : "" }); }}>
|
|
2422
|
+
<select class="tb-select oo-team" value=${teamValue} onChange=${(e) => { const o = opts.find((x) => x.value === e.target.value); setF({ ...f, team: o ? o.team : "" }); }}>
|
|
2305
2423
|
${opts.map((o) => html`<option key=${o.value} value=${o.value}>${o.label}</option>`)}
|
|
2306
2424
|
</select></label>
|
|
2307
2425
|
<${People} nodes=${everyone} pinned=${f.pinned} onChange=${(pinned) => setF({ ...f, pinned })} />` : null}
|
|
2308
|
-
<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>
|
|
2309
|
-
${zones && !overview && !shared ? html`<label class="check oo-play" title=${still ? to("playStill") : null}><input type="checkbox" checked=${playOn && !still} disabled=${still}
|
|
2310
|
-
onChange=${() => { const v = !playOn; store.savePlayOn(v); setPlayOn(v); }} /><span>${to("playOn")}</span></label>` : null}
|
|
2311
|
-
${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}
|
|
2312
|
-
<label class="check oo-dialogue" title=${to("dialogueTitle")}><input type="checkbox" checked=${dialogueOn} onChange=${toggleDialogue} /><span>${to("dialogue")}</span></label>
|
|
2313
|
-
${overview ? html`<label class="check oo-lobby-tile" title=${lobbyAll.length ? undefined : to("lobbyEveryone")}><input type="checkbox" checked=${lobbyOn && lobbyAll.length > 0}
|
|
2314
|
-
disabled=${!lobbyAll.length} onChange=${() => { const v = !lobbyOn; store.saveLobbyTile(v); setLobbyOn(v); setTip(null); }} /><span>${to("lobbyTile")}</span></label>
|
|
2315
|
-
${lobbyAll.length ? null : html`<span class="muted oo-note oo-lobby-none">${to("lobbyEveryone")}</span>`}` : null}
|
|
2316
2426
|
${carouselPick ? html`<div class="oo-carousel">
|
|
2317
2427
|
<${CarouselOffices} stored=${stored} carIds=${carIds} open=${carMenu} onOpen=${setCarMenu} onToggle=${toggleCarId}
|
|
2318
2428
|
onAll=${() => setCarIds(stored.map((o) => o.id))} onNone=${() => setCarIds([])} />
|
|
@@ -2324,23 +2434,61 @@ export function Office({ view, traffic, q = "", lease, onOpen, assetUrl, assetIm
|
|
|
2324
2434
|
</div>` : null}
|
|
2325
2435
|
${custom && baseSkin.id !== custom.skin && !loading ? html`<span class="muted oo-note">${to("skinUnknown", styleName(custom.skin))}</span>` : null}
|
|
2326
2436
|
${placed.ignored ? html`<span class="muted oo-note">${to("layoutIgnored")}</span>` : null}
|
|
2327
|
-
${styleErr && auto ? html`<span class="note oo-note oo-style-err" role="status">${styleErr}</span>` : null}
|
|
2328
|
-
${traffic ? html`<button type="button" class=${`btn btn-sm oo-key-btn${keyOpen ? " on" : ""}`} aria-expanded=${keyOpen ? "true" : "false"} title=${to("keyTitle")}
|
|
2329
|
-
onClick=${() => { const v = !keyOpen; store.saveKeyOpen(v); setKeyOpen(v); }}>${to("key")}</button>` : null}
|
|
2330
2437
|
${L.unseated ? html`<span class="muted oo-note">${to("unseated", L.unseated)}</span>` : null}
|
|
2438
|
+
`;
|
|
2439
|
+
const optionItems = html`
|
|
2440
|
+
${auto ? html`<label class="oo-pick"><span class="oo-pick-label">${to("styleLabel")}</span>
|
|
2441
|
+
<select class="tb-select oo-style" value=${STYLES.includes(style) || packs.some((pk) => pk.id === style) ? style : skin.id} title=${to(canEdit ? "styleForAll" : "styleHere")} onChange=${(e) => pickStyle(e.target.value)}>
|
|
2442
|
+
${styles.map((id) => html`<option key=${id} value=${id}>${to(`style_${id}`)}</option>`)}
|
|
2443
|
+
${packs.map((pk) => html`<option key=${`pack:${pk.id}`} value=${pk.id}>${pk.name}</option>`)}
|
|
2444
|
+
</select></label>` : null}
|
|
2445
|
+
<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>
|
|
2446
|
+
${zones && !overview && !shared ? html`<label class="check oo-play"><input type="checkbox" checked=${playOn && !still} disabled=${still}
|
|
2447
|
+
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}
|
|
2448
|
+
${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}
|
|
2449
|
+
<label class="check oo-dialogue" title=${to("dialogueTitle")}><input type="checkbox" checked=${dialogueOn} onChange=${toggleDialogue} /><span>${to("dialogue")}</span></label>
|
|
2450
|
+
${overview ? html`<label class="check oo-lobby-tile" title=${lobbyAll.length ? undefined : to("lobbyEveryone")}><input type="checkbox" checked=${lobbyOn && lobbyAll.length > 0}
|
|
2451
|
+
disabled=${!lobbyAll.length} onChange=${() => { const v = !lobbyOn; store.saveLobbyTile(v); setLobbyOn(v); setTip(null); }} /><span>${to("lobbyTile")}</span></label>
|
|
2452
|
+
${lobbyAll.length ? null : html`<span class="muted oo-note oo-lobby-none">${to("lobbyEveryone")}</span>`}` : null}
|
|
2453
|
+
${traffic ? html`<label class="check oo-key-tick" title=${to("keyTitle")}><input type="checkbox" checked=${keyOpen}
|
|
2454
|
+
onChange=${() => { const v = !keyOpen; store.saveKeyOpen(v); setKeyOpen(v); }} /><span>${to("key")}</span></label>` : null}
|
|
2455
|
+
${styleErr && auto ? html`<span class="note oo-note oo-style-err" role="status">${styleErr}</span>` : null}
|
|
2456
|
+
`;
|
|
2457
|
+
const actionItems = html`
|
|
2331
2458
|
${canEdit && storedRev !== null ? html`<button type="button" class="btn btn-sm oo-edit" onClick=${() => { if (!overview && !carouselPick) setEditing(true); }} disabled=${!!layout || overview || carouselPick}
|
|
2332
2459
|
title=${overview || carouselPick ? to(carouselPick ? "carouselNoEdit" : "overviewNoEdit") : undefined}>${t("orge.edit")}</button>` : null}
|
|
2333
2460
|
${canLayout ? html`<button type="button" class="btn btn-sm oo-layout" onClick=${openLayout}>${t("orgl.edit")}</button>` : null}
|
|
2334
2461
|
${canShare ? html`<${ShareButton} offices=${stored} current=${overview ? "all" : custom ? custom.id : null} disabled=${!!layout}
|
|
2335
|
-
get=${lease ? (path, o) => lease.fetch(path, o) : undefined} />` : null}
|
|
2462
|
+
get=${lease ? (path, o) => lease.fetch(path, o) : undefined} />` : null}
|
|
2463
|
+
`;
|
|
2464
|
+
// The sheet: a "Display options" heading over the options (a Hub room's too), a rule before the actions (a room has none).
|
|
2465
|
+
const hasActions = (canEdit && storedRev !== null) || canLayout || canShare;
|
|
2466
|
+
const barItems = html`${scopeItems}<h3 class="oo-sheet-h">${to("display")}</h3>${optionItems}
|
|
2467
|
+
${hasActions ? html`<hr class="oo-sheet-rule" />` : null}${actionItems}`;
|
|
2468
|
+
// A room's dropdown hangs from the zoom stack's top, inside the stage (which clips): it is never taller than the
|
|
2469
|
+
// stage's room below its top (Prism #3556 P2: a 340 px stage); a longer list scrolls.
|
|
2470
|
+
const fitPop = (el) => {
|
|
2471
|
+
if (!el || !roomGear || !stageRef.current || typeof el.getBoundingClientRect !== "function") return;
|
|
2472
|
+
const st = stageRef.current.getBoundingClientRect(), top = el.getBoundingClientRect().top;
|
|
2473
|
+
if (st && st.height > 0) el.style.maxHeight = `${popMaxHeight(st.bottom, top)}px`;
|
|
2474
|
+
};
|
|
2475
|
+
const displayMenu = (opener) => html`<div class=${`oo-display${roomGear ? " oo-display-zoom" : ""}`} ref=${displayRef}>${opener}
|
|
2476
|
+
${dispOpen ? html`<div class="oo-display-pop" role="group" aria-label=${to("display")} ref=${fitPop}><h3 class="oo-display-h">${to("display")}</h3>
|
|
2477
|
+
<div class="oo-bar oo-display-list">${optionItems}</div></div>` : null}</div>`;
|
|
2336
2478
|
return html`<div class=${`oo${fs ? ` fs ${fs}` : ""}${compact ? " phone" : ""}${dlgVisible ? " has-dialogue" : ""}`} ref=${ooRef}>
|
|
2337
|
-
${
|
|
2479
|
+
${folded ? null : html`<div class="oo-bar oo-bar-row">
|
|
2480
|
+
<div class="oo-bar-scope">${scopeItems}</div>
|
|
2481
|
+
<div class="oo-bar-actions">${actionItems}
|
|
2482
|
+
${displayMenu(html`<button type="button" class=${`btn btn-sm oo-display-btn${dispOpen ? " on" : ""}`} aria-expanded=${dispOpen ? "true" : "false"}
|
|
2483
|
+
onClick=${() => setDisp(!dispOpen)}><${Icon} name="settings" size=${14} /><span>${to("display")}</span></button>`)}
|
|
2484
|
+
</div>
|
|
2485
|
+
</div>`}
|
|
2338
2486
|
${compact && more ? html`<${Dialog} title=${to("office")} cls="oo-sheet" onClose=${closeMore}>
|
|
2339
|
-
|
|
2487
|
+
${compact ? html`<div class="oo-sheet-tiles">
|
|
2340
2488
|
${tile("fitwidth", to("fit"), () => { closeMore(); fit(); }, "oo-sheet-fit")}
|
|
2341
2489
|
${tile("fitwidth", to("fill"), toggleFill, "oo-sheet-fill", fitMode === "cover")}
|
|
2342
2490
|
${tile("fullscreen", to("fullscreen"), () => { closeMore(); enterFs(); }, "oo-sheet-fs")}
|
|
2343
|
-
</div
|
|
2491
|
+
</div>` : null}
|
|
2344
2492
|
${typeof onLive === "function" ? html`<label class="check oo-sheet-live"><input type="checkbox" checked=${!!live} onChange=${() => onLive(!live)} /><span>${t("orgc.live")}</span></label>` : null}
|
|
2345
2493
|
<div class="oo-bar oo-sheet-bar" onClick=${sheetClick}>${barItems}</div>
|
|
2346
2494
|
</${Dialog}>` : null}
|
|
@@ -2367,10 +2515,12 @@ export function Office({ view, traffic, q = "", lease, onOpen, assetUrl, assetIm
|
|
|
2367
2515
|
${tipDesk.office ? html`<div class="muted oo-tip-office">${tipDesk.office}</div>` : null}
|
|
2368
2516
|
</div>` : null}
|
|
2369
2517
|
${cardOf ? html`<${OfficeCard} key=${cardOf.key}
|
|
2370
|
-
model=${cardModel({ node: cardOf.node, lv, levels: wordsOf(cardOf.skin), share: !onOpen, rows: cardRows ? cardRows(cardOf.node.name) : null,
|
|
2518
|
+
model=${cardModel({ node: cardOf.node, lv, levels: wordsOf(cardOf.skin), share: !onOpen, rows: cardRows ? cardRows(cardOf.node.name) : null, display: cardName ? cardName(cardOf.node.name) : "",
|
|
2371
2519
|
state: stateOf(cardOf.node), now: nowOf(cardOf.node),
|
|
2372
2520
|
where: [cardOf.office || (custom ? custom.name : to("allOffice")), cardOf.area].filter(Boolean).join(" · ") })}
|
|
2373
|
-
avatar=${drawAvatar} sheet=${phone || size.w < SHEET_W} place=${(el) => { cardEl.current = el; placeCard();
|
|
2521
|
+
avatar=${drawAvatar} sheet=${phone || size.w < SHEET_W} place=${(el) => { const was = cardEl.current; cardEl.current = el; placeCard();
|
|
2522
|
+
// #4379 review: the tags it covers (or uncovers) are judged at the next frame; a still scene draws one now.
|
|
2523
|
+
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(); } }}
|
|
2374
2524
|
onChat=${onOpen ? () => { const n = cardOf.node.name; setCard(null); open(n); } : null} onFind=${findCard} onClose=${closeCard}
|
|
2375
2525
|
onReact=${play ? (kind) => {
|
|
2376
2526
|
const n = cardOf.node.name;
|
|
@@ -2393,7 +2543,7 @@ export function Office({ view, traffic, q = "", lease, onOpen, assetUrl, assetIm
|
|
|
2393
2543
|
const nt = nodeText(d.node), cap = nowOf(d.node), where = d.office ? ` · ${d.office}` : "";
|
|
2394
2544
|
const full = words ? `${nt.primary} — ${stateOf(d.node)}` : nt.full;
|
|
2395
2545
|
return html`<li key=${d.key}>${d.node.i
|
|
2396
|
-
? html`<button type="button" class="oo-desk" data-name=${d.node.name} data-key=${d.key} aria-label=${`${full}${where}${cap ? ` · ${cap}` : ""}.`} aria-haspopup="dialog"
|
|
2546
|
+
? html`<button type="button" class="oo-desk" data-name=${d.node.name} data-key=${d.key} data-slot=${Number.isInteger(d.box?.slot) ? d.box.slot : undefined} aria-label=${`${full}${where}${cap ? ` · ${cap}` : ""}.`} aria-haspopup="dialog"
|
|
2397
2547
|
onFocus=${() => setTip(d.key)} onBlur=${() => setTip(null)} onClick=${() => { cardFrom.current = d.key; setCard((cur) => (cur === d.key ? null : d.key)); }}>${nt.primary}</button>`
|
|
2398
2548
|
: html`<span class="oo-desk" data-name=${d.node.name} data-key=${d.key}>${full}</span>`}</li>`;
|
|
2399
2549
|
})}</ul>
|
|
@@ -2405,6 +2555,7 @@ export function Office({ view, traffic, q = "", lease, onOpen, assetUrl, assetIm
|
|
|
2405
2555
|
<button type="button" class=${`icon-btn oo-fill${fitMode === "cover" ? " on" : ""}`} aria-pressed=${fitMode === "cover" ? "true" : "false"} aria-label=${to("fillTitle")}
|
|
2406
2556
|
title=${to("fillTitle")} onClick=${toggleFill}>${to("fill")}</button>
|
|
2407
2557
|
<button type="button" class="icon-btn oo-fs" aria-label=${to(fs ? "exitFullscreen" : "fullscreen")} title=${to(fs ? "exitFullscreen" : "fullscreen")} onClick=${toggleFs}><${Icon} name=${fs ? "fullscreenexit" : "fullscreen"} size=${16} /></button>
|
|
2558
|
+
${roomGear ? displayMenu(html`<button type="button" class=${`icon-btn oo-options${dispOpen ? " on" : ""}`} aria-expanded=${dispOpen ? "true" : "false"} aria-label=${to("display")} title=${to("display")} onClick=${() => setDisp(!dispOpen)}><${Icon} name="settings" size=${16} /></button>`) : null}
|
|
2408
2559
|
</div>
|
|
2409
2560
|
${showSnacks ? html`<div ref=${snackTrayRef} class="oo-snacks" role="toolbar" aria-label=${to("snacks")}>
|
|
2410
2561
|
${packSnacks.map((sn) => {
|
|
@@ -2435,7 +2586,7 @@ export function Office({ view, traffic, q = "", lease, onOpen, assetUrl, assetIm
|
|
|
2435
2586
|
<rect ref=${miniViewRef} class="oc-mini-view oo-mini-view" />
|
|
2436
2587
|
</svg>
|
|
2437
2588
|
</div>
|
|
2438
|
-
${zoneList.length ? html`<div class="oo-zone-pills" role="group" aria-label=${to("zones")}>
|
|
2589
|
+
${zoneList.length ? html`<div class="oo-zone-pills" role="group" aria-label=${to("zones")} ref=${pillsRef} onScroll=${pillsCue}>
|
|
2439
2590
|
<button type="button" class="btn btn-sm oo-zone-all" onClick=${() => fit()}>${to("zoneAll")}</button>
|
|
2440
2591
|
${zoneList.map((z) => html`<button key=${z.key} type="button" class="btn btn-sm oo-zone" data-area=${z.key} onClick=${() => toZone(z)}>${to("zoneN", areaName(z.key), z.n)}</button>`)}
|
|
2441
2592
|
</div>` : null}
|
|
@@ -4,7 +4,7 @@ register("hubMyAgents", {
|
|
|
4
4
|
offlineShort:"Offline · last seen {0}", knownShared:"{0} shared", oldCountOne:"1 Fleet needs an update to share agents from here.", oldCount:"{0} Fleets need an update to share agents from here.", namesMore:"{0} and {1} more", lead:"The agents you can share on this Hub, and who may ask each one.", refresh:"Refresh", refreshing:"Checking…", fleet:"Fleet", connected:"Connected", offline:"This Fleet is offline. Shown as last seen at {0}.", count:"{0} of {1} shared", select:"Select all", general:"Your Fleet's General. It can manage this Fleet.", classic:"ClassicBot room", classicHint:"Hub questions and answers are not posted in its Discord or Telegram room, and the room's chat is not copied to the Hub. It is one agent with one memory: it may use what it learned in the room when it answers here.",
|
|
5
5
|
old:"Update this Fleet to share agents from here.", update:"Update this Fleet", updateHint:"On that computer, open Settings → Hub and check its connection and version.", off:"Sharing from the Hub page is turned off in this Fleet's Settings → Hub.", denied:"Your Hub administrator hasn't allowed you to share agents.", unknown:"The Hub could not check whether sharing is allowed. Refresh to check.", remote:"This kind of agent can't answer Hub questions yet.", unavailable:"This agent cannot answer Hub questions right now.", limit:"This Fleet already shares 64 agents, the most allowed.", suspended:"This Fleet is paused on this Hub.", revoked:"This Fleet was removed from this Hub.",
|
|
6
6
|
lapsed:"Its backend or folder changed since you shared it, so Hub questions are refused until you share it again. The people who may ask it stay.", shareAgain:"Share again", needsReshare:"Needs re-share", kept:"(kept)",
|
|
7
|
-
shared:"Shared", nobody:"nobody may ask yet", peopleOne:"1 person may ask", people:"{0} people may ask", subjects:"{0} people, groups or teams may ask", paused:"Paused", sharing:"Sharing…", stopping:"Stopping…", uncertain:"Not confirmed yet: this Fleet hasn't answered. Refresh to check.", refused:"Not shared: {0}", changed:"This list changed. It has been refreshed; tick again.",
|
|
7
|
+
shared:"Shared", nobody:"nobody may ask yet", setWho:"Choose who may ask", peopleOne:"1 person may ask", people:"{0} people may ask", subjects:"{0} people, groups or teams may ask", paused:"Paused", sharing:"Sharing…", stopping:"Stopping…", uncertain:"Not confirmed yet: this Fleet hasn't answered. Refresh to check.", refused:"Not shared: {0}", changed:"This list changed. It has been refreshed; tick again.",
|
|
8
8
|
shareOne:"Share 1 agent", stopOne:"Stop sharing 1 agent", stopTitleOne:"Stop sharing 1 agent?", accessTitleOne:"1 agent is shared. Who may ask it?", share:"Share {0} agents", stop:"Stop sharing {0} agents", mixed:"Share {0} · Stop sharing {1}", apply:"Apply changes", cancel:"Cancel", stopTitle:"Stop sharing {0} agents?", stopBody:"People will no longer be able to ask: {0}. Their lists of who may ask are cleared.", stopHint:"To keep the lists and only stop answers for now, pause sharing instead.", stopGo:"Stop sharing", pause:"Pause instead", pauseOne:"Pause sharing", later:"Decide later", accessTitle:"{0} agents are shared. Who may ask them?", accessLead:"Nobody can ask them until you choose.", same:"The same people for all {0}", each:"Choose for each agent", choose:"Choose who may ask", previousMixed:"Use the list it had before", previous:"Use the list it had before ({0} people)", used:"The previous list is saved.", saved:"Saved", saveFailed:"Could not save access for {0}. Check the current agent and try again.", personal:"On my own computer", details:"Open {0}",
|
|
9
9
|
empty:"You don't have an agent on this Hub yet.", already:"You can already ask other people's agents: open Chats, or @mention an agent in a room.", emptyLead:"To have an agent of your own that colleagues can ask:", personalOff:"Personal agents are turned off on this Hub. Ask your Hub administrator.", fleetLead:"If you run AgEnD, share the agents in it.", connectDenied:"Ask your Hub administrator to let you connect a Fleet.", apps:"Your own Claude Code or Codex can also use this Hub for you. That is for asking and posting as you. Colleagues can't ask it.", appsLink:"My AI apps", failed:"The list could not be read. Refresh to try again.",
|
|
10
10
|
},
|
|
@@ -12,7 +12,7 @@ register("hubMyAgents", {
|
|
|
12
12
|
offlineShort:"離線 · 最後上線 {0}", knownShared:"已分享 {0}", oldCountOne:"有 1 個 Fleet 需要更新,才能從這裡分享 Agent。", oldCount:"有 {0} 個 Fleet 需要更新,才能從這裡分享 Agent。", namesMore:"{0} 等 {1} 個", lead:"可以分享到這個 Hub 的 Agent,以及誰可以向它們提問。", refresh:"重新整理", refreshing:"確認中…", fleet:"Fleet", connected:"已連接", offline:"這個 Fleet 目前離線,顯示的是 {0} 的狀態。", count:"已分享 {0} / {1}", select:"全選", general:"你的 Fleet 的 General,可以管理這個 Fleet。", classic:"ClassicBot 房間", classicHint:"Hub 的提問與回答不會貼到它的 Discord 或 Telegram 房間,房間的聊天也不會複製到 Hub。但它是同一個 Agent、同一份記憶:在這裡回答時,可能用到它在房間裡得知的內容。",
|
|
13
13
|
old:"請更新這個 Fleet,才能從這裡分享 Agent。", update:"更新這個 Fleet", updateHint:"請到那台電腦的「設定 → Hub」,確認連接狀態與版本。", off:"這個 Fleet 的「設定 → Hub」關閉了從 Hub 頁面分享。", denied:"Hub 管理員還沒有允許你分享 Agent。", unknown:"Hub 目前無法確認是否允許分享,請重新整理確認。", remote:"這種 Agent 還不能回答 Hub 的提問。", unavailable:"這個 Agent 目前無法回答 Hub 的提問。", limit:"這個 Fleet 已經分享 64 個 Agent,達到上限。", suspended:"這個 Fleet 在這個 Hub 已暫停。", revoked:"這個 Fleet 已從這個 Hub 移除。",
|
|
14
14
|
lapsed:"分享之後它的後端或資料夾換了,重新分享之前 Hub 的提問都會被拒絕。可以提問的人會保留。", shareAgain:"重新分享", needsReshare:"需要重新分享", kept:"(會保留)",
|
|
15
|
-
shared:"分享中", nobody:"還沒有人可以問", peopleOne:"1 人可以提問", people:"{0} 人可以提問", subjects:"{0} 個人員、群組或團隊可以提問", paused:"已暫停", sharing:"分享中…", stopping:"停止中…", uncertain:"還沒有確認:這個 Fleet 尚未回應,請重新整理確認。", refused:"沒有分享:{0}", changed:"清單已有變動並重新整理,請重新勾選。",
|
|
15
|
+
shared:"分享中", nobody:"還沒有人可以問", setWho:"設定誰可以問", peopleOne:"1 人可以提問", people:"{0} 人可以提問", subjects:"{0} 個人員、群組或團隊可以提問", paused:"已暫停", sharing:"分享中…", stopping:"停止中…", uncertain:"還沒有確認:這個 Fleet 尚未回應,請重新整理確認。", refused:"沒有分享:{0}", changed:"清單已有變動並重新整理,請重新勾選。",
|
|
16
16
|
shareOne:"分享 1 個 Agent", stopOne:"停止分享 1 個 Agent", stopTitleOne:"要停止分享 1 個 Agent 嗎?", accessTitleOne:"已分享 1 個 Agent。誰可以問它?", share:"分享 {0} 個 Agent", stop:"停止分享 {0} 個 Agent", mixed:"分享 {0} 個 · 停止分享 {1} 個", apply:"套用變更", cancel:"取消", stopTitle:"要停止分享 {0} 個 Agent 嗎?", stopBody:"同仁將無法再問:{0}。這些 Agent 的「可以提問的人」名單會被清除。", stopHint:"如果只是暫時不回答、想保留名單,請改用「暫停分享」。", stopGo:"停止分享", pause:"改為暫停", pauseOne:"暫停分享", later:"稍後再決定", accessTitle:"已分享 {0} 個 Agent。誰可以問它們?", accessLead:"在你選擇之前,沒有人可以問它們。", same:"{0} 個都用同一份名單", each:"每個 Agent 分開選", choose:"選擇誰可以提問", previousMixed:"沿用之前的名單", previous:"沿用之前的名單({0} 人)", used:"已儲存之前的名單。", saved:"已儲存", saveFailed:"無法儲存 {0} 的提問權限,請確認目前的 Agent 後再試。", personal:"在我的電腦上", details:"開啟 {0}",
|
|
17
17
|
empty:"你在這個 Hub 還沒有自己的 Agent。", already:"你現在就可以問別人的 Agent:到「對話」,或在房間裡 @ 一個 Agent。", emptyLead:"想要有自己的 Agent 讓同仁提問:", personalOff:"這個 Hub 還沒有開啟個人 Agent,請洽 Hub 管理員。", fleetLead:"如果你有在使用 AgEnD,可以分享裡面的 Agent。", connectDenied:"請 Hub 管理員允許你連接 Fleet。", apps:"你自己的 Claude Code 或 Codex 也可以替你使用這個 Hub,用來提問和發言;同仁不能問它。", appsLink:"我的 AI App", failed:"無法讀取清單,請重新整理再試。",
|
|
18
18
|
}
|
package/dist/ui/hub-my-agents.js
CHANGED
|
@@ -128,12 +128,16 @@ export function HubMyAgents({ client, scope, shared = [], policy = false, person
|
|
|
128
128
|
<div class="hub-rows">${rows.map(row => { const key = rowKey(fleet, row), status = [...pending].reverse().find(r => r.op.input.fleetId === fleet.id && (row.instance ? r.instance === row.instance : r.id === row.current?.id) && ["pending", "uncertain", "refused"].includes(r.state));
|
|
129
129
|
const reason = rowAvailability(fleet, row, publish, count), tick = ["pending", "uncertain"].includes(status?.state) ? !!status.instance : Object.hasOwn(draft, key) ? draft[key] : row.shared;
|
|
130
130
|
return html`<div class="hub-agent-choice" data-unavailable=${reason ? true : undefined} key=${key}><div class="s-row hub-row"><label class="hub-agent-tick"><input type="checkbox" data-share-agent=${row.instance || row.current?.id} aria-label=${row.displayName} checked=${tick} disabled=${busy || !!reason || !!waiting.length} onChange=${e => { const checked = e.target.checked; setDraft(old => ({ ...old, [key]: checked })); }} /></label><${Avatar} name=${row.displayName} size="sm" />
|
|
131
|
-
<span class="hub-row-text">${row.current ? html`<a href=${`/ui/hub/exposures?agent=${encodeURIComponent(row.current.id)}`} aria-label=${ms("details", row.displayName)}><strong>${row.displayName}</strong></a>` : html`<strong>${row.displayName}</strong>`}
|
|
131
|
+
<span class="hub-row-text">${row.current ? html`<a class="hub-agent-link" href=${`/ui/hub/exposures?agent=${encodeURIComponent(row.current.id)}`} aria-label=${ms("details", row.displayName)}><strong>${row.displayName}</strong></a>` : html`<strong>${row.displayName}</strong>`}
|
|
132
132
|
${row.kind === "classic-room" ? html`<small class="tag">${ms("classic")}</small>` : null}<small class="note">${reason && reason !== "offline" ? ms(reason) : row.general ? ms("general") : row.description}</small>
|
|
133
133
|
${row.current?.intro ? html`<small class="note">${row.current.intro}</small>` : null}
|
|
134
134
|
${row.shared ? (row.exposure?.lapsed === true && row.instance
|
|
135
135
|
? html`<small class="note hub-agent-lapsed-status">${ms("needsReshare")} · ${summary(row.current)}${lang() === "zh-TW" ? "" : " "}${ms("kept")}</small>`
|
|
136
|
-
:
|
|
136
|
+
: row.current.state === "published" && !row.current.grants?.length
|
|
137
|
+
// M-3565 (the user, 11-24): "nobody may ask yet" is where to start — a button straight to the picker.
|
|
138
|
+
? html`<small class="note hub-agent-who">${ms("shared")} · <button type="button" class="btn btn-sm hub-agent-set-who" data-set-who=${row.current.id} disabled=${busy}
|
|
139
|
+
onClick=${() => setAccess([{ ...row.current, direct: true }])}>${ms("setWho")}</button></small>`
|
|
140
|
+
: html`<small class="note">${ms(row.current.state !== "published" ? "paused" : "shared")} · ${summary(row.current)}</small>`) : null}
|
|
137
141
|
${row.shared && row.exposure?.lapsed === true && row.instance ? html`<small class="note hub-agent-lapsed" role="status">${ms("lapsed")}</small>
|
|
138
142
|
<button type="button" class="btn btn-sm hub-agent-share-again" data-share-again=${row.instance} disabled=${busy || !!waiting.length} onClick=${() => shareAgain(row, fleet)}>${ms("shareAgain")}</button>` : null}
|
|
139
143
|
${status ? html`<small class=${status.state === "refused" ? "err" : "note"} role="status">${status.state === "uncertain" ? ms("uncertain") : status.state === "refused" ? status.code === "stale-list" ? ms("changed") : ms("refused", ms(({ "not-allowed": "denied", "switched-off": "off", "limit": "limit", "not-shareable": "unavailable" })[status.code] || "unavailable")) : ms(status.instance ? "sharing" : "stopping")}</small>` : null}</span>
|
|
@@ -155,7 +159,8 @@ function SharingAccess({ targets, client, scope, subjects, onAllow, onClose }) {
|
|
|
155
159
|
const life = useRef(0);
|
|
156
160
|
useEffect(() => { const generation = life.current; void Promise.all(targets.map(async x => [x.id, await client.previousAgentAccess(scope, x.id)])).then(rows => { if (generation === life.current) setPrevious(Object.fromEntries(rows)); }); return () => { life.current++; }; }, [client, scope, targets]);
|
|
157
161
|
useEffect(() => { if (targets.length === 1 && !pick) setPick(targets); }, []);
|
|
162
|
+
const direct = targets.length === 1 && targets[0].direct === true; // M-3565: opened from a row's 「設定誰可以問」
|
|
158
163
|
const usePrevious = async x => { if (busy) return; const generation = life.current; setBusy(true); const r = await client.usePreviousAgentAccess(scope, x.id, { revision: x.revision, digest: previous[x.id]?.previous?.digest }); if (generation === life.current) { setOutcomes(old => ({ ...old, [x.id]: r.ok ? ms("used") : ms("saveFailed", x.displayName) })); setBusy(false); } };
|
|
159
|
-
if (pick) return html`<${HubGrantPicker} x=${pick[0]} legacy=${!subjects} targets=${pick} client=${client} act=${async fn => fn()} grant=${input => client.ownerGrant(scope, input)} onClose=${() => setPick(null)} onResults=${results => setOutcomes(old => ({ ...old, ...results }))} extra=${html`${pick.map(x=>html`<div key=${x.id}><strong>${x.displayName}</strong>${introPreview(x)}</div>`)}${pick.length === 1 && previous[pick[0].id]?.previous ? html`<button class="btn" disabled=${busy} onClick=${() => usePrevious(pick[0])}>${ms(previous[pick[0].id].previous.peopleCount === null ? "previousMixed" : "previous", previous[pick[0].id].previous.count)}</button>${outcomes[pick[0].id] ? html`<p role="status">${outcomes[pick[0].id]}</p>` : null}` : null}`} />`;
|
|
164
|
+
if (pick) return html`<${HubGrantPicker} x=${pick[0]} legacy=${!subjects} targets=${pick} client=${client} act=${async fn => fn()} grant=${input => client.ownerGrant(scope, input)} onClose=${() => (direct ? onClose() : setPick(null))} onResults=${results => setOutcomes(old => ({ ...old, ...results }))} extra=${html`${pick.map(x=>html`<div key=${x.id}><strong>${x.displayName}</strong>${introPreview(x)}</div>`)}${pick.length === 1 && previous[pick[0].id]?.previous ? html`<button class="btn" disabled=${busy} onClick=${() => usePrevious(pick[0])}>${ms(previous[pick[0].id].previous.peopleCount === null ? "previousMixed" : "previous", previous[pick[0].id].previous.count)}</button>${outcomes[pick[0].id] ? html`<p role="status">${outcomes[pick[0].id]}</p>` : null}` : null}`} />`;
|
|
160
165
|
return html`<${Dialog} title=${mc("accessTitle", targets.length)} onClose=${onClose} actions=${html`<button class="btn" onClick=${onClose}>${ms("later")}</button>`}><p>${ms("accessLead")}</p><div class="field-row"><button class="btn btn-primary" onClick=${() => { setMode("same"); setPick(targets); }}>${ms("same", targets.length)}</button><button class="btn" onClick=${() => setMode("each")}>${ms("each")}</button></div><ul class="hub-share-access-list">${targets.map(x => html`<li class="hub-share-access-item"><div class="hub-row-text"><strong>${x.displayName}</strong>${introPreview(x)}${outcomes[x.id] ? html`<small role="status">${outcomes[x.id]}</small>` : null}</div>${mode === "each" ? html`<button class="btn btn-sm" onClick=${() => setPick([x])}>${ms("choose")}</button>` : null}${previous[x.id]?.previous ? html`<button class="btn btn-sm" disabled=${busy} onClick=${() => usePrevious(x)}>${ms(previous[x.id].previous.peopleCount === null ? "previousMixed" : "previous", previous[x.id].previous.count)}</button>` : null}</li>`)}</ul></${Dialog}>`;
|
|
161
166
|
}
|