@exaudeus/workrail 2.1.0 → 3.1.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/compiler/resolve-templates.d.ts +5 -0
- package/dist/application/services/compiler/resolve-templates.js +35 -0
- package/dist/application/services/compiler/routine-loader.d.ts +11 -0
- package/dist/application/services/compiler/routine-loader.js +45 -0
- package/dist/application/services/compiler/template-registry.d.ts +4 -2
- package/dist/application/services/compiler/template-registry.js +105 -4
- package/dist/application/services/workflow-compiler.js +34 -3
- package/dist/di/container.js +10 -1
- package/dist/di/tokens.d.ts +1 -0
- package/dist/di/tokens.js +1 -0
- package/dist/engine/engine-factory.d.ts +3 -0
- package/dist/engine/engine-factory.js +295 -0
- package/dist/engine/index.d.ts +3 -0
- package/dist/engine/index.js +12 -0
- package/dist/engine/types.d.ts +130 -0
- package/dist/engine/types.js +18 -0
- package/dist/manifest.json +146 -74
- package/dist/mcp/handlers/v2-checkpoint.d.ts +31 -1
- package/dist/mcp/handlers/v2-checkpoint.js +76 -64
- package/dist/mcp/handlers/v2-execution/continue-advance.d.ts +2 -0
- package/dist/mcp/handlers/v2-execution/continue-advance.js +5 -5
- package/dist/mcp/handlers/v2-execution/continue-rehydrate.d.ts +2 -0
- package/dist/mcp/handlers/v2-execution/continue-rehydrate.js +17 -22
- package/dist/mcp/handlers/v2-execution/index.d.ts +10 -17
- package/dist/mcp/handlers/v2-execution/index.js +44 -54
- package/dist/mcp/handlers/v2-execution/replay.d.ts +4 -15
- package/dist/mcp/handlers/v2-execution/replay.js +52 -128
- package/dist/mcp/handlers/v2-execution/start.d.ts +3 -2
- package/dist/mcp/handlers/v2-execution/start.js +18 -46
- package/dist/mcp/handlers/v2-token-ops.d.ts +45 -24
- package/dist/mcp/handlers/v2-token-ops.js +372 -32
- package/dist/mcp/output-schemas.d.ts +104 -283
- package/dist/mcp/output-schemas.js +24 -22
- package/dist/mcp/server.js +8 -0
- package/dist/mcp/types.d.ts +4 -0
- package/dist/mcp/v2/tools.d.ts +22 -52
- package/dist/mcp/v2/tools.js +18 -32
- package/dist/mcp/v2-response-formatter.js +12 -16
- package/dist/runtime/runtime-mode.d.ts +2 -0
- package/dist/v2/durable-core/domain/prompt-renderer.d.ts +1 -0
- package/dist/v2/durable-core/domain/prompt-renderer.js +5 -3
- package/dist/v2/durable-core/schemas/export-bundle/index.d.ts +14 -14
- package/dist/v2/durable-core/schemas/session/events.d.ts +4 -4
- package/dist/v2/durable-core/schemas/session/validation-event.d.ts +2 -2
- package/dist/v2/durable-core/tokens/payloads.d.ts +32 -32
- package/dist/v2/durable-core/tokens/short-token.d.ts +38 -0
- package/dist/v2/durable-core/tokens/short-token.js +126 -0
- package/dist/v2/durable-core/tokens/token-patterns.d.ts +4 -0
- package/dist/v2/durable-core/tokens/token-patterns.js +9 -0
- package/dist/v2/infra/in-memory/token-alias-store/index.d.ts +11 -0
- package/dist/v2/infra/in-memory/token-alias-store/index.js +38 -0
- package/dist/v2/infra/local/data-dir/index.d.ts +1 -0
- package/dist/v2/infra/local/data-dir/index.js +3 -0
- package/dist/v2/infra/local/token-alias-store/index.d.ts +16 -0
- package/dist/v2/infra/local/token-alias-store/index.js +117 -0
- package/dist/v2/ports/data-dir.port.d.ts +1 -0
- package/dist/v2/ports/token-alias-store.port.d.ts +33 -0
- package/dist/v2/ports/token-alias-store.port.js +2 -0
- package/package.json +8 -1
- package/workflows/coding-task-workflow-agentic.lean.v2.json +41 -3
- package/workflows/examples/routine-injection-example.json +28 -0
|
@@ -9,5 +9,10 @@ export type ResolveTemplatesPassError = {
|
|
|
9
9
|
readonly code: 'TEMPLATE_EXPAND_ERROR';
|
|
10
10
|
readonly stepId: string;
|
|
11
11
|
readonly cause: TemplateExpandError;
|
|
12
|
+
} | {
|
|
13
|
+
readonly code: 'DUPLICATE_STEP_ID';
|
|
14
|
+
readonly stepId: string;
|
|
15
|
+
readonly templateId: string;
|
|
16
|
+
readonly message: string;
|
|
12
17
|
};
|
|
13
18
|
export declare function resolveTemplatesPass(steps: readonly (WorkflowStepDefinition | LoopStepDefinition)[], registry: TemplateRegistry): Result<readonly (WorkflowStepDefinition | LoopStepDefinition)[], ResolveTemplatesPassError>;
|
|
@@ -23,10 +23,17 @@ function resolveStepTemplate(step, registry) {
|
|
|
23
23
|
cause: expandResult.error,
|
|
24
24
|
});
|
|
25
25
|
}
|
|
26
|
+
if (step.runCondition) {
|
|
27
|
+
return (0, neverthrow_1.ok)(expandResult.value.map(expanded => ({
|
|
28
|
+
...expanded,
|
|
29
|
+
runCondition: expanded.runCondition ?? step.runCondition,
|
|
30
|
+
})));
|
|
31
|
+
}
|
|
26
32
|
return (0, neverthrow_1.ok)(expandResult.value);
|
|
27
33
|
}
|
|
28
34
|
function resolveTemplatesPass(steps, registry) {
|
|
29
35
|
const resolved = [];
|
|
36
|
+
const seenIds = new Set();
|
|
30
37
|
for (const step of steps) {
|
|
31
38
|
if ((0, workflow_definition_js_1.isLoopStepDefinition)(step)) {
|
|
32
39
|
if (Array.isArray(step.body)) {
|
|
@@ -35,11 +42,22 @@ function resolveTemplatesPass(steps, registry) {
|
|
|
35
42
|
const res = resolveStepTemplate(bodyStep, registry);
|
|
36
43
|
if (res.isErr())
|
|
37
44
|
return (0, neverthrow_1.err)(res.error);
|
|
45
|
+
for (const expanded of res.value) {
|
|
46
|
+
const collision = checkIdCollision(expanded.id, bodyStep.templateCall?.templateId, seenIds);
|
|
47
|
+
if (collision)
|
|
48
|
+
return (0, neverthrow_1.err)(collision);
|
|
49
|
+
}
|
|
38
50
|
bodyResolved.push(...res.value);
|
|
39
51
|
}
|
|
52
|
+
const loopCollision = checkIdCollision(step.id, undefined, seenIds);
|
|
53
|
+
if (loopCollision)
|
|
54
|
+
return (0, neverthrow_1.err)(loopCollision);
|
|
40
55
|
resolved.push({ ...step, body: bodyResolved });
|
|
41
56
|
}
|
|
42
57
|
else {
|
|
58
|
+
const loopCollision = checkIdCollision(step.id, undefined, seenIds);
|
|
59
|
+
if (loopCollision)
|
|
60
|
+
return (0, neverthrow_1.err)(loopCollision);
|
|
43
61
|
resolved.push(step);
|
|
44
62
|
}
|
|
45
63
|
}
|
|
@@ -47,8 +65,25 @@ function resolveTemplatesPass(steps, registry) {
|
|
|
47
65
|
const res = resolveStepTemplate(step, registry);
|
|
48
66
|
if (res.isErr())
|
|
49
67
|
return (0, neverthrow_1.err)(res.error);
|
|
68
|
+
for (const expanded of res.value) {
|
|
69
|
+
const collision = checkIdCollision(expanded.id, step.templateCall?.templateId, seenIds);
|
|
70
|
+
if (collision)
|
|
71
|
+
return (0, neverthrow_1.err)(collision);
|
|
72
|
+
}
|
|
50
73
|
resolved.push(...res.value);
|
|
51
74
|
}
|
|
52
75
|
}
|
|
53
76
|
return (0, neverthrow_1.ok)(resolved);
|
|
54
77
|
}
|
|
78
|
+
function checkIdCollision(stepId, templateId, seenIds) {
|
|
79
|
+
if (seenIds.has(stepId)) {
|
|
80
|
+
return {
|
|
81
|
+
code: 'DUPLICATE_STEP_ID',
|
|
82
|
+
stepId,
|
|
83
|
+
templateId: templateId ?? '(none)',
|
|
84
|
+
message: `Duplicate step id '${stepId}' after template expansion${templateId ? ` (from template '${templateId}')` : ''}`,
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
seenIds.add(stepId);
|
|
88
|
+
return undefined;
|
|
89
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Result } from 'neverthrow';
|
|
2
|
+
import type { WorkflowDefinition } from '../../../types/workflow-definition.js';
|
|
3
|
+
export interface RoutineLoadWarning {
|
|
4
|
+
readonly file: string;
|
|
5
|
+
readonly reason: string;
|
|
6
|
+
}
|
|
7
|
+
export interface RoutineLoadResult {
|
|
8
|
+
readonly routines: ReadonlyMap<string, WorkflowDefinition>;
|
|
9
|
+
readonly warnings: readonly RoutineLoadWarning[];
|
|
10
|
+
}
|
|
11
|
+
export declare function loadRoutineDefinitions(routinesDir?: string): Result<RoutineLoadResult, string>;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.loadRoutineDefinitions = loadRoutineDefinitions;
|
|
7
|
+
const fs_1 = require("fs");
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
const neverthrow_1 = require("neverthrow");
|
|
10
|
+
const workflow_definition_js_1 = require("../../../types/workflow-definition.js");
|
|
11
|
+
function resolveRoutinesDir() {
|
|
12
|
+
const projectRoot = path_1.default.resolve(__dirname, '..', '..', '..', '..');
|
|
13
|
+
return path_1.default.join(projectRoot, 'workflows', 'routines');
|
|
14
|
+
}
|
|
15
|
+
function loadRoutineDefinitions(routinesDir) {
|
|
16
|
+
const dir = routinesDir ?? resolveRoutinesDir();
|
|
17
|
+
if (!(0, fs_1.existsSync)(dir)) {
|
|
18
|
+
return (0, neverthrow_1.ok)({ routines: new Map(), warnings: [] });
|
|
19
|
+
}
|
|
20
|
+
let files;
|
|
21
|
+
try {
|
|
22
|
+
files = (0, fs_1.readdirSync)(dir).filter(f => f.endsWith('.json'));
|
|
23
|
+
}
|
|
24
|
+
catch (e) {
|
|
25
|
+
return (0, neverthrow_1.err)(`Failed to read routines directory '${dir}': ${e}`);
|
|
26
|
+
}
|
|
27
|
+
const routines = new Map();
|
|
28
|
+
const warnings = [];
|
|
29
|
+
for (const file of files) {
|
|
30
|
+
const filePath = path_1.default.join(dir, file);
|
|
31
|
+
try {
|
|
32
|
+
const raw = (0, fs_1.readFileSync)(filePath, 'utf-8');
|
|
33
|
+
const parsed = JSON.parse(raw);
|
|
34
|
+
if (!(0, workflow_definition_js_1.hasWorkflowDefinitionShape)(parsed)) {
|
|
35
|
+
warnings.push({ file, reason: 'does not match WorkflowDefinition shape (missing id, name, description, version, or steps)' });
|
|
36
|
+
continue;
|
|
37
|
+
}
|
|
38
|
+
routines.set(parsed.id, parsed);
|
|
39
|
+
}
|
|
40
|
+
catch (e) {
|
|
41
|
+
warnings.push({ file, reason: String(e) });
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return (0, neverthrow_1.ok)({ routines, warnings });
|
|
45
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Result } from 'neverthrow';
|
|
2
|
-
import type { WorkflowStepDefinition } from '../../../types/workflow-definition.js';
|
|
2
|
+
import type { WorkflowStepDefinition, WorkflowDefinition } from '../../../types/workflow-definition.js';
|
|
3
3
|
export type TemplateExpander = (callerId: string, args: Readonly<Record<string, unknown>>) => Result<readonly WorkflowStepDefinition[], TemplateExpandError>;
|
|
4
4
|
export type TemplateExpandError = {
|
|
5
5
|
readonly code: 'TEMPLATE_EXPAND_FAILED';
|
|
@@ -16,4 +16,6 @@ export interface TemplateRegistry {
|
|
|
16
16
|
readonly has: (templateId: string) => boolean;
|
|
17
17
|
readonly knownIds: () => readonly string[];
|
|
18
18
|
}
|
|
19
|
-
export declare function
|
|
19
|
+
export declare function routineIdToTemplateId(routineId: string): string;
|
|
20
|
+
export declare function createRoutineExpander(routineId: string, definition: WorkflowDefinition): Result<TemplateExpander, TemplateExpandError>;
|
|
21
|
+
export declare function createTemplateRegistry(routineExpanders?: ReadonlyMap<string, TemplateExpander>): TemplateRegistry;
|
|
@@ -1,13 +1,114 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.routineIdToTemplateId = routineIdToTemplateId;
|
|
4
|
+
exports.createRoutineExpander = createRoutineExpander;
|
|
3
5
|
exports.createTemplateRegistry = createTemplateRegistry;
|
|
4
6
|
const neverthrow_1 = require("neverthrow");
|
|
7
|
+
const SINGLE_BRACE_ARG = /(?<!\{)\{([^{}]+)\}(?!\})/g;
|
|
8
|
+
function isSubstitutableValue(value) {
|
|
9
|
+
return typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean';
|
|
10
|
+
}
|
|
11
|
+
function substituteArgs(template, args, templateId, routineId, stepId) {
|
|
12
|
+
const missing = [];
|
|
13
|
+
const badType = [];
|
|
14
|
+
const result = template.replace(SINGLE_BRACE_ARG, (match, argName) => {
|
|
15
|
+
if (!(argName in args)) {
|
|
16
|
+
missing.push(argName);
|
|
17
|
+
return match;
|
|
18
|
+
}
|
|
19
|
+
const value = args[argName];
|
|
20
|
+
if (!isSubstitutableValue(value)) {
|
|
21
|
+
badType.push(argName);
|
|
22
|
+
return match;
|
|
23
|
+
}
|
|
24
|
+
return String(value);
|
|
25
|
+
});
|
|
26
|
+
if (missing.length > 0) {
|
|
27
|
+
return (0, neverthrow_1.err)({
|
|
28
|
+
code: 'TEMPLATE_EXPAND_FAILED',
|
|
29
|
+
templateId,
|
|
30
|
+
message: `MISSING_TEMPLATE_ARG: routine '${routineId}' step '${stepId}' references arg(s) '${missing.join("', '")}' but they were not provided in templateCall.args`,
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
if (badType.length > 0) {
|
|
34
|
+
return (0, neverthrow_1.err)({
|
|
35
|
+
code: 'TEMPLATE_EXPAND_FAILED',
|
|
36
|
+
templateId,
|
|
37
|
+
message: `INVALID_TEMPLATE_ARG_TYPE: routine '${routineId}' step '${stepId}' arg(s) '${badType.join("', '")}' must be string, number, or boolean (got non-primitive)`,
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
return (0, neverthrow_1.ok)(result);
|
|
41
|
+
}
|
|
42
|
+
function routineIdToTemplateId(routineId) {
|
|
43
|
+
const name = routineId.startsWith('routine-') ? routineId.slice('routine-'.length) : routineId;
|
|
44
|
+
return `wr.templates.routine.${name}`;
|
|
45
|
+
}
|
|
46
|
+
function createRoutineExpander(routineId, definition) {
|
|
47
|
+
for (const step of definition.steps) {
|
|
48
|
+
if ('templateCall' in step && step.templateCall) {
|
|
49
|
+
return (0, neverthrow_1.err)({
|
|
50
|
+
code: 'TEMPLATE_EXPAND_FAILED',
|
|
51
|
+
templateId: routineIdToTemplateId(routineId),
|
|
52
|
+
message: `Routine '${routineId}' step '${step.id}' contains a templateCall. Recursive routine injection is not allowed.`,
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
const templateId = routineIdToTemplateId(routineId);
|
|
57
|
+
const expander = (callerId, args) => {
|
|
58
|
+
const expandedSteps = [];
|
|
59
|
+
for (const step of definition.steps) {
|
|
60
|
+
if (!step.id || !step.title) {
|
|
61
|
+
return (0, neverthrow_1.err)({
|
|
62
|
+
code: 'TEMPLATE_EXPAND_FAILED',
|
|
63
|
+
templateId,
|
|
64
|
+
message: `Routine '${routineId}' step '${step.id ?? '(missing id)'}' is missing required field '${!step.id ? 'id' : 'title'}'.`,
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
if (!step.prompt) {
|
|
68
|
+
return (0, neverthrow_1.err)({
|
|
69
|
+
code: 'TEMPLATE_EXPAND_FAILED',
|
|
70
|
+
templateId,
|
|
71
|
+
message: `Routine '${routineId}' step '${step.id}' is missing required field 'prompt'.`,
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
const promptResult = substituteArgs(step.prompt, args, templateId, routineId, step.id);
|
|
75
|
+
if (promptResult.isErr())
|
|
76
|
+
return (0, neverthrow_1.err)(promptResult.error);
|
|
77
|
+
const titleResult = substituteArgs(step.title, args, templateId, routineId, step.id);
|
|
78
|
+
if (titleResult.isErr())
|
|
79
|
+
return (0, neverthrow_1.err)(titleResult.error);
|
|
80
|
+
const expandedStep = {
|
|
81
|
+
...step,
|
|
82
|
+
id: `${callerId}.${step.id}`,
|
|
83
|
+
title: titleResult.value,
|
|
84
|
+
prompt: promptResult.value,
|
|
85
|
+
...(definition.metaGuidance && definition.metaGuidance.length > 0
|
|
86
|
+
? {
|
|
87
|
+
guidance: [
|
|
88
|
+
...(step.guidance ?? []),
|
|
89
|
+
...definition.metaGuidance,
|
|
90
|
+
],
|
|
91
|
+
}
|
|
92
|
+
: {}),
|
|
93
|
+
};
|
|
94
|
+
expandedSteps.push(expandedStep);
|
|
95
|
+
}
|
|
96
|
+
return (0, neverthrow_1.ok)(expandedSteps);
|
|
97
|
+
};
|
|
98
|
+
return (0, neverthrow_1.ok)(expander);
|
|
99
|
+
}
|
|
5
100
|
const TEMPLATE_DEFINITIONS = new Map();
|
|
6
|
-
function createTemplateRegistry() {
|
|
7
|
-
const
|
|
101
|
+
function createTemplateRegistry(routineExpanders) {
|
|
102
|
+
const allExpanders = new Map(TEMPLATE_DEFINITIONS);
|
|
103
|
+
if (routineExpanders) {
|
|
104
|
+
for (const [id, expander] of routineExpanders) {
|
|
105
|
+
allExpanders.set(id, expander);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
const knownIds = [...allExpanders.keys()];
|
|
8
109
|
return {
|
|
9
110
|
resolve(templateId) {
|
|
10
|
-
const expander =
|
|
111
|
+
const expander = allExpanders.get(templateId);
|
|
11
112
|
if (!expander) {
|
|
12
113
|
return (0, neverthrow_1.err)({
|
|
13
114
|
code: 'UNKNOWN_TEMPLATE',
|
|
@@ -18,7 +119,7 @@ function createTemplateRegistry() {
|
|
|
18
119
|
return (0, neverthrow_1.ok)(expander);
|
|
19
120
|
},
|
|
20
121
|
has(templateId) {
|
|
21
|
-
return
|
|
122
|
+
return allExpanders.has(templateId);
|
|
22
123
|
},
|
|
23
124
|
knownIds() {
|
|
24
125
|
return knownIds;
|
|
@@ -20,16 +20,47 @@ const resolve_features_1 = require("./compiler/resolve-features");
|
|
|
20
20
|
const feature_registry_1 = require("./compiler/feature-registry");
|
|
21
21
|
const resolve_templates_1 = require("./compiler/resolve-templates");
|
|
22
22
|
const template_registry_1 = require("./compiler/template-registry");
|
|
23
|
+
const routine_loader_1 = require("./compiler/routine-loader");
|
|
23
24
|
const _refRegistry = (0, ref_registry_1.createRefRegistry)();
|
|
24
25
|
const _featureRegistry = (0, feature_registry_1.createFeatureRegistry)();
|
|
25
|
-
|
|
26
|
+
function buildTemplateRegistry() {
|
|
27
|
+
const routineExpanders = new Map();
|
|
28
|
+
const loadResult = (0, routine_loader_1.loadRoutineDefinitions)();
|
|
29
|
+
if (loadResult.isErr()) {
|
|
30
|
+
console.warn(`[WorkflowCompiler] Failed to load routine definitions: ${loadResult.error}`);
|
|
31
|
+
return (0, template_registry_1.createTemplateRegistry)();
|
|
32
|
+
}
|
|
33
|
+
const { routines, warnings } = loadResult.value;
|
|
34
|
+
for (const w of warnings) {
|
|
35
|
+
console.warn(`[WorkflowCompiler] Skipped routine file '${w.file}': ${w.reason}`);
|
|
36
|
+
}
|
|
37
|
+
for (const [routineId, definition] of routines) {
|
|
38
|
+
const expanderResult = (0, template_registry_1.createRoutineExpander)(routineId, definition);
|
|
39
|
+
if (expanderResult.isOk()) {
|
|
40
|
+
routineExpanders.set((0, template_registry_1.routineIdToTemplateId)(routineId), expanderResult.value);
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
console.warn(`[WorkflowCompiler] Failed to create expander for routine '${routineId}': ${expanderResult.error.message}`);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return (0, template_registry_1.createTemplateRegistry)(routineExpanders.size > 0 ? routineExpanders : undefined);
|
|
47
|
+
}
|
|
48
|
+
let _templateRegistryCache;
|
|
49
|
+
function getTemplateRegistry() {
|
|
50
|
+
if (!_templateRegistryCache) {
|
|
51
|
+
_templateRegistryCache = buildTemplateRegistry();
|
|
52
|
+
}
|
|
53
|
+
return _templateRegistryCache;
|
|
54
|
+
}
|
|
26
55
|
function resolveDefinitionSteps(steps, features) {
|
|
27
|
-
const templatesResult = (0, resolve_templates_1.resolveTemplatesPass)(steps,
|
|
56
|
+
const templatesResult = (0, resolve_templates_1.resolveTemplatesPass)(steps, getTemplateRegistry());
|
|
28
57
|
if (templatesResult.isErr()) {
|
|
29
58
|
const e = templatesResult.error;
|
|
30
59
|
const message = e.code === 'TEMPLATE_RESOLVE_ERROR'
|
|
31
60
|
? `Step '${e.stepId}': template error — ${e.cause.message}`
|
|
32
|
-
:
|
|
61
|
+
: e.code === 'DUPLICATE_STEP_ID'
|
|
62
|
+
? e.message
|
|
63
|
+
: `Step '${e.stepId}': template expansion error — ${e.cause.message}`;
|
|
33
64
|
return (0, neverthrow_1.err)(error_1.Err.invalidState(message));
|
|
34
65
|
}
|
|
35
66
|
const featuresResult = (0, resolve_features_1.resolveFeaturesPass)(templatesResult.value, features, _featureRegistry);
|
package/dist/di/container.js
CHANGED
|
@@ -86,6 +86,7 @@ function detectRuntimeMode() {
|
|
|
86
86
|
function toProcessLifecyclePolicy(mode) {
|
|
87
87
|
switch (mode.kind) {
|
|
88
88
|
case 'test':
|
|
89
|
+
case 'library':
|
|
89
90
|
return { kind: 'no_signal_handlers' };
|
|
90
91
|
case 'cli':
|
|
91
92
|
case 'rpc':
|
|
@@ -103,7 +104,7 @@ function registerRuntime(options = {}) {
|
|
|
103
104
|
const signals = policy.kind === 'no_signal_handlers' ? new noop_process_signals_js_1.NoopProcessSignals() : new node_process_signals_js_1.NodeProcessSignals();
|
|
104
105
|
tsyringe_1.container.register(tokens_js_1.DI.Runtime.ProcessSignals, { useValue: signals });
|
|
105
106
|
tsyringe_1.container.register(tokens_js_1.DI.Runtime.ShutdownEvents, { useValue: new in_memory_shutdown_events_js_1.InMemoryShutdownEvents() });
|
|
106
|
-
const terminator = mode.kind === 'test' ? new throwing_process_terminator_js_1.ThrowingProcessTerminator() : new node_process_terminator_js_1.NodeProcessTerminator();
|
|
107
|
+
const terminator = (mode.kind === 'test' || mode.kind === 'library') ? new throwing_process_terminator_js_1.ThrowingProcessTerminator() : new node_process_terminator_js_1.NodeProcessTerminator();
|
|
107
108
|
tsyringe_1.container.register(tokens_js_1.DI.Runtime.ProcessTerminator, { useValue: terminator });
|
|
108
109
|
}
|
|
109
110
|
async function registerStorageChain() {
|
|
@@ -221,6 +222,7 @@ async function registerV2Services() {
|
|
|
221
222
|
}),
|
|
222
223
|
});
|
|
223
224
|
const { LocalKeyringV2 } = await Promise.resolve().then(() => __importStar(require('../v2/infra/local/keyring/index.js')));
|
|
225
|
+
const { LocalTokenAliasStoreV2 } = await Promise.resolve().then(() => __importStar(require('../v2/infra/local/token-alias-store/index.js')));
|
|
224
226
|
const { LocalSessionEventLogStoreV2 } = await Promise.resolve().then(() => __importStar(require('../v2/infra/local/session-store/index.js')));
|
|
225
227
|
const { LocalSnapshotStoreV2 } = await Promise.resolve().then(() => __importStar(require('../v2/infra/local/snapshot-store/index.js')));
|
|
226
228
|
const { LocalPinnedWorkflowStoreV2 } = await Promise.resolve().then(() => __importStar(require('../v2/infra/local/pinned-workflow-store/index.js')));
|
|
@@ -234,6 +236,13 @@ async function registerV2Services() {
|
|
|
234
236
|
return new LocalKeyringV2(dataDir, fs, base64url, entropy);
|
|
235
237
|
}),
|
|
236
238
|
});
|
|
239
|
+
tsyringe_1.container.register(tokens_js_1.DI.V2.TokenAliasStore, {
|
|
240
|
+
useFactory: (0, tsyringe_1.instanceCachingFactory)((c) => {
|
|
241
|
+
const dataDir = c.resolve(tokens_js_1.DI.V2.DataDir);
|
|
242
|
+
const fs = c.resolve(tokens_js_1.DI.V2.FileSystem);
|
|
243
|
+
return new LocalTokenAliasStoreV2(dataDir, fs);
|
|
244
|
+
}),
|
|
245
|
+
});
|
|
237
246
|
tsyringe_1.container.register(tokens_js_1.DI.V2.SessionStore, {
|
|
238
247
|
useFactory: (0, tsyringe_1.instanceCachingFactory)((c) => {
|
|
239
248
|
const dataDir = c.resolve(tokens_js_1.DI.V2.DataDir);
|
package/dist/di/tokens.d.ts
CHANGED
package/dist/di/tokens.js
CHANGED
|
@@ -41,6 +41,7 @@ exports.DI = {
|
|
|
41
41
|
SnapshotStore: Symbol('V2.SnapshotStore'),
|
|
42
42
|
PinnedWorkflowStore: Symbol('V2.PinnedWorkflowStore'),
|
|
43
43
|
SessionLock: Symbol('V2.SessionLock'),
|
|
44
|
+
TokenAliasStore: Symbol('V2.TokenAliasStore'),
|
|
44
45
|
ExecutionGate: Symbol('V2.ExecutionGate'),
|
|
45
46
|
},
|
|
46
47
|
Runtime: {
|