@ramme-io/shared 3.1.1 → 3.1.2
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 +2 -2
- package/dist/index.cjs +434 -82
- package/dist/index.d.cts +1238 -12
- package/dist/index.d.ts +1238 -12
- package/dist/index.js +397 -82
- package/package.json +6 -5
package/dist/index.js
CHANGED
|
@@ -273,28 +273,165 @@ var BodewellCommandSchema = z4.object({
|
|
|
273
273
|
value: z4.number()
|
|
274
274
|
});
|
|
275
275
|
|
|
276
|
-
// src/
|
|
276
|
+
// src/device/schema.ts
|
|
277
277
|
import { z as z5 } from "zod";
|
|
278
|
-
var
|
|
279
|
-
|
|
280
|
-
|
|
278
|
+
var DeviceKindSchema = z5.enum([
|
|
279
|
+
"esp32-touch-28",
|
|
280
|
+
// 2.8" 240x320 resistive touch, the workshop board
|
|
281
|
+
"esp32-headless",
|
|
282
|
+
// no display; sensor node
|
|
283
|
+
"simulator"
|
|
284
|
+
// browser-side stand-in, for building without hardware
|
|
285
|
+
]);
|
|
286
|
+
var DeviceAppIdSchema = z5.enum([
|
|
287
|
+
"weather",
|
|
288
|
+
"clock",
|
|
289
|
+
"aircraft",
|
|
290
|
+
"sensor",
|
|
291
|
+
"blank"
|
|
292
|
+
]);
|
|
293
|
+
var WeatherAppConfigSchema = z5.object({
|
|
294
|
+
/** Postal code is what a person knows; the portal resolves it to coordinates. */
|
|
295
|
+
postalCode: z5.string().min(3).max(12),
|
|
296
|
+
latitude: z5.number().min(-90).max(90).optional(),
|
|
297
|
+
longitude: z5.number().min(-180).max(180).optional(),
|
|
298
|
+
units: z5.enum(["imperial", "metric"]).default("imperial"),
|
|
299
|
+
showForecast: z5.boolean().default(true),
|
|
300
|
+
refreshSeconds: z5.number().int().min(300).max(86400).default(900)
|
|
301
|
+
});
|
|
302
|
+
var ClockAppConfigSchema = z5.object({
|
|
303
|
+
/** IANA zone, e.g. "America/New_York". */
|
|
304
|
+
timezone: z5.string().default("America/New_York"),
|
|
305
|
+
twentyFourHour: z5.boolean().default(false),
|
|
306
|
+
showSeconds: z5.boolean().default(false),
|
|
307
|
+
showDate: z5.boolean().default(true)
|
|
308
|
+
});
|
|
309
|
+
var AircraftAppConfigSchema = z5.object({
|
|
310
|
+
latitude: z5.number().min(-90).max(90),
|
|
311
|
+
longitude: z5.number().min(-180).max(180),
|
|
312
|
+
radiusKm: z5.number().min(5).max(400).default(80),
|
|
313
|
+
/** Rows the list view can show before the screen runs out. */
|
|
314
|
+
maxRows: z5.number().int().min(1).max(12).default(8),
|
|
315
|
+
refreshSeconds: z5.number().int().min(10).max(600).default(30)
|
|
316
|
+
});
|
|
317
|
+
var SensorAppConfigSchema = z5.object({
|
|
318
|
+
/** Signal keys to display, in order. Abstract keys per the Signal contract. */
|
|
319
|
+
keys: z5.array(z5.string()).min(1).max(6),
|
|
320
|
+
refreshSeconds: z5.number().int().min(1).max(3600).default(10)
|
|
321
|
+
});
|
|
322
|
+
var DeviceAppsSchema = z5.object({
|
|
323
|
+
weather: WeatherAppConfigSchema.optional(),
|
|
324
|
+
clock: ClockAppConfigSchema.optional(),
|
|
325
|
+
aircraft: AircraftAppConfigSchema.optional(),
|
|
326
|
+
sensor: SensorAppConfigSchema.optional()
|
|
327
|
+
});
|
|
328
|
+
var DeviceDisplayConfigSchema = z5.object({
|
|
329
|
+
brightness: z5.number().int().min(5).max(100).default(80),
|
|
330
|
+
/** Degrees clockwise. The board can sit either way up in a case. */
|
|
331
|
+
rotation: z5.union([z5.literal(0), z5.literal(90), z5.literal(180), z5.literal(270)]).default(0),
|
|
332
|
+
/** Dim rather than sleep — a desk display that blanks looks broken. */
|
|
333
|
+
dimAfterSeconds: z5.number().int().min(0).max(86400).default(0),
|
|
334
|
+
dimBrightness: z5.number().int().min(0).max(100).default(15),
|
|
335
|
+
/** Local 24h times, e.g. "22:30". Empty disables night dimming. */
|
|
336
|
+
nightStart: z5.string().regex(/^([01]\d|2[0-3]):[0-5]\d$/).optional(),
|
|
337
|
+
nightEnd: z5.string().regex(/^([01]\d|2[0-3]):[0-5]\d$/).optional()
|
|
338
|
+
});
|
|
339
|
+
var RgbTripletSchema = z5.string().regex(
|
|
340
|
+
/^\d{1,3} \d{1,3} \d{1,3}$/,
|
|
341
|
+
'Expected space-separated RGB integers, e.g. "13 110 253"'
|
|
342
|
+
);
|
|
343
|
+
var DeviceThemeSchema = z5.object({
|
|
344
|
+
preset: z5.enum(["light", "dark", "corporate", "midnight", "blueprint", "custom"]).default("dark"),
|
|
345
|
+
background: RgbTripletSchema.optional(),
|
|
346
|
+
foreground: RgbTripletSchema.optional(),
|
|
347
|
+
accent: RgbTripletSchema.optional(),
|
|
348
|
+
muted: RgbTripletSchema.optional(),
|
|
349
|
+
warning: RgbTripletSchema.optional()
|
|
350
|
+
});
|
|
351
|
+
var DeviceConfigSchema = z5.object({
|
|
352
|
+
/** Bumped only on breaking shape changes, so old firmware can refuse safely. */
|
|
353
|
+
schemaVersion: z5.literal(1),
|
|
354
|
+
deviceId: z5.string().min(1),
|
|
355
|
+
/** Monotonic. Portal increments on write; device echoes what it is running. */
|
|
356
|
+
revision: z5.number().int().nonnegative(),
|
|
357
|
+
updatedAt: z5.string().datetime().optional(),
|
|
358
|
+
activeApp: DeviceAppIdSchema,
|
|
359
|
+
apps: DeviceAppsSchema,
|
|
360
|
+
display: DeviceDisplayConfigSchema,
|
|
361
|
+
theme: DeviceThemeSchema
|
|
362
|
+
});
|
|
363
|
+
var ProvisioningStateSchema = z5.enum([
|
|
364
|
+
"unprovisioned",
|
|
365
|
+
"connecting",
|
|
366
|
+
"online",
|
|
367
|
+
"offline",
|
|
368
|
+
"failed"
|
|
369
|
+
]);
|
|
370
|
+
var DeviceStatusSchema = z5.object({
|
|
371
|
+
deviceId: z5.string().min(1),
|
|
372
|
+
kind: DeviceKindSchema,
|
|
373
|
+
firmwareVersion: z5.string(),
|
|
374
|
+
/** Shown on the device's own screen at boot — how the user finds it. */
|
|
375
|
+
ipAddress: z5.string().optional(),
|
|
376
|
+
provisioning: ProvisioningStateSchema,
|
|
377
|
+
/** Revision the device is actually running, not the one it was sent. */
|
|
378
|
+
configRevision: z5.number().int().nonnegative(),
|
|
379
|
+
activeApp: DeviceAppIdSchema,
|
|
380
|
+
rssi: z5.number().int().optional().describe("dBm"),
|
|
381
|
+
uptimeSeconds: z5.number().int().nonnegative().optional(),
|
|
382
|
+
freeHeapBytes: z5.number().int().nonnegative().optional()
|
|
383
|
+
});
|
|
384
|
+
var DEVICE_ENDPOINTS = {
|
|
385
|
+
/** GET → DeviceStatus */
|
|
386
|
+
status: "/api/status",
|
|
387
|
+
/** GET → DeviceConfig · POST DeviceConfig → applied + persisted */
|
|
388
|
+
config: "/api/config",
|
|
389
|
+
/** POST → clears stored credentials and returns to AP mode */
|
|
390
|
+
forget: "/api/forget"
|
|
391
|
+
};
|
|
392
|
+
var DEVICE_AP_SSID_PREFIX = "ramme-setup-";
|
|
393
|
+
var DEFAULT_DEVICE_CONFIG = {
|
|
394
|
+
schemaVersion: 1,
|
|
395
|
+
revision: 0,
|
|
396
|
+
activeApp: "clock",
|
|
397
|
+
apps: {},
|
|
398
|
+
display: {
|
|
399
|
+
brightness: 80,
|
|
400
|
+
rotation: 0,
|
|
401
|
+
dimAfterSeconds: 0,
|
|
402
|
+
dimBrightness: 15
|
|
403
|
+
},
|
|
404
|
+
theme: { preset: "dark" }
|
|
405
|
+
};
|
|
406
|
+
|
|
407
|
+
// src/ai/tools.ts
|
|
408
|
+
import { z as z6 } from "zod";
|
|
409
|
+
var telemetryGraphParameters = z6.object({
|
|
410
|
+
deviceId: z6.string().min(1, "Device ID is required"),
|
|
411
|
+
timeRange: z6.enum(["1h", "24h", "7d"], {
|
|
281
412
|
errorMap: () => ({ message: "Time range must be 1h, 24h, or 7d" })
|
|
282
413
|
}),
|
|
283
|
-
metrics:
|
|
284
|
-
|
|
414
|
+
metrics: z6.array(
|
|
415
|
+
z6.enum(["temperature", "humidity", "vwc", "ec", "ph", "pressure", "co2"])
|
|
285
416
|
).min(1, "At least one metric is required").max(4, "Maximum 4 metrics per graph")
|
|
286
417
|
});
|
|
287
|
-
var stockChartParameters =
|
|
288
|
-
ticker:
|
|
289
|
-
timeRange:
|
|
418
|
+
var stockChartParameters = z6.object({
|
|
419
|
+
ticker: z6.string().min(1).describe("The stock ticker symbol explicitly requested by the user. YOU MUST EXTRACT AND PROVIDE THIS (e.g., 'AAPL', 'MSFT')."),
|
|
420
|
+
timeRange: z6.enum(["1D", "1W", "1M", "1Y"], {
|
|
290
421
|
errorMap: () => ({ message: "Time range must be 1D, 1W, 1M, or 1Y" })
|
|
291
422
|
}).describe("The time range for the chart. Choose based on user request or default to '1M'."),
|
|
292
|
-
metrics:
|
|
423
|
+
metrics: z6.array(z6.enum(["price", "volume", "moving_average"])).min(1, "At least one metric is required").describe("Array of metrics to display. Always include 'price' and 'volume' unless user specifies otherwise.")
|
|
424
|
+
});
|
|
425
|
+
var tickerParam = z6.string().min(1).describe("The stock ticker symbol (e.g., 'AAPL', 'TSLA', 'MSFT').");
|
|
426
|
+
var liveQuoteParameters = z6.object({ ticker: tickerParam });
|
|
427
|
+
var companyNewsParameters = z6.object({ ticker: tickerParam });
|
|
428
|
+
var companyProfileParameters = z6.object({ ticker: tickerParam });
|
|
429
|
+
var counterpartyGraphParameters = z6.object({
|
|
430
|
+
ticker: tickerParam,
|
|
431
|
+
hops: z6.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.")
|
|
293
432
|
});
|
|
294
|
-
var
|
|
295
|
-
var
|
|
296
|
-
var companyNewsParameters = z5.object({ ticker: tickerParam });
|
|
297
|
-
var companyProfileParameters = z5.object({ ticker: tickerParam });
|
|
433
|
+
var divergenceMetricsParameters = z6.object({ ticker: tickerParam });
|
|
434
|
+
var architectureReferenceParameters = z6.object({});
|
|
298
435
|
var AI_TOOLS = {
|
|
299
436
|
get_telemetry_graph: {
|
|
300
437
|
name: "get_telemetry_graph",
|
|
@@ -320,6 +457,21 @@ var AI_TOOLS = {
|
|
|
320
457
|
name: "get_company_profile",
|
|
321
458
|
description: "Fetches fundamental company data including the business description, sector, industry, market cap, and P/E ratio.",
|
|
322
459
|
parameters: companyProfileParameters
|
|
460
|
+
},
|
|
461
|
+
get_counterparty_graph: {
|
|
462
|
+
name: "get_counterparty_graph",
|
|
463
|
+
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.",
|
|
464
|
+
parameters: counterpartyGraphParameters
|
|
465
|
+
},
|
|
466
|
+
get_divergence_metrics: {
|
|
467
|
+
name: "get_divergence_metrics",
|
|
468
|
+
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.",
|
|
469
|
+
parameters: divergenceMetricsParameters
|
|
470
|
+
},
|
|
471
|
+
get_architecture_reference: {
|
|
472
|
+
name: "get_architecture_reference",
|
|
473
|
+
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.",
|
|
474
|
+
parameters: architectureReferenceParameters
|
|
323
475
|
}
|
|
324
476
|
};
|
|
325
477
|
|
|
@@ -505,12 +657,12 @@ use bg-card or bg-background as a safe fallback. NEVER invent raw colors.
|
|
|
505
657
|
`;
|
|
506
658
|
|
|
507
659
|
// src/theme/schema.ts
|
|
508
|
-
import { z as
|
|
509
|
-
var RGBString =
|
|
660
|
+
import { z as z7 } from "zod";
|
|
661
|
+
var RGBString = z7.string().regex(
|
|
510
662
|
/^\d{1,3}\s+\d{1,3}\s+\d{1,3}$/,
|
|
511
663
|
'Must be space-separated RGB integers (e.g. "13 110 253")'
|
|
512
664
|
);
|
|
513
|
-
var ThemeOverridesSchema =
|
|
665
|
+
var ThemeOverridesSchema = z7.object({
|
|
514
666
|
// ── Core Brand ───────────────────────────────────────────────────────────
|
|
515
667
|
"--app-primary-color": RGBString.optional(),
|
|
516
668
|
"--app-primary-foreground-color": RGBString.optional(),
|
|
@@ -526,9 +678,9 @@ var ThemeOverridesSchema = z6.object({
|
|
|
526
678
|
"--app-muted-bg": RGBString.optional(),
|
|
527
679
|
"--app-muted-text": RGBString.optional(),
|
|
528
680
|
// ── Shape ────────────────────────────────────────────────────────────────
|
|
529
|
-
"--app-border-radius-sm":
|
|
530
|
-
"--app-border-radius-md":
|
|
531
|
-
"--app-border-radius-lg":
|
|
681
|
+
"--app-border-radius-sm": z7.string().optional(),
|
|
682
|
+
"--app-border-radius-md": z7.string().optional(),
|
|
683
|
+
"--app-border-radius-lg": z7.string().optional(),
|
|
532
684
|
// ── Form Controls ────────────────────────────────────────────────────────
|
|
533
685
|
"--app-input-bg-color": RGBString.optional(),
|
|
534
686
|
"--app-input-text-color": RGBString.optional(),
|
|
@@ -542,19 +694,19 @@ var ThemeOverridesSchema = z6.object({
|
|
|
542
694
|
"--app-chart-4": RGBString.optional(),
|
|
543
695
|
"--app-chart-5": RGBString.optional()
|
|
544
696
|
}).strict();
|
|
545
|
-
var ThemeFontsSchema =
|
|
697
|
+
var ThemeFontsSchema = z7.object({
|
|
546
698
|
/** Google Font name for headings (h1–h4, .font-serif). Example: "Playfair Display" */
|
|
547
|
-
heading:
|
|
699
|
+
heading: z7.string(),
|
|
548
700
|
/** Google Font name for body text. Example: "Inter" */
|
|
549
|
-
body:
|
|
701
|
+
body: z7.string(),
|
|
550
702
|
/** Optional monospace font. Example: "Roboto Mono" */
|
|
551
|
-
mono:
|
|
703
|
+
mono: z7.string().optional()
|
|
552
704
|
});
|
|
553
|
-
var AIThemeSchema =
|
|
705
|
+
var AIThemeSchema = z7.object({
|
|
554
706
|
/** Short descriptive theme name. Example: "Midnight Garden" */
|
|
555
|
-
name:
|
|
707
|
+
name: z7.string(),
|
|
556
708
|
/** One-sentence vibe description. Example: "Dark indigo with golden accents." */
|
|
557
|
-
description:
|
|
709
|
+
description: z7.string(),
|
|
558
710
|
/** Google Font pairing for heading and body text. */
|
|
559
711
|
fonts: ThemeFontsSchema.optional(),
|
|
560
712
|
/**
|
|
@@ -565,13 +717,13 @@ var AIThemeSchema = z6.object({
|
|
|
565
717
|
cssVars: ThemeOverridesSchema
|
|
566
718
|
});
|
|
567
719
|
var THEME_PRESETS = ["light", "dark", "system", "corporate", "midnight", "blueprint"];
|
|
568
|
-
var ThemeTokensSchema =
|
|
720
|
+
var ThemeTokensSchema = z7.object({
|
|
569
721
|
primary: RGBString,
|
|
570
722
|
neutral: RGBString,
|
|
571
723
|
success: RGBString,
|
|
572
724
|
warning: RGBString,
|
|
573
725
|
destructive: RGBString,
|
|
574
|
-
radius:
|
|
726
|
+
radius: z7.enum(["none", "sm", "md", "lg", "full"])
|
|
575
727
|
});
|
|
576
728
|
var DEFAULT_THEME_TOKENS = {
|
|
577
729
|
primary: "13 110 253",
|
|
@@ -583,22 +735,22 @@ var DEFAULT_THEME_TOKENS = {
|
|
|
583
735
|
};
|
|
584
736
|
|
|
585
737
|
// src/auth/schema.ts
|
|
586
|
-
import { z as
|
|
587
|
-
var UserSchema =
|
|
588
|
-
id:
|
|
589
|
-
name:
|
|
590
|
-
email:
|
|
591
|
-
password:
|
|
592
|
-
role:
|
|
593
|
-
status:
|
|
594
|
-
joinedAt:
|
|
595
|
-
lastActive:
|
|
596
|
-
avatarUrl:
|
|
738
|
+
import { z as z8 } from "zod";
|
|
739
|
+
var UserSchema = z8.object({
|
|
740
|
+
id: z8.string().default(""),
|
|
741
|
+
name: z8.string(),
|
|
742
|
+
email: z8.string().email(),
|
|
743
|
+
password: z8.string().optional(),
|
|
744
|
+
role: z8.string(),
|
|
745
|
+
status: z8.string().optional(),
|
|
746
|
+
joinedAt: z8.string().optional(),
|
|
747
|
+
lastActive: z8.string().optional(),
|
|
748
|
+
avatarUrl: z8.string().optional()
|
|
597
749
|
});
|
|
598
750
|
|
|
599
751
|
// src/counterparty/schema.ts
|
|
600
|
-
import { z as
|
|
601
|
-
var CounterpartyTypeSchema =
|
|
752
|
+
import { z as z9 } from "zod";
|
|
753
|
+
var CounterpartyTypeSchema = z9.enum([
|
|
602
754
|
"supplier",
|
|
603
755
|
"customer",
|
|
604
756
|
"partner",
|
|
@@ -606,91 +758,249 @@ var CounterpartyTypeSchema = z8.enum([
|
|
|
606
758
|
"regulator",
|
|
607
759
|
"unknown"
|
|
608
760
|
]);
|
|
609
|
-
var
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
761
|
+
var CounterpartyResolutionSchema = z9.enum([
|
|
762
|
+
"public",
|
|
763
|
+
"public_uncovered",
|
|
764
|
+
"private",
|
|
765
|
+
"unresolved"
|
|
766
|
+
]);
|
|
767
|
+
var CounterpartyNodeSchema = z9.object({
|
|
768
|
+
id: z9.string(),
|
|
769
|
+
ticker: z9.string().nullable(),
|
|
770
|
+
/** Name as it appeared in the source signal — e.g. "Nike". Not the registered name. */
|
|
771
|
+
name: z9.string(),
|
|
772
|
+
/** Registered legal name from `profiles` — e.g. "NIKE, Inc.". Null unless `public`. */
|
|
773
|
+
publicName: z9.string().nullable(),
|
|
774
|
+
lei: z9.string().nullable(),
|
|
775
|
+
resolution: CounterpartyResolutionSchema,
|
|
613
776
|
type: CounterpartyTypeSchema,
|
|
614
|
-
confidence:
|
|
615
|
-
sourceSignalIds:
|
|
616
|
-
firstSeenAt:
|
|
617
|
-
lastSeenAt:
|
|
777
|
+
confidence: z9.number().min(0).max(1),
|
|
778
|
+
sourceSignalIds: z9.array(z9.number()),
|
|
779
|
+
firstSeenAt: z9.string().datetime(),
|
|
780
|
+
lastSeenAt: z9.string().datetime()
|
|
618
781
|
});
|
|
619
|
-
var RelationshipEdgeTypeSchema =
|
|
782
|
+
var RelationshipEdgeTypeSchema = z9.enum([
|
|
620
783
|
"supplies_to",
|
|
621
784
|
"purchases_from",
|
|
622
785
|
"partners_with",
|
|
623
786
|
"competes_with",
|
|
624
|
-
"regulated_by"
|
|
787
|
+
"regulated_by",
|
|
788
|
+
"invests_in",
|
|
789
|
+
"acquires",
|
|
790
|
+
/**
|
|
791
|
+
* Identity equivalence, not a business relationship: source and target are
|
|
792
|
+
* the same real-world entity under two different node ids (typically a
|
|
793
|
+
* slug-keyed node that predates LEI resolution, pointing at the canonical
|
|
794
|
+
* LEI-keyed node once resolution succeeds). Never delete/merge either
|
|
795
|
+
* node — this edge exists so a consumer wanting a deduped view can follow
|
|
796
|
+
* it to the canonical id, reversibly.
|
|
797
|
+
*/
|
|
798
|
+
"same_as"
|
|
625
799
|
]);
|
|
626
|
-
var RelationshipEdgeSchema =
|
|
627
|
-
id:
|
|
628
|
-
sourceId:
|
|
629
|
-
targetId:
|
|
800
|
+
var RelationshipEdgeSchema = z9.object({
|
|
801
|
+
id: z9.string(),
|
|
802
|
+
sourceId: z9.string(),
|
|
803
|
+
targetId: z9.string(),
|
|
630
804
|
edgeType: RelationshipEdgeTypeSchema,
|
|
631
|
-
weight:
|
|
632
|
-
evidenceSignalIds:
|
|
633
|
-
updatedAt:
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
805
|
+
weight: z9.number().min(0).max(1),
|
|
806
|
+
evidenceSignalIds: z9.array(z9.number()),
|
|
807
|
+
updatedAt: z9.string().datetime(),
|
|
808
|
+
validFrom: z9.string().datetime(),
|
|
809
|
+
/** null = currently valid. Set when a differently-typed edge supersedes this one. */
|
|
810
|
+
validTo: z9.string().datetime().nullable()
|
|
811
|
+
});
|
|
812
|
+
var SignalWeightSchema = z9.object({
|
|
813
|
+
signalId: z9.number(),
|
|
814
|
+
weight: z9.number().min(0).max(1),
|
|
815
|
+
reason: z9.string().max(280)
|
|
816
|
+
});
|
|
817
|
+
var DivergenceMetricSchema = z9.object({
|
|
818
|
+
ticker: z9.string(),
|
|
819
|
+
// 'operations'/'customer' are current; 'operational'/'ux' are pre-rename
|
|
820
|
+
// values that still exist on rows written before the backend's rename —
|
|
821
|
+
// kept here so reading old rows doesn't fail validation.
|
|
822
|
+
metric: z9.enum(["operations", "customer", "operational", "ux"]),
|
|
823
|
+
score: z9.number(),
|
|
824
|
+
baseline: z9.number(),
|
|
825
|
+
observed: z9.number(),
|
|
826
|
+
computedAt: z9.string().datetime(),
|
|
827
|
+
contributingSignals: z9.array(SignalWeightSchema)
|
|
648
828
|
});
|
|
649
829
|
|
|
650
830
|
// src/non-public-entity/schema.ts
|
|
651
|
-
import { z as
|
|
652
|
-
var NonPublicEntitySchema =
|
|
653
|
-
lei:
|
|
654
|
-
entityName:
|
|
655
|
-
jurisdiction:
|
|
656
|
-
registrationStatus:
|
|
657
|
-
parentEntityLei:
|
|
658
|
-
materialMetadata:
|
|
659
|
-
discoveredAt:
|
|
831
|
+
import { z as z10 } from "zod";
|
|
832
|
+
var NonPublicEntitySchema = z10.object({
|
|
833
|
+
lei: z10.string().nullable(),
|
|
834
|
+
entityName: z10.string(),
|
|
835
|
+
jurisdiction: z10.string().nullable(),
|
|
836
|
+
registrationStatus: z10.string(),
|
|
837
|
+
parentEntityLei: z10.string().nullable(),
|
|
838
|
+
materialMetadata: z10.record(z10.unknown()),
|
|
839
|
+
discoveredAt: z10.string().datetime()
|
|
660
840
|
});
|
|
841
|
+
|
|
842
|
+
// src/events/schema.ts
|
|
843
|
+
import { z as z11 } from "zod";
|
|
844
|
+
var EventSourceSchema = z11.enum(["db", "mock"]);
|
|
845
|
+
var EntityEventKindSchema = z11.enum(["news", "filing", "report"]);
|
|
846
|
+
var ImpactScaleSchema = z11.enum(["graded", "binary", "default", "none"]);
|
|
847
|
+
var TimestampPrecisionSchema = z11.enum(["second", "day"]);
|
|
848
|
+
var EntityEventSchema = z11.object({
|
|
849
|
+
/** Namespaced so ids never collide across sources: `news:1234`, `filing:AAPL:2026-07-31`. */
|
|
850
|
+
id: z11.string(),
|
|
851
|
+
kind: EntityEventKindSchema,
|
|
852
|
+
/**
|
|
853
|
+
* The producer's own type string, unmodified — `NEWS_YAHOO FINANCE_YAHOO RSS`,
|
|
854
|
+
* `ANNUAL`, `SNAPSHOT`. There are 31 distinct NEWS variants in the live table,
|
|
855
|
+
* so this is for filtering and debugging: never render it raw to a user.
|
|
856
|
+
*/
|
|
857
|
+
subtype: z11.string().nullable(),
|
|
858
|
+
ticker: z11.string(),
|
|
859
|
+
/** Always `YYYY-MM-DDTHH:MM:SSZ`. Fixed-width, so lexical order == chronological order. */
|
|
860
|
+
occurredAt: z11.string(),
|
|
861
|
+
precision: TimestampPrecisionSchema,
|
|
862
|
+
title: z11.string(),
|
|
863
|
+
summary: z11.string().nullable(),
|
|
864
|
+
url: z11.string().nullable(),
|
|
865
|
+
impact: z11.number().nullable(),
|
|
866
|
+
impactScale: ImpactScaleSchema,
|
|
867
|
+
/** 0 bearish … 50 neutral … 100 bullish. */
|
|
868
|
+
sentiment: z11.number().nullable(),
|
|
869
|
+
/** False for filings, and for any event sitting at exactly neutral. */
|
|
870
|
+
sentimentIsMeaningful: z11.boolean(),
|
|
871
|
+
source: EventSourceSchema,
|
|
872
|
+
meta: z11.record(z11.unknown()).nullable()
|
|
873
|
+
});
|
|
874
|
+
var PaginatedEntityEventsSchema = z11.object({
|
|
875
|
+
total: z11.number(),
|
|
876
|
+
page: z11.number(),
|
|
877
|
+
page_size: z11.number(),
|
|
878
|
+
data: z11.array(EntityEventSchema)
|
|
879
|
+
});
|
|
880
|
+
var EventBucketSizeSchema = z11.enum(["day", "week", "month"]);
|
|
881
|
+
var EntityEventDensityBucketSchema = z11.object({
|
|
882
|
+
bucketStart: z11.string(),
|
|
883
|
+
kind: EntityEventKindSchema,
|
|
884
|
+
count: z11.number(),
|
|
885
|
+
/** Null when no event in the bucket had meaningful sentiment. */
|
|
886
|
+
avgSentiment: z11.number().nullable(),
|
|
887
|
+
maxImpact: z11.number().nullable()
|
|
888
|
+
});
|
|
889
|
+
var EntityEventDensitySchema = z11.object({
|
|
890
|
+
ticker: z11.string(),
|
|
891
|
+
bucket: EventBucketSizeSchema,
|
|
892
|
+
buckets: z11.array(EntityEventDensityBucketSchema),
|
|
893
|
+
/** So the client can set its time domain without a second request. */
|
|
894
|
+
range: z11.object({ min: z11.string(), max: z11.string() }),
|
|
895
|
+
source: EventSourceSchema
|
|
896
|
+
});
|
|
897
|
+
var EntityEventFacetSchema = z11.object({
|
|
898
|
+
kind: EntityEventKindSchema,
|
|
899
|
+
count: z11.number(),
|
|
900
|
+
earliest: z11.string().nullable(),
|
|
901
|
+
latest: z11.string().nullable(),
|
|
902
|
+
impactScale: ImpactScaleSchema,
|
|
903
|
+
sentimentUsable: z11.boolean()
|
|
904
|
+
});
|
|
905
|
+
var EntityEventFacetsSchema = z11.object({
|
|
906
|
+
ticker: z11.string(),
|
|
907
|
+
facets: z11.array(EntityEventFacetSchema),
|
|
908
|
+
source: EventSourceSchema
|
|
909
|
+
});
|
|
910
|
+
var DailyPricePointSchema = z11.object({
|
|
911
|
+
date: z11.string(),
|
|
912
|
+
open: z11.number().nullable(),
|
|
913
|
+
high: z11.number().nullable(),
|
|
914
|
+
low: z11.number().nullable(),
|
|
915
|
+
close: z11.number(),
|
|
916
|
+
volume: z11.number().nullable()
|
|
917
|
+
});
|
|
918
|
+
var EntityPriceSeriesSchema = z11.object({
|
|
919
|
+
ticker: z11.string(),
|
|
920
|
+
series: z11.array(DailyPricePointSchema),
|
|
921
|
+
source: EventSourceSchema
|
|
922
|
+
});
|
|
923
|
+
var EVENT_KIND_LABELS = {
|
|
924
|
+
news: "News",
|
|
925
|
+
filing: "Filing",
|
|
926
|
+
report: "Analyst report"
|
|
927
|
+
};
|
|
928
|
+
var IMPACT_FLAG_THRESHOLD = 7;
|
|
929
|
+
var SENTIMENT_NEUTRAL = 50;
|
|
930
|
+
var DEFAULT_HORIZON_QUARTERS = 5;
|
|
931
|
+
var EXCLUDED_SOURCES = {
|
|
932
|
+
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.",
|
|
933
|
+
divergence_metrics: "A continuously recomputed annotation, not an event: 524 AAPL rows in 2 days.",
|
|
934
|
+
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.",
|
|
935
|
+
raw_filings: "Stale since April, superseded by signals.",
|
|
936
|
+
market_metrics: "Two rows total.",
|
|
937
|
+
job_log: "24.5M rows with no ticker index \u2014 never touch it in a request path."
|
|
938
|
+
};
|
|
661
939
|
export {
|
|
662
940
|
AIKeyManifestSchema,
|
|
663
941
|
AIThemeSchema,
|
|
664
942
|
AI_ROSTER,
|
|
665
943
|
AI_TOOLS,
|
|
666
944
|
ActionSchema,
|
|
945
|
+
AircraftAppConfigSchema,
|
|
667
946
|
AppSignalSchema,
|
|
668
947
|
AppSpecificationSchema,
|
|
669
948
|
AuthStrategySchema,
|
|
670
949
|
BlockSchema,
|
|
671
950
|
schema_exports as Bodewell,
|
|
951
|
+
ClockAppConfigSchema,
|
|
672
952
|
CounterpartyNodeSchema,
|
|
953
|
+
CounterpartyResolutionSchema,
|
|
673
954
|
CounterpartyTypeSchema,
|
|
674
955
|
DEFAULT_CHAT_MODEL,
|
|
956
|
+
DEFAULT_DEVICE_CONFIG,
|
|
957
|
+
DEFAULT_HORIZON_QUARTERS,
|
|
675
958
|
DEFAULT_PRO_MODEL,
|
|
676
959
|
DEFAULT_SCHEMA_MODEL,
|
|
677
960
|
DEFAULT_THEME_TOKENS,
|
|
961
|
+
DEVICE_AP_SSID_PREFIX,
|
|
962
|
+
DEVICE_ENDPOINTS,
|
|
963
|
+
DailyPricePointSchema,
|
|
964
|
+
DeviceAppIdSchema,
|
|
965
|
+
DeviceAppsSchema,
|
|
966
|
+
DeviceConfigSchema,
|
|
967
|
+
DeviceDisplayConfigSchema,
|
|
968
|
+
DeviceKindSchema,
|
|
969
|
+
DeviceStatusSchema,
|
|
970
|
+
DeviceThemeSchema,
|
|
678
971
|
DivergenceMetricSchema,
|
|
972
|
+
EVENT_KIND_LABELS,
|
|
973
|
+
EXCLUDED_SOURCES,
|
|
974
|
+
EntityEventDensityBucketSchema,
|
|
975
|
+
EntityEventDensitySchema,
|
|
976
|
+
EntityEventFacetSchema,
|
|
977
|
+
EntityEventFacetsSchema,
|
|
978
|
+
EntityEventKindSchema,
|
|
979
|
+
EntityEventSchema,
|
|
980
|
+
EntityPriceSeriesSchema,
|
|
679
981
|
EntitySchema,
|
|
982
|
+
EventBucketSizeSchema,
|
|
983
|
+
EventSourceSchema,
|
|
680
984
|
FieldSchema,
|
|
681
985
|
FloraTelemetrySchema,
|
|
682
986
|
GENESIS_LIBRARY_CONTEXT,
|
|
683
987
|
GENESIS_VALID_COMPONENTS,
|
|
988
|
+
IMPACT_FLAG_THRESHOLD,
|
|
989
|
+
ImpactScaleSchema,
|
|
684
990
|
NonPublicEntitySchema,
|
|
685
991
|
PageSchema,
|
|
686
992
|
PageSectionSchema,
|
|
993
|
+
PaginatedEntityEventsSchema,
|
|
994
|
+
ProvisioningStateSchema,
|
|
687
995
|
RelationshipEdgeSchema,
|
|
688
996
|
RelationshipEdgeTypeSchema,
|
|
689
997
|
ResourceSchema,
|
|
998
|
+
SENTIMENT_NEUTRAL,
|
|
690
999
|
SIGNAL_DOMAINS,
|
|
691
1000
|
SIGNAL_KINDS,
|
|
692
1001
|
SIGNAL_KIND_LABELS,
|
|
693
1002
|
SIGNAL_SOURCES,
|
|
1003
|
+
SensorAppConfigSchema,
|
|
694
1004
|
SignalArraySchema,
|
|
695
1005
|
SignalKindSchema,
|
|
696
1006
|
SignalPacketSchema,
|
|
@@ -702,11 +1012,16 @@ export {
|
|
|
702
1012
|
ThemeFontsSchema,
|
|
703
1013
|
ThemeOverridesSchema,
|
|
704
1014
|
ThemeTokensSchema,
|
|
1015
|
+
TimestampPrecisionSchema,
|
|
705
1016
|
TriggerSchema,
|
|
706
1017
|
UserSchema,
|
|
1018
|
+
WeatherAppConfigSchema,
|
|
707
1019
|
WorkflowSchema,
|
|
1020
|
+
architectureReferenceParameters,
|
|
708
1021
|
companyNewsParameters,
|
|
709
1022
|
companyProfileParameters,
|
|
1023
|
+
counterpartyGraphParameters,
|
|
1024
|
+
divergenceMetricsParameters,
|
|
710
1025
|
liveQuoteParameters,
|
|
711
1026
|
stockChartParameters,
|
|
712
1027
|
telemetryGraphParameters
|
package/package.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ramme-io/shared",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"private": false,
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "./dist/index.cjs",
|
|
8
|
+
"sideEffects": false,
|
|
8
9
|
"module": "./dist/index.js",
|
|
9
10
|
"types": "./dist/index.d.ts",
|
|
10
11
|
"exports": {
|
|
@@ -20,13 +21,13 @@
|
|
|
20
21
|
"publishConfig": {
|
|
21
22
|
"access": "public"
|
|
22
23
|
},
|
|
23
|
-
"scripts": {
|
|
24
|
-
"build": "tsup index.ts --format esm,cjs --dts --clean"
|
|
25
|
-
},
|
|
26
24
|
"dependencies": {
|
|
27
25
|
"zod": "^3.23.8"
|
|
28
26
|
},
|
|
29
27
|
"devDependencies": {
|
|
30
28
|
"tsup": "^8.5.1"
|
|
29
|
+
},
|
|
30
|
+
"scripts": {
|
|
31
|
+
"build": "tsup index.ts --format esm,cjs --dts --clean"
|
|
31
32
|
}
|
|
32
|
-
}
|
|
33
|
+
}
|