@songsid/agend 2.4.0-beta.25 → 2.4.0-beta.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent-file-read.js +1 -1
- package/dist/agent-file-read.js.map +1 -1
- package/dist/auth-api.js +3 -1
- package/dist/auth-api.js.map +1 -1
- package/dist/build-provenance.json +1 -1
- package/dist/channel/mcp-tools.js +1 -1
- package/dist/channel/mcp-tools.js.map +1 -1
- package/dist/delivery-outbox.js +4 -1
- package/dist/delivery-outbox.js.map +1 -1
- package/dist/fleet-lock.d.ts +16 -0
- package/dist/fleet-lock.js +40 -0
- package/dist/fleet-lock.js.map +1 -1
- package/dist/fleet-manager.d.ts +20 -1
- package/dist/fleet-manager.js +154 -14
- package/dist/fleet-manager.js.map +1 -1
- package/dist/general-knowledge/skills/cross-instance-messaging/SKILL.md +6 -1
- package/dist/general-knowledge/skills/hub/SKILL.md +12 -1
- package/dist/general-knowledge/skills/web-appearance/SKILL.md +3 -1
- package/dist/general-knowledge/skills/web-dashboard/SKILL.md +7 -0
- package/dist/hub/client.js +7 -0
- package/dist/hub/client.js.map +1 -1
- package/dist/hub/compose/member.js +6 -1
- package/dist/hub/compose/member.js.map +1 -1
- package/dist/hub/compose/server.d.ts +1 -0
- package/dist/hub/compose/server.js +3 -2
- package/dist/hub/compose/server.js.map +1 -1
- package/dist/hub/http/compose.js +3 -2
- package/dist/hub/http/compose.js.map +1 -1
- package/dist/hub/http/deps.d.ts +1 -0
- package/dist/hub/member/room-ask.d.ts +7 -8
- package/dist/hub/member/room-ask.js +52 -13
- package/dist/hub/member/room-ask.js.map +1 -1
- package/dist/hub/member/room-reaction-acks.d.ts +12 -0
- package/dist/hub/member/room-reaction-acks.js +44 -0
- package/dist/hub/member/room-reaction-acks.js.map +1 -0
- package/dist/hub/protocol.d.ts +4 -0
- package/dist/hub/protocol.js +2 -2
- package/dist/hub/protocol.js.map +1 -1
- package/dist/hub/roles/audit-details.d.ts +2 -0
- package/dist/hub/roles/audit-details.js +1 -1
- package/dist/hub/roles/audit-details.js.map +1 -1
- package/dist/hub/roles/authority.d.ts +8 -3
- package/dist/hub/roles/authority.js +144 -102
- package/dist/hub/roles/authority.js.map +1 -1
- package/dist/hub/roles/delegation.js +2 -2
- package/dist/hub/roles/delegation.js.map +1 -1
- package/dist/hub/roles/model.d.ts +5 -2
- package/dist/hub/roles/model.js +5 -4
- package/dist/hub/roles/model.js.map +1 -1
- package/dist/hub/roles/review.js +2 -2
- package/dist/hub/roles/review.js.map +1 -1
- package/dist/hub/room-react-ack-model.d.ts +2 -0
- package/dist/hub/room-react-ack-model.js +3 -0
- package/dist/hub/room-react-ack-model.js.map +1 -0
- package/dist/hub/rooms/admin.d.ts +6 -0
- package/dist/hub/rooms/admin.js +33 -0
- package/dist/hub/rooms/admin.js.map +1 -1
- package/dist/hub/rooms/agents.d.ts +2 -0
- package/dist/hub/rooms/agents.js +44 -3
- package/dist/hub/rooms/agents.js.map +1 -1
- package/dist/hub/rooms/service.d.ts +5 -1
- package/dist/hub/rooms/service.js +76 -24
- package/dist/hub/rooms/service.js.map +1 -1
- package/dist/hub/rooms/types.d.ts +2 -0
- package/dist/hub/server.js +6 -1
- package/dist/hub/server.js.map +1 -1
- package/dist/hub/types.d.ts +2 -0
- package/dist/locale.js +2 -2
- package/dist/locale.js.map +1 -1
- package/dist/public-web-gateway.js +2 -0
- package/dist/public-web-gateway.js.map +1 -1
- package/dist/recover.cjs +212 -26
- package/dist/request-contact-native.js +4 -0
- package/dist/request-contact-native.js.map +1 -1
- package/dist/scheduler/scheduler.d.ts +9 -0
- package/dist/scheduler/scheduler.js +26 -0
- package/dist/scheduler/scheduler.js.map +1 -1
- package/dist/scheduler/scheduler.test.js +17 -0
- package/dist/scheduler/scheduler.test.js.map +1 -1
- package/dist/settings-api.js +72 -0
- package/dist/settings-api.js.map +1 -1
- package/dist/settings-change.js +13 -0
- package/dist/settings-change.js.map +1 -1
- package/dist/settings-effect.js +11 -1
- package/dist/settings-effect.js.map +1 -1
- package/dist/ui/contact-auth-strings.js +7 -2
- package/dist/ui/contact-permissions.js +10 -2
- package/dist/ui/fleet-office-pack.d.ts +2 -2
- package/dist/ui/fleet-office-pack.js +25 -8
- package/dist/ui/fleet-office-vehicles.js +28 -11
- package/dist/ui/fleet-office-zones.js +2 -2
- package/dist/ui/fleet-office.js +25 -5
- package/dist/ui/hub-admin-rooms-strings.js +6 -2
- package/dist/ui/hub-admin-rooms.js +3 -1
- package/dist/ui/hub-group-search.js +2 -2
- package/dist/ui/hub-notify-keep.js +49 -0
- package/dist/ui/hub-role-view.js +1 -1
- package/dist/ui/hub-roles-strings.js +14 -10
- package/dist/ui/hub-roles.js +1 -1
- package/dist/ui/hub-room-notify.js +2 -1
- package/dist/ui/hub-room-strings.js +3 -3
- package/dist/ui/hub-room-thread.js +9 -4
- package/dist/ui/panel-hub.js +3 -2
- package/dist/ui/panel-needs.js +13 -5
- package/dist/ui/settings-update.js +13 -0
- package/dist/ui/shared/app-install.js +123 -0
- package/dist/ui/shared/app-shell.js +4 -2
- package/dist/ui/shared/app-update.js +16 -2
- package/dist/ui/shared/app.css +43 -0
- package/dist/ui/shared/app.js +3 -0
- package/dist/ui/shared/hub-chat.css +6 -0
- package/dist/ui/shared/ui-confirm.js +4 -3
- package/dist/ui/shared/ui-icons.js +2 -0
- package/dist/ui/shared/update-card-ui.js +419 -0
- package/dist/update-abandon.d.ts +26 -0
- package/dist/update-abandon.js +111 -0
- package/dist/update-abandon.js.map +1 -0
- package/dist/update-forward.d.ts +5 -19
- package/dist/update-forward.js +19 -75
- package/dist/update-forward.js.map +1 -1
- package/dist/update-goback.d.ts +90 -0
- package/dist/update-goback.js +260 -0
- package/dist/update-goback.js.map +1 -0
- package/dist/update-journal.d.ts +8 -0
- package/dist/update-journal.js +8 -2
- package/dist/update-journal.js.map +1 -1
- package/dist/update-package-restore.d.ts +11 -2
- package/dist/update-package-restore.js +16 -5
- package/dist/update-package-restore.js.map +1 -1
- package/dist/update-quiescence.d.ts +38 -9
- package/dist/update-quiescence.js +50 -10
- package/dist/update-quiescence.js.map +1 -1
- package/dist/update-recovery/recover.js +10 -0
- package/dist/update-recovery/recover.js.map +1 -1
- package/dist/update-recovery/runner.d.ts +4 -0
- package/dist/update-recovery/runner.js +38 -5
- package/dist/update-recovery/runner.js.map +1 -1
- package/dist/update-restore.d.ts +7 -1
- package/dist/update-restore.js +10 -5
- package/dist/update-restore.js.map +1 -1
- package/dist/update-retained.d.ts +28 -1
- package/dist/update-retained.js +28 -3
- package/dist/update-retained.js.map +1 -1
- package/dist/update-settings.d.ts +27 -0
- package/dist/update-settings.js +40 -0
- package/dist/update-settings.js.map +1 -1
- package/dist/update-snapshot-scope.js +1 -0
- package/dist/update-snapshot-scope.js.map +1 -1
- package/dist/web-icons.d.ts +11 -0
- package/dist/web-icons.js +14 -2
- package/dist/web-icons.js.map +1 -1
- package/dist/web-mentions.d.ts +27 -8
- package/dist/web-mentions.js +108 -1
- package/dist/web-mentions.js.map +1 -1
- package/dist/web-office-acts.js +3 -0
- package/dist/web-office-acts.js.map +1 -1
- package/package.json +2 -2
package/dist/ui/panel-hub.js
CHANGED
|
@@ -47,6 +47,7 @@ const { useRoomStar } = roomFavorites;
|
|
|
47
47
|
import { HubRoomPage } from "./hub-room-thread.js";
|
|
48
48
|
import { TextSizeButton } from "/assets/header-tools.js";
|
|
49
49
|
import { HubNotifyToggle, clearHubMeId, noteHubMeId, rememberedMeId, startHubRoomNotifier } from "./hub-room-notify.js";
|
|
50
|
+
import { InstallAppButton } from "/assets/app-install.js";
|
|
50
51
|
import { hroom } from "./hub-room-strings.js";
|
|
51
52
|
import { ha as hApps } from "./hub-ai-apps-strings.js";
|
|
52
53
|
import { hr } from "./hub-read-strings.js";
|
|
@@ -213,7 +214,7 @@ export function HubPanel({ route }) {
|
|
|
213
214
|
props=${{client:hubClient(),person:s.displayName,request:new URLSearchParams(location.search).get("request")||""}}/></div></div></div>`;
|
|
214
215
|
// Security notices stay on their own page. The bound join branch above never renders the chat or notices page.
|
|
215
216
|
if (s && tab === "ask" && view === "notices" && noticesOffered(s)) return html`<div data-effect-panel="hub" class="panel p-hub p-hub-notices">
|
|
216
|
-
<${PanelHeader} title=${hc("noticesTitle")}><span class="hub-head-tools"><${HubNotifyToggle} /></span></${PanelHeader}><div data-trust="panel-content" class="panel-body hub-page-body">
|
|
217
|
+
<${PanelHeader} title=${hc("noticesTitle")}><span class="hub-head-tools"><${InstallAppButton} /><${HubNotifyToggle} /></span></${PanelHeader}><div data-trust="panel-content" class="panel-body hub-page-body">
|
|
217
218
|
<div class="col hub-owner hub-notices-col"><p class="s-page-lead hub-page-lead">${roleNoticesOffered(s, hubClient()) ? roleNoticeLead() : directoryNoticesOffered(s, hubClient()) ? dn("pageLead") : hc("noticesLead")}</p>
|
|
218
219
|
${pairingNoticesOffered(s) ? html`<${PairingNotices} admin=${!!s.admin} empty=${introNoticeOffered(s,hubClient()) || directoryNoticesOffered(s, hubClient()) || roleNoticesOffered(s, hubClient()) ? null : html`<${Empty} icon="bell" title=${hc("noNotices")} />`} />` : null}
|
|
219
220
|
${introNoticeOffered(s,hubClient())?html`<${IntroNotice} client=${hubClient()} />`:null}${directoryNoticesOffered(s, hubClient()) ? html`<${DirectoryNotices} client=${hubClient()} />` : null}${roleNoticesOffered(s, hubClient()) ? html`<${RoleNotices} client=${hubClient()} />` : null}</div></div></div>`;
|
|
@@ -669,7 +670,7 @@ function HubChats() {
|
|
|
669
670
|
if (opening && (!rs.loaded || recentRoom(rs.rooms))) return html`<${PanelHeader} title=${hc("chats")} /><div class="hub-home"><div class="hub-home-pick center"><${Skeleton} variant="rows" lines=${4} /></div></div>`;
|
|
670
671
|
// On a phone the launcher takes the page on 新對話 and when there is nothing to list; otherwise the list does.
|
|
671
672
|
const alone = launch || (rs.loaded && !rs.error && !rs.rooms.length);
|
|
672
|
-
return html`<${PanelHeader} title=${launch ? hc("newChat") : hc("chats")}
|
|
673
|
+
return html`<${PanelHeader} title=${launch ? hc("newChat") : hc("chats")}><span class="hub-head-tools"><${InstallAppButton} /></span></${PanelHeader}>
|
|
673
674
|
${/* M-3137 (versions spec §2.3): the signed-in person whose own Fleet is behind is told here, once per sign-in. */ ""}
|
|
674
675
|
<${OlderFleetBanner} client=${hubClient()} signIn=${s?.csrf || ""} />
|
|
675
676
|
<div class=${`hub-home${alone ? " is-launch" : ""}`}>
|
package/dist/ui/panel-needs.js
CHANGED
|
@@ -19,10 +19,11 @@ import { t, register } from "/assets/app-i18n.js";
|
|
|
19
19
|
import { appStore, createStore, useStore } from "/assets/app-store.js";
|
|
20
20
|
import { useLease } from "/assets/app-ctx.js";
|
|
21
21
|
import { PanelHeader, setTitle } from "/assets/app-shell.js";
|
|
22
|
-
import { fleetPath, chatPath } from "/assets/app-route.js";
|
|
22
|
+
import { fleetPath, chatPath, settingsPath } from "/assets/app-route.js";
|
|
23
23
|
import { namesOf, namesStore } from "/assets/instance-nav.js";
|
|
24
24
|
import { Empty, Skeleton } from "/assets/ui-states.js";
|
|
25
25
|
import { Icon } from "/assets/ui-icons.js";
|
|
26
|
+
import { InstallAppSection } from "/assets/app-install.js";
|
|
26
27
|
import { toast } from "/assets/ui-toast.js";
|
|
27
28
|
import { confirmDialog } from "/assets/ui-confirm.js";
|
|
28
29
|
import { notifyStore, notifySupport, configDetail, reasonText, refreshNotify, setNotify } from "/assets/app-needs.js";
|
|
@@ -34,6 +35,9 @@ import { runtimeUpdateText } from "./runtime-update-status.js";
|
|
|
34
35
|
import { ContactNeedsItem, ContactSuggestionsGroup, isRestrictedSuggestion } from "./contact-needs.js";
|
|
35
36
|
import { ContactVerifyNeed, contactVerifyCount, isContactVerify } from "./contact-verify-need.js";
|
|
36
37
|
import { HostDirectoryNotices, hostDirectoryNoticesOffered } from "./hub-host-security-notices.js";
|
|
38
|
+
// M-3770 1.4: AgEnD's own update in Needs you — only a failure or "can't update here" (design §3.1).
|
|
39
|
+
import { UpdateNeedsItem, updateAttention } from "/assets/update-card-ui.js";
|
|
40
|
+
import { updateStore } from "/assets/app-update.js";
|
|
37
41
|
|
|
38
42
|
// A pre-upgrade tab retains app-i18n.js. Register these reasons when the updated panel is loaded, too.
|
|
39
43
|
register("app", {
|
|
@@ -72,7 +76,7 @@ register("needs", {
|
|
|
72
76
|
e_confirmation_not_pending: "This request was already decided or ran out.", e_not_found: "This request is no longer here.",
|
|
73
77
|
},
|
|
74
78
|
"zh-TW": {
|
|
75
|
-
otherEmpty: "沒有其他待處理事項。", title: "等你處理", empty: "目前沒有需要你處理的事", emptyHint: "
|
|
79
|
+
otherEmpty: "沒有其他待處理事項。", title: "等你處理", empty: "目前沒有需要你處理的事", emptyHint: "Agent 在等你時,會出現在這裡——也會出現在聊天 app 的 General。", emptyHintWeb: "Agent 在等你時,會出現在這裡。",
|
|
76
80
|
open: "開啟聊天", kiroOpen: "開啟 Agent", kiroMigration: "遷移說明", openCard: "打開卡片", noAssignee: "任務看板(沒有負責人)", fleetSignIns: "AI 帳號", signIn: "連接帳號",
|
|
77
81
|
gap: "還沒補齊:{0}", gapUnchecked: "還有 {0} 項沒勾", gapNoResult: "沒有產出總結", gapJoin: "、", acknowledge: "確認", acknowledging: "確認中…", answering: "回覆中…",
|
|
78
82
|
hubClose: "不處理這題", hubClosing: "結束中…", hubCloseTitle: "不處理這題?", hubCloseConfirm: "不處理這題", hubCloseDetail: "可以結束這題,不會再把問題送給 Agent。", hubCloseMessage: "Hub 會告訴提問者這題不會回答。關閉後無法復原。同一則訊息無法再試一次;提問者可以另問一題。已經送出的答案會保留。這不會停止 Agent 已經開始的工作。", hubCloseDone: "Hub 已確認結束這題。", hubCloseAnswered: "答案已經送達 Hub,原有答案會保留。", hubCloseVerify: "請先驗證管理員帳號,再結束這題。", hubCloseForbidden: "只有管理這個 Agent 的管理員可以結束這題。", hubCloseUnsupported: "請先更新 Hub,才能結束這題。目前仍保留暫停項目。", hubCloseUnavailable: "Hub 尚未確認結束。請檢查連線後再試;問題沒有重新送出。",
|
|
@@ -222,7 +226,9 @@ export function NeedsPanel({ navKey }) {
|
|
|
222
226
|
const verify = items.find(isContactVerify);
|
|
223
227
|
const groups = groupNeeds(items.filter(item => !item.runtimeUpdate && !isRestrictedSuggestion(item) && !isContactVerify(item)));
|
|
224
228
|
// M-3710: the verify line counts as the requests it stands for (as the badge and tab title do).
|
|
225
|
-
|
|
229
|
+
// #4487 review P2: AgEnD's own update item — rendered, counted and weighed for the empty state from the one answer.
|
|
230
|
+
const updateInfo = useStore(updateStore).info, updateNeed = !!updateAttention(updateInfo);
|
|
231
|
+
const shownCount = items.length - suggestions.length + (suggestions.length ? 1 : 0) + asks.length + (verify ? contactVerifyCount(verify) - 1 : 0) + (updateNeed ? 1 : 0);
|
|
226
232
|
if (updates.length) groups.push({ instance: "", items: updates });
|
|
227
233
|
const nowMs = Date.now();
|
|
228
234
|
return html`<div data-effect-panel="needs" class="panel p-needs">
|
|
@@ -234,8 +240,9 @@ export function NeedsPanel({ navKey }) {
|
|
|
234
240
|
${decidedHere.map(([id, d]) => html`<${ProposalResult} key=${id} result=${d} />`)}
|
|
235
241
|
</section>` : null}
|
|
236
242
|
${verify ? html`<${ContactVerifyNeed} item=${verify} />` : null}
|
|
237
|
-
${
|
|
238
|
-
|
|
243
|
+
${updateNeed ? html`<${UpdateNeedsItem} info=${updateInfo} settingsHref=${`${settingsPath("advanced")}#settings-update`} />` : null}
|
|
244
|
+
${(!ready || needsLoaded === false) && !items.length && !asks.length && !updateNeed ? html`<${Skeleton} variant="rows" lines=${3} />`
|
|
245
|
+
: !items.length && !asks.length && !decidedHere.length ? updateNeed ? null : hostDirectoryNoticesOffered() ? html`<p class="muted">${tn("otherEmpty")}</p>` : html`<${Empty} icon="check" title=${tn("empty")} hint=${tn(chatApp ? "emptyHint" : "emptyHintWeb")} />`
|
|
239
246
|
: groups.map((g) => html`<section key=${JSON.stringify([g.instance, g.items[0]?.type === "config",g.items[0]?.type === 'host', !!g.items[0]?.runtimeUpdate])} class="n-group" aria-label=${g.items[0]?.runtimeUpdate ? runtimeUpdateText("attention") : g.instance}>
|
|
240
247
|
<h2 class="n-group-head">${g.items[0]?.runtimeUpdate ? runtimeUpdateText("attention") : g.instance ? html`<a href=${chatPath(g.instance)} title=${g.instance}>${nameFor(g.instance)}</a>` : g.items[0]?.type==='host'?hostAlertText('title'):g.items[0]?.type === "config" ? t("app.settings") : tn(g.items.some(i => i.type === "backend") ? "fleetSignIns" : "noAssignee")}</h2>
|
|
241
248
|
${g.items.map((item) => item.type === "contact"
|
|
@@ -503,5 +510,6 @@ function NotifyToggle() {
|
|
|
503
510
|
<${Icon} name="bell" size=${14} />${on ? tn("turnOff") : tn("turnOn")}</button></div>` : null}
|
|
504
511
|
</div>
|
|
505
512
|
</article>
|
|
513
|
+
<${InstallAppSection} />
|
|
506
514
|
</section>`;
|
|
507
515
|
}
|
|
@@ -8,6 +8,8 @@ import { useStore } from "/assets/app-store.js";
|
|
|
8
8
|
import { toast } from "/assets/ui-toast.js";
|
|
9
9
|
import { checkUpdateNow, hubNeed, openHubUpdateDialog, openUpdateDialog, refreshUpdate, updateActive, updateStore } from "/assets/app-update.js";
|
|
10
10
|
import { dateTimeText } from "/assets/clock-text.js";
|
|
11
|
+
// M-3770 1.4: the update card's Settings part (a module of its own; its deps are passed, never imported back).
|
|
12
|
+
import { UpdateCardSettings, cardActions } from "/assets/update-card-ui.js";
|
|
11
13
|
|
|
12
14
|
register("supdate", {
|
|
13
15
|
en: { title: "Version and update", current: "Current version", line: "Update line", latest: "Latest", checked: "Last checked",
|
|
@@ -62,11 +64,22 @@ export function UpdateSection() {
|
|
|
62
64
|
${offer && !offer.installable ? html`<p class="s-update-note">${t("supdate.alphaNote")}</p>` : null}
|
|
63
65
|
<div class="s-update-row">
|
|
64
66
|
${need ? html`<button type="button" class="btn btn-primary" disabled=${starting || updateActive(info)} onClick=${() => { void openHubUpdateDialog(); }}>${t("update.now")}</button>`
|
|
67
|
+
: info.card !== undefined ? cardButtons(info, starting)
|
|
65
68
|
: offer && offer.installable ? html`<button type="button" class="btn btn-primary" disabled=${starting || updateActive(info)} onClick=${openUpdateDialog}>${t("update.now")}</button>` : null}
|
|
66
69
|
<button type="button" class="btn" disabled=${checking || updateActive(info)} onClick=${check}>${checking ? t("supdate.checking") : t("supdate.check")}</button>
|
|
67
70
|
</div>
|
|
71
|
+
${info.card !== undefined ? html`<${UpdateCardSettings} info=${info} deps=${CARD_DEPS} />` : null}
|
|
68
72
|
</section>`;
|
|
69
73
|
}
|
|
74
|
+
/** M-3770 1.4: what update-card-ui.js needs from app-update.js, passed in. */
|
|
75
|
+
const CARD_DEPS = { refresh: () => refreshUpdate(), setInfo: (i) => updateStore.set({ info: i }), getInfo: () => updateStore.get().info };
|
|
76
|
+
/** M-3770 1.4: with the card, the banner's answers in every state (#4487 review P2: the banner is hidden on this page, so
|
|
77
|
+
* waiting and scheduled keep Cancel and Update now here; Pick a time only where a schedule is taken). One policy: cardActions. */
|
|
78
|
+
function cardButtons(info, starting) {
|
|
79
|
+
const busy = starting || updateActive(info);
|
|
80
|
+
const actions = cardActions(info, CARD_DEPS);
|
|
81
|
+
return actions.length ? actions.map((a) => html`<button type="button" key=${a.key} class=${`btn${a.primary ? " btn-primary" : ""}`} disabled=${busy} onClick=${() => { void a.run(); }}>${a.label}</button>`) : null;
|
|
82
|
+
}
|
|
70
83
|
|
|
71
84
|
/** The "new version" mark beside Settings' version pill (admins, an installable offer). */
|
|
72
85
|
export function UpdatePillMark() {
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
// S-255: install the dashboard or the Hub as an app. The page registers /sw.js (web-icons.ts: no fetch handler and no
|
|
2
|
+
// cache, so no API answer or chat is ever stored by it) and keeps the browser's install offer for a button:
|
|
3
|
+
// - Chrome/Edge make the offer (beforeinstallprompt) only where the page could be installed: localhost, or https with a
|
|
4
|
+
// certificate the browser trusts. The button installs.
|
|
5
|
+
// - Safari on iPhone/iPad has no offer: the words say Share → Add to Home Screen.
|
|
6
|
+
// - An https page whose certificate the browser doesn't trust (a Hub's self-signed one) cannot register the worker
|
|
7
|
+
// (SecurityError), and a plain-http LAN address isn't a secure context: the words say why, never a prompt that fails.
|
|
8
|
+
// - Already running as the app, or a browser that offers nothing: no hint at all.
|
|
9
|
+
import { html } from "./app-html.js";
|
|
10
|
+
import { createStore, useStore } from "./app-store.js";
|
|
11
|
+
import { register, t } from "./app-i18n.js";
|
|
12
|
+
import { Icon } from "./ui-icons.js";
|
|
13
|
+
import { confirmDialog } from "./ui-confirm.js";
|
|
14
|
+
|
|
15
|
+
register("install", {
|
|
16
|
+
en: {
|
|
17
|
+
title: "Install as an app",
|
|
18
|
+
available: "Opens in its own window, from your Start menu, Dock or home screen.",
|
|
19
|
+
install: "Install",
|
|
20
|
+
short: "Install",
|
|
21
|
+
ios: "In Safari, tap Share, then Add to Home Screen.",
|
|
22
|
+
untrusted: "Can't be installed here: your browser doesn't trust this address's certificate. Ask your administrator for a trusted certificate, then open this page again.",
|
|
23
|
+
insecure: "Can't be installed from a plain http:// address. Open it through localhost or an https:// address.",
|
|
24
|
+
ok: "OK",
|
|
25
|
+
},
|
|
26
|
+
"zh-TW": {
|
|
27
|
+
title: "安裝成應用程式",
|
|
28
|
+
available: "在自己的視窗開啟,可從開始選單、Dock 或主畫面啟動。",
|
|
29
|
+
install: "安裝",
|
|
30
|
+
short: "安裝",
|
|
31
|
+
ios: "在 Safari 點「分享」,再點「加入主畫面」。",
|
|
32
|
+
untrusted: "這裡無法安裝:你的瀏覽器不信任這個網址的憑證。請管理員改用受信任的憑證後,再重新開啟這個頁面。",
|
|
33
|
+
insecure: "一般 http:// 網址無法安裝。請改用 localhost 或 https:// 網址開啟。",
|
|
34
|
+
ok: "知道了",
|
|
35
|
+
},
|
|
36
|
+
});
|
|
37
|
+
const ti = (k) => t(`install.${k}`);
|
|
38
|
+
|
|
39
|
+
/** "available" | "ios" | "untrusted" | "insecure" | "installed" | "none" (nothing to say). */
|
|
40
|
+
export const installStore = createStore({ state: "none" });
|
|
41
|
+
let offer = null;
|
|
42
|
+
/** The windows already started (the app's one, or a test's own fake). */
|
|
43
|
+
const started = new WeakSet();
|
|
44
|
+
|
|
45
|
+
const standalone = (env) => {
|
|
46
|
+
try { return env.matchMedia?.("(display-mode: standalone)")?.matches === true || env.navigator?.standalone === true; } catch { return false; }
|
|
47
|
+
};
|
|
48
|
+
/** Safari on iPhone/iPad (other iOS browsers can't add to the home screen in a way we can describe). */
|
|
49
|
+
const iosSafari = (env) => {
|
|
50
|
+
const ua = env.navigator?.userAgent || "";
|
|
51
|
+
const ios = /iPhone|iPad|iPod/.test(ua) || (/Macintosh/.test(ua) && (env.navigator?.maxTouchPoints || 0) > 1);
|
|
52
|
+
return ios && /Safari/.test(ua) && !/CriOS|FxiOS|EdgiOS/.test(ua);
|
|
53
|
+
};
|
|
54
|
+
const set = (state) => installStore.set({ state });
|
|
55
|
+
|
|
56
|
+
/** Once per page, from the app's start: listen for the offer, register the worker, decide what to say. */
|
|
57
|
+
export function startInstall(env = globalThis) {
|
|
58
|
+
if (started.has(env)) return;
|
|
59
|
+
started.add(env);
|
|
60
|
+
set("none");
|
|
61
|
+
if (standalone(env)) { set("installed"); return; }
|
|
62
|
+
env.addEventListener?.("beforeinstallprompt", (event) => { event.preventDefault(); offer = event; set("available"); });
|
|
63
|
+
env.addEventListener?.("appinstalled", () => { offer = null; set("installed"); });
|
|
64
|
+
if (iosSafari(env)) set("ios");
|
|
65
|
+
// A plain-http address is not a secure context, and browsers hide the worker API there: say why before looking for it.
|
|
66
|
+
if (env.isSecureContext === false) { if (installStore.get().state === "none") set("insecure"); return; }
|
|
67
|
+
const sw = env.navigator?.serviceWorker;
|
|
68
|
+
if (!sw) return;
|
|
69
|
+
sw.register("/sw.js", { scope: "/" }).catch((error) => {
|
|
70
|
+
// A certificate the browser doesn't trust: registration is refused as a SecurityError.
|
|
71
|
+
if (error && error.name === "SecurityError" && installStore.get().state === "none") set("untrusted");
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/** The browser's own install dialog; afterwards the offer is spent (the browser may make a new one later). */
|
|
76
|
+
export async function promptInstall() {
|
|
77
|
+
const event = offer;
|
|
78
|
+
if (!event) return "none";
|
|
79
|
+
offer = null;
|
|
80
|
+
set("none");
|
|
81
|
+
try {
|
|
82
|
+
await event.prompt();
|
|
83
|
+
const choice = await event.userChoice;
|
|
84
|
+
if (choice?.outcome === "accepted") set("installed");
|
|
85
|
+
return choice?.outcome || "dismissed";
|
|
86
|
+
} catch { return "dismissed"; }
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
const SAYS = new Set(["available", "ios", "untrusted", "insecure"]);
|
|
90
|
+
/** Whether there is anything to offer or say (a menu item or button shows only then). */
|
|
91
|
+
export const installOffered = (state) => SAYS.has(state);
|
|
92
|
+
export const installLabel = () => ti("title");
|
|
93
|
+
/** The one action, wherever it is offered: the browser's dialog where it can install; otherwise the reason, in a notice. */
|
|
94
|
+
export function runInstall(state = installStore.get().state) {
|
|
95
|
+
if (state === "available") { void promptInstall(); return; }
|
|
96
|
+
if (SAYS.has(state)) void confirmDialog({ title: ti("title"), message: ti(state), confirmLabel: ti("ok"), notice: true });
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/** The Fleet's Needs you settings row, drawn like the notification row beside it. Nothing when there's nothing to say. */
|
|
100
|
+
export function InstallAppSection() {
|
|
101
|
+
const { state } = useStore(installStore);
|
|
102
|
+
if (!SAYS.has(state)) return null;
|
|
103
|
+
return html`<article class="n-notify n-install" data-install=${state}>
|
|
104
|
+
<span class="n-notify-icon"><${Icon} name="install" size=${18} /></span>
|
|
105
|
+
<div class="n-notify-body">
|
|
106
|
+
<div class="n-notify-title"><strong>${ti("title")}</strong></div>
|
|
107
|
+
<p class="n-notify-note note">${ti(state)}</p>
|
|
108
|
+
${state === "available" ? html`<div class="n-notify-actions"><button type="button" class="btn btn-sm btn-primary" onClick=${() => { void promptInstall(); }}>
|
|
109
|
+
<${Icon} name="install" size=${14} />${ti("install")}</button></div>` : null}
|
|
110
|
+
</div>
|
|
111
|
+
</article>`;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/** The Hub header's compact button: installs where it can, otherwise says how or why not. */
|
|
115
|
+
export function InstallAppButton() {
|
|
116
|
+
const { state } = useStore(installStore);
|
|
117
|
+
if (!SAYS.has(state)) return null;
|
|
118
|
+
// Its name and tooltip are what it does (the leader's capture check: a bare arrow by the bell read as "download notices").
|
|
119
|
+
const label = ti("title");
|
|
120
|
+
const click = () => runInstall(state);
|
|
121
|
+
return html`<button type="button" class="icon-btn hub-install" data-install=${state} aria-label=${label} title=${label} onClick=${click}>
|
|
122
|
+
<${Icon} name="install" size=${16} /><span class="hub-install-label" aria-hidden="true">${ti("short")}</span></button>`;
|
|
123
|
+
}
|
|
@@ -314,7 +314,8 @@ export function setTitle(text) { titleBase = text || ""; drawTitle(); }
|
|
|
314
314
|
const needsWeight = (i) => (i?.type === "contact" && i.reason === "contact_verify_needed" ? Math.max(1, Math.floor(Number(i.contactVerify?.count) || 1)) : 1);
|
|
315
315
|
const needsTotal = (needs) => needs.reduce((n, i) => n + needsWeight(i), 0);
|
|
316
316
|
appStore.subscribe((s) => {
|
|
317
|
-
|
|
317
|
+
// #4487 review P3: AgEnD's own update item (app-update.js keeps it in appStore) counts in the tab's title too.
|
|
318
|
+
const n = (Array.isArray(s.needs) ? needsTotal(s.needs) : 0) + (s.updateNeeds ? 1 : 0);
|
|
318
319
|
if (n !== titleCount) { titleCount = n; drawTitle(); }
|
|
319
320
|
});
|
|
320
321
|
|
|
@@ -573,7 +574,8 @@ register("phoneNav", {
|
|
|
573
574
|
export function needsCount(app) {
|
|
574
575
|
const needs = Array.isArray(app.needs) ? app.needs : [], proposals = Array.isArray(app.proposals) ? app.proposals : [];
|
|
575
576
|
const suggestions = needs.filter(i => i?.type === "contact" && i.reason === "contact_restricted_suggestion").length;
|
|
576
|
-
|
|
577
|
+
// #4487 review P2: AgEnD's own update item (app-update.js keeps it in appStore), counted once.
|
|
578
|
+
return needsTotal(needs) - suggestions + (suggestions ? 1 : 0) + proposals.length + (app.updateNeeds ? 1 : 0);
|
|
577
579
|
}
|
|
578
580
|
|
|
579
581
|
export function PanelHeader({ title, sub, children, headingRef, nav, notice, pageControls, pageActions, back = null }) {
|
|
@@ -5,11 +5,14 @@
|
|
|
5
5
|
// An older server (no /ui/update) answers 404: nothing is shown.
|
|
6
6
|
import { html, useEffect, useState } from "./app-html.js";
|
|
7
7
|
import { register, t } from "./app-i18n.js";
|
|
8
|
-
import { createStore, useStore } from "./app-store.js";
|
|
8
|
+
import { appStore, createStore, useStore } from "./app-store.js";
|
|
9
9
|
import { confirmDialog } from "./ui-confirm.js";
|
|
10
10
|
import { Dialog } from "./ui-dialog.js";
|
|
11
11
|
import { Icon } from "./ui-icons.js";
|
|
12
12
|
import { toast } from "./ui-toast.js";
|
|
13
|
+
// M-3770 1.4: the one update card (a module of its own: the module-skew rule).
|
|
14
|
+
import { PickTimeHost, cardLine, updateAttention } from "./update-card-ui.js";
|
|
15
|
+
import { navStore } from "./app-nav.js";
|
|
13
16
|
|
|
14
17
|
register("update", {
|
|
15
18
|
en: {
|
|
@@ -71,6 +74,9 @@ const LATER_HUB_KEY = "agend_update_later_hub", LATER_HUB_MS = 24 * 60 * 60 * 10
|
|
|
71
74
|
*/
|
|
72
75
|
export const updateStore = createStore({ info: null, loadedVersion: null, skew: 0, starting: false, later: remembered(LATER_KEY),
|
|
73
76
|
dismissed: remembered(DISMISSED_KEY), reloadDismissed: null, log: null, laterHub: remembered(LATER_HUB_KEY) });
|
|
77
|
+
// #4487 review P2: AgEnD's own update item (a failure, or can't update here) counts in Needs you like any other — its badge,
|
|
78
|
+
// the tab's and the page's count and empty state read it from appStore (app-shell.js needsCount; panel-needs.js).
|
|
79
|
+
updateStore.subscribe((st) => { const n = updateAttention(st && st.info) ? 1 : 0; if ((appStore.get().updateNeeds || 0) !== n) appStore.set({ updateNeeds: n }); });
|
|
74
80
|
|
|
75
81
|
/** Semver "a > b" (major.minor.patch, then a release over its prereleases, then prerelease identifiers) — the server's rule. */
|
|
76
82
|
export function newerVersion(a, b) {
|
|
@@ -251,6 +257,7 @@ function LogDialog() {
|
|
|
251
257
|
export function UpdateLine() {
|
|
252
258
|
usePolling();
|
|
253
259
|
const s = useStore(updateStore);
|
|
260
|
+
const nav = useStore(navStore);
|
|
254
261
|
const [, tick] = useState(0);
|
|
255
262
|
const info = s.info;
|
|
256
263
|
const active = updateActive(info);
|
|
@@ -287,11 +294,18 @@ export function UpdateLine() {
|
|
|
287
294
|
line = html`<${Line} title=${t("update.hubAvailable", rec.hubName, rec.version, info.current)} sub=${[t("update.hubSub")]}>
|
|
288
295
|
<button type="button" class="btn btn-sm btn-primary" disabled=${s.starting} onClick=${() => { void openHubUpdateDialog(); }}>${t("update.now")}</button>
|
|
289
296
|
<button type="button" class="btn btn-sm" onClick=${() => { const v = `${rec.hubId}:${rec.revision}@${Date.now()}`; remember(LATER_HUB_KEY, v); updateStore.set({ laterHub: v }); }}>${t("update.later")}</button></${Line}>`;
|
|
297
|
+
} else if (info.card !== undefined) {
|
|
298
|
+
// M-3770 1.4: a server with the update card — its line (offered, waiting for idle, scheduled, can't), never the
|
|
299
|
+
// per-browser Later below (Not now is the server's, for the whole fleet).
|
|
300
|
+
// The leader (S-237): Settings has the card's own controls; the top line would say it twice there.
|
|
301
|
+
line = nav.route && nav.route.panel === "settings" ? null : cardLine(info, { Line, busy: s.starting, deps: cardDeps });
|
|
290
302
|
} else if (info.offer && info.offer.installable && s.later !== info.offer.version && !hubNeed(info)) {
|
|
291
303
|
const o = info.offer;
|
|
292
304
|
line = html`<${Line} title=${t("update.available", o.version, info.current)} sub=${[t("update.availableSub", channelWord(o.channel))]}>
|
|
293
305
|
<button type="button" class="btn btn-sm btn-primary" disabled=${s.starting} onClick=${openUpdateDialog}>${t("update.now")}</button>
|
|
294
306
|
<button type="button" class="btn btn-sm" onClick=${() => { remember(LATER_KEY, o.version); updateStore.set({ later: o.version }); }}>${t("update.later")}</button></${Line}>`;
|
|
295
307
|
}
|
|
296
|
-
return html`${line}<${LogDialog} />`;
|
|
308
|
+
return html`${line}<${LogDialog} /><${PickTimeHost} />`;
|
|
297
309
|
}
|
|
310
|
+
/** M-3770 1.4: what update-card-ui.js needs from this module, passed in (it never imports this one). */
|
|
311
|
+
export const cardDeps = { refresh: () => refreshUpdate(), setInfo: (info) => updateStore.set({ info }), getInfo: () => updateStore.get().info };
|
package/dist/ui/shared/app.css
CHANGED
|
@@ -2250,6 +2250,8 @@ textarea.s-yaml { white-space: pre; overflow-x: auto; }
|
|
|
2250
2250
|
.update-text { display: flex; align-items: flex-start; gap: var(--s-2); min-width: 0; }
|
|
2251
2251
|
.update-icon { display: inline-flex; flex: none; margin-top: 1px; }
|
|
2252
2252
|
.update-words { min-width: 0; }
|
|
2253
|
+
/* M-3770 1.4 (capture check): zh banner words break at spaces and punctuation, never inside a word (「閒置時」), as the credits card's. */
|
|
2254
|
+
.update-words :is(.update-title, .update-sub) { word-break: keep-all; overflow-wrap: anywhere; text-wrap: balance; }
|
|
2253
2255
|
.update-title { font-weight: 600; }
|
|
2254
2256
|
.update-sub { font-size: var(--fs-xs); color: var(--text-2); }
|
|
2255
2257
|
.update-line.bad .update-sub, .update-line.ok .update-sub { color: var(--text-2); }
|
|
@@ -2272,6 +2274,47 @@ textarea.s-yaml { white-space: pre; overflow-x: auto; }
|
|
|
2272
2274
|
.update-actions.indent { margin-left: 26px; }
|
|
2273
2275
|
}
|
|
2274
2276
|
/* M-2738: Settings → Advanced → Version and update */
|
|
2277
|
+
/* M-3770 1.4: the update card's Settings part — its state, "Updates on this machine", and the controls (pause windows;
|
|
2278
|
+
Advanced: pin, longest wait). Phone: every control a 44 px box, the day ticks wrap. */
|
|
2279
|
+
.uc-settings { display: flex; flex-direction: column; gap: var(--s-3); margin-top: var(--s-3); border-top: 1px solid var(--border); padding-top: var(--s-3); }
|
|
2280
|
+
.uc-status { margin: 0; font-size: var(--fs-sm); }
|
|
2281
|
+
.uc-machine { font-size: var(--fs-sm); }
|
|
2282
|
+
.uc-machine .uc-mark { font-weight: var(--fw-semibold); margin: 0 2px; }
|
|
2283
|
+
.uc-self .uc-mark { color: var(--ok); } .uc-admin-only .uc-mark { color: var(--warn); } .uc-stop .uc-mark { color: var(--danger); }
|
|
2284
|
+
.uc-checks { margin: var(--s-1) 0 0; padding-left: var(--s-4); color: var(--text-2); }
|
|
2285
|
+
.uc-controls { display: flex; flex-direction: column; gap: var(--s-3); }
|
|
2286
|
+
.uc-pause { border: 0; padding: 0; margin: 0; min-width: 0; }
|
|
2287
|
+
.uc-pause legend { font-weight: var(--fw-semibold); font-size: var(--fs-sm); padding: 0; }
|
|
2288
|
+
.uc-hint { margin: 2px 0 var(--s-2); font-size: var(--fs-xs); }
|
|
2289
|
+
.uc-pause-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); padding: var(--s-2) 0; border-bottom: 1px solid var(--border); }
|
|
2290
|
+
.uc-days { display: flex; flex-wrap: wrap; gap: 2px var(--s-2); }
|
|
2291
|
+
.uc-day { font-size: var(--fs-sm); }
|
|
2292
|
+
.uc-time { display: inline-flex; align-items: center; gap: var(--s-1); font-size: var(--fs-sm); color: var(--text-2); }
|
|
2293
|
+
.uc-time .input { width: auto; }
|
|
2294
|
+
.uc-row-actions { display: flex; flex-wrap: wrap; gap: var(--s-2); margin-top: var(--s-2); }
|
|
2295
|
+
.uc-advanced .field { display: flex; flex-direction: column; gap: 2px; margin-bottom: var(--s-2); max-width: 320px; }
|
|
2296
|
+
.uc-pick { display: flex; flex-direction: column; gap: var(--s-2); }
|
|
2297
|
+
.uc-pick-row { font-size: var(--fs-sm); }
|
|
2298
|
+
.uc-pick-frame { padding: var(--s-2) var(--s-3); border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); }
|
|
2299
|
+
.uc-pick-frame { display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-3); }
|
|
2300
|
+
.uc-pick-field { display: flex; flex-direction: column; gap: 2px; font-size: var(--fs-sm); color: var(--text-2); }
|
|
2301
|
+
.uc-pick-field .input { width: auto; min-width: 7em; }
|
|
2302
|
+
.uc-how { margin-top: 2px; font-size: var(--fs-md); }
|
|
2303
|
+
.uc-how summary { cursor: pointer; color: var(--accent); }
|
|
2304
|
+
.uc-how p { margin: var(--s-1) 0 0; color: var(--text); overflow-wrap: anywhere; }
|
|
2305
|
+
/* #4487 UX look: a command in a check's sentence is code to copy (one tap selects it all); the banner's secondary buttons
|
|
2306
|
+
keep a visible outline on any banner colour (先不要 on the phone's dark press-only banner). */
|
|
2307
|
+
.uc-cmd { font-family: var(--font-mono); font-size: 0.92em; padding: 1px 5px; border-radius: var(--r-sm); background: var(--surface);
|
|
2308
|
+
border: 1px solid var(--border); user-select: all; display: inline-block; max-width: 100%; white-space: nowrap; overflow-x: auto;
|
|
2309
|
+
vertical-align: bottom; } /* a command stays on one line (never "sudo agen / d update"); a long one scrolls in its box */
|
|
2310
|
+
.update-actions .btn:not(.btn-primary):not(.update-x) { border-color: var(--border-strong); }
|
|
2311
|
+
.uc-needs .n-item { display: flex; flex-direction: column; align-items: flex-start; gap: var(--s-1); }
|
|
2312
|
+
@media (max-width: 899px), (pointer: coarse) {
|
|
2313
|
+
.uc-settings :is(.btn, .input, .uc-day, .uc-pick-row), .uc-needs .btn, .update-line .update-actions .btn { min-height: var(--tap); }
|
|
2314
|
+
.uc-day, .uc-pick-row { display: inline-flex; align-items: center; }
|
|
2315
|
+
.uc-days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); width: 100%; } /* the week on one row */
|
|
2316
|
+
.uc-day { justify-content: center; gap: 2px; }
|
|
2317
|
+
}
|
|
2275
2318
|
.s-update dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px var(--s-4); margin: 0 0 var(--s-3); font-size: var(--fs-sm); }
|
|
2276
2319
|
.s-update dt { color: var(--text-2); }
|
|
2277
2320
|
.s-update dd { margin: 0; }
|
package/dist/ui/shared/app.js
CHANGED
|
@@ -17,6 +17,7 @@ import { createStream } from "./app-stream.js";
|
|
|
17
17
|
import { appStore, applyStatus, applyActivity, guestPage, guestTrusted, addNotice, createNoticesSync } from "./app-store.js";
|
|
18
18
|
import { chatPath } from "./app-route.js";
|
|
19
19
|
import { startNeedsNotifier } from "./app-needs.js";
|
|
20
|
+
import { startInstall } from "./app-install.js";
|
|
20
21
|
import { toast } from "./ui-toast.js";
|
|
21
22
|
import { t } from "./app-i18n.js";
|
|
22
23
|
import { initTextSize, initUsageRail } from "./header-tools.js";
|
|
@@ -42,6 +43,8 @@ const guest = guestPage();
|
|
|
42
43
|
// Needs you, notices, preferences, themes or owner CSS — none of the fleet's endpoints exist at the Hub's origin, and
|
|
43
44
|
// who is signed in is the Hub's own session (/hub/v1/session), read by its pages.
|
|
44
45
|
const hubPage = mode === "full" && !guest && String(boot.hub || "").split(/\s+/).includes("hub");
|
|
46
|
+
// S-255: install as an app (the dashboard and the Hub, signed in; never a guest's or a reader's page).
|
|
47
|
+
if (mode === "full" && !guest) startInstall();
|
|
45
48
|
|
|
46
49
|
// A failed load can be retried (the panel's Retry): each retry asks for a fresh URL, since a browser may keep a failed
|
|
47
50
|
// module import cached under the first one. boot() runs once, whichever attempt succeeds.
|
|
@@ -132,6 +132,12 @@ a.hub-launch-pill { border: 1px solid var(--border); background: transparent; co
|
|
|
132
132
|
@media (max-width: 899px), (pointer: coarse) {
|
|
133
133
|
.hub-head-tools .hd-text, .hub-head-tools .hub-notify { min-width: var(--tap); min-height: var(--tap); }
|
|
134
134
|
}
|
|
135
|
+
/* S-255: Install as an app — the icon on a desktop (named by its tooltip); on a phone, its short word beside it. */
|
|
136
|
+
.hub-install-label { display: none; }
|
|
137
|
+
@media (max-width: 899px), (pointer: coarse) {
|
|
138
|
+
.hub-head-tools .hub-install { width: auto; min-width: var(--tap); min-height: var(--tap); padding: 0 var(--s-2); gap: var(--s-1); }
|
|
139
|
+
.hub-install-label { display: inline; font-size: var(--fs-sm); line-height: var(--lh-sm); }
|
|
140
|
+
}
|
|
135
141
|
.hub-scroller { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; position: relative; }
|
|
136
142
|
/* M-3117: the thread is the Fleet chat's (.thread in app.css: its column, padding and a phone's tighter one) — no Hub copy. */
|
|
137
143
|
.hub-room-empty { padding: var(--s-6) var(--s-4); }
|
|
@@ -14,11 +14,12 @@ let seq = 0;
|
|
|
14
14
|
* Ask. Resolves true for the confirm button, false for Cancel, Esc, the backdrop or ×.
|
|
15
15
|
* `message` may hold blank lines (paragraphs); it is shown as text.
|
|
16
16
|
*/
|
|
17
|
-
|
|
17
|
+
/** S-255: `notice` — words to read, not a question: one button, no Cancel (Esc, the backdrop and × still close it). */
|
|
18
|
+
export function confirmDialog({ title, message, confirmLabel, danger = false, more = null, even = false, notice = false } = {}) {
|
|
18
19
|
return new Promise((resolve) => {
|
|
19
20
|
// M-3387: `more` { label, lines } — a list closed under the text until opened (e.g. every tool name a switch stops).
|
|
20
21
|
const extra = more && more.label && Array.isArray(more.lines) && more.lines.length ? { label: String(more.label), lines: more.lines.map(String) } : null;
|
|
21
|
-
const item = { id: ++seq, title: title || t("app.confirmTitle"), message: String(message || ""), confirmLabel: confirmLabel || t("app.confirmOk"), danger, more: extra, even: !!even, resolve };
|
|
22
|
+
const item = { id: ++seq, title: title || t("app.confirmTitle"), message: String(message || ""), confirmLabel: confirmLabel || t("app.confirmOk"), danger, more: extra, even: !!even, notice: !!notice, resolve };
|
|
22
23
|
confirmStore.set((s) => ({ queue: [...s.queue, item] }));
|
|
23
24
|
});
|
|
24
25
|
}
|
|
@@ -39,7 +40,7 @@ export function ConfirmHost() {
|
|
|
39
40
|
const paragraphs = q.message.split(/\n{2,}/);
|
|
40
41
|
// `even`: the two buttons share the row's width on every screen (as a phone's bottom sheet always does).
|
|
41
42
|
return html`<${Dialog} key=${q.id} title=${q.title} cls=${q.even ? "dlg-even" : ""} onClose=${() => answerConfirm(q.id, false)}
|
|
42
|
-
actions=${html`<button type="button" class="btn" onClick=${() => answerConfirm(q.id, false)}>${t("app.cancel")}</button
|
|
43
|
+
actions=${html`${q.notice ? null : html`<button type="button" class="btn" onClick=${() => answerConfirm(q.id, false)}>${t("app.cancel")}</button>`}
|
|
43
44
|
<button type="button" class=${`btn ${q.danger ? "btn-danger" : "btn-primary"}`} data-confirm="yes" onClick=${() => answerConfirm(q.id, true)}>${q.confirmLabel}</button>`}>
|
|
44
45
|
${paragraphs.map((p, i) => html`<p key=${i} class="confirm-text">${p}</p>`)}
|
|
45
46
|
${q.more ? html`<details class="confirm-more"><summary>${q.more.label}</summary><ul>${q.more.lines.map((l, i) => html`<li key=${i} class="mono">${l}</li>`)}</ul></details>` : null}
|
|
@@ -56,6 +56,8 @@ const P = {
|
|
|
56
56
|
key: () => html`<circle cx="7.5" cy="15.5" r="4.5"/><path d="M10.7 12.3L21 2M17 6l3 3M14 9l2 2"/>`,
|
|
57
57
|
pause: () => html`<path d="M8 5v14M16 5v14"/>`,
|
|
58
58
|
download: () => html`<path d="M12 3v12M7 10l5 5 5-5M5 21h14"/>`,
|
|
59
|
+
// S-255: install as an app — a screen with an arrow down into it (not a plain download).
|
|
60
|
+
install: () => html`<rect x="3" y="3" width="18" height="13" rx="2"/><path d="M12 6.5v6M9 9.5l3 3 3-3M8 21h8M12 16v5"/>`,
|
|
59
61
|
org: () => html`<rect x="9" y="2" width="6" height="5" rx="1"/><rect x="2" y="17" width="6" height="5" rx="1"/><rect x="16" y="17" width="6" height="5" rx="1"/><path d="M12 7v5M5 17v-5h14v5"/>`,
|
|
60
62
|
panel: () => html`<rect x="3" y="4" width="18" height="16" rx="2"/><path d="M14 4v16"/>`,
|
|
61
63
|
back: () => html`<path d="M19 12H5M12 19l-7-7 7-7"/>`,
|