@songsid/agend 2.4.0-beta.31 → 2.4.0-beta.34
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/build-provenance.json +1 -1
- package/dist/channel/mcp-tools.js +1 -1
- package/dist/channel/mcp-tools.js.map +1 -1
- package/dist/daemon.d.ts +9 -1
- package/dist/daemon.js +104 -25
- package/dist/daemon.js.map +1 -1
- package/dist/fleet-context.d.ts +2 -0
- package/dist/fleet-manager.d.ts +16 -0
- package/dist/fleet-manager.js +92 -9
- package/dist/fleet-manager.js.map +1 -1
- package/dist/general-knowledge/skills/concepts/SKILL.md +21 -2
- package/dist/general-knowledge/skills/credential-profiles/SKILL.md +9 -4
- package/dist/general-knowledge/skills/hub/SKILL.md +16 -4
- package/dist/general-knowledge/skills/web-dashboard/SKILL.md +2 -0
- package/dist/hub/client.js +23 -7
- package/dist/hub/client.js.map +1 -1
- package/dist/hub/compose/member.d.ts +11 -0
- package/dist/hub/compose/member.js +17 -5
- package/dist/hub/compose/member.js.map +1 -1
- package/dist/hub/compose/server.js +2 -1
- package/dist/hub/compose/server.js.map +1 -1
- package/dist/hub/group-policy/resources.d.ts +1 -1
- package/dist/hub/http/compose.d.ts +2 -0
- package/dist/hub/http/compose.js +45 -6
- package/dist/hub/http/compose.js.map +1 -1
- package/dist/hub/member/room-ask.d.ts +1 -0
- package/dist/hub/member/room-ask.js +11 -4
- package/dist/hub/member/room-ask.js.map +1 -1
- package/dist/hub/member-journal.d.ts +2 -0
- package/dist/hub/member-journal.js +5 -0
- package/dist/hub/member-journal.js.map +1 -1
- package/dist/hub/member-reconciliation.d.ts +2 -0
- package/dist/hub/member-reconciliation.js +3 -1
- package/dist/hub/member-reconciliation.js.map +1 -1
- package/dist/hub/protocol.d.ts +15 -8
- package/dist/hub/protocol.js +15 -3
- package/dist/hub/protocol.js.map +1 -1
- package/dist/hub/receipt-reason.d.ts +6 -0
- package/dist/hub/receipt-reason.js +12 -0
- package/dist/hub/receipt-reason.js.map +1 -0
- package/dist/hub/representative.d.ts +6 -0
- package/dist/hub/representative.js +21 -4
- package/dist/hub/representative.js.map +1 -1
- package/dist/hub/rooms/direct-view.js +2 -0
- package/dist/hub/rooms/direct-view.js.map +1 -1
- package/dist/hub/rooms/types.d.ts +2 -0
- package/dist/hub/rooms.d.ts +12 -0
- package/dist/hub/rooms.js +14 -3
- package/dist/hub/rooms.js.map +1 -1
- package/dist/hub/server.js +9 -2
- package/dist/hub/server.js.map +1 -1
- package/dist/hub/settings-member-address-decision.js +1 -1
- package/dist/hub/settings-member-address-decision.js.map +1 -1
- package/dist/hub/settings-web-address-decision.js +2 -2
- package/dist/hub/settings-web-address-decision.js.map +1 -1
- package/dist/hub-reply-route.d.ts +36 -0
- package/dist/hub-reply-route.js +67 -0
- package/dist/hub-reply-route.js.map +1 -0
- package/dist/hub-report-target.d.ts +4 -0
- package/dist/instance-lifecycle.d.ts +2 -0
- package/dist/instance-lifecycle.js +4 -0
- package/dist/instance-lifecycle.js.map +1 -1
- package/dist/locale.js +2 -2
- package/dist/locale.js.map +1 -1
- package/dist/outbound-handlers.d.ts +2 -0
- package/dist/outbound-handlers.js +22 -7
- package/dist/outbound-handlers.js.map +1 -1
- package/dist/outbound-schemas.d.ts +1 -0
- package/dist/outbound-schemas.js +1 -0
- package/dist/outbound-schemas.js.map +1 -1
- package/dist/topic-commands.js +6 -4
- package/dist/topic-commands.js.map +1 -1
- package/dist/turn-reply-guard.d.ts +3 -1
- package/dist/turn-reply-guard.js +7 -3
- package/dist/turn-reply-guard.js.map +1 -1
- package/dist/ui/hub-assistant-admin.js +10 -3
- package/dist/ui/hub-assistant-usage-strings.js +8 -0
- package/dist/ui/hub-chat-store.js +9 -6
- package/dist/ui/hub-chat-strings.js +4 -2
- package/dist/ui/hub-owner-strings.js +2 -2
- package/dist/ui/hub-room-composer.js +9 -2
- package/dist/ui/hub-room-strings.js +4 -4
- package/dist/ui/hub-room-thread.js +45 -11
- package/dist/ui/panel-chat.js +18 -5
- package/dist/ui/panel-hub.js +3 -3
- package/dist/ui/report-columns.js +137 -0
- package/dist/ui/shared/app.css +28 -2
- package/dist/ui/shared/chat-msg-actions.js +1 -1
- package/dist/ui/shared/chat-thread.js +1 -1
- package/dist/ui/shared/hub-owner.css +12 -0
- package/package.json +1 -1
|
@@ -19,8 +19,9 @@ register("hubChat", {
|
|
|
19
19
|
emptyRoom: "Ask {0} your first question", emptyRoomHint: "It answers for {0}. An answer can take a few minutes.",
|
|
20
20
|
composer: "Ask {0}", composerHint: "You ask as yourself; {0} sees that it was you.", send: "Send", stop: "Stop",
|
|
21
21
|
working: "{0} is working on it", elapsed: "Time since it started",
|
|
22
|
-
tick_queued: "
|
|
22
|
+
tick_queued: "Sent", tick_processing: "At the owner's fleet", tick_delivered: "Answered",
|
|
23
23
|
tick_failed: "Not answered", tick_cancelled: "Outcome unknown",
|
|
24
|
+
deliveredNextTurn:"{0} will see this when it finishes its current work", finishedNoReply:"{0} finished without replying to this. You can ask again.",
|
|
24
25
|
notAnswered: "Not answered: {0}", uncertain: "Outcome unknown: it may or may not have been answered.",
|
|
25
26
|
reason_expired: "the question expired before an answer", reason_revoked: "your permission ended", reason_frozen: "the owner paused questions",
|
|
26
27
|
reason_withdrawn: "the agent is no longer shared", reason_unknown: "no reason given",
|
|
@@ -53,8 +54,9 @@ register("hubChat", {
|
|
|
53
54
|
emptyRoom: "問 {0} 第一個問題", emptyRoomHint: "它代表 {0} 回答;回答可能要幾分鐘。",
|
|
54
55
|
composer: "問 {0}", composerHint: "你以自己的 Hub 身分提問;{0} 會看到是你問的。", send: "送出", stop: "停止",
|
|
55
56
|
working: "{0} 正在處理", elapsed: "開始處理後經過的時間",
|
|
56
|
-
tick_queued: "
|
|
57
|
+
tick_queued: "已送出", tick_processing: "已送達擁有者的 fleet", tick_delivered: "已回答",
|
|
57
58
|
tick_failed: "未回答", tick_cancelled: "結果未知",
|
|
59
|
+
deliveredNextTurn:"{0} 忙完目前的工作就會看到這則", finishedNoReply:"{0} 處理完了,但沒有回覆這則。可以再問一次。",
|
|
58
60
|
notAnswered: "未回答:{0}", uncertain: "結果未知:可能已回答,也可能沒有。",
|
|
59
61
|
reason_expired: "問題在回答前就過期了", reason_revoked: "你的權限已結束", reason_frozen: "擁有者暫停了提問",
|
|
60
62
|
reason_withdrawn: "這個 Agent 不再分享", reason_unknown: "沒有說明原因",
|
|
@@ -19,7 +19,7 @@ register("hubOwner", {
|
|
|
19
19
|
pairedFleets: "Connected fleets · {0}", pauseGo: "Stop sharing…", pauseLead: "No one can ask it any more. To share it again, it has to be shared again from its fleet, and everyone has to be allowed to ask again. What was asked stays readable.",
|
|
20
20
|
pauseTitle: "Stop sharing", pendingLead: "Check that this fingerprint matches the one your fleet shows, then confirm.",
|
|
21
21
|
pendingPairings: "Pairings waiting for you", recent: "Recent questions",
|
|
22
|
-
recentLead: "Who asked and when, and whether it was answered. What they asked
|
|
22
|
+
recentLead: "Who asked and when, and whether it was answered. What they asked goes only to the agent's own conversation; it isn't posted in your Fleet chat.", recentNone: "No one has asked yet.",
|
|
23
23
|
refresh: "Refresh", revokeItem: "Revoke…", revokedTag: "Revoked", rowMenu: "More for {0}", scopeHub: "This Hub", scopeYou: "Yours",
|
|
24
24
|
yourAgentsCount: "My agents · {0}", sharedCount: "Shared · {0}", stageAnswered: "Answered", stageNot: "Not answered", stageWaiting: "Waiting", statePaused: "Sharing stopped on the Hub",
|
|
25
25
|
stateShared: "Shared", stateWithdrawn: "Withdrawn", stepApprove: "You approve", stepApproveHint: "Check the same fingerprint, then approve.",
|
|
@@ -36,7 +36,7 @@ register("hubOwner", {
|
|
|
36
36
|
mayAskOne: "1 人可以提問", mineLead: "在這個 Hub 上代表你回答的 Agent:誰可以提問、到什麼時候、最近誰問過。要開始或停止分享,請到你 Fleet 的「設定 → Hub」。", mineLeadShort: "在這個 Hub 上代表你回答的 Agent:誰可以提問、到什麼時候、最近誰問過。", noFleets: "還沒有已連接的 Fleet。",
|
|
37
37
|
ownerChecked: "擁有者已確認", ownerLogin: "擁有者的登入名稱", pairSteps: "配對一個 Fleet", pairedFleets: "已連接的 Fleet · {0}", pauseGo: "停止分享…",
|
|
38
38
|
pauseLead: "之後沒有人能再向它提問。要再分享,必須回到它的 Fleet 重新分享,而且每個人都要重新允許提問。已經問過的內容仍然看得到。", pauseTitle: "停止分享", pendingLead: "確認這個指紋和你 Fleet 上顯示的一致,再按確認。", pendingPairings: "等你核對的配對",
|
|
39
|
-
recent: "最近的提問", recentLead: "
|
|
39
|
+
recent: "最近的提問", recentLead: "誰問的、什麼時候,有沒有回答。問題只會送到這個 Agent 自己的對話裡,不會貼到你 Fleet 的聊天。", recentNone: "還沒有人問過。", refresh: "重新整理", revokeItem: "撤銷…", revokedTag: "已撤銷",
|
|
40
40
|
rowMenu: "{0} 的更多動作", scopeHub: "這個 Hub", scopeYou: "你的", yourAgentsCount: "我的 Agent · {0}", sharedCount: "分享中 · {0}", stageAnswered: "已回答", stageNot: "未回答", stageWaiting: "等待中",
|
|
41
41
|
statePaused: "已在 Hub 停止分享", stateShared: "分享中", stateWithdrawn: "已停止分享", stepApprove: "你核准", stepApproveHint: "核對同一個指紋後核准。", stepCode: "產生配對碼",
|
|
42
42
|
stepCodeHint: "給 Fleet 的擁有者:10 分鐘內在他的 Fleet 輸入,只能用一次。", stepOwner: "擁有者核對指紋", stepOwnerHint: "在他的 Fleet 上,然後在這個 Hub 的「我的 Agent」確認。",
|
|
@@ -241,9 +241,16 @@ export function RoomComposer({ store, detail, reply = null, onReply = () => {},
|
|
|
241
241
|
// M-3125: `canSendEmpty` — files are ready to go, so a post may be the files alone (the server takes it).
|
|
242
242
|
const text = value.trim(); if ((!text && !canSendEmpty) || busy || closed) return;
|
|
243
243
|
setBusy(true); setMsg(null);
|
|
244
|
-
|
|
244
|
+
// M-3951: the box empties at once, as the Fleet chat's does (the message is already drawn); a refusal puts it back
|
|
245
|
+
// unless something new was typed meanwhile.
|
|
246
|
+
const was = { value, bindings: bindings.current, reply };
|
|
247
|
+
setValue(""); bindings.current = []; onReply(null);
|
|
248
|
+
const r = await store.send(text, { mentions: boundMentions(was.value, detail, was.bindings), ...(was.reply ? { replyTo: was.reply.roomMessage } : {}) });
|
|
245
249
|
setBusy(false);
|
|
246
|
-
if (r.ok) {
|
|
250
|
+
if (!r.ok) {
|
|
251
|
+
if (!input.current?.value) { setValue(was.value); bindings.current = was.bindings; if (was.reply) onReply(was.reply); }
|
|
252
|
+
setMsg({ text: refusalText(r), retry: retryable(r) });
|
|
253
|
+
}
|
|
247
254
|
};
|
|
248
255
|
const onKeyDown = (e) => {
|
|
249
256
|
if (palette && (e.key === "ArrowDown" || e.key === "ArrowUp")) { e.preventDefault(); setPick((i) => (i + (e.key === "ArrowDown" ? 1 : palette.length - 1)) % palette.length); return; }
|
|
@@ -40,7 +40,7 @@ register("hubRoom", {
|
|
|
40
40
|
searchResults: "Results", searchRooms: "Rooms and chats", searchBadgeRoom: "Room", searchBadgeChat: "Chat", searchCount: "{0} results",
|
|
41
41
|
searchOlder: "Search older messages", searchKeys: "↑↓ move · Enter open · Esc close", jumpMissing: "That message is no longer in this room.",
|
|
42
42
|
filterPh: "Filter: name or owner", filterClear: "Clear the filter",
|
|
43
|
-
laterAnswer: "{0} ({1}) · answers after they come online", noAnswer: "No answer", noAnswerReshare: "This agent is unavailable right now. Its owner needs to share it again.",
|
|
43
|
+
laterAnswer: "{0} ({1}) · answers after they come online", noAnswer: "No answer", noAnswerReshare: "This agent is unavailable right now. Its owner needs to share it again.", directDelivered:"{0} will see this when it finishes its current work", noAnswerUnanswered:"{0} finished without replying to this. You can ask again.", noAnswerDeclined: "The owner chose not to answer this question.", noAnswerStopped: "No answer: {0} stopped sharing this agent.",
|
|
44
44
|
workingOne: "{0} is working on it", workingMany: "{0} agents are working",
|
|
45
45
|
waitBehindOne: "Waiting: {0} is answering another question first", waitBehindMany: "Waiting: {0} has {1} questions to answer first",
|
|
46
46
|
waitBusy: "Waiting: {0} is busy with other work", waitPaused: "Waiting: {0} is paused; it gets your question when it resumes",
|
|
@@ -137,7 +137,7 @@ register("hubRoom", {
|
|
|
137
137
|
assistantQuota: "The room assistant uses this account's quota.",
|
|
138
138
|
aiAccount: "AI account", cap: "At most this many at once", idleMinutes: "Stop after this many idle minutes",
|
|
139
139
|
runningNow: "Now", stop: "Stop", lastUsed: "Last used",
|
|
140
|
-
usage: "
|
|
140
|
+
usage: "Room assistant usage", usageLead: "How many times the Hub's room assistant answered each day, last 7 days. Questions to shared agents are counted on Overview.",
|
|
141
141
|
quotaPlenty: "Plenty", quotaLow: "Running low", quotaGone: "Used up",
|
|
142
142
|
assistantNotEnabled: "The room assistant is not enabled yet.",
|
|
143
143
|
assistantEnableHint: "Sign in an AI account in AgEnD on this computer, then come back and turn it on.",
|
|
@@ -197,7 +197,7 @@ register("hubRoom", {
|
|
|
197
197
|
searchResults: "結果", searchRooms: "房間與聊天", searchBadgeRoom: "房間", searchBadgeChat: "聊天", searchCount: "{0} 筆結果",
|
|
198
198
|
searchOlder: "搜尋更早的訊息", searchKeys: "↑↓ 移動 · Enter 開啟 · Esc 關閉", jumpMissing: "這則訊息已不在這個房間裡。",
|
|
199
199
|
filterPh: "篩選:名稱或擁有者", filterClear: "清除篩選",
|
|
200
|
-
laterAnswer: "{0}({1})· 上線後回答", noAnswer: "沒有回答", noAnswerReshare: "這個 Agent 暫時無法回答,擁有者需要重新分享。", noAnswerUnanswered:"
|
|
200
|
+
laterAnswer: "{0}({1})· 上線後回答", noAnswer: "沒有回答", noAnswerReshare: "這個 Agent 暫時無法回答,擁有者需要重新分享。", directDelivered:"{0} 忙完目前的工作就會看到這則", noAnswerUnanswered:"{0} 處理完了,但沒有回覆這則。可以再問一次。", noAnswerDeclined: "擁有者決定不處理這題。", noAnswerStopped: "沒有回答:{0} 已停止分享這個 Agent。",
|
|
201
201
|
workingOne: "{0} 正在處理", workingMany: "{0} 個 Agent 正在處理",
|
|
202
202
|
waitBehindOne: "等待中:{0} 正在先回答另一個問題", waitBehindMany: "等待中:{0} 前面還有 {1} 個問題",
|
|
203
203
|
waitBusy: "等待中:{0} 正在處理其他工作", waitPaused: "等待中:{0} 已暫停,恢復後會收到你的問題",
|
|
@@ -285,7 +285,7 @@ register("hubRoom", {
|
|
|
285
285
|
assistantQuota: "房間助理使用這個帳號的額度。",
|
|
286
286
|
aiAccount: "AI 帳號", cap: "同時最多幾個", idleMinutes: "閒置幾分鐘後停止",
|
|
287
287
|
runningNow: "現在", stop: "停止", lastUsed: "最後使用",
|
|
288
|
-
usage: "
|
|
288
|
+
usage: "房間助理用量", usageLead: "Hub 房間助理近 7 天每天回答的次數。分享的 Agent 收到的提問算在「總覽」。",
|
|
289
289
|
quotaPlenty: "充足", quotaLow: "快用完", quotaGone: "用完",
|
|
290
290
|
assistantNotEnabled: "房間助理還沒有啟用。",
|
|
291
291
|
assistantEnableHint: "先在這台電腦的 AgEnD 登入一個 AI 帳號,再回來開啟。",
|
|
@@ -73,7 +73,7 @@ function useNarrowScreen() {
|
|
|
73
73
|
/** M-3311 (3): a room message's address — what Copy link copies; opening it shows that message (jumpParam). */
|
|
74
74
|
export const messageLink = (roomId, messageId) => `${location.origin}/ui/hub?room=${encodeURIComponent(roomId)}${messageId ? `&m=${encodeURIComponent(messageId)}` : ""}`;
|
|
75
75
|
/** M-3311 (#4159 review): a room row's Copy link — only a message with an address (a room message's id); otherwise none. */
|
|
76
|
-
export const roomLinkOf = (roomId) => (x) => (x && x.roomMessage ? messageLink(roomId, x.roomMessage) : null);
|
|
76
|
+
export const roomLinkOf = (roomId) => (x) => (x && x.roomMessage && !x.pending ? messageLink(roomId, x.roomMessage) : null);
|
|
77
77
|
/** M-3127 C: the message a search hit opens (`?room=…&m=<id>`), or null. */
|
|
78
78
|
export const jumpParam = () => { try { const v = new URLSearchParams(location.search).get("m"); return v && /^[A-Za-z0-9-]{1,64}$/.test(v) ? v : null; } catch { return null; } };
|
|
79
79
|
const iso = (ms) => (Number.isFinite(ms) && ms > 0 ? new Date(ms).toISOString() : undefined);
|
|
@@ -135,6 +135,21 @@ export function askState(ask) {
|
|
|
135
135
|
}
|
|
136
136
|
return { line: parts.join(" · "), ...(reason ? { reason } : {}) };
|
|
137
137
|
}
|
|
138
|
+
/**
|
|
139
|
+
* M-3951: my 1:1 question's mark, as the Fleet chat draws its own (◷ waiting, ✓ handed over, ✓✓ the agent has it,
|
|
140
|
+
* ! not delivered, ⊘ dropped). From the Hub's receipt stage, and its answer row: one that is working, or an answer,
|
|
141
|
+
* means the agent has it. Null when the Hub sent no stage (an older Hub): no mark, as before.
|
|
142
|
+
*/
|
|
143
|
+
export function directDelivery(m, messages) {
|
|
144
|
+
const stage = m && m.receiptStage;
|
|
145
|
+
if (typeof stage !== "string") return null;
|
|
146
|
+
const answer = Array.isArray(messages) ? messages.find((x) => x && x.answerTo === m.id && x.author?.kind === "agent") : null;
|
|
147
|
+
if (stage === "answered" || stage === "consumed" || answer?.stage === "working" || (answer && answer.text)) return "delivered";
|
|
148
|
+
if (stage === "delivered") return "processing";
|
|
149
|
+
if (stage === "queued") return "queued";
|
|
150
|
+
if (stage === "cancelled" || stage === "uncertain") return "cancelled";
|
|
151
|
+
return "failed";
|
|
152
|
+
}
|
|
138
153
|
/** When the server has not yet named failed/blocked, a stored `not-answered` child is failed. */
|
|
139
154
|
function askOf(m, messages) {
|
|
140
155
|
const ask = m && m.ask;
|
|
@@ -206,23 +221,30 @@ export function toThreadMessages(messages, { meId, ids, direct = false, expanded
|
|
|
206
221
|
const quotedId = m.replyTo || m.answerTo || "";
|
|
207
222
|
const quoted = quotedId ? byId.get(quotedId) : null;
|
|
208
223
|
const state = askState(askOf(m, messages)), sourceBadge = roomSource(author);
|
|
224
|
+
const neutralNoReply=direct&&state?.reason==="finished-without-answer";
|
|
225
|
+
const child=direct&&mine?messages.find(x=>x.answerTo===m.id&&x.author?.kind==="agent"):null;
|
|
226
|
+
const deliveredLine=direct&&mine&&state?.delivery==="processing"&&child?.author?.name?hroom("directDelivered",child.author.name):null;
|
|
227
|
+
if(m.stage==="not-answered"&&m.reasonCode==="finished-without-answer"){
|
|
228
|
+
out.push({boot:BOOT,id,role:"status",sender:"",text:hroom("noAnswerUnanswered",author.name||""),bare:true,progressOf:m.answerTo});continue;
|
|
229
|
+
}
|
|
209
230
|
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,
|
|
210
231
|
...(sourceBadge ? { sourceBadge } : {}), ...(kind === "agent" && author.id ? { authorMember: String(author.id) } : {}),
|
|
211
232
|
...(kind === "person" && !mine && !author.via ? { person: true } : {}), // Lumen (spec §3): someone else's words, a bubble on the left
|
|
212
|
-
roomMessage: m.id, ...(
|
|
233
|
+
roomMessage: m.id, ...(m.id.startsWith("local:") ? { pending: true } : {}), ...(direct && mine && directDelivery(m, messages) ? { delivery: directDelivery(m, messages) }
|
|
234
|
+
: mine && state?.delivery && !neutralNoReply && !deliveredLine ? { delivery: state.delivery } : {}),
|
|
213
235
|
// 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).
|
|
214
236
|
...(() => { const files = Array.isArray(m.files) ? m.files.map(hubFileAttachment).filter(Boolean) : []; return files.length ? { attachments: files } : {}; })(),
|
|
215
237
|
...(!direct && Array.isArray(m.reactions) && m.reactions.length ? { reactionBar: reactionBar(m.reactions, { meId, names }) } : {}),
|
|
216
238
|
...(!direct && kind !== "person" && m.buttons ? { buttons: roomButtons(m.buttons, meId) } : {}),
|
|
217
239
|
...(quotedId ? { replyTo: { boot: BOOT, id: num(quotedId), sender: quoted ? authorLine(quoted.author, quoted.author?.id === meId, direct) : "", text: quoted ? String(quoted.text || "").slice(0, 120) : "" } } : {}),
|
|
218
|
-
...(m.stage === "not-answered" && !(kind === "person" && m.reasonCode === "share-needs-reshare") ? { text: m.reasonCode === "owner-declined" ? hroom("noAnswerDeclined") : m.reasonCode === "share-needs-reshare" ? hroom("noAnswerReshare") : m.reasonCode === "owner-stopped-sharing" ? hroom("noAnswerStopped", author.owner?.name || "") : m.reasonCode==="finished-without-answer"?hroom("noAnswerUnanswered"):hroom("noAnswer") } : {}) });
|
|
240
|
+
...(m.stage === "not-answered" && !(kind === "person" && m.reasonCode === "share-needs-reshare") ? { text: m.reasonCode === "owner-declined" ? hroom("noAnswerDeclined") : m.reasonCode === "share-needs-reshare" ? hroom("noAnswerReshare") : m.reasonCode === "owner-stopped-sharing" ? hroom("noAnswerStopped", author.owner?.name || "") : m.reasonCode==="finished-without-answer"?hroom("noAnswerUnanswered",author.name||""):hroom("noAnswer") } : {}) });
|
|
219
241
|
if (kind === "person" && m.stage === "not-answered" && m.reasonCode === "share-needs-reshare")
|
|
220
242
|
out.push({ boot: BOOT, id: num(`unavailable:${m.id}`), role: "status", sender: "", text: hroom("noAnswerReshare"), bare: true, wrap: true });
|
|
221
243
|
if (foldAfter) out.push({ boot: BOOT, id: num(`expand:${foldAfter.arg}`), role: "status", sender: "", text: "", bare: true, fold: true, action: foldAfter });
|
|
222
244
|
// Spec §10: once an @所有 Agent has answers, under the last one shown, 「請房間助理整理」 (it sends 「@房間助理 整理上面的回答」).
|
|
223
245
|
if (summarise && lastShown && byId.get(m.answerTo)?.mentions?.includes("all"))
|
|
224
246
|
out.push({ boot: BOOT, id: num(`summarise:${m.answerTo}`), role: "status", sender: "", text: "", bare: true, action: { label: hroom("askSummarise"), arg: `summarise:${m.answerTo}` } });
|
|
225
|
-
const line = state?.line, why = !line && mine ? askReason(state?.reason) : "";
|
|
247
|
+
const line = deliveredLine || state?.line, why = !line && mine && !(neutralNoReply&&messages.some(x=>x.answerTo===m.id&&x.reasonCode==="finished-without-answer")) ? askReason(state?.reason) : "";
|
|
226
248
|
// Its status, not an event: under it, without a time of its own.
|
|
227
249
|
if (line) out.push({ boot: BOOT, id: id + 1, role: "status", sender: "", text: line, progressOf: m.id, bare: true });
|
|
228
250
|
else if (why) out.push({ boot: BOOT, id: id + 1, role: "status", sender: "", text: why, progressOf: m.id, bare: true, wrap: state?.reason === "share-needs-reshare" });
|
|
@@ -253,7 +275,9 @@ export function createRoomStore(roomId, { client, meId = "", pinsOn = false } =
|
|
|
253
275
|
if (!m || m.roomId !== roomId || typeof m.id !== "string") return;
|
|
254
276
|
const i = st.messages.findIndex((x) => x.id === m.id || (m.idempotencyKey && x.idempotencyKey === m.idempotencyKey));
|
|
255
277
|
// The server always sends the whole message: one without reactions has none left (M-3127), never the old ones.
|
|
256
|
-
|
|
278
|
+
// M-3951: my message drawn at send (`local:`) is replaced whole: its optimistic stage never outlives the Hub's copy.
|
|
279
|
+
if (i >= 0 && st.messages[i].id.startsWith("local:")) st.messages[i] = m;
|
|
280
|
+
else if (i >= 0) { const next = { ...st.messages[i], ...m }; if (!("reactions" in m)) delete next.reactions; st.messages[i] = next; } else st.messages.push(m);
|
|
257
281
|
};
|
|
258
282
|
const readDetail = async () => { const d = await client.room(roomId); if (!st.live) return; if (d.ok) st.detail = d; else if (!st.detail) st.error = d.code || "failed"; };
|
|
259
283
|
async function refresh() {
|
|
@@ -332,12 +356,21 @@ export function createRoomStore(roomId, { client, meId = "", pinsOn = false } =
|
|
|
332
356
|
filesV1: true,
|
|
333
357
|
async send(text, { mentions = [], replyTo, files } = {}) {
|
|
334
358
|
const idempotencyKey = (globalThis.crypto?.randomUUID?.() || `${Date.now()}-${Math.random()}`).replace(/[^A-Za-z0-9-]/g, "");
|
|
335
|
-
|
|
359
|
+
// M-3951: my message shows at once, as the Fleet chat's does: in a 1:1 with its ◷ until the Hub's copy replaces it.
|
|
360
|
+
// Files keep today's path (their chips stay in the composer until the Hub has them).
|
|
361
|
+
const me = st.detail?.me?.id || meId, local = `local:${idempotencyKey}`, draws = !files?.length && !!text && !!me;
|
|
362
|
+
if (draws) { st.messages.push({ id: local, roomId, at: Date.now(), author: { kind: "person", id: me, name: "" }, text, mentions, idempotencyKey,
|
|
363
|
+
...(replyTo ? { replyTo } : {}), ...(st.detail?.room?.kind === "direct" ? { receiptStage: "queued" } : {}) }); changed(); }
|
|
364
|
+
let r;
|
|
365
|
+
try { r = await client.sendRoomMessage(roomId, { text, mentions, replyTo, idempotencyKey, ...(files?.length ? { files } : {}) }); }
|
|
366
|
+
finally { if (draws) st.messages = st.messages.filter((m) => m.id !== local); }
|
|
336
367
|
// The stored message, as the Hub answers it: `{ message }`, or the message itself (Ridge's server) — drawn at once,
|
|
337
368
|
// whether or not the stream is up yet (a first send after opening the room must not vanish).
|
|
338
369
|
const { ok, ...bare } = r || {};
|
|
339
370
|
const sent = r && r.message ? r.message : ok && typeof bare.id === "string" && typeof bare.roomId === "string" ? bare : null;
|
|
340
|
-
|
|
371
|
+
// The stream's copy, when it came first, is at least as new as the send's answer (its stage may already be ✓).
|
|
372
|
+
if (ok && sent && !st.messages.some((m) => m.id === sent.id)) upsert(sent);
|
|
373
|
+
if (draws || (ok && sent)) changed();
|
|
341
374
|
return r;
|
|
342
375
|
},
|
|
343
376
|
older, findQuoted,
|
|
@@ -567,18 +600,19 @@ export function HubRoomPage({ roomId, listed = null, Thread, client, meId = "",
|
|
|
567
600
|
// read when the thread draws (the thread keeps its options from its first render, before the room's members are known).
|
|
568
601
|
const labels = () => [hroom("mentionAll"), hroom("mentionAssistant"), ...(store.detail()?.members || []).filter((m) => m.kind !== "assistant").map((m) => `@${m.name}`)];
|
|
569
602
|
const extra = {
|
|
570
|
-
|
|
603
|
+
// M-3951: a message still being sent (no Hub id yet) cannot be replied to, reacted to or pinned.
|
|
604
|
+
isUser: (x) => x.mine === true, canReply: (x) => !store.closed() && !x?.pending,
|
|
571
605
|
// M-3565: an agent's name opens its member card (its "@ it here", "Chat with it one-to-one"); its source in the card.
|
|
572
606
|
senderBadge: (el, msg) => mountSourceAuthor(el, msg, (id) => focusMember(id)),
|
|
573
607
|
mentionLabels: labels,
|
|
574
608
|
// A line's one action: 「展開其餘 N 則」, or 「請房間助理整理」 (spec §10: the same as sending 「@房間助理 整理上面的回答」).
|
|
575
609
|
statusAction: (arg) => { if (String(arg).startsWith("summarise:")) { if (!store.closed()) void store.send(hroom("summarisePrompt"), { mentions: ["assistant"] }); } else store.expand(arg); },
|
|
576
|
-
startReply: (x) => { setReply(x); setTimeout(() => input.current?.focus(), 0); },
|
|
610
|
+
startReply: (x) => { if (x?.pending) return; setReply(x); setTimeout(() => input.current?.focus(), 0); },
|
|
577
611
|
findQuoted: (key) => store.findQuoted(key),
|
|
578
612
|
// M-3127: people's reactions — a group room's messages (not a room line), while the room is open to me. Read when the
|
|
579
613
|
// thread draws: these options are kept from the first render, before the room's kind is known.
|
|
580
614
|
react: (x, emoji, on) => { void store.react(x.roomMessage, emoji, on).then((r) => { if (!r?.ok && r?.code !== "closed") toast(hroom("reactFailed"), false); }); },
|
|
581
|
-
canReact: () => store.detail()?.room?.kind === "group" && !store.closed(),
|
|
615
|
+
canReact: (x) => store.detail()?.room?.kind === "group" && !store.closed() && !x?.pending,
|
|
582
616
|
reactText: (k) => (k === "add" ? hroom("reactAdd") : k === "pick" ? hroom("reactPick") : ""),
|
|
583
617
|
reactLabel: hroom("reactAdd"), // the message menu's React (web-claude's HubThread, M-3117 PR 2: phones)
|
|
584
618
|
// M-3125 PR3: a room picture opens full size in the page; 「標註」 then quotes the marked-up copy here — it joins this
|
|
@@ -592,7 +626,7 @@ export function HubRoomPage({ roomId, listed = null, Thread, client, meId = "",
|
|
|
592
626
|
// M-3340: the Fleet chat's Pin / Unpin — mine only (read when the menu opens: the pins arrive after the first render).
|
|
593
627
|
pin: (x) => { void togglePin(x.roomMessage); },
|
|
594
628
|
pinned: (x) => store.isPinned(x.roomMessage),
|
|
595
|
-
canPin: (x) => store.pinsOffered() && !!x.roomMessage && x.role !== "status",
|
|
629
|
+
canPin: (x) => store.pinsOffered() && !!x.roomMessage && !x.pending && x.role !== "status",
|
|
596
630
|
};
|
|
597
631
|
// M-3340: pin or unpin a message for me; said in a toast either way (as the Fleet chat says it).
|
|
598
632
|
async function togglePin(messageId) {
|
package/dist/ui/panel-chat.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { focusComposerStrip } from "/assets/composer-focus.js";
|
|
2
2
|
import { previewReplyFile, replyPreviewLabel } from "./reply-file-preview.js";
|
|
3
3
|
import { NativePaneRecovery } from "./native-pane-recovery.js";
|
|
4
|
+
import { applyColumns, ClearColumns, ColumnMenu, columnsActive, columnsLabel, loadColumns, NO_COLUMNS, saveColumns } from "./report-columns.js";
|
|
4
5
|
import { GeneralLocation } from "./general-location.js";
|
|
5
6
|
// #1408 step 1: the chat panel. Behind the session gate (/ui/js/), loaded by the app with a dynamic import in "full"
|
|
6
7
|
// mode only. boot() runs once per page (the chat store must hear the stream from the first frame); <ChatPanel> mounts
|
|
@@ -1060,20 +1061,32 @@ function CommandReport({ report, command }) {
|
|
|
1060
1061
|
wasExpanded.current = expanded;
|
|
1061
1062
|
}, [expanded]);
|
|
1062
1063
|
const query = filter.trim().toLocaleLowerCase();
|
|
1063
|
-
|
|
1064
|
+
// M-3943: the status report's columns sort and filter like a spreadsheet's (report-columns.js), kept per browser.
|
|
1065
|
+
const status = command === "status";
|
|
1066
|
+
const [columns, setColumnsState] = useState(() => status ? loadColumns(command, report.columns.length) : NO_COLUMNS);
|
|
1067
|
+
const setColumns = (next) => { setColumnsState(next); saveColumns(command, report.columns.length, next); };
|
|
1068
|
+
const arranged = status && columnsActive(report.rows, columns);
|
|
1069
|
+
const matched = status && query
|
|
1064
1070
|
? report.rows.filter(row => row.some(value => value.toLocaleLowerCase().includes(query))) : report.rows;
|
|
1071
|
+
const rows = status ? applyColumns(matched, columns) : matched;
|
|
1072
|
+
const narrowed = !!query || rows.length !== report.rows.length;
|
|
1073
|
+
const colMenu = (label, i, triggerClass) => html`<${ColumnMenu} label=${label} col=${i} rows=${report.rows} state=${columns} onChange=${setColumns} triggerClass=${triggerClass} />`;
|
|
1074
|
+
const ariaSort = (i) => columns.sort?.col === i ? (columns.sort.dir === "asc" ? "ascending" : "descending") : undefined;
|
|
1065
1075
|
const view = html`<section class=${`cmd-report cmd-report-${command}${expanded ? " cmd-report-expanded" : ""}`} aria-label=${report.title}>
|
|
1066
1076
|
${expanded ? null : html`<h3>${report.title}</h3>`}
|
|
1067
1077
|
<div class="cmd-report-tools">
|
|
1068
|
-
${
|
|
1078
|
+
${status ? html`<label class="field"><span class="sr-only">${t("chat.cmdReportFilter")}</span>
|
|
1069
1079
|
<input type="search" aria-label=${t("chat.cmdReportFilter")} placeholder=${t("chat.cmdReportFilter")}
|
|
1070
1080
|
value=${filter} onInput=${e => setFilter(e.target.value)} /></label>` : null}
|
|
1081
|
+
${arranged ? html`<${ClearColumns} onClear=${() => setColumns(NO_COLUMNS)} />` : null}
|
|
1071
1082
|
${expanded ? null : html`<button type="button" class="btn btn-sm btn-ghost" ref=${trigger} data-report-expand onClick=${() => setExpanded(true)}>${t("chat.cmdReportOpen")}</button>`}
|
|
1072
1083
|
</div>
|
|
1073
|
-
${
|
|
1084
|
+
${status ? html`<div class="report-col-bar" role="group" aria-label=${columnsLabel()}>${report.columns.map((label, i) => colMenu(label, i, "btn btn-sm btn-ghost report-col-chip"))}</div>` : null}
|
|
1085
|
+
${status ? html`<p class="note cmd-report-count">${narrowed ? t("chat.cmdReportMatches", rows.length, report.rows.length) : t("chat.cmdReportCount", report.rows.length)}${report.notes[0] ? " · " + report.notes[0] : ""}</p>` : null}
|
|
1074
1086
|
<div class="cmd-report-body" tabIndex="0" aria-label=${report.title}>
|
|
1075
|
-
${rows.length ? html`<table class=${
|
|
1076
|
-
|
|
1087
|
+
${rows.length ? html`<table class=${status ? "us-table" : "cmd-metrics"}><thead><tr>${report.columns.map((label, i) => status
|
|
1088
|
+
? html`<th scope="col" aria-sort=${ariaSort(i)}>${colMenu(label, i)}</th>` : html`<th scope="col">${label}</th>`)}</tr></thead>
|
|
1089
|
+
<tbody>${rows.map(row => html`<tr>${row.map((value, i) => html`<td data-label=${report.columns[i]}>${value}</td>`)}</tr>`)}</tbody></table>` : narrowed ? html`<p class="note">${t("chat.cmdReportEmpty")}</p>` : null}
|
|
1077
1090
|
${(command === "status" ? report.notes.slice(1) : report.notes).map(note => html`<p class="note">${note}</p>`)}
|
|
1078
1091
|
</div>
|
|
1079
1092
|
</section>`;
|
package/dist/ui/panel-hub.js
CHANGED
|
@@ -774,14 +774,14 @@ function HubRoomLoading({ error } = {}) {
|
|
|
774
774
|
/** The thread's words are the fleet chat's; its delivery marks say the Hub's stages. */
|
|
775
775
|
const threadT = (key, ...a) => (key.startsWith("chat.tick_") ? hc(key.slice(5), ...a) : t(key, ...a));
|
|
776
776
|
const REASONS = { "share-needs-reshare": "reason_reshare", expired: "reason_expired", revoked: "reason_revoked", frozen: "reason_frozen", withdrawn: "reason_withdrawn" };
|
|
777
|
-
const reasonText = (code, stage) => (stage === "uncertain" ? hc("uncertain") : hc("notAnswered", hc(REASONS[code] || "reason_unknown")));
|
|
777
|
+
const reasonText = (code, stage, agent) => (code==="finished-without-answer"?hc("finishedNoReply",agent||""):stage === "uncertain" ? hc("uncertain") : hc("notAnswered", hc(REASONS[code] || "reason_unknown")));
|
|
778
778
|
async function copyText(text) { try { await navigator.clipboard.writeText(text); return true; } catch { return false; } }
|
|
779
779
|
|
|
780
780
|
/** One room: its header, the thread, what blocks asking, the working line and the composer; the panel beside it. */
|
|
781
781
|
function HubRoomView({ room: given }) {
|
|
782
782
|
const s = useSession();
|
|
783
783
|
const wide = useWide();
|
|
784
|
-
const store = useMemo(() => createHubChatStore(given, { me: (s && s.displayName) || "", reason: reasonText }), [given.id]);
|
|
784
|
+
const store = useMemo(() => createHubChatStore(given, { me: (s && s.displayName) || "", reason: reasonText, progress: agent=>hc("deliveredNextTurn",agent) }), [given.id]);
|
|
785
785
|
useEffect(() => () => store.stop(), [store]);
|
|
786
786
|
const [, tick] = useState(0);
|
|
787
787
|
useEffect(() => {
|
|
@@ -989,7 +989,7 @@ function HubThread({ store, name, panelKey, threadRef, extra = null, emptyView =
|
|
|
989
989
|
const ex = extra || {};
|
|
990
990
|
const offActions = installMessageActions(list, {
|
|
991
991
|
t: threadT, messageOf: thread.messageOf, rove: thread.rove, copyText, notice: (text, ok = true) => toast(text, ok),
|
|
992
|
-
canReply: () => (typeof ex.canReply === "function" ? ex.canReply() !== false : false) && typeof ex.startReply === "function",
|
|
992
|
+
canReply: (x) => (typeof ex.canReply === "function" ? ex.canReply(x) !== false : false) && typeof ex.startReply === "function",
|
|
993
993
|
reply: (x) => ex.startReply?.(x),
|
|
994
994
|
// React opens the thread's picker for that message (extra.react is the thread's own add/remove call, with an emoji).
|
|
995
995
|
...(typeof ex.react === "function" ? { react: (x) => thread.pickReaction?.(msgKey(x)), canReact: (x) => !!x.roomMessage && ex.canReact?.(x) !== false, reactLabel: ex.reactLabel } : {}),
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
// M-3943: Excel-style column menus for the web status report. Each column sorts A → Z or Z → A and shows or hides its
|
|
2
|
+
// values with checkboxes; the choice is this browser's own (localStorage), so it survives a reload. Pure helpers first
|
|
3
|
+
// (sorting and filtering are tested without a page), then the menu.
|
|
4
|
+
import { html } from "/assets/app-html.js";
|
|
5
|
+
import { Menu } from "/assets/ui-menu.js";
|
|
6
|
+
import { Icon } from "/assets/ui-icons.js";
|
|
7
|
+
import { lang, register, t } from "/assets/app-i18n.js";
|
|
8
|
+
|
|
9
|
+
register("reportCols", {
|
|
10
|
+
en: { menu: "Sort and filter: {0}", asc: "Sort A to Z", desc: "Sort Z to A", show: "Filter by value", all: "Select all",
|
|
11
|
+
blank: "(Blank)", clear: "Clear filter", clearAll: "Clear sort and filters", columns: "Sort and filter" },
|
|
12
|
+
"zh-TW": { menu: "排序與篩選:{0}", asc: "從 A 到 Z 排序", desc: "從 Z 到 A 排序", show: "依值篩選", all: "全選",
|
|
13
|
+
blank: "(空白)", clear: "清除篩選", clearAll: "清除排序與篩選", columns: "排序與篩選" },
|
|
14
|
+
});
|
|
15
|
+
const rc = (key, ...args) => t(`reportCols.${key}`, ...args);
|
|
16
|
+
|
|
17
|
+
/** Cells that mean "nothing here": sorted last in both directions (as Excel does) and listed as (Blank). */
|
|
18
|
+
const BLANK = new Set(["", "-", "—"]);
|
|
19
|
+
export const isBlank = (value) => BLANK.has(String(value ?? "").trim());
|
|
20
|
+
/**
|
|
21
|
+
* The order text sorts in. Latin (and digits, symbols) before CJK in every language, as a spreadsheet does, so the same
|
|
22
|
+
* report sorts the same whatever the dashboard's language; Z to A is the exact reverse. Within each group, the
|
|
23
|
+
* dashboard's own language orders (not the browser's): zh-TW orders its characters its own way.
|
|
24
|
+
*/
|
|
25
|
+
const CJK = /^[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Bopomofo}]/u;
|
|
26
|
+
const collators = new Map();
|
|
27
|
+
function collator() {
|
|
28
|
+
const language = lang() || "en";
|
|
29
|
+
if (!collators.has(language)) collators.set(language, new Intl.Collator(language, { numeric: true, sensitivity: "base" }));
|
|
30
|
+
return collators.get(language);
|
|
31
|
+
}
|
|
32
|
+
export function compareText(a, b) {
|
|
33
|
+
const x = String(a ?? "").trim(), y = String(b ?? "").trim();
|
|
34
|
+
return (Number(CJK.test(x)) - Number(CJK.test(y))) || collator().compare(x, y);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/** The empty choice: no sort, nothing hidden. `hidden` maps a column index to the values it hides. */
|
|
38
|
+
export const NO_COLUMNS = Object.freeze({ sort: null, hidden: {} });
|
|
39
|
+
|
|
40
|
+
/** The rows a choice shows, in its order. A value no row has any more hides nothing; new values are shown. */
|
|
41
|
+
export function applyColumns(rows, state) {
|
|
42
|
+
const hidden = Object.entries(state?.hidden || {}).filter(([, values]) => values?.length);
|
|
43
|
+
let out = hidden.length ? rows.filter(row => hidden.every(([col, values]) => !values.includes(row[+col]))) : rows;
|
|
44
|
+
const sort = state?.sort;
|
|
45
|
+
if (sort && Number.isInteger(sort.col)) {
|
|
46
|
+
const dir = sort.dir === "desc" ? -1 : 1;
|
|
47
|
+
out = out.map((row, i) => [row, i]).sort(([a, i], [b, j]) => {
|
|
48
|
+
const ea = isBlank(a[sort.col]), eb = isBlank(b[sort.col]);
|
|
49
|
+
if (ea !== eb) return ea ? 1 : -1;
|
|
50
|
+
return dir * compareText(a[sort.col], b[sort.col]) || i - j;
|
|
51
|
+
}).map(([row]) => row);
|
|
52
|
+
}
|
|
53
|
+
return out;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/** A column's distinct values, in A → Z order with blanks last: the checkboxes of its menu. */
|
|
57
|
+
export function columnValues(rows, col) {
|
|
58
|
+
return [...new Set(rows.map(row => row[col] ?? ""))].sort((a, b) => (isBlank(a) - isBlank(b)) || compareText(a, b));
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/** Whether a column hides anything the rows still have (a remembered value that is gone does not count). */
|
|
62
|
+
export function columnFiltered(rows, state, col) {
|
|
63
|
+
const values = state?.hidden?.[col];
|
|
64
|
+
return !!values?.length && rows.some(row => values.includes(row[col]));
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/** Whether a choice changes anything for these rows: a sort, or a filter that hides a row. */
|
|
68
|
+
export const columnsActive = (rows, state) => !!state?.sort || rows.some(row => Object.entries(state?.hidden || {}).some(([col, values]) => values?.includes(row[+col])));
|
|
69
|
+
|
|
70
|
+
/** Toggle one value of a column; `all` shows every value when any is hidden, else hides them all. */
|
|
71
|
+
export function toggleValue(state, col, value, values) {
|
|
72
|
+
const hidden = new Set(state.hidden?.[col] || []);
|
|
73
|
+
if (value === undefined) {
|
|
74
|
+
const anyHidden = values.some(v => hidden.has(v));
|
|
75
|
+
return withHidden(state, col, anyHidden ? [] : values);
|
|
76
|
+
}
|
|
77
|
+
if (hidden.has(value)) hidden.delete(value); else hidden.add(value);
|
|
78
|
+
return withHidden(state, col, [...hidden]);
|
|
79
|
+
}
|
|
80
|
+
function withHidden(state, col, values) {
|
|
81
|
+
const hidden = { ...(state.hidden || {}) };
|
|
82
|
+
if (values.length) hidden[col] = values; else delete hidden[col];
|
|
83
|
+
return { ...state, hidden };
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* This browser's choice for a report, kept per command. It is tied to the report's column count: a report whose columns
|
|
88
|
+
* changed starts clean rather than sorting or hiding the wrong column. Storage can be missing or refuse (a private
|
|
89
|
+
* window): the menus still work, they just aren't kept.
|
|
90
|
+
*/
|
|
91
|
+
const storageKey = (command) => `agend.reportColumns.${command}`;
|
|
92
|
+
export function loadColumns(command, columnCount) {
|
|
93
|
+
try {
|
|
94
|
+
const saved = JSON.parse(globalThis.localStorage?.getItem(storageKey(command)) || "null");
|
|
95
|
+
if (!saved || saved.columns !== columnCount) return NO_COLUMNS;
|
|
96
|
+
const sort = saved.sort && Number.isInteger(saved.sort.col) && saved.sort.col < columnCount && (saved.sort.dir === "asc" || saved.sort.dir === "desc")
|
|
97
|
+
? { col: saved.sort.col, dir: saved.sort.dir } : null;
|
|
98
|
+
const hidden = {};
|
|
99
|
+
for (const [col, values] of Object.entries(saved.hidden || {})) {
|
|
100
|
+
if (+col >= 0 && +col < columnCount && Array.isArray(values)) hidden[col] = values.filter(v => typeof v === "string");
|
|
101
|
+
}
|
|
102
|
+
return { sort, hidden };
|
|
103
|
+
} catch { return NO_COLUMNS; }
|
|
104
|
+
}
|
|
105
|
+
export function saveColumns(command, columnCount, state) {
|
|
106
|
+
try {
|
|
107
|
+
if (!state.sort && !Object.keys(state.hidden || {}).length) globalThis.localStorage?.removeItem(storageKey(command));
|
|
108
|
+
else globalThis.localStorage?.setItem(storageKey(command), JSON.stringify({ columns: columnCount, sort: state.sort, hidden: state.hidden }));
|
|
109
|
+
} catch { /* not kept: the choice still applies on this page */ }
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/** One column's menu: the two sorts, then a checkbox per value with Select all, then Clear filter. */
|
|
113
|
+
export function ColumnMenu({ label, col, rows, state, onChange, trigger, triggerClass }) {
|
|
114
|
+
const values = columnValues(rows, col);
|
|
115
|
+
const hidden = new Set(state.hidden?.[col] || []);
|
|
116
|
+
const sorted = state.sort?.col === col ? state.sort.dir : null;
|
|
117
|
+
const filtered = columnFiltered(rows, state, col);
|
|
118
|
+
const items = [
|
|
119
|
+
{ key: "asc", label: rc("asc"), checked: sorted === "asc", onSelect: () => onChange({ ...state, sort: sorted === "asc" ? null : { col, dir: "asc" } }) },
|
|
120
|
+
{ key: "desc", label: rc("desc"), checked: sorted === "desc", onSelect: () => onChange({ ...state, sort: sorted === "desc" ? null : { col, dir: "desc" } }) },
|
|
121
|
+
{ key: "show", heading: true, label: rc("show") },
|
|
122
|
+
{ key: "all", checkbox: true, label: rc("all"), checked: !values.some(v => hidden.has(v)), onSelect: () => onChange(toggleValue(state, col, undefined, values)) },
|
|
123
|
+
...values.map(value => ({ key: `v:${value}`, checkbox: true, title: value, label: isBlank(value) ? `${value || ""} ${rc("blank")}`.trim() : value,
|
|
124
|
+
checked: !hidden.has(value), onSelect: () => onChange(toggleValue(state, col, value, values)) })),
|
|
125
|
+
{ key: "clear", label: rc("clear"), disabled: !filtered, onSelect: () => onChange(withHidden(state, col, [])) },
|
|
126
|
+
];
|
|
127
|
+
// Marks drawn as icons (a text arrow or funnel can be missing from the page's font): the sort's direction, a filter.
|
|
128
|
+
return html`<${Menu} items=${items} label=${rc("menu", label)} cls="agent-menu report-col-menu" fit topLayer active=${filtered || !!sorted}
|
|
129
|
+
triggerClass=${`${triggerClass || "report-col-btn"}${filtered ? " report-col-filtered" : ""}`}
|
|
130
|
+
trigger=${trigger ?? html`<span class="report-col-label">${label}</span><span class="report-col-mark" aria-hidden="true">${sorted ? html`<${Icon} name=${sorted === "asc" ? "up" : "down"} size=${14} />` : null}${filtered ? html`<${Icon} name="sliders" size=${14} />` : sorted ? null : html`<${Icon} name="chevron" size=${14} />`}</span>`} />`;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/** The tools-row button that puts a report back to its own order with every row shown. */
|
|
134
|
+
export function ClearColumns({ onClear }) {
|
|
135
|
+
return html`<button type="button" class="btn btn-sm btn-ghost" data-report-clear onClick=${onClear}>${rc("clearAll")}</button>`;
|
|
136
|
+
}
|
|
137
|
+
export const columnsLabel = () => rc("columns");
|
package/dist/ui/shared/app.css
CHANGED
|
@@ -3247,13 +3247,35 @@ html.oo-immersive .p-fleet > .panel-body { z-index: 50; }
|
|
|
3247
3247
|
.cmd-report-expanded .cmd-report-body { flex: 1; min-height: 0; max-height: none; overflow-y: auto; }
|
|
3248
3248
|
.cmd-report-tools { display: flex; align-items: center; flex-wrap: wrap; gap: var(--s-2); margin-bottom: var(--s-2); }
|
|
3249
3249
|
.cmd-report-tools .field { flex: 1; min-width: 0; }
|
|
3250
|
-
.cmd-report-status .us-table th:first-child { width:
|
|
3251
|
-
|
|
3250
|
+
.cmd-report-status .us-table th:first-child { width: 24%; }
|
|
3251
|
+
/* M-3943: Profile (3rd) beside Backend; Model (4th) keeps the room it had. */
|
|
3252
|
+
.cmd-report-status .us-table th:nth-child(3) { width: 12%; }
|
|
3253
|
+
.cmd-report-status .us-table th:nth-child(4) { width: 18%; }
|
|
3252
3254
|
.cmd-report h3 { margin: 0 0 var(--s-2); font-size: var(--fs-sm); }
|
|
3253
3255
|
.cmd-report .note { overflow-wrap: anywhere; white-space: pre-wrap; }
|
|
3254
3256
|
.cmd-report table { table-layout: fixed; width: 100%; border-collapse: collapse; }
|
|
3255
3257
|
.cmd-report td, .cmd-report th { overflow-wrap: anywhere; }
|
|
3256
3258
|
.cmd-metrics td, .cmd-metrics th { padding: var(--s-2); text-align: left; vertical-align: top; border-bottom: 1px solid var(--border); }
|
|
3259
|
+
/* M-3943: each status column's sort and filter menu — the header itself on a desk, a row of buttons on a phone. */
|
|
3260
|
+
.report-col-menu { display: block; }
|
|
3261
|
+
.report-col-btn { display: flex; align-items: center; gap: var(--s-1); width: 100%; padding: 0; border: 0; background: none; color: inherit;
|
|
3262
|
+
font: inherit; font-weight: inherit; text-align: left; cursor: pointer; border-radius: var(--r-sm); }
|
|
3263
|
+
.report-col-btn:hover, .report-col-btn:focus-visible { color: var(--accent); }
|
|
3264
|
+
.report-col-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
|
|
3265
|
+
.report-col-label { flex: 1; min-width: 0; overflow-wrap: anywhere; }
|
|
3266
|
+
.report-col-mark { flex: none; display: inline-flex; align-items: center; gap: 2px; color: var(--text-3); }
|
|
3267
|
+
.report-col-mark .icon { display: block; }
|
|
3268
|
+
/* Value checkboxes read as boxes, ticked or not (the shared menu draws only the tick). */
|
|
3269
|
+
.report-col-menu [role=menuitemcheckbox] .menu-tick { width: 16px; height: 16px; box-sizing: border-box; justify-content: center; align-items: center;
|
|
3270
|
+
border: 1.5px solid var(--text-3); border-radius: 3px; }
|
|
3271
|
+
.report-col-menu [role=menuitemcheckbox][aria-checked=true] .menu-tick { border-color: var(--accent); }
|
|
3272
|
+
.report-col-menu [role=menuitemcheckbox] .menu-tick .icon { width: 12px; height: 12px; }
|
|
3273
|
+
/* A long list ends with room below its last item (Clear filter), not flush against the edge. */
|
|
3274
|
+
.report-col-menu > .menu-list { padding-bottom: var(--s-3); }
|
|
3275
|
+
.report-col-btn.active .report-col-mark, .report-col-chip.active, .report-col-chip.active .report-col-mark { color: var(--accent); }
|
|
3276
|
+
/* Open is not filtered: an open menu's button gets a plain fill; only a sort or filter turns a column the accent colour. */
|
|
3277
|
+
.cmd-report .report-col-btn[aria-expanded=true], .cmd-report .report-col-chip[aria-expanded=true] { background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--border); }
|
|
3278
|
+
.report-col-bar { display: none; }
|
|
3257
3279
|
@media (max-width: 899px), (pointer: coarse) and (max-height: 500px) and (max-width: 1023px) {
|
|
3258
3280
|
.cmd-report-body { max-height: 25vh; }
|
|
3259
3281
|
.cmd-report-tools input, .cmd-report-tools .btn { min-height: var(--tap); }
|
|
@@ -3264,6 +3286,10 @@ html.oo-immersive .p-fleet > .panel-body { z-index: 50; }
|
|
|
3264
3286
|
.cmd-report-status .us-table tr { margin-bottom: var(--s-3); padding: var(--s-2); border-bottom: 1px solid var(--border); }
|
|
3265
3287
|
.cmd-report-status .us-table td { display: flex; justify-content: space-between; gap: var(--s-3); border: 0; }
|
|
3266
3288
|
.cmd-report-status .us-table td::before { content: attr(data-label); color: var(--text-3); flex-shrink: 0; }
|
|
3289
|
+
.report-col-bar { display: flex; flex-wrap: wrap; gap: var(--s-1); margin-bottom: var(--s-2); }
|
|
3290
|
+
.cmd-report-status .cmd-report-tools .field { flex-basis: 100%; }
|
|
3291
|
+
.report-col-chip { min-height: var(--tap); }
|
|
3292
|
+
.report-col-chip .report-col-label { overflow-wrap: normal; }
|
|
3267
3293
|
|
|
3268
3294
|
}
|
|
3269
3295
|
.cmd-text { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font-family: var(--font-ui); color: var(--text-2); }
|
|
@@ -100,7 +100,7 @@ export function installMessageActions(list, deps) {
|
|
|
100
100
|
function openMenu(row, x, y) {
|
|
101
101
|
closeMenu();
|
|
102
102
|
const items = [];
|
|
103
|
-
if (deps.canReply?.() !== false) items.push(["reply", deps.t("chat.reply"), () => deps.reply(row)]);
|
|
103
|
+
if (deps.canReply?.(row) !== false) items.push(["reply", deps.t("chat.reply"), () => deps.reply(row)]);
|
|
104
104
|
if (typeof deps.pin === "function" && deps.canPin?.(row) !== false) {
|
|
105
105
|
const on = deps.pinned?.(row) === true;
|
|
106
106
|
items.push([on ? "unpin" : "pin", deps.t(on ? "chat.unpin" : "chat.pin"), () => deps.pin(row)]);
|
|
@@ -212,7 +212,7 @@ export function createThread(list, scroller, opts) {
|
|
|
212
212
|
// M-3127: a Hub room (opts.react, a message of the room) also offers Add reaction in the same strip; the Fleet passes none.
|
|
213
213
|
const reactable = typeof opts.react === "function" && x.roomMessage && opts.canReact?.(x) !== false;
|
|
214
214
|
const addReact = reactable ? `<button type="button" class="chip-btn icon-only" data-act="reactPick" data-arg="${escAttr(key)}" aria-haspopup="true" aria-expanded="false" title="${escAttr(reactText("add"))}" aria-label="${escAttr(reactText("add"))}">${REACT}</button>` : "";
|
|
215
|
-
const act = opts.canReply?.() === false ? (addReact ? `<div data-trust="thread-control" class="msg-actions">${addReact}</div>` : "") : `<div data-trust="thread-control" class="msg-actions">${addReact}<button type="button" class="chip-btn icon-only" data-act="reply" data-arg="${escAttr(key)}" title="${escAttr(tr("chat.reply"))}" aria-label="${escAttr(tr("chat.reply"))}">${REPLY}</button></div>`;
|
|
215
|
+
const act = opts.canReply?.(x) === false ? (addReact ? `<div data-trust="thread-control" class="msg-actions">${addReact}</div>` : "") : `<div data-trust="thread-control" class="msg-actions">${addReact}<button type="button" class="chip-btn icon-only" data-act="reply" data-arg="${escAttr(key)}" title="${escAttr(tr("chat.reply"))}" aria-label="${escAttr(tr("chat.reply"))}">${REPLY}</button></div>`;
|
|
216
216
|
// A Hub sender's stateless badge is mounted as DOM below. Its escaped descriptor participates in keyed updates;
|
|
217
217
|
// Fleet callers supply no senderBadge hook and retain their existing sender markup.
|
|
218
218
|
const badge = opts.senderBadge && x.sourceBadge ? ` data-source-badge="${escAttr(JSON.stringify(x.sourceBadge))}"` : "";
|
|
@@ -68,6 +68,18 @@
|
|
|
68
68
|
.hub-join-groups .hub-row-text, .hub-group-hits .hub-row-text { flex: 1 1 12em; min-width: 0; }
|
|
69
69
|
.hub-join-fleets { flex-direction: row; align-items: center; gap: var(--s-2); margin: 0; }
|
|
70
70
|
.hub-join-fleets input { width: 4.5em; }
|
|
71
|
+
/* M-3957: the subject (a long AD distinguished name) takes the row's first line and wraps; its controls share the line below,
|
|
72
|
+
on one centre line, Remove at its end. Before, the DN squeezed beside the controls and a phone clipped its last part. */
|
|
73
|
+
.hub-join-groups > .s-row > .hub-row-text { flex: 1 1 100%; }
|
|
74
|
+
.hub-join-groups .hub-group-dn { font-size: var(--fs-sm); white-space: normal; overflow-wrap: anywhere; }
|
|
75
|
+
.hub-join-groups .check { display: inline-flex; align-items: center; gap: var(--s-1); margin: 0; }
|
|
76
|
+
.hub-join-groups > .s-row > .btn { margin-inline-start: auto; }
|
|
77
|
+
/* M-3957: the room assistant's daily answers — a compact two-column table, numbers right-aligned under their heading. */
|
|
78
|
+
.hub-assistant-usage table { width: auto; align-self: flex-start; border-collapse: collapse; font-size: var(--fs-sm); min-width: 12rem; margin-top: var(--s-2); }
|
|
79
|
+
.hub-assistant-usage th { text-align: left; font-weight: normal; color: var(--text-2); padding: var(--s-1) var(--s-5) var(--s-1) 0; border-bottom: 1px solid var(--border); }
|
|
80
|
+
.hub-assistant-usage td { padding: var(--s-1) var(--s-5) var(--s-1) 0; border-bottom: 1px solid var(--border); }
|
|
81
|
+
.hub-assistant-usage tr:last-child td { border-bottom: 0; }
|
|
82
|
+
.hub-assistant-usage .n { text-align: right; font-variant-numeric: tabular-nums; padding-right: 0; }
|
|
71
83
|
.hub-step-form { display: flex; gap: var(--s-2); align-items: center; flex-wrap: wrap; width: 100%; }
|
|
72
84
|
.hub-step-form .field { margin: 0; flex: 1 1 14em; min-width: 14em; } /* a phone: the button wraps under the field, never squeezing it */
|
|
73
85
|
.hub-steps .hub-offer { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: start; margin: 0; padding: 0; }
|
package/package.json
CHANGED