@agimon-ai/doompi-workflow 0.0.1-alpha.85 → 0.0.1-alpha.86

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.
@@ -501,7 +501,8 @@ function callResult(value) {
501
501
  });
502
502
  return {
503
503
  content,
504
- details: value
504
+ details: value,
505
+ ...typeof value === "object" && value !== null && "isError" in value && value.isError === true ? { isError: true } : {}
505
506
  };
506
507
  }
507
508
  function createWorkflowServerRuntime(host, serverHost) {
@@ -534,6 +535,13 @@ function createWorkflowServerRuntime(host, serverHost) {
534
535
  return activeItems.length > 0;
535
536
  };
536
537
  const feature = (0, _agimon_ai_workflow_mcp.createEmbeddedWorkflowFeature)();
538
+ const launch = (parameters) => feature.runTool.execute({
539
+ ...parameters,
540
+ env: {
541
+ ...parameters.env,
542
+ [PI_SESSION_ENV]: host.context.sessionId
543
+ }
544
+ });
537
545
  let control;
538
546
  let controlDisposers = [];
539
547
  const disposeControl = () => {
@@ -746,7 +754,7 @@ function createWorkflowServerRuntime(host, serverHost) {
746
754
  executionMode: "serial",
747
755
  async execute(_toolCallId, parameters, signal) {
748
756
  signal?.throwIfAborted();
749
- return callResult(await feature.runTool.execute(parameters));
757
+ return callResult(await launch(parameters));
750
758
  }
751
759
  },
752
760
  {
@@ -819,16 +827,40 @@ function createWorkflowServerRuntime(host, serverHost) {
819
827
  });
820
828
  return;
821
829
  }
822
- const rendered = callResult(await feature.runTool.execute({
823
- workflowPath: parsed.workflow,
824
- ...parsed.runner === void 0 ? {} : { runner: parsed.runner },
825
- ...Object.keys(parsed.inputs).length === 0 ? {} : { inputs: parsed.inputs },
826
- ...parsed.prompt === void 0 ? {} : { prompt: parsed.prompt }
827
- })).content.find((entry) => entry.type === "text");
828
- await execution.client.notify({
829
- body: rendered?.type === "text" ? rendered.text : "Workflow launch requested.",
830
- level: "info"
831
- });
830
+ try {
831
+ const entry = require_workflowLaunchCommand.resolveWorkflowEntry(await catalogReader.read(execution.cwd), parsed.workflow);
832
+ if (!entry || entry.error) {
833
+ await execution.client.notify({
834
+ body: entry?.error ?? `Workflow not found: ${parsed.workflow}`,
835
+ level: "error"
836
+ });
837
+ return;
838
+ }
839
+ const problems = require_workflowLaunchCommand.validateWorkflowLaunch(entry, parsed);
840
+ if (problems.length > 0) {
841
+ await execution.client.notify({
842
+ body: problems.join("\n"),
843
+ level: "error"
844
+ });
845
+ return;
846
+ }
847
+ const result = callResult(await launch({
848
+ workflowPath: entry.path,
849
+ ...parsed.runner === void 0 ? {} : { runner: parsed.runner },
850
+ ...Object.keys(parsed.inputs).length === 0 ? {} : { inputs: parsed.inputs },
851
+ ...parsed.prompt === void 0 ? {} : { prompt: parsed.prompt }
852
+ }));
853
+ const rendered = result.content.find((item) => item.type === "text");
854
+ await execution.client.notify({
855
+ body: rendered?.type === "text" ? rendered.text : "Workflow launch requested.",
856
+ level: result.isError ? "error" : "info"
857
+ });
858
+ } catch (error) {
859
+ await execution.client.notify({
860
+ body: String(error),
861
+ level: "error"
862
+ });
863
+ }
832
864
  }
833
865
  }],
834
866
  onDispose() {