@songsid/agend 2.2.0 → 2.3.0-beta.2
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.js +248 -2
- package/dist/agent-cli.js.map +1 -1
- package/dist/agent-endpoint.d.ts +2 -0
- package/dist/agent-endpoint.js +25 -0
- package/dist/agent-endpoint.js.map +1 -1
- package/dist/agent-file-read.d.ts +35 -0
- package/dist/agent-file-read.js +144 -0
- package/dist/agent-file-read.js.map +1 -0
- package/dist/agent-whats-new.js +8 -0
- package/dist/agent-whats-new.js.map +1 -1
- package/dist/atomic-write.js +9 -1
- package/dist/atomic-write.js.map +1 -1
- package/dist/auth-api.js +17 -0
- package/dist/auth-api.js.map +1 -1
- package/dist/backend/antigravity.js +3 -3
- package/dist/backend/antigravity.js.map +1 -1
- package/dist/backend/claude-code.js +5 -1
- package/dist/backend/claude-code.js.map +1 -1
- package/dist/backend/launch-effort.js +1 -1
- package/dist/backend/launch-effort.js.map +1 -1
- package/dist/backend/muse.js +10 -2
- package/dist/backend/muse.js.map +1 -1
- package/dist/backend/types.d.ts +8 -0
- package/dist/backend/types.js +10 -0
- package/dist/backend/types.js.map +1 -1
- package/dist/cache-analysis.d.ts +47 -1
- package/dist/cache-analysis.js +68 -8
- package/dist/cache-analysis.js.map +1 -1
- package/dist/cache-report-tool.d.ts +17 -0
- package/dist/cache-report-tool.js +40 -0
- package/dist/cache-report-tool.js.map +1 -0
- package/dist/cache-service.d.ts +15 -0
- package/dist/cache-service.js +26 -1
- package/dist/cache-service.js.map +1 -1
- package/dist/channel/adapters/discord.d.ts +2 -0
- package/dist/channel/adapters/discord.js +17 -2
- package/dist/channel/adapters/discord.js.map +1 -1
- package/dist/channel/adapters/telegram.d.ts +8 -1
- package/dist/channel/adapters/telegram.js +74 -4
- package/dist/channel/adapters/telegram.js.map +1 -1
- package/dist/channel/mcp-tools.js +36 -0
- package/dist/channel/mcp-tools.js.map +1 -1
- package/dist/channel/types.d.ts +15 -0
- package/dist/cli.js +7 -3
- package/dist/cli.js.map +1 -1
- package/dist/config-validator.js +22 -2
- package/dist/config-validator.js.map +1 -1
- package/dist/daemon.js +244 -20
- package/dist/daemon.js.map +1 -1
- package/dist/fleet-context.d.ts +5 -0
- package/dist/fleet-manager.d.ts +92 -0
- package/dist/fleet-manager.js +410 -29
- package/dist/fleet-manager.js.map +1 -1
- package/dist/general-knowledge/skills/credential-profiles/SKILL.md +7 -0
- package/dist/general-knowledge/skills/web-appearance/SKILL.md +367 -0
- package/dist/instance-avatar.js +3 -0
- package/dist/instance-avatar.js.map +1 -1
- package/dist/instance-config-impact.js +3 -0
- package/dist/instance-config-impact.js.map +1 -1
- package/dist/instance-lifecycle.js +9 -4
- package/dist/instance-lifecycle.js.map +1 -1
- package/dist/needs-you-hub.d.ts +4 -0
- package/dist/needs-you-hub.js +31 -6
- package/dist/needs-you-hub.js.map +1 -1
- package/dist/needs-you.d.ts +1 -13
- package/dist/needs-you.js +3 -37
- package/dist/needs-you.js.map +1 -1
- package/dist/outbound-handlers.d.ts +7 -0
- package/dist/outbound-handlers.js +65 -10
- package/dist/outbound-handlers.js.map +1 -1
- package/dist/outbound-schemas.d.ts +74 -0
- package/dist/outbound-schemas.js +56 -0
- package/dist/outbound-schemas.js.map +1 -1
- package/dist/public-web-gateway.js +14 -0
- package/dist/public-web-gateway.js.map +1 -1
- package/dist/repo-worktree-guard.d.ts +36 -0
- package/dist/repo-worktree-guard.js +143 -0
- package/dist/repo-worktree-guard.js.map +1 -0
- package/dist/scheduler/scheduler.d.ts +70 -1
- package/dist/scheduler/scheduler.js +256 -17
- package/dist/scheduler/scheduler.js.map +1 -1
- package/dist/service-installer.d.ts +2 -1
- package/dist/service-installer.js +18 -3
- package/dist/service-installer.js.map +1 -1
- package/dist/settings-api.js +74 -1
- package/dist/settings-api.js.map +1 -1
- package/dist/settings-change.js +8 -0
- package/dist/settings-change.js.map +1 -1
- package/dist/settings-effect.js +16 -2
- package/dist/settings-effect.js.map +1 -1
- package/dist/settings-http-confirmation.js +5 -0
- package/dist/settings-http-confirmation.js.map +1 -1
- package/dist/tool-permissions.d.ts +5 -0
- package/dist/tool-permissions.js +61 -2
- package/dist/tool-permissions.js.map +1 -1
- package/dist/topic-commands.d.ts +10 -6
- package/dist/topic-commands.js +21 -17
- package/dist/topic-commands.js.map +1 -1
- package/dist/topic-link.d.ts +128 -0
- package/dist/topic-link.js +269 -0
- package/dist/topic-link.js.map +1 -0
- package/dist/types.d.ts +13 -0
- package/dist/ui/app-effects.js +187 -0
- package/dist/ui/chat-effect-posters.js +42 -0
- package/dist/ui/chat-effects.js +72 -0
- package/dist/ui/chat-live-replies.js +58 -0
- package/dist/ui/chat-render.js +4 -4
- package/dist/ui/chat-store.js +9 -3
- package/dist/ui/chat-strings.js +15 -0
- package/dist/ui/chat-thread.js +47 -21
- package/dist/ui/chat-tour.js +1 -1
- package/dist/ui/effect-trial-controller.js +119 -0
- package/dist/ui/effect-trial-offer.js +31 -0
- package/dist/ui/effect-trial-panel.js +37 -0
- package/dist/ui/fleet-cache.js +23 -1
- package/dist/ui/image-lightbox.js +1 -1
- package/dist/ui/panel-chat.js +85 -17
- package/dist/ui/panel-details.js +18 -5
- package/dist/ui/panel-fleet.js +3 -3
- package/dist/ui/panel-log.js +6 -6
- package/dist/ui/panel-needs.js +3 -3
- package/dist/ui/panel-settings.js +8 -5
- package/dist/ui/preview-panel.js +25 -9
- package/dist/ui/settings-appearance.js +325 -0
- package/dist/ui/settings-effects.js +201 -0
- package/dist/ui/settings-mods.js +257 -0
- package/dist/ui/settings-owner-effects.js +80 -0
- package/dist/ui/settings-strings.js +245 -0
- package/dist/ui/shared/agend-auth.js +27 -3
- package/dist/ui/shared/agent-widget.js +248 -0
- package/dist/ui/shared/app-i18n.js +2 -0
- package/dist/ui/shared/app-prefs.js +30 -10
- package/dist/ui/shared/app-route.js +23 -1
- package/dist/ui/shared/app-session.js +1 -1
- package/dist/ui/shared/app-shell.js +29 -16
- package/dist/ui/shared/app-store.js +2 -0
- package/dist/ui/shared/app-stream.js +12 -7
- package/dist/ui/shared/app-themes.js +188 -0
- package/dist/ui/shared/app.css +225 -3
- package/dist/ui/shared/app.js +6 -0
- package/dist/ui/shared/card-strings.js +28 -0
- package/dist/ui/shared/effect-app-runtime.js +248 -0
- package/dist/ui/shared/effect-baseline.js +64 -0
- package/dist/ui/shared/effect-chat-runtime.js +154 -0
- package/dist/ui/shared/effect-cursor.js +125 -0
- package/dist/ui/shared/effect-frame.js +127 -0
- package/dist/ui/shared/effect-geometry.js +122 -0
- package/dist/ui/shared/effect-host-style.js +10 -0
- package/dist/ui/shared/effect-owner-regions.js +74 -0
- package/dist/ui/shared/effect-owner-source.js +115 -0
- package/dist/ui/shared/effect-policy.js +137 -0
- package/dist/ui/shared/effect-poster-reader.js +98 -0
- package/dist/ui/shared/effect-posters.js +117 -0
- package/dist/ui/shared/effect-profiler.js +162 -0
- package/dist/ui/shared/effect-profiles.js +65 -0
- package/dist/ui/shared/effect-registry.js +496 -0
- package/dist/ui/shared/effect-runtime-loader.js +234 -0
- package/dist/ui/shared/effect-safety.js +153 -0
- package/dist/ui/shared/effect-stock-snapshot.js +34 -0
- package/dist/ui/shared/effect-stock-trust.js +165 -0
- package/dist/ui/shared/effect-trial-source.js +103 -0
- package/dist/ui/shared/effect-trial-stage.js +147 -0
- package/dist/ui/shared/header-tools.js +1 -1
- package/dist/ui/shared/identity-card.js +202 -0
- package/dist/ui/shared/identity-color.js +261 -0
- package/dist/ui/shared/instance-nav.js +37 -19
- package/dist/ui/shared/owner-css.js +221 -0
- package/dist/ui/shared/owner-effect-prefs.js +117 -0
- package/dist/ui/shared/panel-view.js +81 -8
- package/dist/ui/shared/signin.js +2 -0
- package/dist/ui/shared/ui-dialog.js +1 -1
- package/dist/ui/shared/ui-icons.js +2 -0
- package/dist/ui/shared/ui-menu.js +1 -1
- package/dist/ui/shared/ui-toast.js +1 -1
- package/dist/ui/shared/usage-dialog.js +14 -2
- package/dist/ui/shared/view-strings.js +36 -2
- package/dist/ui/signin.html +1 -0
- package/dist/usage/providers.d.ts +3 -0
- package/dist/usage/providers.js +4 -3
- package/dist/usage/providers.js.map +1 -1
- package/dist/view-api.d.ts +29 -0
- package/dist/view-api.js +188 -8
- package/dist/view-api.js.map +1 -1
- package/dist/web-api.d.ts +42 -0
- package/dist/web-api.js +898 -36
- package/dist/web-api.js.map +1 -1
- package/dist/web-appearance-limits.d.ts +82 -0
- package/dist/web-appearance-limits.js +83 -0
- package/dist/web-appearance-limits.js.map +1 -0
- package/dist/web-appearance-policy.d.ts +66 -0
- package/dist/web-appearance-policy.js +94 -0
- package/dist/web-appearance-policy.js.map +1 -0
- package/dist/web-appearance-tools.d.ts +50 -0
- package/dist/web-appearance-tools.js +105 -0
- package/dist/web-appearance-tools.js.map +1 -0
- package/dist/web-appearance-view.d.ts +99 -0
- package/dist/web-appearance-view.js +163 -0
- package/dist/web-appearance-view.js.map +1 -0
- package/dist/web-appearance.d.ts +79 -0
- package/dist/web-appearance.js +298 -0
- package/dist/web-appearance.js.map +1 -0
- package/dist/web-asset-parts.d.ts +93 -0
- package/dist/web-asset-parts.js +133 -0
- package/dist/web-asset-parts.js.map +1 -0
- package/dist/web-auth.js +17 -1
- package/dist/web-auth.js.map +1 -1
- package/dist/web-card.d.ts +96 -0
- package/dist/web-card.js +232 -0
- package/dist/web-card.js.map +1 -0
- package/dist/web-chat-history.d.ts +13 -0
- package/dist/web-chat-history.js +23 -2
- package/dist/web-chat-history.js.map +1 -1
- package/dist/web-effect-bundle.d.ts +28 -0
- package/dist/web-effect-bundle.js +126 -0
- package/dist/web-effect-bundle.js.map +1 -0
- package/dist/web-effect-canonical.d.ts +8 -0
- package/dist/web-effect-canonical.js +27 -0
- package/dist/web-effect-canonical.js.map +1 -0
- package/dist/web-effect-library.d.ts +114 -0
- package/dist/web-effect-library.js +530 -0
- package/dist/web-effect-library.js.map +1 -0
- package/dist/web-effect-poster.d.ts +8 -0
- package/dist/web-effect-poster.js +52 -0
- package/dist/web-effect-poster.js.map +1 -0
- package/dist/web-effect-profiles.d.ts +118 -0
- package/dist/web-effect-profiles.js +180 -0
- package/dist/web-effect-profiles.js.map +1 -0
- package/dist/web-effect-service.d.ts +86 -0
- package/dist/web-effect-service.js +314 -0
- package/dist/web-effect-service.js.map +1 -0
- package/dist/web-effect-tools.d.ts +47 -0
- package/dist/web-effect-tools.js +129 -0
- package/dist/web-effect-tools.js.map +1 -0
- package/dist/web-effect-trials.d.ts +86 -0
- package/dist/web-effect-trials.js +204 -0
- package/dist/web-effect-trials.js.map +1 -0
- package/dist/web-effect-upload.d.ts +27 -0
- package/dist/web-effect-upload.js +185 -0
- package/dist/web-effect-upload.js.map +1 -0
- package/dist/web-effect-worker.d.ts +8 -0
- package/dist/web-effect-worker.js +170 -0
- package/dist/web-effect-worker.js.map +1 -0
- package/dist/web-effect.d.ts +103 -0
- package/dist/web-effect.js +153 -0
- package/dist/web-effect.js.map +1 -0
- package/dist/web-identity-color.d.ts +87 -0
- package/dist/web-identity-color.js +209 -0
- package/dist/web-identity-color.js.map +1 -0
- package/dist/web-identity-palette.d.ts +113 -0
- package/dist/web-identity-palette.js +84 -0
- package/dist/web-identity-palette.js.map +1 -0
- package/dist/web-image-meta.d.ts +25 -0
- package/dist/web-image-meta.js +200 -0
- package/dist/web-image-meta.js.map +1 -0
- package/dist/web-mod-agent.d.ts +50 -0
- package/dist/web-mod-agent.js +205 -0
- package/dist/web-mod-agent.js.map +1 -0
- package/dist/web-mod-bundle.d.ts +149 -0
- package/dist/web-mod-bundle.js +470 -0
- package/dist/web-mod-bundle.js.map +1 -0
- package/dist/web-mod-export.d.ts +59 -0
- package/dist/web-mod-export.js +79 -0
- package/dist/web-mod-export.js.map +1 -0
- package/dist/web-mod-store.d.ts +283 -0
- package/dist/web-mod-store.js +625 -0
- package/dist/web-mod-store.js.map +1 -0
- package/dist/web-org.d.ts +3 -3
- package/dist/web-org.js +11 -17
- package/dist/web-org.js.map +1 -1
- package/dist/web-owner-css-store.d.ts +180 -0
- package/dist/web-owner-css-store.js +384 -0
- package/dist/web-owner-css-store.js.map +1 -0
- package/dist/web-owner-css.d.ts +58 -0
- package/dist/web-owner-css.js +552 -0
- package/dist/web-owner-css.js.map +1 -0
- package/dist/web-prefs.d.ts +48 -0
- package/dist/web-prefs.js +209 -33
- package/dist/web-prefs.js.map +1 -1
- package/dist/web-preview.d.ts +9 -1
- package/dist/web-preview.js +24 -7
- package/dist/web-preview.js.map +1 -1
- package/dist/web-settings-patch.d.ts +18 -0
- package/dist/web-settings-patch.js +51 -0
- package/dist/web-settings-patch.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 +218 -0
- package/dist/web-theme-store.js +516 -0
- package/dist/web-theme-store.js.map +1 -0
- package/dist/web-theme.d.ts +121 -0
- package/dist/web-theme.js +407 -0
- package/dist/web-theme.js.map +1 -0
- package/dist/web-widget.d.ts +72 -0
- package/dist/web-widget.js +245 -0
- package/dist/web-widget.js.map +1 -0
- package/package.json +1 -1
- package/templates/systemd.service.ejs +8 -0
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* #1629 (first design §1, §8; r2 §8): an agent's web theme — a small, closed, typed object. One module validates and
|
|
3
|
+
* canonicalises it; the store keeps only what this returns, and the page applies only canonical values (colours as
|
|
4
|
+
* "#rrggbb", choices as fixed tokens, numbers in range). Nothing here is CSS text.
|
|
5
|
+
*
|
|
6
|
+
* The theme is the look only. Where an agent's effects and widgets are placed is the store's (web-theme-store.ts
|
|
7
|
+
* placements): `set_web_theme` never places anything.
|
|
8
|
+
*/
|
|
9
|
+
import { type IdentityColor, type Placement } from "./web-identity-palette.js";
|
|
10
|
+
export type Color = string;
|
|
11
|
+
export type AssetId = string;
|
|
12
|
+
export interface Palette {
|
|
13
|
+
bg?: Color;
|
|
14
|
+
surface?: Color;
|
|
15
|
+
text?: Color;
|
|
16
|
+
text2?: Color;
|
|
17
|
+
accent?: Color;
|
|
18
|
+
userBubble?: Color;
|
|
19
|
+
agentBubble?: Color;
|
|
20
|
+
}
|
|
21
|
+
export type ThemeMode = "light" | "dark";
|
|
22
|
+
export interface Theme {
|
|
23
|
+
v: 1;
|
|
24
|
+
colors?: {
|
|
25
|
+
light?: Palette;
|
|
26
|
+
dark?: Palette;
|
|
27
|
+
};
|
|
28
|
+
accent?: Color;
|
|
29
|
+
bubble?: {
|
|
30
|
+
radius?: number;
|
|
31
|
+
border?: "none" | "thin" | "accent";
|
|
32
|
+
};
|
|
33
|
+
font?: "inter" | "system" | "mono";
|
|
34
|
+
background?: {
|
|
35
|
+
image: AssetId;
|
|
36
|
+
fit: "cover" | "contain";
|
|
37
|
+
opacity: number;
|
|
38
|
+
};
|
|
39
|
+
avatar?: AssetId;
|
|
40
|
+
workingLabel?: string;
|
|
41
|
+
/** r4 §1: the agent's identity card. A person's card fields (View's Edit profile) win field by field. */
|
|
42
|
+
card?: ThemeCard;
|
|
43
|
+
/**
|
|
44
|
+
* #1958: the agent's identity colour (a preset or #rrggbb; without it, its accent) and where it shows. A person's
|
|
45
|
+
* choice for this instance wins, field by field.
|
|
46
|
+
*/
|
|
47
|
+
identity?: ThemeIdentity;
|
|
48
|
+
}
|
|
49
|
+
export interface ThemeIdentity {
|
|
50
|
+
color?: IdentityColor;
|
|
51
|
+
show?: Placement[];
|
|
52
|
+
}
|
|
53
|
+
export interface ThemeCard {
|
|
54
|
+
portrait?: AssetId;
|
|
55
|
+
banner?: AssetId;
|
|
56
|
+
tagline?: string;
|
|
57
|
+
bio?: string;
|
|
58
|
+
}
|
|
59
|
+
export interface ThemeProblem {
|
|
60
|
+
path: string;
|
|
61
|
+
problem: string;
|
|
62
|
+
}
|
|
63
|
+
export declare const THEME_MAX_BYTES = 4096;
|
|
64
|
+
export declare const PALETTE_KEYS: readonly ["bg", "surface", "text", "text2", "accent", "userBubble", "agentBubble"];
|
|
65
|
+
/**
|
|
66
|
+
* The token defaults (src/ui/shared/tokens.css) the contrast check measures a theme against — a test pins these equal
|
|
67
|
+
* to the stylesheet. An agent message has no bubble of its own: its "bubble" is the page background.
|
|
68
|
+
*/
|
|
69
|
+
export declare const THEME_DEFAULTS: Record<ThemeMode, Required<Palette>>;
|
|
70
|
+
/** WCAG AA: [foreground, background, minimum ratio]. */
|
|
71
|
+
export declare const CONTRAST_PAIRS: ReadonlyArray<readonly [keyof Palette, keyof Palette, number]>;
|
|
72
|
+
/** "#rgb" | "#rrggbb", any case → "#rrggbb" lowercase; anything else (names, alpha, functions, text after it) → null. */
|
|
73
|
+
export declare function canonicalColor(v: unknown): Color | null;
|
|
74
|
+
/** A card's bio (r4 §1): NFC, 1..280 graphemes, at most 3 line breaks ("\n" only), otherwise as one line. */
|
|
75
|
+
export declare const BIO_MAX_GRAPHEMES = 280;
|
|
76
|
+
export declare const BIO_MAX_BREAKS = 3;
|
|
77
|
+
export declare const TAGLINE_MAX_GRAPHEMES = 60;
|
|
78
|
+
/**
|
|
79
|
+
* #1889 review: one explicit bound in UTF-16 units too, for the host and the page alike — a grapheme may be many units
|
|
80
|
+
* (an emoji family is 8), so 10 per grapheme keeps every ordinary text and still bounds what is stored.
|
|
81
|
+
*/
|
|
82
|
+
export declare const TAGLINE_MAX_UNITS: number;
|
|
83
|
+
export declare const BIO_MAX_UNITS = 2800;
|
|
84
|
+
/** A card's tagline: one line of 1..60 graphemes, at most TAGLINE_MAX_UNITS units. */
|
|
85
|
+
export declare function canonicalTagline(v: unknown): string | null;
|
|
86
|
+
export declare function canonicalBio(v: unknown): string | null;
|
|
87
|
+
/** One line of text: NFC, `min..max` graphemes, nothing invisible or directional. */
|
|
88
|
+
export declare function canonicalText(v: unknown, min: number, max: number): string | null;
|
|
89
|
+
export declare function contrastRatio(a: Color, b: Color): number;
|
|
90
|
+
/** The palette a mode renders with: the theme's colours over the defaults (a mode's accent, else the theme's). */
|
|
91
|
+
export declare function effectivePalette(theme: Theme, mode: ThemeMode): Required<Palette>;
|
|
92
|
+
export interface ThemeContext {
|
|
93
|
+
/** The asset ids this instance has (background and avatar must name one). */
|
|
94
|
+
assets: ReadonlySet<string>;
|
|
95
|
+
/** r4 §1: each asset's slot — a card's portrait and banner must name a picture uploaded for that slot. */
|
|
96
|
+
slotOf?: (id: string) => string | undefined;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* The whole theme, checked and canonicalised: closed schema at every level, types never coerced, integers and steps,
|
|
100
|
+
* colours re-serialised, text NFC and counted in graphemes, asset ids this instance has, contrast per mode, ≤ 4 KiB.
|
|
101
|
+
*/
|
|
102
|
+
export declare function checkTheme(input: unknown, ctx: ThemeContext): {
|
|
103
|
+
ok: true;
|
|
104
|
+
theme: Theme;
|
|
105
|
+
} | {
|
|
106
|
+
ok: false;
|
|
107
|
+
errors: ThemeProblem[];
|
|
108
|
+
};
|
|
109
|
+
/** One key order, so the stored, served and tool-returned JSON are the same bytes for the same theme. */
|
|
110
|
+
export declare function canonicalTheme(t: Theme): Theme;
|
|
111
|
+
/**
|
|
112
|
+
* set_web_theme's patch on the current theme: `set` merges (objects by key, values replace), then `clear` removes
|
|
113
|
+
* dotted paths ("colors.dark.bg", "bubble", …). The result is checked whole: all or nothing.
|
|
114
|
+
*/
|
|
115
|
+
export declare function applyThemePatch(current: Theme, patch: unknown, ctx: ThemeContext): {
|
|
116
|
+
ok: true;
|
|
117
|
+
theme: Theme;
|
|
118
|
+
} | {
|
|
119
|
+
ok: false;
|
|
120
|
+
errors: ThemeProblem[];
|
|
121
|
+
};
|
|
@@ -0,0 +1,407 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* #1629 (first design §1, §8; r2 §8): an agent's web theme — a small, closed, typed object. One module validates and
|
|
3
|
+
* canonicalises it; the store keeps only what this returns, and the page applies only canonical values (colours as
|
|
4
|
+
* "#rrggbb", choices as fixed tokens, numbers in range). Nothing here is CSS text.
|
|
5
|
+
*
|
|
6
|
+
* The theme is the look only. Where an agent's effects and widgets are placed is the store's (web-theme-store.ts
|
|
7
|
+
* placements): `set_web_theme` never places anything.
|
|
8
|
+
*/
|
|
9
|
+
import { canonicalIdentityColor, canonicalPlacements } from "./web-identity-palette.js";
|
|
10
|
+
export const THEME_MAX_BYTES = 4096;
|
|
11
|
+
export const PALETTE_KEYS = ["bg", "surface", "text", "text2", "accent", "userBubble", "agentBubble"];
|
|
12
|
+
const MODES = ["light", "dark"];
|
|
13
|
+
const BORDERS = ["none", "thin", "accent"];
|
|
14
|
+
const FONTS = ["inter", "system", "mono"];
|
|
15
|
+
const FITS = ["cover", "contain"];
|
|
16
|
+
const ASSET_ID = /^[0-9a-f]{32}$/;
|
|
17
|
+
/**
|
|
18
|
+
* The token defaults (src/ui/shared/tokens.css) the contrast check measures a theme against — a test pins these equal
|
|
19
|
+
* to the stylesheet. An agent message has no bubble of its own: its "bubble" is the page background.
|
|
20
|
+
*/
|
|
21
|
+
export const THEME_DEFAULTS = {
|
|
22
|
+
dark: { bg: "#212121", surface: "#2f2f2f", text: "#ececec", text2: "#b4b4b4", accent: "#7ab7ff", userBubble: "#2f2f2f", agentBubble: "#212121" },
|
|
23
|
+
light: { bg: "#ffffff", surface: "#f4f4f4", text: "#0d0d0d", text2: "#5d5d5d", accent: "#0a62c2", userBubble: "#f4f4f4", agentBubble: "#ffffff" },
|
|
24
|
+
};
|
|
25
|
+
/** WCAG AA: [foreground, background, minimum ratio]. */
|
|
26
|
+
export const CONTRAST_PAIRS = [
|
|
27
|
+
["text", "bg", 4.5], ["text", "surface", 4.5], ["text", "agentBubble", 4.5], ["text", "userBubble", 4.5],
|
|
28
|
+
["text2", "bg", 4.5], ["text2", "surface", 4.5],
|
|
29
|
+
["accent", "bg", 3],
|
|
30
|
+
];
|
|
31
|
+
const isObj = (v) => typeof v === "object" && v !== null && !Array.isArray(v) && Object.getPrototypeOf(v) === Object.prototype;
|
|
32
|
+
/** "#rgb" | "#rrggbb", any case → "#rrggbb" lowercase; anything else (names, alpha, functions, text after it) → null. */
|
|
33
|
+
export function canonicalColor(v) {
|
|
34
|
+
if (typeof v !== "string")
|
|
35
|
+
return null;
|
|
36
|
+
const m = /^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/.exec(v);
|
|
37
|
+
if (!m)
|
|
38
|
+
return null;
|
|
39
|
+
const h = m[1].toLowerCase();
|
|
40
|
+
return h.length === 3 ? `#${h[0]}${h[0]}${h[1]}${h[1]}${h[2]}${h[2]}` : `#${h}`;
|
|
41
|
+
}
|
|
42
|
+
const GRAPHEMES = new Intl.Segmenter(undefined, { granularity: "grapheme" });
|
|
43
|
+
/**
|
|
44
|
+
* Control, format (incl. bidi overrides, zero-width space), line/paragraph separators: never in a label — except the
|
|
45
|
+
* zero-width joiner, which emoji sequences (👨👩👧) are made of.
|
|
46
|
+
*/
|
|
47
|
+
const FORBIDDEN_TEXT = /(?!\u200d)[\p{Cc}\p{Cf}\p{Zl}\p{Zp}]/u;
|
|
48
|
+
/**
|
|
49
|
+
* At least one character that draws something: not a mark, control, format or separator, nor a blank that renders as
|
|
50
|
+
* nothing (Hangul fillers, braille blank) — so a lone joiner, variation selector or filler is not a label (#1887 P3).
|
|
51
|
+
*/
|
|
52
|
+
const VISIBLE = /[^\p{M}\p{C}\p{Z}\u115f\u1160\u3164\uffa0\u2800]/u;
|
|
53
|
+
/** A card's bio (r4 §1): NFC, 1..280 graphemes, at most 3 line breaks ("\n" only), otherwise as one line. */
|
|
54
|
+
export const BIO_MAX_GRAPHEMES = 280;
|
|
55
|
+
export const BIO_MAX_BREAKS = 3;
|
|
56
|
+
export const TAGLINE_MAX_GRAPHEMES = 60;
|
|
57
|
+
/**
|
|
58
|
+
* #1889 review: one explicit bound in UTF-16 units too, for the host and the page alike — a grapheme may be many units
|
|
59
|
+
* (an emoji family is 8), so 10 per grapheme keeps every ordinary text and still bounds what is stored.
|
|
60
|
+
*/
|
|
61
|
+
export const TAGLINE_MAX_UNITS = TAGLINE_MAX_GRAPHEMES * 10;
|
|
62
|
+
export const BIO_MAX_UNITS = 2800;
|
|
63
|
+
/** A card's tagline: one line of 1..60 graphemes, at most TAGLINE_MAX_UNITS units. */
|
|
64
|
+
export function canonicalTagline(v) {
|
|
65
|
+
const t = canonicalText(v, 1, TAGLINE_MAX_GRAPHEMES);
|
|
66
|
+
return t !== null && t.length <= TAGLINE_MAX_UNITS ? t : null;
|
|
67
|
+
}
|
|
68
|
+
export function canonicalBio(v) {
|
|
69
|
+
if (typeof v !== "string")
|
|
70
|
+
return null;
|
|
71
|
+
const s = v.normalize("NFC");
|
|
72
|
+
const lines = s.split("\n");
|
|
73
|
+
if (s.length > BIO_MAX_UNITS || lines.length > BIO_MAX_BREAKS + 1 || s.trim() !== s || !VISIBLE.test(s))
|
|
74
|
+
return null;
|
|
75
|
+
if (lines.some(l => FORBIDDEN_TEXT.test(l)))
|
|
76
|
+
return null;
|
|
77
|
+
const n = [...GRAPHEMES.segment(s)].length;
|
|
78
|
+
return n >= 1 && n <= BIO_MAX_GRAPHEMES ? s : null;
|
|
79
|
+
}
|
|
80
|
+
/** One line of text: NFC, `min..max` graphemes, nothing invisible or directional. */
|
|
81
|
+
export function canonicalText(v, min, max) {
|
|
82
|
+
if (typeof v !== "string")
|
|
83
|
+
return null;
|
|
84
|
+
const s = v.normalize("NFC");
|
|
85
|
+
if (FORBIDDEN_TEXT.test(s) || s.trim() !== s || !VISIBLE.test(s))
|
|
86
|
+
return null;
|
|
87
|
+
const n = [...GRAPHEMES.segment(s)].length;
|
|
88
|
+
return n >= min && n <= max ? s : null;
|
|
89
|
+
}
|
|
90
|
+
function relLuminance(hex) {
|
|
91
|
+
const c = [1, 3, 5].map(i => parseInt(hex.slice(i, i + 2), 16) / 255).map(x => (x <= 0.03928 ? x / 12.92 : ((x + 0.055) / 1.055) ** 2.4));
|
|
92
|
+
return 0.2126 * c[0] + 0.7152 * c[1] + 0.0722 * c[2];
|
|
93
|
+
}
|
|
94
|
+
export function contrastRatio(a, b) {
|
|
95
|
+
const [l1, l2] = [relLuminance(a), relLuminance(b)].sort((x, y) => y - x);
|
|
96
|
+
return (l1 + 0.05) / (l2 + 0.05);
|
|
97
|
+
}
|
|
98
|
+
/** The palette a mode renders with: the theme's colours over the defaults (a mode's accent, else the theme's). */
|
|
99
|
+
export function effectivePalette(theme, mode) {
|
|
100
|
+
return { ...THEME_DEFAULTS[mode], ...(theme.accent ? { accent: theme.accent } : {}), ...(theme.colors?.[mode] ?? {}) };
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* The whole theme, checked and canonicalised: closed schema at every level, types never coerced, integers and steps,
|
|
104
|
+
* colours re-serialised, text NFC and counted in graphemes, asset ids this instance has, contrast per mode, ≤ 4 KiB.
|
|
105
|
+
*/
|
|
106
|
+
export function checkTheme(input, ctx) {
|
|
107
|
+
const errors = [];
|
|
108
|
+
const bad = (path, problem) => { errors.push({ path, problem }); };
|
|
109
|
+
if (!isObj(input))
|
|
110
|
+
return { ok: false, errors: [{ path: "", problem: "must be an object" }] };
|
|
111
|
+
const out = { v: 1 };
|
|
112
|
+
const known = new Set(["v", "colors", "accent", "bubble", "font", "background", "avatar", "workingLabel", "card", "identity"]);
|
|
113
|
+
for (const k of Object.keys(input))
|
|
114
|
+
if (!known.has(k))
|
|
115
|
+
bad(k, "unknown key");
|
|
116
|
+
if (input.v !== undefined && input.v !== 1)
|
|
117
|
+
bad("v", "must be 1");
|
|
118
|
+
if (input.colors !== undefined) {
|
|
119
|
+
if (!isObj(input.colors))
|
|
120
|
+
bad("colors", "must be an object");
|
|
121
|
+
else {
|
|
122
|
+
const colors = {};
|
|
123
|
+
for (const k of Object.keys(input.colors))
|
|
124
|
+
if (!MODES.includes(k))
|
|
125
|
+
bad(`colors.${k}`, "unknown key (light or dark)");
|
|
126
|
+
for (const mode of MODES) {
|
|
127
|
+
const pal = input.colors[mode];
|
|
128
|
+
if (pal === undefined)
|
|
129
|
+
continue;
|
|
130
|
+
if (!isObj(pal)) {
|
|
131
|
+
bad(`colors.${mode}`, "must be an object");
|
|
132
|
+
continue;
|
|
133
|
+
}
|
|
134
|
+
const p = {};
|
|
135
|
+
for (const k of Object.keys(pal)) {
|
|
136
|
+
if (!PALETTE_KEYS.includes(k)) {
|
|
137
|
+
bad(`colors.${mode}.${k}`, "unknown key");
|
|
138
|
+
continue;
|
|
139
|
+
}
|
|
140
|
+
const c = canonicalColor(pal[k]);
|
|
141
|
+
if (!c)
|
|
142
|
+
bad(`colors.${mode}.${k}`, "must be a colour #rgb or #rrggbb");
|
|
143
|
+
else
|
|
144
|
+
p[k] = c;
|
|
145
|
+
}
|
|
146
|
+
if (Object.keys(p).length)
|
|
147
|
+
colors[mode] = sortPalette(p);
|
|
148
|
+
}
|
|
149
|
+
if (Object.keys(colors).length)
|
|
150
|
+
out.colors = colors;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
if (input.accent !== undefined) {
|
|
154
|
+
const c = canonicalColor(input.accent);
|
|
155
|
+
if (!c)
|
|
156
|
+
bad("accent", "must be a colour #rgb or #rrggbb");
|
|
157
|
+
else
|
|
158
|
+
out.accent = c;
|
|
159
|
+
}
|
|
160
|
+
if (input.bubble !== undefined) {
|
|
161
|
+
if (!isObj(input.bubble))
|
|
162
|
+
bad("bubble", "must be an object");
|
|
163
|
+
else {
|
|
164
|
+
const b = {};
|
|
165
|
+
for (const k of Object.keys(input.bubble))
|
|
166
|
+
if (k !== "radius" && k !== "border")
|
|
167
|
+
bad(`bubble.${k}`, "unknown key");
|
|
168
|
+
const r = input.bubble.radius;
|
|
169
|
+
if (r !== undefined) {
|
|
170
|
+
if (!Number.isInteger(r) || r < 0 || r > 24)
|
|
171
|
+
bad("bubble.radius", "a whole number of px, 0..24");
|
|
172
|
+
else
|
|
173
|
+
b.radius = r;
|
|
174
|
+
}
|
|
175
|
+
const bd = input.bubble.border;
|
|
176
|
+
if (bd !== undefined) {
|
|
177
|
+
if (!BORDERS.includes(bd))
|
|
178
|
+
bad("bubble.border", "none, thin or accent");
|
|
179
|
+
else
|
|
180
|
+
b.border = bd;
|
|
181
|
+
}
|
|
182
|
+
if (Object.keys(b).length)
|
|
183
|
+
out.bubble = b;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
if (input.font !== undefined) {
|
|
187
|
+
if (!FONTS.includes(input.font))
|
|
188
|
+
bad("font", "inter, system or mono");
|
|
189
|
+
else
|
|
190
|
+
out.font = input.font;
|
|
191
|
+
}
|
|
192
|
+
if (input.background !== undefined) {
|
|
193
|
+
const bg = input.background;
|
|
194
|
+
if (!isObj(bg))
|
|
195
|
+
bad("background", "must be an object");
|
|
196
|
+
else {
|
|
197
|
+
for (const k of Object.keys(bg))
|
|
198
|
+
if (!["image", "fit", "opacity"].includes(k))
|
|
199
|
+
bad(`background.${k}`, "unknown key");
|
|
200
|
+
const okImage = typeof bg.image === "string" && ASSET_ID.test(bg.image) && ctx.assets.has(bg.image);
|
|
201
|
+
if (!okImage)
|
|
202
|
+
bad("background.image", typeof bg.image === "string" && ASSET_ID.test(bg.image) ? "no such asset of this instance" : "an asset id");
|
|
203
|
+
const okFit = FITS.includes(bg.fit);
|
|
204
|
+
if (!okFit)
|
|
205
|
+
bad("background.fit", "cover or contain");
|
|
206
|
+
const op = bg.opacity;
|
|
207
|
+
const okOp = typeof op === "number" && Number.isFinite(op) && op >= 0.05 && op <= 1;
|
|
208
|
+
if (!okOp)
|
|
209
|
+
bad("background.opacity", "a number 0.05..1");
|
|
210
|
+
if (okImage && okFit && okOp)
|
|
211
|
+
out.background = { image: bg.image, fit: bg.fit, opacity: Math.round(op * 20) / 20 };
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
if (input.avatar !== undefined) {
|
|
215
|
+
const a = input.avatar;
|
|
216
|
+
if (typeof a !== "string" || !ASSET_ID.test(a))
|
|
217
|
+
bad("avatar", "an asset id");
|
|
218
|
+
else if (!ctx.assets.has(a))
|
|
219
|
+
bad("avatar", "no such asset of this instance");
|
|
220
|
+
else
|
|
221
|
+
out.avatar = a;
|
|
222
|
+
}
|
|
223
|
+
if (input.workingLabel !== undefined) {
|
|
224
|
+
const t = canonicalText(input.workingLabel, 1, 24);
|
|
225
|
+
if (t === null)
|
|
226
|
+
bad("workingLabel", "1..24 characters on one line, no control or direction characters");
|
|
227
|
+
else
|
|
228
|
+
out.workingLabel = t;
|
|
229
|
+
}
|
|
230
|
+
if (input.card !== undefined) {
|
|
231
|
+
const c = input.card;
|
|
232
|
+
if (!isObj(c))
|
|
233
|
+
bad("card", "must be an object");
|
|
234
|
+
else {
|
|
235
|
+
const card = {};
|
|
236
|
+
for (const k of Object.keys(c))
|
|
237
|
+
if (!["portrait", "banner", "tagline", "bio"].includes(k))
|
|
238
|
+
bad(`card.${k}`, "unknown key");
|
|
239
|
+
for (const slot of ["portrait", "banner"]) {
|
|
240
|
+
const id = c[slot];
|
|
241
|
+
if (id === undefined)
|
|
242
|
+
continue;
|
|
243
|
+
if (typeof id !== "string" || !ASSET_ID.test(id))
|
|
244
|
+
bad(`card.${slot}`, "an asset id");
|
|
245
|
+
else if (!ctx.assets.has(id))
|
|
246
|
+
bad(`card.${slot}`, "no such asset of this instance");
|
|
247
|
+
else if (ctx.slotOf && ctx.slotOf(id) !== slot)
|
|
248
|
+
bad(`card.${slot}`, `a picture uploaded for the ${slot} slot`);
|
|
249
|
+
else
|
|
250
|
+
card[slot] = id;
|
|
251
|
+
}
|
|
252
|
+
if (c.tagline !== undefined) {
|
|
253
|
+
const t = canonicalTagline(c.tagline);
|
|
254
|
+
if (t === null)
|
|
255
|
+
bad("card.tagline", `1..${TAGLINE_MAX_GRAPHEMES} characters on one line, no control or direction characters`);
|
|
256
|
+
else
|
|
257
|
+
card.tagline = t;
|
|
258
|
+
}
|
|
259
|
+
if (c.bio !== undefined) {
|
|
260
|
+
const b = canonicalBio(c.bio);
|
|
261
|
+
if (b === null)
|
|
262
|
+
bad("card.bio", `1..${BIO_MAX_GRAPHEMES} characters, at most ${BIO_MAX_BREAKS} line breaks, no control or direction characters`);
|
|
263
|
+
else
|
|
264
|
+
card.bio = b;
|
|
265
|
+
}
|
|
266
|
+
if (Object.keys(card).length)
|
|
267
|
+
out.card = card;
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
if (input.identity !== undefined) {
|
|
271
|
+
const id = input.identity;
|
|
272
|
+
if (!isObj(id))
|
|
273
|
+
bad("identity", "must be an object");
|
|
274
|
+
else {
|
|
275
|
+
const identity = {};
|
|
276
|
+
for (const k of Object.keys(id))
|
|
277
|
+
if (k !== "color" && k !== "show")
|
|
278
|
+
bad(`identity.${k}`, "unknown key");
|
|
279
|
+
if (id.color !== undefined) {
|
|
280
|
+
const c = canonicalIdentityColor(id.color);
|
|
281
|
+
if (!c)
|
|
282
|
+
bad("identity.color", "a preset (red, orange, amber, lime, green, teal, cyan, blue, indigo, violet, pink, slate) or a colour #rrggbb");
|
|
283
|
+
else
|
|
284
|
+
identity.color = c;
|
|
285
|
+
}
|
|
286
|
+
if (id.show !== undefined) {
|
|
287
|
+
const s = canonicalPlacements(id.show);
|
|
288
|
+
if (!s)
|
|
289
|
+
bad("identity.show", "a list of where the colour shows: name, bar, ring (each once; [] for nowhere)");
|
|
290
|
+
else
|
|
291
|
+
identity.show = s;
|
|
292
|
+
}
|
|
293
|
+
if (Object.keys(identity).length)
|
|
294
|
+
out.identity = identity;
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
if (errors.length)
|
|
298
|
+
return { ok: false, errors };
|
|
299
|
+
for (const mode of MODES) {
|
|
300
|
+
const pal = effectivePalette(out, mode);
|
|
301
|
+
for (const [fg, bgKey, min] of CONTRAST_PAIRS) {
|
|
302
|
+
const ratio = contrastRatio(pal[fg], pal[bgKey]);
|
|
303
|
+
if (ratio + 1e-9 < min)
|
|
304
|
+
bad(`colors.${mode}.${fg}`, `contrast ${fg} on ${bgKey} is ${ratio.toFixed(2)}:1, at least ${min}:1 is needed`);
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
if (errors.length)
|
|
308
|
+
return { ok: false, errors };
|
|
309
|
+
const canonical = canonicalTheme(out);
|
|
310
|
+
if (Buffer.byteLength(JSON.stringify(canonical), "utf8") > THEME_MAX_BYTES)
|
|
311
|
+
return { ok: false, errors: [{ path: "", problem: `larger than ${THEME_MAX_BYTES} bytes` }] };
|
|
312
|
+
return { ok: true, theme: canonical };
|
|
313
|
+
}
|
|
314
|
+
function sortPalette(p) {
|
|
315
|
+
const out = {};
|
|
316
|
+
for (const k of PALETTE_KEYS)
|
|
317
|
+
if (p[k] !== undefined)
|
|
318
|
+
out[k] = p[k];
|
|
319
|
+
return out;
|
|
320
|
+
}
|
|
321
|
+
/** One key order, so the stored, served and tool-returned JSON are the same bytes for the same theme. */
|
|
322
|
+
export function canonicalTheme(t) {
|
|
323
|
+
const out = { v: 1 };
|
|
324
|
+
if (t.colors) {
|
|
325
|
+
const c = {};
|
|
326
|
+
for (const m of MODES)
|
|
327
|
+
if (t.colors[m])
|
|
328
|
+
c[m] = sortPalette(t.colors[m]);
|
|
329
|
+
out.colors = c;
|
|
330
|
+
}
|
|
331
|
+
if (t.accent)
|
|
332
|
+
out.accent = t.accent;
|
|
333
|
+
if (t.bubble)
|
|
334
|
+
out.bubble = { ...(t.bubble.radius !== undefined ? { radius: t.bubble.radius } : {}), ...(t.bubble.border ? { border: t.bubble.border } : {}) };
|
|
335
|
+
if (t.font)
|
|
336
|
+
out.font = t.font;
|
|
337
|
+
if (t.background)
|
|
338
|
+
out.background = { image: t.background.image, fit: t.background.fit, opacity: t.background.opacity };
|
|
339
|
+
if (t.avatar)
|
|
340
|
+
out.avatar = t.avatar;
|
|
341
|
+
if (t.workingLabel)
|
|
342
|
+
out.workingLabel = t.workingLabel;
|
|
343
|
+
if (t.card) {
|
|
344
|
+
const c = {};
|
|
345
|
+
for (const k of ["portrait", "banner", "tagline", "bio"])
|
|
346
|
+
if (t.card[k])
|
|
347
|
+
c[k] = t.card[k];
|
|
348
|
+
if (Object.keys(c).length)
|
|
349
|
+
out.card = c;
|
|
350
|
+
}
|
|
351
|
+
if (t.identity && (t.identity.color || t.identity.show)) {
|
|
352
|
+
out.identity = { ...(t.identity.color ? { color: t.identity.color } : {}), ...(t.identity.show ? { show: [...t.identity.show] } : {}) };
|
|
353
|
+
}
|
|
354
|
+
return out;
|
|
355
|
+
}
|
|
356
|
+
/**
|
|
357
|
+
* set_web_theme's patch on the current theme: `set` merges (objects by key, values replace), then `clear` removes
|
|
358
|
+
* dotted paths ("colors.dark.bg", "bubble", …). The result is checked whole: all or nothing.
|
|
359
|
+
*/
|
|
360
|
+
export function applyThemePatch(current, patch, ctx) {
|
|
361
|
+
if (!isObj(patch))
|
|
362
|
+
return { ok: false, errors: [{ path: "", problem: "a patch { set?, clear? }" }] };
|
|
363
|
+
for (const k of Object.keys(patch))
|
|
364
|
+
if (k !== "set" && k !== "clear")
|
|
365
|
+
return { ok: false, errors: [{ path: k, problem: "unknown key (set or clear)" }] };
|
|
366
|
+
const next = JSON.parse(JSON.stringify(current));
|
|
367
|
+
if (patch.set !== undefined) {
|
|
368
|
+
if (!isObj(patch.set))
|
|
369
|
+
return { ok: false, errors: [{ path: "set", problem: "must be an object" }] };
|
|
370
|
+
mergeInto(next, patch.set);
|
|
371
|
+
}
|
|
372
|
+
if (patch.clear !== undefined) {
|
|
373
|
+
if (!Array.isArray(patch.clear) || patch.clear.length > 32 || !patch.clear.every(p => typeof p === "string" && /^[a-zA-Z0-9]+(\.[a-zA-Z0-9]+){0,2}$/.test(p))) {
|
|
374
|
+
return { ok: false, errors: [{ path: "clear", problem: "a list of dotted paths such as colors.dark.bg" }] };
|
|
375
|
+
}
|
|
376
|
+
for (const path of patch.clear)
|
|
377
|
+
clearPath(next, path.split("."));
|
|
378
|
+
}
|
|
379
|
+
return checkTheme(next, ctx);
|
|
380
|
+
}
|
|
381
|
+
function mergeInto(target, src) {
|
|
382
|
+
for (const k of Object.keys(src)) {
|
|
383
|
+
const v = src[k];
|
|
384
|
+
if (Object.hasOwn(target, k) && isObj(v) && isObj(target[k])) {
|
|
385
|
+
mergeInto(target[k], v);
|
|
386
|
+
continue;
|
|
387
|
+
}
|
|
388
|
+
// An own property, whatever the name ("__proto__" included): the closed-schema check then reports it, never a prototype.
|
|
389
|
+
Object.defineProperty(target, k, { value: isObj(v) ? JSON.parse(JSON.stringify(v)) : v, enumerable: true, writable: true, configurable: true });
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
function clearPath(target, parts) {
|
|
393
|
+
const [head, ...rest] = parts;
|
|
394
|
+
if (!head || !Object.hasOwn(target, head))
|
|
395
|
+
return;
|
|
396
|
+
if (!rest.length) {
|
|
397
|
+
delete target[head];
|
|
398
|
+
return;
|
|
399
|
+
}
|
|
400
|
+
const child = target[head];
|
|
401
|
+
if (!isObj(child))
|
|
402
|
+
return;
|
|
403
|
+
clearPath(child, rest);
|
|
404
|
+
if (!Object.keys(child).length)
|
|
405
|
+
delete target[head];
|
|
406
|
+
}
|
|
407
|
+
//# sourceMappingURL=web-theme.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"web-theme.js","sourceRoot":"","sources":["../src/web-theme.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,sBAAsB,EAAE,mBAAmB,EAAsC,MAAM,2BAA2B,CAAC;AA2B5H,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,CAAC;AACpC,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,aAAa,CAAU,CAAC;AAC/G,MAAM,KAAK,GAAyB,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;AACtD,MAAM,OAAO,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAU,CAAC;AACpD,MAAM,KAAK,GAAG,CAAC,OAAO,EAAE,QAAQ,EAAE,MAAM,CAAU,CAAC;AACnD,MAAM,IAAI,GAAG,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I,CAAC,CAAC;IACvB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM;QAAE,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC;AACtD,CAAC"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
export declare const WIDGET_SLOTS: readonly ["chat_header", "details", "sidebar"];
|
|
2
|
+
export type WidgetSlot = typeof WIDGET_SLOTS[number];
|
|
3
|
+
/** The agent's own slots. `sidebar` is a person's (owner_slot for an agent). */
|
|
4
|
+
export declare const AGENT_WIDGET_SLOTS: readonly ["chat_header", "details"];
|
|
5
|
+
export type AgentWidgetSlot = typeof AGENT_WIDGET_SLOTS[number];
|
|
6
|
+
export declare const WIDGET_ITEM_TYPES: readonly ["stat", "progress", "text", "list", "badge", "spark"];
|
|
7
|
+
export type WidgetItemType = typeof WIDGET_ITEM_TYPES[number];
|
|
8
|
+
export declare const WIDGET_TONES: readonly ["ok", "warn", "bad", "info", "muted"];
|
|
9
|
+
export type WidgetTone = typeof WIDGET_TONES[number];
|
|
10
|
+
/** Values the page already has for the instance itself (its status frame entry). */
|
|
11
|
+
export declare const INSTANCE_BINDS: readonly ["state", "context_pct", "cost_usd"];
|
|
12
|
+
/** The fleet's counts: the person's sidebar only (an agent's widget never sees another instance). */
|
|
13
|
+
export declare const FLEET_BINDS: readonly ["fleet.idle", "fleet.working", "fleet.needs_you", "fleet.stopped"];
|
|
14
|
+
export type WidgetBind = typeof INSTANCE_BINDS[number] | typeof FLEET_BINDS[number];
|
|
15
|
+
/** The chat header is one short strip: at most 4 compact items, and no list or sparkline. */
|
|
16
|
+
export declare const SLOT_RULES: Record<WidgetSlot, {
|
|
17
|
+
maxItems: number;
|
|
18
|
+
types: readonly WidgetItemType[];
|
|
19
|
+
binds: readonly WidgetBind[];
|
|
20
|
+
}>;
|
|
21
|
+
export declare const WIDGET_TITLE_MAX = 24;
|
|
22
|
+
export declare const WIDGET_LABEL_MAX = 24;
|
|
23
|
+
export declare const WIDGET_UNIT_MAX = 8;
|
|
24
|
+
export declare const WIDGET_TEXT_MAX = 120;
|
|
25
|
+
export declare const WIDGET_LIST_ITEMS = 6;
|
|
26
|
+
export declare const WIDGET_LIST_TEXT_MAX = 60;
|
|
27
|
+
export declare const WIDGET_SPARK_POINTS = 48;
|
|
28
|
+
export declare const WIDGET_TONES_MAX = 8;
|
|
29
|
+
export declare const WIDGET_NUMBER_MAX = 1000000000000000;
|
|
30
|
+
/** Canonical JSON bytes: the spec, and the data. */
|
|
31
|
+
export declare const WIDGET_SPEC_MAX_BYTES = 2048;
|
|
32
|
+
export declare const WIDGET_DATA_MAX_BYTES = 4096;
|
|
33
|
+
export interface WidgetItem {
|
|
34
|
+
type: WidgetItemType;
|
|
35
|
+
label?: string;
|
|
36
|
+
key?: string;
|
|
37
|
+
bind?: WidgetBind;
|
|
38
|
+
unit?: string;
|
|
39
|
+
max?: number;
|
|
40
|
+
tone?: WidgetTone;
|
|
41
|
+
tones?: Record<string, WidgetTone>;
|
|
42
|
+
}
|
|
43
|
+
export interface WidgetSpec {
|
|
44
|
+
v: 1;
|
|
45
|
+
title: string;
|
|
46
|
+
items: WidgetItem[];
|
|
47
|
+
}
|
|
48
|
+
export type WidgetValue = number | string | string[] | number[];
|
|
49
|
+
export type WidgetData = Record<string, WidgetValue>;
|
|
50
|
+
export interface WidgetProblem {
|
|
51
|
+
path: string;
|
|
52
|
+
problem: string;
|
|
53
|
+
}
|
|
54
|
+
export type Checked<T> = {
|
|
55
|
+
ok: true;
|
|
56
|
+
value: T;
|
|
57
|
+
} | {
|
|
58
|
+
ok: false;
|
|
59
|
+
errors: WidgetProblem[];
|
|
60
|
+
};
|
|
61
|
+
/** A spec for `slot`, closed and canonical: unknown keys, types, binds or a component the slot can't hold are refused. */
|
|
62
|
+
export declare function checkWidgetSpec(raw: unknown, slot: WidgetSlot): Checked<WidgetSpec>;
|
|
63
|
+
/** Whether `v` is a value an item of `type` can show (the same rule on the page). */
|
|
64
|
+
export declare function valueFits(type: WidgetItemType, v: unknown): boolean;
|
|
65
|
+
/** Data for `spec`: closed to the keys the spec names, each value fitting every item that shows it. */
|
|
66
|
+
export declare function checkWidgetData(raw: unknown, spec: WidgetSpec): Checked<WidgetData>;
|
|
67
|
+
/** `patch` over `prev`: a key set to null is removed; the result is checked whole. */
|
|
68
|
+
export declare function mergeWidgetData(prev: WidgetData, patch: unknown, spec: WidgetSpec): Checked<WidgetData>;
|
|
69
|
+
/** The data kept when a spec changes: each value that still fits the new spec. */
|
|
70
|
+
export declare function carryWidgetData(prev: WidgetData, spec: WidgetSpec): WidgetData;
|
|
71
|
+
/** A spec's id: its content (canonical JSON). The same spec in two bundles is the same widget. */
|
|
72
|
+
export declare function widgetId(spec: WidgetSpec): string;
|