@songsid/agend 2.4.0-alpha.2 → 2.4.0-alpha.4
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/account-isolation.d.ts +6 -0
- package/dist/account-isolation.js +40 -0
- package/dist/account-isolation.js.map +1 -0
- package/dist/accounts-signout.d.ts +15 -2
- package/dist/accounts-signout.js +52 -4
- package/dist/accounts-signout.js.map +1 -1
- package/dist/accounts-view.d.ts +114 -27
- package/dist/accounts-view.js +123 -60
- package/dist/accounts-view.js.map +1 -1
- package/dist/agent-cli-instructions.md +15 -9
- package/dist/agent-cli.js +47 -20
- package/dist/agent-cli.js.map +1 -1
- package/dist/agent-endpoint.js +23 -8
- package/dist/agent-endpoint.js.map +1 -1
- package/dist/agent-list-output.d.ts +23 -0
- package/dist/agent-list-output.js +53 -0
- package/dist/agent-list-output.js.map +1 -0
- package/dist/agent-runtime-change.js +4 -4
- package/dist/agent-runtime-change.js.map +1 -1
- package/dist/agent-whats-new.js +9 -7
- package/dist/agent-whats-new.js.map +1 -1
- package/dist/antigravity-first-run.d.ts +4 -0
- package/dist/antigravity-first-run.js +57 -0
- package/dist/antigravity-first-run.js.map +1 -0
- package/dist/antigravity-identity.d.ts +6 -0
- package/dist/antigravity-identity.js +27 -0
- package/dist/antigravity-identity.js.map +1 -0
- package/dist/antigravity-store.d.ts +22 -0
- package/dist/antigravity-store.js +79 -0
- package/dist/antigravity-store.js.map +1 -0
- package/dist/auth-api.js +11 -1
- package/dist/auth-api.js.map +1 -1
- package/dist/backend/agy-onboarding.d.ts +14 -0
- package/dist/backend/agy-onboarding.js +114 -0
- package/dist/backend/agy-onboarding.js.map +1 -0
- package/dist/backend/antigravity.d.ts +15 -0
- package/dist/backend/antigravity.js +44 -4
- package/dist/backend/antigravity.js.map +1 -1
- package/dist/backend/claude-code.d.ts +8 -0
- package/dist/backend/claude-code.js +11 -4
- package/dist/backend/claude-code.js.map +1 -1
- package/dist/backend/codex.js +7 -3
- package/dist/backend/codex.js.map +1 -1
- package/dist/backend/credential-profile.d.ts +22 -3
- package/dist/backend/credential-profile.js +61 -9
- package/dist/backend/credential-profile.js.map +1 -1
- package/dist/backend/grok.d.ts +19 -0
- package/dist/backend/grok.js +112 -1
- package/dist/backend/grok.js.map +1 -1
- package/dist/backend/types.d.ts +10 -0
- package/dist/backend/types.js.map +1 -1
- package/dist/backend-availability.d.ts +6 -0
- package/dist/backend-availability.js +11 -0
- package/dist/backend-availability.js.map +1 -1
- package/dist/browser-backend-signins.d.ts +9 -1
- package/dist/browser-backend-signins.js +9 -5
- package/dist/browser-backend-signins.js.map +1 -1
- package/dist/build-provenance.json +1 -1
- package/dist/channel/mcp-tools.js +10 -10
- package/dist/channel/mcp-tools.js.map +1 -1
- package/dist/child-process.d.ts +1 -0
- package/dist/child-process.js.map +1 -1
- package/dist/claude-auth-status.d.ts +1 -0
- package/dist/claude-auth-status.js +25 -0
- package/dist/claude-auth-status.js.map +1 -1
- package/dist/claude-model-observation.d.ts +71 -0
- package/dist/claude-model-observation.js +169 -0
- package/dist/claude-model-observation.js.map +1 -0
- package/dist/cli-capability.d.ts +104 -19
- package/dist/cli-capability.js +3 -1
- package/dist/cli-capability.js.map +1 -1
- package/dist/cli-caps-module.d.ts +14 -0
- package/dist/cli-caps-module.js +8 -1
- package/dist/cli-caps-module.js.map +1 -1
- package/dist/cli-registry-check.js +114 -18
- package/dist/cli-registry-check.js.map +1 -1
- package/dist/cli-registry.d.ts +116 -12
- package/dist/cli-registry.js +16 -1
- package/dist/cli-registry.js.map +1 -1
- package/dist/cli-spec-antigravity.d.ts +53 -11
- package/dist/cli-spec-antigravity.js +44 -13
- package/dist/cli-spec-antigravity.js.map +1 -1
- package/dist/cli-spec-claude-code.d.ts +14 -1
- package/dist/cli-spec-claude-code.js +5 -4
- package/dist/cli-spec-claude-code.js.map +1 -1
- package/dist/cli-spec-codex.d.ts +8 -0
- package/dist/cli-spec-codex.js +4 -3
- package/dist/cli-spec-codex.js.map +1 -1
- package/dist/cli-spec-grok.d.ts +4 -0
- package/dist/cli-spec-grok.js +2 -1
- package/dist/cli-spec-grok.js.map +1 -1
- package/dist/cli-spec-kiro-cli.d.ts +7 -0
- package/dist/cli-spec-kiro-cli.js +3 -2
- package/dist/cli-spec-kiro-cli.js.map +1 -1
- package/dist/cli-spec-muse.d.ts +4 -0
- package/dist/cli-spec-muse.js +2 -1
- package/dist/cli-spec-muse.js.map +1 -1
- package/dist/cli-spec-opencode.d.ts +1 -0
- package/dist/cli-spec-opencode.js +1 -0
- package/dist/cli-spec-opencode.js.map +1 -1
- package/dist/credential-store-proof.d.ts +6 -0
- package/dist/credential-store-proof.js +30 -0
- package/dist/credential-store-proof.js.map +1 -0
- package/dist/cross-instance-envelope.d.ts +4 -1
- package/dist/cross-instance-envelope.js +12 -7
- package/dist/cross-instance-envelope.js.map +1 -1
- package/dist/daemon.d.ts +24 -2
- package/dist/daemon.js +265 -37
- package/dist/daemon.js.map +1 -1
- package/dist/decision-list.d.ts +5 -4
- package/dist/decision-list.js +22 -8
- package/dist/decision-list.js.map +1 -1
- package/dist/delivery-consumed-watch.d.ts +24 -0
- package/dist/delivery-consumed-watch.js +21 -10
- package/dist/delivery-consumed-watch.js.map +1 -1
- package/dist/delivery-outbox.d.ts +5 -1
- package/dist/delivery-outbox.js +5 -0
- package/dist/delivery-outbox.js.map +1 -1
- package/dist/fleet-manager.d.ts +31 -2
- package/dist/fleet-manager.js +238 -56
- package/dist/fleet-manager.js.map +1 -1
- package/dist/fleet-windows-runtime.js +6 -6
- package/dist/fleet-windows-runtime.js.map +1 -1
- package/dist/general-knowledge/skills/concepts/SKILL.md +48 -7
- package/dist/general-knowledge/skills/credential-profiles/SKILL.md +23 -6
- package/dist/general-knowledge/skills/cross-instance-messaging/SKILL.md +18 -8
- package/dist/general-knowledge/skills/fleet-health/SKILL.md +16 -0
- package/dist/general-knowledge/skills/hub/SKILL.md +518 -0
- package/dist/general-knowledge/skills/multi-channel/SKILL.md +1 -1
- package/dist/general-knowledge/skills/scheduling/SKILL.md +1 -1
- package/dist/general-knowledge/skills/web-dashboard/SKILL.md +199 -40
- package/dist/general-knowledge/skills/worker-collaboration/SKILL.md +5 -1
- package/dist/general-role.d.ts +1 -1
- package/dist/general-role.js +1 -0
- package/dist/general-role.js.map +1 -1
- package/dist/grok-delivery-proof.d.ts +24 -0
- package/dist/grok-delivery-proof.js +124 -0
- package/dist/grok-delivery-proof.js.map +1 -0
- package/dist/hub/assistant/admin-types.d.ts +43 -0
- package/dist/hub/assistant/admin-types.js +2 -0
- package/dist/hub/assistant/admin-types.js.map +1 -0
- package/dist/hub/assistant/claude-host.d.ts +17 -0
- package/dist/hub/assistant/claude-host.js +300 -0
- package/dist/hub/assistant/claude-host.js.map +1 -0
- package/dist/hub/assistant/context.d.ts +3 -0
- package/dist/hub/assistant/context.js +7 -0
- package/dist/hub/assistant/context.js.map +1 -0
- package/dist/hub/assistant/fleet-host.d.ts +19 -0
- package/dist/hub/assistant/fleet-host.js +28 -0
- package/dist/hub/assistant/fleet-host.js.map +1 -0
- package/dist/hub/assistant/runner.d.ts +64 -0
- package/dist/hub/assistant/runner.js +239 -0
- package/dist/hub/assistant/runner.js.map +1 -0
- package/dist/hub/assistant/service.d.ts +51 -0
- package/dist/hub/assistant/service.js +143 -0
- package/dist/hub/assistant/service.js.map +1 -0
- package/dist/hub/assistant/store.d.ts +3 -0
- package/dist/hub/assistant/store.js +65 -0
- package/dist/hub/assistant/store.js.map +1 -0
- package/dist/hub/assistant/types.d.ts +60 -0
- package/dist/hub/assistant/types.js +2 -0
- package/dist/hub/assistant/types.js.map +1 -0
- package/dist/hub/buttons.d.ts +3 -0
- package/dist/hub/buttons.js +11 -11
- package/dist/hub/buttons.js.map +1 -1
- package/dist/hub/catalog.d.ts +13 -6
- package/dist/hub/catalog.js +127 -35
- package/dist/hub/catalog.js.map +1 -1
- package/dist/hub/client.d.ts +16 -0
- package/dist/hub/client.js +52 -9
- package/dist/hub/client.js.map +1 -1
- package/dist/hub/compose/member.d.ts +8 -1
- package/dist/hub/compose/member.js +238 -57
- package/dist/hub/compose/member.js.map +1 -1
- package/dist/hub/compose/server.d.ts +17 -1
- package/dist/hub/compose/server.js +76 -13
- package/dist/hub/compose/server.js.map +1 -1
- package/dist/hub/directory/admission.d.ts +15 -0
- package/dist/hub/directory/admission.js +56 -0
- package/dist/hub/directory/admission.js.map +1 -0
- package/dist/hub/directory/directory.d.ts +1 -1
- package/dist/hub/directory/directory.js +114 -0
- package/dist/hub/directory/directory.js.map +1 -1
- package/dist/hub/directory/types.d.ts +27 -0
- package/dist/hub/directory/types.js.map +1 -1
- package/dist/hub/enrolment-code.d.ts +1 -1
- package/dist/hub/enrolment-code.js +4 -4
- package/dist/hub/enrolment-code.js.map +1 -1
- package/dist/hub/grant-access.d.ts +11 -0
- package/dist/hub/grant-access.js +113 -0
- package/dist/hub/grant-access.js.map +1 -0
- package/dist/hub/grant-search.d.ts +9 -0
- package/dist/hub/grant-search.js +92 -0
- package/dist/hub/grant-search.js.map +1 -0
- package/dist/hub/group-policy/admin-control.d.ts +1 -0
- package/dist/hub/group-policy/admin-control.js +4 -2
- package/dist/hub/group-policy/admin-control.js.map +1 -1
- package/dist/hub/group-policy/admin-facts.d.ts +1 -0
- package/dist/hub/group-policy/admin-facts.js +2 -1
- package/dist/hub/group-policy/admin-facts.js.map +1 -1
- package/dist/hub/group-policy/admin-impact.d.ts +2 -0
- package/dist/hub/group-policy/admin-impact.js +10 -2
- package/dist/hub/group-policy/admin-impact.js.map +1 -1
- package/dist/hub/group-policy/admin-inventory.js +1 -1
- package/dist/hub/group-policy/admin-inventory.js.map +1 -1
- package/dist/hub/group-policy/admin-read.d.ts +1 -0
- package/dist/hub/group-policy/admin-read.js +3 -2
- package/dist/hub/group-policy/admin-read.js.map +1 -1
- package/dist/hub/group-policy/authorization.d.ts +5 -2
- package/dist/hub/group-policy/authorization.js +73 -32
- package/dist/hub/group-policy/authorization.js.map +1 -1
- package/dist/hub/group-policy/errors.d.ts +9 -0
- package/dist/hub/group-policy/errors.js +13 -0
- package/dist/hub/group-policy/errors.js.map +1 -0
- package/dist/hub/group-policy/impact-inventory.js +20 -4
- package/dist/hub/group-policy/impact-inventory.js.map +1 -1
- package/dist/hub/group-policy/resources.d.ts +4 -5
- package/dist/hub/group-policy/resources.js +26 -19
- package/dist/hub/group-policy/resources.js.map +1 -1
- package/dist/hub/group-policy/store.d.ts +21 -12
- package/dist/hub/group-policy/store.js +99 -109
- package/dist/hub/group-policy/store.js.map +1 -1
- package/dist/hub/group-policy/welcome.js.map +1 -1
- package/dist/hub/http/compose.d.ts +1 -0
- package/dist/hub/http/compose.js +463 -20
- package/dist/hub/http/compose.js.map +1 -1
- package/dist/hub/http/core.d.ts +24 -5
- package/dist/hub/http/core.js +181 -54
- package/dist/hub/http/core.js.map +1 -1
- package/dist/hub/http/deps.d.ts +26 -0
- package/dist/hub/http/schema.js +19 -0
- package/dist/hub/http/schema.js.map +1 -1
- package/dist/hub/init/member-certificate.d.ts +1 -0
- package/dist/hub/init/member-certificate.js +39 -0
- package/dist/hub/init/member-certificate.js.map +1 -0
- package/dist/hub/init/plan-digest.js +1 -0
- package/dist/hub/init/plan-digest.js.map +1 -1
- package/dist/hub/invitations.d.ts +96 -0
- package/dist/hub/invitations.js +292 -0
- package/dist/hub/invitations.js.map +1 -0
- package/dist/hub/join/certificate-trust.d.ts +13 -0
- package/dist/hub/join/certificate-trust.js +41 -0
- package/dist/hub/join/certificate-trust.js.map +1 -0
- package/dist/hub/join/certificate.d.ts +11 -0
- package/dist/hub/join/certificate.js +67 -0
- package/dist/hub/join/certificate.js.map +1 -0
- package/dist/hub/join/client.d.ts +5 -0
- package/dist/hub/join/client.js +30 -3
- package/dist/hub/join/client.js.map +1 -1
- package/dist/hub/join/http.js +5 -3
- package/dist/hub/join/http.js.map +1 -1
- package/dist/hub/join/local.d.ts +37 -1
- package/dist/hub/join/local.js +142 -14
- package/dist/hub/join/local.js.map +1 -1
- package/dist/hub/join/service.d.ts +19 -0
- package/dist/hub/join/service.js +46 -35
- package/dist/hub/join/service.js.map +1 -1
- package/dist/hub/join/trust.d.ts +9 -0
- package/dist/hub/join/trust.js +35 -0
- package/dist/hub/join/trust.js.map +1 -1
- package/dist/hub/member/pairing-api.js +12 -1
- package/dist/hub/member/pairing-api.js.map +1 -1
- package/dist/hub/member/room-ask.d.ts +137 -0
- package/dist/hub/member/room-ask.js +358 -0
- package/dist/hub/member/room-ask.js.map +1 -0
- package/dist/hub/member-journal.d.ts +18 -1
- package/dist/hub/member-journal.js +76 -3
- package/dist/hub/member-journal.js.map +1 -1
- package/dist/hub/member-origin.d.ts +177 -0
- package/dist/hub/member-origin.js +314 -0
- package/dist/hub/member-origin.js.map +1 -0
- package/dist/hub/pairing-notices.d.ts +1 -0
- package/dist/hub/pairing-notices.js +2 -1
- package/dist/hub/pairing-notices.js.map +1 -1
- package/dist/hub/pairing.d.ts +11 -0
- package/dist/hub/pairing.js +69 -21
- package/dist/hub/pairing.js.map +1 -1
- package/dist/hub/policy.d.ts +1 -1
- package/dist/hub/policy.js +19 -6
- package/dist/hub/policy.js.map +1 -1
- package/dist/hub/protocol.d.ts +172 -0
- package/dist/hub/protocol.js +25 -2
- package/dist/hub/protocol.js.map +1 -1
- package/dist/hub/quota.d.ts +2 -1
- package/dist/hub/quota.js +2 -2
- package/dist/hub/quota.js.map +1 -1
- package/dist/hub/roles/authority.d.ts +45 -0
- package/dist/hub/roles/authority.js +199 -0
- package/dist/hub/roles/authority.js.map +1 -0
- package/dist/hub/roles/change.d.ts +18 -0
- package/dist/hub/roles/change.js +76 -0
- package/dist/hub/roles/change.js.map +1 -0
- package/dist/hub/roles/clock.d.ts +18 -0
- package/dist/hub/roles/clock.js +58 -0
- package/dist/hub/roles/clock.js.map +1 -0
- package/dist/hub/roles/convert.d.ts +11 -0
- package/dist/hub/roles/convert.js +27 -0
- package/dist/hub/roles/convert.js.map +1 -0
- package/dist/hub/roles/cutover-inventory.d.ts +14 -0
- package/dist/hub/roles/cutover-inventory.js +42 -0
- package/dist/hub/roles/cutover-inventory.js.map +1 -0
- package/dist/hub/roles/cutover-marker.d.ts +57 -0
- package/dist/hub/roles/cutover-marker.js +26 -0
- package/dist/hub/roles/cutover-marker.js.map +1 -0
- package/dist/hub/roles/cutover.d.ts +32 -0
- package/dist/hub/roles/cutover.js +170 -0
- package/dist/hub/roles/cutover.js.map +1 -0
- package/dist/hub/roles/delegation.d.ts +24 -0
- package/dist/hub/roles/delegation.js +111 -0
- package/dist/hub/roles/delegation.js.map +1 -0
- package/dist/hub/roles/evaluate.d.ts +50 -0
- package/dist/hub/roles/evaluate.js +96 -0
- package/dist/hub/roles/evaluate.js.map +1 -0
- package/dist/hub/roles/expiry.d.ts +46 -0
- package/dist/hub/roles/expiry.js +180 -0
- package/dist/hub/roles/expiry.js.map +1 -0
- package/dist/hub/roles/mode-effects.d.ts +5 -0
- package/dist/hub/roles/mode-effects.js +21 -0
- package/dist/hub/roles/mode-effects.js.map +1 -0
- package/dist/hub/roles/model.d.ts +171 -0
- package/dist/hub/roles/model.js +79 -0
- package/dist/hub/roles/model.js.map +1 -0
- package/dist/hub/roles/read.d.ts +33 -0
- package/dist/hub/roles/read.js +55 -0
- package/dist/hub/roles/read.js.map +1 -0
- package/dist/hub/roles/writer.d.ts +80 -0
- package/dist/hub/roles/writer.js +427 -0
- package/dist/hub/roles/writer.js.map +1 -0
- package/dist/hub/rooms/admin.d.ts +45 -0
- package/dist/hub/rooms/admin.js +105 -0
- package/dist/hub/rooms/admin.js.map +1 -0
- package/dist/hub/rooms/agents.d.ts +74 -0
- package/dist/hub/rooms/agents.js +333 -0
- package/dist/hub/rooms/agents.js.map +1 -0
- package/dist/hub/rooms/assistant.d.ts +44 -0
- package/dist/hub/rooms/assistant.js +179 -0
- package/dist/hub/rooms/assistant.js.map +1 -0
- package/dist/hub/rooms/context.d.ts +10 -0
- package/dist/hub/rooms/context.js +24 -0
- package/dist/hub/rooms/context.js.map +1 -0
- package/dist/hub/rooms/direct-view.d.ts +39 -0
- package/dist/hub/rooms/direct-view.js +38 -0
- package/dist/hub/rooms/direct-view.js.map +1 -0
- package/dist/hub/rooms/directory.d.ts +35 -0
- package/dist/hub/rooms/directory.js +98 -0
- package/dist/hub/rooms/directory.js.map +1 -0
- package/dist/hub/rooms/schema.d.ts +11 -0
- package/dist/hub/rooms/schema.js +73 -0
- package/dist/hub/rooms/schema.js.map +1 -0
- package/dist/hub/rooms/service.d.ts +449 -0
- package/dist/hub/rooms/service.js +581 -0
- package/dist/hub/rooms/service.js.map +1 -0
- package/dist/hub/rooms/types.d.ts +79 -0
- package/dist/hub/rooms/types.js +2 -0
- package/dist/hub/rooms/types.js.map +1 -0
- package/dist/hub/rooms.d.ts +15 -1
- package/dist/hub/rooms.js +76 -31
- package/dist/hub/rooms.js.map +1 -1
- package/dist/hub/runtime.d.ts +8 -0
- package/dist/hub/runtime.js +57 -3
- package/dist/hub/runtime.js.map +1 -1
- package/dist/hub/server.d.ts +28 -0
- package/dist/hub/server.js +66 -6
- package/dist/hub/server.js.map +1 -1
- package/dist/hub/sessions.js +6 -2
- package/dist/hub/sessions.js.map +1 -1
- package/dist/hub/settings-commit.d.ts +6 -1
- package/dist/hub/settings-commit.js +15 -0
- package/dist/hub/settings-commit.js.map +1 -1
- package/dist/hub/settings-directory-decision.d.ts +2 -2
- package/dist/hub/settings-directory-decision.js +7 -5
- package/dist/hub/settings-directory-decision.js.map +1 -1
- package/dist/hub/settings-directory-proof.js +3 -1
- package/dist/hub/settings-directory-proof.js.map +1 -1
- package/dist/hub/settings-directory-recovery.d.ts +5 -0
- package/dist/hub/settings-directory-recovery.js +14 -4
- package/dist/hub/settings-directory-recovery.js.map +1 -1
- package/dist/hub/settings-member-address-control.d.ts +84 -0
- package/dist/hub/settings-member-address-control.js +150 -0
- package/dist/hub/settings-member-address-control.js.map +1 -0
- package/dist/hub/settings-member-address-decision.d.ts +229 -0
- package/dist/hub/settings-member-address-decision.js +318 -0
- package/dist/hub/settings-member-address-decision.js.map +1 -0
- package/dist/hub/settings-member-address-http.d.ts +9 -0
- package/dist/hub/settings-member-address-http.js +78 -0
- package/dist/hub/settings-member-address-http.js.map +1 -0
- package/dist/hub/settings-member-address-network.d.ts +2 -0
- package/dist/hub/settings-member-address-network.js +22 -0
- package/dist/hub/settings-member-address-network.js.map +1 -0
- package/dist/hub/settings-member-address-notices.d.ts +22 -0
- package/dist/hub/settings-member-address-notices.js +21 -0
- package/dist/hub/settings-member-address-notices.js.map +1 -0
- package/dist/hub/settings-member-address-policy.d.ts +21 -0
- package/dist/hub/settings-member-address-policy.js +34 -0
- package/dist/hub/settings-member-address-policy.js.map +1 -0
- package/dist/hub/settings-member-address.d.ts +64 -0
- package/dist/hub/settings-member-address.js +239 -0
- package/dist/hub/settings-member-address.js.map +1 -0
- package/dist/hub/sharing.d.ts +10 -0
- package/dist/hub/sharing.js +74 -0
- package/dist/hub/sharing.js.map +1 -0
- package/dist/hub/socket.d.ts +2 -0
- package/dist/hub/socket.js +2 -0
- package/dist/hub/socket.js.map +1 -1
- package/dist/hub/store.js +6 -2
- package/dist/hub/store.js.map +1 -1
- package/dist/hub/teams/types.d.ts +41 -0
- package/dist/hub/teams/types.js +2 -0
- package/dist/hub/teams/types.js.map +1 -0
- package/dist/hub/tls.d.ts +47 -0
- package/dist/hub/tls.js +23 -6
- package/dist/hub/tls.js.map +1 -1
- package/dist/hub/types.d.ts +68 -4
- package/dist/hub/validation.d.ts +1 -1
- package/dist/hub/validation.js +2 -2
- package/dist/hub/validation.js.map +1 -1
- package/dist/hub/web-origin.d.ts +93 -0
- package/dist/hub/web-origin.js +174 -0
- package/dist/hub/web-origin.js.map +1 -0
- package/dist/hub-pilot-trust-settings.d.ts +4 -0
- package/dist/hub-pilot-trust-settings.js +13 -0
- package/dist/hub-pilot-trust-settings.js.map +1 -0
- package/dist/human-delivery-receipts.d.ts +4 -2
- package/dist/human-delivery-receipts.js +20 -13
- package/dist/human-delivery-receipts.js.map +1 -1
- package/dist/inbound-presentation.d.ts +28 -0
- package/dist/inbound-presentation.js +48 -0
- package/dist/inbound-presentation.js.map +1 -0
- package/dist/instance-lifecycle.d.ts +13 -1
- package/dist/instance-lifecycle.js +33 -10
- package/dist/instance-lifecycle.js.map +1 -1
- package/dist/instructions.d.ts +10 -2
- package/dist/instructions.js +32 -7
- package/dist/instructions.js.map +1 -1
- package/dist/locale.js +20 -6
- package/dist/locale.js.map +1 -1
- package/dist/log-service.d.ts +3 -0
- package/dist/log-service.js +39 -22
- package/dist/log-service.js.map +1 -1
- package/dist/log-steps.d.ts +56 -1
- package/dist/log-steps.js +318 -56
- package/dist/log-steps.js.map +1 -1
- package/dist/login-flows.d.ts +24 -2
- package/dist/login-flows.js +53 -22
- package/dist/login-flows.js.map +1 -1
- package/dist/login-url.js +3 -0
- package/dist/login-url.js.map +1 -1
- package/dist/machine-accounts.d.ts +42 -12
- package/dist/machine-accounts.js +144 -46
- package/dist/machine-accounts.js.map +1 -1
- package/dist/machine-signins.d.ts +35 -13
- package/dist/machine-signins.js +57 -27
- package/dist/machine-signins.js.map +1 -1
- package/dist/native-instance-input.js +4 -4
- package/dist/native-instance-input.js.map +1 -1
- package/dist/native-instance-registry.d.ts +3 -3
- package/dist/native-instance-registry.js +11 -10
- package/dist/native-instance-registry.js.map +1 -1
- package/dist/needs-you-hub.js +6 -2
- package/dist/needs-you-hub.js.map +1 -1
- package/dist/needs-you.d.ts +5 -1
- package/dist/needs-you.js +4 -8
- package/dist/needs-you.js.map +1 -1
- package/dist/office-share-page.js +1 -1
- package/dist/office-share-page.js.map +1 -1
- package/dist/outbound-handlers.d.ts +1 -0
- package/dist/outbound-handlers.js +25 -19
- package/dist/outbound-handlers.js.map +1 -1
- package/dist/outbound-schemas.d.ts +19 -0
- package/dist/outbound-schemas.js +23 -4
- package/dist/outbound-schemas.js.map +1 -1
- package/dist/profile-signins.d.ts +5 -0
- package/dist/profile-signins.js +1 -0
- package/dist/profile-signins.js.map +1 -1
- package/dist/queued-handoffs.d.ts +3 -1
- package/dist/queued-handoffs.js +1 -1
- package/dist/queued-handoffs.js.map +1 -1
- package/dist/runtime-build-info.js +6 -2
- package/dist/runtime-build-info.js.map +1 -1
- package/dist/runtime-cli.js +33 -11
- package/dist/runtime-cli.js.map +1 -1
- package/dist/runtime-client.d.ts +18 -2
- package/dist/runtime-client.js +84 -21
- package/dist/runtime-client.js.map +1 -1
- package/dist/runtime-credential-profiles.d.ts +36 -4
- package/dist/runtime-credential-profiles.js +82 -16
- package/dist/runtime-credential-profiles.js.map +1 -1
- package/dist/runtime-profile-ownership.d.ts +2 -2
- package/dist/runtime-profile-ownership.js +3 -3
- package/dist/runtime-profile-ownership.js.map +1 -1
- package/dist/runtime-protocol.d.ts +5 -3
- package/dist/runtime-protocol.js +4 -0
- package/dist/runtime-protocol.js.map +1 -1
- package/dist/runtime-remote-accounts.d.ts +72 -5
- package/dist/runtime-remote-accounts.js +293 -52
- package/dist/runtime-remote-accounts.js.map +1 -1
- package/dist/runtime-remote-setup.d.ts +2 -2
- package/dist/runtime-remote-setup.js +2 -2
- package/dist/runtime-remote-setup.js.map +1 -1
- package/dist/runtime-signin-transport.d.ts +22 -4
- package/dist/runtime-signin-transport.js +50 -12
- package/dist/runtime-signin-transport.js.map +1 -1
- package/dist/runtime-signin.d.ts +42 -0
- package/dist/runtime-signin.js +105 -9
- package/dist/runtime-signin.js.map +1 -1
- package/dist/runtime-transcript-source.d.ts +2 -0
- package/dist/runtime-transcript-source.js +23 -1
- package/dist/runtime-transcript-source.js.map +1 -1
- package/dist/runtime-windows-bridge.js +6 -1
- package/dist/runtime-windows-bridge.js.map +1 -1
- package/dist/scheduler/task-board.d.ts +1 -0
- package/dist/scheduler/task-board.js +10 -1
- package/dist/scheduler/task-board.js.map +1 -1
- package/dist/settings-api.d.ts +1 -0
- package/dist/settings-api.js +15 -8
- package/dist/settings-api.js.map +1 -1
- package/dist/settings-baseline.d.ts +3 -0
- package/dist/settings-baseline.js +2 -2
- package/dist/settings-baseline.js.map +1 -1
- package/dist/settings-effect.d.ts +3 -0
- package/dist/settings-effect.js +12 -2
- package/dist/settings-effect.js.map +1 -1
- package/dist/signin-keepalive.d.ts +31 -2
- package/dist/signin-keepalive.js +123 -12
- package/dist/signin-keepalive.js.map +1 -1
- package/dist/structured-signin-transport.d.ts +2 -2
- package/dist/structured-signin-transport.js +27 -6
- package/dist/structured-signin-transport.js.map +1 -1
- package/dist/structured-signin.d.ts +16 -2
- package/dist/structured-signin.js +59 -4
- package/dist/structured-signin.js.map +1 -1
- package/dist/task-board-tool.d.ts +0 -13
- package/dist/task-board-tool.js +42 -6
- package/dist/task-board-tool.js.map +1 -1
- package/dist/tool-receipt-output.d.ts +151 -0
- package/dist/tool-receipt-output.js +50 -0
- package/dist/tool-receipt-output.js.map +1 -0
- package/dist/topic-commands.js +2 -1
- package/dist/topic-commands.js.map +1 -1
- package/dist/transcript-jsonl.d.ts +24 -0
- package/dist/transcript-jsonl.js +72 -22
- package/dist/transcript-jsonl.js.map +1 -1
- package/dist/transcript-monitor.d.ts +5 -1
- package/dist/transcript-monitor.js +65 -3
- package/dist/transcript-monitor.js.map +1 -1
- package/dist/transcript-needles.d.ts +1 -1
- package/dist/transcript-needles.js +1 -1
- package/dist/transcript-records.d.ts +2 -1
- package/dist/transcript-records.js.map +1 -1
- package/dist/transcript-sources.d.ts +4 -0
- package/dist/transcript-sources.js +2 -0
- package/dist/transcript-sources.js.map +1 -1
- package/dist/ui/accounts-keepalive.js +15 -6
- package/dist/ui/accounts-manage.js +25 -5
- package/dist/ui/accounts-view.js +28 -24
- package/dist/ui/agent-details-settings.js +10 -1
- package/dist/ui/agent-proposals.js +22 -2
- package/dist/ui/agent-runtime-settings.js +3 -3
- package/dist/ui/backend-signin.js +4 -4
- package/dist/ui/chat-activity.js +2 -2
- package/dist/ui/cli-caps.js +7 -7
- package/dist/ui/credential-profile-select.js +32 -19
- package/dist/ui/fleet-canvas.js +5 -2
- package/dist/ui/fleet-office-card.js +4 -2
- package/dist/ui/fleet-org.js +2 -0
- package/dist/ui/hub-admin-rooms-strings.js +28 -0
- package/dist/ui/hub-admin-rooms.js +77 -0
- package/dist/ui/hub-assistant-admin-strings.js +26 -0
- package/dist/ui/hub-assistant-admin.js +85 -0
- package/dist/ui/hub-chat-store.js +8 -4
- package/dist/ui/hub-client.js +224 -33
- package/dist/ui/hub-enrolment-code.js +1 -1
- package/dist/ui/hub-grant-picker.js +100 -0
- package/dist/ui/hub-group-search.js +2 -2
- package/dist/ui/hub-invitations-strings.js +30 -0
- package/dist/ui/hub-invitations.js +108 -0
- package/dist/ui/hub-join-one-strings.js +4 -2
- package/dist/ui/hub-join-steps.js +5 -2
- package/dist/ui/hub-pairing-form-strings.js +48 -0
- package/dist/ui/hub-pilot-trust-strings.js +27 -0
- package/dist/ui/hub-pilot-trust.js +41 -0
- package/dist/ui/hub-room-composer.js +113 -0
- package/dist/ui/hub-room-favorites.js +90 -0
- package/dist/ui/hub-room-list.js +152 -0
- package/dist/ui/hub-room-members-strings.js +12 -0
- package/dist/ui/hub-room-members.js +104 -0
- package/dist/ui/hub-room-new-strings.js +46 -0
- package/dist/ui/hub-room-new.js +135 -0
- package/dist/ui/hub-room-presence.js +123 -0
- package/dist/ui/hub-room-settings-strings.js +26 -0
- package/dist/ui/hub-room-settings.js +134 -0
- package/dist/ui/hub-room-strings.js +222 -0
- package/dist/ui/hub-room-thread.js +262 -0
- package/dist/ui/hub-room-unread.js +51 -0
- package/dist/ui/hub-room-working.js +29 -0
- package/dist/ui/log-row.js +14 -5
- package/dist/ui/machine-signin.js +47 -14
- package/dist/ui/panel-details.js +6 -1
- package/dist/ui/panel-fleet.js +2 -2
- package/dist/ui/panel-hub.js +145 -59
- package/dist/ui/panel-needs.js +2 -0
- package/dist/ui/panel-settings.js +2 -2
- package/dist/ui/settings-hub-company-join.js +32 -11
- package/dist/ui/settings-hub-connection.js +9 -3
- package/dist/ui/settings-hub-member-address.js +205 -0
- package/dist/ui/settings-hub-section.js +4 -0
- package/dist/ui/settings-hub-web-address.js +233 -0
- package/dist/ui/settings-hub.js +16 -4
- package/dist/ui/shared/accounts-keepalive.css +8 -0
- package/dist/ui/shared/accounts-usage-pool.css +10 -0
- package/dist/ui/shared/accounts.css +9 -0
- package/dist/ui/shared/app-i18n.js +2 -2
- package/dist/ui/shared/app-needs.js +3 -0
- package/dist/ui/shared/app-shell.js +4 -1
- package/dist/ui/shared/app.css +43 -5
- package/dist/ui/shared/chat-render.js +10 -0
- package/dist/ui/shared/chat-thread.js +14 -5
- package/dist/ui/shared/hub-chat.css +17 -0
- package/dist/ui/shared/hub-grant-picker.css +4 -0
- package/dist/ui/shared/hub-rooms-u2.css +42 -0
- package/dist/ui/shared/hub-sharing.css +4 -0
- package/dist/ui/shared/model-observation.js +16 -0
- package/dist/ui/shared/stale-tab.css +6 -0
- package/dist/ui/shared/stale-tab.js +50 -0
- package/dist/ui/shared/view-strings.js +2 -2
- package/dist/ui/structured-signin.js +19 -6
- package/dist/ui/usage-pool.js +76 -0
- package/dist/usage/agent-output.d.ts +144 -0
- package/dist/usage/agent-output.js +75 -0
- package/dist/usage/agent-output.js.map +1 -0
- package/dist/usage/provider-alerts.d.ts +6 -0
- package/dist/usage/provider-alerts.js +6 -0
- package/dist/usage/provider-alerts.js.map +1 -1
- package/dist/usage/providers.d.ts +2 -2
- package/dist/usage/providers.js +60 -18
- package/dist/usage/providers.js.map +1 -1
- package/dist/usage/usage-api.d.ts +12 -0
- package/dist/usage/usage-api.js +39 -0
- package/dist/usage/usage-api.js.map +1 -1
- package/dist/web-api.d.ts +4 -0
- package/dist/web-api.js +32 -13
- package/dist/web-api.js.map +1 -1
- package/dist/web-backend-login.d.ts +4 -1
- package/dist/web-backend-login.js.map +1 -1
- package/dist/windows-cli-providers.js +5 -1
- package/dist/windows-cli-providers.js.map +1 -1
- package/dist/windows-cli-worker.d.ts +33 -1
- package/dist/windows-cli-worker.js +150 -10
- package/dist/windows-cli-worker.js.map +1 -1
- package/dist/windows-cli.d.ts +7 -1
- package/dist/windows-cli.js +19 -2
- package/dist/windows-cli.js.map +1 -1
- package/dist/workflow-templates/default.md +2 -2
- package/package.json +1 -1
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
// Hub rooms, the right-hand members panel (docs/design/hub-rooms-ux.md section 5): the people, the agents in presence
|
|
2
|
+
// order, the room assistant, who can see what, and (for a room manager) the way to Room settings. Clicking an agent
|
|
3
|
+
// opens a small card: @ it here, chat with it one-to-one (only when I may ask it), and, for a manager, remove it.
|
|
4
|
+
// The dots use the Fleet sidebar's colours (.dot ok / busy / warn / off), so a state reads the same in both.
|
|
5
|
+
// The shell owns the room's detail (and reads it again on member.changed); this panel applies presence.changed in place.
|
|
6
|
+
import { html, useEffect, useState } from "/assets/app-html.js";
|
|
7
|
+
import { hubClient } from "./hub-client.js";
|
|
8
|
+
import { hm } from "./hub-room-members-strings.js";
|
|
9
|
+
import { hroom } from "./hub-room-strings.js";
|
|
10
|
+
import { collapse, headerCounts, presenceDot, presenceView, sortAgents } from "./hub-room-presence.js";
|
|
11
|
+
import { hn, linkRoomsU2Css } from "./hub-room-new-strings.js";
|
|
12
|
+
|
|
13
|
+
linkRoomsU2Css();
|
|
14
|
+
|
|
15
|
+
const AGENTS_SHOWN = 8;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* The dot class and words for one member, from the shared rooms presence mapping (hub-room-presence.js: reason codes,
|
|
19
|
+
* known notes in the viewer's language, the same online count as the list). Only two things are this panel's own: a
|
|
20
|
+
* person added before their first Hub sign-in (they see the room when they first sign in), and the assistant's idle
|
|
21
|
+
* row reading 「待命 · Hub 提供」.
|
|
22
|
+
*/
|
|
23
|
+
export function memberStatus(m) {
|
|
24
|
+
if (m.kind === "person" && m.signedIn === false) return { dot: "off", text: hn("neverSignedIn") };
|
|
25
|
+
const v = presenceView(m);
|
|
26
|
+
const word = m.kind === "assistant" && v.word === "stIdle" ? hroom("assistantIdleHub") : hroom(v.word);
|
|
27
|
+
const note = v.noteKey ? hroom(v.noteKey) : v.noteText;
|
|
28
|
+
return { dot: presenceDot(v.dot), text: note ? `${word} · ${note}` : word };
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** 「林小華的 Agent」, but 「Alex 的 Agent」: a name ending in a Latin letter or digit takes a space before 的 (Lumen). */
|
|
32
|
+
export function ownerAgent(name) {
|
|
33
|
+
return hm(/[A-Za-z0-9]$/.test(name) ? "ownerAgentLatin" : "ownerAgent", name);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* The panel, in the right rail of a group room. Props (one mount line in the shell):
|
|
38
|
+
* - client;
|
|
39
|
+
* - roomId;
|
|
40
|
+
* - detail: the shell's own GET /hub/v1/rooms/:id answer { room, me: { id?, role }, members, settings, invited }. The
|
|
41
|
+
* shell reads it again on member.changed, so it is not read here. Only presence.changed is applied here, in place,
|
|
42
|
+
* until the next detail;
|
|
43
|
+
* - onMention(member): puts 「@name 」 in the composer;
|
|
44
|
+
* - onOpenChat(member): opens the one-to-one, offered only for an agent whose member row says `canAsk`;
|
|
45
|
+
* - onSettings().
|
|
46
|
+
*/
|
|
47
|
+
export function RoomMembersPanel({ client = hubClient(), roomId, detail, onMention, onOpenChat, onSettings } = {}) {
|
|
48
|
+
const [presence, setPresence] = useState({}), [open, setOpen] = useState(null), [expanded, setExpanded] = useState(false);
|
|
49
|
+
const [busy, setBusy] = useState(false), [failed, setFailed] = useState(false), [gone, setGone] = useState({});
|
|
50
|
+
useEffect(() => { setPresence({}); setGone({}); }, [detail]);
|
|
51
|
+
useEffect(() => client.subscribeRooms?.({
|
|
52
|
+
// The whole state each time: presence, its reason code and note. One the event omits is cleared (undefined), so a
|
|
53
|
+
// stale reason or note never outlives the presence it came with.
|
|
54
|
+
"presence.changed": (e) => { if (e?.roomId === roomId && typeof e.memberId === "string") setPresence(old => ({ ...old, [e.memberId]: { presence: e.presence, presenceReason: e.presenceReason, presenceNote: e.presenceNote } })); },
|
|
55
|
+
}) ?? (() => {}), [client, roomId]);
|
|
56
|
+
if (!detail || !Array.isArray(detail.members)) return html`<aside class="hub-room-members" aria-busy="true"></aside>`;
|
|
57
|
+
const data = { role: detail.me?.role === "manager" ? "manager" : "member",
|
|
58
|
+
members: detail.members.filter(m => m && !gone[m.id]).map(m => presence[m.id] ? { ...m, ...presence[m.id] } : m) };
|
|
59
|
+
const meId = detail.me?.id;
|
|
60
|
+
const manager = data.role === "manager";
|
|
61
|
+
// Me first, then who is online, then the offline and those who have never signed in (spec 8224c4675).
|
|
62
|
+
const personRank = (m) => m.id === meId ? 0 : m.presence === "online" ? 1 : 2;
|
|
63
|
+
const people = data.members.filter(m => m.kind === "person").sort((a, b) => personRank(a) - personRank(b));
|
|
64
|
+
const agents = sortAgents(data.members), heads = headerCounts(data.members);
|
|
65
|
+
const assistant = data.members.find(m => m.kind === "assistant");
|
|
66
|
+
const fold = collapse(agents, AGENTS_SHOWN), shown = expanded ? agents : fold.shown;
|
|
67
|
+
const remove = async (m) => {
|
|
68
|
+
setBusy(true); setFailed(false);
|
|
69
|
+
const r = await client.removeRoomMember(roomId, m.id);
|
|
70
|
+
setBusy(false);
|
|
71
|
+
if (r?.ok) { setOpen(null); setGone(old => ({ ...old, [m.id]: true })); } // the shell reads the room again on member.changed
|
|
72
|
+
else setFailed(true);
|
|
73
|
+
};
|
|
74
|
+
// An agent's second line names whose it is beside its state (「處理中 · 林小華的 Agent」), always shown, not only on hover.
|
|
75
|
+
const row = (m, extra = null) => {
|
|
76
|
+
const v = memberStatus(m), owner = (m.kind === "agent" || m.kind === "later") && m.owner?.name ? ownerAgent(m.owner.name) : "";
|
|
77
|
+
return html`<span class="hub-member-name">${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>`;
|
|
78
|
+
};
|
|
79
|
+
return html`<aside class="hub-room-members">
|
|
80
|
+
<section><h4>${heads.member}</h4>
|
|
81
|
+
<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>
|
|
82
|
+
</section>
|
|
83
|
+
${agents.length ? null : html`<section class="hub-room-no-agents"><h4>${hm("agents")}</h4><p class="note">${hm("noAgents")}</p></section>`}
|
|
84
|
+
${agents.length ? html`<section><h4>${heads.agent}</h4>
|
|
85
|
+
<ul>${shown.map(m => html`<li class="hub-member hub-member-agent" key=${m.id}>
|
|
86
|
+
<button type="button" class="hub-member-open" title=${m.owner?.name ? hm("ownerOf", m.owner.name) : ""} aria-expanded=${open === m.id} onClick=${() => { setFailed(false); setOpen(open === m.id ? null : m.id); }}>${row(m)}</button>
|
|
87
|
+
${open === m.id ? html`<div class="hub-member-card" role="group" aria-label=${m.name}>
|
|
88
|
+
<strong>${m.name}</strong>${m.owner?.name ? html`<small class="note">${hm("ownerOf", m.owner.name)}</small>` : null}
|
|
89
|
+
<small class="note">${memberStatus(m).text}</small>
|
|
90
|
+
<div class="field-row">
|
|
91
|
+
<button type="button" class="btn" onClick=${() => { setOpen(null); onMention?.(m); }}>${hroom("mentionHere")}</button>
|
|
92
|
+
${m.canAsk === true ? html`<button type="button" class="btn" onClick=${() => { setOpen(null); onOpenChat?.(m); }}>${hroom("chatOneToOne")}</button>` : null}
|
|
93
|
+
${manager ? html`<button type="button" class="btn btn-danger" disabled=${busy} onClick=${() => remove(m)}>${hroom("removeFromRoom")}</button>` : null}
|
|
94
|
+
</div>
|
|
95
|
+
${failed ? html`<p class="note" role="alert">${hm("removeFailed")}</p>` : null}
|
|
96
|
+
</div>` : null}
|
|
97
|
+
</li>`)}</ul>
|
|
98
|
+
${fold.rest ? html`<button type="button" class="btn btn-link hub-members-more" onClick=${() => setExpanded(!expanded)}>${expanded ? hm("fewer") : hroom("moreN", fold.rest)}</button>` : null}
|
|
99
|
+
</section>` : null}
|
|
100
|
+
${assistant ? html`<section><ul><li class="hub-member hub-member-assistant">${row({ ...assistant, name: hroom("roomAssistant") })}</li></ul></section>` : null}
|
|
101
|
+
<section class="hub-room-who"><h4>${hroom("whoSees")}</h4><p class="note">${hroom("whoSeesRoom")}</p></section>
|
|
102
|
+
${manager ? html`<button type="button" class="btn btn-link hub-room-settings-link" onClick=${() => onSettings?.()}>${hroom("roomSettings")}</button>` : null}
|
|
103
|
+
</aside>`;
|
|
104
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
// Hub rooms, the New room dialog and its pickers (docs/design/hub-rooms-ux.md section 6; the pickers are reused by Room
|
|
2
|
+
// settings, section 7): only the words the shared room vocabulary (hub-room-strings.js, namespace hubRoom) does not have.
|
|
3
|
+
// A module of its own, so a tab holding an older dictionary still has every word (upgrade skew).
|
|
4
|
+
import { register, t } from "/assets/app-i18n.js";
|
|
5
|
+
|
|
6
|
+
register("hubRoomNew", {
|
|
7
|
+
en: {
|
|
8
|
+
agents: "Agents",
|
|
9
|
+
withCount: "{0} · {1} people",
|
|
10
|
+
withCountOne: "{0} · 1 person",
|
|
11
|
+
peopleLimit: "This room would have {0} people, over the limit of {1}. Choose a smaller AD group or team instead.",
|
|
12
|
+
groupUnavailable: "Can't read the members of “{0}” right now. Try again later.",
|
|
13
|
+
neverSignedIn: "Hasn't signed in to the Hub yet",
|
|
14
|
+
teamAgents: "Every member's agents in “{0}”",
|
|
15
|
+
remove: "Remove {0}",
|
|
16
|
+
noMatch: "Nothing matches.",
|
|
17
|
+
searchFailed: "Search did not work. Try again.",
|
|
18
|
+
createFailed: "The room was not created. Try again.",
|
|
19
|
+
nameTooLong: "A room name is at most 60 characters.",
|
|
20
|
+
},
|
|
21
|
+
"zh-TW": {
|
|
22
|
+
agents: "Agent",
|
|
23
|
+
withCount: "{0} · {1} 人",
|
|
24
|
+
withCountOne: "{0} · 1 人",
|
|
25
|
+
peopleLimit: "這個房間會有 {0} 人,超過上限 {1} 人。請改選較小的 AD 群組或團隊。",
|
|
26
|
+
groupUnavailable: "目前無法讀取「{0}」的成員,請稍後再試。",
|
|
27
|
+
neverSignedIn: "還沒登入過 Hub",
|
|
28
|
+
teamAgents: "「{0}」所有人的 Agent",
|
|
29
|
+
remove: "移除 {0}",
|
|
30
|
+
noMatch: "找不到符合的結果。",
|
|
31
|
+
searchFailed: "搜尋沒有成功,請再試一次。",
|
|
32
|
+
createFailed: "房間沒有建立,請再試一次。",
|
|
33
|
+
nameTooLong: "房間名稱最多 60 個字。",
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
export const hn = (key, ...args) => t(`hubRoomNew.${key}`, ...args);
|
|
37
|
+
|
|
38
|
+
/** The U2 screens' stylesheet, linked once (an older hub-chat.css or hub-owner.css lacks these rules). */
|
|
39
|
+
export function linkRoomsU2Css(doc = typeof document !== "undefined" ? document : null) {
|
|
40
|
+
try {
|
|
41
|
+
if (!doc || !doc.head || doc.querySelector('link[data-hub-rooms-u2-css="1"]')) return;
|
|
42
|
+
const link = doc.createElement("link");
|
|
43
|
+
link.setAttribute("rel", "stylesheet"); link.setAttribute("href", "/assets/hub-rooms-u2.css"); link.setAttribute("data-hub-rooms-u2-css", "1");
|
|
44
|
+
doc.head.appendChild(link);
|
|
45
|
+
} catch { /* the screens still work without it */ }
|
|
46
|
+
}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
// Hub rooms, the New room dialog (docs/design/hub-rooms-ux.md section 6), opened from the list's 「+ 新房間」 row (shown
|
|
2
|
+
// only to people who may start rooms). Name (required, at most 60 characters), members (people, teams, AD groups; I am
|
|
3
|
+
// always in, as the manager), agents (mine join at once; someone else's are invited and join when their owner agrees;
|
|
4
|
+
// a team's every member's agents can be invited), and the room assistant when the Hub offers one. 建立 creates the
|
|
5
|
+
// room, sends the invitations, and opens the room; the room's first lines (created, invited) are the server's.
|
|
6
|
+
// RoomPicker is the search-and-tags field, reused by Room settings (section 7).
|
|
7
|
+
import { html, useEffect, useRef, useState } from "/assets/app-html.js";
|
|
8
|
+
import { Dialog } from "/assets/ui-dialog.js";
|
|
9
|
+
import { hubClient } from "./hub-client.js";
|
|
10
|
+
import { hroom } from "./hub-room-strings.js";
|
|
11
|
+
import { hn, linkRoomsU2Css } from "./hub-room-new-strings.js";
|
|
12
|
+
|
|
13
|
+
linkRoomsU2Css();
|
|
14
|
+
|
|
15
|
+
const NAME_MAX = 60;
|
|
16
|
+
const SEARCH_DELAY_MS = 200;
|
|
17
|
+
|
|
18
|
+
/** One picked item's words: a person or agent by name, a team or AD group with its people, a team's agents. */
|
|
19
|
+
export function pickLabel(item) {
|
|
20
|
+
if (item.kind === "team-agents") return hn("teamAgents", item.name);
|
|
21
|
+
if ((item.kind === "team" || item.kind === "group") && Number.isFinite(item.people)) return item.people === 1 ? hn("withCountOne", item.name) : hn("withCount", item.name, item.people);
|
|
22
|
+
return item.name;
|
|
23
|
+
}
|
|
24
|
+
const keyOf = (item) => `${item.kind}:${item.id}`;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* A search box over GET /hub/v1/rooms/candidates and the picked items as tags.
|
|
28
|
+
* - kinds: the candidate kinds searched, e.g. ["person", "team", "group"] or ["agent", "team"]. In an agent picker, a team
|
|
29
|
+
* result stands for "invite every member's agents" (kind "team-agents").
|
|
30
|
+
* - picked, onChange(next), exclude: keys ("kind:id") never offered, e.g. members already in the room.
|
|
31
|
+
* - note: a refusal the owner shows under the field (the 100-person limit, a group the directory could not read).
|
|
32
|
+
* A picked AD group is read first (client.roomGroup): its tag shows its head count, and a group the directory cannot
|
|
33
|
+
* read whole is not added — the other picks stay.
|
|
34
|
+
*/
|
|
35
|
+
export function RoomPicker({ client, kinds, picked, onChange, placeholder, label, id, exclude = [], fixed = null, note = "" } = {}) {
|
|
36
|
+
const [q, setQ] = useState(""), [results, setResults] = useState(null), [failed, setFailed] = useState(false), [groupNote, setGroupNote] = useState("");
|
|
37
|
+
const asked = useRef(0), timer = useRef(null), latest = useRef(picked), live = useRef(true);
|
|
38
|
+
latest.current = picked;
|
|
39
|
+
const agents = kinds.includes("agent");
|
|
40
|
+
useEffect(() => { live.current = true; return () => { live.current = false; clearTimeout(timer.current); }; }, []);
|
|
41
|
+
const search = (text) => {
|
|
42
|
+
setQ(text); clearTimeout(timer.current);
|
|
43
|
+
const mine = ++asked.current;
|
|
44
|
+
if (!text.trim()) { setResults(null); setFailed(false); return; }
|
|
45
|
+
timer.current = setTimeout(async () => {
|
|
46
|
+
const answers = await Promise.all(kinds.map(kind => client.roomCandidates(text.trim(), kind)));
|
|
47
|
+
if (mine !== asked.current) return;
|
|
48
|
+
if (answers.some(r => !r?.ok)) { setFailed(true); setResults(null); return; }
|
|
49
|
+
setFailed(false);
|
|
50
|
+
setResults(answers.flatMap(r => Array.isArray(r.candidates) ? r.candidates : [])
|
|
51
|
+
.map(c => agents && c.kind === "team" ? { ...c, kind: "team-agents" } : c)
|
|
52
|
+
.filter(c => c && typeof c.id === "string" && typeof c.name === "string"));
|
|
53
|
+
}, SEARCH_DELAY_MS);
|
|
54
|
+
};
|
|
55
|
+
const taken = new Set([...exclude, ...picked.map(keyOf)]);
|
|
56
|
+
const offer = (results ?? []).filter(c => !taken.has(keyOf(c)));
|
|
57
|
+
const pick = async (item) => {
|
|
58
|
+
setQ(""); setResults(null); setGroupNote("");
|
|
59
|
+
if (item.kind !== "group" || typeof client.roomGroup !== "function") { onChange([...latest.current, item]); return; }
|
|
60
|
+
const r = await client.roomGroup(item.id);
|
|
61
|
+
if (!live.current || latest.current.some(x => keyOf(x) === keyOf(item))) return;
|
|
62
|
+
if (!r?.ok) { setGroupNote(hn("groupUnavailable", item.name)); return; }
|
|
63
|
+
onChange([...latest.current, { ...item, ...(typeof r.name === "string" && r.name ? { name: r.name } : {}), ...(Number.isSafeInteger(r.people) ? { people: r.people } : {}) }]);
|
|
64
|
+
};
|
|
65
|
+
return html`<div class="field hub-room-picker">
|
|
66
|
+
<label for=${id}><span>${label}</span></label>
|
|
67
|
+
<ul class="hub-room-tags">
|
|
68
|
+
${fixed}
|
|
69
|
+
${picked.map(item => html`<li class="tag" key=${keyOf(item)}>${pickLabel(item)}${agents && item.kind === "agent" && !item.mine || item.kind === "team-agents" ? html` · ${hroom("invitePending")}` : null}
|
|
70
|
+
<button type="button" class="chip-btn" aria-label=${hn("remove", pickLabel(item))} onClick=${() => onChange(picked.filter(x => keyOf(x) !== keyOf(item)))}>×</button></li>`)}
|
|
71
|
+
</ul>
|
|
72
|
+
<input id=${id} type="search" autocomplete="off" placeholder=${placeholder} value=${q} onInput=${(e) => search(e.target.value)} />
|
|
73
|
+
${failed ? html`<p class="note" role="alert">${hn("searchFailed")}</p>` : null}
|
|
74
|
+
${groupNote || note ? html`<p class="note hub-room-picker-note" role="alert">${groupNote || note}</p>` : null}
|
|
75
|
+
${results && !failed ? offer.length ? html`<ul class="hub-room-results" role="listbox" aria-label=${label}>${offer.map(c => html`<li key=${keyOf(c)}>
|
|
76
|
+
<button type="button" role="option" class="hub-room-result" onClick=${() => { void pick(c); }}>${pickLabel(c)}${c.owner?.name && c.kind === "agent" ? html` <small class="note">${c.owner.name}</small>` : null}${c.kind === "agent" && !c.mine ? html` <small class="note">${hroom("invitePending")}</small>` : null}</button></li>`)}</ul>`
|
|
77
|
+
: html`<p class="note">${hn("noMatch")}</p>` : null}
|
|
78
|
+
</div>`;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/** 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
|
+
const [name, setName] = useState(""), [people, setPeople] = useState([]), [agents, setAgents] = useState([]), [withAssistant, setWithAssistant] = useState(false);
|
|
84
|
+
const [offered, setOffered] = useState(assistant === true), [busy, setBusy] = useState(false), [error, setError] = useState(""), [peopleNote, setPeopleNote] = useState("");
|
|
85
|
+
const nameRef = useRef(null), sent = useRef(false);
|
|
86
|
+
useEffect(() => {
|
|
87
|
+
if (typeof assistant === "boolean") { setOffered(assistant); return; }
|
|
88
|
+
let live = true;
|
|
89
|
+
void client.roomList().then(r => { if (live) setOffered(r?.ok === true && r.me?.assistant === true); });
|
|
90
|
+
return () => { live = false; };
|
|
91
|
+
}, [client, assistant]);
|
|
92
|
+
const create = async () => {
|
|
93
|
+
if (sent.current) return;
|
|
94
|
+
const title = name.trim();
|
|
95
|
+
if (!title) { setError(hroom("nameRequired")); nameRef.current?.focus(); return; }
|
|
96
|
+
if ([...title].length > NAME_MAX) { setError(hn("nameTooLong")); nameRef.current?.focus(); return; }
|
|
97
|
+
sent.current = true; setBusy(true); setError(""); setPeopleNote("");
|
|
98
|
+
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"),
|
|
100
|
+
agents: agents.filter(x => x.kind === "agent" && x.mine).map(x => x.id), assistant: offered && withAssistant });
|
|
101
|
+
const roomId = r?.ok ? r.room?.id : null;
|
|
102
|
+
if (!roomId) {
|
|
103
|
+
sent.current = false; setBusy(false);
|
|
104
|
+
// Nothing was created. Too many people: say how many, keep every pick. A group the directory could not read:
|
|
105
|
+
// drop that group only.
|
|
106
|
+
const group = r?.status === 503 && r.code === "group-unavailable" ? people.find(x => x.kind === "group" && x.id === r.group) : null;
|
|
107
|
+
if (r?.status === 409 && r.code === "people-limit" && Number.isSafeInteger(r.people)) setPeopleNote(hn("peopleLimit", r.people, r.limit ?? 100));
|
|
108
|
+
else if (group) { setPeople(people.filter(x => x !== group)); setPeopleNote(hn("groupUnavailable", group.name)); }
|
|
109
|
+
else setError(hn("createFailed"));
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
const others = agents.filter(x => x.kind === "agent" && !x.mine).map(x => x.id), teams = agents.filter(x => x.kind === "team-agents").map(x => x.id);
|
|
113
|
+
// The room exists now: invitations are best effort, and the room's own list shows what was sent.
|
|
114
|
+
if (others.length) await client.inviteToRoom(roomId, { agents: others });
|
|
115
|
+
for (const team of teams) await client.inviteToRoom(roomId, { team });
|
|
116
|
+
onOpenRoom?.(roomId); onClose?.();
|
|
117
|
+
};
|
|
118
|
+
const me = html`<li class="tag hub-room-me">${hroom("roleYou")} · ${hroom("roleManager")}</li>`;
|
|
119
|
+
return html`<${Dialog} title=${hroom("newRoomTitle")} onClose=${() => onClose?.()} busy=${busy} cls="hub-room-new"
|
|
120
|
+
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>`}>
|
|
122
|
+
<form class="form" onSubmit=${(e) => { e.preventDefault(); void create(); }}>
|
|
123
|
+
<label class="field"><span>${hroom("name")}</span>
|
|
124
|
+
<input id="hubRoomName" ref=${nameRef} maxlength=${NAME_MAX} autocomplete="off" placeholder=${hroom("namePlaceholder")} value=${name}
|
|
125
|
+
aria-invalid=${error === hroom("nameRequired") || error === hn("nameTooLong") ? "true" : "false"} onInput=${(e) => { setName(e.target.value); if (error) setError(""); }} /></label>
|
|
126
|
+
${error ? html`<p class="note hub-room-new-error" role="alert">${error}</p>` : null}
|
|
127
|
+
<${RoomPicker} client=${client} id="hubRoomPeople" kinds=${["person", "team", "group"]} label=${hroom("members")} placeholder=${hroom("addPeople")}
|
|
128
|
+
picked=${people} onChange=${(next) => { setPeople(next); setPeopleNote(""); }} fixed=${me} note=${peopleNote} />
|
|
129
|
+
<${RoomPicker} client=${client} id="hubRoomAgents" kinds=${["agent", "team"]} label=${hn("agents")} placeholder=${hroom("addAgents")}
|
|
130
|
+
picked=${agents} onChange=${setAgents} />
|
|
131
|
+
${offered ? html`<label class="check"><input id="hubRoomAssistant" class="s-ui-toggle" type="checkbox" role="switch" checked=${withAssistant}
|
|
132
|
+
onChange=${(e) => setWithAssistant(e.target.checked)} /><span>${hroom("addAssistant")}</span></label>` : null}
|
|
133
|
+
</form>
|
|
134
|
+
</${Dialog}>`;
|
|
135
|
+
}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hub rooms presence (docs/design/hub-rooms-ux.md §5): the status dot and word for a
|
|
3
|
+
* member, the agents sort order, the Members/Agents header counts, and the
|
|
4
|
+
* overflow split behind "… 其餘 N 個". Pure helpers, no DOM: words come from
|
|
5
|
+
* hub-room-strings.js (namespace hubRoom) in the viewer's language, so this
|
|
6
|
+
* module imports it for its registration side effect and reads through hroom.
|
|
7
|
+
*/
|
|
8
|
+
import { hroom } from "./hub-room-strings.js";
|
|
9
|
+
|
|
10
|
+
/** Spec §5 rows, in list order: 處理中, 待命, 暫停, 離線, 上線時回答. */
|
|
11
|
+
const GROUP_ORDER = ["working", "idle", "paused", "offline", "later"];
|
|
12
|
+
|
|
13
|
+
/** Presence value → status dot (spec §5 colours: green idle counts as online). */
|
|
14
|
+
const DOT = { online: "online", idle: "online", working: "working", paused: "paused", offline: "offline", later: "offline" };
|
|
15
|
+
|
|
16
|
+
/** Presence value → hubRoom word key. */
|
|
17
|
+
const WORD = { online: "stOnline", idle: "stIdle", working: "stWorking", paused: "stPaused", offline: "stOffline", later: "stLater" };
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Fixture/server presence-note display text → hubRoom reason key. The note arrives
|
|
21
|
+
* as display text (the fixture's contract), so the known ones map back to their
|
|
22
|
+
* keys here; anything else passes through unchanged (it is text, never a key).
|
|
23
|
+
* Once R2 serves presenceReason codes, those win over this legacy text path.
|
|
24
|
+
*/
|
|
25
|
+
const NOTE_KEY = { "額度用完": "pauseQuota", "等待登入": "pauseSignIn", "等待核准": "pauseApproval", "需要更新 AgEnD": "needsUpdate" };
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* R2 presenceReason codes → display overrides (hub-rooms track R/C contract).
|
|
29
|
+
* A mapped reason wins over any legacy presenceNote text, but only when the
|
|
30
|
+
* member's presence matches: patches can merge a stale reason onto a newer
|
|
31
|
+
* presence that omits it, so a lingering reason must never override a fresh
|
|
32
|
+
* presence. An unmapped code is ignored so the presence mapping stands and
|
|
33
|
+
* no raw code ever reaches the UI.
|
|
34
|
+
* - quota/auth/approval/operator/capacity apply to paused only (yellow; only
|
|
35
|
+
* the first three have a reason word, there is no operator/capacity word
|
|
36
|
+
* in hubRoom yet).
|
|
37
|
+
* - update applies to offline only (grey with its own word).
|
|
38
|
+
* - idle: no-op, the presence already says idle (autowake sleep).
|
|
39
|
+
* - error/stuck/unknown: no mapping defined — the presence mapping stands.
|
|
40
|
+
* - stopped/crashed: grey dot (offline) + the "stopped" word, gated on
|
|
41
|
+
* presence "paused" as C only sends these paused (crashed is normalised
|
|
42
|
+
* to stopped server-side, so both map to stStopped here).
|
|
43
|
+
*/
|
|
44
|
+
const REASON = {
|
|
45
|
+
quota: { when: ["paused"], dot: "paused", word: "stPaused", noteKey: "pauseQuota" },
|
|
46
|
+
auth: { when: ["paused"], dot: "paused", word: "stPaused", noteKey: "pauseSignIn" },
|
|
47
|
+
approval: { when: ["paused"], dot: "paused", word: "stPaused", noteKey: "pauseApproval" },
|
|
48
|
+
update: { when: ["offline"], dot: "offline", word: "needsUpdate" },
|
|
49
|
+
operator: { when: ["paused"], dot: "paused", word: "stPaused" },
|
|
50
|
+
capacity: { when: ["paused"], dot: "paused", word: "stPaused" },
|
|
51
|
+
stopped: { when: ["paused"], dot: "offline", word: "stStopped" },
|
|
52
|
+
crashed: { when: ["paused"], dot: "offline", word: "stStopped" },
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
const groupIndex = (presence) => { const i = GROUP_ORDER.indexOf(presence); return i < 0 ? GROUP_ORDER.length : i; };
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* One member's status: { dot, word, noteKey?, noteText? }. dot is the status
|
|
59
|
+
* colour; word is always a hubRoom key; noteKey is too when the member's
|
|
60
|
+
* presenceNote matches a known reason, while an unrecognised note goes to
|
|
61
|
+
* noteText and is shown verbatim — never passed through hroom, so an unknown
|
|
62
|
+
* reason can never render as a raw hubRoom.* key. An offline member whose note
|
|
63
|
+
* is 需要更新 AgEnD shows as offline with its own word; a paused room assistant
|
|
64
|
+
* shows 暫時無法回答.
|
|
65
|
+
*/
|
|
66
|
+
export function presenceView(member) {
|
|
67
|
+
const presence = member?.presence;
|
|
68
|
+
if (member?.kind === "assistant") {
|
|
69
|
+
return presence === "paused"
|
|
70
|
+
? { dot: "paused", word: "stAssistantDown" }
|
|
71
|
+
: { dot: DOT[presence] ?? "offline", word: WORD[presence] ?? "stOffline" };
|
|
72
|
+
}
|
|
73
|
+
const reason = REASON[member?.presenceReason];
|
|
74
|
+
if (reason && reason.when.includes(presence)) return { dot: reason.dot, word: reason.word, ...(reason.noteKey ? { noteKey: reason.noteKey } : {}) };
|
|
75
|
+
const noteKey = NOTE_KEY[member?.presenceNote];
|
|
76
|
+
if (presence === "offline" && noteKey === "needsUpdate") return { dot: "offline", word: "needsUpdate" };
|
|
77
|
+
const view = { dot: DOT[presence] ?? "offline", word: WORD[presence] ?? "stOffline" };
|
|
78
|
+
if (noteKey) view.noteKey = noteKey;
|
|
79
|
+
else if (member?.presenceNote) view.noteText = member.presenceNote;
|
|
80
|
+
return view;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* The Fleet sidebar dot class for a presence value, or for a presence + reason
|
|
85
|
+
* pair (shared with the list rows). A reason the table knows wins when its
|
|
86
|
+
* `when` gate matches the presence — so a stopped agent reads grey, not yellow.
|
|
87
|
+
* Unknown or gated-out reasons fall back to the plain presence dot.
|
|
88
|
+
*/
|
|
89
|
+
const DOT_CLASS = { online: "ok", idle: "ok", working: "busy", paused: "warn", offline: "off", later: "off" };
|
|
90
|
+
export function presenceDot(presence, reason) {
|
|
91
|
+
const r = typeof reason === "string" ? REASON[reason] : undefined;
|
|
92
|
+
const dot = (r && r.when.includes(presence) ? r.dot : undefined) ?? DOT[presence] ?? "offline";
|
|
93
|
+
return DOT_CLASS[dot] ?? "off";
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* The Agents list order (spec §5): working, then idle (待命), paused, offline,
|
|
98
|
+
* reply-later; stable by name within each group. Only kind "agent"/"later"
|
|
99
|
+
* members sort here — people have their own row and the room assistant has its.
|
|
100
|
+
*/
|
|
101
|
+
export function sortAgents(members) {
|
|
102
|
+
return members
|
|
103
|
+
.filter((m) => m.kind === "agent" || m.kind === "later")
|
|
104
|
+
.map((m, i) => [m, i])
|
|
105
|
+
.sort(([a, ai], [b, bi]) => groupIndex(a.presence) - groupIndex(b.presence) || (a.name < b.name ? -1 : a.name > b.name ? 1 : ai - bi))
|
|
106
|
+
.map(([m]) => m);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/** "Agent · 12(線上 9)" and "成員 · 3(線上 2)" in the viewer's language. */
|
|
110
|
+
export function headerCounts(members) {
|
|
111
|
+
const agents = members.filter((m) => m.kind === "agent" || m.kind === "later");
|
|
112
|
+
const people = members.filter((m) => m.kind === "person");
|
|
113
|
+
const online = (list) => list.filter((m) => m.presence === "online" || m.presence === "idle" || m.presence === "working").length;
|
|
114
|
+
return {
|
|
115
|
+
agent: hroom("agentsHead", agents.length, online(agents)),
|
|
116
|
+
member: hroom("membersHead", people.length, online(people)),
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/** The first `limit` rows shown, the rest folded behind "… 其餘 N 個". */
|
|
121
|
+
export function collapse(list, limit = 8) {
|
|
122
|
+
return { shown: list.slice(0, limit), rest: Math.max(0, list.length - limit) };
|
|
123
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// Hub rooms, Room settings (docs/design/hub-rooms-ux.md section 7): only the words the shared room vocabulary
|
|
2
|
+
// (hub-room-strings.js, namespace hubRoom) does not have. A module of its own, so a tab holding an older dictionary
|
|
3
|
+
// still has every word (upgrade skew).
|
|
4
|
+
import { register, t } from "/assets/app-i18n.js";
|
|
5
|
+
|
|
6
|
+
register("hubRoomSettings", {
|
|
7
|
+
en: {
|
|
8
|
+
expiredRow: "{0} ({1}) · invitation expired", expiredRowNoOwner: "{0} · invitation expired",
|
|
9
|
+
pendingRowNoOwner: "{0} · invited, waiting for the owner",
|
|
10
|
+
inviteAgain: "Invite again",
|
|
11
|
+
rowMenu: "More for {0}",
|
|
12
|
+
save: "Save",
|
|
13
|
+
saveFailed: "That was not saved. Try again.",
|
|
14
|
+
assistantSwitch: "Room assistant",
|
|
15
|
+
},
|
|
16
|
+
"zh-TW": {
|
|
17
|
+
expiredRow: "{0}({1})· 邀請已過期", expiredRowNoOwner: "{0} · 邀請已過期",
|
|
18
|
+
pendingRowNoOwner: "{0} · 已邀請,等擁有者同意",
|
|
19
|
+
inviteAgain: "重新邀請",
|
|
20
|
+
rowMenu: "{0} 的更多動作",
|
|
21
|
+
save: "儲存",
|
|
22
|
+
saveFailed: "沒有儲存,請再試一次。",
|
|
23
|
+
assistantSwitch: "房間助理",
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
export const hs = (key, ...args) => t(`hubRoomSettings.${key}`, ...args);
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
// Hub rooms, Room settings (docs/design/hub-rooms-ux.md section 7), opened from the room's header menu or the members
|
|
2
|
+
// panel's 「房間設定」, for a room manager. Three parts:
|
|
3
|
+
// - 基本: the name, 「成員可以 @所有 Agent」, 「新成員看得到」.
|
|
4
|
+
// - 成員與 Agent: people and agents, each with a menu (設為房間管理 / 改為成員, 從房間移除); adding people, and adding or
|
|
5
|
+
// inviting agents, with New room's pickers; the room's invitations (pending: 取消邀請; expired after 7 days:
|
|
6
|
+
// 重新邀請); the room assistant's switch when the Hub offers one.
|
|
7
|
+
// - 其他: 封存房間, after a confirmation.
|
|
8
|
+
// Each change is sent at once. The shell holds the room's detail; onChanged() asks it to read the room again
|
|
9
|
+
// (member.changed / room.changed do the same for other tabs). leaveRoom() is the header menu's 「離開房間」.
|
|
10
|
+
import { html, useEffect, useRef, useState } from "/assets/app-html.js";
|
|
11
|
+
import { Dialog } from "/assets/ui-dialog.js";
|
|
12
|
+
import { Menu } from "/assets/ui-menu.js";
|
|
13
|
+
import { confirmDialog } from "/assets/ui-confirm.js";
|
|
14
|
+
import { hubClient } from "./hub-client.js";
|
|
15
|
+
import { hroom } from "./hub-room-strings.js";
|
|
16
|
+
import { hs } from "./hub-room-settings-strings.js";
|
|
17
|
+
import { RoomPicker } from "./hub-room-new.js";
|
|
18
|
+
import { hn, linkRoomsU2Css } from "./hub-room-new-strings.js";
|
|
19
|
+
|
|
20
|
+
linkRoomsU2Css();
|
|
21
|
+
|
|
22
|
+
const NAME_MAX = 60;
|
|
23
|
+
const isAgent = (m) => m.kind === "agent" || m.kind === "later";
|
|
24
|
+
|
|
25
|
+
/** 離開房間 for anyone: → { ok } or { ok: false, text } (the last manager is told to hand the role on first). */
|
|
26
|
+
export async function leaveRoom(client, roomId, meId) {
|
|
27
|
+
const r = await client.removeRoomMember(roomId, meId);
|
|
28
|
+
if (r?.ok) return { ok: true };
|
|
29
|
+
return { ok: false, text: r?.status === 409 && r.code === "last-manager" ? hroom("lastManager") : hs("saveFailed") };
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/** One invitation row's words: the agent, its owner when known, pending or expired. */
|
|
33
|
+
export function invitedLabel(row) {
|
|
34
|
+
const owner = typeof row.owner === "string" ? row.owner : row.owner?.name || "";
|
|
35
|
+
if (row.state === "expired") return owner ? hs("expiredRow", row.name, owner) : hs("expiredRowNoOwner", row.name);
|
|
36
|
+
return owner ? hroom("inviteRow", row.name, owner) : hs("pendingRowNoOwner", row.name);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/** Props: client, roomId, detail (the shell's GET /hub/v1/rooms/:id answer), onClose(), onChanged(), assistant (the Hub offers the room assistant; read from the list when not given). */
|
|
40
|
+
export function RoomSettings({ client = hubClient(), roomId, detail, onClose, onChanged, assistant } = {}) {
|
|
41
|
+
const room = detail?.room ?? {}, settings = detail?.settings ?? {}, members = Array.isArray(detail?.members) ? detail.members : [];
|
|
42
|
+
const invited = Array.isArray(detail?.invited) ? detail.invited : [];
|
|
43
|
+
const [name, setName] = useState(room.name ?? ""), [busy, setBusy] = useState(false), [error, setError] = useState("");
|
|
44
|
+
const [allMention, setAllMention] = useState(settings.allMention !== false), [history, setHistory] = useState(settings.historyForNew === "all" ? "all" : "since-join");
|
|
45
|
+
const [offered, setOffered] = useState(assistant === true), [addPeople, setAddPeople] = useState([]), [addAgents, setAddAgents] = useState([]), [peopleNote, setPeopleNote] = useState("");
|
|
46
|
+
const live = useRef(true);
|
|
47
|
+
useEffect(() => () => { live.current = false; }, []);
|
|
48
|
+
useEffect(() => { setName(room.name ?? ""); setAllMention(settings.allMention !== false); setHistory(settings.historyForNew === "all" ? "all" : "since-join"); }, [detail]);
|
|
49
|
+
useEffect(() => {
|
|
50
|
+
if (typeof assistant === "boolean") { setOffered(assistant); return; }
|
|
51
|
+
void client.roomList().then(r => { if (live.current) setOffered(r?.ok === true && r.me?.assistant === true); });
|
|
52
|
+
}, [client, assistant]);
|
|
53
|
+
const hasAssistant = members.some(m => m.kind === "assistant");
|
|
54
|
+
/** One change: send it, then let the shell read the room again; a refusal names what to do. */
|
|
55
|
+
/** refused(r): a refusal the caller shows itself (true = handled), e.g. under the add-people field. */
|
|
56
|
+
const act = async (send, undo, refused) => {
|
|
57
|
+
setBusy(true); setError(""); setPeopleNote("");
|
|
58
|
+
const r = await send();
|
|
59
|
+
if (!live.current) return r;
|
|
60
|
+
setBusy(false);
|
|
61
|
+
if (r?.ok) onChanged?.();
|
|
62
|
+
else { undo?.(); if (!refused?.(r)) setError(r?.status === 409 && r.code === "last-manager" ? hroom("lastManager") : hs("saveFailed")); }
|
|
63
|
+
return r;
|
|
64
|
+
};
|
|
65
|
+
const saveName = () => {
|
|
66
|
+
const title = name.trim();
|
|
67
|
+
if (!title) { setError(hroom("nameRequired")); return; }
|
|
68
|
+
if (title === room.name || [...title].length > NAME_MAX) return;
|
|
69
|
+
void act(() => client.updateRoom(roomId, { name: title }), () => setName(room.name ?? ""));
|
|
70
|
+
};
|
|
71
|
+
/** A picked item is sent at once (the picker then starts empty again): a person, team or group joins; my agent joins; someone else's agent, or a team's agents, are invited. */
|
|
72
|
+
const add = async (next, setter) => {
|
|
73
|
+
setter([]);
|
|
74
|
+
for (const item of next) {
|
|
75
|
+
const send = item.kind === "agent" && item.mine ? () => client.addRoomMember(roomId, { kind: "agent", id: item.id })
|
|
76
|
+
: item.kind === "agent" ? () => client.inviteToRoom(roomId, { agents: [item.id] })
|
|
77
|
+
: item.kind === "team-agents" ? () => client.inviteToRoom(roomId, { team: item.id })
|
|
78
|
+
: () => client.addRoomMember(roomId, { kind: item.kind, id: item.id });
|
|
79
|
+
// Too many people, or a group the directory could not read: said under the add field; nothing was added.
|
|
80
|
+
const r = await act(send, undefined, (no) => {
|
|
81
|
+
if (no?.status === 409 && no.code === "people-limit" && Number.isSafeInteger(no.people)) { setPeopleNote(hn("peopleLimit", no.people, no.limit ?? 100)); return true; }
|
|
82
|
+
if (no?.status === 503 && no.code === "group-unavailable" && item.kind === "group") { setPeopleNote(hn("groupUnavailable", item.name)); return true; }
|
|
83
|
+
return false;
|
|
84
|
+
});
|
|
85
|
+
if (!r?.ok) break;
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
const rowMenu = (m) => html`<${Menu} label=${hs("rowMenu", m.name)} items=${[
|
|
89
|
+
m.kind === "person" ? { key: "role", label: m.role === "manager" ? hroom("makeMember") : hroom("makeManager"),
|
|
90
|
+
onSelect: () => { void act(() => client.setRoomMemberRole(roomId, m.id, m.role === "manager" ? "member" : "manager")); } } : null,
|
|
91
|
+
{ key: "remove", label: hroom("removeFromRoom"), danger: true, onSelect: () => { void act(() => client.removeRoomMember(roomId, m.id)); } },
|
|
92
|
+
]} />`;
|
|
93
|
+
const memberRow = (m) => html`<li class="hub-settings-row" key=${m.id} data-member=${m.id}><span>${m.name}${m.id === detail?.me?.id ? html` <span class="tag">${hroom("roleYou")}</span>` : null}${m.role === "manager" ? html` <span class="tag">${hroom("roleManager")}</span>` : null}${isAgent(m) && m.owner?.name ? html` <small class="note">${m.owner.name}</small>` : null}${m.kind === "person" && m.signedIn === false ? html` <small class="note">${hn("neverSignedIn")}</small>` : null}</span>${rowMenu(m)}</li>`;
|
|
94
|
+
const archive = async () => {
|
|
95
|
+
const yes = await confirmDialog({ title: hroom("archiveRoom"), message: hroom("archiveAsk", room.name ?? ""), confirmLabel: hroom("archive"), danger: true });
|
|
96
|
+
if (!yes) return;
|
|
97
|
+
const r = await act(() => client.updateRoom(roomId, { archived: true }));
|
|
98
|
+
if (r?.ok) onClose?.();
|
|
99
|
+
};
|
|
100
|
+
const taken = members.map(m => `${m.kind === "later" ? "agent" : m.kind}:${m.id}`).concat(invited.filter(x => x.state !== "expired").map(x => `agent:${x.exposureId}`));
|
|
101
|
+
return html`<${Dialog} title=${hroom("roomSettings")} onClose=${() => onClose?.()} cls="hub-room-settings" wide=${true}>
|
|
102
|
+
${error ? html`<p class="note hub-room-settings-error" role="alert">${error}</p>` : null}
|
|
103
|
+
<section class="form"><h4>${hroom("basics")}</h4>
|
|
104
|
+
<form class="field hub-room-name-row" onSubmit=${(e) => { e.preventDefault(); saveName(); }}>
|
|
105
|
+
<label for="hubRoomSettingsName">${hroom("name")}</label>
|
|
106
|
+
<div class="field-row"><input id="hubRoomSettingsName" maxlength=${NAME_MAX} autocomplete="off" value=${name} onInput=${(e) => setName(e.target.value)} />
|
|
107
|
+
<button type="button" class="btn" disabled=${busy || name.trim() === (room.name ?? "")} onClick=${saveName}>${hs("save")}</button></div>
|
|
108
|
+
</form>
|
|
109
|
+
<label class="check"><input id="hubRoomAllMention" class="s-ui-toggle" type="checkbox" role="switch" checked=${allMention} disabled=${busy}
|
|
110
|
+
onChange=${(e) => { const v = e.target.checked; setAllMention(v); void act(() => client.updateRoom(roomId, { allMention: v }), () => setAllMention(!v)); }} /><span>${hroom("membersCanAll")}</span></label>
|
|
111
|
+
<fieldset class="field"><legend>${hroom("newMembersSee")}</legend>
|
|
112
|
+
${[["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
|
+
onChange=${() => { const old = history; setHistory(value); void act(() => client.updateRoom(roomId, { historyForNew: value }), () => setHistory(old)); }} /><span>${label}</span></label>`)}
|
|
114
|
+
</fieldset>
|
|
115
|
+
</section>
|
|
116
|
+
<section class="form"><h4>${hroom("membersAndAgents")}</h4>
|
|
117
|
+
<ul class="hub-settings-people">${members.filter(m => m.kind === "person").map(memberRow)}</ul>
|
|
118
|
+
<${RoomPicker} client=${client} id="hubRoomAddPeople" kinds=${["person", "team", "group"]} label=${hroom("addMembers")} placeholder=${hroom("addPeople")}
|
|
119
|
+
picked=${addPeople} exclude=${taken} note=${peopleNote} onChange=${(next) => { void add(next, setAddPeople); }} />
|
|
120
|
+
<ul class="hub-settings-agents">${members.filter(isAgent).map(memberRow)}</ul>
|
|
121
|
+
${invited.length ? html`<ul class="hub-settings-invited">${invited.map(row => html`<li class="hub-settings-row" key=${row.id} data-invitation=${row.id}><span>${invitedLabel(row)}</span>
|
|
122
|
+
${row.state === "expired"
|
|
123
|
+
? html`<button type="button" class="btn btn-link" disabled=${busy} onClick=${() => { void act(async () => { const r = await client.inviteToRoom(roomId, { agents: [row.exposureId] }); if (r?.ok) await client.cancelRoomInvitation(roomId, row.id); return r; }); }}>${hs("inviteAgain")}</button>`
|
|
124
|
+
: html`<button type="button" class="btn btn-link" disabled=${busy} onClick=${() => { void act(() => client.cancelRoomInvitation(roomId, row.id)); }}>${hroom("cancelInvite")}</button>`}</li>`)}</ul>` : null}
|
|
125
|
+
<${RoomPicker} client=${client} id="hubRoomAddAgents" kinds=${["agent", "team"]} label=${hroom("addOrInviteAgents")} placeholder=${hroom("addAgents")}
|
|
126
|
+
picked=${addAgents} exclude=${taken} onChange=${(next) => { void add(next, setAddAgents); }} />
|
|
127
|
+
${offered || hasAssistant ? html`<label class="check"><input id="hubRoomSettingsAssistant" class="s-ui-toggle" type="checkbox" role="switch" checked=${hasAssistant} disabled=${busy}
|
|
128
|
+
onChange=${(e) => { const v = e.target.checked, id = members.find(m => m.kind === "assistant")?.id; void act(() => v ? client.addRoomMember(roomId, { kind: "assistant" }) : client.removeRoomMember(roomId, id)); }} /><span>${hs("assistantSwitch")}</span></label>` : null}
|
|
129
|
+
</section>
|
|
130
|
+
<section class="form"><h4>${hroom("other")}</h4>
|
|
131
|
+
<button type="button" class="btn btn-danger" disabled=${busy || room.archived === true} onClick=${() => { void archive(); }}>${hroom("archiveRoom")}</button>
|
|
132
|
+
</section>
|
|
133
|
+
</${Dialog}>`;
|
|
134
|
+
}
|