@exaudeus/workrail 0.0.3 → 0.0.5

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/README.md CHANGED
@@ -18,15 +18,46 @@ The codebase now implements the full MVP described in the original specification
18
18
 
19
19
  ---
20
20
 
21
+ ## 🚀 Quick Start
22
+
23
+ ```bash
24
+ # Install globally
25
+ npm install -g @exaudeus/workrail
26
+
27
+ # Initialize your personal workflow directory
28
+ workrail init
29
+
30
+ # List all available workflows (bundled + your custom ones)
31
+ workrail list
32
+
33
+ # Check workflow sources and status
34
+ workrail sources
35
+
36
+ # Validate a workflow file
37
+ workrail validate my-workflow.json
38
+
39
+ # Start the MCP server
40
+ workrail start
41
+ ```
42
+
43
+ **Multiple Workflow Sources**: WorkRail automatically loads workflows from:
44
+ - **Bundled workflows** (included with the package)
45
+ - **User workflows** (`~/.workrail/workflows/`)
46
+ - **Project workflows** (`./workflows/`)
47
+ - **Custom directories** (via `WORKFLOW_STORAGE_PATH` environment variable)
48
+
49
+ ---
50
+
21
51
  ## ✨ Key Features
22
52
 
23
53
  * **Clean Architecture** – clear separation of **Domain → Application → Infrastructure** layers.
24
54
  * **MCP Protocol Support** – Full MCP SDK integration with proper tool definitions and stdio transport.
25
- * **Workflow Orchestration Tools** – 4 core tools for workflow management:
55
+ * **Workflow Orchestration Tools** – 5 core tools for workflow management:
26
56
  - `workflow_list` - List all available workflows
27
57
  - `workflow_get` - Get detailed workflow information
28
58
  - `workflow_next` - Get the next step in a workflow
29
59
  - `workflow_validate` - Advanced validation of step outputs with schema, context-aware, and composition rules
60
+ - `workflow_validate_json` - Direct JSON workflow validation with comprehensive error reporting and actionable suggestions
30
61
  * **Dependency Injection** – pluggable components are wired by `src/container.ts` (Inversify-style, no runtime reflection).
31
62
  * **Async, Secure Storage** – interchangeable back-ends: in-memory (default for tests) and file-based storage with path-traversal safeguards.
32
63
  * **Advanced ValidationEngine** – Three-tier validation system with JSON Schema validation (AJV), Context-Aware Validation (conditional rules), and Logical Composition (and/or/not operators) for comprehensive step output quality assurance.
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Enhanced validation result interface that matches other use cases
3
+ */
4
+ export interface WorkflowJsonValidationResult {
5
+ valid: boolean;
6
+ issues: string[];
7
+ suggestions: string[];
8
+ }
9
+ /**
10
+ * Factory function that creates a pure use-case for validating workflow JSON.
11
+ * Dependencies are injected at creation time, returning a pure function.
12
+ */
13
+ export declare function createValidateWorkflowJson(): (workflowJson: string) => Promise<WorkflowJsonValidationResult>;
14
+ /**
15
+ * @deprecated Use createValidateWorkflowJson factory function instead
16
+ * Legacy export for backward compatibility
17
+ */
18
+ export declare function validateWorkflowJson(workflowJson: string): Promise<WorkflowJsonValidationResult>;
19
+ //# sourceMappingURL=validate-workflow-json.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate-workflow-json.d.ts","sourceRoot":"","sources":["../../../src/application/use-cases/validate-workflow-json.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,WAAW,4BAA4B;IAC3C,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB;AAED;;;GAGG;AACH,wBAAgB,0BAA0B,KAEtC,cAAc,MAAM,KACnB,OAAO,CAAC,4BAA4B,CAAC,CA6DzC;AAgGD;;;GAGG;AACH,wBAAsB,oBAAoB,CACxC,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC,4BAA4B,CAAC,CAEvC"}
@@ -0,0 +1,148 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createValidateWorkflowJson = createValidateWorkflowJson;
4
+ exports.validateWorkflowJson = validateWorkflowJson;
5
+ const validation_1 = require("../validation");
6
+ /**
7
+ * Factory function that creates a pure use-case for validating workflow JSON.
8
+ * Dependencies are injected at creation time, returning a pure function.
9
+ */
10
+ function createValidateWorkflowJson() {
11
+ return async (workflowJson) => {
12
+ // Handle null, undefined, or non-string input
13
+ if (workflowJson === null || workflowJson === undefined || typeof workflowJson !== 'string') {
14
+ return {
15
+ valid: false,
16
+ issues: ['Workflow JSON content is required and must be a string.'],
17
+ suggestions: ['Provide valid JSON content for the workflow.']
18
+ };
19
+ }
20
+ // Handle empty string after trimming
21
+ const trimmedJson = workflowJson.trim();
22
+ if (trimmedJson.length === 0) {
23
+ return {
24
+ valid: false,
25
+ issues: ['Workflow JSON content is empty.'],
26
+ suggestions: ['Provide valid JSON content for the workflow.']
27
+ };
28
+ }
29
+ // Parse JSON with detailed error handling
30
+ let parsedWorkflow;
31
+ try {
32
+ parsedWorkflow = JSON.parse(trimmedJson);
33
+ }
34
+ catch (error) {
35
+ const errorMessage = error instanceof Error ? error.message : 'Unknown JSON parsing error';
36
+ return {
37
+ valid: false,
38
+ issues: [`Invalid JSON syntax: ${errorMessage}`],
39
+ suggestions: [
40
+ 'Check for missing quotes, commas, or brackets in the JSON.',
41
+ 'Ensure all strings are properly quoted.',
42
+ 'Verify that brackets and braces are properly matched.',
43
+ 'Use a JSON formatter or validator to identify syntax errors.'
44
+ ]
45
+ };
46
+ }
47
+ // Validate the parsed workflow using existing validation
48
+ const validationResult = (0, validation_1.validateWorkflow)(parsedWorkflow);
49
+ // Transform validation result to match use case interface
50
+ const issues = [];
51
+ const suggestions = [];
52
+ if (!validationResult.valid) {
53
+ // Process validation errors and provide enhanced error messages
54
+ validationResult.errors.forEach(error => {
55
+ issues.push(enhanceErrorMessage(error));
56
+ });
57
+ // Add general suggestions based on common validation errors
58
+ suggestions.push(...generateSuggestions(validationResult.errors));
59
+ }
60
+ return {
61
+ valid: validationResult.valid,
62
+ issues,
63
+ suggestions
64
+ };
65
+ };
66
+ }
67
+ /**
68
+ * Enhance error messages to be more user-friendly for LLM consumption
69
+ */
70
+ function enhanceErrorMessage(error) {
71
+ // Handle common AJV error patterns and make them more descriptive
72
+ if (error.includes('must have required property')) {
73
+ const match = error.match(/must have required property '(.+)'/);
74
+ if (match) {
75
+ const property = match[1];
76
+ return `Missing required field '${property}'. This field is mandatory for all workflows.`;
77
+ }
78
+ }
79
+ if (error.includes('must be string')) {
80
+ return `${error} - Expected a text value enclosed in quotes.`;
81
+ }
82
+ if (error.includes('must be array')) {
83
+ return `${error} - Expected a list of items enclosed in square brackets [].`;
84
+ }
85
+ if (error.includes('must be object')) {
86
+ return `${error} - Expected a JSON object enclosed in curly braces {}.`;
87
+ }
88
+ if (error.includes('must match pattern')) {
89
+ return `${error} - The value does not match the required format or pattern.`;
90
+ }
91
+ if (error.includes('must NOT have additional properties')) {
92
+ return `Unexpected property found. Remove this property or check for typos.`;
93
+ }
94
+ if (error.includes('additionalProperties')) {
95
+ return `${error} - Remove any unexpected properties or check for typos.`;
96
+ }
97
+ if (error.includes('must be >= 1')) {
98
+ return `${error} - Value must be at least 1.`;
99
+ }
100
+ if (error.includes('must be <= ')) {
101
+ return `${error} - Value exceeds the maximum allowed length.`;
102
+ }
103
+ // Return original error if no specific enhancement is available
104
+ return error;
105
+ }
106
+ /**
107
+ * Generate actionable suggestions based on validation errors
108
+ */
109
+ function generateSuggestions(errors) {
110
+ const suggestions = [];
111
+ const errorText = errors.join(' ').toLowerCase();
112
+ // Add suggestions based on common error patterns
113
+ if (errorText.includes('id')) {
114
+ suggestions.push('Ensure the workflow ID follows the pattern: lowercase letters, numbers, and hyphens only.');
115
+ }
116
+ if (errorText.includes('name')) {
117
+ suggestions.push('Provide a clear, descriptive name for the workflow.');
118
+ }
119
+ if (errorText.includes('description')) {
120
+ suggestions.push('Add a meaningful description explaining what the workflow accomplishes.');
121
+ }
122
+ if (errorText.includes('version')) {
123
+ suggestions.push('Use semantic versioning format (e.g., "0.0.1", "1.0.0").');
124
+ }
125
+ if (errorText.includes('steps')) {
126
+ suggestions.push('Ensure the workflow has at least one step with id, title, and prompt fields.');
127
+ }
128
+ if (errorText.includes('step')) {
129
+ suggestions.push('Check that all steps have required fields: id, title, and prompt.');
130
+ }
131
+ if (errorText.includes('pattern')) {
132
+ suggestions.push('Review the workflow schema documentation for correct field formats.');
133
+ }
134
+ // Add general suggestions if no specific ones were added
135
+ if (suggestions.length === 0) {
136
+ suggestions.push('Review the workflow schema documentation for correct structure and formatting.');
137
+ suggestions.push('Check that all required fields are present and properly formatted.');
138
+ }
139
+ return suggestions;
140
+ }
141
+ /**
142
+ * @deprecated Use createValidateWorkflowJson factory function instead
143
+ * Legacy export for backward compatibility
144
+ */
145
+ async function validateWorkflowJson(workflowJson) {
146
+ return createValidateWorkflowJson()(workflowJson);
147
+ }
148
+ //# sourceMappingURL=validate-workflow-json.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate-workflow-json.js","sourceRoot":"","sources":["../../../src/application/use-cases/validate-workflow-json.ts"],"names":[],"mappings":";;AAeA,gEAgEC;AAoGD,oDAIC;AAvLD,8CAA2E;AAW3E;;;GAGG;AACH,SAAgB,0BAA0B;IACxC,OAAO,KAAK,EACV,YAAoB,EACmB,EAAE;QACzC,8CAA8C;QAC9C,IAAI,YAAY,KAAK,IAAI,IAAI,YAAY,KAAK,SAAS,IAAI,OAAO,YAAY,KAAK,QAAQ,EAAE,CAAC;YAC5F,OAAO;gBACL,KAAK,EAAE,KAAK;gBACZ,MAAM,EAAE,CAAC,yDAAyD,CAAC;gBACnE,WAAW,EAAE,CAAC,8CAA8C,CAAC;aAC9D,CAAC;QACJ,CAAC;QAED,qCAAqC;QACrC,MAAM,WAAW,GAAG,YAAY,CAAC,IAAI,EAAE,CAAC;QACxC,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC7B,OAAO;gBACL,KAAK,EAAE,KAAK;gBACZ,MAAM,EAAE,CAAC,iCAAiC,CAAC;gBAC3C,WAAW,EAAE,CAAC,8CAA8C,CAAC;aAC9D,CAAC;QACJ,CAAC;QAED,0CAA0C;QAC1C,IAAI,cAAuB,CAAC;QAC5B,IAAI,CAAC;YACH,cAAc,GAAG,IAAI,CAAC,KAAK,CA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44 +6,142 @@ const commander_1 = require("commander");
6
6
  const fs_1 = tslib_1.__importDefault(require("fs"));
7
7
  const path_1 = tslib_1.__importDefault(require("path"));
8
8
  const chalk_1 = tslib_1.__importDefault(require("chalk"));
9
+ const os_1 = tslib_1.__importDefault(require("os"));
9
10
  const server_1 = require("./infrastructure/rpc/server");
10
11
  const workflow_service_1 = require("./application/services/workflow-service");
11
- const storage_1 = require("./infrastructure/storage");
12
+ // import { createDefaultWorkflowStorage } from './infrastructure/storage';
12
13
  const validation_1 = require("./application/validation");
14
+ const multi_directory_workflow_storage_1 = require("./infrastructure/storage/multi-directory-workflow-storage");
13
15
  const program = new commander_1.Command();
14
16
  program
15
- .name('workflow-lookup')
17
+ .name('workrail')
16
18
  .description('MCP server for workflow orchestration and guidance')
17
- .version('0.0.1');
19
+ .version('0.0.3');
18
20
  program
19
- .command('start')
20
- .description('Start the workflow lookup server')
21
+ .command('init')
22
+ .description('Initialize user workflow directory with sample workflows')
21
23
  .action(async () => {
22
24
  try {
23
- const workflowService = new workflow_service_1.DefaultWorkflowService((0, storage_1.createDefaultWorkflowStorage)());
24
- const server = (0, server_1.createWorkflowLookupServer)(workflowService);
25
- await server.start();
26
- console.log('Workflow Lookup MCP Server started successfully');
27
- // Graceful shutdown on SIGINT/SIGTERM
28
- const shutdown = async (signal) => {
29
- console.log(`Received ${signal}, shutting down...`);
30
- await server.stop();
31
- process.exit(0);
32
- };
33
- process.on('SIGINT', () => shutdown('SIGINT'));
34
- process.on('SIGTERM', () => shutdown('SIGTERM'));
25
+ console.log(chalk_1.default.blue('🚀 Initializing user workflow directory...'));
26
+ const userDir = await (0, multi_directory_workflow_storage_1.initializeUserWorkflowDirectory)();
27
+ console.log(chalk_1.default.green('✅ User workflow directory initialized:'));
28
+ console.log(chalk_1.default.cyan(` ${userDir}`));
29
+ console.log();
30
+ console.log(chalk_1.default.yellow('📝 Getting started:'));
31
+ console.log(chalk_1.default.white('1. Edit the sample workflow in the directory above'));
32
+ console.log(chalk_1.default.white('2. Create new workflow JSON files following the schema'));
33
+ console.log(chalk_1.default.white('3. Run "workrail list" to see your workflows'));
34
+ console.log(chalk_1.default.white('4. Use your workflows with any MCP-enabled AI assistant'));
35
+ console.log();
36
+ console.log(chalk_1.default.gray('💡 Tip: Use "workrail validate <file>" to check your workflow syntax'));
35
37
  }
36
38
  catch (error) {
37
- console.error('Failed to start server:', error);
39
+ console.error(chalk_1.default.red('Failed to initialize user workflow directory:'));
40
+ console.error(chalk_1.default.red(error.message));
38
41
  process.exit(1);
39
42
  }
40
43
  });
41
44
  program
42
- .command('validate')
43
- .description('Validate a workflow file against the schema')
44
- .argument('<file>', 'path to workflow JSON file')
45
- .action(async (file) => {
46
- await validateWorkflowFile(file);
45
+ .command('list')
46
+ .description('List all available workflows from all sources')
47
+ .option('-v, --verbose', 'Show detailed information including sources')
48
+ .action(async (options) => {
49
+ try {
50
+ console.log(chalk_1.default.blue('📋 Available workflows:'));
51
+ console.log();
52
+ const workflowService = new workflow_service_1.DefaultWorkflowService();
53
+ const workflows = await workflowService.listWorkflowSummaries();
54
+ if (workflows.length === 0) {
55
+ console.log(chalk_1.default.yellow(' No workflows found.'));
56
+ console.log(chalk_1.default.gray(' Run "workrail init" to create your first workflow.'));
57
+ return;
58
+ }
59
+ workflows.forEach((workflow, index) => {
60
+ console.log(chalk_1.default.green(`${index + 1}. ${workflow.name}`));
61
+ console.log(chalk_1.default.white(` ID: ${workflow.id}`));
62
+ console.log(chalk_1.default.gray(` ${workflow.description}`));
63
+ if (options.verbose) {
64
+ console.log(chalk_1.default.cyan(` Version: ${workflow.version}`));
65
+ }
66
+ console.log();
67
+ });
68
+ console.log(chalk_1.default.gray(`Total: ${workflows.length} workflows`));
69
+ }
70
+ catch (error) {
71
+ console.error(chalk_1.default.red('❌ Failed to list workflows:'));
72
+ console.error(chalk_1.default.red(error.message));
73
+ process.exit(1);
74
+ }
75
+ });
76
+ program
77
+ .command('sources')
78
+ .description('Show workflow directory sources and their status')
79
+ .action(async () => {
80
+ try {
81
+ console.log(chalk_1.default.blue('📂 Workflow directory sources:'));
82
+ console.log();
83
+ const sources = [
84
+ {
85
+ name: 'Bundled Workflows',
86
+ path: path_1.default.resolve(__dirname, '../workflows'),
87
+ type: 'bundled',
88
+ description: 'Pre-built workflows included with WorkRail'
89
+ },
90
+ {
91
+ name: 'User Workflows',
92
+ path: path_1.default.join(os_1.default.homedir(), '.workrail', 'workflows'),
93
+ type: 'user',
94
+ description: 'Your personal workflow collection'
95
+ },
96
+ {
97
+ name: 'Project Workflows',
98
+ path: path_1.default.resolve(process.cwd(), 'workflows'),
99
+ type: 'project',
100
+ description: 'Project-specific workflows'
101
+ }
102
+ ];
103
+ // Add custom paths from environment
104
+ const envPaths = process.env['WORKFLOW_STORAGE_PATH'];
105
+ if (envPaths) {
106
+ const customPaths = envPaths.split(path_1.default.delimiter);
107
+ customPaths.forEach((customPath, index) => {
108
+ sources.push({
109
+ name: `Custom Path ${index + 1}`,
110
+ path: path_1.default.resolve(customPath.trim()),
111
+ type: 'custom',
112
+ description: 'Custom workflow directory'
113
+ });
114
+ });
115
+ }
116
+ sources.forEach((source, index) => {
117
+ const exists = fs_1.default.existsSync(source.path);
118
+ const icon = exists ? '✅' : '❌';
119
+ const status = exists ? 'Found' : 'Not found';
120
+ console.log(chalk_1.default.white(`${index + 1}. ${source.name} ${icon}`));
121
+ console.log(chalk_1.default.gray(` Path: ${source.path}`));
122
+ console.log(chalk_1.default.gray(` Status: ${status}`));
123
+ console.log(chalk_1.default.gray(` ${source.description}`));
124
+ if (exists) {
125
+ try {
126
+ const files = fs_1.default.readdirSync(source.path).filter(f => f.endsWith('.json'));
127
+ console.log(chalk_1.default.cyan(` Workflows: ${files.length} files`));
128
+ }
129
+ catch (error) {
130
+ console.log(chalk_1.default.red(` Error reading directory`));
131
+ }
132
+ }
133
+ console.log();
134
+ });
135
+ console.log(chalk_1.default.yellow('💡 Tips:'));
136
+ console.log(chalk_1.default.white('• Run "workrail init" to create the user workflow directory'));
137
+ console.log(chalk_1.default.white('• Set WORKFLOW_STORAGE_PATH to add custom directories'));
138
+ console.log(chalk_1.default.white('• Use colon-separated paths for multiple custom directories'));
139
+ }
140
+ catch (error) {
141
+ console.error(chalk_1.default.red('❌ Failed to check workflow sources:'));
142
+ console.error(chalk_1.default.red(error.message));
143
+ process.exit(1);
144
+ }
47
145
  });
48
146
  async function validateWorkflowFile(filePath) {
49
147
  try {
@@ -102,5 +200,24 @@ async function validateWorkflowFile(filePath) {
102
200
  process.exit(1);
103
201
  }
104
202
  }
203
+ program
204
+ .command('validate <file>')
205
+ .description('Validate a workflow file against the schema')
206
+ .action(validateWorkflowFile);
207
+ program
208
+ .command('start')
209
+ .description('Start the MCP server')
210
+ .action(async () => {
211
+ try {
212
+ console.log(chalk_1.default.blue('🚀 Starting WorkRail MCP server...'));
213
+ const workflowService = new workflow_service_1.DefaultWorkflowService();
214
+ const server = (0, server_1.createWorkflowLookupServer)(workflowService);
215
+ await server.start();
216
+ }
217
+ catch (error) {
218
+ console.error(chalk_1.default.red('❌ Failed to start server:'), error.message);
219
+ process.exit(1);
220
+ }
221
+ });
105
222
  program.parse();
106
223
  //# sourceMappingURL=cli.js.map
package/dist/cli.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;;;AAEA,yCAAoC;AACpC,oDAAoB;AACpB,wDAAwB;AACxB,0DAA0B;AAC1B,wDAAyE;AACzE,8EAAiF;AACjF,sDAAwE;AACxE,yDAA4D;AAE5D,MAAM,OAAO,GAAG,IAAI,mBAAO,EAAE,CAAC;AAE9B,OAAO;KACJ,IAAI,CAAC,iBAAiB,CAAC;KACvB,WAAW,CAAC,oDAAoD,CAAC;KACjE,OAAO,CAAC,OAAO,CAAC,CAAC;AAEpB,OAAO;KACJ,OAAO,CAAC,OAAO,CAAC;KAChB,WAAW,CAAC,kCAAkC,CAAC;KAC/C,MAAM,CAAC,KAAK,IAAI,EAAE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C,CAAC,CAAC;QAE9D,MAAM,eAAe,GAAG,IAAI,yCAAsB,EAAE,CAAC;QACrD,MAAM,MAAM,GAAG,IAAA,mCAA0B,EAAC,eAAe,CAAC,CAAC;QAE3D,MAAM,MAAM,CAAC,KAAK,EAAE,CAAC;IACvB,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,OAAO,CAAC,KAAK,CAAC,eAAK,CAAC,GAAG,CAAC,2BAA2B,CAAC,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;QACrE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC,CAAC,CAAC;AAEL,OAAO,CAAC,KAAK,EAAE,CAAC"}
@@ -0,0 +1,50 @@
1
+ import { IWorkflowStorage } from '../../types/storage';
2
+ import { Workflow, WorkflowSummary } from '../../types/mcp-types';
3
+ /**
4
+ * Multi-directory workflow storage that loads workflows from multiple directories
5
+ * and merges them together. Supports:
6
+ * - Bundled workflows (always included)
7
+ * - User-specific workflows (~/.workrail/workflows)
8
+ * - Project-specific workflows (./workflows or custom path)
9
+ * - Multiple custom directories (colon-separated paths)
10
+ */
11
+ export declare class MultiDirectoryWorkflowStorage implements IWorkflowStorage {
12
+ private storageInstances;
13
+ constructor(options?: MultiDirectoryOptions);
14
+ private resolveDirectories;
15
+ loadAllWorkflows(): Promise<Workflow[]>;
16
+ getWorkflowById(id: string): Promise<Workflow | null>;
17
+ listWorkflowSummaries(): Promise<WorkflowSummary[]>;
18
+ save?(_workflow: Workflow): Promise<void>;
19
+ /**
20
+ * Get information about loaded directories
21
+ */
22
+ getDirectoryInfo(): DirectoryInfo[];
23
+ private getDirectoryType;
24
+ }
25
+ export interface MultiDirectoryOptions {
26
+ excludeBundled?: boolean;
27
+ excludeUser?: boolean;
28
+ excludeProject?: boolean;
29
+ additionalDirectories?: string[];
30
+ fileStorageOptions?: {
31
+ maxFileSizeBytes?: number;
32
+ cacheTTLms?: number;
33
+ cacheSize?: number;
34
+ indexCacheTTLms?: number;
35
+ };
36
+ }
37
+ export interface DirectoryInfo {
38
+ path: string;
39
+ index: number;
40
+ type: 'bundled' | 'user' | 'project' | 'custom';
41
+ }
42
+ /**
43
+ * Create a multi-directory storage with sensible defaults
44
+ */
45
+ export declare function createMultiDirectoryWorkflowStorage(options?: MultiDirectoryOptions): MultiDirectoryWorkflowStorage;
46
+ /**
47
+ * Initialize user workflow directory if it doesn't exist
48
+ */
49
+ export declare function initializeUserWorkflowDirectory(): Promise<string>;
50
+ //# sourceMappingURL=multi-directory-workflow-storage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"multi-directory-workflow-storage.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/storage/multi-directory-workflow-storage.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAGlE;;;;;;;GAOG;AACH,qBAAa,6BAA8B,YAAW,gBAAgB;IACpE,OAAO,CAAC,gBAAgB,CAA6B;gBAEzC,OAAO,GAAE,qBAA0B;IAS/C,OAAO,CAAC,kBAAkB;IAgDpB,gBAAgB,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC;IA8BvC,eAAe,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC;IAmBrD,qBAAqB,IAAI,OAAO,CAAC,eAAe,EAAE,CAAC;IAWnD,IAAI,CAAC,CAAC,SAAS,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;IAgB/C;;OAEG;IACI,gBAAgB,IAAI,aAAa,EAAE;IAQ1C,OAAO,CAAC,gBAAgB;CAYzB;AAED,MAAM,WAAW,qBAAqB;IACpC,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,qBAAqB,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