@songsid/agend 2.4.0-beta.10 → 2.4.0-beta.12
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/accounts-view.d.ts +29 -0
- package/dist/accounts-view.js +2 -14
- package/dist/accounts-view.js.map +1 -1
- package/dist/agent-endpoint.d.ts +1 -0
- package/dist/agent-endpoint.js +4 -2
- package/dist/agent-endpoint.js.map +1 -1
- package/dist/auth-api.d.ts +2 -0
- package/dist/auth-api.js +29 -2
- package/dist/auth-api.js.map +1 -1
- package/dist/backend/claude-code.js +35 -9
- package/dist/backend/claude-code.js.map +1 -1
- package/dist/backend/codex-precaution.d.ts +7 -0
- package/dist/backend/codex-precaution.js +102 -0
- package/dist/backend/codex-precaution.js.map +1 -0
- package/dist/backend/codex.d.ts +1 -0
- package/dist/backend/codex.js +18 -0
- package/dist/backend/codex.js.map +1 -1
- package/dist/backend/grok.js +21 -6
- package/dist/backend/grok.js.map +1 -1
- package/dist/backend/types.d.ts +9 -1
- package/dist/backend/types.js.map +1 -1
- package/dist/build-provenance.json +1 -1
- package/dist/channel/mcp-server.js +1 -1
- package/dist/channel/mcp-server.js.map +1 -1
- package/dist/channel/mcp-tools.js +3 -1
- package/dist/channel/mcp-tools.js.map +1 -1
- package/dist/claude-install-kind.d.ts +19 -0
- package/dist/claude-install-kind.js +54 -0
- package/dist/claude-install-kind.js.map +1 -0
- package/dist/cli-audited.js +3 -3
- package/dist/cli-audited.js.map +1 -1
- package/dist/daemon.d.ts +5 -0
- package/dist/daemon.js +22 -4
- package/dist/daemon.js.map +1 -1
- package/dist/event-log.d.ts +12 -0
- package/dist/event-log.js +40 -0
- package/dist/event-log.js.map +1 -1
- package/dist/fleet-manager.d.ts +122 -2
- package/dist/fleet-manager.js +482 -27
- package/dist/fleet-manager.js.map +1 -1
- package/dist/general-knowledge/skills/hub/SKILL.md +38 -6
- package/dist/general-knowledge/skills/web-dashboard/SKILL.md +16 -1
- package/dist/hub/admin-dashboard.js +3 -3
- package/dist/hub/admin-dashboard.js.map +1 -1
- package/dist/hub/agent-catalog-model.d.ts +276 -0
- package/dist/hub/agent-catalog-model.js +49 -0
- package/dist/hub/agent-catalog-model.js.map +1 -0
- package/dist/hub/agent-catalog.d.ts +137 -0
- package/dist/hub/agent-catalog.js +118 -0
- package/dist/hub/agent-catalog.js.map +1 -0
- package/dist/hub/agent-intro-model.d.ts +38 -0
- package/dist/hub/agent-intro-model.js +14 -0
- package/dist/hub/agent-intro-model.js.map +1 -0
- package/dist/hub/agent-intro-tool.d.ts +35 -0
- package/dist/hub/agent-intro-tool.js +83 -0
- package/dist/hub/agent-intro-tool.js.map +1 -0
- package/dist/hub/agent-intro.d.ts +31 -0
- package/dist/hub/agent-intro.js +51 -0
- package/dist/hub/agent-intro.js.map +1 -0
- package/dist/hub/catalog.d.ts +4 -2
- package/dist/hub/catalog.js +19 -3
- package/dist/hub/catalog.js.map +1 -1
- package/dist/hub/client.d.ts +3 -0
- package/dist/hub/client.js +47 -1
- package/dist/hub/client.js.map +1 -1
- package/dist/hub/compose/member.d.ts +19 -5
- package/dist/hub/compose/member.js +94 -13
- package/dist/hub/compose/member.js.map +1 -1
- package/dist/hub/compose/server.d.ts +5 -0
- package/dist/hub/compose/server.js +6 -1
- package/dist/hub/compose/server.js.map +1 -1
- package/dist/hub/execution/service.d.ts +1 -1
- package/dist/hub/execution/service.js +1 -0
- package/dist/hub/execution/service.js.map +1 -1
- package/dist/hub/http/compose.d.ts +3 -0
- package/dist/hub/http/compose.js +122 -15
- package/dist/hub/http/compose.js.map +1 -1
- package/dist/hub/http/schema.js +15 -0
- package/dist/hub/http/schema.js.map +1 -1
- package/dist/hub/mcp/tools.js +2 -1
- package/dist/hub/mcp/tools.js.map +1 -1
- package/dist/hub/member/agent-catalog.d.ts +28 -0
- package/dist/hub/member/agent-catalog.js +80 -0
- package/dist/hub/member/agent-catalog.js.map +1 -0
- package/dist/hub/member/agent-intro.d.ts +28 -0
- package/dist/hub/member/agent-intro.js +66 -0
- package/dist/hub/member/agent-intro.js.map +1 -0
- package/dist/hub/member/exposure-api.d.ts +3 -3
- package/dist/hub/member/exposure-api.js +4 -4
- package/dist/hub/member/exposure-api.js.map +1 -1
- package/dist/hub/member/exposures.d.ts +12 -4
- package/dist/hub/member/exposures.js +27 -13
- package/dist/hub/member/exposures.js.map +1 -1
- package/dist/hub/member/room-ask.d.ts +14 -1
- package/dist/hub/member/room-ask.js +76 -10
- package/dist/hub/member/room-ask.js.map +1 -1
- package/dist/hub/member/room-context-budget.d.ts +5 -0
- package/dist/hub/member/room-context-budget.js +34 -0
- package/dist/hub/member/room-context-budget.js.map +1 -0
- package/dist/hub/member/room-notification.d.ts +1 -1
- package/dist/hub/member/room-post.d.ts +6 -3
- package/dist/hub/member/room-post.js +9 -3
- package/dist/hub/member/room-post.js.map +1 -1
- package/dist/hub/member/sharing-journal.d.ts +252 -0
- package/dist/hub/member/sharing-journal.js +212 -0
- package/dist/hub/member/sharing-journal.js.map +1 -0
- package/dist/hub/member/sharing-link.d.ts +25 -0
- package/dist/hub/member/sharing-link.js +68 -0
- package/dist/hub/member/sharing-link.js.map +1 -0
- package/dist/hub/member/sharing-result.d.ts +6 -0
- package/dist/hub/member/sharing-result.js +46 -0
- package/dist/hub/member/sharing-result.js.map +1 -0
- package/dist/hub/member/sharing.d.ts +37 -0
- package/dist/hub/member/sharing.js +181 -0
- package/dist/hub/member/sharing.js.map +1 -0
- package/dist/hub/personal/owner-host.d.ts +6 -0
- package/dist/hub/personal/owner-host.js +4 -2
- package/dist/hub/personal/owner-host.js.map +1 -1
- package/dist/hub/protocol.d.ts +398 -4
- package/dist/hub/protocol.js +13 -5
- package/dist/hub/protocol.js.map +1 -1
- package/dist/hub/room-answer-status-model.d.ts +3 -0
- package/dist/hub/room-answer-status-model.js +4 -0
- package/dist/hub/room-answer-status-model.js.map +1 -0
- package/dist/hub/room-brief-model.d.ts +30 -0
- package/dist/hub/room-brief-model.js +37 -0
- package/dist/hub/room-brief-model.js.map +1 -0
- package/dist/hub/room-context-model.d.ts +2 -0
- package/dist/hub/room-context-model.js +2 -2
- package/dist/hub/room-context-model.js.map +1 -1
- package/dist/hub/room-members-model.d.ts +63 -0
- package/dist/hub/room-members-model.js +7 -0
- package/dist/hub/room-members-model.js.map +1 -0
- package/dist/hub/rooms/agents.d.ts +1 -0
- package/dist/hub/rooms/agents.js +62 -11
- package/dist/hub/rooms/agents.js.map +1 -1
- package/dist/hub/rooms/brief.d.ts +18 -0
- package/dist/hub/rooms/brief.js +39 -0
- package/dist/hub/rooms/brief.js.map +1 -0
- package/dist/hub/rooms/direct-view.d.ts +5 -1
- package/dist/hub/rooms/direct-view.js +2 -2
- package/dist/hub/rooms/direct-view.js.map +1 -1
- package/dist/hub/rooms/members-page.d.ts +33 -0
- package/dist/hub/rooms/members-page.js +37 -0
- package/dist/hub/rooms/members-page.js.map +1 -0
- package/dist/hub/rooms/purpose.d.ts +7 -0
- package/dist/hub/rooms/purpose.js +14 -0
- package/dist/hub/rooms/purpose.js.map +1 -0
- package/dist/hub/rooms/service.d.ts +43 -0
- package/dist/hub/rooms/service.js +80 -22
- package/dist/hub/rooms/service.js.map +1 -1
- package/dist/hub/rooms/types.d.ts +6 -1
- package/dist/hub/rooms.d.ts +1 -0
- package/dist/hub/rooms.js +9 -4
- package/dist/hub/rooms.js.map +1 -1
- package/dist/hub/runtime.d.ts +1 -1
- package/dist/hub/server.js +49 -1
- package/dist/hub/server.js.map +1 -1
- package/dist/hub/sharing-previous-access.d.ts +22 -0
- package/dist/hub/sharing-previous-access.js +93 -0
- package/dist/hub/sharing-previous-access.js.map +1 -0
- package/dist/hub/sharing-requests.d.ts +171 -0
- package/dist/hub/sharing-requests.js +311 -0
- package/dist/hub/sharing-requests.js.map +1 -0
- package/dist/hub/sharing-retention.d.ts +47 -0
- package/dist/hub/sharing-retention.js +83 -0
- package/dist/hub/sharing-retention.js.map +1 -0
- package/dist/hub/sharing-withdrawal.d.ts +14 -0
- package/dist/hub/sharing-withdrawal.js +28 -0
- package/dist/hub/sharing-withdrawal.js.map +1 -0
- package/dist/hub/types.d.ts +13 -5
- package/dist/hub-page-sharing-settings.d.ts +6 -0
- package/dist/hub-page-sharing-settings.js +19 -0
- package/dist/hub-page-sharing-settings.js.map +1 -0
- package/dist/hub-room-reply-warning.d.ts +2 -0
- package/dist/hub-room-reply-warning.js +16 -0
- package/dist/hub-room-reply-warning.js.map +1 -0
- package/dist/hub-sharing-notice.d.ts +43 -0
- package/dist/hub-sharing-notice.js +34 -0
- package/dist/hub-sharing-notice.js.map +1 -0
- package/dist/instance-lifecycle.d.ts +15 -0
- package/dist/instance-lifecycle.js +36 -1
- package/dist/instance-lifecycle.js.map +1 -1
- package/dist/locale.js +78 -0
- package/dist/locale.js.map +1 -1
- package/dist/login-controller.d.ts +26 -0
- package/dist/login-controller.js +72 -2
- package/dist/login-controller.js.map +1 -1
- package/dist/login-flows.js +1 -1
- package/dist/login-flows.js.map +1 -1
- package/dist/native-mcp.js +1 -1
- package/dist/native-mcp.js.map +1 -1
- package/dist/needs-you-hub.js +1 -1
- package/dist/needs-you-hub.js.map +1 -1
- package/dist/needs-you.d.ts +8 -1
- package/dist/needs-you.js +6 -0
- package/dist/needs-you.js.map +1 -1
- package/dist/office-share-page.js +1 -1
- package/dist/office-share-page.js.map +1 -1
- package/dist/outbound-handlers.d.ts +2 -1
- package/dist/outbound-handlers.js +17 -4
- package/dist/outbound-handlers.js.map +1 -1
- package/dist/outbound-schemas.d.ts +10 -0
- package/dist/outbound-schemas.js +3 -1
- package/dist/outbound-schemas.js.map +1 -1
- package/dist/public-web-gateway.js +9 -3
- package/dist/public-web-gateway.js.map +1 -1
- package/dist/remote-card-answer.d.ts +1 -1
- package/dist/remote-card-answer.js +8 -1
- package/dist/remote-card-answer.js.map +1 -1
- package/dist/remote-card-prompt.js +1 -1
- package/dist/remote-card-prompt.js.map +1 -1
- package/dist/restart-progress.d.ts +6 -0
- package/dist/restart-progress.js +5 -0
- package/dist/restart-progress.js.map +1 -1
- package/dist/settings-api.d.ts +1 -0
- package/dist/settings-api.js +84 -10
- package/dist/settings-api.js.map +1 -1
- package/dist/settings-baseline.d.ts +3 -0
- package/dist/settings-baseline.js +2 -2
- package/dist/settings-baseline.js.map +1 -1
- package/dist/settings-change.js +1 -0
- package/dist/settings-change.js.map +1 -1
- package/dist/settings-effect.d.ts +3 -0
- package/dist/settings-effect.js +33 -2
- package/dist/settings-effect.js.map +1 -1
- package/dist/tool-permissions.js +3 -3
- package/dist/tool-permissions.js.map +1 -1
- package/dist/ui/chat-quote.js +3 -261
- package/dist/ui/fleet-office-card.js +8 -4
- package/dist/ui/fleet-office-pack.d.ts +1 -0
- package/dist/ui/fleet-office-pack.js +6 -2
- package/dist/ui/fleet-office-play.js +84 -0
- package/dist/ui/fleet-office-store.js +23 -0
- package/dist/ui/fleet-office-zones.js +5 -1
- package/dist/ui/fleet-office.js +78 -8
- package/dist/ui/host-install.js +77 -3
- package/dist/ui/hub-agent-intro.js +35 -0
- package/dist/ui/hub-attachments.js +81 -3
- package/dist/ui/hub-chat-strings.js +4 -4
- package/dist/ui/hub-client.js +16 -1
- package/dist/ui/hub-grant-picker.js +25 -11
- package/dist/ui/hub-group-strings.js +3 -3
- package/dist/ui/hub-intro-notice.js +16 -0
- package/dist/ui/hub-my-agents-model.js +42 -0
- package/dist/ui/hub-my-agents-strings.js +18 -0
- package/dist/ui/hub-my-agents.js +144 -0
- package/dist/ui/hub-owner-strings.js +5 -5
- package/dist/ui/hub-personal-agent.js +5 -4
- package/dist/ui/hub-room-composer.js +37 -6
- package/dist/ui/hub-room-list.js +4 -3
- package/dist/ui/hub-room-members.js +5 -2
- package/dist/ui/hub-room-new.js +8 -5
- package/dist/ui/hub-room-purpose.js +19 -0
- package/dist/ui/hub-room-search.js +1 -1
- package/dist/ui/hub-room-settings.js +9 -0
- package/dist/ui/hub-room-strings.js +6 -4
- package/dist/ui/hub-room-thread.js +70 -17
- package/dist/ui/hub-strings.js +5 -5
- package/dist/ui/hub-welcome.js +6 -6
- package/dist/ui/notice-hub-sharing.js +81 -0
- package/dist/ui/panel-chat.js +19 -5
- package/dist/ui/panel-hub.js +77 -29
- package/dist/ui/panel-notices.js +2 -1
- package/dist/ui/settings-hub-connection.js +2 -2
- package/dist/ui/settings-hub-page-sharing.js +52 -0
- package/dist/ui/settings-hub.js +4 -2
- package/dist/ui/settings-registry.js +1 -0
- package/dist/ui/shared/app-i18n.js +2 -2
- package/dist/ui/shared/app-shell.js +14 -2
- package/dist/ui/shared/app-store.js +6 -2
- package/dist/ui/shared/app.js +3 -1
- package/dist/ui/shared/chat-msg-actions.js +3 -1
- package/dist/ui/shared/chat-quote.js +261 -0
- package/dist/ui/shared/hub-chat.css +31 -0
- package/dist/ui/shared/hub-my-agents.css +35 -0
- package/dist/ui/shared/hub-rooms-u2.css +5 -0
- package/dist/ui/shared/module-warm.d.ts +3 -0
- package/dist/ui/shared/module-warm.js +39 -0
- package/dist/web-api.d.ts +21 -5
- package/dist/web-api.js +138 -7
- package/dist/web-api.js.map +1 -1
- package/dist/web-asset-version.d.ts +65 -0
- package/dist/web-asset-version.js +259 -0
- package/dist/web-asset-version.js.map +1 -0
- package/dist/web-host-guard.js +3 -1
- package/dist/web-host-guard.js.map +1 -1
- package/dist/web-host-install.d.ts +30 -3
- package/dist/web-host-install.js +50 -4
- package/dist/web-host-install.js.map +1 -1
- package/dist/web-notices.d.ts +17 -0
- package/dist/web-notices.js +47 -6
- package/dist/web-notices.js.map +1 -1
- package/dist/web-terminal.d.ts +5 -0
- package/dist/web-terminal.js +11 -0
- package/dist/web-terminal.js.map +1 -1
- package/launcher/agend-install.cjs +48 -7
- package/package.json +1 -1
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import {rp} from "./hub-room-purpose.js";
|
|
2
|
+
import { hi } from "./hub-agent-intro.js";
|
|
1
3
|
// Hub rooms, the right-hand members panel (docs/design/hub-rooms-ux.md section 5): the people, the agents in presence
|
|
2
4
|
// order, the room assistant, who can see what, and (for a room manager) the way to Room settings. Clicking an agent
|
|
3
5
|
// opens a small card: @ it here, chat with it one-to-one (only when I may ask it), and, for a manager, remove it.
|
|
@@ -76,9 +78,10 @@ export function RoomMembersPanel({ client = hubClient(), roomId, detail, onMenti
|
|
|
76
78
|
// An agent's second line names whose it is beside its state (「處理中 · 林小華的 Agent」), always shown, not only on hover.
|
|
77
79
|
const row = (m, extra = null) => {
|
|
78
80
|
const v = memberStatus(m), owner = (m.kind === "agent" || m.kind === "later") && m.owner?.name ? (v.update ? hm("askOwner", m.owner.name) : ownerAgent(m.owner.name)) : "";
|
|
79
|
-
return html`<span class="hub-member-name"><${RoomSourceMark} source=${roomSource(m)} decorative=${true} />${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
|
|
81
|
+
return html`<span class="hub-member-name"><${RoomSourceMark} source=${roomSource(m)} decorative=${true} />${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>${m.intro||m.kind==="assistant"?html`<small class="note">${m.kind==="assistant"?hi("assistant"):m.intro}</small>`:null}`;
|
|
80
82
|
};
|
|
81
83
|
return html`<aside class="hub-room-members">
|
|
84
|
+
${detail.room?.purpose?html`<section class="hub-room-purpose-panel"><h4>${rp("title")}</h4><p>${detail.room.purpose}</p></section>`:manager&&client.roomPurposeV1===true&&typeof detail.room?.purpose==="string"?html`<button type="button" class="btn btn-link" onClick=${()=>onSettings?.()}>${rp("add")}</button>`:null}
|
|
82
85
|
<section><h4>${heads.member}</h4>
|
|
83
86
|
<ul>${people.map(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>`)}</ul>
|
|
84
87
|
</section>
|
|
@@ -87,7 +90,7 @@ export function RoomMembersPanel({ client = hubClient(), roomId, detail, onMenti
|
|
|
87
90
|
<ul>${shown.map(m => html`<li class="hub-member hub-member-agent" key=${m.id}>
|
|
88
91
|
<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>
|
|
89
92
|
${open === m.id ? html`<div class="hub-member-card" role="group" aria-label=${m.name}>
|
|
90
|
-
<strong>${m.name}</strong>${m.owner?.name ? html`<small class="note">${hm("ownerOf", m.owner.name)}</small>` : null}
|
|
93
|
+
<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}
|
|
91
94
|
<small class="note hub-source-explanation">${roomSource(m)?.label}</small>
|
|
92
95
|
<small class="note">${memberStatus(m).text}</small>
|
|
93
96
|
<div class="field-row">
|
package/dist/ui/hub-room-new.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import {RoomPurposeField,purposeCount} from "./hub-room-purpose.js";
|
|
1
2
|
// Hub rooms, the New room dialog (docs/design/hub-rooms-ux.md section 6), opened from the list's 「+ 新房間」 row (shown
|
|
2
3
|
// only to people who may start rooms). Name (required, at most 60 characters), members (people, teams, AD groups; I am
|
|
3
4
|
// always in, as the manager), agents (mine join at once; someone else's are invited and join when their owner agrees;
|
|
@@ -73,13 +74,14 @@ export function RoomPicker({ client, kinds, picked, onChange, placeholder, label
|
|
|
73
74
|
${failed ? html`<p class="note" role="alert">${hn("searchFailed")}</p>` : null}
|
|
74
75
|
${groupNote || note ? html`<p class="note hub-room-picker-note" role="alert">${groupNote || note}</p>` : null}
|
|
75
76
|
${results && !failed ? offer.length ? html`<ul class="hub-room-results" role="listbox" aria-label=${label}>${offer.map(c => html`<li key=${keyOf(c)}>
|
|
76
|
-
<button type="button" role="option" class="hub-room-result" onClick=${() => { void pick(c); }}>${pickLabel(c)}${c.owner?.name && c.kind === "agent" ? html` <small class="note">${c.owner.name}</small>` : null}${c.kind === "agent" && !c.mine ? html` <small class="note">${hroom("invitePending")}</small>` : null}</button></li>`)}</ul>`
|
|
77
|
+
<button type="button" role="option" class="hub-room-result" onClick=${() => { void pick(c); }}>${pickLabel(c)}${c.intro?html` <small class="note">${c.intro}</small>`:null}${c.owner?.name && c.kind === "agent" ? html` <small class="note">${c.owner.name}</small>` : null}${c.kind === "agent" && !c.mine ? html` <small class="note">${hroom("invitePending")}</small>` : null}</button></li>`)}</ul>`
|
|
77
78
|
: html`<p class="note">${hn("noMatch")}</p>` : null}
|
|
78
79
|
</div>`;
|
|
79
80
|
}
|
|
80
81
|
|
|
81
82
|
/** Props: client, onClose(), onOpenRoom(roomId), assistant (whether the Hub offers the room assistant; read from the list when not given). */
|
|
82
|
-
export function NewRoomDialog({ client = hubClient(), onClose, onOpenRoom, assistant } = {}) {
|
|
83
|
+
export function NewRoomDialog({ client = hubClient(), onClose, onOpenRoom, assistant, purposeSupported=false } = {}) {
|
|
84
|
+
const [purpose,setPurpose]=useState("");
|
|
83
85
|
const [name, setName] = useState(""), [people, setPeople] = useState([]), [agents, setAgents] = useState([]), [withAssistant, setWithAssistant] = useState(false);
|
|
84
86
|
const [offered, setOffered] = useState(assistant === true), [busy, setBusy] = useState(false), [error, setError] = useState(""), [peopleNote, setPeopleNote] = useState("");
|
|
85
87
|
const nameRef = useRef(null), sent = useRef(false);
|
|
@@ -90,13 +92,13 @@ export function NewRoomDialog({ client = hubClient(), onClose, onOpenRoom, assis
|
|
|
90
92
|
return () => { live = false; };
|
|
91
93
|
}, [client, assistant]);
|
|
92
94
|
const create = async () => {
|
|
93
|
-
if (sent.current) return;
|
|
95
|
+
if (sent.current || purposeSupported&&purposeCount(purpose)>200) return;
|
|
94
96
|
const title = name.trim();
|
|
95
97
|
if (!title) { setError(hroom("nameRequired")); nameRef.current?.focus(); return; }
|
|
96
98
|
if ([...title].length > NAME_MAX) { setError(hn("nameTooLong")); nameRef.current?.focus(); return; }
|
|
97
99
|
sent.current = true; setBusy(true); setError(""); setPeopleNote("");
|
|
98
100
|
const ids = (kind, from = people) => from.filter(x => x.kind === kind).map(x => x.id);
|
|
99
|
-
const r = await client.createRoom({ name: title, people: ids("person"), teams: ids("team"), groups: ids("group"),
|
|
101
|
+
const r = await client.createRoom({ name: title, ...(purposeSupported?{purpose}:{}), people: ids("person"), teams: ids("team"), groups: ids("group"),
|
|
100
102
|
agents: agents.filter(x => x.kind === "agent" && x.mine).map(x => x.id), assistant: offered && withAssistant });
|
|
101
103
|
const roomId = r?.ok ? r.room?.id : null;
|
|
102
104
|
if (!roomId) {
|
|
@@ -118,11 +120,12 @@ export function NewRoomDialog({ client = hubClient(), onClose, onOpenRoom, assis
|
|
|
118
120
|
const me = html`<li class="tag hub-room-me">${hroom("roleYou")} · ${hroom("roleManager")}</li>`;
|
|
119
121
|
return html`<${Dialog} title=${hroom("newRoomTitle")} onClose=${() => onClose?.()} busy=${busy} cls="hub-room-new"
|
|
120
122
|
actions=${html`<button type="button" class="btn" disabled=${busy} onClick=${() => onClose?.()}>${hroom("cancel")}</button>
|
|
121
|
-
<button type="button" class="btn btn-primary" disabled=${busy} onClick=${() => { void create(); }}>${hroom("create")}</button>`}>
|
|
123
|
+
<button type="button" class="btn btn-primary" disabled=${busy||purposeSupported&&purposeCount(purpose)>200} onClick=${() => { void create(); }}>${hroom("create")}</button>`}>
|
|
122
124
|
<form class="form" onSubmit=${(e) => { e.preventDefault(); void create(); }}>
|
|
123
125
|
<label class="field"><span>${hroom("name")}</span>
|
|
124
126
|
<input id="hubRoomName" ref=${nameRef} maxlength=${NAME_MAX} autocomplete="off" placeholder=${hroom("namePlaceholder")} value=${name}
|
|
125
127
|
aria-invalid=${error === hroom("nameRequired") || error === hn("nameTooLong") ? "true" : "false"} onInput=${(e) => { setName(e.target.value); if (error) setError(""); }} /></label>
|
|
128
|
+
${purposeSupported?html`<${RoomPurposeField} value=${purpose} onValue=${setPurpose} disabled=${busy} />`:null}
|
|
126
129
|
${error ? html`<p class="note hub-room-new-error" role="alert">${error}</p>` : null}
|
|
127
130
|
<${RoomPicker} client=${client} id="hubRoomPeople" kinds=${["person", "team", "group"]} label=${hroom("members")} placeholder=${hroom("addPeople")}
|
|
128
131
|
picked=${people} onChange=${(next) => { setPeople(next); setPeopleNote(""); }} fixed=${me} note=${peopleNote} />
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import {html,useState} from "/assets/app-html.js";
|
|
2
|
+
import {register,t} from "/assets/app-i18n.js";
|
|
3
|
+
import {Dialog} from "/assets/ui-dialog.js";
|
|
4
|
+
register("hubRoomPurpose",{
|
|
5
|
+
en:{title:"Purpose",hint:"One line on what this room is for. Members see it, and agents asked here are told.",placeholder:"For example: release questions for the web team",add:"Add a purpose",tooLong:"Use 200 characters or fewer.",close:"Close"},
|
|
6
|
+
"zh-TW":{title:"用途",hint:"用一句話說明這個房間做什麼。成員看得到,在這裡被問的 Agent 也會知道。",placeholder:"例如:網頁組的發版問題",add:"新增用途",tooLong:"最多 200 個字。",close:"關閉"}
|
|
7
|
+
});
|
|
8
|
+
export const rp=(key,...args)=>t(`hubRoomPurpose.${key}`,...args);
|
|
9
|
+
export const purposeCount=value=>[...new Intl.Segmenter(undefined,{granularity:"grapheme"}).segment(String(value??""))].length;
|
|
10
|
+
export function RoomPurposeField({id="hubRoomPurpose",value="",onValue,disabled=false}){
|
|
11
|
+
const count=purposeCount(value);
|
|
12
|
+
return html`<label class="field hub-room-purpose-field" for=${id}><span>${rp("title")}</span><input id=${id} value=${value} placeholder=${rp("placeholder")} disabled=${disabled} aria-invalid=${count>200?"true":null} aria-describedby=${`${id}Hint`} onInput=${e=>onValue(e.target.value)} /><small class="note" id=${`${id}Hint`}>${`${rp("hint")} ${count}/200`}</small>${count>200?html`<small class="err" role="alert">${rp("tooLong")}</small>`:null}</label>`;
|
|
13
|
+
}
|
|
14
|
+
export function RoomPurposeHeader({purpose="",onEdit}){
|
|
15
|
+
const [open,setOpen]=useState(false);
|
|
16
|
+
if(!purpose)return onEdit?html`<button type="button" class="hub-room-purpose-trigger" onClick=${onEdit}>${rp("add")}</button>`:null;
|
|
17
|
+
return html`<button type="button" class="hub-room-purpose-trigger" title=${purpose} aria-haspopup="dialog" aria-expanded=${open?"true":"false"} aria-label=${`${rp("title")}: ${purpose}`} onClick=${()=>setOpen(true)}>${purpose}</button>
|
|
18
|
+
${open?html`<${Dialog} title=${rp("title")} onClose=${()=>setOpen(false)} actions=${html`<button type="button" class="btn" onClick=${()=>setOpen(false)}>${rp("close")}</button>`}><p class="hub-room-purpose-full">${purpose}</p></${Dialog}>`:null}`;
|
|
19
|
+
}
|
|
@@ -67,7 +67,7 @@ export function RoomSearch({ client, rooms = [], openRoom, openHit, onClose }) {
|
|
|
67
67
|
}, [onClose]);
|
|
68
68
|
const query = q.trim();
|
|
69
69
|
// A room or chat by its name, or an agent chat by its owner's (what the list's filter matched before).
|
|
70
|
-
const names = useMemo(() => (query ? rooms.filter((r) => [roomLabel(r), r.agent?.owner?.name].some((v) => String(v || "").toLowerCase().includes(query.toLowerCase()))).slice(0, 8) : []), [rooms, query]);
|
|
70
|
+
const names = useMemo(() => (query ? rooms.filter((r) => [roomLabel(r), r.purpose, r.agent?.owner?.name].some((v) => String(v || "").toLowerCase().includes(query.toLowerCase()))).slice(0, 8) : []), [rooms, query]);
|
|
71
71
|
// The messages: debounced; an older answer never replaces a newer query's; "Search older messages" appends.
|
|
72
72
|
const run = async (text, cursor = null) => {
|
|
73
73
|
const mine = ++seq.current;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import {RoomPurposeField,purposeCount} from "./hub-room-purpose.js";
|
|
1
2
|
// Hub rooms, Room settings (docs/design/hub-rooms-ux.md section 7), opened from the room's header menu or the members
|
|
2
3
|
// panel's 「房間設定」, for a room manager. Three parts:
|
|
3
4
|
// - 基本: the name, 「成員可以 @所有 Agent」, 「新成員看得到」.
|
|
@@ -41,6 +42,9 @@ export function invitedLabel(row) {
|
|
|
41
42
|
export function RoomSettings({ client = hubClient(), roomId, detail, onClose, onChanged, assistant } = {}) {
|
|
42
43
|
const room = detail?.room ?? {}, settings = detail?.settings ?? {}, members = Array.isArray(detail?.members) ? detail.members : [];
|
|
43
44
|
const invited = Array.isArray(detail?.invited) ? detail.invited : [];
|
|
45
|
+
const [purpose,setPurpose]=useState(room.purpose??"");
|
|
46
|
+
useEffect(()=>setPurpose(room.purpose??""),[roomId,room.purpose]);
|
|
47
|
+
const purposeSupported=client.roomPurposeV1===true&&typeof room.purpose==="string"&&detail?.me?.role==="manager";
|
|
44
48
|
const [name, setName] = useState(room.name ?? ""), [busy, setBusy] = useState(false), [error, setError] = useState("");
|
|
45
49
|
const [allMention, setAllMention] = useState(settings.allMention !== false), [history, setHistory] = useState(settings.historyForNew === "all" ? "all" : "since-join");
|
|
46
50
|
const [aiApps,setAiApps]=useState(settings.aiApps!==false);
|
|
@@ -66,6 +70,10 @@ export function RoomSettings({ client = hubClient(), roomId, detail, onClose, on
|
|
|
66
70
|
else { undo?.(); if (!refused?.(r)) setError(r?.status === 409 && r.code === "last-manager" ? hroom("lastManager") : hs("saveFailed")); }
|
|
67
71
|
return r;
|
|
68
72
|
};
|
|
73
|
+
const savePurpose=()=>{
|
|
74
|
+
if(!purposeSupported||purposeCount(purpose)>200||purpose===(room.purpose??""))return;
|
|
75
|
+
void act(()=>client.updateRoom(roomId,{purpose}));
|
|
76
|
+
};
|
|
69
77
|
const saveName = () => {
|
|
70
78
|
const title = name.trim();
|
|
71
79
|
if (!title) { setError(hroom("nameRequired")); return; }
|
|
@@ -110,6 +118,7 @@ export function RoomSettings({ client = hubClient(), roomId, detail, onClose, on
|
|
|
110
118
|
<div class="field-row"><input id="hubRoomSettingsName" maxlength=${NAME_MAX} autocomplete="off" value=${name} onInput=${(e) => setName(e.target.value)} />
|
|
111
119
|
<button type="button" class="btn" disabled=${busy || name.trim() === (room.name ?? "")} onClick=${saveName}>${hs("save")}</button></div>
|
|
112
120
|
</form>
|
|
121
|
+
${purposeSupported?html`<form class="form hub-room-purpose-form" onSubmit=${e=>{e.preventDefault();savePurpose();}}><${RoomPurposeField} id="hubRoomSettingsPurpose" value=${purpose} onValue=${setPurpose} disabled=${busy} /><div class="field-row"><button type="submit" class="btn" disabled=${busy||purposeCount(purpose)>200||purpose===(room.purpose??"")}>${hs("save")}</button></div></form>`:null}
|
|
113
122
|
<label class="check"><input id="hubRoomAllMention" class="s-ui-toggle" type="checkbox" role="switch" checked=${allMention} disabled=${busy}
|
|
114
123
|
onChange=${(e) => { const v = e.target.checked; setAllMention(v); void act(() => client.updateRoom(roomId, { allMention: v }), () => setAllMention(!v)); }} /><span>${hroom("membersCanAll")}</span></label>
|
|
115
124
|
${typeof settings.aiApps==="boolean"&&typeof client.setRoomAiApps==="function"?html`<label class="check"><input id="hubRoomAiApps" class="s-ui-toggle" type="checkbox" role="switch" checked=${aiApps} disabled=${busy}
|
|
@@ -38,7 +38,7 @@ register("hubRoom", {
|
|
|
38
38
|
searchResults: "Results", searchRooms: "Rooms and chats", searchBadgeRoom: "Room", searchBadgeChat: "Chat", searchCount: "{0} results",
|
|
39
39
|
searchOlder: "Search older messages", searchKeys: "↑↓ move · Enter open · Esc close", jumpMissing: "That message is no longer in this room.",
|
|
40
40
|
filterPh: "Filter: name or owner", filterClear: "Clear the filter",
|
|
41
|
-
laterAnswer: "{0} ({1}) · answers after they come online", noAnswer: "No answer",
|
|
41
|
+
laterAnswer: "{0} ({1}) · answers after they come online", noAnswer: "No answer", noAnswerUnanswered:"No answer: The agent finished without answering here", noAnswerStopped: "No answer: {0} stopped sharing this agent.",
|
|
42
42
|
workingOne: "{0} is working on it", workingMany: "{0} agents are working",
|
|
43
43
|
// §4 composer
|
|
44
44
|
composer: "Speak in “{0}”; @ an agent to have it answer",
|
|
@@ -73,6 +73,7 @@ register("hubRoom", {
|
|
|
73
73
|
addAssistant: "Add a room assistant (provided by the Hub)",
|
|
74
74
|
create: "Create", cancel: "Cancel",
|
|
75
75
|
createdSys: "{0} created this room.",
|
|
76
|
+
purposeSetSys:"{0} set the purpose: {1}",purposeClearedSys:"{0} cleared the purpose.",
|
|
76
77
|
sysAdminJoined: "{0} joined as a room manager", composerAssistant: "Ask the Hub assistant", composerDirect: "Ask {0}",
|
|
77
78
|
invitedSys: "{0} agents invited; they join when the owner agrees.",
|
|
78
79
|
nameRequired: "Enter a room name.",
|
|
@@ -141,7 +142,7 @@ register("hubRoom", {
|
|
|
141
142
|
// The @ progress line in parts, a part with 0 left out (Lumen): "Answered 1 · Working 1".
|
|
142
143
|
progAnswered: "Answered {0}", progWorking: "Working {0}", progLater: "Reply later {0}",
|
|
143
144
|
progFailed: "Failed {0}", progBlocked: "Blocked {0}",
|
|
144
|
-
reasonExpired: "The question expired before an answer", reasonUnavailable: "The room assistant could not answer",
|
|
145
|
+
reasonUnanswered:"The agent finished without answering here", reasonExpired: "The question expired before an answer", reasonUnavailable: "The room assistant could not answer",
|
|
145
146
|
reasonInterrupted: "The answer was interrupted", reasonRetired: "This agent could not answer", reasonUnknown: "No reason given",
|
|
146
147
|
roomsCanAskIt: "People in its rooms can @ it there. See In these rooms.", invitationsTitle: "Invitations",
|
|
147
148
|
},
|
|
@@ -171,7 +172,7 @@ register("hubRoom", {
|
|
|
171
172
|
searchResults: "結果", searchRooms: "房間與聊天", searchBadgeRoom: "房間", searchBadgeChat: "聊天", searchCount: "{0} 筆結果",
|
|
172
173
|
searchOlder: "搜尋更早的訊息", searchKeys: "↑↓ 移動 · Enter 開啟 · Esc 關閉", jumpMissing: "這則訊息已不在這個房間裡。",
|
|
173
174
|
filterPh: "篩選:名稱或擁有者", filterClear: "清除篩選",
|
|
174
|
-
laterAnswer: "{0}({1})· 上線後回答", noAnswer: "沒有回答",
|
|
175
|
+
laterAnswer: "{0}({1})· 上線後回答", noAnswer: "沒有回答", noAnswerUnanswered:"沒有回答:Agent 已結束處理,但沒有在這裡回答。", noAnswerStopped: "沒有回答:{0} 已停止分享這個 Agent。",
|
|
175
176
|
workingOne: "{0} 正在處理", workingMany: "{0} 個 Agent 正在處理",
|
|
176
177
|
composer: "在「{0}」說話;@ 一個 Agent 請它回答",
|
|
177
178
|
composerShort: "說話,或 @ Agent 請它回答",
|
|
@@ -203,6 +204,7 @@ register("hubRoom", {
|
|
|
203
204
|
addAssistant: "加入房間助理(Hub 提供)",
|
|
204
205
|
create: "建立", cancel: "取消",
|
|
205
206
|
createdSys: "{0} 建立了這個房間。",
|
|
207
|
+
purposeSetSys:"{0} 設定了用途:{1}",purposeClearedSys:"{0} 清除了用途。",
|
|
206
208
|
sysAdminJoined: "{0} 以房間管理的身分加入", composerAssistant: "問 Hub 助理", composerDirect: "問 {0}",
|
|
207
209
|
invitedSys: "已邀請 {0} 個 Agent,擁有者同意後會加入。",
|
|
208
210
|
nameRequired: "請輸入房間名稱。",
|
|
@@ -260,7 +262,7 @@ register("hubRoom", {
|
|
|
260
262
|
peopleOne: "1 人", peopleMany: "{0} 人", agentsOne: "1 個 Agent", agentsMany: "{0} 個 Agent",
|
|
261
263
|
progAnswered: "已回答 {0}", progWorking: "處理中 {0}", progLater: "稍後回覆 {0}",
|
|
262
264
|
progFailed: "未回答 {0}", progBlocked: "無法回答 {0}",
|
|
263
|
-
reasonExpired: "問題在回答前就過期了", reasonUnavailable: "房間助理暫時無法回答",
|
|
265
|
+
reasonUnanswered:"Agent 已結束處理,但沒有在這裡回答", reasonExpired: "問題在回答前就過期了", reasonUnavailable: "房間助理暫時無法回答",
|
|
264
266
|
reasonInterrupted: "回答被中斷", reasonRetired: "這個 Agent 無法回答", reasonUnknown: "沒有說明原因",
|
|
265
267
|
roomsCanAskIt: "房間裡的人可以在房間裡 @ 它,見「在這些房間裡」。", invitationsTitle: "邀請",
|
|
266
268
|
},
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import {RoomPurposeHeader} from "./hub-room-purpose.js";
|
|
2
|
+
import { hi } from "./hub-agent-intro.js";
|
|
1
3
|
import {hp} from "./hub-personal-agent-strings.js";
|
|
2
4
|
// M-3092 PR 2 (Hub rooms, track U): one room of a Hub with rooms, on the Fleet chat's own thread (/assets/chat-thread.js
|
|
3
5
|
// through panel-hub.js's HubThread). docs/design/hub-rooms-ux.md §3 says only where a room differs from the Fleet chat:
|
|
@@ -23,19 +25,44 @@ import { firstCharacter } from "/assets/instance-nav.js";
|
|
|
23
25
|
import { hroom } from "./hub-room-strings.js";
|
|
24
26
|
import {ha} from "./hub-ai-apps-strings.js";
|
|
25
27
|
import { RoomComposer } from "./hub-room-composer.js";
|
|
26
|
-
import { TextSizeButton } from "/assets/header-tools.js";
|
|
28
|
+
import { TextSizeButton, TEXT_SIZES, setTextSize, textSizeStore } from "/assets/header-tools.js";
|
|
29
|
+
import { useStore } from "/assets/app-store.js";
|
|
30
|
+
import { notifyStore, notifySupport, setNotify } from "/assets/app-needs.js";
|
|
27
31
|
import { HubNotifyToggle } from "./hub-room-notify.js";
|
|
28
32
|
import { createHubButtonActions } from "./hub-button-actions.js";
|
|
29
33
|
import { linkRoomsU2Css } from "./hub-room-new-strings.js";
|
|
30
34
|
import { workingLine } from "./hub-room-working.js";
|
|
31
35
|
import { roomSource, mountSourceAuthor } from "./hub-room-source.js";
|
|
32
36
|
import { countsLine } from "./hub-room-list.js";
|
|
33
|
-
import { PendingFiles, hf, hubFileAttachment, pageCarriesFiles, roomTakesFiles, uploadChosen } from "./hub-attachments.js";
|
|
37
|
+
import { DropOverlay, MAX_FILES, PendingFiles, hf, hubFileAttachment, pageCarriesFiles, putBackText, roomTakesFiles, uploadChosen, useFileDrop } from "./hub-attachments.js";
|
|
34
38
|
import { LightboxHost, openLightbox } from "/assets/image-lightbox.js";
|
|
35
39
|
// M-3125 PR3: the one quote target an annotated room picture has (here, so a page with an older dictionary has the words).
|
|
36
40
|
register("hubRoomAnnotate", { en: { quote: "Quote in this room" }, "zh-TW": { quote: "引用到這個房間" } });
|
|
37
41
|
|
|
38
42
|
linkRoomsU2Css(); // M-3127: the reaction chips and picker are drawn from hub-rooms-u2.css (a room opened before any U2 panel)
|
|
43
|
+
/**
|
|
44
|
+
* M-3311 (3): the Fleet chat's 「全寬」 for a Hub conversation — this device's choice (as the Fleet keeps its own), its own key:
|
|
45
|
+
* a Hub page has no Fleet module to share it with.
|
|
46
|
+
*/
|
|
47
|
+
const WIDE_KEY = "agend_hub_chat_wide";
|
|
48
|
+
export function hubChatWide() { try { return localStorage.getItem(WIDE_KEY) === "on"; } catch { return false; } }
|
|
49
|
+
function setHubChatWide(on) { try { if (on) localStorage.setItem(WIDE_KEY, "on"); else localStorage.removeItem(WIDE_KEY); } catch { /* this tab only */ } }
|
|
50
|
+
/** The Fleet chat's narrow screen (panel-chat.js narrowScreen): no 「全寬」 there — the column is the screen's already. */
|
|
51
|
+
const NARROW_QUERY = "(max-width: 899px), (pointer: coarse) and (max-height: 500px) and (max-width: 1023px)";
|
|
52
|
+
/**
|
|
53
|
+
* M-3311 (#4162 review): the narrow screen, kept current as the window is resized — hub-chat.css hides the header's text size
|
|
54
|
+
* and Notify at this same width, so ⋯ gains (or drops) them at once, not at the next render.
|
|
55
|
+
*/
|
|
56
|
+
function useNarrowScreen() {
|
|
57
|
+
const q = (() => { try { return typeof matchMedia === "function" ? matchMedia(NARROW_QUERY) : null; } catch { return null; } })();
|
|
58
|
+
const [narrow, setNarrow] = useState(() => !!q?.matches);
|
|
59
|
+
useEffect(() => { if (!q) return undefined; const on = () => setNarrow(!!q.matches); on(); q.addEventListener?.("change", on); return () => q.removeEventListener?.("change", on); }, []);
|
|
60
|
+
return narrow;
|
|
61
|
+
}
|
|
62
|
+
/** M-3311 (3): a room message's address — what Copy link copies; opening it shows that message (jumpParam). */
|
|
63
|
+
export const messageLink = (roomId, messageId) => `${location.origin}/ui/hub?room=${encodeURIComponent(roomId)}${messageId ? `&m=${encodeURIComponent(messageId)}` : ""}`;
|
|
64
|
+
/** M-3311 (#4159 review): a room row's Copy link — only a message with an address (a room message's id); otherwise none. */
|
|
65
|
+
export const roomLinkOf = (roomId) => (x) => (x && x.roomMessage ? messageLink(roomId, x.roomMessage) : null);
|
|
39
66
|
/** M-3127 C: the message a search hit opens (`?room=…&m=<id>`), or null. */
|
|
40
67
|
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; } };
|
|
41
68
|
const iso = (ms) => (Number.isFinite(ms) && ms > 0 ? new Date(ms).toISOString() : undefined);
|
|
@@ -65,6 +92,7 @@ export function authorLine(author, mine = false, direct = false) {
|
|
|
65
92
|
*/
|
|
66
93
|
const SYSTEM = { "room-created": "createdSys", "member-joined": "sysJoined", "admin-joined": "sysAdminJoined", "poll-closed": "sysPollClosed" };
|
|
67
94
|
export function systemText(m) {
|
|
95
|
+
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);
|
|
68
96
|
if(m?.system?.kind==="app-rate-limited")return ha("rateLimited",m.system.name||"");
|
|
69
97
|
if (m?.system?.kind === "agent-mention-stopped") return agentStopText(m.system) ?? String(m.text || "");
|
|
70
98
|
const key = m && m.system && SYSTEM[m.system.kind];
|
|
@@ -77,7 +105,7 @@ export function systemText(m) {
|
|
|
77
105
|
* child counts as failed.
|
|
78
106
|
*/
|
|
79
107
|
const count = (v) => (Number.isSafeInteger(v) && v > 0 ? v : 0);
|
|
80
|
-
const REASON = { expired: "reasonExpired", unavailable: "reasonUnavailable", interrupted: "reasonInterrupted", retired: "reasonRetired", unknown: "reasonUnknown" };
|
|
108
|
+
const REASON = { "finished-without-answer":"reasonUnanswered",expired: "reasonExpired", unavailable: "reasonUnavailable", interrupted: "reasonInterrupted", retired: "reasonRetired", unknown: "reasonUnknown" };
|
|
81
109
|
export function askReason(code) { return REASON[code] ? hroom(REASON[code]) : ""; }
|
|
82
110
|
export function askState(ask) {
|
|
83
111
|
if (!ask || !Number.isSafeInteger(ask.total) || ask.total < 1) return null;
|
|
@@ -172,7 +200,7 @@ export function toThreadMessages(messages, { meId, ids, direct = false, expanded
|
|
|
172
200
|
...(!direct && Array.isArray(m.reactions) && m.reactions.length ? { reactionBar: reactionBar(m.reactions, { meId, names }) } : {}),
|
|
173
201
|
...(!direct && kind !== "person" && m.buttons ? { buttons: roomButtons(m.buttons, meId) } : {}),
|
|
174
202
|
...(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) : "" } } : {}),
|
|
175
|
-
...(m.stage === "not-answered" ? { text: hroom("noAnswer") } : {}) });
|
|
203
|
+
...(m.stage === "not-answered" ? { text: m.reasonCode === "owner-stopped-sharing" ? hroom("noAnswerStopped", author.owner?.name || "") : m.reasonCode==="finished-without-answer"?hroom("noAnswerUnanswered"):hroom("noAnswer") } : {}) });
|
|
176
204
|
if (foldAfter) out.push({ boot: BOOT, id: num(`expand:${foldAfter.arg}`), role: "status", sender: "", text: "", bare: true, fold: true, action: foldAfter });
|
|
177
205
|
// Spec §10: once an @所有 Agent has answers, under the last one shown, 「請房間助理整理」 (it sends 「@房間助理 整理上面的回答」).
|
|
178
206
|
if (summarise && lastShown && byId.get(m.answerTo)?.mentions?.includes("all"))
|
|
@@ -384,12 +412,20 @@ export function HubRoomPage({ roomId, listed = null, Thread, client, meId = "",
|
|
|
384
412
|
useEffect(() => { const id = detail && detail.me && detail.me.id; if (id) onMe(roomId, id); }, [detail && detail.me && detail.me.id]);
|
|
385
413
|
// M-3125: Attach only where this page and this room carry files and the room is open; chosen files ride the next send.
|
|
386
414
|
const takesFiles = pageCarriesFiles(client, store) && roomTakesFiles(room) && !store.closed();
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
415
|
+
// M-3311: `left` (what still fits) and `notice` serve a paste and a drop as the Fleet chat's (hub-attachments.js pasteToAttach).
|
|
416
|
+
const attach = takesFiles ? { title: hf("attach"), left: () => MAX_FILES - filesRef.current.length, notice: (text) => { if (alive.current) toast(text); },
|
|
417
|
+
onFiles: async (list) => {
|
|
418
|
+
setFileMsg("");
|
|
419
|
+
const refused = await uploadChosen(client, room.id || roomId, list, { current: () => filesRef.current, set: setFiles, alive: () => alive.current });
|
|
420
|
+
if (alive.current && refused.length) setFileMsg(refused.join(" "));
|
|
421
|
+
return refused;
|
|
422
|
+
} } : null;
|
|
423
|
+
// M-3311 (1): a file dragged onto the conversation is attached, as in the Fleet chat.
|
|
424
|
+
const mainRef = useRef(null);
|
|
425
|
+
useFileDrop(mainRef, attach);
|
|
426
|
+
// M-3311 (3): a long paste's chip — 「改為文字」 puts its text back into the box (the Fleet chat's), and the chip goes.
|
|
427
|
+
const asText = (key) => { const f = filesRef.current.find((x) => x.key === key); if (!f) return; setFiles(filesRef.current.filter((x) => x.key !== key)); putBackText(input.current, f.text); input.current?.focus(); };
|
|
428
|
+
const pending = files.length || fileMsg ? html`<${PendingFiles} files=${files} onAsText=${asText} onRemove=${(key) => setFiles(filesRef.current.filter((f) => f.key !== key))}
|
|
393
429
|
formatSize=${(n) => (globalThis.AgendChatRender?.formatSize ? globalThis.AgendChatRender.formatSize(n) : `${n} B`)} />${fileMsg ? html`<p class="note" role="alert">${fileMsg}</p>` : null}` : null;
|
|
394
430
|
// The composer sends through the store; this one adds the ready files, waits for uploads, and clears only what was sent.
|
|
395
431
|
const annotateRef = useRef(null);
|
|
@@ -466,7 +502,25 @@ export function HubRoomPage({ roomId, listed = null, Thread, client, meId = "",
|
|
|
466
502
|
// composer's files (uploaded like any chosen file) and the reply quotes the message it came from. Read at click time
|
|
467
503
|
// (the thread keeps its options from its first render).
|
|
468
504
|
openImage: (links, img) => openLightbox(links, img, annotateRef.current(img)),
|
|
505
|
+
// M-3311 (2): 「引用」 on a selected passage goes into this room's box (read at selection time).
|
|
506
|
+
quote: { field: () => input.current, can: () => !store.closed() },
|
|
507
|
+
// M-3311 (3): the Fleet chat's Copy link — a room message's address (opening it shows that message).
|
|
508
|
+
linkOf: roomLinkOf(roomId),
|
|
469
509
|
};
|
|
510
|
+
// M-3311 (3): the header's menu — a group room's Room settings and Leave, and on a desk the Fleet chat's 「全寬」 for any room.
|
|
511
|
+
const [fullWidth, setFullWidth] = useState(hubChatWide);
|
|
512
|
+
const textSize = useStore(textSizeStore), notify = useStore(notifyStore), narrow = useNarrowScreen();
|
|
513
|
+
const menuItems = [
|
|
514
|
+
group && detail?.me?.role === "manager" ? { key: "settings", label: hroom("roomSettings"), icon: "settings", onSelect: openSettings } : null,
|
|
515
|
+
group && detail?.me ? { key: "leave", label: hroom("leaveRoom"), icon: "close", onSelect: () => { void leave(); } } : null,
|
|
516
|
+
!narrow && detail?.me ? { key: "fullWidth", checkbox: true, checked: fullWidth, label: t("chat.fullWidth"), onSelect: () => { setHubChatWide(!fullWidth); setFullWidth(!fullWidth); } } : null,
|
|
517
|
+
// M-3311 (4): a phone's header is one row (back, the room, members, ⋯) as the Fleet chat's — its text size and Notify
|
|
518
|
+
// move into ⋯ there (hub-chat.css hides the two buttons at the same width).
|
|
519
|
+
...(narrow ? [
|
|
520
|
+
{ key: "textSize", label: t("app.textSize", t(`app.textSize_${textSize.size}`)), icon: "type", onSelect: () => setTextSize(TEXT_SIZES[(TEXT_SIZES.indexOf(textSize.size) + 1) % TEXT_SIZES.length]) },
|
|
521
|
+
...(notifySupport() === "ok" ? [{ key: "notify", checkbox: true, checked: notify.state === "on", disabled: notify.asking, label: hroom("notifyTitle"), onSelect: () => { void setNotify(notify.state !== "on"); } }] : []),
|
|
522
|
+
] : []),
|
|
523
|
+
].filter(Boolean);
|
|
470
524
|
const line2 = group ? `${countsLine(room.people, room.agents)}${hasAssistant ? ` · ${hroom("roomAssistant")}` : ""}`
|
|
471
525
|
: room.assistant ? hroom("providedByHub") : room.agent?.answerOnly ? hp("answerOnlyAsker") : String(room.agent?.owner?.name || "");
|
|
472
526
|
const showRail = wide && rail && Panel && group && detail;
|
|
@@ -477,24 +531,23 @@ export function HubRoomPage({ roomId, listed = null, Thread, client, meId = "",
|
|
|
477
531
|
onMention=${(m) => { setSheet(false); insert.current?.(`@${m.name}`); }}
|
|
478
532
|
onOpenChat=${(m) => { const direct = rooms.find((r) => r.kind === "direct" && r.agent?.exposureId === m.id); if (direct) openRoom(direct.id); }}
|
|
479
533
|
onSettings=${() => { setSheet(false); openSettings(); }} />` : null;
|
|
480
|
-
return html`<div class=${`hub-chat hub-room-page${showRail ? " with-rail" : ""}`} data-room=${roomId}>
|
|
534
|
+
return html`<div class=${`hub-chat hub-room-page${showRail ? " with-rail" : ""}`} data-room=${roomId} data-width=${fullWidth ? "full" : undefined}>
|
|
481
535
|
<${LightboxHost} />
|
|
482
|
-
<section class="hub-chat-main">
|
|
536
|
+
<section class="hub-chat-main" ref=${mainRef}>
|
|
537
|
+
${attach ? html`<${DropOverlay} />` : null}
|
|
483
538
|
<header class=${`hub-chat-head${room.agent?.answerOnly?" hub-answer-only-head":""}`} data-trust="panel-content">
|
|
484
539
|
${/* Lumen (spec §2): on a phone the header starts with the Fleet chat's back to the list. */ ""}
|
|
485
540
|
<a class="icon-btn hub-back only-narrow" href="/ui/hub" aria-label=${t("hub.back")} title=${t("hub.back")}
|
|
486
541
|
onClick=${(e) => { if (e.metaKey || e.ctrlKey) return; e.preventDefault(); goList(); }}><${Icon} name="back" /></a>
|
|
487
542
|
<span class=${`av${group ? " av-square" : ""}`} aria-hidden="true"><span class="av-text">${firstCharacter(title || "?") || "?"}</span></span>
|
|
488
|
-
<span class="hub-chat-title"><strong>${title}</strong
|
|
543
|
+
<span class="hub-chat-title"><strong>${title}</strong>${group&&typeof room.purpose==="string"?html`<${RoomPurposeHeader} purpose=${room.purpose} onEdit=${detail?.me?.role==="manager"&&client.roomPurposeV1===true?openSettings:undefined} />`:null}<span class=${`s${room.agent?.answerOnly?" hub-answer-only-note":""}`}>${line2}</span>${room.assistant||room.agent?.intro?html`<span class="s hub-agent-intro-line">${room.assistant?hi("assistant"):room.agent.intro}</span>`:null}</span>
|
|
489
544
|
<span class="hub-head-tools"><${TextSizeButton} /><${HubNotifyToggle} /></span>
|
|
490
545
|
${group && Panel ? html`<button type="button" class="icon-btn hub-room-rail-toggle" aria-pressed=${(wide ? rail : sheet) ? "true" : "false"} title=${hroom("members")} aria-label=${hroom("members")}
|
|
491
546
|
onClick=${() => (wide ? setRail(!rail) : setSheet(true))}><${Icon} name="team" size=${18} /></button>` : null}
|
|
492
|
-
${
|
|
493
|
-
detail.me.role === "manager" ? { key: "settings", label: hroom("roomSettings"), icon: "settings", onSelect: openSettings } : null,
|
|
494
|
-
{ key: "leave", label: hroom("leaveRoom"), icon: "close", onSelect: () => { void leave(); } },
|
|
495
|
-
].filter(Boolean)} />` : null}
|
|
547
|
+
${menuItems.length ? html`<${Menu} cls="hub-room-menu" label=${hroom("menu")} fit=${true} ownerKey=${roomId} items=${menuItems} />` : null}
|
|
496
548
|
</header>
|
|
497
549
|
${leaveError ? html`<p class="err hub-room-leave-err" role="alert">${leaveError}</p>` : null}
|
|
550
|
+
${room.closureReason === "owner-stopped-sharing" ? html`<p class="note" role="status">${hroom("noAnswerStopped", room.ownerName || room.agent?.owner?.name || "")}</p>` : null}
|
|
498
551
|
<${Thread} store=${store} name=${title} panelKey=${`hub-room:${roomId}`} threadRef=${threadRef} extra=${extra}
|
|
499
552
|
emptyView=${room.assistant ? html`<div class="hub-assistant-empty"><${Empty} icon="bot" title=${hroom("hubAssistant")} hint=${hroom("hubAssistantEmpty")} /></div>`
|
|
500
553
|
: group ? html`<p class="note">${hroom("composerHint")}</p>` : null} />
|
package/dist/ui/hub-strings.js
CHANGED
|
@@ -11,10 +11,10 @@ register("hub", {
|
|
|
11
11
|
myFleet: "My fleet", hub: "Hub", openHubTab: "Open {0} in a new tab", switcher: "Workspace",
|
|
12
12
|
// The Hub's own pages
|
|
13
13
|
askTitle: "Ask", askEmpty: "No agents you can ask yet", askHint: "When an owner shares an agent with you, it appears here with who allowed it.",
|
|
14
|
-
exposuresTitle: "My
|
|
14
|
+
exposuresTitle: "My agents", exposuresEmpty: "You don't share any agents yet",
|
|
15
15
|
exposuresHint: "Share an agent from your own fleet: Settings → Hub → Connect to a Hub.",
|
|
16
16
|
adminTitle: "Administration",
|
|
17
|
-
// The Hub workspace (S3b): sign-in, Ask, My
|
|
17
|
+
// The Hub workspace (S3b): sign-in, Ask, My agents, Administration
|
|
18
18
|
signedOutHub: "Not signed in", signOut: "Sign out", signInTitle: "Sign in to the Hub",
|
|
19
19
|
signInLead: "Use your company account. Your password goes to the directory only and is never kept.",
|
|
20
20
|
signInPreview: "This Hub is a preview. Its screens and features may still change.",
|
|
@@ -79,7 +79,7 @@ register("hub", {
|
|
|
79
79
|
pickView: "Data view", pickTools: "Tools", shareNow: "Share", pickCancel: "Cancel", pickNone: "Choose a data view and at least one tool.",
|
|
80
80
|
waitingConfirm: "Waiting for your confirmation", pendingSent: "Sent for confirmation: finish it on the confirm card to share it.",
|
|
81
81
|
errLimit: "At most 64 agents can be shared.", notAvailable: "Not available on this AgEnD version.",
|
|
82
|
-
hubStillNeeded: "Still needed on the Hub:", ownerStepHub: "Your confirmation: sign in to the Hub, open My
|
|
82
|
+
hubStillNeeded: "Still needed on the Hub:", ownerStepHub: "Your confirmation: sign in to the Hub, open My agents and confirm this fingerprint.",
|
|
83
83
|
adminStepHub: "The Hub administrator's approval of this fingerprint.", hubProgressHidden: "This page can't see their progress; it connects once both are done.",
|
|
84
84
|
localMatch: "It matches the Hub's screen", localConfirmed: "You confirmed this fingerprint here.",
|
|
85
85
|
hold_disconnected: "Disconnected here. The Hub still lists this fleet until its administrator revokes it.", startOver: "Start over",
|
|
@@ -91,7 +91,7 @@ register("hub", {
|
|
|
91
91
|
preview: "預覽:這個版本還不能真正連接 Hub,這裡的操作不會離開這個頁面。",
|
|
92
92
|
myFleet: "我的 Fleet", hub: "Hub", openHubTab: "在新分頁開啟 {0}", switcher: "工作區",
|
|
93
93
|
askTitle: "提問", askEmpty: "目前還沒有你可以提問的 Agent", askHint: "有人把 Agent 開放給你之後,它會出現在這裡,並註明是誰授權的。",
|
|
94
|
-
exposuresTitle: "
|
|
94
|
+
exposuresTitle: "我的 Agent", exposuresEmpty: "你還沒有分享任何 Agent",
|
|
95
95
|
exposuresHint: "請在自己的 Fleet 分享 Agent:設定 → Hub。",
|
|
96
96
|
adminTitle: "管理",
|
|
97
97
|
signedOutHub: "尚未登入", signOut: "登出", signInTitle: "登入 Hub",
|
|
@@ -156,7 +156,7 @@ register("hub", {
|
|
|
156
156
|
pickView: "資料檢視", pickTools: "工具", shareNow: "分享", pickCancel: "取消", pickNone: "請選擇一個資料檢視和至少一個工具。",
|
|
157
157
|
waitingConfirm: "等待你的確認", pendingSent: "已送出確認:請在確認卡完成,才會分享。",
|
|
158
158
|
errLimit: "最多只能分享 64 個 Agent。", notAvailable: "這個 AgEnD 版本無法使用此功能。",
|
|
159
|
-
hubStillNeeded: "還需要在 Hub 完成:", ownerStepHub: "你的確認:登入 Hub
|
|
159
|
+
hubStillNeeded: "還需要在 Hub 完成:", ownerStepHub: "你的確認:登入 Hub,在「我的 Agent」確認這個指紋。",
|
|
160
160
|
adminStepHub: "Hub 管理員核准這個指紋。", hubProgressHidden: "這個頁面看不到 Hub 那邊的進度,兩項都完成後就會連接。",
|
|
161
161
|
localMatch: "和 Hub 畫面上的一致", localConfirmed: "你已在這裡確認這個指紋。",
|
|
162
162
|
hold_disconnected: "已在這裡移除連接。Hub 管理員撤銷之前,Hub 上仍會列出這個 Fleet。", startOver: "重新開始",
|
package/dist/ui/hub-welcome.js
CHANGED
|
@@ -126,7 +126,7 @@ function AddressChip({ host }) {
|
|
|
126
126
|
* pair from here). `admin` never reads the "your Hub administrator connects fleets" line. The pairing steps show while no Fleet is
|
|
127
127
|
* connected, else behind 「+ 連接另一個 Fleet」; at the limit, the limit line instead.
|
|
128
128
|
*/
|
|
129
|
-
export function MyFleetsCard({ quick = false, admin = false, features = [] }) {
|
|
129
|
+
export function MyFleetsCard({ quick = false, admin = false, features = [], compact = false }) {
|
|
130
130
|
const c = hubClient(), { w, error, load, refresh } = useWelcome();
|
|
131
131
|
const companyJoin = Array.isArray(features) && features.includes("company-join-v1");
|
|
132
132
|
const [joinOn, setJoinOn] = useState(false), [adding, setAdding] = useState(false);
|
|
@@ -137,7 +137,7 @@ export function MyFleetsCard({ quick = false, admin = false, features = [] }) {
|
|
|
137
137
|
c.joinMetadata().then((r) => { if (live) setJoinOn(!!r && r.ok === true && Array.isArray(r.features) && r.features.includes("company-join-v1")); }, () => {});
|
|
138
138
|
return () => { live = false; };
|
|
139
139
|
}, [companyJoin]);
|
|
140
|
-
const head = (count) => html`<h3>${hg("fleetsTitle")}${count ? html` <small class="note">${count}</small>` : null}</h3>`;
|
|
140
|
+
const head = (count) => html`<h3>${hg("fleetsTitle")}${count ? html` <small class="note">${compact ? " · " : ""}${count}</small>` : null}</h3>`;
|
|
141
141
|
if (error) return html`<section class="card hub-my-fleets">${head()}${error === "busy"
|
|
142
142
|
? html`<p class="note" role="status" data-welcome="busy">${hr("busy")}</p>` : html`<${ErrorState} message=${hg("unknown")} onRetry=${load} />`}</section>`;
|
|
143
143
|
if (!w) return html`<section class="card hub-my-fleets" aria-busy="true">${head()}<${Skeleton} variant="rows" lines=${2} /></section>`;
|
|
@@ -156,15 +156,15 @@ export function MyFleetsCard({ quick = false, admin = false, features = [] }) {
|
|
|
156
156
|
${quickOn ? html`<details class="s-ui-disclosure hub-welcome-other"><summary>${otherWaysLabel()}</summary><div class="s-disclosure-body">
|
|
157
157
|
<${QuickPairingGuide} allowed=${connectOk && !atLimit} publishAllowed=${w.publish?.state === "allow"} onConnected=${refresh} /></div></details>` : null}
|
|
158
158
|
</div>`;
|
|
159
|
-
return html`<section class="card hub-my-fleets" data-entry="connect">${head(connectOk && max > 0 ? hg("connectCount", used, max) : "")}
|
|
160
|
-
${fleets.length ? html`<div class="hub-rows">${fleets.map((f) => html`<div key=${f.id} class="s-row hub-row" data-fleet=${f.id}>
|
|
159
|
+
return html`<section class="card hub-my-fleets" data-entry="connect"><div class="field-row hub-my-fleets-head">${head(connectOk && max > 0 ? hg("connectCount", used, max) : "")}${compact && used && connectOk && !atLimit && !adding ? html`<button type="button" class="btn btn-sm hub-pair-more" onClick=${() => setAdding(true)}>${hg("connectAnother")}</button>` : null}</div>
|
|
160
|
+
${!compact && fleets.length ? html`<div class="hub-rows">${fleets.map((f) => html`<div key=${f.id} class="s-row hub-row" data-fleet=${f.id}>
|
|
161
161
|
<span class="hub-row-text"><strong>${f.label || f.id}</strong></span>
|
|
162
162
|
<span class=${`tag${f.status === "active" ? " ok" : f.status === "suspended" || f.status === "unknown" ? " warn" : ""}`} data-fleet-status=${f.status}>${hg(FLEET_STATUS[f.status] || "fleetUnknown")}</span>
|
|
163
|
-
${quickOn ? html`<${FleetRowMenu} fleet=${f} onRevoked=${load} />` : null}</div>`)}</div>` : html`<p class="note">${hg("connectHint")}</p>`}
|
|
163
|
+
${quickOn ? html`<${FleetRowMenu} fleet=${f} onRevoked=${load} />` : null}</div>`)}</div>` : !compact ? html`<p class="note">${hg("connectHint")}</p>` : null}
|
|
164
164
|
${!legacy && !connectOk ? html`<p class="note">${w.chat?.state === "allow" && connect.reason === "no-group" ? hg("connectNotIncluded") : reasonText(connect, "contactAdmin")}</p>`
|
|
165
165
|
: atLimit ? html`<p class="note" data-welcome="limit">${hg("connectLimit")}</p>`
|
|
166
166
|
: !used || adding ? steps
|
|
167
|
-
: html`<button type="button" class="btn btn-sm hub-pair-more" onClick=${() => setAdding(true)}>${hg("connectAnother")}</button>`}
|
|
167
|
+
: compact ? null : html`<button type="button" class="btn btn-sm hub-pair-more" onClick=${() => setAdding(true)}>${hg("connectAnother")}</button>`}
|
|
168
168
|
${!legacy && w.publish && w.publish.state !== "allow" && connectOk ? html`<p class="note" data-welcome="publish">${hg("publishNot")}</p>` : null}
|
|
169
169
|
</section>`;
|
|
170
170
|
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { html, useState } from "/assets/app-html.js";
|
|
2
|
+
import { register, t } from "/assets/app-i18n.js";
|
|
3
|
+
import { useStore } from "/assets/app-store.js";
|
|
4
|
+
import * as updates from "/assets/app-update.js";
|
|
5
|
+
register("noticeHubSharing", {
|
|
6
|
+
en: {
|
|
7
|
+
"reason_not-owner": "The connected owner changed.",
|
|
8
|
+
"reason_switched-off": "Sharing from the Hub page is turned off in this Fleet's Settings → Hub.",
|
|
9
|
+
"reason_stale-list": "It changed after this list was shown. Refresh to check.",
|
|
10
|
+
"reason_not-shareable": "This agent can't answer Hub questions.",
|
|
11
|
+
"reason_limit": "This Fleet already shares 64 agents, the most allowed.",
|
|
12
|
+
"reason_not-allowed": "The Hub hasn't allowed this share.",
|
|
13
|
+
"reason_unknown-agent": "This agent is no longer available.",
|
|
14
|
+
"reason_expired": "This request expired.",
|
|
15
|
+
"reason_unavailable": "The Fleet could not confirm this change.",
|
|
16
|
+
undoneBy: "A Fleet administrator undid this request.",
|
|
17
|
+
pending: "{0} asked to change sharing with {1} from the Hub page. The result is not confirmed yet.",
|
|
18
|
+
shared: "{0} shared {1} with {2} from the Hub page. Nobody can ask until {0} chooses who may ask.",
|
|
19
|
+
stopped: "{0} stopped sharing {1} with {2} from the Hub page.",
|
|
20
|
+
undoneShare: "{0}: no longer shared.", undoneStop: "{0}: shared again.", changed: "{0}: skipped because it changed or could not be restored.",
|
|
21
|
+
refused: "{0}: not changed ({1}).", undo: "Undo", undoPending: "Not confirmed yet. Refresh Notices to check.",
|
|
22
|
+
expired: "This can no longer be undone here. Use Settings → Hub.", done: "Undone. The notice shows which agents changed.",
|
|
23
|
+
classic: "Hub questions and answers are not posted in its Discord or Telegram room, and the room's chat is not copied to the Hub. It is one agent with one memory: it may use what it learned in the room when it answers here.",
|
|
24
|
+
},
|
|
25
|
+
"zh-TW": {
|
|
26
|
+
"reason_not-owner": "已連接的擁有者已變更。",
|
|
27
|
+
"reason_switched-off": "這個 Fleet 的「設定 → Hub」關閉了從 Hub 頁面分享。",
|
|
28
|
+
"reason_stale-list": "顯示名單之後,狀態已變更,請重新整理確認。",
|
|
29
|
+
"reason_not-shareable": "這個 Agent 目前無法回答 Hub 的提問。",
|
|
30
|
+
"reason_limit": "這個 Fleet 已經分享 64 個 Agent,達到上限。",
|
|
31
|
+
"reason_not-allowed": "Hub 尚未允許這次分享。",
|
|
32
|
+
"reason_unknown-agent": "這個 Agent 已無法使用。",
|
|
33
|
+
"reason_expired": "這次要求已到期。",
|
|
34
|
+
"reason_unavailable": "Fleet 無法確認這次變更。",
|
|
35
|
+
undoneBy: "Fleet 管理員已復原這次變更。",
|
|
36
|
+
pending: "{0} 從 Hub 頁面要求變更與 {1} 的分享,還沒有確認結果。",
|
|
37
|
+
shared: "{0} 從 Hub 頁面把 {1} 分享到 {2}。在 {0} 選擇誰可以問之前,沒有人可以問它。",
|
|
38
|
+
stopped: "{0} 從 Hub 頁面停止把 {1} 分享到 {2}。",
|
|
39
|
+
undoneShare: "{0}:不再分享。", undoneStop: "{0}:已重新分享。", changed: "{0}:狀態已變更或無法還原,已略過。",
|
|
40
|
+
refused: "{0}:沒有變更({1})。", undo: "復原", undoPending: "還沒有確認,請重新整理「通知」確認。",
|
|
41
|
+
expired: "已經無法在這裡復原,請到「設定 → Hub」。", done: "已復原,通知會顯示哪些 Agent 已變更。",
|
|
42
|
+
classic: "Hub 的提問與回答不會貼到它的 Discord 或 Telegram 房間,房間的聊天也不會複製到 Hub。但它是同一個 Agent、同一份記憶:在這裡回答時,可能用到它在房間裡得知的內容。",
|
|
43
|
+
},
|
|
44
|
+
});
|
|
45
|
+
const tn = (key, ...args) => t(`noticeHubSharing.${key}`, ...args);
|
|
46
|
+
export function hubSharingLines(value) {
|
|
47
|
+
if (!value || !Array.isArray(value.rows)) return [];
|
|
48
|
+
if (value.state === "pending") return [tn("pending", value.byName, value.hubName)];
|
|
49
|
+
const shared = value.rows.filter(row => row.state === "shared").map(row => row.name), stopped = value.rows.filter(row => row.state === "stopped").map(row => row.name);
|
|
50
|
+
const lines = [value.state === "undone" ? tn("undoneBy") : null, shared.length ? tn("shared", value.byName, shared.join(", "), value.hubName) : null,
|
|
51
|
+
stopped.length ? tn("stopped", value.byName, stopped.join(", "), value.hubName) : null].filter(Boolean);
|
|
52
|
+
for (const row of value.rows) {
|
|
53
|
+
if (row.state === "undone") lines.push(tn(row.action === "share" ? "undoneShare" : "undoneStop", row.name));
|
|
54
|
+
if (row.state === "refused") lines.push(tn("refused", row.name, tn(`reason_${row.code || "unavailable"}`)));
|
|
55
|
+
if (row.state === "changed") lines.push(tn("changed", row.name));
|
|
56
|
+
}
|
|
57
|
+
if (value.rows.some(row => row.kind === "classic-room" && row.action === "share" && row.state === "shared")) lines.push(tn("classic"));
|
|
58
|
+
return lines;
|
|
59
|
+
}
|
|
60
|
+
export function HubSharingNotice({ notice }) {
|
|
61
|
+
const value = notice?.hubSharing;
|
|
62
|
+
const [busy, setBusy] = useState(false), [latest, setLatest] = useState(null), [feedback, setFeedback] = useState("");
|
|
63
|
+
const update = updates.updateStore ? useStore(updates.updateStore) : null;
|
|
64
|
+
const shown = latest || value;
|
|
65
|
+
const undo = async () => {
|
|
66
|
+
if (busy) return; setBusy(true); setFeedback("");
|
|
67
|
+
try {
|
|
68
|
+
const response = await fetch(`/api/settings/hub/sharing-notices/${encodeURIComponent(value.key)}/undo`, { method: "POST", headers: { "Content-Type": "application/json" }, body: "{}" });
|
|
69
|
+
const result = await response.json();
|
|
70
|
+
if (response.status === 200) { setLatest(result); }
|
|
71
|
+
else setFeedback(response.status === 409 && result?.error === "expired" ? "expired" : "undoPending");
|
|
72
|
+
} catch { setFeedback("undoPending"); }
|
|
73
|
+
finally { setBusy(false); }
|
|
74
|
+
};
|
|
75
|
+
const expired = !shown || Date.now() >= shown.undoUntil;
|
|
76
|
+
const offered = (shown?.state === "complete" || shown?.state === "undoing") && shown.rows.some(row => row.state === "shared" || row.state === "stopped");
|
|
77
|
+
return html`<div class="n-detail notice-text">${hubSharingLines(shown).map((line, index) => html`<p key=${index}>${line}</p>`)}</div>
|
|
78
|
+
${offered && update?.info?.admin === true ? expired ? html`<p class="note">${tn("expired")}</p>`
|
|
79
|
+
: html`<div class="n-actions"><button type="button" class="btn btn-sm" disabled=${busy} onClick=${undo}>${tn("undo")}</button></div>` : null}
|
|
80
|
+
${feedback ? html`<p class="note" role="status">${tn(feedback)}</p>` : null}`;
|
|
81
|
+
}
|
package/dist/ui/panel-chat.js
CHANGED
|
@@ -722,7 +722,9 @@ function useMedia(query) {
|
|
|
722
722
|
/** M-3167: the model's short name for the composer's chip on a desk ("Opus 5.5 (claude-opus-5-5)" → "Opus 5.5"). */
|
|
723
723
|
export function shortModelName(label) {
|
|
724
724
|
const s = String(label || "").replace(/\s*\([^)]*\)\s*$/, "").trim();
|
|
725
|
-
|
|
725
|
+
// M-3304: a version is one or two digits each (`5`, `5-5`); a dated id's date is not a minor version —
|
|
726
|
+
// "claude-sonnet-6-20270101" is "Sonnet 6" (was "Sonnet 6.20270101"), "claude-opus-5-5-20261201" "Opus 5.5".
|
|
727
|
+
const family = /^claude-(opus|sonnet|haiku|fable)-(\d{1,2})(?:-(\d{1,2}))?(?![\d.])/i.exec(s);
|
|
726
728
|
if (family) return `${family[1][0].toUpperCase()}${family[1].slice(1).toLowerCase()} ${family[2]}${family[3] ? `.${family[3]}` : ""}`;
|
|
727
729
|
return s;
|
|
728
730
|
}
|
|
@@ -1087,12 +1089,24 @@ function ModelMenu({ name, c, lease }) {
|
|
|
1087
1089
|
// A desk: under the control that opened it (else above the box's left end); a click outside closes it.
|
|
1088
1090
|
const place = (el) => {
|
|
1089
1091
|
if (!el) return;
|
|
1090
|
-
const at = modelMenuAnchor, w = el.offsetWidth || 320
|
|
1092
|
+
const at = modelMenuAnchor, w = el.offsetWidth || 320;
|
|
1091
1093
|
const vw = globalThis.innerWidth || 1280, vh = globalThis.innerHeight || 800; // (a test DOM has no viewport)
|
|
1092
1094
|
let left, top;
|
|
1093
|
-
//
|
|
1094
|
-
|
|
1095
|
-
|
|
1095
|
+
// M-3304 (the user, beta.11): under the control — or above it when it sits in the lower half (the composer's chip) — and
|
|
1096
|
+
// never over it: a list longer than the room there scrolls within the menu (its height capped to that room), instead
|
|
1097
|
+
// of the menu moving up over the control and the header. Its left at the control's (kept in the viewport).
|
|
1098
|
+
if (at) {
|
|
1099
|
+
const up = at.top > vh / 2, room = Math.max(160, Math.floor(up ? at.top - 6 - 8 : vh - at.bottom - 6 - 8));
|
|
1100
|
+
el.style.setProperty("max-height", `${room}px`);
|
|
1101
|
+
const h = Math.min(el.offsetHeight || 0, room);
|
|
1102
|
+
left = Math.min(Math.max(8, at.left), vw - w - 8);
|
|
1103
|
+
top = up ? Math.max(8, at.top - 6 - h) : at.bottom + 6;
|
|
1104
|
+
} else {
|
|
1105
|
+
const box = el.closest(".p-chat")?.querySelector(".composer-box")?.getBoundingClientRect();
|
|
1106
|
+
el.style.setProperty("max-height", `${Math.max(160, Math.floor((box ? box.top : vh) - 16))}px`);
|
|
1107
|
+
const h = el.offsetHeight || 0;
|
|
1108
|
+
left = box ? box.left : 16; top = box ? Math.max(8, box.top - h - 8) : 72;
|
|
1109
|
+
}
|
|
1096
1110
|
el.style.setProperty("left", `${Math.round(left)}px`); el.style.setProperty("top", `${Math.round(top)}px`);
|
|
1097
1111
|
};
|
|
1098
1112
|
return html`<div class="model-menu-scrim" onClick=${close}></div><div class="model-menu-pop" ref=${(el) => { pop.current = el; place(el); }} onKeyDown=${onKeys}>${body}</div>`;
|