@songsid/agend 2.4.0-beta.11 → 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 +28 -2
- package/dist/auth-api.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/daemon.d.ts +5 -0
- package/dist/daemon.js +20 -2
- package/dist/daemon.js.map +1 -1
- package/dist/fleet-manager.d.ts +105 -1
- package/dist/fleet-manager.js +366 -24
- package/dist/fleet-manager.js.map +1 -1
- package/dist/general-knowledge/skills/hub/SKILL.md +25 -0
- package/dist/general-knowledge/skills/web-dashboard/SKILL.md +6 -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/client.d.ts +1 -0
- package/dist/hub/client.js +26 -0
- package/dist/hub/client.js.map +1 -1
- package/dist/hub/compose/member.d.ts +13 -5
- package/dist/hub/compose/member.js +28 -5
- package/dist/hub/compose/member.js.map +1 -1
- package/dist/hub/compose/server.d.ts +1 -0
- package/dist/hub/compose/server.js +5 -1
- package/dist/hub/compose/server.js.map +1 -1
- package/dist/hub/http/compose.d.ts +1 -0
- package/dist/hub/http/compose.js +28 -5
- package/dist/hub/http/compose.js.map +1 -1
- package/dist/hub/http/schema.js +6 -0
- package/dist/hub/http/schema.js.map +1 -1
- 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/room-ask.d.ts +10 -0
- package/dist/hub/member/room-ask.js +70 -7
- package/dist/hub/member/room-ask.js.map +1 -1
- 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/protocol.d.ts +172 -4
- package/dist/hub/protocol.js +10 -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.js +50 -10
- 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/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 +11 -0
- package/dist/hub/rooms/service.js +56 -12
- package/dist/hub/rooms/service.js.map +1 -1
- package/dist/hub/rooms/types.d.ts +6 -2
- package/dist/hub/runtime.d.ts +1 -1
- package/dist/hub/server.js +27 -1
- package/dist/hub/server.js.map +1 -1
- package/dist/hub/types.d.ts +9 -5
- 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/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 +20 -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/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 +5 -0
- package/dist/needs-you.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 +5 -1
- package/dist/public-web-gateway.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-effect.js +17 -1
- 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/host-install.js +77 -3
- package/dist/ui/hub-agent-intro.js +15 -6
- package/dist/ui/hub-attachments.js +81 -3
- package/dist/ui/hub-client.js +4 -0
- package/dist/ui/hub-intro-notice.js +16 -0
- package/dist/ui/hub-my-agents.js +5 -2
- package/dist/ui/hub-room-composer.js +10 -2
- package/dist/ui/hub-room-list.js +1 -1
- package/dist/ui/hub-room-members.js +2 -0
- package/dist/ui/hub-room-new.js +7 -4
- 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 +68 -17
- package/dist/ui/panel-chat.js +19 -5
- package/dist/ui/panel-hub.js +61 -18
- package/dist/ui/shared/app-i18n.js +2 -2
- package/dist/ui/shared/app-shell.js +6 -0
- 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 +28 -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 +17 -4
- package/dist/web-api.js +83 -6
- 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-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
package/dist/ui/host-install.js
CHANGED
|
@@ -23,7 +23,7 @@ register("hostinstall", {
|
|
|
23
23
|
output: "Installer output (last lines)",
|
|
24
24
|
started: "Installing {0}…", confirm: "Install {0} on the AgEnD host",
|
|
25
25
|
err_unsupported: "This CLI cannot be installed from here.", err_already: "{0} is already installed on this host.",
|
|
26
|
-
err_busy: "Another install or sign-in is running. Wait for it to end, or cancel it.", err_shutting_down: "AgEnD is shutting down.",
|
|
26
|
+
err_busy: "Another install or sign-in is running. Wait for it to end, or cancel it.", err_cli_self_updating: "{0} is updating itself right now. Try again in a few minutes.", err_shutting_down: "AgEnD is shutting down.",
|
|
27
27
|
err_not_allowed: "Only a fleet admin signed in on this machine or its network can install a CLI.",
|
|
28
28
|
err_install_needs_a_local_admin: "Only a fleet admin signed in on this machine or its network can install a CLI.",
|
|
29
29
|
err_install_not_over_public_link: "Installing is not available over the public link. Open the dashboard on the machine running AgEnD.",
|
|
@@ -44,7 +44,7 @@ register("hostinstall", {
|
|
|
44
44
|
output: "安裝程式輸出(最後幾行)",
|
|
45
45
|
started: "正在安裝 {0}…", confirm: "在 AgEnD 主機上安裝 {0}",
|
|
46
46
|
err_unsupported: "這個 CLI 不能從這裡安裝。", err_already: "這台主機已經安裝 {0}。",
|
|
47
|
-
err_busy: "另一個安裝或登入正在進行。請等它結束,或先取消它。", err_shutting_down: "AgEnD 正在關閉。",
|
|
47
|
+
err_busy: "另一個安裝或登入正在進行。請等它結束,或先取消它。", err_cli_self_updating: "{0} 正在自行更新,請過幾分鐘再試。", err_shutting_down: "AgEnD 正在關閉。",
|
|
48
48
|
err_not_allowed: "只有在這台機器或它的網路上登入的 fleet 管理員,才能安裝 CLI。",
|
|
49
49
|
err_install_needs_a_local_admin: "只有在這台機器或它的網路上登入的 fleet 管理員,才能安裝 CLI。",
|
|
50
50
|
err_install_not_over_public_link: "公開連結上不能安裝。請在執行 AgEnD 的機器上開啟儀表板。",
|
|
@@ -110,6 +110,46 @@ register("hostinstall", {
|
|
|
110
110
|
updatedLatestNoVersion: "{0} 的更新程式已結束(結束碼 0),但之後讀不到已安裝的版本,不確定現在是哪個版本。",
|
|
111
111
|
},
|
|
112
112
|
});
|
|
113
|
+
// M-3307 (#4146): an npm-global Claude Code is offered a switch to Claude's native install (the audited release through claude.ai/install.sh, in the same window), and afterwards
|
|
114
|
+
// the removal of the npm copy as a separate step that says what it removes. Both are held changes like Install and Update; the page names only "claude-code".
|
|
115
|
+
register("hostinstall", {
|
|
116
|
+
en: {
|
|
117
|
+
nativeOffer: "Claude Code is installed with npm ({0}). An AgEnD restart can interrupt npm's own updates and leave `claude` half-installed. Claude's native install avoids that: switching installs {1}, the release AgEnD has audited, with claude.ai/install.sh.",
|
|
118
|
+
nativeSwitch: "Switch to native install", cardLabelNative: "Switch Claude Code on this AgEnD computer to Claude's native install",
|
|
119
|
+
runningNative: "Installing Claude Code {0} with Claude's native installer (started on {1}).",
|
|
120
|
+
nativeOk: "`claude` now runs from Claude's native install: {0} ({1}).",
|
|
121
|
+
nativeStillNpm: "The native installer finished, but `claude` still runs the npm copy ({0}), which comes first on PATH. Removing the npm copy finishes the switch.",
|
|
122
|
+
nativeUnverified: "The native installer finished, but `claude` could not be found afterwards. Read its last lines below.",
|
|
123
|
+
failedNative: "The switch to Claude's native install did not finish.",
|
|
124
|
+
npmLeft: "The npm copy is still at {0}. Removing it runs npm -g uninstall @anthropic-ai/claude-code in that npm folder; Claude's native install stays.",
|
|
125
|
+
npmRemove: "Remove the npm copy", cardLabelNpmRemove: "Remove the npm copy of Claude Code from this AgEnD computer",
|
|
126
|
+
runningNpmRemove: "Removing the npm copy of Claude Code (started on {0}).",
|
|
127
|
+
npmRemoved: "The npm copy was removed. `claude` runs {0} ({1}).",
|
|
128
|
+
npmNotRemoved: "npm finished, but the npm copy is still at {0}. Read its last lines below: removing it may need the account that installed it.",
|
|
129
|
+
failedNpmRemove: "The npm copy was not removed.",
|
|
130
|
+
err_not_npm: "Claude Code here is not an npm install, so there is nothing to switch.",
|
|
131
|
+
err_still_npm: "There is no native install of Claude Code yet: switch to it first, then remove the npm copy.",
|
|
132
|
+
err_no_npm_copy: "There is no npm copy of Claude Code to remove.",
|
|
133
|
+
},
|
|
134
|
+
"zh-TW": {
|
|
135
|
+
nativeOffer: "Claude Code 是用 npm 安裝的({0})。AgEnD 重啟時可能打斷 npm 自己的更新,讓 `claude` 只裝了一半。改用 Claude 的原生安裝就不會這樣:切換會用 claude.ai/install.sh 安裝 {1},也就是 AgEnD 稽核過的版本。",
|
|
136
|
+
nativeSwitch: "改用原生安裝", cardLabelNative: "把這台 AgEnD 電腦上的 Claude Code 改成 Claude 的原生安裝",
|
|
137
|
+
runningNative: "正在用 Claude 的原生安裝程式安裝 Claude Code {0}(從 {1} 啟動)。",
|
|
138
|
+
nativeOk: "`claude` 現在使用 Claude 的原生安裝:{0}({1})。",
|
|
139
|
+
nativeStillNpm: "原生安裝程式已結束,但 `claude` 仍然執行 npm 那份({0}),因為它在 PATH 上比較前面。移除 npm 那份就能完成切換。",
|
|
140
|
+
nativeUnverified: "原生安裝程式已結束,但之後找不到 `claude`。請看下方它的最後幾行。",
|
|
141
|
+
failedNative: "改用 Claude 原生安裝沒有完成。",
|
|
142
|
+
npmLeft: "npm 那份還在 {0}。移除會在那個 npm 目錄執行 npm -g uninstall @anthropic-ai/claude-code;Claude 的原生安裝會保留。",
|
|
143
|
+
npmRemove: "移除 npm 那份", cardLabelNpmRemove: "從這台 AgEnD 電腦移除 npm 安裝的 Claude Code",
|
|
144
|
+
runningNpmRemove: "正在移除 npm 安裝的 Claude Code(從 {0} 啟動)。",
|
|
145
|
+
npmRemoved: "已移除 npm 那份。`claude` 現在執行 {0}({1})。",
|
|
146
|
+
npmNotRemoved: "npm 已結束,但 npm 那份還在 {0}。請看下方它的最後幾行:可能需要當初安裝它的帳號才能移除。",
|
|
147
|
+
failedNpmRemove: "npm 那份沒有移除。",
|
|
148
|
+
err_not_npm: "這裡的 Claude Code 不是用 npm 安裝的,不需要切換。",
|
|
149
|
+
err_still_npm: "還沒有 Claude Code 的原生安裝:請先改用原生安裝,再移除 npm 那份。",
|
|
150
|
+
err_no_npm_copy: "沒有 npm 安裝的 Claude Code 可以移除。",
|
|
151
|
+
},
|
|
152
|
+
});
|
|
113
153
|
const th = (k, ...v) => t(`hostinstall.${k}`, ...v);
|
|
114
154
|
function installStyles() {
|
|
115
155
|
if (typeof document === "undefined" || !document.head || document.querySelector('link[href="/assets/host-install.css"]')) return;
|
|
@@ -181,6 +221,9 @@ export const startHostInstall = (backend) => startHostCli("/ui/host-install", ba
|
|
|
181
221
|
/** Update `backend` on the host to the audited release (AGEND-136). */
|
|
182
222
|
/** AGEND-154 (Prism P2-1 on #3552): the update to the vendor's latest (`latest`, the one named exception) says so in the request — `acceptLatestUnaudited: true` — which is what lets the server run it; a page without this line sends `{ backend }`, and the server refuses. */
|
|
183
223
|
export const startHostUpdate = (backend, latest = false) => startHostCli("/ui/host-update", backend, latest ? "cardLabelUpdateLatest" : "cardLabelUpdate", latest ? { acceptLatestUnaudited: true } : {});
|
|
224
|
+
/** M-3307: switch the host's npm-global Claude Code to Claude's native install; then, a separate step, remove the npm copy. */
|
|
225
|
+
export const startHostNativeSwitch = () => startHostCli("/ui/host-native-switch", "claude-code", "cardLabelNative");
|
|
226
|
+
export const startHostNpmRemove = () => startHostCli("/ui/host-npm-remove", "claude-code", "cardLabelNpmRemove");
|
|
184
227
|
|
|
185
228
|
export async function cancelHostInstall() {
|
|
186
229
|
const r = await post("/ui/host-install/cancel", {});
|
|
@@ -240,6 +283,14 @@ export function VersionLine({ row, label, blocked = false }) {
|
|
|
240
283
|
return html`<div class="s-account-version" data-cli-update=${u.state} data-via=${u.via} data-latest=${u.latest ? "1" : "0"}>
|
|
241
284
|
<p class="note s-account-why">${text}</p>
|
|
242
285
|
${u.button ? html`<span class="s-actions"><button type="button" class="btn btn-sm btn-primary s-account-update" aria-label=${`${label} — ${buttonLabel}`} disabled=${blocked || installRunning(state)} onClick=${() => { void startHostUpdate(row.backend, !!u.latest); }}>${updating ? th("updating") : buttonLabel}</button></span>` : null}
|
|
286
|
+
${row.npmLeftover && row.backend === "claude-code" && !(runFor(state, row.backend) && runFor(state, row.backend).claude && runFor(state, row.backend).claude.npmLeftover) ? html`<div class="s-account-native" data-npm-left="1">
|
|
287
|
+
<p class="note s-account-why">${th("npmLeft", row.npmLeftover.dir)}</p>
|
|
288
|
+
<span class="s-actions"><button type="button" class="btn btn-sm btn-primary s-account-npm-remove" disabled=${blocked || installRunning(state)} onClick=${() => { void startHostNpmRemove(); }}>${th("npmRemove")}</button></span>
|
|
289
|
+
</div>` : null}
|
|
290
|
+
${row.nativeSwitch && row.backend === "claude-code" ? html`<div class="s-account-native" data-native-offer="1">
|
|
291
|
+
<p class="note s-account-why">${th("nativeOffer", row.nativeSwitch.npmPackageDir, u.audited)}</p>
|
|
292
|
+
<span class="s-actions"><button type="button" class="btn btn-sm btn-primary s-account-native-switch" aria-label=${`${label} — ${th("nativeSwitch")}`} disabled=${blocked || installRunning(state)} onClick=${() => { void startHostNativeSwitch(); }}>${th("nativeSwitch")}</button></span>
|
|
293
|
+
</div>` : null}
|
|
243
294
|
</div>`;
|
|
244
295
|
}
|
|
245
296
|
|
|
@@ -259,7 +310,26 @@ export function HostInstallRun({ backend, label }) {
|
|
|
259
310
|
const lines = Array.isArray(run.lines) ? run.lines : [];
|
|
260
311
|
let text, cls = "";
|
|
261
312
|
const update = run.mode === "update";
|
|
262
|
-
|
|
313
|
+
// M-3307: the switch and the removal say where `claude` resolves afterwards (a fresh login shell) and whether the npm copy is still there, with the removal offered on it.
|
|
314
|
+
const switching = run.mode === "native" || run.mode === "remove-npm";
|
|
315
|
+
const c = run.claude || null;
|
|
316
|
+
let npmLeft = null;
|
|
317
|
+
if (switching) {
|
|
318
|
+
if (run.phase === "running") text = run.mode === "native" ? th("runningNative", run.targetVersion || "?", run.startedOn) : th("runningNpmRemove", run.startedOn);
|
|
319
|
+
else if (run.phase === "ok" && run.mode === "native") {
|
|
320
|
+
if (!c || !c.path) { cls = "signin-message"; text = th("nativeUnverified"); }
|
|
321
|
+
else if (c.kind === "native") { cls = "signin-ok"; text = th("nativeOk", c.path, run.version || "?"); }
|
|
322
|
+
else { cls = "signin-warn"; text = th("nativeStillNpm", c.path); }
|
|
323
|
+
npmLeft = c && c.npmLeftover ? c.npmLeftover : null;
|
|
324
|
+
}
|
|
325
|
+
else if (run.phase === "ok") {
|
|
326
|
+
if (c && c.npmLeftover) { cls = "signin-warn"; text = th("npmNotRemoved", c.npmLeftover); }
|
|
327
|
+
else { cls = "signin-ok"; text = th("npmRemoved", (c && c.path) || "?", run.version || "?"); }
|
|
328
|
+
}
|
|
329
|
+
else if (run.phase === "failed" || run.phase === "timeout" || run.phase === "cancelled") text = th(run.mode === "native" ? "failedNative" : "failedNpmRemove");
|
|
330
|
+
}
|
|
331
|
+
if (switching) { /* said above */ }
|
|
332
|
+
else if (run.phase === "running") text = update ? (run.latest ? th("runningUpdateLatest", label, "", run.startedOn) : th("runningUpdate", label, run.targetVersion || "?", run.startedOn)) : th("running", label, run.startedOn);
|
|
263
333
|
else if (run.phase === "ok" && update) {
|
|
264
334
|
// An update says the version before and after (the binary probe's own readings). Exit code 0 is not enough: when the version read afterwards is not the audited release (`reached`
|
|
265
335
|
// false), or could not be read (null), it is a warning that names the installed and the audited version, not a success.
|
|
@@ -284,6 +354,10 @@ export function HostInstallRun({ backend, label }) {
|
|
|
284
354
|
${lines.length ? html`<pre class="s-account-install-output" aria-label=${th("output")}>${lines.join("\n")}</pre>`
|
|
285
355
|
: run.phase === "running" ? html`<small class="note">${th("runningNoOutput")}</small>` : null}
|
|
286
356
|
${run.cleanupFailed ? html`<p class="note">${th("cleanup")}</p>` : null}
|
|
357
|
+
${npmLeft ? html`<div class="s-account-native" data-npm-left="1">
|
|
358
|
+
<p class="note s-account-why">${th("npmLeft", npmLeft)}</p>
|
|
359
|
+
<span class="s-actions"><button type="button" class="btn btn-sm btn-primary s-account-npm-remove" disabled=${installRunning(state)} onClick=${() => { void startHostNpmRemove(); }}>${th("npmRemove")}</button></span>
|
|
360
|
+
</div>` : null}
|
|
287
361
|
<div class="s-actions">${run.phase === "running"
|
|
288
362
|
? html`<button type="button" class="btn btn-sm btn-ghost" disabled=${busy} onClick=${cancel}>${th(update ? "cancelUpdate" : "cancel")}</button>`
|
|
289
363
|
: html`<button type="button" class="btn btn-sm btn-ghost" onClick=${() => dismissHostInstall(run.id)}>${th("dismiss")}</button>`}</div>
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { html, useEffect, useRef, useState } from "/assets/app-html.js";
|
|
2
2
|
import { register, t } from "/assets/app-i18n.js";
|
|
3
3
|
register("hubIntro", {
|
|
4
|
-
en: {title:"Introduction",hint:"One line about what this agent handles. Colleagues can see it. Up to 50 characters.",placeholder:"I handle…",save:"Save introduction",failed:"Could not save the introduction. Try again.",saved:"
|
|
5
|
-
"zh-TW": {title:"自我介紹",hint:"用一句話說明這個 Agent 負責什麼,同仁會看到。最多 50 個字。",placeholder:"我負責…",save:"儲存自我介紹",failed:"無法儲存自我介紹,請再試一次。",saved:"
|
|
4
|
+
en: {title:"Introduction",hint:"One line about what this agent handles. Colleagues can see it. Up to 50 characters.",placeholder:"I handle…",save:"Save introduction",failed:"Could not save the introduction. Try again.",saved:"Saved. The agent can still change it later; this line shows who changed it last.",edit:"Edit",close:"Close",owner:"Last changed by the owner",agent:"Last changed by the agent",default:"From the Fleet description",review:"Colleagues will see this line. Check it and save.",cut:"Your earlier description was longer; only the first 50 characters are shown here.",assistant:"Hub assistant. Answers from this room's chat."},
|
|
5
|
+
"zh-TW": {title:"自我介紹",hint:"用一句話說明這個 Agent 負責什麼,同仁會看到。最多 50 個字。",placeholder:"我負責…",save:"儲存自我介紹",failed:"無法儲存自我介紹,請再試一次。",saved:"已儲存。Agent 之後仍然可以更改;這一行會顯示最後是誰改的。",edit:"編輯",close:"關閉",owner:"最後由擁有者修改",agent:"最後由 Agent 修改",default:"來自 Fleet 說明",review:"同仁會看到這一行,請確認後儲存。",cut:"你之前的說明比較長,這裡只顯示前 50 個字。",assistant:"Hub 提供的助理,根據這個房間的對話回答。"}
|
|
6
6
|
});
|
|
7
7
|
export const hi=(key,...args)=>t(`hubIntro.${key}`,...args);
|
|
8
8
|
const split=value=>[...new Intl.Segmenter(undefined,{granularity:"grapheme"}).segment(String(value??""))].map(v=>v.segment);
|
|
9
9
|
export const introCount=value=>split(value).length;
|
|
10
10
|
export const introPreview=value=>split(value).slice(0,50).join("");
|
|
11
|
-
export function AgentIntroEditor({exposure,client,onSaved=()=>{}}){
|
|
11
|
+
export function AgentIntroEditor({exposure,client,onSaved=()=>{},embedded=false}){
|
|
12
12
|
const [text,setText]=useState(exposure.intro??""),[busy,setBusy]=useState(false),[message,setMessage]=useState("");
|
|
13
13
|
const generation=useRef(0),pending=useRef(false);
|
|
14
14
|
useEffect(()=>{generation.current++;setText(exposure.intro??"");setMessage("");return()=>{generation.current++;};},[exposure.id,exposure.intro,exposure.introAt]);
|
|
@@ -17,10 +17,19 @@ export function AgentIntroEditor({exposure,client,onSaved=()=>{}}){
|
|
|
17
17
|
try{result=await client.saveAgentIntro(exposure.id,exposure.revision,text);}catch{result={ok:false};}
|
|
18
18
|
pending.current=false;if(mine!==generation.current)return;setBusy(false);setMessage(hi(result?.ok?"saved":"failed"));if(result?.ok)onSaved(result);
|
|
19
19
|
};
|
|
20
|
-
|
|
20
|
+
const Body=embedded?"div":"form";
|
|
21
|
+
return html`<section class=${embedded?"hub-agent-intro":"card hub-agent-intro"}>${embedded?null:html`<h3>${hi("title")}</h3>`}<${Body} class="form" onSubmit=${embedded?undefined:save}>
|
|
21
22
|
<label class="field"><span>${hi("title")}</span><input value=${text} placeholder=${hi("placeholder")} disabled=${busy} onInput=${e=>setText(e.target.value)} aria-invalid=${count>50?"true":null} /><small class="note">${`${hi("hint")} ${count}/50`}</small></label>
|
|
22
23
|
${exposure.introBy?html`<p class="note">${hi(exposure.introBy)}${exposure.introAt?html` · <time datetime=${new Date(exposure.introAt).toISOString()}>${new Date(exposure.introAt).toLocaleString()}</time>`:null}</p>`:null}
|
|
23
|
-
<div class="field-row"><button class="btn btn-sm btn-primary" disabled=${busy||count>50||text===(exposure.intro??"")}>${hi("save")}</button></div>
|
|
24
|
+
<div class="field-row"><button type=${embedded?"button":"submit"} onClick=${embedded?save:undefined} class="btn btn-sm btn-primary" disabled=${busy||count>50||text===(exposure.intro??"")}>${hi("save")}</button></div>
|
|
24
25
|
${message?html`<p role="status">${message}</p>`:null}
|
|
25
|
-
|
|
26
|
+
</${Body}></section>`;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/** Form-free: the sharing dialog already owns the grant form. */
|
|
30
|
+
export function AgentIntroSharingPreview({exposure,client,onSaved=()=>{}}){
|
|
31
|
+
const [editing,setEditing]=useState(false),[saved,setSaved]=useState(null);
|
|
32
|
+
const value={...exposure,...saved},text=value.introBy?value.intro:(value.introDefault??value.intro??"");
|
|
33
|
+
return html`<div class="hub-intro-sharing-preview"><p class="note">${hi("title")}${text?`: ${text}`:""}</p><button type="button" class="btn btn-sm btn-ghost" onClick=${()=>setEditing(!editing)}>${hi(editing?"close":"edit")}</button>
|
|
34
|
+
${editing?html`<${AgentIntroEditor} embedded=${true} exposure=${{...value,intro:text}} client=${client} onSaved=${result=>{setSaved(result);setEditing(false);onSaved(result);}} />`:null}</div>`;
|
|
26
35
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// stylesheet has had since the fleet chat's own attachments (.pending-files, .file-chip, .chip-x).
|
|
4
4
|
// The server decides everything: a room offers Attach only while its fleet link negotiated attachments-v1 (room.features);
|
|
5
5
|
// each file is uploaded on choice (typed by name, images by their bytes, within the limits), and Send names the ids.
|
|
6
|
-
import { html } from "/assets/app-html.js";
|
|
6
|
+
import { html, useEffect, useRef } from "/assets/app-html.js";
|
|
7
7
|
import { register, t } from "/assets/app-i18n.js";
|
|
8
8
|
import { Icon } from "/assets/ui-icons.js";
|
|
9
9
|
|
|
@@ -67,7 +67,8 @@ export async function uploadChosen(client, roomId, fileList, { current, set, ali
|
|
|
67
67
|
const room = Math.max(0, MAX_FILES - current().length);
|
|
68
68
|
if (chosen.length > room) refusals.push(hf("tooMany", MAX_FILES));
|
|
69
69
|
const admitted = chosen.slice(0, room).map((file) => ({ file, key: `${Date.now()}-${Math.random().toString(36).slice(2)}` }));
|
|
70
|
-
|
|
70
|
+
// M-3311 (3): a long paste's chip keeps its text, for the Fleet chat's 「改為文字」 (PendingFiles' onAsText).
|
|
71
|
+
if (admitted.length) set([...current(), ...admitted.map(({ file, key }) => ({ key, name: file.name, size: file.size, state: "uploading", ...(pastedTexts.has(file) ? { text: pastedTexts.get(file) } : {}) }))]);
|
|
71
72
|
for (const { file, key } of admitted) {
|
|
72
73
|
if (!alive()) break;
|
|
73
74
|
if (!current().some((f) => f.key === key)) continue;
|
|
@@ -80,11 +81,88 @@ export async function uploadChosen(client, roomId, fileList, { current, set, ali
|
|
|
80
81
|
return refusals;
|
|
81
82
|
}
|
|
82
83
|
|
|
84
|
+
// ── M-3308 / M-3311: the Fleet chat's paste and drop (panel-chat.js onPaste, its drag-and-drop), for a Hub conversation — a
|
|
85
|
+
// room and a 1:1 question alike, through their own Attach (`attach`: { onFiles(list) → refusals, left?() → files that still
|
|
86
|
+
// fit, notice?(text) }) and so the Hub's file rules (uploadChosen above). Words: the Fleet chat's own (chat.*).
|
|
87
|
+
|
|
88
|
+
/** Past this many characters a text paste goes as a text file (the Fleet chat's LONG_PASTE_CHARS, chat-render.js). */
|
|
89
|
+
export const LONG_PASTE_CHARS = 4000;
|
|
90
|
+
const isLongPaste = (text) => (globalThis.AgendChatRender?.isLongPaste ? globalThis.AgendChatRender.isLongPaste(text) : typeof text === "string" && text.length > LONG_PASTE_CHARS);
|
|
91
|
+
const stamp = () => new Date().toISOString().slice(0, 19).replace(/[-:T]/g, "");
|
|
92
|
+
const IMAGE_EXT = { "image/png": "png", "image/jpeg": "jpg", "image/gif": "gif", "image/webp": "webp" };
|
|
93
|
+
/**
|
|
94
|
+
* A pasted file as the Hub uploads it. A clipboard picture (a screen capture) may come with no name — the Hub refuses an
|
|
95
|
+
* upload without one — so it is named `screenshot-<time>.<png|jpg|…>` by its type; a named one (Chrome's "image.png", a
|
|
96
|
+
* copied file) keeps its own.
|
|
97
|
+
*/
|
|
98
|
+
export function pastedFile(file) {
|
|
99
|
+
if (!file || (file.name && file.name.trim())) return file;
|
|
100
|
+
const ext = IMAGE_EXT[file.type] || (String(file.type).startsWith("text/") ? "txt" : "bin");
|
|
101
|
+
return new File([file], `${String(file.type).startsWith("image/") ? "screenshot" : "pasted"}-${stamp()}.${ext}`, { type: file.type, lastModified: file.lastModified });
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* A paste into a Hub composer: its files are attached (the paste stops there unless text came with them); a text past
|
|
105
|
+
* LONG_PASTE_CHARS goes as `pasted-<time>.txt` — only when there is room for it (#4151 review: as the Fleet chat keeps it in the
|
|
106
|
+
* box when nothing more fits), and once attached it says so (the Fleet chat's notice). No `attach`: the box takes it, as ever.
|
|
107
|
+
*/
|
|
108
|
+
export function pasteToAttach(e, attach) {
|
|
109
|
+
if (!attach) return;
|
|
110
|
+
const list = e.clipboardData && e.clipboardData.files ? [...e.clipboardData.files] : [];
|
|
111
|
+
const text = e.clipboardData ? e.clipboardData.getData("text") : "";
|
|
112
|
+
if (list.length) { void attach.onFiles(list.map(pastedFile)); if (!text) e.preventDefault(); return; }
|
|
113
|
+
if (!isLongPaste(text)) return;
|
|
114
|
+
if (typeof attach.left === "function" && attach.left() < 1) { attach.notice?.(t("chat.pasteKeptAsText")); return; }
|
|
115
|
+
e.preventDefault();
|
|
116
|
+
const file = new File([text], `pasted-${stamp()}.txt`, { type: "text/plain" });
|
|
117
|
+
pastedTexts.set(file, text);
|
|
118
|
+
Promise.resolve(attach.onFiles([file])).then((refused) => { if (!refused || !refused.length) attach.notice?.(t("chat.pasteAttached", text.length.toLocaleString())); });
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* M-3311 (1): files dragged over a Hub conversation (the `.hub-chat-main` at `ref`) show where they go; a drop attaches them —
|
|
122
|
+
* the Fleet chat's own (counted, so moving over messages does not flicker). Nothing while the conversation takes no files.
|
|
123
|
+
*/
|
|
124
|
+
export function useFileDrop(ref, attach) {
|
|
125
|
+
const on = !!attach, latest = useRef(attach);
|
|
126
|
+
latest.current = attach; // the latest Attach (it closes over the conversation's current list), read at the drop
|
|
127
|
+
useEffect(() => {
|
|
128
|
+
const el = ref.current; if (!el || !on) return undefined;
|
|
129
|
+
let depth = 0;
|
|
130
|
+
const hasFiles = (e) => !!(e.dataTransfer && [...(e.dataTransfer.types || [])].includes("Files"));
|
|
131
|
+
const enter = (e) => { if (hasFiles(e)) { depth++; el.classList.add("dragging"); } };
|
|
132
|
+
const over = (e) => { if (hasFiles(e)) e.preventDefault(); };
|
|
133
|
+
const leave = (e) => { if (hasFiles(e) && --depth <= 0) { depth = 0; el.classList.remove("dragging"); } };
|
|
134
|
+
const drop = (e) => {
|
|
135
|
+
depth = 0; el.classList.remove("dragging");
|
|
136
|
+
const files = e.dataTransfer && e.dataTransfer.files ? [...e.dataTransfer.files] : [];
|
|
137
|
+
if (!files.length) return;
|
|
138
|
+
e.preventDefault(); void latest.current?.onFiles(files.map(pastedFile));
|
|
139
|
+
};
|
|
140
|
+
el.addEventListener("dragenter", enter); el.addEventListener("dragover", over); el.addEventListener("dragleave", leave); el.addEventListener("drop", drop);
|
|
141
|
+
return () => { el.classList.remove("dragging"); el.removeEventListener("dragenter", enter); el.removeEventListener("dragover", over); el.removeEventListener("dragleave", leave); el.removeEventListener("drop", drop); };
|
|
142
|
+
}, [ref.current, on]);
|
|
143
|
+
}
|
|
144
|
+
/** M-3311 (3): what a long paste became a file of — its chip can put it back as text (the Fleet chat's 「改為文字」). */
|
|
145
|
+
const pastedTexts = new WeakMap();
|
|
146
|
+
/**
|
|
147
|
+
* M-3311 (3): a long paste's text back into the box — after what is there, on a new line (the Fleet chat's fileBackAsText) —
|
|
148
|
+
* through the box's own typing path (its value setter and an input event: the composer's draft takes it).
|
|
149
|
+
*/
|
|
150
|
+
export function putBackText(field, text) {
|
|
151
|
+
if (!field || typeof text !== "string") return;
|
|
152
|
+
const value = field.value || "", next = value ? `${value}\n${text}` : text;
|
|
153
|
+
const set = typeof HTMLTextAreaElement === "function" ? Object.getOwnPropertyDescriptor(HTMLTextAreaElement.prototype, "value")?.set : null;
|
|
154
|
+
if (set) set.call(field, next); else field.value = next;
|
|
155
|
+
field.dispatchEvent(new Event("input", { bubbles: true }));
|
|
156
|
+
}
|
|
157
|
+
/** Where a dragged file goes: the Fleet chat's drop card (shown by `.dragging` on the conversation). */
|
|
158
|
+
export const DropOverlay = () => html`<div data-trust="drop" class="drop-overlay" aria-hidden="true"><div class="drop-card"><${Icon} name="attach" size=${32} /><span>${t("chat.dropHere")}</span></div></div>`;
|
|
159
|
+
|
|
83
160
|
/** The files waiting under the composer. */
|
|
84
|
-
export function PendingFiles({ files, onRemove, formatSize = (n) => `${n} B` }) {
|
|
161
|
+
export function PendingFiles({ files, onRemove, onAsText = null, formatSize = (n) => `${n} B` }) {
|
|
85
162
|
if (!files.length) return null;
|
|
86
163
|
return html`<div class="pending-files hub-pending-files">${files.map((f) => html`<span key=${f.key} class="file-chip" data-state=${f.state}>
|
|
87
164
|
<span class="ic"><${Icon} name="file" size=${16} /></span><span class="nm">${f.name}</span>
|
|
88
165
|
<span class="sz">${f.state === "uploading" ? hf("uploading") : formatSize(f.size)}</span>
|
|
166
|
+
${typeof f.text === "string" && onAsText ? html`<button type="button" class="as-text" onClick=${() => onAsText(f.key)}>${t("chat.asText")}</button>` : null}
|
|
89
167
|
<button type="button" class="chip-x" title=${hf("remove", f.name)} aria-label=${hf("remove", f.name)} onClick=${() => onRemove(f.key)}><${Icon} name="close" size=${14} /></button></span>`)}</div>`;
|
|
90
168
|
}
|
package/dist/ui/hub-client.js
CHANGED
|
@@ -378,6 +378,9 @@ export function createHubWebClient({ fetchImpl = (...a) => fetch(...a), readTime
|
|
|
378
378
|
savePersonPrefs(sessionCsrf, favorites, onlyIfUnset = false) {
|
|
379
379
|
return sessionCsrf && sessionCsrf === csrf ? call("PUT", "/hub/v1/me/prefs", { favorites, onlyIfUnset }) : Promise.resolve(retired());
|
|
380
380
|
},
|
|
381
|
+
agentIntroDefaultsV1: true,
|
|
382
|
+
introNotice: () => call("GET", "/hub/v1/me/intro-notice"),
|
|
383
|
+
acknowledgeIntroNotice: () => call("DELETE", "/hub/v1/me/intro-notice"),
|
|
381
384
|
agentSharingV1: true,
|
|
382
385
|
ownAgents(scope) { return scope && scope === csrf ? call("GET", "/hub/v1/me/agents") : Promise.resolve(retired()); },
|
|
383
386
|
refreshOwnAgents(scope, fleetId) { return scope && scope === csrf ? call("POST", "/hub/v1/me/agents/refresh", { fleetId }) : Promise.resolve(retired()); },
|
|
@@ -447,6 +450,7 @@ export function createHubWebClient({ fetchImpl = (...a) => fetch(...a), readTime
|
|
|
447
450
|
/** → { ok, room, me: { role }, members: [Member], settings: { allMention, historyForNew } } */
|
|
448
451
|
room(roomId) { return call("GET", `/hub/v1/rooms/${id(roomId)}`); },
|
|
449
452
|
/** A group room: { name, people: [personId], teams: [teamId], groups: [groupId], agents: [exposureId], assistant }. */
|
|
453
|
+
roomPurposeV1: true,
|
|
450
454
|
createRoom(input) { return call("POST", "/hub/v1/rooms", input); },
|
|
451
455
|
/** { name?, allMention?, historyForNew?, assistant?, archived? } */
|
|
452
456
|
updateRoom(roomId, patch) { return call("PATCH", `/hub/v1/rooms/${id(roomId)}`, patch); },
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import {html,useEffect,useRef,useState} from "/assets/app-html.js";
|
|
2
|
+
import {register,t} from "/assets/app-i18n.js";
|
|
3
|
+
register("hubIntroNotice",{
|
|
4
|
+
en:{title:"Agent introductions",body:"Introductions now show for {0} of your agents. Review them.",more:"Introductions now show for {0} more of your agents, from {1}. Review them.",fleet:"a Fleet",review:"Review {0}",ack:"Done",failed:"Could not load the introduction notice. Try again.",saveFailed:"Could not dismiss the notice. Try again.",retry:"Try again"},
|
|
5
|
+
"zh-TW":{title:"Agent 自我介紹",body:"你的 {0} 個 Agent 現在會顯示自我介紹,請檢查內容。",more:"你在 {1} 的 {0} 個 Agent 現在也會顯示自我介紹,請檢查內容。",fleet:"一個 Fleet",review:"檢查 {0}",ack:"完成",failed:"無法載入自我介紹通知,請再試一次。",saveFailed:"無法關閉通知,請再試一次。",retry:"再試一次"}
|
|
6
|
+
});
|
|
7
|
+
const word=(key,...args)=>t(`hubIntroNotice.${key}`,...args);
|
|
8
|
+
export const introNoticeOffered=(session,client)=>session?.features?.includes("agent-intro-defaults-v1")&&client?.agentIntroDefaultsV1===true;
|
|
9
|
+
export function IntroNotice({client}){
|
|
10
|
+
const [notice,setNotice]=useState(null),[failed,setFailed]=useState(false),[busy,setBusy]=useState(false),epoch=useRef(0);
|
|
11
|
+
const load=async()=>{const mine=epoch.current;try{const out=await client.introNotice();if(mine!==epoch.current)return;if(!out.ok){setFailed(true);return;}setNotice(out.notice);setFailed(false);}catch{if(mine===epoch.current)setFailed(true);}};
|
|
12
|
+
useEffect(()=>{epoch.current++;void load();return()=>{epoch.current++;};},[client]);
|
|
13
|
+
const ack=async()=>{if(busy)return;const mine=epoch.current;setBusy(true);try{const out=await client.acknowledgeIntroNotice();if(mine!==epoch.current)return;if(out.ok)setNotice(null);else setFailed(true);}catch{if(mine===epoch.current)setFailed(true);}finally{if(mine===epoch.current)setBusy(false);}};
|
|
14
|
+
if(!notice&&!failed)return null;
|
|
15
|
+
return html`<section class="card hub-intro-notice"><h3>${word("title")}</h3>${failed?html`<p class="err" role="alert">${word(notice?"saveFailed":"failed")}</p><button class="btn btn-sm" onClick=${load}>${word("retry")}</button>`:null}${notice?html`${notice.batches.map(batch=>html`<article key=${batch.fleetId}><p>${word(batch.more?"more":"body",batch.agents.length,batch.fleet||word("fleet"))}</p><ul>${batch.agents.map(agent=>html`<li key=${agent.id}><a class="btn btn-sm btn-ghost" href=${`/ui/hub/exposures?agent=${encodeURIComponent(agent.id)}`}>${word("review",agent.name)}</a></li>`)}</ul></article>`)}<button class="btn btn-sm" disabled=${busy} onClick=${ack}>${word("ack")}</button>`:null}</section>`;
|
|
16
|
+
}
|
package/dist/ui/hub-my-agents.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { AgentIntroSharingPreview } from "./hub-agent-intro.js";
|
|
1
2
|
/** Owner-only inventory. Saved requests survive page refresh; Fleet snapshots decide the result. */
|
|
2
3
|
import { lang } from "/assets/app-i18n.js";
|
|
3
4
|
import { html, useEffect, useRef, useState } from "/assets/app-html.js";
|
|
@@ -131,11 +132,13 @@ export function HubMyAgents({ client, scope, shared = [], policy = false, person
|
|
|
131
132
|
</div>`;
|
|
132
133
|
}
|
|
133
134
|
function SharingAccess({ targets, client, scope, subjects, onAllow, onClose }) {
|
|
135
|
+
const [introUpdates,setIntroUpdates]=useState({});
|
|
136
|
+
const introPreview=x=>client.agentIntrosV1?html`<${AgentIntroSharingPreview} key=${x.id} exposure=${{...x,...introUpdates[x.id]}} client=${client} onSaved=${value=>setIntroUpdates(old=>({...old,[x.id]:value}))} />`:null;
|
|
134
137
|
const [mode, setMode] = useState(targets.length === 1 ? "each" : null), [pick, setPick] = useState(null), [previous, setPrevious] = useState({}), [outcomes, setOutcomes] = useState({}), [busy, setBusy] = useState(false);
|
|
135
138
|
const life = useRef(0);
|
|
136
139
|
useEffect(() => { const generation = life.current; void Promise.all(targets.map(async x => [x.id, await client.previousAgentAccess(scope, x.id)])).then(rows => { if (generation === life.current) setPrevious(Object.fromEntries(rows)); }); return () => { life.current++; }; }, [client, scope, targets]);
|
|
137
140
|
useEffect(() => { if (targets.length === 1 && !pick) setPick(targets); }, []);
|
|
138
141
|
const usePrevious = async x => { if (busy) return; const generation = life.current; setBusy(true); const r = await client.usePreviousAgentAccess(scope, x.id, { revision: x.revision, digest: previous[x.id]?.previous?.digest }); if (generation === life.current) { setOutcomes(old => ({ ...old, [x.id]: r.ok ? ms("used") : ms("saveFailed", x.displayName) })); setBusy(false); } };
|
|
139
|
-
if (pick) return html`<${HubGrantPicker} x=${pick[0]} legacy=${!subjects} targets=${pick} client=${client} act=${async fn => fn()} grant=${input => client.ownerGrant(scope, input)} onClose=${() => setPick(null)} onResults=${results => setOutcomes(old => ({ ...old, ...results }))} extra=${pick.length === 1 && previous[pick[0].id]?.previous ? html`<button class="btn" disabled=${busy} onClick=${() => usePrevious(pick[0])}>${ms(previous[pick[0].id].previous.peopleCount === null ? "previousMixed" : "previous", previous[pick[0].id].previous.count)}</button>${outcomes[pick[0].id] ? html`<p role="status">${outcomes[pick[0].id]}</p>` : null}` : null} />`;
|
|
140
|
-
return html`<${Dialog} title=${mc("accessTitle", targets.length)} onClose=${onClose} actions=${html`<button class="btn" onClick=${onClose}>${ms("later")}</button>`}><p>${ms("accessLead")}</p><div class="field-row"><button class="btn btn-primary" onClick=${() => { setMode("same"); setPick(targets); }}>${ms("same", targets.length)}</button><button class="btn" onClick=${() => setMode("each")}>${ms("each")}</button></div><ul class="hub-share-access-list">${targets.map(x => html`<li class="hub-share-access-item"><
|
|
142
|
+
if (pick) return html`<${HubGrantPicker} x=${pick[0]} legacy=${!subjects} targets=${pick} client=${client} act=${async fn => fn()} grant=${input => client.ownerGrant(scope, input)} onClose=${() => setPick(null)} onResults=${results => setOutcomes(old => ({ ...old, ...results }))} extra=${html`${pick.map(x=>html`<div key=${x.id}><strong>${x.displayName}</strong>${introPreview(x)}</div>`)}${pick.length === 1 && previous[pick[0].id]?.previous ? html`<button class="btn" disabled=${busy} onClick=${() => usePrevious(pick[0])}>${ms(previous[pick[0].id].previous.peopleCount === null ? "previousMixed" : "previous", previous[pick[0].id].previous.count)}</button>${outcomes[pick[0].id] ? html`<p role="status">${outcomes[pick[0].id]}</p>` : null}` : null}`} />`;
|
|
143
|
+
return html`<${Dialog} title=${mc("accessTitle", targets.length)} onClose=${onClose} actions=${html`<button class="btn" onClick=${onClose}>${ms("later")}</button>`}><p>${ms("accessLead")}</p><div class="field-row"><button class="btn btn-primary" onClick=${() => { setMode("same"); setPick(targets); }}>${ms("same", targets.length)}</button><button class="btn" onClick=${() => setMode("each")}>${ms("each")}</button></div><ul class="hub-share-access-list">${targets.map(x => html`<li class="hub-share-access-item"><div class="hub-row-text"><strong>${x.displayName}</strong>${introPreview(x)}${outcomes[x.id] ? html`<small role="status">${outcomes[x.id]}</small>` : null}</div>${mode === "each" ? html`<button class="btn btn-sm" onClick=${() => setPick([x])}>${ms("choose")}</button>` : null}${previous[x.id]?.previous ? html`<button class="btn btn-sm" disabled=${busy} onClick=${() => usePrevious(x)}>${ms(previous[x.id].previous.peopleCount === null ? "previousMixed" : "previous", previous[x.id].previous.count)}</button>` : null}</li>`)}</ul></${Dialog}>`;
|
|
141
144
|
}
|
|
@@ -13,6 +13,7 @@ import { t } from "/assets/app-i18n.js";
|
|
|
13
13
|
import { Icon } from "/assets/ui-icons.js";
|
|
14
14
|
import { hroom } from "./hub-room-strings.js";
|
|
15
15
|
import { presenceDot } from "./hub-room-presence.js";
|
|
16
|
+
import { pasteToAttach } from "./hub-attachments.js";
|
|
16
17
|
|
|
17
18
|
const ONLINE = new Set(["online", "idle", "working"]);
|
|
18
19
|
const agentsOf = (detail) => (detail?.members || []).filter((m) => m.kind === "agent" || m.kind === "later");
|
|
@@ -78,6 +79,9 @@ export function mentionsIn(text, detail) {
|
|
|
78
79
|
return [...new Set(out)];
|
|
79
80
|
}
|
|
80
81
|
|
|
82
|
+
// M-3308: the paste helpers live with the Hub's files (hub-attachments.js), shared with the 1:1 question's composer (M-3311).
|
|
83
|
+
export { LONG_PASTE_CHARS, pastedFile } from "./hub-attachments.js";
|
|
84
|
+
|
|
81
85
|
/** Above the box when @所有 Agent is in it: how many answer now, how many after they come back (spec §4). */
|
|
82
86
|
export function allBar(detail) {
|
|
83
87
|
const agents = agentsOf(detail), online = agents.filter((a) => ONLINE.has(a.presence)).length;
|
|
@@ -132,6 +136,9 @@ export function RoomComposer({ store, detail, reply = null, onReply = () => {},
|
|
|
132
136
|
if (globalThis.AgendChatRender?.composerKey(e, { touch: touchScreen() }) === "send") { e.preventDefault(); void send(); }
|
|
133
137
|
};
|
|
134
138
|
const track = (v) => { setValue(v); setMsg(null); setCaret(input.current ? input.current.selectionStart ?? v.length : v.length); };
|
|
139
|
+
// M-3308 (the user: a screenshot pasted with Ctrl+V did nothing in a room): the Fleet chat's paste, through the room's own
|
|
140
|
+
// Attach and its file rules (hub-attachments.js pasteToAttach). A room that takes no files keeps the text (as before).
|
|
141
|
+
const onPaste = (e) => { if (!closed) pasteToAttach(e, attach); };
|
|
135
142
|
const paletteId = `hubMention-${room.id || "room"}`, optId = (o) => `${paletteId}-${o.key}`;
|
|
136
143
|
// M-3117: as the Fleet chat's dock has it — the box, then a failed send, then the line under it (its .composer-row).
|
|
137
144
|
if (closed) return html`<p class="hub-banner warn" role="status">${hroom(detail?.room?.archived ? "errArchived" : "errNotMember")}</p>`;
|
|
@@ -145,11 +152,12 @@ export function RoomComposer({ store, detail, reply = null, onReply = () => {},
|
|
|
145
152
|
${group && value.includes(hroom("mentionAll")) ? html`<p class="note hub-room-allbar" role="status">${allBar(detail)}</p>` : null}
|
|
146
153
|
${reply ? html`<div class="reply-bar" data-trust="composer" role="status"><span class="reply-text">${reply.sender ? `${reply.sender} · ` : ""}${String(reply.text || "").slice(0, 80)}</span>
|
|
147
154
|
<button type="button" class="icon-btn reply-cancel" title=${hroom("cancel")} aria-label=${hroom("cancel")} onClick=${() => { onReply(null); input.current?.focus(); }}><${Icon} name="close" size=${14} /></button></div>` : null}
|
|
148
|
-
<${ComposerInput} inputRef=${input} value=${value} attach=${attach} placeholder=${room.assistant ? hroom("composerAssistant") : group ? (short ? hroom("composerShort") : hroom("composer", room.name || "")) : hroom("composerDirect", room.name || "")} onValue=${track} onKeyDown=${onKeyDown}
|
|
155
|
+
<${ComposerInput} inputRef=${input} value=${value} attach=${attach} onPaste=${onPaste} placeholder=${room.assistant ? hroom("composerAssistant") : group ? (short ? hroom("composerShort") : hroom("composer", room.name || "")) : hroom("composerDirect", room.name || "")} onValue=${track} onKeyDown=${onKeyDown}
|
|
149
156
|
controls=${palette ? paletteId : undefined} expanded=${!!palette} activeDescendant=${chosen ? optId(chosen) : undefined}
|
|
150
157
|
stop=${{ hidden: true, disabled: true, title: t("chat.stopReply"), label: t("chat.stopReply"), onClick: () => {} }}
|
|
151
158
|
send=${{ hidden: false, disabled: (!value.trim() && !canSendEmpty) || busy, label: t("chat.send"), onClick: () => { void send(); } }} />
|
|
152
159
|
</div>
|
|
153
160
|
${msg ? html`<p class="err" role="alert">${msg.text}${msg.retry ? html` <button type="button" class="btn btn-sm" onClick=${send}>${hroom("retrySend")}</button>` : null}</p>` : null}
|
|
154
|
-
${
|
|
161
|
+
${/* M-3311 (3): the Fleet chat's line under the box — Enter sends, Shift+Enter a new line — and a group room's @agent hint after it. */ ""}
|
|
162
|
+
<div class=${`composer-row${group ? " hub-hints" : ""}`}><span class="hint hub-enter-hint">${t(touchScreen() ? "chat.nativeComposerHintTouch" : "chat.nativeComposerHint")}</span>${group ? html`<span class="hint hub-room-hint">${hroom("composerHint")}</span>` : null}</div>`;
|
|
155
163
|
}
|
package/dist/ui/hub-room-list.js
CHANGED
|
@@ -72,7 +72,7 @@ export function rowView(r) {
|
|
|
72
72
|
const group = r.kind === "group", limited = r.limited === true;
|
|
73
73
|
// Today's chats keep what their row said: closed, or a question waiting (the Fleet's working dot), else its owner.
|
|
74
74
|
const closed = limited && r.legacy?.state === "closed", waiting = limited && !closed && r.legacy?.waiting === true;
|
|
75
|
-
const line2 = group ? countsLine(r.people, r.agents)
|
|
75
|
+
const line2 = group ? [countsLine(r.people, r.agents),r.purpose].filter(Boolean).join(" · ")
|
|
76
76
|
: closed ? t("hubChat.tagClosed") : waiting ? t("hubChat.waiting")
|
|
77
77
|
: r.assistant ? hi("assistant") : [r.agent?.intro,r.agent?.answerOnly ? hp("answerOnlyAsker") : String(r.agent?.owner?.name || "")].filter(Boolean).join(" · ");
|
|
78
78
|
return {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import {rp} from "./hub-room-purpose.js";
|
|
1
2
|
import { hi } from "./hub-agent-intro.js";
|
|
2
3
|
// Hub rooms, the right-hand members panel (docs/design/hub-rooms-ux.md section 5): the people, the agents in presence
|
|
3
4
|
// order, the room assistant, who can see what, and (for a room manager) the way to Room settings. Clicking an agent
|
|
@@ -80,6 +81,7 @@ export function RoomMembersPanel({ client = hubClient(), roomId, detail, onMenti
|
|
|
80
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}`;
|
|
81
82
|
};
|
|
82
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}
|
|
83
85
|
<section><h4>${heads.member}</h4>
|
|
84
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>
|
|
85
87
|
</section>
|
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;
|
|
@@ -79,7 +80,8 @@ export function RoomPicker({ client, kinds, picked, onChange, placeholder, label
|
|
|
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}
|