@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/LICENSE +2 -2
- package/README.md +47 -0
- package/dist/index.cjs +490 -36
- package/dist/index.d.cts +1491 -3
- package/dist/index.d.ts +1491 -3
- package/dist/index.js +443 -36
- package/package.json +3 -1
package/dist/index.js
CHANGED
|
@@ -273,24 +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
|
});
|
|
433
|
+
var divergenceMetricsParameters = z6.object({ ticker: tickerParam });
|
|
434
|
+
var architectureReferenceParameters = z6.object({});
|
|
294
435
|
var AI_TOOLS = {
|
|
295
436
|
get_telemetry_graph: {
|
|
296
437
|
name: "get_telemetry_graph",
|
|
@@ -301,6 +442,36 @@ var AI_TOOLS = {
|
|
|
301
442
|
name: "get_stock_chart",
|
|
302
443
|
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.",
|
|
303
444
|
parameters: stockChartParameters
|
|
445
|
+
},
|
|
446
|
+
get_live_quote: {
|
|
447
|
+
name: "get_live_quote",
|
|
448
|
+
description: "Fetches and displays the real-time stock price and daily change percentage for a given company ticker symbol.",
|
|
449
|
+
parameters: liveQuoteParameters
|
|
450
|
+
},
|
|
451
|
+
get_company_news: {
|
|
452
|
+
name: "get_company_news",
|
|
453
|
+
description: "Fetches and displays the 5 most recent news headlines and sentiment impact scores for a given company ticker symbol.",
|
|
454
|
+
parameters: companyNewsParameters
|
|
455
|
+
},
|
|
456
|
+
get_company_profile: {
|
|
457
|
+
name: "get_company_profile",
|
|
458
|
+
description: "Fetches fundamental company data including the business description, sector, industry, market cap, and P/E ratio.",
|
|
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
|
|
304
475
|
}
|
|
305
476
|
};
|
|
306
477
|
|
|
@@ -486,12 +657,12 @@ use bg-card or bg-background as a safe fallback. NEVER invent raw colors.
|
|
|
486
657
|
`;
|
|
487
658
|
|
|
488
659
|
// src/theme/schema.ts
|
|
489
|
-
import { z as
|
|
490
|
-
var RGBString =
|
|
660
|
+
import { z as z7 } from "zod";
|
|
661
|
+
var RGBString = z7.string().regex(
|
|
491
662
|
/^\d{1,3}\s+\d{1,3}\s+\d{1,3}$/,
|
|
492
663
|
'Must be space-separated RGB integers (e.g. "13 110 253")'
|
|
493
664
|
);
|
|
494
|
-
var ThemeOverridesSchema =
|
|
665
|
+
var ThemeOverridesSchema = z7.object({
|
|
495
666
|
// ── Core Brand ───────────────────────────────────────────────────────────
|
|
496
667
|
"--app-primary-color": RGBString.optional(),
|
|
497
668
|
"--app-primary-foreground-color": RGBString.optional(),
|
|
@@ -507,9 +678,9 @@ var ThemeOverridesSchema = z6.object({
|
|
|
507
678
|
"--app-muted-bg": RGBString.optional(),
|
|
508
679
|
"--app-muted-text": RGBString.optional(),
|
|
509
680
|
// ── Shape ────────────────────────────────────────────────────────────────
|
|
510
|
-
"--app-border-radius-sm":
|
|
511
|
-
"--app-border-radius-md":
|
|
512
|
-
"--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(),
|
|
513
684
|
// ── Form Controls ────────────────────────────────────────────────────────
|
|
514
685
|
"--app-input-bg-color": RGBString.optional(),
|
|
515
686
|
"--app-input-text-color": RGBString.optional(),
|
|
@@ -523,19 +694,19 @@ var ThemeOverridesSchema = z6.object({
|
|
|
523
694
|
"--app-chart-4": RGBString.optional(),
|
|
524
695
|
"--app-chart-5": RGBString.optional()
|
|
525
696
|
}).strict();
|
|
526
|
-
var ThemeFontsSchema =
|
|
697
|
+
var ThemeFontsSchema = z7.object({
|
|
527
698
|
/** Google Font name for headings (h1–h4, .font-serif). Example: "Playfair Display" */
|
|
528
|
-
heading:
|
|
699
|
+
heading: z7.string(),
|
|
529
700
|
/** Google Font name for body text. Example: "Inter" */
|
|
530
|
-
body:
|
|
701
|
+
body: z7.string(),
|
|
531
702
|
/** Optional monospace font. Example: "Roboto Mono" */
|
|
532
|
-
mono:
|
|
703
|
+
mono: z7.string().optional()
|
|
533
704
|
});
|
|
534
|
-
var AIThemeSchema =
|
|
705
|
+
var AIThemeSchema = z7.object({
|
|
535
706
|
/** Short descriptive theme name. Example: "Midnight Garden" */
|
|
536
|
-
name:
|
|
707
|
+
name: z7.string(),
|
|
537
708
|
/** One-sentence vibe description. Example: "Dark indigo with golden accents." */
|
|
538
|
-
description:
|
|
709
|
+
description: z7.string(),
|
|
539
710
|
/** Google Font pairing for heading and body text. */
|
|
540
711
|
fonts: ThemeFontsSchema.optional(),
|
|
541
712
|
/**
|
|
@@ -546,13 +717,13 @@ var AIThemeSchema = z6.object({
|
|
|
546
717
|
cssVars: ThemeOverridesSchema
|
|
547
718
|
});
|
|
548
719
|
var THEME_PRESETS = ["light", "dark", "system", "corporate", "midnight", "blueprint"];
|
|
549
|
-
var ThemeTokensSchema =
|
|
720
|
+
var ThemeTokensSchema = z7.object({
|
|
550
721
|
primary: RGBString,
|
|
551
722
|
neutral: RGBString,
|
|
552
723
|
success: RGBString,
|
|
553
724
|
warning: RGBString,
|
|
554
725
|
destructive: RGBString,
|
|
555
|
-
radius:
|
|
726
|
+
radius: z7.enum(["none", "sm", "md", "lg", "full"])
|
|
556
727
|
});
|
|
557
728
|
var DEFAULT_THEME_TOKENS = {
|
|
558
729
|
primary: "13 110 253",
|
|
@@ -564,58 +735,294 @@ var DEFAULT_THEME_TOKENS = {
|
|
|
564
735
|
};
|
|
565
736
|
|
|
566
737
|
// src/auth/schema.ts
|
|
567
|
-
import { z as
|
|
568
|
-
var UserSchema =
|
|
569
|
-
id:
|
|
570
|
-
name:
|
|
571
|
-
email:
|
|
572
|
-
password:
|
|
573
|
-
role:
|
|
574
|
-
status:
|
|
575
|
-
joinedAt:
|
|
576
|
-
lastActive:
|
|
577
|
-
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()
|
|
749
|
+
});
|
|
750
|
+
|
|
751
|
+
// src/counterparty/schema.ts
|
|
752
|
+
import { z as z9 } from "zod";
|
|
753
|
+
var CounterpartyTypeSchema = z9.enum([
|
|
754
|
+
"supplier",
|
|
755
|
+
"customer",
|
|
756
|
+
"partner",
|
|
757
|
+
"competitor",
|
|
758
|
+
"regulator",
|
|
759
|
+
"unknown"
|
|
760
|
+
]);
|
|
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,
|
|
776
|
+
type: CounterpartyTypeSchema,
|
|
777
|
+
confidence: z9.number().min(0).max(1),
|
|
778
|
+
sourceSignalIds: z9.array(z9.number()),
|
|
779
|
+
firstSeenAt: z9.string().datetime(),
|
|
780
|
+
lastSeenAt: z9.string().datetime()
|
|
781
|
+
});
|
|
782
|
+
var RelationshipEdgeTypeSchema = z9.enum([
|
|
783
|
+
"supplies_to",
|
|
784
|
+
"purchases_from",
|
|
785
|
+
"partners_with",
|
|
786
|
+
"competes_with",
|
|
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"
|
|
799
|
+
]);
|
|
800
|
+
var RelationshipEdgeSchema = z9.object({
|
|
801
|
+
id: z9.string(),
|
|
802
|
+
sourceId: z9.string(),
|
|
803
|
+
targetId: z9.string(),
|
|
804
|
+
edgeType: RelationshipEdgeTypeSchema,
|
|
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)
|
|
828
|
+
});
|
|
829
|
+
|
|
830
|
+
// src/non-public-entity/schema.ts
|
|
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()
|
|
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()
|
|
578
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
|
+
};
|
|
579
939
|
export {
|
|
580
940
|
AIKeyManifestSchema,
|
|
581
941
|
AIThemeSchema,
|
|
582
942
|
AI_ROSTER,
|
|
583
943
|
AI_TOOLS,
|
|
584
944
|
ActionSchema,
|
|
945
|
+
AircraftAppConfigSchema,
|
|
585
946
|
AppSignalSchema,
|
|
586
947
|
AppSpecificationSchema,
|
|
587
948
|
AuthStrategySchema,
|
|
588
949
|
BlockSchema,
|
|
589
950
|
schema_exports as Bodewell,
|
|
951
|
+
ClockAppConfigSchema,
|
|
952
|
+
CounterpartyNodeSchema,
|
|
953
|
+
CounterpartyResolutionSchema,
|
|
954
|
+
CounterpartyTypeSchema,
|
|
590
955
|
DEFAULT_CHAT_MODEL,
|
|
956
|
+
DEFAULT_DEVICE_CONFIG,
|
|
957
|
+
DEFAULT_HORIZON_QUARTERS,
|
|
591
958
|
DEFAULT_PRO_MODEL,
|
|
592
959
|
DEFAULT_SCHEMA_MODEL,
|
|
593
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,
|
|
971
|
+
DivergenceMetricSchema,
|
|
972
|
+
EVENT_KIND_LABELS,
|
|
973
|
+
EXCLUDED_SOURCES,
|
|
974
|
+
EntityEventDensityBucketSchema,
|
|
975
|
+
EntityEventDensitySchema,
|
|
976
|
+
EntityEventFacetSchema,
|
|
977
|
+
EntityEventFacetsSchema,
|
|
978
|
+
EntityEventKindSchema,
|
|
979
|
+
EntityEventSchema,
|
|
980
|
+
EntityPriceSeriesSchema,
|
|
594
981
|
EntitySchema,
|
|
982
|
+
EventBucketSizeSchema,
|
|
983
|
+
EventSourceSchema,
|
|
595
984
|
FieldSchema,
|
|
596
985
|
FloraTelemetrySchema,
|
|
597
986
|
GENESIS_LIBRARY_CONTEXT,
|
|
598
987
|
GENESIS_VALID_COMPONENTS,
|
|
988
|
+
IMPACT_FLAG_THRESHOLD,
|
|
989
|
+
ImpactScaleSchema,
|
|
990
|
+
NonPublicEntitySchema,
|
|
599
991
|
PageSchema,
|
|
600
992
|
PageSectionSchema,
|
|
993
|
+
PaginatedEntityEventsSchema,
|
|
994
|
+
ProvisioningStateSchema,
|
|
995
|
+
RelationshipEdgeSchema,
|
|
996
|
+
RelationshipEdgeTypeSchema,
|
|
601
997
|
ResourceSchema,
|
|
998
|
+
SENTIMENT_NEUTRAL,
|
|
602
999
|
SIGNAL_DOMAINS,
|
|
603
1000
|
SIGNAL_KINDS,
|
|
604
1001
|
SIGNAL_KIND_LABELS,
|
|
605
1002
|
SIGNAL_SOURCES,
|
|
1003
|
+
SensorAppConfigSchema,
|
|
606
1004
|
SignalArraySchema,
|
|
607
1005
|
SignalKindSchema,
|
|
608
1006
|
SignalPacketSchema,
|
|
609
1007
|
SignalSchema,
|
|
610
1008
|
SignalSourceSchema,
|
|
1009
|
+
SignalWeightSchema,
|
|
611
1010
|
THEME_PRESETS,
|
|
612
1011
|
THEME_SYSTEM_PROMPT,
|
|
613
1012
|
ThemeFontsSchema,
|
|
614
1013
|
ThemeOverridesSchema,
|
|
615
1014
|
ThemeTokensSchema,
|
|
1015
|
+
TimestampPrecisionSchema,
|
|
616
1016
|
TriggerSchema,
|
|
617
1017
|
UserSchema,
|
|
1018
|
+
WeatherAppConfigSchema,
|
|
618
1019
|
WorkflowSchema,
|
|
1020
|
+
architectureReferenceParameters,
|
|
1021
|
+
companyNewsParameters,
|
|
1022
|
+
companyProfileParameters,
|
|
1023
|
+
counterpartyGraphParameters,
|
|
1024
|
+
divergenceMetricsParameters,
|
|
1025
|
+
liveQuoteParameters,
|
|
619
1026
|
stockChartParameters,
|
|
620
1027
|
telemetryGraphParameters
|
|
621
1028
|
};
|
package/package.json
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ramme-io/shared",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.2",
|
|
4
|
+
"license": "MIT",
|
|
4
5
|
"private": false,
|
|
5
6
|
"type": "module",
|
|
6
7
|
"main": "./dist/index.cjs",
|
|
8
|
+
"sideEffects": false,
|
|
7
9
|
"module": "./dist/index.js",
|
|
8
10
|
"types": "./dist/index.d.ts",
|
|
9
11
|
"exports": {
|