@ramme-io/shared 3.1.0 → 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,40 +25,87 @@ __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,
35
+ CounterpartyNodeSchema: () => CounterpartyNodeSchema,
36
+ CounterpartyResolutionSchema: () => CounterpartyResolutionSchema,
37
+ CounterpartyTypeSchema: () => CounterpartyTypeSchema,
33
38
  DEFAULT_CHAT_MODEL: () => DEFAULT_CHAT_MODEL,
39
+ DEFAULT_DEVICE_CONFIG: () => DEFAULT_DEVICE_CONFIG,
40
+ DEFAULT_HORIZON_QUARTERS: () => DEFAULT_HORIZON_QUARTERS,
34
41
  DEFAULT_PRO_MODEL: () => DEFAULT_PRO_MODEL,
35
42
  DEFAULT_SCHEMA_MODEL: () => DEFAULT_SCHEMA_MODEL,
36
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,
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,
37
64
  EntitySchema: () => EntitySchema,
65
+ EventBucketSizeSchema: () => EventBucketSizeSchema,
66
+ EventSourceSchema: () => EventSourceSchema,
38
67
  FieldSchema: () => FieldSchema,
39
68
  FloraTelemetrySchema: () => FloraTelemetrySchema,
40
69
  GENESIS_LIBRARY_CONTEXT: () => GENESIS_LIBRARY_CONTEXT,
41
70
  GENESIS_VALID_COMPONENTS: () => GENESIS_VALID_COMPONENTS,
71
+ IMPACT_FLAG_THRESHOLD: () => IMPACT_FLAG_THRESHOLD,
72
+ ImpactScaleSchema: () => ImpactScaleSchema,
73
+ NonPublicEntitySchema: () => NonPublicEntitySchema,
42
74
  PageSchema: () => PageSchema,
43
75
  PageSectionSchema: () => PageSectionSchema,
76
+ PaginatedEntityEventsSchema: () => PaginatedEntityEventsSchema,
77
+ ProvisioningStateSchema: () => ProvisioningStateSchema,
78
+ RelationshipEdgeSchema: () => RelationshipEdgeSchema,
79
+ RelationshipEdgeTypeSchema: () => RelationshipEdgeTypeSchema,
44
80
  ResourceSchema: () => ResourceSchema,
81
+ SENTIMENT_NEUTRAL: () => SENTIMENT_NEUTRAL,
45
82
  SIGNAL_DOMAINS: () => SIGNAL_DOMAINS,
46
83
  SIGNAL_KINDS: () => SIGNAL_KINDS,
47
84
  SIGNAL_KIND_LABELS: () => SIGNAL_KIND_LABELS,
48
85
  SIGNAL_SOURCES: () => SIGNAL_SOURCES,
86
+ SensorAppConfigSchema: () => SensorAppConfigSchema,
49
87
  SignalArraySchema: () => SignalArraySchema,
50
88
  SignalKindSchema: () => SignalKindSchema,
51
89
  SignalPacketSchema: () => SignalPacketSchema,
52
90
  SignalSchema: () => SignalSchema,
53
91
  SignalSourceSchema: () => SignalSourceSchema,
92
+ SignalWeightSchema: () => SignalWeightSchema,
54
93
  THEME_PRESETS: () => THEME_PRESETS,
55
94
  THEME_SYSTEM_PROMPT: () => THEME_SYSTEM_PROMPT,
56
95
  ThemeFontsSchema: () => ThemeFontsSchema,
57
96
  ThemeOverridesSchema: () => ThemeOverridesSchema,
58
97
  ThemeTokensSchema: () => ThemeTokensSchema,
98
+ TimestampPrecisionSchema: () => TimestampPrecisionSchema,
59
99
  TriggerSchema: () => TriggerSchema,
60
100
  UserSchema: () => UserSchema,
101
+ WeatherAppConfigSchema: () => WeatherAppConfigSchema,
61
102
  WorkflowSchema: () => WorkflowSchema,
103
+ architectureReferenceParameters: () => architectureReferenceParameters,
104
+ companyNewsParameters: () => companyNewsParameters,
105
+ companyProfileParameters: () => companyProfileParameters,
106
+ counterpartyGraphParameters: () => counterpartyGraphParameters,
107
+ divergenceMetricsParameters: () => divergenceMetricsParameters,
108
+ liveQuoteParameters: () => liveQuoteParameters,
62
109
  stockChartParameters: () => stockChartParameters,
63
110
  telemetryGraphParameters: () => telemetryGraphParameters
64
111
  });
@@ -333,24 +380,165 @@ var BodewellCommandSchema = import_zod4.z.object({
333
380
  value: import_zod4.z.number()
334
381
  });
335
382
 
336
- // src/ai/tools.ts
383
+ // src/device/schema.ts
337
384
  var import_zod5 = require("zod");
338
- var telemetryGraphParameters = import_zod5.z.object({
339
- deviceId: import_zod5.z.string().min(1, "Device ID is required"),
340
- 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"], {
341
519
  errorMap: () => ({ message: "Time range must be 1h, 24h, or 7d" })
342
520
  }),
343
- metrics: import_zod5.z.array(
344
- 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"])
345
523
  ).min(1, "At least one metric is required").max(4, "Maximum 4 metrics per graph")
346
524
  });
347
- var stockChartParameters = import_zod5.z.object({
348
- 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')."),
349
- 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"], {
350
528
  errorMap: () => ({ message: "Time range must be 1D, 1W, 1M, or 1Y" })
351
529
  }).describe("The time range for the chart. Choose based on user request or default to '1M'."),
352
- 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.")
353
539
  });
540
+ var divergenceMetricsParameters = import_zod6.z.object({ ticker: tickerParam });
541
+ var architectureReferenceParameters = import_zod6.z.object({});
354
542
  var AI_TOOLS = {
355
543
  get_telemetry_graph: {
356
544
  name: "get_telemetry_graph",
@@ -361,6 +549,36 @@ var AI_TOOLS = {
361
549
  name: "get_stock_chart",
362
550
  description: "Displays an interactive financial chart with price movements, volume, and technical indicators. Use this when the user asks to visualize stock performance, analyze price trends, or compare financial metrics over time. Supports daily (1D), weekly (1W), monthly (1M), and yearly (1Y) time ranges.",
363
551
  parameters: stockChartParameters
552
+ },
553
+ get_live_quote: {
554
+ name: "get_live_quote",
555
+ description: "Fetches and displays the real-time stock price and daily change percentage for a given company ticker symbol.",
556
+ parameters: liveQuoteParameters
557
+ },
558
+ get_company_news: {
559
+ name: "get_company_news",
560
+ description: "Fetches and displays the 5 most recent news headlines and sentiment impact scores for a given company ticker symbol.",
561
+ parameters: companyNewsParameters
562
+ },
563
+ get_company_profile: {
564
+ name: "get_company_profile",
565
+ description: "Fetches fundamental company data including the business description, sector, industry, market cap, and P/E ratio.",
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
364
582
  }
365
583
  };
366
584
 
@@ -546,12 +764,12 @@ use bg-card or bg-background as a safe fallback. NEVER invent raw colors.
546
764
  `;
547
765
 
548
766
  // src/theme/schema.ts
549
- var import_zod6 = require("zod");
550
- var RGBString = import_zod6.z.string().regex(
767
+ var import_zod7 = require("zod");
768
+ var RGBString = import_zod7.z.string().regex(
551
769
  /^\d{1,3}\s+\d{1,3}\s+\d{1,3}$/,
552
770
  'Must be space-separated RGB integers (e.g. "13 110 253")'
553
771
  );
554
- var ThemeOverridesSchema = import_zod6.z.object({
772
+ var ThemeOverridesSchema = import_zod7.z.object({
555
773
  // ── Core Brand ───────────────────────────────────────────────────────────
556
774
  "--app-primary-color": RGBString.optional(),
557
775
  "--app-primary-foreground-color": RGBString.optional(),
@@ -567,9 +785,9 @@ var ThemeOverridesSchema = import_zod6.z.object({
567
785
  "--app-muted-bg": RGBString.optional(),
568
786
  "--app-muted-text": RGBString.optional(),
569
787
  // ── Shape ────────────────────────────────────────────────────────────────
570
- "--app-border-radius-sm": import_zod6.z.string().optional(),
571
- "--app-border-radius-md": import_zod6.z.string().optional(),
572
- "--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(),
573
791
  // ── Form Controls ────────────────────────────────────────────────────────
574
792
  "--app-input-bg-color": RGBString.optional(),
575
793
  "--app-input-text-color": RGBString.optional(),
@@ -583,19 +801,19 @@ var ThemeOverridesSchema = import_zod6.z.object({
583
801
  "--app-chart-4": RGBString.optional(),
584
802
  "--app-chart-5": RGBString.optional()
585
803
  }).strict();
586
- var ThemeFontsSchema = import_zod6.z.object({
804
+ var ThemeFontsSchema = import_zod7.z.object({
587
805
  /** Google Font name for headings (h1–h4, .font-serif). Example: "Playfair Display" */
588
- heading: import_zod6.z.string(),
806
+ heading: import_zod7.z.string(),
589
807
  /** Google Font name for body text. Example: "Inter" */
590
- body: import_zod6.z.string(),
808
+ body: import_zod7.z.string(),
591
809
  /** Optional monospace font. Example: "Roboto Mono" */
592
- mono: import_zod6.z.string().optional()
810
+ mono: import_zod7.z.string().optional()
593
811
  });
594
- var AIThemeSchema = import_zod6.z.object({
812
+ var AIThemeSchema = import_zod7.z.object({
595
813
  /** Short descriptive theme name. Example: "Midnight Garden" */
596
- name: import_zod6.z.string(),
814
+ name: import_zod7.z.string(),
597
815
  /** One-sentence vibe description. Example: "Dark indigo with golden accents." */
598
- description: import_zod6.z.string(),
816
+ description: import_zod7.z.string(),
599
817
  /** Google Font pairing for heading and body text. */
600
818
  fonts: ThemeFontsSchema.optional(),
601
819
  /**
@@ -606,13 +824,13 @@ var AIThemeSchema = import_zod6.z.object({
606
824
  cssVars: ThemeOverridesSchema
607
825
  });
608
826
  var THEME_PRESETS = ["light", "dark", "system", "corporate", "midnight", "blueprint"];
609
- var ThemeTokensSchema = import_zod6.z.object({
827
+ var ThemeTokensSchema = import_zod7.z.object({
610
828
  primary: RGBString,
611
829
  neutral: RGBString,
612
830
  success: RGBString,
613
831
  warning: RGBString,
614
832
  destructive: RGBString,
615
- radius: import_zod6.z.enum(["none", "sm", "md", "lg", "full"])
833
+ radius: import_zod7.z.enum(["none", "sm", "md", "lg", "full"])
616
834
  });
617
835
  var DEFAULT_THEME_TOKENS = {
618
836
  primary: "13 110 253",
@@ -624,18 +842,207 @@ var DEFAULT_THEME_TOKENS = {
624
842
  };
625
843
 
626
844
  // src/auth/schema.ts
627
- var import_zod7 = require("zod");
628
- var UserSchema = import_zod7.z.object({
629
- id: import_zod7.z.string().default(""),
630
- name: import_zod7.z.string(),
631
- email: import_zod7.z.string().email(),
632
- password: import_zod7.z.string().optional(),
633
- role: import_zod7.z.string(),
634
- status: import_zod7.z.string().optional(),
635
- joinedAt: import_zod7.z.string().optional(),
636
- lastActive: import_zod7.z.string().optional(),
637
- 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()
856
+ });
857
+
858
+ // src/counterparty/schema.ts
859
+ var import_zod9 = require("zod");
860
+ var CounterpartyTypeSchema = import_zod9.z.enum([
861
+ "supplier",
862
+ "customer",
863
+ "partner",
864
+ "competitor",
865
+ "regulator",
866
+ "unknown"
867
+ ]);
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,
883
+ type: CounterpartyTypeSchema,
884
+ confidence: import_zod9.z.number().min(0).max(1),
885
+ sourceSignalIds: import_zod9.z.array(import_zod9.z.number()),
886
+ firstSeenAt: import_zod9.z.string().datetime(),
887
+ lastSeenAt: import_zod9.z.string().datetime()
888
+ });
889
+ var RelationshipEdgeTypeSchema = import_zod9.z.enum([
890
+ "supplies_to",
891
+ "purchases_from",
892
+ "partners_with",
893
+ "competes_with",
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"
906
+ ]);
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(),
911
+ edgeType: RelationshipEdgeTypeSchema,
912
+ weight: import_zod9.z.number().min(0).max(1),
913
+ evidenceSignalIds: import_zod9.z.array(import_zod9.z.number()),
914
+ updatedAt: import_zod9.z.string().datetime(),
915
+ validFrom: import_zod9.z.string().datetime(),
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)
935
+ });
936
+
937
+ // src/non-public-entity/schema.ts
938
+ var import_zod10 = require("zod");
939
+ var NonPublicEntitySchema = import_zod10.z.object({
940
+ lei: import_zod10.z.string().nullable(),
941
+ entityName: import_zod10.z.string(),
942
+ jurisdiction: import_zod10.z.string().nullable(),
943
+ registrationStatus: import_zod10.z.string(),
944
+ parentEntityLei: import_zod10.z.string().nullable(),
945
+ materialMetadata: import_zod10.z.record(import_zod10.z.unknown()),
946
+ discoveredAt: import_zod10.z.string().datetime()
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()
638
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
+ };
639
1046
  // Annotate the CommonJS export names for ESM import in node:
640
1047
  0 && (module.exports = {
641
1048
  AIKeyManifestSchema,
@@ -643,40 +1050,87 @@ var UserSchema = import_zod7.z.object({
643
1050
  AI_ROSTER,
644
1051
  AI_TOOLS,
645
1052
  ActionSchema,
1053
+ AircraftAppConfigSchema,
646
1054
  AppSignalSchema,
647
1055
  AppSpecificationSchema,
648
1056
  AuthStrategySchema,
649
1057
  BlockSchema,
650
1058
  Bodewell,
1059
+ ClockAppConfigSchema,
1060
+ CounterpartyNodeSchema,
1061
+ CounterpartyResolutionSchema,
1062
+ CounterpartyTypeSchema,
651
1063
  DEFAULT_CHAT_MODEL,
1064
+ DEFAULT_DEVICE_CONFIG,
1065
+ DEFAULT_HORIZON_QUARTERS,
652
1066
  DEFAULT_PRO_MODEL,
653
1067
  DEFAULT_SCHEMA_MODEL,
654
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,
1079
+ DivergenceMetricSchema,
1080
+ EVENT_KIND_LABELS,
1081
+ EXCLUDED_SOURCES,
1082
+ EntityEventDensityBucketSchema,
1083
+ EntityEventDensitySchema,
1084
+ EntityEventFacetSchema,
1085
+ EntityEventFacetsSchema,
1086
+ EntityEventKindSchema,
1087
+ EntityEventSchema,
1088
+ EntityPriceSeriesSchema,
655
1089
  EntitySchema,
1090
+ EventBucketSizeSchema,
1091
+ EventSourceSchema,
656
1092
  FieldSchema,
657
1093
  FloraTelemetrySchema,
658
1094
  GENESIS_LIBRARY_CONTEXT,
659
1095
  GENESIS_VALID_COMPONENTS,
1096
+ IMPACT_FLAG_THRESHOLD,
1097
+ ImpactScaleSchema,
1098
+ NonPublicEntitySchema,
660
1099
  PageSchema,
661
1100
  PageSectionSchema,
1101
+ PaginatedEntityEventsSchema,
1102
+ ProvisioningStateSchema,
1103
+ RelationshipEdgeSchema,
1104
+ RelationshipEdgeTypeSchema,
662
1105
  ResourceSchema,
1106
+ SENTIMENT_NEUTRAL,
663
1107
  SIGNAL_DOMAINS,
664
1108
  SIGNAL_KINDS,
665
1109
  SIGNAL_KIND_LABELS,
666
1110
  SIGNAL_SOURCES,
1111
+ SensorAppConfigSchema,
667
1112
  SignalArraySchema,
668
1113
  SignalKindSchema,
669
1114
  SignalPacketSchema,
670
1115
  SignalSchema,
671
1116
  SignalSourceSchema,
1117
+ SignalWeightSchema,
672
1118
  THEME_PRESETS,
673
1119
  THEME_SYSTEM_PROMPT,
674
1120
  ThemeFontsSchema,
675
1121
  ThemeOverridesSchema,
676
1122
  ThemeTokensSchema,
1123
+ TimestampPrecisionSchema,
677
1124
  TriggerSchema,
678
1125
  UserSchema,
1126
+ WeatherAppConfigSchema,
679
1127
  WorkflowSchema,
1128
+ architectureReferenceParameters,
1129
+ companyNewsParameters,
1130
+ companyProfileParameters,
1131
+ counterpartyGraphParameters,
1132
+ divergenceMetricsParameters,
1133
+ liveQuoteParameters,
680
1134
  stockChartParameters,
681
1135
  telemetryGraphParameters
682
1136
  });