@michengai/dsh-codex-ui 2.0.22 → 2.1.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/lib/client.js CHANGED
@@ -777,6 +777,18 @@ html[data-dsh-glass] body:not([data-ds-dark-theme]) .dcu-section-card {
777
777
  "--shiki-token-string-expression": "#a6e3a1",
778
778
  "--shiki-token-punctuation": "#9399b2",
779
779
  "--shiki-token-link": "#89b4fa"
780
+ },
781
+ "cyberpunk": {
782
+ ...COMMON_SHIKI_SURFACE,
783
+ "--shiki-token-constant": "#ffd700",
784
+ "--shiki-token-string": "#8cffb0",
785
+ "--shiki-token-comment": "#20943b",
786
+ "--shiki-token-keyword": "#00ff41",
787
+ "--shiki-token-parameter": "#a6ff4d",
788
+ "--shiki-token-function": "#00ff9d",
789
+ "--shiki-token-string-expression": "#8cffb0",
790
+ "--shiki-token-punctuation": "#00cc34",
791
+ "--shiki-token-link": "#00ff88"
780
792
  }
781
793
  };
782
794
  //#endregion
@@ -3346,7 +3358,204 @@ html[data-dsh-glass] body:not([data-ds-dark-theme]) .dcu-section-card {
3346
3358
  CATPPUCCIN_MOCHA_THEME,
3347
3359
  CATPPUCCIN_MACCHIATO_THEME,
3348
3360
  CATPPUCCIN_FRAPPE_THEME,
3349
- CATPPUCCIN_LATTE_THEME
3361
+ CATPPUCCIN_LATTE_THEME,
3362
+ {
3363
+ id: "cyberpunk",
3364
+ colorScheme: "dark",
3365
+ tokens: {
3366
+ ...SHIKI_TOKENS_BY_THEME["cyberpunk"],
3367
+ "--dsw-static-amber-100": "color-mix(in srgb, #ffd700 20%, #0f1d12)",
3368
+ "--dsw-static-amber-400": "color-mix(in srgb, #ffd700 70%, #0f1d12)",
3369
+ "--dsw-static-amber-500": "#ffd700",
3370
+ "--dsw-static-amber-600": "#ffd700",
3371
+ "--dsw-static-amber-900": "color-mix(in srgb, #ffd700 18%, #000a00)",
3372
+ "--dsw-static-blue-100": "color-mix(in srgb, #00e5ff 24%, #0f1d12)",
3373
+ "--dsw-static-blue-300": "color-mix(in srgb, #00e5ff 50%, #0f1d12)",
3374
+ "--dsw-static-blue-400": "color-mix(in srgb, #00e5ff 66%, #0f1d12)",
3375
+ "--dsw-static-blue-450": "color-mix(in srgb, #00e5ff 84%, #0f1d12)",
3376
+ "--dsw-static-blue-500": "#00e5ff",
3377
+ "--dsw-static-blue-50": "color-mix(in srgb, #00e5ff 10%, #0f1d12)",
3378
+ "--dsw-static-blue-50p": "color-mix(in srgb, #00e5ff 14%, #0f1d12)",
3379
+ "--dsw-static-blue-600": "color-mix(in srgb, #00b8d4 84%, #0f1d12)",
3380
+ "--dsw-static-blue-75": "color-mix(in srgb, #00e5ff 18%, #0f1d12)",
3381
+ "--dsw-static-blue-800": "color-mix(in srgb, #00b8d4 26%, #000a00)",
3382
+ "--dsw-static-blue-900": "color-mix(in srgb, #00b8d4 18%, #000a00)",
3383
+ "--dsw-static-blue-950": "color-mix(in srgb, #00b8d4 12%, #000a00)",
3384
+ "--dsw-static-deepseek-100": "color-mix(in srgb, #00ff41 24%, #0f1d12)",
3385
+ "--dsw-static-deepseek-200": "color-mix(in srgb, #00ff41 36%, #0f1d12)",
3386
+ "--dsw-static-deepseek-300": "color-mix(in srgb, #00ff41 50%, #0f1d12)",
3387
+ "--dsw-static-deepseek-400": "color-mix(in srgb, #00ff41 66%, #0f1d12)",
3388
+ "--dsw-static-deepseek-450": "color-mix(in srgb, #00ff41 84%, #0f1d12)",
3389
+ "--dsw-static-deepseek-500": "#00ff41",
3390
+ "--dsw-static-deepseek-50": "color-mix(in srgb, #00ff41 10%, #0f1d12)",
3391
+ "--dsw-static-deepseek-600": "color-mix(in srgb, #00cc34 84%, #0f1d12)",
3392
+ "--dsw-static-deepseek-700-delete": "color-mix(in srgb, #00cc34 68%, #0f1d12)",
3393
+ "--dsw-static-deepseek-800": "color-mix(in srgb, #00cc34 26%, #000a00)",
3394
+ "--dsw-static-deepseek-900": "color-mix(in srgb, #00cc34 18%, #000a00)",
3395
+ "--dsw-static-green-100": "color-mix(in srgb, #00ff88 18%, #0f1d12)",
3396
+ "--dsw-static-green-400": "color-mix(in srgb, #00ff88 80%, #0f1d12)",
3397
+ "--dsw-static-green-500": "#00ff88",
3398
+ "--dsw-static-green-500-a08": "color-mix(in srgb, #00ff88 8%, transparent)",
3399
+ "--dsw-static-green-500-a12": "color-mix(in srgb, #00ff88 12%, transparent)",
3400
+ "--dsw-static-green-900": "color-mix(in srgb, #00ff88 22%, #000a00)",
3401
+ "--dsw-static-neutral-00": "#7dff9e",
3402
+ "--dsw-static-neutral-1000": "#000600",
3403
+ "--dsw-static-neutral-100": "#00d937",
3404
+ "--dsw-static-neutral-150": "#00cc34",
3405
+ "--dsw-static-neutral-200": "#1ca838",
3406
+ "--dsw-static-neutral-250": "#1ca838",
3407
+ "--dsw-static-neutral-300": "#1a8a30",
3408
+ "--dsw-static-neutral-400": "#147026",
3409
+ "--dsw-static-neutral-500": "#0c5c1e",
3410
+ "--dsw-static-neutral-50": "#00ff41",
3411
+ "--dsw-static-neutral-550": "#08521a",
3412
+ "--dsw-static-neutral-600": "#004814",
3413
+ "--dsw-static-neutral-700": "#234029",
3414
+ "--dsw-static-neutral-800": "#152819",
3415
+ "--dsw-static-neutral-850": "#0f1d12",
3416
+ "--dsw-static-neutral-900": "#000600",
3417
+ "--dsw-static-neutral-bluish-00": "#7dff9e",
3418
+ "--dsw-static-neutral-bluish-1000": "#000600",
3419
+ "--dsw-static-neutral-bluish-100": "#00d937",
3420
+ "--dsw-static-neutral-bluish-150": "#00cc34",
3421
+ "--dsw-static-neutral-bluish-200": "#1ca838",
3422
+ "--dsw-static-neutral-bluish-300": "#1a8a30",
3423
+ "--dsw-static-neutral-bluish-400": "#147026",
3424
+ "--dsw-static-neutral-bluish-500": "#0c5c1e",
3425
+ "--dsw-static-neutral-bluish-50": "#00ff41",
3426
+ "--dsw-static-neutral-bluish-600": "#004814",
3427
+ "--dsw-static-neutral-bluish-60": "#00f03d",
3428
+ "--dsw-static-neutral-bluish-700": "#234029",
3429
+ "--dsw-static-neutral-bluish-750": "#1c3421",
3430
+ "--dsw-static-neutral-bluish-75": "#00e038",
3431
+ "--dsw-static-neutral-bluish-800": "#152819",
3432
+ "--dsw-static-neutral-bluish-850": "#0f1d12",
3433
+ "--dsw-static-neutral-bluish-875": "#0a140c",
3434
+ "--dsw-static-neutral-bluish-900": "#000600",
3435
+ "--dsw-static-neutral-bluish-950": "#000a00",
3436
+ "--dsw-static-red-100": "color-mix(in srgb, #ff003c 20%, #0f1d12)",
3437
+ "--dsw-static-red-400": "color-mix(in srgb, #ff003c 78%, #0f1d12)",
3438
+ "--dsw-static-red-400-a12": "color-mix(in srgb, #ff003c 12%, transparent)",
3439
+ "--dsw-static-red-500": "#ff003c",
3440
+ "--dsw-static-red-50": "color-mix(in srgb, #ff003c 10%, #0f1d12)",
3441
+ "--dsw-static-red-600": "#e00034",
3442
+ "--dsw-static-red-600-a08": "color-mix(in srgb, #ff003c 8%, transparent)",
3443
+ "--dsw-static-red-900": "color-mix(in srgb, #ff003c 34%, #0f1d12)",
3444
+ "--dsw-alias-bg-base": "var(--dsw-static-neutral-bluish-950)",
3445
+ "--dsw-alias-bg-document-preview": "var(--dsw-static-neutral-bluish-950)",
3446
+ "--dsw-alias-bg-document-selection": "color-mix(in srgb, var(--dsw-static-blue-500) 40%, transparent)",
3447
+ "--dsw-alias-label-document-preview": "var(--dsw-static-neutral-bluish-300)",
3448
+ "--dsw-alias-bg-layer-1": "var(--dsw-static-neutral-bluish-875)",
3449
+ "--dsw-alias-bg-layer-2": "var(--dsw-static-neutral-bluish-850)",
3450
+ "--dsw-alias-bg-layer-3": "var(--dsw-static-neutral-bluish-800)",
3451
+ "--dsw-alias-bg-mask-1": "rgba(0, 0, 0, 0.5)",
3452
+ "--dsw-alias-bg-mask-2": "rgba(0, 0, 0, 0.2)",
3453
+ "--dsw-alias-bg-mask-3": "rgba(0, 0, 0, 0.48)",
3454
+ "--dsw-alias-bg-mask-photo": "rgba(0, 0, 0, 0.88)",
3455
+ "--dsw-alias-bg-mask-drop": "rgba(0, 14, 4, 0.72)",
3456
+ "--dsw-alias-bg-module-platform": "var(--dsw-static-neutral-bluish-800)",
3457
+ "--dsw-alias-bg-multi-select": "var(--dsw-static-neutral-850)",
3458
+ "--dsw-alias-bg-overlay": "var(--dsw-static-neutral-bluish-700)",
3459
+ "--dsw-alias-bg-skeleton": "rgba(0, 255, 65, 0.08)",
3460
+ "--dsw-alias-border-inverted2": "rgba(0, 255, 65, 0.08)",
3461
+ "--dsw-alias-border-inverted": "rgba(0, 255, 65, 0.06)",
3462
+ "--dsw-alias-border-l1": "rgba(0, 255, 65, 0.14)",
3463
+ "--dsw-alias-border-l2-darkmode-thin": "rgba(0, 255, 65, 0.20)",
3464
+ "--dsw-alias-border-l2": "rgba(0, 255, 65, 0.24)",
3465
+ "--dsw-alias-border-l3": "rgba(0, 255, 65, 0.36)",
3466
+ "--dsw-alias-border-l4": "rgba(0, 255, 65, 0.52)",
3467
+ "--dsw-alias-brand-primary-invert": "var(--dsw-static-neutral-bluish-50)",
3468
+ "--dsw-alias-brand-primary-new-colorprimary-new-color": "#00ff41",
3469
+ "--dsw-alias-brand-primary": "#00ff41",
3470
+ "--dsw-alias-brand-text": "#000a00",
3471
+ "--dsw-alias-button-contrast-fill": "var(--dsw-static-neutral-bluish-50)",
3472
+ "--dsw-alias-button-elevated-fill": "var(--dsw-static-neutral-bluish-750)",
3473
+ "--dsw-alias-button-floating-fill": "var(--dsw-static-neutral-bluish-850)",
3474
+ "--dsw-alias-button-floating-hover": "var(--dsw-static-neutral-bluish-800)",
3475
+ "--dsw-alias-button-ghost-active-border": "var(--dsw-static-neutral-bluish-600)",
3476
+ "--dsw-alias-button-ghost-active-fill": "var(--dsw-static-neutral-bluish-750)",
3477
+ "--dsw-alias-button-ghost-active-hover": "var(--dsw-static-neutral-bluish-700)",
3478
+ "--dsw-alias-button-info-fill": "#00ff41",
3479
+ "--dsw-alias-button-info-hover": "#5cff85",
3480
+ "--dsw-alias-button-primary-dimmed": "var(--dsw-static-neutral-bluish-750)",
3481
+ "--dsw-alias-button-primary-fill": "#00ff41",
3482
+ "--dsw-alias-button-primary-hover": "#5cff85",
3483
+ "--dsw-alias-button-tool-bar-fill-invisible": "rgba(0, 20, 4, 0.42)",
3484
+ "--dsw-alias-button-tool-bar-fill": "rgba(12, 48, 20, 0.55)",
3485
+ "--dsw-alias-button-tool-bar-hover": "rgba(18, 68, 28, 0.70)",
3486
+ "--dsw-alias-interactive-bg-active": "rgba(0, 255, 65, 0.22)",
3487
+ "--dsw-alias-interactive-bg-hover-accent": "rgba(0, 255, 65, 0.24)",
3488
+ "--dsw-alias-interactive-bg-hover-danger": "rgba(255, 0, 60, 0.16)",
3489
+ "--dsw-alias-interactive-bg-hover-solid": "var(--dsw-static-neutral-bluish-800)",
3490
+ "--dsw-alias-interactive-bg-hover": "rgba(0, 255, 65, 0.09)",
3491
+ "--dsw-alias-label-caption": "var(--dsw-static-neutral-bluish-300)",
3492
+ "--dsw-alias-label-deep-diving": "color-mix(in srgb, var(--dsw-static-deepseek-450) 55%, var(--dsw-static-neutral-bluish-400))",
3493
+ "--dsw-alias-label-deep-diving-shimmer": "color-mix(in srgb, var(--dsw-static-blue-300) 65%, var(--dsw-static-deepseek-400))",
3494
+ "--dsw-alias-label-dimmed": "var(--dsw-static-neutral-bluish-400)",
3495
+ "--dsw-alias-label-primary-bluish": "var(--dsw-static-neutral-bluish-50)",
3496
+ "--dsw-alias-label-primary-dimmed": "var(--dsw-static-neutral-bluish-75)",
3497
+ "--dsw-alias-label-primary-foreground": "var(--dsw-static-neutral-bluish-1000)",
3498
+ "--dsw-alias-label-primary-inverted": "var(--dsw-static-neutral-bluish-800)",
3499
+ "--dsw-alias-label-primary": "var(--dsw-static-neutral-bluish-50)",
3500
+ "--dsw-alias-label-secondary": "var(--dsw-static-neutral-bluish-150)",
3501
+ "--dsw-alias-label-shimmer": "color-mix(in srgb, var(--dsw-static-neutral-00) 45%, transparent)",
3502
+ "--dsw-alias-label-tertiary": "var(--dsw-static-neutral-bluish-200)",
3503
+ "--dsw-alias-menu-icon": "var(--dsw-alias-label-primary-dimmed)",
3504
+ "--dsw-alias-link": "#00ff88",
3505
+ "--dsw-alias-markdown-citation": "var(--dsw-static-neutral-bluish-800)",
3506
+ "--dsw-alias-markdown-code-block-banner": "var(--dsw-static-neutral-bluish-850)",
3507
+ "--dsw-alias-markdown-code-block": "var(--dsw-static-neutral-bluish-900)",
3508
+ "--dsw-alias-markdown-code-segment-selected": "var(--dsw-static-neutral-bluish-800)",
3509
+ "--dsw-alias-markdown-code-segment-unselected": "var(--dsw-static-neutral-bluish-900)",
3510
+ "--dsw-alias-markdown-inline-code": "rgba(0, 255, 65, 0.12)",
3511
+ "--dsw-alias-markdown-placeholder": "var(--dsw-static-neutral-bluish-850)",
3512
+ "--dsw-alias-markdown-tag": "var(--dsw-static-neutral-bluish-850)",
3513
+ "--dsw-alias-scrollbar-bg-l1": "var(--dsw-static-neutral-700)",
3514
+ "--dsw-alias-scrollbar-bg-l2": "var(--dsw-static-neutral-600)",
3515
+ "--dsw-alias-scrollbar-hover-l1": "var(--dsw-static-neutral-600)",
3516
+ "--dsw-alias-scrollbar-hover-l2": "var(--dsw-static-neutral-550)",
3517
+ "--dsw-alias-state-business-primary": "var(--dsw-static-deepseek-500)",
3518
+ "--dsw-alias-state-business-tertiary": "var(--dsw-static-deepseek-800)",
3519
+ "--dsw-alias-code-diff-added": "var(--dsw-static-green-500-a12)",
3520
+ "--dsw-alias-code-diff-deleted": "var(--dsw-static-red-400-a12)",
3521
+ "--dsw-alias-file-diff-added-bg": "var(--dsw-static-green-500-a12)",
3522
+ "--dsw-alias-file-diff-added-gutter": "color-mix(in srgb, var(--dsw-static-green-500) 6%, transparent)",
3523
+ "--dsw-alias-file-diff-added-marker": "var(--dsw-static-green-500)",
3524
+ "--dsw-alias-file-diff-deleted-bg": "var(--dsw-static-red-400-a12)",
3525
+ "--dsw-alias-file-diff-deleted-gutter": "color-mix(in srgb, var(--dsw-static-red-500) 6%, transparent)",
3526
+ "--dsw-alias-file-diff-deleted-marker": "var(--dsw-static-red-500)",
3527
+ "--dsw-alias-state-error-primary": "var(--dsw-static-red-400)",
3528
+ "--dsw-alias-state-error-secondary": "var(--dsw-static-red-400)",
3529
+ "--dsw-alias-state-idle-primary": "var(--dsw-static-neutral-600)",
3530
+ "--dsw-alias-state-success-primary": "var(--dsw-static-green-500)",
3531
+ "--dsw-alias-state-success-secondary": "var(--dsw-static-green-400)",
3532
+ "--dsw-alias-state-success-tertiary": "var(--dsw-static-green-900)",
3533
+ "--dsw-alias-state-warn-label": "var(--dsw-static-amber-600)",
3534
+ "--dsw-alias-state-warn-primary": "var(--dsw-static-amber-500)",
3535
+ "--dsw-alias-state-warn-secondary": "var(--dsw-static-amber-400)",
3536
+ "--dsw-alias-state-warn-tertiary": "var(--dsw-static-amber-900)",
3537
+ "--dsw-alias-switch-thumb": "var(--dsw-static-neutral-bluish-200)",
3538
+ "--dsw-alias-toast-bg": "var(--dsw-static-neutral-bluish-750)",
3539
+ "--dsw-alias-toast-label": "var(--dsw-static-neutral-bluish-00)",
3540
+ "--dsw-alias-turn-trigger-bg": "var(--dsw-alias-interactive-bg-hover)",
3541
+ "--dsw-alias-turn-trigger-bg-hover": "var(--dsw-alias-interactive-bg-active)",
3542
+ "--dsw-alias-tooltip-bg": "var(--dsw-static-neutral-bluish-750)",
3543
+ "--dsw-alias-tooltip-key-bg": "color-mix(in srgb, var(--dsw-alias-tooltip-bg), white 18%)",
3544
+ "--dsw-alias-menu-group-header-fill": "color-mix(in srgb, var(--dsw-alias-bg-layer-3) 94%, transparent)",
3545
+ "--dsw-specific-bubble-highlight": "var(--dsw-static-neutral-bluish-750)",
3546
+ "--dsw-specific-bubble": "var(--dsw-static-neutral-bluish-850)",
3547
+ "--dsw-specific-input-major": "var(--dsw-static-neutral-bluish-850)",
3548
+ "--dsw-specific-login-input": "var(--dsw-static-neutral-bluish-900)",
3549
+ "--dsw-specific-menu": "var(--dsw-menu-surface-fill)",
3550
+ "--dsw-specific-selector": "var(--dsw-static-neutral-bluish-800)",
3551
+ "--dsw-specific-sidebar-fill": "var(--dsw-static-neutral-bluish-900)",
3552
+ "--dsw-specific-sidebar-nav-item-active-accent": "var(--dsw-static-neutral-bluish-800)",
3553
+ "--dsw-specific-sidebar-nav-item-active": "rgba(0, 255, 65, 0.18)",
3554
+ "--dsw-specific-sidebar-nav-item-hover": "rgba(0, 255, 65, 0.08)",
3555
+ "--dsw-specific-tip": "var(--dsw-static-neutral-bluish-800)",
3556
+ "--dsw-menu-surface-fill": "color-mix(in srgb, var(--dsw-alias-bg-layer-3) 75%, transparent)"
3557
+ }
3558
+ }
3350
3559
  ];
3351
3560
  //#endregion
3352
3561
  //#region src/client/theme/state.ts
@@ -3357,7 +3566,7 @@ html[data-dsh-glass] body:not([data-ds-dark-theme]) .dcu-section-card {
3357
3566
  glassPreset: "codex-ui.glass.preset",
3358
3567
  glassGlow: "codex-ui.glass.glow"
3359
3568
  });
3360
- const listeners$2 = /* @__PURE__ */ new Set();
3569
+ const listeners$3 = /* @__PURE__ */ new Set();
3361
3570
  const VALID_THEMES = [
3362
3571
  "stock",
3363
3572
  "codex-dark",
@@ -3372,7 +3581,8 @@ html[data-dsh-glass] body:not([data-ds-dark-theme]) .dcu-section-card {
3372
3581
  "catppuccin-mocha",
3373
3582
  "catppuccin-macchiato",
3374
3583
  "catppuccin-frappe",
3375
- "catppuccin-latte"
3584
+ "catppuccin-latte",
3585
+ "cyberpunk"
3376
3586
  ];
3377
3587
  function safeGetItem$1(key) {
3378
3588
  try {
@@ -3421,7 +3631,7 @@ html[data-dsh-glass] body:not([data-ds-dark-theme]) .dcu-section-card {
3421
3631
  }
3422
3632
  function notify() {
3423
3633
  currentSnapshot = computeSnapshot();
3424
- for (const listener of listeners$2) try {
3634
+ for (const listener of listeners$3) try {
3425
3635
  listener();
3426
3636
  } catch (e) {
3427
3637
  console.warn("[codex-ui:theme] listener error:", e);
@@ -3448,9 +3658,9 @@ html[data-dsh-glass] body:not([data-ds-dark-theme]) .dcu-section-card {
3448
3658
  notify();
3449
3659
  }
3450
3660
  function subscribeThemeSettings(listener) {
3451
- listeners$2.add(listener);
3661
+ listeners$3.add(listener);
3452
3662
  return () => {
3453
- listeners$2.delete(listener);
3663
+ listeners$3.delete(listener);
3454
3664
  };
3455
3665
  }
3456
3666
  if (typeof window !== "undefined") window.addEventListener("storage", (event) => {
@@ -3911,6 +4121,13 @@ html[data-dsh-glass] body:not([data-ds-dark-theme]) .dcu-section-card {
3911
4121
  subKey: "theme.subLatte",
3912
4122
  accent: "#8839ef",
3913
4123
  colorScheme: "light"
4124
+ },
4125
+ {
4126
+ id: "cyberpunk",
4127
+ labelKey: "theme.paletteCyberpunk",
4128
+ subKey: "theme.subCyberpunk",
4129
+ accent: "#00ff41",
4130
+ colorScheme: "dark"
3914
4131
  }
3915
4132
  ];
3916
4133
  const stylesheet$1 = `
@@ -4374,7 +4591,7 @@ ${SECTION_CARD_CSS}
4374
4591
  const PREDICTION_STORAGE_KEY = "codex-ui.composer.prediction";
4375
4592
  /** 同一窗口内跨标签页同步(storage 事件在写入方自身不触发)。 */
4376
4593
  const PREDICTION_STORAGE_EVENT = "codex-ui:prediction-change";
4377
- const listeners$1 = /* @__PURE__ */ new Set();
4594
+ const listeners$2 = /* @__PURE__ */ new Set();
4378
4595
  function safeGetItem(key) {
4379
4596
  try {
4380
4597
  if (typeof localStorage !== "undefined") return localStorage.getItem(key);
@@ -4407,11 +4624,11 @@ ${SECTION_CARD_CSS}
4407
4624
  };
4408
4625
  }
4409
4626
  let cached = snapshot();
4410
- function publish() {
4627
+ function publish$1() {
4411
4628
  const next = snapshot();
4412
4629
  if (next.subPluginEnabled === cached.subPluginEnabled && next.userEnabled === cached.userEnabled && next.mode === cached.mode && next.hostAllowed === cached.hostAllowed && next.enabled === cached.enabled && next.nextEnabled === cached.nextEnabled && next.continueEnabled === cached.continueEnabled) return;
4413
4630
  cached = next;
4414
- for (const listener of [...listeners$1]) try {
4631
+ for (const listener of [...listeners$2]) try {
4415
4632
  listener();
4416
4633
  } catch {}
4417
4634
  }
@@ -4420,13 +4637,13 @@ ${SECTION_CARD_CSS}
4420
4637
  return cached;
4421
4638
  }
4422
4639
  function subscribePredictionSettings(listener) {
4423
- listeners$1.add(listener);
4424
- return () => listeners$1.delete(listener);
4640
+ listeners$2.add(listener);
4641
+ return () => listeners$2.delete(listener);
4425
4642
  }
4426
4643
  function setPredictionMode(mode) {
4427
4644
  currentMode = mode;
4428
4645
  safeSetItem(PREDICTION_STORAGE_KEY, mode);
4429
- publish();
4646
+ publish$1();
4430
4647
  if (typeof window !== "undefined" && typeof window.dispatchEvent === "function") try {
4431
4648
  window.dispatchEvent(new Event(PREDICTION_STORAGE_EVENT));
4432
4649
  } catch {}
@@ -4434,12 +4651,12 @@ ${SECTION_CARD_CSS}
4434
4651
  /** Host 状态端点回报的配置位;缺省视为允许。 */
4435
4652
  function setHostPredictionAllowed(allowed) {
4436
4653
  hostAllowed = allowed;
4437
- publish();
4654
+ publish$1();
4438
4655
  }
4439
4656
  /** 标记 codex-ui-composer 子插件在 Host 侧的启用状态;未启用时设置卡片不渲染(对齐主题卡片)。 */
4440
4657
  function setSubPluginEnabled(enabled) {
4441
4658
  subPluginEnabled = enabled;
4442
- publish();
4659
+ publish$1();
4443
4660
  }
4444
4661
  /** 监听跨标签页与同窗口的设置变更。返回卸载函数。 */
4445
4662
  function observePredictionSettings() {
@@ -4447,11 +4664,11 @@ ${SECTION_CARD_CSS}
4447
4664
  const onStorage = (event) => {
4448
4665
  if (event.key !== null && event.key !== "codex-ui.composer.prediction") return;
4449
4666
  currentMode = parseStoredMode(safeGetItem(PREDICTION_STORAGE_KEY));
4450
- publish();
4667
+ publish$1();
4451
4668
  };
4452
4669
  const onLocal = () => {
4453
4670
  currentMode = parseStoredMode(safeGetItem(PREDICTION_STORAGE_KEY));
4454
- publish();
4671
+ publish$1();
4455
4672
  };
4456
4673
  window.addEventListener("storage", onStorage);
4457
4674
  window.addEventListener(PREDICTION_STORAGE_EVENT, onLocal);
@@ -4461,11 +4678,72 @@ ${SECTION_CARD_CSS}
4461
4678
  };
4462
4679
  }
4463
4680
  //#endregion
4681
+ //#region src/client/composer/history-scope.ts
4682
+ const HISTORY_SCOPE_STORAGE_KEY = "codex-ui.composer.history-scope";
4683
+ /** 同一窗口内跨标签页同步(storage 事件在写入方自身不触发)。 */
4684
+ const HISTORY_SCOPE_STORAGE_EVENT = "codex-ui:history-scope-change";
4685
+ const listeners$1 = /* @__PURE__ */ new Set();
4686
+ function safeStorage() {
4687
+ try {
4688
+ if (typeof localStorage !== "undefined") return localStorage;
4689
+ } catch {}
4690
+ }
4691
+ function parseStoredHistoryScope(raw) {
4692
+ return raw === "workspace" ? "workspace" : "session";
4693
+ }
4694
+ let currentScope = parseStoredHistoryScope(safeStorage()?.getItem(HISTORY_SCOPE_STORAGE_KEY));
4695
+ /** 稳定的只读快照,可直接交给 `useSyncExternalStore`。 */
4696
+ function getHistoryScope() {
4697
+ return currentScope;
4698
+ }
4699
+ function subscribeHistoryScope(listener) {
4700
+ listeners$1.add(listener);
4701
+ return () => {
4702
+ listeners$1.delete(listener);
4703
+ };
4704
+ }
4705
+ function publish() {
4706
+ for (const listener of [...listeners$1]) try {
4707
+ listener();
4708
+ } catch {}
4709
+ }
4710
+ function setHistoryScope(scope) {
4711
+ currentScope = scope;
4712
+ try {
4713
+ safeStorage()?.setItem(HISTORY_SCOPE_STORAGE_KEY, scope);
4714
+ } catch {}
4715
+ publish();
4716
+ if (typeof window !== "undefined" && typeof window.dispatchEvent === "function") try {
4717
+ window.dispatchEvent(new Event(HISTORY_SCOPE_STORAGE_EVENT));
4718
+ } catch {}
4719
+ }
4720
+ /** 监听跨标签页与同窗口的设置变更。返回卸载函数。 */
4721
+ function observeHistoryScope() {
4722
+ if (typeof window === "undefined") return () => {};
4723
+ const sync = () => {
4724
+ const next = parseStoredHistoryScope(safeStorage()?.getItem(HISTORY_SCOPE_STORAGE_KEY));
4725
+ if (next === currentScope) return;
4726
+ currentScope = next;
4727
+ publish();
4728
+ };
4729
+ const onStorage = (event) => {
4730
+ if (event.key !== null && event.key !== "codex-ui.composer.history-scope") return;
4731
+ sync();
4732
+ };
4733
+ sync();
4734
+ window.addEventListener("storage", onStorage);
4735
+ window.addEventListener(HISTORY_SCOPE_STORAGE_EVENT, sync);
4736
+ return () => {
4737
+ window.removeEventListener("storage", onStorage);
4738
+ window.removeEventListener(HISTORY_SCOPE_STORAGE_EVENT, sync);
4739
+ };
4740
+ }
4741
+ //#endregion
4464
4742
  //#region src/client/composer/ComposerSettingsCard.tsx
4465
4743
  /**
4466
4744
  * 输入框增强设置卡片。
4467
4745
  *
4468
- * 只放预测开关:其他能力(↑/↓ 历史、宽度手柄、建议卡片)没有可调项,
4746
+ * 放预测开关与 ↑/↓ 历史召回范围;宽度手柄、建议卡片没有可调项,
4469
4747
  * 用不到就不渲染成灰项,遵循插件「不残留死配置」的既有约定。
4470
4748
  *
4471
4749
  * 站点级关闭(profile `cordis.patch.yml` 里 `config: { prediction: false }`)时,
@@ -4473,6 +4751,7 @@ ${SECTION_CARD_CSS}
4473
4751
  */
4474
4752
  function ComposerSettingsCard({ t }) {
4475
4753
  const state = (0, react.useSyncExternalStore)(subscribePredictionSettings, getPredictionSettingsState, getPredictionSettingsState);
4754
+ const historyScope = (0, react.useSyncExternalStore)(subscribeHistoryScope, getHistoryScope, getHistoryScope);
4476
4755
  if (!state.subPluginEnabled) return null;
4477
4756
  const lockedByHost = !state.hostAllowed;
4478
4757
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
@@ -4528,6 +4807,33 @@ ${SECTION_CARD_CSS}
4528
4807
  setPredictionMode(nextMode);
4529
4808
  }
4530
4809
  })]
4810
+ }),
4811
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4812
+ className: "dcu-settings-row",
4813
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4814
+ className: "dcu-settings-row-label",
4815
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
4816
+ className: "dcu-settings-row-title",
4817
+ children: t("composer.historyScope")
4818
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
4819
+ className: "dcu-settings-row-hint",
4820
+ children: t("composer.historyScopeHint")
4821
+ })]
4822
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.SegmentedControl, {
4823
+ id: "codex-ui-composer-history-scope",
4824
+ label: t("composer.historyScope"),
4825
+ value: historyScope,
4826
+ options: [{
4827
+ value: "session",
4828
+ label: t("composer.historyScopeSession")
4829
+ }, {
4830
+ value: "workspace",
4831
+ label: t("composer.historyScopeWorkspace")
4832
+ }],
4833
+ onChange: (nextScope) => {
4834
+ setHistoryScope(nextScope);
4835
+ }
4836
+ })]
4531
4837
  })
4532
4838
  ]
4533
4839
  });
@@ -5150,13 +5456,17 @@ html[data-dsh-glass] body:not([data-ds-dark-theme]) .dcu-section-card{background
5150
5456
  "about.updateAvailable": "更新可能",
5151
5457
  "about.updatingAll": "インストール/更新中",
5152
5458
  "about.viewProject": "GitHub",
5153
- "composer.desc": "インライン入力予測と入力補完。その他の機能(↑/↓ 履歴、幅調整)には影響しません。",
5459
+ "composer.desc": "インライン入力予測と履歴(↑/↓)の呼び出し範囲を設定します。幅調整ハンドルなどの機能は引き続き利用できます。",
5154
5460
  "composer.prediction": "スマート入力予測",
5155
5461
  "composer.predictionHint": "無効、入力停止時の続きのみ、または予測+続きの両方。Tab で採用。",
5156
5462
  "composer.predictionLocked": "現在のプロファイルのプラグイン設定で無効化されています(cordis.patch.yml → codex-ui-composer の prediction)。ここでは有効にできません。",
5157
5463
  "composer.modeOff": "オフ",
5158
5464
  "composer.modeContinue": "続きのみ",
5159
5465
  "composer.modeAll": "予測+続き",
5466
+ "composer.historyScope": "履歴の呼び出し範囲",
5467
+ "composer.historyScopeHint": "現在の会話のみ、または同じワークスペースのすべての会話と共有します。",
5468
+ "composer.historyScopeSession": "現在の会話",
5469
+ "composer.historyScopeWorkspace": "ワークスペース",
5160
5470
  "composer.title": "入力欄の拡張",
5161
5471
  "desktopMenu.help": "ヘルプ",
5162
5472
  "desktopMenu.help.reloadPage": "ページを再読み込み",
@@ -5213,6 +5523,7 @@ html[data-dsh-glass] body:not([data-ds-dark-theme]) .dcu-section-card{background
5213
5523
  "sections.pin": "ピン留め",
5214
5524
  "sections.pinned": "ピン留め",
5215
5525
  "sections.remove": "セクションを削除",
5526
+ "sections.addWorkspace": "ワークスペースを追加",
5216
5527
  "sections.rename": "名前を変更",
5217
5528
  "sections.settings": "セクション設定",
5218
5529
  "sections.unpin": "ピン留めを解除",
@@ -5260,6 +5571,7 @@ html[data-dsh-glass] body:not([data-ds-dark-theme]) .dcu-section-card{background
5260
5571
  "theme.paletteClaudeLight": "Claude ライト",
5261
5572
  "theme.paletteCodexDark": "Codex ダーク",
5262
5573
  "theme.paletteCodexLight": "Codex ライト",
5574
+ "theme.paletteCyberpunk": "Cyberpunk (サイバーパンク)",
5263
5575
  "theme.paletteDracula": "Dracula (ドラキュラ)",
5264
5576
  "theme.paletteFrappe": "Frappé (フラッペ)",
5265
5577
  "theme.paletteGruvboxDark": "Gruvbox ダーク",
@@ -5279,6 +5591,7 @@ html[data-dsh-glass] body:not([data-ds-dark-theme]) .dcu-section-card{background
5279
5591
  "theme.subClaudeLight": "温かみのある和紙感とテラコッタ",
5280
5592
  "theme.subCodexDark": "没入型カーボンダーク ギークな質感",
5281
5593
  "theme.subCodexLight": "ミニマルペーパーホワイト 快適な読書",
5594
+ "theme.subCyberpunk": "黒地にネオングリーン · マトリックス端末",
5282
5595
  "theme.subDracula": "吸血鬼ピンクとサイバーネオン",
5283
5596
  "theme.subFrappe": "フラッペダーク 透明感のあるミスト",
5284
5597
  "theme.subGruvboxDark": "泥炭深茶と暖金レトロ",
@@ -5366,13 +5679,17 @@ html[data-dsh-glass] body:not([data-ds-dark-theme]) .dcu-section-card{background
5366
5679
  "about.updateAvailable": "Actualización disponible",
5367
5680
  "about.updatingAll": "Instalando/actualizando",
5368
5681
  "about.viewProject": "GitHub",
5369
- "composer.desc": "Predicción inteligente y continuación en línea; otras funciones (historial ↑/↓, ajuste de ancho) no se ven afectadas.",
5682
+ "composer.desc": "Configura la predicción en línea y el alcance del historial (↑/↓); otras funciones como el ajuste de ancho siguen activas.",
5370
5683
  "composer.prediction": "Predicción de entrada en línea",
5371
5684
  "composer.predictionHint": "Desactivado, solo continuación al pausar escritura, o ambos; pulse Tab para aceptar.",
5372
5685
  "composer.predictionLocked": "Deshabilitado por la configuración del perfil (cordis.patch.yml → codex-ui-composer prediction); no se puede habilitar aquí.",
5373
5686
  "composer.modeOff": "Desactivado",
5374
5687
  "composer.modeContinue": "Solo continuación",
5375
5688
  "composer.modeAll": "Predicción y continuación",
5689
+ "composer.historyScope": "Alcance del historial",
5690
+ "composer.historyScopeHint": "Recupera mensajes solo de esta conversación o compártelos con todas las conversaciones del espacio de trabajo.",
5691
+ "composer.historyScopeSession": "Esta conversación",
5692
+ "composer.historyScopeWorkspace": "Espacio de trabajo",
5376
5693
  "composer.title": "Mejoras de entrada",
5377
5694
  "desktopMenu.help": "Ayuda",
5378
5695
  "desktopMenu.help.reloadPage": "Recargar página",
@@ -5429,6 +5746,7 @@ html[data-dsh-glass] body:not([data-ds-dark-theme]) .dcu-section-card{background
5429
5746
  "sections.pin": "Fijar",
5430
5747
  "sections.pinned": "Fijados",
5431
5748
  "sections.remove": "Eliminar sección",
5749
+ "sections.addWorkspace": "Agregar espacio de trabajo",
5432
5750
  "sections.rename": "Renombrar",
5433
5751
  "sections.settings": "Ajustes de sección",
5434
5752
  "sections.unpin": "Desfijar",
@@ -5476,6 +5794,7 @@ html[data-dsh-glass] body:not([data-ds-dark-theme]) .dcu-section-card{background
5476
5794
  "theme.paletteClaudeLight": "Claude Claro",
5477
5795
  "theme.paletteCodexDark": "Codex Oscuro",
5478
5796
  "theme.paletteCodexLight": "Codex Claro",
5797
+ "theme.paletteCyberpunk": "Cyberpunk",
5479
5798
  "theme.paletteDracula": "Dracula",
5480
5799
  "theme.paletteFrappe": "Frappé",
5481
5800
  "theme.paletteGruvboxDark": "Gruvbox Oscuro",
@@ -5495,6 +5814,7 @@ html[data-dsh-glass] body:not([data-ds-dark-theme]) .dcu-section-card{background
5495
5814
  "theme.subClaudeLight": "Papel cálido y terracota",
5496
5815
  "theme.subCodexDark": "Negro inmersivo Estilo hacker",
5497
5816
  "theme.subCodexLight": "Blanco papel limpio Lectura pura",
5817
+ "theme.subCyberpunk": "Verde neón sobre negro · terminal matrix",
5498
5818
  "theme.subDracula": "Rosa vampiro y brillo ciber",
5499
5819
  "theme.subFrappe": "Frappé oscuro Efecto niebla translúcida",
5500
5820
  "theme.subGruvboxDark": "Oscuro retro y oro cálido",
@@ -5582,13 +5902,17 @@ html[data-dsh-glass] body:not([data-ds-dark-theme]) .dcu-section-card{background
5582
5902
  "about.updateAvailable": "Mise à jour disponible",
5583
5903
  "about.updatingAll": "Installation/mise à jour",
5584
5904
  "about.viewProject": "GitHub",
5585
- "composer.desc": "Prédiction et complétion en ligne ; les autres fonctionnalités (historique ↑/↓, poignées de largeur) restent inchangées.",
5905
+ "composer.desc": "Configurez la prédiction en ligne et la portée de l'historique (↑/↓) ; les autres fonctions comme les poignées de largeur restent actives.",
5586
5906
  "composer.prediction": "Prédiction de saisie en ligne",
5587
5907
  "composer.predictionHint": "Désactivé, continuation seule lors d'une pause de frappe, ou les deux ; Tab pour accepter.",
5588
5908
  "composer.predictionLocked": "Désactivé dans la configuration du profil (cordis.patch.yml → codex-ui-composer prediction) ; ne peut pas être activé ici.",
5589
5909
  "composer.modeOff": "Désactivé",
5590
5910
  "composer.modeContinue": "Continuer seulement",
5591
5911
  "composer.modeAll": "Prédiction et continuation",
5912
+ "composer.historyScope": "Portée de l'historique",
5913
+ "composer.historyScopeHint": "Rappelez les messages de cette conversation uniquement, ou partagez-les avec toutes les conversations de l'espace de travail.",
5914
+ "composer.historyScopeSession": "Cette conversation",
5915
+ "composer.historyScopeWorkspace": "Espace de travail",
5592
5916
  "composer.title": "Améliorations de saisie",
5593
5917
  "desktopMenu.help": "Aide",
5594
5918
  "desktopMenu.help.reloadPage": "Recharger la page",
@@ -5645,6 +5969,7 @@ html[data-dsh-glass] body:not([data-ds-dark-theme]) .dcu-section-card{background
5645
5969
  "sections.pin": "Épingler",
5646
5970
  "sections.pinned": "Épinglés",
5647
5971
  "sections.remove": "Supprimer la section",
5972
+ "sections.addWorkspace": "Ajouter un espace de travail",
5648
5973
  "sections.rename": "Renommer",
5649
5974
  "sections.settings": "Paramètres de section",
5650
5975
  "sections.unpin": "Détacher",
@@ -5692,6 +6017,7 @@ html[data-dsh-glass] body:not([data-ds-dark-theme]) .dcu-section-card{background
5692
6017
  "theme.paletteClaudeLight": "Claude Clair",
5693
6018
  "theme.paletteCodexDark": "Codex Sombre",
5694
6019
  "theme.paletteCodexLight": "Codex Clair",
6020
+ "theme.paletteCyberpunk": "Cyberpunk",
5695
6021
  "theme.paletteDracula": "Dracula",
5696
6022
  "theme.paletteFrappe": "Frappé",
5697
6023
  "theme.paletteGruvboxDark": "Gruvbox Sombre",
@@ -5711,6 +6037,7 @@ html[data-dsh-glass] body:not([data-ds-dark-theme]) .dcu-section-card{background
5711
6037
  "theme.subClaudeLight": "Papier chaud et terre cuite",
5712
6038
  "theme.subCodexDark": "Noir immersif Texture épurée",
5713
6039
  "theme.subCodexLight": "Blanc papier Lecture agréable",
6040
+ "theme.subCyberpunk": "Vert néon sur noir · terminal Matrix",
5714
6041
  "theme.subDracula": "Rose vampire et lueur cyber",
5715
6042
  "theme.subFrappe": "Frappé sombre Brume translucide",
5716
6043
  "theme.subGruvboxDark": "Rétro sombre et or chaud",
@@ -5798,13 +6125,17 @@ html[data-dsh-glass] body:not([data-ds-dark-theme]) .dcu-section-card{background
5798
6125
  "about.updateAvailable": "Update verfügbar",
5799
6126
  "about.updatingAll": "Wird installiert/aktualisiert",
5800
6127
  "about.viewProject": "GitHub",
5801
- "composer.desc": "Inline-Vorhersage und Textvervollständigung; andere Funktionen (↑/↓ Verlauf, Breitenanpassung) bleiben unberührt.",
6128
+ "composer.desc": "Inline-Vorhersage und Verlaufsbereich (↑/↓) konfigurieren; weitere Funktionen wie die Breitenanpassung bleiben aktiv.",
5802
6129
  "composer.prediction": "Intelligente Eingabevorhersage",
5803
6130
  "composer.predictionHint": "Aus, nur Fortsetzung bei Tipppausen oder beides; mit Tab übernehmen.",
5804
6131
  "composer.predictionLocked": "In der Profilkonfiguration deaktiviert (cordis.patch.yml → codex-ui-composer prediction); kann hier nicht aktiviert werden.",
5805
6132
  "composer.modeOff": "Aus",
5806
6133
  "composer.modeContinue": "Nur Fortsetzung",
5807
6134
  "composer.modeAll": "Vorhersage & Fortsetzung",
6135
+ "composer.historyScope": "Verlaufsbereich",
6136
+ "composer.historyScopeHint": "Erinnerte Eingaben nur aus dieser Unterhaltung oder gemeinsam mit allen Unterhaltungen im Arbeitsbereich.",
6137
+ "composer.historyScopeSession": "Diese Unterhaltung",
6138
+ "composer.historyScopeWorkspace": "Arbeitsbereich",
5808
6139
  "composer.title": "Eingabe-Erweiterungen",
5809
6140
  "desktopMenu.help": "Hilfe",
5810
6141
  "desktopMenu.help.reloadPage": "Seite neu laden",
@@ -5861,6 +6192,7 @@ html[data-dsh-glass] body:not([data-ds-dark-theme]) .dcu-section-card{background
5861
6192
  "sections.pin": "Anheften",
5862
6193
  "sections.pinned": "Angeheftet",
5863
6194
  "sections.remove": "Bereich entfernen",
6195
+ "sections.addWorkspace": "Arbeitsbereich hinzufügen",
5864
6196
  "sections.rename": "Umbenennen",
5865
6197
  "sections.settings": "Bereichseinstellungen",
5866
6198
  "sections.unpin": "Lösen",
@@ -5908,6 +6240,7 @@ html[data-dsh-glass] body:not([data-ds-dark-theme]) .dcu-section-card{background
5908
6240
  "theme.paletteClaudeLight": "Claude Hell",
5909
6241
  "theme.paletteCodexDark": "Codex Dunkel",
5910
6242
  "theme.paletteCodexLight": "Codex Hell",
6243
+ "theme.paletteCyberpunk": "Cyberpunk",
5911
6244
  "theme.paletteDracula": "Dracula",
5912
6245
  "theme.paletteFrappe": "Frappé",
5913
6246
  "theme.paletteGruvboxDark": "Gruvbox Dunkel",
@@ -5927,6 +6260,7 @@ html[data-dsh-glass] body:not([data-ds-dark-theme]) .dcu-section-card{background
5927
6260
  "theme.subClaudeLight": "Warmes Papier & Terrakotta",
5928
6261
  "theme.subCodexDark": "Immersives Anthrazit Puristischer Stil",
5929
6262
  "theme.subCodexLight": "Klares Papierweiß Angenehmes Lesen",
6263
+ "theme.subCyberpunk": "Neongrün auf Schwarz · Matrix-Terminal",
5930
6264
  "theme.subDracula": "Vampir-Pink & Cyber-Glow",
5931
6265
  "theme.subFrappe": "Dunkles Frappé Nebelig-transparent",
5932
6266
  "theme.subGruvboxDark": "Retro-Dunkel & Warmgold",
@@ -6014,13 +6348,17 @@ html[data-dsh-glass] body:not([data-ds-dark-theme]) .dcu-section-card{background
6014
6348
  "about.updateAvailable": "Доступно обновление",
6015
6349
  "about.updatingAll": "Установка/обновление",
6016
6350
  "about.viewProject": "GitHub",
6017
- "composer.desc": "Умное предсказание ввода и автодополнение; другие функции (история ↑/↓, изменение ширины) не затрагиваются.",
6351
+ "composer.desc": "Настройте умное предсказание ввода и область истории (↑/↓); остальные функции, включая изменение ширины, остаются активными.",
6018
6352
  "composer.prediction": "Интеллектуальное предсказание ввода",
6019
6353
  "composer.predictionHint": "Отключено, только автодополнение при паузе, или оба варианта; Tab для принятия.",
6020
6354
  "composer.predictionLocked": "Отключено в настройках профиля (cordis.patch.yml → codex-ui-composer prediction); здесь включить невозможно.",
6021
6355
  "composer.modeOff": "Выкл",
6022
6356
  "composer.modeContinue": "Только продолжение",
6023
6357
  "composer.modeAll": "Предсказание и продолжение",
6358
+ "composer.historyScope": "Область истории",
6359
+ "composer.historyScopeHint": "Показывать введённые сообщения только этого диалога или всех диалогов рабочей области.",
6360
+ "composer.historyScopeSession": "Этот диалог",
6361
+ "composer.historyScopeWorkspace": "Рабочая область",
6024
6362
  "composer.title": "Улучшения поля ввода",
6025
6363
  "desktopMenu.help": "Справка",
6026
6364
  "desktopMenu.help.reloadPage": "Перезагрузить страницу",
@@ -6077,6 +6415,7 @@ html[data-dsh-glass] body:not([data-ds-dark-theme]) .dcu-section-card{background
6077
6415
  "sections.pin": "Закрепить",
6078
6416
  "sections.pinned": "Закрепленные",
6079
6417
  "sections.remove": "Удалить секцию",
6418
+ "sections.addWorkspace": "Добавить рабочую область",
6080
6419
  "sections.rename": "Переименовать",
6081
6420
  "sections.settings": "Настройки секции",
6082
6421
  "sections.unpin": "Открепить",
@@ -6124,6 +6463,7 @@ html[data-dsh-glass] body:not([data-ds-dark-theme]) .dcu-section-card{background
6124
6463
  "theme.paletteClaudeLight": "Claude Светлая",
6125
6464
  "theme.paletteCodexDark": "Codex Темная",
6126
6465
  "theme.paletteCodexLight": "Codex Светлая",
6466
+ "theme.paletteCyberpunk": "Cyberpunk",
6127
6467
  "theme.paletteDracula": "Dracula",
6128
6468
  "theme.paletteFrappe": "Frappé",
6129
6469
  "theme.paletteGruvboxDark": "Gruvbox Темная",
@@ -6143,6 +6483,7 @@ html[data-dsh-glass] body:not([data-ds-dark-theme]) .dcu-section-card{background
6143
6483
  "theme.subClaudeLight": "Теплая бумага и терракотовый",
6144
6484
  "theme.subCodexDark": "Глубокий угольный Минимализм",
6145
6485
  "theme.subCodexLight": "Чистый бумажный Комфортное чтение",
6486
+ "theme.subCyberpunk": "Неоновый зеленый на черном · терминал матрицы",
6146
6487
  "theme.subDracula": "Вампирский розовый и кибер-свечение",
6147
6488
  "theme.subFrappe": "Темный фраппе Полупрозрачный туман",
6148
6489
  "theme.subGruvboxDark": "Ретро-темный и теплое золото",
@@ -6230,13 +6571,17 @@ html[data-dsh-glass] body:not([data-ds-dark-theme]) .dcu-section-card{background
6230
6571
  "about.updateAvailable": "Atualização disponível",
6231
6572
  "about.updatingAll": "Instalando/atualizando",
6232
6573
  "about.viewProject": "GitHub",
6233
- "composer.desc": "Previsão de entrada e continuação em linha; outros recursos (histórico ↑/↓, ajuste de largura) não são afetados.",
6574
+ "composer.desc": "Configure a previsão em linha e o escopo do histórico (↑/↓); outros recursos como o ajuste de largura continuam ativos.",
6234
6575
  "composer.prediction": "Previsão de entrada em linha",
6235
6576
  "composer.predictionHint": "Desativado, apenas continuação ao pausar, ou ambos; pressione Tab para aceitar.",
6236
6577
  "composer.predictionLocked": "Desativado pela configuração do perfil (cordis.patch.yml → codex-ui-composer prediction); não pode ser ativado aqui.",
6237
6578
  "composer.modeOff": "Desativado",
6238
6579
  "composer.modeContinue": "Apenas continuação",
6239
6580
  "composer.modeAll": "Previsão e continuação",
6581
+ "composer.historyScope": "Escopo do histórico",
6582
+ "composer.historyScopeHint": "Recupere mensagens apenas desta conversa ou compartilhe com todas as conversas do espaço de trabalho.",
6583
+ "composer.historyScopeSession": "Esta conversa",
6584
+ "composer.historyScopeWorkspace": "Espaço de trabalho",
6240
6585
  "composer.title": "Aprimoramentos de entrada",
6241
6586
  "desktopMenu.help": "Ajuda",
6242
6587
  "desktopMenu.help.reloadPage": "Recarregar página",
@@ -6293,6 +6638,7 @@ html[data-dsh-glass] body:not([data-ds-dark-theme]) .dcu-section-card{background
6293
6638
  "sections.pin": "Fixar",
6294
6639
  "sections.pinned": "Fixados",
6295
6640
  "sections.remove": "Remover seção",
6641
+ "sections.addWorkspace": "Adicionar espaço de trabalho",
6296
6642
  "sections.rename": "Renomear",
6297
6643
  "sections.settings": "Configurações de seção",
6298
6644
  "sections.unpin": "Desafixar",
@@ -6340,6 +6686,7 @@ html[data-dsh-glass] body:not([data-ds-dark-theme]) .dcu-section-card{background
6340
6686
  "theme.paletteClaudeLight": "Claude Claro",
6341
6687
  "theme.paletteCodexDark": "Codex Escuro",
6342
6688
  "theme.paletteCodexLight": "Codex Claro",
6689
+ "theme.paletteCyberpunk": "Cyberpunk",
6343
6690
  "theme.paletteDracula": "Dracula",
6344
6691
  "theme.paletteFrappe": "Frappé",
6345
6692
  "theme.paletteGruvboxDark": "Gruvbox Escuro",
@@ -6359,6 +6706,7 @@ html[data-dsh-glass] body:not([data-ds-dark-theme]) .dcu-section-card{background
6359
6706
  "theme.subClaudeLight": "Papel quente e terracota",
6360
6707
  "theme.subCodexDark": "Carvão imersivo Visual hacker",
6361
6708
  "theme.subCodexLight": "Branco papelLeitura pura",
6709
+ "theme.subCyberpunk": "Verde neon no preto · terminal matrix",
6362
6710
  "theme.subDracula": "Rosa vampiro e brilho ciber",
6363
6711
  "theme.subFrappe": "Frappé escuro Névoa translúcida",
6364
6712
  "theme.subGruvboxDark": "Escuro retrô e ouro quente",
@@ -6420,6 +6768,7 @@ html[data-dsh-glass] body:not([data-ds-dark-theme]) .dcu-section-card{background
6420
6768
  "sections.unpin": "取消置顶",
6421
6769
  "sections.rename": "重命名",
6422
6770
  "sections.remove": "移除分区",
6771
+ "sections.addWorkspace": "添加工作区",
6423
6772
  "sections.writePending": "工作区移动尚未完成,后续操作正在等待宿主响应。",
6424
6773
  "sections.writeAborted": "工作区移动未完成,已自动撤销。",
6425
6774
  "sections.new": "新建分区",
@@ -6535,13 +6884,17 @@ html[data-dsh-glass] body:not([data-ds-dark-theme]) .dcu-section-card{background
6535
6884
  "sidebar.createPlugin": "创建你的插件",
6536
6885
  "sidebar.createPrompt": "创建一个带左侧栏入口的 DSH 插件。",
6537
6886
  "composer.title": "输入框增强",
6538
- "composer.desc": "智能输入预测与行内续写;其他输入框能力(↑/↓ 历史、宽度手柄)不受影响。",
6887
+ "composer.desc": "智能输入预测与 ↑/↓ 历史召回范围设置;输入框宽度手柄等能力保持常驻。",
6539
6888
  "composer.prediction": "智能输入预测",
6540
6889
  "composer.predictionHint": "关闭、仅打字停顿续写、或同时启用空框推测与续写;按 Tab 采纳。",
6541
6890
  "composer.predictionLocked": "已在当前 Profile 的插件配置中关闭(cordis.patch.yml → codex-ui-composer 的 prediction),此处不可开启。",
6542
6891
  "composer.modeOff": "关闭",
6543
6892
  "composer.modeContinue": "仅续写",
6544
6893
  "composer.modeAll": "推测+续写",
6894
+ "composer.historyScope": "历史召回范围",
6895
+ "composer.historyScopeHint": "仅在当前会话内召回,或与同一工作区的所有会话共享。",
6896
+ "composer.historyScopeSession": "当前会话",
6897
+ "composer.historyScopeWorkspace": "当前工作区",
6545
6898
  "theme.title": "界面外观与换肤",
6546
6899
  "theme.desc": "定制 DeepSeek Harness 视觉风格,支持 Codex 经典配色与悬浮云母质感。",
6547
6900
  "theme.palette": "主题配色",
@@ -6561,6 +6914,7 @@ html[data-dsh-glass] body:not([data-ds-dark-theme]) .dcu-section-card{background
6561
6914
  "theme.paletteMacchiato": "Macchiato (玛奇朵)",
6562
6915
  "theme.paletteFrappe": "Frappé (冰吸)",
6563
6916
  "theme.paletteLatte": "Latte (拿铁)",
6917
+ "theme.paletteCyberpunk": "Cyberpunk (赛博朋克)",
6564
6918
  "theme.subStock": "跟随系统 原生界面",
6565
6919
  "theme.subCodexDark": "沉浸炭黑 极客质感",
6566
6920
  "theme.subCodexLight": "极简纸白 纯净阅读",
@@ -6575,6 +6929,7 @@ html[data-dsh-glass] body:not([data-ds-dark-theme]) .dcu-section-card{background
6575
6929
  "theme.subMacchiato": "玛奇朵暗色 典雅柔和",
6576
6930
  "theme.subFrappe": "冰吸暗色 雾感通透",
6577
6931
  "theme.subLatte": "拿铁暖白 温润明快",
6932
+ "theme.subCyberpunk": "黑底霓虹绿 矩阵终端",
6578
6933
  "theme.mode": "排版模式",
6579
6934
  "theme.modeHint": "云母效果重塑为悬浮磨砂卡片;原版排版保持官方布局换用玻璃材质",
6580
6935
  "theme.modeMica": "云母效果 (悬浮卡片)",
@@ -6634,6 +6989,7 @@ html[data-dsh-glass] body:not([data-ds-dark-theme]) .dcu-section-card{background
6634
6989
  "sections.unpin": "Unpin",
6635
6990
  "sections.rename": "Rename",
6636
6991
  "sections.remove": "Remove section",
6992
+ "sections.addWorkspace": "Add workspace",
6637
6993
  "sections.writePending": "Workspace move is still pending host response.",
6638
6994
  "sections.writeAborted": "Workspace move was not completed and was aborted.",
6639
6995
  "sections.new": "New section",
@@ -6749,13 +7105,17 @@ html[data-dsh-glass] body:not([data-ds-dark-theme]) .dcu-section-card{background
6749
7105
  "sidebar.createPlugin": "Create your plugin",
6750
7106
  "sidebar.createPrompt": "Create a DSH plugin with a left sidebar entry.",
6751
7107
  "composer.title": "Composer Enhancements",
6752
- "composer.desc": "Inline prediction and continuation for the composer; other composer features (↑/↓ history, width handles) are unaffected.",
7108
+ "composer.desc": "Configure inline prediction and ↑/↓ history scope; other composer features like width handles remain active.",
6753
7109
  "composer.prediction": "Inline prediction",
6754
7110
  "composer.predictionHint": "Off, typing pause continuation only, or both prediction and continuation; press Tab to accept.",
6755
7111
  "composer.predictionLocked": "Disabled by this Profile's plugin config (cordis.patch.yml → codex-ui-composer prediction); it cannot be enabled here.",
6756
7112
  "composer.modeOff": "Off",
6757
7113
  "composer.modeContinue": "Continuation only",
6758
7114
  "composer.modeAll": "Prediction & continuation",
7115
+ "composer.historyScope": "History scope",
7116
+ "composer.historyScopeHint": "Recall prompts from this conversation only, or share them across every conversation in the workspace.",
7117
+ "composer.historyScopeSession": "This conversation",
7118
+ "composer.historyScopeWorkspace": "Workspace",
6759
7119
  "theme.title": "Appearance & Themes",
6760
7120
  "theme.desc": "Customize DeepSeek Harness visual styling with Codex themes and frosted mica glass.",
6761
7121
  "theme.palette": "Theme Palette",
@@ -6775,6 +7135,7 @@ html[data-dsh-glass] body:not([data-ds-dark-theme]) .dcu-section-card{background
6775
7135
  "theme.paletteMacchiato": "Macchiato",
6776
7136
  "theme.paletteFrappe": "Frappé",
6777
7137
  "theme.paletteLatte": "Latte",
7138
+ "theme.paletteCyberpunk": "Cyberpunk",
6778
7139
  "theme.subStock": "System default",
6779
7140
  "theme.subCodexDark": "Immersive carbon dark",
6780
7141
  "theme.subCodexLight": "Clean paper light",
@@ -6789,6 +7150,7 @@ html[data-dsh-glass] body:not([data-ds-dark-theme]) .dcu-section-card{background
6789
7150
  "theme.subMacchiato": "Macchiato soft tone",
6790
7151
  "theme.subFrappe": "Frappé cool mist",
6791
7152
  "theme.subLatte": "Latte warm light",
7153
+ "theme.subCyberpunk": "Neon green on black · matrix terminal",
6792
7154
  "theme.mode": "Layout Mode",
6793
7155
  "theme.modeHint": "Mica restyles the UI into floating frosted cards; Compatibility keeps the stock layout with glass material",
6794
7156
  "theme.modeMica": "Mica Cards",
@@ -9289,6 +9651,8 @@ html[data-dsh-glass-float] [data-shortcut-modal="settings"][data-sidebar-collaps
9289
9651
  const HISTORY_KEY = "michengai.codex-ui.input-history.v1";
9290
9652
  const LEGACY_HISTORY_KEY = "michengai.btw.history.v1";
9291
9653
  const MAX_STORAGE_LENGTH = 1e6;
9654
+ /** 最多保留多少个作用域;会话级模式下即最近有输入的 100 个会话。 */
9655
+ const MAX_SCOPES = 100;
9292
9656
  /** 只保存已发送文本;浏览器存储失败时仍保留本次内存历史。 */
9293
9657
  var InputHistory = class {
9294
9658
  storage;
@@ -9306,7 +9670,7 @@ html[data-dsh-glass-float] [data-shortcut-modal="settings"][data-sidebar-collaps
9306
9670
  if (raw.length > MAX_STORAGE_LENGTH) throw new Error("历史数据过大");
9307
9671
  const data = JSON.parse(raw);
9308
9672
  if (typeof data !== "object" || data === null || Array.isArray(data)) throw new Error("历史格式无效");
9309
- for (const [key, value] of Object.entries(data).slice(-20)) if (Array.isArray(value)) this.scopes.set(key, value.filter((item) => typeof item === "string" && item.length <= 8e3).slice(-limit));
9673
+ for (const [key, value] of Object.entries(data).slice(-100)) if (Array.isArray(value)) this.scopes.set(key, value.filter((item) => typeof item === "string" && item.length <= 8e3).slice(-limit));
9310
9674
  if (current === null || current === void 0) storage?.setItem(HISTORY_KEY, JSON.stringify(Object.fromEntries(this.scopes)));
9311
9675
  } catch {
9312
9676
  warn("输入历史读取失败,本次使用内存历史。");
@@ -9321,7 +9685,7 @@ html[data-dsh-glass-float] [data-shortcut-modal="settings"][data-sidebar-collaps
9321
9685
  if (previous.at(-1) === text) return;
9322
9686
  this.scopes.delete(scope);
9323
9687
  this.scopes.set(scope, [...previous, text].slice(-this.limit));
9324
- while (this.scopes.size > 20) this.scopes.delete(this.scopes.keys().next().value);
9688
+ while (this.scopes.size > MAX_SCOPES) this.scopes.delete(this.scopes.keys().next().value);
9325
9689
  let serialized = JSON.stringify(Object.fromEntries(this.scopes));
9326
9690
  while (serialized.length > MAX_STORAGE_LENGTH && this.scopes.size) {
9327
9691
  const oldest = this.scopes.keys().next().value;
@@ -9461,10 +9825,11 @@ html[data-dsh-glass-float] [data-shortcut-modal="settings"][data-sidebar-collaps
9461
9825
  /** 隐形输入扩展:使用宿主状态和编辑动作,不替换编辑器或创建旁问界面。 */
9462
9826
  function InputHistoryDock({ ctx, sessionId, history, seen }) {
9463
9827
  const anchor = (0, react.useRef)(null);
9828
+ const scopeMode = (0, react.useSyncExternalStore)(subscribeHistoryScope, getHistoryScope, getHistoryScope);
9464
9829
  (0, react.useEffect)(() => {
9465
9830
  const binding = ctx.sessions.binding(sessionId);
9466
9831
  if (binding === void 0) return;
9467
- const scope = ctx.sessions.list.getSnapshot().byId[sessionId]?.cwd ?? sessionId;
9832
+ const scope = scopeMode === "workspace" ? ctx.sessions.list.getSnapshot().byId[sessionId]?.cwd ?? sessionId : sessionId;
9468
9833
  const input = ctx.conversation.input.for(binding.ctx);
9469
9834
  const menu = ctx.inputTriggers.sessionOf(binding.ctx).menu;
9470
9835
  seen.set(binding, binding.eventSource.getSnapshot().revision);
@@ -9521,7 +9886,8 @@ html[data-dsh-glass-float] [data-shortcut-modal="settings"][data-sidebar-collaps
9521
9886
  ctx,
9522
9887
  sessionId,
9523
9888
  history,
9524
- seen
9889
+ seen,
9890
+ scopeMode
9525
9891
  ]);
9526
9892
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
9527
9893
  ref: anchor,
@@ -9537,6 +9903,7 @@ html[data-dsh-glass-float] [data-shortcut-modal="settings"][data-sidebar-collaps
9537
9903
  }
9538
9904
  const history = new InputHistory(storage);
9539
9905
  const seen = /* @__PURE__ */ new WeakMap();
9906
+ const stopScope = observeHistoryScope();
9540
9907
  function Dock(props) {
9541
9908
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(InputHistoryDock, {
9542
9909
  ctx,
@@ -9557,6 +9924,7 @@ html[data-dsh-glass-float] [data-shortcut-modal="settings"][data-sidebar-collaps
9557
9924
  locale: NS
9558
9925
  }, InputHistoryHint));
9559
9926
  return () => {
9927
+ stopScope();
9560
9928
  unregisterDock();
9561
9929
  unregisterHint();
9562
9930
  };
@@ -12183,12 +12551,12 @@ html[data-dsh-glass-float] [data-shortcut-modal="settings"][data-sidebar-collaps
12183
12551
  * @param order - 宿主当前的完整工作区顺序。
12184
12552
  * @returns 校正后的结构与是否发生变化。
12185
12553
  */
12186
- function reconcileHostOrder(state, order) {
12554
+ function reconcileHostOrder(state, order, fallbackSectionId = DEFAULT_SECTION_ID) {
12187
12555
  const assignments = /* @__PURE__ */ new Map();
12188
12556
  for (const section of state.sections) for (const id of section.ids) assignments.set(id, section.id);
12189
12557
  let added = false;
12190
12558
  for (const id of order) if (!assignments.has(id)) {
12191
- assignments.set(id, DEFAULT_SECTION_ID);
12559
+ assignments.set(id, fallbackSectionId);
12192
12560
  added = true;
12193
12561
  }
12194
12562
  const sections = state.sections.map((section) => {
@@ -12402,11 +12770,14 @@ html[data-dsh-glass-float] [data-shortcut-modal="settings"][data-sidebar-collaps
12402
12770
  /* 分区成员不加缩进:项目行以下全是宿主自己的排版(会话行、缩进变量都在里面),
12403
12771
  这里再补 padding 会把整个项目块连同会话一起右移,跟原生不一致。成员标记只用于折叠隐藏。 */
12404
12772
  [data-dcu-section-member]{transition:max-height 180ms var(--ds-ease-in-out,cubic-bezier(.2,0,0,1)),opacity 180ms var(--ds-ease-in-out,cubic-bezier(.2,0,0,1))}
12405
- [data-dcu-section-hidden='true']{display:none !important}
12406
- .dcu-ws-section-actions{display:flex;gap:2px;opacity:.55;transition:opacity .12s ease;flex:none}
12407
- .dcu-ws-section:hover .dcu-ws-section-actions,.dcu-ws-section:focus-within .dcu-ws-section-actions{opacity:1}
12408
- .dcu-ws-section-action{width:22px;height:22px;border:0;border-radius:50%;background:transparent;color:inherit;font:inherit;font-size:12px;line-height:1;cursor:pointer;display:grid;place-items:center}
12409
- .dcu-ws-section-action:hover{background:var(--dsw-alias-interactive-bg-hover,rgba(127,127,127,.16))}
12773
+ [data-dcu-section-hidden='true'],[data-dcu-section-relocating='true']{display:none !important}
12774
+ /* 与宿主行操作区完全一致:按钮自带 margin:-4px,gap:13px 使视觉净间距为 5px;平时隐藏,悬停/聚焦/菜单打开时显现 */
12775
+ .dcu-ws-section-actions{display:none;align-items:center;gap:13px;padding-right:6px;flex:none}
12776
+ @media (hover:hover){.dcu-ws-section:hover .dcu-ws-section-actions{display:inline-flex}}
12777
+ @media (hover:none){.dcu-ws-section-actions{display:inline-flex}}
12778
+ .dcu-ws-section:focus-within .dcu-ws-section-actions,.dcu-ws-section[data-menu-open='true'] .dcu-ws-section-actions{display:inline-flex}
12779
+ .dcu-ws-section-action{width:24px;height:24px;margin:-4px;padding:0;border:0;border-radius:var(--dsw-radius-xs,4px);background:transparent;color:var(--dsw-alias-label-tertiary,inherit);font:inherit;font-size:12px;line-height:1;cursor:pointer;display:inline-flex;align-items:center;justify-content:center}
12780
+ .dcu-ws-section-action:hover{color:var(--dsw-alias-label-primary,inherit);background:var(--dsw-alias-interactive-bg-hover,rgba(127,127,127,.16))}
12410
12781
  [data-sidebar-collapsed='true'] .dcu-ws-section{display:none !important}
12411
12782
  /* z-index 取宿主顶级浮层的量级:分区标题 ··· 这条路径把面板挂在 body 上,宿主侧边栏/工作区树自己是
12412
12783
  更大的层级,1000 会让侧边栏的行文字压在面板上(表现为「菜单跑到侧边栏后面」)。
@@ -12539,6 +12910,104 @@ body[data-dcu-drag-blocked='true'] [class*="dropAfter"]::after{display:none !imp
12539
12910
  let sectionsLoaded = false;
12540
12911
  let list;
12541
12912
  let baselineSet = false;
12913
+ const RELOCATING_ATTR = "data-dcu-section-relocating";
12914
+ const RELOCATING_TIMEOUT_MS = 1500;
12915
+ /** 正在等候异步顺序落地的新建工作区 ID,避免延迟流帧造成置顶/相邻分组闪烁或错位。 */
12916
+ const relocatingIds = /* @__PURE__ */ new Set();
12917
+ let relocatingCleanupTimer;
12918
+ /** 记录上一次稳定布局后各分区标题的 offsetTop,用于与宿主 AnimatedRows 同步补间。 */
12919
+ const lastHeaderOffsets = /* @__PURE__ */ new WeakMap();
12920
+ const syncedHostAnimations = /* @__PURE__ */ new WeakSet();
12921
+ const activeHeaderSyncAnimations = /* @__PURE__ */ new WeakMap();
12922
+ function clearRelocating() {
12923
+ relocatingIds.clear();
12924
+ if (relocatingCleanupTimer !== void 0) {
12925
+ window.clearTimeout(relocatingCleanupTimer);
12926
+ relocatingCleanupTimer = void 0;
12927
+ }
12928
+ for (const node of Array.from(document.querySelectorAll(`[${RELOCATING_ATTR}]`))) node.removeAttribute(RELOCATING_ATTR);
12929
+ }
12930
+ function markRelocating(ids) {
12931
+ for (const id of ids) relocatingIds.add(id);
12932
+ if (relocatingCleanupTimer !== void 0) window.clearTimeout(relocatingCleanupTimer);
12933
+ relocatingCleanupTimer = window.setTimeout(() => {
12934
+ relocatingCleanupTimer = void 0;
12935
+ if (disposed || relocatingIds.size === 0) return;
12936
+ if (list !== void 0) cancelHostRowAnimations(list);
12937
+ clearRelocating();
12938
+ syncNow();
12939
+ }, RELOCATING_TIMEOUT_MS);
12940
+ }
12941
+ function cancelHostRowAnimations(container) {
12942
+ for (const row of Array.from(container.querySelectorAll("[data-row-key]"))) for (const animation of row.getAnimations?.() ?? []) {
12943
+ const effect = animation.effect;
12944
+ if (typeof effect?.getKeyframes === "function" && effect.getKeyframes().some((frame) => frame.transform !== void 0)) animation.cancel();
12945
+ }
12946
+ }
12947
+ function recordHeaderOffsets() {
12948
+ for (const header of headers.values()) {
12949
+ if (!header.isConnected) continue;
12950
+ lastHeaderOffsets.set(header, {
12951
+ parent: header.offsetParent,
12952
+ top: header.offsetTop
12953
+ });
12954
+ }
12955
+ }
12956
+ /**
12957
+ * 宿主展开/收起工作区或新建空白会话时,AnimatedRows 只对 [data-row-key] 行做 200ms 平滑位移;
12958
+ * 若插件分区标题原地瞬移,就会与下方行发生错位/重影碰撞。在绘制前同步补间位移量即可同频共舞。
12959
+ */
12960
+ function syncHeadersWithHostMotion(container) {
12961
+ if (window.matchMedia?.("(prefers-reduced-motion: reduce)").matches) {
12962
+ recordHeaderOffsets();
12963
+ return;
12964
+ }
12965
+ let hasFreshHostMove = false;
12966
+ for (const row of Array.from(container.querySelectorAll("[data-row-key^=\"workspace:\"]"))) for (const animation of row.getAnimations?.() ?? []) {
12967
+ if (syncedHostAnimations.has(animation)) continue;
12968
+ const effect = animation.effect;
12969
+ if (typeof effect?.getKeyframes === "function" && effect.getKeyframes().some((frame) => frame.transform !== void 0)) {
12970
+ syncedHostAnimations.add(animation);
12971
+ hasFreshHostMove = true;
12972
+ }
12973
+ }
12974
+ const moves = [];
12975
+ for (const header of headers.values()) {
12976
+ if (!header.isConnected) continue;
12977
+ const prev = lastHeaderOffsets.get(header);
12978
+ const currParent = header.offsetParent;
12979
+ const currTop = header.offsetTop;
12980
+ if (hasFreshHostMove && prev !== void 0 && prev.parent === currParent && typeof header.animate === "function") {
12981
+ let currentTranslateY = 0;
12982
+ const running = activeHeaderSyncAnimations.get(header);
12983
+ if (running !== void 0 && running.playState === "running") {
12984
+ const transform = window.getComputedStyle(header).transform;
12985
+ if (transform !== "" && transform !== "none" && typeof DOMMatrix === "function") currentTranslateY = new DOMMatrix(transform).m42;
12986
+ }
12987
+ const dy = prev.top + currentTranslateY - currTop;
12988
+ if (Math.abs(dy) >= .5) moves.push({
12989
+ header,
12990
+ dy
12991
+ });
12992
+ }
12993
+ lastHeaderOffsets.set(header, {
12994
+ parent: currParent,
12995
+ top: currTop
12996
+ });
12997
+ }
12998
+ for (const { header, dy } of moves) {
12999
+ activeHeaderSyncAnimations.get(header)?.cancel();
13000
+ const anim = header.animate([{ transform: `translateY(${dy}px)` }, { transform: "translateY(0)" }], {
13001
+ duration: 200,
13002
+ easing: "ease-out"
13003
+ });
13004
+ activeHeaderSyncAnimations.set(header, anim);
13005
+ anim.finished.catch(() => {}).then(() => {
13006
+ if (activeHeaderSyncAnimations.get(header) === anim) activeHeaderSyncAnimations.delete(header);
13007
+ anim.cancel();
13008
+ });
13009
+ }
13010
+ }
12542
13011
  let activeUpdate;
12543
13012
  let writeGen = 0;
12544
13013
  let waitNotice;
@@ -12613,6 +13082,107 @@ body[data-dcu-drag-blocked='true'] [class*="dropAfter"]::after{display:none !imp
12613
13082
  let assignExpanded = false;
12614
13083
  /** 当前二级菜单的锚点(「分区」那一行),悬停重复触发时用来去重。 */
12615
13084
  let assignAnchor;
13085
+ /**
13086
+ * 检查宿主是否已挂载目录选择流能力(`sidebar.workspaces.directoryFlow`)。
13087
+ * 仅当官方 slots 服务就绪且该 slot 被占用时显示分区内「添加工作区」按钮;
13088
+ * slots 缺失或未占用时不渲染无效入口,避免出现只能走兜底快捷键的残缺状态。
13089
+ */
13090
+ const isDirectoryFlowAvailable = () => typeof ctx.slots?.entries === "function" && ctx.slots.entries("sidebar.workspaces.directoryFlow").length > 0;
13091
+ /**
13092
+ * 等待新工作区自动归属的目标分区 ID。
13093
+ * 用户在某个分区的菜单里点击「新建工作区」后暂存,当宿主创建新工作区时自动将其分配到该分区。
13094
+ */
13095
+ let pendingTargetSectionId;
13096
+ let pendingTargetCleanupTimer;
13097
+ let triggeringHostAdd = false;
13098
+ function clearPendingTarget() {
13099
+ pendingTargetSectionId = void 0;
13100
+ if (pendingTargetCleanupTimer !== void 0) {
13101
+ window.clearTimeout(pendingTargetCleanupTimer);
13102
+ pendingTargetCleanupTimer = void 0;
13103
+ }
13104
+ }
13105
+ function schedulePendingTargetCleanup() {
13106
+ if (pendingTargetCleanupTimer !== void 0) window.clearTimeout(pendingTargetCleanupTimer);
13107
+ pendingTargetCleanupTimer = window.setTimeout(() => {
13108
+ pendingTargetCleanupTimer = void 0;
13109
+ pendingTargetSectionId = void 0;
13110
+ }, 9e4);
13111
+ }
13112
+ /**
13113
+ * 宿主顶栏/侧栏头部原生「添加工作区」按钮的 8 门精确文案(同步自宿主 `workspace.add`)。
13114
+ * 仅做精确全等匹配:既能绕开宿主工作区行右键菜单(`工作区“…”的操作`)与带省略号的菜单项(`添加工作区…`),
13115
+ * 又与下方选择器对 `[data-context-menu-trigger]`、`[aria-haspopup="menu"]` 及 `[data-row-key]` 的排除构成双重防护。
13116
+ */
13117
+ const HOST_ADD_WORKSPACE_LABELS = /* @__PURE__ */ new Set([
13118
+ "添加工作区",
13119
+ "Add workspace",
13120
+ "ワークスペースを追加",
13121
+ "Agregar espacio de trabajo",
13122
+ "Ajouter un espace de travail",
13123
+ "Arbeitsbereich hinzufügen",
13124
+ "Добавить рабочую область",
13125
+ "Adicionar espaço de trabalho"
13126
+ ]);
13127
+ function isHostAddWorkspaceButton(btn) {
13128
+ if (btn.hasAttribute("data-dcu-action")) return false;
13129
+ if (btn.hasAttribute("data-context-menu-trigger") || btn.getAttribute("aria-haspopup") === "menu") return false;
13130
+ if (btn.closest("[data-row-key]") !== null) return false;
13131
+ const shortcuts = btn.getAttribute("aria-keyshortcuts") ?? "";
13132
+ if (/\bo\b/i.test(shortcuts) || /(?:^|\+)o$/i.test(shortcuts)) return true;
13133
+ const label = btn.getAttribute("aria-label")?.trim() ?? "";
13134
+ return HOST_ADD_WORKSPACE_LABELS.has(label);
13135
+ }
13136
+ function findHostAddWorkspaceButton() {
13137
+ const candidates = document.querySelectorAll("button:not([data-dcu-action]):not([data-context-menu-trigger]):not([aria-haspopup=\"menu\"])");
13138
+ for (const btn of candidates) if (isHostAddWorkspaceButton(btn)) return btn;
13139
+ return null;
13140
+ }
13141
+ function triggerHostAddWorkspace() {
13142
+ triggeringHostAdd = true;
13143
+ try {
13144
+ const hostAddBtn = findHostAddWorkspaceButton();
13145
+ if (hostAddBtn !== null) {
13146
+ hostAddBtn.click();
13147
+ return;
13148
+ }
13149
+ const isMac = typeof navigator !== "undefined" && /Mac|iPod|iPhone|iPad/.test(navigator.platform);
13150
+ const event = new KeyboardEvent("keydown", {
13151
+ code: "KeyO",
13152
+ key: "o",
13153
+ ctrlKey: !isMac,
13154
+ metaKey: isMac,
13155
+ bubbles: true,
13156
+ cancelable: true
13157
+ });
13158
+ document.dispatchEvent(event);
13159
+ } finally {
13160
+ triggeringHostAdd = false;
13161
+ }
13162
+ }
13163
+ function startAddWorkspaceToSection(sectionId) {
13164
+ pendingTargetSectionId = sectionId;
13165
+ schedulePendingTargetCleanup();
13166
+ triggerHostAddWorkspace();
13167
+ }
13168
+ function onDocumentClickClearPending(event) {
13169
+ if (triggeringHostAdd || pendingTargetSectionId === void 0) return;
13170
+ const target = event.target;
13171
+ if (!(target instanceof Element)) return;
13172
+ if (target.closest(`.${HEADER_CLASS}-actions`) !== null) return;
13173
+ const menuitem = target.closest("[role=\"menuitem\"]");
13174
+ if (menuitem !== null && !menuitem.hasAttribute("data-dcu-action")) {
13175
+ const normalized = (menuitem.textContent ?? "").trim().replace(/[….]+\s*$/, "").trim();
13176
+ if (HOST_ADD_WORKSPACE_LABELS.has(normalized)) clearPendingTarget();
13177
+ return;
13178
+ }
13179
+ const btn = target.closest("button");
13180
+ if (btn !== null && isHostAddWorkspaceButton(btn)) clearPendingTarget();
13181
+ }
13182
+ function onDocumentKeydownClearPending(event) {
13183
+ if (triggeringHostAdd || pendingTargetSectionId === void 0) return;
13184
+ if ((event.ctrlKey || event.metaKey) && !event.altKey && !event.shiftKey && event.code === "KeyO") clearPendingTarget();
13185
+ }
12616
13186
  const workspaces = () => {
12617
13187
  const service = ctx.get?.("workspaces");
12618
13188
  if (service === void 0 || service === null) return void 0;
@@ -12657,22 +13227,32 @@ body[data-dcu-drag-blocked='true'] [class*="dropAfter"]::after{display:none !imp
12657
13227
  commitExplicit(next, []);
12658
13228
  }
12659
13229
  /** 保留显式移动身份;在宿主确认且真实列表到位之前,不提前修改标题和折叠标记。 */
12660
- function commitExplicit(next, workspaceIds) {
13230
+ function commitExplicit(next, workspaceIds, suppressMotion = false) {
12661
13231
  if (disposed) return;
12662
13232
  state = next;
12663
13233
  updates.push({
12664
13234
  next,
12665
13235
  workspaceIds,
12666
- rpcDone: false
13236
+ rpcDone: false,
13237
+ suppressMotion
12667
13238
  });
12668
13239
  startNextUpdate();
12669
13240
  }
13241
+ function syncHeaderAddButton(header, sectionId, name, available) {
13242
+ const actions = header.querySelector(`.${HEADER_CLASS}-actions`);
13243
+ if (actions === null) return;
13244
+ const existing = actions.querySelector("[data-dcu-action=\"add-workspace\"]");
13245
+ if (available) {
13246
+ if (existing === null) actions.appendChild(buildAddWorkspaceActionButton(sectionId, name));
13247
+ } else if (existing !== null) existing.remove();
13248
+ }
12670
13249
  function ensureHeader(sectionId, name) {
13250
+ const displayName = localizeBuiltinName(sectionId, name, text);
12671
13251
  let header = headers.get(sectionId);
12672
13252
  if (header !== void 0 && header.isConnected) {
12673
13253
  const label = header.querySelector(`.${HEADER_CLASS}-label`);
12674
- const next = localizeBuiltinName(sectionId, name, text);
12675
- if (label !== null && label.textContent !== next) label.textContent = next;
13254
+ if (label !== null && label.textContent !== displayName) label.textContent = displayName;
13255
+ syncHeaderAddButton(header, sectionId, displayName, isDirectoryFlowAvailable());
12676
13256
  return header;
12677
13257
  }
12678
13258
  header = document.createElement("div");
@@ -12684,7 +13264,7 @@ body[data-dcu-drag-blocked='true'] [class*="dropAfter"]::after{display:none !imp
12684
13264
  header.dataset.open = collapsed[sectionId] === true ? "false" : "true";
12685
13265
  const label = document.createElement("span");
12686
13266
  label.className = `${HEADER_CLASS}-label`;
12687
- label.textContent = localizeBuiltinName(sectionId, name, text);
13267
+ label.textContent = displayName;
12688
13268
  header.appendChild(label);
12689
13269
  const chevron = document.createElement("span");
12690
13270
  chevron.className = `${HEADER_CLASS}-chevron`;
@@ -12695,8 +13275,9 @@ body[data-dcu-drag-blocked='true'] [class*="dropAfter"]::after{display:none !imp
12695
13275
  header.appendChild(grow);
12696
13276
  const actions = document.createElement("span");
12697
13277
  actions.className = `${HEADER_CLASS}-actions`;
12698
- actions.appendChild(buildHeaderActionButton(sectionId, name));
13278
+ actions.appendChild(buildHeaderActionButton(sectionId, displayName));
12699
13279
  header.appendChild(actions);
13280
+ syncHeaderAddButton(header, sectionId, displayName, isDirectoryFlowAvailable());
12700
13281
  header.addEventListener("click", (event) => {
12701
13282
  if (event.target instanceof Element && event.target.closest(`.${HEADER_CLASS}-actions`) !== null) return;
12702
13283
  toggleSection(sectionId);
@@ -12710,6 +13291,38 @@ body[data-dcu-drag-blocked='true'] [class*="dropAfter"]::after{display:none !imp
12710
13291
  headers.set(sectionId, header);
12711
13292
  return header;
12712
13293
  }
13294
+ /**
13295
+ * 分区标题右侧的「添加工作区」快捷按钮(位于 `···` 右侧):
13296
+ * 复用宿主项目行图标按钮外壳与宿主原生 `IconProjectAddOutlineRegular` 图标。
13297
+ * 置顶、项目和自定义分区均有此按钮。
13298
+ */
13299
+ function buildAddWorkspaceActionButton(sectionId, name) {
13300
+ const hostButton = document.querySelector("[data-row-key^=\"workspace:\"] [class*=\"rowActions\"] button");
13301
+ let button;
13302
+ if (hostButton !== null) {
13303
+ button = hostButton.cloneNode(true);
13304
+ button.removeAttribute("aria-keyshortcuts");
13305
+ button.removeAttribute("tabindex");
13306
+ button.removeAttribute("aria-haspopup");
13307
+ button.removeAttribute("aria-expanded");
13308
+ button.removeAttribute("data-context-menu-trigger");
13309
+ } else {
13310
+ button = document.createElement("button");
13311
+ button.className = `${HEADER_CLASS}-action`;
13312
+ }
13313
+ button.innerHTML = iconProjectAdd();
13314
+ button.setAttribute("type", "button");
13315
+ button.setAttribute("data-dcu-action", "add-workspace");
13316
+ const addLabel = text("sections.addWorkspace", "添加工作区");
13317
+ button.setAttribute("aria-label", `${name} ${addLabel}`);
13318
+ button.setAttribute("title", addLabel);
13319
+ button.addEventListener("click", (event) => {
13320
+ event.preventDefault();
13321
+ event.stopPropagation();
13322
+ startAddWorkspaceToSection(sectionId);
13323
+ });
13324
+ return button;
13325
+ }
12713
13326
  /** 分区标题右侧的 `···`:直接克隆宿主项目行的原生图标按钮,样式与宿主完全一致。 */
12714
13327
  function buildHeaderActionButton(sectionId, name) {
12715
13328
  const hostButton = document.querySelector("[data-row-key^=\"workspace:\"] [class*=\"rowActions\"] button");
@@ -12724,6 +13337,7 @@ body[data-dcu-drag-blocked='true'] [class*="dropAfter"]::after{display:none !imp
12724
13337
  button.textContent = "···";
12725
13338
  }
12726
13339
  button.setAttribute("type", "button");
13340
+ button.setAttribute("data-dcu-action", "more");
12727
13341
  button.setAttribute("aria-label", `${name} ${text("sections.settings", "分区设置")}`);
12728
13342
  button.addEventListener("click", (event) => {
12729
13343
  event.preventDefault();
@@ -12829,10 +13443,11 @@ body[data-dcu-drag-blocked='true'] [class*="dropAfter"]::after{display:none !imp
12829
13443
  if (target === null) return;
12830
13444
  const ungrouped = Array.from(list?.querySelectorAll("[data-row-key=\"workspace:\"]") ?? []).map((row) => row instanceof HTMLElement ? blockOf(row, list) : null).find((block) => block !== null);
12831
13445
  const byId = new Map(blocks.map((item) => [item.workspaceId, item.block]));
13446
+ const visibleById = relocatingIds.size === 0 ? byId : new Map(blocks.filter((item) => !relocatingIds.has(item.workspaceId)).map((item) => [item.workspaceId, item.block]));
12832
13447
  let reference = null;
12833
13448
  for (let index = layoutState.sections.length - 1; index >= 0; index -= 1) {
12834
13449
  const section = layoutState.sections[index];
12835
- const first = section.ids.map((id) => byId.get(id)).find((block) => block !== void 0);
13450
+ const first = section.ids.map((id) => visibleById.get(id)).find((block) => block !== void 0);
12836
13451
  if (first !== void 0) reference = first;
12837
13452
  else if (section.id === "default" && ungrouped !== void 0) reference = ungrouped;
12838
13453
  if (section.id === "pinned" && section.ids.length === 0) {
@@ -12854,6 +13469,8 @@ body[data-dcu-drag-blocked='true'] [class*="dropAfter"]::after{display:none !imp
12854
13469
  const memberOf = /* @__PURE__ */ new Map();
12855
13470
  for (const section of layoutState.sections) for (const id of section.ids) memberOf.set(id, section.id);
12856
13471
  for (const block of blocks) {
13472
+ if (relocatingIds.has(block.workspaceId)) block.block.setAttribute(RELOCATING_ATTR, "true");
13473
+ else block.block.removeAttribute(RELOCATING_ATTR);
12857
13474
  const sectionId = memberOf.get(block.workspaceId);
12858
13475
  if (sectionId === void 0) {
12859
13476
  block.block.removeAttribute("data-dcu-section-member");
@@ -12933,6 +13550,7 @@ body[data-dcu-drag-blocked='true'] [class*="dropAfter"]::after{display:none !imp
12933
13550
  }
12934
13551
  assignExpanded = false;
12935
13552
  assignAnchor?.setAttribute("aria-expanded", "false");
13553
+ for (const h of headers.values()) h.removeAttribute("data-menu-open");
12936
13554
  cancelPanelLeave = void 0;
12937
13555
  menuHost = void 0;
12938
13556
  assignAnchor = void 0;
@@ -13070,6 +13688,7 @@ body[data-dcu-drag-blocked='true'] [class*="dropAfter"]::after{display:none !imp
13070
13688
  }
13071
13689
  });
13072
13690
  openHostPanel(anchor, items);
13691
+ headers.get(sectionId)?.setAttribute("data-menu-open", "true");
13073
13692
  }
13074
13693
  /** 标题原地改名:只把标签换成输入框,不碰宿主节点。 */
13075
13694
  let editingInput;
@@ -13332,18 +13951,32 @@ body[data-dcu-drag-blocked='true'] [class*="dropAfter"]::after{display:none !imp
13332
13951
  }
13333
13952
  document.addEventListener("pointerdown", onPointerdownToPrepareMenu, true);
13334
13953
  document.addEventListener("click", onClickToPrepareMenu, true);
13954
+ document.addEventListener("click", onDocumentClickClearPending, true);
13955
+ document.addEventListener("keydown", onDocumentKeydownClearPending, true);
13335
13956
  document.addEventListener("contextmenu", onContextMenuToPrepareMenu, true);
13957
+ let unsubscribeDirectoryFlow;
13958
+ try {
13959
+ if (typeof ctx.slots?.subscribe === "function") unsubscribeDirectoryFlow = ctx.slots.subscribe("sidebar.workspaces.directoryFlow", () => {
13960
+ if (disposed) return;
13961
+ const available = isDirectoryFlowAvailable();
13962
+ if (!available) clearPendingTarget();
13963
+ for (const [id, header] of headers.entries()) syncHeaderAddButton(header, id, localizeBuiltinName(id, state.sections.find((item) => item.id === id)?.name ?? id, text), available);
13964
+ });
13965
+ } catch {
13966
+ unsubscribeDirectoryFlow = void 0;
13967
+ }
13336
13968
  /**
13337
13969
  * 用宿主自己的图标组件渲染出静态 SVG。
13338
13970
  * 手绘图标在描边粗细、圆角与视觉重心上永远差一档,直接复用宿主原语才能和原生菜单项完全同源。
13339
13971
  */
13340
13972
  const iconCache = /* @__PURE__ */ new Map();
13341
13973
  function hostIconMarkup(name, size = 16) {
13342
- const cached = iconCache.get(name);
13974
+ const cacheKey = `${name}:${size}`;
13975
+ const cached = iconCache.get(cacheKey);
13343
13976
  if (cached !== void 0) return cached;
13344
13977
  const Component = _deepseek_ai_dsh_client_ui_primitives[name];
13345
13978
  if (typeof Component !== "function") {
13346
- iconCache.set(name, "");
13979
+ iconCache.set(cacheKey, "");
13347
13980
  return "";
13348
13981
  }
13349
13982
  let markup = "";
@@ -13359,7 +13992,7 @@ body[data-dcu-drag-blocked='true'] [class*="dropAfter"]::after{display:none !imp
13359
13992
  } finally {
13360
13993
  (0, react_dom.unmountComponentAtNode)(host);
13361
13994
  }
13362
- iconCache.set(name, markup);
13995
+ iconCache.set(cacheKey, markup);
13363
13996
  return markup;
13364
13997
  }
13365
13998
  /**
@@ -13372,6 +14005,12 @@ body[data-dcu-drag-blocked='true'] [class*="dropAfter"]::after{display:none !imp
13372
14005
  const iconPinned = () => hostIconMarkup("IconPinFillRegular");
13373
14006
  const iconSection = () => hostIconMarkup("IconChecklistOutlineRegular");
13374
14007
  const iconPlus = () => hostIconMarkup("IconPlusOutlineRegular");
14008
+ const FALLBACK_PROJECT_ADD_SVG = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 16 16\" width=\"16\" height=\"16\" fill=\"none\" stroke-width=\"1.2\"><path d=\"M5.54492 2.06738C5.91034 2.06754 6.26318 2.20149 6.53711 2.44336L7.94043 3.68164V4.7998C7.71462 4.74105 7.50367 4.63139 7.32617 4.47461L5.87598 3.19238C5.78477 3.11185 5.66658 3.06754 5.54492 3.06738H2.94922C2.67322 3.06738 2.44946 3.29145 2.44922 3.56738V12.4326C2.44927 12.7087 2.67311 12.9326 2.94922 12.9326H12.9326C13.2086 12.9325 13.4326 12.7086 13.4326 12.4326V8.53613H14.4326V12.4326C14.4326 13.2609 13.7609 13.9325 12.9326 13.9326H2.94922C2.12083 13.9326 1.44927 13.261 1.44922 12.4326V3.56738C1.44946 2.73916 2.12094 2.06738 2.94922 2.06738H5.54492Z\" fill=\"currentColor\"/><path d=\"M9.75977 4.50208H14.5509\" stroke=\"currentColor\"/><path d=\"M12.1492 6.89758L12.1492 2.10642\" stroke=\"currentColor\"/></svg>";
14009
+ /** 宿主原生「添加工作区」图标(带加号的工作区轮廓)。 */
14010
+ const iconProjectAdd = () => {
14011
+ const markup = hostIconMarkup("IconProjectAddOutlineRegular", 16);
14012
+ return markup !== "" ? markup : FALLBACK_PROJECT_ADD_SVG;
14013
+ };
13375
14014
  /** 分区展开箭头:和宿主项目行同一颗 `IconTriangleRightFillRegular`,展开时旋转 90°。 */
13376
14015
  const iconChevron = () => hostIconMarkup("IconTriangleRightFillRegular");
13377
14016
  const iconEdit = () => hostIconMarkup("IconEditOutlineRegular");
@@ -13549,10 +14188,32 @@ body[data-dcu-drag-blocked='true'] [class*="dropAfter"]::after{display:none !imp
13549
14188
  anchor.setAttribute("aria-expanded", "true");
13550
14189
  }
13551
14190
  }
13552
- /** 新增项目进入默认分区,删除项目及时裁剪;不改变既有成员的显式归属。 */
13553
- function withHostWorkspaces(value, ids) {
14191
+ /**
14192
+ * 消费正在等待中的新建工作区目标分区。
14193
+ * 只要 ids 中出现了 referenceState 尚未记录的新增工作区,且 pendingTargetSectionId 有效,
14194
+ * 即立刻消费并清除 pendingTargetSectionId(避免被后续写入吞掉或重复触发),同时自动展开目标分区。
14195
+ */
14196
+ function consumeTargetForNewIds(ids, referenceState) {
14197
+ const target = pendingTargetSectionId;
14198
+ if (target === void 0) return void 0;
14199
+ if (!ids.some((id) => sectionOf(referenceState, id) === void 0)) return void 0;
14200
+ pendingTargetSectionId = void 0;
14201
+ if (pendingTargetCleanupTimer !== void 0) {
14202
+ window.clearTimeout(pendingTargetCleanupTimer);
14203
+ pendingTargetCleanupTimer = void 0;
14204
+ }
14205
+ if (collapsed[target] === true) {
14206
+ collapsed[target] = false;
14207
+ persistCollapsed();
14208
+ const targetHeader = headers.get(target);
14209
+ if (targetHeader !== void 0) targetHeader.dataset.open = "true";
14210
+ }
14211
+ return target;
14212
+ }
14213
+ /** 新增项目进入指定或默认分区,删除项目及时裁剪;不改变既有成员的显式归属。 */
14214
+ function withHostWorkspaces(value, ids, fallbackSectionId = DEFAULT_SECTION_ID) {
13554
14215
  let next = normalizeSections(value, ids);
13555
- for (const id of ids) if (sectionOf(next, id) === void 0) next = assignWorkspace(next, id, DEFAULT_SECTION_ID);
14216
+ for (const id of ids) if (sectionOf(next, id) === void 0) next = assignWorkspace(next, id, fallbackSectionId);
13556
14217
  return next;
13557
14218
  }
13558
14219
  /** 一次只执行一个确定的计划;请求未结束时绝不超时重发同一条写入。 */
@@ -13560,21 +14221,27 @@ body[data-dcu-drag-blocked='true'] [class*="dropAfter"]::after{display:none !imp
13560
14221
  if (disposed || activeUpdate !== void 0) return;
13561
14222
  const update = updates.shift();
13562
14223
  if (update === void 0) return;
13563
- update.next = withHostWorkspaces(update.next, knownIds());
14224
+ const ids = knownIds();
14225
+ const original = new Set(flattenSections(update.next));
14226
+ const target = consumeTargetForNewIds(ids, update.next) ?? "default";
14227
+ update.next = withHostWorkspaces(update.next, ids, target);
14228
+ const additions = ids.filter((id) => !original.has(id));
14229
+ const movingIds = update.workspaceIds === void 0 ? void 0 : additions.length === 0 ? update.workspaceIds : [...update.workspaceIds, ...additions];
13564
14230
  if (updates.length === 0) state = update.next;
13565
14231
  activeUpdate = update;
13566
- if (list !== void 0) update.motion = new SectionLayoutMotion(list);
14232
+ if (list !== void 0 && update.suppressMotion !== true) update.motion = new SectionLayoutMotion(list);
13567
14233
  const service = workspaces();
14234
+ const plannedMoves = planWorkspaceMoves(ids, flattenSections(update.next), movingIds);
14235
+ if (update.suppressMotion === true && movingIds !== void 0 && movingIds.length > 0 && plannedMoves.length > 0) markRelocating(movingIds);
13568
14236
  const write = async () => {
13569
14237
  if (service === void 0) throw new Error("工作区服务未就绪");
13570
- const desired = flattenSections(update.next);
13571
- for (const move of planWorkspaceMoves(knownIds(), desired, update.workspaceIds)) {
14238
+ for (const move of plannedMoves) {
13572
14239
  if (disposed || activeUpdate !== update) return;
13573
14240
  await insertWorkspace(service, move.workspaceId, move.beforeWorkspaceId);
13574
14241
  }
13575
14242
  if (disposed || activeUpdate !== update) return;
13576
14243
  update.rpcDone = true;
13577
- syncNow();
14244
+ syncNow(true);
13578
14245
  };
13579
14246
  write().catch(() => {
13580
14247
  if (disposed || activeUpdate !== update) return;
@@ -13582,6 +14249,7 @@ body[data-dcu-drag-blocked='true'] [class*="dropAfter"]::after{display:none !imp
13582
14249
  showAbortedNotice();
13583
14250
  updates.length = 0;
13584
14251
  update.motion?.dispose();
14252
+ clearRelocating();
13585
14253
  activeUpdate = void 0;
13586
14254
  state = committedState;
13587
14255
  scheduleSync();
@@ -13608,7 +14276,7 @@ body[data-dcu-drag-blocked='true'] [class*="dropAfter"]::after{display:none !imp
13608
14276
  if (menu === void 0 || reference === void 0 || wrapper === void 0 || wrapper === null) return;
13609
14277
  hostMenuRowTemplate = wrapper.cloneNode(true);
13610
14278
  }
13611
- function syncNow() {
14279
+ function syncNow(allowRevealRelocating = true) {
13612
14280
  if (disposed || syncing) return;
13613
14281
  cacheHostMenuTemplate();
13614
14282
  if (!sectionsLoaded) return;
@@ -13630,11 +14298,12 @@ body[data-dcu-drag-blocked='true'] [class*="dropAfter"]::after{display:none !imp
13630
14298
  const update = activeUpdate;
13631
14299
  if (update !== void 0) {
13632
14300
  if (update.rpcDone && sameVisibleOrder(ids, order)) {
13633
- const normalized = withHostWorkspaces(update.next, ids);
14301
+ const original = new Set(flattenSections(update.next));
14302
+ const target = consumeTargetForNewIds(ids, update.next) ?? "default";
14303
+ const normalized = withHostWorkspaces(update.next, ids, target);
13634
14304
  if (!sameOrder(flattenSections(normalized), flattenSections(update.next))) {
13635
- const original = new Set(flattenSections(update.next));
13636
- update.next = reconcileHostOrder(normalized, ids).state;
13637
- state = withHostWorkspaces(state, ids);
14305
+ update.next = reconcileHostOrder(normalized, ids, target).state;
14306
+ state = reconcileHostOrder(withHostWorkspaces(state, ids, target), ids, target).state;
13638
14307
  update.motion?.dispose();
13639
14308
  update.motion = void 0;
13640
14309
  update.layoutDone = false;
@@ -13644,6 +14313,7 @@ body[data-dcu-drag-blocked='true'] [class*="dropAfter"]::after{display:none !imp
13644
14313
  const service = workspaces();
13645
14314
  if (service === void 0) throw new Error("工作区服务未就绪");
13646
14315
  update.rpcDone = false;
14316
+ if (update.suppressMotion === true && additions.length > 0) markRelocating(additions);
13647
14317
  (async () => {
13648
14318
  for (const move of moves) await insertWorkspace(service, move.workspaceId, move.beforeWorkspaceId);
13649
14319
  if (activeUpdate !== update || disposed) return;
@@ -13653,6 +14323,7 @@ body[data-dcu-drag-blocked='true'] [class*="dropAfter"]::after{display:none !imp
13653
14323
  console.warn("[codex-ui:sections] 同步新工作区顺序失败。");
13654
14324
  if (activeUpdate !== update || disposed) return;
13655
14325
  updates.length = 0;
14326
+ clearRelocating();
13656
14327
  activeUpdate = void 0;
13657
14328
  state = committedState;
13658
14329
  scheduleSync();
@@ -13662,16 +14333,34 @@ body[data-dcu-drag-blocked='true'] [class*="dropAfter"]::after{display:none !imp
13662
14333
  }
13663
14334
  }
13664
14335
  const desired = flattenSections(update.next);
13665
- if (!sameOrder(ids, desired) || !sameVisibleOrder(desired, order)) return;
14336
+ const idsSet = new Set(ids);
14337
+ const orderSet = new Set(order);
14338
+ const relocatingInDom = Array.from(relocatingIds).every((id) => !idsSet.has(id) || orderSet.has(id));
14339
+ if (!(sameOrder(ids, desired) && sameVisibleOrder(desired, order) && relocatingInDom && (relocatingIds.size === 0 || update.rpcDone))) {
14340
+ if (relocatingIds.size > 0) {
14341
+ cancelHostRowAnimations(list);
14342
+ placeHeaders(collectProjectBlocks(list, list), update.next);
14343
+ recordHeaderOffsets();
14344
+ }
14345
+ return;
14346
+ }
14347
+ if (relocatingIds.size > 0) {
14348
+ if (!allowRevealRelocating) return;
14349
+ cancelHostRowAnimations(list);
14350
+ clearRelocating();
14351
+ }
13666
14352
  if (!update.layoutDone) {
13667
14353
  update.layoutDone = true;
13668
- const layout = () => placeHeaders(collectProjectBlocks(list, list), update.next);
14354
+ const layout = () => {
14355
+ placeHeaders(collectProjectBlocks(list, list), update.next);
14356
+ recordHeaderOffsets();
14357
+ };
13669
14358
  const finished = update.motion?.play(layout);
13670
14359
  if (finished === void 0) layout();
13671
14360
  (finished ?? Promise.resolve()).then(() => {
13672
14361
  if (disposed || activeUpdate !== update) return;
13673
14362
  update.motionDone = true;
13674
- syncNow();
14363
+ syncNow(allowRevealRelocating);
13675
14364
  });
13676
14365
  }
13677
14366
  if (update.rpcDone && update.motionDone) {
@@ -13688,16 +14377,36 @@ body[data-dcu-drag-blocked='true'] [class*="dropAfter"]::after{display:none !imp
13688
14377
  state = normalizeSections(state, ids);
13689
14378
  if (!baselineSet) {
13690
14379
  baselineSet = true;
13691
- for (const id of ids) if (sectionOf(state, id) === void 0) state = assignWorkspace(state, id, DEFAULT_SECTION_ID);
14380
+ const target = consumeTargetForNewIds(ids, state) ?? "default";
14381
+ for (const id of ids) if (sectionOf(state, id) === void 0) state = assignWorkspace(state, id, target);
13692
14382
  committedState = state;
13693
14383
  if (!sameOrder(flattenSections(state), ids)) {
13694
14384
  commitExplicit(state);
13695
14385
  return;
13696
14386
  }
13697
- } else state = reconcileHostOrder(state, ids).state;
14387
+ } else {
14388
+ const newIds = ids.filter((id) => sectionOf(state, id) === void 0);
14389
+ const target = consumeTargetForNewIds(ids, state);
14390
+ state = reconcileHostOrder(state, ids, target ?? "default").state;
14391
+ if (newIds.length > 0) {
14392
+ committedState = state;
14393
+ persist();
14394
+ if (!sameOrder(flattenSections(state), ids)) {
14395
+ commitExplicit(state, newIds, true);
14396
+ if (relocatingIds.size > 0) {
14397
+ cancelHostRowAnimations(list);
14398
+ placeHeaders(collectProjectBlocks(list, list), state);
14399
+ recordHeaderOffsets();
14400
+ }
14401
+ return;
14402
+ }
14403
+ }
14404
+ }
13698
14405
  committedState = state;
13699
14406
  if (serializeSections(state) !== before) persist();
13700
14407
  placeHeaders(collectProjectBlocks(list, list));
14408
+ if (relocatingIds.size === 0 && animatingSections.size === 0) syncHeadersWithHostMotion(list);
14409
+ else recordHeaderOffsets();
13701
14410
  } finally {
13702
14411
  syncing = false;
13703
14412
  }
@@ -13734,8 +14443,11 @@ body[data-dcu-drag-blocked='true'] [class*="dropAfter"]::after{display:none !imp
13734
14443
  }
13735
14444
  }
13736
14445
  if (touched) {
13737
- if (activeUpdate !== void 0) syncNow();
13738
- else scheduleSync();
14446
+ if (activeUpdate !== void 0 || knownIds().some((id) => sectionOf(state, id) === void 0)) syncNow(true);
14447
+ else {
14448
+ if (list !== void 0 && relocatingIds.size === 0 && animatingSections.size === 0) syncHeadersWithHostMotion(list);
14449
+ scheduleSync();
14450
+ }
13739
14451
  }
13740
14452
  });
13741
14453
  observer.observe(document.body, {
@@ -13747,7 +14459,10 @@ body[data-dcu-drag-blocked='true'] [class*="dropAfter"]::after{display:none !imp
13747
14459
  const service = workspaces();
13748
14460
  if (service === void 0) return;
13749
14461
  try {
13750
- unsubscribe = service.list.subscribe(() => scheduleSync());
14462
+ unsubscribe = service.list.subscribe(() => {
14463
+ if (!disposed && knownIds().some((id) => sectionOf(state, id) === void 0)) syncNow(false);
14464
+ else scheduleSync();
14465
+ });
13751
14466
  } catch {
13752
14467
  unsubscribe = void 0;
13753
14468
  }
@@ -13766,6 +14481,8 @@ body[data-dcu-drag-blocked='true'] [class*="dropAfter"]::after{display:none !imp
13766
14481
  if (activeInstance === dispose) activeInstance = void 0;
13767
14482
  window.clearInterval(boot);
13768
14483
  if (rafId !== 0) window.cancelAnimationFrame(rafId);
14484
+ if (pendingTargetCleanupTimer !== void 0) window.clearTimeout(pendingTargetCleanupTimer);
14485
+ clearRelocating();
13769
14486
  observer?.disconnect();
13770
14487
  clearWriteWait();
13771
14488
  updates.length = 0;
@@ -13779,7 +14496,10 @@ body[data-dcu-drag-blocked='true'] [class*="dropAfter"]::after{display:none !imp
13779
14496
  document.removeEventListener("pointerdown", onPointerdownToCloseSectionMenu, true);
13780
14497
  document.removeEventListener("pointerdown", onPointerdownToPrepareMenu, true);
13781
14498
  document.removeEventListener("click", onClickToPrepareMenu, true);
14499
+ document.removeEventListener("click", onDocumentClickClearPending, true);
14500
+ document.removeEventListener("keydown", onDocumentKeydownClearPending, true);
13782
14501
  document.removeEventListener("contextmenu", onContextMenuToPrepareMenu, true);
14502
+ unsubscribeDirectoryFlow?.();
13783
14503
  unsubscribe?.();
13784
14504
  closeSectionMenu();
13785
14505
  flushSectionsSave();