@qilin-agent/client-ui-workspace 0.0.0-stage → 3.1.4
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/LICENSE +21 -0
- package/README.i18n.yaml +67 -0
- package/README.md +134 -2
- package/README.zh.md +135 -0
- package/lib/client.js +3334 -0
- package/lib/index.js +11 -0
- package/lib/types/client/WorkspacePicker.d.ts +57 -0
- package/lib/types/client/contract/slots.d.ts +213 -0
- package/lib/types/client/index.d.ts +49 -0
- package/lib/types/client/locales.d.ts +160 -0
- package/lib/types/client/navigation.d.ts +148 -0
- package/lib/types/client/pin-order.d.ts +26 -0
- package/lib/types/client/rows/Rows.d.ts +116 -0
- package/lib/types/client/rows/WorkspaceBrowser.d.ts +8 -0
- package/lib/types/client/shortcuts.d.ts +39 -0
- package/lib/types/client/stores.d.ts +54 -0
- package/lib/types/client/subagent-lineage.d.ts +21 -0
- package/lib/types/client/tree.d.ts +187 -0
- package/lib/types/index.d.ts +9 -0
- package/package.json +85 -3
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import type { PropsRenderSlots } from '@qilin-agent/client-ui-slots';
|
|
2
|
+
import type { WorkspaceBrowserProps } from '../contract/slots.ts';
|
|
3
|
+
import type { GroupNode, SearchResultNode, SessionNode } from '../tree.ts';
|
|
4
|
+
/** The standard locale seat, prop-passed from the browser root. */
|
|
5
|
+
type RowTranslate = WorkspaceBrowserProps['t'];
|
|
6
|
+
/**
|
|
7
|
+
* Row drag wiring supplied by the tree owner. `drop` reports the half of the
|
|
8
|
+
* row where the pointer released so the owner can resolve an insert anchor.
|
|
9
|
+
*/
|
|
10
|
+
export interface RowDragProps {
|
|
11
|
+
/** Start dragging this row. */
|
|
12
|
+
start: () => void;
|
|
13
|
+
/** A compatible row drag is in flight. */
|
|
14
|
+
active: boolean;
|
|
15
|
+
/** Current marker on this row: insert line above, below, or none. */
|
|
16
|
+
marker: 'before' | 'after' | null;
|
|
17
|
+
/** Report the hovered half while a compatible drag passes over this row. */
|
|
18
|
+
hover: (half: 'before' | 'after') => void;
|
|
19
|
+
drop: (half: 'before' | 'after') => void;
|
|
20
|
+
end: () => void;
|
|
21
|
+
}
|
|
22
|
+
/** Drag lifecycle owned by a workspace row; its enclosing group owns hit testing. */
|
|
23
|
+
interface WorkspaceRowDragProps {
|
|
24
|
+
start: () => void;
|
|
25
|
+
end: () => void;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Project (workspace) header row: folder + title;
|
|
29
|
+
* hover reveals the chevron and create button, and dwelling on a real
|
|
30
|
+
* Workspace shows its hover card (the ungrouped bucket has none).
|
|
31
|
+
* `containsCurrent` arrives on the node (derivation fact, no renderer scan).
|
|
32
|
+
* @param props.group - derived group node.
|
|
33
|
+
* @param props.containsCurrentDescendant - highlight an ancestor even when its subtree is collapsed.
|
|
34
|
+
* @param props.onToggle - expand/collapse the group.
|
|
35
|
+
* @param props.onCreate - start a frontend Session inside this Workspace.
|
|
36
|
+
* @param props.drag - optional workspace-row drag wiring.
|
|
37
|
+
* @param props.home - host account home for POSIX hover-path abbreviation.
|
|
38
|
+
* @param props.t - the browser root's locale seat.
|
|
39
|
+
* @returns the row element.
|
|
40
|
+
*/
|
|
41
|
+
export declare function ProjectRowItem({ group, containsCurrentDescendant, onToggle, onCreate, actions, drag, home, t }: {
|
|
42
|
+
group: GroupNode;
|
|
43
|
+
containsCurrentDescendant?: boolean;
|
|
44
|
+
onToggle: () => void;
|
|
45
|
+
onCreate: () => void;
|
|
46
|
+
/** Real-Workspace actions; absent for the ungrouped bucket (no menu shown). */
|
|
47
|
+
actions?: {
|
|
48
|
+
rename: () => void;
|
|
49
|
+
delete: () => void;
|
|
50
|
+
} | undefined;
|
|
51
|
+
/** Present only for real Workspace rows in the grouped view. */
|
|
52
|
+
drag?: WorkspaceRowDragProps | undefined;
|
|
53
|
+
/** Host account home; POSIX home-rooted hover paths display as `~`. */
|
|
54
|
+
home?: string | undefined;
|
|
55
|
+
t: RowTranslate;
|
|
56
|
+
}): import("react").JSX.Element;
|
|
57
|
+
/** Child seats a Session row renders: its leading decoration and hover-card section. */
|
|
58
|
+
type SessionRowRenderSlots = PropsRenderSlots<'sidebar.session.row.leading' | 'sidebar.session.row.hover'>['renderSlot'];
|
|
59
|
+
/**
|
|
60
|
+
* One flat search result: title, Workspace context, and optional content
|
|
61
|
+
* excerpt. Search navigation opens the session only; it does not address an
|
|
62
|
+
* event inside the conversation.
|
|
63
|
+
* @param props.result - merged local/content search row.
|
|
64
|
+
* @param props.currentId - selected session id.
|
|
65
|
+
* @param props.onOpen - open the selected session.
|
|
66
|
+
* @param props.t - Workspace-browser translation seat.
|
|
67
|
+
* @returns the result button.
|
|
68
|
+
*/
|
|
69
|
+
export declare function SearchResultItem({ result, currentId, onOpen, t }: {
|
|
70
|
+
result: SearchResultNode;
|
|
71
|
+
currentId: string | undefined;
|
|
72
|
+
onOpen: (id: SearchResultNode['id']) => void;
|
|
73
|
+
t: RowTranslate;
|
|
74
|
+
}): import("react").JSX.Element;
|
|
75
|
+
/**
|
|
76
|
+
* One top-level 34px session row: status dot (pending user interaction outranks
|
|
77
|
+
* own or descendant activity), title, relative time, and the row actions menu.
|
|
78
|
+
* @param props.node - derived session node.
|
|
79
|
+
* @param props.currentId - selected session id (row highlight).
|
|
80
|
+
* @param props.now - epoch ms for relative-time formatting.
|
|
81
|
+
* @param props.onOpen - open a session by id.
|
|
82
|
+
* @param props.onRename - open the session rename dialog (id + current title).
|
|
83
|
+
* @param props.onFork - fork a session at its last completed turn.
|
|
84
|
+
* @param props.onArchive - archive a session by id.
|
|
85
|
+
* @param props.onPin - pin a session by id (leading its group and the flat list).
|
|
86
|
+
* @param props.onUnpin - drop a session's pin.
|
|
87
|
+
* @param props.onReveal - scroll this row into view after search navigation, then acknowledge it.
|
|
88
|
+
* @param props.drag - optional row-drag target wiring; blank rows cannot start a drag.
|
|
89
|
+
* @param props.t - the browser root's locale seat.
|
|
90
|
+
* @returns the session row.
|
|
91
|
+
*/
|
|
92
|
+
export declare function SessionNodeItem({ node, currentId, now, onOpen, onRename, onFork, onArchive, onPin, onUnpin, onReveal, drag, renderSlot, t, }: {
|
|
93
|
+
node: SessionNode;
|
|
94
|
+
currentId: string | undefined;
|
|
95
|
+
now: number;
|
|
96
|
+
onOpen: (id: SessionNode['id']) => void;
|
|
97
|
+
/** Open the browser-owned session rename dialog (row menu action). */
|
|
98
|
+
onRename: (id: SessionNode['id'], currentTitle: string) => void;
|
|
99
|
+
/** Fork a session at its last completed turn (row menu action). */
|
|
100
|
+
onFork: (id: SessionNode['id']) => void;
|
|
101
|
+
/** Archive this session (row menu action; commits without a dialog). */
|
|
102
|
+
onArchive: (id: SessionNode['id']) => void;
|
|
103
|
+
/** Pin this session ahead of unpinned rows (row menu and hover action). */
|
|
104
|
+
onPin: (id: SessionNode['id']) => void;
|
|
105
|
+
/** Drop this session's pin (row menu and hover action). */
|
|
106
|
+
onUnpin: (id: SessionNode['id']) => void;
|
|
107
|
+
/** Scroll this row into view after search navigation, then acknowledge it. */
|
|
108
|
+
onReveal?: (() => void) | undefined;
|
|
109
|
+
/** Present on reorderable-list rows so every row can remain a drop target. */
|
|
110
|
+
drag?: RowDragProps | undefined;
|
|
111
|
+
/** Child-seat renderer for the row's leading decoration and hover-card section. */
|
|
112
|
+
renderSlot: SessionRowRenderSlots;
|
|
113
|
+
t: RowTranslate;
|
|
114
|
+
}): import("react").JSX.Element;
|
|
115
|
+
export {};
|
|
116
|
+
//# 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, usePanelInfo, expandSidebar, useSessions, useSessionStatus, useWorkspaces, useStore, actions, startSession, open, renameSession, forkSession, renameWorkspace, deleteWorkspace, insertWorkspaceBefore, archiveSession, pinSession, unpinSession, createWorkspace, searchSessions, searchResultLimit, requestSearch, requestAddWorkspace, closeAddWorkspace, closeRenameRequest, setDirectoryBusy, useDirectoryFlow, useHostInfo, useWorkspaceShortcuts, useShortcuts, renderSlot, t, }: WorkspaceBrowserProps): import("react").JSX.Element;
|
|
8
|
+
//# sourceMappingURL=WorkspaceBrowser.d.ts.map
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/** Workspace command registration and browser-owned opening requests. */
|
|
2
|
+
import type { Context } from '@qilin-agent/kylin';
|
|
3
|
+
import { type SnapshotStore } from '@qilin-agent/client-store';
|
|
4
|
+
import type { SessionId } from '@qilin-agent/session/types';
|
|
5
|
+
import type { UiWorkspace } from './navigation.ts';
|
|
6
|
+
/** Transient requests consumed by the existing workspace browser. */
|
|
7
|
+
export interface WorkspaceShortcutState {
|
|
8
|
+
readonly searchRequest: number;
|
|
9
|
+
readonly addRequested: boolean;
|
|
10
|
+
readonly directoryBusy: boolean;
|
|
11
|
+
readonly renameTarget: {
|
|
12
|
+
readonly sessionId: SessionId;
|
|
13
|
+
readonly currentTitle: string;
|
|
14
|
+
} | null;
|
|
15
|
+
}
|
|
16
|
+
interface WorkspaceShortcutControls {
|
|
17
|
+
state: SnapshotStore<WorkspaceShortcutState>;
|
|
18
|
+
search: () => void;
|
|
19
|
+
add: () => void;
|
|
20
|
+
closeAdd: () => void;
|
|
21
|
+
directoryBusy: (busy: boolean) => void;
|
|
22
|
+
rename: (sessionId: SessionId, currentTitle: string) => void;
|
|
23
|
+
closeRename: () => void;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Create the private browser request source shared by commands and controls.
|
|
27
|
+
* @returns observable state and its complete mutation callbacks.
|
|
28
|
+
*/
|
|
29
|
+
export declare function createWorkspaceShortcutControls(): WorkspaceShortcutControls;
|
|
30
|
+
/**
|
|
31
|
+
* Register navigation commands against the existing workspace owner.
|
|
32
|
+
* @param ctx - plugin context with the shortcut, locale, and model services.
|
|
33
|
+
* @param navigation - session creation and forking from the pointer controls' navigation service.
|
|
34
|
+
* @param controls - browser-owned opening requests.
|
|
35
|
+
* @param archiveSession - shared archive action, including running-work confirmation and notices.
|
|
36
|
+
*/
|
|
37
|
+
export declare function installWorkspaceShortcuts(ctx: Context, navigation: Pick<UiWorkspace, 'startSession' | 'forkSession'>, controls: ReturnType<typeof createWorkspaceShortcutControls>, archiveSession: (sessionId: SessionId) => void): void;
|
|
38
|
+
export {};
|
|
39
|
+
//# sourceMappingURL=shortcuts.d.ts.map
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The workspace browser's viewing store: the session-list grouping mode,
|
|
3
|
+
* persisted across reloads. Module level exports the factory only (a
|
|
4
|
+
* module-level handle would pin the store identity across plugin reloads);
|
|
5
|
+
* register() receives the factory and the browser derives its PropsStore
|
|
6
|
+
* share from the return type.
|
|
7
|
+
*/
|
|
8
|
+
import { type EngineStoreHandle } from '@qilin-agent/client-store';
|
|
9
|
+
import type { SessionListState } from '@qilin-agent/api-session-controller/client';
|
|
10
|
+
import type { SessionId } from '@qilin-agent/session/types';
|
|
11
|
+
/** Browser-local order account for the hierarchy-free flat Session list. */
|
|
12
|
+
export declare const FLAT_SESSION_ORDER_KEY = "__flat_session_order__";
|
|
13
|
+
/** Session-list grouping mode: sibling Workspace sections, a Workspace tree, or one flat list. */
|
|
14
|
+
export type SessionGroupBy = 'workspace' | 'workspace-tree' | 'flat';
|
|
15
|
+
/** Session order: saved manual positions or current recency. */
|
|
16
|
+
export type SessionOrderBy = 'manual' | 'updated';
|
|
17
|
+
/** Workspace browser viewing state persisted across surface remounts and reloads. */
|
|
18
|
+
type WorkspaceViewState = {
|
|
19
|
+
groupBy: SessionGroupBy;
|
|
20
|
+
orderBy: SessionOrderBy;
|
|
21
|
+
/** Explicit group expansion keyed by Workspace identity, including descendants in tree mode. */
|
|
22
|
+
groupExpansion: Record<string, boolean>;
|
|
23
|
+
/** Saved manual order per Workspace group plus the browser-local flat-list account. */
|
|
24
|
+
sessionOrderByAccount: Record<string, string[]>;
|
|
25
|
+
};
|
|
26
|
+
/** What a pin order write reconciles a pinned Session's accounts against. */
|
|
27
|
+
export interface PinOrderSource {
|
|
28
|
+
/** Every account's complete membership: each Workspace, Ungrouped, and the flat list. */
|
|
29
|
+
members: Readonly<Record<string, readonly SessionId[]>>;
|
|
30
|
+
/** Session summaries the reconciliation orders new members by. */
|
|
31
|
+
summaries: SessionListState['byId'];
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Annotation twin of the actions literal below (the export needs a declared
|
|
35
|
+
* return type); drift fails assignability at the defineStore call.
|
|
36
|
+
*/
|
|
37
|
+
type WorkspaceViewActions = {
|
|
38
|
+
setGroupBy: (draft: WorkspaceViewState, mode: SessionGroupBy) => void;
|
|
39
|
+
setOrderBy: (draft: WorkspaceViewState, mode: SessionOrderBy, initialOrders: Readonly<Record<string, readonly string[]>>) => void;
|
|
40
|
+
setGroupExpanded: (draft: WorkspaceViewState, key: string, expanded: boolean) => void;
|
|
41
|
+
retainAccountKeys: (draft: WorkspaceViewState, workspaceKeys: readonly string[]) => void;
|
|
42
|
+
syncSessionOrders: (draft: WorkspaceViewState, orders: Readonly<Record<string, readonly string[]>>) => void;
|
|
43
|
+
setSessionOrder: (draft: WorkspaceViewState, accountKey: string, order: readonly string[], initialOrders: Readonly<Record<string, readonly string[]>>) => void;
|
|
44
|
+
pinSessionOrder: (draft: WorkspaceViewState, sessionId: SessionId, accountKeys: readonly string[], source: PinOrderSource) => void;
|
|
45
|
+
};
|
|
46
|
+
/** The bound write set of one viewing-store instance (what the UiWorkspace service drives). */
|
|
47
|
+
export type WorkspaceViewStoreActions = ReturnType<ReturnType<typeof createWorkspaceViewStore>['create']>['actions'];
|
|
48
|
+
/**
|
|
49
|
+
* Create the workspace browser viewing store handle.
|
|
50
|
+
* @returns the store handle (spec + type + identity + factory in one).
|
|
51
|
+
*/
|
|
52
|
+
export declare function createWorkspaceViewStore(): EngineStoreHandle<WorkspaceViewState, WorkspaceViewActions>;
|
|
53
|
+
export {};
|
|
54
|
+
//# sourceMappingURL=stores.d.ts.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/** UI Workspace-owned projection of descendant counts from Session summaries. */
|
|
2
|
+
import type { SessionId } from '@qilin-agent/session/types';
|
|
3
|
+
interface LineageEntry {
|
|
4
|
+
readonly id: SessionId;
|
|
5
|
+
readonly parentId?: SessionId;
|
|
6
|
+
readonly origin?: 'subagent';
|
|
7
|
+
readonly running: boolean;
|
|
8
|
+
}
|
|
9
|
+
/** Descendant counts for one possible parent Session. */
|
|
10
|
+
export interface SubagentDescendantSummary {
|
|
11
|
+
readonly count: number;
|
|
12
|
+
readonly runningCount: number;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Index uninterrupted subagent descendants under each ancestor.
|
|
16
|
+
* @param summaries - Session summaries keyed by id.
|
|
17
|
+
* @returns descendant totals keyed by possible parent id.
|
|
18
|
+
*/
|
|
19
|
+
export declare function indexSubagentDescendants(summaries: Readonly<Record<SessionId, LineageEntry>>): ReadonlyMap<SessionId, SubagentDescendantSummary>;
|
|
20
|
+
export {};
|
|
21
|
+
//# sourceMappingURL=subagent-lineage.d.ts.map
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Derives the workspace browser tree from caller-projected Workspace and
|
|
3
|
+
* Session order. Unassigned Sessions trail under Ungrouped; only the selected
|
|
4
|
+
* blank Session remains visible.
|
|
5
|
+
*/
|
|
6
|
+
import { type SessionListState, type SessionSearchResultItem } from '@qilin-agent/api-session-controller/client';
|
|
7
|
+
import type { WorkspaceId, WorkspaceView } from '@qilin-agent/api-workspace-controller/client';
|
|
8
|
+
import type { SessionStatusSnapshot } from '@qilin-agent/client-ui-session/client';
|
|
9
|
+
import type { SessionId } from '@qilin-agent/session/types';
|
|
10
|
+
/** Group key for Sessions outside every Workspace. */
|
|
11
|
+
export declare const UNGROUPED_KEY = "";
|
|
12
|
+
/**
|
|
13
|
+
* Resolve the Workspace browser group that owns one Session.
|
|
14
|
+
* @param workspaces - authoritative Workspace membership.
|
|
15
|
+
* @param sessionId - Session whose browser group is required.
|
|
16
|
+
* @returns owning Workspace id, or {@link UNGROUPED_KEY} when no Workspace accounts for it.
|
|
17
|
+
*/
|
|
18
|
+
export declare function owningGroupKey(workspaces: readonly WorkspaceView[], sessionId: SessionId): string;
|
|
19
|
+
/** Pending interaction kinds with dedicated Workspace-row presentation. */
|
|
20
|
+
export type SessionPendingInteractionStatus = 'approval' | 'plan-review' | 'question';
|
|
21
|
+
type SessionStatuses = SessionStatusSnapshot;
|
|
22
|
+
/** One top-level session row in a group or the flat list. */
|
|
23
|
+
export interface SessionNode {
|
|
24
|
+
id: SessionId;
|
|
25
|
+
/** Stored display title; the renderer substitutes the localized New Session label for blank rows. */
|
|
26
|
+
title: string;
|
|
27
|
+
/** The provisional blank session (renderer shows the localized New Session title). */
|
|
28
|
+
blank: boolean;
|
|
29
|
+
/** A Session-scoped UI consumer is awaiting this user. */
|
|
30
|
+
pendingInteraction?: SessionPendingInteractionStatus;
|
|
31
|
+
running: boolean;
|
|
32
|
+
/** Running descendants connected through uninterrupted subagent-origin lineage. */
|
|
33
|
+
runningSubagentCount: number;
|
|
34
|
+
/** Finished running while not selected and not yet opened (the green "done" reminder dot). */
|
|
35
|
+
completed: boolean;
|
|
36
|
+
updatedAt: number;
|
|
37
|
+
/** In the registry-global pin set: leads its section, and the row marks itself pinned. */
|
|
38
|
+
pinned: boolean;
|
|
39
|
+
}
|
|
40
|
+
/** Session order selected by the Workspace browser. */
|
|
41
|
+
export type SessionOrderBy = 'manual' | 'updated';
|
|
42
|
+
/** Registry-global row membership every tree derivation reads. */
|
|
43
|
+
export interface SessionRowState {
|
|
44
|
+
/** Registry-global pin ids; pinned rows lead their section without changing the caller's local order. */
|
|
45
|
+
pinnedSessionIds: readonly SessionId[];
|
|
46
|
+
/** Registry-global archive set. */
|
|
47
|
+
archivedSessionIds: readonly SessionId[];
|
|
48
|
+
}
|
|
49
|
+
/** One workspace group section: header row facts + visible top-level session rows. */
|
|
50
|
+
export interface GroupNode {
|
|
51
|
+
/** Group key: the workspace id or {@link UNGROUPED_KEY}. */
|
|
52
|
+
key: string;
|
|
53
|
+
/** Backing Workspace id; absent only for the ungrouped bucket. */
|
|
54
|
+
workspaceId: WorkspaceId | undefined;
|
|
55
|
+
cwd: string | undefined;
|
|
56
|
+
/** Workspace creation time (epoch ms); absent only for the ungrouped bucket. */
|
|
57
|
+
createdAt: number | undefined;
|
|
58
|
+
label: string;
|
|
59
|
+
/** Total visible sessions in the group. */
|
|
60
|
+
sessionCount: number;
|
|
61
|
+
expanded: boolean;
|
|
62
|
+
/** The group contains the selected session (active folder tint; supplied here so the renderer never scans). */
|
|
63
|
+
containsCurrent: boolean;
|
|
64
|
+
/** Visible session rows (empty while the group is folded). */
|
|
65
|
+
sessions: readonly SessionNode[];
|
|
66
|
+
}
|
|
67
|
+
/** One flat search row combining list metadata with an optional content match. */
|
|
68
|
+
export interface SearchResultNode {
|
|
69
|
+
id: SessionId;
|
|
70
|
+
title: string;
|
|
71
|
+
workspace: string;
|
|
72
|
+
/** A Session-scoped UI consumer is awaiting this user. */
|
|
73
|
+
pendingInteraction?: SessionPendingInteractionStatus;
|
|
74
|
+
running: boolean;
|
|
75
|
+
/** Running descendants connected through uninterrupted subagent-origin lineage. */
|
|
76
|
+
runningSubagentCount: number;
|
|
77
|
+
/** Finished running while not selected and not yet opened (the green "done" reminder dot). */
|
|
78
|
+
completed: boolean;
|
|
79
|
+
snippet?: string;
|
|
80
|
+
}
|
|
81
|
+
/** Bounded merged search projection plus the refine-query hint bit. */
|
|
82
|
+
export interface SearchResultSet {
|
|
83
|
+
items: readonly SearchResultNode[];
|
|
84
|
+
hasMore: boolean;
|
|
85
|
+
}
|
|
86
|
+
/** Viewing state consumed by the derivation. */
|
|
87
|
+
export interface TreeView {
|
|
88
|
+
expandedGroups: readonly string[];
|
|
89
|
+
/** Browser-local order for Sessions without a backing Workspace account. */
|
|
90
|
+
ungroupedOrder?: readonly string[];
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Directory display label: basename of the path (both separators accepted).
|
|
94
|
+
* Ungrouped-bucket fallback for surfaces without a workspace title.
|
|
95
|
+
* @param cwd - directory path, or undefined for the ungrouped bucket.
|
|
96
|
+
* @returns basename, the raw cwd when it has no basename, or an empty ungrouped marker.
|
|
97
|
+
*/
|
|
98
|
+
export declare function workspaceLabel(cwd: string | undefined): string;
|
|
99
|
+
/**
|
|
100
|
+
* Project known account members by current Session recency.
|
|
101
|
+
* @param sessionIds - authoritative account membership.
|
|
102
|
+
* @param summaries - current Session summaries; members without a summary are omitted until it arrives.
|
|
103
|
+
* @returns known members newest first, with Session identity as the deterministic tie-break.
|
|
104
|
+
*/
|
|
105
|
+
export declare function orderByRecency(sessionIds: readonly SessionId[], summaries: SessionListState['byId']): SessionId[];
|
|
106
|
+
/**
|
|
107
|
+
* Reconcile a browser-local manual order with current account membership.
|
|
108
|
+
* @param memberIds - authoritative account membership.
|
|
109
|
+
* @param savedOrder - previously saved browser-local order.
|
|
110
|
+
* @param summaries - current Session summaries used to append newly known members by recency.
|
|
111
|
+
* @returns retained saved slots followed by newly known members; departed members and unknown new members are omitted.
|
|
112
|
+
*/
|
|
113
|
+
export declare function reconcileManualOrder(memberIds: readonly SessionId[], savedOrder: readonly string[] | undefined, summaries: SessionListState['byId']): SessionId[];
|
|
114
|
+
/**
|
|
115
|
+
* Keep the selected provisional New Session ahead of either base order.
|
|
116
|
+
* @param order - recency or reconciled manual order.
|
|
117
|
+
* @param currentBlank - selected blank Session in this account, when present.
|
|
118
|
+
* @returns a copy with the selected blank first and no duplicate slot.
|
|
119
|
+
*/
|
|
120
|
+
export declare function pinCurrentBlank(order: readonly SessionId[], currentBlank: SessionId | undefined): SessionId[];
|
|
121
|
+
/**
|
|
122
|
+
* Derive the workspace browser groups with every session as a top-level row.
|
|
123
|
+
*
|
|
124
|
+
* Every group shows; sessions populate under expanded groups in the selected
|
|
125
|
+
* local order. Blank sessions are excluded except for the selected
|
|
126
|
+
* provisional New Session row; archived sessions are excluded everywhere.
|
|
127
|
+
* Content search lives outside this derivation
|
|
128
|
+
* (see {@link deriveSearchResults}).
|
|
129
|
+
* @param list - sessions list snapshot (`mainView` retention feeds containsCurrent).
|
|
130
|
+
* @param workspaces - real Workspaces in Host group order with caller-projected Session order.
|
|
131
|
+
* @param rowState - registry-global pin and archive membership.
|
|
132
|
+
* @param statuses - unified UI status by Session.
|
|
133
|
+
* @param view - local expansion arrays.
|
|
134
|
+
* @returns group sections in render order.
|
|
135
|
+
*/
|
|
136
|
+
export declare function deriveGroups(list: SessionListState, workspaces: readonly WorkspaceView[], rowState: SessionRowState, statuses: SessionStatuses, view: TreeView): GroupNode[];
|
|
137
|
+
/**
|
|
138
|
+
* Select flat-list members without deriving row presentation or ordering.
|
|
139
|
+
* @param list - sessions list snapshot.
|
|
140
|
+
* @param rowState - registry-global pin and archive membership.
|
|
141
|
+
* @returns known visible Session ids in list order, including ordinary forks and only the current blank.
|
|
142
|
+
*/
|
|
143
|
+
export declare function visibleSessionIds(list: SessionListState, rowState: Pick<SessionRowState, 'archivedSessionIds'>): SessionId[];
|
|
144
|
+
/**
|
|
145
|
+
* Select complete flat-list membership, independently of archive visibility.
|
|
146
|
+
* The pin write-back reconciles this account, so an archived Session keeps its
|
|
147
|
+
* slot and no pin silently drops it.
|
|
148
|
+
* @param list - sessions list snapshot.
|
|
149
|
+
* @returns known ordinary Session ids, including archived ones.
|
|
150
|
+
*/
|
|
151
|
+
export declare function sessionMemberIds(list: SessionListState): SessionId[];
|
|
152
|
+
/**
|
|
153
|
+
* Derive flat rows from the browser's ordered visible Session ids.
|
|
154
|
+
* @param list - sessions list snapshot used to select the ids.
|
|
155
|
+
* @param sessionIds - known visible members in caller order, including any pinned blank.
|
|
156
|
+
* @param pinnedSessionIds - registry-global pin set; pinned rows lead after the blank.
|
|
157
|
+
* @param statuses - unified UI status by Session.
|
|
158
|
+
* @returns flat rows with pinned rows fronted and current status indicators.
|
|
159
|
+
*/
|
|
160
|
+
export declare function deriveFlat(list: SessionListState, sessionIds: readonly SessionId[], pinnedSessionIds: readonly SessionId[], statuses: SessionStatuses): SessionNode[];
|
|
161
|
+
/**
|
|
162
|
+
* Merge immediate title/Workspace substring matches with ranked Host content
|
|
163
|
+
* matches. Local rows lead newest-first, content-only rows retain backend
|
|
164
|
+
* order, and duplicate sessions receive the backend snippet in place.
|
|
165
|
+
* @param list - session metadata authority.
|
|
166
|
+
* @param workspaces - Workspace membership and display labels.
|
|
167
|
+
* @param query - caller text; surrounding whitespace is ignored.
|
|
168
|
+
* @param rowState - registry-global archive membership (members never match).
|
|
169
|
+
* @param statuses - unified UI status by Session.
|
|
170
|
+
* @param content - ranked Host content-search page.
|
|
171
|
+
* @param limit - protocol-owned maximum merged row count.
|
|
172
|
+
* @returns bounded deduplicated flat rows and a refine-query hint bit.
|
|
173
|
+
*/
|
|
174
|
+
export declare function deriveSearchResults(list: SessionListState, workspaces: readonly WorkspaceView[], query: string, rowState: Pick<SessionRowState, 'archivedSessionIds'>, statuses: SessionStatuses, content: {
|
|
175
|
+
items: readonly SessionSearchResultItem[];
|
|
176
|
+
hasMore: boolean;
|
|
177
|
+
}, limit: number): SearchResultSet;
|
|
178
|
+
/**
|
|
179
|
+
* Find the nearest registered ancestor, excluding the Workspace directory itself.
|
|
180
|
+
* Paths use Host spelling; matching is case-sensitive, like Workspace identity.
|
|
181
|
+
* @param path - Workspace directory.
|
|
182
|
+
* @param parents - registered Workspace directory paths.
|
|
183
|
+
* @returns the owning parent path, or undefined when no parent contains the Workspace.
|
|
184
|
+
*/
|
|
185
|
+
export declare function owningParentFolder(path: string, parents: readonly string[]): string | undefined;
|
|
186
|
+
export {};
|
|
187
|
+
//# sourceMappingURL=tree.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Workspace picker plugin, node half. Pure UI plugin: the empty apply exists
|
|
3
|
+
* so the plugin appears in the host cordis.yml / Loader (load and lifecycle
|
|
4
|
+
* follow the host; the browser half ships via exports["./client"], discovered
|
|
5
|
+
* through the package.json qilin.client declaration).
|
|
6
|
+
*/
|
|
7
|
+
/** Host plugin body — no host-side behavior for the workspace picker plugin. */
|
|
8
|
+
export declare function apply(): void;
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,88 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qilin-agent/client-ui-workspace",
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"description": "Workspace picker plugin: one WorkspacePicker registered into the sidebar and empty-state workspace slots",
|
|
4
|
+
"version": "3.1.4",
|
|
5
|
+
"publishConfig": {
|
|
6
|
+
"access": "public"
|
|
7
|
+
},
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/kkutysllb/QiLin.git",
|
|
11
|
+
"directory": "packages/client/ui-workspace"
|
|
12
|
+
},
|
|
13
|
+
"engines": {
|
|
14
|
+
"node": "^22.19.0 || >=24.0.0"
|
|
15
|
+
},
|
|
16
|
+
"type": "module",
|
|
17
|
+
"main": "lib/index.js",
|
|
18
|
+
"types": "lib/types/index.d.ts",
|
|
19
|
+
"exports": {
|
|
20
|
+
".": {
|
|
21
|
+
"types": "./lib/types/index.d.ts",
|
|
22
|
+
"default": "./lib/index.js"
|
|
23
|
+
},
|
|
24
|
+
"./client": {
|
|
25
|
+
"types": "./lib/types/client/index.d.ts",
|
|
26
|
+
"default": "./lib/client.js"
|
|
27
|
+
},
|
|
28
|
+
"./src/*": "./src/*",
|
|
29
|
+
"./package.json": "./package.json"
|
|
30
|
+
},
|
|
31
|
+
"qilin": {
|
|
32
|
+
"client": {
|
|
33
|
+
"inject": [
|
|
34
|
+
"@qilin-agent/api-remotes",
|
|
35
|
+
"@qilin-agent/api-session-controller",
|
|
36
|
+
"@qilin-agent/api-workspace-controller",
|
|
37
|
+
"@qilin-agent/client-connection",
|
|
38
|
+
"@qilin-agent/client-locale",
|
|
39
|
+
"@qilin-agent/client-shortcuts",
|
|
40
|
+
"@qilin-agent/client-ui-conversation",
|
|
41
|
+
"@qilin-agent/client-ui-layout",
|
|
42
|
+
"@qilin-agent/client-ui-renderer",
|
|
43
|
+
"@qilin-agent/client-ui-session",
|
|
44
|
+
"@qilin-agent/client-ui-sidebar"
|
|
45
|
+
],
|
|
46
|
+
"platform": "web"
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
"license": "MIT",
|
|
50
|
+
"peerDependencies": {
|
|
51
|
+
"@qilin-agent/kylin": "~4.0.3"
|
|
52
|
+
},
|
|
53
|
+
"devDependencies": {
|
|
54
|
+
"@types/react": "~18.3.1",
|
|
55
|
+
"clsx": "^2.0.0",
|
|
56
|
+
"react": "^18.2.0",
|
|
57
|
+
"@qilin-agent/api-remotes": "3.1.4",
|
|
58
|
+
"@qilin-agent/api-workspace-controller": "3.1.4",
|
|
59
|
+
"@qilin-agent/api-session-controller": "3.1.4",
|
|
60
|
+
"@qilin-agent/client-locale": "3.1.4",
|
|
61
|
+
"@qilin-agent/client-shortcuts": "3.1.4",
|
|
62
|
+
"@qilin-agent/client-store": "3.1.4",
|
|
63
|
+
"@qilin-agent/client-connection": "3.1.4",
|
|
64
|
+
"@qilin-agent/client-test-runtime": "3.1.4",
|
|
65
|
+
"@qilin-agent/client-ui-layout": "3.1.4",
|
|
66
|
+
"@qilin-agent/client-ui-conversation": "3.1.4",
|
|
67
|
+
"@qilin-agent/client-ui-primitives": "3.1.4",
|
|
68
|
+
"@qilin-agent/client-ui-renderer": "3.1.4",
|
|
69
|
+
"@qilin-agent/client-ui-session": "3.1.4",
|
|
70
|
+
"@qilin-agent/client-ui-sidebar": "3.1.4",
|
|
71
|
+
"@qilin-agent/client-ui-slots": "3.1.4",
|
|
72
|
+
"@qilin-agent/schedule": "3.1.4",
|
|
73
|
+
"@qilin-agent/session": "3.1.4",
|
|
74
|
+
"@qilin-agent/subagent": "3.1.4",
|
|
75
|
+
"@qilin-agent/typert-protocol": "3.1.4",
|
|
76
|
+
"@qilin-agent/util-workspace-path": "3.1.4",
|
|
77
|
+
"@qilin-agent/kylin": "~4.0.3"
|
|
78
|
+
},
|
|
79
|
+
"files": [
|
|
80
|
+
"lib/index.js",
|
|
81
|
+
"lib/client.js",
|
|
82
|
+
"lib/types/**/*.d.ts"
|
|
83
|
+
],
|
|
84
|
+
"scripts": {
|
|
85
|
+
"bundle": "tsdown",
|
|
86
|
+
"watch": "tsdown --watch"
|
|
87
|
+
}
|
|
6
88
|
}
|