@songsid/agend 2.3.0-beta.21 → 2.3.0-beta.23
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/README.md +2 -2
- package/README.zh-TW.md +2 -2
- package/dist/agent-cli.js +4 -2
- package/dist/agent-cli.js.map +1 -1
- package/dist/agent-endpoint.d.ts +9 -0
- package/dist/agent-endpoint.js +15 -0
- package/dist/agent-endpoint.js.map +1 -1
- package/dist/agent-whats-new.d.ts +5 -0
- package/dist/agent-whats-new.js +16 -1
- package/dist/agent-whats-new.js.map +1 -1
- package/dist/auth-api.d.ts +7 -0
- package/dist/auth-api.js +10 -3
- package/dist/auth-api.js.map +1 -1
- package/dist/backend/codex-package.d.ts +30 -0
- package/dist/backend/codex-package.js +133 -0
- package/dist/backend/codex-package.js.map +1 -0
- package/dist/backend/codex.d.ts +2 -0
- package/dist/backend/codex.js +9 -2
- package/dist/backend/codex.js.map +1 -1
- package/dist/backend/grok.js +56 -3
- package/dist/backend/grok.js.map +1 -1
- package/dist/backend/kiro.d.ts +9 -1
- package/dist/backend/kiro.js +102 -1
- package/dist/backend/kiro.js.map +1 -1
- package/dist/backend/opencode-permission.js +1 -1
- package/dist/backend/opencode-permission.js.map +1 -1
- package/dist/backend/opencode.js +2 -1
- package/dist/backend/opencode.js.map +1 -1
- package/dist/binary-probe.js +1 -1
- package/dist/bug-report-cli.js +1 -1
- package/dist/bundled-skills.d.ts +7 -3
- package/dist/bundled-skills.js +16 -7
- package/dist/bundled-skills.js.map +1 -1
- package/dist/channel/adapters/discord.js +3 -3
- package/dist/channel/adapters/discord.js.map +1 -1
- package/dist/channel/mcp-server.js +12 -4
- package/dist/channel/mcp-server.js.map +1 -1
- package/dist/channel/mcp-tools.d.ts +3 -1
- package/dist/channel/mcp-tools.js +38 -2
- package/dist/channel/mcp-tools.js.map +1 -1
- package/dist/child-process.d.ts +21 -0
- package/dist/child-process.js +54 -0
- package/dist/child-process.js.map +1 -0
- package/dist/cli.js +167 -182
- package/dist/cli.js.map +1 -1
- package/dist/command-table.d.ts +1 -1
- package/dist/command-table.js +1 -1
- package/dist/command-table.js.map +1 -1
- package/dist/config-validator.js +28 -2
- package/dist/config-validator.js.map +1 -1
- package/dist/config.d.ts +2 -2
- package/dist/config.js +16 -2
- package/dist/config.js.map +1 -1
- package/dist/daemon.d.ts +14 -0
- package/dist/daemon.js +45 -8
- package/dist/daemon.js.map +1 -1
- package/dist/darwin-memory.js +1 -1
- package/dist/doctor.d.ts +5 -0
- package/dist/doctor.js +42 -0
- package/dist/doctor.js.map +1 -1
- package/dist/export-import.js +1 -1
- package/dist/export-import.js.map +1 -1
- package/dist/fleet-level-config.d.ts +1 -1
- package/dist/fleet-level-config.js +2 -0
- package/dist/fleet-level-config.js.map +1 -1
- package/dist/fleet-manager.d.ts +73 -2
- package/dist/fleet-manager.js +400 -33
- package/dist/fleet-manager.js.map +1 -1
- package/dist/full-restart.d.ts +5 -5
- package/dist/full-restart.js +5 -5
- package/dist/full-restart.js.map +1 -1
- package/dist/general-knowledge/skills/fleet-config/SKILL.md +1 -1
- package/dist/general-knowledge/skills/fleet-restart/SKILL.md +8 -9
- package/dist/general-knowledge/skills/multi-channel/SKILL.md +1 -1
- package/dist/general-knowledge/skills/web-appearance/SKILL.canvas-worker-off.md +319 -0
- package/dist/general-knowledge/skills/web-dashboard/SKILL.canvas-worker-off.md +529 -0
- package/dist/general-knowledge/skills/web-dashboard/SKILL.md +19 -4
- package/dist/general-knowledge/steering/core-rules.md +1 -1
- package/dist/instance-config-impact.js +13 -3
- package/dist/instance-config-impact.js.map +1 -1
- package/dist/instance-lifecycle.js +6 -6
- package/dist/instance-lifecycle.js.map +1 -1
- package/dist/instructions.js +2 -1
- package/dist/instructions.js.map +1 -1
- package/dist/locale.js +137 -10
- package/dist/locale.js.map +1 -1
- package/dist/login-flows.js +1 -1
- package/dist/login-shell.js +3 -1
- package/dist/login-shell.js.map +1 -1
- package/dist/ls-rows.js +1 -1
- package/dist/needs-you-hub.d.ts +98 -1
- package/dist/needs-you-hub.js +313 -44
- package/dist/needs-you-hub.js.map +1 -1
- package/dist/needs-you-live.d.ts +5 -2
- package/dist/needs-you-live.js +6 -3
- package/dist/needs-you-live.js.map +1 -1
- package/dist/needs-you.d.ts +58 -3
- package/dist/needs-you.js +36 -3
- package/dist/needs-you.js.map +1 -1
- package/dist/outbound-handlers.js +25 -10
- package/dist/outbound-handlers.js.map +1 -1
- package/dist/outbound-schemas.d.ts +3 -3
- package/dist/provider-secret-registry.d.ts +5 -3
- package/dist/provider-secret-registry.js +8 -2
- package/dist/provider-secret-registry.js.map +1 -1
- package/dist/public-link-progress.d.ts +12 -1
- package/dist/public-link-progress.js +5 -10
- package/dist/public-link-progress.js.map +1 -1
- package/dist/public-tunnel-config.d.ts +11 -0
- package/dist/public-tunnel-config.js +68 -0
- package/dist/public-tunnel-config.js.map +1 -0
- package/dist/public-web-gateway.d.ts +2 -0
- package/dist/public-web-gateway.js +3 -2
- package/dist/public-web-gateway.js.map +1 -1
- package/dist/public-web-link.d.ts +13 -2
- package/dist/public-web-link.js +37 -10
- package/dist/public-web-link.js.map +1 -1
- package/dist/quickstart.js +14 -8
- package/dist/quickstart.js.map +1 -1
- package/dist/resource-report.js +1 -1
- package/dist/scheduler/task-board.d.ts +41 -1
- package/dist/scheduler/task-board.js +150 -4
- package/dist/scheduler/task-board.js.map +1 -1
- package/dist/sd-notify.js +2 -1
- package/dist/sd-notify.js.map +1 -1
- package/dist/secret-store.d.ts +2 -0
- package/dist/secret-store.js +21 -0
- package/dist/secret-store.js.map +1 -1
- package/dist/service-installer.d.ts +69 -0
- package/dist/service-installer.js +181 -0
- package/dist/service-installer.js.map +1 -1
- package/dist/service-owner.d.ts +44 -0
- package/dist/service-owner.js +48 -0
- package/dist/service-owner.js.map +1 -0
- package/dist/settings-api.d.ts +5 -0
- package/dist/settings-api.js +32 -10
- package/dist/settings-api.js.map +1 -1
- package/dist/settings-change.js +86 -3
- package/dist/settings-change.js.map +1 -1
- package/dist/settings-effect.js +6 -1
- package/dist/settings-effect.js.map +1 -1
- package/dist/settings-http-confirmation.d.ts +2 -0
- package/dist/settings-http-confirmation.js +4 -3
- package/dist/settings-http-confirmation.js.map +1 -1
- package/dist/settings-request-capability.d.ts +4 -1
- package/dist/settings-request-capability.js +11 -3
- package/dist/settings-request-capability.js.map +1 -1
- package/dist/setup-host.js +1 -1
- package/dist/setup-wizard.js +1 -1
- package/dist/setup-wizard.js.map +1 -1
- package/dist/task-board-summary.d.ts +101 -0
- package/dist/task-board-summary.js +177 -0
- package/dist/task-board-summary.js.map +1 -0
- package/dist/task-board-waker.d.ts +8 -1
- package/dist/task-board-waker.js +15 -6
- package/dist/task-board-waker.js.map +1 -1
- package/dist/tmux-control.js +1 -1
- package/dist/tmux-control.js.map +1 -1
- package/dist/tmux-exec-helper.d.ts +5 -1
- package/dist/tmux-exec-helper.js +13 -21
- package/dist/tmux-exec-helper.js.map +1 -1
- package/dist/tmux-manager.js +1 -1
- package/dist/tmux-read.js +1 -1
- package/dist/tmux-read.js.map +1 -1
- package/dist/topic-commands.d.ts +3 -0
- package/dist/topic-commands.js +29 -18
- package/dist/topic-commands.js.map +1 -1
- package/dist/transcript-monitor.js +5 -0
- package/dist/transcript-monitor.js.map +1 -1
- package/dist/transcript-sources.d.ts +2 -0
- package/dist/transcript-sources.js +4 -0
- package/dist/transcript-sources.js.map +1 -1
- package/dist/tunnel/cloudflared-install.js +3 -1
- package/dist/tunnel/cloudflared-install.js.map +1 -1
- package/dist/tunnel/cloudflared.d.ts +7 -16
- package/dist/tunnel/cloudflared.js +65 -13
- package/dist/tunnel/cloudflared.js.map +1 -1
- package/dist/tunnel/named-diagnostics.d.ts +13 -0
- package/dist/tunnel/named-diagnostics.js +52 -0
- package/dist/tunnel/named-diagnostics.js.map +1 -0
- package/dist/tunnel/types.d.ts +2 -1
- package/dist/tunnel/types.js.map +1 -1
- package/dist/types.d.ts +12 -0
- package/dist/ui/app-effects.js +10 -4
- package/dist/ui/app.html +2 -0
- package/dist/ui/chat-render.js +39 -0
- package/dist/ui/chat-store.js +8 -0
- package/dist/ui/chat-strings.js +5 -2
- package/dist/ui/chat-thread.js +15 -8
- package/dist/ui/effect-trial-offer.js +2 -31
- package/dist/ui/effects-waker.js +2 -70
- package/dist/ui/fleet-canvas.js +14 -6
- package/dist/ui/fleet-route-scene.js +86 -21
- package/dist/ui/fleet-task-card.js +5 -5
- package/dist/ui/fleet-task-common.js +41 -7
- package/dist/ui/fleet-task-work.js +107 -0
- package/dist/ui/fleet-tasks.js +46 -12
- package/dist/ui/fleet-traffic.js +57 -10
- package/dist/ui/icons/icon-192.png +0 -0
- package/dist/ui/icons/icon-512.png +0 -0
- package/dist/ui/image-lightbox.js +39 -1
- package/dist/ui/image-zoom.js +242 -0
- package/dist/ui/panel-chat.js +24 -13
- package/dist/ui/panel-details.js +2 -0
- package/dist/ui/panel-fleet.js +6 -2
- package/dist/ui/panel-needs.js +21 -6
- package/dist/ui/panel-settings.js +90 -15
- package/dist/ui/preview-panel.js +2 -1
- package/dist/ui/search-dialog.js +2 -1
- package/dist/ui/settings-appearance.js +159 -9
- package/dist/ui/settings-dialogs.js +33 -17
- package/dist/ui/settings-discord.js +6 -2
- package/dist/ui/settings-guests.js +2 -1
- package/dist/ui/settings-learn.js +1 -0
- package/dist/ui/settings-model.js +2 -11
- package/dist/ui/settings-mods.js +6 -3
- package/dist/ui/settings-strings.js +80 -0
- package/dist/ui/settings-token.js +3 -1
- package/dist/ui/settings-web-authority.js +6 -3
- package/dist/ui/settings-wizard.js +13 -7
- package/dist/ui/shared/app-i18n.js +2 -2
- package/dist/ui/shared/app-needs.js +2 -2
- package/dist/ui/shared/app-store.js +2 -2
- package/dist/ui/shared/app-stream.js +2 -1
- package/dist/ui/shared/app.css +125 -28
- package/dist/ui/shared/app.js +5 -1
- package/dist/ui/shared/effect-app-runtime.js +7 -5
- package/dist/ui/shared/effect-chat-runtime.js +2 -7
- package/dist/ui/shared/effect-cursor.js +3 -2
- package/dist/ui/shared/effect-display-metadata.js +39 -0
- package/dist/ui/shared/effect-registry.js +4 -2
- package/dist/ui/shared/effect-runtime-loader.js +3 -1
- package/dist/ui/shared/effect-stock-trust.js +1 -1
- package/dist/ui/shared/feature-flags.js +127 -0
- package/dist/ui/shared/identity-color.js +6 -3
- package/dist/ui/shared/instance-nav.js +3 -2
- package/dist/ui/shared/text-undo.js +210 -0
- package/dist/ui/shared/ui-dialog.js +4 -3
- package/dist/ui/shared/ui-icons.js +2 -0
- package/dist/ui/signin.html +2 -0
- package/dist/update-dispatch.js +1 -1
- package/dist/update-launch.d.ts +1 -1
- package/dist/update-launch.js +1 -2
- package/dist/update-launch.js.map +1 -1
- package/dist/usage/providers.js +1 -1
- package/dist/usage/providers.js.map +1 -1
- package/dist/view-api.js +1 -1
- package/dist/web-api.d.ts +12 -2
- package/dist/web-api.js +266 -18
- package/dist/web-api.js.map +1 -1
- package/dist/web-app-icon-worker.d.ts +1 -0
- package/dist/web-app-icon-worker.js +15 -0
- package/dist/web-app-icon-worker.js.map +1 -0
- package/dist/web-app-icon.d.ts +107 -0
- package/dist/web-app-icon.js +256 -0
- package/dist/web-app-icon.js.map +1 -0
- package/dist/web-appearance-tools.d.ts +1 -0
- package/dist/web-appearance-tools.js +7 -3
- package/dist/web-appearance-tools.js.map +1 -1
- package/dist/web-appearance.d.ts +4 -10
- package/dist/web-appearance.js +4 -3
- package/dist/web-appearance.js.map +1 -1
- package/dist/web-chat-history.d.ts +37 -0
- package/dist/web-chat-history.js +57 -2
- package/dist/web-chat-history.js.map +1 -1
- package/dist/web-experimental-http.d.ts +2 -0
- package/dist/web-experimental-http.js +12 -0
- package/dist/web-experimental-http.js.map +1 -0
- package/dist/web-experimental.d.ts +11 -0
- package/dist/web-experimental.js +49 -0
- package/dist/web-experimental.js.map +1 -0
- package/dist/web-guest-access.d.ts +1 -0
- package/dist/web-guest-access.js +11 -3
- package/dist/web-guest-access.js.map +1 -1
- package/dist/web-icons.d.ts +33 -1
- package/dist/web-icons.js +83 -11
- package/dist/web-icons.js.map +1 -1
- package/dist/web-mod-store.d.ts +2 -0
- package/dist/web-mod-store.js +10 -0
- package/dist/web-mod-store.js.map +1 -1
- package/dist/web-png.d.ts +29 -0
- package/dist/web-png.js +321 -0
- package/dist/web-png.js.map +1 -0
- package/dist/web-preview.d.ts +2 -0
- package/dist/web-preview.js +2 -0
- package/dist/web-preview.js.map +1 -1
- package/dist/web-reactions.d.ts +34 -0
- package/dist/web-reactions.js +47 -0
- package/dist/web-reactions.js.map +1 -0
- package/dist/web-settings-patch.d.ts +2 -1
- package/dist/web-settings-patch.js +5 -1
- package/dist/web-settings-patch.js.map +1 -1
- package/dist/web-settings-tools.d.ts +1 -0
- package/dist/web-settings-tools.js +14 -10
- package/dist/web-settings-tools.js.map +1 -1
- package/dist/web-terminal.js +1 -1
- package/dist/web-theme-store.d.ts +2 -2
- package/dist/web-theme-store.js +6 -3
- package/dist/web-theme-store.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* #2308 review: the app icon's conversion (decode, five resizes, PNG/ICO encoding) runs here, off the fleet's event
|
|
3
|
+
* loop — a 2048 px 16-bit source takes about a second. One source in (workerData), the made files or a reason out.
|
|
4
|
+
*/
|
|
5
|
+
import { parentPort, workerData } from "node:worker_threads";
|
|
6
|
+
import { appIconSet } from "./web-app-icon.js";
|
|
7
|
+
import { PngError } from "./web-png.js";
|
|
8
|
+
try {
|
|
9
|
+
const files = appIconSet(new Uint8Array(workerData.source));
|
|
10
|
+
parentPort.postMessage({ ok: true, files });
|
|
11
|
+
}
|
|
12
|
+
catch (err) {
|
|
13
|
+
parentPort.postMessage({ ok: false, detail: err instanceof PngError ? err.message : "the image could not be read" });
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=web-app-icon-worker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"web-app-icon-worker.js","sourceRoot":"","sources":["../src/web-app-icon-worker.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAExC,IAAI,CAAC;IACH,MAAM,KAAK,GAAG,UAAU,CAAC,IAAI,UAAU,CAAE,UAAsC,CAAC,MAAM,CAAC,CAAC,CAAC;IACzF,UAAW,CAAC,WAAW,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;AAC/C,CAAC;AAAC,OAAO,GAAG,EAAE,CAAC;IACb,UAAW,CAAC,WAAW,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,YAAY,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,6BAA6B,EAAE,CAAC,CAAC;AACxH,CAAC"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/** What an upload may weigh (the route stops reading past it). */
|
|
2
|
+
export declare const APP_ICON_MAX_BYTES: number;
|
|
3
|
+
/** The source's side: at least the manifest's largest icon, at most what decodes in a few MB of memory. */
|
|
4
|
+
export declare const APP_ICON_MIN_SIDE = 512;
|
|
5
|
+
export declare const APP_ICON_MAX_SIDE = 2048;
|
|
6
|
+
/** The files made from the source, by the name each is served as. */
|
|
7
|
+
export declare const APP_ICON_FILES: readonly ["apple-touch-icon.png", "favicon.ico", "icon-192.png", "icon-512.png"];
|
|
8
|
+
export type AppIconFile = (typeof APP_ICON_FILES)[number];
|
|
9
|
+
export interface AppIconState {
|
|
10
|
+
version: string;
|
|
11
|
+
updatedAt: string;
|
|
12
|
+
by: string;
|
|
13
|
+
}
|
|
14
|
+
export type AppIconResult = {
|
|
15
|
+
ok: true;
|
|
16
|
+
state: AppIconState;
|
|
17
|
+
} | {
|
|
18
|
+
ok: false;
|
|
19
|
+
status: 400 | 409 | 413 | 415 | 500 | 503;
|
|
20
|
+
error: string;
|
|
21
|
+
detail?: string;
|
|
22
|
+
};
|
|
23
|
+
/** A source checked and made into its files (prepare), not yet in force (commit). */
|
|
24
|
+
export interface AppIconPrepared {
|
|
25
|
+
version: string;
|
|
26
|
+
source: Uint8Array;
|
|
27
|
+
files: Record<AppIconFile, Buffer>;
|
|
28
|
+
epoch: number;
|
|
29
|
+
}
|
|
30
|
+
export type AppIconPrepareResult = {
|
|
31
|
+
ok: true;
|
|
32
|
+
prepared: AppIconPrepared;
|
|
33
|
+
} | Extract<AppIconResult, {
|
|
34
|
+
ok: false;
|
|
35
|
+
}>;
|
|
36
|
+
/** The conversion's bounds off the event loop: its time, and its worker's heap. */
|
|
37
|
+
export declare const APP_ICON_CONVERT_MS = 30000;
|
|
38
|
+
/** Make the files from a source somewhere: a worker thread in the fleet (the default), in-process where a test says so. */
|
|
39
|
+
export type AppIconConvert = (bytes: Uint8Array) => Promise<{
|
|
40
|
+
ok: true;
|
|
41
|
+
files: Record<AppIconFile, Buffer>;
|
|
42
|
+
} | {
|
|
43
|
+
ok: false;
|
|
44
|
+
detail: string;
|
|
45
|
+
}>;
|
|
46
|
+
/** What the conversion needs of a worker thread (a test gives one that ends when it says). */
|
|
47
|
+
export interface IconWorker {
|
|
48
|
+
on(event: "message" | "error" | "exit", listener: (...args: any[]) => void): unknown;
|
|
49
|
+
terminate(): Promise<number>;
|
|
50
|
+
}
|
|
51
|
+
/** The fleet's worker: its own heap; TypeScript sources through tsx, the built .js otherwise. */
|
|
52
|
+
export declare function spawnIconWorker(source: ArrayBuffer): IconWorker;
|
|
53
|
+
/**
|
|
54
|
+
* The conversion in a one-off worker thread: its own heap, a deadline (terminated past it), never the fleet's loop.
|
|
55
|
+
* It settles only once the worker has exited (#2319 review): a timed-out or finished conversion whose thread is still
|
|
56
|
+
* winding down keeps its claim, so the store never runs two threads at once.
|
|
57
|
+
*/
|
|
58
|
+
export declare function convertWithWorker(spawn?: (source: ArrayBuffer) => IconWorker, deadlineMs?: number): AppIconConvert;
|
|
59
|
+
export declare const convertInWorker: AppIconConvert;
|
|
60
|
+
/** The conversion on this thread (tests, tools): the same code, without the worker. */
|
|
61
|
+
export declare const convertInProcess: AppIconConvert;
|
|
62
|
+
/** The sizes made from one decoded source. */
|
|
63
|
+
export declare function appIconSet(bytes: Uint8Array): Record<AppIconFile, Buffer>;
|
|
64
|
+
export declare class AppIconStore {
|
|
65
|
+
private readonly dataDir;
|
|
66
|
+
private readonly now;
|
|
67
|
+
private readonly convert;
|
|
68
|
+
private cached;
|
|
69
|
+
/** One conversion at a time: a second upload meanwhile is told to wait (409). */
|
|
70
|
+
private converting;
|
|
71
|
+
private closed;
|
|
72
|
+
/** Moved by every reset: an icon prepared before it is no longer the person's latest wish, and is not used. */
|
|
73
|
+
private epoch;
|
|
74
|
+
constructor(dataDir: string, now?: () => Date, convert?: AppIconConvert);
|
|
75
|
+
/** The fleet is stopping: nothing more is converted or switched to. */
|
|
76
|
+
close(): void;
|
|
77
|
+
get isClosed(): boolean;
|
|
78
|
+
private get root();
|
|
79
|
+
private get pointer();
|
|
80
|
+
/** The custom icon in force, or null for the bundled one. Read again only when the pointer file changed. */
|
|
81
|
+
current(): AppIconState | null;
|
|
82
|
+
/** A made file of the icon in force (or of `version`), or null. */
|
|
83
|
+
file(name: AppIconFile, version?: string): Buffer | null;
|
|
84
|
+
/**
|
|
85
|
+
* Check a source (its size and magic here; decoding and the sizes in the conversion, off the event loop) and make its
|
|
86
|
+
* files. Nothing on disk changes: commit() switches to them, after its caller checked again who asks.
|
|
87
|
+
*/
|
|
88
|
+
prepare(bytes: Uint8Array): Promise<AppIconPrepareResult>;
|
|
89
|
+
/** Switch to a prepared icon: its files under its version, then the pointer (last, atomically), then old versions go. */
|
|
90
|
+
commit(prepared: AppIconPrepared, by: string): AppIconResult;
|
|
91
|
+
/** prepare() then commit(), for a caller with nothing to check in between. */
|
|
92
|
+
set(bytes: Uint8Array, by: string): Promise<AppIconResult>;
|
|
93
|
+
/**
|
|
94
|
+
* Back to the bundled icon: the pointer removed (none there is already the default), then the files. A pointer that
|
|
95
|
+
* cannot be removed is a failure — nothing is pruned, so the icon in force keeps its files (#2308 review).
|
|
96
|
+
*/
|
|
97
|
+
reset(): {
|
|
98
|
+
ok: true;
|
|
99
|
+
} | {
|
|
100
|
+
ok: false;
|
|
101
|
+
status: 500;
|
|
102
|
+
error: string;
|
|
103
|
+
detail?: string;
|
|
104
|
+
};
|
|
105
|
+
/** Remove every version folder but `keep`. */
|
|
106
|
+
private prune;
|
|
107
|
+
}
|
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* #2308: the person's own app icon. One square PNG (the admin's page crops and draws whatever they chose into one) is
|
|
3
|
+
* checked and decoded here (web-png.ts), and made into the sizes a browser and a home screen ask for: the touch icon
|
|
4
|
+
* (180, on white — iOS shows transparency as black), the favicon (an ICO of 32 and 48) and the manifest's 192 and 512.
|
|
5
|
+
*
|
|
6
|
+
* Under the state dir: `web-app-icon/<version>/…`, the version being the source's sha256 (16 hex), and
|
|
7
|
+
* `web-app-icon/current.json` naming the version in force — written last, atomically, so a reader sees the old set or
|
|
8
|
+
* the new one, never half of one. Older version folders are removed once the pointer has moved.
|
|
9
|
+
*/
|
|
10
|
+
import { createHash } from "node:crypto";
|
|
11
|
+
import { Worker } from "node:worker_threads";
|
|
12
|
+
import { mkdirSync, readFileSync, readdirSync, renameSync, rmSync, statSync, unlinkSync, writeFileSync } from "node:fs";
|
|
13
|
+
import { join } from "node:path";
|
|
14
|
+
import { decodePng, encodeIco, encodePng, flatten, isPng, PngError, resize } from "./web-png.js";
|
|
15
|
+
/** What an upload may weigh (the route stops reading past it). */
|
|
16
|
+
export const APP_ICON_MAX_BYTES = 5 * 1024 * 1024;
|
|
17
|
+
/** The source's side: at least the manifest's largest icon, at most what decodes in a few MB of memory. */
|
|
18
|
+
export const APP_ICON_MIN_SIDE = 512;
|
|
19
|
+
export const APP_ICON_MAX_SIDE = 2048;
|
|
20
|
+
/** The files made from the source, by the name each is served as. */
|
|
21
|
+
export const APP_ICON_FILES = ["apple-touch-icon.png", "favicon.ico", "icon-192.png", "icon-512.png"];
|
|
22
|
+
/** The conversion's bounds off the event loop: its time, and its worker's heap. */
|
|
23
|
+
export const APP_ICON_CONVERT_MS = 30_000;
|
|
24
|
+
const CONVERT_HEAP_MB = 256;
|
|
25
|
+
/** The fleet's worker: its own heap; TypeScript sources through tsx, the built .js otherwise. */
|
|
26
|
+
export function spawnIconWorker(source) {
|
|
27
|
+
return import.meta.url.endsWith(".ts")
|
|
28
|
+
? new Worker(`const { workerData } = require("node:worker_threads"); import("tsx/esm/api").then(({ tsImport }) => tsImport(workerData.entry, workerData.entry));`, { eval: true, execArgv: [], resourceLimits: { maxOldGenerationSizeMb: CONVERT_HEAP_MB }, workerData: { entry: new URL("./web-app-icon-worker.ts", import.meta.url).href, source } })
|
|
29
|
+
: new Worker(new URL("./web-app-icon-worker.js", import.meta.url), { execArgv: [], resourceLimits: { maxOldGenerationSizeMb: CONVERT_HEAP_MB }, workerData: { source }, transferList: [source] });
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* The conversion in a one-off worker thread: its own heap, a deadline (terminated past it), never the fleet's loop.
|
|
33
|
+
* It settles only once the worker has exited (#2319 review): a timed-out or finished conversion whose thread is still
|
|
34
|
+
* winding down keeps its claim, so the store never runs two threads at once.
|
|
35
|
+
*/
|
|
36
|
+
export function convertWithWorker(spawn = spawnIconWorker, deadlineMs = APP_ICON_CONVERT_MS) {
|
|
37
|
+
return (bytes) => new Promise((resolve) => {
|
|
38
|
+
const worker = spawn(new Uint8Array(bytes).buffer);
|
|
39
|
+
let result = null;
|
|
40
|
+
let exited = false;
|
|
41
|
+
const settle = () => { if (result && exited)
|
|
42
|
+
resolve(result); };
|
|
43
|
+
const finish = (r) => {
|
|
44
|
+
if (result)
|
|
45
|
+
return;
|
|
46
|
+
result = r;
|
|
47
|
+
clearTimeout(timer);
|
|
48
|
+
if (!exited)
|
|
49
|
+
void worker.terminate().catch(() => { });
|
|
50
|
+
settle();
|
|
51
|
+
};
|
|
52
|
+
const timer = setTimeout(() => finish({ ok: false, detail: "it took too long to read" }), deadlineMs);
|
|
53
|
+
worker.on("message", (m) => {
|
|
54
|
+
if (!m || !m.ok || !m.files) {
|
|
55
|
+
finish({ ok: false, detail: (m && m.detail) || "the image could not be read" });
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
const files = {};
|
|
59
|
+
for (const name of APP_ICON_FILES) {
|
|
60
|
+
const f = m.files[name];
|
|
61
|
+
if (!f) {
|
|
62
|
+
finish({ ok: false, detail: "the image could not be read" });
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
files[name] = Buffer.from(f.buffer, f.byteOffset, f.byteLength);
|
|
66
|
+
}
|
|
67
|
+
finish({ ok: true, files });
|
|
68
|
+
});
|
|
69
|
+
worker.on("error", () => finish({ ok: false, detail: "the image could not be read" }));
|
|
70
|
+
worker.on("exit", () => { exited = true; finish({ ok: false, detail: "the image could not be read" }); settle(); });
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
export const convertInWorker = convertWithWorker();
|
|
74
|
+
/** The conversion on this thread (tests, tools): the same code, without the worker. */
|
|
75
|
+
export const convertInProcess = async (bytes) => {
|
|
76
|
+
try {
|
|
77
|
+
return { ok: true, files: appIconSet(bytes) };
|
|
78
|
+
}
|
|
79
|
+
catch (err) {
|
|
80
|
+
return { ok: false, detail: err instanceof PngError ? err.message : "the image could not be read" };
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
function writeBytesAtomic(path, bytes) {
|
|
84
|
+
const tmp = `${path}.${process.pid}.${Date.now()}.tmp`;
|
|
85
|
+
try {
|
|
86
|
+
writeFileSync(tmp, bytes, { mode: 0o600 });
|
|
87
|
+
renameSync(tmp, path);
|
|
88
|
+
}
|
|
89
|
+
catch (err) {
|
|
90
|
+
try {
|
|
91
|
+
unlinkSync(tmp);
|
|
92
|
+
}
|
|
93
|
+
catch { /* none */ }
|
|
94
|
+
throw err;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
/** The sizes made from one decoded source. */
|
|
98
|
+
export function appIconSet(bytes) {
|
|
99
|
+
const src = decodePng(bytes, { maxSide: APP_ICON_MAX_SIDE });
|
|
100
|
+
if (src.width !== src.height)
|
|
101
|
+
throw new PngError(`not square (${src.width}×${src.height})`);
|
|
102
|
+
if (src.width < APP_ICON_MIN_SIDE)
|
|
103
|
+
throw new PngError(`smaller than ${APP_ICON_MIN_SIDE}×${APP_ICON_MIN_SIDE}`);
|
|
104
|
+
const at = (n) => resize(src, n, n);
|
|
105
|
+
return {
|
|
106
|
+
"apple-touch-icon.png": encodePng(flatten(at(180), [255, 255, 255])),
|
|
107
|
+
"favicon.ico": encodeIco([{ size: 32, png: encodePng(at(32)) }, { size: 48, png: encodePng(at(48)) }]),
|
|
108
|
+
"icon-192.png": encodePng(at(192)),
|
|
109
|
+
"icon-512.png": encodePng(at(512)),
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
export class AppIconStore {
|
|
113
|
+
dataDir;
|
|
114
|
+
now;
|
|
115
|
+
convert;
|
|
116
|
+
cached = null;
|
|
117
|
+
/** One conversion at a time: a second upload meanwhile is told to wait (409). */
|
|
118
|
+
converting = false;
|
|
119
|
+
closed = false;
|
|
120
|
+
/** Moved by every reset: an icon prepared before it is no longer the person's latest wish, and is not used. */
|
|
121
|
+
epoch = 0;
|
|
122
|
+
constructor(dataDir, now = () => new Date(), convert = convertInWorker) {
|
|
123
|
+
this.dataDir = dataDir;
|
|
124
|
+
this.now = now;
|
|
125
|
+
this.convert = convert;
|
|
126
|
+
}
|
|
127
|
+
/** The fleet is stopping: nothing more is converted or switched to. */
|
|
128
|
+
close() { this.closed = true; }
|
|
129
|
+
get isClosed() { return this.closed; }
|
|
130
|
+
get root() { return join(this.dataDir, "web-app-icon"); }
|
|
131
|
+
get pointer() { return join(this.root, "current.json"); }
|
|
132
|
+
/** The custom icon in force, or null for the bundled one. Read again only when the pointer file changed. */
|
|
133
|
+
current() {
|
|
134
|
+
let mtimeMs;
|
|
135
|
+
try {
|
|
136
|
+
mtimeMs = statSync(this.pointer).mtimeMs;
|
|
137
|
+
}
|
|
138
|
+
catch {
|
|
139
|
+
this.cached = { mtimeMs: -1, state: null };
|
|
140
|
+
return null;
|
|
141
|
+
}
|
|
142
|
+
if (this.cached && this.cached.mtimeMs === mtimeMs)
|
|
143
|
+
return this.cached.state;
|
|
144
|
+
let state = null;
|
|
145
|
+
try {
|
|
146
|
+
const v = JSON.parse(readFileSync(this.pointer, "utf8"));
|
|
147
|
+
if (typeof v.version === "string" && /^[0-9a-f]{16}$/.test(v.version) && typeof v.updatedAt === "string" && typeof v.by === "string") {
|
|
148
|
+
state = { version: v.version, updatedAt: v.updatedAt, by: v.by };
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
catch { /* unreadable: the bundled icon */ }
|
|
152
|
+
this.cached = { mtimeMs, state };
|
|
153
|
+
return state;
|
|
154
|
+
}
|
|
155
|
+
/** A made file of the icon in force (or of `version`), or null. */
|
|
156
|
+
file(name, version) {
|
|
157
|
+
const v = version ?? this.current()?.version;
|
|
158
|
+
if (!v || !/^[0-9a-f]{16}$/.test(v))
|
|
159
|
+
return null;
|
|
160
|
+
try {
|
|
161
|
+
return readFileSync(join(this.root, v, name));
|
|
162
|
+
}
|
|
163
|
+
catch {
|
|
164
|
+
return null;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Check a source (its size and magic here; decoding and the sizes in the conversion, off the event loop) and make its
|
|
169
|
+
* files. Nothing on disk changes: commit() switches to them, after its caller checked again who asks.
|
|
170
|
+
*/
|
|
171
|
+
async prepare(bytes) {
|
|
172
|
+
if (this.closed)
|
|
173
|
+
return { ok: false, status: 503, error: "app_icon_unavailable" };
|
|
174
|
+
if (bytes.length > APP_ICON_MAX_BYTES)
|
|
175
|
+
return { ok: false, status: 413, error: "app_icon_too_large", detail: "at most 5 MiB" };
|
|
176
|
+
if (!isPng(bytes))
|
|
177
|
+
return { ok: false, status: 415, error: "app_icon_not_png", detail: "a PNG image (the page converts JPG and WebP)" };
|
|
178
|
+
if (this.converting)
|
|
179
|
+
return { ok: false, status: 409, error: "app_icon_busy", detail: "another icon is being made" };
|
|
180
|
+
this.converting = true;
|
|
181
|
+
const epoch = this.epoch;
|
|
182
|
+
try {
|
|
183
|
+
const made = await this.convert(bytes);
|
|
184
|
+
if (!made.ok)
|
|
185
|
+
return { ok: false, status: 400, error: "app_icon_unreadable", detail: made.detail };
|
|
186
|
+
return { ok: true, prepared: { version: createHash("sha256").update(bytes).digest("hex").slice(0, 16), source: bytes, files: made.files, epoch } };
|
|
187
|
+
}
|
|
188
|
+
finally {
|
|
189
|
+
this.converting = false;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
/** Switch to a prepared icon: its files under its version, then the pointer (last, atomically), then old versions go. */
|
|
193
|
+
commit(prepared, by) {
|
|
194
|
+
if (this.closed)
|
|
195
|
+
return { ok: false, status: 503, error: "app_icon_unavailable" };
|
|
196
|
+
// #2319 review: restored to the default while this one was being made — the later wish wins.
|
|
197
|
+
if (prepared.epoch !== this.epoch)
|
|
198
|
+
return { ok: false, status: 409, error: "app_icon_superseded", detail: "the icon was reset meanwhile" };
|
|
199
|
+
const { version } = prepared;
|
|
200
|
+
const state = { version, updatedAt: this.now().toISOString(), by };
|
|
201
|
+
try {
|
|
202
|
+
const dir = join(this.root, version);
|
|
203
|
+
mkdirSync(dir, { recursive: true, mode: 0o700 });
|
|
204
|
+
writeBytesAtomic(join(dir, "source.png"), prepared.source);
|
|
205
|
+
for (const name of APP_ICON_FILES)
|
|
206
|
+
writeBytesAtomic(join(dir, name), prepared.files[name]);
|
|
207
|
+
writeBytesAtomic(this.pointer, Buffer.from(JSON.stringify(state)));
|
|
208
|
+
}
|
|
209
|
+
catch {
|
|
210
|
+
return { ok: false, status: 500, error: "app_icon_not_saved" };
|
|
211
|
+
}
|
|
212
|
+
this.cached = null;
|
|
213
|
+
this.prune(version);
|
|
214
|
+
return { ok: true, state };
|
|
215
|
+
}
|
|
216
|
+
/** prepare() then commit(), for a caller with nothing to check in between. */
|
|
217
|
+
async set(bytes, by) {
|
|
218
|
+
const p = await this.prepare(bytes);
|
|
219
|
+
return p.ok ? this.commit(p.prepared, by) : p;
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Back to the bundled icon: the pointer removed (none there is already the default), then the files. A pointer that
|
|
223
|
+
* cannot be removed is a failure — nothing is pruned, so the icon in force keeps its files (#2308 review).
|
|
224
|
+
*/
|
|
225
|
+
reset() {
|
|
226
|
+
this.epoch++;
|
|
227
|
+
try {
|
|
228
|
+
unlinkSync(this.pointer);
|
|
229
|
+
}
|
|
230
|
+
catch (err) {
|
|
231
|
+
if (err.code !== "ENOENT")
|
|
232
|
+
return { ok: false, status: 500, error: "app_icon_not_reset", detail: err.code ?? "error" };
|
|
233
|
+
}
|
|
234
|
+
this.cached = null;
|
|
235
|
+
this.prune(null);
|
|
236
|
+
return { ok: true };
|
|
237
|
+
}
|
|
238
|
+
/** Remove every version folder but `keep`. */
|
|
239
|
+
prune(keep) {
|
|
240
|
+
let names;
|
|
241
|
+
try {
|
|
242
|
+
names = readdirSync(this.root);
|
|
243
|
+
}
|
|
244
|
+
catch {
|
|
245
|
+
return;
|
|
246
|
+
}
|
|
247
|
+
for (const n of names)
|
|
248
|
+
if (/^[0-9a-f]{16}$/.test(n) && n !== keep) {
|
|
249
|
+
try {
|
|
250
|
+
rmSync(join(this.root, n), { recursive: true, force: true });
|
|
251
|
+
}
|
|
252
|
+
catch { /* next time */ }
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
//# sourceMappingURL=web-app-icon.js.map
|
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,CAAC;CACF"}
|
|
@@ -26,7 +26,7 @@ export class AppearanceTools {
|
|
|
26
26
|
const t = this.deps.theme(name);
|
|
27
27
|
const answer = this.deps.themeAnswer(name);
|
|
28
28
|
return { entry, theme: t.theme, card: this.deps.card(name), locked: t.locked, agentEdit: answer.agent_edit !== false, limits: (answer.limits ?? {}), widgets: t.widgets, ambient: t.ambient,
|
|
29
|
-
effects: this.deps.effects?.(name) ?? [], colorPrefs: this.deps.colorPrefs?.() ?? {} };
|
|
29
|
+
effects: this.deps.canvasWorkerEnabled?.() === true ? this.deps.effects?.(name) ?? [] : [], colorPrefs: this.deps.colorPrefs?.() ?? {} };
|
|
30
30
|
}
|
|
31
31
|
/** The face drawn, as bytes of this instance's: the theme's picture, the person's upload, or its own bot's. */
|
|
32
32
|
avatar(name, input) {
|
|
@@ -52,8 +52,12 @@ export class AppearanceTools {
|
|
|
52
52
|
for (const [k, b] of this.previews)
|
|
53
53
|
if (now - b.last > PREVIEW_IDLE_MS)
|
|
54
54
|
this.previews.delete(k); // nothing stale stays
|
|
55
|
-
if (tool === "get_web_appearance")
|
|
56
|
-
|
|
55
|
+
if (tool === "get_web_appearance") {
|
|
56
|
+
const view = appearanceView(this.input(name));
|
|
57
|
+
if (this.deps.canvasWorkerEnabled?.() !== true)
|
|
58
|
+
delete view.effects;
|
|
59
|
+
return view;
|
|
60
|
+
}
|
|
57
61
|
if (tool !== "preview_web_appearance")
|
|
58
62
|
return { error: "unknown_tool" };
|
|
59
63
|
if (args.part !== undefined)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web-appearance-tools.js","sourceRoot":"","sources":["../src/web-appearance-tools.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EAAE,cAAc,EAAyC,aAAa,EAAE,eAAe,EAAE,UAAU,EAA0C,MAAM,0BAA0B,CAAC;AACrL,OAAO,EAAE,gBAA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,CAAC,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC,KAAK,CAAC,IAAK,CAAC,CAAC,KAAgB,GAAG,CAAC,IAAK,CAAC,CAAC,KAAgB,IAAI,KAAK;YAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe,EAAE,CAAC;QACxJ,CAAC,CAAC,IAAI,GAAG,GAAG,CAAC,CAAsD,4CAA4C;QAC/G,MAAM,CAAC,GAAG,CAAC,CAAC,KAAe,CAAC;QAC5B,OAAO,EAAE,QAAQ,EAAE,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,GAAG,gBAAgB,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,gBAAgB,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;IAC5G,CAAC;IACD,+BAA+B;IAC/B,MAAM,CAAC,IAAY,IAAU,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;CAC3D"}
|
package/dist/web-appearance.d.ts
CHANGED
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* #1629 (first design §4, §6; r2 (a)–(c); r4-4): the agent's own theme tools — get_web_theme, set_web_theme,
|
|
3
|
-
* set_web_theme_asset, reset_web_theme, set_web_widget, remove_web_widget, set_web_ambient, clear_web_ambient (#2117) — and a person's reset, lock, widget removal and ambient. None takes a target: the caller is the
|
|
4
|
-
* instance its IPC connection or agent token belongs to, and only that instance's record is ever read or written.
|
|
5
|
-
*
|
|
6
|
-
* Every agent write: the fleet-wide switch (web.themes.agent_edit), then the person's lock, then the shared limiter's
|
|
7
|
-
* check, then validation and the write, then — only once it is on disk — the limiter's record. A refused, invalid or
|
|
8
|
-
* failed call costs nothing. A person's reset and lock are never limited.
|
|
9
|
-
*/
|
|
10
1
|
import { type AppearanceBucket, AppearanceLimiter } from "./web-appearance-policy.js";
|
|
11
2
|
import { type ThemeStore } from "./web-theme-store.js";
|
|
12
3
|
/** An upload in parts with no new part for this long is dropped (monotonic clock). */
|
|
@@ -16,6 +7,9 @@ type WebConfigView = {
|
|
|
16
7
|
themes?: {
|
|
17
8
|
agent_edit?: boolean;
|
|
18
9
|
};
|
|
10
|
+
experimental?: {
|
|
11
|
+
canvas_worker?: boolean;
|
|
12
|
+
};
|
|
19
13
|
} | undefined | null;
|
|
20
14
|
export declare class WebAppearance {
|
|
21
15
|
private readonly store;
|
|
@@ -50,7 +44,7 @@ export declare class WebAppearance {
|
|
|
50
44
|
private setAssetPart;
|
|
51
45
|
/** reset_web_theme: the agent can always undo itself (a change for the limit). */
|
|
52
46
|
resetTheme(instance: string): ToolAnswer;
|
|
53
|
-
/** A person's reset
|
|
47
|
+
/** A person's reset: theme, widgets, ambient and pictures go; while CW is disabled its selections stay. The lock stays. */
|
|
54
48
|
humanReset(instance: string): ToolAnswer;
|
|
55
49
|
/** A person's lock (r2 (a)). Not limited. */
|
|
56
50
|
humanLock(instance: string, locked: boolean): ToolAnswer;
|
package/dist/web-appearance.js
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
* check, then validation and the write, then — only once it is on disk — the limiter's record. A refused, invalid or
|
|
8
8
|
* failed call costs nothing. A person's reset and lock are never limited.
|
|
9
9
|
*/
|
|
10
|
+
import { canvasWorkerEnabled } from "./web-experimental.js";
|
|
10
11
|
import { AppearanceLimiter, agentAppearanceEditAllowed } from "./web-appearance-policy.js";
|
|
11
12
|
import { applyThemePatch, STATUS_COLORS, THEME_DEFAULTS } from "./web-theme.js";
|
|
12
13
|
import { createHash, randomBytes } from "node:crypto";
|
|
@@ -48,7 +49,7 @@ export class WebAppearance {
|
|
|
48
49
|
getTheme(instance) {
|
|
49
50
|
const r = this.store.get(instance);
|
|
50
51
|
return {
|
|
51
|
-
effects: r.placements.effects,
|
|
52
|
+
...(canvasWorkerEnabled(this.webConfig()) ? { effects: r.placements.effects } : {}),
|
|
52
53
|
theme: r.theme, by: r.by, locked: r.locked, agent_edit: agentAppearanceEditAllowed(this.webConfig()),
|
|
53
54
|
defaults: THEME_DEFAULTS,
|
|
54
55
|
// #2196: never themed; a page theme (page.on) must leave each readable (3:1) on its sidebar and background.
|
|
@@ -176,10 +177,10 @@ export class WebAppearance {
|
|
|
176
177
|
this.changed();
|
|
177
178
|
return { theme: { v: 1 } };
|
|
178
179
|
}
|
|
179
|
-
/** A person's reset
|
|
180
|
+
/** A person's reset: theme, widgets, ambient and pictures go; while CW is disabled its selections stay. The lock stays. */
|
|
180
181
|
humanReset(instance) {
|
|
181
182
|
this.uploads.delete(instance);
|
|
182
|
-
const w = this.store.reset(instance, "human");
|
|
183
|
+
const w = this.store.reset(instance, "human", !canvasWorkerEnabled(this.webConfig()));
|
|
183
184
|
if (!w.ok)
|
|
184
185
|
return { error: w.error, status: w.status };
|
|
185
186
|
this.changed();
|