replicas-cli 0.3.562 → 0.3.565

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.
Files changed (2) hide show
  1. package/dist/index.cjs +273 -156
  2. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -263,7 +263,7 @@ var init_urls = __esm({
263
263
  WEB_APP_PATHS.automations,
264
264
  `${WEB_APP_PATHS.automations}/${UUID_PATTERN}`
265
265
  ];
266
- APP_LINK_PATTERNS = APP_LINK_PATHS.map((path12) => new RegExp(`^${path12.replace(/[.+^${}()|[\]\\]/g, "\\$&").replace(/\?/g, ".").replace(/\*/g, ".*")}$`));
266
+ APP_LINK_PATTERNS = APP_LINK_PATHS.map((path13) => new RegExp(`^${path13.replace(/[.+^${}()|[\]\\]/g, "\\$&").replace(/\?/g, ".").replace(/\*/g, ".*")}$`));
267
267
  LEGACY_WEB_APP_PATHS = {
268
268
  app: "/app",
269
269
  home: "/home",
@@ -657,10 +657,10 @@ function mergeDefs(...defs) {
657
657
  function cloneDef(schema) {
658
658
  return mergeDefs(schema._zod.def);
659
659
  }
660
- function getElementAtPath(obj, path12) {
661
- if (!path12)
660
+ function getElementAtPath(obj, path13) {
661
+ if (!path13)
662
662
  return obj;
663
- return path12.reduce((acc, key) => acc?.[key], obj);
663
+ return path13.reduce((acc, key) => acc?.[key], obj);
664
664
  }
665
665
  function promiseAllObject(promisesObj) {
666
666
  const keys = Object.keys(promisesObj);
@@ -919,11 +919,11 @@ function explicitlyAborted(x, startIndex = 0) {
919
919
  }
920
920
  return false;
921
921
  }
922
- function prefixIssues(path12, issues) {
922
+ function prefixIssues(path13, issues) {
923
923
  return issues.map((iss) => {
924
924
  var _a3;
925
925
  (_a3 = iss).path ?? (_a3.path = []);
926
- iss.path.unshift(path12);
926
+ iss.path.unshift(path13);
927
927
  return iss;
928
928
  });
929
929
  }
@@ -1458,16 +1458,16 @@ function flattenError(error62, mapper = (issue3) => issue3.message) {
1458
1458
  }
1459
1459
  function formatError(error62, mapper = (issue3) => issue3.message) {
1460
1460
  const fieldErrors = { _errors: [] };
1461
- const processError = (error63, path12 = []) => {
1461
+ const processError = (error63, path13 = []) => {
1462
1462
  for (const issue3 of error63.issues) {
1463
1463
  if (issue3.code === "invalid_union" && issue3.errors.length) {
1464
- issue3.errors.map((issues) => processError({ issues }, [...path12, ...issue3.path]));
1464
+ issue3.errors.map((issues) => processError({ issues }, [...path13, ...issue3.path]));
1465
1465
  } else if (issue3.code === "invalid_key") {
1466
- processError({ issues: issue3.issues }, [...path12, ...issue3.path]);
1466
+ processError({ issues: issue3.issues }, [...path13, ...issue3.path]);
1467
1467
  } else if (issue3.code === "invalid_element") {
1468
- processError({ issues: issue3.issues }, [...path12, ...issue3.path]);
1468
+ processError({ issues: issue3.issues }, [...path13, ...issue3.path]);
1469
1469
  } else {
1470
- const fullpath = [...path12, ...issue3.path];
1470
+ const fullpath = [...path13, ...issue3.path];
1471
1471
  if (fullpath.length === 0) {
1472
1472
  fieldErrors._errors.push(mapper(issue3));
1473
1473
  } else {
@@ -1506,17 +1506,17 @@ function formatError(error62, mapper = (issue3) => issue3.message) {
1506
1506
  }
1507
1507
  function treeifyError(error62, mapper = (issue3) => issue3.message) {
1508
1508
  const result = { errors: [] };
1509
- const processError = (error63, path12 = []) => {
1509
+ const processError = (error63, path13 = []) => {
1510
1510
  var _a3;
1511
1511
  for (const issue3 of error63.issues) {
1512
1512
  if (issue3.code === "invalid_union" && issue3.errors.length) {
1513
- issue3.errors.map((issues) => processError({ issues }, [...path12, ...issue3.path]));
1513
+ issue3.errors.map((issues) => processError({ issues }, [...path13, ...issue3.path]));
1514
1514
  } else if (issue3.code === "invalid_key") {
1515
- processError({ issues: issue3.issues }, [...path12, ...issue3.path]);
1515
+ processError({ issues: issue3.issues }, [...path13, ...issue3.path]);
1516
1516
  } else if (issue3.code === "invalid_element") {
1517
- processError({ issues: issue3.issues }, [...path12, ...issue3.path]);
1517
+ processError({ issues: issue3.issues }, [...path13, ...issue3.path]);
1518
1518
  } else {
1519
- const fullpath = [...path12, ...issue3.path];
1519
+ const fullpath = [...path13, ...issue3.path];
1520
1520
  if (fullpath.length === 0) {
1521
1521
  result.errors.push(mapper(issue3));
1522
1522
  continue;
@@ -1555,8 +1555,8 @@ function treeifyError(error62, mapper = (issue3) => issue3.message) {
1555
1555
  }
1556
1556
  function toDotPath(_path) {
1557
1557
  const segs = [];
1558
- const path12 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
1559
- for (const seg of path12) {
1558
+ const path13 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
1559
+ for (const seg of path13) {
1560
1560
  if (typeof seg === "number")
1561
1561
  segs.push(`[${seg}]`);
1562
1562
  else if (typeof seg === "symbol")
@@ -19674,13 +19674,13 @@ function resolveRef(ref, ctx) {
19674
19674
  if (!ref.startsWith("#")) {
19675
19675
  throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
19676
19676
  }
19677
- const path12 = ref.slice(1).split("/").filter(Boolean);
19678
- if (path12.length === 0) {
19677
+ const path13 = ref.slice(1).split("/").filter(Boolean);
19678
+ if (path13.length === 0) {
19679
19679
  return ctx.rootSchema;
19680
19680
  }
19681
19681
  const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
19682
- if (path12[0] === defsKey) {
19683
- const key = path12[1] === void 0 ? void 0 : decodeJSONPointerSegment(path12[1]);
19682
+ if (path13[0] === defsKey) {
19683
+ const key = path13[1] === void 0 ? void 0 : decodeJSONPointerSegment(path13[1]);
19684
19684
  if (!key || !ctx.defs[key]) {
19685
19685
  throw new Error(`Reference not found: ${ref}`);
19686
19686
  }
@@ -21481,7 +21481,7 @@ function designColors({ mode, palette, accent, custom: custom2 }) {
21481
21481
  const colors = { ...DESIGN_COLORS[mode], ...paletteColors, ...accent === "custom" ? customAccent(custom2.accent, paletteColors) : ACCENT_COLORS[accent][mode] };
21482
21482
  return resolved === "custom" ? { ...colors, ...Object.fromEntries(READABLE_TEXT_KEYS.map((key) => [key, readableText(colors[key], paletteColors)])) } : colors;
21483
21483
  }
21484
- var plain, THEME_PREFERENCES, PALETTE_PRESETS, PALETTES, PALETTE_COLORS, ACCENT_PRESETS, ACCENTS, ACCENT_COLORS, dark, DESIGN_COLORS, SERIES, BRAND_COLORS, channels, mix, linearChannels, luminance, contrast, customMode, themeCode, DEFAULT_THEME, resolvePalette, READABLE_TEXT_KEYS;
21484
+ var plain, THEME_PREFERENCES, PALETTE_PRESETS, PALETTES, PALETTE_COLORS, ACCENT_PRESETS, ACCENTS, ACCENT_COLORS, dark, DESIGN_COLORS, SERIES, BRAND_COLORS, channels, mix, linearChannels, luminance, contrast, isHex, isCustomTheme, customMode, themeCode, DEFAULT_THEME, resolvePalette, READABLE_TEXT_KEYS;
21485
21485
  var init_design_tokens = __esm({
21486
21486
  "../shared/src/design-tokens.ts"() {
21487
21487
  "use strict";
@@ -21609,6 +21609,8 @@ var init_design_tokens = __esm({
21609
21609
  const [lighter, darker] = [luminance(a), luminance(b)].sort((x, y) => y - x);
21610
21610
  return (lighter + 0.05) / (darker + 0.05);
21611
21611
  };
21612
+ isHex = (value) => typeof value === "string" && /^#[0-9a-f]{6}$/i.test(value);
21613
+ isCustomTheme = (value) => isRecord(value) && [value.background, value.foreground, value.accent].every(isHex);
21612
21614
  customMode = ({ background, foreground }) => luminance(background) < luminance(foreground) ? "dark" : "light";
21613
21615
  themeCode = ({ background, foreground, accent }) => [background, foreground, accent].join(",");
21614
21616
  DEFAULT_THEME = {
@@ -24742,8 +24744,8 @@ function parseIssueContractRecord(schema, value, at, report) {
24742
24744
  return result.data;
24743
24745
  }
24744
24746
  for (const issue3 of result.error.issues) {
24745
- const path12 = [at, ...issue3.path.map((key) => typeof key === "number" || UUID_RE.test(String(key)) ? "*" : String(key))].filter(Boolean).join(".");
24746
- report.problems.add(`${path12} ${issue3.code}${issue3.code === "invalid_value" ? ` ${String(issue3.input).slice(0, 40)}` : ""}`);
24747
+ const path13 = [at, ...issue3.path.map((key) => typeof key === "number" || UUID_RE.test(String(key)) ? "*" : String(key))].filter(Boolean).join(".");
24748
+ report.problems.add(`${path13} ${issue3.code}${issue3.code === "invalid_value" ? ` ${String(issue3.input).slice(0, 40)}` : ""}`);
24747
24749
  }
24748
24750
  report.dropped++;
24749
24751
  return void 0;
@@ -26419,9 +26421,10 @@ replicas theme set --theme dark --color-theme slate
26419
26421
  replicas theme set --accent purple
26420
26422
  replicas theme set --accent ff5500
26421
26423
  replicas theme set --code 0d1117,e6ecf4,ff5500
26424
+ replicas theme publish --name "Ocean" --code 0b1622,e6f0f8,f2b94b --wallpaper ./ocean.webp --effect dither
26422
26425
  \`\`\`
26423
26426
 
26424
- A color theme always goes with \`--theme light\` or \`--theme dark\`. An accent is a preset name or any hex color. A theme code is three hex colors: background, text, accent. Write hex colors without the \`#\`, which the shell reads as a comment. \`replicas theme set --help\` lists the names. For a look the presets don't cover, choose the three colors yourself and pass them as \`--code\`; the text has to read clearly on the background, or it is refused.
26427
+ A color theme always goes with \`--theme light\` or \`--theme dark\`. An accent is a preset name or any hex color. A theme code is three hex colors: background, text, accent. Write hex colors without the \`#\`, which the shell reads as a comment. \`replicas theme set --help\` and \`replicas theme publish --help\` list the options. For a look the presets don't cover, choose the three colors yourself and pass them as \`--code\`; the text has to read clearly on the background, or it is refused. \`replicas theme publish\` publishes to the Replicas gallery under the workspace writer's account (with optional \`--description\`, \`--wallpaper\`, \`--effect\`, and font flags).
26425
26428
 
26426
26429
  It changes the theme of the one person who has written in this workspace, and prints their email. You cannot pick someone else. When several people have written here, or nobody has yet (a workspace started by an automation, another agent, the API or the CLI, until its person sends a message in it), it refuses: tell them they can change their own under **Themes** in the account menu. A workspace created before this command existed answers \`unknown command\`: say the same.
26427
26430
 
@@ -26975,7 +26978,7 @@ function defaultReplicasAgentAbilities() {
26975
26978
  function hasAllReplicasAgentAbilities(abilities) {
26976
26979
  return REPLICAS_AGENT_ABILITIES.every((key) => typeof abilities[key] === "boolean");
26977
26980
  }
26978
- var EMPTY_AGENT_DEFAULT_SETTINGS, DEFAULT_SUBAGENT_MCP_PROVIDERS, ALERT_SOUND_FAMILIES, ALERT_SOUNDS, WALLPAPER_VIDEO_MAX_BYTES, PUSH_WHEN_ACTIVE_COPY, DEFAULT_USER_PREFERENCES, DEFAULT_DEFAULT_SKILLS, defaultSkillsOverridesSchema, LINEAR_ROUTING_SKILL_MAX_LENGTH, linearRoutingSkillSchema;
26981
+ var EMPTY_AGENT_DEFAULT_SETTINGS, DEFAULT_SUBAGENT_MCP_PROVIDERS, ALERT_SOUND_FAMILIES, ALERT_SOUNDS, CHAT_TEXT_SIZES, APP_FONTS, CODE_FONTS, WALLPAPER_EFFECTS, WALLPAPER_VIDEO_MAX_BYTES, PUSH_WHEN_ACTIVE_COPY, DEFAULT_USER_PREFERENCES, DEFAULT_DEFAULT_SKILLS, defaultSkillsOverridesSchema, LINEAR_ROUTING_SKILL_MAX_LENGTH, linearRoutingSkillSchema;
26979
26982
  var init_preferences = __esm({
26980
26983
  "../shared/src/routes/preferences.ts"() {
26981
26984
  "use strict";
@@ -26997,6 +27000,10 @@ var init_preferences = __esm({
26997
27000
  wood: ["ready", "pluck", "knock", "bloom", "steps"]
26998
27001
  };
26999
27002
  ALERT_SOUNDS = [...ALERT_SOUND_FAMILIES.glass, ...ALERT_SOUND_FAMILIES.wood];
27003
+ CHAT_TEXT_SIZES = ["small", "default", "large", "larger"];
27004
+ APP_FONTS = ["inter", "system", "atkinson", "geist", "ibm-plex-sans", "source-sans", "lexend"];
27005
+ CODE_FONTS = ["geist-mono", "system", "atkinson-mono", "jetbrains-mono", "fira-code", "source-code-pro", "ibm-plex-mono"];
27006
+ WALLPAPER_EFFECTS = ["soft", "duotone", "dither", "none"];
27000
27007
  WALLPAPER_VIDEO_MAX_BYTES = 16 * 1024 * 1024;
27001
27008
  PUSH_WHEN_ACTIVE_COPY = {
27002
27009
  wait: `Wait ${PUSH_HOLD_MINUTES} minutes`,
@@ -27076,8 +27083,8 @@ var init_preferences = __esm({
27076
27083
  });
27077
27084
 
27078
27085
  // ../shared/src/environment-files.ts
27079
- function validateEnvironmentFilePath(path12) {
27080
- const trimmedPath = path12.trim();
27086
+ function validateEnvironmentFilePath(path13) {
27087
+ const trimmedPath = path13.trim();
27081
27088
  if (!trimmedPath) {
27082
27089
  return "Path is required.";
27083
27090
  }
@@ -27509,7 +27516,7 @@ var init_environment_config = __esm({
27509
27516
  }).nullable().optional(),
27510
27517
  repositories: external_exports.array(external_exports.string().trim().min(1)).optional(),
27511
27518
  workspaceSize: external_exports.enum(WORKSPACE_SIZE_OPTIONS).optional(),
27512
- files: external_exports.record(external_exports.string().trim().refine((path12) => !validateEnvironmentFilePath(path12), "must be a file path starting with ~/"), external_exports.strictObject({
27519
+ files: external_exports.record(external_exports.string().trim().refine((path13) => !validateEnvironmentFilePath(path13), "must be a file path starting with ~/"), external_exports.strictObject({
27513
27520
  name: external_exports.string().trim().min(1).optional(),
27514
27521
  content: external_exports.string().max(65536)
27515
27522
  })).optional(),
@@ -28327,11 +28334,11 @@ function parseShellScript(script, cwd) {
28327
28334
  parseUntil(scope, 0, false);
28328
28335
  return scope.commands;
28329
28336
  }
28330
- function resolveShellPath(dir, path12) {
28331
- if (path12.includes(SHELL_OPAQUE)) return null;
28332
- if (!path12.startsWith("/") && dir === null) return null;
28337
+ function resolveShellPath(dir, path13) {
28338
+ if (path13.includes(SHELL_OPAQUE)) return null;
28339
+ if (!path13.startsWith("/") && dir === null) return null;
28333
28340
  const parts = [];
28334
- for (const part of (path12.startsWith("/") ? path12 : `${dir}/${path12}`).split("/")) {
28341
+ for (const part of (path13.startsWith("/") ? path13 : `${dir}/${path13}`).split("/")) {
28335
28342
  if (part === "..") parts.pop();
28336
28343
  else if (part && part !== ".") parts.push(part);
28337
28344
  }
@@ -28792,8 +28799,8 @@ function parseSkillName(tool, input2) {
28792
28799
  const skillName = parsedInput.skill ?? parsedInput.name;
28793
28800
  return typeof skillName === "string" && skillName ? skillName : null;
28794
28801
  }
28795
- function skillNameFromFilePath(path12) {
28796
- const parts = path12.split(/[\\/]+/).filter(Boolean);
28802
+ function skillNameFromFilePath(path13) {
28803
+ const parts = path13.split(/[\\/]+/).filter(Boolean);
28797
28804
  if (parts.length < 2 || parts[parts.length - 1].toLowerCase() !== "skill.md") return null;
28798
28805
  const skillName = parts[parts.length - 2];
28799
28806
  return /[*?[\]{}…$]/.test(skillName) || ["skills", ".system"].includes(skillName.toLowerCase()) ? null : skillName;
@@ -28802,19 +28809,19 @@ function skillFilePath(tool, input2) {
28802
28809
  if (!READ_TOOL_NAMES.has(tool.toLowerCase())) return null;
28803
28810
  const parsedInput = typeof input2 === "string" ? safeJsonParse(input2, null) : input2;
28804
28811
  if (!isRecord(parsedInput)) return null;
28805
- const path12 = [parsedInput.path, parsedInput.filePath, parsedInput.file_path].find((value) => typeof value === "string" && value.length > 0);
28806
- return path12 && skillNameFromFilePath(path12) ? path12 : null;
28812
+ const path13 = [parsedInput.path, parsedInput.filePath, parsedInput.file_path].find((value) => typeof value === "string" && value.length > 0);
28813
+ return path13 && skillNameFromFilePath(path13) ? path13 : null;
28807
28814
  }
28808
28815
  function createCallDisplayMessage(message2) {
28809
28816
  if (message2.inputRequest) return { ...message2, type: "tool_call" };
28810
- const path12 = skillFilePath(message2.tool, message2.input);
28811
- const skillName = message2.server.toLowerCase() === "skills" ? message2.tool : path12 ? skillNameFromFilePath(path12) : parseSkillName(message2.tool, message2.input);
28817
+ const path13 = skillFilePath(message2.tool, message2.input);
28818
+ const skillName = message2.server.toLowerCase() === "skills" ? message2.tool : path13 ? skillNameFromFilePath(path13) : parseSkillName(message2.tool, message2.input);
28812
28819
  if (skillName === null) return { ...message2, type: "tool_call" };
28813
28820
  return {
28814
28821
  id: message2.id,
28815
28822
  type: "skill",
28816
28823
  skillName,
28817
- ...path12 ? { path: path12 } : {},
28824
+ ...path13 ? { path: path13 } : {},
28818
28825
  status: message2.status,
28819
28826
  timestamp: message2.timestamp
28820
28827
  };
@@ -28846,11 +28853,11 @@ function userMessageText(message2) {
28846
28853
 
28847
28854
  ${message2.content}` : message2.content;
28848
28855
  }
28849
- function fileContentDiff(path12, content, action) {
28856
+ function fileContentDiff(path13, content, action) {
28850
28857
  const lines = content.replace(/\n$/, "").split("\n");
28851
28858
  return [
28852
- `--- ${action === "add" ? "/dev/null" : `a/${path12}`}`,
28853
- `+++ ${action === "add" ? `b/${path12}` : "/dev/null"}`,
28859
+ `--- ${action === "add" ? "/dev/null" : `a/${path13}`}`,
28860
+ `+++ ${action === "add" ? `b/${path13}` : "/dev/null"}`,
28854
28861
  action === "add" ? `@@ -0,0 +1,${lines.length} @@` : `@@ -1,${lines.length} +0,0 @@`,
28855
28862
  ...lines.map((line) => `${action === "add" ? "+" : "-"}${line}`)
28856
28863
  ].join("\n");
@@ -28865,8 +28872,8 @@ function skillNamesFromCommand(command) {
28865
28872
  if (!SKILL_READ_COMMANDS.has(name) || writesFiles(name, argv) || fileWrites(shellCommand).length > 0) return [];
28866
28873
  const paths = readCommandPaths(name, argv);
28867
28874
  const stdinTarget = shellCommand.stdinTarget?.replaceAll(SHELL_OPAQUE, "\u2026");
28868
- return (paths.length === 0 && stdinTarget ? [stdinTarget] : paths).flatMap((path12) => {
28869
- const resolved = path12.startsWith("~") ? path12 : resolveShellPath(shellCommand.dir, path12)?.replace(SCRIPT_ROOT, "");
28875
+ return (paths.length === 0 && stdinTarget ? [stdinTarget] : paths).flatMap((path13) => {
28876
+ const resolved = path13.startsWith("~") ? path13 : resolveShellPath(shellCommand.dir, path13)?.replace(SCRIPT_ROOT, "");
28870
28877
  const skillName = resolved && skillNameFromFilePath(resolved);
28871
28878
  return skillName ? [skillName] : [];
28872
28879
  });
@@ -28950,7 +28957,7 @@ var init_format2 = __esm({
28950
28957
  PATTERN_FLAGS = /* @__PURE__ */ new Set(["-e", "-f", "--file", "--regexp"]);
28951
28958
  SCRIPT_ROOT = "/";
28952
28959
  commandName = (argv) => argv[0].split("/").pop() ?? argv[0];
28953
- fileWrites = ({ writes }) => writes.filter(({ path: path12 }) => path12 !== "/dev/null");
28960
+ fileWrites = ({ writes }) => writes.filter(({ path: path13 }) => path13 !== "/dev/null");
28954
28961
  SKILL_READ_COMMANDS = /* @__PURE__ */ new Set(["awk", "bat", "cat", "head", "less", "more", "nl", "sed", "tail"]);
28955
28962
  }
28956
28963
  });
@@ -29065,17 +29072,17 @@ var require_visit = __commonJS({
29065
29072
  visit2.BREAK = BREAK;
29066
29073
  visit2.SKIP = SKIP;
29067
29074
  visit2.REMOVE = REMOVE;
29068
- function visit_(key, node2, visitor, path12) {
29069
- const ctrl = callVisitor(key, node2, visitor, path12);
29075
+ function visit_(key, node2, visitor, path13) {
29076
+ const ctrl = callVisitor(key, node2, visitor, path13);
29070
29077
  if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
29071
- replaceNode(key, path12, ctrl);
29072
- return visit_(key, ctrl, visitor, path12);
29078
+ replaceNode(key, path13, ctrl);
29079
+ return visit_(key, ctrl, visitor, path13);
29073
29080
  }
29074
29081
  if (typeof ctrl !== "symbol") {
29075
29082
  if (identity.isCollection(node2)) {
29076
- path12 = Object.freeze(path12.concat(node2));
29083
+ path13 = Object.freeze(path13.concat(node2));
29077
29084
  for (let i = 0; i < node2.items.length; ++i) {
29078
- const ci = visit_(i, node2.items[i], visitor, path12);
29085
+ const ci = visit_(i, node2.items[i], visitor, path13);
29079
29086
  if (typeof ci === "number")
29080
29087
  i = ci - 1;
29081
29088
  else if (ci === BREAK)
@@ -29086,13 +29093,13 @@ var require_visit = __commonJS({
29086
29093
  }
29087
29094
  }
29088
29095
  } else if (identity.isPair(node2)) {
29089
- path12 = Object.freeze(path12.concat(node2));
29090
- const ck = visit_("key", node2.key, visitor, path12);
29096
+ path13 = Object.freeze(path13.concat(node2));
29097
+ const ck = visit_("key", node2.key, visitor, path13);
29091
29098
  if (ck === BREAK)
29092
29099
  return BREAK;
29093
29100
  else if (ck === REMOVE)
29094
29101
  node2.key = null;
29095
- const cv = visit_("value", node2.value, visitor, path12);
29102
+ const cv = visit_("value", node2.value, visitor, path13);
29096
29103
  if (cv === BREAK)
29097
29104
  return BREAK;
29098
29105
  else if (cv === REMOVE)
@@ -29113,17 +29120,17 @@ var require_visit = __commonJS({
29113
29120
  visitAsync.BREAK = BREAK;
29114
29121
  visitAsync.SKIP = SKIP;
29115
29122
  visitAsync.REMOVE = REMOVE;
29116
- async function visitAsync_(key, node2, visitor, path12) {
29117
- const ctrl = await callVisitor(key, node2, visitor, path12);
29123
+ async function visitAsync_(key, node2, visitor, path13) {
29124
+ const ctrl = await callVisitor(key, node2, visitor, path13);
29118
29125
  if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
29119
- replaceNode(key, path12, ctrl);
29120
- return visitAsync_(key, ctrl, visitor, path12);
29126
+ replaceNode(key, path13, ctrl);
29127
+ return visitAsync_(key, ctrl, visitor, path13);
29121
29128
  }
29122
29129
  if (typeof ctrl !== "symbol") {
29123
29130
  if (identity.isCollection(node2)) {
29124
- path12 = Object.freeze(path12.concat(node2));
29131
+ path13 = Object.freeze(path13.concat(node2));
29125
29132
  for (let i = 0; i < node2.items.length; ++i) {
29126
- const ci = await visitAsync_(i, node2.items[i], visitor, path12);
29133
+ const ci = await visitAsync_(i, node2.items[i], visitor, path13);
29127
29134
  if (typeof ci === "number")
29128
29135
  i = ci - 1;
29129
29136
  else if (ci === BREAK)
@@ -29134,13 +29141,13 @@ var require_visit = __commonJS({
29134
29141
  }
29135
29142
  }
29136
29143
  } else if (identity.isPair(node2)) {
29137
- path12 = Object.freeze(path12.concat(node2));
29138
- const ck = await visitAsync_("key", node2.key, visitor, path12);
29144
+ path13 = Object.freeze(path13.concat(node2));
29145
+ const ck = await visitAsync_("key", node2.key, visitor, path13);
29139
29146
  if (ck === BREAK)
29140
29147
  return BREAK;
29141
29148
  else if (ck === REMOVE)
29142
29149
  node2.key = null;
29143
- const cv = await visitAsync_("value", node2.value, visitor, path12);
29150
+ const cv = await visitAsync_("value", node2.value, visitor, path13);
29144
29151
  if (cv === BREAK)
29145
29152
  return BREAK;
29146
29153
  else if (cv === REMOVE)
@@ -29167,23 +29174,23 @@ var require_visit = __commonJS({
29167
29174
  }
29168
29175
  return visitor;
29169
29176
  }
29170
- function callVisitor(key, node2, visitor, path12) {
29177
+ function callVisitor(key, node2, visitor, path13) {
29171
29178
  if (typeof visitor === "function")
29172
- return visitor(key, node2, path12);
29179
+ return visitor(key, node2, path13);
29173
29180
  if (identity.isMap(node2))
29174
- return visitor.Map?.(key, node2, path12);
29181
+ return visitor.Map?.(key, node2, path13);
29175
29182
  if (identity.isSeq(node2))
29176
- return visitor.Seq?.(key, node2, path12);
29183
+ return visitor.Seq?.(key, node2, path13);
29177
29184
  if (identity.isPair(node2))
29178
- return visitor.Pair?.(key, node2, path12);
29185
+ return visitor.Pair?.(key, node2, path13);
29179
29186
  if (identity.isScalar(node2))
29180
- return visitor.Scalar?.(key, node2, path12);
29187
+ return visitor.Scalar?.(key, node2, path13);
29181
29188
  if (identity.isAlias(node2))
29182
- return visitor.Alias?.(key, node2, path12);
29189
+ return visitor.Alias?.(key, node2, path13);
29183
29190
  return void 0;
29184
29191
  }
29185
- function replaceNode(key, path12, node2) {
29186
- const parent = path12[path12.length - 1];
29192
+ function replaceNode(key, path13, node2) {
29193
+ const parent = path13[path13.length - 1];
29187
29194
  if (identity.isCollection(parent)) {
29188
29195
  parent.items[key] = node2;
29189
29196
  } else if (identity.isPair(parent)) {
@@ -29793,10 +29800,10 @@ var require_Collection = __commonJS({
29793
29800
  var createNode = require_createNode();
29794
29801
  var identity = require_identity();
29795
29802
  var Node = require_Node();
29796
- function collectionFromPath(schema, path12, value) {
29803
+ function collectionFromPath(schema, path13, value) {
29797
29804
  let v2 = value;
29798
- for (let i = path12.length - 1; i >= 0; --i) {
29799
- const k = path12[i];
29805
+ for (let i = path13.length - 1; i >= 0; --i) {
29806
+ const k = path13[i];
29800
29807
  if (typeof k === "number" && Number.isInteger(k) && k >= 0) {
29801
29808
  const a = [];
29802
29809
  a[k] = v2;
@@ -29815,7 +29822,7 @@ var require_Collection = __commonJS({
29815
29822
  sourceObjects: /* @__PURE__ */ new Map()
29816
29823
  });
29817
29824
  }
29818
- var isEmptyPath = (path12) => path12 == null || typeof path12 === "object" && !!path12[Symbol.iterator]().next().done;
29825
+ var isEmptyPath = (path13) => path13 == null || typeof path13 === "object" && !!path13[Symbol.iterator]().next().done;
29819
29826
  var Collection = class extends Node.NodeBase {
29820
29827
  constructor(type, schema) {
29821
29828
  super(type);
@@ -29845,11 +29852,11 @@ var require_Collection = __commonJS({
29845
29852
  * be a Pair instance or a `{ key, value }` object, which may not have a key
29846
29853
  * that already exists in the map.
29847
29854
  */
29848
- addIn(path12, value) {
29849
- if (isEmptyPath(path12))
29855
+ addIn(path13, value) {
29856
+ if (isEmptyPath(path13))
29850
29857
  this.add(value);
29851
29858
  else {
29852
- const [key, ...rest] = path12;
29859
+ const [key, ...rest] = path13;
29853
29860
  const node2 = this.get(key, true);
29854
29861
  if (identity.isCollection(node2))
29855
29862
  node2.addIn(rest, value);
@@ -29863,8 +29870,8 @@ var require_Collection = __commonJS({
29863
29870
  * Removes a value from the collection.
29864
29871
  * @returns `true` if the item was found and removed.
29865
29872
  */
29866
- deleteIn(path12) {
29867
- const [key, ...rest] = path12;
29873
+ deleteIn(path13) {
29874
+ const [key, ...rest] = path13;
29868
29875
  if (rest.length === 0)
29869
29876
  return this.delete(key);
29870
29877
  const node2 = this.get(key, true);
@@ -29878,8 +29885,8 @@ var require_Collection = __commonJS({
29878
29885
  * scalar values from their surrounding node; to disable set `keepScalar` to
29879
29886
  * `true` (collections are always returned intact).
29880
29887
  */
29881
- getIn(path12, keepScalar) {
29882
- const [key, ...rest] = path12;
29888
+ getIn(path13, keepScalar) {
29889
+ const [key, ...rest] = path13;
29883
29890
  const node2 = this.get(key, true);
29884
29891
  if (rest.length === 0)
29885
29892
  return !keepScalar && identity.isScalar(node2) ? node2.value : node2;
@@ -29897,8 +29904,8 @@ var require_Collection = __commonJS({
29897
29904
  /**
29898
29905
  * Checks if the collection includes a value with the key `key`.
29899
29906
  */
29900
- hasIn(path12) {
29901
- const [key, ...rest] = path12;
29907
+ hasIn(path13) {
29908
+ const [key, ...rest] = path13;
29902
29909
  if (rest.length === 0)
29903
29910
  return this.has(key);
29904
29911
  const node2 = this.get(key, true);
@@ -29908,8 +29915,8 @@ var require_Collection = __commonJS({
29908
29915
  * Sets a value in this collection. For `!!set`, `value` needs to be a
29909
29916
  * boolean to add/remove the item from the set.
29910
29917
  */
29911
- setIn(path12, value) {
29912
- const [key, ...rest] = path12;
29918
+ setIn(path13, value) {
29919
+ const [key, ...rest] = path13;
29913
29920
  if (rest.length === 0) {
29914
29921
  this.set(key, value);
29915
29922
  } else {
@@ -32424,9 +32431,9 @@ var require_Document = __commonJS({
32424
32431
  this.contents.add(value);
32425
32432
  }
32426
32433
  /** Adds a value to the document. */
32427
- addIn(path12, value) {
32434
+ addIn(path13, value) {
32428
32435
  if (assertCollection(this.contents))
32429
- this.contents.addIn(path12, value);
32436
+ this.contents.addIn(path13, value);
32430
32437
  }
32431
32438
  /**
32432
32439
  * Create a new `Alias` node, ensuring that the target `node` has the required anchor.
@@ -32501,14 +32508,14 @@ var require_Document = __commonJS({
32501
32508
  * Removes a value from the document.
32502
32509
  * @returns `true` if the item was found and removed.
32503
32510
  */
32504
- deleteIn(path12) {
32505
- if (Collection.isEmptyPath(path12)) {
32511
+ deleteIn(path13) {
32512
+ if (Collection.isEmptyPath(path13)) {
32506
32513
  if (this.contents == null)
32507
32514
  return false;
32508
32515
  this.contents = null;
32509
32516
  return true;
32510
32517
  }
32511
- return assertCollection(this.contents) ? this.contents.deleteIn(path12) : false;
32518
+ return assertCollection(this.contents) ? this.contents.deleteIn(path13) : false;
32512
32519
  }
32513
32520
  /**
32514
32521
  * Returns item at `key`, or `undefined` if not found. By default unwraps
@@ -32523,10 +32530,10 @@ var require_Document = __commonJS({
32523
32530
  * scalar values from their surrounding node; to disable set `keepScalar` to
32524
32531
  * `true` (collections are always returned intact).
32525
32532
  */
32526
- getIn(path12, keepScalar) {
32527
- if (Collection.isEmptyPath(path12))
32533
+ getIn(path13, keepScalar) {
32534
+ if (Collection.isEmptyPath(path13))
32528
32535
  return !keepScalar && identity.isScalar(this.contents) ? this.contents.value : this.contents;
32529
- return identity.isCollection(this.contents) ? this.contents.getIn(path12, keepScalar) : void 0;
32536
+ return identity.isCollection(this.contents) ? this.contents.getIn(path13, keepScalar) : void 0;
32530
32537
  }
32531
32538
  /**
32532
32539
  * Checks if the document includes a value with the key `key`.
@@ -32537,10 +32544,10 @@ var require_Document = __commonJS({
32537
32544
  /**
32538
32545
  * Checks if the document includes a value at `path`.
32539
32546
  */
32540
- hasIn(path12) {
32541
- if (Collection.isEmptyPath(path12))
32547
+ hasIn(path13) {
32548
+ if (Collection.isEmptyPath(path13))
32542
32549
  return this.contents !== void 0;
32543
- return identity.isCollection(this.contents) ? this.contents.hasIn(path12) : false;
32550
+ return identity.isCollection(this.contents) ? this.contents.hasIn(path13) : false;
32544
32551
  }
32545
32552
  /**
32546
32553
  * Sets a value in this document. For `!!set`, `value` needs to be a
@@ -32557,13 +32564,13 @@ var require_Document = __commonJS({
32557
32564
  * Sets a value in this document. For `!!set`, `value` needs to be a
32558
32565
  * boolean to add/remove the item from the set.
32559
32566
  */
32560
- setIn(path12, value) {
32561
- if (Collection.isEmptyPath(path12)) {
32567
+ setIn(path13, value) {
32568
+ if (Collection.isEmptyPath(path13)) {
32562
32569
  this.contents = value;
32563
32570
  } else if (this.contents == null) {
32564
- this.contents = Collection.collectionFromPath(this.schema, Array.from(path12), value);
32571
+ this.contents = Collection.collectionFromPath(this.schema, Array.from(path13), value);
32565
32572
  } else if (assertCollection(this.contents)) {
32566
- this.contents.setIn(path12, value);
32573
+ this.contents.setIn(path13, value);
32567
32574
  }
32568
32575
  }
32569
32576
  /**
@@ -34523,9 +34530,9 @@ var require_cst_visit = __commonJS({
34523
34530
  visit2.BREAK = BREAK;
34524
34531
  visit2.SKIP = SKIP;
34525
34532
  visit2.REMOVE = REMOVE;
34526
- visit2.itemAtPath = (cst, path12) => {
34533
+ visit2.itemAtPath = (cst, path13) => {
34527
34534
  let item = cst;
34528
- for (const [field2, index] of path12) {
34535
+ for (const [field2, index] of path13) {
34529
34536
  const tok = item?.[field2];
34530
34537
  if (tok && "items" in tok) {
34531
34538
  item = tok.items[index];
@@ -34534,23 +34541,23 @@ var require_cst_visit = __commonJS({
34534
34541
  }
34535
34542
  return item;
34536
34543
  };
34537
- visit2.parentCollection = (cst, path12) => {
34538
- const parent = visit2.itemAtPath(cst, path12.slice(0, -1));
34539
- const field2 = path12[path12.length - 1][0];
34544
+ visit2.parentCollection = (cst, path13) => {
34545
+ const parent = visit2.itemAtPath(cst, path13.slice(0, -1));
34546
+ const field2 = path13[path13.length - 1][0];
34540
34547
  const coll = parent?.[field2];
34541
34548
  if (coll && "items" in coll)
34542
34549
  return coll;
34543
34550
  throw new Error("Parent collection not found");
34544
34551
  };
34545
- function _visit(path12, item, visitor) {
34546
- let ctrl = visitor(item, path12);
34552
+ function _visit(path13, item, visitor) {
34553
+ let ctrl = visitor(item, path13);
34547
34554
  if (typeof ctrl === "symbol")
34548
34555
  return ctrl;
34549
34556
  for (const field2 of ["key", "value"]) {
34550
34557
  const token = item[field2];
34551
34558
  if (token && "items" in token) {
34552
34559
  for (let i = 0; i < token.items.length; ++i) {
34553
- const ci = _visit(Object.freeze(path12.concat([[field2, i]])), token.items[i], visitor);
34560
+ const ci = _visit(Object.freeze(path13.concat([[field2, i]])), token.items[i], visitor);
34554
34561
  if (typeof ci === "number")
34555
34562
  i = ci - 1;
34556
34563
  else if (ci === BREAK)
@@ -34561,10 +34568,10 @@ var require_cst_visit = __commonJS({
34561
34568
  }
34562
34569
  }
34563
34570
  if (typeof ctrl === "function" && field2 === "key")
34564
- ctrl = ctrl(item, path12);
34571
+ ctrl = ctrl(item, path13);
34565
34572
  }
34566
34573
  }
34567
- return typeof ctrl === "function" ? ctrl(item, path12) : ctrl;
34574
+ return typeof ctrl === "function" ? ctrl(item, path13) : ctrl;
34568
34575
  }
34569
34576
  exports2.visit = visit2;
34570
34577
  }
@@ -35866,14 +35873,14 @@ var require_parser = __commonJS({
35866
35873
  case "scalar":
35867
35874
  case "single-quoted-scalar":
35868
35875
  case "double-quoted-scalar": {
35869
- const fs13 = this.flowScalar(this.type);
35876
+ const fs14 = this.flowScalar(this.type);
35870
35877
  if (atNextItem || it.value) {
35871
- map2.items.push({ start, key: fs13, sep: [] });
35878
+ map2.items.push({ start, key: fs14, sep: [] });
35872
35879
  this.onKeyLine = true;
35873
35880
  } else if (it.sep) {
35874
- this.stack.push(fs13);
35881
+ this.stack.push(fs14);
35875
35882
  } else {
35876
- Object.assign(it, { key: fs13, sep: [] });
35883
+ Object.assign(it, { key: fs14, sep: [] });
35877
35884
  this.onKeyLine = true;
35878
35885
  }
35879
35886
  return;
@@ -36001,13 +36008,13 @@ var require_parser = __commonJS({
36001
36008
  case "scalar":
36002
36009
  case "single-quoted-scalar":
36003
36010
  case "double-quoted-scalar": {
36004
- const fs13 = this.flowScalar(this.type);
36011
+ const fs14 = this.flowScalar(this.type);
36005
36012
  if (!it || it.value)
36006
- fc.items.push({ start: [], key: fs13, sep: [] });
36013
+ fc.items.push({ start: [], key: fs14, sep: [] });
36007
36014
  else if (it.sep)
36008
- this.stack.push(fs13);
36015
+ this.stack.push(fs14);
36009
36016
  else
36010
- Object.assign(it, { key: fs13, sep: [] });
36017
+ Object.assign(it, { key: fs14, sep: [] });
36011
36018
  return;
36012
36019
  }
36013
36020
  case "flow-map-end":
@@ -36651,7 +36658,7 @@ function stripAttachmentNote(text4) {
36651
36658
  if (annotationsNote) content = content.slice(0, annotationsNote.index).trim();
36652
36659
  return {
36653
36660
  content,
36654
- files: match ? [...match[1].matchAll(/^- (.+)$/gm)].map(([, path12]) => path12) : [],
36661
+ files: match ? [...match[1].matchAll(/^- (.+)$/gm)].map(([, path13]) => path13) : [],
36655
36662
  walkthroughs,
36656
36663
  appshots,
36657
36664
  annotations: annotationsNote ? parseAnnotationsNote(annotationsNote.body) : []
@@ -36690,7 +36697,7 @@ var init_user_message_attachments = __esm({
36690
36697
  WALKTHROUGH_NOTE_REGEX = /(?:^|\n\n)<replicas_walkthrough path="([^"\n]+)" duration_seconds="(\d+)" audio="(true|false)">\n[^<]*\n<\/replicas_walkthrough>$/;
36691
36698
  TRUNCATED_WALKTHROUGH_NOTE_REGEX = /(?:^|\n\n)<replicas_walkthrough path="([^"\n]*)(?:" duration_seconds="(\d*))?(?:" audio="(true)?)?[^<]*(?:<\/?[a-z_]*)?$/;
36692
36699
  VIDEO_SIZES_REGEX = /<replicas_instructions>\nThe attached videos' frame sizes, in pixels:((?:\n- .+: \d+x\d+)+)(?:\nFor display only; ignore\.)?\n<\/replicas_instructions>/;
36693
- parseVideoSizes = (raw) => Object.fromEntries([...(raw.match(VIDEO_SIZES_REGEX)?.[1] ?? "").matchAll(/^- (.+): (\d+)x(\d+)$/gm)].map(([, path12, width, height]) => [path12, { width: Number(width), height: Number(height) }]));
36700
+ parseVideoSizes = (raw) => Object.fromEntries([...(raw.match(VIDEO_SIZES_REGEX)?.[1] ?? "").matchAll(/^- (.+): (\d+)x(\d+)$/gm)].map(([, path13, width, height]) => [path13, { width: Number(width), height: Number(height) }]));
36694
36701
  }
36695
36702
  });
36696
36703
 
@@ -38071,7 +38078,7 @@ function parseOpencodeEvents(events) {
38071
38078
  upsertDisplayMessage(messages, {
38072
38079
  id,
38073
38080
  type: "file_change",
38074
- changes: files.map((path12) => ({ path: path12, kind: "update" })),
38081
+ changes: files.map((path13) => ({ path: path13, kind: "update" })),
38075
38082
  status: "completed",
38076
38083
  timestamp: timestamp2
38077
38084
  });
@@ -40703,7 +40710,7 @@ var CLI_VERSION;
40703
40710
  var init_cli_version = __esm({
40704
40711
  "../shared/src/cli-version.ts"() {
40705
40712
  "use strict";
40706
- CLI_VERSION = "0.3.562";
40713
+ CLI_VERSION = "0.3.564";
40707
40714
  }
40708
40715
  });
40709
40716
 
@@ -41248,13 +41255,78 @@ var init_web_auth = __esm({
41248
41255
  }
41249
41256
  });
41250
41257
 
41258
+ // ../shared/src/routes/marketplace.ts
41259
+ function themeModes({ palette, custom: custom2 }) {
41260
+ return palette === "custom" ? [customMode(custom2)] : ["light", "dark"].filter((mode) => PALETTE_PRESETS[mode].some((name) => name === palette));
41261
+ }
41262
+ function themeMode(colors, mode) {
41263
+ const modes = themeModes(colors);
41264
+ if (modes.length === 1) return modes[0];
41265
+ return mode ?? "system";
41266
+ }
41267
+ var MARKETPLACE_NAME_MAX_LENGTH, MARKETPLACE_DESCRIPTION_MAX_LENGTH, MARKETPLACE_REPORT_MAX_LENGTH, themeColorsSchema, wallpaperSchema, themeSettingsShape, themeContentSchema, publishBase, themeFields, updateMarketplaceThemeSchema, publishMarketplaceItemSchema, reportMarketplaceItemSchema, adminUpdateMarketplaceItemSchema;
41268
+ var init_marketplace = __esm({
41269
+ "../shared/src/routes/marketplace.ts"() {
41270
+ "use strict";
41271
+ init_zod();
41272
+ init_design_tokens();
41273
+ init_preferences();
41274
+ MARKETPLACE_NAME_MAX_LENGTH = 40;
41275
+ MARKETPLACE_DESCRIPTION_MAX_LENGTH = 200;
41276
+ MARKETPLACE_REPORT_MAX_LENGTH = 500;
41277
+ themeColorsSchema = external_exports.object({
41278
+ palette: external_exports.custom((value) => PALETTES.some((palette) => palette === value)),
41279
+ accent: external_exports.custom((value) => ACCENTS.some((accent) => accent === value)),
41280
+ custom: external_exports.custom(isCustomTheme)
41281
+ });
41282
+ wallpaperSchema = external_exports.object({ key: external_exports.string(), effect: external_exports.enum(WALLPAPER_EFFECTS) });
41283
+ themeSettingsShape = {
41284
+ colors: themeColorsSchema,
41285
+ mode: external_exports.enum(THEME_PREFERENCES),
41286
+ chat_text_size: external_exports.enum(CHAT_TEXT_SIZES),
41287
+ app_font: external_exports.enum(APP_FONTS),
41288
+ code_font: external_exports.enum(CODE_FONTS)
41289
+ };
41290
+ themeContentSchema = external_exports.object({
41291
+ ...themeSettingsShape,
41292
+ mode: themeSettingsShape.mode.optional(),
41293
+ chat_text_size: themeSettingsShape.chat_text_size.default(DEFAULT_USER_PREFERENCES.chat_text_size),
41294
+ app_font: themeSettingsShape.app_font.default(DEFAULT_USER_PREFERENCES.app_font),
41295
+ code_font: themeSettingsShape.code_font.default(DEFAULT_USER_PREFERENCES.code_font),
41296
+ wallpaper: wallpaperSchema.nullable()
41297
+ }).transform((content) => ({ ...content, mode: themeMode(content.colors, content.mode) }));
41298
+ publishBase = {
41299
+ name: external_exports.string().trim().min(1).max(MARKETPLACE_NAME_MAX_LENGTH),
41300
+ description: external_exports.string().trim().max(MARKETPLACE_DESCRIPTION_MAX_LENGTH).nullable()
41301
+ };
41302
+ themeFields = { ...publishBase, ...themeSettingsShape, wallpaper: external_exports.object({ key: external_exports.string().nullable(), effect: external_exports.enum(WALLPAPER_EFFECTS) }).nullable() };
41303
+ updateMarketplaceThemeSchema = external_exports.object(themeFields);
41304
+ publishMarketplaceItemSchema = external_exports.discriminatedUnion("kind", [
41305
+ external_exports.object({ kind: external_exports.literal("theme"), ...themeFields }),
41306
+ external_exports.object({ kind: external_exports.literal("avatar"), ...publishBase, workspace_id: external_exports.string().uuid() })
41307
+ ]);
41308
+ reportMarketplaceItemSchema = external_exports.object({ reason: external_exports.string().trim().min(1).max(MARKETPLACE_REPORT_MAX_LENGTH) });
41309
+ adminUpdateMarketplaceItemSchema = external_exports.object({ hidden: external_exports.boolean() });
41310
+ }
41311
+ });
41312
+
41251
41313
  // ../shared/src/routes/themes.ts
41252
- var updateThemeRequestSchema;
41314
+ var updateThemeRequestSchema, publishThemeRequestSchema;
41253
41315
  var init_themes = __esm({
41254
41316
  "../shared/src/routes/themes.ts"() {
41255
41317
  "use strict";
41256
41318
  init_zod();
41319
+ init_marketplace();
41320
+ init_preferences();
41257
41321
  updateThemeRequestSchema = external_exports.object({ theme: external_exports.string(), palette: external_exports.string(), accent: external_exports.string(), code: external_exports.string() }).partial();
41322
+ publishThemeRequestSchema = updateThemeRequestSchema.extend({
41323
+ name: external_exports.string().trim().min(1).max(MARKETPLACE_NAME_MAX_LENGTH),
41324
+ description: external_exports.string().trim().max(MARKETPLACE_DESCRIPTION_MAX_LENGTH).nullable().optional(),
41325
+ effect: external_exports.enum(WALLPAPER_EFFECTS).optional(),
41326
+ app_font: external_exports.enum(APP_FONTS).optional(),
41327
+ code_font: external_exports.enum(CODE_FONTS).optional(),
41328
+ chat_text_size: external_exports.enum(CHAT_TEXT_SIZES).optional()
41329
+ });
41258
41330
  }
41259
41331
  });
41260
41332
 
@@ -53931,8 +54003,8 @@ var init_claude_auth2 = __esm({
53931
54003
  });
53932
54004
 
53933
54005
  // src/lib/muse-oauth.ts
53934
- async function post(path12, body2) {
53935
- return fetch(`${AUTH_URL}${path12}`, {
54006
+ async function post(path13, body2) {
54007
+ return fetch(`${AUTH_URL}${path13}`, {
53936
54008
  method: "POST",
53937
54009
  headers: { "Content-Type": "application/x-www-form-urlencoded" },
53938
54010
  body: body2
@@ -54206,7 +54278,7 @@ async function credentialsGetCommand(service, options) {
54206
54278
  });
54207
54279
  }
54208
54280
  async function credentialsSetCommand(service, options) {
54209
- const path12 = credentialsPath(service, options, true);
54281
+ const path13 = credentialsPath(service, options, true);
54210
54282
  const { org: org2, models, ...fields } = options;
54211
54283
  const secretField = service === "bedrock" ? "aws_secret_access_key" : "api_key";
54212
54284
  const body2 = {
@@ -54214,7 +54286,7 @@ async function credentialsSetCommand(service, options) {
54214
54286
  ...models ? { models: models.split(",").map((model2) => model2.trim()).filter(Boolean) } : {},
54215
54287
  [secretField]: await readSecret(service, secretField === "api_key" ? "API key" : "AWS secret access key")
54216
54288
  };
54217
- const response = await orgAuthenticatedFetch(path12, { method: "POST", body: body2 });
54289
+ const response = await orgAuthenticatedFetch(path13, { method: "POST", body: body2 });
54218
54290
  output2(response, () => console.log(import_chalk18.default.green(`Saved ${scopeLabel(options)} ${service} credentials.`)));
54219
54291
  }
54220
54292
  async function credentialsRemoveCommand(service, options) {
@@ -55755,8 +55827,8 @@ async function chatQueueListCommand(id, chatId) {
55755
55827
  printQueue(queue);
55756
55828
  });
55757
55829
  }
55758
- async function mutateQueue(path12, method, body2) {
55759
- output2(await orgAuthenticatedFetch(path12, { method, body: body2 }), ({ queue }) => {
55830
+ async function mutateQueue(path13, method, body2) {
55831
+ output2(await orgAuthenticatedFetch(path13, { method, body: body2 }), ({ queue }) => {
55760
55832
  if (queue) printQueue(queue);
55761
55833
  else console.log("Done.");
55762
55834
  });
@@ -55770,7 +55842,7 @@ var init_chat = __esm({
55770
55842
  init_api2();
55771
55843
  init_output();
55772
55844
  init_replica2();
55773
- chatPath2 = (id, chatId, path12 = "") => `/v1/replica/${id}/chats/${chatId}${path12}`;
55845
+ chatPath2 = (id, chatId, path13 = "") => `/v1/replica/${id}/chats/${chatId}${path13}`;
55774
55846
  chatQueueClearCommand = (id, chatId) => mutateQueue(chatPath2(id, chatId, "/queue"), "DELETE");
55775
55847
  chatQueueRemoveCommand = (id, chatId, messageId) => mutateQueue(chatPath2(id, chatId, `/queue/${messageId}`), "DELETE");
55776
55848
  chatQueueEditCommand = (id, chatId, messageId, message2) => mutateQueue(chatPath2(id, chatId, `/queue/${messageId}`), "PATCH", { message: message2 });
@@ -55821,7 +55893,7 @@ var init_plugins3 = __esm({
55821
55893
  init_command_utils();
55822
55894
  init_output();
55823
55895
  init_environment3();
55824
- pluginsPath = async ({ env }, path12) => env ? `/v1/environments/${await resolveEnvironmentId(env)}/plugins${path12}` : `/v1/plugins${path12}`;
55896
+ pluginsPath = async ({ env }, path13) => env ? `/v1/environments/${await resolveEnvironmentId(env)}/plugins${path13}` : `/v1/plugins${path13}`;
55825
55897
  }
55826
55898
  });
55827
55899
 
@@ -56804,10 +56876,10 @@ var init_automation = __esm({
56804
56876
  });
56805
56877
 
56806
56878
  // src/lib/agent-api.ts
56807
- async function agentFetch(path12, options) {
56808
- return (await agentRequest(path12, options)).json();
56879
+ async function agentFetch(path13, options) {
56880
+ return (await agentRequest(path13, options)).json();
56809
56881
  }
56810
- async function agentRequest(path12, options) {
56882
+ async function agentRequest(path13, options) {
56811
56883
  const config3 = readAgentConfig();
56812
56884
  if (!config3) {
56813
56885
  throw new Error("Agent mode config not found");
@@ -56823,7 +56895,7 @@ async function agentRequest(path12, options) {
56823
56895
  ...options?.headers || {}
56824
56896
  };
56825
56897
  const body2 = rawBody === void 0 ? void 0 : rawBody instanceof FormData || rawBody instanceof ReadableStream ? rawBody : JSON.stringify(rawBody);
56826
- const response = await fetch(`${MONOLITH_URL}${path12}`, {
56898
+ const response = await fetch(`${MONOLITH_URL}${path13}`, {
56827
56899
  ...options,
56828
56900
  headers,
56829
56901
  body: body2,
@@ -56835,7 +56907,7 @@ async function agentRequest(path12, options) {
56835
56907
  }
56836
56908
  return response;
56837
56909
  }
56838
- async function engineFetch(path12, options) {
56910
+ async function engineFetch(path13, options) {
56839
56911
  const config3 = readAgentConfig();
56840
56912
  if (!config3) {
56841
56913
  throw new Error("Agent mode config not found");
@@ -56845,7 +56917,7 @@ async function engineFetch(path12, options) {
56845
56917
  "Content-Type": "application/json",
56846
56918
  ...options?.headers || {}
56847
56919
  };
56848
- const response = await fetch(`http://localhost:${ENGINE_PORT2}${path12}`, {
56920
+ const response = await fetch(`http://localhost:${ENGINE_PORT2}${path13}`, {
56849
56921
  ...options,
56850
56922
  headers,
56851
56923
  body: options?.body !== void 0 ? JSON.stringify(options.body) : void 0
@@ -57870,16 +57942,16 @@ function computeExecCommand(kind) {
57870
57942
  return async (command, options) => {
57871
57943
  if (command.length === 0) throw new Error(`Pass a command after --, e.g. replicas ${kind} exec -- ${kind === "gpu" ? "nvidia-smi" : "xcodebuild -version"}`);
57872
57944
  const sandboxId = await resolveSandboxId(kind, options);
57873
- const path12 = `${BASE}/${sandboxId}/exec`;
57945
+ const path13 = `${BASE}/${sandboxId}/exec`;
57874
57946
  if (options.detach) {
57875
- const { jobId } = await agentFetch(path12, execRequest(command.join(" "), options));
57947
+ const { jobId } = await agentFetch(path13, execRequest(command.join(" "), options));
57876
57948
  output2({ jobId, sandboxId }, () => {
57877
57949
  console.log(`Started job ${import_chalk30.default.bold(jobId)} in ${sandboxId}`);
57878
57950
  console.log(import_chalk30.default.gray(`Follow it with: replicas ${kind} logs ${jobId} -f`));
57879
57951
  });
57880
57952
  return;
57881
57953
  }
57882
- const exitCode = await streamOutput(await agentRequest(path12, execRequest(command.join(" "), options)));
57954
+ const exitCode = await streamOutput(await agentRequest(path13, execRequest(command.join(" "), options)));
57883
57955
  process.exitCode = exitCode ?? 1;
57884
57956
  if (isJsonMode()) output2({ sandboxId, exitCode }, () => {
57885
57957
  });
@@ -57912,21 +57984,21 @@ function assertTransferSize(bytes, localPath) {
57912
57984
  }
57913
57985
  }
57914
57986
  function archive(localPath) {
57915
- const path12 = (0, import_node_path3.resolve)(localPath);
57916
- if (!(0, import_node_fs3.existsSync)(path12)) throw new Error(`${path12} does not exist`);
57917
- if (!(0, import_node_fs3.statSync)(path12).isDirectory()) {
57918
- assertTransferSize((0, import_node_fs3.statSync)(path12).size, localPath);
57919
- return (0, import_node_child_process2.spawn)("tar", ["-czf", "-", "-C", (0, import_node_path3.dirname)(path12), (0, import_node_path3.basename)(path12)], { stdio: ["ignore", "pipe", "pipe"] });
57987
+ const path13 = (0, import_node_path3.resolve)(localPath);
57988
+ if (!(0, import_node_fs3.existsSync)(path13)) throw new Error(`${path13} does not exist`);
57989
+ if (!(0, import_node_fs3.statSync)(path13).isDirectory()) {
57990
+ assertTransferSize((0, import_node_fs3.statSync)(path13).size, localPath);
57991
+ return (0, import_node_child_process2.spawn)("tar", ["-czf", "-", "-C", (0, import_node_path3.dirname)(path13), (0, import_node_path3.basename)(path13)], { stdio: ["ignore", "pipe", "pipe"] });
57920
57992
  }
57921
- const listed = (0, import_node_child_process2.spawnSync)("git", ["-C", path12, "ls-files", "-co", "--exclude-standard", "-z"], { maxBuffer: 256 * 1024 * 1024 });
57993
+ const listed = (0, import_node_child_process2.spawnSync)("git", ["-C", path13, "ls-files", "-co", "--exclude-standard", "-z"], { maxBuffer: 256 * 1024 * 1024 });
57922
57994
  if (listed.status !== 0) {
57923
- const du = (0, import_node_child_process2.spawnSync)("du", ["-sk", "--exclude=.git", "--exclude=node_modules", path12]);
57995
+ const du = (0, import_node_child_process2.spawnSync)("du", ["-sk", "--exclude=.git", "--exclude=node_modules", path13]);
57924
57996
  assertTransferSize(Number(du.stdout.toString().split(" ")[0]) * 1024, localPath);
57925
- return (0, import_node_child_process2.spawn)("tar", ["-czf", "-", "-C", path12, "--exclude=.git", "--exclude=node_modules", "."], { stdio: ["ignore", "pipe", "pipe"] });
57997
+ return (0, import_node_child_process2.spawn)("tar", ["-czf", "-", "-C", path13, "--exclude=.git", "--exclude=node_modules", "."], { stdio: ["ignore", "pipe", "pipe"] });
57926
57998
  }
57927
- const files = listed.stdout.toString().split("\0").filter((file2) => file2 && (0, import_node_fs3.existsSync)((0, import_node_path3.join)(path12, file2)));
57928
- assertTransferSize(files.reduce((total, file2) => total + (0, import_node_fs3.statSync)((0, import_node_path3.join)(path12, file2)).size, 0), localPath);
57929
- const child = (0, import_node_child_process2.spawn)("tar", ["-czf", "-", "-C", path12, "--null", "-T", "-"], { stdio: ["pipe", "pipe", "pipe"] });
57999
+ const files = listed.stdout.toString().split("\0").filter((file2) => file2 && (0, import_node_fs3.existsSync)((0, import_node_path3.join)(path13, file2)));
58000
+ assertTransferSize(files.reduce((total, file2) => total + (0, import_node_fs3.statSync)((0, import_node_path3.join)(path13, file2)).size, 0), localPath);
58001
+ const child = (0, import_node_child_process2.spawn)("tar", ["-czf", "-", "-C", path13, "--null", "-T", "-"], { stdio: ["pipe", "pipe", "pipe"] });
57930
58002
  child.stdin.end(files.map((file2) => `${file2}\0`).join(""));
57931
58003
  return child;
57932
58004
  }
@@ -58619,6 +58691,12 @@ var init_device = __esm({
58619
58691
  });
58620
58692
 
58621
58693
  // src/commands/theme.ts
58694
+ function parseEnum(value, allowed, label) {
58695
+ if (value === void 0) return void 0;
58696
+ const match = allowed.find((candidate) => candidate === value);
58697
+ if (!match) throw new Error(`Invalid ${label} '${value}'. Choose one of: ${allowed.join(", ")}.`);
58698
+ return match;
58699
+ }
58622
58700
  async function themeGetCommand() {
58623
58701
  print((email3) => `Theme of ${email3}`)(await agentFetch("/v1/engine/theme"));
58624
58702
  }
@@ -58628,10 +58706,48 @@ async function themeSetCommand(options) {
58628
58706
  await agentFetch("/v1/engine/theme", { method: "PUT", body: body2 })
58629
58707
  );
58630
58708
  }
58631
- var print;
58709
+ async function themePublishCommand(options) {
58710
+ if (!options.name?.trim()) throw new Error("Pass --name <name> for the published theme.");
58711
+ const payload = {
58712
+ name: options.name,
58713
+ ...options.description !== void 0 && { description: options.description },
58714
+ ...options.theme !== void 0 && { theme: options.theme },
58715
+ ...options.colorTheme !== void 0 && { palette: options.colorTheme },
58716
+ ...options.accent !== void 0 && { accent: options.accent },
58717
+ ...options.code !== void 0 && { code: options.code },
58718
+ ...options.effect !== void 0 && { effect: parseEnum(options.effect, WALLPAPER_EFFECTS, "wallpaper effect") },
58719
+ ...options.appFont !== void 0 && { app_font: parseEnum(options.appFont, APP_FONTS, "app font") },
58720
+ ...options.codeFont !== void 0 && { code_font: parseEnum(options.codeFont, CODE_FONTS, "code font") },
58721
+ ...options.chatTextSize !== void 0 && { chat_text_size: parseEnum(options.chatTextSize, CHAT_TEXT_SIZES, "chat text size") }
58722
+ };
58723
+ let body2 = payload;
58724
+ if (options.wallpaper) {
58725
+ const resolvedPath = import_node_path7.default.resolve(options.wallpaper);
58726
+ if (!import_node_fs7.default.existsSync(resolvedPath)) throw new Error(`Wallpaper file not found: ${resolvedPath}`);
58727
+ const { mimeType } = classifyCanvasFilename(import_node_path7.default.basename(resolvedPath));
58728
+ if (!IMAGE_MEDIA_TYPES.some((allowed) => allowed === mimeType)) throw new Error("Wallpaper must be a PNG, JPEG, WebP, or GIF image.");
58729
+ const form = new FormData();
58730
+ form.set("data", JSON.stringify(payload));
58731
+ form.set("image", new File([import_node_fs7.default.readFileSync(resolvedPath)], import_node_path7.default.basename(resolvedPath), { type: mimeType }));
58732
+ body2 = form;
58733
+ }
58734
+ const published = await agentFetch("/v1/engine/theme/publish", { method: "POST", body: body2 });
58735
+ output2(published, ({ item, email: email3 }) => {
58736
+ console.log(`Published theme "${item.name}" as ${email3}.`);
58737
+ console.log(`id: ${item.id}`);
58738
+ console.log(`mode: ${item.content.mode}`);
58739
+ console.log(`color theme: ${item.content.colors.palette}`);
58740
+ if (item.content.colors.palette === "custom") console.log(`theme code: ${themeCode(item.content.colors.custom)}`);
58741
+ if (item.content.wallpaper) console.log(`wallpaper: ${item.content.wallpaper.url} (${item.content.wallpaper.effect})`);
58742
+ });
58743
+ }
58744
+ var import_node_fs7, import_node_path7, print;
58632
58745
  var init_theme = __esm({
58633
58746
  "src/commands/theme.ts"() {
58634
58747
  "use strict";
58748
+ import_node_fs7 = __toESM(require("fs"));
58749
+ import_node_path7 = __toESM(require("path"));
58750
+ init_src();
58635
58751
  init_design_tokens();
58636
58752
  init_agent_api();
58637
58753
  init_output();
@@ -59109,6 +59225,7 @@ ${VISUAL_PAGE_RULES}`).action(run(visualizeCommand));
59109
59225
  const theme = program.command("theme").description("The web and desktop app theme of the person who wrote in this workspace");
59110
59226
  theme.command("get").description("Show their theme, color theme and accent").action(run(themeGetCommand));
59111
59227
  theme.command("set").description("Change their theme; their open web and desktop apps repaint on their own").option("--theme <theme>", THEME_PREFERENCES.join(", ")).option("--color-theme <name>", `With --theme dark: ${PALETTE_PRESETS.dark.join(", ")}. With --theme light: ${PALETTE_PRESETS.light.join(", ")}`).option("--accent <color>", `${ACCENT_PRESETS.join(", ")}, or any hex color such as ff5500`).option("--code <code>", "Custom colors as a theme code of three hex colors, background,text,accent, such as 0d1117,e6ecf4,ff5500. The text has to read on the background").action(run(themeSetCommand));
59228
+ theme.command("publish").description("Publish a theme to the Replicas gallery under their account").requiredOption("--name <name>", "Theme name shown in the gallery (max 40 characters)").option("--description <text>", "Optional short description (max 200 characters)").option("--theme <theme>", THEME_PREFERENCES.join(", ")).option("--color-theme <name>", `With --theme dark: ${PALETTE_PRESETS.dark.join(", ")}. With --theme light: ${PALETTE_PRESETS.light.join(", ")}`).option("--accent <color>", `${ACCENT_PRESETS.join(", ")}, or any hex color such as ff5500`).option("--code <code>", "Custom colors as a theme code of three hex colors, background,text,accent, such as 0d1117,e6ecf4,ff5500. The text has to read on the background").option("--wallpaper <path>", "Optional wallpaper image file (PNG, JPEG, WebP, or GIF, under 5 MB)").option("--effect <effect>", `Wallpaper effect: ${WALLPAPER_EFFECTS.join(", ")} (default: soft)`).option("--app-font <font>", `App font: ${APP_FONTS.join(", ")}`).option("--code-font <font>", `Code font: ${CODE_FONTS.join(", ")}`).option("--chat-text-size <size>", `Chat text size: ${CHAT_TEXT_SIZES.join(", ")}`).action(run(themePublishCommand));
59112
59229
  program.command("computer").description("Drive the workspace Linux desktop through replicas-computer");
59113
59230
  const allowed = /* @__PURE__ */ new Set([
59114
59231
  "identity",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "replicas-cli",
3
- "version": "0.3.562",
3
+ "version": "0.3.565",
4
4
  "description": "CLI for managing Replicas workspaces - SSH into cloud dev environments with automatic port forwarding",
5
5
  "main": "dist/index.cjs",
6
6
  "bin": {