@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/LICENSE +21 -0
- package/README.i18n.yaml +6 -0
- package/README.md +113 -0
- package/README.zh.md +113 -0
- package/lib/client.js +2710 -0
- package/lib/index.js +11 -0
- package/lib/invariant.js +25 -0
- package/lib/types/client/WorkspacePicker.d.ts +57 -0
- package/lib/types/client/contract/slots.d.ts +158 -0
- package/lib/types/client/index.d.ts +44 -0
- package/lib/types/client/locales.d.ts +138 -0
- package/lib/types/client/navigation.d.ts +83 -0
- package/lib/types/client/rows/Rows.d.ts +103 -0
- package/lib/types/client/rows/WorkspaceBrowser.d.ts +8 -0
- package/lib/types/client/stores.d.ts +44 -0
- package/lib/types/client/subagent-lineage.d.ts +21 -0
- package/lib/types/client/tree.d.ts +128 -0
- package/lib/types/index.d.ts +9 -0
- package/lib/types/invariant.d.ts +16 -0
- package/package.json +100 -0
|
@@ -0,0 +1,44 @@
|
|
|
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 '@prettier-ai/dsh-client-store';
|
|
9
|
+
/** Browser-local order account for the hierarchy-free flat Session list. */
|
|
10
|
+
export declare const FLAT_SESSION_ORDER_KEY = "__flat_session_order__";
|
|
11
|
+
/** Session-list grouping mode: workspace sections or one flat recency list. */
|
|
12
|
+
export type SessionGroupBy = 'workspace' | 'flat';
|
|
13
|
+
/** Session order: user-arranged only, or user-arranged plus activity promotion. */
|
|
14
|
+
export type SessionOrderBy = 'manual' | 'updated';
|
|
15
|
+
/** Workspace browser viewing state persisted across surface remounts and reloads. */
|
|
16
|
+
type WorkspaceViewState = {
|
|
17
|
+
groupBy: SessionGroupBy;
|
|
18
|
+
orderBy: SessionOrderBy;
|
|
19
|
+
/** Explicit zero-or-five-session state keyed by Workspace group identity. */
|
|
20
|
+
groupExpansion: Record<string, boolean>;
|
|
21
|
+
/** Shared editable order per Workspace group plus the browser-local flat-list account. */
|
|
22
|
+
sessionOrderByAccount: Record<string, string[]>;
|
|
23
|
+
/** Last observed update timestamps per order account for one-time promotion events. */
|
|
24
|
+
sessionUpdatedAtByAccount: Record<string, Record<string, number>>;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Annotation twin of the actions literal below (the export needs a declared
|
|
28
|
+
* return type); drift fails assignability at the defineStore call.
|
|
29
|
+
*/
|
|
30
|
+
type WorkspaceViewActions = {
|
|
31
|
+
setGroupBy: (draft: WorkspaceViewState, mode: SessionGroupBy) => void;
|
|
32
|
+
setOrderBy: (draft: WorkspaceViewState, mode: SessionOrderBy) => void;
|
|
33
|
+
setGroupExpanded: (draft: WorkspaceViewState, key: string, expanded: boolean) => void;
|
|
34
|
+
retainAccountKeys: (draft: WorkspaceViewState, workspaceKeys: readonly string[]) => void;
|
|
35
|
+
syncSessionOrderAccount: (draft: WorkspaceViewState, accountKey: string, order: string[], updatedAt: Record<string, number>) => void;
|
|
36
|
+
setSessionOrder: (draft: WorkspaceViewState, accountKey: string, order: string[]) => void;
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Create the workspace browser viewing store handle.
|
|
40
|
+
* @returns the store handle (spec + type + identity + factory in one).
|
|
41
|
+
*/
|
|
42
|
+
export declare function createWorkspaceViewStore(): EngineStoreHandle<WorkspaceViewState, WorkspaceViewActions>;
|
|
43
|
+
export {};
|
|
44
|
+
//# 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 '@prettier-ai/dsh-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,128 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Derives the workspace browser tree from Host Workspace order and membership.
|
|
3
|
+
* Unassigned Sessions trail under Ungrouped; only the selected blank Session
|
|
4
|
+
* remains visible.
|
|
5
|
+
*/
|
|
6
|
+
import { type SessionListState, type SessionSearchResultItem } from '@prettier-ai/dsh-api-session-controller/client';
|
|
7
|
+
import type { WorkspaceId, WorkspaceView } from '@prettier-ai/dsh-api-workspace-controller/client';
|
|
8
|
+
import type { SessionPendingInteractionBase } from '@prettier-ai/dsh-client-ui-session/client';
|
|
9
|
+
import type { SessionId } from '@prettier-ai/dsh-session/types';
|
|
10
|
+
/** Group key for Sessions outside every Workspace. */
|
|
11
|
+
export declare const UNGROUPED_KEY = "";
|
|
12
|
+
/** Pending interaction kinds with dedicated Workspace-row presentation. */
|
|
13
|
+
export type SessionPendingInteractionStatus = 'approval' | 'plan-review' | 'question';
|
|
14
|
+
type SessionPendingInteractions = ReadonlyMap<SessionId, SessionPendingInteractionBase>;
|
|
15
|
+
/** One top-level session row in a group or the flat list. */
|
|
16
|
+
export interface SessionNode {
|
|
17
|
+
id: SessionId;
|
|
18
|
+
/** Stored display title; the renderer substitutes the localized New Session label for blank rows. */
|
|
19
|
+
title: string;
|
|
20
|
+
/** The provisional blank session (renderer shows the localized New Session title). */
|
|
21
|
+
blank: boolean;
|
|
22
|
+
/** A Session-scoped UI consumer is awaiting this user. */
|
|
23
|
+
pendingInteraction?: SessionPendingInteractionStatus;
|
|
24
|
+
running: boolean;
|
|
25
|
+
/** Running descendants connected through uninterrupted subagent-origin lineage. */
|
|
26
|
+
runningSubagentCount: number;
|
|
27
|
+
/** Finished running while not selected and not yet opened (the green "done" reminder dot). */
|
|
28
|
+
completed: boolean;
|
|
29
|
+
updatedAt: number;
|
|
30
|
+
}
|
|
31
|
+
/** Session order selected by the Workspace browser. */
|
|
32
|
+
export type SessionOrderBy = 'manual' | 'updated';
|
|
33
|
+
/** One workspace group section: header row facts + visible top-level session rows. */
|
|
34
|
+
export interface GroupNode {
|
|
35
|
+
/** Group key: the workspace id or {@link UNGROUPED_KEY}. */
|
|
36
|
+
key: string;
|
|
37
|
+
/** Backing Workspace id; absent only for the ungrouped bucket. */
|
|
38
|
+
workspaceId: WorkspaceId | undefined;
|
|
39
|
+
cwd: string | undefined;
|
|
40
|
+
/** Workspace creation time (epoch ms); absent only for the ungrouped bucket. */
|
|
41
|
+
createdAt: number | undefined;
|
|
42
|
+
label: string;
|
|
43
|
+
/** Total visible sessions in the group. */
|
|
44
|
+
sessionCount: number;
|
|
45
|
+
expanded: boolean;
|
|
46
|
+
/** The group contains the selected session (active folder tint; supplied here so the renderer never scans). */
|
|
47
|
+
containsCurrent: boolean;
|
|
48
|
+
/** Visible session rows (empty while the group is folded). */
|
|
49
|
+
sessions: readonly SessionNode[];
|
|
50
|
+
}
|
|
51
|
+
/** One flat search row combining list metadata with an optional content match. */
|
|
52
|
+
export interface SearchResultNode {
|
|
53
|
+
id: SessionId;
|
|
54
|
+
title: string;
|
|
55
|
+
workspace: string;
|
|
56
|
+
/** A Session-scoped UI consumer is awaiting this user. */
|
|
57
|
+
pendingInteraction?: SessionPendingInteractionStatus;
|
|
58
|
+
running: boolean;
|
|
59
|
+
/** Running descendants connected through uninterrupted subagent-origin lineage. */
|
|
60
|
+
runningSubagentCount: number;
|
|
61
|
+
/** Finished running while not selected and not yet opened (the green "done" reminder dot). */
|
|
62
|
+
completed: boolean;
|
|
63
|
+
snippet?: string;
|
|
64
|
+
}
|
|
65
|
+
/** Bounded merged search projection plus the refine-query hint bit. */
|
|
66
|
+
export interface SearchResultSet {
|
|
67
|
+
items: readonly SearchResultNode[];
|
|
68
|
+
hasMore: boolean;
|
|
69
|
+
}
|
|
70
|
+
/** Viewing state consumed by the derivation. */
|
|
71
|
+
export interface TreeView {
|
|
72
|
+
expandedGroups: readonly string[];
|
|
73
|
+
/** Browser-local order for Sessions without a backing Workspace account. */
|
|
74
|
+
ungroupedOrder?: readonly string[];
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Directory display label: basename of the path (both separators accepted).
|
|
78
|
+
* Ungrouped-bucket fallback for surfaces without a workspace title.
|
|
79
|
+
* @param cwd - directory path, or undefined for the ungrouped bucket.
|
|
80
|
+
* @returns basename, the raw cwd when it has no basename, or an empty ungrouped marker.
|
|
81
|
+
*/
|
|
82
|
+
export declare function workspaceLabel(cwd: string | undefined): string;
|
|
83
|
+
/**
|
|
84
|
+
* Derive the workspace browser groups with every session as a top-level row.
|
|
85
|
+
*
|
|
86
|
+
* Every group shows; sessions populate under expanded groups in the selected
|
|
87
|
+
* local order. Blank sessions are excluded except for the selected
|
|
88
|
+
* provisional New Session row; archived sessions are excluded everywhere.
|
|
89
|
+
* Content search lives outside this derivation
|
|
90
|
+
* (see {@link deriveSearchResults}).
|
|
91
|
+
* @param list - sessions list snapshot (`current` feeds containsCurrent).
|
|
92
|
+
* @param workspaces - real workspaces in stable Host order.
|
|
93
|
+
* @param archivedSessionIds - registry-global archive set.
|
|
94
|
+
* @param pendingInteractions - pending UI interactions by Session.
|
|
95
|
+
* @param view - local expansion arrays.
|
|
96
|
+
* @returns group sections in render order.
|
|
97
|
+
*/
|
|
98
|
+
export declare function deriveGroups(list: SessionListState, workspaces: readonly WorkspaceView[], archivedSessionIds: readonly SessionId[], pendingInteractions: SessionPendingInteractions, view: TreeView): GroupNode[];
|
|
99
|
+
/**
|
|
100
|
+
* Derive the flat session list ("In one list" mode): every session — fork
|
|
101
|
+
* children included — as a top-level row, strictly newest-first. No grouping,
|
|
102
|
+
* no parent/child adjacency. Content search lives outside this derivation
|
|
103
|
+
* (see {@link deriveSearchResults}).
|
|
104
|
+
* @param list - sessions list snapshot.
|
|
105
|
+
* @param archivedSessionIds - registry-global archive set.
|
|
106
|
+
* @param pendingInteractions - pending UI interactions by Session.
|
|
107
|
+
* @returns flat rows in render order.
|
|
108
|
+
*/
|
|
109
|
+
export declare function deriveFlat(list: SessionListState, archivedSessionIds: readonly SessionId[], pendingInteractions: SessionPendingInteractions): SessionNode[];
|
|
110
|
+
/**
|
|
111
|
+
* Merge immediate title/Workspace substring matches with ranked Host content
|
|
112
|
+
* matches. Local rows lead newest-first, content-only rows retain backend
|
|
113
|
+
* order, and duplicate sessions receive the backend snippet in place.
|
|
114
|
+
* @param list - session metadata authority.
|
|
115
|
+
* @param workspaces - Workspace membership and display labels.
|
|
116
|
+
* @param query - caller text; surrounding whitespace is ignored.
|
|
117
|
+
* @param archivedSessionIds - registry-global archive set (members never match).
|
|
118
|
+
* @param pendingInteractions - pending UI interactions by Session.
|
|
119
|
+
* @param content - ranked Host content-search page.
|
|
120
|
+
* @param limit - protocol-owned maximum merged row count.
|
|
121
|
+
* @returns bounded deduplicated flat rows and a refine-query hint bit.
|
|
122
|
+
*/
|
|
123
|
+
export declare function deriveSearchResults(list: SessionListState, workspaces: readonly WorkspaceView[], query: string, archivedSessionIds: readonly SessionId[], pendingInteractions: SessionPendingInteractions, content: {
|
|
124
|
+
items: readonly SessionSearchResultItem[];
|
|
125
|
+
hasMore: boolean;
|
|
126
|
+
}, limit: number): SearchResultSet;
|
|
127
|
+
export {};
|
|
128
|
+
//# 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 dsh.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
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Package-owned invariant companion for `@prettier-ai/dsh-client-ui-workspace`.
|
|
3
|
+
* @module @prettier-ai/dsh-client-ui-workspace/invariant
|
|
4
|
+
*/
|
|
5
|
+
import type { Context } from '@prettier-ai/cordis';
|
|
6
|
+
/** Cordis companion plugin name. */
|
|
7
|
+
export declare const name = "client-ui-workspace-invariant";
|
|
8
|
+
/** Service required before the companion can reserve package ownership. */
|
|
9
|
+
export declare const inject: string[];
|
|
10
|
+
/**
|
|
11
|
+
* Register this package's invariant companion.
|
|
12
|
+
* @param ctx - Cordis context carrying the invariant service.
|
|
13
|
+
* @returns the installed registration's disposer after setup succeeds.
|
|
14
|
+
*/
|
|
15
|
+
export declare const apply: (ctx: Context) => Promise<() => void>;
|
|
16
|
+
//# sourceMappingURL=invariant.d.ts.map
|
package/package.json
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@prettier-ai/dsh-client-ui-workspace",
|
|
3
|
+
"description": "Workspace picker plugin: one WorkspacePicker registered into the sidebar and empty-state workspace slots",
|
|
4
|
+
"version": "0.1.2-alpha.1",
|
|
5
|
+
"publishConfig": {
|
|
6
|
+
"access": "public"
|
|
7
|
+
},
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/deepseek-ai/deepseek-harness.git",
|
|
11
|
+
"directory": "packages/client/ui-workspace"
|
|
12
|
+
},
|
|
13
|
+
"type": "module",
|
|
14
|
+
"main": "lib/index.js",
|
|
15
|
+
"types": "lib/types/index.d.ts",
|
|
16
|
+
"exports": {
|
|
17
|
+
".": {
|
|
18
|
+
"types": "./lib/types/index.d.ts",
|
|
19
|
+
"default": "./lib/index.js"
|
|
20
|
+
},
|
|
21
|
+
"./invariant": {
|
|
22
|
+
"types": "./lib/types/invariant.d.ts",
|
|
23
|
+
"default": "./lib/invariant.js"
|
|
24
|
+
},
|
|
25
|
+
"./client": {
|
|
26
|
+
"types": "./lib/types/client/index.d.ts",
|
|
27
|
+
"default": "./lib/client.js"
|
|
28
|
+
},
|
|
29
|
+
"./src/*": "./src/*",
|
|
30
|
+
"./package.json": "./package.json"
|
|
31
|
+
},
|
|
32
|
+
"dsh": {
|
|
33
|
+
"client": {
|
|
34
|
+
"inject": [
|
|
35
|
+
"@prettier-ai/dsh-api-remotes",
|
|
36
|
+
"@prettier-ai/dsh-api-session-controller",
|
|
37
|
+
"@prettier-ai/dsh-api-workspace-controller",
|
|
38
|
+
"@prettier-ai/dsh-client-connection",
|
|
39
|
+
"@prettier-ai/dsh-client-locale",
|
|
40
|
+
"@prettier-ai/dsh-client-ui-conversation",
|
|
41
|
+
"@prettier-ai/dsh-client-ui-renderer",
|
|
42
|
+
"@prettier-ai/dsh-client-ui-session",
|
|
43
|
+
"@prettier-ai/dsh-client-ui-sidebar"
|
|
44
|
+
],
|
|
45
|
+
"platform": "web"
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
"license": "MIT",
|
|
49
|
+
"dependencies": {
|
|
50
|
+
"clsx": "^2.0.0"
|
|
51
|
+
},
|
|
52
|
+
"peerDependencies": {
|
|
53
|
+
"@prettier-ai/dsh-api-remotes": "^0.1.2-alpha.1",
|
|
54
|
+
"@prettier-ai/dsh-client-connection": "^0.1.2-alpha.1",
|
|
55
|
+
"@prettier-ai/dsh-client-locale": "^0.1.2-alpha.1",
|
|
56
|
+
"@prettier-ai/dsh-api-workspace-controller": "^0.1.2-alpha.1",
|
|
57
|
+
"@prettier-ai/dsh-api-session-controller": "^0.1.2-alpha.1",
|
|
58
|
+
"@prettier-ai/dsh-client-ui-conversation": "^0.1.2-alpha.1",
|
|
59
|
+
"@prettier-ai/dsh-client-ui-renderer": "^0.1.2-alpha.1",
|
|
60
|
+
"@prettier-ai/dsh-client-ui-session": "^0.1.2-alpha.1",
|
|
61
|
+
"@prettier-ai/dsh-client-ui-sidebar": "^0.1.2-alpha.1",
|
|
62
|
+
"@prettier-ai/cordis": "^4.0.1",
|
|
63
|
+
"@prettier-ai/dsh-session": "^0.1.2-alpha.1",
|
|
64
|
+
"@prettier-ai/dsh-typert-protocol": "^0.1.2-alpha.1",
|
|
65
|
+
"@prettier-ai/dsh-invariants": "^0.1.2-alpha.1",
|
|
66
|
+
"@prettier-ai/dsh-util-workspace-path": "^0.1.2-alpha.1"
|
|
67
|
+
},
|
|
68
|
+
"devDependencies": {
|
|
69
|
+
"@types/react": "~18.3.1",
|
|
70
|
+
"react": "^18.2.0",
|
|
71
|
+
"@prettier-ai/dsh-api-session-controller": "^0.1.2-alpha.1",
|
|
72
|
+
"@prettier-ai/dsh-api-workspace-controller": "^0.1.2-alpha.1",
|
|
73
|
+
"@prettier-ai/dsh-api-remotes": "^0.1.2-alpha.1",
|
|
74
|
+
"@prettier-ai/dsh-client-locale": "^0.1.2-alpha.1",
|
|
75
|
+
"@prettier-ai/dsh-client-store": "^0.1.2-alpha.1",
|
|
76
|
+
"@prettier-ai/dsh-client-connection": "^0.1.2-alpha.1",
|
|
77
|
+
"@prettier-ai/dsh-client-ui-conversation": "^0.1.2-alpha.1",
|
|
78
|
+
"@prettier-ai/dsh-client-ui-primitives": "^0.1.2-alpha.1",
|
|
79
|
+
"@prettier-ai/dsh-client-test-runtime": "^0.1.2-alpha.1",
|
|
80
|
+
"@prettier-ai/dsh-client-ui-slots": "^0.1.2-alpha.1",
|
|
81
|
+
"@prettier-ai/dsh-invariants": "^0.1.2-alpha.1",
|
|
82
|
+
"@prettier-ai/dsh-typert-protocol": "^0.1.2-alpha.1",
|
|
83
|
+
"@prettier-ai/dsh-session": "^0.1.2-alpha.1",
|
|
84
|
+
"@prettier-ai/dsh-client-ui-renderer": "^0.1.2-alpha.1",
|
|
85
|
+
"@prettier-ai/dsh-client-ui-sidebar": "^0.1.2-alpha.1",
|
|
86
|
+
"@prettier-ai/dsh-util-workspace-path": "^0.1.2-alpha.1",
|
|
87
|
+
"@prettier-ai/dsh-client-ui-session": "^0.1.2-alpha.1",
|
|
88
|
+
"@prettier-ai/cordis": "^4.0.1"
|
|
89
|
+
},
|
|
90
|
+
"files": [
|
|
91
|
+
"lib/index.js",
|
|
92
|
+
"lib/invariant.js",
|
|
93
|
+
"lib/client.js",
|
|
94
|
+
"lib/types/**/*.d.ts"
|
|
95
|
+
],
|
|
96
|
+
"scripts": {
|
|
97
|
+
"bundle": "tsdown",
|
|
98
|
+
"watch": "tsdown --watch"
|
|
99
|
+
}
|
|
100
|
+
}
|