@songsid/agend 2.4.0-beta.14 → 2.4.0-beta.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/accounts-profiles.d.ts +1 -1
- package/dist/accounts-view.d.ts +3 -0
- package/dist/accounts-view.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 +6 -1
- package/dist/backend/claude-code.js +63 -8
- package/dist/backend/claude-code.js.map +1 -1
- package/dist/backend/kiro.js +6 -1
- package/dist/backend/kiro.js.map +1 -1
- package/dist/backend/types.d.ts +2 -0
- package/dist/backend/types.js.map +1 -1
- package/dist/backend-command.d.ts +4 -2
- package/dist/backend-command.js +3 -0
- package/dist/backend-command.js.map +1 -1
- package/dist/browser-backend-signins.d.ts +1 -0
- package/dist/browser-backend-signins.js +3 -1
- package/dist/browser-backend-signins.js.map +1 -1
- package/dist/build-provenance.json +1 -1
- package/dist/classic-channel-manager.d.ts +1 -0
- package/dist/classic-channel-manager.js +4 -1
- package/dist/classic-channel-manager.js.map +1 -1
- package/dist/claude-credential-change.d.ts +22 -0
- package/dist/claude-credential-change.js +47 -0
- package/dist/claude-credential-change.js.map +1 -0
- package/dist/claude-credential-launch.d.ts +62 -0
- package/dist/claude-credential-launch.js +304 -0
- package/dist/claude-credential-launch.js.map +1 -0
- package/dist/claude-credential-runner.d.ts +1 -0
- package/dist/claude-credential-runner.js +56 -0
- package/dist/claude-credential-runner.js.map +1 -0
- package/dist/claude-credential-vault.d.ts +51 -0
- package/dist/claude-credential-vault.js +252 -0
- package/dist/claude-credential-vault.js.map +1 -0
- package/dist/claude-setup-token-transport.d.ts +9 -0
- package/dist/claude-setup-token-transport.js +82 -0
- package/dist/claude-setup-token-transport.js.map +1 -0
- package/dist/claude-setup-token.d.ts +51 -0
- package/dist/claude-setup-token.js +83 -0
- package/dist/claude-setup-token.js.map +1 -0
- package/dist/cli-audited.js +7 -6
- package/dist/cli-audited.js.map +1 -1
- package/dist/command-report.d.ts +11 -0
- package/dist/command-report.js +2 -0
- package/dist/command-report.js.map +1 -0
- package/dist/config-validator.js +9 -0
- package/dist/config-validator.js.map +1 -1
- package/dist/config.js +4 -2
- package/dist/config.js.map +1 -1
- package/dist/contact-auth-api.d.ts +2 -1
- package/dist/contact-auth-api.js +15 -5
- package/dist/contact-auth-api.js.map +1 -1
- package/dist/contact-auth-policy.d.ts +5 -0
- package/dist/contact-auth-policy.js +2 -0
- package/dist/contact-auth-policy.js.map +1 -1
- package/dist/contact-auth-store.d.ts +12 -1
- package/dist/contact-auth-store.js +67 -5
- package/dist/contact-auth-store.js.map +1 -1
- package/dist/contact-auth-types.d.ts +27 -1
- package/dist/contact-auth-types.js.map +1 -1
- package/dist/daemon.d.ts +5 -0
- package/dist/daemon.js +59 -3
- package/dist/daemon.js.map +1 -1
- package/dist/fleet-level-config.d.ts +1 -1
- package/dist/fleet-level-config.js +1 -0
- package/dist/fleet-level-config.js.map +1 -1
- package/dist/fleet-manager.d.ts +48 -3
- package/dist/fleet-manager.js +446 -27
- package/dist/fleet-manager.js.map +1 -1
- package/dist/general-knowledge/skills/cross-instance-messaging/SKILL.md +16 -6
- package/dist/general-knowledge/skills/web-appearance/SKILL.md +4 -1
- package/dist/general-knowledge/skills/web-dashboard/SKILL.md +23 -5
- package/dist/host-monitoring-config.d.ts +14 -0
- package/dist/host-monitoring-config.js +31 -0
- package/dist/host-monitoring-config.js.map +1 -0
- package/dist/hub/group-policy/resources.d.ts +1 -1
- package/dist/instance-config-impact.js +1 -1
- package/dist/instance-config-impact.js.map +1 -1
- package/dist/instructions.js +1 -0
- package/dist/instructions.js.map +1 -1
- package/dist/locale.d.ts +2 -0
- package/dist/locale.js +19 -1
- package/dist/locale.js.map +1 -1
- package/dist/needs-you-hub.js +3 -0
- package/dist/needs-you-hub.js.map +1 -1
- package/dist/needs-you.d.ts +2 -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/profile-signins.d.ts +1 -0
- package/dist/profile-signins.js +3 -1
- package/dist/profile-signins.js.map +1 -1
- package/dist/public-web-gateway.js +2 -0
- package/dist/public-web-gateway.js.map +1 -1
- package/dist/public-web-link.d.ts +21 -2
- package/dist/public-web-link.js +22 -2
- package/dist/public-web-link.js.map +1 -1
- package/dist/settings-api.d.ts +12 -0
- package/dist/settings-api.js +146 -7
- package/dist/settings-api.js.map +1 -1
- package/dist/settings-change.js +2 -0
- package/dist/settings-change.js.map +1 -1
- package/dist/settings-effect.js +13 -1
- package/dist/settings-effect.js.map +1 -1
- package/dist/topic-commands.d.ts +7 -1
- package/dist/topic-commands.js +98 -88
- package/dist/topic-commands.js.map +1 -1
- package/dist/types.d.ts +2 -0
- package/dist/ui/accounts-view.js +12 -6
- package/dist/ui/backend-signin.js +3 -1
- package/dist/ui/chat-commands.js +2 -0
- package/dist/ui/chat-popout-transport.js +49 -19
- package/dist/ui/chat-popout.js +15 -1
- package/dist/ui/chat-store.js +1 -1
- package/dist/ui/claude-credentials.js +112 -0
- package/dist/ui/claude-setup-token.js +36 -0
- package/dist/ui/contact-auth-client.js +9 -2
- package/dist/ui/contact-auth-strings.js +78 -16
- package/dist/ui/contact-authorizations.js +47 -26
- package/dist/ui/contact-needs.js +22 -6
- package/dist/ui/contact-permissions.js +55 -10
- package/dist/ui/contact-tool-groups.js +39 -0
- package/dist/ui/fleet-canvas.js +3 -2
- package/dist/ui/fleet-office-card.js +414 -41
- package/dist/ui/fleet-office-dialogue.js +3 -3
- package/dist/ui/fleet-office-pack.d.ts +67 -1
- package/dist/ui/fleet-office-pack.js +412 -18
- package/dist/ui/fleet-office-play.js +262 -3
- package/dist/ui/fleet-office-skin.js +67 -20
- package/dist/ui/fleet-office-zones.js +19 -1
- package/dist/ui/fleet-office.js +393 -47
- package/dist/ui/office-share-page.js +5 -1
- package/dist/ui/panel-chat.js +47 -3
- package/dist/ui/panel-fleet.js +1 -1
- package/dist/ui/panel-needs.js +7 -4
- package/dist/ui/panel-settings.js +2 -1
- package/dist/ui/preview-popout.js +134 -0
- package/dist/ui/reply-file-preview.js +1 -1
- package/dist/ui/settings-appearance.js +6 -1
- package/dist/ui/settings-host-monitoring.js +51 -0
- package/dist/ui/settings-registry.js +1 -1
- package/dist/ui/settings-shared.js +3 -2
- package/dist/ui/shared/app-i18n.js +4 -0
- package/dist/ui/shared/app-shell.js +16 -7
- package/dist/ui/shared/app.css +266 -27
- package/dist/ui/shared/app.js +7 -1
- package/dist/ui/shared/chat-strings.js +8 -2
- package/dist/ui/shared/info-tip.js +64 -0
- package/dist/ui/shared/office-dialogue.css +12 -0
- package/dist/ui/shared/preview-panel.js +44 -18
- package/dist/ui/shared/preview-popout.css +11 -0
- package/dist/ui/shared/theme-picker.js +46 -0
- package/dist/ui/shared/theme.js +47 -4
- package/dist/ui/shared/tokens.css +273 -0
- package/dist/ui/shared/ui-confirm.js +5 -2
- package/dist/ui/shared/usage-dialog.js +9 -34
- package/dist/ui/shared/view-strings.js +2 -0
- package/dist/usage/i18n-keys.d.ts +1 -1
- package/dist/usage/i18n-keys.js +1 -1
- package/dist/usage/i18n-keys.js.map +1 -1
- package/dist/usage/providers.d.ts +1 -0
- package/dist/usage/providers.js +14 -1
- package/dist/usage/providers.js.map +1 -1
- package/dist/usage/usage-api.js +5 -2
- package/dist/usage/usage-api.js.map +1 -1
- package/dist/web-api.d.ts +5 -1
- package/dist/web-api.js +29 -9
- package/dist/web-api.js.map +1 -1
- package/dist/web-claude-credentials.d.ts +31 -0
- package/dist/web-claude-credentials.js +138 -0
- package/dist/web-claude-credentials.js.map +1 -0
- package/dist/web-commands.d.ts +5 -2
- package/dist/web-commands.js +4 -2
- package/dist/web-commands.js.map +1 -1
- package/dist/web-office-skins.d.ts +7 -2
- package/dist/web-office-skins.js +42 -16
- package/dist/web-office-skins.js.map +1 -1
- package/dist/web-session.d.ts +20 -1
- package/dist/web-session.js +27 -0
- package/dist/web-session.js.map +1 -1
- package/dist/web-terminal.d.ts +4 -0
- package/dist/web-terminal.js +16 -1
- package/dist/web-terminal.js.map +1 -1
- package/package.json +1 -1
|
@@ -12,6 +12,8 @@ import { register } from "/assets/app-i18n.js";
|
|
|
12
12
|
import { appStore, useStore } from "/assets/app-store.js";
|
|
13
13
|
import { toast } from "/assets/ui-toast.js";
|
|
14
14
|
import { Skeleton, ErrorState, Empty } from "/assets/ui-states.js";
|
|
15
|
+
import { labelOf } from "/assets/instance-nav.js";
|
|
16
|
+
import { InfoTip } from "/assets/info-tip.js";
|
|
15
17
|
import { ca } from "./contact-auth-strings.js";
|
|
16
18
|
import { decideTicket, getTicket, listTickets, personKey, shortTicketId } from "./contact-auth-client.js";
|
|
17
19
|
|
|
@@ -25,6 +27,8 @@ const TONE = { pending: "warn", approved: "ok", delivered: "ok", declined: "bad"
|
|
|
25
27
|
const stateOf = (s) => (Object.prototype.hasOwnProperty.call(TONE, s) ? s : "unknown");
|
|
26
28
|
const label = (p) => (p && (p.label || p.userId)) || "";
|
|
27
29
|
/** datetime-local's value for a time `days` from now (the browser's own zone). */
|
|
30
|
+
/** M-3385: how long a request waits for a decision (its expiry from when it was asked), in whole minutes; 0 if unknown. */
|
|
31
|
+
const waitMinutes = (tk) => { const ms = Date.parse(tk.expiresAt) - Date.parse(tk.createdAt); return Number.isFinite(ms) && ms > 0 ? Math.round(ms / 60_000) : 0; };
|
|
28
32
|
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
33
|
|
|
30
34
|
/** One request: what it is, who asked, and — for its approver, while it waits — the decision. */
|
|
@@ -33,11 +37,14 @@ export function TicketCard({ ticket, onChange, onPerson, focus = false }) {
|
|
|
33
37
|
const [allow, setAllow] = useState(false);
|
|
34
38
|
const [until, setUntil] = useState(() => localIn(7));
|
|
35
39
|
const [uses, setUses] = useState("");
|
|
40
|
+
const { instances } = useStore(appStore);
|
|
41
|
+
const agentLabel = (name) => labelOf((instances || []).find((i) => i.name === name) || { name });
|
|
42
|
+
const personLabel = label;
|
|
36
43
|
const tk = ticket, st = stateOf(tk.state);
|
|
37
44
|
const decide = async (decision) => {
|
|
38
45
|
if (busy) return;
|
|
39
46
|
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;
|
|
47
|
+
const grant = decision === "approve-once" && allow && until && tk.origin?.kind === "human" && (tk.origin?.people || []).length === 1 ? { expiresAt: new Date(until).toISOString(), remainingUses: Number.isFinite(n) ? n : null } : undefined;
|
|
41
48
|
setBusy(true);
|
|
42
49
|
const r = await decideTicket(tk.id, { revision: tk.revision, decision, ...(grant ? { grant } : {}) });
|
|
43
50
|
setBusy(false);
|
|
@@ -51,27 +58,41 @@ export function TicketCard({ ticket, onChange, onPerson, focus = false }) {
|
|
|
51
58
|
toast(ca(r.code === "forbidden" ? "forbidden" : r.code === "unavailable" ? "unavailable" : "decideFailed"), false);
|
|
52
59
|
};
|
|
53
60
|
const people = tk.origin?.people || [];
|
|
61
|
+
const grantable = tk.origin?.kind === "human" && people.length === 1;
|
|
62
|
+
// M-3385: when it was decided; or, while it waits, how long it waits and that nothing is forwarded after that.
|
|
63
|
+
const endsText = tk.decidedAt ? ca("decided", when(tk.decidedAt), personLabel(tk.decidedBy))
|
|
64
|
+
: st === "pending" && waitMinutes(tk) ? ca("expiresPending", when(tk.expiresAt), waitMinutes(tk)) : ca("expires", when(tk.expiresAt));
|
|
54
65
|
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
|
|
57
|
-
<span class="
|
|
58
|
-
<
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
${
|
|
66
|
-
|
|
66
|
+
return html`<article class=${`card contact-ticket${st === "pending" || focus ? " lbar" : ""}${focus ? " focus" : ""}`} data-ticket=${tk.id} data-state=${st}>
|
|
67
|
+
<div class="contact-ticket-head"><strong>${ca("ticketTitle")}</strong><code class="contact-ticket-id" title=${tk.id}>#${shortTicketId(tk.id)}</code>
|
|
68
|
+
<span class="tag contact-ticket-verb">${ca(`verb_${tk.verb}`)}</span><span class=${`tag contact-ticket-state${TONE[st] === "warn" ? " warn" : TONE[st] === "ok" ? " s-state ok" : TONE[st] === "bad" ? " s-state bad" : ""}`}>${ca(`state_${st}`)}</span></div>
|
|
69
|
+
<div class="contact-ticket-meta">
|
|
70
|
+
<div class="contact-ticket-route"><span>${ca("from", "")}</span><span class="contact-agent-chip" title=${tk.source}>${agentLabel(tk.source)}</span>
|
|
71
|
+
<span>→ ${ca("to", "")}</span><span class="contact-agent-chip" title=${tk.target}>${agentLabel(tk.target)}</span></div>
|
|
72
|
+
<div class="contact-ticket-origin">${people.map((p) => html`<button type="button" class="link-btn" title=${ca("filterPerson", personLabel(p))}
|
|
73
|
+
onClick=${() => onPerson?.(p)}>${personLabel(p)}</button>`)}${originText ? html`<span class="tag warn">${originText}</span>` : null}
|
|
74
|
+
${tk.origin?.chain?.length ? html`<span class="contact-hop-chain"><span>${ca("via", "")}</span>${tk.origin.chain.map((name, i) => html`${i ? html`<span aria-hidden="true">→</span>` : null}<span class="contact-hop" title=${name}>${agentLabel(name)}</span>`)}</span>` : null}</div>
|
|
75
|
+
</div>
|
|
76
|
+
${tk.message ? html`<div class="contact-ticket-message-box"><p class="contact-ticket-label">${ca("messageLabel")}</p><pre class="contact-ticket-message">${tk.message}</pre></div>` : null}
|
|
77
|
+
<div class="contact-ticket-foot">
|
|
78
|
+
<div class="contact-ticket-times"><span class="contact-time-item" title=${ca("created", when(tk.createdAt))}>${ca("created", when(tk.createdAt))}</span>
|
|
79
|
+
<span class=${`contact-time-item${!tk.decidedAt && st === "pending" && waitMinutes(tk) ? " contact-time-wait" : ""}`} title=${endsText}>${endsText}</span></div>
|
|
80
|
+
${st === "delivered" ? html`<p class="note">${ca("deliveryNote")}</p>` : null}
|
|
81
|
+
${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}
|
|
82
|
+
</div>
|
|
67
83
|
${tk.canDecide && st === "pending" ? html`<div class="contact-decide">
|
|
68
|
-
|
|
69
|
-
<
|
|
70
|
-
${allow ? html`<div class="field-row contact-allow">
|
|
84
|
+
${/* M-3385 (the user, 11-20: easy to read but too long): one short visible line; what an approval means onward is in its ⓘ. */ ""}
|
|
85
|
+
<p class="note contact-decided-note">${ca("decidedNote")} <${InfoTip} text=${ca("decidedNoteMore")} label=${ca("decidedNoteAbout")} /></p>
|
|
86
|
+
${allow && grantable ? html`<div class="field-row contact-allow">
|
|
71
87
|
<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
88
|
<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="
|
|
74
|
-
<button type="button" class="btn btn-sm" disabled=${busy} onClick=${() => void decide("decline")}>${ca("decline")}</button
|
|
89
|
+
<div class="contact-decide-controls"><button type="button" class="btn btn-sm btn-primary" disabled=${busy} onClick=${() => void decide("approve-once")}>${ca("approveOnce")}</button>
|
|
90
|
+
<button type="button" class="btn btn-sm danger" disabled=${busy} onClick=${() => void decide("decline")}>${ca("decline")}</button>
|
|
91
|
+
${/* M-3385: a standing grant is one person's — offered only for a request from exactly one person (the server refuses
|
|
92
|
+
any other: invalid-grant-origin), and said in full: who, what kind, from where to where; where it lives under the row. */ ""}
|
|
93
|
+
${grantable ? html`<span class="contact-toggle-pair"><label class="check contact-toggle"><input type="checkbox" checked=${allow} disabled=${busy} onChange=${(e) => setAllow(e.currentTarget.checked)} />
|
|
94
|
+
<span>${ca("alsoAllow")}</span></label><${InfoTip} cls="contact-allow-info" text=${ca("alsoAllowMore", personLabel(people[0]), ca(`verb_${tk.verb}`), agentLabel(tk.source), agentLabel(tk.target))}
|
|
95
|
+
label=${ca("alsoAllowAbout")} /></span>` : null}</div>
|
|
75
96
|
</div>` : null}
|
|
76
97
|
</article>`;
|
|
77
98
|
}
|
|
@@ -107,18 +128,18 @@ export function ContactAuthorizations() {
|
|
|
107
128
|
const names = (instances || []).map((i) => i.name).filter(Boolean).sort();
|
|
108
129
|
const list = page.items.filter((x) => !focus || x.id !== focus.id);
|
|
109
130
|
return html`<div class="contact-auth-page">
|
|
110
|
-
<p class="
|
|
111
|
-
<div class="
|
|
112
|
-
<div class="seg" role="group" aria-label=${ca("filterStatus")}>${["pending", "all"].map((s) => html`<button key=${s} type="button" class=${`
|
|
131
|
+
<p class="s-page-lead">${ca("pageLead")}</p>
|
|
132
|
+
<div class="us-bar-top contact-filters">
|
|
133
|
+
<div class="seg-inline" role="group" aria-label=${ca("filterStatus")}>${["pending", "all"].map((s) => html`<button key=${s} type="button" class=${`btn btn-sm${status === s ? " btn-primary" : ""}`}
|
|
113
134
|
aria-pressed=${status === s ? "true" : "false"} onClick=${() => setStatus(s)}>${ca(`filter_${s}`)}</button>`)}</div>
|
|
114
|
-
<label class="
|
|
115
|
-
<option value="">${ca("filterAny")}</option>${names.map((n) => html`<option key=${n} value=${n}>${n}</option>`)}</select></label>
|
|
116
|
-
${person ? html`<
|
|
135
|
+
<label class="us-group contact-agent-filter"><span>${ca("filterAgent")}</span><select value=${agent} onChange=${(e) => setAgent(e.currentTarget.value)}>
|
|
136
|
+
<option value="">${ca("filterAny")}</option>${names.map((n) => html`<option key=${n} value=${n}>${labelOf((instances || []).find((i) => i.name === n))}</option>`)}</select></label>
|
|
137
|
+
${person ? html`<span class="chip contact-person-filter"><span>${ca("filterPerson", label(person))}</span><button type="button" class="chip-x" aria-label=${ca("filterPersonClear")} title=${ca("filterPersonClear")} onClick=${() => setPerson(null)}>×</button></span>` : null}
|
|
117
138
|
</div>
|
|
118
139
|
${focus ? html`<${TicketCard} ticket=${focus} focus=${true} onChange=${replace} onPerson=${setPerson} />` : null}
|
|
119
|
-
${page.loading ? html`<${Skeleton} lines=${
|
|
140
|
+
${page.loading ? html`<${Skeleton} variant="cards" lines=${2} label=${ca("loading")} />`
|
|
120
141
|
: 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")} />`
|
|
142
|
+
: !list.length && !focus ? html`<${Empty} icon="key" title=${ca(status === "pending" ? "emptyPending" : "empty")} hint=${ca("emptyHint")} action=${status === "pending" ? html`<button type="button" class="btn btn-sm" onClick=${() => setStatus("all")}>${ca("viewAll")}</button>` : null} />`
|
|
122
143
|
: html`<div class="contact-ticket-list">${list.map((tk) => html`<${TicketCard} key=${tk.id} ticket=${tk} onChange=${replace} onPerson=${setPerson} />`)}</div>`}
|
|
123
144
|
${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
145
|
</div>`;
|
package/dist/ui/contact-needs.js
CHANGED
|
@@ -13,9 +13,9 @@ import { Icon } from "/assets/ui-icons.js";
|
|
|
13
13
|
import { toast } from "/assets/ui-toast.js";
|
|
14
14
|
import { confirmDialog } from "/assets/ui-confirm.js";
|
|
15
15
|
import { ca } from "./contact-auth-strings.js";
|
|
16
|
-
import { getPermissions, getTicket, putPermissions } from "./contact-auth-client.js";
|
|
16
|
+
import { getPermissions, getTicket, putPermissions, dismissSuggestion } from "./contact-auth-client.js";
|
|
17
17
|
import { TicketCard } from "./contact-authorizations.js";
|
|
18
|
-
import { notCovered, wouldDisableText } from "./contact-permissions.js";
|
|
18
|
+
import { notCovered, wouldDisableMore, wouldDisableText } from "./contact-permissions.js";
|
|
19
19
|
|
|
20
20
|
const ID = /^[A-Za-z0-9_-]{1,64}$/;
|
|
21
21
|
|
|
@@ -50,7 +50,7 @@ function SuggestionNeed({ item }) {
|
|
|
50
50
|
if (!r.ok) { toast(ca(r.code === "forbidden" ? "forbidden" : r.code === "unavailable" ? "unavailable" : "loadFailed"), false); return; }
|
|
51
51
|
const p = r.data;
|
|
52
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") });
|
|
53
|
+
const ok = await confirmDialog({ title: ca("confirmRestricted"), confirmLabel: ca("suggestSwitch"), message: [ca("modeRestrictedNote"), ca("switchOriginNote"), wouldDisableText(p.roomTools, p.nativeGuard)].join("\n\n"), more: wouldDisableMore(p.roomTools) });
|
|
54
54
|
if (!ok) return;
|
|
55
55
|
const w = await putPermissions(name, { revision: p.revision, mode: "restricted" });
|
|
56
56
|
toast(ca(w.ok ? "saved" : w.code === "conflict" ? "stale" : w.code === "forbidden" ? "forbidden" : "saveFailed"), w.ok);
|
|
@@ -59,10 +59,10 @@ function SuggestionNeed({ item }) {
|
|
|
59
59
|
const later = async () => {
|
|
60
60
|
if (busy) return;
|
|
61
61
|
setBusy(true);
|
|
62
|
-
|
|
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; }
|
|
62
|
+
const r = await dismissSuggestion(item.id);
|
|
64
63
|
setBusy(false);
|
|
65
|
-
if (!ok) toast(ca("
|
|
64
|
+
if (!r.ok) toast(ca(r.status === 401 ? "laterSignedOut" : r.code === "csrf" || r.code === "cross-site" ? "laterRefresh" : r.code === "verification-required" ? "laterVerify"
|
|
65
|
+
: r.code === "forbidden" ? "laterForbidden" : r.code === "missing" ? "laterMissing" : r.status === 0 ? "laterNetwork" : "laterUnavailable"), false, { detail: true });
|
|
66
66
|
};
|
|
67
67
|
return html`<div class="n-title"><strong>${ca("suggestTitle")}</strong></div>
|
|
68
68
|
<p class="n-detail">${name}: ${ca("suggestBody")}</p>
|
|
@@ -75,6 +75,22 @@ function SuggestionNeed({ item }) {
|
|
|
75
75
|
</div>`;
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
+
/** M-3381: a Needs you item that is a room's restricted-mode suggestion. */
|
|
79
|
+
export const isRestrictedSuggestion = (item) => item?.type === "contact" && item.reason === "contact_restricted_suggestion";
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* M-3381 (the user, beta.14: one row per existing room flooded the list): every room's restricted-mode suggestion in ONE
|
|
83
|
+
* low-key group, closed until opened — "N existing ClassicBot rooms can switch to restricted mode" — each room's card
|
|
84
|
+
* (switch / preview / later) inside it.
|
|
85
|
+
*/
|
|
86
|
+
export function ContactSuggestionsGroup({ items }) {
|
|
87
|
+
if (!items?.length) return null;
|
|
88
|
+
return html`<details class="n-group n-suggestions" data-trust="permission">
|
|
89
|
+
<summary class="n-group-head">${ca("suggestGroup", items.length)}</summary>
|
|
90
|
+
${items.map((item) => html`<${ContactNeedsItem} key=${item.id} item=${item} />`)}
|
|
91
|
+
</details>`;
|
|
92
|
+
}
|
|
93
|
+
|
|
78
94
|
/** One contact item of Needs you (item.type "contact"); null for a reason this page doesn't know. */
|
|
79
95
|
export function ContactNeedsItem({ item }) {
|
|
80
96
|
const body = item.reason === "contact_request" ? html`<${RequestNeed} item=${item} />` : item.reason === "contact_restricted_suggestion" ? html`<${SuggestionNeed} item=${item} />` : null;
|
|
@@ -14,8 +14,9 @@ import { toast } from "/assets/ui-toast.js";
|
|
|
14
14
|
import { Skeleton, ErrorState } from "/assets/ui-states.js";
|
|
15
15
|
import { confirmDialog } from "/assets/ui-confirm.js";
|
|
16
16
|
import { ca } from "./contact-auth-strings.js";
|
|
17
|
-
import { getPermissions, putPermissions, shortTicketId } from "./contact-auth-client.js";
|
|
17
|
+
import { getPermissions, putPermissions, clearOrigin, shortTicketId } from "./contact-auth-client.js";
|
|
18
18
|
import { REASONS } from "./contact-authorizations.js";
|
|
19
|
+
import { groupWouldDisable } from "./contact-tool-groups.js";
|
|
19
20
|
|
|
20
21
|
const when = (iso) => { const d = new Date(iso); return Number.isFinite(d.getTime()) ? d.toLocaleString([], { dateStyle: "medium", timeStyle: "short" }) : ""; };
|
|
21
22
|
/** A3's guard reason codes (ContactGuardStatus.reason), each said in words (contact-auth-strings.js guardReason_<code>). */
|
|
@@ -37,40 +38,59 @@ const personLabel = (p) => (p && (p.label || p.userId)) || "";
|
|
|
37
38
|
export function usePermissions(name) {
|
|
38
39
|
const [state, setState] = useState({ loading: true });
|
|
39
40
|
const rev = useRef(-1);
|
|
41
|
+
const originRev = useRef(-1);
|
|
40
42
|
const read = async () => {
|
|
41
43
|
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 }));
|
|
44
|
+
if (r.ok) { rev.current = r.data.revision; originRev.current = r.data.originState?.revision ?? -1; setState({ data: r.data }); } else setState((s) => ({ ...(s.data ? { data: s.data } : {}), error: r.code }));
|
|
43
45
|
return r;
|
|
44
46
|
};
|
|
45
47
|
useEffect(() => {
|
|
46
48
|
let live = true;
|
|
47
49
|
void read().then(() => { if (!live) rev.current = -1; });
|
|
48
50
|
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;
|
|
51
|
+
const off = typeof sub === "function" ? sub("contact-auth", (d) => { if (d && d.instance === name && (!(Number(d.revision) <= rev.current) || Number(d.originRevision) > originRev.current)) void read(); }) : null;
|
|
52
|
+
const offMessage = typeof sub === "function" ? sub("message", (d) => { if (d?.instance === name) void read(); }) : null;
|
|
50
53
|
const onShow = () => { if (document.visibilityState === "visible") void read(); };
|
|
51
54
|
document.addEventListener("visibilitychange", onShow);
|
|
52
|
-
return () => { live = false; if (typeof off === "function") off(); document.removeEventListener("visibilitychange", onShow); };
|
|
55
|
+
return () => { live = false; if (typeof off === "function") off(); if (typeof offMessage === "function") offMessage(); document.removeEventListener("visibilitychange", onShow); };
|
|
53
56
|
}, [name]);
|
|
54
|
-
return { ...state, read, setData: (data) => { rev.current = data.revision; setState({ data }); } };
|
|
57
|
+
return { ...state, read, setData: (data) => { rev.current = data.revision; originRev.current = data.originState?.revision ?? -1; setState({ data }); } };
|
|
55
58
|
}
|
|
56
59
|
|
|
57
60
|
/**
|
|
58
61
|
* What would stop if this legacy room switched — AgEnD's known removals; when the backend's own inventory couldn't be read
|
|
59
62
|
* (impactComplete false) that is said too, so the list is never taken as everything.
|
|
63
|
+
* M-3387: by kind with counts (contact-tool-groups.js), the AI tool's own tools on their own line, the two layers said, and
|
|
64
|
+
* every name behind "show all".
|
|
60
65
|
*/
|
|
61
66
|
function WouldDisable({ tools, complete }) {
|
|
62
67
|
const incomplete = complete === false ? html`<p class="feedback warning contact-impact-incomplete">${ca("impactIncomplete")}</p>` : null;
|
|
63
|
-
|
|
64
|
-
|
|
68
|
+
if (!tools || !tools.length) return complete === false ? incomplete : html`<p class="note">${ca("wouldDisableNone")}</p>`;
|
|
69
|
+
const { groups, cli, agendCount } = groupWouldDisable(tools);
|
|
70
|
+
return html`<div class="contact-would">
|
|
71
|
+
${agendCount ? html`<p>${ca("toolsLostTitle", agendCount)}</p><ul class="contact-would-groups">${groups.map((g) => html`<li key=${g.id} data-group=${g.id}>${ca("toolGroupLine", ca(`toolGroup_${g.id}`), g.tools.length)}</li>`)}</ul>` : null}
|
|
72
|
+
${cli.length ? html`<p class="contact-would-cli">${ca("cliToolsLine", cli.length, cli.join(", "))}</p>` : null}
|
|
73
|
+
<p class="note contact-would-layers">${ca("toolLayers")}</p>
|
|
74
|
+
<details class="contact-would-all"><summary>${ca("showAllTools", tools.length)}</summary><ul>${tools.map((n) => html`<li key=${n} class="mono">${n}</li>`)}</ul></details>
|
|
75
|
+
${incomplete}</div>`;
|
|
65
76
|
}
|
|
66
|
-
/** The same, as the confirm's text (paragraphs). */
|
|
77
|
+
/** The same, as the confirm's text (paragraphs): the kinds with counts, the AI tool's own tools, the two layers. */
|
|
67
78
|
export function wouldDisableText(roomTools, guard) {
|
|
68
79
|
const would = roomTools?.wouldDisable || [];
|
|
69
|
-
const
|
|
80
|
+
const { groups, cli, agendCount } = groupWouldDisable(would);
|
|
81
|
+
const parts = [would.length ? "" : roomTools?.impactComplete === false ? "" : ca("wouldDisableNone")];
|
|
82
|
+
if (agendCount) parts.push([ca("toolsLostTitle", agendCount), ...groups.map((g) => ca("toolGroupLine", ca(`toolGroup_${g.id}`), g.tools.length))].join("\n"));
|
|
83
|
+
if (cli.length) parts.push(ca("cliToolsLine", cli.length, cli.join(", ")));
|
|
84
|
+
if (would.length) parts.push(ca("toolLayers"));
|
|
70
85
|
if (roomTools?.impactComplete === false) parts.push(ca("impactIncomplete"));
|
|
71
86
|
if (notCovered(guard)) parts.push(ca("notCoveredWarning"));
|
|
72
87
|
return parts.filter(Boolean).join("\n\n");
|
|
73
88
|
}
|
|
89
|
+
/** M-3387: the confirm's "show all": every name that would stop, or null when none. */
|
|
90
|
+
export function wouldDisableMore(roomTools) {
|
|
91
|
+
const would = roomTools?.wouldDisable || [];
|
|
92
|
+
return would.length ? { label: ca("showAllTools", would.length), lines: would } : null;
|
|
93
|
+
}
|
|
74
94
|
|
|
75
95
|
export function ContactPermissionsPanel({ name }) {
|
|
76
96
|
const perm = usePermissions(name);
|
|
@@ -100,9 +120,22 @@ export function ContactPermissionsPanel({ name }) {
|
|
|
100
120
|
const toRestricted = mode === "restricted";
|
|
101
121
|
const ok = await confirmDialog({ title: ca(toRestricted ? "confirmRestricted" : "confirmLegacy"), message: toRestricted
|
|
102
122
|
? [ca("modeRestrictedNote"), ca("switchOriginNote"), wouldDisableText(p.roomTools, p.nativeGuard)].join("\n\n")
|
|
103
|
-
: ca("modeLegacyNote"),
|
|
123
|
+
: ca("modeLegacyNote"), ...(toRestricted ? { more: wouldDisableMore(p.roomTools) } : {}),
|
|
124
|
+
confirmLabel: ca(toRestricted ? "switchRestricted" : "switchLegacy"), danger: !toRestricted });
|
|
104
125
|
if (ok) await write({ mode });
|
|
105
126
|
};
|
|
127
|
+
const clearRetainedOrigin = async () => {
|
|
128
|
+
if (busy || !p.originState?.canClear) return;
|
|
129
|
+
setBusy(true);
|
|
130
|
+
const confirmed = await confirmDialog({ title: ca("originClear"), message: ca("originClearConfirm"),
|
|
131
|
+
confirmLabel: ca("originClear"), danger: true });
|
|
132
|
+
if (!confirmed) { setBusy(false); return; }
|
|
133
|
+
const r = await clearOrigin(name, { revision: p.revision, originRevision: p.originState.revision, generation: p.originState.generation });
|
|
134
|
+
setBusy(false);
|
|
135
|
+
if (r.ok) { perm.setData(r.data); toast(ca("originCleared"), true); return; }
|
|
136
|
+
if (r.code === "conflict") { await perm.read(); toast(ca("stale"), false); return; }
|
|
137
|
+
toast(ca(r.code === "forbidden" ? "forbidden" : r.code === "unavailable" ? "unavailable" : "saveFailed"), false);
|
|
138
|
+
};
|
|
106
139
|
const tools = p.roomTools || { publicRead: false, allowedMcpTools: [], wouldDisable: [] };
|
|
107
140
|
const setTools = (next) => write({ roomTools: { publicRead: next.publicRead, allowedMcpTools: next.allowedMcpTools } });
|
|
108
141
|
const addMcp = async (e) => {
|
|
@@ -182,6 +215,18 @@ export function ContactPermissionsPanel({ name }) {
|
|
|
182
215
|
if (await confirmDialog({ message: ca("grantRemoveConfirm"), confirmLabel: ca("grantRemove"), danger: true })) void grantsWrite(p.grants.filter((x) => x.id !== gr.id));
|
|
183
216
|
}}>${ca("grantRemove")}</button>` : null}</li>`)}</ul>` : html`<p class="note">${ca("grantsNone")}</p>`}
|
|
184
217
|
</section>`}
|
|
218
|
+
${p.originState ? html`<section class="card contact-origin">
|
|
219
|
+
<h3>${ca("originTitle")}</h3>
|
|
220
|
+
<p class="contact-origin-state"><strong>${ca(`originKind_${p.originState.kind}`)}</strong></p>
|
|
221
|
+
<p class="note">${ca("originRetainedNote")}</p>
|
|
222
|
+
<p>${ca("originPeople")}</p>
|
|
223
|
+
${p.originState.people.length ? html`<ul class="contact-list contact-origin-people">${p.originState.people.map((person) => html`<li key=${`${person.platform}:${person.adapterId}:${person.userId}`}>
|
|
224
|
+
<strong>${personLabel(person)}</strong> <span class="muted">${person.platform} · ${person.adapterId} · ${person.userId}</span></li>`)}</ul>` : html`<p class="note">${ca("originPeopleNone")}</p>`}
|
|
225
|
+
<p class="contact-origin-chain">${ca("originChain")}: ${p.originState.chain.length ? p.originState.chain.join(" → ") : ca("originChainNone")}</p>
|
|
226
|
+
<p class="note">${ca("originReceipts", p.originState.receiptCount)}</p>
|
|
227
|
+
${p.originState.lastCleared ? html`<p class="contact-origin-last">${ca("originLastCleared", personLabel(p.originState.lastCleared.actor), when(p.originState.lastCleared.at))}</p>` : null}
|
|
228
|
+
${p.originState.canClear ? html`<button type="button" class="btn btn-sm btn-danger contact-origin-clear" disabled=${busy} onClick=${() => void clearRetainedOrigin()}>${ca("originClear")}</button>` : null}
|
|
229
|
+
</section>` : null}
|
|
185
230
|
<section class="card contact-history">
|
|
186
231
|
<h3>${ca("historyTitle")}</h3>
|
|
187
232
|
${p.history.length ? html`<ul class="contact-list contact-history-list">${p.history.map((h) => html`<li key=${h.id}>
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// M-3387 (the user, beta.14): switching a ClassicBot room to restricted mode listed ~50 raw AgEnD tool names
|
|
2
|
+
// (hub_room_list, get_fleet_status, set_web_theme_asset, office_pack_upload…) as what would stop. They are now said as a
|
|
3
|
+
// few kinds, with counts, and the names behind a "show all".
|
|
4
|
+
//
|
|
5
|
+
// Two layers stop: AgEnD's own tools (every MCP tool outside the restricted ceiling, CLASSIC_RESTRICTED_TOOLS) are taken
|
|
6
|
+
// away by the switch itself; the CLI's own tools (its shell, files, web — the backend's names, e.g. Bash) stop only where
|
|
7
|
+
// the command-line guard covers the room. A name in TOOL_GROUPS is AgEnD's; any other name in wouldDisable is the CLI's.
|
|
8
|
+
// tests/contact-tool-groups-m3387.test.ts pins that every AgEnD MCP tool (src/channel/mcp-tools.ts) outside the ceiling is
|
|
9
|
+
// in exactly one group, so a new tool can't be added without being put in one.
|
|
10
|
+
|
|
11
|
+
/** The kinds of AgEnD tools a restricted room loses, in the order they are shown; each tool in exactly one. */
|
|
12
|
+
export const TOOL_GROUPS = Object.freeze([
|
|
13
|
+
{ id: "fleet", tools: ["get_fleet_status", "get_fleet_config", "validate_config", "get_effort", "list_models", "kiro_engine_status",
|
|
14
|
+
"update_instance_config", "update_fleet_defaults", "migrate_kiro_instance", "reconcile_kiro_instance", "get_web_settings", "set_web_settings"] },
|
|
15
|
+
{ id: "agents", tools: ["create_instance", "delete_instance", "replace_instance", "start_instance", "stop_instance", "restart_instance",
|
|
16
|
+
"pause_instance", "wake_instance", "create_team", "update_team", "delete_team"] },
|
|
17
|
+
{ id: "usage", tools: ["get_usage", "get_usage_report", "get_cache_report", "get_instance_logs"] },
|
|
18
|
+
{ id: "schedules", tools: ["create_schedule", "list_schedules", "update_schedule", "delete_schedule"] },
|
|
19
|
+
{ id: "tasks", tools: ["task", "post_decision", "list_decisions", "update_decision"] },
|
|
20
|
+
{ id: "look", tools: ["set_display_name", "set_description", "set_persona_emoji", "list_emojis", "preview_emojis", "list_stickers",
|
|
21
|
+
"preview_stickers", "get_web_theme", "set_web_theme", "set_web_theme_asset", "reset_web_theme", "get_web_appearance",
|
|
22
|
+
"preview_web_appearance", "set_web_widget", "remove_web_widget", "set_web_ambient", "clear_web_ambient", "office_view", "office_set",
|
|
23
|
+
"office_set_style", "office_pack_check", "office_pack_list", "office_pack_upload", "office_pack_delete", "office_pack_restore"] },
|
|
24
|
+
{ id: "repos", tools: ["checkout_repo", "release_repo", "deploy_template", "teardown_deployment", "list_deployments"] },
|
|
25
|
+
{ id: "hub", tools: ["hub_room_list", "hub_room_post", "hub_room_members", "hub_people_search", "hub_set_intro"] },
|
|
26
|
+
].map((g) => Object.freeze({ id: g.id, tools: Object.freeze(g.tools) })));
|
|
27
|
+
|
|
28
|
+
const GROUP_OF = new Map(TOOL_GROUPS.flatMap((g) => g.tools.map((tool) => [tool, g.id])));
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* `names` (a room's wouldDisable) split by layer: AgEnD's tools by kind (shown order; kinds with none left out) and the
|
|
32
|
+
* CLI's own tools (any other name), each list sorted, nothing twice.
|
|
33
|
+
*/
|
|
34
|
+
export function groupWouldDisable(names) {
|
|
35
|
+
const unique = [...new Set((names || []).map(String))];
|
|
36
|
+
const groups = TOOL_GROUPS.map((g) => ({ id: g.id, tools: unique.filter((n) => GROUP_OF.get(n) === g.id).sort() })).filter((g) => g.tools.length);
|
|
37
|
+
const cli = unique.filter((n) => !GROUP_OF.has(n)).sort();
|
|
38
|
+
return { groups, cli, agendCount: groups.reduce((sum, g) => sum + g.tools.length, 0) };
|
|
39
|
+
}
|
package/dist/ui/fleet-canvas.js
CHANGED
|
@@ -20,10 +20,11 @@ import { modelSwitchText, modelName, observationLabel } from "/assets/model-obse
|
|
|
20
20
|
// #2182: routed around the cards and through the boxes' doors by libavoid in a worker (fleet-route-scene.js), each
|
|
21
21
|
// line from card to card; the lanes are the fallback.
|
|
22
22
|
import { html, useEffect, useLayoutEffect, useMemo, useRef, useState } from "/assets/app-html.js";
|
|
23
|
-
import { appStore } from "/assets/app-store.js";
|
|
23
|
+
import { appStore, guestPage } from "/assets/app-store.js";
|
|
24
24
|
import { t, register } from "/assets/app-i18n.js";
|
|
25
25
|
import { chatPath } from "/assets/app-route.js";
|
|
26
26
|
import { navigate } from "/assets/app-nav.js";
|
|
27
|
+
import { openOfficeChatWindow } from "./chat-popout.js";
|
|
27
28
|
import { Empty, Skeleton } from "/assets/ui-states.js";
|
|
28
29
|
import { Icon } from "/assets/ui-icons.js";
|
|
29
30
|
import { avatarOf, firstCharacter, namesOf } from "/assets/instance-nav.js";
|
|
@@ -512,7 +513,7 @@ export function OrgCanvas({ org, app, lease }) {
|
|
|
512
513
|
</div>
|
|
513
514
|
${mode === "canvas" && live && keyOpen ? html`<${Legend} />` : null}
|
|
514
515
|
${mode === "list" ? html`<${OrgChart} org=${org} app=${app} bare=${true} sending=${sending} />`
|
|
515
|
-
: mode === "office" ? html`<${Office} view=${view} traffic=${live ? traffic : null} q=${q} lease=${lease} onOpen=${
|
|
516
|
+
: mode === "office" ? html`<${Office} view=${view} traffic=${live ? traffic : null} q=${q} lease=${lease} onOpen=${guestPage() ? null : openOfficeChatWindow}
|
|
516
517
|
more=${officeSheet && officeMore} onMore=${officeSheet ? setOfficeMore : null} live=${live} onLive=${setLive} />`
|
|
517
518
|
: html`<${Canvas} view=${view} folded=${folded} onFold=${onFold} q=${q} jump=${jump} traffic=${live ? traffic : null} />`}
|
|
518
519
|
</div>`;
|