@exaudeus/workrail 0.12.0 → 0.13.0
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/enhanced-loop-validator.js +3 -3
- package/dist/application/services/step-output-decoder.d.ts +6 -0
- package/dist/application/services/step-output-decoder.js +49 -0
- package/dist/application/services/validation-engine.d.ts +9 -0
- package/dist/application/services/validation-engine.js +142 -18
- package/dist/application/services/workflow-interpreter.d.ts +1 -1
- package/dist/application/services/workflow-interpreter.js +147 -81
- package/dist/application/services/workflow-service.d.ts +2 -0
- package/dist/application/services/workflow-service.js +3 -3
- package/dist/application/use-cases/validate-step-output.d.ts +2 -0
- package/dist/di/container.js +19 -3
- package/dist/di/tokens.d.ts +3 -0
- package/dist/di/tokens.js +3 -0
- package/dist/domain/execution/state.d.ts +6 -6
- package/dist/domain/workflow-id-policy.d.ts +17 -0
- package/dist/domain/workflow-id-policy.js +57 -0
- package/dist/infrastructure/storage/enhanced-multi-source-workflow-storage.js +33 -6
- package/dist/infrastructure/storage/file-workflow-storage.js +3 -1
- package/dist/infrastructure/storage/schema-validating-workflow-storage.js +13 -8
- package/dist/manifest.json +261 -109
- package/dist/mcp/handlers/v2-execution.js +62 -79
- package/dist/mcp/handlers/v2-workflow.js +14 -9
- package/dist/mcp/server.js +53 -48
- package/dist/mcp/tool-descriptions.js +15 -15
- package/dist/mcp/tools.js +14 -14
- package/dist/mcp/types/tool-description-types.d.ts +1 -1
- package/dist/mcp/types/tool-description-types.js +5 -5
- package/dist/mcp/types.d.ts +2 -0
- package/dist/v2/durable-core/constants.d.ts +15 -0
- package/dist/v2/durable-core/constants.js +18 -0
- package/dist/v2/durable-core/domain/ack-advance-append-plan.d.ts +32 -0
- package/dist/v2/durable-core/domain/ack-advance-append-plan.js +95 -0
- package/dist/v2/durable-core/domain/loop-runtime.d.ts +50 -0
- package/dist/v2/durable-core/domain/loop-runtime.js +95 -0
- package/dist/v2/durable-core/domain/notes-markdown.d.ts +4 -0
- package/dist/v2/durable-core/domain/notes-markdown.js +46 -0
- package/dist/v2/durable-core/domain/outputs.d.ts +12 -0
- package/dist/v2/durable-core/domain/outputs.js +18 -0
- package/dist/v2/durable-core/schemas/execution-snapshot/execution-snapshot.v1.d.ts +113 -113
- package/dist/v2/durable-core/schemas/execution-snapshot/execution-snapshot.v1.js +11 -10
- package/dist/v2/durable-core/schemas/export-bundle/index.d.ts +7129 -0
- package/dist/v2/durable-core/schemas/export-bundle/index.js +82 -0
- package/dist/v2/durable-core/schemas/lib/decision-trace-ref.d.ts +80 -0
- package/dist/v2/durable-core/schemas/lib/decision-trace-ref.js +38 -0
- package/dist/v2/durable-core/schemas/lib/dedupe-key.d.ts +8 -0
- package/dist/v2/durable-core/schemas/lib/dedupe-key.js +28 -0
- package/dist/v2/durable-core/schemas/lib/utf8-bounded-string.d.ts +6 -0
- package/dist/v2/durable-core/schemas/lib/utf8-bounded-string.js +12 -0
- package/dist/v2/durable-core/schemas/session/events.d.ts +158 -12
- package/dist/v2/durable-core/schemas/session/events.js +47 -20
- package/dist/v2/durable-core/schemas/session/manifest.d.ts +1 -1
- package/dist/v2/durable-core/schemas/session/manifest.js +6 -1
- package/dist/v2/durable-core/schemas/session/preferences.d.ts +5 -0
- package/dist/v2/durable-core/schemas/session/preferences.js +6 -0
- package/dist/v2/durable-core/schemas/session/session-health.d.ts +3 -0
- package/dist/v2/durable-core/tokens/index.d.ts +0 -1
- package/dist/v2/durable-core/tokens/index.js +1 -4
- package/dist/v2/durable-core/tokens/token-codec.d.ts +3 -2
- package/dist/v2/durable-core/tokens/token-codec.js +12 -6
- package/dist/v2/durable-core/tokens/token-signer.d.ts +3 -2
- package/dist/v2/durable-core/tokens/token-signer.js +8 -9
- package/dist/v2/infra/local/base64url/index.d.ts +5 -0
- package/dist/v2/infra/local/base64url/index.js +48 -0
- package/dist/v2/infra/local/fs/index.js +8 -4
- package/dist/v2/infra/local/keyring/index.d.ts +5 -1
- package/dist/v2/infra/local/keyring/index.js +41 -32
- package/dist/v2/infra/local/pinned-workflow-store/index.d.ts +3 -1
- package/dist/v2/infra/local/pinned-workflow-store/index.js +50 -62
- package/dist/v2/infra/local/random-entropy/index.d.ts +4 -0
- package/dist/v2/infra/local/random-entropy/index.js +10 -0
- package/dist/v2/infra/local/session-lock/index.d.ts +3 -1
- package/dist/v2/infra/local/session-lock/index.js +4 -3
- package/dist/v2/infra/local/session-store/index.js +26 -4
- package/dist/v2/infra/local/snapshot-store/index.js +20 -25
- package/dist/v2/infra/local/time-clock/index.d.ts +5 -0
- package/dist/v2/infra/local/time-clock/index.js +12 -0
- package/dist/v2/infra/local/utf8/index.d.ts +5 -0
- package/dist/v2/infra/local/utf8/index.js +12 -0
- package/dist/v2/ports/base64url.port.d.ts +12 -0
- package/dist/v2/ports/base64url.port.js +2 -0
- package/dist/v2/ports/random-entropy.port.d.ts +3 -0
- package/dist/v2/ports/random-entropy.port.js +2 -0
- package/dist/v2/ports/time-clock.port.d.ts +4 -0
- package/dist/v2/ports/time-clock.port.js +2 -0
- package/dist/v2/ports/utf8.port.d.ts +3 -0
- package/dist/v2/ports/utf8.port.js +2 -0
- package/dist/v2/projections/node-outputs.js +28 -11
- package/dist/v2/projections/preferences.d.ts +1 -2
- package/dist/v2/projections/preferences.js +11 -4
- package/dist/v2/projections/run-dag.js +40 -28
- package/dist/v2/projections/run-status-signals.d.ts +1 -2
- package/dist/v2/usecases/execution-session-gate.js +33 -34
- package/package.json +3 -1
- package/spec/workflow.schema.json +2 -2
- package/workflows/coding-task-workflow-agentic.json +213 -50
- package/workflows/relocation-workflow-us.json +430 -0
- package/dist/v2/durable-core/tokens/base64url.d.ts +0 -7
- package/dist/v2/durable-core/tokens/base64url.js +0 -16
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
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
|
+
const zod_1 = require("zod");
|
|
7
|
+
const constants_js_1 = require("../../constants.js");
|
|
8
|
+
const index_js_1 = require("../execution-snapshot/index.js");
|
|
9
|
+
const events_js_1 = require("../session/events.js");
|
|
10
|
+
const index_js_2 = require("../session/index.js");
|
|
11
|
+
const Sha256DigestSchema = zod_1.z
|
|
12
|
+
.string()
|
|
13
|
+
.regex(constants_js_1.SHA256_DIGEST_PATTERN, 'Expected sha256:<64 hex chars>')
|
|
14
|
+
.describe('SHA-256 digest in format sha256:<64 lowercase hex>');
|
|
15
|
+
exports.IntegrityEntryV1Schema = zod_1.z.object({
|
|
16
|
+
path: zod_1.z.string().min(1).describe('Location within bundle (e.g., "session/events")'),
|
|
17
|
+
sha256: Sha256DigestSchema.describe('JCS canonical JSON + SHA-256'),
|
|
18
|
+
bytes: zod_1.z.number().int().nonnegative().describe('Byte length of JCS canonical UTF-8'),
|
|
19
|
+
});
|
|
20
|
+
exports.IntegrityManifestV1Schema = zod_1.z.object({
|
|
21
|
+
kind: zod_1.z.literal('sha256_manifest_v1').describe('Integrity scheme identifier'),
|
|
22
|
+
entries: zod_1.z
|
|
23
|
+
.array(exports.IntegrityEntryV1Schema)
|
|
24
|
+
.min(1)
|
|
25
|
+
.describe('Integrity entries for each major artifact path'),
|
|
26
|
+
});
|
|
27
|
+
exports.ProducerInfoV1Schema = zod_1.z.object({
|
|
28
|
+
appVersion: zod_1.z.string().min(1).describe('Application version that produced the bundle'),
|
|
29
|
+
appliedConfigHash: Sha256DigestSchema.optional().describe('Optional: hash of applied config'),
|
|
30
|
+
});
|
|
31
|
+
const SnapshotsMapV1Schema = zod_1.z
|
|
32
|
+
.record(zod_1.z.string().min(1).describe('SnapshotRef (sha256:<digest>)'), index_js_1.ExecutionSnapshotFileV1Schema)
|
|
33
|
+
.describe('Content-addressed snapshot storage');
|
|
34
|
+
const PinnedWorkflowsMapV1Schema = zod_1.z
|
|
35
|
+
.record(zod_1.z.string().min(1).describe('WorkflowHash (sha256:<digest>)'), zod_1.z.unknown().describe('CompiledWorkflowV1 or equivalent snapshot'))
|
|
36
|
+
.describe('Pinned workflow definitions by hash');
|
|
37
|
+
exports.SessionContentsV1Schema = zod_1.z.object({
|
|
38
|
+
sessionId: zod_1.z.string().min(1).describe('Stable session identifier'),
|
|
39
|
+
events: zod_1.z
|
|
40
|
+
.array(events_js_1.DomainEventV1Schema)
|
|
41
|
+
.describe('Ordered session events by ascending eventIndex'),
|
|
42
|
+
manifest: zod_1.z
|
|
43
|
+
.array(index_js_2.ManifestRecordV1Schema)
|
|
44
|
+
.describe('Ordered manifest records by ascending manifestIndex'),
|
|
45
|
+
snapshots: SnapshotsMapV1Schema.describe('Content-addressed snapshot CAS'),
|
|
46
|
+
pinnedWorkflows: PinnedWorkflowsMapV1Schema.describe('Pinned workflow definitions'),
|
|
47
|
+
});
|
|
48
|
+
exports.ExportBundleV1Schema = zod_1.z.object({
|
|
49
|
+
bundleSchemaVersion: zod_1.z.literal(1).describe('Bundle format version (1)'),
|
|
50
|
+
bundleId: zod_1.z.string().min(1).describe('Stable bundle identifier'),
|
|
51
|
+
exportedAt: zod_1.z.string().datetime().describe('ISO 8601 timestamp (informational only)'),
|
|
52
|
+
producer: exports.ProducerInfoV1Schema.describe('Informational producer metadata'),
|
|
53
|
+
integrity: exports.IntegrityManifestV1Schema.describe('Corruption detection manifest'),
|
|
54
|
+
session: exports.SessionContentsV1Schema.describe('Session durable truth'),
|
|
55
|
+
});
|
|
56
|
+
exports.BundleImportErrorCodeSchema = zod_1.z.enum([
|
|
57
|
+
'BUNDLE_INVALID_FORMAT',
|
|
58
|
+
'BUNDLE_UNSUPPORTED_VERSION',
|
|
59
|
+
'BUNDLE_INTEGRITY_FAILED',
|
|
60
|
+
'BUNDLE_MISSING_SNAPSHOT',
|
|
61
|
+
'BUNDLE_MISSING_PINNED_WORKFLOW',
|
|
62
|
+
'BUNDLE_EVENT_ORDER_INVALID',
|
|
63
|
+
'BUNDLE_MANIFEST_ORDER_INVALID',
|
|
64
|
+
]);
|
|
65
|
+
exports.BundleImportErrorSchema = zod_1.z.object({
|
|
66
|
+
code: exports.BundleImportErrorCodeSchema,
|
|
67
|
+
message: zod_1.z.string().min(1).describe('Human-readable error message'),
|
|
68
|
+
retry: zod_1.z.enum(['yes', 'no']).describe('Whether caller should retry'),
|
|
69
|
+
details: zod_1.z.record(zod_1.z.unknown()).optional().describe('Additional debugging context'),
|
|
70
|
+
});
|
|
71
|
+
function importCollisionPolicy(args) {
|
|
72
|
+
return 'import_as_new';
|
|
73
|
+
}
|
|
74
|
+
function importValidationOrder() {
|
|
75
|
+
return ['schema', 'integrity', 'ordering', 'references'];
|
|
76
|
+
}
|
|
77
|
+
var index_js_3 = require("../execution-snapshot/index.js");
|
|
78
|
+
Object.defineProperty(exports, "ExecutionSnapshotFileV1Schema", { enumerable: true, get: function () { return index_js_3.ExecutionSnapshotFileV1Schema; } });
|
|
79
|
+
var events_js_2 = require("../session/events.js");
|
|
80
|
+
Object.defineProperty(exports, "DomainEventV1Schema", { enumerable: true, get: function () { return events_js_2.DomainEventV1Schema; } });
|
|
81
|
+
var index_js_4 = require("../session/index.js");
|
|
82
|
+
Object.defineProperty(exports, "ManifestRecordV1Schema", { enumerable: true, get: function () { return index_js_4.ManifestRecordV1Schema; } });
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const DecisionTraceRefKindSchema: z.ZodEnum<["step_id", "loop_id", "condition_id", "iteration"]>;
|
|
3
|
+
export type DecisionTraceRefKind = z.infer<typeof DecisionTraceRefKindSchema>;
|
|
4
|
+
export declare const DecisionTraceRefV1Schema: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
|
|
5
|
+
kind: z.ZodLiteral<"step_id">;
|
|
6
|
+
stepId: z.ZodString;
|
|
7
|
+
}, "strict", z.ZodTypeAny, {
|
|
8
|
+
kind: "step_id";
|
|
9
|
+
stepId: string;
|
|
10
|
+
}, {
|
|
11
|
+
kind: "step_id";
|
|
12
|
+
stepId: string;
|
|
13
|
+
}>, z.ZodObject<{
|
|
14
|
+
kind: z.ZodLiteral<"loop_id">;
|
|
15
|
+
loopId: z.ZodString;
|
|
16
|
+
}, "strict", z.ZodTypeAny, {
|
|
17
|
+
kind: "loop_id";
|
|
18
|
+
loopId: string;
|
|
19
|
+
}, {
|
|
20
|
+
kind: "loop_id";
|
|
21
|
+
loopId: string;
|
|
22
|
+
}>, z.ZodObject<{
|
|
23
|
+
kind: z.ZodLiteral<"condition_id">;
|
|
24
|
+
conditionId: z.ZodString;
|
|
25
|
+
}, "strict", z.ZodTypeAny, {
|
|
26
|
+
kind: "condition_id";
|
|
27
|
+
conditionId: string;
|
|
28
|
+
}, {
|
|
29
|
+
kind: "condition_id";
|
|
30
|
+
conditionId: string;
|
|
31
|
+
}>, z.ZodObject<{
|
|
32
|
+
kind: z.ZodLiteral<"iteration">;
|
|
33
|
+
value: z.ZodNumber;
|
|
34
|
+
}, "strict", z.ZodTypeAny, {
|
|
35
|
+
value: number;
|
|
36
|
+
kind: "iteration";
|
|
37
|
+
}, {
|
|
38
|
+
value: number;
|
|
39
|
+
kind: "iteration";
|
|
40
|
+
}>]>;
|
|
41
|
+
export type DecisionTraceRefV1 = z.infer<typeof DecisionTraceRefV1Schema>;
|
|
42
|
+
export declare const MAX_DECISION_TRACE_REFS_PER_ENTRY = 10;
|
|
43
|
+
export declare const DecisionTraceRefsV1Schema: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
|
|
44
|
+
kind: z.ZodLiteral<"step_id">;
|
|
45
|
+
stepId: z.ZodString;
|
|
46
|
+
}, "strict", z.ZodTypeAny, {
|
|
47
|
+
kind: "step_id";
|
|
48
|
+
stepId: string;
|
|
49
|
+
}, {
|
|
50
|
+
kind: "step_id";
|
|
51
|
+
stepId: string;
|
|
52
|
+
}>, z.ZodObject<{
|
|
53
|
+
kind: z.ZodLiteral<"loop_id">;
|
|
54
|
+
loopId: z.ZodString;
|
|
55
|
+
}, "strict", z.ZodTypeAny, {
|
|
56
|
+
kind: "loop_id";
|
|
57
|
+
loopId: string;
|
|
58
|
+
}, {
|
|
59
|
+
kind: "loop_id";
|
|
60
|
+
loopId: string;
|
|
61
|
+
}>, z.ZodObject<{
|
|
62
|
+
kind: z.ZodLiteral<"condition_id">;
|
|
63
|
+
conditionId: z.ZodString;
|
|
64
|
+
}, "strict", z.ZodTypeAny, {
|
|
65
|
+
kind: "condition_id";
|
|
66
|
+
conditionId: string;
|
|
67
|
+
}, {
|
|
68
|
+
kind: "condition_id";
|
|
69
|
+
conditionId: string;
|
|
70
|
+
}>, z.ZodObject<{
|
|
71
|
+
kind: z.ZodLiteral<"iteration">;
|
|
72
|
+
value: z.ZodNumber;
|
|
73
|
+
}, "strict", z.ZodTypeAny, {
|
|
74
|
+
value: number;
|
|
75
|
+
kind: "iteration";
|
|
76
|
+
}, {
|
|
77
|
+
value: number;
|
|
78
|
+
kind: "iteration";
|
|
79
|
+
}>]>, "many">>;
|
|
80
|
+
export type DecisionTraceRefsV1 = z.infer<typeof DecisionTraceRefsV1Schema>;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DecisionTraceRefsV1Schema = exports.MAX_DECISION_TRACE_REFS_PER_ENTRY = exports.DecisionTraceRefV1Schema = exports.DecisionTraceRefKindSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const constants_js_1 = require("../../constants.js");
|
|
6
|
+
exports.DecisionTraceRefKindSchema = zod_1.z.enum([
|
|
7
|
+
'step_id',
|
|
8
|
+
'loop_id',
|
|
9
|
+
'condition_id',
|
|
10
|
+
'iteration',
|
|
11
|
+
]);
|
|
12
|
+
const StepIdRefSchema = zod_1.z.object({
|
|
13
|
+
kind: zod_1.z.literal('step_id'),
|
|
14
|
+
stepId: zod_1.z.string().regex(constants_js_1.DELIMITER_SAFE_ID_PATTERN, 'stepId must be delimiter-safe: [a-z0-9_-]+'),
|
|
15
|
+
}).strict();
|
|
16
|
+
const LoopIdRefSchema = zod_1.z.object({
|
|
17
|
+
kind: zod_1.z.literal('loop_id'),
|
|
18
|
+
loopId: zod_1.z.string().regex(constants_js_1.DELIMITER_SAFE_ID_PATTERN, 'loopId must be delimiter-safe: [a-z0-9_-]+'),
|
|
19
|
+
}).strict();
|
|
20
|
+
const ConditionIdRefSchema = zod_1.z.object({
|
|
21
|
+
kind: zod_1.z.literal('condition_id'),
|
|
22
|
+
conditionId: zod_1.z.string().regex(constants_js_1.DELIMITER_SAFE_ID_PATTERN, 'conditionId must be delimiter-safe: [a-z0-9_-]+'),
|
|
23
|
+
}).strict();
|
|
24
|
+
const IterationRefSchema = zod_1.z.object({
|
|
25
|
+
kind: zod_1.z.literal('iteration'),
|
|
26
|
+
value: zod_1.z.number().int().nonnegative(),
|
|
27
|
+
}).strict();
|
|
28
|
+
exports.DecisionTraceRefV1Schema = zod_1.z.discriminatedUnion('kind', [
|
|
29
|
+
StepIdRefSchema,
|
|
30
|
+
LoopIdRefSchema,
|
|
31
|
+
ConditionIdRefSchema,
|
|
32
|
+
IterationRefSchema,
|
|
33
|
+
]);
|
|
34
|
+
exports.MAX_DECISION_TRACE_REFS_PER_ENTRY = 10;
|
|
35
|
+
exports.DecisionTraceRefsV1Schema = zod_1.z
|
|
36
|
+
.array(exports.DecisionTraceRefV1Schema)
|
|
37
|
+
.max(exports.MAX_DECISION_TRACE_REFS_PER_ENTRY)
|
|
38
|
+
.optional();
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { Brand } from '../../../../runtime/brand.js';
|
|
3
|
+
export type DedupeKeyV1 = Brand<string, 'v2.DedupeKeyV1'>;
|
|
4
|
+
export declare const DEDUPE_KEY_PATTERN: RegExp;
|
|
5
|
+
export declare const MAX_DEDUPE_KEY_LENGTH = 256;
|
|
6
|
+
export declare const DedupeKeyV1Schema: z.ZodString;
|
|
7
|
+
export declare function buildDedupeKey(kind: string, parts: readonly string[]): DedupeKeyV1;
|
|
8
|
+
export declare function isValidDedupeKey(value: string): value is DedupeKeyV1;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DedupeKeyV1Schema = exports.MAX_DEDUPE_KEY_LENGTH = exports.DEDUPE_KEY_PATTERN = void 0;
|
|
4
|
+
exports.buildDedupeKey = buildDedupeKey;
|
|
5
|
+
exports.isValidDedupeKey = isValidDedupeKey;
|
|
6
|
+
const zod_1 = require("zod");
|
|
7
|
+
exports.DEDUPE_KEY_PATTERN = /^[a-z0-9_:>-]+$/;
|
|
8
|
+
exports.MAX_DEDUPE_KEY_LENGTH = 256;
|
|
9
|
+
exports.DedupeKeyV1Schema = zod_1.z
|
|
10
|
+
.string()
|
|
11
|
+
.min(1)
|
|
12
|
+
.max(exports.MAX_DEDUPE_KEY_LENGTH)
|
|
13
|
+
.regex(exports.DEDUPE_KEY_PATTERN, 'dedupeKey must be ASCII-safe: [a-z0-9_:->]+');
|
|
14
|
+
function buildDedupeKey(kind, parts) {
|
|
15
|
+
const key = [kind, ...parts].join(':');
|
|
16
|
+
if (!exports.DEDUPE_KEY_PATTERN.test(key)) {
|
|
17
|
+
throw new Error(`Invalid dedupeKey: "${key}" does not match pattern ${exports.DEDUPE_KEY_PATTERN}`);
|
|
18
|
+
}
|
|
19
|
+
if (key.length > exports.MAX_DEDUPE_KEY_LENGTH) {
|
|
20
|
+
throw new Error(`Invalid dedupeKey: "${key}" exceeds max length ${exports.MAX_DEDUPE_KEY_LENGTH}`);
|
|
21
|
+
}
|
|
22
|
+
return key;
|
|
23
|
+
}
|
|
24
|
+
function isValidDedupeKey(value) {
|
|
25
|
+
return (value.length > 0 &&
|
|
26
|
+
value.length <= exports.MAX_DEDUPE_KEY_LENGTH &&
|
|
27
|
+
exports.DEDUPE_KEY_PATTERN.test(value));
|
|
28
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.utf8BoundedString = utf8BoundedString;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
function utf8BoundedString(opts) {
|
|
6
|
+
const encoder = new TextEncoder();
|
|
7
|
+
let schema = zod_1.z.string();
|
|
8
|
+
if (opts.minLength !== undefined && opts.minLength > 0) {
|
|
9
|
+
schema = schema.min(opts.minLength);
|
|
10
|
+
}
|
|
11
|
+
return schema.refine((s) => encoder.encode(s).length <= opts.maxBytes, { message: `${opts.label} exceeds ${opts.maxBytes} UTF-8 bytes` });
|
|
12
|
+
}
|
|
@@ -496,8 +496,8 @@ export declare const DomainEventV1Schema: z.ZodDiscriminatedUnion<"kind", [z.Zod
|
|
|
496
496
|
kind: "workflow_step";
|
|
497
497
|
stepId: string;
|
|
498
498
|
}>]>;
|
|
499
|
-
message: z.ZodString
|
|
500
|
-
suggestedFix: z.ZodOptional<z.ZodString
|
|
499
|
+
message: z.ZodEffects<z.ZodString, string, string>;
|
|
500
|
+
suggestedFix: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
501
501
|
}, "strip", z.ZodTypeAny, {
|
|
502
502
|
message: string;
|
|
503
503
|
code: "USER_ONLY_DEPENDENCY" | "MISSING_REQUIRED_OUTPUT" | "INVALID_REQUIRED_OUTPUT" | "REQUIRED_CAPABILITY_UNKNOWN" | "REQUIRED_CAPABILITY_UNAVAILABLE" | "INVARIANT_VIOLATION" | "STORAGE_CORRUPTION_DETECTED";
|
|
@@ -853,7 +853,7 @@ export declare const DomainEventV1Schema: z.ZodDiscriminatedUnion<"kind", [z.Zod
|
|
|
853
853
|
outputChannel: z.ZodEnum<["recap", "artifact"]>;
|
|
854
854
|
payload: z.ZodDiscriminatedUnion<"payloadKind", [z.ZodObject<{
|
|
855
855
|
payloadKind: z.ZodLiteral<"notes">;
|
|
856
|
-
notesMarkdown: z.ZodString
|
|
856
|
+
notesMarkdown: z.ZodEffects<z.ZodString, string, string>;
|
|
857
857
|
}, "strip", z.ZodTypeAny, {
|
|
858
858
|
payloadKind: "notes";
|
|
859
859
|
notesMarkdown: string;
|
|
@@ -1770,33 +1770,155 @@ export declare const DomainEventV1Schema: z.ZodDiscriminatedUnion<"kind", [z.Zod
|
|
|
1770
1770
|
runId: string;
|
|
1771
1771
|
nodeId: string;
|
|
1772
1772
|
}>;
|
|
1773
|
-
data: z.ZodObject<{
|
|
1773
|
+
data: z.ZodEffects<z.ZodObject<{
|
|
1774
1774
|
traceId: z.ZodString;
|
|
1775
1775
|
entries: z.ZodArray<z.ZodObject<{
|
|
1776
1776
|
kind: z.ZodEnum<["selected_next_step", "evaluated_condition", "entered_loop", "exited_loop", "detected_non_tip_advance"]>;
|
|
1777
|
-
summary: z.ZodString
|
|
1778
|
-
refs: z.ZodOptional<z.
|
|
1777
|
+
summary: z.ZodEffects<z.ZodString, string, string>;
|
|
1778
|
+
refs: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
|
|
1779
|
+
kind: z.ZodLiteral<"step_id">;
|
|
1780
|
+
stepId: z.ZodString;
|
|
1781
|
+
}, "strict", z.ZodTypeAny, {
|
|
1782
|
+
kind: "step_id";
|
|
1783
|
+
stepId: string;
|
|
1784
|
+
}, {
|
|
1785
|
+
kind: "step_id";
|
|
1786
|
+
stepId: string;
|
|
1787
|
+
}>, z.ZodObject<{
|
|
1788
|
+
kind: z.ZodLiteral<"loop_id">;
|
|
1789
|
+
loopId: z.ZodString;
|
|
1790
|
+
}, "strict", z.ZodTypeAny, {
|
|
1791
|
+
kind: "loop_id";
|
|
1792
|
+
loopId: string;
|
|
1793
|
+
}, {
|
|
1794
|
+
kind: "loop_id";
|
|
1795
|
+
loopId: string;
|
|
1796
|
+
}>, z.ZodObject<{
|
|
1797
|
+
kind: z.ZodLiteral<"condition_id">;
|
|
1798
|
+
conditionId: z.ZodString;
|
|
1799
|
+
}, "strict", z.ZodTypeAny, {
|
|
1800
|
+
kind: "condition_id";
|
|
1801
|
+
conditionId: string;
|
|
1802
|
+
}, {
|
|
1803
|
+
kind: "condition_id";
|
|
1804
|
+
conditionId: string;
|
|
1805
|
+
}>, z.ZodObject<{
|
|
1806
|
+
kind: z.ZodLiteral<"iteration">;
|
|
1807
|
+
value: z.ZodNumber;
|
|
1808
|
+
}, "strict", z.ZodTypeAny, {
|
|
1809
|
+
value: number;
|
|
1810
|
+
kind: "iteration";
|
|
1811
|
+
}, {
|
|
1812
|
+
value: number;
|
|
1813
|
+
kind: "iteration";
|
|
1814
|
+
}>]>, "many">>;
|
|
1779
1815
|
}, "strip", z.ZodTypeAny, {
|
|
1780
1816
|
kind: "selected_next_step" | "evaluated_condition" | "entered_loop" | "exited_loop" | "detected_non_tip_advance";
|
|
1781
1817
|
summary: string;
|
|
1782
|
-
refs?:
|
|
1818
|
+
refs?: ({
|
|
1819
|
+
kind: "step_id";
|
|
1820
|
+
stepId: string;
|
|
1821
|
+
} | {
|
|
1822
|
+
kind: "loop_id";
|
|
1823
|
+
loopId: string;
|
|
1824
|
+
} | {
|
|
1825
|
+
kind: "condition_id";
|
|
1826
|
+
conditionId: string;
|
|
1827
|
+
} | {
|
|
1828
|
+
value: number;
|
|
1829
|
+
kind: "iteration";
|
|
1830
|
+
})[] | undefined;
|
|
1783
1831
|
}, {
|
|
1784
1832
|
kind: "selected_next_step" | "evaluated_condition" | "entered_loop" | "exited_loop" | "detected_non_tip_advance";
|
|
1785
1833
|
summary: string;
|
|
1786
|
-
refs?:
|
|
1834
|
+
refs?: ({
|
|
1835
|
+
kind: "step_id";
|
|
1836
|
+
stepId: string;
|
|
1837
|
+
} | {
|
|
1838
|
+
kind: "loop_id";
|
|
1839
|
+
loopId: string;
|
|
1840
|
+
} | {
|
|
1841
|
+
kind: "condition_id";
|
|
1842
|
+
conditionId: string;
|
|
1843
|
+
} | {
|
|
1844
|
+
value: number;
|
|
1845
|
+
kind: "iteration";
|
|
1846
|
+
})[] | undefined;
|
|
1787
1847
|
}>, "many">;
|
|
1788
1848
|
}, "strip", z.ZodTypeAny, {
|
|
1789
1849
|
entries: {
|
|
1790
1850
|
kind: "selected_next_step" | "evaluated_condition" | "entered_loop" | "exited_loop" | "detected_non_tip_advance";
|
|
1791
1851
|
summary: string;
|
|
1792
|
-
refs?:
|
|
1852
|
+
refs?: ({
|
|
1853
|
+
kind: "step_id";
|
|
1854
|
+
stepId: string;
|
|
1855
|
+
} | {
|
|
1856
|
+
kind: "loop_id";
|
|
1857
|
+
loopId: string;
|
|
1858
|
+
} | {
|
|
1859
|
+
kind: "condition_id";
|
|
1860
|
+
conditionId: string;
|
|
1861
|
+
} | {
|
|
1862
|
+
value: number;
|
|
1863
|
+
kind: "iteration";
|
|
1864
|
+
})[] | undefined;
|
|
1865
|
+
}[];
|
|
1866
|
+
traceId: string;
|
|
1867
|
+
}, {
|
|
1868
|
+
entries: {
|
|
1869
|
+
kind: "selected_next_step" | "evaluated_condition" | "entered_loop" | "exited_loop" | "detected_non_tip_advance";
|
|
1870
|
+
summary: string;
|
|
1871
|
+
refs?: ({
|
|
1872
|
+
kind: "step_id";
|
|
1873
|
+
stepId: string;
|
|
1874
|
+
} | {
|
|
1875
|
+
kind: "loop_id";
|
|
1876
|
+
loopId: string;
|
|
1877
|
+
} | {
|
|
1878
|
+
kind: "condition_id";
|
|
1879
|
+
conditionId: string;
|
|
1880
|
+
} | {
|
|
1881
|
+
value: number;
|
|
1882
|
+
kind: "iteration";
|
|
1883
|
+
})[] | undefined;
|
|
1884
|
+
}[];
|
|
1885
|
+
traceId: string;
|
|
1886
|
+
}>, {
|
|
1887
|
+
entries: {
|
|
1888
|
+
kind: "selected_next_step" | "evaluated_condition" | "entered_loop" | "exited_loop" | "detected_non_tip_advance";
|
|
1889
|
+
summary: string;
|
|
1890
|
+
refs?: ({
|
|
1891
|
+
kind: "step_id";
|
|
1892
|
+
stepId: string;
|
|
1893
|
+
} | {
|
|
1894
|
+
kind: "loop_id";
|
|
1895
|
+
loopId: string;
|
|
1896
|
+
} | {
|
|
1897
|
+
kind: "condition_id";
|
|
1898
|
+
conditionId: string;
|
|
1899
|
+
} | {
|
|
1900
|
+
value: number;
|
|
1901
|
+
kind: "iteration";
|
|
1902
|
+
})[] | undefined;
|
|
1793
1903
|
}[];
|
|
1794
1904
|
traceId: string;
|
|
1795
1905
|
}, {
|
|
1796
1906
|
entries: {
|
|
1797
1907
|
kind: "selected_next_step" | "evaluated_condition" | "entered_loop" | "exited_loop" | "detected_non_tip_advance";
|
|
1798
1908
|
summary: string;
|
|
1799
|
-
refs?:
|
|
1909
|
+
refs?: ({
|
|
1910
|
+
kind: "step_id";
|
|
1911
|
+
stepId: string;
|
|
1912
|
+
} | {
|
|
1913
|
+
kind: "loop_id";
|
|
1914
|
+
loopId: string;
|
|
1915
|
+
} | {
|
|
1916
|
+
kind: "condition_id";
|
|
1917
|
+
conditionId: string;
|
|
1918
|
+
} | {
|
|
1919
|
+
value: number;
|
|
1920
|
+
kind: "iteration";
|
|
1921
|
+
})[] | undefined;
|
|
1800
1922
|
}[];
|
|
1801
1923
|
traceId: string;
|
|
1802
1924
|
}>;
|
|
@@ -1807,7 +1929,19 @@ export declare const DomainEventV1Schema: z.ZodDiscriminatedUnion<"kind", [z.Zod
|
|
|
1807
1929
|
entries: {
|
|
1808
1930
|
kind: "selected_next_step" | "evaluated_condition" | "entered_loop" | "exited_loop" | "detected_non_tip_advance";
|
|
1809
1931
|
summary: string;
|
|
1810
|
-
refs?:
|
|
1932
|
+
refs?: ({
|
|
1933
|
+
kind: "step_id";
|
|
1934
|
+
stepId: string;
|
|
1935
|
+
} | {
|
|
1936
|
+
kind: "loop_id";
|
|
1937
|
+
loopId: string;
|
|
1938
|
+
} | {
|
|
1939
|
+
kind: "condition_id";
|
|
1940
|
+
conditionId: string;
|
|
1941
|
+
} | {
|
|
1942
|
+
value: number;
|
|
1943
|
+
kind: "iteration";
|
|
1944
|
+
})[] | undefined;
|
|
1811
1945
|
}[];
|
|
1812
1946
|
traceId: string;
|
|
1813
1947
|
};
|
|
@@ -1826,7 +1960,19 @@ export declare const DomainEventV1Schema: z.ZodDiscriminatedUnion<"kind", [z.Zod
|
|
|
1826
1960
|
entries: {
|
|
1827
1961
|
kind: "selected_next_step" | "evaluated_condition" | "entered_loop" | "exited_loop" | "detected_non_tip_advance";
|
|
1828
1962
|
summary: string;
|
|
1829
|
-
refs?:
|
|
1963
|
+
refs?: ({
|
|
1964
|
+
kind: "step_id";
|
|
1965
|
+
stepId: string;
|
|
1966
|
+
} | {
|
|
1967
|
+
kind: "loop_id";
|
|
1968
|
+
loopId: string;
|
|
1969
|
+
} | {
|
|
1970
|
+
kind: "condition_id";
|
|
1971
|
+
conditionId: string;
|
|
1972
|
+
} | {
|
|
1973
|
+
value: number;
|
|
1974
|
+
kind: "iteration";
|
|
1975
|
+
})[] | undefined;
|
|
1830
1976
|
}[];
|
|
1831
1977
|
traceId: string;
|
|
1832
1978
|
};
|
|
@@ -4,9 +4,17 @@ exports.DomainEventV1Schema = exports.DomainEventEnvelopeV1Schema = void 0;
|
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const json_zod_js_1 = require("../../canonical/json-zod.js");
|
|
6
6
|
const index_js_1 = require("../../ids/index.js");
|
|
7
|
+
const preferences_js_1 = require("./preferences.js");
|
|
8
|
+
const constants_js_1 = require("../../constants.js");
|
|
9
|
+
const decision_trace_ref_js_1 = require("../lib/decision-trace-ref.js");
|
|
10
|
+
const dedupe_key_js_1 = require("../lib/dedupe-key.js");
|
|
11
|
+
const utf8_bounded_string_js_1 = require("../lib/utf8-bounded-string.js");
|
|
12
|
+
function utf8ByteLength(s) {
|
|
13
|
+
return new TextEncoder().encode(s).length;
|
|
14
|
+
}
|
|
7
15
|
const sha256DigestSchema = zod_1.z
|
|
8
16
|
.string()
|
|
9
|
-
.regex(
|
|
17
|
+
.regex(constants_js_1.SHA256_DIGEST_PATTERN, 'Expected sha256:<64 hex chars>')
|
|
10
18
|
.describe('sha256 digest in WorkRail v2 format');
|
|
11
19
|
const workflowHashSchema = sha256DigestSchema
|
|
12
20
|
.transform((v) => (0, index_js_1.asWorkflowHash)((0, index_js_1.asSha256Digest)(v)))
|
|
@@ -20,7 +28,7 @@ exports.DomainEventEnvelopeV1Schema = zod_1.z.object({
|
|
|
20
28
|
eventIndex: zod_1.z.number().int().nonnegative(),
|
|
21
29
|
sessionId: zod_1.z.string().min(1),
|
|
22
30
|
kind: zod_1.z.string().min(1),
|
|
23
|
-
dedupeKey:
|
|
31
|
+
dedupeKey: dedupe_key_js_1.DedupeKeyV1Schema,
|
|
24
32
|
scope: zod_1.z
|
|
25
33
|
.object({
|
|
26
34
|
runId: zod_1.z.string().min(1).optional(),
|
|
@@ -68,7 +76,12 @@ const EdgeCreatedDataV1Schema = zod_1.z
|
|
|
68
76
|
const OutputChannelSchema = zod_1.z.enum(['recap', 'artifact']);
|
|
69
77
|
const NotesPayloadV1Schema = zod_1.z.object({
|
|
70
78
|
payloadKind: zod_1.z.literal('notes'),
|
|
71
|
-
notesMarkdown: zod_1.z
|
|
79
|
+
notesMarkdown: zod_1.z
|
|
80
|
+
.string()
|
|
81
|
+
.min(1)
|
|
82
|
+
.refine((s) => utf8ByteLength(s) <= constants_js_1.MAX_OUTPUT_NOTES_MARKDOWN_BYTES, {
|
|
83
|
+
message: `notesMarkdown exceeds max ${constants_js_1.MAX_OUTPUT_NOTES_MARKDOWN_BYTES} UTF-8 bytes`,
|
|
84
|
+
}),
|
|
72
85
|
});
|
|
73
86
|
const ArtifactRefPayloadV1Schema = zod_1.z.object({
|
|
74
87
|
payloadKind: zod_1.z.literal('artifact_ref'),
|
|
@@ -103,21 +116,32 @@ const BlockerCodeSchema = zod_1.z.enum([
|
|
|
103
116
|
'STORAGE_CORRUPTION_DETECTED',
|
|
104
117
|
]);
|
|
105
118
|
const BlockerPointerSchema = zod_1.z.discriminatedUnion('kind', [
|
|
106
|
-
zod_1.z.object({ kind: zod_1.z.literal('context_key'), key: zod_1.z.string().min(1) }),
|
|
119
|
+
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_-]+') }),
|
|
107
120
|
zod_1.z.object({ kind: zod_1.z.literal('context_budget') }),
|
|
108
121
|
zod_1.z.object({ kind: zod_1.z.literal('output_contract'), contractRef: zod_1.z.string().min(1) }),
|
|
109
122
|
zod_1.z.object({ kind: zod_1.z.literal('capability'), capability: zod_1.z.enum(['delegation', 'web_browsing']) }),
|
|
110
|
-
zod_1.z.object({ kind: zod_1.z.literal('workflow_step'), stepId: zod_1.z.string().min(1) }),
|
|
123
|
+
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_-]+') }),
|
|
111
124
|
]);
|
|
112
125
|
const BlockerSchema = zod_1.z.object({
|
|
113
126
|
code: BlockerCodeSchema,
|
|
114
127
|
pointer: BlockerPointerSchema,
|
|
115
|
-
message: zod_1.z
|
|
116
|
-
|
|
128
|
+
message: zod_1.z
|
|
129
|
+
.string()
|
|
130
|
+
.min(1)
|
|
131
|
+
.refine((s) => utf8ByteLength(s) <= constants_js_1.MAX_BLOCKER_MESSAGE_BYTES, {
|
|
132
|
+
message: `Blocker message exceeds ${constants_js_1.MAX_BLOCKER_MESSAGE_BYTES} bytes (UTF-8)`,
|
|
133
|
+
}),
|
|
134
|
+
suggestedFix: zod_1.z
|
|
135
|
+
.string()
|
|
136
|
+
.min(1)
|
|
137
|
+
.refine((s) => utf8ByteLength(s) <= constants_js_1.MAX_BLOCKER_SUGGESTED_FIX_BYTES, {
|
|
138
|
+
message: `Blocker suggestedFix exceeds ${constants_js_1.MAX_BLOCKER_SUGGESTED_FIX_BYTES} bytes (UTF-8)`,
|
|
139
|
+
})
|
|
140
|
+
.optional(),
|
|
117
141
|
});
|
|
118
142
|
const BlockerReportV1Schema = zod_1.z
|
|
119
143
|
.object({
|
|
120
|
-
blockers: zod_1.z.array(BlockerSchema).min(1).max(
|
|
144
|
+
blockers: zod_1.z.array(BlockerSchema).min(1).max(constants_js_1.MAX_BLOCKERS),
|
|
121
145
|
})
|
|
122
146
|
.superRefine((v, ctx) => {
|
|
123
147
|
const keyFor = (b) => {
|
|
@@ -165,21 +189,19 @@ const AdvanceRecordedDataV1Schema = zod_1.z.object({
|
|
|
165
189
|
intent: zod_1.z.literal('ack_pending'),
|
|
166
190
|
outcome: AdvanceRecordedOutcomeV1Schema,
|
|
167
191
|
});
|
|
168
|
-
const AutonomySchema = zod_1.z.enum(['guided', 'full_auto_stop_on_user_deps', 'full_auto_never_stop']);
|
|
169
|
-
const RiskPolicySchema = zod_1.z.enum(['conservative', 'balanced', 'aggressive']);
|
|
170
192
|
const PreferencesChangedDataV1Schema = zod_1.z
|
|
171
193
|
.object({
|
|
172
194
|
changeId: zod_1.z.string().min(1),
|
|
173
195
|
source: zod_1.z.enum(['user', 'workflow_recommendation', 'system']),
|
|
174
196
|
delta: zod_1.z
|
|
175
197
|
.array(zod_1.z.discriminatedUnion('key', [
|
|
176
|
-
zod_1.z.object({ key: zod_1.z.literal('autonomy'), value:
|
|
177
|
-
zod_1.z.object({ key: zod_1.z.literal('riskPolicy'), value:
|
|
198
|
+
zod_1.z.object({ key: zod_1.z.literal('autonomy'), value: preferences_js_1.AutonomyV2Schema }),
|
|
199
|
+
zod_1.z.object({ key: zod_1.z.literal('riskPolicy'), value: preferences_js_1.RiskPolicyV2Schema }),
|
|
178
200
|
]))
|
|
179
201
|
.min(1),
|
|
180
202
|
effective: zod_1.z.object({
|
|
181
|
-
autonomy:
|
|
182
|
-
riskPolicy:
|
|
203
|
+
autonomy: preferences_js_1.AutonomyV2Schema,
|
|
204
|
+
riskPolicy: preferences_js_1.RiskPolicyV2Schema,
|
|
183
205
|
}),
|
|
184
206
|
})
|
|
185
207
|
.superRefine((v, ctx) => {
|
|
@@ -230,7 +252,7 @@ exports.DomainEventV1Schema = zod_1.z.discriminatedUnion('kind', [
|
|
|
230
252
|
data: zod_1.z.object({
|
|
231
253
|
key: zod_1.z.enum(['git_branch', 'git_head_sha', 'repo_root_hash']),
|
|
232
254
|
value: zod_1.z.discriminatedUnion('type', [
|
|
233
|
-
zod_1.z.object({ type: zod_1.z.literal('short_string'), value: zod_1.z.string().min(1).max(
|
|
255
|
+
zod_1.z.object({ type: zod_1.z.literal('short_string'), value: zod_1.z.string().min(1).max(constants_js_1.MAX_OBSERVATION_SHORT_STRING_LENGTH) }),
|
|
234
256
|
zod_1.z.object({ type: zod_1.z.literal('git_sha1'), value: zod_1.z.string().regex(/^[0-9a-f]{40}$/) }),
|
|
235
257
|
zod_1.z.object({ type: zod_1.z.literal('sha256'), value: sha256DigestSchema }),
|
|
236
258
|
]),
|
|
@@ -335,16 +357,21 @@ exports.DomainEventV1Schema = zod_1.z.discriminatedUnion('kind', [
|
|
|
335
357
|
exports.DomainEventEnvelopeV1Schema.extend({
|
|
336
358
|
kind: zod_1.z.literal('decision_trace_appended'),
|
|
337
359
|
scope: zod_1.z.object({ runId: zod_1.z.string().min(1), nodeId: zod_1.z.string().min(1) }),
|
|
338
|
-
data: zod_1.z
|
|
360
|
+
data: zod_1.z
|
|
361
|
+
.object({
|
|
339
362
|
traceId: zod_1.z.string().min(1),
|
|
340
363
|
entries: zod_1.z
|
|
341
364
|
.array(zod_1.z.object({
|
|
342
365
|
kind: zod_1.z.enum(['selected_next_step', 'evaluated_condition', 'entered_loop', 'exited_loop', 'detected_non_tip_advance']),
|
|
343
|
-
summary:
|
|
344
|
-
refs:
|
|
366
|
+
summary: (0, utf8_bounded_string_js_1.utf8BoundedString)({ maxBytes: constants_js_1.MAX_DECISION_TRACE_ENTRY_SUMMARY_BYTES, label: 'decision trace entry summary', minLength: 1 }),
|
|
367
|
+
refs: decision_trace_ref_js_1.DecisionTraceRefsV1Schema,
|
|
345
368
|
}))
|
|
346
369
|
.min(1)
|
|
347
|
-
.max(
|
|
348
|
-
})
|
|
370
|
+
.max(constants_js_1.MAX_DECISION_TRACE_ENTRIES),
|
|
371
|
+
})
|
|
372
|
+
.refine((data) => {
|
|
373
|
+
const totalBytes = data.entries.reduce((sum, entry) => sum + utf8ByteLength(entry.summary), 0);
|
|
374
|
+
return totalBytes <= constants_js_1.MAX_DECISION_TRACE_TOTAL_BYTES;
|
|
375
|
+
}, { message: `Decision trace total bytes exceeds ${constants_js_1.MAX_DECISION_TRACE_TOTAL_BYTES}` }),
|
|
349
376
|
}),
|
|
350
377
|
]);
|
|
@@ -6,7 +6,7 @@ export declare const ManifestRecordV1Schema: z.ZodDiscriminatedUnion<"kind", [z.
|
|
|
6
6
|
kind: z.ZodLiteral<"segment_closed">;
|
|
7
7
|
firstEventIndex: z.ZodNumber;
|
|
8
8
|
lastEventIndex: z.ZodNumber;
|
|
9
|
-
segmentRelPath: z.ZodString
|
|
9
|
+
segmentRelPath: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
10
10
|
sha256: z.ZodString;
|
|
11
11
|
bytes: z.ZodNumber;
|
|
12
12
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -6,6 +6,11 @@ const sha256DigestSchema = zod_1.z
|
|
|
6
6
|
.string()
|
|
7
7
|
.regex(/^sha256:[0-9a-f]{64}$/, 'Expected sha256:<64 hex chars>')
|
|
8
8
|
.describe('sha256 digest in WorkRail v2 format');
|
|
9
|
+
const relativePathSchema = zod_1.z
|
|
10
|
+
.string()
|
|
11
|
+
.min(1)
|
|
12
|
+
.refine((path) => !path.startsWith('/') && !path.startsWith('\\'), 'Path must be relative (no absolute paths)')
|
|
13
|
+
.refine((path) => !path.includes('../') && !path.includes('..\\'), 'Path must not contain path traversal (..)');
|
|
9
14
|
exports.ManifestRecordV1Schema = zod_1.z.discriminatedUnion('kind', [
|
|
10
15
|
zod_1.z.object({
|
|
11
16
|
v: zod_1.z.literal(1),
|
|
@@ -14,7 +19,7 @@ exports.ManifestRecordV1Schema = zod_1.z.discriminatedUnion('kind', [
|
|
|
14
19
|
kind: zod_1.z.literal('segment_closed'),
|
|
15
20
|
firstEventIndex: zod_1.z.number().int().nonnegative(),
|
|
16
21
|
lastEventIndex: zod_1.z.number().int().nonnegative(),
|
|
17
|
-
segmentRelPath:
|
|
22
|
+
segmentRelPath: relativePathSchema,
|
|
18
23
|
sha256: sha256DigestSchema,
|
|
19
24
|
bytes: zod_1.z.number().int().nonnegative(),
|
|
20
25
|
}),
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export type AutonomyV2 = 'guided' | 'full_auto_stop_on_user_deps' | 'full_auto_never_stop';
|
|
3
|
+
export type RiskPolicyV2 = 'conservative' | 'balanced' | 'aggressive';
|
|
4
|
+
export declare const AutonomyV2Schema: z.ZodEnum<["guided", "full_auto_stop_on_user_deps", "full_auto_never_stop"]>;
|
|
5
|
+
export declare const RiskPolicyV2Schema: z.ZodEnum<["conservative", "balanced", "aggressive"]>;
|