@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
|
@@ -13,6 +13,7 @@ import { hroom } from "./hub-room-strings.js";
|
|
|
13
13
|
import { collapse, headerCounts, presenceDot, presenceView, sortAgents } from "./hub-room-presence.js";
|
|
14
14
|
import { hn, linkRoomsU2Css } from "./hub-room-new-strings.js";
|
|
15
15
|
import { roomSource, RoomSourceMark } from "./hub-room-source.js";
|
|
16
|
+
import { firstCharacter } from "/assets/instance-nav.js";
|
|
16
17
|
|
|
17
18
|
linkRoomsU2Css();
|
|
18
19
|
|
|
@@ -63,6 +64,40 @@ export function memberStatus(m) {
|
|
|
63
64
|
return { dot: presenceDot(v.dot), text: note ? `${word} · ${note}` : word, ...(v.word === "needsUpdate" ? { update: true } : {}) };
|
|
64
65
|
}
|
|
65
66
|
|
|
67
|
+
const LUM = (hex) => { const c = [1, 3, 5].map((i) => parseInt(hex.slice(i, i + 2), 16) / 255).map((x) => (x <= 0.03928 ? x / 12.92 : ((x + 0.055) / 1.055) ** 2.4)); return 0.2126 * c[0] + 0.7152 * c[1] + 0.0722 * c[2]; };
|
|
68
|
+
const RATIO = (a, b) => (Math.max(a, b) + 0.05) / (Math.min(a, b) + 0.05);
|
|
69
|
+
const INK_DARK = "#111111", INK_LIGHT = "#ffffff";
|
|
70
|
+
const GRAPHEME = typeof Intl !== "undefined" && typeof Intl.Segmenter === "function" ? new Intl.Segmenter(undefined, { granularity: "grapheme" }) : null;
|
|
71
|
+
/** Exactly one grapheme (one emoji, with its modifiers and joiners), else "": a longer label never fills a 20 px disc. */
|
|
72
|
+
function oneGrapheme(text) {
|
|
73
|
+
const parts = GRAPHEME ? [...GRAPHEME.segment(text)] : Array.from(text);
|
|
74
|
+
return parts.length === 1 ? text : "";
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* M-3533 R2a: an agent's avatar as its owner's Fleet shows it — its persona emoji, else its initial — on its identity
|
|
79
|
+
* colour (the room detail's `look`, from the owner's catalog), else on the default tint. An emoji label longer than one
|
|
80
|
+
* character (the catalog allows 64 bytes) is not drawn: the initial instead. Text on the colour is whichever of the two
|
|
81
|
+
* inks actually painted (#111111, white) has the higher contrast on it.
|
|
82
|
+
*/
|
|
83
|
+
export function agentAvatar(m) {
|
|
84
|
+
const color = typeof m?.look?.color === "string" && /^#[0-9a-f]{6}$/i.test(m.look.color) ? m.look.color.toLowerCase() : null;
|
|
85
|
+
const emoji = typeof m?.look?.emoji === "string" ? oneGrapheme(m.look.emoji.trim()) : "";
|
|
86
|
+
const lum = color ? LUM(color) : null;
|
|
87
|
+
return { color, text: emoji || firstCharacter(m?.name || "") || "?", emoji: !!emoji, ink: lum === null ? null : (RATIO(lum, LUM(INK_LIGHT)) >= RATIO(lum, LUM(INK_DARK)) ? INK_LIGHT : INK_DARK) };
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* The avatar in the row (the emoji or initial drawn from `data-av`, so the row's text is still the name alone), in the
|
|
91
|
+
* slot M-3256's source badge had: every agent row's badge was the same logo, so the avatar now says "an agent" (people's
|
|
92
|
+
* rows have none) and the source is said by the row's title, its accessible name and the agent's card (the design check).
|
|
93
|
+
*/
|
|
94
|
+
function AgentAvatar({ m }) {
|
|
95
|
+
const a = agentAvatar(m);
|
|
96
|
+
// The colour goes in through the CSSOM (no style attribute: the dashboard's CSP, web-csp-1300).
|
|
97
|
+
const paint = (el) => { if (!el?.style) return; if (a.color) { el.style.setProperty("--av", a.color); el.style.setProperty("--av-ink", a.ink); } else { el.style.removeProperty("--av"); el.style.removeProperty("--av-ink"); } };
|
|
98
|
+
return html`<span class=${`hub-agent-av${a.emoji ? " emoji" : ""}${a.color ? "" : " neutral"}`} aria-hidden="true" data-av=${a.text} ref=${paint}></span>`;
|
|
99
|
+
}
|
|
100
|
+
|
|
66
101
|
/** 「林小華的 Agent」, but 「Alex 的 Agent」: a name ending in a Latin letter or digit takes a space before 的 (Lumen). */
|
|
67
102
|
export function ownerAgent(name) {
|
|
68
103
|
return hm(/[A-Za-z0-9]$/.test(name) ? "ownerAgentLatin" : "ownerAgent", name);
|
|
@@ -80,8 +115,16 @@ export function ownerAgent(name) {
|
|
|
80
115
|
* - onSettings();
|
|
81
116
|
* - compact (M1): true / false for that list whatever the size; absent, a room over COMPACT_OVER gets the compact one.
|
|
82
117
|
*/
|
|
83
|
-
export function RoomMembersPanel({ client = hubClient(), roomId, detail, onMention, onOpenChat, onSettings, compact: force = undefined } = {}) {
|
|
118
|
+
export function RoomMembersPanel({ client = hubClient(), roomId, detail, onMention, onOpenChat, onSettings, compact: force = undefined, focus = null } = {}) {
|
|
84
119
|
const [presence, setPresence] = useState({}), [open, setOpen] = useState(null), [expanded, setExpanded] = useState(false);
|
|
120
|
+
// M-3565: `focus` ({ id, n }: a message's agent name pressed): that agent's card open, its owner's group unfolded, in view.
|
|
121
|
+
useEffect(() => {
|
|
122
|
+
if (!focus || !focus.id) return;
|
|
123
|
+
// Always in view: no filter left hiding it, the list unfolded past its first rows (#4389 review); then its card.
|
|
124
|
+
setQ(""); setExpanded(true); setOpen(focus.id);
|
|
125
|
+
const t = setTimeout(() => { try { document.querySelector(`.hub-room-members [data-member="${CSS.escape(focus.id)}"]`)?.scrollIntoView({ block: "nearest" }); } catch { /* none */ } }, 0);
|
|
126
|
+
return () => clearTimeout(t);
|
|
127
|
+
}, [focus && focus.n]);
|
|
85
128
|
const [busy, setBusy] = useState(false), [failed, setFailed] = useState(false), [gone, setGone] = useState({}), [q, setQ] = useState("");
|
|
86
129
|
useEffect(() => { setPresence({}); setGone({}); }, [detail]);
|
|
87
130
|
useEffect(() => client.subscribeRooms?.({
|
|
@@ -113,10 +156,14 @@ export function RoomMembersPanel({ client = hubClient(), roomId, detail, onMenti
|
|
|
113
156
|
// M1: in a compact list a row is one line — the name, its state — and the owner and introduction move into its card.
|
|
114
157
|
const row = (m, extra = null) => {
|
|
115
158
|
const v = memberStatus(m), owner = !compact && (m.kind === "agent" || m.kind === "later") && m.owner?.name ? (v.update ? hm("askOwner", m.owner.name) : ownerAgent(m.owner.name)) : "";
|
|
116
|
-
|
|
159
|
+
// R2a: an agent's avatar takes the source mark's slot (the source in the row's title, accessible name and card). The
|
|
160
|
+
// room assistant has the sidebar's 「Hub 助理」 disc (its first character, "H"), so the column lines up.
|
|
161
|
+
const agentRow = m.kind === "agent" || m.kind === "later";
|
|
162
|
+
const mark = agentRow ? html`<${AgentAvatar} m=${m} />` : m.kind === "assistant" ? html`<${AgentAvatar} m=${{ name: hroom("hubAssistant") }} />` : html`<${RoomSourceMark} source=${roomSource(m)} decorative=${true} />`;
|
|
163
|
+
return html`<span class="hub-member-name">${mark}${m.name}${extra}</span><span class="hub-member-state"><span class=${`dot ${v.dot}`} aria-hidden="true"></span><span>${v.text}</span>${owner ? html`<span class="hub-member-owner">· ${owner}</span>` : null}</span>${!compact&&(m.intro||m.kind==="assistant")?html`<small class="note">${m.kind==="assistant"?hi("assistant"):m.intro}</small>`:null}`;
|
|
117
164
|
};
|
|
118
165
|
const person = (m) => html`<li class="hub-member" key=${m.id}>${row(m, html`${m.id === meId ? html` <span class="tag">${hroom("roleYou")}</span>` : null}${m.role === "manager" ? html` <span class="tag">${hroom("roleManager")}</span>` : null}`)}</li>`;
|
|
119
|
-
const agentItem = (m) => html`<li class="hub-member hub-member-agent" key=${m.id}>
|
|
166
|
+
const agentItem = (m) => html`<li class="hub-member hub-member-agent" key=${m.id} data-member=${m.id}>
|
|
120
167
|
<button type="button" class="hub-member-open" title=${roomSource(m)?.label || ""} aria-label=${`${m.name}. ${memberStatus(m).text}. ${roomSource(m)?.label || ""}`} aria-expanded=${open === m.id} onClick=${() => { setFailed(false); setOpen(open === m.id ? null : m.id); }}>${row(m)}</button>
|
|
121
168
|
${open === m.id ? html`<div class="hub-member-card" role="group" aria-label=${m.name}>
|
|
122
169
|
<strong>${m.name}</strong>${m.intro?html`<p class="note">${m.intro}</p>`:null}${m.owner?.name ? html`<small class="note">${hm("ownerOf", m.owner.name)}</small>` : null}
|
|
@@ -147,7 +194,7 @@ export function RoomMembersPanel({ client = hubClient(), roomId, detail, onMenti
|
|
|
147
194
|
${off.length ? html`<details class="hub-member-group hub-members-offline" open=${filtering}><summary>${hm("notOnline", off.length)}</summary><ul>${off.map(person)}</ul></details>` : null}
|
|
148
195
|
</section>
|
|
149
196
|
${agents.length ? html`<section><h4>${filtering ? hm("agentsMatch", groups.reduce((n, g) => n + g.shown.length, 0), agents.length) : heads.agent}</h4>
|
|
150
|
-
${groups.map((g) => html`<details class="hub-member-group hub-members-owner" key=${g.key} open=${filtering}><summary>${hm("ownerGroup", g.owner || hm("noOwner"), filtering ? g.shown.length : g.agents.length)}</summary><ul>${g.shown.map(agentItem)}</ul></details>`)}
|
|
197
|
+
${groups.map((g) => html`<details class="hub-member-group hub-members-owner" key=${g.key} open=${filtering || (!!focus && g.agents.some((a) => a.id === focus.id))}><summary>${hm("ownerGroup", g.owner || hm("noOwner"), filtering ? g.shown.length : g.agents.length)}</summary><ul>${g.shown.map(agentItem)}</ul></details>`)}
|
|
151
198
|
</section>` : null}`;
|
|
152
199
|
};
|
|
153
200
|
return html`<aside class=${`hub-room-members${compact ? " compact" : ""}`}>
|
|
@@ -111,16 +111,21 @@ export function named(d, members = []) {
|
|
|
111
111
|
const taken = new Set(), rename = new Map();
|
|
112
112
|
const instances = list.map((i) => {
|
|
113
113
|
const b = base(i), owner = owners.get(i.name) || "";
|
|
114
|
-
let label = b;
|
|
114
|
+
let label = b, fit = i.assistant ? { short: hroom("roomAssistantTag") } : null;
|
|
115
115
|
if (count.get(b) > 1 && owner) {
|
|
116
116
|
label = `${b}${open}${owner}${close}`;
|
|
117
117
|
if ([...label].length > LABEL_MAX) label = `${b}${open}${owner.split(/\s+/)[0]}${close}`;
|
|
118
118
|
label = clip(label, KEY_MAX);
|
|
119
|
+
// The owner part, for the drawing's tag: too narrow for both, it keeps the owner and cuts the name — the owner is
|
|
120
|
+
// what tells the two agents apart (fleet-office-skin.js fitText, #4379 review). The room assistant's tag has a
|
|
121
|
+
// shorter word for a narrow tag ("Assistant").
|
|
122
|
+
const who = label.endsWith(close) ? label.slice(b.length + open.length, -close.length) : "";
|
|
123
|
+
if (who && label === `${b}${open}${who}${close}`) fit = { owner: [open, who, close] };
|
|
119
124
|
}
|
|
120
125
|
label = safeKey(label);
|
|
121
126
|
for (let n = 2, at = label; taken.has(label); n++) label = `${at} ${n}`;
|
|
122
127
|
taken.add(label); rename.set(i.name, label);
|
|
123
|
-
return { ...i, name: label, display_name: label, member: i.name };
|
|
128
|
+
return { ...i, name: label, display_name: label, member: i.name, plain: b, ...(fit ? { tag_fit: fit } : {}) };
|
|
124
129
|
});
|
|
125
130
|
const offices = d && d.offices && Array.isArray(d.offices.offices)
|
|
126
131
|
? { ...d.offices, offices: d.offices.offices.map((o) => ({ ...o, members: (Array.isArray(o.members) ? o.members : []).map((m) => rename.get(m) ?? m) })) } : d?.offices;
|
|
@@ -131,7 +136,7 @@ export function named(d, members = []) {
|
|
|
131
136
|
* `members` the room's (its detail's: owner, introduction, the list's states); `onMention(member)` the card's "@ it" (the
|
|
132
137
|
* page switches to Chat with the mention in the box); `more` / `onMore` a phone's options sheet, opened from the room's ⋯.
|
|
133
138
|
*/
|
|
134
|
-
export function RoomOffice({ client, roomId, members, onMention = null, more = false, onMore = null, timers = globalThis, pollMs = ROOM_OFFICE_POLL_MS, load = loadDrawing }) {
|
|
139
|
+
export function RoomOffice({ client, roomId, members, onMention = null, onOpenChat = null, more = false, onMore = null, timers = globalThis, pollMs = ROOM_OFFICE_POLL_MS, load = loadDrawing }) {
|
|
135
140
|
const [phase, setPhase] = useState("loading"); // loading | live | failed | off
|
|
136
141
|
const [d, setD] = useState(null);
|
|
137
142
|
const [kit, setKit] = useState(null);
|
|
@@ -185,7 +190,13 @@ export function RoomOffice({ client, roomId, members, onMention = null, more = f
|
|
|
185
190
|
<${Office} view=${view} traffic=${[]} lease=${lease} opening="room" talk=${{ now: Date.now(), items: [] }}
|
|
186
191
|
oneOffice=${true} readOnly=${true} stream=${false} storage=${storage} words=${(node) => officeWords(node, members)}
|
|
187
192
|
cardRows=${(name) => officeCardRows(members, shown.instances.find((i) => i.name === name)?.member)}
|
|
188
|
-
|
|
189
|
-
|
|
193
|
+
cardName=${(name) => shown.instances.find((i) => i.name === name)?.plain || ""}
|
|
194
|
+
cardAction=${onMention || onOpenChat ? (name) => { const m = memberOf(name); if (!m) return null;
|
|
195
|
+
// M-3565: the member card's 「和它一對一對話」 too, when this viewer may ask the agent (as there: canAsk).
|
|
196
|
+
const acts = [...(onMention ? [{ label: hroom("mentionIt"), title: hroom("mentionItTitle", name), run: () => onMention(m) }] : []),
|
|
197
|
+
// The card's row beside "Find in office" and "@ it" is narrow: a short label; the whole words its title and name.
|
|
198
|
+
...(onOpenChat && m.canAsk === true ? [{ label: hroom("chatOneToOneShort"), title: hroom("chatOneToOne"), run: () => onOpenChat(m) }] : [])];
|
|
199
|
+
return acts.length > 1 ? acts : acts[0] || null; } : null}
|
|
200
|
+
foldBar=${true} more=${more} onMore=${onMore} officesKey=${`${shown.offices?.offices?.[0]?.skin ?? ""}\n${shown.offices?.offices?.[0]?.members?.join("\n") ?? ""}`} />
|
|
190
201
|
</div>`;
|
|
191
202
|
}
|
|
@@ -93,16 +93,19 @@ export function presenceDot(presence, reason) {
|
|
|
93
93
|
return DOT_CLASS[dot] ?? "off";
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
+
const cmp = (a, b) => { const x = String(a ?? ""), y = String(b ?? ""); return x < y ? -1 : x > y ? 1 : 0; };
|
|
97
|
+
|
|
96
98
|
/**
|
|
97
99
|
* The Agents list order (spec §5): working, then idle (待命), paused, offline,
|
|
98
|
-
* reply-later;
|
|
100
|
+
* reply-later; by name within each group, two agents of one name by their owner's
|
|
101
|
+
* name, then id (R2a), so they never swap between reads. Only kind "agent"/"later"
|
|
99
102
|
* members sort here — people have their own row and the room assistant has its.
|
|
100
103
|
*/
|
|
101
104
|
export function sortAgents(members) {
|
|
102
105
|
return members
|
|
103
106
|
.filter((m) => m.kind === "agent" || m.kind === "later")
|
|
104
107
|
.map((m, i) => [m, i])
|
|
105
|
-
.sort(([a, ai], [b, bi]) => groupIndex(a.presence) - groupIndex(b.presence) || (a.name
|
|
108
|
+
.sort(([a, ai], [b, bi]) => groupIndex(a.presence) - groupIndex(b.presence) || cmp(a.name, b.name) || cmp(a.owner?.name, b.owner?.name) || cmp(a.id, b.id) || ai - bi)
|
|
106
109
|
.map(([m]) => m);
|
|
107
110
|
}
|
|
108
111
|
|
|
@@ -13,7 +13,7 @@ import { Dialog } from "/assets/ui-dialog.js";
|
|
|
13
13
|
import { Menu } from "/assets/ui-menu.js";
|
|
14
14
|
import { confirmDialog } from "/assets/ui-confirm.js";
|
|
15
15
|
import { hubClient } from "./hub-client.js";
|
|
16
|
-
import { hroom } from "./hub-room-strings.js";
|
|
16
|
+
import { hroom, styleName } from "./hub-room-strings.js";
|
|
17
17
|
import { hs } from "./hub-room-settings-strings.js";
|
|
18
18
|
import {ha} from "./hub-ai-apps-strings.js";
|
|
19
19
|
import { RoomPicker } from "./hub-room-new.js";
|
|
@@ -40,6 +40,39 @@ export function invitedLabel(row) {
|
|
|
40
40
|
return owner ? hroom("inviteRow", row.name, owner) : hs("pendingRowNoOwner", row.name);
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
+
/**
|
|
44
|
+
* The separator before a style's seats: " · ", but "· " after a full-width bracket or quote (「工作室(大)· 57」), whose
|
|
45
|
+
* glyph already carries its own side spacing, so every row's gap before the dot looks the same (the capture check).
|
|
46
|
+
*/
|
|
47
|
+
export function dotAfter(name) {
|
|
48
|
+
return /[)」』〕】]$/.test(name) ? "· " : " · ";
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* The hint's last words on one line, so a wrap never leaves 「子。」 or "seat." alone: the last four characters (with the
|
|
53
|
+
* full stop) of a Chinese sentence, the last two words of an English one. Short enough never to overflow a phone.
|
|
54
|
+
*/
|
|
55
|
+
export function keepTail(text) {
|
|
56
|
+
const m = /[\u3000-\u9fff\uff00-\uffef]/.test(text) ? /^([\s\S]*?)(\S{1,4}[。!?]?)$/.exec(text) : /^([\s\S]*?)(\S+ \S+)$/.exec(text);
|
|
57
|
+
return m && m[1] ? html`${m[1]}<span class="hub-nowrap">${m[2]}</span>` : text;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* M-3533 R1b: the room office's styles with their seats, and — when the room's agents (its assistant too) outnumber the
|
|
62
|
+
* picked style's rest seats and a larger style has more — the hint to pick a larger one.
|
|
63
|
+
*/
|
|
64
|
+
function OfficeStyles({ styles, value, saved, busy, members, onPick, onSave }) {
|
|
65
|
+
const agents = members.filter((m) => m.kind === "agent").length, figures = agents + members.filter((m) => m.kind === "assistant").length;
|
|
66
|
+
const picked = styles.find((x) => x.id === value) || null;
|
|
67
|
+
const larger = picked && styles.some((x) => x.seats.rest > picked.seats.rest);
|
|
68
|
+
return html`<fieldset class="field hub-room-office-styles"><legend>${hroom("officeStyle")}</legend>
|
|
69
|
+
${styles.map((x) => html`<label class="check" key=${x.id}><input type="radio" name="hubRoomOfficeStyle" value=${x.id} checked=${value === x.id} disabled=${busy}
|
|
70
|
+
onChange=${() => onPick(x.id)} /><span>${styleName(x.id)}${dotAfter(styleName(x.id))}${hroom("seatsN", x.seats.total)}</span></label>`)}
|
|
71
|
+
${picked && larger && figures > picked.seats.rest ? html`<p class="note hub-room-office-fit">${keepTail(hroom(figures > agents ? "officeFitHintAssistant" : "officeFitHint", agents, styleName(picked.id), picked.seats.rest))}</p>` : null}
|
|
72
|
+
<div class="field-row"><button type="button" class="btn hub-room-office-style-save" disabled=${busy || value === saved} onClick=${onSave}>${hroom("officeStyleSave")}</button></div>
|
|
73
|
+
</fieldset>`;
|
|
74
|
+
}
|
|
75
|
+
|
|
43
76
|
/** Props: client, roomId, detail (the shell's GET /hub/v1/rooms/:id answer), onClose(), onChanged(), assistant (the Hub offers the room assistant; read from the list when not given). */
|
|
44
77
|
export function RoomSettings({ client = hubClient(), roomId, detail, onClose, onChanged, assistant } = {}) {
|
|
45
78
|
const room = detail?.room ?? {}, settings = detail?.settings ?? {}, members = Array.isArray(detail?.members) ? detail.members : [];
|
|
@@ -61,6 +94,15 @@ export function RoomSettings({ client = hubClient(), roomId, detail, onClose, on
|
|
|
61
94
|
const [office, setOffice] = useState(settings.office?.enabled === true);
|
|
62
95
|
useEffect(() => { setName(room.name ?? ""); setAllMention(settings.allMention !== false); setHistory(settings.historyForNew === "all" ? "all" : "since-join"); setOffice(settings.office?.enabled === true); }, [detail]);
|
|
63
96
|
useEffect(()=>setAiApps(settings.aiApps!==false),[detail]);
|
|
97
|
+
// M-3533 R1b (§2.1b): the office's style — the room styles, each with its seats from its own layout (the drawing's
|
|
98
|
+
// fleet-office-skin.js, loaded with import() as the office tab does); picked here, saved once with Save style.
|
|
99
|
+
const savedStyle = typeof settings.office?.style === "string" ? settings.office.style : "studio";
|
|
100
|
+
const [style, setStyle] = useState(savedStyle), [styles, setStyles] = useState(null);
|
|
101
|
+
useEffect(() => { setStyle(savedStyle); }, [detail]);
|
|
102
|
+
useEffect(() => {
|
|
103
|
+
if (!officeShown) return;
|
|
104
|
+
import("./fleet-office-skin.js").then((m) => { if (live.current) setStyles(m.ROOM_STYLES.map((id) => ({ id, seats: m.styleSeats(id) })).filter((x) => x.seats)); }, () => {});
|
|
105
|
+
}, [officeShown]);
|
|
64
106
|
useEffect(() => {
|
|
65
107
|
if (typeof assistant === "boolean") { setOffered(assistant); return; }
|
|
66
108
|
void client.roomList().then(r => { if (live.current) setOffered(r?.ok === true && r.me?.assistant === true); });
|
|
@@ -155,6 +197,8 @@ export function RoomSettings({ client = hubClient(), roomId, detail, onClose, on
|
|
|
155
197
|
${officeShown ? html`<section class="form hub-room-office-settings"><h4>${hroom("officeSection")}</h4>
|
|
156
198
|
<label class="check"><input id="hubRoomOffice" class="s-ui-toggle" type="checkbox" role="switch" checked=${office} disabled=${busy}
|
|
157
199
|
onChange=${(e) => { const v = e.target.checked; setOffice(v); void act(() => client.updateRoom(roomId, { office: { enabled: v } }), () => setOffice(!v)); }} /><span>${hroom("officeSetting")}</span></label>
|
|
200
|
+
${office && styles ? html`<${OfficeStyles} styles=${styles} value=${style} saved=${savedStyle} busy=${busy} members=${members} onPick=${setStyle}
|
|
201
|
+
onSave=${() => { void act(() => client.updateRoom(roomId, { office: { style } })); }} />` : null}
|
|
158
202
|
</section>` : null}
|
|
159
203
|
<section class="form"><h4>${hroom("other")}</h4>
|
|
160
204
|
<button type="button" class="btn btn-danger" disabled=${busy || room.archived === true} onClick=${() => { void archive(); }}>${hroom("archiveRoom")}</button>
|
|
@@ -24,12 +24,14 @@ export function RoomSourceMark({ source, decorative = false }) {
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
/** Stateless island inside the shared thread's sender node. No raw markup comes from the message. */
|
|
27
|
-
export function mountSourceAuthor(sender, message) {
|
|
27
|
+
export function mountSourceAuthor(sender, message, openMember = null) {
|
|
28
28
|
const source = message?.sourceBadge;
|
|
29
29
|
if (!sender || !source) return;
|
|
30
30
|
sender.textContent = "";
|
|
31
|
+
// M-3565: an agent's name opens its member card (where its source is said too); else, as before, the source as a toast.
|
|
32
|
+
const tap = () => { if (!(openMember && message.authorMember && openMember(message.authorMember))) toast(source.label, true, { detail: true }); };
|
|
31
33
|
render(html`<button type="button" class="hub-source-trigger" title=${source.label}
|
|
32
|
-
aria-label=${`${message.sender}. ${source.label}`} onClick=${
|
|
34
|
+
aria-label=${`${message.sender}. ${source.label}`} onClick=${tap}>
|
|
33
35
|
<${RoomSourceMark} source=${source} decorative=${true} /><span>${message.sender}</span>
|
|
34
36
|
</button>`, sender);
|
|
35
37
|
}
|
|
@@ -9,7 +9,7 @@ register("hubRoom", {
|
|
|
9
9
|
en: {
|
|
10
10
|
// §1 vocabulary (on-screen terms)
|
|
11
11
|
chat: "Chat", room: "Room", members: "Members", roomManager: "Room manager",
|
|
12
|
-
roomAssistant: "Room assistant", hubAssistant: "Hub assistant",
|
|
12
|
+
roomAssistant: "Room assistant", roomAssistantTag: "Assistant", hubAssistant: "Hub assistant",
|
|
13
13
|
mentionAll: "@All agents", invitation: "Invitation", replyLater: "Reply later", team: "Team",
|
|
14
14
|
// §2 layout
|
|
15
15
|
search: "Search", roomsGroup: "Rooms", agentsGroup: "Agents",
|
|
@@ -65,7 +65,7 @@ register("hubRoom", {
|
|
|
65
65
|
needsUpdate: "Needs an AgEnD update", stLater: "Answers when online",
|
|
66
66
|
stAssistantDown: "Cannot answer right now",
|
|
67
67
|
stStopped: "Stopped",
|
|
68
|
-
mentionHere: "@ it here", chatOneToOne: "Chat with it one-to-one", removeFromRoom: "Remove from room",
|
|
68
|
+
mentionHere: "@ it here", chatOneToOne: "Chat with it one-to-one", chatOneToOneShort: "Chat 1:1", removeFromRoom: "Remove from room",
|
|
69
69
|
// §6 new room
|
|
70
70
|
newRoomTitle: "New room", name: "Name", namePlaceholder: "For example: Weekly leads meeting",
|
|
71
71
|
addPeople: "Add people, teams, or AD groups: type a name to search",
|
|
@@ -84,6 +84,12 @@ register("hubRoom", {
|
|
|
84
84
|
cardOwner: "Owner", cardIntro: "Introduction", answeringHere: "Answering a question in this room",
|
|
85
85
|
mentionIt: "@ it", mentionItTitle: "Ask {0} in the chat", officeOptions: "Office options", officeStale: "The office may be out of date. Reconnecting…",
|
|
86
86
|
officeSection: "Room office", officeSetting: "Show the room office",
|
|
87
|
+
// M-3533 R1b: the style, its seats from its layout, and the hint when the room's agents outnumber its rest seats.
|
|
88
|
+
officeStyle: "Style", officeStyleSave: "Save style", seatsN: "{0} seats",
|
|
89
|
+
"style_studio-large": "Studio (large)", style_studio: "Studio", style_cozy: "Cozy", style_guild: "Guild", style_school: "School",
|
|
90
|
+
officeFitHint: "This room has {0} agents. {1} has {2} seats to rest in; a larger style gives everyone a seat.",
|
|
91
|
+
officeFitHintAssistant: "This room has {0} agents and the room assistant. {1} has {2} seats to rest in; a larger style gives everyone a seat.",
|
|
92
|
+
officeStyleSys: "{0} changed the room office's style to “{1}”",
|
|
87
93
|
sysAdminJoined: "{0} joined as a room manager", composerAssistant: "Ask the Hub assistant", composerDirect: "Ask {0}",
|
|
88
94
|
invitedSys: "{0} agents invited; they join when the owner agrees.",
|
|
89
95
|
nameRequired: "Enter a room name.",
|
|
@@ -158,7 +164,7 @@ register("hubRoom", {
|
|
|
158
164
|
},
|
|
159
165
|
"zh-TW": {
|
|
160
166
|
chat: "對話", room: "房間", members: "成員", roomManager: "房間管理",
|
|
161
|
-
roomAssistant: "房間助理", hubAssistant: "Hub 助理",
|
|
167
|
+
roomAssistant: "房間助理", roomAssistantTag: "助理", hubAssistant: "Hub 助理",
|
|
162
168
|
mentionAll: "@所有 Agent", invitation: "邀請", replyLater: "稍後回覆", team: "團隊",
|
|
163
169
|
search: "搜尋", roomsGroup: "房間", agentsGroup: "Agent",
|
|
164
170
|
roomSub: "{0} 人 · {1} 個 Agent", providedByHub: "Hub 提供",
|
|
@@ -206,7 +212,7 @@ register("hubRoom", {
|
|
|
206
212
|
needsUpdate: "需要更新 AgEnD", stLater: "上線時回答",
|
|
207
213
|
stAssistantDown: "暫時無法回答",
|
|
208
214
|
stStopped: "已停止",
|
|
209
|
-
mentionHere: "在這裡 @ 它", chatOneToOne: "和它一對一對話", removeFromRoom: "從房間移除",
|
|
215
|
+
mentionHere: "在這裡 @ 它", chatOneToOne: "和它一對一對話", chatOneToOneShort: "一對一對話", removeFromRoom: "從房間移除",
|
|
210
216
|
newRoomTitle: "新房間", name: "名稱", namePlaceholder: "例如:每週主管會議",
|
|
211
217
|
addPeople: "加入人、團隊或 AD 群組:輸入名稱搜尋",
|
|
212
218
|
addAgents: "加入自己的 Agent,或邀請別人的",
|
|
@@ -223,6 +229,11 @@ register("hubRoom", {
|
|
|
223
229
|
cardOwner: "擁有者", cardIntro: "介紹", answeringHere: "正在回答這個房間的問題",
|
|
224
230
|
mentionIt: "@ 它", mentionItTitle: "在聊天裡問 {0}", officeOptions: "辦公室選項", officeStale: "畫面可能不是最新,正在重新連線…",
|
|
225
231
|
officeSection: "房間辦公室", officeSetting: "顯示房間辦公室",
|
|
232
|
+
officeStyle: "風格", officeStyleSave: "儲存風格", seatsN: "{0} 個座位",
|
|
233
|
+
"style_studio-large": "工作室(大)", style_studio: "工作室", style_cozy: "溫馨", style_guild: "冒險者公會", style_school: "學校",
|
|
234
|
+
officeFitHint: "這個房間有 {0} 個 Agent。「{1}」的休息區有 {2} 個座位,換成較大的風格就能讓每個 Agent 都有位子。",
|
|
235
|
+
officeFitHintAssistant: "這個房間有 {0} 個 Agent 和房間助理。「{1}」的休息區有 {2} 個座位,換成較大的風格就能讓每一位都有位子。",
|
|
236
|
+
officeStyleSys: "{0} 把房間辦公室的風格換成「{1}」",
|
|
226
237
|
sysAdminJoined: "{0} 以房間管理的身分加入", composerAssistant: "問 Hub 助理", composerDirect: "問 {0}",
|
|
227
238
|
invitedSys: "已邀請 {0} 個 Agent,擁有者同意後會加入。",
|
|
228
239
|
nameRequired: "請輸入房間名稱。",
|
|
@@ -288,3 +299,5 @@ register("hubRoom", {
|
|
|
288
299
|
|
|
289
300
|
/** hubRoom.* words. */
|
|
290
301
|
export const hroom = (key, ...values) => t(`hubRoom.${key}`, ...values);
|
|
302
|
+
/** M-3533 R1b: a room office style's name in this viewer's words; one this page does not know, as its id. */
|
|
303
|
+
export const styleName = (id) => { const k = `style_${id}`, w = hroom(k); return w !== `hubRoom.${k}` ? w : String(id); };
|
|
@@ -22,7 +22,7 @@ import { toast } from "/assets/ui-toast.js";
|
|
|
22
22
|
import { register, t } from "/assets/app-i18n.js";
|
|
23
23
|
import "./hub-strings.js";
|
|
24
24
|
import { firstCharacter } from "/assets/instance-nav.js";
|
|
25
|
-
import { hroom } from "./hub-room-strings.js";
|
|
25
|
+
import { hroom, styleName } from "./hub-room-strings.js";
|
|
26
26
|
import {ha} from "./hub-ai-apps-strings.js";
|
|
27
27
|
import { RoomComposer } from "./hub-room-composer.js";
|
|
28
28
|
import { TextSizeButton, TEXT_SIZES, setTextSize, textSizeStore } from "/assets/header-tools.js";
|
|
@@ -96,6 +96,8 @@ const SYSTEM = { "room-created": "createdSys", "member-joined": "sysJoined", "ad
|
|
|
96
96
|
export function systemText(m) {
|
|
97
97
|
if(m?.system?.kind==="purpose-changed"&&typeof m.system.purpose==="string"&&typeof m.system.name==="string")return hroom(m.system.purpose?"purposeSetSys":"purposeClearedSys",m.system.name,m.system.purpose);
|
|
98
98
|
if (m?.system?.kind === "office-changed" && typeof m.system.enabled === "boolean" && typeof m.system.name === "string") return hroom(m.system.enabled ? "officeOnSys" : "officeOffSys", m.system.name);
|
|
99
|
+
// M-3533 R1b: the style in this reader's words (a style this page does not know: its id, as stored).
|
|
100
|
+
if (m?.system?.kind === "office-style-changed" && typeof m.system.style === "string" && typeof m.system.name === "string") return hroom("officeStyleSys", m.system.name, styleName(m.system.style));
|
|
99
101
|
if(m?.system?.kind==="app-rate-limited")return ha("rateLimited",m.system.name||"");
|
|
100
102
|
if (m?.system?.kind === "agent-mention-stopped") return agentStopText(m.system) ?? String(m.text || "");
|
|
101
103
|
const key = m && m.system && SYSTEM[m.system.kind];
|
|
@@ -195,7 +197,7 @@ export function toThreadMessages(messages, { meId, ids, direct = false, expanded
|
|
|
195
197
|
const quoted = quotedId ? byId.get(quotedId) : null;
|
|
196
198
|
const state = askState(askOf(m, messages)), sourceBadge = roomSource(author);
|
|
197
199
|
out.push({ boot: BOOT, id, role: kind === "person" && !author.via ? "user" : "agent", sender: authorLine(author, mine, direct), ts: iso(m.at), text: String(m.text || ""), mine,
|
|
198
|
-
...(sourceBadge ? { sourceBadge } : {}),
|
|
200
|
+
...(sourceBadge ? { sourceBadge } : {}), ...(kind === "agent" && author.id ? { authorMember: String(author.id) } : {}),
|
|
199
201
|
...(kind === "person" && !mine && !author.via ? { person: true } : {}), // Lumen (spec §3): someone else's words, a bubble on the left
|
|
200
202
|
roomMessage: m.id, ...(mine && state?.delivery ? { delivery: state.delivery } : {}),
|
|
201
203
|
// M-3125: a post's files, as the 1:1 chat maps them (images inline through the Hub's own route; HTML gets its preview card).
|
|
@@ -402,7 +404,7 @@ function useMembersPanel() {
|
|
|
402
404
|
* Fleet chat's thread (panel-hub.js's HubThread, given as `Thread`: the thread wiring is one), the room's composer, and
|
|
403
405
|
* the members panel on the right. `client`: the Hub client; `me`: { id } from the session.
|
|
404
406
|
*/
|
|
405
|
-
export function HubRoomPage({ roomId, listed = null, Thread, client, meId = "", rooms = [], openRoom = () => {}, goList = () => {}, onLeft = () => {}, onMe = () => {}, pinsOn = false,
|
|
407
|
+
export function HubRoomPage({ roomId, listed = null, Thread, client, meId = "", rooms = [], openRoom = () => {}, openDirect = null, goList = () => {}, onLeft = () => {}, onMe = () => {}, pinsOn = false,
|
|
406
408
|
view = "chat", onView = () => {}, officeHref = (v) => v }) {
|
|
407
409
|
const store = useMemo(() => createRoomStore(roomId, { client, meId, pinsOn }), [roomId]);
|
|
408
410
|
const [pinsOpen, setPinsOpen] = useState(false);
|
|
@@ -529,7 +531,8 @@ export function HubRoomPage({ roomId, listed = null, Thread, client, meId = "",
|
|
|
529
531
|
const labels = () => [hroom("mentionAll"), hroom("mentionAssistant"), ...(store.detail()?.members || []).filter((m) => m.kind !== "assistant").map((m) => `@${m.name}`)];
|
|
530
532
|
const extra = {
|
|
531
533
|
isUser: (x) => x.mine === true, canReply: () => !store.closed(),
|
|
532
|
-
|
|
534
|
+
// M-3565: an agent's name opens its member card (its "@ it here", "Chat with it one-to-one"); its source in the card.
|
|
535
|
+
senderBadge: (el, msg) => mountSourceAuthor(el, msg, (id) => focusMember(id)),
|
|
533
536
|
mentionLabels: labels,
|
|
534
537
|
// A line's one action: 「展開其餘 N 則」, or 「請房間助理整理」 (spec §10: the same as sending 「@房間助理 整理上面的回答」).
|
|
535
538
|
statusAction: (arg) => { if (String(arg).startsWith("summarise:")) { if (!store.closed()) void store.send(hroom("summarisePrompt"), { mentions: ["assistant"] }); } else store.expand(arg); },
|
|
@@ -592,9 +595,26 @@ export function HubRoomPage({ roomId, listed = null, Thread, client, meId = "",
|
|
|
592
595
|
// The Fleet chat's working bar (Lumen): 「Notes 正在處理」, or 「2 個 Agent 正在處理」 — the answer row only when it arrives.
|
|
593
596
|
// Who: this room's answers being worked on; the words: workingLine() (#3857), the one place that says it.
|
|
594
597
|
const working = workingLine({ members: store.workers().map((w) => ({ ...w, presence: "working" })) });
|
|
598
|
+
// M-3565: a message's agent name → its card in the members panel: the panel opened (a phone's sheet), the card open.
|
|
599
|
+
const [focus, setFocus] = useState(null), wideNow = useRef(wide);
|
|
600
|
+
wideNow.current = wide; // read when pressed: the thread keeps the sender hook from its first render
|
|
601
|
+
const focusMember = (id) => {
|
|
602
|
+
const m = (store.detail()?.members || []).find((x) => x && x.kind === "agent" && x.id === id);
|
|
603
|
+
if (!m) return false;
|
|
604
|
+
if (wideNow.current) setRail(true); else setSheet(true);
|
|
605
|
+
setFocus({ id, n: Date.now() });
|
|
606
|
+
return true;
|
|
607
|
+
};
|
|
608
|
+
// M-3565: 「和它一對一對話」 (the member card, the office card) — the viewer's own chat with the agent: the one they have,
|
|
609
|
+
// else a new one (openDirect, the page's: as 新對話 starts it). Before, with no chat yet it did nothing.
|
|
610
|
+
const chatWith = (m) => {
|
|
611
|
+
if (typeof openDirect === "function") { setSheet(false); return openDirect(m); }
|
|
612
|
+
const direct = rooms.find((r) => r.kind === "direct" && r.agent?.exposureId === m.id);
|
|
613
|
+
if (direct) openRoom(direct.id);
|
|
614
|
+
};
|
|
595
615
|
const panel = Panel && detail ? html`<${Panel} client=${client} roomId=${roomId} detail=${detail}
|
|
596
616
|
onMention=${(m) => { setSheet(false); insertMention(m); }}
|
|
597
|
-
onOpenChat=${
|
|
617
|
+
onOpenChat=${chatWith} focus=${focus}
|
|
598
618
|
onSettings=${() => { setSheet(false); openSettings(); }} />` : null;
|
|
599
619
|
return html`<div class=${`hub-chat hub-room-page${showRail ? " with-rail" : ""}`} data-room=${roomId} data-width=${fullWidth ? "full" : undefined}>
|
|
600
620
|
<${LightboxHost} />
|
|
@@ -619,7 +639,7 @@ export function HubRoomPage({ roomId, listed = null, Thread, client, meId = "",
|
|
|
619
639
|
${menuItems.length ? html`<${Menu} cls="hub-room-menu" label=${hroom("menu")} fit=${true} ownerKey=${roomId} items=${menuItems} />` : null}
|
|
620
640
|
</header>
|
|
621
641
|
${inOffice ? html`<${RoomOffice} key=${roomId} client=${client} roomId=${roomId} members=${detail?.members || []}
|
|
622
|
-
onMention=${(m) => { mentionNext.current = m; onView("chat"); }} more=${
|
|
642
|
+
onMention=${(m) => { mentionNext.current = m; onView("chat"); }} onOpenChat=${chatWith} more=${officeMore} onMore=${setOfficeMore} />` : null}
|
|
623
643
|
${!inOffice && group && typeof room.purpose === "string" ? html`<${RoomPurposeCard} initial=${firstCharacter(title || "?") || "?"} purpose=${room.purpose}
|
|
624
644
|
onEdit=${detail?.me?.role === "manager" && client.roomPurposeV1 === true ? openSettings : undefined} />` : null}
|
|
625
645
|
${leaveError ? html`<p class="err hub-room-leave-err" role="alert">${leaveError}</p>` : null}
|
package/dist/ui/hub-strings.js
CHANGED
|
@@ -17,10 +17,10 @@ register("hub", {
|
|
|
17
17
|
adminTitle: "Administration",
|
|
18
18
|
// The Hub workspace (S3b): sign-in, Ask, My agents, Administration
|
|
19
19
|
signedOutHub: "Not signed in", signOut: "Sign out", signInTitle: "Sign in to the Hub",
|
|
20
|
-
signInLead: "Use your company account.
|
|
20
|
+
signInLead: "Use your company account. The Hub checks your password with the directory and never keeps it; your browser may offer to save it for you.",
|
|
21
21
|
signInPreview: "This Hub is a preview. Its screens and features may still change.",
|
|
22
22
|
login: "Account", password: "Password", signIn: "Sign in",
|
|
23
|
-
errSignIn: "That account and password didn't work.", errDirectory: "The directory can't be reached right now. Try again later.",
|
|
23
|
+
errSignIn: "That account and password didn't work.", errSignInAt: "That account and password didn't work. Type only your account name, the part before the @ (for example alex), not your email address.", errDirectory: "The directory can't be reached right now. Try again later.",
|
|
24
24
|
errBusyHub: "Too many requests just now. Wait a moment and try again.", errConflictHub: "This changed meanwhile. It has been reloaded; check it and try again.",
|
|
25
25
|
errNotFound: "Not found, or not available to you.", errDenied: "You're not allowed to do that (or no longer).", approveOwnerDenied: "{0} can't connect a Fleet right now: they aren't in the allowed groups, or they've been blocked from connecting.", errUnreachableHub: "The Hub can't be reached.",
|
|
26
26
|
askableTitle: "Agents you can ask", allowedBy: "Shared by {0} · until {1}", ask: "Ask", roomsTitle: "Your conversations", openRoom: "Open", back: "Back",
|
|
@@ -96,10 +96,10 @@ register("hub", {
|
|
|
96
96
|
exposuresHint: "請在自己的 Fleet 分享 Agent:設定 → Hub。",
|
|
97
97
|
adminTitle: "管理",
|
|
98
98
|
signedOutHub: "尚未登入", signOut: "登出", signInTitle: "登入 Hub",
|
|
99
|
-
signInLead: "
|
|
99
|
+
signInLead: "請使用公司帳號登入。Hub 只把密碼送給目錄服務驗證,不會保存;你的瀏覽器可能會詢問是否幫你記住。",
|
|
100
100
|
signInPreview: "這個 Hub 是預覽版,畫面與功能可能還會變動。",
|
|
101
101
|
login: "帳號", password: "密碼", signIn: "登入",
|
|
102
|
-
errSignIn: "帳號或密碼不正確。", errDirectory: "目前無法連到目錄服務,請稍後再試。",
|
|
102
|
+
errSignIn: "帳號或密碼不正確。", errSignInAt: "帳號或密碼不正確。帳號只要填 @ 前面的部分(例如 alex),不是電子郵件地址。", errDirectory: "目前無法連到目錄服務,請稍後再試。",
|
|
103
103
|
errBusyHub: "請求太頻繁,請稍候再試。", errConflictHub: "這個項目剛剛有變更,已重新載入,請確認後再試一次。",
|
|
104
104
|
errNotFound: "找不到,或你無法使用。", errDenied: "你沒有權限(或權限已被撤回)。", approveOwnerDenied: "{0} 目前不能連接 Fleet(不在允許的範圍,或已被禁止連接)。", errUnreachableHub: "無法連到 Hub。",
|
|
105
105
|
askableTitle: "你可以提問的 Agent", allowedBy: "由 {0} 開放 · 到 {1}", ask: "提問", roomsTitle: "你的對話", openRoom: "開啟", back: "返回",
|
package/dist/ui/panel-chat.js
CHANGED
|
@@ -816,7 +816,7 @@ function threadEntry(name, doc) {
|
|
|
816
816
|
openImage: (links, img) => openLightbox(links, img, annotateFor(name, img)), // an image, full size, in the page (#3727: with 標註)
|
|
817
817
|
emojis: (id) => !!emojiIndex && emojiIndex.known(id), // #1630: the fleet's server emoji
|
|
818
818
|
mentions: (kind, id) => (mentionIndex ? mentionIndex.name(kind, id) : null), // #1682: mention names
|
|
819
|
-
taskRefs: taskRefIndex ? taskChipInfo : undefined, // A person's task numbers as chips
|
|
819
|
+
taskRefs: taskRefIndex ? taskChipInfo : undefined, // A person's and an agent's task numbers as chips
|
|
820
820
|
activity: { mount: (node, group) => mountActivity(node, group, activityCtx(name)) }, // AGEND-181: the timeline's blocks
|
|
821
821
|
});
|
|
822
822
|
e.thread = thread;
|
package/dist/ui/panel-hub.js
CHANGED
|
@@ -301,7 +301,10 @@ function HubSignIn() {
|
|
|
301
301
|
const r = await hubClient().signIn(form.login.trim(), form.password);
|
|
302
302
|
if (mine !== generation.current || joinRequest() !== requestId) return;
|
|
303
303
|
if (r.ok) {
|
|
304
|
-
|
|
304
|
+
// M-3563: the browser keeps this login as typed (the directory account), so it offers it next time — never the
|
|
305
|
+
// email address from its own saved personal info. The fields keep their values until the form goes away (a
|
|
306
|
+
// browser judges a sign-in by them).
|
|
307
|
+
rememberLogin(form.login.trim(), form.password);
|
|
305
308
|
if (company.requestId) {
|
|
306
309
|
const joined = await approval.run(r.csrf);
|
|
307
310
|
if (mine !== generation.current || joined.code === "retired") return;
|
|
@@ -311,7 +314,11 @@ function HubSignIn() {
|
|
|
311
314
|
}
|
|
312
315
|
setBusy(false);
|
|
313
316
|
setForm((f) => ({ ...f, password: "" }));
|
|
314
|
-
|
|
317
|
+
// M-3563: a browser fills its saved email address into 帳號. Where this Hub signs in by an account that can hold no "@"
|
|
318
|
+
// (AD's sAMAccountName: the shell's data-hub-login="no-at"), say what to type instead; elsewhere ("@" may be right:
|
|
319
|
+
// userPrincipalName, mail…) the plain line.
|
|
320
|
+
const noAt = typeof document !== "undefined" && document.body?.dataset?.hubLogin === "no-at";
|
|
321
|
+
setMsg(r.code === "backpressure" ? hw("errBusyHub") : r.code === "unavailable" ? hw("errDirectory") : hw(noAt && form.login.includes("@") ? "errSignInAt" : "errSignIn"));
|
|
315
322
|
};
|
|
316
323
|
return html`<main class="hub-signin-page"><section class="hub-signin hub-signin-card" aria-labelledby="hubSignInTitle">
|
|
317
324
|
<div class="hub-signin-brand"><strong>${t("hubShell.brand")}</strong>${name ? html`<span>${name}</span>` : null}</div>
|
|
@@ -321,10 +328,10 @@ function HubSignIn() {
|
|
|
321
328
|
${company.requestId && company.view === undefined ? html`<${Skeleton} variant="form" lines=${2} label=${hj("loading")} />` : company.requestId && company.view && !company.view.ok ? html`<${ErrorState} message=${joinError(company.view.code)} onRetry=${company.retry} />` : null}
|
|
322
329
|
${!company.requestId || company.view?.ok && company.view.state === "pending" ? html`<form class="hub-signin-form" onSubmit=${submit}>
|
|
323
330
|
<label for="hubLogin">${hw("login")}</label>
|
|
324
|
-
<input id="hubLogin" autocomplete="username" spellcheck=${false} autocapitalize="none"
|
|
331
|
+
<input id="hubLogin" name="username" autocomplete="username" spellcheck=${false} autocapitalize="none"
|
|
325
332
|
value=${form.login} onInput=${(e) => { const v = e.target.value; setForm((f) => ({ ...f, login: v })); }} />
|
|
326
333
|
<label for="hubPassword">${hw("password")}</label>
|
|
327
|
-
<input id="hubPassword" type="password" autocomplete="current-password"
|
|
334
|
+
<input id="hubPassword" name="password" type="password" autocomplete="current-password"
|
|
328
335
|
value=${form.password} onInput=${(e) => { const v = e.target.value; setForm((f) => ({ ...f, password: v })); }} />
|
|
329
336
|
<button type="submit" class="hub-signin-go" disabled=${busy || company.requestId && !company.view?.ok}>${company.requestId ? hj("signInConnect") : hw("signIn")}</button>
|
|
330
337
|
</form>` : company.view?.ok ? html`<p role="status">${joinError(company.view.reason || company.view.state)}</p>` : null}
|
|
@@ -334,6 +341,36 @@ function HubSignIn() {
|
|
|
334
341
|
</section></main>`;
|
|
335
342
|
}
|
|
336
343
|
|
|
344
|
+
/**
|
|
345
|
+
* M-3565: a room's 「和它一對一對話」 — the viewer's own chat with that agent: the one they have, else one started as 新對話
|
|
346
|
+
* starts it (their grant for that agent, from the catalog). Resolves to whether it opened; says why not when it did not.
|
|
347
|
+
*/
|
|
348
|
+
export async function openDirectChat(member, rooms = []) {
|
|
349
|
+
const id = member && member.id;
|
|
350
|
+
if (!id) return false;
|
|
351
|
+
const have = rooms.find((r) => r && r.kind === "direct" && !r.archived && (r.agent || r.legacy || {}).exposureId === id);
|
|
352
|
+
if (have) { navigate(roomPath(have.id)); return true; }
|
|
353
|
+
const cat = await hubClient().catalog().catch(() => null);
|
|
354
|
+
const it = cat && Array.isArray(cat.askable) ? cat.askable.find((x) => x && x.exposure && x.exposure.id === id && x.grant) : null;
|
|
355
|
+
if (!it) { toast(hw("errNotFound"), false); return false; }
|
|
356
|
+
const r = await hubClient().openRoom(it.exposure.id, it.grant.id);
|
|
357
|
+
if (!r.ok) { toast(errText(r), false); return false; }
|
|
358
|
+
await refreshRooms(); navigate(roomPath(r.room.id));
|
|
359
|
+
return true;
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
/**
|
|
363
|
+
* M-3563: hand a login that worked to the browser's password manager (Chrome, Edge: the Credential Management API), the
|
|
364
|
+
* account exactly as typed. Where the browser has none, or the person declines, nothing happens; never an error.
|
|
365
|
+
*/
|
|
366
|
+
export function rememberLogin(login, password) {
|
|
367
|
+
try {
|
|
368
|
+
const PC = globalThis.PasswordCredential, store = globalThis.navigator?.credentials?.store;
|
|
369
|
+
if (typeof PC !== "function" || typeof store !== "function" || !login || !password) return;
|
|
370
|
+
Promise.resolve(globalThis.navigator.credentials.store(new PC({ id: login, password, name: login }))).catch(() => {});
|
|
371
|
+
} catch { /* none */ }
|
|
372
|
+
}
|
|
373
|
+
|
|
337
374
|
/** Load a list from the client; `reload` reads it again. null while loading, { error } on failure. */
|
|
338
375
|
function useRead(read) {
|
|
339
376
|
const [data, setData] = useState(null);
|
|
@@ -592,7 +629,7 @@ function HubChats() {
|
|
|
592
629
|
const room = id ? (listed ? listed.legacy || listed : rs.loaded ? { id, exposureName: "", ownerName: "", features: [] } : null) : null;
|
|
593
630
|
// A room of a Hub with rooms: the shared thread with the room's store, composer and members panel (hub-room-thread.js).
|
|
594
631
|
if (id && listed && !listed.legacy) return html`<${HubRoomPage} key=${id} roomId=${id} listed=${listed} Thread=${HubThread} client=${hubClient()}
|
|
595
|
-
rooms=${rs.rooms} openRoom=${(rid) => navigate(roomPath(rid))} goList=${() => navigate("/ui/hub")}
|
|
632
|
+
rooms=${rs.rooms} openRoom=${(rid) => navigate(roomPath(rid))} openDirect=${(m) => openDirectChat(m, rs.rooms)} goList=${() => navigate("/ui/hub")}
|
|
596
633
|
onLeft=${() => { void refreshRooms(); navigate("/ui/hub"); }} onMe=${noteHubMeId} pinsOn=${roomPinsLive()}
|
|
597
634
|
view=${viewParam() === "office" ? "office" : "chat"} officeHref=${(v) => roomViewPath(id, v)} onView=${(v) => navigate(roomViewPath(id, v))} />`;
|
|
598
635
|
if (id && room) return html`<${HubRoomView} key=${id} room=${room} />`;
|