Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions packages/code/src/protocol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -996,6 +996,8 @@ const WORKSPACE_COMMAND_RESULT_KEYS = new Set([
const WORKSPACE_SEARCH_MATCH_KEYS = new Set(['path', 'line', 'column', 'text']);

export interface BridgeWorkerCapabilities {
/** Opt in to negotiating the dark checkpoint lease ticket, not worktree ownership. */
checkpointLeaseTicketV1?: true;
/** Opt-in protocol: maximum concurrently leased independent workspace roots. */
workspaceLeaseSlots?: number;
statefulWorkspace: boolean;
Expand Down Expand Up @@ -1027,6 +1029,7 @@ export interface BridgeWorkerRegistrationResponse {
supportedWorkspaceToolOperations?: BridgeWorkspaceToolOperation[];
/** This bridge can bind a durable creation lease to its authenticated caller. */
supportedWorktreeOwnerScope?: true;
supportedCheckpointLeaseTicketV1?: true;
/** Write modes this Code API can safely route to a capability-aware worker. */
supportedWorkspaceWriteFileModes?: WorkspaceWriteFileMode[];
/** Edit modes this Code API can safely route to a capability-aware worker. */
Expand Down Expand Up @@ -1161,6 +1164,8 @@ export interface BridgeAssignment<TBody = object> {
request: BridgeSandboxRequest<TBody> | WorkspaceToolRequest;
/** Bridge-derived principal scope for explicit creation, never caller request data. */
worktreeOwnerScope?: string;
/** Advisory only. The surrounding lease supplies the assignment, generation, incarnation and slot. */
checkpointLeaseTicket?: { version: 1; epoch: string };
}

export interface BridgeLeaseResponse<TBody = object> {
Expand Down Expand Up @@ -2465,6 +2470,7 @@ export function isValidBridgeWorkerCapabilities(
if (typeof value !== 'object' || value === null) return false;
const capabilities = value as Record<string, unknown>;
return (
(capabilities.checkpointLeaseTicketV1 === undefined || capabilities.checkpointLeaseTicketV1 === true) &&
(capabilities.workspaceLeaseSlots === undefined ||
(Number.isSafeInteger(capabilities.workspaceLeaseSlots) &&
Number(capabilities.workspaceLeaseSlots) >= 1 &&
Expand Down
Loading
Loading