@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
|
@@ -89,7 +89,11 @@ function blobImage(blob) {
|
|
|
89
89
|
return new Promise((resolve) => {
|
|
90
90
|
if (typeof Image !== "function") { resolve(null); return; }
|
|
91
91
|
const src = URL.createObjectURL(blob), im = new Image();
|
|
92
|
-
|
|
92
|
+
const finish = () => { URL.revokeObjectURL(src); resolve(im); };
|
|
93
|
+
im.onload = () => {
|
|
94
|
+
if (typeof im.decode === "function") im.decode().then(finish, finish);
|
|
95
|
+
else finish();
|
|
96
|
+
};
|
|
93
97
|
im.onerror = () => { URL.revokeObjectURL(src); resolve(null); };
|
|
94
98
|
im.src = src;
|
|
95
99
|
});
|
package/dist/ui/panel-chat.js
CHANGED
|
@@ -385,10 +385,11 @@ export function boot({ stream, boot: bootData, deps = {} }) {
|
|
|
385
385
|
clearReply: (instance) => store.clearReply(instance),
|
|
386
386
|
addToDraft: (instance, line) => { feedbackInstance = instance; recordEdit(composerField(instance)); store.addToDraft(instance, line); },
|
|
387
387
|
focus: (instance = feedbackInstance) => {
|
|
388
|
+
import("./preview-popout.js").then(m => m.leavePreviewWindow()).catch(() => {});
|
|
388
389
|
const el = composerField(instance); if (!el) return;
|
|
389
390
|
el.focus();
|
|
390
391
|
// After the render that shows the line: the caret at its end.
|
|
391
|
-
setTimeout(() => { if (composerField(instance) !== el) return; try { const n = el.value.length; el.setSelectionRange(n, n); } catch { /* not a text field */ } }, 0);
|
|
392
|
+
setTimeout(() => { if (composerField(instance) !== el) return; el.focus(); try { const n = el.value.length; el.setSelectionRange(n, n); } catch { /* not a text field */ } }, 0);
|
|
392
393
|
},
|
|
393
394
|
});
|
|
394
395
|
// #1604: the preview opt-in and Tour live in Settings → This device now (and on each preview card's menu).
|
|
@@ -446,6 +447,7 @@ export function ChatPanel({ route, navKey }) {
|
|
|
446
447
|
const app = useStore(appStore);
|
|
447
448
|
const name = route.instance;
|
|
448
449
|
const inst = name ? app.instances.find(i => i.name === name) : null;
|
|
450
|
+
|
|
449
451
|
useEffect(() => {
|
|
450
452
|
if (store.show) {
|
|
451
453
|
if (!name || !inst) return;
|
|
@@ -501,6 +503,16 @@ function useResolvedMode(lease) {
|
|
|
501
503
|
}
|
|
502
504
|
|
|
503
505
|
function ChatView({ name, inst, lease, navKey, exec, awaiting }) {
|
|
506
|
+
const [previewPopout, setPreviewPopout] = useState(null);
|
|
507
|
+
useEffect(() => {
|
|
508
|
+
let alive = true, owner = null; setPreviewPopout(null);
|
|
509
|
+
if (!name || !inst) return;
|
|
510
|
+
import("./preview-popout.js").then(m => m.createPreviewPopout(name)).then(value => {
|
|
511
|
+
if (!alive) { value?.close(); return; } owner = value;
|
|
512
|
+
if (owner) setPreviewPopout(() => spec => owner.open(spec));
|
|
513
|
+
}).catch(() => {});
|
|
514
|
+
return () => { alive = false; owner?.close(); };
|
|
515
|
+
}, [name, !!inst]);
|
|
504
516
|
const pane = paneContext.usePane?.(), paneNow = useRef(pane); paneNow.current = pane;
|
|
505
517
|
const bindings = useRef({ input: { current: null }, box: { current: null }, composing: false }).current;
|
|
506
518
|
const ids = pane ? Object.fromEntries(["msgIn", "attachBtn", "stopBtn", "sendBtn", "cmdPalette"].map(key => [key, `pane-${pane.id}-${key}`])) : {};
|
|
@@ -657,7 +669,7 @@ function ChatView({ name, inst, lease, navKey, exec, awaiting }) {
|
|
|
657
669
|
<${ChatAmbient} name=${name} surface=${effectSurface} part="front" />
|
|
658
670
|
</div>
|
|
659
671
|
<${PreviewPanel} name=${name} split=${split} msgs=${() => store.state.msgs[name] || []} subscribe=${(fn) => store.subscribe(fn)}
|
|
660
|
-
keyOf=${msgKey} reveal=${(k) => thread.current && thread.current
|
|
672
|
+
popout=${previewPopout} keyOf=${msgKey} reveal=${(k) => { const owner = thread.current; import("./preview-popout.js").then(m => m.leavePreviewWindow(), () => {}).then(() => { if (lease.current() && thread.current === owner) owner?.reveal(k); }); }} download=${downloadHtml} allow=${(commit) => setPreviewOptIn(true, commit)} />
|
|
661
673
|
</div>
|
|
662
674
|
<${LightboxHost} owner=${view} />
|
|
663
675
|
${attachmentsSupported ? html`<div data-trust="drop" class="drop-overlay" aria-hidden="true"><div class="drop-card"><${Icon} name="attach" size=${32} /><span>${t("chat.dropHere")}</span></div></div>` : null}
|
|
@@ -996,6 +1008,38 @@ function openBackendSignIn(backend) {
|
|
|
996
1008
|
import("./backend-signin.js").then((m) => m.openSignIn({ backend }), () => toast(t("app.loadFailed"), false));
|
|
997
1009
|
}
|
|
998
1010
|
|
|
1011
|
+
/** Reports contain plain strings; HTM escapes every title, header, cell and note. */
|
|
1012
|
+
function CommandReport({ report, command }) {
|
|
1013
|
+
const [filter, setFilter] = useState("");
|
|
1014
|
+
const [expanded, setExpanded] = useState(false);
|
|
1015
|
+
const trigger = useRef(null);
|
|
1016
|
+
const wasExpanded = useRef(false);
|
|
1017
|
+
// The inline trigger is recreated when the modal closes; restore focus after its ref is mounted.
|
|
1018
|
+
useLayoutEffect(() => {
|
|
1019
|
+
if (wasExpanded.current && !expanded) trigger.current?.focus({ preventScroll: true });
|
|
1020
|
+
wasExpanded.current = expanded;
|
|
1021
|
+
}, [expanded]);
|
|
1022
|
+
const query = filter.trim().toLocaleLowerCase();
|
|
1023
|
+
const rows = command === "status" && query
|
|
1024
|
+
? report.rows.filter(row => row.some(value => value.toLocaleLowerCase().includes(query))) : report.rows;
|
|
1025
|
+
const view = html`<section class=${`cmd-report cmd-report-${command}${expanded ? " cmd-report-expanded" : ""}`} aria-label=${report.title}>
|
|
1026
|
+
${expanded ? null : html`<h3>${report.title}</h3>`}
|
|
1027
|
+
<div class="cmd-report-tools">
|
|
1028
|
+
${command === "status" ? html`<label class="field"><span class="sr-only">${t("chat.cmdReportFilter")}</span>
|
|
1029
|
+
<input type="search" aria-label=${t("chat.cmdReportFilter")} placeholder=${t("chat.cmdReportFilter")}
|
|
1030
|
+
value=${filter} onInput=${e => setFilter(e.target.value)} /></label>` : null}
|
|
1031
|
+
${expanded ? null : html`<button type="button" class="btn btn-sm btn-ghost" ref=${trigger} data-report-expand onClick=${() => setExpanded(true)}>${t("chat.cmdReportOpen")}</button>`}
|
|
1032
|
+
</div>
|
|
1033
|
+
${command === "status" ? html`<p class="note cmd-report-count">${query ? t("chat.cmdReportMatches", rows.length, report.rows.length) : t("chat.cmdReportCount", report.rows.length)}${report.notes[0] ? " · " + report.notes[0] : ""}</p>` : null}
|
|
1034
|
+
<div class="cmd-report-body" tabIndex="0" aria-label=${report.title}>
|
|
1035
|
+
${rows.length ? html`<table class=${command === "status" ? "us-table" : "cmd-metrics"}><thead><tr>${report.columns.map(label => html`<th scope="col">${label}</th>`)}</tr></thead>
|
|
1036
|
+
<tbody>${rows.map(row => html`<tr>${row.map((value, i) => html`<td data-label=${report.columns[i]}>${value}</td>`)}</tr>`)}</tbody></table>` : query ? html`<p class="note">${t("chat.cmdReportEmpty")}</p>` : null}
|
|
1037
|
+
${(command === "status" ? report.notes.slice(1) : report.notes).map(note => html`<p class="note">${note}</p>`)}
|
|
1038
|
+
</div>
|
|
1039
|
+
</section>`;
|
|
1040
|
+
return expanded ? html`<div class="cmd-report-modal"><${Dialog} title=${report.title} wide onClose=${() => setExpanded(false)}>${view}</${Dialog}></div>` : view;
|
|
1041
|
+
}
|
|
1042
|
+
|
|
999
1043
|
/** #1269: what the last chat command answered — its text, why it was refused, or a list to choose from. */
|
|
1000
1044
|
// M-3166 PR 3: the model menu's words (kept beside their caller: a retained chat dictionary has no such words).
|
|
1001
1045
|
register("modelMenu", {
|
|
@@ -1144,7 +1188,7 @@ function CommandCard({ name, lease }) {
|
|
|
1144
1188
|
${c.busy ? html`<span class="wait">${t("chat.cmdRunning", c.command)}</span>` : html`<button type="button" class="icon-btn" title=${t("chat.cmdDismiss")}
|
|
1145
1189
|
aria-label=${t("chat.cmdDismiss")} onClick=${() => store.dismissCommand(name)}><${Icon} name="close" size=${14} /></button>`}</div></div>
|
|
1146
1190
|
${c.error ? html`<p class="cmd-text">${c.error}</p>` : null}
|
|
1147
|
-
${c.text ? html`<pre class="cmd-text">${c.text}</pre>` : null}
|
|
1191
|
+
${c.report ? html`<${CommandReport} report=${c.report} command=${c.command} />` : c.text ? html`<pre class="cmd-text">${c.text}</pre>` : null}
|
|
1148
1192
|
${c.compact ? html`<p class="cmd-text cmd-phase">${c.compact === "running" ? t("chat.compactRunning")
|
|
1149
1193
|
: c.compact === "done" ? t("chat.compactDone") : c.compact === "timeout" ? t("chat.compactTimeout", "10")
|
|
1150
1194
|
: c.compact === "lost" ? t("chat.compactLost") : c.compact === "not_compacted" ? t("chat.compactNotCompacted") : t("chat.compactUnknown")}</p>` : null}
|
package/dist/ui/panel-fleet.js
CHANGED
|
@@ -241,7 +241,7 @@ export function FleetPanel({ route, navKey }) {
|
|
|
241
241
|
tabs; the title, search, docs and text size give way: app.css), then the page's own tools. */ ""}
|
|
242
242
|
<${PanelHeader} title=${t("fleet.title")} sub=${sub} nav=${wide ? tabs("fleet-tabs") : phone ? tabs("seg fleet-phone-tabs") : null}><${DocsLink} /><${HeaderTools} navKey=${navKey} /></${PanelHeader}>
|
|
243
243
|
${wide || phone ? null : tabs("seg")}
|
|
244
|
-
<div data-trust="panel-content" class="panel-body"><div class=${`col${tab === "tasks" || tab === "org" || tab === "cache" || tab === "usage" ? " col-wide" : ""}`}><${Body} lease=${lease} /></div></div>
|
|
244
|
+
<div data-trust="panel-content" class="panel-body"><div class=${`col${tab === "tasks" || tab === "org" || tab === "cache" || tab === "usage" || tab === "authorizations" ? " col-wide" : ""}`}><${Body} lease=${lease} /></div></div>
|
|
245
245
|
</div>`;
|
|
246
246
|
}
|
|
247
247
|
|
package/dist/ui/panel-needs.js
CHANGED
|
@@ -28,7 +28,7 @@ import { openSignIn, signInOffered } from "./backend-signin.js";
|
|
|
28
28
|
import { decideProposal, installProposals } from "./agent-proposals.js";
|
|
29
29
|
import { GeneralLocation } from "./general-location.js";
|
|
30
30
|
import { runtimeUpdateText } from "./runtime-update-status.js";
|
|
31
|
-
import { ContactNeedsItem } from "./contact-needs.js";
|
|
31
|
+
import { ContactNeedsItem, ContactSuggestionsGroup, isRestrictedSuggestion } from "./contact-needs.js";
|
|
32
32
|
import { HostDirectoryNotices, hostDirectoryNoticesOffered } from "./hub-host-security-notices.js";
|
|
33
33
|
|
|
34
34
|
// A pre-upgrade tab retains app-i18n.js. Register these reasons when the updated panel is loaded, too.
|
|
@@ -201,11 +201,14 @@ export function NeedsPanel({ navKey }) {
|
|
|
201
201
|
// The chat store owns a prompt's busy/answered state; redraw when it changes (and when it arrives).
|
|
202
202
|
useEffect(() => { if (owner) return owner.subscribe(() => tick((n) => n + 1)); return undefined; }, [owner, lease]);
|
|
203
203
|
const updates = items.filter(item => item.runtimeUpdate);
|
|
204
|
-
|
|
204
|
+
// M-3381: the rooms' restricted-mode suggestions are one group (below the rest), counted once.
|
|
205
|
+
const suggestions = items.filter(isRestrictedSuggestion);
|
|
206
|
+
const groups = groupNeeds(items.filter(item => !item.runtimeUpdate && !isRestrictedSuggestion(item)));
|
|
207
|
+
const shownCount = items.length - suggestions.length + (suggestions.length ? 1 : 0) + asks.length;
|
|
205
208
|
if (updates.length) groups.push({ instance: "", items: updates });
|
|
206
209
|
const nowMs = Date.now();
|
|
207
210
|
return html`<div data-effect-panel="needs" class="panel p-needs">
|
|
208
|
-
<${PanelHeader} title=${tn("title")} sub=${
|
|
211
|
+
<${PanelHeader} title=${tn("title")} sub=${shownCount ? t("app.needsCount", shownCount) : null} />
|
|
209
212
|
<div data-trust="panel-content" class="panel-body"><div class="col">
|
|
210
213
|
${asks.length || decidedHere.length ? html`<section class="n-group n-proposals" aria-label=${tn("proposals")}>
|
|
211
214
|
<h2 class="n-group-head">${tn("proposals")}</h2>
|
|
@@ -220,7 +223,7 @@ export function NeedsPanel({ navKey }) {
|
|
|
220
223
|
// M-3339: a contact request or the restricted-mode suggestion — its own card (contact-needs.js; references only).
|
|
221
224
|
? html`<${ContactNeedsItem} key=${item.id} item=${item} />`
|
|
222
225
|
: html`<${NeedsItem} key=${item.id} item=${item} nowMs=${nowMs} owner=${owner} />`)}
|
|
223
|
-
</section>`)}
|
|
226
|
+
</section>`).concat(suggestions.length ? [html`<${ContactSuggestionsGroup} key="contact-suggestions" items=${suggestions} />`] : [])}
|
|
224
227
|
<${HostDirectoryNotices} />
|
|
225
228
|
<${NotifyToggle} />
|
|
226
229
|
</div></div>
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { HostMonitoringSettings } from "./settings-host-monitoring.js";
|
|
1
2
|
import { SettingsBuildVersion } from "./settings-build-version.js";
|
|
2
3
|
// #1408 step 3: the Settings panel (/settings[/<section>]) — agents, connections, ClassicBot rooms, general defaults,
|
|
3
4
|
// the developer YAML. Behind the session gate (/ui/js/), loaded the first time it is opened.
|
|
@@ -436,7 +437,7 @@ export function SettingsPanel({ route, navKey }) {
|
|
|
436
437
|
: section === "agents" ? html`<${YamlLock} staged=${staged}><${Agents} ctx=${ctx} search=${search} clearSearch=${() => setSearch("")} openDialog=${toDialog} /></${YamlLock}>${SETTINGS_SECTIONS.includes("accounts") ? html`<p class="note s-agents-accounts-link">${layoutText("agentsAccountsNote")} <a href=${settingsPath("accounts")}>${layoutText("agentsAccountsLink")}<span aria-hidden="true">→</span></a></p>` : accountsCard()}`
|
|
437
438
|
: section === "accounts" ? accountsCard()
|
|
438
439
|
: section === "agent-defaults" ? html`<${GeneralLocation} /><${YamlLock} staged=${staged}><${General} key=${formKey} ctx=${ctx} part="fleet" />${!SETTINGS_SECTIONS.includes("notifications") ? html`<${QuotaNoticeSettings} key=${`quota:${formKey}`} ctx=${ctx} />` : null}</${YamlLock}>`
|
|
439
|
-
: section === "notifications" ? html`<${YamlLock} staged=${staged}><${QuotaNoticeSettings} key=${formKey} ctx=${ctx} /></${YamlLock}>`
|
|
440
|
+
: section === "notifications" ? html`<${YamlLock} staged=${staged}><${HostMonitoringSettings} key=${`monitoring:${formKey}`} ctx=${ctx} /><${QuotaNoticeSettings} key=${formKey} ctx=${ctx} /></${YamlLock}>`
|
|
440
441
|
: section === "chat" ? html`<${SettingsConnector} /><${YamlLock} staged=${staged}><${Bots} ctx=${ctx} search=${search} openDialog=${toDialog} /></${YamlLock}>
|
|
441
442
|
<${WebSection} key=${formKey} ctx=${ctx} staged=${staged} part="chat" />
|
|
442
443
|
<div id="classicbot" class="s-anchor s-classic-area"><section class="card s-chat-classic"><h2 class="s-ap-group">ClassicBot</h2><${Classic} ctx=${ctx} search=${search} openDialog=${toDialog} /></section>
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
// M-3438: presentation only. Each new window authenticates and reads its own history.
|
|
2
|
+
// Only a bounded locator crosses the existing exact-window protocol; never HTML, credentials or permissions.
|
|
3
|
+
import { appStore } from "/assets/app-store.js";
|
|
4
|
+
import { assetUrl } from "/assets/asset-url.js";
|
|
5
|
+
import { Shell, shellStore } from "/assets/app-shell.js";
|
|
6
|
+
import { isSafeInstanceName } from "/assets/app-route.js";
|
|
7
|
+
import { register, t } from "/assets/app-i18n.js";
|
|
8
|
+
import { toast } from "/assets/ui-toast.js";
|
|
9
|
+
import { loadHtmlAttachment } from "/assets/html-attachment.js";
|
|
10
|
+
import * as Panel from "/assets/preview-panel.js";
|
|
11
|
+
import * as Transport from "./chat-popout-transport.js";
|
|
12
|
+
|
|
13
|
+
register("previewPopout", {
|
|
14
|
+
en: { open: "Pop out preview", blocked: "Your browser blocked the window. Allow pop-ups for this site, then try again. The original preview is unchanged.",
|
|
15
|
+
retained: "The preview could not be opened in the new window. The original preview has been kept.", busy: "A preview window is already opening." },
|
|
16
|
+
"zh-TW": { open: "彈出預覽視窗", blocked: "瀏覽器封鎖了新視窗。請允許這個網站開啟彈出視窗,再試一次。原本的預覽不變。",
|
|
17
|
+
retained: "無法在新視窗開啟預覽,已保留原本的預覽。", busy: "正在開啟預覽視窗。" },
|
|
18
|
+
});
|
|
19
|
+
register("chat", { en: { pvPopout: "Pop out preview" }, "zh-TW": { pvPopout: "彈出預覽視窗" } });
|
|
20
|
+
const notify = reason => toast(t("previewPopout." + reason), false);
|
|
21
|
+
const safeKey = value => typeof value === "string" && value.length <= 256 && /^[a-zA-Z0-9_-]+-[0-9]+$/.test(value);
|
|
22
|
+
export function validPreviewLocator(value) {
|
|
23
|
+
if (!value || typeof value !== "object" || Array.isArray(value) || !safeKey(value.msgKey)) return false;
|
|
24
|
+
const keys = Object.keys(value).sort().join(",");
|
|
25
|
+
return keys === "msgKey,n" ? Number.isInteger(value.n) && value.n >= 0 && value.n < 1000
|
|
26
|
+
: keys === "attachmentId,msgKey" && typeof value.attachmentId === "string" && /^[a-f0-9]{32}$/.test(value.attachmentId);
|
|
27
|
+
}
|
|
28
|
+
export function previewLocator(open) {
|
|
29
|
+
if (!open || open.kind !== "html" || !isSafeInstanceName(open.instance)) return null;
|
|
30
|
+
const locator = open.att ? { msgKey: open.msgKey, attachmentId: open.att.id } : { msgKey: open.msgKey, n: open.n };
|
|
31
|
+
return validPreviewLocator(locator) ? locator : null;
|
|
32
|
+
}
|
|
33
|
+
export function previewSpecFromHistory(name, locator, messages) {
|
|
34
|
+
if (!isSafeInstanceName(name) || !validPreviewLocator(locator)) return null;
|
|
35
|
+
const row = (Array.isArray(messages) ? messages : []).find(x =>
|
|
36
|
+
x.instance === name && x.role === "agent" && x.boot + "-" + x.id === locator.msgKey);
|
|
37
|
+
if (!row) return null;
|
|
38
|
+
const common = { instance: name, msgKey: locator.msgKey, sender: row.sender, ts: row.ts };
|
|
39
|
+
if (Object.hasOwn(locator, "n")) {
|
|
40
|
+
const fence = globalThis.AgendChatRender.htmlFences(row.text)[locator.n];
|
|
41
|
+
return fence?.terminated ? { ...common, key: locator.msgKey + ":f" + locator.n, n: locator.n, code: fence.code } : null;
|
|
42
|
+
}
|
|
43
|
+
const att = (row.attachments || []).find(a => a.id === locator.attachmentId && globalThis.AgendChatRender.isHtmlAttachment(a));
|
|
44
|
+
return att ? { ...common, key: locator.msgKey + ":a" + att.id, att: { id: att.id, name: att.name, size: att.size }, code: null } : null;
|
|
45
|
+
}
|
|
46
|
+
export async function readPreviewSpec(chat, name, locator, current) {
|
|
47
|
+
if (!validPreviewLocator(locator) || !current()) return null;
|
|
48
|
+
await chat.store.findQuoted(name, locator.msgKey); // Existing endpoint, archive limits and audience checks.
|
|
49
|
+
if (!current()) return null;
|
|
50
|
+
let spec = previewSpecFromHistory(name, locator, chat.store.state.msgs[name]);
|
|
51
|
+
if (spec?.att) {
|
|
52
|
+
// Read through the existing same-origin attachment loader. Launch still has its own size/opt-in gate.
|
|
53
|
+
const read = await loadHtmlAttachment(spec.att, undefined, { anyway: true });
|
|
54
|
+
if (!current() || !read.ok) return null;
|
|
55
|
+
spec = { ...spec, code: read.code };
|
|
56
|
+
}
|
|
57
|
+
return current() ? spec : null;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
let styles;
|
|
61
|
+
function loadStyles() {
|
|
62
|
+
return styles ??= new Promise(resolve => {
|
|
63
|
+
const link = document.createElement("link"); link.rel = "stylesheet"; link.href = assetUrl("/assets/preview-popout.css");
|
|
64
|
+
link.onload = () => resolve(true); link.onerror = () => resolve(false); document.head.appendChild(link);
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
const supported = () => Shell.popoutVersion === 1 && typeof Panel.previewHostReady === "function"
|
|
68
|
+
&& typeof Transport.createPreviewPopoutTransport === "function" && typeof Transport.receivePreviewPopout === "function";
|
|
69
|
+
const requested = win => new URL(win.location.href).searchParams.get("presentation") === "preview";
|
|
70
|
+
const auth = () => globalThis.AgendAuth;
|
|
71
|
+
const visible = name => appStore.get().ready && appStore.get().instances.some(x => x.name === name) && !auth()?.sessionEnded?.();
|
|
72
|
+
let leavePresentation = null;
|
|
73
|
+
export function leavePreviewWindow() { leavePresentation?.(); }
|
|
74
|
+
|
|
75
|
+
/** Prepared before offering the control, so window.open remains in its actual click stack. */
|
|
76
|
+
export async function createPreviewPopout(name, win = window) {
|
|
77
|
+
if (!supported() || !isSafeInstanceName(name) || requested(win)) return null;
|
|
78
|
+
const [css, scope] = await Promise.all([loadStyles(), auth()?.sessionHandle?.()]);
|
|
79
|
+
if (!css || !scope || !visible(name)) return null;
|
|
80
|
+
let alive = true;
|
|
81
|
+
const transport = Transport.createPreviewPopoutTransport({ win, scope, notify });
|
|
82
|
+
const off = auth()?.onSessionEnd?.(() => { alive = false; transport.close(); });
|
|
83
|
+
return {
|
|
84
|
+
open(open) {
|
|
85
|
+
const payload = previewLocator(open);
|
|
86
|
+
const current = () => alive && visible(name) && open.instance === name && Panel.panelStore.get().open === open;
|
|
87
|
+
if (!payload || !current()) return false;
|
|
88
|
+
return transport.open({ name, payload, current, complete() {
|
|
89
|
+
if (!current()) return false; Panel.closePanel(); return true;
|
|
90
|
+
} });
|
|
91
|
+
},
|
|
92
|
+
close() { alive = false; transport.close(); if (typeof off === "function") off(); },
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export async function installPreviewWindow({ nav, chat, win = window }) {
|
|
97
|
+
const stamp = nav.navStore.get(), route = stamp.route, name = route?.instance;
|
|
98
|
+
if (!supported() || !requested(win) || route?.panel !== "chat" || !isSafeInstanceName(name) || !win.opener) return null;
|
|
99
|
+
const [css, scope] = await Promise.all([loadStyles(), auth()?.sessionHandle?.()]);
|
|
100
|
+
if (!css || !scope) return null;
|
|
101
|
+
let alive = true, showing = false;
|
|
102
|
+
const current = () => alive && nav.navStore.get() === stamp && !auth()?.sessionEnded?.();
|
|
103
|
+
const leave = () => {
|
|
104
|
+
if (!showing) return; showing = false;
|
|
105
|
+
delete document.documentElement.dataset.previewWindow;
|
|
106
|
+
shellStore.set({ popout: false, popoutHeader: null });
|
|
107
|
+
const url = new URL(win.location.href); url.searchParams.delete("presentation");
|
|
108
|
+
win.history.replaceState(win.history.state, "", url.pathname + url.search + url.hash);
|
|
109
|
+
};
|
|
110
|
+
const stop = Transport.receivePreviewPopout({
|
|
111
|
+
win, name, scope, notify, current,
|
|
112
|
+
ready: () => current() && visible(name) && Panel.previewHostReady(name),
|
|
113
|
+
accept: async (locator, withinDeadline) => {
|
|
114
|
+
const fresh = () => current() && withinDeadline();
|
|
115
|
+
const spec = await readPreviewSpec(chat, name, locator, fresh);
|
|
116
|
+
if (!spec || !fresh()) return false;
|
|
117
|
+
showing = true; leavePresentation = leave;
|
|
118
|
+
document.documentElement.dataset.previewWindow = "1";
|
|
119
|
+
shellStore.set({ popout: true, popoutHeader: null, drawer: false });
|
|
120
|
+
Panel.openPanel(spec, { run: true }); // The explicit pop-out click; existing availability/opt-in/size gates still own launch.
|
|
121
|
+
return true;
|
|
122
|
+
},
|
|
123
|
+
});
|
|
124
|
+
const panelOff = Panel.panelStore.subscribe(s => { if (showing && !s.open) leave(); });
|
|
125
|
+
const navOff = nav.navStore.subscribe(() => { if (nav.navStore.get() !== stamp) close(); });
|
|
126
|
+
let authOff = null;
|
|
127
|
+
authOff = auth()?.onSessionEnd?.(() => { Panel.closePanel(); close(); });
|
|
128
|
+
function close() {
|
|
129
|
+
if (!alive) return; alive = false; stop(); leave(); panelOff(); navOff();
|
|
130
|
+
if (leavePresentation === leave) leavePresentation = null;
|
|
131
|
+
if (typeof authOff === "function") authOff();
|
|
132
|
+
}
|
|
133
|
+
return { close };
|
|
134
|
+
}
|
|
@@ -51,7 +51,7 @@ export function ReplyFilePanel({ open, panel, fs, enterFs, leaveFs, onKey, close
|
|
|
51
51
|
return html`<aside data-trust="preview" class=${`pv-panel ws-panel reply-file-panel${fs ? ` pv-fs pv-fs-${fs}` : ""}`} ref=${panel} aria-label=${t("replyPreview.title")} onKeyDown=${onKey}>
|
|
52
52
|
<div class="pv-panel-head">
|
|
53
53
|
<div class="pv-panel-title"><strong>${t("replyPreview.title")}</strong><span class="pv-source">${open.instance}</span></div>
|
|
54
|
-
<button type="button" class="icon-btn
|
|
54
|
+
<button type="button" class="icon-btn pv-panel-fs" aria-label=${t(fs ? "chat.pvFsExit" : "chat.pvFs")} onClick=${() => fs ? leaveFs() : enterFs()}><${Icon} name=${fs ? "fullscreenexit" : "fullscreen"} size=${16} /></button>
|
|
55
55
|
<button type="button" class="icon-btn pv-panel-close" aria-label=${t("chat.pvClose")} onClick=${close}><${Icon} name="close" size=${18} /></button>
|
|
56
56
|
</div>
|
|
57
57
|
<div class="pv-note ws-readonly">${t("replyPreview.readonly")}</div>
|
|
@@ -9,6 +9,7 @@ import { appStore, useStore } from "/assets/app-store.js";
|
|
|
9
9
|
import { DEFAULT_SETTINGS_CONTENT_WIDTH, SETTINGS_CONTENT_WIDTHS, settingsContentWidthStore, setSettingsContentWidth } from "/assets/settings-width.js";
|
|
10
10
|
import { ModsCard } from "./settings-mods.js";
|
|
11
11
|
import { Icon } from "/assets/ui-icons.js";
|
|
12
|
+
import { ThemePicker, paletteName } from "/assets/theme-picker.js";
|
|
12
13
|
import { toast } from "/assets/ui-toast.js";
|
|
13
14
|
import { ownerCssOffHere, ownerCssTrial, safeMode, setOwnerCssActive, setOwnerCssOffHere, startOwnerCssTrial } from "/assets/owner-css.js";
|
|
14
15
|
import { setThemesShown, themesStore } from "/assets/app-themes.js";
|
|
@@ -109,7 +110,8 @@ export function AppearanceSection(props = {}) {
|
|
|
109
110
|
/** Theme remains a normal personal preference. */
|
|
110
111
|
function ThemeModeCard() {
|
|
111
112
|
const [theme, setTheme] = useState(typeof AgendTheme !== "undefined" ? AgendTheme.get() : "system");
|
|
112
|
-
|
|
113
|
+
const [coloursOpen, setColoursOpen] = useState(false), [palette, setPalette] = useState(globalThis.AgendTheme?.getPalette?.() || "");
|
|
114
|
+
useEffect(() => globalThis.AgendTheme?.onChange?.(value => { setTheme(value); setPalette(globalThis.AgendTheme.getPalette?.() || ""); }), []);
|
|
113
115
|
const choose = (value) => { setTheme(value); if (typeof AgendTheme !== "undefined") AgendTheme.set(value); savePref("theme", value); };
|
|
114
116
|
return html`<section class="card s-appearance s-look-display"><h3>${tn("lookDisplayGroup")}</h3>
|
|
115
117
|
<fieldset id="pref-theme" class="s-theme-picker"><legend>${t("app.theme")}</legend><div class="s-theme-options">
|
|
@@ -119,6 +121,9 @@ function ThemeModeCard() {
|
|
|
119
121
|
<span class="s-theme-choice-label">${t(`app.${key}`)}</span>
|
|
120
122
|
</label>`)}
|
|
121
123
|
</div></fieldset>
|
|
124
|
+
<div class="s-row s-theme-colours-row"><div class="grow"><span>${t("app.colours")}</span><small class="note">${paletteName(palette)}</small></div>
|
|
125
|
+
<button type="button" class="btn s-theme-colours" onClick=${() => setColoursOpen(true)}>${t("app.themeChoose")}</button></div>
|
|
126
|
+
${coloursOpen ? html`<${ThemePicker} onClose=${() => { setColoursOpen(false); setPalette(globalThis.AgendTheme?.getPalette?.() || ""); }} />` : null}
|
|
122
127
|
<${SettingsContentWidth} />
|
|
123
128
|
</section>`;
|
|
124
129
|
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { html, useEffect } from '/assets/app-html.js';
|
|
2
|
+
import { register, t } from '/assets/app-i18n.js';
|
|
3
|
+
import { confirmDialog } from '/assets/ui-confirm.js';
|
|
4
|
+
import { useDraft, syncStage } from './settings-draft.js';
|
|
5
|
+
register('hostMonitoring', {
|
|
6
|
+
en: { title:'Host monitoring', enabled:'Monitor this computer', agents:'Include agent footprint',
|
|
7
|
+
hint:'When on, samples every 30–60 seconds; estimated 2–4 MiB RAM and 1–4 MiB of local writes per hour.',
|
|
8
|
+
agentHint:'Optional process snapshot every minute; for 32 agents, an estimated extra 2–8 MiB RAM and 1–4 MiB of writes per hour.',
|
|
9
|
+
off:'Off by default. While off, there is no monitoring collector, timer or history file.',
|
|
10
|
+
agentUnavailable:'Agent footprint is not available in this version of AgEnD.',
|
|
11
|
+
stopTitle:'Turn off host monitoring?', stopBody:'This stops monitoring and its alerts, and removes the recorded host history. Turning it on again starts a new history.', stop:'Turn off', },
|
|
12
|
+
'zh-TW': { title:'主機監測', enabled:'監測這台電腦', agents:'包含 Agent 資源用量',
|
|
13
|
+
hint:'開啟後每 30–60 秒取樣;估計使用 2–4 MiB 記憶體,每小時本機寫入 1–4 MiB。',
|
|
14
|
+
agentHint:'選用:每分鐘讀取行程資料;32 個 Agent 估計另用 2–8 MiB 記憶體,每小時寫入 1–4 MiB。',
|
|
15
|
+
off:'預設關閉。關閉時沒有監測收集器、計時器或歷史檔案。',
|
|
16
|
+
agentUnavailable:'這個 AgEnD 版本尚未提供 Agent 資源用量。',
|
|
17
|
+
stopTitle:'關閉主機監測?', stopBody:'這會停止監測與通知,並移除已記錄的主機歷史。重新開啟時會建立新的歷史。', stop:'關閉', },
|
|
18
|
+
});
|
|
19
|
+
const copy = k => t(`hostMonitoring.${k}`);
|
|
20
|
+
export function HostMonitoringSettings({ ctx }) {
|
|
21
|
+
const available = ctx.schema?.host_monitoring === true;
|
|
22
|
+
useEffect(() => { if (!available) syncStage(ctx, 'host-monitoring', null); }, [available]);
|
|
23
|
+
// Keep the dormant controls out of Settings until a real collector is wired.
|
|
24
|
+
// A separate child keeps hook order stable across capability transitions.
|
|
25
|
+
return available ? html`<${AvailableHostMonitoringSettings} ctx=${ctx} />` : null;
|
|
26
|
+
}
|
|
27
|
+
function AvailableHostMonitoringSettings({ ctx }) {
|
|
28
|
+
const base = { enabled:ctx.fleet.monitoring?.enabled === true, agent_footprint:ctx.fleet.monitoring?.agent_footprint === true };
|
|
29
|
+
const [form, setForm] = useDraft(ctx, 'host-monitoring', () => base);
|
|
30
|
+
const agentsAvailable = ctx.schema?.host_monitoring_agents === true;
|
|
31
|
+
useEffect(() => {
|
|
32
|
+
const changed = form.enabled !== base.enabled || form.agent_footprint !== base.agent_footprint;
|
|
33
|
+
syncStage(ctx, 'host-monitoring', changed ? {label:copy('title'), impact:'now', request:{method:'PUT',url:'/api/settings/fleet/monitoring',body:{enabled:form.enabled,agent_footprint:form.agent_footprint}}} : null);
|
|
34
|
+
}, [form]);
|
|
35
|
+
const setEnabled = async (checked, control) => {
|
|
36
|
+
if (!checked && form.enabled && !(await confirmDialog({title:copy('stopTitle'),message:copy('stopBody'),confirmLabel:copy('stop'),danger:true}))) {
|
|
37
|
+
// The browser toggled its native property before the asynchronous question.
|
|
38
|
+
// Cancel leaves the draft unchanged, so restore the displayed value too.
|
|
39
|
+
control.checked = form.enabled;
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
setForm(f=>({...f,enabled:checked}));
|
|
43
|
+
};
|
|
44
|
+
const row = (id,key,hint,disabled,change) => html`<div class="s-setting-row"><div class="s-setting-copy"><label for=${id}>${copy(key)}</label><p class="note" id=${`${id}-hint`}>${copy(hint)}</p></div>
|
|
45
|
+
<input class="s-ui-toggle" type="checkbox" role="switch" id=${id} checked=${form[key === 'agents' ? 'agent_footprint':'enabled']} disabled=${disabled} aria-describedby=${`${id}-hint`} onChange=${e=>change(e.target.checked, e.target)} /></div>`;
|
|
46
|
+
return html`<section class="card s-group" id="host-monitoring"><h3>${copy('title')}</h3>
|
|
47
|
+
${row('hostMonitoringEnabled','enabled','hint',false,setEnabled)}
|
|
48
|
+
${row('hostMonitoringAgents','agents','agentHint',!agentsAvailable || !form.enabled,checked=>setForm(f=>({...f,agent_footprint:checked})))}
|
|
49
|
+
${!agentsAvailable ? html`<p class="note">${copy('agentUnavailable')}</p>` : null}
|
|
50
|
+
<p class="note">${copy('off')}</p></section>`;
|
|
51
|
+
}
|
|
@@ -29,7 +29,7 @@ const ROWS = [
|
|
|
29
29
|
["quota.notices", "notifications", "#quota-notices", null, "defaults.quota_notice", ["usage", "quota", "notifications", "remaining", "weekly"], ["用量", "額度", "提醒", "通知", "剩餘"], L("Quota notices", "用量提醒")],
|
|
30
30
|
// You · Preferences
|
|
31
31
|
["profile.name", "preferences", "#profile-name", "settings.profileTitle", null, ["name", "display name", "who agents see", "profile"], ["名字", "名稱", "顯示名稱", "個人資料"]],
|
|
32
|
-
["prefs.theme", "look", "#pref-theme", "app.theme", null, ["theme", "dark", "light", "dark mode", "colour scheme"], ["主題", "深色", "淺色", "外觀"]],
|
|
32
|
+
["prefs.theme", "look", "#pref-theme", "app.theme", null, ["theme", "dark", "light", "dark mode", "colour scheme", "colours", "Clear Sky", "Meadow", "Night Violet", "Mint"], ["主題", "深色", "淺色", "外觀", "配色", "晴空", "青草", "夜紫", "薄荷"]],
|
|
33
33
|
["prefs.lang", "preferences", "#pref-lang", "app.language", null, ["language", "dashboard language", "english", "chinese", "locale"], ["語言", "介面語言", "中文", "英文"]],
|
|
34
34
|
["prefs.density", "preferences", "#pref-density", "app.sidebarDensity", null, ["sidebar", "compact", "detailed", "density", "agent list"], ["側邊欄", "精簡", "詳細", "密度", "Agent 清單"]],
|
|
35
35
|
["prefs.compactName", "preferences", "#pref-compact-name", "app.compactName", null, ["compact", "display name", "instance name"], ["精簡", "暱稱", "實際名稱"]],
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
import { html, useEffect, useRef, useState } from "/assets/app-html.js";
|
|
11
11
|
import { t } from "/assets/app-i18n.js";
|
|
12
12
|
import { settingsPath } from "/assets/app-route.js";
|
|
13
|
+
import { InfoTip as SharedInfoTip } from "/assets/info-tip.js";
|
|
13
14
|
import "./settings-strings.js";
|
|
14
15
|
import "./settings-shared-strings.js"; // the words this page added: a tab that already ran an older settings-strings.js has none of them (#3087)
|
|
15
16
|
import {
|
|
@@ -225,9 +226,9 @@ export function Tip({ text, cls = "", ariaLabel, children }) {
|
|
|
225
226
|
onClick=${(e) => { e.stopPropagation(); if (pinned) hide(); else { show(); setPinned(true); } }}>${children}</button>
|
|
226
227
|
<span id=${idRef.current} ref=${body} class=${`s-tipbody${at && at.above ? " above" : ""}`} role="tooltip" hidden=${!at}>${text}</span></span>`;
|
|
227
228
|
}
|
|
228
|
-
/** The ⓘ beside a label: what the field is for, when it matters, what its default means. */
|
|
229
|
+
/** The ⓘ beside a label: what the field is for, when it matters, what its default means. M-3443: the shared info icon. */
|
|
229
230
|
export function InfoTip({ text, name }) {
|
|
230
|
-
return html`<${
|
|
231
|
+
return html`<${SharedInfoTip} text=${text} label=${tn("tipLabel", name)} cls="s-i" />`;
|
|
231
232
|
}
|
|
232
233
|
/**
|
|
233
234
|
* "6/7 in use · artist custom" at a field's right: how many agents use this page's value; hover lists the ones that set their own.
|
|
@@ -77,6 +77,8 @@ register("app", {
|
|
|
77
77
|
compactName: "Compact row name", compactNickname: "Display name", compactInstance: "Instance name",
|
|
78
78
|
names: "Names", namesNickname: "Nickname first", namesInstance: "Real name first",
|
|
79
79
|
theme: "Theme", themeSystem: "System", themeLight: "Light", themeDark: "Dark", language: "Language",
|
|
80
|
+
themeOther: "Other…", themeOtherActive: "Colours: {0}…", themeChoose: "Choose…", colours: "Colours", apply: "Apply",
|
|
81
|
+
paletteDefault: "Default", paletteSky: "Clear Sky", paletteMeadow: "Meadow", paletteViolet: "Night Violet", paletteMint: "Mint",
|
|
80
82
|
previews: "Allow HTML previews", tour: "Tour", tourTitle: "Show the web chat tour again",
|
|
81
83
|
needsYou: "needs you", approxNote: "Read from the terminal, so approximate", chat: "Chat", details: "Settings", log: "Log", instanceViews: "Views of {0}",
|
|
82
84
|
textSize: "Text size: {0}", textSize_s: "S", textSize_m: "M", textSize_l: "L", textSize_fit: "Fit", usage: "Usage", usageHide: "Hide usage",
|
|
@@ -129,6 +131,8 @@ register("app", {
|
|
|
129
131
|
compactName: "精簡列名稱", compactNickname: "暱稱", compactInstance: "實際名稱",
|
|
130
132
|
names: "名稱", namesNickname: "暱稱優先", namesInstance: "實際名稱優先",
|
|
131
133
|
theme: "主題", themeSystem: "跟隨系統", themeLight: "淺色", themeDark: "深色", language: "語言",
|
|
134
|
+
themeOther: "其他…", themeOtherActive: "配色:{0}…", themeChoose: "選擇…", colours: "配色", apply: "套用",
|
|
135
|
+
paletteDefault: "預設", paletteSky: "晴空", paletteMeadow: "青草", paletteViolet: "夜紫", paletteMint: "薄荷",
|
|
132
136
|
previews: "允許預覽 HTML", tour: "導覽", tourTitle: "再看一次網頁聊天導覽",
|
|
133
137
|
needsYou: "等你回應", approxNote: "從終端畫面判讀,僅供參考", chat: "聊天", details: "設定", log: "紀錄", instanceViews: "{0} 的檢視",
|
|
134
138
|
textSize: "字級:{0}", textSize_s: "小", textSize_m: "中", textSize_l: "大", textSize_fit: "填滿", usage: "用量", usageHide: "隱藏用量",
|
|
@@ -17,6 +17,7 @@ import { applyPageTheme, pageNow, resolvedMode, themesStore } from "./app-themes
|
|
|
17
17
|
import { ErrorState, Skeleton } from "./ui-states.js";
|
|
18
18
|
import { StaleTabPrompt, isStaleModuleError } from "./stale-tab.js";
|
|
19
19
|
import { Dialog } from "./ui-dialog.js";
|
|
20
|
+
import { ThemePicker, paletteName } from "./theme-picker.js";
|
|
20
21
|
import { InstanceNav, RosterNav, namesStore, phoneDrawerStore, setNamesPrimary, sidebarDensityStore, setSidebarDensity, compactNameStore, setCompactName } from "./instance-nav.js";
|
|
21
22
|
import { usageRailStore } from "./header-tools.js";
|
|
22
23
|
import { RightRail, sidePanelStore } from "./side-panel.js";
|
|
@@ -415,7 +416,7 @@ function Sidebar({ route, onNewInstance, viewOnly }) {
|
|
|
415
416
|
aria-current=${on(panel) ? "page" : undefined} aria-label=${count ? `${label} (${t(countText, count)})` : undefined} onClick=${closeDrawer}>
|
|
416
417
|
<${Icon} name=${icon} /><span class="grow">${label}</span>${count ? html`<span class="nav-count" aria-hidden="true">${count}</span>` : null}</a>`;
|
|
417
418
|
// alpha.2 (M-2300): an agent's request waiting for this web-only fleet's owner counts too (only the owner's page has any).
|
|
418
|
-
const
|
|
419
|
+
const needsTotal = needsCount(app);
|
|
419
420
|
// View-only (an anonymous reader, #1408 §3): View and a way to sign in — nothing that needs a session is rendered.
|
|
420
421
|
if (viewOnly) {
|
|
421
422
|
return html`<aside id="sidebar" class="sidebar" aria-label=${t("app.menu")}>
|
|
@@ -465,7 +466,7 @@ function Sidebar({ route, onNewInstance, viewOnly }) {
|
|
|
465
466
|
${/* AgEnD Hub P1: a member fleet's "My fleet ↔ Hub" (shown once paired; nothing loads when the switch is off) */ hubMarks().member ? html`<${HubSwitcherSlot} />` : null}
|
|
466
467
|
<nav data-trust="navigation" class="side-nav" aria-label=${t("app.menu")}>
|
|
467
468
|
${overview}
|
|
468
|
-
${navLink("needs", NEEDS_PATH, "inbox", t("app.needsNav"),
|
|
469
|
+
${navLink("needs", NEEDS_PATH, "inbox", t("app.needsNav"), needsTotal)}
|
|
469
470
|
${/* #2910 D2: a web-only fleet (no chat connection) has Notices — what General would have said. AGEND-122: a chat fleet too, while one is unread (a confirmation from another device that nothing else could carry). */
|
|
470
471
|
(app.connections === 0 || (app.notices && app.notices.unread > 0)) && app.notices && app.notices.enabled ? navLink("notices", NOTICES_PATH, "bell", t("app.noticesNav"), app.notices.unread | 0, "app.noticesCount") : null}
|
|
471
472
|
${searchOffered(canCreate) ? searchRow() : null}
|
|
@@ -510,18 +511,21 @@ function ViewOnlyNav({ route }) {
|
|
|
510
511
|
*/
|
|
511
512
|
export function DevicePrefs({ labels = false, fields = ["theme", "language", "names"] } = {}) {
|
|
512
513
|
const [theme, setTheme] = useState(typeof AgendTheme !== "undefined" ? AgendTheme.get() : "system");
|
|
514
|
+
const [palette, setPalette] = useState(globalThis.AgendTheme?.getPalette?.() || ""), [coloursOpen, setColoursOpen] = useState(false);
|
|
513
515
|
const [l, setL] = useState(lang());
|
|
514
516
|
const names = useStore(namesStore); // #1722
|
|
515
517
|
const density = useStore(sidebarDensityStore).value;
|
|
516
518
|
const compactName = useStore(compactNameStore).value ?? names.primary;
|
|
517
519
|
// #1665: what is in force, as it changes — another device's choice arriving while this is open is shown at once.
|
|
518
|
-
useEffect(() => (
|
|
520
|
+
useEffect(() => globalThis.AgendTheme?.onChange?.(value => { setTheme(value); setPalette(globalThis.AgendTheme.getPalette?.() || ""); }), []);
|
|
519
521
|
useEffect(() => onLang(setL), []);
|
|
520
522
|
const shows = (field) => fields.includes(field);
|
|
521
523
|
return html`<div class=${`prefs${labels ? " labelled" : ""}`}>
|
|
522
524
|
${shows("theme") ? html`<label class="pref"><${Icon} name="sun" size=${16} /><span class=${labels ? "pref-label" : "sr-only"}>${t("app.theme")}</span>
|
|
523
|
-
<select id=${labels ? "pref-theme" : undefined} value=${theme} aria-label=${t("app.theme")} onChange=${(e) => {
|
|
524
|
-
<option value="system">${t("app.themeSystem")}</option><option value="light">${t("app.themeLight")}</option><option value="dark">${t("app.themeDark")}</option
|
|
525
|
+
<select id=${labels ? "pref-theme" : undefined} value=${theme} aria-label=${t("app.theme")} onChange=${(e) => { const value = e.target.value; if (value === "other") { e.target.value = theme; setColoursOpen(true); return; } setTheme(value); if (typeof AgendTheme !== "undefined") AgendTheme.set(value); savePref("theme", value); }}>
|
|
526
|
+
<option value="system">${t("app.themeSystem")}</option><option value="light">${t("app.themeLight")}</option><option value="dark">${t("app.themeDark")}</option>
|
|
527
|
+
<option value="other">${palette ? t("app.themeOtherActive", paletteName(palette)) : t("app.themeOther")}</option></select></label>` : null}
|
|
528
|
+
${coloursOpen ? html`<${ThemePicker} onClose=${() => setColoursOpen(false)} />` : null}
|
|
525
529
|
${shows("language") ? html`<label class="pref"><${Icon} name="globe" size=${16} /><span class=${labels ? "pref-label" : "sr-only"}>${t("app.language")}</span>
|
|
526
530
|
<select id=${labels ? "pref-lang" : undefined} value=${l} aria-label=${t("app.language")} onChange=${(e) => { setL(e.target.value); setLang(e.target.value); savePref("lang", e.target.value); }}>
|
|
527
531
|
<option value="en">English</option><option value="zh-TW">中文</option></select></label>` : null}
|
|
@@ -561,7 +565,12 @@ register("phoneNav", {
|
|
|
561
565
|
"zh-TW": { back: "回到 Agent 清單" },
|
|
562
566
|
});
|
|
563
567
|
/** What Needs you counts: its items and the agents' proposals (the tab's badge, the sidebar's). */
|
|
564
|
-
|
|
568
|
+
/** M-3381: the rooms' restricted-mode suggestions count once (one group on the page), however many rooms. */
|
|
569
|
+
export function needsCount(app) {
|
|
570
|
+
const needs = Array.isArray(app.needs) ? app.needs : [], proposals = Array.isArray(app.proposals) ? app.proposals : [];
|
|
571
|
+
const suggestions = needs.filter(i => i?.type === "contact" && i.reason === "contact_restricted_suggestion").length;
|
|
572
|
+
return needs.length - suggestions + (suggestions ? 1 : 0) + proposals.length;
|
|
573
|
+
}
|
|
565
574
|
|
|
566
575
|
export function PanelHeader({ title, sub, children, headingRef, nav, notice, pageControls, pageActions, back = null }) {
|
|
567
576
|
const shell = useStore(shellStore);
|
|
@@ -625,7 +634,7 @@ function BottomTabs({ route, viewOnly }) {
|
|
|
625
634
|
// last tab), Settings.
|
|
626
635
|
return html`<nav data-trust="navigation" class="tabs" aria-label=${t("app.menu")}>
|
|
627
636
|
${tab(chatHref, "chat", t("app.chat"), !!open || (!!route && route.panel === "chat"), anyAwaiting)}
|
|
628
|
-
${tab(NEEDS_PATH, "inbox", t("app.needsTab"), route && route.panel === "needs", (app
|
|
637
|
+
${tab(NEEDS_PATH, "inbox", t("app.needsTab"), route && route.panel === "needs", needsCount(app), t("app.needsCount", needsCount(app)))}
|
|
629
638
|
${tab(fleetEntryPath(route), "fleet", t("app.fleet"), route && route.panel === "fleet")}
|
|
630
639
|
${tab(settingsPath(), "settings", t("app.settings"), route && route.panel === "settings")}
|
|
631
640
|
</nav>`;
|