@lostgradient/weft 0.16.0 → 0.18.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 +1 -1
- package/dist/alerting/alert-manager.d.ts +5 -5
- package/dist/alerting/alert-manager.js +24 -6
- package/dist/alerting/index.d.ts +1 -1
- package/dist/alerting/types.d.ts +17 -13
- package/dist/alerting/types.js +5 -0
- package/dist/cli/generated/operation-catalog.snapshot.json +73 -0
- package/dist/cli/generated/operation-client.generated.d.ts +11 -2
- package/dist/cli/generated/operation-client.generated.js +2 -0
- package/dist/core/engine/disposal.js +7 -0
- package/dist/core/engine/engine-runtime-helpers.d.ts +3 -1
- package/dist/core/engine/engine-runtime-helpers.js +2 -2
- package/dist/core/engine/errors.d.ts +20 -0
- package/dist/core/engine/errors.js +8 -0
- package/dist/core/engine/index.d.ts +39 -17
- package/dist/core/engine/index.js +81 -9
- package/dist/core/engine/inline-launch-queue.d.ts +6 -2
- package/dist/core/engine/inline-launch-queue.js +41 -6
- package/dist/core/engine/internals.d.ts +2 -0
- package/dist/core/engine/lease-manager.d.ts +3 -2
- package/dist/core/engine/lease-manager.js +7 -3
- package/dist/core/engine/operations-time.js +6 -0
- package/dist/core/execution-strategy.d.ts +8 -0
- package/dist/core/inline-execution-strategy.d.ts +1 -0
- package/dist/core/inline-execution-strategy.js +33 -20
- package/dist/core/weft-error.d.ts +1 -1
- package/dist/core/weft-error.js +1 -0
- package/dist/core/worker-execution-strategy.d.ts +2 -0
- package/dist/core/worker-execution-strategy.js +7 -2
- package/dist/core/worker-turn-watchdog.d.ts +4 -1
- package/dist/core/worker-turn-watchdog.js +9 -4
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -0
- package/dist/indexeddb.js +1 -1
- package/dist/json-schema.js +1 -1
- package/dist/mcp/tools.js +1 -3
- package/dist/server/authorization-scope.d.ts +32 -2
- package/dist/server/dashboard-assets.d.ts +12 -1
- package/dist/server/dashboard-assets.js +145 -31
- package/dist/server/index.d.ts +2 -0
- package/dist/server/index.js +4 -0
- package/dist/server/operations/aggregate-workflows.js +0 -7
- package/dist/server/operations/async-activity.js +5 -24
- package/dist/server/operations/bulk-cancel-workflows.js +3 -8
- package/dist/server/operations/bulk-delete-workflows.js +3 -8
- package/dist/server/operations/bulk-mutate-workflow-tags.js +3 -8
- package/dist/server/operations/bulk-operation-helpers.d.ts +2 -10
- package/dist/server/operations/bulk-operation-helpers.js +0 -6
- package/dist/server/operations/bulk-retry-failed-workflows.js +3 -8
- package/dist/server/operations/bulk-signal-workflows.js +3 -8
- package/dist/server/operations/cancel-schedule.js +1 -3
- package/dist/server/operations/cancel-workflow.js +1 -3
- package/dist/server/operations/create-schedule.js +2 -3
- package/dist/server/operations/fork-workflow.js +2 -3
- package/dist/server/operations/get-checkpoint-at.js +1 -6
- package/dist/server/operations/get-principal.d.ts +75 -0
- package/dist/server/operations/get-principal.js +41 -0
- package/dist/server/operations/get-registry.js +1 -7
- package/dist/server/operations/get-retention-overview.js +2 -15
- package/dist/server/operations/get-review.js +2 -15
- package/dist/server/operations/get-schedule.js +2 -8
- package/dist/server/operations/get-stream-chunks.js +2 -6
- package/dist/server/operations/get-system-lease.js +1 -7
- package/dist/server/operations/get-system-metrics.js +0 -4
- package/dist/server/operations/get-task-diagnostics.js +2 -13
- package/dist/server/operations/get-update-result.js +1 -6
- package/dist/server/operations/get-workflow-attributes.js +2 -15
- package/dist/server/operations/get-workflow-events.js +2 -15
- package/dist/server/operations/get-workflow-observability.js +2 -5
- package/dist/server/operations/get-workflow-result.js +0 -7
- package/dist/server/operations/get-workflow-timeline.js +1 -6
- package/dist/server/operations/get-workflow.d.ts +3 -6
- package/dist/server/operations/get-workflow.js +2 -12
- package/dist/server/operations/list-alerts.d.ts +5 -2
- package/dist/server/operations/list-alerts.js +2 -9
- package/dist/server/operations/list-checkpoints.js +1 -6
- package/dist/server/operations/list-reviews.js +0 -7
- package/dist/server/operations/list-schedules.js +3 -8
- package/dist/server/operations/list-task-queues.js +0 -4
- package/dist/server/operations/list-workers.js +0 -4
- package/dist/server/operations/list-workflows.js +0 -7
- package/dist/server/operations/pause-schedule.js +1 -3
- package/dist/server/operations/purge-workflows.js +2 -5
- package/dist/server/operations/query-workflow.js +4 -15
- package/dist/server/operations/replay-workflow.js +2 -6
- package/dist/server/operations/resume-schedule.js +1 -3
- package/dist/server/operations/resume-workflow.js +1 -3
- package/dist/server/operations/set-workflow-attributes.js +3 -15
- package/dist/server/operations/signal-workflow.js +3 -12
- package/dist/server/operations/single-workflow-tag-mutation.js +0 -7
- package/dist/server/operations/start-or-signal-workflow.js +2 -3
- package/dist/server/operations/start-workflow.js +2 -3
- package/dist/server/operations/static-registrations.d.ts +28 -0
- package/dist/server/operations/static-registrations.js +263 -0
- package/dist/server/operations/storage-capabilities.js +1 -3
- package/dist/server/operations/storage.js +7 -13
- package/dist/server/operations/submit-review-decision.js +3 -12
- package/dist/server/operations/suspend-workflow.js +1 -3
- package/dist/server/operations/timeout-workflow.js +1 -3
- package/dist/server/operations/update-schedule.js +1 -3
- package/dist/server/operations/update-workflow.js +2 -3
- package/dist/server/operations/worker-drain.js +0 -8
- package/dist/server/rest-binding.d.ts +3 -2
- package/dist/server/rest-bindings.d.ts +5 -0
- package/dist/server/rest-bindings.js +4 -312
- package/dist/server/route-model.d.ts +2 -0
- package/dist/server/route-model.js +1 -1
- package/dist/server/runtime/task-reconciliation.d.ts +10 -1
- package/dist/server/runtime/task-reconciliation.js +26 -2
- package/dist/server/serve-internals.js +12 -6
- package/dist/storage/indexeddb.js +28 -48
- package/dist/storage/testing.d.ts +6 -3
- package/dist/storage/testing.js +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/worker/protocol-schemas.d.ts +2 -2
- package/dist/worker/protocol-schemas.js +2 -2
- package/dist/worker/protocol.js +1 -1
- package/package.json +1 -1
|
@@ -1,110 +1,12 @@
|
|
|
1
1
|
import { createOperationRegistry } from "./operation-catalog.js";
|
|
2
|
-
import {
|
|
3
|
-
addWorkflowTagsOperation,
|
|
4
|
-
addWorkflowTagsRestBinding
|
|
5
|
-
} from "./operations/add-workflow-tags.js";
|
|
6
|
-
import {
|
|
7
|
-
aggregateWorkflowsOperation,
|
|
8
|
-
aggregateWorkflowsRestBinding
|
|
9
|
-
} from "./operations/aggregate-workflows.js";
|
|
10
|
-
import * as asyncActivity from "./operations/async-activity.js";
|
|
11
|
-
import {
|
|
12
|
-
bulkCancelWorkflowsOperation,
|
|
13
|
-
bulkCancelWorkflowsRestBinding
|
|
14
|
-
} from "./operations/bulk-cancel-workflows.js";
|
|
15
|
-
import {
|
|
16
|
-
bulkDeleteWorkflowsOperation,
|
|
17
|
-
bulkDeleteWorkflowsRestBinding
|
|
18
|
-
} from "./operations/bulk-delete-workflows.js";
|
|
19
|
-
import {
|
|
20
|
-
bulkMutateWorkflowTagsOperation,
|
|
21
|
-
bulkMutateWorkflowTagsRestBinding
|
|
22
|
-
} from "./operations/bulk-mutate-workflow-tags.js";
|
|
23
|
-
import {
|
|
24
|
-
bulkRetryFailedWorkflowsOperation,
|
|
25
|
-
bulkRetryFailedWorkflowsRestBinding
|
|
26
|
-
} from "./operations/bulk-retry-failed-workflows.js";
|
|
27
|
-
import {
|
|
28
|
-
bulkSignalWorkflowsOperation,
|
|
29
|
-
bulkSignalWorkflowsRestBinding
|
|
30
|
-
} from "./operations/bulk-signal-workflows.js";
|
|
31
|
-
import {
|
|
32
|
-
cancelScheduleOperation,
|
|
33
|
-
cancelScheduleRestBinding
|
|
34
|
-
} from "./operations/cancel-schedule.js";
|
|
35
|
-
import {
|
|
36
|
-
cancelWorkflowOperation,
|
|
37
|
-
cancelWorkflowRestBinding
|
|
38
|
-
} from "./operations/cancel-workflow.js";
|
|
39
|
-
import {
|
|
40
|
-
createScheduleOperation,
|
|
41
|
-
createScheduleRestBinding
|
|
42
|
-
} from "./operations/create-schedule.js";
|
|
43
|
-
import {
|
|
44
|
-
fleetEventsSseOperation,
|
|
45
|
-
fleetEventsSseRestBinding
|
|
46
|
-
} from "./operations/fleet-events-sse.js";
|
|
47
|
-
import { fleetEventsSubscriptionOperation } from "./operations/fleet-events-subscription.js";
|
|
48
|
-
import { forkWorkflowOperation, forkWorkflowRestBinding } from "./operations/fork-workflow.js";
|
|
49
|
-
import {
|
|
50
|
-
getCheckpointAtOperation,
|
|
51
|
-
getCheckpointAtRestBinding
|
|
52
|
-
} from "./operations/get-checkpoint-at.js";
|
|
53
|
-
import { getRegistryOperation, getRegistryRestBinding } from "./operations/get-registry.js";
|
|
54
|
-
import {
|
|
55
|
-
getRetentionOverviewOperation,
|
|
56
|
-
getRetentionOverviewRestBinding
|
|
57
|
-
} from "./operations/get-retention-overview.js";
|
|
58
|
-
import { getReviewOperation, getReviewRestBinding } from "./operations/get-review.js";
|
|
59
|
-
import { getScheduleOperation, getScheduleRestBinding } from "./operations/get-schedule.js";
|
|
60
|
-
import {
|
|
61
|
-
getStreamChunksOperation,
|
|
62
|
-
getStreamChunksRestBinding
|
|
63
|
-
} from "./operations/get-stream-chunks.js";
|
|
64
|
-
import {
|
|
65
|
-
getSystemLeaseOperation,
|
|
66
|
-
getSystemLeaseRestBinding
|
|
67
|
-
} from "./operations/get-system-lease.js";
|
|
68
2
|
import {
|
|
69
3
|
createGetSystemMetricsOperation,
|
|
70
4
|
createGetSystemMetricsRestBinding
|
|
71
5
|
} from "./operations/get-system-metrics.js";
|
|
72
6
|
import {
|
|
73
|
-
clearTaskDeadLetterOperation,
|
|
74
|
-
clearTaskDeadLetterRestBinding,
|
|
75
7
|
createGetTaskDiagnosticsOperation,
|
|
76
|
-
getTaskDiagnosticsOperation
|
|
77
|
-
getTaskDiagnosticsRestBinding
|
|
8
|
+
getTaskDiagnosticsOperation
|
|
78
9
|
} from "./operations/get-task-diagnostics.js";
|
|
79
|
-
import {
|
|
80
|
-
getUpdateResultOperation,
|
|
81
|
-
getUpdateResultRestBinding
|
|
82
|
-
} from "./operations/get-update-result.js";
|
|
83
|
-
import {
|
|
84
|
-
getWorkflowAttributesOperation,
|
|
85
|
-
getWorkflowAttributesRestBinding
|
|
86
|
-
} from "./operations/get-workflow-attributes.js";
|
|
87
|
-
import {
|
|
88
|
-
getWorkflowEventsOperation,
|
|
89
|
-
getWorkflowEventsRestBinding
|
|
90
|
-
} from "./operations/get-workflow-events.js";
|
|
91
|
-
import * as workflowObservability from "./operations/get-workflow-observability.js";
|
|
92
|
-
import {
|
|
93
|
-
getWorkflowResultOperation,
|
|
94
|
-
getWorkflowResultRestBinding
|
|
95
|
-
} from "./operations/get-workflow-result.js";
|
|
96
|
-
import {
|
|
97
|
-
getWorkflowTimelineOperation,
|
|
98
|
-
getWorkflowTimelineRestBinding
|
|
99
|
-
} from "./operations/get-workflow-timeline.js";
|
|
100
|
-
import { getWorkflowOperation, getWorkflowRestBinding } from "./operations/get-workflow.js";
|
|
101
|
-
import { listAlertsOperation, listAlertsRestBinding } from "./operations/list-alerts.js";
|
|
102
|
-
import {
|
|
103
|
-
listCheckpointsOperation,
|
|
104
|
-
listCheckpointsRestBinding
|
|
105
|
-
} from "./operations/list-checkpoints.js";
|
|
106
|
-
import { listReviewsOperation, listReviewsRestBinding } from "./operations/list-reviews.js";
|
|
107
|
-
import { listSchedulesOperation, listSchedulesRestBinding } from "./operations/list-schedules.js";
|
|
108
10
|
import {
|
|
109
11
|
createListTaskQueuesOperation,
|
|
110
12
|
createListTaskQueuesRestBinding,
|
|
@@ -115,86 +17,7 @@ import {
|
|
|
115
17
|
createListWorkersRestBinding,
|
|
116
18
|
listWorkersOperation
|
|
117
19
|
} from "./operations/list-workers.js";
|
|
118
|
-
import {
|
|
119
|
-
import { pauseScheduleOperation, pauseScheduleRestBinding } from "./operations/pause-schedule.js";
|
|
120
|
-
import {
|
|
121
|
-
purgeWorkflowsOperation,
|
|
122
|
-
purgeWorkflowsRestBinding
|
|
123
|
-
} from "./operations/purge-workflows.js";
|
|
124
|
-
import {
|
|
125
|
-
queryWorkflowOperation,
|
|
126
|
-
queryWorkflowRestBinding,
|
|
127
|
-
queryWorkflowWithInputRestBinding
|
|
128
|
-
} from "./operations/query-workflow.js";
|
|
129
|
-
import { recoverAllOperation, recoverAllRestBinding } from "./operations/recover-all.js";
|
|
130
|
-
import {
|
|
131
|
-
removeWorkflowTagsOperation,
|
|
132
|
-
removeWorkflowTagsRestBinding
|
|
133
|
-
} from "./operations/remove-workflow-tags.js";
|
|
134
|
-
import {
|
|
135
|
-
replayWorkflowOperation,
|
|
136
|
-
replayWorkflowRestBinding
|
|
137
|
-
} from "./operations/replay-workflow.js";
|
|
138
|
-
import {
|
|
139
|
-
resumeScheduleOperation,
|
|
140
|
-
resumeScheduleRestBinding
|
|
141
|
-
} from "./operations/resume-schedule.js";
|
|
142
|
-
import {
|
|
143
|
-
resumeWorkflowOperation,
|
|
144
|
-
resumeWorkflowRestBinding
|
|
145
|
-
} from "./operations/resume-workflow.js";
|
|
146
|
-
import {
|
|
147
|
-
setWorkflowAttributesOperation,
|
|
148
|
-
setWorkflowAttributesRestBinding
|
|
149
|
-
} from "./operations/set-workflow-attributes.js";
|
|
150
|
-
import {
|
|
151
|
-
signalWorkflowOperation,
|
|
152
|
-
signalWorkflowRestBinding
|
|
153
|
-
} from "./operations/signal-workflow.js";
|
|
154
|
-
import {
|
|
155
|
-
startOrSignalWorkflowOperation,
|
|
156
|
-
startOrSignalWorkflowRestBinding
|
|
157
|
-
} from "./operations/start-or-signal-workflow.js";
|
|
158
|
-
import { startWorkflowOperation, startWorkflowRestBinding } from "./operations/start-workflow.js";
|
|
159
|
-
import * as storageCapabilities from "./operations/storage-capabilities.js";
|
|
160
|
-
import {
|
|
161
|
-
storageBatchOperation,
|
|
162
|
-
storageBatchRestBinding,
|
|
163
|
-
storageConditionalBatchOperation,
|
|
164
|
-
storageConditionalBatchRestBinding,
|
|
165
|
-
storageDeleteOperation,
|
|
166
|
-
storageDeleteRestBinding,
|
|
167
|
-
storageGetOperation,
|
|
168
|
-
storageGetRestBinding,
|
|
169
|
-
storagePutOperation,
|
|
170
|
-
storagePutRestBinding,
|
|
171
|
-
storageScanOperation,
|
|
172
|
-
storageScanRestBinding
|
|
173
|
-
} from "./operations/storage.js";
|
|
174
|
-
import {
|
|
175
|
-
streamWorkflowSseOperation,
|
|
176
|
-
streamWorkflowSseRestBinding
|
|
177
|
-
} from "./operations/stream-workflow-sse.js";
|
|
178
|
-
import {
|
|
179
|
-
submitReviewDecisionOperation,
|
|
180
|
-
submitReviewDecisionRestBinding
|
|
181
|
-
} from "./operations/submit-review-decision.js";
|
|
182
|
-
import {
|
|
183
|
-
suspendWorkflowOperation,
|
|
184
|
-
suspendWorkflowRestBinding
|
|
185
|
-
} from "./operations/suspend-workflow.js";
|
|
186
|
-
import {
|
|
187
|
-
timeoutWorkflowOperation,
|
|
188
|
-
timeoutWorkflowRestBinding
|
|
189
|
-
} from "./operations/timeout-workflow.js";
|
|
190
|
-
import {
|
|
191
|
-
updateScheduleOperation,
|
|
192
|
-
updateScheduleRestBinding
|
|
193
|
-
} from "./operations/update-schedule.js";
|
|
194
|
-
import {
|
|
195
|
-
updateWorkflowOperation,
|
|
196
|
-
updateWorkflowRestBinding
|
|
197
|
-
} from "./operations/update-workflow.js";
|
|
20
|
+
import { STATIC_OPERATIONS, STATIC_REST_BINDINGS } from "./operations/static-registrations.js";
|
|
198
21
|
import {
|
|
199
22
|
clearDeploymentDrainOperation,
|
|
200
23
|
clearWorkerDrainOperation,
|
|
@@ -209,76 +32,7 @@ import {
|
|
|
209
32
|
drainDeploymentOperation,
|
|
210
33
|
drainWorkerOperation
|
|
211
34
|
} from "./operations/worker-drain.js";
|
|
212
|
-
|
|
213
|
-
workflowEventsSseOperation,
|
|
214
|
-
workflowEventsSseRestBinding
|
|
215
|
-
} from "./operations/workflow-events-sse.js";
|
|
216
|
-
import { workflowEventsSubscriptionOperation } from "./operations/workflow-events-subscription.js";
|
|
217
|
-
export const REST_BINDINGS = [
|
|
218
|
-
listAlertsRestBinding,
|
|
219
|
-
startWorkflowRestBinding,
|
|
220
|
-
startOrSignalWorkflowRestBinding,
|
|
221
|
-
recoverAllRestBinding,
|
|
222
|
-
listWorkflowsRestBinding,
|
|
223
|
-
aggregateWorkflowsRestBinding,
|
|
224
|
-
purgeWorkflowsRestBinding,
|
|
225
|
-
bulkCancelWorkflowsRestBinding,
|
|
226
|
-
bulkSignalWorkflowsRestBinding,
|
|
227
|
-
bulkRetryFailedWorkflowsRestBinding,
|
|
228
|
-
bulkDeleteWorkflowsRestBinding,
|
|
229
|
-
bulkMutateWorkflowTagsRestBinding,
|
|
230
|
-
getWorkflowRestBinding,
|
|
231
|
-
cancelWorkflowRestBinding,
|
|
232
|
-
getWorkflowResultRestBinding,
|
|
233
|
-
getWorkflowAttributesRestBinding,
|
|
234
|
-
...workflowObservability.workflowObservabilityRestBindings,
|
|
235
|
-
getWorkflowEventsRestBinding,
|
|
236
|
-
setWorkflowAttributesRestBinding,
|
|
237
|
-
signalWorkflowRestBinding,
|
|
238
|
-
asyncActivity.listPendingAsyncActivitiesRestBinding,
|
|
239
|
-
asyncActivity.completeAsyncActivityRestBinding,
|
|
240
|
-
asyncActivity.failAsyncActivityRestBinding,
|
|
241
|
-
queryWorkflowRestBinding,
|
|
242
|
-
queryWorkflowWithInputRestBinding,
|
|
243
|
-
resumeWorkflowRestBinding,
|
|
244
|
-
suspendWorkflowRestBinding,
|
|
245
|
-
forkWorkflowRestBinding,
|
|
246
|
-
timeoutWorkflowRestBinding,
|
|
247
|
-
updateWorkflowRestBinding,
|
|
248
|
-
createScheduleRestBinding,
|
|
249
|
-
updateScheduleRestBinding,
|
|
250
|
-
getRegistryRestBinding,
|
|
251
|
-
getSystemLeaseRestBinding,
|
|
252
|
-
getRetentionOverviewRestBinding,
|
|
253
|
-
getUpdateResultRestBinding,
|
|
254
|
-
listReviewsRestBinding,
|
|
255
|
-
getReviewRestBinding,
|
|
256
|
-
listCheckpointsRestBinding,
|
|
257
|
-
getCheckpointAtRestBinding,
|
|
258
|
-
getWorkflowTimelineRestBinding,
|
|
259
|
-
addWorkflowTagsRestBinding,
|
|
260
|
-
removeWorkflowTagsRestBinding,
|
|
261
|
-
submitReviewDecisionRestBinding,
|
|
262
|
-
cancelScheduleRestBinding,
|
|
263
|
-
pauseScheduleRestBinding,
|
|
264
|
-
resumeScheduleRestBinding,
|
|
265
|
-
getStreamChunksRestBinding,
|
|
266
|
-
streamWorkflowSseRestBinding,
|
|
267
|
-
workflowEventsSseRestBinding,
|
|
268
|
-
fleetEventsSseRestBinding,
|
|
269
|
-
getTaskDiagnosticsRestBinding,
|
|
270
|
-
clearTaskDeadLetterRestBinding,
|
|
271
|
-
listSchedulesRestBinding,
|
|
272
|
-
getScheduleRestBinding,
|
|
273
|
-
replayWorkflowRestBinding,
|
|
274
|
-
storageCapabilities.storageCapabilitiesRestBinding,
|
|
275
|
-
storageGetRestBinding,
|
|
276
|
-
storagePutRestBinding,
|
|
277
|
-
storageDeleteRestBinding,
|
|
278
|
-
storageScanRestBinding,
|
|
279
|
-
storageBatchRestBinding,
|
|
280
|
-
storageConditionalBatchRestBinding
|
|
281
|
-
];
|
|
35
|
+
export const REST_BINDINGS = STATIC_REST_BINDINGS;
|
|
282
36
|
export function createLiveRestBindings() {
|
|
283
37
|
return [
|
|
284
38
|
...REST_BINDINGS,
|
|
@@ -349,70 +103,8 @@ function buildTaskDiagnosticsOperationForRegistry(options) {
|
|
|
349
103
|
export function createLiveOperationRegistry(options) {
|
|
350
104
|
const resolved = options ?? {};
|
|
351
105
|
return createOperationRegistry([
|
|
352
|
-
|
|
353
|
-
startOrSignalWorkflowOperation,
|
|
354
|
-
recoverAllOperation,
|
|
355
|
-
listWorkflowsOperation,
|
|
356
|
-
aggregateWorkflowsOperation,
|
|
357
|
-
purgeWorkflowsOperation,
|
|
358
|
-
bulkCancelWorkflowsOperation,
|
|
359
|
-
bulkSignalWorkflowsOperation,
|
|
360
|
-
bulkRetryFailedWorkflowsOperation,
|
|
361
|
-
bulkDeleteWorkflowsOperation,
|
|
362
|
-
bulkMutateWorkflowTagsOperation,
|
|
363
|
-
getWorkflowOperation,
|
|
364
|
-
cancelWorkflowOperation,
|
|
365
|
-
getWorkflowResultOperation,
|
|
366
|
-
getWorkflowAttributesOperation,
|
|
367
|
-
...workflowObservability.workflowObservabilityOperations,
|
|
368
|
-
getWorkflowEventsOperation,
|
|
369
|
-
setWorkflowAttributesOperation,
|
|
370
|
-
signalWorkflowOperation,
|
|
371
|
-
asyncActivity.listPendingAsyncActivitiesOperation,
|
|
372
|
-
asyncActivity.completeAsyncActivityOperation,
|
|
373
|
-
asyncActivity.failAsyncActivityOperation,
|
|
374
|
-
queryWorkflowOperation,
|
|
375
|
-
resumeWorkflowOperation,
|
|
376
|
-
suspendWorkflowOperation,
|
|
377
|
-
forkWorkflowOperation,
|
|
378
|
-
timeoutWorkflowOperation,
|
|
379
|
-
updateWorkflowOperation,
|
|
380
|
-
createScheduleOperation,
|
|
381
|
-
updateScheduleOperation,
|
|
382
|
-
getRegistryOperation,
|
|
383
|
-
getSystemLeaseOperation,
|
|
384
|
-
getRetentionOverviewOperation,
|
|
385
|
-
getUpdateResultOperation,
|
|
386
|
-
listReviewsOperation,
|
|
387
|
-
getReviewOperation,
|
|
388
|
-
listCheckpointsOperation,
|
|
389
|
-
getCheckpointAtOperation,
|
|
390
|
-
getWorkflowTimelineOperation,
|
|
391
|
-
addWorkflowTagsOperation,
|
|
392
|
-
removeWorkflowTagsOperation,
|
|
393
|
-
submitReviewDecisionOperation,
|
|
394
|
-
cancelScheduleOperation,
|
|
395
|
-
pauseScheduleOperation,
|
|
396
|
-
resumeScheduleOperation,
|
|
397
|
-
getStreamChunksOperation,
|
|
398
|
-
streamWorkflowSseOperation,
|
|
399
|
-
workflowEventsSseOperation,
|
|
400
|
-
fleetEventsSseOperation,
|
|
401
|
-
workflowEventsSubscriptionOperation,
|
|
402
|
-
fleetEventsSubscriptionOperation,
|
|
106
|
+
...STATIC_OPERATIONS,
|
|
403
107
|
buildTaskDiagnosticsOperationForRegistry(resolved),
|
|
404
|
-
clearTaskDeadLetterOperation,
|
|
405
|
-
listSchedulesOperation,
|
|
406
|
-
listAlertsOperation,
|
|
407
|
-
getScheduleOperation,
|
|
408
|
-
replayWorkflowOperation,
|
|
409
|
-
storageCapabilities.storageCapabilitiesOperation,
|
|
410
|
-
storageGetOperation,
|
|
411
|
-
storagePutOperation,
|
|
412
|
-
storageDeleteOperation,
|
|
413
|
-
storageScanOperation,
|
|
414
|
-
storageBatchOperation,
|
|
415
|
-
storageConditionalBatchOperation,
|
|
416
108
|
buildSystemMetricsOperation(resolved),
|
|
417
109
|
buildListWorkersOperationForRegistry(resolved),
|
|
418
110
|
buildDrainWorkerOperationForRegistry(resolved),
|
|
@@ -34,6 +34,8 @@
|
|
|
34
34
|
* RFC 9264 / discovery convention.
|
|
35
35
|
*/
|
|
36
36
|
export declare const API_PREFIX = "/api";
|
|
37
|
+
/** Root-relative namespace for the functional REST and WebSocket API. */
|
|
38
|
+
export declare const ROOT_API_PREFIX = "/v1";
|
|
37
39
|
/**
|
|
38
40
|
* Map a canonical, root-relative server path to its external (`/api`-prefixed)
|
|
39
41
|
* form for emission in specs and discovery documents.
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import type { ServeOptions } from '../index.ts';
|
|
2
2
|
import type { InflightRecord, TaskRequeueReason } from '../task-state.ts';
|
|
3
3
|
import type { ServerContext } from './context.ts';
|
|
4
|
+
interface ManualTaskReconciliationForTesting {
|
|
5
|
+
readonly options: ServeOptions;
|
|
6
|
+
scanAt(operationId: string, trackedDeadline: number, now: number): Promise<void>;
|
|
7
|
+
}
|
|
8
|
+
/** @internal Restricts manual reconciliation to explicitly marked test options. */
|
|
9
|
+
export declare function useManualTaskReconciliationForTesting(options: ServeOptions): ManualTaskReconciliationForTesting;
|
|
10
|
+
/** @internal Installs the narrow one-shot test controller before a server starts. */
|
|
11
|
+
export declare function consumeManualTaskReconciliationForTesting(options: ServeOptions, context: ServerContext, cleanupWorkflowIndex: (operationId: string) => void): boolean;
|
|
4
12
|
/**
|
|
5
13
|
* Given a persisted inflight record, either permanently fail the task (if
|
|
6
14
|
* retry attempts are exhausted) or transition it back to queued and
|
|
@@ -13,5 +21,6 @@ export declare function reassignOrExpireTask(context: ServerContext, options: Se
|
|
|
13
21
|
* their tasks. Only touches storage for the specific operations whose
|
|
14
22
|
* deadlines have actually passed — no full `op:inflight:*` scan.
|
|
15
23
|
*/
|
|
16
|
-
export declare function scanExpiredTasks(context: ServerContext, options: ServeOptions, cleanupWorkflowIndex: (operationId: string) => void): Promise<void>;
|
|
24
|
+
export declare function scanExpiredTasks(context: ServerContext, options: ServeOptions, cleanupWorkflowIndex: (operationId: string) => void, now?: number): Promise<void>;
|
|
17
25
|
export declare function reconcileOrphanedRecords(context: ServerContext, options: ServeOptions, cleanupWorkflowIndex: (operationId: string) => void): Promise<void>;
|
|
26
|
+
export {};
|
|
@@ -17,6 +17,30 @@ import {
|
|
|
17
17
|
recordWorkerCapacitySaturationMetric
|
|
18
18
|
} from "./task-metrics.js";
|
|
19
19
|
import { isInflightRecord } from "./websocket-worker.js";
|
|
20
|
+
const manualTaskReconciliationRegistrations = new WeakMap;
|
|
21
|
+
export function useManualTaskReconciliationForTesting(options) {
|
|
22
|
+
const registration = {};
|
|
23
|
+
manualTaskReconciliationRegistrations.set(options, registration);
|
|
24
|
+
return {
|
|
25
|
+
options,
|
|
26
|
+
scanAt(operationId, trackedDeadline, now) {
|
|
27
|
+
if (registration.scanAt === void 0)
|
|
28
|
+
throw Error("Manual task reconciliation requires a running test server");
|
|
29
|
+
return registration.scanAt(operationId, trackedDeadline, now);
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
export function consumeManualTaskReconciliationForTesting(options, context, cleanupWorkflowIndex) {
|
|
34
|
+
const registration = manualTaskReconciliationRegistrations.get(options);
|
|
35
|
+
manualTaskReconciliationRegistrations.delete(options);
|
|
36
|
+
if (registration === void 0)
|
|
37
|
+
return !1;
|
|
38
|
+
registration.scanAt = async (operationId, trackedDeadline, now) => {
|
|
39
|
+
context.deadlineTracker.add({ operationId, deadline: trackedDeadline });
|
|
40
|
+
await scanExpiredTasks(context, options, cleanupWorkflowIndex, now);
|
|
41
|
+
};
|
|
42
|
+
return !0;
|
|
43
|
+
}
|
|
20
44
|
export async function reassignOrExpireTask(context, options, operationId, record, reason = "visibility-timeout") {
|
|
21
45
|
const nextAttempt = (record.attempt ?? 1) + 1, policy = record.retryPolicy, nextRetryCount = Math.max(record.retryCount ?? 0, nextAttempt - 1);
|
|
22
46
|
if (hasExceededMaxAttempts(policy, nextAttempt)) {
|
|
@@ -82,12 +106,12 @@ function scheduleTaskRedispatch(context, options, taskDispatch, policy) {
|
|
|
82
106
|
} else
|
|
83
107
|
dispatchTaskImpl(context, options, taskDispatch).catch((err) => console.error(`[weft] Redispatch failed for "${taskDispatch.operationId}":`, err));
|
|
84
108
|
}
|
|
85
|
-
export async function scanExpiredTasks(context, options, cleanupWorkflowIndex) {
|
|
109
|
+
export async function scanExpiredTasks(context, options, cleanupWorkflowIndex, now = Date.now()) {
|
|
86
110
|
if (context.scanRunning)
|
|
87
111
|
return;
|
|
88
112
|
context.scanRunning = !0;
|
|
89
113
|
try {
|
|
90
|
-
const
|
|
114
|
+
const expired = context.deadlineTracker.drainExpired(now);
|
|
91
115
|
for (const { operationId, deadline } of expired) {
|
|
92
116
|
if (context.processingOperations.has(operationId)) {
|
|
93
117
|
context.deadlineTracker.add({ operationId, deadline });
|
|
@@ -25,7 +25,11 @@ import {
|
|
|
25
25
|
registerWorkflowEventLifecycle
|
|
26
26
|
} from "./runtime/event-broadcasting.js";
|
|
27
27
|
import { shutdownAllWorkers } from "./runtime/shutdown.js";
|
|
28
|
-
import {
|
|
28
|
+
import {
|
|
29
|
+
consumeManualTaskReconciliationForTesting as consumeManual,
|
|
30
|
+
reconcileOrphanedRecords,
|
|
31
|
+
scanExpiredTasks
|
|
32
|
+
} from "./runtime/task-reconciliation.js";
|
|
29
33
|
import { DEFAULT_MAX_STREAM_CONNECTIONS_PER_WORKFLOW } from "./runtime/websocket-stream.js";
|
|
30
34
|
import { isInflightRecord, withRetry } from "./runtime/websocket-worker.js";
|
|
31
35
|
import { TaskQueue } from "./task-queue.js";
|
|
@@ -166,14 +170,16 @@ export function registerStackDisposers(stack, context, options, broadcastingHand
|
|
|
166
170
|
stack.defer(() => context.mcpSessionManager[Symbol.asyncDispose]());
|
|
167
171
|
stack.defer(registerWorkflowEventLifecycle(options.engine, context, broadcastingHandle));
|
|
168
172
|
stack.defer(() => shutdownAllWorkers(context, options.workerShutdownTimeoutMs === void 0 ? void 0 : { timeoutMs: options.workerShutdownTimeoutMs, stopWaitingWhenIdle: !0 }));
|
|
169
|
-
const visibilityPollHandle = setInterval(() => {
|
|
173
|
+
const schedulesTaskReconciliation = !consumeManual(options, context, onOperationCleanup), visibilityPollHandle = schedulesTaskReconciliation ? setInterval(() => {
|
|
170
174
|
scanExpiredTasks(context, options, onOperationCleanup);
|
|
171
|
-
}, context.visibilityPollMs), reconciliationIntervalMs = context.visibilityPollMs * RECONCILIATION_MULTIPLIER, reconciliationHandle = setInterval(() => {
|
|
175
|
+
}, context.visibilityPollMs) : void 0, reconciliationIntervalMs = context.visibilityPollMs * RECONCILIATION_MULTIPLIER, reconciliationHandle = schedulesTaskReconciliation ? setInterval(() => {
|
|
172
176
|
reconcileOrphanedRecords(context, options, onOperationCleanup);
|
|
173
|
-
}, reconciliationIntervalMs);
|
|
177
|
+
}, reconciliationIntervalMs) : void 0;
|
|
174
178
|
stack.defer(() => {
|
|
175
|
-
|
|
176
|
-
|
|
179
|
+
if (visibilityPollHandle !== void 0)
|
|
180
|
+
clearInterval(visibilityPollHandle);
|
|
181
|
+
if (reconciliationHandle !== void 0)
|
|
182
|
+
clearInterval(reconciliationHandle);
|
|
177
183
|
context.deadlineTracker.clear();
|
|
178
184
|
for (const timer of context.pendingTimers)
|
|
179
185
|
clearTimeout(timer);
|
|
@@ -74,6 +74,30 @@ function createCursorRequestAwaiter(request, transaction) {
|
|
|
74
74
|
});
|
|
75
75
|
};
|
|
76
76
|
}
|
|
77
|
+
async function* iterateCursor(database, keyRangeFactory, prefix, options, openCursor, project) {
|
|
78
|
+
const { limit, reverse } = options, prefixEnd = resolvePrefixRangeEnd(prefix), range = keyRangeFactory.bound(prefix, prefixEnd, !1, !0), direction = reverse ? "prev" : "next", transaction = database.transaction(STORE_NAME, "readonly"), store = transaction.objectStore(STORE_NAME), request = openCursor(store, range, direction), nextCursor = createCursorRequestAwaiter(request, transaction);
|
|
79
|
+
let count = 0, completed = !1;
|
|
80
|
+
try {
|
|
81
|
+
let cursor = await nextCursor();
|
|
82
|
+
while (cursor) {
|
|
83
|
+
if (limit !== void 0 && count >= limit)
|
|
84
|
+
break;
|
|
85
|
+
const key = cursor.key;
|
|
86
|
+
if (matchesScanOptions(key, options)) {
|
|
87
|
+
yield project(cursor);
|
|
88
|
+
count++;
|
|
89
|
+
}
|
|
90
|
+
cursor.continue();
|
|
91
|
+
cursor = await nextCursor();
|
|
92
|
+
}
|
|
93
|
+
completed = !0;
|
|
94
|
+
} finally {
|
|
95
|
+
if (!completed)
|
|
96
|
+
try {
|
|
97
|
+
transaction.abort();
|
|
98
|
+
} catch {}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
77
101
|
|
|
78
102
|
export class IndexedDBStorage {
|
|
79
103
|
#databaseName;
|
|
@@ -168,30 +192,8 @@ export class IndexedDBStorage {
|
|
|
168
192
|
});
|
|
169
193
|
}
|
|
170
194
|
async* scan(prefix, options = {}) {
|
|
171
|
-
const
|
|
172
|
-
|
|
173
|
-
const nextCursor = createCursorRequestAwaiter(request, transaction);
|
|
174
|
-
let completed = !1;
|
|
175
|
-
try {
|
|
176
|
-
let cursor = await nextCursor();
|
|
177
|
-
while (cursor) {
|
|
178
|
-
if (limit !== void 0 && count >= limit)
|
|
179
|
-
break;
|
|
180
|
-
const key = cursor.key;
|
|
181
|
-
if (matchesScanOptions(key, options)) {
|
|
182
|
-
yield [key, new Uint8Array(cursor.value)];
|
|
183
|
-
count++;
|
|
184
|
-
}
|
|
185
|
-
cursor.continue();
|
|
186
|
-
cursor = await nextCursor();
|
|
187
|
-
}
|
|
188
|
-
completed = !0;
|
|
189
|
-
} finally {
|
|
190
|
-
if (!completed)
|
|
191
|
-
try {
|
|
192
|
-
transaction.abort();
|
|
193
|
-
} catch {}
|
|
194
|
-
}
|
|
195
|
+
const database = await this.#databasePromise;
|
|
196
|
+
yield* iterateCursor(database, this.#runtime.IDBKeyRange, prefix, options, (store, range, direction) => store.openCursor(range, direction), (cursor) => [cursor.key, new Uint8Array(cursor.value)]);
|
|
195
197
|
}
|
|
196
198
|
async batch(operations) {
|
|
197
199
|
assertStorageBatchOperationCount("batch operations", operations.length);
|
|
@@ -270,30 +272,8 @@ export class IndexedDBStorage {
|
|
|
270
272
|
});
|
|
271
273
|
}
|
|
272
274
|
async* keys(prefix, options = {}) {
|
|
273
|
-
const
|
|
274
|
-
|
|
275
|
-
const nextCursor = createCursorRequestAwaiter(request, transaction);
|
|
276
|
-
let completed = !1;
|
|
277
|
-
try {
|
|
278
|
-
let cursor = await nextCursor();
|
|
279
|
-
while (cursor) {
|
|
280
|
-
if (limit !== void 0 && count >= limit)
|
|
281
|
-
break;
|
|
282
|
-
const key = cursor.key;
|
|
283
|
-
if (matchesScanOptions(key, options)) {
|
|
284
|
-
yield key;
|
|
285
|
-
count++;
|
|
286
|
-
}
|
|
287
|
-
cursor.continue();
|
|
288
|
-
cursor = await nextCursor();
|
|
289
|
-
}
|
|
290
|
-
completed = !0;
|
|
291
|
-
} finally {
|
|
292
|
-
if (!completed)
|
|
293
|
-
try {
|
|
294
|
-
transaction.abort();
|
|
295
|
-
} catch {}
|
|
296
|
-
}
|
|
275
|
+
const database = await this.#databasePromise;
|
|
276
|
+
yield* iterateCursor(database, this.#runtime.IDBKeyRange, prefix, options, (store, range, direction) => store.openKeyCursor(range, direction), (cursor) => cursor.key);
|
|
297
277
|
}
|
|
298
278
|
async count(prefix) {
|
|
299
279
|
const database = await this.#databasePromise, prefixEnd = resolvePrefixRangeEnd(prefix), store = database.transaction(STORE_NAME, "readonly").objectStore(STORE_NAME);
|
|
@@ -70,6 +70,8 @@ export type ConcurrentConditionalBatchConformanceOptions = {
|
|
|
70
70
|
export type BinaryAndLargeScanConformanceOptions = {
|
|
71
71
|
/** Construct a fresh, empty adapter for each conformance case. */
|
|
72
72
|
readonly create: () => Storage | Promise<Storage>;
|
|
73
|
+
/** Optional timeout for adapters whose local large-scan test needs more time. */
|
|
74
|
+
readonly largeScanTimeoutMs?: number;
|
|
73
75
|
};
|
|
74
76
|
/**
|
|
75
77
|
* Construct a fresh, empty adapter for each basic-contract case.
|
|
@@ -151,9 +153,10 @@ export declare function runStorageCapabilityConformance(name: string, options: C
|
|
|
151
153
|
*/
|
|
152
154
|
export declare function runConcurrentConditionalBatchConformance(name: string, options: ConcurrentConditionalBatchConformanceOptions): void;
|
|
153
155
|
/**
|
|
154
|
-
* Register the basic key/value and scan contract that every storage
|
|
155
|
-
* must satisfy: get, put, overwrite, delete
|
|
156
|
-
*
|
|
156
|
+
* Register the complete basic key/value and scan contract that every storage
|
|
157
|
+
* adapter must satisfy: get, put, overwrite, delete (including missing keys),
|
|
158
|
+
* prefix scans, limits, reverse ordering, exclusive and inclusive range
|
|
159
|
+
* bounds, no-match scans, empty-prefix scans, and put/delete batches.
|
|
157
160
|
*
|
|
158
161
|
* @example
|
|
159
162
|
* ```ts
|