@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,124 @@
1
+ import { z } from 'zod/v4';
2
+ export const ARTIFACT_TYPES = [
3
+ 'intake_requirements',
4
+ 'canonical_specification',
5
+ 'clarification_questions',
6
+ 'clarification_answers',
7
+ 'plan',
8
+ 'plan_review',
9
+ 'test_plan',
10
+ 'implementation',
11
+ 'static_review',
12
+ 'security_review',
13
+ 'performance_review',
14
+ 'adversarial_review',
15
+ 'design_review',
16
+ 'docs_review',
17
+ 'ux_review',
18
+ 'review_report',
19
+ 'remediation_plan',
20
+ 'verification',
21
+ 'judge_decision',
22
+ 'planning_agreement',
23
+ 'implementation_agreement',
24
+ 'verification_agreement',
25
+ 'release_summary',
26
+ 'release_agreement',
27
+ 'escalation_context',
28
+ 'run_manifest',
29
+ 'codebase_context',
30
+ 'test_suite',
31
+ 'acceptance_validation',
32
+ 'review_findings',
33
+ 'task_breakdown',
34
+ 'decomposition_review',
35
+ 'task_specifications',
36
+ 'pr_diff_context',
37
+ ];
38
+ export const artifactTypeSchema = z.enum(ARTIFACT_TYPES);
39
+ export const artifactRefSchema = z.object({
40
+ type: artifactTypeSchema,
41
+ name: z.string(),
42
+ version: z.number(),
43
+ checksum: z.string(),
44
+ });
45
+ export const artifactInputSchema = z.object({
46
+ type: artifactTypeSchema,
47
+ name: z.string(),
48
+ runId: z.string().optional(),
49
+ content: z.string(),
50
+ producedBy: z.string(),
51
+ predecessorRef: artifactRefSchema.optional(),
52
+ metadata: z
53
+ .object({
54
+ validationFailed: z.boolean().optional(),
55
+ })
56
+ .catchall(z.unknown())
57
+ .optional(),
58
+ preValidated: z.boolean().optional(),
59
+ });
60
+ export const artifactSchema = z.object({
61
+ ref: artifactRefSchema,
62
+ type: artifactTypeSchema,
63
+ name: z.string(),
64
+ version: z.number(),
65
+ content: z.string(),
66
+ checksum: z.string(),
67
+ producedBy: z.string(),
68
+ predecessorRef: artifactRefSchema.optional(),
69
+ createdAt: z.string(),
70
+ sizeBytes: z.number(),
71
+ metadata: z
72
+ .object({
73
+ validationFailed: z.boolean().optional(),
74
+ })
75
+ .catchall(z.unknown())
76
+ .optional(),
77
+ });
78
+ export const artifactQuerySchema = z.object({
79
+ type: artifactTypeSchema.optional(),
80
+ name: z.string().optional(),
81
+ producedBy: z.string().optional(),
82
+ minVersion: z.number().optional(),
83
+ maxVersion: z.number().optional(),
84
+ createdAfter: z.string().optional(),
85
+ createdBefore: z.string().optional(),
86
+ });
87
+ export const artifactSummarySchema = z.object({
88
+ ref: artifactRefSchema,
89
+ type: artifactTypeSchema,
90
+ name: z.string(),
91
+ version: z.number(),
92
+ producedBy: z.string(),
93
+ createdAt: z.string(),
94
+ sizeBytes: z.number(),
95
+ });
96
+ export const artifactInventorySchema = z.object({
97
+ runId: z.string(),
98
+ artifacts: z.array(artifactSummarySchema).readonly(),
99
+ totalCount: z.number(),
100
+ totalSizeBytes: z.number(),
101
+ });
102
+ export const integrityResultSchema = z.object({
103
+ valid: z.boolean(),
104
+ expectedChecksum: z.string(),
105
+ actualChecksum: z.string(),
106
+ ref: artifactRefSchema,
107
+ });
108
+ export const artifactMetadataSchema = z.object({
109
+ type: artifactTypeSchema,
110
+ name: z.string(),
111
+ runId: z.string().optional(),
112
+ version: z.number(),
113
+ checksum: z.string(),
114
+ producedBy: z.string(),
115
+ predecessorRef: artifactRefSchema.nullable(),
116
+ createdAt: z.string(),
117
+ sizeBytes: z.number(),
118
+ metadata: z
119
+ .object({
120
+ validationFailed: z.boolean().optional(),
121
+ })
122
+ .catchall(z.unknown())
123
+ .optional(),
124
+ });
@@ -0,0 +1,3 @@
1
+ export * from './artifact-system';
2
+ export * from './agreement-artifacts';
3
+ export * from './artifact-dependency-graph';
@@ -0,0 +1,3 @@
1
+ export * from './artifact-system';
2
+ export * from './agreement-artifacts';
3
+ export * from './artifact-dependency-graph';
@@ -0,0 +1,324 @@
1
+ import { z } from 'zod/v4';
2
+ export declare const logLevelSchema: z.ZodEnum<{
3
+ error: "error";
4
+ warn: "warn";
5
+ debug: "debug";
6
+ info: "info";
7
+ }>;
8
+ export type LogLevel = z.infer<typeof logLevelSchema>;
9
+ export declare const runtimeConfigSchema: z.ZodObject<{
10
+ logLevel: z.ZodEnum<{
11
+ error: "error";
12
+ warn: "warn";
13
+ debug: "debug";
14
+ info: "info";
15
+ }>;
16
+ reportOutputPath: z.ZodOptional<z.ZodString>;
17
+ }, z.core.$strip>;
18
+ export type RuntimeConfig = z.infer<typeof runtimeConfigSchema>;
19
+ export declare const specificationReadinessGateSchema: z.ZodObject<{
20
+ minCompletenessScore: z.ZodNumber;
21
+ }, z.core.$strip>;
22
+ export type SpecificationReadinessGate = z.infer<typeof specificationReadinessGateSchema>;
23
+ export declare const implementationReviewGateSchema: z.ZodObject<{
24
+ maxHighSeverityFindings: z.ZodNumber;
25
+ maxMediumSeverityFindings: z.ZodNumber;
26
+ }, z.core.$strip>;
27
+ export type ImplementationReviewGate = z.infer<typeof implementationReviewGateSchema>;
28
+ export declare const qualityGateConfigSchema: z.ZodObject<{
29
+ specificationReadiness: z.ZodObject<{
30
+ minCompletenessScore: z.ZodNumber;
31
+ }, z.core.$strip>;
32
+ implementationReview: z.ZodObject<{
33
+ maxHighSeverityFindings: z.ZodNumber;
34
+ maxMediumSeverityFindings: z.ZodNumber;
35
+ }, z.core.$strip>;
36
+ }, z.core.$strip>;
37
+ export type QualityGateConfig = z.infer<typeof qualityGateConfigSchema>;
38
+ export declare const iterationLimitDefaultsSchema: z.ZodObject<{
39
+ maxReviewIterations: z.ZodNumber;
40
+ maxJudgeArbitrations: z.ZodNumber;
41
+ maxClarificationRounds: z.ZodNumber;
42
+ maxAcceptanceIterations: z.ZodNumber;
43
+ }, z.core.$strip>;
44
+ export type IterationLimitDefaults = z.infer<typeof iterationLimitDefaultsSchema>;
45
+ export declare const iterationLimitConfigSchema: z.ZodObject<{
46
+ defaults: z.ZodObject<{
47
+ maxReviewIterations: z.ZodNumber;
48
+ maxJudgeArbitrations: z.ZodNumber;
49
+ maxClarificationRounds: z.ZodNumber;
50
+ maxAcceptanceIterations: z.ZodNumber;
51
+ }, z.core.$strip>;
52
+ }, z.core.$strip>;
53
+ export type IterationLimitConfig = z.infer<typeof iterationLimitConfigSchema>;
54
+ export declare const budgetConfigSchema: z.ZodObject<{
55
+ maxTokensPerRun: z.ZodOptional<z.ZodNumber>;
56
+ alertThresholds: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodNumber>>>;
57
+ }, z.core.$strip>;
58
+ export type BudgetConfig = z.infer<typeof budgetConfigSchema>;
59
+ export declare const confidenceGateConfigSchema: z.ZodObject<{
60
+ modelEscalationThreshold: z.ZodNumber;
61
+ humanEscalationThreshold: z.ZodNumber;
62
+ heuristicWeight: z.ZodNumber;
63
+ heuristicSignals: z.ZodObject<{
64
+ penalizeHedgingLanguage: z.ZodBoolean;
65
+ penalizeHighRetryCount: z.ZodBoolean;
66
+ penalizeUnresolvedFindings: z.ZodBoolean;
67
+ }, z.core.$strip>;
68
+ }, z.core.$strip>;
69
+ export type ConfidenceGateConfig = z.infer<typeof confidenceGateConfigSchema>;
70
+ export declare const governanceConfigSchema: z.ZodObject<{
71
+ iterationLimits: z.ZodObject<{
72
+ defaults: z.ZodObject<{
73
+ maxReviewIterations: z.ZodNumber;
74
+ maxJudgeArbitrations: z.ZodNumber;
75
+ maxClarificationRounds: z.ZodNumber;
76
+ maxAcceptanceIterations: z.ZodNumber;
77
+ }, z.core.$strip>;
78
+ }, z.core.$strip>;
79
+ qualityGates: z.ZodObject<{
80
+ specificationReadiness: z.ZodObject<{
81
+ minCompletenessScore: z.ZodNumber;
82
+ }, z.core.$strip>;
83
+ implementationReview: z.ZodObject<{
84
+ maxHighSeverityFindings: z.ZodNumber;
85
+ maxMediumSeverityFindings: z.ZodNumber;
86
+ }, z.core.$strip>;
87
+ }, z.core.$strip>;
88
+ budget: z.ZodOptional<z.ZodObject<{
89
+ maxTokensPerRun: z.ZodOptional<z.ZodNumber>;
90
+ alertThresholds: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodNumber>>>;
91
+ }, z.core.$strip>>;
92
+ confidenceGate: z.ZodOptional<z.ZodObject<{
93
+ modelEscalationThreshold: z.ZodNumber;
94
+ humanEscalationThreshold: z.ZodNumber;
95
+ heuristicWeight: z.ZodNumber;
96
+ heuristicSignals: z.ZodObject<{
97
+ penalizeHedgingLanguage: z.ZodBoolean;
98
+ penalizeHighRetryCount: z.ZodBoolean;
99
+ penalizeUnresolvedFindings: z.ZodBoolean;
100
+ }, z.core.$strip>;
101
+ }, z.core.$strip>>;
102
+ }, z.core.$strip>;
103
+ export type GovernanceConfig = z.infer<typeof governanceConfigSchema>;
104
+ export declare const roleAssignmentSchema: z.ZodObject<{
105
+ model: z.ZodString;
106
+ maxTokens: z.ZodOptional<z.ZodNumber>;
107
+ overrides: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
108
+ dispatchType: z.ZodOptional<z.ZodEnum<{
109
+ agent: "agent";
110
+ }>>;
111
+ runner: z.ZodOptional<z.ZodString>;
112
+ agentConfig: z.ZodOptional<z.ZodObject<{
113
+ model: z.ZodOptional<z.ZodString>;
114
+ timeoutMs: z.ZodOptional<z.ZodNumber>;
115
+ instructions: z.ZodOptional<z.ZodString>;
116
+ command: z.ZodOptional<z.ZodString>;
117
+ args: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
118
+ handshakeTimeoutMs: z.ZodOptional<z.ZodNumber>;
119
+ liveRequestTimeoutMs: z.ZodOptional<z.ZodNumber>;
120
+ endpoint: z.ZodOptional<z.ZodString>;
121
+ authHeader: z.ZodOptional<z.ZodString>;
122
+ pollIntervalMs: z.ZodOptional<z.ZodNumber>;
123
+ maxTurns: z.ZodOptional<z.ZodNumber>;
124
+ }, z.core.$strip>>;
125
+ }, z.core.$strip>;
126
+ export type RoleAssignment = z.infer<typeof roleAssignmentSchema>;
127
+ export declare const customRoleDefinitionSchema: z.ZodObject<{
128
+ description: z.ZodString;
129
+ ownedArtifacts: z.ZodReadonly<z.ZodArray<z.ZodString>>;
130
+ readableArtifacts: z.ZodReadonly<z.ZodArray<z.ZodString>>;
131
+ forbiddenArtifacts: z.ZodReadonly<z.ZodArray<z.ZodString>>;
132
+ requiredCapabilities: z.ZodReadonly<z.ZodArray<z.ZodString>>;
133
+ reviewedBy: z.ZodOptional<z.ZodString>;
134
+ reviews: z.ZodOptional<z.ZodString>;
135
+ }, z.core.$strip>;
136
+ export type CustomRoleDefinition = z.infer<typeof customRoleDefinitionSchema>;
137
+ export declare const permissionRuleSchema: z.ZodObject<{
138
+ action: z.ZodString;
139
+ decision: z.ZodEnum<{
140
+ grant: "grant";
141
+ deny: "deny";
142
+ }>;
143
+ scope: z.ZodOptional<z.ZodString>;
144
+ pattern: z.ZodOptional<z.ZodString>;
145
+ }, z.core.$strip>;
146
+ export type PermissionRule = z.infer<typeof permissionRuleSchema>;
147
+ export declare const permissionPolicySchema: z.ZodObject<{
148
+ defaultAction: z.ZodOptional<z.ZodEnum<{
149
+ grant: "grant";
150
+ deny: "deny";
151
+ ask_human: "ask_human";
152
+ }>>;
153
+ rules: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodObject<{
154
+ action: z.ZodString;
155
+ decision: z.ZodEnum<{
156
+ grant: "grant";
157
+ deny: "deny";
158
+ }>;
159
+ scope: z.ZodOptional<z.ZodString>;
160
+ pattern: z.ZodOptional<z.ZodString>;
161
+ }, z.core.$strip>>>>;
162
+ roleTrust: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
163
+ safeCommands: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
164
+ }, z.core.$strip>;
165
+ export type PermissionPolicy = z.infer<typeof permissionPolicySchema>;
166
+ export declare const rolesConfigSchema: z.ZodObject<{
167
+ assignments: z.ZodRecord<z.ZodString, z.ZodObject<{
168
+ model: z.ZodString;
169
+ maxTokens: z.ZodOptional<z.ZodNumber>;
170
+ overrides: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
171
+ dispatchType: z.ZodOptional<z.ZodEnum<{
172
+ agent: "agent";
173
+ }>>;
174
+ runner: z.ZodOptional<z.ZodString>;
175
+ agentConfig: z.ZodOptional<z.ZodObject<{
176
+ model: z.ZodOptional<z.ZodString>;
177
+ timeoutMs: z.ZodOptional<z.ZodNumber>;
178
+ instructions: z.ZodOptional<z.ZodString>;
179
+ command: z.ZodOptional<z.ZodString>;
180
+ args: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
181
+ handshakeTimeoutMs: z.ZodOptional<z.ZodNumber>;
182
+ liveRequestTimeoutMs: z.ZodOptional<z.ZodNumber>;
183
+ endpoint: z.ZodOptional<z.ZodString>;
184
+ authHeader: z.ZodOptional<z.ZodString>;
185
+ pollIntervalMs: z.ZodOptional<z.ZodNumber>;
186
+ maxTurns: z.ZodOptional<z.ZodNumber>;
187
+ }, z.core.$strip>>;
188
+ }, z.core.$strip>>;
189
+ customRoles: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
190
+ description: z.ZodString;
191
+ ownedArtifacts: z.ZodReadonly<z.ZodArray<z.ZodString>>;
192
+ readableArtifacts: z.ZodReadonly<z.ZodArray<z.ZodString>>;
193
+ forbiddenArtifacts: z.ZodReadonly<z.ZodArray<z.ZodString>>;
194
+ requiredCapabilities: z.ZodReadonly<z.ZodArray<z.ZodString>>;
195
+ reviewedBy: z.ZodOptional<z.ZodString>;
196
+ reviews: z.ZodOptional<z.ZodString>;
197
+ }, z.core.$strip>>>;
198
+ permissionPolicy: z.ZodOptional<z.ZodObject<{
199
+ defaultAction: z.ZodOptional<z.ZodEnum<{
200
+ grant: "grant";
201
+ deny: "deny";
202
+ ask_human: "ask_human";
203
+ }>>;
204
+ rules: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodObject<{
205
+ action: z.ZodString;
206
+ decision: z.ZodEnum<{
207
+ grant: "grant";
208
+ deny: "deny";
209
+ }>;
210
+ scope: z.ZodOptional<z.ZodString>;
211
+ pattern: z.ZodOptional<z.ZodString>;
212
+ }, z.core.$strip>>>>;
213
+ roleTrust: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
214
+ safeCommands: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
215
+ }, z.core.$strip>>;
216
+ }, z.core.$strip>;
217
+ export type RolesConfig = z.infer<typeof rolesConfigSchema>;
218
+ export declare const workflowConfigSchema: z.ZodObject<{
219
+ name: z.ZodString;
220
+ version: z.ZodString;
221
+ globalTransitionLimit: z.ZodOptional<z.ZodNumber>;
222
+ }, z.core.$strip>;
223
+ export type WorkflowConfig = z.infer<typeof workflowConfigSchema>;
224
+ export declare const mergedConfigurationSchema: z.ZodObject<{
225
+ workflow: z.ZodObject<{
226
+ name: z.ZodString;
227
+ version: z.ZodString;
228
+ globalTransitionLimit: z.ZodOptional<z.ZodNumber>;
229
+ }, z.core.$strip>;
230
+ roles: z.ZodObject<{
231
+ assignments: z.ZodRecord<z.ZodString, z.ZodObject<{
232
+ model: z.ZodString;
233
+ maxTokens: z.ZodOptional<z.ZodNumber>;
234
+ overrides: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
235
+ dispatchType: z.ZodOptional<z.ZodEnum<{
236
+ agent: "agent";
237
+ }>>;
238
+ runner: z.ZodOptional<z.ZodString>;
239
+ agentConfig: z.ZodOptional<z.ZodObject<{
240
+ model: z.ZodOptional<z.ZodString>;
241
+ timeoutMs: z.ZodOptional<z.ZodNumber>;
242
+ instructions: z.ZodOptional<z.ZodString>;
243
+ command: z.ZodOptional<z.ZodString>;
244
+ args: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
245
+ handshakeTimeoutMs: z.ZodOptional<z.ZodNumber>;
246
+ liveRequestTimeoutMs: z.ZodOptional<z.ZodNumber>;
247
+ endpoint: z.ZodOptional<z.ZodString>;
248
+ authHeader: z.ZodOptional<z.ZodString>;
249
+ pollIntervalMs: z.ZodOptional<z.ZodNumber>;
250
+ maxTurns: z.ZodOptional<z.ZodNumber>;
251
+ }, z.core.$strip>>;
252
+ }, z.core.$strip>>;
253
+ customRoles: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
254
+ description: z.ZodString;
255
+ ownedArtifacts: z.ZodReadonly<z.ZodArray<z.ZodString>>;
256
+ readableArtifacts: z.ZodReadonly<z.ZodArray<z.ZodString>>;
257
+ forbiddenArtifacts: z.ZodReadonly<z.ZodArray<z.ZodString>>;
258
+ requiredCapabilities: z.ZodReadonly<z.ZodArray<z.ZodString>>;
259
+ reviewedBy: z.ZodOptional<z.ZodString>;
260
+ reviews: z.ZodOptional<z.ZodString>;
261
+ }, z.core.$strip>>>;
262
+ permissionPolicy: z.ZodOptional<z.ZodObject<{
263
+ defaultAction: z.ZodOptional<z.ZodEnum<{
264
+ grant: "grant";
265
+ deny: "deny";
266
+ ask_human: "ask_human";
267
+ }>>;
268
+ rules: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodObject<{
269
+ action: z.ZodString;
270
+ decision: z.ZodEnum<{
271
+ grant: "grant";
272
+ deny: "deny";
273
+ }>;
274
+ scope: z.ZodOptional<z.ZodString>;
275
+ pattern: z.ZodOptional<z.ZodString>;
276
+ }, z.core.$strip>>>>;
277
+ roleTrust: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
278
+ safeCommands: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
279
+ }, z.core.$strip>>;
280
+ }, z.core.$strip>;
281
+ governance: z.ZodObject<{
282
+ iterationLimits: z.ZodObject<{
283
+ defaults: z.ZodObject<{
284
+ maxReviewIterations: z.ZodNumber;
285
+ maxJudgeArbitrations: z.ZodNumber;
286
+ maxClarificationRounds: z.ZodNumber;
287
+ maxAcceptanceIterations: z.ZodNumber;
288
+ }, z.core.$strip>;
289
+ }, z.core.$strip>;
290
+ qualityGates: z.ZodObject<{
291
+ specificationReadiness: z.ZodObject<{
292
+ minCompletenessScore: z.ZodNumber;
293
+ }, z.core.$strip>;
294
+ implementationReview: z.ZodObject<{
295
+ maxHighSeverityFindings: z.ZodNumber;
296
+ maxMediumSeverityFindings: z.ZodNumber;
297
+ }, z.core.$strip>;
298
+ }, z.core.$strip>;
299
+ budget: z.ZodOptional<z.ZodObject<{
300
+ maxTokensPerRun: z.ZodOptional<z.ZodNumber>;
301
+ alertThresholds: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodNumber>>>;
302
+ }, z.core.$strip>>;
303
+ confidenceGate: z.ZodOptional<z.ZodObject<{
304
+ modelEscalationThreshold: z.ZodNumber;
305
+ humanEscalationThreshold: z.ZodNumber;
306
+ heuristicWeight: z.ZodNumber;
307
+ heuristicSignals: z.ZodObject<{
308
+ penalizeHedgingLanguage: z.ZodBoolean;
309
+ penalizeHighRetryCount: z.ZodBoolean;
310
+ penalizeUnresolvedFindings: z.ZodBoolean;
311
+ }, z.core.$strip>;
312
+ }, z.core.$strip>>;
313
+ }, z.core.$strip>;
314
+ runtime: z.ZodObject<{
315
+ logLevel: z.ZodEnum<{
316
+ error: "error";
317
+ warn: "warn";
318
+ debug: "debug";
319
+ info: "info";
320
+ }>;
321
+ reportOutputPath: z.ZodOptional<z.ZodString>;
322
+ }, z.core.$strip>;
323
+ }, z.core.$strip>;
324
+ export type MergedConfiguration = z.infer<typeof mergedConfigurationSchema>;
@@ -0,0 +1,93 @@
1
+ import { z } from 'zod/v4';
2
+ import { agentConfigSchema, dispatchTypeSchema } from '../runner/role-system';
3
+ import { permissionDecisionActionSchema } from '../shared/string-enums';
4
+ export const logLevelSchema = z.enum(['debug', 'info', 'warn', 'error']);
5
+ export const runtimeConfigSchema = z.object({
6
+ logLevel: logLevelSchema,
7
+ reportOutputPath: z.string().optional(),
8
+ });
9
+ export const specificationReadinessGateSchema = z.object({
10
+ minCompletenessScore: z.number(),
11
+ });
12
+ export const implementationReviewGateSchema = z.object({
13
+ maxHighSeverityFindings: z.number(),
14
+ maxMediumSeverityFindings: z.number(),
15
+ });
16
+ export const qualityGateConfigSchema = z.object({
17
+ specificationReadiness: specificationReadinessGateSchema,
18
+ implementationReview: implementationReviewGateSchema,
19
+ });
20
+ export const iterationLimitDefaultsSchema = z.object({
21
+ maxReviewIterations: z.number(),
22
+ maxJudgeArbitrations: z.number(),
23
+ maxClarificationRounds: z.number(),
24
+ maxAcceptanceIterations: z.number(),
25
+ });
26
+ export const iterationLimitConfigSchema = z.object({
27
+ defaults: iterationLimitDefaultsSchema,
28
+ });
29
+ export const budgetConfigSchema = z.object({
30
+ maxTokensPerRun: z.number().optional(),
31
+ alertThresholds: z.array(z.number()).readonly().optional(),
32
+ });
33
+ export const confidenceGateConfigSchema = z.object({
34
+ modelEscalationThreshold: z.number().min(0).max(1),
35
+ humanEscalationThreshold: z.number().min(0).max(1),
36
+ heuristicWeight: z.number().min(0).max(1),
37
+ heuristicSignals: z.object({
38
+ penalizeHedgingLanguage: z.boolean(),
39
+ penalizeHighRetryCount: z.boolean(),
40
+ penalizeUnresolvedFindings: z.boolean(),
41
+ }),
42
+ });
43
+ export const governanceConfigSchema = z.object({
44
+ iterationLimits: iterationLimitConfigSchema,
45
+ qualityGates: qualityGateConfigSchema,
46
+ budget: budgetConfigSchema.optional(),
47
+ confidenceGate: confidenceGateConfigSchema.optional(),
48
+ });
49
+ export const roleAssignmentSchema = z.object({
50
+ model: z.string().min(1),
51
+ maxTokens: z.number().optional(),
52
+ overrides: z.record(z.string(), z.unknown()).optional(),
53
+ dispatchType: dispatchTypeSchema.optional(),
54
+ runner: z.string().min(1).optional(),
55
+ agentConfig: agentConfigSchema.optional(),
56
+ });
57
+ export const customRoleDefinitionSchema = z.object({
58
+ description: z.string(),
59
+ ownedArtifacts: z.array(z.string()).readonly(),
60
+ readableArtifacts: z.array(z.string()).readonly(),
61
+ forbiddenArtifacts: z.array(z.string()).readonly(),
62
+ requiredCapabilities: z.array(z.string()).readonly(),
63
+ reviewedBy: z.string().optional(),
64
+ reviews: z.string().optional(),
65
+ });
66
+ export const permissionRuleSchema = z.object({
67
+ action: z.string(),
68
+ decision: z.enum(['grant', 'deny']),
69
+ scope: z.string().optional(),
70
+ pattern: z.string().optional(),
71
+ });
72
+ export const permissionPolicySchema = z.object({
73
+ defaultAction: permissionDecisionActionSchema.optional(),
74
+ rules: z.array(permissionRuleSchema).readonly().optional(),
75
+ roleTrust: z.record(z.string(), z.string()).optional(),
76
+ safeCommands: z.array(z.string()).readonly().optional(),
77
+ });
78
+ export const rolesConfigSchema = z.object({
79
+ assignments: z.record(z.string(), roleAssignmentSchema),
80
+ customRoles: z.record(z.string(), customRoleDefinitionSchema).optional(),
81
+ permissionPolicy: permissionPolicySchema.optional(),
82
+ });
83
+ export const workflowConfigSchema = z.object({
84
+ name: z.string().min(1),
85
+ version: z.string().min(1),
86
+ globalTransitionLimit: z.number().min(1).optional(),
87
+ });
88
+ export const mergedConfigurationSchema = z.object({
89
+ workflow: workflowConfigSchema,
90
+ roles: rolesConfigSchema,
91
+ governance: governanceConfigSchema,
92
+ runtime: runtimeConfigSchema,
93
+ });