@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,304 @@
1
+ import { z } from 'zod/v4';
2
+ import { approvalStatusSchema } from '../artifacts/agreement-artifacts';
3
+ import { artifactRefSchema } from '../artifacts/artifact-system';
4
+ import { escalationTriggerSchema, governanceOutcomeSchema, policyCheckOutcomeSchema, } from '../governance/governance';
5
+ import { policyOutcomeSchema } from '../governance/policy-engine';
6
+ import { threeTierSeveritySchema } from '../shared/string-enums';
7
+ // ---------------------------------------------------------------------------
8
+ // Run payload schemas
9
+ // ---------------------------------------------------------------------------
10
+ export const runStartedDataSchema = z.object({
11
+ config: z.object({
12
+ workflow: z.string(),
13
+ variant: z.string().optional(),
14
+ repository: z.string(),
15
+ sourceType: z.string(),
16
+ }),
17
+ tokenBudget: z.number().optional(),
18
+ });
19
+ export const runCompletedDataSchema = z.object({
20
+ outcome: z.enum(['success', 'partial', 'failed']),
21
+ reason: z.string().optional(),
22
+ artifactCount: z.number(),
23
+ totalDurationMs: z.number(),
24
+ totalTokens: z.object({ input: z.number(), output: z.number() }),
25
+ });
26
+ export const runAbortedDataSchema = z.object({
27
+ reason: z.string(),
28
+ abortedBy: z.enum(['user', 'governance', 'system', 'policy']),
29
+ lastState: z.string(),
30
+ });
31
+ export const runResumedDataSchema = z.object({
32
+ resumedFromState: z.string(),
33
+ checkpointTimestamp: z.string(),
34
+ eventsReplayed: z.number(),
35
+ });
36
+ export const runPausedDataSchema = z.object({
37
+ reason: z.enum(['human_input_required', 'rate_limited', 'manual']),
38
+ pausedInState: z.string(),
39
+ });
40
+ // ---------------------------------------------------------------------------
41
+ // State payload schemas
42
+ // ---------------------------------------------------------------------------
43
+ export const stateEnteredDataSchema = z.object({
44
+ stateId: z.string(),
45
+ stateType: z.string(),
46
+ entryActionsCount: z.number(),
47
+ });
48
+ export const stateExitedDataSchema = z.object({
49
+ stateId: z.string(),
50
+ durationMs: z.number(),
51
+ });
52
+ // ---------------------------------------------------------------------------
53
+ // Transition payload schemas
54
+ // ---------------------------------------------------------------------------
55
+ export const transitionRequestedDataSchema = z.object({
56
+ from: z.string(),
57
+ to: z.string(),
58
+ trigger: z.string(),
59
+ guardsToEvaluate: z.number(),
60
+ });
61
+ export const transitionCompletedDataSchema = z.object({
62
+ from: z.string(),
63
+ to: z.string(),
64
+ trigger: z.string(),
65
+ guardsEvaluated: z.number(),
66
+ guardsPassed: z.number(),
67
+ governanceConsulted: z.boolean(),
68
+ durationMs: z.number(),
69
+ });
70
+ export const transitionDeniedDataSchema = z.object({
71
+ from: z.string(),
72
+ to: z.string(),
73
+ trigger: z.string(),
74
+ deniedBy: z.enum(['guard', 'governance', 'policy']),
75
+ reason: z.string(),
76
+ });
77
+ // ---------------------------------------------------------------------------
78
+ // Worker payload schemas
79
+ // ---------------------------------------------------------------------------
80
+ export const workerDispatchedDataSchema = z.object({
81
+ workerId: z.string(),
82
+ role: z.string(),
83
+ model: z.string(),
84
+ inputArtifacts: z.array(artifactRefSchema).readonly(),
85
+ });
86
+ export const workerCompletedDataSchema = z.object({
87
+ workerId: z.string(),
88
+ role: z.string(),
89
+ model: z.string(),
90
+ outputArtifacts: z.array(artifactRefSchema).readonly(),
91
+ durationMs: z.number(),
92
+ inputTokens: z.number(),
93
+ outputTokens: z.number(),
94
+ repairAttempts: z.number(),
95
+ });
96
+ export const workerFailedDataSchema = z.object({
97
+ workerId: z.string(),
98
+ role: z.string(),
99
+ error: z.string(),
100
+ errorCategory: z.enum(['agent_error', 'validation_error', 'timeout', 'cancelled', 'unknown']),
101
+ durationMs: z.number(),
102
+ inputTokens: z.number(),
103
+ outputTokens: z.number(),
104
+ willRetry: z.boolean(),
105
+ });
106
+ export const workerRetriedDataSchema = z.object({
107
+ workerId: z.string(),
108
+ role: z.string(),
109
+ attempt: z.number(),
110
+ maxAttempts: z.number(),
111
+ retryReason: z.string(),
112
+ backoffMs: z.number(),
113
+ });
114
+ export const workerCancelledDataSchema = z.object({
115
+ workerId: z.string(),
116
+ role: z.string(),
117
+ cancelledBy: z.enum(['user', 'governance', 'timeout', 'system']),
118
+ reason: z.string(),
119
+ });
120
+ export const workerTimeoutDataSchema = z.object({
121
+ workerId: z.string(),
122
+ role: z.string(),
123
+ timeoutMs: z.number(),
124
+ elapsedMs: z.number(),
125
+ });
126
+ // ---------------------------------------------------------------------------
127
+ // Artifact payload schemas
128
+ // ---------------------------------------------------------------------------
129
+ export const artifactStoredDataSchema = z.object({
130
+ artifactRef: artifactRefSchema,
131
+ producedBy: z.string(),
132
+ sizeBytes: z.number(),
133
+ predecessorRef: artifactRefSchema.optional(),
134
+ });
135
+ export const artifactVerifiedDataSchema = z.object({
136
+ artifactRef: artifactRefSchema,
137
+ integrityValid: z.boolean(),
138
+ expectedChecksum: z.string(),
139
+ actualChecksum: z.string(),
140
+ });
141
+ export const artifactInvalidatedDataSchema = z.object({
142
+ artifactRef: artifactRefSchema,
143
+ reason: z.enum(['upstream_changed', 'manual', 'policy']),
144
+ invalidatedBy: z.string(),
145
+ });
146
+ // ---------------------------------------------------------------------------
147
+ // Governance payload schemas
148
+ // ---------------------------------------------------------------------------
149
+ export const governanceDecisionDataSchema = z.object({
150
+ transition: z.object({ from: z.string(), to: z.string() }),
151
+ decision: governanceOutcomeSchema,
152
+ policiesEvaluated: z.array(z.string()).readonly(),
153
+ policyResults: z
154
+ .array(z.object({
155
+ policyType: z.string(),
156
+ outcome: policyCheckOutcomeSchema,
157
+ reason: z.string().optional(),
158
+ }))
159
+ .readonly(),
160
+ reason: z.string(),
161
+ });
162
+ export const agreementProducedDataSchema = z.object({
163
+ agreementType: z.string(),
164
+ artifactRef: artifactRefSchema,
165
+ participantCount: z.number(),
166
+ findingsCount: z.number(),
167
+ verdict: approvalStatusSchema,
168
+ });
169
+ export const escalationTriggeredDataSchema = z.object({
170
+ trigger: escalationTriggerSchema,
171
+ currentState: z.string(),
172
+ iterationCount: z.number(),
173
+ escalationContextRef: artifactRefSchema,
174
+ });
175
+ // ---------------------------------------------------------------------------
176
+ // Policy payload schemas
177
+ // ---------------------------------------------------------------------------
178
+ export const policyEvaluatedDataSchema = z.object({
179
+ policyCount: z.number(),
180
+ passCount: z.number(),
181
+ failCount: z.number(),
182
+ skipCount: z.number(),
183
+ overallOutcome: policyOutcomeSchema,
184
+ });
185
+ export const policyDeniedDataSchema = z.object({
186
+ policyType: z.string(),
187
+ reason: z.string(),
188
+ remediations: z.array(z.string()).readonly(),
189
+ });
190
+ export const policyEscalatedDataSchema = z.object({
191
+ policyType: z.string(),
192
+ reason: z.string(),
193
+ escalationTarget: z.enum(['human', 'governance']),
194
+ });
195
+ // ---------------------------------------------------------------------------
196
+ // Finding payload schemas
197
+ // ---------------------------------------------------------------------------
198
+ export const findingRaisedDataSchema = z.object({
199
+ findingId: z.string(),
200
+ severity: z.enum(['critical', 'high', 'medium', 'low', 'info']),
201
+ category: z.string(),
202
+ title: z.string(),
203
+ reviewArtifact: artifactRefSchema,
204
+ });
205
+ export const findingAddressedDataSchema = z.object({
206
+ findingId: z.string(),
207
+ resolutionType: z.enum(['fixed', 'acknowledged', 'wont_fix', 'deferred']),
208
+ implementationArtifact: artifactRefSchema,
209
+ });
210
+ export const findingAcceptedDataSchema = z.object({
211
+ findingId: z.string(),
212
+ acceptedBy: z.string(),
213
+ });
214
+ export const findingRejectedDataSchema = z.object({
215
+ findingId: z.string(),
216
+ rejectedBy: z.string(),
217
+ reason: z.string(),
218
+ });
219
+ export const findingEscalatedDataSchema = z.object({
220
+ findingId: z.string(),
221
+ reason: z.string(),
222
+ escalationContextRef: artifactRefSchema,
223
+ });
224
+ // ---------------------------------------------------------------------------
225
+ // Human interaction payload schemas
226
+ // ---------------------------------------------------------------------------
227
+ export const humanInputRequestedDataSchema = z.object({
228
+ requestType: z.enum(['clarification', 'approval', 'decision', 'review']),
229
+ context: z.string(),
230
+ currentState: z.string(),
231
+ timeoutMs: z.number().optional(),
232
+ });
233
+ export const humanInputReceivedDataSchema = z.object({
234
+ requestType: z.string(),
235
+ responseTimeMs: z.number(),
236
+ inputSizeChars: z.number(),
237
+ });
238
+ export const humanApprovalGrantedDataSchema = z.object({
239
+ approvalType: z.string(),
240
+ conditions: z.array(z.string()).readonly().optional(),
241
+ artifactRef: artifactRefSchema.optional(),
242
+ });
243
+ export const humanApprovalDeniedDataSchema = z.object({
244
+ approvalType: z.string(),
245
+ reason: z.string(),
246
+ artifactRef: artifactRefSchema.optional(),
247
+ });
248
+ export const humanTimeoutDataSchema = z.object({
249
+ requestType: z.string(),
250
+ timeoutMs: z.number(),
251
+ fallbackAction: z.enum(['abort', 'escalate', 'continue_with_default']),
252
+ });
253
+ export const humanPermissionRequestedDataSchema = z.object({
254
+ runId: z.string(),
255
+ messageId: z.string(),
256
+ action: z.string(),
257
+ resource: z.string(),
258
+ riskLevel: threeTierSeveritySchema,
259
+ reasoning: z.string().optional(),
260
+ });
261
+ export const humanPermissionResolvedDataSchema = z.object({
262
+ runId: z.string(),
263
+ messageId: z.string(),
264
+ granted: z.boolean(),
265
+ });
266
+ export const humanClarificationRequestedDataSchema = z.object({
267
+ runId: z.string(),
268
+ messageId: z.string(),
269
+ question: z.string(),
270
+ context: z.string().optional(),
271
+ });
272
+ export const humanClarificationAnsweredDataSchema = z.object({
273
+ runId: z.string(),
274
+ messageId: z.string(),
275
+ answer: z.string(),
276
+ });
277
+ // ---------------------------------------------------------------------------
278
+ // Checkpoint payload schemas
279
+ // ---------------------------------------------------------------------------
280
+ export const checkpointSavedDataSchema = z.object({
281
+ checkpointId: z.string(),
282
+ currentState: z.string(),
283
+ artifactCount: z.number(),
284
+ sizeBytes: z.number(),
285
+ });
286
+ export const checkpointRestoredDataSchema = z.object({
287
+ checkpointId: z.string(),
288
+ restoredToState: z.string(),
289
+ eventsSinceCheckpoint: z.number(),
290
+ });
291
+ // ---------------------------------------------------------------------------
292
+ // System payload schemas
293
+ // ---------------------------------------------------------------------------
294
+ export const systemErrorDataSchema = z.object({
295
+ component: z.string(),
296
+ message: z.string(),
297
+ recoverable: z.boolean(),
298
+ stack: z.string().optional(),
299
+ });
300
+ export const systemWarningDataSchema = z.object({
301
+ component: z.string(),
302
+ message: z.string(),
303
+ suggestion: z.string().optional(),
304
+ });