@lostgradient/weft 0.18.0 → 0.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -1
- package/dist/cli/conformance.js +14 -18
- package/dist/cli/generated/operation-catalog.snapshot.json +258 -16
- package/dist/cli/generated/operation-client.generated.d.ts +30 -6
- package/dist/cli/generated/operation-client.generated.js +4 -0
- package/dist/core/context/child-workflow-pipe.d.ts +1 -1
- package/dist/core/context/child-workflow-pipe.js +1 -1
- package/dist/core/engine/construction.d.ts +2 -0
- package/dist/core/engine/construction.js +3 -0
- package/dist/core/engine/index.js +1 -0
- package/dist/core/engine/listing.d.ts +1 -0
- package/dist/core/engine/listing.js +6 -4
- package/dist/core/weft-error.d.ts +1 -1
- package/dist/core/weft-error.js +2 -1
- package/dist/core/worker-execution-dispatcher.d.ts +8 -0
- package/dist/core/worker-execution-dispatcher.js +4 -0
- package/dist/core/worker-execution-strategy-options.d.ts +16 -0
- package/dist/core/worker-execution-strategy.js +71 -89
- package/dist/core/worker-fault-handling.d.ts +45 -0
- package/dist/core/worker-fault-handling.js +88 -0
- package/dist/core/worker-protocol.d.ts +18 -1
- package/dist/core/worker-protocol.js +1 -1
- package/dist/core/worker-realm-readiness.d.ts +78 -0
- package/dist/core/worker-realm-readiness.js +127 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.js +28 -1
- package/dist/json-schema.js +1 -1
- package/dist/runtime/portable.d.ts +14 -0
- package/dist/runtime/portable.js +10 -0
- package/dist/server/index.d.ts +71 -8
- package/dist/server/index.js +7 -3
- package/dist/server/operations/get-task-diagnostics.d.ts +43 -18
- package/dist/server/operations/get-task-diagnostics.js +87 -126
- package/dist/server/operations/get-worker-diagnostics.d.ts +177 -0
- package/dist/server/operations/get-worker-diagnostics.js +117 -0
- package/dist/server/operations/list-worker-registration-rejections.d.ts +79 -0
- package/dist/server/operations/list-worker-registration-rejections.js +60 -0
- package/dist/server/operations/list-workers.js +1 -3
- package/dist/server/operations/static-registrations.js +5 -20
- package/dist/server/rest-bindings.js +31 -2
- package/dist/server/runtime/authentication-bridge.js +6 -14
- package/dist/server/runtime/context.d.ts +23 -0
- package/dist/server/runtime/task-dispatch.d.ts +7 -1
- package/dist/server/runtime/task-dispatch.js +126 -55
- package/dist/server/runtime/task-ledger-completion.d.ts +68 -0
- package/dist/server/runtime/task-ledger-completion.js +72 -0
- package/dist/server/runtime/task-ledger-recovery.d.ts +55 -0
- package/dist/server/runtime/task-ledger-recovery.js +73 -0
- package/dist/server/runtime/task-ledger-runtime.d.ts +64 -0
- package/dist/server/runtime/task-ledger-runtime.js +34 -0
- package/dist/server/runtime/task-metrics.d.ts +6 -4
- package/dist/server/runtime/task-polling.d.ts +14 -12
- package/dist/server/runtime/task-polling.js +106 -82
- package/dist/server/runtime/task-reconciliation.d.ts +35 -8
- package/dist/server/runtime/task-reconciliation.js +75 -74
- package/dist/server/runtime/task-result-resolution.d.ts +2 -10
- package/dist/server/runtime/task-result-resolution.js +0 -67
- package/dist/server/runtime/task-result-view.d.ts +82 -0
- package/dist/server/runtime/task-result-view.js +48 -0
- package/dist/server/runtime/websocket-worker-messaging.d.ts +16 -0
- package/dist/server/runtime/websocket-worker-messaging.js +32 -0
- package/dist/server/runtime/websocket-worker-registration.d.ts +41 -0
- package/dist/server/runtime/websocket-worker-registration.js +134 -0
- package/dist/server/runtime/websocket-worker.d.ts +0 -1
- package/dist/server/runtime/websocket-worker.js +64 -116
- package/dist/server/serve-internals.d.ts +9 -6
- package/dist/server/serve-internals.js +14 -40
- package/dist/server/task-ledger-codec.d.ts +40 -0
- package/dist/server/task-ledger-codec.js +195 -0
- package/dist/server/task-ledger-keys.d.ts +13 -0
- package/dist/server/task-ledger-keys.js +5 -0
- package/dist/server/task-ledger-limits.d.ts +34 -0
- package/dist/server/task-ledger-limits.js +5 -0
- package/dist/server/task-ledger-transition-helpers.d.ts +38 -0
- package/dist/server/task-ledger-transition-helpers.js +42 -0
- package/dist/server/task-ledger-transitions-cancellation.d.ts +31 -0
- package/dist/server/task-ledger-transitions-cancellation.js +73 -0
- package/dist/server/task-ledger-transitions.d.ts +129 -0
- package/dist/server/task-ledger-transitions.js +162 -0
- package/dist/server/task-ledger-types.d.ts +220 -0
- package/dist/server/task-ledger-types.js +1 -0
- package/dist/server/task-ledger.d.ts +17 -0
- package/dist/server/task-ledger.js +24 -0
- package/dist/server/task-state.d.ts +25 -152
- package/dist/server/task-state.js +0 -188
- package/dist/server/worker-admission-policy.d.ts +70 -0
- package/dist/server/worker-admission-policy.js +0 -0
- package/dist/storage/compressed-storage.js +1 -1
- package/dist/storage/index.d.ts +0 -2
- package/dist/storage/interface.d.ts +0 -2
- package/dist/storage/interface.js +1 -1
- package/dist/storage/lmdb.js +1 -1
- package/dist/storage/memory.js +1 -1
- package/dist/storage/neon.js +1 -1
- package/dist/storage/postgres.js +1 -1
- package/dist/storage/resolve.js +1 -1
- package/dist/storage/scoped-storage.js +1 -1
- package/dist/storage/testing.js +1 -1
- package/dist/storage/turso.js +1 -1
- package/dist/storage/web-extension.js +2 -2
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/web-extension.js +1 -1
- package/dist/worker/index.d.ts +2 -0
- package/dist/worker/index.js +30 -4
- package/dist/worker/manifest/canonical-json.d.ts +20 -0
- package/dist/worker/manifest/canonical-json.js +13 -0
- package/dist/worker/manifest/capabilities.d.ts +24 -0
- package/dist/worker/manifest/capabilities.js +74 -0
- package/dist/worker/manifest/content-digest.d.ts +20 -0
- package/dist/worker/manifest/content-digest.js +13 -0
- package/dist/worker/manifest/declared-shape-digest.d.ts +14 -0
- package/dist/worker/manifest/declared-shape-digest.js +4 -0
- package/dist/worker/manifest/digest.d.ts +82 -0
- package/dist/worker/manifest/digest.js +9 -0
- package/dist/worker/manifest/execution-identity.d.ts +92 -0
- package/dist/worker/manifest/execution-identity.js +36 -0
- package/dist/worker/manifest/failure.d.ts +59 -0
- package/dist/worker/manifest/failure.js +4 -0
- package/dist/worker/manifest/index.d.ts +22 -0
- package/dist/worker/manifest/index.js +23 -0
- package/dist/worker/manifest/internal-realm.d.ts +50 -0
- package/dist/worker/manifest/internal-realm.js +39 -0
- package/dist/worker/manifest/is-record.d.ts +12 -0
- package/dist/worker/manifest/is-record.js +6 -0
- package/dist/worker/manifest/json-scan.d.ts +26 -0
- package/dist/worker/manifest/json-scan.js +88 -0
- package/dist/worker/manifest/limits.d.ts +138 -0
- package/dist/worker/manifest/limits.js +1 -0
- package/dist/worker/manifest/normalize.d.ts +63 -0
- package/dist/worker/manifest/normalize.js +73 -0
- package/dist/worker/manifest/parse-json.d.ts +24 -0
- package/dist/worker/manifest/parse-json.js +15 -0
- package/dist/worker/manifest/parse.d.ts +86 -0
- package/dist/worker/manifest/parse.js +188 -0
- package/dist/worker/manifest/registry-contract-builder.d.ts +120 -0
- package/dist/worker/manifest/registry-contract-builder.js +65 -0
- package/dist/worker/manifest/types.d.ts +263 -0
- package/dist/worker/manifest/types.js +1 -0
- package/dist/worker/manifest/utf8.d.ts +13 -0
- package/dist/worker/manifest/utf8.js +7 -0
- package/dist/worker/options.d.ts +55 -8
- package/dist/worker/options.js +65 -9
- package/dist/worker/protocol-internals.d.ts +1 -2
- package/dist/worker/protocol-internals.js +0 -5
- package/dist/worker/protocol-messages.d.ts +33 -17
- package/dist/worker/protocol-schemas.d.ts +36 -74
- package/dist/worker/protocol-schemas.js +25 -18
- package/dist/worker/protocol-version.d.ts +18 -14
- package/dist/worker/protocol-version.js +1 -1
- package/dist/worker/protocol.js +1 -1
- package/dist/worker/registry/deployment-consistency.d.ts +78 -0
- package/dist/worker/registry/deployment-consistency.js +27 -0
- package/dist/worker/registry/drain.d.ts +14 -0
- package/dist/worker/registry/drain.js +24 -0
- package/dist/worker/registry/rejections.d.ts +31 -0
- package/dist/worker/registry/rejections.js +10 -0
- package/dist/worker/registry/summary.d.ts +0 -3
- package/dist/worker/registry/summary.js +2 -5
- package/dist/worker/registry/types.d.ts +10 -3
- package/dist/worker/registry.d.ts +47 -2
- package/dist/worker/registry.js +45 -32
- package/dist/workers/workflow-worker-entry.d.ts +12 -7
- package/dist/workers/workflow-worker-entry.js +9 -2
- package/package.json +3 -3
- package/dist/server/task-resolved-record.d.ts +0 -12
- package/dist/server/task-resolved-record.js +0 -35
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Weft
|
|
2
2
|
|
|
3
|
-
A Bun-native durable execution engine. Current release: `0.
|
|
3
|
+
A Bun-native durable execution engine. Current release: `0.19.0`.
|
|
4
4
|
|
|
5
5
|
Install the library from npm as `@lostgradient/weft`:
|
|
6
6
|
|
|
@@ -378,6 +378,8 @@ import { RemoteWorker } from '@lostgradient/weft';
|
|
|
378
378
|
|
|
379
379
|
const worker = new RemoteWorker({
|
|
380
380
|
serverUrl: 'wss://weft.internal:7233',
|
|
381
|
+
deploymentName: 'orders',
|
|
382
|
+
buildId: '2026.08.19-1',
|
|
381
383
|
workflows: {
|
|
382
384
|
orderFulfillment: {
|
|
383
385
|
name: 'orderFulfillment',
|
package/dist/cli/conformance.js
CHANGED
|
@@ -1,23 +1,20 @@
|
|
|
1
1
|
import { decode } from "../core/codec.js";
|
|
2
2
|
import { Engine } from "../core/engine.js";
|
|
3
3
|
import { serve } from "../server/index.js";
|
|
4
|
-
import {
|
|
4
|
+
import { isRemoteTaskTerminalResolved, taskLedgerKey } from "../server/task-ledger.js";
|
|
5
5
|
import { MemoryStorage } from "../storage/memory.js";
|
|
6
6
|
import {
|
|
7
7
|
REMOTE_WORKER_PROTOCOL_VERSION,
|
|
8
8
|
REMOTE_WORKER_SUPPORTED_PROTOCOL_VERSIONS
|
|
9
9
|
} from "../worker/protocol.js";
|
|
10
10
|
const CONFORMANCE_QUEUE = "conformance", CONFORMANCE_ACTIVITIES = [
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
"
|
|
11
|
+
"conformance.echo",
|
|
12
|
+
"conformance.sleep",
|
|
13
|
+
"conformance.cancel"
|
|
14
14
|
], CONFORMANCE_HEARTBEAT_INTERVAL_MS = 25;
|
|
15
15
|
function createCheck(name, ok, message) {
|
|
16
16
|
return { name, ok, message };
|
|
17
17
|
}
|
|
18
|
-
function isRecord(value) {
|
|
19
|
-
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
20
|
-
}
|
|
21
18
|
async function waitForCondition(predicate, timeoutMs, label) {
|
|
22
19
|
const deadline = Date.now() + timeoutMs;
|
|
23
20
|
let lastError;
|
|
@@ -110,17 +107,12 @@ async function waitForWorkerIdle(server, workerId, timeoutMs) {
|
|
|
110
107
|
}
|
|
111
108
|
throw Error(`Timed out after ${timeoutMs}ms waiting for worker ${workerId} to become idle`);
|
|
112
109
|
}
|
|
113
|
-
function isResolvedRecord(value) {
|
|
114
|
-
if (!isRecord(value))
|
|
115
|
-
return !1;
|
|
116
|
-
return typeof value.operationId === "string" && (value.status === "completed" || value.status === "failed") && typeof value.resolvedAt === "number";
|
|
117
|
-
}
|
|
118
110
|
async function readResolvedStatus(storage, operationId) {
|
|
119
|
-
const stored = await storage.get(
|
|
111
|
+
const stored = await storage.get(taskLedgerKey(operationId));
|
|
120
112
|
if (stored === null)
|
|
121
113
|
return;
|
|
122
114
|
const decoded = decode(stored);
|
|
123
|
-
if (!
|
|
115
|
+
if (!isRemoteTaskTerminalResolved(decoded))
|
|
124
116
|
return;
|
|
125
117
|
return decoded.status;
|
|
126
118
|
}
|
|
@@ -131,6 +123,7 @@ async function dispatchAndWait(server, storage, operationId, activityName, input
|
|
|
131
123
|
if (!await server.dispatchTask({
|
|
132
124
|
operationId,
|
|
133
125
|
activityName,
|
|
126
|
+
workflowType: "conformance",
|
|
134
127
|
input,
|
|
135
128
|
queue: CONFORMANCE_QUEUE,
|
|
136
129
|
visibilityTimeout: Math.max(500, timeoutMs)
|
|
@@ -151,15 +144,16 @@ async function runConformanceChecks(command, timeoutMs) {
|
|
|
151
144
|
worker = startWorker(command, server);
|
|
152
145
|
const workerId = await waitForRegisteredWorker(server, timeoutMs), registered = server.registry.getWorker(workerId);
|
|
153
146
|
checks.push(createCheck("register", registered?.queue === CONFORMANCE_QUEUE && CONFORMANCE_ACTIVITIES.every((activity) => registered.activities.includes(activity)), `registered worker ${workerId}`));
|
|
154
|
-
await dispatchAndWait(server, storage, "conformance-echo", "
|
|
147
|
+
await dispatchAndWait(server, storage, "conformance-echo", "conformance.echo", { ok: !0 }, "completed", timeoutMs);
|
|
155
148
|
checks.push(createCheck("task completion", !0, "echo task resolved"));
|
|
156
149
|
await waitForWorkerHeartbeat(server, workerId, timeoutMs);
|
|
157
|
-
await dispatchAndWait(server, storage, "conformance-heartbeat", "
|
|
150
|
+
await dispatchAndWait(server, storage, "conformance-heartbeat", "conformance.sleep", { milliseconds: CONFORMANCE_HEARTBEAT_INTERVAL_MS * 3 }, "completed", timeoutMs);
|
|
158
151
|
checks.push(createCheck("heartbeat", !0, "heartbeat observed while worker was connected"));
|
|
159
152
|
const cancelOperationId = "conformance-cancel";
|
|
160
153
|
if (!await server.dispatchTask({
|
|
161
154
|
operationId: cancelOperationId,
|
|
162
|
-
activityName: "
|
|
155
|
+
activityName: "conformance.cancel",
|
|
156
|
+
workflowType: "conformance",
|
|
163
157
|
input: { milliseconds: timeoutMs },
|
|
164
158
|
queue: CONFORMANCE_QUEUE,
|
|
165
159
|
visibilityTimeout: Math.max(500, timeoutMs)
|
|
@@ -173,7 +167,8 @@ async function runConformanceChecks(command, timeoutMs) {
|
|
|
173
167
|
const reconnectOperationId = "conformance-reconnect", reconnectDelayMs = Math.min(1500, Math.max(250, Math.floor(timeoutMs * 0.75)));
|
|
174
168
|
if (!await server.dispatchTask({
|
|
175
169
|
operationId: reconnectOperationId,
|
|
176
|
-
activityName: "
|
|
170
|
+
activityName: "conformance.sleep",
|
|
171
|
+
workflowType: "conformance",
|
|
177
172
|
input: { milliseconds: reconnectDelayMs },
|
|
178
173
|
queue: CONFORMANCE_QUEUE,
|
|
179
174
|
visibilityTimeout: Math.max(500, timeoutMs)
|
|
@@ -185,6 +180,7 @@ async function runConformanceChecks(command, timeoutMs) {
|
|
|
185
180
|
await stopWorker(worker);
|
|
186
181
|
worker = replacementWorker;
|
|
187
182
|
await waitForCondition(() => server.registry.getWorker(workerId) === void 0, timeoutMs, "original worker disconnect");
|
|
183
|
+
await waitForCondition(() => (server.registry.getWorker(replacementWorkerId)?.inFlight ?? 0) > 0 || server.registry.getWorker(replacementWorkerId) === void 0, timeoutMs, "reassigned reconnect task delivered to replacement worker");
|
|
188
184
|
await waitForWorkerIdle(server, replacementWorkerId, timeoutMs);
|
|
189
185
|
await waitForResolvedStatus(storage, reconnectOperationId, "completed", timeoutMs);
|
|
190
186
|
checks.push(createCheck("reconnect", !0, "in-flight task completed after reconnect"));
|
|
@@ -1708,7 +1708,6 @@
|
|
|
1708
1708
|
"type": "string"
|
|
1709
1709
|
},
|
|
1710
1710
|
"lastRequeueReason": {
|
|
1711
|
-
"enum": ["visibility-timeout", "worker-disconnect"],
|
|
1712
1711
|
"type": "string"
|
|
1713
1712
|
},
|
|
1714
1713
|
"operationId": {
|
|
@@ -1822,7 +1821,7 @@
|
|
|
1822
1821
|
"jsonRpcWebSocket": false,
|
|
1823
1822
|
"jsonRpcStdio": false
|
|
1824
1823
|
},
|
|
1825
|
-
"producibleFaults": [],
|
|
1824
|
+
"producibleFaults": ["NotFound"],
|
|
1826
1825
|
"inputSchema": {
|
|
1827
1826
|
"additionalProperties": false,
|
|
1828
1827
|
"properties": {
|
|
@@ -2056,6 +2055,185 @@
|
|
|
2056
2055
|
]
|
|
2057
2056
|
}
|
|
2058
2057
|
},
|
|
2058
|
+
{
|
|
2059
|
+
"name": "weft.workers.diagnostics",
|
|
2060
|
+
"kind": "unary",
|
|
2061
|
+
"summary": "Get bounded instance and deployment-version diagnostics for one connected worker",
|
|
2062
|
+
"description": "Report one connected worker's identity split into two parts: `instance` (this live connection — queue, health, connection timestamps) and `deploymentVersion` (the artifact it loaded — SDK/runtime identity, manifest digest, and every advertised workflow's version, revision, and contract hash). Returns `worker: null` when the workerId is not currently connected. Excludes capabilities and raw payload schemas.",
|
|
2063
|
+
"tags": ["Observability"],
|
|
2064
|
+
"destructive": false,
|
|
2065
|
+
"access": {
|
|
2066
|
+
"kind": "scoped",
|
|
2067
|
+
"scopes": ["system:read"]
|
|
2068
|
+
},
|
|
2069
|
+
"transports": {
|
|
2070
|
+
"http": true,
|
|
2071
|
+
"jsonRpcHttp": true,
|
|
2072
|
+
"jsonRpcWebSocket": true,
|
|
2073
|
+
"jsonRpcStdio": true
|
|
2074
|
+
},
|
|
2075
|
+
"producibleFaults": [],
|
|
2076
|
+
"inputSchema": {
|
|
2077
|
+
"additionalProperties": false,
|
|
2078
|
+
"properties": {
|
|
2079
|
+
"workerId": {
|
|
2080
|
+
"minLength": 1,
|
|
2081
|
+
"type": "string"
|
|
2082
|
+
}
|
|
2083
|
+
},
|
|
2084
|
+
"required": ["workerId"],
|
|
2085
|
+
"type": "object"
|
|
2086
|
+
},
|
|
2087
|
+
"outputSchema": {
|
|
2088
|
+
"additionalProperties": false,
|
|
2089
|
+
"properties": {
|
|
2090
|
+
"worker": {
|
|
2091
|
+
"anyOf": [
|
|
2092
|
+
{
|
|
2093
|
+
"additionalProperties": false,
|
|
2094
|
+
"properties": {
|
|
2095
|
+
"deploymentVersion": {
|
|
2096
|
+
"additionalProperties": false,
|
|
2097
|
+
"properties": {
|
|
2098
|
+
"artifactDigest": {
|
|
2099
|
+
"type": "string"
|
|
2100
|
+
},
|
|
2101
|
+
"buildId": {
|
|
2102
|
+
"type": "string"
|
|
2103
|
+
},
|
|
2104
|
+
"deploymentName": {
|
|
2105
|
+
"type": "string"
|
|
2106
|
+
},
|
|
2107
|
+
"manifestDigest": {
|
|
2108
|
+
"type": "string"
|
|
2109
|
+
},
|
|
2110
|
+
"manifestVersion": {
|
|
2111
|
+
"type": "number"
|
|
2112
|
+
},
|
|
2113
|
+
"protocolVersion": {
|
|
2114
|
+
"type": "number"
|
|
2115
|
+
},
|
|
2116
|
+
"runtimeName": {
|
|
2117
|
+
"type": "string"
|
|
2118
|
+
},
|
|
2119
|
+
"runtimeVersion": {
|
|
2120
|
+
"type": "string"
|
|
2121
|
+
},
|
|
2122
|
+
"sdkVersion": {
|
|
2123
|
+
"type": "string"
|
|
2124
|
+
},
|
|
2125
|
+
"workflows": {
|
|
2126
|
+
"additionalProperties": {
|
|
2127
|
+
"additionalProperties": false,
|
|
2128
|
+
"properties": {
|
|
2129
|
+
"activities": {
|
|
2130
|
+
"additionalProperties": {
|
|
2131
|
+
"additionalProperties": false,
|
|
2132
|
+
"properties": {
|
|
2133
|
+
"contractHash": {
|
|
2134
|
+
"type": "string"
|
|
2135
|
+
},
|
|
2136
|
+
"implementationRevision": {
|
|
2137
|
+
"type": "string"
|
|
2138
|
+
}
|
|
2139
|
+
},
|
|
2140
|
+
"required": ["contractHash", "implementationRevision"],
|
|
2141
|
+
"type": "object"
|
|
2142
|
+
},
|
|
2143
|
+
"propertyNames": {
|
|
2144
|
+
"type": "string"
|
|
2145
|
+
},
|
|
2146
|
+
"type": "object"
|
|
2147
|
+
},
|
|
2148
|
+
"contractHash": {
|
|
2149
|
+
"type": "string"
|
|
2150
|
+
},
|
|
2151
|
+
"workflowRevision": {
|
|
2152
|
+
"type": "string"
|
|
2153
|
+
},
|
|
2154
|
+
"workflowVersion": {
|
|
2155
|
+
"type": "string"
|
|
2156
|
+
}
|
|
2157
|
+
},
|
|
2158
|
+
"required": [
|
|
2159
|
+
"workflowVersion",
|
|
2160
|
+
"workflowRevision",
|
|
2161
|
+
"contractHash",
|
|
2162
|
+
"activities"
|
|
2163
|
+
],
|
|
2164
|
+
"type": "object"
|
|
2165
|
+
},
|
|
2166
|
+
"propertyNames": {
|
|
2167
|
+
"type": "string"
|
|
2168
|
+
},
|
|
2169
|
+
"type": "object"
|
|
2170
|
+
}
|
|
2171
|
+
},
|
|
2172
|
+
"required": [
|
|
2173
|
+
"deploymentName",
|
|
2174
|
+
"buildId",
|
|
2175
|
+
"artifactDigest",
|
|
2176
|
+
"runtimeName",
|
|
2177
|
+
"runtimeVersion",
|
|
2178
|
+
"sdkVersion",
|
|
2179
|
+
"manifestVersion",
|
|
2180
|
+
"protocolVersion",
|
|
2181
|
+
"manifestDigest",
|
|
2182
|
+
"workflows"
|
|
2183
|
+
],
|
|
2184
|
+
"type": "object"
|
|
2185
|
+
},
|
|
2186
|
+
"instance": {
|
|
2187
|
+
"additionalProperties": false,
|
|
2188
|
+
"properties": {
|
|
2189
|
+
"connectedAt": {
|
|
2190
|
+
"type": "number"
|
|
2191
|
+
},
|
|
2192
|
+
"health": {
|
|
2193
|
+
"enum": ["active", "draining", "drained"],
|
|
2194
|
+
"type": "string"
|
|
2195
|
+
},
|
|
2196
|
+
"heartbeatAgeMs": {
|
|
2197
|
+
"type": "number"
|
|
2198
|
+
},
|
|
2199
|
+
"lastHeartbeatAt": {
|
|
2200
|
+
"type": "number"
|
|
2201
|
+
},
|
|
2202
|
+
"queue": {
|
|
2203
|
+
"type": "string"
|
|
2204
|
+
},
|
|
2205
|
+
"startedAt": {
|
|
2206
|
+
"type": "number"
|
|
2207
|
+
},
|
|
2208
|
+
"workerId": {
|
|
2209
|
+
"type": "string"
|
|
2210
|
+
}
|
|
2211
|
+
},
|
|
2212
|
+
"required": [
|
|
2213
|
+
"workerId",
|
|
2214
|
+
"queue",
|
|
2215
|
+
"health",
|
|
2216
|
+
"connectedAt",
|
|
2217
|
+
"startedAt",
|
|
2218
|
+
"lastHeartbeatAt",
|
|
2219
|
+
"heartbeatAgeMs"
|
|
2220
|
+
],
|
|
2221
|
+
"type": "object"
|
|
2222
|
+
}
|
|
2223
|
+
},
|
|
2224
|
+
"required": ["instance", "deploymentVersion"],
|
|
2225
|
+
"type": "object"
|
|
2226
|
+
},
|
|
2227
|
+
{
|
|
2228
|
+
"type": "null"
|
|
2229
|
+
}
|
|
2230
|
+
]
|
|
2231
|
+
}
|
|
2232
|
+
},
|
|
2233
|
+
"required": ["worker"],
|
|
2234
|
+
"type": "object"
|
|
2235
|
+
}
|
|
2236
|
+
},
|
|
2059
2237
|
{
|
|
2060
2238
|
"name": "weft.workers.drain",
|
|
2061
2239
|
"kind": "unary",
|
|
@@ -2235,16 +2413,6 @@
|
|
|
2235
2413
|
"drainingWorkers": {
|
|
2236
2414
|
"type": "number"
|
|
2237
2415
|
},
|
|
2238
|
-
"gitSha": {
|
|
2239
|
-
"anyOf": [
|
|
2240
|
-
{
|
|
2241
|
-
"type": "string"
|
|
2242
|
-
},
|
|
2243
|
-
{
|
|
2244
|
-
"type": "null"
|
|
2245
|
-
}
|
|
2246
|
-
]
|
|
2247
|
-
},
|
|
2248
2416
|
"health": {
|
|
2249
2417
|
"enum": ["active", "draining", "drained"],
|
|
2250
2418
|
"type": "string"
|
|
@@ -2280,7 +2448,6 @@
|
|
|
2280
2448
|
"deploymentName",
|
|
2281
2449
|
"buildId",
|
|
2282
2450
|
"runtimeVersion",
|
|
2283
|
-
"gitSha",
|
|
2284
2451
|
"health",
|
|
2285
2452
|
"workers",
|
|
2286
2453
|
"activeWorkers",
|
|
@@ -2327,9 +2494,6 @@
|
|
|
2327
2494
|
"deploymentName": {
|
|
2328
2495
|
"type": "string"
|
|
2329
2496
|
},
|
|
2330
|
-
"gitSha": {
|
|
2331
|
-
"type": "string"
|
|
2332
|
-
},
|
|
2333
2497
|
"health": {
|
|
2334
2498
|
"enum": ["active", "draining", "drained"],
|
|
2335
2499
|
"type": "string"
|
|
@@ -2383,6 +2547,84 @@
|
|
|
2383
2547
|
"type": "object"
|
|
2384
2548
|
}
|
|
2385
2549
|
},
|
|
2550
|
+
{
|
|
2551
|
+
"name": "weft.workers.rejections",
|
|
2552
|
+
"kind": "unary",
|
|
2553
|
+
"summary": "List recently declined worker registration attempts",
|
|
2554
|
+
"description": "Bounded, most-recent-first log of declined `register` attempts: rejection code, attempted workerId when known, and whatever deployment/queue identity had already been parsed by the time the rejecting gate ran. No free-text message and no manifest content.",
|
|
2555
|
+
"tags": ["Observability"],
|
|
2556
|
+
"destructive": false,
|
|
2557
|
+
"access": {
|
|
2558
|
+
"kind": "scoped",
|
|
2559
|
+
"scopes": ["system:read"]
|
|
2560
|
+
},
|
|
2561
|
+
"transports": {
|
|
2562
|
+
"http": true,
|
|
2563
|
+
"jsonRpcHttp": true,
|
|
2564
|
+
"jsonRpcWebSocket": true,
|
|
2565
|
+
"jsonRpcStdio": true
|
|
2566
|
+
},
|
|
2567
|
+
"producibleFaults": [],
|
|
2568
|
+
"inputSchema": {
|
|
2569
|
+
"additionalProperties": false,
|
|
2570
|
+
"properties": {
|
|
2571
|
+
"limit": {
|
|
2572
|
+
"default": 20,
|
|
2573
|
+
"maximum": 100,
|
|
2574
|
+
"minimum": 1,
|
|
2575
|
+
"type": "integer"
|
|
2576
|
+
}
|
|
2577
|
+
},
|
|
2578
|
+
"required": ["limit"],
|
|
2579
|
+
"type": "object"
|
|
2580
|
+
},
|
|
2581
|
+
"outputSchema": {
|
|
2582
|
+
"additionalProperties": false,
|
|
2583
|
+
"properties": {
|
|
2584
|
+
"items": {
|
|
2585
|
+
"items": {
|
|
2586
|
+
"additionalProperties": false,
|
|
2587
|
+
"properties": {
|
|
2588
|
+
"buildId": {
|
|
2589
|
+
"type": "string"
|
|
2590
|
+
},
|
|
2591
|
+
"code": {
|
|
2592
|
+
"enum": [
|
|
2593
|
+
"invalid_registration",
|
|
2594
|
+
"unsupported_protocol_version",
|
|
2595
|
+
"deployment_conflict",
|
|
2596
|
+
"registration_rejected"
|
|
2597
|
+
],
|
|
2598
|
+
"type": "string"
|
|
2599
|
+
},
|
|
2600
|
+
"deploymentName": {
|
|
2601
|
+
"type": "string"
|
|
2602
|
+
},
|
|
2603
|
+
"queue": {
|
|
2604
|
+
"type": "string"
|
|
2605
|
+
},
|
|
2606
|
+
"rejectedAt": {
|
|
2607
|
+
"type": "number"
|
|
2608
|
+
},
|
|
2609
|
+
"workerId": {
|
|
2610
|
+
"type": "string"
|
|
2611
|
+
}
|
|
2612
|
+
},
|
|
2613
|
+
"required": ["code", "rejectedAt"],
|
|
2614
|
+
"type": "object"
|
|
2615
|
+
},
|
|
2616
|
+
"type": "array"
|
|
2617
|
+
},
|
|
2618
|
+
"limit": {
|
|
2619
|
+
"maximum": 100,
|
|
2620
|
+
"minimum": 1,
|
|
2621
|
+
"type": "integer"
|
|
2622
|
+
}
|
|
2623
|
+
},
|
|
2624
|
+
"required": ["items", "limit"],
|
|
2625
|
+
"type": "object"
|
|
2626
|
+
}
|
|
2627
|
+
},
|
|
2386
2628
|
{
|
|
2387
2629
|
"name": "weft.workers.resume",
|
|
2388
2630
|
"kind": "unary",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type CatalogWeftClient, type WeftClientConnection } from '../operation-client-runtime.ts';
|
|
2
|
-
export declare const CATALOG_OPERATION_NAMES: readonly ["weft.activities.complete", "weft.activities.fail", "weft.alerts.list", "weft.recover.all", "weft.retention.get", "weft.reviews.decision.submit", "weft.reviews.get", "weft.reviews.list", "weft.schedules.cancel", "weft.schedules.create", "weft.schedules.get", "weft.schedules.list", "weft.schedules.pause", "weft.schedules.resume", "weft.schedules.update", "weft.storage.capabilities", "weft.system.lease", "weft.system.metrics", "weft.system.principal", "weft.system.registry", "weft.task.queues.list", "weft.tasks.diagnostics", "weft.updates.result.get", "weft.worker.deployments.drain", "weft.worker.deployments.resume", "weft.workers.drain", "weft.workers.list", "weft.workers.resume", "weft.workflows.activities.pending.list", "weft.workflows.aggregate", "weft.workflows.attributes.get", "weft.workflows.attributes.set", "weft.workflows.bulk.cancel", "weft.workflows.bulk.delete", "weft.workflows.bulk.retryfailed", "weft.workflows.bulk.signal", "weft.workflows.bulk.tags", "weft.workflows.cancel", "weft.workflows.checkpoints.get", "weft.workflows.checkpoints.list", "weft.workflows.events.list", "weft.workflows.finalizer.get", "weft.workflows.fork", "weft.workflows.get", "weft.workflows.list", "weft.workflows.purge", "weft.workflows.query", "weft.workflows.replay", "weft.workflows.result.get", "weft.workflows.resume", "weft.workflows.scheduleprovenance.get", "weft.workflows.signal", "weft.workflows.start", "weft.workflows.startorsignal", "weft.workflows.streams.chunks", "weft.workflows.suspend", "weft.workflows.tags.add", "weft.workflows.tags.remove", "weft.workflows.timeline.get", "weft.workflows.timeout", "weft.workflows.update"];
|
|
2
|
+
export declare const CATALOG_OPERATION_NAMES: readonly ["weft.activities.complete", "weft.activities.fail", "weft.alerts.list", "weft.recover.all", "weft.retention.get", "weft.reviews.decision.submit", "weft.reviews.get", "weft.reviews.list", "weft.schedules.cancel", "weft.schedules.create", "weft.schedules.get", "weft.schedules.list", "weft.schedules.pause", "weft.schedules.resume", "weft.schedules.update", "weft.storage.capabilities", "weft.system.lease", "weft.system.metrics", "weft.system.principal", "weft.system.registry", "weft.task.queues.list", "weft.tasks.diagnostics", "weft.updates.result.get", "weft.worker.deployments.drain", "weft.worker.deployments.resume", "weft.workers.diagnostics", "weft.workers.drain", "weft.workers.list", "weft.workers.rejections", "weft.workers.resume", "weft.workflows.activities.pending.list", "weft.workflows.aggregate", "weft.workflows.attributes.get", "weft.workflows.attributes.set", "weft.workflows.bulk.cancel", "weft.workflows.bulk.delete", "weft.workflows.bulk.retryfailed", "weft.workflows.bulk.signal", "weft.workflows.bulk.tags", "weft.workflows.cancel", "weft.workflows.checkpoints.get", "weft.workflows.checkpoints.list", "weft.workflows.events.list", "weft.workflows.finalizer.get", "weft.workflows.fork", "weft.workflows.get", "weft.workflows.list", "weft.workflows.purge", "weft.workflows.query", "weft.workflows.replay", "weft.workflows.result.get", "weft.workflows.resume", "weft.workflows.scheduleprovenance.get", "weft.workflows.signal", "weft.workflows.start", "weft.workflows.startorsignal", "weft.workflows.streams.chunks", "weft.workflows.suspend", "weft.workflows.tags.add", "weft.workflows.tags.remove", "weft.workflows.timeline.get", "weft.workflows.timeout", "weft.workflows.update"];
|
|
3
3
|
export type CatalogOperationName = (typeof CATALOG_OPERATION_NAMES)[number];
|
|
4
|
-
export declare const CLIENT_OPERATION_NAMES: readonly ["weft.activities.complete", "weft.activities.fail", "weft.alerts.list", "weft.recover.all", "weft.retention.get", "weft.reviews.decision.submit", "weft.reviews.get", "weft.reviews.list", "weft.schedules.cancel", "weft.schedules.create", "weft.schedules.get", "weft.schedules.list", "weft.schedules.pause", "weft.schedules.resume", "weft.schedules.update", "weft.storage.capabilities", "weft.system.lease", "weft.system.metrics", "weft.system.principal", "weft.system.registry", "weft.task.queues.list", "weft.tasks.diagnostics", "weft.tasks.diagnostics.deadletters.clear", "weft.updates.result.get", "weft.worker.deployments.drain", "weft.worker.deployments.resume", "weft.workers.drain", "weft.workers.list", "weft.workers.resume", "weft.workflows.activities.pending.list", "weft.workflows.aggregate", "weft.workflows.attributes.get", "weft.workflows.attributes.set", "weft.workflows.bulk.cancel", "weft.workflows.bulk.delete", "weft.workflows.bulk.retryfailed", "weft.workflows.bulk.signal", "weft.workflows.bulk.tags", "weft.workflows.cancel", "weft.workflows.checkpoints.get", "weft.workflows.checkpoints.list", "weft.workflows.events.list", "weft.workflows.finalizer.get", "weft.workflows.fork", "weft.workflows.get", "weft.workflows.list", "weft.workflows.purge", "weft.workflows.query", "weft.workflows.replay", "weft.workflows.result.get", "weft.workflows.resume", "weft.workflows.scheduleprovenance.get", "weft.workflows.signal", "weft.workflows.start", "weft.workflows.startorsignal", "weft.workflows.streams.chunks", "weft.workflows.suspend", "weft.workflows.tags.add", "weft.workflows.tags.remove", "weft.workflows.timeline.get", "weft.workflows.timeout", "weft.workflows.update"];
|
|
4
|
+
export declare const CLIENT_OPERATION_NAMES: readonly ["weft.activities.complete", "weft.activities.fail", "weft.alerts.list", "weft.recover.all", "weft.retention.get", "weft.reviews.decision.submit", "weft.reviews.get", "weft.reviews.list", "weft.schedules.cancel", "weft.schedules.create", "weft.schedules.get", "weft.schedules.list", "weft.schedules.pause", "weft.schedules.resume", "weft.schedules.update", "weft.storage.capabilities", "weft.system.lease", "weft.system.metrics", "weft.system.principal", "weft.system.registry", "weft.task.queues.list", "weft.tasks.diagnostics", "weft.tasks.diagnostics.deadletters.clear", "weft.updates.result.get", "weft.worker.deployments.drain", "weft.worker.deployments.resume", "weft.workers.diagnostics", "weft.workers.drain", "weft.workers.list", "weft.workers.rejections", "weft.workers.resume", "weft.workflows.activities.pending.list", "weft.workflows.aggregate", "weft.workflows.attributes.get", "weft.workflows.attributes.set", "weft.workflows.bulk.cancel", "weft.workflows.bulk.delete", "weft.workflows.bulk.retryfailed", "weft.workflows.bulk.signal", "weft.workflows.bulk.tags", "weft.workflows.cancel", "weft.workflows.checkpoints.get", "weft.workflows.checkpoints.list", "weft.workflows.events.list", "weft.workflows.finalizer.get", "weft.workflows.fork", "weft.workflows.get", "weft.workflows.list", "weft.workflows.purge", "weft.workflows.query", "weft.workflows.replay", "weft.workflows.result.get", "weft.workflows.resume", "weft.workflows.scheduleprovenance.get", "weft.workflows.signal", "weft.workflows.start", "weft.workflows.startorsignal", "weft.workflows.streams.chunks", "weft.workflows.suspend", "weft.workflows.tags.add", "weft.workflows.tags.remove", "weft.workflows.timeline.get", "weft.workflows.timeout", "weft.workflows.update"];
|
|
5
5
|
export type ClientOperationName = (typeof CLIENT_OPERATION_NAMES)[number];
|
|
6
6
|
export declare const CLIENT_REST_OPERATION_BINDINGS: {
|
|
7
7
|
readonly 'weft.tasks.diagnostics.deadletters.clear': {
|
|
@@ -304,7 +304,7 @@ export type ClientOperationTypes = {
|
|
|
304
304
|
readonly executionLatencyMs?: number;
|
|
305
305
|
readonly heartbeatAgeMs?: number;
|
|
306
306
|
readonly kind: 'stuck-queued' | 'stale-inflight' | 'retry-storm' | 'all-workers-at-capacity' | 'dead-lettered';
|
|
307
|
-
readonly lastRequeueReason?:
|
|
307
|
+
readonly lastRequeueReason?: string;
|
|
308
308
|
readonly operationId?: string;
|
|
309
309
|
readonly queue?: string;
|
|
310
310
|
readonly queueLatencyMs?: number;
|
|
@@ -335,7 +335,7 @@ export type ClientOperationTypes = {
|
|
|
335
335
|
readonly output: {
|
|
336
336
|
readonly ok: boolean;
|
|
337
337
|
};
|
|
338
|
-
readonly faults:
|
|
338
|
+
readonly faults: 'NotFound';
|
|
339
339
|
};
|
|
340
340
|
'weft.updates.result.get': {
|
|
341
341
|
readonly input: {
|
|
@@ -359,6 +359,15 @@ export type ClientOperationTypes = {
|
|
|
359
359
|
readonly output: unknown;
|
|
360
360
|
readonly faults: never;
|
|
361
361
|
};
|
|
362
|
+
'weft.workers.diagnostics': {
|
|
363
|
+
readonly input: {
|
|
364
|
+
readonly workerId: string;
|
|
365
|
+
};
|
|
366
|
+
readonly output: {
|
|
367
|
+
readonly worker: unknown;
|
|
368
|
+
};
|
|
369
|
+
readonly faults: never;
|
|
370
|
+
};
|
|
362
371
|
'weft.workers.drain': {
|
|
363
372
|
readonly input: {
|
|
364
373
|
readonly reason?: string;
|
|
@@ -376,7 +385,6 @@ export type ClientOperationTypes = {
|
|
|
376
385
|
readonly deploymentName: unknown;
|
|
377
386
|
readonly drainedWorkers: number;
|
|
378
387
|
readonly drainingWorkers: number;
|
|
379
|
-
readonly gitSha: unknown;
|
|
380
388
|
readonly health: 'active' | 'draining' | 'drained';
|
|
381
389
|
readonly inFlight: number;
|
|
382
390
|
readonly oldestStartedAt: unknown;
|
|
@@ -391,7 +399,6 @@ export type ClientOperationTypes = {
|
|
|
391
399
|
readonly concurrency: number;
|
|
392
400
|
readonly connectedAt: number;
|
|
393
401
|
readonly deploymentName?: string;
|
|
394
|
-
readonly gitSha?: string;
|
|
395
402
|
readonly health: 'active' | 'draining' | 'drained';
|
|
396
403
|
readonly heartbeatAgeMs: number;
|
|
397
404
|
readonly id: string;
|
|
@@ -405,6 +412,23 @@ export type ClientOperationTypes = {
|
|
|
405
412
|
};
|
|
406
413
|
readonly faults: never;
|
|
407
414
|
};
|
|
415
|
+
'weft.workers.rejections': {
|
|
416
|
+
readonly input: {
|
|
417
|
+
readonly limit: number;
|
|
418
|
+
};
|
|
419
|
+
readonly output: {
|
|
420
|
+
readonly items: ReadonlyArray<{
|
|
421
|
+
readonly buildId?: string;
|
|
422
|
+
readonly code: 'invalid_registration' | 'unsupported_protocol_version' | 'deployment_conflict' | 'registration_rejected';
|
|
423
|
+
readonly deploymentName?: string;
|
|
424
|
+
readonly queue?: string;
|
|
425
|
+
readonly rejectedAt: number;
|
|
426
|
+
readonly workerId?: string;
|
|
427
|
+
}>;
|
|
428
|
+
readonly limit: number;
|
|
429
|
+
};
|
|
430
|
+
readonly faults: never;
|
|
431
|
+
};
|
|
408
432
|
'weft.workers.resume': {
|
|
409
433
|
readonly input: {
|
|
410
434
|
readonly workerId: string;
|
|
@@ -28,8 +28,10 @@ export const CATALOG_OPERATION_NAMES = [
|
|
|
28
28
|
"weft.updates.result.get",
|
|
29
29
|
"weft.worker.deployments.drain",
|
|
30
30
|
"weft.worker.deployments.resume",
|
|
31
|
+
"weft.workers.diagnostics",
|
|
31
32
|
"weft.workers.drain",
|
|
32
33
|
"weft.workers.list",
|
|
34
|
+
"weft.workers.rejections",
|
|
33
35
|
"weft.workers.resume",
|
|
34
36
|
"weft.workflows.activities.pending.list",
|
|
35
37
|
"weft.workflows.aggregate",
|
|
@@ -91,8 +93,10 @@ export const CATALOG_OPERATION_NAMES = [
|
|
|
91
93
|
"weft.updates.result.get",
|
|
92
94
|
"weft.worker.deployments.drain",
|
|
93
95
|
"weft.worker.deployments.resume",
|
|
96
|
+
"weft.workers.diagnostics",
|
|
94
97
|
"weft.workers.drain",
|
|
95
98
|
"weft.workers.list",
|
|
99
|
+
"weft.workers.rejections",
|
|
96
100
|
"weft.workers.resume",
|
|
97
101
|
"weft.workflows.activities.pending.list",
|
|
98
102
|
"weft.workflows.aggregate",
|
|
@@ -9,7 +9,7 @@ export declare function normalizePipeStage(internals: ContextInternals, stage: W
|
|
|
9
9
|
export declare function resolveChildWorkflowTarget<TInput = unknown, TOutput = unknown>(internals: ContextInternals, target: ChildWorkflowTarget<TInput, TOutput>): string;
|
|
10
10
|
export declare function resolveMapConcurrency(totalItems: number, requestedConcurrency: number | undefined): number;
|
|
11
11
|
export declare function createCompositionToken(internals: ContextInternals, kind: 'map' | 'pipe' | 'reduce'): string;
|
|
12
|
-
export declare function createCompositionChildWorkflowOptions(internals: ContextInternals, token: string, index: number, options?: AwaitChildWorkflowOptions
|
|
12
|
+
export declare function createCompositionChildWorkflowOptions(internals: ContextInternals, token: string, index: number, options?: AwaitChildWorkflowOptions): AwaitChildWorkflowOptions;
|
|
13
13
|
export declare function createReduceChildWorkflowOptions(internals: ContextInternals, token: string, index: number, options: WorkflowReduceOptions | undefined): AwaitChildWorkflowOptions;
|
|
14
14
|
export declare function primeParallelOperations(operations: Generator<ContextOperationRequest, unknown, unknown>[]): ContextOperationRequest[];
|
|
15
15
|
export declare function startChild<TResult = unknown>(context: Context, internals: ContextInternals, workflowType: string, input: unknown, options?: ChildWorkflowOptions): Generator<ContextOperationRequest, TResult | ChildWorkflowHandle<TResult>, unknown>;
|
|
@@ -27,7 +27,7 @@ export function resolveMapConcurrency(totalItems, requestedConcurrency) {
|
|
|
27
27
|
export function createCompositionToken(internals, kind) {
|
|
28
28
|
return `${kind}:${internals.stepIndex}`;
|
|
29
29
|
}
|
|
30
|
-
export function createCompositionChildWorkflowOptions(internals, token, index, options
|
|
30
|
+
export function createCompositionChildWorkflowOptions(internals, token, index, options) {
|
|
31
31
|
assertCompositionAwaitsChildWorkflow(options);
|
|
32
32
|
if (options?.id !== void 0)
|
|
33
33
|
return options;
|
|
@@ -51,6 +51,8 @@ export declare function createExecutionStrategyBundle(parameters: {
|
|
|
51
51
|
development: boolean;
|
|
52
52
|
broadcastEvents: boolean;
|
|
53
53
|
getRegistration: (workflowType: string) => RegistrationEntry | undefined;
|
|
54
|
+
/** Live accessor for registered workflow type names (WFT-28); registrations are still empty here. */
|
|
55
|
+
listRegisteredWorkflowTypes: () => Iterable<string>;
|
|
54
56
|
getComposedWorkflowInterceptor?: () => ComposedWorkflowInterceptor | null;
|
|
55
57
|
resolveWorkflowType: (target: string | Function) => string;
|
|
56
58
|
registerCancelHandler?: (workflowId: string, handler: () => Promise<void> | void) => () => void;
|
|
@@ -187,6 +187,7 @@ export function createExecutionStrategyBundle(parameters) {
|
|
|
187
187
|
development,
|
|
188
188
|
broadcastEvents,
|
|
189
189
|
getRegistration,
|
|
190
|
+
listRegisteredWorkflowTypes,
|
|
190
191
|
getComposedWorkflowInterceptor,
|
|
191
192
|
resolveWorkflowType,
|
|
192
193
|
registerCancelHandler,
|
|
@@ -203,6 +204,8 @@ export function createExecutionStrategyBundle(parameters) {
|
|
|
203
204
|
broadcastEvents,
|
|
204
205
|
requireProtocolVersion: workerExecutionConfiguration.requireProtocolVersion,
|
|
205
206
|
discardOnCancel: workerExecutionConfiguration.discardOnCancel,
|
|
207
|
+
requireRealmReady: !0,
|
|
208
|
+
getExpectedWorkflowTypes: () => [...listRegisteredWorkflowTypes()],
|
|
206
209
|
workflowTurnTimeoutMs: workerExecutionConfiguration.workflowTurnTimeoutMs,
|
|
207
210
|
maxProtocolMessageBytes: workerExecutionConfiguration.maxProtocolMessageBytes,
|
|
208
211
|
getNow,
|
|
@@ -280,6 +280,7 @@ export class Engine extends EventTarget {
|
|
|
280
280
|
development: resolvedOptions.development,
|
|
281
281
|
broadcastEvents: resolvedOptions.broadcastEvents,
|
|
282
282
|
getRegistration: getInternals(this).registrations.get.bind(getInternals(this).registrations),
|
|
283
|
+
listRegisteredWorkflowTypes: () => getInternals(this).registrations.keys(),
|
|
283
284
|
getComposedWorkflowInterceptor: () => getComposedWorkflowInterceptor(getInternals(this)),
|
|
284
285
|
resolveWorkflowType: this.#resolveWorkflowTypeTarget.bind(this),
|
|
285
286
|
registerCancelHandler: (workflowId, handler) => registerCancelHandler(getInternals(this), workflowId, handler),
|
|
@@ -3,6 +3,7 @@ import type { EngineInternals } from './internals.ts';
|
|
|
3
3
|
export declare const BULK_OPERATION_BATCH_SIZE = 1000;
|
|
4
4
|
/** List workflow summaries that match a filter, using indexes when available. */
|
|
5
5
|
export declare function list(internals: EngineInternals, filter?: ListFilter, options?: ListOptions): Promise<PaginatedResult<WorkflowSummary>>;
|
|
6
|
+
export declare function assertWorkflowListScanWithinCap(scannedRows: number): void;
|
|
6
7
|
/** Stream decoded workflow states that match a list filter. */
|
|
7
8
|
export declare function streamWorkflowStates(internals: EngineInternals, filter?: ListFilter): AsyncGenerator<WorkflowState>;
|
|
8
9
|
/** Stream decoded workflow states in fixed-size batches for bulk operations. */
|
|
@@ -25,8 +25,7 @@ export async function list(internals, filter, options) {
|
|
|
25
25
|
}
|
|
26
26
|
async function collectSummariesFromConstrainedIds(internals, constrainedIds, normalizedFilter, normalizedTagFilters, options) {
|
|
27
27
|
const orderedIds = [...constrainedIds];
|
|
28
|
-
|
|
29
|
-
throw new WorkflowListScanCapExceededError(MAX_LIST_SCAN_ROWS);
|
|
28
|
+
assertWorkflowListScanWithinCap(orderedIds.length);
|
|
30
29
|
const items = [];
|
|
31
30
|
for (let start = 0;start < orderedIds.length; start += CONSTRAINED_ID_CHUNK_SIZE) {
|
|
32
31
|
const chunkIds = orderedIds.slice(start, start + CONSTRAINED_ID_CHUNK_SIZE), chunkBytes = await Promise.all(chunkIds.map((workflowId) => internals.storage.get(KEYS.workflow(workflowId)))), searchAttributesByWorkflowId = await readSearchAttributesForStates(internals, chunkBytes, normalizedFilter), matchingStates = [];
|
|
@@ -49,8 +48,7 @@ async function collectSummariesFromFullScan(internals, normalizedFilter, normali
|
|
|
49
48
|
if (!isTopLevelWorkflowStateKey(key))
|
|
50
49
|
continue;
|
|
51
50
|
scanned += 1;
|
|
52
|
-
|
|
53
|
-
throw new WorkflowListScanCapExceededError(MAX_LIST_SCAN_ROWS);
|
|
51
|
+
assertWorkflowListScanWithinCap(scanned);
|
|
54
52
|
const state = decodeWorkflowState(value), searchAttributes = await readSearchAttributesForFilter(internals, state.id, normalizedFilter);
|
|
55
53
|
if (!matchesListFilter(state, normalizedFilter, null, normalizedTagFilters, searchAttributes))
|
|
56
54
|
continue;
|
|
@@ -59,6 +57,10 @@ async function collectSummariesFromFullScan(internals, normalizedFilter, normali
|
|
|
59
57
|
}
|
|
60
58
|
return items;
|
|
61
59
|
}
|
|
60
|
+
export function assertWorkflowListScanWithinCap(scannedRows) {
|
|
61
|
+
if (scannedRows > MAX_LIST_SCAN_ROWS)
|
|
62
|
+
throw new WorkflowListScanCapExceededError(MAX_LIST_SCAN_ROWS);
|
|
63
|
+
}
|
|
62
64
|
async function summariesFromStates(internals, states, options) {
|
|
63
65
|
const attributeBytesByWorkflowId = new Map;
|
|
64
66
|
await Promise.all(states.map(async (state) => {
|