@lssm/lib.observability 0.4.1 → 1.41.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/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # @lssm/lib.observability
2
2
 
3
+ ## 0.5.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Refactor to be compatible with ai-sdk v6
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies
12
+ - @lssm/lib.lifecycle@0.4.0
13
+
3
14
  ## 0.4.1
4
15
 
5
16
  ### Patch Changes
@@ -72,3 +83,8 @@
72
83
  - Metrics collection (counters, histograms)
73
84
  - Structured logging with trace correlation
74
85
  - HTTP tracing middleware
86
+
87
+
88
+
89
+
90
+
package/README.md CHANGED
@@ -46,7 +46,12 @@ app.use(createTracingMiddleware());
46
46
 
47
47
  ## Documentation
48
48
 
49
- Full docs: https://contractspec.chaman.ventures/docs/libraries/observability
49
+ Full docs: https://contractspec.lssm.tech/docs/libraries/observability
50
+
51
+
52
+
53
+
54
+
50
55
 
51
56
 
52
57
 
@@ -1 +1 @@
1
- import{createCounter as e,createHistogram as t,createUpDownCounter as n}from"../metrics/index.mjs";import{o as r}from"../lifecycle/dist/utils/formatters.mjs";import"../lifecycle/dist/index.mjs";import{EventEmitter as i}from"node:events";var a=class{assessmentCounter;confidenceHistogram;stageUpDownCounter;emitter;lowConfidenceThreshold;currentStageByTenant=new Map;constructor(r={}){let a=r.meterName??`@lssm/lib.lifecycle-kpi`;this.assessmentCounter=e(`lifecycle_assessments_total`,`Total lifecycle assessments`,a),this.confidenceHistogram=t(`lifecycle_assessment_confidence`,`Lifecycle assessment confidence distribution`,a),this.stageUpDownCounter=n(`lifecycle_stage_tenants`,`Current tenants per lifecycle stage`,a),this.emitter=r.emitter??new i,this.lowConfidenceThreshold=r.lowConfidenceThreshold??.4}recordAssessment(e,t){let n={stage:r(e.stage),tenantId:t};this.assessmentCounter.add(1,n),this.confidenceHistogram.record(e.confidence,n),this.ensureStageCounters(e.stage,t),this.emitter.emit(`event`,{type:`assessment.recorded`,payload:{tenantId:t,stage:e.stage}}),e.confidence<this.lowConfidenceThreshold&&this.emitter.emit(`event`,{type:`confidence.low`,payload:{tenantId:t,confidence:e.confidence}})}on(e){this.emitter.on(`event`,e)}ensureStageCounters(e,t){if(!t)return;let n=this.currentStageByTenant.get(t);n!==e&&(n!==void 0&&this.stageUpDownCounter.add(-1,{stage:r(n),tenantId:t}),this.stageUpDownCounter.add(1,{stage:r(e),tenantId:t}),this.currentStageByTenant.set(t,e),this.emitter.emit(`event`,{type:`stage.changed`,payload:{tenantId:t,previousStage:n,nextStage:e}}))}};export{a as LifecycleKpiPipeline};
1
+ import{createCounter as e,createHistogram as t,createUpDownCounter as n}from"../metrics/index.mjs";import{EventEmitter as r}from"node:events";import{getStageLabel as i}from"@lssm/lib.lifecycle";var a=class{assessmentCounter;confidenceHistogram;stageUpDownCounter;emitter;lowConfidenceThreshold;currentStageByTenant=new Map;constructor(i={}){let a=i.meterName??`@lssm/lib.lifecycle-kpi`;this.assessmentCounter=e(`lifecycle_assessments_total`,`Total lifecycle assessments`,a),this.confidenceHistogram=t(`lifecycle_assessment_confidence`,`Lifecycle assessment confidence distribution`,a),this.stageUpDownCounter=n(`lifecycle_stage_tenants`,`Current tenants per lifecycle stage`,a),this.emitter=i.emitter??new r,this.lowConfidenceThreshold=i.lowConfidenceThreshold??.4}recordAssessment(e,t){let n={stage:i(e.stage),tenantId:t};this.assessmentCounter.add(1,n),this.confidenceHistogram.record(e.confidence,n),this.ensureStageCounters(e.stage,t),this.emitter.emit(`event`,{type:`assessment.recorded`,payload:{tenantId:t,stage:e.stage}}),e.confidence<this.lowConfidenceThreshold&&this.emitter.emit(`event`,{type:`confidence.low`,payload:{tenantId:t,confidence:e.confidence}})}on(e){this.emitter.on(`event`,e)}ensureStageCounters(e,t){if(!t)return;let n=this.currentStageByTenant.get(t);n!==e&&(n!==void 0&&this.stageUpDownCounter.add(-1,{stage:i(n),tenantId:t}),this.stageUpDownCounter.add(1,{stage:i(e),tenantId:t}),this.currentStageByTenant.set(t,e),this.emitter.emit(`event`,{type:`stage.changed`,payload:{tenantId:t,previousStage:n,nextStage:e}}))}};export{a as LifecycleKpiPipeline};
@@ -1 +1 @@
1
- import{SpanStatusCode as e,context as t,trace as n}from"@opentelemetry/api";function r(e=`@lssm/lib.observability`){return n.getTracer(e)}async function i(t,n,i){return r(i).startActiveSpan(t,async t=>{try{let r=await n(t);return t.setStatus({code:e.OK}),r}catch(n){throw t.recordException(n),t.setStatus({code:e.ERROR,message:n instanceof Error?n.message:String(n)}),n}finally{t.end()}})}function a(t,n,i){return r(i).startActiveSpan(t,t=>{try{let r=n(t);return t.setStatus({code:e.OK}),r}catch(n){throw t.recordException(n),t.setStatus({code:e.ERROR,message:n instanceof Error?n.message:String(n)}),n}finally{t.end()}})}export{r as getTracer,i as traceAsync,a as traceSync};
1
+ import{SpanStatusCode as e,trace as t}from"@opentelemetry/api";function n(e=`@lssm/lib.observability`){return t.getTracer(e)}async function r(t,r,i){return n(i).startActiveSpan(t,async t=>{try{let n=await r(t);return t.setStatus({code:e.OK}),n}catch(n){throw t.recordException(n),t.setStatus({code:e.ERROR,message:n instanceof Error?n.message:String(n)}),n}finally{t.end()}})}function i(t,r,i){return n(i).startActiveSpan(t,t=>{try{let n=r(t);return t.setStatus({code:e.OK}),n}catch(n){throw t.recordException(n),t.setStatus({code:e.ERROR,message:n instanceof Error?n.message:String(n)}),n}finally{t.end()}})}export{n as getTracer,r as traceAsync,i as traceSync};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lssm/lib.observability",
3
- "version": "0.4.1",
3
+ "version": "1.41.0",
4
4
  "main": "./dist/index.mjs",
5
5
  "types": "./dist/index.d.mts",
6
6
  "scripts": {
@@ -16,7 +16,7 @@
16
16
  "test": "bun run"
17
17
  },
18
18
  "dependencies": {
19
- "@lssm/lib.lifecycle": "0.3.1"
19
+ "@lssm/lib.lifecycle": "workspace:*"
20
20
  },
21
21
  "peerDependencies": {
22
22
  "@opentelemetry/api": "*"
@@ -25,23 +25,39 @@
25
25
  "typescript": "^5.0.0"
26
26
  },
27
27
  "exports": {
28
- ".": "./dist/index.mjs",
29
- "./anomaly/alert-manager": "./dist/anomaly/alert-manager.mjs",
30
- "./anomaly/anomaly-detector": "./dist/anomaly/anomaly-detector.mjs",
31
- "./anomaly/baseline-calculator": "./dist/anomaly/baseline-calculator.mjs",
32
- "./anomaly/root-cause-analyzer": "./dist/anomaly/root-cause-analyzer.mjs",
33
- "./intent/aggregator": "./dist/intent/aggregator.mjs",
34
- "./intent/detector": "./dist/intent/detector.mjs",
35
- "./logging": "./dist/logging/index.mjs",
36
- "./metrics": "./dist/metrics/index.mjs",
37
- "./pipeline/evolution-pipeline": "./dist/pipeline/evolution-pipeline.mjs",
38
- "./pipeline/lifecycle-pipeline": "./dist/pipeline/lifecycle-pipeline.mjs",
39
- "./tracing": "./dist/tracing/index.mjs",
40
- "./tracing/middleware": "./dist/tracing/middleware.mjs",
28
+ ".": "./src/index.ts",
29
+ "./anomaly/alert-manager": "./src/anomaly/alert-manager.ts",
30
+ "./anomaly/anomaly-detector": "./src/anomaly/anomaly-detector.ts",
31
+ "./anomaly/baseline-calculator": "./src/anomaly/baseline-calculator.ts",
32
+ "./anomaly/root-cause-analyzer": "./src/anomaly/root-cause-analyzer.ts",
33
+ "./intent/aggregator": "./src/intent/aggregator.ts",
34
+ "./intent/detector": "./src/intent/detector.ts",
35
+ "./logging": "./src/logging/index.ts",
36
+ "./metrics": "./src/metrics/index.ts",
37
+ "./pipeline/evolution-pipeline": "./src/pipeline/evolution-pipeline.ts",
38
+ "./pipeline/lifecycle-pipeline": "./src/pipeline/lifecycle-pipeline.ts",
39
+ "./tracing": "./src/tracing/index.ts",
40
+ "./tracing/middleware": "./src/tracing/middleware.ts",
41
41
  "./*": "./*"
42
42
  },
43
43
  "module": "./dist/index.mjs",
44
44
  "publishConfig": {
45
- "access": "public"
45
+ "access": "public",
46
+ "exports": {
47
+ ".": "./dist/index.mjs",
48
+ "./anomaly/alert-manager": "./dist/anomaly/alert-manager.mjs",
49
+ "./anomaly/anomaly-detector": "./dist/anomaly/anomaly-detector.mjs",
50
+ "./anomaly/baseline-calculator": "./dist/anomaly/baseline-calculator.mjs",
51
+ "./anomaly/root-cause-analyzer": "./dist/anomaly/root-cause-analyzer.mjs",
52
+ "./intent/aggregator": "./dist/intent/aggregator.mjs",
53
+ "./intent/detector": "./dist/intent/detector.mjs",
54
+ "./logging": "./dist/logging/index.mjs",
55
+ "./metrics": "./dist/metrics/index.mjs",
56
+ "./pipeline/evolution-pipeline": "./dist/pipeline/evolution-pipeline.mjs",
57
+ "./pipeline/lifecycle-pipeline": "./dist/pipeline/lifecycle-pipeline.mjs",
58
+ "./tracing": "./dist/tracing/index.mjs",
59
+ "./tracing/middleware": "./dist/tracing/middleware.mjs",
60
+ "./*": "./*"
61
+ }
46
62
  }
47
63
  }
@@ -1,20 +0,0 @@
1
- import { AnomalySignal } from "./anomaly-detector.mjs";
2
- import { RootCauseAnalysis } from "./root-cause-analyzer.mjs";
3
-
4
- //#region src/anomaly/alert-manager.d.ts
5
- interface AlertManagerOptions {
6
- cooldownMs?: number;
7
- transport: (payload: {
8
- signal: AnomalySignal;
9
- analysis: RootCauseAnalysis;
10
- }) => Promise<void> | void;
11
- }
12
- declare class AlertManager {
13
- private readonly options;
14
- private readonly cooldownMs;
15
- private readonly lastAlert;
16
- constructor(options: AlertManagerOptions);
17
- notify(signal: AnomalySignal, analysis: RootCauseAnalysis): Promise<void>;
18
- }
19
- //#endregion
20
- export { AlertManager, AlertManagerOptions };
@@ -1,25 +0,0 @@
1
- import { BaselineCalculator, MetricPoint } from "./baseline-calculator.mjs";
2
-
3
- //#region src/anomaly/anomaly-detector.d.ts
4
- interface AnomalyThresholds {
5
- errorRateDelta?: number;
6
- latencyDelta?: number;
7
- throughputDrop?: number;
8
- minSamples?: number;
9
- }
10
- interface AnomalySignal {
11
- type: 'error_rate_spike' | 'latency_regression' | 'throughput_drop';
12
- delta: number;
13
- point: MetricPoint;
14
- baseline: ReturnType<BaselineCalculator['getSnapshot']>;
15
- }
16
- declare class AnomalyDetector {
17
- private readonly baseline;
18
- private readonly thresholds;
19
- constructor(options?: AnomalyThresholds);
20
- evaluate(point: MetricPoint): AnomalySignal[];
21
- private relativeDelta;
22
- private relativeDrop;
23
- }
24
- //#endregion
25
- export { AnomalyDetector, AnomalySignal, AnomalyThresholds };
@@ -1,25 +0,0 @@
1
- //#region src/anomaly/baseline-calculator.d.ts
2
- interface MetricPoint {
3
- latencyP99: number;
4
- latencyP95: number;
5
- errorRate: number;
6
- throughput: number;
7
- timestamp: Date;
8
- }
9
- interface BaselineSnapshot {
10
- latencyP99: number;
11
- latencyP95: number;
12
- errorRate: number;
13
- throughput: number;
14
- sampleCount: number;
15
- }
16
- declare class BaselineCalculator {
17
- private readonly alpha;
18
- private snapshot;
19
- constructor(alpha?: number);
20
- update(point: MetricPoint): BaselineSnapshot;
21
- getSnapshot(): BaselineSnapshot;
22
- private mix;
23
- }
24
- //#endregion
25
- export { BaselineCalculator, BaselineSnapshot, MetricPoint };
@@ -1,22 +0,0 @@
1
- import { AnomalySignal } from "./anomaly-detector.mjs";
2
-
3
- //#region src/anomaly/root-cause-analyzer.d.ts
4
- interface DeploymentEvent {
5
- id: string;
6
- operation: string;
7
- deployedAt: Date;
8
- stage?: string;
9
- status: 'in_progress' | 'completed' | 'rolled_back';
10
- }
11
- interface RootCauseAnalysis {
12
- signal: AnomalySignal;
13
- culprit?: DeploymentEvent;
14
- notes: string[];
15
- }
16
- declare class RootCauseAnalyzer {
17
- private readonly lookbackMs;
18
- constructor(lookbackMs?: number);
19
- analyze(signal: AnomalySignal, deployments: DeploymentEvent[]): RootCauseAnalysis;
20
- }
21
- //#endregion
22
- export { DeploymentEvent, RootCauseAnalysis, RootCauseAnalyzer };
package/dist/index.d.mts DELETED
@@ -1,13 +0,0 @@
1
- import { BaselineCalculator } from "./anomaly/baseline-calculator.mjs";
2
- import { AnomalyDetector, AnomalySignal, AnomalyThresholds } from "./anomaly/anomaly-detector.mjs";
3
- import { RootCauseAnalysis, RootCauseAnalyzer } from "./anomaly/root-cause-analyzer.mjs";
4
- import { AlertManager } from "./anomaly/alert-manager.mjs";
5
- import { getTracer, traceAsync, traceSync } from "./tracing/index.mjs";
6
- import { createCounter, createHistogram, createUpDownCounter, getMeter, standardMetrics } from "./metrics/index.mjs";
7
- import { LogEntry, LogLevel, Logger, logger } from "./logging/index.mjs";
8
- import { IntentAggregator, IntentAggregatorSnapshot, TelemetrySample } from "./intent/aggregator.mjs";
9
- import { TracingMiddlewareOptions, createTracingMiddleware } from "./tracing/middleware.mjs";
10
- import { IntentDetector, IntentSignal, IntentSignalType } from "./intent/detector.mjs";
11
- import { EvolutionPipeline, EvolutionPipelineEvent, EvolutionPipelineOptions } from "./pipeline/evolution-pipeline.mjs";
12
- import { LifecycleKpiPipeline, LifecycleKpiPipelineOptions, LifecyclePipelineEvent } from "./pipeline/lifecycle-pipeline.mjs";
13
- export { AlertManager, AnomalyDetector, type AnomalySignal, type AnomalyThresholds, BaselineCalculator, EvolutionPipeline, type EvolutionPipelineEvent, type EvolutionPipelineOptions, IntentAggregator, type IntentAggregatorSnapshot, IntentDetector, type IntentSignal, type IntentSignalType, LifecycleKpiPipeline, type LifecycleKpiPipelineOptions, type LifecyclePipelineEvent, type LogEntry, type LogLevel, Logger, type RootCauseAnalysis, RootCauseAnalyzer, type TelemetrySample, type TracingMiddlewareOptions, createCounter, createHistogram, createTracingMiddleware, createUpDownCounter, getMeter, getTracer, logger, standardMetrics, traceAsync, traceSync };
@@ -1,59 +0,0 @@
1
- //#region src/intent/aggregator.d.ts
2
- interface TelemetrySample {
3
- operation: {
4
- name: string;
5
- version: number;
6
- };
7
- durationMs: number;
8
- success: boolean;
9
- timestamp: Date;
10
- errorCode?: string;
11
- tenantId?: string;
12
- traceId?: string;
13
- actorId?: string;
14
- metadata?: Record<string, unknown>;
15
- }
16
- interface AggregatedOperationMetrics {
17
- operation: {
18
- name: string;
19
- version: number;
20
- };
21
- totalCalls: number;
22
- successRate: number;
23
- errorRate: number;
24
- averageLatencyMs: number;
25
- p95LatencyMs: number;
26
- p99LatencyMs: number;
27
- maxLatencyMs: number;
28
- windowStart: Date;
29
- windowEnd: Date;
30
- topErrors: Record<string, number>;
31
- }
32
- interface OperationSequence {
33
- steps: string[];
34
- tenantId?: string;
35
- count: number;
36
- }
37
- interface IntentAggregatorSnapshot {
38
- metrics: AggregatedOperationMetrics[];
39
- sequences: OperationSequence[];
40
- sampleCount: number;
41
- windowStart?: Date;
42
- windowEnd?: Date;
43
- }
44
- interface IntentAggregatorOptions {
45
- windowMs?: number;
46
- sequenceSampleSize?: number;
47
- }
48
- declare class IntentAggregator {
49
- private readonly windowMs;
50
- private readonly sequenceSampleSize;
51
- private readonly samples;
52
- constructor(options?: IntentAggregatorOptions);
53
- add(sample: TelemetrySample): void;
54
- flush(now?: Date): IntentAggregatorSnapshot;
55
- private aggregateMetrics;
56
- private buildSequences;
57
- }
58
- //#endregion
59
- export { AggregatedOperationMetrics, IntentAggregator, IntentAggregatorOptions, IntentAggregatorSnapshot, OperationSequence, TelemetrySample };
@@ -1,31 +0,0 @@
1
- import { AggregatedOperationMetrics, OperationSequence } from "./aggregator.mjs";
2
-
3
- //#region src/intent/detector.d.ts
4
- type IntentSignalType = 'latency-regression' | 'error-spike' | 'throughput-drop' | 'missing-workflow-step';
5
- interface IntentSignal {
6
- id: string;
7
- type: IntentSignalType;
8
- operation?: AggregatedOperationMetrics['operation'];
9
- confidence: number;
10
- description: string;
11
- metadata?: Record<string, unknown>;
12
- evidence: {
13
- type: 'metric' | 'sequence' | 'anomaly';
14
- description: string;
15
- data?: Record<string, unknown>;
16
- }[];
17
- }
18
- interface IntentDetectorOptions {
19
- errorRateThreshold?: number;
20
- latencyP99ThresholdMs?: number;
21
- throughputDropThreshold?: number;
22
- minSequenceLength?: number;
23
- }
24
- declare class IntentDetector {
25
- private readonly options;
26
- constructor(options?: IntentDetectorOptions);
27
- detectFromMetrics(current: AggregatedOperationMetrics[], previous?: AggregatedOperationMetrics[]): IntentSignal[];
28
- detectSequentialIntents(sequences: OperationSequence[]): IntentSignal[];
29
- }
30
- //#endregion
31
- export { IntentDetector, IntentDetectorOptions, IntentSignal, IntentSignalType };
@@ -1 +0,0 @@
1
- import{e,n as t,t as n}from"./types/stages.mjs";import"./types/axes.mjs";import"./types/signals.mjs";import"./types/milestones.mjs";import{o as r,r as i}from"./utils/formatters.mjs";
@@ -1 +0,0 @@
1
- (function(e){return e.Sketch=`Sketch`,e.Prototype=`Prototype`,e.Mvp=`MVP`,e.V1=`V1`,e.Ecosystem=`Ecosystem`,e})({}),function(e){return e.Solo=`Solo`,e.TinyTeam=`TinyTeam`,e.FunctionalOrg=`FunctionalOrg`,e.MultiTeam=`MultiTeam`,e.Bureaucratic=`Bureaucratic`,e}({}),function(e){return e.Bootstrapped=`Bootstrapped`,e.PreSeed=`PreSeed`,e.Seed=`Seed`,e.SeriesAorB=`SeriesAorB`,e.LateStage=`LateStage`,e}({});
@@ -1 +0,0 @@
1
- import"./stages.mjs";
@@ -1 +0,0 @@
1
- import"./stages.mjs";
@@ -1 +0,0 @@
1
- let e=function(e){return e[e.Exploration=0]=`Exploration`,e[e.ProblemSolutionFit=1]=`ProblemSolutionFit`,e[e.MvpEarlyTraction=2]=`MvpEarlyTraction`,e[e.ProductMarketFit=3]=`ProductMarketFit`,e[e.GrowthScaleUp=4]=`GrowthScaleUp`,e[e.ExpansionPlatform=5]=`ExpansionPlatform`,e[e.MaturityRenewal=6]=`MaturityRenewal`,e}({});const t=[e.Exploration,e.ProblemSolutionFit,e.MvpEarlyTraction,e.ProductMarketFit,e.GrowthScaleUp,e.ExpansionPlatform,e.MaturityRenewal],n={[e.Exploration]:{id:e.Exploration,order:0,slug:`exploration`,name:`Exploration / Ideation`,question:`Is there a problem worth my time?`,signals:[`20+ discovery interviews`,`Clear problem statement`,`Named ICP`],traps:[`Branding before discovery`,`Premature tooling decisions`],focusAreas:[`Customer discovery`,`Problem definition`,`Segment clarity`]},[e.ProblemSolutionFit]:{id:e.ProblemSolutionFit,order:1,slug:`problem-solution-fit`,name:`Problem–Solution Fit`,question:`Do people care enough about this solution?`,signals:[`Prototype reuse`,`Referral energy`,`Pre-pay interest`],traps:[`“Market is huge” without users`,`Skipping qualitative loops`],focusAreas:[`Solution hypothesis`,`Value messaging`,`Feedback capture`]},[e.MvpEarlyTraction]:{id:e.MvpEarlyTraction,order:2,slug:`mvp-early-traction`,name:`MVP & Early Traction`,question:`Can we get real usage and learn fast?`,signals:[`20–50 named active users`,`Weekly releases`,`Noisy feedback`],traps:[`Overbuilt infra for 10 users`,`Undefined retention metric`],focusAreas:[`Activation`,`Cohort tracking`,`Feedback rituals`]},[e.ProductMarketFit]:{id:e.ProductMarketFit,order:3,slug:`product-market-fit`,name:`Product–Market Fit`,question:`Is this pulling us forward?`,signals:[`Retention without heroics`,`Organic word-of-mouth`,`Value stories`],traps:[`Hero growth that does not scale`,`Ignoring churn signals`],focusAreas:[`Retention`,`Reliability`,`ICP clarity`]},[e.GrowthScaleUp]:{id:e.GrowthScaleUp,order:4,slug:`growth-scale-up`,name:`Growth / Scale-up`,question:`Can we grow this repeatably?`,signals:[`Predictable channels`,`Specialized hires`,`Unit economics on track`],traps:[`Paid spend masking retention gaps`,`Infra debt blocking launches`],focusAreas:[`Ops systems`,`Growth loops`,`Reliability engineering`]},[e.ExpansionPlatform]:{id:e.ExpansionPlatform,order:5,slug:`expansion-platform`,name:`Expansion / Platform`,question:`What is the next growth curve?`,signals:[`Stable core metrics`,`Partner/API demand`,`Ecosystem pull`],traps:[`Platform theater before wedge is solid`],focusAreas:[`Partnerships`,`APIs`,`New market validation`]},[e.MaturityRenewal]:{id:e.MaturityRenewal,order:6,slug:`maturity-renewal`,name:`Maturity / Renewal`,question:`Optimize, reinvent, or sunset?`,signals:[`Margin focus`,`Portfolio bets`,`Narrative refresh`],traps:[`Assuming past success is enough`],focusAreas:[`Cost optimization`,`Reinvention bets`,`Sunset planning`]}};export{e,n,t};
@@ -1 +0,0 @@
1
- import{n as e,t}from"../types/stages.mjs";const n=e=>[`Product: ${e.product}`,`Company: ${e.company}`,`Capital: ${e.capital}`],r=t=>e[t].name;export{r as o,n as r};
@@ -1,19 +0,0 @@
1
- //#region src/logging/index.d.ts
2
- type LogLevel = 'debug' | 'info' | 'warn' | 'error';
3
- interface LogEntry {
4
- level: LogLevel;
5
- message: string;
6
- [key: string]: unknown;
7
- }
8
- declare class Logger {
9
- private readonly serviceName;
10
- constructor(serviceName: string);
11
- private log;
12
- debug(message: string, meta?: Record<string, unknown>): void;
13
- info(message: string, meta?: Record<string, unknown>): void;
14
- warn(message: string, meta?: Record<string, unknown>): void;
15
- error(message: string, meta?: Record<string, unknown>): void;
16
- }
17
- declare const logger: Logger;
18
- //#endregion
19
- export { LogEntry, LogLevel, Logger, logger };
@@ -1,16 +0,0 @@
1
- import * as _opentelemetry_api0 from "@opentelemetry/api";
2
- import { Counter, Histogram, Meter, UpDownCounter } from "@opentelemetry/api";
3
-
4
- //#region src/metrics/index.d.ts
5
- declare function getMeter(name?: string): Meter;
6
- declare function createCounter(name: string, description?: string, meterName?: string): Counter;
7
- declare function createUpDownCounter(name: string, description?: string, meterName?: string): UpDownCounter;
8
- declare function createHistogram(name: string, description?: string, meterName?: string): Histogram;
9
- declare const standardMetrics: {
10
- httpRequests: Counter<_opentelemetry_api0.Attributes>;
11
- httpDuration: Histogram<_opentelemetry_api0.Attributes>;
12
- operationErrors: Counter<_opentelemetry_api0.Attributes>;
13
- workflowDuration: Histogram<_opentelemetry_api0.Attributes>;
14
- };
15
- //#endregion
16
- export { createCounter, createHistogram, createUpDownCounter, getMeter, standardMetrics };
@@ -1,39 +0,0 @@
1
- import { IntentAggregator, IntentAggregatorSnapshot, TelemetrySample } from "../intent/aggregator.mjs";
2
- import { IntentDetector, IntentSignal } from "../intent/detector.mjs";
3
- import { EventEmitter } from "node:events";
4
-
5
- //#region src/pipeline/evolution-pipeline.d.ts
6
- type EvolutionPipelineEvent = {
7
- type: 'intent.detected';
8
- payload: IntentSignal;
9
- } | {
10
- type: 'telemetry.window';
11
- payload: {
12
- sampleCount: number;
13
- };
14
- };
15
- interface EvolutionPipelineOptions {
16
- detector?: IntentDetector;
17
- aggregator?: IntentAggregator;
18
- emitter?: EventEmitter;
19
- onIntent?: (intent: IntentSignal) => Promise<void> | void;
20
- onSnapshot?: (snapshot: IntentAggregatorSnapshot) => Promise<void> | void;
21
- }
22
- declare class EvolutionPipeline {
23
- private readonly detector;
24
- private readonly aggregator;
25
- private readonly emitter;
26
- private readonly onIntent?;
27
- private readonly onSnapshot?;
28
- private timer?;
29
- private previousMetrics?;
30
- constructor(options?: EvolutionPipelineOptions);
31
- ingest(sample: TelemetrySample): void;
32
- on(listener: (event: EvolutionPipelineEvent) => void): void;
33
- start(intervalMs?: number): void;
34
- stop(): void;
35
- run(): Promise<void>;
36
- private emit;
37
- }
38
- //#endregion
39
- export { EvolutionPipeline, EvolutionPipelineEvent, EvolutionPipelineOptions };
@@ -1,43 +0,0 @@
1
- import { EventEmitter } from "node:events";
2
- import { LifecycleAssessment, LifecycleStage } from "@lssm/lib.lifecycle";
3
-
4
- //#region src/pipeline/lifecycle-pipeline.d.ts
5
- type LifecyclePipelineEvent = {
6
- type: 'assessment.recorded';
7
- payload: {
8
- tenantId?: string;
9
- stage: LifecycleStage;
10
- };
11
- } | {
12
- type: 'stage.changed';
13
- payload: {
14
- tenantId?: string;
15
- previousStage?: LifecycleStage;
16
- nextStage: LifecycleStage;
17
- };
18
- } | {
19
- type: 'confidence.low';
20
- payload: {
21
- tenantId?: string;
22
- confidence: number;
23
- };
24
- };
25
- interface LifecycleKpiPipelineOptions {
26
- meterName?: string;
27
- emitter?: EventEmitter;
28
- lowConfidenceThreshold?: number;
29
- }
30
- declare class LifecycleKpiPipeline {
31
- private readonly assessmentCounter;
32
- private readonly confidenceHistogram;
33
- private readonly stageUpDownCounter;
34
- private readonly emitter;
35
- private readonly lowConfidenceThreshold;
36
- private readonly currentStageByTenant;
37
- constructor(options?: LifecycleKpiPipelineOptions);
38
- recordAssessment(assessment: LifecycleAssessment, tenantId?: string): void;
39
- on(listener: (event: LifecyclePipelineEvent) => void): void;
40
- private ensureStageCounters;
41
- }
42
- //#endregion
43
- export { LifecycleKpiPipeline, LifecycleKpiPipelineOptions, LifecyclePipelineEvent };
@@ -1,8 +0,0 @@
1
- import { Span, Tracer } from "@opentelemetry/api";
2
-
3
- //#region src/tracing/index.d.ts
4
- declare function getTracer(name?: string): Tracer;
5
- declare function traceAsync<T>(name: string, fn: (span: Span) => Promise<T>, tracerName?: string): Promise<T>;
6
- declare function traceSync<T>(name: string, fn: (span: Span) => T, tracerName?: string): T;
7
- //#endregion
8
- export { getTracer, traceAsync, traceSync };
@@ -1,18 +0,0 @@
1
- import { TelemetrySample } from "../intent/aggregator.mjs";
2
-
3
- //#region src/tracing/middleware.d.ts
4
- interface TracingMiddlewareOptions {
5
- resolveOperation?: (input: {
6
- req: Request;
7
- res?: Response;
8
- }) => {
9
- name: string;
10
- version: number;
11
- } | undefined;
12
- onSample?: (sample: TelemetrySample) => void;
13
- tenantResolver?: (req: Request) => string | undefined;
14
- actorResolver?: (req: Request) => string | undefined;
15
- }
16
- declare function createTracingMiddleware(options?: TracingMiddlewareOptions): (req: Request, next: () => Promise<Response>) => Promise<Response>;
17
- //#endregion
18
- export { TracingMiddlewareOptions, createTracingMiddleware };