@prettier-ai/dsh-client-ui-workspace 0.1.2-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.js ADDED
@@ -0,0 +1,11 @@
1
+ //#region lib/types/index.js
2
+ /**
3
+ * Workspace picker plugin, node half. Pure UI plugin: the empty apply exists
4
+ * so the plugin appears in the host cordis.yml / Loader (load and lifecycle
5
+ * follow the host; the browser half ships via exports["./client"], discovered
6
+ * through the package.json dsh.client declaration).
7
+ */
8
+ /** Host plugin body — no host-side behavior for the workspace picker plugin. */
9
+ function apply() {}
10
+ //#endregion
11
+ export { apply };
@@ -0,0 +1,25 @@
1
+ //#region lib/types/invariant.js
2
+ /**
3
+ * Package-owned invariant companion for `@prettier-ai/dsh-client-ui-workspace`.
4
+ * @module @prettier-ai/dsh-client-ui-workspace/invariant
5
+ */
6
+ const PACKAGE_NAME = "@prettier-ai/dsh-client-ui-workspace";
7
+ /** Cordis companion plugin name. */
8
+ const name = "client-ui-workspace-invariant";
9
+ /** Service required before the companion can reserve package ownership. */
10
+ const inject = ["invariants"];
11
+ /**
12
+ * No runtime invariant: a pure-consumer plugin registering presentational
13
+ * components into two host-declared slots plus its locale dictionaries — its
14
+ * inject face is stateless RPC wrappers plus a create-and-open call; it
15
+ * emits no cordis events and owns no cross-plugin mutable state.
16
+ */
17
+ const install = () => {};
18
+ /**
19
+ * Register this package's invariant companion.
20
+ * @param ctx - Cordis context carrying the invariant service.
21
+ * @returns the installed registration's disposer after setup succeeds.
22
+ */
23
+ const apply = (ctx) => Promise.resolve(ctx.invariants.register(PACKAGE_NAME, install));
24
+ //#endregion
25
+ export { apply, inject, name };
@@ -0,0 +1,57 @@
1
+ /**
2
+ * Workspace pick/add flow. WorkspacePickFlow is the reusable core (menu +
3
+ * path error dialog) consumed directly by WorkspaceBrowser (same package) and
4
+ * wrapped by WorkspacePicker for the conversation empty-state slot
5
+ * registration. Directory picking itself lives in the composed flow package's
6
+ * slot occupant (see the contract module doc): this core only opens the flow,
7
+ * adopts the picked path, and owns the error surface. Adding a workspace has
8
+ * exactly one route — pick a host directory, new or existing — because the
9
+ * occupant's own create-folder affordance already covers creating one.
10
+ */
11
+ import type { ReactNode, RefObject } from 'react';
12
+ import type { WorkspaceId, WorkspaceSnapshot, WorkspaceView } from '@prettier-ai/dsh-api-workspace-controller/client';
13
+ import type { SnapshotSelectorHook } from '@prettier-ai/dsh-client-ui-slots';
14
+ import type { DirectoryFlowOwnerProps, WorkspacePickerProps } from './contract/slots.ts';
15
+ /** Core flow props: the owner supplies popover control and pick semantics. */
16
+ export interface WorkspacePickFlowProps {
17
+ /** The standard locale seat, forwarded by whichever slot entry hosts the flow. */
18
+ t: WorkspacePickerProps['t'];
19
+ /** Popover visibility (anchor button toggle state, owner-local). */
20
+ open: boolean;
21
+ /** The anchor button element — the popover's placement anchor. */
22
+ anchorRef?: RefObject<HTMLElement | null> | undefined;
23
+ /** Selector hook over the workspace list (framework standard hook). */
24
+ useWorkspaces: <S>(selector: (state: WorkspaceSnapshot) => S) => S;
25
+ /** Adopt a picked host directory as a real Workspace. */
26
+ createWorkspace: (input: {
27
+ path: string;
28
+ }) => Promise<WorkspaceView>;
29
+ /** Bound occupancy selector hook for this surface's directory-flow hole (empty leaves the surface with no add action). */
30
+ useDirectoryFlow: SnapshotSelectorHook<boolean>;
31
+ /** Render this surface's directory-flow hole with the owner conversation (the entry's narrowed renderSlot). */
32
+ renderDirectoryFlow: (owner: DirectoryFlowOwnerProps) => ReactNode;
33
+ /** A real Workspace was picked or created. */
34
+ onPick: (workspaceId: WorkspaceId) => void;
35
+ /** Close the popover (outside click / Escape / post-pick). */
36
+ onClose: () => void;
37
+ /** Only offer the add action, hide existing workspaces. */
38
+ addOnly?: boolean;
39
+ /** Menu opening direction relative to the anchor. */
40
+ side?: 'bottom' | 'top' | 'right';
41
+ /** Currently active workspace (trailing check in the picker list). */
42
+ selectedId?: WorkspaceId | undefined;
43
+ }
44
+ /**
45
+ * Render the pick menu plus the adoption error dialog.
46
+ * @param props - owner-controlled flow props.
47
+ * @returns menu + dialog elements.
48
+ */
49
+ export declare function WorkspacePickFlow({ t, open, anchorRef, useWorkspaces, createWorkspace, useDirectoryFlow, renderDirectoryFlow, onPick, onClose, addOnly, side, selectedId, }: WorkspacePickFlowProps): import("react").JSX.Element;
50
+ /**
51
+ * The conversation empty-state registration: adapts the owner share to the
52
+ * core flow (all state and semantics live in the flow / the owner).
53
+ * @param props - empty-state slot props (owner share + injected creation callback).
54
+ * @returns the flow element.
55
+ */
56
+ export declare function WorkspacePicker({ open, anchorRef, useWorkspaces, selectedId, onPick, onClose, createWorkspace, useDirectoryFlow, renderSlot, t, }: WorkspacePickerProps): import("react").JSX.Element;
57
+ //# sourceMappingURL=WorkspacePicker.d.ts.map
@@ -0,0 +1,158 @@
1
+ /**
2
+ * ui-workspace contracts. Two registrations share this package:
3
+ *
4
+ * - WorkspaceBrowser fills the sidebar shell's `sidebar.workspaces` hole —
5
+ * the whole browsing region (section header, search, grouped/flat session
6
+ * list, workspace dialogs). It registers this package's viewing store and
7
+ * consumes the shell's two-fact owner share (wide / expandSidebar).
8
+ * - WorkspacePicker fills the conversation empty-state hole (menu + error
9
+ * dialog shared with the browser).
10
+ *
11
+ * Each registration also declares one **directory-flow hole** (`single`
12
+ * kind): the slot a composed picker package's client half fills with its
13
+ * picking interaction — a renderless native-chooser driver or an in-app
14
+ * browsing dialog. ui-workspace owns the trigger (the "Add workspace…"
15
+ * entry, present only while the hole is occupied) and the adoption
16
+ * semantics (`createWorkspace({ path })`, the retryable error dialog,
17
+ * Choose again); the occupant owns everything between `open` and the picked path,
18
+ * including creating a new directory to hand back. That occupant-owned
19
+ * creation is why adding a workspace has a single route: an unoccupied hole
20
+ * leaves the surface with no add affordance at all.
21
+ * Two holes exist because the two menu surfaces are independent slot entries
22
+ * and a hole has exactly one declaring entry — they carry the same owner
23
+ * contract and the same occupant.
24
+ */
25
+ import type { ConnectionGenerationState } from '@prettier-ai/dsh-client-connection/client';
26
+ import type { HostObservable, PropsHooks, PropsLocale, PropsRenderSlots, PropsRuntime, PropsStore } from '@prettier-ai/dsh-client-ui-slots';
27
+ import type { SessionSearchResultItem } from '@prettier-ai/dsh-api-session-controller/client';
28
+ import type { WorkspaceId, WorkspaceView } from '@prettier-ai/dsh-api-workspace-controller/client';
29
+ import type { SessionId } from '@prettier-ai/dsh-session/types';
30
+ import type { createWorkspaceViewStore } from '../stores.ts';
31
+ /**
32
+ * Owner share of the directory-flow holes: the complete conversation between
33
+ * the trigger surface and the picking interaction. The occupant reads `open`
34
+ * to run/render its interaction and reports exactly one outcome per open.
35
+ */
36
+ export interface DirectoryFlowOwnerProps {
37
+ /** True while a picking interaction is requested; flipping back to false withdraws the request. */
38
+ open: boolean;
39
+ /** True while the owner adopts a picked path (`createWorkspace` in flight); occupants disable their commit affordances. */
40
+ busy: boolean;
41
+ /** The operator picked a directory (absolute host path); the owner adopts it. */
42
+ onPicked: (path: string) => void;
43
+ /** The operator dismissed the interaction; the owner just closes the flow. */
44
+ onCancel: () => void;
45
+ /** The interaction itself failed (chooser missing, listing denied); the owner shows its error surface. */
46
+ onError: (message: string) => void;
47
+ }
48
+ declare module '@prettier-ai/dsh-client-ui-slots' {
49
+ interface SlotMap {
50
+ /** Directory-flow hole under the conversation empty-state picker (declared by the WorkspacePicker entry). */
51
+ 'conversation.hero.workspace.directoryFlow': {
52
+ kind: 'single';
53
+ scope: 'root';
54
+ owner: DirectoryFlowOwnerProps;
55
+ };
56
+ /** Directory-flow hole under the sidebar browsing region (declared by the WorkspaceBrowser entry). */
57
+ 'sidebar.workspaces.directoryFlow': {
58
+ kind: 'single';
59
+ scope: 'root';
60
+ owner: DirectoryFlowOwnerProps;
61
+ };
62
+ }
63
+ }
64
+ /** The two directory-flow holes; a flow package's client half registers its one component into both. */
65
+ export type DirectoryFlowSlotName = 'conversation.hero.workspace.directoryFlow' | 'sidebar.workspaces.directoryFlow';
66
+ /**
67
+ * Directory-picking share both trigger surfaces consume. Occupancy rides the
68
+ * inject face's reserved `hooks` compartment: the renderer binds the source
69
+ * into the `useDirectoryFlow` selector hook, so an empty hole hides the
70
+ * "Add workspace…" entry reactively and the surface withdraws an open
71
+ * flow whose occupant unloaded mid-interaction (nobody is left to cancel).
72
+ */
73
+ export type DirectoryPickingInjected = {
74
+ hooks: {
75
+ /** True while this surface's directory-flow hole is occupied. */
76
+ directoryFlow: HostObservable<boolean>;
77
+ };
78
+ };
79
+ /** Component-side view of the picking share: the bound occupancy selector hook. */
80
+ export type DirectoryPickingHooks = PropsHooks<DirectoryPickingInjected['hooks']>;
81
+ /**
82
+ * Browser-private injected share (arrives via the register inject factory).
83
+ * Data reads use the global framework hooks; these are the Host actions the
84
+ * browsing region drives.
85
+ */
86
+ export type WorkspaceBrowserInjected = {
87
+ hooks: DirectoryPickingInjected['hooks'] & {
88
+ /** Current generation's Host description, bound by the slot renderer. */
89
+ connectionGeneration: ConnectionGenerationState;
90
+ };
91
+ /**
92
+ * Start a New Session in a Workspace: reuse-or-create its blank session and
93
+ * open it; without an explicit workspace, inherit the current Session
94
+ * Workspace, then the recent Workspace, or clear into the New Session view.
95
+ */
96
+ startSession: (workspaceId?: WorkspaceId) => void;
97
+ /** Open a real Session. */
98
+ open: (sessionId: SessionId) => void;
99
+ /**
100
+ * Search current visible conversation messages. The Host fixes the result
101
+ * bound; `hasMore` means the query needs narrowing.
102
+ */
103
+ searchSessions: (query: string, signal: AbortSignal) => Promise<{
104
+ items: readonly SessionSearchResultItem[];
105
+ hasMore: boolean;
106
+ }>;
107
+ /** Maximum number of merged rows rendered for one search. */
108
+ searchResultLimit: number;
109
+ /** Rename a Session (explicit user title; resolves on host acceptance). */
110
+ renameSession: (sessionId: SessionId, title: string) => Promise<void>;
111
+ /** Fork a Session at its last completed turn and open the child. */
112
+ forkSession: (sessionId: SessionId) => void;
113
+ /** Rename a Host Workspace (rejects on name conflict; resolves on durability). */
114
+ renameWorkspace: (workspaceId: WorkspaceId, title: string) => Promise<void>;
115
+ /** Delete only a Host Workspace registration; directory and Session logs remain. */
116
+ deleteWorkspace: (workspaceId: WorkspaceId) => Promise<void>;
117
+ /**
118
+ * Reorder a Workspace in the durable registry display order.
119
+ * Omitted anchor appends to the end.
120
+ */
121
+ insertWorkspaceBefore: (workspaceId: WorkspaceId, beforeWorkspaceId?: WorkspaceId) => Promise<void>;
122
+ /**
123
+ * Archive a Session into the registry-global set: hidden from grouping
124
+ * surfaces, log and accounting slot retained. Archiving the current
125
+ * session clears the selection into the New Session view state.
126
+ */
127
+ archiveSession: (sessionId: SessionId) => Promise<void>;
128
+ /**
129
+ * Reorder a session inside its Workspace account (DOM-insertBefore
130
+ * semantics: omitted anchor appends to the end). The view refreshes from
131
+ * the Host response/changed frame; failures leave the order unchanged.
132
+ */
133
+ insertSessionBefore: (workspaceId: WorkspaceId, sessionId: SessionId, beforeSessionId?: SessionId) => Promise<void>;
134
+ /** Adopt a picked host directory as a real Workspace before targeting a Session. */
135
+ createWorkspace: (input: {
136
+ path: string;
137
+ }) => Promise<WorkspaceView>;
138
+ };
139
+ /** Full browser props: shell owner share + viewing store + injected actions + the locale seat. */
140
+ export type WorkspaceBrowserProps = PropsRuntime<'sidebar.workspaces'> & PropsRenderSlots<'sidebar.workspaces.directoryFlow'> & PropsStore<ReturnType<typeof createWorkspaceViewStore>> & Omit<WorkspaceBrowserInjected, 'hooks'> & PropsHooks<WorkspaceBrowserInjected['hooks']> & PropsLocale<'workspace'>;
141
+ /**
142
+ * Picker-private injected share. Pick semantics remain in the owner's onPick
143
+ * callback; this callback creates only the real Host Workspace. A type alias
144
+ * supplies the implicit index signature required by the registry.
145
+ */
146
+ export type WorkspacePickerInjected = DirectoryPickingInjected & {
147
+ /** Adopt a picked host directory as a real Workspace before targeting a Session. */
148
+ createWorkspace: (input: {
149
+ path: string;
150
+ }) => Promise<WorkspaceView>;
151
+ };
152
+ /**
153
+ * Full picker props: the owner share plus the creation callback and the
154
+ * locale seat. The two picker holes (blank-session hero / New-Session view)
155
+ * share one owner currency, so one composed type serves both registrations.
156
+ */
157
+ export type WorkspacePickerProps = PropsRuntime<'conversation.hero.workspace'> & PropsRenderSlots<'conversation.hero.workspace.directoryFlow'> & Omit<WorkspacePickerInjected, 'hooks'> & DirectoryPickingHooks & PropsLocale<'workspace'>;
158
+ //# sourceMappingURL=slots.d.ts.map
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Workspace plugin, browser half. Two registrations: WorkspaceBrowser fills
3
+ * the sidebar shell's `sidebar.workspaces` hole (the whole browsing region),
4
+ * and WorkspacePicker fills the conversation hero's picker hole
5
+ * (`conversation.hero.workspace` — both hero forms). Both read real Host
6
+ * Workspaces through the global useWorkspaces hook, and each declares its
7
+ * own `single` directory-flow child hole for the composed picker package's
8
+ * client half (see the contract module doc). Export discipline:
9
+ * packages/client/AGENTS.md.
10
+ */
11
+ import type { Context } from '@prettier-ai/cordis';
12
+ import type { WorkspaceSnapshot } from '@prettier-ai/dsh-api-workspace-controller/client';
13
+ import type { SnapshotSelectorHook } from '@prettier-ai/dsh-client-ui-slots';
14
+ import { type WorkspaceKey } from './locales.ts';
15
+ export type { UiWorkspace } from './navigation.ts';
16
+ export type { DirectoryFlowOwnerProps, DirectoryFlowSlotName, DirectoryPickingHooks, DirectoryPickingInjected, WorkspaceBrowserInjected, WorkspaceBrowserProps, WorkspacePickerInjected, WorkspacePickerProps, } from './contract/slots.ts';
17
+ export type { WorkspaceKey } from './locales.ts';
18
+ declare module '@prettier-ai/dsh-client-ui-slots' {
19
+ interface GlobalStandardProps {
20
+ /** Selector hook over the pure Workspace Controller snapshot. */
21
+ useWorkspaces: SnapshotSelectorHook<WorkspaceSnapshot>;
22
+ }
23
+ interface LocaleNamespaceMap {
24
+ /** The workspace browsing region and pick/create flow copy. */
25
+ workspace: WorkspaceKey;
26
+ }
27
+ }
28
+ /**
29
+ * Required services (cordis fiber inject). The target slots are declared by
30
+ * the ui-sidebar / ui-conversation applies, whose activation order relative
31
+ * to this one is NOT constrained: dsh.client.inject edges are informational
32
+ * (loading/prefetch metadata, never apply sequencing) and neither owner
33
+ * provides a waitable service. apply therefore depends on each slot
34
+ * declaration through `slots.inject()` instead of assuming order.
35
+ */
36
+ export declare const inject: string[];
37
+ /**
38
+ * Register the browser and picker once their slot declarations are on the
39
+ * ledger. Inject factories return plain callbacks; data reads use the
40
+ * framework's global hooks.
41
+ * @param ctx - client root context.
42
+ */
43
+ export declare function apply(ctx: Context): void;
44
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,138 @@
1
+ /**
2
+ * `workspace` namespace dictionaries: the browsing region (section header,
3
+ * search, tree rows, dialogs) and the pick/add flow. Runtime failure
4
+ * messages (wire error strings) pass through untranslated by policy.
5
+ */
6
+ /** Simplified Chinese dictionary (the key-set source of truth). */
7
+ export declare const zh: {
8
+ 'group.ungrouped': string;
9
+ 'session.new': string;
10
+ 'section.workspaces': string;
11
+ 'section.sessions': string;
12
+ 'viewOptions.label': string;
13
+ 'groupBy.label': string;
14
+ 'groupBy.workspace': string;
15
+ 'groupBy.flat': string;
16
+ 'orderBy.label': string;
17
+ 'orderBy.manual': string;
18
+ 'orderBy.updated': string;
19
+ 'sessions.expand': string;
20
+ 'sessions.collapse': string;
21
+ 'empty.none': string;
22
+ 'empty.noMatches': string;
23
+ 'workspace.add': string;
24
+ 'search.sessions.aria': string;
25
+ 'search.placeholder': string;
26
+ 'search.clear': string;
27
+ 'search.results.aria': string;
28
+ 'search.pending': string;
29
+ 'search.unavailable': string;
30
+ 'search.noMatches': string;
31
+ 'search.hasMore': string;
32
+ 'menu.addWorkspace': string;
33
+ 'picker.loading': string;
34
+ 'conflict.named': string;
35
+ 'folderError.title': string;
36
+ 'folderError.retry': string;
37
+ rename: string;
38
+ 'rename.workspace.title': string;
39
+ 'rename.session.title': string;
40
+ 'field.workspaceName': string;
41
+ 'field.sessionName': string;
42
+ 'delete.workspace': string;
43
+ 'delete.desc': string;
44
+ 'delete.pending': string;
45
+ 'menu.fork': string;
46
+ 'menu.archiveSession': string;
47
+ 'sessions.count.one': string;
48
+ 'sessions.count.other': string;
49
+ 'actions.workspace.aria': string;
50
+ 'actions.session.aria': string;
51
+ 'actions.newSession.aria': string;
52
+ 'status.running': string;
53
+ 'status.subagentsRunning.one': string;
54
+ 'status.subagentsRunning.other': string;
55
+ 'status.idle': string;
56
+ 'status.waitingApproval': string;
57
+ 'status.planReview': string;
58
+ 'status.waitingAnswer': string;
59
+ 'status.completed': string;
60
+ 'hover.created': string;
61
+ 'hover.copied': string;
62
+ 'date.ymd': string;
63
+ 'time.now': string;
64
+ 'time.minutes': string;
65
+ 'time.hours': string;
66
+ 'time.days': string;
67
+ 'time.months': string;
68
+ 'time.years': string;
69
+ 'time.ago': string;
70
+ };
71
+ /** The workspace namespace key union. */
72
+ export type WorkspaceKey = keyof typeof zh;
73
+ /** English dictionary, checked complete against the zh key set. */
74
+ export declare const en: {
75
+ 'group.ungrouped': string;
76
+ 'session.new': string;
77
+ 'section.workspaces': string;
78
+ 'section.sessions': string;
79
+ 'viewOptions.label': string;
80
+ 'groupBy.label': string;
81
+ 'groupBy.workspace': string;
82
+ 'groupBy.flat': string;
83
+ 'orderBy.label': string;
84
+ 'orderBy.manual': string;
85
+ 'orderBy.updated': string;
86
+ 'sessions.expand': string;
87
+ 'sessions.collapse': string;
88
+ 'empty.none': string;
89
+ 'empty.noMatches': string;
90
+ 'workspace.add': string;
91
+ 'search.sessions.aria': string;
92
+ 'search.placeholder': string;
93
+ 'search.clear': string;
94
+ 'search.results.aria': string;
95
+ 'search.pending': string;
96
+ 'search.unavailable': string;
97
+ 'search.noMatches': string;
98
+ 'search.hasMore': string;
99
+ 'menu.addWorkspace': string;
100
+ 'picker.loading': string;
101
+ 'conflict.named': string;
102
+ 'folderError.title': string;
103
+ 'folderError.retry': string;
104
+ rename: string;
105
+ 'rename.workspace.title': string;
106
+ 'rename.session.title': string;
107
+ 'field.workspaceName': string;
108
+ 'field.sessionName': string;
109
+ 'delete.workspace': string;
110
+ 'delete.desc': string;
111
+ 'delete.pending': string;
112
+ 'menu.fork': string;
113
+ 'menu.archiveSession': string;
114
+ 'sessions.count.one': string;
115
+ 'sessions.count.other': string;
116
+ 'actions.workspace.aria': string;
117
+ 'actions.session.aria': string;
118
+ 'actions.newSession.aria': string;
119
+ 'status.running': string;
120
+ 'status.subagentsRunning.one': string;
121
+ 'status.subagentsRunning.other': string;
122
+ 'status.idle': string;
123
+ 'status.waitingApproval': string;
124
+ 'status.planReview': string;
125
+ 'status.waitingAnswer': string;
126
+ 'status.completed': string;
127
+ 'hover.created': string;
128
+ 'hover.copied': string;
129
+ 'date.ymd': string;
130
+ 'time.now': string;
131
+ 'time.minutes': string;
132
+ 'time.hours': string;
133
+ 'time.days': string;
134
+ 'time.months': string;
135
+ 'time.years': string;
136
+ 'time.ago': string;
137
+ };
138
+ //# sourceMappingURL=locales.d.ts.map
@@ -0,0 +1,83 @@
1
+ /** Workspace archive and directory UI capability. */
2
+ import { Service, type Context } from '@prettier-ai/cordis';
3
+ import type { ClientRemote, DirectoryListing } from '@prettier-ai/dsh-api-remotes/client';
4
+ import type { RemoteFailure } from '@prettier-ai/dsh-typert-protocol';
5
+ import type { ISessions } from '@prettier-ai/dsh-api-session-controller/client';
6
+ import type { IWorkspaces, WorkspaceId } from '@prettier-ai/dsh-api-workspace-controller/client';
7
+ import type { SessionId } from '@prettier-ai/dsh-session/types';
8
+ /** Workspace archive and directory operations consumed by Client UI domains. */
9
+ export interface UiWorkspace {
10
+ /**
11
+ * Resolve the reusable or newly created blank Session for a Workspace.
12
+ * @param workspaceId - target Workspace.
13
+ * @returns a Session already addressable through the Session Controller.
14
+ */
15
+ connectWorkspace(workspaceId: WorkspaceId): Promise<SessionId>;
16
+ /**
17
+ * Start a New Session flow and navigate to its Session.
18
+ * @param workspaceId - explicit target; absent inherits the current or most recent Workspace.
19
+ */
20
+ startSession(workspaceId?: WorkspaceId): void;
21
+ /**
22
+ * Archive a Session and clear it when it is the current selection.
23
+ * @param sessionId - Session to archive.
24
+ */
25
+ archiveSession(sessionId: SessionId): Promise<void>;
26
+ /**
27
+ * Open the Host-native directory picker.
28
+ * @returns the selected directory, or null when cancelled.
29
+ */
30
+ pickDirectory(): Promise<string | null>;
31
+ /**
32
+ * List one Host directory level.
33
+ * @param path - directory path; absent selects the Host home.
34
+ * @param signal - cancellation for a superseded scan.
35
+ * @returns directory entries and breadcrumb ancestry.
36
+ */
37
+ listDirectory(path?: string, signal?: AbortSignal): Promise<DirectoryListing>;
38
+ /**
39
+ * Create a child directory.
40
+ * @param path - existing parent directory.
41
+ * @param name - child directory name.
42
+ * @returns created absolute path.
43
+ */
44
+ createDirectory(path: string, name: string): Promise<string>;
45
+ }
46
+ declare module '@prettier-ai/cordis' {
47
+ interface Context {
48
+ /** Cross-Controller Workspace navigation and directory UI capability. */
49
+ uiWorkspace: UiWorkspace;
50
+ }
51
+ }
52
+ /** Structured directory failure exposed to directory UI consumers. */
53
+ export declare class DirectoryBrowseError extends Error {
54
+ readonly rpcError: RemoteFailure;
55
+ readonly name = "DirectoryBrowseError";
56
+ /** @param rpcError - Host directory business failure. */
57
+ constructor(rpcError: RemoteFailure);
58
+ }
59
+ /** Implements Workspace archive and directory UI operations. */
60
+ declare class UiWorkspaceService extends Service implements UiWorkspace {
61
+ private readonly directoryPicker;
62
+ private readonly workspaces;
63
+ private readonly sessions;
64
+ private readonly connecting;
65
+ /**
66
+ * @param ctx - Client root Context.
67
+ * @param directoryPicker - the directory-picking Remote namespace.
68
+ * @param workspaces - pure Workspace Controller.
69
+ * @param sessions - pure Session Controller.
70
+ */
71
+ constructor(ctx: Context, directoryPicker: ClientRemote['directoryPicker'], workspaces: IWorkspaces, sessions: ISessions);
72
+ connectWorkspace(workspaceId: WorkspaceId): Promise<SessionId>;
73
+ startSession(workspaceId?: WorkspaceId): void;
74
+ archiveSession(sessionId: SessionId): Promise<void>;
75
+ pickDirectory(): Promise<string | null>;
76
+ listDirectory(path?: string, signal?: AbortSignal): Promise<DirectoryListing>;
77
+ createDirectory(path: string, name: string): Promise<string>;
78
+ private watchNavigation;
79
+ /** @returns true when an archived current selection was cleared. */
80
+ private clearArchivedCurrent;
81
+ }
82
+ export { UiWorkspaceService };
83
+ //# sourceMappingURL=navigation.d.ts.map
@@ -0,0 +1,103 @@
1
+ import type { WorkspaceBrowserProps } from '../contract/slots.ts';
2
+ import type { GroupNode, SearchResultNode, SessionNode } from '../tree.ts';
3
+ /** The standard locale seat, prop-passed from the browser root. */
4
+ type RowTranslate = WorkspaceBrowserProps['t'];
5
+ /**
6
+ * Row drag wiring supplied by the tree owner. `drop` reports the half of the
7
+ * row where the pointer released so the owner can resolve an insert anchor.
8
+ */
9
+ export interface RowDragProps {
10
+ /** Start dragging this row. */
11
+ start: () => void;
12
+ /** A compatible row drag is in flight. */
13
+ active: boolean;
14
+ /** Current marker on this row: insert line above, below, or none. */
15
+ marker: 'before' | 'after' | null;
16
+ /** Report the hovered half while a compatible drag passes over this row. */
17
+ hover: (half: 'before' | 'after') => void;
18
+ drop: (half: 'before' | 'after') => void;
19
+ end: () => void;
20
+ }
21
+ /** Drag lifecycle owned by a workspace row; its enclosing group owns hit testing. */
22
+ interface WorkspaceRowDragProps {
23
+ start: () => void;
24
+ end: () => void;
25
+ }
26
+ /**
27
+ * Project (workspace) header row: folder + title;
28
+ * hover reveals the chevron and create button, and dwelling on a real
29
+ * Workspace shows its hover card (the ungrouped bucket has none).
30
+ * `containsCurrent` arrives on the node (derivation fact, no renderer scan).
31
+ * @param props.group - derived group node.
32
+ * @param props.onToggle - expand/collapse the group.
33
+ * @param props.onCreate - start a frontend Session inside this Workspace.
34
+ * @param props.drag - optional workspace-row drag wiring.
35
+ * @param props.home - host account home for POSIX hover-path abbreviation.
36
+ * @param props.t - the browser root's locale seat.
37
+ * @returns the row element.
38
+ */
39
+ export declare function ProjectRowItem({ group, onToggle, onCreate, actions, drag, home, t }: {
40
+ group: GroupNode;
41
+ onToggle: () => void;
42
+ onCreate: () => void;
43
+ /** Real-Workspace actions; absent for the ungrouped bucket (no menu shown). */
44
+ actions?: {
45
+ rename: () => void;
46
+ delete: () => void;
47
+ } | undefined;
48
+ /** Present only for real Workspace rows in the grouped view. */
49
+ drag?: WorkspaceRowDragProps | undefined;
50
+ /** Host account home; POSIX home-rooted hover paths display as `~`. */
51
+ home?: string | undefined;
52
+ t: RowTranslate;
53
+ }): import("react").JSX.Element;
54
+ /**
55
+ * One flat search result: title, Workspace context, and optional content
56
+ * excerpt. Search navigation opens the session only; it does not address an
57
+ * event inside the conversation.
58
+ * @param props.result - merged local/content search row.
59
+ * @param props.currentId - selected session id.
60
+ * @param props.onOpen - open the selected session.
61
+ * @param props.t - Workspace-browser translation seat.
62
+ * @returns the result button.
63
+ */
64
+ export declare function SearchResultItem({ result, currentId, onOpen, t }: {
65
+ result: SearchResultNode;
66
+ currentId: string | undefined;
67
+ onOpen: (id: SearchResultNode['id']) => void;
68
+ t: RowTranslate;
69
+ }): import("react").JSX.Element;
70
+ /**
71
+ * One top-level 34px session row: status dot (pending user interaction outranks
72
+ * own or descendant activity), title, relative time, and the row actions menu.
73
+ * @param props.node - derived session node.
74
+ * @param props.currentId - selected session id (row highlight).
75
+ * @param props.now - epoch ms for relative-time formatting.
76
+ * @param props.onOpen - open a session by id.
77
+ * @param props.onRename - open the session rename dialog (id + current title).
78
+ * @param props.onFork - fork a session at its last completed turn.
79
+ * @param props.onArchive - archive a session by id.
80
+ * @param props.drag - optional draggable-row wiring.
81
+ * @param props.flat - omit the empty status slot in the hierarchy-free flat list.
82
+ * @param props.t - the browser root's locale seat.
83
+ * @returns the session row.
84
+ */
85
+ export declare function SessionNodeItem({ node, currentId, now, onOpen, onRename, onFork, onArchive, drag, flat, t }: {
86
+ node: SessionNode;
87
+ currentId: string | undefined;
88
+ now: number;
89
+ onOpen: (id: SessionNode['id']) => void;
90
+ /** Open the browser-owned session rename dialog (row menu action). */
91
+ onRename: (id: SessionNode['id'], currentTitle: string) => void;
92
+ /** Fork a session at its last completed turn (row menu action). */
93
+ onFork: (id: SessionNode['id']) => void;
94
+ /** Archive this session (row menu action; commits without a dialog). */
95
+ onArchive: (id: SessionNode['id']) => void;
96
+ /** Present only on draggable rows (workspace-group sessions outside search). */
97
+ drag?: RowDragProps | undefined;
98
+ /** The row is rendered without a parent Workspace header. */
99
+ flat?: boolean | undefined;
100
+ t: RowTranslate;
101
+ }): import("react").JSX.Element;
102
+ export {};
103
+ //# sourceMappingURL=Rows.d.ts.map
@@ -0,0 +1,8 @@
1
+ import type { WorkspaceBrowserProps } from '../contract/slots.ts';
2
+ /**
3
+ * Render the browsing region.
4
+ * @param props - composed slot props (shell owner share + store + injected actions).
5
+ * @returns the region element tree.
6
+ */
7
+ export declare function WorkspaceBrowser({ wide, expandSidebar, useSessions, useSessionPendingInteraction, useWorkspaces, useStore, actions, startSession, open, renameSession, forkSession, renameWorkspace, deleteWorkspace, insertWorkspaceBefore, archiveSession, insertSessionBefore, createWorkspace, searchSessions, searchResultLimit, useDirectoryFlow, useConnectionGeneration, renderSlot, t, }: WorkspaceBrowserProps): import("react").JSX.Element;
8
+ //# sourceMappingURL=WorkspaceBrowser.d.ts.map