Sidebar session list grows the figma 239-10458 feature set and the
workspace/session browsing region moves wholesale into ui-workspace:
- Group-by menu (WorkSpace / In one list): flat mode lists every session
top-level, strictly newest-first; the choice persists across reloads.
- Session rows get a 500ms hover detail card (title / relative time /
status line) and a ... menu (Rename / Fork session / Delete session,
visual-only for now); workspace headers get ... with Rename (wired) and
Delete workspace (visual-only).
- workspace.rename RPC: trims, rejects duplicate titles on the create
chain (workspace-name-conflict), no-op on same title; modal dialog with
client-side duplicate pre-check.
- workspace.insertSessionBefore RPC (DOM-insertBefore semantics, omitted
anchor appends): HTML5 drag reorder of root sessions inside a workspace
group; order truth stays host-side, the view refreshes from the
response/changed frame.
- Activity pinning removed: the session/event touchSession chain is gone;
workspace accounts are manually owned (new sessions prepend, explicit
reordering only). Contracts and tests updated, api catalog regenerated.
- ui-sidebar reduced to the column shell (brand, fold state machine, New
Session, Settings) exposing one sidebar.workspaces hole with a two-fact
owner share {wide, expandSidebar}; ui-workspace owns the whole region
(header, search, grouped/flat lists, dialogs, drag) plus the picker via
a shared WorkspaceCreateFlow. The old sidebar.workspace picker slot and
its deferral indirection are gone.
- ui-primitives: Menu gains label entries, danger rows, and
closeOnPointerLeave; new HoverCard (portaled, open-delay, disabled
guard). Hover card and row menu never coexist.
73 lines
2.9 KiB
TypeScript
73 lines
2.9 KiB
TypeScript
/**
|
|
* workspace domain zod schemas (names derived from map keys). The
|
|
* WorkspaceId brand cast lives in sessions.schema (see the note there) and
|
|
* is re-exported here as the domain-local name.
|
|
*/
|
|
|
|
import { z } from 'zod'
|
|
import type { RequestPayload, ResponseValue } from './rpc-map.ts'
|
|
import type { Wire } from './rpc.schema.ts'
|
|
import type { WorkspaceView } from './workspace.ts'
|
|
import { sessionIdSchema, workspaceIdSchema } from './sessions.schema.ts'
|
|
|
|
export { workspaceIdSchema } from './sessions.schema.ts'
|
|
|
|
/** WorkspaceView row of every workspace.* response. */
|
|
export const workspaceViewSchema = z.object({
|
|
workspaceId: workspaceIdSchema,
|
|
path: z.string(),
|
|
title: z.string(),
|
|
sessionIds: z.array(sessionIdSchema),
|
|
createdAt: z.string(),
|
|
updatedAt: z.string(),
|
|
}) satisfies z.ZodType<Wire<WorkspaceView>>
|
|
|
|
/** workspace.list request payload (empty object literal). */
|
|
export const workspaceListRequestSchema = z.object({}) satisfies z.ZodType<Wire<RequestPayload<'workspace.list'>>>
|
|
|
|
/** workspace.list response value. */
|
|
export const workspaceListValueSchema = z.object({
|
|
items: z.array(workspaceViewSchema),
|
|
}) satisfies z.ZodType<Wire<ResponseValue<'workspace.list'>>>
|
|
|
|
/** workspace.create request payload: exactly one of path/name (the contract's create spellings). */
|
|
export const workspaceCreateRequestSchema = z.object({
|
|
path: z.string().optional(),
|
|
name: z.string().optional(),
|
|
}).refine(
|
|
payload => (payload.path === undefined) !== (payload.name === undefined),
|
|
{ message: 'workspace.create requires exactly one of path / name' },
|
|
) satisfies z.ZodType<Wire<RequestPayload<'workspace.create'>>>
|
|
|
|
/** workspace.create response value. */
|
|
export const workspaceCreateValueSchema = z.object({
|
|
workspace: workspaceViewSchema,
|
|
created: z.boolean(),
|
|
}) satisfies z.ZodType<Wire<ResponseValue<'workspace.create'>>>
|
|
|
|
/** workspace.rename request payload: the new title must be non-blank. */
|
|
export const workspaceRenameRequestSchema = z.object({
|
|
workspaceId: workspaceIdSchema,
|
|
title: z.string(),
|
|
}).refine(
|
|
payload => payload.title.trim() !== '',
|
|
{ message: 'workspace.rename requires a non-blank title' },
|
|
) satisfies z.ZodType<Wire<RequestPayload<'workspace.rename'>>>
|
|
|
|
/** workspace.rename response value. */
|
|
export const workspaceRenameValueSchema = z.object({
|
|
workspace: workspaceViewSchema,
|
|
}) satisfies z.ZodType<Wire<ResponseValue<'workspace.rename'>>>
|
|
|
|
/** workspace.insertSessionBefore request payload (anchor omitted = append to end). */
|
|
export const workspaceInsertSessionBeforeRequestSchema = z.object({
|
|
workspaceId: workspaceIdSchema,
|
|
sessionId: sessionIdSchema,
|
|
beforeSessionId: sessionIdSchema.optional(),
|
|
}) satisfies z.ZodType<Wire<RequestPayload<'workspace.insertSessionBefore'>>>
|
|
|
|
/** workspace.insertSessionBefore response value. */
|
|
export const workspaceInsertSessionBeforeValueSchema = z.object({
|
|
workspace: workspaceViewSchema,
|
|
}) satisfies z.ZodType<Wire<ResponseValue<'workspace.insertSessionBefore'>>>
|