@agimon-ai/po-workflow 0.0.0-alpha.211 → 0.0.0-alpha.213
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.
|
@@ -12770,7 +12770,10 @@ function unreadable(record, command, result) {
|
|
|
12770
12770
|
* Registry homes come from the workflow store, never from scanning folders.
|
|
12771
12771
|
*/
|
|
12772
12772
|
async function readWorkflowRuns(runtime, options = {}) {
|
|
12773
|
-
if (options.homeDir === void 0) return (await Promise.all((options.locations ?? await workflowRunLocations(runtime)).map((location) => readWorkflowRuns(runtime, {
|
|
12773
|
+
if (options.homeDir === void 0) return (await Promise.all((options.locations ?? await workflowRunLocations(runtime)).map((location) => readWorkflowRuns(runtime, {
|
|
12774
|
+
...location,
|
|
12775
|
+
...options.scope ? { scope: options.scope } : {}
|
|
12776
|
+
})))).flat();
|
|
12774
12777
|
const parser = new require_workflowHost.WorkflowParserService(runtime);
|
|
12775
12778
|
const homeDir = options.homeDir;
|
|
12776
12779
|
const ownerSessionId = options.ownerSessionId ?? workflowHomeOwner(homeDir);
|
|
@@ -12787,10 +12790,12 @@ async function readWorkflowRuns(runtime, options = {}) {
|
|
|
12787
12790
|
plans.set(workflowPath, plan);
|
|
12788
12791
|
return plan;
|
|
12789
12792
|
};
|
|
12793
|
+
const scope = options.scope;
|
|
12790
12794
|
const runs = [];
|
|
12791
12795
|
for (const record of await registry.listRuns()) {
|
|
12792
12796
|
const parsed = parseWorkflowRunRecord(JSON.stringify(record));
|
|
12793
12797
|
if (parsed === void 0) continue;
|
|
12798
|
+
if (scope && !runBelongsToSession(parsed, scope.sessionId) && !(scope.launched && runLaunchedBySession(parsed, scope.sessionId))) continue;
|
|
12794
12799
|
const jobs = foldWorkflowProgress(await registry.readProgress(record.runId), await planFor(parsed.view.workflowPath));
|
|
12795
12800
|
const owner = registry.runRef(record)?.ownerSessionId ?? ownerSessionId;
|
|
12796
12801
|
runs.push({
|
|
@@ -20435,8 +20440,12 @@ function createWorkflowServerRuntime(host, serverHost, runtime, resolveSecrets,
|
|
|
20435
20440
|
const childReports = () => serverScope?.resolve(_agimon_ai_po_core_hubChannel.PO_CHILD_REPORT_CONTRACT);
|
|
20436
20441
|
/** Every registry home the store knows, led by this session's own and those it already serves. */
|
|
20437
20442
|
const knownLocations = () => workflowRunLocations(runtime, [ownHome, ...features.keys()]);
|
|
20438
|
-
|
|
20439
|
-
|
|
20443
|
+
/** With a scope, other sessions' runs are skipped before enrichment; callers still filter what comes back. */
|
|
20444
|
+
const snapshot = async (scope) => {
|
|
20445
|
+
const runs = await readWorkflowRuns(runtime, {
|
|
20446
|
+
locations: await knownLocations(),
|
|
20447
|
+
...scope ? { scope } : {}
|
|
20448
|
+
});
|
|
20440
20449
|
const stale = /* @__PURE__ */ new Map();
|
|
20441
20450
|
for (const home of new Set(runs.filter((run) => run.view.stage === "running").map((run) => run.registryHome ?? ownHome))) for (const record of await featureFor(home).registry.listRuns()) if (record.stale) stale.set(`${home}/${record.workspace}/${record.runKey}`, record.staleReason);
|
|
20442
20451
|
return runs.map((run) => run.view.stage === "running" && stale.has(`${run.registryHome ?? ownHome}/${run.view.workspace}/${run.view.runKey}`) ? {
|
|
@@ -20576,7 +20585,10 @@ function createWorkflowServerRuntime(host, serverHost, runtime, resolveSecrets,
|
|
|
20576
20585
|
const publishRuns = async (executionContext) => {
|
|
20577
20586
|
if (!historyRead) return false;
|
|
20578
20587
|
const revision = ++runsReadRevision;
|
|
20579
|
-
const records = (await snapshot(
|
|
20588
|
+
const records = (await snapshot({
|
|
20589
|
+
sessionId: executionContext.sessionId,
|
|
20590
|
+
launched: true
|
|
20591
|
+
})).filter((run) => runBelongsToSession(run, executionContext.sessionId) || runLaunchedBySession(run, executionContext.sessionId));
|
|
20580
20592
|
if (disposed || revision !== runsReadRevision) return activeRunCount > 0 || pendingCompletions.size > 0;
|
|
20581
20593
|
for (const record of records) {
|
|
20582
20594
|
const view = record.view;
|
|
@@ -21010,7 +21022,10 @@ function createWorkflowServerRuntime(host, serverHost, runtime, resolveSecrets,
|
|
|
21010
21022
|
if (disposed) throw new Error(RUNTIME_DISPOSED_MESSAGE);
|
|
21011
21023
|
if (refusal !== void 0) return textResult(`Error: ${refusal}`, true);
|
|
21012
21024
|
const self = host.context.sessionId;
|
|
21013
|
-
const running = (await snapshot(
|
|
21025
|
+
const running = (await snapshot({
|
|
21026
|
+
sessionId: self,
|
|
21027
|
+
launched: true
|
|
21028
|
+
})).filter((run) => run.view.stage === "running" && run.view.stale !== true && (runBelongsToSession(run, self) || runLaunchedBySession(run, self))).length;
|
|
21014
21029
|
const ceiling = resolveMaxConcurrent(host.context.environment);
|
|
21015
21030
|
if (running >= ceiling) return textResult(`Error: This session is at capacity: ${String(running)}/${String(ceiling)} workflows running.`, true);
|
|
21016
21031
|
const workflowPath = (0, node_path.resolve)(where.cwd, input.workflowPath);
|
|
@@ -21227,7 +21242,10 @@ function createWorkflowServerRuntime(host, serverHost, runtime, resolveSecrets,
|
|
|
21227
21242
|
return ownedControl;
|
|
21228
21243
|
}
|
|
21229
21244
|
if (disposed) throw new Error(RUNTIME_DISPOSED_MESSAGE);
|
|
21230
|
-
const homes = /* @__PURE__ */ new Set([ownHome, ...(await snapshot(
|
|
21245
|
+
const homes = /* @__PURE__ */ new Set([ownHome, ...(await snapshot({
|
|
21246
|
+
sessionId: host.context.sessionId,
|
|
21247
|
+
launched: true
|
|
21248
|
+
})).filter((run) => runBelongsToSession(run, host.context.sessionId) || runLaunchedBySession(run, host.context.sessionId)).map((run) => run.registryHome ?? ownHome)]);
|
|
21231
21249
|
if (disposed) throw new Error(RUNTIME_DISPOSED_MESSAGE);
|
|
21232
21250
|
const currentHome = [...features].find(([, candidate]) => candidate === feature)[0];
|
|
21233
21251
|
homes.add(currentHome);
|
|
@@ -21872,7 +21890,10 @@ function createWorkflowServerRuntime(host, serverHost, runtime, resolveSecrets,
|
|
|
21872
21890
|
resources: [{
|
|
21873
21891
|
name: "workflow-session",
|
|
21874
21892
|
kind: "context",
|
|
21875
|
-
read: async (executionContext) => workflowSession ? workflowSessionBrief(presentWorkflowRuns((await snapshot(
|
|
21893
|
+
read: async (executionContext) => workflowSession ? workflowSessionBrief(presentWorkflowRuns((await snapshot({
|
|
21894
|
+
sessionId: executionContext.sessionId,
|
|
21895
|
+
launched: false
|
|
21896
|
+
})).filter((run) => runBelongsToSession(run, executionContext.sessionId)).map((run) => run.view), Date.now())) : ""
|
|
21876
21897
|
}],
|
|
21877
21898
|
activities: [{
|
|
21878
21899
|
name: SOURCE,
|