@qzsy/dsh-workspace-combobox 0.2.0 → 0.2.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/README.md CHANGED
@@ -5,7 +5,7 @@ Workspace combobox plus a Git branch picker for DeepSeek Harness.
5
5
  ## Install
6
6
 
7
7
  ~~~bash
8
- dsh plugin add @qzsy/dsh-workspace-combobox@0.2.0
8
+ dsh plugin add @qzsy/dsh-workspace-combobox@0.2.1
9
9
  ~~~
10
10
 
11
11
  ## Features
package/dist/client.js CHANGED
@@ -705,6 +705,7 @@ window.__ModuleLoader__.load({
705
705
  //#region git branch
706
706
  const BRANCH_STATUS_ENDPOINT = 'api/workspace-git';
707
707
  const BRANCH_SWITCH_ENDPOINT = 'api/workspace-git/switch';
708
+ const MIN_SWITCH_FEEDBACK_MS = 700;
708
709
 
709
710
  function branchEndpoint(route) {
710
711
  if (typeof document !== 'undefined' && typeof document.baseURI === 'string') {
@@ -717,6 +718,10 @@ window.__ModuleLoader__.load({
717
718
  return route;
718
719
  }
719
720
 
721
+ function wait(ms) {
722
+ return new Promise((resolve) => setTimeout(resolve, ms));
723
+ }
724
+
720
725
  async function branchRequest(route, payload, signal) {
721
726
  const response = await fetch(branchEndpoint(route), {
722
727
  method: 'POST',
@@ -871,14 +876,19 @@ window.__ModuleLoader__.load({
871
876
  const choose = async (name, isRemote) => {
872
877
  if (busy) return;
873
878
  const targetPath = path;
879
+ const startedAt = Date.now();
874
880
  setSwitching(name);
875
881
  setError('');
876
882
  try {
877
883
  const next = await branchRequest(BRANCH_SWITCH_ENDPOINT, { path: targetPath, branch: name, remote: isRemote });
884
+ const remaining = MIN_SWITCH_FEEDBACK_MS - (Date.now() - startedAt);
885
+ if (remaining > 0) await wait(remaining);
878
886
  if (selection !== undefined && typeof selection.get === 'function' && selection.get() !== targetPath) return;
879
887
  setStatus(next);
880
888
  setOpen(false);
881
889
  } catch (failure) {
890
+ const remaining = MIN_SWITCH_FEEDBACK_MS - (Date.now() - startedAt);
891
+ if (remaining > 0) await wait(remaining);
882
892
  setError(failure instanceof Error && failure.message.length > 0 ? failure.message : t('branch.failed'));
883
893
  } finally {
884
894
  setSwitching(null);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qzsy/dsh-workspace-combobox",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Pinyin-aware workspace combobox for the New Session picker, plus a Git branch picker with local/remote branch switching and a Ctrl+. frame-wide workspace switcher.",
5
5
  "type": "module",
6
6
  "license": "MIT",