@qilin-agent/client-ui-workspace 0.0.0-stage → 3.1.3

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.
@@ -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,90 @@
1
1
  {
2
2
  "name": "@qilin-agent/client-ui-workspace",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "description": "Workspace picker plugin: one WorkspacePicker registered into the sidebar and empty-state workspace slots",
4
+ "version": "3.1.3",
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
+ "@qilin-agent/client-ui-workbench"
46
+ ],
47
+ "platform": "web"
48
+ }
49
+ },
50
+ "license": "MIT",
51
+ "peerDependencies": {
52
+ "@qilin-agent/kylin": "~4.0.3"
53
+ },
54
+ "devDependencies": {
55
+ "@types/react": "~18.3.1",
56
+ "clsx": "^2.0.0",
57
+ "react": "^18.2.0",
58
+ "@qilin-agent/api-remotes": "3.1.3",
59
+ "@qilin-agent/api-session-controller": "3.1.3",
60
+ "@qilin-agent/api-workspace-controller": "3.1.3",
61
+ "@qilin-agent/client-connection": "3.1.3",
62
+ "@qilin-agent/client-shortcuts": "3.1.3",
63
+ "@qilin-agent/client-store": "3.1.3",
64
+ "@qilin-agent/client-test-runtime": "3.1.3",
65
+ "@qilin-agent/client-locale": "3.1.3",
66
+ "@qilin-agent/client-ui-conversation": "3.1.3",
67
+ "@qilin-agent/client-ui-layout": "3.1.3",
68
+ "@qilin-agent/client-ui-primitives": "3.1.3",
69
+ "@qilin-agent/client-ui-session": "3.1.3",
70
+ "@qilin-agent/client-ui-sidebar": "3.1.3",
71
+ "@qilin-agent/client-ui-renderer": "3.1.3",
72
+ "@qilin-agent/client-ui-slots": "3.1.3",
73
+ "@qilin-agent/schedule": "3.1.3",
74
+ "@qilin-agent/session": "3.1.3",
75
+ "@qilin-agent/client-ui-workbench": "3.1.3",
76
+ "@qilin-agent/typert-protocol": "3.1.3",
77
+ "@qilin-agent/subagent": "3.1.3",
78
+ "@qilin-agent/kylin": "~4.0.3",
79
+ "@qilin-agent/util-workspace-path": "3.1.3"
80
+ },
81
+ "files": [
82
+ "lib/index.js",
83
+ "lib/client.js",
84
+ "lib/types/**/*.d.ts"
85
+ ],
86
+ "scripts": {
87
+ "bundle": "tsdown",
88
+ "watch": "tsdown --watch"
89
+ }
6
90
  }