@songsid/agend 2.3.0-beta.6 → 2.3.0-beta.8
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-cli-instructions.md +1 -1
- package/dist/agent-cli.js +21 -2
- package/dist/agent-cli.js.map +1 -1
- package/dist/agent-endpoint.js +4 -0
- package/dist/agent-endpoint.js.map +1 -1
- package/dist/agent-file-read.js +68 -8
- package/dist/agent-file-read.js.map +1 -1
- package/dist/agent-whats-new.js +4 -0
- package/dist/agent-whats-new.js.map +1 -1
- package/dist/auth-api.js +3 -1
- package/dist/auth-api.js.map +1 -1
- package/dist/authority/authority-state.d.ts +38 -0
- package/dist/authority/authority-state.js +114 -0
- package/dist/authority/authority-state.js.map +1 -0
- package/dist/authority/session-authorizations.d.ts +43 -0
- package/dist/authority/session-authorizations.js +102 -0
- package/dist/authority/session-authorizations.js.map +1 -0
- package/dist/authority/web-authority.d.ts +31 -11
- package/dist/authority/web-authority.js +39 -12
- package/dist/authority/web-authority.js.map +1 -1
- package/dist/cache-ledger.d.ts +16 -3
- package/dist/cache-ledger.js +33 -13
- package/dist/cache-ledger.js.map +1 -1
- package/dist/cache-service.d.ts +55 -3
- package/dist/cache-service.js +152 -16
- package/dist/cache-service.js.map +1 -1
- package/dist/channel/mcp-tools.js +13 -7
- package/dist/channel/mcp-tools.js.map +1 -1
- package/dist/classic-channel-manager.d.ts +2 -2
- package/dist/classic-channel-manager.js +2 -6
- package/dist/classic-channel-manager.js.map +1 -1
- package/dist/config-validator.js +10 -4
- package/dist/config-validator.js.map +1 -1
- package/dist/daemon.d.ts +2 -0
- package/dist/daemon.js +31 -9
- package/dist/daemon.js.map +1 -1
- package/dist/delivery-outbox.d.ts +8 -0
- package/dist/delivery-outbox.js +7 -1
- package/dist/delivery-outbox.js.map +1 -1
- package/dist/fleet-manager.d.ts +109 -2
- package/dist/fleet-manager.js +280 -12
- package/dist/fleet-manager.js.map +1 -1
- package/dist/general-knowledge/skills/cross-instance-messaging/SKILL.md +2 -1
- package/dist/general-knowledge/skills/multi-channel/SKILL.md +2 -1
- package/dist/general-knowledge/skills/web-appearance/SKILL.md +89 -30
- package/dist/general-knowledge/skills/web-dashboard/SKILL.md +62 -8
- package/dist/general-knowledge/skills/worker-collaboration/SKILL.md +1 -1
- package/dist/human-delivery-receipts.d.ts +14 -0
- package/dist/human-delivery-receipts.js +42 -6
- package/dist/human-delivery-receipts.js.map +1 -1
- package/dist/instance-config-impact.js +1 -0
- package/dist/instance-config-impact.js.map +1 -1
- package/dist/instance-names.d.ts +4 -0
- package/dist/instance-names.js +12 -0
- package/dist/instance-names.js.map +1 -0
- package/dist/instructions.d.ts +8 -1
- package/dist/instructions.js +9 -2
- package/dist/instructions.js.map +1 -1
- package/dist/locale.js +52 -0
- package/dist/locale.js.map +1 -1
- package/dist/outbound-handlers.d.ts +6 -0
- package/dist/outbound-handlers.js +49 -2
- package/dist/outbound-handlers.js.map +1 -1
- package/dist/outbound-schemas.d.ts +57 -1
- package/dist/outbound-schemas.js +34 -2
- package/dist/outbound-schemas.js.map +1 -1
- package/dist/public-web-gateway.js +8 -2
- package/dist/public-web-gateway.js.map +1 -1
- package/dist/rollout-index.d.ts +5 -0
- package/dist/rollout-index.js +26 -5
- package/dist/rollout-index.js.map +1 -1
- package/dist/settings-api.d.ts +6 -0
- package/dist/settings-api.js +54 -1
- package/dist/settings-api.js.map +1 -1
- package/dist/settings-change.js +31 -0
- package/dist/settings-change.js.map +1 -1
- package/dist/settings-effect.js +10 -1
- package/dist/settings-effect.js.map +1 -1
- package/dist/tool-permissions.d.ts +0 -7
- package/dist/tool-permissions.js +73 -5
- package/dist/tool-permissions.js.map +1 -1
- package/dist/topic-commands.d.ts +2 -1
- package/dist/topic-commands.js +2 -4
- package/dist/topic-commands.js.map +1 -1
- package/dist/types.d.ts +13 -2
- package/dist/ui/app-effects.js +46 -28
- package/dist/ui/chat-ambient.js +307 -0
- package/dist/ui/chat-effect-posters.js +8 -8
- package/dist/ui/chat-effects.js +51 -22
- package/dist/ui/chat-strings.js +21 -6
- package/dist/ui/chat-thread.js +1 -1
- package/dist/ui/fleet-usage.js +401 -0
- package/dist/ui/panel-chat.js +22 -9
- package/dist/ui/panel-fleet.js +6 -5
- package/dist/ui/panel-settings.js +10 -2
- package/dist/ui/settings-appearance.js +8 -0
- package/dist/ui/settings-mods.js +19 -6
- package/dist/ui/settings-owner-effects.js +3 -3
- package/dist/ui/settings-strings.js +30 -0
- package/dist/ui/settings-web-authority.js +91 -0
- package/dist/ui/shared/app-route.js +1 -1
- package/dist/ui/shared/app-session.js +2 -0
- package/dist/ui/shared/app-shell.js +2 -1
- package/dist/ui/shared/app-themes.js +24 -6
- package/dist/ui/shared/app.css +95 -0
- package/dist/ui/shared/effect-app-runtime.js +68 -19
- package/dist/ui/shared/effect-chat-runtime.js +16 -3
- package/dist/ui/shared/effect-frame.js +17 -3
- package/dist/ui/shared/effect-policy.js +18 -5
- package/dist/ui/shared/effect-profiler.js +31 -9
- package/dist/ui/shared/effect-registry.js +17 -41
- package/dist/ui/shared/effect-stock-trust.js +4 -4
- package/dist/ui/shared/effect-trial-stage.js +18 -7
- package/dist/ui/shared/fx-motion.js +67 -0
- package/dist/ui/shared/usage-dialog.js +8 -0
- package/dist/ui/shared/view-strings.js +4 -0
- package/dist/ui/shared/web-authorize.js +151 -0
- package/dist/usage-report.d.ts +158 -0
- package/dist/usage-report.js +226 -0
- package/dist/usage-report.js.map +1 -0
- package/dist/usage-rollup.d.ts +51 -0
- package/dist/usage-rollup.js +168 -0
- package/dist/usage-rollup.js.map +1 -0
- package/dist/web-ambient.d.ts +72 -0
- package/dist/web-ambient.js +154 -0
- package/dist/web-ambient.js.map +1 -0
- package/dist/web-api.d.ts +33 -0
- package/dist/web-api.js +148 -18
- package/dist/web-api.js.map +1 -1
- package/dist/web-appearance-tools.d.ts +3 -0
- package/dist/web-appearance-tools.js +18 -3
- package/dist/web-appearance-tools.js.map +1 -1
- package/dist/web-appearance-view.d.ts +14 -2
- package/dist/web-appearance-view.js +32 -5
- package/dist/web-appearance-view.js.map +1 -1
- package/dist/web-appearance.d.ts +15 -1
- package/dist/web-appearance.js +77 -1
- package/dist/web-appearance.js.map +1 -1
- package/dist/web-asset-parts.d.ts +2 -2
- package/dist/web-asset-parts.js +3 -3
- package/dist/web-asset-parts.js.map +1 -1
- package/dist/web-auth.js +3 -1
- package/dist/web-auth.js.map +1 -1
- package/dist/web-effect-bootstrap.d.ts +12 -0
- package/dist/web-effect-bootstrap.js +49 -0
- package/dist/web-effect-bootstrap.js.map +1 -0
- package/dist/web-effect-bundle.js +46 -1
- package/dist/web-effect-bundle.js.map +1 -1
- package/dist/web-effect-playback.d.ts +30 -0
- package/dist/web-effect-playback.js +71 -0
- package/dist/web-effect-playback.js.map +1 -0
- package/dist/web-effect-profiles.d.ts +4 -4
- package/dist/web-effect-service.d.ts +11 -4
- package/dist/web-effect-service.js +25 -4
- package/dist/web-effect-service.js.map +1 -1
- package/dist/web-effect-tools.d.ts +1 -0
- package/dist/web-effect-tools.js +2 -1
- package/dist/web-effect-tools.js.map +1 -1
- package/dist/web-effect-worker.d.ts +1 -1
- package/dist/web-effect-worker.js +2 -2
- package/dist/web-effect-worker.js.map +1 -1
- package/dist/web-guest-access.js +3 -1
- package/dist/web-guest-access.js.map +1 -1
- package/dist/web-mod-agent.js +5 -1
- package/dist/web-mod-agent.js.map +1 -1
- package/dist/web-mod-bundle.d.ts +9 -1
- package/dist/web-mod-bundle.js +62 -3
- package/dist/web-mod-bundle.js.map +1 -1
- package/dist/web-mod-export.d.ts +9 -0
- package/dist/web-mod-export.js +21 -0
- package/dist/web-mod-export.js.map +1 -1
- package/dist/web-mod-store.d.ts +2 -1
- package/dist/web-mod-store.js +13 -6
- package/dist/web-mod-store.js.map +1 -1
- package/dist/web-session-authorization.d.ts +132 -0
- package/dist/web-session-authorization.js +193 -0
- package/dist/web-session-authorization.js.map +1 -0
- package/dist/web-session.d.ts +5 -0
- package/dist/web-session.js +16 -0
- package/dist/web-session.js.map +1 -1
- package/dist/web-settings-patch.d.ts +26 -2
- package/dist/web-settings-patch.js +50 -1
- package/dist/web-settings-patch.js.map +1 -1
- package/dist/web-settings-tools.d.ts +8 -0
- package/dist/web-settings-tools.js +14 -1
- package/dist/web-settings-tools.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-theme-store.d.ts +39 -0
- package/dist/web-theme-store.js +122 -11
- package/dist/web-theme-store.js.map +1 -1
- package/package.json +1 -1
package/dist/ui/chat-effects.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// #1629: Chat contributes a committed lease to the one app owner; no private pool or server polling.
|
|
2
|
-
import { html, useLayoutEffect, useRef, useState } from "/assets/app-html.js";
|
|
2
|
+
import { html, useEffect, useLayoutEffect, useRef, useState } from "/assets/app-html.js";
|
|
3
3
|
import { register, t } from "/assets/app-i18n.js";
|
|
4
4
|
import { appStore, useStore } from "/assets/app-store.js";
|
|
5
5
|
import { ownerCssLifecycle } from "/assets/owner-css.js";
|
|
@@ -7,55 +7,79 @@ import { chatEffectState, chatEffectIdentity } from "/assets/effect-chat-runtime
|
|
|
7
7
|
import { Dialog } from "/assets/ui-dialog.js";
|
|
8
8
|
import { navigate } from "/assets/app-nav.js";
|
|
9
9
|
import { toast } from "/assets/ui-toast.js";
|
|
10
|
+
import { setThemesShown, themesShown, themesStore } from "/assets/app-themes.js";
|
|
11
|
+
import { setFollowsReducedMotion } from "/assets/fx-motion.js";
|
|
10
12
|
import { getAppEffects } from "./app-effects.js";
|
|
11
13
|
|
|
12
14
|
register("chatFx", {
|
|
13
|
-
en: {
|
|
15
|
+
en: { transport: "Off: the isolated effect frame could not start. Reload to try again.", enableHere: "Turn effects on here", playMotion: "Play effects anyway", leaveSafe: "Leave safe mode", viewerShow: "Show themes, effects and widgets here", clock: "Off: the page timing clock is unavailable. Reload to try again.", gatesUnknown: "Off: the playback conditions could not be verified.", resource: "Off: this effect could not be loaded or verified. Reload to try again.", frontQueue: "Waiting for a foreground slot.", consent: "This page has older playback information. Reload to use the isolated effect player.", previewMissing: "Off: the isolated effect frame is unavailable. Reload to try again.", unsupported: "Off: this browser lacks required Canvas Worker or layout support.", calibration: "Starting the effect.", baseline: "This page has older playback information. Reload to try again.", safetyUnknown: "Stopped: this device's safety history could not be verified. Reload to check it.", rawReason: "Playback blocked: {0}", missingRow: "Playback state is unavailable (runtime_unavailable).", region: "Off: this effect does not declare the chat region.", blocked: "Placed effects are blocked for this viewer:", deviceSetting: "Open device preferences", webSetting: "Open Web settings", reloadHint: "Reload page",
|
|
16
|
+
title: "Effects", loading: "Checking effects…", empty: "No effects in this chat.", failed: "Effects stopped because their resources could not be verified. Reload the page to try again.", reload: "Reload page", pause: "Pause", resume: "Resume", remove: "Remove from chat", removeFailed: "Could not remove this effect. Reload the page to check its state.", css: "Agent foreground effects are paused while your custom CSS is on or cannot be verified.", setting: "Open Web appearance settings", running: "Running", starting: "Starting", off: "Stopped", resumeFailed: "This effect cannot resume: the page or its safety history is not ready. Reload the page or choose another effect.", queued: "Waiting for a slot", unknown: "Playback is off or unavailable here.", budget: "Paused to protect page responsiveness. Resume keeps the three-pauses safety limit.", pauseHelp: "Resume keeps this device’s automatic-pause history and three-pause safety limit.", paused: "Paused", low: "Reduced quality",
|
|
14
17
|
typing: "Waiting while you type — it plays when you leave the message box.", covered: "Waiting while a menu or panel covers the chat.",
|
|
15
18
|
dialogOpen: "Paused while this dialog is open.", wasRunning: "Was running; paused while this dialog is open.", modal: "Waiting while a dialog is open.",
|
|
16
19
|
off3: "Turned off on this device after three automatic pauses. Resume cannot restart it here.", interrupted: "Stopped: the page closed while it was playing. Resume to play it again.",
|
|
17
|
-
cssOff: "Off while your custom CSS is on.", reducedMotion: "Off:
|
|
18
|
-
|
|
20
|
+
cssOff: "Off while your custom CSS is on.", reducedMotion: "Off: you chose to follow the system's reduced motion setting.", saveData: "This page has older playback information. Reload to try again.",
|
|
21
|
+
hiddenTab: "Waiting until this tab is visible.", offscreen: "Waiting until the chat is on screen.",
|
|
19
22
|
safeMode: "Off in safe mode.", publicLink: "Off on a public link.", disabled: "Effects are switched off." },
|
|
20
|
-
"zh-TW": {
|
|
23
|
+
"zh-TW": { transport: "已關閉:無法啟動隔離效果框架。請重新載入再試。", enableHere: "在這裡開啟效果", playMotion: "仍然播放效果", leaveSafe: "離開安全模式", viewerShow: "在這裡顯示主題、效果與小工具", clock: "已關閉:頁面計時無法使用。請重新載入再試。", gatesUnknown: "已關閉:無法確認播放條件。", resource: "已關閉:無法載入或驗證此效果。請重新載入再試。", frontQueue: "等待前景空位。", consent: "這個頁面的播放資訊已過期。請重新載入以使用隔離效果播放器。", previewMissing: "已關閉:隔離效果框架無法使用。請重新載入再試。", unsupported: "已關閉:這個瀏覽器缺少 Canvas Worker 或版面驗證支援。", calibration: "正在啟動效果。", baseline: "這個頁面的播放資訊已過期,請重新載入再試。", safetyUnknown: "已停止:無法確認這台裝置的安全紀錄。請重新載入確認。", rawReason: "播放受阻:{0}", missingRow: "無法取得播放狀態(runtime_unavailable)。", region: "已關閉:此效果未宣告聊天區域。", blocked: "放置的效果目前無法在這個畫面播放:", deviceSetting: "開啟裝置偏好設定", webSetting: "開啟網頁設定", reloadHint: "重新載入頁面",
|
|
24
|
+
title: "效果", loading: "正在確認效果…", empty: "這個聊天沒有放置效果。", failed: "無法確認效果資源,已停止播放。重新載入頁面後再試。", reload: "重新載入頁面", pause: "暫停", resume: "恢復", remove: "從聊天移除", removeFailed: "無法移除效果。請重新載入頁面確認狀態。", css: "自訂 CSS 開啟或無法確認時,代理的前景效果會暫停。", setting: "開啟網頁外觀設定", running: "播放中", starting: "啟動中", off: "已停止", resumeFailed: "頁面或安全紀錄尚未就緒,無法恢復此效果。請重新載入頁面,或選擇其他效果。", queued: "等待空位", unknown: "這裡已關閉播放,或無法播放效果。", budget: "為維持頁面順暢,已暫停效果。恢復仍保留三次暫停的安全上限。", pauseHelp: "恢復仍保留這台裝置的自動暫停紀錄與三次暫停安全上限。", paused: "已暫停", low: "降低畫質",
|
|
21
25
|
typing: "輸入時暫停,離開訊息輸入框就會播放。", covered: "選單或面板蓋住聊天時暫停。",
|
|
22
26
|
dialogOpen: "開著這個對話框時暫停。", wasRunning: "原本在播放;開著這個對話框時暫停。", modal: "有對話框開著時暫停。",
|
|
23
27
|
off3: "已自動暫停三次,這台裝置已關閉此效果,無法在這裡恢復。", interrupted: "播放時頁面被關閉而停止。按「恢復」再播放一次。",
|
|
24
|
-
cssOff: "自訂 CSS 開啟時關閉。", reducedMotion: "
|
|
25
|
-
|
|
28
|
+
cssOff: "自訂 CSS 開啟時關閉。", reducedMotion: "已關閉:效果跟隨這台裝置的「減少動態效果」設定。", saveData: "這個頁面的播放資訊已過期,請重新載入再試。",
|
|
29
|
+
hiddenTab: "等這個分頁顯示時再播放。", offscreen: "等聊天顯示在畫面上時再播放。",
|
|
26
30
|
safeMode: "安全模式下關閉。", publicLink: "公開連結上關閉。", disabled: "效果已關閉。" },
|
|
27
31
|
});
|
|
28
32
|
|
|
29
|
-
/**
|
|
33
|
+
/** Read/admin dashboard sessions keep management controls; public/guest Chat playback has no owner identity. */
|
|
30
34
|
export function chatEffectsMenuAvailable() { return chatEffectIdentity(window) !== null; }
|
|
31
35
|
|
|
32
36
|
// #2055: what a row's state means, in words — never only "Stopped" when the runtime knows why.
|
|
33
37
|
const RECENT_MS = 5000;
|
|
34
|
-
const
|
|
35
|
-
|
|
38
|
+
const REASON_KEY = { __proto__: null, transport_unavailable: "chatFx.transport", owner_css: "chatFx.cssOff", reduced_motion: "chatFx.reducedMotion", save_data: "chatFx.saveData", preview_unavailable: "chatFx.previewMissing", preview_not_consented: "chatFx.consent", unsupported_host: "chatFx.unsupported", registry_unsupported: "chatFx.unsupported",
|
|
39
|
+
baseline_unsupported: "chatFx.baseline", baseline_unavailable: "chatFx.baseline", baseline_timeout: "chatFx.baseline", calibrating: "chatFx.calibration", safety_unknown: "chatFx.safetyUnknown", region_unavailable: "chatFx.region",
|
|
36
40
|
hidden: "chatFx.hiddenTab", offscreen: "chatFx.offscreen", safe_mode: "chatFx.safeMode", public_link: "chatFx.publicLink", disabled: "chatFx.disabled",
|
|
41
|
+
clock_unavailable: "chatFx.clock", gates_unknown: "chatFx.gatesUnknown", runtime_unavailable: "chatFx.missingRow", resource_unavailable: "chatFx.resource", resource_timeout: "chatFx.resource", front_limit: "chatFx.frontQueue",
|
|
37
42
|
safety_off: "chatFx.off3", interrupted: "chatFx.interrupted" };
|
|
38
43
|
/** `ownOpen`: this Effects dialog is open; `wasRunning`: the effect was running when it opened (shown as past, never as current). */
|
|
39
44
|
export function effectRowText(row, { ownOpen = false, wasRunning = false, doc = typeof document === "undefined" ? null : document } = {}) {
|
|
40
|
-
if (!row) return t("chatFx.
|
|
45
|
+
if (!row) return t("chatFx.missingRow");
|
|
41
46
|
// The sticky history first (it is what Resume answers), then a pause, then what is playing or queued.
|
|
42
47
|
if (row.reason === "safety_off" || row.reason === "interrupted") return t(REASON_KEY[row.reason]);
|
|
43
48
|
if (row.reason === "paused" || row.reason === "host_budget") return t("chatFx.paused");
|
|
49
|
+
if (REASON_KEY[row.reason]) return t(REASON_KEY[row.reason]);
|
|
50
|
+
if (row.reason != null && !["stock_overlay", "modal", "frame_limit"].includes(row.reason))
|
|
51
|
+
return t("chatFx.rawReason", typeof row.reason === "string" ? row.reason.replace(/[\u0000-\u001f\u007f]/g, "").slice(0, 80) : "unknown");
|
|
44
52
|
if (row.phase === "running") return t("chatFx.running");
|
|
45
53
|
if (row.phase) return t("chatFx.starting");
|
|
46
54
|
if (row.verdict === "queued") return t("chatFx.queued");
|
|
47
55
|
if (row.reason === "stock_overlay" || row.reason === "modal") {
|
|
48
56
|
if (ownOpen) return t(wasRunning ? "chatFx.wasRunning" : "chatFx.dialogOpen");
|
|
49
57
|
if (row.reason === "modal") return t("chatFx.modal");
|
|
50
|
-
|
|
51
|
-
const a = doc?.activeElement;
|
|
52
|
-
return t(a && a !== doc.body && typeof a.matches === "function" && (a.matches(EDITABLE) || a.isContentEditable === true) ? "chatFx.typing" : "chatFx.covered");
|
|
58
|
+
return t("chatFx.covered");
|
|
53
59
|
}
|
|
54
|
-
return
|
|
60
|
+
return t("chatFx.rawReason", typeof row.reason === "string" ? row.reason.replace(/[\u0000-\u001f\u007f]/g, "").slice(0, 80) : "unknown");
|
|
55
61
|
}
|
|
56
62
|
|
|
57
|
-
|
|
63
|
+
/** Fixed local actions: no server/Worker-provided destination or raw reason in a URL. */
|
|
64
|
+
export function effectReasonAction(reason) {
|
|
65
|
+
if (reason === "preview_not_consented" || reason === "preview_unavailable") return { reload: true, label: "chatFx.reloadHint" };
|
|
66
|
+
if (["disabled", "owner_css"].includes(reason)) return { href: "/settings/appearance", label: "chatFx.setting" };
|
|
67
|
+
if (["transport_unavailable", "baseline_unsupported", "baseline_unavailable", "baseline_timeout", "runtime_unavailable", "resource_unavailable", "resource_timeout", "clock_unavailable", "safety_unknown"].includes(reason)) return { reload: true, label: "chatFx.reloadHint" };
|
|
68
|
+
return null;
|
|
69
|
+
}
|
|
70
|
+
const localViewer = () => document.body.dataset.publicLink === "1" || document.body.dataset.tier === "guest";
|
|
71
|
+
function ReasonAction({ reason, onClose = () => {} }) {
|
|
72
|
+
if (reason === "safe_mode") return html`<button type="button" class="btn" onClick=${() => { onClose(); const url = new URL(location.href); url.searchParams.delete("safe"); location.assign(url.href); }}>${t("chatFx.leaveSafe")}</button>`;
|
|
73
|
+
if (reason === "reduced_motion") return html`<button type="button" class="btn" onClick=${() => { onClose(); setFollowsReducedMotion(false); }}>${t("chatFx.playMotion")}</button>`;
|
|
74
|
+
if (reason === "disabled" && localViewer()) return html`<button type="button" class="btn" onClick=${() => { onClose(); setThemesShown(true); }}>${t("chatFx.enableHere")}</button>`;
|
|
75
|
+
const action = document.body.dataset.tier === "guest" && reason === "owner_css" ? { reload: true, label: "chatFx.reloadHint" } : effectReasonAction(reason);
|
|
76
|
+
return action ? html`<button type="button" class="btn" onClick=${() => { onClose(); if (action.reload) location.reload(); else navigate(action.href); }}>${t(action.label)}</button>` : null;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const NO_PLAYBACK = () => {};
|
|
80
|
+
export function ChatEffects({ name, lease, element, store, open, onClose, onPlayback = NO_PLAYBACK }) {
|
|
58
81
|
const cssLife = useStore(ownerCssLifecycle);
|
|
82
|
+
useStore(themesStore); // Viewer-local off/on is visible immediately, independent of runtime callbacks.
|
|
59
83
|
// Which effects were running just before this dialog opened ("was running" is said in the past, never shown as
|
|
60
84
|
// current). The ⋯ menu that opens it is a barrier too, so "just before" is within RECENT_MS of the observed stop.
|
|
61
85
|
// Tracked where updates arrive (an unchanged snapshot is not republished while an effect keeps running).
|
|
@@ -77,7 +101,7 @@ export function ChatEffects({ name, lease, element, store, open, onClose }) {
|
|
|
77
101
|
setBusy(false); onClose(); setCanWrite(false); setState(null);
|
|
78
102
|
const host = window, owner = getAppEffects(host);
|
|
79
103
|
const current = () => live && lease.current();
|
|
80
|
-
if (!owner) { setState({ error: null, rows: [], effects: [], unavailable: true }); return cleanup; }
|
|
104
|
+
if (!owner) { setState({ error: null, rows: [], effects: [], unavailable: true, reason: typeof host.OffscreenCanvas !== "function" || typeof host.Worker !== "function" ? "unsupported_host" : "runtime_unavailable" }); return cleanup; }
|
|
81
105
|
releases.push(owner.onEnd(() => { if (current()) setState({ error: "resource_unavailable", rows: [], effects: [], unavailable: true }); }));
|
|
82
106
|
playing.current = new Map(); // evidence belongs to this name and lease only
|
|
83
107
|
const track = rows => {
|
|
@@ -93,13 +117,13 @@ export function ChatEffects({ name, lease, element, store, open, onClose }) {
|
|
|
93
117
|
if (!current()) return;
|
|
94
118
|
track(value?.rows);
|
|
95
119
|
const g = owner.gates();
|
|
96
|
-
setState({ ...value, unavailable: !g.enabled || !g.show || !g.
|
|
120
|
+
setState({ ...value, unavailable: !g.enabled || !g.show || !g.transportReady || g.safe || g.reducedMotion });
|
|
97
121
|
};
|
|
98
122
|
api = owner.attachChat({ name, element: element.current, current,
|
|
99
123
|
observe: () => ({ state: chatEffectState(appStore.get(), name) }), onChange: changed });
|
|
100
124
|
runtime.current = api;
|
|
101
|
-
if (!api?.ok) { setState({ error: null, rows: [], effects: [], unavailable: true }); return cleanup; }
|
|
102
|
-
host.AgendAuth?.canWrite?.().then(value => { if (current()) setCanWrite(value === true); }).catch(() => {});
|
|
125
|
+
if (!api?.ok) { setState({ error: null, rows: [], effects: [], unavailable: true, reason: "runtime_unavailable" }); return cleanup; }
|
|
126
|
+
if (chatEffectIdentity(host)) host.AgendAuth?.canWrite?.().then(value => { if (current()) setCanWrite(value === true); }).catch(() => {});
|
|
103
127
|
api.sync();
|
|
104
128
|
return cleanup;
|
|
105
129
|
} catch {
|
|
@@ -117,12 +141,17 @@ export function ChatEffects({ name, lease, element, store, open, onClose }) {
|
|
|
117
141
|
wasOpen.current = open;
|
|
118
142
|
const css = cssLife.state !== "off" && effects.some(p => p.by !== "human" && p.manifest.layer === "front");
|
|
119
143
|
const remove = async id => { if (busy) return; setBusy(true); const api = runtime.current; const ok = await api?.remove?.(id); if (!lease.current() || runtime.current !== api) return; setBusy(false); if (!ok) toast(t("chatFx.removeFailed"), false); };
|
|
120
|
-
|
|
144
|
+
const playingNow = !state?.unavailable && !state?.error && rows.some(row => row.phase === "running" && row.reason == null);
|
|
145
|
+
useEffect(() => { onPlayback({ name, playing: playingNow }); return () => onPlayback({ name, playing: false }); }, [name, playingNow, onPlayback]);
|
|
146
|
+
const blocked = effects.flatMap(p => { const row = rows.find(r => r.id === p.id); return row?.phase === "running" && row.reason == null ? [] : [{ p, row }]; });
|
|
147
|
+
return html`${!open && localViewer() && effects.length ? html`<div class="chat-fx-notice"><label><input type="checkbox" checked=${themesShown()} onChange=${e => setThemesShown(e.currentTarget.checked)} /> ${t("chatFx.viewerShow")}</label></div>` : null}${!open && state?.error && !effects.length ? html`<div class="chat-fx-notice" role="status">${effectRowText({ reason: state.error })} <${ReasonAction} reason=${state.error} /></div>` : null}${!open && state?.reason ? html`<div class="chat-fx-notice" role="status">${effectRowText({ reason: state.reason })} <${ReasonAction} reason=${state.reason} /></div>` : null}${!open && blocked.length ? html`<div class="chat-fx-notice" role="status"><strong>${t("chatFx.blocked")}</strong>
|
|
148
|
+
${blocked.map(({ p, row }) => html`<span key=${p.id}>${p.manifest.title}: ${effectRowText(row)} ${["paused", "host_budget"].includes(row?.reason) ? html`<small>${t(row.reason === "host_budget" ? "chatFx.budget" : "chatFx.pauseHelp")}</small>` : null} <${ReasonAction} reason=${row?.reason} /></span>`)}</div>` : null}${open ? html`<${Dialog} title=${t("chatFx.title")} onClose=${onClose} busy=${busy}>
|
|
121
149
|
${state?.error ? html`<p>${t("chatFx.failed")}</p><button type="button" class="btn" onClick=${() => location.reload()}>${t("chatFx.reload")}</button>` : null}
|
|
122
150
|
${css ? html`<p>${t("chatFx.css")}</p><button type="button" class="btn" onClick=${() => { onClose(); navigate("/settings/appearance"); }}>${t("chatFx.setting")}</button>` : null}
|
|
123
151
|
${!effects.length && !state?.error ? html`<p>${t(state?.unavailable ? "chatFx.unknown" : state?.loading || !state ? "chatFx.loading" : "chatFx.empty")}</p>` : null}
|
|
124
152
|
${effects.map(p => { const row = rows.find(r => r.id === p.id); return html`<section key=${p.id}><h3>${p.manifest.title}</h3><p>${effectRowText(row, { ownOpen: open, wasRunning: before.current?.get(p.id) === true })}${row?.quality === "low" ? ` · ${t("chatFx.low")}` : ""}</p>
|
|
125
|
-
|
|
153
|
+
<${ReasonAction} reason=${row?.reason} onClose=${onClose} />
|
|
154
|
+
${["paused", "host_budget"].includes(row?.reason) ? html`<p>${t(row.reason === "host_budget" ? "chatFx.budget" : "chatFx.pauseHelp")}</p>` : null}
|
|
126
155
|
<button type="button" class="btn" disabled=${busy} onClick=${() => runtime.current?.pause?.(p.id)}>${t("chatFx.pause")}</button>
|
|
127
156
|
<button type="button" class="btn" disabled=${busy} onClick=${() => { if (!runtime.current?.resume?.(p.id)) toast(t(rows.find(r => r.id === p.id)?.reason === "safety_off" ? "chatFx.off3" : "chatFx.resumeFailed"), false); }}>${t("chatFx.resume")}</button>
|
|
128
157
|
${canWrite ? html`<button type="button" class="btn" disabled=${busy} onClick=${() => remove(p.id)}>${t("chatFx.remove")}</button>` : null}</section>`; })}
|
package/dist/ui/chat-strings.js
CHANGED
|
@@ -4,14 +4,14 @@ import { register } from "/assets/app-i18n.js";
|
|
|
4
4
|
register("chat", {
|
|
5
5
|
en: {
|
|
6
6
|
effectTrialReason_checking: "Checking this session…",
|
|
7
|
-
effectTrialReason_localAdmin: "Sign in as an admin
|
|
7
|
+
effectTrialReason_localAdmin: "Sign in as an admin outside the public link to Try.",
|
|
8
8
|
effectTrialReason_chatChanged: "Open the chat that offered this trial.",
|
|
9
9
|
effectTrialReason_busy: "Stop the current trial before starting another.",
|
|
10
10
|
effectTrialReason_safe: "Turn off safe mode to Try.",
|
|
11
11
|
effectTrialReason_effectsOff: "Turn on effects to Try.",
|
|
12
|
-
effectTrialReason_reducedMotion: "
|
|
12
|
+
effectTrialReason_reducedMotion: "Effects follow this device’s reduced-motion setting.",
|
|
13
13
|
effectTrialReason_saveData: "Your device requests reduced data use.",
|
|
14
|
-
effectTrialReason_transport: "The
|
|
14
|
+
effectTrialReason_transport: "The isolated effect player is unavailable. Reload this page.",
|
|
15
15
|
effectTrialReason_unsupported: "Canvas Worker playback is unavailable in this browser.",
|
|
16
16
|
effectTrialReason_inactive: "Return to this page to Try.",
|
|
17
17
|
effectTrialReason_dialog: "Close the other menu or dialog to Try.",
|
|
@@ -19,6 +19,7 @@ register("chat", {
|
|
|
19
19
|
effectTrialSignIn: "Sign in here",
|
|
20
20
|
effectTrialStopOther: "Stop current trial",
|
|
21
21
|
effectTrialSettings: "Open playback settings",
|
|
22
|
+
effectTrialPlayMotion: "Play effects anyway",
|
|
22
23
|
effectTrial: "Effect trial", effectTrialLocal: "A sample on this page. Nothing is applied or saved.",
|
|
23
24
|
effectTrialStart: "Try", effectTrialExpired: "This trial offer has expired.", effectTrialUnavailable: "This trial is no longer available.",
|
|
24
25
|
cmdConfirm: "Clear", cmdConfirmBackend: "Switch and restart", cmdRunning: "Running /{0}…", cmdNotCommand: "Not a command here — Enter sends it as a message.", cmdDismiss: "Dismiss", cmdCommands: "Commands",
|
|
@@ -117,18 +118,25 @@ register("chat", {
|
|
|
117
118
|
themeResetDone: "{0}'s theme was reset.", themeLocked: "{0}'s theme is locked: the agent can't change it.", themeUnlocked: "{0}'s theme is unlocked.",
|
|
118
119
|
themeFailed: "The theme was not changed ({0}).",
|
|
119
120
|
widgetRemoveHeader: "Remove the chat header widget", widgetRemoveDetails: "Remove the Details widget", widgetRemoved: "{0}'s widget was removed.",
|
|
121
|
+
// #2117: an agent's ambient effect — why it is not showing here, and a person's Clear.
|
|
122
|
+
ambientBlocked_hidden: "Ambient effect hidden: agents' themes are off — turn them on",
|
|
123
|
+
ambientBlocked_safe: "Ambient effect hidden: safe mode (?safe=1) — leave safe mode",
|
|
124
|
+
ambientBlocked_reducedMotion: "Ambient effect hidden: this device follows reduced motion — play effects anyway",
|
|
125
|
+
ambientBlocked_unsupported: "Ambient effect hidden: this browser can't animate it",
|
|
126
|
+
ambientClearLoop: "Clear the ambient effect", ambientClearClick: "Clear the click effect", ambientCleared: "{0}'s ambient effect was cleared.",
|
|
127
|
+
ambientMotionNote: "Your system asks for reduced motion; effects are on.", ambientMotionNoteLink: "Turn off here", ambientMotionNoteClose: "Close",
|
|
120
128
|
configured: "(configured)", fleetDefault: "(fleet default)",
|
|
121
129
|
},
|
|
122
130
|
"zh-TW": {
|
|
123
131
|
effectTrialReason_checking: "正在確認工作階段…",
|
|
124
|
-
effectTrialReason_localAdmin: "
|
|
132
|
+
effectTrialReason_localAdmin: "請在公開連結以外的儀表板以管理員登入後試播。",
|
|
125
133
|
effectTrialReason_chatChanged: "請開啟發出試播邀請的聊天。",
|
|
126
134
|
effectTrialReason_busy: "請先停止目前的試播。",
|
|
127
135
|
effectTrialReason_safe: "請先關閉安全模式。",
|
|
128
136
|
effectTrialReason_effectsOff: "請先開啟效果。",
|
|
129
|
-
effectTrialReason_reducedMotion: "
|
|
137
|
+
effectTrialReason_reducedMotion: "效果跟隨這台裝置的「減少動態效果」設定。",
|
|
130
138
|
effectTrialReason_saveData: "裝置目前要求節省數據。",
|
|
131
|
-
effectTrialReason_transport: "
|
|
139
|
+
effectTrialReason_transport: "隔離效果播放器目前無法使用。請重新載入頁面。",
|
|
132
140
|
effectTrialReason_unsupported: "此瀏覽器無法播放 Canvas Worker 效果。",
|
|
133
141
|
effectTrialReason_inactive: "請回到本頁後試播。",
|
|
134
142
|
effectTrialReason_dialog: "請先關閉其他選單或對話框。",
|
|
@@ -136,6 +144,7 @@ register("chat", {
|
|
|
136
144
|
effectTrialSignIn: "在此登入",
|
|
137
145
|
effectTrialStopOther: "停止目前試播",
|
|
138
146
|
effectTrialSettings: "開啟播放設定",
|
|
147
|
+
effectTrialPlayMotion: "仍然播放效果",
|
|
139
148
|
effectTrial: "效果試播", effectTrialLocal: "僅在本頁試播,不會套用或儲存。",
|
|
140
149
|
effectTrialStart: "試播", effectTrialExpired: "試播邀請已過期。", effectTrialUnavailable: "此試播已無法使用。",
|
|
141
150
|
cmdConfirm: "清空", cmdConfirmBackend: "切換並重新啟動", cmdRunning: "執行 /{0} 中…", cmdNotCommand: "這裡沒有這個指令——按 Enter 會當成一般訊息送出。", cmdDismiss: "關閉", cmdCommands: "指令",
|
|
@@ -231,6 +240,12 @@ register("chat", {
|
|
|
231
240
|
themeResetDone: "已重設 {0} 的主題。", themeLocked: "已鎖定 {0} 的主題:agent 無法變更。", themeUnlocked: "已解除 {0} 的主題鎖定。",
|
|
232
241
|
themeFailed: "主題沒有變更({0})。",
|
|
233
242
|
widgetRemoveHeader: "移除聊天標頭的小工具", widgetRemoveDetails: "移除詳細資料頁的小工具", widgetRemoved: "已移除 {0} 的小工具。",
|
|
243
|
+
ambientBlocked_hidden: "環境效果未顯示:已關閉 agent 的主題——開啟",
|
|
244
|
+
ambientBlocked_safe: "環境效果未顯示:安全模式(?safe=1)——離開安全模式",
|
|
245
|
+
ambientBlocked_reducedMotion: "環境效果未顯示:這台裝置跟隨「減少動態效果」——仍然播放",
|
|
246
|
+
ambientBlocked_unsupported: "環境效果未顯示:此瀏覽器無法播放",
|
|
247
|
+
ambientClearLoop: "清除環境效果", ambientClearClick: "清除點擊效果", ambientCleared: "已清除 {0} 的環境效果。",
|
|
248
|
+
ambientMotionNote: "你的系統要求減少動態效果;效果目前開著。", ambientMotionNoteLink: "在這裡關閉", ambientMotionNoteClose: "關閉",
|
|
234
249
|
configured: "(設定值)", fleetDefault: "(fleet 預設)",
|
|
235
250
|
},
|
|
236
251
|
});
|
package/dist/ui/chat-thread.js
CHANGED
|
@@ -114,7 +114,7 @@ export function createThread(list, scroller, opts) {
|
|
|
114
114
|
function trialHtml(offer, time, message) {
|
|
115
115
|
const reason = trialNow() >= offer.expiresAt ? "expired" : PUBLIC_LINK() ? "localAdmin" : trialStatus(message);
|
|
116
116
|
const available = reason === "ready", fix = !PUBLIC_LINK() && !available && reason !== "expired" && reason !== "checking" && typeof opts.fixEffectTrial === "function";
|
|
117
|
-
const label = available ? "chat.effectTrialStart" : reason === "busy" ? "chat.effectTrialStopOther" : reason === "localAdmin" ? "chat.effectTrialSignIn" : "chat.effectTrialSettings";
|
|
117
|
+
const label = available ? "chat.effectTrialStart" : reason === "busy" ? "chat.effectTrialStopOther" : reason === "localAdmin" ? "chat.effectTrialSignIn" : reason === "reducedMotion" ? "chat.effectTrialPlayMotion" : "chat.effectTrialSettings";
|
|
118
118
|
const button = available || fix ? `<button type="button" class="btn btn-sm effect-trial-start" data-act="effectTrial" data-arg="${escAttr(msgKey(message))}">${escAttr(tr(label))}</button>` : "";
|
|
119
119
|
return `<div class="msg status-line"><div class="meta">${time}</div><div class="body"><div class="effect-trial-offer" data-trust="thread-control"><strong>${escAttr(tr("chat.effectTrial"))}: ${escAttr(offer.title)}</strong><div>${escAttr(tr(available ? "chat.effectTrialLocal" : "chat.effectTrialReason_" + reason))}</div>${button}</div></div></div>`;
|
|
120
120
|
}
|