@exaudeus/workrail 1.5.0 → 1.5.2
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/dist/application/services/workflow-compiler.js +14 -2
- package/dist/infrastructure/session/HttpServer.js +7 -2
- package/dist/infrastructure/session/SessionManager.d.ts +12 -4
- package/dist/infrastructure/session/SessionManager.js +30 -15
- package/dist/manifest.json +417 -217
- package/dist/mcp/error-mapper.d.ts +1 -1
- package/dist/mcp/error-mapper.js +12 -8
- package/dist/mcp/handler-factory.js +8 -1
- package/dist/mcp/handlers/session.js +36 -58
- package/dist/mcp/handlers/v2-advance-core/event-builders.d.ts +37 -0
- package/dist/mcp/handlers/v2-advance-core/event-builders.js +114 -0
- package/dist/mcp/handlers/v2-advance-core/index.d.ts +67 -0
- package/dist/mcp/handlers/v2-advance-core/index.js +119 -0
- package/dist/mcp/handlers/v2-advance-core/input-validation.d.ts +44 -0
- package/dist/mcp/handlers/v2-advance-core/input-validation.js +58 -0
- package/dist/mcp/handlers/v2-advance-core/outcome-blocked.d.ts +16 -0
- package/dist/mcp/handlers/v2-advance-core/outcome-blocked.js +64 -0
- package/dist/mcp/handlers/v2-advance-core/outcome-success.d.ts +15 -0
- package/dist/mcp/handlers/v2-advance-core/outcome-success.js +136 -0
- package/dist/mcp/handlers/v2-advance-core.d.ts +3 -45
- package/dist/mcp/handlers/v2-advance-core.js +3 -431
- package/dist/mcp/handlers/v2-advance-events.d.ts +61 -0
- package/dist/mcp/handlers/v2-advance-events.js +126 -0
- package/dist/mcp/handlers/v2-checkpoint.js +11 -14
- package/dist/mcp/handlers/v2-context-budget.js +2 -2
- package/dist/mcp/handlers/v2-error-mapping.d.ts +3 -3
- package/dist/mcp/handlers/v2-error-mapping.js +31 -27
- package/dist/mcp/handlers/v2-execution/advance.d.ts +32 -0
- package/dist/mcp/handlers/v2-execution/advance.js +50 -0
- package/dist/mcp/handlers/v2-execution/continue-advance.d.ts +29 -0
- package/dist/mcp/handlers/v2-execution/continue-advance.js +167 -0
- package/dist/mcp/handlers/v2-execution/continue-rehydrate.d.ts +22 -0
- package/dist/mcp/handlers/v2-execution/continue-rehydrate.js +145 -0
- package/dist/mcp/handlers/v2-execution/index.d.ts +31 -0
- package/dist/mcp/handlers/v2-execution/index.js +102 -0
- package/dist/mcp/handlers/v2-execution/replay.d.ts +55 -0
- package/dist/mcp/handlers/v2-execution/replay.js +225 -0
- package/dist/mcp/handlers/v2-execution/start.d.ts +52 -0
- package/dist/mcp/handlers/v2-execution/start.js +331 -0
- package/dist/mcp/handlers/v2-execution-helpers.d.ts +26 -2
- package/dist/mcp/handlers/v2-execution-helpers.js +76 -60
- package/dist/mcp/handlers/v2-execution.d.ts +1 -23
- package/dist/mcp/handlers/v2-execution.js +5 -898
- package/dist/mcp/handlers/v2-state-conversion.d.ts +0 -5
- package/dist/mcp/handlers/v2-state-conversion.js +2 -21
- package/dist/mcp/handlers/v2-token-ops.d.ts +1 -1
- package/dist/mcp/handlers/v2-workflow.js +85 -78
- package/dist/mcp/output-schemas.d.ts +197 -34
- package/dist/mcp/output-schemas.js +12 -5
- package/dist/mcp/tool-descriptions.js +22 -16
- package/dist/mcp/types.d.ts +10 -0
- package/dist/mcp/types.js +10 -0
- package/dist/mcp/v2/tools.d.ts +45 -7
- package/dist/mcp/v2/tools.js +7 -3
- package/dist/types/workflow-definition.d.ts +3 -2
- package/dist/v2/durable-core/canonical/jcs.js +8 -1
- package/dist/v2/durable-core/constants.d.ts +60 -0
- package/dist/v2/durable-core/constants.js +55 -1
- package/dist/v2/durable-core/domain/ack-advance-append-plan.d.ts +14 -13
- package/dist/v2/durable-core/domain/ack-advance-append-plan.js +143 -116
- package/dist/v2/durable-core/domain/blocked-node-builder.js +9 -3
- package/dist/v2/durable-core/domain/blocking-decision.d.ts +2 -0
- package/dist/v2/durable-core/domain/blocking-decision.js +29 -12
- package/dist/v2/durable-core/domain/bundle-builder.d.ts +1 -0
- package/dist/v2/durable-core/domain/bundle-builder.js +1 -1
- package/dist/v2/durable-core/domain/bundle-validator.js +3 -2
- package/dist/v2/durable-core/domain/decision-trace-builder.js +7 -9
- package/dist/v2/durable-core/domain/function-definition-expander.js +1 -3
- package/dist/v2/durable-core/domain/gap-builder.js +2 -1
- package/dist/v2/durable-core/domain/observation-builder.js +2 -1
- package/dist/v2/durable-core/domain/outputs.d.ts +2 -1
- package/dist/v2/durable-core/domain/outputs.js +3 -2
- package/dist/v2/durable-core/domain/reason-model.d.ts +1 -1
- package/dist/v2/durable-core/domain/reason-model.js +4 -9
- package/dist/v2/durable-core/domain/validation-criteria-validator.js +2 -2
- package/dist/v2/durable-core/domain/validation-event-builder.js +4 -6
- package/dist/v2/durable-core/domain/validation-loader.js +2 -1
- package/dist/v2/durable-core/domain/validation-requirements-extractor.js +12 -18
- package/dist/v2/durable-core/encoding/base32-lower.d.ts +13 -1
- package/dist/v2/durable-core/encoding/base32-lower.js +13 -3
- package/dist/v2/durable-core/encoding/hex-to-bytes.d.ts +6 -0
- package/dist/v2/durable-core/encoding/hex-to-bytes.js +19 -0
- package/dist/v2/durable-core/ids/attempt-id-derivation.d.ts +6 -1
- package/dist/v2/durable-core/ids/attempt-id-derivation.js +9 -19
- package/dist/v2/durable-core/ids/event-ids.d.ts +9 -0
- package/dist/v2/durable-core/ids/event-ids.js +18 -0
- package/dist/v2/durable-core/ids/index.d.ts +13 -33
- package/dist/v2/durable-core/ids/index.js +22 -63
- package/dist/v2/durable-core/ids/session-ids.d.ts +9 -0
- package/dist/v2/durable-core/ids/session-ids.js +18 -0
- package/dist/v2/durable-core/ids/snapshot-ids.d.ts +6 -0
- package/dist/v2/durable-core/ids/snapshot-ids.js +10 -0
- package/dist/v2/durable-core/ids/token-ids.d.ts +3 -0
- package/dist/v2/durable-core/ids/token-ids.js +6 -0
- package/dist/v2/durable-core/ids/workflow-hash-ref.d.ts +3 -0
- package/dist/v2/durable-core/ids/workflow-hash-ref.js +5 -4
- package/dist/v2/durable-core/ids/workflow-ids.d.ts +11 -0
- package/dist/v2/durable-core/ids/workflow-ids.js +21 -0
- package/dist/v2/durable-core/lib/utf8-byte-length.d.ts +1 -0
- package/dist/v2/durable-core/lib/utf8-byte-length.js +6 -0
- package/dist/v2/durable-core/schemas/artifacts/loop-control.d.ts +6 -6
- package/dist/v2/durable-core/schemas/artifacts/loop-control.js +2 -1
- package/dist/v2/durable-core/schemas/execution-snapshot/blocked-snapshot.d.ts +28 -28
- package/dist/v2/durable-core/schemas/execution-snapshot/blocked-snapshot.js +5 -7
- package/dist/v2/durable-core/schemas/execution-snapshot/execution-snapshot.v1.d.ts +296 -296
- package/dist/v2/durable-core/schemas/export-bundle/index.d.ts +466 -471
- package/dist/v2/durable-core/schemas/export-bundle/index.js +0 -8
- package/dist/v2/durable-core/schemas/lib/dedupe-key.d.ts +9 -1
- package/dist/v2/durable-core/schemas/lib/dedupe-key.js +4 -3
- package/dist/v2/durable-core/schemas/lib/utf8-byte-length.d.ts +1 -0
- package/dist/v2/durable-core/schemas/lib/utf8-byte-length.js +6 -0
- package/dist/v2/durable-core/schemas/session/blockers.d.ts +305 -0
- package/dist/v2/durable-core/schemas/session/blockers.js +80 -0
- package/dist/v2/durable-core/schemas/session/dag-topology.d.ts +77 -0
- package/dist/v2/durable-core/schemas/session/dag-topology.js +45 -0
- package/dist/v2/durable-core/schemas/session/events.d.ts +56 -56
- package/dist/v2/durable-core/schemas/session/events.js +11 -182
- package/dist/v2/durable-core/schemas/session/gaps.d.ts +211 -0
- package/dist/v2/durable-core/schemas/session/gaps.js +37 -0
- package/dist/v2/durable-core/schemas/session/outputs.d.ts +148 -0
- package/dist/v2/durable-core/schemas/session/outputs.js +44 -0
- package/dist/v2/durable-core/schemas/session/validation-event.js +5 -7
- package/dist/v2/durable-core/tokens/token-codec.d.ts +1 -18
- package/dist/v2/durable-core/tokens/token-codec.js +0 -67
- package/dist/v2/durable-core/tokens/token-signer.d.ts +1 -8
- package/dist/v2/durable-core/tokens/token-signer.js +0 -43
- package/dist/v2/infra/local/base32/index.js +1 -23
- package/dist/v2/infra/local/bech32m/index.js +1 -1
- package/dist/v2/infra/local/data-dir/index.d.ts +7 -6
- package/dist/v2/infra/local/data-dir/index.js +3 -3
- package/dist/v2/infra/local/directory-listing/index.d.ts +2 -2
- package/dist/v2/infra/local/session-store/index.js +198 -182
- package/dist/v2/infra/local/session-summary-provider/index.js +5 -2
- package/dist/v2/infra/local/snapshot-store/index.js +2 -2
- package/dist/v2/ports/data-dir.port.d.ts +7 -6
- package/dist/v2/ports/fs.port.d.ts +18 -7
- package/dist/v2/ports/session-event-log-store.port.d.ts +5 -2
- package/dist/v2/projections/advance-outcomes.d.ts +1 -7
- package/dist/v2/projections/advance-outcomes.js +2 -1
- package/dist/v2/projections/artifacts.js +3 -2
- package/dist/v2/projections/capabilities.d.ts +1 -7
- package/dist/v2/projections/capabilities.js +2 -1
- package/dist/v2/projections/gaps.d.ts +1 -7
- package/dist/v2/projections/gaps.js +2 -1
- package/dist/v2/projections/node-outputs.d.ts +1 -7
- package/dist/v2/projections/node-outputs.js +4 -3
- package/dist/v2/projections/preferences.d.ts +1 -7
- package/dist/v2/projections/preferences.js +2 -1
- package/dist/v2/projections/projection-error.d.ts +7 -0
- package/dist/v2/projections/projection-error.js +2 -0
- package/dist/v2/projections/resume-ranking.js +3 -3
- package/dist/v2/projections/run-context.d.ts +1 -7
- package/dist/v2/projections/run-context.js +4 -2
- package/dist/v2/projections/run-dag.d.ts +9 -9
- package/dist/v2/projections/run-dag.js +88 -65
- package/dist/v2/projections/run-status-signals.d.ts +1 -7
- package/dist/v2/projections/run-status-signals.js +3 -2
- package/dist/v2/usecases/execution-session-gate.js +2 -5
- package/dist/v2/usecases/export-session.js +4 -2
- package/dist/v2/usecases/import-session.d.ts +3 -3
- package/package.json +1 -1
- package/workflows/coding-task-workflow-agentic.json +0 -9
- package/workflows/workflow-for-workflows.json +18 -5
|
@@ -284,23 +284,23 @@ export declare const DomainEventV1Schema: z.ZodDiscriminatedUnion<"kind", [z.Zod
|
|
|
284
284
|
snapshotRef: z.ZodEffects<z.ZodString, never, string>;
|
|
285
285
|
}, "strip", z.ZodTypeAny, {
|
|
286
286
|
snapshotRef: never;
|
|
287
|
-
|
|
288
|
-
nodeKind: "step" | "checkpoint" | "blocked_attempt";
|
|
287
|
+
nodeKind: "checkpoint" | "step" | "blocked_attempt";
|
|
289
288
|
parentNodeId: string | null;
|
|
289
|
+
workflowHash: never;
|
|
290
290
|
}, {
|
|
291
291
|
snapshotRef: string;
|
|
292
|
-
|
|
293
|
-
nodeKind: "step" | "checkpoint" | "blocked_attempt";
|
|
292
|
+
nodeKind: "checkpoint" | "step" | "blocked_attempt";
|
|
294
293
|
parentNodeId: string | null;
|
|
294
|
+
workflowHash: string;
|
|
295
295
|
}>;
|
|
296
296
|
}, "strip", z.ZodTypeAny, {
|
|
297
297
|
kind: "node_created";
|
|
298
298
|
sessionId: string;
|
|
299
299
|
data: {
|
|
300
300
|
snapshotRef: never;
|
|
301
|
-
|
|
302
|
-
nodeKind: "step" | "checkpoint" | "blocked_attempt";
|
|
301
|
+
nodeKind: "checkpoint" | "step" | "blocked_attempt";
|
|
303
302
|
parentNodeId: string | null;
|
|
303
|
+
workflowHash: never;
|
|
304
304
|
};
|
|
305
305
|
v: 1;
|
|
306
306
|
eventIndex: number;
|
|
@@ -315,9 +315,9 @@ export declare const DomainEventV1Schema: z.ZodDiscriminatedUnion<"kind", [z.Zod
|
|
|
315
315
|
sessionId: string;
|
|
316
316
|
data: {
|
|
317
317
|
snapshotRef: string;
|
|
318
|
-
|
|
319
|
-
nodeKind: "step" | "checkpoint" | "blocked_attempt";
|
|
318
|
+
nodeKind: "checkpoint" | "step" | "blocked_attempt";
|
|
320
319
|
parentNodeId: string | null;
|
|
320
|
+
workflowHash: string;
|
|
321
321
|
};
|
|
322
322
|
v: 1;
|
|
323
323
|
eventIndex: number;
|
|
@@ -350,42 +350,42 @@ export declare const DomainEventV1Schema: z.ZodDiscriminatedUnion<"kind", [z.Zod
|
|
|
350
350
|
kind: z.ZodEnum<["idempotent_replay", "intentional_fork", "non_tip_advance", "checkpoint_created"]>;
|
|
351
351
|
eventId: z.ZodString;
|
|
352
352
|
}, "strip", z.ZodTypeAny, {
|
|
353
|
-
kind: "
|
|
353
|
+
kind: "intentional_fork" | "non_tip_advance" | "idempotent_replay" | "checkpoint_created";
|
|
354
354
|
eventId: string;
|
|
355
355
|
}, {
|
|
356
|
-
kind: "
|
|
356
|
+
kind: "intentional_fork" | "non_tip_advance" | "idempotent_replay" | "checkpoint_created";
|
|
357
357
|
eventId: string;
|
|
358
358
|
}>;
|
|
359
359
|
}, "strip", z.ZodTypeAny, {
|
|
360
360
|
cause: {
|
|
361
|
-
kind: "
|
|
361
|
+
kind: "intentional_fork" | "non_tip_advance" | "idempotent_replay" | "checkpoint_created";
|
|
362
362
|
eventId: string;
|
|
363
363
|
};
|
|
364
|
-
edgeKind: "
|
|
364
|
+
edgeKind: "acked_step" | "checkpoint";
|
|
365
365
|
fromNodeId: string;
|
|
366
366
|
toNodeId: string;
|
|
367
367
|
}, {
|
|
368
368
|
cause: {
|
|
369
|
-
kind: "
|
|
369
|
+
kind: "intentional_fork" | "non_tip_advance" | "idempotent_replay" | "checkpoint_created";
|
|
370
370
|
eventId: string;
|
|
371
371
|
};
|
|
372
|
-
edgeKind: "
|
|
372
|
+
edgeKind: "acked_step" | "checkpoint";
|
|
373
373
|
fromNodeId: string;
|
|
374
374
|
toNodeId: string;
|
|
375
375
|
}>, {
|
|
376
376
|
cause: {
|
|
377
|
-
kind: "
|
|
377
|
+
kind: "intentional_fork" | "non_tip_advance" | "idempotent_replay" | "checkpoint_created";
|
|
378
378
|
eventId: string;
|
|
379
379
|
};
|
|
380
|
-
edgeKind: "
|
|
380
|
+
edgeKind: "acked_step" | "checkpoint";
|
|
381
381
|
fromNodeId: string;
|
|
382
382
|
toNodeId: string;
|
|
383
383
|
}, {
|
|
384
384
|
cause: {
|
|
385
|
-
kind: "
|
|
385
|
+
kind: "intentional_fork" | "non_tip_advance" | "idempotent_replay" | "checkpoint_created";
|
|
386
386
|
eventId: string;
|
|
387
387
|
};
|
|
388
|
-
edgeKind: "
|
|
388
|
+
edgeKind: "acked_step" | "checkpoint";
|
|
389
389
|
fromNodeId: string;
|
|
390
390
|
toNodeId: string;
|
|
391
391
|
}>;
|
|
@@ -394,10 +394,10 @@ export declare const DomainEventV1Schema: z.ZodDiscriminatedUnion<"kind", [z.Zod
|
|
|
394
394
|
sessionId: string;
|
|
395
395
|
data: {
|
|
396
396
|
cause: {
|
|
397
|
-
kind: "
|
|
397
|
+
kind: "intentional_fork" | "non_tip_advance" | "idempotent_replay" | "checkpoint_created";
|
|
398
398
|
eventId: string;
|
|
399
399
|
};
|
|
400
|
-
edgeKind: "
|
|
400
|
+
edgeKind: "acked_step" | "checkpoint";
|
|
401
401
|
fromNodeId: string;
|
|
402
402
|
toNodeId: string;
|
|
403
403
|
};
|
|
@@ -413,10 +413,10 @@ export declare const DomainEventV1Schema: z.ZodDiscriminatedUnion<"kind", [z.Zod
|
|
|
413
413
|
sessionId: string;
|
|
414
414
|
data: {
|
|
415
415
|
cause: {
|
|
416
|
-
kind: "
|
|
416
|
+
kind: "intentional_fork" | "non_tip_advance" | "idempotent_replay" | "checkpoint_created";
|
|
417
417
|
eventId: string;
|
|
418
418
|
};
|
|
419
|
-
edgeKind: "
|
|
419
|
+
edgeKind: "acked_step" | "checkpoint";
|
|
420
420
|
fromNodeId: string;
|
|
421
421
|
toNodeId: string;
|
|
422
422
|
};
|
|
@@ -451,7 +451,7 @@ export declare const DomainEventV1Schema: z.ZodDiscriminatedUnion<"kind", [z.Zod
|
|
|
451
451
|
outcome: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
|
|
452
452
|
kind: z.ZodLiteral<"blocked">;
|
|
453
453
|
blockers: z.ZodEffects<z.ZodObject<{
|
|
454
|
-
blockers: z.ZodArray<z.ZodObject<{
|
|
454
|
+
blockers: z.ZodReadonly<z.ZodArray<z.ZodObject<{
|
|
455
455
|
code: z.ZodEnum<["USER_ONLY_DEPENDENCY", "MISSING_REQUIRED_OUTPUT", "INVALID_REQUIRED_OUTPUT", "REQUIRED_CAPABILITY_UNKNOWN", "REQUIRED_CAPABILITY_UNAVAILABLE", "INVARIANT_VIOLATION", "STORAGE_CORRUPTION_DETECTED"]>;
|
|
456
456
|
pointer: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
|
|
457
457
|
kind: z.ZodLiteral<"context_key">;
|
|
@@ -536,9 +536,9 @@ export declare const DomainEventV1Schema: z.ZodDiscriminatedUnion<"kind", [z.Zod
|
|
|
536
536
|
stepId: string;
|
|
537
537
|
};
|
|
538
538
|
suggestedFix?: string | undefined;
|
|
539
|
-
}>, "many"
|
|
539
|
+
}>, "many">>;
|
|
540
540
|
}, "strip", z.ZodTypeAny, {
|
|
541
|
-
blockers: {
|
|
541
|
+
blockers: readonly {
|
|
542
542
|
message: string;
|
|
543
543
|
code: "USER_ONLY_DEPENDENCY" | "MISSING_REQUIRED_OUTPUT" | "INVALID_REQUIRED_OUTPUT" | "REQUIRED_CAPABILITY_UNKNOWN" | "REQUIRED_CAPABILITY_UNAVAILABLE" | "INVARIANT_VIOLATION" | "STORAGE_CORRUPTION_DETECTED";
|
|
544
544
|
pointer: {
|
|
@@ -559,7 +559,7 @@ export declare const DomainEventV1Schema: z.ZodDiscriminatedUnion<"kind", [z.Zod
|
|
|
559
559
|
suggestedFix?: string | undefined;
|
|
560
560
|
}[];
|
|
561
561
|
}, {
|
|
562
|
-
blockers: {
|
|
562
|
+
blockers: readonly {
|
|
563
563
|
message: string;
|
|
564
564
|
code: "USER_ONLY_DEPENDENCY" | "MISSING_REQUIRED_OUTPUT" | "INVALID_REQUIRED_OUTPUT" | "REQUIRED_CAPABILITY_UNKNOWN" | "REQUIRED_CAPABILITY_UNAVAILABLE" | "INVARIANT_VIOLATION" | "STORAGE_CORRUPTION_DETECTED";
|
|
565
565
|
pointer: {
|
|
@@ -580,7 +580,7 @@ export declare const DomainEventV1Schema: z.ZodDiscriminatedUnion<"kind", [z.Zod
|
|
|
580
580
|
suggestedFix?: string | undefined;
|
|
581
581
|
}[];
|
|
582
582
|
}>, {
|
|
583
|
-
blockers: {
|
|
583
|
+
blockers: readonly {
|
|
584
584
|
message: string;
|
|
585
585
|
code: "USER_ONLY_DEPENDENCY" | "MISSING_REQUIRED_OUTPUT" | "INVALID_REQUIRED_OUTPUT" | "REQUIRED_CAPABILITY_UNKNOWN" | "REQUIRED_CAPABILITY_UNAVAILABLE" | "INVARIANT_VIOLATION" | "STORAGE_CORRUPTION_DETECTED";
|
|
586
586
|
pointer: {
|
|
@@ -601,7 +601,7 @@ export declare const DomainEventV1Schema: z.ZodDiscriminatedUnion<"kind", [z.Zod
|
|
|
601
601
|
suggestedFix?: string | undefined;
|
|
602
602
|
}[];
|
|
603
603
|
}, {
|
|
604
|
-
blockers: {
|
|
604
|
+
blockers: readonly {
|
|
605
605
|
message: string;
|
|
606
606
|
code: "USER_ONLY_DEPENDENCY" | "MISSING_REQUIRED_OUTPUT" | "INVALID_REQUIRED_OUTPUT" | "REQUIRED_CAPABILITY_UNKNOWN" | "REQUIRED_CAPABILITY_UNAVAILABLE" | "INVARIANT_VIOLATION" | "STORAGE_CORRUPTION_DETECTED";
|
|
607
607
|
pointer: {
|
|
@@ -625,7 +625,7 @@ export declare const DomainEventV1Schema: z.ZodDiscriminatedUnion<"kind", [z.Zod
|
|
|
625
625
|
}, "strip", z.ZodTypeAny, {
|
|
626
626
|
kind: "blocked";
|
|
627
627
|
blockers: {
|
|
628
|
-
blockers: {
|
|
628
|
+
blockers: readonly {
|
|
629
629
|
message: string;
|
|
630
630
|
code: "USER_ONLY_DEPENDENCY" | "MISSING_REQUIRED_OUTPUT" | "INVALID_REQUIRED_OUTPUT" | "REQUIRED_CAPABILITY_UNKNOWN" | "REQUIRED_CAPABILITY_UNAVAILABLE" | "INVARIANT_VIOLATION" | "STORAGE_CORRUPTION_DETECTED";
|
|
631
631
|
pointer: {
|
|
@@ -649,7 +649,7 @@ export declare const DomainEventV1Schema: z.ZodDiscriminatedUnion<"kind", [z.Zod
|
|
|
649
649
|
}, {
|
|
650
650
|
kind: "blocked";
|
|
651
651
|
blockers: {
|
|
652
|
-
blockers: {
|
|
652
|
+
blockers: readonly {
|
|
653
653
|
message: string;
|
|
654
654
|
code: "USER_ONLY_DEPENDENCY" | "MISSING_REQUIRED_OUTPUT" | "INVALID_REQUIRED_OUTPUT" | "REQUIRED_CAPABILITY_UNKNOWN" | "REQUIRED_CAPABILITY_UNAVAILABLE" | "INVARIANT_VIOLATION" | "STORAGE_CORRUPTION_DETECTED";
|
|
655
655
|
pointer: {
|
|
@@ -686,7 +686,7 @@ export declare const DomainEventV1Schema: z.ZodDiscriminatedUnion<"kind", [z.Zod
|
|
|
686
686
|
outcome: {
|
|
687
687
|
kind: "blocked";
|
|
688
688
|
blockers: {
|
|
689
|
-
blockers: {
|
|
689
|
+
blockers: readonly {
|
|
690
690
|
message: string;
|
|
691
691
|
code: "USER_ONLY_DEPENDENCY" | "MISSING_REQUIRED_OUTPUT" | "INVALID_REQUIRED_OUTPUT" | "REQUIRED_CAPABILITY_UNKNOWN" | "REQUIRED_CAPABILITY_UNAVAILABLE" | "INVARIANT_VIOLATION" | "STORAGE_CORRUPTION_DETECTED";
|
|
692
692
|
pointer: {
|
|
@@ -717,7 +717,7 @@ export declare const DomainEventV1Schema: z.ZodDiscriminatedUnion<"kind", [z.Zod
|
|
|
717
717
|
outcome: {
|
|
718
718
|
kind: "blocked";
|
|
719
719
|
blockers: {
|
|
720
|
-
blockers: {
|
|
720
|
+
blockers: readonly {
|
|
721
721
|
message: string;
|
|
722
722
|
code: "USER_ONLY_DEPENDENCY" | "MISSING_REQUIRED_OUTPUT" | "INVALID_REQUIRED_OUTPUT" | "REQUIRED_CAPABILITY_UNKNOWN" | "REQUIRED_CAPABILITY_UNAVAILABLE" | "INVARIANT_VIOLATION" | "STORAGE_CORRUPTION_DETECTED";
|
|
723
723
|
pointer: {
|
|
@@ -752,7 +752,7 @@ export declare const DomainEventV1Schema: z.ZodDiscriminatedUnion<"kind", [z.Zod
|
|
|
752
752
|
outcome: {
|
|
753
753
|
kind: "blocked";
|
|
754
754
|
blockers: {
|
|
755
|
-
blockers: {
|
|
755
|
+
blockers: readonly {
|
|
756
756
|
message: string;
|
|
757
757
|
code: "USER_ONLY_DEPENDENCY" | "MISSING_REQUIRED_OUTPUT" | "INVALID_REQUIRED_OUTPUT" | "REQUIRED_CAPABILITY_UNKNOWN" | "REQUIRED_CAPABILITY_UNAVAILABLE" | "INVARIANT_VIOLATION" | "STORAGE_CORRUPTION_DETECTED";
|
|
758
758
|
pointer: {
|
|
@@ -795,7 +795,7 @@ export declare const DomainEventV1Schema: z.ZodDiscriminatedUnion<"kind", [z.Zod
|
|
|
795
795
|
outcome: {
|
|
796
796
|
kind: "blocked";
|
|
797
797
|
blockers: {
|
|
798
|
-
blockers: {
|
|
798
|
+
blockers: readonly {
|
|
799
799
|
message: string;
|
|
800
800
|
code: "USER_ONLY_DEPENDENCY" | "MISSING_REQUIRED_OUTPUT" | "INVALID_REQUIRED_OUTPUT" | "REQUIRED_CAPABILITY_UNKNOWN" | "REQUIRED_CAPABILITY_UNAVAILABLE" | "INVARIANT_VIOLATION" | "STORAGE_CORRUPTION_DETECTED";
|
|
801
801
|
pointer: {
|
|
@@ -985,7 +985,7 @@ export declare const DomainEventV1Schema: z.ZodDiscriminatedUnion<"kind", [z.Zod
|
|
|
985
985
|
}>]>;
|
|
986
986
|
}, "strip", z.ZodTypeAny, {
|
|
987
987
|
outputId: string;
|
|
988
|
-
outputChannel: "
|
|
988
|
+
outputChannel: "recap" | "artifact";
|
|
989
989
|
payload: {
|
|
990
990
|
payloadKind: "notes";
|
|
991
991
|
notesMarkdown: string;
|
|
@@ -999,7 +999,7 @@ export declare const DomainEventV1Schema: z.ZodDiscriminatedUnion<"kind", [z.Zod
|
|
|
999
999
|
supersedesOutputId?: string | undefined;
|
|
1000
1000
|
}, {
|
|
1001
1001
|
outputId: string;
|
|
1002
|
-
outputChannel: "
|
|
1002
|
+
outputChannel: "recap" | "artifact";
|
|
1003
1003
|
payload: {
|
|
1004
1004
|
payloadKind: "notes";
|
|
1005
1005
|
notesMarkdown: string;
|
|
@@ -1013,7 +1013,7 @@ export declare const DomainEventV1Schema: z.ZodDiscriminatedUnion<"kind", [z.Zod
|
|
|
1013
1013
|
supersedesOutputId?: string | undefined;
|
|
1014
1014
|
}>, {
|
|
1015
1015
|
outputId: string;
|
|
1016
|
-
outputChannel: "
|
|
1016
|
+
outputChannel: "recap" | "artifact";
|
|
1017
1017
|
payload: {
|
|
1018
1018
|
payloadKind: "notes";
|
|
1019
1019
|
notesMarkdown: string;
|
|
@@ -1027,7 +1027,7 @@ export declare const DomainEventV1Schema: z.ZodDiscriminatedUnion<"kind", [z.Zod
|
|
|
1027
1027
|
supersedesOutputId?: string | undefined;
|
|
1028
1028
|
}, {
|
|
1029
1029
|
outputId: string;
|
|
1030
|
-
outputChannel: "
|
|
1030
|
+
outputChannel: "recap" | "artifact";
|
|
1031
1031
|
payload: {
|
|
1032
1032
|
payloadKind: "notes";
|
|
1033
1033
|
notesMarkdown: string;
|
|
@@ -1045,7 +1045,7 @@ export declare const DomainEventV1Schema: z.ZodDiscriminatedUnion<"kind", [z.Zod
|
|
|
1045
1045
|
sessionId: string;
|
|
1046
1046
|
data: {
|
|
1047
1047
|
outputId: string;
|
|
1048
|
-
outputChannel: "
|
|
1048
|
+
outputChannel: "recap" | "artifact";
|
|
1049
1049
|
payload: {
|
|
1050
1050
|
payloadKind: "notes";
|
|
1051
1051
|
notesMarkdown: string;
|
|
@@ -1071,7 +1071,7 @@ export declare const DomainEventV1Schema: z.ZodDiscriminatedUnion<"kind", [z.Zod
|
|
|
1071
1071
|
sessionId: string;
|
|
1072
1072
|
data: {
|
|
1073
1073
|
outputId: string;
|
|
1074
|
-
outputChannel: "
|
|
1074
|
+
outputChannel: "recap" | "artifact";
|
|
1075
1075
|
payload: {
|
|
1076
1076
|
payloadKind: "notes";
|
|
1077
1077
|
notesMarkdown: string;
|
|
@@ -1117,10 +1117,10 @@ export declare const DomainEventV1Schema: z.ZodDiscriminatedUnion<"kind", [z.Zod
|
|
|
1117
1117
|
key: z.ZodLiteral<"autonomy">;
|
|
1118
1118
|
value: z.ZodEnum<["guided", "full_auto_stop_on_user_deps", "full_auto_never_stop"]>;
|
|
1119
1119
|
}, "strip", z.ZodTypeAny, {
|
|
1120
|
-
value: "guided" | "
|
|
1120
|
+
value: "guided" | "full_auto_never_stop" | "full_auto_stop_on_user_deps";
|
|
1121
1121
|
key: "autonomy";
|
|
1122
1122
|
}, {
|
|
1123
|
-
value: "guided" | "
|
|
1123
|
+
value: "guided" | "full_auto_never_stop" | "full_auto_stop_on_user_deps";
|
|
1124
1124
|
key: "autonomy";
|
|
1125
1125
|
}>, z.ZodObject<{
|
|
1126
1126
|
key: z.ZodLiteral<"riskPolicy">;
|
|
@@ -1136,66 +1136,66 @@ export declare const DomainEventV1Schema: z.ZodDiscriminatedUnion<"kind", [z.Zod
|
|
|
1136
1136
|
autonomy: z.ZodEnum<["guided", "full_auto_stop_on_user_deps", "full_auto_never_stop"]>;
|
|
1137
1137
|
riskPolicy: z.ZodEnum<["conservative", "balanced", "aggressive"]>;
|
|
1138
1138
|
}, "strip", z.ZodTypeAny, {
|
|
1139
|
-
autonomy: "guided" | "
|
|
1139
|
+
autonomy: "guided" | "full_auto_never_stop" | "full_auto_stop_on_user_deps";
|
|
1140
1140
|
riskPolicy: "conservative" | "balanced" | "aggressive";
|
|
1141
1141
|
}, {
|
|
1142
|
-
autonomy: "guided" | "
|
|
1142
|
+
autonomy: "guided" | "full_auto_never_stop" | "full_auto_stop_on_user_deps";
|
|
1143
1143
|
riskPolicy: "conservative" | "balanced" | "aggressive";
|
|
1144
1144
|
}>;
|
|
1145
1145
|
}, "strip", z.ZodTypeAny, {
|
|
1146
1146
|
source: "user" | "workflow_recommendation" | "system";
|
|
1147
1147
|
changeId: string;
|
|
1148
1148
|
delta: ({
|
|
1149
|
-
value: "guided" | "
|
|
1149
|
+
value: "guided" | "full_auto_never_stop" | "full_auto_stop_on_user_deps";
|
|
1150
1150
|
key: "autonomy";
|
|
1151
1151
|
} | {
|
|
1152
1152
|
value: "conservative" | "balanced" | "aggressive";
|
|
1153
1153
|
key: "riskPolicy";
|
|
1154
1154
|
})[];
|
|
1155
1155
|
effective: {
|
|
1156
|
-
autonomy: "guided" | "
|
|
1156
|
+
autonomy: "guided" | "full_auto_never_stop" | "full_auto_stop_on_user_deps";
|
|
1157
1157
|
riskPolicy: "conservative" | "balanced" | "aggressive";
|
|
1158
1158
|
};
|
|
1159
1159
|
}, {
|
|
1160
1160
|
source: "user" | "workflow_recommendation" | "system";
|
|
1161
1161
|
changeId: string;
|
|
1162
1162
|
delta: ({
|
|
1163
|
-
value: "guided" | "
|
|
1163
|
+
value: "guided" | "full_auto_never_stop" | "full_auto_stop_on_user_deps";
|
|
1164
1164
|
key: "autonomy";
|
|
1165
1165
|
} | {
|
|
1166
1166
|
value: "conservative" | "balanced" | "aggressive";
|
|
1167
1167
|
key: "riskPolicy";
|
|
1168
1168
|
})[];
|
|
1169
1169
|
effective: {
|
|
1170
|
-
autonomy: "guided" | "
|
|
1170
|
+
autonomy: "guided" | "full_auto_never_stop" | "full_auto_stop_on_user_deps";
|
|
1171
1171
|
riskPolicy: "conservative" | "balanced" | "aggressive";
|
|
1172
1172
|
};
|
|
1173
1173
|
}>, {
|
|
1174
1174
|
source: "user" | "workflow_recommendation" | "system";
|
|
1175
1175
|
changeId: string;
|
|
1176
1176
|
delta: ({
|
|
1177
|
-
value: "guided" | "
|
|
1177
|
+
value: "guided" | "full_auto_never_stop" | "full_auto_stop_on_user_deps";
|
|
1178
1178
|
key: "autonomy";
|
|
1179
1179
|
} | {
|
|
1180
1180
|
value: "conservative" | "balanced" | "aggressive";
|
|
1181
1181
|
key: "riskPolicy";
|
|
1182
1182
|
})[];
|
|
1183
1183
|
effective: {
|
|
1184
|
-
autonomy: "guided" | "
|
|
1184
|
+
autonomy: "guided" | "full_auto_never_stop" | "full_auto_stop_on_user_deps";
|
|
1185
1185
|
riskPolicy: "conservative" | "balanced" | "aggressive";
|
|
1186
1186
|
};
|
|
1187
1187
|
}, {
|
|
1188
1188
|
source: "user" | "workflow_recommendation" | "system";
|
|
1189
1189
|
changeId: string;
|
|
1190
1190
|
delta: ({
|
|
1191
|
-
value: "guided" | "
|
|
1191
|
+
value: "guided" | "full_auto_never_stop" | "full_auto_stop_on_user_deps";
|
|
1192
1192
|
key: "autonomy";
|
|
1193
1193
|
} | {
|
|
1194
1194
|
value: "conservative" | "balanced" | "aggressive";
|
|
1195
1195
|
key: "riskPolicy";
|
|
1196
1196
|
})[];
|
|
1197
1197
|
effective: {
|
|
1198
|
-
autonomy: "guided" | "
|
|
1198
|
+
autonomy: "guided" | "full_auto_never_stop" | "full_auto_stop_on_user_deps";
|
|
1199
1199
|
riskPolicy: "conservative" | "balanced" | "aggressive";
|
|
1200
1200
|
};
|
|
1201
1201
|
}>;
|
|
@@ -1206,14 +1206,14 @@ export declare const DomainEventV1Schema: z.ZodDiscriminatedUnion<"kind", [z.Zod
|
|
|
1206
1206
|
source: "user" | "workflow_recommendation" | "system";
|
|
1207
1207
|
changeId: string;
|
|
1208
1208
|
delta: ({
|
|
1209
|
-
value: "guided" | "
|
|
1209
|
+
value: "guided" | "full_auto_never_stop" | "full_auto_stop_on_user_deps";
|
|
1210
1210
|
key: "autonomy";
|
|
1211
1211
|
} | {
|
|
1212
1212
|
value: "conservative" | "balanced" | "aggressive";
|
|
1213
1213
|
key: "riskPolicy";
|
|
1214
1214
|
})[];
|
|
1215
1215
|
effective: {
|
|
1216
|
-
autonomy: "guided" | "
|
|
1216
|
+
autonomy: "guided" | "full_auto_never_stop" | "full_auto_stop_on_user_deps";
|
|
1217
1217
|
riskPolicy: "conservative" | "balanced" | "aggressive";
|
|
1218
1218
|
};
|
|
1219
1219
|
};
|
|
@@ -1232,14 +1232,14 @@ export declare const DomainEventV1Schema: z.ZodDiscriminatedUnion<"kind", [z.Zod
|
|
|
1232
1232
|
source: "user" | "workflow_recommendation" | "system";
|
|
1233
1233
|
changeId: string;
|
|
1234
1234
|
delta: ({
|
|
1235
|
-
value: "guided" | "
|
|
1235
|
+
value: "guided" | "full_auto_never_stop" | "full_auto_stop_on_user_deps";
|
|
1236
1236
|
key: "autonomy";
|
|
1237
1237
|
} | {
|
|
1238
1238
|
value: "conservative" | "balanced" | "aggressive";
|
|
1239
1239
|
key: "riskPolicy";
|
|
1240
1240
|
})[];
|
|
1241
1241
|
effective: {
|
|
1242
|
-
autonomy: "guided" | "
|
|
1242
|
+
autonomy: "guided" | "full_auto_never_stop" | "full_auto_stop_on_user_deps";
|
|
1243
1243
|
riskPolicy: "conservative" | "balanced" | "aggressive";
|
|
1244
1244
|
};
|
|
1245
1245
|
};
|
|
@@ -9,10 +9,12 @@ const constants_js_1 = require("../../constants.js");
|
|
|
9
9
|
const decision_trace_ref_js_1 = require("../lib/decision-trace-ref.js");
|
|
10
10
|
const dedupe_key_js_1 = require("../lib/dedupe-key.js");
|
|
11
11
|
const utf8_bounded_string_js_1 = require("../lib/utf8-bounded-string.js");
|
|
12
|
+
const utf8_byte_length_js_1 = require("../lib/utf8-byte-length.js");
|
|
12
13
|
const validation_event_js_1 = require("./validation-event.js");
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
const blockers_js_1 = require("./blockers.js");
|
|
15
|
+
const outputs_js_1 = require("./outputs.js");
|
|
16
|
+
const gaps_js_1 = require("./gaps.js");
|
|
17
|
+
const dag_topology_js_1 = require("./dag-topology.js");
|
|
16
18
|
const sha256DigestSchema = zod_1.z
|
|
17
19
|
.string()
|
|
18
20
|
.regex(constants_js_1.SHA256_DIGEST_PATTERN, 'Expected sha256:<64 hex chars>')
|
|
@@ -20,9 +22,6 @@ const sha256DigestSchema = zod_1.z
|
|
|
20
22
|
const workflowHashSchema = sha256DigestSchema
|
|
21
23
|
.transform((v) => (0, index_js_1.asWorkflowHash)((0, index_js_1.asSha256Digest)(v)))
|
|
22
24
|
.describe('WorkflowHash (sha256 digest of workflow definition)');
|
|
23
|
-
const snapshotRefSchema = sha256DigestSchema
|
|
24
|
-
.transform((v) => (0, index_js_1.asSnapshotRef)((0, index_js_1.asSha256Digest)(v)))
|
|
25
|
-
.describe('SnapshotRef (content-addressed sha256 ref)');
|
|
26
25
|
exports.DomainEventEnvelopeV1Schema = zod_1.z.object({
|
|
27
26
|
v: zod_1.z.literal(1),
|
|
28
27
|
eventId: zod_1.z.string().min(1),
|
|
@@ -45,145 +44,8 @@ const RunStartedDataV1Schema = zod_1.z.object({
|
|
|
45
44
|
workflowSourceKind: WorkflowSourceKindSchema,
|
|
46
45
|
workflowSourceRef: zod_1.z.string().min(1),
|
|
47
46
|
});
|
|
48
|
-
const NodeKindSchema = zod_1.z.enum(['step', 'checkpoint', 'blocked_attempt']);
|
|
49
|
-
const NodeCreatedDataV1Schema = zod_1.z.object({
|
|
50
|
-
nodeKind: NodeKindSchema,
|
|
51
|
-
parentNodeId: zod_1.z.string().min(1).nullable(),
|
|
52
|
-
workflowHash: workflowHashSchema,
|
|
53
|
-
snapshotRef: snapshotRefSchema,
|
|
54
|
-
});
|
|
55
|
-
const EdgeKindSchema = zod_1.z.enum(['acked_step', 'checkpoint']);
|
|
56
|
-
const EdgeCauseKindSchema = zod_1.z.enum(['idempotent_replay', 'intentional_fork', 'non_tip_advance', 'checkpoint_created']);
|
|
57
|
-
const EdgeCauseSchema = zod_1.z.object({
|
|
58
|
-
kind: EdgeCauseKindSchema,
|
|
59
|
-
eventId: zod_1.z.string().min(1),
|
|
60
|
-
});
|
|
61
|
-
const EdgeCreatedDataV1Schema = zod_1.z
|
|
62
|
-
.object({
|
|
63
|
-
edgeKind: EdgeKindSchema,
|
|
64
|
-
fromNodeId: zod_1.z.string().min(1),
|
|
65
|
-
toNodeId: zod_1.z.string().min(1),
|
|
66
|
-
cause: EdgeCauseSchema,
|
|
67
|
-
})
|
|
68
|
-
.superRefine((v, ctx) => {
|
|
69
|
-
if (v.edgeKind === 'checkpoint' && v.cause.kind !== 'checkpoint_created') {
|
|
70
|
-
ctx.addIssue({
|
|
71
|
-
code: zod_1.z.ZodIssueCode.custom,
|
|
72
|
-
message: 'edgeKind=checkpoint requires cause.kind=checkpoint_created',
|
|
73
|
-
path: ['cause', 'kind'],
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
});
|
|
77
|
-
const OutputChannelSchema = zod_1.z.enum(['recap', 'artifact']);
|
|
78
|
-
const NotesPayloadV1Schema = zod_1.z.object({
|
|
79
|
-
payloadKind: zod_1.z.literal('notes'),
|
|
80
|
-
notesMarkdown: zod_1.z
|
|
81
|
-
.string()
|
|
82
|
-
.min(1)
|
|
83
|
-
.refine((s) => utf8ByteLength(s) <= constants_js_1.MAX_OUTPUT_NOTES_MARKDOWN_BYTES, {
|
|
84
|
-
message: `notesMarkdown exceeds max ${constants_js_1.MAX_OUTPUT_NOTES_MARKDOWN_BYTES} UTF-8 bytes`,
|
|
85
|
-
}),
|
|
86
|
-
});
|
|
87
|
-
const ArtifactRefPayloadV1Schema = zod_1.z.object({
|
|
88
|
-
payloadKind: zod_1.z.literal('artifact_ref'),
|
|
89
|
-
sha256: sha256DigestSchema,
|
|
90
|
-
contentType: zod_1.z.string().min(1),
|
|
91
|
-
byteLength: zod_1.z.number().int().nonnegative(),
|
|
92
|
-
content: zod_1.z.unknown().optional(),
|
|
93
|
-
});
|
|
94
|
-
const OutputPayloadV1Schema = zod_1.z.discriminatedUnion('payloadKind', [NotesPayloadV1Schema, ArtifactRefPayloadV1Schema]);
|
|
95
|
-
const NodeOutputAppendedDataV1Schema = zod_1.z
|
|
96
|
-
.object({
|
|
97
|
-
outputId: zod_1.z.string().min(1),
|
|
98
|
-
supersedesOutputId: zod_1.z.string().min(1).optional(),
|
|
99
|
-
outputChannel: OutputChannelSchema,
|
|
100
|
-
payload: OutputPayloadV1Schema,
|
|
101
|
-
})
|
|
102
|
-
.superRefine((v, ctx) => {
|
|
103
|
-
if (v.outputChannel === 'recap' && v.payload.payloadKind !== 'notes') {
|
|
104
|
-
ctx.addIssue({
|
|
105
|
-
code: zod_1.z.ZodIssueCode.custom,
|
|
106
|
-
message: 'outputChannel=recap requires payloadKind=notes',
|
|
107
|
-
path: ['payload', 'payloadKind'],
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
});
|
|
111
|
-
const BlockerCodeSchema = zod_1.z.enum([
|
|
112
|
-
'USER_ONLY_DEPENDENCY',
|
|
113
|
-
'MISSING_REQUIRED_OUTPUT',
|
|
114
|
-
'INVALID_REQUIRED_OUTPUT',
|
|
115
|
-
'REQUIRED_CAPABILITY_UNKNOWN',
|
|
116
|
-
'REQUIRED_CAPABILITY_UNAVAILABLE',
|
|
117
|
-
'INVARIANT_VIOLATION',
|
|
118
|
-
'STORAGE_CORRUPTION_DETECTED',
|
|
119
|
-
]);
|
|
120
|
-
const BlockerPointerSchema = zod_1.z.discriminatedUnion('kind', [
|
|
121
|
-
zod_1.z.object({ kind: zod_1.z.literal('context_key'), key: zod_1.z.string().min(1).regex(constants_js_1.DELIMITER_SAFE_ID_PATTERN, 'context_key must be delimiter-safe: [a-z0-9_-]+') }),
|
|
122
|
-
zod_1.z.object({ kind: zod_1.z.literal('context_budget') }),
|
|
123
|
-
zod_1.z.object({ kind: zod_1.z.literal('output_contract'), contractRef: zod_1.z.string().min(1) }),
|
|
124
|
-
zod_1.z.object({ kind: zod_1.z.literal('capability'), capability: zod_1.z.enum(['delegation', 'web_browsing']) }),
|
|
125
|
-
zod_1.z.object({ kind: zod_1.z.literal('workflow_step'), stepId: zod_1.z.string().min(1).regex(constants_js_1.DELIMITER_SAFE_ID_PATTERN, 'stepId must be delimiter-safe: [a-z0-9_-]+') }),
|
|
126
|
-
]);
|
|
127
|
-
const BlockerSchema = zod_1.z.object({
|
|
128
|
-
code: BlockerCodeSchema,
|
|
129
|
-
pointer: BlockerPointerSchema,
|
|
130
|
-
message: zod_1.z
|
|
131
|
-
.string()
|
|
132
|
-
.min(1)
|
|
133
|
-
.refine((s) => utf8ByteLength(s) <= constants_js_1.MAX_BLOCKER_MESSAGE_BYTES, {
|
|
134
|
-
message: `Blocker message exceeds ${constants_js_1.MAX_BLOCKER_MESSAGE_BYTES} bytes (UTF-8)`,
|
|
135
|
-
}),
|
|
136
|
-
suggestedFix: zod_1.z
|
|
137
|
-
.string()
|
|
138
|
-
.min(1)
|
|
139
|
-
.refine((s) => utf8ByteLength(s) <= constants_js_1.MAX_BLOCKER_SUGGESTED_FIX_BYTES, {
|
|
140
|
-
message: `Blocker suggestedFix exceeds ${constants_js_1.MAX_BLOCKER_SUGGESTED_FIX_BYTES} bytes (UTF-8)`,
|
|
141
|
-
})
|
|
142
|
-
.optional(),
|
|
143
|
-
});
|
|
144
|
-
const BlockerReportV1Schema = zod_1.z
|
|
145
|
-
.object({
|
|
146
|
-
blockers: zod_1.z.array(BlockerSchema).min(1).max(constants_js_1.MAX_BLOCKERS),
|
|
147
|
-
})
|
|
148
|
-
.superRefine((v, ctx) => {
|
|
149
|
-
const keyFor = (b) => {
|
|
150
|
-
const p = b.pointer;
|
|
151
|
-
let ptrStable;
|
|
152
|
-
switch (p.kind) {
|
|
153
|
-
case 'context_key':
|
|
154
|
-
ptrStable = p.key;
|
|
155
|
-
break;
|
|
156
|
-
case 'output_contract':
|
|
157
|
-
ptrStable = p.contractRef;
|
|
158
|
-
break;
|
|
159
|
-
case 'capability':
|
|
160
|
-
ptrStable = p.capability;
|
|
161
|
-
break;
|
|
162
|
-
case 'workflow_step':
|
|
163
|
-
ptrStable = p.stepId;
|
|
164
|
-
break;
|
|
165
|
-
case 'context_budget':
|
|
166
|
-
ptrStable = '';
|
|
167
|
-
break;
|
|
168
|
-
default:
|
|
169
|
-
const _exhaustive = p;
|
|
170
|
-
ptrStable = _exhaustive;
|
|
171
|
-
}
|
|
172
|
-
return `${b.code}|${p.kind}|${String(ptrStable)}`;
|
|
173
|
-
};
|
|
174
|
-
for (let i = 1; i < v.blockers.length; i++) {
|
|
175
|
-
if (keyFor(v.blockers[i - 1]) > keyFor(v.blockers[i])) {
|
|
176
|
-
ctx.addIssue({
|
|
177
|
-
code: zod_1.z.ZodIssueCode.custom,
|
|
178
|
-
message: 'blockers must be deterministically sorted',
|
|
179
|
-
path: ['blockers'],
|
|
180
|
-
});
|
|
181
|
-
break;
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
});
|
|
185
47
|
const AdvanceRecordedOutcomeV1Schema = zod_1.z.discriminatedUnion('kind', [
|
|
186
|
-
zod_1.z.object({ kind: zod_1.z.literal('blocked'), blockers: BlockerReportV1Schema }),
|
|
48
|
+
zod_1.z.object({ kind: zod_1.z.literal('blocked'), blockers: blockers_js_1.BlockerReportV1Schema }),
|
|
187
49
|
zod_1.z.object({ kind: zod_1.z.literal('advanced'), toNodeId: zod_1.z.string().min(1) }),
|
|
188
50
|
]);
|
|
189
51
|
const AdvanceRecordedDataV1Schema = zod_1.z.object({
|
|
@@ -213,39 +75,6 @@ const PreferencesChangedDataV1Schema = zod_1.z
|
|
|
213
75
|
ctx.addIssue({ code: zod_1.z.ZodIssueCode.custom, message: 'delta must not contain duplicate keys', path: ['delta'] });
|
|
214
76
|
}
|
|
215
77
|
});
|
|
216
|
-
const UserOnlyDependencyReasonSchema = zod_1.z.enum([
|
|
217
|
-
'needs_user_secret_or_token',
|
|
218
|
-
'needs_user_account_access',
|
|
219
|
-
'needs_user_artifact',
|
|
220
|
-
'needs_user_choice',
|
|
221
|
-
'needs_user_approval',
|
|
222
|
-
'needs_user_environment_action',
|
|
223
|
-
]);
|
|
224
|
-
const GapReasonSchema = zod_1.z.discriminatedUnion('category', [
|
|
225
|
-
zod_1.z.object({ category: zod_1.z.literal('user_only_dependency'), detail: UserOnlyDependencyReasonSchema }),
|
|
226
|
-
zod_1.z.object({ category: zod_1.z.literal('contract_violation'), detail: zod_1.z.enum(['missing_required_output', 'invalid_required_output']) }),
|
|
227
|
-
zod_1.z.object({
|
|
228
|
-
category: zod_1.z.literal('capability_missing'),
|
|
229
|
-
detail: zod_1.z.enum(['required_capability_unavailable', 'required_capability_unknown']),
|
|
230
|
-
}),
|
|
231
|
-
zod_1.z.object({ category: zod_1.z.literal('unexpected'), detail: zod_1.z.enum(['invariant_violation', 'storage_corruption_detected']) }),
|
|
232
|
-
]);
|
|
233
|
-
const GapResolutionSchema = zod_1.z.discriminatedUnion('kind', [
|
|
234
|
-
zod_1.z.object({ kind: zod_1.z.literal('unresolved') }),
|
|
235
|
-
zod_1.z.object({ kind: zod_1.z.literal('resolves'), resolvesGapId: zod_1.z.string().min(1) }),
|
|
236
|
-
]);
|
|
237
|
-
const GapEvidenceRefSchema = zod_1.z.discriminatedUnion('kind', [
|
|
238
|
-
zod_1.z.object({ kind: zod_1.z.literal('event'), eventId: zod_1.z.string().min(1) }),
|
|
239
|
-
zod_1.z.object({ kind: zod_1.z.literal('output'), outputId: zod_1.z.string().min(1) }),
|
|
240
|
-
]);
|
|
241
|
-
const GapRecordedDataV1Schema = zod_1.z.object({
|
|
242
|
-
gapId: zod_1.z.string().min(1),
|
|
243
|
-
severity: zod_1.z.enum(['info', 'warning', 'critical']),
|
|
244
|
-
reason: GapReasonSchema,
|
|
245
|
-
summary: zod_1.z.string().min(1),
|
|
246
|
-
resolution: GapResolutionSchema,
|
|
247
|
-
evidenceRefs: zod_1.z.array(GapEvidenceRefSchema).optional(),
|
|
248
|
-
});
|
|
249
78
|
exports.DomainEventV1Schema = zod_1.z.discriminatedUnion('kind', [
|
|
250
79
|
exports.DomainEventEnvelopeV1Schema.extend({ kind: zod_1.z.literal('session_created'), data: zod_1.z.object({}) }),
|
|
251
80
|
exports.DomainEventEnvelopeV1Schema.extend({
|
|
@@ -269,12 +98,12 @@ exports.DomainEventV1Schema = zod_1.z.discriminatedUnion('kind', [
|
|
|
269
98
|
exports.DomainEventEnvelopeV1Schema.extend({
|
|
270
99
|
kind: zod_1.z.literal('node_created'),
|
|
271
100
|
scope: zod_1.z.object({ runId: zod_1.z.string().min(1), nodeId: zod_1.z.string().min(1) }),
|
|
272
|
-
data: NodeCreatedDataV1Schema,
|
|
101
|
+
data: dag_topology_js_1.NodeCreatedDataV1Schema,
|
|
273
102
|
}),
|
|
274
103
|
exports.DomainEventEnvelopeV1Schema.extend({
|
|
275
104
|
kind: zod_1.z.literal('edge_created'),
|
|
276
105
|
scope: zod_1.z.object({ runId: zod_1.z.string().min(1) }),
|
|
277
|
-
data: EdgeCreatedDataV1Schema,
|
|
106
|
+
data: dag_topology_js_1.EdgeCreatedDataV1Schema,
|
|
278
107
|
}),
|
|
279
108
|
exports.DomainEventEnvelopeV1Schema.extend({
|
|
280
109
|
kind: zod_1.z.literal('advance_recorded'),
|
|
@@ -289,7 +118,7 @@ exports.DomainEventV1Schema = zod_1.z.discriminatedUnion('kind', [
|
|
|
289
118
|
exports.DomainEventEnvelopeV1Schema.extend({
|
|
290
119
|
kind: zod_1.z.literal('node_output_appended'),
|
|
291
120
|
scope: zod_1.z.object({ runId: zod_1.z.string().min(1), nodeId: zod_1.z.string().min(1) }),
|
|
292
|
-
data: NodeOutputAppendedDataV1Schema,
|
|
121
|
+
data: outputs_js_1.NodeOutputAppendedDataV1Schema,
|
|
293
122
|
}),
|
|
294
123
|
exports.DomainEventEnvelopeV1Schema.extend({
|
|
295
124
|
kind: zod_1.z.literal('preferences_changed'),
|
|
@@ -349,7 +178,7 @@ exports.DomainEventV1Schema = zod_1.z.discriminatedUnion('kind', [
|
|
|
349
178
|
exports.DomainEventEnvelopeV1Schema.extend({
|
|
350
179
|
kind: zod_1.z.literal('gap_recorded'),
|
|
351
180
|
scope: zod_1.z.object({ runId: zod_1.z.string().min(1), nodeId: zod_1.z.string().min(1) }),
|
|
352
|
-
data: GapRecordedDataV1Schema,
|
|
181
|
+
data: gaps_js_1.GapRecordedDataV1Schema,
|
|
353
182
|
}),
|
|
354
183
|
exports.DomainEventEnvelopeV1Schema.extend({
|
|
355
184
|
kind: zod_1.z.literal('context_set'),
|
|
@@ -386,7 +215,7 @@ exports.DomainEventV1Schema = zod_1.z.discriminatedUnion('kind', [
|
|
|
386
215
|
.max(constants_js_1.MAX_DECISION_TRACE_ENTRIES),
|
|
387
216
|
})
|
|
388
217
|
.refine((data) => {
|
|
389
|
-
const totalBytes = data.entries.reduce((sum, entry) => sum + utf8ByteLength(entry.summary), 0);
|
|
218
|
+
const totalBytes = data.entries.reduce((sum, entry) => sum + (0, utf8_byte_length_js_1.utf8ByteLength)(entry.summary), 0);
|
|
390
219
|
return totalBytes <= constants_js_1.MAX_DECISION_TRACE_TOTAL_BYTES;
|
|
391
220
|
}, { message: `Decision trace total bytes exceeds ${constants_js_1.MAX_DECISION_TRACE_TOTAL_BYTES}` }),
|
|
392
221
|
}),
|