snow-flow 10.0.1-dev.487 → 10.0.1-dev.488

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
- "version": "10.0.1-dev.487",
3
+ "version": "10.0.1-dev.488",
4
4
  "name": "snow-flow",
5
5
  "description": "Snow-Flow - ServiceNow Multi-Agent Development Framework powered by AI",
6
6
  "license": "Elastic-2.0",
@@ -1917,6 +1917,27 @@ async function addFlowLogicViaGraphQL(
1917
1917
  ): Promise<{ success: boolean; logicId?: string; uiUniqueIdentifier?: string; steps?: any; error?: string }> {
1918
1918
  const steps: any = {};
1919
1919
 
1920
+ // Normalize common aliases to actual ServiceNow flow logic type values
1921
+ var LOGIC_TYPE_ALIASES: Record<string, string> = {
1922
+ 'FOR_EACH': 'FOREACH',
1923
+ 'DO_UNTIL': 'DOUNTIL',
1924
+ 'ELSE_IF': 'ELSEIF',
1925
+ 'SKIP_ITERATION': 'CONTINUE',
1926
+ 'EXIT_LOOP': 'BREAK',
1927
+ 'GO_BACK_TO': 'GOBACKTO',
1928
+ 'DYNAMIC_FLOW': 'DYNAMICFLOW',
1929
+ 'END_FLOW': 'END',
1930
+ 'GET_FLOW_OUTPUT': 'GETFLOWOUTPUT',
1931
+ 'GET_FLOW_OUTPUTS': 'GETFLOWOUTPUT',
1932
+ 'SET_FLOW_VARIABLES': 'SETFLOWVARIABLES',
1933
+ 'APPEND_FLOW_VARIABLES': 'APPENDFLOWVARIABLES',
1934
+ };
1935
+ var normalizedType = LOGIC_TYPE_ALIASES[logicType.toUpperCase()] || logicType;
1936
+ if (normalizedType !== logicType) {
1937
+ steps.type_normalized = { from: logicType, to: normalizedType };
1938
+ logicType = normalizedType;
1939
+ }
1940
+
1920
1941
  // Dynamically look up flow logic definition in sys_hub_flow_logic_definition
1921
1942
  // Fetch extra fields needed for the flowLogicDefinition object in the mutation
1922
1943
  const defFields = 'sys_id,type,name,description,order,attributes,compilation_class,quiescence,visible,category,connected_to';
@@ -1924,7 +1945,7 @@ async function addFlowLogicViaGraphQL(
1924
1945
  let defName = '';
1925
1946
  let defType = logicType;
1926
1947
  let defRecord: any = {};
1927
- // Try exact match on type (IF, ELSE, FOR_EACH, DO_UNTIL, SWITCH), then name
1948
+ // Try exact match on type (IF, ELSE, FOREACH, DOUNTIL, etc.), then name
1928
1949
  for (const field of ['type', 'name']) {
1929
1950
  if (defId) break;
1930
1951
  try {
@@ -2597,17 +2618,18 @@ export const toolDefinition: MCPToolDefinition = {
2597
2618
  },
2598
2619
  logic_type: {
2599
2620
  type: 'string',
2600
- description: 'Flow logic type for add_flow_logic. Looked up dynamically in sys_hub_flow_logic_definition. Available types: ' +
2621
+ description: 'Flow logic type for add_flow_logic. Looked up dynamically in sys_hub_flow_logic_definition. ' +
2622
+ 'Common aliases (FOR_EACH, DO_UNTIL, etc.) are auto-normalized to ServiceNow types. Available types: ' +
2601
2623
  'IF, ELSEIF, ELSE — conditional branching. Use ELSEIF (not nested ELSE+IF) for else-if branches. ELSE and ELSEIF require connected_to set to the If block\'s uiUniqueIdentifier. ' +
2602
- 'FOR_EACH, DO_UNTIL — loops. SKIP_ITERATION and EXIT_LOOP can be used inside loops. ' +
2624
+ 'FOREACH (or FOR_EACH), DOUNTIL (or DO_UNTIL) — loops. CONTINUE (skip iteration) and BREAK (exit loop) can be used inside loops. ' +
2603
2625
  'PARALLEL — execute branches in parallel. ' +
2604
2626
  'DECISION — switch/decision table. ' +
2605
2627
  'TRY — error handling (try/catch). ' +
2606
2628
  'END — End Flow (stops execution). Always add END as the last element when the flow should terminate cleanly. ' +
2607
2629
  'TIMER — Wait for a duration of time. ' +
2608
- 'GO_BACK_TO — jump back to a previous step. ' +
2609
- 'SET_FLOW_VARIABLES, APPEND_FLOW_VARIABLES, GET_FLOW_OUTPUT — flow variable management. ' +
2610
- 'WORKFLOW — call a legacy workflow. DYNAMIC_FLOW — dynamically invoke a flow. ' +
2630
+ 'GOBACKTO (or GO_BACK_TO) — jump back to a previous step. ' +
2631
+ 'SETFLOWVARIABLES, APPENDFLOWVARIABLES, GETFLOWOUTPUT — flow variable management. ' +
2632
+ 'WORKFLOW — call a legacy workflow. DYNAMICFLOW — dynamically invoke a flow. ' +
2611
2633
  'Best practice: add an END element at the end of your flow for clean termination.'
2612
2634
  },
2613
2635
  logic_inputs: {