veryfront 0.1.924 → 0.1.925
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/esm/cli/commands/workflow/command.d.ts +1 -0
- package/esm/cli/commands/workflow/command.d.ts.map +1 -1
- package/esm/cli/commands/workflow/command.js +41 -16
- package/esm/deno.js +1 -1
- package/esm/src/utils/version-constant.d.ts +1 -1
- package/esm/src/utils/version-constant.js +1 -1
- package/esm/src/workflow/worker/dynamic-run-entrypoint.d.ts.map +1 -1
- package/esm/src/workflow/worker/dynamic-run-entrypoint.js +16 -10
- package/esm/src/workflow/worker/run-entrypoint.d.ts.map +1 -1
- package/esm/src/workflow/worker/run-entrypoint.js +6 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/workflow/command.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/workflow/command.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAKjD,MAAM,WAAW,eAAgB,SAAQ,YAAY;IACnD,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,sBAAsB;IACrC,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,wBAAgB,6BAA6B,CAC3C,MAAM,EAAE,sBAAsB,EAAE,GAC/B,MAAM,EAAE,CAUV;AAuFD,wBAAsB,eAAe,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAyF7E"}
|
|
@@ -2,6 +2,9 @@ import * as dntShim from "../../../_dnt.shims.js";
|
|
|
2
2
|
import { cliLogger } from "../../utils/index.js";
|
|
3
3
|
import { exitProcess } from "../../utils/index.js";
|
|
4
4
|
import { withProjectSourceContext } from "../../shared/project-source-context.js";
|
|
5
|
+
import { agentRegistry } from "../../../src/agent/composition/index.js";
|
|
6
|
+
import { discoverProjectAgentRuntime } from "../../../src/agent/project/agent-runtime.js";
|
|
7
|
+
import { toolRegistry } from "../../../src/tool/registry.js";
|
|
5
8
|
import { sanitizeRunOutputForLogging } from "../../utils/sanitize-run-output.js";
|
|
6
9
|
import { writeRunResultIfConfigured } from "../../utils/write-run-result.js";
|
|
7
10
|
import { getEnv } from "../../../src/platform/index.js";
|
|
@@ -16,18 +19,39 @@ export function formatWorkflowDiscoveryErrors(errors) {
|
|
|
16
19
|
}
|
|
17
20
|
return lines;
|
|
18
21
|
}
|
|
19
|
-
|
|
22
|
+
function formatRuntimeDiscoveryError(error) {
|
|
23
|
+
return {
|
|
24
|
+
filePath: error.file,
|
|
25
|
+
error: error.error.message,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
function withProjectStepRegistries(config) {
|
|
29
|
+
return {
|
|
30
|
+
...config,
|
|
31
|
+
executor: {
|
|
32
|
+
...config.executor,
|
|
33
|
+
stepExecutor: {
|
|
34
|
+
...config.executor?.stepExecutor,
|
|
35
|
+
agentRegistry: config.executor?.stepExecutor?.agentRegistry ?? agentRegistry,
|
|
36
|
+
toolRegistry: config.executor?.stepExecutor?.toolRegistry ?? toolRegistry,
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
async function createWorkflowClient(config) {
|
|
20
42
|
const { createWorkflowClient } = await import("../../../src/workflow/api/workflow-client.js");
|
|
43
|
+
const clientConfig = withProjectStepRegistries(config);
|
|
21
44
|
const redisUrl = getEnv("REDIS_URL")?.trim();
|
|
22
45
|
if (!redisUrl) {
|
|
23
|
-
return createWorkflowClient(
|
|
46
|
+
return createWorkflowClient(clientConfig);
|
|
24
47
|
}
|
|
25
48
|
const { RedisBackend } = await import("../../../src/workflow/backends/redis.js");
|
|
49
|
+
const debug = clientConfig.debug ?? false;
|
|
26
50
|
const backend = new RedisBackend({ url: redisUrl, debug });
|
|
27
51
|
if (backend.initialize) {
|
|
28
52
|
await backend.initialize();
|
|
29
53
|
}
|
|
30
|
-
return createWorkflowClient({
|
|
54
|
+
return createWorkflowClient({ ...clientConfig, backend });
|
|
31
55
|
}
|
|
32
56
|
async function waitForWorkflowExit(client, runId) {
|
|
33
57
|
while (true) {
|
|
@@ -79,37 +103,38 @@ export async function workflowCommand(options) {
|
|
|
79
103
|
return;
|
|
80
104
|
}
|
|
81
105
|
}
|
|
82
|
-
const
|
|
83
|
-
await withProjectSourceContext(
|
|
106
|
+
const projectDir = options.projectDir ?? dntShim.Deno.cwd();
|
|
107
|
+
await withProjectSourceContext(projectDir, async ({ adapter, proxyContext }) => {
|
|
84
108
|
const sourceLabel = proxyContext?.branchRef
|
|
85
109
|
? `branch ${proxyContext.branchRef}`
|
|
86
110
|
: proxyContext
|
|
87
111
|
? "main"
|
|
88
|
-
: `${
|
|
112
|
+
: `${projectDir}/workflows/...`;
|
|
89
113
|
cliLogger.info(`Discovering workflows in ${sourceLabel}`);
|
|
90
|
-
const discovery = await
|
|
91
|
-
projectDir
|
|
114
|
+
const discovery = await discoverProjectAgentRuntime({
|
|
115
|
+
projectDir,
|
|
92
116
|
adapter,
|
|
93
|
-
|
|
94
|
-
debug: options.debug,
|
|
117
|
+
verbose: options.debug,
|
|
95
118
|
});
|
|
119
|
+
const workflows = [...discovery.workflows.values()];
|
|
96
120
|
if (discovery.errors.length > 0 && options.debug) {
|
|
97
|
-
for (const err of discovery.errors) {
|
|
121
|
+
for (const err of discovery.errors.map(formatRuntimeDiscoveryError)) {
|
|
98
122
|
cliLogger.warn(` Warning: ${err.filePath}: ${err.error}`);
|
|
99
123
|
}
|
|
100
124
|
}
|
|
101
|
-
const workflow =
|
|
125
|
+
const workflow = workflows.find((candidate) => candidate.id === workflowId);
|
|
102
126
|
if (!workflow) {
|
|
103
127
|
cliLogger.error(`Workflow "${workflowId}" not found.`);
|
|
104
128
|
if (discovery.errors.length > 0 && !options.debug) {
|
|
105
129
|
cliLogger.warn("Some workflow files could not be loaded:");
|
|
106
|
-
|
|
130
|
+
const errors = discovery.errors.map(formatRuntimeDiscoveryError);
|
|
131
|
+
for (const line of formatWorkflowDiscoveryErrors(errors)) {
|
|
107
132
|
cliLogger.warn(line);
|
|
108
133
|
}
|
|
109
134
|
}
|
|
110
|
-
if (
|
|
135
|
+
if (workflows.length > 0) {
|
|
111
136
|
cliLogger.info("Available workflows:");
|
|
112
|
-
for (const candidate of
|
|
137
|
+
for (const candidate of workflows) {
|
|
113
138
|
cliLogger.info(` - ${candidate.id}`);
|
|
114
139
|
}
|
|
115
140
|
}
|
|
@@ -119,7 +144,7 @@ export async function workflowCommand(options) {
|
|
|
119
144
|
exitProcess(1);
|
|
120
145
|
return;
|
|
121
146
|
}
|
|
122
|
-
const client = await createWorkflowClient(options.debug);
|
|
147
|
+
const client = await createWorkflowClient({ debug: options.debug });
|
|
123
148
|
try {
|
|
124
149
|
client.register(workflow.definition);
|
|
125
150
|
cliLogger.info(`Running workflow: ${workflow.id}`);
|
package/esm/deno.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dynamic-run-entrypoint.d.ts","sourceRoot":"","sources":["../../../../src/src/workflow/worker/dynamic-run-entrypoint.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;
|
|
1
|
+
{"version":3,"file":"dynamic-run-entrypoint.d.ts","sourceRoot":"","sources":["../../../../src/src/workflow/worker/dynamic-run-entrypoint.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AASH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAY5D;;GAEG;AACH,eAAO,MAAM,kBAAkB;;;;;;CAMrB,CAAC;AAEX;;GAEG;AACH,MAAM,WAAW,kCAAkC;IACjD,uCAAuC;IACvC,OAAO,EAAE,eAAe,CAAC;IAEzB,2BAA2B;IAC3B,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,qBAAqB,CACzC,MAAM,EAAE,kCAAkC,GACzC,OAAO,CAAC,MAAM,CAAC,CAmIjB;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,WAAW,yCAAyC;IACxD,4BAA4B;IAC5B,QAAQ,EAAE,MAAM,CAAC;IAEjB,2BAA2B;IAC3B,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,gDAAgD;AAChD,wBAAsB,kCAAkC,CACtD,OAAO,EAAE,yCAAyC,GACjD,OAAO,CAAC,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC,CAchC"}
|
|
@@ -28,7 +28,9 @@ import { logger as baseLogger } from "../../utils/index.js";
|
|
|
28
28
|
import { getEnv } from "../../platform/compat/process.js";
|
|
29
29
|
import { enhanceAdapterWithFS } from "../../platform/adapters/fs/integration.js";
|
|
30
30
|
import { denoAdapter } from "../../platform/adapters/runtime/deno/index.js";
|
|
31
|
-
import {
|
|
31
|
+
import { agentRegistry } from "../../agent/composition/index.js";
|
|
32
|
+
import { discoverProjectAgentRuntime } from "../../agent/project/agent-runtime.js";
|
|
33
|
+
import { toolRegistry } from "../../tool/registry.js";
|
|
32
34
|
import { WorkflowExecutor } from "../executor/workflow-executor.js";
|
|
33
35
|
import { failRunExecution, getFinalRunExitCode, getTenantFromEnv, hydrateRunContextEnv, runWithTenantContext, } from "./shared.js";
|
|
34
36
|
const logger = baseLogger.component("dynamic-workflow-run-entrypoint");
|
|
@@ -100,37 +102,41 @@ export async function runDynamicWorkflowRun(config) {
|
|
|
100
102
|
if (debug) {
|
|
101
103
|
logger.info("FS adapter initialized");
|
|
102
104
|
}
|
|
103
|
-
// Discover workflows
|
|
104
|
-
const discoveryResult = await
|
|
105
|
+
// Discover workflows and the project-local agent/tool registries they may reference.
|
|
106
|
+
const discoveryResult = await discoverProjectAgentRuntime({
|
|
105
107
|
projectDir: "", // Root of project (relative paths with API)
|
|
106
108
|
adapter,
|
|
107
|
-
|
|
108
|
-
debug,
|
|
109
|
+
verbose: debug,
|
|
109
110
|
});
|
|
110
111
|
if (discoveryResult.errors.length > 0 && debug) {
|
|
111
112
|
logger.warn("Some workflow files failed to load:", discoveryResult.errors);
|
|
112
113
|
}
|
|
113
|
-
|
|
114
|
+
const workflows = [...discoveryResult.workflows.values()];
|
|
115
|
+
if (workflows.length === 0) {
|
|
114
116
|
logger.error("No workflows discovered");
|
|
115
117
|
return DYNAMIC_EXIT_CODES.DISCOVERY_FAILED;
|
|
116
118
|
}
|
|
117
119
|
if (debug) {
|
|
118
|
-
logger.info(`[DynamicWorkflowRun] Discovered ${
|
|
120
|
+
logger.info(`[DynamicWorkflowRun] Discovered ${workflows.length} workflows:`, workflows.map((w) => w.id));
|
|
119
121
|
}
|
|
120
122
|
// Find the matching workflow
|
|
121
|
-
const workflow =
|
|
123
|
+
const workflow = workflows.find((w) => w.id === run.workflowId);
|
|
122
124
|
if (!workflow) {
|
|
123
125
|
logger.error(`Workflow not found: ${run.workflowId}`);
|
|
124
|
-
logger.error(`[DynamicWorkflowRun] Available workflows: ${
|
|
126
|
+
logger.error(`[DynamicWorkflowRun] Available workflows: ${workflows.map((w) => w.id).join(", ")}`);
|
|
125
127
|
return DYNAMIC_EXIT_CODES.NOT_FOUND;
|
|
126
128
|
}
|
|
127
129
|
if (debug) {
|
|
128
|
-
logger.info(`Found workflow "${workflow.id}"
|
|
130
|
+
logger.info(`Found workflow "${workflow.id}"`);
|
|
129
131
|
}
|
|
130
132
|
// Create executor and register the workflow
|
|
131
133
|
const executor = new WorkflowExecutor({
|
|
132
134
|
backend,
|
|
133
135
|
debug,
|
|
136
|
+
stepExecutor: {
|
|
137
|
+
agentRegistry,
|
|
138
|
+
toolRegistry,
|
|
139
|
+
},
|
|
134
140
|
});
|
|
135
141
|
executor.register(workflow.definition);
|
|
136
142
|
// Execute the workflow
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-entrypoint.d.ts","sourceRoot":"","sources":["../../../../src/src/workflow/worker/run-entrypoint.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;
|
|
1
|
+
{"version":3,"file":"run-entrypoint.d.ts","sourceRoot":"","sources":["../../../../src/src/workflow/worker/run-entrypoint.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAMH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAWtD;;GAEG;AACH,MAAM,WAAW,2BAA2B;IAC1C,uCAAuC;IACvC,OAAO,EAAE,eAAe,CAAC;IAEzB,wBAAwB;IACxB,QAAQ,EAAE,gBAAgB,CAAC;IAE3B,2BAA2B;IAC3B,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED;;GAEG;AACH,eAAO,MAAM,UAAU;;;;;CAKb,CAAC;AAEX;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAsB,cAAc,CAAC,MAAM,EAAE,2BAA2B,GAAG,OAAO,CAAC,MAAM,CAAC,CAgEzF;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,WAAW,kCAAkC;IACjD,4BAA4B;IAC5B,QAAQ,EAAE,MAAM,CAAC;IAEjB,4BAA4B;IAC5B,SAAS,EAAE,KAAK,CAAC;QAAE,UAAU,EAAE,kBAAkB,CAAA;KAAE,CAAC,CAAC;IAErD,2BAA2B;IAC3B,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,wCAAwC;AACxC,wBAAsB,2BAA2B,CAC/C,OAAO,EAAE,kCAAkC,GAC1C,OAAO,CAAC,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC,CA8BhC"}
|
|
@@ -21,6 +21,8 @@
|
|
|
21
21
|
*/
|
|
22
22
|
import { logger as baseLogger } from "../../utils/index.js";
|
|
23
23
|
import { getEnv } from "../../platform/compat/process.js";
|
|
24
|
+
import { agentRegistry } from "../../agent/composition/index.js";
|
|
25
|
+
import { toolRegistry } from "../../tool/registry.js";
|
|
24
26
|
import { failRunExecution, getFinalRunExitCode, getTenantFromEnv, hydrateRunContextEnv, runWithTenantContext, } from "./shared.js";
|
|
25
27
|
const logger = baseLogger.component("workflow-run-entrypoint");
|
|
26
28
|
/**
|
|
@@ -122,6 +124,10 @@ export async function createWorkflowRunEntrypoint(options) {
|
|
|
122
124
|
const executor = new WorkflowExecutor({
|
|
123
125
|
backend,
|
|
124
126
|
debug: options.debug,
|
|
127
|
+
stepExecutor: {
|
|
128
|
+
agentRegistry,
|
|
129
|
+
toolRegistry,
|
|
130
|
+
},
|
|
125
131
|
});
|
|
126
132
|
// Register workflows
|
|
127
133
|
for (const wf of options.workflows) {
|