@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
|
@@ -2,13 +2,14 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.loadValidationResultV1 = loadValidationResultV1;
|
|
4
4
|
const neverthrow_1 = require("neverthrow");
|
|
5
|
+
const constants_js_1 = require("../constants.js");
|
|
5
6
|
function loadValidationResultV1(events, validationId) {
|
|
6
7
|
if (!validationId) {
|
|
7
8
|
return (0, neverthrow_1.ok)(null);
|
|
8
9
|
}
|
|
9
10
|
let latest = null;
|
|
10
11
|
for (const e of events) {
|
|
11
|
-
if (e.kind !==
|
|
12
|
+
if (e.kind !== constants_js_1.EVENT_KIND.VALIDATION_PERFORMED)
|
|
12
13
|
continue;
|
|
13
14
|
if (e.data.validationId !== validationId)
|
|
14
15
|
continue;
|
|
@@ -14,21 +14,16 @@ function extractValidationRequirements(criteria) {
|
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
function extractRequirementsRecursive(criteria) {
|
|
17
|
-
const requirements = [];
|
|
18
17
|
if ((0, validation_js_1.isValidationRule)(criteria)) {
|
|
19
18
|
const formatted = formatRule(criteria);
|
|
20
|
-
|
|
21
|
-
requirements.push(formatted);
|
|
22
|
-
return requirements;
|
|
19
|
+
return formatted ? [formatted] : [];
|
|
23
20
|
}
|
|
24
21
|
if ((0, validation_js_1.isValidationComposition)(criteria)) {
|
|
25
22
|
if (criteria.and) {
|
|
26
|
-
|
|
27
|
-
requirements.push(...extractRequirementsRecursive(sub));
|
|
28
|
-
}
|
|
23
|
+
return criteria.and.flatMap(extractRequirementsRecursive);
|
|
29
24
|
}
|
|
30
25
|
}
|
|
31
|
-
return
|
|
26
|
+
return [];
|
|
32
27
|
}
|
|
33
28
|
function formatRule(rule) {
|
|
34
29
|
switch (rule.type) {
|
|
@@ -36,20 +31,19 @@ function formatRule(rule) {
|
|
|
36
31
|
if (!rule.value)
|
|
37
32
|
return null;
|
|
38
33
|
return `Must contain: "${rule.value}"`;
|
|
39
|
-
case 'regex':
|
|
34
|
+
case 'regex': {
|
|
40
35
|
if (!rule.pattern)
|
|
41
36
|
return null;
|
|
42
37
|
const flags = rule.flags ? ` (flags: ${rule.flags})` : '';
|
|
43
38
|
return `Must match pattern: ${rule.pattern}${flags}`;
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
return `Length: ${parts.join(', ')}`;
|
|
39
|
+
}
|
|
40
|
+
case 'length': {
|
|
41
|
+
const constraints = [
|
|
42
|
+
rule.min !== undefined ? `≥${rule.min} chars` : null,
|
|
43
|
+
rule.max !== undefined ? `≤${rule.max} chars` : null,
|
|
44
|
+
].filter((c) => c !== null);
|
|
45
|
+
return constraints.length > 0 ? `Length: ${constraints.join(', ')}` : null;
|
|
46
|
+
}
|
|
53
47
|
case 'schema':
|
|
54
48
|
return null;
|
|
55
49
|
default:
|
|
@@ -1,5 +1,17 @@
|
|
|
1
|
+
import type { Result } from 'neverthrow';
|
|
1
2
|
export type Base32LowerNoPad = string & {
|
|
2
3
|
readonly __brand: 'v2.Base32LowerNoPad';
|
|
3
4
|
};
|
|
5
|
+
export type Base32DecodeError = {
|
|
6
|
+
readonly code: 'BASE32_INVALID_CHARACTERS';
|
|
7
|
+
readonly message: string;
|
|
8
|
+
readonly position?: number;
|
|
9
|
+
} | {
|
|
10
|
+
readonly code: 'BASE32_INVALID_LENGTH';
|
|
11
|
+
readonly message: string;
|
|
12
|
+
} | {
|
|
13
|
+
readonly code: 'BASE32_NON_CANONICAL';
|
|
14
|
+
readonly message: string;
|
|
15
|
+
};
|
|
4
16
|
export declare function encodeBase32LowerNoPad(bytes: Uint8Array): Base32LowerNoPad;
|
|
5
|
-
export declare function decodeBase32LowerNoPad(encoded: string): Uint8Array
|
|
17
|
+
export declare function decodeBase32LowerNoPad(encoded: string): Result<Uint8Array, Base32DecodeError>;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.encodeBase32LowerNoPad = encodeBase32LowerNoPad;
|
|
4
4
|
exports.decodeBase32LowerNoPad = decodeBase32LowerNoPad;
|
|
5
|
+
const neverthrow_1 = require("neverthrow");
|
|
5
6
|
const BASE32_LOWER_ALPHABET = 'abcdefghijklmnopqrstuvwxyz234567';
|
|
6
7
|
function encodeBase32LowerNoPad(bytes) {
|
|
7
8
|
let out = '';
|
|
@@ -33,19 +34,28 @@ function decodeBase32LowerNoPad(encoded) {
|
|
|
33
34
|
const lookup = new Map(BASE32_LOWER_ALPHABET.split('').map((c, i) => [c, i]));
|
|
34
35
|
let acc = 0n;
|
|
35
36
|
const totalBits = encoded.length * 5;
|
|
37
|
+
let position = 0;
|
|
36
38
|
for (const char of encoded) {
|
|
37
39
|
const val = lookup.get(char);
|
|
38
40
|
if (val === undefined) {
|
|
39
|
-
|
|
41
|
+
return (0, neverthrow_1.err)({
|
|
42
|
+
code: 'BASE32_INVALID_CHARACTERS',
|
|
43
|
+
message: `Invalid base32 character: '${char}'`,
|
|
44
|
+
position,
|
|
45
|
+
});
|
|
40
46
|
}
|
|
41
47
|
acc = (acc << 5n) | BigInt(val);
|
|
48
|
+
position++;
|
|
42
49
|
}
|
|
43
50
|
const byteCount = Math.floor(totalBits / 8);
|
|
44
51
|
const paddingBits = totalBits - byteCount * 8;
|
|
45
52
|
if (paddingBits > 0) {
|
|
46
53
|
const paddingMask = (1n << BigInt(paddingBits)) - 1n;
|
|
47
54
|
if ((acc & paddingMask) !== 0n) {
|
|
48
|
-
|
|
55
|
+
return (0, neverthrow_1.err)({
|
|
56
|
+
code: 'BASE32_NON_CANONICAL',
|
|
57
|
+
message: 'Non-canonical base32 encoding (padding bits non-zero)',
|
|
58
|
+
});
|
|
49
59
|
}
|
|
50
60
|
acc >>= BigInt(paddingBits);
|
|
51
61
|
}
|
|
@@ -54,5 +64,5 @@ function decodeBase32LowerNoPad(encoded) {
|
|
|
54
64
|
bytes[i] = Number(acc & 0xffn);
|
|
55
65
|
acc >>= 8n;
|
|
56
66
|
}
|
|
57
|
-
return bytes;
|
|
67
|
+
return (0, neverthrow_1.ok)(bytes);
|
|
58
68
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.hexToBytes = hexToBytes;
|
|
4
|
+
const neverthrow_1 = require("neverthrow");
|
|
5
|
+
function hexToBytes(hex) {
|
|
6
|
+
if (hex.length % 2 !== 0) {
|
|
7
|
+
return (0, neverthrow_1.err)({ code: 'INVALID_HEX', message: 'hex string must have even length' });
|
|
8
|
+
}
|
|
9
|
+
const out = new Uint8Array(hex.length / 2);
|
|
10
|
+
for (let i = 0; i < out.length; i++) {
|
|
11
|
+
const byteHex = hex.slice(i * 2, i * 2 + 2);
|
|
12
|
+
const n = Number.parseInt(byteHex, 16);
|
|
13
|
+
if (Number.isNaN(n)) {
|
|
14
|
+
return (0, neverthrow_1.err)({ code: 'INVALID_HEX', message: `invalid hex byte: ${byteHex}` });
|
|
15
|
+
}
|
|
16
|
+
out[i] = n;
|
|
17
|
+
}
|
|
18
|
+
return (0, neverthrow_1.ok)(out);
|
|
19
|
+
}
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
import type { Result } from 'neverthrow';
|
|
1
2
|
import type { Sha256PortV2 } from '../../ports/sha256.port.js';
|
|
2
3
|
import type { AttemptId } from './index.js';
|
|
3
|
-
export
|
|
4
|
+
export type AttemptIdDerivationError = {
|
|
5
|
+
readonly code: 'INVALID_HEX' | 'INVALID_DIGEST_FORMAT';
|
|
6
|
+
readonly message: string;
|
|
7
|
+
};
|
|
8
|
+
export declare function deriveChildAttemptId(parent: AttemptId, sha256: Sha256PortV2): Result<AttemptId, AttemptIdDerivationError>;
|
|
@@ -1,32 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.deriveChildAttemptId = deriveChildAttemptId;
|
|
4
|
+
const neverthrow_1 = require("neverthrow");
|
|
4
5
|
const index_js_1 = require("./index.js");
|
|
5
6
|
const base32_lower_js_1 = require("../encoding/base32-lower.js");
|
|
7
|
+
const hex_to_bytes_js_1 = require("../encoding/hex-to-bytes.js");
|
|
6
8
|
const PREFIX = 'wr_attempt_next_v1:';
|
|
7
|
-
function hexToBytes(hex) {
|
|
8
|
-
if (hex.length % 2 !== 0) {
|
|
9
|
-
throw new Error('hex string must have even length');
|
|
10
|
-
}
|
|
11
|
-
const out = new Uint8Array(hex.length / 2);
|
|
12
|
-
for (let i = 0; i < out.length; i++) {
|
|
13
|
-
const byteHex = hex.slice(i * 2, i * 2 + 2);
|
|
14
|
-
const n = Number.parseInt(byteHex, 16);
|
|
15
|
-
if (Number.isNaN(n)) {
|
|
16
|
-
throw new Error(`invalid hex byte: ${byteHex}`);
|
|
17
|
-
}
|
|
18
|
-
out[i] = n;
|
|
19
|
-
}
|
|
20
|
-
return out;
|
|
21
|
-
}
|
|
22
9
|
const SHA256_DIGEST_RE = /^sha256:[0-9a-f]{64}$/;
|
|
23
10
|
function deriveChildAttemptId(parent, sha256) {
|
|
24
11
|
const bytes = new TextEncoder().encode(`${PREFIX}${String(parent)}`);
|
|
25
12
|
const digest = String(sha256.sha256(bytes));
|
|
26
13
|
if (!SHA256_DIGEST_RE.test(digest)) {
|
|
27
|
-
|
|
14
|
+
return (0, neverthrow_1.err)({ code: 'INVALID_DIGEST_FORMAT', message: `expected sha256:<64hex> digest, got: ${digest}` });
|
|
15
|
+
}
|
|
16
|
+
const first16Res = (0, hex_to_bytes_js_1.hexToBytes)(digest.slice('sha256:'.length, 'sha256:'.length + 32));
|
|
17
|
+
if (first16Res.isErr()) {
|
|
18
|
+
return (0, neverthrow_1.err)(first16Res.error);
|
|
28
19
|
}
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
return (0, index_js_1.asAttemptId)(`attempt_${suffix}`);
|
|
20
|
+
const suffix = (0, base32_lower_js_1.encodeBase32LowerNoPad)(first16Res.value);
|
|
21
|
+
return (0, neverthrow_1.ok)((0, index_js_1.asAttemptId)(`attempt_${suffix}`));
|
|
32
22
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Brand } from '../../../runtime/brand.js';
|
|
2
|
+
export type EventId = Brand<string, 'v2.EventId'>;
|
|
3
|
+
export type EventIndex = Brand<number, 'v2.EventIndex'>;
|
|
4
|
+
export type ManifestIndex = Brand<number, 'v2.ManifestIndex'>;
|
|
5
|
+
export type OutputId = Brand<string, 'v2.OutputId'>;
|
|
6
|
+
export declare function asEventId(value: string): EventId;
|
|
7
|
+
export declare function asEventIndex(value: number): EventIndex;
|
|
8
|
+
export declare function asManifestIndex(value: number): ManifestIndex;
|
|
9
|
+
export declare function asOutputId(value: string): OutputId;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.asEventId = asEventId;
|
|
4
|
+
exports.asEventIndex = asEventIndex;
|
|
5
|
+
exports.asManifestIndex = asManifestIndex;
|
|
6
|
+
exports.asOutputId = asOutputId;
|
|
7
|
+
function asEventId(value) {
|
|
8
|
+
return value;
|
|
9
|
+
}
|
|
10
|
+
function asEventIndex(value) {
|
|
11
|
+
return value;
|
|
12
|
+
}
|
|
13
|
+
function asManifestIndex(value) {
|
|
14
|
+
return value;
|
|
15
|
+
}
|
|
16
|
+
function asOutputId(value) {
|
|
17
|
+
return value;
|
|
18
|
+
}
|
|
@@ -1,33 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
export type
|
|
3
|
-
export
|
|
4
|
-
export type
|
|
5
|
-
export
|
|
6
|
-
export type
|
|
7
|
-
export type
|
|
8
|
-
export
|
|
9
|
-
export type
|
|
10
|
-
export
|
|
11
|
-
export type
|
|
12
|
-
export
|
|
13
|
-
export type
|
|
14
|
-
export type AttemptId = Brand<string, 'v2.AttemptId'>;
|
|
15
|
-
export type OutputId = Brand<string, 'v2.OutputId'>;
|
|
16
|
-
export type TokenStringV1 = Brand<string, 'v2.TokenStringV1'>;
|
|
17
|
-
export declare function asWorkflowId(value: string): WorkflowId;
|
|
18
|
-
export declare function asSha256Digest(value: string): Sha256Digest;
|
|
19
|
-
export declare function asWorkflowHash(value: Sha256Digest): WorkflowHash;
|
|
20
|
-
export declare function asWorkflowHashRef(value: string): WorkflowHashRef;
|
|
21
|
-
export declare function asCanonicalBytes(value: Uint8Array): CanonicalBytes;
|
|
22
|
-
export declare function asSessionId(value: string): SessionId;
|
|
23
|
-
export declare function asRunId(value: string): RunId;
|
|
24
|
-
export declare function asNodeId(value: string): NodeId;
|
|
25
|
-
export declare function asEventId(value: string): EventId;
|
|
26
|
-
export declare function asEventIndex(value: number): EventIndex;
|
|
27
|
-
export declare function asManifestIndex(value: number): ManifestIndex;
|
|
28
|
-
export declare function asSnapshotRef(value: Sha256Digest): SnapshotRef;
|
|
29
|
-
export declare function asAttemptId(value: string): AttemptId;
|
|
30
|
-
export declare function asOutputId(value: string): OutputId;
|
|
31
|
-
export declare function asTokenStringV1(value: string): TokenStringV1;
|
|
32
|
-
export { deriveWorkflowHashRef } from './workflow-hash-ref.js';
|
|
33
|
-
export type { WorkflowHashRefError } from './workflow-hash-ref.js';
|
|
1
|
+
export type { Brand } from '../../../runtime/brand.js';
|
|
2
|
+
export type { SessionId, RunId, NodeId, AttemptId } from './session-ids.js';
|
|
3
|
+
export { asSessionId, asRunId, asNodeId, asAttemptId } from './session-ids.js';
|
|
4
|
+
export type { WorkflowId, Sha256Digest, WorkflowHash, WorkflowHashRef, } from './workflow-ids.js';
|
|
5
|
+
export { asWorkflowId, asSha256Digest, asWorkflowHash, asWorkflowHashRef, deriveWorkflowHashRef, } from './workflow-ids.js';
|
|
6
|
+
export type { WorkflowHashRefError } from './workflow-ids.js';
|
|
7
|
+
export type { EventId, EventIndex, ManifestIndex, OutputId } from './event-ids.js';
|
|
8
|
+
export { asEventId, asEventIndex, asManifestIndex, asOutputId } from './event-ids.js';
|
|
9
|
+
export type { SnapshotRef, CanonicalBytes } from './snapshot-ids.js';
|
|
10
|
+
export { asSnapshotRef, asCanonicalBytes } from './snapshot-ids.js';
|
|
11
|
+
export type { TokenStringV1 } from './token-ids.js';
|
|
12
|
+
export { asTokenStringV1 } from './token-ids.js';
|
|
13
|
+
export type { WithHealthySessionLock } from './with-healthy-session-lock.js';
|
|
@@ -1,65 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.deriveWorkflowHashRef = void 0;
|
|
4
|
-
|
|
5
|
-
exports.
|
|
6
|
-
exports.
|
|
7
|
-
exports.
|
|
8
|
-
exports.
|
|
9
|
-
|
|
10
|
-
exports.
|
|
11
|
-
exports.
|
|
12
|
-
exports.
|
|
13
|
-
exports.
|
|
14
|
-
exports.
|
|
15
|
-
|
|
16
|
-
exports.
|
|
17
|
-
exports.
|
|
18
|
-
exports.
|
|
19
|
-
function
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
function
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
function asWorkflowHash(value) {
|
|
26
|
-
return value;
|
|
27
|
-
}
|
|
28
|
-
function asWorkflowHashRef(value) {
|
|
29
|
-
return value;
|
|
30
|
-
}
|
|
31
|
-
function asCanonicalBytes(value) {
|
|
32
|
-
return value;
|
|
33
|
-
}
|
|
34
|
-
function asSessionId(value) {
|
|
35
|
-
return value;
|
|
36
|
-
}
|
|
37
|
-
function asRunId(value) {
|
|
38
|
-
return value;
|
|
39
|
-
}
|
|
40
|
-
function asNodeId(value) {
|
|
41
|
-
return value;
|
|
42
|
-
}
|
|
43
|
-
function asEventId(value) {
|
|
44
|
-
return value;
|
|
45
|
-
}
|
|
46
|
-
function asEventIndex(value) {
|
|
47
|
-
return value;
|
|
48
|
-
}
|
|
49
|
-
function asManifestIndex(value) {
|
|
50
|
-
return value;
|
|
51
|
-
}
|
|
52
|
-
function asSnapshotRef(value) {
|
|
53
|
-
return value;
|
|
54
|
-
}
|
|
55
|
-
function asAttemptId(value) {
|
|
56
|
-
return value;
|
|
57
|
-
}
|
|
58
|
-
function asOutputId(value) {
|
|
59
|
-
return value;
|
|
60
|
-
}
|
|
61
|
-
function asTokenStringV1(value) {
|
|
62
|
-
return value;
|
|
63
|
-
}
|
|
64
|
-
var workflow_hash_ref_js_1 = require("./workflow-hash-ref.js");
|
|
65
|
-
Object.defineProperty(exports, "deriveWorkflowHashRef", { enumerable: true, get: function () { return workflow_hash_ref_js_1.deriveWorkflowHashRef; } });
|
|
3
|
+
exports.asTokenStringV1 = exports.asCanonicalBytes = exports.asSnapshotRef = exports.asOutputId = exports.asManifestIndex = exports.asEventIndex = exports.asEventId = exports.deriveWorkflowHashRef = exports.asWorkflowHashRef = exports.asWorkflowHash = exports.asSha256Digest = exports.asWorkflowId = exports.asAttemptId = exports.asNodeId = exports.asRunId = exports.asSessionId = void 0;
|
|
4
|
+
var session_ids_js_1 = require("./session-ids.js");
|
|
5
|
+
Object.defineProperty(exports, "asSessionId", { enumerable: true, get: function () { return session_ids_js_1.asSessionId; } });
|
|
6
|
+
Object.defineProperty(exports, "asRunId", { enumerable: true, get: function () { return session_ids_js_1.asRunId; } });
|
|
7
|
+
Object.defineProperty(exports, "asNodeId", { enumerable: true, get: function () { return session_ids_js_1.asNodeId; } });
|
|
8
|
+
Object.defineProperty(exports, "asAttemptId", { enumerable: true, get: function () { return session_ids_js_1.asAttemptId; } });
|
|
9
|
+
var workflow_ids_js_1 = require("./workflow-ids.js");
|
|
10
|
+
Object.defineProperty(exports, "asWorkflowId", { enumerable: true, get: function () { return workflow_ids_js_1.asWorkflowId; } });
|
|
11
|
+
Object.defineProperty(exports, "asSha256Digest", { enumerable: true, get: function () { return workflow_ids_js_1.asSha256Digest; } });
|
|
12
|
+
Object.defineProperty(exports, "asWorkflowHash", { enumerable: true, get: function () { return workflow_ids_js_1.asWorkflowHash; } });
|
|
13
|
+
Object.defineProperty(exports, "asWorkflowHashRef", { enumerable: true, get: function () { return workflow_ids_js_1.asWorkflowHashRef; } });
|
|
14
|
+
Object.defineProperty(exports, "deriveWorkflowHashRef", { enumerable: true, get: function () { return workflow_ids_js_1.deriveWorkflowHashRef; } });
|
|
15
|
+
var event_ids_js_1 = require("./event-ids.js");
|
|
16
|
+
Object.defineProperty(exports, "asEventId", { enumerable: true, get: function () { return event_ids_js_1.asEventId; } });
|
|
17
|
+
Object.defineProperty(exports, "asEventIndex", { enumerable: true, get: function () { return event_ids_js_1.asEventIndex; } });
|
|
18
|
+
Object.defineProperty(exports, "asManifestIndex", { enumerable: true, get: function () { return event_ids_js_1.asManifestIndex; } });
|
|
19
|
+
Object.defineProperty(exports, "asOutputId", { enumerable: true, get: function () { return event_ids_js_1.asOutputId; } });
|
|
20
|
+
var snapshot_ids_js_1 = require("./snapshot-ids.js");
|
|
21
|
+
Object.defineProperty(exports, "asSnapshotRef", { enumerable: true, get: function () { return snapshot_ids_js_1.asSnapshotRef; } });
|
|
22
|
+
Object.defineProperty(exports, "asCanonicalBytes", { enumerable: true, get: function () { return snapshot_ids_js_1.asCanonicalBytes; } });
|
|
23
|
+
var token_ids_js_1 = require("./token-ids.js");
|
|
24
|
+
Object.defineProperty(exports, "asTokenStringV1", { enumerable: true, get: function () { return token_ids_js_1.asTokenStringV1; } });
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Brand } from '../../../runtime/brand.js';
|
|
2
|
+
export type SessionId = Brand<string, 'v2.SessionId'>;
|
|
3
|
+
export type RunId = Brand<string, 'v2.RunId'>;
|
|
4
|
+
export type NodeId = Brand<string, 'v2.NodeId'>;
|
|
5
|
+
export type AttemptId = Brand<string, 'v2.AttemptId'>;
|
|
6
|
+
export declare function asSessionId(value: string): SessionId;
|
|
7
|
+
export declare function asRunId(value: string): RunId;
|
|
8
|
+
export declare function asNodeId(value: string): NodeId;
|
|
9
|
+
export declare function asAttemptId(value: string): AttemptId;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.asSessionId = asSessionId;
|
|
4
|
+
exports.asRunId = asRunId;
|
|
5
|
+
exports.asNodeId = asNodeId;
|
|
6
|
+
exports.asAttemptId = asAttemptId;
|
|
7
|
+
function asSessionId(value) {
|
|
8
|
+
return value;
|
|
9
|
+
}
|
|
10
|
+
function asRunId(value) {
|
|
11
|
+
return value;
|
|
12
|
+
}
|
|
13
|
+
function asNodeId(value) {
|
|
14
|
+
return value;
|
|
15
|
+
}
|
|
16
|
+
function asAttemptId(value) {
|
|
17
|
+
return value;
|
|
18
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Brand } from '../../../runtime/brand.js';
|
|
2
|
+
import type { Sha256Digest } from './workflow-ids.js';
|
|
3
|
+
export type SnapshotRef = Brand<Sha256Digest, 'v2.SnapshotRef'>;
|
|
4
|
+
export type CanonicalBytes = Brand<Uint8Array, 'v2.CanonicalBytes'>;
|
|
5
|
+
export declare function asSnapshotRef(value: Sha256Digest): SnapshotRef;
|
|
6
|
+
export declare function asCanonicalBytes(value: Uint8Array): CanonicalBytes;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.asSnapshotRef = asSnapshotRef;
|
|
4
|
+
exports.asCanonicalBytes = asCanonicalBytes;
|
|
5
|
+
function asSnapshotRef(value) {
|
|
6
|
+
return value;
|
|
7
|
+
}
|
|
8
|
+
function asCanonicalBytes(value) {
|
|
9
|
+
return value;
|
|
10
|
+
}
|
|
@@ -3,5 +3,8 @@ import type { WorkflowHash, WorkflowHashRef } from './index.js';
|
|
|
3
3
|
export type WorkflowHashRefError = {
|
|
4
4
|
readonly code: 'WORKFLOW_HASH_INVALID_FORMAT';
|
|
5
5
|
readonly message: string;
|
|
6
|
+
} | {
|
|
7
|
+
readonly code: 'INVALID_HEX';
|
|
8
|
+
readonly message: string;
|
|
6
9
|
};
|
|
7
10
|
export declare function deriveWorkflowHashRef(workflowHash: WorkflowHash): Result<WorkflowHashRef, WorkflowHashRefError>;
|
|
@@ -4,6 +4,7 @@ exports.deriveWorkflowHashRef = deriveWorkflowHashRef;
|
|
|
4
4
|
const neverthrow_1 = require("neverthrow");
|
|
5
5
|
const index_js_1 = require("./index.js");
|
|
6
6
|
const base32_lower_js_1 = require("../encoding/base32-lower.js");
|
|
7
|
+
const hex_to_bytes_js_1 = require("../encoding/hex-to-bytes.js");
|
|
7
8
|
function deriveWorkflowHashRef(workflowHash) {
|
|
8
9
|
const match = /^sha256:([0-9a-f]{64})$/.exec(String(workflowHash));
|
|
9
10
|
if (!match) {
|
|
@@ -14,10 +15,10 @@ function deriveWorkflowHashRef(workflowHash) {
|
|
|
14
15
|
}
|
|
15
16
|
const hexDigest = match[1];
|
|
16
17
|
const first32Hex = hexDigest.slice(0, 32);
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
const bytesResult = (0, hex_to_bytes_js_1.hexToBytes)(first32Hex);
|
|
19
|
+
if (bytesResult.isErr()) {
|
|
20
|
+
return (0, neverthrow_1.err)(bytesResult.error);
|
|
20
21
|
}
|
|
21
|
-
const suffix = (0, base32_lower_js_1.encodeBase32LowerNoPad)(
|
|
22
|
+
const suffix = (0, base32_lower_js_1.encodeBase32LowerNoPad)(bytesResult.value);
|
|
22
23
|
return (0, neverthrow_1.ok)((0, index_js_1.asWorkflowHashRef)(`wf_${suffix}`));
|
|
23
24
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Brand } from '../../../runtime/brand.js';
|
|
2
|
+
export type Sha256Digest = Brand<string, 'v2.Sha256Digest'>;
|
|
3
|
+
export type WorkflowHash = Brand<Sha256Digest, 'v2.WorkflowHash'>;
|
|
4
|
+
export type WorkflowHashRef = Brand<string, 'v2.WorkflowHashRef'>;
|
|
5
|
+
export type WorkflowId = Brand<string, 'v2.WorkflowId'>;
|
|
6
|
+
export declare function asWorkflowId(value: string): WorkflowId;
|
|
7
|
+
export declare function asSha256Digest(value: string): Sha256Digest;
|
|
8
|
+
export declare function asWorkflowHash(value: Sha256Digest): WorkflowHash;
|
|
9
|
+
export declare function asWorkflowHashRef(value: string): WorkflowHashRef;
|
|
10
|
+
export { deriveWorkflowHashRef } from './workflow-hash-ref.js';
|
|
11
|
+
export type { WorkflowHashRefError } from './workflow-hash-ref.js';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.deriveWorkflowHashRef = void 0;
|
|
4
|
+
exports.asWorkflowId = asWorkflowId;
|
|
5
|
+
exports.asSha256Digest = asSha256Digest;
|
|
6
|
+
exports.asWorkflowHash = asWorkflowHash;
|
|
7
|
+
exports.asWorkflowHashRef = asWorkflowHashRef;
|
|
8
|
+
function asWorkflowId(value) {
|
|
9
|
+
return value;
|
|
10
|
+
}
|
|
11
|
+
function asSha256Digest(value) {
|
|
12
|
+
return value;
|
|
13
|
+
}
|
|
14
|
+
function asWorkflowHash(value) {
|
|
15
|
+
return value;
|
|
16
|
+
}
|
|
17
|
+
function asWorkflowHashRef(value) {
|
|
18
|
+
return value;
|
|
19
|
+
}
|
|
20
|
+
var workflow_hash_ref_js_1 = require("./workflow-hash-ref.js");
|
|
21
|
+
Object.defineProperty(exports, "deriveWorkflowHashRef", { enumerable: true, get: function () { return workflow_hash_ref_js_1.deriveWorkflowHashRef; } });
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function utf8ByteLength(s: string): number;
|
|
@@ -8,15 +8,15 @@ export declare const LoopControlMetadataV1Schema: z.ZodOptional<z.ZodObject<{
|
|
|
8
8
|
iterationIndex: z.ZodOptional<z.ZodNumber>;
|
|
9
9
|
confidence: z.ZodOptional<z.ZodNumber>;
|
|
10
10
|
}, "strict", z.ZodTypeAny, {
|
|
11
|
-
confidence?: number | undefined;
|
|
12
11
|
reason?: string | undefined;
|
|
13
12
|
issuesFound?: number | undefined;
|
|
14
13
|
iterationIndex?: number | undefined;
|
|
15
|
-
}, {
|
|
16
14
|
confidence?: number | undefined;
|
|
15
|
+
}, {
|
|
17
16
|
reason?: string | undefined;
|
|
18
17
|
issuesFound?: number | undefined;
|
|
19
18
|
iterationIndex?: number | undefined;
|
|
19
|
+
confidence?: number | undefined;
|
|
20
20
|
}>>;
|
|
21
21
|
export type LoopControlMetadataV1 = z.infer<typeof LoopControlMetadataV1Schema>;
|
|
22
22
|
export declare const LoopControlArtifactV1Schema: z.ZodObject<{
|
|
@@ -29,35 +29,35 @@ export declare const LoopControlArtifactV1Schema: z.ZodObject<{
|
|
|
29
29
|
iterationIndex: z.ZodOptional<z.ZodNumber>;
|
|
30
30
|
confidence: z.ZodOptional<z.ZodNumber>;
|
|
31
31
|
}, "strict", z.ZodTypeAny, {
|
|
32
|
-
confidence?: number | undefined;
|
|
33
32
|
reason?: string | undefined;
|
|
34
33
|
issuesFound?: number | undefined;
|
|
35
34
|
iterationIndex?: number | undefined;
|
|
36
|
-
}, {
|
|
37
35
|
confidence?: number | undefined;
|
|
36
|
+
}, {
|
|
38
37
|
reason?: string | undefined;
|
|
39
38
|
issuesFound?: number | undefined;
|
|
40
39
|
iterationIndex?: number | undefined;
|
|
40
|
+
confidence?: number | undefined;
|
|
41
41
|
}>>;
|
|
42
42
|
}, "strict", z.ZodTypeAny, {
|
|
43
43
|
kind: "wr.loop_control";
|
|
44
44
|
loopId: string;
|
|
45
45
|
decision: "continue" | "stop";
|
|
46
46
|
metadata?: {
|
|
47
|
-
confidence?: number | undefined;
|
|
48
47
|
reason?: string | undefined;
|
|
49
48
|
issuesFound?: number | undefined;
|
|
50
49
|
iterationIndex?: number | undefined;
|
|
50
|
+
confidence?: number | undefined;
|
|
51
51
|
} | undefined;
|
|
52
52
|
}, {
|
|
53
53
|
kind: "wr.loop_control";
|
|
54
54
|
loopId: string;
|
|
55
55
|
decision: "continue" | "stop";
|
|
56
56
|
metadata?: {
|
|
57
|
-
confidence?: number | undefined;
|
|
58
57
|
reason?: string | undefined;
|
|
59
58
|
issuesFound?: number | undefined;
|
|
60
59
|
iterationIndex?: number | undefined;
|
|
60
|
+
confidence?: number | undefined;
|
|
61
61
|
} | undefined;
|
|
62
62
|
}>;
|
|
63
63
|
export type LoopControlArtifactV1 = z.infer<typeof LoopControlArtifactV1Schema>;
|
|
@@ -6,11 +6,12 @@ exports.parseLoopControlArtifact = parseLoopControlArtifact;
|
|
|
6
6
|
exports.findLoopControlArtifact = findLoopControlArtifact;
|
|
7
7
|
const zod_1 = require("zod");
|
|
8
8
|
const constants_js_1 = require("../../constants.js");
|
|
9
|
+
const MAX_ARTIFACT_METADATA_REASON_LENGTH = 1024;
|
|
9
10
|
exports.LOOP_CONTROL_CONTRACT_REF = 'wr.contracts.loop_control';
|
|
10
11
|
exports.LoopControlDecisionSchema = zod_1.z.enum(['continue', 'stop']);
|
|
11
12
|
exports.LoopControlMetadataV1Schema = zod_1.z
|
|
12
13
|
.object({
|
|
13
|
-
reason: zod_1.z.string().max(
|
|
14
|
+
reason: zod_1.z.string().max(MAX_ARTIFACT_METADATA_REASON_LENGTH).optional(),
|
|
14
15
|
issuesFound: zod_1.z.number().int().nonnegative().optional(),
|
|
15
16
|
iterationIndex: zod_1.z.number().int().nonnegative().optional(),
|
|
16
17
|
confidence: zod_1.z.number().int().min(0).max(100).optional(),
|