@ramme-io/shared 3.1.2 → 3.3.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.cjs +1058 -140
- package/dist/index.d.cts +17266 -27
- package/dist/index.d.ts +17266 -27
- package/dist/index.js +975 -140
- package/package.json +3 -2
package/dist/index.js
CHANGED
|
@@ -264,7 +264,8 @@ var BodewellTelemetrySchema = z4.object({
|
|
|
264
264
|
soil_temp_stemma: z4.number().optional().describe("Celsius"),
|
|
265
265
|
soil_vwc: z4.number().describe("Volumetric Water Content / Raw Capacitance"),
|
|
266
266
|
soil_moisture: z4.number().optional().describe("Firmware alias for raw capacitance"),
|
|
267
|
-
soil_moisture_raw: z4.number().optional().describe("Unscaled capacitance (300-1100)")
|
|
267
|
+
soil_moisture_raw: z4.number().optional().describe("Unscaled capacitance (300-1100)"),
|
|
268
|
+
fw_version: z4.string().max(40).optional().describe("Firmware build the board is running; absent on v4 sketches, which cannot be updated over the air")
|
|
268
269
|
}).passthrough();
|
|
269
270
|
var BodewellCommandSchema = z4.object({
|
|
270
271
|
stick_id: BodewellDeviceID,
|
|
@@ -404,34 +405,554 @@ var DEFAULT_DEVICE_CONFIG = {
|
|
|
404
405
|
theme: { preset: "dark" }
|
|
405
406
|
};
|
|
406
407
|
|
|
407
|
-
// src/
|
|
408
|
+
// src/apps/schema.ts
|
|
408
409
|
import { z as z6 } from "zod";
|
|
409
|
-
var
|
|
410
|
-
|
|
411
|
-
|
|
410
|
+
var AppColorTokenSchema = z6.enum([
|
|
411
|
+
"background",
|
|
412
|
+
"foreground",
|
|
413
|
+
"muted",
|
|
414
|
+
"accent",
|
|
415
|
+
"success",
|
|
416
|
+
"warning",
|
|
417
|
+
"danger"
|
|
418
|
+
]);
|
|
419
|
+
var AppRgbSchema = z6.string().regex(/^\d{1,3} \d{1,3} \d{1,3}$/, 'RGB must be three space-separated integers, e.g. "13 110 253"');
|
|
420
|
+
var AppColorSchema = z6.union([AppColorTokenSchema, AppRgbSchema]);
|
|
421
|
+
var AppTextSizeSchema = z6.enum(["xs", "sm", "base", "lg", "xl", "display"]);
|
|
422
|
+
var AppAlignSchema = z6.enum(["start", "center", "end"]);
|
|
423
|
+
var AppSourceSchema = z6.discriminatedUnion("kind", [
|
|
424
|
+
z6.object({
|
|
425
|
+
kind: z6.literal("weather"),
|
|
426
|
+
latitude: z6.number().min(-90).max(90),
|
|
427
|
+
longitude: z6.number().min(-180).max(180),
|
|
428
|
+
units: z6.enum(["imperial", "metric"]).default("imperial"),
|
|
429
|
+
refreshSeconds: z6.number().int().min(300).max(86400).default(600)
|
|
430
|
+
}),
|
|
431
|
+
z6.object({
|
|
432
|
+
kind: z6.literal("clock"),
|
|
433
|
+
/** IANA zone, e.g. "America/New_York". */
|
|
434
|
+
timezone: z6.string().default("America/New_York"),
|
|
435
|
+
twentyFourHour: z6.boolean().default(false)
|
|
436
|
+
}),
|
|
437
|
+
z6.object({
|
|
438
|
+
kind: z6.literal("countdown"),
|
|
439
|
+
/** ISO date or datetime, e.g. "2026-12-25" or "2026-12-25T18:00:00Z". */
|
|
440
|
+
target: z6.string().min(4),
|
|
441
|
+
label: z6.string().max(24).optional()
|
|
442
|
+
}),
|
|
443
|
+
z6.object({
|
|
444
|
+
kind: z6.literal("static"),
|
|
445
|
+
values: z6.record(z6.union([z6.string(), z6.number(), z6.boolean()]))
|
|
446
|
+
}),
|
|
447
|
+
/**
|
|
448
|
+
* Taking turns: a number that counts 0, 1, 2 … up to `count - 1` and starts
|
|
449
|
+
* again, moving on every `minutes`. Its one field is `index`.
|
|
450
|
+
*
|
|
451
|
+
* It exists for the photo frame — each photo hides unless the index is its
|
|
452
|
+
* own — and works for anything that should alternate, like two lines of a
|
|
453
|
+
* sign. Counted from UTC minutes since 1970, so the browser and every board
|
|
454
|
+
* agree on which turn it is without talking to each other, and minutes
|
|
455
|
+
* because a board redraws once a minute and no faster (see loop() in
|
|
456
|
+
* hardware/weather-display/weather-display.ino).
|
|
457
|
+
*/
|
|
458
|
+
z6.object({
|
|
459
|
+
kind: z6.literal("cycle"),
|
|
460
|
+
count: z6.number().int().min(2).max(12),
|
|
461
|
+
minutes: z6.number().int().min(1).max(1440).default(5)
|
|
462
|
+
})
|
|
463
|
+
]);
|
|
464
|
+
var AppOperandSchema = z6.union([
|
|
465
|
+
z6.object({ literal: z6.number() }),
|
|
466
|
+
z6.object({ source: z6.string().min(1), field: z6.string().min(1) })
|
|
467
|
+
]);
|
|
468
|
+
var AppComputeSchema = z6.object({
|
|
469
|
+
compute: z6.enum(["add", "subtract", "multiply", "divide"]),
|
|
470
|
+
of: z6.tuple([AppOperandSchema, AppOperandSchema]),
|
|
471
|
+
round: z6.boolean().default(true)
|
|
472
|
+
});
|
|
473
|
+
var AppBindingSchema = z6.union([
|
|
474
|
+
z6.object({ literal: z6.union([z6.string(), z6.number(), z6.boolean()]) }),
|
|
475
|
+
z6.object({
|
|
476
|
+
/** Key into the document's `sources` map. */
|
|
477
|
+
source: z6.string().min(1),
|
|
478
|
+
/** Field on that source, e.g. "temperature", "high", "condition". */
|
|
479
|
+
field: z6.string().min(1)
|
|
480
|
+
}),
|
|
481
|
+
AppComputeSchema
|
|
482
|
+
]);
|
|
483
|
+
var AppConditionSchema = z6.object({
|
|
484
|
+
value: AppOperandSchema,
|
|
485
|
+
op: z6.enum(["<", "<=", ">", ">=", "==", "!="]),
|
|
486
|
+
than: z6.union([z6.number(), z6.string(), z6.boolean()])
|
|
487
|
+
});
|
|
488
|
+
var AppStyleRuleSchema = z6.object({
|
|
489
|
+
when: AppConditionSchema,
|
|
490
|
+
color: AppColorSchema.optional(),
|
|
491
|
+
size: AppTextSizeSchema.optional()
|
|
492
|
+
});
|
|
493
|
+
var leafBase = {
|
|
494
|
+
color: AppColorSchema.optional(),
|
|
495
|
+
/** Drawn only when this is false, or absent. */
|
|
496
|
+
hideWhen: AppConditionSchema.optional(),
|
|
497
|
+
/** Conditional style. First match wins. */
|
|
498
|
+
rules: z6.array(AppStyleRuleSchema).max(4).optional()
|
|
499
|
+
};
|
|
500
|
+
var AppTextSchema = z6.object({
|
|
501
|
+
type: z6.literal("text"),
|
|
502
|
+
value: AppBindingSchema,
|
|
503
|
+
size: AppTextSizeSchema.default("base"),
|
|
504
|
+
align: AppAlignSchema.default("start"),
|
|
505
|
+
/** Printed after the value, e.g. a degree symbol. Never itself bound. */
|
|
506
|
+
suffix: z6.string().max(8).optional(),
|
|
507
|
+
...leafBase
|
|
508
|
+
});
|
|
509
|
+
var AppDialSchema = z6.object({
|
|
510
|
+
type: z6.literal("dial"),
|
|
511
|
+
value: AppBindingSchema,
|
|
512
|
+
min: z6.number(),
|
|
513
|
+
max: z6.number(),
|
|
514
|
+
label: z6.string().max(24).optional(),
|
|
515
|
+
...leafBase
|
|
516
|
+
});
|
|
517
|
+
var AppSparklineSchema = z6.object({
|
|
518
|
+
type: z6.literal("sparkline"),
|
|
519
|
+
/** A source field holding a series rather than a scalar. */
|
|
520
|
+
series: AppBindingSchema,
|
|
521
|
+
...leafBase
|
|
522
|
+
});
|
|
523
|
+
var AppBarSchema = z6.object({
|
|
524
|
+
type: z6.literal("bar"),
|
|
525
|
+
value: AppBindingSchema,
|
|
526
|
+
min: z6.number(),
|
|
527
|
+
max: z6.number(),
|
|
528
|
+
...leafBase
|
|
529
|
+
});
|
|
530
|
+
var AppStatusSchema = z6.object({
|
|
531
|
+
type: z6.literal("status"),
|
|
532
|
+
state: AppBindingSchema,
|
|
533
|
+
label: z6.string().max(24).optional(),
|
|
534
|
+
...leafBase
|
|
535
|
+
});
|
|
536
|
+
var SPRITE_MAX_SIDE = 64;
|
|
537
|
+
var SPRITE_MAX_ROW_BYTES = SPRITE_MAX_SIDE / 2;
|
|
538
|
+
var SPRITE_MAX_BASE64 = Math.ceil(SPRITE_MAX_ROW_BYTES * SPRITE_MAX_SIDE / 3) * 4;
|
|
539
|
+
var AppSpriteSchema = z6.object({
|
|
540
|
+
type: z6.literal("sprite"),
|
|
541
|
+
width: z6.number().int().min(1).max(SPRITE_MAX_SIDE),
|
|
542
|
+
height: z6.number().int().min(1).max(SPRITE_MAX_SIDE),
|
|
543
|
+
/**
|
|
544
|
+
* Up to sixteen colours, in the same form every other colour in a document
|
|
545
|
+
* takes: a semantic token, or literal RGB.
|
|
546
|
+
*
|
|
547
|
+
* Both are allowed on purpose. A token re-colours with the theme, which is
|
|
548
|
+
* what an icon wants; literal RGB does not, which is what a drawing wants.
|
|
549
|
+
* A picture of a dog is content, not chrome, and should not turn teal
|
|
550
|
+
* because somebody switched to the corporate theme.
|
|
551
|
+
*/
|
|
552
|
+
palette: z6.array(AppColorSchema).min(1).max(16),
|
|
553
|
+
/** base64 of the packed nibbles. */
|
|
554
|
+
pixels: z6.string().min(4).max(SPRITE_MAX_BASE64),
|
|
555
|
+
align: AppAlignSchema.default("start"),
|
|
556
|
+
/** Drawn only when this is false, or absent. */
|
|
557
|
+
hideWhen: AppConditionSchema.optional()
|
|
558
|
+
});
|
|
559
|
+
var AssetHashSchema = z6.string().regex(/^[0-9a-f]{64}$/, "a lowercase hex SHA-256");
|
|
560
|
+
var IMAGE_MAX_DRAWN = { width: 304, height: 224 };
|
|
561
|
+
var IMAGE_MAX_SCALE = 8;
|
|
562
|
+
var RETRO_RENDITION = { width: 76, height: 56, scale: 4, colors: 16 };
|
|
563
|
+
var SPR_FORMAT = {
|
|
564
|
+
/** "RSPR". */
|
|
565
|
+
magic: [82, 83, 80, 82],
|
|
566
|
+
version: 1,
|
|
567
|
+
/** magic 4, version 1, width u16, height u16, bits per pixel 1, palette count 1. */
|
|
568
|
+
headerBytes: 11,
|
|
569
|
+
/** Only 4 today: two pixels per byte, high nibble first, rows padded to a byte. */
|
|
570
|
+
bitsPerPixel: 4,
|
|
571
|
+
maxColors: 16
|
|
572
|
+
};
|
|
573
|
+
var SPR_MAX_BYTES = SPR_FORMAT.headerBytes + SPR_FORMAT.maxColors * 2 + Math.ceil(IMAGE_MAX_DRAWN.width / 2) * IMAGE_MAX_DRAWN.height;
|
|
574
|
+
var AppImageSchema = z6.object({
|
|
575
|
+
type: z6.literal("image"),
|
|
576
|
+
asset: AssetHashSchema,
|
|
577
|
+
/** The file's own pixels, not the drawn size. */
|
|
578
|
+
width: z6.number().int().min(1).max(IMAGE_MAX_DRAWN.width),
|
|
579
|
+
height: z6.number().int().min(1).max(IMAGE_MAX_DRAWN.height),
|
|
580
|
+
scale: z6.number().int().min(1).max(IMAGE_MAX_SCALE).default(1),
|
|
581
|
+
align: AppAlignSchema.default("start"),
|
|
582
|
+
/** Drawn only when this is false, or absent. */
|
|
583
|
+
hideWhen: AppConditionSchema.optional()
|
|
584
|
+
});
|
|
585
|
+
var AppLeafSchema = z6.discriminatedUnion("type", [
|
|
586
|
+
AppTextSchema,
|
|
587
|
+
AppDialSchema,
|
|
588
|
+
AppSparklineSchema,
|
|
589
|
+
AppBarSchema,
|
|
590
|
+
AppStatusSchema,
|
|
591
|
+
AppSpriteSchema,
|
|
592
|
+
AppImageSchema
|
|
593
|
+
]);
|
|
594
|
+
var AppGroupSchema = z6.object({
|
|
595
|
+
type: z6.literal("group"),
|
|
596
|
+
direction: z6.enum(["row", "stack"]),
|
|
597
|
+
gap: z6.number().int().min(0).max(64).default(4),
|
|
598
|
+
align: AppAlignSchema.default("start"),
|
|
599
|
+
children: z6.array(AppLeafSchema).min(1).max(8)
|
|
600
|
+
});
|
|
601
|
+
var AppBlockSchema = z6.union([AppLeafSchema, AppGroupSchema]);
|
|
602
|
+
var AppScreenSizeSchema = z6.preprocess(
|
|
603
|
+
(value) => value === "240x320" ? "320x240" : value,
|
|
604
|
+
z6.enum(["320x240"])
|
|
605
|
+
);
|
|
606
|
+
var AppDocumentSchema = z6.object({
|
|
607
|
+
/** Bumped only for a breaking change; the device checks it before parsing. */
|
|
608
|
+
schemaVersion: z6.literal(1),
|
|
609
|
+
id: z6.string().regex(/^[a-z0-9][a-z0-9-]{1,38}[a-z0-9]$/, "lowercase slug"),
|
|
610
|
+
name: z6.string().min(1).max(48),
|
|
611
|
+
/** Free text. Never an email or anything else identifying — see the plan. */
|
|
612
|
+
author: z6.string().max(32).optional(),
|
|
613
|
+
screen: AppScreenSizeSchema.default("320x240"),
|
|
614
|
+
background: AppColorSchema.default("background"),
|
|
615
|
+
/** Named so bindings can refer to them. */
|
|
616
|
+
sources: z6.record(AppSourceSchema).default({}),
|
|
617
|
+
blocks: z6.array(AppBlockSchema).min(1).max(12)
|
|
618
|
+
}).superRefine((doc, ctx) => {
|
|
619
|
+
const bytesPerRow = (width) => Math.ceil(width / 2);
|
|
620
|
+
const check = (block, path) => {
|
|
621
|
+
const b = block;
|
|
622
|
+
if (b?.type !== "sprite" || !b.width || !b.height || typeof b.pixels !== "string") return;
|
|
623
|
+
const want = bytesPerRow(b.width) * b.height;
|
|
624
|
+
const got = Math.floor(b.pixels.replace(/=+$/, "").length * 3 / 4);
|
|
625
|
+
if (got === want) return;
|
|
626
|
+
ctx.addIssue({
|
|
627
|
+
code: z6.ZodIssueCode.custom,
|
|
628
|
+
path: [...path, "pixels"],
|
|
629
|
+
message: `${b.width}x${b.height} needs ${want} bytes of pixel data, and this decodes to ${got}. Rows are padded to whole bytes, so the length is ceil(width / 2) * height.`
|
|
630
|
+
});
|
|
631
|
+
};
|
|
632
|
+
const checkImage = (block, path) => {
|
|
633
|
+
const b = block;
|
|
634
|
+
if (b?.type !== "image" || !b.width || !b.height) return;
|
|
635
|
+
const scale = b.scale ?? 1;
|
|
636
|
+
const w = b.width * scale;
|
|
637
|
+
const h = b.height * scale;
|
|
638
|
+
if (w <= IMAGE_MAX_DRAWN.width && h <= IMAGE_MAX_DRAWN.height) return;
|
|
639
|
+
ctx.addIssue({
|
|
640
|
+
code: z6.ZodIssueCode.custom,
|
|
641
|
+
path: [...path, "scale"],
|
|
642
|
+
message: `${b.width}x${b.height} at scale ${scale} draws ${w}x${h}, and a board draws at most ${IMAGE_MAX_DRAWN.width}x${IMAGE_MAX_DRAWN.height} inside its margin.`
|
|
643
|
+
});
|
|
644
|
+
};
|
|
645
|
+
doc.blocks.forEach((block, i) => {
|
|
646
|
+
check(block, ["blocks", i]);
|
|
647
|
+
checkImage(block, ["blocks", i]);
|
|
648
|
+
const children = block.children;
|
|
649
|
+
if (Array.isArray(children)) {
|
|
650
|
+
children.forEach((child, j) => {
|
|
651
|
+
check(child, ["blocks", i, "children", j]);
|
|
652
|
+
checkImage(child, ["blocks", i, "children", j]);
|
|
653
|
+
});
|
|
654
|
+
}
|
|
655
|
+
});
|
|
656
|
+
});
|
|
657
|
+
|
|
658
|
+
// src/apps/photos.ts
|
|
659
|
+
import { z as z7 } from "zod";
|
|
660
|
+
var ORIGINAL_MAX_SIDE = 3072;
|
|
661
|
+
var ORIGINAL_MAX_BYTES = 3e6;
|
|
662
|
+
var PHOTOS_PER_ACCOUNT = 50;
|
|
663
|
+
var PHOTO_UPLOADS_PER_HOUR = 30;
|
|
664
|
+
var PhotoUploadSchema = z7.object({
|
|
665
|
+
rendition: z7.string().min(4),
|
|
666
|
+
original: z7.string().min(4)
|
|
667
|
+
});
|
|
668
|
+
var PhotoSummarySchema = z7.object({
|
|
669
|
+
hash: AssetHashSchema,
|
|
670
|
+
/** The rendition's own pixels. */
|
|
671
|
+
width: z7.number().int().positive(),
|
|
672
|
+
height: z7.number().int().positive(),
|
|
673
|
+
renditionBytes: z7.number().int().positive(),
|
|
674
|
+
originalWidth: z7.number().int().positive(),
|
|
675
|
+
originalHeight: z7.number().int().positive(),
|
|
676
|
+
originalBytes: z7.number().int().positive(),
|
|
677
|
+
uploadedAt: z7.number().int()
|
|
678
|
+
});
|
|
679
|
+
|
|
680
|
+
// src/apps/delivery.ts
|
|
681
|
+
import { z as z8 } from "zod";
|
|
682
|
+
var DeviceIdSchema = z8.string().regex(/^[0-9A-HJKMNP-TV-Z]{8}$/, "eight characters, no I L O or U");
|
|
683
|
+
var PairCodeSchema = z8.string().regex(/^\d{4}$/);
|
|
684
|
+
var DeviceRegistrationSchema = z8.object({
|
|
685
|
+
deviceId: DeviceIdSchema,
|
|
686
|
+
code: PairCodeSchema,
|
|
687
|
+
/** Firmware build, so a support question has an answer. */
|
|
688
|
+
version: z8.string().max(40).optional(),
|
|
689
|
+
/** Which board this is, from Boards.h — the two variants need different firmware. */
|
|
690
|
+
board: z8.string().max(40).optional(),
|
|
691
|
+
/** dBm, always negative. -50 is across the room; -85 is a complaint. */
|
|
692
|
+
rssi: z8.number().int().min(-127).max(0).optional(),
|
|
693
|
+
/** On the owner's own network. Long enough for IPv6, which this does not send yet. */
|
|
694
|
+
ip: z8.string().max(45).optional(),
|
|
695
|
+
/** Seconds since boot. Not growing between check-ins means it is restarting. */
|
|
696
|
+
uptime: z8.number().int().nonnegative().optional(),
|
|
697
|
+
/** Free heap in bytes. */
|
|
698
|
+
heap: z8.number().int().nonnegative().optional(),
|
|
699
|
+
/** The app revision the board has actually drawn. */
|
|
700
|
+
drew: z8.number().int().nonnegative().optional(),
|
|
701
|
+
/** Why it last restarted, already mapped to a word by the firmware. */
|
|
702
|
+
reset: z8.string().max(40).optional()
|
|
703
|
+
});
|
|
704
|
+
var SendRequestSchema = z8.object({
|
|
705
|
+
deviceId: DeviceIdSchema,
|
|
706
|
+
code: PairCodeSchema
|
|
707
|
+
});
|
|
708
|
+
var OwnedSendRequestSchema = z8.object({
|
|
709
|
+
deviceId: DeviceIdSchema
|
|
710
|
+
});
|
|
711
|
+
var DeliveredAppSchema = z8.object({
|
|
712
|
+
revision: z8.number().int().nonnegative(),
|
|
713
|
+
sentAt: z8.number().int().nonnegative()
|
|
714
|
+
});
|
|
715
|
+
var DeviceRecordSchema = z8.object({
|
|
716
|
+
deviceId: DeviceIdSchema,
|
|
717
|
+
code: PairCodeSchema,
|
|
718
|
+
ownerId: z8.string().nullable().default(null),
|
|
719
|
+
version: z8.string().max(40).optional(),
|
|
720
|
+
createdAt: z8.number().int().nonnegative(),
|
|
721
|
+
lastSeenAt: z8.number().int().nonnegative()
|
|
722
|
+
});
|
|
723
|
+
var DEVICE_LABEL_MAX = 48;
|
|
724
|
+
var DEVICE_TTL_SECONDS = 60 * 60 * 24 * 30;
|
|
725
|
+
var CLAIMED_DEVICE_TTL_SECONDS = 60 * 60 * 24 * 400;
|
|
726
|
+
|
|
727
|
+
// src/apps/vitals.ts
|
|
728
|
+
import { z as z9 } from "zod";
|
|
729
|
+
var VitalSourceSchema = z9.enum(["register", "poll", "send"]);
|
|
730
|
+
var DeviceVitalsSchema = z9.object({
|
|
731
|
+
/** When the board last said any of this, by the server's clock. */
|
|
732
|
+
reportedAt: z9.number().int().nonnegative().optional(),
|
|
733
|
+
/**
|
|
734
|
+
* The firmware build. Today every board sends the literal "doc-1", which is a
|
|
735
|
+
* protocol marker rather than a build id — so this is shown as reported and
|
|
736
|
+
* labelled as not yet a version. The real value lives in the published
|
|
737
|
+
* manifest until firmware carries it.
|
|
738
|
+
*/
|
|
739
|
+
firmwareVersion: z9.string().max(40).optional(),
|
|
740
|
+
/** Which board this is. Nothing distinguishes a CYD from a Freenove S3 yet. */
|
|
741
|
+
board: z9.string().max(40).optional(),
|
|
742
|
+
/** dBm, negative. -50 is across the room, -85 is a complaint. */
|
|
743
|
+
rssi: z9.number().int().min(-127).max(0).optional(),
|
|
744
|
+
/** The board's address on its own network, as the board sees it. */
|
|
745
|
+
ip: z9.string().max(45).optional(),
|
|
746
|
+
uptimeSeconds: z9.number().int().nonnegative().optional(),
|
|
747
|
+
freeHeapBytes: z9.number().int().nonnegative().optional(),
|
|
748
|
+
/**
|
|
749
|
+
* The revision the board is actually showing.
|
|
750
|
+
*
|
|
751
|
+
* Distinct from the revision that was sent, and the difference is the whole
|
|
752
|
+
* value: a send that was never drawn looks identical to a successful one until
|
|
753
|
+
* these two numbers disagree.
|
|
754
|
+
*/
|
|
755
|
+
drewRevision: z9.number().int().nonnegative().optional(),
|
|
756
|
+
/** Why it last restarted, if it says. A board power-cycling in a loop is a fault. */
|
|
757
|
+
resetReason: z9.string().max(40).optional(),
|
|
758
|
+
/** When it last polled — finer-grained than a registration, for liveness only. */
|
|
759
|
+
lastPollAt: z9.number().int().nonnegative().optional()
|
|
760
|
+
});
|
|
761
|
+
var DeviceSeenSchema = z9.object({
|
|
762
|
+
/** When the board last asked for its app. The freshest signal this system has. */
|
|
763
|
+
lastPollAt: z9.number().int().nonnegative(),
|
|
764
|
+
/** The revision it reported drawing at that moment. */
|
|
765
|
+
drewRevision: z9.number().int().nonnegative().optional()
|
|
766
|
+
});
|
|
767
|
+
var DEVICE_VITALS_FIELDS = [
|
|
768
|
+
{
|
|
769
|
+
key: "firmwareVersion",
|
|
770
|
+
label: "Firmware",
|
|
771
|
+
source: "register",
|
|
772
|
+
reportedByFirmware: true,
|
|
773
|
+
note: 'A build stamped in by CI. Boards flashed before that report the marker "doc-1".'
|
|
774
|
+
},
|
|
775
|
+
{ key: "board", label: "Board", source: "register", reportedByFirmware: true },
|
|
776
|
+
{ key: "drewRevision", label: "Showing revision", source: "poll", reportedByFirmware: true },
|
|
777
|
+
{ key: "rssi", label: "Wi-Fi signal", unit: "dBm", source: "register", reportedByFirmware: true },
|
|
778
|
+
{ key: "ip", label: "Address on your network", source: "register", reportedByFirmware: true },
|
|
779
|
+
{ key: "uptimeSeconds", label: "Uptime", unit: "s", source: "register", reportedByFirmware: true },
|
|
780
|
+
{
|
|
781
|
+
key: "freeHeapBytes",
|
|
782
|
+
label: "Free memory",
|
|
783
|
+
unit: "bytes",
|
|
784
|
+
source: "register",
|
|
785
|
+
reportedByFirmware: true
|
|
786
|
+
},
|
|
787
|
+
{ key: "resetReason", label: "Last restart", source: "register", reportedByFirmware: true }
|
|
788
|
+
];
|
|
789
|
+
var DEVICE_FRESH_MS = 7 * 60 * 60 * 1e3;
|
|
790
|
+
var DEVICE_STALE_MS = 30 * 24 * 60 * 60 * 1e3;
|
|
791
|
+
|
|
792
|
+
// src/apps/glyphs.ts
|
|
793
|
+
var DEVICE_UNKNOWN_GLYPH = "?";
|
|
794
|
+
var DEVICE_GLYPHS = {
|
|
795
|
+
// Accented Latin, CP437 0x80-0xA5 and 0xE1
|
|
796
|
+
"\xC7": { byte: 128, shows: "\xC7" },
|
|
797
|
+
"\xFC": { byte: 129, shows: "\xFC" },
|
|
798
|
+
"\xE9": { byte: 130, shows: "\xE9" },
|
|
799
|
+
"\xE2": { byte: 131, shows: "\xE2" },
|
|
800
|
+
"\xE4": { byte: 132, shows: "\xE4" },
|
|
801
|
+
"\xE0": { byte: 133, shows: "\xE0" },
|
|
802
|
+
"\xE5": { byte: 134, shows: "\xE5" },
|
|
803
|
+
"\xE7": { byte: 135, shows: "\xE7" },
|
|
804
|
+
"\xEA": { byte: 136, shows: "\xEA" },
|
|
805
|
+
"\xEB": { byte: 137, shows: "\xEB" },
|
|
806
|
+
"\xE8": { byte: 138, shows: "\xE8" },
|
|
807
|
+
"\xEF": { byte: 139, shows: "\xEF" },
|
|
808
|
+
"\xEE": { byte: 140, shows: "\xEE" },
|
|
809
|
+
"\xEC": { byte: 141, shows: "\xEC" },
|
|
810
|
+
"\xC4": { byte: 142, shows: "\xC4" },
|
|
811
|
+
"\xC5": { byte: 143, shows: "\xC5" },
|
|
812
|
+
"\xC9": { byte: 144, shows: "\xC9" },
|
|
813
|
+
"\xE6": { byte: 145, shows: "\xE6" },
|
|
814
|
+
"\xC6": { byte: 146, shows: "\xC6" },
|
|
815
|
+
"\xF4": { byte: 147, shows: "\xF4" },
|
|
816
|
+
"\xF6": { byte: 148, shows: "\xF6" },
|
|
817
|
+
"\xF2": { byte: 149, shows: "\xF2" },
|
|
818
|
+
"\xFB": { byte: 150, shows: "\xFB" },
|
|
819
|
+
"\xF9": { byte: 151, shows: "\xF9" },
|
|
820
|
+
"\xFF": { byte: 152, shows: "\xFF" },
|
|
821
|
+
"\xD6": { byte: 153, shows: "\xD6" },
|
|
822
|
+
"\xDC": { byte: 154, shows: "\xDC" },
|
|
823
|
+
"\xE1": { byte: 160, shows: "\xE1" },
|
|
824
|
+
"\xED": { byte: 161, shows: "\xED" },
|
|
825
|
+
"\xF3": { byte: 162, shows: "\xF3" },
|
|
826
|
+
"\xFA": { byte: 163, shows: "\xFA" },
|
|
827
|
+
"\xF1": { byte: 164, shows: "\xF1" },
|
|
828
|
+
"\xD1": { byte: 165, shows: "\xD1" },
|
|
829
|
+
"\xDF": { byte: 225, shows: "\xDF" },
|
|
830
|
+
// Symbols a readout uses
|
|
831
|
+
"\xA2": { byte: 155, shows: "\xA2" },
|
|
832
|
+
"\xA3": { byte: 156, shows: "\xA3" },
|
|
833
|
+
"\xA5": { byte: 157, shows: "\xA5" },
|
|
834
|
+
"\u0192": { byte: 159, shows: "\u0192" },
|
|
835
|
+
"\xAA": { byte: 166, shows: "\xAA" },
|
|
836
|
+
"\xBA": { byte: 167, shows: "\xBA" },
|
|
837
|
+
"\xBF": { byte: 168, shows: "\xBF" },
|
|
838
|
+
"\xAC": { byte: 170, shows: "\xAC" },
|
|
839
|
+
"\xBD": { byte: 171, shows: "\xBD" },
|
|
840
|
+
"\xBC": { byte: 172, shows: "\xBC" },
|
|
841
|
+
"\xA1": { byte: 173, shows: "\xA1" },
|
|
842
|
+
"\xAB": { byte: 174, shows: "\xAB" },
|
|
843
|
+
"\xBB": { byte: 175, shows: "\xBB" },
|
|
844
|
+
"\u03C0": { byte: 227, shows: "\u03C0" },
|
|
845
|
+
"\xB5": { byte: 230, shows: "\xB5" },
|
|
846
|
+
"\u03A9": { byte: 234, shows: "\u03A9" },
|
|
847
|
+
"\u221E": { byte: 236, shows: "\u221E" },
|
|
848
|
+
"\xB1": { byte: 241, shows: "\xB1" },
|
|
849
|
+
"\u2265": { byte: 242, shows: "\u2265" },
|
|
850
|
+
"\u2264": { byte: 243, shows: "\u2264" },
|
|
851
|
+
"\xF7": { byte: 246, shows: "\xF7" },
|
|
852
|
+
"\u2248": { byte: 247, shows: "\u2248" },
|
|
853
|
+
"\xB0": { byte: 248, shows: "\xB0" },
|
|
854
|
+
"\xB7": { byte: 250, shows: "\xB7" },
|
|
855
|
+
"\u221A": { byte: 251, shows: "\u221A" },
|
|
856
|
+
"\xB2": { byte: 253, shows: "\xB2" },
|
|
857
|
+
// Punctuation an AI writes without being asked, folded to ASCII
|
|
858
|
+
"\u2018": { byte: 39, shows: "'" },
|
|
859
|
+
"\u2019": { byte: 39, shows: "'" },
|
|
860
|
+
"\u201C": { byte: 34, shows: '"' },
|
|
861
|
+
"\u201D": { byte: 34, shows: '"' },
|
|
862
|
+
"\u2013": { byte: 45, shows: "-" },
|
|
863
|
+
"\u2014": { byte: 45, shows: "-" },
|
|
864
|
+
"\u2212": { byte: 45, shows: "-" },
|
|
865
|
+
"\xA0": { byte: 32, shows: " " }
|
|
866
|
+
};
|
|
867
|
+
var DEVICE_PALETTE = {
|
|
868
|
+
background: "17 17 17",
|
|
869
|
+
foreground: "238 238 238",
|
|
870
|
+
muted: "153 153 153",
|
|
871
|
+
accent: "23 162 184",
|
|
872
|
+
success: "34 197 94",
|
|
873
|
+
warning: "245 158 11",
|
|
874
|
+
danger: "220 53 69"
|
|
875
|
+
};
|
|
876
|
+
|
|
877
|
+
// src/apps/timezones.ts
|
|
878
|
+
var DEVICE_TIMEZONES = [
|
|
879
|
+
// North America
|
|
880
|
+
{ iana: "America/New_York", posix: "EST5EDT,M3.2.0,M11.1.0" },
|
|
881
|
+
{ iana: "America/Toronto", posix: "EST5EDT,M3.2.0,M11.1.0" },
|
|
882
|
+
{ iana: "America/Chicago", posix: "CST6CDT,M3.2.0,M11.1.0" },
|
|
883
|
+
{ iana: "America/Denver", posix: "MST7MDT,M3.2.0,M11.1.0" },
|
|
884
|
+
{ iana: "America/Phoenix", posix: "MST7" },
|
|
885
|
+
{ iana: "America/Los_Angeles", posix: "PST8PDT,M3.2.0,M11.1.0" },
|
|
886
|
+
{ iana: "America/Vancouver", posix: "PST8PDT,M3.2.0,M11.1.0" },
|
|
887
|
+
{ iana: "America/Anchorage", posix: "AKST9AKDT,M3.2.0,M11.1.0" },
|
|
888
|
+
{ iana: "Pacific/Honolulu", posix: "HST10" },
|
|
889
|
+
{ iana: "America/Mexico_City", posix: "CST6" },
|
|
890
|
+
{ iana: "America/Sao_Paulo", posix: "BRT3" },
|
|
891
|
+
// Europe
|
|
892
|
+
{ iana: "Europe/London", posix: "GMT0BST,M3.5.0/1,M10.5.0" },
|
|
893
|
+
{ iana: "Europe/Dublin", posix: "GMT0IST,M3.5.0/1,M10.5.0" },
|
|
894
|
+
{ iana: "Europe/Lisbon", posix: "WET0WEST,M3.5.0/1,M10.5.0" },
|
|
895
|
+
{ iana: "Europe/Paris", posix: "CET-1CEST,M3.5.0,M10.5.0/3" },
|
|
896
|
+
{ iana: "Europe/Berlin", posix: "CET-1CEST,M3.5.0,M10.5.0/3" },
|
|
897
|
+
{ iana: "Europe/Madrid", posix: "CET-1CEST,M3.5.0,M10.5.0/3" },
|
|
898
|
+
{ iana: "Europe/Rome", posix: "CET-1CEST,M3.5.0,M10.5.0/3" },
|
|
899
|
+
{ iana: "Europe/Amsterdam", posix: "CET-1CEST,M3.5.0,M10.5.0/3" },
|
|
900
|
+
{ iana: "Europe/Stockholm", posix: "CET-1CEST,M3.5.0,M10.5.0/3" },
|
|
901
|
+
{ iana: "Europe/Warsaw", posix: "CET-1CEST,M3.5.0,M10.5.0/3" },
|
|
902
|
+
{ iana: "Europe/Zurich", posix: "CET-1CEST,M3.5.0,M10.5.0/3" },
|
|
903
|
+
{ iana: "Europe/Athens", posix: "EET-2EEST,M3.5.0/3,M10.5.0/4" },
|
|
904
|
+
{ iana: "Europe/Helsinki", posix: "EET-2EEST,M3.5.0/3,M10.5.0/4" },
|
|
905
|
+
{ iana: "Europe/Kyiv", posix: "EET-2EEST,M3.5.0/3,M10.5.0/4" },
|
|
906
|
+
{ iana: "Europe/Moscow", posix: "MSK-3" },
|
|
907
|
+
// Asia and the Middle East
|
|
908
|
+
{ iana: "Asia/Jerusalem", posix: "IST-2IDT,M3.5.5/2,M10.5.0" },
|
|
909
|
+
{ iana: "Asia/Dubai", posix: "GST-4" },
|
|
910
|
+
{ iana: "Asia/Kolkata", posix: "IST-5:30" },
|
|
911
|
+
{ iana: "Asia/Bangkok", posix: "ICT-7" },
|
|
912
|
+
{ iana: "Asia/Shanghai", posix: "CST-8" },
|
|
913
|
+
{ iana: "Asia/Hong_Kong", posix: "HKT-8" },
|
|
914
|
+
{ iana: "Asia/Singapore", posix: "SGT-8" },
|
|
915
|
+
{ iana: "Asia/Tokyo", posix: "JST-9" },
|
|
916
|
+
{ iana: "Asia/Seoul", posix: "KST-9" },
|
|
917
|
+
// Oceania
|
|
918
|
+
{ iana: "Australia/Perth", posix: "AWST-8" },
|
|
919
|
+
{ iana: "Australia/Brisbane", posix: "AEST-10" },
|
|
920
|
+
{ iana: "Australia/Adelaide", posix: "ACST-9:30ACDT,M10.1.0,M4.1.0/3" },
|
|
921
|
+
{ iana: "Australia/Sydney", posix: "AEST-10AEDT,M10.1.0,M4.1.0/3" },
|
|
922
|
+
{ iana: "Australia/Melbourne", posix: "AEST-10AEDT,M10.1.0,M4.1.0/3" },
|
|
923
|
+
{ iana: "Pacific/Auckland", posix: "NZST-12NZDT,M9.5.0,M4.1.0/3" },
|
|
924
|
+
{ iana: "UTC", posix: "UTC0" }
|
|
925
|
+
];
|
|
926
|
+
var DEVICE_TIMEZONE_FALLBACK = "UTC0";
|
|
927
|
+
|
|
928
|
+
// src/ai/tools.ts
|
|
929
|
+
import { z as z10 } from "zod";
|
|
930
|
+
var telemetryGraphParameters = z10.object({
|
|
931
|
+
deviceId: z10.string().min(1, "Device ID is required"),
|
|
932
|
+
timeRange: z10.enum(["1h", "24h", "7d"], {
|
|
412
933
|
errorMap: () => ({ message: "Time range must be 1h, 24h, or 7d" })
|
|
413
934
|
}),
|
|
414
|
-
metrics:
|
|
415
|
-
|
|
935
|
+
metrics: z10.array(
|
|
936
|
+
z10.enum(["temperature", "humidity", "vwc", "ec", "ph", "pressure", "co2"])
|
|
416
937
|
).min(1, "At least one metric is required").max(4, "Maximum 4 metrics per graph")
|
|
417
938
|
});
|
|
418
|
-
var stockChartParameters =
|
|
419
|
-
ticker:
|
|
420
|
-
timeRange:
|
|
939
|
+
var stockChartParameters = z10.object({
|
|
940
|
+
ticker: z10.string().min(1).describe("The stock ticker symbol explicitly requested by the user. YOU MUST EXTRACT AND PROVIDE THIS (e.g., 'AAPL', 'MSFT')."),
|
|
941
|
+
timeRange: z10.enum(["1D", "1W", "1M", "1Y"], {
|
|
421
942
|
errorMap: () => ({ message: "Time range must be 1D, 1W, 1M, or 1Y" })
|
|
422
943
|
}).describe("The time range for the chart. Choose based on user request or default to '1M'."),
|
|
423
|
-
metrics:
|
|
944
|
+
metrics: z10.array(z10.enum(["price", "volume", "moving_average"])).min(1, "At least one metric is required").describe("Array of metrics to display. Always include 'price' and 'volume' unless user specifies otherwise.")
|
|
424
945
|
});
|
|
425
|
-
var tickerParam =
|
|
426
|
-
var liveQuoteParameters =
|
|
427
|
-
var companyNewsParameters =
|
|
428
|
-
var companyProfileParameters =
|
|
429
|
-
var counterpartyGraphParameters =
|
|
946
|
+
var tickerParam = z10.string().min(1).describe("The stock ticker symbol (e.g., 'AAPL', 'TSLA', 'MSFT').");
|
|
947
|
+
var liveQuoteParameters = z10.object({ ticker: tickerParam });
|
|
948
|
+
var companyNewsParameters = z10.object({ ticker: tickerParam });
|
|
949
|
+
var companyProfileParameters = z10.object({ ticker: tickerParam });
|
|
950
|
+
var counterpartyGraphParameters = z10.object({
|
|
430
951
|
ticker: tickerParam,
|
|
431
|
-
hops:
|
|
952
|
+
hops: z10.number().int().min(1).max(2).optional().describe("How many relationship hops to traverse (1 = direct counterparties only, 2 = counterparties-of-counterparties too). Defaults to 1 if omitted.")
|
|
432
953
|
});
|
|
433
|
-
var divergenceMetricsParameters =
|
|
434
|
-
var architectureReferenceParameters =
|
|
954
|
+
var divergenceMetricsParameters = z10.object({ ticker: tickerParam });
|
|
955
|
+
var architectureReferenceParameters = z10.object({});
|
|
435
956
|
var AI_TOOLS = {
|
|
436
957
|
get_telemetry_graph: {
|
|
437
958
|
name: "get_telemetry_graph",
|
|
@@ -479,6 +1000,16 @@ var AI_TOOLS = {
|
|
|
479
1000
|
var DEFAULT_SCHEMA_MODEL = "gemini-2.5-flash";
|
|
480
1001
|
var DEFAULT_CHAT_MODEL = "gemini-2.5-flash";
|
|
481
1002
|
var DEFAULT_PRO_MODEL = "gemini-2.5-pro";
|
|
1003
|
+
var PROVIDER_DEFAULT_MODEL = {
|
|
1004
|
+
"google-gemini": "gemini-2.5-flash",
|
|
1005
|
+
"openai": "gpt-4o-mini",
|
|
1006
|
+
"anthropic": "claude-haiku-4-5-20251001",
|
|
1007
|
+
"grok": "grok-2-1212",
|
|
1008
|
+
"deepseek": "deepseek-chat",
|
|
1009
|
+
"ollama": "llama3.3"
|
|
1010
|
+
};
|
|
1011
|
+
var ASSISTANT_PROVIDER = "anthropic";
|
|
1012
|
+
var ASSISTANT_MODEL = PROVIDER_DEFAULT_MODEL[ASSISTANT_PROVIDER];
|
|
482
1013
|
var AI_ROSTER = {
|
|
483
1014
|
/** The Strategist: high creativity, exploratory conversation */
|
|
484
1015
|
STRATEGIST: {
|
|
@@ -656,13 +1187,155 @@ RULE: If you cannot express a UI intent with a semantic token from the \u2705 li
|
|
|
656
1187
|
use bg-card or bg-background as a safe fallback. NEVER invent raw colors.
|
|
657
1188
|
`;
|
|
658
1189
|
|
|
1190
|
+
// src/ai/prompts/appDocument.prompt.ts
|
|
1191
|
+
var APP_DOCUMENT_SYSTEM_PROMPT = `
|
|
1192
|
+
You write tiny apps for a small desk device whose screen is 320 pixels wide and
|
|
1193
|
+
240 pixels high \u2014 landscape.
|
|
1194
|
+
|
|
1195
|
+
Reply with ONE JSON object and nothing else. No markdown fences, no explanation.
|
|
1196
|
+
|
|
1197
|
+
THE SHAPE
|
|
1198
|
+
|
|
1199
|
+
{
|
|
1200
|
+
"schemaVersion": 1,
|
|
1201
|
+
"id": "lowercase-slug",
|
|
1202
|
+
"name": "Short Name",
|
|
1203
|
+
"screen": "320x240",
|
|
1204
|
+
"background": "background",
|
|
1205
|
+
"sources": { },
|
|
1206
|
+
"blocks": [ ]
|
|
1207
|
+
}
|
|
1208
|
+
|
|
1209
|
+
BLOCKS \u2014 up to 12, drawn top to bottom. Each is one of:
|
|
1210
|
+
|
|
1211
|
+
{ "type": "text", "value": V, "size": S, "align": A, "color": C, "suffix": "\xB0" }
|
|
1212
|
+
{ "type": "dial", "value": V, "min": 0, "max": 100, "label": "CPU", "color": C }
|
|
1213
|
+
{ "type": "bar", "value": V, "min": 0, "max": 100, "color": C }
|
|
1214
|
+
{ "type": "sparkline", "series": V, "color": C }
|
|
1215
|
+
{ "type": "status", "state": V, "label": "Door", "color": C }
|
|
1216
|
+
{ "type": "sprite", "palette": [C, ...], "grid": "0011
|
|
1217
|
+
0110
|
|
1218
|
+
1100
|
|
1219
|
+
0011", "align": A }
|
|
1220
|
+
{ "type": "group", "direction": "row"|"stack", "gap": 8, "align": A, "children": [ ...leaves... ] }
|
|
1221
|
+
|
|
1222
|
+
DRAWING A SPRITE \u2014 you may, and here is the only form that works.
|
|
1223
|
+
|
|
1224
|
+
Write a "grid": one line per row, one hex character per pixel, each character
|
|
1225
|
+
indexing "palette" (so "0" is the first colour, "1" the second, up to "f").
|
|
1226
|
+
Every row must be exactly the same length. Up to 64x64, but 16x16 and 32x32
|
|
1227
|
+
look far better \u2014 small palettes and bold shapes read on a 320x240 panel, fine
|
|
1228
|
+
detail does not.
|
|
1229
|
+
|
|
1230
|
+
{ "type": "sprite",
|
|
1231
|
+
"palette": ["background", "255 214 10", "17 17 17"],
|
|
1232
|
+
"grid": "0011110
|
|
1233
|
+
0122210
|
|
1234
|
+
1222221
|
|
1235
|
+
1211121
|
|
1236
|
+
1222221
|
|
1237
|
+
0122210
|
|
1238
|
+
0011110" }
|
|
1239
|
+
|
|
1240
|
+
Put the background colour FIRST so "0" means empty, and use "." as a synonym
|
|
1241
|
+
for "0" if it makes the shape easier to see while you write it.
|
|
1242
|
+
|
|
1243
|
+
Palette entries are the same colours as everywhere else: a semantic token
|
|
1244
|
+
re-colours with the theme, which is what an icon wants, and literal "R G B"
|
|
1245
|
+
does not, which is what a picture wants.
|
|
1246
|
+
|
|
1247
|
+
NEVER write a "pixels" field yourself. That is base64 of packed nibbles, one
|
|
1248
|
+
wrong character shifts every pixel after it, and you cannot check it. Write the
|
|
1249
|
+
grid; it is converted for you. If a document you are editing already has
|
|
1250
|
+
"pixels" and no "grid", leave it exactly as it is.
|
|
1251
|
+
|
|
1252
|
+
PHOTOS \u2014 a document you are editing may hold { "type": "image", "asset": "<64 hex
|
|
1253
|
+
characters>", ... }. That is a picture someone uploaded, named by the hash of
|
|
1254
|
+
its file. Keep every image block exactly as it is unless asked to remove it, and
|
|
1255
|
+
never write one yourself: you cannot make the file it names, so any hash you
|
|
1256
|
+
invent draws nothing.
|
|
1257
|
+
|
|
1258
|
+
Count your rows before you answer. A grid whose rows are different lengths is
|
|
1259
|
+
the one mistake that will come back to you.
|
|
1260
|
+
|
|
1261
|
+
A group holds leaves only. Groups do NOT nest inside groups \u2014 the device has no
|
|
1262
|
+
layout engine, only computed offsets.
|
|
1263
|
+
|
|
1264
|
+
CONDITIONS \u2014 any block may also carry these:
|
|
1265
|
+
|
|
1266
|
+
"hideWhen": { "value": O, "op": "<", "than": 32 }
|
|
1267
|
+
leave it off the screen entirely while that is true
|
|
1268
|
+
|
|
1269
|
+
"rules": [ { "when": { "value": O, "op": "<", "than": 32 }, "color": "accent" },
|
|
1270
|
+
{ "when": { "value": O, "op": ">", "than": 85 }, "color": "danger" } ]
|
|
1271
|
+
style that applies only when something is true. First match wins, so write
|
|
1272
|
+
the narrowest band first. At most four. Each may set "color", "size" or both.
|
|
1273
|
+
|
|
1274
|
+
op is one of "<" "<=" ">" ">=" "==" "!="
|
|
1275
|
+
Only == and != work on words; the rest are for numbers.
|
|
1276
|
+
|
|
1277
|
+
O is an operand: { "literal": 32 } or { "source": "forecast", "field": "temperature" }
|
|
1278
|
+
|
|
1279
|
+
This is how "make it red when it is freezing" is expressed. Use it whenever a
|
|
1280
|
+
request contains "when", "if", "unless", "only", or a colour tied to a value.
|
|
1281
|
+
|
|
1282
|
+
S (size) "xs" | "sm" | "base" | "lg" | "xl" | "display"
|
|
1283
|
+
A (align) "start" | "center" | "end"
|
|
1284
|
+
C (color) "background" | "foreground" | "muted" | "accent" | "success" | "warning" | "danger"
|
|
1285
|
+
or three space-separated RGB numbers, e.g. "220 53 69"
|
|
1286
|
+
|
|
1287
|
+
VALUES \u2014 every V is one of:
|
|
1288
|
+
|
|
1289
|
+
{ "literal": "Hello" } text you wrote
|
|
1290
|
+
{ "source": "forecast", "field": "temperature" } read from a source
|
|
1291
|
+
{ "compute": "subtract", "of": [O, O], "round": true } arithmetic
|
|
1292
|
+
|
|
1293
|
+
compute is "add" | "subtract" | "multiply" | "divide", exactly two operands,
|
|
1294
|
+
and it does NOT nest \u2014 an operand is a literal or a source field, never
|
|
1295
|
+
another compute. "The difference between the high and the low" is the shape
|
|
1296
|
+
this is for.
|
|
1297
|
+
|
|
1298
|
+
SOURCES \u2014 declare what the app reads, then bind to it by name:
|
|
1299
|
+
|
|
1300
|
+
"forecast": { "kind": "weather", "latitude": 39.95, "longitude": -75.17,
|
|
1301
|
+
"units": "imperial", "refreshSeconds": 600 }
|
|
1302
|
+
fields: temperature, condition, high, low
|
|
1303
|
+
"now": { "kind": "clock", "timezone": "America/New_York", "twentyFourHour": false }
|
|
1304
|
+
fields: time, date, weekday, hour (hour is 0-23, for rules about time of day)
|
|
1305
|
+
"until": { "kind": "countdown", "target": "2026-12-25", "label": "Christmas" }
|
|
1306
|
+
fields: days, hours, minutes, seconds, label
|
|
1307
|
+
"fixed": { "kind": "static", "values": { "anything": 1 } }
|
|
1308
|
+
fields: whatever you put in values
|
|
1309
|
+
"turn": { "kind": "cycle", "count": 2, "minutes": 5 }
|
|
1310
|
+
fields: index (0, 1, \u2026 count-1, moving on every "minutes", then round again)
|
|
1311
|
+
For things that take turns: give each block "hideWhen": { "value":
|
|
1312
|
+
{ "source": "turn", "field": "index" }, "op": "!=", "than": N } so only
|
|
1313
|
+
block N shows on turn N. The board changes at most once a minute.
|
|
1314
|
+
|
|
1315
|
+
RULES
|
|
1316
|
+
|
|
1317
|
+
1. 320x240 is small, and it is wider than it is tall. A "display" size text is
|
|
1318
|
+
about 56 pixels tall \u2014 one of those and two or three smaller lines fill the
|
|
1319
|
+
height. Use the width: a "row" group puts two or three things side by side.
|
|
1320
|
+
Prefer fewer, bigger things over a dense dashboard.
|
|
1321
|
+
2. Use semantic colours unless asked for a specific one. They follow the theme.
|
|
1322
|
+
3. There is no scrolling and no text wrapping. Long strings are cut off.
|
|
1323
|
+
4. No tables, no forms, no images, no buttons. The screen shows; it does not
|
|
1324
|
+
take input.
|
|
1325
|
+
5. If the request needs something the vocabulary cannot express, build the
|
|
1326
|
+
closest thing it can and do not invent a component.
|
|
1327
|
+
6. Prefer a rule over a fixed colour whenever the request ties appearance to a
|
|
1328
|
+
value. "Red when cold" is a rule; "red" is not.
|
|
1329
|
+
`.trim();
|
|
1330
|
+
var APP_DOCUMENT_EDIT_PREFIX = "Here is the current app. Change only what is asked:";
|
|
1331
|
+
|
|
659
1332
|
// src/theme/schema.ts
|
|
660
|
-
import { z as
|
|
661
|
-
var RGBString =
|
|
1333
|
+
import { z as z11 } from "zod";
|
|
1334
|
+
var RGBString = z11.string().regex(
|
|
662
1335
|
/^\d{1,3}\s+\d{1,3}\s+\d{1,3}$/,
|
|
663
1336
|
'Must be space-separated RGB integers (e.g. "13 110 253")'
|
|
664
1337
|
);
|
|
665
|
-
var ThemeOverridesSchema =
|
|
1338
|
+
var ThemeOverridesSchema = z11.object({
|
|
666
1339
|
// ── Core Brand ───────────────────────────────────────────────────────────
|
|
667
1340
|
"--app-primary-color": RGBString.optional(),
|
|
668
1341
|
"--app-primary-foreground-color": RGBString.optional(),
|
|
@@ -678,9 +1351,9 @@ var ThemeOverridesSchema = z7.object({
|
|
|
678
1351
|
"--app-muted-bg": RGBString.optional(),
|
|
679
1352
|
"--app-muted-text": RGBString.optional(),
|
|
680
1353
|
// ── Shape ────────────────────────────────────────────────────────────────
|
|
681
|
-
"--app-border-radius-sm":
|
|
682
|
-
"--app-border-radius-md":
|
|
683
|
-
"--app-border-radius-lg":
|
|
1354
|
+
"--app-border-radius-sm": z11.string().optional(),
|
|
1355
|
+
"--app-border-radius-md": z11.string().optional(),
|
|
1356
|
+
"--app-border-radius-lg": z11.string().optional(),
|
|
684
1357
|
// ── Form Controls ────────────────────────────────────────────────────────
|
|
685
1358
|
"--app-input-bg-color": RGBString.optional(),
|
|
686
1359
|
"--app-input-text-color": RGBString.optional(),
|
|
@@ -694,19 +1367,19 @@ var ThemeOverridesSchema = z7.object({
|
|
|
694
1367
|
"--app-chart-4": RGBString.optional(),
|
|
695
1368
|
"--app-chart-5": RGBString.optional()
|
|
696
1369
|
}).strict();
|
|
697
|
-
var ThemeFontsSchema =
|
|
1370
|
+
var ThemeFontsSchema = z11.object({
|
|
698
1371
|
/** Google Font name for headings (h1–h4, .font-serif). Example: "Playfair Display" */
|
|
699
|
-
heading:
|
|
1372
|
+
heading: z11.string(),
|
|
700
1373
|
/** Google Font name for body text. Example: "Inter" */
|
|
701
|
-
body:
|
|
1374
|
+
body: z11.string(),
|
|
702
1375
|
/** Optional monospace font. Example: "Roboto Mono" */
|
|
703
|
-
mono:
|
|
1376
|
+
mono: z11.string().optional()
|
|
704
1377
|
});
|
|
705
|
-
var AIThemeSchema =
|
|
1378
|
+
var AIThemeSchema = z11.object({
|
|
706
1379
|
/** Short descriptive theme name. Example: "Midnight Garden" */
|
|
707
|
-
name:
|
|
1380
|
+
name: z11.string(),
|
|
708
1381
|
/** One-sentence vibe description. Example: "Dark indigo with golden accents." */
|
|
709
|
-
description:
|
|
1382
|
+
description: z11.string(),
|
|
710
1383
|
/** Google Font pairing for heading and body text. */
|
|
711
1384
|
fonts: ThemeFontsSchema.optional(),
|
|
712
1385
|
/**
|
|
@@ -717,13 +1390,13 @@ var AIThemeSchema = z7.object({
|
|
|
717
1390
|
cssVars: ThemeOverridesSchema
|
|
718
1391
|
});
|
|
719
1392
|
var THEME_PRESETS = ["light", "dark", "system", "corporate", "midnight", "blueprint"];
|
|
720
|
-
var ThemeTokensSchema =
|
|
1393
|
+
var ThemeTokensSchema = z11.object({
|
|
721
1394
|
primary: RGBString,
|
|
722
1395
|
neutral: RGBString,
|
|
723
1396
|
success: RGBString,
|
|
724
1397
|
warning: RGBString,
|
|
725
1398
|
destructive: RGBString,
|
|
726
|
-
radius:
|
|
1399
|
+
radius: z11.enum(["none", "sm", "md", "lg", "full"])
|
|
727
1400
|
});
|
|
728
1401
|
var DEFAULT_THEME_TOKENS = {
|
|
729
1402
|
primary: "13 110 253",
|
|
@@ -735,22 +1408,101 @@ var DEFAULT_THEME_TOKENS = {
|
|
|
735
1408
|
};
|
|
736
1409
|
|
|
737
1410
|
// src/auth/schema.ts
|
|
738
|
-
import { z as
|
|
739
|
-
var UserSchema =
|
|
740
|
-
id:
|
|
741
|
-
name:
|
|
742
|
-
email:
|
|
743
|
-
password:
|
|
744
|
-
role:
|
|
745
|
-
status:
|
|
746
|
-
joinedAt:
|
|
747
|
-
lastActive:
|
|
748
|
-
avatarUrl:
|
|
1411
|
+
import { z as z12 } from "zod";
|
|
1412
|
+
var UserSchema = z12.object({
|
|
1413
|
+
id: z12.string().default(""),
|
|
1414
|
+
name: z12.string(),
|
|
1415
|
+
email: z12.string().email(),
|
|
1416
|
+
password: z12.string().optional(),
|
|
1417
|
+
role: z12.string(),
|
|
1418
|
+
status: z12.string().optional(),
|
|
1419
|
+
joinedAt: z12.string().optional(),
|
|
1420
|
+
lastActive: z12.string().optional(),
|
|
1421
|
+
avatarUrl: z12.string().optional()
|
|
749
1422
|
});
|
|
750
1423
|
|
|
1424
|
+
// src/auth/accounts.ts
|
|
1425
|
+
import { z as z13 } from "zod";
|
|
1426
|
+
var AccountIdSchema = z13.string().regex(/^acct_[0-9a-f]{12}$/, "acct_ and 12 hex digits");
|
|
1427
|
+
var AccountRoleSchema = z13.enum(["member", "admin"]);
|
|
1428
|
+
var AccountStatusSchema = z13.enum(["active", "suspended"]);
|
|
1429
|
+
var ScryptHashSchema = z13.object({
|
|
1430
|
+
algo: z13.literal("scrypt"),
|
|
1431
|
+
n: z13.number().int().positive(),
|
|
1432
|
+
r: z13.number().int().positive(),
|
|
1433
|
+
p: z13.number().int().positive(),
|
|
1434
|
+
keylen: z13.number().int().positive(),
|
|
1435
|
+
salt: z13.string().min(16),
|
|
1436
|
+
hash: z13.string().min(16)
|
|
1437
|
+
});
|
|
1438
|
+
var AccountRecordSchema = z13.object({
|
|
1439
|
+
accountId: AccountIdSchema,
|
|
1440
|
+
/** Lowercased on write, because a login must not depend on how it was typed. */
|
|
1441
|
+
email: z13.string().email().max(254),
|
|
1442
|
+
name: z13.string().min(1).max(64),
|
|
1443
|
+
role: AccountRoleSchema,
|
|
1444
|
+
status: AccountStatusSchema,
|
|
1445
|
+
password: ScryptHashSchema,
|
|
1446
|
+
createdAt: z13.number().int().nonnegative(),
|
|
1447
|
+
lastLoginAt: z13.number().int().nonnegative().nullable().default(null),
|
|
1448
|
+
/** Which admin approved this, or null for the bootstrap account. */
|
|
1449
|
+
invitedBy: AccountIdSchema.nullable().default(null)
|
|
1450
|
+
});
|
|
1451
|
+
var PublicAccountSchema = z13.object({
|
|
1452
|
+
accountId: AccountIdSchema,
|
|
1453
|
+
email: z13.string().email(),
|
|
1454
|
+
name: z13.string(),
|
|
1455
|
+
role: AccountRoleSchema,
|
|
1456
|
+
status: AccountStatusSchema
|
|
1457
|
+
});
|
|
1458
|
+
var SessionRecordSchema = z13.object({
|
|
1459
|
+
accountId: AccountIdSchema,
|
|
1460
|
+
createdAt: z13.number().int().nonnegative(),
|
|
1461
|
+
expiresAt: z13.number().int().nonnegative(),
|
|
1462
|
+
lastSeenAt: z13.number().int().nonnegative()
|
|
1463
|
+
});
|
|
1464
|
+
var InviteRecordSchema = z13.object({
|
|
1465
|
+
email: z13.string().email().max(254),
|
|
1466
|
+
role: AccountRoleSchema,
|
|
1467
|
+
createdAt: z13.number().int().nonnegative(),
|
|
1468
|
+
expiresAt: z13.number().int().nonnegative(),
|
|
1469
|
+
invitedBy: AccountIdSchema
|
|
1470
|
+
});
|
|
1471
|
+
var AccessRequestSchema = z13.object({
|
|
1472
|
+
email: z13.string().email().max(254),
|
|
1473
|
+
name: z13.string().min(1).max(64),
|
|
1474
|
+
/** Optional, and never shown publicly. Long enough to be useful, short enough not to be an essay. */
|
|
1475
|
+
reason: z13.string().max(500).optional()
|
|
1476
|
+
});
|
|
1477
|
+
var AccessRequestStatusSchema = z13.enum(["pending", "approved", "denied"]);
|
|
1478
|
+
var AccessRequestRecordSchema = z13.object({
|
|
1479
|
+
requestId: z13.string().regex(/^req_[0-9a-f]{12}$/, "req_ and 12 hex digits"),
|
|
1480
|
+
email: z13.string().email().max(254),
|
|
1481
|
+
name: z13.string().min(1).max(64),
|
|
1482
|
+
reason: z13.string().max(500).optional(),
|
|
1483
|
+
status: AccessRequestStatusSchema,
|
|
1484
|
+
createdAt: z13.number().int().nonnegative(),
|
|
1485
|
+
decidedAt: z13.number().int().nonnegative().nullable().default(null),
|
|
1486
|
+
decidedBy: AccountIdSchema.nullable().default(null)
|
|
1487
|
+
});
|
|
1488
|
+
var SCRYPT_PARAMS = {
|
|
1489
|
+
n: 32768,
|
|
1490
|
+
r: 8,
|
|
1491
|
+
p: 1,
|
|
1492
|
+
keylen: 64,
|
|
1493
|
+
maxmem: 64 * 1024 * 1024
|
|
1494
|
+
};
|
|
1495
|
+
var MIN_PASSWORD_LENGTH = 12;
|
|
1496
|
+
var MAX_PASSWORD_LENGTH = 200;
|
|
1497
|
+
var SESSION_COOKIE_NAME = "ramme_session";
|
|
1498
|
+
var SESSION_TTL_SECONDS = 60 * 60 * 24 * 30;
|
|
1499
|
+
var ACCOUNT_TTL_SECONDS = 60 * 60 * 24 * 400;
|
|
1500
|
+
var INVITE_TTL_SECONDS = 60 * 60 * 24 * 14;
|
|
1501
|
+
var ACCESS_REQUEST_TTL_SECONDS = 60 * 60 * 24 * 90;
|
|
1502
|
+
|
|
751
1503
|
// src/counterparty/schema.ts
|
|
752
|
-
import { z as
|
|
753
|
-
var CounterpartyTypeSchema =
|
|
1504
|
+
import { z as z14 } from "zod";
|
|
1505
|
+
var CounterpartyTypeSchema = z14.enum([
|
|
754
1506
|
"supplier",
|
|
755
1507
|
"customer",
|
|
756
1508
|
"partner",
|
|
@@ -758,28 +1510,28 @@ var CounterpartyTypeSchema = z9.enum([
|
|
|
758
1510
|
"regulator",
|
|
759
1511
|
"unknown"
|
|
760
1512
|
]);
|
|
761
|
-
var CounterpartyResolutionSchema =
|
|
1513
|
+
var CounterpartyResolutionSchema = z14.enum([
|
|
762
1514
|
"public",
|
|
763
1515
|
"public_uncovered",
|
|
764
1516
|
"private",
|
|
765
1517
|
"unresolved"
|
|
766
1518
|
]);
|
|
767
|
-
var CounterpartyNodeSchema =
|
|
768
|
-
id:
|
|
769
|
-
ticker:
|
|
1519
|
+
var CounterpartyNodeSchema = z14.object({
|
|
1520
|
+
id: z14.string(),
|
|
1521
|
+
ticker: z14.string().nullable(),
|
|
770
1522
|
/** Name as it appeared in the source signal — e.g. "Nike". Not the registered name. */
|
|
771
|
-
name:
|
|
1523
|
+
name: z14.string(),
|
|
772
1524
|
/** Registered legal name from `profiles` — e.g. "NIKE, Inc.". Null unless `public`. */
|
|
773
|
-
publicName:
|
|
774
|
-
lei:
|
|
1525
|
+
publicName: z14.string().nullable(),
|
|
1526
|
+
lei: z14.string().nullable(),
|
|
775
1527
|
resolution: CounterpartyResolutionSchema,
|
|
776
1528
|
type: CounterpartyTypeSchema,
|
|
777
|
-
confidence:
|
|
778
|
-
sourceSignalIds:
|
|
779
|
-
firstSeenAt:
|
|
780
|
-
lastSeenAt:
|
|
1529
|
+
confidence: z14.number().min(0).max(1),
|
|
1530
|
+
sourceSignalIds: z14.array(z14.number()),
|
|
1531
|
+
firstSeenAt: z14.string().datetime(),
|
|
1532
|
+
lastSeenAt: z14.string().datetime()
|
|
781
1533
|
});
|
|
782
|
-
var RelationshipEdgeTypeSchema =
|
|
1534
|
+
var RelationshipEdgeTypeSchema = z14.enum([
|
|
783
1535
|
"supplies_to",
|
|
784
1536
|
"purchases_from",
|
|
785
1537
|
"partners_with",
|
|
@@ -797,127 +1549,127 @@ var RelationshipEdgeTypeSchema = z9.enum([
|
|
|
797
1549
|
*/
|
|
798
1550
|
"same_as"
|
|
799
1551
|
]);
|
|
800
|
-
var RelationshipEdgeSchema =
|
|
801
|
-
id:
|
|
802
|
-
sourceId:
|
|
803
|
-
targetId:
|
|
1552
|
+
var RelationshipEdgeSchema = z14.object({
|
|
1553
|
+
id: z14.string(),
|
|
1554
|
+
sourceId: z14.string(),
|
|
1555
|
+
targetId: z14.string(),
|
|
804
1556
|
edgeType: RelationshipEdgeTypeSchema,
|
|
805
|
-
weight:
|
|
806
|
-
evidenceSignalIds:
|
|
807
|
-
updatedAt:
|
|
808
|
-
validFrom:
|
|
1557
|
+
weight: z14.number().min(0).max(1),
|
|
1558
|
+
evidenceSignalIds: z14.array(z14.number()),
|
|
1559
|
+
updatedAt: z14.string().datetime(),
|
|
1560
|
+
validFrom: z14.string().datetime(),
|
|
809
1561
|
/** null = currently valid. Set when a differently-typed edge supersedes this one. */
|
|
810
|
-
validTo:
|
|
1562
|
+
validTo: z14.string().datetime().nullable()
|
|
811
1563
|
});
|
|
812
|
-
var SignalWeightSchema =
|
|
813
|
-
signalId:
|
|
814
|
-
weight:
|
|
815
|
-
reason:
|
|
1564
|
+
var SignalWeightSchema = z14.object({
|
|
1565
|
+
signalId: z14.number(),
|
|
1566
|
+
weight: z14.number().min(0).max(1),
|
|
1567
|
+
reason: z14.string().max(280)
|
|
816
1568
|
});
|
|
817
|
-
var DivergenceMetricSchema =
|
|
818
|
-
ticker:
|
|
1569
|
+
var DivergenceMetricSchema = z14.object({
|
|
1570
|
+
ticker: z14.string(),
|
|
819
1571
|
// 'operations'/'customer' are current; 'operational'/'ux' are pre-rename
|
|
820
1572
|
// values that still exist on rows written before the backend's rename —
|
|
821
1573
|
// kept here so reading old rows doesn't fail validation.
|
|
822
|
-
metric:
|
|
823
|
-
score:
|
|
824
|
-
baseline:
|
|
825
|
-
observed:
|
|
826
|
-
computedAt:
|
|
827
|
-
contributingSignals:
|
|
1574
|
+
metric: z14.enum(["operations", "customer", "operational", "ux"]),
|
|
1575
|
+
score: z14.number(),
|
|
1576
|
+
baseline: z14.number(),
|
|
1577
|
+
observed: z14.number(),
|
|
1578
|
+
computedAt: z14.string().datetime(),
|
|
1579
|
+
contributingSignals: z14.array(SignalWeightSchema)
|
|
828
1580
|
});
|
|
829
1581
|
|
|
830
1582
|
// src/non-public-entity/schema.ts
|
|
831
|
-
import { z as
|
|
832
|
-
var NonPublicEntitySchema =
|
|
833
|
-
lei:
|
|
834
|
-
entityName:
|
|
835
|
-
jurisdiction:
|
|
836
|
-
registrationStatus:
|
|
837
|
-
parentEntityLei:
|
|
838
|
-
materialMetadata:
|
|
839
|
-
discoveredAt:
|
|
1583
|
+
import { z as z15 } from "zod";
|
|
1584
|
+
var NonPublicEntitySchema = z15.object({
|
|
1585
|
+
lei: z15.string().nullable(),
|
|
1586
|
+
entityName: z15.string(),
|
|
1587
|
+
jurisdiction: z15.string().nullable(),
|
|
1588
|
+
registrationStatus: z15.string(),
|
|
1589
|
+
parentEntityLei: z15.string().nullable(),
|
|
1590
|
+
materialMetadata: z15.record(z15.unknown()),
|
|
1591
|
+
discoveredAt: z15.string().datetime()
|
|
840
1592
|
});
|
|
841
1593
|
|
|
842
1594
|
// src/events/schema.ts
|
|
843
|
-
import { z as
|
|
844
|
-
var EventSourceSchema =
|
|
845
|
-
var EntityEventKindSchema =
|
|
846
|
-
var ImpactScaleSchema =
|
|
847
|
-
var TimestampPrecisionSchema =
|
|
848
|
-
var EntityEventSchema =
|
|
1595
|
+
import { z as z16 } from "zod";
|
|
1596
|
+
var EventSourceSchema = z16.enum(["db", "mock"]);
|
|
1597
|
+
var EntityEventKindSchema = z16.enum(["news", "filing", "report"]);
|
|
1598
|
+
var ImpactScaleSchema = z16.enum(["graded", "binary", "default", "none"]);
|
|
1599
|
+
var TimestampPrecisionSchema = z16.enum(["second", "day"]);
|
|
1600
|
+
var EntityEventSchema = z16.object({
|
|
849
1601
|
/** Namespaced so ids never collide across sources: `news:1234`, `filing:AAPL:2026-07-31`. */
|
|
850
|
-
id:
|
|
1602
|
+
id: z16.string(),
|
|
851
1603
|
kind: EntityEventKindSchema,
|
|
852
1604
|
/**
|
|
853
1605
|
* The producer's own type string, unmodified — `NEWS_YAHOO FINANCE_YAHOO RSS`,
|
|
854
1606
|
* `ANNUAL`, `SNAPSHOT`. There are 31 distinct NEWS variants in the live table,
|
|
855
1607
|
* so this is for filtering and debugging: never render it raw to a user.
|
|
856
1608
|
*/
|
|
857
|
-
subtype:
|
|
858
|
-
ticker:
|
|
1609
|
+
subtype: z16.string().nullable(),
|
|
1610
|
+
ticker: z16.string(),
|
|
859
1611
|
/** Always `YYYY-MM-DDTHH:MM:SSZ`. Fixed-width, so lexical order == chronological order. */
|
|
860
|
-
occurredAt:
|
|
1612
|
+
occurredAt: z16.string(),
|
|
861
1613
|
precision: TimestampPrecisionSchema,
|
|
862
|
-
title:
|
|
863
|
-
summary:
|
|
864
|
-
url:
|
|
865
|
-
impact:
|
|
1614
|
+
title: z16.string(),
|
|
1615
|
+
summary: z16.string().nullable(),
|
|
1616
|
+
url: z16.string().nullable(),
|
|
1617
|
+
impact: z16.number().nullable(),
|
|
866
1618
|
impactScale: ImpactScaleSchema,
|
|
867
1619
|
/** 0 bearish … 50 neutral … 100 bullish. */
|
|
868
|
-
sentiment:
|
|
1620
|
+
sentiment: z16.number().nullable(),
|
|
869
1621
|
/** False for filings, and for any event sitting at exactly neutral. */
|
|
870
|
-
sentimentIsMeaningful:
|
|
1622
|
+
sentimentIsMeaningful: z16.boolean(),
|
|
871
1623
|
source: EventSourceSchema,
|
|
872
|
-
meta:
|
|
1624
|
+
meta: z16.record(z16.unknown()).nullable()
|
|
873
1625
|
});
|
|
874
|
-
var PaginatedEntityEventsSchema =
|
|
875
|
-
total:
|
|
876
|
-
page:
|
|
877
|
-
page_size:
|
|
878
|
-
data:
|
|
1626
|
+
var PaginatedEntityEventsSchema = z16.object({
|
|
1627
|
+
total: z16.number(),
|
|
1628
|
+
page: z16.number(),
|
|
1629
|
+
page_size: z16.number(),
|
|
1630
|
+
data: z16.array(EntityEventSchema)
|
|
879
1631
|
});
|
|
880
|
-
var EventBucketSizeSchema =
|
|
881
|
-
var EntityEventDensityBucketSchema =
|
|
882
|
-
bucketStart:
|
|
1632
|
+
var EventBucketSizeSchema = z16.enum(["day", "week", "month"]);
|
|
1633
|
+
var EntityEventDensityBucketSchema = z16.object({
|
|
1634
|
+
bucketStart: z16.string(),
|
|
883
1635
|
kind: EntityEventKindSchema,
|
|
884
|
-
count:
|
|
1636
|
+
count: z16.number(),
|
|
885
1637
|
/** Null when no event in the bucket had meaningful sentiment. */
|
|
886
|
-
avgSentiment:
|
|
887
|
-
maxImpact:
|
|
1638
|
+
avgSentiment: z16.number().nullable(),
|
|
1639
|
+
maxImpact: z16.number().nullable()
|
|
888
1640
|
});
|
|
889
|
-
var EntityEventDensitySchema =
|
|
890
|
-
ticker:
|
|
1641
|
+
var EntityEventDensitySchema = z16.object({
|
|
1642
|
+
ticker: z16.string(),
|
|
891
1643
|
bucket: EventBucketSizeSchema,
|
|
892
|
-
buckets:
|
|
1644
|
+
buckets: z16.array(EntityEventDensityBucketSchema),
|
|
893
1645
|
/** So the client can set its time domain without a second request. */
|
|
894
|
-
range:
|
|
1646
|
+
range: z16.object({ min: z16.string(), max: z16.string() }),
|
|
895
1647
|
source: EventSourceSchema
|
|
896
1648
|
});
|
|
897
|
-
var EntityEventFacetSchema =
|
|
1649
|
+
var EntityEventFacetSchema = z16.object({
|
|
898
1650
|
kind: EntityEventKindSchema,
|
|
899
|
-
count:
|
|
900
|
-
earliest:
|
|
901
|
-
latest:
|
|
1651
|
+
count: z16.number(),
|
|
1652
|
+
earliest: z16.string().nullable(),
|
|
1653
|
+
latest: z16.string().nullable(),
|
|
902
1654
|
impactScale: ImpactScaleSchema,
|
|
903
|
-
sentimentUsable:
|
|
1655
|
+
sentimentUsable: z16.boolean()
|
|
904
1656
|
});
|
|
905
|
-
var EntityEventFacetsSchema =
|
|
906
|
-
ticker:
|
|
907
|
-
facets:
|
|
1657
|
+
var EntityEventFacetsSchema = z16.object({
|
|
1658
|
+
ticker: z16.string(),
|
|
1659
|
+
facets: z16.array(EntityEventFacetSchema),
|
|
908
1660
|
source: EventSourceSchema
|
|
909
1661
|
});
|
|
910
|
-
var DailyPricePointSchema =
|
|
911
|
-
date:
|
|
912
|
-
open:
|
|
913
|
-
high:
|
|
914
|
-
low:
|
|
915
|
-
close:
|
|
916
|
-
volume:
|
|
917
|
-
});
|
|
918
|
-
var EntityPriceSeriesSchema =
|
|
919
|
-
ticker:
|
|
920
|
-
series:
|
|
1662
|
+
var DailyPricePointSchema = z16.object({
|
|
1663
|
+
date: z16.string(),
|
|
1664
|
+
open: z16.number().nullable(),
|
|
1665
|
+
high: z16.number().nullable(),
|
|
1666
|
+
low: z16.number().nullable(),
|
|
1667
|
+
close: z16.number(),
|
|
1668
|
+
volume: z16.number().nullable()
|
|
1669
|
+
});
|
|
1670
|
+
var EntityPriceSeriesSchema = z16.object({
|
|
1671
|
+
ticker: z16.string(),
|
|
1672
|
+
series: z16.array(DailyPricePointSchema),
|
|
921
1673
|
source: EventSourceSchema
|
|
922
1674
|
});
|
|
923
1675
|
var EVENT_KIND_LABELS = {
|
|
@@ -937,17 +1689,55 @@ var EXCLUDED_SOURCES = {
|
|
|
937
1689
|
job_log: "24.5M rows with no ticker index \u2014 never touch it in a request path."
|
|
938
1690
|
};
|
|
939
1691
|
export {
|
|
1692
|
+
ACCESS_REQUEST_TTL_SECONDS,
|
|
1693
|
+
ACCOUNT_TTL_SECONDS,
|
|
940
1694
|
AIKeyManifestSchema,
|
|
941
1695
|
AIThemeSchema,
|
|
942
1696
|
AI_ROSTER,
|
|
943
1697
|
AI_TOOLS,
|
|
1698
|
+
APP_DOCUMENT_EDIT_PREFIX,
|
|
1699
|
+
APP_DOCUMENT_SYSTEM_PROMPT,
|
|
1700
|
+
ASSISTANT_MODEL,
|
|
1701
|
+
ASSISTANT_PROVIDER,
|
|
1702
|
+
AccessRequestRecordSchema,
|
|
1703
|
+
AccessRequestSchema,
|
|
1704
|
+
AccessRequestStatusSchema,
|
|
1705
|
+
AccountIdSchema,
|
|
1706
|
+
AccountRecordSchema,
|
|
1707
|
+
AccountRoleSchema,
|
|
1708
|
+
AccountStatusSchema,
|
|
944
1709
|
ActionSchema,
|
|
945
1710
|
AircraftAppConfigSchema,
|
|
1711
|
+
AppAlignSchema,
|
|
1712
|
+
AppBarSchema,
|
|
1713
|
+
AppBindingSchema,
|
|
1714
|
+
AppBlockSchema,
|
|
1715
|
+
AppColorSchema,
|
|
1716
|
+
AppColorTokenSchema,
|
|
1717
|
+
AppComputeSchema,
|
|
1718
|
+
AppConditionSchema,
|
|
1719
|
+
AppDialSchema,
|
|
1720
|
+
AppDocumentSchema,
|
|
1721
|
+
AppGroupSchema,
|
|
1722
|
+
AppImageSchema,
|
|
1723
|
+
AppLeafSchema,
|
|
1724
|
+
AppOperandSchema,
|
|
1725
|
+
AppRgbSchema,
|
|
1726
|
+
AppScreenSizeSchema,
|
|
946
1727
|
AppSignalSchema,
|
|
1728
|
+
AppSourceSchema,
|
|
1729
|
+
AppSparklineSchema,
|
|
947
1730
|
AppSpecificationSchema,
|
|
1731
|
+
AppSpriteSchema,
|
|
1732
|
+
AppStatusSchema,
|
|
1733
|
+
AppStyleRuleSchema,
|
|
1734
|
+
AppTextSchema,
|
|
1735
|
+
AppTextSizeSchema,
|
|
1736
|
+
AssetHashSchema,
|
|
948
1737
|
AuthStrategySchema,
|
|
949
1738
|
BlockSchema,
|
|
950
1739
|
schema_exports as Bodewell,
|
|
1740
|
+
CLAIMED_DEVICE_TTL_SECONDS,
|
|
951
1741
|
ClockAppConfigSchema,
|
|
952
1742
|
CounterpartyNodeSchema,
|
|
953
1743
|
CounterpartyResolutionSchema,
|
|
@@ -960,14 +1750,30 @@ export {
|
|
|
960
1750
|
DEFAULT_THEME_TOKENS,
|
|
961
1751
|
DEVICE_AP_SSID_PREFIX,
|
|
962
1752
|
DEVICE_ENDPOINTS,
|
|
1753
|
+
DEVICE_FRESH_MS,
|
|
1754
|
+
DEVICE_GLYPHS,
|
|
1755
|
+
DEVICE_LABEL_MAX,
|
|
1756
|
+
DEVICE_PALETTE,
|
|
1757
|
+
DEVICE_STALE_MS,
|
|
1758
|
+
DEVICE_TIMEZONES,
|
|
1759
|
+
DEVICE_TIMEZONE_FALLBACK,
|
|
1760
|
+
DEVICE_TTL_SECONDS,
|
|
1761
|
+
DEVICE_UNKNOWN_GLYPH,
|
|
1762
|
+
DEVICE_VITALS_FIELDS,
|
|
963
1763
|
DailyPricePointSchema,
|
|
1764
|
+
DeliveredAppSchema,
|
|
964
1765
|
DeviceAppIdSchema,
|
|
965
1766
|
DeviceAppsSchema,
|
|
966
1767
|
DeviceConfigSchema,
|
|
967
1768
|
DeviceDisplayConfigSchema,
|
|
1769
|
+
DeviceIdSchema,
|
|
968
1770
|
DeviceKindSchema,
|
|
1771
|
+
DeviceRecordSchema,
|
|
1772
|
+
DeviceRegistrationSchema,
|
|
1773
|
+
DeviceSeenSchema,
|
|
969
1774
|
DeviceStatusSchema,
|
|
970
1775
|
DeviceThemeSchema,
|
|
1776
|
+
DeviceVitalsSchema,
|
|
971
1777
|
DivergenceMetricSchema,
|
|
972
1778
|
EVENT_KIND_LABELS,
|
|
973
1779
|
EXCLUDED_SOURCES,
|
|
@@ -985,22 +1791,50 @@ export {
|
|
|
985
1791
|
FloraTelemetrySchema,
|
|
986
1792
|
GENESIS_LIBRARY_CONTEXT,
|
|
987
1793
|
GENESIS_VALID_COMPONENTS,
|
|
1794
|
+
IMAGE_MAX_DRAWN,
|
|
1795
|
+
IMAGE_MAX_SCALE,
|
|
988
1796
|
IMPACT_FLAG_THRESHOLD,
|
|
1797
|
+
INVITE_TTL_SECONDS,
|
|
989
1798
|
ImpactScaleSchema,
|
|
1799
|
+
InviteRecordSchema,
|
|
1800
|
+
MAX_PASSWORD_LENGTH,
|
|
1801
|
+
MIN_PASSWORD_LENGTH,
|
|
990
1802
|
NonPublicEntitySchema,
|
|
1803
|
+
ORIGINAL_MAX_BYTES,
|
|
1804
|
+
ORIGINAL_MAX_SIDE,
|
|
1805
|
+
OwnedSendRequestSchema,
|
|
1806
|
+
PHOTOS_PER_ACCOUNT,
|
|
1807
|
+
PHOTO_UPLOADS_PER_HOUR,
|
|
1808
|
+
PROVIDER_DEFAULT_MODEL,
|
|
991
1809
|
PageSchema,
|
|
992
1810
|
PageSectionSchema,
|
|
993
1811
|
PaginatedEntityEventsSchema,
|
|
1812
|
+
PairCodeSchema,
|
|
1813
|
+
PhotoSummarySchema,
|
|
1814
|
+
PhotoUploadSchema,
|
|
994
1815
|
ProvisioningStateSchema,
|
|
1816
|
+
PublicAccountSchema,
|
|
1817
|
+
RETRO_RENDITION,
|
|
995
1818
|
RelationshipEdgeSchema,
|
|
996
1819
|
RelationshipEdgeTypeSchema,
|
|
997
1820
|
ResourceSchema,
|
|
1821
|
+
SCRYPT_PARAMS,
|
|
998
1822
|
SENTIMENT_NEUTRAL,
|
|
1823
|
+
SESSION_COOKIE_NAME,
|
|
1824
|
+
SESSION_TTL_SECONDS,
|
|
999
1825
|
SIGNAL_DOMAINS,
|
|
1000
1826
|
SIGNAL_KINDS,
|
|
1001
1827
|
SIGNAL_KIND_LABELS,
|
|
1002
1828
|
SIGNAL_SOURCES,
|
|
1829
|
+
SPRITE_MAX_BASE64,
|
|
1830
|
+
SPRITE_MAX_ROW_BYTES,
|
|
1831
|
+
SPRITE_MAX_SIDE,
|
|
1832
|
+
SPR_FORMAT,
|
|
1833
|
+
SPR_MAX_BYTES,
|
|
1834
|
+
ScryptHashSchema,
|
|
1835
|
+
SendRequestSchema,
|
|
1003
1836
|
SensorAppConfigSchema,
|
|
1837
|
+
SessionRecordSchema,
|
|
1004
1838
|
SignalArraySchema,
|
|
1005
1839
|
SignalKindSchema,
|
|
1006
1840
|
SignalPacketSchema,
|
|
@@ -1015,6 +1849,7 @@ export {
|
|
|
1015
1849
|
TimestampPrecisionSchema,
|
|
1016
1850
|
TriggerSchema,
|
|
1017
1851
|
UserSchema,
|
|
1852
|
+
VitalSourceSchema,
|
|
1018
1853
|
WeatherAppConfigSchema,
|
|
1019
1854
|
WorkflowSchema,
|
|
1020
1855
|
architectureReferenceParameters,
|