@ramme-io/shared 4.4.0 → 4.6.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.
package/dist/index.js CHANGED
@@ -1209,6 +1209,26 @@ var ShelfSchema = z10.object({
1209
1209
  */
1210
1210
  added: z10.array(z10.number().int().nonnegative()).max(SHELF_MAX_APPS).optional()
1211
1211
  });
1212
+ var BOARD_SLEEP_MINUTES = [10, 30, 60, 0];
1213
+ var BOARD_SLEEP_MINUTES_DEFAULT = 10;
1214
+ var BoardSleepMinutesSchema = z10.union([z10.literal(10), z10.literal(30), z10.literal(60), z10.literal(0)]);
1215
+ var BOARD_REMOTE_COMMANDS = [
1216
+ "podcasts",
1217
+ "radio",
1218
+ "music",
1219
+ "snake",
1220
+ "menu",
1221
+ "settings",
1222
+ "home",
1223
+ "next",
1224
+ "quieter",
1225
+ "louder",
1226
+ "sleep"
1227
+ ];
1228
+ var BoardRemoteCommandSchema = z10.enum(BOARD_REMOTE_COMMANDS);
1229
+ var BOARD_REMOTE_PENDING_MAX = 8;
1230
+ var BOARD_REMOTE_TTL_MS = 10 * 6e4;
1231
+ var BoardRemotePressSchema = z10.object({ n: z10.number().int().positive(), do: BoardRemoteCommandSchema });
1212
1232
  var ShelfEditSchema = z10.discriminatedUnion("op", [
1213
1233
  z10.object({ op: z10.literal("show"), deviceId: DeviceIdSchema, index: z10.number().int().min(0) }),
1214
1234
  z10.object({ op: z10.literal("remove"), deviceId: DeviceIdSchema, index: z10.number().int().min(0) }),
@@ -1227,6 +1247,14 @@ var ShelfEditSchema = z10.discriminatedUnion("op", [
1227
1247
  * per-board setting rather than a build.
1228
1248
  */
1229
1249
  z10.object({ op: z10.literal("screen"), deviceId: DeviceIdSchema, invert: z10.boolean() }),
1250
+ /**
1251
+ * How long the board may be left alone on its battery before it sleeps,
1252
+ * 0 for never. Beside the panel setting, and for the same reason: it is
1253
+ * about one board, not the apps on it.
1254
+ */
1255
+ z10.object({ op: z10.literal("sleep"), deviceId: DeviceIdSchema, minutes: BoardSleepMinutesSchema }),
1256
+ /** A press from the page's Remote; see BOARD_REMOTE_COMMANDS. */
1257
+ z10.object({ op: z10.literal("remote"), deviceId: DeviceIdSchema, do: BoardRemoteCommandSchema }),
1230
1258
  /**
1231
1259
  * Remove one entry from the list of apps sent to this board, by the revision
1232
1260
  * it was sent as. The record only: what the board holds is the shelf's
@@ -1235,13 +1263,22 @@ var ShelfEditSchema = z10.discriminatedUnion("op", [
1235
1263
  z10.object({ op: z10.literal("forget"), deviceId: DeviceIdSchema, revision: z10.number().int().min(1) })
1236
1264
  ]);
1237
1265
 
1266
+ // src/apps/library.ts
1267
+ import { z as z11 } from "zod";
1268
+ var SAVED_APPS_MAX = 100;
1269
+ var SavedAppSchema = z11.object({
1270
+ document: AppDocumentSchema,
1271
+ savedAt: z11.number().int().nonnegative(),
1272
+ updatedAt: z11.number().int().nonnegative()
1273
+ });
1274
+
1238
1275
  // src/apps/protocol.ts
1239
- import { z as z12 } from "zod";
1276
+ import { z as z13 } from "zod";
1240
1277
 
1241
1278
  // src/theme/account.ts
1242
- import { z as z11 } from "zod";
1243
- var ThemeRgbSchema = z11.string().regex(/^\d{1,3} \d{1,3} \d{1,3}$/, 'Must be "R G B", e.g. "13 110 253"').refine((v) => v.split(" ").every((n) => Number(n) <= 255), "Each channel is 0\u2013255");
1244
- var ThemePaletteSchema = z11.object({
1279
+ import { z as z12 } from "zod";
1280
+ var ThemeRgbSchema = z12.string().regex(/^\d{1,3} \d{1,3} \d{1,3}$/, 'Must be "R G B", e.g. "13 110 253"').refine((v) => v.split(" ").every((n) => Number(n) <= 255), "Each channel is 0\u2013255");
1281
+ var ThemePaletteSchema = z12.object({
1245
1282
  background: ThemeRgbSchema,
1246
1283
  /** Text. */
1247
1284
  foreground: ThemeRgbSchema,
@@ -1262,21 +1299,21 @@ var THEME_PALETTE_TOKENS = [
1262
1299
  "warning",
1263
1300
  "danger"
1264
1301
  ];
1265
- var ThemeLetteringSchema = z11.enum(["inter", "tay", "pixel"]);
1302
+ var ThemeLetteringSchema = z12.enum(["inter", "tay", "pixel"]);
1266
1303
  var THEME_RADII = ["0rem", "0.25rem", "0.5rem", "0.75rem", "1rem"];
1267
- var WebFontFamilySchema = z11.string().trim().min(1).max(60).regex(/^[A-Za-z0-9 ]+$/);
1268
- var ThemeWebFontsSchema = z11.object({
1304
+ var WebFontFamilySchema = z12.string().trim().min(1).max(60).regex(/^[A-Za-z0-9 ]+$/);
1305
+ var ThemeWebFontsSchema = z12.object({
1269
1306
  heading: WebFontFamilySchema.optional(),
1270
1307
  body: WebFontFamilySchema.optional()
1271
1308
  });
1272
- var AccountThemeSchema = z11.object({
1273
- name: z11.string().trim().min(1).max(40),
1309
+ var AccountThemeSchema = z12.object({
1310
+ name: z12.string().trim().min(1).max(40),
1274
1311
  /** The preset it started from, when it started from one. */
1275
- base: z11.string().max(40).optional(),
1312
+ base: z12.string().max(40).optional(),
1276
1313
  light: ThemePaletteSchema,
1277
1314
  dark: ThemePaletteSchema,
1278
1315
  lettering: ThemeLetteringSchema,
1279
- radius: z11.enum(THEME_RADII),
1316
+ radius: z12.enum(THEME_RADII),
1280
1317
  fonts: ThemeWebFontsSchema.optional()
1281
1318
  });
1282
1319
 
@@ -1309,7 +1346,14 @@ var DEVICE_PROTOCOL = {
1309
1346
  * a local model, ramme.io a metered cloud one. The board sends the same clip
1310
1347
  * to either.
1311
1348
  */
1312
- voice: { method: "POST", path: "/api/device/voice" }
1349
+ voice: { method: "POST", path: "/api/device/voice" },
1350
+ /**
1351
+ * GET `?id=` → 200 `{ shows: [{ t, e: [{ i, t, m }] }] }`: the newest
1352
+ * episodes of each podcast the board follows, `i` naming one and `m` its
1353
+ * minutes. GET `?id=&ep=<i>` → 302 to that episode's MP3, which the board
1354
+ * plays as it plays a station. 404 for an episode it does not follow.
1355
+ */
1356
+ podcasts: { method: "GET", path: "/api/device/podcasts" }
1313
1357
  };
1314
1358
  var DEVICE_VOICE_CLIP = {
1315
1359
  contentType: "audio/wav",
@@ -1320,8 +1364,8 @@ var DEVICE_VOICE_CLIP = {
1320
1364
  /** The 44-byte header plus fifteen seconds of samples. */
1321
1365
  maxBytes: 44 + 16e3 * 2 * 15
1322
1366
  };
1323
- var DeviceVoiceReplySchema = z12.object({
1324
- text: z12.string().max(2e3)
1367
+ var DeviceVoiceReplySchema = z13.object({
1368
+ text: z13.string().max(2e3)
1325
1369
  });
1326
1370
  var DEVICE_POLL_QUERY = {
1327
1371
  id: "the board id (required)",
@@ -1333,20 +1377,25 @@ var DEVICE_POLL_QUERY = {
1333
1377
  rot: "which way it stands, 0\u20133",
1334
1378
  pl: "the palette it draws in, as 42 hex digits",
1335
1379
  fn: "the lettering it draws in",
1380
+ ha: 'the firmware apps it has switched off, ids joined by commas, "-" for none',
1336
1381
  bt: "battery millivolts",
1382
+ sl: 'minutes left alone on battery before it sleeps, "0" for never',
1383
+ rc: 'the number of the last press from its page it carried out, "0" for none',
1337
1384
  u: "what happened to the last update it was asked to install"
1338
1385
  };
1339
- var BoardPaletteHexSchema = z12.string().regex(/^[0-9a-f]{42}$/);
1340
- var BoardFontSchema = z12.union([z12.literal("auto"), ThemeLetteringSchema]);
1341
- var DevicePollReplySchema = z12.object({
1342
- revision: z12.number().int().nonnegative(),
1343
- sentAt: z12.number().int().nonnegative().optional(),
1386
+ var BoardPaletteHexSchema = z13.string().regex(/^[0-9a-f]{42}$/);
1387
+ var BoardFontSchema = z13.union([z13.literal("auto"), ThemeLetteringSchema]);
1388
+ var DevicePollReplySchema = z13.object({
1389
+ revision: z13.number().int().nonnegative(),
1390
+ sentAt: z13.number().int().nonnegative().optional(),
1344
1391
  document: AppDocumentSchema.optional(),
1345
1392
  shelf: ShelfSchema.optional(),
1346
1393
  update: FirmwareUpdateSchema.optional(),
1347
- screen: z12.object({ invert: z12.boolean() }).optional(),
1394
+ screen: z13.object({ invert: z13.boolean(), sleepMinutes: BoardSleepMinutesSchema.optional() }).optional(),
1348
1395
  palette: BoardPaletteHexSchema.optional(),
1349
- font: BoardFontSchema.optional()
1396
+ font: BoardFontSchema.optional(),
1397
+ hiddenApps: z13.string().regex(/^([a-z]+(,[a-z]+)*)?$/).optional(),
1398
+ remote: z13.array(BoardRemotePressSchema).max(BOARD_REMOTE_PENDING_MAX).optional()
1350
1399
  });
1351
1400
 
1352
1401
  // src/apps/deviceFonts.generated.ts
@@ -1354,14 +1403,14 @@ var SMOOTH_FACES = { "inter": { "family": "Inter", "weight": 500, "caps": false
1354
1403
  var SMOOTH_FONT_ADVANCES = { "inter": { "10": { "0": 6, "1": 4, "2": 6, "3": 6, "4": 7, "5": 6, "6": 6, "7": 6, "8": 6, "9": 6, " ": 3, "!": 3, '"': 5, "#": 6, "$": 6, "%": 10, "&": 7, "'": 3, "(": 4, ")": 4, "*": 5, "+": 7, ",": 3, "-": 5, ".": 3, "/": 4, ":": 3, ";": 3, "<": 7, "=": 7, ">": 7, "?": 5, "@": 10, "A": 7, "B": 7, "C": 7, "D": 7, "E": 6, "F": 6, "G": 7, "H": 7, "I": 3, "J": 6, "K": 7, "L": 6, "M": 9, "N": 8, "O": 8, "P": 6, "Q": 8, "R": 6, "S": 6, "T": 7, "U": 7, "V": 7, "W": 10, "X": 7, "Y": 7, "Z": 6, "[": 4, "\\": 4, "]": 4, "^": 5, "_": 5, "`": 3, "a": 6, "b": 6, "c": 6, "d": 6, "e": 6, "f": 4, "g": 6, "h": 6, "i": 3, "j": 3, "k": 6, "l": 3, "m": 9, "n": 6, "o": 6, "p": 6, "q": 6, "r": 4, "s": 5, "t": 3, "u": 6, "v": 6, "w": 8, "x": 6, "y": 6, "z": 6, "{": 4, "|": 3, "}": 4, "~": 7, "\xA0": 3, "\xA1": 3, "\xA2": 6, "\xA3": 6, "\xA5": 6, "\xAA": 5, "\xAB": 6, "\xAC": 7, "\xB0": 5, "\xB1": 7, "\xB2": 4, "\xB5": 6, "\xB7": 3, "\xBA": 5, "\xBB": 6, "\xBC": 8, "\xBD": 9, "\xBF": 5, "\xC4": 7, "\xC5": 7, "\xC6": 10, "\xC7": 7, "\xC9": 6, "\xD1": 8, "\xD6": 8, "\xDC": 7, "\xDF": 6, "\xE0": 6, "\xE1": 6, "\xE2": 6, "\xE4": 6, "\xE5": 6, "\xE6": 9, "\xE7": 6, "\xE8": 6, "\xE9": 6, "\xEA": 6, "\xEB": 6, "\xEC": 3, "\xED": 3, "\xEE": 3, "\xEF": 3, "\xF1": 6, "\xF2": 6, "\xF3": 6, "\xF4": 6, "\xF6": 6, "\xF7": 7, "\xF9": 6, "\xFA": 6, "\xFB": 6, "\xFC": 6, "\xFF": 6, "\u0192": 5, "\u03A9": 8, "\u03C0": 5, "\u2013": 5, "\u2014": 10, "\u2018": 3, "\u2019": 3, "\u201C": 5, "\u201D": 5, "\u2212": 7, "\u221A": 5, "\u221E": 7, "\u2248": 5, "\u2264": 5, "\u2265": 5 }, "12": { "0": 8, "1": 5, "2": 7, "3": 8, "4": 8, "5": 7, "6": 8, "7": 7, "8": 8, "9": 8, " ": 3, "!": 4, '"': 6, "#": 8, "$": 8, "%": 12, "&": 8, "'": 4, "(": 4, ")": 4, "*": 6, "+": 8, ",": 4, "-": 6, ".": 4, "/": 4, ":": 4, ";": 4, "<": 8, "=": 8, ">": 8, "?": 6, "@": 12, "A": 9, "B": 8, "C": 9, "D": 9, "E": 7, "F": 7, "G": 9, "H": 9, "I": 3, "J": 7, "K": 8, "L": 7, "M": 11, "N": 9, "O": 9, "P": 8, "Q": 9, "R": 8, "S": 8, "T": 8, "U": 9, "V": 9, "W": 12, "X": 8, "Y": 8, "Z": 8, "[": 4, "\\": 4, "]": 4, "^": 6, "_": 6, "`": 4, "a": 7, "b": 7, "c": 7, "d": 7, "e": 7, "f": 5, "g": 7, "h": 7, "i": 3, "j": 3, "k": 7, "l": 3, "m": 11, "n": 7, "o": 7, "p": 7, "q": 7, "r": 5, "s": 6, "t": 4, "u": 7, "v": 7, "w": 10, "x": 7, "y": 7, "z": 7, "{": 5, "|": 4, "}": 5, "~": 8, "\xA0": 3, "\xA1": 4, "\xA2": 7, "\xA3": 7, "\xA5": 7, "\xAA": 5, "\xAB": 7, "\xAC": 8, "\xB0": 5, "\xB1": 8, "\xB2": 5, "\xB5": 7, "\xB7": 4, "\xBA": 6, "\xBB": 7, "\xBC": 10, "\xBD": 10, "\xBF": 6, "\xC4": 9, "\xC5": 9, "\xC6": 12, "\xC7": 9, "\xC9": 7, "\xD1": 9, "\xD6": 9, "\xDC": 9, "\xDF": 8, "\xE0": 7, "\xE1": 7, "\xE2": 7, "\xE4": 7, "\xE5": 7, "\xE6": 11, "\xE7": 7, "\xE8": 7, "\xE9": 7, "\xEA": 7, "\xEB": 7, "\xEC": 3, "\xED": 3, "\xEE": 3, "\xEF": 3, "\xF1": 7, "\xF2": 7, "\xF3": 7, "\xF4": 7, "\xF6": 7, "\xF7": 8, "\xF9": 7, "\xFA": 7, "\xFB": 7, "\xFC": 7, "\xFF": 7, "\u0192": 6, "\u03A9": 9, "\u03C0": 7, "\u2013": 6, "\u2014": 12, "\u2018": 3, "\u2019": 3, "\u201C": 6, "\u201D": 6, "\u2212": 8, "\u221A": 7, "\u221E": 9, "\u2248": 7, "\u2264": 7, "\u2265": 7 }, "16": { "0": 10, "1": 7, "2": 10, "3": 10, "4": 11, "5": 10, "6": 10, "7": 9, "8": 10, "9": 10, " ": 4, "!": 5, '"': 8, "#": 10, "$": 10, "%": 16, "&": 10, "'": 5, "(": 6, ")": 6, "*": 8, "+": 11, ",": 5, "-": 7, ".": 5, "/": 6, ":": 5, ";": 5, "<": 11, "=": 11, ">": 11, "?": 8, "@": 16, "A": 11, "B": 11, "C": 12, "D": 12, "E": 10, "F": 9, "G": 12, "H": 12, "I": 4, "J": 9, "K": 11, "L": 9, "M": 15, "N": 12, "O": 12, "P": 10, "Q": 12, "R": 10, "S": 10, "T": 10, "U": 12, "V": 11, "W": 16, "X": 11, "Y": 11, "Z": 10, "[": 6, "\\": 6, "]": 6, "^": 8, "_": 7, "`": 5, "a": 9, "b": 10, "c": 9, "d": 10, "e": 9, "f": 6, "g": 10, "h": 10, "i": 4, "j": 4, "k": 9, "l": 4, "m": 14, "n": 10, "o": 10, "p": 10, "q": 10, "r": 6, "s": 9, "t": 5, "u": 10, "v": 9, "w": 13, "x": 9, "y": 9, "z": 9, "{": 7, "|": 6, "}": 7, "~": 11, "\xA0": 4, "\xA1": 5, "\xA2": 9, "\xA3": 10, "\xA5": 9, "\xAA": 7, "\xAB": 10, "\xAC": 11, "\xB0": 7, "\xB1": 11, "\xB2": 7, "\xB5": 10, "\xB7": 5, "\xBA": 8, "\xBB": 10, "\xBC": 13, "\xBD": 14, "\xBF": 8, "\xC4": 11, "\xC5": 11, "\xC6": 16, "\xC7": 12, "\xC9": 10, "\xD1": 12, "\xD6": 12, "\xDC": 12, "\xDF": 10, "\xE0": 9, "\xE1": 9, "\xE2": 9, "\xE4": 9, "\xE5": 9, "\xE6": 15, "\xE7": 9, "\xE8": 9, "\xE9": 9, "\xEA": 9, "\xEB": 9, "\xEC": 4, "\xED": 4, "\xEE": 4, "\xEF": 4, "\xF1": 10, "\xF2": 10, "\xF3": 10, "\xF4": 10, "\xF6": 10, "\xF7": 11, "\xF9": 10, "\xFA": 10, "\xFB": 10, "\xFC": 10, "\xFF": 9, "\u0192": 8, "\u03A9": 12, "\u03C0": 9, "\u2013": 8, "\u2014": 16, "\u2018": 4, "\u2019": 4, "\u201C": 8, "\u201D": 8, "\u2212": 11, "\u221A": 9, "\u221E": 11, "\u2248": 9, "\u2264": 9, "\u2265": 9 }, "20": { "0": 13, "1": 8, "2": 12, "3": 13, "4": 13, "5": 12, "6": 13, "7": 11, "8": 13, "9": 13, " ": 5, "!": 6, '"': 10, "#": 13, "$": 13, "%": 20, "&": 13, "'": 6, "(": 7, ")": 7, "*": 10, "+": 13, ",": 6, "-": 9, ".": 6, "/": 7, ":": 6, ";": 6, "<": 13, "=": 13, ">": 13, "?": 11, "@": 20, "A": 14, "B": 13, "C": 15, "D": 14, "E": 12, "F": 12, "G": 15, "H": 15, "I": 5, "J": 12, "K": 14, "L": 11, "M": 18, "N": 15, "O": 15, "P": 13, "Q": 15, "R": 13, "S": 13, "T": 13, "U": 15, "V": 14, "W": 20, "X": 14, "Y": 14, "Z": 13, "[": 7, "\\": 7, "]": 7, "^": 10, "_": 9, "`": 7, "a": 11, "b": 12, "c": 12, "d": 12, "e": 12, "f": 8, "g": 12, "h": 12, "i": 5, "j": 5, "k": 11, "l": 5, "m": 18, "n": 12, "o": 12, "p": 12, "q": 12, "r": 8, "s": 11, "t": 7, "u": 12, "v": 11, "w": 17, "x": 11, "y": 12, "z": 11, "{": 9, "|": 7, "}": 9, "~": 13, "\xA0": 5, "\xA1": 6, "\xA2": 12, "\xA3": 12, "\xA5": 11, "\xAA": 9, "\xAB": 12, "\xAC": 13, "\xB0": 9, "\xB1": 13, "\xB2": 9, "\xB5": 12, "\xB7": 6, "\xBA": 10, "\xBB": 12, "\xBC": 16, "\xBD": 17, "\xBF": 11, "\xC4": 14, "\xC5": 14, "\xC6": 20, "\xC7": 15, "\xC9": 12, "\xD1": 15, "\xD6": 15, "\xDC": 15, "\xDF": 13, "\xE0": 11, "\xE1": 11, "\xE2": 11, "\xE4": 11, "\xE5": 11, "\xE6": 18, "\xE7": 12, "\xE8": 12, "\xE9": 12, "\xEA": 12, "\xEB": 12, "\xEC": 5, "\xED": 5, "\xEE": 5, "\xEF": 5, "\xF1": 12, "\xF2": 12, "\xF3": 12, "\xF4": 12, "\xF6": 12, "\xF7": 13, "\xF9": 12, "\xFA": 12, "\xFB": 12, "\xFC": 12, "\xFF": 12, "\u0192": 10, "\u03A9": 15, "\u03C0": 11, "\u2013": 10, "\u2014": 20, "\u2018": 6, "\u2019": 6, "\u201C": 9, "\u201D": 9, "\u2212": 13, "\u221A": 11, "\u221E": 14, "\u2248": 11, "\u2264": 11, "\u2265": 11 }, "28": { "0": 18, "1": 12, "2": 17, "3": 18, "4": 18, "5": 17, "6": 18, "7": 16, "8": 18, "9": 18, " ": 7, "!": 9, '"': 14, "#": 18, "$": 18, "%": 28, "&": 18, "'": 9, "(": 10, ")": 10, "*": 15, "+": 19, ",": 8, "-": 13, ".": 8, "/": 10, ":": 8, ";": 9, "<": 19, "=": 19, ">": 19, "?": 15, "@": 28, "A": 20, "B": 18, "C": 21, "D": 20, "E": 17, "F": 17, "G": 21, "H": 21, "I": 8, "J": 16, "K": 19, "L": 16, "M": 26, "N": 21, "O": 21, "P": 18, "Q": 22, "R": 18, "S": 18, "T": 18, "U": 21, "V": 20, "W": 28, "X": 20, "Y": 19, "Z": 18, "[": 10, "\\": 10, "]": 10, "^": 13, "_": 13, "`": 9, "a": 16, "b": 17, "c": 16, "d": 17, "e": 16, "f": 11, "g": 17, "h": 17, "i": 7, "j": 7, "k": 16, "l": 7, "m": 25, "n": 17, "o": 17, "p": 17, "q": 17, "r": 11, "s": 15, "t": 10, "u": 17, "v": 16, "w": 23, "x": 16, "y": 16, "z": 16, "{": 12, "|": 10, "}": 12, "~": 19, "\xA0": 7, "\xA1": 9, "\xA2": 16, "\xA3": 17, "\xA5": 16, "\xAA": 13, "\xAB": 17, "\xAC": 19, "\xB0": 13, "\xB1": 19, "\xB2": 13, "\xB5": 17, "\xB7": 8, "\xBA": 14, "\xBB": 17, "\xBC": 23, "\xBD": 24, "\xBF": 15, "\xC4": 20, "\xC5": 20, "\xC6": 28, "\xC7": 21, "\xC9": 17, "\xD1": 21, "\xD6": 21, "\xDC": 21, "\xDF": 18, "\xE0": 16, "\xE1": 16, "\xE2": 16, "\xE4": 16, "\xE5": 16, "\xE6": 26, "\xE7": 16, "\xE8": 16, "\xE9": 16, "\xEA": 16, "\xEB": 16, "\xEC": 7, "\xED": 7, "\xEE": 7, "\xEF": 7, "\xF1": 17, "\xF2": 17, "\xF3": 17, "\xF4": 17, "\xF6": 17, "\xF7": 19, "\xF9": 17, "\xFA": 17, "\xFB": 17, "\xFC": 17, "\xFF": 16, "\u0192": 14, "\u03A9": 22, "\u03C0": 15, "\u2013": 14, "\u2014": 28, "\u2018": 8, "\u2019": 8, "\u201C": 13, "\u201D": 13, "\u2212": 19, "\u221A": 15, "\u221E": 20, "\u2248": 15, "\u2264": 15, "\u2265": 15 }, "56": { "0": 36, "1": 23, "2": 35, "3": 35, "4": 37, "5": 34, "6": 35, "7": 32, "8": 35, "9": 35, " ": 15, "!": 17, '"': 28, "#": 36, "$": 36, "%": 56, "&": 37, "'": 18, "(": 21, ")": 21, "*": 29, "+": 37, ",": 17, "-": 26, ".": 17, "/": 21, ":": 17, ";": 18, "<": 37, "=": 37, ">": 37, "?": 30, "@": 55, "A": 40, "B": 37, "C": 41, "D": 40, "E": 34, "F": 33, "G": 42, "H": 42, "I": 15, "J": 32, "K": 39, "L": 32, "M": 51, "N": 42, "O": 43, "P": 36, "Q": 43, "R": 36, "S": 36, "T": 37, "U": 41, "V": 40, "W": 56, "X": 39, "Y": 39, "Z": 36, "[": 21, "\\": 21, "]": 21, "^": 27, "_": 26, "`": 19, "a": 32, "b": 35, "c": 32, "d": 35, "e": 33, "f": 21, "g": 35, "h": 34, "i": 14, "j": 14, "k": 31, "l": 14, "m": 50, "n": 34, "o": 34, "p": 35, "q": 35, "r": 22, "s": 30, "t": 19, "u": 34, "v": 32, "w": 46, "x": 31, "y": 32, "z": 31, "{": 25, "|": 19, "}": 25, "~": 37, "\xB0": 26 } }, "tay": { "28": { "0": 29, "1": 16, "2": 28, "3": 28, "4": 30, "5": 27, "6": 28, "7": 26, "8": 29, "9": 29, " ": 12, "!": 16, '"': 12, "#": 27, "$": 27, "%": 29, "&": 33, "'": 9, "(": 20, ")": 20, "*": 14, "+": 21, ",": 10, "-": 16, ".": 10, "/": 19, ":": 13, ";": 12, "<": 18, "=": 22, ">": 18, "?": 27, "@": 31, "A": 28, "B": 32, "C": 28, "D": 30, "E": 30, "F": 29, "G": 29, "H": 32, "I": 16, "J": 27, "K": 29, "L": 27, "M": 36, "N": 32, "O": 29, "P": 30, "Q": 30, "R": 30, "S": 29, "T": 31, "U": 29, "V": 28, "W": 40, "X": 29, "Y": 29, "Z": 30, "[": 17, "\\": 19, "]": 17, "^": 13, "_": 19, "`": 9, "{": 13, "|": 6, "}": 13, "~": 15, "\xA0": 8, "\xA1": 15, "\xA2": 14, "\xA3": 26, "\xA5": 31, "\xAA": 8, "\xAB": 14, "\xAC": 16, "\xB0": 14, "\xB1": 15, "\xB2": 8, "\xB7": 7, "\xBA": 9, "\xBB": 14, "\xBC": 21, "\xBD": 21, "\xBF": 26, "\xC4": 28, "\xC5": 28, "\xC6": 25, "\xC7": 28, "\xC9": 30, "\xD1": 32, "\xD6": 29, "\xDC": 29, "\xF7": 15, "\u03A9": 22, "\u2013": 14, "\u2014": 28, "\u2018": 9, "\u2019": 9, "\u201C": 12, "\u201D": 12, "\u2212": 16, "\u221A": 15, "\u221E": 20, "\u2248": 15, "\u2264": 15, "\u2265": 15 }, "56": { "0": 58, "1": 33, "2": 56, "3": 57, "4": 60, "5": 55, "6": 57, "7": 51, "8": 58, "9": 59, " ": 24, "!": 32, '"': 23, "#": 55, "$": 55, "%": 59, "&": 66, "'": 18, "(": 39, ")": 39, "*": 28, "+": 43, ",": 20, "-": 31, ".": 20, "/": 38, ":": 26, ";": 23, "<": 37, "=": 44, ">": 37, "?": 54, "@": 61, "A": 56, "B": 63, "C": 56, "D": 60, "E": 60, "F": 58, "G": 58, "H": 63, "I": 33, "J": 55, "K": 58, "L": 53, "M": 72, "N": 65, "O": 59, "P": 60, "Q": 59, "R": 61, "S": 58, "T": 62, "U": 58, "V": 56, "W": 79, "X": 58, "Y": 58, "Z": 59, "[": 34, "\\": 38, "]": 34, "^": 26, "_": 39, "`": 19, "{": 27, "|": 11, "}": 27, "~": 30, "\xB0": 27 } } };
1355
1404
 
1356
1405
  // src/ai/tools.ts
1357
- import { z as z13 } from "zod";
1358
- var telemetryGraphParameters = z13.object({
1359
- deviceId: z13.string().min(1, "Device ID is required"),
1360
- timeRange: z13.enum(["1h", "24h", "7d"], {
1406
+ import { z as z14 } from "zod";
1407
+ var telemetryGraphParameters = z14.object({
1408
+ deviceId: z14.string().min(1, "Device ID is required"),
1409
+ timeRange: z14.enum(["1h", "24h", "7d"], {
1361
1410
  errorMap: () => ({ message: "Time range must be 1h, 24h, or 7d" })
1362
1411
  }),
1363
- metrics: z13.array(
1364
- z13.enum(["temperature", "humidity", "vwc", "ec", "ph", "pressure", "co2"])
1412
+ metrics: z14.array(
1413
+ z14.enum(["temperature", "humidity", "vwc", "ec", "ph", "pressure", "co2"])
1365
1414
  ).min(1, "At least one metric is required").max(4, "Maximum 4 metrics per graph")
1366
1415
  });
1367
1416
  var AI_TOOLS = {
@@ -1738,12 +1787,12 @@ RULES
1738
1787
  var APP_DOCUMENT_EDIT_PREFIX = "Here is the current app. Change only what is asked:";
1739
1788
 
1740
1789
  // src/theme/schema.ts
1741
- import { z as z14 } from "zod";
1742
- var RGBString = z14.string().regex(
1790
+ import { z as z15 } from "zod";
1791
+ var RGBString = z15.string().regex(
1743
1792
  /^\d{1,3}\s+\d{1,3}\s+\d{1,3}$/,
1744
1793
  'Must be space-separated RGB integers (e.g. "13 110 253")'
1745
1794
  );
1746
- var ThemeOverridesSchema = z14.object({
1795
+ var ThemeOverridesSchema = z15.object({
1747
1796
  // ── Core Brand ───────────────────────────────────────────────────────────
1748
1797
  "--app-primary-color": RGBString.optional(),
1749
1798
  "--app-primary-foreground-color": RGBString.optional(),
@@ -1759,9 +1808,9 @@ var ThemeOverridesSchema = z14.object({
1759
1808
  "--app-muted-bg": RGBString.optional(),
1760
1809
  "--app-muted-text": RGBString.optional(),
1761
1810
  // ── Shape ────────────────────────────────────────────────────────────────
1762
- "--app-border-radius-sm": z14.string().optional(),
1763
- "--app-border-radius-md": z14.string().optional(),
1764
- "--app-border-radius-lg": z14.string().optional(),
1811
+ "--app-border-radius-sm": z15.string().optional(),
1812
+ "--app-border-radius-md": z15.string().optional(),
1813
+ "--app-border-radius-lg": z15.string().optional(),
1765
1814
  // ── Form Controls ────────────────────────────────────────────────────────
1766
1815
  "--app-input-bg-color": RGBString.optional(),
1767
1816
  "--app-input-text-color": RGBString.optional(),
@@ -1775,19 +1824,19 @@ var ThemeOverridesSchema = z14.object({
1775
1824
  "--app-chart-4": RGBString.optional(),
1776
1825
  "--app-chart-5": RGBString.optional()
1777
1826
  }).strict();
1778
- var ThemeFontsSchema = z14.object({
1827
+ var ThemeFontsSchema = z15.object({
1779
1828
  /** Google Font name for headings (h1–h4, .font-serif). Example: "Playfair Display" */
1780
- heading: z14.string(),
1829
+ heading: z15.string(),
1781
1830
  /** Google Font name for body text. Example: "Inter" */
1782
- body: z14.string(),
1831
+ body: z15.string(),
1783
1832
  /** Optional monospace font. Example: "Roboto Mono" */
1784
- mono: z14.string().optional()
1833
+ mono: z15.string().optional()
1785
1834
  });
1786
- var AIThemeSchema = z14.object({
1835
+ var AIThemeSchema = z15.object({
1787
1836
  /** Short descriptive theme name. Example: "Midnight Garden" */
1788
- name: z14.string(),
1837
+ name: z15.string(),
1789
1838
  /** One-sentence vibe description. Example: "Dark indigo with golden accents." */
1790
- description: z14.string(),
1839
+ description: z15.string(),
1791
1840
  /** Google Font pairing for heading and body text. */
1792
1841
  fonts: ThemeFontsSchema.optional(),
1793
1842
  /**
@@ -1798,13 +1847,13 @@ var AIThemeSchema = z14.object({
1798
1847
  cssVars: ThemeOverridesSchema
1799
1848
  });
1800
1849
  var THEME_PRESETS = ["light", "dark", "system", "corporate", "midnight", "blueprint", "markets"];
1801
- var ThemeTokensSchema = z14.object({
1850
+ var ThemeTokensSchema = z15.object({
1802
1851
  primary: RGBString,
1803
1852
  neutral: RGBString,
1804
1853
  success: RGBString,
1805
1854
  warning: RGBString,
1806
1855
  destructive: RGBString,
1807
- radius: z14.enum(["none", "sm", "md", "lg", "full"])
1856
+ radius: z15.enum(["none", "sm", "md", "lg", "full"])
1808
1857
  });
1809
1858
  var DEFAULT_THEME_TOKENS = {
1810
1859
  primary: "13 110 253",
@@ -1826,12 +1875,12 @@ var CONTROL_STATE_MEANINGS = {
1826
1875
  };
1827
1876
 
1828
1877
  // src/enclosures/schema.ts
1829
- import { z as z15 } from "zod";
1830
- var Mm = z15.number().finite();
1878
+ import { z as z16 } from "zod";
1879
+ var Mm = z16.number().finite();
1831
1880
  var PositiveMm = Mm.positive();
1832
1881
  var NonNegativeMm = Mm.nonnegative();
1833
- var PrinterProfileSchema = z15.object({
1834
- name: z15.string().min(1).default("Bambu Lab X1 Carbon"),
1882
+ var PrinterProfileSchema = z16.object({
1883
+ name: z16.string().min(1).default("Bambu Lab X1 Carbon"),
1835
1884
  /** Walls are whole multiples of this. */
1836
1885
  nozzle: PositiveMm.default(0.4),
1837
1886
  /** Gap for parts that slide together: the case's lip, a lid. */
@@ -1839,32 +1888,32 @@ var PrinterProfileSchema = z15.object({
1839
1888
  /** Gap for a friction fit. */
1840
1889
  clearance_press: NonNegativeMm.default(0.1)
1841
1890
  });
1842
- var EdgeSchema = z15.enum(["east", "west", "north", "south", "top", "bottom"]);
1843
- var FlexButtonSchema = z15.object({
1891
+ var EdgeSchema = z16.enum(["east", "west", "north", "south", "top", "bottom"]);
1892
+ var FlexButtonSchema = z16.object({
1844
1893
  /** The tongue's length, from its free end to where it joins the floor. */
1845
1894
  length: PositiveMm.default(12),
1846
1895
  /** Its width. */
1847
1896
  width: PositiveMm.default(5),
1848
1897
  /** The way from the switch to where the tongue joins the floor. */
1849
- hinge: z15.enum(["east", "west", "north", "south"])
1898
+ hinge: z16.enum(["east", "west", "north", "south"])
1850
1899
  });
1851
- var InterfaceSchema = z15.object({
1900
+ var InterfaceSchema = z16.object({
1852
1901
  /** usb_c, screen, reset_button, status_led, sd_card… */
1853
- name: z15.string().min(1),
1902
+ name: z16.string().min(1),
1854
1903
  edge: EdgeSchema,
1855
1904
  /** From the centre of that face — see COORDINATES above. */
1856
- offset_from_center: z15.tuple([Mm, Mm]).default([0, 0]),
1905
+ offset_from_center: z16.tuple([Mm, Mm]).default([0, 0]),
1857
1906
  /**
1858
1907
  * A grille is a field of small round holes filling an ellipse of
1859
1908
  * `cutout_size` — a speaker's — on a top or bottom face only.
1860
1909
  */
1861
- cutout_shape: z15.enum(["rect", "rounded_rect", "circle", "grille"]),
1910
+ cutout_shape: z16.enum(["rect", "rounded_rect", "circle", "grille"]),
1862
1911
  /** [width, height] of the opening, including room for a plug's boot. A circle uses the first as its diameter. */
1863
- cutout_size: z15.tuple([PositiveMm, PositiveMm]),
1912
+ cutout_size: z16.tuple([PositiveMm, PositiveMm]),
1864
1913
  /** How far the part sticks out past the component's edge. */
1865
1914
  protrusion: NonNegativeMm.default(0),
1866
1915
  /** A wider recess on the outside face, [width, height, depth], for a thick cable boot. */
1867
- outer_recess: z15.tuple([PositiveMm, PositiveMm, PositiveMm]).optional(),
1916
+ outer_recess: z16.tuple([PositiveMm, PositiveMm, PositiveMm]).optional(),
1868
1917
  /** Press it through the floor instead of opening a hole — see FlexButtonSchema. */
1869
1918
  flex_button: FlexButtonSchema.optional(),
1870
1919
  /**
@@ -1875,31 +1924,31 @@ var InterfaceSchema = z15.object({
1875
1924
  */
1876
1925
  chamfer: NonNegativeMm.optional()
1877
1926
  });
1878
- var MountHolesSchema = z15.object({
1927
+ var MountHolesSchema = z16.object({
1879
1928
  /** Four holes, this far in from each corner: [east-west, north-south]. */
1880
- inset_from_corners: z15.tuple([PositiveMm, PositiveMm]).optional(),
1929
+ inset_from_corners: z16.tuple([PositiveMm, PositiveMm]).optional(),
1881
1930
  /** Or exactly where they are: [east, north] from the footprint centre. */
1882
- positions: z15.array(z15.tuple([Mm, Mm])).min(1).optional(),
1883
- thread: z15.enum(["M2", "M2.5", "M3"]),
1931
+ positions: z16.array(z16.tuple([Mm, Mm])).min(1).optional(),
1932
+ thread: z16.enum(["M2", "M2.5", "M3"]),
1884
1933
  /** Heat-set insert outer diameter and depth. split_shell_lip only: tray_bezel's screws cut their own thread. */
1885
1934
  insert_od: PositiveMm.optional(),
1886
1935
  insert_depth: PositiveMm.optional()
1887
1936
  }).refine((m) => (m.inset_from_corners ? 1 : 0) + (m.positions ? 1 : 0) === 1, {
1888
1937
  message: "give either inset_from_corners or positions, not both or neither"
1889
1938
  });
1890
- var PlacementSchema = z15.object({
1891
- relative_to: z15.string().min(1),
1892
- where: z15.enum(["below", "above", "east", "west", "north", "south"]),
1939
+ var PlacementSchema = z16.object({
1940
+ relative_to: z16.string().min(1),
1941
+ where: z16.enum(["below", "above", "east", "west", "north", "south"]),
1893
1942
  /** Space between the two keep-outs. */
1894
1943
  gap: NonNegativeMm.default(1),
1895
1944
  /** Moved this far [east, north] from centred on the other, once placed. */
1896
- offset: z15.tuple([Mm, Mm]).default([0, 0])
1945
+ offset: z16.tuple([Mm, Mm]).default([0, 0])
1897
1946
  });
1898
- var ComponentSchema = z15.object({
1899
- id: z15.string().regex(/^[a-z][a-z0-9_]*$/, "lowercase letters, digits and underscores"),
1900
- type: z15.enum(["pcb", "display", "battery", "speaker", "module"]),
1947
+ var ComponentSchema = z16.object({
1948
+ id: z16.string().regex(/^[a-z][a-z0-9_]*$/, "lowercase letters, digits and underscores"),
1949
+ type: z16.enum(["pcb", "display", "battery", "speaker", "module"]),
1901
1950
  /** [east, north, up] — see COORDINATES. */
1902
- dimensions: z15.tuple([PositiveMm, PositiveMm, PositiveMm]),
1951
+ dimensions: z16.tuple([PositiveMm, PositiveMm, PositiveMm]),
1903
1952
  /**
1904
1953
  * Radius of the footprint's corners: most boards are rounded. The case's
1905
1954
  * inside corners follow it, so a rounded board gets a rounded tray without
@@ -1912,23 +1961,23 @@ var ComponentSchema = z15.object({
1912
1961
  /** Height of what is underneath (solder joints, a microSD socket), kept clear. */
1913
1962
  clearance_z_bottom: NonNegativeMm.default(0),
1914
1963
  /** Quarter turns about Z, applied before placement. */
1915
- rotation: z15.union([z15.literal(0), z15.literal(90), z15.literal(180), z15.literal(270)]).default(0),
1964
+ rotation: z16.union([z16.literal(0), z16.literal(90), z16.literal(180), z16.literal(270)]).default(0),
1916
1965
  placement: PlacementSchema.optional(),
1917
1966
  mount_holes: MountHolesSchema.optional(),
1918
- interfaces: z15.array(InterfaceSchema).default([]),
1967
+ interfaces: z16.array(InterfaceSchema).default([]),
1919
1968
  /** How it is held if it has no screw holes. */
1920
- retention: z15.enum(["none", "cradle_ribs"]).default("none")
1969
+ retention: z16.enum(["none", "cradle_ribs"]).default("none")
1921
1970
  });
1922
- var EmblemSchema = z15.object({
1971
+ var EmblemSchema = z16.object({
1923
1972
  /** The SVG file, relative to the manifest. Filled paths only; strokes are ignored. */
1924
- svg: z15.string().min(1),
1925
- face: z15.enum(["top", "bottom"]).default("bottom"),
1973
+ svg: z16.string().min(1),
1974
+ face: z16.enum(["top", "bottom"]).default("bottom"),
1926
1975
  /** Height of the mark on the face, along north. Its width follows the SVG's proportions. */
1927
1976
  height: PositiveMm,
1928
1977
  /** How deep it is pressed in. */
1929
1978
  depth: PositiveMm.default(0.6),
1930
1979
  /** From the centre of the case's footprint, [east, north]. */
1931
- offset: z15.tuple([Mm, Mm]).default([0, 0]),
1980
+ offset: z16.tuple([Mm, Mm]).default([0, 0]),
1932
1981
  /**
1933
1982
  * Cut it right through the face instead, as a stencil — a speaker's grille
1934
1983
  * in the shape of the mark. Whatever its lines enclose would fall out, so
@@ -1938,14 +1987,14 @@ var EmblemSchema = z15.object({
1938
1987
  * (STENCIL_SPECK) are cut away; a larger one with no bridge fails the fit
1939
1988
  * check, by where it is.
1940
1989
  */
1941
- stencil: z15.object({
1942
- bridges: z15.array(z15.object({ at: z15.tuple([Mm, Mm]), angle: z15.number().default(0), length: PositiveMm.default(3) })).default([])
1990
+ stencil: z16.object({
1991
+ bridges: z16.array(z16.object({ at: z16.tuple([Mm, Mm]), angle: z16.number().default(0), length: PositiveMm.default(3) })).default([])
1943
1992
  }).optional()
1944
1993
  });
1945
- var HardwareManifestSchema = z15.object({
1946
- project: z15.string().regex(/^[a-z0-9][a-z0-9_-]*$/, "lowercase, digits, - and _"),
1994
+ var HardwareManifestSchema = z16.object({
1995
+ project: z16.string().regex(/^[a-z0-9][a-z0-9_-]*$/, "lowercase, digits, - and _"),
1947
1996
  /** How the case goes together — see TWO STYLES above. */
1948
- enclosure_style: z15.enum(["split_shell_lip", "tray_bezel"]).default("split_shell_lip"),
1997
+ enclosure_style: z16.enum(["split_shell_lip", "tray_bezel"]).default("split_shell_lip"),
1949
1998
  wall_thickness: PositiveMm.default(2.4),
1950
1999
  /**
1951
2000
  * Thicker walls on chosen sides, in place of `wall_thickness` there. A
@@ -1954,7 +2003,7 @@ var HardwareManifestSchema = z15.object({
1954
2003
  * black ESP32-S3 board's flush case, 2026-10-25). Each is a whole number
1955
2004
  * of nozzle lines, and no thinner than `wall_thickness`.
1956
2005
  */
1957
- walls: z15.object({ east: PositiveMm, west: PositiveMm, north: PositiveMm, south: PositiveMm }).partial().default({}),
2006
+ walls: z16.object({ east: PositiveMm, west: PositiveMm, north: PositiveMm, south: PositiveMm }).partial().default({}),
1958
2007
  /** Radius of the vertical outside corners. */
1959
2008
  corner_radius: NonNegativeMm.default(2),
1960
2009
  /**
@@ -1963,19 +2012,19 @@ var HardwareManifestSchema = z15.object({
1963
2012
  * rounds every edge the bevel leaves, so nothing on the outside is sharp.
1964
2013
  * Without it they are square, and a case reads as a printed box.
1965
2014
  */
1966
- edges: z15.object({
1967
- style: z15.enum(["chamfer", "round"]),
2015
+ edges: z16.object({
2016
+ style: z16.enum(["chamfer", "round"]),
1968
2017
  size: PositiveMm,
1969
2018
  soften: NonNegativeMm.default(0)
1970
2019
  }).optional(),
1971
2020
  printer: PrinterProfileSchema.default({}),
1972
- components: z15.array(ComponentSchema).min(1),
2021
+ components: z16.array(ComponentSchema).min(1),
1973
2022
  emblem: EmblemSchema.optional()
1974
2023
  }).superRefine((m, ctx) => {
1975
2024
  const lines = m.wall_thickness / m.printer.nozzle;
1976
2025
  if (Math.abs(lines - Math.round(lines)) > 1e-6) {
1977
2026
  ctx.addIssue({
1978
- code: z15.ZodIssueCode.custom,
2027
+ code: z16.ZodIssueCode.custom,
1979
2028
  path: ["wall_thickness"],
1980
2029
  message: `${m.wall_thickness}mm is not a whole number of ${m.printer.nozzle}mm lines \u2014 try ${(Math.round(lines) * m.printer.nozzle).toFixed(2)}`
1981
2030
  });
@@ -1985,14 +2034,14 @@ var HardwareManifestSchema = z15.object({
1985
2034
  const n = t / m.printer.nozzle;
1986
2035
  if (Math.abs(n - Math.round(n)) > 1e-6) {
1987
2036
  ctx.addIssue({
1988
- code: z15.ZodIssueCode.custom,
2037
+ code: z16.ZodIssueCode.custom,
1989
2038
  path: ["walls", side],
1990
2039
  message: `${t}mm is not a whole number of ${m.printer.nozzle}mm lines \u2014 try ${(Math.round(n) * m.printer.nozzle).toFixed(2)}`
1991
2040
  });
1992
2041
  }
1993
2042
  if (t < m.wall_thickness) {
1994
2043
  ctx.addIssue({
1995
- code: z15.ZodIssueCode.custom,
2044
+ code: z16.ZodIssueCode.custom,
1996
2045
  path: ["walls", side],
1997
2046
  message: `${t}mm is thinner than wall_thickness (${m.wall_thickness}mm): walls only thicken on chosen sides`
1998
2047
  });
@@ -2001,13 +2050,13 @@ var HardwareManifestSchema = z15.object({
2001
2050
  const ids = m.components.map((c) => c.id);
2002
2051
  ids.forEach((id, i) => {
2003
2052
  if (ids.indexOf(id) !== i) {
2004
- ctx.addIssue({ code: z15.ZodIssueCode.custom, path: ["components", i, "id"], message: `"${id}" is used twice` });
2053
+ ctx.addIssue({ code: z16.ZodIssueCode.custom, path: ["components", i, "id"], message: `"${id}" is used twice` });
2005
2054
  }
2006
2055
  });
2007
2056
  const roots = m.components.filter((c) => !c.placement);
2008
2057
  if (roots.length !== 1) {
2009
2058
  ctx.addIssue({
2010
- code: z15.ZodIssueCode.custom,
2059
+ code: z16.ZodIssueCode.custom,
2011
2060
  path: ["components"],
2012
2061
  message: `exactly one component must have no placement (the origin); found ${roots.length}: ${roots.map((r) => r.id).join(", ") || "none"}`
2013
2062
  });
@@ -2017,13 +2066,13 @@ var HardwareManifestSchema = z15.object({
2017
2066
  if (!c.placement) return;
2018
2067
  const target = c.placement.relative_to;
2019
2068
  if (!byId.has(target)) {
2020
- ctx.addIssue({ code: z15.ZodIssueCode.custom, path: ["components", i, "placement", "relative_to"], message: `no component "${target}"` });
2069
+ ctx.addIssue({ code: z16.ZodIssueCode.custom, path: ["components", i, "placement", "relative_to"], message: `no component "${target}"` });
2021
2070
  return;
2022
2071
  }
2023
2072
  const seen = /* @__PURE__ */ new Set([c.id]);
2024
2073
  for (let at = byId.get(target); at?.placement; at = byId.get(at.placement.relative_to)) {
2025
2074
  if (seen.has(at.id)) {
2026
- ctx.addIssue({ code: z15.ZodIssueCode.custom, path: ["components", i, "placement"], message: `placement loops back to "${at.id}"` });
2075
+ ctx.addIssue({ code: z16.ZodIssueCode.custom, path: ["components", i, "placement"], message: `placement loops back to "${at.id}"` });
2027
2076
  return;
2028
2077
  }
2029
2078
  seen.add(at.id);
@@ -2031,139 +2080,139 @@ var HardwareManifestSchema = z15.object({
2031
2080
  });
2032
2081
  m.components.forEach((c, i) => {
2033
2082
  if (m.enclosure_style === "split_shell_lip" && c.mount_holes && (!c.mount_holes.insert_od || !c.mount_holes.insert_depth)) {
2034
- ctx.addIssue({ code: z15.ZodIssueCode.custom, path: ["components", i, "mount_holes"], message: "a split_shell_lip case holds boards on heat-set inserts: give insert_od and insert_depth" });
2083
+ ctx.addIssue({ code: z16.ZodIssueCode.custom, path: ["components", i, "mount_holes"], message: "a split_shell_lip case holds boards on heat-set inserts: give insert_od and insert_depth" });
2035
2084
  }
2036
2085
  c.interfaces.forEach((f, j) => {
2037
2086
  if (f.chamfer && f.edge !== "top" && f.edge !== "bottom") {
2038
- ctx.addIssue({ code: z15.ZodIssueCode.custom, path: ["components", i, "interfaces", j, "chamfer"], message: `a chamfer ramps an opening in the bezel or the floor: its edge must be top or bottom, not ${f.edge}` });
2087
+ ctx.addIssue({ code: z16.ZodIssueCode.custom, path: ["components", i, "interfaces", j, "chamfer"], message: `a chamfer ramps an opening in the bezel or the floor: its edge must be top or bottom, not ${f.edge}` });
2039
2088
  }
2040
2089
  if (f.cutout_shape === "grille" && f.edge !== "top" && f.edge !== "bottom") {
2041
- ctx.addIssue({ code: z15.ZodIssueCode.custom, path: ["components", i, "interfaces", j, "cutout_shape"], message: `a grille is a field of holes in the bezel or the floor: its edge must be top or bottom, not ${f.edge}` });
2090
+ ctx.addIssue({ code: z16.ZodIssueCode.custom, path: ["components", i, "interfaces", j, "cutout_shape"], message: `a grille is a field of holes in the bezel or the floor: its edge must be top or bottom, not ${f.edge}` });
2042
2091
  }
2043
2092
  if (f.flex_button && f.edge !== "bottom") {
2044
- ctx.addIssue({ code: z15.ZodIssueCode.custom, path: ["components", i, "interfaces", j, "flex_button"], message: `a flex button is pressed through the floor: its edge must be bottom, not ${f.edge}` });
2093
+ ctx.addIssue({ code: z16.ZodIssueCode.custom, path: ["components", i, "interfaces", j, "flex_button"], message: `a flex button is pressed through the floor: its edge must be bottom, not ${f.edge}` });
2045
2094
  }
2046
2095
  });
2047
2096
  const [x, y] = c.dimensions;
2048
2097
  c.mount_holes?.positions?.forEach((p, j) => {
2049
2098
  if (Math.abs(p[0]) > x / 2 || Math.abs(p[1]) > y / 2) {
2050
- ctx.addIssue({ code: z15.ZodIssueCode.custom, path: ["components", i, "mount_holes", "positions", j], message: `hole at [${p}] is outside the ${x}\xD7${y} footprint` });
2099
+ ctx.addIssue({ code: z16.ZodIssueCode.custom, path: ["components", i, "mount_holes", "positions", j], message: `hole at [${p}] is outside the ${x}\xD7${y} footprint` });
2051
2100
  }
2052
2101
  });
2053
2102
  const inset = c.mount_holes?.inset_from_corners;
2054
2103
  if (inset && (inset[0] * 2 >= x || inset[1] * 2 >= y)) {
2055
- ctx.addIssue({ code: z15.ZodIssueCode.custom, path: ["components", i, "mount_holes", "inset_from_corners"], message: `insets [${inset}] meet in the middle of a ${x}\xD7${y} footprint` });
2104
+ ctx.addIssue({ code: z16.ZodIssueCode.custom, path: ["components", i, "mount_holes", "inset_from_corners"], message: `insets [${inset}] meet in the middle of a ${x}\xD7${y} footprint` });
2056
2105
  }
2057
2106
  });
2058
2107
  });
2059
- var FamilyChoiceSchema = z15.object({
2060
- label: z15.string().min(1),
2108
+ var FamilyChoiceSchema = z16.object({
2109
+ label: z16.string().min(1),
2061
2110
  /** One sentence: what it is for. */
2062
- description: z15.string().optional(),
2111
+ description: z16.string().optional(),
2063
2112
  /** Components added to the base manifest's. */
2064
- components: z15.array(ComponentSchema).default([]),
2113
+ components: z16.array(ComponentSchema).default([]),
2065
2114
  /** Top-level manifest fields this choice sets: wall_thickness, emblem… */
2066
- set: z15.record(z15.unknown()).default({}),
2115
+ set: z16.record(z16.unknown()).default({}),
2067
2116
  /**
2068
2117
  * Changes to the base's own components, by id: fields to set, null to
2069
2118
  * remove one, and `interfaces` by name the same way — a null interface is
2070
2119
  * removed, an unknown one added. How a flush top lowers the board's
2071
2120
  * clearance and widens its screen opening to the glass.
2072
2121
  */
2073
- patch: z15.record(z15.record(z15.unknown())).default({})
2122
+ patch: z16.record(z16.record(z16.unknown())).default({})
2074
2123
  });
2075
- var FamilyOptionSchema = z15.object({
2076
- label: z15.string().min(1),
2124
+ var FamilyOptionSchema = z16.object({
2125
+ label: z16.string().min(1),
2077
2126
  /** In order; the first is the default. Ids are lowercase words and dashes. */
2078
- choices: z15.array(FamilyChoiceSchema.extend({ id: z15.string().regex(/^[a-z0-9][a-z0-9-]*$/) })).min(1)
2127
+ choices: z16.array(FamilyChoiceSchema.extend({ id: z16.string().regex(/^[a-z0-9][a-z0-9-]*$/) })).min(1)
2079
2128
  });
2080
- var CaseFamilySchema = z15.object({
2129
+ var CaseFamilySchema = z16.object({
2081
2130
  /** The base manifest, relative to this file. */
2082
- manifest: z15.string().min(1),
2131
+ manifest: z16.string().min(1),
2083
2132
  /** Option groups, in the order they are offered: base, top… */
2084
- options: z15.record(z15.string().regex(/^[a-z][a-z0-9-]*$/), FamilyOptionSchema)
2133
+ options: z16.record(z16.string().regex(/^[a-z][a-z0-9-]*$/), FamilyOptionSchema)
2085
2134
  });
2086
2135
 
2087
2136
  // src/auth/schema.ts
2088
- import { z as z16 } from "zod";
2089
- var UserSchema = z16.object({
2090
- id: z16.string().default(""),
2091
- name: z16.string(),
2092
- email: z16.string().email(),
2093
- password: z16.string().optional(),
2094
- role: z16.string(),
2095
- status: z16.string().optional(),
2096
- joinedAt: z16.string().optional(),
2097
- lastActive: z16.string().optional(),
2098
- avatarUrl: z16.string().optional()
2137
+ import { z as z17 } from "zod";
2138
+ var UserSchema = z17.object({
2139
+ id: z17.string().default(""),
2140
+ name: z17.string(),
2141
+ email: z17.string().email(),
2142
+ password: z17.string().optional(),
2143
+ role: z17.string(),
2144
+ status: z17.string().optional(),
2145
+ joinedAt: z17.string().optional(),
2146
+ lastActive: z17.string().optional(),
2147
+ avatarUrl: z17.string().optional()
2099
2148
  });
2100
2149
 
2101
2150
  // src/auth/accounts.ts
2102
- import { z as z17 } from "zod";
2103
- var AccountIdSchema = z17.string().regex(/^acct_[0-9a-f]{12}$/, "acct_ and 12 hex digits");
2104
- var AccountRoleSchema = z17.enum(["member", "admin"]);
2105
- var AccountStatusSchema = z17.enum(["active", "suspended"]);
2106
- var ScryptHashSchema = z17.object({
2107
- algo: z17.literal("scrypt"),
2108
- n: z17.number().int().positive(),
2109
- r: z17.number().int().positive(),
2110
- p: z17.number().int().positive(),
2111
- keylen: z17.number().int().positive(),
2112
- salt: z17.string().min(16),
2113
- hash: z17.string().min(16)
2114
- });
2115
- var AccountRecordSchema = z17.object({
2151
+ import { z as z18 } from "zod";
2152
+ var AccountIdSchema = z18.string().regex(/^acct_[0-9a-f]{12}$/, "acct_ and 12 hex digits");
2153
+ var AccountRoleSchema = z18.enum(["member", "admin"]);
2154
+ var AccountStatusSchema = z18.enum(["active", "suspended"]);
2155
+ var ScryptHashSchema = z18.object({
2156
+ algo: z18.literal("scrypt"),
2157
+ n: z18.number().int().positive(),
2158
+ r: z18.number().int().positive(),
2159
+ p: z18.number().int().positive(),
2160
+ keylen: z18.number().int().positive(),
2161
+ salt: z18.string().min(16),
2162
+ hash: z18.string().min(16)
2163
+ });
2164
+ var AccountRecordSchema = z18.object({
2116
2165
  accountId: AccountIdSchema,
2117
2166
  /** Lowercased on write, because a login must not depend on how it was typed. */
2118
- email: z17.string().email().max(254),
2119
- name: z17.string().min(1).max(64),
2167
+ email: z18.string().email().max(254),
2168
+ name: z18.string().min(1).max(64),
2120
2169
  role: AccountRoleSchema,
2121
2170
  status: AccountStatusSchema,
2122
2171
  password: ScryptHashSchema,
2123
- createdAt: z17.number().int().nonnegative(),
2124
- lastLoginAt: z17.number().int().nonnegative().nullable().default(null),
2172
+ createdAt: z18.number().int().nonnegative(),
2173
+ lastLoginAt: z18.number().int().nonnegative().nullable().default(null),
2125
2174
  /** Which admin approved this, or null for the bootstrap account. */
2126
2175
  invitedBy: AccountIdSchema.nullable().default(null)
2127
2176
  });
2128
2177
  var DISPLAY_NAME_MAX = 40;
2129
- var DisplayNameSchema = z17.string().transform((s) => s.trim().replace(/\s+/g, " ")).pipe(
2130
- z17.string().min(1, "Give a name.").max(DISPLAY_NAME_MAX, `At most ${DISPLAY_NAME_MAX} characters.`).refine((s) => !/[\u0000-\u001f\u007f-\u009f\u200b-\u200f\u2028-\u202e\u2066-\u2069]/.test(s), "Letters, numbers, spaces and punctuation only.")
2178
+ var DisplayNameSchema = z18.string().transform((s) => s.trim().replace(/\s+/g, " ")).pipe(
2179
+ z18.string().min(1, "Give a name.").max(DISPLAY_NAME_MAX, `At most ${DISPLAY_NAME_MAX} characters.`).refine((s) => !/[\u0000-\u001f\u007f-\u009f\u200b-\u200f\u2028-\u202e\u2066-\u2069]/.test(s), "Letters, numbers, spaces and punctuation only.")
2131
2180
  );
2132
- var PublicAccountSchema = z17.object({
2181
+ var PublicAccountSchema = z18.object({
2133
2182
  accountId: AccountIdSchema,
2134
- email: z17.string().email(),
2135
- name: z17.string(),
2183
+ email: z18.string().email(),
2184
+ name: z18.string(),
2136
2185
  role: AccountRoleSchema,
2137
2186
  status: AccountStatusSchema
2138
2187
  });
2139
- var SessionRecordSchema = z17.object({
2188
+ var SessionRecordSchema = z18.object({
2140
2189
  accountId: AccountIdSchema,
2141
- createdAt: z17.number().int().nonnegative(),
2142
- expiresAt: z17.number().int().nonnegative(),
2143
- lastSeenAt: z17.number().int().nonnegative()
2190
+ createdAt: z18.number().int().nonnegative(),
2191
+ expiresAt: z18.number().int().nonnegative(),
2192
+ lastSeenAt: z18.number().int().nonnegative()
2144
2193
  });
2145
- var InviteRecordSchema = z17.object({
2146
- email: z17.string().email().max(254),
2194
+ var InviteRecordSchema = z18.object({
2195
+ email: z18.string().email().max(254),
2147
2196
  role: AccountRoleSchema,
2148
- createdAt: z17.number().int().nonnegative(),
2149
- expiresAt: z17.number().int().nonnegative(),
2197
+ createdAt: z18.number().int().nonnegative(),
2198
+ expiresAt: z18.number().int().nonnegative(),
2150
2199
  invitedBy: AccountIdSchema
2151
2200
  });
2152
- var AccessRequestSchema = z17.object({
2153
- email: z17.string().email().max(254),
2154
- name: z17.string().min(1).max(64),
2201
+ var AccessRequestSchema = z18.object({
2202
+ email: z18.string().email().max(254),
2203
+ name: z18.string().min(1).max(64),
2155
2204
  /** Optional, and never shown publicly. Long enough to be useful, short enough not to be an essay. */
2156
- reason: z17.string().max(500).optional()
2157
- });
2158
- var AccessRequestStatusSchema = z17.enum(["pending", "approved", "denied"]);
2159
- var AccessRequestRecordSchema = z17.object({
2160
- requestId: z17.string().regex(/^req_[0-9a-f]{12}$/, "req_ and 12 hex digits"),
2161
- email: z17.string().email().max(254),
2162
- name: z17.string().min(1).max(64),
2163
- reason: z17.string().max(500).optional(),
2205
+ reason: z18.string().max(500).optional()
2206
+ });
2207
+ var AccessRequestStatusSchema = z18.enum(["pending", "approved", "denied"]);
2208
+ var AccessRequestRecordSchema = z18.object({
2209
+ requestId: z18.string().regex(/^req_[0-9a-f]{12}$/, "req_ and 12 hex digits"),
2210
+ email: z18.string().email().max(254),
2211
+ name: z18.string().min(1).max(64),
2212
+ reason: z18.string().max(500).optional(),
2164
2213
  status: AccessRequestStatusSchema,
2165
- createdAt: z17.number().int().nonnegative(),
2166
- decidedAt: z17.number().int().nonnegative().nullable().default(null),
2214
+ createdAt: z18.number().int().nonnegative(),
2215
+ decidedAt: z18.number().int().nonnegative().nullable().default(null),
2167
2216
  decidedBy: AccountIdSchema.nullable().default(null)
2168
2217
  });
2169
2218
  var SCRYPT_PARAMS = {
@@ -2182,35 +2231,37 @@ var INVITE_TTL_SECONDS = 60 * 60 * 24 * 14;
2182
2231
  var ACCESS_REQUEST_TTL_SECONDS = 60 * 60 * 24 * 90;
2183
2232
 
2184
2233
  // src/auth/accessTokens.ts
2185
- import { z as z18 } from "zod";
2186
- var ACCESS_TOKEN_SCOPES = ["boards:read", "boards:send", "boards:configure"];
2187
- var AccessTokenScopeSchema = z18.enum(ACCESS_TOKEN_SCOPES);
2234
+ import { z as z19 } from "zod";
2235
+ var ACCESS_TOKEN_SCOPES = ["boards:read", "boards:send", "boards:configure", "apps:read", "apps:write"];
2236
+ var AccessTokenScopeSchema = z19.enum(ACCESS_TOKEN_SCOPES);
2188
2237
  var ACCESS_TOKEN_SCOPE_LABELS = {
2189
2238
  "boards:read": "See my boards",
2190
2239
  "boards:send": "Send apps to my boards",
2191
- "boards:configure": "Change my boards\u2019 settings"
2240
+ "boards:configure": "Change my boards\u2019 settings",
2241
+ "apps:read": "See my saved apps",
2242
+ "apps:write": "Save apps to my account"
2192
2243
  };
2193
2244
  var ACCESS_TOKEN_PREFIX = "rmk_";
2194
2245
  var ACCESS_TOKEN_LIFETIMES_DAYS = [7, 30, 90, 365];
2195
2246
  var ACCESS_TOKEN_MAX_PER_ACCOUNT = 20;
2196
2247
  var ACCESS_TOKEN_RATE_PER_MINUTE = 60;
2197
- var AccessTokenRecordSchema = z18.object({
2248
+ var AccessTokenRecordSchema = z19.object({
2198
2249
  /** The first 12 hex digits of the hash: what the owner sees and revokes by. */
2199
- tokenId: z18.string().regex(/^[0-9a-f]{12}$/),
2250
+ tokenId: z19.string().regex(/^[0-9a-f]{12}$/),
2200
2251
  accountId: AccountIdSchema,
2201
2252
  /** What the owner called it: "laptop", "Claude Code". */
2202
- name: z18.string().trim().min(1).max(60),
2203
- scopes: z18.array(AccessTokenScopeSchema).min(1),
2204
- createdAt: z18.number().int().nonnegative(),
2205
- expiresAt: z18.number().int().nonnegative(),
2253
+ name: z19.string().trim().min(1).max(60),
2254
+ scopes: z19.array(AccessTokenScopeSchema).min(1),
2255
+ createdAt: z19.number().int().nonnegative(),
2256
+ expiresAt: z19.number().int().nonnegative(),
2206
2257
  /** Moved forward at most once a day, so using a token is not a write per request. */
2207
- lastUsedAt: z18.number().int().nonnegative().nullable().default(null)
2258
+ lastUsedAt: z19.number().int().nonnegative().nullable().default(null)
2208
2259
  });
2209
2260
  var PublicAccessTokenSchema = AccessTokenRecordSchema.omit({ accountId: true });
2210
- var NewAccessTokenSchema = z18.object({
2211
- name: z18.string().trim().min(1, "Give it a name.").max(60),
2212
- scopes: z18.array(AccessTokenScopeSchema).min(1, "Choose at least one thing it can do."),
2213
- days: z18.union(ACCESS_TOKEN_LIFETIMES_DAYS.map((d) => z18.literal(d)))
2261
+ var NewAccessTokenSchema = z19.object({
2262
+ name: z19.string().trim().min(1, "Give it a name.").max(60),
2263
+ scopes: z19.array(AccessTokenScopeSchema).min(1, "Choose at least one thing it can do."),
2264
+ days: z19.union(ACCESS_TOKEN_LIFETIMES_DAYS.map((d) => z19.literal(d)))
2214
2265
  });
2215
2266
  export {
2216
2267
  ACCESS_REQUEST_TTL_SECONDS,
@@ -2269,9 +2320,17 @@ export {
2269
2320
  AppTextSizeSchema,
2270
2321
  AssetHashSchema,
2271
2322
  AuthStrategySchema,
2323
+ BOARD_REMOTE_COMMANDS,
2324
+ BOARD_REMOTE_PENDING_MAX,
2325
+ BOARD_REMOTE_TTL_MS,
2326
+ BOARD_SLEEP_MINUTES,
2327
+ BOARD_SLEEP_MINUTES_DEFAULT,
2272
2328
  BlockSchema,
2273
2329
  BoardFontSchema,
2274
2330
  BoardPaletteHexSchema,
2331
+ BoardRemoteCommandSchema,
2332
+ BoardRemotePressSchema,
2333
+ BoardSleepMinutesSchema,
2275
2334
  schema_exports as Bodewell,
2276
2335
  CLAIMED_DEVICE_TTL_SECONDS,
2277
2336
  CONTROL_STATES,
@@ -2374,6 +2433,7 @@ export {
2374
2433
  PublicAccountSchema,
2375
2434
  RETRO_RENDITION,
2376
2435
  ResourceSchema,
2436
+ SAVED_APPS_MAX,
2377
2437
  SCRYPT_PARAMS,
2378
2438
  SESSION_COOKIE_NAME,
2379
2439
  SESSION_TTL_SECONDS,
@@ -2391,6 +2451,7 @@ export {
2391
2451
  SPRITE_MAX_SIDE,
2392
2452
  SPR_FORMAT,
2393
2453
  SPR_MAX_BYTES,
2454
+ SavedAppSchema,
2394
2455
  ScryptHashSchema,
2395
2456
  SendRequestSchema,
2396
2457
  SensorAppConfigSchema,