Distinguish services from scripts with type system and runtime tracking

This commit is contained in:
Mohamed Boudra
2026-04-09 23:45:00 +07:00
parent c7399084a4
commit b1b85833bb
27 changed files with 1265 additions and 493 deletions
+2
View File
@@ -1820,11 +1820,13 @@ export const WorkspaceScriptHealthSchema = z.enum(["healthy", "unhealthy"]);
export const WorkspaceScriptPayloadSchema = z.object({
scriptName: z.string(),
type: z.enum(["script", "service"]).optional().default("service"),
hostname: z.string(),
port: z.number().int().positive().nullable(),
url: z.string().nullable(),
lifecycle: WorkspaceScriptLifecycleSchema,
health: WorkspaceScriptHealthSchema.nullable(),
exitCode: z.number().nullable().optional().default(null),
});
export const WorkspaceDescriptorPayloadSchema = z.object({
@@ -155,11 +155,13 @@ describe("workspace message schemas", () => {
expect(parsed.payload.workspace.scripts).toEqual([
{
scriptName: "web",
type: "service",
hostname: "web.localhost",
port: 3000,
url: "http://web.localhost:6767",
lifecycle: "running",
health: "healthy",
exitCode: null,
},
]);
});
@@ -213,6 +215,10 @@ describe("workspace message schemas", () => {
expect(parsed.type).toBe("script_status_update");
expect(parsed.payload.workspaceId).toBe("/repo");
expect(parsed.payload.scripts[0]).toMatchObject({
type: "service",
exitCode: null,
});
});
test("parses workspace_setup_progress payload", () => {