|
|
|
@@ -56,6 +56,7 @@ import {
|
|
|
|
|
LoopStopResponseSchema,
|
|
|
|
|
} from "./loop/rpc-schemas.js";
|
|
|
|
|
import {
|
|
|
|
|
BROWSER_AUTOMATION_COMMAND_NAMES,
|
|
|
|
|
BrowserAutomationExecuteRequestSchema,
|
|
|
|
|
BrowserAutomationExecuteResponseSchema,
|
|
|
|
|
} from "./browser-automation/rpc-schemas.js";
|
|
|
|
@@ -1036,7 +1037,7 @@ const WorkspaceLabelSyncCursorSchema = z.object({
|
|
|
|
|
export const WorkspaceLabelListRequestSchema = z.object({
|
|
|
|
|
type: z.literal("workspace.label.list.request"),
|
|
|
|
|
requestId: z.string(),
|
|
|
|
|
subscribe: z.object({ subscriptionId: z.string() }),
|
|
|
|
|
subscribe: z.object({ subscriptionId: z.string().optional() }).optional(),
|
|
|
|
|
sync: WorkspaceLabelSyncCursorSchema.optional(),
|
|
|
|
|
});
|
|
|
|
|
export const WorkspaceLabelAssignmentSetRequestSchema = z.object({
|
|
|
|
@@ -1680,7 +1681,7 @@ export type CreateAgentWorktreeTarget = z.infer<typeof CreateAgentWorktreeTarget
|
|
|
|
|
|
|
|
|
|
export const CreateAgentRequestMessageSchema = z.object({
|
|
|
|
|
type: z.literal("create_agent_request"),
|
|
|
|
|
// A creation key requires initialPrompt to be sent separately with a stable messageId.
|
|
|
|
|
// Legacy create_agent_request uses a separate initial-message receipt when keyed.
|
|
|
|
|
idempotencyKey: z.string().min(1).max(512).optional(),
|
|
|
|
|
config: AgentSessionConfigSchema,
|
|
|
|
|
env: z.record(z.string(), z.string()).optional(),
|
|
|
|
@@ -1701,6 +1702,33 @@ export const CreateAgentRequestMessageSchema = z.object({
|
|
|
|
|
requestId: z.string(),
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
/** Resource IDs are optional on creation; supplied IDs retain their identity on replay. */
|
|
|
|
|
export const AgentCreateRequestSchema = CreateAgentRequestMessageSchema.extend({
|
|
|
|
|
type: z.literal("agent.create.request"),
|
|
|
|
|
agentId: z.uuid().optional(),
|
|
|
|
|
attachments: z.array(AgentAttachmentSchema).optional(),
|
|
|
|
|
subscribe: z.boolean().optional(),
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
export const WorkspaceInitialAgentSchema = AgentCreateRequestSchema.omit({
|
|
|
|
|
type: true,
|
|
|
|
|
requestId: true,
|
|
|
|
|
idempotencyKey: true,
|
|
|
|
|
subscribe: true,
|
|
|
|
|
workspaceId: true,
|
|
|
|
|
worktree: true,
|
|
|
|
|
worktreeName: true,
|
|
|
|
|
git: true,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
export const CreationSubscribeRequestSchema = z.object({
|
|
|
|
|
type: z.literal("creation.subscribe.request"),
|
|
|
|
|
requestId: z.string(),
|
|
|
|
|
kind: z.enum(["workspace", "agent"]),
|
|
|
|
|
idempotencyKey: z.string().min(1).max(512),
|
|
|
|
|
subscribe: z.boolean().optional(),
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
export const ListProviderModelsRequestMessageSchema = z.object({
|
|
|
|
|
type: z.literal("list_provider_models_request"),
|
|
|
|
|
provider: AgentProviderSchema,
|
|
|
|
@@ -2124,7 +2152,14 @@ export const CheckoutStatusRequestSchema = z.object({
|
|
|
|
|
|
|
|
|
|
export const SubscribeCheckoutDiffRequestSchema = z.object({
|
|
|
|
|
type: z.literal("subscribe_checkout_diff_request"),
|
|
|
|
|
subscriptionId: z.string(),
|
|
|
|
|
subscriptionId: z.string().optional(),
|
|
|
|
|
cwd: z.string(),
|
|
|
|
|
compare: CheckoutDiffCompareSchema,
|
|
|
|
|
requestId: z.string(),
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
export const CheckoutDiffGetRequestSchema = z.object({
|
|
|
|
|
type: z.literal("checkout.diff.get.request"),
|
|
|
|
|
cwd: z.string(),
|
|
|
|
|
compare: CheckoutDiffCompareSchema,
|
|
|
|
|
requestId: z.string(),
|
|
|
|
@@ -2562,7 +2597,14 @@ export const ArchiveWorkspaceRequestSchema = z.object({
|
|
|
|
|
// between an existing local directory and a newly created paseo worktree.
|
|
|
|
|
export const WorkspaceCreateRequestSchema = z.object({
|
|
|
|
|
type: z.literal("workspace.create.request"),
|
|
|
|
|
workspaceId: z
|
|
|
|
|
.string()
|
|
|
|
|
.regex(/^wks_[a-f0-9]{16}$/)
|
|
|
|
|
.optional(),
|
|
|
|
|
agent: WorkspaceInitialAgentSchema.optional(),
|
|
|
|
|
subscribe: z.boolean().optional(),
|
|
|
|
|
requestId: z.string(),
|
|
|
|
|
idempotencyKey: z.string().min(1).max(512).optional(),
|
|
|
|
|
// Optional user-set title applied to the created workspace.
|
|
|
|
|
title: z.string().optional(),
|
|
|
|
|
// Optional prompt context for workspace-level name/branch generation.
|
|
|
|
@@ -2700,7 +2742,7 @@ export const FileSubscribeRequestSchema = z.object({
|
|
|
|
|
type: z.literal("fs.file.subscribe.request"),
|
|
|
|
|
cwd: z.string(),
|
|
|
|
|
path: z.string(),
|
|
|
|
|
subscriptionId: z.string(),
|
|
|
|
|
subscriptionId: z.string().optional(),
|
|
|
|
|
requestId: z.string(),
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
@@ -2855,6 +2897,7 @@ export const ListTerminalsRequestSchema = z.object({
|
|
|
|
|
|
|
|
|
|
export const SubscribeTerminalsRequestSchema = z.object({
|
|
|
|
|
type: z.literal("subscribe_terminals_request"),
|
|
|
|
|
requestId: z.string().optional(),
|
|
|
|
|
cwd: z.string(),
|
|
|
|
|
workspaceId: z.string().optional(),
|
|
|
|
|
});
|
|
|
|
@@ -3061,19 +3104,55 @@ export const SessionEventSubscriptionSchema = z.enum([
|
|
|
|
|
"agent_attention_required",
|
|
|
|
|
"agent_permission_request",
|
|
|
|
|
"agent_permission_resolved",
|
|
|
|
|
"checkout_status_update",
|
|
|
|
|
"script_status_update",
|
|
|
|
|
"workspace_setup_progress",
|
|
|
|
|
"agent.provider_subagents.update",
|
|
|
|
|
"terminal_attention_required",
|
|
|
|
|
"status.server_info",
|
|
|
|
|
"status.daemon_config_changed",
|
|
|
|
|
"status.plugin_catalog_changed",
|
|
|
|
|
"status.plugin_settings_changed",
|
|
|
|
|
"activity_log",
|
|
|
|
|
"hub.execution.agent.update",
|
|
|
|
|
"hub.execution.agent.stream",
|
|
|
|
|
]);
|
|
|
|
|
export type SessionEventSubscription = z.infer<typeof SessionEventSubscriptionSchema>;
|
|
|
|
|
export const SessionEventsSetSubscriptionRequestSchema = z.object({
|
|
|
|
|
type: z.literal("session.events.set_subscription.request"),
|
|
|
|
|
requestId: z.string(),
|
|
|
|
|
events: z.array(SessionEventSubscriptionSchema),
|
|
|
|
|
notifications: z.boolean().optional(),
|
|
|
|
|
});
|
|
|
|
|
export const SessionEventsSetSubscriptionResponseSchema = z.object({
|
|
|
|
|
type: z.literal("session.events.set_subscription.response"),
|
|
|
|
|
payload: z.object({ requestId: z.string() }),
|
|
|
|
|
payload: z.object({ requestId: z.string(), subscriptionId: z.string().optional() }),
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
export const BrowserHostRegisterRequestSchema = z.object({
|
|
|
|
|
type: z.literal("browser.host.register.request"),
|
|
|
|
|
requestId: z.string(),
|
|
|
|
|
hostKind: z.string().min(1),
|
|
|
|
|
supportedCommands: z.array(z.enum(BROWSER_AUTOMATION_COMMAND_NAMES)).min(1),
|
|
|
|
|
});
|
|
|
|
|
export const BrowserHostRegisterResponseSchema = z.object({
|
|
|
|
|
type: z.literal("browser.host.register.response"),
|
|
|
|
|
payload: z.object({ requestId: z.string(), subscriptionId: z.string() }),
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
export const SubscriptionReleaseRequestSchema = z.object({
|
|
|
|
|
type: z.literal("subscription.release.request"),
|
|
|
|
|
requestId: z.string(),
|
|
|
|
|
subscriptionId: z.string(),
|
|
|
|
|
});
|
|
|
|
|
export const SubscriptionReleaseResponseSchema = z.object({
|
|
|
|
|
type: z.literal("subscription.release.response"),
|
|
|
|
|
payload: z.object({ requestId: z.string(), subscriptionId: z.string() }),
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
export const SessionInboundMessageSchema = z.discriminatedUnion("type", [
|
|
|
|
|
BrowserHostRegisterRequestSchema,
|
|
|
|
|
SubscriptionReleaseRequestSchema,
|
|
|
|
|
SessionEventsSetSubscriptionRequestSchema,
|
|
|
|
|
HubExecutionAgentCreateRequestSchema,
|
|
|
|
|
HubExecutionAgentValidateRequestSchema,
|
|
|
|
@@ -3174,6 +3253,7 @@ export const SessionInboundMessageSchema = z.discriminatedUnion("type", [
|
|
|
|
|
AgentRewindRequestMessageSchema,
|
|
|
|
|
AgentPermissionResponseMessageSchema,
|
|
|
|
|
CheckoutStatusRequestSchema,
|
|
|
|
|
CheckoutDiffGetRequestSchema,
|
|
|
|
|
SubscribeCheckoutDiffRequestSchema,
|
|
|
|
|
UnsubscribeCheckoutDiffRequestSchema,
|
|
|
|
|
CheckoutCommitRequestSchema,
|
|
|
|
@@ -3217,6 +3297,8 @@ export const SessionInboundMessageSchema = z.discriminatedUnion("type", [
|
|
|
|
|
ProjectGithubCloneRequestSchema,
|
|
|
|
|
ArchiveWorkspaceRequestSchema,
|
|
|
|
|
WorkspaceCreateRequestSchema,
|
|
|
|
|
AgentCreateRequestSchema,
|
|
|
|
|
CreationSubscribeRequestSchema,
|
|
|
|
|
WorkspaceClearAttentionRequestSchema,
|
|
|
|
|
WorkspaceMarkUnreadRequestSchema,
|
|
|
|
|
FileExplorerRequestSchema,
|
|
|
|
@@ -3281,6 +3363,7 @@ export type SessionInboundMessage = z.infer<typeof SessionInboundMessageSchema>;
|
|
|
|
|
// ============================================================================
|
|
|
|
|
|
|
|
|
|
export const ActivityLogPayloadSchema = z.object({
|
|
|
|
|
subscriptionId: z.string().optional(),
|
|
|
|
|
id: z.string(),
|
|
|
|
|
timestamp: z.coerce.date(),
|
|
|
|
|
type: z.enum(["transcript", "assistant", "tool_call", "tool_result", "error", "system"]),
|
|
|
|
@@ -3442,6 +3525,9 @@ export const ServerInfoStatusPayloadSchema = z
|
|
|
|
|
.object({
|
|
|
|
|
// COMPAT(agentRequestReceipts): added in v0.8.0; remove gate after 2027-03-05.
|
|
|
|
|
agentRequestReceipts: z.boolean().optional(),
|
|
|
|
|
// COMPAT(workspaceRequestReceipts): added in v0.8.0; remove gate after 2027-03-07.
|
|
|
|
|
workspaceRequestReceipts: z.boolean().optional(),
|
|
|
|
|
creationLifecycle: z.boolean().optional(),
|
|
|
|
|
// COMPAT(hubAgentRpc): added in v0.8.0; remove gate after 2027-03-05.
|
|
|
|
|
hubAgentRpc: z.boolean().optional(),
|
|
|
|
|
providersSnapshot: z.boolean().optional(),
|
|
|
|
@@ -3541,6 +3627,8 @@ export const ServerInfoStatusPayloadSchema = z
|
|
|
|
|
agentForkContextCursor: z.boolean().optional(),
|
|
|
|
|
// COMPAT(providerSubagents): added in v0.1.107, remove gate after 2027-01-12.
|
|
|
|
|
providerSubagents: z.boolean().optional(),
|
|
|
|
|
// COMPAT(projectedSubagentTimeline): added after v0.8.0, remove gates after 2027-03-14; retain wire field.
|
|
|
|
|
projectedSubagentTimeline: z.boolean().optional(),
|
|
|
|
|
// COMPAT(providerSubagentNesting): added in v0.7, remove gate after 2027-03-04.
|
|
|
|
|
providerSubagentNesting: z.boolean().optional(),
|
|
|
|
|
// COMPAT(workspacePinning): added in v0.1.107, remove gate after 2027-01-12.
|
|
|
|
@@ -3575,6 +3663,7 @@ export const ServerInfoStatusPayloadSchema = z
|
|
|
|
|
// COMPAT(selectiveAgentTimeline): added in v0.1.106, remove after 2027-01-12.
|
|
|
|
|
selectiveAgentTimeline: z.boolean().optional(),
|
|
|
|
|
explicitEventSubscriptions: z.boolean().optional(),
|
|
|
|
|
ownedSubscriptions: z.boolean().optional(),
|
|
|
|
|
// COMPAT(canonicalSubmittedPrompts): added in v0.2.6, remove gate after 2027-01-30.
|
|
|
|
|
canonicalSubmittedPrompts: z.boolean().optional(),
|
|
|
|
|
// COMPAT(agentTurnIdentity): accept peers that observed pre-release v0.2.6 through 2027-01-31.
|
|
|
|
@@ -3943,6 +4032,7 @@ export const AgentUpdateMessageSchema = z.object({
|
|
|
|
|
type: z.literal("agent_update"),
|
|
|
|
|
payload: z.discriminatedUnion("kind", [
|
|
|
|
|
z.object({
|
|
|
|
|
subscriptionId: z.string().optional(),
|
|
|
|
|
kind: z.literal("upsert"),
|
|
|
|
|
agent: AgentSnapshotPayloadSchema,
|
|
|
|
|
project: ProjectPlacementPayloadSchema.nullable().optional(),
|
|
|
|
@@ -3950,6 +4040,7 @@ export const AgentUpdateMessageSchema = z.object({
|
|
|
|
|
seq: z.number().int().positive().optional(),
|
|
|
|
|
}),
|
|
|
|
|
z.object({
|
|
|
|
|
subscriptionId: z.string().optional(),
|
|
|
|
|
kind: z.literal("remove"),
|
|
|
|
|
agentId: z.string(),
|
|
|
|
|
generation: z.string().optional(),
|
|
|
|
@@ -3961,6 +4052,7 @@ export const AgentUpdateMessageSchema = z.object({
|
|
|
|
|
export const AgentStreamMessageSchema = z.object({
|
|
|
|
|
type: z.literal("agent_stream"),
|
|
|
|
|
payload: z.object({
|
|
|
|
|
subscriptionId: z.string().optional(),
|
|
|
|
|
agentId: z.string(),
|
|
|
|
|
event: AgentStreamEventPayloadSchema,
|
|
|
|
|
timestamp: z.string(),
|
|
|
|
@@ -4107,12 +4199,14 @@ export const WorkspaceUpdateMessageSchema = z.object({
|
|
|
|
|
type: z.literal("workspace_update"),
|
|
|
|
|
payload: z.discriminatedUnion("kind", [
|
|
|
|
|
z.object({
|
|
|
|
|
subscriptionId: z.string().optional(),
|
|
|
|
|
kind: z.literal("upsert"),
|
|
|
|
|
workspace: WorkspaceDescriptorPayloadSchema,
|
|
|
|
|
generation: z.string().optional(),
|
|
|
|
|
seq: z.number().int().positive().optional(),
|
|
|
|
|
}),
|
|
|
|
|
z.object({
|
|
|
|
|
subscriptionId: z.string().optional(),
|
|
|
|
|
kind: z.literal("remove"),
|
|
|
|
|
id: z.string(),
|
|
|
|
|
// COMPAT(workspaceProjects): added in v0.1.97, drop the optional gate when floor >= v0.1.97.
|
|
|
|
@@ -4141,6 +4235,7 @@ export const WorkspaceLabelListResponseSchema = z.object({
|
|
|
|
|
type: z.literal("workspace.label.list.response"),
|
|
|
|
|
payload: z.object({
|
|
|
|
|
requestId: z.string(),
|
|
|
|
|
subscriptionId: z.string().optional(),
|
|
|
|
|
labels: z.array(WorkspaceLabelDefinitionSchema),
|
|
|
|
|
sync: WorkspaceLabelSyncMetadataSchema,
|
|
|
|
|
}),
|
|
|
|
@@ -4149,6 +4244,7 @@ export const WorkspaceLabelUpdateSchema = z.object({
|
|
|
|
|
type: z.literal("workspace.label.update"),
|
|
|
|
|
payload: z.discriminatedUnion("kind", [
|
|
|
|
|
z.object({
|
|
|
|
|
subscriptionId: z.string().optional(),
|
|
|
|
|
kind: z.literal("upsert"),
|
|
|
|
|
label: WorkspaceLabelDefinitionSchema,
|
|
|
|
|
previousName: z.string().optional(),
|
|
|
|
@@ -4156,6 +4252,7 @@ export const WorkspaceLabelUpdateSchema = z.object({
|
|
|
|
|
seq: z.number().int().positive(),
|
|
|
|
|
}),
|
|
|
|
|
z.object({
|
|
|
|
|
subscriptionId: z.string().optional(),
|
|
|
|
|
kind: z.literal("remove"),
|
|
|
|
|
name: z.string(),
|
|
|
|
|
generation: z.string(),
|
|
|
|
@@ -4198,12 +4295,14 @@ export const ProjectUpdateMessageSchema = z.object({
|
|
|
|
|
type: z.literal("project.update"),
|
|
|
|
|
payload: z.discriminatedUnion("kind", [
|
|
|
|
|
z.object({
|
|
|
|
|
subscriptionId: z.string().optional(),
|
|
|
|
|
kind: z.literal("upsert"),
|
|
|
|
|
project: WorkspaceProjectDescriptorPayloadSchema,
|
|
|
|
|
generation: z.string().optional(),
|
|
|
|
|
seq: z.number().int().positive().optional(),
|
|
|
|
|
}),
|
|
|
|
|
z.object({
|
|
|
|
|
subscriptionId: z.string().optional(),
|
|
|
|
|
kind: z.literal("remove"),
|
|
|
|
|
projectId: z.string(),
|
|
|
|
|
generation: z.string().optional(),
|
|
|
|
@@ -4224,6 +4323,7 @@ export const ProjectListResponseMessageSchema = z.object({
|
|
|
|
|
export const ScriptStatusUpdateMessageSchema = z.object({
|
|
|
|
|
type: z.literal("script_status_update"),
|
|
|
|
|
payload: z.object({
|
|
|
|
|
subscriptionId: z.string().optional(),
|
|
|
|
|
workspaceId: z.string(),
|
|
|
|
|
scripts: z.array(WorkspaceScriptPayloadSchema),
|
|
|
|
|
}),
|
|
|
|
@@ -4232,6 +4332,7 @@ export const ScriptStatusUpdateMessageSchema = z.object({
|
|
|
|
|
export const WorkspaceSetupProgressMessageSchema = z.object({
|
|
|
|
|
type: z.literal("workspace_setup_progress"),
|
|
|
|
|
payload: z.object({
|
|
|
|
|
subscriptionId: z.string().optional(),
|
|
|
|
|
workspaceId: z.string(),
|
|
|
|
|
status: z.enum(["running", "completed", "failed", "blocked"]),
|
|
|
|
|
detail: WorktreeSetupDetailPayloadSchema,
|
|
|
|
@@ -4493,6 +4594,7 @@ export const FetchAgentTimelineResponseMessageSchema = z.object({
|
|
|
|
|
export const AgentTimelineReplacementMessageSchema = z.object({
|
|
|
|
|
type: z.literal("agent.timeline.replacement"),
|
|
|
|
|
payload: z.object({
|
|
|
|
|
subscriptionId: z.string().optional(),
|
|
|
|
|
agentId: z.string(),
|
|
|
|
|
epoch: z.string(),
|
|
|
|
|
}),
|
|
|
|
@@ -4570,6 +4672,9 @@ export const ProviderSubagentTimelineResponseMessageSchema = z.object({
|
|
|
|
|
provider: AgentProviderSchema.nullable(),
|
|
|
|
|
direction: z.enum(["tail", "before", "after"]),
|
|
|
|
|
epoch: z.string(),
|
|
|
|
|
projection: z.literal("projected").optional(),
|
|
|
|
|
startCursor: AgentTimelineCursorSchema.nullable().optional(),
|
|
|
|
|
endCursor: AgentTimelineCursorSchema.nullable().optional(),
|
|
|
|
|
reset: z.boolean(),
|
|
|
|
|
staleCursor: z.boolean(),
|
|
|
|
|
gap: z.boolean(),
|
|
|
|
@@ -4585,6 +4690,16 @@ export const ProviderSubagentTimelineResponseMessageSchema = z.object({
|
|
|
|
|
item: AgentTimelineItemPayloadSchema,
|
|
|
|
|
timestamp: z.string(),
|
|
|
|
|
seq: z.number().int().nonnegative(),
|
|
|
|
|
seqStart: z.number().int().nonnegative().optional(),
|
|
|
|
|
seqEnd: z.number().int().nonnegative().optional(),
|
|
|
|
|
sourceSeqRanges: z
|
|
|
|
|
.array(
|
|
|
|
|
z.object({
|
|
|
|
|
startSeq: z.number().int().nonnegative(),
|
|
|
|
|
endSeq: z.number().int().nonnegative(),
|
|
|
|
|
}),
|
|
|
|
|
)
|
|
|
|
|
.optional(),
|
|
|
|
|
}),
|
|
|
|
|
),
|
|
|
|
|
error: z.string().nullable(),
|
|
|
|
@@ -4595,10 +4710,12 @@ export const ProviderSubagentUpdateMessageSchema = z.object({
|
|
|
|
|
type: z.literal("agent.provider_subagents.update"),
|
|
|
|
|
payload: z.discriminatedUnion("kind", [
|
|
|
|
|
z.object({
|
|
|
|
|
subscriptionId: z.string().optional(),
|
|
|
|
|
kind: z.literal("upsert"),
|
|
|
|
|
subagent: ProviderSubagentDescriptorPayloadSchema,
|
|
|
|
|
}),
|
|
|
|
|
z.object({
|
|
|
|
|
subscriptionId: z.string().optional(),
|
|
|
|
|
kind: z.literal("timeline"),
|
|
|
|
|
parentAgentId: z.string(),
|
|
|
|
|
subagentId: z.string(),
|
|
|
|
@@ -4609,6 +4726,7 @@ export const ProviderSubagentUpdateMessageSchema = z.object({
|
|
|
|
|
epoch: z.string(),
|
|
|
|
|
}),
|
|
|
|
|
z.object({
|
|
|
|
|
subscriptionId: z.string().optional(),
|
|
|
|
|
kind: z.literal("remove"),
|
|
|
|
|
parentAgentId: z.string(),
|
|
|
|
|
subagentId: z.string(),
|
|
|
|
@@ -4619,6 +4737,7 @@ export const ProviderSubagentUpdateMessageSchema = z.object({
|
|
|
|
|
export const SetAgentTimelineSubscriptionResponseMessageSchema = z.object({
|
|
|
|
|
type: z.literal("agent.timeline.set_subscription.response"),
|
|
|
|
|
payload: z.object({
|
|
|
|
|
subscriptionId: z.string().optional(),
|
|
|
|
|
agentIds: z.array(z.string()),
|
|
|
|
|
requestId: z.string(),
|
|
|
|
|
}),
|
|
|
|
@@ -4627,6 +4746,7 @@ export const SetAgentTimelineSubscriptionResponseMessageSchema = z.object({
|
|
|
|
|
export const AgentAttentionRequiredMessageSchema = z.object({
|
|
|
|
|
type: z.literal("agent_attention_required"),
|
|
|
|
|
payload: z.object({
|
|
|
|
|
subscriptionId: z.string().optional(),
|
|
|
|
|
agentId: z.string(),
|
|
|
|
|
reason: z.enum(["finished", "error", "permission"]),
|
|
|
|
|
timestamp: z.string(),
|
|
|
|
@@ -4678,9 +4798,63 @@ export const ClearAgentAttentionResponseMessageSchema = z.object({
|
|
|
|
|
}),
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
export const CreationSnapshotSchema = z.object({
|
|
|
|
|
kind: z.enum(["workspace", "agent"]),
|
|
|
|
|
idempotencyKey: z.string(),
|
|
|
|
|
revision: z.number().int().nonnegative(),
|
|
|
|
|
phase: z.enum([
|
|
|
|
|
"accepted",
|
|
|
|
|
"workspace_ready",
|
|
|
|
|
"agent_ready",
|
|
|
|
|
"prompt_started",
|
|
|
|
|
"completed",
|
|
|
|
|
"failed",
|
|
|
|
|
]),
|
|
|
|
|
workspaceId: z.string().nullable(),
|
|
|
|
|
agentId: z.string().nullable(),
|
|
|
|
|
workspace: WorkspaceDescriptorPayloadSchema.optional(),
|
|
|
|
|
agent: AgentSnapshotPayloadSchema.optional(),
|
|
|
|
|
error: z.string().nullable(),
|
|
|
|
|
setupSkippedReason: z.string().optional(),
|
|
|
|
|
errorCode: z.string().optional(),
|
|
|
|
|
failedStage: z.enum(["workspace", "agent", "prompt"]).optional(),
|
|
|
|
|
outcomeUnknown: z.boolean().optional(),
|
|
|
|
|
});
|
|
|
|
|
export type CreationSnapshot = z.infer<typeof CreationSnapshotSchema>;
|
|
|
|
|
export type AgentCreateRequest = z.infer<typeof AgentCreateRequestSchema>;
|
|
|
|
|
export type WorkspaceInitialAgent = z.infer<typeof WorkspaceInitialAgentSchema>;
|
|
|
|
|
|
|
|
|
|
export const WorkspaceCreationUpdateSchema = z.object({
|
|
|
|
|
type: z.literal("workspace.create.update"),
|
|
|
|
|
payload: CreationSnapshotSchema.extend({ subscriptionId: z.string().optional() }),
|
|
|
|
|
});
|
|
|
|
|
export const AgentCreationUpdateSchema = WorkspaceCreationUpdateSchema.extend({
|
|
|
|
|
type: z.literal("agent.create.update"),
|
|
|
|
|
});
|
|
|
|
|
export const CreationSubscribeResponseSchema = z.object({
|
|
|
|
|
type: z.literal("creation.subscribe.response"),
|
|
|
|
|
payload: z.object({
|
|
|
|
|
requestId: z.string(),
|
|
|
|
|
subscriptionId: z.string().optional(),
|
|
|
|
|
snapshot: CreationSnapshotSchema.nullable(),
|
|
|
|
|
error: z.string().nullable(),
|
|
|
|
|
}),
|
|
|
|
|
});
|
|
|
|
|
export const AgentCreateResponseSchema = z.object({
|
|
|
|
|
type: z.literal("agent.create.response"),
|
|
|
|
|
payload: z.object({
|
|
|
|
|
requestId: z.string(),
|
|
|
|
|
agent: AgentSnapshotPayloadSchema.nullable(),
|
|
|
|
|
error: z.string().nullable(),
|
|
|
|
|
creation: CreationSnapshotSchema.optional(),
|
|
|
|
|
}),
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
export const WorkspaceCreateResponseSchema = z.object({
|
|
|
|
|
type: z.literal("workspace.create.response"),
|
|
|
|
|
payload: z.object({
|
|
|
|
|
agent: AgentSnapshotPayloadSchema.optional(),
|
|
|
|
|
creation: CreationSnapshotSchema.optional(),
|
|
|
|
|
workspace: WorkspaceDescriptorPayloadSchema.nullable(),
|
|
|
|
|
setupTerminalId: z.string().nullable(),
|
|
|
|
|
setupSkippedReason: z.string().optional(),
|
|
|
|
@@ -4910,6 +5084,7 @@ export const WriteProjectConfigResponseMessageSchema = z.object({
|
|
|
|
|
export const AgentPermissionRequestMessageSchema = z.object({
|
|
|
|
|
type: z.literal("agent_permission_request"),
|
|
|
|
|
payload: z.object({
|
|
|
|
|
subscriptionId: z.string().optional(),
|
|
|
|
|
agentId: z.string(),
|
|
|
|
|
request: AgentPermissionRequestPayloadSchema,
|
|
|
|
|
}),
|
|
|
|
@@ -4918,6 +5093,7 @@ export const AgentPermissionRequestMessageSchema = z.object({
|
|
|
|
|
export const AgentPermissionResolvedMessageSchema = z.object({
|
|
|
|
|
type: z.literal("agent_permission_resolved"),
|
|
|
|
|
payload: z.object({
|
|
|
|
|
subscriptionId: z.string().optional(),
|
|
|
|
|
agentId: z.string(),
|
|
|
|
|
requestId: z.string(),
|
|
|
|
|
resolution: AgentPermissionResponseSchema,
|
|
|
|
@@ -5158,6 +5334,7 @@ const CheckoutPrStatusPayloadSchema = z.object({
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const CheckoutStatusUpdateMetadataSchema = z.object({
|
|
|
|
|
subscriptionId: z.string().optional(),
|
|
|
|
|
prStatus: CheckoutPrStatusPayloadSchema.optional(),
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
@@ -5188,6 +5365,13 @@ export const SubscribeCheckoutDiffResponseSchema = z.object({
|
|
|
|
|
}),
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
export const CheckoutDiffGetResponseSchema = z.object({
|
|
|
|
|
type: z.literal("checkout.diff.get.response"),
|
|
|
|
|
payload: CheckoutDiffSubscriptionPayloadSchema.omit({ subscriptionId: true }).extend({
|
|
|
|
|
requestId: z.string(),
|
|
|
|
|
}),
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
export const CheckoutDiffUpdateSchema = z.object({
|
|
|
|
|
type: z.literal("checkout_diff_update"),
|
|
|
|
|
payload: CheckoutDiffSubscriptionPayloadSchema,
|
|
|
|
@@ -5952,6 +6136,7 @@ export const GetProvidersSnapshotResponseMessageSchema = z.object({
|
|
|
|
|
export const ProvidersSnapshotUpdateMessageSchema = z.object({
|
|
|
|
|
type: z.literal("providers_snapshot_update"),
|
|
|
|
|
payload: z.object({
|
|
|
|
|
subscriptionId: z.string().optional(),
|
|
|
|
|
cwd: z.string().optional(),
|
|
|
|
|
entries: z.array(ProviderSnapshotEntrySchema),
|
|
|
|
|
compactSnapshot: CompactProviderSnapshotSchema.optional(),
|
|
|
|
@@ -6117,6 +6302,9 @@ export const ListTerminalsResponseSchema = z.object({
|
|
|
|
|
export const TerminalsChangedSchema = z.object({
|
|
|
|
|
type: z.literal("terminals_changed"),
|
|
|
|
|
payload: z.object({
|
|
|
|
|
subscriptionId: z.string().optional(),
|
|
|
|
|
requestId: z.string().optional(),
|
|
|
|
|
workspaceId: z.string().optional(),
|
|
|
|
|
cwd: z.string(),
|
|
|
|
|
terminals: z.array(TerminalInfoSchema.omit({ cwd: true })),
|
|
|
|
|
}),
|
|
|
|
@@ -6146,6 +6334,7 @@ export const SubscribeTerminalResponseSchema = z.object({
|
|
|
|
|
z.object({
|
|
|
|
|
terminalId: z.string(),
|
|
|
|
|
slot: z.number().int().min(0).max(255),
|
|
|
|
|
subscriptionId: z.string().optional(),
|
|
|
|
|
error: z.null(),
|
|
|
|
|
requestId: z.string(),
|
|
|
|
|
}),
|
|
|
|
@@ -6179,13 +6368,17 @@ export const CaptureTerminalResponseSchema = z.object({
|
|
|
|
|
export const TerminalStreamExitSchema = z.object({
|
|
|
|
|
type: z.literal("terminal_stream_exit"),
|
|
|
|
|
payload: z.object({
|
|
|
|
|
subscriptionId: z.string().optional(),
|
|
|
|
|
terminalId: z.string(),
|
|
|
|
|
// Observation failure; the underlying terminal process may still be running.
|
|
|
|
|
error: z.string().optional(),
|
|
|
|
|
}),
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
export const TerminalAttentionRequiredSchema = z.object({
|
|
|
|
|
type: z.literal("terminal_attention_required"),
|
|
|
|
|
payload: z.object({
|
|
|
|
|
subscriptionId: z.string().optional(),
|
|
|
|
|
serverId: z.string().optional(),
|
|
|
|
|
terminalId: z.string(),
|
|
|
|
|
cwd: z.string(),
|
|
|
|
@@ -6264,6 +6457,7 @@ export const HubExecutionControlResponseSchema = z.object({
|
|
|
|
|
export const HubExecutionAgentUpdateSchema = z.object({
|
|
|
|
|
type: z.literal("hub.execution.agent.update"),
|
|
|
|
|
payload: z.object({
|
|
|
|
|
subscriptionId: z.string().optional(),
|
|
|
|
|
executionId: z.string(),
|
|
|
|
|
agentId: z.string(),
|
|
|
|
|
agent: AgentSnapshotPayloadSchema,
|
|
|
|
@@ -6273,6 +6467,7 @@ export const HubExecutionAgentUpdateSchema = z.object({
|
|
|
|
|
export const HubExecutionAgentStreamSchema = z.object({
|
|
|
|
|
type: z.literal("hub.execution.agent.stream"),
|
|
|
|
|
payload: z.object({
|
|
|
|
|
subscriptionId: z.string().optional(),
|
|
|
|
|
executionId: z.string(),
|
|
|
|
|
agentId: z.string(),
|
|
|
|
|
event: AgentStreamEventPayloadSchema,
|
|
|
|
@@ -6482,6 +6677,8 @@ export const AgentSkillsImportLegacySelectionResponseSchema = z.object({
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
export const SessionOutboundMessageSchema = z.discriminatedUnion("type", [
|
|
|
|
|
BrowserHostRegisterResponseSchema,
|
|
|
|
|
SubscriptionReleaseResponseSchema,
|
|
|
|
|
SessionEventsSetSubscriptionResponseSchema,
|
|
|
|
|
HubExecutionAgentCreateResponseSchema,
|
|
|
|
|
HubExecutionAgentValidateResponseSchema,
|
|
|
|
@@ -6569,6 +6766,10 @@ export const SessionOutboundMessageSchema = z.discriminatedUnion("type", [
|
|
|
|
|
CancelAgentResponseMessageSchema,
|
|
|
|
|
ClearAgentAttentionResponseMessageSchema,
|
|
|
|
|
WorkspaceCreateResponseSchema,
|
|
|
|
|
AgentCreateResponseSchema,
|
|
|
|
|
WorkspaceCreationUpdateSchema,
|
|
|
|
|
AgentCreationUpdateSchema,
|
|
|
|
|
CreationSubscribeResponseSchema,
|
|
|
|
|
WorkspaceClearAttentionResponseSchema,
|
|
|
|
|
WorkspaceMarkUnreadResponseSchema,
|
|
|
|
|
SendAgentMessageResponseMessageSchema,
|
|
|
|
@@ -6608,6 +6809,7 @@ export const SessionOutboundMessageSchema = z.discriminatedUnion("type", [
|
|
|
|
|
CloseItemsResponseSchema,
|
|
|
|
|
CheckoutStatusResponseSchema,
|
|
|
|
|
CheckoutStatusUpdateSchema,
|
|
|
|
|
CheckoutDiffGetResponseSchema,
|
|
|
|
|
SubscribeCheckoutDiffResponseSchema,
|
|
|
|
|
CheckoutDiffUpdateSchema,
|
|
|
|
|
CheckoutCommitResponseSchema,
|
|
|
|
|