@makaio/framework 1.0.0-dev-1788258714339 → 1.0.0-dev-1788721567504
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/.makaio-build.json +2 -2
- package/dist/attempt-record-codec-BORASgzn.mjs +1 -0
- package/dist/authority-state-bootstrap-eitx6Ukn.mjs +1 -0
- package/dist/bus/index.d.mts +19 -19
- package/dist/bus/index.mjs +1 -1
- package/dist/capabilities-DEvmD9VJ.mjs +1 -0
- package/dist/{context-resolution-CW4OtPrS.d.mts → context-resolution-CoKFKIqz.d.mts} +5 -5
- package/dist/contracts/adapter/index.d.mts +1 -1
- package/dist/contracts/artifact/index.d.mts +2 -2
- package/dist/contracts/canonical-model/index.d.mts +1 -1
- package/dist/contracts/capabilities/index.d.mts +2 -2
- package/dist/contracts/capabilities/index.mjs +1 -1
- package/dist/contracts/client/index.d.mts +1 -1
- package/dist/contracts/extension/index.d.mts +3 -3
- package/dist/contracts/harness/index.d.mts +1 -1
- package/dist/contracts/index.d.mts +618 -124
- package/dist/contracts/index.mjs +1 -1
- package/dist/contracts/materialization/index.d.mts +3 -3
- package/dist/contracts/session/index.d.mts +2 -2
- package/dist/contracts/shared/index.d.mts +1 -1
- package/dist/contracts/variant/index.d.mts +1 -1
- package/dist/contracts/worker/index.d.mts +2 -0
- package/dist/contracts/worker/index.mjs +1 -0
- package/dist/contracts/workflow/index.d.mts +2 -2
- package/dist/contracts/workflow/index.mjs +1 -1
- package/dist/{execution-attempt-repository-BJ2W6wwx.d.mts → execution-attempt-repository-CRdrgou3.d.mts} +869 -58
- package/dist/{index-jxPncqWZ2.d.mts → index--Ws52sWV2.d.mts} +4 -4
- package/dist/{index-OG402CBI.d.mts → index-37_b--BH.d.mts} +85 -85
- package/dist/{index-B-3I98nw.d.mts → index-AdcDBUnc.d.mts} +95 -95
- package/dist/{index-CMekqu_D.d.mts → index-BJdkVFX9.d.mts} +327 -63
- package/dist/{index-4KJ6IDE7.d.mts → index-BKIxdzIw.d.mts} +5 -5
- package/dist/{index-CPi0UpRh.d.mts → index-B_8bA2JW.d.mts} +1 -1
- package/dist/{index-CmwAJ8-5.d.mts → index-CFI6FxC7.d.mts} +1 -1
- package/dist/{index-BqlCDBfc.d.mts → index-CVcG4Q3X.d.mts} +5 -5
- package/dist/{index-DXqG0r3o.d.mts → index-CxwqnZpT.d.mts} +62 -62
- package/dist/{index-BkbnC65b.d.mts → index-CyWGSxrs.d.mts} +291 -291
- package/dist/{index-B9V3T4EQ.d.mts → index-D037TVsm.d.mts} +4 -4
- package/dist/{index-C146Eq_J.d.mts → index-D1wTWSLR.d.mts} +327 -327
- package/dist/{index-DWkFkvRn2.d.mts → index-D8D-yibS2.d.mts} +3 -3
- package/dist/{index-Bqk0pJBQ2.d.mts → index-DBD_oFEt2.d.mts} +1 -1
- package/dist/{index-DJ2KgJDJ2.d.mts → index-DV38-klA2.d.mts} +59 -83
- package/dist/{index-C3lu_fy5.d.mts → index-I5a37JCm.d.mts} +76 -76
- package/dist/{namespace-l-HG1rLF.d.mts → namespace-Bo94cenp.d.mts} +136 -136
- package/dist/{namespace-DknCutQZ.d.mts → namespace-CPm9dhi2.d.mts} +2 -2
- package/dist/{namespace-BNp7n_gu.d.mts → namespace-CsnrP8AD.d.mts} +3 -3
- package/dist/{namespace-BGRHcrmp.d.mts → namespace-CstawJgN.d.mts} +2 -2
- package/dist/{namespace-C06lJSuj.d.mts → namespace-K23m4b0n.d.mts} +6 -6
- package/dist/{package-BNFTUFLB.d.mts → package-DkZmsdCd.d.mts} +107 -30
- package/dist/package-UemD2NWn.mjs +7 -0
- package/dist/package.json +1 -1
- package/dist/runtime-node/index.d.mts +2 -2
- package/dist/runtime-node/index.mjs +24 -24
- package/dist/runtime-node/makaio-config.d.mts +2 -2
- package/dist/runtime-node/makaio-config.mjs +1 -1
- package/dist/runtime-node/workflow-execution-bus-access.mjs +1 -1
- package/dist/runtime-node/workflow-worker/index.d.mts +2 -2
- package/dist/runtime-node/workflow-worker/index.mjs +1 -1
- package/dist/runtime-node/workflow-worker/worker-entry.d.mts +49 -9
- package/dist/runtime-node/workflow-worker/worker-entry.mjs +1 -1
- package/dist/runtime-registration-client-BTtFpt_k.mjs +1 -0
- package/dist/{schemas-OWvBn7AH.d.mts → schemas-BCXvEWyF.d.mts} +4 -4
- package/dist/{schemas-Dd0po67F.d.mts → schemas-CJKHYluy.d.mts} +16 -16
- package/dist/{schemas-C1mxTfd7.d.mts → schemas-CenET9Cq.d.mts} +1 -1
- package/dist/{schemas-D7ScxLrf.d.mts → schemas-DTJtS14K.d.mts} +136 -136
- package/dist/services/adapter-runtime/index.d.mts +3 -3
- package/dist/services/adapter-runtime/namespace.d.mts +1 -1
- package/dist/services/adapter-runtime/schemas.d.mts +1 -1
- package/dist/services/adapter-subsystem/index.d.mts +2 -2
- package/dist/services/adapter-subsystem/namespace.d.mts +1 -1
- package/dist/services/agent-runtime/index.d.mts +2 -2
- package/dist/services/agent-runtime/namespace.d.mts +1 -1
- package/dist/services/agent-runtime/schemas.d.mts +1 -1
- package/dist/services/filesystem/namespace.d.mts +6 -6
- package/dist/services/filesystem/schemas.d.mts +3 -3
- package/dist/services/harness/index.d.mts +3 -3
- package/dist/services/index.d.mts +93 -93
- package/dist/services/provider-context/index.d.mts +1 -1
- package/dist/services/session/index.d.mts +2 -2
- package/dist/services/session/messages/namespace.d.mts +1 -1
- package/dist/services/settings/namespace.d.mts +12 -12
- package/dist/services/settings/storage/extension-configs/namespace.d.mts +3 -3
- package/dist/services/subagent-template/index.d.mts +2 -2
- package/dist/services/subagent-template/namespace.d.mts +1 -1
- package/dist/services/subagent-template/schemas.d.mts +1 -1
- package/dist/{transition-DXmCUq6w.d.mts → transition-DxsrTsn4.d.mts} +1 -1
- package/dist/{types-DcxBYlPA.d.mts → types-Czdm5op1.d.mts} +306 -306
- package/dist/ui-components/index.d.mts +4 -4
- package/dist/{view-builder-k82f5KFd.d.mts → view-builder-D-Wz_l_B.d.mts} +1 -1
- package/dist/worker-CLsRbzpk.mjs +1 -0
- package/dist/worker-DlRdLf2d.mjs +1 -0
- package/dist/workflow-BomH9DBB.mjs +1 -0
- package/dist/workflow-engine/execution-attempt-repository.d.mts +2 -2
- package/dist/workflow-engine/execution-attempt-repository.mjs +1 -1
- package/dist/workflow-engine/index.d.mts +352 -62
- package/dist/workflow-engine/index.mjs +1 -1
- package/dist/workflow-engine/package.d.mts +1 -1
- package/dist/workflow-engine/package.mjs +1 -1
- package/dist/workflow-engine/testing/index.d.mts +83 -10
- package/dist/workflow-engine/testing/index.mjs +1 -1
- package/dist/workflow-engine/testing/sqlite.d.mts +3 -2
- package/dist/workflow-engine/testing/sqlite.mjs +107 -39
- package/dist/workflow-engine/workflow-orchestrator.mjs +1 -1
- package/dist/workflow-worker-DjUfKshi.mjs +1 -0
- package/package.json +4 -4
- package/dist/attempt-record-codec-BYfYkj4M.mjs +0 -1
- package/dist/authority-state-bootstrap-CLYus369.mjs +0 -1
- package/dist/await-trigger-Bkg2BQfg.mjs +0 -1
- package/dist/capabilities-BUwuA7XX.mjs +0 -1
- package/dist/contracts/worker-node/index.d.mts +0 -2
- package/dist/contracts/worker-node/index.mjs +0 -1
- package/dist/package-B01gmu75.mjs +0 -7
- package/dist/worker-node-CjuQb9hl.mjs +0 -1
- package/dist/worker-node-Dtf9ilsR.mjs +0 -1
- package/dist/workflow-C4mck_NW.mjs +0 -1
- package/dist/workflow-worker-aNbdgqml.mjs +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { r as ExtensionDiscovery } from "./extension-discovery-Dhu3WplO.mjs";
|
|
2
2
|
import { RegistrableBusNamespaceDefinition } from "@makaio/framework/core";
|
|
3
3
|
import { BusTransport, IMakaioBus, SubjectTelemetryProjectorRegistry } from "@makaio/framework/bus";
|
|
4
|
-
import { ExtensionConfigProvider,
|
|
4
|
+
import { ExecutionAttemptOperationAdmitRefusalReason, ExecutionAttemptOperationDelivery, ExecutionAttemptOperationKind, ExecutionAttemptOperationReceipt, ExecutionAttemptRuntimeRegisterRefusalReason, ExtensionConfigProvider, IWorkerProvider, IWorkflowRunner, IWorkflowRunner as IWorkflowRunner$1, LoopGateHandler, MakaioNodeExtension, NormalizedWorkerCapabilities, OutcomeAckDecision, StationHandler, StepRunnerBusAuth, StepRunnerPlatformDefaults, TrayManifest, WorkerAllocatedOutcome, WorkerBootstrapClaimResponse, WorkerCapabilities, WorkerContributionManifest, WorkerContributionRef, WorkerDispatch, WorkerMaterializationSpec, WorkerProvisionRequest, WorkerRequirements, WorkerRuntimeContext, WorkflowDefinition, WorkflowRunContext, WorkflowRunResult, WorkflowRunResult as WorkflowRunResult$1, WorkflowRunnerCompletion, WorkflowRunnerCompletion as WorkflowRunnerCompletion$1, WorkflowRunnerRunOptions, WorkflowWorkerConfig, WorkflowWorkerSource, WorkflowZodSchemas } from "@makaio/framework/contracts";
|
|
5
5
|
import { DispatchingAuth, TransportAuth } from "@makaio/framework/node/transports";
|
|
6
6
|
import { ContributionProcessor, ExtensionCoordinator, ExtensionRuntimeSurface, KernelExtensionContext, KernelMakaioExtension, RuntimeCapability, TransportProvider, WindowRegistry } from "@makaio/framework/kernel";
|
|
7
7
|
import { StorageEngine } from "@makaio/framework/storage/drizzle";
|
|
@@ -747,22 +747,22 @@ type WorkflowRunnerBootOptions = {
|
|
|
747
747
|
readonly idleTimeoutMs?: number;
|
|
748
748
|
} | {
|
|
749
749
|
/**
|
|
750
|
-
* Delegate workflow executions to a product-owned
|
|
750
|
+
* Delegate workflow executions to a product-owned Worker dispatch seam.
|
|
751
751
|
*
|
|
752
752
|
* The dispatch function is supplied by the host composition root and
|
|
753
753
|
* typically wired to `workerPool.dispatch`. Framework code remains
|
|
754
754
|
* decoupled from any pool implementation details.
|
|
755
755
|
*/
|
|
756
|
-
readonly mode: 'worker
|
|
756
|
+
readonly mode: 'worker';
|
|
757
757
|
/**
|
|
758
|
-
*
|
|
758
|
+
* Worker dispatch function injected by the host composition root.
|
|
759
759
|
*
|
|
760
760
|
* Called once per workflow execution with the full worker config and
|
|
761
761
|
* manifest. Product hosts may wire this to `workerPool.dispatch`.
|
|
762
762
|
* When omitted, the Node runtime dispatches through the framework
|
|
763
|
-
* `worker
|
|
763
|
+
* `worker.dispatch` bus subject and requires a bus instance.
|
|
764
764
|
*/
|
|
765
|
-
readonly dispatch?:
|
|
765
|
+
readonly dispatch?: WorkerDispatch;
|
|
766
766
|
/**
|
|
767
767
|
* Contribution manifest forwarded to each dispatch call.
|
|
768
768
|
*
|
|
@@ -777,7 +777,7 @@ type WorkflowRunnerBootOptions = {
|
|
|
777
777
|
* When provided, the pool uses these to select a compatible provider.
|
|
778
778
|
* Omit to accept any available pool with no constraints.
|
|
779
779
|
*/
|
|
780
|
-
readonly requirements?:
|
|
780
|
+
readonly requirements?: WorkerRequirements;
|
|
781
781
|
};
|
|
782
782
|
/**
|
|
783
783
|
* Bound address info passed to {@link BootMakaioRuntimeOptions.onTransportReady}.
|
|
@@ -1055,17 +1055,17 @@ interface CoreBootOptions {
|
|
|
1055
1055
|
/** Host-owned resolvers that create portable specs for path-backed workflow starts. */
|
|
1056
1056
|
readonly workflowMaterializationSpecResolvers?: readonly WorkflowMaterializationSpecResolver[];
|
|
1057
1057
|
/**
|
|
1058
|
-
* Injected execution attempt persistence port for
|
|
1058
|
+
* Injected execution attempt persistence port for Worker dispatch.
|
|
1059
1059
|
*
|
|
1060
|
-
* Required when `workflowRunner.mode` is `'worker
|
|
1060
|
+
* Required when `workflowRunner.mode` is `'worker'`. The consuming
|
|
1061
1061
|
* Factory provides the concrete implementation that owns durable attempt
|
|
1062
1062
|
* records and accept/duplicate/conflict/fence decisions.
|
|
1063
1063
|
*
|
|
1064
1064
|
* When omitted, framework-only, in-process, and Piscina modes operate
|
|
1065
|
-
* without attempt tracking.
|
|
1065
|
+
* without attempt tracking. Worker mode fails fast at boot when this
|
|
1066
1066
|
* is not provided.
|
|
1067
1067
|
*/
|
|
1068
|
-
readonly executionAttemptRepository?: ExecutionAttemptRepository
|
|
1068
|
+
readonly executionAttemptRepository?: ExecutionAttemptRepository<WorkflowRunResult>;
|
|
1069
1069
|
/**
|
|
1070
1070
|
* Runtime data home for config, database, machine identity, and installed
|
|
1071
1071
|
* extensions. Defaults to the `MAKAIO_HOME` environment override when set,
|
|
@@ -1299,9 +1299,16 @@ interface ThinWorkflowPiscinaRunnerOptions {
|
|
|
1299
1299
|
}
|
|
1300
1300
|
//#endregion
|
|
1301
1301
|
//#region runtimes/node/src/workflow-worker/worker-ready-message.d.ts
|
|
1302
|
-
/** Message type posted by workflow workers once
|
|
1302
|
+
/** Message type posted by workflow workers once the authority accepted the runtime. */
|
|
1303
1303
|
declare const WORKFLOW_WORKER_READY_MESSAGE_TYPE: "makaio.workflow-worker.ready";
|
|
1304
|
-
/**
|
|
1304
|
+
/**
|
|
1305
|
+
* Piscina worker-to-pool message emitted after the attempt accepted this runtime.
|
|
1306
|
+
*
|
|
1307
|
+
* The message is posted only by the attempt-bound arm of the worker entrypoint,
|
|
1308
|
+
* after `execution-attempt.runtime.register` returned and the workflow run
|
|
1309
|
+
* passed the attempt's start gate. It therefore means "the authority accepted
|
|
1310
|
+
* this runtime", not "the worker finished composing itself".
|
|
1311
|
+
*/
|
|
1305
1312
|
interface WorkflowWorkerReadyMessage {
|
|
1306
1313
|
/** Stable message discriminator. */
|
|
1307
1314
|
readonly type: typeof WORKFLOW_WORKER_READY_MESSAGE_TYPE;
|
|
@@ -1309,11 +1316,16 @@ interface WorkflowWorkerReadyMessage {
|
|
|
1309
1316
|
readonly executionId: string;
|
|
1310
1317
|
/** Dynamic workflow cancel subject observed by the worker. */
|
|
1311
1318
|
readonly cancelSubject: string;
|
|
1312
|
-
/**
|
|
1313
|
-
readonly
|
|
1319
|
+
/** Attempt whose runtime registration the authority accepted. */
|
|
1320
|
+
readonly executionAttemptId: string;
|
|
1314
1321
|
}
|
|
1315
1322
|
//#endregion
|
|
1316
1323
|
//#region runtimes/node/src/workflow-worker/thin-workflow-piscina-runner.d.ts
|
|
1324
|
+
/** Attempt identity a readiness-aware dispatch binds its worker thread to. */
|
|
1325
|
+
interface ThinWorkflowPiscinaAttemptBinding {
|
|
1326
|
+
/** Authority-created attempt the dispatched thread registers against. */
|
|
1327
|
+
readonly executionAttemptId: string;
|
|
1328
|
+
}
|
|
1317
1329
|
/** Result and readiness promises for one workflow worker dispatch. */
|
|
1318
1330
|
interface ThinWorkflowPiscinaRunWithReadiness {
|
|
1319
1331
|
/** Terminal workflow result returned by the worker. */
|
|
@@ -1344,7 +1356,7 @@ declare class ThinWorkflowPiscinaRunner implements IWorkflowRunner$1 {
|
|
|
1344
1356
|
* Execute a complete workflow in a pooled worker thread.
|
|
1345
1357
|
*
|
|
1346
1358
|
* When `manifest` is provided it overrides the runner's construction-time
|
|
1347
|
-
* default, so per-request contribution sets from the
|
|
1359
|
+
* default, so per-request contribution sets from the Worker pool are
|
|
1348
1360
|
* applied correctly without requiring a new runner instance.
|
|
1349
1361
|
* @param config - Full workflow worker configuration with source, inputs, and bus info.
|
|
1350
1362
|
* @param signal - AbortSignal for cooperative cancellation.
|
|
@@ -1353,18 +1365,23 @@ declare class ThinWorkflowPiscinaRunner implements IWorkflowRunner$1 {
|
|
|
1353
1365
|
*/
|
|
1354
1366
|
run(config: WorkflowWorkerConfig, signal: AbortSignal, manifest?: WorkerContributionManifest): Promise<WorkflowRunnerCompletion$1>;
|
|
1355
1367
|
/**
|
|
1356
|
-
* Execute
|
|
1368
|
+
* Execute an attempt-bound workflow and expose its readiness signal separately.
|
|
1357
1369
|
*
|
|
1358
1370
|
* The terminal result remains the {@link IWorkflowRunner} contract. The ready
|
|
1359
|
-
* promise
|
|
1360
|
-
* `
|
|
1361
|
-
*
|
|
1371
|
+
* promise resolves once the worker thread's own
|
|
1372
|
+
* `execution-attempt.runtime.register` reply came back, so readiness here
|
|
1373
|
+
* means the authority accepted that runtime rather than that a thread booted.
|
|
1374
|
+
*
|
|
1375
|
+
* The attempt binding is required because readiness has no meaning without
|
|
1376
|
+
* it: a thread with no attempt registers nothing, posts no ready message, and
|
|
1377
|
+
* would leave this promise to be rejected by the run's own settlement.
|
|
1362
1378
|
* @param config - Full workflow worker configuration with source, inputs, and bus info.
|
|
1363
1379
|
* @param signal - AbortSignal for cooperative cancellation.
|
|
1364
1380
|
* @param manifest - Optional per-call manifest override.
|
|
1381
|
+
* @param attempt - Attempt identity the dispatched thread registers against.
|
|
1365
1382
|
* @returns Terminal result and readiness promises for this worker run.
|
|
1366
1383
|
*/
|
|
1367
|
-
runWithReadiness(config: WorkflowWorkerConfig, signal: AbortSignal, manifest
|
|
1384
|
+
runWithReadiness(config: WorkflowWorkerConfig, signal: AbortSignal, manifest: WorkerContributionManifest | undefined, attempt: ThinWorkflowPiscinaAttemptBinding): ThinWorkflowPiscinaRunWithReadiness;
|
|
1368
1385
|
/**
|
|
1369
1386
|
* Destroy the thread pool and release all worker threads.
|
|
1370
1387
|
*/
|
|
@@ -1373,6 +1390,11 @@ declare class ThinWorkflowPiscinaRunner implements IWorkflowRunner$1 {
|
|
|
1373
1390
|
* Realize portable filesystem references before transferring a task to
|
|
1374
1391
|
* Piscina. Worker threads receive only verified absolute paths, never an
|
|
1375
1392
|
* Authority-relative source or unchecked contribution package path.
|
|
1393
|
+
*
|
|
1394
|
+
* The task is returned as the `unbound` arm; the readiness-aware path
|
|
1395
|
+
* re-stamps it `attempt-bound` with its attempt identity afterwards, so the
|
|
1396
|
+
* attempt identity never becomes an optional field on the shape the
|
|
1397
|
+
* attempt-free path also uses.
|
|
1376
1398
|
* @param config - Portable worker configuration.
|
|
1377
1399
|
* @param manifest - Exact contribution identities for this execution.
|
|
1378
1400
|
* @param signal - Cancellation signal for the dispatch.
|
|
@@ -1398,18 +1420,18 @@ interface CreateNodeWorkflowRunnerPackageOptionsParams {
|
|
|
1398
1420
|
* Host-owned bus instance forwarded to in-process runner construction.
|
|
1399
1421
|
*
|
|
1400
1422
|
* Required when `workflowRunner.mode` is `'in-process'` or omitted on an
|
|
1401
|
-
* explicit runner object. Also used by
|
|
1423
|
+
* explicit runner object. Also used by Worker mode when no explicit
|
|
1402
1424
|
* dispatch function is supplied. Ignored for Piscina mode.
|
|
1403
1425
|
*/
|
|
1404
1426
|
readonly bus?: IMakaioBus;
|
|
1405
1427
|
/**
|
|
1406
1428
|
* Injected execution attempt persistence port.
|
|
1407
1429
|
*
|
|
1408
|
-
* Required when `workflowRunner.mode` is `'worker
|
|
1430
|
+
* Required when `workflowRunner.mode` is `'worker'`. Threaded
|
|
1409
1431
|
* through to the workflow engine service options so the Authority
|
|
1410
1432
|
* service can delegate durable decisions.
|
|
1411
1433
|
*/
|
|
1412
|
-
readonly executionAttemptRepository?: ExecutionAttemptRepository
|
|
1434
|
+
readonly executionAttemptRepository?: ExecutionAttemptRepository<WorkflowRunResult>;
|
|
1413
1435
|
/** Host-owned resolvers for portable path-backed workflow starts. */
|
|
1414
1436
|
readonly workflowMaterializationSpecResolvers?: readonly WorkflowMaterializationSpecResolver[];
|
|
1415
1437
|
}
|
|
@@ -1431,18 +1453,18 @@ interface NodeWorkflowRunnerPackageOptions {
|
|
|
1431
1453
|
/**
|
|
1432
1454
|
* Injected execution attempt persistence port.
|
|
1433
1455
|
*
|
|
1434
|
-
* Present only when the workflow runner uses
|
|
1456
|
+
* Present only when the workflow runner uses Worker dispatch mode.
|
|
1435
1457
|
* Forwarded to the workflow engine service for Authority construction.
|
|
1436
1458
|
*/
|
|
1437
|
-
readonly executionAttemptRepository?: ExecutionAttemptRepository
|
|
1459
|
+
readonly executionAttemptRepository?: ExecutionAttemptRepository<WorkflowRunResult>;
|
|
1438
1460
|
/**
|
|
1439
1461
|
* Execution attempt Authority constructed from the injected repository.
|
|
1440
1462
|
*
|
|
1441
|
-
* Present only when the workflow runner uses
|
|
1463
|
+
* Present only when the workflow runner uses Worker dispatch mode.
|
|
1442
1464
|
* Shared between the runner (for attempt creation before dispatch) and
|
|
1443
1465
|
* the workflow engine service (for outcome commitment).
|
|
1444
1466
|
*/
|
|
1445
|
-
readonly executionAttemptAuthority?: ExecutionAttemptAuthority
|
|
1467
|
+
readonly executionAttemptAuthority?: ExecutionAttemptAuthority<WorkflowRunResult>;
|
|
1446
1468
|
/** Host-owned resolvers forwarded to the workflow engine service. */
|
|
1447
1469
|
readonly workflowMaterializationSpecResolvers?: readonly WorkflowMaterializationSpecResolver[];
|
|
1448
1470
|
}
|
|
@@ -1467,17 +1489,17 @@ interface CreateNodeWorkflowRunnerParams {
|
|
|
1467
1489
|
* Host-owned bus instance forwarded to {@link InProcessWorkflowRunner}.
|
|
1468
1490
|
*
|
|
1469
1491
|
* Required when `runner` is present and its `mode` is `'in-process'` or
|
|
1470
|
-
* omitted. Also required for `'worker
|
|
1492
|
+
* omitted. Also required for `'worker'` mode when no explicit dispatch
|
|
1471
1493
|
* function is supplied. Ignored for Piscina mode.
|
|
1472
1494
|
*/
|
|
1473
1495
|
readonly bus?: IMakaioBus;
|
|
1474
1496
|
/**
|
|
1475
|
-
* Execution attempt Authority injected into
|
|
1497
|
+
* Execution attempt Authority injected into Worker runners.
|
|
1476
1498
|
*
|
|
1477
|
-
* Required when `runner.mode` is `'worker
|
|
1499
|
+
* Required when `runner.mode` is `'worker'`. The runner uses this
|
|
1478
1500
|
* to create attempts before dispatch and wait for committed outcomes.
|
|
1479
1501
|
*/
|
|
1480
|
-
readonly authority?: ExecutionAttemptAuthority
|
|
1502
|
+
readonly authority?: ExecutionAttemptAuthority<WorkflowRunResult>;
|
|
1481
1503
|
}
|
|
1482
1504
|
/**
|
|
1483
1505
|
* Create a workflow-level runner based on the Node runtime configuration.
|
|
@@ -1490,18 +1512,18 @@ interface CreateNodeWorkflowRunnerParams {
|
|
|
1490
1512
|
*/
|
|
1491
1513
|
declare function createNodeWorkflowRunner(params: CreateNodeWorkflowRunnerParams): IWorkflowRunner | undefined;
|
|
1492
1514
|
//#endregion
|
|
1493
|
-
//#region runtimes/node/src/workflow-worker/worker-
|
|
1515
|
+
//#region runtimes/node/src/workflow-worker/worker-runner.d.ts
|
|
1494
1516
|
/**
|
|
1495
|
-
* Construction options for {@link
|
|
1517
|
+
* Construction options for {@link WorkerRunner}.
|
|
1496
1518
|
*/
|
|
1497
|
-
interface
|
|
1519
|
+
interface WorkerRunnerOptions {
|
|
1498
1520
|
/**
|
|
1499
1521
|
* Dispatch seam injected by the host composition root.
|
|
1500
1522
|
*
|
|
1501
1523
|
* Product hosts wire this to `workerPool.dispatch` or another implementation.
|
|
1502
1524
|
* Framework code calls through this seam without coupling to any pool.
|
|
1503
1525
|
*/
|
|
1504
|
-
readonly dispatch:
|
|
1526
|
+
readonly dispatch: WorkerDispatch;
|
|
1505
1527
|
/**
|
|
1506
1528
|
* Execution attempt Authority used to create attempts before dispatch and
|
|
1507
1529
|
* wait for committed outcomes after dispatch returns.
|
|
@@ -1509,7 +1531,7 @@ interface WorkerNodeRunnerOptions {
|
|
|
1509
1531
|
* Required for authority-committed completions. When absent, the runner
|
|
1510
1532
|
* cannot create attempts or wait for durable outcomes.
|
|
1511
1533
|
*/
|
|
1512
|
-
readonly authority: ExecutionAttemptAuthority
|
|
1534
|
+
readonly authority: ExecutionAttemptAuthority<WorkflowRunResult>;
|
|
1513
1535
|
/**
|
|
1514
1536
|
* Extension contribution manifest forwarded to dispatched workers.
|
|
1515
1537
|
*
|
|
@@ -1523,10 +1545,10 @@ interface WorkerNodeRunnerOptions {
|
|
|
1523
1545
|
* When provided, the receiving pool uses these to select a compatible
|
|
1524
1546
|
* provider. Omit to accept any available pool.
|
|
1525
1547
|
*/
|
|
1526
|
-
readonly requirements?:
|
|
1548
|
+
readonly requirements?: WorkerRequirements;
|
|
1527
1549
|
}
|
|
1528
1550
|
/**
|
|
1529
|
-
* Workflow runner that delegates full workflow execution to a
|
|
1551
|
+
* Workflow runner that delegates full workflow execution to a Worker
|
|
1530
1552
|
* dispatch seam supplied by the host composition root.
|
|
1531
1553
|
*
|
|
1532
1554
|
* This class implements the {@link IWorkflowRunner} contract while remaining
|
|
@@ -1537,12 +1559,12 @@ interface WorkerNodeRunnerOptions {
|
|
|
1537
1559
|
* The runner creates an execution attempt through the injected Authority
|
|
1538
1560
|
* before dispatch and waits for the committed outcome after dispatch returns.
|
|
1539
1561
|
*/
|
|
1540
|
-
declare class
|
|
1562
|
+
declare class WorkerRunner implements IWorkflowRunner {
|
|
1541
1563
|
private readonly options;
|
|
1542
1564
|
/**
|
|
1543
1565
|
* @param options - Dispatch seam, authority, optional manifest, and optional requirements.
|
|
1544
1566
|
*/
|
|
1545
|
-
constructor(options:
|
|
1567
|
+
constructor(options: WorkerRunnerOptions);
|
|
1546
1568
|
/**
|
|
1547
1569
|
* Execute a complete workflow by delegating to the injected dispatch seam.
|
|
1548
1570
|
*
|
|
@@ -1688,9 +1710,10 @@ interface PiscinaThinWorkflowProviderOptions {
|
|
|
1688
1710
|
* can supply lightweight fakes without spawning real worker threads.
|
|
1689
1711
|
*
|
|
1690
1712
|
* Readiness is part of the requirement rather than an optional refinement:
|
|
1691
|
-
*
|
|
1692
|
-
*
|
|
1693
|
-
*
|
|
1713
|
+
* the thread's own registration is what makes the attempt ready, and this
|
|
1714
|
+
* provider watches that signal to abort the allocation when it fails. A
|
|
1715
|
+
* runner without one would silently swallow a refused registration instead
|
|
1716
|
+
* of failing where it is wired.
|
|
1694
1717
|
*/
|
|
1695
1718
|
readonly runner: ReadinessAwareWorkflowRunner;
|
|
1696
1719
|
/**
|
|
@@ -1711,7 +1734,7 @@ interface PiscinaThinWorkflowProviderOptions {
|
|
|
1711
1734
|
* call site instead of having the value silently dropped. See
|
|
1712
1735
|
* {@link PiscinaThinWorkflowProvider}.
|
|
1713
1736
|
*/
|
|
1714
|
-
readonly baseCapabilities?: Omit<Partial<
|
|
1737
|
+
readonly baseCapabilities?: Omit<Partial<WorkerCapabilities>, 'supportsRecovery'>;
|
|
1715
1738
|
/**
|
|
1716
1739
|
* Optional retry configuration for outcome submission.
|
|
1717
1740
|
*
|
|
@@ -1731,13 +1754,14 @@ interface PiscinaThinWorkflowProviderOptions {
|
|
|
1731
1754
|
*/
|
|
1732
1755
|
interface ReadinessAwareWorkflowRunner extends IWorkflowRunner {
|
|
1733
1756
|
/**
|
|
1734
|
-
* Run once and separately expose the worker's
|
|
1757
|
+
* Run once and separately expose the worker's own registration readiness.
|
|
1735
1758
|
* @param config - Worker configuration for the run.
|
|
1736
1759
|
* @param signal - AbortSignal that cancels the run.
|
|
1737
1760
|
* @param manifest - Optional per-call contribution manifest.
|
|
1738
|
-
* @
|
|
1761
|
+
* @param attempt - Attempt identity the dispatched worker registers against.
|
|
1762
|
+
* @returns Terminal result promise and registration readiness promise.
|
|
1739
1763
|
*/
|
|
1740
|
-
runWithReadiness(config:
|
|
1764
|
+
runWithReadiness(config: WorkerProvisionRequest['workerConfig'], signal: AbortSignal, manifest: WorkerProvisionRequest['workerManifest'] | undefined, attempt: ThinWorkflowPiscinaAttemptBinding): ThinWorkflowPiscinaRunWithReadiness;
|
|
1741
1765
|
}
|
|
1742
1766
|
/**
|
|
1743
1767
|
* Built-in thin workflow provider backed by the existing workflow-level
|
|
@@ -1747,13 +1771,14 @@ interface ReadinessAwareWorkflowRunner extends IWorkflowRunner {
|
|
|
1747
1771
|
* with the framework capability registry and participate in pool-driven
|
|
1748
1772
|
* dispatch. Each {@link provision} call starts the underlying runner and
|
|
1749
1773
|
* returns a validated {@link ProviderAllocationRef} together with an
|
|
1750
|
-
* infrastructure-only {@link
|
|
1774
|
+
* infrastructure-only {@link WorkerHandle}.
|
|
1751
1775
|
*
|
|
1752
1776
|
* The handle controls allocation lifecycle (cancel/terminate) but does
|
|
1753
|
-
* NOT expose readiness or workflow results. Readiness is
|
|
1754
|
-
*
|
|
1755
|
-
*
|
|
1756
|
-
* the Authority's `control.outcome.submit`
|
|
1777
|
+
* NOT expose readiness or workflow results. Readiness is the worker thread's
|
|
1778
|
+
* own business: it registers its runtime with the ExecutionAttempt authority,
|
|
1779
|
+
* which publishes `execution-attempt.runtime.ready`. Workflow outcomes are
|
|
1780
|
+
* submitted and acknowledged through the Authority's `control.outcome.submit`
|
|
1781
|
+
* bus subject.
|
|
1757
1782
|
*
|
|
1758
1783
|
* Piscina is a local thin workflow runner: it declares that it is NOT
|
|
1759
1784
|
* recoverable. Allocation references are process-local and non-durable.
|
|
@@ -1765,7 +1790,7 @@ interface ReadinessAwareWorkflowRunner extends IWorkflowRunner {
|
|
|
1765
1790
|
* recovery capability, and `supportsRecovery` stays `false` regardless of the
|
|
1766
1791
|
* capability overrides a host supplies.
|
|
1767
1792
|
*/
|
|
1768
|
-
declare class PiscinaThinWorkflowProvider implements
|
|
1793
|
+
declare class PiscinaThinWorkflowProvider implements IWorkerProvider {
|
|
1769
1794
|
private readonly options;
|
|
1770
1795
|
/** Execution environment tag used for pool provider matching. */
|
|
1771
1796
|
readonly environment: "piscina";
|
|
@@ -1777,7 +1802,7 @@ declare class PiscinaThinWorkflowProvider implements IWorkerNodeProvider {
|
|
|
1777
1802
|
*/
|
|
1778
1803
|
readonly allocationLifetime: "provisioner-process-bound";
|
|
1779
1804
|
/** Capabilities advertised to the pool dispatch selector. */
|
|
1780
|
-
readonly baseCapabilities:
|
|
1805
|
+
readonly baseCapabilities: NormalizedWorkerCapabilities;
|
|
1781
1806
|
/**
|
|
1782
1807
|
* @param options - Provider identity, runner, and optional capability overrides.
|
|
1783
1808
|
*/
|
|
@@ -1801,22 +1826,29 @@ declare class PiscinaThinWorkflowProvider implements IWorkerNodeProvider {
|
|
|
1801
1826
|
* runner. Cancellation is never flattened into an outcome, so callers
|
|
1802
1827
|
* can tell it apart from an ambiguous infrastructure rejection.
|
|
1803
1828
|
*
|
|
1804
|
-
* The return type is narrower than {@link
|
|
1829
|
+
* The return type is narrower than {@link IWorkerProvider.provision}:
|
|
1805
1830
|
* this provider allocates a local worker thread or rejects, and it has no
|
|
1806
1831
|
* way to positively prove that nothing was created. The narrow type states
|
|
1807
1832
|
* what it can prove today. Gaining the ability to confirm absence means
|
|
1808
1833
|
* deliberately widening this signature back to the contract union.
|
|
1834
|
+
* A worker configuration without a bus URL is rejected loudly rather than
|
|
1835
|
+
* allocated: the thread would have no transport, so it could never
|
|
1836
|
+
* authenticate as the attempt or register its runtime, and the allocation
|
|
1837
|
+
* would be a worker that is provisioned and permanently unready.
|
|
1809
1838
|
* @param request - Full provision request containing worker config and manifest.
|
|
1810
1839
|
* @param signal - AbortSignal for cooperative cancellation of the provision operation.
|
|
1811
1840
|
* @returns Allocated outcome with a validated allocation reference and infrastructure handle.
|
|
1841
|
+
* @throws When the worker configuration carries no bus URL.
|
|
1812
1842
|
*/
|
|
1813
|
-
provision(request:
|
|
1843
|
+
provision(request: WorkerProvisionRequest, signal: AbortSignal): Promise<WorkerAllocatedOutcome>;
|
|
1814
1844
|
/**
|
|
1815
1845
|
* Submit a workflow outcome through the Authority bus protocol after
|
|
1816
1846
|
* the runner promise settles.
|
|
1817
1847
|
*
|
|
1818
1848
|
* On success, submits the runner's result directly. On failure, builds
|
|
1819
|
-
* a `failed` {@link WorkflowRunResult} from the error message.
|
|
1849
|
+
* a `failed` {@link WorkflowRunResult} from the error message. Attached
|
|
1850
|
+
* only once the thread's run was admitted: a rejection before admission is
|
|
1851
|
+
* infrastructure evidence, not a workflow outcome, and never reaches here.
|
|
1820
1852
|
*
|
|
1821
1853
|
* Uses the shared {@link submitOutcomeWithAck} helper for decision-aware
|
|
1822
1854
|
* retry with bounded exponential back-off. Since the Piscina provider
|
|
@@ -1867,7 +1899,7 @@ interface InProcessWorkflowRunnerOptions {
|
|
|
1867
1899
|
* In-process implementation of {@link IWorkflowRunner}.
|
|
1868
1900
|
*
|
|
1869
1901
|
* Executes a full workflow inside the calling process using the shared host
|
|
1870
|
-
* bus. Unlike the Piscina and
|
|
1902
|
+
* bus. Unlike the Piscina and Worker runners, this runner does not spawn
|
|
1871
1903
|
* isolated processes or threads — the workflow orchestrator runs inline on the
|
|
1872
1904
|
* caller's bus.
|
|
1873
1905
|
*
|
|
@@ -1970,7 +2002,7 @@ type HeadlessWorkerBootstrapCredentials = WorkerBootstrapClaimResponse;
|
|
|
1970
2002
|
/**
|
|
1971
2003
|
* Bootstrap the worker by claiming execution-scoped bus credentials.
|
|
1972
2004
|
*
|
|
1973
|
-
* Implementations issue `
|
|
2005
|
+
* Implementations issue `WorkerSubjects.control['bootstrap.claim']`
|
|
1974
2006
|
* against an unauthenticated or bootstrap-authenticated bus and return the
|
|
1975
2007
|
* execution-scoped credentials for the authenticated connection.
|
|
1976
2008
|
* @param signal - Cancellation signal. Abort rejects the bootstrap.
|
|
@@ -2102,12 +2134,18 @@ interface HeadlessWorkflowWorkerResult {
|
|
|
2102
2134
|
/**
|
|
2103
2135
|
* Run a single workflow execution through the portable headless worker harness.
|
|
2104
2136
|
*
|
|
2105
|
-
*
|
|
2106
|
-
*
|
|
2137
|
+
* The runtime proves itself to the Authority before it asks for work: the
|
|
2138
|
+
* delivery endpoint is installed first, `execution-attempt.runtime.register`
|
|
2139
|
+
* returns only after the Authority made readiness durable, and the whole legacy
|
|
2140
|
+
* run then passes the attempt's start gate as one admitted `workflow-run`
|
|
2141
|
+
* operation. Kernel readiness is emitted later, by
|
|
2142
|
+
* `createIsolatedWorkflowRuntime` during composition.
|
|
2107
2143
|
* @param deps - Injected provider and product dependencies.
|
|
2108
2144
|
* @param signal - Cancellation signal from the process/caller.
|
|
2109
2145
|
* @returns Terminal result and durable ACK decision.
|
|
2110
2146
|
* @throws {@link OutcomeDeliveryError} When the Authority rejects the outcome.
|
|
2147
|
+
* @throws {@link RuntimeRegistrationRefusedError} When the Authority refuses this runtime.
|
|
2148
|
+
* @throws {@link OperationAdmissionRefusedError} When the Authority refuses the run.
|
|
2111
2149
|
* @throws When bootstrap, connection, materialization, or runtime composition fails.
|
|
2112
2150
|
*/
|
|
2113
2151
|
declare function runHeadlessWorkflowWorker(deps: HeadlessWorkflowWorkerDeps, signal: AbortSignal): Promise<HeadlessWorkflowWorkerResult>;
|
|
@@ -2174,4 +2212,230 @@ declare function loadWorkflowModules(source: Exclude<WorkflowWorkerSource, {
|
|
|
2174
2212
|
*/
|
|
2175
2213
|
declare function loadWorkflowModule(source: WorkflowWorkerSource): Promise<RuntimeLoadedWorkflow>;
|
|
2176
2214
|
//#endregion
|
|
2177
|
-
|
|
2215
|
+
//#region runtimes/node/src/workflow-worker/runtime-registration-client.d.ts
|
|
2216
|
+
/**
|
|
2217
|
+
* Operation kinds a runtime endpoint may be handed by the authority.
|
|
2218
|
+
*
|
|
2219
|
+
* `runtime-probe` is excluded: the bounded probe is the authority's own proof
|
|
2220
|
+
* that the endpoint accepts a fenced instruction, and
|
|
2221
|
+
* {@link installOperationDeliveryEndpoint} answers it itself. A caller-supplied
|
|
2222
|
+
* probe handler would be a second way to answer the same delivery.
|
|
2223
|
+
*/
|
|
2224
|
+
type DeliverableOperationKind = Exclude<ExecutionAttemptOperationKind, 'runtime-probe'>;
|
|
2225
|
+
/**
|
|
2226
|
+
* Runtime-side executor for one delivered operation.
|
|
2227
|
+
*
|
|
2228
|
+
* Receives the delivery verbatim and returns the receipt the authority sees.
|
|
2229
|
+
* A handler that cannot honour the delivery returns a `refused` receipt with
|
|
2230
|
+
* its reason rather than throwing — a throw is reported to the authority as a
|
|
2231
|
+
* failed request, which it reads as an unproven endpoint.
|
|
2232
|
+
* @param delivery - The operation the authority handed to this runtime.
|
|
2233
|
+
* @returns The receipt reported back to the authority.
|
|
2234
|
+
*/
|
|
2235
|
+
type OperationDeliveryHandler = (delivery: ExecutionAttemptOperationDelivery) => ExecutionAttemptOperationReceipt | Promise<ExecutionAttemptOperationReceipt>;
|
|
2236
|
+
/**
|
|
2237
|
+
* Handlers a runtime installs for the operation kinds it can execute.
|
|
2238
|
+
*
|
|
2239
|
+
* Partial by design: a delivery whose kind has no handler is answered
|
|
2240
|
+
* `refused` / `unknown-kind`, which is the honest report of a runtime that
|
|
2241
|
+
* does not know the instruction.
|
|
2242
|
+
*/
|
|
2243
|
+
type OperationDeliveryHandlers = Partial<Record<DeliverableOperationKind, OperationDeliveryHandler>>;
|
|
2244
|
+
/** Identity the delivery endpoint is installed for. */
|
|
2245
|
+
interface OperationDeliveryEndpointIdentity {
|
|
2246
|
+
/** Attempt this runtime owns; the first half of the delivery filter. */
|
|
2247
|
+
readonly executionAttemptId: string;
|
|
2248
|
+
/** This runtime incarnation; the second half of the delivery filter. */
|
|
2249
|
+
readonly runtimeIncarnationId: string;
|
|
2250
|
+
/**
|
|
2251
|
+
* Generation this incarnation was accepted with, when already known.
|
|
2252
|
+
*
|
|
2253
|
+
* Set when the endpoint is re-installed on another bus after registration
|
|
2254
|
+
* (the pre-composition → runtime bus handoff). A fresh endpoint installed
|
|
2255
|
+
* before registration leaves it out and learns the generation through
|
|
2256
|
+
* {@link OperationDeliveryEndpoint.bindGeneration}.
|
|
2257
|
+
*/
|
|
2258
|
+
readonly runtimeGeneration?: number;
|
|
2259
|
+
}
|
|
2260
|
+
/** The installed delivery endpoint of one runtime incarnation. */
|
|
2261
|
+
interface OperationDeliveryEndpoint {
|
|
2262
|
+
/**
|
|
2263
|
+
* Fence later deliveries against the generation the authority accepted.
|
|
2264
|
+
*
|
|
2265
|
+
* Called once registration returned. The probe needs no fence — it is
|
|
2266
|
+
* addressed to this incarnation and arrives before the generation exists —
|
|
2267
|
+
* but every other delivery is refused `stale-generation` unless it carries
|
|
2268
|
+
* exactly this generation.
|
|
2269
|
+
* @param runtimeGeneration - Generation returned by registration.
|
|
2270
|
+
*/
|
|
2271
|
+
bindGeneration(runtimeGeneration: number): void;
|
|
2272
|
+
/** Remove the endpoint from its bus. Idempotent. */
|
|
2273
|
+
cleanup(): void;
|
|
2274
|
+
}
|
|
2275
|
+
/**
|
|
2276
|
+
* Install this runtime's responder for `execution-attempt.operation.deliver`.
|
|
2277
|
+
*
|
|
2278
|
+
* The subject is static and every live Worker Runtime subscribes to it, so the
|
|
2279
|
+
* addressing is a payload filter on the runtime's own attempt and incarnation
|
|
2280
|
+
* (`bus.withFilter({ executionAttemptId, runtimeIncarnationId })`, the same
|
|
2281
|
+
* move the adapter session endpoints make in `adapters/core`). A delivery for
|
|
2282
|
+
* another attempt — or for a newer incarnation of this attempt while this one
|
|
2283
|
+
* is still connected — is a filter miss that returns undefined and
|
|
2284
|
+
* auto-advances the dispatch chain to the next responder; it is not an error
|
|
2285
|
+
* and this endpoint never sees it.
|
|
2286
|
+
*
|
|
2287
|
+
* The endpoint must exist before the runtime registers: the authority delivers
|
|
2288
|
+
* the bounded probe inside the registration request, and an unsubscribed
|
|
2289
|
+
* runtime fails its own registration with `probe-failed`. The returned
|
|
2290
|
+
* propagation await is what makes "before" true across a transport — the
|
|
2291
|
+
* subscription is visible to the authority when this resolves.
|
|
2292
|
+
* @param bus - Connected runtime bus the endpoint is installed on.
|
|
2293
|
+
* @param identity - Attempt and incarnation this runtime is; the delivery filter.
|
|
2294
|
+
* @param handlers - Handlers for the operation kinds this runtime can execute.
|
|
2295
|
+
* @returns The installed endpoint: a generation binder and its cleanup.
|
|
2296
|
+
*/
|
|
2297
|
+
declare function installOperationDeliveryEndpoint(bus: IMakaioBus, identity: OperationDeliveryEndpointIdentity, handlers: OperationDeliveryHandlers): Promise<OperationDeliveryEndpoint>;
|
|
2298
|
+
/**
|
|
2299
|
+
* Error thrown when the authority refuses a runtime registration.
|
|
2300
|
+
*
|
|
2301
|
+
* A refusal hands out no generation, so there is nothing for the caller to
|
|
2302
|
+
* fence with and no partial success to report: the runtime cannot proceed.
|
|
2303
|
+
*/
|
|
2304
|
+
declare class RuntimeRegistrationRefusedError extends Error {
|
|
2305
|
+
readonly executionAttemptId: string;
|
|
2306
|
+
readonly refusalReason: ExecutionAttemptRuntimeRegisterRefusalReason | undefined;
|
|
2307
|
+
/**
|
|
2308
|
+
* @param executionAttemptId - Attempt whose registration was refused.
|
|
2309
|
+
* @param refusalReason - Authority's reason, absent only if it reported none.
|
|
2310
|
+
*/
|
|
2311
|
+
constructor(executionAttemptId: string, refusalReason: ExecutionAttemptRuntimeRegisterRefusalReason | undefined);
|
|
2312
|
+
}
|
|
2313
|
+
/**
|
|
2314
|
+
* Error thrown when the authority refuses an operation admission.
|
|
2315
|
+
*
|
|
2316
|
+
* A refused admission means the operation never passed the attempt's start
|
|
2317
|
+
* gate, so the caller must not run it.
|
|
2318
|
+
*/
|
|
2319
|
+
declare class OperationAdmissionRefusedError extends Error {
|
|
2320
|
+
readonly executionAttemptId: string;
|
|
2321
|
+
readonly admissionKey: string;
|
|
2322
|
+
readonly refusalReason: ExecutionAttemptOperationAdmitRefusalReason | undefined;
|
|
2323
|
+
/**
|
|
2324
|
+
* @param executionAttemptId - Attempt the admission was requested against.
|
|
2325
|
+
* @param admissionKey - Idempotency key the caller admitted under.
|
|
2326
|
+
* @param refusalReason - Authority's reason, absent only if it reported none.
|
|
2327
|
+
*/
|
|
2328
|
+
constructor(executionAttemptId: string, admissionKey: string, refusalReason: ExecutionAttemptOperationAdmitRefusalReason | undefined);
|
|
2329
|
+
}
|
|
2330
|
+
/**
|
|
2331
|
+
* How long a registration keeps retrying a `not-allocated` refusal.
|
|
2332
|
+
*
|
|
2333
|
+
* The allocation-visibility window: a provider that runs its runtime in
|
|
2334
|
+
* process starts it inside `provision()`, and the pool records the returned
|
|
2335
|
+
* allocation only afterwards. Until that record is durable the authority
|
|
2336
|
+
* answers `not-allocated`, which is a fact about timing, not about this
|
|
2337
|
+
* runtime. Same value and same reasoning as `BOOTSTRAP_CONNECT_TIMEOUT_MS` in
|
|
2338
|
+
* the container entrypoint's bootstrap claim, which retries the equivalent
|
|
2339
|
+
* `attempt-pending` rejection. The window exists because no provider has an
|
|
2340
|
+
* activation step the pool drives after the record is durable; until such a
|
|
2341
|
+
* barrier exists, the retry is the runtime's only way to wait for the record.
|
|
2342
|
+
*/
|
|
2343
|
+
declare const ALLOCATION_VISIBILITY_DEADLINE_MS = 10000;
|
|
2344
|
+
/** Parameters for registering this runtime incarnation with the authority. */
|
|
2345
|
+
interface RegisterWorkerRuntimeOptions {
|
|
2346
|
+
/** Authority-created attempt identifier this runtime claims. */
|
|
2347
|
+
readonly executionAttemptId: string;
|
|
2348
|
+
/** Identifier of this concrete runtime incarnation, unique per boot. */
|
|
2349
|
+
readonly runtimeIncarnationId: string;
|
|
2350
|
+
/** Cancellation signal for the registration request. */
|
|
2351
|
+
readonly signal?: AbortSignal;
|
|
2352
|
+
/**
|
|
2353
|
+
* How long to keep retrying a `not-allocated` refusal, in milliseconds.
|
|
2354
|
+
*
|
|
2355
|
+
* Defaults to {@link ALLOCATION_VISIBILITY_DEADLINE_MS}. Exists so a test can
|
|
2356
|
+
* pin the deadline without waiting ten seconds for it.
|
|
2357
|
+
*/
|
|
2358
|
+
readonly allocationVisibilityDeadlineMs?: number;
|
|
2359
|
+
}
|
|
2360
|
+
/**
|
|
2361
|
+
* Register this runtime incarnation as the endpoint of its ExecutionAttempt.
|
|
2362
|
+
*
|
|
2363
|
+
* One request that returns only after the authority made readiness durable:
|
|
2364
|
+
* it allocates the generation, admits and delivers the bounded probe to the
|
|
2365
|
+
* endpoint installed by {@link installOperationDeliveryEndpoint}, persists the
|
|
2366
|
+
* completion, and publishes `execution-attempt.runtime.ready`. The reply is
|
|
2367
|
+
* the complete answer; the only refusal retried here is `not-allocated`, and
|
|
2368
|
+
* only inside the allocation-visibility window described at
|
|
2369
|
+
* {@link ALLOCATION_VISIBILITY_DEADLINE_MS}.
|
|
2370
|
+
*
|
|
2371
|
+
* A `duplicate` decision is readiness: the authority answers it only for an
|
|
2372
|
+
* incarnation that already holds a readiness instant, and it carries the same
|
|
2373
|
+
* generation that incarnation was registered with.
|
|
2374
|
+
* @param bus - Connected runtime bus authenticated as the attempt peer.
|
|
2375
|
+
* @param options - Attempt identity, incarnation identity, cancellation.
|
|
2376
|
+
* @returns The generation this runtime must fence all later traffic with.
|
|
2377
|
+
* @throws {@link RuntimeRegistrationRefusedError} When the authority refuses.
|
|
2378
|
+
*/
|
|
2379
|
+
declare function registerWorkerRuntime(bus: IMakaioBus, options: RegisterWorkerRuntimeOptions): Promise<number>;
|
|
2380
|
+
/** Parameters for admitting this runtime's workflow run through the start gate. */
|
|
2381
|
+
interface AdmitWorkflowRunOperationOptions {
|
|
2382
|
+
/** Authority-created attempt identifier the operation runs under. */
|
|
2383
|
+
readonly executionAttemptId: string;
|
|
2384
|
+
/** Generation this runtime was registered with. */
|
|
2385
|
+
readonly runtimeGeneration: number;
|
|
2386
|
+
/** Caller-chosen idempotency key for this admission. */
|
|
2387
|
+
readonly admissionKey: string;
|
|
2388
|
+
/** Cancellation signal for the admission request. */
|
|
2389
|
+
readonly signal?: AbortSignal;
|
|
2390
|
+
}
|
|
2391
|
+
/**
|
|
2392
|
+
* Admit this runtime's workflow run through the attempt's start gate.
|
|
2393
|
+
*
|
|
2394
|
+
* The legacy run passes the gate as one admitted operation: materialize, load,
|
|
2395
|
+
* compose, execute, and the outcome all stay inside it, and the outcome commit
|
|
2396
|
+
* settles the attempt rather than a separate completion call.
|
|
2397
|
+
*
|
|
2398
|
+
* A `duplicate` decision is the retry of an admission whose first pass already
|
|
2399
|
+
* succeeded, so it yields the existing operation identifier.
|
|
2400
|
+
* @param bus - Connected runtime bus authenticated as the attempt peer.
|
|
2401
|
+
* @param options - Attempt identity, fence, idempotency key, cancellation.
|
|
2402
|
+
* @returns The identifier of the admitted operation.
|
|
2403
|
+
* @throws {@link OperationAdmissionRefusedError} When the authority refuses.
|
|
2404
|
+
* @throws When the authority admits without naming an operation.
|
|
2405
|
+
*/
|
|
2406
|
+
declare function admitWorkflowRunOperation(bus: IMakaioBus, options: AdmitWorkflowRunOperationOptions): Promise<string>;
|
|
2407
|
+
/** Parameters for proving this runtime and admitting its workflow run. */
|
|
2408
|
+
interface RegisterAndAdmitWorkflowRunOptions {
|
|
2409
|
+
/** Authority-created attempt identifier this runtime claims. */
|
|
2410
|
+
readonly executionAttemptId: string;
|
|
2411
|
+
/** Identifier of this concrete runtime incarnation, unique per boot. */
|
|
2412
|
+
readonly runtimeIncarnationId: string;
|
|
2413
|
+
/** The delivery endpoint installed for this incarnation, bound to the accepted generation here. */
|
|
2414
|
+
readonly endpoint: OperationDeliveryEndpoint;
|
|
2415
|
+
/** Cancellation signal for both requests. */
|
|
2416
|
+
readonly signal?: AbortSignal;
|
|
2417
|
+
}
|
|
2418
|
+
/** What a runtime holds once its workflow run passed the start gate. */
|
|
2419
|
+
interface AdmittedWorkflowRun {
|
|
2420
|
+
/** Generation this runtime was accepted with. */
|
|
2421
|
+
readonly runtimeGeneration: number;
|
|
2422
|
+
/** Identifier of the admitted workflow-run operation. */
|
|
2423
|
+
readonly operationId: string;
|
|
2424
|
+
}
|
|
2425
|
+
/**
|
|
2426
|
+
* Prove this runtime to the authority and admit its workflow run, in order.
|
|
2427
|
+
*
|
|
2428
|
+
* The one sequence every workflow runtime performs before it pulls work:
|
|
2429
|
+
* register (the probe arrives at `options.endpoint` meanwhile), bind the
|
|
2430
|
+
* accepted generation onto that endpoint, then admit the run under the
|
|
2431
|
+
* incarnation's own key `workflow-run:<runtimeIncarnationId>`, so a retried
|
|
2432
|
+
* admission is answered `duplicate` with the same operation.
|
|
2433
|
+
* @param bus - Connected runtime bus authenticated as the attempt peer.
|
|
2434
|
+
* @param options - Attempt identity, incarnation identity, endpoint, cancellation.
|
|
2435
|
+
* @returns The accepted generation and the admitted operation.
|
|
2436
|
+
* @throws {@link RuntimeRegistrationRefusedError} When the authority refuses the runtime.
|
|
2437
|
+
* @throws {@link OperationAdmissionRefusedError} When the authority refuses the run.
|
|
2438
|
+
*/
|
|
2439
|
+
declare function registerAndAdmitWorkflowRun(bus: IMakaioBus, options: RegisterAndAdmitWorkflowRunOptions): Promise<AdmittedWorkflowRun>;
|
|
2440
|
+
//#endregion
|
|
2441
|
+
export { ThinWorkflowPiscinaRunner as $, runHeadlessWorkflowWorker as A, initializeNodeDatabase as At, PiscinaThinWorkflowProviderOptions as B, HttpRouteGraphBuilder as Bt, HeadlessWorkerContributionLoader as C, verifyContribution as Ct, HeadlessWorkflowWorkerDeps as D, DatabaseBootOptions as Dt, HeadlessWorkerPostCommitObserver as E, resolveWorkflowWorkerEntry as Et, WorkflowRuntimeContributionLoader as F, BridgeBrowserOptions as Ft, OutcomeSubmitRetryConfig as G, HonoRouteGraphOptions as Gt, OutcomeDeliveryError as H, HttpContributionPhase as Ht, createIsolatedWorkflowRuntime as I, FrameworkModuleResolver as It, WorkerRunnerOptions as J, ActivatedAdapterRuntimeIdentity as Jt, submitOutcomeWithAck as K, createHonoRouteGraph as Kt, InProcessWorkflowRunner as L, NodeFrameworkModuleResolver as Lt, IsolatedWorkflowRuntime as M, normalizeNodeHostCapabilities as Mt, IsolatedWorkflowRuntimeContext as N, selectFrameworkCorePackages as Nt, HeadlessWorkflowWorkerResult as O, InitializeNodeDatabaseOptions as Ot, WorkflowRuntimeAuthorityConnector as P, ShutdownStep as Pt, createNodeWorkflowRunnerPackageOptions as Q, prepareAdapterRuntime as Qt, InProcessWorkflowRunnerOptions as R, NoopFrameworkModuleResolver as Rt, HeadlessWorkerBusConnector as S, parseSriIntegrity as St, HeadlessWorkerMaterializer as T, WorkflowWorkerEntryResolverOptions as Tt, OutcomeReconnect as U, HttpRouteContribution as Ut, DELIVERED_DECISIONS as V, createHttpRouteGraphBuilder as Vt, OutcomeSubmitPayload as W, HonoRouteGraph as Wt, NodeWorkflowRunnerPackageOptions as X, PreparedAdapterRuntime as Xt, CreateNodeWorkflowRunnerPackageOptionsParams as Y, PrepareAdapterRuntimeInput as Yt, createNodeWorkflowRunner as Z, activateAdapterRuntimeIdentity as Zt, loadWorkflowModule as _, assertNoSymlinkEscape as _t, OperationAdmissionRefusedError as a, BootMakaioRuntimeOptions as at, HeadlessWorkerBootstrap as b, computeFileDigest as bt, OperationDeliveryHandler as c, ServerTransportProvider as ct, RegisterWorkerRuntimeOptions as d, WorkflowRunnerBootOptions as dt, IWorkflowRunner$1 as et, RuntimeRegistrationRefusedError as f, LocalDirectoryMaterializerOptions as ft, registerWorkerRuntime as g, assertContainedIn as gt, registerAndAdmitWorkflowRun as h, WorkspaceRootResolver as ht, DeliverableOperationKind as i, BootCoordinatorSetupContext as it, CreateIsolatedWorkflowRuntimeOptions as j, HostCapabilityDeclaration as jt, MaterializedWorkspace as k, InitializeNodeDatabaseResult as kt, OperationDeliveryHandlers as l, TransportReadyInfo as lt, installOperationDeliveryEndpoint as m, ParsedSriIntegrity as mt, AdmitWorkflowRunOperationOptions as n, ThinWorkflowPiscinaRunnerOptions as nt, OperationDeliveryEndpoint as o, CoreBootOptions as ot, admitWorkflowRunOperation as p, MaterializationError as pt, WorkerRunner as q, ActivateAdapterRuntimeIdentityInput as qt, AdmittedWorkflowRun as r, WorkflowRunResult$1 as rt, OperationDeliveryEndpointIdentity as s, MakaioRuntime as st, ALLOCATION_VISIBILITY_DEADLINE_MS as t, RuntimeLoadedWorkflow as tt, RegisterAndAdmitWorkflowRunOptions as u, UpstreamTelemetryBootOptions as ut, loadWorkflowModules as v, computeContributionPackageDigest as vt, HeadlessWorkerExecutor as w, WorkflowWorkerEntryMode as wt, HeadlessWorkerBootstrapCredentials as x, materializeLocalDirectory as xt, loadWorkflowFromConfig as y, computeDirectoryDigest as yt, PiscinaThinWorkflowProvider as z, resolveFrameworkSpecifier as zt };
|