supipowers 2.1.0 → 2.2.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.
- package/README.md +71 -12
- package/package.json +4 -8
- package/skills/ui-design/SKILL.md +2 -2
- package/src/ai/final-message.ts +15 -1
- package/src/ai/schema-text.ts +60 -40
- package/src/ai/schema-validation.ts +88 -0
- package/src/ai/structured-output.ts +19 -19
- package/src/bootstrap.ts +3 -0
- package/src/commands/fix-pr.ts +166 -26
- package/src/commands/optimize-context.ts +153 -16
- package/src/commands/runbook.ts +511 -0
- package/src/config/schema.ts +102 -139
- package/src/context/rule-renderer.ts +274 -2
- package/src/context/runbook-extension-template.ts +193 -0
- package/src/context/startup-check.ts +197 -2
- package/src/context/startup-optimizer.ts +133 -10
- package/src/docs/contracts.ts +13 -23
- package/src/fix-pr/assessment.ts +63 -24
- package/src/fix-pr/contracts.ts +15 -23
- package/src/fix-pr/fetch-comments.ts +119 -0
- package/src/fix-pr/prompt-builder.ts +19 -8
- package/src/git/commit-contract.ts +13 -19
- package/src/git/commit.ts +168 -6
- package/src/harness/command.ts +98 -6
- package/src/harness/git-verification.ts +515 -0
- package/src/harness/git-verify-qa.ts +406 -0
- package/src/harness/pipeline.ts +17 -8
- package/src/harness/stages/implement-apply.ts +61 -4
- package/src/harness/stages/validate.ts +108 -0
- package/src/lsp/capabilities.ts +9 -12
- package/src/lsp/contracts.ts +15 -23
- package/src/planning/planning-ask-tool.ts +13 -2
- package/src/planning/spec.ts +21 -27
- package/src/planning/system-prompt.ts +1 -1
- package/src/planning/validate.ts +4 -7
- package/src/platform/progress.ts +11 -0
- package/src/quality/contracts.ts +15 -23
- package/src/quality/schemas.ts +40 -67
- package/src/release/contracts.ts +19 -28
- package/src/review/types.ts +142 -186
- package/src/types.ts +45 -2
- package/src/ui-design/session.ts +13 -2
- package/src/ui-design/system-prompt.ts +2 -2
- package/src/ultraplan/contracts.ts +458 -524
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { z } from "zod/v4";
|
|
2
|
+
import type { ZodType } from "zod/v4";
|
|
3
3
|
import type {
|
|
4
4
|
ResolvedUltraPlanCatalog,
|
|
5
5
|
ResolvedUltraPlanSlotBinding,
|
|
@@ -61,6 +61,7 @@ import type {
|
|
|
61
61
|
UltraPlanStackReview,
|
|
62
62
|
} from "../types.js";
|
|
63
63
|
import { getUltraPlanBatchGraphErrors } from "./batch/planner.js";
|
|
64
|
+
import { checkSchema, collectSchemaValidationErrors, parseSchema } from "../ai/schema-validation.js";
|
|
64
65
|
|
|
65
66
|
export type {
|
|
66
67
|
ResolvedUltraPlanCatalog,
|
|
@@ -222,170 +223,157 @@ export const ULTRAPLAN_AUTHORING_FINDING_SOURCES = [
|
|
|
222
223
|
] as const satisfies readonly UltraPlanAuthoringFindingSource[];
|
|
223
224
|
|
|
224
225
|
|
|
225
|
-
function keyedObject(keys: readonly string[], valueSchema:
|
|
226
|
-
return
|
|
227
|
-
Object.fromEntries(keys.map((key) => [key, valueSchema])) as Record<string,
|
|
228
|
-
|
|
229
|
-
);
|
|
226
|
+
function keyedObject(keys: readonly string[], valueSchema: ZodType) {
|
|
227
|
+
return z.object(
|
|
228
|
+
Object.fromEntries(keys.map((key) => [key, valueSchema])) as Record<string, ZodType>,
|
|
229
|
+
).strict();
|
|
230
230
|
}
|
|
231
231
|
|
|
232
|
-
function sparseKeyedObject(keys: readonly string[], valueSchema:
|
|
233
|
-
return
|
|
232
|
+
function sparseKeyedObject(keys: readonly string[], valueSchema: ZodType) {
|
|
233
|
+
return keyedObject(keys, valueSchema).partial();
|
|
234
234
|
}
|
|
235
235
|
|
|
236
236
|
|
|
237
237
|
|
|
238
238
|
function literalUnion<const TValue extends readonly string[]>(values: TValue) {
|
|
239
|
-
return
|
|
239
|
+
return z.enum([...values] as unknown as [TValue[number], ...TValue[number][]]);
|
|
240
240
|
}
|
|
241
241
|
|
|
242
|
-
export const UltraPlanProgressSummarySchema =
|
|
242
|
+
export const UltraPlanProgressSummarySchema = z.object(
|
|
243
243
|
{
|
|
244
|
-
total:
|
|
245
|
-
terminal:
|
|
246
|
-
blocked:
|
|
244
|
+
total: z.number().min(0),
|
|
245
|
+
terminal: z.number().min(0),
|
|
246
|
+
blocked: z.number().min(0),
|
|
247
247
|
},
|
|
248
|
-
|
|
249
|
-
);
|
|
248
|
+
).strict();
|
|
250
249
|
|
|
251
|
-
export const UltraPlanAffectedUnitRefSchema =
|
|
250
|
+
export const UltraPlanAffectedUnitRefSchema = z.object(
|
|
252
251
|
{
|
|
253
|
-
stack:
|
|
254
|
-
domainId:
|
|
255
|
-
level:
|
|
256
|
-
scenarioId:
|
|
252
|
+
stack: literalUnion(ULTRAPLAN_STACKS).nullable(),
|
|
253
|
+
domainId: z.string().min(1).nullable(),
|
|
254
|
+
level: literalUnion(ULTRAPLAN_LEVELS).nullable(),
|
|
255
|
+
scenarioId: z.string().min(1).nullable(),
|
|
257
256
|
},
|
|
258
|
-
|
|
259
|
-
);
|
|
257
|
+
).strict();
|
|
260
258
|
|
|
261
|
-
export const UltraPlanProofEvidenceSchema =
|
|
259
|
+
export const UltraPlanProofEvidenceSchema = z.object(
|
|
262
260
|
{
|
|
263
|
-
summary:
|
|
264
|
-
command:
|
|
265
|
-
outputRef:
|
|
266
|
-
metadata:
|
|
261
|
+
summary: z.string().min(1),
|
|
262
|
+
command: z.string().min(1).optional(),
|
|
263
|
+
outputRef: z.string().min(1).optional(),
|
|
264
|
+
metadata: z.record(z.string(), z.unknown()).optional(),
|
|
267
265
|
},
|
|
268
|
-
|
|
269
|
-
);
|
|
266
|
+
).strict();
|
|
270
267
|
|
|
271
|
-
export const UltraPlanProofSchema =
|
|
268
|
+
export const UltraPlanProofSchema = z.object(
|
|
272
269
|
{
|
|
273
270
|
type: literalUnion(ULTRAPLAN_PROOF_TYPES),
|
|
274
271
|
phase: literalUnion(ULTRAPLAN_EXECUTION_PHASES),
|
|
275
|
-
recordedAt:
|
|
276
|
-
actor:
|
|
272
|
+
recordedAt: z.string().min(1),
|
|
273
|
+
actor: z.string().min(1),
|
|
277
274
|
evidence: UltraPlanProofEvidenceSchema,
|
|
278
|
-
artifactRef:
|
|
275
|
+
artifactRef: z.string().min(1),
|
|
279
276
|
},
|
|
280
|
-
|
|
281
|
-
);
|
|
277
|
+
).strict();
|
|
282
278
|
|
|
283
|
-
export const UltraPlanBlockerSchema =
|
|
279
|
+
export const UltraPlanBlockerSchema = z.object(
|
|
284
280
|
{
|
|
285
|
-
code:
|
|
286
|
-
message:
|
|
281
|
+
code: z.string().min(1),
|
|
282
|
+
message: z.string().min(1),
|
|
287
283
|
scope: literalUnion(ULTRAPLAN_BLOCKER_SCOPES),
|
|
288
284
|
affected: UltraPlanAffectedUnitRefSchema,
|
|
289
|
-
recoverable:
|
|
285
|
+
recoverable: z.boolean(),
|
|
290
286
|
recoveryMode: literalUnion(ULTRAPLAN_RECOVERY_MODES),
|
|
291
|
-
nextAction:
|
|
292
|
-
retryable:
|
|
293
|
-
detectedAt:
|
|
294
|
-
details:
|
|
287
|
+
nextAction: z.string().min(1),
|
|
288
|
+
retryable: z.boolean(),
|
|
289
|
+
detectedAt: z.string().min(1),
|
|
290
|
+
details: z.record(z.string(), z.unknown()).optional(),
|
|
295
291
|
},
|
|
296
|
-
|
|
297
|
-
);
|
|
292
|
+
).strict();
|
|
298
293
|
|
|
299
|
-
export const UltraPlanAgentBindingSchema =
|
|
294
|
+
export const UltraPlanAgentBindingSchema = z.object(
|
|
300
295
|
{
|
|
301
296
|
slot: literalUnion(ULTRAPLAN_AGENT_SLOT_NAMES),
|
|
302
297
|
agentType: literalUnion(ULTRAPLAN_AGENT_TYPES),
|
|
303
|
-
agentName:
|
|
304
|
-
model:
|
|
305
|
-
thinkingLevel:
|
|
298
|
+
agentName: z.string().min(1),
|
|
299
|
+
model: z.string().min(1).nullable(),
|
|
300
|
+
thinkingLevel: literalUnion(ULTRAPLAN_THINKING_LEVELS).nullable(),
|
|
306
301
|
},
|
|
307
|
-
|
|
308
|
-
);
|
|
302
|
+
).strict();
|
|
309
303
|
|
|
310
|
-
export const UltraPlanAgentSlotsSchema =
|
|
304
|
+
export const UltraPlanAgentSlotsSchema = z.object(
|
|
311
305
|
{
|
|
312
306
|
executor: UltraPlanAgentBindingSchema,
|
|
313
307
|
tester: UltraPlanAgentBindingSchema,
|
|
314
|
-
domainReviewEnabled:
|
|
315
|
-
stackReviewEnabled:
|
|
316
|
-
domainReviewer:
|
|
317
|
-
stackReviewer:
|
|
308
|
+
domainReviewEnabled: z.boolean(),
|
|
309
|
+
stackReviewEnabled: z.boolean(),
|
|
310
|
+
domainReviewer: UltraPlanAgentBindingSchema.optional(),
|
|
311
|
+
stackReviewer: UltraPlanAgentBindingSchema.optional(),
|
|
318
312
|
},
|
|
319
|
-
|
|
320
|
-
);
|
|
313
|
+
).strict();
|
|
321
314
|
|
|
322
|
-
export const UltraPlanSlotOverrideSchema =
|
|
315
|
+
export const UltraPlanSlotOverrideSchema = z.object(
|
|
323
316
|
{
|
|
324
|
-
agentName:
|
|
325
|
-
model:
|
|
326
|
-
thinkingLevel:
|
|
317
|
+
agentName: z.string().min(1).optional(),
|
|
318
|
+
model: z.string().min(1).optional(),
|
|
319
|
+
thinkingLevel: literalUnion(ULTRAPLAN_THINKING_LEVELS).optional(),
|
|
327
320
|
},
|
|
328
|
-
|
|
329
|
-
);
|
|
321
|
+
).strict();
|
|
330
322
|
|
|
331
|
-
export const UltraPlanReviewGatePolicySchema =
|
|
323
|
+
export const UltraPlanReviewGatePolicySchema = z.object(
|
|
332
324
|
{
|
|
333
|
-
enabled:
|
|
325
|
+
enabled: z.boolean(),
|
|
334
326
|
},
|
|
335
|
-
|
|
336
|
-
);
|
|
327
|
+
).strict();
|
|
337
328
|
|
|
338
|
-
export const UltraPlanConfigSchema =
|
|
329
|
+
export const UltraPlanConfigSchema = z.object(
|
|
339
330
|
{
|
|
340
|
-
slots:
|
|
341
|
-
reviewGates:
|
|
342
|
-
|
|
343
|
-
|
|
331
|
+
slots: sparseKeyedObject(ULTRAPLAN_AGENT_SLOT_NAMES, UltraPlanSlotOverrideSchema).optional(),
|
|
332
|
+
reviewGates: sparseKeyedObject(
|
|
333
|
+
ULTRAPLAN_REVIEWER_SLOT_NAMES,
|
|
334
|
+
UltraPlanReviewGatePolicySchema,
|
|
335
|
+
).optional(),
|
|
344
336
|
},
|
|
345
|
-
|
|
346
|
-
);
|
|
337
|
+
).strict();
|
|
347
338
|
|
|
348
|
-
export const UltraPlanAgentDefinitionFrontmatterSchema =
|
|
339
|
+
export const UltraPlanAgentDefinitionFrontmatterSchema = z.object(
|
|
349
340
|
{
|
|
350
|
-
name:
|
|
351
|
-
description:
|
|
352
|
-
supportedSlots:
|
|
353
|
-
model:
|
|
354
|
-
thinkingLevel:
|
|
355
|
-
focus:
|
|
341
|
+
name: z.string().min(1),
|
|
342
|
+
description: z.string().min(1),
|
|
343
|
+
supportedSlots: z.array(literalUnion(ULTRAPLAN_AGENT_SLOT_NAMES)).min(1),
|
|
344
|
+
model: z.string().min(1).optional(),
|
|
345
|
+
thinkingLevel: literalUnion(ULTRAPLAN_THINKING_LEVELS).optional(),
|
|
346
|
+
focus: z.string().min(1).optional(),
|
|
356
347
|
},
|
|
357
|
-
|
|
358
|
-
);
|
|
348
|
+
).strict();
|
|
359
349
|
|
|
360
|
-
export const ResolvedUltraPlanSlotBindingSchema =
|
|
350
|
+
export const ResolvedUltraPlanSlotBindingSchema = z.object(
|
|
361
351
|
{
|
|
362
352
|
slot: literalUnion(ULTRAPLAN_AGENT_SLOT_NAMES),
|
|
363
353
|
agentType: literalUnion(ULTRAPLAN_AGENT_TYPES),
|
|
364
|
-
agentName:
|
|
365
|
-
model:
|
|
366
|
-
thinkingLevel:
|
|
354
|
+
agentName: z.string().min(1),
|
|
355
|
+
model: z.string().min(1).nullable(),
|
|
356
|
+
thinkingLevel: literalUnion(ULTRAPLAN_THINKING_LEVELS).nullable(),
|
|
367
357
|
selectionSource: literalUnion(ULTRAPLAN_SELECTION_SOURCES),
|
|
368
358
|
definitionSource: literalUnion(ULTRAPLAN_DEFINITION_SOURCES),
|
|
369
359
|
modelSource: literalUnion(ULTRAPLAN_RESOLVED_VALUE_SOURCES),
|
|
370
360
|
thinkingLevelSource: literalUnion(ULTRAPLAN_RESOLVED_VALUE_SOURCES),
|
|
371
|
-
definitionPath:
|
|
361
|
+
definitionPath: z.string().min(1).nullable(),
|
|
372
362
|
},
|
|
373
|
-
|
|
374
|
-
);
|
|
363
|
+
).strict();
|
|
375
364
|
|
|
376
|
-
export const ResolvedUltraPlanCatalogSchema =
|
|
365
|
+
export const ResolvedUltraPlanCatalogSchema = z.object(
|
|
377
366
|
{
|
|
378
367
|
slots: keyedObject(
|
|
379
368
|
ULTRAPLAN_AGENT_SLOT_NAMES,
|
|
380
|
-
|
|
369
|
+
ResolvedUltraPlanSlotBindingSchema.nullable(),
|
|
381
370
|
),
|
|
382
371
|
reviewGates: sparseKeyedObject(
|
|
383
372
|
ULTRAPLAN_REVIEWER_SLOT_NAMES,
|
|
384
373
|
UltraPlanReviewGatePolicySchema,
|
|
385
374
|
),
|
|
386
375
|
},
|
|
387
|
-
|
|
388
|
-
);
|
|
376
|
+
).strict();
|
|
389
377
|
|
|
390
378
|
|
|
391
379
|
const ULTRAPLAN_NON_TERMINAL_SCENARIO_STATUSES = [
|
|
@@ -400,280 +388,258 @@ const ULTRAPLAN_NON_TERMINAL_SCENARIO_STATUSES = [
|
|
|
400
388
|
const ULTRAPLAN_TERMINAL_SCENARIO_STATUSES = ["green-proved", "review-passed", "done"] as const;
|
|
401
389
|
|
|
402
390
|
const UltraPlanScenarioSharedShape = {
|
|
403
|
-
id:
|
|
404
|
-
title:
|
|
391
|
+
id: z.string().min(1),
|
|
392
|
+
title: z.string().min(1),
|
|
405
393
|
stack: literalUnion(ULTRAPLAN_STACKS),
|
|
406
|
-
domainId:
|
|
394
|
+
domainId: z.string().min(1),
|
|
407
395
|
level: literalUnion(ULTRAPLAN_LEVELS),
|
|
408
|
-
steps:
|
|
409
|
-
assignedSlots:
|
|
410
|
-
dependencies:
|
|
411
|
-
blocker:
|
|
396
|
+
steps: z.array(z.string().min(1)),
|
|
397
|
+
assignedSlots: z.array(literalUnion(ULTRAPLAN_AGENT_SLOT_NAMES)),
|
|
398
|
+
dependencies: z.array(z.string().min(1)).optional(),
|
|
399
|
+
blocker: UltraPlanBlockerSchema.nullable().optional(),
|
|
412
400
|
};
|
|
413
401
|
|
|
414
|
-
export const UltraPlanScenarioSchema =
|
|
415
|
-
|
|
402
|
+
export const UltraPlanScenarioSchema = z.union([
|
|
403
|
+
z.object(
|
|
416
404
|
{
|
|
417
405
|
...UltraPlanScenarioSharedShape,
|
|
418
406
|
status: literalUnion(ULTRAPLAN_NON_TERMINAL_SCENARIO_STATUSES),
|
|
419
|
-
proofs:
|
|
407
|
+
proofs: z.array(UltraPlanProofSchema),
|
|
420
408
|
},
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
Type.Object(
|
|
409
|
+
).strict(),
|
|
410
|
+
z.object(
|
|
424
411
|
{
|
|
425
412
|
...UltraPlanScenarioSharedShape,
|
|
426
413
|
status: literalUnion(ULTRAPLAN_TERMINAL_SCENARIO_STATUSES),
|
|
427
|
-
proofs:
|
|
414
|
+
proofs: z.array(UltraPlanProofSchema).min(1),
|
|
428
415
|
},
|
|
429
|
-
|
|
430
|
-
),
|
|
416
|
+
).strict(),
|
|
431
417
|
]);
|
|
432
418
|
|
|
433
|
-
export const UltraPlanDomainReviewGateSchema =
|
|
419
|
+
export const UltraPlanDomainReviewGateSchema = z.object(
|
|
434
420
|
{
|
|
435
|
-
enabled:
|
|
421
|
+
enabled: z.boolean(),
|
|
436
422
|
status: literalUnion(ULTRAPLAN_REVIEW_STATUSES),
|
|
437
423
|
},
|
|
438
|
-
|
|
439
|
-
);
|
|
424
|
+
).strict();
|
|
440
425
|
|
|
441
|
-
export const UltraPlanDomainSchema =
|
|
426
|
+
export const UltraPlanDomainSchema = z.object(
|
|
442
427
|
{
|
|
443
|
-
id:
|
|
444
|
-
name:
|
|
445
|
-
unit:
|
|
446
|
-
integration:
|
|
447
|
-
e2e:
|
|
428
|
+
id: z.string().min(1),
|
|
429
|
+
name: z.string().min(1),
|
|
430
|
+
unit: z.array(UltraPlanScenarioSchema),
|
|
431
|
+
integration: z.array(UltraPlanScenarioSchema),
|
|
432
|
+
e2e: z.array(UltraPlanScenarioSchema),
|
|
448
433
|
review: UltraPlanDomainReviewGateSchema,
|
|
449
434
|
progress: UltraPlanProgressSummarySchema,
|
|
450
435
|
},
|
|
451
|
-
|
|
452
|
-
);
|
|
436
|
+
).strict();
|
|
453
437
|
|
|
454
|
-
export const UltraPlanStackSchema =
|
|
438
|
+
export const UltraPlanStackSchema = z.object(
|
|
455
439
|
{
|
|
456
440
|
stack: literalUnion(ULTRAPLAN_STACKS),
|
|
457
441
|
applicability: literalUnion(ULTRAPLAN_APPLICABILITY),
|
|
458
|
-
domains:
|
|
442
|
+
domains: z.array(UltraPlanDomainSchema),
|
|
459
443
|
status: literalUnion(ULTRAPLAN_SESSION_STATES),
|
|
460
444
|
agentSlots: UltraPlanAgentSlotsSchema,
|
|
461
445
|
progress: UltraPlanProgressSummarySchema,
|
|
462
446
|
},
|
|
463
|
-
|
|
464
|
-
);
|
|
447
|
+
).strict();
|
|
465
448
|
|
|
466
|
-
export const UltraPlanCursorSchema =
|
|
449
|
+
export const UltraPlanCursorSchema = z.object(
|
|
467
450
|
{
|
|
468
451
|
targetType: literalUnion(ULTRAPLAN_CURSOR_TARGETS),
|
|
469
|
-
stack:
|
|
470
|
-
domainId:
|
|
471
|
-
level:
|
|
472
|
-
scenarioId:
|
|
452
|
+
stack: literalUnion(ULTRAPLAN_STACKS).nullable(),
|
|
453
|
+
domainId: z.string().min(1).nullable(),
|
|
454
|
+
level: literalUnion(ULTRAPLAN_LEVELS).nullable(),
|
|
455
|
+
scenarioId: z.string().min(1).nullable(),
|
|
473
456
|
phase: literalUnion(ULTRAPLAN_EXECUTION_PHASES),
|
|
474
457
|
status: literalUnion([
|
|
475
458
|
...ULTRAPLAN_SCENARIO_STATUSES,
|
|
476
459
|
...ULTRAPLAN_REVIEW_STATUSES,
|
|
477
460
|
...ULTRAPLAN_SESSION_STATES,
|
|
478
461
|
] as const),
|
|
479
|
-
summary:
|
|
462
|
+
summary: z.string().min(1),
|
|
480
463
|
},
|
|
481
|
-
|
|
482
|
-
);
|
|
464
|
+
).strict();
|
|
483
465
|
|
|
484
|
-
export const UltraPlanDomainReviewSchema =
|
|
466
|
+
export const UltraPlanDomainReviewSchema = z.object(
|
|
485
467
|
{
|
|
486
468
|
stack: literalUnion(ULTRAPLAN_STACKS),
|
|
487
|
-
domainId:
|
|
469
|
+
domainId: z.string().min(1),
|
|
488
470
|
reviewerSlot: literalUnion(ULTRAPLAN_AGENT_SLOT_NAMES),
|
|
489
471
|
status: literalUnion(ULTRAPLAN_REVIEW_STATUSES),
|
|
490
|
-
startedAt:
|
|
491
|
-
completedAt:
|
|
492
|
-
summary:
|
|
493
|
-
artifactRef:
|
|
472
|
+
startedAt: z.string().min(1),
|
|
473
|
+
completedAt: z.string().min(1).optional(),
|
|
474
|
+
summary: z.string().min(1),
|
|
475
|
+
artifactRef: z.string().min(1),
|
|
494
476
|
},
|
|
495
|
-
|
|
496
|
-
);
|
|
477
|
+
).strict();
|
|
497
478
|
|
|
498
|
-
export const UltraPlanStackReviewSchema =
|
|
479
|
+
export const UltraPlanStackReviewSchema = z.object(
|
|
499
480
|
{
|
|
500
481
|
stack: literalUnion(ULTRAPLAN_STACKS),
|
|
501
482
|
reviewerSlot: literalUnion(ULTRAPLAN_AGENT_SLOT_NAMES),
|
|
502
483
|
status: literalUnion(ULTRAPLAN_REVIEW_STATUSES),
|
|
503
|
-
startedAt:
|
|
504
|
-
completedAt:
|
|
505
|
-
summary:
|
|
506
|
-
artifactRef:
|
|
484
|
+
startedAt: z.string().min(1),
|
|
485
|
+
completedAt: z.string().min(1).optional(),
|
|
486
|
+
summary: z.string().min(1),
|
|
487
|
+
artifactRef: z.string().min(1),
|
|
507
488
|
},
|
|
508
|
-
|
|
509
|
-
);
|
|
489
|
+
).strict();
|
|
510
490
|
|
|
511
|
-
export const UltraPlanAuthoredArtifactSchema =
|
|
491
|
+
export const UltraPlanAuthoredArtifactSchema = z.object(
|
|
512
492
|
{
|
|
513
|
-
sessionId:
|
|
514
|
-
title:
|
|
515
|
-
goal:
|
|
516
|
-
createdAt:
|
|
517
|
-
updatedAt:
|
|
518
|
-
stacks:
|
|
493
|
+
sessionId: z.string().min(1),
|
|
494
|
+
title: z.string().min(1),
|
|
495
|
+
goal: z.string().min(1),
|
|
496
|
+
createdAt: z.string().min(1),
|
|
497
|
+
updatedAt: z.string().min(1),
|
|
498
|
+
stacks: z.array(UltraPlanStackSchema),
|
|
519
499
|
},
|
|
520
|
-
|
|
521
|
-
);
|
|
500
|
+
).strict();
|
|
522
501
|
|
|
523
|
-
export const UltraPlanManifestAuthoredRefsSchema =
|
|
502
|
+
export const UltraPlanManifestAuthoredRefsSchema = z.object(
|
|
524
503
|
{
|
|
525
|
-
json:
|
|
526
|
-
markdown:
|
|
504
|
+
json: z.string().min(1),
|
|
505
|
+
markdown: z.string().min(1).optional(),
|
|
527
506
|
},
|
|
528
|
-
|
|
529
|
-
);
|
|
507
|
+
).strict();
|
|
530
508
|
|
|
531
|
-
export const UltraPlanManifestStackSummarySchema =
|
|
509
|
+
export const UltraPlanManifestStackSummarySchema = z.object(
|
|
532
510
|
{
|
|
533
511
|
stack: literalUnion(ULTRAPLAN_STACKS),
|
|
534
512
|
applicability: literalUnion(ULTRAPLAN_APPLICABILITY),
|
|
535
513
|
progress: UltraPlanProgressSummarySchema,
|
|
536
|
-
domainCount:
|
|
537
|
-
terminalDomainCount:
|
|
514
|
+
domainCount: z.number().min(0),
|
|
515
|
+
terminalDomainCount: z.number().min(0),
|
|
538
516
|
},
|
|
539
|
-
|
|
540
|
-
);
|
|
517
|
+
).strict();
|
|
541
518
|
|
|
542
|
-
export const UltraPlanManifestReviewReferenceSchema =
|
|
519
|
+
export const UltraPlanManifestReviewReferenceSchema = z.object(
|
|
543
520
|
{
|
|
544
521
|
type: literalUnion(["domain", "stack"] as const),
|
|
545
522
|
stack: literalUnion(ULTRAPLAN_STACKS),
|
|
546
|
-
domainId:
|
|
547
|
-
path:
|
|
523
|
+
domainId: z.string().min(1).nullable(),
|
|
524
|
+
path: z.string().min(1),
|
|
548
525
|
status: literalUnion(ULTRAPLAN_REVIEW_STATUSES),
|
|
549
526
|
},
|
|
550
|
-
|
|
551
|
-
);
|
|
527
|
+
).strict();
|
|
552
528
|
|
|
553
529
|
// --- Authoring pipeline schemas ---------------------------------------------------
|
|
554
530
|
|
|
555
|
-
export const UltraPlanAuthoringFindingSchema =
|
|
531
|
+
export const UltraPlanAuthoringFindingSchema = z.object(
|
|
556
532
|
{
|
|
557
|
-
id:
|
|
533
|
+
id: z.string().min(1),
|
|
558
534
|
severity: literalUnion(ULTRAPLAN_AUTHORING_FINDING_SEVERITIES),
|
|
559
535
|
source: literalUnion(ULTRAPLAN_AUTHORING_FINDING_SOURCES),
|
|
560
|
-
target:
|
|
536
|
+
target: z.object(
|
|
561
537
|
{
|
|
562
|
-
stack:
|
|
563
|
-
domainId:
|
|
564
|
-
scenarioId:
|
|
538
|
+
stack: literalUnion(ULTRAPLAN_STACKS).nullable(),
|
|
539
|
+
domainId: z.string().min(1).nullable(),
|
|
540
|
+
scenarioId: z.string().min(1).nullable(),
|
|
565
541
|
},
|
|
566
|
-
|
|
567
|
-
),
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
recordedAt: Type.String({ minLength: 1 }),
|
|
542
|
+
).strict(),
|
|
543
|
+
message: z.string().min(1),
|
|
544
|
+
recommendation: z.string().min(1),
|
|
545
|
+
recordedAt: z.string().min(1),
|
|
571
546
|
},
|
|
572
|
-
|
|
573
|
-
);
|
|
547
|
+
).strict();
|
|
574
548
|
|
|
575
|
-
export const UltraPlanAuthoringFindingsArtifactSchema =
|
|
549
|
+
export const UltraPlanAuthoringFindingsArtifactSchema = z.object(
|
|
576
550
|
{
|
|
577
|
-
iteration:
|
|
578
|
-
draftRef:
|
|
579
|
-
recordedAt:
|
|
580
|
-
findings:
|
|
551
|
+
iteration: z.number().int().min(1),
|
|
552
|
+
draftRef: z.string().min(1),
|
|
553
|
+
recordedAt: z.string().min(1),
|
|
554
|
+
findings: z.array(UltraPlanAuthoringFindingSchema),
|
|
581
555
|
},
|
|
582
|
-
|
|
583
|
-
);
|
|
556
|
+
).strict();
|
|
584
557
|
|
|
585
|
-
export const UltraPlanAuthoringResearchRefSchema =
|
|
558
|
+
export const UltraPlanAuthoringResearchRefSchema = z.object(
|
|
586
559
|
{
|
|
587
560
|
stack: literalUnion(ULTRAPLAN_STACKS),
|
|
588
|
-
path:
|
|
561
|
+
path: z.string().min(1),
|
|
589
562
|
},
|
|
590
|
-
|
|
591
|
-
);
|
|
563
|
+
).strict();
|
|
592
564
|
|
|
593
|
-
export const UltraPlanAuthoringArtifactRefsSchema =
|
|
565
|
+
export const UltraPlanAuthoringArtifactRefsSchema = z.object(
|
|
594
566
|
{
|
|
595
|
-
intake:
|
|
596
|
-
scout:
|
|
597
|
-
discuss:
|
|
598
|
-
deferredIdeas:
|
|
599
|
-
research:
|
|
600
|
-
researchSummary:
|
|
601
|
-
draft:
|
|
602
|
-
draftMarkdown:
|
|
603
|
-
findings:
|
|
567
|
+
intake: z.string().min(1).optional(),
|
|
568
|
+
scout: z.string().min(1).optional(),
|
|
569
|
+
discuss: z.string().min(1).optional(),
|
|
570
|
+
deferredIdeas: z.string().min(1).optional(),
|
|
571
|
+
research: z.array(UltraPlanAuthoringResearchRefSchema).optional(),
|
|
572
|
+
researchSummary: z.string().min(1).optional(),
|
|
573
|
+
draft: z.string().min(1).optional(),
|
|
574
|
+
draftMarkdown: z.string().min(1).optional(),
|
|
575
|
+
findings: z.string().min(1).optional(),
|
|
604
576
|
},
|
|
605
|
-
|
|
606
|
-
);
|
|
577
|
+
).strict();
|
|
607
578
|
|
|
608
|
-
export const UltraPlanAuthoringStateSchema =
|
|
579
|
+
export const UltraPlanAuthoringStateSchema = z.object(
|
|
609
580
|
{
|
|
610
581
|
pipeline: literalUnion(ULTRAPLAN_AUTHORING_PIPELINE_MODES),
|
|
611
582
|
stage: literalUnion(ULTRAPLAN_AUTHORING_STAGES),
|
|
612
583
|
stageStatus: literalUnion(ULTRAPLAN_AUTHORING_STAGE_STATUSES),
|
|
613
|
-
iteration:
|
|
614
|
-
stallReentryCount:
|
|
584
|
+
iteration: z.number().int().min(1),
|
|
585
|
+
stallReentryCount: z.number().int().min(0),
|
|
615
586
|
artifacts: UltraPlanAuthoringArtifactRefsSchema,
|
|
616
|
-
blocker:
|
|
617
|
-
startedAt:
|
|
618
|
-
updatedAt:
|
|
587
|
+
blocker: UltraPlanBlockerSchema.nullable(),
|
|
588
|
+
startedAt: z.string().min(1),
|
|
589
|
+
updatedAt: z.string().min(1),
|
|
619
590
|
},
|
|
620
|
-
|
|
621
|
-
);
|
|
591
|
+
).strict();
|
|
622
592
|
|
|
623
|
-
export const UltraPlanAuthoringPipelineEventSchema =
|
|
593
|
+
export const UltraPlanAuthoringPipelineEventSchema = z.object(
|
|
624
594
|
{
|
|
625
|
-
recordedAt:
|
|
595
|
+
recordedAt: z.string().min(1),
|
|
626
596
|
stage: literalUnion(ULTRAPLAN_AUTHORING_STAGES),
|
|
627
597
|
stageStatus: literalUnion(ULTRAPLAN_AUTHORING_STAGE_STATUSES),
|
|
628
|
-
iteration:
|
|
629
|
-
summary:
|
|
630
|
-
details:
|
|
598
|
+
iteration: z.number().int().min(1),
|
|
599
|
+
summary: z.string(),
|
|
600
|
+
details: z.record(z.string(), z.unknown()).optional(),
|
|
631
601
|
},
|
|
632
|
-
|
|
633
|
-
);
|
|
602
|
+
).strict();
|
|
634
603
|
|
|
635
604
|
|
|
636
|
-
export const UltraPlanManifestSchema =
|
|
605
|
+
export const UltraPlanManifestSchema = z.object(
|
|
637
606
|
{
|
|
638
|
-
sessionId:
|
|
639
|
-
projectName:
|
|
640
|
-
title:
|
|
607
|
+
sessionId: z.string().min(1),
|
|
608
|
+
projectName: z.string().min(1),
|
|
609
|
+
title: z.string().min(1),
|
|
641
610
|
authored: UltraPlanManifestAuthoredRefsSchema,
|
|
642
611
|
state: literalUnion(ULTRAPLAN_SESSION_STATES),
|
|
643
|
-
cursor:
|
|
644
|
-
lastCompleted:
|
|
612
|
+
cursor: UltraPlanCursorSchema.nullable(),
|
|
613
|
+
lastCompleted: UltraPlanCursorSchema.nullable(),
|
|
645
614
|
progress: UltraPlanProgressSummarySchema,
|
|
646
|
-
stacks:
|
|
647
|
-
blocker:
|
|
648
|
-
reviews:
|
|
649
|
-
createdAt:
|
|
650
|
-
updatedAt:
|
|
651
|
-
authoring:
|
|
615
|
+
stacks: z.array(UltraPlanManifestStackSummarySchema),
|
|
616
|
+
blocker: UltraPlanBlockerSchema.nullable(),
|
|
617
|
+
reviews: z.array(UltraPlanManifestReviewReferenceSchema),
|
|
618
|
+
createdAt: z.string().min(1),
|
|
619
|
+
updatedAt: z.string().min(1),
|
|
620
|
+
authoring: UltraPlanAuthoringStateSchema.optional(),
|
|
652
621
|
},
|
|
653
|
-
|
|
654
|
-
);
|
|
622
|
+
).strict();
|
|
655
623
|
|
|
656
|
-
export const UltraPlanIndexEntrySchema =
|
|
624
|
+
export const UltraPlanIndexEntrySchema = z.object(
|
|
657
625
|
{
|
|
658
|
-
sessionId:
|
|
659
|
-
title:
|
|
626
|
+
sessionId: z.string().min(1),
|
|
627
|
+
title: z.string().min(1),
|
|
660
628
|
state: literalUnion(ULTRAPLAN_SESSION_STATES),
|
|
661
629
|
bucket: literalUnion(ULTRAPLAN_SESSION_BUCKETS),
|
|
662
|
-
createdAt:
|
|
663
|
-
updatedAt:
|
|
664
|
-
cursor:
|
|
665
|
-
idleReason:
|
|
666
|
-
authoringStage:
|
|
630
|
+
createdAt: z.string().min(1),
|
|
631
|
+
updatedAt: z.string().min(1),
|
|
632
|
+
cursor: UltraPlanCursorSchema.nullable(),
|
|
633
|
+
idleReason: z.string().min(1).nullable(),
|
|
634
|
+
authoringStage: literalUnion(ULTRAPLAN_AUTHORING_STAGES).nullable().optional(),
|
|
667
635
|
},
|
|
668
|
-
|
|
669
|
-
);
|
|
636
|
+
).strict();
|
|
670
637
|
|
|
671
|
-
export const UltraPlanIndexSchema =
|
|
638
|
+
export const UltraPlanIndexSchema = z.object(
|
|
672
639
|
{
|
|
673
|
-
sessions:
|
|
640
|
+
sessions: z.array(UltraPlanIndexEntrySchema),
|
|
674
641
|
},
|
|
675
|
-
|
|
676
|
-
);
|
|
642
|
+
).strict();
|
|
677
643
|
|
|
678
644
|
type UltraPlanTerminalProofRequirement = {
|
|
679
645
|
phase: UltraPlanProof["phase"];
|
|
@@ -701,15 +667,15 @@ function getRequiredUltraPlanTerminalProofRequirements(
|
|
|
701
667
|
|
|
702
668
|
function formatUltraPlanRequiredProofTypes(types: readonly UltraPlanProof["type"][]): string {
|
|
703
669
|
return types.length === 1
|
|
704
|
-
?
|
|
705
|
-
: types.map((type) =>
|
|
670
|
+
? `"${types[0]}"`
|
|
671
|
+
: types.map((type) => `"${type}"`).join(" or ");
|
|
706
672
|
}
|
|
707
673
|
|
|
708
674
|
function formatUltraPlanTerminalProofRequirements(
|
|
709
675
|
requirements: readonly UltraPlanTerminalProofRequirement[],
|
|
710
676
|
): string {
|
|
711
677
|
return requirements
|
|
712
|
-
.map((requirement) => `a
|
|
678
|
+
.map((requirement) => `a "${requirement.phase}" proof of type ${formatUltraPlanRequiredProofTypes(requirement.types)}`)
|
|
713
679
|
.join(" or ");
|
|
714
680
|
}
|
|
715
681
|
|
|
@@ -733,7 +699,7 @@ function collectUltraPlanScenarioProofErrors(
|
|
|
733
699
|
}
|
|
734
700
|
|
|
735
701
|
errors.push(
|
|
736
|
-
`/stacks/${scenario.stack}/domains/${scenario.domainId}/${level}/${scenario.id} terminal scenario
|
|
702
|
+
`/stacks/${scenario.stack}/domains/${scenario.domainId}/${level}/${scenario.id} terminal scenario "${scenario.id}" with status "${scenario.status}" requires at least one terminal proof: ${formatUltraPlanTerminalProofRequirements(requirements)}`,
|
|
737
703
|
);
|
|
738
704
|
}
|
|
739
705
|
}
|
|
@@ -753,20 +719,21 @@ function getUltraPlanAuthoredArtifactSemanticErrors(authored: UltraPlanAuthoredA
|
|
|
753
719
|
}
|
|
754
720
|
|
|
755
721
|
|
|
756
|
-
export function getUltraPlanSchemaErrors(schema:
|
|
757
|
-
return
|
|
722
|
+
export function getUltraPlanSchemaErrors(schema: ZodType, value: unknown): string[] {
|
|
723
|
+
return collectSchemaValidationErrors(schema, value).map((error) => `${error.path === "(root)" ? "/" : error.path} ${error.message}`);
|
|
758
724
|
}
|
|
759
725
|
|
|
760
|
-
function buildValidationResult<T>(schema:
|
|
726
|
+
function buildValidationResult<T>(schema: ZodType<T>, value: unknown):
|
|
761
727
|
| { ok: true; value: T }
|
|
762
728
|
| { ok: false; errors: string[] } {
|
|
763
|
-
|
|
764
|
-
|
|
729
|
+
const result = parseSchema<T>(schema, value);
|
|
730
|
+
if (result.success) {
|
|
731
|
+
return { ok: true, value: result.data };
|
|
765
732
|
}
|
|
766
733
|
|
|
767
734
|
return {
|
|
768
735
|
ok: false,
|
|
769
|
-
errors:
|
|
736
|
+
errors: result.errors.map((error) => `${error.path === "(root)" ? "/" : error.path} ${error.message}`),
|
|
770
737
|
};
|
|
771
738
|
}
|
|
772
739
|
|
|
@@ -813,53 +780,53 @@ export function validateUltraPlanAuthoredArtifact(value: unknown) {
|
|
|
813
780
|
export function isUltraPlanAgentDefinitionFrontmatter(
|
|
814
781
|
value: unknown,
|
|
815
782
|
): value is UltraPlanAgentDefinitionFrontmatter {
|
|
816
|
-
return
|
|
783
|
+
return checkSchema(UltraPlanAgentDefinitionFrontmatterSchema, value);
|
|
817
784
|
}
|
|
818
785
|
|
|
819
786
|
export function isResolvedUltraPlanSlotBinding(value: unknown): value is ResolvedUltraPlanSlotBinding {
|
|
820
|
-
return
|
|
787
|
+
return checkSchema(ResolvedUltraPlanSlotBindingSchema, value);
|
|
821
788
|
}
|
|
822
789
|
|
|
823
790
|
export function isResolvedUltraPlanCatalog(value: unknown): value is ResolvedUltraPlanCatalog {
|
|
824
|
-
return
|
|
791
|
+
return checkSchema(ResolvedUltraPlanCatalogSchema, value);
|
|
825
792
|
}
|
|
826
793
|
|
|
827
794
|
|
|
828
795
|
export function isUltraPlanProof(value: unknown): value is UltraPlanProof {
|
|
829
|
-
return
|
|
796
|
+
return checkSchema(UltraPlanProofSchema, value);
|
|
830
797
|
}
|
|
831
798
|
|
|
832
799
|
export function isUltraPlanBlocker(value: unknown): value is UltraPlanBlocker {
|
|
833
|
-
return
|
|
800
|
+
return checkSchema(UltraPlanBlockerSchema, value);
|
|
834
801
|
}
|
|
835
802
|
|
|
836
803
|
export function isUltraPlanScenario(value: unknown): value is UltraPlanScenario {
|
|
837
|
-
return
|
|
804
|
+
return checkSchema(UltraPlanScenarioSchema, value)
|
|
838
805
|
&& hasRequiredUltraPlanScenarioProof(value as UltraPlanScenario);
|
|
839
806
|
}
|
|
840
807
|
|
|
841
808
|
export function isUltraPlanDomain(value: unknown): value is UltraPlanDomain {
|
|
842
|
-
return
|
|
809
|
+
return checkSchema(UltraPlanDomainSchema, value);
|
|
843
810
|
}
|
|
844
811
|
|
|
845
812
|
export function isUltraPlanAgentSlots(value: unknown): value is UltraPlanAgentSlots {
|
|
846
|
-
return
|
|
813
|
+
return checkSchema(UltraPlanAgentSlotsSchema, value);
|
|
847
814
|
}
|
|
848
815
|
|
|
849
816
|
export function isUltraPlanStack(value: unknown): value is UltraPlanStack {
|
|
850
|
-
return
|
|
817
|
+
return checkSchema(UltraPlanStackSchema, value);
|
|
851
818
|
}
|
|
852
819
|
|
|
853
820
|
export function isUltraPlanCursor(value: unknown): value is UltraPlanCursor {
|
|
854
|
-
return
|
|
821
|
+
return checkSchema(UltraPlanCursorSchema, value);
|
|
855
822
|
}
|
|
856
823
|
|
|
857
824
|
export function isUltraPlanDomainReview(value: unknown): value is UltraPlanDomainReview {
|
|
858
|
-
return
|
|
825
|
+
return checkSchema(UltraPlanDomainReviewSchema, value);
|
|
859
826
|
}
|
|
860
827
|
|
|
861
828
|
export function isUltraPlanStackReview(value: unknown): value is UltraPlanStackReview {
|
|
862
|
-
return
|
|
829
|
+
return checkSchema(UltraPlanStackReviewSchema, value);
|
|
863
830
|
}
|
|
864
831
|
|
|
865
832
|
export function isUltraPlanAuthoredArtifact(value: unknown): value is UltraPlanAuthoredArtifact {
|
|
@@ -867,15 +834,15 @@ export function isUltraPlanAuthoredArtifact(value: unknown): value is UltraPlanA
|
|
|
867
834
|
}
|
|
868
835
|
|
|
869
836
|
export function isUltraPlanManifest(value: unknown): value is UltraPlanManifest {
|
|
870
|
-
return
|
|
837
|
+
return checkSchema(UltraPlanManifestSchema, value);
|
|
871
838
|
}
|
|
872
839
|
|
|
873
840
|
export function isUltraPlanIndexEntry(value: unknown): value is UltraPlanIndexEntry {
|
|
874
|
-
return
|
|
841
|
+
return checkSchema(UltraPlanIndexEntrySchema, value);
|
|
875
842
|
}
|
|
876
843
|
|
|
877
844
|
export function isUltraPlanIndex(value: unknown): value is UltraPlanIndex {
|
|
878
|
-
return
|
|
845
|
+
return checkSchema(UltraPlanIndexSchema, value);
|
|
879
846
|
}
|
|
880
847
|
|
|
881
848
|
|
|
@@ -919,294 +886,266 @@ export const ULTRAPLAN_RUNTIME_BLOCKER_CODES = [
|
|
|
919
886
|
"migration-conflict",
|
|
920
887
|
] as const;
|
|
921
888
|
|
|
922
|
-
export const UltraPlanLaunchContextSchema =
|
|
889
|
+
export const UltraPlanLaunchContextSchema = z.object(
|
|
923
890
|
{
|
|
924
|
-
attemptId:
|
|
925
|
-
attemptKey:
|
|
891
|
+
attemptId: z.string().min(1),
|
|
892
|
+
attemptKey: z.string().min(1),
|
|
926
893
|
sourceAgent: literalUnion(ULTRAPLAN_SOURCE_AGENTS),
|
|
927
|
-
launchedAt:
|
|
894
|
+
launchedAt: z.string().min(1),
|
|
928
895
|
},
|
|
929
|
-
|
|
930
|
-
);
|
|
896
|
+
).strict();
|
|
931
897
|
|
|
932
|
-
export const UltraPlanObservationTargetSchema =
|
|
898
|
+
export const UltraPlanObservationTargetSchema = z.object(
|
|
933
899
|
{
|
|
934
900
|
targetType: literalUnion(ULTRAPLAN_CURSOR_TARGETS),
|
|
935
|
-
stack:
|
|
936
|
-
domainId:
|
|
937
|
-
level:
|
|
938
|
-
scenarioId:
|
|
901
|
+
stack: literalUnion(ULTRAPLAN_STACKS).nullable(),
|
|
902
|
+
domainId: z.string().min(1).nullable(),
|
|
903
|
+
level: literalUnion(ULTRAPLAN_LEVELS).nullable(),
|
|
904
|
+
scenarioId: z.string().min(1).nullable(),
|
|
939
905
|
phase: literalUnion(ULTRAPLAN_EXECUTION_PHASES),
|
|
940
|
-
resolvedSlot:
|
|
906
|
+
resolvedSlot: z.string().min(1).nullable(),
|
|
941
907
|
},
|
|
942
|
-
|
|
943
|
-
);
|
|
908
|
+
).strict();
|
|
944
909
|
|
|
945
|
-
export const UltraPlanObservationCorrelationFailureSchema =
|
|
910
|
+
export const UltraPlanObservationCorrelationFailureSchema = z.object(
|
|
946
911
|
{
|
|
947
|
-
reason:
|
|
948
|
-
details:
|
|
912
|
+
reason: z.string().min(1),
|
|
913
|
+
details: z.record(z.string(), z.unknown()).optional(),
|
|
949
914
|
},
|
|
950
|
-
|
|
951
|
-
);
|
|
915
|
+
).strict();
|
|
952
916
|
|
|
953
|
-
export const UltraPlanHookObservationSchema =
|
|
917
|
+
export const UltraPlanHookObservationSchema = z.object(
|
|
954
918
|
{
|
|
955
|
-
sessionId:
|
|
919
|
+
sessionId: z.string().min(1),
|
|
956
920
|
hookEvent: literalUnion(ULTRAPLAN_HOOK_EVENT_NAMES),
|
|
957
921
|
actorKind: literalUnion(ULTRAPLAN_ACTOR_KINDS),
|
|
958
|
-
attemptId:
|
|
959
|
-
attemptKey:
|
|
922
|
+
attemptId: z.string().min(1).nullable(),
|
|
923
|
+
attemptKey: z.string().min(1).nullable(),
|
|
960
924
|
sourceAgent: literalUnion(ULTRAPLAN_SOURCE_AGENTS),
|
|
961
|
-
occurredAt:
|
|
962
|
-
causationId:
|
|
963
|
-
fingerprint:
|
|
964
|
-
target:
|
|
965
|
-
correlationFailure:
|
|
966
|
-
payloadSummary:
|
|
925
|
+
occurredAt: z.string().min(1),
|
|
926
|
+
causationId: z.string().min(1).nullable(),
|
|
927
|
+
fingerprint: z.string().min(1),
|
|
928
|
+
target: UltraPlanObservationTargetSchema.nullable(),
|
|
929
|
+
correlationFailure: UltraPlanObservationCorrelationFailureSchema.nullable(),
|
|
930
|
+
payloadSummary: z.string(),
|
|
967
931
|
},
|
|
968
|
-
|
|
969
|
-
);
|
|
932
|
+
).strict();
|
|
970
933
|
|
|
971
|
-
export const UltraPlanProofCandidateTargetSchema =
|
|
934
|
+
export const UltraPlanProofCandidateTargetSchema = z.object(
|
|
972
935
|
{
|
|
973
936
|
targetType: literalUnion(ULTRAPLAN_CURSOR_TARGETS),
|
|
974
|
-
stack:
|
|
975
|
-
domainId:
|
|
976
|
-
level:
|
|
977
|
-
scenarioId:
|
|
937
|
+
stack: literalUnion(ULTRAPLAN_STACKS).nullable(),
|
|
938
|
+
domainId: z.string().min(1).nullable(),
|
|
939
|
+
level: literalUnion(ULTRAPLAN_LEVELS).nullable(),
|
|
940
|
+
scenarioId: z.string().min(1).nullable(),
|
|
978
941
|
},
|
|
979
|
-
|
|
980
|
-
);
|
|
942
|
+
).strict();
|
|
981
943
|
|
|
982
|
-
export const UltraPlanProofCandidateSchema =
|
|
944
|
+
export const UltraPlanProofCandidateSchema = z.object(
|
|
983
945
|
{
|
|
984
946
|
phase: literalUnion(ULTRAPLAN_EXECUTION_PHASES),
|
|
985
947
|
type: literalUnion(ULTRAPLAN_PROOF_TYPES),
|
|
986
948
|
target: UltraPlanProofCandidateTargetSchema,
|
|
987
949
|
evidence: UltraPlanProofEvidenceSchema,
|
|
988
|
-
artifactRef:
|
|
989
|
-
observationFingerprint:
|
|
990
|
-
fingerprint:
|
|
950
|
+
artifactRef: z.string().min(1).nullable(),
|
|
951
|
+
observationFingerprint: z.string().min(1),
|
|
952
|
+
fingerprint: z.string().min(1),
|
|
991
953
|
},
|
|
992
|
-
|
|
993
|
-
);
|
|
954
|
+
).strict();
|
|
994
955
|
|
|
995
|
-
export const UltraPlanBlockerCandidateSchema =
|
|
956
|
+
export const UltraPlanBlockerCandidateSchema = z.object(
|
|
996
957
|
{
|
|
997
958
|
blocker: UltraPlanBlockerSchema,
|
|
998
|
-
observationFingerprint:
|
|
959
|
+
observationFingerprint: z.string().min(1),
|
|
999
960
|
},
|
|
1000
|
-
|
|
1001
|
-
);
|
|
961
|
+
).strict();
|
|
1002
962
|
|
|
1003
|
-
export const UltraPlanAttemptRecordSchema =
|
|
963
|
+
export const UltraPlanAttemptRecordSchema = z.object(
|
|
1004
964
|
{
|
|
1005
|
-
attemptId:
|
|
1006
|
-
attemptKey:
|
|
965
|
+
attemptId: z.string().min(1),
|
|
966
|
+
attemptKey: z.string().min(1),
|
|
1007
967
|
launchContext: UltraPlanLaunchContextSchema,
|
|
1008
|
-
cursorSnapshot:
|
|
1009
|
-
observations:
|
|
1010
|
-
proofCandidates:
|
|
1011
|
-
blockerCandidates:
|
|
1012
|
-
outcome:
|
|
1013
|
-
startedAt:
|
|
1014
|
-
finalizedAt:
|
|
968
|
+
cursorSnapshot: UltraPlanCursorSchema.nullable(),
|
|
969
|
+
observations: z.array(UltraPlanHookObservationSchema),
|
|
970
|
+
proofCandidates: z.array(UltraPlanProofCandidateSchema),
|
|
971
|
+
blockerCandidates: z.array(UltraPlanBlockerCandidateSchema),
|
|
972
|
+
outcome: literalUnion(ULTRAPLAN_ATTEMPT_OUTCOMES).nullable(),
|
|
973
|
+
startedAt: z.string().min(1),
|
|
974
|
+
finalizedAt: z.string().min(1).nullable(),
|
|
1015
975
|
},
|
|
1016
|
-
|
|
1017
|
-
);
|
|
976
|
+
).strict();
|
|
1018
977
|
|
|
1019
|
-
export const UltraPlanScenarioStatusUpdateSchema =
|
|
978
|
+
export const UltraPlanScenarioStatusUpdateSchema = z.object(
|
|
1020
979
|
{
|
|
1021
980
|
stack: literalUnion(ULTRAPLAN_STACKS),
|
|
1022
|
-
domainId:
|
|
981
|
+
domainId: z.string().min(1),
|
|
1023
982
|
level: literalUnion(ULTRAPLAN_LEVELS),
|
|
1024
|
-
scenarioId:
|
|
983
|
+
scenarioId: z.string().min(1),
|
|
1025
984
|
nextStatus: literalUnion(ULTRAPLAN_SCENARIO_STATUSES),
|
|
1026
|
-
appendProof:
|
|
985
|
+
appendProof: UltraPlanProofSchema.optional(),
|
|
1027
986
|
},
|
|
1028
|
-
|
|
1029
|
-
);
|
|
987
|
+
).strict();
|
|
1030
988
|
|
|
1031
|
-
export const UltraPlanReviewStatusUpdateSchema =
|
|
989
|
+
export const UltraPlanReviewStatusUpdateSchema = z.object(
|
|
1032
990
|
{
|
|
1033
991
|
type: literalUnion(["domain", "stack"] as const),
|
|
1034
992
|
stack: literalUnion(ULTRAPLAN_STACKS),
|
|
1035
|
-
domainId:
|
|
993
|
+
domainId: z.string().min(1).nullable(),
|
|
1036
994
|
nextStatus: literalUnion(ULTRAPLAN_REVIEW_STATUSES),
|
|
1037
|
-
artifactRef:
|
|
995
|
+
artifactRef: z.string().min(1).nullable(),
|
|
1038
996
|
},
|
|
1039
|
-
|
|
1040
|
-
);
|
|
997
|
+
).strict();
|
|
1041
998
|
|
|
1042
|
-
export const UltraPlanBlockerUpdateSchema =
|
|
999
|
+
export const UltraPlanBlockerUpdateSchema = z.object(
|
|
1043
1000
|
{
|
|
1044
1001
|
scope: literalUnion(ULTRAPLAN_BLOCKER_SCOPES),
|
|
1045
|
-
nextValue:
|
|
1046
|
-
clearedByObservationFingerprint:
|
|
1002
|
+
nextValue: UltraPlanBlockerSchema.nullable(),
|
|
1003
|
+
clearedByObservationFingerprint: z.string().min(1).nullable(),
|
|
1047
1004
|
},
|
|
1048
|
-
|
|
1049
|
-
);
|
|
1005
|
+
).strict();
|
|
1050
1006
|
|
|
1051
|
-
export const UltraPlanRepairActionSchema =
|
|
1052
|
-
|
|
1007
|
+
export const UltraPlanRepairActionSchema = z.union([
|
|
1008
|
+
z.object(
|
|
1053
1009
|
{
|
|
1054
|
-
op:
|
|
1055
|
-
reason:
|
|
1010
|
+
op: z.literal("recompute-cursor"),
|
|
1011
|
+
reason: z.string().min(1),
|
|
1056
1012
|
},
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
Type.Object(
|
|
1013
|
+
).strict(),
|
|
1014
|
+
z.object(
|
|
1060
1015
|
{
|
|
1061
|
-
op:
|
|
1062
|
-
reason:
|
|
1016
|
+
op: z.literal("recompute-progress"),
|
|
1017
|
+
reason: z.string().min(1),
|
|
1063
1018
|
},
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
Type.Object(
|
|
1019
|
+
).strict(),
|
|
1020
|
+
z.object(
|
|
1067
1021
|
{
|
|
1068
|
-
op:
|
|
1069
|
-
reason:
|
|
1022
|
+
op: z.literal("clear-active-attempt"),
|
|
1023
|
+
reason: z.string().min(1),
|
|
1070
1024
|
},
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
Type.Object(
|
|
1025
|
+
).strict(),
|
|
1026
|
+
z.object(
|
|
1074
1027
|
{
|
|
1075
|
-
op:
|
|
1076
|
-
attemptId:
|
|
1077
|
-
reason:
|
|
1028
|
+
op: z.literal("convert-active-to-interrupted"),
|
|
1029
|
+
attemptId: z.string().min(1),
|
|
1030
|
+
reason: z.string().min(1),
|
|
1078
1031
|
},
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
Type.Object(
|
|
1032
|
+
).strict(),
|
|
1033
|
+
z.object(
|
|
1082
1034
|
{
|
|
1083
|
-
op:
|
|
1035
|
+
op: z.literal("clear-blocker"),
|
|
1084
1036
|
scope: literalUnion(ULTRAPLAN_BLOCKER_SCOPES),
|
|
1085
|
-
clearedByObservationFingerprint:
|
|
1037
|
+
clearedByObservationFingerprint: z.string().min(1),
|
|
1086
1038
|
},
|
|
1087
|
-
|
|
1088
|
-
),
|
|
1039
|
+
).strict(),
|
|
1089
1040
|
]);
|
|
1090
1041
|
|
|
1091
|
-
export const UltraPlanTrackerAttemptFinalizationSchema =
|
|
1042
|
+
export const UltraPlanTrackerAttemptFinalizationSchema = z.object(
|
|
1092
1043
|
{
|
|
1093
|
-
attemptId:
|
|
1044
|
+
attemptId: z.string().min(1),
|
|
1094
1045
|
outcome: literalUnion(ULTRAPLAN_ATTEMPT_OUTCOMES),
|
|
1095
|
-
finalizedAt:
|
|
1046
|
+
finalizedAt: z.string().min(1),
|
|
1096
1047
|
},
|
|
1097
|
-
|
|
1098
|
-
);
|
|
1048
|
+
).strict();
|
|
1099
1049
|
|
|
1100
|
-
export const UltraPlanMutationPlanSchema =
|
|
1050
|
+
export const UltraPlanMutationPlanSchema = z.object(
|
|
1101
1051
|
{
|
|
1102
1052
|
kind: literalUnion(ULTRAPLAN_MUTATION_KINDS),
|
|
1103
|
-
rationale:
|
|
1104
|
-
appendObservationFingerprint:
|
|
1105
|
-
scenarioStatusUpdate:
|
|
1106
|
-
reviewStatusUpdate:
|
|
1107
|
-
blockerUpdate:
|
|
1108
|
-
cursorUpdate:
|
|
1109
|
-
sessionStateUpdate:
|
|
1110
|
-
trackerAttemptFinalization:
|
|
1111
|
-
recomputeProgress:
|
|
1112
|
-
repairActions:
|
|
1113
|
-
notes:
|
|
1053
|
+
rationale: z.string().min(1),
|
|
1054
|
+
appendObservationFingerprint: z.string().min(1).nullable(),
|
|
1055
|
+
scenarioStatusUpdate: UltraPlanScenarioStatusUpdateSchema.nullable(),
|
|
1056
|
+
reviewStatusUpdate: UltraPlanReviewStatusUpdateSchema.nullable(),
|
|
1057
|
+
blockerUpdate: UltraPlanBlockerUpdateSchema.nullable(),
|
|
1058
|
+
cursorUpdate: UltraPlanCursorSchema.nullable(),
|
|
1059
|
+
sessionStateUpdate: literalUnion(ULTRAPLAN_SESSION_STATES).nullable(),
|
|
1060
|
+
trackerAttemptFinalization: UltraPlanTrackerAttemptFinalizationSchema.nullable(),
|
|
1061
|
+
recomputeProgress: z.boolean(),
|
|
1062
|
+
repairActions: z.array(UltraPlanRepairActionSchema),
|
|
1063
|
+
notes: z.array(z.string()),
|
|
1114
1064
|
},
|
|
1115
|
-
|
|
1116
|
-
);
|
|
1065
|
+
).strict();
|
|
1117
1066
|
|
|
1118
|
-
export const UltraPlanPendingMutationSchema =
|
|
1067
|
+
export const UltraPlanPendingMutationSchema = z.object(
|
|
1119
1068
|
{
|
|
1120
|
-
attemptId:
|
|
1069
|
+
attemptId: z.string().min(1),
|
|
1121
1070
|
mutationPlan: UltraPlanMutationPlanSchema,
|
|
1122
|
-
expectedManifestFingerprint:
|
|
1123
|
-
stagedAt:
|
|
1071
|
+
expectedManifestFingerprint: z.string().min(1),
|
|
1072
|
+
stagedAt: z.string().min(1),
|
|
1124
1073
|
},
|
|
1125
|
-
|
|
1126
|
-
);
|
|
1074
|
+
).strict();
|
|
1127
1075
|
|
|
1128
|
-
export const UltraPlanRuntimeTrackerSchema =
|
|
1076
|
+
export const UltraPlanRuntimeTrackerSchema = z.object(
|
|
1129
1077
|
{
|
|
1130
|
-
version:
|
|
1131
|
-
sessionId:
|
|
1132
|
-
activeAttempt:
|
|
1133
|
-
finalizedAttempts:
|
|
1134
|
-
appliedFingerprints:
|
|
1135
|
-
pendingMutation:
|
|
1136
|
-
updatedAt:
|
|
1078
|
+
version: z.literal(1),
|
|
1079
|
+
sessionId: z.string().min(1),
|
|
1080
|
+
activeAttempt: UltraPlanAttemptRecordSchema.nullable(),
|
|
1081
|
+
finalizedAttempts: z.array(UltraPlanAttemptRecordSchema),
|
|
1082
|
+
appliedFingerprints: z.array(z.string().min(1)),
|
|
1083
|
+
pendingMutation: UltraPlanPendingMutationSchema.nullable(),
|
|
1084
|
+
updatedAt: z.string().min(1),
|
|
1137
1085
|
},
|
|
1138
|
-
|
|
1139
|
-
);
|
|
1086
|
+
).strict();
|
|
1140
1087
|
|
|
1141
|
-
export const UltraPlanRepairDetailsSchema =
|
|
1088
|
+
export const UltraPlanRepairDetailsSchema = z.object(
|
|
1142
1089
|
{
|
|
1143
|
-
reason:
|
|
1144
|
-
actions:
|
|
1090
|
+
reason: z.string().min(1),
|
|
1091
|
+
actions: z.array(UltraPlanRepairActionSchema),
|
|
1145
1092
|
},
|
|
1146
|
-
|
|
1147
|
-
);
|
|
1093
|
+
).strict();
|
|
1148
1094
|
|
|
1149
|
-
export const UltraPlanReducerActionSchema =
|
|
1150
|
-
|
|
1095
|
+
export const UltraPlanReducerActionSchema = z.union([
|
|
1096
|
+
z.object(
|
|
1151
1097
|
{
|
|
1152
|
-
kind:
|
|
1098
|
+
kind: z.literal("session_started"),
|
|
1153
1099
|
observation: UltraPlanHookObservationSchema,
|
|
1154
|
-
nowIso:
|
|
1100
|
+
nowIso: z.string().min(1),
|
|
1155
1101
|
},
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
Type.Object(
|
|
1102
|
+
).strict(),
|
|
1103
|
+
z.object(
|
|
1159
1104
|
{
|
|
1160
|
-
kind:
|
|
1105
|
+
kind: z.literal("attempt_started"),
|
|
1161
1106
|
observation: UltraPlanHookObservationSchema,
|
|
1162
1107
|
launchContext: UltraPlanLaunchContextSchema,
|
|
1163
1108
|
},
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
Type.Object(
|
|
1109
|
+
).strict(),
|
|
1110
|
+
z.object(
|
|
1167
1111
|
{
|
|
1168
|
-
kind:
|
|
1112
|
+
kind: z.literal("observation_staged"),
|
|
1169
1113
|
observation: UltraPlanHookObservationSchema,
|
|
1170
1114
|
},
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
Type.Object(
|
|
1115
|
+
).strict(),
|
|
1116
|
+
z.object(
|
|
1174
1117
|
{
|
|
1175
|
-
kind:
|
|
1118
|
+
kind: z.literal("attempt_finalized"),
|
|
1176
1119
|
observation: UltraPlanHookObservationSchema,
|
|
1177
|
-
nowIso:
|
|
1120
|
+
nowIso: z.string().min(1),
|
|
1178
1121
|
},
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
Type.Object(
|
|
1122
|
+
).strict(),
|
|
1123
|
+
z.object(
|
|
1182
1124
|
{
|
|
1183
|
-
kind:
|
|
1125
|
+
kind: z.literal("session_shutdown"),
|
|
1184
1126
|
observation: UltraPlanHookObservationSchema,
|
|
1185
|
-
nowIso:
|
|
1127
|
+
nowIso: z.string().min(1),
|
|
1186
1128
|
},
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
Type.Object(
|
|
1129
|
+
).strict(),
|
|
1130
|
+
z.object(
|
|
1190
1131
|
{
|
|
1191
|
-
kind:
|
|
1192
|
-
nowIso:
|
|
1132
|
+
kind: z.literal("repair_applied"),
|
|
1133
|
+
nowIso: z.string().min(1),
|
|
1193
1134
|
details: UltraPlanRepairDetailsSchema,
|
|
1194
1135
|
},
|
|
1195
|
-
|
|
1196
|
-
),
|
|
1136
|
+
).strict(),
|
|
1197
1137
|
]);
|
|
1198
1138
|
|
|
1199
|
-
export const UltraPlanSessionMigrationRecordSchema =
|
|
1139
|
+
export const UltraPlanSessionMigrationRecordSchema = z.object(
|
|
1200
1140
|
{
|
|
1201
|
-
migratedAt:
|
|
1202
|
-
legacyPath:
|
|
1203
|
-
fingerprintBefore:
|
|
1204
|
-
fingerprintAfter:
|
|
1205
|
-
legacyRenamedTo:
|
|
1141
|
+
migratedAt: z.string().min(1),
|
|
1142
|
+
legacyPath: z.string().min(1),
|
|
1143
|
+
fingerprintBefore: z.string().min(1),
|
|
1144
|
+
fingerprintAfter: z.string().min(1),
|
|
1145
|
+
legacyRenamedTo: z.string().min(1).nullable(),
|
|
1206
1146
|
kind: literalUnion(ULTRAPLAN_MIGRATION_KINDS),
|
|
1207
1147
|
},
|
|
1208
|
-
|
|
1209
|
-
);
|
|
1148
|
+
).strict();
|
|
1210
1149
|
|
|
1211
1150
|
// ---------------------------------------------------------------------------
|
|
1212
1151
|
// Semantic validators for contracts that express invariants above schema.
|
|
@@ -1359,33 +1298,33 @@ export function validateUltraPlanSessionMigrationRecord(value: unknown) {
|
|
|
1359
1298
|
}
|
|
1360
1299
|
|
|
1361
1300
|
export function isUltraPlanLaunchContext(value: unknown): value is UltraPlanLaunchContext {
|
|
1362
|
-
return
|
|
1301
|
+
return checkSchema(UltraPlanLaunchContextSchema, value);
|
|
1363
1302
|
}
|
|
1364
1303
|
|
|
1365
1304
|
export function isUltraPlanHookObservation(value: unknown): value is UltraPlanHookObservation {
|
|
1366
|
-
return
|
|
1305
|
+
return checkSchema(UltraPlanHookObservationSchema, value);
|
|
1367
1306
|
}
|
|
1368
1307
|
|
|
1369
1308
|
export function isUltraPlanProofCandidate(value: unknown): value is UltraPlanProofCandidate {
|
|
1370
|
-
return
|
|
1309
|
+
return checkSchema(UltraPlanProofCandidateSchema, value);
|
|
1371
1310
|
}
|
|
1372
1311
|
|
|
1373
1312
|
export function isUltraPlanBlockerCandidate(value: unknown): value is UltraPlanBlockerCandidate {
|
|
1374
|
-
return
|
|
1313
|
+
return checkSchema(UltraPlanBlockerCandidateSchema, value);
|
|
1375
1314
|
}
|
|
1376
1315
|
|
|
1377
1316
|
export function isUltraPlanAttemptRecord(value: unknown): value is UltraPlanAttemptRecord {
|
|
1378
|
-
if (!
|
|
1317
|
+
if (!checkSchema(UltraPlanAttemptRecordSchema, value)) return false;
|
|
1379
1318
|
return getUltraPlanAttemptRecordSemanticErrors(value as UltraPlanAttemptRecord).length === 0;
|
|
1380
1319
|
}
|
|
1381
1320
|
|
|
1382
1321
|
export function isUltraPlanMutationPlan(value: unknown): value is UltraPlanMutationPlan {
|
|
1383
|
-
if (!
|
|
1322
|
+
if (!checkSchema(UltraPlanMutationPlanSchema, value)) return false;
|
|
1384
1323
|
return getUltraPlanMutationPlanSemanticErrors(value as UltraPlanMutationPlan).length === 0;
|
|
1385
1324
|
}
|
|
1386
1325
|
|
|
1387
1326
|
export function isUltraPlanPendingMutation(value: unknown): value is UltraPlanPendingMutation {
|
|
1388
|
-
return
|
|
1327
|
+
return checkSchema(UltraPlanPendingMutationSchema, value);
|
|
1389
1328
|
}
|
|
1390
1329
|
|
|
1391
1330
|
export function isUltraPlanRuntimeTracker(value: unknown): value is UltraPlanRuntimeTracker {
|
|
@@ -1393,7 +1332,7 @@ export function isUltraPlanRuntimeTracker(value: unknown): value is UltraPlanRun
|
|
|
1393
1332
|
}
|
|
1394
1333
|
|
|
1395
1334
|
export function isUltraPlanReducerAction(value: unknown): value is UltraPlanReducerAction {
|
|
1396
|
-
return
|
|
1335
|
+
return checkSchema(UltraPlanReducerActionSchema, value);
|
|
1397
1336
|
}
|
|
1398
1337
|
|
|
1399
1338
|
export function isUltraPlanSessionMigrationRecord(value: unknown): value is UltraPlanSessionMigrationRecord {
|
|
@@ -1401,7 +1340,7 @@ export function isUltraPlanSessionMigrationRecord(value: unknown): value is Ultr
|
|
|
1401
1340
|
}
|
|
1402
1341
|
|
|
1403
1342
|
export function isUltraPlanRepairAction(value: unknown): value is UltraPlanRepairAction {
|
|
1404
|
-
return
|
|
1343
|
+
return checkSchema(UltraPlanRepairActionSchema, value);
|
|
1405
1344
|
}
|
|
1406
1345
|
|
|
1407
1346
|
|
|
@@ -1444,75 +1383,70 @@ export const ULTRAPLAN_BATCH_JOURNAL_EVENT_TYPES = [
|
|
|
1444
1383
|
"cleanup-warning",
|
|
1445
1384
|
] as const;
|
|
1446
1385
|
|
|
1447
|
-
export const UltraPlanBatchWaveSchema =
|
|
1386
|
+
export const UltraPlanBatchWaveSchema = z.object(
|
|
1448
1387
|
{
|
|
1449
|
-
waveIndex:
|
|
1450
|
-
sessionIds:
|
|
1388
|
+
waveIndex: z.number().min(0),
|
|
1389
|
+
sessionIds: z.array(z.string().min(1)),
|
|
1451
1390
|
},
|
|
1452
|
-
|
|
1453
|
-
);
|
|
1391
|
+
).strict();
|
|
1454
1392
|
|
|
1455
|
-
export const UltraPlanBatchNodeSchema =
|
|
1393
|
+
export const UltraPlanBatchNodeSchema = z.object(
|
|
1456
1394
|
{
|
|
1457
|
-
nodeId:
|
|
1458
|
-
sessionId:
|
|
1459
|
-
title:
|
|
1460
|
-
waveIndex:
|
|
1461
|
-
dependencies:
|
|
1395
|
+
nodeId: z.string().min(1),
|
|
1396
|
+
sessionId: z.string().min(1),
|
|
1397
|
+
title: z.string().min(1),
|
|
1398
|
+
waveIndex: z.number().min(0),
|
|
1399
|
+
dependencies: z.array(z.string().min(1)),
|
|
1462
1400
|
state: literalUnion(ULTRAPLAN_BATCH_NODE_STATES),
|
|
1463
|
-
blockerKind:
|
|
1464
|
-
blockerSummary:
|
|
1465
|
-
resumeRequestedAt:
|
|
1466
|
-
branchName:
|
|
1467
|
-
worktreePath:
|
|
1468
|
-
updatedAt:
|
|
1401
|
+
blockerKind: literalUnion(ULTRAPLAN_BATCH_NODE_BLOCKER_KINDS).nullable(),
|
|
1402
|
+
blockerSummary: z.string().min(1).nullable(),
|
|
1403
|
+
resumeRequestedAt: z.string().min(1).nullable(),
|
|
1404
|
+
branchName: z.string().min(1).nullable(),
|
|
1405
|
+
worktreePath: z.string().min(1).nullable(),
|
|
1406
|
+
updatedAt: z.string().min(1),
|
|
1469
1407
|
},
|
|
1470
|
-
|
|
1471
|
-
);
|
|
1408
|
+
).strict();
|
|
1472
1409
|
|
|
1473
|
-
export const UltraPlanBatchRunSchema =
|
|
1410
|
+
export const UltraPlanBatchRunSchema = z.object(
|
|
1474
1411
|
{
|
|
1475
|
-
runId:
|
|
1476
|
-
projectRoot:
|
|
1477
|
-
baseBranch:
|
|
1478
|
-
baseHead:
|
|
1479
|
-
currentBaseHead:
|
|
1480
|
-
createdAt:
|
|
1481
|
-
updatedAt:
|
|
1412
|
+
runId: z.string().min(1),
|
|
1413
|
+
projectRoot: z.string().min(1),
|
|
1414
|
+
baseBranch: z.string().min(1),
|
|
1415
|
+
baseHead: z.string().min(1),
|
|
1416
|
+
currentBaseHead: z.string().min(1),
|
|
1417
|
+
createdAt: z.string().min(1),
|
|
1418
|
+
updatedAt: z.string().min(1),
|
|
1482
1419
|
state: literalUnion(ULTRAPLAN_BATCH_RUN_STATES),
|
|
1483
|
-
maxParallelism:
|
|
1484
|
-
batchBlockerCode:
|
|
1485
|
-
batchBlockerSummary:
|
|
1486
|
-
batchResumeRequestedAt:
|
|
1487
|
-
supervisorWorktreePath:
|
|
1488
|
-
waves:
|
|
1489
|
-
nodes:
|
|
1420
|
+
maxParallelism: z.number().min(1),
|
|
1421
|
+
batchBlockerCode: literalUnion(ULTRAPLAN_BATCH_BLOCKER_CODES).nullable(),
|
|
1422
|
+
batchBlockerSummary: z.string().min(1).nullable(),
|
|
1423
|
+
batchResumeRequestedAt: z.string().min(1).nullable(),
|
|
1424
|
+
supervisorWorktreePath: z.string().min(1).nullable(),
|
|
1425
|
+
waves: z.array(UltraPlanBatchWaveSchema),
|
|
1426
|
+
nodes: z.array(UltraPlanBatchNodeSchema),
|
|
1490
1427
|
},
|
|
1491
|
-
|
|
1492
|
-
);
|
|
1428
|
+
).strict();
|
|
1493
1429
|
|
|
1494
|
-
export const UltraPlanBatchActiveRunLeaseSchema =
|
|
1430
|
+
export const UltraPlanBatchActiveRunLeaseSchema = z.object(
|
|
1495
1431
|
{
|
|
1496
|
-
runId:
|
|
1497
|
-
ownerSessionId:
|
|
1498
|
-
leaseAcquiredAt:
|
|
1499
|
-
leaseExpiresAt:
|
|
1500
|
-
updatedAt:
|
|
1432
|
+
runId: z.string().min(1),
|
|
1433
|
+
ownerSessionId: z.string().min(1).nullable(),
|
|
1434
|
+
leaseAcquiredAt: z.string().min(1).nullable(),
|
|
1435
|
+
leaseExpiresAt: z.string().min(1).nullable(),
|
|
1436
|
+
updatedAt: z.string().min(1),
|
|
1501
1437
|
},
|
|
1502
|
-
|
|
1503
|
-
);
|
|
1438
|
+
).strict();
|
|
1504
1439
|
|
|
1505
|
-
export const UltraPlanBatchJournalEventSchema =
|
|
1440
|
+
export const UltraPlanBatchJournalEventSchema = z.object(
|
|
1506
1441
|
{
|
|
1507
|
-
runId:
|
|
1508
|
-
sessionId:
|
|
1442
|
+
runId: z.string().min(1),
|
|
1443
|
+
sessionId: z.string().min(1).nullable(),
|
|
1509
1444
|
type: literalUnion(ULTRAPLAN_BATCH_JOURNAL_EVENT_TYPES),
|
|
1510
|
-
recordedAt:
|
|
1511
|
-
summary:
|
|
1512
|
-
details:
|
|
1445
|
+
recordedAt: z.string().min(1),
|
|
1446
|
+
summary: z.string().min(1),
|
|
1447
|
+
details: z.record(z.string(), z.unknown()).optional(),
|
|
1513
1448
|
},
|
|
1514
|
-
|
|
1515
|
-
);
|
|
1449
|
+
).strict();
|
|
1516
1450
|
|
|
1517
1451
|
function parseBatchLeaseTimestamp(errors: string[], fieldName: string, value: string | null): number | null {
|
|
1518
1452
|
if (value === null) {
|
|
@@ -1573,11 +1507,11 @@ export function validateUltraPlanBatchActiveRunLease(value: unknown) {
|
|
|
1573
1507
|
}
|
|
1574
1508
|
|
|
1575
1509
|
export function isUltraPlanBatchWave(value: unknown): value is UltraPlanBatchWave {
|
|
1576
|
-
return
|
|
1510
|
+
return checkSchema(UltraPlanBatchWaveSchema, value);
|
|
1577
1511
|
}
|
|
1578
1512
|
|
|
1579
1513
|
export function isUltraPlanBatchNode(value: unknown): value is UltraPlanBatchNode {
|
|
1580
|
-
return
|
|
1514
|
+
return checkSchema(UltraPlanBatchNodeSchema, value);
|
|
1581
1515
|
}
|
|
1582
1516
|
|
|
1583
1517
|
export function isUltraPlanBatchRun(value: unknown): value is UltraPlanBatchRun {
|
|
@@ -1589,5 +1523,5 @@ export function isUltraPlanBatchActiveRunLease(value: unknown): value is UltraPl
|
|
|
1589
1523
|
}
|
|
1590
1524
|
|
|
1591
1525
|
export function isUltraPlanBatchJournalEvent(value: unknown): value is UltraPlanBatchJournalEvent {
|
|
1592
|
-
return
|
|
1593
|
-
}
|
|
1526
|
+
return checkSchema(UltraPlanBatchJournalEventSchema, value);
|
|
1527
|
+
}
|