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