@trigger.dev/sdk 4.6.4 → 4.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commonjs/v3/ai.d.ts +5 -2
- package/dist/commonjs/v3/ai.js +189 -266
- package/dist/commonjs/v3/ai.js.map +1 -1
- package/dist/commonjs/v3/chat-client.js +7 -0
- package/dist/commonjs/v3/chat-client.js.map +1 -1
- package/dist/commonjs/v3/chat-server.d.ts +1 -0
- package/dist/commonjs/v3/chat-server.js +8 -0
- package/dist/commonjs/v3/chat-server.js.map +1 -1
- package/dist/commonjs/v3/chat.d.ts +28 -4
- package/dist/commonjs/v3/chat.js +41 -9
- package/dist/commonjs/v3/chat.js.map +1 -1
- package/dist/commonjs/v3/chatRouteWait.d.ts +21 -0
- package/dist/commonjs/v3/chatRouteWait.js +43 -0
- package/dist/commonjs/v3/chatRouteWait.js.map +1 -0
- package/dist/commonjs/v3/compactionResponse.js +5 -0
- package/dist/commonjs/v3/compactionResponse.js.map +1 -1
- package/dist/commonjs/v3/concurrency-shared.d.ts +13 -0
- package/dist/commonjs/v3/concurrency-shared.js +35 -0
- package/dist/commonjs/v3/concurrency-shared.js.map +1 -0
- package/dist/commonjs/v3/concurrencyLimits.d.ts +73 -0
- package/dist/commonjs/v3/concurrencyLimits.js +166 -0
- package/dist/commonjs/v3/concurrencyLimits.js.map +1 -0
- package/dist/commonjs/v3/index.d.ts +2 -1
- package/dist/commonjs/v3/index.js +3 -1
- package/dist/commonjs/v3/index.js.map +1 -1
- package/dist/commonjs/v3/managedChatResponse.d.ts +44 -0
- package/dist/commonjs/v3/managedChatResponse.js +233 -0
- package/dist/commonjs/v3/managedChatResponse.js.map +1 -0
- package/dist/commonjs/v3/queues.d.ts +31 -0
- package/dist/commonjs/v3/queues.js +31 -0
- package/dist/commonjs/v3/queues.js.map +1 -1
- package/dist/commonjs/v3/shared.d.ts +18 -1
- package/dist/commonjs/v3/shared.js +137 -47
- package/dist/commonjs/v3/shared.js.map +1 -1
- package/dist/commonjs/v3/steeringContext.d.ts +41 -0
- package/dist/commonjs/v3/steeringContext.js +118 -0
- package/dist/commonjs/v3/steeringContext.js.map +1 -0
- package/dist/commonjs/v3/transcriptStorage.d.ts +4 -1
- package/dist/commonjs/v3/transcriptStorage.js +51 -4
- package/dist/commonjs/v3/transcriptStorage.js.map +1 -1
- package/dist/commonjs/version.js +1 -1
- package/dist/esm/v3/ai.d.ts +5 -2
- package/dist/esm/v3/ai.js +189 -266
- package/dist/esm/v3/ai.js.map +1 -1
- package/dist/esm/v3/chat-client.js +7 -0
- package/dist/esm/v3/chat-client.js.map +1 -1
- package/dist/esm/v3/chat-server.d.ts +1 -0
- package/dist/esm/v3/chat-server.js +8 -0
- package/dist/esm/v3/chat-server.js.map +1 -1
- package/dist/esm/v3/chat.d.ts +28 -4
- package/dist/esm/v3/chat.js +41 -9
- package/dist/esm/v3/chat.js.map +1 -1
- package/dist/esm/v3/chatRouteWait.d.ts +21 -0
- package/dist/esm/v3/chatRouteWait.js +40 -0
- package/dist/esm/v3/chatRouteWait.js.map +1 -0
- package/dist/esm/v3/compactionResponse.js +5 -0
- package/dist/esm/v3/compactionResponse.js.map +1 -1
- package/dist/esm/v3/concurrency-shared.d.ts +13 -0
- package/dist/esm/v3/concurrency-shared.js +31 -0
- package/dist/esm/v3/concurrency-shared.js.map +1 -0
- package/dist/esm/v3/concurrencyLimits.d.ts +73 -0
- package/dist/esm/v3/concurrencyLimits.js +158 -0
- package/dist/esm/v3/concurrencyLimits.js.map +1 -0
- package/dist/esm/v3/index.d.ts +2 -1
- package/dist/esm/v3/index.js +2 -1
- package/dist/esm/v3/index.js.map +1 -1
- package/dist/esm/v3/managedChatResponse.d.ts +44 -0
- package/dist/esm/v3/managedChatResponse.js +228 -0
- package/dist/esm/v3/managedChatResponse.js.map +1 -0
- package/dist/esm/v3/queues.d.ts +31 -0
- package/dist/esm/v3/queues.js +31 -0
- package/dist/esm/v3/queues.js.map +1 -1
- package/dist/esm/v3/shared.d.ts +18 -1
- package/dist/esm/v3/shared.js +136 -47
- package/dist/esm/v3/shared.js.map +1 -1
- package/dist/esm/v3/steeringContext.d.ts +41 -0
- package/dist/esm/v3/steeringContext.js +113 -0
- package/dist/esm/v3/steeringContext.js.map +1 -0
- package/dist/esm/v3/transcriptStorage.d.ts +4 -1
- package/dist/esm/v3/transcriptStorage.js +51 -4
- package/dist/esm/v3/transcriptStorage.js.map +1 -1
- package/dist/esm/version.js +1 -1
- package/docs/ai-chat/client-protocol.mdx +3 -1
- package/docs/ai-chat/error-handling.mdx +44 -76
- package/docs/ai-chat/fast-starts.mdx +1 -1
- package/docs/ai-chat/frontend.mdx +27 -21
- package/docs/ai-chat/patterns/branching-conversations.mdx +95 -230
- package/docs/ai-chat/patterns/human-in-the-loop.mdx +166 -164
- package/docs/ai-chat/patterns/tool-result-auditing.mdx +28 -27
- package/docs/ai-chat/patterns/version-upgrades.mdx +4 -4
- package/docs/ai-chat/pending-messages.mdx +19 -5
- package/docs/ai-chat/quick-start.mdx +26 -20
- package/docs/ai-chat/reference.mdx +21 -3
- package/docs/ai-chat/sessions.mdx +1 -1
- package/docs/ai-chat/testing.mdx +16 -4
- package/docs/concurrency.mdx +384 -0
- package/docs/config/config-file.mdx +2 -0
- package/docs/database-connections.mdx +3 -3
- package/docs/deploy-environment-variables.mdx +6 -0
- package/docs/deployment/atomic-deployment.mdx +416 -132
- package/docs/deployment/overview.mdx +2 -2
- package/docs/deployment/preview-branches.mdx +2 -2
- package/docs/github-actions.mdx +26 -16
- package/docs/github-integration.mdx +2 -2
- package/docs/idempotency.mdx +43 -5
- package/docs/introduction.mdx +1 -1
- package/docs/limits.mdx +16 -6
- package/docs/manual-setup.mdx +1 -1
- package/docs/observability/query.mdx +25 -0
- package/docs/queues.mdx +271 -0
- package/docs/reports.mdx +1 -1
- package/docs/runs/priority.mdx +2 -25
- package/docs/self-hosting/env/webapp.mdx +9 -0
- package/docs/self-hosting/kubernetes.mdx +14 -3
- package/docs/tasks/overview.mdx +3 -5
- package/docs/troubleshooting-alerts.mdx +124 -1
- package/docs/troubleshooting.mdx +12 -0
- package/docs/vercel-integration.mdx +6 -7
- package/docs/versioning.mdx +1 -1
- package/docs/writing-tasks-introduction.mdx +2 -1
- package/package.json +2 -2
- package/docs/deployment/version-skew-protection.mdx +0 -492
- package/docs/queue-concurrency.mdx +0 -358
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ManagedChatResponse = void 0;
|
|
4
|
+
exports.createOrderedChatWriter = createOrderedChatWriter;
|
|
5
|
+
const ai_runtime_js_1 = require("../imports/ai-runtime.js");
|
|
6
|
+
/** One ordered output channel for a turn's managed model and data chunks. */
|
|
7
|
+
class ManagedChatResponse {
|
|
8
|
+
publish;
|
|
9
|
+
controller;
|
|
10
|
+
completion;
|
|
11
|
+
failure;
|
|
12
|
+
closed = false;
|
|
13
|
+
chunks = [];
|
|
14
|
+
original;
|
|
15
|
+
fallbackId = (0, ai_runtime_js_1.generateId)();
|
|
16
|
+
completedSteps = 0;
|
|
17
|
+
dataBoundary = 0;
|
|
18
|
+
generationOffset = 0;
|
|
19
|
+
orderedSteps = true;
|
|
20
|
+
pendingData = [];
|
|
21
|
+
constructor(publish) {
|
|
22
|
+
this.publish = publish;
|
|
23
|
+
}
|
|
24
|
+
seed(messages) {
|
|
25
|
+
// Never mutate the caller's history while processing a continuation.
|
|
26
|
+
const last = messages?.at(-1);
|
|
27
|
+
this.original = last?.role === "assistant" ? structuredClone(last) : undefined;
|
|
28
|
+
}
|
|
29
|
+
get isClosed() {
|
|
30
|
+
return this.closed;
|
|
31
|
+
}
|
|
32
|
+
get revision() {
|
|
33
|
+
return this.chunks.length;
|
|
34
|
+
}
|
|
35
|
+
continues(id) {
|
|
36
|
+
return this.original?.id === id;
|
|
37
|
+
}
|
|
38
|
+
beginGeneration() {
|
|
39
|
+
this.generationOffset = this.completedSteps;
|
|
40
|
+
this.dataBoundary = this.completedSteps;
|
|
41
|
+
}
|
|
42
|
+
afterStep(completedSteps) {
|
|
43
|
+
this.dataBoundary = this.orderedSteps ? this.generationOffset + completedSteps : 0;
|
|
44
|
+
}
|
|
45
|
+
/** Raw pipes own their output ordering and do not feed this capture. */
|
|
46
|
+
useRawPipe() {
|
|
47
|
+
this.orderedSteps = false;
|
|
48
|
+
this.dataBoundary = 0;
|
|
49
|
+
this.flushPendingData();
|
|
50
|
+
}
|
|
51
|
+
flushPendingData() {
|
|
52
|
+
this.dataBoundary = this.completedSteps;
|
|
53
|
+
for (const next of this.pendingData.splice(0))
|
|
54
|
+
this.write(next.chunk, next.capture);
|
|
55
|
+
}
|
|
56
|
+
writeData(chunk) {
|
|
57
|
+
const capture = chunk.type.startsWith("data-") && !("transient" in chunk && chunk.transient);
|
|
58
|
+
if (this.closed)
|
|
59
|
+
throw new Error("The managed chat response is closed");
|
|
60
|
+
if (this.dataBoundary > this.completedSteps) {
|
|
61
|
+
this.pendingData.push({ chunk, capture, after: this.dataBoundary });
|
|
62
|
+
}
|
|
63
|
+
else
|
|
64
|
+
this.write(chunk, capture);
|
|
65
|
+
}
|
|
66
|
+
write(chunk, capture = true) {
|
|
67
|
+
if (this.closed)
|
|
68
|
+
throw new Error("The managed chat response is closed");
|
|
69
|
+
if (this.failure)
|
|
70
|
+
throw this.failure;
|
|
71
|
+
if (!this.controller) {
|
|
72
|
+
const stream = new ReadableStream({
|
|
73
|
+
start: (controller) => {
|
|
74
|
+
this.controller = controller;
|
|
75
|
+
},
|
|
76
|
+
});
|
|
77
|
+
this.completion = this.publish(stream);
|
|
78
|
+
// Transport errors are observed by pipe/close; never leave an unhandled
|
|
79
|
+
// rejection when a fire-and-forget custom write opened the response.
|
|
80
|
+
this.completion.catch((error) => {
|
|
81
|
+
this.failure = error;
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
if (capture)
|
|
85
|
+
this.chunks.push(chunk);
|
|
86
|
+
this.controller.enqueue(chunk);
|
|
87
|
+
if (capture && chunk.type === "finish-step") {
|
|
88
|
+
this.completedSteps++;
|
|
89
|
+
while (this.pendingData[0] && this.pendingData[0].after <= this.completedSteps) {
|
|
90
|
+
const next = this.pendingData.shift();
|
|
91
|
+
this.write(next.chunk, next.capture);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
async pipe(source, signal) {
|
|
96
|
+
const reader = source instanceof ReadableStream ? source.getReader() : undefined;
|
|
97
|
+
const iterator = reader
|
|
98
|
+
? undefined
|
|
99
|
+
: source[Symbol.asyncIterator]();
|
|
100
|
+
let rejectAbort;
|
|
101
|
+
const aborted = new Promise((_, reject) => {
|
|
102
|
+
rejectAbort = reject;
|
|
103
|
+
});
|
|
104
|
+
// A pre-aborted signal or a synchronously throwing iterator can leave this
|
|
105
|
+
// promise outside the read race; observe its rejection in either case.
|
|
106
|
+
aborted.catch(() => { });
|
|
107
|
+
const cancel = () => rejectAbort(signal?.reason);
|
|
108
|
+
signal?.addEventListener("abort", cancel, { once: true });
|
|
109
|
+
try {
|
|
110
|
+
while (true) {
|
|
111
|
+
signal?.throwIfAborted();
|
|
112
|
+
if (this.failure)
|
|
113
|
+
throw this.failure;
|
|
114
|
+
const next = reader ? reader.read() : iterator.next();
|
|
115
|
+
const result = signal ? await Promise.race([next, aborted]) : await next;
|
|
116
|
+
signal?.throwIfAborted();
|
|
117
|
+
if (result.done)
|
|
118
|
+
break;
|
|
119
|
+
this.write(result.value);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
finally {
|
|
123
|
+
signal?.removeEventListener("abort", cancel);
|
|
124
|
+
try {
|
|
125
|
+
if (signal?.aborted) {
|
|
126
|
+
// Async generators can queue return() behind a blocked next(). Stop
|
|
127
|
+
// the turn without waiting for provider cleanup, and observe failures.
|
|
128
|
+
try {
|
|
129
|
+
void Promise.resolve(reader ? reader.cancel(signal.reason) : iterator?.return?.()).catch(() => { });
|
|
130
|
+
}
|
|
131
|
+
catch {
|
|
132
|
+
// A synchronous cleanup failure must not replace the abort reason.
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
else if (iterator)
|
|
136
|
+
await iterator.return?.();
|
|
137
|
+
}
|
|
138
|
+
finally {
|
|
139
|
+
reader?.releaseLock();
|
|
140
|
+
// No further finish-step can arrive from this source. Preserve accepted
|
|
141
|
+
// data at the end of the available partial before callers snapshot it.
|
|
142
|
+
this.flushPendingData();
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
/** Native reduction of the exact admitted chunks, including same-ID updates. */
|
|
147
|
+
async snapshot(options) {
|
|
148
|
+
if (!this.chunks.length)
|
|
149
|
+
return options?.message;
|
|
150
|
+
const chunks = this.chunks.slice(options?.from ?? 0);
|
|
151
|
+
let message = options?.message;
|
|
152
|
+
const original = options?.message ?? this.original;
|
|
153
|
+
const stream = new ReadableStream({
|
|
154
|
+
start(controller) {
|
|
155
|
+
for (const chunk of chunks)
|
|
156
|
+
controller.enqueue(chunk);
|
|
157
|
+
controller.close();
|
|
158
|
+
},
|
|
159
|
+
});
|
|
160
|
+
for await (const update of (0, ai_runtime_js_1.readUIMessageStream)({
|
|
161
|
+
stream,
|
|
162
|
+
...(original ? { message: structuredClone(original) } : {}),
|
|
163
|
+
// An error chunk must leave previously streamed content recoverable.
|
|
164
|
+
terminateOnError: false,
|
|
165
|
+
}))
|
|
166
|
+
message = update;
|
|
167
|
+
return message ? { ...message, id: message.id || this.fallbackId } : undefined;
|
|
168
|
+
}
|
|
169
|
+
async close() {
|
|
170
|
+
if (!this.closed) {
|
|
171
|
+
this.flushPendingData();
|
|
172
|
+
// A data-only response still needs the same server ID on both sides.
|
|
173
|
+
if (!this.original &&
|
|
174
|
+
this.chunks.length &&
|
|
175
|
+
!this.chunks.some((chunk) => chunk.type === "start")) {
|
|
176
|
+
this.write({ type: "start", messageId: this.fallbackId });
|
|
177
|
+
}
|
|
178
|
+
this.closed = true;
|
|
179
|
+
this.controller?.close();
|
|
180
|
+
}
|
|
181
|
+
await this.completion;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
exports.ManagedChatResponse = ManagedChatResponse;
|
|
185
|
+
/** Hook streams share a publisher; only persistent data joins managed capture. */
|
|
186
|
+
function createOrderedChatWriter(activeResponse, publish) {
|
|
187
|
+
const raw = new ManagedChatResponse(publish);
|
|
188
|
+
const merging = [];
|
|
189
|
+
const writer = {
|
|
190
|
+
write(part) {
|
|
191
|
+
const managed = activeResponse();
|
|
192
|
+
if (managed)
|
|
193
|
+
managed.writeData(part);
|
|
194
|
+
else
|
|
195
|
+
raw.write(part, false);
|
|
196
|
+
},
|
|
197
|
+
merge(stream) {
|
|
198
|
+
const work = (async () => {
|
|
199
|
+
const reader = stream.getReader();
|
|
200
|
+
try {
|
|
201
|
+
while (true) {
|
|
202
|
+
const { done, value } = await reader.read();
|
|
203
|
+
if (done)
|
|
204
|
+
break;
|
|
205
|
+
writer.write(value);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
finally {
|
|
209
|
+
reader.releaseLock();
|
|
210
|
+
}
|
|
211
|
+
})();
|
|
212
|
+
work.catch(() => { });
|
|
213
|
+
merging.push(work);
|
|
214
|
+
},
|
|
215
|
+
};
|
|
216
|
+
return {
|
|
217
|
+
writer,
|
|
218
|
+
async flush() {
|
|
219
|
+
try {
|
|
220
|
+
let cursor = 0;
|
|
221
|
+
while (cursor < merging.length) {
|
|
222
|
+
const batch = merging.slice(cursor);
|
|
223
|
+
cursor = merging.length;
|
|
224
|
+
await Promise.all(batch);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
finally {
|
|
228
|
+
await raw.close();
|
|
229
|
+
}
|
|
230
|
+
},
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
//# sourceMappingURL=managedChatResponse.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"managedChatResponse.js","sourceRoot":"","sources":["../../../src/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,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QAC9B,CAAC;QACD,KAAK,CAAC,MAAsC;YAC1C,MAAM,IAAI,GAAG,CAAC,KAAK,IAAI,EAAE;gBACvB,MAAM,MAAM,GAAG,MAAM,CAAC,SAAS,EAAE,CAAC;gBAClC,IAAI,CAAC;oBACH,OAAO,IAAI,EAAE,CAAC;wBACZ,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,MAAM,MAAM,CAAC,IAAI,EAAE,CAAC;wBAC5C,IAAI,IAAI;4BAAE,MAAM;wBAChB,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;oBACtB,CAAC;gBACH,CAAC;wBAAS,CAAC;oBACT,MAAM,CAAC,WAAW,EAAE,CAAC;gBACvB,CAAC;YACH,CAAC,CAAC,EAAE,CAAC;YACL,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;YACrB,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACrB,CAAC;KACF,CAAC;IACF,OAAO;QACL,MAAM;QACN,KAAK,CAAC,KAAK;YACT,IAAI,CAAC;gBACH,IAAI,MAAM,GAAG,CAAC,CAAC;gBACf,OAAO,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;oBAC/B,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;oBACpC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;oBACxB,MAAM,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;gBAC3B,CAAC;YACH,CAAC;oBAAS,CAAC;gBACT,MAAM,GAAG,CAAC,KAAK,EAAE,CAAC;YACpB,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -47,6 +47,28 @@ export declare function pause(queue: RetrieveQueueParam, requestOptions?: ApiReq
|
|
|
47
47
|
/**
|
|
48
48
|
* Overrides the concurrency limit of a queue.
|
|
49
49
|
*
|
|
50
|
+
* @deprecated Queue-level concurrency is the legacy model: a modern queue is only the
|
|
51
|
+
* ordered line runs wait in, and concurrency is declared on the task and managed
|
|
52
|
+
* through `concurrencyLimits`. The server rejects this call for queues on the new
|
|
53
|
+
* model. Migrate by declaring the limit and overriding it by name:
|
|
54
|
+
*
|
|
55
|
+
* ```ts
|
|
56
|
+
* export const myTask = task({
|
|
57
|
+
* id: "my-task",
|
|
58
|
+
* concurrency: { total: 5 },
|
|
59
|
+
* run: async (payload) => {
|
|
60
|
+
* // ...
|
|
61
|
+
* },
|
|
62
|
+
* });
|
|
63
|
+
*
|
|
64
|
+
* await concurrencyLimits.override("task/my-task", { total: 10 });
|
|
65
|
+
* ```
|
|
66
|
+
*
|
|
67
|
+
* For workloads that pass a `concurrencyKey` at trigger time, declare `concurrency: { perKey: n }`
|
|
68
|
+
* instead (`total` caps all keys together). For a limit shared by several tasks, declare a named
|
|
69
|
+
* limit with `concurrencyLimit({ name, ... })`, making the same choice between `total` and
|
|
70
|
+
* `perKey`, pass it to each task's `concurrency` option, and override it by that name.
|
|
71
|
+
*
|
|
50
72
|
* @param queue - The ID of the queue to override the concurrency limit, or the type and name
|
|
51
73
|
* @param concurrencyLimit - The concurrency limit to override
|
|
52
74
|
* @returns The updated queue state
|
|
@@ -55,6 +77,15 @@ export declare function overrideConcurrencyLimit(queue: RetrieveQueueParam, conc
|
|
|
55
77
|
/**
|
|
56
78
|
* Resets the concurrency limit of a queue to the base value.
|
|
57
79
|
*
|
|
80
|
+
* @deprecated Queue-level concurrency is the legacy model: a modern queue is only the
|
|
81
|
+
* ordered line runs wait in, and concurrency is declared on the task and managed
|
|
82
|
+
* through `concurrencyLimits`. The server rejects this call for queues on the new
|
|
83
|
+
* model. Migrate by resetting the limit by name:
|
|
84
|
+
*
|
|
85
|
+
* ```ts
|
|
86
|
+
* await concurrencyLimits.reset("task/my-task");
|
|
87
|
+
* ```
|
|
88
|
+
*
|
|
58
89
|
* @param queue - The ID of the queue to reset the concurrency limit, or the type and name
|
|
59
90
|
* @returns The updated queue state
|
|
60
91
|
*/
|
|
@@ -104,6 +104,28 @@ function pause(queue, requestOptions) {
|
|
|
104
104
|
/**
|
|
105
105
|
* Overrides the concurrency limit of a queue.
|
|
106
106
|
*
|
|
107
|
+
* @deprecated Queue-level concurrency is the legacy model: a modern queue is only the
|
|
108
|
+
* ordered line runs wait in, and concurrency is declared on the task and managed
|
|
109
|
+
* through `concurrencyLimits`. The server rejects this call for queues on the new
|
|
110
|
+
* model. Migrate by declaring the limit and overriding it by name:
|
|
111
|
+
*
|
|
112
|
+
* ```ts
|
|
113
|
+
* export const myTask = task({
|
|
114
|
+
* id: "my-task",
|
|
115
|
+
* concurrency: { total: 5 },
|
|
116
|
+
* run: async (payload) => {
|
|
117
|
+
* // ...
|
|
118
|
+
* },
|
|
119
|
+
* });
|
|
120
|
+
*
|
|
121
|
+
* await concurrencyLimits.override("task/my-task", { total: 10 });
|
|
122
|
+
* ```
|
|
123
|
+
*
|
|
124
|
+
* For workloads that pass a `concurrencyKey` at trigger time, declare `concurrency: { perKey: n }`
|
|
125
|
+
* instead (`total` caps all keys together). For a limit shared by several tasks, declare a named
|
|
126
|
+
* limit with `concurrencyLimit({ name, ... })`, making the same choice between `total` and
|
|
127
|
+
* `perKey`, pass it to each task's `concurrency` option, and override it by that name.
|
|
128
|
+
*
|
|
107
129
|
* @param queue - The ID of the queue to override the concurrency limit, or the type and name
|
|
108
130
|
* @param concurrencyLimit - The concurrency limit to override
|
|
109
131
|
* @returns The updated queue state
|
|
@@ -132,6 +154,15 @@ function overrideConcurrencyLimit(queue, concurrencyLimit, requestOptions) {
|
|
|
132
154
|
/**
|
|
133
155
|
* Resets the concurrency limit of a queue to the base value.
|
|
134
156
|
*
|
|
157
|
+
* @deprecated Queue-level concurrency is the legacy model: a modern queue is only the
|
|
158
|
+
* ordered line runs wait in, and concurrency is declared on the task and managed
|
|
159
|
+
* through `concurrencyLimits`. The server rejects this call for queues on the new
|
|
160
|
+
* model. Migrate by resetting the limit by name:
|
|
161
|
+
*
|
|
162
|
+
* ```ts
|
|
163
|
+
* await concurrencyLimits.reset("task/my-task");
|
|
164
|
+
* ```
|
|
165
|
+
*
|
|
135
166
|
* @param queue - The ID of the queue to reset the concurrency limit, or the type and name
|
|
136
167
|
* @returns The updated queue state
|
|
137
168
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queues.js","sourceRoot":"","sources":["../../../src/v3/queues.ts"],"names":[],"mappings":";;;;;;;;AAQA,6CAK8B;AAC9B,2CAAqC;AAErC;;;;;;GAMG;AACH,cACE,OAA0B,EAC1B,cAAkC;IAElC,MAAM,SAAS,GAAG,qBAAgB,CAAC,aAAa,EAAE,CAAC;IAEnD,MAAM,eAAe,GAAG,IAAA,wBAAmB,EACzC;QACE,MAAM,EAAN,kBAAM;QACN,IAAI,EAAE,eAAe;QACrB,IAAI,EAAE,OAAO;KACd,EACD,cAAc,CACf,CAAC;IAEF,OAAO,SAAS,CAAC,UAAU,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC;AACxD,CAAC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,kBACE,KAAyB,EACzB,cAAkC;IAElC,MAAM,SAAS,GAAG,qBAAgB,CAAC,aAAa,EAAE,CAAC;IAEnD,MAAM,eAAe,GAAG,IAAA,wBAAmB,EACzC;QACE,MAAM,EAAN,kBAAM;QACN,IAAI,EAAE,mBAAmB;QACzB,IAAI,EAAE,OAAO;QACb,UAAU,EAAE;YACV,GAAG,IAAA,sBAAiB,EAAC,EAAE,KAAK,EAAE,CAAC;YAC/B,GAAG,IAAA,wBAAmB,EAAC;gBACrB,KAAK,EAAE;oBACL;wBACE,IAAI,EAAE,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI;wBACpD,OAAO,EAAE,QAAQ;qBAClB;iBACF;gBACD,KAAK,EAAE,UAAU;aAClB,CA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AC,CAAC,KAAK,CAAC,IAAI;wBACpD,OAAO,EAAE,QAAQ;qBAClB;iBACF;gBACD,KAAK,EAAE,UAAU;aAClB,CAAC;SACH;KACF,EACD,cAAc,CACf,CAAC;IAEF,OAAO,SAAS,CAAC,0BAA0B,CAAC,KAAK,EAAE,eAAe,CAAC,CAAC;AACtE,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,gBACE,KAAyB,EACzB,cAAkC;IAElC,MAAM,SAAS,GAAG,qBAAgB,CAAC,aAAa,EAAE,CAAC;IAEnD,MAAM,eAAe,GAAG,IAAA,wBAAmB,EACzC;QACE,MAAM,EAAN,kBAAM;QACN,IAAI,EAAE,iBAAiB;QACvB,IAAI,EAAE,OAAO;QACb,UAAU,EAAE;YACV,GAAG,IAAA,sBAAiB,EAAC,EAAE,KAAK,EAAE,CAAC;YAC/B,GAAG,IAAA,wBAAmB,EAAC;gBACrB,KAAK,EAAE;oBACL;wBACE,IAAI,EAAE,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI;wBACpD,OAAO,EAAE,QAAQ;qBAClB;iBACF;gBACD,KAAK,EAAE,UAAU;aAClB,CAAC;SACH;KACF,EACD,cAAc,CACf,CAAC;IAEF,OAAO,SAAS,CAAC,UAAU,CAAC,KAAK,EAAE,QAAQ,EAAE,eAAe,CAAC,CAAC;AAChE,CAAC"}
|
|
@@ -1,8 +1,25 @@
|
|
|
1
|
-
import { type ApiRequestOptions, type InitOutput, type Queue, type QueueOptions, type TaskFromIdentifier, type TaskRunContext, ApiError, SubtaskUnwrapError, TaskRunPromise, type AnyRunHandle, type AnyTask, type BatchByIdAndWaitItem, type BatchByIdItem, type BatchByIdResult, type BatchByTaskAndWaitItem, type BatchByTaskItem, type BatchByTaskResult, type BatchItem, type BatchItemNDJSON, type BatchResult, type BatchRunHandle, type BatchRunHandleFromTypes, type BatchTasksRunHandleFromTypes, type BatchTriggerAndWaitOptions, type BatchTriggerOptions, type InferRunTypes, type RunHandle, type RunHandleFromTypes, type Task, type TaskIdentifier, type TaskOptions, type TaskOptionsWithSchema, type TaskOutput, type TaskPayload, type TaskRunResult, type TaskSchema, type TaskWithSchema, type TaskWithSchemaOptions, type TaskWithToolOptions, type ToolTask, type ToolTaskParameters, type TriggerAndSubscribeOptions, type TriggerAndWaitOptions, type TriggerApiRequestOptions, type TriggerOptions } from "@trigger.dev/core/v3";
|
|
1
|
+
import { type ApiRequestOptions, type InitOutput, type Queue, type QueueOptions, type TaskFromIdentifier, type TaskRunContext, ApiError, SubtaskUnwrapError, TaskRunPromise, type AnyRunHandle, type AnyTask, type BatchByIdAndWaitItem, type BatchByIdItem, type BatchByIdResult, type BatchByTaskAndWaitItem, type BatchByTaskItem, type BatchByTaskResult, type BatchItem, type BatchItemNDJSON, type BatchResult, type BatchRunHandle, type BatchRunHandleFromTypes, type BatchTasksRunHandleFromTypes, type BatchTriggerAndWaitOptions, type BatchTriggerOptions, type InferRunTypes, type RunHandle, type RunHandleFromTypes, type Task, type TaskIdentifier, type TaskOptions, type TaskOptionsWithSchema, type TaskOutput, type TaskPayload, type TaskRunResult, type TaskSchema, type TaskWithSchema, type TaskWithSchemaOptions, type TaskWithToolOptions, type ToolTask, type ToolTaskParameters, type TriggerAndSubscribeOptions, type TriggerAndWaitOptions, type TriggerApiRequestOptions, type TriggerOptions, type ConcurrencyLimitOptions, type ConcurrencyLimit } from "@trigger.dev/core/v3";
|
|
2
2
|
export type { AnyRunHandle, AnyTask, BatchItem, BatchResult, BatchRunHandle, BatchTriggerOptions, Queue, RunHandle, Task, TaskFromIdentifier, TaskIdentifier, TaskOptions, TaskOptionsWithSchema, TaskOutput, TaskPayload, TaskRunResult, TaskSchema, TaskWithSchema, TaskWithSchemaOptions, TriggerOptions, };
|
|
3
3
|
export { SubtaskUnwrapError, TaskRunPromise };
|
|
4
4
|
export type Context = TaskRunContext;
|
|
5
5
|
export declare function queue(options: QueueOptions): Queue;
|
|
6
|
+
/**
|
|
7
|
+
* Declares a named, shareable concurrency limit. Tasks hold it via their `concurrency`
|
|
8
|
+
* option; every task holding the same limit draws from the same pools.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
*
|
|
12
|
+
* ```ts
|
|
13
|
+
* export const openaiLimit = concurrencyLimit({ name: "openai", total: 25 });
|
|
14
|
+
*
|
|
15
|
+
* export const generateSummary = task({
|
|
16
|
+
* id: "generate-summary",
|
|
17
|
+
* concurrency: [{ total: 5 }, openaiLimit],
|
|
18
|
+
* run: async (payload) => {},
|
|
19
|
+
* });
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export declare function concurrencyLimit(options: ConcurrencyLimitOptions): ConcurrencyLimit;
|
|
6
23
|
export declare function createTask<TIdentifier extends string, TOutput = unknown, TInitOutput extends InitOutput = any>(params: TaskOptionsWithSchema<TIdentifier, TOutput, TInitOutput>): Task<TIdentifier, any, TOutput>;
|
|
7
24
|
export declare function createTask<TIdentifier extends string, TInput = void, TOutput = unknown, TInitOutput extends InitOutput = any>(params: TaskOptions<TIdentifier, TInput, TOutput, TInitOutput>): Task<TIdentifier, TInput, TOutput>;
|
|
8
25
|
/**
|