Export explicit control protocol domain types

This commit is contained in:
Timothy J. Aveni
2026-06-25 20:54:08 -07:00
parent e827230d95
commit c639c579f4
+572 -226
View File
@@ -656,232 +656,578 @@ export const ControlPlaneCutoverResponseSchema = z.object({
packages: z.array(ControlPlaneRunningPackageSchema), packages: z.array(ControlPlaneRunningPackageSchema),
}); });
export type ControlPlaneRunRequest = z.output< export type ControlPlaneRunRequest = {
typeof ControlPlaneRunRequestSchema target: string;
>; };
export type ControlPlaneCheckRequest = z.output<
typeof ControlPlaneCheckRequestSchema export type ControlPlaneCheckRequest = {
>; packageName: string;
export type ControlPlaneCutoverRequest = z.output< rev: string;
typeof ControlPlaneCutoverRequestSchema };
>;
export type ControlPlaneClearStateRequest = z.output< export type ControlPlaneCutoverRequest = {
typeof ControlPlaneClearStateRequestSchema targets: string[];
>; };
export type ControlPlaneDescribeRequest = z.output<
typeof ControlPlaneDescribeRequestSchema export type ControlPlaneClearStateRequest = {
>; packageName: string;
export type ControlPlaneLogsRequest = z.output< recursive?: boolean;
typeof ControlPlaneLogsRequestSchema };
>;
export type ControlPlaneErrorsRequest = z.output< export type ControlPlaneDescribeRequest = ControlPlaneCheckRequest;
typeof ControlPlaneErrorsRequestSchema
>; export type ControlPlaneLogsRequest = {
export type ControlPlaneReplEvalRequest = z.output< packageName: string;
typeof ControlPlaneReplEvalRequestSchema tail?: number;
>; stream?: "stdout" | "stderr" | "all";
export type ControlPlaneReplCloseRequest = z.output< };
typeof ControlPlaneReplCloseRequestSchema
>; export type ControlPlaneErrorsRequest = {
export type ControlPlaneDeviceTarget = z.output< packageName?: string;
typeof ControlPlaneDeviceTargetSchema stateContextId?: string;
>; tail?: number;
export type ControlPlaneDeviceViewport = z.output< acknowledge?: boolean;
typeof ControlPlaneDeviceViewportSchema };
>;
export type ControlPlaneDevice = z.output<typeof ControlPlaneDeviceSchema>; export type ControlPlaneReplEvalRequest = {
export type ControlPlaneDevicesResponse = z.output< sessionId?: string;
typeof ControlPlaneDevicesResponseSchema code: string;
>; autoClose?: boolean;
export type ControlPlaneDeviceAssignRequest = z.output< defaultStateContextId: string | null;
typeof ControlPlaneDeviceAssignRequestSchema };
>;
export type ControlPlaneDeviceRenameRequest = z.output< export type ControlPlaneReplCloseRequest = {
typeof ControlPlaneDeviceRenameRequestSchema sessionId: string;
>; };
export type ControlPlaneDeviceRemoveRequest = z.output<
typeof ControlPlaneDeviceRemoveRequestSchema export type ControlPlaneDeviceTarget = {
>; packageName: string;
export type ControlPlaneDeviceIdentifyRequest = z.output< stateContextId: string;
typeof ControlPlaneDeviceIdentifyRequestSchema surfaceId: string;
>; requestFullscreen?: boolean;
export type ControlPlaneDeviceSessionRequest = z.output< };
typeof ControlPlaneDeviceSessionRequestSchema
>; export type ControlPlaneDeviceViewport = {
export type ControlPlaneDeviceSessionResponse = z.output< width: number;
typeof ControlPlaneDeviceSessionResponseSchema height: number;
>; pixelRatio: number | null;
export type ControlPlanePublicAccessTarget = z.output< };
typeof ControlPlanePublicAccessTargetSchema
>; export type ControlPlaneDevice = {
export type ControlPlanePublicAuthGrantRequest = z.output< deviceId: string;
typeof ControlPlanePublicAuthGrantRequestSchema name: string | null;
>; createdAt: string;
export type ControlPlanePublicAuthGrantResponse = z.output< lastSeenAt: string | null;
typeof ControlPlanePublicAuthGrantResponseSchema connected: boolean;
>; assignment: ControlPlaneDeviceTarget | null;
export type ControlPlanePublicAuthGrantRevokeRequest = z.output< configuredAssignment: ControlPlaneDeviceTarget | null;
typeof ControlPlanePublicAuthGrantRevokeRequestSchema identifyUntil: string | null;
>; lastUserAgent: string | null;
export type ControlPlanePublicAuthGrantRevokeResponse = z.output< viewport: ControlPlaneDeviceViewport | null;
typeof ControlPlanePublicAuthGrantRevokeResponseSchema };
>;
export type ControlPlanePublicSessionRequest = z.output< export type ControlPlaneDevicesResponse = {
typeof ControlPlanePublicSessionRequestSchema devices: ControlPlaneDevice[];
>; };
export type ControlPlanePublicSessionResponse = z.output<
typeof ControlPlanePublicSessionResponseSchema export type ControlPlaneDeviceAssignRequest = {
>; deviceId: string;
export type ControlPlaneSurfaceSessionRequest = z.output< target: ControlPlaneDeviceTarget | null;
typeof ControlPlaneSurfaceSessionRequestSchema };
>;
export type ControlPlaneSurfaceSessionResponse = z.output< export type ControlPlaneDeviceRenameRequest = {
typeof ControlPlaneSurfaceSessionResponseSchema deviceId: string;
>; name: string | null;
export type ControlPlaneWorkspacePackage = z.output< };
typeof ControlPlaneWorkspacePackageSchema
>; export type ControlPlaneDeviceRemoveRequest = {
export type ControlPlaneStateContext = z.output< deviceId: string;
typeof ControlPlaneStateContextSchema };
>;
export type ControlPlaneBrowserAuthMessage = z.output< export type ControlPlaneDeviceIdentifyRequest = {
typeof ControlPlaneBrowserAuthMessageSchema deviceId: string;
>; durationMs?: number;
export type ControlPlaneBrowserOpenRootContextParams = z.output< };
typeof ControlPlaneBrowserOpenRootContextParamsSchema
>; export type ControlPlaneDeviceSessionRequest = {
export type ControlPlaneBrowserOpenDerivedContextParams = z.output< deviceId: string;
typeof ControlPlaneBrowserOpenDerivedContextParamsSchema sessionToken: string;
>; requestedTarget?: ControlPlaneDeviceTarget | null;
export type ControlPlaneBrowserCloseStateContextParams = z.output< userAgent: string | null;
typeof ControlPlaneBrowserCloseStateContextParamsSchema viewport: ControlPlaneDeviceViewport | null;
>; };
export type ControlPlaneBrowserCallParams = z.output<
typeof ControlPlaneBrowserCallParamsSchema export type ControlPlaneDeviceSessionResponse = {
>; device: ControlPlaneDevice;
export type ControlPlaneBrowserValueGetParams = z.output< };
typeof ControlPlaneBrowserValueGetParamsSchema
>; export type ControlPlanePublicAccessTarget =
export type ControlPlaneBrowserSubscribeParams = z.output< | {
typeof ControlPlaneBrowserSubscribeParamsSchema kind: "device";
>; target?: ControlPlaneDeviceTarget | null;
export type ControlPlaneBrowserUnsubscribeParams = z.output< }
typeof ControlPlaneBrowserUnsubscribeParamsSchema | {
>; kind: "browser-surface";
export type ControlPlaneBrowserSubscriptionReadyParams = z.output< packageName?: string;
typeof ControlPlaneBrowserSubscriptionReadyParamsSchema stateContextId: string;
>; surfaceId: string;
export type ControlPlaneBrowserRequestMessage = z.output< requestFullscreen?: boolean;
typeof ControlPlaneBrowserRequestMessageSchema }
>; | {
export type ControlPlaneBrowserClientMessage = z.output< kind: "remote-dom";
typeof ControlPlaneBrowserClientMessageSchema packageName?: string;
>; stateContextId: string;
export type ControlPlaneBrowserResponseMessage = z.output< };
typeof ControlPlaneBrowserResponseMessageSchema
>; export type ControlPlanePublicAuthGrantRequest = {
export type ControlPlaneBrowserSubscriptionDataMessage = z.output< target: ControlPlanePublicAccessTarget;
typeof ControlPlaneBrowserSubscriptionDataMessageSchema };
>;
export type ControlPlaneBrowserAuthAckMessage = z.output< export type ControlPlanePublicAuthGrantResponse = {
typeof ControlPlaneBrowserAuthAckMessageSchema authGrant: string;
>; target: ControlPlanePublicAccessTarget;
export type ControlPlaneBrowserStatusInvalidatedMessage = z.output< };
typeof ControlPlaneBrowserStatusInvalidatedMessageSchema
>; export type ControlPlanePublicAuthGrantRevokeRequest = {
export type ControlPlaneBrowserServerMessage = z.output< authGrant: string;
typeof ControlPlaneBrowserServerMessageSchema };
>;
export type ControlPlaneDeviceSocketConnectMessage = z.output< export type ControlPlanePublicAuthGrantRevokeResponse = {
typeof ControlPlaneDeviceSocketConnectMessageSchema revoked: boolean;
>; };
export type ControlPlaneDeviceSocketUpdateMessage = z.output<
typeof ControlPlaneDeviceSocketUpdateMessageSchema export type ControlPlanePublicSessionRequest = {
>; authGrant: string;
export type ControlPlaneDeviceSocketClientMessage = z.output< };
typeof ControlPlaneDeviceSocketClientMessageSchema
>; export type ControlPlanePublicSessionResponse = {
export type ControlPlaneDeviceSocketReadyMessage = z.output< sessionToken: string;
typeof ControlPlaneDeviceSocketReadyMessageSchema target: ControlPlanePublicAccessTarget;
>; expiresAt: string;
export type ControlPlaneDeviceSocketStateMessage = z.output< };
typeof ControlPlaneDeviceSocketStateMessageSchema
>; export type ControlPlaneSurfaceSessionRequest = {
export type ControlPlaneDeviceSocketRemovedMessage = z.output< target: Extract<
typeof ControlPlaneDeviceSocketRemovedMessageSchema ControlPlanePublicAccessTarget,
>; { kind: "browser-surface" | "remote-dom" }
export type ControlPlaneDeviceSocketServerMessage = z.output< >;
typeof ControlPlaneDeviceSocketServerMessageSchema };
>;
export type ControlPlanePackageLogEntry = z.output< export type ControlPlaneSurfaceSessionResponse = {
typeof ControlPlanePackageLogEntrySchema sessionToken: string;
>; target: ControlPlaneSurfaceSessionRequest["target"];
export type ControlPlaneRuntimeErrorPhase = z.output< expiresAt: string;
typeof ControlPlaneRuntimeErrorPhaseSchema };
>;
export type ControlPlanePackageErrorEntry = z.output< export type ControlPlaneWorkspacePackage = {
typeof ControlPlanePackageErrorEntrySchema packageName: string;
>; headCommit: string;
export type ControlPlaneLogsResponse = z.output< ignored: boolean;
typeof ControlPlaneLogsResponseSchema };
>;
export type ControlPlaneErrorsResponse = z.output< export type ControlPlaneStateContext = {
typeof ControlPlaneErrorsResponseSchema id: string;
>; packageName: string;
export type ControlPlaneReplLogEntry = z.output< packageRef: string;
typeof ControlPlaneReplLogEntrySchema createdAt: string;
>; parentStateContextId: string | null;
export type ControlPlaneReplSession = z.output< namespace: string | null;
typeof ControlPlaneReplSessionSchema kind: "root" | "derived";
>; };
export type ControlPlaneReplEvalResponse = z.output<
typeof ControlPlaneReplEvalResponseSchema export type ControlPlaneBrowserAuthMessage = {
>; type: "auth";
export type ControlPlaneReplCloseResponse = z.output< secret: string;
typeof ControlPlaneReplCloseResponseSchema };
>;
export type ControlPlaneRemoteDomPayload = z.output< export type ControlPlaneBrowserOpenRootContextParams = {
typeof ControlPlaneRemoteDomPayloadSchema target: string;
>; };
export type ControlPlaneDependencyInput = z.output<
typeof ControlPlaneDependencyInputSchema export type ControlPlaneBrowserOpenDerivedContextParams = {
>; target: string;
export type ControlPlaneDependencyNode = z.output< targetPackageName?: string;
typeof ControlPlaneDependencyNodeSchema callerStateContextId: string;
>; contextNamespace: string | null;
export type ControlPlaneDependencyGraph = z.output< };
typeof ControlPlaneDependencyGraphSchema
>; export type ControlPlaneBrowserCloseStateContextParams = {
export type ControlPlaneRunningPackage = z.output< stateContextId: string;
typeof ControlPlaneRunningPackageSchema };
>;
export type ControlPlaneCheckStatus = z.output< export type ControlPlaneBrowserCallParams = {
typeof ControlPlaneCheckResultSchema target: string;
>["status"]; functionName: string;
export type ControlPlaneCheckResult = z.output< params: unknown;
typeof ControlPlaneCheckResultSchema stateContextId: string;
>; };
export type ControlPlaneSchemaResourceDescription = z.output<
typeof ControlPlaneSchemaResourceDescriptionSchema export type ControlPlaneBrowserValueGetParams = {
>; target: string;
export type ControlPlanePackageSchemaDescription = z.output< valueName: string;
typeof ControlPlanePackageSchemaDescriptionSchema params: unknown;
>; stateContextId: string;
export type ControlPlaneSchemaDescriptionResult = z.output< };
typeof ControlPlaneSchemaDescriptionResultSchema
>; export type ControlPlaneBrowserSubscribeParams = {
export type ControlPlaneRunResponse = z.output< target: string;
typeof ControlPlaneRunResponseSchema resourceName: string;
>; params: unknown;
export type ControlPlaneClearStateResponse = z.output< stateContextId: string;
typeof ControlPlaneClearStateResponseSchema subscriptionNamespace: string | null;
>; };
export type ControlPlaneStatusResponse = z.output<
typeof ControlPlaneStatusResponseSchema export type ControlPlaneBrowserUnsubscribeParams = {
>; subscriptionId: string;
export type ControlPlaneCutoverResponse = z.output< };
typeof ControlPlaneCutoverResponseSchema
>; export type ControlPlaneBrowserSubscriptionReadyParams =
ControlPlaneBrowserUnsubscribeParams;
export type ControlPlaneBrowserRequestMessage =
| {
type: "request";
requestId: string;
method: "open-root-context";
params: ControlPlaneBrowserOpenRootContextParams;
}
| {
type: "request";
requestId: string;
method: "open-derived-context";
params: ControlPlaneBrowserOpenDerivedContextParams;
}
| {
type: "request";
requestId: string;
method: "close-state-context";
params: ControlPlaneBrowserCloseStateContextParams;
}
| {
type: "request";
requestId: string;
method: "call";
params: ControlPlaneBrowserCallParams;
}
| {
type: "request";
requestId: string;
method: "value-get";
params: ControlPlaneBrowserValueGetParams;
}
| {
type: "request";
requestId: string;
method: "event-subscribe";
params: ControlPlaneBrowserSubscribeParams;
}
| {
type: "request";
requestId: string;
method: "value-watch";
params: ControlPlaneBrowserSubscribeParams;
}
| {
type: "request";
requestId: string;
method: "unsubscribe";
params: ControlPlaneBrowserUnsubscribeParams;
}
| {
type: "request";
requestId: string;
method: "subscription-ready";
params: ControlPlaneBrowserSubscriptionReadyParams;
};
export type ControlPlaneBrowserClientMessage =
| ControlPlaneBrowserAuthMessage
| ControlPlaneBrowserRequestMessage;
export type ControlPlaneBrowserResponseMessage =
| {
type: "response";
requestId: string;
ok: true;
result?: unknown;
}
| {
type: "response";
requestId: string;
ok: false;
error: string;
};
export type ControlPlaneBrowserSubscriptionDataMessage = {
type: "subscription-data";
subscriptionId: string;
data: unknown;
};
export type ControlPlaneBrowserAuthAckMessage = {
type: "auth-ack";
};
export type ControlPlaneBrowserStatusInvalidatedMessage = {
type: "status-invalidated";
reason:
| "state-context-opened"
| "state-context-closed"
| "running-packages-changed"
| "repl-sessions-changed"
| "runtime-errors-changed"
| "devices-changed";
};
export type ControlPlaneBrowserServerMessage =
| ControlPlaneBrowserAuthAckMessage
| ControlPlaneBrowserStatusInvalidatedMessage
| ControlPlaneBrowserResponseMessage
| ControlPlaneBrowserSubscriptionDataMessage;
export type ControlPlaneDeviceSocketConnectMessage = {
type: "device-connect";
deviceId: string;
sessionToken: string;
requestedTarget?: ControlPlaneDeviceTarget | null;
userAgent?: string | null;
viewport?: ControlPlaneDeviceViewport | null;
};
export type ControlPlaneDeviceSocketUpdateMessage = {
type: "device-update";
viewport?: ControlPlaneDeviceViewport | null;
};
export type ControlPlaneDeviceSocketClientMessage =
| ControlPlaneDeviceSocketConnectMessage
| ControlPlaneDeviceSocketUpdateMessage;
export type ControlPlaneDeviceSocketReadyMessage = {
type: "device-ready";
device: ControlPlaneDevice;
};
export type ControlPlaneDeviceSocketStateMessage = {
type: "device-state";
device: ControlPlaneDevice;
};
export type ControlPlaneDeviceSocketRemovedMessage = {
type: "device-removed";
deviceId: string;
};
export type ControlPlaneDeviceSocketServerMessage =
| ControlPlaneDeviceSocketReadyMessage
| ControlPlaneDeviceSocketStateMessage
| ControlPlaneDeviceSocketRemovedMessage;
export type ControlPlanePackageLogEntry = {
id: string;
createdAt: string;
packageName: string;
label: string;
processId: number | null;
stream: "stdout" | "stderr";
text: string;
};
export type ControlPlaneRuntimeErrorPhase =
| "on-create"
| "on-destroy"
| "on-context-open"
| "on-context-close"
| "browser-surface"
| "function"
| "event-subscribe"
| "event-cleanup"
| "value-get"
| "value-watch"
| "value-cleanup"
| "subscription-publish"
| "internal";
export type ControlPlanePackageErrorEntry = {
id: string;
createdAt: string;
packageName: string;
label: string | null;
processId: number | null;
stateContextId: string | null;
phase: ControlPlaneRuntimeErrorPhase;
functionName: string | null;
resourceKind: "event" | "value" | null;
resourceName: string | null;
surfaceId: string | null;
hostSessionId: string | null;
message: string;
stack: string | null;
acknowledgedAt: string | null;
};
export type ControlPlaneLogsResponse = {
packageName: string;
entries: ControlPlanePackageLogEntry[];
};
export type ControlPlaneErrorsResponse = {
entries: ControlPlanePackageErrorEntry[];
acknowledgedCount: number;
};
export type ControlPlaneReplLogEntry = {
level: "log" | "info" | "warn" | "error";
text: string;
};
export type ControlPlaneReplSession = {
sessionId: string;
createdAt: string;
lastActivityAt: string;
ownedStateContextIds: string[];
borrowedStateContextIds: string[];
subscriptionCount: number;
tempDirectory: string;
};
export type ControlPlaneReplEvalResponse = {
session: ControlPlaneReplSession;
created: boolean;
closed: boolean;
ok: boolean;
result: string | null;
logs: ControlPlaneReplLogEntry[];
error: string | null;
};
export type ControlPlaneReplCloseResponse = {
sessionId: string;
closed: boolean;
};
export type ControlPlaneRemoteDomPayload = {
protocol: string;
revision: number;
baseRevision: number | null;
fromEmpty: boolean;
mutations: unknown[];
};
export type ControlPlaneDependencyInput = {
inputName: string;
targetNodeId: string;
};
export type ControlPlaneDependencyNode = {
nodeId: string;
label: string;
originalRef: string | null;
lockedRef: string | null;
version: string | null;
inputs: ControlPlaneDependencyInput[];
};
export type ControlPlaneDependencyGraph = {
rootNodeId: string;
nodes: ControlPlaneDependencyNode[];
};
export type ControlPlaneRunningPackage = {
key: string;
label: string;
packageName: string;
flakeRef: string;
requestedRef: string | null;
connected: boolean;
processId: number | null;
openedStateContextIds: string[];
rootStateContextIds: string[];
resolvedRef: string | null;
version: string | null;
unreadErrorCount: number;
lastErrorAt: string | null;
dependencyGraph: ControlPlaneDependencyGraph | null;
dependencyGraphError: string | null;
};
export type ControlPlaneCheckStatus = "running" | "passed" | "failed";
export type ControlPlaneCheckResult = {
packageName: string;
rev: string;
status: ControlPlaneCheckStatus;
startedAt: string;
finishedAt: string | null;
summary: string | null;
logExcerpt: string | null;
};
export type ControlPlaneSchemaAnnotation = Record<string, unknown> & {
type: string;
};
export type ControlPlaneSchemaResourceDescription = {
name: string;
description: string | null;
annotations: ControlPlaneSchemaAnnotation[];
takesParams: boolean;
inputDescription: string | null;
inputJsonSchema: Record<string, unknown> | null;
outputDescription: string | null;
outputJsonSchema: Record<string, unknown> | null;
paramsDescription: string | null;
paramsJsonSchema: Record<string, unknown> | null;
dataDescription: string | null;
dataJsonSchema: Record<string, unknown> | null;
history?: boolean;
payloadMode: string | null;
};
export type ControlPlanePackageSchemaDescription = {
packageName: string;
schemaPackageName: string;
description: string | null;
annotations: ControlPlaneSchemaAnnotation[];
functions: ControlPlaneSchemaResourceDescription[];
events: ControlPlaneSchemaResourceDescription[];
values: ControlPlaneSchemaResourceDescription[];
};
export type ControlPlaneSchemaDescriptionResult = {
packageName: string;
rev: string;
generatedAt: string;
status: "available" | "unavailable";
data: ControlPlanePackageSchemaDescription | null;
error: string | null;
};
export type ControlPlaneRunResponse = {
stateContextId: string;
package: ControlPlaneRunningPackage;
};
export type ControlPlaneClearStateResponse = {
packageNames: string[];
clearedDirectories: string[];
packages: ControlPlaneRunningPackage[];
};
export type ControlPlaneStatusResponse = {
generatedAt: string;
workspacePackages: ControlPlaneWorkspacePackage[];
stateContexts: ControlPlaneStateContext[];
replSessions: ControlPlaneReplSession[];
devices: ControlPlaneDevice[];
packages: ControlPlaneRunningPackage[];
checks: ControlPlaneCheckResult[];
descriptions: ControlPlaneSchemaDescriptionResult[];
};
export type ControlPlaneCutoverResponse = {
packages: ControlPlaneRunningPackage[];
};
export const parseControlPlaneDeviceTarget = (value: unknown) => export const parseControlPlaneDeviceTarget = (value: unknown) =>
parseWith(ControlPlaneDeviceTargetSchema, value); parseWith(ControlPlaneDeviceTargetSchema, value);