@trigger.dev/sdk 4.6.3 → 4.7.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.
Files changed (119) hide show
  1. package/dist/commonjs/v3/ai.d.ts +5 -2
  2. package/dist/commonjs/v3/ai.js +189 -266
  3. package/dist/commonjs/v3/ai.js.map +1 -1
  4. package/dist/commonjs/v3/chat-client.js +7 -0
  5. package/dist/commonjs/v3/chat-client.js.map +1 -1
  6. package/dist/commonjs/v3/chat-server.d.ts +1 -0
  7. package/dist/commonjs/v3/chat-server.js +8 -0
  8. package/dist/commonjs/v3/chat-server.js.map +1 -1
  9. package/dist/commonjs/v3/chat.d.ts +28 -4
  10. package/dist/commonjs/v3/chat.js +41 -9
  11. package/dist/commonjs/v3/chat.js.map +1 -1
  12. package/dist/commonjs/v3/chatRouteWait.d.ts +21 -0
  13. package/dist/commonjs/v3/chatRouteWait.js +43 -0
  14. package/dist/commonjs/v3/chatRouteWait.js.map +1 -0
  15. package/dist/commonjs/v3/compactionResponse.js +5 -0
  16. package/dist/commonjs/v3/compactionResponse.js.map +1 -1
  17. package/dist/commonjs/v3/concurrency-shared.d.ts +13 -0
  18. package/dist/commonjs/v3/concurrency-shared.js +35 -0
  19. package/dist/commonjs/v3/concurrency-shared.js.map +1 -0
  20. package/dist/commonjs/v3/concurrencyLimits.d.ts +73 -0
  21. package/dist/commonjs/v3/concurrencyLimits.js +166 -0
  22. package/dist/commonjs/v3/concurrencyLimits.js.map +1 -0
  23. package/dist/commonjs/v3/index.d.ts +2 -1
  24. package/dist/commonjs/v3/index.js +3 -1
  25. package/dist/commonjs/v3/index.js.map +1 -1
  26. package/dist/commonjs/v3/managedChatResponse.d.ts +44 -0
  27. package/dist/commonjs/v3/managedChatResponse.js +233 -0
  28. package/dist/commonjs/v3/managedChatResponse.js.map +1 -0
  29. package/dist/commonjs/v3/queues.d.ts +31 -0
  30. package/dist/commonjs/v3/queues.js +31 -0
  31. package/dist/commonjs/v3/queues.js.map +1 -1
  32. package/dist/commonjs/v3/shared.d.ts +18 -1
  33. package/dist/commonjs/v3/shared.js +137 -47
  34. package/dist/commonjs/v3/shared.js.map +1 -1
  35. package/dist/commonjs/v3/steeringContext.d.ts +41 -0
  36. package/dist/commonjs/v3/steeringContext.js +118 -0
  37. package/dist/commonjs/v3/steeringContext.js.map +1 -0
  38. package/dist/commonjs/v3/transcriptStorage.d.ts +4 -1
  39. package/dist/commonjs/v3/transcriptStorage.js +51 -4
  40. package/dist/commonjs/v3/transcriptStorage.js.map +1 -1
  41. package/dist/commonjs/version.js +1 -1
  42. package/dist/esm/v3/ai.d.ts +5 -2
  43. package/dist/esm/v3/ai.js +189 -266
  44. package/dist/esm/v3/ai.js.map +1 -1
  45. package/dist/esm/v3/chat-client.js +7 -0
  46. package/dist/esm/v3/chat-client.js.map +1 -1
  47. package/dist/esm/v3/chat-server.d.ts +1 -0
  48. package/dist/esm/v3/chat-server.js +8 -0
  49. package/dist/esm/v3/chat-server.js.map +1 -1
  50. package/dist/esm/v3/chat.d.ts +28 -4
  51. package/dist/esm/v3/chat.js +41 -9
  52. package/dist/esm/v3/chat.js.map +1 -1
  53. package/dist/esm/v3/chatRouteWait.d.ts +21 -0
  54. package/dist/esm/v3/chatRouteWait.js +40 -0
  55. package/dist/esm/v3/chatRouteWait.js.map +1 -0
  56. package/dist/esm/v3/compactionResponse.js +5 -0
  57. package/dist/esm/v3/compactionResponse.js.map +1 -1
  58. package/dist/esm/v3/concurrency-shared.d.ts +13 -0
  59. package/dist/esm/v3/concurrency-shared.js +31 -0
  60. package/dist/esm/v3/concurrency-shared.js.map +1 -0
  61. package/dist/esm/v3/concurrencyLimits.d.ts +73 -0
  62. package/dist/esm/v3/concurrencyLimits.js +158 -0
  63. package/dist/esm/v3/concurrencyLimits.js.map +1 -0
  64. package/dist/esm/v3/index.d.ts +2 -1
  65. package/dist/esm/v3/index.js +2 -1
  66. package/dist/esm/v3/index.js.map +1 -1
  67. package/dist/esm/v3/managedChatResponse.d.ts +44 -0
  68. package/dist/esm/v3/managedChatResponse.js +228 -0
  69. package/dist/esm/v3/managedChatResponse.js.map +1 -0
  70. package/dist/esm/v3/queues.d.ts +31 -0
  71. package/dist/esm/v3/queues.js +31 -0
  72. package/dist/esm/v3/queues.js.map +1 -1
  73. package/dist/esm/v3/shared.d.ts +18 -1
  74. package/dist/esm/v3/shared.js +136 -47
  75. package/dist/esm/v3/shared.js.map +1 -1
  76. package/dist/esm/v3/steeringContext.d.ts +41 -0
  77. package/dist/esm/v3/steeringContext.js +113 -0
  78. package/dist/esm/v3/steeringContext.js.map +1 -0
  79. package/dist/esm/v3/transcriptStorage.d.ts +4 -1
  80. package/dist/esm/v3/transcriptStorage.js +51 -4
  81. package/dist/esm/v3/transcriptStorage.js.map +1 -1
  82. package/dist/esm/version.js +1 -1
  83. package/docs/ai-chat/client-protocol.mdx +3 -1
  84. package/docs/ai-chat/error-handling.mdx +44 -76
  85. package/docs/ai-chat/fast-starts.mdx +1 -1
  86. package/docs/ai-chat/frontend.mdx +27 -21
  87. package/docs/ai-chat/patterns/branching-conversations.mdx +95 -230
  88. package/docs/ai-chat/patterns/human-in-the-loop.mdx +166 -164
  89. package/docs/ai-chat/patterns/tool-result-auditing.mdx +28 -27
  90. package/docs/ai-chat/patterns/version-upgrades.mdx +4 -4
  91. package/docs/ai-chat/pending-messages.mdx +19 -5
  92. package/docs/ai-chat/quick-start.mdx +26 -20
  93. package/docs/ai-chat/reference.mdx +21 -3
  94. package/docs/ai-chat/sessions.mdx +1 -1
  95. package/docs/ai-chat/testing.mdx +16 -4
  96. package/docs/concurrency.mdx +384 -0
  97. package/docs/database-connections.mdx +3 -3
  98. package/docs/deploy-environment-variables.mdx +6 -0
  99. package/docs/deployment/atomic-deployment.mdx +416 -132
  100. package/docs/deployment/overview.mdx +2 -2
  101. package/docs/github-actions.mdx +2 -2
  102. package/docs/github-integration.mdx +2 -2
  103. package/docs/idempotency.mdx +43 -5
  104. package/docs/introduction.mdx +1 -1
  105. package/docs/limits.mdx +16 -6
  106. package/docs/observability/query.mdx +25 -0
  107. package/docs/queues.mdx +271 -0
  108. package/docs/reports.mdx +1 -1
  109. package/docs/runs/priority.mdx +2 -25
  110. package/docs/self-hosting/env/webapp.mdx +7 -0
  111. package/docs/tasks/overview.mdx +3 -5
  112. package/docs/troubleshooting-alerts.mdx +124 -1
  113. package/docs/troubleshooting.mdx +12 -0
  114. package/docs/vercel-integration.mdx +6 -7
  115. package/docs/versioning.mdx +1 -1
  116. package/docs/writing-tasks-introduction.mdx +2 -1
  117. package/package.json +2 -2
  118. package/docs/deployment/version-skew-protection.mdx +0 -492
  119. package/docs/queue-concurrency.mdx +0 -358
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/v3/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,OAAO,EAAE,KAAK,EAAqB,MAAM,YAAY,CAAC;AACtD,OAAO,EAAE,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AACvD,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,sBAAsB,CAAC;AACrC,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAS3B,OAAO,EACL,QAAQ,EACR,mBAAmB,EACnB,eAAe,EACf,aAAa,EACb,mBAAmB,EACnB,aAAa,EACb,qBAAqB,EACrB,cAAc,EACd,wBAAwB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EACL,QAAQ,EACR,mBAAmB,EACnB,eAAe,EACf,aAAa,EACb,mBAAmB,EACnB,aAAa,EACb,qBAAqB,EACrB,cAAc,EACd,wBAAwB,EACxB,iBAAiB,EACjB,gBAAgB,EAChB,sBAAsB,EACtB,sBAAsB,EACtB,wBAAwB,EACxB,MAAM,GAEP,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACL,IAAI,GASL,MAAM,WAAW,CAAC;AACnB,OAAO,KAAK,SAAS,MAAM,sBAAsB,CAAC;AAClD,OAAO,EACL,WAAW,GAGZ,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,OAAO,MAAM,cAAc,CAAC;AACxC,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AACtC,OAAO,KAAK,iBAAiB,MAAM,wBAAwB,CAAC;AAG5D,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,aAAa,EAA4B,MAAM,oBAAoB,CAAC;AAC7E,OAAO,KAAK,OAAO,MAAM,cAAc,CAAC;AACxC,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC"}
@@ -0,0 +1,44 @@
1
+ import type { UIMessage, UIMessageChunk } from "ai";
2
+ /** One ordered output channel for a turn's managed model and data chunks. */
3
+ export declare class ManagedChatResponse {
4
+ private readonly publish;
5
+ private controller?;
6
+ private completion?;
7
+ private failure?;
8
+ private closed;
9
+ private chunks;
10
+ private original?;
11
+ private fallbackId;
12
+ private completedSteps;
13
+ private dataBoundary;
14
+ private generationOffset;
15
+ private orderedSteps;
16
+ private pendingData;
17
+ constructor(publish: (stream: ReadableStream<UIMessageChunk>) => Promise<unknown>);
18
+ seed(messages: readonly UIMessage[] | undefined): void;
19
+ get isClosed(): boolean;
20
+ get revision(): number;
21
+ continues(id: string): boolean;
22
+ beginGeneration(): void;
23
+ afterStep(completedSteps: number): void;
24
+ /** Raw pipes own their output ordering and do not feed this capture. */
25
+ useRawPipe(): void;
26
+ private flushPendingData;
27
+ writeData(chunk: UIMessageChunk): void;
28
+ write(chunk: UIMessageChunk, capture?: boolean): void;
29
+ pipe(source: AsyncIterable<UIMessageChunk> | ReadableStream<UIMessageChunk>, signal?: AbortSignal): Promise<void>;
30
+ /** Native reduction of the exact admitted chunks, including same-ID updates. */
31
+ snapshot(options?: {
32
+ message: UIMessage;
33
+ from: number;
34
+ }): Promise<UIMessage | undefined>;
35
+ close(): Promise<void>;
36
+ }
37
+ /** Hook streams share a publisher; only persistent data joins managed capture. */
38
+ export declare function createOrderedChatWriter(activeResponse: () => ManagedChatResponse | undefined, publish: (stream: ReadableStream<UIMessageChunk>) => Promise<unknown>): {
39
+ writer: {
40
+ write(part: UIMessageChunk): void;
41
+ merge(stream: ReadableStream<UIMessageChunk>): void;
42
+ };
43
+ flush(): Promise<void>;
44
+ };
@@ -0,0 +1,228 @@
1
+ import { generateId, readUIMessageStream } from "../imports/ai-runtime.js";
2
+ /** One ordered output channel for a turn's managed model and data chunks. */
3
+ export class ManagedChatResponse {
4
+ publish;
5
+ controller;
6
+ completion;
7
+ failure;
8
+ closed = false;
9
+ chunks = [];
10
+ original;
11
+ fallbackId = generateId();
12
+ completedSteps = 0;
13
+ dataBoundary = 0;
14
+ generationOffset = 0;
15
+ orderedSteps = true;
16
+ pendingData = [];
17
+ constructor(publish) {
18
+ this.publish = publish;
19
+ }
20
+ seed(messages) {
21
+ // Never mutate the caller's history while processing a continuation.
22
+ const last = messages?.at(-1);
23
+ this.original = last?.role === "assistant" ? structuredClone(last) : undefined;
24
+ }
25
+ get isClosed() {
26
+ return this.closed;
27
+ }
28
+ get revision() {
29
+ return this.chunks.length;
30
+ }
31
+ continues(id) {
32
+ return this.original?.id === id;
33
+ }
34
+ beginGeneration() {
35
+ this.generationOffset = this.completedSteps;
36
+ this.dataBoundary = this.completedSteps;
37
+ }
38
+ afterStep(completedSteps) {
39
+ this.dataBoundary = this.orderedSteps ? this.generationOffset + completedSteps : 0;
40
+ }
41
+ /** Raw pipes own their output ordering and do not feed this capture. */
42
+ useRawPipe() {
43
+ this.orderedSteps = false;
44
+ this.dataBoundary = 0;
45
+ this.flushPendingData();
46
+ }
47
+ flushPendingData() {
48
+ this.dataBoundary = this.completedSteps;
49
+ for (const next of this.pendingData.splice(0))
50
+ this.write(next.chunk, next.capture);
51
+ }
52
+ writeData(chunk) {
53
+ const capture = chunk.type.startsWith("data-") && !("transient" in chunk && chunk.transient);
54
+ if (this.closed)
55
+ throw new Error("The managed chat response is closed");
56
+ if (this.dataBoundary > this.completedSteps) {
57
+ this.pendingData.push({ chunk, capture, after: this.dataBoundary });
58
+ }
59
+ else
60
+ this.write(chunk, capture);
61
+ }
62
+ write(chunk, capture = true) {
63
+ if (this.closed)
64
+ throw new Error("The managed chat response is closed");
65
+ if (this.failure)
66
+ throw this.failure;
67
+ if (!this.controller) {
68
+ const stream = new ReadableStream({
69
+ start: (controller) => {
70
+ this.controller = controller;
71
+ },
72
+ });
73
+ this.completion = this.publish(stream);
74
+ // Transport errors are observed by pipe/close; never leave an unhandled
75
+ // rejection when a fire-and-forget custom write opened the response.
76
+ this.completion.catch((error) => {
77
+ this.failure = error;
78
+ });
79
+ }
80
+ if (capture)
81
+ this.chunks.push(chunk);
82
+ this.controller.enqueue(chunk);
83
+ if (capture && chunk.type === "finish-step") {
84
+ this.completedSteps++;
85
+ while (this.pendingData[0] && this.pendingData[0].after <= this.completedSteps) {
86
+ const next = this.pendingData.shift();
87
+ this.write(next.chunk, next.capture);
88
+ }
89
+ }
90
+ }
91
+ async pipe(source, signal) {
92
+ const reader = source instanceof ReadableStream ? source.getReader() : undefined;
93
+ const iterator = reader
94
+ ? undefined
95
+ : source[Symbol.asyncIterator]();
96
+ let rejectAbort;
97
+ const aborted = new Promise((_, reject) => {
98
+ rejectAbort = reject;
99
+ });
100
+ // A pre-aborted signal or a synchronously throwing iterator can leave this
101
+ // promise outside the read race; observe its rejection in either case.
102
+ aborted.catch(() => { });
103
+ const cancel = () => rejectAbort(signal?.reason);
104
+ signal?.addEventListener("abort", cancel, { once: true });
105
+ try {
106
+ while (true) {
107
+ signal?.throwIfAborted();
108
+ if (this.failure)
109
+ throw this.failure;
110
+ const next = reader ? reader.read() : iterator.next();
111
+ const result = signal ? await Promise.race([next, aborted]) : await next;
112
+ signal?.throwIfAborted();
113
+ if (result.done)
114
+ break;
115
+ this.write(result.value);
116
+ }
117
+ }
118
+ finally {
119
+ signal?.removeEventListener("abort", cancel);
120
+ try {
121
+ if (signal?.aborted) {
122
+ // Async generators can queue return() behind a blocked next(). Stop
123
+ // the turn without waiting for provider cleanup, and observe failures.
124
+ try {
125
+ void Promise.resolve(reader ? reader.cancel(signal.reason) : iterator?.return?.()).catch(() => { });
126
+ }
127
+ catch {
128
+ // A synchronous cleanup failure must not replace the abort reason.
129
+ }
130
+ }
131
+ else if (iterator)
132
+ await iterator.return?.();
133
+ }
134
+ finally {
135
+ reader?.releaseLock();
136
+ // No further finish-step can arrive from this source. Preserve accepted
137
+ // data at the end of the available partial before callers snapshot it.
138
+ this.flushPendingData();
139
+ }
140
+ }
141
+ }
142
+ /** Native reduction of the exact admitted chunks, including same-ID updates. */
143
+ async snapshot(options) {
144
+ if (!this.chunks.length)
145
+ return options?.message;
146
+ const chunks = this.chunks.slice(options?.from ?? 0);
147
+ let message = options?.message;
148
+ const original = options?.message ?? this.original;
149
+ const stream = new ReadableStream({
150
+ start(controller) {
151
+ for (const chunk of chunks)
152
+ controller.enqueue(chunk);
153
+ controller.close();
154
+ },
155
+ });
156
+ for await (const update of readUIMessageStream({
157
+ stream,
158
+ ...(original ? { message: structuredClone(original) } : {}),
159
+ // An error chunk must leave previously streamed content recoverable.
160
+ terminateOnError: false,
161
+ }))
162
+ message = update;
163
+ return message ? { ...message, id: message.id || this.fallbackId } : undefined;
164
+ }
165
+ async close() {
166
+ if (!this.closed) {
167
+ this.flushPendingData();
168
+ // A data-only response still needs the same server ID on both sides.
169
+ if (!this.original &&
170
+ this.chunks.length &&
171
+ !this.chunks.some((chunk) => chunk.type === "start")) {
172
+ this.write({ type: "start", messageId: this.fallbackId });
173
+ }
174
+ this.closed = true;
175
+ this.controller?.close();
176
+ }
177
+ await this.completion;
178
+ }
179
+ }
180
+ /** Hook streams share a publisher; only persistent data joins managed capture. */
181
+ export function createOrderedChatWriter(activeResponse, publish) {
182
+ const raw = new ManagedChatResponse(publish);
183
+ const merging = [];
184
+ const writer = {
185
+ write(part) {
186
+ const managed = activeResponse();
187
+ if (managed)
188
+ managed.writeData(part);
189
+ else
190
+ raw.write(part, false);
191
+ },
192
+ merge(stream) {
193
+ const work = (async () => {
194
+ const reader = stream.getReader();
195
+ try {
196
+ while (true) {
197
+ const { done, value } = await reader.read();
198
+ if (done)
199
+ break;
200
+ writer.write(value);
201
+ }
202
+ }
203
+ finally {
204
+ reader.releaseLock();
205
+ }
206
+ })();
207
+ work.catch(() => { });
208
+ merging.push(work);
209
+ },
210
+ };
211
+ return {
212
+ writer,
213
+ async flush() {
214
+ try {
215
+ let cursor = 0;
216
+ while (cursor < merging.length) {
217
+ const batch = merging.slice(cursor);
218
+ cursor = merging.length;
219
+ await Promise.all(batch);
220
+ }
221
+ }
222
+ finally {
223
+ await raw.close();
224
+ }
225
+ },
226
+ };
227
+ }
228
+ //# sourceMappingURL=managedChatResponse.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"managedChatResponse.js","sourceRoot":"","sources":["../../../src/v3/managedChatResponse.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAE3E,6EAA6E;AAC7E,MAAM,OAAO,mBAAmB;IAeX,OAAO;IAdlB,UAAU,CAAmD;IAC7D,UAAU,CAAoB;IAC9B,OAAO,CAAW;IAClB,MAAM,GAAG,KAAK,CAAC;IACf,MAAM,GAAqB,EAAE,CAAC;IAC9B,QAAQ,CAAa;IACrB,UAAU,GAAG,UAAU,EAAE,CAAC;IAC1B,cAAc,GAAG,CAAC,CAAC;IACnB,YAAY,GAAG,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AC,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
  */
@@ -96,6 +96,28 @@ export function pause(queue, requestOptions) {
96
96
  /**
97
97
  * Overrides the concurrency limit of a queue.
98
98
  *
99
+ * @deprecated Queue-level concurrency is the legacy model: a modern queue is only the
100
+ * ordered line runs wait in, and concurrency is declared on the task and managed
101
+ * through `concurrencyLimits`. The server rejects this call for queues on the new
102
+ * model. Migrate by declaring the limit and overriding it by name:
103
+ *
104
+ * ```ts
105
+ * export const myTask = task({
106
+ * id: "my-task",
107
+ * concurrency: { total: 5 },
108
+ * run: async (payload) => {
109
+ * // ...
110
+ * },
111
+ * });
112
+ *
113
+ * await concurrencyLimits.override("task/my-task", { total: 10 });
114
+ * ```
115
+ *
116
+ * For workloads that pass a `concurrencyKey` at trigger time, declare `concurrency: { perKey: n }`
117
+ * instead (`total` caps all keys together). For a limit shared by several tasks, declare a named
118
+ * limit with `concurrencyLimit({ name, ... })`, making the same choice between `total` and
119
+ * `perKey`, pass it to each task's `concurrency` option, and override it by that name.
120
+ *
99
121
  * @param queue - The ID of the queue to override the concurrency limit, or the type and name
100
122
  * @param concurrencyLimit - The concurrency limit to override
101
123
  * @returns The updated queue state
@@ -124,6 +146,15 @@ export function overrideConcurrencyLimit(queue, concurrencyLimit, requestOptions
124
146
  /**
125
147
  * Resets the concurrency limit of a queue to the base value.
126
148
  *
149
+ * @deprecated Queue-level concurrency is the legacy model: a modern queue is only the
150
+ * ordered line runs wait in, and concurrency is declared on the task and managed
151
+ * through `concurrencyLimits`. The server rejects this call for queues on the new
152
+ * model. Migrate by resetting the limit by name:
153
+ *
154
+ * ```ts
155
+ * await concurrencyLimits.reset("task/my-task");
156
+ * ```
157
+ *
127
158
  * @param queue - The ID of the queue to reset the concurrency limit, or the type and name
128
159
  * @returns The updated queue state
129
160
  */
@@ -1 +1 @@
1
- {"version":3,"file":"queues.js","sourceRoot":"","sources":["../../../src/v3/queues.ts"],"names":[],"mappings":"AAQA,OAAO,EACL,mBAAmB,EACnB,gBAAgB,EAChB,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC;;;;;;GAMG;AACH,MAAM,UAAU,IAAI,CAClB,OAA0B,EAC1B,cAAkC;IAElC,MAAM,SAAS,GAAG,gBAAgB,CAAC,aAAa,EAAE,CAAC;IAEnD,MAAM,eAAe,GAAG,mBAAmB,CACzC;QACE,MAAM;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,MAAM,UAAU,QAAQ,CACtB,KAAyB,EACzB,cAAkC;IAElC,MAAM,SAAS,GAAG,gBAAgB,CAAC,aAAa,EAAE,CAAC;IAEnD,MAAM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aAClB,CAAC;SACH;KACF,EACD,cAAc,CACf,CAAC;IAEF,OAAO,SAAS,CAAC,0BAA0B,CAAC,KAAK,EAAE,eAAe,CAAC,CAAC;AACtE,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,MAAM,CACpB,KAAyB,EACzB,cAAkC;IAElC,MAAM,SAAS,GAAG,gBAAgB,CAAC,aAAa,EAAE,CAAC;IAEnD,MAAM,eAAe,GAAG,mBAAmB,CACzC;QACE,MAAM;QACN,IAAI,EAAE,iBAAiB;QACvB,IAAI,EAAE,OAAO;QACb,UAAU,EAAE;YACV,GAAG,iBAAiB,CAAC,EAAE,KAAK,EAAE,CAAC;YAC/B,GAAG,mBAAmB,CAAC;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
  /**