@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
@@ -1,13 +1,23 @@
1
1
  import { StateType, StateDefinition } from '@langchain/langgraph';
2
+ import type { WorkflowRunnableConfig } from '../common/graphConfig.js';
3
+ export type { WorkflowRunnableConfig } from '../common/graphConfig.js';
2
4
  /**
3
5
  * Base class for all workflow nodes
4
6
  *
7
+ * LangGraph supports both sync and async node functions. This base class
8
+ * supports both patterns - nodes can return Partial<TState> synchronously
9
+ * or Promise<Partial<TState>> asynchronously.
10
+ *
11
+ * Nodes receive an optional second parameter `config` (RunnableConfig) that
12
+ * contains runtime context like progress reporters, thread IDs, etc. This
13
+ * is the proper way to access runtime dependencies without polluting state.
14
+ *
5
15
  * @template TState - The state type for the workflow (defaults to StateType&lt;StateDefinition&gt;)
6
16
  *
7
- * Example:
17
+ * Example (sync):
8
18
  * ```
9
19
  * const MyWorkflowState = Annotation.Root({ count: Annotation<number> });
10
- * type State = typeof MyWorkflowState.State; // This is StateType<typeof MyWorkflowState.spec>
20
+ * type State = typeof MyWorkflowState.State;
11
21
  *
12
22
  * class IncrementNode extends BaseNode<State> {
13
23
  * constructor() {
@@ -19,9 +29,25 @@ import { StateType, StateDefinition } from '@langchain/langgraph';
19
29
  * };
20
30
  * }
21
31
  * ```
32
+ *
33
+ * Example (async with config):
34
+ * ```
35
+ * class AsyncNode extends BaseNode<State> {
36
+ * constructor() {
37
+ * super('asyncNode');
38
+ * }
39
+ *
40
+ * execute = async (state: State, config?: WorkflowRunnableConfig) => {
41
+ * const progressReporter = config?.configurable?.progressReporter;
42
+ * progressReporter?.report(50, 100, 'Processing...');
43
+ * const result = await someAsyncOperation();
44
+ * return { data: result };
45
+ * };
46
+ * }
47
+ * ```
22
48
  */
23
49
  export declare abstract class BaseNode<TState extends StateType<StateDefinition>> {
24
50
  readonly name: string;
25
51
  constructor(name: string);
26
- abstract execute: (state: TState) => Partial<TState>;
52
+ abstract execute: (state: TState, config?: WorkflowRunnableConfig) => Partial<TState> | Promise<Partial<TState>>;
27
53
  }
@@ -7,12 +7,20 @@
7
7
  /**
8
8
  * Base class for all workflow nodes
9
9
  *
10
+ * LangGraph supports both sync and async node functions. This base class
11
+ * supports both patterns - nodes can return Partial<TState> synchronously
12
+ * or Promise<Partial<TState>> asynchronously.
13
+ *
14
+ * Nodes receive an optional second parameter `config` (RunnableConfig) that
15
+ * contains runtime context like progress reporters, thread IDs, etc. This
16
+ * is the proper way to access runtime dependencies without polluting state.
17
+ *
10
18
  * @template TState - The state type for the workflow (defaults to StateType&lt;StateDefinition&gt;)
11
19
  *
12
- * Example:
20
+ * Example (sync):
13
21
  * ```
14
22
  * const MyWorkflowState = Annotation.Root({ count: Annotation<number> });
15
- * type State = typeof MyWorkflowState.State; // This is StateType<typeof MyWorkflowState.spec>
23
+ * type State = typeof MyWorkflowState.State;
16
24
  *
17
25
  * class IncrementNode extends BaseNode<State> {
18
26
  * constructor() {
@@ -24,6 +32,22 @@
24
32
  * };
25
33
  * }
26
34
  * ```
35
+ *
36
+ * Example (async with config):
37
+ * ```
38
+ * class AsyncNode extends BaseNode<State> {
39
+ * constructor() {
40
+ * super('asyncNode');
41
+ * }
42
+ *
43
+ * execute = async (state: State, config?: WorkflowRunnableConfig) => {
44
+ * const progressReporter = config?.configurable?.progressReporter;
45
+ * progressReporter?.report(50, 100, 'Processing...');
46
+ * const result = await someAsyncOperation();
47
+ * return { data: result };
48
+ * };
49
+ * }
50
+ * ```
27
51
  */
28
52
  export class BaseNode {
29
53
  name;
@@ -1 +1 @@
1
- {"version":3,"file":"abstractBaseNode.js","sourceRoot":"","sources":["../../src/nodes/abstractBaseNode.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,OAAgB,QAAQ;IACZ,IAAI,CAAS;IAE7B,YAAY,IAAY;QACtB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CAGF"}
1
+ {"version":3,"file":"abstractBaseNode.js","sourceRoot":"","sources":["../../src/nodes/abstractBaseNode.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAQH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,MAAM,OAAgB,QAAQ;IACZ,IAAI,CAAS;IAE7B,YAAY,IAAY;QACtB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CAMF"}
@@ -1,7 +1,7 @@
1
1
  import z from 'zod';
2
2
  import { StateType, StateDefinition } from '@langchain/langgraph';
3
3
  import { BaseNode } from './abstractBaseNode.js';
4
- import { MCPToolInvocationData } from '../common/metadata.js';
4
+ import { InterruptData } from '../common/metadata.js';
5
5
  import { Logger } from '../logging/logger.js';
6
6
  import { ToolExecutor } from './toolExecutor.js';
7
7
  /**
@@ -23,10 +23,12 @@ export declare abstract class AbstractToolNode<TState extends StateType<StateDef
23
23
  * This method uses the common toolExecutionUtils.executeToolWithLogging function
24
24
  * to ensure consistent behavior across all tool invocations in the codebase.
25
25
  *
26
- * @param toolInvocationData The tool invocation data to pass to the tool executor
26
+ * Supports both MCPToolInvocationData (delegate mode) and NodeGuidanceData (direct guidance mode).
27
+ *
28
+ * @param interruptData The interrupt data (MCPToolInvocationData or NodeGuidanceData) to pass to the tool executor
27
29
  * @param resultSchema The schema to validate the result against
28
30
  * @param validator Optional custom validator function
29
31
  * @returns The validated result from the tool execution
30
32
  */
31
- protected executeToolWithLogging<TResultSchema extends z.ZodObject<z.ZodRawShape>>(toolInvocationData: MCPToolInvocationData<z.ZodObject<z.ZodRawShape>>, resultSchema: TResultSchema, validator?: (result: unknown, schema: TResultSchema) => z.infer<TResultSchema>): z.infer<TResultSchema>;
33
+ protected executeToolWithLogging<TResultSchema extends z.ZodObject<z.ZodRawShape>>(interruptData: InterruptData<z.ZodObject<z.ZodRawShape>, TResultSchema>, resultSchema: TResultSchema, validator?: (result: unknown, schema: TResultSchema) => z.infer<TResultSchema>): z.infer<TResultSchema>;
32
34
  }
@@ -32,13 +32,15 @@ export class AbstractToolNode extends BaseNode {
32
32
  * This method uses the common toolExecutionUtils.executeToolWithLogging function
33
33
  * to ensure consistent behavior across all tool invocations in the codebase.
34
34
  *
35
- * @param toolInvocationData The tool invocation data to pass to the tool executor
35
+ * Supports both MCPToolInvocationData (delegate mode) and NodeGuidanceData (direct guidance mode).
36
+ *
37
+ * @param interruptData The interrupt data (MCPToolInvocationData or NodeGuidanceData) to pass to the tool executor
36
38
  * @param resultSchema The schema to validate the result against
37
39
  * @param validator Optional custom validator function
38
40
  * @returns The validated result from the tool execution
39
41
  */
40
- executeToolWithLogging(toolInvocationData, resultSchema, validator) {
41
- return executeToolWithLogging(this.toolExecutor, this.logger, toolInvocationData, resultSchema, validator);
42
+ executeToolWithLogging(interruptData, resultSchema, validator) {
43
+ return executeToolWithLogging(this.toolExecutor, this.logger, interruptData, resultSchema, validator);
42
44
  }
43
45
  }
44
46
  //# sourceMappingURL=abstractToolNode.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"abstractToolNode.js","sourceRoot":"","sources":["../../src/nodes/abstractToolNode.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEjD,OAAO,EAAU,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,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AC,IAAI,CAAC,CAAC;QACZ,IAAI,CAAC,aAAa,GAAG,gBAAgB,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC;QAC7D,IAAI,CAAC,MAAM,GAAG,MAAM,IAAI,qBAAqB,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QAClE,IAAI,CAAC,YAAY,GAAG,YAAY,IAAI,IAAI,qBAAqB,EAAE,CAAC;IAClE,CAAC;IAED;;;;;;;;;;;;;;;OAeG;IACO,sBAAsB,CAC9B,aAAuE,EACvE,YAA2B,EAC3B,SAA8E;QAE9E,OAAO,sBAAsB,CAC3B,IAAI,CAAC,YAAY,EACjB,IAAI,CAAC,MAAM,EACX,aAAa,EACb,YAAY,EACZ,SAAS,CACV,CAAC;IACJ,CAAC;CACF"}
@@ -56,9 +56,9 @@ export function createGetUserInputNode(options) {
56
56
  isFulfilled: false,
57
57
  reason: `Property '${propertyName}' is missing from the workflow state.`,
58
58
  };
59
- }, userInputProperty, } = options;
59
+ }, userInputProperty, nodeName = 'getUserInput', } = options;
60
60
  // Create default service implementation if not provided
61
61
  const service = getInputService ?? new GetInputService(toolId, toolExecutor, logger);
62
- return new GetUserInputNode(service, requiredProperties, isPropertyFulfilled, userInputProperty);
62
+ return new GetUserInputNode(service, requiredProperties, isPropertyFulfilled, userInputProperty, nodeName);
63
63
  }
64
64
  //# sourceMappingURL=factory.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"factory.js","sourceRoot":"","sources":["../../../src/nodes/getUserInput/factory.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,eAAe,EAA2B,MAAM,mCAAmC,CAAC;AAC7F,OAAO,EAA2B,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAGtE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;G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B,EAAE,EAC1C,MAAM,GAAG,qBAAqB,CAAC,kBAAkB,CAAC,EAClD,mBAAmB,GAAG,CAAC,KAAa,EAAE,YAAoB,EAA2B,EAAE;QACrF,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;QAC1C,IAAI,WAAW,EAAE,CAAC;YAChB,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC;QAC/B,CAAC;QACD,OAAO;YACL,WAAW,EAAE,KAAK;YAClB,MAAM,EAAE,aAAa,YAAY,uCAAuC;SACzE,CAAC;IACJ,CAAC,EACD,iBAAiB,EACjB,QAAQ,GAAG,cAAc,GAC1B,GAAG,OAAO,CAAC;IAEZ,wDAAwD;IACxD,MAAM,OAAO,GACX,eAAe,IAAI,IAAI,eAAe,CAAC,MAAM,EAAE,YAAY,EAAE,MAAM,CAAC,CAAC;IAEvE,OAAO,IAAI,gBAAgB,CACzB,OAAO,EACP,kBAAkB,EAClB,mBAAmB,EACnB,iBAAiB,EACjB,QAAQ,CACT,CAAC;AACJ,CAAC"}
@@ -56,13 +56,31 @@ export interface GetUserInputNodeOptions<TState extends StateType<StateDefinitio
56
56
  *
57
57
  */
58
58
  userInputProperty: keyof TState;
59
+ /**
60
+ * Custom name for the node (optional, defaults to 'getUserInput')
61
+ * Use this when you need multiple getUserInput nodes in the same graph
62
+ *
63
+ * @example
64
+ *
65
+ * // Create multiple input nodes with unique names
66
+ * const userInputNode = createGetUserInputNode({
67
+ * nodeName: 'getUserInput',
68
+ * ...
69
+ * });
70
+ *
71
+ * const androidSetupNode = createGetUserInputNode({
72
+ * nodeName: 'getAndroidSetup',
73
+ * ...
74
+ * });
75
+ */
76
+ nodeName?: string;
59
77
  }
60
78
  export declare class GetUserInputNode<TState extends StateType<StateDefinition>> extends BaseNode<TState> {
61
79
  private readonly getInputService;
62
80
  private readonly requiredProperties;
63
81
  private readonly isPropertyFulfilled;
64
82
  private readonly userInputProperty;
65
- constructor(getInputService: GetInputServiceProvider, requiredProperties: PropertyMetadataCollection, isPropertyFulfilled: IsPropertyFulfilled<TState>, userInputProperty: keyof TState);
83
+ constructor(getInputService: GetInputServiceProvider, requiredProperties: PropertyMetadataCollection, isPropertyFulfilled: IsPropertyFulfilled<TState>, userInputProperty: keyof TState, nodeName?: string);
66
84
  execute: (state: TState) => Partial<TState>;
67
85
  private getUnfulfilledProperties;
68
86
  }
@@ -10,8 +10,8 @@ export class GetUserInputNode extends BaseNode {
10
10
  requiredProperties;
11
11
  isPropertyFulfilled;
12
12
  userInputProperty;
13
- constructor(getInputService, requiredProperties, isPropertyFulfilled, userInputProperty) {
14
- super('getUserInput');
13
+ constructor(getInputService, requiredProperties, isPropertyFulfilled, userInputProperty, nodeName = 'getUserInput') {
14
+ super(nodeName);
15
15
  this.getInputService = getInputService;
16
16
  this.requiredProperties = requiredProperties;
17
17
  this.isPropertyFulfilled = isPropertyFulfilled;
@@ -1 +1 @@
1
- {"version":3,"file":"node.js","sourceRoot":"","sources":["../../../src/nodes/getUserInput/node.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAkElD,MAAM,OAAO,gBAA4D,SAAQ,QAAgB;IAE5E;IACA;IACA;IACA;IAJnB,YACmB,eAAwC,EACxC,kBAA8C,EAC9C,mBAAgD,EAChD,iBAA+B;QAEhD,KAAK,CAAC,cAAc,CAAC,CAAC;QALL,oBAAe,GAAf,eAAe,CAAyB;QACxC,uBAAkB,GAAlB,kBAAkB,CAA4B;QAC9C,wBAAmB,GAAnB,mBAAmB,CAA6B;QAChD,sBAAiB,GAAjB,iBAAiB,CAAc;IAGlD,CAAC;IAED,OAAO,GAAG,CAAC,KAAa,EAAmB,EAAE;QAC3C,MAAM,qBAAqB,GAAG,IAAI,CAAC,wBAAwB,CAAC,KAAK,CAAC,CAAC;QACnE,MAAM,YAAY,GAAG,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,qBAAqB,C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AAC,wBAAwB,CAAC,KAAK,CAAC,CAAC;QACnE,MAAM,YAAY,GAAG,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,qBAAqB,CAAC,CAAC;QAC1E,OAAO,EAAE,CAAC,IAAI,CAAC,iBAAiB,CAAC,EAAE,YAAY,EAAgC,CAAC;IAClF,CAAC,CAAC;IAEM,wBAAwB,CAAC,KAAa;QAC5C,MAAM,aAAa,GAAuB,EAAE,CAAC;QAC7C,KAAK,MAAM,CAAC,YAAY,EAAE,QAAQ,CAAC,IAAI,MAAM,CAAC,OAAO,CACnD,IAAI,CAAC,kBAAgD,CACtD,EAAE,CAAC;YACF,MAAM,iBAAiB,GAAG,IAAI,CAAC,mBAAmB,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC;YAExE,IAAI,CAAC,iBAAiB,CAAC,WAAW,EAAE,CAAC;gBACnC,aAAa,CAAC,IAAI,CAAC;oBACjB,YAAY;oBACZ,YAAY,EAAE,QAAQ,CAAC,YAAY;oBACnC,WAAW,EAAE,QAAQ,CAAC,WAAW;oBACjC,MAAM,EAAE,iBAAiB,CAAC,MAAM;iBACjC,CAAC,CAAC;YACL,CAAC;QACH,CAAC;QACD,OAAO,aAAa,CAAC;IACvB,CAAC;CACF"}
@@ -1,5 +1,5 @@
1
1
  import z from 'zod';
2
- import { MCPToolInvocationData } from '../common/metadata.js';
2
+ import { InterruptData } from '../common/metadata.js';
3
3
  /**
4
4
  * Interface for tool execution mechanism.
5
5
  * Abstracts the LangGraph interrupt mechanism to enable dependency injection and testing.
@@ -8,15 +8,16 @@ export interface ToolExecutor {
8
8
  /**
9
9
  * Executes a tool by invoking the underlying mechanism (e.g., LangGraph interrupt).
10
10
  *
11
- * @param toolInvocationData The tool invocation data to pass to the execution mechanism
11
+ * @param interruptData The interrupt data to pass to the execution mechanism.
12
+ * Can be either MCPToolInvocationData (delegate mode) or NodeGuidanceData (direct guidance mode).
12
13
  * @returns The result from the tool execution (as unknown, to be validated by caller)
13
14
  */
14
- execute(toolInvocationData: MCPToolInvocationData<z.ZodObject<z.ZodRawShape>>): unknown;
15
+ execute(interruptData: InterruptData<z.ZodObject<z.ZodRawShape>, z.ZodObject<z.ZodRawShape>>): unknown;
15
16
  }
16
17
  /**
17
18
  * Production implementation of ToolExecutor that uses LangGraph's interrupt mechanism.
18
19
  * This is the default implementation used in production workflows.
19
20
  */
20
21
  export declare class LangGraphToolExecutor implements ToolExecutor {
21
- execute(toolInvocationData: MCPToolInvocationData<z.ZodObject<z.ZodRawShape>>): unknown;
22
+ execute(interruptData: InterruptData<z.ZodObject<z.ZodRawShape>, z.ZodObject<z.ZodRawShape>>): unknown;
22
23
  }
@@ -11,8 +11,8 @@ import { interrupt } from '@langchain/langgraph';
11
11
  */
12
12
  /* c8 ignore start */
13
13
  export class LangGraphToolExecutor {
14
- execute(toolInvocationData) {
15
- return interrupt(toolInvocationData);
14
+ execute(interruptData) {
15
+ return interrupt(interruptData);
16
16
  }
17
17
  }
18
18
  /* c8 ignore stop */
@@ -1 +1 @@
1
- {"version":3,"file":"toolExecutor.js","sourceRoot":"","sources":["../../src/nodes/toolExecutor.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAiBjD;;;GAGG;AACH,qBAAqB;AACrB,MAAM,OAAO,qBAAqB;IAChC,OAAO,CAAC,kBAAqE;QAC3E,OAAO,SAAS,CAAC,kBAAkB,CAAC,CAAC;IACvC,CAAC;CACF;AACD,oBAAoB"}
1
+ {"version":3,"file":"toolExecutor.js","sourceRoot":"","sources":["../../src/nodes/toolExecutor.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAoBjD;;;GAGG;AACH,qBAAqB;AACrB,MAAM,OAAO,qBAAqB;IAChC,OAAO,CACL,aAAoF;QAEpF,OAAO,SAAS,CAAC,aAAa,CAAC,CAAC;IAClC,CAAC;CACF;AACD,oBAAoB"}
@@ -89,14 +89,14 @@ export class CheckPropertiesFulfilledRouter {
89
89
  }
90
90
  }
91
91
  if (unfulfilledProperties.length > 0) {
92
- this.logger.debug('Properties not fulfilled, routing to unfulfilled node', {
92
+ this.logger.debug(`Properties not fulfilled, routing to ${this.propertiesUnfulfilledNodeName}`, {
93
93
  unfulfilledProperties,
94
94
  targetNode: this.propertiesUnfulfilledNodeName,
95
95
  totalRequired: Object.keys(this.requiredProperties).length,
96
96
  });
97
97
  return this.propertiesUnfulfilledNodeName;
98
98
  }
99
- this.logger.debug('All properties fulfilled, routing to fulfilled node', {
99
+ this.logger.debug(`All properties fulfilled, routing to ${this.propertiesFulfilledNodeName}`, {
100
100
  targetNode: this.propertiesFulfilledNodeName,
101
101
  totalProperties: Object.keys(this.requiredProperties).length,
102
102
  });
@@ -1 +1 @@
1
- {"version":3,"file":"checkPropertiesFulfilledRouter.js","sourceRoot":"","sources":["../../src/routers/checkPropertiesFulfilledRouter.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAAU,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAErE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,MAAM,OAAO,8BAA8B;IACxB,2BAA2B,CAAS;IACpC,6BAA6B,CAAS;IACtC,kBAAkB,CAA6B;IAC/C,MAAM,CAAS;IAEhC;;;;;;;;OAQG;IACH,YACE,2BAAmC,EACnC,6BAAqC,EACrC,kBAA8C,EAC9C,MAAe;QAEf,IAAI,CAAC,2BAA2B,GAAG,2BAA2B,CAAC;QAC/D,IAAI,CAAC,6BAA6B,GAAG,6BAA6B,CAAC;QACnE,IAAI,CAAC,kBAAkB,GAAG,kBAAkB,CAAC;QAC7C,IAAI,CAAC,MAAM,GAAG,MAAM,IAAI,qBAAqB,CAAC,gCAAgC,CAAC,CAAC;IAClF,CAAC;IAED;;;;;;;;;OASG;IACH,OAAO,GAAG,CAAC,KAAa,EAAU,EAAE;QAClC,O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C5F,UAAU,EAAE,IAAI,CAAC,2BAA2B;YAC5C,eAAe,EAAE,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC,MAAM;SAC7D,CAAC,CAAC;QACH,OAAO,IAAI,CAAC,2BAA2B,CAAC;IAC1C,CAAC;CACF"}
@@ -1,5 +1,5 @@
1
1
  import z from 'zod';
2
- import { MCPToolInvocationData } from '../common/metadata.js';
2
+ import { InterruptData } from '../common/metadata.js';
3
3
  import { Logger } from '../logging/logger.js';
4
4
  import { ToolExecutor } from '../nodes/toolExecutor.js';
5
5
  /**
@@ -29,9 +29,9 @@ import { ToolExecutor } from '../nodes/toolExecutor.js';
29
29
  * }
30
30
  *
31
31
  * doSomething(input: string): ResultType {
32
- * const toolInvocationData = { ... };
32
+ * const interruptData = { ... };
33
33
  * return this.executeToolWithLogging(
34
- * toolInvocationData,
34
+ * interruptData,
35
35
  * MyToolResultSchema
36
36
  * );
37
37
  * }
@@ -59,7 +59,7 @@ export declare abstract class AbstractService {
59
59
  * This method uses the common toolExecutionUtils.executeToolWithLogging function
60
60
  * to ensure consistent behavior across all tool invocations in the codebase.
61
61
  *
62
- * @param toolInvocationData - The tool invocation data to pass to the tool executor
62
+ * @param interruptData - The interrupt data (MCPToolInvocationData or NodeGuidanceData)
63
63
  * @param resultSchema - The schema to validate the result against
64
64
  * @param validator - Optional custom validator function
65
65
  * @returns The validated result from the tool execution
@@ -67,5 +67,5 @@ export declare abstract class AbstractService {
67
67
  * @throws {z.ZodError} If the result does not match the schema (when using default validation)
68
68
  * @throws {Error} If tool execution fails or custom validator throws
69
69
  */
70
- protected executeToolWithLogging<TResultSchema extends z.ZodObject<z.ZodRawShape>>(toolInvocationData: MCPToolInvocationData<z.ZodObject<z.ZodRawShape>>, resultSchema: TResultSchema, validator?: (result: unknown, schema: TResultSchema) => z.infer<TResultSchema>): z.infer<TResultSchema>;
70
+ protected executeToolWithLogging<TResultSchema extends z.ZodObject<z.ZodRawShape>>(interruptData: InterruptData<z.ZodObject<z.ZodRawShape>, TResultSchema>, resultSchema: TResultSchema, validator?: (result: unknown, schema: TResultSchema) => z.infer<TResultSchema>): z.infer<TResultSchema>;
71
71
  }
@@ -34,9 +34,9 @@ import { executeToolWithLogging } from '../utils/toolExecutionUtils.js';
34
34
  * }
35
35
  *
36
36
  * doSomething(input: string): ResultType {
37
- * const toolInvocationData = { ... };
37
+ * const interruptData = { ... };
38
38
  * return this.executeToolWithLogging(
39
- * toolInvocationData,
39
+ * interruptData,
40
40
  * MyToolResultSchema
41
41
  * );
42
42
  * }
@@ -68,7 +68,7 @@ export class AbstractService {
68
68
  * This method uses the common toolExecutionUtils.executeToolWithLogging function
69
69
  * to ensure consistent behavior across all tool invocations in the codebase.
70
70
  *
71
- * @param toolInvocationData - The tool invocation data to pass to the tool executor
71
+ * @param interruptData - The interrupt data (MCPToolInvocationData or NodeGuidanceData)
72
72
  * @param resultSchema - The schema to validate the result against
73
73
  * @param validator - Optional custom validator function
74
74
  * @returns The validated result from the tool execution
@@ -76,8 +76,8 @@ export class AbstractService {
76
76
  * @throws {z.ZodError} If the result does not match the schema (when using default validation)
77
77
  * @throws {Error} If tool execution fails or custom validator throws
78
78
  */
79
- executeToolWithLogging(toolInvocationData, resultSchema, validator) {
80
- return executeToolWithLogging(this.toolExecutor, this.logger, toolInvocationData, resultSchema, validator);
79
+ executeToolWithLogging(interruptData, resultSchema, validator) {
80
+ return executeToolWithLogging(this.toolExecutor, this.logger, interruptData, resultSchema, validator);
81
81
  }
82
82
  }
83
83
  //# sourceMappingURL=abstractService.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"abstractService.js","sourceRoot":"","sources":["../../src/services/abstractService.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAAU,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,EAAgB,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAC/E,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAg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AAC;QAClE,IAAI,CAAC,YAAY,GAAG,YAAY,IAAI,IAAI,qBAAqB,EAAE,CAAC;IAClE,CAAC;IAED;;;;;;;;;;;;;;;;;OAiBG;IACO,sBAAsB,CAC9B,aAAuE,EACvE,YAA2B,EAC3B,SAA8E;QAE9E,OAAO,sBAAsB,CAC3B,IAAI,CAAC,YAAY,EACjB,IAAI,CAAC,MAAM,EACX,aAAa,EACb,YAAY,EACZ,SAAS,CACV,CAAC;IACJ,CAAC;CACF"}
@@ -27,8 +27,9 @@ export interface GetInputServiceProvider {
27
27
  /**
28
28
  * Service for getting user input for a given question.
29
29
  *
30
- * This service extends AbstractService to leverage common tool execution
31
- * patterns including standardized logging and result validation.
30
+ * This service uses direct guidance mode (NodeGuidanceData) to have the orchestrator
31
+ * generate user input collection prompts directly, eliminating the need for an
32
+ * intermediate tool call.
32
33
  */
33
34
  export declare class GetInputService extends AbstractService implements GetInputServiceProvider {
34
35
  private readonly toolId;
@@ -40,4 +41,11 @@ export declare class GetInputService extends AbstractService implements GetInput
40
41
  */
41
42
  constructor(toolId: string, toolExecutor?: ToolExecutor, logger?: Logger);
42
43
  getInput(unfulfilledProperties: GetInputProperty[]): unknown;
44
+ /**
45
+ * Generates the task guidance for user input collection.
46
+ *
47
+ * @param properties - Array of properties requiring user input
48
+ * @returns The guidance prompt string
49
+ */
50
+ private generateTaskGuidance;
43
51
  }
@@ -5,12 +5,13 @@
5
5
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
6
6
  */
7
7
  import { AbstractService } from './abstractService.js';
8
- import { createGetInputMetadata, GET_INPUT_WORKFLOW_RESULT_SCHEMA, } from '../tools/utilities/index.js';
8
+ import { GET_INPUT_WORKFLOW_RESULT_SCHEMA } from '../tools/utilities/index.js';
9
9
  /**
10
10
  * Service for getting user input for a given question.
11
11
  *
12
- * This service extends AbstractService to leverage common tool execution
13
- * patterns including standardized logging and result validation.
12
+ * This service uses direct guidance mode (NodeGuidanceData) to have the orchestrator
13
+ * generate user input collection prompts directly, eliminating the need for an
14
+ * intermediate tool call.
14
15
  */
15
16
  export class GetInputService extends AbstractService {
16
17
  toolId;
@@ -28,21 +29,55 @@ export class GetInputService extends AbstractService {
28
29
  this.logger.debug('Starting input request with properties', {
29
30
  unfulfilledProperties,
30
31
  });
31
- const metadata = createGetInputMetadata(this.toolId);
32
- // Create tool invocation data
33
- const toolInvocationData = {
34
- llmMetadata: {
35
- name: metadata.toolId,
36
- description: metadata.description,
37
- inputSchema: metadata.inputSchema,
38
- },
39
- input: {
40
- propertiesRequiringInput: unfulfilledProperties,
41
- },
32
+ // Build a concrete example based on the actual properties being requested
33
+ const exampleProperties = unfulfilledProperties.reduce((acc, prop) => {
34
+ acc[prop.propertyName] = `<user's ${prop.friendlyName} value>`;
35
+ return acc;
36
+ }, {});
37
+ // Create NodeGuidanceData for direct guidance mode
38
+ const nodeGuidanceData = {
39
+ nodeId: this.toolId,
40
+ taskGuidance: this.generateTaskGuidance(unfulfilledProperties),
41
+ resultSchema: GET_INPUT_WORKFLOW_RESULT_SCHEMA,
42
+ // Provide example to help LLM understand the expected userUtterance wrapper
43
+ exampleOutput: JSON.stringify({ userUtterance: exampleProperties }),
42
44
  };
43
45
  // Execute tool with logging and validation
44
- const validatedResult = this.executeToolWithLogging(toolInvocationData, GET_INPUT_WORKFLOW_RESULT_SCHEMA);
46
+ const validatedResult = this.executeToolWithLogging(nodeGuidanceData, GET_INPUT_WORKFLOW_RESULT_SCHEMA);
45
47
  return validatedResult.userUtterance;
46
48
  }
49
+ /**
50
+ * Generates the task guidance for user input collection.
51
+ *
52
+ * @param properties - Array of properties requiring user input
53
+ * @returns The guidance prompt string
54
+ */
55
+ generateTaskGuidance(properties) {
56
+ const propertiesDescription = properties
57
+ .map(property => `- Property Name: ${property.propertyName}\n- Friendly Name: ${property.friendlyName}\n- Description: ${property.description}`)
58
+ .join('\n\n');
59
+ return `
60
+ # ROLE
61
+ You are an input gathering tool, responsible for explicitly requesting and gathering the
62
+ user's input for a set of unfulfilled properties.
63
+
64
+ # TASK
65
+ Your job is to provide a prompt to the user that outlines the details for a set of properties
66
+ that require the user's input. The prompt should be polite and conversational.
67
+
68
+ # CONTEXT
69
+ Here is the list of properties that require the user's input, along with their describing
70
+ metadata:
71
+
72
+ ${propertiesDescription}
73
+
74
+ # INSTRUCTIONS
75
+ 1. Based on the properties listed in "CONTEXT", generate a prompt that outlines the details
76
+ for each property.
77
+ 2. Present the prompt to the user and instruct the user to provide their input.
78
+ 3. **IMPORTANT:** YOU MUST NOW WAIT for the user to provide a follow-up response to your prompt.
79
+ 1. You CANNOT PROCEED FROM THIS STEP until the user has provided THEIR OWN INPUT VALUE.
80
+ `;
81
+ }
47
82
  }
48
83
  //# sourceMappingURL=getInputService.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getInputService.js","sourceRoot":"","sources":["../../src/services/getInputService.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EACL,sBAAsB,EAEtB,gCAAgC,GACjC,MAAM,6BAA6B,CAAC;AAgCrC;;;;;GAKG;AACH,MAAM,OAAO,eAAgB,SAAQ,eAAe;IAQ/B;IAPnB;;;;;OAKG;IACH,YACmB,MAAc,EAC/B,YAA2B,EAC3B,MAAe;QAEf,KAAK,CAAC,iBAAiB,EAAE,YAAY,EAAE,MAAM,CAAC,CAAC;QAJ9B,WAAM,GAAN,MAAM,CAAQ;IAKjC,CAAC;IAED,QAAQ,CAAC,qBAAyC;QAChD,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,wCAAwC,EAAE;YAC1D,qBAAqB;SACtB,CAAC,CAAC;QAEH,MAAM,QAAQ,GAAG,sBAAsB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACrD,8BAA8B;QAC9B,MAAM,kBAAkB,GAAkE;YACxF,WAAW,EAAE;gBACX,IAAI,EAAE,QAAQ,CAAC,MAAM;gBACrB,WAAW,EAAE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EAAE,gCAAgC;YAC9C,4EAA4E;YAC5E,aAAa,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,aAAa,EAAE,iBAAiB,EAAE,CAAC;SACpE,CAAC;QAEF,2CAA2C;QAC3C,MAAM,eAAe,GAAG,IAAI,CAAC,sBAAsB,CACjD,gBAAgB,EAChB,gCAAgC,CACjC,CAAC;QAEF,OAAO,eAAe,CAAC,aAAa,CAAC;IACvC,CAAC;IAED;;;;;OAKG;IACK,oBAAoB,CAAC,UAA8B;QACzD,MAAM,qBAAqB,GAAG,UAAU;aACrC,GAAG,CACF,QAAQ,CAAC,EAAE,CACT,oBAAoB,QAAQ,CAAC,YAAY,sBAAsB,QAAQ,CAAC,YAAY,oBAAoB,QAAQ,CAAC,WAAW,EAAE,CACjI;aACA,IAAI,CAAC,MAAM,CAAC,CAAC;QAEhB,OAAO;;;;;;;;;;;;;EAaT,qBAAqB;;;;;;;;CAQtB,CAAC;IACA,CAAC;CACF"}
@@ -26,8 +26,9 @@ export interface InputExtractionServiceProvider {
26
26
  /**
27
27
  * Service for extracting structured properties from user input.
28
28
  *
29
- * This service extends AbstractService to leverage common tool execution
30
- * patterns including standardized logging and result validation.
29
+ * This service uses direct guidance mode (NodeGuidanceData) to have the orchestrator
30
+ * generate property extraction prompts directly, eliminating the need for an
31
+ * intermediate tool call.
31
32
  */
32
33
  export declare class InputExtractionService extends AbstractService implements InputExtractionServiceProvider {
33
34
  private readonly toolId;
@@ -43,4 +44,12 @@ export declare class InputExtractionService extends AbstractService implements I
43
44
  private preparePropertiesForExtraction;
44
45
  private preparePropertyResultsSchema;
45
46
  private validateAndFilterResult;
47
+ /**
48
+ * Generates the task guidance for input extraction.
49
+ *
50
+ * @param userUtterance - The raw user input to analyze
51
+ * @param propertiesToExtract - Array of properties to extract
52
+ * @returns The guidance prompt string
53
+ */
54
+ private generateTaskGuidance;
46
55
  }