@songsid/agend 2.4.0-beta.8 → 2.4.0-beta.9
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/auth-api.js +3 -0
- package/dist/auth-api.js.map +1 -1
- package/dist/backend/cli-runtime-switch.js +1 -26
- package/dist/backend/cli-runtime-switch.js.map +1 -1
- package/dist/build-provenance.json +1 -1
- package/dist/connect/mcp.d.ts +9 -0
- package/dist/connect/mcp.js +10 -0
- package/dist/connect/mcp.js.map +1 -0
- package/dist/connect/stdio.d.ts +1 -1
- package/dist/connect/stdio.js +22 -28
- package/dist/connect/stdio.js.map +1 -1
- package/dist/fleet-manager.d.ts +1 -1
- package/dist/fleet-manager.js +11 -16
- package/dist/fleet-manager.js.map +1 -1
- package/dist/general-knowledge/skills/hub/SKILL.md +78 -4
- package/dist/general-knowledge/skills/web-dashboard/SKILL.md +10 -2
- package/dist/hub/admin-dashboard.js +17 -1
- package/dist/hub/admin-dashboard.js.map +1 -1
- package/dist/hub/audit/index.d.ts +2 -0
- package/dist/hub/audit/index.js +8 -0
- package/dist/hub/audit/index.js.map +1 -1
- package/dist/hub/buttons.js +3 -1
- package/dist/hub/buttons.js.map +1 -1
- package/dist/hub/catalog.d.ts +1 -0
- package/dist/hub/catalog.js +6 -4
- package/dist/hub/catalog.js.map +1 -1
- package/dist/hub/client.d.ts +3 -0
- package/dist/hub/client.js +14 -2
- package/dist/hub/client.js.map +1 -1
- package/dist/hub/compose/member.js +28 -11
- package/dist/hub/compose/member.js.map +1 -1
- package/dist/hub/compose/server.d.ts +5 -0
- package/dist/hub/compose/server.js +91 -10
- package/dist/hub/compose/server.js.map +1 -1
- package/dist/hub/group-policy/admin-api.d.ts +1 -0
- package/dist/hub/group-policy/admin-api.js +1 -1
- package/dist/hub/group-policy/admin-api.js.map +1 -1
- package/dist/hub/group-policy/admin-dto.d.ts +2 -1
- package/dist/hub/group-policy/admin-inventory.d.ts +2 -0
- package/dist/hub/group-policy/admin-inventory.js +13 -4
- package/dist/hub/group-policy/admin-inventory.js.map +1 -1
- package/dist/hub/group-policy/authorization.d.ts +2 -0
- package/dist/hub/group-policy/authorization.js +7 -2
- package/dist/hub/group-policy/authorization.js.map +1 -1
- package/dist/hub/group-policy/resources.d.ts +2 -0
- package/dist/hub/group-policy/resources.js +12 -1
- package/dist/hub/group-policy/resources.js.map +1 -1
- package/dist/hub/http/compose.js +99 -22
- package/dist/hub/http/compose.js.map +1 -1
- package/dist/hub/http/core.js +27 -3
- package/dist/hub/http/core.js.map +1 -1
- package/dist/hub/http/deps.d.ts +11 -0
- package/dist/hub/http/schema.js +6 -0
- package/dist/hub/http/schema.js.map +1 -1
- package/dist/hub/mcp/auth.d.ts +3 -0
- package/dist/hub/mcp/auth.js +11 -1
- package/dist/hub/mcp/auth.js.map +1 -1
- package/dist/hub/mcp/catalog.d.ts +44 -0
- package/dist/hub/mcp/catalog.js +31 -0
- package/dist/hub/mcp/catalog.js.map +1 -0
- package/dist/hub/mcp/door-schema.d.ts +7 -0
- package/dist/hub/mcp/door-schema.js +20 -0
- package/dist/hub/mcp/door-schema.js.map +1 -0
- package/dist/hub/mcp/http.d.ts +25 -0
- package/dist/hub/mcp/http.js +259 -0
- package/dist/hub/mcp/http.js.map +1 -0
- package/dist/hub/mcp/policy.d.ts +65 -0
- package/dist/hub/mcp/policy.js +153 -0
- package/dist/hub/mcp/policy.js.map +1 -0
- package/dist/hub/mcp/server.d.ts +3 -0
- package/dist/hub/mcp/server.js +32 -0
- package/dist/hub/mcp/server.js.map +1 -0
- package/dist/hub/mcp/tools.d.ts +31 -0
- package/dist/hub/mcp/tools.js +176 -0
- package/dist/hub/mcp/tools.js.map +1 -0
- package/dist/hub/member/room-ask.d.ts +4 -4
- package/dist/hub/member/room-ask.js +12 -0
- package/dist/hub/member/room-ask.js.map +1 -1
- package/dist/hub/member/room-mention-feedback.d.ts +44 -0
- package/dist/hub/member/room-mention-feedback.js +121 -0
- package/dist/hub/member/room-mention-feedback.js.map +1 -0
- package/dist/hub/member/room-notification.d.ts +9 -0
- package/dist/hub/member/room-notification.js +2 -0
- package/dist/hub/member/room-notification.js.map +1 -0
- package/dist/hub/member/room-post-answers.d.ts +1 -7
- package/dist/hub/member/room-post-answers.js.map +1 -1
- package/dist/hub/member/room-post.d.ts +3 -0
- package/dist/hub/member/room-post.js +9 -1
- package/dist/hub/member/room-post.js.map +1 -1
- package/dist/hub/pairing.d.ts +15 -1
- package/dist/hub/pairing.js +33 -2
- package/dist/hub/pairing.js.map +1 -1
- package/dist/hub/personal/owner-host.d.ts +76 -0
- package/dist/hub/personal/owner-host.js +137 -40
- package/dist/hub/personal/owner-host.js.map +1 -1
- package/dist/hub/personal/refusals.d.ts +11 -0
- package/dist/hub/personal/refusals.js +33 -0
- package/dist/hub/personal/refusals.js.map +1 -0
- package/dist/hub/personal/runtime-host.d.ts +26 -0
- package/dist/hub/personal/runtime-host.js +51 -0
- package/dist/hub/personal/runtime-host.js.map +1 -0
- package/dist/hub/personal/schema.d.ts +2 -0
- package/dist/hub/personal/schema.js +7 -1
- package/dist/hub/personal/schema.js.map +1 -1
- package/dist/hub/personal/turns.d.ts +39 -0
- package/dist/hub/personal/turns.js +221 -0
- package/dist/hub/personal/turns.js.map +1 -0
- package/dist/hub/personal/types.d.ts +1 -1
- package/dist/hub/policy.d.ts +1 -1
- package/dist/hub/protocol.d.ts +43 -0
- package/dist/hub/protocol.js +16 -4
- package/dist/hub/protocol.js.map +1 -1
- package/dist/hub/roles/admin-control.js +69 -16
- package/dist/hub/roles/admin-control.js.map +1 -1
- package/dist/hub/roles/admin-types.d.ts +24 -1
- package/dist/hub/roles/allowed-list-control.d.ts +34 -0
- package/dist/hub/roles/allowed-list-control.js +179 -0
- package/dist/hub/roles/allowed-list-control.js.map +1 -0
- package/dist/hub/roles/allowed-list.d.ts +8 -0
- package/dist/hub/roles/allowed-list.js +49 -0
- package/dist/hub/roles/allowed-list.js.map +1 -0
- package/dist/hub/roles/audit-details.d.ts +144 -0
- package/dist/hub/roles/audit-details.js +26 -0
- package/dist/hub/roles/audit-details.js.map +1 -0
- package/dist/hub/roles/authority.d.ts +12 -0
- package/dist/hub/roles/authority.js +39 -3
- package/dist/hub/roles/authority.js.map +1 -1
- package/dist/hub/roles/change.d.ts +3 -1
- package/dist/hub/roles/change.js +4 -3
- package/dist/hub/roles/change.js.map +1 -1
- package/dist/hub/roles/clock.d.ts +3 -0
- package/dist/hub/roles/clock.js +1 -1
- package/dist/hub/roles/clock.js.map +1 -1
- package/dist/hub/roles/cutover-inventory.d.ts +2 -0
- package/dist/hub/roles/cutover-inventory.js +8 -1
- package/dist/hub/roles/cutover-inventory.js.map +1 -1
- package/dist/hub/roles/cutover.d.ts +2 -2
- package/dist/hub/roles/cutover.js +3 -4
- package/dist/hub/roles/cutover.js.map +1 -1
- package/dist/hub/roles/delegation.d.ts +4 -1
- package/dist/hub/roles/delegation.js +3 -2
- package/dist/hub/roles/delegation.js.map +1 -1
- package/dist/hub/roles/expiry-effects.d.ts +8 -0
- package/dist/hub/roles/expiry-effects.js +50 -0
- package/dist/hub/roles/expiry-effects.js.map +1 -0
- package/dist/hub/roles/migrations.d.ts +7 -0
- package/dist/hub/roles/migrations.js +44 -0
- package/dist/hub/roles/migrations.js.map +1 -0
- package/dist/hub/roles/model.d.ts +2 -0
- package/dist/hub/roles/model.js +2 -1
- package/dist/hub/roles/model.js.map +1 -1
- package/dist/hub/roles/overview.d.ts +8 -0
- package/dist/hub/roles/overview.js +15 -0
- package/dist/hub/roles/overview.js.map +1 -0
- package/dist/hub/roles/resource-effects.d.ts +3 -2
- package/dist/hub/roles/resource-effects.js +1 -1
- package/dist/hub/roles/resource-effects.js.map +1 -1
- package/dist/hub/roles/review.d.ts +16 -0
- package/dist/hub/roles/review.js +42 -0
- package/dist/hub/roles/review.js.map +1 -0
- package/dist/hub/roles/writer.d.ts +8 -2
- package/dist/hub/roles/writer.js +56 -16
- package/dist/hub/roles/writer.js.map +1 -1
- package/dist/hub/room-mention-feedback-model.d.ts +12 -0
- package/dist/hub/room-mention-feedback-model.js +12 -0
- package/dist/hub/room-mention-feedback-model.js.map +1 -0
- package/dist/hub/rooms/agents.d.ts +3 -1
- package/dist/hub/rooms/agents.js +94 -12
- package/dist/hub/rooms/agents.js.map +1 -1
- package/dist/hub/rooms/direct-view.d.ts +6 -2
- package/dist/hub/rooms/direct-view.js +3 -3
- package/dist/hub/rooms/direct-view.js.map +1 -1
- package/dist/hub/rooms/service.d.ts +27 -3
- package/dist/hub/rooms/service.js +74 -13
- package/dist/hub/rooms/service.js.map +1 -1
- package/dist/hub/rooms/types.d.ts +3 -1
- package/dist/hub/rooms.d.ts +11 -1
- package/dist/hub/rooms.js +76 -10
- package/dist/hub/rooms.js.map +1 -1
- package/dist/hub/runtime.js +1 -1
- package/dist/hub/runtime.js.map +1 -1
- package/dist/hub/server.d.ts +2 -0
- package/dist/hub/server.js +19 -3
- package/dist/hub/server.js.map +1 -1
- package/dist/hub/session-directory-transition.d.ts +2 -1
- package/dist/hub/session-directory-transition.js +10 -3
- package/dist/hub/session-directory-transition.js.map +1 -1
- package/dist/hub/sessions.d.ts +1 -1
- package/dist/hub/sessions.js +14 -10
- package/dist/hub/sessions.js.map +1 -1
- package/dist/hub/settings-commit.d.ts +32 -1
- package/dist/hub/settings-commit.js +11 -4
- package/dist/hub/settings-commit.js.map +1 -1
- package/dist/hub/settings-directory-ca.js +1 -1
- package/dist/hub/settings-directory-ca.js.map +1 -1
- package/dist/hub/settings-directory-control.js +7 -7
- package/dist/hub/settings-directory-control.js.map +1 -1
- package/dist/hub/settings-directory-http.d.ts +2 -0
- package/dist/hub/settings-directory-http.js +21 -6
- package/dist/hub/settings-directory-http.js.map +1 -1
- package/dist/hub/settings-directory-proof.d.ts +5 -1
- package/dist/hub/settings-directory-proof.js +27 -9
- package/dist/hub/settings-directory-proof.js.map +1 -1
- package/dist/hub/settings-directory-recovery.js +2 -1
- package/dist/hub/settings-directory-recovery.js.map +1 -1
- package/dist/hub/settings-directory-save.d.ts +2 -0
- package/dist/hub/settings-directory-save.js +9 -6
- package/dist/hub/settings-directory-save.js.map +1 -1
- package/dist/hub/types.d.ts +11 -0
- package/dist/locale.js +10 -10
- package/dist/locale.js.map +1 -1
- package/dist/login-controller.d.ts +19 -2
- package/dist/login-controller.js +26 -8
- package/dist/login-controller.js.map +1 -1
- package/dist/runtime-build-info.js +1 -1
- package/dist/runtime-build-info.js.map +1 -1
- package/dist/runtime-client.js +6 -6
- package/dist/runtime-client.js.map +1 -1
- package/dist/runtime-coordinator.js +8 -3
- package/dist/runtime-coordinator.js.map +1 -1
- package/dist/runtime-install.d.ts +3 -1
- package/dist/runtime-install.js +5 -3
- package/dist/runtime-install.js.map +1 -1
- package/dist/runtime-personal-answer-only-probe.d.ts +3 -0
- package/dist/runtime-personal-answer-only-probe.js +134 -0
- package/dist/runtime-personal-answer-only-probe.js.map +1 -0
- package/dist/runtime-personal-answer-only.d.ts +16 -0
- package/dist/runtime-personal-answer-only.js +54 -0
- package/dist/runtime-personal-answer-only.js.map +1 -0
- package/dist/runtime-personal-answer.d.ts +6 -2
- package/dist/runtime-personal-answer.js +10 -2
- package/dist/runtime-personal-answer.js.map +1 -1
- package/dist/runtime-personal-preflight.d.ts +4 -1
- package/dist/runtime-personal-preflight.js +50 -4
- package/dist/runtime-personal-preflight.js.map +1 -1
- package/dist/runtime-personal-profile.d.ts +4 -0
- package/dist/runtime-personal-profile.js +11 -0
- package/dist/runtime-personal-profile.js.map +1 -1
- package/dist/runtime-personal-protocol.d.ts +4 -1
- package/dist/runtime-personal-protocol.js +5 -1
- package/dist/runtime-personal-protocol.js.map +1 -1
- package/dist/runtime-personal-stage.d.ts +1 -0
- package/dist/runtime-personal-stage.js +7 -3
- package/dist/runtime-personal-stage.js.map +1 -1
- package/dist/runtime-protocol.d.ts +1 -1
- package/dist/setup-form.js +10 -0
- package/dist/setup-form.js.map +1 -1
- package/dist/tunnel/lease.d.ts +14 -0
- package/dist/tunnel/lease.js +23 -0
- package/dist/tunnel/lease.js.map +1 -1
- package/dist/ui/backend-signin.js +86 -20
- package/dist/ui/chat-activity-groups.js +41 -8
- package/dist/ui/chat-activity.js +3 -1
- package/dist/ui/chat-tour.js +1 -1
- package/dist/ui/fleet-canvas.js +10 -5
- package/dist/ui/fleet-office.js +73 -7
- package/dist/ui/hub-ai-apps-strings.js +6 -0
- package/dist/ui/hub-ai-apps.js +83 -0
- package/dist/ui/hub-client.js +19 -2
- package/dist/ui/hub-directory-editor-strings.js +2 -2
- package/dist/ui/hub-directory-editor.js +1 -0
- package/dist/ui/hub-group-policy.js +4 -3
- package/dist/ui/hub-group-strings.js +2 -2
- package/dist/ui/hub-personal-agent-strings.js +160 -0
- package/dist/ui/hub-personal-agent.js +94 -0
- package/dist/ui/hub-role-audit.js +39 -0
- package/dist/ui/hub-role-forms.js +99 -0
- package/dist/ui/hub-role-notices.js +11 -0
- package/dist/ui/hub-role-view.js +86 -0
- package/dist/ui/hub-roles-strings.js +428 -4
- package/dist/ui/hub-roles.js +76 -41
- package/dist/ui/hub-room-composer.js +3 -2
- package/dist/ui/hub-room-list.js +4 -3
- package/dist/ui/hub-room-members.js +4 -2
- package/dist/ui/hub-room-settings.js +6 -0
- package/dist/ui/hub-room-source-strings.js +17 -0
- package/dist/ui/hub-room-source.js +34 -0
- package/dist/ui/hub-room-thread.js +10 -4
- package/dist/ui/panel-chat.js +4 -4
- package/dist/ui/panel-fleet.js +3 -3
- package/dist/ui/panel-hub.js +39 -25
- package/dist/ui/runtime-commands.d.ts +2 -2
- package/dist/ui/runtime-commands.js +7 -4
- package/dist/ui/settings-build-version.js +2 -2
- package/dist/ui/shared/access-overview.css +1 -1
- package/dist/ui/shared/accounts-keepalive.css +1 -1
- package/dist/ui/shared/accounts.css +1 -1
- package/dist/ui/shared/agent-sheet.js +2 -2
- package/dist/ui/shared/app-prefs.js +5 -2
- package/dist/ui/shared/app-shell.js +1 -1
- package/dist/ui/shared/app-swipe.js +3 -1
- package/dist/ui/shared/app.css +124 -40
- package/dist/ui/shared/app.js +1 -1
- package/dist/ui/shared/chat-thread.js +5 -1
- package/dist/ui/shared/chat-work-bar.css +5 -5
- package/dist/ui/shared/connector-prompt.d.ts +1 -0
- package/dist/ui/shared/connector-prompt.js +10 -0
- package/dist/ui/shared/hub-ai-apps.css +12 -0
- package/dist/ui/shared/hub-chat.css +9 -2
- package/dist/ui/shared/hub-groups.css +1 -1
- package/dist/ui/shared/hub-owner.css +5 -5
- package/dist/ui/shared/hub-roles.css +98 -26
- package/dist/ui/shared/hub-rooms-u2.css +14 -0
- package/dist/ui/shared/hub.css +3 -3
- package/dist/ui/shared/instance-nav.js +24 -9
- package/dist/ui/shared/loading.css +1 -1
- package/dist/ui/shared/model-picker.css +2 -2
- package/dist/ui/shared/preview-panel-actions.js +1 -1
- package/dist/ui/shared/preview-panel.js +2 -2
- package/dist/ui/shared/signin.js +27 -12
- package/dist/ui/shared/task-board.css +2 -2
- package/dist/ui/shared/tokens.css +1 -1
- package/dist/ui/shared/ui-toast.js +4 -4
- package/dist/ui/shared/usage-dialog.js +43 -4
- package/dist/ui/signin.html +4 -2
- package/dist/ui/structured-signin.js +64 -12
- package/dist/ui/web-terminal/terminal.css +1 -1
- package/dist/web-backend-login.d.ts +5 -1
- package/dist/web-backend-login.js +8 -2
- package/dist/web-backend-login.js.map +1 -1
- package/dist/web-prefs.js +2 -0
- package/dist/web-prefs.js.map +1 -1
- package/dist/windows-cli-worker.d.ts +3 -0
- package/dist/windows-cli-worker.js +33 -4
- package/dist/windows-cli-worker.js.map +1 -1
- package/dist/windows-cli.d.ts +1 -0
- package/dist/windows-cli.js +8 -4
- package/dist/windows-cli.js.map +1 -1
- package/package.json +1 -1
- package/templates/runtime-install/install.ps1 +24 -4
package/dist/ui/hub-roles.js
CHANGED
|
@@ -1,48 +1,83 @@
|
|
|
1
|
-
/** Role
|
|
1
|
+
/** Role navigation/presentation. Every mutation still uses the server's single checked policy proposal. */
|
|
2
2
|
import {html,useEffect,useRef,useState} from "/assets/app-html.js";
|
|
3
|
+
import {Dialog} from "/assets/ui-dialog.js";
|
|
3
4
|
import {hr,linkRoleCss} from "./hub-roles-strings.js";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
function Search({client,kind,onPick}){
|
|
11
|
-
const [q,setQ]=useState(""),[rows,setRows]=useState([]),[busy,setBusy]=useState(false),[failure,setFailure]=useState(null),epoch=useRef(0);
|
|
12
|
-
useEffect(()=>()=>{epoch.current++;},[client,kind]);
|
|
13
|
-
const search=async()=>{if(q.trim().length<2||busy)return;const mine=++epoch.current;setBusy(true);setFailure(null);let out;try{out=await client.roleSearch(kind,q.trim());}catch{out={ok:false};}if(mine!==epoch.current)return;setBusy(false);if(out.ok)setRows(out.candidates||[]);else setFailure(error(out));};
|
|
14
|
-
return html`<div class="hub-role-search"><label class="field"><span>${hr(kind)}</span><input value=${q} maxlength="64" placeholder=${hr("query")} onInput=${e=>{epoch.current++;setQ(e.target.value);setRows([]);setBusy(false);}} onKeyDown=${e=>{if(e.key==="Enter"){e.preventDefault();void search();}}}/></label><button type="button" class="btn" disabled=${busy||q.trim().length<2} onClick=${search}>${hr("search")}</button>${failure?html`<p role="alert" class="err">${failure}</p>`:null}<ul class="hub-role-list">${rows.map(row=>html`<li key=${key(row.key)}><span class="grow">${row.name}${row.login?html`<small class="note"> · ${row.login}</small>`:null}</span><button type="button" class="btn" onClick=${()=>{epoch.current++;onPick(row);setRows([]);setQ("");}}>${hr("choose")}</button></li>`)}</ul></div>`;
|
|
5
|
+
import {RoleWizard,AssignPanel,PermissionSections,Review} from "./hub-role-forms.js";
|
|
6
|
+
import {RoleAudit} from "./hub-role-audit.js";
|
|
7
|
+
import {personKey,personName,roleName,roleDescription,assignedSubjects,assignmentCount,subjectId,scopeName,roleError} from "./hub-role-view.js";
|
|
8
|
+
const copy=value=>structuredClone(value);
|
|
9
|
+
function Tabs({items,value,onChange,disabled=false,label}){
|
|
10
|
+
return html`<div class="hub-role-tabs" role="tablist" aria-label=${label}>${items.map(item=>html`<button key=${item.key} type="button" role="tab" tabindex=${item.key===value?0:-1} onKeyDown=${e=>{const at=items.findIndex(row=>row.key===value),keys={ArrowRight:(at+1)%items.length,ArrowLeft:(at+items.length-1)%items.length,Home:0,End:items.length-1};if(Object.hasOwn(keys,e.key)){e.preventDefault();const next=keys[e.key];onChange(items[next].key);(e.currentTarget||e.target).parentNode.querySelectorAll('[role="tab"]')[next]?.focus();}}} aria-selected=${item.key===value} class=${item.key===value?"is-active":""} disabled=${disabled} onClick=${()=>onChange(item.key)}>${item.label}</button>`)}</div>`;
|
|
15
11
|
}
|
|
16
|
-
function
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
12
|
+
function RoleList({view,busy,canEdit,canAssign,onOpen,onAssign,onCreate}){
|
|
13
|
+
return html`<section class="card hub-role-list-page"><div class="hub-card-head"><h2>${hr("roles")}</h2>${canEdit?html`<button type="button" class="btn btn-primary" disabled=${busy} onClick=${onCreate}>${hr("newRole")}</button>`:null}</div>
|
|
14
|
+
<div class="hub-team-table-wrap"><table class="hub-team-table hub-role-list"><thead><tr><th>${hr("role")}</th><th>${hr("rolePurpose")}</th><th>${hr("assignedTo")}</th><th></th></tr></thead><tbody>${view.policy.roles.map(role=>html`<tr key=${role.id} onClick=${()=>{if(!busy)onOpen(role.id);}}>
|
|
15
|
+
<td><button type="button" class="hub-role-row-open" disabled=${busy} onClick=${e=>{e.stopPropagation();onOpen(role.id);}}>${roleName(role,view)}</button><span class="tag">${hr(role.kind==="custom"?"custom":role.kind==="carried-over"?"carried":"builtin")}</span></td>
|
|
16
|
+
<td class="hub-role-purpose">${roleDescription(role,view)}</td><td class="hub-role-assigned-count">${assignmentCount(view,role)}</td><td>${canAssign?html`<button type="button" class="btn btn-sm" disabled=${busy} onClick=${e=>{e.stopPropagation();onAssign(role.id);}}>${hr("assign")}</button>`:null}</td></tr>`)}</tbody></table></div></section>`;
|
|
20
17
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
18
|
+
function People({view,roleId=null,busy,onOpen,onAssign}){
|
|
19
|
+
const [filter,setFilter]=useState("all"),rows=assignedSubjects(view,roleId).filter(row=>filter==="all"||row.subject.kind===filter);
|
|
20
|
+
return html`<section class="card hub-role-people"><div class="hub-card-head"><h2>${hr("people")}</h2>${onAssign?html`<button type="button" class="btn btn-primary" disabled=${busy} onClick=${onAssign}>${hr("assignPeople")}</button>`:null}</div>
|
|
21
|
+
<label class="field hub-role-filter"><span>${hr("subject")}</span><select value=${filter} disabled=${busy} onChange=${e=>setFilter(e.target.value)}><option value="all">${hr("all")}</option><option value="person">${hr("people")}</option><option value="group">${hr("groups")}</option></select></label>
|
|
22
|
+
<ul class="hub-rows">${rows.map(row=>html`<li class="s-row hub-row" key=${row.id}><span class="hub-row-text"><button type="button" class="hub-role-row-open" disabled=${busy} onClick=${()=>onOpen(row.subject)}>${row.name}</button>
|
|
23
|
+
<span class="chips">${row.fixed?html`<span class="tag">${hr("admin")}</span>`:null}${[...new Set(row.assignments.map(a=>a.roleId))].map(id=>html`<span class="tag" key=${id}>${roleName(view.policy.roles.find(r=>r.id===id),view)}</span>`)}${row.subject.kind==="person"&&personKey(row.subject.person)===personKey(view.actor)?html`<span class="tag">${hr("you")}</span>`:null}</span>
|
|
24
|
+
<small class="note">${row.fixed?hr("firstAdminHelp"):[...new Set(row.assignments.map(a=>scopeName(a.scope)))].join(" · ")}</small></span></li>`)}</ul>${!rows.length?html`<p class="note">${hr("nobodyAssigned")}</p>`:null}</section>`;
|
|
25
|
+
}
|
|
26
|
+
function PersonRoles({view,subject,busy,onBack,onEdit,onRemove}){
|
|
27
|
+
const row=assignedSubjects(view).find(row=>row.id===subjectId(subject)),own=subject.kind==="person"&&personKey(subject.person)===personKey(view.actor),canAssign=view.management.includes("roles.assign");
|
|
28
|
+
return html`<section class="card hub-role-person"><button type="button" class="btn btn-sm" disabled=${busy} onClick=${onBack}>‹ ${hr("people")}</button><h2>${row?.name||hr("unknownPerson")}${own?html` <span class="tag">${hr("you")}</span>`:null}</h2>${own?html`<p class="s-info">${hr("selfHelp")}</p>`:null}
|
|
29
|
+
<ul class="hub-rows">${row?.fixed?html`<li class="s-row hub-row"><span class="hub-row-text"><strong>${hr("admin")}</strong><small class="note">${hr("firstAdminHelp")}</small></span></li>`:null}
|
|
30
|
+
${row?.assignments.map(a=>html`<li class="s-row hub-row" key=${a.id}><span class="hub-row-text"><strong>${roleName(view.policy.roles.find(r=>r.id===a.roleId),view)}</strong><small class="note">${scopeName(a.scope)} · ${a.expiresAt?new Date(a.expiresAt).toLocaleString():hr("noEnd")}</small></span>
|
|
31
|
+
${canAssign?html`<div class="s-actions"><button type="button" class="btn btn-sm" disabled=${busy||own} onClick=${()=>onEdit(a)}>${hr("edit")}</button><button type="button" class="btn btn-sm danger" disabled=${busy||own} onClick=${()=>onRemove(a)}>${hr("remove")}</button></div>`:null}</li>`)}</ul></section>`;
|
|
32
|
+
}
|
|
33
|
+
function RolePage({view,role,busy,canEdit,canAssign,onBack,onAssign,onEdit,onDelete,onPerson}){
|
|
34
|
+
const [tab,setTab]=useState("people"),editable=canEdit&&!["admin","carried-over"].includes(role.kind)&&!role.id.startsWith("root-self:");
|
|
35
|
+
const count=assignedSubjects(view,role.id).length;
|
|
36
|
+
return html`<section class="hub-role-detail"><button type="button" class="btn btn-sm" disabled=${busy} onClick=${onBack}>‹ ${hr("roles")}</button><div class="hub-card-head"><h2>${roleName(role,view)} <span class="tag">${hr(["custom","carried-over"].includes(role.kind)?role.kind==="custom"?"custom":"carried":"builtin")}</span></h2>
|
|
37
|
+
${editable&&role.kind==="custom"?html`<details class="hub-role-menu"><summary>${hr("more")}</summary><button type="button" class="btn danger" disabled=${busy} onClick=${onDelete}>${hr("delete")}</button></details>`:null}</div><p>${roleDescription(role,view)}</p><p class="note">${hr("quota")}: ${role.defaultMaxFleets}</p>
|
|
38
|
+
<${Tabs} label=${roleName(role,view)} items=${[{key:"people",label:hr("people")+" · "+count},{key:"permissions",label:hr("permissions")+" · "+hr("permissionCount",role.permissions.length,12)}]} value=${tab} disabled=${busy} onChange=${setTab}/>
|
|
39
|
+
${tab==="people"?html`<${People} key=${role.id} view=${view} roleId=${role.id} busy=${busy} onOpen=${onPerson} onAssign=${canAssign?onAssign:null}/>`:html`<section class="card"><div class="hub-card-head"><h3>${hr("permissions")}</h3>${editable?html`<button type="button" class="btn" disabled=${busy} onClick=${onEdit}>${hr("editPermissions")}</button>`:null}</div>
|
|
40
|
+
${role.kind==="admin"?html`<p class="s-info">${hr("adminFixed")}</p>`:null}${role.kind==="carried-over"?html`<p class="note">${hr("inherited")}</p>`:null}<${PermissionSections} permissions=${role.permissions} readOnly=${true} administrator=${role.kind==="admin"}/></section>`}</section>`;
|
|
31
41
|
}
|
|
32
42
|
export function HubRoles({client}){
|
|
33
|
-
const [styled,setStyled]=useState(null),[styleRetry,setStyleRetry]=useState(0)
|
|
34
|
-
const
|
|
35
|
-
useEffect(()=>{let live=true;
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
43
|
+
const [styled,setStyled]=useState(null),[styleRetry,setStyleRetry]=useState(0),[view,setView]=useState(null),[failure,setFailure]=useState(null),[busy,setBusy]=useState(false),[saved,setSaved]=useState(false),[reload,setReload]=useState(0),[tab,setTab]=useState("roles"),[page,setPage]=useState(null),[wizard,setWizard]=useState(null),[assign,setAssign]=useState(null),[settings,setSettings]=useState(false),[checked,setChecked]=useState(null);
|
|
44
|
+
const epoch=useRef(0),writing=useRef(false);
|
|
45
|
+
useEffect(()=>{let live=true;linkRoleCss().then(out=>{if(live)setStyled(out);});return()=>{live=false;};},[styleRetry]);
|
|
46
|
+
useEffect(()=>{let live=true;const mine=++epoch.current;setView(null);setChecked(null);setWizard(null);setAssign(null);setSettings(false);
|
|
47
|
+
Promise.resolve().then(()=>client.roles()).then(out=>{if(!live||mine!==epoch.current)return;if(out.ok){setView(out.view);setFailure(null);if(!out.view.policy)setTab(out.view.management.includes("audit.view")?"audit":"roles");}else setFailure(roleError(out));},()=>{if(live&&mine===epoch.current)setFailure(hr("failed"));});
|
|
48
|
+
const end=client.onSignedOut?.(()=>{epoch.current++;writing.current=false;setView(null);setChecked(null);setWizard(null);setAssign(null);setSettings(false);setBusy(false);setFailure(hr("denied"));});return()=>{live=false;epoch.current++;end?.();};
|
|
49
|
+
},[client,reload]);
|
|
50
|
+
const preview=async(policy,origin="page",rootSelf=false)=>{
|
|
51
|
+
if(writing.current)return;writing.current=true;setBusy(true);setFailure(null);setSaved(false);setChecked(null);const mine=++epoch.current;let out;try{out=rootSelf?await client.roleRootPreview():await client.rolePreview(policy);}catch{out={ok:false};}
|
|
52
|
+
if(mine!==epoch.current)return;writing.current=false;setBusy(false);if(out.ok)setChecked({policy,rootSelf,origin,...out});else setFailure(roleError(out,true));
|
|
53
|
+
};
|
|
54
|
+
const apply=async()=>{
|
|
55
|
+
if(!checked||writing.current)return;writing.current=true;setBusy(true);setFailure(null);const selected=checked,mine=++epoch.current;let out;try{out=selected.rootSelf?await client.roleRootApply(selected.previewDigest):await client.roleApply(selected.policy,selected.previewDigest);}catch{out={ok:false};}
|
|
56
|
+
if(mine!==epoch.current)return;writing.current=false;setBusy(false);setChecked(null);
|
|
57
|
+
if(out.ok){if(wizard)setPage({kind:"role",id:wizard.id});setWizard(null);setAssign(null);setSettings(false);setSaved(true);setReload(n=>n+1);}else setFailure(roleError(out,true));
|
|
58
|
+
};
|
|
59
|
+
const remember=row=>setView(previous=>({...previous,personLabels:[...(previous.personLabels||[]).filter(p=>p.id!==personKey(row.key)),{id:personKey(row.key),name:row.name}]}));
|
|
60
|
+
const close=()=>{if(busy)return;setChecked(null);setFailure(null);setWizard(null);setAssign(null);setSettings(false);};
|
|
61
|
+
const openAssign=(roleId,assignment=null)=>{setChecked(null);setFailure(null);setAssign({roleId,assignment});};
|
|
62
|
+
const refresh=()=>{setWizard(null);setAssign(null);setSettings(false);setChecked(null);setPage(null);setReload(n=>n+1);};
|
|
63
|
+
const remove=a=>{const next=copy(view.policy);next.assignments=next.assignments.filter(row=>row.id!==a.id);void preview(next);};
|
|
64
|
+
const root=view&&personKey(view.root)===personKey(view.actor),canEdit=!!view?.management.includes("hub.admin"),canAssign=!!view?.management.includes("roles.assign"),selectedRole=view?.policy?.roles.find(r=>r.id===page?.id);
|
|
65
|
+
if(styled!==true)return html`<section class="card"><p role="status">${hr(styled===false?"styleFailed":"styleLoading")}</p>${styled===false?html`<button type="button" class="btn" onClick=${()=>{setStyled(null);setStyleRetry(n=>n+1);}}>${hr("retry")}</button>`:null}</section>`;
|
|
66
|
+
return html`<div class="hub-roles"><p class="s-page-lead hub-page-lead">${hr("lead")}</p>
|
|
67
|
+
${failure&&!assign&&!settings?html`<p class="err" role="alert">${failure}</p><button type="button" class="btn" disabled=${busy} onClick=${refresh}>${hr("reloadRoles")}</button>`:null}${saved?html`<p role="status">${hr("saved")}</p>`:null}${!view&&!failure?html`<p role="status">${hr("loading")}</p>`:null}
|
|
68
|
+
${view?html`<div class="hub-role-top"><${Tabs} label=${hr("title")} items=${[...(view.policy?[{key:"roles",label:hr("roles")},{key:"people",label:hr("people")}]:[]),...(view.management.includes("audit.view")?[{key:"audit",label:hr("audit")}]:[])]} value=${tab} disabled=${busy} onChange=${key=>{setTab(key);setPage(null);setWizard(null);setChecked(null);setFailure(null);}}/>
|
|
69
|
+
${canEdit?html`<details class="hub-role-menu"><summary aria-label=${hr("rolesSettings")}>⋯</summary><button type="button" class="btn" disabled=${busy} onClick=${()=>{setSettings(true);setChecked(null);setFailure(null);}}>${hr("rolesSettings")}</button></details>`:null}</div>
|
|
70
|
+
${checked?.origin==="page"?html`<section class="card"><h2>${hr("review")}</h2><${Review} view=${view} checked=${checked}/><div class="hub-role-actions"><button type="button" class="btn" disabled=${busy} onClick=${()=>setChecked(null)}>${hr("back")}</button><button type="button" class=${`btn ${checked.policy?.roles.length<view.policy.roles.length?"danger":"btn-primary"}`} disabled=${busy} onClick=${apply}>${hr(busy?"saving":checked.policy?.roles.length<view.policy.roles.length?"delete":"apply")}</button></div></section>`:
|
|
71
|
+
wizard?html`<${RoleWizard} key=${wizard.id} view=${view} role=${wizard} checked=${checked?.origin==="wizard"?checked:null} busy=${busy} onCheck=${policy=>preview(policy,"wizard")} onApply=${apply} onBack=${()=>setChecked(null)} onCancel=${close}/>`:
|
|
72
|
+
tab==="audit"?html`<${RoleAudit} key=${reload} client=${client}/>`:
|
|
73
|
+
page?.kind==="person"?html`<${PersonRoles} view=${view} subject=${page.subject} busy=${busy} onBack=${()=>setPage(null)} onEdit=${a=>openAssign(a.roleId,a)} onRemove=${remove}/>`:
|
|
74
|
+
selectedRole?html`<${RolePage} key=${selectedRole.id} view=${view} role=${selectedRole} busy=${busy} canEdit=${canEdit} canAssign=${canAssign} onBack=${()=>setPage(null)} onPerson=${subject=>setPage({kind:"person",subject})} onAssign=${()=>openAssign(selectedRole.id)} onEdit=${()=>{setChecked(null);setWizard(selectedRole);}} onDelete=${()=>{const next=copy(view.policy);next.roles=next.roles.filter(r=>r.id!==selectedRole.id);next.assignments=next.assignments.filter(a=>a.roleId!==selectedRole.id);preview(next);}}/>`:
|
|
75
|
+
tab==="people"?html`<${People} view=${view} busy=${busy} onOpen=${subject=>setPage({kind:"person",subject})} onAssign=${canAssign?()=>openAssign(null):null}/>`:
|
|
76
|
+
view.policy?html`<${RoleList} view=${view} busy=${busy} canEdit=${canEdit} canAssign=${canAssign} onOpen=${id=>setPage({kind:"role",id})} onAssign=${openAssign} onCreate=${()=>{setFailure(null);setWizard({id:"custom:"+crypto.randomUUID(),kind:"custom",name:"",description:"",permissions:[],defaultMaxFleets:0});}}/>`:html`<p class="note">${hr("noPolicy")}</p>`}
|
|
77
|
+
${root&&!view.rootSelfUsed&&!wizard&&!checked&&tab==="roles"&&!page?html`<aside class="s-info hub-role-root-notice"><p>${hr("rootHelp")}</p><button type="button" class="btn btn-sm" disabled=${busy} onClick=${()=>preview(null,"page",true)}>${hr("rootDefaults")}</button></aside>`:null}
|
|
78
|
+
${assign?html`<${AssignPanel} view=${view} client=${client} roleId=${assign.roleId} assignment=${assign.assignment} checked=${checked?.origin==="assign"?checked:null} busy=${busy} failure=${failure} onReload=${refresh} onCheck=${policy=>preview(policy,"assign")} onApply=${apply} onBack=${()=>setChecked(null)} onClose=${close} onRemember=${remember}/>`:null}
|
|
79
|
+
${settings?html`<${Dialog} title=${checked?hr("review"):hr("rolesSettings")} busy=${busy} onClose=${close} wide=${true} cls="hub-role-panel" actions=${checked?html`<button type="button" class="btn" disabled=${busy} onClick=${()=>setChecked(null)}>${hr("back")}</button><button type="button" class="btn btn-primary" disabled=${busy} onClick=${apply}>${hr("apply")}</button>`:null}>
|
|
80
|
+
${failure?html`<p class="err" role="alert">${failure}</p><button type="button" class="btn" disabled=${busy} onClick=${refresh}>${hr("reloadRoles")}</button>`:null}${checked?html`<${Review} view=${view} checked=${checked}/>`:html`<div class="hub-role-status"><p><span class=${`tag ${view.policy.rolesActive?"ok":"warn"}`}>${hr(view.policy.rolesActive?"on":"off")}</span></p><p>${hr("offHelp")}</p>${view.policy.state==="never-enabled"?html`<p class="s-info">${hr("selfLegacy")}</p>`:view.policy.state==="suspended"?html`<p class="s-info">${hr("selfPaused")}</p>`:null}<button type="button" class="btn" disabled=${busy} onClick=${()=>{const next=copy(view.policy);next.rolesActive=!next.rolesActive;preview(next,"settings");}}>${hr(view.policy.rolesActive?"turnOff":"turnOn")}</button>
|
|
81
|
+
<h3>${hr("firstAdmin")}</h3><p>${personName(view,view.root)}</p><p class="note">${hr("firstAdminHelp")}</p><a class="btn" href="/ui/hub/admin?view=allowed-list">${hr("openAllowedList")}</a></div>`}</${Dialog}>`:null}`:null}
|
|
82
|
+
</div>`;
|
|
48
83
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import {hp} from "./hub-personal-agent-strings.js";
|
|
1
2
|
// M-3092 PR 2 (Hub rooms, track U): a room's composer — the Fleet chat's own ComposerInput, its palette (`cmd-palette`)
|
|
2
3
|
// and its reply bar (`reply-bar`), with what a room adds (docs/design/hub-rooms-ux.md §4):
|
|
3
4
|
// - typing `@` opens a menu: 「@所有 Agent」 (when this room lets me), 「@房間助理」 (when the room has one), each agent
|
|
@@ -40,7 +41,7 @@ export function mentionOptions(detail, query = "") {
|
|
|
40
41
|
out.push({ kind: "all", key: "all", label: hroom("mentionAll"), hint: hroom("mentionAllHint", String(agents.length)) });
|
|
41
42
|
if ((detail?.members || []).some((m) => m.kind === "assistant") && hit(hroom("mentionAssistant")))
|
|
42
43
|
out.push({ kind: "assistant", key: "assistant", label: hroom("mentionAssistant"), hint: hroom("mentionAssistantHint") });
|
|
43
|
-
for (const a of agents) if (hit(a.name, a.owner?.name)) out.push({ kind: "agent", key: a.id, label: `@${a.name}`, hint: a.owner?.name || "", dot: presenceDot(a.presence, a.presenceReason) });
|
|
44
|
+
for (const a of agents) if (hit(a.name, a.owner?.name)) out.push({ kind: "agent", key: a.id, label: `@${a.name}`, ...(a.answerOnly?{answerOnly:true}:{}), hint: a.answerOnly ? hp("answerOnlyAsker") : a.owner?.name || "", dot: presenceDot(a.presence, a.presenceReason) });
|
|
44
45
|
for (const p of (detail?.members || []).filter((m) => m.kind === "person" && m.id !== detail?.me?.id)) if (hit(p.name)) out.push({ kind: "person", key: p.id, label: `@${p.name}`, hint: "" });
|
|
45
46
|
return out;
|
|
46
47
|
}
|
|
@@ -116,7 +117,7 @@ export function RoomComposer({ store, detail, reply = null, onReply = () => {},
|
|
|
116
117
|
${palette ? html`<ul data-trust="palette" class="cmd-palette" id=${paletteId} role="listbox" aria-label=${hroom("mentionAll")}>
|
|
117
118
|
${palette.map((o) => html`<li key=${o.key} id=${optId(o)} role="option" aria-selected=${o === chosen ? "true" : "false"} class=${o === chosen ? "on" : ""}
|
|
118
119
|
onMouseDown=${(e) => { e.preventDefault(); complete(o); }}>
|
|
119
|
-
<span class="cmd-name">${o.dot ? html`<span class=${`dot ${o.dot}`} aria-hidden="true"></span> ` : null}${o.label}</span><span class
|
|
120
|
+
<span class="cmd-name">${o.dot ? html`<span class=${`dot ${o.dot}`} aria-hidden="true"></span> ` : null}${o.label}</span><span class=${`cmd-desc${o.answerOnly?" hub-answer-only-note":""}`}>${o.hint}</span></li>`)}
|
|
120
121
|
</ul>` : null}
|
|
121
122
|
${group && value.includes(hroom("mentionAll")) ? html`<p class="note hub-room-allbar" role="status">${allBar(detail)}</p>` : null}
|
|
122
123
|
${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>
|
package/dist/ui/hub-room-list.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import {hp} from "./hub-personal-agent-strings.js";
|
|
1
2
|
// M-3092 (Hub rooms, track U): the Hub's conversation list, drawn as the Fleet chat draws its roster — the same row
|
|
2
3
|
// (`li.v-li > a.inst.v-inst`: avatar with its status dot, the name line and the second line), the same section head
|
|
3
4
|
// (`inst-head > side-label`, its count) and the same count badge (`nav-count`). docs/design/hub-rooms-ux.md §2:
|
|
@@ -29,7 +30,7 @@ export function listRoomOf(item) {
|
|
|
29
30
|
if (!item || typeof item !== "object" || typeof item.id !== "string") return null;
|
|
30
31
|
return { id: item.id, kind: "direct", name: String(item.exposureName || ""), people: 1, agents: 1, online: null, unread: 0,
|
|
31
32
|
lastAt: Number.isFinite(item.lastAt) ? item.lastAt : 0, lastText: "", lastAuthor: "",
|
|
32
|
-
agent: { exposureId: String(item.exposureId || ""), owner: { name: String(item.ownerName || "") }, presence: null }, limited: true, legacy: item };
|
|
33
|
+
agent: { ...(item.answerOnly?{answerOnly:true}:{}), exposureId: String(item.exposureId || ""), owner: { name: String(item.ownerName || "") }, presence: null }, limited: true, legacy: item };
|
|
33
34
|
}
|
|
34
35
|
/** The rooms list from whichever client this page has: roomList() when it can, else rooms() mapped by listRoomOf(). */
|
|
35
36
|
export function readRoomList(client) {
|
|
@@ -72,7 +73,7 @@ export function rowView(r) {
|
|
|
72
73
|
const closed = limited && r.legacy?.state === "closed", waiting = limited && !closed && r.legacy?.waiting === true;
|
|
73
74
|
const line2 = group ? countsLine(r.people, r.agents)
|
|
74
75
|
: closed ? t("hubChat.tagClosed") : waiting ? t("hubChat.waiting")
|
|
75
|
-
: r.assistant ? tr("providedByHub") : String(r.agent?.owner?.name || "");
|
|
76
|
+
: r.assistant ? tr("providedByHub") : r.agent?.answerOnly ? hp("answerOnlyAsker") : String(r.agent?.owner?.name || "");
|
|
76
77
|
return {
|
|
77
78
|
title: r.assistant ? tr("hubAssistant") : String(r.name || ""), line2,
|
|
78
79
|
avatar: { square: group, text: firstCharacter(r.assistant ? tr("hubAssistant") : String(r.name || "?")) || "?" },
|
|
@@ -131,7 +132,7 @@ export function HubRoomRows({ rooms, q = "", current = null, href, onGo, star =
|
|
|
131
132
|
<span class=${`av${v.avatar.square ? " av-square" : ""}`}><span class="av-text" aria-hidden="true">${v.avatar.text}</span>${v.dot
|
|
132
133
|
? html`<span class=${`av-dot dot ${v.dot}`} aria-hidden="true"></span>` : null}</span>
|
|
133
134
|
<span class="inst-text"><span class="inst-line"><span class="inst-name" title=${v.title}>${v.title}</span><span class="v-meta">${listTime(r.lastAt)}</span></span>
|
|
134
|
-
<span class="inst-line inst-line2"><span class
|
|
135
|
+
<span class="inst-line inst-line2"><span class=${`inst-alt${r.agent?.answerOnly?" hub-answer-only-note":""}`} title=${v.line2 || undefined}>${v.archived ? `${tr("archived")} · ${v.line2}` : v.line2}</span>
|
|
135
136
|
${v.mentioned ? html`<span class="hub-room-at" title=${tr("mentionedYou")}>@</span>` : null}
|
|
136
137
|
${v.unread ? html`<span class="nav-count" title=${tr("unreadN", String(v.unread))}>${v.unread > 99 ? "99+" : v.unread}</span>` : null}</span></span>
|
|
137
138
|
</a>${items.length ? html`<${Menu} cls=${`inst-workspace inst-row-menu agent-menu${starred ? " is-favorite" : ""}`} fit=${true} topLayer=${true}
|
|
@@ -9,6 +9,7 @@ import { hm } from "./hub-room-members-strings.js";
|
|
|
9
9
|
import { hroom } from "./hub-room-strings.js";
|
|
10
10
|
import { collapse, headerCounts, presenceDot, presenceView, sortAgents } from "./hub-room-presence.js";
|
|
11
11
|
import { hn, linkRoomsU2Css } from "./hub-room-new-strings.js";
|
|
12
|
+
import { roomSource, RoomSourceMark } from "./hub-room-source.js";
|
|
12
13
|
|
|
13
14
|
linkRoomsU2Css();
|
|
14
15
|
|
|
@@ -75,7 +76,7 @@ export function RoomMembersPanel({ client = hubClient(), roomId, detail, onMenti
|
|
|
75
76
|
// An agent's second line names whose it is beside its state (「處理中 · 林小華的 Agent」), always shown, not only on hover.
|
|
76
77
|
const row = (m, extra = null) => {
|
|
77
78
|
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)) : "";
|
|
78
|
-
return html`<span class="hub-member-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>`;
|
|
79
80
|
};
|
|
80
81
|
return html`<aside class="hub-room-members">
|
|
81
82
|
<section><h4>${heads.member}</h4>
|
|
@@ -84,9 +85,10 @@ export function RoomMembersPanel({ client = hubClient(), roomId, detail, onMenti
|
|
|
84
85
|
${agents.length ? null : html`<section class="hub-room-no-agents"><h4>${hm("agents")}</h4><p class="note">${hm("noAgents")}</p></section>`}
|
|
85
86
|
${agents.length ? html`<section><h4>${heads.agent}</h4>
|
|
86
87
|
<ul>${shown.map(m => html`<li class="hub-member hub-member-agent" key=${m.id}>
|
|
87
|
-
<button type="button" class="hub-member-open" title=${m
|
|
88
|
+
<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>
|
|
88
89
|
${open === m.id ? html`<div class="hub-member-card" role="group" aria-label=${m.name}>
|
|
89
90
|
<strong>${m.name}</strong>${m.owner?.name ? html`<small class="note">${hm("ownerOf", m.owner.name)}</small>` : null}
|
|
91
|
+
<small class="note hub-source-explanation">${roomSource(m)?.label}</small>
|
|
90
92
|
<small class="note">${memberStatus(m).text}</small>
|
|
91
93
|
<div class="field-row">
|
|
92
94
|
<button type="button" class="btn" onClick=${() => { setOpen(null); onMention?.(m); }}>${hroom("mentionHere")}</button>
|
|
@@ -14,6 +14,7 @@ import { confirmDialog } from "/assets/ui-confirm.js";
|
|
|
14
14
|
import { hubClient } from "./hub-client.js";
|
|
15
15
|
import { hroom } from "./hub-room-strings.js";
|
|
16
16
|
import { hs } from "./hub-room-settings-strings.js";
|
|
17
|
+
import {ha} from "./hub-ai-apps-strings.js";
|
|
17
18
|
import { RoomPicker } from "./hub-room-new.js";
|
|
18
19
|
import { hn, linkRoomsU2Css } from "./hub-room-new-strings.js";
|
|
19
20
|
|
|
@@ -42,10 +43,13 @@ export function RoomSettings({ client = hubClient(), roomId, detail, onClose, on
|
|
|
42
43
|
const invited = Array.isArray(detail?.invited) ? detail.invited : [];
|
|
43
44
|
const [name, setName] = useState(room.name ?? ""), [busy, setBusy] = useState(false), [error, setError] = useState("");
|
|
44
45
|
const [allMention, setAllMention] = useState(settings.allMention !== false), [history, setHistory] = useState(settings.historyForNew === "all" ? "all" : "since-join");
|
|
46
|
+
const [aiApps,setAiApps]=useState(settings.aiApps!==false);
|
|
47
|
+
const [aiAppsScope]=useState(()=>client.aiAppsScope?.());
|
|
45
48
|
const [offered, setOffered] = useState(assistant === true), [addPeople, setAddPeople] = useState([]), [addAgents, setAddAgents] = useState([]), [peopleNote, setPeopleNote] = useState("");
|
|
46
49
|
const live = useRef(true);
|
|
47
50
|
useEffect(() => () => { live.current = false; }, []);
|
|
48
51
|
useEffect(() => { setName(room.name ?? ""); setAllMention(settings.allMention !== false); setHistory(settings.historyForNew === "all" ? "all" : "since-join"); }, [detail]);
|
|
52
|
+
useEffect(()=>setAiApps(settings.aiApps!==false),[detail]);
|
|
49
53
|
useEffect(() => {
|
|
50
54
|
if (typeof assistant === "boolean") { setOffered(assistant); return; }
|
|
51
55
|
void client.roomList().then(r => { if (live.current) setOffered(r?.ok === true && r.me?.assistant === true); });
|
|
@@ -108,6 +112,8 @@ export function RoomSettings({ client = hubClient(), roomId, detail, onClose, on
|
|
|
108
112
|
</form>
|
|
109
113
|
<label class="check"><input id="hubRoomAllMention" class="s-ui-toggle" type="checkbox" role="switch" checked=${allMention} disabled=${busy}
|
|
110
114
|
onChange=${(e) => { const v = e.target.checked; setAllMention(v); void act(() => client.updateRoom(roomId, { allMention: v }), () => setAllMention(!v)); }} /><span>${hroom("membersCanAll")}</span></label>
|
|
115
|
+
${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}
|
|
116
|
+
onChange=${e=>{const value=e.target.checked;setAiApps(value);void act(()=>client.setRoomAiApps(aiAppsScope,roomId,value),()=>setAiApps(!value));}}/><span>${ha("roomSwitch")}</span></label>`:null}
|
|
111
117
|
<fieldset class="field"><legend>${hroom("newMembersSee")}</legend>
|
|
112
118
|
${[["since-join", hroom("historyAfter")], ["all", hroom("historyAll")]].map(([value, label]) => html`<label class="check" key=${value}><input type="radio" name="hubRoomHistory" value=${value} checked=${history === value} disabled=${busy}
|
|
113
119
|
onChange=${() => { const old = history; setHistory(value); void act(() => client.updateRoom(roomId, { historyForNew: value }), () => setHistory(old)); }} /><span>${label}</span></label>`)}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { register, t } from "/assets/app-i18n.js";
|
|
2
|
+
|
|
3
|
+
register("hubRoomSource", {
|
|
4
|
+
en: {
|
|
5
|
+
agend: "AgEnD agent",
|
|
6
|
+
fleet: "An agent in {0}'s Fleet",
|
|
7
|
+
personal: "{0}'s personal agent",
|
|
8
|
+
app: 'Posted by {0} through an AI app. The app gave the name "{1}" itself.',
|
|
9
|
+
},
|
|
10
|
+
"zh-TW": {
|
|
11
|
+
agend: "AgEnD Agent",
|
|
12
|
+
fleet: "{0} 的 Fleet 裡的 Agent",
|
|
13
|
+
personal: "{0} 的個人 Agent",
|
|
14
|
+
app: "由 {0} 透過 AI App 發出。「{1}」是 App 自己提供的名稱。",
|
|
15
|
+
},
|
|
16
|
+
});
|
|
17
|
+
export const hsource = (key, ...args) => t(`hubRoomSource.${key}`, ...args);
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// Display only: an app's registered name never establishes a vendor identity or room membership.
|
|
2
|
+
import { html, render } from "/assets/app-html.js";
|
|
3
|
+
import { Icon } from "/assets/ui-icons.js";
|
|
4
|
+
import { toast } from "/assets/ui-toast.js";
|
|
5
|
+
import { hsource } from "./hub-room-source-strings.js";
|
|
6
|
+
|
|
7
|
+
export function roomSource(author) {
|
|
8
|
+
if (!author) return null;
|
|
9
|
+
if (author.via?.kind === "app") return { kind: "app", label: hsource("app", String(author.name || ""), String(author.via.name || "")) };
|
|
10
|
+
const agent = author.kind === "agent" || author.kind === "later";
|
|
11
|
+
if (!agent && author.via?.kind !== "agent") return null;
|
|
12
|
+
const owner = agent ? author.owner?.name : author.name;
|
|
13
|
+
const label = owner && author.agentKind ? hsource(author.agentKind === "personal" ? "personal" : "fleet", String(owner)) : hsource("agend");
|
|
14
|
+
return { kind: "agend", label };
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function RoomSourceMark({ source, decorative = false }) {
|
|
18
|
+
if (!source) return null;
|
|
19
|
+
return html`<span class="hub-source-mark" data-room-source=${source.kind} role=${decorative ? undefined : "img"}
|
|
20
|
+
aria-hidden=${decorative ? "true" : undefined} aria-label=${decorative ? undefined : source.label} title=${source.label}>
|
|
21
|
+
${source.kind === "agend" ? html`<img src="/assets/agend-mark.svg" width="16" height="16" alt="" aria-hidden="true" />` : html`<${Icon} name="view" size=${16} />`}
|
|
22
|
+
</span>`;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** Stateless island inside the shared thread's sender node. No raw markup comes from the message. */
|
|
26
|
+
export function mountSourceAuthor(sender, message) {
|
|
27
|
+
const source = message?.sourceBadge;
|
|
28
|
+
if (!sender || !source) return;
|
|
29
|
+
sender.textContent = "";
|
|
30
|
+
render(html`<button type="button" class="hub-source-trigger" title=${source.label}
|
|
31
|
+
aria-label=${`${message.sender}. ${source.label}`} onClick=${() => toast(source.label, true, { detail: true })}>
|
|
32
|
+
<${RoomSourceMark} source=${source} decorative=${true} /><span>${message.sender}</span>
|
|
33
|
+
</button>`, sender);
|
|
34
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import {hp} from "./hub-personal-agent-strings.js";
|
|
1
2
|
// 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
|
|
2
3
|
// through panel-hub.js's HubThread). docs/design/hub-rooms-ux.md §3 says only where a room differs from the Fleet chat:
|
|
3
4
|
// - every message says who wrote it — a person by name (mine: on the right, no name), an agent as 「name · owner 的 Agent」,
|
|
@@ -20,12 +21,14 @@ import { register, t } from "/assets/app-i18n.js";
|
|
|
20
21
|
import "./hub-strings.js";
|
|
21
22
|
import { firstCharacter } from "/assets/instance-nav.js";
|
|
22
23
|
import { hroom } from "./hub-room-strings.js";
|
|
24
|
+
import {ha} from "./hub-ai-apps-strings.js";
|
|
23
25
|
import { RoomComposer } from "./hub-room-composer.js";
|
|
24
26
|
import { TextSizeButton } from "/assets/header-tools.js";
|
|
25
27
|
import { HubNotifyToggle } from "./hub-room-notify.js";
|
|
26
28
|
import { createHubButtonActions } from "./hub-button-actions.js";
|
|
27
29
|
import { linkRoomsU2Css } from "./hub-room-new-strings.js";
|
|
28
30
|
import { workingLine } from "./hub-room-working.js";
|
|
31
|
+
import { roomSource, mountSourceAuthor } from "./hub-room-source.js";
|
|
29
32
|
import { countsLine } from "./hub-room-list.js";
|
|
30
33
|
import { PendingFiles, hf, hubFileAttachment, pageCarriesFiles, roomTakesFiles, uploadChosen } from "./hub-attachments.js";
|
|
31
34
|
import { LightboxHost, openLightbox } from "/assets/image-lightbox.js";
|
|
@@ -62,6 +65,7 @@ export function authorLine(author, mine = false, direct = false) {
|
|
|
62
65
|
*/
|
|
63
66
|
const SYSTEM = { "room-created": "createdSys", "member-joined": "sysJoined", "admin-joined": "sysAdminJoined", "poll-closed": "sysPollClosed" };
|
|
64
67
|
export function systemText(m) {
|
|
68
|
+
if(m?.system?.kind==="app-rate-limited")return ha("rateLimited",m.system.name||"");
|
|
65
69
|
if (m?.system?.kind === "agent-mention-stopped") return agentStopText(m.system) ?? String(m.text || "");
|
|
66
70
|
const key = m && m.system && SYSTEM[m.system.kind];
|
|
67
71
|
return key && typeof m.system.name === "string" ? hroom(key, m.system.name) : String((m && m.text) || "");
|
|
@@ -158,8 +162,9 @@ export function toThreadMessages(messages, { meId, ids, direct = false, expanded
|
|
|
158
162
|
// The quote chip keeps a stable key even when that original is not in this page (scroll-up / findQuoted loads it).
|
|
159
163
|
const quotedId = m.replyTo || m.answerTo || "";
|
|
160
164
|
const quoted = quotedId ? byId.get(quotedId) : null;
|
|
161
|
-
const state = askState(askOf(m, messages));
|
|
165
|
+
const state = askState(askOf(m, messages)), sourceBadge = roomSource(author);
|
|
162
166
|
out.push({ boot: BOOT, id, role: kind === "person" && !author.via ? "user" : "agent", sender: authorLine(author, mine, direct), ts: iso(m.at), text: String(m.text || ""), mine,
|
|
167
|
+
...(sourceBadge ? { sourceBadge } : {}),
|
|
163
168
|
...(kind === "person" && !mine && !author.via ? { person: true } : {}), // Lumen (spec §3): someone else's words, a bubble on the left
|
|
164
169
|
roomMessage: m.id, ...(mine && state?.delivery ? { delivery: state.delivery } : {}),
|
|
165
170
|
// M-3125: a post's files, as the 1:1 chat maps them (images inline through the Hub's own route; HTML gets its preview card).
|
|
@@ -434,6 +439,7 @@ export function HubRoomPage({ roomId, listed = null, Thread, client, meId = "",
|
|
|
434
439
|
const labels = () => [hroom("mentionAll"), hroom("mentionAssistant"), ...(store.detail()?.members || []).filter((m) => m.kind !== "assistant").map((m) => `@${m.name}`)];
|
|
435
440
|
const extra = {
|
|
436
441
|
isUser: (x) => x.mine === true, canReply: () => !store.closed(),
|
|
442
|
+
senderBadge: mountSourceAuthor,
|
|
437
443
|
mentionLabels: labels,
|
|
438
444
|
// A line's one action: 「展開其餘 N 則」, or 「請房間助理整理」 (spec §10: the same as sending 「@房間助理 整理上面的回答」).
|
|
439
445
|
statusAction: (arg) => { if (String(arg).startsWith("summarise:")) { if (!store.closed()) void store.send(hroom("summarisePrompt"), { mentions: ["assistant"] }); } else store.expand(arg); },
|
|
@@ -451,7 +457,7 @@ export function HubRoomPage({ roomId, listed = null, Thread, client, meId = "",
|
|
|
451
457
|
openImage: (links, img) => openLightbox(links, img, annotateRef.current(img)),
|
|
452
458
|
};
|
|
453
459
|
const line2 = group ? `${countsLine(room.people, room.agents)}${hasAssistant ? ` · ${hroom("roomAssistant")}` : ""}`
|
|
454
|
-
: room.assistant ? hroom("providedByHub") : String(room.agent?.owner?.name || "");
|
|
460
|
+
: room.assistant ? hroom("providedByHub") : room.agent?.answerOnly ? hp("answerOnlyAsker") : String(room.agent?.owner?.name || "");
|
|
455
461
|
const showRail = wide && rail && Panel && group && detail;
|
|
456
462
|
// The Fleet chat's working bar (Lumen): 「Notes 正在處理」, or 「2 個 Agent 正在處理」 — the answer row only when it arrives.
|
|
457
463
|
// Who: this room's answers being worked on; the words: workingLine() (#3857), the one place that says it.
|
|
@@ -463,12 +469,12 @@ export function HubRoomPage({ roomId, listed = null, Thread, client, meId = "",
|
|
|
463
469
|
return html`<div class=${`hub-chat hub-room-page${showRail ? " with-rail" : ""}`} data-room=${roomId}>
|
|
464
470
|
<${LightboxHost} />
|
|
465
471
|
<section class="hub-chat-main">
|
|
466
|
-
<header class
|
|
472
|
+
<header class=${`hub-chat-head${room.agent?.answerOnly?" hub-answer-only-head":""}`} data-trust="panel-content">
|
|
467
473
|
${/* Lumen (spec §2): on a phone the header starts with the Fleet chat's back to the list. */ ""}
|
|
468
474
|
<a class="icon-btn hub-back only-narrow" href="/ui/hub" aria-label=${t("hub.back")} title=${t("hub.back")}
|
|
469
475
|
onClick=${(e) => { if (e.metaKey || e.ctrlKey) return; e.preventDefault(); goList(); }}><${Icon} name="back" /></a>
|
|
470
476
|
<span class=${`av${group ? " av-square" : ""}`} aria-hidden="true"><span class="av-text">${firstCharacter(title || "?") || "?"}</span></span>
|
|
471
|
-
<span class="hub-chat-title"><strong>${title}</strong><span class
|
|
477
|
+
<span class="hub-chat-title"><strong>${title}</strong><span class=${`s${room.agent?.answerOnly?" hub-answer-only-note":""}`}>${line2}</span></span>
|
|
472
478
|
<span class="hub-head-tools"><${TextSizeButton} /><${HubNotifyToggle} /></span>
|
|
473
479
|
${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")}
|
|
474
480
|
onClick=${() => (wide ? setRail(!rail) : setSheet(true))}><${Icon} name="team" size=${18} /></button>` : null}
|
package/dist/ui/panel-chat.js
CHANGED
|
@@ -689,7 +689,7 @@ export function threadsToLetGo(kept, current, { keep, maxNodes, favorites, prote
|
|
|
689
689
|
}
|
|
690
690
|
return out;
|
|
691
691
|
}
|
|
692
|
-
const narrowScreen = () => typeof matchMedia === "function" && matchMedia("(max-width: 899px)").matches;
|
|
692
|
+
const narrowScreen = () => typeof matchMedia === "function" && matchMedia("(max-width: 899px), (pointer: coarse) and (max-height: 500px) and (max-width: 1023px)").matches;
|
|
693
693
|
/**
|
|
694
694
|
* M-3167: the composer's own model picker and context ring, below this width. The header's chips give way to them
|
|
695
695
|
* there (chat-work-bar.css, the same width), so the model is always in one place and never under the agent's tabs.
|
|
@@ -944,7 +944,7 @@ function Dock({ name, inst, lease, exec, awaiting, workingLabel, bindings, ids,
|
|
|
944
944
|
const s = store.state;
|
|
945
945
|
// M-3166 (Argon 0): a phone's one line above the box — model · effort · context, or what the agent is doing — instead of
|
|
946
946
|
// the working bar; the line under the box goes with it (its Not verified is this line's right end).
|
|
947
|
-
const metaLine = useMedia("(max-width: 899px)") && !guestPage();
|
|
947
|
+
const metaLine = useMedia("(max-width: 899px), (pointer: coarse) and (max-height: 500px) and (max-width: 1023px)") && !guestPage();
|
|
948
948
|
return html`<div data-trust="composer" class="dock"><div class="dock-col">
|
|
949
949
|
<${Prompts} name=${name} />
|
|
950
950
|
<${SubagentProgress} name=${name} />
|
|
@@ -997,7 +997,7 @@ function modelDescription(o, name) {
|
|
|
997
997
|
* so in the menu and keeps the list (M-2731); a refused switch (no list with it) is the card's.
|
|
998
998
|
*/
|
|
999
999
|
function ModelMenu({ name, c, lease }) {
|
|
1000
|
-
const narrow = useMedia("(max-width: 899px)");
|
|
1000
|
+
const narrow = useMedia("(max-width: 899px), (pointer: coarse) and (max-height: 500px) and (max-width: 1023px)");
|
|
1001
1001
|
const close = () => store.dismissCommand(name);
|
|
1002
1002
|
const alive = () => lease.current();
|
|
1003
1003
|
const run = (args, action) => store.runCommand(name, "model", args, { alive, ...(action ? { action } : {}) });
|
|
@@ -1252,7 +1252,7 @@ function Composer({ name, inst, label = name, lease, busy, bindings, ids = {}, f
|
|
|
1252
1252
|
// with nothing typed, Send is Stop (typed: Send again, and Stop is the status line's).
|
|
1253
1253
|
// M-3167: both read live, so a window resized across them redraws (read once, a phone's ring and picker stayed on a
|
|
1254
1254
|
// desk, unstyled). Between the phone's width and a wide desk the composer has the ring and a short model chip too.
|
|
1255
|
-
const narrow = useMedia("(max-width: 899px)"), toolsHere = useMedia(COMPOSER_TOOLS_Q);
|
|
1255
|
+
const narrow = useMedia("(max-width: 899px), (pointer: coarse) and (max-height: 500px) and (max-width: 1023px)"), toolsHere = useMedia(COMPOSER_TOOLS_Q);
|
|
1256
1256
|
const phone = narrow && !guestPage();
|
|
1257
1257
|
const stopNow = phone && busy && !content;
|
|
1258
1258
|
// A file waiting: what goes is a message with its file, never a command (no palette, no command line). #2855: a guest's
|
package/dist/ui/panel-fleet.js
CHANGED
|
@@ -145,7 +145,7 @@ function useLoad(lease, path, version) {
|
|
|
145
145
|
* memory warning), all six tabs and the header's tools. Otherwise the tabs are the row under the header, as before —
|
|
146
146
|
* never clipped, never squeezed. The natural widths are the same in either place, so the answer does not flip-flop.
|
|
147
147
|
*/
|
|
148
|
-
const NARROW = "(max-width: 899px)";
|
|
148
|
+
const NARROW = "(max-width: 899px), (pointer: coarse) and (max-height: 500px) and (max-width: 1023px)";
|
|
149
149
|
export function tabsFit(m) { return m.title + m.tabs + m.tools + m.gaps <= m.room + 0.5; }
|
|
150
150
|
export function measureTabsFit(root) {
|
|
151
151
|
const head = root?.querySelector(".panel-head");
|
|
@@ -170,11 +170,11 @@ export function measureTabsFit(root) {
|
|
|
170
170
|
}
|
|
171
171
|
/** M-3166: whether this is a phone's width (under 900 px), kept current as the window is resized. */
|
|
172
172
|
function usePhoneWidth() {
|
|
173
|
-
const read = () => typeof matchMedia === "function" && matchMedia("(max-width: 899px)").matches;
|
|
173
|
+
const read = () => typeof matchMedia === "function" && matchMedia("(max-width: 899px), (pointer: coarse) and (max-height: 500px) and (max-width: 1023px)").matches;
|
|
174
174
|
const [on, setOn] = useState(read);
|
|
175
175
|
useEffect(() => {
|
|
176
176
|
if (typeof matchMedia !== "function") return undefined;
|
|
177
|
-
const mq = matchMedia("(max-width: 899px)"), changed = () => setOn(mq.matches);
|
|
177
|
+
const mq = matchMedia("(max-width: 899px), (pointer: coarse) and (max-height: 500px) and (max-width: 1023px)"), changed = () => setOn(mq.matches);
|
|
178
178
|
changed(); mq.addEventListener?.("change", changed);
|
|
179
179
|
return () => mq.removeEventListener?.("change", changed);
|
|
180
180
|
}, []);
|