@lssm/lib.evolution 1.41.1 → 1.42.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1 +1,6 @@
1
- import{SpecAnalyzer as e}from"./analyzer/spec-analyzer.js";import{SpecGenerator as t}from"./generator/spec-generator.js";import{AISpecGenerator as n,createAISpecGenerator as r}from"./generator/ai-spec-generator.js";import{FileSystemSuggestionWriter as i,InMemorySpecSuggestionRepository as a,SpecSuggestionOrchestrator as o}from"./approval/integration.js";export{n as AISpecGenerator,i as FileSystemSuggestionWriter,a as InMemorySpecSuggestionRepository,e as SpecAnalyzer,t as SpecGenerator,o as SpecSuggestionOrchestrator,r as createAISpecGenerator};
1
+ import { SpecAnalyzer } from "./analyzer/spec-analyzer.js";
2
+ import { SpecGenerator } from "./generator/spec-generator.js";
3
+ import { AISpecGenerator, createAISpecGenerator } from "./generator/ai-spec-generator.js";
4
+ import { FileSystemSuggestionWriter, InMemorySpecSuggestionRepository, SpecSuggestionOrchestrator } from "./approval/integration.js";
5
+
6
+ export { AISpecGenerator, FileSystemSuggestionWriter, InMemorySpecSuggestionRepository, SpecAnalyzer, SpecGenerator, SpecSuggestionOrchestrator, createAISpecGenerator };
@@ -0,0 +1,132 @@
1
+ import { LifecycleStage } from "@lssm/lib.lifecycle";
2
+ import { OpKind, OperationSpec, ResourceRefDescriptor } from "@lssm/lib.contracts";
3
+ import { AnySchemaModel } from "@lssm/lib.schema";
4
+
5
+ //#region src/types.d.ts
6
+ type AnomalySeverity = 'low' | 'medium' | 'high';
7
+ type SuggestionStatus = 'pending' | 'approved' | 'rejected';
8
+ interface OperationCoordinate {
9
+ key: string;
10
+ version: number;
11
+ tenantId?: string;
12
+ }
13
+ interface OperationMetricSample {
14
+ operation: OperationCoordinate;
15
+ durationMs: number;
16
+ success: boolean;
17
+ timestamp: Date;
18
+ payloadSizeBytes?: number;
19
+ errorCode?: string;
20
+ errorMessage?: string;
21
+ actor?: string;
22
+ channel?: string;
23
+ traceId?: string;
24
+ metadata?: Record<string, unknown>;
25
+ }
26
+ interface SpecUsageStats {
27
+ operation: OperationCoordinate;
28
+ totalCalls: number;
29
+ successRate: number;
30
+ errorRate: number;
31
+ averageLatencyMs: number;
32
+ p95LatencyMs: number;
33
+ p99LatencyMs: number;
34
+ maxLatencyMs: number;
35
+ lastSeenAt: Date;
36
+ windowStart: Date;
37
+ windowEnd: Date;
38
+ topErrors: Record<string, number>;
39
+ }
40
+ interface SuggestionEvidence {
41
+ type: 'telemetry' | 'user-feedback' | 'simulation' | 'test';
42
+ description: string;
43
+ data?: Record<string, unknown>;
44
+ }
45
+ interface SpecAnomaly {
46
+ operation: OperationCoordinate;
47
+ severity: AnomalySeverity;
48
+ metric: 'latency' | 'error-rate' | 'throughput' | 'policy' | 'schema';
49
+ description: string;
50
+ detectedAt: Date;
51
+ threshold?: number;
52
+ observedValue?: number;
53
+ evidence: SuggestionEvidence[];
54
+ }
55
+ interface PatternConfidence {
56
+ score: number;
57
+ sampleSize: number;
58
+ pValue?: number;
59
+ }
60
+ interface IntentPattern {
61
+ id: string;
62
+ type: 'latency-regression' | 'error-spike' | 'missing-operation' | 'chained-intent' | 'throughput-drop' | 'schema-mismatch';
63
+ description: string;
64
+ operation?: OperationCoordinate;
65
+ confidence: PatternConfidence;
66
+ metadata?: Record<string, unknown>;
67
+ evidence: SuggestionEvidence[];
68
+ }
69
+ interface SpecSuggestionProposal {
70
+ summary: string;
71
+ rationale: string;
72
+ changeType: 'new-spec' | 'revision' | 'policy-update' | 'schema-update';
73
+ kind?: OpKind;
74
+ spec?: OperationSpec<AnySchemaModel, AnySchemaModel | ResourceRefDescriptor<boolean>>;
75
+ diff?: string;
76
+ metadata?: Record<string, unknown>;
77
+ }
78
+ interface SpecSuggestion {
79
+ id: string;
80
+ intent: IntentPattern;
81
+ target?: OperationCoordinate;
82
+ proposal: SpecSuggestionProposal;
83
+ confidence: number;
84
+ createdAt: Date;
85
+ createdBy: string;
86
+ status: SuggestionStatus;
87
+ evidence: SuggestionEvidence[];
88
+ priority: 'low' | 'medium' | 'high';
89
+ tags?: string[];
90
+ approvals?: {
91
+ reviewer?: string;
92
+ notes?: string;
93
+ decidedAt?: Date;
94
+ status?: SuggestionStatus;
95
+ };
96
+ }
97
+ interface EvolutionConfig {
98
+ minConfidence?: number;
99
+ autoApproveThreshold?: number;
100
+ maxSuggestionsPerOperation?: number;
101
+ requireApproval?: boolean;
102
+ maxConcurrentExperiments?: number;
103
+ }
104
+ interface SpecSuggestionFilters {
105
+ status?: SuggestionStatus;
106
+ operationKey?: string;
107
+ }
108
+ interface SpecSuggestionRepository {
109
+ create(suggestion: SpecSuggestion): Promise<void>;
110
+ getById(id: string): Promise<SpecSuggestion | undefined>;
111
+ updateStatus(id: string, status: SuggestionStatus, metadata?: {
112
+ reviewer?: string;
113
+ notes?: string;
114
+ decidedAt?: Date;
115
+ }): Promise<void>;
116
+ list(filters?: SpecSuggestionFilters): Promise<SpecSuggestion[]>;
117
+ }
118
+ interface SpecSuggestionWriter {
119
+ write(suggestion: SpecSuggestion): Promise<string>;
120
+ }
121
+ interface OptimizationHint {
122
+ operation: OperationCoordinate;
123
+ category: 'schema' | 'policy' | 'performance' | 'error-handling';
124
+ summary: string;
125
+ justification: string;
126
+ recommendedActions: string[];
127
+ lifecycleStage?: LifecycleStage;
128
+ lifecycleNotes?: string;
129
+ }
130
+ //#endregion
131
+ export { AnomalySeverity, EvolutionConfig, IntentPattern, OperationCoordinate, OperationMetricSample, OptimizationHint, PatternConfidence, SpecAnomaly, SpecSuggestion, SpecSuggestionFilters, SpecSuggestionProposal, SpecSuggestionRepository, SpecSuggestionWriter, SpecUsageStats, SuggestionEvidence, SuggestionStatus };
132
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","names":[],"sources":["../src/types.ts"],"sourcesContent":[],"mappings":";;;;;KAQY,eAAA;KACA,gBAAA;AADA,UAG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A,MAAA;EAMI,aAAA,CAAA,EAAA,MAAA;EACH,QAAA,EAtDD,kBAsDC,EAAA;;AAII,UAvDA,iBAAA,CAuDe;EAQf,KAAA,EAAA,MAAA;EAKA,UAAA,EAAA,MAAA;EACI,MAAA,CAAA,EAAA,MAAA;;AACU,UAhEd,aAAA,CAgEc;EAAR,EAAA,EAAA,MAAA;EAGX,IAAA,EAAA,oBAAA,GAAA,aAAA,GAAA,mBAAA,GAAA,gBAAA,GAAA,iBAAA,GAAA,iBAAA;EACoD,WAAA,EAAA,MAAA;EAC3D,SAAA,CAAA,EA3DS,mBA2DT;EACY,UAAA,EA3DH,iBA2DG;EAAgC,QAAA,CAAA,EA1DpC,MA0DoC,CAAA,MAAA,EAAA,OAAA,CAAA;EAAR,QAAA,EAzD7B,kBAyD6B,EAAA;;AAGxB,UAzDA,sBAAA,CA0DG;EAGH,OAAA,EAAA,MAAA;;;SAzDR;SACA,cACL,gBACA,iBAAiB;;aAGR;;UAGI,cAAA;;UAEP;WACC;YACC;;aAEC;;UAEH;YACE;;;;;;gBAMI;aACH;;;UAII,eAAA;;;;;;;UAQA,qBAAA;WACN;;;UAIM,wBAAA;qBACI,iBAAiB;uBACf,QAAQ;mCAGnB;;;gBACoD;MAC3D;iBACY,wBAAwB,QAAQ;;UAGhC,oBAAA;oBACG,iBAAiB;;UAGpB,gBAAA;aACJ;;;;;mBAKM"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lssm/lib.evolution",
3
- "version": "1.41.1",
3
+ "version": "1.42.2",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -12,7 +12,7 @@
12
12
  "scripts": {
13
13
  "publish:pkg": "bun publish --tolerate-republish --ignore-scripts --verbose",
14
14
  "publish:pkg:canary": "bun publish:pkg --tag canary",
15
- "build": "bun build:bundle && bun build:types",
15
+ "build": "bun build:types && bun build:bundle",
16
16
  "build:bundle": "tsdown",
17
17
  "build:types": "tsc --noEmit",
18
18
  "dev": "bun build:bundle --watch",
@@ -23,25 +23,25 @@
23
23
  "test": "bun test"
24
24
  },
25
25
  "dependencies": {
26
- "ai": "beta",
26
+ "ai": "6.0.3",
27
27
  "zod": "^4.1.13",
28
- "@lssm/lib.ai-agent": "1.41.1",
29
- "@lssm/lib.contracts": "1.41.1",
30
- "@lssm/lib.lifecycle": "1.41.1",
31
- "@lssm/lib.observability": "1.41.1",
32
- "@lssm/lib.schema": "1.41.1"
28
+ "@lssm/lib.ai-agent": "1.42.2",
29
+ "@lssm/lib.contracts": "1.42.2",
30
+ "@lssm/lib.lifecycle": "1.42.2",
31
+ "@lssm/lib.observability": "1.42.2",
32
+ "@lssm/lib.schema": "1.42.2"
33
33
  },
34
34
  "peerDependencies": {
35
- "@prisma/client": "7.1.0"
35
+ "@prisma/client": "7.2.0"
36
36
  },
37
37
  "devDependencies": {
38
- "@lssm/tool.tsdown": "1.41.1",
39
- "@lssm/tool.typescript": "1.41.1",
40
- "tsdown": "^0.17.4",
38
+ "@lssm/tool.tsdown": "1.42.2",
39
+ "@lssm/tool.typescript": "1.42.2",
40
+ "tsdown": "^0.18.3",
41
41
  "typescript": "^5.9.3"
42
42
  },
43
43
  "exports": {
44
- ".": "./src/index.ts",
44
+ ".": "./dist/index.js",
45
45
  "./*": "./*"
46
46
  },
47
47
  "publishConfig": {
@@ -49,6 +49,13 @@
49
49
  "exports": {
50
50
  ".": "./dist/index.js",
51
51
  "./*": "./*"
52
- }
52
+ },
53
+ "registry": "https://registry.npmjs.org/"
54
+ },
55
+ "license": "MIT",
56
+ "repository": {
57
+ "type": "git",
58
+ "url": "https://github.com/lssm-tech/contractspec.git",
59
+ "directory": "packages/libs/evolution"
53
60
  }
54
61
  }