@agimon-ai/po-workflow 0.0.0-alpha.197 → 0.0.0-alpha.199
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.
- package/dist/extensions/server.cjs +37 -20
- package/dist/extensions/server.cjs.map +1 -1
- package/dist/extensions/server.mjs +37 -20
- package/dist/extensions/server.mjs.map +1 -1
- package/dist/{index-BN2c6ftU.d.mts → index--C-zOl9A.d.mts} +8 -1
- package/dist/{index-BN2c6ftU.d.mts.map → index--C-zOl9A.d.mts.map} +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/po-runtime-identity.json +1 -1
- package/dist/workflowHost.d.mts +1 -1
- package/package.json +10 -10
- package/src/prompts/codemode-how-to-workflow/SKILL.md +1 -1
|
@@ -4229,6 +4229,11 @@ async function createWorkflowTracker(config) {
|
|
|
4229
4229
|
name: "dynamicWorkflow",
|
|
4230
4230
|
summary: "Tracked Mastra workflows: then, parallel, branch and bounded foreach, with live child-agent transcripts in Activity.",
|
|
4231
4231
|
declarations: dynamicWorkflowDeclarations,
|
|
4232
|
+
sync: [
|
|
4233
|
+
"createStep",
|
|
4234
|
+
"createWorkflow",
|
|
4235
|
+
"z"
|
|
4236
|
+
],
|
|
4232
4237
|
bind(run) {
|
|
4233
4238
|
if (run.sessionId !== config.sessionId) throw new Error("dynamicWorkflow belongs to another session.");
|
|
4234
4239
|
const binding = new AbortController();
|
|
@@ -11533,14 +11538,14 @@ function defaultCatalogDeps(runtime) {
|
|
|
11533
11538
|
const parser = new require_workflowHost.WorkflowParserService(runtime);
|
|
11534
11539
|
return {
|
|
11535
11540
|
list: (directory) => readWorkflowCatalog(directory, runtime),
|
|
11536
|
-
summarize: async (workflowPath) => {
|
|
11537
|
-
const detail = await summarizeWorkflow(workflowPath, (target) => parser.parseWorkflowFile(target));
|
|
11541
|
+
summarize: async (workflowPath, definition) => {
|
|
11542
|
+
const detail = await summarizeWorkflow(workflowPath, async (target) => definition ? structuredClone(definition) : parser.parseWorkflowFile(target));
|
|
11538
11543
|
if (detail.error !== void 0) return detail;
|
|
11539
11544
|
const errors = (await diagnoseWorkflow(workflowPath, {
|
|
11540
11545
|
runtime,
|
|
11541
11546
|
runConfigKeys: PO_RUN_CONFIG_KEYS,
|
|
11542
11547
|
renamedRunConfigKeys: RENAMED_RUN_CONFIG_KEYS
|
|
11543
|
-
})).diagnostics.filter((diagnostic) => diagnostic.level === "error");
|
|
11548
|
+
}, definition)).diagnostics.filter((diagnostic) => diagnostic.level === "error");
|
|
11544
11549
|
if (errors.length === 0) return detail;
|
|
11545
11550
|
return {
|
|
11546
11551
|
...detail,
|
|
@@ -15964,9 +15969,10 @@ var RunWorkflowService = class {
|
|
|
15964
15969
|
* Execute the workflow after signal handlers are installed.
|
|
15965
15970
|
*/
|
|
15966
15971
|
async prepareAllocation(input) {
|
|
15967
|
-
const saved = input.recovery?.definition;
|
|
15972
|
+
const saved = input.recovery?.definition ?? input.definition;
|
|
15973
|
+
const pinned = input.recovery === void 0 && input.definition !== void 0;
|
|
15968
15974
|
const path = (0, node_path.resolve)(this.runtime.cwd, input.workflowPath);
|
|
15969
|
-
return this.admitAllocationForWorkflow(input, saved && (input.helpActive?.() !== true || !await this.pathExists(path)) ? structuredClone(saved) : await this.parser.parseWorkflowFile(path));
|
|
15975
|
+
return this.admitAllocationForWorkflow(input, saved && (pinned || input.helpActive?.() !== true || !await this.pathExists(path)) ? structuredClone(saved) : await this.parser.parseWorkflowFile(path));
|
|
15970
15976
|
}
|
|
15971
15977
|
async admitAllocationForWorkflow(input, workflow) {
|
|
15972
15978
|
const expected = input.allocation ?? input.admission?.allocation;
|
|
@@ -15997,9 +16003,10 @@ var RunWorkflowService = class {
|
|
|
15997
16003
|
}
|
|
15998
16004
|
async executeWorkflow(input, dryRun, continueOnError) {
|
|
15999
16005
|
const workflowPath = (0, node_path.resolve)(this.runtime.cwd, input.workflowPath);
|
|
16000
|
-
let saved = input.recovery?.definition;
|
|
16006
|
+
let saved = input.recovery?.definition ?? input.definition;
|
|
16007
|
+
const pinned = input.recovery === void 0 && input.definition !== void 0;
|
|
16001
16008
|
const readDefinition = async (path) => {
|
|
16002
|
-
if (saved && (input.helpActive?.() !== true || !await this.pathExists(path))) return structuredClone(saved);
|
|
16009
|
+
if (saved && (pinned || input.helpActive?.() !== true || !await this.pathExists(path))) return structuredClone(saved);
|
|
16003
16010
|
const parsed = await this.parser.parseWorkflowFile(path);
|
|
16004
16011
|
if (saved) saved = structuredClone(parsed);
|
|
16005
16012
|
return parsed;
|
|
@@ -19440,6 +19447,16 @@ function createWorkflowServerRuntime(host, serverHost, runtime, resolveSecrets,
|
|
|
19440
19447
|
if (source === void 0) throw new Error(WORKFLOW_SOURCE_UNAVAILABLE);
|
|
19441
19448
|
return source;
|
|
19442
19449
|
};
|
|
19450
|
+
/**
|
|
19451
|
+
* The launching session's own copy of a definition. A session in the workspace's checkout reads the registered
|
|
19452
|
+
* source; a session in another checkout of the repository (a worktree) reads its own checkout instead.
|
|
19453
|
+
*/
|
|
19454
|
+
const definitionPath = (definition) => {
|
|
19455
|
+
const source = sourceNamed(definition.source);
|
|
19456
|
+
const fromSession = (0, node_path.relative)(host.context.repoRoot, source.directory);
|
|
19457
|
+
const elsewhere = source.source === REPO_SOURCE && (fromSession.startsWith("..") || (0, node_path.isAbsolute)(fromSession));
|
|
19458
|
+
return (0, node_path.resolve)(elsewhere ? host.context.cwd : source.directory, definition.key);
|
|
19459
|
+
};
|
|
19443
19460
|
const workflowRuns = {
|
|
19444
19461
|
async readConfig(id) {
|
|
19445
19462
|
if (disposed) return void 0;
|
|
@@ -19847,10 +19864,10 @@ function createWorkflowServerRuntime(host, serverHost, runtime, resolveSecrets,
|
|
|
19847
19864
|
const stored = require_contract.librarySourceOf(workflowPath, runtime.library);
|
|
19848
19865
|
const inside = stored ? require_contract.workflowDefinitionRef(workflowPath, where.repoRoot, runtime.library).key : (0, node_path.relative)(where.repoRoot, workflowPath);
|
|
19849
19866
|
if (!stored && (inside.startsWith("..") || (0, node_path.isAbsolute)(inside))) return `Workflow ${input.workflowPath} is outside this session's repository, so it cannot be launched here.`;
|
|
19850
|
-
const detail = await catalogDeps.summarize(workflowPath);
|
|
19867
|
+
const detail = await catalogDeps.summarize(workflowPath, input.definition);
|
|
19851
19868
|
if (detail.error !== void 0) return needsFixingNotice(inside, detail.error);
|
|
19852
19869
|
if (runtime.workflowHost.platform === "edge") {
|
|
19853
|
-
const refusal = cloudWorkflowLaunchRefusal(await feature.parser.parseWorkflowFile(workflowPath), input);
|
|
19870
|
+
const refusal = cloudWorkflowLaunchRefusal(input.definition ?? await feature.parser.parseWorkflowFile(workflowPath), input);
|
|
19854
19871
|
if (refusal !== void 0) return refusal;
|
|
19855
19872
|
}
|
|
19856
19873
|
const requirements = preparing ? {
|
|
@@ -20389,13 +20406,10 @@ function createWorkflowServerRuntime(host, serverHost, runtime, resolveSecrets,
|
|
|
20389
20406
|
const admissionInput = async (request) => {
|
|
20390
20407
|
if (request.kind === "launch") {
|
|
20391
20408
|
if (!typebox_value.Value.Check(_agimon_ai_po_core_workflow.PoWorkflowDefinitionRefSchema, request.definition)) throw new Error(INVALID_WORKFLOW_REFERENCE);
|
|
20392
|
-
const
|
|
20393
|
-
const { policy: _policy, targetSessionId, allocation: _allocation, ...overrides } = request.overrides ?? {};
|
|
20394
|
-
const directory = targetSessionId === void 0 || source.source !== REPO_SOURCE ? source.directory : publicServices?.owner(targetSessionId)?.location.repoRoot;
|
|
20395
|
-
if (directory === void 0) throw new Error("Workflow target session is unavailable.");
|
|
20409
|
+
const { policy: _policy, targetSessionId: _target, allocation: _allocation, ...overrides } = request.overrides ?? {};
|
|
20396
20410
|
return feature.runTool.getInputSchema().parse({
|
|
20397
20411
|
...overrides,
|
|
20398
|
-
workflowPath: (
|
|
20412
|
+
workflowPath: definitionPath(request.definition)
|
|
20399
20413
|
});
|
|
20400
20414
|
}
|
|
20401
20415
|
if (request.kind !== "recover") throw new Error("Invalid workflow admission request.");
|
|
@@ -20418,7 +20432,7 @@ function createWorkflowServerRuntime(host, serverHost, runtime, resolveSecrets,
|
|
|
20418
20432
|
warnings: [],
|
|
20419
20433
|
deferred: []
|
|
20420
20434
|
};
|
|
20421
|
-
const where = owner?.location ?? host.context;
|
|
20435
|
+
const where = request.kind === "launch" && request.definition?.source === REPO_SOURCE ? host.context : owner?.location ?? host.context;
|
|
20422
20436
|
let input;
|
|
20423
20437
|
try {
|
|
20424
20438
|
input = await admissionInput(request);
|
|
@@ -20474,10 +20488,9 @@ function createWorkflowServerRuntime(host, serverHost, runtime, resolveSecrets,
|
|
|
20474
20488
|
async requirements(definition, options = {}) {
|
|
20475
20489
|
assertAvailable();
|
|
20476
20490
|
if (!typebox_value.Value.Check(_agimon_ai_po_core_workflow.PoWorkflowDefinitionRefSchema, definition)) throw new Error(INVALID_WORKFLOW_REFERENCE);
|
|
20477
|
-
const source = sourceNamed(definition.source);
|
|
20478
20491
|
return operations.requirements({
|
|
20479
20492
|
...options,
|
|
20480
|
-
workflowPath: (
|
|
20493
|
+
workflowPath: definitionPath(definition)
|
|
20481
20494
|
}, host.context.cwd, void 0, definition);
|
|
20482
20495
|
},
|
|
20483
20496
|
registerPolicy(coordinator, callback, options) {
|
|
@@ -20521,7 +20534,12 @@ function createWorkflowServerRuntime(host, serverHost, runtime, resolveSecrets,
|
|
|
20521
20534
|
const owner = publicServices?.owner(ownerId);
|
|
20522
20535
|
if (!owner) throw new Error("Workflow launch owner is unavailable; admission remains pending.");
|
|
20523
20536
|
watchOwner(ownerId);
|
|
20524
|
-
|
|
20537
|
+
const pinned = request.kind === "launch" && request.definition.source === REPO_SOURCE ? {
|
|
20538
|
+
...input,
|
|
20539
|
+
workflowPath: (0, node_path.resolve)(owner.location.repoRoot, request.definition.key),
|
|
20540
|
+
definition: await feature.parser.parseWorkflowFile(input.workflowPath)
|
|
20541
|
+
} : input;
|
|
20542
|
+
await owner.launch(pinned, {
|
|
20525
20543
|
...admission,
|
|
20526
20544
|
ownerSessionId: ownerId
|
|
20527
20545
|
});
|
|
@@ -20697,10 +20715,9 @@ function createWorkflowServerRuntime(host, serverHost, runtime, resolveSecrets,
|
|
|
20697
20715
|
scope.provide(_agimon_ai_po_core_workflow.PO_WORKFLOW_LAUNCH_SERVICE, { async launch(definition, overrides = {}) {
|
|
20698
20716
|
await waitForReadiness();
|
|
20699
20717
|
if (!typebox_value.Value.Check(_agimon_ai_po_core_workflow.PoWorkflowDefinitionRefSchema, definition)) throw new Error(INVALID_WORKFLOW_REFERENCE);
|
|
20700
|
-
const source = sourceNamed(definition.source);
|
|
20701
20718
|
const result = await launch({
|
|
20702
20719
|
...overrides,
|
|
20703
|
-
workflowPath: (
|
|
20720
|
+
workflowPath: definitionPath(definition),
|
|
20704
20721
|
env: {
|
|
20705
20722
|
...overrides.env,
|
|
20706
20723
|
[PUBLIC_LAUNCH_ENV]: PUBLIC_LAUNCH_ENABLED
|