Extract client SDK package (#1052)
* Extract client SDK package * Polish SDK client identity defaults * Build client before dependent CI jobs * Restore daemon client server export * Extract protocol and client SDK packages * Fix provider override schema validation * Fix app test daemon client imports * Simplify workspace build targets * Fix CLI test server build bootstrap * Run SDK package tests in CI * Fix rebase package split drift * Restore lockfile registry metadata * Update SDK config test for prompt default * Move terminal stream router test to client package * Fix rebase drift for protocol imports * Fix SDK agent capability fixture * Restore legacy server client exports * Fix server export compatibility test * Advertise custom mode icon client capability * Remove server daemon-client exports * Format rebased mode control import * Fix rebase drift for protocol imports Files added by upstream PRs (#893, #1147, #1154) referenced the pre-split shared/ paths that this branch moves into @getpaseo/protocol. Redirect those imports to the protocol package so typecheck stays green after the rebase.
This commit is contained in:
@@ -0,0 +1,176 @@
|
||||
import { z } from "zod";
|
||||
import {
|
||||
ScheduleCadenceSchema,
|
||||
ScheduleRunSchema,
|
||||
ScheduleSummarySchema,
|
||||
StoredScheduleSchema,
|
||||
ScheduleTargetSchema,
|
||||
} from "./types.js";
|
||||
|
||||
const ScheduleCreateTargetSchema = z.discriminatedUnion("type", [
|
||||
z.object({
|
||||
type: z.literal("self"),
|
||||
agentId: z.string().uuid(),
|
||||
}),
|
||||
z.object({
|
||||
type: z.literal("agent"),
|
||||
agentId: z.string().uuid(),
|
||||
}),
|
||||
z.object({
|
||||
type: z.literal("new-agent"),
|
||||
config: ScheduleTargetSchema.options[1].shape.config,
|
||||
}),
|
||||
]);
|
||||
|
||||
export const ScheduleCreateRequestSchema = z.object({
|
||||
type: z.literal("schedule/create"),
|
||||
requestId: z.string(),
|
||||
prompt: z.string().min(1),
|
||||
name: z.string().optional(),
|
||||
cadence: ScheduleCadenceSchema,
|
||||
target: ScheduleCreateTargetSchema,
|
||||
maxRuns: z.number().int().positive().optional(),
|
||||
expiresAt: z.string().optional(),
|
||||
runOnCreate: z.boolean().optional(),
|
||||
});
|
||||
|
||||
export const ScheduleListRequestSchema = z.object({
|
||||
type: z.literal("schedule/list"),
|
||||
requestId: z.string(),
|
||||
});
|
||||
|
||||
export const ScheduleInspectRequestSchema = z.object({
|
||||
type: z.literal("schedule/inspect"),
|
||||
requestId: z.string(),
|
||||
scheduleId: z.string(),
|
||||
});
|
||||
|
||||
export const ScheduleLogsRequestSchema = z.object({
|
||||
type: z.literal("schedule/logs"),
|
||||
requestId: z.string(),
|
||||
scheduleId: z.string(),
|
||||
});
|
||||
|
||||
export const SchedulePauseRequestSchema = z.object({
|
||||
type: z.literal("schedule/pause"),
|
||||
requestId: z.string(),
|
||||
scheduleId: z.string(),
|
||||
});
|
||||
|
||||
export const ScheduleResumeRequestSchema = z.object({
|
||||
type: z.literal("schedule/resume"),
|
||||
requestId: z.string(),
|
||||
scheduleId: z.string(),
|
||||
});
|
||||
|
||||
export const ScheduleDeleteRequestSchema = z.object({
|
||||
type: z.literal("schedule/delete"),
|
||||
requestId: z.string(),
|
||||
scheduleId: z.string(),
|
||||
});
|
||||
|
||||
export const ScheduleRunOnceRequestSchema = z.object({
|
||||
type: z.literal("schedule/run-once"),
|
||||
requestId: z.string(),
|
||||
scheduleId: z.string(),
|
||||
});
|
||||
|
||||
const ScheduleUpdateNewAgentConfigSchema = z.object({
|
||||
provider: z.string().trim().min(1).optional(),
|
||||
model: z.string().trim().min(1).nullable().optional(),
|
||||
modeId: z.string().trim().min(1).nullable().optional(),
|
||||
cwd: z.string().trim().min(1).optional(),
|
||||
});
|
||||
|
||||
export const ScheduleUpdateRequestSchema = z.object({
|
||||
type: z.literal("schedule/update"),
|
||||
requestId: z.string(),
|
||||
scheduleId: z.string(),
|
||||
name: z.string().nullable().optional(),
|
||||
prompt: z.string().min(1).optional(),
|
||||
cadence: ScheduleCadenceSchema.optional(),
|
||||
newAgentConfig: ScheduleUpdateNewAgentConfigSchema.optional(),
|
||||
maxRuns: z.number().int().positive().nullable().optional(),
|
||||
expiresAt: z.string().nullable().optional(),
|
||||
});
|
||||
|
||||
export const ScheduleCreateResponseSchema = z.object({
|
||||
type: z.literal("schedule/create/response"),
|
||||
payload: z.object({
|
||||
requestId: z.string(),
|
||||
schedule: ScheduleSummarySchema.nullable(),
|
||||
error: z.string().nullable(),
|
||||
}),
|
||||
});
|
||||
|
||||
export const ScheduleListResponseSchema = z.object({
|
||||
type: z.literal("schedule/list/response"),
|
||||
payload: z.object({
|
||||
requestId: z.string(),
|
||||
schedules: z.array(ScheduleSummarySchema),
|
||||
error: z.string().nullable(),
|
||||
}),
|
||||
});
|
||||
|
||||
export const ScheduleInspectResponseSchema = z.object({
|
||||
type: z.literal("schedule/inspect/response"),
|
||||
payload: z.object({
|
||||
requestId: z.string(),
|
||||
schedule: StoredScheduleSchema.nullable(),
|
||||
error: z.string().nullable(),
|
||||
}),
|
||||
});
|
||||
|
||||
export const ScheduleLogsResponseSchema = z.object({
|
||||
type: z.literal("schedule/logs/response"),
|
||||
payload: z.object({
|
||||
requestId: z.string(),
|
||||
runs: z.array(ScheduleRunSchema),
|
||||
error: z.string().nullable(),
|
||||
}),
|
||||
});
|
||||
|
||||
export const SchedulePauseResponseSchema = z.object({
|
||||
type: z.literal("schedule/pause/response"),
|
||||
payload: z.object({
|
||||
requestId: z.string(),
|
||||
schedule: ScheduleSummarySchema.nullable(),
|
||||
error: z.string().nullable(),
|
||||
}),
|
||||
});
|
||||
|
||||
export const ScheduleResumeResponseSchema = z.object({
|
||||
type: z.literal("schedule/resume/response"),
|
||||
payload: z.object({
|
||||
requestId: z.string(),
|
||||
schedule: ScheduleSummarySchema.nullable(),
|
||||
error: z.string().nullable(),
|
||||
}),
|
||||
});
|
||||
|
||||
export const ScheduleDeleteResponseSchema = z.object({
|
||||
type: z.literal("schedule/delete/response"),
|
||||
payload: z.object({
|
||||
requestId: z.string(),
|
||||
scheduleId: z.string(),
|
||||
error: z.string().nullable(),
|
||||
}),
|
||||
});
|
||||
|
||||
export const ScheduleRunOnceResponseSchema = z.object({
|
||||
type: z.literal("schedule/run-once/response"),
|
||||
payload: z.object({
|
||||
requestId: z.string(),
|
||||
schedule: StoredScheduleSchema.nullable(),
|
||||
error: z.string().nullable(),
|
||||
}),
|
||||
});
|
||||
|
||||
export const ScheduleUpdateResponseSchema = z.object({
|
||||
type: z.literal("schedule/update/response"),
|
||||
payload: z.object({
|
||||
requestId: z.string(),
|
||||
schedule: StoredScheduleSchema.nullable(),
|
||||
error: z.string().nullable(),
|
||||
}),
|
||||
});
|
||||
Reference in New Issue
Block a user