@ramme-io/shared 3.6.0 → 4.0.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/README.md +0 -2
- package/dist/index.cjs +827 -459
- package/dist/index.d.cts +31599 -1363
- package/dist/index.d.ts +31599 -1363
- package/dist/index.js +773 -426
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -21,6 +21,12 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
21
21
|
var index_exports = {};
|
|
22
22
|
__export(index_exports, {
|
|
23
23
|
ACCESS_REQUEST_TTL_SECONDS: () => ACCESS_REQUEST_TTL_SECONDS,
|
|
24
|
+
ACCESS_TOKEN_LIFETIMES_DAYS: () => ACCESS_TOKEN_LIFETIMES_DAYS,
|
|
25
|
+
ACCESS_TOKEN_MAX_PER_ACCOUNT: () => ACCESS_TOKEN_MAX_PER_ACCOUNT,
|
|
26
|
+
ACCESS_TOKEN_PREFIX: () => ACCESS_TOKEN_PREFIX,
|
|
27
|
+
ACCESS_TOKEN_RATE_PER_MINUTE: () => ACCESS_TOKEN_RATE_PER_MINUTE,
|
|
28
|
+
ACCESS_TOKEN_SCOPES: () => ACCESS_TOKEN_SCOPES,
|
|
29
|
+
ACCESS_TOKEN_SCOPE_LABELS: () => ACCESS_TOKEN_SCOPE_LABELS,
|
|
24
30
|
ACCOUNT_TTL_SECONDS: () => ACCOUNT_TTL_SECONDS,
|
|
25
31
|
AIKeyManifestSchema: () => AIKeyManifestSchema,
|
|
26
32
|
AIThemeSchema: () => AIThemeSchema,
|
|
@@ -33,10 +39,13 @@ __export(index_exports, {
|
|
|
33
39
|
AccessRequestRecordSchema: () => AccessRequestRecordSchema,
|
|
34
40
|
AccessRequestSchema: () => AccessRequestSchema,
|
|
35
41
|
AccessRequestStatusSchema: () => AccessRequestStatusSchema,
|
|
42
|
+
AccessTokenRecordSchema: () => AccessTokenRecordSchema,
|
|
43
|
+
AccessTokenScopeSchema: () => AccessTokenScopeSchema,
|
|
36
44
|
AccountIdSchema: () => AccountIdSchema,
|
|
37
45
|
AccountRecordSchema: () => AccountRecordSchema,
|
|
38
46
|
AccountRoleSchema: () => AccountRoleSchema,
|
|
39
47
|
AccountStatusSchema: () => AccountStatusSchema,
|
|
48
|
+
AccountThemeSchema: () => AccountThemeSchema,
|
|
40
49
|
ActionSchema: () => ActionSchema,
|
|
41
50
|
AircraftAppConfigSchema: () => AircraftAppConfigSchema,
|
|
42
51
|
AppAlignSchema: () => AppAlignSchema,
|
|
@@ -68,106 +77,120 @@ __export(index_exports, {
|
|
|
68
77
|
AssetHashSchema: () => AssetHashSchema,
|
|
69
78
|
AuthStrategySchema: () => AuthStrategySchema,
|
|
70
79
|
BlockSchema: () => BlockSchema,
|
|
80
|
+
BoardFontSchema: () => BoardFontSchema,
|
|
81
|
+
BoardPaletteHexSchema: () => BoardPaletteHexSchema,
|
|
71
82
|
Bodewell: () => schema_exports,
|
|
72
83
|
CLAIMED_DEVICE_TTL_SECONDS: () => CLAIMED_DEVICE_TTL_SECONDS,
|
|
84
|
+
CONTROL_STATES: () => CONTROL_STATES,
|
|
85
|
+
CONTROL_STATE_MEANINGS: () => CONTROL_STATE_MEANINGS,
|
|
86
|
+
CaseFamilySchema: () => CaseFamilySchema,
|
|
73
87
|
ClockAppConfigSchema: () => ClockAppConfigSchema,
|
|
74
|
-
|
|
75
|
-
CounterpartyResolutionSchema: () => CounterpartyResolutionSchema,
|
|
76
|
-
CounterpartyTypeSchema: () => CounterpartyTypeSchema,
|
|
88
|
+
ComponentSchema: () => ComponentSchema,
|
|
77
89
|
DEFAULT_CHAT_MODEL: () => DEFAULT_CHAT_MODEL,
|
|
78
90
|
DEFAULT_DEVICE_CONFIG: () => DEFAULT_DEVICE_CONFIG,
|
|
79
|
-
DEFAULT_HORIZON_QUARTERS: () => DEFAULT_HORIZON_QUARTERS,
|
|
80
91
|
DEFAULT_PRO_MODEL: () => DEFAULT_PRO_MODEL,
|
|
81
92
|
DEFAULT_SCHEMA_MODEL: () => DEFAULT_SCHEMA_MODEL,
|
|
82
93
|
DEFAULT_THEME_TOKENS: () => DEFAULT_THEME_TOKENS,
|
|
83
94
|
DEVICE_AP_SSID_PREFIX: () => DEVICE_AP_SSID_PREFIX,
|
|
84
95
|
DEVICE_ENDPOINTS: () => DEVICE_ENDPOINTS,
|
|
96
|
+
DEVICE_FEATURES: () => DEVICE_FEATURES,
|
|
97
|
+
DEVICE_FEATURE_STATE_LABELS: () => DEVICE_FEATURE_STATE_LABELS,
|
|
85
98
|
DEVICE_FRESH_MS: () => DEVICE_FRESH_MS,
|
|
86
99
|
DEVICE_GLYPHS: () => DEVICE_GLYPHS,
|
|
87
100
|
DEVICE_LABEL_MAX: () => DEVICE_LABEL_MAX,
|
|
88
101
|
DEVICE_PALETTE: () => DEVICE_PALETTE,
|
|
102
|
+
DEVICE_POLL_QUERY: () => DEVICE_POLL_QUERY,
|
|
103
|
+
DEVICE_PROTOCOL: () => DEVICE_PROTOCOL,
|
|
89
104
|
DEVICE_STALE_MS: () => DEVICE_STALE_MS,
|
|
90
105
|
DEVICE_TIMEZONES: () => DEVICE_TIMEZONES,
|
|
91
106
|
DEVICE_TIMEZONE_FALLBACK: () => DEVICE_TIMEZONE_FALLBACK,
|
|
92
107
|
DEVICE_TTL_SECONDS: () => DEVICE_TTL_SECONDS,
|
|
93
108
|
DEVICE_UNKNOWN_GLYPH: () => DEVICE_UNKNOWN_GLYPH,
|
|
94
109
|
DEVICE_VITALS_FIELDS: () => DEVICE_VITALS_FIELDS,
|
|
95
|
-
|
|
110
|
+
DISPLAY_FACE_MIN_PX: () => DISPLAY_FACE_MIN_PX,
|
|
111
|
+
DISPLAY_NAME_MAX: () => DISPLAY_NAME_MAX,
|
|
96
112
|
DeliveredAppSchema: () => DeliveredAppSchema,
|
|
97
113
|
DeviceAppIdSchema: () => DeviceAppIdSchema,
|
|
98
114
|
DeviceAppsSchema: () => DeviceAppsSchema,
|
|
99
115
|
DeviceConfigSchema: () => DeviceConfigSchema,
|
|
100
116
|
DeviceDisplayConfigSchema: () => DeviceDisplayConfigSchema,
|
|
117
|
+
DeviceFeatureKeySchema: () => DeviceFeatureKeySchema,
|
|
118
|
+
DeviceFeatureStateSchema: () => DeviceFeatureStateSchema,
|
|
119
|
+
DeviceFeaturesSchema: () => DeviceFeaturesSchema,
|
|
101
120
|
DeviceIdSchema: () => DeviceIdSchema,
|
|
102
121
|
DeviceKindSchema: () => DeviceKindSchema,
|
|
122
|
+
DevicePollReplySchema: () => DevicePollReplySchema,
|
|
123
|
+
DeviceReadingSchema: () => DeviceReadingSchema,
|
|
103
124
|
DeviceRecordSchema: () => DeviceRecordSchema,
|
|
104
125
|
DeviceRegistrationSchema: () => DeviceRegistrationSchema,
|
|
126
|
+
DeviceReportSchema: () => DeviceReportSchema,
|
|
105
127
|
DeviceSeenSchema: () => DeviceSeenSchema,
|
|
106
128
|
DeviceStatusSchema: () => DeviceStatusSchema,
|
|
107
129
|
DeviceThemeSchema: () => DeviceThemeSchema,
|
|
108
130
|
DeviceVitalsSchema: () => DeviceVitalsSchema,
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
EntityEventDensityBucketSchema: () => EntityEventDensityBucketSchema,
|
|
113
|
-
EntityEventDensitySchema: () => EntityEventDensitySchema,
|
|
114
|
-
EntityEventFacetSchema: () => EntityEventFacetSchema,
|
|
115
|
-
EntityEventFacetsSchema: () => EntityEventFacetsSchema,
|
|
116
|
-
EntityEventKindSchema: () => EntityEventKindSchema,
|
|
117
|
-
EntityEventSchema: () => EntityEventSchema,
|
|
118
|
-
EntityPriceSeriesSchema: () => EntityPriceSeriesSchema,
|
|
131
|
+
DisplayNameSchema: () => DisplayNameSchema,
|
|
132
|
+
EdgeSchema: () => EdgeSchema,
|
|
133
|
+
EmblemSchema: () => EmblemSchema,
|
|
119
134
|
EntitySchema: () => EntitySchema,
|
|
120
|
-
EventBucketSizeSchema: () => EventBucketSizeSchema,
|
|
121
|
-
EventSourceSchema: () => EventSourceSchema,
|
|
122
135
|
FIRMWARE_UPDATE_ATTEMPTS: () => FIRMWARE_UPDATE_ATTEMPTS,
|
|
123
136
|
FIRMWARE_UPDATE_PREFIX: () => FIRMWARE_UPDATE_PREFIX,
|
|
124
137
|
FULL_COLOUR_FRAME_MAX: () => FULL_COLOUR_FRAME_MAX,
|
|
125
138
|
FULL_RENDITION: () => FULL_RENDITION,
|
|
139
|
+
FamilyChoiceSchema: () => FamilyChoiceSchema,
|
|
140
|
+
FamilyOptionSchema: () => FamilyOptionSchema,
|
|
126
141
|
FieldSchema: () => FieldSchema,
|
|
127
142
|
FirmwareUpdateSchema: () => FirmwareUpdateSchema,
|
|
143
|
+
FlexButtonSchema: () => FlexButtonSchema,
|
|
128
144
|
FloraTelemetrySchema: () => FloraTelemetrySchema,
|
|
129
145
|
GENESIS_LIBRARY_CONTEXT: () => GENESIS_LIBRARY_CONTEXT,
|
|
130
146
|
GENESIS_VALID_COMPONENTS: () => GENESIS_VALID_COMPONENTS,
|
|
147
|
+
HardwareManifestSchema: () => HardwareManifestSchema,
|
|
131
148
|
ICON_GRID: () => ICON_GRID,
|
|
132
149
|
ICON_SIZE_PX: () => ICON_SIZE_PX,
|
|
133
150
|
ICON_STROKE: () => ICON_STROKE,
|
|
134
151
|
IMAGE_MAX_DRAWN: () => IMAGE_MAX_DRAWN,
|
|
135
152
|
IMAGE_MAX_SCALE: () => IMAGE_MAX_SCALE,
|
|
136
|
-
IMPACT_FLAG_THRESHOLD: () => IMPACT_FLAG_THRESHOLD,
|
|
137
153
|
INVITE_TTL_SECONDS: () => INVITE_TTL_SECONDS,
|
|
138
|
-
|
|
154
|
+
InterfaceSchema: () => InterfaceSchema,
|
|
139
155
|
InviteRecordSchema: () => InviteRecordSchema,
|
|
140
156
|
MAX_PASSWORD_LENGTH: () => MAX_PASSWORD_LENGTH,
|
|
141
157
|
MIN_PASSWORD_LENGTH: () => MIN_PASSWORD_LENGTH,
|
|
142
|
-
|
|
158
|
+
MountHolesSchema: () => MountHolesSchema,
|
|
159
|
+
NewAccessTokenSchema: () => NewAccessTokenSchema,
|
|
143
160
|
ORIGINAL_MAX_BYTES: () => ORIGINAL_MAX_BYTES,
|
|
144
161
|
ORIGINAL_MAX_SIDE: () => ORIGINAL_MAX_SIDE,
|
|
145
162
|
OwnedSendRequestSchema: () => OwnedSendRequestSchema,
|
|
163
|
+
PANEL_SIZE: () => PANEL_SIZE,
|
|
146
164
|
PHOTOS_PER_ACCOUNT: () => PHOTOS_PER_ACCOUNT,
|
|
147
165
|
PHOTO_UPLOADS_PER_HOUR: () => PHOTO_UPLOADS_PER_HOUR,
|
|
148
166
|
PROVIDER_DEFAULT_MODEL: () => PROVIDER_DEFAULT_MODEL,
|
|
149
167
|
PageSchema: () => PageSchema,
|
|
150
168
|
PageSectionSchema: () => PageSectionSchema,
|
|
151
|
-
PaginatedEntityEventsSchema: () => PaginatedEntityEventsSchema,
|
|
152
169
|
PairCodeSchema: () => PairCodeSchema,
|
|
170
|
+
PanelOrientationSchema: () => PanelOrientationSchema,
|
|
153
171
|
PhotoCropSchema: () => PhotoCropSchema,
|
|
154
172
|
PhotoFullSchema: () => PhotoFullSchema,
|
|
155
173
|
PhotoSummarySchema: () => PhotoSummarySchema,
|
|
156
174
|
PhotoUploadSchema: () => PhotoUploadSchema,
|
|
175
|
+
PlacementSchema: () => PlacementSchema,
|
|
176
|
+
PrinterProfileSchema: () => PrinterProfileSchema,
|
|
157
177
|
ProvisioningStateSchema: () => ProvisioningStateSchema,
|
|
178
|
+
PublicAccessTokenSchema: () => PublicAccessTokenSchema,
|
|
158
179
|
PublicAccountSchema: () => PublicAccountSchema,
|
|
159
180
|
RETRO_RENDITION: () => RETRO_RENDITION,
|
|
160
|
-
RelationshipEdgeSchema: () => RelationshipEdgeSchema,
|
|
161
|
-
RelationshipEdgeTypeSchema: () => RelationshipEdgeTypeSchema,
|
|
162
181
|
ResourceSchema: () => ResourceSchema,
|
|
163
182
|
SCRYPT_PARAMS: () => SCRYPT_PARAMS,
|
|
164
|
-
SENTIMENT_NEUTRAL: () => SENTIMENT_NEUTRAL,
|
|
165
183
|
SESSION_COOKIE_NAME: () => SESSION_COOKIE_NAME,
|
|
166
184
|
SESSION_TTL_SECONDS: () => SESSION_TTL_SECONDS,
|
|
185
|
+
SHELF_MAX_APPS: () => SHELF_MAX_APPS,
|
|
186
|
+
SHELF_MAX_BYTES: () => SHELF_MAX_BYTES,
|
|
187
|
+
SHELF_ROTATE_MINUTES: () => SHELF_ROTATE_MINUTES,
|
|
167
188
|
SIGNAL_DOMAINS: () => SIGNAL_DOMAINS,
|
|
168
189
|
SIGNAL_KINDS: () => SIGNAL_KINDS,
|
|
169
190
|
SIGNAL_KIND_LABELS: () => SIGNAL_KIND_LABELS,
|
|
170
191
|
SIGNAL_SOURCES: () => SIGNAL_SOURCES,
|
|
192
|
+
SMOOTH_FACES: () => SMOOTH_FACES,
|
|
193
|
+
SMOOTH_FONT_ADVANCES: () => SMOOTH_FONT_ADVANCES,
|
|
171
194
|
SPRITE_MAX_BASE64: () => SPRITE_MAX_BASE64,
|
|
172
195
|
SPRITE_MAX_ROW_BYTES: () => SPRITE_MAX_ROW_BYTES,
|
|
173
196
|
SPRITE_MAX_SIDE: () => SPRITE_MAX_SIDE,
|
|
@@ -177,18 +200,23 @@ __export(index_exports, {
|
|
|
177
200
|
SendRequestSchema: () => SendRequestSchema,
|
|
178
201
|
SensorAppConfigSchema: () => SensorAppConfigSchema,
|
|
179
202
|
SessionRecordSchema: () => SessionRecordSchema,
|
|
203
|
+
ShelfEditSchema: () => ShelfEditSchema,
|
|
204
|
+
ShelfSchema: () => ShelfSchema,
|
|
180
205
|
SignalArraySchema: () => SignalArraySchema,
|
|
181
206
|
SignalKindSchema: () => SignalKindSchema,
|
|
182
207
|
SignalPacketSchema: () => SignalPacketSchema,
|
|
183
208
|
SignalSchema: () => SignalSchema,
|
|
184
209
|
SignalSourceSchema: () => SignalSourceSchema,
|
|
185
|
-
|
|
210
|
+
THEME_PALETTE_TOKENS: () => THEME_PALETTE_TOKENS,
|
|
186
211
|
THEME_PRESETS: () => THEME_PRESETS,
|
|
212
|
+
THEME_RADII: () => THEME_RADII,
|
|
187
213
|
THEME_SYSTEM_PROMPT: () => THEME_SYSTEM_PROMPT,
|
|
188
214
|
ThemeFontsSchema: () => ThemeFontsSchema,
|
|
215
|
+
ThemeLetteringSchema: () => ThemeLetteringSchema,
|
|
189
216
|
ThemeOverridesSchema: () => ThemeOverridesSchema,
|
|
217
|
+
ThemePaletteSchema: () => ThemePaletteSchema,
|
|
218
|
+
ThemeRgbSchema: () => ThemeRgbSchema,
|
|
190
219
|
ThemeTokensSchema: () => ThemeTokensSchema,
|
|
191
|
-
TimestampPrecisionSchema: () => TimestampPrecisionSchema,
|
|
192
220
|
TriggerSchema: () => TriggerSchema,
|
|
193
221
|
UserSchema: () => UserSchema,
|
|
194
222
|
VitalSourceSchema: () => VitalSourceSchema,
|
|
@@ -197,13 +225,6 @@ __export(index_exports, {
|
|
|
197
225
|
WEATHER_ICON_NAMES: () => WEATHER_ICON_NAMES,
|
|
198
226
|
WeatherAppConfigSchema: () => WeatherAppConfigSchema,
|
|
199
227
|
WorkflowSchema: () => WorkflowSchema,
|
|
200
|
-
architectureReferenceParameters: () => architectureReferenceParameters,
|
|
201
|
-
companyNewsParameters: () => companyNewsParameters,
|
|
202
|
-
companyProfileParameters: () => companyProfileParameters,
|
|
203
|
-
counterpartyGraphParameters: () => counterpartyGraphParameters,
|
|
204
|
-
divergenceMetricsParameters: () => divergenceMetricsParameters,
|
|
205
|
-
liveQuoteParameters: () => liveQuoteParameters,
|
|
206
|
-
stockChartParameters: () => stockChartParameters,
|
|
207
228
|
telemetryGraphParameters: () => telemetryGraphParameters
|
|
208
229
|
});
|
|
209
230
|
module.exports = __toCommonJS(index_exports);
|
|
@@ -370,8 +391,10 @@ var SIGNAL_DOMAINS = {
|
|
|
370
391
|
// Track C — latency, uptime, queue depth
|
|
371
392
|
USER_BEHAVIOR: "user_behavior",
|
|
372
393
|
// Track D — engagement, conversion, NPS
|
|
373
|
-
LOGIC: "logic"
|
|
394
|
+
LOGIC: "logic",
|
|
374
395
|
// Derived — Methodology Engine outputs
|
|
396
|
+
ENVIRONMENT: "environment"
|
|
397
|
+
// A device's surroundings — temperature, humidity, light
|
|
375
398
|
};
|
|
376
399
|
|
|
377
400
|
// src/signals/base.schema.ts
|
|
@@ -662,7 +685,30 @@ var AppSourceSchema = import_zod6.z.discriminatedUnion("kind", [
|
|
|
662
685
|
import_zod6.z.object({
|
|
663
686
|
kind: import_zod6.z.literal("cycle"),
|
|
664
687
|
count: import_zod6.z.number().int().min(2).max(12),
|
|
665
|
-
minutes: import_zod6.z.number().int().min(1).max(1440).default(5)
|
|
688
|
+
minutes: import_zod6.z.number().int().min(1).max(1440).default(5),
|
|
689
|
+
/**
|
|
690
|
+
* A turn shorter than a minute — a slideshow at 5, 15 or 30 seconds. Wins
|
|
691
|
+
* over `minutes` where it is given; `minutes` stays the nearest whole
|
|
692
|
+
* minute, so a board whose firmware predates this still takes turns,
|
|
693
|
+
* once a minute. Counted the same way: seconds since 1970, in turns.
|
|
694
|
+
*/
|
|
695
|
+
seconds: import_zod6.z.number().int().min(5).max(86400).optional()
|
|
696
|
+
}),
|
|
697
|
+
/**
|
|
698
|
+
* The board's own parts: what a sensor plugged into the board it is drawn
|
|
699
|
+
* on is reading right now (docs/superpowers/specs/ramme-lab.md, "The
|
|
700
|
+
* differentiator"). Fields: `temperature`, from a temperature probe, a
|
|
701
|
+
* whole number in `units` like the weather's; and `connected`, whether a
|
|
702
|
+
* probe is plugged in at all. A board with nothing plugged in has no
|
|
703
|
+
* `temperature`, so a binding to it draws the placeholder.
|
|
704
|
+
*
|
|
705
|
+
* The board fills it from the probe (drawApp() in the sketch); a page
|
|
706
|
+
* previewing that board fills it from the readings the board reported
|
|
707
|
+
* (useAppData); the Studio, with no board, shows the placeholder.
|
|
708
|
+
*/
|
|
709
|
+
import_zod6.z.object({
|
|
710
|
+
kind: import_zod6.z.literal("board"),
|
|
711
|
+
units: import_zod6.z.enum(["imperial", "metric"]).default("imperial")
|
|
666
712
|
})
|
|
667
713
|
]);
|
|
668
714
|
var AppOperandSchema = import_zod6.z.union([
|
|
@@ -835,6 +881,11 @@ var AppGroupSchema = import_zod6.z.object({
|
|
|
835
881
|
children: import_zod6.z.array(AppLeafSchema).min(1).max(8)
|
|
836
882
|
});
|
|
837
883
|
var AppBlockSchema = import_zod6.z.union([AppLeafSchema, AppGroupSchema]);
|
|
884
|
+
var PanelOrientationSchema = import_zod6.z.enum(["landscape", "portrait"]);
|
|
885
|
+
var PANEL_SIZE = {
|
|
886
|
+
landscape: { width: 320, height: 240 },
|
|
887
|
+
portrait: { width: 240, height: 320 }
|
|
888
|
+
};
|
|
838
889
|
var AppScreenSizeSchema = import_zod6.z.preprocess(
|
|
839
890
|
(value) => value === "240x320" ? "320x240" : value,
|
|
840
891
|
import_zod6.z.enum(["320x240"])
|
|
@@ -855,6 +906,27 @@ var AppDocumentSchema = import_zod6.z.object({
|
|
|
855
906
|
* block off the glass. Older firmware draws from the top.
|
|
856
907
|
*/
|
|
857
908
|
valign: import_zod6.z.enum(["start", "center"]).optional(),
|
|
909
|
+
/**
|
|
910
|
+
* Where the blocks sit across the screen as a whole. `center` makes a column
|
|
911
|
+
* as wide as the widest block and centres that column, so left-aligned lines
|
|
912
|
+
* stay aligned with each other and the group sits in the middle — rather
|
|
913
|
+
* than every line hugging the left edge with the right half empty. Widths
|
|
914
|
+
* are the board's (see `pack`); a block with no width of its own, like an
|
|
915
|
+
* equal-celled row or a bar, fills the screen and leaves nothing to centre.
|
|
916
|
+
* Older firmware draws from the left.
|
|
917
|
+
*/
|
|
918
|
+
halign: import_zod6.z.enum(["start", "center"]).optional(),
|
|
919
|
+
/**
|
|
920
|
+
* The lettering. `inter` (the default) is Inter, anti-aliased, drawn at
|
|
921
|
+
* each text size from its own font — SMOOTH_FONT_ADVANCES in
|
|
922
|
+
* ./deviceFonts.generated.ts are its widths. `pixel` is the board's
|
|
923
|
+
* built-in 5x7 bitmap font scaled up: the retro look, chunky on purpose.
|
|
924
|
+
* `tay` is TAY Dreamboat, the Ramme display face — capitals only, so
|
|
925
|
+
* lowercase is drawn as capitals; best for signs, times and numbers.
|
|
926
|
+
* Firmware older than 2026-10-18 draws everything in pixel, and older than
|
|
927
|
+
* 2026-10-20 draws `tay` as Inter.
|
|
928
|
+
*/
|
|
929
|
+
font: import_zod6.z.enum(["inter", "pixel", "tay"]).optional(),
|
|
858
930
|
/** Named so bindings can refer to them. */
|
|
859
931
|
sources: import_zod6.z.record(AppSourceSchema).default({}),
|
|
860
932
|
blocks: import_zod6.z.array(AppBlockSchema).min(1).max(12)
|
|
@@ -944,82 +1016,32 @@ var PhotoSummarySchema = import_zod7.z.object({
|
|
|
944
1016
|
});
|
|
945
1017
|
|
|
946
1018
|
// src/apps/delivery.ts
|
|
947
|
-
var
|
|
948
|
-
var DeviceIdSchema = import_zod8.z.string().regex(/^[0-9A-HJKMNP-TV-Z]{8}$/, "eight characters, no I L O or U");
|
|
949
|
-
var PairCodeSchema = import_zod8.z.string().regex(/^\d{4}$/);
|
|
950
|
-
var DeviceRegistrationSchema = import_zod8.z.object({
|
|
951
|
-
deviceId: DeviceIdSchema,
|
|
952
|
-
code: PairCodeSchema,
|
|
953
|
-
/** Firmware build, so a support question has an answer. */
|
|
954
|
-
version: import_zod8.z.string().max(40).optional(),
|
|
955
|
-
/** Which board this is, from Boards.h — the two variants need different firmware. */
|
|
956
|
-
board: import_zod8.z.string().max(40).optional(),
|
|
957
|
-
/** dBm, always negative. -50 is across the room; -85 is a complaint. */
|
|
958
|
-
rssi: import_zod8.z.number().int().min(-127).max(0).optional(),
|
|
959
|
-
/** On the owner's own network. Long enough for IPv6, which this does not send yet. */
|
|
960
|
-
ip: import_zod8.z.string().max(45).optional(),
|
|
961
|
-
/** Seconds since boot. Not growing between check-ins means it is restarting. */
|
|
962
|
-
uptime: import_zod8.z.number().int().nonnegative().optional(),
|
|
963
|
-
/** Free heap in bytes. */
|
|
964
|
-
heap: import_zod8.z.number().int().nonnegative().optional(),
|
|
965
|
-
/** The app revision the board has actually drawn. */
|
|
966
|
-
drew: import_zod8.z.number().int().nonnegative().optional(),
|
|
967
|
-
/** Why it last restarted, already mapped to a word by the firmware. */
|
|
968
|
-
reset: import_zod8.z.string().max(40).optional()
|
|
969
|
-
});
|
|
970
|
-
var SendRequestSchema = import_zod8.z.object({
|
|
971
|
-
deviceId: DeviceIdSchema,
|
|
972
|
-
code: PairCodeSchema
|
|
973
|
-
});
|
|
974
|
-
var OwnedSendRequestSchema = import_zod8.z.object({
|
|
975
|
-
deviceId: DeviceIdSchema
|
|
976
|
-
});
|
|
977
|
-
var DeliveredAppSchema = import_zod8.z.object({
|
|
978
|
-
revision: import_zod8.z.number().int().nonnegative(),
|
|
979
|
-
sentAt: import_zod8.z.number().int().nonnegative()
|
|
980
|
-
});
|
|
981
|
-
var DeviceRecordSchema = import_zod8.z.object({
|
|
982
|
-
deviceId: DeviceIdSchema,
|
|
983
|
-
code: PairCodeSchema,
|
|
984
|
-
ownerId: import_zod8.z.string().nullable().default(null),
|
|
985
|
-
version: import_zod8.z.string().max(40).optional(),
|
|
986
|
-
createdAt: import_zod8.z.number().int().nonnegative(),
|
|
987
|
-
lastSeenAt: import_zod8.z.number().int().nonnegative()
|
|
988
|
-
});
|
|
989
|
-
var DEVICE_LABEL_MAX = 48;
|
|
990
|
-
var DEVICE_TTL_SECONDS = 60 * 60 * 24 * 30;
|
|
991
|
-
var CLAIMED_DEVICE_TTL_SECONDS = 60 * 60 * 24 * 400;
|
|
992
|
-
var FirmwareUpdateSchema = import_zod8.z.object({
|
|
993
|
-
version: import_zod8.z.string().min(1).max(40),
|
|
994
|
-
url: import_zod8.z.string().url().max(200),
|
|
995
|
-
sha256: import_zod8.z.string().regex(/^[0-9a-f]{64}$/),
|
|
996
|
-
bytes: import_zod8.z.number().int().positive(),
|
|
997
|
-
requestedAt: import_zod8.z.number().int().nonnegative()
|
|
998
|
-
});
|
|
999
|
-
var FIRMWARE_UPDATE_PREFIX = "https://www.ramme.io/firmware/weather-display/";
|
|
1000
|
-
var FIRMWARE_UPDATE_ATTEMPTS = 3;
|
|
1019
|
+
var import_zod9 = require("zod");
|
|
1001
1020
|
|
|
1002
1021
|
// src/apps/vitals.ts
|
|
1003
|
-
var
|
|
1004
|
-
var VitalSourceSchema =
|
|
1005
|
-
var
|
|
1022
|
+
var import_zod8 = require("zod");
|
|
1023
|
+
var VitalSourceSchema = import_zod8.z.enum(["register", "poll", "send"]);
|
|
1024
|
+
var DeviceFeatureStateSchema = import_zod8.z.enum(["working", "missing", "unsupported", "fault"]);
|
|
1025
|
+
var DeviceFeatureKeySchema = import_zod8.z.string().regex(/^[a-z][a-z0-9-]{0,23}$/);
|
|
1026
|
+
var DeviceFeaturesSchema = import_zod8.z.record(DeviceFeatureKeySchema, DeviceFeatureStateSchema).refine((f) => Object.keys(f).length <= 16, { message: "at most 16 features" });
|
|
1027
|
+
var DeviceVitalsSchema = import_zod8.z.object({
|
|
1006
1028
|
/** When the board last said any of this, by the server's clock. */
|
|
1007
|
-
reportedAt:
|
|
1029
|
+
reportedAt: import_zod8.z.number().int().nonnegative().optional(),
|
|
1008
1030
|
/**
|
|
1009
1031
|
* The firmware build. Today every board sends the literal "doc-1", which is a
|
|
1010
1032
|
* protocol marker rather than a build id — so this is shown as reported and
|
|
1011
1033
|
* labelled as not yet a version. The real value lives in the published
|
|
1012
1034
|
* manifest until firmware carries it.
|
|
1013
1035
|
*/
|
|
1014
|
-
firmwareVersion:
|
|
1036
|
+
firmwareVersion: import_zod8.z.string().max(40).optional(),
|
|
1015
1037
|
/** Which board this is. Nothing distinguishes a CYD from a Freenove S3 yet. */
|
|
1016
|
-
board:
|
|
1038
|
+
board: import_zod8.z.string().max(40).optional(),
|
|
1017
1039
|
/** dBm, negative. -50 is across the room, -85 is a complaint. */
|
|
1018
|
-
rssi:
|
|
1040
|
+
rssi: import_zod8.z.number().int().min(-127).max(0).optional(),
|
|
1019
1041
|
/** The board's address on its own network, as the board sees it. */
|
|
1020
|
-
ip:
|
|
1021
|
-
uptimeSeconds:
|
|
1022
|
-
freeHeapBytes:
|
|
1042
|
+
ip: import_zod8.z.string().max(45).optional(),
|
|
1043
|
+
uptimeSeconds: import_zod8.z.number().int().nonnegative().optional(),
|
|
1044
|
+
freeHeapBytes: import_zod8.z.number().int().nonnegative().optional(),
|
|
1023
1045
|
/**
|
|
1024
1046
|
* The revision the board is actually showing.
|
|
1025
1047
|
*
|
|
@@ -1027,30 +1049,69 @@ var DeviceVitalsSchema = import_zod9.z.object({
|
|
|
1027
1049
|
* value: a send that was never drawn looks identical to a successful one until
|
|
1028
1050
|
* these two numbers disagree.
|
|
1029
1051
|
*/
|
|
1030
|
-
drewRevision:
|
|
1052
|
+
drewRevision: import_zod8.z.number().int().nonnegative().optional(),
|
|
1031
1053
|
/** Why it last restarted, if it says. A board power-cycling in a loop is a fault. */
|
|
1032
|
-
resetReason:
|
|
1054
|
+
resetReason: import_zod8.z.string().max(40).optional(),
|
|
1055
|
+
/** Its parts and whether each works — see `DeviceFeaturesSchema`. */
|
|
1056
|
+
features: DeviceFeaturesSchema.optional(),
|
|
1033
1057
|
/** When it last polled — finer-grained than a registration, for liveness only. */
|
|
1034
|
-
lastPollAt:
|
|
1058
|
+
lastPollAt: import_zod8.z.number().int().nonnegative().optional()
|
|
1035
1059
|
});
|
|
1036
|
-
var DeviceSeenSchema =
|
|
1060
|
+
var DeviceSeenSchema = import_zod8.z.object({
|
|
1037
1061
|
/** When the board last asked for its app. The freshest signal this system has. */
|
|
1038
|
-
lastPollAt:
|
|
1062
|
+
lastPollAt: import_zod8.z.number().int().nonnegative(),
|
|
1039
1063
|
/** The revision it reported drawing at that moment. */
|
|
1040
|
-
drewRevision:
|
|
1064
|
+
drewRevision: import_zod8.z.number().int().nonnegative().optional(),
|
|
1041
1065
|
/**
|
|
1042
1066
|
* The firmware it is running, sent on every poll by builds that can update
|
|
1043
1067
|
* remotely — so its presence is also the answer to "can this board be
|
|
1044
1068
|
* updated from its page?". Registration reports the version too, but only
|
|
1045
1069
|
* every six hours; after a remote update this is what shows it took.
|
|
1046
1070
|
*/
|
|
1047
|
-
firmware:
|
|
1071
|
+
firmware: import_zod8.z.string().max(40).optional(),
|
|
1048
1072
|
/** Photos its app names, and how many of those it holds in flash. */
|
|
1049
|
-
photosWanted:
|
|
1050
|
-
photosHeld:
|
|
1073
|
+
photosWanted: import_zod8.z.number().int().nonnegative().optional(),
|
|
1074
|
+
photosHeld: import_zod8.z.number().int().nonnegative().optional(),
|
|
1051
1075
|
/** What happened to the last firmware update it tried, in a few words. */
|
|
1052
|
-
updateResult:
|
|
1053
|
-
|
|
1076
|
+
updateResult: import_zod8.z.string().max(80).optional(),
|
|
1077
|
+
/**
|
|
1078
|
+
* What the battery line reads, in millivolts — S3 boards only, which have a
|
|
1079
|
+
* divider on GPIO9; a CYD has no way to measure a battery. Shown raw on the
|
|
1080
|
+
* board's page until it has been checked against a real battery, and only
|
|
1081
|
+
* then turned into an icon and a percentage on the glass.
|
|
1082
|
+
*/
|
|
1083
|
+
batteryMv: import_zod8.z.number().int().min(0).max(1e4).optional(),
|
|
1084
|
+
/**
|
|
1085
|
+
* The quarter turn its screen is set to (Settings → Turn), 0-3 as LovyanGFX
|
|
1086
|
+
* counts them: even is upright, odd is sideways, the board's 240x320 panel
|
|
1087
|
+
* turned. Its page previews apps the way the board stands (PANEL_SIZE).
|
|
1088
|
+
* Absent from a board older than 2026-10-28, which only ever stood sideways.
|
|
1089
|
+
*/
|
|
1090
|
+
rotation: import_zod8.z.number().int().min(0).max(3).optional()
|
|
1091
|
+
});
|
|
1092
|
+
var DeviceReadingSchema = import_zod8.z.object({
|
|
1093
|
+
key: DeviceFeatureKeySchema,
|
|
1094
|
+
value: import_zod8.z.union([import_zod8.z.number().finite(), import_zod8.z.string().max(64), import_zod8.z.boolean()]),
|
|
1095
|
+
unit: import_zod8.z.string().max(16).optional(),
|
|
1096
|
+
at: import_zod8.z.number().int().nonnegative().optional()
|
|
1097
|
+
});
|
|
1098
|
+
var DeviceReportSchema = import_zod8.z.object({
|
|
1099
|
+
readings: import_zod8.z.array(DeviceReadingSchema).min(1).max(16)
|
|
1100
|
+
});
|
|
1101
|
+
var DEVICE_FEATURES = [
|
|
1102
|
+
{ key: "screen", label: "Screen" },
|
|
1103
|
+
{ key: "touch", label: "Touch" },
|
|
1104
|
+
{ key: "speaker", label: "Speaker" },
|
|
1105
|
+
{ key: "microphone", label: "Microphone" },
|
|
1106
|
+
{ key: "battery", label: "Battery" },
|
|
1107
|
+
{ key: "temperature", label: "Temperature probe" }
|
|
1108
|
+
];
|
|
1109
|
+
var DEVICE_FEATURE_STATE_LABELS = {
|
|
1110
|
+
working: "Working",
|
|
1111
|
+
missing: "None on this board",
|
|
1112
|
+
unsupported: "Not supported yet",
|
|
1113
|
+
fault: "Not working"
|
|
1114
|
+
};
|
|
1054
1115
|
var DEVICE_VITALS_FIELDS = [
|
|
1055
1116
|
{
|
|
1056
1117
|
key: "firmwareVersion",
|
|
@@ -1071,11 +1132,84 @@ var DEVICE_VITALS_FIELDS = [
|
|
|
1071
1132
|
source: "register",
|
|
1072
1133
|
reportedByFirmware: true
|
|
1073
1134
|
},
|
|
1074
|
-
{ key: "resetReason", label: "Last restart", source: "register", reportedByFirmware: true }
|
|
1135
|
+
{ key: "resetReason", label: "Last restart", source: "register", reportedByFirmware: true },
|
|
1136
|
+
{
|
|
1137
|
+
key: "batteryMv",
|
|
1138
|
+
label: "Battery line",
|
|
1139
|
+
unit: "mV",
|
|
1140
|
+
source: "poll",
|
|
1141
|
+
reportedByFirmware: true,
|
|
1142
|
+
note: "Black (S3) boards only, raw and not yet calibrated. A yellow board cannot measure a battery."
|
|
1143
|
+
}
|
|
1075
1144
|
];
|
|
1076
1145
|
var DEVICE_FRESH_MS = 7 * 60 * 60 * 1e3;
|
|
1077
1146
|
var DEVICE_STALE_MS = 30 * 24 * 60 * 60 * 1e3;
|
|
1078
1147
|
|
|
1148
|
+
// src/apps/delivery.ts
|
|
1149
|
+
var DeviceIdSchema = import_zod9.z.string().regex(/^[0-9A-HJKMNP-TV-Z]{8}$/, "eight characters, no I L O or U");
|
|
1150
|
+
var PairCodeSchema = import_zod9.z.string().regex(/^\d{4}$/);
|
|
1151
|
+
var DeviceRegistrationSchema = import_zod9.z.object({
|
|
1152
|
+
deviceId: DeviceIdSchema,
|
|
1153
|
+
code: PairCodeSchema,
|
|
1154
|
+
/** Firmware build, so a support question has an answer. */
|
|
1155
|
+
version: import_zod9.z.string().max(40).optional(),
|
|
1156
|
+
/** Which board this is, from Boards.h — the two variants need different firmware. */
|
|
1157
|
+
board: import_zod9.z.string().max(40).optional(),
|
|
1158
|
+
/** dBm, always negative. -50 is across the room; -85 is a complaint. */
|
|
1159
|
+
rssi: import_zod9.z.number().int().min(-127).max(0).optional(),
|
|
1160
|
+
/** On the owner's own network. Long enough for IPv6, which this does not send yet. */
|
|
1161
|
+
ip: import_zod9.z.string().max(45).optional(),
|
|
1162
|
+
/** Seconds since boot. Not growing between check-ins means it is restarting. */
|
|
1163
|
+
uptime: import_zod9.z.number().int().nonnegative().optional(),
|
|
1164
|
+
/** Free heap in bytes. */
|
|
1165
|
+
heap: import_zod9.z.number().int().nonnegative().optional(),
|
|
1166
|
+
/** The app revision the board has actually drawn. */
|
|
1167
|
+
drew: import_zod9.z.number().int().nonnegative().optional(),
|
|
1168
|
+
/** Why it last restarted, already mapped to a word by the firmware. */
|
|
1169
|
+
reset: import_zod9.z.string().max(40).optional(),
|
|
1170
|
+
/**
|
|
1171
|
+
* What the board has and whether each part works: "speaker: working",
|
|
1172
|
+
* "battery: missing". This describes the device — its own hardware, as its
|
|
1173
|
+
* own check screen reports it — and never the room: a state, not a reading.
|
|
1174
|
+
* What the microphone heard, a sensor's value, or anything a part could
|
|
1175
|
+
* learn about its surroundings does not belong here and is not representable
|
|
1176
|
+
* (DeviceFeatureStateSchema is four words). Readings, when they come, travel
|
|
1177
|
+
* as Signals and are argued for on their own.
|
|
1178
|
+
*/
|
|
1179
|
+
features: DeviceFeaturesSchema.optional()
|
|
1180
|
+
});
|
|
1181
|
+
var SendRequestSchema = import_zod9.z.object({
|
|
1182
|
+
deviceId: DeviceIdSchema,
|
|
1183
|
+
code: PairCodeSchema
|
|
1184
|
+
});
|
|
1185
|
+
var OwnedSendRequestSchema = import_zod9.z.object({
|
|
1186
|
+
deviceId: DeviceIdSchema
|
|
1187
|
+
});
|
|
1188
|
+
var DeliveredAppSchema = import_zod9.z.object({
|
|
1189
|
+
revision: import_zod9.z.number().int().nonnegative(),
|
|
1190
|
+
sentAt: import_zod9.z.number().int().nonnegative()
|
|
1191
|
+
});
|
|
1192
|
+
var DeviceRecordSchema = import_zod9.z.object({
|
|
1193
|
+
deviceId: DeviceIdSchema,
|
|
1194
|
+
code: PairCodeSchema,
|
|
1195
|
+
ownerId: import_zod9.z.string().nullable().default(null),
|
|
1196
|
+
version: import_zod9.z.string().max(40).optional(),
|
|
1197
|
+
createdAt: import_zod9.z.number().int().nonnegative(),
|
|
1198
|
+
lastSeenAt: import_zod9.z.number().int().nonnegative()
|
|
1199
|
+
});
|
|
1200
|
+
var DEVICE_LABEL_MAX = 48;
|
|
1201
|
+
var DEVICE_TTL_SECONDS = 60 * 60 * 24 * 30;
|
|
1202
|
+
var CLAIMED_DEVICE_TTL_SECONDS = 60 * 60 * 24 * 400;
|
|
1203
|
+
var FirmwareUpdateSchema = import_zod9.z.object({
|
|
1204
|
+
version: import_zod9.z.string().min(1).max(40),
|
|
1205
|
+
url: import_zod9.z.string().url().max(200),
|
|
1206
|
+
sha256: import_zod9.z.string().regex(/^[0-9a-f]{64}$/),
|
|
1207
|
+
bytes: import_zod9.z.number().int().positive(),
|
|
1208
|
+
requestedAt: import_zod9.z.number().int().nonnegative()
|
|
1209
|
+
});
|
|
1210
|
+
var FIRMWARE_UPDATE_PREFIX = "https://www.ramme.io/firmware/weather-display/";
|
|
1211
|
+
var FIRMWARE_UPDATE_ATTEMPTS = 3;
|
|
1212
|
+
|
|
1079
1213
|
// src/apps/glyphs.ts
|
|
1080
1214
|
var DEVICE_UNKNOWN_GLYPH = "?";
|
|
1081
1215
|
var DEVICE_GLYPHS = {
|
|
@@ -1151,6 +1285,7 @@ var DEVICE_GLYPHS = {
|
|
|
1151
1285
|
"\u2212": { byte: 45, shows: "-" },
|
|
1152
1286
|
"\xA0": { byte: 32, shows: " " }
|
|
1153
1287
|
};
|
|
1288
|
+
var DISPLAY_FACE_MIN_PX = 28;
|
|
1154
1289
|
var DEVICE_PALETTE = {
|
|
1155
1290
|
background: "17 17 17",
|
|
1156
1291
|
foreground: "238 238 238",
|
|
@@ -1281,74 +1416,158 @@ var WEATHER_ICONS = {
|
|
|
1281
1416
|
]
|
|
1282
1417
|
};
|
|
1283
1418
|
|
|
1284
|
-
// src/
|
|
1419
|
+
// src/apps/shelf.ts
|
|
1285
1420
|
var import_zod10 = require("zod");
|
|
1286
|
-
var
|
|
1287
|
-
|
|
1288
|
-
|
|
1421
|
+
var SHELF_MAX_APPS = 8;
|
|
1422
|
+
var SHELF_MAX_BYTES = 24e3;
|
|
1423
|
+
var SHELF_ROTATE_MINUTES = [0, 1, 5, 15, 30, 60];
|
|
1424
|
+
var ShelfSchema = import_zod10.z.object({
|
|
1425
|
+
apps: import_zod10.z.array(AppDocumentSchema).min(1).max(SHELF_MAX_APPS),
|
|
1426
|
+
/** Which app to show — an index into `apps`. */
|
|
1427
|
+
show: import_zod10.z.number().int().min(0).max(SHELF_MAX_APPS - 1),
|
|
1428
|
+
/** Move to the next app every this many minutes; 0 holds still. */
|
|
1429
|
+
rotateMinutes: import_zod10.z.number().int().min(0).max(1440).default(0),
|
|
1430
|
+
/**
|
|
1431
|
+
* When each app was last sent, aligned with `apps`. The server's
|
|
1432
|
+
* bookkeeping, not the board's: a send to a full shelf takes off the app
|
|
1433
|
+
* sent longest ago, so sending always works. Missing reads as oldest.
|
|
1434
|
+
*/
|
|
1435
|
+
added: import_zod10.z.array(import_zod10.z.number().int().nonnegative()).max(SHELF_MAX_APPS).optional()
|
|
1436
|
+
});
|
|
1437
|
+
var ShelfEditSchema = import_zod10.z.discriminatedUnion("op", [
|
|
1438
|
+
import_zod10.z.object({ op: import_zod10.z.literal("show"), deviceId: DeviceIdSchema, index: import_zod10.z.number().int().min(0) }),
|
|
1439
|
+
import_zod10.z.object({ op: import_zod10.z.literal("remove"), deviceId: DeviceIdSchema, index: import_zod10.z.number().int().min(0) }),
|
|
1440
|
+
import_zod10.z.object({
|
|
1441
|
+
op: import_zod10.z.literal("move"),
|
|
1442
|
+
deviceId: DeviceIdSchema,
|
|
1443
|
+
from: import_zod10.z.number().int().min(0),
|
|
1444
|
+
to: import_zod10.z.number().int().min(0)
|
|
1445
|
+
}),
|
|
1446
|
+
import_zod10.z.object({ op: import_zod10.z.literal("rotate"), deviceId: DeviceIdSchema, minutes: import_zod10.z.number().int().min(0).max(1440) }),
|
|
1447
|
+
/**
|
|
1448
|
+
* Swap the panel's light and dark. Not about apps, but it rides the same
|
|
1449
|
+
* route and the same poll: some units of the same board carry a panel wired
|
|
1450
|
+
* the other way, so one shows white on black and its twin black on white
|
|
1451
|
+
* from identical firmware. It is a fact about one board's glass, so it is a
|
|
1452
|
+
* per-board setting rather than a build.
|
|
1453
|
+
*/
|
|
1454
|
+
import_zod10.z.object({ op: import_zod10.z.literal("screen"), deviceId: DeviceIdSchema, invert: import_zod10.z.boolean() }),
|
|
1455
|
+
/**
|
|
1456
|
+
* Remove one entry from the list of apps sent to this board, by the revision
|
|
1457
|
+
* it was sent as. The record only: what the board holds is the shelf's
|
|
1458
|
+
* business, and `remove` above is how an app comes off it.
|
|
1459
|
+
*/
|
|
1460
|
+
import_zod10.z.object({ op: import_zod10.z.literal("forget"), deviceId: DeviceIdSchema, revision: import_zod10.z.number().int().min(1) })
|
|
1461
|
+
]);
|
|
1462
|
+
|
|
1463
|
+
// src/apps/protocol.ts
|
|
1464
|
+
var import_zod12 = require("zod");
|
|
1465
|
+
|
|
1466
|
+
// src/theme/account.ts
|
|
1467
|
+
var import_zod11 = require("zod");
|
|
1468
|
+
var ThemeRgbSchema = import_zod11.z.string().regex(/^\d{1,3} \d{1,3} \d{1,3}$/, 'Must be "R G B", e.g. "13 110 253"').refine((v) => v.split(" ").every((n) => Number(n) <= 255), "Each channel is 0\u2013255");
|
|
1469
|
+
var ThemePaletteSchema = import_zod11.z.object({
|
|
1470
|
+
background: ThemeRgbSchema,
|
|
1471
|
+
/** Text. */
|
|
1472
|
+
foreground: ThemeRgbSchema,
|
|
1473
|
+
/** Quieter text: labels, captions, the second line. */
|
|
1474
|
+
muted: ThemeRgbSchema,
|
|
1475
|
+
/** The brand colour: buttons and links on the site, highlights on a board. */
|
|
1476
|
+
accent: ThemeRgbSchema,
|
|
1477
|
+
success: ThemeRgbSchema,
|
|
1478
|
+
warning: ThemeRgbSchema,
|
|
1479
|
+
danger: ThemeRgbSchema
|
|
1480
|
+
});
|
|
1481
|
+
var THEME_PALETTE_TOKENS = [
|
|
1482
|
+
"background",
|
|
1483
|
+
"foreground",
|
|
1484
|
+
"muted",
|
|
1485
|
+
"accent",
|
|
1486
|
+
"success",
|
|
1487
|
+
"warning",
|
|
1488
|
+
"danger"
|
|
1489
|
+
];
|
|
1490
|
+
var ThemeLetteringSchema = import_zod11.z.enum(["inter", "tay", "pixel"]);
|
|
1491
|
+
var THEME_RADII = ["0rem", "0.25rem", "0.5rem", "0.75rem", "1rem"];
|
|
1492
|
+
var AccountThemeSchema = import_zod11.z.object({
|
|
1493
|
+
name: import_zod11.z.string().trim().min(1).max(40),
|
|
1494
|
+
/** The preset it started from, when it started from one. */
|
|
1495
|
+
base: import_zod11.z.string().max(40).optional(),
|
|
1496
|
+
light: ThemePaletteSchema,
|
|
1497
|
+
dark: ThemePaletteSchema,
|
|
1498
|
+
lettering: ThemeLetteringSchema,
|
|
1499
|
+
radius: import_zod11.z.enum(THEME_RADII)
|
|
1500
|
+
});
|
|
1501
|
+
|
|
1502
|
+
// src/apps/protocol.ts
|
|
1503
|
+
var DEVICE_PROTOCOL = {
|
|
1504
|
+
/** POST `DeviceRegistration` → 200. On boot and every six hours. */
|
|
1505
|
+
register: { method: "POST", path: "/api/device/register" },
|
|
1506
|
+
/**
|
|
1507
|
+
* GET `?id=&since=<revision>` plus what the board says about itself
|
|
1508
|
+
* (`DEVICE_POLL_QUERY`) → 200 `DevicePollReply`, 304 when nothing is newer
|
|
1509
|
+
* than `since`, 204 when nothing has ever been sent.
|
|
1510
|
+
*/
|
|
1511
|
+
poll: { method: "GET", path: "/api/device/app" },
|
|
1512
|
+
/** POST `DeviceReport` → 202. Only while the board has readings to give. */
|
|
1513
|
+
report: { method: "POST", path: "/api/device/report" },
|
|
1514
|
+
/**
|
|
1515
|
+
* GET `?id=&hash=<sha256>` → 200 raw bytes, 404 for anything it may not
|
|
1516
|
+
* have. Only a hash an app on the board names; the board keeps the file.
|
|
1517
|
+
*/
|
|
1518
|
+
photo: { method: "GET", path: "/api/device/photo" }
|
|
1519
|
+
};
|
|
1520
|
+
var DEVICE_POLL_QUERY = {
|
|
1521
|
+
id: "the board id (required)",
|
|
1522
|
+
since: "the revision on the glass now",
|
|
1523
|
+
v: "the firmware version it runs",
|
|
1524
|
+
ph: 'photos held / photos wanted, as "3/4"',
|
|
1525
|
+
sh: '"1" when it can hold a shelf of apps rather than one',
|
|
1526
|
+
inv: 'its light/dark panel setting, "0" or "1"',
|
|
1527
|
+
rot: "which way it stands, 0\u20133",
|
|
1528
|
+
pl: "the palette it draws in, as 42 hex digits",
|
|
1529
|
+
fn: "the lettering it draws in",
|
|
1530
|
+
bt: "battery millivolts",
|
|
1531
|
+
u: "what happened to the last update it was asked to install"
|
|
1532
|
+
};
|
|
1533
|
+
var BoardPaletteHexSchema = import_zod12.z.string().regex(/^[0-9a-f]{42}$/);
|
|
1534
|
+
var BoardFontSchema = import_zod12.z.union([import_zod12.z.literal("auto"), ThemeLetteringSchema]);
|
|
1535
|
+
var DevicePollReplySchema = import_zod12.z.object({
|
|
1536
|
+
revision: import_zod12.z.number().int().nonnegative(),
|
|
1537
|
+
sentAt: import_zod12.z.number().int().nonnegative().optional(),
|
|
1538
|
+
document: AppDocumentSchema.optional(),
|
|
1539
|
+
shelf: ShelfSchema.optional(),
|
|
1540
|
+
update: FirmwareUpdateSchema.optional(),
|
|
1541
|
+
screen: import_zod12.z.object({ invert: import_zod12.z.boolean() }).optional(),
|
|
1542
|
+
palette: BoardPaletteHexSchema.optional(),
|
|
1543
|
+
font: BoardFontSchema.optional()
|
|
1544
|
+
});
|
|
1545
|
+
|
|
1546
|
+
// src/apps/deviceFonts.generated.ts
|
|
1547
|
+
var SMOOTH_FACES = { "inter": { "family": "Inter", "weight": 500, "caps": false }, "tay": { "family": "TAY Dreamboat", "weight": 400, "caps": true } };
|
|
1548
|
+
var SMOOTH_FONT_ADVANCES = { "inter": { "10": { "0": 6, "1": 4, "2": 6, "3": 6, "4": 7, "5": 6, "6": 6, "7": 6, "8": 6, "9": 6, " ": 3, "!": 3, '"': 5, "#": 6, "$": 6, "%": 10, "&": 7, "'": 3, "(": 4, ")": 4, "*": 5, "+": 7, ",": 3, "-": 5, ".": 3, "/": 4, ":": 3, ";": 3, "<": 7, "=": 7, ">": 7, "?": 5, "@": 10, "A": 7, "B": 7, "C": 7, "D": 7, "E": 6, "F": 6, "G": 7, "H": 7, "I": 3, "J": 6, "K": 7, "L": 6, "M": 9, "N": 8, "O": 8, "P": 6, "Q": 8, "R": 6, "S": 6, "T": 7, "U": 7, "V": 7, "W": 10, "X": 7, "Y": 7, "Z": 6, "[": 4, "\\": 4, "]": 4, "^": 5, "_": 5, "`": 3, "a": 6, "b": 6, "c": 6, "d": 6, "e": 6, "f": 4, "g": 6, "h": 6, "i": 3, "j": 3, "k": 6, "l": 3, "m": 9, "n": 6, "o": 6, "p": 6, "q": 6, "r": 4, "s": 5, "t": 3, "u": 6, "v": 6, "w": 8, "x": 6, "y": 6, "z": 6, "{": 4, "|": 3, "}": 4, "~": 7, "\xA0": 3, "\xA1": 3, "\xA2": 6, "\xA3": 6, "\xA5": 6, "\xAA": 5, "\xAB": 6, "\xAC": 7, "\xB0": 5, "\xB1": 7, "\xB2": 4, "\xB5": 6, "\xB7": 3, "\xBA": 5, "\xBB": 6, "\xBC": 8, "\xBD": 9, "\xBF": 5, "\xC4": 7, "\xC5": 7, "\xC6": 10, "\xC7": 7, "\xC9": 6, "\xD1": 8, "\xD6": 8, "\xDC": 7, "\xDF": 6, "\xE0": 6, "\xE1": 6, "\xE2": 6, "\xE4": 6, "\xE5": 6, "\xE6": 9, "\xE7": 6, "\xE8": 6, "\xE9": 6, "\xEA": 6, "\xEB": 6, "\xEC": 3, "\xED": 3, "\xEE": 3, "\xEF": 3, "\xF1": 6, "\xF2": 6, "\xF3": 6, "\xF4": 6, "\xF6": 6, "\xF7": 7, "\xF9": 6, "\xFA": 6, "\xFB": 6, "\xFC": 6, "\xFF": 6, "\u0192": 5, "\u03A9": 8, "\u03C0": 5, "\u2013": 5, "\u2014": 10, "\u2018": 3, "\u2019": 3, "\u201C": 5, "\u201D": 5, "\u2212": 7, "\u221A": 5, "\u221E": 7, "\u2248": 5, "\u2264": 5, "\u2265": 5 }, "12": { "0": 8, "1": 5, "2": 7, "3": 8, "4": 8, "5": 7, "6": 8, "7": 7, "8": 8, "9": 8, " ": 3, "!": 4, '"': 6, "#": 8, "$": 8, "%": 12, "&": 8, "'": 4, "(": 4, ")": 4, "*": 6, "+": 8, ",": 4, "-": 6, ".": 4, "/": 4, ":": 4, ";": 4, "<": 8, "=": 8, ">": 8, "?": 6, "@": 12, "A": 9, "B": 8, "C": 9, "D": 9, "E": 7, "F": 7, "G": 9, "H": 9, "I": 3, "J": 7, "K": 8, "L": 7, "M": 11, "N": 9, "O": 9, "P": 8, "Q": 9, "R": 8, "S": 8, "T": 8, "U": 9, "V": 9, "W": 12, "X": 8, "Y": 8, "Z": 8, "[": 4, "\\": 4, "]": 4, "^": 6, "_": 6, "`": 4, "a": 7, "b": 7, "c": 7, "d": 7, "e": 7, "f": 5, "g": 7, "h": 7, "i": 3, "j": 3, "k": 7, "l": 3, "m": 11, "n": 7, "o": 7, "p": 7, "q": 7, "r": 5, "s": 6, "t": 4, "u": 7, "v": 7, "w": 10, "x": 7, "y": 7, "z": 7, "{": 5, "|": 4, "}": 5, "~": 8, "\xA0": 3, "\xA1": 4, "\xA2": 7, "\xA3": 7, "\xA5": 7, "\xAA": 5, "\xAB": 7, "\xAC": 8, "\xB0": 5, "\xB1": 8, "\xB2": 5, "\xB5": 7, "\xB7": 4, "\xBA": 6, "\xBB": 7, "\xBC": 10, "\xBD": 10, "\xBF": 6, "\xC4": 9, "\xC5": 9, "\xC6": 12, "\xC7": 9, "\xC9": 7, "\xD1": 9, "\xD6": 9, "\xDC": 9, "\xDF": 8, "\xE0": 7, "\xE1": 7, "\xE2": 7, "\xE4": 7, "\xE5": 7, "\xE6": 11, "\xE7": 7, "\xE8": 7, "\xE9": 7, "\xEA": 7, "\xEB": 7, "\xEC": 3, "\xED": 3, "\xEE": 3, "\xEF": 3, "\xF1": 7, "\xF2": 7, "\xF3": 7, "\xF4": 7, "\xF6": 7, "\xF7": 8, "\xF9": 7, "\xFA": 7, "\xFB": 7, "\xFC": 7, "\xFF": 7, "\u0192": 6, "\u03A9": 9, "\u03C0": 7, "\u2013": 6, "\u2014": 12, "\u2018": 3, "\u2019": 3, "\u201C": 6, "\u201D": 6, "\u2212": 8, "\u221A": 7, "\u221E": 9, "\u2248": 7, "\u2264": 7, "\u2265": 7 }, "16": { "0": 10, "1": 7, "2": 10, "3": 10, "4": 11, "5": 10, "6": 10, "7": 9, "8": 10, "9": 10, " ": 4, "!": 5, '"': 8, "#": 10, "$": 10, "%": 16, "&": 10, "'": 5, "(": 6, ")": 6, "*": 8, "+": 11, ",": 5, "-": 7, ".": 5, "/": 6, ":": 5, ";": 5, "<": 11, "=": 11, ">": 11, "?": 8, "@": 16, "A": 11, "B": 11, "C": 12, "D": 12, "E": 10, "F": 9, "G": 12, "H": 12, "I": 4, "J": 9, "K": 11, "L": 9, "M": 15, "N": 12, "O": 12, "P": 10, "Q": 12, "R": 10, "S": 10, "T": 10, "U": 12, "V": 11, "W": 16, "X": 11, "Y": 11, "Z": 10, "[": 6, "\\": 6, "]": 6, "^": 8, "_": 7, "`": 5, "a": 9, "b": 10, "c": 9, "d": 10, "e": 9, "f": 6, "g": 10, "h": 10, "i": 4, "j": 4, "k": 9, "l": 4, "m": 14, "n": 10, "o": 10, "p": 10, "q": 10, "r": 6, "s": 9, "t": 5, "u": 10, "v": 9, "w": 13, "x": 9, "y": 9, "z": 9, "{": 7, "|": 6, "}": 7, "~": 11, "\xA0": 4, "\xA1": 5, "\xA2": 9, "\xA3": 10, "\xA5": 9, "\xAA": 7, "\xAB": 10, "\xAC": 11, "\xB0": 7, "\xB1": 11, "\xB2": 7, "\xB5": 10, "\xB7": 5, "\xBA": 8, "\xBB": 10, "\xBC": 13, "\xBD": 14, "\xBF": 8, "\xC4": 11, "\xC5": 11, "\xC6": 16, "\xC7": 12, "\xC9": 10, "\xD1": 12, "\xD6": 12, "\xDC": 12, "\xDF": 10, "\xE0": 9, "\xE1": 9, "\xE2": 9, "\xE4": 9, "\xE5": 9, "\xE6": 15, "\xE7": 9, "\xE8": 9, "\xE9": 9, "\xEA": 9, "\xEB": 9, "\xEC": 4, "\xED": 4, "\xEE": 4, "\xEF": 4, "\xF1": 10, "\xF2": 10, "\xF3": 10, "\xF4": 10, "\xF6": 10, "\xF7": 11, "\xF9": 10, "\xFA": 10, "\xFB": 10, "\xFC": 10, "\xFF": 9, "\u0192": 8, "\u03A9": 12, "\u03C0": 9, "\u2013": 8, "\u2014": 16, "\u2018": 4, "\u2019": 4, "\u201C": 8, "\u201D": 8, "\u2212": 11, "\u221A": 9, "\u221E": 11, "\u2248": 9, "\u2264": 9, "\u2265": 9 }, "20": { "0": 13, "1": 8, "2": 12, "3": 13, "4": 13, "5": 12, "6": 13, "7": 11, "8": 13, "9": 13, " ": 5, "!": 6, '"': 10, "#": 13, "$": 13, "%": 20, "&": 13, "'": 6, "(": 7, ")": 7, "*": 10, "+": 13, ",": 6, "-": 9, ".": 6, "/": 7, ":": 6, ";": 6, "<": 13, "=": 13, ">": 13, "?": 11, "@": 20, "A": 14, "B": 13, "C": 15, "D": 14, "E": 12, "F": 12, "G": 15, "H": 15, "I": 5, "J": 12, "K": 14, "L": 11, "M": 18, "N": 15, "O": 15, "P": 13, "Q": 15, "R": 13, "S": 13, "T": 13, "U": 15, "V": 14, "W": 20, "X": 14, "Y": 14, "Z": 13, "[": 7, "\\": 7, "]": 7, "^": 10, "_": 9, "`": 7, "a": 11, "b": 12, "c": 12, "d": 12, "e": 12, "f": 8, "g": 12, "h": 12, "i": 5, "j": 5, "k": 11, "l": 5, "m": 18, "n": 12, "o": 12, "p": 12, "q": 12, "r": 8, "s": 11, "t": 7, "u": 12, "v": 11, "w": 17, "x": 11, "y": 12, "z": 11, "{": 9, "|": 7, "}": 9, "~": 13, "\xA0": 5, "\xA1": 6, "\xA2": 12, "\xA3": 12, "\xA5": 11, "\xAA": 9, "\xAB": 12, "\xAC": 13, "\xB0": 9, "\xB1": 13, "\xB2": 9, "\xB5": 12, "\xB7": 6, "\xBA": 10, "\xBB": 12, "\xBC": 16, "\xBD": 17, "\xBF": 11, "\xC4": 14, "\xC5": 14, "\xC6": 20, "\xC7": 15, "\xC9": 12, "\xD1": 15, "\xD6": 15, "\xDC": 15, "\xDF": 13, "\xE0": 11, "\xE1": 11, "\xE2": 11, "\xE4": 11, "\xE5": 11, "\xE6": 18, "\xE7": 12, "\xE8": 12, "\xE9": 12, "\xEA": 12, "\xEB": 12, "\xEC": 5, "\xED": 5, "\xEE": 5, "\xEF": 5, "\xF1": 12, "\xF2": 12, "\xF3": 12, "\xF4": 12, "\xF6": 12, "\xF7": 13, "\xF9": 12, "\xFA": 12, "\xFB": 12, "\xFC": 12, "\xFF": 12, "\u0192": 10, "\u03A9": 15, "\u03C0": 11, "\u2013": 10, "\u2014": 20, "\u2018": 6, "\u2019": 6, "\u201C": 9, "\u201D": 9, "\u2212": 13, "\u221A": 11, "\u221E": 14, "\u2248": 11, "\u2264": 11, "\u2265": 11 }, "28": { "0": 18, "1": 12, "2": 17, "3": 18, "4": 18, "5": 17, "6": 18, "7": 16, "8": 18, "9": 18, " ": 7, "!": 9, '"': 14, "#": 18, "$": 18, "%": 28, "&": 18, "'": 9, "(": 10, ")": 10, "*": 15, "+": 19, ",": 8, "-": 13, ".": 8, "/": 10, ":": 8, ";": 9, "<": 19, "=": 19, ">": 19, "?": 15, "@": 28, "A": 20, "B": 18, "C": 21, "D": 20, "E": 17, "F": 17, "G": 21, "H": 21, "I": 8, "J": 16, "K": 19, "L": 16, "M": 26, "N": 21, "O": 21, "P": 18, "Q": 22, "R": 18, "S": 18, "T": 18, "U": 21, "V": 20, "W": 28, "X": 20, "Y": 19, "Z": 18, "[": 10, "\\": 10, "]": 10, "^": 13, "_": 13, "`": 9, "a": 16, "b": 17, "c": 16, "d": 17, "e": 16, "f": 11, "g": 17, "h": 17, "i": 7, "j": 7, "k": 16, "l": 7, "m": 25, "n": 17, "o": 17, "p": 17, "q": 17, "r": 11, "s": 15, "t": 10, "u": 17, "v": 16, "w": 23, "x": 16, "y": 16, "z": 16, "{": 12, "|": 10, "}": 12, "~": 19, "\xA0": 7, "\xA1": 9, "\xA2": 16, "\xA3": 17, "\xA5": 16, "\xAA": 13, "\xAB": 17, "\xAC": 19, "\xB0": 13, "\xB1": 19, "\xB2": 13, "\xB5": 17, "\xB7": 8, "\xBA": 14, "\xBB": 17, "\xBC": 23, "\xBD": 24, "\xBF": 15, "\xC4": 20, "\xC5": 20, "\xC6": 28, "\xC7": 21, "\xC9": 17, "\xD1": 21, "\xD6": 21, "\xDC": 21, "\xDF": 18, "\xE0": 16, "\xE1": 16, "\xE2": 16, "\xE4": 16, "\xE5": 16, "\xE6": 26, "\xE7": 16, "\xE8": 16, "\xE9": 16, "\xEA": 16, "\xEB": 16, "\xEC": 7, "\xED": 7, "\xEE": 7, "\xEF": 7, "\xF1": 17, "\xF2": 17, "\xF3": 17, "\xF4": 17, "\xF6": 17, "\xF7": 19, "\xF9": 17, "\xFA": 17, "\xFB": 17, "\xFC": 17, "\xFF": 16, "\u0192": 14, "\u03A9": 22, "\u03C0": 15, "\u2013": 14, "\u2014": 28, "\u2018": 8, "\u2019": 8, "\u201C": 13, "\u201D": 13, "\u2212": 19, "\u221A": 15, "\u221E": 20, "\u2248": 15, "\u2264": 15, "\u2265": 15 }, "56": { "0": 36, "1": 23, "2": 35, "3": 35, "4": 37, "5": 34, "6": 35, "7": 32, "8": 35, "9": 35, " ": 15, "!": 17, '"': 28, "#": 36, "$": 36, "%": 56, "&": 37, "'": 18, "(": 21, ")": 21, "*": 29, "+": 37, ",": 17, "-": 26, ".": 17, "/": 21, ":": 17, ";": 18, "<": 37, "=": 37, ">": 37, "?": 30, "@": 55, "A": 40, "B": 37, "C": 41, "D": 40, "E": 34, "F": 33, "G": 42, "H": 42, "I": 15, "J": 32, "K": 39, "L": 32, "M": 51, "N": 42, "O": 43, "P": 36, "Q": 43, "R": 36, "S": 36, "T": 37, "U": 41, "V": 40, "W": 56, "X": 39, "Y": 39, "Z": 36, "[": 21, "\\": 21, "]": 21, "^": 27, "_": 26, "`": 19, "a": 32, "b": 35, "c": 32, "d": 35, "e": 33, "f": 21, "g": 35, "h": 34, "i": 14, "j": 14, "k": 31, "l": 14, "m": 50, "n": 34, "o": 34, "p": 35, "q": 35, "r": 22, "s": 30, "t": 19, "u": 34, "v": 32, "w": 46, "x": 31, "y": 32, "z": 31, "{": 25, "|": 19, "}": 25, "~": 37, "\xB0": 26 } }, "tay": { "28": { "0": 29, "1": 16, "2": 28, "3": 28, "4": 30, "5": 27, "6": 28, "7": 26, "8": 29, "9": 29, " ": 12, "!": 16, '"': 12, "#": 27, "$": 27, "%": 29, "&": 33, "'": 9, "(": 20, ")": 20, "*": 14, "+": 21, ",": 10, "-": 16, ".": 10, "/": 19, ":": 13, ";": 12, "<": 18, "=": 22, ">": 18, "?": 27, "@": 31, "A": 28, "B": 32, "C": 28, "D": 30, "E": 30, "F": 29, "G": 29, "H": 32, "I": 16, "J": 27, "K": 29, "L": 27, "M": 36, "N": 32, "O": 29, "P": 30, "Q": 30, "R": 30, "S": 29, "T": 31, "U": 29, "V": 28, "W": 40, "X": 29, "Y": 29, "Z": 30, "[": 17, "\\": 19, "]": 17, "^": 13, "_": 19, "`": 9, "{": 13, "|": 6, "}": 13, "~": 15, "\xA0": 8, "\xA1": 15, "\xA2": 14, "\xA3": 26, "\xA5": 31, "\xAA": 8, "\xAB": 14, "\xAC": 16, "\xB0": 14, "\xB1": 15, "\xB2": 8, "\xB7": 7, "\xBA": 9, "\xBB": 14, "\xBC": 21, "\xBD": 21, "\xBF": 26, "\xC4": 28, "\xC5": 28, "\xC6": 25, "\xC7": 28, "\xC9": 30, "\xD1": 32, "\xD6": 29, "\xDC": 29, "\xF7": 15, "\u03A9": 22, "\u2013": 14, "\u2014": 28, "\u2018": 9, "\u2019": 9, "\u201C": 12, "\u201D": 12, "\u2212": 16, "\u221A": 15, "\u221E": 20, "\u2248": 15, "\u2264": 15, "\u2265": 15 }, "56": { "0": 58, "1": 33, "2": 56, "3": 57, "4": 60, "5": 55, "6": 57, "7": 51, "8": 58, "9": 59, " ": 24, "!": 32, '"': 23, "#": 55, "$": 55, "%": 59, "&": 66, "'": 18, "(": 39, ")": 39, "*": 28, "+": 43, ",": 20, "-": 31, ".": 20, "/": 38, ":": 26, ";": 23, "<": 37, "=": 44, ">": 37, "?": 54, "@": 61, "A": 56, "B": 63, "C": 56, "D": 60, "E": 60, "F": 58, "G": 58, "H": 63, "I": 33, "J": 55, "K": 58, "L": 53, "M": 72, "N": 65, "O": 59, "P": 60, "Q": 59, "R": 61, "S": 58, "T": 62, "U": 58, "V": 56, "W": 79, "X": 58, "Y": 58, "Z": 59, "[": 34, "\\": 38, "]": 34, "^": 26, "_": 39, "`": 19, "{": 27, "|": 11, "}": 27, "~": 30, "\xB0": 27 } } };
|
|
1549
|
+
|
|
1550
|
+
// src/ai/tools.ts
|
|
1551
|
+
var import_zod13 = require("zod");
|
|
1552
|
+
var telemetryGraphParameters = import_zod13.z.object({
|
|
1553
|
+
deviceId: import_zod13.z.string().min(1, "Device ID is required"),
|
|
1554
|
+
timeRange: import_zod13.z.enum(["1h", "24h", "7d"], {
|
|
1289
1555
|
errorMap: () => ({ message: "Time range must be 1h, 24h, or 7d" })
|
|
1290
1556
|
}),
|
|
1291
|
-
metrics:
|
|
1292
|
-
|
|
1557
|
+
metrics: import_zod13.z.array(
|
|
1558
|
+
import_zod13.z.enum(["temperature", "humidity", "vwc", "ec", "ph", "pressure", "co2"])
|
|
1293
1559
|
).min(1, "At least one metric is required").max(4, "Maximum 4 metrics per graph")
|
|
1294
1560
|
});
|
|
1295
|
-
var stockChartParameters = import_zod10.z.object({
|
|
1296
|
-
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')."),
|
|
1297
|
-
timeRange: import_zod10.z.enum(["1D", "1W", "1M", "1Y"], {
|
|
1298
|
-
errorMap: () => ({ message: "Time range must be 1D, 1W, 1M, or 1Y" })
|
|
1299
|
-
}).describe("The time range for the chart. Choose based on user request or default to '1M'."),
|
|
1300
|
-
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.")
|
|
1301
|
-
});
|
|
1302
|
-
var tickerParam = import_zod10.z.string().min(1).describe("The stock ticker symbol (e.g., 'AAPL', 'TSLA', 'MSFT').");
|
|
1303
|
-
var liveQuoteParameters = import_zod10.z.object({ ticker: tickerParam });
|
|
1304
|
-
var companyNewsParameters = import_zod10.z.object({ ticker: tickerParam });
|
|
1305
|
-
var companyProfileParameters = import_zod10.z.object({ ticker: tickerParam });
|
|
1306
|
-
var counterpartyGraphParameters = import_zod10.z.object({
|
|
1307
|
-
ticker: tickerParam,
|
|
1308
|
-
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.")
|
|
1309
|
-
});
|
|
1310
|
-
var divergenceMetricsParameters = import_zod10.z.object({ ticker: tickerParam });
|
|
1311
|
-
var architectureReferenceParameters = import_zod10.z.object({});
|
|
1312
1561
|
var AI_TOOLS = {
|
|
1313
1562
|
get_telemetry_graph: {
|
|
1314
1563
|
name: "get_telemetry_graph",
|
|
1315
1564
|
description: "Displays an interactive line chart of historical sensor telemetry data. Use this when the user asks to visualize trends, compare metrics over time, or analyze device performance. Supports temperature, humidity, VWC (volumetric water content), EC (electrical conductivity), pH, pressure, and CO2.",
|
|
1316
|
-
parameters: telemetryGraphParameters
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
},
|
|
1323
|
-
get_live_quote: {
|
|
1324
|
-
name: "get_live_quote",
|
|
1325
|
-
description: "Fetches and displays the real-time stock price and daily change percentage for a given company ticker symbol.",
|
|
1326
|
-
parameters: liveQuoteParameters
|
|
1327
|
-
},
|
|
1328
|
-
get_company_news: {
|
|
1329
|
-
name: "get_company_news",
|
|
1330
|
-
description: "Fetches and displays the 5 most recent news headlines and sentiment impact scores for a given company ticker symbol.",
|
|
1331
|
-
parameters: companyNewsParameters
|
|
1332
|
-
},
|
|
1333
|
-
get_company_profile: {
|
|
1334
|
-
name: "get_company_profile",
|
|
1335
|
-
description: "Fetches fundamental company data including the business description, sector, industry, market cap, and P/E ratio.",
|
|
1336
|
-
parameters: companyProfileParameters
|
|
1337
|
-
},
|
|
1338
|
-
get_counterparty_graph: {
|
|
1339
|
-
name: "get_counterparty_graph",
|
|
1340
|
-
description: "Displays the inferred counterparty relationship graph for a company \u2014 suppliers, customers, partners, competitors, regulators, and investment/acquisition relationships that Fleet-Brain-Deep has extracted from alternative signals. Use this when the user asks about a company's business relationships, supply chain, competitors, or who it partners/invests with. Not for corporate ownership structure (parent/subsidiary) \u2014 use company profile data for that.",
|
|
1341
|
-
parameters: counterpartyGraphParameters
|
|
1342
|
-
},
|
|
1343
|
-
get_divergence_metrics: {
|
|
1344
|
-
name: "get_divergence_metrics",
|
|
1345
|
-
description: "Displays Fleet-Brain-Deep's operational and customer divergence scores for a company \u2014 a signed delta between expected (baseline) and observed performance, inferred from recent signals. Use this when the user asks whether something is going better or worse than expected operationally or from a customer-experience standpoint.",
|
|
1346
|
-
parameters: divergenceMetricsParameters
|
|
1347
|
-
},
|
|
1348
|
-
get_architecture_reference: {
|
|
1349
|
-
name: "get_architecture_reference",
|
|
1350
|
-
description: "Explains THIS PLATFORM'S OWN data architecture \u2014 its tech stack, database schema and data modeling, AI/LLM integration points, and background worker (sentinel) fleet. Use this for questions about how the system itself is built, not about a company or the market. Takes no parameters.",
|
|
1351
|
-
parameters: architectureReferenceParameters
|
|
1565
|
+
parameters: telemetryGraphParameters,
|
|
1566
|
+
promptParameters: `{
|
|
1567
|
+
"deviceId": "string (required)",
|
|
1568
|
+
"timeRange": "enum: '1h' | '24h' | '7d' (required)",
|
|
1569
|
+
"metrics": "array of enum: 'temperature' | 'humidity' | 'vwc' | 'ec' | 'ph' | 'pressure' | 'co2' (1-4 items required)"
|
|
1570
|
+
}`
|
|
1352
1571
|
}
|
|
1353
1572
|
};
|
|
1354
1573
|
|
|
@@ -1579,7 +1798,12 @@ BLOCKS \u2014 up to 12, drawn top to bottom. Each is one of:
|
|
|
1579
1798
|
A row splits the width into equal cells. Add "pack": true and each child takes
|
|
1580
1799
|
only its own width, "gap" apart \u2014 a number with its icon right beside it, or
|
|
1581
1800
|
"H 68\xB0 L 56\xB0" as one line. Put "valign": "center" at the top level of the
|
|
1582
|
-
document to centre the blocks on the screen rather than start at the top
|
|
1801
|
+
document to centre the blocks on the screen rather than start at the top, and
|
|
1802
|
+
"font": "pixel" for chunky retro lettering or "font": "tay" for the Ramme
|
|
1803
|
+
display face, all capitals, good for signs and big numbers (the default is a
|
|
1804
|
+
smooth plain face), and
|
|
1805
|
+
"halign": "center" to centre them across it \u2014 the lines keep their own
|
|
1806
|
+
alignment inside a column as wide as the widest, and the column is centred.
|
|
1583
1807
|
|
|
1584
1808
|
AN ICON is the sky drawn in outline: "sun", "partly", "cloud", "fog", "rain",
|
|
1585
1809
|
"snow" or "storm". Bind its value to a weather source's "icon" field so it
|
|
@@ -1679,6 +1903,14 @@ SOURCES \u2014 declare what the app reads, then bind to it by name:
|
|
|
1679
1903
|
For things that take turns: give each block "hideWhen": { "value":
|
|
1680
1904
|
{ "source": "turn", "field": "index" }, "op": "!=", "than": N } so only
|
|
1681
1905
|
block N shows on turn N. The board changes at most once a minute.
|
|
1906
|
+
"probe": { "kind": "board", "units": "imperial" }
|
|
1907
|
+
fields: temperature, connected
|
|
1908
|
+
What a sensor plugged into the board itself is reading: a temperature
|
|
1909
|
+
probe's temperature, a whole number in units, updated about once a
|
|
1910
|
+
second. connected is false when nothing is plugged in, and temperature
|
|
1911
|
+
is then missing (it draws "--"): use hideWhen on connected to show
|
|
1912
|
+
"Plug in the probe" instead. Use this, not weather, for "my sensor",
|
|
1913
|
+
"the probe", "water temperature" and the like.
|
|
1682
1914
|
|
|
1683
1915
|
RULES
|
|
1684
1916
|
|
|
@@ -1698,12 +1930,12 @@ RULES
|
|
|
1698
1930
|
var APP_DOCUMENT_EDIT_PREFIX = "Here is the current app. Change only what is asked:";
|
|
1699
1931
|
|
|
1700
1932
|
// src/theme/schema.ts
|
|
1701
|
-
var
|
|
1702
|
-
var RGBString =
|
|
1933
|
+
var import_zod14 = require("zod");
|
|
1934
|
+
var RGBString = import_zod14.z.string().regex(
|
|
1703
1935
|
/^\d{1,3}\s+\d{1,3}\s+\d{1,3}$/,
|
|
1704
1936
|
'Must be space-separated RGB integers (e.g. "13 110 253")'
|
|
1705
1937
|
);
|
|
1706
|
-
var ThemeOverridesSchema =
|
|
1938
|
+
var ThemeOverridesSchema = import_zod14.z.object({
|
|
1707
1939
|
// ── Core Brand ───────────────────────────────────────────────────────────
|
|
1708
1940
|
"--app-primary-color": RGBString.optional(),
|
|
1709
1941
|
"--app-primary-foreground-color": RGBString.optional(),
|
|
@@ -1719,9 +1951,9 @@ var ThemeOverridesSchema = import_zod11.z.object({
|
|
|
1719
1951
|
"--app-muted-bg": RGBString.optional(),
|
|
1720
1952
|
"--app-muted-text": RGBString.optional(),
|
|
1721
1953
|
// ── Shape ────────────────────────────────────────────────────────────────
|
|
1722
|
-
"--app-border-radius-sm":
|
|
1723
|
-
"--app-border-radius-md":
|
|
1724
|
-
"--app-border-radius-lg":
|
|
1954
|
+
"--app-border-radius-sm": import_zod14.z.string().optional(),
|
|
1955
|
+
"--app-border-radius-md": import_zod14.z.string().optional(),
|
|
1956
|
+
"--app-border-radius-lg": import_zod14.z.string().optional(),
|
|
1725
1957
|
// ── Form Controls ────────────────────────────────────────────────────────
|
|
1726
1958
|
"--app-input-bg-color": RGBString.optional(),
|
|
1727
1959
|
"--app-input-text-color": RGBString.optional(),
|
|
@@ -1735,19 +1967,19 @@ var ThemeOverridesSchema = import_zod11.z.object({
|
|
|
1735
1967
|
"--app-chart-4": RGBString.optional(),
|
|
1736
1968
|
"--app-chart-5": RGBString.optional()
|
|
1737
1969
|
}).strict();
|
|
1738
|
-
var ThemeFontsSchema =
|
|
1970
|
+
var ThemeFontsSchema = import_zod14.z.object({
|
|
1739
1971
|
/** Google Font name for headings (h1–h4, .font-serif). Example: "Playfair Display" */
|
|
1740
|
-
heading:
|
|
1972
|
+
heading: import_zod14.z.string(),
|
|
1741
1973
|
/** Google Font name for body text. Example: "Inter" */
|
|
1742
|
-
body:
|
|
1974
|
+
body: import_zod14.z.string(),
|
|
1743
1975
|
/** Optional monospace font. Example: "Roboto Mono" */
|
|
1744
|
-
mono:
|
|
1976
|
+
mono: import_zod14.z.string().optional()
|
|
1745
1977
|
});
|
|
1746
|
-
var AIThemeSchema =
|
|
1978
|
+
var AIThemeSchema = import_zod14.z.object({
|
|
1747
1979
|
/** Short descriptive theme name. Example: "Midnight Garden" */
|
|
1748
|
-
name:
|
|
1980
|
+
name: import_zod14.z.string(),
|
|
1749
1981
|
/** One-sentence vibe description. Example: "Dark indigo with golden accents." */
|
|
1750
|
-
description:
|
|
1982
|
+
description: import_zod14.z.string(),
|
|
1751
1983
|
/** Google Font pairing for heading and body text. */
|
|
1752
1984
|
fonts: ThemeFontsSchema.optional(),
|
|
1753
1985
|
/**
|
|
@@ -1758,13 +1990,13 @@ var AIThemeSchema = import_zod11.z.object({
|
|
|
1758
1990
|
cssVars: ThemeOverridesSchema
|
|
1759
1991
|
});
|
|
1760
1992
|
var THEME_PRESETS = ["light", "dark", "system", "corporate", "midnight", "blueprint"];
|
|
1761
|
-
var ThemeTokensSchema =
|
|
1993
|
+
var ThemeTokensSchema = import_zod14.z.object({
|
|
1762
1994
|
primary: RGBString,
|
|
1763
1995
|
neutral: RGBString,
|
|
1764
1996
|
success: RGBString,
|
|
1765
1997
|
warning: RGBString,
|
|
1766
1998
|
destructive: RGBString,
|
|
1767
|
-
radius:
|
|
1999
|
+
radius: import_zod14.z.enum(["none", "sm", "md", "lg", "full"])
|
|
1768
2000
|
});
|
|
1769
2001
|
var DEFAULT_THEME_TOKENS = {
|
|
1770
2002
|
primary: "13 110 253",
|
|
@@ -1775,82 +2007,355 @@ var DEFAULT_THEME_TOKENS = {
|
|
|
1775
2007
|
radius: "md"
|
|
1776
2008
|
};
|
|
1777
2009
|
|
|
2010
|
+
// src/theme/controls.ts
|
|
2011
|
+
var CONTROL_STATES = ["rest", "pressed", "busy", "disabled", "focused"];
|
|
2012
|
+
var CONTROL_STATE_MEANINGS = {
|
|
2013
|
+
rest: { means: "The control, in the theme\u2019s surface or accent.", web: "default" },
|
|
2014
|
+
pressed: { means: "Lit the moment a finger lands on it.", web: ":active" },
|
|
2015
|
+
busy: { means: "Stays lit while its action runs; nothing else on screen moves.", web: "loading" },
|
|
2016
|
+
disabled: { means: "Muted, and a tap does nothing.", web: "disabled" },
|
|
2017
|
+
focused: { means: "Highlighted by a knob or a key: the control choosing would press.", web: ":focus-visible" }
|
|
2018
|
+
};
|
|
2019
|
+
|
|
2020
|
+
// src/enclosures/schema.ts
|
|
2021
|
+
var import_zod15 = require("zod");
|
|
2022
|
+
var Mm = import_zod15.z.number().finite();
|
|
2023
|
+
var PositiveMm = Mm.positive();
|
|
2024
|
+
var NonNegativeMm = Mm.nonnegative();
|
|
2025
|
+
var PrinterProfileSchema = import_zod15.z.object({
|
|
2026
|
+
name: import_zod15.z.string().min(1).default("Bambu Lab X1 Carbon"),
|
|
2027
|
+
/** Walls are whole multiples of this. */
|
|
2028
|
+
nozzle: PositiveMm.default(0.4),
|
|
2029
|
+
/** Gap for parts that slide together: the case's lip, a lid. */
|
|
2030
|
+
clearance_slip: NonNegativeMm.default(0.2),
|
|
2031
|
+
/** Gap for a friction fit. */
|
|
2032
|
+
clearance_press: NonNegativeMm.default(0.1)
|
|
2033
|
+
});
|
|
2034
|
+
var EdgeSchema = import_zod15.z.enum(["east", "west", "north", "south", "top", "bottom"]);
|
|
2035
|
+
var FlexButtonSchema = import_zod15.z.object({
|
|
2036
|
+
/** The tongue's length, from its free end to where it joins the floor. */
|
|
2037
|
+
length: PositiveMm.default(12),
|
|
2038
|
+
/** Its width. */
|
|
2039
|
+
width: PositiveMm.default(5),
|
|
2040
|
+
/** The way from the switch to where the tongue joins the floor. */
|
|
2041
|
+
hinge: import_zod15.z.enum(["east", "west", "north", "south"])
|
|
2042
|
+
});
|
|
2043
|
+
var InterfaceSchema = import_zod15.z.object({
|
|
2044
|
+
/** usb_c, screen, reset_button, status_led, sd_card… */
|
|
2045
|
+
name: import_zod15.z.string().min(1),
|
|
2046
|
+
edge: EdgeSchema,
|
|
2047
|
+
/** From the centre of that face — see COORDINATES above. */
|
|
2048
|
+
offset_from_center: import_zod15.z.tuple([Mm, Mm]).default([0, 0]),
|
|
2049
|
+
/**
|
|
2050
|
+
* A grille is a field of small round holes filling an ellipse of
|
|
2051
|
+
* `cutout_size` — a speaker's — on a top or bottom face only.
|
|
2052
|
+
*/
|
|
2053
|
+
cutout_shape: import_zod15.z.enum(["rect", "rounded_rect", "circle", "grille"]),
|
|
2054
|
+
/** [width, height] of the opening, including room for a plug's boot. A circle uses the first as its diameter. */
|
|
2055
|
+
cutout_size: import_zod15.z.tuple([PositiveMm, PositiveMm]),
|
|
2056
|
+
/** How far the part sticks out past the component's edge. */
|
|
2057
|
+
protrusion: NonNegativeMm.default(0),
|
|
2058
|
+
/** A wider recess on the outside face, [width, height, depth], for a thick cable boot. */
|
|
2059
|
+
outer_recess: import_zod15.z.tuple([PositiveMm, PositiveMm, PositiveMm]).optional(),
|
|
2060
|
+
/** Press it through the floor instead of opening a hole — see FlexButtonSchema. */
|
|
2061
|
+
flex_button: FlexButtonSchema.optional(),
|
|
2062
|
+
/**
|
|
2063
|
+
* A 45° ramp this deep round the opening at the outside face, widening it
|
|
2064
|
+
* by this much a side there. For a screen set back behind a bezel: the
|
|
2065
|
+
* picture's edges stay in view and a fingertip reaches them. Top or bottom
|
|
2066
|
+
* openings only.
|
|
2067
|
+
*/
|
|
2068
|
+
chamfer: NonNegativeMm.optional()
|
|
2069
|
+
});
|
|
2070
|
+
var MountHolesSchema = import_zod15.z.object({
|
|
2071
|
+
/** Four holes, this far in from each corner: [east-west, north-south]. */
|
|
2072
|
+
inset_from_corners: import_zod15.z.tuple([PositiveMm, PositiveMm]).optional(),
|
|
2073
|
+
/** Or exactly where they are: [east, north] from the footprint centre. */
|
|
2074
|
+
positions: import_zod15.z.array(import_zod15.z.tuple([Mm, Mm])).min(1).optional(),
|
|
2075
|
+
thread: import_zod15.z.enum(["M2", "M2.5", "M3"]),
|
|
2076
|
+
/** Heat-set insert outer diameter and depth. split_shell_lip only: tray_bezel's screws cut their own thread. */
|
|
2077
|
+
insert_od: PositiveMm.optional(),
|
|
2078
|
+
insert_depth: PositiveMm.optional()
|
|
2079
|
+
}).refine((m) => (m.inset_from_corners ? 1 : 0) + (m.positions ? 1 : 0) === 1, {
|
|
2080
|
+
message: "give either inset_from_corners or positions, not both or neither"
|
|
2081
|
+
});
|
|
2082
|
+
var PlacementSchema = import_zod15.z.object({
|
|
2083
|
+
relative_to: import_zod15.z.string().min(1),
|
|
2084
|
+
where: import_zod15.z.enum(["below", "above", "east", "west", "north", "south"]),
|
|
2085
|
+
/** Space between the two keep-outs. */
|
|
2086
|
+
gap: NonNegativeMm.default(1),
|
|
2087
|
+
/** Moved this far [east, north] from centred on the other, once placed. */
|
|
2088
|
+
offset: import_zod15.z.tuple([Mm, Mm]).default([0, 0])
|
|
2089
|
+
});
|
|
2090
|
+
var ComponentSchema = import_zod15.z.object({
|
|
2091
|
+
id: import_zod15.z.string().regex(/^[a-z][a-z0-9_]*$/, "lowercase letters, digits and underscores"),
|
|
2092
|
+
type: import_zod15.z.enum(["pcb", "display", "battery", "speaker", "module"]),
|
|
2093
|
+
/** [east, north, up] — see COORDINATES. */
|
|
2094
|
+
dimensions: import_zod15.z.tuple([PositiveMm, PositiveMm, PositiveMm]),
|
|
2095
|
+
/**
|
|
2096
|
+
* Radius of the footprint's corners: most boards are rounded. The case's
|
|
2097
|
+
* inside corners follow it, so a rounded board gets a rounded tray without
|
|
2098
|
+
* the tray growing wider. Leave it at 0 for a square one, or when unsure —
|
|
2099
|
+
* assuming sharper than the part is safe, rounder is not.
|
|
2100
|
+
*/
|
|
2101
|
+
corner_radius: NonNegativeMm.default(0),
|
|
2102
|
+
/** Height of the tallest part on top (headers, capacitors, a connector), kept clear. */
|
|
2103
|
+
clearance_z_top: NonNegativeMm.default(0),
|
|
2104
|
+
/** Height of what is underneath (solder joints, a microSD socket), kept clear. */
|
|
2105
|
+
clearance_z_bottom: NonNegativeMm.default(0),
|
|
2106
|
+
/** Quarter turns about Z, applied before placement. */
|
|
2107
|
+
rotation: import_zod15.z.union([import_zod15.z.literal(0), import_zod15.z.literal(90), import_zod15.z.literal(180), import_zod15.z.literal(270)]).default(0),
|
|
2108
|
+
placement: PlacementSchema.optional(),
|
|
2109
|
+
mount_holes: MountHolesSchema.optional(),
|
|
2110
|
+
interfaces: import_zod15.z.array(InterfaceSchema).default([]),
|
|
2111
|
+
/** How it is held if it has no screw holes. */
|
|
2112
|
+
retention: import_zod15.z.enum(["none", "cradle_ribs"]).default("none")
|
|
2113
|
+
});
|
|
2114
|
+
var EmblemSchema = import_zod15.z.object({
|
|
2115
|
+
/** The SVG file, relative to the manifest. Filled paths only; strokes are ignored. */
|
|
2116
|
+
svg: import_zod15.z.string().min(1),
|
|
2117
|
+
face: import_zod15.z.enum(["top", "bottom"]).default("bottom"),
|
|
2118
|
+
/** Height of the mark on the face, along north. Its width follows the SVG's proportions. */
|
|
2119
|
+
height: PositiveMm,
|
|
2120
|
+
/** How deep it is pressed in. */
|
|
2121
|
+
depth: PositiveMm.default(0.6),
|
|
2122
|
+
/** From the centre of the case's footprint, [east, north]. */
|
|
2123
|
+
offset: import_zod15.z.tuple([Mm, Mm]).default([0, 0]),
|
|
2124
|
+
/**
|
|
2125
|
+
* Cut it right through the face instead, as a stencil — a speaker's grille
|
|
2126
|
+
* in the shape of the mark. Whatever its lines enclose would fall out, so
|
|
2127
|
+
* each enclosed piece is held by bridges across a line: give them here, in
|
|
2128
|
+
* millimetres from the mark's centre as it reads (y up), each turned
|
|
2129
|
+
* `angle` degrees from running east-west. Pieces too small to hold
|
|
2130
|
+
* (STENCIL_SPECK) are cut away; a larger one with no bridge fails the fit
|
|
2131
|
+
* check, by where it is.
|
|
2132
|
+
*/
|
|
2133
|
+
stencil: import_zod15.z.object({
|
|
2134
|
+
bridges: import_zod15.z.array(import_zod15.z.object({ at: import_zod15.z.tuple([Mm, Mm]), angle: import_zod15.z.number().default(0), length: PositiveMm.default(3) })).default([])
|
|
2135
|
+
}).optional()
|
|
2136
|
+
});
|
|
2137
|
+
var HardwareManifestSchema = import_zod15.z.object({
|
|
2138
|
+
project: import_zod15.z.string().regex(/^[a-z0-9][a-z0-9_-]*$/, "lowercase, digits, - and _"),
|
|
2139
|
+
/** How the case goes together — see TWO STYLES above. */
|
|
2140
|
+
enclosure_style: import_zod15.z.enum(["split_shell_lip", "tray_bezel"]).default("split_shell_lip"),
|
|
2141
|
+
wall_thickness: PositiveMm.default(2.4),
|
|
2142
|
+
/**
|
|
2143
|
+
* Thicker walls on chosen sides, in place of `wall_thickness` there. A
|
|
2144
|
+
* screen whose glass is as wide as its board otherwise gets 2.4mm of frame
|
|
2145
|
+
* along its sides and 11mm at its ends, which looks off balance (the
|
|
2146
|
+
* black ESP32-S3 board's flush case, 2026-10-25). Each is a whole number
|
|
2147
|
+
* of nozzle lines, and no thinner than `wall_thickness`.
|
|
2148
|
+
*/
|
|
2149
|
+
walls: import_zod15.z.object({ east: PositiveMm, west: PositiveMm, north: PositiveMm, south: PositiveMm }).partial().default({}),
|
|
2150
|
+
/** Radius of the vertical outside corners. */
|
|
2151
|
+
corner_radius: NonNegativeMm.default(2),
|
|
2152
|
+
/**
|
|
2153
|
+
* The outside's front and back edges — where the face meets the sides.
|
|
2154
|
+
* `chamfer` bevels them flat at 45°, `round` rounds them; `soften` then
|
|
2155
|
+
* rounds every edge the bevel leaves, so nothing on the outside is sharp.
|
|
2156
|
+
* Without it they are square, and a case reads as a printed box.
|
|
2157
|
+
*/
|
|
2158
|
+
edges: import_zod15.z.object({
|
|
2159
|
+
style: import_zod15.z.enum(["chamfer", "round"]),
|
|
2160
|
+
size: PositiveMm,
|
|
2161
|
+
soften: NonNegativeMm.default(0)
|
|
2162
|
+
}).optional(),
|
|
2163
|
+
printer: PrinterProfileSchema.default({}),
|
|
2164
|
+
components: import_zod15.z.array(ComponentSchema).min(1),
|
|
2165
|
+
emblem: EmblemSchema.optional()
|
|
2166
|
+
}).superRefine((m, ctx) => {
|
|
2167
|
+
const lines = m.wall_thickness / m.printer.nozzle;
|
|
2168
|
+
if (Math.abs(lines - Math.round(lines)) > 1e-6) {
|
|
2169
|
+
ctx.addIssue({
|
|
2170
|
+
code: import_zod15.z.ZodIssueCode.custom,
|
|
2171
|
+
path: ["wall_thickness"],
|
|
2172
|
+
message: `${m.wall_thickness}mm is not a whole number of ${m.printer.nozzle}mm lines \u2014 try ${(Math.round(lines) * m.printer.nozzle).toFixed(2)}`
|
|
2173
|
+
});
|
|
2174
|
+
}
|
|
2175
|
+
for (const [side, t] of Object.entries(m.walls)) {
|
|
2176
|
+
if (t === void 0) continue;
|
|
2177
|
+
const n = t / m.printer.nozzle;
|
|
2178
|
+
if (Math.abs(n - Math.round(n)) > 1e-6) {
|
|
2179
|
+
ctx.addIssue({
|
|
2180
|
+
code: import_zod15.z.ZodIssueCode.custom,
|
|
2181
|
+
path: ["walls", side],
|
|
2182
|
+
message: `${t}mm is not a whole number of ${m.printer.nozzle}mm lines \u2014 try ${(Math.round(n) * m.printer.nozzle).toFixed(2)}`
|
|
2183
|
+
});
|
|
2184
|
+
}
|
|
2185
|
+
if (t < m.wall_thickness) {
|
|
2186
|
+
ctx.addIssue({
|
|
2187
|
+
code: import_zod15.z.ZodIssueCode.custom,
|
|
2188
|
+
path: ["walls", side],
|
|
2189
|
+
message: `${t}mm is thinner than wall_thickness (${m.wall_thickness}mm): walls only thicken on chosen sides`
|
|
2190
|
+
});
|
|
2191
|
+
}
|
|
2192
|
+
}
|
|
2193
|
+
const ids = m.components.map((c) => c.id);
|
|
2194
|
+
ids.forEach((id, i) => {
|
|
2195
|
+
if (ids.indexOf(id) !== i) {
|
|
2196
|
+
ctx.addIssue({ code: import_zod15.z.ZodIssueCode.custom, path: ["components", i, "id"], message: `"${id}" is used twice` });
|
|
2197
|
+
}
|
|
2198
|
+
});
|
|
2199
|
+
const roots = m.components.filter((c) => !c.placement);
|
|
2200
|
+
if (roots.length !== 1) {
|
|
2201
|
+
ctx.addIssue({
|
|
2202
|
+
code: import_zod15.z.ZodIssueCode.custom,
|
|
2203
|
+
path: ["components"],
|
|
2204
|
+
message: `exactly one component must have no placement (the origin); found ${roots.length}: ${roots.map((r) => r.id).join(", ") || "none"}`
|
|
2205
|
+
});
|
|
2206
|
+
}
|
|
2207
|
+
const byId = new Map(m.components.map((c) => [c.id, c]));
|
|
2208
|
+
m.components.forEach((c, i) => {
|
|
2209
|
+
if (!c.placement) return;
|
|
2210
|
+
const target = c.placement.relative_to;
|
|
2211
|
+
if (!byId.has(target)) {
|
|
2212
|
+
ctx.addIssue({ code: import_zod15.z.ZodIssueCode.custom, path: ["components", i, "placement", "relative_to"], message: `no component "${target}"` });
|
|
2213
|
+
return;
|
|
2214
|
+
}
|
|
2215
|
+
const seen = /* @__PURE__ */ new Set([c.id]);
|
|
2216
|
+
for (let at = byId.get(target); at?.placement; at = byId.get(at.placement.relative_to)) {
|
|
2217
|
+
if (seen.has(at.id)) {
|
|
2218
|
+
ctx.addIssue({ code: import_zod15.z.ZodIssueCode.custom, path: ["components", i, "placement"], message: `placement loops back to "${at.id}"` });
|
|
2219
|
+
return;
|
|
2220
|
+
}
|
|
2221
|
+
seen.add(at.id);
|
|
2222
|
+
}
|
|
2223
|
+
});
|
|
2224
|
+
m.components.forEach((c, i) => {
|
|
2225
|
+
if (m.enclosure_style === "split_shell_lip" && c.mount_holes && (!c.mount_holes.insert_od || !c.mount_holes.insert_depth)) {
|
|
2226
|
+
ctx.addIssue({ code: import_zod15.z.ZodIssueCode.custom, path: ["components", i, "mount_holes"], message: "a split_shell_lip case holds boards on heat-set inserts: give insert_od and insert_depth" });
|
|
2227
|
+
}
|
|
2228
|
+
c.interfaces.forEach((f, j) => {
|
|
2229
|
+
if (f.chamfer && f.edge !== "top" && f.edge !== "bottom") {
|
|
2230
|
+
ctx.addIssue({ code: import_zod15.z.ZodIssueCode.custom, path: ["components", i, "interfaces", j, "chamfer"], message: `a chamfer ramps an opening in the bezel or the floor: its edge must be top or bottom, not ${f.edge}` });
|
|
2231
|
+
}
|
|
2232
|
+
if (f.cutout_shape === "grille" && f.edge !== "top" && f.edge !== "bottom") {
|
|
2233
|
+
ctx.addIssue({ code: import_zod15.z.ZodIssueCode.custom, path: ["components", i, "interfaces", j, "cutout_shape"], message: `a grille is a field of holes in the bezel or the floor: its edge must be top or bottom, not ${f.edge}` });
|
|
2234
|
+
}
|
|
2235
|
+
if (f.flex_button && f.edge !== "bottom") {
|
|
2236
|
+
ctx.addIssue({ code: import_zod15.z.ZodIssueCode.custom, path: ["components", i, "interfaces", j, "flex_button"], message: `a flex button is pressed through the floor: its edge must be bottom, not ${f.edge}` });
|
|
2237
|
+
}
|
|
2238
|
+
});
|
|
2239
|
+
const [x, y] = c.dimensions;
|
|
2240
|
+
c.mount_holes?.positions?.forEach((p, j) => {
|
|
2241
|
+
if (Math.abs(p[0]) > x / 2 || Math.abs(p[1]) > y / 2) {
|
|
2242
|
+
ctx.addIssue({ code: import_zod15.z.ZodIssueCode.custom, path: ["components", i, "mount_holes", "positions", j], message: `hole at [${p}] is outside the ${x}\xD7${y} footprint` });
|
|
2243
|
+
}
|
|
2244
|
+
});
|
|
2245
|
+
const inset = c.mount_holes?.inset_from_corners;
|
|
2246
|
+
if (inset && (inset[0] * 2 >= x || inset[1] * 2 >= y)) {
|
|
2247
|
+
ctx.addIssue({ code: import_zod15.z.ZodIssueCode.custom, path: ["components", i, "mount_holes", "inset_from_corners"], message: `insets [${inset}] meet in the middle of a ${x}\xD7${y} footprint` });
|
|
2248
|
+
}
|
|
2249
|
+
});
|
|
2250
|
+
});
|
|
2251
|
+
var FamilyChoiceSchema = import_zod15.z.object({
|
|
2252
|
+
label: import_zod15.z.string().min(1),
|
|
2253
|
+
/** One sentence: what it is for. */
|
|
2254
|
+
description: import_zod15.z.string().optional(),
|
|
2255
|
+
/** Components added to the base manifest's. */
|
|
2256
|
+
components: import_zod15.z.array(ComponentSchema).default([]),
|
|
2257
|
+
/** Top-level manifest fields this choice sets: wall_thickness, emblem… */
|
|
2258
|
+
set: import_zod15.z.record(import_zod15.z.unknown()).default({}),
|
|
2259
|
+
/**
|
|
2260
|
+
* Changes to the base's own components, by id: fields to set, null to
|
|
2261
|
+
* remove one, and `interfaces` by name the same way — a null interface is
|
|
2262
|
+
* removed, an unknown one added. How a flush top lowers the board's
|
|
2263
|
+
* clearance and widens its screen opening to the glass.
|
|
2264
|
+
*/
|
|
2265
|
+
patch: import_zod15.z.record(import_zod15.z.record(import_zod15.z.unknown())).default({})
|
|
2266
|
+
});
|
|
2267
|
+
var FamilyOptionSchema = import_zod15.z.object({
|
|
2268
|
+
label: import_zod15.z.string().min(1),
|
|
2269
|
+
/** In order; the first is the default. Ids are lowercase words and dashes. */
|
|
2270
|
+
choices: import_zod15.z.array(FamilyChoiceSchema.extend({ id: import_zod15.z.string().regex(/^[a-z0-9][a-z0-9-]*$/) })).min(1)
|
|
2271
|
+
});
|
|
2272
|
+
var CaseFamilySchema = import_zod15.z.object({
|
|
2273
|
+
/** The base manifest, relative to this file. */
|
|
2274
|
+
manifest: import_zod15.z.string().min(1),
|
|
2275
|
+
/** Option groups, in the order they are offered: base, top… */
|
|
2276
|
+
options: import_zod15.z.record(import_zod15.z.string().regex(/^[a-z][a-z0-9-]*$/), FamilyOptionSchema)
|
|
2277
|
+
});
|
|
2278
|
+
|
|
1778
2279
|
// src/auth/schema.ts
|
|
1779
|
-
var
|
|
1780
|
-
var UserSchema =
|
|
1781
|
-
id:
|
|
1782
|
-
name:
|
|
1783
|
-
email:
|
|
1784
|
-
password:
|
|
1785
|
-
role:
|
|
1786
|
-
status:
|
|
1787
|
-
joinedAt:
|
|
1788
|
-
lastActive:
|
|
1789
|
-
avatarUrl:
|
|
2280
|
+
var import_zod16 = require("zod");
|
|
2281
|
+
var UserSchema = import_zod16.z.object({
|
|
2282
|
+
id: import_zod16.z.string().default(""),
|
|
2283
|
+
name: import_zod16.z.string(),
|
|
2284
|
+
email: import_zod16.z.string().email(),
|
|
2285
|
+
password: import_zod16.z.string().optional(),
|
|
2286
|
+
role: import_zod16.z.string(),
|
|
2287
|
+
status: import_zod16.z.string().optional(),
|
|
2288
|
+
joinedAt: import_zod16.z.string().optional(),
|
|
2289
|
+
lastActive: import_zod16.z.string().optional(),
|
|
2290
|
+
avatarUrl: import_zod16.z.string().optional()
|
|
1790
2291
|
});
|
|
1791
2292
|
|
|
1792
2293
|
// src/auth/accounts.ts
|
|
1793
|
-
var
|
|
1794
|
-
var AccountIdSchema =
|
|
1795
|
-
var AccountRoleSchema =
|
|
1796
|
-
var AccountStatusSchema =
|
|
1797
|
-
var ScryptHashSchema =
|
|
1798
|
-
algo:
|
|
1799
|
-
n:
|
|
1800
|
-
r:
|
|
1801
|
-
p:
|
|
1802
|
-
keylen:
|
|
1803
|
-
salt:
|
|
1804
|
-
hash:
|
|
1805
|
-
});
|
|
1806
|
-
var AccountRecordSchema =
|
|
2294
|
+
var import_zod17 = require("zod");
|
|
2295
|
+
var AccountIdSchema = import_zod17.z.string().regex(/^acct_[0-9a-f]{12}$/, "acct_ and 12 hex digits");
|
|
2296
|
+
var AccountRoleSchema = import_zod17.z.enum(["member", "admin"]);
|
|
2297
|
+
var AccountStatusSchema = import_zod17.z.enum(["active", "suspended"]);
|
|
2298
|
+
var ScryptHashSchema = import_zod17.z.object({
|
|
2299
|
+
algo: import_zod17.z.literal("scrypt"),
|
|
2300
|
+
n: import_zod17.z.number().int().positive(),
|
|
2301
|
+
r: import_zod17.z.number().int().positive(),
|
|
2302
|
+
p: import_zod17.z.number().int().positive(),
|
|
2303
|
+
keylen: import_zod17.z.number().int().positive(),
|
|
2304
|
+
salt: import_zod17.z.string().min(16),
|
|
2305
|
+
hash: import_zod17.z.string().min(16)
|
|
2306
|
+
});
|
|
2307
|
+
var AccountRecordSchema = import_zod17.z.object({
|
|
1807
2308
|
accountId: AccountIdSchema,
|
|
1808
2309
|
/** Lowercased on write, because a login must not depend on how it was typed. */
|
|
1809
|
-
email:
|
|
1810
|
-
name:
|
|
2310
|
+
email: import_zod17.z.string().email().max(254),
|
|
2311
|
+
name: import_zod17.z.string().min(1).max(64),
|
|
1811
2312
|
role: AccountRoleSchema,
|
|
1812
2313
|
status: AccountStatusSchema,
|
|
1813
2314
|
password: ScryptHashSchema,
|
|
1814
|
-
createdAt:
|
|
1815
|
-
lastLoginAt:
|
|
2315
|
+
createdAt: import_zod17.z.number().int().nonnegative(),
|
|
2316
|
+
lastLoginAt: import_zod17.z.number().int().nonnegative().nullable().default(null),
|
|
1816
2317
|
/** Which admin approved this, or null for the bootstrap account. */
|
|
1817
2318
|
invitedBy: AccountIdSchema.nullable().default(null)
|
|
1818
2319
|
});
|
|
1819
|
-
var
|
|
2320
|
+
var DISPLAY_NAME_MAX = 40;
|
|
2321
|
+
var DisplayNameSchema = import_zod17.z.string().transform((s) => s.trim().replace(/\s+/g, " ")).pipe(
|
|
2322
|
+
import_zod17.z.string().min(1, "Give a name.").max(DISPLAY_NAME_MAX, `At most ${DISPLAY_NAME_MAX} characters.`).refine((s) => !/[\u0000-\u001f\u007f-\u009f\u200b-\u200f\u2028-\u202e\u2066-\u2069]/.test(s), "Letters, numbers, spaces and punctuation only.")
|
|
2323
|
+
);
|
|
2324
|
+
var PublicAccountSchema = import_zod17.z.object({
|
|
1820
2325
|
accountId: AccountIdSchema,
|
|
1821
|
-
email:
|
|
1822
|
-
name:
|
|
2326
|
+
email: import_zod17.z.string().email(),
|
|
2327
|
+
name: import_zod17.z.string(),
|
|
1823
2328
|
role: AccountRoleSchema,
|
|
1824
2329
|
status: AccountStatusSchema
|
|
1825
2330
|
});
|
|
1826
|
-
var SessionRecordSchema =
|
|
2331
|
+
var SessionRecordSchema = import_zod17.z.object({
|
|
1827
2332
|
accountId: AccountIdSchema,
|
|
1828
|
-
createdAt:
|
|
1829
|
-
expiresAt:
|
|
1830
|
-
lastSeenAt:
|
|
2333
|
+
createdAt: import_zod17.z.number().int().nonnegative(),
|
|
2334
|
+
expiresAt: import_zod17.z.number().int().nonnegative(),
|
|
2335
|
+
lastSeenAt: import_zod17.z.number().int().nonnegative()
|
|
1831
2336
|
});
|
|
1832
|
-
var InviteRecordSchema =
|
|
1833
|
-
email:
|
|
2337
|
+
var InviteRecordSchema = import_zod17.z.object({
|
|
2338
|
+
email: import_zod17.z.string().email().max(254),
|
|
1834
2339
|
role: AccountRoleSchema,
|
|
1835
|
-
createdAt:
|
|
1836
|
-
expiresAt:
|
|
2340
|
+
createdAt: import_zod17.z.number().int().nonnegative(),
|
|
2341
|
+
expiresAt: import_zod17.z.number().int().nonnegative(),
|
|
1837
2342
|
invitedBy: AccountIdSchema
|
|
1838
2343
|
});
|
|
1839
|
-
var AccessRequestSchema =
|
|
1840
|
-
email:
|
|
1841
|
-
name:
|
|
2344
|
+
var AccessRequestSchema = import_zod17.z.object({
|
|
2345
|
+
email: import_zod17.z.string().email().max(254),
|
|
2346
|
+
name: import_zod17.z.string().min(1).max(64),
|
|
1842
2347
|
/** Optional, and never shown publicly. Long enough to be useful, short enough not to be an essay. */
|
|
1843
|
-
reason:
|
|
1844
|
-
});
|
|
1845
|
-
var AccessRequestStatusSchema =
|
|
1846
|
-
var AccessRequestRecordSchema =
|
|
1847
|
-
requestId:
|
|
1848
|
-
email:
|
|
1849
|
-
name:
|
|
1850
|
-
reason:
|
|
2348
|
+
reason: import_zod17.z.string().max(500).optional()
|
|
2349
|
+
});
|
|
2350
|
+
var AccessRequestStatusSchema = import_zod17.z.enum(["pending", "approved", "denied"]);
|
|
2351
|
+
var AccessRequestRecordSchema = import_zod17.z.object({
|
|
2352
|
+
requestId: import_zod17.z.string().regex(/^req_[0-9a-f]{12}$/, "req_ and 12 hex digits"),
|
|
2353
|
+
email: import_zod17.z.string().email().max(254),
|
|
2354
|
+
name: import_zod17.z.string().min(1).max(64),
|
|
2355
|
+
reason: import_zod17.z.string().max(500).optional(),
|
|
1851
2356
|
status: AccessRequestStatusSchema,
|
|
1852
|
-
createdAt:
|
|
1853
|
-
decidedAt:
|
|
2357
|
+
createdAt: import_zod17.z.number().int().nonnegative(),
|
|
2358
|
+
decidedAt: import_zod17.z.number().int().nonnegative().nullable().default(null),
|
|
1854
2359
|
decidedBy: AccountIdSchema.nullable().default(null)
|
|
1855
2360
|
});
|
|
1856
2361
|
var SCRYPT_PARAMS = {
|
|
@@ -1868,197 +2373,45 @@ var ACCOUNT_TTL_SECONDS = 60 * 60 * 24 * 400;
|
|
|
1868
2373
|
var INVITE_TTL_SECONDS = 60 * 60 * 24 * 14;
|
|
1869
2374
|
var ACCESS_REQUEST_TTL_SECONDS = 60 * 60 * 24 * 90;
|
|
1870
2375
|
|
|
1871
|
-
// src/
|
|
1872
|
-
var
|
|
1873
|
-
var
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
"
|
|
1877
|
-
"
|
|
1878
|
-
"regulator",
|
|
1879
|
-
"unknown"
|
|
1880
|
-
]);
|
|
1881
|
-
var CounterpartyResolutionSchema = import_zod14.z.enum([
|
|
1882
|
-
"public",
|
|
1883
|
-
"public_uncovered",
|
|
1884
|
-
"private",
|
|
1885
|
-
"unresolved"
|
|
1886
|
-
]);
|
|
1887
|
-
var CounterpartyNodeSchema = import_zod14.z.object({
|
|
1888
|
-
id: import_zod14.z.string(),
|
|
1889
|
-
ticker: import_zod14.z.string().nullable(),
|
|
1890
|
-
/** Name as it appeared in the source signal — e.g. "Nike". Not the registered name. */
|
|
1891
|
-
name: import_zod14.z.string(),
|
|
1892
|
-
/** Registered legal name from `profiles` — e.g. "NIKE, Inc.". Null unless `public`. */
|
|
1893
|
-
publicName: import_zod14.z.string().nullable(),
|
|
1894
|
-
lei: import_zod14.z.string().nullable(),
|
|
1895
|
-
resolution: CounterpartyResolutionSchema,
|
|
1896
|
-
type: CounterpartyTypeSchema,
|
|
1897
|
-
confidence: import_zod14.z.number().min(0).max(1),
|
|
1898
|
-
sourceSignalIds: import_zod14.z.array(import_zod14.z.number()),
|
|
1899
|
-
firstSeenAt: import_zod14.z.string().datetime(),
|
|
1900
|
-
lastSeenAt: import_zod14.z.string().datetime()
|
|
1901
|
-
});
|
|
1902
|
-
var RelationshipEdgeTypeSchema = import_zod14.z.enum([
|
|
1903
|
-
"supplies_to",
|
|
1904
|
-
"purchases_from",
|
|
1905
|
-
"partners_with",
|
|
1906
|
-
"competes_with",
|
|
1907
|
-
"regulated_by",
|
|
1908
|
-
"invests_in",
|
|
1909
|
-
"acquires",
|
|
1910
|
-
/**
|
|
1911
|
-
* Identity equivalence, not a business relationship: source and target are
|
|
1912
|
-
* the same real-world entity under two different node ids (typically a
|
|
1913
|
-
* slug-keyed node that predates LEI resolution, pointing at the canonical
|
|
1914
|
-
* LEI-keyed node once resolution succeeds). Never delete/merge either
|
|
1915
|
-
* node — this edge exists so a consumer wanting a deduped view can follow
|
|
1916
|
-
* it to the canonical id, reversibly.
|
|
1917
|
-
*/
|
|
1918
|
-
"same_as"
|
|
1919
|
-
]);
|
|
1920
|
-
var RelationshipEdgeSchema = import_zod14.z.object({
|
|
1921
|
-
id: import_zod14.z.string(),
|
|
1922
|
-
sourceId: import_zod14.z.string(),
|
|
1923
|
-
targetId: import_zod14.z.string(),
|
|
1924
|
-
edgeType: RelationshipEdgeTypeSchema,
|
|
1925
|
-
weight: import_zod14.z.number().min(0).max(1),
|
|
1926
|
-
evidenceSignalIds: import_zod14.z.array(import_zod14.z.number()),
|
|
1927
|
-
updatedAt: import_zod14.z.string().datetime(),
|
|
1928
|
-
validFrom: import_zod14.z.string().datetime(),
|
|
1929
|
-
/** null = currently valid. Set when a differently-typed edge supersedes this one. */
|
|
1930
|
-
validTo: import_zod14.z.string().datetime().nullable()
|
|
1931
|
-
});
|
|
1932
|
-
var SignalWeightSchema = import_zod14.z.object({
|
|
1933
|
-
signalId: import_zod14.z.number(),
|
|
1934
|
-
weight: import_zod14.z.number().min(0).max(1),
|
|
1935
|
-
reason: import_zod14.z.string().max(280)
|
|
1936
|
-
});
|
|
1937
|
-
var DivergenceMetricSchema = import_zod14.z.object({
|
|
1938
|
-
ticker: import_zod14.z.string(),
|
|
1939
|
-
// 'operations'/'customer' are current; 'operational'/'ux' are pre-rename
|
|
1940
|
-
// values that still exist on rows written before the backend's rename —
|
|
1941
|
-
// kept here so reading old rows doesn't fail validation.
|
|
1942
|
-
metric: import_zod14.z.enum(["operations", "customer", "operational", "ux"]),
|
|
1943
|
-
score: import_zod14.z.number(),
|
|
1944
|
-
baseline: import_zod14.z.number(),
|
|
1945
|
-
observed: import_zod14.z.number(),
|
|
1946
|
-
computedAt: import_zod14.z.string().datetime(),
|
|
1947
|
-
contributingSignals: import_zod14.z.array(SignalWeightSchema)
|
|
1948
|
-
});
|
|
1949
|
-
|
|
1950
|
-
// src/non-public-entity/schema.ts
|
|
1951
|
-
var import_zod15 = require("zod");
|
|
1952
|
-
var NonPublicEntitySchema = import_zod15.z.object({
|
|
1953
|
-
lei: import_zod15.z.string().nullable(),
|
|
1954
|
-
entityName: import_zod15.z.string(),
|
|
1955
|
-
jurisdiction: import_zod15.z.string().nullable(),
|
|
1956
|
-
registrationStatus: import_zod15.z.string(),
|
|
1957
|
-
parentEntityLei: import_zod15.z.string().nullable(),
|
|
1958
|
-
materialMetadata: import_zod15.z.record(import_zod15.z.unknown()),
|
|
1959
|
-
discoveredAt: import_zod15.z.string().datetime()
|
|
1960
|
-
});
|
|
1961
|
-
|
|
1962
|
-
// src/events/schema.ts
|
|
1963
|
-
var import_zod16 = require("zod");
|
|
1964
|
-
var EventSourceSchema = import_zod16.z.enum(["db", "mock"]);
|
|
1965
|
-
var EntityEventKindSchema = import_zod16.z.enum(["news", "filing", "report"]);
|
|
1966
|
-
var ImpactScaleSchema = import_zod16.z.enum(["graded", "binary", "default", "none"]);
|
|
1967
|
-
var TimestampPrecisionSchema = import_zod16.z.enum(["second", "day"]);
|
|
1968
|
-
var EntityEventSchema = import_zod16.z.object({
|
|
1969
|
-
/** Namespaced so ids never collide across sources: `news:1234`, `filing:AAPL:2026-07-31`. */
|
|
1970
|
-
id: import_zod16.z.string(),
|
|
1971
|
-
kind: EntityEventKindSchema,
|
|
1972
|
-
/**
|
|
1973
|
-
* The producer's own type string, unmodified — `NEWS_YAHOO FINANCE_YAHOO RSS`,
|
|
1974
|
-
* `ANNUAL`, `SNAPSHOT`. There are 31 distinct NEWS variants in the live table,
|
|
1975
|
-
* so this is for filtering and debugging: never render it raw to a user.
|
|
1976
|
-
*/
|
|
1977
|
-
subtype: import_zod16.z.string().nullable(),
|
|
1978
|
-
ticker: import_zod16.z.string(),
|
|
1979
|
-
/** Always `YYYY-MM-DDTHH:MM:SSZ`. Fixed-width, so lexical order == chronological order. */
|
|
1980
|
-
occurredAt: import_zod16.z.string(),
|
|
1981
|
-
precision: TimestampPrecisionSchema,
|
|
1982
|
-
title: import_zod16.z.string(),
|
|
1983
|
-
summary: import_zod16.z.string().nullable(),
|
|
1984
|
-
url: import_zod16.z.string().nullable(),
|
|
1985
|
-
impact: import_zod16.z.number().nullable(),
|
|
1986
|
-
impactScale: ImpactScaleSchema,
|
|
1987
|
-
/** 0 bearish … 50 neutral … 100 bullish. */
|
|
1988
|
-
sentiment: import_zod16.z.number().nullable(),
|
|
1989
|
-
/** False for filings, and for any event sitting at exactly neutral. */
|
|
1990
|
-
sentimentIsMeaningful: import_zod16.z.boolean(),
|
|
1991
|
-
source: EventSourceSchema,
|
|
1992
|
-
meta: import_zod16.z.record(import_zod16.z.unknown()).nullable()
|
|
1993
|
-
});
|
|
1994
|
-
var PaginatedEntityEventsSchema = import_zod16.z.object({
|
|
1995
|
-
total: import_zod16.z.number(),
|
|
1996
|
-
page: import_zod16.z.number(),
|
|
1997
|
-
page_size: import_zod16.z.number(),
|
|
1998
|
-
data: import_zod16.z.array(EntityEventSchema)
|
|
1999
|
-
});
|
|
2000
|
-
var EventBucketSizeSchema = import_zod16.z.enum(["day", "week", "month"]);
|
|
2001
|
-
var EntityEventDensityBucketSchema = import_zod16.z.object({
|
|
2002
|
-
bucketStart: import_zod16.z.string(),
|
|
2003
|
-
kind: EntityEventKindSchema,
|
|
2004
|
-
count: import_zod16.z.number(),
|
|
2005
|
-
/** Null when no event in the bucket had meaningful sentiment. */
|
|
2006
|
-
avgSentiment: import_zod16.z.number().nullable(),
|
|
2007
|
-
maxImpact: import_zod16.z.number().nullable()
|
|
2008
|
-
});
|
|
2009
|
-
var EntityEventDensitySchema = import_zod16.z.object({
|
|
2010
|
-
ticker: import_zod16.z.string(),
|
|
2011
|
-
bucket: EventBucketSizeSchema,
|
|
2012
|
-
buckets: import_zod16.z.array(EntityEventDensityBucketSchema),
|
|
2013
|
-
/** So the client can set its time domain without a second request. */
|
|
2014
|
-
range: import_zod16.z.object({ min: import_zod16.z.string(), max: import_zod16.z.string() }),
|
|
2015
|
-
source: EventSourceSchema
|
|
2016
|
-
});
|
|
2017
|
-
var EntityEventFacetSchema = import_zod16.z.object({
|
|
2018
|
-
kind: EntityEventKindSchema,
|
|
2019
|
-
count: import_zod16.z.number(),
|
|
2020
|
-
earliest: import_zod16.z.string().nullable(),
|
|
2021
|
-
latest: import_zod16.z.string().nullable(),
|
|
2022
|
-
impactScale: ImpactScaleSchema,
|
|
2023
|
-
sentimentUsable: import_zod16.z.boolean()
|
|
2024
|
-
});
|
|
2025
|
-
var EntityEventFacetsSchema = import_zod16.z.object({
|
|
2026
|
-
ticker: import_zod16.z.string(),
|
|
2027
|
-
facets: import_zod16.z.array(EntityEventFacetSchema),
|
|
2028
|
-
source: EventSourceSchema
|
|
2029
|
-
});
|
|
2030
|
-
var DailyPricePointSchema = import_zod16.z.object({
|
|
2031
|
-
date: import_zod16.z.string(),
|
|
2032
|
-
open: import_zod16.z.number().nullable(),
|
|
2033
|
-
high: import_zod16.z.number().nullable(),
|
|
2034
|
-
low: import_zod16.z.number().nullable(),
|
|
2035
|
-
close: import_zod16.z.number(),
|
|
2036
|
-
volume: import_zod16.z.number().nullable()
|
|
2037
|
-
});
|
|
2038
|
-
var EntityPriceSeriesSchema = import_zod16.z.object({
|
|
2039
|
-
ticker: import_zod16.z.string(),
|
|
2040
|
-
series: import_zod16.z.array(DailyPricePointSchema),
|
|
2041
|
-
source: EventSourceSchema
|
|
2042
|
-
});
|
|
2043
|
-
var EVENT_KIND_LABELS = {
|
|
2044
|
-
news: "News",
|
|
2045
|
-
filing: "Filing",
|
|
2046
|
-
report: "Analyst report"
|
|
2047
|
-
};
|
|
2048
|
-
var IMPACT_FLAG_THRESHOLD = 7;
|
|
2049
|
-
var SENTIMENT_NEUTRAL = 50;
|
|
2050
|
-
var DEFAULT_HORIZON_QUARTERS = 5;
|
|
2051
|
-
var EXCLUDED_SOURCES = {
|
|
2052
|
-
insights: "insights.ANALYSIS is a verbatim 1:1 mirror of signals \u2014 every AAPL ANALYSIS row contains a news description verbatim and lands within 2s of it. Including it doubles every event.",
|
|
2053
|
-
divergence_metrics: "A continuously recomputed annotation, not an event: 524 AAPL rows in 2 days.",
|
|
2054
|
-
counterparty_edges: "No history exists \u2014 all rows were created within a 2-day window, so nothing can be placed on a time axis without fabricating it.",
|
|
2055
|
-
raw_filings: "Stale since April, superseded by signals.",
|
|
2056
|
-
market_metrics: "Two rows total.",
|
|
2057
|
-
job_log: "24.5M rows with no ticker index \u2014 never touch it in a request path."
|
|
2376
|
+
// src/auth/accessTokens.ts
|
|
2377
|
+
var import_zod18 = require("zod");
|
|
2378
|
+
var ACCESS_TOKEN_SCOPES = ["boards:read", "boards:send"];
|
|
2379
|
+
var AccessTokenScopeSchema = import_zod18.z.enum(ACCESS_TOKEN_SCOPES);
|
|
2380
|
+
var ACCESS_TOKEN_SCOPE_LABELS = {
|
|
2381
|
+
"boards:read": "See my boards",
|
|
2382
|
+
"boards:send": "Send apps to my boards"
|
|
2058
2383
|
};
|
|
2384
|
+
var ACCESS_TOKEN_PREFIX = "rmk_";
|
|
2385
|
+
var ACCESS_TOKEN_LIFETIMES_DAYS = [7, 30, 90, 365];
|
|
2386
|
+
var ACCESS_TOKEN_MAX_PER_ACCOUNT = 20;
|
|
2387
|
+
var ACCESS_TOKEN_RATE_PER_MINUTE = 60;
|
|
2388
|
+
var AccessTokenRecordSchema = import_zod18.z.object({
|
|
2389
|
+
/** The first 12 hex digits of the hash: what the owner sees and revokes by. */
|
|
2390
|
+
tokenId: import_zod18.z.string().regex(/^[0-9a-f]{12}$/),
|
|
2391
|
+
accountId: AccountIdSchema,
|
|
2392
|
+
/** What the owner called it: "laptop", "Claude Code". */
|
|
2393
|
+
name: import_zod18.z.string().trim().min(1).max(60),
|
|
2394
|
+
scopes: import_zod18.z.array(AccessTokenScopeSchema).min(1),
|
|
2395
|
+
createdAt: import_zod18.z.number().int().nonnegative(),
|
|
2396
|
+
expiresAt: import_zod18.z.number().int().nonnegative(),
|
|
2397
|
+
/** Moved forward at most once a day, so using a token is not a write per request. */
|
|
2398
|
+
lastUsedAt: import_zod18.z.number().int().nonnegative().nullable().default(null)
|
|
2399
|
+
});
|
|
2400
|
+
var PublicAccessTokenSchema = AccessTokenRecordSchema.omit({ accountId: true });
|
|
2401
|
+
var NewAccessTokenSchema = import_zod18.z.object({
|
|
2402
|
+
name: import_zod18.z.string().trim().min(1, "Give it a name.").max(60),
|
|
2403
|
+
scopes: import_zod18.z.array(AccessTokenScopeSchema).min(1, "Choose at least one thing it can do."),
|
|
2404
|
+
days: import_zod18.z.union(ACCESS_TOKEN_LIFETIMES_DAYS.map((d) => import_zod18.z.literal(d)))
|
|
2405
|
+
});
|
|
2059
2406
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2060
2407
|
0 && (module.exports = {
|
|
2061
2408
|
ACCESS_REQUEST_TTL_SECONDS,
|
|
2409
|
+
ACCESS_TOKEN_LIFETIMES_DAYS,
|
|
2410
|
+
ACCESS_TOKEN_MAX_PER_ACCOUNT,
|
|
2411
|
+
ACCESS_TOKEN_PREFIX,
|
|
2412
|
+
ACCESS_TOKEN_RATE_PER_MINUTE,
|
|
2413
|
+
ACCESS_TOKEN_SCOPES,
|
|
2414
|
+
ACCESS_TOKEN_SCOPE_LABELS,
|
|
2062
2415
|
ACCOUNT_TTL_SECONDS,
|
|
2063
2416
|
AIKeyManifestSchema,
|
|
2064
2417
|
AIThemeSchema,
|
|
@@ -2071,10 +2424,13 @@ var EXCLUDED_SOURCES = {
|
|
|
2071
2424
|
AccessRequestRecordSchema,
|
|
2072
2425
|
AccessRequestSchema,
|
|
2073
2426
|
AccessRequestStatusSchema,
|
|
2427
|
+
AccessTokenRecordSchema,
|
|
2428
|
+
AccessTokenScopeSchema,
|
|
2074
2429
|
AccountIdSchema,
|
|
2075
2430
|
AccountRecordSchema,
|
|
2076
2431
|
AccountRoleSchema,
|
|
2077
2432
|
AccountStatusSchema,
|
|
2433
|
+
AccountThemeSchema,
|
|
2078
2434
|
ActionSchema,
|
|
2079
2435
|
AircraftAppConfigSchema,
|
|
2080
2436
|
AppAlignSchema,
|
|
@@ -2106,106 +2462,120 @@ var EXCLUDED_SOURCES = {
|
|
|
2106
2462
|
AssetHashSchema,
|
|
2107
2463
|
AuthStrategySchema,
|
|
2108
2464
|
BlockSchema,
|
|
2465
|
+
BoardFontSchema,
|
|
2466
|
+
BoardPaletteHexSchema,
|
|
2109
2467
|
Bodewell,
|
|
2110
2468
|
CLAIMED_DEVICE_TTL_SECONDS,
|
|
2469
|
+
CONTROL_STATES,
|
|
2470
|
+
CONTROL_STATE_MEANINGS,
|
|
2471
|
+
CaseFamilySchema,
|
|
2111
2472
|
ClockAppConfigSchema,
|
|
2112
|
-
|
|
2113
|
-
CounterpartyResolutionSchema,
|
|
2114
|
-
CounterpartyTypeSchema,
|
|
2473
|
+
ComponentSchema,
|
|
2115
2474
|
DEFAULT_CHAT_MODEL,
|
|
2116
2475
|
DEFAULT_DEVICE_CONFIG,
|
|
2117
|
-
DEFAULT_HORIZON_QUARTERS,
|
|
2118
2476
|
DEFAULT_PRO_MODEL,
|
|
2119
2477
|
DEFAULT_SCHEMA_MODEL,
|
|
2120
2478
|
DEFAULT_THEME_TOKENS,
|
|
2121
2479
|
DEVICE_AP_SSID_PREFIX,
|
|
2122
2480
|
DEVICE_ENDPOINTS,
|
|
2481
|
+
DEVICE_FEATURES,
|
|
2482
|
+
DEVICE_FEATURE_STATE_LABELS,
|
|
2123
2483
|
DEVICE_FRESH_MS,
|
|
2124
2484
|
DEVICE_GLYPHS,
|
|
2125
2485
|
DEVICE_LABEL_MAX,
|
|
2126
2486
|
DEVICE_PALETTE,
|
|
2487
|
+
DEVICE_POLL_QUERY,
|
|
2488
|
+
DEVICE_PROTOCOL,
|
|
2127
2489
|
DEVICE_STALE_MS,
|
|
2128
2490
|
DEVICE_TIMEZONES,
|
|
2129
2491
|
DEVICE_TIMEZONE_FALLBACK,
|
|
2130
2492
|
DEVICE_TTL_SECONDS,
|
|
2131
2493
|
DEVICE_UNKNOWN_GLYPH,
|
|
2132
2494
|
DEVICE_VITALS_FIELDS,
|
|
2133
|
-
|
|
2495
|
+
DISPLAY_FACE_MIN_PX,
|
|
2496
|
+
DISPLAY_NAME_MAX,
|
|
2134
2497
|
DeliveredAppSchema,
|
|
2135
2498
|
DeviceAppIdSchema,
|
|
2136
2499
|
DeviceAppsSchema,
|
|
2137
2500
|
DeviceConfigSchema,
|
|
2138
2501
|
DeviceDisplayConfigSchema,
|
|
2502
|
+
DeviceFeatureKeySchema,
|
|
2503
|
+
DeviceFeatureStateSchema,
|
|
2504
|
+
DeviceFeaturesSchema,
|
|
2139
2505
|
DeviceIdSchema,
|
|
2140
2506
|
DeviceKindSchema,
|
|
2507
|
+
DevicePollReplySchema,
|
|
2508
|
+
DeviceReadingSchema,
|
|
2141
2509
|
DeviceRecordSchema,
|
|
2142
2510
|
DeviceRegistrationSchema,
|
|
2511
|
+
DeviceReportSchema,
|
|
2143
2512
|
DeviceSeenSchema,
|
|
2144
2513
|
DeviceStatusSchema,
|
|
2145
2514
|
DeviceThemeSchema,
|
|
2146
2515
|
DeviceVitalsSchema,
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
EntityEventDensityBucketSchema,
|
|
2151
|
-
EntityEventDensitySchema,
|
|
2152
|
-
EntityEventFacetSchema,
|
|
2153
|
-
EntityEventFacetsSchema,
|
|
2154
|
-
EntityEventKindSchema,
|
|
2155
|
-
EntityEventSchema,
|
|
2156
|
-
EntityPriceSeriesSchema,
|
|
2516
|
+
DisplayNameSchema,
|
|
2517
|
+
EdgeSchema,
|
|
2518
|
+
EmblemSchema,
|
|
2157
2519
|
EntitySchema,
|
|
2158
|
-
EventBucketSizeSchema,
|
|
2159
|
-
EventSourceSchema,
|
|
2160
2520
|
FIRMWARE_UPDATE_ATTEMPTS,
|
|
2161
2521
|
FIRMWARE_UPDATE_PREFIX,
|
|
2162
2522
|
FULL_COLOUR_FRAME_MAX,
|
|
2163
2523
|
FULL_RENDITION,
|
|
2524
|
+
FamilyChoiceSchema,
|
|
2525
|
+
FamilyOptionSchema,
|
|
2164
2526
|
FieldSchema,
|
|
2165
2527
|
FirmwareUpdateSchema,
|
|
2528
|
+
FlexButtonSchema,
|
|
2166
2529
|
FloraTelemetrySchema,
|
|
2167
2530
|
GENESIS_LIBRARY_CONTEXT,
|
|
2168
2531
|
GENESIS_VALID_COMPONENTS,
|
|
2532
|
+
HardwareManifestSchema,
|
|
2169
2533
|
ICON_GRID,
|
|
2170
2534
|
ICON_SIZE_PX,
|
|
2171
2535
|
ICON_STROKE,
|
|
2172
2536
|
IMAGE_MAX_DRAWN,
|
|
2173
2537
|
IMAGE_MAX_SCALE,
|
|
2174
|
-
IMPACT_FLAG_THRESHOLD,
|
|
2175
2538
|
INVITE_TTL_SECONDS,
|
|
2176
|
-
|
|
2539
|
+
InterfaceSchema,
|
|
2177
2540
|
InviteRecordSchema,
|
|
2178
2541
|
MAX_PASSWORD_LENGTH,
|
|
2179
2542
|
MIN_PASSWORD_LENGTH,
|
|
2180
|
-
|
|
2543
|
+
MountHolesSchema,
|
|
2544
|
+
NewAccessTokenSchema,
|
|
2181
2545
|
ORIGINAL_MAX_BYTES,
|
|
2182
2546
|
ORIGINAL_MAX_SIDE,
|
|
2183
2547
|
OwnedSendRequestSchema,
|
|
2548
|
+
PANEL_SIZE,
|
|
2184
2549
|
PHOTOS_PER_ACCOUNT,
|
|
2185
2550
|
PHOTO_UPLOADS_PER_HOUR,
|
|
2186
2551
|
PROVIDER_DEFAULT_MODEL,
|
|
2187
2552
|
PageSchema,
|
|
2188
2553
|
PageSectionSchema,
|
|
2189
|
-
PaginatedEntityEventsSchema,
|
|
2190
2554
|
PairCodeSchema,
|
|
2555
|
+
PanelOrientationSchema,
|
|
2191
2556
|
PhotoCropSchema,
|
|
2192
2557
|
PhotoFullSchema,
|
|
2193
2558
|
PhotoSummarySchema,
|
|
2194
2559
|
PhotoUploadSchema,
|
|
2560
|
+
PlacementSchema,
|
|
2561
|
+
PrinterProfileSchema,
|
|
2195
2562
|
ProvisioningStateSchema,
|
|
2563
|
+
PublicAccessTokenSchema,
|
|
2196
2564
|
PublicAccountSchema,
|
|
2197
2565
|
RETRO_RENDITION,
|
|
2198
|
-
RelationshipEdgeSchema,
|
|
2199
|
-
RelationshipEdgeTypeSchema,
|
|
2200
2566
|
ResourceSchema,
|
|
2201
2567
|
SCRYPT_PARAMS,
|
|
2202
|
-
SENTIMENT_NEUTRAL,
|
|
2203
2568
|
SESSION_COOKIE_NAME,
|
|
2204
2569
|
SESSION_TTL_SECONDS,
|
|
2570
|
+
SHELF_MAX_APPS,
|
|
2571
|
+
SHELF_MAX_BYTES,
|
|
2572
|
+
SHELF_ROTATE_MINUTES,
|
|
2205
2573
|
SIGNAL_DOMAINS,
|
|
2206
2574
|
SIGNAL_KINDS,
|
|
2207
2575
|
SIGNAL_KIND_LABELS,
|
|
2208
2576
|
SIGNAL_SOURCES,
|
|
2577
|
+
SMOOTH_FACES,
|
|
2578
|
+
SMOOTH_FONT_ADVANCES,
|
|
2209
2579
|
SPRITE_MAX_BASE64,
|
|
2210
2580
|
SPRITE_MAX_ROW_BYTES,
|
|
2211
2581
|
SPRITE_MAX_SIDE,
|
|
@@ -2215,18 +2585,23 @@ var EXCLUDED_SOURCES = {
|
|
|
2215
2585
|
SendRequestSchema,
|
|
2216
2586
|
SensorAppConfigSchema,
|
|
2217
2587
|
SessionRecordSchema,
|
|
2588
|
+
ShelfEditSchema,
|
|
2589
|
+
ShelfSchema,
|
|
2218
2590
|
SignalArraySchema,
|
|
2219
2591
|
SignalKindSchema,
|
|
2220
2592
|
SignalPacketSchema,
|
|
2221
2593
|
SignalSchema,
|
|
2222
2594
|
SignalSourceSchema,
|
|
2223
|
-
|
|
2595
|
+
THEME_PALETTE_TOKENS,
|
|
2224
2596
|
THEME_PRESETS,
|
|
2597
|
+
THEME_RADII,
|
|
2225
2598
|
THEME_SYSTEM_PROMPT,
|
|
2226
2599
|
ThemeFontsSchema,
|
|
2600
|
+
ThemeLetteringSchema,
|
|
2227
2601
|
ThemeOverridesSchema,
|
|
2602
|
+
ThemePaletteSchema,
|
|
2603
|
+
ThemeRgbSchema,
|
|
2228
2604
|
ThemeTokensSchema,
|
|
2229
|
-
TimestampPrecisionSchema,
|
|
2230
2605
|
TriggerSchema,
|
|
2231
2606
|
UserSchema,
|
|
2232
2607
|
VitalSourceSchema,
|
|
@@ -2235,12 +2610,5 @@ var EXCLUDED_SOURCES = {
|
|
|
2235
2610
|
WEATHER_ICON_NAMES,
|
|
2236
2611
|
WeatherAppConfigSchema,
|
|
2237
2612
|
WorkflowSchema,
|
|
2238
|
-
architectureReferenceParameters,
|
|
2239
|
-
companyNewsParameters,
|
|
2240
|
-
companyProfileParameters,
|
|
2241
|
-
counterpartyGraphParameters,
|
|
2242
|
-
divergenceMetricsParameters,
|
|
2243
|
-
liveQuoteParameters,
|
|
2244
|
-
stockChartParameters,
|
|
2245
2613
|
telemetryGraphParameters
|
|
2246
2614
|
});
|