feat(workspace): support persistent workspace ordering
This commit is contained in:
@@ -83,6 +83,7 @@ export const hostFrameSchema = z.discriminatedUnion('type', [
|
||||
z.object({ type: z.literal('host/agent-error'), sessionId: sessionIdSchema, message: z.string() }),
|
||||
z.object({ type: z.literal('host/workspace-changed'), workspace: workspaceViewSchema }),
|
||||
z.object({ type: z.literal('host/workspace-removed'), workspaceId: workspaceIdSchema }),
|
||||
z.object({ type: z.literal('host/workspace-order-changed'), workspaceIds: z.array(workspaceIdSchema) }),
|
||||
z.object({ type: z.literal('host/archived-sessions-changed'), archivedSessionIds: z.array(sessionIdSchema) }),
|
||||
z.object({ type: z.literal('host/commands-changed') }),
|
||||
z.object({ type: z.literal('host/session-preset-changed'), sessionId: sessionIdSchema, agentPreset: z.string() }),
|
||||
|
||||
@@ -119,7 +119,8 @@ export type MuxFrame =
|
||||
* workspace mutation (create/attach/order change — the client upserts, while
|
||||
* `workspace.list` provides the reconnect baseline); workspace-removed is the
|
||||
* committed registration-deletion increment and never implies directory or
|
||||
* session-log deletion; archived-sessions-changed pushes the full registry
|
||||
* session-log deletion; workspace-order-changed pushes the complete durable
|
||||
* registry order after a reorder; archived-sessions-changed pushes the full registry
|
||||
* archive set after every durable change (same full-snapshot posture as
|
||||
* workspace-changed — `workspace.list` re-baselines it on reconnect).
|
||||
*/
|
||||
@@ -139,6 +140,7 @@ export type HostFrame =
|
||||
| { type: 'host/agent-error'; sessionId: SessionId; message: string }
|
||||
| { type: 'host/workspace-changed'; workspace: WorkspaceView }
|
||||
| { type: 'host/workspace-removed'; workspaceId: WorkspaceView['workspaceId'] }
|
||||
| { type: 'host/workspace-order-changed'; workspaceIds: WorkspaceView['workspaceId'][] }
|
||||
| { type: 'host/archived-sessions-changed'; archivedSessionIds: SessionId[] }
|
||||
/**
|
||||
* The command registry changed (`commands/change` passthrough). Pure
|
||||
|
||||
@@ -48,6 +48,7 @@ export interface RpcMethodMap {
|
||||
'workspace.create': WorkspaceApi['create']
|
||||
'workspace.rename': WorkspaceApi['rename']
|
||||
'workspace.delete': WorkspaceApi['delete']
|
||||
'workspace.insertBefore': WorkspaceApi['insertBefore']
|
||||
'workspace.insertSessionBefore': WorkspaceApi['insertSessionBefore']
|
||||
'workspace.archiveSession': WorkspaceApi['archiveSession']
|
||||
'command.list': CommandsApi['list']
|
||||
|
||||
@@ -66,6 +66,17 @@ export const workspaceDeleteValueSchema = z.object({
|
||||
deleted: z.literal(true),
|
||||
}) satisfies z.ZodType<Wire<ResponseValue<'workspace.delete'>>>
|
||||
|
||||
/** workspace.insertBefore request payload (anchor omitted = append to end). */
|
||||
export const workspaceInsertBeforeRequestSchema = z.object({
|
||||
workspaceId: workspaceIdSchema,
|
||||
beforeWorkspaceId: workspaceIdSchema.optional(),
|
||||
}) satisfies z.ZodType<Wire<RequestPayload<'workspace.insertBefore'>>>
|
||||
|
||||
/** workspace.insertBefore response value: the complete durable display order. */
|
||||
export const workspaceInsertBeforeValueSchema = z.object({
|
||||
workspaceIds: z.array(workspaceIdSchema),
|
||||
}) satisfies z.ZodType<Wire<ResponseValue<'workspace.insertBefore'>>>
|
||||
|
||||
/** workspace.insertSessionBefore request payload (anchor omitted = append to end). */
|
||||
export const workspaceInsertSessionBeforeRequestSchema = z.object({
|
||||
workspaceId: workspaceIdSchema,
|
||||
|
||||
@@ -73,6 +73,15 @@ export interface WorkspaceApi {
|
||||
delete(request: RpcRequest<{ workspaceId: WorkspaceId }>):
|
||||
Promise<RpcResponse<{ deleted: true }>>
|
||||
|
||||
/**
|
||||
* Moves one Workspace within the registry display order,
|
||||
* DOM-insertBefore-like. An omitted anchor appends to the end.
|
||||
*/
|
||||
insertBefore(request: RpcRequest<{
|
||||
workspaceId: WorkspaceId
|
||||
beforeWorkspaceId?: WorkspaceId
|
||||
}>): Promise<RpcResponse<{ workspaceIds: WorkspaceId[] }>>
|
||||
|
||||
/**
|
||||
* Moves an accounted session within its workspace's manual order,
|
||||
* DOM-insertBefore-like: with `beforeSessionId` the session is inserted
|
||||
|
||||
Reference in New Issue
Block a user