@songsid/agend 2.4.0-beta.12 → 2.4.0-beta.14
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/agent-endpoint.js +28 -6
- package/dist/agent-endpoint.js.map +1 -1
- package/dist/auth-api.js +5 -0
- package/dist/auth-api.js.map +1 -1
- package/dist/backend/claude-code.d.ts +9 -0
- package/dist/backend/claude-code.js +60 -4
- package/dist/backend/claude-code.js.map +1 -1
- package/dist/backend/codex.js +11 -0
- package/dist/backend/codex.js.map +1 -1
- package/dist/backend/grok.js +11 -0
- package/dist/backend/grok.js.map +1 -1
- package/dist/backend/types.d.ts +4 -1
- package/dist/backend/types.js.map +1 -1
- package/dist/backend-availability.d.ts +1 -16
- package/dist/backend-availability.js +2 -91
- package/dist/backend-availability.js.map +1 -1
- package/dist/backend-version-static.d.ts +15 -0
- package/dist/backend-version-static.js +95 -0
- package/dist/backend-version-static.js.map +1 -0
- package/dist/build-provenance.json +1 -1
- package/dist/channel/adapters/telegram.js +3 -1
- package/dist/channel/adapters/telegram.js.map +1 -1
- package/dist/channel/mcp-server.js +18 -1
- package/dist/channel/mcp-server.js.map +1 -1
- package/dist/channel/tool-router.d.ts +4 -0
- package/dist/channel/tool-router.js +43 -19
- package/dist/channel/tool-router.js.map +1 -1
- package/dist/classic-channel-manager.d.ts +3 -0
- package/dist/classic-channel-manager.js +18 -0
- package/dist/classic-channel-manager.js.map +1 -1
- package/dist/classic-cli-guard.d.ts +66 -0
- package/dist/classic-cli-guard.js +209 -0
- package/dist/classic-cli-guard.js.map +1 -0
- package/dist/cli-audited.js +7 -5
- package/dist/cli-audited.js.map +1 -1
- package/dist/config-validator.js +3 -0
- package/dist/config-validator.js.map +1 -1
- package/dist/contact-auth-api.d.ts +16 -0
- package/dist/contact-auth-api.js +78 -0
- package/dist/contact-auth-api.js.map +1 -0
- package/dist/contact-auth-files.d.ts +6 -0
- package/dist/contact-auth-files.js +29 -0
- package/dist/contact-auth-files.js.map +1 -0
- package/dist/contact-auth-policy.d.ts +75 -0
- package/dist/contact-auth-policy.js +23 -0
- package/dist/contact-auth-policy.js.map +1 -0
- package/dist/contact-auth-service.d.ts +32 -0
- package/dist/contact-auth-service.js +99 -0
- package/dist/contact-auth-service.js.map +1 -0
- package/dist/contact-auth-store.d.ts +75 -0
- package/dist/contact-auth-store.js +295 -0
- package/dist/contact-auth-store.js.map +1 -0
- package/dist/contact-auth-types.d.ts +170 -0
- package/dist/contact-auth-types.js +7 -0
- package/dist/contact-auth-types.js.map +1 -0
- package/dist/daemon.d.ts +16 -1
- package/dist/daemon.js +127 -11
- package/dist/daemon.js.map +1 -1
- package/dist/delivery-outbox.d.ts +6 -0
- package/dist/delivery-outbox.js +19 -0
- package/dist/delivery-outbox.js.map +1 -1
- package/dist/dispatcher-liveness.js +2 -2
- package/dist/dispatcher-liveness.js.map +1 -1
- package/dist/fleet-manager.d.ts +45 -0
- package/dist/fleet-manager.js +450 -23
- package/dist/fleet-manager.js.map +1 -1
- package/dist/general-knowledge/skills/concepts/SKILL.md +18 -0
- package/dist/general-knowledge/skills/credential-profiles/SKILL.md +12 -0
- package/dist/general-knowledge/skills/cross-instance-messaging/SKILL.md +28 -0
- package/dist/general-knowledge/skills/hub/SKILL.md +6 -0
- package/dist/hub/audit/index.d.ts +3 -1
- package/dist/hub/audit/index.js +35 -3
- package/dist/hub/audit/index.js.map +1 -1
- package/dist/hub/catalog.d.ts +8 -0
- package/dist/hub/catalog.js +39 -4
- package/dist/hub/catalog.js.map +1 -1
- package/dist/hub/compose/server.d.ts +2 -0
- package/dist/hub/compose/server.js +11 -1
- package/dist/hub/compose/server.js.map +1 -1
- package/dist/hub/directory/directory.js +5 -2
- package/dist/hub/directory/directory.js.map +1 -1
- package/dist/hub/directory/types.d.ts +5 -1
- package/dist/hub/directory/types.js.map +1 -1
- package/dist/hub/group-policy/resources.d.ts +1 -1
- package/dist/hub/http/compose.d.ts +2 -0
- package/dist/hub/http/compose.js +123 -6
- package/dist/hub/http/compose.js.map +1 -1
- package/dist/hub/http/deps.d.ts +2 -0
- package/dist/hub/http/schema.js +6 -1
- package/dist/hub/http/schema.js.map +1 -1
- package/dist/hub/invitations.js +15 -7
- package/dist/hub/invitations.js.map +1 -1
- package/dist/hub/roles/cutover-inventory.d.ts +3 -0
- package/dist/hub/roles/cutover-inventory.js +20 -4
- package/dist/hub/roles/cutover-inventory.js.map +1 -1
- package/dist/hub/roles/cutover-marker.d.ts +18 -2
- package/dist/hub/roles/cutover-marker.js +6 -2
- package/dist/hub/roles/cutover-marker.js.map +1 -1
- package/dist/hub/room-agent-discovery-model.d.ts +29 -0
- package/dist/hub/room-agent-discovery-model.js +33 -0
- package/dist/hub/room-agent-discovery-model.js.map +1 -0
- package/dist/hub/room-agent-discovery.d.ts +14 -0
- package/dist/hub/room-agent-discovery.js +65 -0
- package/dist/hub/room-agent-discovery.js.map +1 -0
- package/dist/hub/room-agent-requests.d.ts +71 -0
- package/dist/hub/room-agent-requests.js +377 -0
- package/dist/hub/room-agent-requests.js.map +1 -0
- package/dist/hub/rooms/directory.d.ts +13 -0
- package/dist/hub/rooms/directory.js +12 -3
- package/dist/hub/rooms/directory.js.map +1 -1
- package/dist/hub/rooms/schema.d.ts +5 -0
- package/dist/hub/rooms/schema.js +9 -0
- package/dist/hub/rooms/schema.js.map +1 -1
- package/dist/hub/rooms/service.d.ts +43 -19
- package/dist/hub/rooms/service.js +67 -11
- package/dist/hub/rooms/service.js.map +1 -1
- package/dist/hub/rooms/types.d.ts +1 -1
- package/dist/instance-lifecycle.d.ts +6 -1
- package/dist/instance-lifecycle.js +11 -4
- package/dist/instance-lifecycle.js.map +1 -1
- package/dist/locale.js +34 -4
- package/dist/locale.js.map +1 -1
- package/dist/needs-you-hub.d.ts +1 -0
- package/dist/needs-you-hub.js +6 -0
- package/dist/needs-you-hub.js.map +1 -1
- package/dist/needs-you.d.ts +14 -2
- package/dist/needs-you.js +4 -0
- package/dist/needs-you.js.map +1 -1
- package/dist/office-share-page.js +1 -1
- package/dist/office-share-page.js.map +1 -1
- package/dist/outbound-handlers.d.ts +9 -0
- package/dist/outbound-handlers.js +48 -10
- package/dist/outbound-handlers.js.map +1 -1
- package/dist/pause-marker.d.ts +1 -1
- package/dist/pause-marker.js +1 -1
- package/dist/pause-marker.js.map +1 -1
- package/dist/public-web-gateway.d.ts +20 -0
- package/dist/public-web-gateway.js +61 -4
- package/dist/public-web-gateway.js.map +1 -1
- package/dist/runtime-cli-install.js +7 -7
- package/dist/runtime-cli-install.js.map +1 -1
- package/dist/topic-commands.d.ts +1 -1
- package/dist/topic-commands.js +4 -6
- package/dist/topic-commands.js.map +1 -1
- package/dist/ui/accounts-keepalive.js +2 -1
- package/dist/ui/accounts-view.js +2 -1
- package/dist/ui/agent-details-settings.js +7 -5
- package/dist/ui/contact-auth-client.js +48 -0
- package/dist/ui/contact-auth-strings.js +164 -0
- package/dist/ui/contact-authorizations.js +125 -0
- package/dist/ui/contact-needs.js +84 -0
- package/dist/ui/contact-permissions.js +193 -0
- package/dist/ui/contact-ticket-badge.js +54 -0
- package/dist/ui/fleet-canvas.js +3 -1
- package/dist/ui/fleet-office-skin.js +4 -3
- package/dist/ui/fleet-route.js +44 -6
- package/dist/ui/fleet-task-view.js +2 -1
- package/dist/ui/host-install.js +5 -2
- package/dist/ui/hub-ai-apps.js +2 -1
- package/dist/ui/hub-chat-strings.js +2 -1
- package/dist/ui/hub-client.js +30 -7
- package/dist/ui/hub-grant-picker.js +2 -1
- package/dist/ui/hub-group-strings.js +2 -1
- package/dist/ui/hub-invitations.js +5 -1
- package/dist/ui/hub-my-agents.js +2 -1
- package/dist/ui/hub-owner-strings.js +2 -1
- package/dist/ui/hub-personal-agent.js +2 -1
- package/dist/ui/hub-quota.js +2 -1
- package/dist/ui/hub-roles-strings.js +2 -1
- package/dist/ui/hub-room-new-strings.js +2 -1
- package/dist/ui/hub-room-new.js +10 -3
- package/dist/ui/hub-room-owner-requests-strings.js +114 -0
- package/dist/ui/hub-room-owner-requests.js +264 -0
- package/dist/ui/hub-room-pins.js +43 -0
- package/dist/ui/hub-room-settings.js +11 -2
- package/dist/ui/hub-room-source.js +2 -1
- package/dist/ui/hub-room-strings.js +3 -0
- package/dist/ui/hub-room-thread.js +47 -5
- package/dist/ui/hub-strings.js +2 -1
- package/dist/ui/hub-teams.js +2 -1
- package/dist/ui/model-picker.js +3 -2
- package/dist/ui/panel-chat.js +8 -2
- package/dist/ui/panel-details.js +2 -0
- package/dist/ui/panel-fleet.js +3 -2
- package/dist/ui/panel-hub.js +14 -4
- package/dist/ui/panel-needs.js +8 -3
- package/dist/ui/panel-runtimes.js +2 -1
- package/dist/ui/panel-settings.js +3 -0
- package/dist/ui/reply-file-preview.js +2 -1
- package/dist/ui/settings-access-overview.js +2 -1
- package/dist/ui/settings-connector.js +2 -1
- package/dist/ui/shared/agent-sheet.js +2 -1
- package/dist/ui/shared/app-i18n.js +2 -2
- package/dist/ui/shared/app-route.js +1 -1
- package/dist/ui/shared/app-shell.js +35 -9
- package/dist/ui/shared/app-stream.js +3 -1
- package/dist/ui/shared/app.css +42 -0
- package/dist/ui/shared/asset-url.d.ts +2 -0
- package/dist/ui/shared/asset-url.js +20 -0
- package/dist/ui/shared/chat-quote.js +26 -2
- package/dist/ui/shared/chat-table-select.js +175 -0
- package/dist/ui/shared/chat-thread.js +6 -2
- package/dist/ui/shared/hub-rooms-u2.css +22 -0
- package/dist/ui/shared/image-annotate.js +2 -1
- package/dist/ui/shared/text-undo.js +17 -3
- package/dist/ui/shared/ui-states.js +3 -2
- package/dist/ui/shared/view-history.js +2 -1
- package/dist/ui/subagent-row.js +3 -2
- package/dist/ui/usage-pool.js +2 -1
- package/dist/ui/workspace-panel.js +2 -1
- package/dist/wake-coordinator.js +3 -2
- package/dist/wake-coordinator.js.map +1 -1
- package/dist/web-api.d.ts +9 -0
- package/dist/web-api.js +56 -4
- package/dist/web-api.js.map +1 -1
- package/dist/web-chat-history.d.ts +5 -0
- package/dist/web-chat-history.js +26 -0
- package/dist/web-chat-history.js.map +1 -1
- package/dist/web-host-install.d.ts +1 -1
- package/dist/web-reply-files.d.ts +1 -0
- package/dist/web-reply-files.js +2 -0
- package/dist/web-reply-files.js.map +1 -1
- package/dist/web-shell-routes.d.ts +1 -1
- package/dist/web-shell-routes.js +2 -1
- package/dist/web-shell-routes.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* M-3339 (A2): the words of contact authorizations — a ClassicBot room's requests to other agents held for approval, the
|
|
3
|
+
* agent page's Permissions, Fleet → Authorizations, the chat badges, Needs you and the restricted-mode suggestion. en and
|
|
4
|
+
* zh-TW (admin is 管理員). A module of its own (namespace contactAuth); imports only app-i18n.
|
|
5
|
+
*/
|
|
6
|
+
import { register, t } from "/assets/app-i18n.js";
|
|
7
|
+
|
|
8
|
+
register("contactAuth", {
|
|
9
|
+
en: {
|
|
10
|
+
tab: "Permissions", lead: "Who may ask this agent to forward requests to other agents, and what this room may use.",
|
|
11
|
+
loading: "Loading permissions…", loadFailed: "Couldn't load permissions.", retry: "Try again",
|
|
12
|
+
forbidden: "Only this agent's managers can see its permissions.", unavailable: "Permissions are unavailable right now. Try again in a moment.",
|
|
13
|
+
stale: "Someone changed these permissions just now. They have been reloaded — check them and try again.",
|
|
14
|
+
saved: "Saved.", saveFailed: "Couldn't save.", readOnly: "You can see these permissions but not change them.",
|
|
15
|
+
// Mode (a ClassicBot room)
|
|
16
|
+
modeTitle: "Room mode", modeRestricted: "Restricted", modeLegacy: "Not restricted (older setting)",
|
|
17
|
+
modeRestrictedNote: "Requests from people who aren't admins to other agents wait for approval before anything is sent.",
|
|
18
|
+
modeLegacyNote: "Requests from this room go to other agents without approval.",
|
|
19
|
+
switchRestricted: "Switch to restricted", switchLegacy: "Turn restricted mode off",
|
|
20
|
+
confirmRestricted: "Switch this room to restricted mode?", confirmLegacy: "Turn restricted mode off? Requests from this room will go to other agents without approval. Work already handed to another agent stays as it is.",
|
|
21
|
+
wouldDisableTitle: "These tools will stop in this room:", wouldDisableNone: "No tool this room uses now will stop.",
|
|
22
|
+
impactIncomplete: "The backend's own tool list couldn't be read, so other tools may stop too.",
|
|
23
|
+
suggestBanner: "We suggest switching this room to restricted mode.",
|
|
24
|
+
switchOriginNote: "After switching, existing history is treated as unknown. New contacts, including an admin's, need approval; allowed-contact grants cannot match. Approval forwards one request and does not clear the retained origin.",
|
|
25
|
+
// Approvers
|
|
26
|
+
approversTitle: "Approvers", approversInherited: "Inherited from the agent's channel admins.", approversNone: "No channel approvers are selected. A verified host operator is the only permitted approver.",
|
|
27
|
+
approverRemove: "Remove {0}", approversReset: "Use the channel admins again",
|
|
28
|
+
approverAdmins: "Approver must be a Fleet admin for now.", approverPick: "Add an approver", approverAdd: "Add", approverNone: "Choose…",
|
|
29
|
+
invalidApprover: "That person can't approve. Approver must be a Fleet admin for now.",
|
|
30
|
+
// Guard
|
|
31
|
+
guardTitle: "Command-line guard", guard_ready: "Active", "guard_restart-required": "Restart needed", "guard_not-covered": "Not covered", guard_failed: "Failed",
|
|
32
|
+
guardNote: "The guard limits what the backend's own tools can do in this room. It is a policy control, not a security boundary on this computer.",
|
|
33
|
+
notCoveredWarning: "This AI tool or version isn't covered by the guard: it runs with its normal permissions; only contact approval applies.",
|
|
34
|
+
newRoomsRestricted: "New ClassicBot rooms start in restricted mode: requests from people who aren't admins to other agents wait for approval. Where the guard doesn't cover a room's AI tool or version, that tool runs with its normal permissions; only contact approval applies.",
|
|
35
|
+
guardBackend: "Backend: {0}", guardReasonOther: "The guard reported a state this page doesn't know.",
|
|
36
|
+
"guardReason_legacy-mode": "This room isn't in restricted mode, so the guard isn't used.",
|
|
37
|
+
"guardReason_unsupported-backend": "This backend isn't covered by the guard.",
|
|
38
|
+
"guardReason_unsupported-platform": "The guard isn't available on this computer's system.",
|
|
39
|
+
"guardReason_unsupported-version": "This version of the backend isn't covered by the guard.",
|
|
40
|
+
"guardReason_cli-mode": "The guard covers the backend only when it runs through AgEnD's tools, not in this mode.",
|
|
41
|
+
"guardReason_load-not-verified": "The guard hasn't been confirmed as loaded yet. Restart the agent to load it.",
|
|
42
|
+
"guardReason_stale-policy": "The room's settings changed since the agent started. Restart it to apply them.",
|
|
43
|
+
"guardReason_stale-launch": "The agent was started before the guard was set up. Restart it to apply it.",
|
|
44
|
+
"guardReason_not-running": "The agent isn't running, so the guard can't be checked.",
|
|
45
|
+
"guardReason_invalid-policy": "The guard's settings couldn't be read.",
|
|
46
|
+
"guardReason_missing-bound-mcp": "A tool the guard expects isn't available, so it isn't covered.",
|
|
47
|
+
"guardReason_missing-selected-mcp": "A selected MCP tool isn't available to the guard, so it isn't covered. Public reading and AgEnD's own tools still work.",
|
|
48
|
+
"guardReason_guard-files-changed": "The guard's files changed. Restart the agent to load them again.",
|
|
49
|
+
"guardReason_invalid-load-receipt": "The guard's load couldn't be confirmed.",
|
|
50
|
+
"guardReason_guard-unavailable": "The guard isn't available.",
|
|
51
|
+
"guardReason_binary-changed": "The backend program changed since it started. Restart the agent.",
|
|
52
|
+
// Room tools
|
|
53
|
+
toolsTitle: "Tools in this room", publicRead: "Public web search and page reading",
|
|
54
|
+
publicReadNote: "Read-only: searching the web and reading public pages. It doesn't allow running commands or reaching private networks.",
|
|
55
|
+
mcpTitle: "Extra MCP tools (exact names)", mcpNone: "No extra MCP tools.", mcpAdd: "Add", mcpAddLabel: "Exact MCP tool name",
|
|
56
|
+
mcpRemove: "Remove {0}", mcpOwnerWarning: "Uses the owner's account: its cost and identity are the owner's.", mcpPublicRead: "public read",
|
|
57
|
+
offByDefault: "Shell, files outside the room's scratch folder and the owner's credentials stay off.",
|
|
58
|
+
// Allowed contacts (grants)
|
|
59
|
+
grantsTitle: "Allowed contacts", grantsNone: "No allowed contacts. Each request asks the approver.",
|
|
60
|
+
grantsNote: "For a known origin, every originating person needs a matching allowed contact. Unknown origins cannot match these grants and need separate approval.",
|
|
61
|
+
grantRow: "{0} → {1}", grantVerbs: "For: {0}", grantExpires: "Until {0}", grantUses: "{0} uses left", grantUnlimited: "Until it expires",
|
|
62
|
+
grantRemove: "Remove", grantRemoveConfirm: "Remove this allowed contact? Later requests will ask again.",
|
|
63
|
+
// History
|
|
64
|
+
historyTitle: "History", historyNone: "Nothing yet.",
|
|
65
|
+
action_policy: "Settings changed", action_approve: "Approved", action_decline: "Declined", "action_grant-add": "Contact allowed", "action_grant-remove": "Contact removed",
|
|
66
|
+
// Tickets
|
|
67
|
+
ticket: "Contact request #{0}", forwarded: "Forwarded (approved)",
|
|
68
|
+
state_pending: "Waiting for approval", state_approved: "Approved", state_delivered: "Forwarded", state_declined: "Declined", state_expired: "Expired", state_unknown: "Unknown",
|
|
69
|
+
verb_send_to_instance: "message", verb_delegate_task: "task", verb_request_information: "question", verb_broadcast: "broadcast", verb_report_result: "report",
|
|
70
|
+
from: "From {0}", via: "Via {0}", to: "To {0}", origin_unknown: "Origin unknown", origin_mixed: "Earlier non-admin request",
|
|
71
|
+
"reason_earlier-non-admin": "This agent's retained history includes non-admin input, so this contact needs approval.",
|
|
72
|
+
"reason_unknown-origin": "This agent's retained history has an unknown origin, so this contact needs approval.",
|
|
73
|
+
resetNote: "Approval forwards this request only. Retained origins also affect workers and are not cleared by a later admin message; this version has no verified reset.",
|
|
74
|
+
created: "Asked {0}", expires: "Expires {0}", decided: "{0} by {1}",
|
|
75
|
+
approveOnce: "Approve once", decline: "Decline", alsoAllow: "Also allow this contact", alsoAllowUntil: "Until", alsoAllowUses: "Uses (empty: no limit)",
|
|
76
|
+
decidedNote: "Approving forwards this one request once. It doesn't approve what the other agent does with it.",
|
|
77
|
+
deliveryNote: "Forwarded means the request was delivered, not that the work is done.",
|
|
78
|
+
// Fleet → Authorizations
|
|
79
|
+
pageTitle: "Authorizations", pageLead: "Requests from ClassicBot rooms to other agents that wait for an approver.",
|
|
80
|
+
filterStatus: "Show", filter_pending: "Waiting", filter_all: "All", filterAgent: "Agent", filterAny: "Any",
|
|
81
|
+
filterPerson: "Only {0}", filterPersonClear: "Show everyone",
|
|
82
|
+
empty: "No requests.", emptyPending: "Nothing is waiting for approval.", more: "Show more",
|
|
83
|
+
decideFailed: "Couldn't record the decision.", alreadyDecided: "This request was decided elsewhere. It has been reloaded.",
|
|
84
|
+
// Needs you / suggestion
|
|
85
|
+
needsTitle: "{0} wants to contact {1}", needsOpen: "Open",
|
|
86
|
+
suggestTitle: "We suggest switching this room to restricted mode",
|
|
87
|
+
suggestBody: "Requests from people who aren't admins to other agents would wait for approval first.",
|
|
88
|
+
suggestSwitch: "Switch this room", suggestView: "See the impact and allowed contacts", suggestLater: "Later",
|
|
89
|
+
},
|
|
90
|
+
"zh-TW": {
|
|
91
|
+
tab: "權限", lead: "誰可以請這個 Agent 把請求轉交給其他 Agent,以及這個房間可以使用什麼。",
|
|
92
|
+
loading: "正在載入權限…", loadFailed: "無法載入權限。", retry: "重試",
|
|
93
|
+
forbidden: "只有這個 Agent 的管理員可以查看權限。", unavailable: "目前無法取得權限,請稍後再試。",
|
|
94
|
+
stale: "剛才有人修改了這些權限,已重新載入,請確認後再試一次。",
|
|
95
|
+
saved: "已儲存。", saveFailed: "無法儲存。", readOnly: "你可以查看這些權限,但無法修改。",
|
|
96
|
+
modeTitle: "房間模式", modeRestricted: "受限模式", modeLegacy: "未受限(舊設定)",
|
|
97
|
+
modeRestrictedNote: "非管理員對其他 Agent 的請求,要先經過核准才會送出。",
|
|
98
|
+
modeLegacyNote: "這個房間的請求會直接送給其他 Agent,不需核准。",
|
|
99
|
+
switchRestricted: "切換為受限模式", switchLegacy: "關閉受限模式",
|
|
100
|
+
confirmRestricted: "要將這個房間切換為受限模式嗎?", confirmLegacy: "要關閉受限模式嗎?這個房間的請求將直接送給其他 Agent,不需核准。已交給其他 Agent 的工作不會因此改變。",
|
|
101
|
+
wouldDisableTitle: "這個房間將停用下列工具:", wouldDisableNone: "這個房間目前使用的工具都不會停用。",
|
|
102
|
+
impactIncomplete: "無法讀取後端本身的工具清單,因此可能還有其他工具會停用。",
|
|
103
|
+
suggestBanner: "建議將這個房間切換為受限模式。",
|
|
104
|
+
switchOriginNote: "切換後,既有歷史會視為來源不明。包含管理員在內的新聯絡都須逐筆核准,允許的聯絡授權無法配對;核准一筆不會清除保留的來源。",
|
|
105
|
+
approversTitle: "核准人", approversInherited: "沿用這個 Agent 所在頻道的管理員。", approversNone: "尚未選定頻道核准人,僅允許已驗證的主機操作者核准。",
|
|
106
|
+
approverRemove: "移除 {0}", approversReset: "改回沿用頻道管理員",
|
|
107
|
+
approverAdmins: "目前核准人必須是 Fleet 管理員。", approverPick: "新增核准人", approverAdd: "新增", approverNone: "選擇…",
|
|
108
|
+
invalidApprover: "這個人無法擔任核准人。目前核准人必須是 Fleet 管理員。",
|
|
109
|
+
guardTitle: "命令列防護", guard_ready: "已啟用", "guard_restart-required": "需要重新啟動", "guard_not-covered": "未涵蓋", guard_failed: "失敗",
|
|
110
|
+
guardNote: "防護會限制後端內建工具在這個房間能做的事。這是政策控制,不是這台電腦上的安全邊界。",
|
|
111
|
+
notCoveredWarning: "這個 AI 工具或版本不在防護範圍內:它會以原本的權限執行,只有聯絡申請需要核准。",
|
|
112
|
+
newRoomsRestricted: "新的 ClassicBot 房間預設為受限模式:非管理員對其他 Agent 的請求要先經過核准。若防護不涵蓋房間的 AI 工具或版本,該工具會以原本的權限執行,只有聯絡申請需要核准。",
|
|
113
|
+
guardBackend: "後端:{0}", guardReasonOther: "防護回報了這個頁面不認得的狀態。",
|
|
114
|
+
"guardReason_legacy-mode": "這個房間不是受限模式,因此不使用防護。",
|
|
115
|
+
"guardReason_unsupported-backend": "防護不支援這個後端。",
|
|
116
|
+
"guardReason_unsupported-platform": "這台電腦的系統無法使用防護。",
|
|
117
|
+
"guardReason_unsupported-version": "防護不支援這個版本的後端。",
|
|
118
|
+
"guardReason_cli-mode": "防護只在後端透過 AgEnD 工具執行時有效,這個模式不在範圍內。",
|
|
119
|
+
"guardReason_load-not-verified": "尚未確認防護已載入,請重新啟動 Agent 以載入。",
|
|
120
|
+
"guardReason_stale-policy": "Agent 啟動後房間設定有變更,請重新啟動以套用。",
|
|
121
|
+
"guardReason_stale-launch": "Agent 在防護設定前就已啟動,請重新啟動以套用。",
|
|
122
|
+
"guardReason_not-running": "Agent 沒有在執行,無法檢查防護。",
|
|
123
|
+
"guardReason_invalid-policy": "無法讀取防護設定。",
|
|
124
|
+
"guardReason_missing-bound-mcp": "防護需要的工具不在,因此不在涵蓋範圍內。",
|
|
125
|
+
"guardReason_missing-selected-mcp": "選用的 MCP 工具防護無法取得,因此不在涵蓋範圍內;公開讀取與 AgEnD 本身的工具仍可使用。",
|
|
126
|
+
"guardReason_guard-files-changed": "防護的檔案有變更,請重新啟動 Agent 以重新載入。",
|
|
127
|
+
"guardReason_invalid-load-receipt": "無法確認防護的載入狀態。",
|
|
128
|
+
"guardReason_guard-unavailable": "防護目前無法使用。",
|
|
129
|
+
"guardReason_binary-changed": "後端程式在啟動後有變更,請重新啟動 Agent。",
|
|
130
|
+
toolsTitle: "這個房間的工具", publicRead: "公開網頁搜尋與讀取",
|
|
131
|
+
publicReadNote: "唯讀:搜尋網頁、讀取公開頁面。不包含執行指令,也無法連到私人網路。",
|
|
132
|
+
mcpTitle: "額外的 MCP 工具(完整名稱)", mcpNone: "沒有額外的 MCP 工具。", mcpAdd: "新增", mcpAddLabel: "MCP 工具的完整名稱",
|
|
133
|
+
mcpRemove: "移除 {0}", mcpOwnerWarning: "使用擁有者的帳號:費用與身分都算在擁有者名下。", mcpPublicRead: "公開讀取",
|
|
134
|
+
offByDefault: "Shell、房間暫存資料夾以外的檔案與擁有者的憑證都維持關閉。",
|
|
135
|
+
grantsTitle: "常用轉交", grantsNone: "沒有常用轉交,每個請求都會詢問核准人。",
|
|
136
|
+
grantsNote: "來源已知時,每位最初提問者都須有相符的允許聯絡授權。來源不明無法配對這些授權,須另外核准。",
|
|
137
|
+
grantRow: "{0} → {1}", grantVerbs: "用途:{0}", grantExpires: "到 {0} 為止", grantUses: "剩下 {0} 次", grantUnlimited: "到期前不限次數",
|
|
138
|
+
grantRemove: "移除", grantRemoveConfirm: "要移除這個常用轉交嗎?之後的請求會再次詢問。",
|
|
139
|
+
historyTitle: "紀錄", historyNone: "目前沒有紀錄。",
|
|
140
|
+
action_policy: "設定已變更", action_approve: "已核准", action_decline: "已拒絕", "action_grant-add": "已加入常用轉交", "action_grant-remove": "已移除常用轉交",
|
|
141
|
+
ticket: "聯絡申請 #{0}", forwarded: "已准轉交",
|
|
142
|
+
state_pending: "等待核准", state_approved: "已核准", state_delivered: "已准轉交", state_declined: "已拒絕", state_expired: "已過期", state_unknown: "狀態不明",
|
|
143
|
+
verb_send_to_instance: "訊息", verb_delegate_task: "交辦工作", verb_request_information: "詢問", verb_broadcast: "廣播", verb_report_result: "回報結果",
|
|
144
|
+
from: "來自 {0}", via: "經由 {0}", to: "給 {0}", origin_unknown: "來源不明", origin_mixed: "先前有非管理員的請求",
|
|
145
|
+
"reason_earlier-non-admin": "這個 Agent 保留的歷史含有非管理員輸入,因此這次聯絡需要核准。",
|
|
146
|
+
"reason_unknown-origin": "這個 Agent 保留的歷史來源不明,因此這次聯絡需要核准。",
|
|
147
|
+
resetNote: "核准只會轉交這筆申請。保留的來源也會影響接手的工作者,不會因後來的管理員訊息解除;此版本沒有已驗證的重設方式。",
|
|
148
|
+
created: "{0} 提出", expires: "{0} 到期", decided: "{1} 於 {0} 處理",
|
|
149
|
+
approveOnce: "核准這一次", decline: "拒絕", alsoAllow: "同時加入常用轉交", alsoAllowUntil: "到期時間", alsoAllowUses: "次數(留空表示不限)",
|
|
150
|
+
decidedNote: "核准只會轉交這一個請求一次,不代表核准對方 Agent 之後的處理。",
|
|
151
|
+
deliveryNote: "「已准轉交」表示請求已送達,不代表工作已完成。",
|
|
152
|
+
pageTitle: "授權", pageLead: "ClassicBot 房間對其他 Agent 提出、正在等待核准人的請求。",
|
|
153
|
+
filterStatus: "顯示", filter_pending: "等待中", filter_all: "全部", filterAgent: "Agent", filterAny: "任何",
|
|
154
|
+
filterPerson: "只看 {0}", filterPersonClear: "顯示所有人",
|
|
155
|
+
empty: "沒有請求。", emptyPending: "沒有等待核准的請求。", more: "顯示更多",
|
|
156
|
+
decideFailed: "無法記錄這個決定。", alreadyDecided: "這個請求已在其他地方處理,已重新載入。",
|
|
157
|
+
needsTitle: "{0} 想聯絡 {1}", needsOpen: "開啟",
|
|
158
|
+
suggestTitle: "建議將這個房間切換為受限模式",
|
|
159
|
+
suggestBody: "非管理員對其他 Agent 的請求,將先經過核准才會送出。",
|
|
160
|
+
suggestSwitch: "切換這個房間", suggestView: "查看影響與常用轉交", suggestLater: "稍後",
|
|
161
|
+
},
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
export const ca = (k, ...a) => t(`contactAuth.${k}`, ...a);
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
// M-3339 (A2): Fleet → Authorizations — requests from ClassicBot rooms to other agents, held for an approver (the contact
|
|
2
|
+
// authorization contract: src/contact-auth-types.ts; docs/design/classic-contact-authorizations.md). The server scopes
|
|
3
|
+
// the list (approvers and the source room's admins only; at most 50 a page, then a cursor) and decides who may decide.
|
|
4
|
+
// - Show: waiting (default) or all; one agent; one person (an exact identity, picked from a request — never a name search).
|
|
5
|
+
// - A request: who asked (the origin, through which agents), from which room to which agent, the verb and its message,
|
|
6
|
+
// when it expires; Approve once / Decline when the reader may decide, with "also allow this contact" as a separate,
|
|
7
|
+
// explicit choice. Approving forwards this one request once; "Forwarded" means delivered, not that the work is done.
|
|
8
|
+
// - ?ticket=<id> opens that request at the top (from a chat badge, Needs you or a Permissions history row).
|
|
9
|
+
// It reads again on the stream's contact-auth frame and when the page is shown again (no timer).
|
|
10
|
+
import { html, useEffect, useState } from "/assets/app-html.js";
|
|
11
|
+
import { register } from "/assets/app-i18n.js";
|
|
12
|
+
import { appStore, useStore } from "/assets/app-store.js";
|
|
13
|
+
import { toast } from "/assets/ui-toast.js";
|
|
14
|
+
import { Skeleton, ErrorState, Empty } from "/assets/ui-states.js";
|
|
15
|
+
import { ca } from "./contact-auth-strings.js";
|
|
16
|
+
import { decideTicket, getTicket, listTickets, personKey, shortTicketId } from "./contact-auth-client.js";
|
|
17
|
+
|
|
18
|
+
// The Fleet tab's own label (panel-fleet.js reads fleet.<tab>).
|
|
19
|
+
register("fleet", { en: { authorizations: "Authorizations" }, "zh-TW": { authorizations: "授權" } });
|
|
20
|
+
|
|
21
|
+
const when = (iso) => { const d = new Date(iso); return Number.isFinite(d.getTime()) ? d.toLocaleString([], { dateStyle: "medium", timeStyle: "short" }) : ""; };
|
|
22
|
+
/** The server's reason codes (ContactTicket.reason, ContactPermissions.originRestriction.reason). */
|
|
23
|
+
export const REASONS = new Set(["earlier-non-admin", "unknown-origin"]);
|
|
24
|
+
const TONE = { pending: "warn", approved: "ok", delivered: "ok", declined: "bad", expired: "muted", unknown: "bad" };
|
|
25
|
+
const stateOf = (s) => (Object.prototype.hasOwnProperty.call(TONE, s) ? s : "unknown");
|
|
26
|
+
const label = (p) => (p && (p.label || p.userId)) || "";
|
|
27
|
+
/** datetime-local's value for a time `days` from now (the browser's own zone). */
|
|
28
|
+
const localIn = (days) => { const d = new Date(Date.now() + days * 864e5); d.setSeconds(0, 0); return new Date(d.getTime() - d.getTimezoneOffset() * 6e4).toISOString().slice(0, 16); };
|
|
29
|
+
|
|
30
|
+
/** One request: what it is, who asked, and — for its approver, while it waits — the decision. */
|
|
31
|
+
export function TicketCard({ ticket, onChange, onPerson, focus = false }) {
|
|
32
|
+
const [busy, setBusy] = useState(false);
|
|
33
|
+
const [allow, setAllow] = useState(false);
|
|
34
|
+
const [until, setUntil] = useState(() => localIn(7));
|
|
35
|
+
const [uses, setUses] = useState("");
|
|
36
|
+
const tk = ticket, st = stateOf(tk.state);
|
|
37
|
+
const decide = async (decision) => {
|
|
38
|
+
if (busy) return;
|
|
39
|
+
const n = uses.trim() === "" ? null : Math.max(1, Math.floor(Number(uses)));
|
|
40
|
+
const grant = decision === "approve-once" && allow && until ? { expiresAt: new Date(until).toISOString(), remainingUses: Number.isFinite(n) ? n : null } : undefined;
|
|
41
|
+
setBusy(true);
|
|
42
|
+
const r = await decideTicket(tk.id, { revision: tk.revision, decision, ...(grant ? { grant } : {}) });
|
|
43
|
+
setBusy(false);
|
|
44
|
+
if (r.ok) { onChange?.(r.data); return; }
|
|
45
|
+
if (r.code === "already-decided" || r.code === "expired" || r.code === "conflict") {
|
|
46
|
+
toast(ca("alreadyDecided"), false);
|
|
47
|
+
const again = await getTicket(tk.id);
|
|
48
|
+
if (again.ok) onChange?.(again.data);
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
toast(ca(r.code === "forbidden" ? "forbidden" : r.code === "unavailable" ? "unavailable" : "decideFailed"), false);
|
|
52
|
+
};
|
|
53
|
+
const people = tk.origin?.people || [];
|
|
54
|
+
const originText = tk.origin?.kind === "unknown" ? ca("origin_unknown") : tk.origin?.kind === "mixed" ? ca("origin_mixed") : "";
|
|
55
|
+
return html`<article class=${`card contact-ticket${focus ? " focus" : ""}`} data-ticket=${tk.id} data-state=${st}>
|
|
56
|
+
<div class="contact-ticket-head"><strong title=${tk.id}>${ca("ticket", shortTicketId(tk.id))}</strong><span class=${`contact-pill ${TONE[st]}`}>${ca(`state_${st}`)}</span>
|
|
57
|
+
<span class="muted">${ca(`verb_${tk.verb}`)}</span></div>
|
|
58
|
+
<p class="contact-ticket-route">${ca("from", tk.source)} → ${ca("to", tk.target)}</p>
|
|
59
|
+
<p class="contact-ticket-origin">${people.map((p, i) => html`${i ? ", " : ""}<button type="button" class="link-btn" title=${ca("filterPerson", label(p))}
|
|
60
|
+
onClick=${() => onPerson?.(p)}>${label(p)}</button>`)}${originText ? html` <span class="contact-pill warn">${originText}</span>` : null}
|
|
61
|
+
${tk.origin?.chain?.length ? html` <span class="muted">${ca("via", tk.origin.chain.join(" → "))}</span>` : null}</p>
|
|
62
|
+
${tk.message ? html`<pre class="contact-ticket-message">${tk.message}</pre>` : null}
|
|
63
|
+
<p class="muted contact-ticket-times">${ca("created", when(tk.createdAt))} · ${tk.decidedAt ? ca("decided", when(tk.decidedAt), label(tk.decidedBy)) : ca("expires", when(tk.expiresAt))}</p>
|
|
64
|
+
${st === "delivered" ? html`<p class="note">${ca("deliveryNote")}</p>` : null}
|
|
65
|
+
${/* The server's reason code, in words (Sentinel's A1 copy); a code the page doesn't know says nothing rather than a guess. */ ""}
|
|
66
|
+
${REASONS.has(tk.reason) ? html`<p class="note contact-reason" data-reason=${tk.reason}>${ca(`reason_${tk.reason}`)}${st === "pending" ? html` ${ca("resetNote")}` : null}</p>` : null}
|
|
67
|
+
${tk.canDecide && st === "pending" ? html`<div class="contact-decide">
|
|
68
|
+
<p class="note">${ca("decidedNote")}</p>
|
|
69
|
+
<label class="check contact-toggle"><input type="checkbox" checked=${allow} disabled=${busy} onChange=${(e) => setAllow(e.currentTarget.checked)} /><span>${ca("alsoAllow")}</span></label>
|
|
70
|
+
${allow ? html`<div class="field-row contact-allow">
|
|
71
|
+
<label class="field"><span>${ca("alsoAllowUntil")}</span><input class="input" type="datetime-local" value=${until} disabled=${busy} onInput=${(e) => setUntil(e.currentTarget.value)} /></label>
|
|
72
|
+
<label class="field"><span>${ca("alsoAllowUses")}</span><input class="input" type="number" min="1" inputmode="numeric" value=${uses} disabled=${busy} onInput=${(e) => setUses(e.currentTarget.value)} /></label></div>` : null}
|
|
73
|
+
<div class="field-row"><button type="button" class="btn btn-sm btn-primary" disabled=${busy} onClick=${() => void decide("approve-once")}>${ca("approveOnce")}</button>
|
|
74
|
+
<button type="button" class="btn btn-sm" disabled=${busy} onClick=${() => void decide("decline")}>${ca("decline")}</button></div>
|
|
75
|
+
</div>` : null}
|
|
76
|
+
</article>`;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const ticketFromSearch = () => { try { const v = new URLSearchParams(location.search).get("ticket"); return v && /^[A-Za-z0-9_-]{1,64}$/.test(v) ? v : null; } catch { return null; } };
|
|
80
|
+
|
|
81
|
+
export function ContactAuthorizations() {
|
|
82
|
+
const { instances } = useStore(appStore);
|
|
83
|
+
const [status, setStatus] = useState("pending");
|
|
84
|
+
const [agent, setAgent] = useState("");
|
|
85
|
+
const [person, setPerson] = useState(null);
|
|
86
|
+
const [page, setPage] = useState({ loading: true, items: [], next: null });
|
|
87
|
+
const [focus, setFocus] = useState(null);
|
|
88
|
+
const focusId = ticketFromSearch();
|
|
89
|
+
const filters = { ...(status === "pending" ? { status: "pending" } : {}), ...(agent ? { agent } : {}), ...(person ? { person: personKey(person) } : {}) };
|
|
90
|
+
const read = async (cursor) => {
|
|
91
|
+
const r = await listTickets({ ...filters, ...(cursor ? { cursor } : {}) });
|
|
92
|
+
if (!r.ok) { setPage((p) => ({ ...p, loading: false, error: r.code })); return; }
|
|
93
|
+
setPage((p) => ({ loading: false, items: cursor ? [...p.items, ...r.data.items] : r.data.items, next: r.data.nextCursor }));
|
|
94
|
+
};
|
|
95
|
+
const readFocus = async () => { if (!focusId) return; const r = await getTicket(focusId); setFocus(r.ok ? r.data : null); };
|
|
96
|
+
const key = JSON.stringify(filters);
|
|
97
|
+
useEffect(() => {
|
|
98
|
+
setPage({ loading: true, items: [], next: null });
|
|
99
|
+
void read(); void readFocus();
|
|
100
|
+
const sub = appStore.get().streamOn;
|
|
101
|
+
const off = typeof sub === "function" ? sub("contact-auth", () => { void read(); void readFocus(); }) : null;
|
|
102
|
+
const onShow = () => { if (document.visibilityState === "visible") { void read(); void readFocus(); } };
|
|
103
|
+
document.addEventListener("visibilitychange", onShow);
|
|
104
|
+
return () => { if (typeof off === "function") off(); document.removeEventListener("visibilitychange", onShow); };
|
|
105
|
+
}, [key, focusId]);
|
|
106
|
+
const replace = (tk) => { setPage((p) => ({ ...p, items: p.items.map((x) => (x.id === tk.id ? tk : x)) })); if (focus && focus.id === tk.id) setFocus(tk); };
|
|
107
|
+
const names = (instances || []).map((i) => i.name).filter(Boolean).sort();
|
|
108
|
+
const list = page.items.filter((x) => !focus || x.id !== focus.id);
|
|
109
|
+
return html`<div class="contact-auth-page">
|
|
110
|
+
<p class="note">${ca("pageLead")}</p>
|
|
111
|
+
<div class="field-row contact-filters">
|
|
112
|
+
<div class="seg" role="group" aria-label=${ca("filterStatus")}>${["pending", "all"].map((s) => html`<button key=${s} type="button" class=${`seg-item${status === s ? " active" : ""}`}
|
|
113
|
+
aria-pressed=${status === s ? "true" : "false"} onClick=${() => setStatus(s)}>${ca(`filter_${s}`)}</button>`)}</div>
|
|
114
|
+
<label class="field contact-agent-filter"><span>${ca("filterAgent")}</span><select class="input" value=${agent} onChange=${(e) => setAgent(e.currentTarget.value)}>
|
|
115
|
+
<option value="">${ca("filterAny")}</option>${names.map((n) => html`<option key=${n} value=${n}>${n}</option>`)}</select></label>
|
|
116
|
+
${person ? html`<button type="button" class="btn btn-sm btn-ghost contact-person-filter" onClick=${() => setPerson(null)}>${ca("filterPerson", label(person))} · ${ca("filterPersonClear")}</button>` : null}
|
|
117
|
+
</div>
|
|
118
|
+
${focus ? html`<${TicketCard} ticket=${focus} focus=${true} onChange=${replace} onPerson=${setPerson} />` : null}
|
|
119
|
+
${page.loading ? html`<${Skeleton} lines=${4} label=${ca("loading")} />`
|
|
120
|
+
: page.error && !page.items.length ? (page.error === "forbidden" ? html`<p class="note">${ca("forbidden")}</p>` : html`<${ErrorState} message=${ca(page.error === "unavailable" ? "unavailable" : "loadFailed")} onRetry=${() => void read()} />`)
|
|
121
|
+
: !list.length && !focus ? html`<${Empty} icon="key" title=${ca(status === "pending" ? "emptyPending" : "empty")} />`
|
|
122
|
+
: html`<div class="contact-ticket-list">${list.map((tk) => html`<${TicketCard} key=${tk.id} ticket=${tk} onChange=${replace} onPerson=${setPerson} />`)}</div>`}
|
|
123
|
+
${page.next ? html`<div class="field-row"><button type="button" class="btn btn-sm" onClick=${() => void read(page.next)}>${ca("more")}</button></div>` : null}
|
|
124
|
+
</div>`;
|
|
125
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
// M-3339 (A2): Needs you's contact items (panel-needs.js hands item.type "contact" here). The server's needs list carries
|
|
2
|
+
// only references, scoped to the signed-in viewer (Sentinel's seam):
|
|
3
|
+
// - reason "contact_request", contactTicket { id, source, target }: the title names source and target; the request itself
|
|
4
|
+
// (who asked, the message, whether this reader may decide) is read from the scoped ticket route — never shown from the
|
|
5
|
+
// list. Approve once / Decline there (TicketCard); Open goes to Fleet → Authorizations.
|
|
6
|
+
// - reason "contact_restricted_suggestion", contactSuggestion { instance }: 切換這個房間 reads the room's permissions (its
|
|
7
|
+
// revision, and what would stop), confirms, then PUTs mode restricted; 查看影響與常用轉交 opens its Permissions;
|
|
8
|
+
// 稍後 acknowledges the reminder (POST /ui/needs/ack — the server's durable dismissal; the mode never changes).
|
|
9
|
+
// The item leaves the list when the server's next `needs` drops it.
|
|
10
|
+
import { html, useEffect, useState } from "/assets/app-html.js";
|
|
11
|
+
import { detailsPath } from "/assets/app-route.js";
|
|
12
|
+
import { Icon } from "/assets/ui-icons.js";
|
|
13
|
+
import { toast } from "/assets/ui-toast.js";
|
|
14
|
+
import { confirmDialog } from "/assets/ui-confirm.js";
|
|
15
|
+
import { ca } from "./contact-auth-strings.js";
|
|
16
|
+
import { getPermissions, getTicket, putPermissions } from "./contact-auth-client.js";
|
|
17
|
+
import { TicketCard } from "./contact-authorizations.js";
|
|
18
|
+
import { notCovered, wouldDisableText } from "./contact-permissions.js";
|
|
19
|
+
|
|
20
|
+
const ID = /^[A-Za-z0-9_-]{1,64}$/;
|
|
21
|
+
|
|
22
|
+
function RequestNeed({ item }) {
|
|
23
|
+
const ref = item.contactTicket || {};
|
|
24
|
+
const [tk, setTk] = useState(null);
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
let live = true;
|
|
27
|
+
if (ID.test(String(ref.id || ""))) void getTicket(ref.id).then((r) => { if (live && r.ok) setTk(r.data); });
|
|
28
|
+
return () => { live = false; };
|
|
29
|
+
}, [ref.id]);
|
|
30
|
+
return html`<div class="n-title"><strong>${ca("needsTitle", ref.source || "", ref.target || "")}</strong></div>
|
|
31
|
+
${tk ? html`<${TicketCard} ticket=${tk} onChange=${setTk} />` : null}
|
|
32
|
+
<div class="n-actions">${ID.test(String(ref.id || "")) ? html`<a class="btn btn-sm btn-ghost" href=${`/ui/fleet/authorizations?ticket=${encodeURIComponent(ref.id)}`}>${ca("needsOpen")}</a>` : null}</div>`;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function SuggestionNeed({ item }) {
|
|
36
|
+
const name = item.contactSuggestion?.instance || item.instance;
|
|
37
|
+
const [busy, setBusy] = useState(false);
|
|
38
|
+
// The room's guard coverage, read (scoped) before the switch: not covered → said here, before the mode is set.
|
|
39
|
+
const [guard, setGuard] = useState(null);
|
|
40
|
+
useEffect(() => {
|
|
41
|
+
let live = true;
|
|
42
|
+
if (name) void getPermissions(name).then((r) => { if (live && r.ok) setGuard(r.data.nativeGuard || null); });
|
|
43
|
+
return () => { live = false; };
|
|
44
|
+
}, [name]);
|
|
45
|
+
const switchRoom = async () => {
|
|
46
|
+
if (busy || !name) return;
|
|
47
|
+
setBusy(true);
|
|
48
|
+
try {
|
|
49
|
+
const r = await getPermissions(name);
|
|
50
|
+
if (!r.ok) { toast(ca(r.code === "forbidden" ? "forbidden" : r.code === "unavailable" ? "unavailable" : "loadFailed"), false); return; }
|
|
51
|
+
const p = r.data;
|
|
52
|
+
if (p.canSetMode !== true) { toast(ca("forbidden"), false); return; }
|
|
53
|
+
const ok = await confirmDialog({ title: ca("confirmRestricted"), confirmLabel: ca("suggestSwitch"), message: [ca("modeRestrictedNote"), ca("switchOriginNote"), wouldDisableText(p.roomTools, p.nativeGuard)].join("\n\n") });
|
|
54
|
+
if (!ok) return;
|
|
55
|
+
const w = await putPermissions(name, { revision: p.revision, mode: "restricted" });
|
|
56
|
+
toast(ca(w.ok ? "saved" : w.code === "conflict" ? "stale" : w.code === "forbidden" ? "forbidden" : "saveFailed"), w.ok);
|
|
57
|
+
} finally { setBusy(false); }
|
|
58
|
+
};
|
|
59
|
+
const later = async () => {
|
|
60
|
+
if (busy) return;
|
|
61
|
+
setBusy(true);
|
|
62
|
+
let ok = false;
|
|
63
|
+
try { const r = await fetch("/ui/needs/ack", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ id: item.id }) }); ok = r.ok; } catch { ok = false; }
|
|
64
|
+
setBusy(false);
|
|
65
|
+
if (!ok) toast(ca("saveFailed"), false);
|
|
66
|
+
};
|
|
67
|
+
return html`<div class="n-title"><strong>${ca("suggestTitle")}</strong></div>
|
|
68
|
+
<p class="n-detail">${name}: ${ca("suggestBody")}</p>
|
|
69
|
+
<p class="feedback warning contact-origin-switch">${ca("switchOriginNote")}</p>
|
|
70
|
+
${notCovered(guard) ? html`<p class="feedback warning contact-not-covered">${ca("notCoveredWarning")}</p>` : null}
|
|
71
|
+
<div class="n-actions">
|
|
72
|
+
<button type="button" class="btn btn-sm btn-primary" disabled=${busy} onClick=${() => void switchRoom()}>${ca("suggestSwitch")}</button>
|
|
73
|
+
<a class="btn btn-sm" href=${`${detailsPath(name)}?cat=permissions`}>${ca("suggestView")}</a>
|
|
74
|
+
<button type="button" class="btn btn-sm btn-ghost" disabled=${busy} onClick=${() => void later()}>${ca("suggestLater")}</button>
|
|
75
|
+
</div>`;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/** One contact item of Needs you (item.type "contact"); null for a reason this page doesn't know. */
|
|
79
|
+
export function ContactNeedsItem({ item }) {
|
|
80
|
+
const body = item.reason === "contact_request" ? html`<${RequestNeed} item=${item} />` : item.reason === "contact_restricted_suggestion" ? html`<${SuggestionNeed} item=${item} />` : null;
|
|
81
|
+
if (!body) return null;
|
|
82
|
+
return html`<article data-trust="permission" class="n-item contact-need" data-reason=${item.reason}>
|
|
83
|
+
<span class="n-icon"><${Icon} name="key" size=${18} /></span><div class="n-body">${body}</div></article>`;
|
|
84
|
+
}
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
// M-3339 (A2): an agent page's Permissions (agent-details-settings.js, category "permissions") — on the contact
|
|
2
|
+
// authorization contract (src/contact-auth-types.ts; docs/design/classic-contact-authorizations.md).
|
|
3
|
+
// - A ClassicBot room's page: its mode (restricted, or the older setting), the command-line guard's coverage, and the
|
|
4
|
+
// room's tools (public reading, exact MCP tools; what would stop if a legacy room switched).
|
|
5
|
+
// - A worker's page: who approves requests to it (or the channel admins it inherits), and its allowed contacts.
|
|
6
|
+
// - Both: the history.
|
|
7
|
+
// Its own read and its own saves (PUT with the revision read; a 409 reads again and says so) — never staged with the
|
|
8
|
+
// page's settings Save. The server decides who may see or change anything (canManage / canSetMode); nothing here grants.
|
|
9
|
+
// It reads again on the stream's contact-auth frame for this agent (a newer revision) and when the page is shown again.
|
|
10
|
+
import { html, useEffect, useRef, useState } from "/assets/app-html.js";
|
|
11
|
+
import { appStore } from "/assets/app-store.js";
|
|
12
|
+
import { Icon } from "/assets/ui-icons.js";
|
|
13
|
+
import { toast } from "/assets/ui-toast.js";
|
|
14
|
+
import { Skeleton, ErrorState } from "/assets/ui-states.js";
|
|
15
|
+
import { confirmDialog } from "/assets/ui-confirm.js";
|
|
16
|
+
import { ca } from "./contact-auth-strings.js";
|
|
17
|
+
import { getPermissions, putPermissions, shortTicketId } from "./contact-auth-client.js";
|
|
18
|
+
import { REASONS } from "./contact-authorizations.js";
|
|
19
|
+
|
|
20
|
+
const when = (iso) => { const d = new Date(iso); return Number.isFinite(d.getTime()) ? d.toLocaleString([], { dateStyle: "medium", timeStyle: "short" }) : ""; };
|
|
21
|
+
/** A3's guard reason codes (ContactGuardStatus.reason), each said in words (contact-auth-strings.js guardReason_<code>). */
|
|
22
|
+
const GUARD_REASONS = new Set(["legacy-mode", "unsupported-backend", "unsupported-platform", "unsupported-version", "cli-mode", "load-not-verified", "stale-policy",
|
|
23
|
+
"stale-launch", "not-running", "invalid-policy", "missing-bound-mcp", "missing-selected-mcp", "guard-files-changed", "invalid-load-receipt", "guard-unavailable", "binary-changed"]);
|
|
24
|
+
/**
|
|
25
|
+
* The leader's A3 decision (via Cairn): a restricted room whose AI tool, version, platform or mode the guard doesn't cover
|
|
26
|
+
* keeps running with that tool's normal permissions — only contact approval applies. Said plainly (never "ready", never only in
|
|
27
|
+
* a tooltip), and before the mode is set (the mode card, the switch's confirm, Needs you's suggestion). A missing selected MCP
|
|
28
|
+
* tool is partial coverage (the base guard runs): its own reason says which, not this.
|
|
29
|
+
*/
|
|
30
|
+
export const notCovered = (g) => !!g && g.state === "not-covered" && g.reason !== "missing-selected-mcp";
|
|
31
|
+
const GUARD_TONE = { ready: "ok", "restart-required": "warn", "not-covered": "warn", failed: "bad" };
|
|
32
|
+
/** The guard's state as said — anything the contract doesn't name is never shown as ready. */
|
|
33
|
+
const guardState = (g) => (g && ["ready", "restart-required", "not-covered", "failed"].includes(g.state) ? g.state : "failed");
|
|
34
|
+
const personLabel = (p) => (p && (p.label || p.userId)) || "";
|
|
35
|
+
|
|
36
|
+
/** Keep `name`'s permissions read: once, on its contact-auth frame (a newer revision), and when the page is shown again. */
|
|
37
|
+
export function usePermissions(name) {
|
|
38
|
+
const [state, setState] = useState({ loading: true });
|
|
39
|
+
const rev = useRef(-1);
|
|
40
|
+
const read = async () => {
|
|
41
|
+
const r = await getPermissions(name);
|
|
42
|
+
if (r.ok) { rev.current = r.data.revision; setState({ data: r.data }); } else setState((s) => ({ ...(s.data ? { data: s.data } : {}), error: r.code }));
|
|
43
|
+
return r;
|
|
44
|
+
};
|
|
45
|
+
useEffect(() => {
|
|
46
|
+
let live = true;
|
|
47
|
+
void read().then(() => { if (!live) rev.current = -1; });
|
|
48
|
+
const sub = appStore.get().streamOn;
|
|
49
|
+
const off = typeof sub === "function" ? sub("contact-auth", (d) => { if (d && d.instance === name && !(Number(d.revision) <= rev.current)) void read(); }) : null;
|
|
50
|
+
const onShow = () => { if (document.visibilityState === "visible") void read(); };
|
|
51
|
+
document.addEventListener("visibilitychange", onShow);
|
|
52
|
+
return () => { live = false; if (typeof off === "function") off(); document.removeEventListener("visibilitychange", onShow); };
|
|
53
|
+
}, [name]);
|
|
54
|
+
return { ...state, read, setData: (data) => { rev.current = data.revision; setState({ data }); } };
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* What would stop if this legacy room switched — AgEnD's known removals; when the backend's own inventory couldn't be read
|
|
59
|
+
* (impactComplete false) that is said too, so the list is never taken as everything.
|
|
60
|
+
*/
|
|
61
|
+
function WouldDisable({ tools, complete }) {
|
|
62
|
+
const incomplete = complete === false ? html`<p class="feedback warning contact-impact-incomplete">${ca("impactIncomplete")}</p>` : null;
|
|
63
|
+
return tools && tools.length ? html`<div class="contact-would"><p>${ca("wouldDisableTitle")}</p><ul>${tools.map((n) => html`<li key=${n} class="mono">${n}</li>`)}</ul>${incomplete}</div>`
|
|
64
|
+
: complete === false ? incomplete : html`<p class="note">${ca("wouldDisableNone")}</p>`;
|
|
65
|
+
}
|
|
66
|
+
/** The same, as the confirm's text (paragraphs). */
|
|
67
|
+
export function wouldDisableText(roomTools, guard) {
|
|
68
|
+
const would = roomTools?.wouldDisable || [];
|
|
69
|
+
const parts = [would.length ? [ca("wouldDisableTitle"), ...would.map((n) => `• ${n}`)].join("\n") : roomTools?.impactComplete === false ? "" : ca("wouldDisableNone")];
|
|
70
|
+
if (roomTools?.impactComplete === false) parts.push(ca("impactIncomplete"));
|
|
71
|
+
if (notCovered(guard)) parts.push(ca("notCoveredWarning"));
|
|
72
|
+
return parts.filter(Boolean).join("\n\n");
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export function ContactPermissionsPanel({ name }) {
|
|
76
|
+
const perm = usePermissions(name);
|
|
77
|
+
const [busy, setBusy] = useState(false);
|
|
78
|
+
const [mcpDraft, setMcpDraft] = useState("");
|
|
79
|
+
const [pick, setPick] = useState("");
|
|
80
|
+
const p = perm.data;
|
|
81
|
+
if (!p && perm.loading !== false && !perm.error) return html`<${Skeleton} lines=${5} label=${ca("loading")} />`;
|
|
82
|
+
if (!p) return perm.error === "forbidden" ? html`<p class="note contact-forbidden">${ca("forbidden")}</p>`
|
|
83
|
+
: html`<${ErrorState} message=${ca(perm.error === "unavailable" ? "unavailable" : "loadFailed")} onRetry=${() => void perm.read()} />`;
|
|
84
|
+
// Who may change what (the server says; Sentinel's seam): the source room's admins its mode and tools (canSetMode); the
|
|
85
|
+
// target's approvers its approvers and allowed contacts (canManage).
|
|
86
|
+
const canMode = p.classicRoom && p.canSetMode === true;
|
|
87
|
+
const canManage = p.canManage === true;
|
|
88
|
+
/** One write with the revision read; a refusal says why (a stale one reads again first). */
|
|
89
|
+
const write = async (patch) => {
|
|
90
|
+
if (busy) return false;
|
|
91
|
+
setBusy(true);
|
|
92
|
+
const r = await putPermissions(name, { revision: p.revision, ...patch });
|
|
93
|
+
setBusy(false);
|
|
94
|
+
if (r.ok) { perm.setData(r.data); toast(ca("saved"), true); return true; }
|
|
95
|
+
if (r.code === "conflict") { await perm.read(); toast(ca("stale"), false); return false; }
|
|
96
|
+
toast(ca(r.code === "forbidden" ? "forbidden" : r.code === "unavailable" ? "unavailable" : r.code === "invalid-approver" ? "invalidApprover" : "saveFailed"), false);
|
|
97
|
+
return false;
|
|
98
|
+
};
|
|
99
|
+
const switchMode = async (mode) => {
|
|
100
|
+
const toRestricted = mode === "restricted";
|
|
101
|
+
const ok = await confirmDialog({ title: ca(toRestricted ? "confirmRestricted" : "confirmLegacy"), message: toRestricted
|
|
102
|
+
? [ca("modeRestrictedNote"), ca("switchOriginNote"), wouldDisableText(p.roomTools, p.nativeGuard)].join("\n\n")
|
|
103
|
+
: ca("modeLegacyNote"), confirmLabel: ca(toRestricted ? "switchRestricted" : "switchLegacy"), danger: !toRestricted });
|
|
104
|
+
if (ok) await write({ mode });
|
|
105
|
+
};
|
|
106
|
+
const tools = p.roomTools || { publicRead: false, allowedMcpTools: [], wouldDisable: [] };
|
|
107
|
+
const setTools = (next) => write({ roomTools: { publicRead: next.publicRead, allowedMcpTools: next.allowedMcpTools } });
|
|
108
|
+
const addMcp = async (e) => {
|
|
109
|
+
e.preventDefault();
|
|
110
|
+
const n = mcpDraft.trim();
|
|
111
|
+
if (!n || tools.allowedMcpTools.some((x) => x.name === n)) return;
|
|
112
|
+
if (await setTools({ ...tools, allowedMcpTools: [...tools.allowedMcpTools, { name: n, kind: "mcp", usesOwnerAccount: false }] })) setMcpDraft("");
|
|
113
|
+
};
|
|
114
|
+
const grantsWrite = (rows) => write({ grants: rows.map(({ id, person, source, target, verbs, expiresAt, remainingUses }) => ({ id, person, source, target, verbs, expiresAt, remainingUses })) });
|
|
115
|
+
const g = guardState(p.nativeGuard);
|
|
116
|
+
return html`<div class="contact-perm" aria-busy=${busy ? "true" : undefined}>
|
|
117
|
+
${p.originRestriction?.active && REASONS.has(p.originRestriction.reason) ? html`<p class="feedback warning contact-origin-restriction" role="status" data-reason=${p.originRestriction.reason}>
|
|
118
|
+
${ca(`reason_${p.originRestriction.reason}`)} ${ca("resetNote")}</p>` : null}
|
|
119
|
+
${!canManage && !canMode ? html`<p class="s-info contact-readonly"><span aria-hidden="true">ⓘ</span><span>${ca("readOnly")}</span></p>` : null}
|
|
120
|
+
${p.classicRoom ? html`<section class="card contact-mode" data-mode=${p.mode}>
|
|
121
|
+
<h3>${ca("modeTitle")}</h3>
|
|
122
|
+
${p.suggestRestricted && p.mode !== "restricted" ? html`<p class="feedback warning contact-suggest-banner" role="status">${ca("suggestBanner")}</p>` : null}
|
|
123
|
+
<p class="contact-mode-line"><span class=${`contact-pill ${p.mode === "restricted" ? "ok" : "warn"}`}>${ca(p.mode === "restricted" ? "modeRestricted" : "modeLegacy")}</span></p>
|
|
124
|
+
${p.mode !== "restricted" ? html`<p class="feedback warning contact-origin-switch">${ca("switchOriginNote")}</p>` : null}
|
|
125
|
+
<p class="note">${ca(p.mode === "restricted" ? "modeRestrictedNote" : "modeLegacyNote")}</p>
|
|
126
|
+
${p.mode !== "restricted" ? html`<${WouldDisable} tools=${tools.wouldDisable} complete=${tools.impactComplete} />` : null}
|
|
127
|
+
${notCovered(p.nativeGuard) ? html`<p class="feedback warning contact-not-covered" role="status">${ca("notCoveredWarning")}</p>` : null}
|
|
128
|
+
${canMode ? html`<div class="field-row"><button type="button" class=${`btn btn-sm${p.mode === "restricted" ? "" : " btn-primary"}`} disabled=${busy}
|
|
129
|
+
onClick=${() => switchMode(p.mode === "restricted" ? "legacy" : "restricted")}>${ca(p.mode === "restricted" ? "switchLegacy" : "switchRestricted")}</button></div>` : null}
|
|
130
|
+
</section>
|
|
131
|
+
<section class="card contact-guard" data-guard=${g}>
|
|
132
|
+
<h3>${ca("guardTitle")}</h3>
|
|
133
|
+
<p><span class=${`contact-pill ${GUARD_TONE[g]}`}>${ca(`guard_${g}`)}</span>${p.nativeGuard?.backend ? html` <span class="muted">${ca("guardBackend", p.nativeGuard.version ? `${p.nativeGuard.backend} ${p.nativeGuard.version}` : p.nativeGuard.backend)}</span>` : null}</p>
|
|
134
|
+
${/* A3's reason is a code (Cairn): said in words; one this page doesn't know, generically — never the code itself. */ ""}
|
|
135
|
+
${notCovered(p.nativeGuard) ? html`<p class="feedback warning contact-not-covered">${ca("notCoveredWarning")}</p>` : null}
|
|
136
|
+
${p.nativeGuard?.reason ? html`<p class="note contact-guard-reason">${GUARD_REASONS.has(p.nativeGuard.reason) ? ca(`guardReason_${p.nativeGuard.reason}`) : ca("guardReasonOther")}</p>` : null}
|
|
137
|
+
<p class="note">${ca("guardNote")}</p>
|
|
138
|
+
</section>
|
|
139
|
+
<section class="card contact-tools">
|
|
140
|
+
<h3>${ca("toolsTitle")}</h3>
|
|
141
|
+
<label class="check contact-toggle"><input type="checkbox" checked=${!!tools.publicRead} disabled=${!canMode || busy}
|
|
142
|
+
onChange=${(e) => void setTools({ ...tools, publicRead: e.currentTarget.checked })} /><span>${ca("publicRead")}</span></label>
|
|
143
|
+
<p class="note">${ca("publicReadNote")}</p>
|
|
144
|
+
<h4>${ca("mcpTitle")}</h4>
|
|
145
|
+
${tools.allowedMcpTools.length ? html`<ul class="contact-list">${tools.allowedMcpTools.map((x) => html`<li key=${x.name}>
|
|
146
|
+
<span class="mono">${x.name}</span>${x.kind === "public-read" ? html` <span class="muted">${ca("mcpPublicRead")}</span>` : null}
|
|
147
|
+
${x.usesOwnerAccount ? html`<p class="feedback warning contact-owner-warning"><${Icon} name="alert" size=${14} /><span>${x.accountWarning || ca("mcpOwnerWarning")}</span></p>` : null}
|
|
148
|
+
${canMode ? html`<button type="button" class="icon-btn" aria-label=${ca("mcpRemove", x.name)} title=${ca("mcpRemove", x.name)} disabled=${busy}
|
|
149
|
+
onClick=${() => void setTools({ ...tools, allowedMcpTools: tools.allowedMcpTools.filter((y) => y.name !== x.name) })}><${Icon} name="trash" size=${16} /></button>` : null}</li>`)}</ul>`
|
|
150
|
+
: html`<p class="note">${ca("mcpNone")}</p>`}
|
|
151
|
+
${canMode ? html`<form class="field-row contact-mcp-add" onSubmit=${addMcp}><label class="sr-only" for=${`contact-mcp-${name}`}>${ca("mcpAddLabel")}</label>
|
|
152
|
+
<input id=${`contact-mcp-${name}`} class="input mono" placeholder=${ca("mcpAddLabel")} value=${mcpDraft} onInput=${(e) => setMcpDraft(e.currentTarget.value)} />
|
|
153
|
+
<button type="submit" class="btn btn-sm" disabled=${busy || !mcpDraft.trim()}>${ca("mcpAdd")}</button></form>` : null}
|
|
154
|
+
<p class="note">${ca("offByDefault")}</p>
|
|
155
|
+
</section>` : html`<section class="card contact-approvers">
|
|
156
|
+
<h3>${ca("approversTitle")}</h3>
|
|
157
|
+
${p.approvers.length ? html`<ul class="contact-list">${p.approvers.map((a) => html`<li key=${`${a.platform}:${a.adapterId}:${a.userId}`}><span>${personLabel(a)}</span> <span class="muted">${a.platform}</span>
|
|
158
|
+
${canManage && !p.inheritedApprovers ? html`<button type="button" class="icon-btn" aria-label=${ca("approverRemove", personLabel(a))} title=${ca("approverRemove", personLabel(a))} disabled=${busy}
|
|
159
|
+
onClick=${() => void write({ approvers: p.approvers.filter((x) => x !== a) })}><${Icon} name="trash" size=${16} /></button>` : null}</li>`)}</ul>`
|
|
160
|
+
: html`<p class="feedback warning">${ca("approversNone")}</p>`}
|
|
161
|
+
${p.inheritedApprovers ? html`<p class="note">${ca("approversInherited")}</p>` : canManage ? html`<button type="button" class="btn btn-sm" disabled=${busy} onClick=${() => void write({ approvers: [] })}>${ca("approversReset")}</button>` : null}
|
|
162
|
+
${canManage ? (() => {
|
|
163
|
+
// Slice 1: an approver is one of the server's eligible people (a Fleet admin or the verified host operator) — a
|
|
164
|
+
// pick, never a typed name; the server refuses anyone else (invalid-approver).
|
|
165
|
+
const key = (x) => `${x.platform}:${x.adapterId}:${x.userId}`, have = new Set(p.approvers.map(key));
|
|
166
|
+
const left = (p.eligibleApprovers || []).filter((x) => !have.has(key(x)));
|
|
167
|
+
return left.length ? html`<form class="field-row contact-approver-add" onSubmit=${(e) => { e.preventDefault(); const who = left.find((x) => key(x) === pick); if (who) void write({ approvers: [...p.approvers, who] }).then((ok) => { if (ok) setPick(""); }); }}>
|
|
168
|
+
<label class="sr-only" for=${`contact-approver-${name}`}>${ca("approverPick")}</label>
|
|
169
|
+
<select id=${`contact-approver-${name}`} class="input" value=${pick} disabled=${busy} onChange=${(e) => setPick(e.currentTarget.value)}>
|
|
170
|
+
<option value="">${ca("approverNone")}</option>${left.map((x) => html`<option key=${key(x)} value=${key(x)}>${personLabel(x)} · ${x.platform}</option>`)}</select>
|
|
171
|
+
<button type="submit" class="btn btn-sm" disabled=${busy || !pick}>${ca("approverAdd")}</button></form>` : null;
|
|
172
|
+
})() : null}
|
|
173
|
+
<p class="note">${ca("approverAdmins")}</p>
|
|
174
|
+
</section>
|
|
175
|
+
<section class="card contact-grants">
|
|
176
|
+
<h3>${ca("grantsTitle")}</h3>
|
|
177
|
+
<p class="note">${ca("grantsNote")}</p>
|
|
178
|
+
${p.grants.length ? html`<ul class="contact-list">${p.grants.map((gr) => html`<li key=${gr.id}>
|
|
179
|
+
<div><strong>${personLabel(gr.person)}</strong> <span class="muted">${ca("grantRow", gr.source, gr.target)}</span></div>
|
|
180
|
+
<div class="muted">${ca("grantVerbs", gr.verbs.map((v) => ca(`verb_${v}`)).join(", "))} · ${ca("grantExpires", when(gr.expiresAt))} · ${gr.remainingUses == null ? ca("grantUnlimited") : ca("grantUses", gr.remainingUses)}</div>
|
|
181
|
+
${canManage ? html`<button type="button" class="btn btn-sm btn-ghost" disabled=${busy} onClick=${async () => {
|
|
182
|
+
if (await confirmDialog({ message: ca("grantRemoveConfirm"), confirmLabel: ca("grantRemove"), danger: true })) void grantsWrite(p.grants.filter((x) => x.id !== gr.id));
|
|
183
|
+
}}>${ca("grantRemove")}</button>` : null}</li>`)}</ul>` : html`<p class="note">${ca("grantsNone")}</p>`}
|
|
184
|
+
</section>`}
|
|
185
|
+
<section class="card contact-history">
|
|
186
|
+
<h3>${ca("historyTitle")}</h3>
|
|
187
|
+
${p.history.length ? html`<ul class="contact-list contact-history-list">${p.history.map((h) => html`<li key=${h.id}>
|
|
188
|
+
<span class="mono muted">${when(h.at)}</span> <strong>${ca(`action_${h.action}`)}</strong> <span>${personLabel(h.actor)}</span>
|
|
189
|
+
${h.ticketId ? html` <a href=${`/ui/fleet/authorizations?ticket=${encodeURIComponent(h.ticketId)}`} title=${h.ticketId}>#${shortTicketId(h.ticketId)}</a>` : null}
|
|
190
|
+
${h.summary ? html`<div class="muted">${h.summary}</div>` : null}</li>`)}</ul>` : html`<p class="note">${ca("historyNone")}</p>`}
|
|
191
|
+
</section>
|
|
192
|
+
</div>`;
|
|
193
|
+
}
|