@blokjs/runner 0.2.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/dist/Blok.d.ts +19 -0
- package/dist/Blok.js +184 -0
- package/dist/Blok.js.map +1 -0
- package/dist/BlokResponse.d.ts +16 -0
- package/dist/BlokResponse.js +28 -0
- package/dist/BlokResponse.js.map +1 -0
- package/dist/Configuration.d.ts +37 -0
- package/dist/Configuration.js +248 -0
- package/dist/Configuration.js.map +1 -0
- package/dist/ConfigurationResolver.d.ts +7 -0
- package/dist/ConfigurationResolver.js +15 -0
- package/dist/ConfigurationResolver.js.map +1 -0
- package/dist/DefaultLogger.d.ts +65 -0
- package/dist/DefaultLogger.js +101 -0
- package/dist/DefaultLogger.js.map +1 -0
- package/dist/LocalStorage.d.ts +7 -0
- package/dist/LocalStorage.js +56 -0
- package/dist/LocalStorage.js.map +1 -0
- package/dist/MemoryUsage.d.ts +22 -0
- package/dist/MemoryUsage.js +83 -0
- package/dist/MemoryUsage.js.map +1 -0
- package/dist/NodeMap.d.ts +7 -0
- package/dist/NodeMap.js +13 -0
- package/dist/NodeMap.js.map +1 -0
- package/dist/ResolverBase.d.ts +8 -0
- package/dist/ResolverBase.js +18 -0
- package/dist/ResolverBase.js.map +1 -0
- package/dist/Runner.d.ts +25 -0
- package/dist/Runner.js +32 -0
- package/dist/Runner.js.map +1 -0
- package/dist/RunnerNode.d.ts +9 -0
- package/dist/RunnerNode.js +8 -0
- package/dist/RunnerNode.js.map +1 -0
- package/dist/RunnerNodeBase.d.ts +4 -0
- package/dist/RunnerNodeBase.js +3 -0
- package/dist/RunnerNodeBase.js.map +1 -0
- package/dist/RunnerSteps.d.ts +14 -0
- package/dist/RunnerSteps.js +110 -0
- package/dist/RunnerSteps.js.map +1 -0
- package/dist/RuntimeAdapterNode.d.ts +19 -0
- package/dist/RuntimeAdapterNode.js +87 -0
- package/dist/RuntimeAdapterNode.js.map +1 -0
- package/dist/RuntimeRegistry.d.ts +61 -0
- package/dist/RuntimeRegistry.js +87 -0
- package/dist/RuntimeRegistry.js.map +1 -0
- package/dist/TriggerBase.d.ts +119 -0
- package/dist/TriggerBase.js +413 -0
- package/dist/TriggerBase.js.map +1 -0
- package/dist/adapters/BunRuntimeAdapter.d.ts +38 -0
- package/dist/adapters/BunRuntimeAdapter.js +169 -0
- package/dist/adapters/BunRuntimeAdapter.js.map +1 -0
- package/dist/adapters/DockerRuntimeAdapter.d.ts +85 -0
- package/dist/adapters/DockerRuntimeAdapter.js +298 -0
- package/dist/adapters/DockerRuntimeAdapter.js.map +1 -0
- package/dist/adapters/HttpRuntimeAdapter.d.ts +58 -0
- package/dist/adapters/HttpRuntimeAdapter.js +152 -0
- package/dist/adapters/HttpRuntimeAdapter.js.map +1 -0
- package/dist/adapters/NodeJsRuntimeAdapter.d.ts +23 -0
- package/dist/adapters/NodeJsRuntimeAdapter.js +67 -0
- package/dist/adapters/NodeJsRuntimeAdapter.js.map +1 -0
- package/dist/adapters/RuntimeAdapter.d.ts +42 -0
- package/dist/adapters/RuntimeAdapter.js +2 -0
- package/dist/adapters/RuntimeAdapter.js.map +1 -0
- package/dist/adapters/WasmRuntimeAdapter.d.ts +69 -0
- package/dist/adapters/WasmRuntimeAdapter.js +279 -0
- package/dist/adapters/WasmRuntimeAdapter.js.map +1 -0
- package/dist/cache/NodeResultCache.d.ts +286 -0
- package/dist/cache/NodeResultCache.js +499 -0
- package/dist/cache/NodeResultCache.js.map +1 -0
- package/dist/cache/index.d.ts +1 -0
- package/dist/cache/index.js +2 -0
- package/dist/cache/index.js.map +1 -0
- package/dist/cost/CostEstimator.d.ts +57 -0
- package/dist/cost/CostEstimator.js +171 -0
- package/dist/cost/CostEstimator.js.map +1 -0
- package/dist/cost/index.d.ts +4 -0
- package/dist/cost/index.js +3 -0
- package/dist/cost/index.js.map +1 -0
- package/dist/cost/pricing.d.ts +24 -0
- package/dist/cost/pricing.js +169 -0
- package/dist/cost/pricing.js.map +1 -0
- package/dist/defineNode.d.ts +155 -0
- package/dist/defineNode.js +191 -0
- package/dist/defineNode.js.map +1 -0
- package/dist/graphql/GraphQLSchemaGenerator.d.ts +129 -0
- package/dist/graphql/GraphQLSchemaGenerator.js +425 -0
- package/dist/graphql/GraphQLSchemaGenerator.js.map +1 -0
- package/dist/hmr/FileWatcher.d.ts +62 -0
- package/dist/hmr/FileWatcher.js +185 -0
- package/dist/hmr/FileWatcher.js.map +1 -0
- package/dist/hmr/HmrDevConsole.d.ts +13 -0
- package/dist/hmr/HmrDevConsole.js +46 -0
- package/dist/hmr/HmrDevConsole.js.map +1 -0
- package/dist/hmr/HotReloadManager.d.ts +84 -0
- package/dist/hmr/HotReloadManager.js +195 -0
- package/dist/hmr/HotReloadManager.js.map +1 -0
- package/dist/hmr/index.d.ts +39 -0
- package/dist/hmr/index.js +38 -0
- package/dist/hmr/index.js.map +1 -0
- package/dist/index.d.ts +107 -0
- package/dist/index.js +107 -0
- package/dist/index.js.map +1 -0
- package/dist/integrations/APMIntegration.d.ts +141 -0
- package/dist/integrations/APMIntegration.js +212 -0
- package/dist/integrations/APMIntegration.js.map +1 -0
- package/dist/integrations/AzureMonitorIntegration.d.ts +118 -0
- package/dist/integrations/AzureMonitorIntegration.js +254 -0
- package/dist/integrations/AzureMonitorIntegration.js.map +1 -0
- package/dist/integrations/CloudWatchIntegration.d.ts +135 -0
- package/dist/integrations/CloudWatchIntegration.js +293 -0
- package/dist/integrations/CloudWatchIntegration.js.map +1 -0
- package/dist/integrations/SentryIntegration.d.ts +153 -0
- package/dist/integrations/SentryIntegration.js +200 -0
- package/dist/integrations/SentryIntegration.js.map +1 -0
- package/dist/integrations/index.d.ts +19 -0
- package/dist/integrations/index.js +16 -0
- package/dist/integrations/index.js.map +1 -0
- package/dist/marketplace/RuntimeAutoScaler.d.ts +148 -0
- package/dist/marketplace/RuntimeAutoScaler.js +366 -0
- package/dist/marketplace/RuntimeAutoScaler.js.map +1 -0
- package/dist/marketplace/RuntimeCatalog.d.ts +174 -0
- package/dist/marketplace/RuntimeCatalog.js +339 -0
- package/dist/marketplace/RuntimeCatalog.js.map +1 -0
- package/dist/marketplace/RuntimeDiscovery.d.ts +86 -0
- package/dist/marketplace/RuntimeDiscovery.js +219 -0
- package/dist/marketplace/RuntimeDiscovery.js.map +1 -0
- package/dist/marketplace/RuntimeHealthMonitor.d.ts +100 -0
- package/dist/marketplace/RuntimeHealthMonitor.js +241 -0
- package/dist/marketplace/RuntimeHealthMonitor.js.map +1 -0
- package/dist/marketplace/RuntimeMetricsDashboard.d.ts +113 -0
- package/dist/marketplace/RuntimeMetricsDashboard.js +293 -0
- package/dist/marketplace/RuntimeMetricsDashboard.js.map +1 -0
- package/dist/monitoring/CircuitBreaker.d.ts +107 -0
- package/dist/monitoring/CircuitBreaker.js +238 -0
- package/dist/monitoring/CircuitBreaker.js.map +1 -0
- package/dist/monitoring/DistributedTracer.d.ts +125 -0
- package/dist/monitoring/DistributedTracer.js +230 -0
- package/dist/monitoring/DistributedTracer.js.map +1 -0
- package/dist/monitoring/HealthCheck.d.ts +54 -0
- package/dist/monitoring/HealthCheck.js +102 -0
- package/dist/monitoring/HealthCheck.js.map +1 -0
- package/dist/monitoring/PerformanceProfiler.d.ts +63 -0
- package/dist/monitoring/PerformanceProfiler.js +229 -0
- package/dist/monitoring/PerformanceProfiler.js.map +1 -0
- package/dist/monitoring/PrometheusBootstrap.d.ts +30 -0
- package/dist/monitoring/PrometheusBootstrap.js +71 -0
- package/dist/monitoring/PrometheusBootstrap.js.map +1 -0
- package/dist/monitoring/PrometheusMetricsBridge.d.ts +60 -0
- package/dist/monitoring/PrometheusMetricsBridge.js +216 -0
- package/dist/monitoring/PrometheusMetricsBridge.js.map +1 -0
- package/dist/monitoring/RateLimiter.d.ts +58 -0
- package/dist/monitoring/RateLimiter.js +128 -0
- package/dist/monitoring/RateLimiter.js.map +1 -0
- package/dist/monitoring/StructuredLogger.d.ts +131 -0
- package/dist/monitoring/StructuredLogger.js +207 -0
- package/dist/monitoring/StructuredLogger.js.map +1 -0
- package/dist/monitoring/TracingBootstrap.d.ts +69 -0
- package/dist/monitoring/TracingBootstrap.js +129 -0
- package/dist/monitoring/TracingBootstrap.js.map +1 -0
- package/dist/monitoring/TriggerMetricsCollector.d.ts +94 -0
- package/dist/monitoring/TriggerMetricsCollector.js +174 -0
- package/dist/monitoring/TriggerMetricsCollector.js.map +1 -0
- package/dist/monitoring/index.d.ts +9 -0
- package/dist/monitoring/index.js +10 -0
- package/dist/monitoring/index.js.map +1 -0
- package/dist/openapi/OpenAPIGenerator.d.ts +192 -0
- package/dist/openapi/OpenAPIGenerator.js +373 -0
- package/dist/openapi/OpenAPIGenerator.js.map +1 -0
- package/dist/openapi/index.d.ts +20 -0
- package/dist/openapi/index.js +20 -0
- package/dist/openapi/index.js.map +1 -0
- package/dist/security/ABAC.d.ts +224 -0
- package/dist/security/ABAC.js +380 -0
- package/dist/security/ABAC.js.map +1 -0
- package/dist/security/AuditLogger.d.ts +242 -0
- package/dist/security/AuditLogger.js +317 -0
- package/dist/security/AuditLogger.js.map +1 -0
- package/dist/security/AuthMiddleware.d.ts +163 -0
- package/dist/security/AuthMiddleware.js +274 -0
- package/dist/security/AuthMiddleware.js.map +1 -0
- package/dist/security/EncryptionAtRest.d.ts +206 -0
- package/dist/security/EncryptionAtRest.js +236 -0
- package/dist/security/EncryptionAtRest.js.map +1 -0
- package/dist/security/OAuthProvider.d.ts +334 -0
- package/dist/security/OAuthProvider.js +719 -0
- package/dist/security/OAuthProvider.js.map +1 -0
- package/dist/security/PIIDetector.d.ts +233 -0
- package/dist/security/PIIDetector.js +354 -0
- package/dist/security/PIIDetector.js.map +1 -0
- package/dist/security/RBAC.d.ts +143 -0
- package/dist/security/RBAC.js +285 -0
- package/dist/security/RBAC.js.map +1 -0
- package/dist/security/SecretManager.d.ts +652 -0
- package/dist/security/SecretManager.js +1146 -0
- package/dist/security/SecretManager.js.map +1 -0
- package/dist/security/TLSConfig.d.ts +305 -0
- package/dist/security/TLSConfig.js +550 -0
- package/dist/security/TLSConfig.js.map +1 -0
- package/dist/security/index.d.ts +79 -0
- package/dist/security/index.js +80 -0
- package/dist/security/index.js.map +1 -0
- package/dist/testing/TestHarness.d.ts +189 -0
- package/dist/testing/TestHarness.js +272 -0
- package/dist/testing/TestHarness.js.map +1 -0
- package/dist/testing/TestLogger.d.ts +103 -0
- package/dist/testing/TestLogger.js +153 -0
- package/dist/testing/TestLogger.js.map +1 -0
- package/dist/testing/WorkflowTestRunner.d.ts +172 -0
- package/dist/testing/WorkflowTestRunner.js +355 -0
- package/dist/testing/WorkflowTestRunner.js.map +1 -0
- package/dist/testing/index.d.ts +21 -0
- package/dist/testing/index.js +22 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/tracing/InMemoryRunStore.d.ts +44 -0
- package/dist/tracing/InMemoryRunStore.js +341 -0
- package/dist/tracing/InMemoryRunStore.js.map +1 -0
- package/dist/tracing/PostgresRunStore.d.ts +82 -0
- package/dist/tracing/PostgresRunStore.js +640 -0
- package/dist/tracing/PostgresRunStore.js.map +1 -0
- package/dist/tracing/RunStore.d.ts +38 -0
- package/dist/tracing/RunStore.js +2 -0
- package/dist/tracing/RunStore.js.map +1 -0
- package/dist/tracing/RunTracker.d.ts +75 -0
- package/dist/tracing/RunTracker.js +374 -0
- package/dist/tracing/RunTracker.js.map +1 -0
- package/dist/tracing/SqliteRunStore.d.ts +53 -0
- package/dist/tracing/SqliteRunStore.js +703 -0
- package/dist/tracing/SqliteRunStore.js.map +1 -0
- package/dist/tracing/TraceRouter.d.ts +47 -0
- package/dist/tracing/TraceRouter.js +904 -0
- package/dist/tracing/TraceRouter.js.map +1 -0
- package/dist/tracing/TracingLogger.d.ts +21 -0
- package/dist/tracing/TracingLogger.js +62 -0
- package/dist/tracing/TracingLogger.js.map +1 -0
- package/dist/tracing/createStore.d.ts +30 -0
- package/dist/tracing/createStore.js +75 -0
- package/dist/tracing/createStore.js.map +1 -0
- package/dist/tracing/index.d.ts +13 -0
- package/dist/tracing/index.js +9 -0
- package/dist/tracing/index.js.map +1 -0
- package/dist/tracing/sanitize.d.ts +7 -0
- package/dist/tracing/sanitize.js +95 -0
- package/dist/tracing/sanitize.js.map +1 -0
- package/dist/tracing/types.d.ts +178 -0
- package/dist/tracing/types.js +3 -0
- package/dist/tracing/types.js.map +1 -0
- package/dist/types/Average.d.ts +11 -0
- package/dist/types/Average.js +2 -0
- package/dist/types/Average.js.map +1 -0
- package/dist/types/Condition.d.ts +8 -0
- package/dist/types/Condition.js +2 -0
- package/dist/types/Condition.js.map +1 -0
- package/dist/types/Conditions.d.ts +5 -0
- package/dist/types/Conditions.js +2 -0
- package/dist/types/Conditions.js.map +1 -0
- package/dist/types/Config.d.ts +12 -0
- package/dist/types/Config.js +2 -0
- package/dist/types/Config.js.map +1 -0
- package/dist/types/Flow.d.ts +5 -0
- package/dist/types/Flow.js +2 -0
- package/dist/types/Flow.js.map +1 -0
- package/dist/types/GlobalOptions.d.ts +11 -0
- package/dist/types/GlobalOptions.js +2 -0
- package/dist/types/GlobalOptions.js.map +1 -0
- package/dist/types/Inputs.d.ts +5 -0
- package/dist/types/Inputs.js +2 -0
- package/dist/types/Inputs.js.map +1 -0
- package/dist/types/JsonLikeObject.d.ts +3 -0
- package/dist/types/JsonLikeObject.js +2 -0
- package/dist/types/JsonLikeObject.js.map +1 -0
- package/dist/types/Mapper.d.ts +5 -0
- package/dist/types/Mapper.js +2 -0
- package/dist/types/Mapper.js.map +1 -0
- package/dist/types/Node.d.ts +10 -0
- package/dist/types/Node.js +2 -0
- package/dist/types/Node.js.map +1 -0
- package/dist/types/ParamsDictionary.d.ts +3 -0
- package/dist/types/ParamsDictionary.js +2 -0
- package/dist/types/ParamsDictionary.js.map +1 -0
- package/dist/types/Properties.d.ts +5 -0
- package/dist/types/Properties.js +2 -0
- package/dist/types/Properties.js.map +1 -0
- package/dist/types/Targets.d.ts +5 -0
- package/dist/types/Targets.js +2 -0
- package/dist/types/Targets.js.map +1 -0
- package/dist/types/Trigger.d.ts +5 -0
- package/dist/types/Trigger.js +2 -0
- package/dist/types/Trigger.js.map +1 -0
- package/dist/types/TriggerHttp.d.ts +7 -0
- package/dist/types/TriggerHttp.js +2 -0
- package/dist/types/TriggerHttp.js.map +1 -0
- package/dist/types/TriggerResponse.d.ts +6 -0
- package/dist/types/TriggerResponse.js +2 -0
- package/dist/types/TriggerResponse.js.map +1 -0
- package/dist/types/Triggers.d.ts +5 -0
- package/dist/types/Triggers.js +2 -0
- package/dist/types/Triggers.js.map +1 -0
- package/dist/types/TryCatch.d.ts +6 -0
- package/dist/types/TryCatch.js +2 -0
- package/dist/types/TryCatch.js.map +1 -0
- package/dist/visualization/NodeDependencyGraph.d.ts +76 -0
- package/dist/visualization/NodeDependencyGraph.js +418 -0
- package/dist/visualization/NodeDependencyGraph.js.map +1 -0
- package/dist/visualization/WorkflowVisualizer.d.ts +144 -0
- package/dist/visualization/WorkflowVisualizer.js +446 -0
- package/dist/visualization/WorkflowVisualizer.js.map +1 -0
- package/package.json +95 -0
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NodeJsRuntimeAdapter executes TypeScript/JavaScript nodes in-process
|
|
3
|
+
*
|
|
4
|
+
* This adapter handles both:
|
|
5
|
+
* - Module nodes: Nodes loaded from the NodeMap (registered npm packages)
|
|
6
|
+
* - Local nodes: Nodes loaded from the local filesystem
|
|
7
|
+
*
|
|
8
|
+
* Execution happens in the same Node.js process with zero gRPC/HTTP overhead.
|
|
9
|
+
*/
|
|
10
|
+
export class NodeJsRuntimeAdapter {
|
|
11
|
+
kind = "nodejs";
|
|
12
|
+
/**
|
|
13
|
+
* Execute a Node.js node in-process
|
|
14
|
+
*
|
|
15
|
+
* @param node - The node instance to execute (already resolved/instantiated)
|
|
16
|
+
* @param ctx - The workflow execution context
|
|
17
|
+
* @returns Promise that resolves to ExecutionResult
|
|
18
|
+
*/
|
|
19
|
+
async execute(node, ctx) {
|
|
20
|
+
const startTime = performance.now();
|
|
21
|
+
try {
|
|
22
|
+
// Execute the node's run method
|
|
23
|
+
const response = await node.run(ctx);
|
|
24
|
+
const duration_ms = performance.now() - startTime;
|
|
25
|
+
// Convert ResponseContext to ExecutionResult
|
|
26
|
+
// Response can be either:
|
|
27
|
+
// 1. ResponseContext with nested data: { data: { success, data, error } }
|
|
28
|
+
// 2. Direct response: { success, data, error }
|
|
29
|
+
const responseData = response.data;
|
|
30
|
+
const topLevelResponse = response;
|
|
31
|
+
// Check for errors at both nested level (response.data.error) and top level (response.error)
|
|
32
|
+
const nestedError = responseData?.error !== null && responseData?.error !== undefined;
|
|
33
|
+
const topLevelError = topLevelResponse?.error !== null && topLevelResponse?.error !== undefined;
|
|
34
|
+
const hasError = nestedError || topLevelError;
|
|
35
|
+
// Determine success: check both levels, default to true if not specified
|
|
36
|
+
const nestedSuccess = responseData?.success;
|
|
37
|
+
const topLevelSuccess = topLevelResponse?.success;
|
|
38
|
+
const success = hasError ? false : (nestedSuccess ?? topLevelSuccess ?? true);
|
|
39
|
+
// Get error from whichever level has it
|
|
40
|
+
const errorValue = responseData?.error || topLevelResponse?.error || null;
|
|
41
|
+
return {
|
|
42
|
+
success,
|
|
43
|
+
data: response.data,
|
|
44
|
+
errors: errorValue,
|
|
45
|
+
metrics: {
|
|
46
|
+
duration_ms,
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
catch (error) {
|
|
51
|
+
const duration_ms = performance.now() - startTime;
|
|
52
|
+
return {
|
|
53
|
+
success: false,
|
|
54
|
+
data: null,
|
|
55
|
+
errors: {
|
|
56
|
+
message: error.message,
|
|
57
|
+
stack: error.stack,
|
|
58
|
+
name: error.name,
|
|
59
|
+
},
|
|
60
|
+
metrics: {
|
|
61
|
+
duration_ms,
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=NodeJsRuntimeAdapter.js.map
|
|
@@ -0,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I,IAAI,CAAC;YAE1E,OAAO;gBACN,OAAO;gBACP,IAAI,EAAE,QAAQ,CAAC,IAAI;gBACnB,MAAM,EAAE,UAAU;gBAClB,OAAO,EAAE;oBACR,WAAW;iBACX;aACD,CAAC;QACH,CAAC;QAAC,OAAO,KAAc,EAAE,CAAC;YACzB,MAAM,WAAW,GAAG,WAAW,CAAC,GAAG,EAAE,GAAG,SAAS,CAAC;YAElD,OAAO;gBACN,OAAO,EAAE,KAAK;gBACd,IAAI,EAAE,IAAI;gBACV,MAAM,EAAE;oBACP,OAAO,EAAG,KAAe,CAAC,OAAO;oBACjC,KAAK,EAAG,KAAe,CAAC,KAAK;oBAC7B,IAAI,EAAG,KAAe,CAAC,IAAI;iBAC3B;gBACD,OAAO,EAAE;oBACR,WAAW;iBACX;aACD,CAAC;QACH,CAAC;IACF,CAAC;CACD"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { Context } from "@blokjs/shared";
|
|
2
|
+
import type RunnerNode from "../RunnerNode";
|
|
3
|
+
/**
|
|
4
|
+
* RuntimeKind represents all supported runtime environments
|
|
5
|
+
*/
|
|
6
|
+
export type RuntimeKind = "nodejs" | "bun" | "python3" | "go" | "java" | "rust" | "php" | "csharp" | "ruby" | "docker" | "wasm";
|
|
7
|
+
/**
|
|
8
|
+
* ExecutionResult is the canonical response structure from any runtime adapter
|
|
9
|
+
*/
|
|
10
|
+
export type ExecutionResult = {
|
|
11
|
+
success: boolean;
|
|
12
|
+
data: unknown;
|
|
13
|
+
errors: unknown | null;
|
|
14
|
+
logs?: string[];
|
|
15
|
+
metrics?: {
|
|
16
|
+
duration_ms?: number;
|
|
17
|
+
cpu_ms?: number;
|
|
18
|
+
memory_bytes?: number;
|
|
19
|
+
};
|
|
20
|
+
/** Variables set by the SDK node during execution, to be merged into ctx.vars */
|
|
21
|
+
vars?: Record<string, unknown>;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* RuntimeAdapter is the core abstraction for executing nodes in different language runtimes
|
|
25
|
+
*
|
|
26
|
+
* All runtime adapters (NodeJS, Python, Go, Java, etc.) implement this interface
|
|
27
|
+
* to provide a uniform execution contract for the workflow orchestrator.
|
|
28
|
+
*/
|
|
29
|
+
export interface RuntimeAdapter {
|
|
30
|
+
/**
|
|
31
|
+
* The kind of runtime this adapter handles
|
|
32
|
+
*/
|
|
33
|
+
readonly kind: RuntimeKind;
|
|
34
|
+
/**
|
|
35
|
+
* Execute a node in this runtime
|
|
36
|
+
*
|
|
37
|
+
* @param node - The node to execute (includes node path, name, config)
|
|
38
|
+
* @param ctx - The workflow execution context
|
|
39
|
+
* @returns Promise that resolves to ExecutionResult
|
|
40
|
+
*/
|
|
41
|
+
execute(node: RunnerNode, ctx: Context): Promise<ExecutionResult>;
|
|
42
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RuntimeAdapter.js","sourceRoot":"","sources":["../../src/adapters/RuntimeAdapter.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type { Context } from "@blokjs/shared";
|
|
2
|
+
import type RunnerNode from "../RunnerNode";
|
|
3
|
+
import type { ExecutionResult, RuntimeAdapter } from "./RuntimeAdapter";
|
|
4
|
+
/**
|
|
5
|
+
* WasmRuntimeAdapter executes WebAssembly modules as Blok nodes
|
|
6
|
+
*
|
|
7
|
+
* This adapter provides:
|
|
8
|
+
* - Direct WASM execution via WebAssembly API (built-in to Node.js/Bun)
|
|
9
|
+
* - Module caching for fast subsequent executions
|
|
10
|
+
* - Serialized context passing via WASM memory
|
|
11
|
+
* - Support for WASI-compatible modules
|
|
12
|
+
* - Support for both file-based (.wasm) and pre-compiled modules
|
|
13
|
+
*
|
|
14
|
+
* WASM modules must export an `execute` function that:
|
|
15
|
+
* - Takes a pointer to a JSON string input
|
|
16
|
+
* - Returns a pointer to a JSON string output
|
|
17
|
+
*
|
|
18
|
+
* Or export `__blok_execute` which receives/returns via host functions:
|
|
19
|
+
* - `__blok_get_input()` → returns JSON input pointer
|
|
20
|
+
* - `__blok_set_output(ptr, len)` → sets JSON output
|
|
21
|
+
*/
|
|
22
|
+
export declare class WasmRuntimeAdapter implements RuntimeAdapter {
|
|
23
|
+
readonly kind: "wasm";
|
|
24
|
+
private moduleCache;
|
|
25
|
+
private maxCacheSize;
|
|
26
|
+
constructor(options?: {
|
|
27
|
+
maxCacheSize?: number;
|
|
28
|
+
maxCacheAge?: number;
|
|
29
|
+
});
|
|
30
|
+
/**
|
|
31
|
+
* Execute a WASM module as a Blok node
|
|
32
|
+
*
|
|
33
|
+
* @param node - The node to execute (node.node should be path to .wasm file or module name)
|
|
34
|
+
* @param ctx - The workflow execution context
|
|
35
|
+
* @returns Promise that resolves to ExecutionResult
|
|
36
|
+
*/
|
|
37
|
+
execute(node: RunnerNode, ctx: Context): Promise<ExecutionResult>;
|
|
38
|
+
/**
|
|
39
|
+
* Load a WASM module (from cache or file)
|
|
40
|
+
*/
|
|
41
|
+
private loadModule;
|
|
42
|
+
/**
|
|
43
|
+
* Execute a compiled WASM module with input
|
|
44
|
+
*/
|
|
45
|
+
private executeModule;
|
|
46
|
+
/**
|
|
47
|
+
* Get approximate memory usage of a WASM module instance
|
|
48
|
+
*/
|
|
49
|
+
private getModuleMemoryUsage;
|
|
50
|
+
/**
|
|
51
|
+
* Cache a compiled WASM module
|
|
52
|
+
*/
|
|
53
|
+
private cacheModule;
|
|
54
|
+
/**
|
|
55
|
+
* Evict the oldest cached module
|
|
56
|
+
*/
|
|
57
|
+
private evictOldest;
|
|
58
|
+
/**
|
|
59
|
+
* Clear the module cache
|
|
60
|
+
*/
|
|
61
|
+
clearCache(): void;
|
|
62
|
+
/**
|
|
63
|
+
* Get cache statistics
|
|
64
|
+
*/
|
|
65
|
+
getCacheStats(): {
|
|
66
|
+
size: number;
|
|
67
|
+
maxSize: number;
|
|
68
|
+
};
|
|
69
|
+
}
|
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WasmRuntimeAdapter executes WebAssembly modules as Blok nodes
|
|
3
|
+
*
|
|
4
|
+
* This adapter provides:
|
|
5
|
+
* - Direct WASM execution via WebAssembly API (built-in to Node.js/Bun)
|
|
6
|
+
* - Module caching for fast subsequent executions
|
|
7
|
+
* - Serialized context passing via WASM memory
|
|
8
|
+
* - Support for WASI-compatible modules
|
|
9
|
+
* - Support for both file-based (.wasm) and pre-compiled modules
|
|
10
|
+
*
|
|
11
|
+
* WASM modules must export an `execute` function that:
|
|
12
|
+
* - Takes a pointer to a JSON string input
|
|
13
|
+
* - Returns a pointer to a JSON string output
|
|
14
|
+
*
|
|
15
|
+
* Or export `__blok_execute` which receives/returns via host functions:
|
|
16
|
+
* - `__blok_get_input()` → returns JSON input pointer
|
|
17
|
+
* - `__blok_set_output(ptr, len)` → sets JSON output
|
|
18
|
+
*/
|
|
19
|
+
export class WasmRuntimeAdapter {
|
|
20
|
+
kind = "wasm";
|
|
21
|
+
moduleCache = new Map();
|
|
22
|
+
maxCacheSize;
|
|
23
|
+
constructor(options) {
|
|
24
|
+
this.maxCacheSize = options?.maxCacheSize ?? 50;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Execute a WASM module as a Blok node
|
|
28
|
+
*
|
|
29
|
+
* @param node - The node to execute (node.node should be path to .wasm file or module name)
|
|
30
|
+
* @param ctx - The workflow execution context
|
|
31
|
+
* @returns Promise that resolves to ExecutionResult
|
|
32
|
+
*/
|
|
33
|
+
async execute(node, ctx) {
|
|
34
|
+
const startTime = performance.now();
|
|
35
|
+
try {
|
|
36
|
+
const modulePath = node.node || node.name;
|
|
37
|
+
const wasmModule = await this.loadModule(modulePath);
|
|
38
|
+
// Prepare input as JSON string
|
|
39
|
+
const nodeConfig = ctx.config ? ctx.config[node.name] : {};
|
|
40
|
+
const input = JSON.stringify({
|
|
41
|
+
node: {
|
|
42
|
+
name: node.node || node.name,
|
|
43
|
+
type: node.type,
|
|
44
|
+
config: nodeConfig || {},
|
|
45
|
+
},
|
|
46
|
+
context: {
|
|
47
|
+
id: ctx.id,
|
|
48
|
+
workflow_name: ctx.workflow_name,
|
|
49
|
+
request: {
|
|
50
|
+
body: ctx.request.body,
|
|
51
|
+
headers: ctx.request.headers,
|
|
52
|
+
params: ctx.request.params,
|
|
53
|
+
query: ctx.request.query,
|
|
54
|
+
},
|
|
55
|
+
response: ctx.response,
|
|
56
|
+
vars: ctx.vars,
|
|
57
|
+
},
|
|
58
|
+
});
|
|
59
|
+
// Execute WASM module
|
|
60
|
+
const output = await this.executeModule(wasmModule, input);
|
|
61
|
+
const duration_ms = performance.now() - startTime;
|
|
62
|
+
// Parse output
|
|
63
|
+
let result;
|
|
64
|
+
try {
|
|
65
|
+
const parsed = JSON.parse(output);
|
|
66
|
+
result = {
|
|
67
|
+
success: parsed.success ?? true,
|
|
68
|
+
data: parsed.data ?? parsed,
|
|
69
|
+
errors: parsed.errors || parsed.error || null,
|
|
70
|
+
metrics: {
|
|
71
|
+
duration_ms,
|
|
72
|
+
memory_bytes: this.getModuleMemoryUsage(wasmModule),
|
|
73
|
+
},
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
catch {
|
|
77
|
+
// Raw output (non-JSON)
|
|
78
|
+
result = {
|
|
79
|
+
success: true,
|
|
80
|
+
data: output,
|
|
81
|
+
errors: null,
|
|
82
|
+
metrics: {
|
|
83
|
+
duration_ms,
|
|
84
|
+
},
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
return result;
|
|
88
|
+
}
|
|
89
|
+
catch (error) {
|
|
90
|
+
const duration_ms = performance.now() - startTime;
|
|
91
|
+
return {
|
|
92
|
+
success: false,
|
|
93
|
+
data: null,
|
|
94
|
+
errors: {
|
|
95
|
+
message: error.message,
|
|
96
|
+
stack: error.stack,
|
|
97
|
+
name: error.name,
|
|
98
|
+
},
|
|
99
|
+
metrics: {
|
|
100
|
+
duration_ms,
|
|
101
|
+
},
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Load a WASM module (from cache or file)
|
|
107
|
+
*/
|
|
108
|
+
async loadModule(modulePath) {
|
|
109
|
+
// Check cache
|
|
110
|
+
const cached = this.moduleCache.get(modulePath);
|
|
111
|
+
if (cached) {
|
|
112
|
+
cached.lastUsed = Date.now();
|
|
113
|
+
return cached.module;
|
|
114
|
+
}
|
|
115
|
+
// Load from file
|
|
116
|
+
const fs = await import("node:fs/promises");
|
|
117
|
+
const wasmBytes = await fs.readFile(modulePath);
|
|
118
|
+
const module = await WebAssembly.compile(wasmBytes);
|
|
119
|
+
// Cache the compiled module
|
|
120
|
+
this.cacheModule(modulePath, module);
|
|
121
|
+
return module;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Execute a compiled WASM module with input
|
|
125
|
+
*/
|
|
126
|
+
async executeModule(module, input) {
|
|
127
|
+
// Create memory for the module
|
|
128
|
+
const memory = new WebAssembly.Memory({ initial: 10, maximum: 100 }); // 640KB - 6.4MB
|
|
129
|
+
// Host functions for the WASM module to call
|
|
130
|
+
let outputBuffer = "";
|
|
131
|
+
const importObject = {
|
|
132
|
+
env: {
|
|
133
|
+
memory,
|
|
134
|
+
// Allow WASM to log to console
|
|
135
|
+
console_log: (ptr, len) => {
|
|
136
|
+
const bytes = new Uint8Array(memory.buffer, ptr, len);
|
|
137
|
+
const text = new TextDecoder().decode(bytes);
|
|
138
|
+
console.log("[WASM]", text);
|
|
139
|
+
},
|
|
140
|
+
// Allow WASM to set output
|
|
141
|
+
__blok_set_output: (ptr, len) => {
|
|
142
|
+
const bytes = new Uint8Array(memory.buffer, ptr, len);
|
|
143
|
+
outputBuffer = new TextDecoder().decode(bytes);
|
|
144
|
+
},
|
|
145
|
+
// Allow WASM to get the input length
|
|
146
|
+
__blok_input_len: () => {
|
|
147
|
+
return new TextEncoder().encode(input).length;
|
|
148
|
+
},
|
|
149
|
+
// Allow WASM to read input into a buffer
|
|
150
|
+
__blok_read_input: (ptr) => {
|
|
151
|
+
const encoded = new TextEncoder().encode(input);
|
|
152
|
+
const view = new Uint8Array(memory.buffer, ptr, encoded.length);
|
|
153
|
+
view.set(encoded);
|
|
154
|
+
},
|
|
155
|
+
},
|
|
156
|
+
wasi_snapshot_preview1: {
|
|
157
|
+
// Minimal WASI stubs for compatibility
|
|
158
|
+
fd_write: () => 0,
|
|
159
|
+
fd_read: () => 0,
|
|
160
|
+
fd_close: () => 0,
|
|
161
|
+
fd_seek: () => 0,
|
|
162
|
+
proc_exit: () => {
|
|
163
|
+
/* no-op */
|
|
164
|
+
},
|
|
165
|
+
environ_get: () => 0,
|
|
166
|
+
environ_sizes_get: () => 0,
|
|
167
|
+
clock_time_get: () => 0,
|
|
168
|
+
args_get: () => 0,
|
|
169
|
+
args_sizes_get: () => 0,
|
|
170
|
+
},
|
|
171
|
+
};
|
|
172
|
+
// Instantiate module
|
|
173
|
+
const instance = await WebAssembly.instantiate(module, importObject);
|
|
174
|
+
const exports = instance.exports;
|
|
175
|
+
// Try different execution strategies
|
|
176
|
+
// Strategy 1: __blok_execute (Blok-native WASM interface)
|
|
177
|
+
if (typeof exports.__blok_execute === "function") {
|
|
178
|
+
exports.__blok_execute();
|
|
179
|
+
return outputBuffer || '{"success": true, "data": null}';
|
|
180
|
+
}
|
|
181
|
+
// Strategy 2: execute(ptr, len) → ptr
|
|
182
|
+
if (typeof exports.execute === "function") {
|
|
183
|
+
const alloc = exports.alloc;
|
|
184
|
+
const dealloc = exports.dealloc;
|
|
185
|
+
if (alloc) {
|
|
186
|
+
// Module provides its own allocator
|
|
187
|
+
const encoded = new TextEncoder().encode(input);
|
|
188
|
+
const inputPtr = alloc(encoded.length);
|
|
189
|
+
const inputView = new Uint8Array(memory.buffer, inputPtr, encoded.length);
|
|
190
|
+
inputView.set(encoded);
|
|
191
|
+
const resultPtr = exports.execute(inputPtr, encoded.length);
|
|
192
|
+
if (dealloc) {
|
|
193
|
+
dealloc(inputPtr, encoded.length);
|
|
194
|
+
}
|
|
195
|
+
// Read result from memory (null-terminated string)
|
|
196
|
+
const resultView = new Uint8Array(memory.buffer, resultPtr);
|
|
197
|
+
let end = 0;
|
|
198
|
+
while (end < resultView.length && resultView[end] !== 0)
|
|
199
|
+
end++;
|
|
200
|
+
return new TextDecoder().decode(resultView.slice(0, end));
|
|
201
|
+
}
|
|
202
|
+
// No allocator - just call execute
|
|
203
|
+
const result = exports.execute();
|
|
204
|
+
if (typeof result === "number") {
|
|
205
|
+
// Result is a pointer to a string
|
|
206
|
+
const resultView = new Uint8Array(memory.buffer, result);
|
|
207
|
+
let end = 0;
|
|
208
|
+
while (end < resultView.length && resultView[end] !== 0)
|
|
209
|
+
end++;
|
|
210
|
+
return new TextDecoder().decode(resultView.slice(0, end));
|
|
211
|
+
}
|
|
212
|
+
return outputBuffer || String(result);
|
|
213
|
+
}
|
|
214
|
+
// Strategy 3: _start (WASI module)
|
|
215
|
+
if (typeof exports._start === "function") {
|
|
216
|
+
exports._start();
|
|
217
|
+
return outputBuffer || '{"success": true, "data": null}';
|
|
218
|
+
}
|
|
219
|
+
throw new Error("WASM module does not export execute, __blok_execute, or _start");
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Get approximate memory usage of a WASM module instance
|
|
223
|
+
*/
|
|
224
|
+
getModuleMemoryUsage(module) {
|
|
225
|
+
// Estimate based on module sections
|
|
226
|
+
try {
|
|
227
|
+
const customSections = WebAssembly.Module.customSections(module, "name");
|
|
228
|
+
return customSections.reduce((sum, section) => sum + section.byteLength, 0);
|
|
229
|
+
}
|
|
230
|
+
catch {
|
|
231
|
+
return 0;
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* Cache a compiled WASM module
|
|
236
|
+
*/
|
|
237
|
+
cacheModule(path, module) {
|
|
238
|
+
// Evict old entries if cache is full
|
|
239
|
+
if (this.moduleCache.size >= this.maxCacheSize) {
|
|
240
|
+
this.evictOldest();
|
|
241
|
+
}
|
|
242
|
+
this.moduleCache.set(path, {
|
|
243
|
+
module,
|
|
244
|
+
lastUsed: Date.now(),
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Evict the oldest cached module
|
|
249
|
+
*/
|
|
250
|
+
evictOldest() {
|
|
251
|
+
let oldestKey = null;
|
|
252
|
+
let oldestTime = Number.POSITIVE_INFINITY;
|
|
253
|
+
for (const [key, value] of this.moduleCache) {
|
|
254
|
+
if (value.lastUsed < oldestTime) {
|
|
255
|
+
oldestTime = value.lastUsed;
|
|
256
|
+
oldestKey = key;
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
if (oldestKey) {
|
|
260
|
+
this.moduleCache.delete(oldestKey);
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* Clear the module cache
|
|
265
|
+
*/
|
|
266
|
+
clearCache() {
|
|
267
|
+
this.moduleCache.clear();
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* Get cache statistics
|
|
271
|
+
*/
|
|
272
|
+
getCacheStats() {
|
|
273
|
+
return {
|
|
274
|
+
size: this.moduleCache.size,
|
|
275
|
+
maxSize: this.maxCacheSize,
|
|
276
|
+
};
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
//# sourceMappingURL=WasmRuntimeAdapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WasmRuntimeAdapter.js","sourceRoot":"","sources":["../../src/adapters/WasmRuntimeAdapter.ts"],"names":[],"mappings":"AAaA;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,OAAO,kBAAkB;IACd,IAAI,GAAG,MAAe,CAAC;IAE/B,WAAW,GAAG,IAAI,GAAG,EAAwB,CAAC;IAC9C,YAAY,CAAS;IAE7B,YAAY,OAAyD;QACpE,IAAI,CAAC,YAAY,GAAG,OAAO,EAAE,YAAY,IAAI,EAAE,CAAC;IACjD,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,OAAO,CAAC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