snow-flow 10.0.1-dev.486 → 10.0.1-dev.487
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
|
@@ -2506,9 +2506,10 @@ export const toolDefinition: MCPToolDefinition = {
|
|
|
2506
2506
|
'add_action', 'update_action', 'delete_action',
|
|
2507
2507
|
'add_flow_logic', 'update_flow_logic', 'delete_flow_logic',
|
|
2508
2508
|
'add_subflow', 'update_subflow', 'delete_subflow',
|
|
2509
|
-
'close_flow'
|
|
2509
|
+
'open_flow', 'close_flow'
|
|
2510
2510
|
],
|
|
2511
|
-
description: 'Action to perform.
|
|
2511
|
+
description: 'Action to perform. EDITING WORKFLOW: create_flow keeps the editing lock open — you can immediately call add_action, add_flow_logic, etc. without open_flow. For editing EXISTING flows: call open_flow first to acquire the lock. Always call close_flow as the LAST step to release the lock so users can edit in the UI. ' +
|
|
2512
|
+
'add_*/update_*/delete_* for triggers, actions, flow_logic, subflows. update_trigger replaces the trigger type. delete_* removes elements by element_id.'
|
|
2512
2513
|
},
|
|
2513
2514
|
|
|
2514
2515
|
flow_id: {
|
|
@@ -3094,11 +3095,8 @@ export async function execute(args: any, context: ServiceNowContext): Promise<To
|
|
|
3094
3095
|
}
|
|
3095
3096
|
}
|
|
3096
3097
|
|
|
3097
|
-
//
|
|
3098
|
-
|
|
3099
|
-
var lockReleased = await releaseFlowEditingLock(client, flowSysId);
|
|
3100
|
-
diagnostics.editing_lock_released = lockReleased;
|
|
3101
|
-
}
|
|
3098
|
+
// NOTE: Do NOT release the editing lock here. The agent may need to add more elements
|
|
3099
|
+
// (flow logic, actions, etc.) after creation. The agent must call close_flow when done.
|
|
3102
3100
|
|
|
3103
3101
|
return createSuccessResult({
|
|
3104
3102
|
created: true,
|
|
@@ -3706,6 +3704,26 @@ export async function execute(args: any, context: ServiceNowContext): Promise<To
|
|
|
3706
3704
|
: createErrorResult(delResult.error || 'Failed to delete element');
|
|
3707
3705
|
}
|
|
3708
3706
|
|
|
3707
|
+
// ────────────────────────────────────────────────────────────────
|
|
3708
|
+
// OPEN_FLOW — acquire Flow Designer editing lock (processflow GET)
|
|
3709
|
+
// ────────────────────────────────────────────────────────────────
|
|
3710
|
+
case 'open_flow': {
|
|
3711
|
+
if (!args.flow_id) throw new SnowFlowError(ErrorType.VALIDATION_ERROR, 'flow_id is required for open_flow');
|
|
3712
|
+
var openFlowId = await resolveFlowId(client, args.flow_id);
|
|
3713
|
+
var openSummary = summary();
|
|
3714
|
+
try {
|
|
3715
|
+
// The processflow GET is what the Flow Designer UI calls when opening a flow for editing.
|
|
3716
|
+
// This acquires the editing lock so subsequent GraphQL mutations can work.
|
|
3717
|
+
await client.get('/api/now/processflow/flow/' + openFlowId);
|
|
3718
|
+
openSummary.success('Flow opened for editing').field('Flow', openFlowId)
|
|
3719
|
+
.line('You can now use add_action, add_flow_logic, etc. Call close_flow when done.');
|
|
3720
|
+
return createSuccessResult({ action: 'open_flow', flow_id: openFlowId, editing_session: true }, {}, openSummary.build());
|
|
3721
|
+
} catch (e: any) {
|
|
3722
|
+
openSummary.error('Failed to open flow for editing: ' + (e.message || 'unknown')).field('Flow', openFlowId);
|
|
3723
|
+
return createErrorResult('Failed to open flow for editing: ' + (e.message || 'unknown'));
|
|
3724
|
+
}
|
|
3725
|
+
}
|
|
3726
|
+
|
|
3709
3727
|
// ────────────────────────────────────────────────────────────────
|
|
3710
3728
|
// CLOSE_FLOW — release Flow Designer editing lock (safeEdit)
|
|
3711
3729
|
// ────────────────────────────────────────────────────────────────
|