@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/dist/index.cjs CHANGED
@@ -25,33 +25,65 @@ __export(index_exports, {
25
25
  AI_ROSTER: () => AI_ROSTER,
26
26
  AI_TOOLS: () => AI_TOOLS,
27
27
  ActionSchema: () => ActionSchema,
28
+ AircraftAppConfigSchema: () => AircraftAppConfigSchema,
28
29
  AppSignalSchema: () => AppSignalSchema,
29
30
  AppSpecificationSchema: () => AppSpecificationSchema,
30
31
  AuthStrategySchema: () => AuthStrategySchema,
31
32
  BlockSchema: () => BlockSchema,
32
33
  Bodewell: () => schema_exports,
34
+ ClockAppConfigSchema: () => ClockAppConfigSchema,
33
35
  CounterpartyNodeSchema: () => CounterpartyNodeSchema,
36
+ CounterpartyResolutionSchema: () => CounterpartyResolutionSchema,
34
37
  CounterpartyTypeSchema: () => CounterpartyTypeSchema,
35
38
  DEFAULT_CHAT_MODEL: () => DEFAULT_CHAT_MODEL,
39
+ DEFAULT_DEVICE_CONFIG: () => DEFAULT_DEVICE_CONFIG,
40
+ DEFAULT_HORIZON_QUARTERS: () => DEFAULT_HORIZON_QUARTERS,
36
41
  DEFAULT_PRO_MODEL: () => DEFAULT_PRO_MODEL,
37
42
  DEFAULT_SCHEMA_MODEL: () => DEFAULT_SCHEMA_MODEL,
38
43
  DEFAULT_THEME_TOKENS: () => DEFAULT_THEME_TOKENS,
44
+ DEVICE_AP_SSID_PREFIX: () => DEVICE_AP_SSID_PREFIX,
45
+ DEVICE_ENDPOINTS: () => DEVICE_ENDPOINTS,
46
+ DailyPricePointSchema: () => DailyPricePointSchema,
47
+ DeviceAppIdSchema: () => DeviceAppIdSchema,
48
+ DeviceAppsSchema: () => DeviceAppsSchema,
49
+ DeviceConfigSchema: () => DeviceConfigSchema,
50
+ DeviceDisplayConfigSchema: () => DeviceDisplayConfigSchema,
51
+ DeviceKindSchema: () => DeviceKindSchema,
52
+ DeviceStatusSchema: () => DeviceStatusSchema,
53
+ DeviceThemeSchema: () => DeviceThemeSchema,
39
54
  DivergenceMetricSchema: () => DivergenceMetricSchema,
55
+ EVENT_KIND_LABELS: () => EVENT_KIND_LABELS,
56
+ EXCLUDED_SOURCES: () => EXCLUDED_SOURCES,
57
+ EntityEventDensityBucketSchema: () => EntityEventDensityBucketSchema,
58
+ EntityEventDensitySchema: () => EntityEventDensitySchema,
59
+ EntityEventFacetSchema: () => EntityEventFacetSchema,
60
+ EntityEventFacetsSchema: () => EntityEventFacetsSchema,
61
+ EntityEventKindSchema: () => EntityEventKindSchema,
62
+ EntityEventSchema: () => EntityEventSchema,
63
+ EntityPriceSeriesSchema: () => EntityPriceSeriesSchema,
40
64
  EntitySchema: () => EntitySchema,
65
+ EventBucketSizeSchema: () => EventBucketSizeSchema,
66
+ EventSourceSchema: () => EventSourceSchema,
41
67
  FieldSchema: () => FieldSchema,
42
68
  FloraTelemetrySchema: () => FloraTelemetrySchema,
43
69
  GENESIS_LIBRARY_CONTEXT: () => GENESIS_LIBRARY_CONTEXT,
44
70
  GENESIS_VALID_COMPONENTS: () => GENESIS_VALID_COMPONENTS,
71
+ IMPACT_FLAG_THRESHOLD: () => IMPACT_FLAG_THRESHOLD,
72
+ ImpactScaleSchema: () => ImpactScaleSchema,
45
73
  NonPublicEntitySchema: () => NonPublicEntitySchema,
46
74
  PageSchema: () => PageSchema,
47
75
  PageSectionSchema: () => PageSectionSchema,
76
+ PaginatedEntityEventsSchema: () => PaginatedEntityEventsSchema,
77
+ ProvisioningStateSchema: () => ProvisioningStateSchema,
48
78
  RelationshipEdgeSchema: () => RelationshipEdgeSchema,
49
79
  RelationshipEdgeTypeSchema: () => RelationshipEdgeTypeSchema,
50
80
  ResourceSchema: () => ResourceSchema,
81
+ SENTIMENT_NEUTRAL: () => SENTIMENT_NEUTRAL,
51
82
  SIGNAL_DOMAINS: () => SIGNAL_DOMAINS,
52
83
  SIGNAL_KINDS: () => SIGNAL_KINDS,
53
84
  SIGNAL_KIND_LABELS: () => SIGNAL_KIND_LABELS,
54
85
  SIGNAL_SOURCES: () => SIGNAL_SOURCES,
86
+ SensorAppConfigSchema: () => SensorAppConfigSchema,
55
87
  SignalArraySchema: () => SignalArraySchema,
56
88
  SignalKindSchema: () => SignalKindSchema,
57
89
  SignalPacketSchema: () => SignalPacketSchema,
@@ -63,11 +95,16 @@ __export(index_exports, {
63
95
  ThemeFontsSchema: () => ThemeFontsSchema,
64
96
  ThemeOverridesSchema: () => ThemeOverridesSchema,
65
97
  ThemeTokensSchema: () => ThemeTokensSchema,
98
+ TimestampPrecisionSchema: () => TimestampPrecisionSchema,
66
99
  TriggerSchema: () => TriggerSchema,
67
100
  UserSchema: () => UserSchema,
101
+ WeatherAppConfigSchema: () => WeatherAppConfigSchema,
68
102
  WorkflowSchema: () => WorkflowSchema,
103
+ architectureReferenceParameters: () => architectureReferenceParameters,
69
104
  companyNewsParameters: () => companyNewsParameters,
70
105
  companyProfileParameters: () => companyProfileParameters,
106
+ counterpartyGraphParameters: () => counterpartyGraphParameters,
107
+ divergenceMetricsParameters: () => divergenceMetricsParameters,
71
108
  liveQuoteParameters: () => liveQuoteParameters,
72
109
  stockChartParameters: () => stockChartParameters,
73
110
  telemetryGraphParameters: () => telemetryGraphParameters
@@ -343,28 +380,165 @@ var BodewellCommandSchema = import_zod4.z.object({
343
380
  value: import_zod4.z.number()
344
381
  });
345
382
 
346
- // src/ai/tools.ts
383
+ // src/device/schema.ts
347
384
  var import_zod5 = require("zod");
348
- var telemetryGraphParameters = import_zod5.z.object({
349
- deviceId: import_zod5.z.string().min(1, "Device ID is required"),
350
- timeRange: import_zod5.z.enum(["1h", "24h", "7d"], {
385
+ var DeviceKindSchema = import_zod5.z.enum([
386
+ "esp32-touch-28",
387
+ // 2.8" 240x320 resistive touch, the workshop board
388
+ "esp32-headless",
389
+ // no display; sensor node
390
+ "simulator"
391
+ // browser-side stand-in, for building without hardware
392
+ ]);
393
+ var DeviceAppIdSchema = import_zod5.z.enum([
394
+ "weather",
395
+ "clock",
396
+ "aircraft",
397
+ "sensor",
398
+ "blank"
399
+ ]);
400
+ var WeatherAppConfigSchema = import_zod5.z.object({
401
+ /** Postal code is what a person knows; the portal resolves it to coordinates. */
402
+ postalCode: import_zod5.z.string().min(3).max(12),
403
+ latitude: import_zod5.z.number().min(-90).max(90).optional(),
404
+ longitude: import_zod5.z.number().min(-180).max(180).optional(),
405
+ units: import_zod5.z.enum(["imperial", "metric"]).default("imperial"),
406
+ showForecast: import_zod5.z.boolean().default(true),
407
+ refreshSeconds: import_zod5.z.number().int().min(300).max(86400).default(900)
408
+ });
409
+ var ClockAppConfigSchema = import_zod5.z.object({
410
+ /** IANA zone, e.g. "America/New_York". */
411
+ timezone: import_zod5.z.string().default("America/New_York"),
412
+ twentyFourHour: import_zod5.z.boolean().default(false),
413
+ showSeconds: import_zod5.z.boolean().default(false),
414
+ showDate: import_zod5.z.boolean().default(true)
415
+ });
416
+ var AircraftAppConfigSchema = import_zod5.z.object({
417
+ latitude: import_zod5.z.number().min(-90).max(90),
418
+ longitude: import_zod5.z.number().min(-180).max(180),
419
+ radiusKm: import_zod5.z.number().min(5).max(400).default(80),
420
+ /** Rows the list view can show before the screen runs out. */
421
+ maxRows: import_zod5.z.number().int().min(1).max(12).default(8),
422
+ refreshSeconds: import_zod5.z.number().int().min(10).max(600).default(30)
423
+ });
424
+ var SensorAppConfigSchema = import_zod5.z.object({
425
+ /** Signal keys to display, in order. Abstract keys per the Signal contract. */
426
+ keys: import_zod5.z.array(import_zod5.z.string()).min(1).max(6),
427
+ refreshSeconds: import_zod5.z.number().int().min(1).max(3600).default(10)
428
+ });
429
+ var DeviceAppsSchema = import_zod5.z.object({
430
+ weather: WeatherAppConfigSchema.optional(),
431
+ clock: ClockAppConfigSchema.optional(),
432
+ aircraft: AircraftAppConfigSchema.optional(),
433
+ sensor: SensorAppConfigSchema.optional()
434
+ });
435
+ var DeviceDisplayConfigSchema = import_zod5.z.object({
436
+ brightness: import_zod5.z.number().int().min(5).max(100).default(80),
437
+ /** Degrees clockwise. The board can sit either way up in a case. */
438
+ rotation: import_zod5.z.union([import_zod5.z.literal(0), import_zod5.z.literal(90), import_zod5.z.literal(180), import_zod5.z.literal(270)]).default(0),
439
+ /** Dim rather than sleep — a desk display that blanks looks broken. */
440
+ dimAfterSeconds: import_zod5.z.number().int().min(0).max(86400).default(0),
441
+ dimBrightness: import_zod5.z.number().int().min(0).max(100).default(15),
442
+ /** Local 24h times, e.g. "22:30". Empty disables night dimming. */
443
+ nightStart: import_zod5.z.string().regex(/^([01]\d|2[0-3]):[0-5]\d$/).optional(),
444
+ nightEnd: import_zod5.z.string().regex(/^([01]\d|2[0-3]):[0-5]\d$/).optional()
445
+ });
446
+ var RgbTripletSchema = import_zod5.z.string().regex(
447
+ /^\d{1,3} \d{1,3} \d{1,3}$/,
448
+ 'Expected space-separated RGB integers, e.g. "13 110 253"'
449
+ );
450
+ var DeviceThemeSchema = import_zod5.z.object({
451
+ preset: import_zod5.z.enum(["light", "dark", "corporate", "midnight", "blueprint", "custom"]).default("dark"),
452
+ background: RgbTripletSchema.optional(),
453
+ foreground: RgbTripletSchema.optional(),
454
+ accent: RgbTripletSchema.optional(),
455
+ muted: RgbTripletSchema.optional(),
456
+ warning: RgbTripletSchema.optional()
457
+ });
458
+ var DeviceConfigSchema = import_zod5.z.object({
459
+ /** Bumped only on breaking shape changes, so old firmware can refuse safely. */
460
+ schemaVersion: import_zod5.z.literal(1),
461
+ deviceId: import_zod5.z.string().min(1),
462
+ /** Monotonic. Portal increments on write; device echoes what it is running. */
463
+ revision: import_zod5.z.number().int().nonnegative(),
464
+ updatedAt: import_zod5.z.string().datetime().optional(),
465
+ activeApp: DeviceAppIdSchema,
466
+ apps: DeviceAppsSchema,
467
+ display: DeviceDisplayConfigSchema,
468
+ theme: DeviceThemeSchema
469
+ });
470
+ var ProvisioningStateSchema = import_zod5.z.enum([
471
+ "unprovisioned",
472
+ "connecting",
473
+ "online",
474
+ "offline",
475
+ "failed"
476
+ ]);
477
+ var DeviceStatusSchema = import_zod5.z.object({
478
+ deviceId: import_zod5.z.string().min(1),
479
+ kind: DeviceKindSchema,
480
+ firmwareVersion: import_zod5.z.string(),
481
+ /** Shown on the device's own screen at boot — how the user finds it. */
482
+ ipAddress: import_zod5.z.string().optional(),
483
+ provisioning: ProvisioningStateSchema,
484
+ /** Revision the device is actually running, not the one it was sent. */
485
+ configRevision: import_zod5.z.number().int().nonnegative(),
486
+ activeApp: DeviceAppIdSchema,
487
+ rssi: import_zod5.z.number().int().optional().describe("dBm"),
488
+ uptimeSeconds: import_zod5.z.number().int().nonnegative().optional(),
489
+ freeHeapBytes: import_zod5.z.number().int().nonnegative().optional()
490
+ });
491
+ var DEVICE_ENDPOINTS = {
492
+ /** GET → DeviceStatus */
493
+ status: "/api/status",
494
+ /** GET → DeviceConfig · POST DeviceConfig → applied + persisted */
495
+ config: "/api/config",
496
+ /** POST → clears stored credentials and returns to AP mode */
497
+ forget: "/api/forget"
498
+ };
499
+ var DEVICE_AP_SSID_PREFIX = "ramme-setup-";
500
+ var DEFAULT_DEVICE_CONFIG = {
501
+ schemaVersion: 1,
502
+ revision: 0,
503
+ activeApp: "clock",
504
+ apps: {},
505
+ display: {
506
+ brightness: 80,
507
+ rotation: 0,
508
+ dimAfterSeconds: 0,
509
+ dimBrightness: 15
510
+ },
511
+ theme: { preset: "dark" }
512
+ };
513
+
514
+ // src/ai/tools.ts
515
+ var import_zod6 = require("zod");
516
+ var telemetryGraphParameters = import_zod6.z.object({
517
+ deviceId: import_zod6.z.string().min(1, "Device ID is required"),
518
+ timeRange: import_zod6.z.enum(["1h", "24h", "7d"], {
351
519
  errorMap: () => ({ message: "Time range must be 1h, 24h, or 7d" })
352
520
  }),
353
- metrics: import_zod5.z.array(
354
- import_zod5.z.enum(["temperature", "humidity", "vwc", "ec", "ph", "pressure", "co2"])
521
+ metrics: import_zod6.z.array(
522
+ import_zod6.z.enum(["temperature", "humidity", "vwc", "ec", "ph", "pressure", "co2"])
355
523
  ).min(1, "At least one metric is required").max(4, "Maximum 4 metrics per graph")
356
524
  });
357
- var stockChartParameters = import_zod5.z.object({
358
- ticker: import_zod5.z.string().min(1).describe("The stock ticker symbol explicitly requested by the user. YOU MUST EXTRACT AND PROVIDE THIS (e.g., 'AAPL', 'MSFT')."),
359
- timeRange: import_zod5.z.enum(["1D", "1W", "1M", "1Y"], {
525
+ var stockChartParameters = import_zod6.z.object({
526
+ ticker: import_zod6.z.string().min(1).describe("The stock ticker symbol explicitly requested by the user. YOU MUST EXTRACT AND PROVIDE THIS (e.g., 'AAPL', 'MSFT')."),
527
+ timeRange: import_zod6.z.enum(["1D", "1W", "1M", "1Y"], {
360
528
  errorMap: () => ({ message: "Time range must be 1D, 1W, 1M, or 1Y" })
361
529
  }).describe("The time range for the chart. Choose based on user request or default to '1M'."),
362
- metrics: import_zod5.z.array(import_zod5.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.")
530
+ metrics: import_zod6.z.array(import_zod6.z.enum(["price", "volume", "moving_average"])).min(1, "At least one metric is required").describe("Array of metrics to display. Always include 'price' and 'volume' unless user specifies otherwise.")
531
+ });
532
+ var tickerParam = import_zod6.z.string().min(1).describe("The stock ticker symbol (e.g., 'AAPL', 'TSLA', 'MSFT').");
533
+ var liveQuoteParameters = import_zod6.z.object({ ticker: tickerParam });
534
+ var companyNewsParameters = import_zod6.z.object({ ticker: tickerParam });
535
+ var companyProfileParameters = import_zod6.z.object({ ticker: tickerParam });
536
+ var counterpartyGraphParameters = import_zod6.z.object({
537
+ ticker: tickerParam,
538
+ hops: import_zod6.z.number().int().min(1).max(2).optional().describe("How many relationship hops to traverse (1 = direct counterparties only, 2 = counterparties-of-counterparties too). Defaults to 1 if omitted.")
363
539
  });
364
- var tickerParam = import_zod5.z.string().min(1).describe("The stock ticker symbol (e.g., 'AAPL', 'TSLA', 'MSFT').");
365
- var liveQuoteParameters = import_zod5.z.object({ ticker: tickerParam });
366
- var companyNewsParameters = import_zod5.z.object({ ticker: tickerParam });
367
- var companyProfileParameters = import_zod5.z.object({ ticker: tickerParam });
540
+ var divergenceMetricsParameters = import_zod6.z.object({ ticker: tickerParam });
541
+ var architectureReferenceParameters = import_zod6.z.object({});
368
542
  var AI_TOOLS = {
369
543
  get_telemetry_graph: {
370
544
  name: "get_telemetry_graph",
@@ -390,6 +564,21 @@ var AI_TOOLS = {
390
564
  name: "get_company_profile",
391
565
  description: "Fetches fundamental company data including the business description, sector, industry, market cap, and P/E ratio.",
392
566
  parameters: companyProfileParameters
567
+ },
568
+ get_counterparty_graph: {
569
+ name: "get_counterparty_graph",
570
+ 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.",
571
+ parameters: counterpartyGraphParameters
572
+ },
573
+ get_divergence_metrics: {
574
+ name: "get_divergence_metrics",
575
+ 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.",
576
+ parameters: divergenceMetricsParameters
577
+ },
578
+ get_architecture_reference: {
579
+ name: "get_architecture_reference",
580
+ 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.",
581
+ parameters: architectureReferenceParameters
393
582
  }
394
583
  };
395
584
 
@@ -575,12 +764,12 @@ use bg-card or bg-background as a safe fallback. NEVER invent raw colors.
575
764
  `;
576
765
 
577
766
  // src/theme/schema.ts
578
- var import_zod6 = require("zod");
579
- var RGBString = import_zod6.z.string().regex(
767
+ var import_zod7 = require("zod");
768
+ var RGBString = import_zod7.z.string().regex(
580
769
  /^\d{1,3}\s+\d{1,3}\s+\d{1,3}$/,
581
770
  'Must be space-separated RGB integers (e.g. "13 110 253")'
582
771
  );
583
- var ThemeOverridesSchema = import_zod6.z.object({
772
+ var ThemeOverridesSchema = import_zod7.z.object({
584
773
  // ── Core Brand ───────────────────────────────────────────────────────────
585
774
  "--app-primary-color": RGBString.optional(),
586
775
  "--app-primary-foreground-color": RGBString.optional(),
@@ -596,9 +785,9 @@ var ThemeOverridesSchema = import_zod6.z.object({
596
785
  "--app-muted-bg": RGBString.optional(),
597
786
  "--app-muted-text": RGBString.optional(),
598
787
  // ── Shape ────────────────────────────────────────────────────────────────
599
- "--app-border-radius-sm": import_zod6.z.string().optional(),
600
- "--app-border-radius-md": import_zod6.z.string().optional(),
601
- "--app-border-radius-lg": import_zod6.z.string().optional(),
788
+ "--app-border-radius-sm": import_zod7.z.string().optional(),
789
+ "--app-border-radius-md": import_zod7.z.string().optional(),
790
+ "--app-border-radius-lg": import_zod7.z.string().optional(),
602
791
  // ── Form Controls ────────────────────────────────────────────────────────
603
792
  "--app-input-bg-color": RGBString.optional(),
604
793
  "--app-input-text-color": RGBString.optional(),
@@ -612,19 +801,19 @@ var ThemeOverridesSchema = import_zod6.z.object({
612
801
  "--app-chart-4": RGBString.optional(),
613
802
  "--app-chart-5": RGBString.optional()
614
803
  }).strict();
615
- var ThemeFontsSchema = import_zod6.z.object({
804
+ var ThemeFontsSchema = import_zod7.z.object({
616
805
  /** Google Font name for headings (h1–h4, .font-serif). Example: "Playfair Display" */
617
- heading: import_zod6.z.string(),
806
+ heading: import_zod7.z.string(),
618
807
  /** Google Font name for body text. Example: "Inter" */
619
- body: import_zod6.z.string(),
808
+ body: import_zod7.z.string(),
620
809
  /** Optional monospace font. Example: "Roboto Mono" */
621
- mono: import_zod6.z.string().optional()
810
+ mono: import_zod7.z.string().optional()
622
811
  });
623
- var AIThemeSchema = import_zod6.z.object({
812
+ var AIThemeSchema = import_zod7.z.object({
624
813
  /** Short descriptive theme name. Example: "Midnight Garden" */
625
- name: import_zod6.z.string(),
814
+ name: import_zod7.z.string(),
626
815
  /** One-sentence vibe description. Example: "Dark indigo with golden accents." */
627
- description: import_zod6.z.string(),
816
+ description: import_zod7.z.string(),
628
817
  /** Google Font pairing for heading and body text. */
629
818
  fonts: ThemeFontsSchema.optional(),
630
819
  /**
@@ -635,13 +824,13 @@ var AIThemeSchema = import_zod6.z.object({
635
824
  cssVars: ThemeOverridesSchema
636
825
  });
637
826
  var THEME_PRESETS = ["light", "dark", "system", "corporate", "midnight", "blueprint"];
638
- var ThemeTokensSchema = import_zod6.z.object({
827
+ var ThemeTokensSchema = import_zod7.z.object({
639
828
  primary: RGBString,
640
829
  neutral: RGBString,
641
830
  success: RGBString,
642
831
  warning: RGBString,
643
832
  destructive: RGBString,
644
- radius: import_zod6.z.enum(["none", "sm", "md", "lg", "full"])
833
+ radius: import_zod7.z.enum(["none", "sm", "md", "lg", "full"])
645
834
  });
646
835
  var DEFAULT_THEME_TOKENS = {
647
836
  primary: "13 110 253",
@@ -653,22 +842,22 @@ var DEFAULT_THEME_TOKENS = {
653
842
  };
654
843
 
655
844
  // src/auth/schema.ts
656
- var import_zod7 = require("zod");
657
- var UserSchema = import_zod7.z.object({
658
- id: import_zod7.z.string().default(""),
659
- name: import_zod7.z.string(),
660
- email: import_zod7.z.string().email(),
661
- password: import_zod7.z.string().optional(),
662
- role: import_zod7.z.string(),
663
- status: import_zod7.z.string().optional(),
664
- joinedAt: import_zod7.z.string().optional(),
665
- lastActive: import_zod7.z.string().optional(),
666
- avatarUrl: import_zod7.z.string().optional()
845
+ var import_zod8 = require("zod");
846
+ var UserSchema = import_zod8.z.object({
847
+ id: import_zod8.z.string().default(""),
848
+ name: import_zod8.z.string(),
849
+ email: import_zod8.z.string().email(),
850
+ password: import_zod8.z.string().optional(),
851
+ role: import_zod8.z.string(),
852
+ status: import_zod8.z.string().optional(),
853
+ joinedAt: import_zod8.z.string().optional(),
854
+ lastActive: import_zod8.z.string().optional(),
855
+ avatarUrl: import_zod8.z.string().optional()
667
856
  });
668
857
 
669
858
  // src/counterparty/schema.ts
670
- var import_zod8 = require("zod");
671
- var CounterpartyTypeSchema = import_zod8.z.enum([
859
+ var import_zod9 = require("zod");
860
+ var CounterpartyTypeSchema = import_zod9.z.enum([
672
861
  "supplier",
673
862
  "customer",
674
863
  "partner",
@@ -676,58 +865,184 @@ var CounterpartyTypeSchema = import_zod8.z.enum([
676
865
  "regulator",
677
866
  "unknown"
678
867
  ]);
679
- var CounterpartyNodeSchema = import_zod8.z.object({
680
- id: import_zod8.z.string(),
681
- ticker: import_zod8.z.string().nullable(),
682
- name: import_zod8.z.string(),
868
+ var CounterpartyResolutionSchema = import_zod9.z.enum([
869
+ "public",
870
+ "public_uncovered",
871
+ "private",
872
+ "unresolved"
873
+ ]);
874
+ var CounterpartyNodeSchema = import_zod9.z.object({
875
+ id: import_zod9.z.string(),
876
+ ticker: import_zod9.z.string().nullable(),
877
+ /** Name as it appeared in the source signal — e.g. "Nike". Not the registered name. */
878
+ name: import_zod9.z.string(),
879
+ /** Registered legal name from `profiles` — e.g. "NIKE, Inc.". Null unless `public`. */
880
+ publicName: import_zod9.z.string().nullable(),
881
+ lei: import_zod9.z.string().nullable(),
882
+ resolution: CounterpartyResolutionSchema,
683
883
  type: CounterpartyTypeSchema,
684
- confidence: import_zod8.z.number().min(0).max(1),
685
- sourceSignalIds: import_zod8.z.array(import_zod8.z.number()),
686
- firstSeenAt: import_zod8.z.string().datetime(),
687
- lastSeenAt: import_zod8.z.string().datetime()
884
+ confidence: import_zod9.z.number().min(0).max(1),
885
+ sourceSignalIds: import_zod9.z.array(import_zod9.z.number()),
886
+ firstSeenAt: import_zod9.z.string().datetime(),
887
+ lastSeenAt: import_zod9.z.string().datetime()
688
888
  });
689
- var RelationshipEdgeTypeSchema = import_zod8.z.enum([
889
+ var RelationshipEdgeTypeSchema = import_zod9.z.enum([
690
890
  "supplies_to",
691
891
  "purchases_from",
692
892
  "partners_with",
693
893
  "competes_with",
694
- "regulated_by"
894
+ "regulated_by",
895
+ "invests_in",
896
+ "acquires",
897
+ /**
898
+ * Identity equivalence, not a business relationship: source and target are
899
+ * the same real-world entity under two different node ids (typically a
900
+ * slug-keyed node that predates LEI resolution, pointing at the canonical
901
+ * LEI-keyed node once resolution succeeds). Never delete/merge either
902
+ * node — this edge exists so a consumer wanting a deduped view can follow
903
+ * it to the canonical id, reversibly.
904
+ */
905
+ "same_as"
695
906
  ]);
696
- var RelationshipEdgeSchema = import_zod8.z.object({
697
- id: import_zod8.z.string(),
698
- sourceId: import_zod8.z.string(),
699
- targetId: import_zod8.z.string(),
907
+ var RelationshipEdgeSchema = import_zod9.z.object({
908
+ id: import_zod9.z.string(),
909
+ sourceId: import_zod9.z.string(),
910
+ targetId: import_zod9.z.string(),
700
911
  edgeType: RelationshipEdgeTypeSchema,
701
- weight: import_zod8.z.number().min(0).max(1),
702
- evidenceSignalIds: import_zod8.z.array(import_zod8.z.number()),
703
- updatedAt: import_zod8.z.string().datetime()
704
- });
705
- var SignalWeightSchema = import_zod8.z.object({
706
- signalId: import_zod8.z.number(),
707
- weight: import_zod8.z.number().min(0).max(1),
708
- reason: import_zod8.z.string().max(280)
709
- });
710
- var DivergenceMetricSchema = import_zod8.z.object({
711
- ticker: import_zod8.z.string(),
712
- metric: import_zod8.z.enum(["operational", "ux"]),
713
- score: import_zod8.z.number(),
714
- baseline: import_zod8.z.number(),
715
- observed: import_zod8.z.number(),
716
- computedAt: import_zod8.z.string().datetime(),
717
- contributingSignals: import_zod8.z.array(SignalWeightSchema)
912
+ weight: import_zod9.z.number().min(0).max(1),
913
+ evidenceSignalIds: import_zod9.z.array(import_zod9.z.number()),
914
+ updatedAt: import_zod9.z.string().datetime(),
915
+ validFrom: import_zod9.z.string().datetime(),
916
+ /** null = currently valid. Set when a differently-typed edge supersedes this one. */
917
+ validTo: import_zod9.z.string().datetime().nullable()
918
+ });
919
+ var SignalWeightSchema = import_zod9.z.object({
920
+ signalId: import_zod9.z.number(),
921
+ weight: import_zod9.z.number().min(0).max(1),
922
+ reason: import_zod9.z.string().max(280)
923
+ });
924
+ var DivergenceMetricSchema = import_zod9.z.object({
925
+ ticker: import_zod9.z.string(),
926
+ // 'operations'/'customer' are current; 'operational'/'ux' are pre-rename
927
+ // values that still exist on rows written before the backend's rename —
928
+ // kept here so reading old rows doesn't fail validation.
929
+ metric: import_zod9.z.enum(["operations", "customer", "operational", "ux"]),
930
+ score: import_zod9.z.number(),
931
+ baseline: import_zod9.z.number(),
932
+ observed: import_zod9.z.number(),
933
+ computedAt: import_zod9.z.string().datetime(),
934
+ contributingSignals: import_zod9.z.array(SignalWeightSchema)
718
935
  });
719
936
 
720
937
  // src/non-public-entity/schema.ts
721
- var import_zod9 = require("zod");
722
- var NonPublicEntitySchema = import_zod9.z.object({
723
- lei: import_zod9.z.string().nullable(),
724
- entityName: import_zod9.z.string(),
725
- jurisdiction: import_zod9.z.string().nullable(),
726
- registrationStatus: import_zod9.z.string(),
727
- parentEntityLei: import_zod9.z.string().nullable(),
728
- materialMetadata: import_zod9.z.record(import_zod9.z.unknown()),
729
- discoveredAt: import_zod9.z.string().datetime()
938
+ var import_zod10 = require("zod");
939
+ var NonPublicEntitySchema = import_zod10.z.object({
940
+ lei: import_zod10.z.string().nullable(),
941
+ entityName: import_zod10.z.string(),
942
+ jurisdiction: import_zod10.z.string().nullable(),
943
+ registrationStatus: import_zod10.z.string(),
944
+ parentEntityLei: import_zod10.z.string().nullable(),
945
+ materialMetadata: import_zod10.z.record(import_zod10.z.unknown()),
946
+ discoveredAt: import_zod10.z.string().datetime()
730
947
  });
948
+
949
+ // src/events/schema.ts
950
+ var import_zod11 = require("zod");
951
+ var EventSourceSchema = import_zod11.z.enum(["db", "mock"]);
952
+ var EntityEventKindSchema = import_zod11.z.enum(["news", "filing", "report"]);
953
+ var ImpactScaleSchema = import_zod11.z.enum(["graded", "binary", "default", "none"]);
954
+ var TimestampPrecisionSchema = import_zod11.z.enum(["second", "day"]);
955
+ var EntityEventSchema = import_zod11.z.object({
956
+ /** Namespaced so ids never collide across sources: `news:1234`, `filing:AAPL:2026-07-31`. */
957
+ id: import_zod11.z.string(),
958
+ kind: EntityEventKindSchema,
959
+ /**
960
+ * The producer's own type string, unmodified — `NEWS_YAHOO FINANCE_YAHOO RSS`,
961
+ * `ANNUAL`, `SNAPSHOT`. There are 31 distinct NEWS variants in the live table,
962
+ * so this is for filtering and debugging: never render it raw to a user.
963
+ */
964
+ subtype: import_zod11.z.string().nullable(),
965
+ ticker: import_zod11.z.string(),
966
+ /** Always `YYYY-MM-DDTHH:MM:SSZ`. Fixed-width, so lexical order == chronological order. */
967
+ occurredAt: import_zod11.z.string(),
968
+ precision: TimestampPrecisionSchema,
969
+ title: import_zod11.z.string(),
970
+ summary: import_zod11.z.string().nullable(),
971
+ url: import_zod11.z.string().nullable(),
972
+ impact: import_zod11.z.number().nullable(),
973
+ impactScale: ImpactScaleSchema,
974
+ /** 0 bearish … 50 neutral … 100 bullish. */
975
+ sentiment: import_zod11.z.number().nullable(),
976
+ /** False for filings, and for any event sitting at exactly neutral. */
977
+ sentimentIsMeaningful: import_zod11.z.boolean(),
978
+ source: EventSourceSchema,
979
+ meta: import_zod11.z.record(import_zod11.z.unknown()).nullable()
980
+ });
981
+ var PaginatedEntityEventsSchema = import_zod11.z.object({
982
+ total: import_zod11.z.number(),
983
+ page: import_zod11.z.number(),
984
+ page_size: import_zod11.z.number(),
985
+ data: import_zod11.z.array(EntityEventSchema)
986
+ });
987
+ var EventBucketSizeSchema = import_zod11.z.enum(["day", "week", "month"]);
988
+ var EntityEventDensityBucketSchema = import_zod11.z.object({
989
+ bucketStart: import_zod11.z.string(),
990
+ kind: EntityEventKindSchema,
991
+ count: import_zod11.z.number(),
992
+ /** Null when no event in the bucket had meaningful sentiment. */
993
+ avgSentiment: import_zod11.z.number().nullable(),
994
+ maxImpact: import_zod11.z.number().nullable()
995
+ });
996
+ var EntityEventDensitySchema = import_zod11.z.object({
997
+ ticker: import_zod11.z.string(),
998
+ bucket: EventBucketSizeSchema,
999
+ buckets: import_zod11.z.array(EntityEventDensityBucketSchema),
1000
+ /** So the client can set its time domain without a second request. */
1001
+ range: import_zod11.z.object({ min: import_zod11.z.string(), max: import_zod11.z.string() }),
1002
+ source: EventSourceSchema
1003
+ });
1004
+ var EntityEventFacetSchema = import_zod11.z.object({
1005
+ kind: EntityEventKindSchema,
1006
+ count: import_zod11.z.number(),
1007
+ earliest: import_zod11.z.string().nullable(),
1008
+ latest: import_zod11.z.string().nullable(),
1009
+ impactScale: ImpactScaleSchema,
1010
+ sentimentUsable: import_zod11.z.boolean()
1011
+ });
1012
+ var EntityEventFacetsSchema = import_zod11.z.object({
1013
+ ticker: import_zod11.z.string(),
1014
+ facets: import_zod11.z.array(EntityEventFacetSchema),
1015
+ source: EventSourceSchema
1016
+ });
1017
+ var DailyPricePointSchema = import_zod11.z.object({
1018
+ date: import_zod11.z.string(),
1019
+ open: import_zod11.z.number().nullable(),
1020
+ high: import_zod11.z.number().nullable(),
1021
+ low: import_zod11.z.number().nullable(),
1022
+ close: import_zod11.z.number(),
1023
+ volume: import_zod11.z.number().nullable()
1024
+ });
1025
+ var EntityPriceSeriesSchema = import_zod11.z.object({
1026
+ ticker: import_zod11.z.string(),
1027
+ series: import_zod11.z.array(DailyPricePointSchema),
1028
+ source: EventSourceSchema
1029
+ });
1030
+ var EVENT_KIND_LABELS = {
1031
+ news: "News",
1032
+ filing: "Filing",
1033
+ report: "Analyst report"
1034
+ };
1035
+ var IMPACT_FLAG_THRESHOLD = 7;
1036
+ var SENTIMENT_NEUTRAL = 50;
1037
+ var DEFAULT_HORIZON_QUARTERS = 5;
1038
+ var EXCLUDED_SOURCES = {
1039
+ 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.",
1040
+ divergence_metrics: "A continuously recomputed annotation, not an event: 524 AAPL rows in 2 days.",
1041
+ 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.",
1042
+ raw_filings: "Stale since April, superseded by signals.",
1043
+ market_metrics: "Two rows total.",
1044
+ job_log: "24.5M rows with no ticker index \u2014 never touch it in a request path."
1045
+ };
731
1046
  // Annotate the CommonJS export names for ESM import in node:
732
1047
  0 && (module.exports = {
733
1048
  AIKeyManifestSchema,
@@ -735,33 +1050,65 @@ var NonPublicEntitySchema = import_zod9.z.object({
735
1050
  AI_ROSTER,
736
1051
  AI_TOOLS,
737
1052
  ActionSchema,
1053
+ AircraftAppConfigSchema,
738
1054
  AppSignalSchema,
739
1055
  AppSpecificationSchema,
740
1056
  AuthStrategySchema,
741
1057
  BlockSchema,
742
1058
  Bodewell,
1059
+ ClockAppConfigSchema,
743
1060
  CounterpartyNodeSchema,
1061
+ CounterpartyResolutionSchema,
744
1062
  CounterpartyTypeSchema,
745
1063
  DEFAULT_CHAT_MODEL,
1064
+ DEFAULT_DEVICE_CONFIG,
1065
+ DEFAULT_HORIZON_QUARTERS,
746
1066
  DEFAULT_PRO_MODEL,
747
1067
  DEFAULT_SCHEMA_MODEL,
748
1068
  DEFAULT_THEME_TOKENS,
1069
+ DEVICE_AP_SSID_PREFIX,
1070
+ DEVICE_ENDPOINTS,
1071
+ DailyPricePointSchema,
1072
+ DeviceAppIdSchema,
1073
+ DeviceAppsSchema,
1074
+ DeviceConfigSchema,
1075
+ DeviceDisplayConfigSchema,
1076
+ DeviceKindSchema,
1077
+ DeviceStatusSchema,
1078
+ DeviceThemeSchema,
749
1079
  DivergenceMetricSchema,
1080
+ EVENT_KIND_LABELS,
1081
+ EXCLUDED_SOURCES,
1082
+ EntityEventDensityBucketSchema,
1083
+ EntityEventDensitySchema,
1084
+ EntityEventFacetSchema,
1085
+ EntityEventFacetsSchema,
1086
+ EntityEventKindSchema,
1087
+ EntityEventSchema,
1088
+ EntityPriceSeriesSchema,
750
1089
  EntitySchema,
1090
+ EventBucketSizeSchema,
1091
+ EventSourceSchema,
751
1092
  FieldSchema,
752
1093
  FloraTelemetrySchema,
753
1094
  GENESIS_LIBRARY_CONTEXT,
754
1095
  GENESIS_VALID_COMPONENTS,
1096
+ IMPACT_FLAG_THRESHOLD,
1097
+ ImpactScaleSchema,
755
1098
  NonPublicEntitySchema,
756
1099
  PageSchema,
757
1100
  PageSectionSchema,
1101
+ PaginatedEntityEventsSchema,
1102
+ ProvisioningStateSchema,
758
1103
  RelationshipEdgeSchema,
759
1104
  RelationshipEdgeTypeSchema,
760
1105
  ResourceSchema,
1106
+ SENTIMENT_NEUTRAL,
761
1107
  SIGNAL_DOMAINS,
762
1108
  SIGNAL_KINDS,
763
1109
  SIGNAL_KIND_LABELS,
764
1110
  SIGNAL_SOURCES,
1111
+ SensorAppConfigSchema,
765
1112
  SignalArraySchema,
766
1113
  SignalKindSchema,
767
1114
  SignalPacketSchema,
@@ -773,11 +1120,16 @@ var NonPublicEntitySchema = import_zod9.z.object({
773
1120
  ThemeFontsSchema,
774
1121
  ThemeOverridesSchema,
775
1122
  ThemeTokensSchema,
1123
+ TimestampPrecisionSchema,
776
1124
  TriggerSchema,
777
1125
  UserSchema,
1126
+ WeatherAppConfigSchema,
778
1127
  WorkflowSchema,
1128
+ architectureReferenceParameters,
779
1129
  companyNewsParameters,
780
1130
  companyProfileParameters,
1131
+ counterpartyGraphParameters,
1132
+ divergenceMetricsParameters,
781
1133
  liveQuoteParameters,
782
1134
  stockChartParameters,
783
1135
  telemetryGraphParameters