dsh-cliworker-now 0.7.6 → 0.7.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (144) hide show
  1. package/README.en.md +29 -9
  2. package/README.md +31 -9
  3. package/lib/account-models.mjs +16 -13
  4. package/lib/client.js +658 -61
  5. package/lib/client.js.map +1 -1
  6. package/lib/grok-catalog.mjs +2 -2
  7. package/lib/hermes-native-entry.py +48 -13
  8. package/lib/hermes-nous-refresh.py +331 -0
  9. package/lib/index.js +3724 -1589
  10. package/lib/index.js.map +1 -1
  11. package/lib/native-launch.mjs +62 -7
  12. package/lib/native-spawn.mjs +32 -0
  13. package/lib/pi-installation.mjs +27 -3
  14. package/lib/pi-native-catalog.mjs +2 -2
  15. package/lib/pi-omp-bridge.mjs +2 -2
  16. package/lib/private-launch.mjs +6 -2
  17. package/lib/terminal-bridge.mjs +2 -2
  18. package/lib/typert.host.js +83 -11
  19. package/lib/typert.remote-client.d.ts +2 -0
  20. package/lib/typert.remote-client.d.ts.map +1 -1
  21. package/lib/typert.remote-client.js +77 -11
  22. package/lib/types/client/account-query-queue.d.ts +16 -0
  23. package/lib/types/client/account-query-queue.js +61 -0
  24. package/lib/types/client/account-query-queue.js.map +1 -0
  25. package/lib/types/client/account-terminal.d.ts +6 -2
  26. package/lib/types/client/account-terminal.js +260 -31
  27. package/lib/types/client/account-terminal.js.map +1 -1
  28. package/lib/types/client/settings-dialog.js +65 -38
  29. package/lib/types/client/settings-dialog.js.map +1 -1
  30. package/lib/types/client/zcode-login-link-provider.d.ts +9 -0
  31. package/lib/types/client/zcode-login-link-provider.js +105 -0
  32. package/lib/types/client/zcode-login-link-provider.js.map +1 -0
  33. package/lib/types/client/zcode-login-link.d.ts +16 -0
  34. package/lib/types/client/zcode-login-link.js +194 -0
  35. package/lib/types/client/zcode-login-link.js.map +1 -0
  36. package/lib/types/host/account-models.d.mts +3 -1
  37. package/lib/types/host/account-models.mjs +16 -13
  38. package/lib/types/host/accounts.d.ts +3 -2
  39. package/lib/types/host/accounts.js +129 -22
  40. package/lib/types/host/accounts.js.map +1 -1
  41. package/lib/types/host/adapters.d.ts +1 -1
  42. package/lib/types/host/adapters.js +60 -11
  43. package/lib/types/host/adapters.js.map +1 -1
  44. package/lib/types/host/agy-models.d.ts +2 -1
  45. package/lib/types/host/agy-models.js +6 -6
  46. package/lib/types/host/agy-models.js.map +1 -1
  47. package/lib/types/host/agy-windows-account.d.ts +14 -0
  48. package/lib/types/host/agy-windows-account.js +104 -0
  49. package/lib/types/host/agy-windows-account.js.map +1 -0
  50. package/lib/types/host/authorized-catalog.js +13 -4
  51. package/lib/types/host/authorized-catalog.js.map +1 -1
  52. package/lib/types/host/claude-native-oauth.d.ts +17 -0
  53. package/lib/types/host/claude-native-oauth.js +272 -0
  54. package/lib/types/host/claude-native-oauth.js.map +1 -0
  55. package/lib/types/host/claude-own-route.d.ts +33 -0
  56. package/lib/types/host/claude-own-route.js +250 -0
  57. package/lib/types/host/claude-own-route.js.map +1 -0
  58. package/lib/types/host/cli-account-binding.d.ts +2 -1
  59. package/lib/types/host/cli-account-binding.js +59 -21
  60. package/lib/types/host/cli-account-binding.js.map +1 -1
  61. package/lib/types/host/codex-models.js +4 -0
  62. package/lib/types/host/codex-models.js.map +1 -1
  63. package/lib/types/host/extended-adapters.d.ts +3 -2
  64. package/lib/types/host/extended-adapters.js +9 -7
  65. package/lib/types/host/extended-adapters.js.map +1 -1
  66. package/lib/types/host/first-party-models.d.ts +1 -0
  67. package/lib/types/host/first-party-models.js +136 -47
  68. package/lib/types/host/first-party-models.js.map +1 -1
  69. package/lib/types/host/hermes-accounts.js +15 -1
  70. package/lib/types/host/hermes-accounts.js.map +1 -1
  71. package/lib/types/host/hermes-adapter.d.ts +3 -0
  72. package/lib/types/host/hermes-adapter.js +13 -4
  73. package/lib/types/host/hermes-adapter.js.map +1 -1
  74. package/lib/types/host/hermes-installation.js +54 -35
  75. package/lib/types/host/hermes-installation.js.map +1 -1
  76. package/lib/types/host/hermes-native-entry.py +48 -13
  77. package/lib/types/host/hermes-nous-refresh.py +331 -0
  78. package/lib/types/host/hermes-nous.d.ts +5 -1
  79. package/lib/types/host/hermes-nous.js +5 -5
  80. package/lib/types/host/hermes-nous.js.map +1 -1
  81. package/lib/types/host/hermes-renewal.d.ts +27 -0
  82. package/lib/types/host/hermes-renewal.js +292 -0
  83. package/lib/types/host/hermes-renewal.js.map +1 -0
  84. package/lib/types/host/hermes-windows-installation.d.ts +5 -0
  85. package/lib/types/host/hermes-windows-installation.js +91 -0
  86. package/lib/types/host/hermes-windows-installation.js.map +1 -0
  87. package/lib/types/host/index.d.ts +2 -0
  88. package/lib/types/host/index.js +17 -2
  89. package/lib/types/host/index.js.map +1 -1
  90. package/lib/types/host/kimi-accounts.d.ts +2 -0
  91. package/lib/types/host/kimi-accounts.js +4 -2
  92. package/lib/types/host/kimi-accounts.js.map +1 -1
  93. package/lib/types/host/kimi-oauth-models.d.ts +14 -0
  94. package/lib/types/host/kimi-oauth-models.js +246 -0
  95. package/lib/types/host/kimi-oauth-models.js.map +1 -0
  96. package/lib/types/host/mimo-metadata-cache.d.ts +22 -0
  97. package/lib/types/host/mimo-metadata-cache.js +121 -0
  98. package/lib/types/host/mimo-metadata-cache.js.map +1 -0
  99. package/lib/types/host/native-capability-cache.d.ts +11 -0
  100. package/lib/types/host/native-capability-cache.js +94 -0
  101. package/lib/types/host/native-capability-cache.js.map +1 -0
  102. package/lib/types/host/native-launch.mjs +62 -7
  103. package/lib/types/host/native-process.d.ts +3 -1
  104. package/lib/types/host/native-process.js +18 -3
  105. package/lib/types/host/native-process.js.map +1 -1
  106. package/lib/types/host/native-spawn.mjs +32 -0
  107. package/lib/types/host/pi-installation.d.mts +1 -1
  108. package/lib/types/host/pi-installation.mjs +27 -3
  109. package/lib/types/host/pi-omp-adapter.js +15 -1
  110. package/lib/types/host/pi-omp-adapter.js.map +1 -1
  111. package/lib/types/host/private-launch.mjs +23 -0
  112. package/lib/types/host/routing.js +25 -2
  113. package/lib/types/host/routing.js.map +1 -1
  114. package/lib/types/host/runtime.js +17 -5
  115. package/lib/types/host/runtime.js.map +1 -1
  116. package/lib/types/host/windows-account-bootstrap.ps1 +44 -0
  117. package/lib/types/host/windows-account-launch.mjs +47 -0
  118. package/lib/types/host/windows-account-owner.ps1 +137 -0
  119. package/lib/types/host/windows-account-stdio.mjs +19 -0
  120. package/lib/types/host/windows-account-terminal.d.ts +17 -0
  121. package/lib/types/host/windows-account-terminal.js +208 -0
  122. package/lib/types/host/windows-account-terminal.js.map +1 -0
  123. package/lib/types/host/windows-agy-account.ps1 +81 -0
  124. package/lib/types/host/windows-cli-installation.d.ts +31 -0
  125. package/lib/types/host/windows-cli-installation.js +157 -0
  126. package/lib/types/host/windows-cli-installation.js.map +1 -0
  127. package/lib/types/host/windows-hidden-launch.mjs +49 -0
  128. package/lib/types/host/windows-hidden-process.d.ts +12 -0
  129. package/lib/types/host/windows-hidden-process.js +116 -0
  130. package/lib/types/host/windows-hidden-process.js.map +1 -0
  131. package/lib/types/host/zcode-adapter.js +5 -1
  132. package/lib/types/host/zcode-adapter.js.map +1 -1
  133. package/lib/types/host/zcode-grok-accounts.d.ts +3 -1
  134. package/lib/types/host/zcode-grok-accounts.js +60 -11
  135. package/lib/types/host/zcode-grok-accounts.js.map +1 -1
  136. package/lib/types/shared/accounts.d.ts +4 -0
  137. package/lib/windows-account-bootstrap.ps1 +44 -0
  138. package/lib/windows-account-launch.mjs +47 -0
  139. package/lib/windows-account-owner.ps1 +137 -0
  140. package/lib/windows-account-stdio.mjs +19 -0
  141. package/lib/windows-agy-account.ps1 +81 -0
  142. package/lib/windows-hidden-launch.mjs +49 -0
  143. package/lib/zcode-resume.mjs +2 -2
  144. package/package.json +1 -1
package/lib/client.js CHANGED
@@ -3397,6 +3397,16 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
3397
3397
  const dsh_cliworker_now_cliworker_accountStart_parameter_2$schema = () => dsh_cliworker_now_cliworker_accountStart_parameter_2$schema$value ??= string();
3398
3398
  let dsh_cliworker_now_cliworker_accountStart_result$schema$value;
3399
3399
  const dsh_cliworker_now_cliworker_accountStart_result$schema = () => dsh_cliworker_now_cliworker_accountStart_result$schema$value ??= string();
3400
+ let dsh_cliworker_now_cliworker_accountStartForProvider_parameter_0$schema$value;
3401
+ const dsh_cliworker_now_cliworker_accountStartForProvider_parameter_0$schema = () => dsh_cliworker_now_cliworker_accountStartForProvider_parameter_0$schema$value ??= string();
3402
+ let dsh_cliworker_now_cliworker_accountStartForProvider_parameter_1$schema$value;
3403
+ const dsh_cliworker_now_cliworker_accountStartForProvider_parameter_1$schema = () => dsh_cliworker_now_cliworker_accountStartForProvider_parameter_1$schema$value ??= string();
3404
+ let dsh_cliworker_now_cliworker_accountStartForProvider_parameter_2$schema$value;
3405
+ const dsh_cliworker_now_cliworker_accountStartForProvider_parameter_2$schema = () => dsh_cliworker_now_cliworker_accountStartForProvider_parameter_2$schema$value ??= string();
3406
+ let dsh_cliworker_now_cliworker_accountStartForProvider_parameter_3$schema$value;
3407
+ const dsh_cliworker_now_cliworker_accountStartForProvider_parameter_3$schema = () => dsh_cliworker_now_cliworker_accountStartForProvider_parameter_3$schema$value ??= string();
3408
+ let dsh_cliworker_now_cliworker_accountStartForProvider_result$schema$value;
3409
+ const dsh_cliworker_now_cliworker_accountStartForProvider_result$schema = () => dsh_cliworker_now_cliworker_accountStartForProvider_result$schema$value ??= string();
3400
3410
  let dsh_cliworker_now_cliworker_accountStartForSource_parameter_0$schema$value;
3401
3411
  const dsh_cliworker_now_cliworker_accountStartForSource_parameter_0$schema = () => dsh_cliworker_now_cliworker_accountStartForSource_parameter_0$schema$value ??= string();
3402
3412
  let dsh_cliworker_now_cliworker_accountStartForSource_parameter_1$schema$value;
@@ -3609,7 +3619,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
3609
3619
  },
3610
3620
  sourceLocation: {
3611
3621
  "file": "packages/cliworker/src/host/index.ts",
3612
- "line": 923,
3622
+ "line": 942,
3613
3623
  "column": 9
3614
3624
  }
3615
3625
  },
@@ -3663,6 +3673,66 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
3663
3673
  "column": 9
3664
3674
  }
3665
3675
  },
3676
+ {
3677
+ id: "dsh-cliworker-now#cliworker/accountStartForProvider",
3678
+ service: "cliworker",
3679
+ namespace: "cliworker",
3680
+ method: "accountStartForProvider",
3681
+ invocation: { kind: "direct" },
3682
+ parameters: [
3683
+ {
3684
+ name: "parentSessionId",
3685
+ wire: "parentSessionId",
3686
+ source: "json",
3687
+ codec: {
3688
+ mode: "strict",
3689
+ typeSymbol: "dsh-cliworker-now#cliworker/accountStartForProvider:parentSessionId",
3690
+ create: dsh_cliworker_now_cliworker_accountStartForProvider_parameter_0$schema
3691
+ }
3692
+ },
3693
+ {
3694
+ name: "cli",
3695
+ wire: "cli",
3696
+ source: "json",
3697
+ codec: {
3698
+ mode: "strict",
3699
+ typeSymbol: "dsh-cliworker-now#cliworker/accountStartForProvider:cli",
3700
+ create: dsh_cliworker_now_cliworker_accountStartForProvider_parameter_1$schema
3701
+ }
3702
+ },
3703
+ {
3704
+ name: "action",
3705
+ wire: "action",
3706
+ source: "json",
3707
+ codec: {
3708
+ mode: "strict",
3709
+ typeSymbol: "dsh-cliworker-now#cliworker/accountStartForProvider:action",
3710
+ create: dsh_cliworker_now_cliworker_accountStartForProvider_parameter_2$schema
3711
+ }
3712
+ },
3713
+ {
3714
+ name: "provider",
3715
+ wire: "provider",
3716
+ source: "json",
3717
+ codec: {
3718
+ mode: "strict",
3719
+ typeSymbol: "dsh-cliworker-now#cliworker/accountStartForProvider:provider",
3720
+ create: dsh_cliworker_now_cliworker_accountStartForProvider_parameter_3$schema
3721
+ }
3722
+ }
3723
+ ],
3724
+ cancellation: { parameter: "signal" },
3725
+ result: {
3726
+ mode: "strict",
3727
+ typeSymbol: "dsh-cliworker-now#cliworker/accountStartForProvider:result",
3728
+ create: dsh_cliworker_now_cliworker_accountStartForProvider_result$schema
3729
+ },
3730
+ sourceLocation: {
3731
+ "file": "packages/cliworker/src/host/index.ts",
3732
+ "line": 866,
3733
+ "column": 9
3734
+ }
3735
+ },
3666
3736
  {
3667
3737
  id: "dsh-cliworker-now#cliworker/accountStartForSource",
3668
3738
  service: "cliworker",
@@ -3792,7 +3862,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
3792
3862
  },
3793
3863
  sourceLocation: {
3794
3864
  "file": "packages/cliworker/src/host/index.ts",
3795
- "line": 939,
3865
+ "line": 958,
3796
3866
  "column": 9
3797
3867
  }
3798
3868
  },
@@ -3830,7 +3900,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
3830
3900
  },
3831
3901
  sourceLocation: {
3832
3902
  "file": "packages/cliworker/src/host/index.ts",
3833
- "line": 897,
3903
+ "line": 916,
3834
3904
  "column": 10
3835
3905
  }
3836
3906
  },
@@ -3879,7 +3949,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
3879
3949
  },
3880
3950
  sourceLocation: {
3881
3951
  "file": "packages/cliworker/src/host/index.ts",
3882
- "line": 912,
3952
+ "line": 931,
3883
3953
  "column": 9
3884
3954
  }
3885
3955
  },
@@ -3907,7 +3977,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
3907
3977
  },
3908
3978
  sourceLocation: {
3909
3979
  "file": "packages/cliworker/src/host/index.ts",
3910
- "line": 949,
3980
+ "line": 968,
3911
3981
  "column": 9
3912
3982
  }
3913
3983
  },
@@ -3944,7 +4014,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
3944
4014
  },
3945
4015
  sourceLocation: {
3946
4016
  "file": "packages/cliworker/src/host/index.ts",
3947
- "line": 954,
4017
+ "line": 973,
3948
4018
  "column": 9
3949
4019
  }
3950
4020
  },
@@ -4009,7 +4079,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
4009
4079
  },
4010
4080
  sourceLocation: {
4011
4081
  "file": "packages/cliworker/src/host/index.ts",
4012
- "line": 972,
4082
+ "line": 991,
4013
4083
  "column": 9
4014
4084
  }
4015
4085
  },
@@ -4059,7 +4129,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
4059
4129
  },
4060
4130
  sourceLocation: {
4061
4131
  "file": "packages/cliworker/src/host/index.ts",
4062
- "line": 999,
4132
+ "line": 1018,
4063
4133
  "column": 9
4064
4134
  }
4065
4135
  },
@@ -4183,7 +4253,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
4183
4253
  },
4184
4254
  sourceLocation: {
4185
4255
  "file": "packages/cliworker/src/host/index.ts",
4186
- "line": 1033,
4256
+ "line": 1052,
4187
4257
  "column": 9
4188
4258
  }
4189
4259
  },
@@ -4392,7 +4462,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
4392
4462
  },
4393
4463
  sourceLocation: {
4394
4464
  "file": "packages/cliworker/src/host/index.ts",
4395
- "line": 1061,
4465
+ "line": 1080,
4396
4466
  "column": 9
4397
4467
  }
4398
4468
  },
@@ -4580,7 +4650,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
4580
4650
  },
4581
4651
  sourceLocation: {
4582
4652
  "file": "packages/cliworker/src/host/index.ts",
4583
- "line": 1090,
4653
+ "line": 1109,
4584
4654
  "column": 9
4585
4655
  }
4586
4656
  },
@@ -18670,9 +18740,302 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
18670
18740
  var import_addon_fit = require_addon_fit();
18671
18741
  const accountTerminalCSS = "/**\n * Copyright (c) 2014 The xterm.js authors. All rights reserved.\n * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)\n * https://github.com/chjj/term.js\n * @license MIT\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n *\n * Originally forked from (with the author's permission):\n * Fabrice Bellard's javascript vt100 for jslinux:\n * http://bellard.org/jslinux/\n * Copyright (c) 2011 Fabrice Bellard\n * The original design remains. The terminal itself\n * has been extended to include xterm CSI codes, among\n * other features.\n */\n\n/**\n * Default styles for xterm.js\n */\n\n.xterm {\n cursor: text;\n position: relative;\n user-select: none;\n -ms-user-select: none;\n -webkit-user-select: none;\n}\n\n.xterm.focus,\n.xterm:focus {\n outline: none;\n}\n\n.xterm .xterm-helpers {\n position: absolute;\n top: 0;\n /**\n * The z-index of the helpers must be higher than the canvases in order for\n * IMEs to appear on top.\n */\n z-index: 5;\n}\n\n.xterm .xterm-helper-textarea {\n padding: 0;\n border: 0;\n margin: 0;\n /* Move textarea out of the screen to the far left, so that the cursor is not visible */\n position: absolute;\n opacity: 0;\n left: -9999em;\n top: 0;\n width: 0;\n height: 0;\n z-index: -5;\n /** Prevent wrapping so the IME appears against the textarea at the correct position */\n white-space: nowrap;\n overflow: hidden;\n resize: none;\n}\n\n.xterm .composition-view {\n /* TODO: Composition position got messed up somewhere */\n background: #000;\n color: #FFF;\n display: none;\n position: absolute;\n white-space: nowrap;\n z-index: 1;\n}\n\n.xterm .composition-view.active {\n display: block;\n}\n\n.xterm .xterm-viewport {\n /* On OS X this is required in order for the scroll bar to appear fully opaque */\n background-color: #000;\n overflow-y: scroll;\n cursor: default;\n position: absolute;\n right: 0;\n left: 0;\n top: 0;\n bottom: 0;\n}\n\n.xterm .xterm-screen {\n position: relative;\n}\n\n.xterm .xterm-screen canvas {\n position: absolute;\n left: 0;\n top: 0;\n}\n\n.xterm-char-measure-element {\n display: inline-block;\n visibility: hidden;\n position: absolute;\n top: 0;\n left: -9999em;\n line-height: normal;\n}\n\n.xterm.enable-mouse-events {\n /* When mouse events are enabled (eg. tmux), revert to the standard pointer cursor */\n cursor: default;\n}\n\n.xterm.xterm-cursor-pointer,\n.xterm .xterm-cursor-pointer {\n cursor: pointer;\n}\n\n.xterm.column-select.focus {\n /* Column selection mode */\n cursor: crosshair;\n}\n\n.xterm .xterm-accessibility:not(.debug),\n.xterm .xterm-message {\n position: absolute;\n left: 0;\n top: 0;\n bottom: 0;\n right: 0;\n z-index: 10;\n color: transparent;\n pointer-events: none;\n}\n\n.xterm .xterm-accessibility-tree:not(.debug) *::selection {\n color: transparent;\n}\n\n.xterm .xterm-accessibility-tree {\n font-family: monospace;\n user-select: text;\n white-space: pre;\n}\n\n.xterm .xterm-accessibility-tree > div {\n transform-origin: left;\n width: fit-content;\n}\n\n.xterm .live-region {\n position: absolute;\n left: -9999px;\n width: 1px;\n height: 1px;\n overflow: hidden;\n}\n\n.xterm-dim {\n /* Dim should not apply to background, so the opacity of the foreground color is applied\n * explicitly in the generated class and reset to 1 here */\n opacity: 1 !important;\n}\n\n.xterm-underline-1 { text-decoration: underline; }\n.xterm-underline-2 { text-decoration: double underline; }\n.xterm-underline-3 { text-decoration: wavy underline; }\n.xterm-underline-4 { text-decoration: dotted underline; }\n.xterm-underline-5 { text-decoration: dashed underline; }\n\n.xterm-overline {\n text-decoration: overline;\n}\n\n.xterm-overline.xterm-underline-1 { text-decoration: overline underline; }\n.xterm-overline.xterm-underline-2 { text-decoration: overline double underline; }\n.xterm-overline.xterm-underline-3 { text-decoration: overline wavy underline; }\n.xterm-overline.xterm-underline-4 { text-decoration: overline dotted underline; }\n.xterm-overline.xterm-underline-5 { text-decoration: overline dashed underline; }\n\n.xterm-strikethrough {\n text-decoration: line-through;\n}\n\n.xterm-screen .xterm-decoration-container .xterm-decoration {\n z-index: 6;\n position: absolute;\n}\n\n.xterm-screen .xterm-decoration-container .xterm-decoration.xterm-decoration-top-layer {\n z-index: 7;\n}\n\n.xterm-decoration-overview-ruler {\n z-index: 8;\n position: absolute;\n top: 0;\n right: 0;\n pointer-events: none;\n}\n\n.xterm-decoration-top {\n z-index: 2;\n position: relative;\n}\n\n\n\n/* Derived from vs/base/browser/ui/scrollbar/media/scrollbar.css */\n\n/* xterm.js customization: Override xterm's cursor style */\n.xterm .xterm-scrollable-element > .scrollbar {\n cursor: default;\n}\n\n/* Arrows */\n.xterm .xterm-scrollable-element > .scrollbar > .scra {\n cursor: pointer;\n font-size: 11px !important;\n}\n\n.xterm .xterm-scrollable-element > .visible {\n opacity: 1;\n\n /* Background rule added for IE9 - to allow clicks on dom node */\n background:rgba(0,0,0,0);\n\n transition: opacity 100ms linear;\n /* In front of peek view */\n z-index: 11;\n}\n.xterm .xterm-scrollable-element > .invisible {\n opacity: 0;\n pointer-events: none;\n}\n.xterm .xterm-scrollable-element > .invisible.fade {\n transition: opacity 800ms linear;\n}\n\n/* Scrollable Content Inset Shadow */\n.xterm .xterm-scrollable-element > .shadow {\n position: absolute;\n display: none;\n}\n.xterm .xterm-scrollable-element > .shadow.top {\n display: block;\n top: 0;\n left: 3px;\n height: 3px;\n width: 100%;\n box-shadow: var(--vscode-scrollbar-shadow, #000) 0 6px 6px -6px inset;\n}\n.xterm .xterm-scrollable-element > .shadow.left {\n display: block;\n top: 3px;\n left: 0;\n height: 100%;\n width: 3px;\n box-shadow: var(--vscode-scrollbar-shadow, #000) 6px 0 6px -6px inset;\n}\n.xterm .xterm-scrollable-element > .shadow.top-left-corner {\n display: block;\n top: 0;\n left: 0;\n height: 3px;\n width: 3px;\n}\n.xterm .xterm-scrollable-element > .shadow.top.left {\n box-shadow: var(--vscode-scrollbar-shadow, #000) 6px 0 6px -6px inset;\n}\n";
18672
18742
  //#endregion
18743
+ //#region lib/types/client/zcode-login-link.js
18744
+ const nativePrompt = "Open this URL to sign in:";
18745
+ const maxLineLength = 8192;
18746
+ const nativeEndpoints = {
18747
+ zai: {
18748
+ prefix: /^https:\/\/chat\.z\.ai(?::443)?\/api\/oauth\/authorize\?/,
18749
+ origin: "https://chat.z.ai",
18750
+ path: "/api/oauth/authorize",
18751
+ parameters: [
18752
+ "client_id",
18753
+ "redirect_uri",
18754
+ "state",
18755
+ "response_type"
18756
+ ]
18757
+ },
18758
+ bigmodel: {
18759
+ prefix: /^https:\/\/bigmodel\.cn(?::443)?\/login\?/,
18760
+ origin: "https://bigmodel.cn",
18761
+ path: "/login",
18762
+ parameters: [
18763
+ "appId",
18764
+ "redirect",
18765
+ "state"
18766
+ ]
18767
+ }
18768
+ };
18769
+ /** Validate only the observed native authorization endpoint; return the original bytes. */
18770
+ function nativeLoginUrl(line, provider) {
18771
+ const selected = provider === void 0 ? "zai" : provider;
18772
+ if (selected !== "zai" && selected !== "bigmodel") return void 0;
18773
+ const endpoint = nativeEndpoints[selected];
18774
+ if (line.length > maxLineLength || !endpoint.prefix.test(line) || /[\s\p{C}<>"'\\#]/u.test(line)) return void 0;
18775
+ try {
18776
+ const url = new URL(line);
18777
+ if (url.protocol !== "https:" || url.origin !== endpoint.origin || url.pathname !== endpoint.path || url.username || url.password || url.hash || url.port && url.port !== "443") return void 0;
18778
+ for (const parameter of endpoint.parameters) {
18779
+ const values = url.searchParams.getAll(parameter);
18780
+ if (values.length !== 1 || !values[0]?.trim()) return void 0;
18781
+ }
18782
+ return line;
18783
+ } catch {
18784
+ return;
18785
+ }
18786
+ }
18787
+ /**
18788
+ * The caller must enable this only for a ZCode login session and pass the selected
18789
+ * provider so one region cannot open the other region's URL. URLs stay in memory.
18790
+ * Accept a single complete line immediately after the fixed native --no-browser
18791
+ * prompt. SGR/cursor visibility do not affect text. The observed ConPTY blank
18792
+ * screen initialization is accepted only before any prompt/URL text; arbitrary
18793
+ * cursor edits do not become trusted text. OSC payloads are never stored.
18794
+ */
18795
+ function createZcodeLoginLinkParser(provider) {
18796
+ let mode = "text";
18797
+ let line = "";
18798
+ let invalidLine = false;
18799
+ let carriageReturn = false;
18800
+ let csiParameters = true;
18801
+ let csiLength = 0;
18802
+ let csiSequence = "";
18803
+ let oscCommand = "";
18804
+ let oscCommandComplete = false;
18805
+ let oscInitialization = false;
18806
+ let awaitingUrl = false;
18807
+ let previousUrl;
18808
+ const reset = () => {
18809
+ mode = "text";
18810
+ line = "";
18811
+ invalidLine = false;
18812
+ carriageReturn = false;
18813
+ csiParameters = true;
18814
+ csiLength = 0;
18815
+ csiSequence = "";
18816
+ oscCommand = "";
18817
+ oscCommandComplete = false;
18818
+ oscInitialization = false;
18819
+ awaitingUrl = false;
18820
+ previousUrl = void 0;
18821
+ };
18822
+ const finishLine = () => {
18823
+ const complete = invalidLine ? "" : line.trim();
18824
+ line = "";
18825
+ invalidLine = false;
18826
+ carriageReturn = false;
18827
+ if (complete === nativePrompt) {
18828
+ awaitingUrl = true;
18829
+ return;
18830
+ }
18831
+ const candidate = awaitingUrl ? nativeLoginUrl(complete, provider) : void 0;
18832
+ awaitingUrl = false;
18833
+ if (!candidate || candidate === previousUrl) return void 0;
18834
+ previousUrl = candidate;
18835
+ return candidate;
18836
+ };
18837
+ return {
18838
+ reset,
18839
+ write(chunk) {
18840
+ let result;
18841
+ for (const character of chunk) {
18842
+ if (mode === "osc" || mode === "osc-escape") {
18843
+ if (character === "\x07" || mode === "osc-escape" && character === "\\") {
18844
+ if (!oscInitialization || !oscCommandComplete || !["0", "2"].includes(oscCommand)) invalidLine = true;
18845
+ mode = "text";
18846
+ } else {
18847
+ if (!oscCommandComplete) if (character === ";") oscCommandComplete = true;
18848
+ else if (oscCommand.length < 2) oscCommand += character;
18849
+ else oscInitialization = false;
18850
+ mode = character === "\x1B" ? "osc-escape" : "osc";
18851
+ }
18852
+ continue;
18853
+ }
18854
+ if (mode === "escape") {
18855
+ if (character === "[") {
18856
+ mode = "csi";
18857
+ csiParameters = true;
18858
+ csiLength = 0;
18859
+ csiSequence = "";
18860
+ continue;
18861
+ }
18862
+ if (character === "]") {
18863
+ oscInitialization = !line && !awaitingUrl && !invalidLine;
18864
+ oscCommand = "";
18865
+ oscCommandComplete = false;
18866
+ mode = "osc";
18867
+ } else {
18868
+ invalidLine = true;
18869
+ mode = "text";
18870
+ }
18871
+ if (character !== "\n") continue;
18872
+ } else if (mode === "csi") {
18873
+ csiLength++;
18874
+ if (character >= "@" && character <= "~") {
18875
+ const sequence = csiSequence + character;
18876
+ const decoration = character === "m" && csiParameters;
18877
+ const visibility = /^\?25[hl]$/.test(sequence);
18878
+ const initialization = !line && !awaitingUrl && !invalidLine && /^(?:2J|0?K|(?:1;1)?H)$/.test(sequence);
18879
+ if (csiLength > 64 || !decoration && !visibility && !initialization) invalidLine = true;
18880
+ mode = "text";
18881
+ continue;
18882
+ }
18883
+ csiParameters &&= /^[0-9;:]$/.test(character);
18884
+ if (csiLength <= 64) csiSequence += character;
18885
+ if (character !== "\n") continue;
18886
+ invalidLine = true;
18887
+ mode = "text";
18888
+ }
18889
+ if (character === "\n") {
18890
+ const found = finishLine();
18891
+ if (found) result = found;
18892
+ continue;
18893
+ }
18894
+ if (carriageReturn) invalidLine = true;
18895
+ carriageReturn = character === "\r";
18896
+ if (carriageReturn) continue;
18897
+ if (character === "\x1B") {
18898
+ mode = "escape";
18899
+ continue;
18900
+ }
18901
+ if (/[\p{C}]/u.test(character)) invalidLine = true;
18902
+ if (line.length + character.length > maxLineLength) invalidLine = true;
18903
+ if (!invalidLine) line += character;
18904
+ }
18905
+ return result;
18906
+ }
18907
+ };
18908
+ }
18909
+ //#endregion
18910
+ //#region lib/types/client/zcode-login-link-provider.js
18911
+ const maxUrlLength = 8192;
18912
+ const maxCells = 16384;
18913
+ const maxWrappedLines = 512;
18914
+ /** Resolve only a complete displayed copy of an already approved native URL. */
18915
+ function displayedUrlRange(terminal, bufferLineNumber, url) {
18916
+ if (!url || url.length > maxUrlLength || !Number.isInteger(bufferLineNumber)) return void 0;
18917
+ const buffer = terminal.buffer.active;
18918
+ const index = bufferLineNumber - 1;
18919
+ if (index < 0 || index >= buffer.length || terminal.cols < 1) return void 0;
18920
+ let first = index;
18921
+ while (buffer.getLine(first)?.isWrapped) {
18922
+ if (first === 0 || index - first >= maxWrappedLines) return void 0;
18923
+ first--;
18924
+ }
18925
+ let text = "";
18926
+ let cellCount = 0;
18927
+ const positions = [];
18928
+ for (let row = first; row < buffer.length; row++) {
18929
+ if (row - first >= maxWrappedLines) return void 0;
18930
+ const line = buffer.getLine(row);
18931
+ if (!line) return void 0;
18932
+ if (row !== first && !line.isWrapped) break;
18933
+ const columns = Math.min(terminal.cols, line.length);
18934
+ if (!Number.isInteger(columns) || columns < 0 || cellCount + columns > maxCells) return void 0;
18935
+ cellCount += columns;
18936
+ for (let column = 0; column < columns; column++) {
18937
+ const cell = line.getCell(column);
18938
+ if (!cell) return void 0;
18939
+ const width = cell.getWidth();
18940
+ if (width === 0) continue;
18941
+ if (width !== 1 && width !== 2) return void 0;
18942
+ const chars = cell.getChars() || " ";
18943
+ if (text.length + chars.length > maxCells) return void 0;
18944
+ const position = {
18945
+ start: {
18946
+ x: column + 1,
18947
+ y: row + 1
18948
+ },
18949
+ end: {
18950
+ x: column + width,
18951
+ y: row + 1
18952
+ }
18953
+ };
18954
+ for (let character = 0; character < chars.length; character++) positions.push(position);
18955
+ text += chars;
18956
+ }
18957
+ }
18958
+ if (text.trim() !== url) return void 0;
18959
+ const offset = text.length - text.trimStart().length;
18960
+ const start = positions[offset]?.start;
18961
+ const end = positions[offset + url.length - 1]?.end;
18962
+ if (!start || !end || bufferLineNumber < start.y || bufferLineNumber > end.y) return void 0;
18963
+ return {
18964
+ start,
18965
+ end
18966
+ };
18967
+ }
18968
+ /**
18969
+ * The caller supplies only the active ZCode login parser's approved URL and
18970
+ * disposes its registerLinkProvider handle on close. No URL discovery, browser
18971
+ * opening, output logging, or persistence happens while links are requested.
18972
+ */
18973
+ function createZcodeLoginLinkProvider(terminal, currentUrl, open) {
18974
+ return { provideLinks(bufferLineNumber, callback) {
18975
+ const url = currentUrl();
18976
+ const range = url ? displayedUrlRange(terminal, bufferLineNumber, url) : void 0;
18977
+ if (!url || !range) {
18978
+ callback(void 0);
18979
+ return;
18980
+ }
18981
+ let disposed = false;
18982
+ callback([{
18983
+ range,
18984
+ text: url,
18985
+ activate() {
18986
+ if (disposed || currentUrl() !== url) return;
18987
+ const current = displayedUrlRange(terminal, bufferLineNumber, url);
18988
+ if (!current || current.start.x !== range.start.x || current.start.y !== range.start.y || current.end.x !== range.end.x || current.end.y !== range.end.y) return;
18989
+ open(url);
18990
+ },
18991
+ dispose() {
18992
+ disposed = true;
18993
+ }
18994
+ }]);
18995
+ } };
18996
+ }
18997
+ //#endregion
18673
18998
  //#region lib/types/client/account-terminal.js
18674
18999
  const STARTUP_TIMEOUT_MS = 2e4;
18675
19000
  const CLEANUP_TIMEOUT_MS = 12e3;
19001
+ const MAX_INPUT_BYTES = 16384;
19002
+ function isPasteShortcut(event) {
19003
+ if (event.altKey || event.isComposing) return false;
19004
+ return (event.key.toLowerCase() === "v" || event.code === "KeyV") && event.ctrlKey !== event.metaKey || event.key === "Insert" && event.shiftKey && !event.ctrlKey && !event.metaKey;
19005
+ }
19006
+ function isCopyShortcut(event) {
19007
+ return !event.altKey && !event.isComposing && (event.key.toLowerCase() === "c" || event.code === "KeyC") && event.ctrlKey !== event.metaKey;
19008
+ }
19009
+ function startupMessage(error) {
19010
+ const message = error instanceof Error ? error.message : "";
19011
+ return [
19012
+ "此 CLI 已有账号终端,请先关闭后重试",
19013
+ "当前宿主不支持交互终端",
19014
+ "账号终端尚未确认完全退出,请重启应用",
19015
+ "Windows 账号终端托管不可用,请检查 PowerShell 后重试",
19016
+ "账号终端启动超时,正在回收启动过程;请稍后重试",
19017
+ "无法启动账号终端,请检查 CLI 安装",
19018
+ "CLI 启动入口无法确认,请配置原生程序或固定 Node/Bun 入口",
19019
+ "无法确认 ZCode 账号功能,请检查完整 CLI 安装后重试",
19020
+ "当前 ZCode 未声明原生登录能力,请检查 CLI 安装",
19021
+ "当前 ZCode 未声明原生终端界面,请检查 CLI 安装",
19022
+ "当前 ZCode 未声明原生退出登录能力,请检查 CLI 安装",
19023
+ "ZCode 配套资源不可用,请检查 CLI 安装或配置 zcodeBuiltinConfig",
19024
+ "当前插件 Host 不支持 ZCode 授权来源选择,请更新插件后重试",
19025
+ "不支持的 ZCode 授权来源",
19026
+ "授权来源只支持 ZCode 登录时选择智谱 BigModel 或 Z.AI",
19027
+ "当前 ZCode CLI 不支持智谱 BigModel 授权,请更新为支持 login bigmodel 的官方完整 CLI 后重试;不会改用 Z.AI 登录。",
19028
+ "OMP 执行入口身份不匹配,请检查该 CLI 的安装和路径",
19029
+ "Pi 执行入口身份不匹配,请检查该 CLI 的安装和路径",
19030
+ "Codex Windows 应用包入口无法确认,请检查安装",
19031
+ "Codex npm 安装入口无法确认,请检查安装",
19032
+ "Hermes Windows 安装入口无法确认,请检查安装",
19033
+ "检测到 Hermes 安装目录,但未找到可用 CLI 入口,请完成安装或配置已有入口",
19034
+ "Windows CLI 安装入口无法读取,请检查安装",
19035
+ "Windows CLI 安装目录配置无效",
19036
+ "Windows 系统目录配置无效"
19037
+ ].find((item) => message === item || message === `Error: ${item}`) ?? "账号终端暂不可用,请确认此 CLI 没有运行任务且当前项目允许执行,再重试";
19038
+ }
18676
19039
  async function waitForCleanup(cleanup) {
18677
19040
  let timer;
18678
19041
  try {
@@ -18684,7 +19047,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
18684
19047
  }
18685
19048
  }
18686
19049
  /** Only mounted after a human selects an account action. No prompt is auto-entered. */
18687
- function AccountTerminal({ api, sessionId, cli, action, source, onClose, onFinished }) {
19050
+ function AccountTerminal({ api, sessionId, cli, action, source, provider, onClose, onFinished, closeControl }) {
18688
19051
  const element = (0, react.useRef)(null);
18689
19052
  const callbacks = (0, react.useRef)({
18690
19053
  onClose,
@@ -18695,7 +19058,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
18695
19058
  onFinished
18696
19059
  };
18697
19060
  const stop = (0, react.useRef)(async () => {});
19061
+ const focus = (0, react.useRef)(() => {});
19062
+ const contextClipboard = (0, react.useRef)(async () => {});
18698
19063
  const generation = (0, react.useRef)(0);
19064
+ const closing = (0, react.useRef)();
18699
19065
  const [attempt, setAttempt] = (0, react.useState)(0);
18700
19066
  const [phase, setPhase] = (0, react.useState)("loading");
18701
19067
  const [instruction, setInstruction] = (0, react.useState)("");
@@ -18705,7 +19071,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
18705
19071
  setPhase("loading");
18706
19072
  setInstruction("");
18707
19073
  setNotice("");
18708
- let alive = true, id = "", ended = false, lastSeq = 0, queuedBytes = 0, resizeFrame = 0, viewDisposed = false;
19074
+ let alive = true, id = "", ended = false, cleanupConfirmed = false, lastSeq = 0, queuedBytes = 0, resizeFrame = 0, viewDisposed = false;
18709
19075
  const startup = new AbortController();
18710
19076
  let startupTimer;
18711
19077
  let stream;
@@ -18714,6 +19080,17 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
18714
19080
  let observer;
18715
19081
  let themeObserver;
18716
19082
  let input;
19083
+ let loginLinks;
19084
+ let removePasteListener;
19085
+ let readingClipboard = false;
19086
+ const loginLinkParser = cli === "zcode" && action === "login" ? createZcodeLoginLinkParser(provider) : void 0;
19087
+ let loginUrl;
19088
+ const openedLoginUrls = /* @__PURE__ */ new Set();
19089
+ const clearLoginLink = () => {
19090
+ loginUrl = void 0;
19091
+ loginLinkParser?.reset();
19092
+ openedLoginUrls.clear();
19093
+ };
18717
19094
  let inputQueue = Promise.resolve();
18718
19095
  let stopping;
18719
19096
  const disposeStream = () => {
@@ -18726,6 +19103,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
18726
19103
  };
18727
19104
  const finish = (failed = false) => {
18728
19105
  disableInput();
19106
+ clearLoginLink();
18729
19107
  if (alive) setPhase(failed ? "failed" : "closed");
18730
19108
  if (!ended) {
18731
19109
  ended = true;
@@ -18736,7 +19114,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
18736
19114
  clearTimeout(startupTimer);
18737
19115
  startup.abort();
18738
19116
  disableInput();
18739
- if (!id) return Promise.resolve();
19117
+ clearLoginLink();
19118
+ if (!id || cleanupConfirmed) return Promise.resolve();
18740
19119
  return stopping ??= (async () => {
18741
19120
  value(await api.cliworker.accountStop(sessionId, id));
18742
19121
  if (!ended) finish();
@@ -18765,6 +19144,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
18765
19144
  () => themeObserver?.disconnect(),
18766
19145
  () => cancelAnimationFrame(resizeFrame),
18767
19146
  () => input?.dispose(),
19147
+ () => loginLinks?.dispose(),
19148
+ () => removePasteListener?.(),
18768
19149
  () => terminal?.dispose()
18769
19150
  ]) try {
18770
19151
  dispose();
@@ -18776,15 +19157,97 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
18776
19157
  fontSize: 12,
18777
19158
  fontFamily: "ui-monospace, SFMono-Regular, Menlo, monospace",
18778
19159
  cursorBlink: true,
19160
+ cursorStyle: "block",
19161
+ cursorInactiveStyle: "outline",
18779
19162
  scrollback: 1e3,
18780
19163
  disableStdin: true,
18781
19164
  linkHandler: { activate: () => {} },
18782
19165
  allowProposedApi: false
18783
19166
  });
18784
19167
  const view = terminal;
19168
+ focus.current = () => {
19169
+ if (alive && !ended && !startup.signal.aborted) view.focus();
19170
+ };
18785
19171
  const fit = new import_addon_fit.FitAddon();
18786
19172
  view.loadAddon(fit);
18787
19173
  view.open(element.current);
19174
+ const canWrite = () => alive && !!id && !ended && !startup.signal.aborted && !viewDisposed;
19175
+ const canCopy = () => alive && !viewDisposed && !startup.signal.aborted;
19176
+ const openLoginUrl = (url) => {
19177
+ if (!canWrite() || url !== loginUrl) return;
19178
+ try {
19179
+ window.open(url, "_blank", "noopener,noreferrer");
19180
+ } catch {
19181
+ setNotice("无法打开登录网页,请在终端中查看原生登录提示");
19182
+ }
19183
+ };
19184
+ if (loginLinkParser) loginLinks = view.registerLinkProvider(createZcodeLoginLinkProvider(view, () => canWrite() ? loginUrl : void 0, openLoginUrl));
19185
+ const pasteText = (text) => {
19186
+ if (!canWrite()) return;
19187
+ if (!text) {
19188
+ setNotice("剪贴板中没有可粘贴的文本");
19189
+ return;
19190
+ }
19191
+ setNotice("");
19192
+ view.focus();
19193
+ view.paste(text);
19194
+ };
19195
+ contextClipboard.current = async () => {
19196
+ if (!canCopy() || readingClipboard) return;
19197
+ if (view.hasSelection()) {
19198
+ const text = view.getSelection();
19199
+ if (!text) return;
19200
+ readingClipboard = true;
19201
+ try {
19202
+ const copied = await (0, _deepseek_ai_dsh_client_ui_primitives.writeClipboard)(text);
19203
+ if (!canCopy()) return;
19204
+ if (!copied) setNotice("复制失败,请重新选择文本后重试");
19205
+ else {
19206
+ setNotice("");
19207
+ view.clearSelection();
19208
+ view.focus();
19209
+ }
19210
+ } catch {
19211
+ if (canCopy()) setNotice("复制失败,请重新选择文本后重试");
19212
+ } finally {
19213
+ readingClipboard = false;
19214
+ }
19215
+ return;
19216
+ }
19217
+ if (!canWrite()) return;
19218
+ readingClipboard = true;
19219
+ try {
19220
+ if (!navigator.clipboard?.readText) throw new Error("clipboard unavailable");
19221
+ const text = await navigator.clipboard.readText();
19222
+ pasteText(text);
19223
+ } catch {
19224
+ if (canWrite()) setNotice("无法读取剪贴板,请聚焦终端后按 Ctrl+V(Mac 为 ⌘V)粘贴");
19225
+ } finally {
19226
+ readingClipboard = false;
19227
+ }
19228
+ };
19229
+ view.attachCustomKeyEventHandler((event) => {
19230
+ if (isCopyShortcut(event) && view.hasSelection()) {
19231
+ event.stopPropagation();
19232
+ return false;
19233
+ }
19234
+ if (!isPasteShortcut(event)) return true;
19235
+ event.stopPropagation();
19236
+ return false;
19237
+ });
19238
+ const container = element.current;
19239
+ const onPaste = (event) => {
19240
+ event.preventDefault();
19241
+ event.stopPropagation();
19242
+ if (!canWrite()) return;
19243
+ if (!event.clipboardData) {
19244
+ setNotice("无法读取粘贴内容,请右键重试");
19245
+ return;
19246
+ }
19247
+ pasteText(event.clipboardData.getData("text/plain"));
19248
+ };
19249
+ container.addEventListener("paste", onPaste, { capture: true });
19250
+ removePasteListener = () => container.removeEventListener("paste", onPaste, { capture: true });
18788
19251
  const theme = () => {
18789
19252
  if (!alive || viewDisposed) return;
18790
19253
  try {
@@ -18792,7 +19255,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
18792
19255
  view.options.theme = {
18793
19256
  background: css.getPropertyValue("--dsw-alias-bg-layer-2").trim() || "#ffffff",
18794
19257
  foreground: css.getPropertyValue("--dsw-alias-label-primary").trim() || "#222222",
18795
- cursor: css.getPropertyValue("--dsw-alias-label-primary").trim() || "#222222"
19258
+ cursor: css.getPropertyValue("--dsw-alias-label-primary").trim() || "#222222",
19259
+ cursorAccent: css.getPropertyValue("--dsw-alias-bg-layer-2").trim() || "#ffffff"
18796
19260
  };
18797
19261
  } catch {
18798
19262
  fail("账号终端显示未能初始化,请重试");
@@ -18825,14 +19289,19 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
18825
19289
  observer.observe(element.current);
18826
19290
  resize();
18827
19291
  input = view.onData((data) => {
18828
- if (!alive || !id || ended || startup.signal.aborted || queuedBytes + data.length > 16384) return;
18829
- queuedBytes += data.length;
19292
+ if (!canWrite()) return;
19293
+ const bytes = new TextEncoder().encode(data).byteLength;
19294
+ if (queuedBytes + bytes > MAX_INPUT_BYTES) {
19295
+ setNotice("输入过长或仍在发送,请缩短内容后重试");
19296
+ return;
19297
+ }
19298
+ queuedBytes += bytes;
18830
19299
  inputQueue = inputQueue.then(async () => {
18831
19300
  if (alive && !ended && !startup.signal.aborted) value(await api.cliworker.accountWrite(sessionId, id, data));
18832
19301
  }).catch(() => {
18833
19302
  if (alive) setNotice("输入未能送达,请关闭终端后重试");
18834
19303
  }).finally(() => {
18835
- queuedBytes -= data.length;
19304
+ queuedBytes -= bytes;
18836
19305
  });
18837
19306
  });
18838
19307
  startupTimer = setTimeout(() => {
@@ -18840,7 +19309,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
18840
19309
  }, STARTUP_TIMEOUT_MS);
18841
19310
  (async () => {
18842
19311
  try {
18843
- const result = JSON.parse(value(await (source ? api.cliworker.accountStartForSource(sessionId, cli, action, source, startup.signal) : api.cliworker.accountStart(sessionId, cli, action, startup.signal))));
19312
+ if (provider && typeof api.cliworker.accountStartForProvider !== "function") throw new Error("当前插件 Host 不支持 ZCode 授权来源选择,请更新插件后重试");
19313
+ const result = JSON.parse(value(await (provider ? api.cliworker.accountStartForProvider(sessionId, cli, action, provider, startup.signal) : source ? api.cliworker.accountStartForSource(sessionId, cli, action, source, startup.signal) : api.cliworker.accountStart(sessionId, cli, action, startup.signal))));
18844
19314
  clearTimeout(startupTimer);
18845
19315
  id = result.id;
18846
19316
  if (!alive || startup.signal.aborted) {
@@ -18862,11 +19332,22 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
18862
19332
  const frame = JSON.parse(item.value);
18863
19333
  if (alive && !ended && frame.seq > lastSeq) {
18864
19334
  lastSeq = frame.seq;
18865
- if (frame.data) view.write(frame.data);
19335
+ if (frame.data) {
19336
+ view.write(frame.data);
19337
+ const link = canWrite() ? loginLinkParser?.write(frame.data) : void 0;
19338
+ if (link) {
19339
+ loginUrl = link;
19340
+ if (!openedLoginUrls.has(link)) {
19341
+ openedLoginUrls.add(link);
19342
+ openLoginUrl(link);
19343
+ }
19344
+ }
19345
+ }
18866
19346
  if (frame.message) setNotice(frame.message);
18867
19347
  }
18868
19348
  item.accept();
18869
19349
  if (frame.status === "closed" || frame.status === "failed") {
19350
+ cleanupConfirmed = frame.cleanupConfirmed === true;
18870
19351
  if (!ended) finish(frame.status === "failed");
18871
19352
  break;
18872
19353
  }
@@ -18876,10 +19357,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
18876
19357
  finish(true);
18877
19358
  stopSession().catch(() => void 0);
18878
19359
  }
18879
- } catch {
19360
+ } catch (error) {
18880
19361
  clearTimeout(startupTimer);
18881
19362
  if (alive && !startup.signal.aborted) {
18882
- setNotice("账号终端暂不可用,请确认此 CLI 没有运行任务且当前项目允许执行,再重试");
19363
+ setNotice(startupMessage(error));
18883
19364
  finish(true);
18884
19365
  }
18885
19366
  if (id) stopSession().catch(() => void 0);
@@ -18890,9 +19371,12 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
18890
19371
  } catch {
18891
19372
  fail("账号终端显示未能初始化,请重试");
18892
19373
  disposeView();
19374
+ focus.current = () => {};
19375
+ contextClipboard.current = async () => {};
18893
19376
  }
18894
19377
  return () => {
18895
19378
  alive = false;
19379
+ clearLoginLink();
18896
19380
  if (generation.current === ownGeneration) generation.current++;
18897
19381
  clearTimeout(startupTimer);
18898
19382
  startup.abort();
@@ -18906,27 +19390,47 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
18906
19390
  cli,
18907
19391
  action,
18908
19392
  source,
19393
+ provider,
18909
19394
  attempt
18910
19395
  ]);
18911
- const close = async (retry = false) => {
19396
+ const close = (retry = false) => {
19397
+ if (closing.current) return closing.current;
18912
19398
  const ownGeneration = generation.current;
18913
19399
  setPhase("stopping");
18914
- try {
18915
- await waitForCleanup(stop.current());
18916
- if (generation.current !== ownGeneration) return;
18917
- if (retry) setAttempt((value) => value + 1);
18918
- else callbacks.current.onClose();
18919
- } catch {
18920
- if (generation.current !== ownGeneration) return;
18921
- setPhase("failed");
18922
- setNotice("终端关闭失败,请重试");
18923
- }
19400
+ const operation = (async () => {
19401
+ try {
19402
+ await waitForCleanup(stop.current());
19403
+ if (generation.current !== ownGeneration) return false;
19404
+ if (retry) setAttempt((value) => value + 1);
19405
+ else callbacks.current.onClose();
19406
+ return true;
19407
+ } catch {
19408
+ if (generation.current !== ownGeneration) return false;
19409
+ setPhase("failed");
19410
+ setNotice("终端关闭失败,请重试");
19411
+ return false;
19412
+ }
19413
+ })();
19414
+ closing.current = operation;
19415
+ operation.finally(() => {
19416
+ if (closing.current === operation) closing.current = void 0;
19417
+ });
19418
+ return operation;
18924
19419
  };
19420
+ (0, react.useEffect)(() => {
19421
+ if (!closeControl) return;
19422
+ const request = () => close();
19423
+ closeControl.current = request;
19424
+ return () => {
19425
+ if (closeControl.current === request) closeControl.current = void 0;
19426
+ };
19427
+ });
18925
19428
  return (0, react_jsx_runtime.jsxs)("section", {
18926
19429
  className: "cwn-account-terminal",
18927
19430
  "data-cli": cli,
18928
19431
  children: [
18929
19432
  (0, react_jsx_runtime.jsx)("style", { children: accountTerminalCSS }),
19433
+ (0, react_jsx_runtime.jsx)("style", { children: `.cwn-account-terminal-view:focus-within { outline: none; }` }),
18930
19434
  (0, react_jsx_runtime.jsxs)("div", {
18931
19435
  className: "cwn-account-terminal-head",
18932
19436
  children: [(0, react_jsx_runtime.jsxs)("strong", { children: [CLI_LABELS[cli], " 账号终端"] }), (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
@@ -18952,7 +19456,13 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
18952
19456
  (0, react_jsx_runtime.jsx)("div", {
18953
19457
  className: "cwn-account-terminal-view",
18954
19458
  ref: element,
18955
- "aria-label": `${CLI_LABELS[cli]} 原生账号终端`
19459
+ "aria-label": `${CLI_LABELS[cli]} 原生账号终端`,
19460
+ onClick: () => focus.current(),
19461
+ onContextMenuCapture: (event) => {
19462
+ event.preventDefault();
19463
+ event.stopPropagation();
19464
+ contextClipboard.current();
19465
+ }
18956
19466
  }),
18957
19467
  (phase === "failed" || phase === "closed") && (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
18958
19468
  variant: "ghost",
@@ -19251,6 +19761,58 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
19251
19761
  });
19252
19762
  }
19253
19763
  //#endregion
19764
+ //#region lib/types/client/account-query-queue.js
19765
+ /** Bounds dialog requests. Host owns process cleanup, including after RPC cancellation. */
19766
+ var AccountQueryQueue = class {
19767
+ limit;
19768
+ waiting = /* @__PURE__ */ new Map();
19769
+ running = /* @__PURE__ */ new Map();
19770
+ priority;
19771
+ constructor(limit = 2) {
19772
+ this.limit = limit;
19773
+ }
19774
+ has(key) {
19775
+ const current = this.running.get(key);
19776
+ return this.waiting.has(key) || !!(current && !current.controller.signal.aborted);
19777
+ }
19778
+ enqueue(key, query, replace = false) {
19779
+ if (this.has(key) && !replace) return false;
19780
+ if (replace) this.running.get(key)?.controller.abort();
19781
+ this.waiting.set(key, query);
19782
+ this.drain();
19783
+ return true;
19784
+ }
19785
+ prioritize(key) {
19786
+ this.priority = key;
19787
+ this.drain();
19788
+ }
19789
+ cancel(key) {
19790
+ this.waiting.delete(key);
19791
+ this.running.get(key)?.controller.abort();
19792
+ }
19793
+ clear() {
19794
+ this.waiting.clear();
19795
+ for (const current of this.running.values()) current.controller.abort();
19796
+ }
19797
+ drain() {
19798
+ while (this.running.size < this.limit) {
19799
+ const key = this.priority !== void 0 && this.waiting.has(this.priority) && !this.running.has(this.priority) ? this.priority : [...this.waiting.keys()].find((candidate) => !this.running.has(candidate));
19800
+ if (key === void 0) return;
19801
+ const query = this.waiting.get(key);
19802
+ this.waiting.delete(key);
19803
+ const current = {
19804
+ query,
19805
+ controller: new AbortController()
19806
+ };
19807
+ this.running.set(key, current);
19808
+ Promise.resolve().then(() => current.controller.signal.aborted ? void 0 : query(current.controller.signal)).catch(() => void 0).finally(() => {
19809
+ if (this.running.get(key) === current) this.running.delete(key);
19810
+ this.drain();
19811
+ });
19812
+ }
19813
+ }
19814
+ };
19815
+ //#endregion
19254
19816
  //#region lib/types/client/settings-dialog.js
19255
19817
  function readEnabled(raw) {
19256
19818
  const parsed = JSON.parse(raw);
@@ -19299,7 +19861,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
19299
19861
  };
19300
19862
  if (!account.error && account.data?.state === "unconfigured") return {
19301
19863
  state: "unconfigured",
19302
- label: account.data.installed ? "未登录" : "未安装"
19864
+ label: account.data.installed ? account.data.cli === "claude" ? account.data.summary : "未登录" : "未安装"
19303
19865
  };
19304
19866
  if (account.error || !account.data || ["unavailable", "unauthenticated"].includes(account.data.state)) return {
19305
19867
  state: "failed",
@@ -19335,15 +19897,23 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
19335
19897
  const [accounts, setAccounts] = (0, react.useState)({});
19336
19898
  const enabledRef = (0, react.useRef)(enabled);
19337
19899
  enabledRef.current = enabled;
19338
- const probes = (0, react.useRef)(/* @__PURE__ */ new Map());
19900
+ const probes = (0, react.useRef)(new AccountQueryQueue());
19339
19901
  const toggleController = (0, react.useRef)();
19902
+ const accountClose = (0, react.useRef)();
19903
+ const leaving = (0, react.useRef)(false);
19904
+ const leave = async (transition) => {
19905
+ if (leaving.current) return;
19906
+ leaving.current = true;
19907
+ try {
19908
+ if (accountClose.current && !await accountClose.current()) return;
19909
+ transition();
19910
+ } finally {
19911
+ leaving.current = false;
19912
+ }
19913
+ };
19340
19914
  const refreshAccount = (0, react.useCallback)((id, replace = false) => {
19341
19915
  if (!enabledRef.current?.[id]) return;
19342
- const previous = probes.current.get(id);
19343
- if (previous && !replace) return;
19344
- previous?.abort();
19345
- const controller = new AbortController();
19346
- probes.current.set(id, controller);
19916
+ if (probes.current.has(id) && !replace) return;
19347
19917
  setAccounts((old) => ({
19348
19918
  ...old,
19349
19919
  [id]: {
@@ -19351,11 +19921,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
19351
19921
  loading: true
19352
19922
  }
19353
19923
  }));
19354
- (async () => {
19924
+ probes.current.enqueue(id, async (signal) => {
19355
19925
  try {
19356
- const next = JSON.parse(value(await api.cliworker.accountStatus(sessionId, id, controller.signal)));
19926
+ const next = JSON.parse(value(await api.cliworker.accountStatus(sessionId, id, signal)));
19357
19927
  if (next.cli !== id) throw new Error("收到不匹配的 CLI 账号状态,请重试");
19358
- if (!controller.signal.aborted) setAccounts((old) => ({
19928
+ if (!signal.aborted) setAccounts((old) => ({
19359
19929
  ...old,
19360
19930
  [id]: {
19361
19931
  data: next,
@@ -19363,17 +19933,15 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
19363
19933
  }
19364
19934
  }));
19365
19935
  } catch (error) {
19366
- if (!controller.signal.aborted) setAccounts((old) => ({
19936
+ if (!signal.aborted) setAccounts((old) => ({
19367
19937
  ...old,
19368
19938
  [id]: {
19369
19939
  loading: false,
19370
19940
  error: operationMessage(error)
19371
19941
  }
19372
19942
  }));
19373
- } finally {
19374
- if (probes.current.get(id) === controller) probes.current.delete(id);
19375
19943
  }
19376
- })();
19944
+ }, replace);
19377
19945
  }, [api, sessionId]);
19378
19946
  (0, react.useEffect)(() => {
19379
19947
  const controller = new AbortController();
@@ -19391,24 +19959,27 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
19391
19959
  return () => {
19392
19960
  controller.abort();
19393
19961
  toggleController.current?.abort();
19394
- for (const probe of probes.current.values()) probe.abort();
19395
19962
  probes.current.clear();
19396
19963
  };
19397
19964
  }, [api, sessionId]);
19398
19965
  (0, react.useEffect)(() => {
19399
19966
  if (!enabled) return;
19400
- for (const id of CLI_IDS) if (enabled[id]) {
19967
+ probes.current.prioritize(cli);
19968
+ for (const id of [cli, ...CLI_IDS.filter((id) => id !== cli)]) if (enabled[id]) {
19401
19969
  if (!accounts[id]) refreshAccount(id);
19402
19970
  } else {
19403
- probes.current.get(id)?.abort();
19404
- probes.current.delete(id);
19971
+ probes.current.cancel(id);
19405
19972
  if (accounts[id]) setAccounts((old) => {
19406
19973
  const next = { ...old };
19407
19974
  delete next[id];
19408
19975
  return next;
19409
19976
  });
19410
19977
  }
19411
- }, [enabled, refreshAccount]);
19978
+ }, [
19979
+ enabled,
19980
+ cli,
19981
+ refreshAccount
19982
+ ]);
19412
19983
  async function toggleCli(id, nextValue) {
19413
19984
  if (!enabled || toggleController.current) return;
19414
19985
  const controller = new AbortController();
@@ -19438,7 +20009,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
19438
20009
  }
19439
20010
  return (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Modal, {
19440
20011
  open: true,
19441
- onClose,
20012
+ onClose: () => void leave(onClose),
19442
20013
  title: "CLI Worker 设置",
19443
20014
  closeLabel: "关闭设置",
19444
20015
  className: "cwn-settings-dialog",
@@ -19456,7 +20027,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
19456
20027
  className: "cwn-settings-nav-primary",
19457
20028
  "aria-label": "智能体设置",
19458
20029
  "aria-pressed": page === "roles",
19459
- onClick: () => setPage("roles"),
20030
+ onClick: () => void leave(() => setPage("roles")),
19460
20031
  children: [(0, react_jsx_runtime.jsx)("span", {
19461
20032
  className: "cwn-settings-nav-icon",
19462
20033
  "aria-hidden": "true",
@@ -19510,10 +20081,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
19510
20081
  "aria-pressed": page === "cli" && cli === id,
19511
20082
  tabIndex: cliExpanded ? void 0 : -1,
19512
20083
  "data-enabled": enabled?.[id] !== false,
19513
- onClick: () => {
20084
+ onClick: () => void leave(() => {
19514
20085
  setCli(id);
19515
20086
  setPage("cli");
19516
- },
20087
+ }),
19517
20088
  children: [
19518
20089
  (0, react_jsx_runtime.jsx)(BrandIcon, {
19519
20090
  cli: id,
@@ -19550,6 +20121,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
19550
20121
  api,
19551
20122
  sessionId
19552
20123
  }) : (0, react_jsx_runtime.jsx)(CliSettings, {
20124
+ accountClose,
19553
20125
  openNativeSettings,
19554
20126
  api,
19555
20127
  sessionId,
@@ -19617,7 +20189,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
19617
20189
  const apiLogin = authenticated && data.authMethod === "api";
19618
20190
  const providerLogins = authenticated ? providerLoginSummary(data) : void 0;
19619
20191
  const state = connection.state;
19620
- const label = enabled === false ? "已关闭" : settingsError ? "设置读取失败,请重新打开" : loading && !data ? "正在读取登录信息…" : account?.error ? account.error : connection.state === "failed" ? connection.label : connection.state === "pending" ? "正在检查连接…" : authenticated ? authenticatedLabel(data) : data?.state === "unconfigured" ? data.installed ? "未登录" : "未安装" : data?.state === "configured" ? "已配置" : data?.summary || "状态待确认";
20192
+ const label = enabled === false ? "已关闭" : settingsError ? "设置读取失败,请重新打开" : loading && !data ? "正在读取登录信息…" : account?.error ? account.error : connection.state === "failed" ? connection.label : connection.state === "pending" ? "正在检查连接…" : authenticated ? authenticatedLabel(data) : data?.state === "unconfigured" ? data.installed ? data.cli === "claude" ? data.summary : "未登录" : "未安装" : data?.state === "configured" ? "已配置" : data?.summary || "状态待确认";
19621
20193
  return (0, react_jsx_runtime.jsx)("div", {
19622
20194
  className: "cwn-account-summary",
19623
20195
  "data-account-state": current ? data?.state : void 0,
@@ -19650,7 +20222,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
19650
20222
  })
19651
20223
  });
19652
20224
  }
19653
- function CliSettings({ openNativeSettings, api, sessionId, cli, enabled, account, connection, onRefreshAccount, onToggle, toggleBusy, toggling, settingsError, toggleError }) {
20225
+ function CliSettings({ accountClose, openNativeSettings, api, sessionId, cli, enabled, account, connection, onRefreshAccount, onToggle, toggleBusy, toggling, settingsError, toggleError }) {
19654
20226
  const [catalog, setCatalog] = (0, react.useState)();
19655
20227
  const [modelLoading, setModelLoading] = (0, react.useState)(true);
19656
20228
  const [saving, setSaving] = (0, react.useState)(false);
@@ -19663,6 +20235,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
19663
20235
  const [action, setAction] = (0, react.useState)();
19664
20236
  const [chosenAction, setChosenAction] = (0, react.useState)();
19665
20237
  const [accountSource, setAccountSource] = (0, react.useState)();
20238
+ const [loginProvider, setLoginProvider] = (0, react.useState)();
19666
20239
  const saveController = (0, react.useRef)();
19667
20240
  (0, react.useEffect)(() => () => saveController.current?.abort(), []);
19668
20241
  (0, react.useEffect)(() => {
@@ -19753,10 +20326,12 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
19753
20326
  const closeAccount = () => {
19754
20327
  setAction(void 0);
19755
20328
  setAccountSource(void 0);
20329
+ setLoginProvider(void 0);
19756
20330
  onRefreshAccount(true);
19757
20331
  };
19758
20332
  const sources = chosenAction?.sources?.filter((source, index, all) => ["native", "plugin"].includes(source.id) && all.findIndex((item) => item.id === source.id) === index);
19759
20333
  const choosingSource = action === "logout" && chosenAction?.sources !== void 0 && !accountSource;
20334
+ const choosingLoginProvider = cli === "zcode" && action === "login" && !loginProvider;
19760
20335
  const accountAction = (id) => {
19761
20336
  const item = account?.data?.actions.find((candidate) => candidate.id === id);
19762
20337
  const label = item?.target === "models" ? id === "login" ? "登录设置" : "打开原生设置" : item?.label ?? (id === "logout" ? "退出登录" : id === "manage" ? "账号终端" : [
@@ -19779,6 +20354,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
19779
20354
  return;
19780
20355
  }
19781
20356
  setChosenAction(item);
20357
+ setLoginProvider(void 0);
19782
20358
  setAccountSource(id === "logout" && item.sources?.length === 1 && ["native", "plugin"].includes(item.sources[0].id) ? item.sources[0].id : void 0);
19783
20359
  setAction(item.id);
19784
20360
  }
@@ -19865,12 +20441,31 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
19865
20441
  }),
19866
20442
  action && enabled && (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Modal, {
19867
20443
  open: true,
19868
- onClose: closeAccount,
20444
+ onClose: () => {
20445
+ if (accountClose.current) accountClose.current();
20446
+ else closeAccount();
20447
+ },
19869
20448
  title: `${CLI_LABELS[cli]} · ${chosenAction?.label ?? "账号终端"}`,
19870
20449
  closeLabel: "关闭账号操作",
19871
20450
  className: "cwn-account-dialog",
19872
20451
  contentClassName: "cwn-account-dialog-content",
19873
- children: choosingSource ? (0, react_jsx_runtime.jsxs)("section", {
20452
+ children: choosingLoginProvider ? (0, react_jsx_runtime.jsxs)("section", {
20453
+ "aria-label": "选择 ZCode 授权来源",
20454
+ children: [(0, react_jsx_runtime.jsx)("p", { children: "选择账号所属的服务商" }), (0, react_jsx_runtime.jsxs)("div", {
20455
+ className: "cwn-account-actions",
20456
+ children: [(0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
20457
+ variant: "outline",
20458
+ size: "md",
20459
+ onClick: () => setLoginProvider("bigmodel"),
20460
+ children: "中国智谱 BigModel"
20461
+ }), (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
20462
+ variant: "outline",
20463
+ size: "md",
20464
+ onClick: () => setLoginProvider("zai"),
20465
+ children: "海外 Z.AI"
20466
+ })]
20467
+ })]
20468
+ }) : choosingSource ? (0, react_jsx_runtime.jsxs)("section", {
19874
20469
  "aria-label": "选择退出账号来源",
19875
20470
  children: [(0, react_jsx_runtime.jsx)("p", { children: sources?.length ? "选择要退出的账号来源" : "账号来源不可用,请关闭后刷新状态" }), (0, react_jsx_runtime.jsx)("div", {
19876
20471
  className: "cwn-account-actions",
@@ -19882,11 +20477,13 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
19882
20477
  }, source.id))
19883
20478
  })]
19884
20479
  }) : (0, react_jsx_runtime.jsx)(AccountTerminal, {
20480
+ closeControl: accountClose,
19885
20481
  api,
19886
20482
  sessionId,
19887
20483
  cli,
19888
20484
  action,
19889
20485
  source: accountSource,
20486
+ provider: loginProvider,
19890
20487
  onClose: closeAccount,
19891
20488
  onFinished: finishedAccountAction
19892
20489
  })