@mcp-b/react-components 0.66.0 → 0.68.0

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.
@@ -5868,29 +5868,32 @@ function _temp4$2(computer_0) {
5868
5868
  //#region src/components/_internal/agent-computer/shell.tsx
5869
5869
  /** The computer's frame: the surface attributes its stylesheet keys on, and its keys. */
5870
5870
  function ShellRoot(t0) {
5871
- const $ = c(25);
5871
+ const $ = c(27);
5872
5872
  let children;
5873
5873
  let className;
5874
+ let desktop;
5874
5875
  let homeWidget;
5875
5876
  let onKeyDown;
5876
5877
  let props;
5877
5878
  let ref;
5878
5879
  if ($[0] !== t0) {
5879
- ({homeWidget, className, onKeyDown, children, ref, ...props} = t0);
5880
+ ({homeWidget, desktop, className, onKeyDown, children, ref, ...props} = t0);
5880
5881
  $[0] = t0;
5881
5882
  $[1] = children;
5882
5883
  $[2] = className;
5883
- $[3] = homeWidget;
5884
- $[4] = onKeyDown;
5885
- $[5] = props;
5886
- $[6] = ref;
5884
+ $[3] = desktop;
5885
+ $[4] = homeWidget;
5886
+ $[5] = onKeyDown;
5887
+ $[6] = props;
5888
+ $[7] = ref;
5887
5889
  } else {
5888
5890
  children = $[1];
5889
5891
  className = $[2];
5890
- homeWidget = $[3];
5891
- onKeyDown = $[4];
5892
- props = $[5];
5893
- ref = $[6];
5892
+ desktop = $[3];
5893
+ homeWidget = $[4];
5894
+ onKeyDown = $[5];
5895
+ props = $[6];
5896
+ ref = $[7];
5894
5897
  }
5895
5898
  const computer = useComputer();
5896
5899
  const rootRef = useMergedRefs(computer.attachRoot, ref);
@@ -5901,30 +5904,31 @@ function ShellRoot(t0) {
5901
5904
  const expose = useComputerSlice(_temp5$1);
5902
5905
  const fullScreen = useComputerSlice(_temp6$1);
5903
5906
  let t1;
5904
- if ($[7] !== className) {
5907
+ if ($[8] !== className) {
5905
5908
  t1 = cx("agent-computer", className);
5906
- $[7] = className;
5907
- $[8] = t1;
5908
- } else t1 = $[8];
5909
+ $[8] = className;
5910
+ $[9] = t1;
5911
+ } else t1 = $[9];
5909
5912
  const t2 = home ? "" : void 0;
5910
5913
  const t3 = phone ? "" : void 0;
5911
5914
  const t4 = homeWidget ? "" : void 0;
5912
- const t5 = switcher ? "" : void 0;
5913
- const t6 = gesturing ?? void 0;
5914
- const t7 = fullScreen ? "" : void 0;
5915
- let t8;
5916
- if ($[9] !== computer || $[10] !== onKeyDown) {
5917
- t8 = (event) => {
5915
+ const t5 = desktop ? "" : void 0;
5916
+ const t6 = switcher ? "" : void 0;
5917
+ const t7 = gesturing ?? void 0;
5918
+ const t8 = fullScreen ? "" : void 0;
5919
+ let t9;
5920
+ if ($[10] !== computer || $[11] !== onKeyDown) {
5921
+ t9 = (event) => {
5918
5922
  onKeyDown?.(event);
5919
5923
  computer.keyDown(event);
5920
5924
  };
5921
- $[9] = computer;
5922
- $[10] = onKeyDown;
5923
- $[11] = t8;
5924
- } else t8 = $[11];
5925
- let t9;
5926
- if ($[12] !== children || $[13] !== expose || $[14] !== props || $[15] !== rootRef || $[16] !== t1 || $[17] !== t2 || $[18] !== t3 || $[19] !== t4 || $[20] !== t5 || $[21] !== t6 || $[22] !== t7 || $[23] !== t8) {
5927
- t9 = /* @__PURE__ */ jsx(AppFrame.Root, {
5925
+ $[10] = computer;
5926
+ $[11] = onKeyDown;
5927
+ $[12] = t9;
5928
+ } else t9 = $[12];
5929
+ let t10;
5930
+ if ($[13] !== children || $[14] !== expose || $[15] !== props || $[16] !== rootRef || $[17] !== t1 || $[18] !== t2 || $[19] !== t3 || $[20] !== t4 || $[21] !== t5 || $[22] !== t6 || $[23] !== t7 || $[24] !== t8 || $[25] !== t9) {
5931
+ t10 = /* @__PURE__ */ jsx(AppFrame.Root, {
5928
5932
  ...props,
5929
5933
  ref: rootRef,
5930
5934
  className: t1,
@@ -5933,28 +5937,30 @@ function ShellRoot(t0) {
5933
5937
  "data-home": t2,
5934
5938
  "data-phone": t3,
5935
5939
  "data-home-widget": t4,
5936
- "data-switcher": t5,
5937
- "data-gesture": t6,
5940
+ "data-desktop": t5,
5941
+ "data-switcher": t6,
5942
+ "data-gesture": t7,
5938
5943
  "data-expose": expose,
5939
- "data-full-screen": t7,
5940
- onKeyDown: t8,
5944
+ "data-full-screen": t8,
5945
+ onKeyDown: t9,
5941
5946
  children
5942
5947
  });
5943
- $[12] = children;
5944
- $[13] = expose;
5945
- $[14] = props;
5946
- $[15] = rootRef;
5947
- $[16] = t1;
5948
- $[17] = t2;
5949
- $[18] = t3;
5950
- $[19] = t4;
5951
- $[20] = t5;
5952
- $[21] = t6;
5953
- $[22] = t7;
5954
- $[23] = t8;
5955
- $[24] = t9;
5956
- } else t9 = $[24];
5957
- return t9;
5948
+ $[13] = children;
5949
+ $[14] = expose;
5950
+ $[15] = props;
5951
+ $[16] = rootRef;
5952
+ $[17] = t1;
5953
+ $[18] = t2;
5954
+ $[19] = t3;
5955
+ $[20] = t4;
5956
+ $[21] = t5;
5957
+ $[22] = t6;
5958
+ $[23] = t7;
5959
+ $[24] = t8;
5960
+ $[25] = t9;
5961
+ $[26] = t10;
5962
+ } else t10 = $[26];
5963
+ return t10;
5958
5964
  }
5959
5965
  function _temp6$1(c_4) {
5960
5966
  const { expandedId } = c_4.getState();
@@ -7787,7 +7793,7 @@ const SIGVELO = COMPUTER_WALLPAPERS.find((option) => option.value === DEFAULT_CO
7787
7793
  * Use a key when changing employee identity to reset their presentation state.
7788
7794
  */
7789
7795
  function AgentComputer(t0) {
7790
- const $ = c(83);
7796
+ const $ = c(84);
7791
7797
  let actionsRef;
7792
7798
  let apps;
7793
7799
  let defaultLayout;
@@ -7935,9 +7941,10 @@ function AgentComputer(t0) {
7935
7941
  } else t14 = $[44];
7936
7942
  const t15 = t14;
7937
7943
  const t16 = Boolean(homeWidget);
7938
- let t17;
7944
+ const t17 = desktop !== void 0;
7945
+ let t18;
7939
7946
  if ($[45] !== homeWidget || $[46] !== name || $[47] !== status) {
7940
- t17 = /* @__PURE__ */ jsx(ShellBar, {
7947
+ t18 = /* @__PURE__ */ jsx(ShellBar, {
7941
7948
  name,
7942
7949
  status,
7943
7950
  homeWidget
@@ -7945,11 +7952,11 @@ function AgentComputer(t0) {
7945
7952
  $[45] = homeWidget;
7946
7953
  $[46] = name;
7947
7954
  $[47] = status;
7948
- $[48] = t17;
7949
- } else t17 = $[48];
7950
- let t18;
7955
+ $[48] = t18;
7956
+ } else t18 = $[48];
7957
+ let t19;
7951
7958
  if ($[49] !== apps || $[50] !== desktop || $[51] !== home) {
7952
- t18 = /* @__PURE__ */ jsx(ShellStage, {
7959
+ t19 = /* @__PURE__ */ jsx(ShellStage, {
7953
7960
  home,
7954
7961
  desktop,
7955
7962
  apps
@@ -7957,128 +7964,130 @@ function AgentComputer(t0) {
7957
7964
  $[49] = apps;
7958
7965
  $[50] = desktop;
7959
7966
  $[51] = home;
7960
- $[52] = t18;
7961
- } else t18 = $[52];
7962
- let t19;
7963
- if ($[53] === Symbol.for("react.memo_cache_sentinel")) {
7964
- t19 = /* @__PURE__ */ jsx(ShellExpose, {});
7965
- $[53] = t19;
7966
- } else t19 = $[53];
7967
+ $[52] = t19;
7968
+ } else t19 = $[52];
7967
7969
  let t20;
7970
+ if ($[53] === Symbol.for("react.memo_cache_sentinel")) {
7971
+ t20 = /* @__PURE__ */ jsx(ShellExpose, {});
7972
+ $[53] = t20;
7973
+ } else t20 = $[53];
7974
+ let t21;
7968
7975
  if ($[54] !== name || $[55] !== trash) {
7969
- t20 = /* @__PURE__ */ jsx(ComputerDock, {
7976
+ t21 = /* @__PURE__ */ jsx(ComputerDock, {
7970
7977
  trash,
7971
7978
  name
7972
7979
  });
7973
7980
  $[54] = name;
7974
7981
  $[55] = trash;
7975
- $[56] = t20;
7976
- } else t20 = $[56];
7977
- let t21;
7978
- if ($[57] === Symbol.for("react.memo_cache_sentinel")) {
7979
- t21 = /* @__PURE__ */ jsx(ShellAnnouncer, {});
7980
- $[57] = t21;
7981
- } else t21 = $[57];
7982
+ $[56] = t21;
7983
+ } else t21 = $[56];
7982
7984
  let t22;
7983
- if ($[58] !== t18 || $[59] !== t20) {
7984
- t22 = /* @__PURE__ */ jsxs(AppFrame.Body, {
7985
+ if ($[57] === Symbol.for("react.memo_cache_sentinel")) {
7986
+ t22 = /* @__PURE__ */ jsx(ShellAnnouncer, {});
7987
+ $[57] = t22;
7988
+ } else t22 = $[57];
7989
+ let t23;
7990
+ if ($[58] !== t19 || $[59] !== t21) {
7991
+ t23 = /* @__PURE__ */ jsxs(AppFrame.Body, {
7985
7992
  className: "agent-computer__body",
7986
7993
  children: [
7987
- t18,
7988
7994
  t19,
7989
7995
  t20,
7990
- t21
7996
+ t21,
7997
+ t22
7991
7998
  ]
7992
7999
  });
7993
- $[58] = t18;
7994
- $[59] = t20;
7995
- $[60] = t22;
7996
- } else t22 = $[60];
7997
- let t23;
8000
+ $[58] = t19;
8001
+ $[59] = t21;
8002
+ $[60] = t23;
8003
+ } else t23 = $[60];
7998
8004
  let t24;
7999
8005
  let t25;
8000
8006
  let t26;
8007
+ let t27;
8001
8008
  if ($[61] === Symbol.for("react.memo_cache_sentinel")) {
8002
- t23 = /* @__PURE__ */ jsx(ShellRevealEdges, {});
8003
- t24 = /* @__PURE__ */ jsx(ShellAppSwitch, {});
8004
- t25 = /* @__PURE__ */ jsx("div", {
8009
+ t24 = /* @__PURE__ */ jsx(ShellRevealEdges, {});
8010
+ t25 = /* @__PURE__ */ jsx(ShellAppSwitch, {});
8011
+ t26 = /* @__PURE__ */ jsx("div", {
8005
8012
  ref: setPortal,
8006
8013
  className: "agent-computer__portal"
8007
8014
  });
8008
- t26 = /* @__PURE__ */ jsx(ShellEffects, {});
8009
- $[61] = t23;
8010
- $[62] = t24;
8011
- $[63] = t25;
8012
- $[64] = t26;
8015
+ t27 = /* @__PURE__ */ jsx(ShellEffects, {});
8016
+ $[61] = t24;
8017
+ $[62] = t25;
8018
+ $[63] = t26;
8019
+ $[64] = t27;
8013
8020
  } else {
8014
- t23 = $[61];
8015
- t24 = $[62];
8016
- t25 = $[63];
8017
- t26 = $[64];
8021
+ t24 = $[61];
8022
+ t25 = $[62];
8023
+ t26 = $[63];
8024
+ t27 = $[64];
8018
8025
  }
8019
- let t27;
8020
- if ($[65] !== props || $[66] !== t15 || $[67] !== t16 || $[68] !== t17 || $[69] !== t22) {
8021
- t27 = /* @__PURE__ */ jsxs(ShellRoot, {
8026
+ let t28;
8027
+ if ($[65] !== props || $[66] !== t15 || $[67] !== t16 || $[68] !== t17 || $[69] !== t18 || $[70] !== t23) {
8028
+ t28 = /* @__PURE__ */ jsxs(ShellRoot, {
8022
8029
  ...props,
8023
8030
  style: t15,
8024
8031
  homeWidget: t16,
8032
+ desktop: t17,
8025
8033
  children: [
8026
- t17,
8027
- t22,
8034
+ t18,
8028
8035
  t23,
8029
8036
  t24,
8030
8037
  t25,
8031
- t26
8038
+ t26,
8039
+ t27
8032
8040
  ]
8033
8041
  });
8034
8042
  $[65] = props;
8035
8043
  $[66] = t15;
8036
8044
  $[67] = t16;
8037
8045
  $[68] = t17;
8038
- $[69] = t22;
8039
- $[70] = t27;
8040
- } else t27 = $[70];
8041
- let t28;
8042
- if ($[71] !== portal || $[72] !== t27) {
8043
- t28 = /* @__PURE__ */ jsx(PortalContext, {
8046
+ $[69] = t18;
8047
+ $[70] = t23;
8048
+ $[71] = t28;
8049
+ } else t28 = $[71];
8050
+ let t29;
8051
+ if ($[72] !== portal || $[73] !== t28) {
8052
+ t29 = /* @__PURE__ */ jsx(PortalContext, {
8044
8053
  value: portal,
8045
- children: t27
8054
+ children: t28
8046
8055
  });
8047
- $[71] = portal;
8048
- $[72] = t27;
8056
+ $[72] = portal;
8049
8057
  $[73] = t28;
8050
- } else t28 = $[73];
8051
- let t29;
8052
- if ($[74] !== computer.handlers || $[75] !== t28) {
8053
- t29 = /* @__PURE__ */ jsx(HandlersContext, {
8058
+ $[74] = t29;
8059
+ } else t29 = $[74];
8060
+ let t30;
8061
+ if ($[75] !== computer.handlers || $[76] !== t29) {
8062
+ t30 = /* @__PURE__ */ jsx(HandlersContext, {
8054
8063
  value: t11,
8055
- children: t28
8064
+ children: t29
8056
8065
  });
8057
- $[74] = computer.handlers;
8058
- $[75] = t28;
8066
+ $[75] = computer.handlers;
8059
8067
  $[76] = t29;
8060
- } else t29 = $[76];
8061
- let t30;
8062
- if ($[77] !== computer.actions || $[78] !== t29) {
8063
- t30 = /* @__PURE__ */ jsx(ActionsContext, {
8068
+ $[77] = t30;
8069
+ } else t30 = $[77];
8070
+ let t31;
8071
+ if ($[78] !== computer.actions || $[79] !== t30) {
8072
+ t31 = /* @__PURE__ */ jsx(ActionsContext, {
8064
8073
  value: t10,
8065
- children: t29
8074
+ children: t30
8066
8075
  });
8067
- $[77] = computer.actions;
8068
- $[78] = t29;
8076
+ $[78] = computer.actions;
8069
8077
  $[79] = t30;
8070
- } else t30 = $[79];
8071
- let t31;
8072
- if ($[80] !== computer || $[81] !== t30) {
8073
- t31 = /* @__PURE__ */ jsx(ComputerContext, {
8078
+ $[80] = t31;
8079
+ } else t31 = $[80];
8080
+ let t32;
8081
+ if ($[81] !== computer || $[82] !== t31) {
8082
+ t32 = /* @__PURE__ */ jsx(ComputerContext, {
8074
8083
  value: computer,
8075
- children: t30
8084
+ children: t31
8076
8085
  });
8077
- $[80] = computer;
8078
- $[81] = t30;
8086
+ $[81] = computer;
8079
8087
  $[82] = t31;
8080
- } else t31 = $[82];
8081
- return t31;
8088
+ $[83] = t32;
8089
+ } else t32 = $[83];
8090
+ return t32;
8082
8091
  }
8083
8092
  //#endregion
8084
8093
  export { useAgentComputerWindow as a, useAgentComputerPortalContainer as i, useAgentComputerActions as n, useAgentComputerWindowActive as o, useAgentComputerAppHandlers as r, chordLabel as s, AgentComputer as t };
@@ -1,2 +1,2 @@
1
- import { a as useAgentComputerWindow, i as useAgentComputerPortalContainer, n as useAgentComputerActions, o as useAgentComputerWindowActive, r as useAgentComputerAppHandlers, t as AgentComputer } from "../../AgentComputer-2uYB8kmu.js";
1
+ import { a as useAgentComputerWindow, i as useAgentComputerPortalContainer, n as useAgentComputerActions, o as useAgentComputerWindowActive, r as useAgentComputerAppHandlers, t as AgentComputer } from "../../AgentComputer-BP9ixGGE.js";
2
2
  export { AgentComputer, useAgentComputerActions, useAgentComputerAppHandlers, useAgentComputerPortalContainer, useAgentComputerWindow, useAgentComputerWindowActive };
@@ -5,7 +5,7 @@ import { IconButton } from "../foundations/IconButton.js";
5
5
  import { AppIcon } from "../foundations/AppIcon.js";
6
6
  import { Tabs } from "../foundations/Tabs.js";
7
7
  import { AlertDialog } from "../foundations/AlertDialog.js";
8
- import { n as useAgentComputerActions } from "../../AgentComputer-2uYB8kmu.js";
8
+ import { n as useAgentComputerActions } from "../../AgentComputer-BP9ixGGE.js";
9
9
  import { Menubar } from "../foundations/Menubar.js";
10
10
  import { getThinkExecutionRunId } from "./ThinkExecutionRun.js";
11
11
  import { ThinkExecutionRunSummary } from "./ThinkExecutionStatus.js";
@@ -17,7 +17,7 @@ import { WorkspaceAutomationsPanel } from "./WorkspaceAutomation.js";
17
17
  import { LinkButton } from "../foundations/LinkButton.js";
18
18
  import { StatusScreen } from "../general-purpose/StatusScreen.js";
19
19
  import { n as useComputerAutomationsContext, r as zonedFormat, t as ComputerAutomationsContext } from "../../automations-host-DPORjdc7.js";
20
- import { n as computerAppTile, t as computerAppParts } from "../../parts-BxJC0QVb.js";
20
+ import { n as computerAppTile, t as computerAppParts } from "../../parts-RXV6GGdB.js";
21
21
  import { ThinkScheduleActions, useThinkScheduleActions } from "./ThinkScheduleActions.js";
22
22
  import { ThinkScheduleBrowser } from "./ThinkScheduleBrowser.js";
23
23
  import { ThinkScheduleDetail } from "./ThinkScheduleDetail.js";
@@ -2,7 +2,7 @@ import { Z as PlusIcon, g as ChevronRightIcon, gt as XIcon, h as ChevronLeftIcon
2
2
  import { Checkbox } from "../foundations/Checkbox.js";
3
3
  import { Button } from "../foundations/Button.js";
4
4
  import { IconButton } from "../foundations/IconButton.js";
5
- import { n as useAgentComputerActions } from "../../AgentComputer-2uYB8kmu.js";
5
+ import { n as useAgentComputerActions } from "../../AgentComputer-BP9ixGGE.js";
6
6
  import { Menubar } from "../foundations/Menubar.js";
7
7
  import { EmptyState } from "../foundations/EmptyState.js";
8
8
  import { DescriptionList } from "../foundations/DescriptionList.js";
@@ -11,7 +11,7 @@ import { AppTopBar } from "../general-purpose/AppTopBar.js";
11
11
  import { ResponsiveSidebarShell } from "../general-purpose/ResponsiveSidebarShell.js";
12
12
  import { LinkButton } from "../foundations/LinkButton.js";
13
13
  import { n as useComputerAutomationsContext, r as zonedFormat } from "../../automations-host-DPORjdc7.js";
14
- import { t as computerAppParts } from "../../parts-BxJC0QVb.js";
14
+ import { t as computerAppParts } from "../../parts-RXV6GGdB.js";
15
15
  import { SearchField } from "../foundations/SearchField.js";
16
16
  import { formatThinkScheduleTimeZone } from "./ThinkSchedule.js";
17
17
  import { Popover } from "../foundations/Popover.js";
@@ -0,0 +1,39 @@
1
+ import { t as WallpaperOption } from "../../WallpaperPicker-C-FItmDS.js";
2
+ import { ReactNode } from "react";
3
+ //#region src/components/agents-sdk/ComputerCustomWallpaper.d.ts
4
+ /** A person's own background image, prepared for bounded browser storage. */
5
+ export interface CustomWallpaper {
6
+ label: string;
7
+ dataUrl: string;
8
+ fit: "fill" | "fit";
9
+ x: number;
10
+ y: number;
11
+ }
12
+ /** The chosen background, and the person's own image if they added one. */
13
+ export interface ComputerWallpaper {
14
+ value: string;
15
+ custom: CustomWallpaper | null;
16
+ }
17
+ /** A saved background, or null when it names no wallpaper this desktop has. */
18
+ export declare function readWallpaper(value: unknown): ComputerWallpaper | null;
19
+ export interface UseComputerWallpaperOptions {
20
+ /** The saved choice; `readWallpaper` validates one from storage. */
21
+ wallpaper: ComputerWallpaper;
22
+ /** Saves a new choice, including the prepared image and its placement. */
23
+ onChange: (next: ComputerWallpaper) => void;
24
+ /** Where the choice is kept, under the controls. */
25
+ hint: ReactNode;
26
+ }
27
+ /** The desktop background with a person's own image: `AgentComputer`'s wallpaper and Settings' fields. */
28
+ export declare function useComputerWallpaper({ wallpaper, onChange, hint }: UseComputerWallpaperOptions): {
29
+ /** The background the computer shows, for `AgentComputer`'s `wallpaper`. */
30
+ selected: WallpaperOption;
31
+ /** ComputerSettings.Host's wallpaper fields. */
32
+ settings: {
33
+ wallpapers: readonly WallpaperOption[];
34
+ wallpaper: string;
35
+ onWallpaperChange: (next: string) => void;
36
+ display: import("react").JSX.Element;
37
+ };
38
+ };
39
+ //#endregion
@@ -0,0 +1,507 @@
1
+ import { Button } from "../foundations/Button.js";
2
+ import { COMPUTER_WALLPAPERS, DEFAULT_COMPUTER_WALLPAPER } from "./ComputerWallpapers.js";
3
+ import { Slider } from "../foundations/Slider.js";
4
+ import { Radio, RadioGroup } from "../foundations/RadioGroup.js";
5
+ import { c } from "react/compiler-runtime";
6
+ import { useEffect, useEffectEvent, useId, useRef, useState } from "react";
7
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
8
+ //#region src/components/agents-sdk/ComputerCustomWallpaper.tsx
9
+ const JPEG_PREFIX = "data:image/jpeg;base64,";
10
+ const MAX_IMAGE_BYTES = 10485760;
11
+ const MAX_STORED_IMAGE_LENGTH = 75e4;
12
+ function readCustomWallpaper(image) {
13
+ if (!image || typeof image !== "object" || !("label" in image && "dataUrl" in image && "fit" in image && "x" in image && "y" in image) || typeof image.label !== "string" || !image.label.trim() || image.label.length > 240 || typeof image.dataUrl !== "string" || image.dataUrl.length > MAX_STORED_IMAGE_LENGTH || !/^data:image\/jpeg;base64,[a-z0-9+/]+=*$/i.test(image.dataUrl) || image.fit !== "fill" && image.fit !== "fit" || ![image.x, image.y].every((position) => typeof position === "number" && Number.isFinite(position) && position >= 0 && position <= 100)) return null;
14
+ const header = atob(image.dataUrl.slice(23, 31));
15
+ if (header.charCodeAt(0) !== 255 || header.charCodeAt(1) !== 216 || header.charCodeAt(2) !== 255) return null;
16
+ const { label, dataUrl, fit } = image;
17
+ return {
18
+ label,
19
+ dataUrl,
20
+ fit,
21
+ x: image.x,
22
+ y: image.y
23
+ };
24
+ }
25
+ /** A saved background, or null when it names no wallpaper this desktop has. */
26
+ function readWallpaper(value) {
27
+ if (!value || typeof value !== "object" || !("value" in value) || !("custom" in value)) return null;
28
+ const custom = value.custom === null ? null : readCustomWallpaper(value.custom);
29
+ if (value.custom !== null && !custom) return null;
30
+ if (value.value === "custom" ? !custom : !COMPUTER_WALLPAPERS.some((w) => w.value === value.value)) return null;
31
+ return {
32
+ value: value.value,
33
+ custom
34
+ };
35
+ }
36
+ async function prepareWallpaper(file) {
37
+ if (!file.size || file.size > MAX_IMAGE_BYTES) throw new Error("Choose an image smaller than 10 MB.");
38
+ const bytes = new Uint8Array(await file.slice(0, 12).arrayBuffer());
39
+ const isPng = [
40
+ 137,
41
+ 80,
42
+ 78,
43
+ 71,
44
+ 13,
45
+ 10,
46
+ 26,
47
+ 10
48
+ ].every((byte, index) => bytes[index] === byte);
49
+ const isJpeg = bytes[0] === 255 && bytes[1] === 216 && bytes[2] === 255;
50
+ const isWebp = [
51
+ 82,
52
+ 73,
53
+ 70,
54
+ 70
55
+ ].every((byte, index) => bytes[index] === byte) && [
56
+ 87,
57
+ 69,
58
+ 66,
59
+ 80
60
+ ].every((byte, index) => bytes[index + 8] === byte);
61
+ if (!(file.type === "image/png" && isPng || file.type === "image/jpeg" && isJpeg || file.type === "image/webp" && isWebp)) throw new Error("Choose a PNG, JPEG, or WebP image.");
62
+ let bitmap;
63
+ try {
64
+ bitmap = await createImageBitmap(file);
65
+ } catch {
66
+ throw new Error("This image couldn’t be opened. Choose another image.");
67
+ }
68
+ try {
69
+ if (!bitmap.width || !bitmap.height || bitmap.width * bitmap.height > 4e7) throw new Error("Choose an image with fewer than 40 million pixels.");
70
+ const canvas = document.createElement("canvas");
71
+ const context = canvas.getContext("2d");
72
+ if (!context) throw new Error("Your browser couldn’t prepare this image.");
73
+ for (const edge of [
74
+ 1600,
75
+ 1200,
76
+ 800
77
+ ]) {
78
+ const scale = Math.min(1, edge / Math.max(bitmap.width, bitmap.height));
79
+ canvas.width = Math.max(1, Math.round(bitmap.width * scale));
80
+ canvas.height = Math.max(1, Math.round(bitmap.height * scale));
81
+ context.fillStyle = "#171c22";
82
+ context.fillRect(0, 0, canvas.width, canvas.height);
83
+ context.drawImage(bitmap, 0, 0, canvas.width, canvas.height);
84
+ const dataUrl = canvas.toDataURL("image/jpeg", .82);
85
+ if (dataUrl.startsWith(JPEG_PREFIX) && dataUrl.length <= MAX_STORED_IMAGE_LENGTH) return {
86
+ label: file.name.trim().slice(0, 240) || "Custom image",
87
+ dataUrl,
88
+ fit: "fill",
89
+ x: 50,
90
+ y: 50
91
+ };
92
+ }
93
+ throw new Error("This image is too detailed to save. Choose a smaller image.");
94
+ } finally {
95
+ bitmap.close();
96
+ }
97
+ }
98
+ function customOption(image) {
99
+ return {
100
+ value: "custom",
101
+ label: image.label,
102
+ background: `url("${image.dataUrl}") ${image.x}% ${image.y}% / ${image.fit === "fill" ? "cover" : "contain"} no-repeat #171c22`
103
+ };
104
+ }
105
+ /** The desktop background with a person's own image: `AgentComputer`'s wallpaper and Settings' fields. */
106
+ function useComputerWallpaper(t0) {
107
+ const $ = c(78);
108
+ const { wallpaper, onChange, hint } = t0;
109
+ const uploadButtonId = useId();
110
+ const uploadInput = useRef(null);
111
+ const helpId = useId();
112
+ const errorId = useId();
113
+ const uploadRevision = useRef(0);
114
+ const [uploading, setUploading] = useState(false);
115
+ const [uploadError, setUploadError] = useState("");
116
+ const { value, custom: saved } = wallpaper;
117
+ const [position, setPosition] = useState(null);
118
+ let t1;
119
+ if ($[0] !== position || $[1] !== saved) {
120
+ t1 = saved && position?.dataUrl === saved.dataUrl ? {
121
+ ...saved,
122
+ x: position.x ?? saved.x,
123
+ y: position.y ?? saved.y
124
+ } : saved;
125
+ $[0] = position;
126
+ $[1] = saved;
127
+ $[2] = t1;
128
+ } else t1 = $[2];
129
+ const custom = t1;
130
+ const customUrl = saved?.dataUrl;
131
+ let t2;
132
+ if ($[3] !== onChange || $[4] !== value) {
133
+ t2 = () => {
134
+ onChange({
135
+ value: value === "custom" ? DEFAULT_COMPUTER_WALLPAPER : value,
136
+ custom: null
137
+ });
138
+ setUploadError("The saved image couldn’t be opened. Choose a new image.");
139
+ };
140
+ $[3] = onChange;
141
+ $[4] = value;
142
+ $[5] = t2;
143
+ } else t2 = $[5];
144
+ const dropUnreadable = useEffectEvent(t2);
145
+ let t3;
146
+ if ($[6] !== customUrl || $[7] !== dropUnreadable) {
147
+ t3 = () => {
148
+ if (!customUrl) return;
149
+ let active = true;
150
+ const image = new Image();
151
+ image.src = customUrl;
152
+ image.decode().catch(() => {
153
+ if (!active) return;
154
+ dropUnreadable();
155
+ });
156
+ return () => {
157
+ active = false;
158
+ };
159
+ };
160
+ $[6] = customUrl;
161
+ $[7] = dropUnreadable;
162
+ $[8] = t3;
163
+ } else t3 = $[8];
164
+ let t4;
165
+ if ($[9] !== customUrl) {
166
+ t4 = [customUrl];
167
+ $[9] = customUrl;
168
+ $[10] = t4;
169
+ } else t4 = $[10];
170
+ useEffect(t3, t4);
171
+ let t5;
172
+ let t6;
173
+ if ($[11] === Symbol.for("react.memo_cache_sentinel")) {
174
+ t5 = () => () => {
175
+ uploadRevision.current = uploadRevision.current + 1;
176
+ };
177
+ t6 = [];
178
+ $[11] = t5;
179
+ $[12] = t6;
180
+ } else {
181
+ t5 = $[11];
182
+ t6 = $[12];
183
+ }
184
+ useEffect(t5, t6);
185
+ let t7;
186
+ let wallpapers;
187
+ if ($[13] !== custom || $[14] !== value) {
188
+ wallpapers = custom ? [...COMPUTER_WALLPAPERS, customOption(custom)] : COMPUTER_WALLPAPERS;
189
+ let t8;
190
+ if ($[17] !== value) {
191
+ t8 = (wallpaper_0) => wallpaper_0.value === value;
192
+ $[17] = value;
193
+ $[18] = t8;
194
+ } else t8 = $[18];
195
+ t7 = wallpapers.find(t8);
196
+ $[13] = custom;
197
+ $[14] = value;
198
+ $[15] = t7;
199
+ $[16] = wallpapers;
200
+ } else {
201
+ t7 = $[15];
202
+ wallpapers = $[16];
203
+ }
204
+ const selected = t7;
205
+ let t8;
206
+ if ($[19] !== onChange) {
207
+ t8 = function save(next, image_0) {
208
+ setPosition(null);
209
+ onChange({
210
+ value: next,
211
+ custom: image_0
212
+ });
213
+ };
214
+ $[19] = onChange;
215
+ $[20] = t8;
216
+ } else t8 = $[20];
217
+ const save = t8;
218
+ let t9;
219
+ if ($[21] !== save || $[22] !== saved || $[23] !== wallpapers) {
220
+ t9 = function select(next_0) {
221
+ if (!wallpapers.some((wallpaper_1) => wallpaper_1.value === next_0)) return;
222
+ uploadRevision.current = uploadRevision.current + 1;
223
+ setUploading(false);
224
+ save(next_0, saved);
225
+ };
226
+ $[21] = save;
227
+ $[22] = saved;
228
+ $[23] = wallpapers;
229
+ $[24] = t9;
230
+ } else t9 = $[24];
231
+ const select = t9;
232
+ let t10;
233
+ if ($[25] !== save || $[26] !== saved) {
234
+ t10 = function updateCustom(patch, t11) {
235
+ const persist = t11 === void 0 ? true : t11;
236
+ if (!saved) return;
237
+ if (persist) save("custom", {
238
+ ...saved,
239
+ ...patch
240
+ });
241
+ else setPosition((current) => ({
242
+ ...current,
243
+ ...patch,
244
+ dataUrl: saved.dataUrl
245
+ }));
246
+ };
247
+ $[25] = save;
248
+ $[26] = saved;
249
+ $[27] = t10;
250
+ } else t10 = $[27];
251
+ const updateCustom = t10;
252
+ let t11;
253
+ if ($[28] !== save) {
254
+ t11 = async function upload(file) {
255
+ const revision = uploadRevision.current = uploadRevision.current + 1;
256
+ setUploading(true);
257
+ setUploadError("");
258
+ const prepared = await prepareWallpaper(file).then(_temp, _temp2);
259
+ if (revision !== uploadRevision.current) return;
260
+ if ("image" in prepared) save("custom", prepared.image);
261
+ else setUploadError(prepared.error instanceof Error ? prepared.error.message : "This image couldn’t be opened.");
262
+ setUploading(false);
263
+ };
264
+ $[28] = save;
265
+ $[29] = t11;
266
+ } else t11 = $[29];
267
+ const upload = t11;
268
+ const t12 = `${helpId}${uploadError ? ` ${errorId}` : ""}`;
269
+ let t13;
270
+ if ($[30] === Symbol.for("react.memo_cache_sentinel")) {
271
+ t13 = () => uploadInput.current?.click();
272
+ $[30] = t13;
273
+ } else t13 = $[30];
274
+ let t14;
275
+ if ($[31] !== t12 || $[32] !== uploadButtonId || $[33] !== uploading) {
276
+ t14 = /* @__PURE__ */ jsx(Button, {
277
+ id: uploadButtonId,
278
+ size: "xs",
279
+ variant: "surface",
280
+ color: "neutral",
281
+ disabled: uploading,
282
+ "aria-describedby": t12,
283
+ onClick: t13,
284
+ children: "Use your own image…"
285
+ });
286
+ $[31] = t12;
287
+ $[32] = uploadButtonId;
288
+ $[33] = uploading;
289
+ $[34] = t14;
290
+ } else t14 = $[34];
291
+ let t15;
292
+ if ($[35] !== uploading) {
293
+ t15 = uploading ? /* @__PURE__ */ jsx("p", {
294
+ role: "status",
295
+ children: "Preparing background…"
296
+ }) : null;
297
+ $[35] = uploading;
298
+ $[36] = t15;
299
+ } else t15 = $[36];
300
+ let t16;
301
+ if ($[37] !== errorId || $[38] !== uploadError) {
302
+ t16 = uploadError ? /* @__PURE__ */ jsx("p", {
303
+ id: errorId,
304
+ role: "alert",
305
+ children: uploadError
306
+ }) : null;
307
+ $[37] = errorId;
308
+ $[38] = uploadError;
309
+ $[39] = t16;
310
+ } else t16 = $[39];
311
+ let t17;
312
+ if ($[40] !== t14 || $[41] !== t15 || $[42] !== t16) {
313
+ t17 = /* @__PURE__ */ jsxs(Fragment, { children: [
314
+ t14,
315
+ t15,
316
+ t16
317
+ ] });
318
+ $[40] = t14;
319
+ $[41] = t15;
320
+ $[42] = t16;
321
+ $[43] = t17;
322
+ } else t17 = $[43];
323
+ const uploadControls = t17;
324
+ const t18 = Boolean(uploadError);
325
+ const t19 = `${helpId}${uploadError ? ` ${errorId}` : ""}`;
326
+ let t20;
327
+ if ($[44] !== upload) {
328
+ t20 = (event) => {
329
+ const file_0 = event.currentTarget.files?.[0];
330
+ event.currentTarget.value = "";
331
+ if (file_0) upload(file_0);
332
+ };
333
+ $[44] = upload;
334
+ $[45] = t20;
335
+ } else t20 = $[45];
336
+ let t21;
337
+ if ($[46] !== t18 || $[47] !== t19 || $[48] !== t20 || $[49] !== uploadButtonId || $[50] !== uploading) {
338
+ t21 = /* @__PURE__ */ jsx("input", {
339
+ ref: uploadInput,
340
+ hidden: true,
341
+ "aria-labelledby": uploadButtonId,
342
+ type: "file",
343
+ accept: "image/png,image/jpeg,image/webp",
344
+ disabled: uploading,
345
+ "aria-invalid": t18,
346
+ "aria-describedby": t19,
347
+ onChange: t20
348
+ });
349
+ $[46] = t18;
350
+ $[47] = t19;
351
+ $[48] = t20;
352
+ $[49] = uploadButtonId;
353
+ $[50] = uploading;
354
+ $[51] = t21;
355
+ } else t21 = $[51];
356
+ let t22;
357
+ if ($[52] !== helpId) {
358
+ t22 = /* @__PURE__ */ jsx("p", {
359
+ id: helpId,
360
+ className: "sigvelo-visually-hidden",
361
+ children: "PNG, JPEG, or WebP, up to 10 MB. Images are dimmed to keep desktop labels readable."
362
+ });
363
+ $[52] = helpId;
364
+ $[53] = t22;
365
+ } else t22 = $[53];
366
+ let t23;
367
+ if ($[54] !== custom || $[55] !== save || $[56] !== updateCustom || $[57] !== uploadButtonId || $[58] !== value) {
368
+ t23 = custom ? /* @__PURE__ */ jsxs("section", {
369
+ className: "computer-wallpapers__custom",
370
+ "aria-label": "Custom background",
371
+ children: [value === "custom" ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs(RadioGroup.Root, {
372
+ className: "computer-wallpapers__placement",
373
+ value: custom.fit,
374
+ onValueChange: (fit) => {
375
+ if (fit === "fill" || fit === "fit") updateCustom({ fit });
376
+ },
377
+ "aria-label": "Image placement",
378
+ children: [/* @__PURE__ */ jsxs("label", {
379
+ className: "computer-wallpapers__choice",
380
+ children: [/* @__PURE__ */ jsx(Radio.Root, {
381
+ value: "fill",
382
+ children: /* @__PURE__ */ jsx(Radio.Indicator, {})
383
+ }), "Fill the screen (crop edges)"]
384
+ }), /* @__PURE__ */ jsxs("label", {
385
+ className: "computer-wallpapers__choice",
386
+ children: [/* @__PURE__ */ jsx(Radio.Root, {
387
+ value: "fit",
388
+ children: /* @__PURE__ */ jsx(Radio.Indicator, {})
389
+ }), "Fit the entire image"]
390
+ })]
391
+ }), /* @__PURE__ */ jsx("div", {
392
+ className: "computer-wallpapers__crop",
393
+ children: ["x", "y"].map((axis) => /* @__PURE__ */ jsxs(Slider.Root, {
394
+ value: custom[axis],
395
+ min: 0,
396
+ max: 100,
397
+ step: 1,
398
+ onValueChange: (position_0) => updateCustom({ [axis]: position_0 }, false),
399
+ onValueCommitted: (position_1) => updateCustom({ [axis]: position_1 }),
400
+ children: [/* @__PURE__ */ jsxs("div", {
401
+ className: "computer-wallpapers__crop-label",
402
+ children: [/* @__PURE__ */ jsx(Slider.Label, { children: axis === "x" ? "Horizontal position" : "Vertical position" }), /* @__PURE__ */ jsxs("span", { children: [custom[axis], "%"] })]
403
+ }), /* @__PURE__ */ jsx(Slider.Control, {
404
+ className: "computer-wallpapers__crop-control",
405
+ children: /* @__PURE__ */ jsxs(Slider.Track, { children: [/* @__PURE__ */ jsx(Slider.Indicator, {}), /* @__PURE__ */ jsx(Slider.Thumb, {})] })
406
+ })]
407
+ }, axis))
408
+ })] }) : null, /* @__PURE__ */ jsxs("div", {
409
+ className: "computer-wallpapers__actions",
410
+ children: [value === "custom" ? /* @__PURE__ */ jsx(Button, {
411
+ variant: "surface",
412
+ color: "neutral",
413
+ onClick: () => updateCustom({
414
+ x: 50,
415
+ y: 50
416
+ }),
417
+ children: "Center image"
418
+ }) : null, /* @__PURE__ */ jsx(Button, {
419
+ variant: "surface",
420
+ color: "neutral",
421
+ onClick: () => {
422
+ uploadRevision.current = uploadRevision.current + 1;
423
+ setUploading(false);
424
+ setUploadError("");
425
+ save(DEFAULT_COMPUTER_WALLPAPER, null);
426
+ requestAnimationFrame(() => uploadInput.current?.ownerDocument.getElementById(uploadButtonId)?.focus());
427
+ },
428
+ children: "Remove custom image"
429
+ })]
430
+ })]
431
+ }) : null;
432
+ $[54] = custom;
433
+ $[55] = save;
434
+ $[56] = updateCustom;
435
+ $[57] = uploadButtonId;
436
+ $[58] = value;
437
+ $[59] = t23;
438
+ } else t23 = $[59];
439
+ let t24;
440
+ if ($[60] !== hint) {
441
+ t24 = /* @__PURE__ */ jsx("p", {
442
+ className: "computer-wallpapers__hint",
443
+ role: "status",
444
+ children: hint
445
+ });
446
+ $[60] = hint;
447
+ $[61] = t24;
448
+ } else t24 = $[61];
449
+ let t25;
450
+ if ($[62] !== t21 || $[63] !== t22 || $[64] !== t23 || $[65] !== t24) {
451
+ t25 = /* @__PURE__ */ jsxs(Fragment, { children: [
452
+ t21,
453
+ t22,
454
+ t23,
455
+ t24
456
+ ] });
457
+ $[62] = t21;
458
+ $[63] = t22;
459
+ $[64] = t23;
460
+ $[65] = t24;
461
+ $[66] = t25;
462
+ } else t25 = $[66];
463
+ const details = t25;
464
+ let t26;
465
+ if ($[67] !== details || $[68] !== uploadControls) {
466
+ t26 = /* @__PURE__ */ jsxs("div", {
467
+ className: "computer-wallpapers__controls",
468
+ children: [uploadControls, details]
469
+ });
470
+ $[67] = details;
471
+ $[68] = uploadControls;
472
+ $[69] = t26;
473
+ } else t26 = $[69];
474
+ let t27;
475
+ if ($[70] !== select || $[71] !== t26 || $[72] !== value || $[73] !== wallpapers) {
476
+ t27 = {
477
+ wallpapers,
478
+ wallpaper: value,
479
+ onWallpaperChange: select,
480
+ display: t26
481
+ };
482
+ $[70] = select;
483
+ $[71] = t26;
484
+ $[72] = value;
485
+ $[73] = wallpapers;
486
+ $[74] = t27;
487
+ } else t27 = $[74];
488
+ let t28;
489
+ if ($[75] !== selected || $[76] !== t27) {
490
+ t28 = {
491
+ selected,
492
+ settings: t27
493
+ };
494
+ $[75] = selected;
495
+ $[76] = t27;
496
+ $[77] = t28;
497
+ } else t28 = $[77];
498
+ return t28;
499
+ }
500
+ function _temp2(error) {
501
+ return { error };
502
+ }
503
+ function _temp(image_1) {
504
+ return { image: image_1 };
505
+ }
506
+ //#endregion
507
+ export { readWallpaper, useComputerWallpaper };
@@ -0,0 +1,15 @@
1
+ import { y as WorkspaceSource } from "../../Workspace-B9nuTfIi.js";
2
+ import { FileInfo } from "@cloudflare/shell";
3
+ //#region src/components/agents-sdk/ComputerFileThumbnail.d.ts
4
+ export interface ComputerFileThumbnailProps {
5
+ entry: FileInfo;
6
+ source: WorkspaceSource;
7
+ sourceKey: string;
8
+ }
9
+ /**
10
+ * A desktop or Finder thumbnail drawn from the file itself, the way Finder
11
+ * draws one: an SVG shows as the image, a text file as a page of its text.
12
+ * Other files draw nothing and keep their type's icon.
13
+ */
14
+ export declare function ComputerFileThumbnail({ entry, source, sourceKey }: ComputerFileThumbnailProps): import("react").JSX.Element | null;
15
+ //#endregion
@@ -0,0 +1,133 @@
1
+ import { workspaceFileQueryKey } from "./Workspace.js";
2
+ import { c } from "react/compiler-runtime";
3
+ import { jsx, jsxs } from "react/jsx-runtime";
4
+ import { useQuery } from "@tanstack/react-query";
5
+ //#region src/components/agents-sdk/ComputerFileThumbnail.tsx
6
+ /** Files small enough to read for a decoration: an SVG as the image, a text file as its page. */
7
+ const MAX_SVG_BYTES = 1048576;
8
+ const MAX_TEXT_BYTES = 65536;
9
+ const PAGE_CHARACTERS = 2048;
10
+ function thumbnailKind(entry) {
11
+ if (entry.type !== "file") return null;
12
+ if (entry.mimeType === "image/svg+xml") return entry.size <= MAX_SVG_BYTES ? "svg" : null;
13
+ return (entry.mimeType.startsWith("text/") || entry.mimeType === "application/json" || entry.mimeType === "application/javascript") && entry.size <= MAX_TEXT_BYTES ? "text" : null;
14
+ }
15
+ /**
16
+ * A desktop or Finder thumbnail drawn from the file itself, the way Finder
17
+ * draws one: an SVG shows as the image, a text file as a page of its text.
18
+ * Other files draw nothing and keep their type's icon.
19
+ */
20
+ function ComputerFileThumbnail(t0) {
21
+ const $ = c(29);
22
+ const { entry, source, sourceKey } = t0;
23
+ let t1;
24
+ if ($[0] !== entry) {
25
+ t1 = thumbnailKind(entry);
26
+ $[0] = entry;
27
+ $[1] = t1;
28
+ } else t1 = $[1];
29
+ const kind = t1;
30
+ let t2;
31
+ if ($[2] !== entry.path || $[3] !== entry.size || $[4] !== entry.updatedAt || $[5] !== sourceKey) {
32
+ t2 = [
33
+ ...workspaceFileQueryKey(sourceKey, "/", entry.path),
34
+ "thumbnail",
35
+ entry.updatedAt,
36
+ entry.size
37
+ ];
38
+ $[2] = entry.path;
39
+ $[3] = entry.size;
40
+ $[4] = entry.updatedAt;
41
+ $[5] = sourceKey;
42
+ $[6] = t2;
43
+ } else t2 = $[6];
44
+ let t3;
45
+ if ($[7] !== entry.path || $[8] !== source) {
46
+ t3 = () => source.readFile(entry.path);
47
+ $[7] = entry.path;
48
+ $[8] = source;
49
+ $[9] = t3;
50
+ } else t3 = $[9];
51
+ const t4 = kind !== null;
52
+ let t5;
53
+ if ($[10] !== t2 || $[11] !== t3 || $[12] !== t4) {
54
+ t5 = {
55
+ queryKey: t2,
56
+ queryFn: t3,
57
+ enabled: t4,
58
+ staleTime: Infinity,
59
+ retry: false
60
+ };
61
+ $[10] = t2;
62
+ $[11] = t3;
63
+ $[12] = t4;
64
+ $[13] = t5;
65
+ } else t5 = $[13];
66
+ const content = useQuery(t5).data;
67
+ if (!kind || !content) return null;
68
+ if (kind === "svg") {
69
+ const t6 = `data:image/svg+xml,${encodeURIComponent(content)}`;
70
+ let t7;
71
+ if ($[14] !== t6) {
72
+ t7 = /* @__PURE__ */ jsx("img", {
73
+ src: t6,
74
+ alt: "",
75
+ width: "64",
76
+ height: "64"
77
+ });
78
+ $[14] = t6;
79
+ $[15] = t7;
80
+ } else t7 = $[15];
81
+ return t7;
82
+ }
83
+ let lines;
84
+ let t6;
85
+ let t7;
86
+ if ($[16] !== content) {
87
+ const [t8, ...t9] = content.slice(0, PAGE_CHARACTERS).split("\n");
88
+ lines = t9;
89
+ const title = t8 === void 0 ? "" : t8;
90
+ t7 = "computer-file-thumbnail";
91
+ let t10;
92
+ if ($[20] === Symbol.for("react.memo_cache_sentinel")) {
93
+ t10 = /^# /;
94
+ $[20] = t10;
95
+ } else t10 = $[20];
96
+ t6 = title.replace(t10, "");
97
+ $[16] = content;
98
+ $[17] = lines;
99
+ $[18] = t6;
100
+ $[19] = t7;
101
+ } else {
102
+ lines = $[17];
103
+ t6 = $[18];
104
+ t7 = $[19];
105
+ }
106
+ let t8;
107
+ if ($[21] !== t6) {
108
+ t8 = /* @__PURE__ */ jsx("strong", { children: t6 });
109
+ $[21] = t6;
110
+ $[22] = t8;
111
+ } else t8 = $[22];
112
+ const t9 = lines.join("\n");
113
+ let t10;
114
+ if ($[23] !== t9) {
115
+ t10 = /* @__PURE__ */ jsx("span", { children: t9 });
116
+ $[23] = t9;
117
+ $[24] = t10;
118
+ } else t10 = $[24];
119
+ let t11;
120
+ if ($[25] !== t10 || $[26] !== t7 || $[27] !== t8) {
121
+ t11 = /* @__PURE__ */ jsxs("span", {
122
+ className: t7,
123
+ children: [t8, t10]
124
+ });
125
+ $[25] = t10;
126
+ $[26] = t7;
127
+ $[27] = t8;
128
+ $[28] = t11;
129
+ } else t11 = $[28];
130
+ return t11;
131
+ }
132
+ //#endregion
133
+ export { ComputerFileThumbnail };
@@ -10,11 +10,11 @@ import { Menu } from "../foundations/Menu.js";
10
10
  import { a as workspaceDirname, i as workspaceBasename } from "../../workspace-path-TZggP-u4.js";
11
11
  import { downloadWorkspaceFile, saveWorkspaceFileAs } from "./WorkspaceFileTransfer.js";
12
12
  import { r as useWorkspaceDragAndDrop } from "../../workspace-drag-B6hMXUNt.js";
13
- import { a as useAgentComputerWindow, r as useAgentComputerAppHandlers } from "../../AgentComputer-2uYB8kmu.js";
13
+ import { a as useAgentComputerWindow, r as useAgentComputerAppHandlers } from "../../AgentComputer-BP9ixGGE.js";
14
14
  import { Menubar } from "../foundations/Menubar.js";
15
15
  import { EmptyState } from "../foundations/EmptyState.js";
16
16
  import { AppTopBar } from "../general-purpose/AppTopBar.js";
17
- import { n as computerAppTile } from "../../parts-BxJC0QVb.js";
17
+ import { n as computerAppTile } from "../../parts-RXV6GGdB.js";
18
18
  import { SearchField } from "../foundations/SearchField.js";
19
19
  import { ToggleGroup } from "../foundations/ToggleGroup.js";
20
20
  import { useWorkspace, workspaceInfoQueryKey } from "./Workspace.js";
@@ -1,7 +1,7 @@
1
1
  import { tt as SearchIcon } from "../../icons-nLTnB9kd.js";
2
2
  import { Button } from "../foundations/Button.js";
3
3
  import { AppIcon } from "../foundations/AppIcon.js";
4
- import { n as useAgentComputerActions } from "../../AgentComputer-2uYB8kmu.js";
4
+ import { n as useAgentComputerActions } from "../../AgentComputer-BP9ixGGE.js";
5
5
  import { c } from "react/compiler-runtime";
6
6
  import { jsx, jsxs } from "react/jsx-runtime";
7
7
  //#region src/components/agents-sdk/ComputerHome.tsx
@@ -2,7 +2,7 @@ import { W as MonitorIcon, c as BellIcon, g as ChevronRightIcon, p as CheckIcon
2
2
  import { Button } from "../foundations/Button.js";
3
3
  import { IconButton } from "../foundations/IconButton.js";
4
4
  import { AppIcon } from "../foundations/AppIcon.js";
5
- import { i as useAgentComputerPortalContainer } from "../../AgentComputer-2uYB8kmu.js";
5
+ import { i as useAgentComputerPortalContainer } from "../../AgentComputer-BP9ixGGE.js";
6
6
  import { Popover } from "../foundations/Popover.js";
7
7
  import { Toast } from "../foundations/Toast.js";
8
8
  import { c } from "react/compiler-runtime";
@@ -1,13 +1,13 @@
1
1
  import { V as MessageSquareIcon, W as MonitorIcon, _ as ChromeIcon, i as ArrowRightIcon, m as ChevronDownIcon, r as ArrowLeftIcon } from "../../icons-nLTnB9kd.js";
2
2
  import { Button } from "../foundations/Button.js";
3
3
  import { IconButton } from "../foundations/IconButton.js";
4
- import { a as useAgentComputerWindow, n as useAgentComputerActions, o as useAgentComputerWindowActive } from "../../AgentComputer-2uYB8kmu.js";
4
+ import { a as useAgentComputerWindow, n as useAgentComputerActions, o as useAgentComputerWindowActive } from "../../AgentComputer-BP9ixGGE.js";
5
5
  import { Menubar } from "../foundations/Menubar.js";
6
6
  import { FormattedDate } from "../foundations/FormattedDate.js";
7
7
  import { AgentScreenSwitcher } from "./AgentScreenSwitcher.js";
8
8
  import { WebPreviewNavigationButton } from "../general-purpose/WebPreview.js";
9
9
  import { BrowserProfileMenu, BrowserRunPanel, BrowserTabStrip } from "./BrowserRunPanel.js";
10
- import { n as computerAppTile } from "../../parts-BxJC0QVb.js";
10
+ import { n as computerAppTile } from "../../parts-RXV6GGdB.js";
11
11
  import { c } from "react/compiler-runtime";
12
12
  import * as React from "react";
13
13
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
@@ -5,9 +5,9 @@ import { Button } from "../foundations/Button.js";
5
5
  import { IconButton } from "../foundations/IconButton.js";
6
6
  import { AppIcon } from "../foundations/AppIcon.js";
7
7
  import { Tabs } from "../foundations/Tabs.js";
8
- import { a as useAgentComputerWindow, n as useAgentComputerActions, s as chordLabel } from "../../AgentComputer-2uYB8kmu.js";
8
+ import { a as useAgentComputerWindow, n as useAgentComputerActions, s as chordLabel } from "../../AgentComputer-BP9ixGGE.js";
9
9
  import { AppTopBar } from "../general-purpose/AppTopBar.js";
10
- import { n as computerAppTile } from "../../parts-BxJC0QVb.js";
10
+ import { n as computerAppTile } from "../../parts-RXV6GGdB.js";
11
11
  import { Switch } from "../foundations/Switch.js";
12
12
  import { ScreenStack } from "../general-purpose/ScreenStack.js";
13
13
  import { ThemeModeControl } from "../general-purpose/ThemeModeControl.js";
@@ -2,7 +2,7 @@ import { tt as SearchIcon } from "../../icons-nLTnB9kd.js";
2
2
  import { Button } from "../foundations/Button.js";
3
3
  import { IconButton } from "../foundations/IconButton.js";
4
4
  import { AppIcon } from "../foundations/AppIcon.js";
5
- import { i as useAgentComputerPortalContainer, n as useAgentComputerActions } from "../../AgentComputer-2uYB8kmu.js";
5
+ import { i as useAgentComputerPortalContainer, n as useAgentComputerActions } from "../../AgentComputer-BP9ixGGE.js";
6
6
  import { CommandPalette } from "../general-purpose/CommandPalette.js";
7
7
  import { c } from "react/compiler-runtime";
8
8
  import * as React from "react";
@@ -1,4 +1,4 @@
1
- import { a as useAgentComputerWindow, r as useAgentComputerAppHandlers } from "./AgentComputer-2uYB8kmu.js";
1
+ import { a as useAgentComputerWindow, r as useAgentComputerAppHandlers } from "./AgentComputer-BP9ixGGE.js";
2
2
  import { c } from "react/compiler-runtime";
3
3
  import * as React from "react";
4
4
  import { jsx } from "react/jsx-runtime";
@@ -403,6 +403,13 @@
403
403
  .agent-computer:not([data-home]) .agent-computer__home {
404
404
  visibility: hidden;
405
405
  }
406
+ /* A wide computer with a desktop shows its files where Home's grid would be;
407
+ the phone keeps Home. */
408
+ @container agent-computer (inline-size > 48rem) {
409
+ .agent-computer[data-desktop] .agent-computer__home {
410
+ display: none;
411
+ }
412
+ }
406
413
  /* Minimizing or closing the last window leaves the desktop with no active app,
407
414
  which is the same state as showing Home — but a window parked in the Dock is
408
415
  on the Dock, not on the desktop, and one that is still seeing itself out has
@@ -564,3 +564,34 @@
564
564
  line-height: var(--sigvelo-leading-loose);
565
565
  color: var(--sigvelo-color-text-muted);
566
566
  }
567
+
568
+ /* A desktop icon's thumbnail: a picture of a document, not a document. Every
569
+ length here is off the ramp on purpose — a 4px body and a 50x64 page are a
570
+ drawing of a text file at icon scale, the way Finder draws one, and there is
571
+ no step on the type scale below 11px to draw it with. The colours are the
572
+ theme's, so it still turns with the appearance. */
573
+ .computer-file-thumbnail {
574
+ display: flex;
575
+ flex-direction: column;
576
+ gap: var(--sigvelo-spacing-1);
577
+ inline-size: 50px;
578
+ block-size: 64px;
579
+ padding: 8px 6px;
580
+ overflow: hidden;
581
+ background: var(--sigvelo-color-surface-raised);
582
+ color: var(--sigvelo-color-text);
583
+ border-radius: var(--sigvelo-radius-sm);
584
+ box-shadow: var(--sigvelo-elevation-raised);
585
+ /* A page drawn at 40% of the smallest text: 4px. */
586
+ font-size: calc(var(--sigvelo-text-3xs) * 0.4);
587
+ line-height: var(--sigvelo-leading-normal);
588
+ text-align: start;
589
+ white-space: pre-wrap;
590
+ }
591
+ .computer-file-thumbnail strong {
592
+ font-size: 1.5em;
593
+ }
594
+ /* A row draws the desktop's page thumbnail at row scale, as Finder's list does. */
595
+ .computer-finder .workspace-browser__entries[data-layout="list"] .computer-file-thumbnail {
596
+ zoom: 0.3;
597
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mcp-b/react-components",
3
- "version": "0.66.0",
3
+ "version": "0.68.0",
4
4
  "description": "MCP-B React components built on Base UI and shared design tokens, including Cloudflare Think chat primitives.",
5
5
  "homepage": "https://design-system.sigvelo.com",
6
6
  "bugs": {
@@ -55,7 +55,7 @@
55
55
  "streamdown": "^2.7.0",
56
56
  "unist-util-visit": "^5.1.0",
57
57
  "yet-another-react-lightbox": "^3.32.2",
58
- "@mcp-b/design-tokens": "0.66.0"
58
+ "@mcp-b/design-tokens": "0.68.0"
59
59
  },
60
60
  "devDependencies": {
61
61
  "@ai-sdk/react": "^4.0.136",