Distinguish services from scripts with type system and runtime tracking
This commit is contained in:
@@ -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", () => {
|
||||
|
||||
Reference in New Issue
Block a user