@qilin-agent/client-ui-workspace 3.1.5 → 3.1.7

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.
@@ -190,7 +190,33 @@ export type WorkspaceBrowserInjected = {
190
190
  createWorkspace: (input: {
191
191
  path: string;
192
192
  }) => Promise<WorkspaceView>;
193
+ /** Copy the complete Session id and report acceptance or failure through the keyed notice. */
194
+ copySessionId: (sessionId: SessionId) => Promise<void>;
193
195
  };
196
+ /** One transient Workspace notice rendered by the overlay toast entry. */
197
+ export type RowToast = {
198
+ kind: 'sessionIdCopied';
199
+ } | {
200
+ kind: 'sessionIdCopyFailed';
201
+ } | {
202
+ kind: 'createFailed';
203
+ message: string;
204
+ };
205
+ /** The notice on display; `seq` keys remounts so a repeated notice restarts its hold. */
206
+ export type RowToastState = RowToast & {
207
+ seq: number;
208
+ };
209
+ /** Existing overlay share: the current notice and its dismissal. */
210
+ export interface RowToastInjected {
211
+ hooks: {
212
+ /** The notice on display, or none. */
213
+ toast: HostObservable<RowToastState | null>;
214
+ };
215
+ /** Take the notice down. */
216
+ dismissToast: () => void;
217
+ }
218
+ /** Props of the existing overlay's keyed notice dispatcher. */
219
+ export type RowToastProps = PropsRuntime<'shell.overlay'> & PropsRenderSlots<'workspace.toast'> & Pick<RowToastInjected, 'dismissToast'> & PropsHooks<RowToastInjected['hooks']>;
194
220
  /** Full browser props: shell owner share + viewing store + injected actions + the locale seat. */
195
221
  export type WorkspaceBrowserProps = PropsRuntime<'sidebar.workspaces'> & PropsRenderSlots<'sidebar.workspaces.directoryFlow' | 'sidebar.session.row.leading' | 'sidebar.session.row.hover'> & PropsStore<ReturnType<typeof createWorkspaceViewStore>> & Omit<WorkspaceBrowserInjected, 'hooks'> & PropsHooks<WorkspaceBrowserInjected['hooks']> & PropsLocale<'workspace'>;
196
222
  /**
@@ -0,0 +1,55 @@
1
+ /** Keyed Workspace notices and the shared Toast Factory's display data. */
2
+ import type { FactoryComponentPropsOf, InjectFace, PropsLocale, PropsRenderFactories, PropsRuntime } from '@qilin-agent/client-ui-slots';
3
+ import type { RowToastState } from './slots.ts';
4
+ /** Business key of one existing Workspace notice. */
5
+ export type ToastKind = RowToastState['kind'];
6
+ /** Notice payload selected by the keyed registration. */
7
+ export type ToastNotice<K extends ToastKind> = Extract<RowToastState, {
8
+ kind: K;
9
+ }>;
10
+ /** Plain display fields consumed by the shared Factory. */
11
+ export interface ToastDisplay {
12
+ text: string;
13
+ tone: 'plain' | 'warning' | 'success';
14
+ }
15
+ /** Per-display identity and dismissal; neither changes when localized content updates. */
16
+ export interface ToastOccurrence extends ToastDisplay {
17
+ seq: number;
18
+ onDone: () => void;
19
+ }
20
+ /** Pure localized display mapping owned by a keyed notice registration. */
21
+ export interface ToastDisplayInjected<K extends ToastKind> {
22
+ display: (notice: ToastNotice<K>, t: PropsLocale<'workspace'>['t'], dismiss: () => void) => ToastDisplay;
23
+ }
24
+ /** Shared adapter props; each registration narrows its notice payload. */
25
+ export type ToastEntryProps<P extends PropsRuntime<'workspace.toast'>> = P & PropsLocale<'workspace'> & PropsRenderFactories & InjectFace<{
26
+ display: (notice: P, t: PropsLocale<'workspace'>['t'], dismiss: () => void) => ToastDisplay;
27
+ }>;
28
+ /** Complete props of the shared Workspace Toast Factory. */
29
+ export type WorkspaceToastProps = FactoryComponentPropsOf<'workspace.toast.content'>;
30
+ /** Owner operations available to every keyed Workspace notice. */
31
+ export interface WorkspaceToastOwnerProps {
32
+ /** Dismiss the displayed notice. */
33
+ dismissToast: () => void;
34
+ }
35
+ declare module '@qilin-agent/client-ui-slots' {
36
+ interface SlotMap {
37
+ /** Workspace notices selected by their existing business discriminator. */
38
+ 'workspace.toast': {
39
+ kind: 'keyed';
40
+ scope: 'root';
41
+ owner: WorkspaceToastOwnerProps;
42
+ keyProps: {
43
+ [K in ToastKind]: ToastNotice<K>;
44
+ };
45
+ };
46
+ }
47
+ interface SlotFactoryMap {
48
+ /** Shared Toast presentation; business registrations supply only display data and callbacks. */
49
+ 'workspace.toast.content': {
50
+ scope: 'root';
51
+ props: ToastOccurrence;
52
+ };
53
+ }
54
+ }
55
+ //# sourceMappingURL=toast.d.ts.map
@@ -12,7 +12,7 @@ import type { Context } from '@qilin-agent/kylin';
12
12
  import type { WorkspaceSnapshot } from '@qilin-agent/api-workspace-controller/client';
13
13
  import type { SnapshotSelectorHook } from '@qilin-agent/client-ui-slots';
14
14
  import { type WorkspaceKey } from './locales.ts';
15
- export type { MainSelection, UiWorkspace } from './navigation.ts';
15
+ export type { MainSelection, StartSessionOptions, UiWorkspace } from './navigation.ts';
16
16
  export type { DirectoryFlowOwnerProps, DirectoryFlowSlotName, DirectoryPickingHooks, DirectoryPickingInjected, SessionRowScheduleOwnerProps, WorkspaceBrowserInjected, WorkspaceBrowserProps, WorkspacePickerInjected, WorkspacePickerProps, } from './contract/slots.ts';
17
17
  export type { WorkspaceKey } from './locales.ts';
18
18
  declare module '@qilin-agent/client-ui-slots' {
@@ -5,6 +5,8 @@
5
5
  */
6
6
  /** Simplified Chinese dictionary (the key-set source of truth). */
7
7
  export declare const zh: {
8
+ 'draft.workspaceRequired': string;
9
+ 'draft.initializationFailed': string;
8
10
  'group.ungrouped': string;
9
11
  'session.new': string;
10
12
  'session.untitled': string;
@@ -52,12 +54,16 @@ export declare const zh: {
52
54
  'menu.unpinSession': string;
53
55
  'menu.fork': string;
54
56
  'menu.archiveSession': string;
57
+ 'menu.sessionId': string;
58
+ 'toast.sessionIdCopied': string;
59
+ 'toast.sessionIdCopyFailed': string;
55
60
  'row.pinned': string;
56
61
  'sessions.count.one': string;
57
62
  'sessions.count.other': string;
58
63
  'actions.workspace.aria': string;
59
64
  'actions.session.aria': string;
60
65
  'actions.newSession.aria': string;
66
+ 'actions.archive': string;
61
67
  'actions.pin': string;
62
68
  'actions.unpin': string;
63
69
  'status.running': string;
@@ -83,6 +89,8 @@ export declare const zh: {
83
89
  export type WorkspaceKey = keyof typeof zh;
84
90
  /** English dictionary, checked complete against the zh key set. */
85
91
  export declare const en: {
92
+ 'draft.workspaceRequired': string;
93
+ 'draft.initializationFailed': string;
86
94
  'group.ungrouped': string;
87
95
  'session.new': string;
88
96
  'session.untitled': string;
@@ -130,12 +138,16 @@ export declare const en: {
130
138
  'menu.unpinSession': string;
131
139
  'menu.fork': string;
132
140
  'menu.archiveSession': string;
141
+ 'menu.sessionId': string;
142
+ 'toast.sessionIdCopied': string;
143
+ 'toast.sessionIdCopyFailed': string;
133
144
  'row.pinned': string;
134
145
  'sessions.count.one': string;
135
146
  'sessions.count.other': string;
136
147
  'actions.workspace.aria': string;
137
148
  'actions.session.aria': string;
138
149
  'actions.newSession.aria': string;
150
+ 'actions.archive': string;
139
151
  'actions.pin': string;
140
152
  'actions.unpin': string;
141
153
  'status.running': string;
@@ -6,12 +6,19 @@ import { type ObservableSnapshot } from '@qilin-agent/client-store';
6
6
  import type { SubagentAddress } from '@qilin-agent/subagent/client';
7
7
  import type { IWorkspaces, WorkspaceId } from '@qilin-agent/api-workspace-controller/client';
8
8
  import type { SessionId } from '@qilin-agent/session/types';
9
+ import type { DraftInitializationOptions } from '@qilin-agent/client-ui-conversation/client';
10
+ import type { RowToast } from './contract/slots.ts';
9
11
  import type { WorkspaceViewStoreActions } from './stores.ts';
10
12
  /** The main-pane selection a navigation action publishes: one Session, or one direct-parent subagent address. */
11
13
  export interface MainSelection {
12
14
  readonly sessionId?: SessionId;
13
15
  readonly subagentAddress?: SubagentAddress;
14
16
  }
17
+ /** Content preparation and Agent preset for the Session a Workspace flow opens. */
18
+ export interface StartSessionOptions extends DraftInitializationOptions {
19
+ /** Agent preset the Session runs; the Host default when omitted. */
20
+ readonly agentPreset?: string;
21
+ }
15
22
  /** Workspace archive and directory operations consumed by Client UI domains. */
16
23
  export interface UiWorkspace {
17
24
  /**
@@ -30,9 +37,10 @@ export interface UiWorkspace {
30
37
  * @param workspaceId - target Workspace.
31
38
  * @param beforeOpen - optional synchronous preparation for the selected Session,
32
39
  * skipped after supersession; a throw aborts the open and releases the retained reference.
40
+ * @param options - choices for the Session the connection creates or reuses.
33
41
  * @returns completion; a superseded request may create a Session but does not open it.
34
42
  */
35
- openWorkspace(workspaceId: WorkspaceId, beforeOpen?: (sessionId: SessionId) => void): Promise<void>;
43
+ openWorkspace(workspaceId: WorkspaceId, beforeOpen?: (sessionId: SessionId) => void, options?: Pick<StartSessionOptions, 'agentPreset'>): Promise<void>;
36
44
  /**
37
45
  * Fork a Session and open the child unless a later navigation supersedes it.
38
46
  * @param sessionId - source Session.
@@ -42,14 +50,17 @@ export interface UiWorkspace {
42
50
  /**
43
51
  * Resolve the reusable or newly created blank Session for a Workspace.
44
52
  * @param workspaceId - target Workspace.
53
+ * @param options - choices for the created or reused Session, including the Agent preset.
45
54
  * @returns a Session already addressable through the Session Controller.
46
55
  */
47
- connectWorkspace(workspaceId: WorkspaceId): Promise<SessionId>;
56
+ connectWorkspace(workspaceId: WorkspaceId, options?: Pick<StartSessionOptions, 'agentPreset'>): Promise<SessionId>;
48
57
  /**
49
58
  * Start a New Session flow and navigate to its Session.
50
59
  * @param workspaceId - explicit target; absent inherits the current or most recent Workspace.
60
+ * @param options - initial content, the Agent preset, and `whenDraftExists`;
61
+ * existing text or attachments are preserved unless that handling replaces them.
51
62
  */
52
- startSession(workspaceId?: WorkspaceId): void;
63
+ startSession(workspaceId?: WorkspaceId, options?: StartSessionOptions): void;
53
64
  /**
54
65
  * Archive a Session and clear it when it is the current selection.
55
66
  * @param sessionId - Session to archive.
@@ -109,6 +120,7 @@ declare class UiWorkspaceService extends Service implements UiWorkspace {
109
120
  private readonly workspaces;
110
121
  private readonly sessions;
111
122
  private readonly view;
123
+ private readonly notify;
112
124
  private readonly connecting;
113
125
  private readonly lifetime;
114
126
  /**
@@ -124,13 +136,16 @@ declare class UiWorkspaceService extends Service implements UiWorkspace {
124
136
  * @param workspaces - pure Workspace Controller.
125
137
  * @param sessions - pure Session Controller.
126
138
  * @param view - the browser's viewing-store write set, which owns saved Session order.
139
+ * @param notify - show one notice through the Workspace notice channel.
127
140
  */
128
- constructor(ctx: Context, directoryPicker: ClientRemote['directoryPicker'], workspaces: IWorkspaces, sessions: ISessions, view: Pick<WorkspaceViewStoreActions, 'pinSessionOrder'>);
129
- connectWorkspace(workspaceId: WorkspaceId): Promise<SessionId>;
141
+ constructor(ctx: Context, directoryPicker: ClientRemote['directoryPicker'], workspaces: IWorkspaces, sessions: ISessions, view: Pick<WorkspaceViewStoreActions, 'pinSessionOrder'>, notify: (toast: RowToast) => void);
142
+ connectWorkspace(workspaceId: WorkspaceId, options?: Pick<StartSessionOptions, 'agentPreset'>): Promise<SessionId>;
130
143
  openSession(target: SessionTarget): void;
131
- openWorkspace(workspaceId: WorkspaceId, beforeOpen?: (sessionId: SessionId) => void): Promise<void>;
144
+ openWorkspace(workspaceId: WorkspaceId, beforeOpen?: (sessionId: SessionId) => void, options?: Pick<StartSessionOptions, 'agentPreset'>): Promise<void>;
132
145
  forkSession(sessionId: SessionId): Promise<void>;
133
- startSession(workspaceId?: WorkspaceId): void;
146
+ startSession(workspaceId?: WorkspaceId, options?: StartSessionOptions): void;
147
+ private prepareDraft;
148
+ private draftPreparationFailed;
134
149
  archiveSession(sessionId: SessionId): Promise<void>;
135
150
  unarchiveSession(sessionId: SessionId): Promise<void>;
136
151
  pinSession(sessionId: SessionId): Promise<void>;
@@ -73,8 +73,9 @@ export declare function SearchResultItem({ result, currentId, onOpen, t }: {
73
73
  t: RowTranslate;
74
74
  }): import("react").JSX.Element;
75
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.
76
+ * One top-level 32px session row: status dot (pending user interaction outranks
77
+ * own or descendant activity), a title that marquees while the row is hovered,
78
+ * relative time, and the hover action strip (menu, archive, pin).
78
79
  * @param props.node - derived session node.
79
80
  * @param props.currentId - selected session id (row highlight).
80
81
  * @param props.now - epoch ms for relative-time formatting.
@@ -82,6 +83,7 @@ export declare function SearchResultItem({ result, currentId, onOpen, t }: {
82
83
  * @param props.onRename - open the session rename dialog (id + current title).
83
84
  * @param props.onFork - fork a session at its last completed turn.
84
85
  * @param props.onArchive - archive a session by id.
86
+ * @param props.onCopyId - copy a session's complete id without opening it.
85
87
  * @param props.onPin - pin a session by id (leading its group and the flat list).
86
88
  * @param props.onUnpin - drop a session's pin.
87
89
  * @param props.onReveal - scroll this row into view after search navigation, then acknowledge it.
@@ -89,7 +91,7 @@ export declare function SearchResultItem({ result, currentId, onOpen, t }: {
89
91
  * @param props.t - the browser root's locale seat.
90
92
  * @returns the session row.
91
93
  */
92
- export declare function SessionNodeItem({ node, currentId, now, onOpen, onRename, onFork, onArchive, onPin, onUnpin, onReveal, drag, renderSlot, t, }: {
94
+ export declare function SessionNodeItem({ node, currentId, now, onOpen, onRename, onFork, onArchive, onCopyId, onPin, onUnpin, onReveal, drag, renderSlot, t, }: {
93
95
  node: SessionNode;
94
96
  currentId: string | undefined;
95
97
  now: number;
@@ -100,6 +102,8 @@ export declare function SessionNodeItem({ node, currentId, now, onOpen, onRename
100
102
  onFork: (id: SessionNode['id']) => void;
101
103
  /** Archive this session (row menu action; commits without a dialog). */
102
104
  onArchive: (id: SessionNode['id']) => void;
105
+ /** Copy this session's complete id without opening it (row menu action). */
106
+ onCopyId: (id: SessionNode['id']) => void;
103
107
  /** Pin this session ahead of unpinned rows (row menu and hover action). */
104
108
  onPin: (id: SessionNode['id']) => void;
105
109
  /** Drop this session's pin (row menu and hover action). */
@@ -4,5 +4,5 @@ import type { WorkspaceBrowserProps } from '../contract/slots.ts';
4
4
  * @param props - composed slot props (shell owner share + store + injected actions).
5
5
  * @returns the region element tree.
6
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;
7
+ export declare function WorkspaceBrowser({ wide, usePanelInfo, expandSidebar, useSessions, useSessionStatus, useWorkspaces, useStore, actions, startSession, open, renameSession, forkSession, renameWorkspace, deleteWorkspace, insertWorkspaceBefore, archiveSession, copySessionId, pinSession, unpinSession, createWorkspace, searchSessions, searchResultLimit, requestSearch, requestAddWorkspace, closeAddWorkspace, closeRenameRequest, setDirectoryBusy, useDirectoryFlow, useHostInfo, useWorkspaceShortcuts, useShortcuts, renderSlot, t, }: WorkspaceBrowserProps): import("react").JSX.Element;
8
8
  //# sourceMappingURL=WorkspaceBrowser.d.ts.map
@@ -0,0 +1,9 @@
1
+ /** The existing overlay dispatches the latest Workspace notice to its keyed presentation. */
2
+ import type { RowToastProps } from '../contract/slots.ts';
3
+ /**
4
+ * Dispatch the current notice without interpreting its business payload.
5
+ * @param props - Current notice, dismissal, and the declared keyed renderer.
6
+ * @returns The selected notice presentation, or nothing.
7
+ */
8
+ export declare function RowActionToast({ useToast, dismissToast, renderSlot }: RowToastProps): import("react").ReactNode;
9
+ //# sourceMappingURL=RowActionToast.d.ts.map
@@ -0,0 +1,15 @@
1
+ import type { PropsRuntime } from '@qilin-agent/client-ui-slots';
2
+ import type { ToastEntryProps, WorkspaceToastProps } from '../contract/toast.ts';
3
+ /**
4
+ * Render one notice using the shared Factory.
5
+ * @param props - Keyed payload, injected display mapping, locale, and Factory renderer.
6
+ * @returns The shared Toast occurrence.
7
+ */
8
+ export declare function ToastEntry<P extends PropsRuntime<'workspace.toast'>>(props: ToastEntryProps<P>): import("react").ReactNode;
9
+ /**
10
+ * Present plain display data with the shared primitive's timing and portal.
11
+ * @param props - Localized display fields, display identity, and dismissal.
12
+ * @returns One Toast, remounted only for a new display identity.
13
+ */
14
+ export declare function WorkspaceToast({ seq, text, tone, onDone }: WorkspaceToastProps): import("react").JSX.Element;
15
+ //# sourceMappingURL=Toast.d.ts.map
@@ -0,0 +1,8 @@
1
+ /** Business-owned mappings into the keyed Workspace Toast slot. */
2
+ import type { Context } from '@qilin-agent/kylin';
3
+ /**
4
+ * Register notice presentations with their business-owned display fields.
5
+ * @param ctx - Workspace plugin context.
6
+ */
7
+ export declare function registerToasts(ctx: Context): void;
8
+ //# sourceMappingURL=register.d.ts.map
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@qilin-agent/client-ui-workspace",
3
3
  "description": "Workspace picker plugin: one WorkspacePicker registered into the sidebar and empty-state workspace slots",
4
- "version": "3.1.5",
4
+ "version": "3.1.7",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -48,33 +48,33 @@
48
48
  },
49
49
  "license": "MIT",
50
50
  "peerDependencies": {
51
- "@qilin-agent/kylin": "~4.0.3"
51
+ "@qilin-agent/kylin": "~4.0.5"
52
52
  },
53
53
  "devDependencies": {
54
54
  "@types/react": "~18.3.1",
55
55
  "clsx": "^2.0.0",
56
56
  "react": "^18.2.0",
57
- "@qilin-agent/api-remotes": "3.1.5",
58
- "@qilin-agent/api-session-controller": "3.1.5",
59
- "@qilin-agent/client-shortcuts": "3.1.5",
60
- "@qilin-agent/client-locale": "3.1.5",
61
- "@qilin-agent/client-connection": "3.1.5",
62
- "@qilin-agent/api-workspace-controller": "3.1.5",
63
- "@qilin-agent/client-store": "3.1.5",
64
- "@qilin-agent/client-test-runtime": "3.1.5",
65
- "@qilin-agent/client-ui-conversation": "3.1.5",
66
- "@qilin-agent/client-ui-layout": "3.1.5",
67
- "@qilin-agent/client-ui-primitives": "3.1.5",
68
- "@qilin-agent/client-ui-renderer": "3.1.5",
69
- "@qilin-agent/client-ui-sidebar": "3.1.5",
70
- "@qilin-agent/client-ui-slots": "3.1.5",
71
- "@qilin-agent/kylin": "~4.0.3",
72
- "@qilin-agent/client-ui-session": "3.1.5",
73
- "@qilin-agent/schedule": "3.1.5",
74
- "@qilin-agent/subagent": "3.1.5",
75
- "@qilin-agent/typert-protocol": "3.1.5",
76
- "@qilin-agent/session": "3.1.5",
77
- "@qilin-agent/util-workspace-path": "3.1.5"
57
+ "@qilin-agent/api-remotes": "3.1.7",
58
+ "@qilin-agent/api-session-controller": "3.1.7",
59
+ "@qilin-agent/api-workspace-controller": "3.1.7",
60
+ "@qilin-agent/client-connection": "3.1.7",
61
+ "@qilin-agent/client-shortcuts": "3.1.7",
62
+ "@qilin-agent/client-locale": "3.1.7",
63
+ "@qilin-agent/client-test-runtime": "3.1.7",
64
+ "@qilin-agent/client-store": "3.1.7",
65
+ "@qilin-agent/client-ui-conversation": "3.1.7",
66
+ "@qilin-agent/client-ui-layout": "3.1.7",
67
+ "@qilin-agent/client-ui-primitives": "3.1.7",
68
+ "@qilin-agent/client-ui-renderer": "3.1.7",
69
+ "@qilin-agent/client-ui-session": "3.1.7",
70
+ "@qilin-agent/client-ui-sidebar": "3.1.7",
71
+ "@qilin-agent/client-ui-slots": "3.1.7",
72
+ "@qilin-agent/schedule": "3.1.7",
73
+ "@qilin-agent/session": "3.1.7",
74
+ "@qilin-agent/subagent": "3.1.7",
75
+ "@qilin-agent/typert-protocol": "3.1.7",
76
+ "@qilin-agent/util-workspace-path": "3.1.7",
77
+ "@qilin-agent/kylin": "~4.0.5"
78
78
  },
79
79
  "files": [
80
80
  "lib/index.js",