@ramme-io/shared 3.7.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 +814 -458
- package/dist/index.d.cts +31587 -1365
- package/dist/index.d.ts +31587 -1365
- package/dist/index.js +760 -425
- 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"])
|
|
@@ -865,6 +916,17 @@ var AppDocumentSchema = import_zod6.z.object({
|
|
|
865
916
|
* Older firmware draws from the left.
|
|
866
917
|
*/
|
|
867
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(),
|
|
868
930
|
/** Named so bindings can refer to them. */
|
|
869
931
|
sources: import_zod6.z.record(AppSourceSchema).default({}),
|
|
870
932
|
blocks: import_zod6.z.array(AppBlockSchema).min(1).max(12)
|
|
@@ -954,82 +1016,32 @@ var PhotoSummarySchema = import_zod7.z.object({
|
|
|
954
1016
|
});
|
|
955
1017
|
|
|
956
1018
|
// src/apps/delivery.ts
|
|
957
|
-
var
|
|
958
|
-
var DeviceIdSchema = import_zod8.z.string().regex(/^[0-9A-HJKMNP-TV-Z]{8}$/, "eight characters, no I L O or U");
|
|
959
|
-
var PairCodeSchema = import_zod8.z.string().regex(/^\d{4}$/);
|
|
960
|
-
var DeviceRegistrationSchema = import_zod8.z.object({
|
|
961
|
-
deviceId: DeviceIdSchema,
|
|
962
|
-
code: PairCodeSchema,
|
|
963
|
-
/** Firmware build, so a support question has an answer. */
|
|
964
|
-
version: import_zod8.z.string().max(40).optional(),
|
|
965
|
-
/** Which board this is, from Boards.h — the two variants need different firmware. */
|
|
966
|
-
board: import_zod8.z.string().max(40).optional(),
|
|
967
|
-
/** dBm, always negative. -50 is across the room; -85 is a complaint. */
|
|
968
|
-
rssi: import_zod8.z.number().int().min(-127).max(0).optional(),
|
|
969
|
-
/** On the owner's own network. Long enough for IPv6, which this does not send yet. */
|
|
970
|
-
ip: import_zod8.z.string().max(45).optional(),
|
|
971
|
-
/** Seconds since boot. Not growing between check-ins means it is restarting. */
|
|
972
|
-
uptime: import_zod8.z.number().int().nonnegative().optional(),
|
|
973
|
-
/** Free heap in bytes. */
|
|
974
|
-
heap: import_zod8.z.number().int().nonnegative().optional(),
|
|
975
|
-
/** The app revision the board has actually drawn. */
|
|
976
|
-
drew: import_zod8.z.number().int().nonnegative().optional(),
|
|
977
|
-
/** Why it last restarted, already mapped to a word by the firmware. */
|
|
978
|
-
reset: import_zod8.z.string().max(40).optional()
|
|
979
|
-
});
|
|
980
|
-
var SendRequestSchema = import_zod8.z.object({
|
|
981
|
-
deviceId: DeviceIdSchema,
|
|
982
|
-
code: PairCodeSchema
|
|
983
|
-
});
|
|
984
|
-
var OwnedSendRequestSchema = import_zod8.z.object({
|
|
985
|
-
deviceId: DeviceIdSchema
|
|
986
|
-
});
|
|
987
|
-
var DeliveredAppSchema = import_zod8.z.object({
|
|
988
|
-
revision: import_zod8.z.number().int().nonnegative(),
|
|
989
|
-
sentAt: import_zod8.z.number().int().nonnegative()
|
|
990
|
-
});
|
|
991
|
-
var DeviceRecordSchema = import_zod8.z.object({
|
|
992
|
-
deviceId: DeviceIdSchema,
|
|
993
|
-
code: PairCodeSchema,
|
|
994
|
-
ownerId: import_zod8.z.string().nullable().default(null),
|
|
995
|
-
version: import_zod8.z.string().max(40).optional(),
|
|
996
|
-
createdAt: import_zod8.z.number().int().nonnegative(),
|
|
997
|
-
lastSeenAt: import_zod8.z.number().int().nonnegative()
|
|
998
|
-
});
|
|
999
|
-
var DEVICE_LABEL_MAX = 48;
|
|
1000
|
-
var DEVICE_TTL_SECONDS = 60 * 60 * 24 * 30;
|
|
1001
|
-
var CLAIMED_DEVICE_TTL_SECONDS = 60 * 60 * 24 * 400;
|
|
1002
|
-
var FirmwareUpdateSchema = import_zod8.z.object({
|
|
1003
|
-
version: import_zod8.z.string().min(1).max(40),
|
|
1004
|
-
url: import_zod8.z.string().url().max(200),
|
|
1005
|
-
sha256: import_zod8.z.string().regex(/^[0-9a-f]{64}$/),
|
|
1006
|
-
bytes: import_zod8.z.number().int().positive(),
|
|
1007
|
-
requestedAt: import_zod8.z.number().int().nonnegative()
|
|
1008
|
-
});
|
|
1009
|
-
var FIRMWARE_UPDATE_PREFIX = "https://www.ramme.io/firmware/weather-display/";
|
|
1010
|
-
var FIRMWARE_UPDATE_ATTEMPTS = 3;
|
|
1019
|
+
var import_zod9 = require("zod");
|
|
1011
1020
|
|
|
1012
1021
|
// src/apps/vitals.ts
|
|
1013
|
-
var
|
|
1014
|
-
var VitalSourceSchema =
|
|
1015
|
-
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({
|
|
1016
1028
|
/** When the board last said any of this, by the server's clock. */
|
|
1017
|
-
reportedAt:
|
|
1029
|
+
reportedAt: import_zod8.z.number().int().nonnegative().optional(),
|
|
1018
1030
|
/**
|
|
1019
1031
|
* The firmware build. Today every board sends the literal "doc-1", which is a
|
|
1020
1032
|
* protocol marker rather than a build id — so this is shown as reported and
|
|
1021
1033
|
* labelled as not yet a version. The real value lives in the published
|
|
1022
1034
|
* manifest until firmware carries it.
|
|
1023
1035
|
*/
|
|
1024
|
-
firmwareVersion:
|
|
1036
|
+
firmwareVersion: import_zod8.z.string().max(40).optional(),
|
|
1025
1037
|
/** Which board this is. Nothing distinguishes a CYD from a Freenove S3 yet. */
|
|
1026
|
-
board:
|
|
1038
|
+
board: import_zod8.z.string().max(40).optional(),
|
|
1027
1039
|
/** dBm, negative. -50 is across the room, -85 is a complaint. */
|
|
1028
|
-
rssi:
|
|
1040
|
+
rssi: import_zod8.z.number().int().min(-127).max(0).optional(),
|
|
1029
1041
|
/** The board's address on its own network, as the board sees it. */
|
|
1030
|
-
ip:
|
|
1031
|
-
uptimeSeconds:
|
|
1032
|
-
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(),
|
|
1033
1045
|
/**
|
|
1034
1046
|
* The revision the board is actually showing.
|
|
1035
1047
|
*
|
|
@@ -1037,30 +1049,69 @@ var DeviceVitalsSchema = import_zod9.z.object({
|
|
|
1037
1049
|
* value: a send that was never drawn looks identical to a successful one until
|
|
1038
1050
|
* these two numbers disagree.
|
|
1039
1051
|
*/
|
|
1040
|
-
drewRevision:
|
|
1052
|
+
drewRevision: import_zod8.z.number().int().nonnegative().optional(),
|
|
1041
1053
|
/** Why it last restarted, if it says. A board power-cycling in a loop is a fault. */
|
|
1042
|
-
resetReason:
|
|
1054
|
+
resetReason: import_zod8.z.string().max(40).optional(),
|
|
1055
|
+
/** Its parts and whether each works — see `DeviceFeaturesSchema`. */
|
|
1056
|
+
features: DeviceFeaturesSchema.optional(),
|
|
1043
1057
|
/** When it last polled — finer-grained than a registration, for liveness only. */
|
|
1044
|
-
lastPollAt:
|
|
1058
|
+
lastPollAt: import_zod8.z.number().int().nonnegative().optional()
|
|
1045
1059
|
});
|
|
1046
|
-
var DeviceSeenSchema =
|
|
1060
|
+
var DeviceSeenSchema = import_zod8.z.object({
|
|
1047
1061
|
/** When the board last asked for its app. The freshest signal this system has. */
|
|
1048
|
-
lastPollAt:
|
|
1062
|
+
lastPollAt: import_zod8.z.number().int().nonnegative(),
|
|
1049
1063
|
/** The revision it reported drawing at that moment. */
|
|
1050
|
-
drewRevision:
|
|
1064
|
+
drewRevision: import_zod8.z.number().int().nonnegative().optional(),
|
|
1051
1065
|
/**
|
|
1052
1066
|
* The firmware it is running, sent on every poll by builds that can update
|
|
1053
1067
|
* remotely — so its presence is also the answer to "can this board be
|
|
1054
1068
|
* updated from its page?". Registration reports the version too, but only
|
|
1055
1069
|
* every six hours; after a remote update this is what shows it took.
|
|
1056
1070
|
*/
|
|
1057
|
-
firmware:
|
|
1071
|
+
firmware: import_zod8.z.string().max(40).optional(),
|
|
1058
1072
|
/** Photos its app names, and how many of those it holds in flash. */
|
|
1059
|
-
photosWanted:
|
|
1060
|
-
photosHeld:
|
|
1073
|
+
photosWanted: import_zod8.z.number().int().nonnegative().optional(),
|
|
1074
|
+
photosHeld: import_zod8.z.number().int().nonnegative().optional(),
|
|
1061
1075
|
/** What happened to the last firmware update it tried, in a few words. */
|
|
1062
|
-
updateResult:
|
|
1063
|
-
|
|
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
|
+
};
|
|
1064
1115
|
var DEVICE_VITALS_FIELDS = [
|
|
1065
1116
|
{
|
|
1066
1117
|
key: "firmwareVersion",
|
|
@@ -1081,11 +1132,84 @@ var DEVICE_VITALS_FIELDS = [
|
|
|
1081
1132
|
source: "register",
|
|
1082
1133
|
reportedByFirmware: true
|
|
1083
1134
|
},
|
|
1084
|
-
{ 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
|
+
}
|
|
1085
1144
|
];
|
|
1086
1145
|
var DEVICE_FRESH_MS = 7 * 60 * 60 * 1e3;
|
|
1087
1146
|
var DEVICE_STALE_MS = 30 * 24 * 60 * 60 * 1e3;
|
|
1088
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
|
+
|
|
1089
1213
|
// src/apps/glyphs.ts
|
|
1090
1214
|
var DEVICE_UNKNOWN_GLYPH = "?";
|
|
1091
1215
|
var DEVICE_GLYPHS = {
|
|
@@ -1161,6 +1285,7 @@ var DEVICE_GLYPHS = {
|
|
|
1161
1285
|
"\u2212": { byte: 45, shows: "-" },
|
|
1162
1286
|
"\xA0": { byte: 32, shows: " " }
|
|
1163
1287
|
};
|
|
1288
|
+
var DISPLAY_FACE_MIN_PX = 28;
|
|
1164
1289
|
var DEVICE_PALETTE = {
|
|
1165
1290
|
background: "17 17 17",
|
|
1166
1291
|
foreground: "238 238 238",
|
|
@@ -1291,74 +1416,158 @@ var WEATHER_ICONS = {
|
|
|
1291
1416
|
]
|
|
1292
1417
|
};
|
|
1293
1418
|
|
|
1294
|
-
// src/
|
|
1419
|
+
// src/apps/shelf.ts
|
|
1295
1420
|
var import_zod10 = require("zod");
|
|
1296
|
-
var
|
|
1297
|
-
|
|
1298
|
-
|
|
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"], {
|
|
1299
1555
|
errorMap: () => ({ message: "Time range must be 1h, 24h, or 7d" })
|
|
1300
1556
|
}),
|
|
1301
|
-
metrics:
|
|
1302
|
-
|
|
1557
|
+
metrics: import_zod13.z.array(
|
|
1558
|
+
import_zod13.z.enum(["temperature", "humidity", "vwc", "ec", "ph", "pressure", "co2"])
|
|
1303
1559
|
).min(1, "At least one metric is required").max(4, "Maximum 4 metrics per graph")
|
|
1304
1560
|
});
|
|
1305
|
-
var stockChartParameters = import_zod10.z.object({
|
|
1306
|
-
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')."),
|
|
1307
|
-
timeRange: import_zod10.z.enum(["1D", "1W", "1M", "1Y"], {
|
|
1308
|
-
errorMap: () => ({ message: "Time range must be 1D, 1W, 1M, or 1Y" })
|
|
1309
|
-
}).describe("The time range for the chart. Choose based on user request or default to '1M'."),
|
|
1310
|
-
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.")
|
|
1311
|
-
});
|
|
1312
|
-
var tickerParam = import_zod10.z.string().min(1).describe("The stock ticker symbol (e.g., 'AAPL', 'TSLA', 'MSFT').");
|
|
1313
|
-
var liveQuoteParameters = import_zod10.z.object({ ticker: tickerParam });
|
|
1314
|
-
var companyNewsParameters = import_zod10.z.object({ ticker: tickerParam });
|
|
1315
|
-
var companyProfileParameters = import_zod10.z.object({ ticker: tickerParam });
|
|
1316
|
-
var counterpartyGraphParameters = import_zod10.z.object({
|
|
1317
|
-
ticker: tickerParam,
|
|
1318
|
-
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.")
|
|
1319
|
-
});
|
|
1320
|
-
var divergenceMetricsParameters = import_zod10.z.object({ ticker: tickerParam });
|
|
1321
|
-
var architectureReferenceParameters = import_zod10.z.object({});
|
|
1322
1561
|
var AI_TOOLS = {
|
|
1323
1562
|
get_telemetry_graph: {
|
|
1324
1563
|
name: "get_telemetry_graph",
|
|
1325
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.",
|
|
1326
|
-
parameters: telemetryGraphParameters
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
},
|
|
1333
|
-
get_live_quote: {
|
|
1334
|
-
name: "get_live_quote",
|
|
1335
|
-
description: "Fetches and displays the real-time stock price and daily change percentage for a given company ticker symbol.",
|
|
1336
|
-
parameters: liveQuoteParameters
|
|
1337
|
-
},
|
|
1338
|
-
get_company_news: {
|
|
1339
|
-
name: "get_company_news",
|
|
1340
|
-
description: "Fetches and displays the 5 most recent news headlines and sentiment impact scores for a given company ticker symbol.",
|
|
1341
|
-
parameters: companyNewsParameters
|
|
1342
|
-
},
|
|
1343
|
-
get_company_profile: {
|
|
1344
|
-
name: "get_company_profile",
|
|
1345
|
-
description: "Fetches fundamental company data including the business description, sector, industry, market cap, and P/E ratio.",
|
|
1346
|
-
parameters: companyProfileParameters
|
|
1347
|
-
},
|
|
1348
|
-
get_counterparty_graph: {
|
|
1349
|
-
name: "get_counterparty_graph",
|
|
1350
|
-
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.",
|
|
1351
|
-
parameters: counterpartyGraphParameters
|
|
1352
|
-
},
|
|
1353
|
-
get_divergence_metrics: {
|
|
1354
|
-
name: "get_divergence_metrics",
|
|
1355
|
-
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.",
|
|
1356
|
-
parameters: divergenceMetricsParameters
|
|
1357
|
-
},
|
|
1358
|
-
get_architecture_reference: {
|
|
1359
|
-
name: "get_architecture_reference",
|
|
1360
|
-
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.",
|
|
1361
|
-
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
|
+
}`
|
|
1362
1571
|
}
|
|
1363
1572
|
};
|
|
1364
1573
|
|
|
@@ -1590,6 +1799,9 @@ A row splits the width into equal cells. Add "pack": true and each child takes
|
|
|
1590
1799
|
only its own width, "gap" apart \u2014 a number with its icon right beside it, or
|
|
1591
1800
|
"H 68\xB0 L 56\xB0" as one line. Put "valign": "center" at the top level of the
|
|
1592
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
|
|
1593
1805
|
"halign": "center" to centre them across it \u2014 the lines keep their own
|
|
1594
1806
|
alignment inside a column as wide as the widest, and the column is centred.
|
|
1595
1807
|
|
|
@@ -1691,6 +1903,14 @@ SOURCES \u2014 declare what the app reads, then bind to it by name:
|
|
|
1691
1903
|
For things that take turns: give each block "hideWhen": { "value":
|
|
1692
1904
|
{ "source": "turn", "field": "index" }, "op": "!=", "than": N } so only
|
|
1693
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.
|
|
1694
1914
|
|
|
1695
1915
|
RULES
|
|
1696
1916
|
|
|
@@ -1710,12 +1930,12 @@ RULES
|
|
|
1710
1930
|
var APP_DOCUMENT_EDIT_PREFIX = "Here is the current app. Change only what is asked:";
|
|
1711
1931
|
|
|
1712
1932
|
// src/theme/schema.ts
|
|
1713
|
-
var
|
|
1714
|
-
var RGBString =
|
|
1933
|
+
var import_zod14 = require("zod");
|
|
1934
|
+
var RGBString = import_zod14.z.string().regex(
|
|
1715
1935
|
/^\d{1,3}\s+\d{1,3}\s+\d{1,3}$/,
|
|
1716
1936
|
'Must be space-separated RGB integers (e.g. "13 110 253")'
|
|
1717
1937
|
);
|
|
1718
|
-
var ThemeOverridesSchema =
|
|
1938
|
+
var ThemeOverridesSchema = import_zod14.z.object({
|
|
1719
1939
|
// ── Core Brand ───────────────────────────────────────────────────────────
|
|
1720
1940
|
"--app-primary-color": RGBString.optional(),
|
|
1721
1941
|
"--app-primary-foreground-color": RGBString.optional(),
|
|
@@ -1731,9 +1951,9 @@ var ThemeOverridesSchema = import_zod11.z.object({
|
|
|
1731
1951
|
"--app-muted-bg": RGBString.optional(),
|
|
1732
1952
|
"--app-muted-text": RGBString.optional(),
|
|
1733
1953
|
// ── Shape ────────────────────────────────────────────────────────────────
|
|
1734
|
-
"--app-border-radius-sm":
|
|
1735
|
-
"--app-border-radius-md":
|
|
1736
|
-
"--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(),
|
|
1737
1957
|
// ── Form Controls ────────────────────────────────────────────────────────
|
|
1738
1958
|
"--app-input-bg-color": RGBString.optional(),
|
|
1739
1959
|
"--app-input-text-color": RGBString.optional(),
|
|
@@ -1747,19 +1967,19 @@ var ThemeOverridesSchema = import_zod11.z.object({
|
|
|
1747
1967
|
"--app-chart-4": RGBString.optional(),
|
|
1748
1968
|
"--app-chart-5": RGBString.optional()
|
|
1749
1969
|
}).strict();
|
|
1750
|
-
var ThemeFontsSchema =
|
|
1970
|
+
var ThemeFontsSchema = import_zod14.z.object({
|
|
1751
1971
|
/** Google Font name for headings (h1–h4, .font-serif). Example: "Playfair Display" */
|
|
1752
|
-
heading:
|
|
1972
|
+
heading: import_zod14.z.string(),
|
|
1753
1973
|
/** Google Font name for body text. Example: "Inter" */
|
|
1754
|
-
body:
|
|
1974
|
+
body: import_zod14.z.string(),
|
|
1755
1975
|
/** Optional monospace font. Example: "Roboto Mono" */
|
|
1756
|
-
mono:
|
|
1976
|
+
mono: import_zod14.z.string().optional()
|
|
1757
1977
|
});
|
|
1758
|
-
var AIThemeSchema =
|
|
1978
|
+
var AIThemeSchema = import_zod14.z.object({
|
|
1759
1979
|
/** Short descriptive theme name. Example: "Midnight Garden" */
|
|
1760
|
-
name:
|
|
1980
|
+
name: import_zod14.z.string(),
|
|
1761
1981
|
/** One-sentence vibe description. Example: "Dark indigo with golden accents." */
|
|
1762
|
-
description:
|
|
1982
|
+
description: import_zod14.z.string(),
|
|
1763
1983
|
/** Google Font pairing for heading and body text. */
|
|
1764
1984
|
fonts: ThemeFontsSchema.optional(),
|
|
1765
1985
|
/**
|
|
@@ -1770,13 +1990,13 @@ var AIThemeSchema = import_zod11.z.object({
|
|
|
1770
1990
|
cssVars: ThemeOverridesSchema
|
|
1771
1991
|
});
|
|
1772
1992
|
var THEME_PRESETS = ["light", "dark", "system", "corporate", "midnight", "blueprint"];
|
|
1773
|
-
var ThemeTokensSchema =
|
|
1993
|
+
var ThemeTokensSchema = import_zod14.z.object({
|
|
1774
1994
|
primary: RGBString,
|
|
1775
1995
|
neutral: RGBString,
|
|
1776
1996
|
success: RGBString,
|
|
1777
1997
|
warning: RGBString,
|
|
1778
1998
|
destructive: RGBString,
|
|
1779
|
-
radius:
|
|
1999
|
+
radius: import_zod14.z.enum(["none", "sm", "md", "lg", "full"])
|
|
1780
2000
|
});
|
|
1781
2001
|
var DEFAULT_THEME_TOKENS = {
|
|
1782
2002
|
primary: "13 110 253",
|
|
@@ -1787,82 +2007,355 @@ var DEFAULT_THEME_TOKENS = {
|
|
|
1787
2007
|
radius: "md"
|
|
1788
2008
|
};
|
|
1789
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
|
+
|
|
1790
2279
|
// src/auth/schema.ts
|
|
1791
|
-
var
|
|
1792
|
-
var UserSchema =
|
|
1793
|
-
id:
|
|
1794
|
-
name:
|
|
1795
|
-
email:
|
|
1796
|
-
password:
|
|
1797
|
-
role:
|
|
1798
|
-
status:
|
|
1799
|
-
joinedAt:
|
|
1800
|
-
lastActive:
|
|
1801
|
-
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()
|
|
1802
2291
|
});
|
|
1803
2292
|
|
|
1804
2293
|
// src/auth/accounts.ts
|
|
1805
|
-
var
|
|
1806
|
-
var AccountIdSchema =
|
|
1807
|
-
var AccountRoleSchema =
|
|
1808
|
-
var AccountStatusSchema =
|
|
1809
|
-
var ScryptHashSchema =
|
|
1810
|
-
algo:
|
|
1811
|
-
n:
|
|
1812
|
-
r:
|
|
1813
|
-
p:
|
|
1814
|
-
keylen:
|
|
1815
|
-
salt:
|
|
1816
|
-
hash:
|
|
1817
|
-
});
|
|
1818
|
-
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({
|
|
1819
2308
|
accountId: AccountIdSchema,
|
|
1820
2309
|
/** Lowercased on write, because a login must not depend on how it was typed. */
|
|
1821
|
-
email:
|
|
1822
|
-
name:
|
|
2310
|
+
email: import_zod17.z.string().email().max(254),
|
|
2311
|
+
name: import_zod17.z.string().min(1).max(64),
|
|
1823
2312
|
role: AccountRoleSchema,
|
|
1824
2313
|
status: AccountStatusSchema,
|
|
1825
2314
|
password: ScryptHashSchema,
|
|
1826
|
-
createdAt:
|
|
1827
|
-
lastLoginAt:
|
|
2315
|
+
createdAt: import_zod17.z.number().int().nonnegative(),
|
|
2316
|
+
lastLoginAt: import_zod17.z.number().int().nonnegative().nullable().default(null),
|
|
1828
2317
|
/** Which admin approved this, or null for the bootstrap account. */
|
|
1829
2318
|
invitedBy: AccountIdSchema.nullable().default(null)
|
|
1830
2319
|
});
|
|
1831
|
-
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({
|
|
1832
2325
|
accountId: AccountIdSchema,
|
|
1833
|
-
email:
|
|
1834
|
-
name:
|
|
2326
|
+
email: import_zod17.z.string().email(),
|
|
2327
|
+
name: import_zod17.z.string(),
|
|
1835
2328
|
role: AccountRoleSchema,
|
|
1836
2329
|
status: AccountStatusSchema
|
|
1837
2330
|
});
|
|
1838
|
-
var SessionRecordSchema =
|
|
2331
|
+
var SessionRecordSchema = import_zod17.z.object({
|
|
1839
2332
|
accountId: AccountIdSchema,
|
|
1840
|
-
createdAt:
|
|
1841
|
-
expiresAt:
|
|
1842
|
-
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()
|
|
1843
2336
|
});
|
|
1844
|
-
var InviteRecordSchema =
|
|
1845
|
-
email:
|
|
2337
|
+
var InviteRecordSchema = import_zod17.z.object({
|
|
2338
|
+
email: import_zod17.z.string().email().max(254),
|
|
1846
2339
|
role: AccountRoleSchema,
|
|
1847
|
-
createdAt:
|
|
1848
|
-
expiresAt:
|
|
2340
|
+
createdAt: import_zod17.z.number().int().nonnegative(),
|
|
2341
|
+
expiresAt: import_zod17.z.number().int().nonnegative(),
|
|
1849
2342
|
invitedBy: AccountIdSchema
|
|
1850
2343
|
});
|
|
1851
|
-
var AccessRequestSchema =
|
|
1852
|
-
email:
|
|
1853
|
-
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),
|
|
1854
2347
|
/** Optional, and never shown publicly. Long enough to be useful, short enough not to be an essay. */
|
|
1855
|
-
reason:
|
|
1856
|
-
});
|
|
1857
|
-
var AccessRequestStatusSchema =
|
|
1858
|
-
var AccessRequestRecordSchema =
|
|
1859
|
-
requestId:
|
|
1860
|
-
email:
|
|
1861
|
-
name:
|
|
1862
|
-
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(),
|
|
1863
2356
|
status: AccessRequestStatusSchema,
|
|
1864
|
-
createdAt:
|
|
1865
|
-
decidedAt:
|
|
2357
|
+
createdAt: import_zod17.z.number().int().nonnegative(),
|
|
2358
|
+
decidedAt: import_zod17.z.number().int().nonnegative().nullable().default(null),
|
|
1866
2359
|
decidedBy: AccountIdSchema.nullable().default(null)
|
|
1867
2360
|
});
|
|
1868
2361
|
var SCRYPT_PARAMS = {
|
|
@@ -1880,197 +2373,45 @@ var ACCOUNT_TTL_SECONDS = 60 * 60 * 24 * 400;
|
|
|
1880
2373
|
var INVITE_TTL_SECONDS = 60 * 60 * 24 * 14;
|
|
1881
2374
|
var ACCESS_REQUEST_TTL_SECONDS = 60 * 60 * 24 * 90;
|
|
1882
2375
|
|
|
1883
|
-
// src/
|
|
1884
|
-
var
|
|
1885
|
-
var
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
"
|
|
1889
|
-
"
|
|
1890
|
-
"regulator",
|
|
1891
|
-
"unknown"
|
|
1892
|
-
]);
|
|
1893
|
-
var CounterpartyResolutionSchema = import_zod14.z.enum([
|
|
1894
|
-
"public",
|
|
1895
|
-
"public_uncovered",
|
|
1896
|
-
"private",
|
|
1897
|
-
"unresolved"
|
|
1898
|
-
]);
|
|
1899
|
-
var CounterpartyNodeSchema = import_zod14.z.object({
|
|
1900
|
-
id: import_zod14.z.string(),
|
|
1901
|
-
ticker: import_zod14.z.string().nullable(),
|
|
1902
|
-
/** Name as it appeared in the source signal — e.g. "Nike". Not the registered name. */
|
|
1903
|
-
name: import_zod14.z.string(),
|
|
1904
|
-
/** Registered legal name from `profiles` — e.g. "NIKE, Inc.". Null unless `public`. */
|
|
1905
|
-
publicName: import_zod14.z.string().nullable(),
|
|
1906
|
-
lei: import_zod14.z.string().nullable(),
|
|
1907
|
-
resolution: CounterpartyResolutionSchema,
|
|
1908
|
-
type: CounterpartyTypeSchema,
|
|
1909
|
-
confidence: import_zod14.z.number().min(0).max(1),
|
|
1910
|
-
sourceSignalIds: import_zod14.z.array(import_zod14.z.number()),
|
|
1911
|
-
firstSeenAt: import_zod14.z.string().datetime(),
|
|
1912
|
-
lastSeenAt: import_zod14.z.string().datetime()
|
|
1913
|
-
});
|
|
1914
|
-
var RelationshipEdgeTypeSchema = import_zod14.z.enum([
|
|
1915
|
-
"supplies_to",
|
|
1916
|
-
"purchases_from",
|
|
1917
|
-
"partners_with",
|
|
1918
|
-
"competes_with",
|
|
1919
|
-
"regulated_by",
|
|
1920
|
-
"invests_in",
|
|
1921
|
-
"acquires",
|
|
1922
|
-
/**
|
|
1923
|
-
* Identity equivalence, not a business relationship: source and target are
|
|
1924
|
-
* the same real-world entity under two different node ids (typically a
|
|
1925
|
-
* slug-keyed node that predates LEI resolution, pointing at the canonical
|
|
1926
|
-
* LEI-keyed node once resolution succeeds). Never delete/merge either
|
|
1927
|
-
* node — this edge exists so a consumer wanting a deduped view can follow
|
|
1928
|
-
* it to the canonical id, reversibly.
|
|
1929
|
-
*/
|
|
1930
|
-
"same_as"
|
|
1931
|
-
]);
|
|
1932
|
-
var RelationshipEdgeSchema = import_zod14.z.object({
|
|
1933
|
-
id: import_zod14.z.string(),
|
|
1934
|
-
sourceId: import_zod14.z.string(),
|
|
1935
|
-
targetId: import_zod14.z.string(),
|
|
1936
|
-
edgeType: RelationshipEdgeTypeSchema,
|
|
1937
|
-
weight: import_zod14.z.number().min(0).max(1),
|
|
1938
|
-
evidenceSignalIds: import_zod14.z.array(import_zod14.z.number()),
|
|
1939
|
-
updatedAt: import_zod14.z.string().datetime(),
|
|
1940
|
-
validFrom: import_zod14.z.string().datetime(),
|
|
1941
|
-
/** null = currently valid. Set when a differently-typed edge supersedes this one. */
|
|
1942
|
-
validTo: import_zod14.z.string().datetime().nullable()
|
|
1943
|
-
});
|
|
1944
|
-
var SignalWeightSchema = import_zod14.z.object({
|
|
1945
|
-
signalId: import_zod14.z.number(),
|
|
1946
|
-
weight: import_zod14.z.number().min(0).max(1),
|
|
1947
|
-
reason: import_zod14.z.string().max(280)
|
|
1948
|
-
});
|
|
1949
|
-
var DivergenceMetricSchema = import_zod14.z.object({
|
|
1950
|
-
ticker: import_zod14.z.string(),
|
|
1951
|
-
// 'operations'/'customer' are current; 'operational'/'ux' are pre-rename
|
|
1952
|
-
// values that still exist on rows written before the backend's rename —
|
|
1953
|
-
// kept here so reading old rows doesn't fail validation.
|
|
1954
|
-
metric: import_zod14.z.enum(["operations", "customer", "operational", "ux"]),
|
|
1955
|
-
score: import_zod14.z.number(),
|
|
1956
|
-
baseline: import_zod14.z.number(),
|
|
1957
|
-
observed: import_zod14.z.number(),
|
|
1958
|
-
computedAt: import_zod14.z.string().datetime(),
|
|
1959
|
-
contributingSignals: import_zod14.z.array(SignalWeightSchema)
|
|
1960
|
-
});
|
|
1961
|
-
|
|
1962
|
-
// src/non-public-entity/schema.ts
|
|
1963
|
-
var import_zod15 = require("zod");
|
|
1964
|
-
var NonPublicEntitySchema = import_zod15.z.object({
|
|
1965
|
-
lei: import_zod15.z.string().nullable(),
|
|
1966
|
-
entityName: import_zod15.z.string(),
|
|
1967
|
-
jurisdiction: import_zod15.z.string().nullable(),
|
|
1968
|
-
registrationStatus: import_zod15.z.string(),
|
|
1969
|
-
parentEntityLei: import_zod15.z.string().nullable(),
|
|
1970
|
-
materialMetadata: import_zod15.z.record(import_zod15.z.unknown()),
|
|
1971
|
-
discoveredAt: import_zod15.z.string().datetime()
|
|
1972
|
-
});
|
|
1973
|
-
|
|
1974
|
-
// src/events/schema.ts
|
|
1975
|
-
var import_zod16 = require("zod");
|
|
1976
|
-
var EventSourceSchema = import_zod16.z.enum(["db", "mock"]);
|
|
1977
|
-
var EntityEventKindSchema = import_zod16.z.enum(["news", "filing", "report"]);
|
|
1978
|
-
var ImpactScaleSchema = import_zod16.z.enum(["graded", "binary", "default", "none"]);
|
|
1979
|
-
var TimestampPrecisionSchema = import_zod16.z.enum(["second", "day"]);
|
|
1980
|
-
var EntityEventSchema = import_zod16.z.object({
|
|
1981
|
-
/** Namespaced so ids never collide across sources: `news:1234`, `filing:AAPL:2026-07-31`. */
|
|
1982
|
-
id: import_zod16.z.string(),
|
|
1983
|
-
kind: EntityEventKindSchema,
|
|
1984
|
-
/**
|
|
1985
|
-
* The producer's own type string, unmodified — `NEWS_YAHOO FINANCE_YAHOO RSS`,
|
|
1986
|
-
* `ANNUAL`, `SNAPSHOT`. There are 31 distinct NEWS variants in the live table,
|
|
1987
|
-
* so this is for filtering and debugging: never render it raw to a user.
|
|
1988
|
-
*/
|
|
1989
|
-
subtype: import_zod16.z.string().nullable(),
|
|
1990
|
-
ticker: import_zod16.z.string(),
|
|
1991
|
-
/** Always `YYYY-MM-DDTHH:MM:SSZ`. Fixed-width, so lexical order == chronological order. */
|
|
1992
|
-
occurredAt: import_zod16.z.string(),
|
|
1993
|
-
precision: TimestampPrecisionSchema,
|
|
1994
|
-
title: import_zod16.z.string(),
|
|
1995
|
-
summary: import_zod16.z.string().nullable(),
|
|
1996
|
-
url: import_zod16.z.string().nullable(),
|
|
1997
|
-
impact: import_zod16.z.number().nullable(),
|
|
1998
|
-
impactScale: ImpactScaleSchema,
|
|
1999
|
-
/** 0 bearish … 50 neutral … 100 bullish. */
|
|
2000
|
-
sentiment: import_zod16.z.number().nullable(),
|
|
2001
|
-
/** False for filings, and for any event sitting at exactly neutral. */
|
|
2002
|
-
sentimentIsMeaningful: import_zod16.z.boolean(),
|
|
2003
|
-
source: EventSourceSchema,
|
|
2004
|
-
meta: import_zod16.z.record(import_zod16.z.unknown()).nullable()
|
|
2005
|
-
});
|
|
2006
|
-
var PaginatedEntityEventsSchema = import_zod16.z.object({
|
|
2007
|
-
total: import_zod16.z.number(),
|
|
2008
|
-
page: import_zod16.z.number(),
|
|
2009
|
-
page_size: import_zod16.z.number(),
|
|
2010
|
-
data: import_zod16.z.array(EntityEventSchema)
|
|
2011
|
-
});
|
|
2012
|
-
var EventBucketSizeSchema = import_zod16.z.enum(["day", "week", "month"]);
|
|
2013
|
-
var EntityEventDensityBucketSchema = import_zod16.z.object({
|
|
2014
|
-
bucketStart: import_zod16.z.string(),
|
|
2015
|
-
kind: EntityEventKindSchema,
|
|
2016
|
-
count: import_zod16.z.number(),
|
|
2017
|
-
/** Null when no event in the bucket had meaningful sentiment. */
|
|
2018
|
-
avgSentiment: import_zod16.z.number().nullable(),
|
|
2019
|
-
maxImpact: import_zod16.z.number().nullable()
|
|
2020
|
-
});
|
|
2021
|
-
var EntityEventDensitySchema = import_zod16.z.object({
|
|
2022
|
-
ticker: import_zod16.z.string(),
|
|
2023
|
-
bucket: EventBucketSizeSchema,
|
|
2024
|
-
buckets: import_zod16.z.array(EntityEventDensityBucketSchema),
|
|
2025
|
-
/** So the client can set its time domain without a second request. */
|
|
2026
|
-
range: import_zod16.z.object({ min: import_zod16.z.string(), max: import_zod16.z.string() }),
|
|
2027
|
-
source: EventSourceSchema
|
|
2028
|
-
});
|
|
2029
|
-
var EntityEventFacetSchema = import_zod16.z.object({
|
|
2030
|
-
kind: EntityEventKindSchema,
|
|
2031
|
-
count: import_zod16.z.number(),
|
|
2032
|
-
earliest: import_zod16.z.string().nullable(),
|
|
2033
|
-
latest: import_zod16.z.string().nullable(),
|
|
2034
|
-
impactScale: ImpactScaleSchema,
|
|
2035
|
-
sentimentUsable: import_zod16.z.boolean()
|
|
2036
|
-
});
|
|
2037
|
-
var EntityEventFacetsSchema = import_zod16.z.object({
|
|
2038
|
-
ticker: import_zod16.z.string(),
|
|
2039
|
-
facets: import_zod16.z.array(EntityEventFacetSchema),
|
|
2040
|
-
source: EventSourceSchema
|
|
2041
|
-
});
|
|
2042
|
-
var DailyPricePointSchema = import_zod16.z.object({
|
|
2043
|
-
date: import_zod16.z.string(),
|
|
2044
|
-
open: import_zod16.z.number().nullable(),
|
|
2045
|
-
high: import_zod16.z.number().nullable(),
|
|
2046
|
-
low: import_zod16.z.number().nullable(),
|
|
2047
|
-
close: import_zod16.z.number(),
|
|
2048
|
-
volume: import_zod16.z.number().nullable()
|
|
2049
|
-
});
|
|
2050
|
-
var EntityPriceSeriesSchema = import_zod16.z.object({
|
|
2051
|
-
ticker: import_zod16.z.string(),
|
|
2052
|
-
series: import_zod16.z.array(DailyPricePointSchema),
|
|
2053
|
-
source: EventSourceSchema
|
|
2054
|
-
});
|
|
2055
|
-
var EVENT_KIND_LABELS = {
|
|
2056
|
-
news: "News",
|
|
2057
|
-
filing: "Filing",
|
|
2058
|
-
report: "Analyst report"
|
|
2059
|
-
};
|
|
2060
|
-
var IMPACT_FLAG_THRESHOLD = 7;
|
|
2061
|
-
var SENTIMENT_NEUTRAL = 50;
|
|
2062
|
-
var DEFAULT_HORIZON_QUARTERS = 5;
|
|
2063
|
-
var EXCLUDED_SOURCES = {
|
|
2064
|
-
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.",
|
|
2065
|
-
divergence_metrics: "A continuously recomputed annotation, not an event: 524 AAPL rows in 2 days.",
|
|
2066
|
-
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.",
|
|
2067
|
-
raw_filings: "Stale since April, superseded by signals.",
|
|
2068
|
-
market_metrics: "Two rows total.",
|
|
2069
|
-
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"
|
|
2070
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
|
+
});
|
|
2071
2406
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2072
2407
|
0 && (module.exports = {
|
|
2073
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,
|
|
2074
2415
|
ACCOUNT_TTL_SECONDS,
|
|
2075
2416
|
AIKeyManifestSchema,
|
|
2076
2417
|
AIThemeSchema,
|
|
@@ -2083,10 +2424,13 @@ var EXCLUDED_SOURCES = {
|
|
|
2083
2424
|
AccessRequestRecordSchema,
|
|
2084
2425
|
AccessRequestSchema,
|
|
2085
2426
|
AccessRequestStatusSchema,
|
|
2427
|
+
AccessTokenRecordSchema,
|
|
2428
|
+
AccessTokenScopeSchema,
|
|
2086
2429
|
AccountIdSchema,
|
|
2087
2430
|
AccountRecordSchema,
|
|
2088
2431
|
AccountRoleSchema,
|
|
2089
2432
|
AccountStatusSchema,
|
|
2433
|
+
AccountThemeSchema,
|
|
2090
2434
|
ActionSchema,
|
|
2091
2435
|
AircraftAppConfigSchema,
|
|
2092
2436
|
AppAlignSchema,
|
|
@@ -2118,106 +2462,120 @@ var EXCLUDED_SOURCES = {
|
|
|
2118
2462
|
AssetHashSchema,
|
|
2119
2463
|
AuthStrategySchema,
|
|
2120
2464
|
BlockSchema,
|
|
2465
|
+
BoardFontSchema,
|
|
2466
|
+
BoardPaletteHexSchema,
|
|
2121
2467
|
Bodewell,
|
|
2122
2468
|
CLAIMED_DEVICE_TTL_SECONDS,
|
|
2469
|
+
CONTROL_STATES,
|
|
2470
|
+
CONTROL_STATE_MEANINGS,
|
|
2471
|
+
CaseFamilySchema,
|
|
2123
2472
|
ClockAppConfigSchema,
|
|
2124
|
-
|
|
2125
|
-
CounterpartyResolutionSchema,
|
|
2126
|
-
CounterpartyTypeSchema,
|
|
2473
|
+
ComponentSchema,
|
|
2127
2474
|
DEFAULT_CHAT_MODEL,
|
|
2128
2475
|
DEFAULT_DEVICE_CONFIG,
|
|
2129
|
-
DEFAULT_HORIZON_QUARTERS,
|
|
2130
2476
|
DEFAULT_PRO_MODEL,
|
|
2131
2477
|
DEFAULT_SCHEMA_MODEL,
|
|
2132
2478
|
DEFAULT_THEME_TOKENS,
|
|
2133
2479
|
DEVICE_AP_SSID_PREFIX,
|
|
2134
2480
|
DEVICE_ENDPOINTS,
|
|
2481
|
+
DEVICE_FEATURES,
|
|
2482
|
+
DEVICE_FEATURE_STATE_LABELS,
|
|
2135
2483
|
DEVICE_FRESH_MS,
|
|
2136
2484
|
DEVICE_GLYPHS,
|
|
2137
2485
|
DEVICE_LABEL_MAX,
|
|
2138
2486
|
DEVICE_PALETTE,
|
|
2487
|
+
DEVICE_POLL_QUERY,
|
|
2488
|
+
DEVICE_PROTOCOL,
|
|
2139
2489
|
DEVICE_STALE_MS,
|
|
2140
2490
|
DEVICE_TIMEZONES,
|
|
2141
2491
|
DEVICE_TIMEZONE_FALLBACK,
|
|
2142
2492
|
DEVICE_TTL_SECONDS,
|
|
2143
2493
|
DEVICE_UNKNOWN_GLYPH,
|
|
2144
2494
|
DEVICE_VITALS_FIELDS,
|
|
2145
|
-
|
|
2495
|
+
DISPLAY_FACE_MIN_PX,
|
|
2496
|
+
DISPLAY_NAME_MAX,
|
|
2146
2497
|
DeliveredAppSchema,
|
|
2147
2498
|
DeviceAppIdSchema,
|
|
2148
2499
|
DeviceAppsSchema,
|
|
2149
2500
|
DeviceConfigSchema,
|
|
2150
2501
|
DeviceDisplayConfigSchema,
|
|
2502
|
+
DeviceFeatureKeySchema,
|
|
2503
|
+
DeviceFeatureStateSchema,
|
|
2504
|
+
DeviceFeaturesSchema,
|
|
2151
2505
|
DeviceIdSchema,
|
|
2152
2506
|
DeviceKindSchema,
|
|
2507
|
+
DevicePollReplySchema,
|
|
2508
|
+
DeviceReadingSchema,
|
|
2153
2509
|
DeviceRecordSchema,
|
|
2154
2510
|
DeviceRegistrationSchema,
|
|
2511
|
+
DeviceReportSchema,
|
|
2155
2512
|
DeviceSeenSchema,
|
|
2156
2513
|
DeviceStatusSchema,
|
|
2157
2514
|
DeviceThemeSchema,
|
|
2158
2515
|
DeviceVitalsSchema,
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
EntityEventDensityBucketSchema,
|
|
2163
|
-
EntityEventDensitySchema,
|
|
2164
|
-
EntityEventFacetSchema,
|
|
2165
|
-
EntityEventFacetsSchema,
|
|
2166
|
-
EntityEventKindSchema,
|
|
2167
|
-
EntityEventSchema,
|
|
2168
|
-
EntityPriceSeriesSchema,
|
|
2516
|
+
DisplayNameSchema,
|
|
2517
|
+
EdgeSchema,
|
|
2518
|
+
EmblemSchema,
|
|
2169
2519
|
EntitySchema,
|
|
2170
|
-
EventBucketSizeSchema,
|
|
2171
|
-
EventSourceSchema,
|
|
2172
2520
|
FIRMWARE_UPDATE_ATTEMPTS,
|
|
2173
2521
|
FIRMWARE_UPDATE_PREFIX,
|
|
2174
2522
|
FULL_COLOUR_FRAME_MAX,
|
|
2175
2523
|
FULL_RENDITION,
|
|
2524
|
+
FamilyChoiceSchema,
|
|
2525
|
+
FamilyOptionSchema,
|
|
2176
2526
|
FieldSchema,
|
|
2177
2527
|
FirmwareUpdateSchema,
|
|
2528
|
+
FlexButtonSchema,
|
|
2178
2529
|
FloraTelemetrySchema,
|
|
2179
2530
|
GENESIS_LIBRARY_CONTEXT,
|
|
2180
2531
|
GENESIS_VALID_COMPONENTS,
|
|
2532
|
+
HardwareManifestSchema,
|
|
2181
2533
|
ICON_GRID,
|
|
2182
2534
|
ICON_SIZE_PX,
|
|
2183
2535
|
ICON_STROKE,
|
|
2184
2536
|
IMAGE_MAX_DRAWN,
|
|
2185
2537
|
IMAGE_MAX_SCALE,
|
|
2186
|
-
IMPACT_FLAG_THRESHOLD,
|
|
2187
2538
|
INVITE_TTL_SECONDS,
|
|
2188
|
-
|
|
2539
|
+
InterfaceSchema,
|
|
2189
2540
|
InviteRecordSchema,
|
|
2190
2541
|
MAX_PASSWORD_LENGTH,
|
|
2191
2542
|
MIN_PASSWORD_LENGTH,
|
|
2192
|
-
|
|
2543
|
+
MountHolesSchema,
|
|
2544
|
+
NewAccessTokenSchema,
|
|
2193
2545
|
ORIGINAL_MAX_BYTES,
|
|
2194
2546
|
ORIGINAL_MAX_SIDE,
|
|
2195
2547
|
OwnedSendRequestSchema,
|
|
2548
|
+
PANEL_SIZE,
|
|
2196
2549
|
PHOTOS_PER_ACCOUNT,
|
|
2197
2550
|
PHOTO_UPLOADS_PER_HOUR,
|
|
2198
2551
|
PROVIDER_DEFAULT_MODEL,
|
|
2199
2552
|
PageSchema,
|
|
2200
2553
|
PageSectionSchema,
|
|
2201
|
-
PaginatedEntityEventsSchema,
|
|
2202
2554
|
PairCodeSchema,
|
|
2555
|
+
PanelOrientationSchema,
|
|
2203
2556
|
PhotoCropSchema,
|
|
2204
2557
|
PhotoFullSchema,
|
|
2205
2558
|
PhotoSummarySchema,
|
|
2206
2559
|
PhotoUploadSchema,
|
|
2560
|
+
PlacementSchema,
|
|
2561
|
+
PrinterProfileSchema,
|
|
2207
2562
|
ProvisioningStateSchema,
|
|
2563
|
+
PublicAccessTokenSchema,
|
|
2208
2564
|
PublicAccountSchema,
|
|
2209
2565
|
RETRO_RENDITION,
|
|
2210
|
-
RelationshipEdgeSchema,
|
|
2211
|
-
RelationshipEdgeTypeSchema,
|
|
2212
2566
|
ResourceSchema,
|
|
2213
2567
|
SCRYPT_PARAMS,
|
|
2214
|
-
SENTIMENT_NEUTRAL,
|
|
2215
2568
|
SESSION_COOKIE_NAME,
|
|
2216
2569
|
SESSION_TTL_SECONDS,
|
|
2570
|
+
SHELF_MAX_APPS,
|
|
2571
|
+
SHELF_MAX_BYTES,
|
|
2572
|
+
SHELF_ROTATE_MINUTES,
|
|
2217
2573
|
SIGNAL_DOMAINS,
|
|
2218
2574
|
SIGNAL_KINDS,
|
|
2219
2575
|
SIGNAL_KIND_LABELS,
|
|
2220
2576
|
SIGNAL_SOURCES,
|
|
2577
|
+
SMOOTH_FACES,
|
|
2578
|
+
SMOOTH_FONT_ADVANCES,
|
|
2221
2579
|
SPRITE_MAX_BASE64,
|
|
2222
2580
|
SPRITE_MAX_ROW_BYTES,
|
|
2223
2581
|
SPRITE_MAX_SIDE,
|
|
@@ -2227,18 +2585,23 @@ var EXCLUDED_SOURCES = {
|
|
|
2227
2585
|
SendRequestSchema,
|
|
2228
2586
|
SensorAppConfigSchema,
|
|
2229
2587
|
SessionRecordSchema,
|
|
2588
|
+
ShelfEditSchema,
|
|
2589
|
+
ShelfSchema,
|
|
2230
2590
|
SignalArraySchema,
|
|
2231
2591
|
SignalKindSchema,
|
|
2232
2592
|
SignalPacketSchema,
|
|
2233
2593
|
SignalSchema,
|
|
2234
2594
|
SignalSourceSchema,
|
|
2235
|
-
|
|
2595
|
+
THEME_PALETTE_TOKENS,
|
|
2236
2596
|
THEME_PRESETS,
|
|
2597
|
+
THEME_RADII,
|
|
2237
2598
|
THEME_SYSTEM_PROMPT,
|
|
2238
2599
|
ThemeFontsSchema,
|
|
2600
|
+
ThemeLetteringSchema,
|
|
2239
2601
|
ThemeOverridesSchema,
|
|
2602
|
+
ThemePaletteSchema,
|
|
2603
|
+
ThemeRgbSchema,
|
|
2240
2604
|
ThemeTokensSchema,
|
|
2241
|
-
TimestampPrecisionSchema,
|
|
2242
2605
|
TriggerSchema,
|
|
2243
2606
|
UserSchema,
|
|
2244
2607
|
VitalSourceSchema,
|
|
@@ -2247,12 +2610,5 @@ var EXCLUDED_SOURCES = {
|
|
|
2247
2610
|
WEATHER_ICON_NAMES,
|
|
2248
2611
|
WeatherAppConfigSchema,
|
|
2249
2612
|
WorkflowSchema,
|
|
2250
|
-
architectureReferenceParameters,
|
|
2251
|
-
companyNewsParameters,
|
|
2252
|
-
companyProfileParameters,
|
|
2253
|
-
counterpartyGraphParameters,
|
|
2254
|
-
divergenceMetricsParameters,
|
|
2255
|
-
liveQuoteParameters,
|
|
2256
|
-
stockChartParameters,
|
|
2257
2613
|
telemetryGraphParameters
|
|
2258
2614
|
});
|