@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 CHANGED
@@ -20,17 +20,55 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // index.ts
21
21
  var index_exports = {};
22
22
  __export(index_exports, {
23
+ ACCESS_REQUEST_TTL_SECONDS: () => ACCESS_REQUEST_TTL_SECONDS,
24
+ ACCOUNT_TTL_SECONDS: () => ACCOUNT_TTL_SECONDS,
23
25
  AIKeyManifestSchema: () => AIKeyManifestSchema,
24
26
  AIThemeSchema: () => AIThemeSchema,
25
27
  AI_ROSTER: () => AI_ROSTER,
26
28
  AI_TOOLS: () => AI_TOOLS,
29
+ APP_DOCUMENT_EDIT_PREFIX: () => APP_DOCUMENT_EDIT_PREFIX,
30
+ APP_DOCUMENT_SYSTEM_PROMPT: () => APP_DOCUMENT_SYSTEM_PROMPT,
31
+ ASSISTANT_MODEL: () => ASSISTANT_MODEL,
32
+ ASSISTANT_PROVIDER: () => ASSISTANT_PROVIDER,
33
+ AccessRequestRecordSchema: () => AccessRequestRecordSchema,
34
+ AccessRequestSchema: () => AccessRequestSchema,
35
+ AccessRequestStatusSchema: () => AccessRequestStatusSchema,
36
+ AccountIdSchema: () => AccountIdSchema,
37
+ AccountRecordSchema: () => AccountRecordSchema,
38
+ AccountRoleSchema: () => AccountRoleSchema,
39
+ AccountStatusSchema: () => AccountStatusSchema,
27
40
  ActionSchema: () => ActionSchema,
28
41
  AircraftAppConfigSchema: () => AircraftAppConfigSchema,
42
+ AppAlignSchema: () => AppAlignSchema,
43
+ AppBarSchema: () => AppBarSchema,
44
+ AppBindingSchema: () => AppBindingSchema,
45
+ AppBlockSchema: () => AppBlockSchema,
46
+ AppColorSchema: () => AppColorSchema,
47
+ AppColorTokenSchema: () => AppColorTokenSchema,
48
+ AppComputeSchema: () => AppComputeSchema,
49
+ AppConditionSchema: () => AppConditionSchema,
50
+ AppDialSchema: () => AppDialSchema,
51
+ AppDocumentSchema: () => AppDocumentSchema,
52
+ AppGroupSchema: () => AppGroupSchema,
53
+ AppImageSchema: () => AppImageSchema,
54
+ AppLeafSchema: () => AppLeafSchema,
55
+ AppOperandSchema: () => AppOperandSchema,
56
+ AppRgbSchema: () => AppRgbSchema,
57
+ AppScreenSizeSchema: () => AppScreenSizeSchema,
29
58
  AppSignalSchema: () => AppSignalSchema,
59
+ AppSourceSchema: () => AppSourceSchema,
60
+ AppSparklineSchema: () => AppSparklineSchema,
30
61
  AppSpecificationSchema: () => AppSpecificationSchema,
62
+ AppSpriteSchema: () => AppSpriteSchema,
63
+ AppStatusSchema: () => AppStatusSchema,
64
+ AppStyleRuleSchema: () => AppStyleRuleSchema,
65
+ AppTextSchema: () => AppTextSchema,
66
+ AppTextSizeSchema: () => AppTextSizeSchema,
67
+ AssetHashSchema: () => AssetHashSchema,
31
68
  AuthStrategySchema: () => AuthStrategySchema,
32
69
  BlockSchema: () => BlockSchema,
33
70
  Bodewell: () => schema_exports,
71
+ CLAIMED_DEVICE_TTL_SECONDS: () => CLAIMED_DEVICE_TTL_SECONDS,
34
72
  ClockAppConfigSchema: () => ClockAppConfigSchema,
35
73
  CounterpartyNodeSchema: () => CounterpartyNodeSchema,
36
74
  CounterpartyResolutionSchema: () => CounterpartyResolutionSchema,
@@ -43,14 +81,30 @@ __export(index_exports, {
43
81
  DEFAULT_THEME_TOKENS: () => DEFAULT_THEME_TOKENS,
44
82
  DEVICE_AP_SSID_PREFIX: () => DEVICE_AP_SSID_PREFIX,
45
83
  DEVICE_ENDPOINTS: () => DEVICE_ENDPOINTS,
84
+ DEVICE_FRESH_MS: () => DEVICE_FRESH_MS,
85
+ DEVICE_GLYPHS: () => DEVICE_GLYPHS,
86
+ DEVICE_LABEL_MAX: () => DEVICE_LABEL_MAX,
87
+ DEVICE_PALETTE: () => DEVICE_PALETTE,
88
+ DEVICE_STALE_MS: () => DEVICE_STALE_MS,
89
+ DEVICE_TIMEZONES: () => DEVICE_TIMEZONES,
90
+ DEVICE_TIMEZONE_FALLBACK: () => DEVICE_TIMEZONE_FALLBACK,
91
+ DEVICE_TTL_SECONDS: () => DEVICE_TTL_SECONDS,
92
+ DEVICE_UNKNOWN_GLYPH: () => DEVICE_UNKNOWN_GLYPH,
93
+ DEVICE_VITALS_FIELDS: () => DEVICE_VITALS_FIELDS,
46
94
  DailyPricePointSchema: () => DailyPricePointSchema,
95
+ DeliveredAppSchema: () => DeliveredAppSchema,
47
96
  DeviceAppIdSchema: () => DeviceAppIdSchema,
48
97
  DeviceAppsSchema: () => DeviceAppsSchema,
49
98
  DeviceConfigSchema: () => DeviceConfigSchema,
50
99
  DeviceDisplayConfigSchema: () => DeviceDisplayConfigSchema,
100
+ DeviceIdSchema: () => DeviceIdSchema,
51
101
  DeviceKindSchema: () => DeviceKindSchema,
102
+ DeviceRecordSchema: () => DeviceRecordSchema,
103
+ DeviceRegistrationSchema: () => DeviceRegistrationSchema,
104
+ DeviceSeenSchema: () => DeviceSeenSchema,
52
105
  DeviceStatusSchema: () => DeviceStatusSchema,
53
106
  DeviceThemeSchema: () => DeviceThemeSchema,
107
+ DeviceVitalsSchema: () => DeviceVitalsSchema,
54
108
  DivergenceMetricSchema: () => DivergenceMetricSchema,
55
109
  EVENT_KIND_LABELS: () => EVENT_KIND_LABELS,
56
110
  EXCLUDED_SOURCES: () => EXCLUDED_SOURCES,
@@ -68,22 +122,50 @@ __export(index_exports, {
68
122
  FloraTelemetrySchema: () => FloraTelemetrySchema,
69
123
  GENESIS_LIBRARY_CONTEXT: () => GENESIS_LIBRARY_CONTEXT,
70
124
  GENESIS_VALID_COMPONENTS: () => GENESIS_VALID_COMPONENTS,
125
+ IMAGE_MAX_DRAWN: () => IMAGE_MAX_DRAWN,
126
+ IMAGE_MAX_SCALE: () => IMAGE_MAX_SCALE,
71
127
  IMPACT_FLAG_THRESHOLD: () => IMPACT_FLAG_THRESHOLD,
128
+ INVITE_TTL_SECONDS: () => INVITE_TTL_SECONDS,
72
129
  ImpactScaleSchema: () => ImpactScaleSchema,
130
+ InviteRecordSchema: () => InviteRecordSchema,
131
+ MAX_PASSWORD_LENGTH: () => MAX_PASSWORD_LENGTH,
132
+ MIN_PASSWORD_LENGTH: () => MIN_PASSWORD_LENGTH,
73
133
  NonPublicEntitySchema: () => NonPublicEntitySchema,
134
+ ORIGINAL_MAX_BYTES: () => ORIGINAL_MAX_BYTES,
135
+ ORIGINAL_MAX_SIDE: () => ORIGINAL_MAX_SIDE,
136
+ OwnedSendRequestSchema: () => OwnedSendRequestSchema,
137
+ PHOTOS_PER_ACCOUNT: () => PHOTOS_PER_ACCOUNT,
138
+ PHOTO_UPLOADS_PER_HOUR: () => PHOTO_UPLOADS_PER_HOUR,
139
+ PROVIDER_DEFAULT_MODEL: () => PROVIDER_DEFAULT_MODEL,
74
140
  PageSchema: () => PageSchema,
75
141
  PageSectionSchema: () => PageSectionSchema,
76
142
  PaginatedEntityEventsSchema: () => PaginatedEntityEventsSchema,
143
+ PairCodeSchema: () => PairCodeSchema,
144
+ PhotoSummarySchema: () => PhotoSummarySchema,
145
+ PhotoUploadSchema: () => PhotoUploadSchema,
77
146
  ProvisioningStateSchema: () => ProvisioningStateSchema,
147
+ PublicAccountSchema: () => PublicAccountSchema,
148
+ RETRO_RENDITION: () => RETRO_RENDITION,
78
149
  RelationshipEdgeSchema: () => RelationshipEdgeSchema,
79
150
  RelationshipEdgeTypeSchema: () => RelationshipEdgeTypeSchema,
80
151
  ResourceSchema: () => ResourceSchema,
152
+ SCRYPT_PARAMS: () => SCRYPT_PARAMS,
81
153
  SENTIMENT_NEUTRAL: () => SENTIMENT_NEUTRAL,
154
+ SESSION_COOKIE_NAME: () => SESSION_COOKIE_NAME,
155
+ SESSION_TTL_SECONDS: () => SESSION_TTL_SECONDS,
82
156
  SIGNAL_DOMAINS: () => SIGNAL_DOMAINS,
83
157
  SIGNAL_KINDS: () => SIGNAL_KINDS,
84
158
  SIGNAL_KIND_LABELS: () => SIGNAL_KIND_LABELS,
85
159
  SIGNAL_SOURCES: () => SIGNAL_SOURCES,
160
+ SPRITE_MAX_BASE64: () => SPRITE_MAX_BASE64,
161
+ SPRITE_MAX_ROW_BYTES: () => SPRITE_MAX_ROW_BYTES,
162
+ SPRITE_MAX_SIDE: () => SPRITE_MAX_SIDE,
163
+ SPR_FORMAT: () => SPR_FORMAT,
164
+ SPR_MAX_BYTES: () => SPR_MAX_BYTES,
165
+ ScryptHashSchema: () => ScryptHashSchema,
166
+ SendRequestSchema: () => SendRequestSchema,
86
167
  SensorAppConfigSchema: () => SensorAppConfigSchema,
168
+ SessionRecordSchema: () => SessionRecordSchema,
87
169
  SignalArraySchema: () => SignalArraySchema,
88
170
  SignalKindSchema: () => SignalKindSchema,
89
171
  SignalPacketSchema: () => SignalPacketSchema,
@@ -98,6 +180,7 @@ __export(index_exports, {
98
180
  TimestampPrecisionSchema: () => TimestampPrecisionSchema,
99
181
  TriggerSchema: () => TriggerSchema,
100
182
  UserSchema: () => UserSchema,
183
+ VitalSourceSchema: () => VitalSourceSchema,
101
184
  WeatherAppConfigSchema: () => WeatherAppConfigSchema,
102
185
  WorkflowSchema: () => WorkflowSchema,
103
186
  architectureReferenceParameters: () => architectureReferenceParameters,
@@ -371,7 +454,8 @@ var BodewellTelemetrySchema = import_zod4.z.object({
371
454
  soil_temp_stemma: import_zod4.z.number().optional().describe("Celsius"),
372
455
  soil_vwc: import_zod4.z.number().describe("Volumetric Water Content / Raw Capacitance"),
373
456
  soil_moisture: import_zod4.z.number().optional().describe("Firmware alias for raw capacitance"),
374
- soil_moisture_raw: import_zod4.z.number().optional().describe("Unscaled capacitance (300-1100)")
457
+ soil_moisture_raw: import_zod4.z.number().optional().describe("Unscaled capacitance (300-1100)"),
458
+ fw_version: import_zod4.z.string().max(40).optional().describe("Firmware build the board is running; absent on v4 sketches, which cannot be updated over the air")
375
459
  }).passthrough();
376
460
  var BodewellCommandSchema = import_zod4.z.object({
377
461
  stick_id: BodewellDeviceID,
@@ -511,34 +595,538 @@ var DEFAULT_DEVICE_CONFIG = {
511
595
  theme: { preset: "dark" }
512
596
  };
513
597
 
514
- // src/ai/tools.ts
598
+ // src/apps/schema.ts
515
599
  var import_zod6 = require("zod");
516
- var telemetryGraphParameters = import_zod6.z.object({
517
- deviceId: import_zod6.z.string().min(1, "Device ID is required"),
518
- timeRange: import_zod6.z.enum(["1h", "24h", "7d"], {
600
+ var AppColorTokenSchema = import_zod6.z.enum([
601
+ "background",
602
+ "foreground",
603
+ "muted",
604
+ "accent",
605
+ "success",
606
+ "warning",
607
+ "danger"
608
+ ]);
609
+ var AppRgbSchema = import_zod6.z.string().regex(/^\d{1,3} \d{1,3} \d{1,3}$/, 'RGB must be three space-separated integers, e.g. "13 110 253"');
610
+ var AppColorSchema = import_zod6.z.union([AppColorTokenSchema, AppRgbSchema]);
611
+ var AppTextSizeSchema = import_zod6.z.enum(["xs", "sm", "base", "lg", "xl", "display"]);
612
+ var AppAlignSchema = import_zod6.z.enum(["start", "center", "end"]);
613
+ var AppSourceSchema = import_zod6.z.discriminatedUnion("kind", [
614
+ import_zod6.z.object({
615
+ kind: import_zod6.z.literal("weather"),
616
+ latitude: import_zod6.z.number().min(-90).max(90),
617
+ longitude: import_zod6.z.number().min(-180).max(180),
618
+ units: import_zod6.z.enum(["imperial", "metric"]).default("imperial"),
619
+ refreshSeconds: import_zod6.z.number().int().min(300).max(86400).default(600)
620
+ }),
621
+ import_zod6.z.object({
622
+ kind: import_zod6.z.literal("clock"),
623
+ /** IANA zone, e.g. "America/New_York". */
624
+ timezone: import_zod6.z.string().default("America/New_York"),
625
+ twentyFourHour: import_zod6.z.boolean().default(false)
626
+ }),
627
+ import_zod6.z.object({
628
+ kind: import_zod6.z.literal("countdown"),
629
+ /** ISO date or datetime, e.g. "2026-12-25" or "2026-12-25T18:00:00Z". */
630
+ target: import_zod6.z.string().min(4),
631
+ label: import_zod6.z.string().max(24).optional()
632
+ }),
633
+ import_zod6.z.object({
634
+ kind: import_zod6.z.literal("static"),
635
+ values: import_zod6.z.record(import_zod6.z.union([import_zod6.z.string(), import_zod6.z.number(), import_zod6.z.boolean()]))
636
+ })
637
+ ]);
638
+ var AppOperandSchema = import_zod6.z.union([
639
+ import_zod6.z.object({ literal: import_zod6.z.number() }),
640
+ import_zod6.z.object({ source: import_zod6.z.string().min(1), field: import_zod6.z.string().min(1) })
641
+ ]);
642
+ var AppComputeSchema = import_zod6.z.object({
643
+ compute: import_zod6.z.enum(["add", "subtract", "multiply", "divide"]),
644
+ of: import_zod6.z.tuple([AppOperandSchema, AppOperandSchema]),
645
+ round: import_zod6.z.boolean().default(true)
646
+ });
647
+ var AppBindingSchema = import_zod6.z.union([
648
+ import_zod6.z.object({ literal: import_zod6.z.union([import_zod6.z.string(), import_zod6.z.number(), import_zod6.z.boolean()]) }),
649
+ import_zod6.z.object({
650
+ /** Key into the document's `sources` map. */
651
+ source: import_zod6.z.string().min(1),
652
+ /** Field on that source, e.g. "temperature", "high", "condition". */
653
+ field: import_zod6.z.string().min(1)
654
+ }),
655
+ AppComputeSchema
656
+ ]);
657
+ var AppConditionSchema = import_zod6.z.object({
658
+ value: AppOperandSchema,
659
+ op: import_zod6.z.enum(["<", "<=", ">", ">=", "==", "!="]),
660
+ than: import_zod6.z.union([import_zod6.z.number(), import_zod6.z.string(), import_zod6.z.boolean()])
661
+ });
662
+ var AppStyleRuleSchema = import_zod6.z.object({
663
+ when: AppConditionSchema,
664
+ color: AppColorSchema.optional(),
665
+ size: AppTextSizeSchema.optional()
666
+ });
667
+ var leafBase = {
668
+ color: AppColorSchema.optional(),
669
+ /** Drawn only when this is false, or absent. */
670
+ hideWhen: AppConditionSchema.optional(),
671
+ /** Conditional style. First match wins. */
672
+ rules: import_zod6.z.array(AppStyleRuleSchema).max(4).optional()
673
+ };
674
+ var AppTextSchema = import_zod6.z.object({
675
+ type: import_zod6.z.literal("text"),
676
+ value: AppBindingSchema,
677
+ size: AppTextSizeSchema.default("base"),
678
+ align: AppAlignSchema.default("start"),
679
+ /** Printed after the value, e.g. a degree symbol. Never itself bound. */
680
+ suffix: import_zod6.z.string().max(8).optional(),
681
+ ...leafBase
682
+ });
683
+ var AppDialSchema = import_zod6.z.object({
684
+ type: import_zod6.z.literal("dial"),
685
+ value: AppBindingSchema,
686
+ min: import_zod6.z.number(),
687
+ max: import_zod6.z.number(),
688
+ label: import_zod6.z.string().max(24).optional(),
689
+ ...leafBase
690
+ });
691
+ var AppSparklineSchema = import_zod6.z.object({
692
+ type: import_zod6.z.literal("sparkline"),
693
+ /** A source field holding a series rather than a scalar. */
694
+ series: AppBindingSchema,
695
+ ...leafBase
696
+ });
697
+ var AppBarSchema = import_zod6.z.object({
698
+ type: import_zod6.z.literal("bar"),
699
+ value: AppBindingSchema,
700
+ min: import_zod6.z.number(),
701
+ max: import_zod6.z.number(),
702
+ ...leafBase
703
+ });
704
+ var AppStatusSchema = import_zod6.z.object({
705
+ type: import_zod6.z.literal("status"),
706
+ state: AppBindingSchema,
707
+ label: import_zod6.z.string().max(24).optional(),
708
+ ...leafBase
709
+ });
710
+ var SPRITE_MAX_SIDE = 64;
711
+ var SPRITE_MAX_ROW_BYTES = SPRITE_MAX_SIDE / 2;
712
+ var SPRITE_MAX_BASE64 = Math.ceil(SPRITE_MAX_ROW_BYTES * SPRITE_MAX_SIDE / 3) * 4;
713
+ var AppSpriteSchema = import_zod6.z.object({
714
+ type: import_zod6.z.literal("sprite"),
715
+ width: import_zod6.z.number().int().min(1).max(SPRITE_MAX_SIDE),
716
+ height: import_zod6.z.number().int().min(1).max(SPRITE_MAX_SIDE),
717
+ /**
718
+ * Up to sixteen colours, in the same form every other colour in a document
719
+ * takes: a semantic token, or literal RGB.
720
+ *
721
+ * Both are allowed on purpose. A token re-colours with the theme, which is
722
+ * what an icon wants; literal RGB does not, which is what a drawing wants.
723
+ * A picture of a dog is content, not chrome, and should not turn teal
724
+ * because somebody switched to the corporate theme.
725
+ */
726
+ palette: import_zod6.z.array(AppColorSchema).min(1).max(16),
727
+ /** base64 of the packed nibbles. */
728
+ pixels: import_zod6.z.string().min(4).max(SPRITE_MAX_BASE64),
729
+ align: AppAlignSchema.default("start"),
730
+ /** Drawn only when this is false, or absent. */
731
+ hideWhen: AppConditionSchema.optional()
732
+ });
733
+ var AssetHashSchema = import_zod6.z.string().regex(/^[0-9a-f]{64}$/, "a lowercase hex SHA-256");
734
+ var IMAGE_MAX_DRAWN = { width: 304, height: 224 };
735
+ var IMAGE_MAX_SCALE = 8;
736
+ var RETRO_RENDITION = { width: 76, height: 56, scale: 4, colors: 16 };
737
+ var SPR_FORMAT = {
738
+ /** "RSPR". */
739
+ magic: [82, 83, 80, 82],
740
+ version: 1,
741
+ /** magic 4, version 1, width u16, height u16, bits per pixel 1, palette count 1. */
742
+ headerBytes: 11,
743
+ /** Only 4 today: two pixels per byte, high nibble first, rows padded to a byte. */
744
+ bitsPerPixel: 4,
745
+ maxColors: 16
746
+ };
747
+ var SPR_MAX_BYTES = SPR_FORMAT.headerBytes + SPR_FORMAT.maxColors * 2 + Math.ceil(IMAGE_MAX_DRAWN.width / 2) * IMAGE_MAX_DRAWN.height;
748
+ var AppImageSchema = import_zod6.z.object({
749
+ type: import_zod6.z.literal("image"),
750
+ asset: AssetHashSchema,
751
+ /** The file's own pixels, not the drawn size. */
752
+ width: import_zod6.z.number().int().min(1).max(IMAGE_MAX_DRAWN.width),
753
+ height: import_zod6.z.number().int().min(1).max(IMAGE_MAX_DRAWN.height),
754
+ scale: import_zod6.z.number().int().min(1).max(IMAGE_MAX_SCALE).default(1),
755
+ align: AppAlignSchema.default("start"),
756
+ /** Drawn only when this is false, or absent. */
757
+ hideWhen: AppConditionSchema.optional()
758
+ });
759
+ var AppLeafSchema = import_zod6.z.discriminatedUnion("type", [
760
+ AppTextSchema,
761
+ AppDialSchema,
762
+ AppSparklineSchema,
763
+ AppBarSchema,
764
+ AppStatusSchema,
765
+ AppSpriteSchema,
766
+ AppImageSchema
767
+ ]);
768
+ var AppGroupSchema = import_zod6.z.object({
769
+ type: import_zod6.z.literal("group"),
770
+ direction: import_zod6.z.enum(["row", "stack"]),
771
+ gap: import_zod6.z.number().int().min(0).max(64).default(4),
772
+ align: AppAlignSchema.default("start"),
773
+ children: import_zod6.z.array(AppLeafSchema).min(1).max(8)
774
+ });
775
+ var AppBlockSchema = import_zod6.z.union([AppLeafSchema, AppGroupSchema]);
776
+ var AppScreenSizeSchema = import_zod6.z.preprocess(
777
+ (value) => value === "240x320" ? "320x240" : value,
778
+ import_zod6.z.enum(["320x240"])
779
+ );
780
+ var AppDocumentSchema = import_zod6.z.object({
781
+ /** Bumped only for a breaking change; the device checks it before parsing. */
782
+ schemaVersion: import_zod6.z.literal(1),
783
+ id: import_zod6.z.string().regex(/^[a-z0-9][a-z0-9-]{1,38}[a-z0-9]$/, "lowercase slug"),
784
+ name: import_zod6.z.string().min(1).max(48),
785
+ /** Free text. Never an email or anything else identifying — see the plan. */
786
+ author: import_zod6.z.string().max(32).optional(),
787
+ screen: AppScreenSizeSchema.default("320x240"),
788
+ background: AppColorSchema.default("background"),
789
+ /** Named so bindings can refer to them. */
790
+ sources: import_zod6.z.record(AppSourceSchema).default({}),
791
+ blocks: import_zod6.z.array(AppBlockSchema).min(1).max(12)
792
+ }).superRefine((doc, ctx) => {
793
+ const bytesPerRow = (width) => Math.ceil(width / 2);
794
+ const check = (block, path) => {
795
+ const b = block;
796
+ if (b?.type !== "sprite" || !b.width || !b.height || typeof b.pixels !== "string") return;
797
+ const want = bytesPerRow(b.width) * b.height;
798
+ const got = Math.floor(b.pixels.replace(/=+$/, "").length * 3 / 4);
799
+ if (got === want) return;
800
+ ctx.addIssue({
801
+ code: import_zod6.z.ZodIssueCode.custom,
802
+ path: [...path, "pixels"],
803
+ 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.`
804
+ });
805
+ };
806
+ const checkImage = (block, path) => {
807
+ const b = block;
808
+ if (b?.type !== "image" || !b.width || !b.height) return;
809
+ const scale = b.scale ?? 1;
810
+ const w = b.width * scale;
811
+ const h = b.height * scale;
812
+ if (w <= IMAGE_MAX_DRAWN.width && h <= IMAGE_MAX_DRAWN.height) return;
813
+ ctx.addIssue({
814
+ code: import_zod6.z.ZodIssueCode.custom,
815
+ path: [...path, "scale"],
816
+ 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.`
817
+ });
818
+ };
819
+ doc.blocks.forEach((block, i) => {
820
+ check(block, ["blocks", i]);
821
+ checkImage(block, ["blocks", i]);
822
+ const children = block.children;
823
+ if (Array.isArray(children)) {
824
+ children.forEach((child, j) => {
825
+ check(child, ["blocks", i, "children", j]);
826
+ checkImage(child, ["blocks", i, "children", j]);
827
+ });
828
+ }
829
+ });
830
+ });
831
+
832
+ // src/apps/photos.ts
833
+ var import_zod7 = require("zod");
834
+ var ORIGINAL_MAX_SIDE = 3072;
835
+ var ORIGINAL_MAX_BYTES = 3e6;
836
+ var PHOTOS_PER_ACCOUNT = 50;
837
+ var PHOTO_UPLOADS_PER_HOUR = 30;
838
+ var PhotoUploadSchema = import_zod7.z.object({
839
+ rendition: import_zod7.z.string().min(4),
840
+ original: import_zod7.z.string().min(4)
841
+ });
842
+ var PhotoSummarySchema = import_zod7.z.object({
843
+ hash: AssetHashSchema,
844
+ /** The rendition's own pixels. */
845
+ width: import_zod7.z.number().int().positive(),
846
+ height: import_zod7.z.number().int().positive(),
847
+ renditionBytes: import_zod7.z.number().int().positive(),
848
+ originalWidth: import_zod7.z.number().int().positive(),
849
+ originalHeight: import_zod7.z.number().int().positive(),
850
+ originalBytes: import_zod7.z.number().int().positive(),
851
+ uploadedAt: import_zod7.z.number().int()
852
+ });
853
+
854
+ // src/apps/delivery.ts
855
+ var import_zod8 = require("zod");
856
+ var DeviceIdSchema = import_zod8.z.string().regex(/^[0-9A-HJKMNP-TV-Z]{8}$/, "eight characters, no I L O or U");
857
+ var PairCodeSchema = import_zod8.z.string().regex(/^\d{4}$/);
858
+ var DeviceRegistrationSchema = import_zod8.z.object({
859
+ deviceId: DeviceIdSchema,
860
+ code: PairCodeSchema,
861
+ /** Firmware build, so a support question has an answer. */
862
+ version: import_zod8.z.string().max(40).optional(),
863
+ /** Which board this is, from Boards.h — the two variants need different firmware. */
864
+ board: import_zod8.z.string().max(40).optional(),
865
+ /** dBm, always negative. -50 is across the room; -85 is a complaint. */
866
+ rssi: import_zod8.z.number().int().min(-127).max(0).optional(),
867
+ /** On the owner's own network. Long enough for IPv6, which this does not send yet. */
868
+ ip: import_zod8.z.string().max(45).optional(),
869
+ /** Seconds since boot. Not growing between check-ins means it is restarting. */
870
+ uptime: import_zod8.z.number().int().nonnegative().optional(),
871
+ /** Free heap in bytes. */
872
+ heap: import_zod8.z.number().int().nonnegative().optional(),
873
+ /** The app revision the board has actually drawn. */
874
+ drew: import_zod8.z.number().int().nonnegative().optional(),
875
+ /** Why it last restarted, already mapped to a word by the firmware. */
876
+ reset: import_zod8.z.string().max(40).optional()
877
+ });
878
+ var SendRequestSchema = import_zod8.z.object({
879
+ deviceId: DeviceIdSchema,
880
+ code: PairCodeSchema
881
+ });
882
+ var OwnedSendRequestSchema = import_zod8.z.object({
883
+ deviceId: DeviceIdSchema
884
+ });
885
+ var DeliveredAppSchema = import_zod8.z.object({
886
+ revision: import_zod8.z.number().int().nonnegative(),
887
+ sentAt: import_zod8.z.number().int().nonnegative()
888
+ });
889
+ var DeviceRecordSchema = import_zod8.z.object({
890
+ deviceId: DeviceIdSchema,
891
+ code: PairCodeSchema,
892
+ ownerId: import_zod8.z.string().nullable().default(null),
893
+ version: import_zod8.z.string().max(40).optional(),
894
+ createdAt: import_zod8.z.number().int().nonnegative(),
895
+ lastSeenAt: import_zod8.z.number().int().nonnegative()
896
+ });
897
+ var DEVICE_LABEL_MAX = 48;
898
+ var DEVICE_TTL_SECONDS = 60 * 60 * 24 * 30;
899
+ var CLAIMED_DEVICE_TTL_SECONDS = 60 * 60 * 24 * 400;
900
+
901
+ // src/apps/vitals.ts
902
+ var import_zod9 = require("zod");
903
+ var VitalSourceSchema = import_zod9.z.enum(["register", "poll", "send"]);
904
+ var DeviceVitalsSchema = import_zod9.z.object({
905
+ /** When the board last said any of this, by the server's clock. */
906
+ reportedAt: import_zod9.z.number().int().nonnegative().optional(),
907
+ /**
908
+ * The firmware build. Today every board sends the literal "doc-1", which is a
909
+ * protocol marker rather than a build id — so this is shown as reported and
910
+ * labelled as not yet a version. The real value lives in the published
911
+ * manifest until firmware carries it.
912
+ */
913
+ firmwareVersion: import_zod9.z.string().max(40).optional(),
914
+ /** Which board this is. Nothing distinguishes a CYD from a Freenove S3 yet. */
915
+ board: import_zod9.z.string().max(40).optional(),
916
+ /** dBm, negative. -50 is across the room, -85 is a complaint. */
917
+ rssi: import_zod9.z.number().int().min(-127).max(0).optional(),
918
+ /** The board's address on its own network, as the board sees it. */
919
+ ip: import_zod9.z.string().max(45).optional(),
920
+ uptimeSeconds: import_zod9.z.number().int().nonnegative().optional(),
921
+ freeHeapBytes: import_zod9.z.number().int().nonnegative().optional(),
922
+ /**
923
+ * The revision the board is actually showing.
924
+ *
925
+ * Distinct from the revision that was sent, and the difference is the whole
926
+ * value: a send that was never drawn looks identical to a successful one until
927
+ * these two numbers disagree.
928
+ */
929
+ drewRevision: import_zod9.z.number().int().nonnegative().optional(),
930
+ /** Why it last restarted, if it says. A board power-cycling in a loop is a fault. */
931
+ resetReason: import_zod9.z.string().max(40).optional(),
932
+ /** When it last polled — finer-grained than a registration, for liveness only. */
933
+ lastPollAt: import_zod9.z.number().int().nonnegative().optional()
934
+ });
935
+ var DeviceSeenSchema = import_zod9.z.object({
936
+ /** When the board last asked for its app. The freshest signal this system has. */
937
+ lastPollAt: import_zod9.z.number().int().nonnegative(),
938
+ /** The revision it reported drawing at that moment. */
939
+ drewRevision: import_zod9.z.number().int().nonnegative().optional()
940
+ });
941
+ var DEVICE_VITALS_FIELDS = [
942
+ {
943
+ key: "firmwareVersion",
944
+ label: "Firmware",
945
+ source: "register",
946
+ reportedByFirmware: true,
947
+ note: 'A build stamped in by CI. Boards flashed before that report the marker "doc-1".'
948
+ },
949
+ { key: "board", label: "Board", source: "register", reportedByFirmware: true },
950
+ { key: "drewRevision", label: "Showing revision", source: "poll", reportedByFirmware: true },
951
+ { key: "rssi", label: "Wi-Fi signal", unit: "dBm", source: "register", reportedByFirmware: true },
952
+ { key: "ip", label: "Address on your network", source: "register", reportedByFirmware: true },
953
+ { key: "uptimeSeconds", label: "Uptime", unit: "s", source: "register", reportedByFirmware: true },
954
+ {
955
+ key: "freeHeapBytes",
956
+ label: "Free memory",
957
+ unit: "bytes",
958
+ source: "register",
959
+ reportedByFirmware: true
960
+ },
961
+ { key: "resetReason", label: "Last restart", source: "register", reportedByFirmware: true }
962
+ ];
963
+ var DEVICE_FRESH_MS = 7 * 60 * 60 * 1e3;
964
+ var DEVICE_STALE_MS = 30 * 24 * 60 * 60 * 1e3;
965
+
966
+ // src/apps/glyphs.ts
967
+ var DEVICE_UNKNOWN_GLYPH = "?";
968
+ var DEVICE_GLYPHS = {
969
+ // Accented Latin, CP437 0x80-0xA5 and 0xE1
970
+ "\xC7": { byte: 128, shows: "\xC7" },
971
+ "\xFC": { byte: 129, shows: "\xFC" },
972
+ "\xE9": { byte: 130, shows: "\xE9" },
973
+ "\xE2": { byte: 131, shows: "\xE2" },
974
+ "\xE4": { byte: 132, shows: "\xE4" },
975
+ "\xE0": { byte: 133, shows: "\xE0" },
976
+ "\xE5": { byte: 134, shows: "\xE5" },
977
+ "\xE7": { byte: 135, shows: "\xE7" },
978
+ "\xEA": { byte: 136, shows: "\xEA" },
979
+ "\xEB": { byte: 137, shows: "\xEB" },
980
+ "\xE8": { byte: 138, shows: "\xE8" },
981
+ "\xEF": { byte: 139, shows: "\xEF" },
982
+ "\xEE": { byte: 140, shows: "\xEE" },
983
+ "\xEC": { byte: 141, shows: "\xEC" },
984
+ "\xC4": { byte: 142, shows: "\xC4" },
985
+ "\xC5": { byte: 143, shows: "\xC5" },
986
+ "\xC9": { byte: 144, shows: "\xC9" },
987
+ "\xE6": { byte: 145, shows: "\xE6" },
988
+ "\xC6": { byte: 146, shows: "\xC6" },
989
+ "\xF4": { byte: 147, shows: "\xF4" },
990
+ "\xF6": { byte: 148, shows: "\xF6" },
991
+ "\xF2": { byte: 149, shows: "\xF2" },
992
+ "\xFB": { byte: 150, shows: "\xFB" },
993
+ "\xF9": { byte: 151, shows: "\xF9" },
994
+ "\xFF": { byte: 152, shows: "\xFF" },
995
+ "\xD6": { byte: 153, shows: "\xD6" },
996
+ "\xDC": { byte: 154, shows: "\xDC" },
997
+ "\xE1": { byte: 160, shows: "\xE1" },
998
+ "\xED": { byte: 161, shows: "\xED" },
999
+ "\xF3": { byte: 162, shows: "\xF3" },
1000
+ "\xFA": { byte: 163, shows: "\xFA" },
1001
+ "\xF1": { byte: 164, shows: "\xF1" },
1002
+ "\xD1": { byte: 165, shows: "\xD1" },
1003
+ "\xDF": { byte: 225, shows: "\xDF" },
1004
+ // Symbols a readout uses
1005
+ "\xA2": { byte: 155, shows: "\xA2" },
1006
+ "\xA3": { byte: 156, shows: "\xA3" },
1007
+ "\xA5": { byte: 157, shows: "\xA5" },
1008
+ "\u0192": { byte: 159, shows: "\u0192" },
1009
+ "\xAA": { byte: 166, shows: "\xAA" },
1010
+ "\xBA": { byte: 167, shows: "\xBA" },
1011
+ "\xBF": { byte: 168, shows: "\xBF" },
1012
+ "\xAC": { byte: 170, shows: "\xAC" },
1013
+ "\xBD": { byte: 171, shows: "\xBD" },
1014
+ "\xBC": { byte: 172, shows: "\xBC" },
1015
+ "\xA1": { byte: 173, shows: "\xA1" },
1016
+ "\xAB": { byte: 174, shows: "\xAB" },
1017
+ "\xBB": { byte: 175, shows: "\xBB" },
1018
+ "\u03C0": { byte: 227, shows: "\u03C0" },
1019
+ "\xB5": { byte: 230, shows: "\xB5" },
1020
+ "\u03A9": { byte: 234, shows: "\u03A9" },
1021
+ "\u221E": { byte: 236, shows: "\u221E" },
1022
+ "\xB1": { byte: 241, shows: "\xB1" },
1023
+ "\u2265": { byte: 242, shows: "\u2265" },
1024
+ "\u2264": { byte: 243, shows: "\u2264" },
1025
+ "\xF7": { byte: 246, shows: "\xF7" },
1026
+ "\u2248": { byte: 247, shows: "\u2248" },
1027
+ "\xB0": { byte: 248, shows: "\xB0" },
1028
+ "\xB7": { byte: 250, shows: "\xB7" },
1029
+ "\u221A": { byte: 251, shows: "\u221A" },
1030
+ "\xB2": { byte: 253, shows: "\xB2" },
1031
+ // Punctuation an AI writes without being asked, folded to ASCII
1032
+ "\u2018": { byte: 39, shows: "'" },
1033
+ "\u2019": { byte: 39, shows: "'" },
1034
+ "\u201C": { byte: 34, shows: '"' },
1035
+ "\u201D": { byte: 34, shows: '"' },
1036
+ "\u2013": { byte: 45, shows: "-" },
1037
+ "\u2014": { byte: 45, shows: "-" },
1038
+ "\u2212": { byte: 45, shows: "-" },
1039
+ "\xA0": { byte: 32, shows: " " }
1040
+ };
1041
+ var DEVICE_PALETTE = {
1042
+ background: "17 17 17",
1043
+ foreground: "238 238 238",
1044
+ muted: "153 153 153",
1045
+ accent: "23 162 184",
1046
+ success: "34 197 94",
1047
+ warning: "245 158 11",
1048
+ danger: "220 53 69"
1049
+ };
1050
+
1051
+ // src/apps/timezones.ts
1052
+ var DEVICE_TIMEZONES = [
1053
+ // North America
1054
+ { iana: "America/New_York", posix: "EST5EDT,M3.2.0,M11.1.0" },
1055
+ { iana: "America/Toronto", posix: "EST5EDT,M3.2.0,M11.1.0" },
1056
+ { iana: "America/Chicago", posix: "CST6CDT,M3.2.0,M11.1.0" },
1057
+ { iana: "America/Denver", posix: "MST7MDT,M3.2.0,M11.1.0" },
1058
+ { iana: "America/Phoenix", posix: "MST7" },
1059
+ { iana: "America/Los_Angeles", posix: "PST8PDT,M3.2.0,M11.1.0" },
1060
+ { iana: "America/Vancouver", posix: "PST8PDT,M3.2.0,M11.1.0" },
1061
+ { iana: "America/Anchorage", posix: "AKST9AKDT,M3.2.0,M11.1.0" },
1062
+ { iana: "Pacific/Honolulu", posix: "HST10" },
1063
+ { iana: "America/Mexico_City", posix: "CST6" },
1064
+ { iana: "America/Sao_Paulo", posix: "BRT3" },
1065
+ // Europe
1066
+ { iana: "Europe/London", posix: "GMT0BST,M3.5.0/1,M10.5.0" },
1067
+ { iana: "Europe/Dublin", posix: "GMT0IST,M3.5.0/1,M10.5.0" },
1068
+ { iana: "Europe/Lisbon", posix: "WET0WEST,M3.5.0/1,M10.5.0" },
1069
+ { iana: "Europe/Paris", posix: "CET-1CEST,M3.5.0,M10.5.0/3" },
1070
+ { iana: "Europe/Berlin", posix: "CET-1CEST,M3.5.0,M10.5.0/3" },
1071
+ { iana: "Europe/Madrid", posix: "CET-1CEST,M3.5.0,M10.5.0/3" },
1072
+ { iana: "Europe/Rome", posix: "CET-1CEST,M3.5.0,M10.5.0/3" },
1073
+ { iana: "Europe/Amsterdam", posix: "CET-1CEST,M3.5.0,M10.5.0/3" },
1074
+ { iana: "Europe/Stockholm", posix: "CET-1CEST,M3.5.0,M10.5.0/3" },
1075
+ { iana: "Europe/Warsaw", posix: "CET-1CEST,M3.5.0,M10.5.0/3" },
1076
+ { iana: "Europe/Zurich", posix: "CET-1CEST,M3.5.0,M10.5.0/3" },
1077
+ { iana: "Europe/Athens", posix: "EET-2EEST,M3.5.0/3,M10.5.0/4" },
1078
+ { iana: "Europe/Helsinki", posix: "EET-2EEST,M3.5.0/3,M10.5.0/4" },
1079
+ { iana: "Europe/Kyiv", posix: "EET-2EEST,M3.5.0/3,M10.5.0/4" },
1080
+ { iana: "Europe/Moscow", posix: "MSK-3" },
1081
+ // Asia and the Middle East
1082
+ { iana: "Asia/Jerusalem", posix: "IST-2IDT,M3.5.5/2,M10.5.0" },
1083
+ { iana: "Asia/Dubai", posix: "GST-4" },
1084
+ { iana: "Asia/Kolkata", posix: "IST-5:30" },
1085
+ { iana: "Asia/Bangkok", posix: "ICT-7" },
1086
+ { iana: "Asia/Shanghai", posix: "CST-8" },
1087
+ { iana: "Asia/Hong_Kong", posix: "HKT-8" },
1088
+ { iana: "Asia/Singapore", posix: "SGT-8" },
1089
+ { iana: "Asia/Tokyo", posix: "JST-9" },
1090
+ { iana: "Asia/Seoul", posix: "KST-9" },
1091
+ // Oceania
1092
+ { iana: "Australia/Perth", posix: "AWST-8" },
1093
+ { iana: "Australia/Brisbane", posix: "AEST-10" },
1094
+ { iana: "Australia/Adelaide", posix: "ACST-9:30ACDT,M10.1.0,M4.1.0/3" },
1095
+ { iana: "Australia/Sydney", posix: "AEST-10AEDT,M10.1.0,M4.1.0/3" },
1096
+ { iana: "Australia/Melbourne", posix: "AEST-10AEDT,M10.1.0,M4.1.0/3" },
1097
+ { iana: "Pacific/Auckland", posix: "NZST-12NZDT,M9.5.0,M4.1.0/3" },
1098
+ { iana: "UTC", posix: "UTC0" }
1099
+ ];
1100
+ var DEVICE_TIMEZONE_FALLBACK = "UTC0";
1101
+
1102
+ // src/ai/tools.ts
1103
+ var import_zod10 = require("zod");
1104
+ var telemetryGraphParameters = import_zod10.z.object({
1105
+ deviceId: import_zod10.z.string().min(1, "Device ID is required"),
1106
+ timeRange: import_zod10.z.enum(["1h", "24h", "7d"], {
519
1107
  errorMap: () => ({ message: "Time range must be 1h, 24h, or 7d" })
520
1108
  }),
521
- metrics: import_zod6.z.array(
522
- import_zod6.z.enum(["temperature", "humidity", "vwc", "ec", "ph", "pressure", "co2"])
1109
+ metrics: import_zod10.z.array(
1110
+ import_zod10.z.enum(["temperature", "humidity", "vwc", "ec", "ph", "pressure", "co2"])
523
1111
  ).min(1, "At least one metric is required").max(4, "Maximum 4 metrics per graph")
524
1112
  });
525
- var stockChartParameters = import_zod6.z.object({
526
- ticker: import_zod6.z.string().min(1).describe("The stock ticker symbol explicitly requested by the user. YOU MUST EXTRACT AND PROVIDE THIS (e.g., 'AAPL', 'MSFT')."),
527
- timeRange: import_zod6.z.enum(["1D", "1W", "1M", "1Y"], {
1113
+ var stockChartParameters = import_zod10.z.object({
1114
+ ticker: import_zod10.z.string().min(1).describe("The stock ticker symbol explicitly requested by the user. YOU MUST EXTRACT AND PROVIDE THIS (e.g., 'AAPL', 'MSFT')."),
1115
+ timeRange: import_zod10.z.enum(["1D", "1W", "1M", "1Y"], {
528
1116
  errorMap: () => ({ message: "Time range must be 1D, 1W, 1M, or 1Y" })
529
1117
  }).describe("The time range for the chart. Choose based on user request or default to '1M'."),
530
- metrics: import_zod6.z.array(import_zod6.z.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.")
1118
+ metrics: import_zod10.z.array(import_zod10.z.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.")
531
1119
  });
532
- var tickerParam = import_zod6.z.string().min(1).describe("The stock ticker symbol (e.g., 'AAPL', 'TSLA', 'MSFT').");
533
- var liveQuoteParameters = import_zod6.z.object({ ticker: tickerParam });
534
- var companyNewsParameters = import_zod6.z.object({ ticker: tickerParam });
535
- var companyProfileParameters = import_zod6.z.object({ ticker: tickerParam });
536
- var counterpartyGraphParameters = import_zod6.z.object({
1120
+ var tickerParam = import_zod10.z.string().min(1).describe("The stock ticker symbol (e.g., 'AAPL', 'TSLA', 'MSFT').");
1121
+ var liveQuoteParameters = import_zod10.z.object({ ticker: tickerParam });
1122
+ var companyNewsParameters = import_zod10.z.object({ ticker: tickerParam });
1123
+ var companyProfileParameters = import_zod10.z.object({ ticker: tickerParam });
1124
+ var counterpartyGraphParameters = import_zod10.z.object({
537
1125
  ticker: tickerParam,
538
- hops: import_zod6.z.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.")
1126
+ hops: import_zod10.z.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.")
539
1127
  });
540
- var divergenceMetricsParameters = import_zod6.z.object({ ticker: tickerParam });
541
- var architectureReferenceParameters = import_zod6.z.object({});
1128
+ var divergenceMetricsParameters = import_zod10.z.object({ ticker: tickerParam });
1129
+ var architectureReferenceParameters = import_zod10.z.object({});
542
1130
  var AI_TOOLS = {
543
1131
  get_telemetry_graph: {
544
1132
  name: "get_telemetry_graph",
@@ -586,6 +1174,16 @@ var AI_TOOLS = {
586
1174
  var DEFAULT_SCHEMA_MODEL = "gemini-2.5-flash";
587
1175
  var DEFAULT_CHAT_MODEL = "gemini-2.5-flash";
588
1176
  var DEFAULT_PRO_MODEL = "gemini-2.5-pro";
1177
+ var PROVIDER_DEFAULT_MODEL = {
1178
+ "google-gemini": "gemini-2.5-flash",
1179
+ "openai": "gpt-4o-mini",
1180
+ "anthropic": "claude-haiku-4-5-20251001",
1181
+ "grok": "grok-2-1212",
1182
+ "deepseek": "deepseek-chat",
1183
+ "ollama": "llama3.3"
1184
+ };
1185
+ var ASSISTANT_PROVIDER = "anthropic";
1186
+ var ASSISTANT_MODEL = PROVIDER_DEFAULT_MODEL[ASSISTANT_PROVIDER];
589
1187
  var AI_ROSTER = {
590
1188
  /** The Strategist: high creativity, exploratory conversation */
591
1189
  STRATEGIST: {
@@ -763,13 +1361,150 @@ RULE: If you cannot express a UI intent with a semantic token from the \u2705 li
763
1361
  use bg-card or bg-background as a safe fallback. NEVER invent raw colors.
764
1362
  `;
765
1363
 
1364
+ // src/ai/prompts/appDocument.prompt.ts
1365
+ var APP_DOCUMENT_SYSTEM_PROMPT = `
1366
+ You write tiny apps for a small desk device whose screen is 320 pixels wide and
1367
+ 240 pixels high \u2014 landscape.
1368
+
1369
+ Reply with ONE JSON object and nothing else. No markdown fences, no explanation.
1370
+
1371
+ THE SHAPE
1372
+
1373
+ {
1374
+ "schemaVersion": 1,
1375
+ "id": "lowercase-slug",
1376
+ "name": "Short Name",
1377
+ "screen": "320x240",
1378
+ "background": "background",
1379
+ "sources": { },
1380
+ "blocks": [ ]
1381
+ }
1382
+
1383
+ BLOCKS \u2014 up to 12, drawn top to bottom. Each is one of:
1384
+
1385
+ { "type": "text", "value": V, "size": S, "align": A, "color": C, "suffix": "\xB0" }
1386
+ { "type": "dial", "value": V, "min": 0, "max": 100, "label": "CPU", "color": C }
1387
+ { "type": "bar", "value": V, "min": 0, "max": 100, "color": C }
1388
+ { "type": "sparkline", "series": V, "color": C }
1389
+ { "type": "status", "state": V, "label": "Door", "color": C }
1390
+ { "type": "sprite", "palette": [C, ...], "grid": "0011
1391
+ 0110
1392
+ 1100
1393
+ 0011", "align": A }
1394
+ { "type": "group", "direction": "row"|"stack", "gap": 8, "align": A, "children": [ ...leaves... ] }
1395
+
1396
+ DRAWING A SPRITE \u2014 you may, and here is the only form that works.
1397
+
1398
+ Write a "grid": one line per row, one hex character per pixel, each character
1399
+ indexing "palette" (so "0" is the first colour, "1" the second, up to "f").
1400
+ Every row must be exactly the same length. Up to 64x64, but 16x16 and 32x32
1401
+ look far better \u2014 small palettes and bold shapes read on a 320x240 panel, fine
1402
+ detail does not.
1403
+
1404
+ { "type": "sprite",
1405
+ "palette": ["background", "255 214 10", "17 17 17"],
1406
+ "grid": "0011110
1407
+ 0122210
1408
+ 1222221
1409
+ 1211121
1410
+ 1222221
1411
+ 0122210
1412
+ 0011110" }
1413
+
1414
+ Put the background colour FIRST so "0" means empty, and use "." as a synonym
1415
+ for "0" if it makes the shape easier to see while you write it.
1416
+
1417
+ Palette entries are the same colours as everywhere else: a semantic token
1418
+ re-colours with the theme, which is what an icon wants, and literal "R G B"
1419
+ does not, which is what a picture wants.
1420
+
1421
+ NEVER write a "pixels" field yourself. That is base64 of packed nibbles, one
1422
+ wrong character shifts every pixel after it, and you cannot check it. Write the
1423
+ grid; it is converted for you. If a document you are editing already has
1424
+ "pixels" and no "grid", leave it exactly as it is.
1425
+
1426
+ PHOTOS \u2014 a document you are editing may hold { "type": "image", "asset": "<64 hex
1427
+ characters>", ... }. That is a picture someone uploaded, named by the hash of
1428
+ its file. Keep every image block exactly as it is unless asked to remove it, and
1429
+ never write one yourself: you cannot make the file it names, so any hash you
1430
+ invent draws nothing.
1431
+
1432
+ Count your rows before you answer. A grid whose rows are different lengths is
1433
+ the one mistake that will come back to you.
1434
+
1435
+ A group holds leaves only. Groups do NOT nest inside groups \u2014 the device has no
1436
+ layout engine, only computed offsets.
1437
+
1438
+ CONDITIONS \u2014 any block may also carry these:
1439
+
1440
+ "hideWhen": { "value": O, "op": "<", "than": 32 }
1441
+ leave it off the screen entirely while that is true
1442
+
1443
+ "rules": [ { "when": { "value": O, "op": "<", "than": 32 }, "color": "accent" },
1444
+ { "when": { "value": O, "op": ">", "than": 85 }, "color": "danger" } ]
1445
+ style that applies only when something is true. First match wins, so write
1446
+ the narrowest band first. At most four. Each may set "color", "size" or both.
1447
+
1448
+ op is one of "<" "<=" ">" ">=" "==" "!="
1449
+ Only == and != work on words; the rest are for numbers.
1450
+
1451
+ O is an operand: { "literal": 32 } or { "source": "forecast", "field": "temperature" }
1452
+
1453
+ This is how "make it red when it is freezing" is expressed. Use it whenever a
1454
+ request contains "when", "if", "unless", "only", or a colour tied to a value.
1455
+
1456
+ S (size) "xs" | "sm" | "base" | "lg" | "xl" | "display"
1457
+ A (align) "start" | "center" | "end"
1458
+ C (color) "background" | "foreground" | "muted" | "accent" | "success" | "warning" | "danger"
1459
+ or three space-separated RGB numbers, e.g. "220 53 69"
1460
+
1461
+ VALUES \u2014 every V is one of:
1462
+
1463
+ { "literal": "Hello" } text you wrote
1464
+ { "source": "forecast", "field": "temperature" } read from a source
1465
+ { "compute": "subtract", "of": [O, O], "round": true } arithmetic
1466
+
1467
+ compute is "add" | "subtract" | "multiply" | "divide", exactly two operands,
1468
+ and it does NOT nest \u2014 an operand is a literal or a source field, never
1469
+ another compute. "The difference between the high and the low" is the shape
1470
+ this is for.
1471
+
1472
+ SOURCES \u2014 declare what the app reads, then bind to it by name:
1473
+
1474
+ "forecast": { "kind": "weather", "latitude": 39.95, "longitude": -75.17,
1475
+ "units": "imperial", "refreshSeconds": 600 }
1476
+ fields: temperature, condition, high, low
1477
+ "now": { "kind": "clock", "timezone": "America/New_York", "twentyFourHour": false }
1478
+ fields: time, date, weekday, hour (hour is 0-23, for rules about time of day)
1479
+ "until": { "kind": "countdown", "target": "2026-12-25", "label": "Christmas" }
1480
+ fields: days, hours, minutes, seconds, label
1481
+ "fixed": { "kind": "static", "values": { "anything": 1 } }
1482
+ fields: whatever you put in values
1483
+
1484
+ RULES
1485
+
1486
+ 1. 320x240 is small, and it is wider than it is tall. A "display" size text is
1487
+ about 56 pixels tall \u2014 one of those and two or three smaller lines fill the
1488
+ height. Use the width: a "row" group puts two or three things side by side.
1489
+ Prefer fewer, bigger things over a dense dashboard.
1490
+ 2. Use semantic colours unless asked for a specific one. They follow the theme.
1491
+ 3. There is no scrolling and no text wrapping. Long strings are cut off.
1492
+ 4. No tables, no forms, no images, no buttons. The screen shows; it does not
1493
+ take input.
1494
+ 5. If the request needs something the vocabulary cannot express, build the
1495
+ closest thing it can and do not invent a component.
1496
+ 6. Prefer a rule over a fixed colour whenever the request ties appearance to a
1497
+ value. "Red when cold" is a rule; "red" is not.
1498
+ `.trim();
1499
+ var APP_DOCUMENT_EDIT_PREFIX = "Here is the current app. Change only what is asked:";
1500
+
766
1501
  // src/theme/schema.ts
767
- var import_zod7 = require("zod");
768
- var RGBString = import_zod7.z.string().regex(
1502
+ var import_zod11 = require("zod");
1503
+ var RGBString = import_zod11.z.string().regex(
769
1504
  /^\d{1,3}\s+\d{1,3}\s+\d{1,3}$/,
770
1505
  'Must be space-separated RGB integers (e.g. "13 110 253")'
771
1506
  );
772
- var ThemeOverridesSchema = import_zod7.z.object({
1507
+ var ThemeOverridesSchema = import_zod11.z.object({
773
1508
  // ── Core Brand ───────────────────────────────────────────────────────────
774
1509
  "--app-primary-color": RGBString.optional(),
775
1510
  "--app-primary-foreground-color": RGBString.optional(),
@@ -785,9 +1520,9 @@ var ThemeOverridesSchema = import_zod7.z.object({
785
1520
  "--app-muted-bg": RGBString.optional(),
786
1521
  "--app-muted-text": RGBString.optional(),
787
1522
  // ── Shape ────────────────────────────────────────────────────────────────
788
- "--app-border-radius-sm": import_zod7.z.string().optional(),
789
- "--app-border-radius-md": import_zod7.z.string().optional(),
790
- "--app-border-radius-lg": import_zod7.z.string().optional(),
1523
+ "--app-border-radius-sm": import_zod11.z.string().optional(),
1524
+ "--app-border-radius-md": import_zod11.z.string().optional(),
1525
+ "--app-border-radius-lg": import_zod11.z.string().optional(),
791
1526
  // ── Form Controls ────────────────────────────────────────────────────────
792
1527
  "--app-input-bg-color": RGBString.optional(),
793
1528
  "--app-input-text-color": RGBString.optional(),
@@ -801,19 +1536,19 @@ var ThemeOverridesSchema = import_zod7.z.object({
801
1536
  "--app-chart-4": RGBString.optional(),
802
1537
  "--app-chart-5": RGBString.optional()
803
1538
  }).strict();
804
- var ThemeFontsSchema = import_zod7.z.object({
1539
+ var ThemeFontsSchema = import_zod11.z.object({
805
1540
  /** Google Font name for headings (h1–h4, .font-serif). Example: "Playfair Display" */
806
- heading: import_zod7.z.string(),
1541
+ heading: import_zod11.z.string(),
807
1542
  /** Google Font name for body text. Example: "Inter" */
808
- body: import_zod7.z.string(),
1543
+ body: import_zod11.z.string(),
809
1544
  /** Optional monospace font. Example: "Roboto Mono" */
810
- mono: import_zod7.z.string().optional()
1545
+ mono: import_zod11.z.string().optional()
811
1546
  });
812
- var AIThemeSchema = import_zod7.z.object({
1547
+ var AIThemeSchema = import_zod11.z.object({
813
1548
  /** Short descriptive theme name. Example: "Midnight Garden" */
814
- name: import_zod7.z.string(),
1549
+ name: import_zod11.z.string(),
815
1550
  /** One-sentence vibe description. Example: "Dark indigo with golden accents." */
816
- description: import_zod7.z.string(),
1551
+ description: import_zod11.z.string(),
817
1552
  /** Google Font pairing for heading and body text. */
818
1553
  fonts: ThemeFontsSchema.optional(),
819
1554
  /**
@@ -824,13 +1559,13 @@ var AIThemeSchema = import_zod7.z.object({
824
1559
  cssVars: ThemeOverridesSchema
825
1560
  });
826
1561
  var THEME_PRESETS = ["light", "dark", "system", "corporate", "midnight", "blueprint"];
827
- var ThemeTokensSchema = import_zod7.z.object({
1562
+ var ThemeTokensSchema = import_zod11.z.object({
828
1563
  primary: RGBString,
829
1564
  neutral: RGBString,
830
1565
  success: RGBString,
831
1566
  warning: RGBString,
832
1567
  destructive: RGBString,
833
- radius: import_zod7.z.enum(["none", "sm", "md", "lg", "full"])
1568
+ radius: import_zod11.z.enum(["none", "sm", "md", "lg", "full"])
834
1569
  });
835
1570
  var DEFAULT_THEME_TOKENS = {
836
1571
  primary: "13 110 253",
@@ -842,22 +1577,101 @@ var DEFAULT_THEME_TOKENS = {
842
1577
  };
843
1578
 
844
1579
  // src/auth/schema.ts
845
- var import_zod8 = require("zod");
846
- var UserSchema = import_zod8.z.object({
847
- id: import_zod8.z.string().default(""),
848
- name: import_zod8.z.string(),
849
- email: import_zod8.z.string().email(),
850
- password: import_zod8.z.string().optional(),
851
- role: import_zod8.z.string(),
852
- status: import_zod8.z.string().optional(),
853
- joinedAt: import_zod8.z.string().optional(),
854
- lastActive: import_zod8.z.string().optional(),
855
- avatarUrl: import_zod8.z.string().optional()
1580
+ var import_zod12 = require("zod");
1581
+ var UserSchema = import_zod12.z.object({
1582
+ id: import_zod12.z.string().default(""),
1583
+ name: import_zod12.z.string(),
1584
+ email: import_zod12.z.string().email(),
1585
+ password: import_zod12.z.string().optional(),
1586
+ role: import_zod12.z.string(),
1587
+ status: import_zod12.z.string().optional(),
1588
+ joinedAt: import_zod12.z.string().optional(),
1589
+ lastActive: import_zod12.z.string().optional(),
1590
+ avatarUrl: import_zod12.z.string().optional()
856
1591
  });
857
1592
 
1593
+ // src/auth/accounts.ts
1594
+ var import_zod13 = require("zod");
1595
+ var AccountIdSchema = import_zod13.z.string().regex(/^acct_[0-9a-f]{12}$/, "acct_ and 12 hex digits");
1596
+ var AccountRoleSchema = import_zod13.z.enum(["member", "admin"]);
1597
+ var AccountStatusSchema = import_zod13.z.enum(["active", "suspended"]);
1598
+ var ScryptHashSchema = import_zod13.z.object({
1599
+ algo: import_zod13.z.literal("scrypt"),
1600
+ n: import_zod13.z.number().int().positive(),
1601
+ r: import_zod13.z.number().int().positive(),
1602
+ p: import_zod13.z.number().int().positive(),
1603
+ keylen: import_zod13.z.number().int().positive(),
1604
+ salt: import_zod13.z.string().min(16),
1605
+ hash: import_zod13.z.string().min(16)
1606
+ });
1607
+ var AccountRecordSchema = import_zod13.z.object({
1608
+ accountId: AccountIdSchema,
1609
+ /** Lowercased on write, because a login must not depend on how it was typed. */
1610
+ email: import_zod13.z.string().email().max(254),
1611
+ name: import_zod13.z.string().min(1).max(64),
1612
+ role: AccountRoleSchema,
1613
+ status: AccountStatusSchema,
1614
+ password: ScryptHashSchema,
1615
+ createdAt: import_zod13.z.number().int().nonnegative(),
1616
+ lastLoginAt: import_zod13.z.number().int().nonnegative().nullable().default(null),
1617
+ /** Which admin approved this, or null for the bootstrap account. */
1618
+ invitedBy: AccountIdSchema.nullable().default(null)
1619
+ });
1620
+ var PublicAccountSchema = import_zod13.z.object({
1621
+ accountId: AccountIdSchema,
1622
+ email: import_zod13.z.string().email(),
1623
+ name: import_zod13.z.string(),
1624
+ role: AccountRoleSchema,
1625
+ status: AccountStatusSchema
1626
+ });
1627
+ var SessionRecordSchema = import_zod13.z.object({
1628
+ accountId: AccountIdSchema,
1629
+ createdAt: import_zod13.z.number().int().nonnegative(),
1630
+ expiresAt: import_zod13.z.number().int().nonnegative(),
1631
+ lastSeenAt: import_zod13.z.number().int().nonnegative()
1632
+ });
1633
+ var InviteRecordSchema = import_zod13.z.object({
1634
+ email: import_zod13.z.string().email().max(254),
1635
+ role: AccountRoleSchema,
1636
+ createdAt: import_zod13.z.number().int().nonnegative(),
1637
+ expiresAt: import_zod13.z.number().int().nonnegative(),
1638
+ invitedBy: AccountIdSchema
1639
+ });
1640
+ var AccessRequestSchema = import_zod13.z.object({
1641
+ email: import_zod13.z.string().email().max(254),
1642
+ name: import_zod13.z.string().min(1).max(64),
1643
+ /** Optional, and never shown publicly. Long enough to be useful, short enough not to be an essay. */
1644
+ reason: import_zod13.z.string().max(500).optional()
1645
+ });
1646
+ var AccessRequestStatusSchema = import_zod13.z.enum(["pending", "approved", "denied"]);
1647
+ var AccessRequestRecordSchema = import_zod13.z.object({
1648
+ requestId: import_zod13.z.string().regex(/^req_[0-9a-f]{12}$/, "req_ and 12 hex digits"),
1649
+ email: import_zod13.z.string().email().max(254),
1650
+ name: import_zod13.z.string().min(1).max(64),
1651
+ reason: import_zod13.z.string().max(500).optional(),
1652
+ status: AccessRequestStatusSchema,
1653
+ createdAt: import_zod13.z.number().int().nonnegative(),
1654
+ decidedAt: import_zod13.z.number().int().nonnegative().nullable().default(null),
1655
+ decidedBy: AccountIdSchema.nullable().default(null)
1656
+ });
1657
+ var SCRYPT_PARAMS = {
1658
+ n: 32768,
1659
+ r: 8,
1660
+ p: 1,
1661
+ keylen: 64,
1662
+ maxmem: 64 * 1024 * 1024
1663
+ };
1664
+ var MIN_PASSWORD_LENGTH = 12;
1665
+ var MAX_PASSWORD_LENGTH = 200;
1666
+ var SESSION_COOKIE_NAME = "ramme_session";
1667
+ var SESSION_TTL_SECONDS = 60 * 60 * 24 * 30;
1668
+ var ACCOUNT_TTL_SECONDS = 60 * 60 * 24 * 400;
1669
+ var INVITE_TTL_SECONDS = 60 * 60 * 24 * 14;
1670
+ var ACCESS_REQUEST_TTL_SECONDS = 60 * 60 * 24 * 90;
1671
+
858
1672
  // src/counterparty/schema.ts
859
- var import_zod9 = require("zod");
860
- var CounterpartyTypeSchema = import_zod9.z.enum([
1673
+ var import_zod14 = require("zod");
1674
+ var CounterpartyTypeSchema = import_zod14.z.enum([
861
1675
  "supplier",
862
1676
  "customer",
863
1677
  "partner",
@@ -865,28 +1679,28 @@ var CounterpartyTypeSchema = import_zod9.z.enum([
865
1679
  "regulator",
866
1680
  "unknown"
867
1681
  ]);
868
- var CounterpartyResolutionSchema = import_zod9.z.enum([
1682
+ var CounterpartyResolutionSchema = import_zod14.z.enum([
869
1683
  "public",
870
1684
  "public_uncovered",
871
1685
  "private",
872
1686
  "unresolved"
873
1687
  ]);
874
- var CounterpartyNodeSchema = import_zod9.z.object({
875
- id: import_zod9.z.string(),
876
- ticker: import_zod9.z.string().nullable(),
1688
+ var CounterpartyNodeSchema = import_zod14.z.object({
1689
+ id: import_zod14.z.string(),
1690
+ ticker: import_zod14.z.string().nullable(),
877
1691
  /** Name as it appeared in the source signal — e.g. "Nike". Not the registered name. */
878
- name: import_zod9.z.string(),
1692
+ name: import_zod14.z.string(),
879
1693
  /** Registered legal name from `profiles` — e.g. "NIKE, Inc.". Null unless `public`. */
880
- publicName: import_zod9.z.string().nullable(),
881
- lei: import_zod9.z.string().nullable(),
1694
+ publicName: import_zod14.z.string().nullable(),
1695
+ lei: import_zod14.z.string().nullable(),
882
1696
  resolution: CounterpartyResolutionSchema,
883
1697
  type: CounterpartyTypeSchema,
884
- confidence: import_zod9.z.number().min(0).max(1),
885
- sourceSignalIds: import_zod9.z.array(import_zod9.z.number()),
886
- firstSeenAt: import_zod9.z.string().datetime(),
887
- lastSeenAt: import_zod9.z.string().datetime()
1698
+ confidence: import_zod14.z.number().min(0).max(1),
1699
+ sourceSignalIds: import_zod14.z.array(import_zod14.z.number()),
1700
+ firstSeenAt: import_zod14.z.string().datetime(),
1701
+ lastSeenAt: import_zod14.z.string().datetime()
888
1702
  });
889
- var RelationshipEdgeTypeSchema = import_zod9.z.enum([
1703
+ var RelationshipEdgeTypeSchema = import_zod14.z.enum([
890
1704
  "supplies_to",
891
1705
  "purchases_from",
892
1706
  "partners_with",
@@ -904,127 +1718,127 @@ var RelationshipEdgeTypeSchema = import_zod9.z.enum([
904
1718
  */
905
1719
  "same_as"
906
1720
  ]);
907
- var RelationshipEdgeSchema = import_zod9.z.object({
908
- id: import_zod9.z.string(),
909
- sourceId: import_zod9.z.string(),
910
- targetId: import_zod9.z.string(),
1721
+ var RelationshipEdgeSchema = import_zod14.z.object({
1722
+ id: import_zod14.z.string(),
1723
+ sourceId: import_zod14.z.string(),
1724
+ targetId: import_zod14.z.string(),
911
1725
  edgeType: RelationshipEdgeTypeSchema,
912
- weight: import_zod9.z.number().min(0).max(1),
913
- evidenceSignalIds: import_zod9.z.array(import_zod9.z.number()),
914
- updatedAt: import_zod9.z.string().datetime(),
915
- validFrom: import_zod9.z.string().datetime(),
1726
+ weight: import_zod14.z.number().min(0).max(1),
1727
+ evidenceSignalIds: import_zod14.z.array(import_zod14.z.number()),
1728
+ updatedAt: import_zod14.z.string().datetime(),
1729
+ validFrom: import_zod14.z.string().datetime(),
916
1730
  /** null = currently valid. Set when a differently-typed edge supersedes this one. */
917
- validTo: import_zod9.z.string().datetime().nullable()
1731
+ validTo: import_zod14.z.string().datetime().nullable()
918
1732
  });
919
- var SignalWeightSchema = import_zod9.z.object({
920
- signalId: import_zod9.z.number(),
921
- weight: import_zod9.z.number().min(0).max(1),
922
- reason: import_zod9.z.string().max(280)
1733
+ var SignalWeightSchema = import_zod14.z.object({
1734
+ signalId: import_zod14.z.number(),
1735
+ weight: import_zod14.z.number().min(0).max(1),
1736
+ reason: import_zod14.z.string().max(280)
923
1737
  });
924
- var DivergenceMetricSchema = import_zod9.z.object({
925
- ticker: import_zod9.z.string(),
1738
+ var DivergenceMetricSchema = import_zod14.z.object({
1739
+ ticker: import_zod14.z.string(),
926
1740
  // 'operations'/'customer' are current; 'operational'/'ux' are pre-rename
927
1741
  // values that still exist on rows written before the backend's rename —
928
1742
  // kept here so reading old rows doesn't fail validation.
929
- metric: import_zod9.z.enum(["operations", "customer", "operational", "ux"]),
930
- score: import_zod9.z.number(),
931
- baseline: import_zod9.z.number(),
932
- observed: import_zod9.z.number(),
933
- computedAt: import_zod9.z.string().datetime(),
934
- contributingSignals: import_zod9.z.array(SignalWeightSchema)
1743
+ metric: import_zod14.z.enum(["operations", "customer", "operational", "ux"]),
1744
+ score: import_zod14.z.number(),
1745
+ baseline: import_zod14.z.number(),
1746
+ observed: import_zod14.z.number(),
1747
+ computedAt: import_zod14.z.string().datetime(),
1748
+ contributingSignals: import_zod14.z.array(SignalWeightSchema)
935
1749
  });
936
1750
 
937
1751
  // src/non-public-entity/schema.ts
938
- var import_zod10 = require("zod");
939
- var NonPublicEntitySchema = import_zod10.z.object({
940
- lei: import_zod10.z.string().nullable(),
941
- entityName: import_zod10.z.string(),
942
- jurisdiction: import_zod10.z.string().nullable(),
943
- registrationStatus: import_zod10.z.string(),
944
- parentEntityLei: import_zod10.z.string().nullable(),
945
- materialMetadata: import_zod10.z.record(import_zod10.z.unknown()),
946
- discoveredAt: import_zod10.z.string().datetime()
1752
+ var import_zod15 = require("zod");
1753
+ var NonPublicEntitySchema = import_zod15.z.object({
1754
+ lei: import_zod15.z.string().nullable(),
1755
+ entityName: import_zod15.z.string(),
1756
+ jurisdiction: import_zod15.z.string().nullable(),
1757
+ registrationStatus: import_zod15.z.string(),
1758
+ parentEntityLei: import_zod15.z.string().nullable(),
1759
+ materialMetadata: import_zod15.z.record(import_zod15.z.unknown()),
1760
+ discoveredAt: import_zod15.z.string().datetime()
947
1761
  });
948
1762
 
949
1763
  // src/events/schema.ts
950
- var import_zod11 = require("zod");
951
- var EventSourceSchema = import_zod11.z.enum(["db", "mock"]);
952
- var EntityEventKindSchema = import_zod11.z.enum(["news", "filing", "report"]);
953
- var ImpactScaleSchema = import_zod11.z.enum(["graded", "binary", "default", "none"]);
954
- var TimestampPrecisionSchema = import_zod11.z.enum(["second", "day"]);
955
- var EntityEventSchema = import_zod11.z.object({
1764
+ var import_zod16 = require("zod");
1765
+ var EventSourceSchema = import_zod16.z.enum(["db", "mock"]);
1766
+ var EntityEventKindSchema = import_zod16.z.enum(["news", "filing", "report"]);
1767
+ var ImpactScaleSchema = import_zod16.z.enum(["graded", "binary", "default", "none"]);
1768
+ var TimestampPrecisionSchema = import_zod16.z.enum(["second", "day"]);
1769
+ var EntityEventSchema = import_zod16.z.object({
956
1770
  /** Namespaced so ids never collide across sources: `news:1234`, `filing:AAPL:2026-07-31`. */
957
- id: import_zod11.z.string(),
1771
+ id: import_zod16.z.string(),
958
1772
  kind: EntityEventKindSchema,
959
1773
  /**
960
1774
  * The producer's own type string, unmodified — `NEWS_YAHOO FINANCE_YAHOO RSS`,
961
1775
  * `ANNUAL`, `SNAPSHOT`. There are 31 distinct NEWS variants in the live table,
962
1776
  * so this is for filtering and debugging: never render it raw to a user.
963
1777
  */
964
- subtype: import_zod11.z.string().nullable(),
965
- ticker: import_zod11.z.string(),
1778
+ subtype: import_zod16.z.string().nullable(),
1779
+ ticker: import_zod16.z.string(),
966
1780
  /** Always `YYYY-MM-DDTHH:MM:SSZ`. Fixed-width, so lexical order == chronological order. */
967
- occurredAt: import_zod11.z.string(),
1781
+ occurredAt: import_zod16.z.string(),
968
1782
  precision: TimestampPrecisionSchema,
969
- title: import_zod11.z.string(),
970
- summary: import_zod11.z.string().nullable(),
971
- url: import_zod11.z.string().nullable(),
972
- impact: import_zod11.z.number().nullable(),
1783
+ title: import_zod16.z.string(),
1784
+ summary: import_zod16.z.string().nullable(),
1785
+ url: import_zod16.z.string().nullable(),
1786
+ impact: import_zod16.z.number().nullable(),
973
1787
  impactScale: ImpactScaleSchema,
974
1788
  /** 0 bearish … 50 neutral … 100 bullish. */
975
- sentiment: import_zod11.z.number().nullable(),
1789
+ sentiment: import_zod16.z.number().nullable(),
976
1790
  /** False for filings, and for any event sitting at exactly neutral. */
977
- sentimentIsMeaningful: import_zod11.z.boolean(),
1791
+ sentimentIsMeaningful: import_zod16.z.boolean(),
978
1792
  source: EventSourceSchema,
979
- meta: import_zod11.z.record(import_zod11.z.unknown()).nullable()
1793
+ meta: import_zod16.z.record(import_zod16.z.unknown()).nullable()
980
1794
  });
981
- var PaginatedEntityEventsSchema = import_zod11.z.object({
982
- total: import_zod11.z.number(),
983
- page: import_zod11.z.number(),
984
- page_size: import_zod11.z.number(),
985
- data: import_zod11.z.array(EntityEventSchema)
1795
+ var PaginatedEntityEventsSchema = import_zod16.z.object({
1796
+ total: import_zod16.z.number(),
1797
+ page: import_zod16.z.number(),
1798
+ page_size: import_zod16.z.number(),
1799
+ data: import_zod16.z.array(EntityEventSchema)
986
1800
  });
987
- var EventBucketSizeSchema = import_zod11.z.enum(["day", "week", "month"]);
988
- var EntityEventDensityBucketSchema = import_zod11.z.object({
989
- bucketStart: import_zod11.z.string(),
1801
+ var EventBucketSizeSchema = import_zod16.z.enum(["day", "week", "month"]);
1802
+ var EntityEventDensityBucketSchema = import_zod16.z.object({
1803
+ bucketStart: import_zod16.z.string(),
990
1804
  kind: EntityEventKindSchema,
991
- count: import_zod11.z.number(),
1805
+ count: import_zod16.z.number(),
992
1806
  /** Null when no event in the bucket had meaningful sentiment. */
993
- avgSentiment: import_zod11.z.number().nullable(),
994
- maxImpact: import_zod11.z.number().nullable()
1807
+ avgSentiment: import_zod16.z.number().nullable(),
1808
+ maxImpact: import_zod16.z.number().nullable()
995
1809
  });
996
- var EntityEventDensitySchema = import_zod11.z.object({
997
- ticker: import_zod11.z.string(),
1810
+ var EntityEventDensitySchema = import_zod16.z.object({
1811
+ ticker: import_zod16.z.string(),
998
1812
  bucket: EventBucketSizeSchema,
999
- buckets: import_zod11.z.array(EntityEventDensityBucketSchema),
1813
+ buckets: import_zod16.z.array(EntityEventDensityBucketSchema),
1000
1814
  /** So the client can set its time domain without a second request. */
1001
- range: import_zod11.z.object({ min: import_zod11.z.string(), max: import_zod11.z.string() }),
1815
+ range: import_zod16.z.object({ min: import_zod16.z.string(), max: import_zod16.z.string() }),
1002
1816
  source: EventSourceSchema
1003
1817
  });
1004
- var EntityEventFacetSchema = import_zod11.z.object({
1818
+ var EntityEventFacetSchema = import_zod16.z.object({
1005
1819
  kind: EntityEventKindSchema,
1006
- count: import_zod11.z.number(),
1007
- earliest: import_zod11.z.string().nullable(),
1008
- latest: import_zod11.z.string().nullable(),
1820
+ count: import_zod16.z.number(),
1821
+ earliest: import_zod16.z.string().nullable(),
1822
+ latest: import_zod16.z.string().nullable(),
1009
1823
  impactScale: ImpactScaleSchema,
1010
- sentimentUsable: import_zod11.z.boolean()
1824
+ sentimentUsable: import_zod16.z.boolean()
1011
1825
  });
1012
- var EntityEventFacetsSchema = import_zod11.z.object({
1013
- ticker: import_zod11.z.string(),
1014
- facets: import_zod11.z.array(EntityEventFacetSchema),
1826
+ var EntityEventFacetsSchema = import_zod16.z.object({
1827
+ ticker: import_zod16.z.string(),
1828
+ facets: import_zod16.z.array(EntityEventFacetSchema),
1015
1829
  source: EventSourceSchema
1016
1830
  });
1017
- var DailyPricePointSchema = import_zod11.z.object({
1018
- date: import_zod11.z.string(),
1019
- open: import_zod11.z.number().nullable(),
1020
- high: import_zod11.z.number().nullable(),
1021
- low: import_zod11.z.number().nullable(),
1022
- close: import_zod11.z.number(),
1023
- volume: import_zod11.z.number().nullable()
1024
- });
1025
- var EntityPriceSeriesSchema = import_zod11.z.object({
1026
- ticker: import_zod11.z.string(),
1027
- series: import_zod11.z.array(DailyPricePointSchema),
1831
+ var DailyPricePointSchema = import_zod16.z.object({
1832
+ date: import_zod16.z.string(),
1833
+ open: import_zod16.z.number().nullable(),
1834
+ high: import_zod16.z.number().nullable(),
1835
+ low: import_zod16.z.number().nullable(),
1836
+ close: import_zod16.z.number(),
1837
+ volume: import_zod16.z.number().nullable()
1838
+ });
1839
+ var EntityPriceSeriesSchema = import_zod16.z.object({
1840
+ ticker: import_zod16.z.string(),
1841
+ series: import_zod16.z.array(DailyPricePointSchema),
1028
1842
  source: EventSourceSchema
1029
1843
  });
1030
1844
  var EVENT_KIND_LABELS = {
@@ -1045,17 +1859,55 @@ var EXCLUDED_SOURCES = {
1045
1859
  };
1046
1860
  // Annotate the CommonJS export names for ESM import in node:
1047
1861
  0 && (module.exports = {
1862
+ ACCESS_REQUEST_TTL_SECONDS,
1863
+ ACCOUNT_TTL_SECONDS,
1048
1864
  AIKeyManifestSchema,
1049
1865
  AIThemeSchema,
1050
1866
  AI_ROSTER,
1051
1867
  AI_TOOLS,
1868
+ APP_DOCUMENT_EDIT_PREFIX,
1869
+ APP_DOCUMENT_SYSTEM_PROMPT,
1870
+ ASSISTANT_MODEL,
1871
+ ASSISTANT_PROVIDER,
1872
+ AccessRequestRecordSchema,
1873
+ AccessRequestSchema,
1874
+ AccessRequestStatusSchema,
1875
+ AccountIdSchema,
1876
+ AccountRecordSchema,
1877
+ AccountRoleSchema,
1878
+ AccountStatusSchema,
1052
1879
  ActionSchema,
1053
1880
  AircraftAppConfigSchema,
1881
+ AppAlignSchema,
1882
+ AppBarSchema,
1883
+ AppBindingSchema,
1884
+ AppBlockSchema,
1885
+ AppColorSchema,
1886
+ AppColorTokenSchema,
1887
+ AppComputeSchema,
1888
+ AppConditionSchema,
1889
+ AppDialSchema,
1890
+ AppDocumentSchema,
1891
+ AppGroupSchema,
1892
+ AppImageSchema,
1893
+ AppLeafSchema,
1894
+ AppOperandSchema,
1895
+ AppRgbSchema,
1896
+ AppScreenSizeSchema,
1054
1897
  AppSignalSchema,
1898
+ AppSourceSchema,
1899
+ AppSparklineSchema,
1055
1900
  AppSpecificationSchema,
1901
+ AppSpriteSchema,
1902
+ AppStatusSchema,
1903
+ AppStyleRuleSchema,
1904
+ AppTextSchema,
1905
+ AppTextSizeSchema,
1906
+ AssetHashSchema,
1056
1907
  AuthStrategySchema,
1057
1908
  BlockSchema,
1058
1909
  Bodewell,
1910
+ CLAIMED_DEVICE_TTL_SECONDS,
1059
1911
  ClockAppConfigSchema,
1060
1912
  CounterpartyNodeSchema,
1061
1913
  CounterpartyResolutionSchema,
@@ -1068,14 +1920,30 @@ var EXCLUDED_SOURCES = {
1068
1920
  DEFAULT_THEME_TOKENS,
1069
1921
  DEVICE_AP_SSID_PREFIX,
1070
1922
  DEVICE_ENDPOINTS,
1923
+ DEVICE_FRESH_MS,
1924
+ DEVICE_GLYPHS,
1925
+ DEVICE_LABEL_MAX,
1926
+ DEVICE_PALETTE,
1927
+ DEVICE_STALE_MS,
1928
+ DEVICE_TIMEZONES,
1929
+ DEVICE_TIMEZONE_FALLBACK,
1930
+ DEVICE_TTL_SECONDS,
1931
+ DEVICE_UNKNOWN_GLYPH,
1932
+ DEVICE_VITALS_FIELDS,
1071
1933
  DailyPricePointSchema,
1934
+ DeliveredAppSchema,
1072
1935
  DeviceAppIdSchema,
1073
1936
  DeviceAppsSchema,
1074
1937
  DeviceConfigSchema,
1075
1938
  DeviceDisplayConfigSchema,
1939
+ DeviceIdSchema,
1076
1940
  DeviceKindSchema,
1941
+ DeviceRecordSchema,
1942
+ DeviceRegistrationSchema,
1943
+ DeviceSeenSchema,
1077
1944
  DeviceStatusSchema,
1078
1945
  DeviceThemeSchema,
1946
+ DeviceVitalsSchema,
1079
1947
  DivergenceMetricSchema,
1080
1948
  EVENT_KIND_LABELS,
1081
1949
  EXCLUDED_SOURCES,
@@ -1093,22 +1961,50 @@ var EXCLUDED_SOURCES = {
1093
1961
  FloraTelemetrySchema,
1094
1962
  GENESIS_LIBRARY_CONTEXT,
1095
1963
  GENESIS_VALID_COMPONENTS,
1964
+ IMAGE_MAX_DRAWN,
1965
+ IMAGE_MAX_SCALE,
1096
1966
  IMPACT_FLAG_THRESHOLD,
1967
+ INVITE_TTL_SECONDS,
1097
1968
  ImpactScaleSchema,
1969
+ InviteRecordSchema,
1970
+ MAX_PASSWORD_LENGTH,
1971
+ MIN_PASSWORD_LENGTH,
1098
1972
  NonPublicEntitySchema,
1973
+ ORIGINAL_MAX_BYTES,
1974
+ ORIGINAL_MAX_SIDE,
1975
+ OwnedSendRequestSchema,
1976
+ PHOTOS_PER_ACCOUNT,
1977
+ PHOTO_UPLOADS_PER_HOUR,
1978
+ PROVIDER_DEFAULT_MODEL,
1099
1979
  PageSchema,
1100
1980
  PageSectionSchema,
1101
1981
  PaginatedEntityEventsSchema,
1982
+ PairCodeSchema,
1983
+ PhotoSummarySchema,
1984
+ PhotoUploadSchema,
1102
1985
  ProvisioningStateSchema,
1986
+ PublicAccountSchema,
1987
+ RETRO_RENDITION,
1103
1988
  RelationshipEdgeSchema,
1104
1989
  RelationshipEdgeTypeSchema,
1105
1990
  ResourceSchema,
1991
+ SCRYPT_PARAMS,
1106
1992
  SENTIMENT_NEUTRAL,
1993
+ SESSION_COOKIE_NAME,
1994
+ SESSION_TTL_SECONDS,
1107
1995
  SIGNAL_DOMAINS,
1108
1996
  SIGNAL_KINDS,
1109
1997
  SIGNAL_KIND_LABELS,
1110
1998
  SIGNAL_SOURCES,
1999
+ SPRITE_MAX_BASE64,
2000
+ SPRITE_MAX_ROW_BYTES,
2001
+ SPRITE_MAX_SIDE,
2002
+ SPR_FORMAT,
2003
+ SPR_MAX_BYTES,
2004
+ ScryptHashSchema,
2005
+ SendRequestSchema,
1111
2006
  SensorAppConfigSchema,
2007
+ SessionRecordSchema,
1112
2008
  SignalArraySchema,
1113
2009
  SignalKindSchema,
1114
2010
  SignalPacketSchema,
@@ -1123,6 +2019,7 @@ var EXCLUDED_SOURCES = {
1123
2019
  TimestampPrecisionSchema,
1124
2020
  TriggerSchema,
1125
2021
  UserSchema,
2022
+ VitalSourceSchema,
1126
2023
  WeatherAppConfigSchema,
1127
2024
  WorkflowSchema,
1128
2025
  architectureReferenceParameters,