@salesforce/magen-mcp-workflow 0.0.1

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.
Files changed (134) hide show
  1. package/README.md +168 -0
  2. package/dist/checkpointing/index.d.ts +3 -0
  3. package/dist/checkpointing/index.js +10 -0
  4. package/dist/checkpointing/index.js.map +1 -0
  5. package/dist/checkpointing/jsonCheckpointer.d.ts +19 -0
  6. package/dist/checkpointing/jsonCheckpointer.js +164 -0
  7. package/dist/checkpointing/jsonCheckpointer.js.map +1 -0
  8. package/dist/checkpointing/statePersistence.d.ts +26 -0
  9. package/dist/checkpointing/statePersistence.js +117 -0
  10. package/dist/checkpointing/statePersistence.js.map +1 -0
  11. package/dist/checkpointing/workflowStateManager.d.ts +99 -0
  12. package/dist/checkpointing/workflowStateManager.js +206 -0
  13. package/dist/checkpointing/workflowStateManager.js.map +1 -0
  14. package/dist/common/fileSystem.d.ts +113 -0
  15. package/dist/common/fileSystem.js +62 -0
  16. package/dist/common/fileSystem.js.map +1 -0
  17. package/dist/common/metadata.d.ts +93 -0
  18. package/dist/common/metadata.js +40 -0
  19. package/dist/common/metadata.js.map +1 -0
  20. package/dist/common/propertyMetadata.d.ts +58 -0
  21. package/dist/common/propertyMetadata.js +8 -0
  22. package/dist/common/propertyMetadata.js.map +1 -0
  23. package/dist/common/types.d.ts +16 -0
  24. package/dist/common/types.js +8 -0
  25. package/dist/common/types.js.map +1 -0
  26. package/dist/index.d.ts +15 -0
  27. package/dist/index.js +37 -0
  28. package/dist/index.js.map +1 -0
  29. package/dist/logging/logger.d.ts +56 -0
  30. package/dist/logging/logger.js +113 -0
  31. package/dist/logging/logger.js.map +1 -0
  32. package/dist/nodes/abstractBaseNode.d.ts +27 -0
  33. package/dist/nodes/abstractBaseNode.js +34 -0
  34. package/dist/nodes/abstractBaseNode.js.map +1 -0
  35. package/dist/nodes/abstractToolNode.d.ts +32 -0
  36. package/dist/nodes/abstractToolNode.js +44 -0
  37. package/dist/nodes/abstractToolNode.js.map +1 -0
  38. package/dist/nodes/getUserInput/factory.d.ts +42 -0
  39. package/dist/nodes/getUserInput/factory.js +64 -0
  40. package/dist/nodes/getUserInput/factory.js.map +1 -0
  41. package/dist/nodes/getUserInput/index.d.ts +2 -0
  42. package/dist/nodes/getUserInput/index.js +3 -0
  43. package/dist/nodes/getUserInput/index.js.map +1 -0
  44. package/dist/nodes/getUserInput/node.d.ts +68 -0
  45. package/dist/nodes/getUserInput/node.js +41 -0
  46. package/dist/nodes/getUserInput/node.js.map +1 -0
  47. package/dist/nodes/index.d.ts +5 -0
  48. package/dist/nodes/index.js +12 -0
  49. package/dist/nodes/index.js.map +1 -0
  50. package/dist/nodes/toolExecutor.d.ts +22 -0
  51. package/dist/nodes/toolExecutor.js +19 -0
  52. package/dist/nodes/toolExecutor.js.map +1 -0
  53. package/dist/nodes/userInputExtraction/factory.d.ts +42 -0
  54. package/dist/nodes/userInputExtraction/factory.js +55 -0
  55. package/dist/nodes/userInputExtraction/factory.js.map +1 -0
  56. package/dist/nodes/userInputExtraction/index.d.ts +2 -0
  57. package/dist/nodes/userInputExtraction/index.js +3 -0
  58. package/dist/nodes/userInputExtraction/index.js.map +1 -0
  59. package/dist/nodes/userInputExtraction/node.d.ts +60 -0
  60. package/dist/nodes/userInputExtraction/node.js +24 -0
  61. package/dist/nodes/userInputExtraction/node.js.map +1 -0
  62. package/dist/routers/checkPropertiesFulfilledRouter.d.ts +74 -0
  63. package/dist/routers/checkPropertiesFulfilledRouter.js +106 -0
  64. package/dist/routers/checkPropertiesFulfilledRouter.js.map +1 -0
  65. package/dist/routers/index.d.ts +1 -0
  66. package/dist/routers/index.js +8 -0
  67. package/dist/routers/index.js.map +1 -0
  68. package/dist/services/abstractService.d.ts +71 -0
  69. package/dist/services/abstractService.js +83 -0
  70. package/dist/services/abstractService.js.map +1 -0
  71. package/dist/services/getInputService.d.ts +43 -0
  72. package/dist/services/getInputService.js +48 -0
  73. package/dist/services/getInputService.js.map +1 -0
  74. package/dist/services/index.d.ts +3 -0
  75. package/dist/services/index.js +10 -0
  76. package/dist/services/index.js.map +1 -0
  77. package/dist/services/inputExtractionService.d.ts +46 -0
  78. package/dist/services/inputExtractionService.js +133 -0
  79. package/dist/services/inputExtractionService.js.map +1 -0
  80. package/dist/storage/wellKnownDirectory.d.ts +79 -0
  81. package/dist/storage/wellKnownDirectory.js +121 -0
  82. package/dist/storage/wellKnownDirectory.js.map +1 -0
  83. package/dist/tools/base/abstractTool.d.ts +61 -0
  84. package/dist/tools/base/abstractTool.js +87 -0
  85. package/dist/tools/base/abstractTool.js.map +1 -0
  86. package/dist/tools/base/abstractWorkflowTool.d.ts +34 -0
  87. package/dist/tools/base/abstractWorkflowTool.js +94 -0
  88. package/dist/tools/base/abstractWorkflowTool.js.map +1 -0
  89. package/dist/tools/base/index.d.ts +2 -0
  90. package/dist/tools/base/index.js +9 -0
  91. package/dist/tools/base/index.js.map +1 -0
  92. package/dist/tools/orchestrator/config.d.ts +55 -0
  93. package/dist/tools/orchestrator/config.js +8 -0
  94. package/dist/tools/orchestrator/config.js.map +1 -0
  95. package/dist/tools/orchestrator/index.d.ts +3 -0
  96. package/dist/tools/orchestrator/index.js +9 -0
  97. package/dist/tools/orchestrator/index.js.map +1 -0
  98. package/dist/tools/orchestrator/metadata.d.ts +55 -0
  99. package/dist/tools/orchestrator/metadata.js +49 -0
  100. package/dist/tools/orchestrator/metadata.js.map +1 -0
  101. package/dist/tools/orchestrator/orchestratorTool.d.ts +39 -0
  102. package/dist/tools/orchestrator/orchestratorTool.js +186 -0
  103. package/dist/tools/orchestrator/orchestratorTool.js.map +1 -0
  104. package/dist/tools/utilities/getInput/factory.d.ts +43 -0
  105. package/dist/tools/utilities/getInput/factory.js +32 -0
  106. package/dist/tools/utilities/getInput/factory.js.map +1 -0
  107. package/dist/tools/utilities/getInput/index.d.ts +3 -0
  108. package/dist/tools/utilities/getInput/index.js +10 -0
  109. package/dist/tools/utilities/getInput/index.js.map +1 -0
  110. package/dist/tools/utilities/getInput/metadata.d.ts +78 -0
  111. package/dist/tools/utilities/getInput/metadata.js +43 -0
  112. package/dist/tools/utilities/getInput/metadata.js.map +1 -0
  113. package/dist/tools/utilities/getInput/tool.d.ts +89 -0
  114. package/dist/tools/utilities/getInput/tool.js +69 -0
  115. package/dist/tools/utilities/getInput/tool.js.map +1 -0
  116. package/dist/tools/utilities/index.d.ts +2 -0
  117. package/dist/tools/utilities/index.js +9 -0
  118. package/dist/tools/utilities/index.js.map +1 -0
  119. package/dist/tools/utilities/inputExtraction/factory.d.ts +43 -0
  120. package/dist/tools/utilities/inputExtraction/factory.js +32 -0
  121. package/dist/tools/utilities/inputExtraction/factory.js.map +1 -0
  122. package/dist/tools/utilities/inputExtraction/index.d.ts +3 -0
  123. package/dist/tools/utilities/inputExtraction/index.js +10 -0
  124. package/dist/tools/utilities/inputExtraction/index.js.map +1 -0
  125. package/dist/tools/utilities/inputExtraction/metadata.d.ts +66 -0
  126. package/dist/tools/utilities/inputExtraction/metadata.js +52 -0
  127. package/dist/tools/utilities/inputExtraction/metadata.js.map +1 -0
  128. package/dist/tools/utilities/inputExtraction/tool.d.ts +82 -0
  129. package/dist/tools/utilities/inputExtraction/tool.js +71 -0
  130. package/dist/tools/utilities/inputExtraction/tool.js.map +1 -0
  131. package/dist/utils/toolExecutionUtils.d.ts +55 -0
  132. package/dist/utils/toolExecutionUtils.js +70 -0
  133. package/dist/utils/toolExecutionUtils.js.map +1 -0
  134. package/package.json +42 -0
@@ -0,0 +1,206 @@
1
+ /*
2
+ * Copyright (c) 2025, salesforce.com, inc.
3
+ * All rights reserved.
4
+ * SPDX-License-Identifier: MIT
5
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
6
+ */
7
+ import * as path from 'path';
8
+ import { MemorySaver } from '@langchain/langgraph';
9
+ import { createComponentLogger } from '../logging/logger.js';
10
+ import { JsonCheckpointSaver } from './jsonCheckpointer.js';
11
+ import { WellKnownDirectoryManager, WELL_KNOWN_FILES } from '../storage/wellKnownDirectory.js';
12
+ import { NodeFileSystemOperations } from '../common/fileSystem.js';
13
+ /**
14
+ * Manages workflow state persistence and checkpointer lifecycle
15
+ *
16
+ * This service encapsulates all workflow state management responsibilities:
17
+ * - Creating and configuring checkpointers (MemorySaver vs JsonCheckpointSaver)
18
+ * - Loading existing state from disk
19
+ * - Saving state to disk
20
+ * - Managing well-known directory paths
21
+ *
22
+ * This separation allows the orchestrator to focus on workflow execution logic
23
+ * while delegating all state management concerns to this service.
24
+ */
25
+ export class WorkflowStateManager {
26
+ logger;
27
+ environment;
28
+ wellKnownDirectoryManager;
29
+ fileSystemOperations;
30
+ constructor(config = {}) {
31
+ this.logger = config.logger || createComponentLogger('WorkflowStateManager');
32
+ this.environment = config.environment || 'production';
33
+ this.fileSystemOperations = config.fileSystemOperations ?? new NodeFileSystemOperations();
34
+ this.wellKnownDirectoryManager = new WellKnownDirectoryManager({
35
+ projectPath: config.projectPath,
36
+ fileSystemOperations: this.fileSystemOperations,
37
+ });
38
+ }
39
+ /**
40
+ * Creates a checkpointer configured for the current environment
41
+ *
42
+ * For 'test' environment:
43
+ * - Returns MemorySaver (in-memory, no file I/O)
44
+ *
45
+ * For 'production' environment:
46
+ * - Returns JsonCheckpointSaver
47
+ * - Automatically loads existing state from disk if available
48
+ * - Creates fresh checkpointer if no state exists
49
+ *
50
+ * @returns A configured checkpointer ready for use
51
+ */
52
+ async createCheckpointer() {
53
+ if (this.environment === 'test') {
54
+ this.logger.debug('Creating MemorySaver for test environment');
55
+ return new MemorySaver();
56
+ }
57
+ // Production environment: Use JsonCheckpointSaver with state persistence
58
+ this.logger.debug('Creating JsonCheckpointSaver for production environment');
59
+ const checkpointer = new JsonCheckpointSaver();
60
+ // Load existing state if available
61
+ const serializedState = await this.readState();
62
+ if (serializedState) {
63
+ this.logger.info('Importing existing checkpointer state from disk');
64
+ await checkpointer.importState(serializedState);
65
+ }
66
+ else {
67
+ this.logger.info('No existing state found, starting with fresh checkpointer');
68
+ }
69
+ return checkpointer;
70
+ }
71
+ /**
72
+ * Saves checkpointer state to disk (production mode only)
73
+ *
74
+ * Only applies to JsonCheckpointSaver. MemorySaver (used in test mode)
75
+ * intentionally does not persist state.
76
+ *
77
+ * @param checkpointer - The checkpointer to save
78
+ * @throws Error if test environment unexpectedly has JsonCheckpointSaver
79
+ */
80
+ async saveCheckpointerState(checkpointer) {
81
+ // Skip persistence for test environment (uses MemorySaver)
82
+ if (this.environment === 'test') {
83
+ // Sanity check: test environment should never have JsonCheckpointSaver
84
+ if (checkpointer instanceof JsonCheckpointSaver) {
85
+ throw new Error('Invalid state: test environment should use MemorySaver, not JsonCheckpointSaver');
86
+ }
87
+ this.logger.debug('Skipping state persistence in test environment');
88
+ return;
89
+ }
90
+ // Production environment: persist JsonCheckpointSaver state
91
+ if (!(checkpointer instanceof JsonCheckpointSaver)) {
92
+ this.logger.warn('Checkpointer is not JsonCheckpointSaver in production environment, skipping persistence');
93
+ return;
94
+ }
95
+ const exportedState = await checkpointer.exportState();
96
+ await this.writeState(exportedState);
97
+ this.logger.info('Checkpointer state successfully persisted to disk');
98
+ }
99
+ /**
100
+ * Reads the serialized state from disk if it exists
101
+ * @returns The serialized state string, or undefined if the file doesn't exist or is invalid
102
+ */
103
+ async readState() {
104
+ const storePath = this.getStatePath();
105
+ try {
106
+ // Check if the file exists
107
+ await this.fileSystemOperations.access(storePath);
108
+ this.logger.info(`Reading checkpointer state from: ${storePath}`);
109
+ // Read the file content
110
+ const content = await this.fileSystemOperations.readFile(storePath, 'utf-8');
111
+ // Validate that it's valid JSON
112
+ JSON.parse(content);
113
+ this.logger.debug('Successfully read and validated checkpointer state', {
114
+ stateSize: content.length,
115
+ path: storePath,
116
+ });
117
+ return content;
118
+ }
119
+ catch (error) {
120
+ if (error.code === 'ENOENT') {
121
+ this.logger.info(`Checkpointer state file not found: ${storePath}. Starting with fresh state.`);
122
+ return undefined;
123
+ }
124
+ else if (error instanceof SyntaxError) {
125
+ this.logger.warn(`Invalid JSON in state file: ${storePath}. Starting with fresh state.`, error);
126
+ return undefined;
127
+ }
128
+ else {
129
+ this.logger.error(`Failed to read checkpointer state from: ${storePath}`, error);
130
+ return undefined;
131
+ }
132
+ }
133
+ }
134
+ /**
135
+ * Writes the serialized state to disk
136
+ * @param serializedState The state to persist
137
+ */
138
+ async writeState(serializedState) {
139
+ const storePath = this.getStatePath();
140
+ try {
141
+ // Ensure the directory exists
142
+ const storeDir = path.dirname(storePath);
143
+ await this.fileSystemOperations.mkdir(storeDir, { recursive: true });
144
+ // Validate that the state is valid JSON before writing
145
+ JSON.parse(serializedState);
146
+ this.logger.info(`Saving checkpointer state to: ${storePath}`);
147
+ // Write the state to a temporary file first, then rename for atomicity
148
+ const tempPath = `${storePath}.tmp`;
149
+ await this.fileSystemOperations.writeFile(tempPath, serializedState, 'utf-8');
150
+ await this.fileSystemOperations.rename(tempPath, storePath);
151
+ this.logger.debug('Successfully saved checkpointer state', {
152
+ stateSize: serializedState.length,
153
+ path: storePath,
154
+ });
155
+ }
156
+ catch (error) {
157
+ if (error instanceof SyntaxError) {
158
+ this.logger.error(`Invalid JSON state provided for persistence. State not saved.`, error);
159
+ throw new Error(`Invalid serialized state: ${error.message}`);
160
+ }
161
+ else {
162
+ this.logger.error(`Failed to save checkpointer state to: ${storePath}`, error);
163
+ throw error;
164
+ }
165
+ }
166
+ }
167
+ /**
168
+ * Deletes the persisted state file
169
+ */
170
+ async clearState() {
171
+ const storePath = this.getStatePath();
172
+ try {
173
+ await this.fileSystemOperations.unlink(storePath);
174
+ this.logger.info(`Cleared checkpointer state file: ${storePath}`);
175
+ }
176
+ catch (error) {
177
+ if (error.code === 'ENOENT') {
178
+ this.logger.debug(`State file already doesn't exist: ${storePath}`);
179
+ }
180
+ else {
181
+ this.logger.error(`Failed to clear state file: ${storePath}`, error);
182
+ throw error;
183
+ }
184
+ }
185
+ }
186
+ /**
187
+ * Checks if a persisted state file exists
188
+ */
189
+ async stateExists() {
190
+ const storePath = this.getStatePath();
191
+ try {
192
+ const stat = await this.fileSystemOperations.stat(storePath);
193
+ return stat.isFile();
194
+ }
195
+ catch {
196
+ return false;
197
+ }
198
+ }
199
+ /**
200
+ * Gets the file path for workflow state storage
201
+ */
202
+ getStatePath() {
203
+ return this.wellKnownDirectoryManager.getWellKnownFilePath(WELL_KNOWN_FILES.WORKFLOW_STATE_STORE_FILENAME);
204
+ }
205
+ }
206
+ //# sourceMappingURL=workflowStateManager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workflowStateManager.js","sourceRoot":"","sources":["../../src/checkpointing/workflowStateManager.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAuB,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACxE,OAAO,EAAE,qBAAqB,EAAU,MAAM,sBAAsB,CAAC;AACrE,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,yBAAyB,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAC/F,OAAO,EAAwB,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;AAsCzF;;;;;;;;;;;GAWG;AACH,MAAM,OAAO,oBAAoB;IACd,MAAM,CAAS;IACf,WAAW,CAAsB;IACjC,yBAAyB,CAA4B;IACrD,oBAAoB,CAAuB;IAE5D,YAAY,SAAqC,EAAE;QACjD,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,IAAI,qBAAqB,CAAC,sBAAsB,CAAC,CAAC;QAC7E,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC,WAAW,IAAI,YAAY,CAAC;QACtD,IAAI,CAAC,oBAAoB,GAAG,MAAM,CAAC,oBAAoB,IAAI,IAAI,wBAAwB,EAAE,CAAC;QAC1F,IAAI,CAAC,yBAAyB,GAAG,IAAI,yBAAyB,CAAC;YAC7D,WAAW,EAAE,MAAM,CAAC,WAAW;YAC/B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a dependency injection interface for filesystem operations,
5
+ * enabling testability and flexibility across the workflow engine.
6
+ */
7
+ import fs from 'fs';
8
+ /**
9
+ * Interface for filesystem operations - enables dependency injection for testing
10
+ * and alternative filesystem implementations
11
+ *
12
+ * Provides both synchronous and asynchronous methods to support different use cases:
13
+ * - Sync methods: For simple, fast operations where blocking is acceptable
14
+ * - Async methods: For I/O-intensive operations requiring non-blocking behavior
15
+ */
16
+ export interface FileSystemOperations {
17
+ /**
18
+ * Check if a path exists in the filesystem (sync)
19
+ * @param path Path to check
20
+ * @returns true if the path exists, false otherwise
21
+ */
22
+ existsSync(path: string): boolean;
23
+ /**
24
+ * Create a directory (and any necessary parent directories) (sync)
25
+ * @param path Directory path to create
26
+ * @param options Options for directory creation (e.g., recursive, mode)
27
+ */
28
+ mkdirSync(path: string, options?: fs.MakeDirectoryOptions): void;
29
+ /**
30
+ * Create a temporary directory with a given prefix (sync)
31
+ * @param prefix Prefix for the temp directory name
32
+ * @returns Full path to the created directory
33
+ */
34
+ mkdtempSync(prefix: string): string;
35
+ /**
36
+ * Remove a file or directory (sync)
37
+ * @param path Path to remove
38
+ * @param options Options for removal (recursive, force, etc.)
39
+ */
40
+ rmSync(path: string, options?: {
41
+ recursive?: boolean;
42
+ force?: boolean;
43
+ }): void;
44
+ /**
45
+ * Get the OS temp directory path (sync)
46
+ * @returns Path to the OS temp directory
47
+ */
48
+ tmpdir(): string;
49
+ /**
50
+ * Check if a path exists and is accessible (async)
51
+ * @param path Path to check
52
+ * @throws Error if path doesn't exist or isn't accessible
53
+ */
54
+ access(path: string): Promise<void>;
55
+ /**
56
+ * Read file contents as string (async)
57
+ * @param path File path to read
58
+ * @param encoding Character encoding (e.g., 'utf-8')
59
+ * @returns File contents as string
60
+ */
61
+ readFile(path: string, encoding: BufferEncoding): Promise<string>;
62
+ /**
63
+ * Write string data to file (async)
64
+ * @param path File path to write
65
+ * @param data String data to write
66
+ * @param encoding Character encoding (e.g., 'utf-8')
67
+ */
68
+ writeFile(path: string, data: string, encoding: BufferEncoding): Promise<void>;
69
+ /**
70
+ * Rename/move a file atomically (async)
71
+ * @param oldPath Current file path
72
+ * @param newPath New file path
73
+ */
74
+ rename(oldPath: string, newPath: string): Promise<void>;
75
+ /**
76
+ * Delete a file (async)
77
+ * @param path File path to delete
78
+ */
79
+ unlink(path: string): Promise<void>;
80
+ /**
81
+ * Create a directory (and any necessary parent directories) (async)
82
+ * @param path Directory path to create
83
+ * @param options Options for directory creation (e.g., recursive, mode)
84
+ */
85
+ mkdir(path: string, options?: fs.MakeDirectoryOptions): Promise<void>;
86
+ /**
87
+ * Get file/directory statistics (async)
88
+ * @param path Path to stat
89
+ * @returns File statistics
90
+ */
91
+ stat(path: string): Promise<fs.Stats>;
92
+ }
93
+ /**
94
+ * Production implementation of FileSystemOperations using Node.js fs module
95
+ * Wraps both sync and async Node.js filesystem operations
96
+ */
97
+ export declare class NodeFileSystemOperations implements FileSystemOperations {
98
+ existsSync(path: string): boolean;
99
+ mkdirSync(path: string, options?: fs.MakeDirectoryOptions): void;
100
+ mkdtempSync(prefix: string): string;
101
+ rmSync(path: string, options?: {
102
+ recursive?: boolean;
103
+ force?: boolean;
104
+ }): void;
105
+ tmpdir(): string;
106
+ access(path: string): Promise<void>;
107
+ readFile(path: string, encoding: BufferEncoding): Promise<string>;
108
+ writeFile(path: string, data: string, encoding: BufferEncoding): Promise<void>;
109
+ rename(oldPath: string, newPath: string): Promise<void>;
110
+ unlink(path: string): Promise<void>;
111
+ mkdir(path: string, options?: fs.MakeDirectoryOptions): Promise<void>;
112
+ stat(path: string): Promise<fs.Stats>;
113
+ }
@@ -0,0 +1,62 @@
1
+ /*
2
+ * Copyright (c) 2025, salesforce.com, inc.
3
+ * All rights reserved.
4
+ * SPDX-License-Identifier: MIT
5
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
6
+ */
7
+ /**
8
+ * Filesystem Operations Abstraction
9
+ *
10
+ * Provides a dependency injection interface for filesystem operations,
11
+ * enabling testability and flexibility across the workflow engine.
12
+ */
13
+ import fs from 'fs';
14
+ import fsPromises from 'fs/promises';
15
+ import os from 'os';
16
+ /**
17
+ * Production implementation of FileSystemOperations using Node.js fs module
18
+ * Wraps both sync and async Node.js filesystem operations
19
+ */
20
+ /* c8 ignore start */
21
+ export class NodeFileSystemOperations {
22
+ // Synchronous operations
23
+ existsSync(path) {
24
+ return fs.existsSync(path);
25
+ }
26
+ mkdirSync(path, options) {
27
+ fs.mkdirSync(path, options);
28
+ }
29
+ mkdtempSync(prefix) {
30
+ return fs.mkdtempSync(prefix);
31
+ }
32
+ rmSync(path, options) {
33
+ fs.rmSync(path, options);
34
+ }
35
+ tmpdir() {
36
+ return os.tmpdir();
37
+ }
38
+ // Asynchronous operations
39
+ async access(path) {
40
+ return fsPromises.access(path);
41
+ }
42
+ async readFile(path, encoding) {
43
+ return fsPromises.readFile(path, encoding);
44
+ }
45
+ async writeFile(path, data, encoding) {
46
+ return fsPromises.writeFile(path, data, encoding);
47
+ }
48
+ async rename(oldPath, newPath) {
49
+ return fsPromises.rename(oldPath, newPath);
50
+ }
51
+ async unlink(path) {
52
+ return fsPromises.unlink(path);
53
+ }
54
+ async mkdir(path, options) {
55
+ await fsPromises.mkdir(path, options);
56
+ }
57
+ async stat(path) {
58
+ return fsPromises.stat(path);
59
+ }
60
+ }
61
+ /* c8 ignore stop */
62
+ //# sourceMappingURL=fileSystem.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fileSystem.js","sourceRoot":"","sources":["../../src/common/fileSystem.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;;;GAKG;AAEH,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,UAAU,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,MAAM,IAAI,CAAC;AAkGpB;;;GAGG;AACH,qBAAqB;AACrB,MAAM,OAAO,wBAAwB;IACnC,yBAAyB;IACzB,UAAU,CAAC,IAAY;QACrB,OAAO,EAAE,CAAC,UAAU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AAC,IAAI,CAAC,CAAC;IAC/B,CAAC;CACF;AACD,oBAAoB"}
@@ -0,0 +1,93 @@
1
+ import z from 'zod';
2
+ /**
3
+ * Workflow state data schema for round-tripping session identity
4
+ * This lightweight object maintains workflow session continuity across stateless MCP tool invocations
5
+ */
6
+ export declare const WORKFLOW_STATE_DATA_SCHEMA: z.ZodObject<{
7
+ thread_id: z.ZodString;
8
+ }, "strip", z.ZodTypeAny, {
9
+ thread_id: string;
10
+ }, {
11
+ thread_id: string;
12
+ }>;
13
+ export type WorkflowStateData = z.infer<typeof WORKFLOW_STATE_DATA_SCHEMA>;
14
+ /**
15
+ * Workflow property names - single source of truth for property naming
16
+ */
17
+ export declare const WORKFLOW_PROPERTY_NAMES: {
18
+ readonly workflowStateData: "workflowStateData";
19
+ readonly userInput: "userInput";
20
+ };
21
+ /**
22
+ * Base input schema for workflow-aware tools
23
+ * All tools participating in workflow orchestration should extend this schema
24
+ */
25
+ export declare const WORKFLOW_TOOL_BASE_INPUT_SCHEMA: z.ZodObject<{
26
+ workflowStateData: z.ZodObject<{
27
+ thread_id: z.ZodString;
28
+ }, "strip", z.ZodTypeAny, {
29
+ thread_id: string;
30
+ }, {
31
+ thread_id: string;
32
+ }>;
33
+ }, "strip", z.ZodTypeAny, {
34
+ workflowStateData: {
35
+ thread_id: string;
36
+ };
37
+ }, {
38
+ workflowStateData: {
39
+ thread_id: string;
40
+ };
41
+ }>;
42
+ /**
43
+ * MCP tool invocation data structure used in LangGraph interrupts
44
+ * Contains all information needed for the orchestrator to create tool invocation instructions
45
+ *
46
+ * @template TWorkflowInputSchema - The full workflow input schema (includes workflowStateData)
47
+ */
48
+ export interface MCPToolInvocationData<TWorkflowInputSchema extends z.ZodObject<z.ZodRawShape>> {
49
+ /** Metadata about the tool to invoke */
50
+ llmMetadata: {
51
+ name: string;
52
+ description: string;
53
+ inputSchema: TWorkflowInputSchema;
54
+ };
55
+ /** Input parameters for the tool invocation - typed to business logic schema only */
56
+ input: Omit<z.infer<TWorkflowInputSchema>, 'workflowStateData'>;
57
+ }
58
+ /**
59
+ * Standard output schema for all workflow MCP tools
60
+ */
61
+ export declare const MCP_WORKFLOW_TOOL_OUTPUT_SCHEMA: z.ZodObject<{
62
+ promptForLLM: z.ZodString;
63
+ resultSchema: z.ZodString;
64
+ }, "strip", z.ZodTypeAny, {
65
+ promptForLLM: string;
66
+ resultSchema: string;
67
+ }, {
68
+ promptForLLM: string;
69
+ resultSchema: string;
70
+ }>;
71
+ export type MCPWorkflowToolOutput = z.infer<typeof MCP_WORKFLOW_TOOL_OUTPUT_SCHEMA>;
72
+ /**
73
+ * Base tool metadata interface - defines the general structure for tool information
74
+ */
75
+ export interface ToolMetadata<TInputSchema extends z.ZodObject<z.ZodRawShape>, TOutputSchema extends z.ZodObject<z.ZodRawShape>> {
76
+ /** Unique tool identifier used for MCP registration and workflow orchestration */
77
+ readonly toolId: string;
78
+ /** Extended tool title for detailed display */
79
+ readonly title: string;
80
+ /** Tool description for documentation and LLM context */
81
+ readonly description: string;
82
+ /** Zod input schema for validation */
83
+ readonly inputSchema: TInputSchema;
84
+ /** Zod output schema for validation */
85
+ readonly outputSchema: TOutputSchema;
86
+ }
87
+ /**
88
+ * Workflow tool metadata interface - defines the structure for workflow tool information
89
+ */
90
+ export interface WorkflowToolMetadata<TInputSchema extends typeof WORKFLOW_TOOL_BASE_INPUT_SCHEMA, TResultSchema extends z.ZodObject<z.ZodRawShape>, TOutputSchema extends typeof MCP_WORKFLOW_TOOL_OUTPUT_SCHEMA = typeof MCP_WORKFLOW_TOOL_OUTPUT_SCHEMA> extends ToolMetadata<TInputSchema, TOutputSchema> {
91
+ /** Holds the shape of the expected result for guidance-based tools */
92
+ readonly resultSchema: TResultSchema;
93
+ }
@@ -0,0 +1,40 @@
1
+ /*
2
+ * Copyright (c) 2025, salesforce.com, inc.
3
+ * All rights reserved.
4
+ * SPDX-License-Identifier: MIT
5
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
6
+ */
7
+ import z from 'zod';
8
+ /**
9
+ * Workflow state data schema for round-tripping session identity
10
+ * This lightweight object maintains workflow session continuity across stateless MCP tool invocations
11
+ */
12
+ export const WORKFLOW_STATE_DATA_SCHEMA = z.object({
13
+ thread_id: z.string().describe('Unique identifier for the workflow session'),
14
+ });
15
+ /**
16
+ * Workflow property names - single source of truth for property naming
17
+ */
18
+ export const WORKFLOW_PROPERTY_NAMES = {
19
+ workflowStateData: 'workflowStateData',
20
+ userInput: 'userInput',
21
+ };
22
+ /**
23
+ * Base input schema for workflow-aware tools
24
+ * All tools participating in workflow orchestration should extend this schema
25
+ */
26
+ export const WORKFLOW_TOOL_BASE_INPUT_SCHEMA = z.object({
27
+ [WORKFLOW_PROPERTY_NAMES.workflowStateData]: WORKFLOW_STATE_DATA_SCHEMA.describe('Workflow session state for continuation. Required for all workflow-aware tools, but optional for the orchestrator tool, because it can also start new workflows.'),
28
+ });
29
+ /**
30
+ * Standard output schema for all workflow MCP tools
31
+ */
32
+ export const MCP_WORKFLOW_TOOL_OUTPUT_SCHEMA = z.object({
33
+ promptForLLM: z
34
+ .string()
35
+ .describe('Complete prompt with instructions and post-processing guidance'),
36
+ resultSchema: z
37
+ .string()
38
+ .describe("The string-serialized JSON schema of the expected result from the LLM's task"),
39
+ });
40
+ //# sourceMappingURL=metadata.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"metadata.js","sourceRoot":"","sources":["../../src/common/metadata.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,CAAC,MAAM,KAAK,CAAC;AAEpB;;;GAGG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,CAAC,MAAM,CAAC;IACjD,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,4CAA4C,CAAC;CAC7E,CAAC,CAAC;AAIH;;GAEG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC,iBAAiB,EAAE,mBAAmB;IACtC,SAAS,EAAE,WAAW;CACd,CAAC;AAEX;;;GAGG;AACH,MAAM,CAAC,MAAM,+BAA+B,GAAG,CAAC,CAAC,MAAM,CAAC;IACtD,CAAC,uBAAuB,CAAC,iBAAiB,CAAC,EAAE,0BAA0B,CAAC,QAAQ,CAC9E,kKAAkK,CACnK;CACF,CAAC,CAAC;AAmBH;;GAEG;AACH,MAAM,CAAC,MAAM,+BAA+B,GAAG,CAAC,CAAC,MAAM,CAAC;IACtD,YAAY,EAAE,CAAC;SACZ,MAAM,EAAE;SACR,QAAQ,CAAC,gEAAgE,CAAC;IAC7E,YAAY,EAAE,CAAC;SACZ,MAAM,EAAE;SACR,QAAQ,CAAC,8EAA8E,CAAC;CAC5F,CAAC,CAAC"}
@@ -0,0 +1,58 @@
1
+ import z from 'zod';
2
+ /**
3
+ * Metadata definition for a property that can be extracted from user input.
4
+ *
5
+ * This type provides a generalized structure for defining properties that need to be
6
+ * collected from users, either through extraction from natural language or explicit prompting.
7
+ *
8
+ * @template T - The Zod schema type for this property
9
+ *
10
+ * @property zodType - Zod schema used for validation and type inference
11
+ * @property description - Detailed description used by LLMs to identify the property in user input
12
+ * @property friendlyName - Human-readable name for display and prompting
13
+ *
14
+ * @example
15
+ * const platformProperty: PropertyMetadata<typeof PLATFORM_ENUM> = {
16
+ * zodType: PLATFORM_ENUM,
17
+ * description: 'Target mobile platform for the mobile app (iOS or Android)',
18
+ * friendlyName: 'mobile platform',
19
+ * };
20
+ */
21
+ export interface PropertyMetadata<T extends z.ZodTypeAny = z.ZodTypeAny> {
22
+ /** Zod schema for validation and type inference */
23
+ readonly zodType: T;
24
+ /** Detailed description for LLM-based extraction */
25
+ readonly description: string;
26
+ /** Human-readable name for display */
27
+ readonly friendlyName: string;
28
+ }
29
+ /**
30
+ * Collection of properties with their metadata.
31
+ * Used to define a set of related properties that can be extracted together.
32
+ *
33
+ * @example
34
+ * const myProperties: PropertyMetadataCollection = {
35
+ * platform: {
36
+ * zodType: z.enum(['iOS', 'Android']),
37
+ * description: 'Target mobile platform',
38
+ * friendlyName: 'platform',
39
+ * },
40
+ * projectName: {
41
+ * zodType: z.string(),
42
+ * description: 'Name of the project',
43
+ * friendlyName: 'project name',
44
+ * },
45
+ * };
46
+ */
47
+ export type PropertyMetadataCollection = Record<string, PropertyMetadata>;
48
+ /**
49
+ * Extracts the inferred TypeScript types from a PropertyMetadataCollection.
50
+ * Useful for creating type-safe objects that match the property definitions.
51
+ *
52
+ * @example
53
+ * type MyProps = InferPropertyTypes<typeof myProperties>;
54
+ * // Results in: { platform: 'iOS' | 'Android', projectName: string }
55
+ */
56
+ export type InferPropertyTypes<T extends PropertyMetadataCollection> = {
57
+ [K in keyof T]: z.infer<T[K]['zodType']>;
58
+ };
@@ -0,0 +1,8 @@
1
+ /*
2
+ * Copyright (c) 2025, salesforce.com, inc.
3
+ * All rights reserved.
4
+ * SPDX-License-Identifier: MIT
5
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
6
+ */
7
+ export {};
8
+ //# sourceMappingURL=propertyMetadata.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"propertyMetadata.js","sourceRoot":"","sources":["../../src/common/propertyMetadata.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
@@ -0,0 +1,16 @@
1
+ import { StateType, StateDefinition } from '@langchain/langgraph';
2
+ /**
3
+ * Describes the result of checking if a property is fulfilled.
4
+ *
5
+ * @property isFulfilled - Boolean indicating if the property is fulfilled.
6
+ * @property reason - Optional string explaining why the property is not fulfilled.
7
+ */
8
+ export type PropertyFulfilledResult = {
9
+ isFulfilled: boolean;
10
+ reason?: string;
11
+ };
12
+ /**
13
+ * Function signature for checking if a property is fulfilled in the state.
14
+ * It can return a boolean or a PropertyFulfilledResult for more detailed feedback.
15
+ */
16
+ export type IsPropertyFulfilled<TState extends StateType<StateDefinition>> = (state: TState, propertyName: string) => PropertyFulfilledResult;
@@ -0,0 +1,8 @@
1
+ /*
2
+ * Copyright (c) 2025, salesforce.com, inc.
3
+ * All rights reserved.
4
+ * SPDX-License-Identifier: MIT
5
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
6
+ */
7
+ export {};
8
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/common/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
@@ -0,0 +1,15 @@
1
+ export { type FileSystemOperations, NodeFileSystemOperations } from './common/fileSystem.js';
2
+ export { WELL_KNOWN_DIR_NAME, WELL_KNOWN_FILES, type WellKnownDirectoryConfig, WellKnownDirectoryManager, } from './storage/wellKnownDirectory.js';
3
+ export { Logger, PinoLogger, createLogger, createComponentLogger, createWorkflowLogger, } from './logging/logger.js';
4
+ export { WORKFLOW_STATE_DATA_SCHEMA, WORKFLOW_PROPERTY_NAMES, WORKFLOW_TOOL_BASE_INPUT_SCHEMA, MCP_WORKFLOW_TOOL_OUTPUT_SCHEMA, type WorkflowStateData, type MCPToolInvocationData, type MCPWorkflowToolOutput, type ToolMetadata, type WorkflowToolMetadata, } from './common/metadata.js';
5
+ export { type PropertyMetadata, type PropertyMetadataCollection, type InferPropertyTypes, } from './common/propertyMetadata.js';
6
+ export { type PropertyFulfilledResult, type IsPropertyFulfilled } from './common/types.js';
7
+ export { type ToolExecutor, LangGraphToolExecutor } from './nodes/toolExecutor.js';
8
+ export { executeToolWithLogging } from './utils/toolExecutionUtils.js';
9
+ export { AbstractTool, AbstractWorkflowTool } from './tools/base/index.js';
10
+ export { GetInputTool, createGetInputTool, createGetInputMetadata, type GetInputToolOptions, type GetInputToolMetadata, type GetInputWorkflowInput, GET_INPUT_PROPERTY_SCHEMA, GET_INPUT_WORKFLOW_INPUT_SCHEMA, GET_INPUT_WORKFLOW_RESULT_SCHEMA, InputExtractionTool, createInputExtractionTool, createInputExtractionMetadata, type InputExtractionToolOptions, type InputExtractionToolMetadata, type InputExtractionWorkflowInput, INPUT_EXTRACTION_WORKFLOW_INPUT_SCHEMA, INPUT_EXTRACTION_WORKFLOW_RESULT_SCHEMA, } from './tools/utilities/index.js';
11
+ export { BaseNode, AbstractToolNode, createGetUserInputNode, createUserInputExtractionNode, type GetUserInputNodeOptions, type UserInputExtractionNodeOptions, } from './nodes/index.js';
12
+ export { CheckPropertiesFulfilledRouter } from './routers/index.js';
13
+ export { AbstractService } from './services/index.js';
14
+ export { JsonCheckpointSaver, WorkflowStatePersistence, WorkflowStateManager, type WorkflowStateManagerConfig, type WorkflowEnvironment, } from './checkpointing/index.js';
15
+ export { OrchestratorTool, createOrchestratorToolMetadata, type OrchestratorConfig, type OrchestratorInput, type OrchestratorOutput, type OrchestratorToolMetadata, ORCHESTRATOR_INPUT_SCHEMA, ORCHESTRATOR_OUTPUT_SCHEMA, } from './tools/orchestrator/index.js';