@qilin-agent/client-ui-workspace 3.1.6 → 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.
package/lib/client.js CHANGED
@@ -724,29 +724,49 @@ window.__ModuleLoader__.load({
724
724
  };
725
725
  }, "ui-workspace: Workspace navigation policy");
726
726
  }
727
- async connectWorkspace(workspaceId) {
727
+ async connectWorkspace(workspaceId, options) {
728
728
  const workspace = this.workspaces.list.getSnapshot().items.find((item) => item.workspaceId === workspaceId);
729
729
  if (workspace === void 0) throw new Error(`uiWorkspace.connectWorkspace: unknown workspace ${workspaceId}`);
730
730
  const inflight = this.connecting.get(workspaceId);
731
- if (inflight !== void 0) return inflight;
731
+ if (inflight !== void 0 && inflight.agentPreset === options?.agentPreset) return inflight.attempt;
732
732
  const archived = this.workspaces.list.getSnapshot().archivedSessionIds;
733
733
  const sessions = this.sessions.list.getSnapshot();
734
734
  for (const id of sessions.ids) {
735
735
  const summary = sessions.byId[id];
736
- if (summary !== void 0 && summary.blank && summary.cwd === workspace.path && workspace.sessionIds.includes(summary.id) && !archived.includes(summary.id)) return summary.id;
736
+ const listed = summary?.projectionValues?.agentPreset;
737
+ if (summary !== void 0 && summary.blank && summary.cwd === workspace.path && workspace.sessionIds.includes(summary.id) && !archived.includes(summary.id) && (options?.agentPreset === void 0 || typeof listed !== "string" || listed === options.agentPreset)) {
738
+ const reuse = this.sessions.create({
739
+ workspaceId,
740
+ sessionId: summary.id,
741
+ ...options?.agentPreset === void 0 ? {} : { agentPreset: options.agentPreset }
742
+ }).finally(() => {
743
+ this.connecting.delete(workspaceId);
744
+ });
745
+ this.connecting.set(workspaceId, {
746
+ agentPreset: options?.agentPreset,
747
+ attempt: reuse
748
+ });
749
+ return reuse;
750
+ }
737
751
  }
738
- const attempt = this.sessions.create({ workspaceId }).finally(() => {
752
+ const attempt = this.sessions.create({
753
+ workspaceId,
754
+ ...options?.agentPreset === void 0 ? {} : { agentPreset: options.agentPreset }
755
+ }).finally(() => {
739
756
  this.connecting.delete(workspaceId);
740
757
  });
741
- this.connecting.set(workspaceId, attempt);
758
+ this.connecting.set(workspaceId, {
759
+ agentPreset: options?.agentPreset,
760
+ attempt
761
+ });
742
762
  return attempt;
743
763
  }
744
764
  openSession(target) {
745
765
  this.replaceMain(target, this.lifetime.signal);
746
766
  }
747
- async openWorkspace(workspaceId, beforeOpen) {
767
+ async openWorkspace(workspaceId, beforeOpen, options) {
748
768
  const navigation = AbortSignal.any([this.ctx.layout.beginNavigation(), this.lifetime.signal]);
749
- const sessionId = await this.connectWorkspace(workspaceId);
769
+ const sessionId = await this.connectWorkspace(workspaceId, options);
750
770
  if (navigation.aborted) return;
751
771
  this.replaceMain(sessionId, navigation, beforeOpen);
752
772
  }
@@ -759,8 +779,9 @@ window.__ModuleLoader__.load({
759
779
  if (!navigation.aborted) this.replaceMain(childId, navigation);
760
780
  }
761
781
  startSession(workspaceId, options) {
762
- const draftOptions = options === void 0 ? void 0 : structuredClone(options);
763
- const initializeDraft = draftOptions !== void 0 && (draftOptions.prompt !== void 0 || draftOptions.clearPreviousDraft === true);
782
+ const { agentPreset, ...draft } = options ?? {};
783
+ const draftOptions = options === void 0 ? void 0 : structuredClone(draft);
784
+ const initializeDraft = draftOptions !== void 0 && (draftOptions.prompt !== void 0 || (draftOptions.whenDraftExists ?? (draftOptions.clearPreviousDraft === true ? "replace" : "keep")) === "replace");
764
785
  const workspace = this.workspaces.list.getSnapshot();
765
786
  const sessions = this.sessions.list.getSnapshot();
766
787
  const current = this.mainReference?.sessionId;
@@ -782,7 +803,7 @@ window.__ModuleLoader__.load({
782
803
  const binding = this.sessions.binding(id);
783
804
  if (binding === void 0) this.draftPreparationFailed();
784
805
  this.prepareDraft(binding, draftOptions);
785
- } : void 0).catch((reason) => {
806
+ } : void 0, agentPreset === void 0 ? void 0 : { agentPreset }).catch((reason) => {
786
807
  console.warn("new session failed:", reason);
787
808
  });
788
809
  }
@@ -1173,11 +1194,11 @@ window.__ModuleLoader__.load({
1173
1194
  const workspaceMenuItems = [{
1174
1195
  id: "rename",
1175
1196
  label: t("rename"),
1176
- icon: (0, react_jsx_runtime.jsx)(_qilin_agent_client_ui_primitives.IconEditOutline16, {})
1197
+ icon: (0, react_jsx_runtime.jsx)(_qilin_agent_client_ui_primitives.IconEditOutlineRegular, {})
1177
1198
  }, {
1178
1199
  id: "delete",
1179
1200
  label: t("delete.workspace"),
1180
- icon: (0, react_jsx_runtime.jsx)(_qilin_agent_client_ui_primitives.IconTrashOutline16, {}),
1201
+ icon: (0, react_jsx_runtime.jsx)(_qilin_agent_client_ui_primitives.IconTrashOutlineRegular, {}),
1181
1202
  danger: true
1182
1203
  }];
1183
1204
  const ownRow = (0, react_jsx_runtime.jsxs)("div", {
@@ -1195,11 +1216,11 @@ window.__ModuleLoader__.load({
1195
1216
  children: [
1196
1217
  (0, react_jsx_runtime.jsx)("span", {
1197
1218
  className: clsx(Rows_module_css_default.slot, Rows_module_css_default.folder, active && Rows_module_css_default.folderActive),
1198
- children: row.expanded ? (0, react_jsx_runtime.jsx)(_qilin_agent_client_ui_primitives.IconFolderOpen16, {}) : (0, react_jsx_runtime.jsx)(_qilin_agent_client_ui_primitives.IconFolderClose16, {})
1219
+ children: row.expanded ? (0, react_jsx_runtime.jsx)(_qilin_agent_client_ui_primitives.IconFolderOpenRegular, {}) : (0, react_jsx_runtime.jsx)(_qilin_agent_client_ui_primitives.IconFolderCloseRegular, {})
1199
1220
  }),
1200
1221
  (0, react_jsx_runtime.jsx)("span", {
1201
1222
  className: clsx(Rows_module_css_default.slot, Rows_module_css_default.chevron),
1202
- children: (0, react_jsx_runtime.jsx)(_qilin_agent_client_ui_primitives.IconTriangleRightFill14, { className: clsx(Rows_module_css_default.arrow, row.expanded && Rows_module_css_default.arrowOpen) })
1223
+ children: (0, react_jsx_runtime.jsx)(_qilin_agent_client_ui_primitives.IconTriangleRightFillRegular, { className: clsx(Rows_module_css_default.arrow, row.expanded && Rows_module_css_default.arrowOpen) })
1203
1224
  }),
1204
1225
  (0, react_jsx_runtime.jsx)("span", {
1205
1226
  className: Rows_module_css_default.projectText,
@@ -1233,7 +1254,7 @@ window.__ModuleLoader__.load({
1233
1254
  e.stopPropagation();
1234
1255
  setMenuOpen((v) => !v);
1235
1256
  },
1236
- children: (0, react_jsx_runtime.jsx)(_qilin_agent_client_ui_primitives.IconEllipsisOutline16, {})
1257
+ children: (0, react_jsx_runtime.jsx)(_qilin_agent_client_ui_primitives.IconEllipsisOutlineRegular, {})
1237
1258
  })
1238
1259
  }), (0, react_jsx_runtime.jsx)("button", {
1239
1260
  type: "button",
@@ -1243,7 +1264,7 @@ window.__ModuleLoader__.load({
1243
1264
  e.stopPropagation();
1244
1265
  onCreate();
1245
1266
  },
1246
- children: (0, react_jsx_runtime.jsx)(_qilin_agent_client_ui_primitives.IconPlusOutline16, {})
1267
+ children: (0, react_jsx_runtime.jsx)(_qilin_agent_client_ui_primitives.IconPlusOutlineRegular, {})
1247
1268
  })]
1248
1269
  })
1249
1270
  ]
@@ -1449,17 +1470,17 @@ window.__ModuleLoader__.load({
1449
1470
  {
1450
1471
  id: "rename",
1451
1472
  label: t("rename"),
1452
- icon: (0, react_jsx_runtime.jsx)(_qilin_agent_client_ui_primitives.IconEditOutline16, {})
1473
+ icon: (0, react_jsx_runtime.jsx)(_qilin_agent_client_ui_primitives.IconEditOutlineRegular, {})
1453
1474
  },
1454
1475
  {
1455
1476
  id: "fork",
1456
1477
  label: t("menu.fork"),
1457
- icon: (0, react_jsx_runtime.jsx)(_qilin_agent_client_ui_primitives.IconBranchOutline16, {})
1478
+ icon: (0, react_jsx_runtime.jsx)(_qilin_agent_client_ui_primitives.IconBranchOutlineRegular, {})
1458
1479
  },
1459
1480
  {
1460
1481
  id: "archive",
1461
1482
  label: t("menu.archiveSession"),
1462
- icon: (0, react_jsx_runtime.jsx)(_qilin_agent_client_ui_primitives.IconArchiveOutline20, { size: 16 })
1483
+ icon: (0, react_jsx_runtime.jsx)(_qilin_agent_client_ui_primitives.IconArchiveOutlineRegular, { size: 16 })
1463
1484
  },
1464
1485
  {
1465
1486
  id: "copyId",
@@ -1538,7 +1559,7 @@ window.__ModuleLoader__.load({
1538
1559
  e.stopPropagation();
1539
1560
  setMenuOpen((v) => !v);
1540
1561
  },
1541
- children: (0, react_jsx_runtime.jsx)(_qilin_agent_client_ui_primitives.IconEllipsisOutline16, {})
1562
+ children: (0, react_jsx_runtime.jsx)(_qilin_agent_client_ui_primitives.IconEllipsisOutlineRegular, {})
1542
1563
  })
1543
1564
  }),
1544
1565
  (0, react_jsx_runtime.jsx)(_qilin_agent_client_ui_primitives.Tooltip, {
@@ -1554,7 +1575,7 @@ window.__ModuleLoader__.load({
1554
1575
  e.stopPropagation();
1555
1576
  onArchive(node.id);
1556
1577
  },
1557
- children: (0, react_jsx_runtime.jsx)(_qilin_agent_client_ui_primitives.IconArchiveOutline20, { size: 16 })
1578
+ children: (0, react_jsx_runtime.jsx)(_qilin_agent_client_ui_primitives.IconArchiveOutlineRegular, { size: 16 })
1558
1579
  })
1559
1580
  }),
1560
1581
  (0, react_jsx_runtime.jsx)(_qilin_agent_client_ui_primitives.Tooltip, {
@@ -1629,14 +1650,14 @@ window.__ModuleLoader__.load({
1629
1650
  const addEntries = flowAvailable ? [{
1630
1651
  id: ADD_WORKSPACE,
1631
1652
  label: t("menu.addWorkspace"),
1632
- icon: (0, react_jsx_runtime.jsx)(_qilin_agent_client_ui_primitives.IconPlusOutline16, { size: 16 }),
1653
+ icon: (0, react_jsx_runtime.jsx)(_qilin_agent_client_ui_primitives.IconPlusOutlineRegular, { size: 16 }),
1633
1654
  disabled: flowBusy
1634
1655
  }] : [];
1635
1656
  const pinAdd = !addOnly && workspaces.length > 0;
1636
1657
  const items = pinAdd ? workspaces.map((workspace) => ({
1637
1658
  id: workspace.workspaceId,
1638
1659
  label: workspace.title,
1639
- icon: (0, react_jsx_runtime.jsx)(_qilin_agent_client_ui_primitives.IconFolderClose16, { size: 16 }),
1660
+ icon: (0, react_jsx_runtime.jsx)(_qilin_agent_client_ui_primitives.IconFolderCloseRegular, { size: 16 }),
1640
1661
  disabled: flowBusy
1641
1662
  })) : addEntries;
1642
1663
  const menuIsEmpty = items.length === 0;
@@ -1969,7 +1990,7 @@ window.__ModuleLoader__.load({
1969
1990
  onClick: () => {
1970
1991
  setOpen((v) => !v);
1971
1992
  },
1972
- children: (0, react_jsx_runtime.jsx)(_qilin_agent_client_ui_primitives.IconPersonalizationOutline16, {})
1993
+ children: (0, react_jsx_runtime.jsx)(_qilin_agent_client_ui_primitives.IconPersonalizationOutlineRegular, {})
1973
1994
  })
1974
1995
  })
1975
1996
  });
@@ -2900,7 +2921,7 @@ window.__ModuleLoader__.load({
2900
2921
  setSearchExpanded(true);
2901
2922
  requestSearch();
2902
2923
  },
2903
- children: (0, react_jsx_runtime.jsx)(_qilin_agent_client_ui_primitives.IconSearchOutline16, { size: searchExpanded ? 11 : 14 })
2924
+ children: (0, react_jsx_runtime.jsx)(_qilin_agent_client_ui_primitives.IconSearchOutlineRegular, { size: searchExpanded ? 11 : 14 })
2904
2925
  })
2905
2926
  }),
2906
2927
  (0, react_jsx_runtime.jsx)("input", {
@@ -2929,7 +2950,7 @@ window.__ModuleLoader__.load({
2929
2950
  setQuery("");
2930
2951
  setSearchExpanded(false);
2931
2952
  },
2932
- children: (0, react_jsx_runtime.jsx)(_qilin_agent_client_ui_primitives.IconCloseFill14, {})
2953
+ children: (0, react_jsx_runtime.jsx)(_qilin_agent_client_ui_primitives.IconCloseFillRegular, {})
2933
2954
  })
2934
2955
  ]
2935
2956
  })
@@ -2960,7 +2981,7 @@ window.__ModuleLoader__.load({
2960
2981
  onClick: () => {
2961
2982
  requestAddWorkspace();
2962
2983
  },
2963
- children: (0, react_jsx_runtime.jsx)(_qilin_agent_client_ui_primitives.IconProjectAddOutline16, { size: 16 })
2984
+ children: (0, react_jsx_runtime.jsx)(_qilin_agent_client_ui_primitives.IconProjectAddOutlineRegular, { size: 16 })
2964
2985
  })
2965
2986
  })]
2966
2987
  }),
@@ -14,8 +14,11 @@ export interface MainSelection {
14
14
  readonly sessionId?: SessionId;
15
15
  readonly subagentAddress?: SubagentAddress;
16
16
  }
17
- /** Optional content preparation for the resolved target Session. */
18
- export type StartSessionOptions = DraftInitializationOptions;
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
+ }
19
22
  /** Workspace archive and directory operations consumed by Client UI domains. */
20
23
  export interface UiWorkspace {
21
24
  /**
@@ -34,9 +37,10 @@ export interface UiWorkspace {
34
37
  * @param workspaceId - target Workspace.
35
38
  * @param beforeOpen - optional synchronous preparation for the selected Session,
36
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.
37
41
  * @returns completion; a superseded request may create a Session but does not open it.
38
42
  */
39
- openWorkspace(workspaceId: WorkspaceId, beforeOpen?: (sessionId: SessionId) => void): Promise<void>;
43
+ openWorkspace(workspaceId: WorkspaceId, beforeOpen?: (sessionId: SessionId) => void, options?: Pick<StartSessionOptions, 'agentPreset'>): Promise<void>;
40
44
  /**
41
45
  * Fork a Session and open the child unless a later navigation supersedes it.
42
46
  * @param sessionId - source Session.
@@ -46,13 +50,15 @@ export interface UiWorkspace {
46
50
  /**
47
51
  * Resolve the reusable or newly created blank Session for a Workspace.
48
52
  * @param workspaceId - target Workspace.
53
+ * @param options - choices for the created or reused Session, including the Agent preset.
49
54
  * @returns a Session already addressable through the Session Controller.
50
55
  */
51
- connectWorkspace(workspaceId: WorkspaceId): Promise<SessionId>;
56
+ connectWorkspace(workspaceId: WorkspaceId, options?: Pick<StartSessionOptions, 'agentPreset'>): Promise<SessionId>;
52
57
  /**
53
58
  * Start a New Session flow and navigate to its Session.
54
59
  * @param workspaceId - explicit target; absent inherits the current or most recent Workspace.
55
- * @param options - initial content; existing text or attachments are preserved unless clearPreviousDraft is true.
60
+ * @param options - initial content, the Agent preset, and `whenDraftExists`;
61
+ * existing text or attachments are preserved unless that handling replaces them.
56
62
  */
57
63
  startSession(workspaceId?: WorkspaceId, options?: StartSessionOptions): void;
58
64
  /**
@@ -133,9 +139,9 @@ declare class UiWorkspaceService extends Service implements UiWorkspace {
133
139
  * @param notify - show one notice through the Workspace notice channel.
134
140
  */
135
141
  constructor(ctx: Context, directoryPicker: ClientRemote['directoryPicker'], workspaces: IWorkspaces, sessions: ISessions, view: Pick<WorkspaceViewStoreActions, 'pinSessionOrder'>, notify: (toast: RowToast) => void);
136
- connectWorkspace(workspaceId: WorkspaceId): Promise<SessionId>;
142
+ connectWorkspace(workspaceId: WorkspaceId, options?: Pick<StartSessionOptions, 'agentPreset'>): Promise<SessionId>;
137
143
  openSession(target: SessionTarget): void;
138
- openWorkspace(workspaceId: WorkspaceId, beforeOpen?: (sessionId: SessionId) => void): Promise<void>;
144
+ openWorkspace(workspaceId: WorkspaceId, beforeOpen?: (sessionId: SessionId) => void, options?: Pick<StartSessionOptions, 'agentPreset'>): Promise<void>;
139
145
  forkSession(sessionId: SessionId): Promise<void>;
140
146
  startSession(workspaceId?: WorkspaceId, options?: StartSessionOptions): void;
141
147
  private prepareDraft;
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.6",
4
+ "version": "3.1.7",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -54,26 +54,26 @@
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.6",
58
- "@qilin-agent/api-session-controller": "3.1.6",
59
- "@qilin-agent/api-workspace-controller": "3.1.6",
60
- "@qilin-agent/client-locale": "3.1.6",
61
- "@qilin-agent/client-shortcuts": "3.1.6",
62
- "@qilin-agent/client-connection": "3.1.6",
63
- "@qilin-agent/client-test-runtime": "3.1.6",
64
- "@qilin-agent/client-ui-conversation": "3.1.6",
65
- "@qilin-agent/client-store": "3.1.6",
66
- "@qilin-agent/client-ui-layout": "3.1.6",
67
- "@qilin-agent/client-ui-primitives": "3.1.6",
68
- "@qilin-agent/client-ui-renderer": "3.1.6",
69
- "@qilin-agent/client-ui-session": "3.1.6",
70
- "@qilin-agent/client-ui-sidebar": "3.1.6",
71
- "@qilin-agent/client-ui-slots": "3.1.6",
72
- "@qilin-agent/schedule": "3.1.6",
73
- "@qilin-agent/session": "3.1.6",
74
- "@qilin-agent/subagent": "3.1.6",
75
- "@qilin-agent/typert-protocol": "3.1.6",
76
- "@qilin-agent/util-workspace-path": "3.1.6",
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
77
  "@qilin-agent/kylin": "~4.0.5"
78
78
  },
79
79
  "files": [