@songsid/agend 2.3.5-alpha.5 → 2.3.5-alpha.6
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/THIRD_PARTY_NOTICES.md +0 -1
- package/dist/accounts-profiles.d.ts +96 -0
- package/dist/accounts-profiles.js +178 -0
- package/dist/accounts-profiles.js.map +1 -0
- package/dist/accounts-signout.d.ts +59 -0
- package/dist/accounts-signout.js +184 -0
- package/dist/accounts-signout.js.map +1 -0
- package/dist/accounts-view.d.ts +54 -0
- package/dist/accounts-view.js +55 -11
- package/dist/accounts-view.js.map +1 -1
- package/dist/agent-workspace.d.ts +11 -0
- package/dist/agent-workspace.js +28 -0
- package/dist/agent-workspace.js.map +1 -1
- package/dist/auth-api.js +27 -5
- package/dist/auth-api.js.map +1 -1
- package/dist/authority/session-authorizations.d.ts +2 -0
- package/dist/authority/session-authorizations.js +7 -1
- package/dist/authority/session-authorizations.js.map +1 -1
- package/dist/backend/codex.js +1 -0
- package/dist/backend/codex.js.map +1 -1
- package/dist/backend/types.d.ts +2 -0
- package/dist/backend/types.js.map +1 -1
- package/dist/build-provenance.json +1 -1
- package/dist/bundled-tmux-guard.d.ts +19 -0
- package/dist/bundled-tmux-guard.js +83 -0
- package/dist/bundled-tmux-guard.js.map +1 -0
- package/dist/classic-bindings.d.ts +13 -0
- package/dist/classic-bindings.js +28 -2
- package/dist/classic-bindings.js.map +1 -1
- package/dist/classic-channel-manager.d.ts +2 -0
- package/dist/classic-channel-manager.js +5 -1
- package/dist/classic-channel-manager.js.map +1 -1
- package/dist/cli.js +116 -11
- package/dist/cli.js.map +1 -1
- package/dist/config-validator.js +11 -0
- package/dist/config-validator.js.map +1 -1
- package/dist/config.js +3 -1
- package/dist/config.js.map +1 -1
- package/dist/daemon.d.ts +27 -2
- package/dist/daemon.js +107 -6
- package/dist/daemon.js.map +1 -1
- package/dist/doctor.js +3 -4
- package/dist/doctor.js.map +1 -1
- package/dist/e2e-isolation.js +5 -2
- package/dist/e2e-isolation.js.map +1 -1
- package/dist/fleet-control-audit.d.ts +1 -1
- package/dist/fleet-manager.d.ts +129 -0
- package/dist/fleet-manager.js +725 -53
- package/dist/fleet-manager.js.map +1 -1
- package/dist/general-knowledge/skills/credential-profiles/SKILL.md +10 -0
- package/dist/hub/compose/server.js +1 -0
- package/dist/hub/compose/server.js.map +1 -1
- package/dist/hub/directory/directory.d.ts +1 -1
- package/dist/hub/directory/directory.js +115 -3
- package/dist/hub/directory/directory.js.map +1 -1
- package/dist/hub/directory/groups.d.ts +29 -0
- package/dist/hub/directory/groups.js +29 -0
- package/dist/hub/directory/groups.js.map +1 -0
- package/dist/hub/directory/index.d.ts +1 -0
- package/dist/hub/directory/types.d.ts +4 -0
- package/dist/hub/directory/types.js.map +1 -1
- package/dist/hub/group-policy/model.d.ts +56 -0
- package/dist/hub/group-policy/model.js +46 -0
- package/dist/hub/group-policy/model.js.map +1 -0
- package/dist/hub/group-policy/resources.d.ts +52 -0
- package/dist/hub/group-policy/resources.js +166 -0
- package/dist/hub/group-policy/resources.js.map +1 -0
- package/dist/hub/group-policy/store.d.ts +52 -0
- package/dist/hub/group-policy/store.js +149 -0
- package/dist/hub/group-policy/store.js.map +1 -0
- package/dist/hub/http/compose.js +4 -3
- package/dist/hub/http/compose.js.map +1 -1
- package/dist/hub/pairing.d.ts +3 -1
- package/dist/hub/pairing.js +6 -3
- package/dist/hub/pairing.js.map +1 -1
- package/dist/hub/server.d.ts +2 -0
- package/dist/hub/server.js +12 -2
- package/dist/hub/server.js.map +1 -1
- package/dist/instance-config-impact.js +4 -3
- package/dist/instance-config-impact.js.map +1 -1
- package/dist/instance-lifecycle.d.ts +17 -0
- package/dist/instance-lifecycle.js +38 -1
- package/dist/instance-lifecycle.js.map +1 -1
- package/dist/locale.js +21 -0
- package/dist/locale.js.map +1 -1
- package/dist/login-controller.d.ts +5 -0
- package/dist/login-controller.js +11 -0
- package/dist/login-controller.js.map +1 -1
- package/dist/login-window-lock.d.ts +2 -1
- package/dist/login-window-lock.js.map +1 -1
- package/dist/ls-rows.d.ts +1 -1
- package/dist/ls-rows.js +1 -1
- package/dist/ls-rows.js.map +1 -1
- package/dist/machine-accounts.d.ts +110 -0
- package/dist/machine-accounts.js +229 -0
- package/dist/machine-accounts.js.map +1 -0
- package/dist/machine-signins.d.ts +89 -0
- package/dist/machine-signins.js +182 -0
- package/dist/machine-signins.js.map +1 -0
- package/dist/muse-usage-relay.d.ts +2 -0
- package/dist/muse-usage-relay.js +5 -3
- package/dist/muse-usage-relay.js.map +1 -1
- package/dist/needs-you-hub.d.ts +3 -0
- package/dist/needs-you-hub.js +13 -3
- package/dist/needs-you-hub.js.map +1 -1
- package/dist/needs-you.d.ts +35 -2
- package/dist/needs-you.js +19 -0
- package/dist/needs-you.js.map +1 -1
- package/dist/quickstart.js +7 -18
- package/dist/quickstart.js.map +1 -1
- package/dist/quiet-run.d.ts +31 -0
- package/dist/quiet-run.js +50 -0
- package/dist/quiet-run.js.map +1 -0
- package/dist/quota-notice-config.d.ts +22 -0
- package/dist/quota-notice-config.js +41 -0
- package/dist/quota-notice-config.js.map +1 -0
- package/dist/runtime-api.d.ts +13 -0
- package/dist/runtime-api.js +125 -1
- package/dist/runtime-api.js.map +1 -1
- package/dist/runtime-build-info.d.ts +2 -1
- package/dist/runtime-build-info.js +7 -3
- package/dist/runtime-build-info.js.map +1 -1
- package/dist/runtime-cli-install.d.ts +153 -0
- package/dist/runtime-cli-install.js +675 -0
- package/dist/runtime-cli-install.js.map +1 -0
- package/dist/runtime-cli.js +157 -12
- package/dist/runtime-cli.js.map +1 -1
- package/dist/runtime-client.d.ts +64 -2
- package/dist/runtime-client.js +277 -20
- package/dist/runtime-client.js.map +1 -1
- package/dist/runtime-coordinator.d.ts +10 -1
- package/dist/runtime-coordinator.js +93 -2
- package/dist/runtime-coordinator.js.map +1 -1
- package/dist/runtime-credential-profiles.d.ts +11 -2
- package/dist/runtime-credential-profiles.js +28 -4
- package/dist/runtime-credential-profiles.js.map +1 -1
- package/dist/runtime-install.js +9 -6
- package/dist/runtime-install.js.map +1 -1
- package/dist/runtime-pane-link.js +2 -1
- package/dist/runtime-pane-link.js.map +1 -1
- package/dist/runtime-pane-service.js +2 -2
- package/dist/runtime-pane-service.js.map +1 -1
- package/dist/runtime-pane-store.d.ts +10 -0
- package/dist/runtime-pane-store.js +13 -1
- package/dist/runtime-pane-store.js.map +1 -1
- package/dist/runtime-profile-ownership.d.ts +66 -0
- package/dist/runtime-profile-ownership.js +391 -0
- package/dist/runtime-profile-ownership.js.map +1 -0
- package/dist/runtime-protocol.d.ts +88 -2
- package/dist/runtime-protocol.js +40 -0
- package/dist/runtime-protocol.js.map +1 -1
- package/dist/runtime-remote-accounts.d.ts +197 -0
- package/dist/runtime-remote-accounts.js +663 -0
- package/dist/runtime-remote-accounts.js.map +1 -0
- package/dist/runtime-remote-setup.d.ts +105 -0
- package/dist/runtime-remote-setup.js +529 -0
- package/dist/runtime-remote-setup.js.map +1 -0
- package/dist/runtime-signin-transport.d.ts +39 -0
- package/dist/runtime-signin-transport.js +110 -0
- package/dist/runtime-signin-transport.js.map +1 -0
- package/dist/runtime-signin.d.ts +132 -0
- package/dist/runtime-signin.js +289 -0
- package/dist/runtime-signin.js.map +1 -0
- package/dist/runtime-update-attention.d.ts +4 -0
- package/dist/runtime-update-attention.js +11 -0
- package/dist/runtime-update-attention.js.map +1 -0
- package/dist/runtime-update-controller.d.ts +75 -0
- package/dist/runtime-update-controller.js +691 -0
- package/dist/runtime-update-controller.js.map +1 -0
- package/dist/runtime-update-ipc.d.ts +42 -0
- package/dist/runtime-update-ipc.js +144 -0
- package/dist/runtime-update-ipc.js.map +1 -0
- package/dist/runtime-update-journal.d.ts +5 -0
- package/dist/runtime-update-journal.js +7 -0
- package/dist/runtime-update-journal.js.map +1 -1
- package/dist/runtime-update-lock.js +17 -2
- package/dist/runtime-update-lock.js.map +1 -1
- package/dist/runtime-update-status.d.ts +30 -0
- package/dist/runtime-update-status.js +31 -0
- package/dist/runtime-update-status.js.map +1 -0
- package/dist/settings-api.js +3 -0
- package/dist/settings-api.js.map +1 -1
- package/dist/settings-change.js +8 -0
- package/dist/settings-change.js.map +1 -1
- package/dist/settings-instance-patch.js +1 -1
- package/dist/settings-instance-patch.js.map +1 -1
- package/dist/setup-wizard.js +3 -5
- package/dist/setup-wizard.js.map +1 -1
- package/dist/signin-keepalive.d.ts +203 -0
- package/dist/signin-keepalive.js +652 -0
- package/dist/signin-keepalive.js.map +1 -0
- package/dist/structured-signin-transport.js +4 -0
- package/dist/structured-signin-transport.js.map +1 -1
- package/dist/structured-signin.d.ts +7 -0
- package/dist/structured-signin.js +1 -1
- package/dist/structured-signin.js.map +1 -1
- package/dist/tmux-binary.d.ts +23 -23
- package/dist/tmux-binary.js +35 -46
- package/dist/tmux-binary.js.map +1 -1
- package/dist/tmux-exec-helper.js +3 -3
- package/dist/tmux-exec-helper.js.map +1 -1
- package/dist/tmux-legacy.d.ts +94 -0
- package/dist/tmux-legacy.js +309 -0
- package/dist/tmux-legacy.js.map +1 -0
- package/dist/tmux-manager.d.ts +7 -1
- package/dist/tmux-manager.js +21 -11
- package/dist/tmux-manager.js.map +1 -1
- package/dist/tmux-rollback.d.ts +31 -0
- package/dist/tmux-rollback.js +72 -0
- package/dist/tmux-rollback.js.map +1 -0
- package/dist/tmux-server.d.ts +102 -0
- package/dist/tmux-server.js +248 -0
- package/dist/tmux-server.js.map +1 -0
- package/dist/transcript-monitor.js +43 -5
- package/dist/transcript-monitor.js.map +1 -1
- package/dist/transcript-records.d.ts +2 -1
- package/dist/transcript-records.js +3 -0
- package/dist/transcript-records.js.map +1 -1
- package/dist/transcript-sources.js +3 -0
- package/dist/transcript-sources.js.map +1 -1
- package/dist/types.d.ts +3 -0
- package/dist/ui/accounts-keepalive.js +112 -0
- package/dist/ui/accounts-manage.js +237 -0
- package/dist/ui/accounts-view.js +175 -31
- package/dist/ui/agent-runtime-settings.js +2 -1
- package/dist/ui/app.html +8 -1
- package/dist/ui/hub-attachments.js +90 -0
- package/dist/ui/hub-chat-store.js +9 -4
- package/dist/ui/hub-client.js +20 -1
- package/dist/ui/hub-preview.js +101 -0
- package/dist/ui/machine-signin.js +56 -0
- package/dist/ui/panel-fleet.js +1 -1
- package/dist/ui/panel-hub.js +126 -31
- package/dist/ui/panel-needs.js +14 -8
- package/dist/ui/panel-notices.js +4 -3
- package/dist/ui/panel-runtimes.js +19 -6
- package/dist/ui/panel-settings.js +12 -6
- package/dist/ui/panel-windows-agent.js +2 -1
- package/dist/ui/preview-pages.js +3 -41
- package/dist/ui/preview-panel-actions.js +3 -161
- package/dist/ui/preview-panel.js +10 -557
- package/dist/ui/preview-versions.js +3 -155
- package/dist/ui/runtime-cli-install.js +114 -0
- package/dist/ui/runtime-update-commands.d.ts +2 -0
- package/dist/ui/runtime-update-commands.js +11 -0
- package/dist/ui/runtime-update-status.js +53 -0
- package/dist/ui/search-dialog.js +3 -2
- package/dist/ui/settings-guests.js +3 -2
- package/dist/ui/settings-hub-browser-certificate.js +2 -0
- package/dist/ui/settings-hub-membership.js +12 -6
- package/dist/ui/settings-hub-retention.js +2 -0
- package/dist/ui/settings-hub.js +11 -3
- package/dist/ui/settings-quota-notice.js +100 -0
- package/dist/ui/settings-registry.js +1 -0
- package/dist/ui/settings-strings.js +2 -2
- package/dist/ui/settings-web-authority.js +2 -1
- package/dist/ui/shared/accounts-keepalive.css +7 -0
- package/dist/ui/shared/accounts.css +13 -0
- package/dist/ui/shared/app-route.js +1 -1
- package/dist/ui/shared/app-shell.js +9 -3
- package/dist/ui/shared/app-store.js +2 -2
- package/dist/ui/shared/app.css +13 -0
- package/dist/ui/shared/app.js +2 -1
- package/dist/ui/shared/hub-chat.css +1 -0
- package/dist/ui/shared/hub-owner.css +1 -1
- package/dist/ui/shared/loading.css +37 -0
- package/dist/ui/shared/preview-pages.js +41 -0
- package/dist/ui/shared/preview-panel-actions.js +168 -0
- package/dist/ui/shared/preview-panel.js +565 -0
- package/dist/ui/shared/preview-versions.js +155 -0
- package/dist/ui/shared/runtime-install.css +4 -0
- package/dist/ui/shared/signin.js +68 -6
- package/dist/ui/shared/ui-states.js +14 -3
- package/dist/ui/shared/workspace-follow.css +19 -0
- package/dist/ui/signin.html +7 -3
- package/dist/ui/structured-signin.js +31 -7
- package/dist/ui/workspace-follow-strings.js +28 -0
- package/dist/ui/workspace-panel.js +225 -36
- package/dist/update-install.d.ts +7 -0
- package/dist/update-install.js +23 -0
- package/dist/update-install.js.map +1 -1
- package/dist/usage/providers.d.ts +5 -0
- package/dist/usage/providers.js +5 -0
- package/dist/usage/providers.js.map +1 -1
- package/dist/usage/quota-notices.d.ts +38 -0
- package/dist/usage/quota-notices.js +160 -0
- package/dist/usage/quota-notices.js.map +1 -0
- package/dist/usage/usage-api.d.ts +1 -0
- package/dist/usage/usage-api.js +16 -0
- package/dist/usage/usage-api.js.map +1 -1
- package/dist/web-api.d.ts +33 -0
- package/dist/web-api.js +342 -8
- package/dist/web-api.js.map +1 -1
- package/dist/web-login.d.ts +35 -1
- package/dist/web-login.js +51 -5
- package/dist/web-login.js.map +1 -1
- package/dist/web-session.d.ts +11 -0
- package/dist/web-session.js +38 -1
- package/dist/web-session.js.map +1 -1
- package/dist/web-shell-routes.d.ts +1 -1
- package/dist/web-shell-routes.js +1 -1
- package/dist/web-shell-routes.js.map +1 -1
- package/dist/web-signin-link.d.ts +42 -0
- package/dist/web-signin-link.js +110 -0
- package/dist/web-signin-link.js.map +1 -0
- package/dist/windows-cli-api.d.ts +6 -0
- package/dist/windows-cli-api.js +11 -0
- package/dist/windows-cli-api.js.map +1 -1
- package/dist/windows-cli-worker.d.ts +3 -1
- package/dist/windows-cli-worker.js +18 -3
- package/dist/windows-cli-worker.js.map +1 -1
- package/dist/workspace-follow-parse.d.ts +36 -0
- package/dist/workspace-follow-parse.js +208 -0
- package/dist/workspace-follow-parse.js.map +1 -0
- package/dist/workspace-follow-records.d.ts +17 -0
- package/dist/workspace-follow-records.js +88 -0
- package/dist/workspace-follow-records.js.map +1 -0
- package/dist/workspace-follow.d.ts +41 -0
- package/dist/workspace-follow.js +143 -0
- package/dist/workspace-follow.js.map +1 -0
- package/dist/wsl-detect.d.ts +1 -0
- package/dist/wsl-detect.js +20 -0
- package/dist/wsl-detect.js.map +1 -0
- package/launcher/tmux-bundle.cjs +26 -10
- package/package.json +6 -2
- package/templates/runtime-install/install.ps1 +154 -13
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { html, useEffect, useMemo, useState } from "/assets/app-html.js";
|
|
2
|
+
import { lang } from "/assets/app-i18n.js";
|
|
3
|
+
import { useDraft, syncStage } from "./settings-draft.js";
|
|
4
|
+
|
|
5
|
+
const COPY = {
|
|
6
|
+
en: { title: "Notifications", heading: "Quota notices", hint: "One reminder per account, shared by its enabled agents. Exhaustion, pause and auto-continue messages are always kept.",
|
|
7
|
+
classic: "ClassicBot", periodExample: "weekly", scope: "Rule for", fleet: "Fleet default", backend: "Backend", agent: "Agent", enabled: "Reminders", inherit: "Inherit", on: "On", off: "Off",
|
|
8
|
+
thresholds: "Remaining percentages", thresholdHint: "Comma-separated, 1–99 (up to 8). Blank inherits; none disables reminders.",
|
|
9
|
+
periods: "Periods", periodHint: "session, hourly, daily, weekly, monthly. Comma-separated; blank inherits; none disables reminders.",
|
|
10
|
+
target: "Send to", general: "General", error: "Check percentages and periods. Changes cannot be saved yet.",
|
|
11
|
+
old: "This server does not support quota notice settings. Update AgEnD to edit them.",
|
|
12
|
+
sources: "Only fresh account usage with a known reset is used. Unsupported or stale readings do not send reminders. Enabled agents contribute a union of rules; disabling one does not silence others.",
|
|
13
|
+
effective: "In effect", defaults: "Built-in: on · 10% remaining · weekly · General", saved: "Quota notices" },
|
|
14
|
+
"zh-TW": { title: "通知", heading: "用量提醒", hint: "同一帳號共用一份提醒,由啟用提醒的 Agent 合併規則。額度耗盡、暫停與自動繼續的狀態訊息一律保留。",
|
|
15
|
+
classic: "ClassicBot", periodExample: "weekly", scope: "設定對象", fleet: "全隊預設", backend: "後端", agent: "Agent", enabled: "提醒", inherit: "繼承", on: "開啟", off: "關閉",
|
|
16
|
+
thresholds: "剩餘百分比", thresholdHint: "以逗號分隔,1–99,最多 8 個。空白表示繼承;none 表示不提醒。",
|
|
17
|
+
periods: "週期", periodHint: "session(工作階段)、hourly(每小時)、daily(每日)、weekly(每週)、monthly(每月)。以逗號分隔;空白繼承;none 不提醒。",
|
|
18
|
+
target: "傳送至", general: "General", error: "請檢查百分比與週期,目前無法儲存。",
|
|
19
|
+
old: "此伺服器尚未支援用量提醒設定,請更新 AgEnD 後再編輯。",
|
|
20
|
+
sources: "只採用有重設時間的最新帳號用量。不支援或過期的資料不會產生提醒。各 Agent 的規則取聯集;關閉其中一個不會關掉其他 Agent 的提醒。",
|
|
21
|
+
effective: "目前生效", defaults: "內建預設:開啟 · 剩餘 10% · 每週 · General", saved: "用量提醒" },
|
|
22
|
+
};
|
|
23
|
+
export const quotaNoticeText = () => COPY[lang()] || COPY.en;
|
|
24
|
+
const BACKENDS = ["claude-code", "codex", "kiro-cli", "grok", "antigravity", "muse"];
|
|
25
|
+
const PERIODS = ["session", "hourly", "daily", "weekly", "monthly"];
|
|
26
|
+
const same = (a, b) => JSON.stringify(a) === JSON.stringify(b);
|
|
27
|
+
const fieldKey = (scope, field) => JSON.stringify([scope, field]);
|
|
28
|
+
const ruleForm = (v = {}) => ({ enabled: v.enabled === undefined ? "" : v.enabled ? "on" : "off", thresholds: v.thresholds === undefined ? "" : v.thresholds.join(", ") || "none", periods: v.periods === undefined ? "" : v.periods.join(", ") || "none" });
|
|
29
|
+
export function quotaRuleFromForm(f) {
|
|
30
|
+
const rule = {};
|
|
31
|
+
if (f.enabled) rule.enabled = f.enabled === "on";
|
|
32
|
+
for (const k of ["thresholds", "periods"]) {
|
|
33
|
+
const raw = f[k].trim(); if (!raw) continue;
|
|
34
|
+
const values = raw === "none" ? [] : raw.split(",").map(v => v.trim());
|
|
35
|
+
const list = k === "thresholds" ? values.map(v => v === "" ? NaN : Number(v)) : values;
|
|
36
|
+
if (new Set(list).size !== list.length || (k === "thresholds" ? list.length > 8 || list.some(v => !Number.isFinite(v) || v < 1 || v > 99) : list.some(v => !PERIODS.includes(v)))) return null;
|
|
37
|
+
rule[k] = list;
|
|
38
|
+
}
|
|
39
|
+
return rule;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export function QuotaNoticeSettings({ ctx }) {
|
|
43
|
+
const text = quotaNoticeText();
|
|
44
|
+
const supported = ctx.schema?.impacts?.["instance.quota_notice"] === "now";
|
|
45
|
+
const instances = ctx.fleet.instances || {};
|
|
46
|
+
const classic = ctx.classic?.channels || {};
|
|
47
|
+
const base = useMemo(() => {
|
|
48
|
+
const d = ctx.fleet.defaults?.quota_notice || {};
|
|
49
|
+
return { target: d.target || "general", rules: Object.fromEntries([
|
|
50
|
+
["fleet", ruleForm(d)], ...BACKENDS.map(b => [`backend:${b}`, ruleForm(d.backends?.[b])]),
|
|
51
|
+
...Object.entries(instances).map(([n, c]) => [`agent:${n}`, ruleForm(c.quota_notice)]),
|
|
52
|
+
...Object.entries(classic).map(([n, c]) => [`classic:${n}`, ruleForm(c.quota_notice)]),
|
|
53
|
+
]) };
|
|
54
|
+
}, []);
|
|
55
|
+
// useDraft retains top-level edited fields. Flatten rules so an edit never
|
|
56
|
+
// freezes untouched rules (or untouched fields of the same rule) across reload.
|
|
57
|
+
const savedFields = useMemo(() => {
|
|
58
|
+
const saved = { target: base.target, ...Object.fromEntries(Object.entries(base.rules).flatMap(([scope, rule]) => Object.entries(rule).map(([field, value]) => [fieldKey(scope, field), value]))) };
|
|
59
|
+
const retained = ctx.drafts?.get("quota-notices");
|
|
60
|
+
if (retained) ctx.drafts.set("quota-notices", Object.fromEntries(Object.entries(retained).filter(([key]) => Object.hasOwn(saved, key))));
|
|
61
|
+
return saved;
|
|
62
|
+
}, []);
|
|
63
|
+
const [fields, setFields] = useDraft(ctx, "quota-notices", () => savedFields);
|
|
64
|
+
const form = useMemo(() => ({ target: fields.target, rules: Object.fromEntries(Object.entries(base.rules).map(([scope, rule]) => [scope, Object.fromEntries(Object.keys(rule).map(field => [field, fields[fieldKey(scope, field)]]))])) }), [fields]);
|
|
65
|
+
const [scope, setScope] = useState("fleet");
|
|
66
|
+
const parsed = Object.fromEntries(Object.entries(form.rules).map(([k, v]) => [k, quotaRuleFromForm(v)]));
|
|
67
|
+
const invalid = Object.values(parsed).some(v => v === null);
|
|
68
|
+
useEffect(() => {
|
|
69
|
+
if (!supported) return;
|
|
70
|
+
const defaults = { ...parsed.fleet, target: form.target, backends: Object.fromEntries(BACKENDS.flatMap(b => Object.keys(parsed[`backend:${b}`] || {}).length ? [[b, parsed[`backend:${b}`]]] : [])) };
|
|
71
|
+
const changed = !same(form.rules.fleet, base.rules.fleet) || form.target !== base.target || BACKENDS.some(b => !same(form.rules[`backend:${b}`], base.rules[`backend:${b}`]));
|
|
72
|
+
syncStage(ctx, "quota:defaults", changed ? { label: text.saved, impact: "now", ...(invalid ? { invalid: text.error } : { request: { method: "PUT", url: "/api/settings/fleet/defaults", body: { quota_notice: defaults } } }) } : null);
|
|
73
|
+
for (const [name, isClassic] of [...Object.keys(instances).map(n => [n, false]), ...Object.keys(classic).map(n => [n, true])]) {
|
|
74
|
+
const k = `${isClassic ? "classic" : "agent"}:${name}`, rule = parsed[k];
|
|
75
|
+
syncStage(ctx, `quota:${k}`, !same(form.rules[k], base.rules[k]) ? { label: `${text.saved} · ${name}`, impact: "now", ...(rule === null ? { invalid: text.error } : { request: { method: "PATCH", url: isClassic ? `/api/settings/classic/channels/${encodeURIComponent(name)}` : `/api/settings/fleet/instances/${encodeURIComponent(name)}`, body: { quota_notice: Object.keys(rule).length ? rule : null } } }) } : null);
|
|
76
|
+
}
|
|
77
|
+
}, [form, supported]);
|
|
78
|
+
const value = form.rules[scope];
|
|
79
|
+
const selectedBackend = scope.startsWith("backend:") ? scope.slice(8) : scope.startsWith("agent:") ? instances[scope.slice(6)]?.backend || ctx.fleet.defaults?.backend || "claude-code" : scope.startsWith("classic:") ? classic[scope.slice(8)]?.backend || ctx.classic?.defaults?.backend || ctx.fleet.defaults?.backend || "claude-code" : null;
|
|
80
|
+
const effective = { enabled: true, thresholds: [10], periods: ["weekly"], ...parsed.fleet,
|
|
81
|
+
...(selectedBackend ? parsed[`backend:${selectedBackend}`] : {}), ...(scope.startsWith("agent:") || scope.startsWith("classic:") ? parsed[scope] : {}) };
|
|
82
|
+
const update = k => e => setFields(f => ({ ...f, [fieldKey(scope, k)]: e.target.value }));
|
|
83
|
+
return html`<section class="s-card" id="quota-notices"><h2>${text.heading}</h2><p>${text.hint}</p><p class="muted">${text.defaults}</p>
|
|
84
|
+
${!supported ? html`<p role="status">${text.old}</p>` : null}
|
|
85
|
+
${!invalid ? html`<p class="muted" data-quota-effective>${text.effective}: ${effective.enabled ? text.on : text.off} · ${effective.thresholds.map(v => `${v}%`).join(", ") || "—"} · ${effective.periods.join(", ") || "—"}</p>` : null}
|
|
86
|
+
<fieldset disabled=${!supported} class="s-quota-fields">
|
|
87
|
+
<div class="field"><label for="qn-target">${text.target}</label><select id="qn-target" value=${form.target} onChange=${e => setFields(f => ({ ...f, target: e.target.value }))}>
|
|
88
|
+
<option value="general">${text.general}</option>${Object.entries(instances).filter(([n]) => n !== "general").map(([n, c]) => html`<option value=${n}>${c.display_name || n}</option>`)}
|
|
89
|
+
${form.target !== "general" && !Object.hasOwn(instances, form.target) ? html`<option value=${form.target}>${form.target}</option>` : null}
|
|
90
|
+
</select></div>
|
|
91
|
+
<div class="field"><label for="qn-scope">${text.scope}</label><select id="qn-scope" value=${scope} onChange=${e => setScope(e.target.value)}>
|
|
92
|
+
<option value="fleet">${text.fleet}</option>${BACKENDS.map(b => html`<option value=${`backend:${b}`}>${text.backend} · ${b}</option>`)}
|
|
93
|
+
${Object.entries(instances).map(([n, c]) => html`<option value=${`agent:${n}`}>${text.agent} · ${c.display_name || n}</option>`)}
|
|
94
|
+
${Object.entries(classic).map(([n, c]) => html`<option value=${`classic:${n}`}>${text.classic} · ${c.name || c.instanceName || n}</option>`)}
|
|
95
|
+
</select></div>
|
|
96
|
+
<div class="field"><label for="qn-enabled">${text.enabled}</label><select id="qn-enabled" value=${value.enabled} onChange=${update("enabled")}><option value="">${text.inherit}</option><option value="on">${text.on}</option><option value="off">${text.off}</option></select></div>
|
|
97
|
+
<div class="field"><label for="qn-thresholds">${text.thresholds}</label><input id="qn-thresholds" value=${value.thresholds} onInput=${update("thresholds")} placeholder="10" /><p class="muted">${text.thresholdHint}</p></div>
|
|
98
|
+
<div class="field"><label for="qn-periods">${text.periods}</label><input id="qn-periods" value=${value.periods} onInput=${update("periods")} placeholder=${text.periodExample} /><p class="muted">${text.periodHint}</p></div>
|
|
99
|
+
</fieldset>${invalid ? html`<p class="feedback error" role="alert">${text.error}</p>` : null}<p class="muted">${text.sources}</p></section>`;
|
|
100
|
+
}
|
|
@@ -15,6 +15,7 @@ const L = (en, zh) => ({ en, "zh-TW": zh });
|
|
|
15
15
|
/** [id, section, target, labelKey | label, config key, words en, words zh] */
|
|
16
16
|
const ROWS = [
|
|
17
17
|
["general.location", "agent-defaults", "#general-location", null, null, ["general", "windows", "paired PC", "host", "location"], ["General", "Windows", "電腦", "主機", "執行位置"], L("Run General on", "General 執行位置")],
|
|
18
|
+
["quota.notices", "notifications", "#quota-notices", null, "defaults.quota_notice", ["usage", "quota", "notifications", "remaining", "weekly"], ["用量", "額度", "提醒", "通知", "剩餘"], L("Quota notices", "用量提醒")],
|
|
18
19
|
// You · Preferences
|
|
19
20
|
["profile.name", "preferences", "#profile-name", "settings.profileTitle", null, ["name", "display name", "who agents see", "profile"], ["名字", "名稱", "顯示名稱", "個人資料"]],
|
|
20
21
|
["prefs.theme", "look", "#pref-theme", "app.theme", null, ["theme", "dark", "light", "dark mode", "colour scheme"], ["主題", "深色", "淺色", "外觀"]],
|
|
@@ -286,7 +286,7 @@ register("settings", {
|
|
|
286
286
|
"sec_windows-cli": "Windows CLI",
|
|
287
287
|
sec_runtimes: "Runtime",
|
|
288
288
|
sec_chat: "Chat & connections", "sec_web-dashboard": "Web dashboard", sec_access: "Access & security",
|
|
289
|
-
sec_advanced: "Advanced", sec_look: "Look", grp_you: "You", grp_fleet: "Fleet",
|
|
289
|
+
sec_notifications: "Notifications", sec_advanced: "Advanced", sec_look: "Look", grp_you: "You", grp_fleet: "Fleet",
|
|
290
290
|
classicDefaultsTitle: "ClassicBot defaults", publicLinkTitle: "Public link & fixed address", webDashboardTitle: "Dashboard features", webSettingsLabel: "Web settings",
|
|
291
291
|
stRunning: "Running",
|
|
292
292
|
stPaused: "Paused",
|
|
@@ -939,7 +939,7 @@ register("settings", {
|
|
|
939
939
|
"sec_windows-cli": "Windows CLI",
|
|
940
940
|
sec_runtimes: "Runtime",
|
|
941
941
|
sec_chat: "聊天與連線", "sec_web-dashboard": "網頁儀表板", sec_access: "存取與安全",
|
|
942
|
-
sec_advanced: "進階", sec_look: "外觀", grp_you: "你自己", grp_fleet: "整個 Fleet",
|
|
942
|
+
sec_notifications: "通知", sec_advanced: "進階", sec_look: "外觀", grp_you: "你自己", grp_fleet: "整個 Fleet",
|
|
943
943
|
classicDefaultsTitle: "ClassicBot 預設值", publicLinkTitle: "公開連結與固定網址", webDashboardTitle: "儀表板功能", webSettingsLabel: "網頁設定",
|
|
944
944
|
stRunning: "執行中",
|
|
945
945
|
stPaused: "已暫停",
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
// them grants anything by itself — a session still needs its account's Confirm in Discord or Telegram).
|
|
6
6
|
import { html, useEffect, useState } from "/assets/app-html.js";
|
|
7
7
|
import { t } from "/assets/app-i18n.js";
|
|
8
|
+
import { Skeleton } from "/assets/ui-states.js";
|
|
8
9
|
import { useTypedText } from "/assets/text-undo.js";
|
|
9
10
|
import { toast } from "/assets/ui-toast.js";
|
|
10
11
|
import { confirmDialog } from "/assets/ui-confirm.js";
|
|
@@ -70,7 +71,7 @@ export function WebAuthorityCard({ ctx, staged, disabled = false }) {
|
|
|
70
71
|
const webOnly = !!overview && overview.webOnly === true;
|
|
71
72
|
const card = (body) => html`<section class="card s-web-authority"><h3>${tn("vaTitle")}</h3><p class="note s-authority-brief">${layoutText(webOnly ? "revAuthorityBriefWeb" : "revAuthorityBrief")}</p><p class="note s-authority-rule">${layoutText("revAuthorityRule")}</p>${body}<details class="s-setting-details"><summary>${layoutText("revAuthorityDetails")}</summary><p class="note">${tn("vaHint")}</p><p class="note">${tn("vaEnabledHint")}</p><p class="note">${tn("vaLoopbackOnlyHint")}</p></details></section>`;
|
|
72
73
|
if (failed) return card(html`<p class="note" role="status">${tn("vaLoadFailed")} <button type="button" class="btn btn-sm" onClick=${load}>${t("app.retry")}</button></p>`);
|
|
73
|
-
if (!overview || !f) return card(html
|
|
74
|
+
if (!overview || !f) return card(html`<${Skeleton} variant="rows" lines=${3} />`);
|
|
74
75
|
|
|
75
76
|
const set = (patch) => setF((x) => ({ ...x, ...patch }));
|
|
76
77
|
const hoursError = f.hours !== null && (!Number.isFinite(f.hours) || f.hours < overview.hours.min || f.hours > overview.hours.max) ? "vaHoursRange" : "";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/* #3292: Settings → Accounts → Keep sign-in alive — linked by accounts-keepalive.js (an older accounts.css lacks these rules). */
|
|
2
|
+
.s-account-keepalive { flex-basis: 100%; display: grid; gap: 2px; padding: var(--s-1) 0 0; border-top: 1px dashed var(--border); }
|
|
3
|
+
.s-account-keepalive .check { display: flex; align-items: flex-start; gap: var(--s-2); }
|
|
4
|
+
.s-account-keepalive small { color: var(--text-2); font-size: var(--fs-xs); overflow-wrap: anywhere; }
|
|
5
|
+
.s-account-keepalive .s-keepalive-fallback { margin-left: var(--s-4); }
|
|
6
|
+
.s-account-keepalive .is-warn { color: var(--warn); font-weight: 600; }
|
|
7
|
+
.s-account-keepalive .is-bad { color: var(--danger); font-weight: 600; }
|
|
@@ -13,3 +13,16 @@
|
|
|
13
13
|
.s-account-machine { border-top: 1px dashed var(--border); padding-top: var(--s-2); }
|
|
14
14
|
.s-account-move { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-1); }
|
|
15
15
|
.s-account-move .check small { margin-left: var(--s-2); }
|
|
16
|
+
/* #3212 PR 2: + Add account at the card's end; Remove's in-use list (a tab with an older copy of this file only loses the layout). */
|
|
17
|
+
.s-account-head .s-account-add { margin-left: auto; }
|
|
18
|
+
.s-account-row .s-account-remove { color: var(--danger, var(--text-2)); }
|
|
19
|
+
.s-account-inuse ul { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-1); }
|
|
20
|
+
.s-account-inuse li { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); }
|
|
21
|
+
.s-account-inuse li > span { flex: 1 1 12em; min-width: 0; overflow-wrap: anywhere; }
|
|
22
|
+
.s-account-inuse li > small { flex-basis: 100%; }
|
|
23
|
+
/* #3190 Part 3c: a paired computer's accounts under its name (a tab with an older copy of this file only loses the layout). */
|
|
24
|
+
.s-account-machine { display: grid; gap: var(--s-1); }
|
|
25
|
+
.s-account-machine-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); }
|
|
26
|
+
.s-account-machine-head .s-account-add { margin-left: auto; }
|
|
27
|
+
.s-account-why { color: var(--text-2); font-size: var(--fs-xs); overflow-wrap: anywhere; }
|
|
28
|
+
.s-account-usage.is-none { color: var(--text-3); }
|
|
@@ -6,7 +6,7 @@ export const FLEET_TABS = ["tasks", "schedules", "teams", "org", "cache", "usage
|
|
|
6
6
|
// #2347: two groups — "You" changes only you or this browser; "Fleet" changes AgEnD for everyone.
|
|
7
7
|
export const SETTINGS_GROUPS = Object.freeze([
|
|
8
8
|
Object.freeze({ id: "you", sections: Object.freeze(["preferences", "look"]) }),
|
|
9
|
-
Object.freeze({ id: "fleet", sections: Object.freeze(["agents", "runtimes", "agent-defaults", "chat", "web-dashboard", "access", "advanced"]) }),
|
|
9
|
+
Object.freeze({ id: "fleet", sections: Object.freeze(["agents", "runtimes", "agent-defaults", "notifications", "chat", "web-dashboard", "access", "advanced"]) }),
|
|
10
10
|
]);
|
|
11
11
|
export const SETTINGS_SECTIONS = Object.freeze(SETTINGS_GROUPS.flatMap((g) => g.sections));
|
|
12
12
|
/** #2347: the sections' names before the regrouping (links and bookmarks keep working) and where each one went. */
|
|
@@ -15,6 +15,7 @@ import { SessionMenu } from "./app-session.js";
|
|
|
15
15
|
import { onPrefsChanged, savePref } from "./app-prefs.js";
|
|
16
16
|
import { applyPageTheme, pageNow, resolvedMode, themesStore } from "./app-themes.js";
|
|
17
17
|
import { ErrorState, Skeleton } from "./ui-states.js";
|
|
18
|
+
import { Dialog } from "./ui-dialog.js";
|
|
18
19
|
import { InstanceNav, RosterNav, namesStore, setNamesPrimary } from "./instance-nav.js";
|
|
19
20
|
import { usageRailStore } from "./header-tools.js";
|
|
20
21
|
import { useWebAuthorization } from "./web-authorize.js";
|
|
@@ -84,12 +85,18 @@ export function searchOffered(admin) {
|
|
|
84
85
|
return (guestPage() ? guestTrusted() : !!admin) && !offLink;
|
|
85
86
|
}
|
|
86
87
|
let searchModule = null;
|
|
88
|
+
let searchOpen = 0;
|
|
89
|
+
function SearchLoading({ onClose }) {
|
|
90
|
+
return html`<${Dialog} title=${t("app.search")} onClose=${onClose} wide=${true}><${Skeleton} variant="rows" lines=${4} /></${Dialog}>`;
|
|
91
|
+
}
|
|
87
92
|
/** Open search; `preset.instance`: narrowed to that agent (Ctrl+F in its chat). */
|
|
88
93
|
export function openSearch(preset = {}) {
|
|
89
94
|
closeDrawer();
|
|
95
|
+
const mine = ++searchOpen;
|
|
96
|
+
showDialog(SearchLoading, { onClose: () => { searchOpen++; closeDialog(); } });
|
|
90
97
|
(searchModule ??= import("/ui/js/search-dialog.js")).then(
|
|
91
|
-
(m) => showDialog(m.SearchDialog, { preset }),
|
|
92
|
-
() => { searchModule = null; toast(t("app.loadFailed"), false); });
|
|
98
|
+
(m) => { if (mine === searchOpen && shellStore.get().dialog?.Component === SearchLoading) showDialog(m.SearchDialog, { preset }); },
|
|
99
|
+
() => { searchModule = null; if (mine === searchOpen && shellStore.get().dialog?.Component === SearchLoading) { closeDialog(); toast(t("app.loadFailed"), false); } });
|
|
93
100
|
}
|
|
94
101
|
/**
|
|
95
102
|
* Ctrl+K (⌘K) anywhere opens search; Ctrl+F (⌘F) in an agent's chat opens it narrowed to that agent — elsewhere the
|
|
@@ -914,4 +921,3 @@ export function Shell({ panels, onNewInstance, viewOnly = false }) {
|
|
|
914
921
|
<${Toasts} />
|
|
915
922
|
</div>`;
|
|
916
923
|
}
|
|
917
|
-
|
|
@@ -116,9 +116,9 @@ export function createNoticesSync({ store, fetchList, setTimer = (fn, ms) => set
|
|
|
116
116
|
function read() {
|
|
117
117
|
return (inFlight ??= Promise.resolve().then(fetchList).then((d) => {
|
|
118
118
|
if (!d || !Array.isArray(d.items)) throw new Error("no list");
|
|
119
|
-
store.set({ notices: mergeNoticeList(store.get().notices, d) });
|
|
119
|
+
store.set({ notices: mergeNoticeList(store.get().notices, d), noticesError: false });
|
|
120
120
|
return true;
|
|
121
|
-
}).catch(() => false).then((ok) => {
|
|
121
|
+
}).catch(() => { store.set({ noticesError: true }); return false; }).then((ok) => {
|
|
122
122
|
inFlight = null;
|
|
123
123
|
if (behind()) later(ok ? NOTICES_RETRY_MS.stale : NOTICES_RETRY_MS.failed);
|
|
124
124
|
else retryAt = 0;
|
package/dist/ui/shared/app.css
CHANGED
|
@@ -4075,3 +4075,16 @@ html.oo-immersive .p-fleet > .panel-body { z-index: 50; }
|
|
|
4075
4075
|
.agent-runtime-change-dialog .dlg-body{flex:1 1 auto;min-height:0;overflow-y:auto;overscroll-behavior:contain}
|
|
4076
4076
|
@media(max-width:600px){.agent-runtime-change-dialog.dlg{width:100vw;max-width:none;height:100dvh;max-height:100dvh;margin:0;border-radius:0}.agent-runtime-change-dialog .dlg-box{height:100%;max-height:100dvh}}
|
|
4077
4077
|
@media(max-width:600px){.agent-runtime-settings{align-items:flex-start;flex-direction:column}.agent-runtime-settings>.btn{align-self:flex-end}}
|
|
4078
|
+
.runtime-cli-install { margin: 0 0 16px; }
|
|
4079
|
+
.runtime-cli-install h4 { margin: 0 0 6px; font-size: var(--fs-sm); font-weight: 500; }
|
|
4080
|
+
.runtime-cli-install .note { margin: 4px 0 0; font-size: var(--fs-xs); }
|
|
4081
|
+
.runtime-cli-install-list { list-style: none; margin: 0 0 6px; padding: 0; }
|
|
4082
|
+
.runtime-cli-install-list li { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 0; border-bottom: 1px solid var(--border); }
|
|
4083
|
+
.runtime-cli-install-list li .btn { margin-inline-start: auto; }
|
|
4084
|
+
.runtime-cli-install pre { margin: 4px 0; overflow-x: auto; }
|
|
4085
|
+
.runtime-cli-install code { font: var(--fs-xs)/1.5 var(--font-mono); overflow-wrap: anywhere; }
|
|
4086
|
+
.runtime-cli-install-others { margin-top: 8px; }
|
|
4087
|
+
.runtime-cli-install-others ul { list-style: none; margin: 4px 0 0; padding: 0; }
|
|
4088
|
+
|
|
4089
|
+
/* Quota preferences obey the panel CSP: no inline styles. */
|
|
4090
|
+
.p-settings .s-quota-fields { border: 0; padding: 0; min-width: 0; }
|
package/dist/ui/shared/app.js
CHANGED
|
@@ -65,7 +65,8 @@ if (hubPage) {
|
|
|
65
65
|
// A chat that loaded late catches up on what is open now; the shell shows that while it is not done, with Retry.
|
|
66
66
|
stream.on("hydration", (hydration) => appStore.set({ hydration }));
|
|
67
67
|
appStore.set({ retryHydration: () => stream.catchUp() });
|
|
68
|
-
|
|
68
|
+
appStore.set({ needsLoaded: false });
|
|
69
|
+
stream.on("needs", (d) => appStore.set({ needsLoaded: true, needs: Array.isArray(d && d.items) ? d.items : [] }));
|
|
69
70
|
// #1218: a panel's way to hear one stream event (the Log's steps_tick), unsubscribed by its lease.
|
|
70
71
|
appStore.set({ streamOn: (name, fn) => stream.on(name, fn) });
|
|
71
72
|
appStore.set({ connection: stream.connection() });
|
|
@@ -46,6 +46,7 @@
|
|
|
46
46
|
.hub-chat { flex: 1; min-height: 0; display: flex; }
|
|
47
47
|
.hub-chat-main { flex: 1; min-width: 0; display: flex; flex-direction: column; min-height: 0; }
|
|
48
48
|
.hub-chat-head { display: flex; align-items: center; gap: var(--s-2); min-height: var(--header-h, 52px); padding: 0 var(--s-4); border-bottom: 1px solid var(--border); flex: none; }
|
|
49
|
+
.hub-chat-head .skeleton { padding: 0; margin: 0; }
|
|
49
50
|
.hub-chat-title { flex: 1; min-width: 0; display: flex; flex-direction: column; }
|
|
50
51
|
.hub-chat-title strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
|
51
52
|
.hub-chat-title .s { color: var(--text-3); font-size: var(--fs-xs); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
|
@@ -29,5 +29,5 @@
|
|
|
29
29
|
.hub-step-form .field { margin: 0; flex: 1; min-width: 12em; }
|
|
30
30
|
.hub-steps .hub-offer { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: start; margin: 0; padding: 0; }
|
|
31
31
|
.hub-steps > li::before { align-self: flex-start; margin-top: 1px; }
|
|
32
|
-
.hub-steps .hub-offer > * { text-align: start; align-self: flex-start; justify-self: start; }
|
|
32
|
+
.hub-steps .hub-offer > * { text-align: start; align-self: flex-start; justify-self: start; margin-left: 0; } /* hub.css's `.hub-steps small` auto margin would push a short line right */
|
|
33
33
|
@media (max-width: 899px) { .hub-page-body { padding: var(--s-3) var(--s-4) var(--s-6); } }
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/* The shared Skeleton's calm content shapes, including before the app's modules arrive. No shimmer or spinner. */
|
|
2
|
+
.skeleton { box-sizing: border-box; width: 100%; min-width: 0; }
|
|
3
|
+
.skeleton > [aria-hidden] { display: flex; flex-direction: column; gap: 14px; width: 100%; }
|
|
4
|
+
.skeleton .sk-line { height: 14px; flex-shrink: 0; background: var(--surface-2, #e8e8eb); border-radius: 5px; }
|
|
5
|
+
.sk-row { display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 8px 0; }
|
|
6
|
+
.sk-row .sk-thumb { width: 36px; height: 36px; border-radius: 9px; }
|
|
7
|
+
.sk-row .sk-copy { display: flex; flex: 1; min-width: 0; flex-direction: column; gap: 9px; }
|
|
8
|
+
.sk-row .sk-copy .sk-line { width: 76%; height: 12px; }
|
|
9
|
+
.sk-row .sk-copy .sk-line + .sk-line { width: 51%; height: 10px; }
|
|
10
|
+
.sk-row .sk-pill { width: 52px; height: 22px; border-radius: 99px; }
|
|
11
|
+
.sk-cards .sk-row { min-height: 104px; border-bottom: 1px solid var(--border, #ddd); }
|
|
12
|
+
.sk-inline { max-width: 140px; min-width: 90px; padding: 0; margin: 0; }
|
|
13
|
+
.s-profile { position: relative; }
|
|
14
|
+
.s-profile-fields { display: flex; flex-direction: column; gap: var(--s-3, 12px); }
|
|
15
|
+
.sk-reserve { visibility: hidden; pointer-events: none; }
|
|
16
|
+
.sk-profile-cover { position: absolute; inset: 52px 16px 16px; }
|
|
17
|
+
.s-pref-profile-fields > .sk-profile-cover { inset: 0; }
|
|
18
|
+
.sk-profile-cover .skeleton { padding: 0; margin: 0; max-width: none; }
|
|
19
|
+
.sk-form .sk-line:nth-child(3) { width: 100%; height: 40px; }
|
|
20
|
+
.sk-form .sk-line:nth-child(4) { width: 48%; height: 32px; border-radius: 99px; }
|
|
21
|
+
.sk-boot { display: flex; height: 100dvh; background: var(--bg, #f6f6f8); }
|
|
22
|
+
.sk-boot-side { width: var(--sidebar-w, 248px); padding: 28px 20px; border-right: 1px solid var(--border, #ddd); }
|
|
23
|
+
.sk-boot-main { flex: 1; min-width: 0; }
|
|
24
|
+
.sk-boot-head { height: 64px; border-bottom: 1px solid var(--border, #ddd); }
|
|
25
|
+
.sk-boot-head .sk-line { width: 160px; }
|
|
26
|
+
.sk-boot .skeleton { margin: 0; max-width: 760px; opacity: 1; animation: none; }
|
|
27
|
+
.sk-boot .sk-line { height: 14px; background: var(--surface-2, #e8e8eb); }
|
|
28
|
+
.signin-card { position: relative; }
|
|
29
|
+
/* Reserve the real, translated form's size while the session is checked; hidden fields cannot be focused. */
|
|
30
|
+
.signin-card:has(#checking:not([hidden])) #form[hidden] { display: block !important; visibility: hidden; pointer-events: none; }
|
|
31
|
+
.sk-signin { position: absolute; inset: 72px 24px 28px; width: auto; padding: 0; margin: 0; max-width: none; }
|
|
32
|
+
.sk-signin > [aria-hidden] { gap: 18px; }
|
|
33
|
+
.sk-signin .sk-line:first-child { width: 70%; height: 26px; }
|
|
34
|
+
.sk-signin .sk-line:nth-child(3) { width: 100%; height: 48px; }
|
|
35
|
+
.sk-signin .sk-line:nth-child(4) { width: 100%; height: 42px; border-radius: 99px; }
|
|
36
|
+
@media (max-width: 899px) { .sk-boot-side { display: none; } }
|
|
37
|
+
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; opacity: 1; } }
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// #2911 (6): every page in the thread — the list the preview panel shows. A page is what preview-versions.js counts as
|
|
2
|
+
// versions of one thing: the agent's complete ```html blocks with one <title> (the untitled ones together), or its
|
|
3
|
+
// attached .html files of one name. Pure: the panel draws it; nothing here runs a preview.
|
|
4
|
+
import "./chat-render.js";
|
|
5
|
+
import { htmlTitle } from "./preview-versions.js";
|
|
6
|
+
|
|
7
|
+
const R = () => globalThis.AgendChatRender;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* The pages in `msgs` (in thread order), newest first: [{ id, label, kind: "html" | "file", versions, latest }], where
|
|
11
|
+
* `latest` is the newest version as the panel opens it ({ key, instance, msgKey, n | att, code, sender, ts }; an
|
|
12
|
+
* attached file's code is read when it is opened). `label` is the title, the file name, or "" for untitled blocks.
|
|
13
|
+
*/
|
|
14
|
+
export function pagesOf(msgs, keyOf, instance) {
|
|
15
|
+
const pages = new Map();
|
|
16
|
+
const add = (id, label, kind, spec) => {
|
|
17
|
+
const p = pages.get(id);
|
|
18
|
+
if (p) { p.versions++; p.latest = spec; pages.delete(id); pages.set(id, p); } // re-inserted: newest last
|
|
19
|
+
else pages.set(id, { id, label, kind, versions: 1, latest: spec });
|
|
20
|
+
};
|
|
21
|
+
for (const x of Array.isArray(msgs) ? msgs : []) {
|
|
22
|
+
if (x.role !== "agent") continue;
|
|
23
|
+
const msgKey = keyOf(x);
|
|
24
|
+
R().htmlFences(x.text).forEach((f, n) => {
|
|
25
|
+
if (!f.terminated) return;
|
|
26
|
+
const title = htmlTitle(f.code);
|
|
27
|
+
add(`t:${title}`, title, "html", { key: `${msgKey}:f${n}`, instance, msgKey, n, code: f.code, sender: x.sender, ts: x.ts });
|
|
28
|
+
});
|
|
29
|
+
for (const a of Array.isArray(x.attachments) ? x.attachments : []) {
|
|
30
|
+
if (!R().isHtmlAttachment(a)) continue;
|
|
31
|
+
add(`a:${a.name.trim().toLowerCase()}`, a.name, "file", { key: `${msgKey}:a${a.id}`, instance, msgKey, att: { id: a.id, name: a.name, size: a.size }, code: null, sender: x.sender, ts: x.ts });
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return [...pages.values()].reverse();
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/** The page `open` belongs to: its id in pagesOf's terms. */
|
|
38
|
+
export function pageIdOf(open) {
|
|
39
|
+
if (!open) return null;
|
|
40
|
+
return open.att ? `a:${String(open.att.name || "").trim().toLowerCase()}` : `t:${htmlTitle(open.code)}`;
|
|
41
|
+
}
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
// #2911: the preview panel's feedback actions — what a person tells the agent about the page it made (M-2217). The
|
|
2
|
+
// panel (preview-panel.js, M-2216's chrome) renders <PanelActions> in its bar, before Download; everything the actions
|
|
3
|
+
// do lives here, so neither side edits the other's file.
|
|
4
|
+
//
|
|
5
|
+
// Nothing here reads or relays the page. A preview's content is the agent's untrusted HTML, so only what the chat
|
|
6
|
+
// already holds goes into the message: a #2272 reply to the message the page came in, and the page's <title> or file
|
|
7
|
+
// name as one line of plain text in the composer — where the person edits it and sends it themselves. What goes is an
|
|
8
|
+
// ordinary message (Discord first): no new channel, nothing sent by itself.
|
|
9
|
+
|
|
10
|
+
import { html, useEffect, useState } from "/assets/app-html.js";
|
|
11
|
+
import { t } from "/assets/app-i18n.js";
|
|
12
|
+
import { Icon } from "/assets/ui-icons.js";
|
|
13
|
+
import { closePanel, frameKey, htmlTitle } from "./preview-panel.js";
|
|
14
|
+
|
|
15
|
+
const P = () => globalThis.AgendPreview;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* The chat registers how to reach its composer (panel-chat.js): { findMsg(instance, msgKey), startReply(instance, msg),
|
|
19
|
+
* clearReply(instance), addToDraft(instance, line), focus() }. null: no chat is mounted, and the actions are not shown.
|
|
20
|
+
*/
|
|
21
|
+
let chat = null;
|
|
22
|
+
export function setPanelFeedback(deps) { chat = deps || null; }
|
|
23
|
+
/** Hub E (#3226): the deps in force, so a room that leaves clears only its own (#3278 review). */
|
|
24
|
+
export const panelFeedback = () => chat;
|
|
25
|
+
/**
|
|
26
|
+
* Hub E (#3226): a page's Share (page-share-dialog.js) is the fleet's only. The fleet registers it (its
|
|
27
|
+
* /ui/js/preview-panel.js); without it the bar has no Share.
|
|
28
|
+
*/
|
|
29
|
+
let ShareButton = null;
|
|
30
|
+
export function setShareButton(component) { ShareButton = component || null; }
|
|
31
|
+
|
|
32
|
+
/** The most of a page's title or file name the line carries. */
|
|
33
|
+
export const NAME_MAX = 80;
|
|
34
|
+
|
|
35
|
+
/** One line of plain text: format characters removed, whitespace and control characters collapsed, cut at NAME_MAX characters. */
|
|
36
|
+
export function plainName(value) {
|
|
37
|
+
// \p{Cf} first (bidi controls, zero-widths): what the person reads is what is sent (#2914 review).
|
|
38
|
+
const s = String(value == null ? "" : value).replace(/\p{Cf}+/gu, "").replace(/[\s\u0000-\u001f\u007f-\u009f\u2028\u2029]+/gu, " ").trim();
|
|
39
|
+
const chars = [...s];
|
|
40
|
+
return chars.length > NAME_MAX ? `${chars.slice(0, NAME_MAX - 1).join("")}…` : s;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** The composer's line naming the page: its <title>, else the attached file's name, else "this page". */
|
|
44
|
+
export function aboutLine(open) {
|
|
45
|
+
if (!open) return "";
|
|
46
|
+
const name = plainName(htmlTitle(open.code || "")) || plainName(open.att && open.att.name);
|
|
47
|
+
return name ? t("chat.pvFbAboutNamed", name) : t("chat.pvFbAboutThis");
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Reply about the open page: a reply to the message it came in (while the thread still has it), and the line naming
|
|
52
|
+
* the page added to the composer (never twice). Returns false when there is nothing to do it with.
|
|
53
|
+
*/
|
|
54
|
+
export function replyAboutPage(open, deps = chat) {
|
|
55
|
+
if (!open || !deps) return false;
|
|
56
|
+
const msg = open.msgKey ? deps.findMsg(open.instance, open.msgKey) : null;
|
|
57
|
+
// The page's message gone from the thread: no reply — and not one to another message started earlier, which the
|
|
58
|
+
// line naming this page would be sent as (#2913 review).
|
|
59
|
+
if (msg) deps.startReply(open.instance, msg);
|
|
60
|
+
else deps.clearReply(open.instance);
|
|
61
|
+
deps.addToDraft(open.instance, aboutLine(open));
|
|
62
|
+
deps.focus();
|
|
63
|
+
return true;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* #2911: the lines the errors chip adds — a header saying the text below is the page's, then each kept error quoted
|
|
68
|
+
* ("> "), already one line of plain text (preview.js), and how many more there were. `log`: P().errors(key).
|
|
69
|
+
*/
|
|
70
|
+
export function errorLines(log) {
|
|
71
|
+
if (!log || !log.count) return [];
|
|
72
|
+
const kind = { error: "", rejection: t("chat.pvFbErrRejection"), console: "console.error: ", blocked: t("chat.pvCdnBlocked") };
|
|
73
|
+
const lines = [t(log.count === 1 ? "chat.pvFbErrHeadOne" : "chat.pvFbErrHead", String(log.count))];
|
|
74
|
+
for (const x of log.items) lines.push(`> ${kind[x.kind] ?? ""}${plainName(x.message)}${x.line ? ` (${t("chat.pvFbErrAt", String(x.line), String(x.col))})` : ""}`);
|
|
75
|
+
const more = log.count - log.items.length;
|
|
76
|
+
if (more > 0) lines.push(t("chat.pvFbErrMore", String(more)));
|
|
77
|
+
return lines;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/** The errors chip's click: reply about the page, then the error lines (each once) — the person edits and sends. */
|
|
81
|
+
export function sendErrors(open, log, deps = chat) {
|
|
82
|
+
if (!replyAboutPage(open, deps)) return false;
|
|
83
|
+
for (const line of errorLines(log)) deps.addToDraft(open.instance, line);
|
|
84
|
+
deps.focus();
|
|
85
|
+
return true;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* #2911: the line a picked element adds — where in the page (the selector the page's frame built, as code) and its
|
|
90
|
+
* words, marked as the page's text. Backticks are taken out of the selector so it stays one code span.
|
|
91
|
+
*/
|
|
92
|
+
export function pickLine(result) {
|
|
93
|
+
if (!result) return "";
|
|
94
|
+
const where = plainName(String(result.selector || "").replace(/`/g, "")) || "?";
|
|
95
|
+
const words = plainName(result.text);
|
|
96
|
+
return words ? t("chat.pvFbPickWords", where, words) : t("chat.pvFbPickAt", where);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/** A picked element: reply about the page, then its line — the person writes what to change after it. */
|
|
100
|
+
export function sendPick(open, result, deps = chat) {
|
|
101
|
+
if (!result || !replyAboutPage(open, deps)) return false;
|
|
102
|
+
deps.addToDraft(open.instance, pickLine(result));
|
|
103
|
+
deps.focus();
|
|
104
|
+
return true;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/** Whether the open page's frame is in pick mode, and its answer handed to sendPick. */
|
|
108
|
+
function usePick(open) {
|
|
109
|
+
const key = open ? frameKey(open.key) : null;
|
|
110
|
+
const [on, setOn] = useState(() => !!(key && P() && P().picking && P().picking(key)));
|
|
111
|
+
useEffect(() => {
|
|
112
|
+
setOn(!!(key && P() && P().picking && P().picking(key)));
|
|
113
|
+
if (!key || !P() || typeof P().onPick !== "function") return undefined;
|
|
114
|
+
return P().onPick((k, result, now) => {
|
|
115
|
+
if (k !== key) return;
|
|
116
|
+
setOn(!!now);
|
|
117
|
+
if (result) { if (narrow()) closePanel(); sendPick(open, result); }
|
|
118
|
+
});
|
|
119
|
+
}, [key]);
|
|
120
|
+
return on;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/** The errors the open page's frame reported, re-read when they change. */
|
|
124
|
+
function useErrors(open) {
|
|
125
|
+
const key = open ? frameKey(open.key) : null;
|
|
126
|
+
const read = () => (key && P() && typeof P().errors === "function" ? P().errors(key) : null);
|
|
127
|
+
const [log, setLog] = useState(read);
|
|
128
|
+
useEffect(() => {
|
|
129
|
+
setLog(read());
|
|
130
|
+
if (!key || !P() || typeof P().onErrors !== "function") return undefined;
|
|
131
|
+
return P().onErrors((k) => { if (k === key) setLog(read()); });
|
|
132
|
+
}, [key]);
|
|
133
|
+
return log;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* #2911 item 8: what Share page names — the block of the message the open page came in ({ boot, id } and its fence
|
|
138
|
+
* number or attachment id; the server reads the page itself), its title, and whose reply. null while the thread no
|
|
139
|
+
* longer has that message.
|
|
140
|
+
*/
|
|
141
|
+
export function shareBlock(open, deps = chat) {
|
|
142
|
+
if (!open || !deps) return null;
|
|
143
|
+
const msg = open.msgKey ? deps.findMsg(open.instance, open.msgKey) : null;
|
|
144
|
+
if (!msg || typeof msg.boot !== "string" || typeof msg.id !== "number") return null;
|
|
145
|
+
const from = open.att && typeof open.att.id === "string" ? { boot: msg.boot, id: msg.id, att: open.att.id }
|
|
146
|
+
: Number.isInteger(open.n) ? { boot: msg.boot, id: msg.id, fence: open.n } : null;
|
|
147
|
+
if (!from) return null;
|
|
148
|
+
const title = plainName(htmlTitle(open.code || "")) || plainName(open.att && open.att.name);
|
|
149
|
+
return { instance: open.instance, from, title, sender: msg.sender || open.sender || "", ts: msg.ts || open.ts || "" };
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
const narrow = () => typeof window !== "undefined" && !!window.matchMedia && window.matchMedia("(max-width: 899px)").matches;
|
|
153
|
+
|
|
154
|
+
/** The bar's actions for the open page. props: open, name, run, view (as the panel has them). */
|
|
155
|
+
export function PanelActions({ open, run }) {
|
|
156
|
+
const log = useErrors(open);
|
|
157
|
+
const picking = usePick(open);
|
|
158
|
+
if (!open || !chat) return null;
|
|
159
|
+
// On a phone the panel is a sheet over the composer: it closes, so the composer is there to type in.
|
|
160
|
+
const reply = () => { if (narrow()) closePanel(); replyAboutPage(open); };
|
|
161
|
+
const send = () => { const now = P().errors(frameKey(open.key)); if (narrow()) closePanel(); sendErrors(open, now); };
|
|
162
|
+
const n = log ? log.count : 0;
|
|
163
|
+
const key = open && frameKey(open.key);
|
|
164
|
+
const canPick = run && run.state === "running" && typeof P().pick === "function";
|
|
165
|
+
const point = () => { P().pick(key, !picking); };
|
|
166
|
+
return html`${ShareButton ? html`<${ShareButton} block=${shareBlock(open)} Icon=${Icon} />` : null}${canPick ? html`<button type="button" class=${`btn btn-sm pv-fb-pick${picking ? " on" : ""}`} aria-pressed=${picking ? "true" : "false"}
|
|
167
|
+
title=${t(picking ? "chat.pvFbPickCancelTitle" : "chat.pvFbPickTitle")} onClick=${point}><${Icon} name="edit" size=${14} /><span class="lbl">${t(picking ? "chat.pvFbPickCancel" : "chat.pvFbPick")}</span></button>` : null}${n ? html`<button type="button" class="btn btn-sm pv-fb-errors" title=${t("chat.pvFbErrTitle")} onClick=${send}><${Icon} name="alert" size=${14} /><span class="pv-fb-n">${n >= P().ERRORS.maxCount ? `${n}+` : String(n)}</span><span class="lbl">${t(n === 1 ? "chat.pvFbErrOne" : "chat.pvFbErrMany")}</span></button>` : null}<button type="button" class="btn btn-sm pv-fb-reply" title=${t("chat.pvFbReplyTitle")} onClick=${reply}><${Icon} name="chat" size=${14} /><span class="lbl">${t("chat.pvFbReply")}</span></button>`;
|
|
168
|
+
}
|