@xerg/schemas 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @xerg/schemas
2
2
 
3
- Versioned TypeScript wire types for Xerg audit payloads, daily rollups, findings, comparisons, and recommendations.
3
+ Versioned TypeScript wire types for Xerg audit payloads, daily rollups, findings, comparisons, and the hosted Action Center recommendation contract.
4
4
 
5
5
  ## What it is
6
6
 
@@ -11,6 +11,7 @@ It is intentionally small and stable:
11
11
  - TypeScript-first types for Xerg wire payloads
12
12
  - Daily spend and waste rollups for hosted dashboards and ingestion pipelines
13
13
  - A runtime `AUDIT_PUSH_PAYLOAD_VERSION` constant for compatibility checks
14
+ - The ranked recommendation contract used by Xerg Cloud, Ask Xerg, and hosted MCP
14
15
  - A dependency-light package surface for backends, ingestion services, and internal tooling
15
16
 
16
17
  ## What it is not
@@ -53,10 +54,10 @@ Current version:
53
54
  ```ts
54
55
  import { AUDIT_PUSH_PAYLOAD_VERSION } from '@xerg/schemas';
55
56
 
56
- AUDIT_PUSH_PAYLOAD_VERSION; // 1
57
+ AUDIT_PUSH_PAYLOAD_VERSION; // 2
57
58
  ```
58
59
 
59
- Daily series such as `spendByDay` and `wasteByDay` were added without bumping the payload version because they are additive fields that older consumers can ignore safely.
60
+ Version `2` adds the richer `XergRecommendation` contract to the pushed payload. Recommendations are now first-class wire data rather than a local-only CLI add-on.
60
61
 
61
62
  ## Exports
62
63
 
@@ -68,6 +69,9 @@ Primary exports include:
68
69
  - `WireFinding`
69
70
  - `WireComparison`
70
71
  - `XergRecommendation`
72
+ - `XergRecommendationPriorityBucket`
73
+ - `XergRecommendationSurface`
74
+ - `XergRecommendationCategory`
71
75
  - `AUDIT_PUSH_PAYLOAD_VERSION`
72
76
 
73
77
  ## Use cases
@@ -75,3 +79,4 @@ Primary exports include:
75
79
  - Share a single payload contract between the Xerg CLI and backend services
76
80
  - Type audit ingestion pipelines without copying interface definitions
77
81
  - Gate processing logic on an explicit payload version
82
+ - Keep hosted action queues, MCP tools, and dashboard recommendation cards aligned with the CLI
package/dist/index.d.ts CHANGED
@@ -24,7 +24,37 @@ interface WireFinding {
24
24
  costImpactUsd: number;
25
25
  }
26
26
 
27
- declare const AUDIT_PUSH_PAYLOAD_VERSION: 1;
27
+ type XergRecommendationPriorityBucket = 'fix_now' | 'test_next' | 'watch';
28
+ type XergRecommendationSurface = 'retry_policy' | 'loop_guard' | 'model_routing' | 'scheduler' | 'prompt_builder' | 'user_behavior' | 'other';
29
+ type XergRecommendationCategory = 'structural_efficiency' | 'model_fit' | 'context_hygiene' | 'cadence_activity' | 'other';
30
+ type XergRecommendationSeverity = 'high' | 'medium' | 'low';
31
+ type XergRecommendationConfidence = 'high' | 'medium' | 'low';
32
+ type XergRecommendationEffort = 'low' | 'medium' | 'high';
33
+ type XergRecommendationScope = 'workspace' | 'source' | 'workflow';
34
+ interface XergRecommendation {
35
+ id: string;
36
+ findingId: string;
37
+ kind: string;
38
+ title: string;
39
+ summary: string;
40
+ priorityBucket: XergRecommendationPriorityBucket;
41
+ recommendedOrder: number;
42
+ implementationSurface: XergRecommendationSurface;
43
+ category: XergRecommendationCategory;
44
+ severity: XergRecommendationSeverity;
45
+ estimatedSavingsUsd: number;
46
+ estimatedSavingsPct: number;
47
+ confidence: XergRecommendationConfidence;
48
+ effort: XergRecommendationEffort;
49
+ scope: XergRecommendationScope;
50
+ scopeId: string;
51
+ scopeLabel: string;
52
+ whereToChange: string;
53
+ validationPlan: string;
54
+ actions: string[];
55
+ }
56
+
57
+ declare const AUDIT_PUSH_PAYLOAD_VERSION: 2;
28
58
  type AuditPushPayloadVersion = typeof AUDIT_PUSH_PAYLOAD_VERSION;
29
59
  type PushEnvironment = 'local' | 'remote' | 'railway';
30
60
  interface FindingTaxonomyBucket {
@@ -72,6 +102,7 @@ interface AuditPushPayload {
72
102
  spendByDay: DailySpendBreakdown[];
73
103
  wasteByDay: DailyWasteBreakdown[];
74
104
  findings: WireFinding[];
105
+ recommendations: XergRecommendation[];
75
106
  notes: string[];
76
107
  comparison?: WireComparison | null;
77
108
  };
@@ -84,16 +115,4 @@ interface AuditPushPayload {
84
115
  };
85
116
  }
86
117
 
87
- interface XergRecommendation {
88
- id: string;
89
- findingId: string;
90
- kind: string;
91
- title: string;
92
- description: string;
93
- estimatedSavingsUsd: number;
94
- confidence: 'high' | 'medium' | 'low';
95
- actionType: 'model-switch' | 'cache-config' | 'prompt-trim' | 'dedup' | 'other';
96
- suggestedChange?: Record<string, unknown>;
97
- }
98
-
99
- export { AUDIT_PUSH_PAYLOAD_VERSION, type AuditPushPayload, type AuditPushPayloadVersion, type DailySpendBreakdown, type DailyWasteBreakdown, type FindingTaxonomyBucket, type PushEnvironment, type SpendBreakdown, type WireComparison, type WireFinding, type WireFindingScope, type XergRecommendation };
118
+ export { AUDIT_PUSH_PAYLOAD_VERSION, type AuditPushPayload, type AuditPushPayloadVersion, type DailySpendBreakdown, type DailyWasteBreakdown, type FindingTaxonomyBucket, type PushEnvironment, type SpendBreakdown, type WireComparison, type WireFinding, type WireFindingScope, type XergRecommendation, type XergRecommendationCategory, type XergRecommendationConfidence, type XergRecommendationEffort, type XergRecommendationPriorityBucket, type XergRecommendationScope, type XergRecommendationSeverity, type XergRecommendationSurface };
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // src/audit-push-payload.ts
2
- var AUDIT_PUSH_PAYLOAD_VERSION = 1;
2
+ var AUDIT_PUSH_PAYLOAD_VERSION = 2;
3
3
  export {
4
4
  AUDIT_PUSH_PAYLOAD_VERSION
5
5
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xerg/schemas",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "description": "Versioned TypeScript wire types for Xerg audit payloads, daily rollups, findings, comparisons, and recommendations.",
5
5
  "keywords": [
6
6
  "xerg",