@memberjunction/task-graph 6.2.0-edge.6 → 6.2.0-edge.8

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.
@@ -43,6 +43,12 @@ export type TaskGraphSubmitContext = {
43
43
  Provider: IMetadataProvider;
44
44
  /** The agent run that emitted this graph, for provenance and `reinvoke` routing. */
45
45
  AgentRunID?: string | null;
46
+ /**
47
+ * Root-first ancestor agent hierarchy (`[...parentAgentHierarchy, submittingAgentName]`) of the
48
+ * run that emitted this graph, persisted on the parent row so dispatched tasks inherit the
49
+ * hierarchy directly without walking ancestor runs in a loop.
50
+ */
51
+ ParentAgentHierarchy?: string[];
46
52
  /**
47
53
  * How many continuation hops produced this graph. A graph submitted by an agent that was itself
48
54
  * re-invoked by a finished graph carries its parent's depth + 1.
@@ -80,6 +86,12 @@ export type TaskGraphParentMetadata = {
80
86
  */
81
87
  failureSemantics?: 'block' | 'edges';
82
88
  submittedByAgentRunID: string | null;
89
+ /**
90
+ * Root-first ancestor agent hierarchy (`[...parentAgentHierarchy, submittingAgentName]`) of the
91
+ * submitting run, persisted so dispatched tasks inherit the hierarchy directly without walking
92
+ * ancestor runs in a loop.
93
+ */
94
+ parentAgentHierarchy?: string[];
83
95
  /**
84
96
  * Who the graph belongs to.
85
97
  *
@@ -162,6 +174,7 @@ export declare function BuildTaskGraphParentInputPayload(args: {
162
174
  failureSemantics: NonNullable<TaskGraphParentMetadata['failureSemantics']>;
163
175
  submittedByAgentRunID: string | null;
164
176
  submittedByUserID: string | null;
177
+ parentAgentHierarchy?: string[];
165
178
  invocation?: {
166
179
  data?: unknown;
167
180
  context?: unknown;
@@ -480,15 +493,19 @@ export declare class TaskGraphService {
480
493
  Success: boolean;
481
494
  ErrorMessage?: string;
482
495
  }>;
483
- /** Maps every referenced agent name to its ID, or reports all unresolvable names at once. */
496
+ /**
497
+ * Maps every referenced agent name to its ID, resolving only `Status = 'Active'` agents that
498
+ * `context.ContextUser` has permission to run (`AIAgentPermissionHelper.FilterRunnableAgents`).
499
+ * Reports all refused names at once, split into "unknown or inactive" (including agents the user
500
+ * cannot `'view'`) and "not runnable by you" (agents the user can `'view'` but cannot `'run'`).
501
+ */
484
502
  private resolveAgents;
485
503
  /**
486
- * Maps every referenced action name to its ID, or reports all unresolvable names at once.
487
- *
488
- * Deliberately a mirror of {@link resolveAgents} rather than a generalization of it: the two
489
- * read different entities and produce different error prose, and the shared shape is three
490
- * lines. Collapsing them would trade a readable failure message for a parameterized lookup.
504
+ * Validates that every Agent node specifying a `presetName` references an Active preset of its
505
+ * resolved agent (`Name` then `DisplayName`, trimmed and case-insensitive), reporting all invalid
506
+ * `(node, preset)` pairs in a single error message.
491
507
  */
508
+ private validateAgentPresets;
492
509
  /**
493
510
  * Maps every referenced prompt name to its ID.
494
511
  *
@@ -1 +1 @@
1
- {"version":3,"file":"TaskGraphService.d.ts","sourceRoot":"","sources":["../src/TaskGraphService.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EACH,iBAAiB,EAKjB,QAAQ,EAEX,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACH,YAAY,EAIf,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAMH,KAAK,2BAA2B,EAChC,KAAK,aAAa,EAClB,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,KAAK,cAAc,EAEtB,MAAM,8BAA8B,CAAC;AAItC,OAAO,EAAuB,KAAK,eAAe,EAAE,KAAK,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAExG,OAAO,EAA4B,KAAK,mBAAmB,EAAE,KAAK,UAAU,EAAE,KAAK,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAG9H;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAIrE;AAED,4DAA4D;AAC5D,MAAM,MAAM,sBAAsB,GAAG;IACjC,uCAAuC;IACvC,aAA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;;;;OAaG;YACW,cAAc;IAmB5B;;;;;;;;OAQG;YACW,cAAc;IAuB5B,mEAAmE;YACrD,aAAa;IAsD3B;;;;;;;OAOG;YACW,eAAe;IAqI7B;;;;;;;;;;;;;;;OAeG;IACH,OAAO,CAAC,mBAAmB;IAI3B,qFAAqF;YACvE,mBAAmB;YA8CnB,YAAY;CAsB7B"}
@@ -17,9 +17,11 @@
17
17
  */
18
18
  import { LogError, LogStatus, RunInEntityTransaction, RunView, } from '@memberjunction/core';
19
19
  import { FormatValidationErrors, NormalizeDependency, RankGraphNodes, SanitizeInvocationEnvelope, ValidateTaskGraphSpec, ConfigOf, } from '@memberjunction/ai-core-plus';
20
- import { UUIDsEqual } from '@memberjunction/global';
21
- import { AgentDecisionService } from '@memberjunction/ai-agents';
20
+ import { EscapeSQLString, UUIDsEqual } from '@memberjunction/global';
21
+ import { AIAgentPermissionHelper } from '@memberjunction/ai-engine-base';
22
22
  import { AIEngine } from '@memberjunction/aiengine';
23
+ import { AgentDecisionService } from '@memberjunction/ai-agents';
24
+ import { ResolveRecordsByNameOrToolName } from './resolve-by-tool-name.js';
23
25
  import { HeldDecisionAnswers } from './decision-node.js';
24
26
  import { TaskClaimStore } from './TaskClaimStore.js';
25
27
  import { ParseTaskGraphDebugState } from './debug-state.js';
@@ -75,6 +77,12 @@ export function ParseTaskGraphParentMetadata(raw) {
75
77
  const parsed = JSON.parse(raw);
76
78
  if (!parsed || typeof parsed !== 'object')
77
79
  return { ...DEFAULT_PARENT_METADATA };
80
+ const parentAgentHierarchy = Array.isArray(parsed.parentAgentHierarchy)
81
+ ? parsed.parentAgentHierarchy
82
+ .filter((name) => typeof name === 'string')
83
+ .map((name) => name.trim())
84
+ .filter((name) => name.length > 0)
85
+ : undefined;
78
86
  return {
79
87
  ...DEFAULT_PARENT_METADATA,
80
88
  ...parsed,
@@ -91,6 +99,9 @@ export function ParseTaskGraphParentMetadata(raw) {
91
99
  continuationDeliveredAs: DELIVERY_OUTCOMES.has(parsed.continuationDeliveredAs)
92
100
  ? parsed.continuationDeliveredAs
93
101
  : undefined,
102
+ parentAgentHierarchy: parentAgentHierarchy && parentAgentHierarchy.length > 0
103
+ ? parentAgentHierarchy
104
+ : undefined,
94
105
  };
95
106
  }
96
107
  catch {
@@ -103,12 +114,19 @@ export function ParseTaskGraphParentMetadata(raw) {
103
114
  * is guaranteed to land before anyone claims.
104
115
  */
105
116
  export function BuildTaskGraphParentInputPayload(args) {
117
+ const parentAgentHierarchy = Array.isArray(args.parentAgentHierarchy)
118
+ ? args.parentAgentHierarchy
119
+ .filter((name) => typeof name === 'string')
120
+ .map((name) => name.trim())
121
+ .filter((name) => name.length > 0)
122
+ : [];
106
123
  return {
107
124
  continuation: args.continuation,
108
125
  reinvokeDepth: args.reinvokeDepth,
109
126
  failureSemantics: args.failureSemantics,
110
127
  submittedByAgentRunID: args.submittedByAgentRunID,
111
128
  submittedByUserID: args.submittedByUserID,
129
+ ...(parentAgentHierarchy.length > 0 ? { parentAgentHierarchy } : {}),
112
130
  ...(args.invocation
113
131
  ? { invocation: { data: args.invocation.data, context: args.invocation.context } }
114
132
  : {}),
@@ -186,8 +204,12 @@ const DISPATCHABLE_KINDS = [
186
204
  export function BuildStepConfiguration(node) {
187
205
  const config = {};
188
206
  const agent = ConfigOf(node, 'Agent');
189
- if (agent?.message || agent?.templateParameters) {
190
- config.agent = { message: agent.message, templateParameters: agent.templateParameters };
207
+ if (agent?.message || agent?.templateParameters || agent?.presetName) {
208
+ config.agent = {
209
+ message: agent.message,
210
+ templateParameters: agent.templateParameters,
211
+ ...(agent.presetName ? { presetName: agent.presetName } : {}),
212
+ };
191
213
  }
192
214
  const prompt = ConfigOf(node, 'Prompt');
193
215
  if (prompt?.templateParameters)
@@ -275,9 +297,14 @@ export function DecisionPromptNameOf(node) {
275
297
  return null;
276
298
  return decision.promptName?.trim() || AgentDecisionService.DEFAULT_PROMPT_NAME;
277
299
  }
278
- /** Every action name a node references, including the action a loop repeats. */
300
+ /** Every action name a node references, including the action(s) a loop repeats. */
279
301
  function actionNamesIn(node) {
280
- const names = [ConfigOf(node, 'Action')?.actionName, LoopOperationOf(node)?.action?.name];
302
+ const loopOp = LoopOperationOf(node);
303
+ const names = [
304
+ ConfigOf(node, 'Action')?.actionName,
305
+ loopOp?.action?.name,
306
+ ...(loopOp?.steps?.map((s) => s.name) ?? []),
307
+ ];
281
308
  return names.filter((n) => !!n);
282
309
  }
283
310
  /**
@@ -295,6 +322,9 @@ function asTransactionCapable(provider) {
295
322
  ? candidate
296
323
  : undefined;
297
324
  }
325
+ function hasRunAfterCommit(provider) {
326
+ return 'RunAfterCommit' in provider && typeof provider.RunAfterCommit === 'function';
327
+ }
298
328
  export function FindUnrunnableKinds(spec) {
299
329
  const offenders = spec.tasks.filter((t) => !DISPATCHABLE_KINDS.includes(t.kind));
300
330
  if (offenders.length === 0)
@@ -472,6 +502,10 @@ export class TaskGraphService {
472
502
  if (!agentIDsByName.Success) {
473
503
  return { Success: false, ErrorMessage: agentIDsByName.ErrorMessage };
474
504
  }
505
+ const presetCheck = this.validateAgentPresets(spec, agentIDsByName.Map);
506
+ if (!presetCheck.Success) {
507
+ return { Success: false, ErrorMessage: presetCheck.ErrorMessage };
508
+ }
475
509
  if (!actionIDsByName.Success) {
476
510
  return { Success: false, ErrorMessage: actionIDsByName.ErrorMessage };
477
511
  }
@@ -515,7 +549,12 @@ export class TaskGraphService {
515
549
  });
516
550
  LogStatus(`[TaskGraphService] Submitted "${spec.workflowName}": parent ${parentTaskID}, ${taskIDMap.size} task(s). ` +
517
551
  `Awaiting dispatcher pickup.`);
518
- KickTaskGraphDispatchers();
552
+ if (hasRunAfterCommit(context.Provider)) {
553
+ context.Provider.RunAfterCommit(() => { KickTaskGraphDispatchers(); }, `TaskGraphService.Submit kick (${parentTaskID})`);
554
+ }
555
+ else {
556
+ KickTaskGraphDispatchers();
557
+ }
519
558
  return { Success: true, ParentTaskID: parentTaskID, TaskIDMap: taskIDMap };
520
559
  }
521
560
  catch (e) {
@@ -1068,7 +1107,12 @@ export class TaskGraphService {
1068
1107
  // ────────────────────────────────────────────────────────────────────────
1069
1108
  // internals
1070
1109
  // ────────────────────────────────────────────────────────────────────────
1071
- /** Maps every referenced agent name to its ID, or reports all unresolvable names at once. */
1110
+ /**
1111
+ * Maps every referenced agent name to its ID, resolving only `Status = 'Active'` agents that
1112
+ * `context.ContextUser` has permission to run (`AIAgentPermissionHelper.FilterRunnableAgents`).
1113
+ * Reports all refused names at once, split into "unknown or inactive" (including agents the user
1114
+ * cannot `'view'`) and "not runnable by you" (agents the user can `'view'` but cannot `'run'`).
1115
+ */
1072
1116
  async resolveAgents(spec, context) {
1073
1117
  // A loop's repeated sub-agent counts as a referenced agent. Collecting only the Agent nodes
1074
1118
  // left a loop body pointing at a name nothing had resolved, so the row got no AgentID and
@@ -1076,36 +1120,100 @@ export class TaskGraphService {
1076
1120
  const names = [...new Set(spec.tasks.flatMap(agentNamesIn))];
1077
1121
  if (names.length === 0)
1078
1122
  return { Success: true, Map: new Map() };
1079
- const quoted = names.map((n) => `'${n.replace(/'/g, "''")}'`).join(',');
1080
- const result = await RunView.FromMetadataProvider(context.Provider).RunView({ EntityName: 'MJ: AI Agents', ExtraFilter: `Name IN (${quoted})`, Fields: ['ID', 'Name'], ResultType: 'simple' }, context.ContextUser);
1081
- const found = new Map();
1082
1123
  const engineLoaded = (AIEngine.Instance?.Agents?.length ?? 0) > 0;
1083
- for (const r of result.Results ?? []) {
1084
- if (engineLoaded && context.ContextUser && typeof AIEngine.Instance.CanUserRunAgent === 'function') {
1085
- const permitted = await AIEngine.Instance.CanUserRunAgent(r.ID, context.ContextUser);
1086
- if (!permitted) {
1087
- continue;
1124
+ const resolved = await ResolveRecordsByNameOrToolName({
1125
+ EntityName: 'MJ: AI Agents',
1126
+ Names: names,
1127
+ Provider: context.Provider,
1128
+ ContextUser: context.ContextUser,
1129
+ ActiveOnly: true,
1130
+ StripSubAgentPrefix: true,
1131
+ FilterCandidates: (rows) => AIAgentPermissionHelper.FilterRunnableAgents(rows, context.ContextUser),
1132
+ AllowCandidate: async (r) => {
1133
+ if (engineLoaded && context.ContextUser && typeof AIEngine.Instance.CanUserRunAgent === 'function') {
1134
+ return AIEngine.Instance.CanUserRunAgent(r.ID, context.ContextUser);
1088
1135
  }
1089
- }
1090
- found.set(r.Name, r.ID);
1136
+ return true;
1137
+ },
1138
+ });
1139
+ if (!resolved.Success || !resolved.Map) {
1140
+ return { Success: false, ErrorMessage: resolved.ErrorMessage };
1091
1141
  }
1092
- const missing = names.filter((n) => !found.has(n));
1142
+ const missing = resolved.Missing ?? [];
1093
1143
  if (missing.length > 0) {
1144
+ const rejected = resolved.Rejected ?? new Map();
1145
+ const unknownOrInactive = [];
1146
+ const notRunnable = [];
1147
+ for (const name of missing) {
1148
+ const row = rejected.get(name);
1149
+ if (!row) {
1150
+ unknownOrInactive.push(name);
1151
+ continue;
1152
+ }
1153
+ let canView = false;
1154
+ try {
1155
+ canView = await AIAgentPermissionHelper.HasPermission(row.ID, context.ContextUser, 'view');
1156
+ }
1157
+ catch (error) {
1158
+ LogError(`TaskGraphService.resolveAgents: view permission check failed for agent '${row.ID}': ${error instanceof Error ? error.message : String(error)}`);
1159
+ }
1160
+ if (!canView) {
1161
+ unknownOrInactive.push(name);
1162
+ }
1163
+ else {
1164
+ notRunnable.push(name);
1165
+ }
1166
+ }
1167
+ const parts = [];
1168
+ if (unknownOrInactive.length > 0) {
1169
+ parts.push(`${unknownOrInactive.length} unknown or inactive agent(s): ${unknownOrInactive.join(', ')}`);
1170
+ }
1171
+ if (notRunnable.length > 0) {
1172
+ parts.push(`${notRunnable.length} agent(s) not runnable by you: ${notRunnable.join(', ')}`);
1173
+ }
1094
1174
  return {
1095
1175
  Success: false,
1096
- ErrorMessage: `Task graph "${spec.workflowName}" references ${missing.length} unknown agent(s): ${missing.join(', ')}. ` +
1176
+ ErrorMessage: `Task graph "${spec.workflowName}" references ${parts.join('; ')}. ` +
1097
1177
  `Submitting would execute the graph with holes where those tasks should be.`,
1098
1178
  };
1099
1179
  }
1100
- return { Success: true, Map: found };
1180
+ return { Success: true, Map: resolved.Map };
1101
1181
  }
1102
1182
  /**
1103
- * Maps every referenced action name to its ID, or reports all unresolvable names at once.
1104
- *
1105
- * Deliberately a mirror of {@link resolveAgents} rather than a generalization of it: the two
1106
- * read different entities and produce different error prose, and the shared shape is three
1107
- * lines. Collapsing them would trade a readable failure message for a parameterized lookup.
1183
+ * Validates that every Agent node specifying a `presetName` references an Active preset of its
1184
+ * resolved agent (`Name` then `DisplayName`, trimmed and case-insensitive), reporting all invalid
1185
+ * `(node, preset)` pairs in a single error message.
1108
1186
  */
1187
+ validateAgentPresets(spec, agentIDsByName) {
1188
+ const invalid = [];
1189
+ for (const node of spec.tasks) {
1190
+ const agent = ConfigOf(node, 'Agent');
1191
+ const presetName = agent?.presetName?.trim();
1192
+ if (!presetName)
1193
+ continue;
1194
+ const agentID = agentIDsByName.get(agent.agentName);
1195
+ if (!agentID)
1196
+ continue;
1197
+ const matched = AIEngine.Instance.FindActiveAgentConfigurationPreset(agentID, presetName);
1198
+ if (!matched) {
1199
+ invalid.push({
1200
+ nodeLabel: node.name || node.tempId,
1201
+ agentName: agent.agentName,
1202
+ presetName,
1203
+ });
1204
+ }
1205
+ }
1206
+ if (invalid.length > 0) {
1207
+ const pairs = invalid
1208
+ .map((item) => `"${item.nodeLabel}" (agent "${item.agentName}", preset "${item.presetName}")`)
1209
+ .join(', ');
1210
+ return {
1211
+ Success: false,
1212
+ ErrorMessage: `Task graph "${spec.workflowName}" references ${invalid.length} unknown agent preset(s): ${pairs}.`,
1213
+ };
1214
+ }
1215
+ return { Success: true };
1216
+ }
1109
1217
  /**
1110
1218
  * Maps every referenced prompt name to its ID.
1111
1219
  *
@@ -1116,8 +1224,13 @@ export class TaskGraphService {
1116
1224
  const names = [...new Set(spec.tasks.flatMap(promptNamesIn))];
1117
1225
  if (names.length === 0)
1118
1226
  return { Success: true, Map: new Map() };
1119
- const quoted = names.map((n) => `'${n.replace(/'/g, "''")}'`).join(',');
1227
+ const quoted = names.map((n) => `'${EscapeSQLString(n)}'`).join(',');
1120
1228
  const result = await RunView.FromMetadataProvider(context.Provider).RunView({ EntityName: 'MJ: AI Prompts', ExtraFilter: `Name IN (${quoted})`, Fields: ['ID', 'Name'], ResultType: 'simple' }, context.ContextUser);
1229
+ if (!result.Success) {
1230
+ const reason = result.ErrorMessage || 'RunView on "MJ: AI Prompts" failed';
1231
+ LogError(`[TaskGraph] Failed to resolve "MJ: AI Prompts" by name: ${reason}`);
1232
+ return { Success: false, ErrorMessage: reason };
1233
+ }
1121
1234
  const found = new Map((result.Results ?? []).map((r) => [r.Name, r.ID]));
1122
1235
  const missing = names.filter((n) => !found.has(n));
1123
1236
  if (missing.length > 0) {
@@ -1130,14 +1243,20 @@ export class TaskGraphService {
1130
1243
  return { Success: true, Map: found };
1131
1244
  }
1132
1245
  async resolveActions(spec, context) {
1133
- // Includes a loop's repeated action — see the note in resolveAgents.
1246
+ // Includes a loop's repeated action(s) — see the note in resolveAgents.
1134
1247
  const names = [...new Set(spec.tasks.flatMap(actionNamesIn))];
1135
1248
  if (names.length === 0)
1136
1249
  return { Success: true, Map: new Map() };
1137
- const quoted = names.map((n) => `'${n.replace(/'/g, "''")}'`).join(',');
1138
- const result = await RunView.FromMetadataProvider(context.Provider).RunView({ EntityName: 'MJ: Actions', ExtraFilter: `Name IN (${quoted})`, Fields: ['ID', 'Name'], ResultType: 'simple' }, context.ContextUser);
1139
- const found = new Map((result.Results ?? []).map((r) => [r.Name, r.ID]));
1140
- const missing = names.filter((n) => !found.has(n));
1250
+ const resolved = await ResolveRecordsByNameOrToolName({
1251
+ EntityName: 'MJ: Actions',
1252
+ Names: names,
1253
+ Provider: context.Provider,
1254
+ ContextUser: context.ContextUser,
1255
+ });
1256
+ if (!resolved.Success || !resolved.Map) {
1257
+ return { Success: false, ErrorMessage: resolved.ErrorMessage };
1258
+ }
1259
+ const missing = resolved.Missing ?? [];
1141
1260
  if (missing.length > 0) {
1142
1261
  return {
1143
1262
  Success: false,
@@ -1145,7 +1264,7 @@ export class TaskGraphService {
1145
1264
  `Submitting would execute the graph with holes where those tasks should be.`,
1146
1265
  };
1147
1266
  }
1148
- return { Success: true, Map: found };
1267
+ return { Success: true, Map: resolved.Map };
1149
1268
  }
1150
1269
  /**
1151
1270
  * Finds or creates the task type used for orchestrated graphs — exactly one of it, ever.
@@ -1246,6 +1365,7 @@ export class TaskGraphService {
1246
1365
  failureSemantics: spec.failureSemantics ?? 'block',
1247
1366
  submittedByAgentRunID: context.AgentRunID ?? null,
1248
1367
  submittedByUserID: context.ContextUser?.ID ?? null,
1368
+ parentAgentHierarchy: context.ParentAgentHierarchy,
1249
1369
  invocation: sanitized.Envelope
1250
1370
  ? { data: sanitized.Envelope.Data, context: sanitized.Envelope.Context }
1251
1371
  : null,
@@ -1320,17 +1440,20 @@ export class TaskGraphService {
1320
1440
  // A loop's key points at what it REPEATS, not at the loop itself. That keeps the
1321
1441
  // reference a real foreign key — joinable, constrained, rename-proof — instead
1322
1442
  // of a name buried in JSON, and CK_Task_Assignment still holds because a loop
1323
- // body is exactly one thing.
1443
+ // body is exactly one thing (for multi-step action bodies, steps[0]'s ActionID
1444
+ // anchors the FK while stepActionIds in Configuration carries the full step map).
1324
1445
  const op = LoopOperationOf(node);
1325
1446
  if (op?.action)
1326
1447
  task.ActionID = actionIDsByName.get(op.action.name);
1448
+ else if (op?.steps?.length)
1449
+ task.ActionID = actionIDsByName.get(op.steps[0].name);
1327
1450
  else if (op?.subAgent)
1328
1451
  task.AgentID = agentIDsByName.get(op.subAgent.name);
1329
1452
  else if (op?.prompt)
1330
1453
  task.PromptID = promptIDsByName.get(op.prompt.name);
1331
1454
  else {
1332
1455
  throw new Error(`Task "${node.name}" is a loop with nothing to repeat. Choose an action, ` +
1333
- `a prompt, or a sub-agent for it to run on each pass.`);
1456
+ `steps, a prompt, or a sub-agent for it to run on each pass.`);
1334
1457
  }
1335
1458
  break;
1336
1459
  }
@@ -1350,7 +1473,17 @@ export class TaskGraphService {
1350
1473
  // run in. A graph that has not started yet has no timestamps to sort by, so its
1351
1474
  // structure is the only order available, and it is available from the moment it is
1352
1475
  // compiled.
1353
- const configuration = { ...buildStepConfiguration(node), sequence: ranks.get(node.tempId) };
1476
+ const loopOp = LoopOperationOf(node);
1477
+ const stepActionIds = loopOp?.steps?.length
1478
+ ? Object.fromEntries(loopOp.steps
1479
+ .map((s) => [s.name, actionIDsByName.get(s.name)])
1480
+ .filter((entry) => typeof entry[1] === 'string' && entry[1].length > 0))
1481
+ : undefined;
1482
+ const configuration = {
1483
+ ...buildStepConfiguration(node),
1484
+ ...(stepActionIds && Object.keys(stepActionIds).length > 0 ? { stepActionIds } : {}),
1485
+ sequence: ranks.get(node.tempId),
1486
+ };
1354
1487
  task.Configuration = JSON.stringify(configuration);
1355
1488
  // Input rides in its own column; Description stays human-readable.
1356
1489
  task.InputPayload = node.inputPayload ? JSON.stringify(node.inputPayload) : null;