@salesforce/magen-mcp-workflow 0.0.1 → 0.0.3

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 (82) hide show
  1. package/dist/common/graphConfig.d.ts +26 -0
  2. package/dist/{tools/utilities/inputExtraction/index.js → common/graphConfig.js} +2 -4
  3. package/dist/common/graphConfig.js.map +1 -0
  4. package/dist/common/metadata.d.ts +51 -10
  5. package/dist/common/metadata.js +9 -0
  6. package/dist/common/metadata.js.map +1 -1
  7. package/dist/execution/commandRunner.d.ts +28 -0
  8. package/dist/execution/commandRunner.js +162 -0
  9. package/dist/execution/commandRunner.js.map +1 -0
  10. package/dist/execution/index.d.ts +3 -0
  11. package/dist/execution/index.js +9 -0
  12. package/dist/execution/index.js.map +1 -0
  13. package/dist/execution/progressReporter.d.ts +33 -0
  14. package/dist/execution/progressReporter.js +58 -0
  15. package/dist/execution/progressReporter.js.map +1 -0
  16. package/dist/execution/types.d.ts +54 -0
  17. package/dist/execution/types.js +8 -0
  18. package/dist/execution/types.js.map +1 -0
  19. package/dist/index.d.ts +4 -2
  20. package/dist/index.js +5 -7
  21. package/dist/index.js.map +1 -1
  22. package/dist/nodes/abstractBaseNode.d.ts +29 -3
  23. package/dist/nodes/abstractBaseNode.js +26 -2
  24. package/dist/nodes/abstractBaseNode.js.map +1 -1
  25. package/dist/nodes/abstractToolNode.d.ts +5 -3
  26. package/dist/nodes/abstractToolNode.js +5 -3
  27. package/dist/nodes/abstractToolNode.js.map +1 -1
  28. package/dist/nodes/getUserInput/factory.js +2 -2
  29. package/dist/nodes/getUserInput/factory.js.map +1 -1
  30. package/dist/nodes/getUserInput/node.d.ts +19 -1
  31. package/dist/nodes/getUserInput/node.js +2 -2
  32. package/dist/nodes/getUserInput/node.js.map +1 -1
  33. package/dist/nodes/toolExecutor.d.ts +5 -4
  34. package/dist/nodes/toolExecutor.js +2 -2
  35. package/dist/nodes/toolExecutor.js.map +1 -1
  36. package/dist/routers/checkPropertiesFulfilledRouter.js +2 -2
  37. package/dist/routers/checkPropertiesFulfilledRouter.js.map +1 -1
  38. package/dist/services/abstractService.d.ts +5 -5
  39. package/dist/services/abstractService.js +5 -5
  40. package/dist/services/abstractService.js.map +1 -1
  41. package/dist/services/getInputService.d.ts +10 -2
  42. package/dist/services/getInputService.js +50 -15
  43. package/dist/services/getInputService.js.map +1 -1
  44. package/dist/services/inputExtractionService.d.ts +11 -2
  45. package/dist/services/inputExtractionService.js +94 -18
  46. package/dist/services/inputExtractionService.js.map +1 -1
  47. package/dist/tools/orchestrator/metadata.d.ts +49 -3
  48. package/dist/tools/orchestrator/metadata.js +31 -4
  49. package/dist/tools/orchestrator/metadata.js.map +1 -1
  50. package/dist/tools/orchestrator/orchestratorTool.d.ts +44 -3
  51. package/dist/tools/orchestrator/orchestratorTool.js +138 -13
  52. package/dist/tools/orchestrator/orchestratorTool.js.map +1 -1
  53. package/dist/tools/utilities/getInput/index.d.ts +0 -2
  54. package/dist/tools/utilities/getInput/index.js +0 -2
  55. package/dist/tools/utilities/getInput/index.js.map +1 -1
  56. package/dist/tools/utilities/getInput/metadata.d.ts +2 -68
  57. package/dist/tools/utilities/getInput/metadata.js +2 -30
  58. package/dist/tools/utilities/getInput/metadata.js.map +1 -1
  59. package/dist/tools/utilities/index.d.ts +0 -1
  60. package/dist/tools/utilities/index.js +0 -1
  61. package/dist/tools/utilities/index.js.map +1 -1
  62. package/dist/utils/toolExecutionUtils.d.ts +6 -6
  63. package/dist/utils/toolExecutionUtils.js +7 -7
  64. package/dist/utils/toolExecutionUtils.js.map +1 -1
  65. package/package.json +3 -3
  66. package/dist/tools/utilities/getInput/factory.d.ts +0 -43
  67. package/dist/tools/utilities/getInput/factory.js +0 -32
  68. package/dist/tools/utilities/getInput/factory.js.map +0 -1
  69. package/dist/tools/utilities/getInput/tool.d.ts +0 -89
  70. package/dist/tools/utilities/getInput/tool.js +0 -69
  71. package/dist/tools/utilities/getInput/tool.js.map +0 -1
  72. package/dist/tools/utilities/inputExtraction/factory.d.ts +0 -43
  73. package/dist/tools/utilities/inputExtraction/factory.js +0 -32
  74. package/dist/tools/utilities/inputExtraction/factory.js.map +0 -1
  75. package/dist/tools/utilities/inputExtraction/index.d.ts +0 -3
  76. package/dist/tools/utilities/inputExtraction/index.js.map +0 -1
  77. package/dist/tools/utilities/inputExtraction/metadata.d.ts +0 -66
  78. package/dist/tools/utilities/inputExtraction/metadata.js +0 -52
  79. package/dist/tools/utilities/inputExtraction/metadata.js.map +0 -1
  80. package/dist/tools/utilities/inputExtraction/tool.d.ts +0 -82
  81. package/dist/tools/utilities/inputExtraction/tool.js +0 -71
  82. package/dist/tools/utilities/inputExtraction/tool.js.map +0 -1
@@ -0,0 +1,26 @@
1
+ import { RunnableConfig } from '@langchain/core/runnables';
2
+ import type { ProgressReporter } from '../execution/progressReporter.js';
3
+ /**
4
+ * Base configurable properties for workflow graphs.
5
+ * Contains thread_id for checkpointing and optional runtime dependencies.
6
+ *
7
+ * This interface defines the workflow-specific properties that extend
8
+ * LangGraph's base configurable type.
9
+ */
10
+ export interface BaseGraphConfig {
11
+ /** Thread ID for checkpointing */
12
+ thread_id: string;
13
+ /** Progress reporter for long-running operations */
14
+ progressReporter?: ProgressReporter;
15
+ }
16
+ /**
17
+ * Extended RunnableConfig with workflow-specific configurable properties.
18
+ * Nodes access runtime context via config.configurable.
19
+ *
20
+ * The configurable property extends RunnableConfig's configurable with
21
+ * our workflow-specific BaseGraphConfig properties. This allows nodes
22
+ * to safely access thread_id and progressReporter when available.
23
+ */
24
+ export interface WorkflowRunnableConfig extends RunnableConfig {
25
+ configurable?: RunnableConfig['configurable'] & Partial<BaseGraphConfig>;
26
+ }
@@ -4,7 +4,5 @@
4
4
  * SPDX-License-Identifier: MIT
5
5
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
6
6
  */
7
- export * from './tool.js';
8
- export * from './metadata.js';
9
- export * from './factory.js';
10
- //# sourceMappingURL=index.js.map
7
+ export {};
8
+ //# sourceMappingURL=graphConfig.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graphConfig.js","sourceRoot":"","sources":["../../src/common/graphConfig.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
@@ -40,21 +40,62 @@ export declare const WORKFLOW_TOOL_BASE_INPUT_SCHEMA: z.ZodObject<{
40
40
  };
41
41
  }>;
42
42
  /**
43
- * MCP tool invocation data structure used in LangGraph interrupts
44
- * Contains all information needed for the orchestrator to create tool invocation instructions
43
+ * MCP tool invocation data structure used in LangGraph interrupts (Delegate Mode).
45
44
  *
46
- * @template TWorkflowInputSchema - The full workflow input schema (includes workflowStateData)
45
+ * When the orchestrator receives this data, it instructs the LLM to invoke a separate
46
+ * MCP tool with the provided metadata and input.
47
+ *
48
+ * @template TInputSchema - The full workflow input schema (includes workflowStateData)
47
49
  */
48
- export interface MCPToolInvocationData<TWorkflowInputSchema extends z.ZodObject<z.ZodRawShape>> {
49
- /** Metadata about the tool to invoke */
50
+ export interface MCPToolInvocationData<TInputSchema extends z.ZodObject<z.ZodRawShape>> {
51
+ /** Input parameters - typed to business logic schema only (excludes workflowStateData) */
52
+ input: Omit<z.infer<TInputSchema>, 'workflowStateData'>;
53
+ /** Metadata about the tool to invoke, including the input schema for LLM context */
50
54
  llmMetadata: {
51
55
  name: string;
52
56
  description: string;
53
- inputSchema: TWorkflowInputSchema;
57
+ /** Zod schema for input validation and LLM context */
58
+ inputSchema: TInputSchema;
54
59
  };
55
- /** Input parameters for the tool invocation - typed to business logic schema only */
56
- input: Omit<z.infer<TWorkflowInputSchema>, 'workflowStateData'>;
57
60
  }
61
+ /**
62
+ * Node guidance data structure used in LangGraph interrupts (Direct Guidance Mode).
63
+ *
64
+ * When the orchestrator receives this data, it generates guidance directly inline
65
+ * instead of delegating to a separate tool. This reduces latency by eliminating
66
+ * an intermediate tool call.
67
+ *
68
+ * @template TResultSchema - The Zod schema for validating the result
69
+ */
70
+ export interface NodeGuidanceData<TResultSchema extends z.ZodObject<z.ZodRawShape>> {
71
+ /** Unique identifier for this service/node - used for logging and debugging */
72
+ nodeId: string;
73
+ /** The task guidance/prompt that instructs the LLM what to do */
74
+ taskGuidance: string;
75
+ /** Zod schema defining expected output structure for result validation */
76
+ resultSchema: TResultSchema;
77
+ /**
78
+ * Optional example output to help the LLM understand the expected response format.
79
+ * When provided, this concrete example is shown alongside the schema to improve
80
+ * LLM compliance with the expected structure.
81
+ */
82
+ exampleOutput?: string;
83
+ }
84
+ /**
85
+ * Union type for all interrupt data types.
86
+ * The orchestrator uses this to handle both delegate and direct guidance modes.
87
+ *
88
+ * @template TInputSchema - For MCPToolInvocationData: the full workflow input schema
89
+ * @template TResultSchema - For NodeGuidanceData: the result validation schema
90
+ */
91
+ export type InterruptData<TInputSchema extends z.ZodObject<z.ZodRawShape>, TResultSchema extends z.ZodObject<z.ZodRawShape>> = MCPToolInvocationData<TInputSchema> | NodeGuidanceData<TResultSchema>;
92
+ /**
93
+ * Type guard to check if interrupt data is NodeGuidanceData (direct guidance mode).
94
+ *
95
+ * @param data - The interrupt data to check
96
+ * @returns true if the data is NodeGuidanceData, false if it's MCPToolInvocationData
97
+ */
98
+ export declare function isNodeGuidanceData<TInputSchema extends z.ZodObject<z.ZodRawShape>, TResultSchema extends z.ZodObject<z.ZodRawShape>>(data: InterruptData<TInputSchema, TResultSchema>): data is NodeGuidanceData<TResultSchema>;
58
99
  /**
59
100
  * Standard output schema for all workflow MCP tools
60
101
  */
@@ -62,11 +103,11 @@ export declare const MCP_WORKFLOW_TOOL_OUTPUT_SCHEMA: z.ZodObject<{
62
103
  promptForLLM: z.ZodString;
63
104
  resultSchema: z.ZodString;
64
105
  }, "strip", z.ZodTypeAny, {
65
- promptForLLM: string;
66
106
  resultSchema: string;
67
- }, {
68
107
  promptForLLM: string;
108
+ }, {
69
109
  resultSchema: string;
110
+ promptForLLM: string;
70
111
  }>;
71
112
  export type MCPWorkflowToolOutput = z.infer<typeof MCP_WORKFLOW_TOOL_OUTPUT_SCHEMA>;
72
113
  /**
@@ -26,6 +26,15 @@ export const WORKFLOW_PROPERTY_NAMES = {
26
26
  export const WORKFLOW_TOOL_BASE_INPUT_SCHEMA = z.object({
27
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
28
  });
29
+ /**
30
+ * Type guard to check if interrupt data is NodeGuidanceData (direct guidance mode).
31
+ *
32
+ * @param data - The interrupt data to check
33
+ * @returns true if the data is NodeGuidanceData, false if it's MCPToolInvocationData
34
+ */
35
+ export function isNodeGuidanceData(data) {
36
+ return 'taskGuidance' in data && 'resultSchema' in data && 'nodeId' in data;
37
+ }
29
38
  /**
30
39
  * Standard output schema for all workflow MCP tools
31
40
  */
@@ -1 +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"}
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;AA0DH;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CAGhC,IAAgD;IAChD,OAAO,cAAc,IAAI,IAAI,IAAI,cAAc,IAAI,IAAI,IAAI,QAAQ,IAAI,IAAI,CAAC;AAC9E,CAAC;AAED;;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,28 @@
1
+ import { Logger } from '../logging/logger.js';
2
+ import type { CommandResult, CommandExecutionOptions } from './types.js';
3
+ /**
4
+ * Generic command execution abstraction that handles process spawning,
5
+ * output capture, and progress reporting.
6
+ */
7
+ export interface CommandRunner {
8
+ /**
9
+ * Executes a command and returns the result.
10
+ *
11
+ * @param command - Command to execute
12
+ * @param args - Command arguments
13
+ * @param options - Execution options
14
+ * @returns Command execution result
15
+ */
16
+ execute(command: string, args: string[], options?: CommandExecutionOptions): Promise<CommandResult>;
17
+ }
18
+ /**
19
+ * Default implementation of CommandRunner using Node.js spawn.
20
+ */
21
+ export declare class DefaultCommandRunner implements CommandRunner {
22
+ private readonly logger;
23
+ private readonly defaultTimeout;
24
+ private static readonly PROGRESS_TOTAL;
25
+ private static readonly DEFAULT_PROGRESS_DEBOUNCE_MS;
26
+ constructor(logger?: Logger, defaultTimeout?: number);
27
+ execute(command: string, args: string[], options?: CommandExecutionOptions): Promise<CommandResult>;
28
+ }
@@ -0,0 +1,162 @@
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 { spawn } from 'child_process';
8
+ import { createWriteStream } from 'fs';
9
+ import { createComponentLogger } from '../logging/logger.js';
10
+ /**
11
+ * Default implementation of CommandRunner using Node.js spawn.
12
+ */
13
+ export class DefaultCommandRunner {
14
+ logger;
15
+ defaultTimeout;
16
+ static PROGRESS_TOTAL = 100;
17
+ static DEFAULT_PROGRESS_DEBOUNCE_MS = 2000;
18
+ constructor(logger, defaultTimeout = 300000) {
19
+ this.logger = logger ?? createComponentLogger('CommandRunner');
20
+ this.defaultTimeout = defaultTimeout;
21
+ }
22
+ async execute(command, args, options = { commandName: 'Command' }) {
23
+ const { env: providedEnv = process.env, timeout = this.defaultTimeout, cwd, progressParser, progressReporter, outputFilePath, commandName, progressDebounceMs = DefaultCommandRunner.DEFAULT_PROGRESS_DEBOUNCE_MS, } = options;
24
+ // Ensure UTF-8 encoding environment variables are set for tools like CocoaPods
25
+ // Allow overrides if explicitly provided in env
26
+ const env = {
27
+ ...providedEnv,
28
+ LANG: providedEnv.LANG || 'en_US.UTF-8',
29
+ LC_ALL: providedEnv.LC_ALL || 'en_US.UTF-8',
30
+ };
31
+ const startTime = Date.now();
32
+ let stdout = '';
33
+ let stderr = '';
34
+ let currentProgress = 0;
35
+ let lastReportedProgress = null;
36
+ let lastReportTime = null;
37
+ return new Promise((resolve, reject) => {
38
+ const outputStream = outputFilePath ? createWriteStream(outputFilePath) : null;
39
+ const childProcess = spawn(command, args, {
40
+ env,
41
+ shell: true,
42
+ stdio: ['ignore', 'pipe', 'pipe'],
43
+ cwd,
44
+ });
45
+ // Initialize progress reporting
46
+ if (progressReporter) {
47
+ const startMessage = `Starting "${commandName}" command execution...`;
48
+ progressReporter.report(0, DefaultCommandRunner.PROGRESS_TOTAL, startMessage);
49
+ }
50
+ // Capture stdout and report progress on each chunk to keep task alive
51
+ childProcess.stdout?.on('data', (data) => {
52
+ const text = data.toString('utf-8');
53
+ stdout += text;
54
+ outputStream?.write(text);
55
+ // Report progress on each stdout chunk to keep task alive
56
+ if (progressReporter) {
57
+ const elapsed = Date.now() - startTime;
58
+ const elapsedSeconds = Math.floor(elapsed / 1000);
59
+ const now = Date.now();
60
+ // Parse progress if parser provided
61
+ if (progressParser) {
62
+ try {
63
+ const parseResult = progressParser(stdout, currentProgress);
64
+ if (parseResult.progress > currentProgress) {
65
+ currentProgress = parseResult.progress;
66
+ }
67
+ // Check if we should report: always report if progress changed, or if debounce time elapsed
68
+ const progressChanged = lastReportedProgress !== currentProgress;
69
+ const debounceElapsed = lastReportTime === null || now - lastReportTime >= progressDebounceMs;
70
+ if (progressChanged || debounceElapsed) {
71
+ const progressMessage = parseResult.message || `${commandName}... (${elapsedSeconds}s elapsed)`;
72
+ progressReporter.report(currentProgress, DefaultCommandRunner.PROGRESS_TOTAL, progressMessage);
73
+ lastReportedProgress = currentProgress;
74
+ lastReportTime = now;
75
+ }
76
+ }
77
+ catch (_error) {
78
+ // If parsing fails, still report progress to keep task alive
79
+ const progressChanged = lastReportedProgress !== currentProgress;
80
+ const debounceElapsed = lastReportTime === null || now - lastReportTime >= progressDebounceMs;
81
+ if (progressChanged || debounceElapsed) {
82
+ const progressMessage = `${commandName}... (${elapsedSeconds}s elapsed)`;
83
+ progressReporter.report(currentProgress, DefaultCommandRunner.PROGRESS_TOTAL, progressMessage);
84
+ lastReportedProgress = currentProgress;
85
+ lastReportTime = now;
86
+ }
87
+ }
88
+ }
89
+ else {
90
+ // No parser - just report activity to keep task alive
91
+ const progressChanged = lastReportedProgress !== currentProgress;
92
+ const debounceElapsed = lastReportTime === null || now - lastReportTime >= progressDebounceMs;
93
+ if (progressChanged || debounceElapsed) {
94
+ const progressMessage = commandName
95
+ ? `${commandName}... (${elapsedSeconds}s elapsed)`
96
+ : `Command in progress... (${elapsedSeconds}s elapsed)`;
97
+ progressReporter.report(currentProgress, DefaultCommandRunner.PROGRESS_TOTAL, progressMessage);
98
+ lastReportedProgress = currentProgress;
99
+ lastReportTime = now;
100
+ }
101
+ }
102
+ }
103
+ });
104
+ // Capture stderr
105
+ childProcess.stderr?.on('data', (data) => {
106
+ const text = data.toString('utf-8');
107
+ stderr += text;
108
+ outputStream?.write(text);
109
+ });
110
+ // Handle process completion
111
+ childProcess.on('exit', (code, signal) => {
112
+ outputStream?.end();
113
+ const duration = Date.now() - startTime;
114
+ const success = code === 0;
115
+ if (progressReporter) {
116
+ if (success) {
117
+ const successMessage = `"${commandName}" command completed successfully`;
118
+ progressReporter.report(DefaultCommandRunner.PROGRESS_TOTAL, DefaultCommandRunner.PROGRESS_TOTAL, successMessage);
119
+ }
120
+ else {
121
+ const errorMsg = signal
122
+ ? `Command terminated by signal: ${signal}`
123
+ : `Command failed with exit code: ${code}`;
124
+ // Don't report 100% for failures - keep current progress to indicate incomplete
125
+ progressReporter.report(currentProgress, DefaultCommandRunner.PROGRESS_TOTAL, errorMsg);
126
+ }
127
+ }
128
+ resolve({
129
+ exitCode: code,
130
+ signal: signal ?? null,
131
+ stdout,
132
+ stderr,
133
+ success,
134
+ duration,
135
+ });
136
+ });
137
+ // Handle process errors
138
+ childProcess.on('error', error => {
139
+ outputStream?.end();
140
+ if (progressReporter) {
141
+ const errorMessage = `"${commandName}" command execution error: ${error.message}`;
142
+ progressReporter.report(DefaultCommandRunner.PROGRESS_TOTAL, DefaultCommandRunner.PROGRESS_TOTAL, errorMessage);
143
+ }
144
+ reject(error);
145
+ });
146
+ // Set timeout
147
+ if (timeout > 0) {
148
+ const timeoutTimer = setTimeout(() => {
149
+ if (childProcess.exitCode === null) {
150
+ childProcess.kill('SIGTERM');
151
+ const duration = Date.now() - startTime;
152
+ reject(new Error(`Command timeout after ${timeout}ms (${Math.floor(duration / 1000)}s elapsed)`));
153
+ }
154
+ }, timeout);
155
+ childProcess.on('exit', () => {
156
+ clearTimeout(timeoutTimer);
157
+ });
158
+ }
159
+ });
160
+ }
161
+ }
162
+ //# sourceMappingURL=commandRunner.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"commandRunner.js","sourceRoot":"","sources":["../../src/execution/commandRunner.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,iBAAiB,EAAE,MAAM,IAAI,CAAC;AACvC,OAAO,EAAU,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAuBrE;;GAEG;AACH,MAAM,OAAO,oBAAoB;IACd,MAAM,CAAS;IACf,cAAc,CAAS;IAChC,MAAM,CAAU,cAAc,GAAG,GAAG,CAAC;IACrC,MAAM,CAAU,4BAA4B,GAAG,IAAI,CAAC;IAE5D,YAAY,MAAe,EAAE,iBAAyB,MAAM;QAC1D,IAAI,CAAC,MAAM,GAAG,MAAM,IAAI,qBAAqB,CAAC,eAAe,CAAC,CAAC;QAC/D,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;IACvC,CAAC;IAED,KAAK,CAAC,OAAO,CACX,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;oBAClF,gBAAgB,CAAC,MAAM,CACrB,oBAAoB,CAAC,cAAc,EACnC,oBAAoB,CAAC,cAAc,EACnC,YAAY,CACb,CAAC;gBACJ,CAAC;gBAED,MAAM,CAAC,KAAK,CAAC,CAAC;YAChB,CAAC,CAAC,CAAC;YAEH,cAAc;YACd,IAAI,OAAO,GAAG,CAAC,EAAE,CAAC;gBAChB,MAAM,YAAY,GAAG,UAAU,CAAC,GAAG,EAAE;oBACnC,IAAI,YAAY,CAAC,QAAQ,KAAK,IAAI,EAAE,CAAC;wBACnC,YAAY,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;wBAC7B,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,SAAS,CAAC;wBACxC,MAAM,CACJ,IAAI,KAAK,CACP,yBAAyB,OAAO,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,GAAG,IAAI,CAAC,YAAY,CAC/E,CACF,CAAC;oBACJ,CAAC;gBACH,CAAC,EAAE,OAAO,CAAC,CAAC;gBAEZ,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE;oBAC3B,YAAY,CAAC,YAAY,CAAC,CAAC;gBAC7B,CAAC,CAAC,CAAC;YACL,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { ProgressReporter, MCPProgressReporter } from './progressReporter.js';
2
+ export { CommandRunner, DefaultCommandRunner } from './commandRunner.js';
3
+ export type { Command, CommandResult, ProgressParseResult, ProgressParser, CommandExecutionOptions, } from './types.js';
@@ -0,0 +1,9 @@
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 { MCPProgressReporter } from './progressReporter.js';
8
+ export { DefaultCommandRunner } from './commandRunner.js';
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/execution/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAoB,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC9E,OAAO,EAAiB,oBAAoB,EAAE,MAAM,oBAAoB,CAAC"}
@@ -0,0 +1,33 @@
1
+ import type { ProgressNotification, LoggingMessageNotification } from '@modelcontextprotocol/sdk/types.js';
2
+ /**
3
+ * Union type for the notifications sent by MCPProgressReporter.
4
+ * Uses the strongly-typed SDK notification types.
5
+ */
6
+ type ProgressReporterNotification = ProgressNotification | LoggingMessageNotification;
7
+ /**
8
+ * Simple interface for reporting progress of long-running operations.
9
+ * Used to send periodic notifications to keep tasks alive during execution.
10
+ */
11
+ export interface ProgressReporter {
12
+ /**
13
+ * Reports progress of a long-running operation.
14
+ *
15
+ * @param progress - Current progress value (0-100)
16
+ * @param total - Optional total value for calculating percentage
17
+ * @param message - Optional message describing current progress
18
+ */
19
+ report(progress: number, total?: number, message?: string): void;
20
+ }
21
+ /**
22
+ * MCP progress reporter that sends notifications via MCP protocol.
23
+ * Uses fire-and-forget pattern to avoid blocking execution.
24
+ */
25
+ export declare class MCPProgressReporter implements ProgressReporter {
26
+ private readonly sendNotification;
27
+ private static readonly PROGRESS_TOTAL;
28
+ private readonly logger;
29
+ private readonly progressToken;
30
+ constructor(sendNotification: (notification: ProgressReporterNotification) => Promise<void>, progressToken?: string);
31
+ report(progress: number, total?: number, message?: string): void;
32
+ }
33
+ export {};
@@ -0,0 +1,58 @@
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 { createComponentLogger } from '../logging/logger.js';
8
+ /**
9
+ * MCP progress reporter that sends notifications via MCP protocol.
10
+ * Uses fire-and-forget pattern to avoid blocking execution.
11
+ */
12
+ export class MCPProgressReporter {
13
+ sendNotification;
14
+ static PROGRESS_TOTAL = 100;
15
+ logger;
16
+ progressToken;
17
+ constructor(sendNotification, progressToken) {
18
+ this.sendNotification = sendNotification;
19
+ // Generate a unique progress token if not provided
20
+ this.progressToken =
21
+ progressToken ?? `progress-${Date.now()}-${Math.random().toString(36).slice(2, 11)}`;
22
+ this.logger = createComponentLogger('MCPProgressReporter');
23
+ }
24
+ report(progress, total = MCPProgressReporter.PROGRESS_TOTAL, message) {
25
+ const percentage = total > 0 ? Math.round((progress / total) * MCPProgressReporter.PROGRESS_TOTAL) : 0;
26
+ // Fire-and-forget notification pattern
27
+ // Use MCP notification format: notifications/progress with progressToken, message, progress, total
28
+ try {
29
+ const progressNotification = {
30
+ method: 'notifications/progress',
31
+ params: {
32
+ progressToken: this.progressToken,
33
+ message: message || `Progress: ${percentage}%`,
34
+ progress: percentage,
35
+ total: MCPProgressReporter.PROGRESS_TOTAL,
36
+ },
37
+ };
38
+ // Send logging message notification for clients that don't support progress notifications
39
+ const loggingNotification = {
40
+ method: 'notifications/message',
41
+ params: {
42
+ level: 'info',
43
+ data: message ? `Progress: ${percentage}%: ${message}` : `Progress: ${percentage}%`,
44
+ },
45
+ };
46
+ this.sendNotification(loggingNotification);
47
+ this.sendNotification(progressNotification).catch(error => {
48
+ // Log notification errors but don't block execution
49
+ this.logger.error('Failed to send progress notification', error);
50
+ });
51
+ }
52
+ catch (error) {
53
+ // Log notification errors but don't block execution
54
+ this.logger.error('Failed to create or send progress notification', error);
55
+ }
56
+ }
57
+ }
58
+ //# sourceMappingURL=progressReporter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"progressReporter.js","sourceRoot":"","sources":["../../src/execution/progressReporter.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,OAAO,EAAU,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAuBrE;;;GAGG;AACH,MAAM,OAAO,mBAAmB;IAMX;IALX,MAAM,CAAU,cAAc,GAAG,GAAG,CAAC;IAC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I,CAAC,gBAAgB,CAAC,oBAAoB,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE;gBACxD,oDAAoD;gBACpD,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,sCAAsC,EAAE,KAAc,CAAC,CAAC;YAC5E,CAAC,CAAC,CAAC;QACL,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,oDAAoD;YACpD,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,gDAAgD,EAAE,KAAc,CAAC,CAAC;QACtF,CAAC;IACH,CAAC"}
@@ -0,0 +1,54 @@
1
+ import { ProgressReporter } from './progressReporter.js';
2
+ /**
3
+ * Command structure for execution
4
+ */
5
+ export interface Command {
6
+ executable: string;
7
+ args: string[];
8
+ env?: NodeJS.ProcessEnv;
9
+ cwd?: string;
10
+ }
11
+ /**
12
+ * Result of command execution
13
+ */
14
+ export interface CommandResult {
15
+ exitCode: number | null;
16
+ signal: NodeJS.Signals | null;
17
+ stdout: string;
18
+ stderr: string;
19
+ success: boolean;
20
+ duration: number;
21
+ }
22
+ /**
23
+ * Progress parse result
24
+ */
25
+ export interface ProgressParseResult {
26
+ progress: number;
27
+ message?: string;
28
+ }
29
+ /**
30
+ * Function type for parsing progress from command output
31
+ */
32
+ export type ProgressParser = (output: string, currentProgress: number) => ProgressParseResult;
33
+ /**
34
+ * Command execution options
35
+ */
36
+ export interface CommandExecutionOptions {
37
+ env?: NodeJS.ProcessEnv;
38
+ timeout?: number;
39
+ cwd?: string;
40
+ progressParser?: ProgressParser;
41
+ progressReporter?: ProgressReporter;
42
+ outputFilePath?: string;
43
+ /**
44
+ * Human-readable name for the command being executed.
45
+ * Used in progress messages to make them more specific.
46
+ * Example: "Project Generation", "iOS Build", "Android Build"
47
+ */
48
+ commandName: string;
49
+ /**
50
+ * Debounce time in milliseconds for reporting identical progress values.
51
+ * Defaults to 2000ms (2 seconds). Progress changes are always reported immediately.
52
+ */
53
+ progressDebounceMs?: number;
54
+ }
@@ -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/execution/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
package/dist/index.d.ts CHANGED
@@ -1,15 +1,17 @@
1
1
  export { type FileSystemOperations, NodeFileSystemOperations } from './common/fileSystem.js';
2
2
  export { WELL_KNOWN_DIR_NAME, WELL_KNOWN_FILES, type WellKnownDirectoryConfig, WellKnownDirectoryManager, } from './storage/wellKnownDirectory.js';
3
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';
4
+ export { WORKFLOW_STATE_DATA_SCHEMA, WORKFLOW_PROPERTY_NAMES, WORKFLOW_TOOL_BASE_INPUT_SCHEMA, MCP_WORKFLOW_TOOL_OUTPUT_SCHEMA, type WorkflowStateData, type MCPToolInvocationData, type NodeGuidanceData, type InterruptData, isNodeGuidanceData, type MCPWorkflowToolOutput, type ToolMetadata, type WorkflowToolMetadata, } from './common/metadata.js';
5
5
  export { type PropertyMetadata, type PropertyMetadataCollection, type InferPropertyTypes, } from './common/propertyMetadata.js';
6
6
  export { type PropertyFulfilledResult, type IsPropertyFulfilled } from './common/types.js';
7
7
  export { type ToolExecutor, LangGraphToolExecutor } from './nodes/toolExecutor.js';
8
8
  export { executeToolWithLogging } from './utils/toolExecutionUtils.js';
9
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';
10
+ export { GET_INPUT_WORKFLOW_RESULT_SCHEMA } from './tools/utilities/index.js';
11
+ export { type BaseGraphConfig, type WorkflowRunnableConfig } from './common/graphConfig.js';
11
12
  export { BaseNode, AbstractToolNode, createGetUserInputNode, createUserInputExtractionNode, type GetUserInputNodeOptions, type UserInputExtractionNodeOptions, } from './nodes/index.js';
12
13
  export { CheckPropertiesFulfilledRouter } from './routers/index.js';
13
14
  export { AbstractService } from './services/index.js';
14
15
  export { JsonCheckpointSaver, WorkflowStatePersistence, WorkflowStateManager, type WorkflowStateManagerConfig, type WorkflowEnvironment, } from './checkpointing/index.js';
15
16
  export { OrchestratorTool, createOrchestratorToolMetadata, type OrchestratorConfig, type OrchestratorInput, type OrchestratorOutput, type OrchestratorToolMetadata, ORCHESTRATOR_INPUT_SCHEMA, ORCHESTRATOR_OUTPUT_SCHEMA, } from './tools/orchestrator/index.js';
17
+ export { ProgressReporter, MCPProgressReporter, CommandRunner, DefaultCommandRunner, type Command, type CommandResult, type ProgressParseResult, type ProgressParser, type CommandExecutionOptions, } from './execution/index.js';
package/dist/index.js CHANGED
@@ -11,19 +11,15 @@ export { WELL_KNOWN_DIR_NAME, WELL_KNOWN_FILES, WellKnownDirectoryManager, } fro
11
11
  // Logging
12
12
  export { PinoLogger, createLogger, createComponentLogger, createWorkflowLogger, } from './logging/logger.js';
13
13
  // Common Metadata
14
- export { WORKFLOW_STATE_DATA_SCHEMA, WORKFLOW_PROPERTY_NAMES, WORKFLOW_TOOL_BASE_INPUT_SCHEMA, MCP_WORKFLOW_TOOL_OUTPUT_SCHEMA, } from './common/metadata.js';
14
+ export { WORKFLOW_STATE_DATA_SCHEMA, WORKFLOW_PROPERTY_NAMES, WORKFLOW_TOOL_BASE_INPUT_SCHEMA, MCP_WORKFLOW_TOOL_OUTPUT_SCHEMA, isNodeGuidanceData, } from './common/metadata.js';
15
15
  // Tool Execution Infrastructure
16
16
  export { LangGraphToolExecutor } from './nodes/toolExecutor.js';
17
17
  // Tool Execution Utils
18
18
  export { executeToolWithLogging } from './utils/toolExecutionUtils.js';
19
19
  // Base Tool Classes
20
20
  export { AbstractTool, AbstractWorkflowTool } from './tools/base/index.js';
21
- // Utility Tools
22
- export {
23
- // Get Input Tool
24
- GetInputTool, createGetInputTool, createGetInputMetadata, GET_INPUT_PROPERTY_SCHEMA, GET_INPUT_WORKFLOW_INPUT_SCHEMA, GET_INPUT_WORKFLOW_RESULT_SCHEMA,
25
- // Input Extraction Tool
26
- InputExtractionTool, createInputExtractionTool, createInputExtractionMetadata, INPUT_EXTRACTION_WORKFLOW_INPUT_SCHEMA, INPUT_EXTRACTION_WORKFLOW_RESULT_SCHEMA, } from './tools/utilities/index.js';
21
+ // Get Input Result Schema (for NodeGuidanceData / direct guidance mode services)
22
+ export { GET_INPUT_WORKFLOW_RESULT_SCHEMA } from './tools/utilities/index.js';
27
23
  // Base Node Classes
28
24
  export { BaseNode, AbstractToolNode, createGetUserInputNode, createUserInputExtractionNode, } from './nodes/index.js';
29
25
  // Routers
@@ -34,4 +30,6 @@ export { AbstractService } from './services/index.js';
34
30
  export { JsonCheckpointSaver, WorkflowStatePersistence, WorkflowStateManager, } from './checkpointing/index.js';
35
31
  // Orchestrator Tool
36
32
  export { OrchestratorTool, createOrchestratorToolMetadata, ORCHESTRATOR_INPUT_SCHEMA, ORCHESTRATOR_OUTPUT_SCHEMA, } from './tools/orchestrator/index.js';
33
+ // Execution Infrastructure
34
+ export { MCPProgressReporter, DefaultCommandRunner, } from './execution/index.js';
37
35
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,iCAAiC;AACjC,OAAO,EAA6B,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAE7F,iCAAiC;AACjC,OAAO,EACL,mBAAmB,EACnB,gBAAgB,EAEhB,yBAAyB,GAC1B,MAAM,iCAAiC,CAAC;AAEzC,UAAU;AACV,OAAO,EAEL,UAAU,EACV,YAAY,EACZ,qBAAqB,EACrB,oBAAoB,GACrB,MAAM,qBAAqB,CAAC;AAE7B,kBAAkB;AAClB,OAAO,EACL,0BAA0B,EAC1B,uBAAuB,EACvB,+BAA+B,EAC/B,+BAA+B,GAMhC,MAAM,sBAAsB,CAAC;AAU9B,gCAAgC;AAChC,OAAO,EAAqB,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAEnF,uBAAuB;AACvB,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAEvE,oBAAoB;AACpB,OAAO,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAE3E,gBAAgB;AAChB,OAAO;AACL,iBAAiB;AACjB,YAAY,EACZ,kBAAkB,EAClB,sBAAsB,EAItB,yBAAyB,EACzB,+BAA+B,EAC/B,gCAAgC;AAChC,wBAAwB;AACxB,mBAAmB,EACnB,yBAAyB,EACzB,6BAA6B,EAI7B,sCAAsC,EACtC,uCAAuC,GACxC,MAAM,4BAA4B,CAAC;AAEpC,oBAAoB;AACpB,OAAO,EACL,QAAQ,EACR,gBAAgB,EAChB,sBAAsB,EACtB,6BAA6B,GAG9B,MAAM,kBAAkB,CAAC;AAE1B,UAAU;AACV,OAAO,EAAE,8BAA8B,EAAE,MAAM,oB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