@lostgradient/weft 0.19.0 → 0.21.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 +2 -2
- package/dist/cli/generated/operation-catalog.snapshot.json +1334 -0
- package/dist/cli/generated/operation-client.generated.d.ts +9 -2
- package/dist/cli/generated/operation-client.generated.js +2 -0
- package/dist/core/engine/activity-reconciliation.d.ts +2 -2
- package/dist/core/engine/activity-reconciliation.js +12 -8
- package/dist/core/engine/async-activity-completion.js +12 -4
- package/dist/core/engine/async-activity-records.d.ts +11 -1
- package/dist/core/engine/async-activity-records.js +4 -3
- package/dist/core/engine/attributes-tags.d.ts +11 -1
- package/dist/core/engine/attributes-tags.js +4 -3
- package/dist/core/engine/bulk-operations-purge.js +5 -2
- package/dist/core/engine/bulk-operations.js +17 -5
- package/dist/core/engine/callback-creators-bundles.js +1 -1
- package/dist/core/engine/callback-creators-core.js +4 -2
- package/dist/core/engine/checkpoint-io.js +1 -1
- package/dist/core/engine/child-workflow.js +2 -1
- package/dist/core/engine/completed-review-storage.js +1 -1
- package/dist/core/engine/condition-waiters.d.ts +45 -3
- package/dist/core/engine/condition-waiters.js +12 -3
- package/dist/core/engine/disposal.js +6 -0
- package/dist/core/engine/engine-internal-types.d.ts +12 -4
- package/dist/core/engine/fenced-write.d.ts +46 -15
- package/dist/core/engine/fenced-write.js +39 -6
- package/dist/core/engine/finalizer-state.d.ts +3 -1
- package/dist/core/engine/handle-result.d.ts +49 -1
- package/dist/core/engine/handle-result.js +95 -20
- package/dist/core/engine/index.d.ts +13 -5
- package/dist/core/engine/index.js +155 -5
- package/dist/core/engine/inline-launch-queue.js +9 -0
- package/dist/core/engine/internals.d.ts +73 -0
- package/dist/core/engine/invoke-update-handler.d.ts +19 -0
- package/dist/core/engine/invoke-update-handler.js +7 -0
- package/dist/core/engine/lease-deposition.d.ts +132 -0
- package/dist/core/engine/lease-deposition.js +31 -0
- package/dist/core/engine/lease-errors.d.ts +80 -9
- package/dist/core/engine/lease-errors.js +28 -2
- package/dist/core/engine/lifecycle/resume.js +3 -1
- package/dist/core/engine/lifecycle/standalone-claim-acquire.d.ts +33 -0
- package/dist/core/engine/lifecycle/standalone-claim-acquire.js +25 -0
- package/dist/core/engine/lifecycle/start-commit.js +20 -6
- package/dist/core/engine/lifecycle/transition.d.ts +15 -1
- package/dist/core/engine/lifecycle/transition.js +6 -3
- package/dist/core/engine/operations-activity.js +1 -1
- package/dist/core/engine/operations-time.js +21 -7
- package/dist/core/engine/owner-side-signal-poll.d.ts +132 -0
- package/dist/core/engine/owner-side-signal-poll.js +22 -0
- package/dist/core/engine/owner-side-update-poll.d.ts +116 -0
- package/dist/core/engine/owner-side-update-poll.js +22 -0
- package/dist/core/engine/ownership-bootstrap.d.ts +280 -0
- package/dist/core/engine/ownership-bootstrap.js +89 -0
- package/dist/core/engine/ownership-mode-marker.d.ts +82 -0
- package/dist/core/engine/ownership-mode-marker.js +52 -0
- package/dist/core/engine/ownership-options.d.ts +22 -6
- package/dist/core/engine/ownership-options.js +42 -12
- package/dist/core/engine/pending-updates.js +35 -24
- package/dist/core/engine/queries.d.ts +70 -0
- package/dist/core/engine/queries.js +58 -4
- package/dist/core/engine/schedules.js +1 -1
- package/dist/core/engine/signals.d.ts +11 -1
- package/dist/core/engine/signals.js +11 -7
- package/dist/core/engine/sleep-timer-acknowledgements.d.ts +68 -0
- package/dist/core/engine/sleep-timer-acknowledgements.js +19 -0
- package/dist/core/engine/storage-io.d.ts +58 -10
- package/dist/core/engine/storage-io.js +27 -9
- package/dist/core/engine/termination/cleanup.d.ts +5 -4
- package/dist/core/engine/termination/complete.js +23 -4
- package/dist/core/engine/termination/finalizer-claim.js +4 -4
- package/dist/core/engine/termination/state-commit-callbacks.d.ts +15 -0
- package/dist/core/engine/termination/state-commit-callbacks.js +0 -0
- package/dist/core/engine/termination/suspend.js +1 -1
- package/dist/core/engine/update-validation.d.ts +28 -0
- package/dist/core/engine/update-validation.js +37 -0
- package/dist/core/engine/updates.d.ts +17 -16
- package/dist/core/engine/updates.js +24 -47
- package/dist/core/engine/wake-ownership-check.d.ts +86 -0
- package/dist/core/engine/wake-ownership-check.js +19 -0
- package/dist/core/engine/wake-ownership-guard.d.ts +46 -0
- package/dist/core/engine/wake-ownership-guard.js +23 -0
- package/dist/core/engine/workflow-claim-codec.d.ts +64 -0
- package/dist/core/engine/workflow-claim-codec.js +44 -0
- package/dist/core/engine/workflow-claim-cooldown.d.ts +60 -0
- package/dist/core/engine/workflow-claim-cooldown.js +17 -0
- package/dist/core/engine/workflow-claim-fold.d.ts +82 -0
- package/dist/core/engine/workflow-claim-fold.js +53 -0
- package/dist/core/engine/workflow-claim-metrics.d.ts +131 -0
- package/dist/core/engine/workflow-claim-metrics.js +62 -0
- package/dist/core/engine/workflow-claim-reclaim-scan.d.ts +96 -0
- package/dist/core/engine/workflow-claim-reclaim-scan.js +66 -0
- package/dist/core/engine/workflow-claim-reclaim-target.d.ts +107 -0
- package/dist/core/engine/workflow-claim-reclaim-target.js +155 -0
- package/dist/core/engine/workflow-claim-registry.d.ts +227 -0
- package/dist/core/engine/workflow-claim-registry.js +198 -0
- package/dist/core/engine/workflow-claim-renewal-interval.d.ts +50 -0
- package/dist/core/engine/workflow-claim-renewal-interval.js +132 -0
- package/dist/core/engine/workflow-claim-renewal-subpasses.d.ts +265 -0
- package/dist/core/engine/workflow-claim-renewal-subpasses.js +104 -0
- package/dist/core/engine/workflow-claim-renewal-task.d.ts +159 -0
- package/dist/core/engine/workflow-claim-renewal-task.js +65 -0
- package/dist/core/engine/workflow-claim-transitions.d.ts +186 -0
- package/dist/core/engine/workflow-claim-transitions.js +120 -0
- package/dist/core/inline-execution-strategy.d.ts +20 -0
- package/dist/core/inline-execution-strategy.js +15 -4
- package/dist/core/scheduler/scheduler-class.js +3 -3
- package/dist/core/scheduler/timer-sources.d.ts +13 -0
- package/dist/core/scheduler/timer-sources.js +1 -1
- package/dist/core/types/options.d.ts +17 -1
- package/dist/core/weft-error.d.ts +1 -1
- package/dist/core/weft-error.js +2 -1
- package/dist/http.js +2 -2
- package/dist/index.d.ts +2 -1
- package/dist/index.js +8 -0
- package/dist/indexeddb.js +1 -1
- package/dist/json-schema.js +3 -3
- package/dist/observability/index.js +2 -2
- package/dist/server/operations/get-task-detail-schema.d.ts +341 -0
- package/dist/server/operations/get-task-detail-schema.js +118 -0
- package/dist/server/operations/get-task-detail.d.ts +346 -0
- package/dist/server/operations/get-task-detail.js +215 -0
- package/dist/server/operations/static-registrations.js +3 -0
- package/dist/storage/auto.js +1 -1
- package/dist/storage/bun-sql.js +113 -0
- package/dist/storage/compressed-storage.js +1 -1
- package/dist/storage/index.d.ts +38 -35
- package/dist/storage/interface.d.ts +87 -125
- package/dist/storage/interface.js +1 -1
- package/dist/storage/key-encoding.d.ts +51 -0
- package/dist/storage/key-encoding.js +13 -0
- package/dist/storage/key-prefixes.d.ts +1 -1
- package/dist/storage/key-prefixes.js +3 -0
- package/dist/storage/lmdb.js +1 -1
- package/dist/storage/memory.js +1 -1
- package/dist/storage/neon.js +2 -2
- package/dist/storage/node-sqlite.js +113 -0
- package/dist/storage/ownership-keys.d.ts +55 -0
- package/dist/storage/ownership-keys.js +6 -0
- package/dist/storage/postgres.js +2 -2
- 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 +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/protocol.js +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,346 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `weft.tasks.get` operation + REST binding (WFT-92).
|
|
3
|
+
*
|
|
4
|
+
* Reads the full durable ledger state for one `operationId` — the wire
|
|
5
|
+
* counterpart to `WeftServer.getTaskResult()`, which is same-process-only
|
|
6
|
+
* (`src/server/runtime/task-result-view.ts`). This operation exposes the
|
|
7
|
+
* complete dispatch envelope and current ledger state so an HTTP/JSON-RPC
|
|
8
|
+
* caller — an operator console, for instance — can render one task's
|
|
9
|
+
* authoritative state without reconstructing it from the bounded
|
|
10
|
+
* `weft.tasks.diagnostics` alerting shape, which deliberately collapses
|
|
11
|
+
* `leased`/`completing`/`cancelling` into one `inflight` value and carries
|
|
12
|
+
* no attempt identity, priority, headers, retry-availability, adoption, or
|
|
13
|
+
* retention evidence.
|
|
14
|
+
*
|
|
15
|
+
* **Excluded fields.** `attemptToken`, `workerSessionId`, and
|
|
16
|
+
* `executionIdentity` are never projected here, matching
|
|
17
|
+
* `TaskResultView`'s own documented exclusion list — they are worker
|
|
18
|
+
* ownership/session internals with no business being public. `headers`
|
|
19
|
+
* are summarized as key names only (`headerKeys`): interceptor headers can
|
|
20
|
+
* carry trace context or auth material, and this is a read surface, not a
|
|
21
|
+
* payload inspector. The task `input` value and a dead-lettered record's
|
|
22
|
+
* pending result `value` are omitted for the same "digest not value"
|
|
23
|
+
* reason `TaskResultView` omits a resolved result's value — the ledger
|
|
24
|
+
* proves which attempt won, it does not re-deliver payloads. `resultDigest`
|
|
25
|
+
* is only projected for `disposition: 'resolved'`: the `cancelled`
|
|
26
|
+
* (mid-attempt) and `retryExhausted` lineages store a synthetic
|
|
27
|
+
* `${disposition}:${operationId}:${attemptToken}` placeholder there instead
|
|
28
|
+
* of a real content hash (`task-ledger-transitions(-cancellation).ts`),
|
|
29
|
+
* which would otherwise leak the excluded `attemptToken` verbatim.
|
|
30
|
+
*
|
|
31
|
+
* **Read-only by design.** This issue deliberately does not add an HTTP
|
|
32
|
+
* path to `adoptTaskResultImpl`. WFT-24 describes adoption as "an explicit
|
|
33
|
+
* caller assertion" that a workflow incorporated a result — a browser
|
|
34
|
+
* operator clicking a button cannot honestly make that assertion. If an
|
|
35
|
+
* HTTP adoption path is ever wanted, it needs its own design discussion,
|
|
36
|
+
* not a bundled addition here.
|
|
37
|
+
*
|
|
38
|
+
* @module server/operations/get-task-detail
|
|
39
|
+
*/
|
|
40
|
+
import type { UnknownRestBinding } from '../rest-bindings.ts';
|
|
41
|
+
export { executionRequirementSchema, getTaskDetailOutputSchema, retryPolicySchema, type GetTaskDetailInput, type GetTaskDetailOutput, } from './get-task-detail-schema.ts';
|
|
42
|
+
export declare const getTaskDetailOperation: import("../operation-catalog.ts").OperationDefinition<{
|
|
43
|
+
operationId: string;
|
|
44
|
+
}, {
|
|
45
|
+
disposition: "resolved";
|
|
46
|
+
resultDigest: string;
|
|
47
|
+
resultStatus: "completed" | "failed";
|
|
48
|
+
state: "terminal";
|
|
49
|
+
terminalAt: number;
|
|
50
|
+
adopted: boolean;
|
|
51
|
+
operationId: string;
|
|
52
|
+
workflowType: string;
|
|
53
|
+
activityName: string;
|
|
54
|
+
queue: string;
|
|
55
|
+
headerKeys: string[];
|
|
56
|
+
visibilityTimeoutMilliseconds: number;
|
|
57
|
+
createdAt: number;
|
|
58
|
+
attempt: number;
|
|
59
|
+
error?: string | undefined;
|
|
60
|
+
adoptedAt?: number | undefined;
|
|
61
|
+
workflowId?: string | undefined;
|
|
62
|
+
workflowExecutionToken?: string | undefined;
|
|
63
|
+
priority?: number | undefined;
|
|
64
|
+
retryPolicy?: {
|
|
65
|
+
maxAttempts: number;
|
|
66
|
+
initialBackoff: string | number;
|
|
67
|
+
backoffMultiplier: number;
|
|
68
|
+
maxBackoff: string | number;
|
|
69
|
+
nonRetryableErrors?: string[] | undefined;
|
|
70
|
+
} | undefined;
|
|
71
|
+
scheduleToCloseDeadline?: number | undefined;
|
|
72
|
+
executionRequirement?: {
|
|
73
|
+
deploymentName?: string | undefined;
|
|
74
|
+
buildId?: string | undefined;
|
|
75
|
+
artifactDigest?: string | undefined;
|
|
76
|
+
workflowRevision?: string | undefined;
|
|
77
|
+
activityContractHash?: string | undefined;
|
|
78
|
+
} | undefined;
|
|
79
|
+
fairShareKey?: string | undefined;
|
|
80
|
+
stickyWorkflowId?: string | undefined;
|
|
81
|
+
} | {
|
|
82
|
+
disposition: "cancelled";
|
|
83
|
+
cancellationReason: string;
|
|
84
|
+
state: "terminal";
|
|
85
|
+
terminalAt: number;
|
|
86
|
+
adopted: boolean;
|
|
87
|
+
operationId: string;
|
|
88
|
+
workflowType: string;
|
|
89
|
+
activityName: string;
|
|
90
|
+
queue: string;
|
|
91
|
+
headerKeys: string[];
|
|
92
|
+
visibilityTimeoutMilliseconds: number;
|
|
93
|
+
createdAt: number;
|
|
94
|
+
attempt: number;
|
|
95
|
+
adoptedAt?: number | undefined;
|
|
96
|
+
workflowId?: string | undefined;
|
|
97
|
+
workflowExecutionToken?: string | undefined;
|
|
98
|
+
priority?: number | undefined;
|
|
99
|
+
retryPolicy?: {
|
|
100
|
+
maxAttempts: number;
|
|
101
|
+
initialBackoff: string | number;
|
|
102
|
+
backoffMultiplier: number;
|
|
103
|
+
maxBackoff: string | number;
|
|
104
|
+
nonRetryableErrors?: string[] | undefined;
|
|
105
|
+
} | undefined;
|
|
106
|
+
scheduleToCloseDeadline?: number | undefined;
|
|
107
|
+
executionRequirement?: {
|
|
108
|
+
deploymentName?: string | undefined;
|
|
109
|
+
buildId?: string | undefined;
|
|
110
|
+
artifactDigest?: string | undefined;
|
|
111
|
+
workflowRevision?: string | undefined;
|
|
112
|
+
activityContractHash?: string | undefined;
|
|
113
|
+
} | undefined;
|
|
114
|
+
fairShareKey?: string | undefined;
|
|
115
|
+
stickyWorkflowId?: string | undefined;
|
|
116
|
+
} | {
|
|
117
|
+
disposition: "retryExhausted";
|
|
118
|
+
error: string;
|
|
119
|
+
state: "terminal";
|
|
120
|
+
terminalAt: number;
|
|
121
|
+
adopted: boolean;
|
|
122
|
+
operationId: string;
|
|
123
|
+
workflowType: string;
|
|
124
|
+
activityName: string;
|
|
125
|
+
queue: string;
|
|
126
|
+
headerKeys: string[];
|
|
127
|
+
visibilityTimeoutMilliseconds: number;
|
|
128
|
+
createdAt: number;
|
|
129
|
+
attempt: number;
|
|
130
|
+
adoptedAt?: number | undefined;
|
|
131
|
+
workflowId?: string | undefined;
|
|
132
|
+
workflowExecutionToken?: string | undefined;
|
|
133
|
+
priority?: number | undefined;
|
|
134
|
+
retryPolicy?: {
|
|
135
|
+
maxAttempts: number;
|
|
136
|
+
initialBackoff: string | number;
|
|
137
|
+
backoffMultiplier: number;
|
|
138
|
+
maxBackoff: string | number;
|
|
139
|
+
nonRetryableErrors?: string[] | undefined;
|
|
140
|
+
} | undefined;
|
|
141
|
+
scheduleToCloseDeadline?: number | undefined;
|
|
142
|
+
executionRequirement?: {
|
|
143
|
+
deploymentName?: string | undefined;
|
|
144
|
+
buildId?: string | undefined;
|
|
145
|
+
artifactDigest?: string | undefined;
|
|
146
|
+
workflowRevision?: string | undefined;
|
|
147
|
+
activityContractHash?: string | undefined;
|
|
148
|
+
} | undefined;
|
|
149
|
+
fairShareKey?: string | undefined;
|
|
150
|
+
stickyWorkflowId?: string | undefined;
|
|
151
|
+
} | {
|
|
152
|
+
state: "queued";
|
|
153
|
+
availableAt: number;
|
|
154
|
+
firstQueuedAt: number;
|
|
155
|
+
lastQueuedAt: number;
|
|
156
|
+
retryCount: number;
|
|
157
|
+
requeueCount: number;
|
|
158
|
+
operationId: string;
|
|
159
|
+
workflowType: string;
|
|
160
|
+
activityName: string;
|
|
161
|
+
queue: string;
|
|
162
|
+
headerKeys: string[];
|
|
163
|
+
visibilityTimeoutMilliseconds: number;
|
|
164
|
+
createdAt: number;
|
|
165
|
+
attempt: number;
|
|
166
|
+
lastDispatchedAt?: number | undefined;
|
|
167
|
+
startedAt?: number | undefined;
|
|
168
|
+
lastRequeueReason?: string | undefined;
|
|
169
|
+
workflowId?: string | undefined;
|
|
170
|
+
workflowExecutionToken?: string | undefined;
|
|
171
|
+
priority?: number | undefined;
|
|
172
|
+
retryPolicy?: {
|
|
173
|
+
maxAttempts: number;
|
|
174
|
+
initialBackoff: string | number;
|
|
175
|
+
backoffMultiplier: number;
|
|
176
|
+
maxBackoff: string | number;
|
|
177
|
+
nonRetryableErrors?: string[] | undefined;
|
|
178
|
+
} | undefined;
|
|
179
|
+
scheduleToCloseDeadline?: number | undefined;
|
|
180
|
+
executionRequirement?: {
|
|
181
|
+
deploymentName?: string | undefined;
|
|
182
|
+
buildId?: string | undefined;
|
|
183
|
+
artifactDigest?: string | undefined;
|
|
184
|
+
workflowRevision?: string | undefined;
|
|
185
|
+
activityContractHash?: string | undefined;
|
|
186
|
+
} | undefined;
|
|
187
|
+
fairShareKey?: string | undefined;
|
|
188
|
+
stickyWorkflowId?: string | undefined;
|
|
189
|
+
} | {
|
|
190
|
+
leaseDeadline: number;
|
|
191
|
+
firstQueuedAt: number;
|
|
192
|
+
lastQueuedAt: number;
|
|
193
|
+
startedAt: number;
|
|
194
|
+
lastHeartbeatAt: number;
|
|
195
|
+
state: "leased";
|
|
196
|
+
retryCount: number;
|
|
197
|
+
requeueCount: number;
|
|
198
|
+
operationId: string;
|
|
199
|
+
workflowType: string;
|
|
200
|
+
activityName: string;
|
|
201
|
+
queue: string;
|
|
202
|
+
headerKeys: string[];
|
|
203
|
+
visibilityTimeoutMilliseconds: number;
|
|
204
|
+
createdAt: number;
|
|
205
|
+
attempt: number;
|
|
206
|
+
lastRequeueReason?: string | undefined;
|
|
207
|
+
workflowId?: string | undefined;
|
|
208
|
+
workflowExecutionToken?: string | undefined;
|
|
209
|
+
priority?: number | undefined;
|
|
210
|
+
retryPolicy?: {
|
|
211
|
+
maxAttempts: number;
|
|
212
|
+
initialBackoff: string | number;
|
|
213
|
+
backoffMultiplier: number;
|
|
214
|
+
maxBackoff: string | number;
|
|
215
|
+
nonRetryableErrors?: string[] | undefined;
|
|
216
|
+
} | undefined;
|
|
217
|
+
scheduleToCloseDeadline?: number | undefined;
|
|
218
|
+
executionRequirement?: {
|
|
219
|
+
deploymentName?: string | undefined;
|
|
220
|
+
buildId?: string | undefined;
|
|
221
|
+
artifactDigest?: string | undefined;
|
|
222
|
+
workflowRevision?: string | undefined;
|
|
223
|
+
activityContractHash?: string | undefined;
|
|
224
|
+
} | undefined;
|
|
225
|
+
fairShareKey?: string | undefined;
|
|
226
|
+
stickyWorkflowId?: string | undefined;
|
|
227
|
+
} | {
|
|
228
|
+
pendingStatus: "completed" | "failed";
|
|
229
|
+
resultDigest: string;
|
|
230
|
+
leaseDeadline: number;
|
|
231
|
+
firstQueuedAt: number;
|
|
232
|
+
lastQueuedAt: number;
|
|
233
|
+
startedAt: number;
|
|
234
|
+
lastHeartbeatAt: number;
|
|
235
|
+
state: "completing";
|
|
236
|
+
retryCount: number;
|
|
237
|
+
requeueCount: number;
|
|
238
|
+
operationId: string;
|
|
239
|
+
workflowType: string;
|
|
240
|
+
activityName: string;
|
|
241
|
+
queue: string;
|
|
242
|
+
headerKeys: string[];
|
|
243
|
+
visibilityTimeoutMilliseconds: number;
|
|
244
|
+
createdAt: number;
|
|
245
|
+
attempt: number;
|
|
246
|
+
lastRequeueReason?: string | undefined;
|
|
247
|
+
workflowId?: string | undefined;
|
|
248
|
+
workflowExecutionToken?: string | undefined;
|
|
249
|
+
priority?: number | undefined;
|
|
250
|
+
retryPolicy?: {
|
|
251
|
+
maxAttempts: number;
|
|
252
|
+
initialBackoff: string | number;
|
|
253
|
+
backoffMultiplier: number;
|
|
254
|
+
maxBackoff: string | number;
|
|
255
|
+
nonRetryableErrors?: string[] | undefined;
|
|
256
|
+
} | undefined;
|
|
257
|
+
scheduleToCloseDeadline?: number | undefined;
|
|
258
|
+
executionRequirement?: {
|
|
259
|
+
deploymentName?: string | undefined;
|
|
260
|
+
buildId?: string | undefined;
|
|
261
|
+
artifactDigest?: string | undefined;
|
|
262
|
+
workflowRevision?: string | undefined;
|
|
263
|
+
activityContractHash?: string | undefined;
|
|
264
|
+
} | undefined;
|
|
265
|
+
fairShareKey?: string | undefined;
|
|
266
|
+
stickyWorkflowId?: string | undefined;
|
|
267
|
+
} | {
|
|
268
|
+
cancellationReason: string;
|
|
269
|
+
cancellationRequestedAt: number;
|
|
270
|
+
leaseDeadline: number;
|
|
271
|
+
firstQueuedAt: number;
|
|
272
|
+
lastQueuedAt: number;
|
|
273
|
+
startedAt: number;
|
|
274
|
+
lastHeartbeatAt: number;
|
|
275
|
+
state: "cancelling";
|
|
276
|
+
retryCount: number;
|
|
277
|
+
requeueCount: number;
|
|
278
|
+
operationId: string;
|
|
279
|
+
workflowType: string;
|
|
280
|
+
activityName: string;
|
|
281
|
+
queue: string;
|
|
282
|
+
headerKeys: string[];
|
|
283
|
+
visibilityTimeoutMilliseconds: number;
|
|
284
|
+
createdAt: number;
|
|
285
|
+
attempt: number;
|
|
286
|
+
lastRequeueReason?: string | undefined;
|
|
287
|
+
workflowId?: string | undefined;
|
|
288
|
+
workflowExecutionToken?: string | undefined;
|
|
289
|
+
priority?: number | undefined;
|
|
290
|
+
retryPolicy?: {
|
|
291
|
+
maxAttempts: number;
|
|
292
|
+
initialBackoff: string | number;
|
|
293
|
+
backoffMultiplier: number;
|
|
294
|
+
maxBackoff: string | number;
|
|
295
|
+
nonRetryableErrors?: string[] | undefined;
|
|
296
|
+
} | undefined;
|
|
297
|
+
scheduleToCloseDeadline?: number | undefined;
|
|
298
|
+
executionRequirement?: {
|
|
299
|
+
deploymentName?: string | undefined;
|
|
300
|
+
buildId?: string | undefined;
|
|
301
|
+
artifactDigest?: string | undefined;
|
|
302
|
+
workflowRevision?: string | undefined;
|
|
303
|
+
activityContractHash?: string | undefined;
|
|
304
|
+
} | undefined;
|
|
305
|
+
fairShareKey?: string | undefined;
|
|
306
|
+
stickyWorkflowId?: string | undefined;
|
|
307
|
+
} | {
|
|
308
|
+
state: "deadLettered";
|
|
309
|
+
pendingStatus: "completed" | "failed";
|
|
310
|
+
resultDigest: string;
|
|
311
|
+
deadLetteredAt: number;
|
|
312
|
+
persistenceFailureReason: string;
|
|
313
|
+
retryCount: number;
|
|
314
|
+
requeueCount: number;
|
|
315
|
+
operationId: string;
|
|
316
|
+
workflowType: string;
|
|
317
|
+
activityName: string;
|
|
318
|
+
queue: string;
|
|
319
|
+
headerKeys: string[];
|
|
320
|
+
visibilityTimeoutMilliseconds: number;
|
|
321
|
+
createdAt: number;
|
|
322
|
+
attempt: number;
|
|
323
|
+
error?: string | undefined;
|
|
324
|
+
lastRequeueReason?: string | undefined;
|
|
325
|
+
workflowId?: string | undefined;
|
|
326
|
+
workflowExecutionToken?: string | undefined;
|
|
327
|
+
priority?: number | undefined;
|
|
328
|
+
retryPolicy?: {
|
|
329
|
+
maxAttempts: number;
|
|
330
|
+
initialBackoff: string | number;
|
|
331
|
+
backoffMultiplier: number;
|
|
332
|
+
maxBackoff: string | number;
|
|
333
|
+
nonRetryableErrors?: string[] | undefined;
|
|
334
|
+
} | undefined;
|
|
335
|
+
scheduleToCloseDeadline?: number | undefined;
|
|
336
|
+
executionRequirement?: {
|
|
337
|
+
deploymentName?: string | undefined;
|
|
338
|
+
buildId?: string | undefined;
|
|
339
|
+
artifactDigest?: string | undefined;
|
|
340
|
+
workflowRevision?: string | undefined;
|
|
341
|
+
activityContractHash?: string | undefined;
|
|
342
|
+
} | undefined;
|
|
343
|
+
fairShareKey?: string | undefined;
|
|
344
|
+
stickyWorkflowId?: string | undefined;
|
|
345
|
+
}, unknown>;
|
|
346
|
+
export declare const getTaskDetailRestBinding: UnknownRestBinding;
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
import { raiseFault } from "../operation-catalog/raise-fault.js";
|
|
2
|
+
import { defineOperation } from "../operation-registry.js";
|
|
3
|
+
import {
|
|
4
|
+
decodeRemoteTaskRecord,
|
|
5
|
+
taskLedgerKey
|
|
6
|
+
} from "../task-ledger.js";
|
|
7
|
+
import {
|
|
8
|
+
executionRequirementSchema,
|
|
9
|
+
getTaskDetailInput,
|
|
10
|
+
getTaskDetailOutputSchema,
|
|
11
|
+
retryPolicySchema
|
|
12
|
+
} from "./get-task-detail-schema.js";
|
|
13
|
+
export {
|
|
14
|
+
executionRequirementSchema,
|
|
15
|
+
getTaskDetailOutputSchema,
|
|
16
|
+
retryPolicySchema
|
|
17
|
+
} from "./get-task-detail-schema.js";
|
|
18
|
+
function projectRetryPolicy(retryPolicy) {
|
|
19
|
+
return {
|
|
20
|
+
maxAttempts: retryPolicy.maxAttempts,
|
|
21
|
+
initialBackoff: retryPolicy.initialBackoff,
|
|
22
|
+
backoffMultiplier: retryPolicy.backoffMultiplier,
|
|
23
|
+
maxBackoff: retryPolicy.maxBackoff,
|
|
24
|
+
...retryPolicy.nonRetryableErrors !== void 0 ? { nonRetryableErrors: retryPolicy.nonRetryableErrors } : {}
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
function projectExecutionRequirement(executionRequirement) {
|
|
28
|
+
return {
|
|
29
|
+
...executionRequirement.deploymentName !== void 0 ? { deploymentName: executionRequirement.deploymentName } : {},
|
|
30
|
+
...executionRequirement.buildId !== void 0 ? { buildId: executionRequirement.buildId } : {},
|
|
31
|
+
...executionRequirement.artifactDigest !== void 0 ? { artifactDigest: executionRequirement.artifactDigest } : {},
|
|
32
|
+
...executionRequirement.workflowRevision !== void 0 ? { workflowRevision: executionRequirement.workflowRevision } : {},
|
|
33
|
+
...executionRequirement.activityContractHash !== void 0 ? { activityContractHash: executionRequirement.activityContractHash } : {}
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
function baseEnvelopeFields(record) {
|
|
37
|
+
return {
|
|
38
|
+
operationId: record.operationId,
|
|
39
|
+
...record.workflowId !== void 0 ? { workflowId: record.workflowId } : {},
|
|
40
|
+
...record.workflowExecutionToken !== void 0 ? { workflowExecutionToken: record.workflowExecutionToken } : {},
|
|
41
|
+
workflowType: record.workflowType,
|
|
42
|
+
activityName: record.activityName,
|
|
43
|
+
queue: record.queue,
|
|
44
|
+
...record.priority !== void 0 ? { priority: record.priority } : {},
|
|
45
|
+
headerKeys: Object.keys(record.headers),
|
|
46
|
+
visibilityTimeoutMilliseconds: record.visibilityTimeoutMilliseconds,
|
|
47
|
+
...record.retryPolicy !== void 0 ? { retryPolicy: projectRetryPolicy(record.retryPolicy) } : {},
|
|
48
|
+
...record.scheduleToCloseDeadline !== void 0 ? { scheduleToCloseDeadline: record.scheduleToCloseDeadline } : {},
|
|
49
|
+
...record.executionRequirement !== void 0 ? { executionRequirement: projectExecutionRequirement(record.executionRequirement) } : {},
|
|
50
|
+
...record.fairShareKey !== void 0 ? { fairShareKey: record.fairShareKey } : {},
|
|
51
|
+
...record.stickyWorkflowId !== void 0 ? { stickyWorkflowId: record.stickyWorkflowId } : {},
|
|
52
|
+
createdAt: record.createdAt,
|
|
53
|
+
attempt: record.attempt
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
function attemptFields(record) {
|
|
57
|
+
return {
|
|
58
|
+
retryCount: record.retryCount,
|
|
59
|
+
requeueCount: record.requeueCount,
|
|
60
|
+
...record.lastRequeueReason !== void 0 ? { lastRequeueReason: record.lastRequeueReason } : {}
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
function leaseHolderFields(record) {
|
|
64
|
+
return {
|
|
65
|
+
leaseDeadline: record.leaseDeadline,
|
|
66
|
+
firstQueuedAt: record.firstQueuedAt,
|
|
67
|
+
lastQueuedAt: record.lastQueuedAt,
|
|
68
|
+
startedAt: record.startedAt,
|
|
69
|
+
lastHeartbeatAt: record.lastHeartbeatAt
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
function projectQueued(record) {
|
|
73
|
+
return {
|
|
74
|
+
...baseEnvelopeFields(record),
|
|
75
|
+
...attemptFields(record),
|
|
76
|
+
state: "queued",
|
|
77
|
+
availableAt: record.availableAt,
|
|
78
|
+
firstQueuedAt: record.firstQueuedAt,
|
|
79
|
+
lastQueuedAt: record.lastQueuedAt,
|
|
80
|
+
...record.lastDispatchedAt !== void 0 ? { lastDispatchedAt: record.lastDispatchedAt } : {},
|
|
81
|
+
...record.startedAt !== void 0 ? { startedAt: record.startedAt } : {}
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
function projectLeased(record) {
|
|
85
|
+
return {
|
|
86
|
+
...baseEnvelopeFields(record),
|
|
87
|
+
...attemptFields(record),
|
|
88
|
+
...leaseHolderFields(record),
|
|
89
|
+
state: "leased"
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
function projectCompleting(record) {
|
|
93
|
+
return {
|
|
94
|
+
...baseEnvelopeFields(record),
|
|
95
|
+
...attemptFields(record),
|
|
96
|
+
...leaseHolderFields(record),
|
|
97
|
+
state: "completing",
|
|
98
|
+
pendingStatus: record.pendingStatus,
|
|
99
|
+
resultDigest: record.pendingResultDigest
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
function projectCancelling(record) {
|
|
103
|
+
return {
|
|
104
|
+
...baseEnvelopeFields(record),
|
|
105
|
+
...attemptFields(record),
|
|
106
|
+
...leaseHolderFields(record),
|
|
107
|
+
state: "cancelling",
|
|
108
|
+
cancellationReason: record.cancellationReason,
|
|
109
|
+
cancellationRequestedAt: record.cancellationRequestedAt
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
function terminalDispositionFields(record) {
|
|
113
|
+
if (record.disposition === "resolved")
|
|
114
|
+
return {
|
|
115
|
+
disposition: "resolved",
|
|
116
|
+
resultDigest: record.resultDigest,
|
|
117
|
+
resultStatus: record.status,
|
|
118
|
+
...record.error !== void 0 ? { error: record.error } : {}
|
|
119
|
+
};
|
|
120
|
+
if (record.disposition === "cancelled")
|
|
121
|
+
return {
|
|
122
|
+
disposition: "cancelled",
|
|
123
|
+
cancellationReason: record.cancellationReason
|
|
124
|
+
};
|
|
125
|
+
return {
|
|
126
|
+
disposition: "retryExhausted",
|
|
127
|
+
error: record.error
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
function projectTerminal(record) {
|
|
131
|
+
return {
|
|
132
|
+
...baseEnvelopeFields(record),
|
|
133
|
+
state: "terminal",
|
|
134
|
+
terminalAt: record.terminalAt,
|
|
135
|
+
adopted: record.adopted,
|
|
136
|
+
...record.adoptedAt !== void 0 ? { adoptedAt: record.adoptedAt } : {},
|
|
137
|
+
...terminalDispositionFields(record)
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
function projectDeadLettered(record) {
|
|
141
|
+
return {
|
|
142
|
+
...baseEnvelopeFields(record),
|
|
143
|
+
...attemptFields(record),
|
|
144
|
+
state: "deadLettered",
|
|
145
|
+
pendingStatus: record.pendingStatus,
|
|
146
|
+
resultDigest: record.pendingResultDigest,
|
|
147
|
+
deadLetteredAt: record.deadLetteredAt,
|
|
148
|
+
persistenceFailureReason: record.persistenceFailureReason,
|
|
149
|
+
...record.error !== void 0 ? { error: record.error } : {}
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
function projectTaskDetail(record) {
|
|
153
|
+
switch (record.state) {
|
|
154
|
+
case "queued":
|
|
155
|
+
return projectQueued(record);
|
|
156
|
+
case "leased":
|
|
157
|
+
return projectLeased(record);
|
|
158
|
+
case "completing":
|
|
159
|
+
return projectCompleting(record);
|
|
160
|
+
case "cancelling":
|
|
161
|
+
return projectCancelling(record);
|
|
162
|
+
case "terminal":
|
|
163
|
+
return projectTerminal(record);
|
|
164
|
+
case "deadLettered":
|
|
165
|
+
return projectDeadLettered(record);
|
|
166
|
+
default:
|
|
167
|
+
return record;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
export const getTaskDetailOperation = defineOperation({
|
|
171
|
+
name: "weft.tasks.get",
|
|
172
|
+
mcpExposable: !1,
|
|
173
|
+
summary: "Get one task's full durable ledger state",
|
|
174
|
+
destructive: !1,
|
|
175
|
+
tags: ["Observability"],
|
|
176
|
+
inputSchema: getTaskDetailInput,
|
|
177
|
+
outputSchema: getTaskDetailOutputSchema,
|
|
178
|
+
access: {
|
|
179
|
+
kind: "scoped",
|
|
180
|
+
scopes: { kind: "anyOf", scopes: ["system:read"] }
|
|
181
|
+
},
|
|
182
|
+
producibleFaults: ["NotFound"],
|
|
183
|
+
discoverable: !0,
|
|
184
|
+
transports: { http: !0, jsonRpcHttp: !0, jsonRpcWebSocket: !0, jsonRpcStdio: !0 },
|
|
185
|
+
unknownKeyPolicy: { http: "strip", jsonRpc: "reject" },
|
|
186
|
+
invoke: async ({ input, engine }) => {
|
|
187
|
+
const raw = await engine.storage.get(taskLedgerKey(input.operationId));
|
|
188
|
+
if (raw === null)
|
|
189
|
+
raiseFault(getTaskDetailOperation, {
|
|
190
|
+
code: "NotFound",
|
|
191
|
+
message: `No task found for operation "${input.operationId}"`,
|
|
192
|
+
data: { resource: "task", identifier: input.operationId }
|
|
193
|
+
});
|
|
194
|
+
const decoded = decodeRemoteTaskRecord(raw);
|
|
195
|
+
if (decoded === null || decoded.operationId !== input.operationId)
|
|
196
|
+
raiseFault(getTaskDetailOperation, {
|
|
197
|
+
code: "EngineFailure",
|
|
198
|
+
message: `Task ledger record for operation "${input.operationId}" could not be decoded`,
|
|
199
|
+
data: {}
|
|
200
|
+
});
|
|
201
|
+
return projectTaskDetail(decoded);
|
|
202
|
+
}
|
|
203
|
+
}), getTaskDetailRestBinding = {
|
|
204
|
+
method: "GET",
|
|
205
|
+
path: "/v1/tasks/detail/:operationId",
|
|
206
|
+
pathParamNames: ["operationId"],
|
|
207
|
+
operationName: "weft.tasks.get",
|
|
208
|
+
inputSources: {
|
|
209
|
+
operationId: { kind: "path", pathParam: "operationId" }
|
|
210
|
+
},
|
|
211
|
+
extractInput: async (_request, pathParams) => ({
|
|
212
|
+
operationId: pathParams.operationId ?? ""
|
|
213
|
+
}),
|
|
214
|
+
success: { kind: "json", status: 200 }
|
|
215
|
+
};
|
|
@@ -41,6 +41,7 @@ import { getReviewOperation, getReviewRestBinding } from "./get-review.js";
|
|
|
41
41
|
import { getScheduleOperation, getScheduleRestBinding } from "./get-schedule.js";
|
|
42
42
|
import { getStreamChunksOperation, getStreamChunksRestBinding } from "./get-stream-chunks.js";
|
|
43
43
|
import { getSystemLeaseOperation, getSystemLeaseRestBinding } from "./get-system-lease.js";
|
|
44
|
+
import { getTaskDetailOperation, getTaskDetailRestBinding } from "./get-task-detail.js";
|
|
44
45
|
import {
|
|
45
46
|
clearTaskDeadLetterOperation,
|
|
46
47
|
clearTaskDeadLetterRestBinding,
|
|
@@ -170,6 +171,7 @@ export const STATIC_REST_BINDINGS = [
|
|
|
170
171
|
fleetEventsSseRestBinding,
|
|
171
172
|
getTaskDiagnosticsRestBinding,
|
|
172
173
|
clearTaskDeadLetterRestBinding,
|
|
174
|
+
getTaskDetailRestBinding,
|
|
173
175
|
listSchedulesRestBinding,
|
|
174
176
|
getScheduleRestBinding,
|
|
175
177
|
replayWorkflowRestBinding,
|
|
@@ -233,6 +235,7 @@ export const STATIC_REST_BINDINGS = [
|
|
|
233
235
|
workflowEventsSubscriptionOperation,
|
|
234
236
|
fleetEventsSubscriptionOperation,
|
|
235
237
|
clearTaskDeadLetterOperation,
|
|
238
|
+
getTaskDetailOperation,
|
|
236
239
|
listSchedulesOperation,
|
|
237
240
|
listAlertsOperation,
|
|
238
241
|
getPrincipalOperation,
|
package/dist/storage/auto.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
var
|
|
2
|
+
var K=import.meta.require;function X(z){return{hasBun:typeof z.Bun<"u",hasIndexedDB:typeof z.indexedDB<"u",hasNode:z.process!==void 0&&typeof z.process.versions?.node==="string",hasWebExtensionStorage:z.browser?.storage!==void 0||z.chrome?.storage!==void 0}}async function A(z){let{createHash:C}=await import("crypto"),J=z.process?.cwd?.()??"weft-default";return C("sha256").update(J).digest("hex").slice(0,16)}async function H(z){let[{mkdirSync:C},{tmpdir:J},j]=await Promise.all([import("fs"),import("os"),import("path")]),Z=z.process?.env?.WEFT_DEFAULT_STORAGE_PATH,q=Z!==void 0&&Z.length>0?Z:j.join(J(),"weft-default",`${await A(z)}.db`);return C(j.dirname(q),{recursive:!0}),q}function $(z,C){if(C==="Bun")return typeof z.Bun;if(C==="browser.storage")return typeof(z.browser?.storage??z.chrome?.storage);return typeof z.process}function Y(z,C){return import.meta.url.endsWith(".ts")?z:C}async function V(z){return await import(z)}function F(z){if(z.browser?.storage!==void 0)return z.browser;if(z.chrome?.storage!==void 0)return z.chrome;return{}}function P(z){let{indexedDB:C,IDBKeyRange:J}=z;if(C===void 0||J===void 0)throw Error("resolveDefaultStorage: IndexedDB resolution requires both indexedDB and IDBKeyRange.");return{indexedDB:C,IDBKeyRange:J}}function k(z){let C=typeof z.indexedDB,J=typeof z.IDBKeyRange;return`typeof indexedDB=${C}, typeof IDBKeyRange=${J}`}var Q=Y("./bun-sql.ts","./bun-sql.js"),U=Y("./node-sqlite.ts","./node-sqlite.js"),W=Y("./indexeddb.ts","./indexeddb.js"),B=Y("./web-extension.ts","./web-extension.js");async function w(z=globalThis){let C=X(z);if(C.hasBun){let{BunSQLiteStorage:J}=await V(Q);return new J(await H(z))}if(C.hasNode){let{NodeSQLiteStorage:J}=await V(U);return new J(await H(z))}if(C.hasWebExtensionStorage){let{WebExtensionStorage:J}=await V(B);return new J({},F(z))}if(C.hasIndexedDB){let{IndexedDBStorage:J}=await V(W);return new J("weft",P(z))}throw Error(`resolveDefaultStorage: requires Bun, Node, WebExtension storage, or IndexedDB. Detected: typeof Bun=${$(z,"Bun")}, typeof process=${$(z,"process")}, typeof browser.storage=${$(z,"browser.storage")}, ${k(z)}.`)}export{w as resolveDefaultStorage};
|