@agimon-ai/doompi-workflow 0.0.1-alpha.115 → 0.0.1-alpha.117

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.
@@ -2081,7 +2081,7 @@ function workflowSessionBrief(runs) {
2081
2081
  const failure = run.stage === "error" ? `; ${run.failedJob === void 0 ? "" : `job '${run.failedJob}' `}failed: ${run.errorMessage ?? "no cause recorded"}` : "";
2082
2082
  return `- ${run.displayName} (runKey ${run.runKey}, workspace ${run.workspace}): ${runState(run)}${where === "" ? "" : ` at ${where}`}${failure}`;
2083
2083
  }),
2084
- "When the user asks: use workflow_run status with the runKey and workspace for progress, workflow_tools recovery-evidence to read a failure, and load the workflow-recovery skill before workflow_tools recover. Recover, pause, resume or stop a run only when the user asks."
2084
+ "When the user or launcher session asks: use workflow_run status with the runKey and workspace for progress, workflow_tools recovery-evidence to read a failure, and load the workflow-recovery skill before workflow_tools recover. Recover, pause, resume or stop a run only when the user asks or the launcher explicitly delegates it through intercom."
2085
2085
  ].join("\n");
2086
2086
  }
2087
2087
  function failureNotice(run) {
@@ -2396,13 +2396,18 @@ function createWorkflowServerRuntime(host, serverHost) {
2396
2396
  return active;
2397
2397
  };
2398
2398
  let runsTimer;
2399
+ let runsAfter;
2399
2400
  /** Publishes the runs once for a burst of job and step events, which a fix loop can produce by the dozen. */
2400
2401
  const publishRunsSoon = (executionContext, after) => {
2402
+ if (after !== void 0) runsAfter = after;
2401
2403
  if (runsTimer !== void 0) return;
2402
2404
  runsTimer = setTimeout(() => {
2403
2405
  runsTimer = void 0;
2406
+ const done = runsAfter;
2407
+ runsAfter = void 0;
2404
2408
  try {
2405
- after?.(publishRuns(executionContext));
2409
+ const active = publishRuns(executionContext);
2410
+ done?.(active);
2406
2411
  } catch (error) {
2407
2412
  telemetry.recordWarning("doom_workflow.publish_failed", error);
2408
2413
  }
@@ -2562,7 +2567,7 @@ function createWorkflowServerRuntime(host, serverHost) {
2562
2567
  await sessionService.close(child).catch(reportLifecycleFailure);
2563
2568
  return result;
2564
2569
  }
2565
- return textResult(`${result.content.map((item) => item.text).join("\n")}\nRuns in workflow session "${name}" (${child}), nested under this session. You will be told here when it finishes; troubleshoot and recover it there.`);
2570
+ return textResult(`${result.content.map((item) => item.text).join("\n")}\nRuns in workflow session "${name}" (${child}), nested under this session. You will be told here when it finishes; troubleshoot and recover it there, or delegate to its owner with intercom send to "${child}".`);
2566
2571
  } catch (error) {
2567
2572
  if (child !== void 0) await sessionService.close(child).catch(reportLifecycleFailure);
2568
2573
  return textResult(`Error: ${errorMessage(error)}`, true);
@@ -3055,6 +3060,8 @@ function createWorkflowServerRuntime(host, serverHost) {
3055
3060
  stopReleaseRequests?.();
3056
3061
  stopPeerReady?.();
3057
3062
  if (runsTimer !== void 0) clearTimeout(runsTimer);
3063
+ runsTimer = void 0;
3064
+ runsAfter = void 0;
3058
3065
  await launcher.dispose();
3059
3066
  runProvider?.dispose();
3060
3067
  runProvider = void 0;