openfox 2.0.145 → 2.0.147

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 (58) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/dist/CHANGELOG.md +22 -0
  3. package/dist/{auto-continue-ZAHNBHPA.js → auto-continue-FGQ63HHR.js} +9 -9
  4. package/dist/{chat-handler-5XMO5XBU.js → chat-handler-VCED3JYF.js} +12 -12
  5. package/dist/{chunk-OVAHNEFG.js → chunk-2PGRX4RH.js} +5 -4
  6. package/dist/{chunk-LG3LQLTZ.js → chunk-2V6QL6IW.js} +290 -120
  7. package/dist/{chunk-2DVAF6HY.js → chunk-5JGRKNMS.js} +3 -3
  8. package/dist/chunk-65KDNVRA.js +7 -0
  9. package/dist/{chunk-2BARKBWV.js → chunk-ABXERHIY.js} +8 -8
  10. package/dist/{chunk-QKPTMHA2.js → chunk-AJMBQMJH.js} +23 -19
  11. package/dist/{chunk-E4F32L4Q.js → chunk-CPRBMVI7.js} +43 -1
  12. package/dist/{chunk-STVJA7IX.js → chunk-CVQYCAMY.js} +3 -3
  13. package/dist/{chunk-HNJ32GRI.js → chunk-ESHP42KO.js} +5 -5
  14. package/dist/{chunk-FLTNKZNQ.js → chunk-KJEOKIH2.js} +4 -4
  15. package/dist/chunk-NHHC3AVI.js +231 -0
  16. package/dist/{chunk-YRSZJ7IZ.js → chunk-NZBO3A3W.js} +2 -2
  17. package/dist/{chunk-3IVJ65IG.js → chunk-ORIPUMOQ.js} +5 -5
  18. package/dist/{chunk-VFHGN3IS.js → chunk-P7KUU5VB.js} +2 -2
  19. package/dist/{chunk-PW5L4WBG.js → chunk-Q6MBLKL4.js} +1 -1
  20. package/dist/{chunk-6FKSGQYO.js → chunk-QHFJRUJV.js} +3 -3
  21. package/dist/{chunk-X2BJFVER.js → chunk-UOBJP4GN.js} +21 -15
  22. package/dist/{chunk-DBTDMK23.js → chunk-YQJ6HEFS.js} +63 -56
  23. package/dist/cli/dev.js +1 -1
  24. package/dist/cli/index.js +1 -1
  25. package/dist/{compactor-53WDNC2S.js → compactor-YY7PO2XE.js} +5 -5
  26. package/dist/{describe-image-IGLGVEOJ.js → describe-image-Z5WS6YU3.js} +8 -8
  27. package/dist/{dynamic-context-7AJC6AII.js → dynamic-context-YLRA34WJ.js} +5 -5
  28. package/dist/{events-ODZ4SSBW.js → events-FTS5W6FX.js} +6 -4
  29. package/dist/{export-import-AH5HBHO6.js → export-import-R4E5BUQS.js} +5 -5
  30. package/dist/{folding-V2R2MZ6Y.js → folding-VWRMYZ5T.js} +4 -2
  31. package/dist/{launch-2QA2EHCT.js → launch-QP2BI3PB.js} +13 -13
  32. package/dist/{orchestrator-L5VINV36.js → orchestrator-7T62RLDL.js} +11 -11
  33. package/dist/package.json +1 -1
  34. package/dist/{path-security-3YFS3GJQ.js → path-security-25P6TQ4R.js} +7 -7
  35. package/dist/{processor-UQ5ITWL6.js → processor-LDLRELLS.js} +11 -11
  36. package/dist/{protocol-Ch2s26bR.d.ts → protocol--oV4P3L_.d.ts} +2 -1
  37. package/dist/{protocol-MRMOB3P4.js → protocol-M4DFHA32.js} +3 -3
  38. package/dist/provider/index.d.ts +4 -4
  39. package/dist/{serve-CIBBSOLM.js → serve-A4AJAH2N.js} +18 -18
  40. package/dist/server/index.d.ts +3 -3
  41. package/dist/server/index.js +17 -17
  42. package/dist/{server-YW3DO4K5.js → server-A3EGJ6MD.js} +16 -16
  43. package/dist/session-stats-Y7WRB5MP.js +23 -0
  44. package/dist/shared/index.d.ts +25 -9
  45. package/dist/shared/index.js +7 -3
  46. package/dist/skill-defaults/workflows/SKILL.md +149 -16
  47. package/dist/stats-2QMXP6G4.js +12 -0
  48. package/dist/{store-AOZ46PBS.js → store-OWOLXB74.js} +3 -3
  49. package/dist/{tools-RG4HDV75.js → tools-MRC27SZG.js} +9 -9
  50. package/dist/{types-BajWwfkt.d.ts → types-NEE5osQN.d.ts} +48 -1
  51. package/dist/{types-BiHNYUUI.d.ts → types-usLcJB6N.d.ts} +1 -1
  52. package/dist/{update-5ENWM2XR.js → update-MLDVVG3D.js} +2 -2
  53. package/dist/web/assets/{index-DL26wmhi.js → index-CkVmYTBd.js} +85 -85
  54. package/dist/web/index.html +1 -1
  55. package/dist/web/sw.js +1 -1
  56. package/package.json +1 -1
  57. package/dist/chunk-7OHXF5GW.js +0 -132
  58. package/dist/chunk-QV4BKKIO.js +0 -7
@@ -1,10 +1,12 @@
1
1
  import {
2
2
  runAgentTurn
3
- } from "./chunk-2BARKBWV.js";
3
+ } from "./chunk-ABXERHIY.js";
4
4
  import {
5
+ buildAgentOverrideStatsIdentity,
5
6
  executeSubAgent,
6
- getToolRegistryForAgent
7
- } from "./chunk-QKPTMHA2.js";
7
+ getToolRegistryForAgent,
8
+ resolveLLMClientForAgent
9
+ } from "./chunk-AJMBQMJH.js";
8
10
  import {
9
11
  gitSpawnEnv
10
12
  } from "./chunk-J7GAZGZT.js";
@@ -33,10 +35,10 @@ import {
33
35
  } from "./chunk-I72ACQ6R.js";
34
36
  import {
35
37
  getCurrentContextWindowId
36
- } from "./chunk-2DVAF6HY.js";
38
+ } from "./chunk-5JGRKNMS.js";
37
39
  import {
38
40
  getEventStore
39
- } from "./chunk-YRSZJ7IZ.js";
41
+ } from "./chunk-NZBO3A3W.js";
40
42
  import {
41
43
  findAgentById,
42
44
  getRuntimeConfig,
@@ -46,7 +48,7 @@ import {
46
48
  import {
47
49
  createChatMessageMessage,
48
50
  createSessionRunningMessage
49
- } from "./chunk-OVAHNEFG.js";
51
+ } from "./chunk-2PGRX4RH.js";
50
52
  import {
51
53
  LLMError
52
54
  } from "./chunk-GZ4EK4LZ.js";
@@ -55,10 +57,10 @@ import {
55
57
  } from "./chunk-K44MW7JJ.js";
56
58
  import {
57
59
  computeSessionStats
58
- } from "./chunk-7OHXF5GW.js";
60
+ } from "./chunk-NHHC3AVI.js";
59
61
  import {
60
62
  createServerMessage
61
- } from "./chunk-PW5L4WBG.js";
63
+ } from "./chunk-Q6MBLKL4.js";
62
64
  import {
63
65
  getGlobalConfigDir
64
66
  } from "./chunk-CQGTEGKL.js";
@@ -204,13 +206,13 @@ function executeShellCommand(command, cwd, timeout, signal) {
204
206
  });
205
207
  }
206
208
 
207
- // src/server/workflows/executor.ts
209
+ // src/server/workflows/template.ts
208
210
  var TEMPLATE_VARIABLES = [
209
211
  { name: "workdir", description: "Working directory of the session" },
210
212
  { name: "reason", description: 'Human-readable reason (e.g. "2 criteria remaining")' },
211
213
  {
212
214
  name: "stepOutput",
213
- description: "Structured output from the previous step (content, stdout, stderr, exitCode, etc.)"
215
+ description: "Structured output from the previous step (content, stdout, stderr, exitCode, etc.); parallel steps expose per-child keys <childId>.<key> and a summary"
214
216
  },
215
217
  {
216
218
  name: "verifierFindings",
@@ -225,16 +227,6 @@ var TEMPLATE_VARIABLES = [
225
227
  { name: "criteriaList", description: "Formatted list of all criteria with status" },
226
228
  { name: "modifiedFiles", description: "List of modified files" }
227
229
  ];
228
- function formatCriteriaList(entries) {
229
- if (entries.length === 0) return "(none)";
230
- return entries.map((e) => {
231
- const status = e.status === "passed" ? "[PASSED]" : e.status === "completed" ? "[NEEDS VERIFICATION]" : e.status === "failed" ? "[FAILED]" : "[NOT COMPLETED]";
232
- return `- **${e.id}** ${status}: ${e.description}`;
233
- }).join("\n");
234
- }
235
- async function formatModifiedFiles(workdir) {
236
- return formatGitDiffFiles(workdir);
237
- }
238
230
  function resolveTemplate(template, ctx) {
239
231
  let result = template;
240
232
  for (const { name } of TEMPLATE_VARIABLES) {
@@ -242,7 +234,7 @@ function resolveTemplate(template, ctx) {
242
234
  const value = String(ctx[name]);
243
235
  result = result.replace(new RegExp(`\\{\\{${name}\\}\\}`, "g"), value);
244
236
  }
245
- result = result.replace(/\{\{stepOutput\.(\w+)\}\}/g, (_, key) => ctx.stepOutput[key] ?? "");
237
+ result = result.replace(/\{\{stepOutput\.([\w.-]+)\}\}/g, (_, key) => ctx.stepOutput[key] ?? "");
246
238
  result = result.replace(/\{\{verifierFindings\}\}/g, ctx.stepOutput["content"] ?? "");
247
239
  result = result.replace(/\{\{previousStepOutput\}\}/g, ctx.stepOutput["stdout"] ?? "");
248
240
  for (const [key, value] of Object.entries(ctx.params)) {
@@ -250,6 +242,196 @@ function resolveTemplate(template, ctx) {
250
242
  }
251
243
  return result;
252
244
  }
245
+
246
+ // src/server/workflows/parallel.ts
247
+ async function mapPool(items, limit, task) {
248
+ const results = new Array(items.length);
249
+ let firstError = null;
250
+ let next = 0;
251
+ const workers = Array.from({ length: Math.min(Math.max(limit, 1), items.length) }, async () => {
252
+ while (next < items.length) {
253
+ const index = next++;
254
+ try {
255
+ results[index] = await task(items[index]);
256
+ } catch (error) {
257
+ if (firstError === null) {
258
+ firstError = error;
259
+ }
260
+ }
261
+ }
262
+ });
263
+ await Promise.all(workers);
264
+ if (firstError !== null) {
265
+ throw firstError;
266
+ }
267
+ return results;
268
+ }
269
+ function aggregateParallel(outcomes) {
270
+ const successCount = outcomes.filter((o) => o.result === "success").length;
271
+ const result = outcomes.length === 0 ? "failure" : successCount === outcomes.length ? "success" : successCount === 0 ? "failure" : "partial";
272
+ const output = {
273
+ result,
274
+ summary: outcomes.map((o) => `- ${o.id}: ${o.result}`).join("\n")
275
+ };
276
+ for (const o of outcomes) {
277
+ output[`${o.id}.result`] = o.result;
278
+ for (const [key, value] of Object.entries(o.output)) {
279
+ output[`${o.id}.${key}`] = value;
280
+ }
281
+ }
282
+ return { result, output };
283
+ }
284
+ function isAbortError(error) {
285
+ return error instanceof Error && error.message === "Aborted";
286
+ }
287
+ function failureOutcome(id, error) {
288
+ const message = error instanceof Error ? error.message : String(error);
289
+ logger.warn("Workflow child step failed", { child: id, error: message });
290
+ return { id, result: "failure", output: { error: message } };
291
+ }
292
+ async function runSubAgentChild(child, deps) {
293
+ const { sessionManager, sessionId, llmClient, ctx, signal, onMessage } = deps;
294
+ try {
295
+ const turnMetrics = new TurnMetrics();
296
+ const promptTemplate = child.prompt ?? "Perform your task.";
297
+ const resolvedPrompt = resolveTemplate(promptTemplate, ctx);
298
+ const allAgents = deps.agents ?? await loadAllAgentsDefault(sessionManager.getProjectWorkdir(sessionId));
299
+ const agentDef = findAgentById(child.subAgentType, allAgents);
300
+ if (!agentDef) {
301
+ logger.error("Sub-agent definition not found", { subAgentType: child.subAgentType });
302
+ return { id: child.id, result: "error", output: { error: `Unknown sub-agent type: ${child.subAgentType}` } };
303
+ }
304
+ const toolRegistry = getToolRegistryForAgent(agentDef);
305
+ const filteredToolRegistry = {
306
+ tools: toolRegistry.tools.filter((t) => t.name !== "step_done"),
307
+ definitions: toolRegistry.definitions.filter((d) => d.type === "function" && d.function.name !== "step_done"),
308
+ execute: toolRegistry.execute
309
+ };
310
+ const result = await executeSubAgent({
311
+ subAgentType: child.subAgentType,
312
+ prompt: resolvedPrompt,
313
+ sessionManager,
314
+ sessionId,
315
+ llmClient,
316
+ toolRegistry: filteredToolRegistry,
317
+ turnMetrics,
318
+ providerManager: sessionManager.getProviderManager?.(),
319
+ statsIdentity: deps.statsIdentity ?? {
320
+ providerId: "",
321
+ providerName: "",
322
+ backend: "unknown",
323
+ model: llmClient.getModel()
324
+ },
325
+ ...signal ? { signal } : {},
326
+ ...onMessage ? { onMessage } : {}
327
+ });
328
+ return {
329
+ id: child.id,
330
+ result: result.result ?? "success",
331
+ output: { content: result.content ?? "", ...result.result ? { result: result.result } : {} }
332
+ };
333
+ } catch (error) {
334
+ if (isAbortError(error)) {
335
+ throw error;
336
+ }
337
+ return failureOutcome(child.id, error);
338
+ }
339
+ }
340
+ async function runShellChild(child, deps) {
341
+ const { sessionManager, sessionId, ctx, label, signal, onMessage, eventStore, windowOptions } = deps;
342
+ if (child.command === void 0) {
343
+ logger.warn("Shell child has no command", { child: child.id });
344
+ return { id: child.id, result: "error", output: { error: "Missing command" } };
345
+ }
346
+ const command = resolveTemplate(child.command, ctx);
347
+ const timeout = child.timeout ?? 6e4;
348
+ const successCodes = child.successExitCodes ?? [0];
349
+ const runningContent = label ? serverT(
350
+ { en: "Running ({{label}}): `{{command}}`", fr: "Ex\xE9cution ({{label}}) : `{{command}}`" },
351
+ { label, command }
352
+ ) : serverT({ en: "Running: `{{command}}`", fr: "Ex\xE9cution : `{{command}}`" }, { command });
353
+ const shellMsgId = crypto.randomUUID();
354
+ eventStore.append(
355
+ sessionId,
356
+ createMessageStartEvent(shellMsgId, "user", runningContent, {
357
+ ...windowOptions ?? {},
358
+ isSystemGenerated: true,
359
+ messageKind: "auto-prompt",
360
+ metadata: { type: "workflow", name: "Workflow", color: "#f59e0b" }
361
+ })
362
+ );
363
+ if (onMessage) {
364
+ onMessage(
365
+ createChatMessageMessage({
366
+ id: shellMsgId,
367
+ role: "user",
368
+ content: runningContent,
369
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
370
+ isSystemGenerated: true,
371
+ messageKind: "auto-prompt",
372
+ metadata: { type: "workflow", name: "Workflow", color: "#f59e0b" }
373
+ })
374
+ );
375
+ }
376
+ const result = await executeShellCommand(command, sessionManager.getEffectiveWorkdir(sessionId), timeout, signal);
377
+ const output = [result.stdout, result.stderr].filter(Boolean).join("\n").trim();
378
+ const outputContent = output ? label ? serverT(
379
+ {
380
+ en: "Exit code ({{label}}): {{code}}\n```\n{{output}}\n```",
381
+ fr: "Code de sortie ({{label}}) : {{code}}\n```\n{{output}}\n```"
382
+ },
383
+ { label, code: result.exitCode, output: output.slice(0, 1e4) }
384
+ ) : serverT(
385
+ { en: "Exit code: {{code}}\n```\n{{output}}\n```", fr: "Code de sortie : {{code}}\n```\n{{output}}\n```" },
386
+ { code: result.exitCode, output: output.slice(0, 1e4) }
387
+ ) : label ? serverT(
388
+ { en: "Exit code ({{label}}): {{code}}", fr: "Code de sortie ({{label}}) : {{code}}" },
389
+ { label, code: result.exitCode }
390
+ ) : serverT({ en: "Exit code: {{code}}", fr: "Code de sortie : {{code}}" }, { code: result.exitCode });
391
+ eventStore.append(sessionId, { type: "message.done", data: { messageId: shellMsgId } });
392
+ const outputMsgId = crypto.randomUUID();
393
+ eventStore.append(
394
+ sessionId,
395
+ createMessageStartEvent(outputMsgId, "user", outputContent, {
396
+ ...windowOptions ?? {},
397
+ isSystemGenerated: true,
398
+ messageKind: "correction"
399
+ })
400
+ );
401
+ eventStore.append(sessionId, { type: "message.done", data: { messageId: outputMsgId } });
402
+ if (onMessage) {
403
+ onMessage(
404
+ createChatMessageMessage({
405
+ id: outputMsgId,
406
+ role: "user",
407
+ content: outputContent,
408
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
409
+ isSystemGenerated: true,
410
+ messageKind: "correction"
411
+ })
412
+ );
413
+ }
414
+ return {
415
+ id: child.id,
416
+ result: successCodes.includes(result.exitCode) ? "success" : "failure",
417
+ output: { stdout: result.stdout ?? "", stderr: result.stderr ?? "", exitCode: String(result.exitCode) }
418
+ };
419
+ }
420
+ async function runChild(child, deps) {
421
+ return child.type === "sub_agent" ? runSubAgentChild(child, deps) : runShellChild(child, deps);
422
+ }
423
+
424
+ // src/server/workflows/executor.ts
425
+ function formatCriteriaList(entries) {
426
+ if (entries.length === 0) return "(none)";
427
+ return entries.map((e) => {
428
+ const status = e.status === "passed" ? "[PASSED]" : e.status === "completed" ? "[NEEDS VERIFICATION]" : e.status === "failed" ? "[FAILED]" : "[NOT COMPLETED]";
429
+ return `- **${e.id}** ${status}: ${e.description}`;
430
+ }).join("\n");
431
+ }
432
+ async function formatModifiedFiles(workdir) {
433
+ return formatGitDiffFiles(workdir);
434
+ }
253
435
  function evaluateCondition(condition, stepOutcome, metadataEntries) {
254
436
  switch (condition.type) {
255
437
  case "step_result":
@@ -364,6 +546,20 @@ function buildReason(metadataEntries) {
364
546
  const remaining = entries.filter((e) => e.status !== "passed");
365
547
  return `${remaining.length} criteria remaining`;
366
548
  }
549
+ function buildStepChildDeps(options, templateCtx, eventStore, windowOptions) {
550
+ const { sessionManager, sessionId, llmClient, statsIdentity, signal, onMessage } = options;
551
+ return {
552
+ sessionManager,
553
+ sessionId,
554
+ llmClient,
555
+ ctx: templateCtx,
556
+ ...signal ? { signal } : {},
557
+ ...onMessage ? { onMessage } : {},
558
+ ...statsIdentity !== void 0 ? { statsIdentity } : {},
559
+ eventStore,
560
+ windowOptions
561
+ };
562
+ }
367
563
  async function executeWorkflow(workflow, options, subGroup) {
368
564
  const { sessionManager, sessionId, llmClient, signal, onMessage } = options;
369
565
  const eventStore = getEventStore();
@@ -582,22 +778,45 @@ async function executeWorkflow(workflow, options, subGroup) {
582
778
  const es = getEventStore();
583
779
  const append = (event) => es.append(sessionId, event);
584
780
  let stepDoneCalled = false;
781
+ const stepAgentId = agentStep.agentId ?? resolveDefaultAgentId();
782
+ const effectiveProviderManager = sessionManager.getProviderManager?.();
783
+ let stepLlmClient = llmClient;
784
+ let stepStatsIdentity = options.statsIdentity;
785
+ let stepGetSessionLLMClient = options.getSessionLLMClient;
786
+ if (effectiveProviderManager) {
787
+ const pinnedEffort = session.providerPinnedEffort ?? void 0;
788
+ const resolved = resolveLLMClientForAgent(stepAgentId, llmClient, effectiveProviderManager, pinnedEffort);
789
+ if (resolved.usedOverride && resolved.override) {
790
+ stepLlmClient = resolved.client;
791
+ stepStatsIdentity = buildAgentOverrideStatsIdentity(
792
+ effectiveProviderManager,
793
+ resolved.client,
794
+ resolved.override
795
+ );
796
+ stepGetSessionLLMClient = void 0;
797
+ } else if (resolved.warning) {
798
+ logger.warn("Agent step model override unavailable, falling back", {
799
+ agentId: stepAgentId,
800
+ warning: resolved.warning
801
+ });
802
+ }
803
+ }
585
804
  let agentResult;
586
805
  try {
587
806
  agentResult = await runAgentTurn(
588
807
  {
589
808
  sessionManager,
590
809
  sessionId,
591
- llmClient,
592
- ...options.getSessionLLMClient ? { getSessionLLMClient: options.getSessionLLMClient } : {},
593
- ...options.statsIdentity ? { statsIdentity: options.statsIdentity } : {},
810
+ llmClient: stepLlmClient,
811
+ ...stepGetSessionLLMClient ? { getSessionLLMClient: stepGetSessionLLMClient } : {},
812
+ ...stepStatsIdentity ? { statsIdentity: stepStatsIdentity } : {},
594
813
  ...signal ? { signal } : {},
595
814
  ...onMessage ? { onMessage } : {},
596
815
  ...options.llmRetryPolicy ? { llmRetryPolicy: options.llmRetryPolicy } : {},
597
816
  ...isResumingCurrentStep ? { skipAgentReminder: true } : {}
598
817
  },
599
818
  turnMetrics,
600
- agentStep.agentId ?? resolveDefaultAgentId(),
819
+ stepAgentId,
601
820
  append,
602
821
  {
603
822
  ...!firstEntryForStep.has(step.id) && !agentStep.prompt && !isResumingCurrentStep ? { injectKickoff: () => injectGenericKickoff(sessionId) } : {},
@@ -641,112 +860,63 @@ async function executeWorkflow(workflow, options, subGroup) {
641
860
  }
642
861
  case "sub_agent": {
643
862
  const subStep = step;
644
- const turnMetrics = new TurnMetrics();
645
- const promptTemplate = subStep.prompt ?? "Perform your task.";
646
- const resolvedPrompt = resolveTemplate(promptTemplate, templateCtx);
647
- const allAgents = await loadAllAgentsDefault(sessionManager.getProjectWorkdir(sessionId));
648
- const agentDef = findAgentById(subStep.subAgentType, allAgents);
649
- if (!agentDef) {
650
- logger.error("Sub-agent definition not found", { subAgentType: subStep.subAgentType });
651
- stepOutcome = { result: "error", output: {} };
652
- break;
863
+ const outcome = await runSubAgentChild(
864
+ subStep,
865
+ buildStepChildDeps(options, templateCtx, eventStore, currentWindowMessageOptions)
866
+ );
867
+ lastStepOutput = outcome.output;
868
+ stepOutcome = { result: outcome.result, output: lastStepOutput };
869
+ break;
870
+ }
871
+ case "shell": {
872
+ const shellStep = step;
873
+ const outcome = await runShellChild(
874
+ shellStep,
875
+ buildStepChildDeps(options, templateCtx, eventStore, currentWindowMessageOptions)
876
+ );
877
+ lastStepOutput = outcome.output;
878
+ stepOutcome = { result: outcome.result, output: lastStepOutput };
879
+ break;
880
+ }
881
+ case "parallel": {
882
+ const parallelStep = step;
883
+ if (parallelStep.children.length === 0) {
884
+ logger.warn("Parallel step has no children", { sessionId, stepId: step.id });
653
885
  }
654
- const toolRegistry = getToolRegistryForAgent(agentDef);
655
- const filteredToolRegistry = {
656
- tools: toolRegistry.tools.filter((t) => t.name !== "step_done"),
657
- definitions: toolRegistry.definitions.filter((d) => d.type === "function" && d.function.name !== "step_done"),
658
- execute: toolRegistry.execute
659
- };
660
- const result = await executeSubAgent({
661
- subAgentType: subStep.subAgentType,
662
- prompt: resolvedPrompt,
886
+ const childIds = parallelStep.children.map((c) => c.id);
887
+ if (new Set(childIds).size !== childIds.length) {
888
+ logger.warn("Parallel step has duplicate child ids", { sessionId, stepId: step.id, ids: childIds });
889
+ }
890
+ const allAgents = await loadAllAgentsDefault(sessionManager.getProjectWorkdir(sessionId));
891
+ const baseDeps = {
663
892
  sessionManager,
664
893
  sessionId,
665
894
  llmClient,
666
- toolRegistry: filteredToolRegistry,
667
- turnMetrics,
668
- providerManager: sessionManager.getProviderManager?.(),
895
+ ctx: templateCtx,
896
+ ...signal ? { signal } : {},
897
+ ...onMessage ? { onMessage } : {},
898
+ eventStore,
899
+ windowOptions: currentWindowMessageOptions,
669
900
  statsIdentity: options.statsIdentity ?? {
670
901
  providerId: "",
671
902
  providerName: "",
672
903
  backend: "unknown",
673
904
  model: llmClient.getModel()
674
905
  },
675
- ...signal ? { signal } : {},
676
- ...onMessage ? { onMessage } : {}
677
- });
678
- lastStepOutput = { content: result.content ?? "", ...result.result ? { result: result.result } : {} };
679
- stepOutcome = { result: result.result ?? "success", output: lastStepOutput };
680
- break;
681
- }
682
- case "shell": {
683
- const shellStep = step;
684
- const command = resolveTemplate(shellStep.command, templateCtx);
685
- const timeout = shellStep.timeout ?? 6e4;
686
- const successCodes = shellStep.successExitCodes ?? [0];
687
- const shellMsgId = crypto.randomUUID();
688
- const runningContent = serverT({ en: "Running: `{{command}}`", fr: "Ex\xE9cution : `{{command}}`" }, { command });
689
- eventStore.append(
690
- sessionId,
691
- createMessageStartEvent(shellMsgId, "user", runningContent, {
692
- ...currentWindowMessageOptions ?? {},
693
- isSystemGenerated: true,
694
- messageKind: "auto-prompt",
695
- metadata: { type: "workflow", name: "Workflow", color: "#f59e0b" }
696
- })
697
- );
698
- if (onMessage) {
699
- onMessage(
700
- createChatMessageMessage({
701
- id: shellMsgId,
702
- role: "user",
703
- content: runningContent,
704
- timestamp: (/* @__PURE__ */ new Date()).toISOString(),
705
- isSystemGenerated: true,
706
- messageKind: "auto-prompt",
707
- metadata: { type: "workflow", name: "Workflow", color: "#f59e0b" }
708
- })
709
- );
710
- }
711
- const result = await executeShellCommand(
712
- command,
713
- sessionManager.getEffectiveWorkdir(sessionId),
714
- timeout,
715
- signal
906
+ agents: allAgents
907
+ };
908
+ const limit = Math.min(
909
+ Math.max(Math.floor(parallelStep.maxConcurrency ?? parallelStep.children.length), 1),
910
+ parallelStep.children.length
716
911
  );
717
- const output = [result.stdout, result.stderr].filter(Boolean).join("\n").trim();
718
- lastStepOutput = { stdout: result.stdout ?? "", stderr: result.stderr ?? "", exitCode: String(result.exitCode) };
719
- const outputContent = output ? serverT(
720
- {
721
- en: "Exit code: {{code}}\n```\n{{output}}\n```",
722
- fr: "Code de sortie : {{code}}\n```\n{{output}}\n```"
723
- },
724
- { code: result.exitCode, output: output.slice(0, 1e4) }
725
- ) : serverT({ en: "Exit code: {{code}}", fr: "Code de sortie : {{code}}" }, { code: result.exitCode });
726
- eventStore.append(sessionId, { type: "message.done", data: { messageId: shellMsgId } });
727
- const outputMsgId = crypto.randomUUID();
728
- eventStore.append(
729
- sessionId,
730
- createMessageStartEvent(outputMsgId, "user", outputContent, {
731
- ...currentWindowMessageOptions ?? {},
732
- isSystemGenerated: true,
733
- messageKind: "correction"
734
- })
912
+ const outcomes = await mapPool(
913
+ parallelStep.children,
914
+ limit,
915
+ (child) => runChild(child, { ...baseDeps, label: child.id })
735
916
  );
736
- eventStore.append(sessionId, { type: "message.done", data: { messageId: outputMsgId } });
737
- if (onMessage) {
738
- onMessage(
739
- createChatMessageMessage({
740
- id: outputMsgId,
741
- role: "user",
742
- content: outputContent,
743
- timestamp: (/* @__PURE__ */ new Date()).toISOString(),
744
- isSystemGenerated: true,
745
- messageKind: "correction"
746
- })
747
- );
748
- }
749
- stepOutcome = { result: successCodes.includes(result.exitCode) ? "success" : "failure", output: lastStepOutput };
917
+ const aggregate = aggregateParallel(outcomes);
918
+ lastStepOutput = aggregate.output;
919
+ stepOutcome = { result: aggregate.result, output: lastStepOutput };
750
920
  break;
751
921
  }
752
922
  case "user": {
@@ -1026,4 +1196,4 @@ export {
1026
1196
  abortRunnerRun,
1027
1197
  launchWorkflowRun
1028
1198
  };
1029
- //# sourceMappingURL=chunk-LG3LQLTZ.js.map
1199
+ //# sourceMappingURL=chunk-2V6QL6IW.js.map
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  getEventStore
3
- } from "./chunk-YRSZJ7IZ.js";
3
+ } from "./chunk-NZBO3A3W.js";
4
4
  import {
5
5
  buildContextMessagesFromEventHistory,
6
6
  buildMessagesFromStoredEvents,
7
7
  foldContextState,
8
8
  foldSessionState,
9
9
  spreadOptionalMessageFields
10
- } from "./chunk-E4F32L4Q.js";
10
+ } from "./chunk-CPRBMVI7.js";
11
11
  import {
12
12
  updateSessionMessageCount
13
13
  } from "./chunk-CCIG3YLG.js";
@@ -444,4 +444,4 @@ export {
444
444
  truncateSessionMessages,
445
445
  getRecentUserPromptsForSession
446
446
  };
447
- //# sourceMappingURL=chunk-2DVAF6HY.js.map
447
+ //# sourceMappingURL=chunk-5JGRKNMS.js.map
@@ -0,0 +1,7 @@
1
+ // src/constants.ts
2
+ var VERSION = "2.0.147";
3
+
4
+ export {
5
+ VERSION
6
+ };
7
+ //# sourceMappingURL=chunk-65KDNVRA.js.map
@@ -3,14 +3,14 @@ import {
3
3
  checkToolChangesAndInject,
4
4
  computeDynamicContextHash,
5
5
  getToolFingerprint
6
- } from "./chunk-HNJ32GRI.js";
6
+ } from "./chunk-ESHP42KO.js";
7
7
  import {
8
8
  createAssemblyResult,
9
9
  getConversationMessages,
10
10
  getToolRegistryForAgent,
11
11
  processEventsForConversation,
12
12
  runTopLevelAgentLoop
13
- } from "./chunk-QKPTMHA2.js";
13
+ } from "./chunk-AJMBQMJH.js";
14
14
  import {
15
15
  getAllInstructions,
16
16
  getEnabledSkillMetadata
@@ -20,7 +20,7 @@ import {
20
20
  } from "./chunk-X7ZAP6YW.js";
21
21
  import {
22
22
  PathAccessDeniedError
23
- } from "./chunk-STVJA7IX.js";
23
+ } from "./chunk-CVQYCAMY.js";
24
24
  import {
25
25
  TurnMetrics,
26
26
  createChatDoneEvent,
@@ -34,13 +34,13 @@ import {
34
34
  import {
35
35
  getCurrentContextWindowId,
36
36
  getCurrentWindowMessageOptions
37
- } from "./chunk-2DVAF6HY.js";
37
+ } from "./chunk-5JGRKNMS.js";
38
38
  import {
39
39
  getEventStore
40
- } from "./chunk-YRSZJ7IZ.js";
40
+ } from "./chunk-NZBO3A3W.js";
41
41
  import {
42
42
  buildSnapshotFromSessionState
43
- } from "./chunk-E4F32L4Q.js";
43
+ } from "./chunk-CPRBMVI7.js";
44
44
  import {
45
45
  findAgentById,
46
46
  getRuntimeConfig,
@@ -357,7 +357,7 @@ async function runAgentTurn(options, turnMetrics, agentId, append, callbacks) {
357
357
  getConversationMessages: buildGetConversationMessages(options.sessionId, resolveAgentClient, append),
358
358
  injectAgentReminder: () => injectAgentReminder(options.sessionId, agentDef),
359
359
  rebuildCachedContext: async () => {
360
- const { applyDynamicContext } = await import("./dynamic-context-7AJC6AII.js");
360
+ const { applyDynamicContext } = await import("./dynamic-context-YLRA34WJ.js");
361
361
  await applyDynamicContext(options.sessionManager, options.sessionId, agentLlmClient.getModel());
362
362
  },
363
363
  ...options.initialCompacting ? { initialCompacting: true } : {},
@@ -387,4 +387,4 @@ export {
387
387
  runChatTurn,
388
388
  runAgentTurn
389
389
  };
390
- //# sourceMappingURL=chunk-2BARKBWV.js.map
390
+ //# sourceMappingURL=chunk-ABXERHIY.js.map