@ramme-io/shared 3.0.0 → 3.1.1

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2026 Ramme Framework
3
+ Copyright (c) 2025 Excesspool Limited Liability Company
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
18
  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
19
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
20
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,47 @@
1
+ # @ramme-io/shared
2
+
3
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
4
+
5
+ **Shared TypeScript types, Zod schemas, and utilities used across the Ramme framework.**
6
+
7
+ This package is the single source of truth for data contracts shared between `@ramme-io/kernel`, `@ramme-io/ui`, and every product app. If two packages need to agree on the shape of a value, the schema for it lives here.
8
+
9
+ ## Installation
10
+
11
+ If you created your app with `npx @ramme-io/create-app@latest`, this package is already installed.
12
+
13
+ ```bash
14
+ pnpm add @ramme-io/shared
15
+ ```
16
+
17
+ ## Usage
18
+
19
+ Import schemas directly, or infer their TypeScript types with Zod's `z.infer`:
20
+
21
+ ```typescript
22
+ import { AppManifestSchema, type AppManifest } from '@ramme-io/shared';
23
+
24
+ const manifest: AppManifest = AppManifestSchema.parse(rawConfig);
25
+ ```
26
+
27
+ ## What's in here
28
+
29
+ | Export path | Contract |
30
+ | --- | --- |
31
+ | `src/schema.ts` | Core app manifest / sitemap contracts consumed by `@ramme-io/kernel` |
32
+ | `src/signals/` | Universal Signal Protocol (Law 12) — `SignalPacket` primitives, source/kind enums |
33
+ | `src/bodewell/schema.ts` | Bodewell tenant exports — hardware-specific adapters that map onto `SignalPacket` |
34
+ | `src/ai/tools.ts`, `src/ai/registry.ts` | AI tool-calling schemas and the model registry (single line of truth for model assignments) |
35
+ | `src/ai/prompts/` | Canonical system-prompt string constants for AI agents (theme + genesis) |
36
+ | `src/theme/schema.ts` | Theme contract (Law 13) — `ThemeOverridesSchema`, `AIThemeSchema`, theme presets |
37
+ | `src/auth/schema.ts` | User/auth entity definitions |
38
+ | `src/counterparty/schema.ts` | Counterparty Intelligence contract for the Fleet-Brain-Deep alternative-signal engine |
39
+ | `src/non-public-entity/schema.ts` | GLEIF LEI-lookup-sourced legal-entity records |
40
+
41
+ ## For Framework Contributors
42
+
43
+ See [CLAUDE.md](./CLAUDE.md) for the full contributor role and the **IRON LAW — Logic = 0** convention: this package holds Zod schemas and their inferred types only. No UI code, no firmware logic, no business logic — any change here is a data-contract change that ripples to every downstream package.
44
+
45
+ ```bash
46
+ pnpm --filter @ramme-io/shared build # tsup index.ts --format esm,cjs --dts --clean
47
+ ```
package/dist/index.cjs CHANGED
@@ -30,17 +30,23 @@ __export(index_exports, {
30
30
  AuthStrategySchema: () => AuthStrategySchema,
31
31
  BlockSchema: () => BlockSchema,
32
32
  Bodewell: () => schema_exports,
33
+ CounterpartyNodeSchema: () => CounterpartyNodeSchema,
34
+ CounterpartyTypeSchema: () => CounterpartyTypeSchema,
33
35
  DEFAULT_CHAT_MODEL: () => DEFAULT_CHAT_MODEL,
34
36
  DEFAULT_PRO_MODEL: () => DEFAULT_PRO_MODEL,
35
37
  DEFAULT_SCHEMA_MODEL: () => DEFAULT_SCHEMA_MODEL,
36
38
  DEFAULT_THEME_TOKENS: () => DEFAULT_THEME_TOKENS,
39
+ DivergenceMetricSchema: () => DivergenceMetricSchema,
37
40
  EntitySchema: () => EntitySchema,
38
41
  FieldSchema: () => FieldSchema,
39
42
  FloraTelemetrySchema: () => FloraTelemetrySchema,
40
43
  GENESIS_LIBRARY_CONTEXT: () => GENESIS_LIBRARY_CONTEXT,
41
44
  GENESIS_VALID_COMPONENTS: () => GENESIS_VALID_COMPONENTS,
45
+ NonPublicEntitySchema: () => NonPublicEntitySchema,
42
46
  PageSchema: () => PageSchema,
43
47
  PageSectionSchema: () => PageSectionSchema,
48
+ RelationshipEdgeSchema: () => RelationshipEdgeSchema,
49
+ RelationshipEdgeTypeSchema: () => RelationshipEdgeTypeSchema,
44
50
  ResourceSchema: () => ResourceSchema,
45
51
  SIGNAL_DOMAINS: () => SIGNAL_DOMAINS,
46
52
  SIGNAL_KINDS: () => SIGNAL_KINDS,
@@ -51,6 +57,7 @@ __export(index_exports, {
51
57
  SignalPacketSchema: () => SignalPacketSchema,
52
58
  SignalSchema: () => SignalSchema,
53
59
  SignalSourceSchema: () => SignalSourceSchema,
60
+ SignalWeightSchema: () => SignalWeightSchema,
54
61
  THEME_PRESETS: () => THEME_PRESETS,
55
62
  THEME_SYSTEM_PROMPT: () => THEME_SYSTEM_PROMPT,
56
63
  ThemeFontsSchema: () => ThemeFontsSchema,
@@ -59,6 +66,9 @@ __export(index_exports, {
59
66
  TriggerSchema: () => TriggerSchema,
60
67
  UserSchema: () => UserSchema,
61
68
  WorkflowSchema: () => WorkflowSchema,
69
+ companyNewsParameters: () => companyNewsParameters,
70
+ companyProfileParameters: () => companyProfileParameters,
71
+ liveQuoteParameters: () => liveQuoteParameters,
62
72
  stockChartParameters: () => stockChartParameters,
63
73
  telemetryGraphParameters: () => telemetryGraphParameters
64
74
  });
@@ -69,7 +79,7 @@ var import_zod = require("zod");
69
79
  var FieldSchema = import_zod.z.object({
70
80
  key: import_zod.z.string(),
71
81
  label: import_zod.z.string(),
72
- type: import_zod.z.enum(["text", "number", "currency", "date", "boolean", "status", "email", "image", "textarea"]),
82
+ type: import_zod.z.enum(["text", "number", "currency", "percent", "delta", "date", "boolean", "status", "email", "image", "textarea"]),
73
83
  required: import_zod.z.boolean().optional(),
74
84
  description: import_zod.z.string().optional(),
75
85
  defaultValue: import_zod.z.any().optional()
@@ -351,6 +361,10 @@ var stockChartParameters = import_zod5.z.object({
351
361
  }).describe("The time range for the chart. Choose based on user request or default to '1M'."),
352
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.")
353
363
  });
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 });
354
368
  var AI_TOOLS = {
355
369
  get_telemetry_graph: {
356
370
  name: "get_telemetry_graph",
@@ -361,6 +375,21 @@ var AI_TOOLS = {
361
375
  name: "get_stock_chart",
362
376
  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
377
  parameters: stockChartParameters
378
+ },
379
+ get_live_quote: {
380
+ name: "get_live_quote",
381
+ description: "Fetches and displays the real-time stock price and daily change percentage for a given company ticker symbol.",
382
+ parameters: liveQuoteParameters
383
+ },
384
+ get_company_news: {
385
+ name: "get_company_news",
386
+ description: "Fetches and displays the 5 most recent news headlines and sentiment impact scores for a given company ticker symbol.",
387
+ parameters: companyNewsParameters
388
+ },
389
+ get_company_profile: {
390
+ name: "get_company_profile",
391
+ description: "Fetches fundamental company data including the business description, sector, industry, market cap, and P/E ratio.",
392
+ parameters: companyProfileParameters
364
393
  }
365
394
  };
366
395
 
@@ -636,6 +665,69 @@ var UserSchema = import_zod7.z.object({
636
665
  lastActive: import_zod7.z.string().optional(),
637
666
  avatarUrl: import_zod7.z.string().optional()
638
667
  });
668
+
669
+ // src/counterparty/schema.ts
670
+ var import_zod8 = require("zod");
671
+ var CounterpartyTypeSchema = import_zod8.z.enum([
672
+ "supplier",
673
+ "customer",
674
+ "partner",
675
+ "competitor",
676
+ "regulator",
677
+ "unknown"
678
+ ]);
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(),
683
+ 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()
688
+ });
689
+ var RelationshipEdgeTypeSchema = import_zod8.z.enum([
690
+ "supplies_to",
691
+ "purchases_from",
692
+ "partners_with",
693
+ "competes_with",
694
+ "regulated_by"
695
+ ]);
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(),
700
+ 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)
718
+ });
719
+
720
+ // 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()
730
+ });
639
731
  // Annotate the CommonJS export names for ESM import in node:
640
732
  0 && (module.exports = {
641
733
  AIKeyManifestSchema,
@@ -648,17 +740,23 @@ var UserSchema = import_zod7.z.object({
648
740
  AuthStrategySchema,
649
741
  BlockSchema,
650
742
  Bodewell,
743
+ CounterpartyNodeSchema,
744
+ CounterpartyTypeSchema,
651
745
  DEFAULT_CHAT_MODEL,
652
746
  DEFAULT_PRO_MODEL,
653
747
  DEFAULT_SCHEMA_MODEL,
654
748
  DEFAULT_THEME_TOKENS,
749
+ DivergenceMetricSchema,
655
750
  EntitySchema,
656
751
  FieldSchema,
657
752
  FloraTelemetrySchema,
658
753
  GENESIS_LIBRARY_CONTEXT,
659
754
  GENESIS_VALID_COMPONENTS,
755
+ NonPublicEntitySchema,
660
756
  PageSchema,
661
757
  PageSectionSchema,
758
+ RelationshipEdgeSchema,
759
+ RelationshipEdgeTypeSchema,
662
760
  ResourceSchema,
663
761
  SIGNAL_DOMAINS,
664
762
  SIGNAL_KINDS,
@@ -669,6 +767,7 @@ var UserSchema = import_zod7.z.object({
669
767
  SignalPacketSchema,
670
768
  SignalSchema,
671
769
  SignalSourceSchema,
770
+ SignalWeightSchema,
672
771
  THEME_PRESETS,
673
772
  THEME_SYSTEM_PROMPT,
674
773
  ThemeFontsSchema,
@@ -677,6 +776,9 @@ var UserSchema = import_zod7.z.object({
677
776
  TriggerSchema,
678
777
  UserSchema,
679
778
  WorkflowSchema,
779
+ companyNewsParameters,
780
+ companyProfileParameters,
781
+ liveQuoteParameters,
680
782
  stockChartParameters,
681
783
  telemetryGraphParameters
682
784
  });
package/dist/index.d.cts CHANGED
@@ -19,21 +19,21 @@ import { z } from 'zod';
19
19
  declare const FieldSchema: z.ZodObject<{
20
20
  key: z.ZodString;
21
21
  label: z.ZodString;
22
- type: z.ZodEnum<["text", "number", "currency", "date", "boolean", "status", "email", "image", "textarea"]>;
22
+ type: z.ZodEnum<["text", "number", "currency", "percent", "delta", "date", "boolean", "status", "email", "image", "textarea"]>;
23
23
  required: z.ZodOptional<z.ZodBoolean>;
24
24
  description: z.ZodOptional<z.ZodString>;
25
25
  defaultValue: z.ZodOptional<z.ZodAny>;
26
26
  }, "strip", z.ZodTypeAny, {
27
27
  key: string;
28
28
  label: string;
29
- type: "number" | "boolean" | "status" | "date" | "text" | "currency" | "email" | "image" | "textarea";
29
+ type: "number" | "boolean" | "status" | "date" | "text" | "currency" | "percent" | "delta" | "email" | "image" | "textarea";
30
30
  required?: boolean | undefined;
31
31
  description?: string | undefined;
32
32
  defaultValue?: any;
33
33
  }, {
34
34
  key: string;
35
35
  label: string;
36
- type: "number" | "boolean" | "status" | "date" | "text" | "currency" | "email" | "image" | "textarea";
36
+ type: "number" | "boolean" | "status" | "date" | "text" | "currency" | "percent" | "delta" | "email" | "image" | "textarea";
37
37
  required?: boolean | undefined;
38
38
  description?: string | undefined;
39
39
  defaultValue?: any;
@@ -45,21 +45,21 @@ declare const ResourceSchema: z.ZodObject<{
45
45
  fields: z.ZodArray<z.ZodObject<{
46
46
  key: z.ZodString;
47
47
  label: z.ZodString;
48
- type: z.ZodEnum<["text", "number", "currency", "date", "boolean", "status", "email", "image", "textarea"]>;
48
+ type: z.ZodEnum<["text", "number", "currency", "percent", "delta", "date", "boolean", "status", "email", "image", "textarea"]>;
49
49
  required: z.ZodOptional<z.ZodBoolean>;
50
50
  description: z.ZodOptional<z.ZodString>;
51
51
  defaultValue: z.ZodOptional<z.ZodAny>;
52
52
  }, "strip", z.ZodTypeAny, {
53
53
  key: string;
54
54
  label: string;
55
- type: "number" | "boolean" | "status" | "date" | "text" | "currency" | "email" | "image" | "textarea";
55
+ type: "number" | "boolean" | "status" | "date" | "text" | "currency" | "percent" | "delta" | "email" | "image" | "textarea";
56
56
  required?: boolean | undefined;
57
57
  description?: string | undefined;
58
58
  defaultValue?: any;
59
59
  }, {
60
60
  key: string;
61
61
  label: string;
62
- type: "number" | "boolean" | "status" | "date" | "text" | "currency" | "email" | "image" | "textarea";
62
+ type: "number" | "boolean" | "status" | "date" | "text" | "currency" | "percent" | "delta" | "email" | "image" | "textarea";
63
63
  required?: boolean | undefined;
64
64
  description?: string | undefined;
65
65
  defaultValue?: any;
@@ -90,7 +90,7 @@ declare const ResourceSchema: z.ZodObject<{
90
90
  fields: {
91
91
  key: string;
92
92
  label: string;
93
- type: "number" | "boolean" | "status" | "date" | "text" | "currency" | "email" | "image" | "textarea";
93
+ type: "number" | "boolean" | "status" | "date" | "text" | "currency" | "percent" | "delta" | "email" | "image" | "textarea";
94
94
  required?: boolean | undefined;
95
95
  description?: string | undefined;
96
96
  defaultValue?: any;
@@ -109,7 +109,7 @@ declare const ResourceSchema: z.ZodObject<{
109
109
  fields: {
110
110
  key: string;
111
111
  label: string;
112
- type: "number" | "boolean" | "status" | "date" | "text" | "currency" | "email" | "image" | "textarea";
112
+ type: "number" | "boolean" | "status" | "date" | "text" | "currency" | "percent" | "delta" | "email" | "image" | "textarea";
113
113
  required?: boolean | undefined;
114
114
  description?: string | undefined;
115
115
  defaultValue?: any;
@@ -631,21 +631,21 @@ declare const AppSpecificationSchema: z.ZodObject<{
631
631
  fields: z.ZodArray<z.ZodObject<{
632
632
  key: z.ZodString;
633
633
  label: z.ZodString;
634
- type: z.ZodEnum<["text", "number", "currency", "date", "boolean", "status", "email", "image", "textarea"]>;
634
+ type: z.ZodEnum<["text", "number", "currency", "percent", "delta", "date", "boolean", "status", "email", "image", "textarea"]>;
635
635
  required: z.ZodOptional<z.ZodBoolean>;
636
636
  description: z.ZodOptional<z.ZodString>;
637
637
  defaultValue: z.ZodOptional<z.ZodAny>;
638
638
  }, "strip", z.ZodTypeAny, {
639
639
  key: string;
640
640
  label: string;
641
- type: "number" | "boolean" | "status" | "date" | "text" | "currency" | "email" | "image" | "textarea";
641
+ type: "number" | "boolean" | "status" | "date" | "text" | "currency" | "percent" | "delta" | "email" | "image" | "textarea";
642
642
  required?: boolean | undefined;
643
643
  description?: string | undefined;
644
644
  defaultValue?: any;
645
645
  }, {
646
646
  key: string;
647
647
  label: string;
648
- type: "number" | "boolean" | "status" | "date" | "text" | "currency" | "email" | "image" | "textarea";
648
+ type: "number" | "boolean" | "status" | "date" | "text" | "currency" | "percent" | "delta" | "email" | "image" | "textarea";
649
649
  required?: boolean | undefined;
650
650
  description?: string | undefined;
651
651
  defaultValue?: any;
@@ -676,7 +676,7 @@ declare const AppSpecificationSchema: z.ZodObject<{
676
676
  fields: {
677
677
  key: string;
678
678
  label: string;
679
- type: "number" | "boolean" | "status" | "date" | "text" | "currency" | "email" | "image" | "textarea";
679
+ type: "number" | "boolean" | "status" | "date" | "text" | "currency" | "percent" | "delta" | "email" | "image" | "textarea";
680
680
  required?: boolean | undefined;
681
681
  description?: string | undefined;
682
682
  defaultValue?: any;
@@ -695,7 +695,7 @@ declare const AppSpecificationSchema: z.ZodObject<{
695
695
  fields: {
696
696
  key: string;
697
697
  label: string;
698
- type: "number" | "boolean" | "status" | "date" | "text" | "currency" | "email" | "image" | "textarea";
698
+ type: "number" | "boolean" | "status" | "date" | "text" | "currency" | "percent" | "delta" | "email" | "image" | "textarea";
699
699
  required?: boolean | undefined;
700
700
  description?: string | undefined;
701
701
  defaultValue?: any;
@@ -1151,7 +1151,7 @@ declare const AppSpecificationSchema: z.ZodObject<{
1151
1151
  fields: {
1152
1152
  key: string;
1153
1153
  label: string;
1154
- type: "number" | "boolean" | "status" | "date" | "text" | "currency" | "email" | "image" | "textarea";
1154
+ type: "number" | "boolean" | "status" | "date" | "text" | "currency" | "percent" | "delta" | "email" | "image" | "textarea";
1155
1155
  required?: boolean | undefined;
1156
1156
  description?: string | undefined;
1157
1157
  defaultValue?: any;
@@ -1260,7 +1260,7 @@ declare const AppSpecificationSchema: z.ZodObject<{
1260
1260
  fields: {
1261
1261
  key: string;
1262
1262
  label: string;
1263
- type: "number" | "boolean" | "status" | "date" | "text" | "currency" | "email" | "image" | "textarea";
1263
+ type: "number" | "boolean" | "status" | "date" | "text" | "currency" | "percent" | "delta" | "email" | "image" | "textarea";
1264
1264
  required?: boolean | undefined;
1265
1265
  description?: string | undefined;
1266
1266
  defaultValue?: any;
@@ -1714,6 +1714,30 @@ declare const stockChartParameters: z.ZodObject<{
1714
1714
  ticker: string;
1715
1715
  }>;
1716
1716
  type StockChartParams = z.infer<typeof stockChartParameters>;
1717
+ declare const liveQuoteParameters: z.ZodObject<{
1718
+ ticker: z.ZodString;
1719
+ }, "strip", z.ZodTypeAny, {
1720
+ ticker: string;
1721
+ }, {
1722
+ ticker: string;
1723
+ }>;
1724
+ type LiveQuoteParams = z.infer<typeof liveQuoteParameters>;
1725
+ declare const companyNewsParameters: z.ZodObject<{
1726
+ ticker: z.ZodString;
1727
+ }, "strip", z.ZodTypeAny, {
1728
+ ticker: string;
1729
+ }, {
1730
+ ticker: string;
1731
+ }>;
1732
+ type CompanyNewsParams = z.infer<typeof companyNewsParameters>;
1733
+ declare const companyProfileParameters: z.ZodObject<{
1734
+ ticker: z.ZodString;
1735
+ }, "strip", z.ZodTypeAny, {
1736
+ ticker: string;
1737
+ }, {
1738
+ ticker: string;
1739
+ }>;
1740
+ type CompanyProfileParams = z.infer<typeof companyProfileParameters>;
1717
1741
  /**
1718
1742
  * Generic tool definition structure.
1719
1743
  * Each tool must have a unique name, description, and Zod parameter schema.
@@ -2237,4 +2261,242 @@ declare const UserSchema: z.ZodObject<{
2237
2261
  }>;
2238
2262
  type User = z.infer<typeof UserSchema>;
2239
2263
 
2240
- export { type AIKeyManifest, AIKeyManifestSchema, type AITheme, AIThemeSchema, AI_ROSTER, AI_TOOLS, type ActionDefinition, ActionSchema, type AgentRoleConfig, type AgentRoleKey, AppSignalSchema, type AppSpecification, AppSpecificationSchema, AuthStrategySchema, type Block, BlockSchema, schema as Bodewell, DEFAULT_CHAT_MODEL, DEFAULT_PRO_MODEL, DEFAULT_SCHEMA_MODEL, DEFAULT_THEME_TOKENS, type EntityDefinition, EntitySchema, type FieldDefinition, FieldSchema, type FloraTelemetry, FloraTelemetrySchema, GENESIS_LIBRARY_CONTEXT, GENESIS_VALID_COMPONENTS, type GenesisComponentType, type PageDefinition, PageSchema, type PageSection, PageSectionSchema, type ResourceDefinition, ResourceSchema, SIGNAL_DOMAINS, SIGNAL_KINDS, SIGNAL_KIND_LABELS, SIGNAL_SOURCES, type Signal, type SignalArray, SignalArraySchema, type SignalDefinition, type SignalDomain, type SignalKind, SignalKindSchema, type SignalPacket, SignalPacketSchema, SignalSchema, type SignalSource, SignalSourceSchema, type StockChartParams, THEME_PRESETS, THEME_SYSTEM_PROMPT, type TelemetryGraphParams, type ThemeFonts, ThemeFontsSchema, type ThemeOverrides, ThemeOverridesSchema, type ThemePreset, type ThemeTokens, ThemeTokensSchema, type ToolCall, type ToolDefinition, TriggerSchema, type User, UserSchema, type WorkflowDefinition, WorkflowSchema, stockChartParameters, telemetryGraphParameters };
2264
+ /**
2265
+ * @file schema.ts
2266
+ * @package @ramme-io/shared
2267
+ * @description The Counterparty Intelligence Contract — canonical schemas for the
2268
+ * alternative-signal / relational-node engine (Fleet-Brain-Deep).
2269
+ *
2270
+ * Covers the graph Fleet-Brain-Deep infers from alternative signals: counterparty
2271
+ * nodes (suppliers, customers, partners, etc. inferred for a ticker), the weighted
2272
+ * edges between them, the per-signal weights that justify a synthesis, and the
2273
+ * operational/UX divergence metrics computed from that graph.
2274
+ *
2275
+ * This is intentionally a SEPARATE graph from the existing SEC-filing-derived
2276
+ * corporate hierarchy (parent/child/sibling ownership structure). Do not conflate
2277
+ * the two — a counterparty is an inferred business relationship, not an ownership
2278
+ * relationship.
2279
+ *
2280
+ * NOTE: `engines/data-factory-api` (Python) has no codegen bridge to this package.
2281
+ * `api/counterparty_models.py` hand-mirrors these shapes in Pydantic — keep both
2282
+ * in sync manually when either changes, same as the existing Signal/Insight models.
2283
+ *
2284
+ * Import from @ramme-io/shared:
2285
+ * import { CounterpartyNodeSchema, CounterpartyNode } from '@ramme-io/shared';
2286
+ *
2287
+ * ─── IRON LAW — Logic = 0 ────────────────────────────────────────────────────
2288
+ * This file contains ONLY Zod schemas and inferred TypeScript types.
2289
+ * No functions. No class instances. No side effects. No imports from kernel.
2290
+ */
2291
+
2292
+ /**
2293
+ * The kind of business relationship a counterparty represents relative to the
2294
+ * subject ticker. 'unknown' is a valid terminal state — not every inferred
2295
+ * node resolves to a confident category.
2296
+ */
2297
+ declare const CounterpartyTypeSchema: z.ZodEnum<["supplier", "customer", "partner", "competitor", "regulator", "unknown"]>;
2298
+ type CounterpartyType = z.infer<typeof CounterpartyTypeSchema>;
2299
+ /**
2300
+ * @field id Stable synthetic identifier. Convention: `cp_<ticker|hash>`.
2301
+ * @field ticker Public ticker of the counterparty, if it has one.
2302
+ * @field name Best-known legal or common name.
2303
+ * @field type See CounterpartyTypeSchema.
2304
+ * @field confidence 0–1. Model confidence this node represents a real,
2305
+ * distinct counterparty (not a dedup/entity-resolution error).
2306
+ * @field sourceSignalIds `signals.id` rows this node was derived from — provenance
2307
+ * trail back to the raw alternative signals.
2308
+ */
2309
+ declare const CounterpartyNodeSchema: z.ZodObject<{
2310
+ id: z.ZodString;
2311
+ ticker: z.ZodNullable<z.ZodString>;
2312
+ name: z.ZodString;
2313
+ type: z.ZodEnum<["supplier", "customer", "partner", "competitor", "regulator", "unknown"]>;
2314
+ confidence: z.ZodNumber;
2315
+ sourceSignalIds: z.ZodArray<z.ZodNumber, "many">;
2316
+ firstSeenAt: z.ZodString;
2317
+ lastSeenAt: z.ZodString;
2318
+ }, "strip", z.ZodTypeAny, {
2319
+ type: "unknown" | "supplier" | "customer" | "partner" | "competitor" | "regulator";
2320
+ id: string;
2321
+ name: string;
2322
+ ticker: string | null;
2323
+ confidence: number;
2324
+ sourceSignalIds: number[];
2325
+ firstSeenAt: string;
2326
+ lastSeenAt: string;
2327
+ }, {
2328
+ type: "unknown" | "supplier" | "customer" | "partner" | "competitor" | "regulator";
2329
+ id: string;
2330
+ name: string;
2331
+ ticker: string | null;
2332
+ confidence: number;
2333
+ sourceSignalIds: number[];
2334
+ firstSeenAt: string;
2335
+ lastSeenAt: string;
2336
+ }>;
2337
+ type CounterpartyNode = z.infer<typeof CounterpartyNodeSchema>;
2338
+ declare const RelationshipEdgeTypeSchema: z.ZodEnum<["supplies_to", "purchases_from", "partners_with", "competes_with", "regulated_by"]>;
2339
+ type RelationshipEdgeType = z.infer<typeof RelationshipEdgeTypeSchema>;
2340
+ /**
2341
+ * A directed, weighted edge between two CounterpartyNode ids (or a node id and
2342
+ * a subject ticker). `weight` is the inferred strength/confidence of the edge
2343
+ * itself, distinct from the confidence on either endpoint node.
2344
+ */
2345
+ declare const RelationshipEdgeSchema: z.ZodObject<{
2346
+ id: z.ZodString;
2347
+ sourceId: z.ZodString;
2348
+ targetId: z.ZodString;
2349
+ edgeType: z.ZodEnum<["supplies_to", "purchases_from", "partners_with", "competes_with", "regulated_by"]>;
2350
+ weight: z.ZodNumber;
2351
+ evidenceSignalIds: z.ZodArray<z.ZodNumber, "many">;
2352
+ updatedAt: z.ZodString;
2353
+ }, "strip", z.ZodTypeAny, {
2354
+ id: string;
2355
+ sourceId: string;
2356
+ targetId: string;
2357
+ edgeType: "supplies_to" | "purchases_from" | "partners_with" | "competes_with" | "regulated_by";
2358
+ weight: number;
2359
+ evidenceSignalIds: number[];
2360
+ updatedAt: string;
2361
+ }, {
2362
+ id: string;
2363
+ sourceId: string;
2364
+ targetId: string;
2365
+ edgeType: "supplies_to" | "purchases_from" | "partners_with" | "competes_with" | "regulated_by";
2366
+ weight: number;
2367
+ evidenceSignalIds: number[];
2368
+ updatedAt: string;
2369
+ }>;
2370
+ type RelationshipEdge = z.infer<typeof RelationshipEdgeSchema>;
2371
+ /**
2372
+ * A single signal's contribution to a downstream synthesis (a counterparty
2373
+ * mapping, a divergence score, or a Fleet-Brain insight). `reason` is a short
2374
+ * model-generated justification, not free-form commentary — keep it terse.
2375
+ */
2376
+ declare const SignalWeightSchema: z.ZodObject<{
2377
+ signalId: z.ZodNumber;
2378
+ weight: z.ZodNumber;
2379
+ reason: z.ZodString;
2380
+ }, "strip", z.ZodTypeAny, {
2381
+ weight: number;
2382
+ signalId: number;
2383
+ reason: string;
2384
+ }, {
2385
+ weight: number;
2386
+ signalId: number;
2387
+ reason: string;
2388
+ }>;
2389
+ type SignalWeight = z.infer<typeof SignalWeightSchema>;
2390
+ /**
2391
+ * Signed divergence between an expected/baseline value and what was actually
2392
+ * observed for a ticker, along one of two tracked metric families.
2393
+ * `score` is signed (observed − baseline, or a normalized variant) — positive
2394
+ * and negative both carry meaning, this is not a magnitude-only metric.
2395
+ */
2396
+ declare const DivergenceMetricSchema: z.ZodObject<{
2397
+ ticker: z.ZodString;
2398
+ metric: z.ZodEnum<["operational", "ux"]>;
2399
+ score: z.ZodNumber;
2400
+ baseline: z.ZodNumber;
2401
+ observed: z.ZodNumber;
2402
+ computedAt: z.ZodString;
2403
+ contributingSignals: z.ZodArray<z.ZodObject<{
2404
+ signalId: z.ZodNumber;
2405
+ weight: z.ZodNumber;
2406
+ reason: z.ZodString;
2407
+ }, "strip", z.ZodTypeAny, {
2408
+ weight: number;
2409
+ signalId: number;
2410
+ reason: string;
2411
+ }, {
2412
+ weight: number;
2413
+ signalId: number;
2414
+ reason: string;
2415
+ }>, "many">;
2416
+ }, "strip", z.ZodTypeAny, {
2417
+ metric: "operational" | "ux";
2418
+ ticker: string;
2419
+ score: number;
2420
+ baseline: number;
2421
+ observed: number;
2422
+ computedAt: string;
2423
+ contributingSignals: {
2424
+ weight: number;
2425
+ signalId: number;
2426
+ reason: string;
2427
+ }[];
2428
+ }, {
2429
+ metric: "operational" | "ux";
2430
+ ticker: string;
2431
+ score: number;
2432
+ baseline: number;
2433
+ observed: number;
2434
+ computedAt: string;
2435
+ contributingSignals: {
2436
+ weight: number;
2437
+ signalId: number;
2438
+ reason: string;
2439
+ }[];
2440
+ }>;
2441
+ type DivergenceMetric = z.infer<typeof DivergenceMetricSchema>;
2442
+
2443
+ /**
2444
+ * @file schema.ts
2445
+ * @package @ramme-io/shared
2446
+ * @description Contract for non-public entities discovered via GLEIF LEI
2447
+ * lookup (e.g. a counterparty mentioned in an alternative signal with no
2448
+ * public ticker). Separate domain from `counterparty/schema.ts` — a
2449
+ * NonPublicEntity is a real-world legal-entity record (GLEIF-sourced),
2450
+ * whereas a CounterpartyNode is Fleet-Brain-Deep's inferred business-graph
2451
+ * node. A CounterpartyNode may reference a NonPublicEntity once resolved,
2452
+ * but the two are not the same thing.
2453
+ *
2454
+ * Import from @ramme-io/shared:
2455
+ * import { NonPublicEntitySchema, NonPublicEntity } from '@ramme-io/shared';
2456
+ *
2457
+ * ─── IRON LAW — Logic = 0 ────────────────────────────────────────────────────
2458
+ * This file contains ONLY Zod schemas and inferred TypeScript types.
2459
+ * No functions. No class instances. No side effects. No imports from kernel.
2460
+ */
2461
+
2462
+ /**
2463
+ * @field lei Legal Entity Identifier, if GLEIF resolved one.
2464
+ * @field entityName Best-known legal name.
2465
+ * @field jurisdiction ISO country/jurisdiction code from GLEIF, if known.
2466
+ * @field registrationStatus GLEIF registration status (e.g. 'ISSUED', 'LAPSED').
2467
+ * Not optional — always set, even if only to a
2468
+ * sentinel like 'PENDING'/'NOT_FOUND'/'TIMEOUT'.
2469
+ * @field parentEntityLei Direct parent's LEI, if GLEIF resolved a parent
2470
+ * distinct from this entity itself.
2471
+ * @field materialMetadata Flexible store for unstructured extraction
2472
+ * (e.g. GLEIF headquarters address). Untyped
2473
+ * payload, not untyped access — see z.record(z.unknown()).
2474
+ */
2475
+ declare const NonPublicEntitySchema: z.ZodObject<{
2476
+ lei: z.ZodNullable<z.ZodString>;
2477
+ entityName: z.ZodString;
2478
+ jurisdiction: z.ZodNullable<z.ZodString>;
2479
+ registrationStatus: z.ZodString;
2480
+ parentEntityLei: z.ZodNullable<z.ZodString>;
2481
+ materialMetadata: z.ZodRecord<z.ZodString, z.ZodUnknown>;
2482
+ discoveredAt: z.ZodString;
2483
+ }, "strip", z.ZodTypeAny, {
2484
+ lei: string | null;
2485
+ entityName: string;
2486
+ jurisdiction: string | null;
2487
+ registrationStatus: string;
2488
+ parentEntityLei: string | null;
2489
+ materialMetadata: Record<string, unknown>;
2490
+ discoveredAt: string;
2491
+ }, {
2492
+ lei: string | null;
2493
+ entityName: string;
2494
+ jurisdiction: string | null;
2495
+ registrationStatus: string;
2496
+ parentEntityLei: string | null;
2497
+ materialMetadata: Record<string, unknown>;
2498
+ discoveredAt: string;
2499
+ }>;
2500
+ type NonPublicEntity = z.infer<typeof NonPublicEntitySchema>;
2501
+
2502
+ export { type AIKeyManifest, AIKeyManifestSchema, type AITheme, AIThemeSchema, AI_ROSTER, AI_TOOLS, type ActionDefinition, ActionSchema, type AgentRoleConfig, type AgentRoleKey, AppSignalSchema, type AppSpecification, AppSpecificationSchema, AuthStrategySchema, type Block, BlockSchema, schema as Bodewell, type CompanyNewsParams, type CompanyProfileParams, type CounterpartyNode, CounterpartyNodeSchema, type CounterpartyType, CounterpartyTypeSchema, DEFAULT_CHAT_MODEL, DEFAULT_PRO_MODEL, DEFAULT_SCHEMA_MODEL, DEFAULT_THEME_TOKENS, type DivergenceMetric, DivergenceMetricSchema, type EntityDefinition, EntitySchema, type FieldDefinition, FieldSchema, type FloraTelemetry, FloraTelemetrySchema, GENESIS_LIBRARY_CONTEXT, GENESIS_VALID_COMPONENTS, type GenesisComponentType, type LiveQuoteParams, type NonPublicEntity, NonPublicEntitySchema, type PageDefinition, PageSchema, type PageSection, PageSectionSchema, type RelationshipEdge, RelationshipEdgeSchema, type RelationshipEdgeType, RelationshipEdgeTypeSchema, type ResourceDefinition, ResourceSchema, SIGNAL_DOMAINS, SIGNAL_KINDS, SIGNAL_KIND_LABELS, SIGNAL_SOURCES, type Signal, type SignalArray, SignalArraySchema, type SignalDefinition, type SignalDomain, type SignalKind, SignalKindSchema, type SignalPacket, SignalPacketSchema, SignalSchema, type SignalSource, SignalSourceSchema, type SignalWeight, SignalWeightSchema, type StockChartParams, THEME_PRESETS, THEME_SYSTEM_PROMPT, type TelemetryGraphParams, type ThemeFonts, ThemeFontsSchema, type ThemeOverrides, ThemeOverridesSchema, type ThemePreset, type ThemeTokens, ThemeTokensSchema, type ToolCall, type ToolDefinition, TriggerSchema, type User, UserSchema, type WorkflowDefinition, WorkflowSchema, companyNewsParameters, companyProfileParameters, liveQuoteParameters, stockChartParameters, telemetryGraphParameters };
package/dist/index.d.ts CHANGED
@@ -19,21 +19,21 @@ import { z } from 'zod';
19
19
  declare const FieldSchema: z.ZodObject<{
20
20
  key: z.ZodString;
21
21
  label: z.ZodString;
22
- type: z.ZodEnum<["text", "number", "currency", "date", "boolean", "status", "email", "image", "textarea"]>;
22
+ type: z.ZodEnum<["text", "number", "currency", "percent", "delta", "date", "boolean", "status", "email", "image", "textarea"]>;
23
23
  required: z.ZodOptional<z.ZodBoolean>;
24
24
  description: z.ZodOptional<z.ZodString>;
25
25
  defaultValue: z.ZodOptional<z.ZodAny>;
26
26
  }, "strip", z.ZodTypeAny, {
27
27
  key: string;
28
28
  label: string;
29
- type: "number" | "boolean" | "status" | "date" | "text" | "currency" | "email" | "image" | "textarea";
29
+ type: "number" | "boolean" | "status" | "date" | "text" | "currency" | "percent" | "delta" | "email" | "image" | "textarea";
30
30
  required?: boolean | undefined;
31
31
  description?: string | undefined;
32
32
  defaultValue?: any;
33
33
  }, {
34
34
  key: string;
35
35
  label: string;
36
- type: "number" | "boolean" | "status" | "date" | "text" | "currency" | "email" | "image" | "textarea";
36
+ type: "number" | "boolean" | "status" | "date" | "text" | "currency" | "percent" | "delta" | "email" | "image" | "textarea";
37
37
  required?: boolean | undefined;
38
38
  description?: string | undefined;
39
39
  defaultValue?: any;
@@ -45,21 +45,21 @@ declare const ResourceSchema: z.ZodObject<{
45
45
  fields: z.ZodArray<z.ZodObject<{
46
46
  key: z.ZodString;
47
47
  label: z.ZodString;
48
- type: z.ZodEnum<["text", "number", "currency", "date", "boolean", "status", "email", "image", "textarea"]>;
48
+ type: z.ZodEnum<["text", "number", "currency", "percent", "delta", "date", "boolean", "status", "email", "image", "textarea"]>;
49
49
  required: z.ZodOptional<z.ZodBoolean>;
50
50
  description: z.ZodOptional<z.ZodString>;
51
51
  defaultValue: z.ZodOptional<z.ZodAny>;
52
52
  }, "strip", z.ZodTypeAny, {
53
53
  key: string;
54
54
  label: string;
55
- type: "number" | "boolean" | "status" | "date" | "text" | "currency" | "email" | "image" | "textarea";
55
+ type: "number" | "boolean" | "status" | "date" | "text" | "currency" | "percent" | "delta" | "email" | "image" | "textarea";
56
56
  required?: boolean | undefined;
57
57
  description?: string | undefined;
58
58
  defaultValue?: any;
59
59
  }, {
60
60
  key: string;
61
61
  label: string;
62
- type: "number" | "boolean" | "status" | "date" | "text" | "currency" | "email" | "image" | "textarea";
62
+ type: "number" | "boolean" | "status" | "date" | "text" | "currency" | "percent" | "delta" | "email" | "image" | "textarea";
63
63
  required?: boolean | undefined;
64
64
  description?: string | undefined;
65
65
  defaultValue?: any;
@@ -90,7 +90,7 @@ declare const ResourceSchema: z.ZodObject<{
90
90
  fields: {
91
91
  key: string;
92
92
  label: string;
93
- type: "number" | "boolean" | "status" | "date" | "text" | "currency" | "email" | "image" | "textarea";
93
+ type: "number" | "boolean" | "status" | "date" | "text" | "currency" | "percent" | "delta" | "email" | "image" | "textarea";
94
94
  required?: boolean | undefined;
95
95
  description?: string | undefined;
96
96
  defaultValue?: any;
@@ -109,7 +109,7 @@ declare const ResourceSchema: z.ZodObject<{
109
109
  fields: {
110
110
  key: string;
111
111
  label: string;
112
- type: "number" | "boolean" | "status" | "date" | "text" | "currency" | "email" | "image" | "textarea";
112
+ type: "number" | "boolean" | "status" | "date" | "text" | "currency" | "percent" | "delta" | "email" | "image" | "textarea";
113
113
  required?: boolean | undefined;
114
114
  description?: string | undefined;
115
115
  defaultValue?: any;
@@ -631,21 +631,21 @@ declare const AppSpecificationSchema: z.ZodObject<{
631
631
  fields: z.ZodArray<z.ZodObject<{
632
632
  key: z.ZodString;
633
633
  label: z.ZodString;
634
- type: z.ZodEnum<["text", "number", "currency", "date", "boolean", "status", "email", "image", "textarea"]>;
634
+ type: z.ZodEnum<["text", "number", "currency", "percent", "delta", "date", "boolean", "status", "email", "image", "textarea"]>;
635
635
  required: z.ZodOptional<z.ZodBoolean>;
636
636
  description: z.ZodOptional<z.ZodString>;
637
637
  defaultValue: z.ZodOptional<z.ZodAny>;
638
638
  }, "strip", z.ZodTypeAny, {
639
639
  key: string;
640
640
  label: string;
641
- type: "number" | "boolean" | "status" | "date" | "text" | "currency" | "email" | "image" | "textarea";
641
+ type: "number" | "boolean" | "status" | "date" | "text" | "currency" | "percent" | "delta" | "email" | "image" | "textarea";
642
642
  required?: boolean | undefined;
643
643
  description?: string | undefined;
644
644
  defaultValue?: any;
645
645
  }, {
646
646
  key: string;
647
647
  label: string;
648
- type: "number" | "boolean" | "status" | "date" | "text" | "currency" | "email" | "image" | "textarea";
648
+ type: "number" | "boolean" | "status" | "date" | "text" | "currency" | "percent" | "delta" | "email" | "image" | "textarea";
649
649
  required?: boolean | undefined;
650
650
  description?: string | undefined;
651
651
  defaultValue?: any;
@@ -676,7 +676,7 @@ declare const AppSpecificationSchema: z.ZodObject<{
676
676
  fields: {
677
677
  key: string;
678
678
  label: string;
679
- type: "number" | "boolean" | "status" | "date" | "text" | "currency" | "email" | "image" | "textarea";
679
+ type: "number" | "boolean" | "status" | "date" | "text" | "currency" | "percent" | "delta" | "email" | "image" | "textarea";
680
680
  required?: boolean | undefined;
681
681
  description?: string | undefined;
682
682
  defaultValue?: any;
@@ -695,7 +695,7 @@ declare const AppSpecificationSchema: z.ZodObject<{
695
695
  fields: {
696
696
  key: string;
697
697
  label: string;
698
- type: "number" | "boolean" | "status" | "date" | "text" | "currency" | "email" | "image" | "textarea";
698
+ type: "number" | "boolean" | "status" | "date" | "text" | "currency" | "percent" | "delta" | "email" | "image" | "textarea";
699
699
  required?: boolean | undefined;
700
700
  description?: string | undefined;
701
701
  defaultValue?: any;
@@ -1151,7 +1151,7 @@ declare const AppSpecificationSchema: z.ZodObject<{
1151
1151
  fields: {
1152
1152
  key: string;
1153
1153
  label: string;
1154
- type: "number" | "boolean" | "status" | "date" | "text" | "currency" | "email" | "image" | "textarea";
1154
+ type: "number" | "boolean" | "status" | "date" | "text" | "currency" | "percent" | "delta" | "email" | "image" | "textarea";
1155
1155
  required?: boolean | undefined;
1156
1156
  description?: string | undefined;
1157
1157
  defaultValue?: any;
@@ -1260,7 +1260,7 @@ declare const AppSpecificationSchema: z.ZodObject<{
1260
1260
  fields: {
1261
1261
  key: string;
1262
1262
  label: string;
1263
- type: "number" | "boolean" | "status" | "date" | "text" | "currency" | "email" | "image" | "textarea";
1263
+ type: "number" | "boolean" | "status" | "date" | "text" | "currency" | "percent" | "delta" | "email" | "image" | "textarea";
1264
1264
  required?: boolean | undefined;
1265
1265
  description?: string | undefined;
1266
1266
  defaultValue?: any;
@@ -1714,6 +1714,30 @@ declare const stockChartParameters: z.ZodObject<{
1714
1714
  ticker: string;
1715
1715
  }>;
1716
1716
  type StockChartParams = z.infer<typeof stockChartParameters>;
1717
+ declare const liveQuoteParameters: z.ZodObject<{
1718
+ ticker: z.ZodString;
1719
+ }, "strip", z.ZodTypeAny, {
1720
+ ticker: string;
1721
+ }, {
1722
+ ticker: string;
1723
+ }>;
1724
+ type LiveQuoteParams = z.infer<typeof liveQuoteParameters>;
1725
+ declare const companyNewsParameters: z.ZodObject<{
1726
+ ticker: z.ZodString;
1727
+ }, "strip", z.ZodTypeAny, {
1728
+ ticker: string;
1729
+ }, {
1730
+ ticker: string;
1731
+ }>;
1732
+ type CompanyNewsParams = z.infer<typeof companyNewsParameters>;
1733
+ declare const companyProfileParameters: z.ZodObject<{
1734
+ ticker: z.ZodString;
1735
+ }, "strip", z.ZodTypeAny, {
1736
+ ticker: string;
1737
+ }, {
1738
+ ticker: string;
1739
+ }>;
1740
+ type CompanyProfileParams = z.infer<typeof companyProfileParameters>;
1717
1741
  /**
1718
1742
  * Generic tool definition structure.
1719
1743
  * Each tool must have a unique name, description, and Zod parameter schema.
@@ -2237,4 +2261,242 @@ declare const UserSchema: z.ZodObject<{
2237
2261
  }>;
2238
2262
  type User = z.infer<typeof UserSchema>;
2239
2263
 
2240
- export { type AIKeyManifest, AIKeyManifestSchema, type AITheme, AIThemeSchema, AI_ROSTER, AI_TOOLS, type ActionDefinition, ActionSchema, type AgentRoleConfig, type AgentRoleKey, AppSignalSchema, type AppSpecification, AppSpecificationSchema, AuthStrategySchema, type Block, BlockSchema, schema as Bodewell, DEFAULT_CHAT_MODEL, DEFAULT_PRO_MODEL, DEFAULT_SCHEMA_MODEL, DEFAULT_THEME_TOKENS, type EntityDefinition, EntitySchema, type FieldDefinition, FieldSchema, type FloraTelemetry, FloraTelemetrySchema, GENESIS_LIBRARY_CONTEXT, GENESIS_VALID_COMPONENTS, type GenesisComponentType, type PageDefinition, PageSchema, type PageSection, PageSectionSchema, type ResourceDefinition, ResourceSchema, SIGNAL_DOMAINS, SIGNAL_KINDS, SIGNAL_KIND_LABELS, SIGNAL_SOURCES, type Signal, type SignalArray, SignalArraySchema, type SignalDefinition, type SignalDomain, type SignalKind, SignalKindSchema, type SignalPacket, SignalPacketSchema, SignalSchema, type SignalSource, SignalSourceSchema, type StockChartParams, THEME_PRESETS, THEME_SYSTEM_PROMPT, type TelemetryGraphParams, type ThemeFonts, ThemeFontsSchema, type ThemeOverrides, ThemeOverridesSchema, type ThemePreset, type ThemeTokens, ThemeTokensSchema, type ToolCall, type ToolDefinition, TriggerSchema, type User, UserSchema, type WorkflowDefinition, WorkflowSchema, stockChartParameters, telemetryGraphParameters };
2264
+ /**
2265
+ * @file schema.ts
2266
+ * @package @ramme-io/shared
2267
+ * @description The Counterparty Intelligence Contract — canonical schemas for the
2268
+ * alternative-signal / relational-node engine (Fleet-Brain-Deep).
2269
+ *
2270
+ * Covers the graph Fleet-Brain-Deep infers from alternative signals: counterparty
2271
+ * nodes (suppliers, customers, partners, etc. inferred for a ticker), the weighted
2272
+ * edges between them, the per-signal weights that justify a synthesis, and the
2273
+ * operational/UX divergence metrics computed from that graph.
2274
+ *
2275
+ * This is intentionally a SEPARATE graph from the existing SEC-filing-derived
2276
+ * corporate hierarchy (parent/child/sibling ownership structure). Do not conflate
2277
+ * the two — a counterparty is an inferred business relationship, not an ownership
2278
+ * relationship.
2279
+ *
2280
+ * NOTE: `engines/data-factory-api` (Python) has no codegen bridge to this package.
2281
+ * `api/counterparty_models.py` hand-mirrors these shapes in Pydantic — keep both
2282
+ * in sync manually when either changes, same as the existing Signal/Insight models.
2283
+ *
2284
+ * Import from @ramme-io/shared:
2285
+ * import { CounterpartyNodeSchema, CounterpartyNode } from '@ramme-io/shared';
2286
+ *
2287
+ * ─── IRON LAW — Logic = 0 ────────────────────────────────────────────────────
2288
+ * This file contains ONLY Zod schemas and inferred TypeScript types.
2289
+ * No functions. No class instances. No side effects. No imports from kernel.
2290
+ */
2291
+
2292
+ /**
2293
+ * The kind of business relationship a counterparty represents relative to the
2294
+ * subject ticker. 'unknown' is a valid terminal state — not every inferred
2295
+ * node resolves to a confident category.
2296
+ */
2297
+ declare const CounterpartyTypeSchema: z.ZodEnum<["supplier", "customer", "partner", "competitor", "regulator", "unknown"]>;
2298
+ type CounterpartyType = z.infer<typeof CounterpartyTypeSchema>;
2299
+ /**
2300
+ * @field id Stable synthetic identifier. Convention: `cp_<ticker|hash>`.
2301
+ * @field ticker Public ticker of the counterparty, if it has one.
2302
+ * @field name Best-known legal or common name.
2303
+ * @field type See CounterpartyTypeSchema.
2304
+ * @field confidence 0–1. Model confidence this node represents a real,
2305
+ * distinct counterparty (not a dedup/entity-resolution error).
2306
+ * @field sourceSignalIds `signals.id` rows this node was derived from — provenance
2307
+ * trail back to the raw alternative signals.
2308
+ */
2309
+ declare const CounterpartyNodeSchema: z.ZodObject<{
2310
+ id: z.ZodString;
2311
+ ticker: z.ZodNullable<z.ZodString>;
2312
+ name: z.ZodString;
2313
+ type: z.ZodEnum<["supplier", "customer", "partner", "competitor", "regulator", "unknown"]>;
2314
+ confidence: z.ZodNumber;
2315
+ sourceSignalIds: z.ZodArray<z.ZodNumber, "many">;
2316
+ firstSeenAt: z.ZodString;
2317
+ lastSeenAt: z.ZodString;
2318
+ }, "strip", z.ZodTypeAny, {
2319
+ type: "unknown" | "supplier" | "customer" | "partner" | "competitor" | "regulator";
2320
+ id: string;
2321
+ name: string;
2322
+ ticker: string | null;
2323
+ confidence: number;
2324
+ sourceSignalIds: number[];
2325
+ firstSeenAt: string;
2326
+ lastSeenAt: string;
2327
+ }, {
2328
+ type: "unknown" | "supplier" | "customer" | "partner" | "competitor" | "regulator";
2329
+ id: string;
2330
+ name: string;
2331
+ ticker: string | null;
2332
+ confidence: number;
2333
+ sourceSignalIds: number[];
2334
+ firstSeenAt: string;
2335
+ lastSeenAt: string;
2336
+ }>;
2337
+ type CounterpartyNode = z.infer<typeof CounterpartyNodeSchema>;
2338
+ declare const RelationshipEdgeTypeSchema: z.ZodEnum<["supplies_to", "purchases_from", "partners_with", "competes_with", "regulated_by"]>;
2339
+ type RelationshipEdgeType = z.infer<typeof RelationshipEdgeTypeSchema>;
2340
+ /**
2341
+ * A directed, weighted edge between two CounterpartyNode ids (or a node id and
2342
+ * a subject ticker). `weight` is the inferred strength/confidence of the edge
2343
+ * itself, distinct from the confidence on either endpoint node.
2344
+ */
2345
+ declare const RelationshipEdgeSchema: z.ZodObject<{
2346
+ id: z.ZodString;
2347
+ sourceId: z.ZodString;
2348
+ targetId: z.ZodString;
2349
+ edgeType: z.ZodEnum<["supplies_to", "purchases_from", "partners_with", "competes_with", "regulated_by"]>;
2350
+ weight: z.ZodNumber;
2351
+ evidenceSignalIds: z.ZodArray<z.ZodNumber, "many">;
2352
+ updatedAt: z.ZodString;
2353
+ }, "strip", z.ZodTypeAny, {
2354
+ id: string;
2355
+ sourceId: string;
2356
+ targetId: string;
2357
+ edgeType: "supplies_to" | "purchases_from" | "partners_with" | "competes_with" | "regulated_by";
2358
+ weight: number;
2359
+ evidenceSignalIds: number[];
2360
+ updatedAt: string;
2361
+ }, {
2362
+ id: string;
2363
+ sourceId: string;
2364
+ targetId: string;
2365
+ edgeType: "supplies_to" | "purchases_from" | "partners_with" | "competes_with" | "regulated_by";
2366
+ weight: number;
2367
+ evidenceSignalIds: number[];
2368
+ updatedAt: string;
2369
+ }>;
2370
+ type RelationshipEdge = z.infer<typeof RelationshipEdgeSchema>;
2371
+ /**
2372
+ * A single signal's contribution to a downstream synthesis (a counterparty
2373
+ * mapping, a divergence score, or a Fleet-Brain insight). `reason` is a short
2374
+ * model-generated justification, not free-form commentary — keep it terse.
2375
+ */
2376
+ declare const SignalWeightSchema: z.ZodObject<{
2377
+ signalId: z.ZodNumber;
2378
+ weight: z.ZodNumber;
2379
+ reason: z.ZodString;
2380
+ }, "strip", z.ZodTypeAny, {
2381
+ weight: number;
2382
+ signalId: number;
2383
+ reason: string;
2384
+ }, {
2385
+ weight: number;
2386
+ signalId: number;
2387
+ reason: string;
2388
+ }>;
2389
+ type SignalWeight = z.infer<typeof SignalWeightSchema>;
2390
+ /**
2391
+ * Signed divergence between an expected/baseline value and what was actually
2392
+ * observed for a ticker, along one of two tracked metric families.
2393
+ * `score` is signed (observed − baseline, or a normalized variant) — positive
2394
+ * and negative both carry meaning, this is not a magnitude-only metric.
2395
+ */
2396
+ declare const DivergenceMetricSchema: z.ZodObject<{
2397
+ ticker: z.ZodString;
2398
+ metric: z.ZodEnum<["operational", "ux"]>;
2399
+ score: z.ZodNumber;
2400
+ baseline: z.ZodNumber;
2401
+ observed: z.ZodNumber;
2402
+ computedAt: z.ZodString;
2403
+ contributingSignals: z.ZodArray<z.ZodObject<{
2404
+ signalId: z.ZodNumber;
2405
+ weight: z.ZodNumber;
2406
+ reason: z.ZodString;
2407
+ }, "strip", z.ZodTypeAny, {
2408
+ weight: number;
2409
+ signalId: number;
2410
+ reason: string;
2411
+ }, {
2412
+ weight: number;
2413
+ signalId: number;
2414
+ reason: string;
2415
+ }>, "many">;
2416
+ }, "strip", z.ZodTypeAny, {
2417
+ metric: "operational" | "ux";
2418
+ ticker: string;
2419
+ score: number;
2420
+ baseline: number;
2421
+ observed: number;
2422
+ computedAt: string;
2423
+ contributingSignals: {
2424
+ weight: number;
2425
+ signalId: number;
2426
+ reason: string;
2427
+ }[];
2428
+ }, {
2429
+ metric: "operational" | "ux";
2430
+ ticker: string;
2431
+ score: number;
2432
+ baseline: number;
2433
+ observed: number;
2434
+ computedAt: string;
2435
+ contributingSignals: {
2436
+ weight: number;
2437
+ signalId: number;
2438
+ reason: string;
2439
+ }[];
2440
+ }>;
2441
+ type DivergenceMetric = z.infer<typeof DivergenceMetricSchema>;
2442
+
2443
+ /**
2444
+ * @file schema.ts
2445
+ * @package @ramme-io/shared
2446
+ * @description Contract for non-public entities discovered via GLEIF LEI
2447
+ * lookup (e.g. a counterparty mentioned in an alternative signal with no
2448
+ * public ticker). Separate domain from `counterparty/schema.ts` — a
2449
+ * NonPublicEntity is a real-world legal-entity record (GLEIF-sourced),
2450
+ * whereas a CounterpartyNode is Fleet-Brain-Deep's inferred business-graph
2451
+ * node. A CounterpartyNode may reference a NonPublicEntity once resolved,
2452
+ * but the two are not the same thing.
2453
+ *
2454
+ * Import from @ramme-io/shared:
2455
+ * import { NonPublicEntitySchema, NonPublicEntity } from '@ramme-io/shared';
2456
+ *
2457
+ * ─── IRON LAW — Logic = 0 ────────────────────────────────────────────────────
2458
+ * This file contains ONLY Zod schemas and inferred TypeScript types.
2459
+ * No functions. No class instances. No side effects. No imports from kernel.
2460
+ */
2461
+
2462
+ /**
2463
+ * @field lei Legal Entity Identifier, if GLEIF resolved one.
2464
+ * @field entityName Best-known legal name.
2465
+ * @field jurisdiction ISO country/jurisdiction code from GLEIF, if known.
2466
+ * @field registrationStatus GLEIF registration status (e.g. 'ISSUED', 'LAPSED').
2467
+ * Not optional — always set, even if only to a
2468
+ * sentinel like 'PENDING'/'NOT_FOUND'/'TIMEOUT'.
2469
+ * @field parentEntityLei Direct parent's LEI, if GLEIF resolved a parent
2470
+ * distinct from this entity itself.
2471
+ * @field materialMetadata Flexible store for unstructured extraction
2472
+ * (e.g. GLEIF headquarters address). Untyped
2473
+ * payload, not untyped access — see z.record(z.unknown()).
2474
+ */
2475
+ declare const NonPublicEntitySchema: z.ZodObject<{
2476
+ lei: z.ZodNullable<z.ZodString>;
2477
+ entityName: z.ZodString;
2478
+ jurisdiction: z.ZodNullable<z.ZodString>;
2479
+ registrationStatus: z.ZodString;
2480
+ parentEntityLei: z.ZodNullable<z.ZodString>;
2481
+ materialMetadata: z.ZodRecord<z.ZodString, z.ZodUnknown>;
2482
+ discoveredAt: z.ZodString;
2483
+ }, "strip", z.ZodTypeAny, {
2484
+ lei: string | null;
2485
+ entityName: string;
2486
+ jurisdiction: string | null;
2487
+ registrationStatus: string;
2488
+ parentEntityLei: string | null;
2489
+ materialMetadata: Record<string, unknown>;
2490
+ discoveredAt: string;
2491
+ }, {
2492
+ lei: string | null;
2493
+ entityName: string;
2494
+ jurisdiction: string | null;
2495
+ registrationStatus: string;
2496
+ parentEntityLei: string | null;
2497
+ materialMetadata: Record<string, unknown>;
2498
+ discoveredAt: string;
2499
+ }>;
2500
+ type NonPublicEntity = z.infer<typeof NonPublicEntitySchema>;
2501
+
2502
+ export { type AIKeyManifest, AIKeyManifestSchema, type AITheme, AIThemeSchema, AI_ROSTER, AI_TOOLS, type ActionDefinition, ActionSchema, type AgentRoleConfig, type AgentRoleKey, AppSignalSchema, type AppSpecification, AppSpecificationSchema, AuthStrategySchema, type Block, BlockSchema, schema as Bodewell, type CompanyNewsParams, type CompanyProfileParams, type CounterpartyNode, CounterpartyNodeSchema, type CounterpartyType, CounterpartyTypeSchema, DEFAULT_CHAT_MODEL, DEFAULT_PRO_MODEL, DEFAULT_SCHEMA_MODEL, DEFAULT_THEME_TOKENS, type DivergenceMetric, DivergenceMetricSchema, type EntityDefinition, EntitySchema, type FieldDefinition, FieldSchema, type FloraTelemetry, FloraTelemetrySchema, GENESIS_LIBRARY_CONTEXT, GENESIS_VALID_COMPONENTS, type GenesisComponentType, type LiveQuoteParams, type NonPublicEntity, NonPublicEntitySchema, type PageDefinition, PageSchema, type PageSection, PageSectionSchema, type RelationshipEdge, RelationshipEdgeSchema, type RelationshipEdgeType, RelationshipEdgeTypeSchema, type ResourceDefinition, ResourceSchema, SIGNAL_DOMAINS, SIGNAL_KINDS, SIGNAL_KIND_LABELS, SIGNAL_SOURCES, type Signal, type SignalArray, SignalArraySchema, type SignalDefinition, type SignalDomain, type SignalKind, SignalKindSchema, type SignalPacket, SignalPacketSchema, SignalSchema, type SignalSource, SignalSourceSchema, type SignalWeight, SignalWeightSchema, type StockChartParams, THEME_PRESETS, THEME_SYSTEM_PROMPT, type TelemetryGraphParams, type ThemeFonts, ThemeFontsSchema, type ThemeOverrides, ThemeOverridesSchema, type ThemePreset, type ThemeTokens, ThemeTokensSchema, type ToolCall, type ToolDefinition, TriggerSchema, type User, UserSchema, type WorkflowDefinition, WorkflowSchema, companyNewsParameters, companyProfileParameters, liveQuoteParameters, stockChartParameters, telemetryGraphParameters };
package/dist/index.js CHANGED
@@ -9,7 +9,7 @@ import { z } from "zod";
9
9
  var FieldSchema = z.object({
10
10
  key: z.string(),
11
11
  label: z.string(),
12
- type: z.enum(["text", "number", "currency", "date", "boolean", "status", "email", "image", "textarea"]),
12
+ type: z.enum(["text", "number", "currency", "percent", "delta", "date", "boolean", "status", "email", "image", "textarea"]),
13
13
  required: z.boolean().optional(),
14
14
  description: z.string().optional(),
15
15
  defaultValue: z.any().optional()
@@ -291,6 +291,10 @@ var stockChartParameters = z5.object({
291
291
  }).describe("The time range for the chart. Choose based on user request or default to '1M'."),
292
292
  metrics: z5.array(z5.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.")
293
293
  });
294
+ var tickerParam = z5.string().min(1).describe("The stock ticker symbol (e.g., 'AAPL', 'TSLA', 'MSFT').");
295
+ var liveQuoteParameters = z5.object({ ticker: tickerParam });
296
+ var companyNewsParameters = z5.object({ ticker: tickerParam });
297
+ var companyProfileParameters = z5.object({ ticker: tickerParam });
294
298
  var AI_TOOLS = {
295
299
  get_telemetry_graph: {
296
300
  name: "get_telemetry_graph",
@@ -301,6 +305,21 @@ var AI_TOOLS = {
301
305
  name: "get_stock_chart",
302
306
  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
307
  parameters: stockChartParameters
308
+ },
309
+ get_live_quote: {
310
+ name: "get_live_quote",
311
+ description: "Fetches and displays the real-time stock price and daily change percentage for a given company ticker symbol.",
312
+ parameters: liveQuoteParameters
313
+ },
314
+ get_company_news: {
315
+ name: "get_company_news",
316
+ description: "Fetches and displays the 5 most recent news headlines and sentiment impact scores for a given company ticker symbol.",
317
+ parameters: companyNewsParameters
318
+ },
319
+ get_company_profile: {
320
+ name: "get_company_profile",
321
+ description: "Fetches fundamental company data including the business description, sector, industry, market cap, and P/E ratio.",
322
+ parameters: companyProfileParameters
304
323
  }
305
324
  };
306
325
 
@@ -576,6 +595,69 @@ var UserSchema = z7.object({
576
595
  lastActive: z7.string().optional(),
577
596
  avatarUrl: z7.string().optional()
578
597
  });
598
+
599
+ // src/counterparty/schema.ts
600
+ import { z as z8 } from "zod";
601
+ var CounterpartyTypeSchema = z8.enum([
602
+ "supplier",
603
+ "customer",
604
+ "partner",
605
+ "competitor",
606
+ "regulator",
607
+ "unknown"
608
+ ]);
609
+ var CounterpartyNodeSchema = z8.object({
610
+ id: z8.string(),
611
+ ticker: z8.string().nullable(),
612
+ name: z8.string(),
613
+ type: CounterpartyTypeSchema,
614
+ confidence: z8.number().min(0).max(1),
615
+ sourceSignalIds: z8.array(z8.number()),
616
+ firstSeenAt: z8.string().datetime(),
617
+ lastSeenAt: z8.string().datetime()
618
+ });
619
+ var RelationshipEdgeTypeSchema = z8.enum([
620
+ "supplies_to",
621
+ "purchases_from",
622
+ "partners_with",
623
+ "competes_with",
624
+ "regulated_by"
625
+ ]);
626
+ var RelationshipEdgeSchema = z8.object({
627
+ id: z8.string(),
628
+ sourceId: z8.string(),
629
+ targetId: z8.string(),
630
+ edgeType: RelationshipEdgeTypeSchema,
631
+ weight: z8.number().min(0).max(1),
632
+ evidenceSignalIds: z8.array(z8.number()),
633
+ updatedAt: z8.string().datetime()
634
+ });
635
+ var SignalWeightSchema = z8.object({
636
+ signalId: z8.number(),
637
+ weight: z8.number().min(0).max(1),
638
+ reason: z8.string().max(280)
639
+ });
640
+ var DivergenceMetricSchema = z8.object({
641
+ ticker: z8.string(),
642
+ metric: z8.enum(["operational", "ux"]),
643
+ score: z8.number(),
644
+ baseline: z8.number(),
645
+ observed: z8.number(),
646
+ computedAt: z8.string().datetime(),
647
+ contributingSignals: z8.array(SignalWeightSchema)
648
+ });
649
+
650
+ // src/non-public-entity/schema.ts
651
+ import { z as z9 } from "zod";
652
+ var NonPublicEntitySchema = z9.object({
653
+ lei: z9.string().nullable(),
654
+ entityName: z9.string(),
655
+ jurisdiction: z9.string().nullable(),
656
+ registrationStatus: z9.string(),
657
+ parentEntityLei: z9.string().nullable(),
658
+ materialMetadata: z9.record(z9.unknown()),
659
+ discoveredAt: z9.string().datetime()
660
+ });
579
661
  export {
580
662
  AIKeyManifestSchema,
581
663
  AIThemeSchema,
@@ -587,17 +669,23 @@ export {
587
669
  AuthStrategySchema,
588
670
  BlockSchema,
589
671
  schema_exports as Bodewell,
672
+ CounterpartyNodeSchema,
673
+ CounterpartyTypeSchema,
590
674
  DEFAULT_CHAT_MODEL,
591
675
  DEFAULT_PRO_MODEL,
592
676
  DEFAULT_SCHEMA_MODEL,
593
677
  DEFAULT_THEME_TOKENS,
678
+ DivergenceMetricSchema,
594
679
  EntitySchema,
595
680
  FieldSchema,
596
681
  FloraTelemetrySchema,
597
682
  GENESIS_LIBRARY_CONTEXT,
598
683
  GENESIS_VALID_COMPONENTS,
684
+ NonPublicEntitySchema,
599
685
  PageSchema,
600
686
  PageSectionSchema,
687
+ RelationshipEdgeSchema,
688
+ RelationshipEdgeTypeSchema,
601
689
  ResourceSchema,
602
690
  SIGNAL_DOMAINS,
603
691
  SIGNAL_KINDS,
@@ -608,6 +696,7 @@ export {
608
696
  SignalPacketSchema,
609
697
  SignalSchema,
610
698
  SignalSourceSchema,
699
+ SignalWeightSchema,
611
700
  THEME_PRESETS,
612
701
  THEME_SYSTEM_PROMPT,
613
702
  ThemeFontsSchema,
@@ -616,6 +705,9 @@ export {
616
705
  TriggerSchema,
617
706
  UserSchema,
618
707
  WorkflowSchema,
708
+ companyNewsParameters,
709
+ companyProfileParameters,
710
+ liveQuoteParameters,
619
711
  stockChartParameters,
620
712
  telemetryGraphParameters
621
713
  };
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "@ramme-io/shared",
3
- "version": "3.0.0",
3
+ "version": "3.1.1",
4
+ "license": "MIT",
4
5
  "private": false,
5
6
  "type": "module",
6
7
  "main": "./dist/index.cjs",
@@ -19,13 +20,13 @@
19
20
  "publishConfig": {
20
21
  "access": "public"
21
22
  },
23
+ "scripts": {
24
+ "build": "tsup index.ts --format esm,cjs --dts --clean"
25
+ },
22
26
  "dependencies": {
23
27
  "zod": "^3.23.8"
24
28
  },
25
29
  "devDependencies": {
26
30
  "tsup": "^8.5.1"
27
- },
28
- "scripts": {
29
- "build": "tsup index.ts --format esm,cjs --dts --clean"
30
31
  }
31
- }
32
+ }