@songsid/agend 2.4.0-beta.14 → 2.4.0-beta.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/auth-api.js +1 -0
- package/dist/auth-api.js.map +1 -1
- package/dist/build-provenance.json +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/fleet-manager.d.ts +9 -1
- package/dist/fleet-manager.js +63 -8
- 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-dashboard/SKILL.md +5 -0
- package/dist/locale.js +6 -0
- 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/ui/contact-auth-client.js +2 -0
- package/dist/ui/contact-auth-strings.js +37 -6
- package/dist/ui/contact-needs.js +18 -2
- package/dist/ui/contact-permissions.js +55 -10
- package/dist/ui/contact-tool-groups.js +39 -0
- package/dist/ui/panel-needs.js +7 -4
- package/dist/ui/settings-appearance.js +6 -1
- package/dist/ui/settings-registry.js +1 -1
- package/dist/ui/shared/app-i18n.js +4 -0
- package/dist/ui/shared/app-shell.js +16 -7
- package/dist/ui/shared/app.css +55 -0
- package/dist/ui/shared/theme-picker.js +46 -0
- package/dist/ui/shared/theme.js +36 -3
- package/dist/ui/shared/tokens.css +273 -0
- package/dist/ui/shared/ui-confirm.js +5 -2
- package/dist/web-api.d.ts +1 -0
- package/dist/web-api.js.map +1 -1
- package/package.json +1 -1
|
@@ -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/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>
|
|
@@ -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
|
}
|
|
@@ -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"], ["精簡", "暱稱", "實際名稱"]],
|
|
@@ -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>`;
|
package/dist/ui/shared/app.css
CHANGED
|
@@ -2259,6 +2259,8 @@ textarea.s-yaml { white-space: pre; overflow-x: auto; }
|
|
|
2259
2259
|
.n-group-head { display: flex; align-items: center; gap: var(--s-2); padding: var(--s-2) var(--s-1); color: var(--text-2); font-size: var(--fs-sm); font-weight: var(--fw-semibold); }
|
|
2260
2260
|
.n-group-head a { color: inherit; }
|
|
2261
2261
|
.n-group-head a:hover { text-decoration: underline; }
|
|
2262
|
+
/* M-3381: the rooms' restricted-mode suggestions, one closed group: its heading opens it. */
|
|
2263
|
+
.n-suggestions > summary { cursor: pointer; }
|
|
2262
2264
|
.n-item { display: flex; gap: var(--s-3); padding: var(--s-3) var(--s-4); border-radius: var(--r-md); background: var(--surface); margin-bottom: 2px; }
|
|
2263
2265
|
.n-icon { flex: none; margin-top: 2px; color: var(--warn); }
|
|
2264
2266
|
.n-item.bad .n-icon { color: var(--danger); }
|
|
@@ -2275,6 +2277,10 @@ textarea.s-yaml { white-space: pre; overflow-x: auto; }
|
|
|
2275
2277
|
.notice-new { font-size: var(--fs-xs); color: var(--accent); font-weight: var(--fw-semibold); }
|
|
2276
2278
|
.notice-sub { margin: 0 var(--s-1) var(--s-3); }
|
|
2277
2279
|
.confirm-text { white-space: pre-wrap; font-size: var(--fs-sm); color: var(--text-2); }
|
|
2280
|
+
/* M-3387: a list closed under a confirm's text (every tool name a restricted switch stops), and the same on Permissions. */
|
|
2281
|
+
.confirm-more, .contact-would-all { margin-top: var(--s-2); font-size: var(--fs-sm); color: var(--text-2); }
|
|
2282
|
+
.confirm-more > summary, .contact-would-all > summary { cursor: pointer; }
|
|
2283
|
+
.confirm-more ul, .contact-would-all ul { margin: var(--s-1) 0 0; padding-left: var(--s-4); }
|
|
2278
2284
|
|
|
2279
2285
|
/* ── Org chart (#1389): General → teams → instances. Connectors are borders and pseudo-elements; no inline style.
|
|
2280
2286
|
Desktop: General's stem meets the bus over the team grid (no per-team ticks: a wrapped row would have nothing to
|
|
@@ -4854,3 +4860,52 @@ html.oo-immersive .p-fleet > .panel-body { z-index: 50; }
|
|
|
4854
4860
|
.msg .meta .contact-badge { display: inline-flex; align-items: center; margin-left: var(--s-2); padding: 0 var(--s-2); border-radius: 999px; font-size: var(--fs-xs); font-weight: var(--fw-semibold);
|
|
4855
4861
|
color: var(--warn); background: var(--warn-bg); border: 1px solid var(--warn-line); text-decoration: none; }
|
|
4856
4862
|
.msg .meta .contact-badge.ok { color: var(--ok); background: var(--ok-bg); border-color: transparent; }
|
|
4863
|
+
|
|
4864
|
+
/* M-3368: a centred colour chooser on both layouts; every miniature uses the page's own palette tokens. */
|
|
4865
|
+
.dlg.theme-picker { width: min(560px, calc(100vw - 32px)); height: fit-content; max-height: 90dvh; margin: auto; border-radius: var(--r-lg); }
|
|
4866
|
+
.theme-picker .dlg-box { height: auto; max-height: 90dvh; }
|
|
4867
|
+
.theme-picker .dlg-body { min-height: 0; }
|
|
4868
|
+
.theme-picker .dlg-head, .theme-picker .dlg-actions { flex: none; }
|
|
4869
|
+
.theme-colours { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-3); }
|
|
4870
|
+
.theme-colour { position: relative; display: flex; flex-direction: column; min-width: 0; gap: var(--s-2); padding: var(--s-2); border: 2px solid var(--border-strong); border-radius: var(--r-md); cursor: pointer; }
|
|
4871
|
+
.theme-colour.selected { border-color: var(--accent); outline: 2px solid var(--accent); outline-offset: 2px; }
|
|
4872
|
+
.theme-colour:focus-within { outline: 2px solid var(--focus); outline-offset: 2px; }
|
|
4873
|
+
.theme-colour > input { position: absolute; opacity: 0; width: 1px; height: 1px; }
|
|
4874
|
+
.theme-colour-name { display: flex; align-items: center; gap: var(--s-1); font-size: var(--fs-sm); font-weight: var(--fw-medium); }
|
|
4875
|
+
.theme-tick { margin-left: auto; width: var(--s-4); flex: none; }
|
|
4876
|
+
.theme-swatch { display: flex; width: 100%; height: 64px; overflow: hidden; border-radius: var(--r-sm); background: var(--bg); }
|
|
4877
|
+
.theme-swatch-side { width: 28%; display: flex; flex-direction: column; gap: var(--s-1); padding: var(--s-2) var(--s-1); background: var(--bg-sidebar); }
|
|
4878
|
+
.theme-swatch-side i { height: var(--s-1); background: var(--accent-fill); border-radius: var(--r-full); }
|
|
4879
|
+
.theme-swatch-chat { flex: 1; display: flex; flex-direction: column; align-items: flex-start; gap: var(--s-2); padding: var(--s-2); }
|
|
4880
|
+
.theme-swatch-chat i { width: 75%; height: var(--s-3); background: var(--user-bubble); border-radius: var(--r-sm); }
|
|
4881
|
+
.theme-swatch-chat i:last-child { width: 50%; align-self: flex-end; background: var(--accent-fill); }
|
|
4882
|
+
.theme-appearance { border: 0; padding: 0; margin: var(--s-2) 0 0; min-width: 0; }
|
|
4883
|
+
.theme-appearance legend { padding: 0; margin-bottom: var(--s-2); font-weight: var(--fw-medium); }
|
|
4884
|
+
.theme-mode-options { display: flex; flex-wrap: wrap; gap: var(--s-3); }
|
|
4885
|
+
.theme-mode-options .check { min-height: var(--tap); }
|
|
4886
|
+
.s-theme-colours { align-self: flex-start; }
|
|
4887
|
+
.s-theme-colours-row > .grow { display: flex; align-items: center; gap: var(--s-2); min-width: 0; }
|
|
4888
|
+
@media (max-width: 899px), (pointer: coarse) and (max-height: 500px) and (max-width: 1023px) {
|
|
4889
|
+
.s-theme-colours { min-width: var(--tap); min-height: var(--tap); }
|
|
4890
|
+
.theme-colours { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-2); }
|
|
4891
|
+
.theme-picker .dlg-head { padding-top: var(--s-3); }
|
|
4892
|
+
.theme-picker .dlg-body { padding-bottom: var(--s-2); }
|
|
4893
|
+
.theme-picker .dlg-actions { padding-top: var(--s-2); }
|
|
4894
|
+
.theme-mode-options { gap: var(--s-2); }
|
|
4895
|
+
}
|
|
4896
|
+
|
|
4897
|
+
/* Meadow keeps the surrounding UI neutral; inline agent colours still override these inherited tokens. */
|
|
4898
|
+
:root[data-palette="meadow"] .shell:not(.th-page) .p-chat { --bg: var(--palette-chat-bg); --text-2: var(--palette-chat-text-2); --text-3: var(--palette-chat-text-3); background: var(--bg); color: var(--text); }
|
|
4899
|
+
:root[data-palette="meadow"] .shell:not(.th-page) .p-chat > .panel-head { background: var(--surface-2); }
|
|
4900
|
+
:root[data-palette="meadow"] .shell:not(.th-page) .p-chat .msg .meta { width: fit-content; padding: 0 var(--s-1); border-radius: var(--r-sm); background: var(--surface); }
|
|
4901
|
+
:root[data-palette="meadow"] .shell:not(.th-page) .p-chat .msg.user .meta { margin-left: auto; }
|
|
4902
|
+
.theme-swatch[data-palette="meadow"] .theme-swatch-chat { background: var(--palette-chat-bg); }
|
|
4903
|
+
.theme-swatch[data-palette="meadow"] .theme-swatch-chat i:last-child { background: var(--accent-decoration); }
|
|
4904
|
+
|
|
4905
|
+
/* M3377: original leaf/grass art is static on the panel; only its child messages scroll. */
|
|
4906
|
+
:root[data-palette="meadow"] .shell:not(.th-page) .p-chat:not([style*="--bg:"]) {
|
|
4907
|
+
background-image: var(--meadow-wallpaper-tile), linear-gradient(145deg, var(--meadow-wallpaper-start), var(--meadow-wallpaper-end));
|
|
4908
|
+
background-size: 192px 192px, 100% 100%;
|
|
4909
|
+
background-position: 0 0, 0 0;
|
|
4910
|
+
background-repeat: repeat, no-repeat;
|
|
4911
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
// Built-in colours use the existing root tokens and mode controller; this dialog only edits that browser choice.
|
|
2
|
+
import { html, useEffect, useRef, useState } from "./app-html.js";
|
|
3
|
+
import { Dialog } from "./ui-dialog.js";
|
|
4
|
+
import { t } from "./app-i18n.js";
|
|
5
|
+
import { savePref, withoutHold } from "./app-prefs.js";
|
|
6
|
+
|
|
7
|
+
export const BUILTIN_PALETTES = Object.freeze(["", "sky", "meadow", "violet", "mint"]);
|
|
8
|
+
export const paletteName = (id) => t(`app.palette${id ? id[0].toUpperCase() + id.slice(1) : "Default"}`);
|
|
9
|
+
|
|
10
|
+
export function ThemePicker({ onClose }) {
|
|
11
|
+
const T = globalThis.AgendTheme;
|
|
12
|
+
const [mode, setMode] = useState(T?.get?.() || "system"), [palette, setPalette] = useState(T?.getPalette?.() || "");
|
|
13
|
+
const draft = useRef({ mode, palette });
|
|
14
|
+
const [systemLight, setSystemLight] = useState(() => globalThis.matchMedia?.("(prefers-color-scheme: light)").matches === true);
|
|
15
|
+
const lease = useRef(null);
|
|
16
|
+
const closing = useRef(false);
|
|
17
|
+
if (!lease.current) lease.current = T?.beginPreview?.();
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
const media = globalThis.matchMedia?.("(prefers-color-scheme: light)");
|
|
20
|
+
const changed = () => setSystemLight(media.matches);
|
|
21
|
+
const unsubscribe = T?.onChange?.(() => {
|
|
22
|
+
if (!closing.current && lease.current?.isCurrent?.() === false) { closing.current = true; onClose(); }
|
|
23
|
+
});
|
|
24
|
+
media?.addEventListener?.("change", changed);
|
|
25
|
+
return () => { unsubscribe?.(); media?.removeEventListener?.("change", changed); lease.current?.cancel(); };
|
|
26
|
+
}, []);
|
|
27
|
+
const update = (nextMode, nextPalette) => { draft.current = { mode: nextMode, palette: nextPalette }; setMode(nextMode); setPalette(nextPalette); lease.current?.update(nextMode, nextPalette); };
|
|
28
|
+
const cancel = () => { closing.current = true; lease.current?.cancel(); onClose(); };
|
|
29
|
+
const apply = () => { closing.current = true; if (lease.current?.commit()) withoutHold(() => savePref("theme", draft.current.mode)); onClose(); };
|
|
30
|
+
const tone = mode === "system" ? systemLight ? "light" : "dark" : mode;
|
|
31
|
+
return html`<${Dialog} title=${t("app.colours")} cls="theme-picker" onClose=${cancel} actions=${html`
|
|
32
|
+
<button type="button" class="btn theme-cancel" onClick=${cancel}>${t("app.cancel")}</button>
|
|
33
|
+
<button type="button" class="btn btn-primary theme-apply" onClick=${apply}>${t("app.apply")}</button>`}>
|
|
34
|
+
<div class="theme-colours" role="radiogroup" aria-label=${t("app.colours")}>
|
|
35
|
+
${BUILTIN_PALETTES.map(id => html`<label key=${id} class=${`theme-colour${palette === id ? " selected" : ""}`}>
|
|
36
|
+
<input type="radio" name="builtin-palette" value=${id} checked=${palette === id} onChange=${(e) => { if (e.currentTarget.checked) update(draft.current.mode, id); }} />
|
|
37
|
+
<span class="theme-swatch" data-palette=${id} data-tone=${tone} aria-hidden="true"><span class="theme-swatch-side"><i></i><i></i></span><span class="theme-swatch-chat"><i></i><i></i></span></span>
|
|
38
|
+
<span class="theme-colour-name">${paletteName(id)}<span class="theme-tick" aria-hidden="true">${palette === id ? "✓" : ""}</span></span>
|
|
39
|
+
</label>`)}
|
|
40
|
+
</div>
|
|
41
|
+
<fieldset class="theme-appearance"><legend>${t("app.theme")}</legend><div class="theme-mode-options">
|
|
42
|
+
${["system", "light", "dark"].map(value => html`<label class="check"><input type="radio" name="builtin-appearance" value=${value} checked=${mode === value}
|
|
43
|
+
onChange=${(e) => { if (e.currentTarget.checked) update(value, draft.current.palette); }} /><span>${t(`app.theme${value[0].toUpperCase() + value.slice(1)}`)}</span></label>`)}
|
|
44
|
+
</div></fieldset>
|
|
45
|
+
</${Dialog}>`;
|
|
46
|
+
}
|
package/dist/ui/shared/theme.js
CHANGED
|
@@ -14,8 +14,11 @@
|
|
|
14
14
|
(function () {
|
|
15
15
|
"use strict";
|
|
16
16
|
var KEY = "agend_theme";
|
|
17
|
+
var PALETTE_KEY = "agend_palette";
|
|
18
|
+
var PALETTES = ["sky", "meadow", "violet", "mint"];
|
|
17
19
|
var SYNCED_FLAG = "agend_prefs_synced";
|
|
18
20
|
function valid(v) { return v === "light" || v === "dark" ? v : "system"; }
|
|
21
|
+
function validPalette(v) { return PALETTES.indexOf(v) >= 0 ? v : ""; }
|
|
19
22
|
function read() {
|
|
20
23
|
try { return valid(localStorage.getItem(KEY)); } catch (e) { return "system"; } // storage blocked: follow the device
|
|
21
24
|
}
|
|
@@ -26,6 +29,8 @@
|
|
|
26
29
|
var root = document.documentElement;
|
|
27
30
|
if (v === "system") root.removeAttribute("data-theme");
|
|
28
31
|
else root.setAttribute("data-theme", v);
|
|
32
|
+
if (palette) root.setAttribute("data-palette", palette);
|
|
33
|
+
else root.removeAttribute("data-palette");
|
|
29
34
|
}
|
|
30
35
|
/** The host's choice for this page: a theme, or null — none known here (no data-prefs, or not in step yet). */
|
|
31
36
|
function hostChoice() {
|
|
@@ -39,18 +44,46 @@
|
|
|
39
44
|
return inStep ? "system" : null;
|
|
40
45
|
}
|
|
41
46
|
var current = hostChoice();
|
|
47
|
+
// Built-in colours are this browser's base palette. Agent page colours and owner CSS remain above it.
|
|
48
|
+
var palette = "";
|
|
49
|
+
try { palette = validPalette(localStorage.getItem(PALETTE_KEY)); } catch (e) { /* default */ }
|
|
42
50
|
if (current !== null) cache(current); else current = read();
|
|
43
51
|
apply(current);
|
|
44
52
|
var listeners = [];
|
|
53
|
+
var preview = null;
|
|
54
|
+
function retirePreview() {
|
|
55
|
+
if (preview) { current = preview.mode; palette = preview.colours; preview = null; }
|
|
56
|
+
}
|
|
57
|
+
function changed() {
|
|
58
|
+
apply(current);
|
|
59
|
+
for (var i = 0; i < listeners.length; i++) { try { listeners[i](current); } catch (e) { /* independent listeners */ } }
|
|
60
|
+
}
|
|
61
|
+
function cachePalette() {
|
|
62
|
+
try { if (palette) localStorage.setItem(PALETTE_KEY, palette); else localStorage.removeItem(PALETTE_KEY); } catch (e) { /* this page only */ }
|
|
63
|
+
}
|
|
45
64
|
window.AgendTheme = {
|
|
46
65
|
/** The theme this page shows. */
|
|
47
66
|
get: function () { return current; },
|
|
67
|
+
getPalette: function () { return palette; },
|
|
68
|
+
setPalette: function (v) { retirePreview(); palette = validPalette(v); cachePalette(); changed(); },
|
|
48
69
|
/** Choose "system", "light" or "dark" (this browser's copy; app-prefs.js keeps the host's); applied now even when it cannot be stored. */
|
|
49
70
|
set: function (v) {
|
|
71
|
+
retirePreview();
|
|
50
72
|
current = valid(v);
|
|
51
73
|
cache(current);
|
|
52
|
-
|
|
53
|
-
|
|
74
|
+
changed();
|
|
75
|
+
},
|
|
76
|
+
/** A dialog's temporary paint. An outside choice retires it; cancel never overwrites that newer choice. */
|
|
77
|
+
beginPreview: function () {
|
|
78
|
+
retirePreview();
|
|
79
|
+
var lease = { mode: current, colours: palette }, before = current, beforePalette = palette;
|
|
80
|
+
preview = lease;
|
|
81
|
+
return {
|
|
82
|
+
isCurrent: function () { return preview === lease; },
|
|
83
|
+
update: function (mode, colours) { if (preview !== lease) return; current = valid(mode); palette = validPalette(colours); changed(); },
|
|
84
|
+
cancel: function () { if (preview !== lease) return; preview = null; current = before; palette = beforePalette; changed(); },
|
|
85
|
+
commit: function () { if (preview !== lease) return false; preview = null; cache(current); cachePalette(); changed(); return true; },
|
|
86
|
+
};
|
|
54
87
|
},
|
|
55
88
|
/** Call `fn` with the theme whenever it changes on this page (an open Preferences shows it); returns the unsubscribe. */
|
|
56
89
|
onChange: function (fn) {
|
|
@@ -108,6 +141,6 @@
|
|
|
108
141
|
// Page palettes are applied to the shell; routes replace headers. Coalesce paints and
|
|
109
142
|
// ignore content attributes so updating this meta element cannot trigger itself.
|
|
110
143
|
new MutationObserver(schedule).observe(document.documentElement, {
|
|
111
|
-
subtree: true, childList: true, attributes: true, attributeFilter: ["class", "style", "data-theme", "data-agent"],
|
|
144
|
+
subtree: true, childList: true, attributes: true, attributeFilter: ["class", "style", "data-theme", "data-palette", "data-agent"],
|
|
112
145
|
});
|
|
113
146
|
})();
|