@agimon-ai/doompi-workflow 0.0.1-alpha.85 → 0.0.1-alpha.87
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as parseWorkflowLaunchCommand } from "../workflowLaunchCommand-Bhr-PvdD.mjs";
|
|
1
|
+
import { i as validateWorkflowLaunch, n as parseWorkflowLaunchCommand, r as resolveWorkflowEntry } from "../workflowLaunchCommand-Bhr-PvdD.mjs";
|
|
2
2
|
import { n as registerRunProvider, r as readWorkflowSkill, t as createWorkflowTerminalService } from "../workflowTerminal-Bj4KKpoA.mjs";
|
|
3
3
|
import { composeRootHooks, defineChannel, defineRoot, defineRoutedContribution } from "@agimon-ai/doompi-core/extensionFile";
|
|
4
4
|
import fs, { statSync } from "node:fs";
|
|
@@ -494,7 +494,8 @@ function callResult(value) {
|
|
|
494
494
|
});
|
|
495
495
|
return {
|
|
496
496
|
content,
|
|
497
|
-
details: value
|
|
497
|
+
details: value,
|
|
498
|
+
...typeof value === "object" && value !== null && "isError" in value && value.isError === true ? { isError: true } : {}
|
|
498
499
|
};
|
|
499
500
|
}
|
|
500
501
|
function createWorkflowServerRuntime(host, serverHost) {
|
|
@@ -527,6 +528,13 @@ function createWorkflowServerRuntime(host, serverHost) {
|
|
|
527
528
|
return activeItems.length > 0;
|
|
528
529
|
};
|
|
529
530
|
const feature = createEmbeddedWorkflowFeature();
|
|
531
|
+
const launch = (parameters) => feature.runTool.execute({
|
|
532
|
+
...parameters,
|
|
533
|
+
env: {
|
|
534
|
+
...parameters.env,
|
|
535
|
+
[PI_SESSION_ENV]: host.context.sessionId
|
|
536
|
+
}
|
|
537
|
+
});
|
|
530
538
|
let control;
|
|
531
539
|
let controlDisposers = [];
|
|
532
540
|
const disposeControl = () => {
|
|
@@ -739,7 +747,7 @@ function createWorkflowServerRuntime(host, serverHost) {
|
|
|
739
747
|
executionMode: "serial",
|
|
740
748
|
async execute(_toolCallId, parameters, signal) {
|
|
741
749
|
signal?.throwIfAborted();
|
|
742
|
-
return callResult(await
|
|
750
|
+
return callResult(await launch(parameters));
|
|
743
751
|
}
|
|
744
752
|
},
|
|
745
753
|
{
|
|
@@ -812,16 +820,40 @@ function createWorkflowServerRuntime(host, serverHost) {
|
|
|
812
820
|
});
|
|
813
821
|
return;
|
|
814
822
|
}
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
823
|
+
try {
|
|
824
|
+
const entry = resolveWorkflowEntry(await catalogReader.read(execution.cwd), parsed.workflow);
|
|
825
|
+
if (!entry || entry.error) {
|
|
826
|
+
await execution.client.notify({
|
|
827
|
+
body: entry?.error ?? `Workflow not found: ${parsed.workflow}`,
|
|
828
|
+
level: "error"
|
|
829
|
+
});
|
|
830
|
+
return;
|
|
831
|
+
}
|
|
832
|
+
const problems = validateWorkflowLaunch(entry, parsed);
|
|
833
|
+
if (problems.length > 0) {
|
|
834
|
+
await execution.client.notify({
|
|
835
|
+
body: problems.join("\n"),
|
|
836
|
+
level: "error"
|
|
837
|
+
});
|
|
838
|
+
return;
|
|
839
|
+
}
|
|
840
|
+
const result = callResult(await launch({
|
|
841
|
+
workflowPath: entry.path,
|
|
842
|
+
...parsed.runner === void 0 ? {} : { runner: parsed.runner },
|
|
843
|
+
...Object.keys(parsed.inputs).length === 0 ? {} : { inputs: parsed.inputs },
|
|
844
|
+
...parsed.prompt === void 0 ? {} : { prompt: parsed.prompt }
|
|
845
|
+
}));
|
|
846
|
+
const rendered = result.content.find((item) => item.type === "text");
|
|
847
|
+
await execution.client.notify({
|
|
848
|
+
body: rendered?.type === "text" ? rendered.text : "Workflow launch requested.",
|
|
849
|
+
level: result.isError ? "error" : "info"
|
|
850
|
+
});
|
|
851
|
+
} catch (error) {
|
|
852
|
+
await execution.client.notify({
|
|
853
|
+
body: String(error),
|
|
854
|
+
level: "error"
|
|
855
|
+
});
|
|
856
|
+
}
|
|
825
857
|
}
|
|
826
858
|
}],
|
|
827
859
|
onDispose() {
|