Skip to content

Commit aa59c89

Browse files
committed
Merge remote-tracking branch 'origin/main' into fix/wait-with-suspend
2 parents b27734b + 6d819c6 commit aa59c89

File tree

93 files changed

+3916
-545
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

93 files changed

+3916
-545
lines changed

.changeset/honest-files-decide.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@trigger.dev/sdk": patch
3+
---
4+
5+
Deprecate toolTask and replace with `ai.tool(mySchemaTask)`

.github/workflows/publish.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,14 @@ jobs:
5656
secrets: inherit
5757

5858
publish-webapp:
59-
needs: [typecheck, units]
59+
needs: [typecheck]
6060
uses: ./.github/workflows/publish-webapp.yml
6161
secrets: inherit
6262
with:
6363
image_tag: ${{ inputs.image_tag }}
6464

6565
publish-worker:
66-
needs: [typecheck, units]
66+
needs: [typecheck]
6767
uses: ./.github/workflows/publish-worker.yml
6868
secrets: inherit
6969
with:

.vscode/launch.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,14 @@
149149
"command": "pnpm run test ./src/run-queue/index.test.ts",
150150
"cwd": "${workspaceFolder}/internal-packages/run-engine",
151151
"sourceMaps": true
152+
},
153+
{
154+
"type": "node-terminal",
155+
"request": "launch",
156+
"name": "Debug d3-demo",
157+
"command": "pnpm exec trigger dev",
158+
"cwd": "${workspaceFolder}/references/d3-demo",
159+
"sourceMaps": true
152160
}
153161
]
154162
}

apps/webapp/app/components/runs/v3/RunIcon.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ export function RunIcon({ name, className, spanName }: TaskIconProps) {
7373
case "trigger":
7474
return <TriggerIcon className={cn(className, "text-orange-500")} />;
7575
case "python":
76-
return <PythonLogoIcon />;
76+
return <PythonLogoIcon className={className} />;
7777
//log levels
7878
case "debug":
7979
case "log":

apps/webapp/app/env.server.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -573,6 +573,8 @@ const EnvironmentSchema = z.object({
573573
RUN_ENGINE_RELEASE_CONCURRENCY_POLL_INTERVAL: z.coerce.number().int().default(500),
574574
RUN_ENGINE_RELEASE_CONCURRENCY_BATCH_SIZE: z.coerce.number().int().default(10),
575575

576+
RUN_ENGINE_WORKER_ENABLED: z.string().default("1"),
577+
576578
/** How long should the presence ttl last */
577579
DEV_PRESENCE_SSE_TIMEOUT: z.coerce.number().int().default(30_000),
578580
DEV_PRESENCE_TTL_MS: z.coerce.number().int().default(5_000),

apps/webapp/app/v3/engineVersion.server.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { RunEngineVersion, type RuntimeEnvironmentType } from "@trigger.dev/database";
2+
import { $replica } from "~/db.server";
23
import {
3-
findCurrentWorkerDeploymentWithoutTasks,
44
findCurrentWorkerFromEnvironment,
5+
getCurrentWorkerDeploymentEngineVersion,
56
} from "./models/workerDeployment.server";
6-
import { $replica } from "~/db.server";
77

88
type Environment = {
99
id: string;
@@ -65,10 +65,12 @@ export async function determineEngineVersion({
6565
}
6666

6767
// Deployed: use the latest deployed BackgroundWorker
68-
const currentDeployment = await findCurrentWorkerDeploymentWithoutTasks(environment.id);
69-
if (currentDeployment?.type === "V1") {
70-
return "V1";
68+
const currentDeploymentEngineVersion = await getCurrentWorkerDeploymentEngineVersion(
69+
environment.id
70+
);
71+
if (currentDeploymentEngineVersion) {
72+
return currentDeploymentEngineVersion;
7173
}
7274

73-
return "V2";
75+
return environment.project.engine;
7476
}

apps/webapp/app/v3/models/workerDeployment.server.ts

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { Prettify } from "@trigger.dev/core";
2-
import { BackgroundWorker, WorkerDeployment } from "@trigger.dev/database";
2+
import { BackgroundWorker, RunEngineVersion, WorkerDeployment } from "@trigger.dev/database";
33
import {
44
CURRENT_DEPLOYMENT_LABEL,
55
CURRENT_UNMANAGED_DEPLOYMENT_LABEL,
@@ -91,23 +91,29 @@ export async function findCurrentWorkerDeployment(
9191
return promotion?.deployment;
9292
}
9393

94-
export async function findCurrentWorkerDeploymentWithoutTasks(
94+
export async function getCurrentWorkerDeploymentEngineVersion(
9595
environmentId: string,
9696
label = CURRENT_DEPLOYMENT_LABEL
97-
): Promise<WorkerDeployment | undefined> {
98-
const promotion = await prisma.workerDeploymentPromotion.findUnique({
97+
): Promise<RunEngineVersion | undefined> {
98+
const promotion = await prisma.workerDeploymentPromotion.findFirst({
9999
where: {
100-
environmentId_label: {
101-
environmentId,
102-
label,
103-
},
100+
environmentId,
101+
label,
104102
},
105-
include: {
106-
deployment: true,
103+
select: {
104+
deployment: {
105+
select: {
106+
type: true,
107+
},
108+
},
107109
},
108110
});
109111

110-
return promotion?.deployment;
112+
if (typeof promotion?.deployment.type === "string") {
113+
return promotion.deployment.type === "V1" ? "V1" : "V2";
114+
}
115+
116+
return undefined;
111117
}
112118

113119
export async function findCurrentUnmanagedWorkerDeployment(

apps/webapp/app/v3/otlpExporter.server.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ class OTLPExporter {
5757

5858
const enrichedEvents = enrichCreatableEvents(events);
5959

60-
this.#logEventsVerbose(enrichedEvents);
60+
this.#logEventsVerbose(enrichedEvents, "exportTraces");
6161

6262
span.setAttribute("event_count", enrichedEvents.length);
6363

@@ -84,7 +84,7 @@ class OTLPExporter {
8484

8585
const enrichedEvents = enrichCreatableEvents(events);
8686

87-
this.#logEventsVerbose(enrichedEvents);
87+
this.#logEventsVerbose(enrichedEvents, "exportLogs");
8888

8989
span.setAttribute("event_count", enrichedEvents.length);
9090

@@ -98,11 +98,11 @@ class OTLPExporter {
9898
});
9999
}
100100

101-
#logEventsVerbose(events: CreatableEvent[]) {
101+
#logEventsVerbose(events: CreatableEvent[], prefix: string) {
102102
if (!this._verbose) return;
103103

104104
events.forEach((event) => {
105-
logger.debug("Exporting event", { event });
105+
logger.debug(`Exporting ${prefix} event`, { event });
106106
});
107107
}
108108

apps/webapp/app/v3/runEngine.server.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ function createRunEngine() {
1414
const engine = new RunEngine({
1515
prisma,
1616
worker: {
17+
disabled: env.RUN_ENGINE_WORKER_ENABLED === "0",
1718
workers: env.RUN_ENGINE_WORKER_COUNT,
1819
tasksPerWorker: env.RUN_ENGINE_TASKS_PER_WORKER,
1920
pollIntervalMs: env.RUN_ENGINE_WORKER_POLL_INTERVAL,

apps/webapp/app/v3/utils/enrichCreatableEvents.server.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ function enrichStyle(event: CreatableEvent) {
2323
// GenAI System check
2424
const system = props["gen_ai.system"];
2525
if (typeof system === "string") {
26-
return { ...baseStyle, icon: `tabler-brand-${system}` };
26+
return { ...baseStyle, icon: `tabler-brand-${system.split(".")[0]}` };
2727
}
2828

2929
// Agent workflow check
@@ -32,6 +32,16 @@ function enrichStyle(event: CreatableEvent) {
3232
return { ...baseStyle, icon: "tabler-brain" };
3333
}
3434

35+
const message = event.message;
36+
37+
if (typeof message === "string" && message === "ai.toolCall") {
38+
return { ...baseStyle, icon: "tabler-tool" };
39+
}
40+
41+
if (typeof message === "string" && message.startsWith("ai.")) {
42+
return { ...baseStyle, icon: "tabler-sparkles" };
43+
}
44+
3545
return baseStyle;
3646
}
3747

0 commit comments

Comments
 (0)