@ai-dev-orchestrator/schemas 0.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.
Files changed (103) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +51 -0
  3. package/dist/artifacts/agreement-artifacts.d.ts +311 -0
  4. package/dist/artifacts/agreement-artifacts.js +48 -0
  5. package/dist/artifacts/artifact-dependency-graph.d.ts +775 -0
  6. package/dist/artifacts/artifact-dependency-graph.js +57 -0
  7. package/dist/artifacts/artifact-system.d.ts +657 -0
  8. package/dist/artifacts/artifact-system.js +124 -0
  9. package/dist/artifacts/index.d.ts +3 -0
  10. package/dist/artifacts/index.js +3 -0
  11. package/dist/config/configuration.d.ts +324 -0
  12. package/dist/config/configuration.js +93 -0
  13. package/dist/config/event-bus-config.d.ts +153 -0
  14. package/dist/config/event-bus-config.js +27 -0
  15. package/dist/config/event-payloads.d.ts +919 -0
  16. package/dist/config/event-payloads.js +304 -0
  17. package/dist/config/event-system.d.ts +3231 -0
  18. package/dist/config/event-system.js +428 -0
  19. package/dist/config/event-types.d.ts +62 -0
  20. package/dist/config/event-types.js +66 -0
  21. package/dist/config/index.d.ts +5 -0
  22. package/dist/config/index.js +5 -0
  23. package/dist/dashboard/dashboard-api.d.ts +149 -0
  24. package/dist/dashboard/dashboard-api.js +80 -0
  25. package/dist/dashboard/dashboard-domain.d.ts +1076 -0
  26. package/dist/dashboard/dashboard-domain.js +305 -0
  27. package/dist/dashboard/index.d.ts +3 -0
  28. package/dist/dashboard/index.js +3 -0
  29. package/dist/dashboard/run-creation-params.d.ts +111 -0
  30. package/dist/dashboard/run-creation-params.js +14 -0
  31. package/dist/governance/governance.d.ts +1119 -0
  32. package/dist/governance/governance.js +111 -0
  33. package/dist/governance/index.d.ts +3 -0
  34. package/dist/governance/index.js +3 -0
  35. package/dist/governance/policy-engine.d.ts +634 -0
  36. package/dist/governance/policy-engine.js +214 -0
  37. package/dist/governance/review-resolution.d.ts +1053 -0
  38. package/dist/governance/review-resolution.js +67 -0
  39. package/dist/index.d.ts +10 -0
  40. package/dist/index.js +10 -0
  41. package/dist/observability/diagnostics.d.ts +185 -0
  42. package/dist/observability/diagnostics.js +63 -0
  43. package/dist/observability/index.d.ts +2 -0
  44. package/dist/observability/index.js +2 -0
  45. package/dist/observability/metrics.d.ts +187 -0
  46. package/dist/observability/metrics.js +67 -0
  47. package/dist/persistence/execution-analytics.d.ts +173 -0
  48. package/dist/persistence/execution-analytics.js +71 -0
  49. package/dist/persistence/index.d.ts +5 -0
  50. package/dist/persistence/index.js +5 -0
  51. package/dist/persistence/project-context.d.ts +164 -0
  52. package/dist/persistence/project-context.js +88 -0
  53. package/dist/persistence/repository-model.d.ts +27 -0
  54. package/dist/persistence/repository-model.js +16 -0
  55. package/dist/persistence/run-manifest.d.ts +422 -0
  56. package/dist/persistence/run-manifest.js +118 -0
  57. package/dist/persistence/state-persistence.d.ts +276 -0
  58. package/dist/persistence/state-persistence.js +83 -0
  59. package/dist/runner/built-in-runner-ids.d.ts +8 -0
  60. package/dist/runner/built-in-runner-ids.js +11 -0
  61. package/dist/runner/collaboration-model.d.ts +100 -0
  62. package/dist/runner/collaboration-model.js +19 -0
  63. package/dist/runner/confidence.d.ts +17 -0
  64. package/dist/runner/confidence.js +11 -0
  65. package/dist/runner/index.d.ts +8 -0
  66. package/dist/runner/index.js +8 -0
  67. package/dist/runner/permission-approval.d.ts +38 -0
  68. package/dist/runner/permission-approval.js +14 -0
  69. package/dist/runner/prompt-engine.d.ts +1467 -0
  70. package/dist/runner/prompt-engine.js +193 -0
  71. package/dist/runner/role-system.d.ts +458 -0
  72. package/dist/runner/role-system.js +94 -0
  73. package/dist/runner/runner-system.d.ts +1721 -0
  74. package/dist/runner/runner-system.js +268 -0
  75. package/dist/runner/task-brief.d.ts +18 -0
  76. package/dist/runner/task-brief.js +12 -0
  77. package/dist/shared/index.d.ts +3 -0
  78. package/dist/shared/index.js +3 -0
  79. package/dist/shared/shared.d.ts +30 -0
  80. package/dist/shared/shared.js +27 -0
  81. package/dist/shared/string-enums.d.ts +59 -0
  82. package/dist/shared/string-enums.js +24 -0
  83. package/dist/shared/utils.d.ts +25 -0
  84. package/dist/shared/utils.js +22 -0
  85. package/dist/specification/canonical-specification.d.ts +475 -0
  86. package/dist/specification/canonical-specification.js +151 -0
  87. package/dist/specification/index.d.ts +3 -0
  88. package/dist/specification/index.js +3 -0
  89. package/dist/specification/intake.d.ts +419 -0
  90. package/dist/specification/intake.js +70 -0
  91. package/dist/specification/iteration-contracts.d.ts +421 -0
  92. package/dist/specification/iteration-contracts.js +61 -0
  93. package/dist/workflow/index.d.ts +4 -0
  94. package/dist/workflow/index.js +4 -0
  95. package/dist/workflow/workflow-dsl.d.ts +81 -0
  96. package/dist/workflow/workflow-dsl.js +38 -0
  97. package/dist/workflow/workflow-engine.d.ts +5788 -0
  98. package/dist/workflow/workflow-engine.js +414 -0
  99. package/dist/workflow/workflow-file.d.ts +331 -0
  100. package/dist/workflow/workflow-file.js +41 -0
  101. package/dist/workflow/workflow-journal.d.ts +520 -0
  102. package/dist/workflow/workflow-journal.js +151 -0
  103. package/package.json +39 -0
@@ -0,0 +1,67 @@
1
+ import { z } from 'zod/v4';
2
+ import { artifactRefSchema } from '../artifacts/artifact-system';
3
+ export const findingBlockingSchema = z.enum(['must_fix', 'should_fix', 'nit']);
4
+ export const findingCategorySchema = z.enum([
5
+ 'correctness',
6
+ 'completeness',
7
+ 'consistency',
8
+ 'security',
9
+ 'performance',
10
+ 'maintainability',
11
+ 'style',
12
+ 'documentation',
13
+ 'test_coverage',
14
+ 'architecture',
15
+ 'other',
16
+ ]);
17
+ export const findingStatusSchema = z.enum([
18
+ 'open',
19
+ 'addressed',
20
+ 'accepted',
21
+ 'rejected',
22
+ 'escalated',
23
+ ]);
24
+ export const findingLocationSchema = z.object({
25
+ artifactRef: artifactRefSchema,
26
+ section: z.string().optional(),
27
+ line: z.number().optional(),
28
+ snippet: z.string().optional(),
29
+ });
30
+ export const findingResolutionSchema = z.object({
31
+ status: findingStatusSchema,
32
+ resolvedInArtifact: artifactRefSchema.optional(),
33
+ resolvedBy: z.string(),
34
+ rationale: z.string(),
35
+ timestamp: z.string(),
36
+ });
37
+ export const findingSchema = z.object({
38
+ id: z.string(),
39
+ severity: z.string(),
40
+ blocking: findingBlockingSchema,
41
+ category: findingCategorySchema,
42
+ title: z.string(),
43
+ description: z.string(),
44
+ location: findingLocationSchema.optional(),
45
+ suggestedFix: z.string().optional(),
46
+ status: findingStatusSchema,
47
+ resolution: findingResolutionSchema.optional(),
48
+ supersedes: z.string().optional(),
49
+ });
50
+ export const aggregatedFindingsSchema = z.object({
51
+ total: z.number(),
52
+ bySeverity: z.record(z.string(), z.number()),
53
+ byStatus: z.record(z.string(), z.number()),
54
+ byCategory: z.record(z.string(), z.number()),
55
+ blocking: z.array(findingSchema).readonly(),
56
+ nonBlocking: z.array(findingSchema).readonly(),
57
+ });
58
+ export const correlatedFindingSchema = z.object({
59
+ finding: findingSchema,
60
+ producedIn: artifactRefSchema,
61
+ addressedIn: artifactRefSchema.optional(),
62
+ verifiedIn: artifactRefSchema.optional(),
63
+ });
64
+ export const correlatedFindingsSchema = z.object({
65
+ findings: z.array(correlatedFindingSchema).readonly(),
66
+ resolutionRate: z.number(),
67
+ });
@@ -0,0 +1,10 @@
1
+ export * from './shared';
2
+ export * from './artifacts';
3
+ export * from './workflow';
4
+ export * from './specification';
5
+ export * from './governance';
6
+ export * from './runner';
7
+ export * from './dashboard';
8
+ export * from './config';
9
+ export * from './observability';
10
+ export * from './persistence';
package/dist/index.js ADDED
@@ -0,0 +1,10 @@
1
+ export * from './shared';
2
+ export * from './artifacts';
3
+ export * from './workflow';
4
+ export * from './specification';
5
+ export * from './governance';
6
+ export * from './runner';
7
+ export * from './dashboard';
8
+ export * from './config';
9
+ export * from './observability';
10
+ export * from './persistence';
@@ -0,0 +1,185 @@
1
+ import { z } from 'zod/v4';
2
+ export declare const diagnosticSeveritySchema: z.ZodEnum<{
3
+ error: "error";
4
+ info: "info";
5
+ warning: "warning";
6
+ hint: "hint";
7
+ }>;
8
+ export type DiagnosticSeverity = z.infer<typeof diagnosticSeveritySchema>;
9
+ export declare const diagnosticEntrySchema: z.ZodObject<{
10
+ severity: z.ZodEnum<{
11
+ error: "error";
12
+ info: "info";
13
+ warning: "warning";
14
+ hint: "hint";
15
+ }>;
16
+ code: z.ZodString;
17
+ message: z.ZodString;
18
+ subsystem: z.ZodString;
19
+ context: z.ZodRecord<z.ZodString, z.ZodUnknown>;
20
+ timestamp: z.ZodString;
21
+ suggestion: z.ZodOptional<z.ZodString>;
22
+ }, z.core.$strip>;
23
+ export type DiagnosticEntry = z.infer<typeof diagnosticEntrySchema>;
24
+ export declare const diagnosticReportSummarySchema: z.ZodObject<{
25
+ totalEntries: z.ZodNumber;
26
+ errorCount: z.ZodNumber;
27
+ warningCount: z.ZodNumber;
28
+ infoCount: z.ZodNumber;
29
+ hintCount: z.ZodNumber;
30
+ subsystemsAffected: z.ZodReadonly<z.ZodArray<z.ZodString>>;
31
+ }, z.core.$strip>;
32
+ export type DiagnosticReportSummary = z.infer<typeof diagnosticReportSummarySchema>;
33
+ export declare const errorChainEntrySchema: z.ZodObject<{
34
+ source: z.ZodString;
35
+ code: z.ZodString;
36
+ message: z.ZodString;
37
+ timestamp: z.ZodString;
38
+ }, z.core.$strip>;
39
+ export type ErrorChainEntry = z.infer<typeof errorChainEntrySchema>;
40
+ export declare const failureAnalysisSchema: z.ZodObject<{
41
+ runId: z.ZodString;
42
+ failedAt: z.ZodString;
43
+ failedState: z.ZodString;
44
+ rootCause: z.ZodString;
45
+ contributingFactors: z.ZodReadonly<z.ZodArray<z.ZodString>>;
46
+ errorChain: z.ZodReadonly<z.ZodArray<z.ZodObject<{
47
+ source: z.ZodString;
48
+ code: z.ZodString;
49
+ message: z.ZodString;
50
+ timestamp: z.ZodString;
51
+ }, z.core.$strip>>>;
52
+ recommendation: z.ZodString;
53
+ }, z.core.$strip>;
54
+ export type FailureAnalysis = z.infer<typeof failureAnalysisSchema>;
55
+ export declare const configurationIssueSchema: z.ZodObject<{
56
+ severity: z.ZodEnum<{
57
+ error: "error";
58
+ info: "info";
59
+ warning: "warning";
60
+ hint: "hint";
61
+ }>;
62
+ path: z.ZodString;
63
+ message: z.ZodString;
64
+ currentValue: z.ZodUnknown;
65
+ expectedValue: z.ZodOptional<z.ZodUnknown>;
66
+ suggestion: z.ZodOptional<z.ZodString>;
67
+ }, z.core.$strip>;
68
+ export type ConfigurationIssue = z.infer<typeof configurationIssueSchema>;
69
+ export declare const configurationInspectionSchema: z.ZodObject<{
70
+ valid: z.ZodBoolean;
71
+ entries: z.ZodReadonly<z.ZodArray<z.ZodObject<{
72
+ severity: z.ZodEnum<{
73
+ error: "error";
74
+ info: "info";
75
+ warning: "warning";
76
+ hint: "hint";
77
+ }>;
78
+ path: z.ZodString;
79
+ message: z.ZodString;
80
+ currentValue: z.ZodUnknown;
81
+ expectedValue: z.ZodOptional<z.ZodUnknown>;
82
+ suggestion: z.ZodOptional<z.ZodString>;
83
+ }, z.core.$strip>>>;
84
+ checkedAt: z.ZodString;
85
+ }, z.core.$strip>;
86
+ export type ConfigurationInspection = z.infer<typeof configurationInspectionSchema>;
87
+ export declare const subsystemDiagnosticSchema: z.ZodObject<{
88
+ subsystem: z.ZodString;
89
+ status: z.ZodString;
90
+ entries: z.ZodReadonly<z.ZodArray<z.ZodObject<{
91
+ severity: z.ZodEnum<{
92
+ error: "error";
93
+ info: "info";
94
+ warning: "warning";
95
+ hint: "hint";
96
+ }>;
97
+ code: z.ZodString;
98
+ message: z.ZodString;
99
+ subsystem: z.ZodString;
100
+ context: z.ZodRecord<z.ZodString, z.ZodUnknown>;
101
+ timestamp: z.ZodString;
102
+ suggestion: z.ZodOptional<z.ZodString>;
103
+ }, z.core.$strip>>>;
104
+ metrics: z.ZodRecord<z.ZodString, z.ZodNumber>;
105
+ checkedAt: z.ZodString;
106
+ }, z.core.$strip>;
107
+ export type SubsystemDiagnostic = z.infer<typeof subsystemDiagnosticSchema>;
108
+ export declare const diagnosticReportSchema: z.ZodObject<{
109
+ generatedAt: z.ZodString;
110
+ runId: z.ZodNullable<z.ZodString>;
111
+ entries: z.ZodReadonly<z.ZodArray<z.ZodObject<{
112
+ severity: z.ZodEnum<{
113
+ error: "error";
114
+ info: "info";
115
+ warning: "warning";
116
+ hint: "hint";
117
+ }>;
118
+ code: z.ZodString;
119
+ message: z.ZodString;
120
+ subsystem: z.ZodString;
121
+ context: z.ZodRecord<z.ZodString, z.ZodUnknown>;
122
+ timestamp: z.ZodString;
123
+ suggestion: z.ZodOptional<z.ZodString>;
124
+ }, z.core.$strip>>>;
125
+ summary: z.ZodObject<{
126
+ totalEntries: z.ZodNumber;
127
+ errorCount: z.ZodNumber;
128
+ warningCount: z.ZodNumber;
129
+ infoCount: z.ZodNumber;
130
+ hintCount: z.ZodNumber;
131
+ subsystemsAffected: z.ZodReadonly<z.ZodArray<z.ZodString>>;
132
+ }, z.core.$strip>;
133
+ failureAnalysis: z.ZodNullable<z.ZodObject<{
134
+ runId: z.ZodString;
135
+ failedAt: z.ZodString;
136
+ failedState: z.ZodString;
137
+ rootCause: z.ZodString;
138
+ contributingFactors: z.ZodReadonly<z.ZodArray<z.ZodString>>;
139
+ errorChain: z.ZodReadonly<z.ZodArray<z.ZodObject<{
140
+ source: z.ZodString;
141
+ code: z.ZodString;
142
+ message: z.ZodString;
143
+ timestamp: z.ZodString;
144
+ }, z.core.$strip>>>;
145
+ recommendation: z.ZodString;
146
+ }, z.core.$strip>>;
147
+ configurationInspection: z.ZodNullable<z.ZodObject<{
148
+ valid: z.ZodBoolean;
149
+ entries: z.ZodReadonly<z.ZodArray<z.ZodObject<{
150
+ severity: z.ZodEnum<{
151
+ error: "error";
152
+ info: "info";
153
+ warning: "warning";
154
+ hint: "hint";
155
+ }>;
156
+ path: z.ZodString;
157
+ message: z.ZodString;
158
+ currentValue: z.ZodUnknown;
159
+ expectedValue: z.ZodOptional<z.ZodUnknown>;
160
+ suggestion: z.ZodOptional<z.ZodString>;
161
+ }, z.core.$strip>>>;
162
+ checkedAt: z.ZodString;
163
+ }, z.core.$strip>>;
164
+ subsystemDiagnostics: z.ZodReadonly<z.ZodArray<z.ZodObject<{
165
+ subsystem: z.ZodString;
166
+ status: z.ZodString;
167
+ entries: z.ZodReadonly<z.ZodArray<z.ZodObject<{
168
+ severity: z.ZodEnum<{
169
+ error: "error";
170
+ info: "info";
171
+ warning: "warning";
172
+ hint: "hint";
173
+ }>;
174
+ code: z.ZodString;
175
+ message: z.ZodString;
176
+ subsystem: z.ZodString;
177
+ context: z.ZodRecord<z.ZodString, z.ZodUnknown>;
178
+ timestamp: z.ZodString;
179
+ suggestion: z.ZodOptional<z.ZodString>;
180
+ }, z.core.$strip>>>;
181
+ metrics: z.ZodRecord<z.ZodString, z.ZodNumber>;
182
+ checkedAt: z.ZodString;
183
+ }, z.core.$strip>>>;
184
+ }, z.core.$strip>;
185
+ export type DiagnosticReport = z.infer<typeof diagnosticReportSchema>;
@@ -0,0 +1,63 @@
1
+ import { z } from 'zod/v4';
2
+ export const diagnosticSeveritySchema = z.enum(['error', 'warning', 'info', 'hint']);
3
+ export const diagnosticEntrySchema = z.object({
4
+ severity: diagnosticSeveritySchema,
5
+ code: z.string(),
6
+ message: z.string(),
7
+ subsystem: z.string(),
8
+ context: z.record(z.string(), z.unknown()),
9
+ timestamp: z.string(),
10
+ suggestion: z.string().optional(),
11
+ });
12
+ export const diagnosticReportSummarySchema = z.object({
13
+ totalEntries: z.number(),
14
+ errorCount: z.number(),
15
+ warningCount: z.number(),
16
+ infoCount: z.number(),
17
+ hintCount: z.number(),
18
+ subsystemsAffected: z.array(z.string()).readonly(),
19
+ });
20
+ export const errorChainEntrySchema = z.object({
21
+ source: z.string(),
22
+ code: z.string(),
23
+ message: z.string(),
24
+ timestamp: z.string(),
25
+ });
26
+ export const failureAnalysisSchema = z.object({
27
+ runId: z.string(),
28
+ failedAt: z.string(),
29
+ failedState: z.string(),
30
+ rootCause: z.string(),
31
+ contributingFactors: z.array(z.string()).readonly(),
32
+ errorChain: z.array(errorChainEntrySchema).readonly(),
33
+ recommendation: z.string(),
34
+ });
35
+ export const configurationIssueSchema = z.object({
36
+ severity: diagnosticSeveritySchema,
37
+ path: z.string(),
38
+ message: z.string(),
39
+ currentValue: z.unknown(),
40
+ expectedValue: z.unknown().optional(),
41
+ suggestion: z.string().optional(),
42
+ });
43
+ export const configurationInspectionSchema = z.object({
44
+ valid: z.boolean(),
45
+ entries: z.array(configurationIssueSchema).readonly(),
46
+ checkedAt: z.string(),
47
+ });
48
+ export const subsystemDiagnosticSchema = z.object({
49
+ subsystem: z.string(),
50
+ status: z.string(),
51
+ entries: z.array(diagnosticEntrySchema).readonly(),
52
+ metrics: z.record(z.string(), z.number()),
53
+ checkedAt: z.string(),
54
+ });
55
+ export const diagnosticReportSchema = z.object({
56
+ generatedAt: z.string(),
57
+ runId: z.string().nullable(),
58
+ entries: z.array(diagnosticEntrySchema).readonly(),
59
+ summary: diagnosticReportSummarySchema,
60
+ failureAnalysis: failureAnalysisSchema.nullable(),
61
+ configurationInspection: configurationInspectionSchema.nullable(),
62
+ subsystemDiagnostics: z.array(subsystemDiagnosticSchema).readonly(),
63
+ });
@@ -0,0 +1,2 @@
1
+ export * from './metrics';
2
+ export * from './diagnostics';
@@ -0,0 +1,2 @@
1
+ export * from './metrics';
2
+ export * from './diagnostics';
@@ -0,0 +1,187 @@
1
+ import { z } from 'zod/v4';
2
+ export declare const metricTypeSchema: z.ZodEnum<{
3
+ counter: "counter";
4
+ gauge: "gauge";
5
+ histogram: "histogram";
6
+ timer: "timer";
7
+ }>;
8
+ export type MetricType = z.infer<typeof metricTypeSchema>;
9
+ export declare const healthStatusSchema: z.ZodEnum<{
10
+ unknown: "unknown";
11
+ healthy: "healthy";
12
+ degraded: "degraded";
13
+ unhealthy: "unhealthy";
14
+ }>;
15
+ export type HealthStatus = z.infer<typeof healthStatusSchema>;
16
+ export declare const metricEntrySchema: z.ZodObject<{
17
+ name: z.ZodString;
18
+ type: z.ZodEnum<{
19
+ counter: "counter";
20
+ gauge: "gauge";
21
+ histogram: "histogram";
22
+ timer: "timer";
23
+ }>;
24
+ value: z.ZodNumber;
25
+ timestamp: z.ZodString;
26
+ labels: z.ZodRecord<z.ZodString, z.ZodString>;
27
+ }, z.core.$strip>;
28
+ export type MetricEntry = z.infer<typeof metricEntrySchema>;
29
+ export declare const metricSeriesSchema: z.ZodObject<{
30
+ name: z.ZodString;
31
+ type: z.ZodEnum<{
32
+ counter: "counter";
33
+ gauge: "gauge";
34
+ histogram: "histogram";
35
+ timer: "timer";
36
+ }>;
37
+ labels: z.ZodRecord<z.ZodString, z.ZodString>;
38
+ entries: z.ZodReadonly<z.ZodArray<z.ZodObject<{
39
+ name: z.ZodString;
40
+ type: z.ZodEnum<{
41
+ counter: "counter";
42
+ gauge: "gauge";
43
+ histogram: "histogram";
44
+ timer: "timer";
45
+ }>;
46
+ value: z.ZodNumber;
47
+ timestamp: z.ZodString;
48
+ labels: z.ZodRecord<z.ZodString, z.ZodString>;
49
+ }, z.core.$strip>>>;
50
+ }, z.core.$strip>;
51
+ export type MetricSeries = z.infer<typeof metricSeriesSchema>;
52
+ export declare const metricSummarySchema: z.ZodObject<{
53
+ name: z.ZodString;
54
+ type: z.ZodEnum<{
55
+ counter: "counter";
56
+ gauge: "gauge";
57
+ histogram: "histogram";
58
+ timer: "timer";
59
+ }>;
60
+ count: z.ZodNumber;
61
+ total: z.ZodNumber;
62
+ min: z.ZodNumber;
63
+ max: z.ZodNumber;
64
+ mean: z.ZodNumber;
65
+ labels: z.ZodRecord<z.ZodString, z.ZodString>;
66
+ }, z.core.$strip>;
67
+ export type MetricSummary = z.infer<typeof metricSummarySchema>;
68
+ export declare const healthCheckResultSchema: z.ZodObject<{
69
+ subsystem: z.ZodString;
70
+ status: z.ZodEnum<{
71
+ unknown: "unknown";
72
+ healthy: "healthy";
73
+ degraded: "degraded";
74
+ unhealthy: "unhealthy";
75
+ }>;
76
+ message: z.ZodString;
77
+ checkedAt: z.ZodString;
78
+ durationMs: z.ZodNumber;
79
+ details: z.ZodObject<{
80
+ error: z.ZodOptional<z.ZodString>;
81
+ version: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
82
+ }, z.core.$catchall<z.ZodUnknown>>;
83
+ }, z.core.$strip>;
84
+ export type HealthCheckResult = z.infer<typeof healthCheckResultSchema>;
85
+ export declare const subsystemHealthSchema: z.ZodObject<{
86
+ subsystem: z.ZodString;
87
+ status: z.ZodEnum<{
88
+ unknown: "unknown";
89
+ healthy: "healthy";
90
+ degraded: "degraded";
91
+ unhealthy: "unhealthy";
92
+ }>;
93
+ lastCheckedAt: z.ZodString;
94
+ consecutiveFailures: z.ZodNumber;
95
+ checks: z.ZodReadonly<z.ZodArray<z.ZodObject<{
96
+ subsystem: z.ZodString;
97
+ status: z.ZodEnum<{
98
+ unknown: "unknown";
99
+ healthy: "healthy";
100
+ degraded: "degraded";
101
+ unhealthy: "unhealthy";
102
+ }>;
103
+ message: z.ZodString;
104
+ checkedAt: z.ZodString;
105
+ durationMs: z.ZodNumber;
106
+ details: z.ZodObject<{
107
+ error: z.ZodOptional<z.ZodString>;
108
+ version: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
109
+ }, z.core.$catchall<z.ZodUnknown>>;
110
+ }, z.core.$strip>>>;
111
+ }, z.core.$strip>;
112
+ export type SubsystemHealth = z.infer<typeof subsystemHealthSchema>;
113
+ export declare const metricsSnapshotSchema: z.ZodObject<{
114
+ timestamp: z.ZodString;
115
+ metrics: z.ZodReadonly<z.ZodArray<z.ZodObject<{
116
+ name: z.ZodString;
117
+ type: z.ZodEnum<{
118
+ counter: "counter";
119
+ gauge: "gauge";
120
+ histogram: "histogram";
121
+ timer: "timer";
122
+ }>;
123
+ count: z.ZodNumber;
124
+ total: z.ZodNumber;
125
+ min: z.ZodNumber;
126
+ max: z.ZodNumber;
127
+ mean: z.ZodNumber;
128
+ labels: z.ZodRecord<z.ZodString, z.ZodString>;
129
+ }, z.core.$strip>>>;
130
+ subsystemHealth: z.ZodReadonly<z.ZodArray<z.ZodObject<{
131
+ subsystem: z.ZodString;
132
+ status: z.ZodEnum<{
133
+ unknown: "unknown";
134
+ healthy: "healthy";
135
+ degraded: "degraded";
136
+ unhealthy: "unhealthy";
137
+ }>;
138
+ lastCheckedAt: z.ZodString;
139
+ consecutiveFailures: z.ZodNumber;
140
+ checks: z.ZodReadonly<z.ZodArray<z.ZodObject<{
141
+ subsystem: z.ZodString;
142
+ status: z.ZodEnum<{
143
+ unknown: "unknown";
144
+ healthy: "healthy";
145
+ degraded: "degraded";
146
+ unhealthy: "unhealthy";
147
+ }>;
148
+ message: z.ZodString;
149
+ checkedAt: z.ZodString;
150
+ durationMs: z.ZodNumber;
151
+ details: z.ZodObject<{
152
+ error: z.ZodOptional<z.ZodString>;
153
+ version: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
154
+ }, z.core.$catchall<z.ZodUnknown>>;
155
+ }, z.core.$strip>>>;
156
+ }, z.core.$strip>>>;
157
+ }, z.core.$strip>;
158
+ export type MetricsSnapshot = z.infer<typeof metricsSnapshotSchema>;
159
+ export declare const timingMetricSchema: z.ZodObject<{
160
+ operation: z.ZodString;
161
+ subsystem: z.ZodString;
162
+ durationMs: z.ZodNumber;
163
+ startedAt: z.ZodString;
164
+ completedAt: z.ZodString;
165
+ labels: z.ZodRecord<z.ZodString, z.ZodString>;
166
+ }, z.core.$strip>;
167
+ export type TimingMetric = z.infer<typeof timingMetricSchema>;
168
+ export declare const performanceSnapshotSchema: z.ZodObject<{
169
+ timestamp: z.ZodString;
170
+ timings: z.ZodReadonly<z.ZodArray<z.ZodObject<{
171
+ operation: z.ZodString;
172
+ subsystem: z.ZodString;
173
+ durationMs: z.ZodNumber;
174
+ startedAt: z.ZodString;
175
+ completedAt: z.ZodString;
176
+ labels: z.ZodRecord<z.ZodString, z.ZodString>;
177
+ }, z.core.$strip>>>;
178
+ workflowLatencyMs: z.ZodNullable<z.ZodNumber>;
179
+ stageLatencies: z.ZodRecord<z.ZodString, z.ZodNumber>;
180
+ eventThroughput: z.ZodNumber;
181
+ memoryUsageBytes: z.ZodNullable<z.ZodNumber>;
182
+ }, z.core.$strip>;
183
+ export type PerformanceSnapshot = z.infer<typeof performanceSnapshotSchema>;
184
+ export interface HealthProbeConfig {
185
+ subsystem: string;
186
+ check: () => Promise<HealthCheckResult>;
187
+ }
@@ -0,0 +1,67 @@
1
+ import { z } from 'zod/v4';
2
+ export const metricTypeSchema = z.enum(['counter', 'gauge', 'histogram', 'timer']);
3
+ export const healthStatusSchema = z.enum(['healthy', 'degraded', 'unhealthy', 'unknown']);
4
+ export const metricEntrySchema = z.object({
5
+ name: z.string(),
6
+ type: metricTypeSchema,
7
+ value: z.number(),
8
+ timestamp: z.string(),
9
+ labels: z.record(z.string(), z.string()),
10
+ });
11
+ export const metricSeriesSchema = z.object({
12
+ name: z.string(),
13
+ type: metricTypeSchema,
14
+ labels: z.record(z.string(), z.string()),
15
+ entries: z.array(metricEntrySchema).readonly(),
16
+ });
17
+ export const metricSummarySchema = z.object({
18
+ name: z.string(),
19
+ type: metricTypeSchema,
20
+ count: z.number(),
21
+ total: z.number(),
22
+ min: z.number(),
23
+ max: z.number(),
24
+ mean: z.number(),
25
+ labels: z.record(z.string(), z.string()),
26
+ });
27
+ export const healthCheckResultSchema = z.object({
28
+ subsystem: z.string(),
29
+ status: healthStatusSchema,
30
+ message: z.string(),
31
+ checkedAt: z.string(),
32
+ durationMs: z.number(),
33
+ details: z
34
+ .object({
35
+ error: z.string().optional(),
36
+ version: z.union([z.string(), z.number()]).optional(),
37
+ })
38
+ .catchall(z.unknown()),
39
+ });
40
+ export const subsystemHealthSchema = z.object({
41
+ subsystem: z.string(),
42
+ status: healthStatusSchema,
43
+ lastCheckedAt: z.string(),
44
+ consecutiveFailures: z.number(),
45
+ checks: z.array(healthCheckResultSchema).readonly(),
46
+ });
47
+ export const metricsSnapshotSchema = z.object({
48
+ timestamp: z.string(),
49
+ metrics: z.array(metricSummarySchema).readonly(),
50
+ subsystemHealth: z.array(subsystemHealthSchema).readonly(),
51
+ });
52
+ export const timingMetricSchema = z.object({
53
+ operation: z.string(),
54
+ subsystem: z.string(),
55
+ durationMs: z.number(),
56
+ startedAt: z.string(),
57
+ completedAt: z.string(),
58
+ labels: z.record(z.string(), z.string()),
59
+ });
60
+ export const performanceSnapshotSchema = z.object({
61
+ timestamp: z.string(),
62
+ timings: z.array(timingMetricSchema).readonly(),
63
+ workflowLatencyMs: z.number().nullable(),
64
+ stageLatencies: z.record(z.string(), z.number()),
65
+ eventThroughput: z.number(),
66
+ memoryUsageBytes: z.number().nullable(),
67
+ });