@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
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ManifestRecordV1Schema = exports.DomainEventV1Schema = exports.ExecutionSnapshotFileV1Schema = exports.BundleImportErrorSchema = exports.BundleImportErrorCodeSchema = exports.ExportBundleV1Schema = exports.SessionContentsV1Schema = exports.ProducerInfoV1Schema = exports.IntegrityManifestV1Schema = exports.IntegrityEntryV1Schema = void 0;
|
|
4
|
-
exports.importCollisionPolicy = importCollisionPolicy;
|
|
5
|
-
exports.importValidationOrder = importValidationOrder;
|
|
6
4
|
const zod_1 = require("zod");
|
|
7
5
|
const constants_js_1 = require("../../constants.js");
|
|
8
6
|
const index_js_1 = require("../execution-snapshot/index.js");
|
|
@@ -68,12 +66,6 @@ exports.BundleImportErrorSchema = zod_1.z.object({
|
|
|
68
66
|
retry: zod_1.z.enum(['yes', 'no']).describe('Whether caller should retry'),
|
|
69
67
|
details: zod_1.z.record(zod_1.z.unknown()).optional().describe('Additional debugging context'),
|
|
70
68
|
});
|
|
71
|
-
function importCollisionPolicy(args) {
|
|
72
|
-
return 'import_as_new';
|
|
73
|
-
}
|
|
74
|
-
function importValidationOrder() {
|
|
75
|
-
return ['schema', 'integrity', 'ordering', 'references'];
|
|
76
|
-
}
|
|
77
69
|
var index_js_3 = require("../execution-snapshot/index.js");
|
|
78
70
|
Object.defineProperty(exports, "ExecutionSnapshotFileV1Schema", { enumerable: true, get: function () { return index_js_3.ExecutionSnapshotFileV1Schema; } });
|
|
79
71
|
var events_js_2 = require("../session/events.js");
|
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import type { Result } from 'neverthrow';
|
|
2
3
|
import type { Brand } from '../../../../runtime/brand.js';
|
|
3
4
|
export type DedupeKeyV1 = Brand<string, 'v2.DedupeKeyV1'>;
|
|
4
5
|
export declare const DEDUPE_KEY_PATTERN: RegExp;
|
|
5
6
|
export declare const MAX_DEDUPE_KEY_LENGTH = 256;
|
|
6
7
|
export declare const DedupeKeyV1Schema: z.ZodString;
|
|
7
|
-
export
|
|
8
|
+
export type DedupeKeyError = {
|
|
9
|
+
readonly code: 'DEDUPE_KEY_INVALID_PATTERN';
|
|
10
|
+
readonly message: string;
|
|
11
|
+
} | {
|
|
12
|
+
readonly code: 'DEDUPE_KEY_TOO_LONG';
|
|
13
|
+
readonly message: string;
|
|
14
|
+
};
|
|
15
|
+
export declare function buildDedupeKey(kind: string, parts: readonly string[]): Result<DedupeKeyV1, DedupeKeyError>;
|
|
8
16
|
export declare function isValidDedupeKey(value: string): value is DedupeKeyV1;
|
|
@@ -4,6 +4,7 @@ exports.DedupeKeyV1Schema = exports.MAX_DEDUPE_KEY_LENGTH = exports.DEDUPE_KEY_P
|
|
|
4
4
|
exports.buildDedupeKey = buildDedupeKey;
|
|
5
5
|
exports.isValidDedupeKey = isValidDedupeKey;
|
|
6
6
|
const zod_1 = require("zod");
|
|
7
|
+
const neverthrow_1 = require("neverthrow");
|
|
7
8
|
exports.DEDUPE_KEY_PATTERN = /^[a-z0-9_:>-]+$/;
|
|
8
9
|
exports.MAX_DEDUPE_KEY_LENGTH = 256;
|
|
9
10
|
exports.DedupeKeyV1Schema = zod_1.z
|
|
@@ -14,12 +15,12 @@ exports.DedupeKeyV1Schema = zod_1.z
|
|
|
14
15
|
function buildDedupeKey(kind, parts) {
|
|
15
16
|
const key = [kind, ...parts].join(':');
|
|
16
17
|
if (!exports.DEDUPE_KEY_PATTERN.test(key)) {
|
|
17
|
-
|
|
18
|
+
return (0, neverthrow_1.err)({ code: 'DEDUPE_KEY_INVALID_PATTERN', message: `dedupeKey "${key}" does not match pattern ${exports.DEDUPE_KEY_PATTERN}` });
|
|
18
19
|
}
|
|
19
20
|
if (key.length > exports.MAX_DEDUPE_KEY_LENGTH) {
|
|
20
|
-
|
|
21
|
+
return (0, neverthrow_1.err)({ code: 'DEDUPE_KEY_TOO_LONG', message: `dedupeKey "${key}" exceeds max length ${exports.MAX_DEDUPE_KEY_LENGTH}` });
|
|
21
22
|
}
|
|
22
|
-
return key;
|
|
23
|
+
return (0, neverthrow_1.ok)(key);
|
|
23
24
|
}
|
|
24
25
|
function isValidDedupeKey(value) {
|
|
25
26
|
return (value.length > 0 &&
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function utf8ByteLength(s: string): number;
|
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const BlockerCodeSchema: z.ZodEnum<["USER_ONLY_DEPENDENCY", "MISSING_REQUIRED_OUTPUT", "INVALID_REQUIRED_OUTPUT", "REQUIRED_CAPABILITY_UNKNOWN", "REQUIRED_CAPABILITY_UNAVAILABLE", "INVARIANT_VIOLATION", "STORAGE_CORRUPTION_DETECTED"]>;
|
|
3
|
+
export declare const BlockerPointerSchema: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
|
|
4
|
+
kind: z.ZodLiteral<"context_key">;
|
|
5
|
+
key: z.ZodString;
|
|
6
|
+
}, "strip", z.ZodTypeAny, {
|
|
7
|
+
key: string;
|
|
8
|
+
kind: "context_key";
|
|
9
|
+
}, {
|
|
10
|
+
key: string;
|
|
11
|
+
kind: "context_key";
|
|
12
|
+
}>, z.ZodObject<{
|
|
13
|
+
kind: z.ZodLiteral<"context_budget">;
|
|
14
|
+
}, "strip", z.ZodTypeAny, {
|
|
15
|
+
kind: "context_budget";
|
|
16
|
+
}, {
|
|
17
|
+
kind: "context_budget";
|
|
18
|
+
}>, z.ZodObject<{
|
|
19
|
+
kind: z.ZodLiteral<"output_contract">;
|
|
20
|
+
contractRef: z.ZodString;
|
|
21
|
+
}, "strip", z.ZodTypeAny, {
|
|
22
|
+
kind: "output_contract";
|
|
23
|
+
contractRef: string;
|
|
24
|
+
}, {
|
|
25
|
+
kind: "output_contract";
|
|
26
|
+
contractRef: string;
|
|
27
|
+
}>, z.ZodObject<{
|
|
28
|
+
kind: z.ZodLiteral<"capability">;
|
|
29
|
+
capability: z.ZodEnum<["delegation", "web_browsing"]>;
|
|
30
|
+
}, "strip", z.ZodTypeAny, {
|
|
31
|
+
kind: "capability";
|
|
32
|
+
capability: "delegation" | "web_browsing";
|
|
33
|
+
}, {
|
|
34
|
+
kind: "capability";
|
|
35
|
+
capability: "delegation" | "web_browsing";
|
|
36
|
+
}>, z.ZodObject<{
|
|
37
|
+
kind: z.ZodLiteral<"workflow_step">;
|
|
38
|
+
stepId: z.ZodString;
|
|
39
|
+
}, "strip", z.ZodTypeAny, {
|
|
40
|
+
kind: "workflow_step";
|
|
41
|
+
stepId: string;
|
|
42
|
+
}, {
|
|
43
|
+
kind: "workflow_step";
|
|
44
|
+
stepId: string;
|
|
45
|
+
}>]>;
|
|
46
|
+
export declare const BlockerSchema: z.ZodObject<{
|
|
47
|
+
code: z.ZodEnum<["USER_ONLY_DEPENDENCY", "MISSING_REQUIRED_OUTPUT", "INVALID_REQUIRED_OUTPUT", "REQUIRED_CAPABILITY_UNKNOWN", "REQUIRED_CAPABILITY_UNAVAILABLE", "INVARIANT_VIOLATION", "STORAGE_CORRUPTION_DETECTED"]>;
|
|
48
|
+
pointer: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
|
|
49
|
+
kind: z.ZodLiteral<"context_key">;
|
|
50
|
+
key: z.ZodString;
|
|
51
|
+
}, "strip", z.ZodTypeAny, {
|
|
52
|
+
key: string;
|
|
53
|
+
kind: "context_key";
|
|
54
|
+
}, {
|
|
55
|
+
key: string;
|
|
56
|
+
kind: "context_key";
|
|
57
|
+
}>, z.ZodObject<{
|
|
58
|
+
kind: z.ZodLiteral<"context_budget">;
|
|
59
|
+
}, "strip", z.ZodTypeAny, {
|
|
60
|
+
kind: "context_budget";
|
|
61
|
+
}, {
|
|
62
|
+
kind: "context_budget";
|
|
63
|
+
}>, z.ZodObject<{
|
|
64
|
+
kind: z.ZodLiteral<"output_contract">;
|
|
65
|
+
contractRef: z.ZodString;
|
|
66
|
+
}, "strip", z.ZodTypeAny, {
|
|
67
|
+
kind: "output_contract";
|
|
68
|
+
contractRef: string;
|
|
69
|
+
}, {
|
|
70
|
+
kind: "output_contract";
|
|
71
|
+
contractRef: string;
|
|
72
|
+
}>, z.ZodObject<{
|
|
73
|
+
kind: z.ZodLiteral<"capability">;
|
|
74
|
+
capability: z.ZodEnum<["delegation", "web_browsing"]>;
|
|
75
|
+
}, "strip", z.ZodTypeAny, {
|
|
76
|
+
kind: "capability";
|
|
77
|
+
capability: "delegation" | "web_browsing";
|
|
78
|
+
}, {
|
|
79
|
+
kind: "capability";
|
|
80
|
+
capability: "delegation" | "web_browsing";
|
|
81
|
+
}>, z.ZodObject<{
|
|
82
|
+
kind: z.ZodLiteral<"workflow_step">;
|
|
83
|
+
stepId: z.ZodString;
|
|
84
|
+
}, "strip", z.ZodTypeAny, {
|
|
85
|
+
kind: "workflow_step";
|
|
86
|
+
stepId: string;
|
|
87
|
+
}, {
|
|
88
|
+
kind: "workflow_step";
|
|
89
|
+
stepId: string;
|
|
90
|
+
}>]>;
|
|
91
|
+
message: z.ZodEffects<z.ZodString, string, string>;
|
|
92
|
+
suggestedFix: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
93
|
+
}, "strip", z.ZodTypeAny, {
|
|
94
|
+
message: string;
|
|
95
|
+
code: "USER_ONLY_DEPENDENCY" | "MISSING_REQUIRED_OUTPUT" | "INVALID_REQUIRED_OUTPUT" | "REQUIRED_CAPABILITY_UNKNOWN" | "REQUIRED_CAPABILITY_UNAVAILABLE" | "INVARIANT_VIOLATION" | "STORAGE_CORRUPTION_DETECTED";
|
|
96
|
+
pointer: {
|
|
97
|
+
key: string;
|
|
98
|
+
kind: "context_key";
|
|
99
|
+
} | {
|
|
100
|
+
kind: "context_budget";
|
|
101
|
+
} | {
|
|
102
|
+
kind: "output_contract";
|
|
103
|
+
contractRef: string;
|
|
104
|
+
} | {
|
|
105
|
+
kind: "capability";
|
|
106
|
+
capability: "delegation" | "web_browsing";
|
|
107
|
+
} | {
|
|
108
|
+
kind: "workflow_step";
|
|
109
|
+
stepId: string;
|
|
110
|
+
};
|
|
111
|
+
suggestedFix?: string | undefined;
|
|
112
|
+
}, {
|
|
113
|
+
message: string;
|
|
114
|
+
code: "USER_ONLY_DEPENDENCY" | "MISSING_REQUIRED_OUTPUT" | "INVALID_REQUIRED_OUTPUT" | "REQUIRED_CAPABILITY_UNKNOWN" | "REQUIRED_CAPABILITY_UNAVAILABLE" | "INVARIANT_VIOLATION" | "STORAGE_CORRUPTION_DETECTED";
|
|
115
|
+
pointer: {
|
|
116
|
+
key: string;
|
|
117
|
+
kind: "context_key";
|
|
118
|
+
} | {
|
|
119
|
+
kind: "context_budget";
|
|
120
|
+
} | {
|
|
121
|
+
kind: "output_contract";
|
|
122
|
+
contractRef: string;
|
|
123
|
+
} | {
|
|
124
|
+
kind: "capability";
|
|
125
|
+
capability: "delegation" | "web_browsing";
|
|
126
|
+
} | {
|
|
127
|
+
kind: "workflow_step";
|
|
128
|
+
stepId: string;
|
|
129
|
+
};
|
|
130
|
+
suggestedFix?: string | undefined;
|
|
131
|
+
}>;
|
|
132
|
+
export declare const BlockerReportV1Schema: z.ZodEffects<z.ZodObject<{
|
|
133
|
+
blockers: z.ZodReadonly<z.ZodArray<z.ZodObject<{
|
|
134
|
+
code: z.ZodEnum<["USER_ONLY_DEPENDENCY", "MISSING_REQUIRED_OUTPUT", "INVALID_REQUIRED_OUTPUT", "REQUIRED_CAPABILITY_UNKNOWN", "REQUIRED_CAPABILITY_UNAVAILABLE", "INVARIANT_VIOLATION", "STORAGE_CORRUPTION_DETECTED"]>;
|
|
135
|
+
pointer: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
|
|
136
|
+
kind: z.ZodLiteral<"context_key">;
|
|
137
|
+
key: z.ZodString;
|
|
138
|
+
}, "strip", z.ZodTypeAny, {
|
|
139
|
+
key: string;
|
|
140
|
+
kind: "context_key";
|
|
141
|
+
}, {
|
|
142
|
+
key: string;
|
|
143
|
+
kind: "context_key";
|
|
144
|
+
}>, z.ZodObject<{
|
|
145
|
+
kind: z.ZodLiteral<"context_budget">;
|
|
146
|
+
}, "strip", z.ZodTypeAny, {
|
|
147
|
+
kind: "context_budget";
|
|
148
|
+
}, {
|
|
149
|
+
kind: "context_budget";
|
|
150
|
+
}>, z.ZodObject<{
|
|
151
|
+
kind: z.ZodLiteral<"output_contract">;
|
|
152
|
+
contractRef: z.ZodString;
|
|
153
|
+
}, "strip", z.ZodTypeAny, {
|
|
154
|
+
kind: "output_contract";
|
|
155
|
+
contractRef: string;
|
|
156
|
+
}, {
|
|
157
|
+
kind: "output_contract";
|
|
158
|
+
contractRef: string;
|
|
159
|
+
}>, z.ZodObject<{
|
|
160
|
+
kind: z.ZodLiteral<"capability">;
|
|
161
|
+
capability: z.ZodEnum<["delegation", "web_browsing"]>;
|
|
162
|
+
}, "strip", z.ZodTypeAny, {
|
|
163
|
+
kind: "capability";
|
|
164
|
+
capability: "delegation" | "web_browsing";
|
|
165
|
+
}, {
|
|
166
|
+
kind: "capability";
|
|
167
|
+
capability: "delegation" | "web_browsing";
|
|
168
|
+
}>, z.ZodObject<{
|
|
169
|
+
kind: z.ZodLiteral<"workflow_step">;
|
|
170
|
+
stepId: z.ZodString;
|
|
171
|
+
}, "strip", z.ZodTypeAny, {
|
|
172
|
+
kind: "workflow_step";
|
|
173
|
+
stepId: string;
|
|
174
|
+
}, {
|
|
175
|
+
kind: "workflow_step";
|
|
176
|
+
stepId: string;
|
|
177
|
+
}>]>;
|
|
178
|
+
message: z.ZodEffects<z.ZodString, string, string>;
|
|
179
|
+
suggestedFix: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
180
|
+
}, "strip", z.ZodTypeAny, {
|
|
181
|
+
message: string;
|
|
182
|
+
code: "USER_ONLY_DEPENDENCY" | "MISSING_REQUIRED_OUTPUT" | "INVALID_REQUIRED_OUTPUT" | "REQUIRED_CAPABILITY_UNKNOWN" | "REQUIRED_CAPABILITY_UNAVAILABLE" | "INVARIANT_VIOLATION" | "STORAGE_CORRUPTION_DETECTED";
|
|
183
|
+
pointer: {
|
|
184
|
+
key: string;
|
|
185
|
+
kind: "context_key";
|
|
186
|
+
} | {
|
|
187
|
+
kind: "context_budget";
|
|
188
|
+
} | {
|
|
189
|
+
kind: "output_contract";
|
|
190
|
+
contractRef: string;
|
|
191
|
+
} | {
|
|
192
|
+
kind: "capability";
|
|
193
|
+
capability: "delegation" | "web_browsing";
|
|
194
|
+
} | {
|
|
195
|
+
kind: "workflow_step";
|
|
196
|
+
stepId: string;
|
|
197
|
+
};
|
|
198
|
+
suggestedFix?: string | undefined;
|
|
199
|
+
}, {
|
|
200
|
+
message: string;
|
|
201
|
+
code: "USER_ONLY_DEPENDENCY" | "MISSING_REQUIRED_OUTPUT" | "INVALID_REQUIRED_OUTPUT" | "REQUIRED_CAPABILITY_UNKNOWN" | "REQUIRED_CAPABILITY_UNAVAILABLE" | "INVARIANT_VIOLATION" | "STORAGE_CORRUPTION_DETECTED";
|
|
202
|
+
pointer: {
|
|
203
|
+
key: string;
|
|
204
|
+
kind: "context_key";
|
|
205
|
+
} | {
|
|
206
|
+
kind: "context_budget";
|
|
207
|
+
} | {
|
|
208
|
+
kind: "output_contract";
|
|
209
|
+
contractRef: string;
|
|
210
|
+
} | {
|
|
211
|
+
kind: "capability";
|
|
212
|
+
capability: "delegation" | "web_browsing";
|
|
213
|
+
} | {
|
|
214
|
+
kind: "workflow_step";
|
|
215
|
+
stepId: string;
|
|
216
|
+
};
|
|
217
|
+
suggestedFix?: string | undefined;
|
|
218
|
+
}>, "many">>;
|
|
219
|
+
}, "strip", z.ZodTypeAny, {
|
|
220
|
+
blockers: readonly {
|
|
221
|
+
message: string;
|
|
222
|
+
code: "USER_ONLY_DEPENDENCY" | "MISSING_REQUIRED_OUTPUT" | "INVALID_REQUIRED_OUTPUT" | "REQUIRED_CAPABILITY_UNKNOWN" | "REQUIRED_CAPABILITY_UNAVAILABLE" | "INVARIANT_VIOLATION" | "STORAGE_CORRUPTION_DETECTED";
|
|
223
|
+
pointer: {
|
|
224
|
+
key: string;
|
|
225
|
+
kind: "context_key";
|
|
226
|
+
} | {
|
|
227
|
+
kind: "context_budget";
|
|
228
|
+
} | {
|
|
229
|
+
kind: "output_contract";
|
|
230
|
+
contractRef: string;
|
|
231
|
+
} | {
|
|
232
|
+
kind: "capability";
|
|
233
|
+
capability: "delegation" | "web_browsing";
|
|
234
|
+
} | {
|
|
235
|
+
kind: "workflow_step";
|
|
236
|
+
stepId: string;
|
|
237
|
+
};
|
|
238
|
+
suggestedFix?: string | undefined;
|
|
239
|
+
}[];
|
|
240
|
+
}, {
|
|
241
|
+
blockers: readonly {
|
|
242
|
+
message: string;
|
|
243
|
+
code: "USER_ONLY_DEPENDENCY" | "MISSING_REQUIRED_OUTPUT" | "INVALID_REQUIRED_OUTPUT" | "REQUIRED_CAPABILITY_UNKNOWN" | "REQUIRED_CAPABILITY_UNAVAILABLE" | "INVARIANT_VIOLATION" | "STORAGE_CORRUPTION_DETECTED";
|
|
244
|
+
pointer: {
|
|
245
|
+
key: string;
|
|
246
|
+
kind: "context_key";
|
|
247
|
+
} | {
|
|
248
|
+
kind: "context_budget";
|
|
249
|
+
} | {
|
|
250
|
+
kind: "output_contract";
|
|
251
|
+
contractRef: string;
|
|
252
|
+
} | {
|
|
253
|
+
kind: "capability";
|
|
254
|
+
capability: "delegation" | "web_browsing";
|
|
255
|
+
} | {
|
|
256
|
+
kind: "workflow_step";
|
|
257
|
+
stepId: string;
|
|
258
|
+
};
|
|
259
|
+
suggestedFix?: string | undefined;
|
|
260
|
+
}[];
|
|
261
|
+
}>, {
|
|
262
|
+
blockers: readonly {
|
|
263
|
+
message: string;
|
|
264
|
+
code: "USER_ONLY_DEPENDENCY" | "MISSING_REQUIRED_OUTPUT" | "INVALID_REQUIRED_OUTPUT" | "REQUIRED_CAPABILITY_UNKNOWN" | "REQUIRED_CAPABILITY_UNAVAILABLE" | "INVARIANT_VIOLATION" | "STORAGE_CORRUPTION_DETECTED";
|
|
265
|
+
pointer: {
|
|
266
|
+
key: string;
|
|
267
|
+
kind: "context_key";
|
|
268
|
+
} | {
|
|
269
|
+
kind: "context_budget";
|
|
270
|
+
} | {
|
|
271
|
+
kind: "output_contract";
|
|
272
|
+
contractRef: string;
|
|
273
|
+
} | {
|
|
274
|
+
kind: "capability";
|
|
275
|
+
capability: "delegation" | "web_browsing";
|
|
276
|
+
} | {
|
|
277
|
+
kind: "workflow_step";
|
|
278
|
+
stepId: string;
|
|
279
|
+
};
|
|
280
|
+
suggestedFix?: string | undefined;
|
|
281
|
+
}[];
|
|
282
|
+
}, {
|
|
283
|
+
blockers: readonly {
|
|
284
|
+
message: string;
|
|
285
|
+
code: "USER_ONLY_DEPENDENCY" | "MISSING_REQUIRED_OUTPUT" | "INVALID_REQUIRED_OUTPUT" | "REQUIRED_CAPABILITY_UNKNOWN" | "REQUIRED_CAPABILITY_UNAVAILABLE" | "INVARIANT_VIOLATION" | "STORAGE_CORRUPTION_DETECTED";
|
|
286
|
+
pointer: {
|
|
287
|
+
key: string;
|
|
288
|
+
kind: "context_key";
|
|
289
|
+
} | {
|
|
290
|
+
kind: "context_budget";
|
|
291
|
+
} | {
|
|
292
|
+
kind: "output_contract";
|
|
293
|
+
contractRef: string;
|
|
294
|
+
} | {
|
|
295
|
+
kind: "capability";
|
|
296
|
+
capability: "delegation" | "web_browsing";
|
|
297
|
+
} | {
|
|
298
|
+
kind: "workflow_step";
|
|
299
|
+
stepId: string;
|
|
300
|
+
};
|
|
301
|
+
suggestedFix?: string | undefined;
|
|
302
|
+
}[];
|
|
303
|
+
}>;
|
|
304
|
+
export type BlockerV1 = z.infer<typeof BlockerSchema>;
|
|
305
|
+
export type BlockerReportV1 = z.infer<typeof BlockerReportV1Schema>;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BlockerReportV1Schema = exports.BlockerSchema = exports.BlockerPointerSchema = exports.BlockerCodeSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const constants_js_1 = require("../../constants.js");
|
|
6
|
+
const utf8_byte_length_js_1 = require("../lib/utf8-byte-length.js");
|
|
7
|
+
exports.BlockerCodeSchema = zod_1.z.enum([
|
|
8
|
+
'USER_ONLY_DEPENDENCY',
|
|
9
|
+
'MISSING_REQUIRED_OUTPUT',
|
|
10
|
+
'INVALID_REQUIRED_OUTPUT',
|
|
11
|
+
'REQUIRED_CAPABILITY_UNKNOWN',
|
|
12
|
+
'REQUIRED_CAPABILITY_UNAVAILABLE',
|
|
13
|
+
'INVARIANT_VIOLATION',
|
|
14
|
+
'STORAGE_CORRUPTION_DETECTED',
|
|
15
|
+
]);
|
|
16
|
+
exports.BlockerPointerSchema = zod_1.z.discriminatedUnion('kind', [
|
|
17
|
+
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_-]+') }),
|
|
18
|
+
zod_1.z.object({ kind: zod_1.z.literal('context_budget') }),
|
|
19
|
+
zod_1.z.object({ kind: zod_1.z.literal('output_contract'), contractRef: zod_1.z.string().min(1) }),
|
|
20
|
+
zod_1.z.object({ kind: zod_1.z.literal('capability'), capability: zod_1.z.enum(['delegation', 'web_browsing']) }),
|
|
21
|
+
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_-]+') }),
|
|
22
|
+
]);
|
|
23
|
+
exports.BlockerSchema = zod_1.z.object({
|
|
24
|
+
code: exports.BlockerCodeSchema,
|
|
25
|
+
pointer: exports.BlockerPointerSchema,
|
|
26
|
+
message: zod_1.z
|
|
27
|
+
.string()
|
|
28
|
+
.min(1)
|
|
29
|
+
.refine((s) => (0, utf8_byte_length_js_1.utf8ByteLength)(s) <= constants_js_1.MAX_BLOCKER_MESSAGE_BYTES, {
|
|
30
|
+
message: `Blocker message exceeds ${constants_js_1.MAX_BLOCKER_MESSAGE_BYTES} bytes (UTF-8)`,
|
|
31
|
+
}),
|
|
32
|
+
suggestedFix: zod_1.z
|
|
33
|
+
.string()
|
|
34
|
+
.min(1)
|
|
35
|
+
.refine((s) => (0, utf8_byte_length_js_1.utf8ByteLength)(s) <= constants_js_1.MAX_BLOCKER_SUGGESTED_FIX_BYTES, {
|
|
36
|
+
message: `Blocker suggestedFix exceeds ${constants_js_1.MAX_BLOCKER_SUGGESTED_FIX_BYTES} bytes (UTF-8)`,
|
|
37
|
+
})
|
|
38
|
+
.optional(),
|
|
39
|
+
});
|
|
40
|
+
exports.BlockerReportV1Schema = zod_1.z
|
|
41
|
+
.object({
|
|
42
|
+
blockers: zod_1.z.array(exports.BlockerSchema).min(1).max(constants_js_1.MAX_BLOCKERS).readonly(),
|
|
43
|
+
})
|
|
44
|
+
.superRefine((v, ctx) => {
|
|
45
|
+
const keyFor = (b) => {
|
|
46
|
+
const p = b.pointer;
|
|
47
|
+
let ptrStable;
|
|
48
|
+
switch (p.kind) {
|
|
49
|
+
case 'context_key':
|
|
50
|
+
ptrStable = p.key;
|
|
51
|
+
break;
|
|
52
|
+
case 'output_contract':
|
|
53
|
+
ptrStable = p.contractRef;
|
|
54
|
+
break;
|
|
55
|
+
case 'capability':
|
|
56
|
+
ptrStable = p.capability;
|
|
57
|
+
break;
|
|
58
|
+
case 'workflow_step':
|
|
59
|
+
ptrStable = p.stepId;
|
|
60
|
+
break;
|
|
61
|
+
case 'context_budget':
|
|
62
|
+
ptrStable = '';
|
|
63
|
+
break;
|
|
64
|
+
default:
|
|
65
|
+
const _exhaustive = p;
|
|
66
|
+
ptrStable = _exhaustive;
|
|
67
|
+
}
|
|
68
|
+
return `${b.code}|${p.kind}|${String(ptrStable)}`;
|
|
69
|
+
};
|
|
70
|
+
for (let i = 1; i < v.blockers.length; i++) {
|
|
71
|
+
if (keyFor(v.blockers[i - 1]) > keyFor(v.blockers[i])) {
|
|
72
|
+
ctx.addIssue({
|
|
73
|
+
code: zod_1.z.ZodIssueCode.custom,
|
|
74
|
+
message: 'blockers must be deterministically sorted',
|
|
75
|
+
path: ['blockers'],
|
|
76
|
+
});
|
|
77
|
+
break;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
});
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const NodeKindSchema: z.ZodEnum<["step", "checkpoint", "blocked_attempt"]>;
|
|
3
|
+
export declare const NodeCreatedDataV1Schema: z.ZodObject<{
|
|
4
|
+
nodeKind: z.ZodEnum<["step", "checkpoint", "blocked_attempt"]>;
|
|
5
|
+
parentNodeId: z.ZodNullable<z.ZodString>;
|
|
6
|
+
workflowHash: z.ZodEffects<z.ZodString, never, string>;
|
|
7
|
+
snapshotRef: z.ZodEffects<z.ZodString, never, string>;
|
|
8
|
+
}, "strip", z.ZodTypeAny, {
|
|
9
|
+
snapshotRef: never;
|
|
10
|
+
nodeKind: "checkpoint" | "step" | "blocked_attempt";
|
|
11
|
+
parentNodeId: string | null;
|
|
12
|
+
workflowHash: never;
|
|
13
|
+
}, {
|
|
14
|
+
snapshotRef: string;
|
|
15
|
+
nodeKind: "checkpoint" | "step" | "blocked_attempt";
|
|
16
|
+
parentNodeId: string | null;
|
|
17
|
+
workflowHash: string;
|
|
18
|
+
}>;
|
|
19
|
+
export declare const EdgeKindSchema: z.ZodEnum<["acked_step", "checkpoint"]>;
|
|
20
|
+
export declare const EdgeCauseKindSchema: z.ZodEnum<["idempotent_replay", "intentional_fork", "non_tip_advance", "checkpoint_created"]>;
|
|
21
|
+
export declare const EdgeCauseSchema: z.ZodObject<{
|
|
22
|
+
kind: z.ZodEnum<["idempotent_replay", "intentional_fork", "non_tip_advance", "checkpoint_created"]>;
|
|
23
|
+
eventId: z.ZodString;
|
|
24
|
+
}, "strip", z.ZodTypeAny, {
|
|
25
|
+
kind: "intentional_fork" | "non_tip_advance" | "idempotent_replay" | "checkpoint_created";
|
|
26
|
+
eventId: string;
|
|
27
|
+
}, {
|
|
28
|
+
kind: "intentional_fork" | "non_tip_advance" | "idempotent_replay" | "checkpoint_created";
|
|
29
|
+
eventId: string;
|
|
30
|
+
}>;
|
|
31
|
+
export declare const EdgeCreatedDataV1Schema: z.ZodEffects<z.ZodObject<{
|
|
32
|
+
edgeKind: z.ZodEnum<["acked_step", "checkpoint"]>;
|
|
33
|
+
fromNodeId: z.ZodString;
|
|
34
|
+
toNodeId: z.ZodString;
|
|
35
|
+
cause: z.ZodObject<{
|
|
36
|
+
kind: z.ZodEnum<["idempotent_replay", "intentional_fork", "non_tip_advance", "checkpoint_created"]>;
|
|
37
|
+
eventId: z.ZodString;
|
|
38
|
+
}, "strip", z.ZodTypeAny, {
|
|
39
|
+
kind: "intentional_fork" | "non_tip_advance" | "idempotent_replay" | "checkpoint_created";
|
|
40
|
+
eventId: string;
|
|
41
|
+
}, {
|
|
42
|
+
kind: "intentional_fork" | "non_tip_advance" | "idempotent_replay" | "checkpoint_created";
|
|
43
|
+
eventId: string;
|
|
44
|
+
}>;
|
|
45
|
+
}, "strip", z.ZodTypeAny, {
|
|
46
|
+
cause: {
|
|
47
|
+
kind: "intentional_fork" | "non_tip_advance" | "idempotent_replay" | "checkpoint_created";
|
|
48
|
+
eventId: string;
|
|
49
|
+
};
|
|
50
|
+
edgeKind: "acked_step" | "checkpoint";
|
|
51
|
+
fromNodeId: string;
|
|
52
|
+
toNodeId: string;
|
|
53
|
+
}, {
|
|
54
|
+
cause: {
|
|
55
|
+
kind: "intentional_fork" | "non_tip_advance" | "idempotent_replay" | "checkpoint_created";
|
|
56
|
+
eventId: string;
|
|
57
|
+
};
|
|
58
|
+
edgeKind: "acked_step" | "checkpoint";
|
|
59
|
+
fromNodeId: string;
|
|
60
|
+
toNodeId: string;
|
|
61
|
+
}>, {
|
|
62
|
+
cause: {
|
|
63
|
+
kind: "intentional_fork" | "non_tip_advance" | "idempotent_replay" | "checkpoint_created";
|
|
64
|
+
eventId: string;
|
|
65
|
+
};
|
|
66
|
+
edgeKind: "acked_step" | "checkpoint";
|
|
67
|
+
fromNodeId: string;
|
|
68
|
+
toNodeId: string;
|
|
69
|
+
}, {
|
|
70
|
+
cause: {
|
|
71
|
+
kind: "intentional_fork" | "non_tip_advance" | "idempotent_replay" | "checkpoint_created";
|
|
72
|
+
eventId: string;
|
|
73
|
+
};
|
|
74
|
+
edgeKind: "acked_step" | "checkpoint";
|
|
75
|
+
fromNodeId: string;
|
|
76
|
+
toNodeId: string;
|
|
77
|
+
}>;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EdgeCreatedDataV1Schema = exports.EdgeCauseSchema = exports.EdgeCauseKindSchema = exports.EdgeKindSchema = exports.NodeCreatedDataV1Schema = exports.NodeKindSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const index_js_1 = require("../../ids/index.js");
|
|
6
|
+
const constants_js_1 = require("../../constants.js");
|
|
7
|
+
const sha256DigestSchema = zod_1.z
|
|
8
|
+
.string()
|
|
9
|
+
.regex(constants_js_1.SHA256_DIGEST_PATTERN, 'Expected sha256:<64 hex chars>')
|
|
10
|
+
.describe('sha256 digest in WorkRail v2 format');
|
|
11
|
+
const workflowHashSchema = sha256DigestSchema
|
|
12
|
+
.transform((v) => (0, index_js_1.asWorkflowHash)((0, index_js_1.asSha256Digest)(v)))
|
|
13
|
+
.describe('WorkflowHash (sha256 digest of workflow definition)');
|
|
14
|
+
const snapshotRefSchema = sha256DigestSchema
|
|
15
|
+
.transform((v) => (0, index_js_1.asSnapshotRef)((0, index_js_1.asSha256Digest)(v)))
|
|
16
|
+
.describe('SnapshotRef (content-addressed sha256 ref)');
|
|
17
|
+
exports.NodeKindSchema = zod_1.z.enum(['step', 'checkpoint', 'blocked_attempt']);
|
|
18
|
+
exports.NodeCreatedDataV1Schema = zod_1.z.object({
|
|
19
|
+
nodeKind: exports.NodeKindSchema,
|
|
20
|
+
parentNodeId: zod_1.z.string().min(1).nullable(),
|
|
21
|
+
workflowHash: workflowHashSchema,
|
|
22
|
+
snapshotRef: snapshotRefSchema,
|
|
23
|
+
});
|
|
24
|
+
exports.EdgeKindSchema = zod_1.z.enum(['acked_step', 'checkpoint']);
|
|
25
|
+
exports.EdgeCauseKindSchema = zod_1.z.enum(['idempotent_replay', 'intentional_fork', 'non_tip_advance', 'checkpoint_created']);
|
|
26
|
+
exports.EdgeCauseSchema = zod_1.z.object({
|
|
27
|
+
kind: exports.EdgeCauseKindSchema,
|
|
28
|
+
eventId: zod_1.z.string().min(1),
|
|
29
|
+
});
|
|
30
|
+
exports.EdgeCreatedDataV1Schema = zod_1.z
|
|
31
|
+
.object({
|
|
32
|
+
edgeKind: exports.EdgeKindSchema,
|
|
33
|
+
fromNodeId: zod_1.z.string().min(1),
|
|
34
|
+
toNodeId: zod_1.z.string().min(1),
|
|
35
|
+
cause: exports.EdgeCauseSchema,
|
|
36
|
+
})
|
|
37
|
+
.superRefine((v, ctx) => {
|
|
38
|
+
if (v.edgeKind === 'checkpoint' && v.cause.kind !== 'checkpoint_created') {
|
|
39
|
+
ctx.addIssue({
|
|
40
|
+
code: zod_1.z.ZodIssueCode.custom,
|
|
41
|
+
message: 'edgeKind=checkpoint requires cause.kind=checkpoint_created',
|
|
42
|
+
path: ['cause', 'kind'],
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
});
|