veryfront 0.1.623 → 0.1.625
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 +3 -3
- package/esm/cli/commands/knowledge/command-help.d.ts.map +1 -1
- package/esm/cli/commands/knowledge/command-help.js +2 -3
- package/esm/cli/commands/knowledge/command.d.ts +2 -47
- package/esm/cli/commands/knowledge/command.d.ts.map +1 -1
- package/esm/cli/commands/knowledge/command.js +22 -124
- package/esm/cli/commands/knowledge/parser.d.ts +40 -0
- package/esm/cli/commands/knowledge/parser.d.ts.map +1 -0
- package/esm/cli/commands/knowledge/parser.js +353 -0
- package/esm/cli/commands/knowledge/result.d.ts +3 -3
- package/esm/cli/commands/knowledge/result.js +1 -1
- package/esm/cli/commands/styles/command.js +2 -2
- package/esm/cli/commands/task/command.js +4 -4
- package/esm/cli/commands/worker/command-help.js +4 -4
- package/esm/cli/commands/worker/command.d.ts +1 -1
- package/esm/cli/commands/worker/command.js +9 -9
- package/esm/cli/commands/workflow/command.js +4 -4
- package/esm/cli/utils/sanitize-run-output.d.ts +2 -0
- package/esm/cli/utils/sanitize-run-output.d.ts.map +1 -0
- package/esm/cli/utils/{sanitize-job-output.js → sanitize-run-output.js} +1 -1
- package/esm/cli/utils/write-run-result.d.ts +2 -0
- package/esm/cli/utils/write-run-result.d.ts.map +1 -0
- package/esm/cli/utils/write-run-result.js +16 -0
- package/esm/deno.d.ts +4 -3
- package/esm/deno.js +6 -5
- package/esm/src/build/production-build/static-generation.d.ts.map +1 -1
- package/esm/src/build/production-build/static-generation.js +85 -0
- package/esm/src/html/hydration-script-builder/templates/renderer.d.ts.map +1 -1
- package/esm/src/html/hydration-script-builder/templates/renderer.js +37 -4
- package/esm/src/integrations/_data.js +1 -1
- package/esm/src/integrations/schema.d.ts +8 -0
- package/esm/src/integrations/schema.d.ts.map +1 -1
- package/esm/src/integrations/schema.js +3 -0
- package/esm/src/internal-agents/run-stream.d.ts.map +1 -1
- package/esm/src/internal-agents/run-stream.js +20 -3
- package/esm/src/platform/adapters/veryfront-api-client/operations.d.ts +2 -2
- package/esm/src/platform/adapters/veryfront-api-client/operations.d.ts.map +1 -1
- package/esm/src/platform/adapters/veryfront-api-client/operations.js +2 -2
- package/esm/src/platform/adapters/veryfront-api-client/schemas/api.schema.d.ts +1 -1
- package/esm/src/platform/adapters/veryfront-api-client/schemas/api.schema.js +1 -1
- package/esm/src/react/components/chat/chat/components/attachment-pill.js +1 -1
- package/esm/src/react/components/chat/chat/composition/chat-composer.d.ts +1 -0
- package/esm/src/react/components/chat/chat/composition/chat-composer.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat/composition/chat-composer.js +27 -11
- package/esm/src/react/components/chat/chat/index.d.ts +1 -0
- package/esm/src/react/components/chat/chat/index.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat/index.js +2 -2
- package/esm/src/react/components/chat/theme.js +1 -1
- package/esm/src/rendering/layouts/utils/applicator.d.ts.map +1 -1
- package/esm/src/rendering/layouts/utils/applicator.js +1 -1
- package/esm/src/rendering/layouts/utils/component-loader.d.ts +8 -0
- package/esm/src/rendering/layouts/utils/component-loader.d.ts.map +1 -1
- package/esm/src/rendering/layouts/utils/component-loader.js +19 -0
- package/esm/src/rendering/rsc/client-boot.ts +23 -6
- package/esm/src/runs/index.d.ts +27 -0
- package/esm/src/runs/index.d.ts.map +1 -0
- package/esm/src/runs/index.js +26 -0
- package/esm/src/runs/runs-client.d.ts +95 -0
- package/esm/src/runs/runs-client.d.ts.map +1 -0
- package/esm/src/runs/runs-client.js +181 -0
- package/esm/src/{jobs → runs}/runtime-env.d.ts.map +1 -1
- package/esm/src/{jobs → runs}/runtime-env.js +2 -2
- package/esm/src/runs/schemas.d.ts +236 -0
- package/esm/src/runs/schemas.d.ts.map +1 -0
- package/esm/src/runs/schemas.js +61 -0
- package/esm/src/security/deno-permissions.d.ts +2 -2
- package/esm/src/security/deno-permissions.js +2 -2
- package/esm/src/security/index.d.ts +1 -1
- package/esm/src/security/index.js +1 -1
- package/esm/src/server/build-app-route-renderer.d.ts +2 -0
- package/esm/src/server/build-app-route-renderer.d.ts.map +1 -1
- package/esm/src/server/build-app-route-renderer.js +51 -28
- package/esm/src/server/handlers/dev/framework-candidates.generated.d.ts.map +1 -1
- package/esm/src/server/handlers/dev/framework-candidates.generated.js +54 -8
- package/esm/src/server/services/rsc/endpoints/rsc-bundles.generated.d.ts.map +1 -1
- package/esm/src/server/services/rsc/endpoints/rsc-bundles.generated.js +1 -1
- package/esm/src/server/services/static/static-file.service.d.ts.map +1 -1
- package/esm/src/server/services/static/static-file.service.js +9 -4
- package/esm/src/skill/index.d.ts +1 -1
- package/esm/src/skill/index.d.ts.map +1 -1
- package/esm/src/skill/index.js +1 -1
- package/esm/src/skill/prompt-augmentation.js +2 -2
- package/esm/src/skill/tools.d.ts +1 -1
- package/esm/src/skill/tools.d.ts.map +1 -1
- package/esm/src/skill/tools.js +11 -9
- package/esm/src/skill/types.d.ts +1 -0
- package/esm/src/skill/types.d.ts.map +1 -1
- package/esm/src/skill/types.js +1 -0
- package/esm/src/task/runner.js +1 -1
- package/esm/src/task/types.d.ts +4 -4
- package/esm/src/task/types.d.ts.map +1 -1
- package/esm/src/task/types.js +1 -1
- package/esm/src/tool/factory.d.ts.map +1 -1
- package/esm/src/tool/factory.js +10 -0
- package/esm/src/tool/types.d.ts +5 -4
- package/esm/src/tool/types.d.ts.map +1 -1
- package/esm/src/utils/index.d.ts +1 -1
- package/esm/src/utils/index.js +1 -1
- package/esm/src/utils/logger/index.d.ts +1 -1
- package/esm/src/utils/logger/index.js +1 -1
- package/esm/src/utils/logger/logger.d.ts +6 -6
- package/esm/src/utils/logger/logger.d.ts.map +1 -1
- package/esm/src/utils/logger/logger.js +10 -10
- package/esm/src/utils/version-constant.d.ts +1 -1
- package/esm/src/utils/version-constant.js +1 -1
- package/esm/src/workflow/executor/workflow-executor.js +3 -3
- package/esm/src/workflow/worker/{dynamic-job-entrypoint.d.ts → dynamic-run-entrypoint.d.ts} +2 -2
- package/esm/src/workflow/worker/{dynamic-job-entrypoint.d.ts.map → dynamic-run-entrypoint.d.ts.map} +1 -1
- package/esm/src/workflow/worker/{dynamic-job-entrypoint.js → dynamic-run-entrypoint.js} +1 -1
- package/esm/src/workflow/worker/executors/index.d.ts +8 -8
- package/esm/src/workflow/worker/executors/index.d.ts.map +1 -1
- package/esm/src/workflow/worker/executors/index.js +5 -5
- package/esm/src/workflow/worker/executors/k8s.d.ts +34 -34
- package/esm/src/workflow/worker/executors/k8s.d.ts.map +1 -1
- package/esm/src/workflow/worker/executors/k8s.js +59 -58
- package/esm/src/workflow/worker/executors/process.d.ts +15 -15
- package/esm/src/workflow/worker/executors/process.d.ts.map +1 -1
- package/esm/src/workflow/worker/executors/process.js +86 -86
- package/esm/src/workflow/worker/executors/types.d.ts +38 -39
- package/esm/src/workflow/worker/executors/types.d.ts.map +1 -1
- package/esm/src/workflow/worker/executors/types.js +9 -10
- package/esm/src/workflow/worker/index.d.ts +7 -7
- package/esm/src/workflow/worker/index.d.ts.map +1 -1
- package/esm/src/workflow/worker/index.js +9 -9
- package/esm/src/workflow/worker/{job-entrypoint.d.ts → run-entrypoint.d.ts} +3 -3
- package/esm/src/workflow/worker/{job-entrypoint.d.ts.map → run-entrypoint.d.ts.map} +1 -1
- package/esm/src/workflow/worker/{job-entrypoint.js → run-entrypoint.js} +2 -2
- package/esm/src/workflow/worker/{job-manager.d.ts → run-manager.d.ts} +32 -32
- package/esm/src/workflow/worker/run-manager.d.ts.map +1 -0
- package/esm/src/workflow/worker/{job-manager.js → run-manager.js} +63 -63
- package/esm/src/workflow/worker/shared.js +1 -1
- package/package.json +4 -4
- package/esm/cli/commands/knowledge/parser-source.d.ts +0 -2
- package/esm/cli/commands/knowledge/parser-source.d.ts.map +0 -1
- package/esm/cli/commands/knowledge/parser-source.js +0 -641
- package/esm/cli/utils/sanitize-job-output.d.ts +0 -2
- package/esm/cli/utils/sanitize-job-output.d.ts.map +0 -1
- package/esm/cli/utils/write-job-result.d.ts +0 -2
- package/esm/cli/utils/write-job-result.d.ts.map +0 -1
- package/esm/cli/utils/write-job-result.js +0 -16
- package/esm/src/jobs/index.d.ts +0 -25
- package/esm/src/jobs/index.d.ts.map +0 -1
- package/esm/src/jobs/index.js +0 -24
- package/esm/src/jobs/jobs-client.d.ts +0 -182
- package/esm/src/jobs/jobs-client.d.ts.map +0 -1
- package/esm/src/jobs/jobs-client.js +0 -255
- package/esm/src/jobs/schemas.d.ts +0 -1146
- package/esm/src/jobs/schemas.d.ts.map +0 -1
- package/esm/src/jobs/schemas.js +0 -294
- package/esm/src/workflow/worker/job-manager.d.ts.map +0 -1
- /package/esm/src/{jobs → runs}/runtime-env.d.ts +0 -0
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Kubernetes
|
|
2
|
+
* Kubernetes-backed run executor
|
|
3
3
|
*
|
|
4
|
-
* Executes
|
|
4
|
+
* Executes workflow runs as Kubernetes Job resources.
|
|
5
5
|
* Each workflow runs in an ephemeral pod with complete isolation.
|
|
6
6
|
*/
|
|
7
|
-
import type {
|
|
7
|
+
import type { RunExecutionConfig, RunExecutionInfo, RunExecutor } from "./types.js";
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
9
|
+
* Kubernetes-backed run executor configuration
|
|
10
10
|
*/
|
|
11
|
-
export interface
|
|
12
|
-
/** Kubernetes namespace for
|
|
11
|
+
export interface K8sRunExecutorConfig {
|
|
12
|
+
/** Kubernetes namespace for run executions */
|
|
13
13
|
namespace?: string;
|
|
14
14
|
/** Container image for workflow execution */
|
|
15
15
|
image: string;
|
|
16
16
|
/** Image pull policy */
|
|
17
17
|
imagePullPolicy?: "Always" | "IfNotPresent" | "Never";
|
|
18
|
-
/** Service account for
|
|
18
|
+
/** Service account for run executions */
|
|
19
19
|
serviceAccount?: string;
|
|
20
|
-
/** Resource requests/limits for
|
|
20
|
+
/** Resource requests/limits for run execution pods */
|
|
21
21
|
resources?: {
|
|
22
22
|
requests?: {
|
|
23
23
|
cpu?: string;
|
|
@@ -30,7 +30,7 @@ export interface K8sJobExecutorConfig {
|
|
|
30
30
|
};
|
|
31
31
|
/** Secrets to mount as environment variables */
|
|
32
32
|
envFromSecrets?: string[];
|
|
33
|
-
/** Time to keep completed
|
|
33
|
+
/** Time to keep completed run executions for debugging (seconds) */
|
|
34
34
|
ttlAfterFinished?: number;
|
|
35
35
|
/** Enable debug logging */
|
|
36
36
|
debug?: boolean;
|
|
@@ -39,19 +39,19 @@ export interface K8sJobExecutorConfig {
|
|
|
39
39
|
* Kubernetes API client interface
|
|
40
40
|
*/
|
|
41
41
|
export interface K8sClient {
|
|
42
|
-
/** Create a
|
|
43
|
-
|
|
44
|
-
/** Get
|
|
45
|
-
|
|
46
|
-
/** List
|
|
47
|
-
|
|
48
|
-
/** Delete a
|
|
49
|
-
|
|
42
|
+
/** Create a run execution Kubernetes resource */
|
|
43
|
+
createRunExecution(namespace: string, resource: K8sRunExecutionSpec): Promise<void>;
|
|
44
|
+
/** Get Kubernetes resource status */
|
|
45
|
+
getRunExecutionResource(namespace: string, name: string): Promise<K8sRunExecutionStatusResponse | null>;
|
|
46
|
+
/** List run execution Kubernetes resources with label selector */
|
|
47
|
+
listRunExecutions(namespace: string, labelSelector: string): Promise<K8sRunExecutionStatusResponse[]>;
|
|
48
|
+
/** Delete a run execution Kubernetes resource */
|
|
49
|
+
deleteRunExecution(namespace: string, name: string): Promise<void>;
|
|
50
50
|
}
|
|
51
51
|
/**
|
|
52
|
-
* K8s
|
|
52
|
+
* K8s run execution Kubernetes resource spec
|
|
53
53
|
*/
|
|
54
|
-
export interface
|
|
54
|
+
export interface K8sRunExecutionSpec {
|
|
55
55
|
metadata: {
|
|
56
56
|
name: string;
|
|
57
57
|
namespace: string;
|
|
@@ -100,9 +100,9 @@ export interface K8sJobSpec {
|
|
|
100
100
|
};
|
|
101
101
|
}
|
|
102
102
|
/**
|
|
103
|
-
* K8s
|
|
103
|
+
* K8s run execution status response
|
|
104
104
|
*/
|
|
105
|
-
export interface
|
|
105
|
+
export interface K8sRunExecutionStatusResponse {
|
|
106
106
|
metadata: {
|
|
107
107
|
name: string;
|
|
108
108
|
labels: Record<string, string>;
|
|
@@ -123,34 +123,34 @@ export interface K8sJobStatusResponse {
|
|
|
123
123
|
};
|
|
124
124
|
}
|
|
125
125
|
/**
|
|
126
|
-
* Kubernetes
|
|
126
|
+
* Kubernetes-backed run executor
|
|
127
127
|
*/
|
|
128
|
-
export declare class
|
|
128
|
+
export declare class K8sRunExecutor implements RunExecutor {
|
|
129
129
|
private config;
|
|
130
130
|
private k8sClient;
|
|
131
|
-
constructor(config:
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
131
|
+
constructor(config: K8sRunExecutorConfig, k8sClient: K8sClient);
|
|
132
|
+
createRunExecution(executionConfig: RunExecutionConfig): Promise<string>;
|
|
133
|
+
getRunExecutionStatus(executionId: string): Promise<RunExecutionInfo | null>;
|
|
134
|
+
listRunExecutions(managerId: string): Promise<RunExecutionInfo[]>;
|
|
135
|
+
deleteRunExecution(executionId: string): Promise<void>;
|
|
136
136
|
/**
|
|
137
|
-
* Convert
|
|
137
|
+
* Convert execution ID to a valid K8s resource name
|
|
138
138
|
*/
|
|
139
|
-
private
|
|
139
|
+
private sanitizeResourceName;
|
|
140
140
|
/**
|
|
141
141
|
* Build tenant environment variables
|
|
142
142
|
*/
|
|
143
143
|
private buildTenantEnv;
|
|
144
144
|
/**
|
|
145
|
-
* Parse K8s
|
|
145
|
+
* Parse K8s run execution response to RunExecutionInfo
|
|
146
146
|
*/
|
|
147
|
-
private
|
|
147
|
+
private parseRunExecutionInfo;
|
|
148
148
|
/**
|
|
149
|
-
* Parse K8s
|
|
149
|
+
* Parse K8s run execution status
|
|
150
150
|
*/
|
|
151
151
|
private parseStatus;
|
|
152
152
|
/**
|
|
153
|
-
* Extract error from K8s
|
|
153
|
+
* Extract error from K8s run execution
|
|
154
154
|
*/
|
|
155
155
|
private extractError;
|
|
156
156
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"k8s.d.ts","sourceRoot":"","sources":["../../../../../src/src/workflow/worker/executors/k8s.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"k8s.d.ts","sourceRoot":"","sources":["../../../../../src/src/workflow/worker/executors/k8s.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EACV,kBAAkB,EAClB,gBAAgB,EAEhB,WAAW,EACZ,MAAM,YAAY,CAAC;AAOpB;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,8CAA8C;IAC9C,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,6CAA6C;IAC7C,KAAK,EAAE,MAAM,CAAC;IAEd,wBAAwB;IACxB,eAAe,CAAC,EAAE,QAAQ,GAAG,cAAc,GAAG,OAAO,CAAC;IAEtD,yCAAyC;IACzC,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB,sDAAsD;IACtD,SAAS,CAAC,EAAE;QACV,QAAQ,CAAC,EAAE;YAAE,GAAG,CAAC,EAAE,MAAM,CAAC;YAAC,MAAM,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC;QAC7C,MAAM,CAAC,EAAE;YAAE,GAAG,CAAC,EAAE,MAAM,CAAC;YAAC,MAAM,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC;KAC5C,CAAC;IAEF,gDAAgD;IAChD,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAE1B,oEAAoE;IACpE,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAE1B,2BAA2B;IAC3B,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,iDAAiD;IACjD,kBAAkB,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC,C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AAS;IAWxD,kBAAkB,CAAC,eAAe,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC;IAkExE,qBAAqB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC;IAmB5E,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC;IAcjE,kBAAkB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAc5D;;OAEG;IACH,OAAO,CAAC,oBAAoB;IAI5B;;OAEG;IACH,OAAO,CAAC,cAAc;IAkCtB;;OAEG;IACH,OAAO,CAAC,qBAAqB;IAuB7B;;OAEG;IACH,OAAO,CAAC,WAAW;IAanB;;OAEG;IACH,OAAO,CAAC,YAAY;CAWrB"}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Kubernetes
|
|
2
|
+
* Kubernetes-backed run executor
|
|
3
3
|
*
|
|
4
|
-
* Executes
|
|
4
|
+
* Executes workflow runs as Kubernetes Job resources.
|
|
5
5
|
* Each workflow runs in an ephemeral pod with complete isolation.
|
|
6
6
|
*/
|
|
7
7
|
import { logger as baseLogger } from "../../../utils/index.js";
|
|
8
|
-
const logger = baseLogger.component("k8s-
|
|
9
|
-
/** Default TTL for completed K8s
|
|
8
|
+
const logger = baseLogger.component("k8s-run-executor");
|
|
9
|
+
/** Default TTL for completed K8s Job resources before automatic cleanup (seconds) */
|
|
10
10
|
const DEFAULT_TTL_AFTER_FINISHED_SECONDS = 300;
|
|
11
11
|
/**
|
|
12
|
-
* Kubernetes
|
|
12
|
+
* Kubernetes-backed run executor
|
|
13
13
|
*/
|
|
14
|
-
export class
|
|
14
|
+
export class K8sRunExecutor {
|
|
15
15
|
config;
|
|
16
16
|
k8sClient;
|
|
17
17
|
constructor(config, k8sClient) {
|
|
@@ -24,18 +24,18 @@ export class K8sJobExecutor {
|
|
|
24
24
|
...config,
|
|
25
25
|
};
|
|
26
26
|
}
|
|
27
|
-
async
|
|
28
|
-
const {
|
|
29
|
-
const
|
|
27
|
+
async createRunExecution(executionConfig) {
|
|
28
|
+
const { executionId, run, managerId, timeout, env, debug } = executionConfig;
|
|
29
|
+
const resourceName = this.sanitizeResourceName(executionId);
|
|
30
30
|
const tenantSlug = run._tenant?.projectSlug ?? "unknown";
|
|
31
|
-
const
|
|
31
|
+
const resource = {
|
|
32
32
|
metadata: {
|
|
33
|
-
name:
|
|
33
|
+
name: resourceName,
|
|
34
34
|
namespace: this.config.namespace,
|
|
35
35
|
labels: {
|
|
36
|
-
"veryfront.com/component": "workflow-
|
|
36
|
+
"veryfront.com/component": "workflow-run-execution",
|
|
37
37
|
"veryfront.com/manager": managerId,
|
|
38
|
-
"veryfront.com/
|
|
38
|
+
"veryfront.com/execution-id": executionId,
|
|
39
39
|
"veryfront.com/run-id": run.id,
|
|
40
40
|
"veryfront.com/workflow-id": run.workflowId,
|
|
41
41
|
"veryfront.com/tenant": tenantSlug,
|
|
@@ -48,8 +48,8 @@ export class K8sJobExecutor {
|
|
|
48
48
|
template: {
|
|
49
49
|
metadata: {
|
|
50
50
|
labels: {
|
|
51
|
-
"veryfront.com/component": "workflow-
|
|
52
|
-
"veryfront.com/
|
|
51
|
+
"veryfront.com/component": "workflow-run-execution",
|
|
52
|
+
"veryfront.com/execution-id": executionId,
|
|
53
53
|
"veryfront.com/run-id": run.id,
|
|
54
54
|
"veryfront.com/tenant": tenantSlug,
|
|
55
55
|
},
|
|
@@ -63,9 +63,9 @@ export class K8sJobExecutor {
|
|
|
63
63
|
image: this.config.image,
|
|
64
64
|
imagePullPolicy: this.config.imagePullPolicy,
|
|
65
65
|
env: [
|
|
66
|
-
{ name: "MODE", value: "
|
|
66
|
+
{ name: "MODE", value: "run" },
|
|
67
67
|
{ name: "WORKFLOW_RUN_ID", value: run.id },
|
|
68
|
-
{ name: "
|
|
68
|
+
{ name: "RUN_EXECUTION_ID", value: executionId },
|
|
69
69
|
...this.buildTenantEnv(run),
|
|
70
70
|
...Object.entries(env).map(([name, value]) => ({ name, value })),
|
|
71
71
|
],
|
|
@@ -79,51 +79,52 @@ export class K8sJobExecutor {
|
|
|
79
79
|
},
|
|
80
80
|
},
|
|
81
81
|
};
|
|
82
|
-
await this.k8sClient.
|
|
82
|
+
await this.k8sClient.createRunExecution(this.config.namespace, resource);
|
|
83
83
|
if (debug || this.config.debug) {
|
|
84
|
-
logger.info(`Created
|
|
84
|
+
logger.info(`Created run execution ${resourceName} for run ${run.id}`);
|
|
85
85
|
}
|
|
86
|
-
return
|
|
86
|
+
return executionId;
|
|
87
87
|
}
|
|
88
|
-
async
|
|
89
|
-
const
|
|
88
|
+
async getRunExecutionStatus(executionId) {
|
|
89
|
+
const resourceName = this.sanitizeResourceName(executionId);
|
|
90
90
|
try {
|
|
91
|
-
const
|
|
92
|
-
if (!
|
|
91
|
+
const k8sResource = await this.k8sClient.getRunExecutionResource(this.config.namespace, resourceName);
|
|
92
|
+
if (!k8sResource) {
|
|
93
93
|
return null;
|
|
94
94
|
}
|
|
95
|
-
return this.
|
|
95
|
+
return this.parseRunExecutionInfo(k8sResource, executionId);
|
|
96
96
|
}
|
|
97
97
|
catch (error) {
|
|
98
|
-
logger.debug("Failed to get K8s
|
|
98
|
+
logger.debug("Failed to get K8s run execution status", { error });
|
|
99
99
|
return null;
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
|
-
async
|
|
102
|
+
async listRunExecutions(managerId) {
|
|
103
103
|
const labelSelector = `veryfront.com/manager=${managerId}`;
|
|
104
|
-
const
|
|
105
|
-
return
|
|
106
|
-
const
|
|
107
|
-
|
|
104
|
+
const k8sResources = await this.k8sClient.listRunExecutions(this.config.namespace, labelSelector);
|
|
105
|
+
return k8sResources.map((k8sResource) => {
|
|
106
|
+
const executionId = k8sResource.metadata.labels["veryfront.com/execution-id"] ??
|
|
107
|
+
k8sResource.metadata.name;
|
|
108
|
+
return this.parseRunExecutionInfo(k8sResource, executionId);
|
|
108
109
|
});
|
|
109
110
|
}
|
|
110
|
-
async
|
|
111
|
-
const
|
|
111
|
+
async deleteRunExecution(executionId) {
|
|
112
|
+
const resourceName = this.sanitizeResourceName(executionId);
|
|
112
113
|
try {
|
|
113
|
-
await this.k8sClient.
|
|
114
|
+
await this.k8sClient.deleteRunExecution(this.config.namespace, resourceName);
|
|
114
115
|
if (this.config.debug) {
|
|
115
|
-
logger.info(`Deleted
|
|
116
|
+
logger.info(`Deleted run execution ${resourceName}`);
|
|
116
117
|
}
|
|
117
118
|
}
|
|
118
119
|
catch (error) {
|
|
119
|
-
logger.warn(`Failed to delete
|
|
120
|
+
logger.warn(`Failed to delete run execution ${resourceName}:`, error);
|
|
120
121
|
}
|
|
121
122
|
}
|
|
122
123
|
/**
|
|
123
|
-
* Convert
|
|
124
|
+
* Convert execution ID to a valid K8s resource name
|
|
124
125
|
*/
|
|
125
|
-
|
|
126
|
-
return `wf-${
|
|
126
|
+
sanitizeResourceName(executionId) {
|
|
127
|
+
return `wf-${executionId.replace(/_/g, "-").toLowerCase()}`;
|
|
127
128
|
}
|
|
128
129
|
/**
|
|
129
130
|
* Build tenant environment variables
|
|
@@ -149,46 +150,46 @@ export class K8sJobExecutor {
|
|
|
149
150
|
return env;
|
|
150
151
|
}
|
|
151
152
|
/**
|
|
152
|
-
* Parse K8s
|
|
153
|
+
* Parse K8s run execution response to RunExecutionInfo
|
|
153
154
|
*/
|
|
154
|
-
|
|
155
|
-
const runId =
|
|
155
|
+
parseRunExecutionInfo(k8sResource, executionId) {
|
|
156
|
+
const runId = k8sResource.metadata.labels["veryfront.com/run-id"] ?? "";
|
|
156
157
|
return {
|
|
157
|
-
|
|
158
|
+
executionId,
|
|
158
159
|
runId,
|
|
159
|
-
status: this.parseStatus(
|
|
160
|
-
createdAt: new Date(
|
|
161
|
-
startedAt:
|
|
162
|
-
completedAt:
|
|
163
|
-
? new Date(
|
|
160
|
+
status: this.parseStatus(k8sResource),
|
|
161
|
+
createdAt: new Date(k8sResource.metadata.creationTimestamp),
|
|
162
|
+
startedAt: k8sResource.status.startTime ? new Date(k8sResource.status.startTime) : undefined,
|
|
163
|
+
completedAt: k8sResource.status.completionTime
|
|
164
|
+
? new Date(k8sResource.status.completionTime)
|
|
164
165
|
: undefined,
|
|
165
|
-
error: this.extractError(
|
|
166
|
+
error: this.extractError(k8sResource),
|
|
166
167
|
metadata: {
|
|
167
|
-
k8sName:
|
|
168
|
+
k8sName: k8sResource.metadata.name,
|
|
168
169
|
namespace: this.config.namespace,
|
|
169
170
|
},
|
|
170
171
|
};
|
|
171
172
|
}
|
|
172
173
|
/**
|
|
173
|
-
* Parse K8s
|
|
174
|
+
* Parse K8s run execution status
|
|
174
175
|
*/
|
|
175
|
-
parseStatus(
|
|
176
|
-
if (
|
|
176
|
+
parseStatus(k8sResource) {
|
|
177
|
+
if (k8sResource.status.succeeded && k8sResource.status.succeeded > 0) {
|
|
177
178
|
return "succeeded";
|
|
178
179
|
}
|
|
179
|
-
if (
|
|
180
|
+
if (k8sResource.status.failed && k8sResource.status.failed > 0) {
|
|
180
181
|
return "failed";
|
|
181
182
|
}
|
|
182
|
-
if (
|
|
183
|
+
if (k8sResource.status.active && k8sResource.status.active > 0) {
|
|
183
184
|
return "running";
|
|
184
185
|
}
|
|
185
186
|
return "pending";
|
|
186
187
|
}
|
|
187
188
|
/**
|
|
188
|
-
* Extract error from K8s
|
|
189
|
+
* Extract error from K8s run execution
|
|
189
190
|
*/
|
|
190
|
-
extractError(
|
|
191
|
-
const failedCondition =
|
|
191
|
+
extractError(k8sResource) {
|
|
192
|
+
const failedCondition = k8sResource.status.conditions?.find((c) => c.type === "Failed" && c.status === "True");
|
|
192
193
|
if (failedCondition) {
|
|
193
194
|
return failedCondition.message ?? failedCondition.reason ?? "Unknown error";
|
|
194
195
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { RunExecutionConfig, RunExecutionInfo, RunExecutor } from "./types.js";
|
|
2
2
|
/**
|
|
3
|
-
* Process
|
|
3
|
+
* Process run executor configuration
|
|
4
4
|
*/
|
|
5
|
-
export interface
|
|
5
|
+
export interface ProcessRunExecutorConfig {
|
|
6
6
|
/** Command to run (default: "deno") */
|
|
7
7
|
command?: string;
|
|
8
8
|
/** Arguments for the command */
|
|
@@ -17,14 +17,14 @@ export interface ProcessJobExecutorConfig {
|
|
|
17
17
|
debug?: boolean;
|
|
18
18
|
}
|
|
19
19
|
/**
|
|
20
|
-
* Process
|
|
20
|
+
* Process run executor
|
|
21
21
|
*
|
|
22
|
-
* Spawns child processes for each
|
|
22
|
+
* Spawns child processes for each workflow run.
|
|
23
23
|
* Provides isolation at the process level (separate memory space).
|
|
24
24
|
*
|
|
25
25
|
* @example
|
|
26
26
|
* ```typescript
|
|
27
|
-
* const executor = new
|
|
27
|
+
* const executor = new ProcessRunExecutor({
|
|
28
28
|
* entrypointPath: "./src/workflow-run-entrypoint.ts",
|
|
29
29
|
* env: {
|
|
30
30
|
* REDIS_URL: "redis://localhost:6379",
|
|
@@ -37,14 +37,14 @@ export interface ProcessJobExecutorConfig {
|
|
|
37
37
|
* });
|
|
38
38
|
* ```
|
|
39
39
|
*/
|
|
40
|
-
export declare class
|
|
40
|
+
export declare class ProcessRunExecutor implements RunExecutor {
|
|
41
41
|
private config;
|
|
42
|
-
private
|
|
43
|
-
constructor(config:
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
42
|
+
private activeExecutions;
|
|
43
|
+
constructor(config: ProcessRunExecutorConfig);
|
|
44
|
+
createRunExecution(executionConfig: RunExecutionConfig): Promise<string>;
|
|
45
|
+
getRunExecutionStatus(executionId: string): Promise<RunExecutionInfo | null>;
|
|
46
|
+
listRunExecutions(managerId: string): Promise<RunExecutionInfo[]>;
|
|
47
|
+
deleteRunExecution(executionId: string): Promise<void>;
|
|
48
48
|
destroy(): Promise<void>;
|
|
49
49
|
/**
|
|
50
50
|
* Monitor a process and update its status when it exits
|
|
@@ -55,8 +55,8 @@ export declare class ProcessJobExecutor implements JobExecutor {
|
|
|
55
55
|
*/
|
|
56
56
|
private streamOutput;
|
|
57
57
|
/**
|
|
58
|
-
* Convert tracked
|
|
58
|
+
* Convert tracked execution to RunExecutionInfo
|
|
59
59
|
*/
|
|
60
|
-
private
|
|
60
|
+
private toRunExecutionInfo;
|
|
61
61
|
}
|
|
62
62
|
//# sourceMappingURL=process.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"process.d.ts","sourceRoot":"","sources":["../../../../../src/src/workflow/worker/executors/process.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"process.d.ts","sourceRoot":"","sources":["../../../../../src/src/workflow/worker/executors/process.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EACV,kBAAkB,EAClB,gBAAgB,EAEhB,WAAW,EACZ,MAAM,YAAY,CAAC;AAIpB;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC,uCAAuC;IACvC,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB,gCAAgC;IAChC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAEhB,iDAAiD;IACjD,cAAc,EAAE,MAAM,CAAC;IAEvB,8CAA8C;IAC9C,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb,uCAAuC;IACvC,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAE7B,2BAA2B;IAC3B,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAkBD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,qBAAa,kBAAmB,YAAW,WAAW;IACpD,OAAO,CAAC,MAAM,CAGZ;IACF,OAAO,CAAC,gBAAgB,CAAuC;gBAEnD,MAAM,EAAE,wBAAwB;IAS5C,kBAAkB,CAAC,eAAe,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC;IA8DxE,qBAAqB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC;IAS5E,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC;IAYjE,kBAAkB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAyBtD,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAkBxB;;OAEG;IACH,OAAO,CAAC,cAAc;IA8DtB;;OAEG;IACH,OAAO,CAAC,YAAY;IAkCpB;;OAEG;IACH,OAAO,CAAC,kBAAkB;CAe3B"}
|