@ultrst-armada/krnl 1.0.9 → 1.0.10
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/package.json
CHANGED
|
@@ -30,6 +30,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
// src/index.ts
|
|
31
31
|
var index_exports = {};
|
|
32
32
|
__export(index_exports, {
|
|
33
|
+
DefaultExecutionController: () => DefaultExecutionController,
|
|
33
34
|
EventBus: () => EventBus,
|
|
34
35
|
FunctionalityFacade: () => FunctionalityFacade,
|
|
35
36
|
FunctionalityOrchestration: () => FunctionalityOrchestration,
|
|
@@ -4112,8 +4113,31 @@ var FunctionalityOrchestration = class {
|
|
|
4112
4113
|
|
|
4113
4114
|
// src/index.ts
|
|
4114
4115
|
var gutts = __toESM(require("@dinilmusick/gutts"), 1);
|
|
4116
|
+
|
|
4117
|
+
// src/execution/execution-controller.ts
|
|
4118
|
+
var DefaultExecutionController = class {
|
|
4119
|
+
providers = /* @__PURE__ */ new Map();
|
|
4120
|
+
executions = /* @__PURE__ */ new Map();
|
|
4121
|
+
register(provider) {
|
|
4122
|
+
this.providers.set(provider.id, provider);
|
|
4123
|
+
}
|
|
4124
|
+
async execute(request, providerId) {
|
|
4125
|
+
const provider = providerId ? this.providers.get(providerId) : this.providers.values().next().value;
|
|
4126
|
+
if (!provider) throw new Error("No execution provider is registered.");
|
|
4127
|
+
const result = await provider.execute(request);
|
|
4128
|
+
this.executions.set(result.executionId, provider);
|
|
4129
|
+
return result;
|
|
4130
|
+
}
|
|
4131
|
+
async cancel(executionId) {
|
|
4132
|
+
const provider = this.executions.get(executionId);
|
|
4133
|
+
if (!provider) throw new Error(`Unknown execution: ${executionId}`);
|
|
4134
|
+
await provider.cancel(executionId);
|
|
4135
|
+
this.executions.delete(executionId);
|
|
4136
|
+
}
|
|
4137
|
+
};
|
|
4115
4138
|
// Annotate the CommonJS export names for ESM import in node:
|
|
4116
4139
|
0 && (module.exports = {
|
|
4140
|
+
DefaultExecutionController,
|
|
4117
4141
|
EventBus,
|
|
4118
4142
|
FunctionalityFacade,
|
|
4119
4143
|
FunctionalityOrchestration,
|
|
@@ -1252,4 +1252,45 @@ declare class ProtocolResolver {
|
|
|
1252
1252
|
static getSupportedProtocols(definition: ServiceDefinition): ProtocolType[];
|
|
1253
1253
|
}
|
|
1254
1254
|
|
|
1255
|
-
|
|
1255
|
+
type ExecutionStatus = "queued" | "running" | "succeeded" | "failed" | "cancelled" | "timed-out";
|
|
1256
|
+
interface ExecutionRequest {
|
|
1257
|
+
workspaceId: string;
|
|
1258
|
+
command: string;
|
|
1259
|
+
cwd?: string;
|
|
1260
|
+
environment?: Readonly<Record<string, string>>;
|
|
1261
|
+
timeoutMs?: number;
|
|
1262
|
+
network?: "none" | "restricted" | "full";
|
|
1263
|
+
resources?: {
|
|
1264
|
+
cpu?: number;
|
|
1265
|
+
memoryMb?: number;
|
|
1266
|
+
diskMb?: number;
|
|
1267
|
+
};
|
|
1268
|
+
}
|
|
1269
|
+
interface ExecutionResult {
|
|
1270
|
+
executionId: string;
|
|
1271
|
+
status: ExecutionStatus;
|
|
1272
|
+
exitCode?: number;
|
|
1273
|
+
stdout: string;
|
|
1274
|
+
stderr: string;
|
|
1275
|
+
artifactIds: readonly string[];
|
|
1276
|
+
}
|
|
1277
|
+
interface ExecutionProvider {
|
|
1278
|
+
readonly id: string;
|
|
1279
|
+
execute(request: ExecutionRequest): Promise<ExecutionResult>;
|
|
1280
|
+
cancel(executionId: string): Promise<void>;
|
|
1281
|
+
}
|
|
1282
|
+
interface ExecutionController {
|
|
1283
|
+
register(provider: ExecutionProvider): void;
|
|
1284
|
+
execute(request: ExecutionRequest, providerId?: string): Promise<ExecutionResult>;
|
|
1285
|
+
cancel(executionId: string): Promise<void>;
|
|
1286
|
+
}
|
|
1287
|
+
|
|
1288
|
+
declare class DefaultExecutionController implements ExecutionController {
|
|
1289
|
+
private readonly providers;
|
|
1290
|
+
private readonly executions;
|
|
1291
|
+
register(provider: ExecutionProvider): void;
|
|
1292
|
+
execute(request: ExecutionRequest, providerId?: string): Promise<ExecutionResult>;
|
|
1293
|
+
cancel(executionId: string): Promise<void>;
|
|
1294
|
+
}
|
|
1295
|
+
|
|
1296
|
+
export { type BackendCommand, type Connection, type DAGValidationResult, DefaultExecutionController, type DefaultFrontendReference, type DependencyContract, type EndpointDescriptor, EventBus, type EventChannel, type EventContract, type EventDefinition, type EventHandler, type EventSubscription, type ExecutionContext, type ExecutionController, type ExecutionProvider, type ExecutionRequest, type ExecutionResult, type ExecutionStatus, type FunctionalityCustomEvents, type FunctionalityDefinition, type FunctionalityEventNamespace, type FunctionalityEvents, type FunctionalityExecutionContext, FunctionalityFacade, type FunctionalityFlow, type FunctionalityFlowStep, type FunctionalityLifecycleEvent, type FunctionalityLifecyclePayload, FunctionalityOrchestration, type FunctionalityStepOptions, HttpProtocolAdapter, type IService, type IServiceFacade, type JobStatus, type KrnlJobDefinition, type KrnlJobHandle, type KrnlJobOptions, KrnlPackageReconciler, KrnlQueue, type KrnlQueueOptions, type KrnlWorkerInfo, KrnlWorkerPool, type KrnlWorkerState, type LifecycleContract, LifecycleManager, MemoryTransport, type NormalizedResult, type OperationContext, type OperationContract, type OrchestrationContext, type OrchestrationDefinition, type OrchestrationDescriptor, OrchestrationEventFacade, type OrchestrationEventNamespace, type OrchestrationFrontendReference, type OrchestrationLifecyclePayload, type OrchestrationResult, type OrchestrationStatus, type OrchestrationStep, P2PProtocolAdapter, type PeerRecord, type ProtocolAdapter, type ProtocolCapabilities, type ProtocolEnvelope, ProtocolResolver, type ProtocolType, type ReconcileResult, type RegisteredServiceRecord, type SagaCompensationHandler, type ServiceCapability, type ServiceDefinition, ServiceDiscovery, ServiceEventBus, ServiceFacade, type ServiceFacadeConfig, ServiceInstance, type ServiceNamespace, ServiceProxy, ServiceRegistry, ServiceRuntime, ServiceStateStore, type ServiceStatus, type StateContract, type StepCompensation, type StepCondition, type StepDefinition, type StepExecutionResult, type StepExecutionStatus, type StepRetryPolicy, type StepStatus, type StepTimeoutPolicy, type StepType, TelemetryController, type TelemetryHandle, type TelemetryInvocation, type TelemetryMode, type TelemetryOptions, type TelemetryPercentiles, type TelemetryResourceSample, type TelemetrySnapshot, type TelemetryStatus, type TelemetryTargetStats, UdpProtocolAdapter, WebSocketProtocolAdapter, WorkerExecutionBoundary, createEventChannels, createService, createServiceDefinition, createServiceFacade, createServiceProxy, deltaResources, sampleResources, telemetryNow, validateOrchestrationDAG, validateServiceDefinition };
|
|
@@ -1252,4 +1252,45 @@ declare class ProtocolResolver {
|
|
|
1252
1252
|
static getSupportedProtocols(definition: ServiceDefinition): ProtocolType[];
|
|
1253
1253
|
}
|
|
1254
1254
|
|
|
1255
|
-
|
|
1255
|
+
type ExecutionStatus = "queued" | "running" | "succeeded" | "failed" | "cancelled" | "timed-out";
|
|
1256
|
+
interface ExecutionRequest {
|
|
1257
|
+
workspaceId: string;
|
|
1258
|
+
command: string;
|
|
1259
|
+
cwd?: string;
|
|
1260
|
+
environment?: Readonly<Record<string, string>>;
|
|
1261
|
+
timeoutMs?: number;
|
|
1262
|
+
network?: "none" | "restricted" | "full";
|
|
1263
|
+
resources?: {
|
|
1264
|
+
cpu?: number;
|
|
1265
|
+
memoryMb?: number;
|
|
1266
|
+
diskMb?: number;
|
|
1267
|
+
};
|
|
1268
|
+
}
|
|
1269
|
+
interface ExecutionResult {
|
|
1270
|
+
executionId: string;
|
|
1271
|
+
status: ExecutionStatus;
|
|
1272
|
+
exitCode?: number;
|
|
1273
|
+
stdout: string;
|
|
1274
|
+
stderr: string;
|
|
1275
|
+
artifactIds: readonly string[];
|
|
1276
|
+
}
|
|
1277
|
+
interface ExecutionProvider {
|
|
1278
|
+
readonly id: string;
|
|
1279
|
+
execute(request: ExecutionRequest): Promise<ExecutionResult>;
|
|
1280
|
+
cancel(executionId: string): Promise<void>;
|
|
1281
|
+
}
|
|
1282
|
+
interface ExecutionController {
|
|
1283
|
+
register(provider: ExecutionProvider): void;
|
|
1284
|
+
execute(request: ExecutionRequest, providerId?: string): Promise<ExecutionResult>;
|
|
1285
|
+
cancel(executionId: string): Promise<void>;
|
|
1286
|
+
}
|
|
1287
|
+
|
|
1288
|
+
declare class DefaultExecutionController implements ExecutionController {
|
|
1289
|
+
private readonly providers;
|
|
1290
|
+
private readonly executions;
|
|
1291
|
+
register(provider: ExecutionProvider): void;
|
|
1292
|
+
execute(request: ExecutionRequest, providerId?: string): Promise<ExecutionResult>;
|
|
1293
|
+
cancel(executionId: string): Promise<void>;
|
|
1294
|
+
}
|
|
1295
|
+
|
|
1296
|
+
export { type BackendCommand, type Connection, type DAGValidationResult, DefaultExecutionController, type DefaultFrontendReference, type DependencyContract, type EndpointDescriptor, EventBus, type EventChannel, type EventContract, type EventDefinition, type EventHandler, type EventSubscription, type ExecutionContext, type ExecutionController, type ExecutionProvider, type ExecutionRequest, type ExecutionResult, type ExecutionStatus, type FunctionalityCustomEvents, type FunctionalityDefinition, type FunctionalityEventNamespace, type FunctionalityEvents, type FunctionalityExecutionContext, FunctionalityFacade, type FunctionalityFlow, type FunctionalityFlowStep, type FunctionalityLifecycleEvent, type FunctionalityLifecyclePayload, FunctionalityOrchestration, type FunctionalityStepOptions, HttpProtocolAdapter, type IService, type IServiceFacade, type JobStatus, type KrnlJobDefinition, type KrnlJobHandle, type KrnlJobOptions, KrnlPackageReconciler, KrnlQueue, type KrnlQueueOptions, type KrnlWorkerInfo, KrnlWorkerPool, type KrnlWorkerState, type LifecycleContract, LifecycleManager, MemoryTransport, type NormalizedResult, type OperationContext, type OperationContract, type OrchestrationContext, type OrchestrationDefinition, type OrchestrationDescriptor, OrchestrationEventFacade, type OrchestrationEventNamespace, type OrchestrationFrontendReference, type OrchestrationLifecyclePayload, type OrchestrationResult, type OrchestrationStatus, type OrchestrationStep, P2PProtocolAdapter, type PeerRecord, type ProtocolAdapter, type ProtocolCapabilities, type ProtocolEnvelope, ProtocolResolver, type ProtocolType, type ReconcileResult, type RegisteredServiceRecord, type SagaCompensationHandler, type ServiceCapability, type ServiceDefinition, ServiceDiscovery, ServiceEventBus, ServiceFacade, type ServiceFacadeConfig, ServiceInstance, type ServiceNamespace, ServiceProxy, ServiceRegistry, ServiceRuntime, ServiceStateStore, type ServiceStatus, type StateContract, type StepCompensation, type StepCondition, type StepDefinition, type StepExecutionResult, type StepExecutionStatus, type StepRetryPolicy, type StepStatus, type StepTimeoutPolicy, type StepType, TelemetryController, type TelemetryHandle, type TelemetryInvocation, type TelemetryMode, type TelemetryOptions, type TelemetryPercentiles, type TelemetryResourceSample, type TelemetrySnapshot, type TelemetryStatus, type TelemetryTargetStats, UdpProtocolAdapter, WebSocketProtocolAdapter, WorkerExecutionBoundary, createEventChannels, createService, createServiceDefinition, createServiceFacade, createServiceProxy, deltaResources, sampleResources, telemetryNow, validateOrchestrationDAG, validateServiceDefinition };
|
|
@@ -4042,7 +4042,30 @@ var FunctionalityOrchestration = class {
|
|
|
4042
4042
|
|
|
4043
4043
|
// src/index.ts
|
|
4044
4044
|
import * as gutts from "@dinilmusick/gutts";
|
|
4045
|
+
|
|
4046
|
+
// src/execution/execution-controller.ts
|
|
4047
|
+
var DefaultExecutionController = class {
|
|
4048
|
+
providers = /* @__PURE__ */ new Map();
|
|
4049
|
+
executions = /* @__PURE__ */ new Map();
|
|
4050
|
+
register(provider) {
|
|
4051
|
+
this.providers.set(provider.id, provider);
|
|
4052
|
+
}
|
|
4053
|
+
async execute(request, providerId) {
|
|
4054
|
+
const provider = providerId ? this.providers.get(providerId) : this.providers.values().next().value;
|
|
4055
|
+
if (!provider) throw new Error("No execution provider is registered.");
|
|
4056
|
+
const result = await provider.execute(request);
|
|
4057
|
+
this.executions.set(result.executionId, provider);
|
|
4058
|
+
return result;
|
|
4059
|
+
}
|
|
4060
|
+
async cancel(executionId) {
|
|
4061
|
+
const provider = this.executions.get(executionId);
|
|
4062
|
+
if (!provider) throw new Error(`Unknown execution: ${executionId}`);
|
|
4063
|
+
await provider.cancel(executionId);
|
|
4064
|
+
this.executions.delete(executionId);
|
|
4065
|
+
}
|
|
4066
|
+
};
|
|
4045
4067
|
export {
|
|
4068
|
+
DefaultExecutionController,
|
|
4046
4069
|
EventBus,
|
|
4047
4070
|
FunctionalityFacade,
|
|
4048
4071
|
FunctionalityOrchestration,
|