@trigger.dev/sdk 4.5.5 → 4.5.7
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/agentSkillsRuntime.js +17 -7
- package/dist/commonjs/v3/agentSkillsRuntime.js.map +1 -1
- package/dist/commonjs/v3/ai.d.ts +49 -8
- package/dist/commonjs/v3/ai.js +151 -27
- package/dist/commonjs/v3/ai.js.map +1 -1
- package/dist/commonjs/v3/aiAutoTelemetry.js +3 -3
- package/dist/commonjs/v3/aiAutoTelemetry.js.map +1 -1
- package/dist/commonjs/v3/index.js +17 -7
- package/dist/commonjs/v3/index.js.map +1 -1
- package/dist/commonjs/v3/runs.d.ts +10 -10
- package/dist/commonjs/v3/skill.js +17 -7
- package/dist/commonjs/v3/skill.js.map +1 -1
- package/dist/commonjs/v3/test/test-session-handle.js +20 -8
- package/dist/commonjs/v3/test/test-session-handle.js.map +1 -1
- package/dist/commonjs/v3/triggerClient.js +17 -7
- package/dist/commonjs/v3/triggerClient.js.map +1 -1
- package/dist/commonjs/v3/triggerClient.types.test.js +17 -7
- package/dist/commonjs/v3/triggerClient.types.test.js.map +1 -1
- package/dist/commonjs/version.js +1 -1
- package/dist/esm/v3/ai.d.ts +49 -8
- package/dist/esm/v3/ai.js +151 -27
- package/dist/esm/v3/ai.js.map +1 -1
- package/dist/esm/v3/aiAutoTelemetry.js +3 -3
- package/dist/esm/v3/aiAutoTelemetry.js.map +1 -1
- package/dist/esm/v3/test/test-session-handle.js +20 -8
- package/dist/esm/v3/test/test-session-handle.js.map +1 -1
- package/dist/esm/version.js +1 -1
- package/docs/ai-chat/changelog.mdx +2 -2
- package/docs/ai-chat/compaction.mdx +2 -2
- package/docs/ai-chat/custom-agents.mdx +15 -20
- package/docs/ai-chat/fast-starts.mdx +2 -2
- package/docs/ai-chat/pending-messages.mdx +6 -2
- package/docs/ai-chat/reference.mdx +2 -2
- package/docs/self-hosting/docker.mdx +19 -1
- package/docs/self-hosting/env/webapp.mdx +2 -1
- package/docs/self-hosting/kubernetes.mdx +24 -2
- package/package.json +3 -3
|
@@ -40,10 +40,10 @@ async function register() {
|
|
|
40
40
|
if (typeof aiMod.registerTelemetry !== "function") {
|
|
41
41
|
return; // v5 / v6 — `ai` core emits spans itself, nothing to wire.
|
|
42
42
|
}
|
|
43
|
-
// Computed specifier
|
|
44
|
-
// resolution; resolves at runtime only when
|
|
43
|
+
// Computed specifier + @vite-ignore keep the optional peer out of static
|
|
44
|
+
// bundler resolution; resolves at runtime only when installed.
|
|
45
45
|
const otelSpecifier = ["@ai-sdk", "otel"].join("/");
|
|
46
|
-
const otelMod = await import(otelSpecifier).catch(() => null);
|
|
46
|
+
const otelMod = await import(/* @vite-ignore */ otelSpecifier).catch(() => null);
|
|
47
47
|
if (typeof otelMod?.OpenTelemetry !== "function") {
|
|
48
48
|
return; // optional peer not installed
|
|
49
49
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aiAutoTelemetry.js","sourceRoot":"","sources":["../../../src/v3/aiAutoTelemetry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,IAAI,YAAY,GAAyB,IAAI,CAAC;AAE9C,yFAAyF;AACzF,MAAM,UAAU,oBAAoB;IAClC,IAAI,CAAC,YAAY,EAAE,CAAC;QAClB,YAAY,GAAG,QAAQ,EAAE,CAAC;IAC5B,CAAC;IACD,OAAO,YAAY,CAAC;AACtB,CAAC;AAED,KAAK,UAAU,QAAQ;IACrB,IAAI,CAAC;QACH,IAAI,sBAAsB,EAAE,EAAE,CAAC;YAC7B,OAAO,CAAC,iDAAiD;QAC3D,CAAC;QACD,MAAM,KAAK,GAAQ,MAAM,MAAM,CAAC,IAAI,CAAC,CAAC;QACtC,IAAI,OAAO,KAAK,CAAC,iBAAiB,KAAK,UAAU,EAAE,CAAC;YAClD,OAAO,CAAC,2DAA2D;QACrE,CAAC;QACD,
|
|
1
|
+
{"version":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,CAAC,GAAG,CAAC,gCAAgC,EAAE,WAAW,EAAE,CAAC;IAC1E,OAAO,KAAK,KAAK,GAAG,IAAI,KAAK,KAAK,OAAO,CAAC;AAC5C,CAAC;AAED;;;;;;GAMG;AACH,SAAS,uBAAuB,CAAC,aAAkB;IACjD,MAAM,YAAY,GAAI,UAAkB,CAAC,6BAA6B,CAAC;IACvE,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,CAAC;QACjC,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,YAAY,CAAC,IAAI,CACtB,CAAC,WAAgB,EAAE,EAAE,CACnB,CAAC,OAAO,aAAa,KAAK,UAAU,IAAI,WAAW,YAAY,aAAa,CAAC;QAC7E,WAAW,EAAE,WAAW,EAAE,IAAI,KAAK,eAAe,CACrD,CAAC;AACJ,CAAC"}
|
|
@@ -93,34 +93,40 @@ export class TestSessionOutputChannel extends SessionOutputChannel {
|
|
|
93
93
|
pipe(value, _options) {
|
|
94
94
|
const state = this.state;
|
|
95
95
|
const readChunks = [];
|
|
96
|
+
let pipeError;
|
|
96
97
|
let resolveDone;
|
|
97
98
|
const done = new Promise((resolve) => {
|
|
98
99
|
resolveDone = resolve;
|
|
99
100
|
});
|
|
100
101
|
(async () => {
|
|
101
|
-
|
|
102
|
-
const reader = readable.getReader();
|
|
102
|
+
let reader;
|
|
103
103
|
try {
|
|
104
|
+
const readable = ensureReadableStream(value);
|
|
105
|
+
reader = readable.getReader();
|
|
104
106
|
while (true) {
|
|
105
107
|
const { done: d, value: v } = await reader.read();
|
|
106
108
|
if (d)
|
|
107
|
-
|
|
109
|
+
break;
|
|
108
110
|
readChunks.push(v);
|
|
109
111
|
notify(state, v);
|
|
110
112
|
}
|
|
111
113
|
}
|
|
114
|
+
catch (err) {
|
|
115
|
+
// Mirror production: a source-stream error (or a throw from stream
|
|
116
|
+
// setup) rejects waitUntilComplete instead of being silently
|
|
117
|
+
// swallowed, so callers (e.g. chat.pipeAndCapture) can observe it.
|
|
118
|
+
pipeError = err;
|
|
119
|
+
}
|
|
112
120
|
finally {
|
|
113
121
|
try {
|
|
114
|
-
reader
|
|
122
|
+
reader?.releaseLock();
|
|
115
123
|
}
|
|
116
124
|
catch {
|
|
117
125
|
// ignore
|
|
118
126
|
}
|
|
119
127
|
resolveDone();
|
|
120
128
|
}
|
|
121
|
-
})()
|
|
122
|
-
resolveDone();
|
|
123
|
-
});
|
|
129
|
+
})();
|
|
124
130
|
const replayStream = new ReadableStream({
|
|
125
131
|
async start(controller) {
|
|
126
132
|
await done;
|
|
@@ -136,6 +142,8 @@ export class TestSessionOutputChannel extends SessionOutputChannel {
|
|
|
136
142
|
},
|
|
137
143
|
waitUntilComplete: async () => {
|
|
138
144
|
await done;
|
|
145
|
+
if (pipeError)
|
|
146
|
+
throw pipeError;
|
|
139
147
|
return emptyResult;
|
|
140
148
|
},
|
|
141
149
|
};
|
|
@@ -219,7 +227,11 @@ export class TestSessionOutputChannel extends SessionOutputChannel {
|
|
|
219
227
|
}
|
|
220
228
|
}
|
|
221
229
|
notify(this.state, synthetic);
|
|
222
|
-
|
|
230
|
+
// Project a synthetic monotonic seq_num as the ack's `lastEventId`,
|
|
231
|
+
// mirroring what S2 returns in production (there it's the control
|
|
232
|
+
// record's seq_num). Using the running `.out` record count lets
|
|
233
|
+
// `chat.writeTurnComplete()` surface a real resume cursor in tests.
|
|
234
|
+
return { lastEventId: String(this.state.chunks.length) };
|
|
223
235
|
}
|
|
224
236
|
/**
|
|
225
237
|
* No-op in the mock harness. Production trims keep `session.out` bounded;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test-session-handle.js","sourceRoot":"","sources":["../../../../src/v3/test/test-session-handle.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAEpF,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AA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B,EACjB,KAA0B,EAC1B,iBAAgD,GAAG,EAAE,CAAC,SAAS;IAE/D,OAAO,IAAI,aAAa,CAAC,SAAS,EAAE;QAClC,EAAE,EAAE,IAAI,uBAAuB,CAAC,SAAS,EAAE,cAAc,CAAC;QAC1D,GAAG,EAAE,IAAI,wBAAwB,CAAC,SAAS,EAAE,KAAK,CAAC;KACpD,CAAC,CAAC;AACL,CAAC"}
|
package/dist/esm/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = "4.5.
|
|
1
|
+
export const VERSION = "4.5.7";
|
|
2
2
|
//# sourceMappingURL=version.js.map
|
|
@@ -55,10 +55,10 @@ if (isFinal) {
|
|
|
55
55
|
const result = streamText({ model, messages: conversation.modelMessages, tools });
|
|
56
56
|
// Pass originalMessages so the handed-over tool round merges into the
|
|
57
57
|
// step-1 assistant instead of starting a new message.
|
|
58
|
-
const
|
|
58
|
+
const { message } = await chat.pipeAndCapture(result, {
|
|
59
59
|
originalMessages: conversation.uiMessages,
|
|
60
60
|
});
|
|
61
|
-
if (
|
|
61
|
+
if (message) await conversation.addResponse(message);
|
|
62
62
|
}
|
|
63
63
|
```
|
|
64
64
|
|
|
@@ -365,8 +365,8 @@ for (let turn = 0; turn < 100; turn++) {
|
|
|
365
365
|
stopWhen: stepCountIs(15),
|
|
366
366
|
});
|
|
367
367
|
|
|
368
|
-
const
|
|
369
|
-
if (
|
|
368
|
+
const { message } = await chat.pipeAndCapture(result);
|
|
369
|
+
if (message) await conversation.addResponse(message);
|
|
370
370
|
|
|
371
371
|
// Outer-loop compaction
|
|
372
372
|
const usage = await result.totalUsage;
|
|
@@ -160,11 +160,11 @@ for await (const turn of session) {
|
|
|
160
160
|
});
|
|
161
161
|
|
|
162
162
|
// Manual: pipe and capture separately
|
|
163
|
-
const
|
|
163
|
+
const { message } = await chat.pipeAndCapture(result, { signal: turn.signal });
|
|
164
164
|
|
|
165
|
-
if (
|
|
165
|
+
if (message) {
|
|
166
166
|
// Custom processing before accumulating
|
|
167
|
-
await turn.addResponse(
|
|
167
|
+
await turn.addResponse(message);
|
|
168
168
|
}
|
|
169
169
|
|
|
170
170
|
// Custom persistence, analytics, etc.
|
|
@@ -215,8 +215,8 @@ For full control, skip `createSession` and compose the primitives directly:
|
|
|
215
215
|
| ------------------------------- | -------------------------------------------------------------------------------------------- |
|
|
216
216
|
| `chat.messages` | Input stream for incoming messages — use `.waitWithIdleTimeout()` to wait for the next turn |
|
|
217
217
|
| `chat.createStopSignal()` | Create a managed stop signal wired to the stop input stream |
|
|
218
|
-
| `chat.pipeAndCapture(result)` | Pipe a
|
|
219
|
-
| `chat.writeTurnComplete()` | Signal
|
|
218
|
+
| `chat.pipeAndCapture(result)` | Pipe a stream and capture the response; returns `{ message, status, error }` |
|
|
219
|
+
| `chat.writeTurnComplete()` | Signal turn complete; returns `{ lastEventId, sessionInEventId }` resume cursors |
|
|
220
220
|
| `chat.MessageAccumulator` | Accumulates conversation messages across turns |
|
|
221
221
|
| `chat.pipe(stream)` | Pipe a stream to the frontend (no response capture) |
|
|
222
222
|
| `chat.cleanupAbortedParts(msg)` | Clean up incomplete parts from a stopped response |
|
|
@@ -285,21 +285,16 @@ export const myChat = chat.customAgent({
|
|
|
285
285
|
stopWhen: stepCountIs(15),
|
|
286
286
|
});
|
|
287
287
|
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
// Stop — fall through to accumulate partial
|
|
295
|
-
} else {
|
|
296
|
-
throw error;
|
|
297
|
-
}
|
|
298
|
-
}
|
|
288
|
+
const { message, status, error } = await chat.pipeAndCapture(result, {
|
|
289
|
+
signal: combinedSignal,
|
|
290
|
+
});
|
|
291
|
+
// pipeAndCapture never throws: a user stop returns status "aborted" with
|
|
292
|
+
// the partial message, and a failure returns status "error" with `error`.
|
|
293
|
+
if (status === "error") throw error;
|
|
299
294
|
|
|
300
|
-
if (
|
|
295
|
+
if (message) {
|
|
301
296
|
const cleaned =
|
|
302
|
-
stop.signal.aborted && !runSignal.aborted ? chat.cleanupAbortedParts(
|
|
297
|
+
stop.signal.aborted && !runSignal.aborted ? chat.cleanupAbortedParts(message) : message;
|
|
303
298
|
await conversation.addResponse(cleaned);
|
|
304
299
|
}
|
|
305
300
|
|
|
@@ -346,8 +341,8 @@ const messages = await conversation.addIncoming(
|
|
|
346
341
|
);
|
|
347
342
|
|
|
348
343
|
// After piping, add the response
|
|
349
|
-
const
|
|
350
|
-
if (
|
|
344
|
+
const { message } = await chat.pipeAndCapture(result);
|
|
345
|
+
if (message) await conversation.addResponse(message);
|
|
351
346
|
|
|
352
347
|
// Access accumulated messages for persistence
|
|
353
348
|
conversation.uiMessages; // UIMessage[]
|
|
@@ -589,10 +589,10 @@ if (turn === 0 && payload.trigger === "handover-prepare") {
|
|
|
589
589
|
messages: conversation.modelMessages,
|
|
590
590
|
stopWhen: stepCountIs(10),
|
|
591
591
|
});
|
|
592
|
-
const
|
|
592
|
+
const { message } = await chat.pipeAndCapture(result, {
|
|
593
593
|
originalMessages: conversation.uiMessages,
|
|
594
594
|
});
|
|
595
|
-
if (
|
|
595
|
+
if (message) await conversation.addResponse(message);
|
|
596
596
|
}
|
|
597
597
|
await chat.writeTurnComplete(); // on isFinal the warm partial is already the response
|
|
598
598
|
return;
|
|
@@ -179,10 +179,14 @@ for (let turn = 0; turn < 100; turn++) {
|
|
|
179
179
|
stopWhen: stepCountIs(15),
|
|
180
180
|
});
|
|
181
181
|
|
|
182
|
-
const
|
|
182
|
+
const { message, status, error } = await chat.pipeAndCapture(result);
|
|
183
183
|
sub.off();
|
|
184
184
|
|
|
185
|
-
|
|
185
|
+
// Keep any partial output, then branch on the outcome: pipeAndCapture no
|
|
186
|
+
// longer throws, so rethrow a real failure and don't complete a failed turn.
|
|
187
|
+
if (message) await conversation.addResponse(message);
|
|
188
|
+
if (status === "error") throw error;
|
|
189
|
+
|
|
186
190
|
await chat.writeTurnComplete();
|
|
187
191
|
}
|
|
188
192
|
```
|
|
@@ -503,8 +503,8 @@ All methods available on the `chat` object from `@trigger.dev/sdk/ai`.
|
|
|
503
503
|
| `chat.agent(options)` | Create a chat agent |
|
|
504
504
|
| `chat.createSession(payload, options)` | Create an async iterator for chat turns |
|
|
505
505
|
| `chat.pipe(source, options?)` | Pipe a stream to the frontend (from anywhere inside a task) |
|
|
506
|
-
| `chat.pipeAndCapture(source, options?)` | Pipe and capture the response `
|
|
507
|
-
| `chat.writeTurnComplete(options?)` | Signal
|
|
506
|
+
| `chat.pipeAndCapture(source, options?)` | Pipe and capture the response; returns `{ message, status, error }` |
|
|
507
|
+
| `chat.writeTurnComplete(options?)` | Signal turn complete; returns `{ lastEventId, sessionInEventId }` resume cursors |
|
|
508
508
|
| `chat.createStopSignal()` | Create a managed stop signal wired to the stop input stream |
|
|
509
509
|
| `chat.messages` | Input stream for incoming messages — use `.waitWithIdleTimeout()` |
|
|
510
510
|
| `chat.local<T>({ id })` | Create a per-run typed local (see [`chat.local`](/ai-chat/chat-local)) |
|
|
@@ -75,12 +75,23 @@ git clone --depth=1 https://github.com/triggerdotdev/trigger.dev
|
|
|
75
75
|
cd trigger.dev/hosting/docker
|
|
76
76
|
```
|
|
77
77
|
|
|
78
|
-
2. Create a `.env` file
|
|
78
|
+
2. Create a `.env` file and generate secrets
|
|
79
79
|
|
|
80
80
|
```bash
|
|
81
81
|
cp .env.example .env
|
|
82
|
+
|
|
83
|
+
# Fills the required secrets in .env with strong, unique values.
|
|
84
|
+
# Safe to re-run - it never overwrites a secret you've already set.
|
|
85
|
+
./generate-secrets.sh
|
|
82
86
|
```
|
|
83
87
|
|
|
88
|
+
<Note>
|
|
89
|
+
The stack ships no working default credentials. `generate-secrets.sh` fills the
|
|
90
|
+
application secrets and the bundled datastore passwords with strong, unique values.
|
|
91
|
+
Keep them safe - rotating the encryption key or session secret later will invalidate
|
|
92
|
+
existing sessions and encrypted data.
|
|
93
|
+
</Note>
|
|
94
|
+
|
|
84
95
|
3. Start the webapp
|
|
85
96
|
|
|
86
97
|
```bash
|
|
@@ -130,6 +141,13 @@ docker compose up -d
|
|
|
130
141
|
|
|
131
142
|
4. Configure the supervisor using the [environment variables](/self-hosting/env/supervisor) in your `.env` file, including the [worker token](#worker-token).
|
|
132
143
|
|
|
144
|
+
<Warning>
|
|
145
|
+
For a split webapp/worker setup, set `MANAGED_WORKER_SECRET` on the worker to
|
|
146
|
+
the **same** value as the webapp's `MANAGED_WORKER_SECRET`. Don't run
|
|
147
|
+
`generate-secrets.sh` on the worker host - it would create a mismatched value
|
|
148
|
+
and the worker would fail to authenticate.
|
|
149
|
+
</Warning>
|
|
150
|
+
|
|
133
151
|
5. Apply the changes:
|
|
134
152
|
|
|
135
153
|
```bash
|
|
@@ -11,7 +11,8 @@ mode: "wide"
|
|
|
11
11
|
| `SESSION_SECRET` | Yes | — | Session encryption secret. Run: `openssl rand -hex 16` |
|
|
12
12
|
| `MAGIC_LINK_SECRET` | Yes | — | Magic link encryption secret. Run: `openssl rand -hex 16` |
|
|
13
13
|
| `ENCRYPTION_KEY` | Yes | — | Secret store encryption key. Run: `openssl rand -hex 16` |
|
|
14
|
-
| `MANAGED_WORKER_SECRET` |
|
|
14
|
+
| `MANAGED_WORKER_SECRET` | Yes | — | Managed worker secret. Must be set and match supervisor. Run: `openssl rand -hex 32` |
|
|
15
|
+
| `ALLOW_INSECURE_DEFAULT_SECRETS` | No | false | Boot even if a secret is still a known-insecure published default. Temporary escape hatch for values you can't safely rotate yet (see [Secret generation and rotation](/self-hosting/kubernetes#secret-generation-and-rotation)). |
|
|
15
16
|
| **Domains & ports** | | | |
|
|
16
17
|
| `REMIX_APP_PORT` | No | 3030 | Remix app port. |
|
|
17
18
|
| `APP_ORIGIN` | Yes | http://localhost:3030 | App origin URL. |
|
|
@@ -121,8 +121,10 @@ The default values are insecure and are only suitable for testing. You will need
|
|
|
121
121
|
Create a `values-custom.yaml` file to override the defaults. For example:
|
|
122
122
|
|
|
123
123
|
```yaml
|
|
124
|
-
#
|
|
125
|
-
#
|
|
124
|
+
# Leave these unset to have the chart auto-generate strong values on first
|
|
125
|
+
# install (retained across upgrades). Set them explicitly only if you need to
|
|
126
|
+
# control the value - e.g. sharing MANAGED_WORKER_SECRET with an external
|
|
127
|
+
# supervisor - or use an existingSecret.
|
|
126
128
|
secrets:
|
|
127
129
|
enabled: true
|
|
128
130
|
sessionSecret: "your-32-char-hex-secret-1"
|
|
@@ -133,6 +135,8 @@ secrets:
|
|
|
133
135
|
# - SESSION_SECRET
|
|
134
136
|
# - MAGIC_LINK_SECRET
|
|
135
137
|
# - ENCRYPTION_KEY
|
|
138
|
+
# - PROVIDER_SECRET
|
|
139
|
+
# - COORDINATOR_SECRET
|
|
136
140
|
# - MANAGED_WORKER_SECRET
|
|
137
141
|
# - OBJECT_STORE_ACCESS_KEY_ID
|
|
138
142
|
# - OBJECT_STORE_SECRET_ACCESS_KEY
|
|
@@ -176,6 +180,24 @@ helm upgrade -n trigger --install trigger \
|
|
|
176
180
|
-f values-custom.yaml
|
|
177
181
|
```
|
|
178
182
|
|
|
183
|
+
### Secret generation and rotation
|
|
184
|
+
|
|
185
|
+
Application, control-plane, and bundled-datastore secrets left unset are generated on
|
|
186
|
+
first install and **retained across `helm upgrade`** - they are never rotated
|
|
187
|
+
automatically, so sessions, encrypted data, and datastore volumes survive upgrades.
|
|
188
|
+
|
|
189
|
+
<Warning>
|
|
190
|
+
GitOps tools that render with `helm template` (e.g. Argo CD) cannot read the existing
|
|
191
|
+
secret, so they regenerate these values on every sync - which rotates them. If you
|
|
192
|
+
deploy via GitOps, always supply your own `secrets.existingSecret` (and datastore
|
|
193
|
+
credentials) so nothing is generated in-cluster.
|
|
194
|
+
</Warning>
|
|
195
|
+
|
|
196
|
+
There is no clean migration for a compromised `ENCRYPTION_KEY`: changing it makes
|
|
197
|
+
existing encrypted data unreadable. If a deployment is still running a previously
|
|
198
|
+
published default and cannot rotate yet, set `ALLOW_INSECURE_DEFAULT_SECRETS=true` on
|
|
199
|
+
the webapp to keep booting while you plan a migration.
|
|
200
|
+
|
|
179
201
|
### Extra env
|
|
180
202
|
|
|
181
203
|
You can set extra environment variables on all services. For example:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trigger.dev/sdk",
|
|
3
|
-
"version": "4.5.
|
|
3
|
+
"version": "4.5.7",
|
|
4
4
|
"description": "trigger.dev Node.JS SDK",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"dependencies": {
|
|
67
67
|
"@opentelemetry/api": "1.9.1",
|
|
68
68
|
"@opentelemetry/semantic-conventions": "1.41.1",
|
|
69
|
-
"@trigger.dev/core": "4.5.
|
|
69
|
+
"@trigger.dev/core": "4.5.7",
|
|
70
70
|
"chalk": "^5.2.0",
|
|
71
71
|
"cronstrue": "^2.21.0",
|
|
72
72
|
"debug": "^4.3.4",
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
},
|
|
79
79
|
"devDependencies": {
|
|
80
80
|
"@ai-sdk/provider": "3.0.8",
|
|
81
|
-
"@arethetypeswrong/cli": "^0.
|
|
81
|
+
"@arethetypeswrong/cli": "^0.18.5",
|
|
82
82
|
"@types/debug": "^4.1.7",
|
|
83
83
|
"@types/react": "^19.2.14",
|
|
84
84
|
"@types/slug": "^5.0.3",
|