feat(apiproxy): workspace.archiveSession RPC and archived-sessions frame
workspace.archiveSession answers the full updated archive set; workspace.list carries the set as the reconnect baseline; the host stream pushes host/archived-sessions-changed full snapshots from the domain/changed global-put branch (same posture as workspace-changed). Unknown sessions map to the existing session-not-found code.
This commit is contained in:
@@ -71,6 +71,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/archived-sessions-changed'), archivedSessionIds: z.array(sessionIdSchema) }),
|
||||
z.object({ type: z.literal('host/commands-changed') }),
|
||||
z.object({ type: z.literal('host/settings-changed'), ns: z.string() }),
|
||||
z.object({ type: z.literal('host/credentials-changed'), ref: z.string() }),
|
||||
|
||||
@@ -101,7 +101,9 @@ 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.
|
||||
* session-log deletion; 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).
|
||||
*/
|
||||
export type HostFrame =
|
||||
| { type: 'host/session-added'; sessionId: SessionId; blank: boolean; parentSessionId?: SessionId; cwd?: string }
|
||||
@@ -110,6 +112,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/archived-sessions-changed'; archivedSessionIds: SessionId[] }
|
||||
/**
|
||||
* The command registry changed (`commands/change` passthrough). Pure
|
||||
* invalidation signal, no payload: clients refetch `command.list` in the
|
||||
|
||||
@@ -42,6 +42,7 @@ export interface RpcMethodMap {
|
||||
'workspace.rename': WorkspaceApi['rename']
|
||||
'workspace.delete': WorkspaceApi['delete']
|
||||
'workspace.insertSessionBefore': WorkspaceApi['insertSessionBefore']
|
||||
'workspace.archiveSession': WorkspaceApi['archiveSession']
|
||||
'command.list': CommandsApi['list']
|
||||
'command.execute': CommandsApi['execute']
|
||||
'skill.list': SkillsApi['list']
|
||||
|
||||
@@ -28,6 +28,7 @@ export const workspaceListRequestSchema = z.object({}) satisfies z.ZodType<Wire<
|
||||
/** workspace.list response value. */
|
||||
export const workspaceListValueSchema = z.object({
|
||||
items: z.array(workspaceViewSchema),
|
||||
archivedSessionIds: z.array(sessionIdSchema),
|
||||
}) satisfies z.ZodType<Wire<ResponseValue<'workspace.list'>>>
|
||||
|
||||
/** workspace.create request payload: exactly one of path/name (the contract's create spellings). */
|
||||
@@ -80,3 +81,13 @@ export const workspaceInsertSessionBeforeRequestSchema = z.object({
|
||||
export const workspaceInsertSessionBeforeValueSchema = z.object({
|
||||
workspace: workspaceViewSchema,
|
||||
}) satisfies z.ZodType<Wire<ResponseValue<'workspace.insertSessionBefore'>>>
|
||||
|
||||
/** workspace.archiveSession request payload. */
|
||||
export const workspaceArchiveSessionRequestSchema = z.object({
|
||||
sessionId: sessionIdSchema,
|
||||
}) satisfies z.ZodType<Wire<RequestPayload<'workspace.archiveSession'>>>
|
||||
|
||||
/** workspace.archiveSession response value: the full updated archive set. */
|
||||
export const workspaceArchiveSessionValueSchema = z.object({
|
||||
archivedSessionIds: z.array(sessionIdSchema),
|
||||
}) satisfies z.ZodType<Wire<ResponseValue<'workspace.archiveSession'>>>
|
||||
|
||||
@@ -37,8 +37,13 @@ export interface WorkspaceView {
|
||||
|
||||
/** Workspace-domain unary methods (the map keys workspace.* of RpcMethodMap). */
|
||||
export interface WorkspaceApi {
|
||||
/** Lists all workspaces in the registry's durable display order. */
|
||||
list(request: RpcRequest<{}>): Promise<RpcResponse<{ items: WorkspaceView[] }>>
|
||||
/**
|
||||
* Lists all workspaces in the registry's durable display order, plus the
|
||||
* registry-global archive set (the reconnect baseline of
|
||||
* `host/archived-sessions-changed`). Archived sessions stay in their
|
||||
* workspace's `sessionIds` account; grouping surfaces hide them.
|
||||
*/
|
||||
list(request: RpcRequest<{}>): Promise<RpcResponse<{ items: WorkspaceView[]; archivedSessionIds: SessionId[] }>>
|
||||
|
||||
/**
|
||||
* Creates (or idempotently resolves) a workspace. Exactly one of `path` /
|
||||
@@ -86,4 +91,15 @@ export interface WorkspaceApi {
|
||||
sessionId: SessionId
|
||||
beforeSessionId?: SessionId
|
||||
}>): Promise<RpcResponse<{ workspace: WorkspaceView }>>
|
||||
|
||||
/**
|
||||
* Adds one session to the registry-global archive set: the session
|
||||
* disappears from every grouping surface but keeps its session log and its
|
||||
* workspace accounting slot (a future unarchive restores its position).
|
||||
* Idempotent for an already archived id. A session neither live nor in
|
||||
* session persistence fails with `session-not-found`. Returns the full
|
||||
* updated set (same snapshot the changed frame carries).
|
||||
*/
|
||||
archiveSession(request: RpcRequest<{ sessionId: SessionId }>):
|
||||
Promise<RpcResponse<{ archivedSessionIds: SessionId[] }>>
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user