@decaf-ts/as-graph 0.2.1 → 0.4.0
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 +158 -2
- package/dist/as-graph.cjs +1 -1
- package/dist/as-graph.cjs.map +1 -1
- package/dist/as-graph.js +1 -1
- package/dist/as-graph.js.map +1 -1
- package/lib/cjs/dagster/DagsterGraphEventBridge.cjs +344 -0
- package/lib/cjs/dagster/DagsterGraphEventBridge.cjs.map +1 -0
- package/lib/cjs/dagster/DagsterGraphExecutionBackend.cjs +789 -0
- package/lib/cjs/dagster/DagsterGraphExecutionBackend.cjs.map +1 -0
- package/lib/cjs/dagster/DagsterResultMapper.cjs +56 -0
- package/lib/cjs/dagster/DagsterResultMapper.cjs.map +1 -0
- package/lib/cjs/dagster/DagsterTypes.cjs +4 -0
- package/lib/cjs/dagster/DagsterTypes.cjs.map +1 -0
- package/lib/cjs/dagster/capabilities.cjs +102 -0
- package/lib/cjs/dagster/capabilities.cjs.map +1 -0
- package/lib/cjs/dagster/constants.cjs +92 -0
- package/lib/cjs/dagster/constants.cjs.map +1 -0
- package/lib/cjs/dagster/index.cjs +32 -0
- package/lib/cjs/dagster/index.cjs.map +1 -0
- package/lib/cjs/engine/constants.cjs +6 -1
- package/lib/cjs/engine/constants.cjs.map +1 -1
- package/lib/cjs/engine/execution/GraphCodeMode.cjs +137 -0
- package/lib/cjs/engine/execution/GraphCodeMode.cjs.map +1 -0
- package/lib/cjs/engine/execution/GraphExecutionBackend.cjs +89 -0
- package/lib/cjs/engine/execution/GraphExecutionBackend.cjs.map +1 -0
- package/lib/cjs/engine/execution/GraphExecutionBackendRegistry.cjs +107 -0
- package/lib/cjs/engine/execution/GraphExecutionBackendRegistry.cjs.map +1 -0
- package/lib/cjs/engine/execution/GraphExecutionEngine.cjs +250 -733
- package/lib/cjs/engine/execution/GraphExecutionEngine.cjs.map +1 -1
- package/lib/cjs/engine/execution/LocalGraphExecutionBackend.cjs +804 -0
- package/lib/cjs/engine/execution/LocalGraphExecutionBackend.cjs.map +1 -0
- package/lib/cjs/engine/execution/index.cjs +4 -0
- package/lib/cjs/engine/execution/index.cjs.map +1 -1
- package/lib/cjs/engine/index.cjs +4 -0
- package/lib/cjs/engine/index.cjs.map +1 -1
- package/lib/cjs/engine/runs/GraphRunService.cjs +61 -0
- package/lib/cjs/engine/runs/GraphRunService.cjs.map +1 -1
- package/lib/cjs/engine/services/GraphWorkflowService.cjs +33 -14
- package/lib/cjs/engine/services/GraphWorkflowService.cjs.map +1 -1
- package/lib/cjs/mastra/MastraCapabilities.cjs +171 -0
- package/lib/cjs/mastra/MastraCapabilities.cjs.map +1 -0
- package/lib/cjs/mastra/MastraConditionBridge.cjs +39 -0
- package/lib/cjs/mastra/MastraConditionBridge.cjs.map +1 -0
- package/lib/cjs/mastra/MastraEventBridge.cjs +486 -0
- package/lib/cjs/mastra/MastraEventBridge.cjs.map +1 -0
- package/lib/cjs/mastra/MastraGraphExecutionBackend.cjs +351 -0
- package/lib/cjs/mastra/MastraGraphExecutionBackend.cjs.map +1 -0
- package/lib/cjs/mastra/MastraResumeGuard.cjs +127 -0
- package/lib/cjs/mastra/MastraResumeGuard.cjs.map +1 -0
- package/lib/cjs/mastra/MastraSchemaConverter.cjs +124 -0
- package/lib/cjs/mastra/MastraSchemaConverter.cjs.map +1 -0
- package/lib/cjs/mastra/MastraWorkflowCompiler.cjs +461 -0
- package/lib/cjs/mastra/MastraWorkflowCompiler.cjs.map +1 -0
- package/lib/cjs/mastra/MastraWorkflowManager.cjs +401 -0
- package/lib/cjs/mastra/MastraWorkflowManager.cjs.map +1 -0
- package/lib/cjs/mastra/index.cjs +35 -0
- package/lib/cjs/mastra/index.cjs.map +1 -0
- package/lib/cjs/mastra/types.cjs +34 -0
- package/lib/cjs/mastra/types.cjs.map +1 -0
- package/lib/cjs/nest/graph/GraphEngineCapabilityManifest.cjs +136 -0
- package/lib/cjs/nest/graph/GraphEngineCapabilityManifest.cjs.map +1 -0
- package/lib/cjs/nest/graph/GraphEngineCapabilityService.cjs +140 -0
- package/lib/cjs/nest/graph/GraphEngineCapabilityService.cjs.map +1 -0
- package/lib/cjs/nest/graph/GraphEngineController.cjs +227 -0
- package/lib/cjs/nest/graph/GraphEngineController.cjs.map +1 -0
- package/lib/cjs/nest/graph/GraphExecutionModule.cjs +30 -2
- package/lib/cjs/nest/graph/GraphExecutionModule.cjs.map +1 -1
- package/lib/cjs/nest/graph/index.cjs +3 -0
- package/lib/cjs/nest/graph/index.cjs.map +1 -1
- package/lib/cjs/nest/graph/main.cjs +54 -0
- package/lib/cjs/nest/graph/main.cjs.map +1 -0
- package/lib/cjs/nest/graph/servingErrors.cjs +3 -0
- package/lib/cjs/nest/graph/servingErrors.cjs.map +1 -1
- package/lib/cjs/node/utility/code/node.cjs +11 -3
- package/lib/cjs/node/utility/code/node.cjs.map +1 -1
- package/lib/cjs/shared/graph/catalog/GraphManifestCompiler.cjs +2 -3
- package/lib/cjs/shared/graph/catalog/GraphManifestCompiler.cjs.map +1 -1
- package/lib/cjs/shared/graph/constants.cjs +8 -0
- package/lib/cjs/shared/graph/constants.cjs.map +1 -1
- package/lib/cjs/shared/graph/index.cjs +2 -1
- package/lib/cjs/shared/graph/index.cjs.map +1 -1
- package/lib/cjs/shared/graph/layout/GraphWorkflowLayout.cjs +146 -0
- package/lib/cjs/shared/graph/layout/GraphWorkflowLayout.cjs.map +1 -0
- package/lib/cjs/shared/graph/layout/index.cjs +23 -0
- package/lib/cjs/shared/graph/layout/index.cjs.map +1 -0
- package/lib/cjs/shared/graph/layout/layout-options.cjs +93 -0
- package/lib/cjs/shared/graph/layout/layout-options.cjs.map +1 -0
- package/lib/cjs/shared/ui/index.cjs +8 -10
- package/lib/cjs/shared/ui/index.cjs.map +1 -1
- package/lib/esm/dagster/DagsterGraphEventBridge.js +339 -0
- package/lib/esm/dagster/DagsterGraphEventBridge.js.map +1 -0
- package/lib/esm/dagster/DagsterGraphExecutionBackend.js +781 -0
- package/lib/esm/dagster/DagsterGraphExecutionBackend.js.map +1 -0
- package/lib/esm/dagster/DagsterResultMapper.js +51 -0
- package/lib/esm/dagster/DagsterResultMapper.js.map +1 -0
- package/lib/esm/dagster/DagsterTypes.js +2 -0
- package/lib/esm/dagster/DagsterTypes.js.map +1 -0
- package/lib/esm/dagster/capabilities.js +97 -0
- package/lib/esm/dagster/capabilities.js.map +1 -0
- package/lib/esm/dagster/constants.js +88 -0
- package/lib/esm/dagster/constants.js.map +1 -0
- package/lib/esm/dagster/index.js +15 -0
- package/lib/esm/dagster/index.js.map +1 -0
- package/lib/esm/engine/constants.js +5 -0
- package/lib/esm/engine/constants.js.map +1 -1
- package/lib/esm/engine/execution/GraphCodeMode.js +132 -0
- package/lib/esm/engine/execution/GraphCodeMode.js.map +1 -0
- package/lib/esm/engine/execution/GraphExecutionBackend.js +83 -0
- package/lib/esm/engine/execution/GraphExecutionBackend.js.map +1 -0
- package/lib/esm/engine/execution/GraphExecutionBackendRegistry.js +102 -0
- package/lib/esm/engine/execution/GraphExecutionBackendRegistry.js.map +1 -0
- package/lib/esm/engine/execution/GraphExecutionEngine.js +232 -716
- package/lib/esm/engine/execution/GraphExecutionEngine.js.map +1 -1
- package/lib/esm/engine/execution/LocalGraphExecutionBackend.js +799 -0
- package/lib/esm/engine/execution/LocalGraphExecutionBackend.js.map +1 -0
- package/lib/esm/engine/execution/index.js +4 -0
- package/lib/esm/engine/execution/index.js.map +1 -1
- package/lib/esm/engine/index.js +4 -0
- package/lib/esm/engine/index.js.map +1 -1
- package/lib/esm/engine/runs/GraphRunService.js +62 -1
- package/lib/esm/engine/runs/GraphRunService.js.map +1 -1
- package/lib/esm/engine/services/GraphWorkflowService.js +33 -14
- package/lib/esm/engine/services/GraphWorkflowService.js.map +1 -1
- package/lib/esm/mastra/MastraCapabilities.js +164 -0
- package/lib/esm/mastra/MastraCapabilities.js.map +1 -0
- package/lib/esm/mastra/MastraConditionBridge.js +34 -0
- package/lib/esm/mastra/MastraConditionBridge.js.map +1 -0
- package/lib/esm/mastra/MastraEventBridge.js +481 -0
- package/lib/esm/mastra/MastraEventBridge.js.map +1 -0
- package/lib/esm/mastra/MastraGraphExecutionBackend.js +346 -0
- package/lib/esm/mastra/MastraGraphExecutionBackend.js.map +1 -0
- package/lib/esm/mastra/MastraResumeGuard.js +123 -0
- package/lib/esm/mastra/MastraResumeGuard.js.map +1 -0
- package/lib/esm/mastra/MastraSchemaConverter.js +119 -0
- package/lib/esm/mastra/MastraSchemaConverter.js.map +1 -0
- package/lib/esm/mastra/MastraWorkflowCompiler.js +456 -0
- package/lib/esm/mastra/MastraWorkflowCompiler.js.map +1 -0
- package/lib/esm/mastra/MastraWorkflowManager.js +396 -0
- package/lib/esm/mastra/MastraWorkflowManager.js.map +1 -0
- package/lib/esm/mastra/index.js +18 -0
- package/lib/esm/mastra/index.js.map +1 -0
- package/lib/esm/mastra/types.js +30 -0
- package/lib/esm/mastra/types.js.map +1 -0
- package/lib/esm/nest/graph/GraphEngineCapabilityManifest.js +129 -0
- package/lib/esm/nest/graph/GraphEngineCapabilityManifest.js.map +1 -0
- package/lib/esm/nest/graph/GraphEngineCapabilityService.js +131 -0
- package/lib/esm/nest/graph/GraphEngineCapabilityService.js.map +1 -0
- package/lib/esm/nest/graph/GraphEngineController.js +218 -0
- package/lib/esm/nest/graph/GraphEngineController.js.map +1 -0
- package/lib/esm/nest/graph/GraphExecutionModule.js +30 -2
- package/lib/esm/nest/graph/GraphExecutionModule.js.map +1 -1
- package/lib/esm/nest/graph/index.js +3 -0
- package/lib/esm/nest/graph/index.js.map +1 -1
- package/lib/esm/nest/graph/main.js +51 -0
- package/lib/esm/nest/graph/main.js.map +1 -0
- package/lib/esm/nest/graph/servingErrors.js +3 -0
- package/lib/esm/nest/graph/servingErrors.js.map +1 -1
- package/lib/esm/node/utility/code/node.js +11 -3
- package/lib/esm/node/utility/code/node.js.map +1 -1
- package/lib/esm/shared/graph/GraphExecutionStateMapper.js.map +1 -1
- package/lib/esm/shared/graph/catalog/GraphManifestCompiler.js +2 -3
- package/lib/esm/shared/graph/catalog/GraphManifestCompiler.js.map +1 -1
- package/lib/esm/shared/graph/constants.js +8 -0
- package/lib/esm/shared/graph/constants.js.map +1 -1
- package/lib/esm/shared/graph/index.js +2 -1
- package/lib/esm/shared/graph/index.js.map +1 -1
- package/lib/esm/shared/graph/layout/GraphWorkflowLayout.js +107 -0
- package/lib/esm/shared/graph/layout/GraphWorkflowLayout.js.map +1 -0
- package/lib/esm/shared/graph/layout/index.js +6 -0
- package/lib/esm/shared/graph/layout/index.js.map +1 -0
- package/lib/esm/shared/graph/layout/layout-options.js +96 -0
- package/lib/esm/shared/graph/layout/layout-options.js.map +1 -0
- package/lib/esm/shared/ui/index.js +8 -10
- package/lib/esm/shared/ui/index.js.map +1 -1
- package/lib/types/dagster/DagsterGraphEventBridge.d.cts +142 -0
- package/lib/types/dagster/DagsterGraphEventBridge.d.mts +142 -0
- package/lib/types/dagster/DagsterGraphExecutionBackend.d.cts +323 -0
- package/lib/types/dagster/DagsterGraphExecutionBackend.d.mts +323 -0
- package/lib/types/dagster/DagsterResultMapper.d.cts +50 -0
- package/lib/types/dagster/DagsterResultMapper.d.mts +50 -0
- package/lib/types/dagster/DagsterTypes.d.cts +355 -0
- package/lib/types/dagster/DagsterTypes.d.mts +355 -0
- package/lib/types/dagster/capabilities.d.cts +34 -0
- package/lib/types/dagster/capabilities.d.mts +34 -0
- package/lib/types/dagster/constants.d.cts +87 -0
- package/lib/types/dagster/constants.d.mts +87 -0
- package/lib/types/dagster/index.d.cts +14 -0
- package/lib/types/dagster/index.d.mts +14 -0
- package/lib/types/engine/constants.d.cts +5 -0
- package/lib/types/engine/constants.d.mts +5 -0
- package/lib/types/engine/execution/GraphCodeMode.d.cts +52 -0
- package/lib/types/engine/execution/GraphCodeMode.d.mts +52 -0
- package/lib/types/engine/execution/GraphExecutionBackend.d.cts +306 -0
- package/lib/types/engine/execution/GraphExecutionBackend.d.mts +306 -0
- package/lib/types/engine/execution/GraphExecutionBackendRegistry.d.cts +59 -0
- package/lib/types/engine/execution/GraphExecutionBackendRegistry.d.mts +59 -0
- package/lib/types/engine/execution/GraphExecutionEngine.d.cts +116 -135
- package/lib/types/engine/execution/GraphExecutionEngine.d.mts +116 -135
- package/lib/types/engine/execution/LocalGraphExecutionBackend.d.cts +232 -0
- package/lib/types/engine/execution/LocalGraphExecutionBackend.d.mts +232 -0
- package/lib/types/engine/execution/index.d.cts +4 -0
- package/lib/types/engine/execution/index.d.mts +4 -0
- package/lib/types/engine/index.d.cts +4 -0
- package/lib/types/engine/index.d.mts +4 -0
- package/lib/types/engine/runs/GraphRunService.d.cts +19 -0
- package/lib/types/engine/runs/GraphRunService.d.mts +19 -0
- package/lib/types/engine/services/GraphWorkflowService.d.cts +22 -0
- package/lib/types/engine/services/GraphWorkflowService.d.mts +22 -0
- package/lib/types/mastra/MastraCapabilities.d.cts +91 -0
- package/lib/types/mastra/MastraCapabilities.d.mts +91 -0
- package/lib/types/mastra/MastraConditionBridge.d.cts +38 -0
- package/lib/types/mastra/MastraConditionBridge.d.mts +38 -0
- package/lib/types/mastra/MastraEventBridge.d.cts +189 -0
- package/lib/types/mastra/MastraEventBridge.d.mts +189 -0
- package/lib/types/mastra/MastraGraphExecutionBackend.d.cts +119 -0
- package/lib/types/mastra/MastraGraphExecutionBackend.d.mts +119 -0
- package/lib/types/mastra/MastraResumeGuard.d.cts +58 -0
- package/lib/types/mastra/MastraResumeGuard.d.mts +58 -0
- package/lib/types/mastra/MastraSchemaConverter.d.cts +39 -0
- package/lib/types/mastra/MastraSchemaConverter.d.mts +39 -0
- package/lib/types/mastra/MastraWorkflowCompiler.d.cts +218 -0
- package/lib/types/mastra/MastraWorkflowCompiler.d.mts +218 -0
- package/lib/types/mastra/MastraWorkflowManager.d.cts +220 -0
- package/lib/types/mastra/MastraWorkflowManager.d.mts +220 -0
- package/lib/types/mastra/index.d.cts +17 -0
- package/lib/types/mastra/index.d.mts +17 -0
- package/lib/types/mastra/types.d.cts +222 -0
- package/lib/types/mastra/types.d.mts +222 -0
- package/lib/types/nest/graph/GraphEngineCapabilityManifest.d.cts +87 -0
- package/lib/types/nest/graph/GraphEngineCapabilityManifest.d.mts +87 -0
- package/lib/types/nest/graph/GraphEngineCapabilityService.d.cts +98 -0
- package/lib/types/nest/graph/GraphEngineCapabilityService.d.mts +98 -0
- package/lib/types/nest/graph/GraphEngineController.d.cts +74 -0
- package/lib/types/nest/graph/GraphEngineController.d.mts +74 -0
- package/lib/types/nest/graph/GraphExecutionModule.d.cts +8 -0
- package/lib/types/nest/graph/GraphExecutionModule.d.mts +8 -0
- package/lib/types/nest/graph/index.d.cts +3 -0
- package/lib/types/nest/graph/index.d.mts +3 -0
- package/lib/types/nest/graph/main.d.cts +1 -0
- package/lib/types/nest/graph/main.d.mts +1 -0
- package/lib/types/nest/graph/servingErrors.d.cts +3 -1
- package/lib/types/nest/graph/servingErrors.d.mts +3 -1
- package/lib/types/node/utility/code/node.d.cts +1 -1
- package/lib/types/node/utility/code/node.d.mts +1 -1
- package/lib/types/shared/graph/GraphExecutionStateMapper.d.cts +5 -5
- package/lib/types/shared/graph/GraphExecutionStateMapper.d.mts +5 -5
- package/lib/types/shared/graph/constants.d.cts +8 -0
- package/lib/types/shared/graph/constants.d.mts +8 -0
- package/lib/types/shared/graph/index.d.cts +2 -1
- package/lib/types/shared/graph/index.d.mts +2 -1
- package/lib/types/shared/graph/layout/GraphWorkflowLayout.d.cts +49 -0
- package/lib/types/shared/graph/layout/GraphWorkflowLayout.d.mts +49 -0
- package/lib/types/shared/graph/layout/index.d.cts +5 -0
- package/lib/types/shared/graph/layout/index.d.mts +5 -0
- package/lib/types/shared/graph/layout/layout-options.d.cts +46 -0
- package/lib/types/shared/graph/layout/layout-options.d.mts +46 -0
- package/lib/types/shared/graph/types.d.cts +4 -3
- package/lib/types/shared/graph/types.d.mts +4 -3
- package/lib/types/shared/ui/index.d.cts +8 -10
- package/lib/types/shared/ui/index.d.mts +8 -10
- package/package.json +49 -6
- package/lib/cjs/shared/ui/GraphNodeView.cjs +0 -114
- package/lib/cjs/shared/ui/GraphNodeView.cjs.map +0 -1
- package/lib/cjs/shared/ui/GraphRunView.cjs +0 -96
- package/lib/cjs/shared/ui/GraphRunView.cjs.map +0 -1
- package/lib/cjs/shared/ui/GraphWorkflowView.cjs +0 -78
- package/lib/cjs/shared/ui/GraphWorkflowView.cjs.map +0 -1
- package/lib/cjs/shared/ui/types.cjs +0 -4
- package/lib/cjs/shared/ui/types.cjs.map +0 -1
- package/lib/esm/shared/ui/GraphNodeView.js +0 -107
- package/lib/esm/shared/ui/GraphNodeView.js.map +0 -1
- package/lib/esm/shared/ui/GraphRunView.js +0 -90
- package/lib/esm/shared/ui/GraphRunView.js.map +0 -1
- package/lib/esm/shared/ui/GraphWorkflowView.js +0 -72
- package/lib/esm/shared/ui/GraphWorkflowView.js.map +0 -1
- package/lib/esm/shared/ui/types.js +0 -2
- package/lib/esm/shared/ui/types.js.map +0 -1
- package/lib/types/shared/ui/GraphNodeView.d.cts +0 -48
- package/lib/types/shared/ui/GraphNodeView.d.mts +0 -48
- package/lib/types/shared/ui/GraphRunView.d.cts +0 -88
- package/lib/types/shared/ui/GraphRunView.d.mts +0 -88
- package/lib/types/shared/ui/GraphWorkflowView.d.cts +0 -18
- package/lib/types/shared/ui/GraphWorkflowView.d.mts +0 -18
- package/lib/types/shared/ui/types.d.cts +0 -200
- package/lib/types/shared/ui/types.d.mts +0 -200
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
11
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* @module as-graph/nest/graph/GraphEngineCapabilityService
|
|
15
|
+
* @summary Engine capability manifest + workflow-catalogue service (SAA-197).
|
|
16
|
+
* @description Holds the statically-derived, boot-time capability manifest and
|
|
17
|
+
* resolves the engine-scoped workflow listing/lookup through the engine-agnostic
|
|
18
|
+
* {@link GraphExecutionEngine} facade. The manifest is never rebuilt per request
|
|
19
|
+
* and no remote engine is probed (C21).
|
|
20
|
+
*/
|
|
21
|
+
import { Inject, Injectable, Optional } from "@nestjs/common";
|
|
22
|
+
import { InternalError } from "@decaf-ts/db-decorators";
|
|
23
|
+
import { GraphExecutionBackendRegistry } from "./../../engine/execution/GraphExecutionBackendRegistry.js";
|
|
24
|
+
import { buildGraphEngineCapabilityManifest, } from "./GraphEngineCapabilityManifest.js";
|
|
25
|
+
/** DI token for {@link GraphEngineCapabilityOptions}. */
|
|
26
|
+
export const GRAPH_ENGINE_CAPABILITY_OPTIONS = "GRAPH_ENGINE_CAPABILITY_OPTIONS";
|
|
27
|
+
/**
|
|
28
|
+
* Default rate limit for the engine capability routes: 120 requests per 60-second
|
|
29
|
+
* window, applied by the `@nestjs/throttler` guard on the `engines` bucket.
|
|
30
|
+
*/
|
|
31
|
+
export const DEFAULT_GRAPH_ENGINE_RATE_LIMIT = {
|
|
32
|
+
windowMs: 60_000,
|
|
33
|
+
maxRequests: 120,
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Owns the boot-time capability manifest and resolves engine-scoped workflow
|
|
37
|
+
* listing/lookup. The manifest is built once in the constructor from the
|
|
38
|
+
* registered backends; request handling never mutates it and never probes a remote
|
|
39
|
+
* engine.
|
|
40
|
+
*/
|
|
41
|
+
let GraphEngineCapabilityService = class GraphEngineCapabilityService {
|
|
42
|
+
/**
|
|
43
|
+
* @param options - Controller options (auth, default engine id, rate limit).
|
|
44
|
+
* @param engine - The engine facade resolving flavour-scoped listing/lookup.
|
|
45
|
+
*/
|
|
46
|
+
constructor(options = {}, engine) {
|
|
47
|
+
this.engine = engine;
|
|
48
|
+
this.manifest = buildGraphEngineCapabilityManifest(GraphExecutionBackendRegistry.list(), options.defaultEngineId);
|
|
49
|
+
this.engineIds = new Set(this.manifest.engines.map((engine) => engine.engineId));
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Returns a defensive copy of the statically-derived capability manifest.
|
|
53
|
+
*
|
|
54
|
+
* @returns The C20 capability manifest snapshot.
|
|
55
|
+
*/
|
|
56
|
+
manifestSnapshot() {
|
|
57
|
+
return {
|
|
58
|
+
engines: this.manifest.engines.map((engine) => ({
|
|
59
|
+
...engine,
|
|
60
|
+
capabilities: engine.capabilities.map((row) => ({ ...row })),
|
|
61
|
+
})),
|
|
62
|
+
defaultEngineId: this.manifest.defaultEngineId,
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Returns a defensive copy of a single allowlisted engine descriptor.
|
|
67
|
+
*
|
|
68
|
+
* @param engineId - The engine id to look up.
|
|
69
|
+
* @returns The engine descriptor, or `undefined` when not allowlisted.
|
|
70
|
+
*/
|
|
71
|
+
descriptor(engineId) {
|
|
72
|
+
const engine = this.manifest.engines.find((entry) => entry.engineId === engineId);
|
|
73
|
+
if (!engine)
|
|
74
|
+
return undefined;
|
|
75
|
+
return {
|
|
76
|
+
...engine,
|
|
77
|
+
capabilities: engine.capabilities.map((row) => ({ ...row })),
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Whether the engine id is registered and allowlisted.
|
|
82
|
+
*
|
|
83
|
+
* @param engineId - The engine id to check.
|
|
84
|
+
* @returns `true` when the id is an available engine.
|
|
85
|
+
*/
|
|
86
|
+
isKnownEngine(engineId) {
|
|
87
|
+
return this.engineIds.has(engineId);
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Lists the workflows a registered engine can surface through the engine-agnostic
|
|
91
|
+
* facade, which applies the fail-closed capability gate and the
|
|
92
|
+
* `GRAPH_BACKEND_WORKFLOWS_NOT_SUPPORTED` error code.
|
|
93
|
+
*
|
|
94
|
+
* @param engineId - The allowlisted engine id to list for.
|
|
95
|
+
* @param args - Optional decaf contextual arguments forwarded to the backend.
|
|
96
|
+
* @returns Workflow summaries.
|
|
97
|
+
* @throws {GraphExecutionError} when the engine declares no listing support.
|
|
98
|
+
*/
|
|
99
|
+
async listWorkflows(engineId, ...args) {
|
|
100
|
+
return await this.requireEngine().listEngineWorkflows(engineId, ...args);
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Looks up a single canonical workflow document on a registered engine through
|
|
104
|
+
* the engine-agnostic facade.
|
|
105
|
+
*
|
|
106
|
+
* @param engineId - The allowlisted engine id to read from.
|
|
107
|
+
* @param workflowId - The canonical workflow id to read.
|
|
108
|
+
* @param args - Optional decaf contextual arguments forwarded to the backend.
|
|
109
|
+
* @returns The canonical workflow document.
|
|
110
|
+
* @throws {GraphExecutionError} when the engine declares no lookup support.
|
|
111
|
+
*/
|
|
112
|
+
async getWorkflow(engineId, workflowId, ...args) {
|
|
113
|
+
return await this.requireEngine().getEngineWorkflow(engineId, workflowId, ...args);
|
|
114
|
+
}
|
|
115
|
+
/** Resolves the engine facade, failing closed when it is not wired. */
|
|
116
|
+
requireEngine() {
|
|
117
|
+
if (!this.engine) {
|
|
118
|
+
throw new InternalError("Graph engine is not available; engine workflow catalogue cannot be resolved");
|
|
119
|
+
}
|
|
120
|
+
return this.engine;
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
GraphEngineCapabilityService = __decorate([
|
|
124
|
+
Injectable(),
|
|
125
|
+
__param(0, Optional()),
|
|
126
|
+
__param(0, Inject(GRAPH_ENGINE_CAPABILITY_OPTIONS)),
|
|
127
|
+
__param(1, Optional()),
|
|
128
|
+
__metadata("design:paramtypes", [Object, Function])
|
|
129
|
+
], GraphEngineCapabilityService);
|
|
130
|
+
export { GraphEngineCapabilityService };
|
|
131
|
+
//# sourceMappingURL=GraphEngineCapabilityService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GraphEngineCapabilityService.js","sourceRoot":"","sources":["../../../../src/nest/graph/GraphEngineCapabilityService.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE9D,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAIxD,OAAO,EAAE,6BAA6B,EAAE,kEAA6D;AAGrG,OAAO,EACL,kCAAkC,GAGnC,2CAAwC;AAEzC,yDAAyD;AACzD,MAAM,CAAC,MAAM,+BAA+B,GAC1C,iCAAiC,CAAC;AAQpC;;;GAGG;AACH,MAAM,CAAC,MAAM,+BAA+B,GAC1C;IACE,QAAQ,EAAE,MAAM;IAChB,WAAW,EAAE,GAAG;CACjB,CAAC;AAwBJ;;;;;GAKG;AAEI,IAAM,4BAA4B,GAAlC,MAAM,4BAA4B;IAIvC;;;OAGG;IACH,YAGE,UAAwC,EAAE,EAEzB,MAA6B;QAA7B,WAAM,GAAN,MAAM,CAAuB;QAE9C,IAAI,CAAC,QAAQ,GAAG,kCAAkC,CAChD,6BAA6B,CAAC,IAAI,EAAE,EACpC,OAAO,CAAC,eAAe,CACxB,CAAC;QACF,IAAI,CAAC,SAAS,GAAG,IAAI,GAAG,CACtB,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,CA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gB,EAChB,UAAkB,EAClB,GAAG,IAAiC;QAEpC,OAAO,MAAM,IAAI,CAAC,aAAa,EAAE,CAAC,iBAAiB,CACjD,QAAQ,EACR,UAAU,EACV,GAAG,IAAI,CACR,CAAC;IACJ,CAAC;IAED,uEAAuE;IAC/D,aAAa;QACnB,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;YACjB,MAAM,IAAI,aAAa,CACrB,6EAA6E,CAC9E,CAAC;QACJ,CAAC;QACD,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;CACF,CAAA;AAlHY,4BAA4B;IADxC,UAAU,EAAE;IAUR,WAAA,QAAQ,EAAE,CAAA;IACV,WAAA,MAAM,CAAC,+BAA+B,CAAC,CAAA;IAEvC,WAAA,QAAQ,EAAE,CAAA;;GAZF,4BAA4B,CAkHxC"}
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
11
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* @module as-graph/nest/graph/GraphEngineController
|
|
15
|
+
* @summary Engine capability manifest + workflow-catalogue HTTP API (SAA-197,
|
|
16
|
+
* SAA-193 C20/C21).
|
|
17
|
+
* @description Serves the statically-derived engine capability manifest and the
|
|
18
|
+
* engine-scoped workflow listing/lookup over read-only `GET` routes under the
|
|
19
|
+
* `graph/engines` namespace. The routes carry the same authentication posture
|
|
20
|
+
* as the other graph read routes, select engines by allowlisted id only (zero query
|
|
21
|
+
* reflection), are rate-limited on the dedicated `engines` throttler bucket, and
|
|
22
|
+
* map engine errors without ever surfacing `GraphExecutionError.details`.
|
|
23
|
+
*/
|
|
24
|
+
import { Controller, Get, HttpException, HttpStatus, Inject, NotFoundException, Optional, Param, } from "@nestjs/common";
|
|
25
|
+
import { SkipThrottle, Throttle } from "@nestjs/throttler";
|
|
26
|
+
import { NotFoundError } from "@decaf-ts/db-decorators";
|
|
27
|
+
import { DecafRequestContext } from "@decaf-ts/for-nest";
|
|
28
|
+
import { GraphExecutionError } from "./../../engine/errors/GraphExecutionError.js";
|
|
29
|
+
import { graphWorkflowOwnerOf } from "./../../engine/services/GraphWorkflowService.js";
|
|
30
|
+
import { GRAPH_ENGINE_CAPABILITY_OPTIONS, GraphEngineCapabilityService, } from "./GraphEngineCapabilityService.js";
|
|
31
|
+
import { toIsoDateString } from "./servingDates.js";
|
|
32
|
+
import { GRAPH_SERVING_INTERNAL_ERROR_MESSAGE, logUnmappedGraphServingError, } from "./servingErrors.js";
|
|
33
|
+
/**
|
|
34
|
+
* Maps a thrown engine-catalogue error to the Nest HTTP equivalent: a backend
|
|
35
|
+
* that declares no workflow catalogue becomes `501`, and any other unmapped error
|
|
36
|
+
* surfaces as a constant generic `500` with the underlying error logged
|
|
37
|
+
* server-side only. `GraphExecutionError.details` is never surfaced to clients.
|
|
38
|
+
*
|
|
39
|
+
* @param {unknown} e - The caught error from the engine facade.
|
|
40
|
+
* @param {GraphServingErrorCorrelation} [correlation] - Request correlation ids attached to the server-side log.
|
|
41
|
+
* @return {HttpException} The HTTP-mapped error to rethrow.
|
|
42
|
+
*/
|
|
43
|
+
function graphEngineHttpErrorOf(e, correlation = {}) {
|
|
44
|
+
if (e instanceof GraphExecutionError) {
|
|
45
|
+
if (e.graphCode === "GRAPH_BACKEND_WORKFLOWS_NOT_SUPPORTED") {
|
|
46
|
+
return new HttpException("Graph workflow catalogue is not supported by the selected engine", HttpStatus.NOT_IMPLEMENTED);
|
|
47
|
+
}
|
|
48
|
+
logUnmappedGraphServingError("GraphEngineController", e, correlation);
|
|
49
|
+
return new HttpException(GRAPH_SERVING_INTERNAL_ERROR_MESSAGE, HttpStatus.INTERNAL_SERVER_ERROR);
|
|
50
|
+
}
|
|
51
|
+
if (e instanceof NotFoundError) {
|
|
52
|
+
return new NotFoundException(e.message);
|
|
53
|
+
}
|
|
54
|
+
if (e instanceof HttpException)
|
|
55
|
+
return e;
|
|
56
|
+
logUnmappedGraphServingError("GraphEngineController", e, correlation);
|
|
57
|
+
return new HttpException(GRAPH_SERVING_INTERNAL_ERROR_MESSAGE, HttpStatus.INTERNAL_SERVER_ERROR);
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Engine capability manifest and engine-scoped workflow catalogue endpoints:
|
|
61
|
+
*
|
|
62
|
+
* - `GET /graph/engines` — the C20 capability manifest for every available
|
|
63
|
+
* (registered, allowlisted) engine.
|
|
64
|
+
* - `GET /graph/engines/{engineId}` — one engine descriptor.
|
|
65
|
+
* - `GET /graph/engines/{engineId}/workflows` — the workflows that engine
|
|
66
|
+
* surfaces through the engine-agnostic facade.
|
|
67
|
+
* - `GET /graph/engines/{engineId}/workflows/{workflowId}` — one canonical
|
|
68
|
+
* workflow document from that engine.
|
|
69
|
+
*
|
|
70
|
+
* All routes are read-only `GET`s, select engines by allowlisted id only, and
|
|
71
|
+
* never reflect arbitrary query input.
|
|
72
|
+
*/
|
|
73
|
+
let GraphEngineController = class GraphEngineController {
|
|
74
|
+
constructor(capabilityService, requestContext, options = {}) {
|
|
75
|
+
this.capabilityService = capabilityService;
|
|
76
|
+
this.requestContext = requestContext;
|
|
77
|
+
this.options = options;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Enforces the configured authentication mode: `auth` defaults to `"required"`
|
|
81
|
+
* and rejects a request with no request context, or with a context that carries
|
|
82
|
+
* no resolved owner user, with `401`; `"optional"` admits anonymous requests.
|
|
83
|
+
*/
|
|
84
|
+
requireAuthenticatedContext() {
|
|
85
|
+
if ((this.options.auth ?? "required") !== "required") {
|
|
86
|
+
return this.requestContext;
|
|
87
|
+
}
|
|
88
|
+
if (!this.requestContext) {
|
|
89
|
+
throw new HttpException("Graph engine access requires an authenticated request context", HttpStatus.UNAUTHORIZED);
|
|
90
|
+
}
|
|
91
|
+
if (graphWorkflowOwnerOf(this.requestContext) === undefined) {
|
|
92
|
+
throw new HttpException("Graph engine access requires an authenticated user", HttpStatus.UNAUTHORIZED);
|
|
93
|
+
}
|
|
94
|
+
return this.requestContext;
|
|
95
|
+
}
|
|
96
|
+
assertKnownEngine(engineId) {
|
|
97
|
+
if (!this.capabilityService.isKnownEngine(engineId)) {
|
|
98
|
+
throw new NotFoundException(`No graph engine '${engineId}' is available`);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Returns the capability manifest for every available engine.
|
|
103
|
+
*
|
|
104
|
+
* @return {Promise<GraphEngineCapabilityManifest>} The C20 capability manifest.
|
|
105
|
+
* @throws {HttpException} 401 without an authenticated caller.
|
|
106
|
+
*/
|
|
107
|
+
async getManifest() {
|
|
108
|
+
this.requireAuthenticatedContext();
|
|
109
|
+
return this.capabilityService.manifestSnapshot();
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Returns one allowlisted engine's capability descriptor.
|
|
113
|
+
*
|
|
114
|
+
* @param {string} engineId - Allowlisted engine id path parameter.
|
|
115
|
+
* @return {Promise<GraphEngineDescriptor>} The engine descriptor.
|
|
116
|
+
* @throws {HttpException} 404 when the engine id is not available.
|
|
117
|
+
*/
|
|
118
|
+
async getEngine(engineId) {
|
|
119
|
+
this.requireAuthenticatedContext();
|
|
120
|
+
const engine = this.capabilityService.descriptor(engineId);
|
|
121
|
+
if (!engine) {
|
|
122
|
+
throw new NotFoundException(`No graph engine '${engineId}' is available`);
|
|
123
|
+
}
|
|
124
|
+
return engine;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Lists the workflows the selected engine surfaces through the
|
|
128
|
+
* engine-agnostic facade.
|
|
129
|
+
*
|
|
130
|
+
* @param {string} engineId - Allowlisted engine id path parameter.
|
|
131
|
+
* @return {Promise<GraphEngineWorkflowSummary[]>} Workflow summaries.
|
|
132
|
+
* @throws {HttpException} 404 for an unknown engine id, 501 when the engine declares no listing support.
|
|
133
|
+
*/
|
|
134
|
+
async listWorkflows(engineId) {
|
|
135
|
+
const context = this.requireAuthenticatedContext();
|
|
136
|
+
this.assertKnownEngine(engineId);
|
|
137
|
+
try {
|
|
138
|
+
const summaries = await this.capabilityService.listWorkflows(engineId, context);
|
|
139
|
+
return summaries.map((summary) => {
|
|
140
|
+
const updatedAt = toIsoDateString(summary.updatedAt);
|
|
141
|
+
return {
|
|
142
|
+
workflowId: summary.id,
|
|
143
|
+
...(summary.name !== undefined ? { name: summary.name } : {}),
|
|
144
|
+
...(updatedAt !== undefined ? { updatedAt } : {}),
|
|
145
|
+
};
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
catch (e) {
|
|
149
|
+
throw graphEngineHttpErrorOf(e, { engineId });
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Returns one canonical workflow document from the selected engine through the
|
|
154
|
+
* engine-agnostic facade.
|
|
155
|
+
*
|
|
156
|
+
* @param {string} engineId - Allowlisted engine id path parameter.
|
|
157
|
+
* @param {string} workflowId - Canonical workflow id path parameter.
|
|
158
|
+
* @return {Promise<GraphWorkflowDocument>} The canonical workflow document.
|
|
159
|
+
* @throws {HttpException} 404 for an unknown engine id, 501 when the engine declares no lookup support.
|
|
160
|
+
*/
|
|
161
|
+
async getWorkflow(engineId, workflowId) {
|
|
162
|
+
const context = this.requireAuthenticatedContext();
|
|
163
|
+
this.assertKnownEngine(engineId);
|
|
164
|
+
try {
|
|
165
|
+
return await this.capabilityService.getWorkflow(engineId, workflowId, context);
|
|
166
|
+
}
|
|
167
|
+
catch (e) {
|
|
168
|
+
throw graphEngineHttpErrorOf(e, { engineId, workflowId });
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
};
|
|
172
|
+
__decorate([
|
|
173
|
+
SkipThrottle({ default: true }),
|
|
174
|
+
Throttle({ engines: {} }),
|
|
175
|
+
Get(),
|
|
176
|
+
__metadata("design:type", Function),
|
|
177
|
+
__metadata("design:paramtypes", []),
|
|
178
|
+
__metadata("design:returntype", Promise)
|
|
179
|
+
], GraphEngineController.prototype, "getManifest", null);
|
|
180
|
+
__decorate([
|
|
181
|
+
SkipThrottle({ default: true }),
|
|
182
|
+
Throttle({ engines: {} }),
|
|
183
|
+
Get(":engineId"),
|
|
184
|
+
__param(0, Param("engineId")),
|
|
185
|
+
__metadata("design:type", Function),
|
|
186
|
+
__metadata("design:paramtypes", [String]),
|
|
187
|
+
__metadata("design:returntype", Promise)
|
|
188
|
+
], GraphEngineController.prototype, "getEngine", null);
|
|
189
|
+
__decorate([
|
|
190
|
+
SkipThrottle({ default: true }),
|
|
191
|
+
Throttle({ engines: {} }),
|
|
192
|
+
Get(":engineId/workflows"),
|
|
193
|
+
__param(0, Param("engineId")),
|
|
194
|
+
__metadata("design:type", Function),
|
|
195
|
+
__metadata("design:paramtypes", [String]),
|
|
196
|
+
__metadata("design:returntype", Promise)
|
|
197
|
+
], GraphEngineController.prototype, "listWorkflows", null);
|
|
198
|
+
__decorate([
|
|
199
|
+
SkipThrottle({ default: true }),
|
|
200
|
+
Throttle({ engines: {} }),
|
|
201
|
+
Get(":engineId/workflows/:workflowId"),
|
|
202
|
+
__param(0, Param("engineId")),
|
|
203
|
+
__param(1, Param("workflowId")),
|
|
204
|
+
__metadata("design:type", Function),
|
|
205
|
+
__metadata("design:paramtypes", [String, String]),
|
|
206
|
+
__metadata("design:returntype", Promise)
|
|
207
|
+
], GraphEngineController.prototype, "getWorkflow", null);
|
|
208
|
+
GraphEngineController = __decorate([
|
|
209
|
+
Controller("graph/engines"),
|
|
210
|
+
__param(1, Optional()),
|
|
211
|
+
__param(1, Inject(DecafRequestContext)),
|
|
212
|
+
__param(2, Optional()),
|
|
213
|
+
__param(2, Inject(GRAPH_ENGINE_CAPABILITY_OPTIONS)),
|
|
214
|
+
__metadata("design:paramtypes", [GraphEngineCapabilityService,
|
|
215
|
+
DecafRequestContext, Object])
|
|
216
|
+
], GraphEngineController);
|
|
217
|
+
export { GraphEngineController };
|
|
218
|
+
//# sourceMappingURL=GraphEngineController.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GraphEngineController.js","sourceRoot":"","sources":["../../../../src/nest/graph/GraphEngineController.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;GAUG;AACH,OAAO,EACL,UAAU,EACV,GAAG,EACH,aAAa,EACb,UAAU,EACV,MAAM,EACN,iBAAiB,EACjB,QAAQ,EACR,KAAK,GACN,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAEzD,OAAO,EAAE,mBAAmB,EAAE,qDAAgD;AAC9E,OAAO,EAAE,oBAAoB,EAAE,wDAAmD;AAKlF,OAAO,EACL,+BAA+B,EAC/B,4BAA4B,GAE7B,0CAAuC;AACxC,OAAO,EAAE,eAAe,EAAE,0BAAuB;AACjD,OAAO,EACL,oCAAoC,EACpC,4BAA4B,GAE7B,2BAAwB;AAYzB;;;;;;;;;GASG;AACH,SAAS,sBAAsB,CAC7B,CAAU,EACV,cAA4C,EAAE;IA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EAAE,CAAC;IACzB,GAAG,CAAC,WAAW,CAAC;IAEd,WAAA,KAAK,CAAC,UAAU,CAAC,CAAA;;;;sDAUnB;AAaK;IAHL,YAAY,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IAC/B,QAAQ,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;IACzB,GAAG,CAAC,qBAAqB,CAAC;IAExB,WAAA,KAAK,CAAC,UAAU,CAAC,CAAA;;;;0DAoBnB;AAcK;IAHL,YAAY,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IAC/B,QAAQ,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;IACzB,GAAG,CAAC,iCAAiC,CAAC;IAEpC,WAAA,KAAK,CAAC,UAAU,CAAC,CAAA;IACjB,WAAA,KAAK,CAAC,YAAY,CAAC,CAAA;;;;wDAarB;AA7IU,qBAAqB;IADjC,UAAU,CAAC,eAAe,CAAC;IAIvB,WAAA,QAAQ,EAAE,CAAA;IACV,WAAA,MAAM,CAAC,mBAAmB,CAAC,CAAA;IAE3B,WAAA,QAAQ,EAAE,CAAA;IACV,WAAA,MAAM,CAAC,+BAA+B,CAAC,CAAA;qCALJ,4BAA4B;QAG9B,mBAAmB;GAL5C,qBAAqB,CA8IjC"}
|
|
@@ -28,7 +28,10 @@ import { DEFAULT_GRAPH_CATALOGUE_RATE_LIMIT, GraphNodeCatalogueController, GRAPH
|
|
|
28
28
|
import { GraphRunController, GRAPH_RUN_OPTIONS, } from "./GraphRunController.js";
|
|
29
29
|
import { GraphWorkflowService } from "./../../engine/services/GraphWorkflowService.js";
|
|
30
30
|
import { GraphEnvironment } from "./../../engine/services/GraphEnvironment.js";
|
|
31
|
+
import { GRAPH_CODE_MAX_TIMEOUT_MS } from "./../../engine/constants.js";
|
|
31
32
|
import { GraphWorkflowController, GRAPH_WORKFLOW_OPTIONS, } from "./GraphWorkflowController.js";
|
|
33
|
+
import { GraphEngineController, } from "./GraphEngineController.js";
|
|
34
|
+
import { DEFAULT_GRAPH_ENGINE_RATE_LIMIT, GRAPH_ENGINE_CAPABILITY_OPTIONS, GraphEngineCapabilityService, } from "./GraphEngineCapabilityService.js";
|
|
32
35
|
/**
|
|
33
36
|
* Generous app-wide default request-rate limit (SAA-1950 F7). The expensive
|
|
34
37
|
* catalogue `resolve`/`methods` routes carry their own `@Throttle` limits; every
|
|
@@ -99,10 +102,16 @@ let GraphExecutionModule = GraphExecutionModule_1 = class GraphExecutionModule {
|
|
|
99
102
|
...DEFAULT_GRAPH_CATALOGUE_RATE_LIMIT,
|
|
100
103
|
...(catalogueOptions.methodsRateLimit ?? {}),
|
|
101
104
|
};
|
|
105
|
+
const engineOptions = options.engines ?? {};
|
|
106
|
+
const engineRateLimit = {
|
|
107
|
+
...DEFAULT_GRAPH_ENGINE_RATE_LIMIT,
|
|
108
|
+
...(engineOptions.rateLimit ?? {}),
|
|
109
|
+
};
|
|
102
110
|
// Backend services consume their options from the accumulated graph
|
|
103
111
|
// environment (`@decaf-ts/logging`), never from injectable config objects.
|
|
104
112
|
// Host-supplied `workflows` options are accumulated into the environment
|
|
105
|
-
// before the service provider is built.
|
|
113
|
+
// before the service provider is built. The `execution` sibling leaf is
|
|
114
|
+
// accumulated in the same call so it survives the raw-object accumulate.
|
|
106
115
|
if (options.workflows) {
|
|
107
116
|
const serviceOptions = {};
|
|
108
117
|
if (options.workflows.limits) {
|
|
@@ -115,6 +124,7 @@ let GraphExecutionModule = GraphExecutionModule_1 = class GraphExecutionModule {
|
|
|
115
124
|
GraphEnvironment.accumulate({
|
|
116
125
|
graph: {
|
|
117
126
|
workflows: serviceOptions,
|
|
127
|
+
execution: { maxCodeTimeoutMs: GRAPH_CODE_MAX_TIMEOUT_MS },
|
|
118
128
|
},
|
|
119
129
|
});
|
|
120
130
|
}
|
|
@@ -168,11 +178,12 @@ let GraphExecutionModule = GraphExecutionModule_1 = class GraphExecutionModule {
|
|
|
168
178
|
const providers = [
|
|
169
179
|
{
|
|
170
180
|
provide: GraphExecutionEngine,
|
|
171
|
-
useFactory: async () => {
|
|
181
|
+
useFactory: async (workflowService) => {
|
|
172
182
|
const config = await sharedConfig();
|
|
173
183
|
const engine = new GraphExecutionEngine();
|
|
174
184
|
await engine.boot({
|
|
175
185
|
...config,
|
|
186
|
+
workflowStore: workflowService,
|
|
176
187
|
authEnabled: resolveGraphAuthEnabled(options),
|
|
177
188
|
...(options.authMatch ? { authMatch: options.authMatch } : {}),
|
|
178
189
|
...(options.credentialAuthorizer
|
|
@@ -181,6 +192,7 @@ let GraphExecutionModule = GraphExecutionModule_1 = class GraphExecutionModule {
|
|
|
181
192
|
});
|
|
182
193
|
return engine;
|
|
183
194
|
},
|
|
195
|
+
inject: [GraphWorkflowService],
|
|
184
196
|
},
|
|
185
197
|
{
|
|
186
198
|
provide: GraphNodeCatalogue,
|
|
@@ -198,6 +210,15 @@ let GraphExecutionModule = GraphExecutionModule_1 = class GraphExecutionModule {
|
|
|
198
210
|
provide: GRAPH_RUN_OPTIONS,
|
|
199
211
|
useValue: (options.runs ?? {}),
|
|
200
212
|
},
|
|
213
|
+
{
|
|
214
|
+
provide: GRAPH_ENGINE_CAPABILITY_OPTIONS,
|
|
215
|
+
useValue: engineOptions,
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
provide: GraphEngineCapabilityService,
|
|
219
|
+
useFactory: (engine) => new GraphEngineCapabilityService(engineOptions, engine),
|
|
220
|
+
inject: [GraphExecutionEngine],
|
|
221
|
+
},
|
|
201
222
|
{
|
|
202
223
|
provide: RamGraphRunStore,
|
|
203
224
|
useFactory: async () => new RamGraphRunStore(await sharedRunAdapter()),
|
|
@@ -244,6 +265,11 @@ let GraphExecutionModule = GraphExecutionModule_1 = class GraphExecutionModule {
|
|
|
244
265
|
ttl: methodsRateLimit.windowMs,
|
|
245
266
|
limit: methodsRateLimit.maxRequests,
|
|
246
267
|
},
|
|
268
|
+
{
|
|
269
|
+
name: "engines",
|
|
270
|
+
ttl: engineRateLimit.windowMs,
|
|
271
|
+
limit: engineRateLimit.maxRequests,
|
|
272
|
+
},
|
|
247
273
|
]),
|
|
248
274
|
];
|
|
249
275
|
// Auth (for-nest pattern): when the host supplies an AuthHandler, install
|
|
@@ -264,6 +290,7 @@ let GraphExecutionModule = GraphExecutionModule_1 = class GraphExecutionModule {
|
|
|
264
290
|
GraphNodeCatalogueController,
|
|
265
291
|
GraphWorkflowController,
|
|
266
292
|
GraphRunController,
|
|
293
|
+
GraphEngineController,
|
|
267
294
|
],
|
|
268
295
|
providers: [
|
|
269
296
|
...providers,
|
|
@@ -276,6 +303,7 @@ let GraphExecutionModule = GraphExecutionModule_1 = class GraphExecutionModule {
|
|
|
276
303
|
RamGraphRunEventStore,
|
|
277
304
|
GraphRunService,
|
|
278
305
|
GraphWorkflowService,
|
|
306
|
+
GraphEngineCapabilityService,
|
|
279
307
|
],
|
|
280
308
|
};
|
|
281
309
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GraphExecutionModule.js","sourceRoot":"","sources":["../../../../src/nest/graph/GraphExecutionModule.ts"],"names":[],"mappings":";;;;;;;AAAA;;;;;;;;;GASG;AACH,OAAO,EAAiB,MAAM,EAAkB,MAAM,gBAAgB,CAAC;AACvE,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpE,OAAO,EACL,eAAe,GAEhB,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAE5D,OAAO,EACL,oBAAoB,EACpB,kBAAkB,EAClB,eAAe,EACf,eAAe,GAGhB,yBAAe;AAChB,OAAO,EACL,qBAAqB,EACrB,gBAAgB,GACjB,6BAAkB;AACnB,OAAO,EAAE,sBAAsB,EAAE,0CAAuC;AACxE,OAAO,EACL,kCAAkC,EAClC,4BAA4B,EAC5B,kCAAkC,GAEnC,0CAAuC;AACxC,OAAO,EACL,kBAAkB,EAClB,iBAAiB,GAElB,gCAA6B;AAC9B,OAAO,EAAE,oBAAoB,EAAE,wDAAmD;AAClF,OAAO,EAAE,gBAAgB,EAAE,oDAA+C;
|
|
1
|
+
{"version":3,"file":"GraphExecutionModule.js","sourceRoot":"","sources":["../../../../src/nest/graph/GraphExecutionModule.ts"],"names":[],"mappings":";;;;;;;AAAA;;;;;;;;;GASG;AACH,OAAO,EAAiB,MAAM,EAAkB,MAAM,gBAAgB,CAAC;AACvE,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpE,OAAO,EACL,eAAe,GAEhB,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAE5D,OAAO,EACL,oBAAoB,EACpB,kBAAkB,EAClB,eAAe,EACf,eAAe,GAGhB,yBAAe;AAChB,OAAO,EACL,qBAAqB,EACrB,gBAAgB,GACjB,6BAAkB;AACnB,OAAO,EAAE,sBAAsB,EAAE,0CAAuC;AACxE,OAAO,EACL,kCAAkC,EAClC,4BAA4B,EAC5B,kCAAkC,GAEnC,0CAAuC;AACxC,OAAO,EACL,kBAAkB,EAClB,iBAAiB,GAElB,gCAA6B;AAC9B,OAAO,EAAE,oBAAoB,EAAE,wDAAmD;AAClF,OAAO,EAAE,gBAAgB,EAAE,oDAA+C;AAE1E,OAAO,EAAE,yBAAyB,EAAE,oCAA+B;AAEnE,OAAO,EACL,uBAAuB,EACvB,sBAAsB,GAEvB,qCAAkC;AACnC,OAAO,EACL,qBAAqB,GACtB,mCAAgC;AACjC,OAAO,EACL,+BAA+B,EAC/B,+BAA+B,EAC/B,4BAA4B,GAE7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AAC;CACF,CAAA;AAjQY,oBAAoB;IADhC,MAAM,CAAC,EAAE,CAAC;GACE,oBAAoB,CAiQhC"}
|
|
@@ -9,5 +9,8 @@ export * from "./GraphWorkflowController.js";
|
|
|
9
9
|
export * from "./GraphRunController.js";
|
|
10
10
|
export * from "./GraphExecutorRegistryFactory.js";
|
|
11
11
|
export * from "./GraphNodeCatalogueController.js";
|
|
12
|
+
export * from "./GraphEngineCapabilityManifest.js";
|
|
13
|
+
export * from "./GraphEngineCapabilityService.js";
|
|
14
|
+
export * from "./GraphEngineController.js";
|
|
12
15
|
export * from "./GraphExecutionModule.js";
|
|
13
16
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/nest/graph/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,6CAA0C;AAC1C,wCAAqC;AACrC,kDAA+C;AAC/C,kDAA+C;AAC/C,0CAAuC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/nest/graph/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,6CAA0C;AAC1C,wCAAqC;AACrC,kDAA+C;AAC/C,kDAA+C;AAC/C,mDAAgD;AAChD,kDAA+C;AAC/C,2CAAwC;AACxC,0CAAuC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module as-graph/nest/graph/main
|
|
3
|
+
* @summary Standalone NestJS bootstrap for the as-graph execution backend.
|
|
4
|
+
* @description Starts a NestJS HTTP server hosting
|
|
5
|
+
* {@link GraphExecutionModule} on the given port (default 3000). Used by the
|
|
6
|
+
* for-angular `start:backend`/`start:dev` scripts so the graph page has an
|
|
7
|
+
* SSE backend to talk to during development.
|
|
8
|
+
*
|
|
9
|
+
* Development-only posture (SAA-595 F5): the server binds to `127.0.0.1`
|
|
10
|
+
* only and CORS admits `http://localhost`/`http://127.0.0.1` origins only,
|
|
11
|
+
* with the DECAF-48 §4.15 standalone anonymous tolerances (`auth:
|
|
12
|
+
* "optional"` + `allowAnonymousAccess`) opted in explicitly for the local
|
|
13
|
+
* run/workflow APIs. `initAdapter: true` installs the standalone RamAdapter
|
|
14
|
+
* so the entry boots without a host-configured Decaf adapter.
|
|
15
|
+
*
|
|
16
|
+
* Usage: `node lib/nest/graph/main.cjs [port]`
|
|
17
|
+
*/
|
|
18
|
+
import { NestFactory } from "@nestjs/core";
|
|
19
|
+
import { GraphExecutionModule } from "./GraphExecutionModule.js";
|
|
20
|
+
async function bootstrap() {
|
|
21
|
+
const port = Number(process.env["GRAPH_BACKEND_PORT"] ?? process.argv[2] ?? 3000);
|
|
22
|
+
const app = await NestFactory.create(GraphExecutionModule.forRoot({
|
|
23
|
+
initAdapter: true,
|
|
24
|
+
runs: { auth: "optional", allowAnonymousAccess: true },
|
|
25
|
+
workflows: { auth: "optional", allowAnonymousAccess: true },
|
|
26
|
+
catalogue: { auth: "optional" },
|
|
27
|
+
engines: { auth: "optional" },
|
|
28
|
+
}));
|
|
29
|
+
app.enableCors({
|
|
30
|
+
origin: [/^http:\/\/(localhost|127\.0\.0\.1)(:\d+)?$/],
|
|
31
|
+
credentials: true,
|
|
32
|
+
});
|
|
33
|
+
await app.listen(port, "127.0.0.1");
|
|
34
|
+
console.log(`[graph-backend] NestJS graph execution server listening on http://127.0.0.1:${port}`);
|
|
35
|
+
console.log(`[graph-backend] GET /graph/node-types`);
|
|
36
|
+
console.log(`[graph-backend] GET /graph/node-types/:kind`);
|
|
37
|
+
console.log(`[graph-backend] POST /graph/node-types/:kind/resolve`);
|
|
38
|
+
console.log(`[graph-backend] PUT /graph/workflows/:workflowId`);
|
|
39
|
+
console.log(`[graph-backend] GET /graph/workflows`);
|
|
40
|
+
console.log(`[graph-backend] GET /graph/workflows/:workflowId`);
|
|
41
|
+
console.log(`[graph-backend] POST /graph/workflows/validate`);
|
|
42
|
+
console.log(`[graph-backend] POST /graph/runs`);
|
|
43
|
+
console.log(`[graph-backend] GET /graph/runs/:runId`);
|
|
44
|
+
console.log(`[graph-backend] GET /graph/runs/:runId/events (SSE)`);
|
|
45
|
+
console.log(`[graph-backend] GET /graph/engines`);
|
|
46
|
+
}
|
|
47
|
+
bootstrap().catch((err) => {
|
|
48
|
+
console.error("[graph-backend] Failed to start:", err);
|
|
49
|
+
process.exit(1);
|
|
50
|
+
});
|
|
51
|
+
//# sourceMappingURL=main.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.js","sourceRoot":"","sources":["../../../../src/nest/graph/main.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,oBAAoB,EAAE,kCAA+B;AAE9D,KAAK,UAAU,SAAS;IACtB,MAAM,IAAI,GAAG,MAAM,CACjB,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,IAAI,CAC7D,CAAC;IAEF,MAAM,GAAG,GAAG,MAAM,WAAW,CAAC,MAAM,CAClC,oBAAoB,CAAC,OAAO,CAAC;QAC3B,WAAW,EAAE,IAAI;QACjB,IAAI,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,oBAAoB,EAAE,IAAI,EAAE;QACtD,SAAS,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,oBAAoB,EAAE,IAAI,EAAE;QAC3D,SAAS,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE;QAC/B,OAAO,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE;KAC9B,CAAC,CACH,CAAC;IACF,GAAG,CAAC,UAAU,CAAC;QACb,MAAM,EAAE,CAAC,4CAA4C,CAAC;QACtD,WAAW,EAAE,IAAI;KAClB,CAAC,CAAC;IACH,MAAM,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;IAEpC,OAAO,CAAC,GAAG,CACT,+EAA+E,IAAI,EAAE,CACtF,CAAC;IAEF,OAAO,CAAC,GAAG,CAAC,4CAA4C,CAAC,CAAC;IAC1D,OAAO,CAAC,GAAG,CAAC,kDAAkD,CAAC,CAAC;IAChE,OAAO,CAAC,GAAG,CAAC,0DAA0D,CAAC,CAAC;IAExE,OAAO,CAAC,GAAG,CAAC,uDAAuD,CAAC,CAAC;IACrE,OAAO,CAAC,GAAG,CAAC,2CAA2C,CAAC,CAAC;IACzD,OAAO,CAAC,GAAG,CAAC,uDAAuD,CAAC,CAAC;IACrE,OAAO,CAAC,GAAG,CAAC,oDAAoD,CAAC,CAAC;IAElE,OAAO,CAAC,GAAG,CAAC,sCAAsC,CAAC,CAAC;IACpD,OAAO,CAAC,GAAG,CAAC,6CAA6C,CAAC,CAAC;IAC3D,OAAO,CAAC,GAAG,CAAC,0DAA0D,CAAC,CAAC;IAExE,OAAO,CAAC,GAAG,CAAC,yCAAyC,CAAC,CAAC;AACzD,CAAC;AAED,SAAS,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;IACxB,OAAO,CAAC,KAAK,CAAC,kCAAkC,EAAE,GAAG,CAAC,CAAC;IACvD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
|
@@ -47,6 +47,9 @@ export function logUnmappedGraphServingError(context, e, correlation = {}) {
|
|
|
47
47
|
if (correlation.workflowId !== undefined) {
|
|
48
48
|
meta.workflowId = correlation.workflowId;
|
|
49
49
|
}
|
|
50
|
+
if (correlation.engineId !== undefined) {
|
|
51
|
+
meta.engineId = correlation.engineId;
|
|
52
|
+
}
|
|
50
53
|
const message = Object.keys(meta).length
|
|
51
54
|
? `Graph request failed with an unmapped error ${JSON.stringify(meta)}`
|
|
52
55
|
: "Graph request failed with an unmapped error";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"servingErrors.js","sourceRoot":"","sources":["../../../../src/nest/graph/servingErrors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAE5C;;;GAGG;AACH,MAAM,CAAC,MAAM,oCAAoC,GAAG,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"servingErrors.js","sourceRoot":"","sources":["../../../../src/nest/graph/servingErrors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAE5C;;;GAGG;AACH,MAAM,CAAC,MAAM,oCAAoC,GAAG,uBAAuB,CAAC;AAsB5E;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,UAAU,4BAA4B,CAC1C,OAAuC,EACvC,CAAU,EACV,cAA4C,EAAE;IAE9C,IAAI,CAAC;QACH,MAAM,KAAK,GAAG,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;QAC5D,MAAM,IAAI,GAA4B,EAAE,CAAC;QACzC,IAAI,WAAW,CAAC,KAAK,KAAK,SAAS;YAAE,IAAI,CAAC,KAAK,GAAG,WAAW,CAAC,KAAK,CAAC;QACpE,IAAI,WAAW,CAAC,UAAU,KAAK,SAAS,EAAE,CAAC;YACzC,IAAI,CAAC,UAAU,GAAG,WAAW,CAAC,UAAU,CAAC;QAC3C,CAAC;QACD,IAAI,WAAW,CAAC,QAAQ,KAAK,SAAS,EAAE,CAAC;YACvC,IAAI,CAAC,QAAQ,GAAG,WAAW,CAAC,QAAQ,CAAC;QACvC,CAAC;QACD,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM;YACtC,CAAC,CAAC,+CAA+C,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE;YACvE,CAAC,CAAC,6CAA6C,CAAC;QAClD,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;IACnD,CAAC;IAAC,MAAM,CAAC;QACP,yEAAyE;QACzE,oEAAoE;IACtE,CAAC;AACH,CAAC"}
|
|
@@ -50,11 +50,15 @@ export const GRAPH_CODE_DEFAULT_TIMEOUT_MS = 1000;
|
|
|
50
50
|
* @returns A bounded timeout in milliseconds.
|
|
51
51
|
*/
|
|
52
52
|
export function clampGraphCodeTimeoutMs(value, maxTimeoutMs) {
|
|
53
|
+
const numericCeiling = typeof maxTimeoutMs === "number" ? maxTimeoutMs : Number(maxTimeoutMs);
|
|
54
|
+
const ceiling = Number.isFinite(numericCeiling) && numericCeiling > 0
|
|
55
|
+
? numericCeiling
|
|
56
|
+
: GRAPH_CODE_MAX_TIMEOUT_MS;
|
|
53
57
|
const numeric = typeof value === "number" ? value : Number(value);
|
|
54
58
|
if (!Number.isFinite(numeric) || numeric <= 0) {
|
|
55
59
|
return GRAPH_CODE_DEFAULT_TIMEOUT_MS;
|
|
56
60
|
}
|
|
57
|
-
return Math.min(Math.floor(numeric),
|
|
61
|
+
return Math.min(Math.floor(numeric), ceiling);
|
|
58
62
|
}
|
|
59
63
|
/**
|
|
60
64
|
* Languages the Code node sandbox accepts. The `language` property is decorated
|
|
@@ -138,8 +142,12 @@ let CodeNode = class CodeNode extends GraphNode {
|
|
|
138
142
|
if (!evaluator) {
|
|
139
143
|
throw new GraphExecutionError("Code node execution requires a CodeSandboxEvaluator to be registered in GraphExecutionEngineConfig.codeSandboxEvaluator", "GRAPH_CODE_SANDBOX_NOT_CONFIGURED", { code });
|
|
140
144
|
}
|
|
141
|
-
const
|
|
142
|
-
|
|
145
|
+
const environmentCeiling = GraphEnvironment.graph.execution?.maxCodeTimeoutMs;
|
|
146
|
+
const maxTimeoutMs = typeof environmentCeiling === "number" &&
|
|
147
|
+
Number.isFinite(environmentCeiling) &&
|
|
148
|
+
environmentCeiling > 0
|
|
149
|
+
? environmentCeiling
|
|
150
|
+
: GRAPH_CODE_MAX_TIMEOUT_MS;
|
|
143
151
|
const timeoutMs = clampGraphCodeTimeoutMs(this.timeoutMs, maxTimeoutMs);
|
|
144
152
|
const md = context.metadata;
|
|
145
153
|
const sandboxContext = {
|