veryfront 0.1.75 → 0.1.77
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/README.md +2 -0
- package/esm/cli/commands/files/command.d.ts +3 -3
- package/esm/cli/commands/pull/command.js +2 -2
- package/esm/cli/commands/task/command.d.ts.map +1 -1
- package/esm/cli/commands/task/command.js +57 -51
- package/esm/cli/commands/workflow/command-help.d.ts +3 -0
- package/esm/cli/commands/workflow/command-help.d.ts.map +1 -0
- package/esm/cli/commands/workflow/command-help.js +19 -0
- package/esm/cli/commands/workflow/command.d.ts +5 -0
- package/esm/cli/commands/workflow/command.d.ts.map +1 -0
- package/esm/cli/commands/workflow/command.js +119 -0
- package/esm/cli/commands/workflow/handler.d.ts +28 -0
- package/esm/cli/commands/workflow/handler.d.ts.map +1 -0
- package/esm/cli/commands/workflow/handler.js +19 -0
- package/esm/cli/help/command-definitions.d.ts.map +1 -1
- package/esm/cli/help/command-definitions.js +2 -0
- package/esm/cli/router.d.ts.map +1 -1
- package/esm/cli/router.js +2 -0
- package/esm/cli/shared/project-source-context.d.ts +18 -0
- package/esm/cli/shared/project-source-context.d.ts.map +1 -0
- package/esm/cli/shared/project-source-context.js +52 -0
- package/esm/deno.d.ts +6 -0
- package/esm/deno.js +12 -6
- package/esm/src/data/server-data-fetcher.d.ts.map +1 -1
- package/esm/src/data/server-data-fetcher.js +17 -1
- package/esm/src/jobs/index.d.ts +34 -0
- package/esm/src/jobs/index.d.ts.map +1 -0
- package/esm/src/jobs/index.js +33 -0
- package/esm/src/jobs/jobs-client.d.ts +134 -0
- package/esm/src/jobs/jobs-client.d.ts.map +1 -0
- package/esm/src/jobs/jobs-client.js +218 -0
- package/esm/src/jobs/schemas.d.ts +1304 -0
- package/esm/src/jobs/schemas.d.ts.map +1 -0
- package/esm/src/jobs/schemas.js +159 -0
- package/esm/src/platform/adapters/veryfront-api-client/operations.d.ts +3 -3
- package/esm/src/platform/adapters/veryfront-api-client/operations.d.ts.map +1 -1
- package/esm/src/platform/adapters/veryfront-api-client/operations.js +12 -10
- package/esm/src/platform/adapters/veryfront-api-client/retry-handler.d.ts +4 -0
- package/esm/src/platform/adapters/veryfront-api-client/retry-handler.d.ts.map +1 -1
- package/esm/src/platform/adapters/veryfront-api-client/retry-handler.js +12 -6
- package/esm/src/platform/adapters/veryfront-api-client/schemas/api.schema.d.ts +4 -4
- package/esm/src/platform/adapters/veryfront-api-client/schemas/api.schema.js +4 -4
- package/esm/src/platform/index.d.ts +1 -0
- package/esm/src/platform/index.d.ts.map +1 -1
- package/esm/src/platform/index.js +1 -0
- package/esm/src/proxy/handler.d.ts.map +1 -1
- package/esm/src/proxy/handler.js +21 -21
- package/esm/src/routing/api/route-executor.d.ts.map +1 -1
- package/esm/src/routing/api/route-executor.js +30 -3
- package/esm/src/security/deno-permissions.d.ts +1 -1
- package/esm/src/security/deno-permissions.d.ts.map +1 -1
- package/esm/src/security/deno-permissions.js +2 -1
- package/esm/src/security/sandbox/project-worker.d.ts.map +1 -1
- package/esm/src/security/sandbox/project-worker.js +2 -2
- package/esm/src/security/sandbox/worker-permissions.d.ts.map +1 -1
- package/esm/src/security/sandbox/worker-permissions.js +23 -20
- package/esm/src/security/sandbox/worker-pool.d.ts.map +1 -1
- package/esm/src/security/sandbox/worker-pool.js +17 -14
- package/esm/src/security/sandbox/worker-types.d.ts +2 -0
- package/esm/src/security/sandbox/worker-types.d.ts.map +1 -1
- package/esm/src/security/sandbox/worker-types.js +2 -0
- package/esm/src/task/types.d.ts +6 -0
- package/esm/src/task/types.d.ts.map +1 -1
- package/package.json +5 -1
- package/src/cli/commands/pull/command.ts +3 -3
- package/src/cli/commands/task/command.ts +66 -57
- package/src/cli/commands/workflow/command-help.ts +21 -0
- package/src/cli/commands/workflow/command.ts +152 -0
- package/src/cli/commands/workflow/handler.ts +25 -0
- package/src/cli/help/command-definitions.ts +2 -0
- package/src/cli/router.ts +2 -0
- package/src/cli/shared/project-source-context.ts +96 -0
- package/src/deno.js +12 -6
- package/src/src/data/server-data-fetcher.ts +30 -2
- package/src/src/jobs/index.ts +85 -0
- package/src/src/jobs/jobs-client.ts +503 -0
- package/src/src/jobs/schemas.ts +202 -0
- package/src/src/platform/adapters/veryfront-api-client/operations.ts +14 -14
- package/src/src/platform/adapters/veryfront-api-client/retry-handler.ts +15 -6
- package/src/src/platform/adapters/veryfront-api-client/schemas/api.schema.ts +4 -4
- package/src/src/platform/index.ts +1 -0
- package/src/src/proxy/handler.ts +27 -19
- package/src/src/routing/api/route-executor.ts +43 -7
- package/src/src/security/deno-permissions.ts +2 -1
- package/src/src/security/sandbox/project-worker.ts +2 -2
- package/src/src/security/sandbox/worker-permissions.ts +22 -19
- package/src/src/security/sandbox/worker-pool.ts +21 -13
- package/src/src/security/sandbox/worker-types.ts +3 -0
- package/src/src/task/types.ts +6 -0
package/README.md
CHANGED
|
@@ -18,6 +18,8 @@ Purpose-built for TypeScript and React, Veryfront gives you everything you need
|
|
|
18
18
|
|
|
19
19
|
- [**Workflows**](https://veryfront.com/docs/code/guides/workflows) — Orchestrate multi-step AI pipelines with branching, parallelism, and human-in-the-loop approval gates.
|
|
20
20
|
|
|
21
|
+
- [**Jobs & Cron Jobs**](https://veryfront.com/docs/code/guides/jobs) — Run durable project-scoped background work now or on a schedule through the Veryfront platform.
|
|
22
|
+
|
|
21
23
|
- [**Multi-Agent**](https://veryfront.com/docs/code/guides/multi-agent) — Compose agents that delegate to each other as tools for complex, coordinated tasks.
|
|
22
24
|
|
|
23
25
|
- [**Memory & Streaming**](https://veryfront.com/docs/code/guides/memory-and-streaming) — Give agents conversation history and streaming responses. Built-in chat UI components for React.
|
|
@@ -31,8 +31,8 @@ declare const FilesGetArgsSchema: z.ZodObject<{
|
|
|
31
31
|
quiet: z.ZodDefault<z.ZodBoolean>;
|
|
32
32
|
}, "strip", z.ZodTypeAny, {
|
|
33
33
|
json: boolean;
|
|
34
|
-
quiet: boolean;
|
|
35
34
|
remotePath: string;
|
|
35
|
+
quiet: boolean;
|
|
36
36
|
projectSlug?: string | undefined;
|
|
37
37
|
projectDir?: string | undefined;
|
|
38
38
|
output?: string | undefined;
|
|
@@ -54,8 +54,8 @@ declare const FilesPutArgsSchema: z.ZodObject<{
|
|
|
54
54
|
}, "strip", z.ZodTypeAny, {
|
|
55
55
|
json: boolean;
|
|
56
56
|
from: string;
|
|
57
|
-
quiet: boolean;
|
|
58
57
|
remotePath: string;
|
|
58
|
+
quiet: boolean;
|
|
59
59
|
projectSlug?: string | undefined;
|
|
60
60
|
projectDir?: string | undefined;
|
|
61
61
|
}, {
|
|
@@ -74,8 +74,8 @@ declare const FilesDeleteArgsSchema: z.ZodObject<{
|
|
|
74
74
|
quiet: z.ZodDefault<z.ZodBoolean>;
|
|
75
75
|
}, "strip", z.ZodTypeAny, {
|
|
76
76
|
json: boolean;
|
|
77
|
-
quiet: boolean;
|
|
78
77
|
remotePath: string;
|
|
78
|
+
quiet: boolean;
|
|
79
79
|
projectSlug?: string | undefined;
|
|
80
80
|
projectDir?: string | undefined;
|
|
81
81
|
}, {
|
|
@@ -89,7 +89,7 @@ export function buildFilesListUrl(projectSlug, source) {
|
|
|
89
89
|
case "release":
|
|
90
90
|
return `/projects/${projectSlug}/releases/${encodeURIComponent(source.version)}/files`;
|
|
91
91
|
case "branch":
|
|
92
|
-
return `/projects/${projectSlug}/
|
|
92
|
+
return `/projects/${projectSlug}/files?branch=${encodeURIComponent(source.name)}`;
|
|
93
93
|
case "main":
|
|
94
94
|
return `/projects/${projectSlug}/files`;
|
|
95
95
|
}
|
|
@@ -127,7 +127,7 @@ export function buildFileContentUrl(projectSlug, path, source) {
|
|
|
127
127
|
case "release":
|
|
128
128
|
return `/projects/${projectSlug}/releases/${encodeURIComponent(source.version)}/files/${encodedPath}`;
|
|
129
129
|
case "branch":
|
|
130
|
-
return `/projects/${projectSlug}/
|
|
130
|
+
return `/projects/${projectSlug}/files/${encodedPath}?branch=${encodeURIComponent(source.name)}`;
|
|
131
131
|
case "main":
|
|
132
132
|
return `/projects/${projectSlug}/files/${encodedPath}`;
|
|
133
133
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/task/command.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/task/command.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAE7C,MAAM,WAAW,WAAY,SAAQ,QAAQ;CAAG;AAEhD,wBAAsB,WAAW,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CA0FrE"}
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
import * as dntShim from "../../../_dnt.shims.js";
|
|
8
8
|
import { cliLogger } from "../../utils/index.js";
|
|
9
9
|
import { exitProcess } from "../../utils/index.js";
|
|
10
|
+
import { withProjectSourceContext } from "../../shared/project-source-context.js";
|
|
10
11
|
export async function taskCommand(options) {
|
|
11
|
-
const { getAdapter } = await import("../../../src/platform/adapters/detect.js");
|
|
12
12
|
const { discoverTasks } = await import("../../../src/task/discovery.js");
|
|
13
13
|
const { runTask } = await import("../../../src/task/runner.js");
|
|
14
14
|
const taskName = options.name;
|
|
@@ -18,62 +18,68 @@ export async function taskCommand(options) {
|
|
|
18
18
|
return;
|
|
19
19
|
}
|
|
20
20
|
const projectDir = dntShim.Deno.cwd();
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
cliLogger.info("Available tasks:");
|
|
38
|
-
for (const t of tasks) {
|
|
39
|
-
cliLogger.info(` - ${t.id}${t.name !== t.id ? ` (${t.name})` : ""}`);
|
|
21
|
+
await withProjectSourceContext(projectDir, async ({ adapter, config, projectId, proxyContext }) => {
|
|
22
|
+
const sourceLabel = proxyContext?.branchRef
|
|
23
|
+
? `branch ${proxyContext.branchRef}`
|
|
24
|
+
: proxyContext
|
|
25
|
+
? "main"
|
|
26
|
+
: `${projectDir}/tasks/...`;
|
|
27
|
+
cliLogger.info(`Discovering tasks in ${sourceLabel}`);
|
|
28
|
+
const { tasks, errors } = await discoverTasks({
|
|
29
|
+
projectDir,
|
|
30
|
+
adapter,
|
|
31
|
+
config,
|
|
32
|
+
debug: options.debug,
|
|
33
|
+
});
|
|
34
|
+
if (errors.length > 0 && options.debug) {
|
|
35
|
+
for (const err of errors) {
|
|
36
|
+
cliLogger.warn(` Warning: ${err.filePath}: ${err.error}`);
|
|
40
37
|
}
|
|
41
38
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
cliLogger.
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
catch {
|
|
56
|
-
cliLogger.error("Invalid --config JSON");
|
|
39
|
+
const task = tasks.find((t) => t.id === taskName);
|
|
40
|
+
if (!task) {
|
|
41
|
+
cliLogger.error(`Task "${taskName}" not found.`);
|
|
42
|
+
if (tasks.length > 0) {
|
|
43
|
+
cliLogger.info("Available tasks:");
|
|
44
|
+
for (const t of tasks) {
|
|
45
|
+
cliLogger.info(` - ${t.id}${t.name !== t.id ? ` (${t.name})` : ""}`);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
cliLogger.info("No tasks found. Create a task file in tasks/ directory:");
|
|
50
|
+
cliLogger.info(" tasks/my-task.ts");
|
|
51
|
+
}
|
|
57
52
|
exitProcess(1);
|
|
58
53
|
return;
|
|
59
54
|
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
55
|
+
let taskConfig = {};
|
|
56
|
+
if (options.config) {
|
|
57
|
+
try {
|
|
58
|
+
taskConfig = JSON.parse(options.config);
|
|
59
|
+
}
|
|
60
|
+
catch {
|
|
61
|
+
cliLogger.error("Invalid --config JSON");
|
|
62
|
+
exitProcess(1);
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
cliLogger.info(`Running task: ${task.name} (${task.id})`);
|
|
67
|
+
cliLogger.info("");
|
|
68
|
+
const result = await runTask({
|
|
69
|
+
task,
|
|
70
|
+
config: taskConfig,
|
|
71
|
+
projectId,
|
|
72
|
+
debug: options.debug,
|
|
73
|
+
});
|
|
74
|
+
cliLogger.info("");
|
|
75
|
+
if (result.success) {
|
|
76
|
+
cliLogger.info(`Task completed in ${result.durationMs}ms`);
|
|
77
|
+
if (result.result !== undefined) {
|
|
78
|
+
cliLogger.info(`Result: ${JSON.stringify(result.result, null, 2)}`);
|
|
79
|
+
}
|
|
80
|
+
return;
|
|
73
81
|
}
|
|
74
|
-
}
|
|
75
|
-
else {
|
|
76
82
|
cliLogger.error(`Task failed after ${result.durationMs}ms: ${result.error}`);
|
|
77
83
|
exitProcess(1);
|
|
78
|
-
}
|
|
84
|
+
});
|
|
79
85
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command-help.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/workflow/command-help.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEvD,eAAO,MAAM,YAAY,EAAE,WAkB1B,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export const workflowHelp = {
|
|
2
|
+
name: "workflow",
|
|
3
|
+
description: "Run a workflow from the app/workflows directory",
|
|
4
|
+
usage: "veryfront workflow run <id> [options]",
|
|
5
|
+
options: [
|
|
6
|
+
{
|
|
7
|
+
flag: "--input <json>",
|
|
8
|
+
description: "JSON input to pass to the workflow",
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
flag: "--debug",
|
|
12
|
+
description: "Enable debug logging",
|
|
13
|
+
},
|
|
14
|
+
],
|
|
15
|
+
examples: [
|
|
16
|
+
"veryfront workflow run publish-site",
|
|
17
|
+
'veryfront workflow run content-pipeline --input \'{"topic":"AI"}\'',
|
|
18
|
+
],
|
|
19
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/workflow/command.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAIjD,MAAM,WAAW,eAAgB,SAAQ,YAAY;CAAG;AA2DxD,wBAAsB,eAAe,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAmF7E"}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import * as dntShim from "../../../_dnt.shims.js";
|
|
2
|
+
import { cliLogger } from "../../utils/index.js";
|
|
3
|
+
import { exitProcess } from "../../utils/index.js";
|
|
4
|
+
import { withProjectSourceContext } from "../../shared/project-source-context.js";
|
|
5
|
+
import { getEnv } from "../../../src/platform/index.js";
|
|
6
|
+
const WORKFLOW_STATUS_POLL_INTERVAL_MS = 1_000;
|
|
7
|
+
async function createWorkflowClient(debug) {
|
|
8
|
+
const { createWorkflowClient } = await import("../../../src/workflow/api/workflow-client.js");
|
|
9
|
+
const redisUrl = getEnv("REDIS_URL")?.trim();
|
|
10
|
+
if (!redisUrl) {
|
|
11
|
+
return createWorkflowClient({ debug });
|
|
12
|
+
}
|
|
13
|
+
const { RedisBackend } = await import("../../../src/workflow/backends/redis.js");
|
|
14
|
+
const backend = new RedisBackend({ url: redisUrl, debug });
|
|
15
|
+
if (backend.initialize) {
|
|
16
|
+
await backend.initialize();
|
|
17
|
+
}
|
|
18
|
+
return createWorkflowClient({ backend, debug });
|
|
19
|
+
}
|
|
20
|
+
async function waitForWorkflowExit(client, runId) {
|
|
21
|
+
while (true) {
|
|
22
|
+
const run = await client.getRun(runId);
|
|
23
|
+
if (!run) {
|
|
24
|
+
throw new Error(`Workflow run not found: ${runId}`);
|
|
25
|
+
}
|
|
26
|
+
if (run.status === "completed") {
|
|
27
|
+
cliLogger.info(`Workflow completed: ${runId}`);
|
|
28
|
+
if (run.output !== undefined) {
|
|
29
|
+
cliLogger.info(`Result: ${JSON.stringify(run.output, null, 2)}`);
|
|
30
|
+
}
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
if (run.status === "waiting") {
|
|
34
|
+
cliLogger.info(`Workflow is waiting: ${runId}`);
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
if (run.status === "failed") {
|
|
38
|
+
throw new Error(run.error?.message || `Workflow failed: ${runId}`);
|
|
39
|
+
}
|
|
40
|
+
if (run.status === "cancelled") {
|
|
41
|
+
throw new Error(`Workflow was cancelled: ${runId}`);
|
|
42
|
+
}
|
|
43
|
+
await new Promise((resolve) => dntShim.setTimeout(resolve, WORKFLOW_STATUS_POLL_INTERVAL_MS));
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
export async function workflowCommand(options) {
|
|
47
|
+
if (options.action !== "run") {
|
|
48
|
+
cliLogger.error(`Unknown workflow action: ${options.action}`);
|
|
49
|
+
exitProcess(1);
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
const workflowId = options.name;
|
|
53
|
+
if (!workflowId) {
|
|
54
|
+
cliLogger.error("Workflow ID is required. Usage: veryfront workflow run <id>");
|
|
55
|
+
exitProcess(1);
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
let input = {};
|
|
59
|
+
if (options.input) {
|
|
60
|
+
try {
|
|
61
|
+
input = JSON.parse(options.input);
|
|
62
|
+
}
|
|
63
|
+
catch {
|
|
64
|
+
cliLogger.error("Invalid --input JSON");
|
|
65
|
+
exitProcess(1);
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
const { discoverWorkflows } = await import("../../../src/workflow/discovery/index.js");
|
|
70
|
+
await withProjectSourceContext(dntShim.Deno.cwd(), async ({ adapter, config, proxyContext }) => {
|
|
71
|
+
const sourceLabel = proxyContext?.branchRef
|
|
72
|
+
? `branch ${proxyContext.branchRef}`
|
|
73
|
+
: proxyContext
|
|
74
|
+
? "main"
|
|
75
|
+
: `${dntShim.Deno.cwd()}/app/workflows/...`;
|
|
76
|
+
cliLogger.info(`Discovering workflows in ${sourceLabel}`);
|
|
77
|
+
const discovery = await discoverWorkflows({
|
|
78
|
+
projectDir: dntShim.Deno.cwd(),
|
|
79
|
+
adapter,
|
|
80
|
+
config,
|
|
81
|
+
debug: options.debug,
|
|
82
|
+
});
|
|
83
|
+
if (discovery.errors.length > 0 && options.debug) {
|
|
84
|
+
for (const err of discovery.errors) {
|
|
85
|
+
cliLogger.warn(` Warning: ${err.filePath}: ${err.error}`);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
const workflow = discovery.workflows.find((candidate) => candidate.id === workflowId);
|
|
89
|
+
if (!workflow) {
|
|
90
|
+
cliLogger.error(`Workflow "${workflowId}" not found.`);
|
|
91
|
+
if (discovery.workflows.length > 0) {
|
|
92
|
+
cliLogger.info("Available workflows:");
|
|
93
|
+
for (const candidate of discovery.workflows) {
|
|
94
|
+
cliLogger.info(` - ${candidate.id}`);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
cliLogger.info("No workflows found. Create a workflow file in app/workflows/.");
|
|
99
|
+
}
|
|
100
|
+
exitProcess(1);
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
const client = await createWorkflowClient(options.debug);
|
|
104
|
+
try {
|
|
105
|
+
client.register(workflow.definition);
|
|
106
|
+
cliLogger.info(`Running workflow: ${workflow.id}`);
|
|
107
|
+
cliLogger.info("");
|
|
108
|
+
const handle = await client.start(workflow.id, input);
|
|
109
|
+
await waitForWorkflowExit(client, handle.runId);
|
|
110
|
+
}
|
|
111
|
+
finally {
|
|
112
|
+
await client.destroy();
|
|
113
|
+
}
|
|
114
|
+
}).catch((error) => {
|
|
115
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
116
|
+
cliLogger.error(message);
|
|
117
|
+
exitProcess(1);
|
|
118
|
+
});
|
|
119
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { ParsedArgs } from "../../shared/types.js";
|
|
3
|
+
declare const WorkflowArgsSchema: z.ZodObject<{
|
|
4
|
+
action: z.ZodEnum<["run"]>;
|
|
5
|
+
name: z.ZodString;
|
|
6
|
+
input: z.ZodOptional<z.ZodString>;
|
|
7
|
+
debug: z.ZodDefault<z.ZodBoolean>;
|
|
8
|
+
}, "strip", z.ZodTypeAny, {
|
|
9
|
+
name: string;
|
|
10
|
+
debug: boolean;
|
|
11
|
+
action: "run";
|
|
12
|
+
input?: string | undefined;
|
|
13
|
+
}, {
|
|
14
|
+
name: string;
|
|
15
|
+
action: "run";
|
|
16
|
+
input?: string | undefined;
|
|
17
|
+
debug?: boolean | undefined;
|
|
18
|
+
}>;
|
|
19
|
+
export type WorkflowArgs = z.infer<typeof WorkflowArgsSchema>;
|
|
20
|
+
export declare const parseWorkflowArgs: (args: ParsedArgs) => z.SafeParseReturnType<unknown, {
|
|
21
|
+
name: string;
|
|
22
|
+
debug: boolean;
|
|
23
|
+
action: "run";
|
|
24
|
+
input?: string | undefined;
|
|
25
|
+
}>;
|
|
26
|
+
export declare function handleWorkflowCommand(args: ParsedArgs): Promise<void>;
|
|
27
|
+
export {};
|
|
28
|
+
//# sourceMappingURL=handler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/workflow/handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAExD,QAAA,MAAM,kBAAkB;;;;;;;;;;;;;;;EAKtB,CAAC;AAEH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAE9D,eAAO,MAAM,iBAAiB;;;;;EAK5B,CAAC;AAEH,wBAAsB,qBAAqB,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAI3E"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { createArgParser, parseArgsOrThrow } from "../../shared/args.js";
|
|
3
|
+
const WorkflowArgsSchema = z.object({
|
|
4
|
+
action: z.enum(["run"]),
|
|
5
|
+
name: z.string(),
|
|
6
|
+
input: z.string().optional(),
|
|
7
|
+
debug: z.boolean().default(false),
|
|
8
|
+
});
|
|
9
|
+
export const parseWorkflowArgs = createArgParser(WorkflowArgsSchema, {
|
|
10
|
+
action: { keys: ["action"], type: "string", positional: 0 },
|
|
11
|
+
name: { keys: ["name"], type: "string", positional: 1 },
|
|
12
|
+
input: { keys: ["input"], type: "string" },
|
|
13
|
+
debug: { keys: ["debug"], type: "boolean" },
|
|
14
|
+
});
|
|
15
|
+
export async function handleWorkflowCommand(args) {
|
|
16
|
+
const opts = parseArgsOrThrow(parseWorkflowArgs, "workflow", args);
|
|
17
|
+
const { workflowCommand } = await import("./command.js");
|
|
18
|
+
await workflowCommand(opts);
|
|
19
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command-definitions.d.ts","sourceRoot":"","sources":["../../../src/cli/help/command-definitions.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"command-definitions.d.ts","sourceRoot":"","sources":["../../../src/cli/help/command-definitions.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAiClD;;;GAGG;AACH,eAAO,MAAM,QAAQ,EAAE,eA+BtB,CAAC"}
|
|
@@ -33,6 +33,7 @@ import { mcpHelp } from "../commands/mcp/command-help.js";
|
|
|
33
33
|
import { issuesHelp } from "../commands/issues/command-help.js";
|
|
34
34
|
import { startHelp } from "../commands/start/command-help.js";
|
|
35
35
|
import { taskHelp } from "../commands/task/command-help.js";
|
|
36
|
+
import { workflowHelp } from "../commands/workflow/command-help.js";
|
|
36
37
|
/**
|
|
37
38
|
* Central registry of all command help definitions.
|
|
38
39
|
* Each command's help is imported from its respective command-help.ts file.
|
|
@@ -67,4 +68,5 @@ export const COMMANDS = {
|
|
|
67
68
|
issues: issuesHelp,
|
|
68
69
|
start: startHelp,
|
|
69
70
|
task: taskHelp,
|
|
71
|
+
workflow: workflowHelp,
|
|
70
72
|
};
|
package/esm/cli/router.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../../src/cli/router.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../../src/cli/router.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAoCH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AA2DpD;;;;GAIG;AACH,wBAAsB,YAAY,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAwClE"}
|
package/esm/cli/router.js
CHANGED
|
@@ -30,6 +30,7 @@ import { handleStartCommand } from "./commands/start/handler.js";
|
|
|
30
30
|
import { handleStudioCommand } from "./commands/studio/handler.js";
|
|
31
31
|
import { handleUpCommand } from "./commands/up/index.js";
|
|
32
32
|
import { handleTaskCommand } from "./commands/task/handler.js";
|
|
33
|
+
import { handleWorkflowCommand } from "./commands/workflow/handler.js";
|
|
33
34
|
import { handleWorkerCommand } from "./commands/worker/handler.js";
|
|
34
35
|
import { login, logout, whoami } from "./auth/index.js";
|
|
35
36
|
import { parseLoginMethod } from "./auth/utils.js";
|
|
@@ -78,6 +79,7 @@ const commands = {
|
|
|
78
79
|
"issues": handleIssuesCommand,
|
|
79
80
|
"start": handleStartCommand,
|
|
80
81
|
"task": handleTaskCommand,
|
|
82
|
+
"workflow": handleWorkflowCommand,
|
|
81
83
|
"worker": handleWorkerCommand,
|
|
82
84
|
};
|
|
83
85
|
/**
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type VeryfrontConfig } from "../../src/config/index.js";
|
|
2
|
+
import { type RuntimeAdapter } from "../../src/platform/index.js";
|
|
3
|
+
interface ProxyProjectSourceContext {
|
|
4
|
+
projectSlug: string;
|
|
5
|
+
token: string;
|
|
6
|
+
projectId?: string;
|
|
7
|
+
branchRef?: string | null;
|
|
8
|
+
}
|
|
9
|
+
export interface ProjectSourceExecutionContext {
|
|
10
|
+
adapter: RuntimeAdapter;
|
|
11
|
+
config: VeryfrontConfig;
|
|
12
|
+
projectDir: string;
|
|
13
|
+
projectId?: string;
|
|
14
|
+
proxyContext?: ProxyProjectSourceContext;
|
|
15
|
+
}
|
|
16
|
+
export declare function withProjectSourceContext<T>(projectDir: string, run: (context: ProjectSourceExecutionContext) => Promise<T>): Promise<T>;
|
|
17
|
+
export {};
|
|
18
|
+
//# sourceMappingURL=project-source-context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project-source-context.d.ts","sourceRoot":"","sources":["../../../src/cli/shared/project-source-context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,KAAK,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5E,OAAO,EAKL,KAAK,cAAc,EACpB,MAAM,6BAA6B,CAAC;AAErC,UAAU,yBAAyB;IACjC,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B;AAED,MAAM,WAAW,6BAA6B;IAC5C,OAAO,EAAE,cAAc,CAAC;IACxB,MAAM,EAAE,eAAe,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,yBAAyB,CAAC;CAC1C;AA8BD,wBAAsB,wBAAwB,CAAC,CAAC,EAC9C,UAAU,EAAE,MAAM,EAClB,GAAG,EAAE,CAAC,OAAO,EAAE,6BAA6B,KAAK,OAAO,CAAC,CAAC,CAAC,GAC1D,OAAO,CAAC,CAAC,CAAC,CAwCZ"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { getConfig } from "../../src/config/index.js";
|
|
2
|
+
import { enhanceAdapterWithFS, getEnv, isExtendedFSAdapter, runtime, } from "../../src/platform/index.js";
|
|
3
|
+
function getProxyProjectSourceContext() {
|
|
4
|
+
const projectSlug = getEnv("VERYFRONT_PROJECT_SLUG")?.trim();
|
|
5
|
+
const token = getEnv("VERYFRONT_API_TOKEN")?.trim();
|
|
6
|
+
if (!projectSlug || !token) {
|
|
7
|
+
return null;
|
|
8
|
+
}
|
|
9
|
+
const projectId = getEnv("VERYFRONT_PROJECT_ID")?.trim();
|
|
10
|
+
const branchRef = getEnv("VERYFRONT_BRANCH_REF")?.trim();
|
|
11
|
+
return {
|
|
12
|
+
projectSlug,
|
|
13
|
+
token,
|
|
14
|
+
projectId: projectId || undefined,
|
|
15
|
+
branchRef: branchRef || null,
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
async function loadProjectConfig(projectDir, adapter, proxyContext) {
|
|
19
|
+
const cacheKey = proxyContext?.projectId ?? proxyContext?.projectSlug;
|
|
20
|
+
return await getConfig(projectDir, adapter, cacheKey ? { cacheKey } : undefined);
|
|
21
|
+
}
|
|
22
|
+
export async function withProjectSourceContext(projectDir, run) {
|
|
23
|
+
const baseAdapter = await runtime.get();
|
|
24
|
+
const initialConfig = await getConfig(projectDir, baseAdapter);
|
|
25
|
+
const adapter = await enhanceAdapterWithFS(baseAdapter, initialConfig, projectDir);
|
|
26
|
+
const proxyContext = getProxyProjectSourceContext();
|
|
27
|
+
if (proxyContext &&
|
|
28
|
+
isExtendedFSAdapter(adapter.fs) &&
|
|
29
|
+
adapter.fs.isMultiProjectMode()) {
|
|
30
|
+
return await adapter.fs.runWithContext(proxyContext.projectSlug, proxyContext.token, async () => {
|
|
31
|
+
const config = await loadProjectConfig(projectDir, adapter, proxyContext);
|
|
32
|
+
return await run({
|
|
33
|
+
adapter,
|
|
34
|
+
config,
|
|
35
|
+
projectDir,
|
|
36
|
+
projectId: proxyContext.projectId,
|
|
37
|
+
proxyContext,
|
|
38
|
+
});
|
|
39
|
+
}, proxyContext.projectId, {
|
|
40
|
+
productionMode: false,
|
|
41
|
+
branch: proxyContext.branchRef ?? null,
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
const config = await loadProjectConfig(projectDir, adapter);
|
|
45
|
+
return await run({
|
|
46
|
+
adapter,
|
|
47
|
+
config,
|
|
48
|
+
projectDir,
|
|
49
|
+
projectId: proxyContext?.projectId,
|
|
50
|
+
proxyContext: proxyContext ?? undefined,
|
|
51
|
+
});
|
|
52
|
+
}
|
package/esm/deno.d.ts
CHANGED
|
@@ -22,6 +22,7 @@ declare namespace _default {
|
|
|
22
22
|
"./workflow/discovery": string;
|
|
23
23
|
"./prompt": string;
|
|
24
24
|
"./resource": string;
|
|
25
|
+
"./jobs": string;
|
|
25
26
|
"./mcp": string;
|
|
26
27
|
"./middleware": string;
|
|
27
28
|
"./utils": string;
|
|
@@ -51,6 +52,7 @@ declare namespace _default {
|
|
|
51
52
|
"veryfront/components/ai": string;
|
|
52
53
|
"veryfront/sandbox": string;
|
|
53
54
|
"veryfront/embedding": string;
|
|
55
|
+
"veryfront/jobs": string;
|
|
54
56
|
"veryfront/agent/react": string;
|
|
55
57
|
"veryfront/agent/testing": string;
|
|
56
58
|
"veryfront/agent/middleware": string;
|
|
@@ -102,6 +104,7 @@ declare namespace _default {
|
|
|
102
104
|
"#cli/shared/types": string;
|
|
103
105
|
"#cli/shared/constants": string;
|
|
104
106
|
"#cli/shared/config": string;
|
|
107
|
+
"#cli/shared/project-source-context": string;
|
|
105
108
|
"#cli/shared/slug": string;
|
|
106
109
|
"#cli/shared/reserve-slug": string;
|
|
107
110
|
"#cli/shared/server-startup": string;
|
|
@@ -124,6 +127,7 @@ declare namespace _default {
|
|
|
124
127
|
"#veryfront/react": string;
|
|
125
128
|
"#veryfront/rendering": string;
|
|
126
129
|
"#veryfront/resource": string;
|
|
130
|
+
"#veryfront/jobs": string;
|
|
127
131
|
"#veryfront/routing": string;
|
|
128
132
|
"#veryfront/security": string;
|
|
129
133
|
"#veryfront/skill": string;
|
|
@@ -243,6 +247,7 @@ declare namespace _default {
|
|
|
243
247
|
"tailwindcss/colors": string;
|
|
244
248
|
redis: string;
|
|
245
249
|
pg: string;
|
|
250
|
+
jose: string;
|
|
246
251
|
"@opentelemetry/api": string;
|
|
247
252
|
"@opentelemetry/core": string;
|
|
248
253
|
"@opentelemetry/context-async-hooks": string;
|
|
@@ -291,6 +296,7 @@ declare namespace _default {
|
|
|
291
296
|
"test:coverage:integration": string;
|
|
292
297
|
"coverage:report": string;
|
|
293
298
|
"coverage:html": string;
|
|
299
|
+
bench: string;
|
|
294
300
|
clean: string;
|
|
295
301
|
lint: string;
|
|
296
302
|
fmt: string;
|