dsh-edge 0.18.0 → 0.19.0-alpha.2

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 (118) hide show
  1. package/README.i18n.yaml +2 -2
  2. package/README.md +8 -8
  3. package/README.zh.md +8 -8
  4. package/THIRD_PARTY_NOTICES.md +2011 -449
  5. package/dist/assets/fonts/Montserrat-OFL.txt +93 -0
  6. package/dist/assets/fonts/montserrat-light-Cvd2VjE_.woff2 +0 -0
  7. package/dist/assets/fonts/montserrat-medium-B4OyO9CN.woff2 +0 -0
  8. package/dist/assets/fonts/montserrat-regular-DYep38cA.woff2 +0 -0
  9. package/dist/assets/index-Cq6ljTv2.css +1 -0
  10. package/dist/assets/index-Dy0OhsZ5.js +127 -0
  11. package/dist/assets/langs/asciidoc-Ve4PFQV2.js +2 -0
  12. package/dist/assets/langs/bat-BkioyH1T.js +2 -0
  13. package/dist/assets/langs/bibtex-CHM0blh-.js +2 -0
  14. package/dist/assets/langs/clojure-P80f7IUj.js +2 -0
  15. package/dist/assets/langs/cmake-D1j8_8rp.js +2 -0
  16. package/dist/assets/langs/csv-fuZLfV_i.js +2 -0
  17. package/dist/assets/langs/dart-bE4Kk8sk.js +2 -0
  18. package/dist/assets/langs/diff-D97Zzqfu.js +2 -0
  19. package/dist/assets/langs/dotenv-Da5cRb03.js +2 -0
  20. package/dist/assets/langs/elixir-CvYZzuDY.js +2 -0
  21. package/dist/assets/langs/erlang-DsQrWhSR.js +2 -0
  22. package/dist/assets/langs/fish-BvzEVeQv.js +2 -0
  23. package/dist/assets/langs/fsharp-CXgrBDvD.js +2 -0
  24. package/dist/assets/langs/graphql-DujV8YkJ.js +2 -0
  25. package/dist/assets/langs/groovy-gcz8RCvz.js +2 -0
  26. package/dist/assets/langs/haskell-Df6bDoY_.js +2 -0
  27. package/dist/assets/langs/hcl-BWvSN4gD.js +2 -0
  28. package/dist/assets/langs/html-derivative-DOyKdj44.js +2 -0
  29. package/dist/assets/langs/html-fwsONPVS.js +2 -0
  30. package/dist/assets/langs/http-DcV90OkR.js +2 -0
  31. package/dist/assets/langs/javascript-DI5JR1nB.js +2 -0
  32. package/dist/assets/langs/julia-BpJ6DjL_.js +2 -0
  33. package/dist/assets/langs/latex-B4C7GdlO.js +2 -0
  34. package/dist/assets/langs/log-2UxHyX5q.js +2 -0
  35. package/dist/assets/langs/make-CHLpvVh8.js +2 -0
  36. package/dist/assets/langs/nix-CwoSXNpI.js +2 -0
  37. package/dist/assets/langs/perl-DsWkoyyU.js +2 -0
  38. package/dist/assets/langs/php-LEPfNACG.js +2 -0
  39. package/dist/assets/langs/powershell-Dpen1YoG.js +2 -0
  40. package/dist/assets/langs/proto-C7zT0LnQ.js +2 -0
  41. package/dist/assets/langs/r-Dspwwk_N.js +2 -0
  42. package/dist/assets/langs/rst-BbocfKWr.js +2 -0
  43. package/dist/assets/langs/ruby-R292Iif0.js +2 -0
  44. package/dist/assets/langs/scala-C151Ov-r.js +2 -0
  45. package/dist/assets/langs/svelte-DNMY6jOf.js +2 -0
  46. package/dist/assets/langs/system-verilog-CnnmHF94.js +2 -0
  47. package/dist/assets/langs/vb-D17OF-Vu.js +2 -0
  48. package/dist/assets/langs/verilog-BQ8w6xss.js +2 -0
  49. package/dist/assets/langs/vue-Dq2x6432.js +2 -0
  50. package/dist/favicon-dark.svg +3 -0
  51. package/dist/favicon.svg +0 -5
  52. package/dist/index.html +5 -4
  53. package/dist/manifest.webmanifest +3 -4
  54. package/dist/plugins/@deepseek-ai/dsh-api-gateway/client.js +353 -101
  55. package/dist/plugins/@deepseek-ai/dsh-api-job-controller/client.js +367 -0
  56. package/dist/plugins/@deepseek-ai/dsh-api-remotes/client.js +7223 -3584
  57. package/dist/plugins/@deepseek-ai/dsh-api-session-controller/client.js +1107 -991
  58. package/dist/plugins/@deepseek-ai/dsh-api-workspace-controller/client.js +119 -6
  59. package/dist/plugins/@deepseek-ai/dsh-api-workspace-files/client.js +41 -35
  60. package/dist/plugins/@deepseek-ai/dsh-client-connection/client.js +354 -5279
  61. package/dist/plugins/@deepseek-ai/dsh-client-file-upload/client.js +10 -23
  62. package/dist/plugins/@deepseek-ai/dsh-client-locale/client.js +234 -80
  63. package/dist/plugins/@deepseek-ai/dsh-client-modules/client.js +554 -46
  64. package/dist/plugins/@deepseek-ai/dsh-client-shortcuts/client.js +2006 -0
  65. package/dist/plugins/@deepseek-ai/dsh-client-ui-agent-preset/client.js +1090 -914
  66. package/dist/plugins/@deepseek-ai/dsh-client-ui-approval/client.js +79 -6
  67. package/dist/plugins/@deepseek-ai/dsh-client-ui-attachment/client.js +126 -155
  68. package/dist/plugins/@deepseek-ai/dsh-client-ui-chat/client.js +5776 -1593
  69. package/dist/plugins/@deepseek-ai/dsh-client-ui-commands/client.js +375 -121
  70. package/dist/plugins/@deepseek-ai/dsh-client-ui-conversation/client.js +3524 -1923
  71. package/dist/plugins/@deepseek-ai/dsh-client-ui-deliverables/client.js +1615 -258
  72. package/dist/plugins/@deepseek-ai/dsh-client-ui-directory-picker-browse/client.js +9 -9
  73. package/dist/plugins/@deepseek-ai/dsh-client-ui-goal/client.js +25 -10
  74. package/dist/plugins/@deepseek-ai/dsh-client-ui-input-trigger/client.js +169 -24
  75. package/dist/plugins/@deepseek-ai/dsh-client-ui-jobs/client.js +413 -63
  76. package/dist/plugins/@deepseek-ai/dsh-client-ui-layout/client.js +131 -14
  77. package/dist/plugins/@deepseek-ai/dsh-client-ui-message-feedback/client.js +24 -22
  78. package/dist/plugins/@deepseek-ai/dsh-client-ui-model-selection/client.js +281 -128
  79. package/dist/plugins/@deepseek-ai/dsh-client-ui-open-in-app/client.js +674 -223
  80. package/dist/plugins/@deepseek-ai/dsh-client-ui-plan/client.js +596 -18
  81. package/dist/plugins/@deepseek-ai/dsh-client-ui-reference/client.js +92 -9
  82. package/dist/plugins/@deepseek-ai/dsh-client-ui-renderer/client.js +467 -59
  83. package/dist/plugins/@deepseek-ai/dsh-client-ui-session/client.js +231 -72
  84. package/dist/plugins/@deepseek-ai/dsh-client-ui-settings/client.js +281 -117
  85. package/dist/plugins/@deepseek-ai/dsh-client-ui-settings-general/client.js +642 -122
  86. package/dist/plugins/@deepseek-ai/dsh-client-ui-settings-models/client.js +1565 -438
  87. package/dist/plugins/@deepseek-ai/dsh-client-ui-settings-plugin-inventory/client.js +201 -75
  88. package/dist/plugins/@deepseek-ai/dsh-client-ui-settings-plugins/client.js +30 -1628
  89. package/dist/plugins/@deepseek-ai/dsh-client-ui-shortcuts/client.js +1163 -0
  90. package/dist/plugins/@deepseek-ai/dsh-client-ui-sidebar/client.js +165 -39
  91. package/dist/plugins/@deepseek-ai/dsh-client-ui-sidebar-browser/client.js +1648 -0
  92. package/dist/plugins/@deepseek-ai/dsh-client-ui-sidebar-documentpreview/client.js +5515 -25622
  93. package/dist/plugins/@deepseek-ai/dsh-client-ui-sidebar-files/client.js +419 -118
  94. package/dist/plugins/@deepseek-ai/dsh-client-ui-sidebar-right/client.js +5692 -260
  95. package/dist/plugins/@deepseek-ai/dsh-client-ui-skill/client.js +156 -41
  96. package/dist/plugins/@deepseek-ai/dsh-client-ui-subagent/client.js +386 -263
  97. package/dist/plugins/@deepseek-ai/dsh-client-ui-theme/client.js +183 -73
  98. package/dist/plugins/@deepseek-ai/dsh-client-ui-tool/client.js +2367 -429
  99. package/dist/plugins/@deepseek-ai/dsh-client-ui-trajectory/client.js +788 -270
  100. package/dist/plugins/@deepseek-ai/dsh-client-ui-user-questions/client.js +87 -79
  101. package/dist/plugins/@deepseek-ai/dsh-client-ui-workflow-run/client.js +28 -14
  102. package/dist/plugins/@deepseek-ai/dsh-client-ui-workspace/client.js +2647 -1044
  103. package/dist/plugins/@deepseek-ai/dsh-typert-registry/client.js +22 -7
  104. package/dist/plugins/dsh-edge-client-ui/client.js +1 -10
  105. package/package.json +96 -86
  106. package/scripts/cli.mjs +16 -4
  107. package/scripts/install.d.mts +12 -2
  108. package/scripts/install.mjs +36 -9
  109. package/scripts/legal-files.mjs +15 -0
  110. package/worker/direct/index.js +2564 -1822
  111. package/worker/isolated/index.js +2144 -1402
  112. package/dist/assets/index-BKQ_L1z6.js +0 -117
  113. package/dist/assets/index-DPX2bQLO.css +0 -1
  114. package/dist/assets/langs/html-CfGypltT.js +0 -2
  115. package/dist/assets/langs/php-DJl5gRdb.js +0 -2
  116. package/dist/assets/langs/ruby-5eNB0pDK.js +0 -2
  117. package/dist/plugins/@deepseek-ai/dsh-client-ui-permission-presets/client.js +0 -505
  118. package/dist/plugins/@deepseek-ai/dsh-client-ui-schedule/client.js +0 -307
@@ -55,7 +55,7 @@ window.__ModuleLoader__.load({
55
55
  }
56
56
  //#endregion
57
57
  //#region \0dsh-css:/home/runner/work/deepseek-harness/deepseek-harness/packages/client/ui-settings-models/src/client/ModelsSection.module.css.mjs
58
- const css$3 = ".zGbnIq_section{max-width:720px;color:var(--dsw-alias-label-primary);flex-direction:column;gap:12px;display:flex}.zGbnIq_title{color:var(--dsw-alias-label-primary);margin:0;font-size:16px;font-weight:500;line-height:24px}.zGbnIq_intro{color:var(--dsw-alias-label-tertiary);margin:0;font-size:14px;line-height:22px}.zGbnIq_notice{color:var(--dsw-alias-state-warn-label);margin:0;font-size:12px;line-height:18px}.zGbnIq_savedNotice{color:var(--dsw-alias-state-success-primary);margin:0;font-size:12px;line-height:18px}.zGbnIq_rows{flex-direction:column;gap:8px;margin:12px 0 0;padding:0;list-style:none;display:flex}.zGbnIq_rowCard{border:.5px solid var(--dsw-alias-border-l4);border-radius:16px;flex-direction:column;gap:12px;padding:12px 14px;display:flex}.zGbnIq_rowHead{align-items:center;gap:10px;display:flex}.zGbnIq_rowIdentity{align-items:center;gap:6px;min-width:0;display:inline-flex}.zGbnIq_rowName{color:var(--dsw-alias-label-primary);font-size:14px;font-weight:500;line-height:22px}.zGbnIq_rowTag{border:.5px solid var(--dsw-alias-border-l3);color:var(--dsw-alias-label-secondary);border-radius:4px;flex:none;padding:1px 6px;font-size:11px;line-height:16px}.zGbnIq_credentialDot{box-sizing:border-box;corner-shape:round;border-radius:50%;flex:none;width:8px;height:8px;display:inline-block}.zGbnIq_credentialDotConfigured{background:var(--dsw-alias-state-success-primary)}.zGbnIq_credentialDotMissing{background:var(--dsw-alias-state-error-primary)}.zGbnIq_rowActions{align-items:center;gap:4px;margin-left:auto;display:inline-flex}.zGbnIq_primaryButton,.zGbnIq_secondaryButton,.zGbnIq_addButton{box-sizing:border-box;height:36px;font:inherit;cursor:pointer;border:none;border-radius:18px;justify-content:center;align-items:center;gap:4px;padding:0 14px;font-size:14px;line-height:22px;display:inline-flex}.zGbnIq_primaryButton{background:var(--dsw-alias-button-primary-fill);color:var(--dsw-alias-label-primary-foreground)}.zGbnIq_primaryButton:hover:not(:disabled){background:var(--dsw-alias-button-primary-hover)}.zGbnIq_secondaryButton,.zGbnIq_addButton{border:.5px solid var(--dsw-alias-border-l3);color:var(--dsw-alias-label-primary);background:0 0}.zGbnIq_secondaryButton:hover:not(:disabled),.zGbnIq_addButton:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover)}.zGbnIq_secondaryButton:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover-solid)}.zGbnIq_dangerButton{box-sizing:border-box;height:36px;color:var(--dsw-alias-state-error-primary);font:inherit;cursor:pointer;background:0 0;border:none;border-radius:18px;justify-content:center;align-items:center;padding:0 14px;font-size:14px;line-height:22px;display:inline-flex}.zGbnIq_dangerButton:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover-danger)}.zGbnIq_rowActions .zGbnIq_secondaryButton,.zGbnIq_rowActions .zGbnIq_dangerButton{border-radius:14px;height:28px;padding:0 10px;font-size:12px;line-height:18px}.zGbnIq_primaryButton:disabled,.zGbnIq_secondaryButton:disabled,.zGbnIq_dangerButton:disabled,.zGbnIq_addButton:disabled,.zGbnIq_linkButton:disabled,.zGbnIq_addModelButton:disabled{opacity:.4;cursor:default}.zGbnIq_primaryButton:focus-visible,.zGbnIq_secondaryButton:focus-visible,.zGbnIq_dangerButton:focus-visible,.zGbnIq_addButton:focus-visible,.zGbnIq_linkButton:focus-visible,.zGbnIq_addModelButton:focus-visible,.zGbnIq_iconButton:focus-visible,.zGbnIq_customizedSummary:focus-visible{box-shadow:0 0 0 2px var(--dsw-alias-border-l3);outline:none}.zGbnIq_editor{background:var(--dsw-alias-bg-module-platform);border-radius:12px;flex-direction:column;gap:14px;padding:14px 16px;display:flex}.zGbnIq_editorHeader{align-items:baseline;gap:8px;display:flex}.zGbnIq_editorTitle{color:var(--dsw-alias-label-primary);font-size:14px;font-weight:500;line-height:22px}.zGbnIq_editorRoute{color:var(--dsw-alias-label-tertiary);font-size:12px;line-height:18px}.zGbnIq_field{flex-direction:column;gap:6px;display:flex}.zGbnIq_fieldLabel{color:var(--dsw-alias-label-secondary);align-items:center;gap:10px;font-size:12px;font-weight:500;line-height:18px;display:inline-flex}.zGbnIq_linkButton{box-sizing:border-box;height:28px;color:var(--dsw-alias-label-tertiary);font:inherit;cursor:pointer;background:0 0;border:none;border-radius:14px;align-items:center;padding:0 10px;font-size:12px;line-height:18px;display:inline-flex}.zGbnIq_linkButton:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-secondary)}.zGbnIq_advancedHint{color:var(--dsw-alias-label-tertiary);margin:0;font-size:12px;line-height:18px}.zGbnIq_editorActions{justify-content:flex-end;gap:8px;display:flex}.zGbnIq_addBlock{flex-direction:column;gap:12px;display:flex}.zGbnIq_addActions{flex-wrap:wrap;gap:10px;display:flex}.zGbnIq_addButton{border:1px dashed var(--dsw-alias-border-l3);border-radius:16px;flex:1 1 0;gap:6px;min-width:180px;height:44px}.zGbnIq_addCard,.zGbnIq_setupCard{background:var(--dsw-alias-bg-module-platform);border-radius:12px;flex-direction:column;gap:14px;padding:14px 16px;list-style:none;display:flex}.zGbnIq_addCard .zGbnIq_editor,.zGbnIq_setupCard .zGbnIq_editor{background:0 0;padding:0}.zGbnIq_customized{border-top:.5px solid var(--dsw-alias-border-l2);padding-top:10px}.zGbnIq_customizedSummary{cursor:pointer;width:fit-content;color:var(--dsw-alias-label-secondary);border-radius:6px;align-items:center;gap:6px;margin-left:-4px;padding:2px 4px;font-size:12px;font-weight:500;line-height:18px;list-style:none;display:flex}.zGbnIq_customizedSummary::-webkit-details-marker{display:none}.zGbnIq_customizedSummary:before{content:\"\";border-bottom:1.5px solid;border-right:1.5px solid;width:5px;height:5px;transition:transform .12s;transform:rotate(-45deg)translate(-1px,-1px)}.zGbnIq_customized[open]>.zGbnIq_customizedSummary:before{transform:rotate(45deg)translate(-1px,-1px)}.zGbnIq_customizedSummary:hover{color:var(--dsw-alias-label-primary)}.zGbnIq_customizedBody{flex-direction:column;gap:12px;padding-top:12px;display:flex}.zGbnIq_modelCatalog{border-top:.5px solid var(--dsw-alias-border-l2);flex-direction:column;gap:10px;padding-top:12px;display:flex}.zGbnIq_modelCatalogHeading{flex-direction:column;gap:2px;display:flex}.zGbnIq_modelCatalogTitle{color:var(--dsw-alias-label-secondary);font-size:12px;font-weight:500;line-height:18px}.zGbnIq_modelCatalogMeta,.zGbnIq_modelEmpty{color:var(--dsw-alias-label-tertiary);margin:0;font-size:12px;line-height:18px}.zGbnIq_modelList{flex-direction:column;gap:8px;display:flex}.zGbnIq_modelListHead{justify-content:space-between;align-items:flex-start;gap:12px;display:flex}.zGbnIq_modelEntry{border:.5px solid var(--dsw-alias-border-l4);border-radius:10px;padding:6px}.zGbnIq_modelRow{grid-template-columns:minmax(0,1.4fr) minmax(0,1fr) auto auto;align-items:center;gap:6px;display:grid}.zGbnIq_iconButton{box-sizing:border-box;width:28px;height:28px;color:var(--dsw-alias-label-tertiary);cursor:pointer;background:0 0;border:none;border-radius:6px;justify-content:center;align-items:center;display:inline-flex}.zGbnIq_iconButton:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}.zGbnIq_iconButton:disabled{cursor:default;opacity:.4}.zGbnIq_iconButtonDanger:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover-danger);color:var(--dsw-alias-state-error-primary)}.zGbnIq_modelAdvanced{grid-template-columns:repeat(auto-fit,minmax(160px,1fr));gap:8px;padding:8px 4px 2px;display:grid}.zGbnIq_modelField{flex-direction:column;gap:4px;display:flex}.zGbnIq_modelFieldLabel{color:var(--dsw-alias-label-tertiary);font-size:12px;line-height:18px}.zGbnIq_modelEmpty{border:1px dashed var(--dsw-alias-border-l3);text-align:center;border-radius:8px;padding:12px}.zGbnIq_addModelButton{box-sizing:border-box;border:.5px solid var(--dsw-alias-border-l3);height:28px;color:var(--dsw-alias-label-primary);font:inherit;cursor:pointer;background:0 0;border-radius:14px;align-self:flex-start;align-items:center;gap:4px;padding:0 10px;font-size:12px;line-height:18px;display:inline-flex}.zGbnIq_addModelButton:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover)}.zGbnIq_input{box-sizing:border-box;border:.5px solid var(--dsw-alias-border-l4);width:100%;height:32px;font:inherit;background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-primary);border-radius:8px;padding:0 10px;font-size:14px;line-height:22px}select.zGbnIq_input{cursor:pointer;max-width:240px}.zGbnIq_input:focus{border-color:var(--dsw-alias-brand-primary);outline:none}.zGbnIq_input::placeholder{color:var(--dsw-alias-label-dimmed)}.zGbnIq_input:disabled{opacity:.6;cursor:default}.zGbnIq_selectInput{appearance:none;background-image:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M3 4.5L6 7.5L9 4.5' stroke='%2381858C' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E\");background-position:right 12px center;background-repeat:no-repeat;background-size:12px 12px;padding-right:32px}.zGbnIq_error{color:var(--dsw-alias-state-error-primary);margin:0;font-size:12px;line-height:18px}.zGbnIq_deleteDialog{width:min(480px,100%)}.zGbnIq_deleteConfirm:not(:disabled){border-color:var(--dsw-alias-state-error-primary);color:var(--dsw-alias-state-error-primary)}.zGbnIq_deleteConfirm:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover-danger)}.zGbnIq_hiddenLabel{clip:rect(0 0 0 0);white-space:nowrap;width:1px;height:1px;position:absolute;overflow:hidden}@media (prefers-reduced-motion:reduce){.zGbnIq_customizedSummary:before,.zGbnIq_switchThumb{transition:none}}.zGbnIq_fetchDialog{--dsh-scrollbar-thumb:var(--dsw-alias-scrollbar-bg-l2);--dsh-scrollbar-thumb-hover:var(--dsw-alias-scrollbar-hover-l2);max-width:520px}.zGbnIq_candidateToolbar{align-items:center;gap:8px;margin-bottom:6px;display:flex}.zGbnIq_candidateSearch{flex:240px;min-width:0}.zGbnIq_candidateList{flex-direction:column;gap:2px;max-height:320px;margin:0;padding:0;list-style:none;display:flex;overflow-y:auto}.zGbnIq_candidate{border-radius:6px}.zGbnIq_candidateLabel{cursor:pointer;align-items:center;gap:8px;padding:6px 8px;display:flex}.zGbnIq_candidateId{font-family:var(--ds-font-family-code);overflow-wrap:anywhere;flex:auto;font-size:13px}.zGbnIq_candidateEmpty{color:var(--dsw-alias-label-secondary);text-align:center;margin:24px 0;font-size:13px;line-height:20px}";
58
+ const css$3 = ".zGbnIq_section{max-width:720px;color:var(--dsw-alias-label-primary);flex-direction:column;gap:12px;display:flex}.zGbnIq_title{color:var(--dsw-alias-label-primary);margin:0;font-size:16px;font-weight:500;line-height:24px}.zGbnIq_intro{color:var(--dsw-alias-label-tertiary);margin:0;font-size:14px;line-height:22px}.zGbnIq_notice{color:var(--dsw-alias-state-warn-label);margin:0;font-size:12px;line-height:18px}.zGbnIq_savedNotice{color:var(--dsw-alias-state-success-primary);margin:0;font-size:12px;line-height:18px}.zGbnIq_rows{flex-direction:column;gap:8px;margin:12px 0 0;padding:0;list-style:none;display:flex}.zGbnIq_rowCard{border:.5px solid var(--dsw-alias-settings-card-stroke);background:var(--dsw-alias-settings-card-fill);border-radius:var(--dsw-radius-xl);flex-direction:column;gap:12px;padding:12px 14px;display:flex}.zGbnIq_rowHead{align-items:center;gap:10px;display:flex}.zGbnIq_rowIdentity{align-items:center;gap:6px;min-width:0;display:inline-flex}.zGbnIq_rowName{color:var(--dsw-alias-label-primary);font-size:14px;font-weight:500;line-height:22px}.zGbnIq_rowTag{border:.5px solid var(--dsw-alias-border-l3);border-radius:var(--dsw-radius-xs);color:var(--dsw-alias-label-secondary);flex:none;padding:1px 6px;font-size:11px;line-height:16px}.zGbnIq_credentialDot{box-sizing:border-box;corner-shape:round;border-radius:50%;flex:none;width:8px;height:8px;display:inline-block}.zGbnIq_credentialDotConfigured{background:var(--dsw-alias-state-success-primary)}.zGbnIq_credentialDotMissing{background:var(--dsw-alias-state-error-primary)}.zGbnIq_rowActions{align-items:center;gap:4px;margin-left:auto;display:inline-flex}.zGbnIq_primaryButton,.zGbnIq_secondaryButton,.zGbnIq_addButton{box-sizing:border-box;border-radius:var(--dsw-radius-md);height:36px;font:inherit;cursor:pointer;border:none;justify-content:center;align-items:center;gap:4px;padding:0 14px;font-size:14px;line-height:22px;display:inline-flex}.zGbnIq_primaryButton{background:var(--dsw-alias-button-primary-fill);color:var(--dsw-alias-label-primary-foreground)}.zGbnIq_primaryButton:hover:not(:disabled){background:var(--dsw-alias-button-primary-hover)}.zGbnIq_secondaryButton,.zGbnIq_addButton{border:.5px solid var(--dsw-alias-border-l3);color:var(--dsw-alias-label-primary);background:0 0}.zGbnIq_secondaryButton:hover:not(:disabled),.zGbnIq_addButton:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover)}.zGbnIq_secondaryButton:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover-solid)}.zGbnIq_dangerButton{box-sizing:border-box;border-radius:var(--dsw-radius-md);height:36px;color:var(--dsw-alias-state-error-primary);font:inherit;cursor:pointer;background:0 0;border:none;justify-content:center;align-items:center;padding:0 14px;font-size:14px;line-height:22px;display:inline-flex}.zGbnIq_dangerButton:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover-danger)}.zGbnIq_rowActions .zGbnIq_secondaryButton,.zGbnIq_rowActions .zGbnIq_dangerButton{border-radius:var(--dsw-radius-sm);height:28px;padding:0 10px;font-size:12px;line-height:18px}.zGbnIq_primaryButton:disabled,.zGbnIq_secondaryButton:disabled,.zGbnIq_dangerButton:disabled,.zGbnIq_addButton:disabled,.zGbnIq_linkButton:disabled,.zGbnIq_addModelButton:disabled{opacity:.4;cursor:default}.zGbnIq_primaryButton:focus-visible,.zGbnIq_secondaryButton:focus-visible,.zGbnIq_dangerButton:focus-visible,.zGbnIq_addButton:focus-visible,.zGbnIq_linkButton:focus-visible,.zGbnIq_addModelButton:focus-visible,.zGbnIq_iconButton:focus-visible,.zGbnIq_customizedSummary:focus-visible{box-shadow:0 0 0 2px var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline:none}.zGbnIq_editor{border-radius:var(--dsw-radius-lg);background:var(--dsw-alias-bg-module-platform);flex-direction:column;gap:14px;padding:14px 16px;display:flex}.zGbnIq_editorHeader{align-items:baseline;gap:8px;display:flex}.zGbnIq_editorTitle{color:var(--dsw-alias-label-primary);font-size:14px;font-weight:500;line-height:22px}.zGbnIq_editorRoute{color:var(--dsw-alias-label-tertiary);font-size:12px;line-height:18px}.zGbnIq_field{flex-direction:column;gap:6px;display:flex}.zGbnIq_fieldLabel{color:var(--dsw-alias-label-secondary);align-items:center;gap:10px;font-size:12px;font-weight:500;line-height:18px;display:inline-flex}.zGbnIq_linkButton{box-sizing:border-box;border-radius:var(--dsw-radius-sm);height:28px;color:var(--dsw-alias-label-tertiary);font:inherit;cursor:pointer;background:0 0;border:none;align-items:center;padding:0 10px;font-size:12px;line-height:18px;display:inline-flex}.zGbnIq_linkButton:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-secondary)}.zGbnIq_advancedHint{color:var(--dsw-alias-label-tertiary);margin:0;font-size:12px;line-height:18px}.zGbnIq_editorActions{justify-content:flex-end;gap:8px;display:flex}.zGbnIq_addBlock{flex-direction:column;gap:12px;display:flex}.zGbnIq_addActions{display:flex}.zGbnIq_addButton{border:1px dashed var(--dsw-alias-border-l3);border-radius:var(--dsw-radius-lg);flex:1 1 0;gap:6px;min-width:180px;height:44px}.zGbnIq_addModes{flex-direction:column;align-items:flex-start;gap:8px;display:flex}.zGbnIq_addPanel{flex-direction:column;gap:14px;display:flex}.zGbnIq_addPanel[hidden]{display:none}.zGbnIq_addCard,.zGbnIq_setupCard{border-radius:var(--dsw-radius-lg);background:var(--dsw-alias-bg-module-platform);flex-direction:column;gap:14px;padding:14px 16px;list-style:none;display:flex}.zGbnIq_addCard .zGbnIq_editor,.zGbnIq_setupCard .zGbnIq_editor{background:0 0;padding:0}.zGbnIq_customized{border-top:.5px solid var(--dsw-alias-border-l2);padding-top:10px}.zGbnIq_customizedSummary{border-radius:var(--dsw-radius-sm);cursor:pointer;width:fit-content;color:var(--dsw-alias-label-secondary);align-items:center;gap:6px;margin-left:-4px;padding:2px 4px;font-size:12px;font-weight:500;line-height:18px;list-style:none;display:flex}.zGbnIq_customizedSummary::-webkit-details-marker{display:none}.zGbnIq_customizedSummary:before{content:\"\";border-bottom:1.5px solid;border-right:1.5px solid;width:5px;height:5px;transition:transform .12s;transform:rotate(-45deg)translate(-1px,-1px)}.zGbnIq_customized[open]>.zGbnIq_customizedSummary:before{transform:rotate(45deg)translate(-1px,-1px)}.zGbnIq_customizedSummary:hover{color:var(--dsw-alias-label-primary)}.zGbnIq_customizedBody{flex-direction:column;gap:12px;padding-top:12px;display:flex}.zGbnIq_modelCatalog{border-top:.5px solid var(--dsw-alias-border-l2);flex-direction:column;gap:10px;padding-top:12px;display:flex}.zGbnIq_modelCatalogHeading{flex-direction:column;gap:2px;display:flex}.zGbnIq_modelCatalogTitle{color:var(--dsw-alias-label-secondary);font-size:12px;font-weight:500;line-height:18px}.zGbnIq_modelCatalogMeta,.zGbnIq_modelEmpty{color:var(--dsw-alias-label-tertiary);margin:0;font-size:12px;line-height:18px}.zGbnIq_modelList{flex-direction:column;gap:8px;display:flex}.zGbnIq_modelListHead{justify-content:space-between;align-items:flex-start;gap:12px;display:flex}.zGbnIq_modelEntry{border:.5px solid var(--dsw-alias-border-l4);border-radius:var(--dsw-radius-lg);padding:6px}.zGbnIq_modelRow{grid-template-columns:minmax(0,1.4fr) minmax(0,1fr) auto auto;align-items:center;gap:6px;display:grid}.zGbnIq_iconButton{box-sizing:border-box;border-radius:var(--dsw-radius-sm);width:28px;height:28px;color:var(--dsw-alias-label-tertiary);cursor:pointer;background:0 0;border:none;justify-content:center;align-items:center;display:inline-flex}.zGbnIq_iconButton:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}.zGbnIq_iconButton:disabled{cursor:default;opacity:.4}.zGbnIq_iconButtonDanger:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover-danger);color:var(--dsw-alias-state-error-primary)}.zGbnIq_modelAdvanced{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;padding:8px 4px 2px;display:grid}.zGbnIq_modelField{flex-direction:column;gap:4px;min-width:0;display:flex}.zGbnIq_modelInputTypes{border:none;grid-column:1/-1;min-width:0;margin:0;padding:0}.zGbnIq_modelInputTypes legend{margin-bottom:4px;padding:0}.zGbnIq_modelInputChoices{flex-wrap:wrap;align-items:center;gap:16px;min-height:32px;display:flex}.zGbnIq_modelFieldLabel{color:var(--dsw-alias-label-tertiary);font-size:12px;line-height:18px}.zGbnIq_modelEmpty{border:1px dashed var(--dsw-alias-border-l3);border-radius:var(--dsw-radius-lg);text-align:center;padding:12px}.zGbnIq_addModelButton{box-sizing:border-box;border:.5px solid var(--dsw-alias-border-l3);border-radius:var(--dsw-radius-sm);height:28px;color:var(--dsw-alias-label-primary);font:inherit;cursor:pointer;background:0 0;align-self:flex-start;align-items:center;gap:4px;padding:0 10px;font-size:12px;line-height:18px;display:inline-flex}.zGbnIq_addModelButton:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover)}.zGbnIq_input{box-sizing:border-box;border:.5px solid var(--dsw-alias-border-l4);border-radius:var(--dsw-radius-md);width:100%;height:32px;font:inherit;background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-primary);padding:0 10px;font-size:14px;line-height:22px}select.zGbnIq_input{cursor:pointer;max-width:240px}.zGbnIq_input:focus{border-color:var(--dsw-alias-state-business-primary);outline:none}.zGbnIq_input::placeholder{color:var(--dsw-alias-label-dimmed)}.zGbnIq_input:disabled{opacity:.6;cursor:default}.zGbnIq_selectInput{appearance:none;background-image:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M3 4.5L6 7.5L9 4.5' stroke='%2381858C' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E\");background-position:right 12px center;background-repeat:no-repeat;background-size:12px 12px;padding-right:32px}.zGbnIq_error{color:var(--dsw-alias-state-error-primary);margin:0;font-size:12px;line-height:18px}.zGbnIq_deleteDialog{width:min(480px,100%)}.zGbnIq_deleteConfirm:not(:disabled){border-color:var(--dsw-alias-state-error-primary);color:var(--dsw-alias-state-error-primary)}.zGbnIq_deleteConfirm:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover-danger)}.zGbnIq_hiddenLabel{clip:rect(0 0 0 0);white-space:nowrap;width:1px;height:1px;position:absolute;overflow:hidden}@media (prefers-reduced-motion:reduce){.zGbnIq_customizedSummary:before,.zGbnIq_switchThumb{transition:none}}.zGbnIq_fetchDialog{--dsh-scrollbar-thumb:var(--dsw-alias-scrollbar-bg-l2);--dsh-scrollbar-thumb-hover:var(--dsw-alias-scrollbar-hover-l2);max-width:520px}.zGbnIq_candidateToolbar{align-items:center;gap:8px;margin-bottom:6px;display:flex}.zGbnIq_candidateSearch{flex:240px;min-width:0}.zGbnIq_candidateList{flex-direction:column;gap:2px;max-height:320px;margin:0;padding:0;list-style:none;display:flex;overflow-y:auto}.zGbnIq_candidate{border-radius:var(--dsw-radius-md)}.zGbnIq_candidateLabel{cursor:pointer;align-items:center;gap:8px;padding:6px 8px;display:flex}.zGbnIq_candidateId{min-width:0;font-family:var(--ds-font-family-code);text-overflow:ellipsis;white-space:nowrap;flex:auto;font-size:13px;overflow:hidden}.zGbnIq_candidateEmpty{color:var(--dsw-alias-label-secondary);text-align:center;margin:24px 0;font-size:13px;line-height:20px}";
59
59
  const tagId$3 = "@deepseek-ai/dsh-client-ui-settings-models/ModelsSection.module.css";
60
60
  if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$3) + "]") === null) {
61
61
  const tag = document.createElement("style");
@@ -70,6 +70,8 @@ window.__ModuleLoader__.load({
70
70
  "addButton": "zGbnIq_addButton",
71
71
  "addCard": "zGbnIq_addCard",
72
72
  "addModelButton": "zGbnIq_addModelButton",
73
+ "addModes": "zGbnIq_addModes",
74
+ "addPanel": "zGbnIq_addPanel",
73
75
  "advancedHint": "zGbnIq_advancedHint",
74
76
  "candidate": "zGbnIq_candidate",
75
77
  "candidateEmpty": "zGbnIq_candidateEmpty",
@@ -111,6 +113,8 @@ window.__ModuleLoader__.load({
111
113
  "modelEntry": "zGbnIq_modelEntry",
112
114
  "modelField": "zGbnIq_modelField",
113
115
  "modelFieldLabel": "zGbnIq_modelFieldLabel",
116
+ "modelInputChoices": "zGbnIq_modelInputChoices",
117
+ "modelInputTypes": "zGbnIq_modelInputTypes",
114
118
  "modelList": "zGbnIq_modelList",
115
119
  "modelListHead": "zGbnIq_modelListHead",
116
120
  "modelRow": "zGbnIq_modelRow",
@@ -158,6 +162,122 @@ window.__ModuleLoader__.load({
158
162
  });
159
163
  }
160
164
  //#endregion
165
+ //#region lib/types/client/ModelInputTypes.js
166
+ /**
167
+ * Edit a nonempty set of input types, displaying inherited types before an override exists.
168
+ * @param props - model declaration and row replacement action.
169
+ * @returns the labeled text and image checkboxes.
170
+ */
171
+ function ModelInputTypes({ model, field, position, disabled, fallback, t, onChange }) {
172
+ const modalities = model[field];
173
+ const selected = Array.isArray(modalities) && modalities.length > 0 ? modalities : fallback ?? ["text"];
174
+ return (0, react_jsx_runtime.jsxs)("fieldset", {
175
+ className: ModelsSection_module_css_default["modelInputTypes"],
176
+ "aria-label": `${t("modelInputTypes")} ${String(position)}`,
177
+ children: [(0, react_jsx_runtime.jsx)("legend", {
178
+ className: ModelsSection_module_css_default["modelFieldLabel"],
179
+ children: t("modelInputTypes")
180
+ }), (0, react_jsx_runtime.jsx)("div", {
181
+ className: ModelsSection_module_css_default["modelInputChoices"],
182
+ children: ["text", "image"].map((modality) => (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Checkbox, {
183
+ label: t(modality === "text" ? "modelInputText" : "modelInputImage"),
184
+ checked: selected.includes(modality),
185
+ disabled: disabled || selected.length === 1 && selected.includes(modality),
186
+ onChange: (checked) => {
187
+ const nextSelected = ["text", "image"].filter((value) => value === modality ? checked : selected.includes(value));
188
+ const next = {
189
+ ...model,
190
+ [field]: nextSelected
191
+ };
192
+ if (field === "inputModalities" && !nextSelected.includes("image")) {
193
+ Reflect.deleteProperty(next, "imagePixelBudget");
194
+ Reflect.deleteProperty(next, "imageMaxBytes");
195
+ }
196
+ onChange(next);
197
+ }
198
+ }, modality))
199
+ })]
200
+ });
201
+ }
202
+ //#endregion
203
+ //#region lib/types/client/ModelRow.js
204
+ /**
205
+ * Render consistent model identity, capacity, and input-type controls.
206
+ * @param props - drafted fields and their owning editor's actions.
207
+ * @returns one expandable model entry.
208
+ */
209
+ function ModelRow(props) {
210
+ const { model, position, t, disabled } = props;
211
+ return (0, react_jsx_runtime.jsxs)("div", {
212
+ className: ModelsSection_module_css_default["modelEntry"],
213
+ children: [(0, react_jsx_runtime.jsxs)("div", {
214
+ className: ModelsSection_module_css_default["modelRow"],
215
+ children: [
216
+ ["id", "name"].map((field) => (0, react_jsx_runtime.jsx)("input", {
217
+ className: ModelsSection_module_css_default["input"],
218
+ type: "text",
219
+ value: typeof model[field] === "string" ? model[field] : "",
220
+ placeholder: t(field === "id" ? "modelId" : "modelName"),
221
+ "aria-label": `${t(field === "id" ? "modelId" : "modelName")} ${String(position)}`,
222
+ disabled,
223
+ onChange: (event) => {
224
+ const value = event.target.value;
225
+ props.onFieldChange(field, field === "name" && value === "" ? void 0 : value);
226
+ },
227
+ onBlur: field === "id" ? (event) => props.onIdBlur?.(event.target.value) : void 0
228
+ }, field)),
229
+ (0, react_jsx_runtime.jsx)("button", {
230
+ type: "button",
231
+ className: ModelsSection_module_css_default["iconButton"],
232
+ "aria-label": `${t("modelAdvanced")} ${String(position)}`,
233
+ "aria-expanded": props.expanded,
234
+ title: t("modelAdvanced"),
235
+ onClick: props.onToggle,
236
+ children: props.expanded ? (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconChevronDownOutlineRegular, {}) : (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconChevronRightOutlineRegular, {})
237
+ }),
238
+ (0, react_jsx_runtime.jsx)("button", {
239
+ type: "button",
240
+ className: `${ModelsSection_module_css_default["iconButton"]} ${ModelsSection_module_css_default["iconButtonDanger"]}`,
241
+ "aria-label": `${t("removeModel")} ${String(position)}`,
242
+ title: t("removeModel"),
243
+ disabled,
244
+ onClick: props.onRemove,
245
+ children: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconTrashOutlineRegular, { size: 14 })
246
+ })
247
+ ]
248
+ }), props.expanded ? (0, react_jsx_runtime.jsxs)("div", {
249
+ className: ModelsSection_module_css_default["modelAdvanced"],
250
+ children: [["contextWindow", "maxTokens"].map((field) => (0, react_jsx_runtime.jsxs)("label", {
251
+ className: ModelsSection_module_css_default["modelField"],
252
+ children: [(0, react_jsx_runtime.jsx)("span", {
253
+ className: ModelsSection_module_css_default["modelFieldLabel"],
254
+ children: t(field)
255
+ }), (0, react_jsx_runtime.jsx)("input", {
256
+ className: ModelsSection_module_css_default["input"],
257
+ type: "text",
258
+ inputMode: "numeric",
259
+ value: props[field].value,
260
+ placeholder: props[field].placeholder,
261
+ "aria-label": `${t(field)} ${String(position)}`,
262
+ disabled,
263
+ onChange: (event) => {
264
+ props[field].onChange(event.target.value);
265
+ },
266
+ onBlur: props[field].onBlur
267
+ })]
268
+ }, field)), (0, react_jsx_runtime.jsx)(ModelInputTypes, {
269
+ model,
270
+ field: props.inputField,
271
+ position,
272
+ fallback: props.inputFallback,
273
+ disabled: disabled || props.inputLoading === true,
274
+ t,
275
+ onChange: props.onChange
276
+ })]
277
+ }) : null]
278
+ });
279
+ }
280
+ //#endregion
161
281
  //#region lib/types/client/DeepSeekModelsEditor.js
162
282
  /**
163
283
  * Curated editor for the direct DeepSeek adapter's advisory model catalog.
@@ -252,7 +372,7 @@ window.__ModuleLoader__.load({
252
372
  }
253
373
  /**
254
374
  * Render the direct DeepSeek adapter's model catalog: id and display name on
255
- * each row, capacities behind the row's own disclosure.
375
+ * each row, capacities and input types behind the row's own disclosure.
256
376
  * @param props - effective rows plus the array-level override actions.
257
377
  * @returns the catalog editor.
258
378
  */
@@ -320,29 +440,16 @@ window.__ModuleLoader__.load({
320
440
  return next;
321
441
  });
322
442
  };
323
- /** One capacity field of one row, rendered inside the row's disclosure. */
324
- const capacityField = (model, index, field, fallback) => (0, react_jsx_runtime.jsxs)("label", {
325
- className: ModelsSection_module_css_default["modelField"],
326
- children: [(0, react_jsx_runtime.jsx)("span", {
327
- className: ModelsSection_module_css_default["modelFieldLabel"],
328
- children: props.t(field === "contextWindow" ? "contextWindow" : "maxTokens")
329
- }), (0, react_jsx_runtime.jsx)("input", {
330
- className: ModelsSection_module_css_default["input"],
331
- type: "text",
332
- inputMode: "numeric",
333
- value: capacityText(model, index, field),
334
- placeholder: fallback === void 0 ? props.t(field === "contextWindow" ? "contextWindowPlaceholder" : "maxTokensPlaceholder") : formatCapacity(fallback),
335
- "aria-label": `${props.t(field === "contextWindow" ? "contextWindow" : "maxTokens")} ${String(index + 1)}`,
336
- disabled: props.disabled,
337
- onChange: (event) => {
338
- const text = event.target.value;
339
- setEditing((current) => new Map(current).set(`${String(index)}:${field}`, text));
340
- update(index, field, parseCapacity(text));
341
- },
342
- onBlur: () => {
343
- settleCapacity(index, field);
344
- }
345
- })]
443
+ const capacityInput = (model, index, field, fallback) => ({
444
+ value: capacityText(model, index, field),
445
+ placeholder: fallback === void 0 ? props.t(field === "contextWindow" ? "contextWindowPlaceholder" : "maxTokensPlaceholder") : formatCapacity(fallback),
446
+ onChange: (text) => {
447
+ setEditing((current) => new Map(current).set(`${String(index)}:${field}`, text));
448
+ update(index, field, parseCapacity(text));
449
+ },
450
+ onBlur: () => {
451
+ settleCapacity(index, field);
452
+ }
346
453
  });
347
454
  return (0, react_jsx_runtime.jsxs)("section", {
348
455
  className: ModelsSection_module_css_default["modelCatalog"],
@@ -372,64 +479,31 @@ window.__ModuleLoader__.load({
372
479
  children: props.t("modelsEmpty")
373
480
  }) : (0, react_jsx_runtime.jsx)("div", {
374
481
  className: ModelsSection_module_css_default["modelList"],
375
- children: props.models.map((model, index) => (0, react_jsx_runtime.jsxs)("div", {
376
- className: ModelsSection_module_css_default["modelEntry"],
377
- children: [(0, react_jsx_runtime.jsxs)("div", {
378
- className: ModelsSection_module_css_default["modelRow"],
379
- children: [
380
- (0, react_jsx_runtime.jsx)("input", {
381
- className: ModelsSection_module_css_default["input"],
382
- type: "text",
383
- value: typeof model["id"] === "string" ? model["id"] : "",
384
- placeholder: props.t("modelId"),
385
- "aria-label": `${props.t("modelId")} ${String(index + 1)}`,
386
- disabled: props.disabled,
387
- onChange: (event) => {
388
- update(index, "id", event.target.value);
389
- },
390
- onBlur: (event) => {
391
- const trimmed = event.target.value.trim();
392
- if (trimmed !== event.target.value) update(index, "id", trimmed);
393
- }
394
- }),
395
- (0, react_jsx_runtime.jsx)("input", {
396
- className: ModelsSection_module_css_default["input"],
397
- type: "text",
398
- value: typeof model["name"] === "string" ? model["name"] : "",
399
- placeholder: props.t("modelName"),
400
- "aria-label": `${props.t("modelName")} ${String(index + 1)}`,
401
- disabled: props.disabled,
402
- onChange: (event) => {
403
- update(index, "name", event.target.value === "" ? void 0 : event.target.value);
404
- }
405
- }),
406
- (0, react_jsx_runtime.jsx)("button", {
407
- type: "button",
408
- className: ModelsSection_module_css_default["iconButton"],
409
- "aria-label": `${props.t("modelAdvanced")} ${String(index + 1)}`,
410
- "aria-expanded": expanded.has(index),
411
- title: props.t("modelAdvanced"),
412
- onClick: () => {
413
- toggle(index);
414
- },
415
- children: expanded.has(index) ? (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconChevronDownOutline14, {}) : (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconChevronRightOutline14, {})
416
- }),
417
- (0, react_jsx_runtime.jsx)("button", {
418
- type: "button",
419
- className: `${ModelsSection_module_css_default["iconButton"]} ${ModelsSection_module_css_default["iconButtonDanger"]}`,
420
- "aria-label": `${props.t("removeModel")} ${String(index + 1)}`,
421
- title: props.t("removeModel"),
422
- disabled: props.disabled,
423
- onClick: () => {
424
- remove(index);
425
- },
426
- children: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconTrashOutline16, { size: 14 })
427
- })
428
- ]
429
- }), expanded.has(index) ? (0, react_jsx_runtime.jsxs)("div", {
430
- className: ModelsSection_module_css_default["modelAdvanced"],
431
- children: [capacityField(model, index, "contextWindow", props.defaultContextWindow), capacityField(model, index, "maxTokens", props.defaultMaxTokens)]
432
- }) : null]
482
+ children: props.models.map((model, index) => (0, react_jsx_runtime.jsx)(ModelRow, {
483
+ model,
484
+ position: index + 1,
485
+ inputField: "inputModalities",
486
+ expanded: expanded.has(index),
487
+ disabled: props.disabled,
488
+ t: props.t,
489
+ contextWindow: capacityInput(model, index, "contextWindow", props.defaultContextWindow),
490
+ maxTokens: capacityInput(model, index, "maxTokens", props.defaultMaxTokens),
491
+ onFieldChange: (field, value) => {
492
+ update(index, field, value);
493
+ },
494
+ onIdBlur: (value) => {
495
+ const trimmed = value.trim();
496
+ if (trimmed !== value) update(index, "id", trimmed);
497
+ },
498
+ onChange: (next) => {
499
+ props.onChange(props.models.map((row, at) => at === index ? next : row));
500
+ },
501
+ onToggle: () => {
502
+ toggle(index);
503
+ },
504
+ onRemove: () => {
505
+ remove(index);
506
+ }
433
507
  }, index))
434
508
  }),
435
509
  (0, react_jsx_runtime.jsxs)("button", {
@@ -439,7 +513,7 @@ window.__ModuleLoader__.load({
439
513
  onClick: () => {
440
514
  props.onChange([...props.models.map((model) => ({ ...model })), { id: "" }]);
441
515
  },
442
- children: [(0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconPlusOutline16, { size: 14 }), props.t("addModel")]
516
+ children: [(0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconPlusOutlineRegular, { size: 14 }), props.t("addModel")]
443
517
  })
444
518
  ]
445
519
  });
@@ -471,44 +545,6 @@ window.__ModuleLoader__.load({
471
545
  const value = model[key];
472
546
  return typeof value === "number" ? value : void 0;
473
547
  }
474
- /** Disclosure chevron; rotates to point down while its row is open. */
475
- function IconChevron({ open }) {
476
- return (0, react_jsx_runtime.jsx)("svg", {
477
- width: "14",
478
- height: "14",
479
- viewBox: "0 0 16 16",
480
- fill: "none",
481
- "aria-hidden": true,
482
- style: {
483
- transform: open ? "rotate(90deg)" : void 0,
484
- transition: "transform 120ms ease"
485
- },
486
- children: (0, react_jsx_runtime.jsx)("path", {
487
- d: "M6 3.5L10.5 8L6 12.5",
488
- stroke: "currentColor",
489
- strokeWidth: "1.5",
490
- strokeLinecap: "round",
491
- strokeLinejoin: "round"
492
- })
493
- });
494
- }
495
- /** Removal glyph for one model row. */
496
- function IconTrash() {
497
- return (0, react_jsx_runtime.jsx)("svg", {
498
- width: "14",
499
- height: "14",
500
- viewBox: "0 0 16 16",
501
- fill: "none",
502
- "aria-hidden": true,
503
- children: (0, react_jsx_runtime.jsx)("path", {
504
- d: "M2.5 4h11M6.5 4V2.5h3V4M4 4l.7 9a1 1 0 001 .9h4.6a1 1 0 001-.9L12 4M6.5 6.8v4.4M9.5 6.8v4.4",
505
- stroke: "currentColor",
506
- strokeWidth: "1.3",
507
- strokeLinecap: "round",
508
- strokeLinejoin: "round"
509
- })
510
- });
511
- }
512
548
  /**
513
549
  * What an empty capacity field is worth, shown as its placeholder so a row left
514
550
  * blank does not read as a model with no capacity at all.
@@ -534,13 +570,14 @@ window.__ModuleLoader__.load({
534
570
  function capacitySpelling(value) {
535
571
  return value === void 0 ? "" : formatCapacity(value);
536
572
  }
537
- /** Adopt a candidate, keeping whatever capacities the provider disclosed. */
573
+ /** Adopt a candidate, preserving disclosed capacities and input types. */
538
574
  function adopt(candidate) {
539
575
  return {
540
576
  id: candidate.id,
541
577
  ...candidate.name === void 0 ? {} : { name: candidate.name },
542
578
  ...candidate.contextWindow === void 0 ? {} : { contextWindow: candidate.contextWindow },
543
- ...candidate.maxTokens === void 0 ? {} : { maxTokens: candidate.maxTokens }
579
+ ...candidate.maxTokens === void 0 ? {} : { maxTokens: candidate.maxTokens },
580
+ ...candidate.inputModalities === void 0 ? {} : { input: [...candidate.inputModalities] }
544
581
  };
545
582
  }
546
583
  /**
@@ -549,9 +586,35 @@ window.__ModuleLoader__.load({
549
586
  * @returns the model-list editor.
550
587
  */
551
588
  function ModelListEditor(props) {
552
- const { models, onChange, probe, operations, t, disabled } = props;
589
+ const { models, onChange, probe, operations, t, disabled, onBusyChange } = props;
590
+ const { catalogProvider } = props;
553
591
  const [busy, setBusy] = (0, react.useState)(false);
592
+ (0, react.useEffect)(() => {
593
+ onBusyChange(busy);
594
+ }, [busy, onBusyChange]);
554
595
  const [failure, setFailure] = (0, react.useState)(void 0);
596
+ const [inheritedCatalog, setInheritedCatalog] = (0, react.useState)(void 0);
597
+ (0, react.useEffect)(() => {
598
+ if (catalogProvider === void 0) return;
599
+ let current = true;
600
+ operations.discoverModels(probe.settingsNs, { provider: catalogProvider }).then((answer) => {
601
+ if (!current) return;
602
+ setInheritedCatalog({
603
+ provider: catalogProvider,
604
+ models: answer.kind === "found" ? answer.models : []
605
+ });
606
+ setFailure(answer.kind === "refused" ? answer.message : void 0);
607
+ });
608
+ return () => {
609
+ current = false;
610
+ };
611
+ }, [
612
+ catalogProvider,
613
+ operations,
614
+ probe.settingsNs
615
+ ]);
616
+ const catalog = inheritedCatalog?.provider === catalogProvider ? inheritedCatalog?.models : void 0;
617
+ const inputDefaults = (0, react.useMemo)(() => new Map(catalog?.map((model) => [model.id, model.inputModalities])), [catalog]);
555
618
  const [candidates, setCandidates] = (0, react.useState)(void 0);
556
619
  const [picked, setPicked] = (0, react.useState)(/* @__PURE__ */ new Set());
557
620
  const [candidateQuery, setCandidateQuery] = (0, react.useState)("");
@@ -607,6 +670,10 @@ window.__ModuleLoader__.load({
607
670
  return;
608
671
  }
609
672
  const found = answer.models;
673
+ if (catalogProvider !== void 0) setInheritedCatalog({
674
+ provider: catalogProvider,
675
+ models: found
676
+ });
610
677
  if (found.length === 0) {
611
678
  setFailure(t("fetchEmpty"));
612
679
  return;
@@ -695,110 +762,60 @@ window.__ModuleLoader__.load({
695
762
  className: ModelsSection_module_css_default["modelEmpty"],
696
763
  children: t("modelsEmpty")
697
764
  }) : null,
698
- models.map((model, index) => (0, react_jsx_runtime.jsxs)("div", {
699
- className: ModelsSection_module_css_default["modelEntry"],
700
- children: [(0, react_jsx_runtime.jsxs)("div", {
701
- className: ModelsSection_module_css_default["modelRow"],
702
- children: [
703
- (0, react_jsx_runtime.jsx)("input", {
704
- className: ModelsSection_module_css_default["input"],
705
- type: "text",
706
- value: textOf(model, "id"),
707
- placeholder: t("modelId"),
708
- "aria-label": `${t("modelId")} ${index + 1}`,
709
- disabled,
710
- onChange: (event) => {
711
- patch(index, { id: event.target.value });
712
- }
713
- }),
714
- (0, react_jsx_runtime.jsx)("input", {
715
- className: ModelsSection_module_css_default["input"],
716
- type: "text",
717
- value: textOf(model, "name"),
718
- placeholder: t("modelName"),
719
- "aria-label": `${t("modelName")} ${index + 1}`,
720
- disabled,
721
- onChange: (event) => {
722
- patch(index, { name: event.target.value === "" ? void 0 : event.target.value });
723
- }
724
- }),
725
- (0, react_jsx_runtime.jsx)("button", {
726
- type: "button",
727
- className: ModelsSection_module_css_default["iconButton"],
728
- "aria-label": `${t("modelAdvanced")} ${index + 1}`,
729
- "aria-expanded": expanded.has(index),
730
- title: t("modelAdvanced"),
731
- onClick: () => {
732
- toggleExpanded(index);
733
- },
734
- children: (0, react_jsx_runtime.jsx)(IconChevron, { open: expanded.has(index) })
735
- }),
736
- (0, react_jsx_runtime.jsx)("button", {
737
- type: "button",
738
- className: `${ModelsSection_module_css_default["iconButton"]} ${ModelsSection_module_css_default["iconButtonDanger"]}`,
739
- "aria-label": `${t("removeModel")} ${index + 1}`,
740
- title: t("removeModel"),
741
- disabled,
742
- onClick: () => {
743
- onChange(models.filter((_model, at) => at !== index));
744
- setExpanded((current) => {
745
- const next = /* @__PURE__ */ new Set();
746
- for (const at of current) if (at < index) next.add(at);
747
- else if (at > index) next.add(at - 1);
748
- return next;
749
- });
750
- setEditing((current) => reindexOnRemove(current, index));
751
- },
752
- children: (0, react_jsx_runtime.jsx)(IconTrash, {})
753
- })
754
- ]
755
- }), expanded.has(index) ? (0, react_jsx_runtime.jsxs)("div", {
756
- className: ModelsSection_module_css_default["modelAdvanced"],
757
- children: [(0, react_jsx_runtime.jsxs)("label", {
758
- className: ModelsSection_module_css_default["modelField"],
759
- children: [(0, react_jsx_runtime.jsx)("span", {
760
- className: ModelsSection_module_css_default["modelFieldLabel"],
761
- children: t("modelContextWindow")
762
- }), (0, react_jsx_runtime.jsx)("input", {
763
- className: ModelsSection_module_css_default["input"],
764
- type: "text",
765
- inputMode: "numeric",
766
- value: capacityText(model, index, "contextWindow"),
767
- placeholder: CAPACITY_HINT.contextWindow,
768
- "aria-label": `${t("modelContextWindow")} ${index + 1}`,
769
- disabled,
770
- onChange: (event) => {
771
- editCapacity(index, "contextWindow", event.target.value);
772
- }
773
- })]
774
- }), (0, react_jsx_runtime.jsxs)("label", {
775
- className: ModelsSection_module_css_default["modelField"],
776
- children: [(0, react_jsx_runtime.jsx)("span", {
777
- className: ModelsSection_module_css_default["modelFieldLabel"],
778
- children: t("modelMaxTokens")
779
- }), (0, react_jsx_runtime.jsx)("input", {
780
- className: ModelsSection_module_css_default["input"],
781
- type: "text",
782
- inputMode: "numeric",
783
- value: capacityText(model, index, "maxTokens"),
784
- placeholder: CAPACITY_HINT.maxTokens,
785
- "aria-label": `${t("modelMaxTokens")} ${index + 1}`,
786
- disabled,
787
- onChange: (event) => {
788
- editCapacity(index, "maxTokens", event.target.value);
789
- }
790
- })]
791
- })]
792
- }) : null]
793
- }, index)),
794
- (0, react_jsx_runtime.jsx)("button", {
765
+ (0, react_jsx_runtime.jsx)("div", {
766
+ className: ModelsSection_module_css_default["modelList"],
767
+ children: models.map((model, index) => (0, react_jsx_runtime.jsx)(ModelRow, {
768
+ model,
769
+ position: index + 1,
770
+ inputField: "input",
771
+ inputFallback: inputDefaults.get(textOf(model, "id")) ?? props.defaultInput,
772
+ inputLoading: catalogProvider !== void 0 && catalog === void 0,
773
+ expanded: expanded.has(index),
774
+ disabled,
775
+ t,
776
+ contextWindow: {
777
+ value: capacityText(model, index, "contextWindow"),
778
+ placeholder: CAPACITY_HINT.contextWindow,
779
+ onChange: (text) => {
780
+ editCapacity(index, "contextWindow", text);
781
+ }
782
+ },
783
+ maxTokens: {
784
+ value: capacityText(model, index, "maxTokens"),
785
+ placeholder: CAPACITY_HINT.maxTokens,
786
+ onChange: (text) => {
787
+ editCapacity(index, "maxTokens", text);
788
+ }
789
+ },
790
+ onFieldChange: (field, value) => {
791
+ patch(index, { [field]: value });
792
+ },
793
+ onChange: (next) => {
794
+ onChange(models.map((row, at) => at === index ? next : row));
795
+ },
796
+ onToggle: () => {
797
+ toggleExpanded(index);
798
+ },
799
+ onRemove: () => {
800
+ onChange(models.filter((_model, at) => at !== index));
801
+ setExpanded((current) => {
802
+ const next = /* @__PURE__ */ new Set();
803
+ for (const at of current) if (at < index) next.add(at);
804
+ else if (at > index) next.add(at - 1);
805
+ return next;
806
+ });
807
+ setEditing((current) => reindexOnRemove(current, index));
808
+ }
809
+ }, index))
810
+ }),
811
+ (0, react_jsx_runtime.jsxs)("button", {
795
812
  type: "button",
796
813
  className: ModelsSection_module_css_default["addModelButton"],
797
814
  disabled,
798
815
  onClick: () => {
799
816
  onChange([...models, { id: "" }]);
800
817
  },
801
- children: t("addModel")
818
+ children: [(0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconPlusOutlineRegular, { size: 14 }), t("addModel")]
802
819
  }),
803
820
  failure !== void 0 ? (0, react_jsx_runtime.jsx)("p", {
804
821
  className: ModelsSection_module_css_default["error"],
@@ -856,6 +873,7 @@ window.__ModuleLoader__.load({
856
873
  }
857
874
  }), (0, react_jsx_runtime.jsx)("span", {
858
875
  className: ModelsSection_module_css_default["candidateId"],
876
+ title: candidate.name ?? candidate.id,
859
877
  children: candidate.id
860
878
  })]
861
879
  })
@@ -884,7 +902,7 @@ window.__ModuleLoader__.load({
884
902
  * Join declared configurable providers with the currently registered routes.
885
903
  * @param registered - live provider routes in registration order.
886
904
  * @param directory - declared configurable providers in declaration order.
887
- * @returns declared rows followed by live routes with no declaration.
905
+ * @returns account and official routes first, then other routes in their original order.
888
906
  */
889
907
  function joinProviderDirectory(registered, directory) {
890
908
  const active = new Set(registered.map((provider) => provider.id));
@@ -908,7 +926,7 @@ window.__ModuleLoader__.load({
908
926
  active: true
909
927
  });
910
928
  }
911
- return rows;
929
+ return rows.toSorted((left, right) => (left.provider === "deepseek-account" ? 0 : left.provider === "deepseek-official" ? 1 : 2) - (right.provider === "deepseek-account" ? 0 : right.provider === "deepseek-official" ? 1 : 2));
912
930
  }
913
931
  /**
914
932
  * Derive the conventional credential reference for a provider route: the v1
@@ -1016,11 +1034,15 @@ window.__ModuleLoader__.load({
1016
1034
  entry,
1017
1035
  configured: namespace !== void 0 && (entry.settingsPath.length === 0 || this.schema.getPath(namespace.value, entry.settingsPath) !== void 0),
1018
1036
  removable: namespace !== void 0 && entry.settingsPath.length > 0 && this.schema.hasPath(namespace.user, entry.settingsPath) && !this.schema.hasPath(namespace.base, entry.settingsPath),
1019
- apiKeyEnv: apiKeyEnvOf(namespace, entry.settingsPath, this.schema),
1037
+ apiKeyEnv: entry.provider === "deepseek-account" ? void 0 : apiKeyEnvOf(namespace, entry.settingsPath, this.schema),
1020
1038
  credential: void 0
1021
1039
  };
1022
1040
  });
1023
- const refs = [...new Set(rows.map((row) => row.apiKeyEnv ?? deriveKeyRef(row.entry.provider)))];
1041
+ if (rows.some((row) => row.entry.provider === "deepseek-account")) {
1042
+ const catalog = await this.ctx.remote.session.modelCatalog();
1043
+ for (const row of rows) if (row.entry.provider === "deepseek-account") row.accountAvailable = catalog.ok && catalog.value.groups.some((group) => group.id === "deepseek-account" && group.models.length > 0);
1044
+ }
1045
+ const refs = [...new Set(rows.filter((row) => row.entry.provider !== "deepseek-account").map((row) => row.apiKeyEnv ?? deriveKeyRef(row.entry.provider)))];
1024
1046
  let credentials = {};
1025
1047
  let credentialError = null;
1026
1048
  if (refs.length > 0) {
@@ -1034,7 +1056,8 @@ window.__ModuleLoader__.load({
1034
1056
  s.error = null;
1035
1057
  s.credentialError = credentialError;
1036
1058
  s.writable = writable;
1037
- s.rows = rows.map((row) => {
1059
+ s.rows = rows.filter((row) => row.entry.provider !== "deepseek-account" || row.accountAvailable === true).map((row) => {
1060
+ if (row.entry.provider === "deepseek-account") return row;
1038
1061
  const named = row.apiKeyEnv === void 0 ? void 0 : credentials[row.apiKeyEnv];
1039
1062
  const derived = row.apiKeyEnv !== void 0 ? void 0 : credentials[deriveKeyRef(row.entry.provider)];
1040
1063
  return {
@@ -1067,6 +1090,7 @@ window.__ModuleLoader__.load({
1067
1090
  */
1068
1091
  function providerUsable(row) {
1069
1092
  if (!row.entry.active) return false;
1093
+ if (row.entry.provider === "deepseek-account") return row.accountAvailable === true;
1070
1094
  if (row.apiKeyEnv === void 0) return true;
1071
1095
  return row.credential?.configured === true;
1072
1096
  }
@@ -1108,18 +1132,46 @@ window.__ModuleLoader__.load({
1108
1132
  return { kind: "credential-missing" };
1109
1133
  }
1110
1134
  //#endregion
1135
+ //#region lib/types/client/protocol-label.js
1136
+ /**
1137
+ * Product names for the wire protocols a pi-ai route may speak. The pickers
1138
+ * show these instead of the schema identifiers (`openai-completions`), which
1139
+ * are what `settings.yaml` carries and what the option values stay.
1140
+ */
1141
+ /** The protocols this page names, keyed by their schema identifier. */
1142
+ const PROTOCOL_LABEL_KEYS = {
1143
+ "openai-completions": "protocolOpenAiCompletions",
1144
+ "openai-responses": "protocolOpenAiResponses",
1145
+ "anthropic-messages": "protocolAnthropicMessages"
1146
+ };
1147
+ /**
1148
+ * The picker text for one protocol identifier.
1149
+ * @param t - section copy.
1150
+ * @param protocol - the schema identifier of the protocol.
1151
+ * @returns the product name this page knows the protocol by; a protocol the
1152
+ * adapter adds before this page names it shows its identifier, the spelling
1153
+ * `settings.yaml` needs anyway.
1154
+ */
1155
+ function protocolLabel(t, protocol) {
1156
+ const key = PROTOCOL_LABEL_KEYS[protocol];
1157
+ return key === void 0 ? protocol : t(key);
1158
+ }
1159
+ //#endregion
1111
1160
  //#region lib/types/client/CustomProviderCard.js
1112
1161
  /**
1113
1162
  * The card that declares a provider pi-ai does not ship — an OpenAI-compatible
1114
1163
  * gateway, a self-hosted server, or a provider newer than the installed
1115
1164
  * catalog.
1116
1165
  *
1117
- * This is a create, not an edit, which is why it is its own card rather than
1166
+ * This is a create, not an edit, which is why it is its own form rather than
1118
1167
  * the provider editor with extra fields: the route id is being *chosen* here,
1119
- * and the settings address does not exist until it is. One `settings.mutate`
1120
- * sets the whole profile at `providers.<route>`; the key travels separately
1121
- * through `credentials/set` under the reference the profile records, exactly as
1122
- * an existing provider's key does.
1168
+ * and the settings address does not exist until it is. It renders as the
1169
+ * custom-API panel of the section's add card; the card's mode switch names it
1170
+ * when both modes are offered, and with the custom mode alone the card shows
1171
+ * this form directly. One `settings.mutate` sets the whole profile at
1172
+ * `providers.<route>`; the key travels separately through `credentials/set`
1173
+ * under the reference the profile records, exactly as an existing provider's
1174
+ * key does.
1123
1175
  *
1124
1176
  * The three fields a hand-declared route cannot default — endpoint, protocol,
1125
1177
  * and at least one model — are required here rather than at load, so the
@@ -1156,7 +1208,7 @@ window.__ModuleLoader__.load({
1156
1208
  * @returns the creation card.
1157
1209
  */
1158
1210
  function CustomProviderCard(props) {
1159
- const { taken, protocols, operations, t } = props;
1211
+ const { taken, protocols, operations, t, onBusyChange } = props;
1160
1212
  const [openedAt] = (0, react.useState)(() => props.revision);
1161
1213
  const [route, setRoute] = (0, react.useState)("");
1162
1214
  const [displayName, setDisplayName] = (0, react.useState)("");
@@ -1165,6 +1217,14 @@ window.__ModuleLoader__.load({
1165
1217
  const [keyDraft, setKeyDraft] = (0, react.useState)("");
1166
1218
  const [models, setModels] = (0, react.useState)([]);
1167
1219
  const [busy, setBusy] = (0, react.useState)(false);
1220
+ const [listBusy, setListBusy] = (0, react.useState)(false);
1221
+ (0, react.useEffect)(() => {
1222
+ onBusyChange?.(busy || listBusy);
1223
+ }, [
1224
+ busy,
1225
+ listBusy,
1226
+ onBusyChange
1227
+ ]);
1168
1228
  const [failure, setFailure] = (0, react.useState)(void 0);
1169
1229
  /**
1170
1230
  * The profile write landed. Only the key write can still be outstanding, so
@@ -1226,13 +1286,6 @@ window.__ModuleLoader__.load({
1226
1286
  return (0, react_jsx_runtime.jsxs)("div", {
1227
1287
  className: ModelsSection_module_css_default["editor"],
1228
1288
  children: [
1229
- (0, react_jsx_runtime.jsx)("div", {
1230
- className: ModelsSection_module_css_default["editorHeader"],
1231
- children: (0, react_jsx_runtime.jsx)("span", {
1232
- className: ModelsSection_module_css_default["editorTitle"],
1233
- children: t("customTitle")
1234
- })
1235
- }),
1236
1289
  (0, react_jsx_runtime.jsxs)("div", {
1237
1290
  className: ModelsSection_module_css_default["field"],
1238
1291
  children: [(0, react_jsx_runtime.jsx)("span", {
@@ -1283,7 +1336,7 @@ window.__ModuleLoader__.load({
1283
1336
  className: ModelsSection_module_css_default["input"],
1284
1337
  type: "text",
1285
1338
  value: baseURL,
1286
- placeholder: t("customBaseUrlPlaceholder"),
1339
+ placeholder: t(protocol === "anthropic-messages" ? "customAnthropicBaseUrlPlaceholder" : "customBaseUrlPlaceholder"),
1287
1340
  "aria-label": t("baseUrl"),
1288
1341
  "aria-invalid": baseUrlInvalid,
1289
1342
  disabled: profileDisabled,
@@ -1311,7 +1364,7 @@ window.__ModuleLoader__.load({
1311
1364
  },
1312
1365
  children: protocols.map((choice) => (0, react_jsx_runtime.jsx)("option", {
1313
1366
  value: choice,
1314
- children: choice
1367
+ children: protocolLabel(t, choice)
1315
1368
  }, choice))
1316
1369
  })]
1317
1370
  }),
@@ -1325,7 +1378,7 @@ window.__ModuleLoader__.load({
1325
1378
  (0, react_jsx_runtime.jsx)("input", {
1326
1379
  className: ModelsSection_module_css_default["input"],
1327
1380
  type: "password",
1328
- autoComplete: "off",
1381
+ autoComplete: "new-password",
1329
1382
  value: keyDraft,
1330
1383
  placeholder: t("keyPlaceholder"),
1331
1384
  "aria-label": t("keyInput"),
@@ -1352,7 +1405,8 @@ window.__ModuleLoader__.load({
1352
1405
  probeBlocked: baseUrlInvalid ? "customBaseUrlInvalid" : keyFailure === "keyBlank" ? "keyBlankNew" : keyFailure,
1353
1406
  operations,
1354
1407
  t,
1355
- disabled: profileDisabled
1408
+ disabled: profileDisabled,
1409
+ onBusyChange: setListBusy
1356
1410
  }),
1357
1411
  failure !== void 0 ? (0, react_jsx_runtime.jsx)("p", {
1358
1412
  className: ModelsSection_module_css_default["error"],
@@ -1396,14 +1450,12 @@ window.__ModuleLoader__.load({
1396
1450
  * Reasoning effort is deliberately absent: it is a per-MODEL capability, and
1397
1451
  * the models under one provider disagree about it, so a provider-scoped
1398
1452
  * control can only be set to a value some of them reject. The composer's
1399
- * model picker offers each model its own levels; `settings.yaml` keeps the
1453
+ * model picker offers each model its own levels; `cordis.patch.yml` keeps the
1400
1454
  * profile field for a deployment that knows its route. Everything else stays
1401
- * owned by `settings.yaml`. Profile edits land as minimal `settings.mutate`
1455
+ * owned by `cordis.patch.yml`. Profile edits land as minimal `settings.mutate`
1402
1456
  * path ops against the stored section — the card names only the fields it can
1403
1457
  * see instead of rebuilding the whole subtree from a partial descriptor.
1404
1458
  */
1405
- /** The public DeepSeek endpoint shown as the deepseek base-URL placeholder. */
1406
- const DEEPSEEK_PUBLIC_BASE_URL = "https://api.deepseek.com";
1407
1459
  /** A user-section subtree as a plain draft object (absent → empty). */
1408
1460
  function draftAt(schema, namespace, path) {
1409
1461
  const subtree = schema.getPath(namespace.user, path);
@@ -1460,6 +1512,15 @@ window.__ModuleLoader__.load({
1460
1512
  const [keyDraft, setKeyDraft] = (0, react.useState)("");
1461
1513
  const [keyState, setKeyState] = (0, react.useState)(void 0);
1462
1514
  const [busy, setBusy] = (0, react.useState)(false);
1515
+ const [listBusy, setListBusy] = (0, react.useState)(false);
1516
+ const { onBusyChange } = props;
1517
+ (0, react.useEffect)(() => {
1518
+ onBusyChange?.(busy || listBusy);
1519
+ }, [
1520
+ busy,
1521
+ listBusy,
1522
+ onBusyChange
1523
+ ]);
1463
1524
  const [failure, setFailure] = (0, react.useState)(void 0);
1464
1525
  const [committedOriginal, setCommittedOriginal] = (0, react.useState)(() => schema.getPath(namespace.user, settingsPath));
1465
1526
  const [expectedRevision, setExpectedRevision] = (0, react.useState)(() => namespace.revision);
@@ -1471,7 +1532,8 @@ window.__ModuleLoader__.load({
1471
1532
  ]);
1472
1533
  const fallback = schema.getPath(namespace.value, settingsPath);
1473
1534
  const disabled = props.readOnly || busy;
1474
- const layout = layoutOf(namespace.ns);
1535
+ const accountProvider = props.provider === "deepseek-account";
1536
+ const layout = accountProvider ? "deepseek" : layoutOf(namespace.ns);
1475
1537
  const keyRef = refFor(schema, namespace, settingsPath, props.provider);
1476
1538
  const protocols = (0, react.useMemo)(() => layout === "pi-ai" ? protocolChoices(namespace, schema) : [], [
1477
1539
  layout,
@@ -1479,6 +1541,7 @@ window.__ModuleLoader__.load({
1479
1541
  schema
1480
1542
  ]);
1481
1543
  (0, react.useEffect)(() => {
1544
+ if (accountProvider) return;
1482
1545
  let stale = false;
1483
1546
  setKeyState(void 0);
1484
1547
  operations.describeCredential(keyRef).then((described) => {
@@ -1488,7 +1551,11 @@ window.__ModuleLoader__.load({
1488
1551
  return () => {
1489
1552
  stale = true;
1490
1553
  };
1491
- }, [operations, keyRef]);
1554
+ }, [
1555
+ operations,
1556
+ keyRef,
1557
+ accountProvider
1558
+ ]);
1492
1559
  const stringAt = (source, key) => {
1493
1560
  const value = schema.getPath(source, [key]);
1494
1561
  return typeof value === "string" && value.trim().length > 0 ? value : void 0;
@@ -1593,6 +1660,7 @@ window.__ModuleLoader__.load({
1593
1660
  const models = modelDrafts(modelsOverridden ? customModels : inheritedModels());
1594
1661
  const defaultContextWindow = schema.getPath(fallback, ["defaultContextWindow"]);
1595
1662
  const defaultMaxTokens = schema.getPath(fallback, ["maxTokens"]);
1663
+ const defaultInput = schema.getPath(fallback, ["defaultInput"]);
1596
1664
  const keyPlaceholder = keyLocked ? t("keyEnvLocked") : keyState?.configured === true && props.credentialRequired !== true ? t("keyStored") : family === "pi-ai" ? t("keyPlaceholderNative") : t("keyPlaceholder");
1597
1665
  /** What both family editors take: the rows, whose layer owns them, and the two writes. */
1598
1666
  const catalogProps = {
@@ -1607,6 +1675,11 @@ window.__ModuleLoader__.load({
1607
1675
  setDraft((current) => schema.deletePath(current, ["models"]));
1608
1676
  }
1609
1677
  };
1678
+ if (accountProvider) return (0, react_jsx_runtime.jsx)(DeepSeekModelsEditor, {
1679
+ ...catalogProps,
1680
+ defaultContextWindow: typeof defaultContextWindow === "number" ? defaultContextWindow : void 0,
1681
+ defaultMaxTokens: typeof defaultMaxTokens === "number" ? defaultMaxTokens : void 0
1682
+ });
1610
1683
  return (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [(0, react_jsx_runtime.jsxs)("div", {
1611
1684
  className: ModelsSection_module_css_default["field"],
1612
1685
  children: [
@@ -1617,7 +1690,7 @@ window.__ModuleLoader__.load({
1617
1690
  (0, react_jsx_runtime.jsx)("input", {
1618
1691
  className: ModelsSection_module_css_default["input"],
1619
1692
  type: "password",
1620
- autoComplete: "off",
1693
+ autoComplete: "new-password",
1621
1694
  value: keyDraft,
1622
1695
  placeholder: keyPlaceholder,
1623
1696
  "aria-label": t("keyInput"),
@@ -1661,20 +1734,29 @@ window.__ModuleLoader__.load({
1661
1734
  }) : null,
1662
1735
  (0, react_jsx_runtime.jsxs)("div", {
1663
1736
  className: ModelsSection_module_css_default["field"],
1664
- children: [(0, react_jsx_runtime.jsx)("span", {
1665
- className: ModelsSection_module_css_default["fieldLabel"],
1666
- children: t("baseUrl")
1667
- }), (0, react_jsx_runtime.jsx)("input", {
1668
- className: ModelsSection_module_css_default["input"],
1669
- type: "text",
1670
- value: stringAt(draft, "baseURL") ?? "",
1671
- placeholder: family === "deepseek" ? DEEPSEEK_PUBLIC_BASE_URL : stringAt(fallback, "baseURL") ?? t("baseUrlDefault"),
1672
- "aria-label": t("baseUrl"),
1673
- disabled,
1674
- onChange: (event) => {
1675
- setField("baseURL", event.target.value === "" ? void 0 : event.target.value);
1676
- }
1677
- })]
1737
+ children: [
1738
+ (0, react_jsx_runtime.jsx)("span", {
1739
+ className: ModelsSection_module_css_default["fieldLabel"],
1740
+ children: t("baseUrl")
1741
+ }),
1742
+ (0, react_jsx_runtime.jsx)("input", {
1743
+ className: ModelsSection_module_css_default["input"],
1744
+ type: "text",
1745
+ value: stringAt(draft, "baseURL") ?? "",
1746
+ placeholder: family === "deepseek" ? t("deepSeekBaseUrl") : stringAt(fallback, "baseURL") ?? t("baseUrlDefault"),
1747
+ "aria-describedby": family === "deepseek" ? `${props.provider}-endpoint-hint` : void 0,
1748
+ "aria-label": t("baseUrl"),
1749
+ disabled,
1750
+ onChange: (event) => {
1751
+ setField("baseURL", event.target.value === "" ? void 0 : event.target.value);
1752
+ }
1753
+ }),
1754
+ family === "deepseek" ? (0, react_jsx_runtime.jsx)("span", {
1755
+ id: `${props.provider}-endpoint-hint`,
1756
+ className: ModelsSection_module_css_default["advancedHint"],
1757
+ children: t("deepSeekEndpointHint")
1758
+ }) : null
1759
+ ]
1678
1760
  }),
1679
1761
  ownsIdentity ? (0, react_jsx_runtime.jsxs)("div", {
1680
1762
  className: ModelsSection_module_css_default["field"],
@@ -1694,7 +1776,7 @@ window.__ModuleLoader__.load({
1694
1776
  children: t("customApiUnset")
1695
1777
  }) : null, protocols.map((choice) => (0, react_jsx_runtime.jsx)("option", {
1696
1778
  value: choice,
1697
- children: choice
1779
+ children: protocolLabel(t, choice)
1698
1780
  }, choice))]
1699
1781
  })]
1700
1782
  }) : null,
@@ -1704,9 +1786,12 @@ window.__ModuleLoader__.load({
1704
1786
  defaultMaxTokens: typeof defaultMaxTokens === "number" ? defaultMaxTokens : void 0
1705
1787
  }) : (0, react_jsx_runtime.jsx)(ModelListEditor, {
1706
1788
  ...catalogProps,
1789
+ catalogProvider: props.declared === true ? void 0 : props.provider,
1790
+ defaultInput: Array.isArray(defaultInput) ? defaultInput : void 0,
1707
1791
  probe,
1708
1792
  probeBlocked: keyFailure,
1709
- operations
1793
+ operations,
1794
+ onBusyChange: setListBusy
1710
1795
  })
1711
1796
  ]
1712
1797
  })]
@@ -1748,6 +1833,7 @@ window.__ModuleLoader__.load({
1748
1833
  props.onClose(false);
1749
1834
  },
1750
1835
  onSubmit: () => {
1836
+ props.onSubmitCredential?.();
1751
1837
  apply();
1752
1838
  }
1753
1839
  })
@@ -1759,15 +1845,24 @@ window.__ModuleLoader__.load({
1759
1845
  /**
1760
1846
  * Models settings section: the provider rows joined from the configurable
1761
1847
  * directory, settings namespaces, and credential states, with one editor
1762
- * card at a time. Rows expose only confirmed API-key state through accessible
1848
+ * card at a time. Rows retain the account-first order supplied by the store
1849
+ * and expose only confirmed API-key state through accessible
1763
1850
  * solid configured or missing dots. A whole-section provider without a
1764
1851
  * configured key renders as its open setup card instead of a row, but only in
1765
1852
  * the first-run posture — no provider on the page can serve requests yet — and
1766
- * only until the user closes that card; the add flow is a card carrying the
1767
- * dormant-provider select. Each card kind owns its own open state, so closing
1768
- * one never discards a draft in another. Every mutation writes through the
1769
- * wire, while a provider removal first requires confirmation; the page
1770
- * re-renders from pushed invalidations or the post-apply reload.
1853
+ * only until the user closes that card. The add flow is one card behind one
1854
+ * button: a mode switch chooses between adopting a dormant directory provider
1855
+ * (the catalog select over the provider editor) and declaring a custom model
1856
+ * API (the create form). A panel mounts the first time its mode is shown and
1857
+ * stays mounted, hidden, while the card is open and its mode stays offered,
1858
+ * so switching modes discards neither draft and an unvisited mode costs
1859
+ * nothing; the switch holds still while either panel has a write or an
1860
+ * endpoint interrogation in flight, since a switch underneath one would
1861
+ * orphan the answer. Each card kind owns its own open state, so closing one
1862
+ * never discards a draft in another. Every
1863
+ * mutation writes through the wire, while a provider removal first requires
1864
+ * confirmation; the page re-renders from pushed invalidations or the
1865
+ * post-apply reload.
1771
1866
  */
1772
1867
  /** Render an editor for either the setup posture or an expanded provider row. */
1773
1868
  function renderProviderEditor({ target, ...props }) {
@@ -1812,7 +1907,7 @@ window.__ModuleLoader__.load({
1812
1907
  * @returns whether to render the setup card.
1813
1908
  */
1814
1909
  function needsSetup(row, anyUsable) {
1815
- if (anyUsable) return false;
1910
+ if (anyUsable || row.entry.provider === "deepseek-account") return false;
1816
1911
  if (row.entry.settingsPath.length > 0) return false;
1817
1912
  return row.credential?.configured !== true;
1818
1913
  }
@@ -1867,32 +1962,60 @@ window.__ModuleLoader__.load({
1867
1962
  }
1868
1963
  function Loaded({ injected, renderSlot }) {
1869
1964
  const { controller, operations, schema, t } = injected;
1870
- const state = injected.useSnapshot((snapshot) => snapshot);
1965
+ const snapshot = injected.useSnapshot((value) => value);
1966
+ const state = {
1967
+ ...snapshot,
1968
+ rows: snapshot.rows.map((row) => row.entry.provider === "deepseek-account" ? {
1969
+ ...row,
1970
+ entry: {
1971
+ ...row.entry,
1972
+ displayName: t("deepSeekAccount")
1973
+ }
1974
+ } : row)
1975
+ };
1871
1976
  const [editing, setEditing] = (0, react.useState)(void 0);
1872
- const [adding, setAdding] = (0, react.useState)(false);
1977
+ const [addOpen, setAddOpen] = (0, react.useState)(false);
1978
+ const [addMode, setAddMode] = (0, react.useState)("catalog");
1979
+ /** The modes shown since the add card opened; each keeps its panel mounted. */
1980
+ const [visited, setVisited] = (0, react.useState)(() => /* @__PURE__ */ new Set());
1981
+ /** Whether each add panel has a write or an interrogation in flight. */
1982
+ const [catalogBusy, setCatalogBusy] = (0, react.useState)(false);
1983
+ const [customBusy, setCustomBusy] = (0, react.useState)(false);
1984
+ /** Base of the add card's tab and panel ids. */
1985
+ const addId = (0, react.useId)();
1873
1986
  const [deleteTarget, setDeleteTarget] = (0, react.useState)(void 0);
1874
1987
  const [deleting, setDeleting] = (0, react.useState)(false);
1875
1988
  const [deleteFailure, setDeleteFailure] = (0, react.useState)(void 0);
1876
1989
  const [savedTarget, setSavedTarget] = (0, react.useState)(void 0);
1877
- const [declaring, setDeclaring] = (0, react.useState)(false);
1878
1990
  const [dismissedSetup, setDismissedSetup] = (0, react.useState)(() => /* @__PURE__ */ new Set());
1879
1991
  const announceSaved = (target) => {
1880
1992
  controller.load().then(() => {
1881
1993
  setSavedTarget(target);
1882
1994
  });
1883
1995
  };
1884
- const closeEditor = (changed, target) => {
1996
+ /**
1997
+ * Close the add card whole. The catalog target is forgotten with it, since
1998
+ * `editing` doubles as the row editor's target once the card is closed and a
1999
+ * refresh could otherwise open the row of a provider the draft never saved.
2000
+ * The busy flags reset here because a panel that closes itself on success
2001
+ * unmounts before it can report idle.
2002
+ */
2003
+ const closeAdd = () => {
1885
2004
  setEditing(void 0);
1886
- setAdding(false);
1887
- setDeclaring(false);
2005
+ setAddOpen(false);
2006
+ setCatalogBusy(false);
2007
+ setCustomBusy(false);
2008
+ };
2009
+ const closeEditor = (changed, target) => {
2010
+ closeAdd();
1888
2011
  if (changed) announceSaved(target);
1889
2012
  };
1890
2013
  /**
1891
- * Close a setup card, which owns none of the state above: the row-editor,
1892
- * add, and declare cards each own one of those, so clearing them here would
1893
- * discard a draft the user opened beside this card. Dismissal is this card's
1894
- * own — the provider falls back to an ordinary row for the rest of the
1895
- * session, and reopens through Edit.
2014
+ * Close a setup card, which owns none of the state above: the row-editor
2015
+ * and add cards each own one of those, so clearing them here would discard
2016
+ * a draft the user opened beside this card. Dismissal is this card's own —
2017
+ * the provider falls back to an ordinary row for the rest of the session,
2018
+ * and reopens through Edit.
1896
2019
  */
1897
2020
  const closeSetup = (changed, target) => {
1898
2021
  setDismissedSetup((previous) => new Set([...previous, target.provider]));
@@ -1945,11 +2068,37 @@ window.__ModuleLoader__.load({
1945
2068
  const anyUsable = state.rows.some(providerUsable);
1946
2069
  const configured = state.rows.filter((row) => row.configured);
1947
2070
  const configurable = state.rows.filter((row) => state.namespaces.has(row.entry.settingsNs));
1948
- const addable = configurable.filter((row) => !row.configured);
1949
- const addTarget = adding ? editing : void 0;
1950
- const addNamespace = addTarget === void 0 ? void 0 : state.namespaces.get(addTarget.settingsNs);
1951
- const addRow = addTarget === void 0 ? void 0 : state.rows.find((row) => row.entry.provider === addTarget.provider);
1952
- const protocols = protocolChoices(state.namespaces.get("llm-pi-ai"), schema);
2071
+ const addable = state.rows.flatMap((row) => {
2072
+ const namespace = state.namespaces.get(row.entry.settingsNs);
2073
+ return namespace === void 0 || row.configured ? [] : [{
2074
+ row,
2075
+ namespace
2076
+ }];
2077
+ });
2078
+ const piAi = state.namespaces.get("llm-pi-ai");
2079
+ const protocols = protocolChoices(piAi, schema);
2080
+ const catalogOffered = configurable.length > 0;
2081
+ const catalogEnabled = addable.length > 0;
2082
+ const customOffered = piAi !== void 0;
2083
+ const customEnabled = protocols.length > 0;
2084
+ const bothOffered = catalogOffered && customOffered;
2085
+ const mode = bothOffered ? addMode : customOffered ? "custom" : "catalog";
2086
+ const mounted = (candidate) => mode === candidate || visited.has(candidate);
2087
+ const switchLocked = catalogBusy || customBusy;
2088
+ const draft = (() => {
2089
+ if (!addOpen || !catalogOffered) return void 0;
2090
+ const kept = editing === void 0 ? void 0 : state.namespaces.get(editing.settingsNs);
2091
+ if (editing !== void 0 && kept !== void 0) return {
2092
+ target: editing,
2093
+ namespace: kept
2094
+ };
2095
+ const first = addable[0];
2096
+ return first === void 0 ? void 0 : {
2097
+ target: targetOf(first.row),
2098
+ namespace: first.namespace
2099
+ };
2100
+ })();
2101
+ const addRow = draft === void 0 ? void 0 : state.rows.find((row) => row.entry.provider === draft.target.provider);
1953
2102
  return (0, react_jsx_runtime.jsxs)("div", {
1954
2103
  className: ModelsSection_module_css_default["section"],
1955
2104
  children: [
@@ -2005,7 +2154,7 @@ window.__ModuleLoader__.load({
2005
2154
  }, { entryKey: row.entry.settingsNs })
2006
2155
  ]
2007
2156
  }, row.entry.provider);
2008
- const open = !adding && editing?.provider === row.entry.provider;
2157
+ const open = !addOpen && editing?.provider === row.entry.provider;
2009
2158
  const credentialConfigured = row.credential?.configured === true;
2010
2159
  const credentialMissing = !credentialConfigured && row.apiKeyEnv !== void 0 && row.credential?.configured === false;
2011
2160
  return (0, react_jsx_runtime.jsxs)("li", {
@@ -2044,8 +2193,7 @@ window.__ModuleLoader__.load({
2044
2193
  "aria-label": providerCopy(t("editProvider"), target),
2045
2194
  onClick: () => {
2046
2195
  setSavedTarget(void 0);
2047
- setDeclaring(false);
2048
- setAdding(false);
2196
+ setAddOpen(false);
2049
2197
  setEditing(open ? void 0 : target);
2050
2198
  },
2051
2199
  children: t("edit")
@@ -2086,94 +2234,136 @@ window.__ModuleLoader__.load({
2086
2234
  }),
2087
2235
  (0, react_jsx_runtime.jsx)("div", {
2088
2236
  className: ModelsSection_module_css_default["addBlock"],
2089
- children: addTarget !== void 0 && addNamespace !== void 0 ? (0, react_jsx_runtime.jsxs)("div", {
2237
+ children: addOpen ? (0, react_jsx_runtime.jsxs)("div", {
2090
2238
  className: ModelsSection_module_css_default["addCard"],
2091
2239
  children: [
2092
2240
  (0, react_jsx_runtime.jsxs)("div", {
2093
- className: ModelsSection_module_css_default["field"],
2094
- children: [(0, react_jsx_runtime.jsx)("span", {
2095
- className: ModelsSection_module_css_default["fieldLabel"],
2096
- children: t("provider")
2097
- }), (0, react_jsx_runtime.jsx)("select", {
2098
- className: `${ModelsSection_module_css_default["input"]} ${ModelsSection_module_css_default["selectInput"]}`,
2099
- value: addTarget.provider,
2100
- "aria-label": t("provider"),
2101
- onChange: (event) => {
2102
- const row = addable.find((candidate) => candidate.entry.provider === event.target.value);
2103
- /* v8 ignore next -- the select only lists addable rows */
2104
- if (row === void 0) return;
2105
- setEditing(targetOf(row));
2106
- },
2107
- children: addable.map((row) => (0, react_jsx_runtime.jsx)("option", {
2108
- value: row.entry.provider,
2109
- children: row.entry.displayName
2110
- }, row.entry.provider))
2241
+ className: ModelsSection_module_css_default["addModes"],
2242
+ children: [bothOffered ? (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.SegmentedControl, {
2243
+ id: addId,
2244
+ label: t("addMode"),
2245
+ value: mode,
2246
+ disabled: switchLocked,
2247
+ options: [{
2248
+ value: "catalog",
2249
+ label: t("addCatalog"),
2250
+ disabled: !catalogEnabled,
2251
+ ...catalogEnabled ? {} : { title: t("addCatalogExhausted") }
2252
+ }, {
2253
+ value: "custom",
2254
+ label: t("addCustom"),
2255
+ disabled: !customEnabled,
2256
+ ...customEnabled ? {} : { title: t("addCustomUnavailable") }
2257
+ }],
2258
+ onChange: (next) => {
2259
+ setAddMode(next);
2260
+ setVisited((previous) => new Set([...previous, next]));
2261
+ }
2262
+ }) : (0, react_jsx_runtime.jsx)("div", {
2263
+ className: ModelsSection_module_css_default["editorHeader"],
2264
+ children: (0, react_jsx_runtime.jsx)("span", {
2265
+ className: ModelsSection_module_css_default["editorTitle"],
2266
+ children: t(mode === "catalog" ? "addCatalog" : "addCustom")
2267
+ })
2268
+ }), (0, react_jsx_runtime.jsx)("p", {
2269
+ className: ModelsSection_module_css_default["advancedHint"],
2270
+ children: t(mode === "catalog" ? "addCatalogHint" : "addCustomHint")
2111
2271
  })]
2112
2272
  }),
2113
- (0, react_jsx_runtime.jsx)(ProviderEditor, {
2114
- provider: addTarget.provider,
2115
- displayName: addTarget.displayName,
2116
- hideTitle: true,
2117
- namespace: addNamespace,
2118
- schema,
2119
- settingsPath: addTarget.settingsPath,
2120
- operations,
2121
- t,
2122
- readOnly: !state.writable,
2123
- onClose: (changed) => {
2124
- closeEditor(changed, addTarget);
2125
- }
2126
- }, addTarget.provider),
2127
- addRow === void 0 ? null : renderSlot("settings.models.provider-card", {
2128
- provider: addRow.entry,
2129
- configured: addRow.configured,
2130
- keyConfigured: keyConfiguredOf(addRow)
2131
- }, { entryKey: addRow.entry.settingsNs })
2273
+ mounted("catalog") && draft !== void 0 ? (0, react_jsx_runtime.jsxs)("div", {
2274
+ id: `${addId}-catalog-panel`,
2275
+ ...bothOffered ? {
2276
+ role: "tabpanel",
2277
+ "aria-labelledby": `${addId}-catalog`
2278
+ } : {},
2279
+ hidden: mode !== "catalog",
2280
+ className: ModelsSection_module_css_default["addPanel"],
2281
+ children: [
2282
+ (0, react_jsx_runtime.jsxs)("div", {
2283
+ className: ModelsSection_module_css_default["field"],
2284
+ children: [(0, react_jsx_runtime.jsx)("span", {
2285
+ className: ModelsSection_module_css_default["fieldLabel"],
2286
+ children: t("provider")
2287
+ }), (0, react_jsx_runtime.jsx)("select", {
2288
+ className: `${ModelsSection_module_css_default["input"]} ${ModelsSection_module_css_default["selectInput"]}`,
2289
+ value: draft.target.provider,
2290
+ "aria-label": t("provider"),
2291
+ disabled: catalogBusy,
2292
+ onChange: (event) => {
2293
+ const picked = addable.find((candidate) => candidate.row.entry.provider === event.target.value);
2294
+ /* v8 ignore next -- the select only lists addable rows */
2295
+ if (picked === void 0) return;
2296
+ setEditing(targetOf(picked.row));
2297
+ },
2298
+ children: addable.map(({ row }) => (0, react_jsx_runtime.jsx)("option", {
2299
+ value: row.entry.provider,
2300
+ children: row.entry.displayName
2301
+ }, row.entry.provider))
2302
+ })]
2303
+ }),
2304
+ (0, react_jsx_runtime.jsx)(ProviderEditor, {
2305
+ provider: draft.target.provider,
2306
+ displayName: draft.target.displayName,
2307
+ hideTitle: true,
2308
+ namespace: draft.namespace,
2309
+ schema,
2310
+ settingsPath: draft.target.settingsPath,
2311
+ operations,
2312
+ t,
2313
+ readOnly: !state.writable,
2314
+ onClose: (changed) => {
2315
+ closeEditor(changed, draft.target);
2316
+ },
2317
+ onBusyChange: setCatalogBusy
2318
+ }, draft.target.provider),
2319
+ addRow === void 0 ? null : renderSlot("settings.models.provider-card", {
2320
+ provider: addRow.entry,
2321
+ configured: addRow.configured,
2322
+ keyConfigured: keyConfiguredOf(addRow)
2323
+ }, { entryKey: addRow.entry.settingsNs })
2324
+ ]
2325
+ }) : null,
2326
+ mounted("custom") && piAi !== void 0 ? (0, react_jsx_runtime.jsx)("div", {
2327
+ id: `${addId}-custom-panel`,
2328
+ ...bothOffered ? {
2329
+ role: "tabpanel",
2330
+ "aria-labelledby": `${addId}-custom`
2331
+ } : {},
2332
+ hidden: mode !== "custom",
2333
+ className: ModelsSection_module_css_default["addPanel"],
2334
+ children: (0, react_jsx_runtime.jsx)(CustomProviderCard, {
2335
+ taken: state.rows.map((row) => row.entry.provider),
2336
+ protocols,
2337
+ revision: piAi.revision,
2338
+ operations,
2339
+ t,
2340
+ readOnly: !state.writable,
2341
+ onClose: (changed) => {
2342
+ closeAdd();
2343
+ if (changed) controller.load();
2344
+ },
2345
+ onBusyChange: setCustomBusy
2346
+ })
2347
+ }) : null
2132
2348
  ]
2133
- }) : declaring ? (0, react_jsx_runtime.jsx)("div", {
2134
- className: ModelsSection_module_css_default["addCard"],
2135
- children: (0, react_jsx_runtime.jsx)(CustomProviderCard, {
2136
- taken: state.rows.map((row) => row.entry.provider),
2137
- protocols,
2138
- /* v8 ignore next -- the card only opens from a button disabled without this namespace */
2139
- revision: state.namespaces.get("llm-pi-ai")?.revision ?? 0,
2140
- operations,
2141
- t,
2142
- readOnly: !state.writable,
2143
- onClose: (changed) => {
2144
- setDeclaring(false);
2145
- if (changed) controller.load();
2146
- }
2147
- })
2148
- }) : (0, react_jsx_runtime.jsxs)("div", {
2349
+ }) : catalogOffered || customOffered ? (0, react_jsx_runtime.jsx)("div", {
2149
2350
  className: ModelsSection_module_css_default["addActions"],
2150
- children: [configurable.length > 0 && (0, react_jsx_runtime.jsxs)("button", {
2351
+ children: (0, react_jsx_runtime.jsxs)("button", {
2151
2352
  type: "button",
2152
2353
  className: ModelsSection_module_css_default["addButton"],
2153
- disabled: addable.length === 0 || !state.writable,
2354
+ disabled: !state.writable || !catalogEnabled && !customEnabled,
2154
2355
  onClick: () => {
2155
2356
  const first = addable[0];
2156
- /* v8 ignore next -- the button is disabled while nothing is addable */
2157
- if (first === void 0) return;
2158
- setSavedTarget(void 0);
2159
- setDeclaring(false);
2160
- setAdding(true);
2161
- setEditing(targetOf(first));
2162
- },
2163
- children: [(0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconPlusOutline16, { size: 14 }), t("add")]
2164
- }), state.namespaces.has("llm-pi-ai") && (0, react_jsx_runtime.jsxs)("button", {
2165
- type: "button",
2166
- className: ModelsSection_module_css_default["addButton"],
2167
- disabled: protocols.length === 0 || !state.writable,
2168
- onClick: () => {
2357
+ const initial = catalogEnabled ? "catalog" : "custom";
2169
2358
  setSavedTarget(void 0);
2170
- setAdding(false);
2171
- setEditing(void 0);
2172
- setDeclaring(true);
2359
+ setEditing(first === void 0 ? void 0 : targetOf(first.row));
2360
+ setAddMode(initial);
2361
+ setVisited(new Set([initial]));
2362
+ setAddOpen(true);
2173
2363
  },
2174
- children: [(0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconPlusOutline16, { size: 14 }), t("customAdd")]
2175
- })]
2176
- })
2364
+ children: [(0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconPlusOutlineRegular, { size: 14 }), t("add")]
2365
+ })
2366
+ }) : null
2177
2367
  }),
2178
2368
  renderSlot("settings.models.footer", {}),
2179
2369
  (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Modal, {
@@ -2185,7 +2375,7 @@ window.__ModuleLoader__.load({
2185
2375
  className: ModelsSection_module_css_default["deleteDialog"],
2186
2376
  footer: (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [(0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
2187
2377
  variant: "outline",
2188
- autoFocus: true,
2378
+ "data-modal-autofocus": true,
2189
2379
  disabled: deleting,
2190
2380
  onClick: closeDelete,
2191
2381
  children: t("cancel")
@@ -2206,7 +2396,7 @@ window.__ModuleLoader__.load({
2206
2396
  }
2207
2397
  //#endregion
2208
2398
  //#region \0dsh-css:/home/runner/work/deepseek-harness/deepseek-harness/packages/client/ui-settings-models/src/client/OnboardingModal.module.css.mjs
2209
- const css$2 = ".jLrgrW_dialog{width:min(600px,100%);padding:0}.jLrgrW_content{box-sizing:border-box;flex-direction:column;max-height:calc(100vh - 48px);padding:28px;display:flex;overflow-y:auto}.jLrgrW_title{color:var(--dsw-alias-label-primary);outline:none;margin:0;font-size:20px;font-weight:500;line-height:28px}.jLrgrW_body{margin-top:20px}@media (width<=560px){.jLrgrW_content{padding:24px}}";
2399
+ const css$2 = ".jLrgrW_dialog{width:min(600px,100%);max-height:100%;padding:0}.jLrgrW_content{box-sizing:border-box;flex-direction:column;min-height:0;padding:28px;display:flex;overflow-y:auto}.jLrgrW_title{color:var(--dsw-alias-label-primary);outline:none;margin:0;font-size:20px;font-weight:500;line-height:28px}.jLrgrW_body{margin-top:20px}@media (width<=560px){.jLrgrW_content{padding:24px}}";
2210
2400
  const tagId$2 = "@deepseek-ai/dsh-client-ui-settings-models/OnboardingModal.module.css";
2211
2401
  if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$2) + "]") === null) {
2212
2402
  const tag = document.createElement("style");
@@ -2283,13 +2473,6 @@ window.__ModuleLoader__.load({
2283
2473
  };
2284
2474
  //#endregion
2285
2475
  //#region lib/types/client/DeepSeekOnboardingDialog.js
2286
- /**
2287
- * Official-DeepSeek first-run step. Readiness comes from the same
2288
- * provider/settings/credential join as the Models page: any provider the user
2289
- * can already talk to ends the step, and only a user with none is offered the
2290
- * official DeepSeek route. The step reuses that page's credential editor in
2291
- * the onboarding plugin's shared modal, so the key is entered once.
2292
- */
2293
2476
  /* v8 ignore next 3 -- closed-union defaults only defend future source widening */
2294
2477
  function assertNever$1(_value) {
2295
2478
  throw new Error("unexpected DeepSeek onboarding state");
@@ -2301,20 +2484,34 @@ window.__ModuleLoader__.load({
2301
2484
  * @returns the onboarding modal or null when onboarding needs no intervention.
2302
2485
  */
2303
2486
  function DeepSeekOnboardingDialog(props) {
2304
- const { complete, controller, useModels, operations, schema, t } = props;
2487
+ const { complete, controller, useModels, operations, schema, t, renderSlot, automatic, explicit = false } = props;
2488
+ const [apiKey, setApiKey] = (0, react.useState)(explicit);
2305
2489
  const state = useModels((snapshot) => snapshot);
2306
2490
  const readiness = onboardingReadiness(state);
2307
2491
  (0, react.useEffect)(() => {
2308
- if (state.status === "idle") controller.load();
2309
- }, [controller, state.status]);
2492
+ if ((automatic || explicit) && state.status === "idle") controller.load();
2493
+ }, [
2494
+ controller,
2495
+ state.status,
2496
+ automatic,
2497
+ explicit
2498
+ ]);
2310
2499
  (0, react.useEffect)(() => {
2311
- if (readiness.kind === "adapter-absent" || readiness.kind === "provider-ready" || readiness.kind === "unavailable") complete();
2312
- }, [complete, readiness.kind]);
2500
+ if (!automatic && !explicit || readiness.kind === "adapter-absent" || !explicit && readiness.kind === "provider-ready" || readiness.kind === "unavailable") complete();
2501
+ }, [
2502
+ complete,
2503
+ readiness.kind,
2504
+ explicit,
2505
+ automatic
2506
+ ]);
2507
+ if (!automatic && !explicit) return null;
2313
2508
  switch (readiness.kind) {
2314
2509
  case "loading":
2315
2510
  case "adapter-absent":
2316
- case "provider-ready":
2317
2511
  case "unavailable": return null;
2512
+ case "provider-ready":
2513
+ if (!explicit) return null;
2514
+ break;
2318
2515
  case "credential-missing": break;
2319
2516
  /* v8 ignore next -- every current readiness variant is handled above */
2320
2517
  default: return assertNever$1(readiness);
@@ -2330,7 +2527,7 @@ window.__ModuleLoader__.load({
2330
2527
  }
2331
2528
  controller.load();
2332
2529
  };
2333
- return (0, react_jsx_runtime.jsxs)(OnboardingModal, {
2530
+ const editor = (0, react_jsx_runtime.jsxs)(OnboardingModal, {
2334
2531
  title: t("onboardingTitle"),
2335
2532
  children: [(0, react_jsx_runtime.jsx)("p", {
2336
2533
  className: DeepSeekOnboardingDialog_module_css_default.description,
@@ -2348,6 +2545,9 @@ window.__ModuleLoader__.load({
2348
2545
  readOnly: false,
2349
2546
  hideTitle: true,
2350
2547
  credentialOnly: true,
2548
+ onSubmitCredential: () => {
2549
+ props.track?.("api_key_save_click", {});
2550
+ },
2351
2551
  credentialRequired: true,
2352
2552
  autoFocusCredential: true,
2353
2553
  cancelLabelKey: "onboardingLater",
@@ -2357,6 +2557,12 @@ window.__ModuleLoader__.load({
2357
2557
  })
2358
2558
  })]
2359
2559
  });
2560
+ return apiKey ? editor : renderSlot("settings.models.sign-in", {
2561
+ complete,
2562
+ useApiKey: () => {
2563
+ setApiKey(true);
2564
+ }
2565
+ }, { fallback: editor });
2360
2566
  }
2361
2567
  //#endregion
2362
2568
  //#region \0dsh-css:/home/runner/work/deepseek-harness/deepseek-harness/packages/client/ui-settings-models/src/client/WelcomeNotice.module.css.mjs
@@ -2377,7 +2583,7 @@ window.__ModuleLoader__.load({
2377
2583
  };
2378
2584
  //#endregion
2379
2585
  //#region lib/types/client/WelcomeNotice.js
2380
- /** Product-wide, versioned internal-testing notice. */
2586
+ /** Product-wide, versioned preview notice. */
2381
2587
  /**
2382
2588
  * Render the current notice until its exact copy version is acknowledged.
2383
2589
  * @param props - settings-shell owner state and welcome dependencies.
@@ -2434,14 +2640,14 @@ window.__ModuleLoader__.load({
2434
2640
  //#endregion
2435
2641
  //#region lib/types/onboarding-copy.js
2436
2642
  /** Durable settings namespace for product-wide GUI onboarding facts. */
2437
- const WELCOME_NOTICE_SETTINGS_NAMESPACE = "ui-onboarding";
2643
+ const WELCOME_NOTICE_SETTINGS_NAMESPACE = "ui-settings-general";
2438
2644
  /** Field storing the last welcome notice version the user acknowledged. */
2439
2645
  const WELCOME_NOTICE_ACK_FIELD = "welcomeNoticeVersion";
2440
2646
  /**
2441
2647
  * Bump only when the notice changes materially and every user should see it
2442
2648
  * again. The acknowledgement is compared for exact equality.
2443
2649
  */
2444
- const WELCOME_NOTICE_VERSION = "2026-08-13.1";
2650
+ const WELCOME_NOTICE_VERSION = "2026-09-28.1";
2445
2651
  //#endregion
2446
2652
  //#region lib/types/client/welcome-store.js
2447
2653
  /**
@@ -2450,16 +2656,6 @@ window.__ModuleLoader__.load({
2450
2656
  * remote browser's memory-mode scope never answers and the acknowledgement
2451
2657
  * stays process-local here.
2452
2658
  */
2453
- /**
2454
- * Accept any object section verbatim; a malformed durable value reads as an
2455
- * empty section, so the notice treats it as unacknowledged instead of leaving
2456
- * the scope stuck on its previous value.
2457
- * @param section - the wire section value.
2458
- * @returns the section object, or an empty one for non-object values.
2459
- */
2460
- function decodeWelcomeSection(section) {
2461
- return typeof section === "object" && section !== null && !Array.isArray(section) ? section : {};
2462
- }
2463
2659
  /* v8 ignore next 3 -- closed-union default only defends future source widening */
2464
2660
  function assertNever(_value) {
2465
2661
  throw new Error("unexpected welcome settings status");
@@ -2647,6 +2843,7 @@ window.__ModuleLoader__.load({
2647
2843
  /** English strings (the key-set source of truth for this pair). */
2648
2844
  const en = {
2649
2845
  nav: "Models",
2846
+ deepSeekAccount: "DeepSeek Account",
2650
2847
  title: "Models",
2651
2848
  intro: "Enter your API keys to use models from the following providers.",
2652
2849
  edit: "Edit",
@@ -2658,7 +2855,14 @@ window.__ModuleLoader__.load({
2658
2855
  deleteDescriptionWithCredential: "Deleting {provider} removes its configuration and stored API key.",
2659
2856
  deleteConfirm: "Delete {provider}",
2660
2857
  deleting: "Deleting {provider}…",
2661
- add: "Add provider",
2858
+ add: "Add model provider",
2859
+ addMode: "How to add",
2860
+ addCatalog: "Third-party model provider",
2861
+ addCustom: "Custom model API",
2862
+ addCatalogHint: "Pick OpenAI, Anthropic, Kimi, or another provider from the built-in catalog and enter its API key.",
2863
+ addCustomHint: "Connect a relay, a self-hosted server, or any other OpenAI- or Anthropic-compatible endpoint by its base URL, protocol, and models.",
2864
+ addCatalogExhausted: "Every catalog provider is already configured.",
2865
+ addCustomUnavailable: "No API protocol is available to declare.",
2662
2866
  provider: "Provider",
2663
2867
  close: "Close",
2664
2868
  cancel: "Cancel",
@@ -2679,6 +2883,8 @@ window.__ModuleLoader__.load({
2679
2883
  customized: "Customized settings",
2680
2884
  baseUrl: "Base URL",
2681
2885
  baseUrlDefault: "Provider default",
2886
+ deepSeekBaseUrl: "https://api.deepseek.com/anthropic",
2887
+ deepSeekEndpointHint: "Use an API endpoint compatible with Anthropic Messages.",
2682
2888
  models: "Models",
2683
2889
  modelsInherited: "Using the adapter defaults",
2684
2890
  modelsCustomized: "Customized model catalog",
@@ -2691,7 +2897,10 @@ window.__ModuleLoader__.load({
2691
2897
  contextWindowPlaceholder: "Uses the provider default",
2692
2898
  maxTokens: "Max output tokens",
2693
2899
  maxTokensPlaceholder: "Uses the provider default",
2694
- modelAdvanced: "Capacities",
2900
+ modelAdvanced: "Model options",
2901
+ modelInputTypes: "Input types",
2902
+ modelInputText: "Text",
2903
+ modelInputImage: "Image",
2695
2904
  addModel: "Add model",
2696
2905
  removeModel: "Delete model",
2697
2906
  modelsEmpty: "No models will be shown in the selector. Unlisted IDs can still be sent directly.",
@@ -2703,11 +2912,9 @@ window.__ModuleLoader__.load({
2703
2912
  modelNameInvalid: "Display name cannot be empty.",
2704
2913
  modelContextInvalid: "Context window must be a positive count, like 131072, 256K, or 1M.",
2705
2914
  modelMaxTokensInvalid: "Max output tokens must be a positive count, like 8192, 64K, or 1M.",
2706
- advancedHint: "Other fields live in settings.yaml; edit that section directly.",
2915
+ advancedHint: "Other fields live in cordis.patch.yml; edit that section directly.",
2707
2916
  modelCapacityInvalid: "A capacity must be a number, optionally suffixed K or M.",
2708
2917
  modelDuplicate: "Each model ID may appear once.",
2709
- modelContextWindow: "Context window",
2710
- modelMaxTokens: "Max output tokens",
2711
2918
  fetchModels: "Fetch available models",
2712
2919
  fetching: "Asking the provider…",
2713
2920
  fetchNeedsBaseUrl: "Enter the base URL first, then fetch.",
@@ -2719,8 +2926,6 @@ window.__ModuleLoader__.load({
2719
2926
  fetchSelectAll: "Select all",
2720
2927
  fetchDeselectAll: "Deselect all",
2721
2928
  fetchAdopt: "Add selected",
2722
- customAdd: "Add a custom provider",
2723
- customTitle: "Custom provider",
2724
2929
  customTag: "Custom",
2725
2930
  customRoute: "Provider ID",
2726
2931
  customRouteHint: "Lowercase identifier, starting with a letter, that uniquely names this provider in requests and as its credential name.",
@@ -2729,15 +2934,19 @@ window.__ModuleLoader__.load({
2729
2934
  customDisplayName: "Display name",
2730
2935
  customApi: "API protocol",
2731
2936
  customApiUnset: "Not selected",
2937
+ protocolOpenAiCompletions: "OpenAI Chat Completions",
2938
+ protocolOpenAiResponses: "OpenAI Responses",
2939
+ protocolAnthropicMessages: "Anthropic Messages",
2732
2940
  customNeedsBaseUrl: "A custom provider needs a base URL.",
2733
2941
  customBaseUrlInvalid: "Enter a valid HTTP or HTTPS URL.",
2734
2942
  customNeedsModels: "A custom provider needs at least one model.",
2735
2943
  customBaseUrlPlaceholder: "https://gateway.example/v1",
2944
+ customAnthropicBaseUrlPlaceholder: "https://gateway.example",
2736
2945
  settingsPathUnresolvable: "unresolvable settings path",
2737
2946
  create: "Create provider",
2738
2947
  creating: "Creating…",
2739
- welcomeTitle: "Internal Testing Notice",
2740
- welcomeBody: "DeepSeek Harness 0.1 remains in testing for Harness developers. Many areas need further improvement, and we welcome feedback from the developer community. DeepSeek Harness's core plugins and foundational APIs will continue to evolve rapidly over the coming months.\n\nWe look forward to exploring the limits of intelligence with developers around the world, building on open-source, open, reusable, and composable infrastructure. We welcome Harness developers everywhere to join the DSH plugin ecosystem.",
2948
+ welcomeTitle: "Preview Notice",
2949
+ welcomeBody: "DeepSeek Harness 0.2 is still in preview, and many areas need continued improvement and refinement. We welcome feedback and suggestions from all developers and users. The new desktop app now targets a broad range of users, while developer-related advanced features can be enabled in the settings. DeepSeek Harness’s product features and plugin APIs are expected to continue rapid iteration and evolution, and will gradually stabilize over time.\n\nWe look forward to exploring the limits of intelligence together with users and developers around the world, building on open-source, reusable, and composable infrastructure. We welcome everyone to bring their ideas to life with DeepSeek Harness and participate in the community to enrich the plugin ecosystem.",
2741
2950
  welcomeContinue: "Continue",
2742
2951
  welcomeError: "The acknowledgement could not be saved. Please try again.",
2743
2952
  onboardingTitle: "Add an API key to get started",
@@ -2750,8 +2959,9 @@ window.__ModuleLoader__.load({
2750
2959
  /** Chinese strings (same keys as {@link en}). */
2751
2960
  const zh = {
2752
2961
  nav: "模型",
2962
+ deepSeekAccount: "DeepSeek 账号",
2753
2963
  title: "模型",
2754
- intro: "填入各提供方的 API 密钥即可使用其模型。",
2964
+ intro: "填入各提供商的 API 密钥即可使用其模型。",
2755
2965
  edit: "编辑",
2756
2966
  editProvider: "编辑 {provider}",
2757
2967
  remove: "删除",
@@ -2761,8 +2971,15 @@ window.__ModuleLoader__.load({
2761
2971
  deleteDescriptionWithCredential: "删除 {provider} 会移除其配置和存储的 API 密钥。",
2762
2972
  deleteConfirm: "删除 {provider}",
2763
2973
  deleting: "正在删除 {provider}…",
2764
- add: "添加提供方",
2765
- provider: "提供方",
2974
+ add: "添加模型提供商",
2975
+ addMode: "添加方式",
2976
+ addCatalog: "第三方模型提供商",
2977
+ addCustom: "自定义模型 API",
2978
+ addCatalogHint: "从内置目录中选择 OpenAI、Anthropic、Kimi 等提供商,填入其 API 密钥即可使用。",
2979
+ addCustomHint: "连接中转站、自部署服务或其他兼容 OpenAI / Anthropic 协议的接口,需填写 API 地址、协议和模型。",
2980
+ addCatalogExhausted: "目录中的提供商都已添加。",
2981
+ addCustomUnavailable: "没有可用的 API 协议。",
2982
+ provider: "提供商",
2766
2983
  close: "关闭",
2767
2984
  cancel: "取消",
2768
2985
  apply: "保存",
@@ -2771,7 +2988,7 @@ window.__ModuleLoader__.load({
2771
2988
  credentialConfigured: "API 密钥已配置",
2772
2989
  credentialMissing: "API 密钥缺失",
2773
2990
  readOnly: "当前部署的设置文档为只读。",
2774
- loadFailed: "加载提供方目录失败",
2991
+ loadFailed: "加载提供商目录失败",
2775
2992
  conflict: "这张卡片打开期间,这些设置已被其他地方改动。请关闭后重新打开,在当前值上编辑。",
2776
2993
  retry: "重试",
2777
2994
  keyInput: "API 密钥",
@@ -2781,7 +2998,9 @@ window.__ModuleLoader__.load({
2781
2998
  keyEnvLocked: "由启动环境提供(只读)",
2782
2999
  customized: "自定义设置",
2783
3000
  baseUrl: "API 地址",
2784
- baseUrlDefault: "提供方默认",
3001
+ baseUrlDefault: "提供商默认",
3002
+ deepSeekBaseUrl: "https://api.deepseek.com/anthropic",
3003
+ deepSeekEndpointHint: "请填写兼容 Anthropic Messages 协议的 API 地址。",
2785
3004
  models: "模型目录",
2786
3005
  modelsInherited: "正在使用适配器默认模型",
2787
3006
  modelsCustomized: "已自定义模型目录",
@@ -2791,56 +3010,59 @@ window.__ModuleLoader__.load({
2791
3010
  modelName: "显示名称",
2792
3011
  modelNamePlaceholder: "留空时使用模型 ID",
2793
3012
  contextWindow: "上下文窗口",
2794
- contextWindowPlaceholder: "使用提供方默认值",
3013
+ contextWindowPlaceholder: "使用提供商默认值",
2795
3014
  maxTokens: "最大输出 token 数",
2796
- maxTokensPlaceholder: "使用提供方默认值",
2797
- modelAdvanced: "容量",
3015
+ maxTokensPlaceholder: "使用提供商默认值",
3016
+ modelAdvanced: "模型选项",
3017
+ modelInputTypes: "输入类型",
3018
+ modelInputText: "文本",
3019
+ modelInputImage: "图片",
2798
3020
  addModel: "添加模型",
2799
3021
  removeModel: "删除模型",
2800
3022
  modelsEmpty: "模型选择器中将不显示任何模型;目录外 ID 仍可直接发送。",
2801
3023
  keyBlank: "请输入 API 密钥;留空则保持已存储的密钥。",
2802
- keyBlankNew: "请输入 API 密钥;若该提供方以其他方式鉴权,可以留空。",
3024
+ keyBlankNew: "请输入 API 密钥;若该提供商以其他方式鉴权,可以留空。",
2803
3025
  keyIllegalCharacters: "该 API 密钥格式错误,请检查。",
2804
3026
  modelIdRequired: "模型 ID 不能为空。",
2805
3027
  modelIdDuplicate: "模型 ID 不能重复。",
2806
3028
  modelNameInvalid: "显示名称不能为空。",
2807
3029
  modelContextInvalid: "上下文窗口必须是正数,例如 131072、256K 或 1M。",
2808
3030
  modelMaxTokensInvalid: "最大输出 token 数必须是正数,例如 8192、64K 或 1M。",
2809
- advancedHint: "其余字段在 settings.yaml 中,请直接编辑对应段。",
3031
+ advancedHint: "其余字段在 cordis.patch.yml 中,请直接编辑对应段。",
2810
3032
  modelCapacityInvalid: "容量需为数字,可加 K 或 M 后缀。",
2811
3033
  modelDuplicate: "每个模型 ID 只能出现一次。",
2812
- modelContextWindow: "上下文窗口",
2813
- modelMaxTokens: "最大输出 token",
2814
3034
  fetchModels: "获取可用模型",
2815
- fetching: "正在询问提供方…",
3035
+ fetching: "正在询问提供商…",
2816
3036
  fetchNeedsBaseUrl: "请先填写 API 地址,再获取。",
2817
- fetchEmpty: "该提供方没有列出任何模型,请手动添加。",
3037
+ fetchEmpty: "该提供商没有列出任何模型,请手动添加。",
2818
3038
  fetchTitle: "选择要添加的模型",
2819
- fetchDescription: "以下是模型提供方的可用模型,勾选要添加的模型。",
3039
+ fetchDescription: "以下是模型提供商的可用模型,勾选要添加的模型。",
2820
3040
  fetchSearch: "搜索模型",
2821
3041
  fetchNoMatches: "没有匹配的模型。",
2822
3042
  fetchSelectAll: "全选",
2823
3043
  fetchDeselectAll: "取消全选",
2824
3044
  fetchAdopt: "添加所选",
2825
- customAdd: "添加自定义提供方",
2826
- customTitle: "自定义提供方",
2827
3045
  customTag: "自定义",
2828
3046
  customRoute: "Provider ID",
2829
- customRouteHint: "以小写字母开头的标识,在请求中唯一标识该提供方,并用于派生凭据名。",
3047
+ customRouteHint: "以小写字母开头的标识,在请求中唯一标识该提供商,并用于派生凭据名。",
2830
3048
  customRouteInvalid: "需以小写字母开头,之后可用小写字母、数字和短横线。",
2831
- customRouteTaken: "已有提供方使用了这个 ID。",
3049
+ customRouteTaken: "已有提供商使用了这个 ID。",
2832
3050
  customDisplayName: "显示名称",
2833
3051
  customApi: "API 协议",
2834
3052
  customApiUnset: "未选择",
2835
- customNeedsBaseUrl: "自定义提供方需要填写 API 地址。",
3053
+ protocolOpenAiCompletions: "OpenAI Chat Completions",
3054
+ protocolOpenAiResponses: "OpenAI Responses",
3055
+ protocolAnthropicMessages: "Anthropic Messages",
3056
+ customNeedsBaseUrl: "自定义模型 API 需要填写 API 地址。",
2836
3057
  customBaseUrlInvalid: "请输入有效的 HTTP 或 HTTPS 地址。",
2837
- customNeedsModels: "自定义提供方至少需要一个模型。",
3058
+ customNeedsModels: "自定义模型 API 至少需要一个模型。",
2838
3059
  customBaseUrlPlaceholder: "https://gateway.example/v1",
3060
+ customAnthropicBaseUrlPlaceholder: "https://gateway.example",
2839
3061
  settingsPathUnresolvable: "无法解析设置路径",
2840
- create: "创建提供方",
3062
+ create: "创建提供商",
2841
3063
  creating: "创建中…",
2842
- welcomeTitle: "内测声明",
2843
- welcomeBody: "DeepSeek Harness 目前的 0.1 版本仍处在面向 Harness 开发者进行测试的阶段,还有许多地方需要持续改进和打磨,希望听取广大开发者的反馈建议。预计 DeepSeek Harness 的核心插件以及基础 API 都会在接下来的一段时间内快速迭代、持续演化。\n\n我们期待与全球开发者一起,在开源、开放、可复用、可组合的基础设施之上,共同探索智能上限。欢迎全球 Harness 开发者加入 DSH 插件生态。",
3064
+ welcomeTitle: "预览版说明",
3065
+ welcomeBody: "DeepSeek Harness 目前的 0.2 版本仍处于预览阶段,还有许多地方需要持续改进和打磨,希望听取广大开发者和用户的反馈建议。现在,新的桌面端面向广泛用户,开发者相关的进阶功能可在配置中开启使用。预计 DeepSeek Harness 的产品功能以及插件 API 都会继续快速迭代、持续演化,并逐渐趋于稳定。\n\n我们期待与全球用户和开发者一起,在开源、可复用、可组合的基础设施之上,共同探索智能上限。欢迎大家用 DeepSeek Harness 将想法变成现实,与社区一起丰富插件生态。",
2844
3066
  welcomeContinue: "继续",
2845
3067
  welcomeError: "暂时无法保存确认状态,请重试。",
2846
3068
  onboardingTitle: "添加一个 API Key 开始使用",
@@ -2851,6 +3073,904 @@ window.__ModuleLoader__.load({
2851
3073
  keyRequired: "请输入 API 密钥后继续。"
2852
3074
  };
2853
3075
  //#endregion
3076
+ //#region ../../../vendor/cosmokit/src/misc.ts
3077
+ /** Return true when a value is `null` or `undefined`. */
3078
+ function isNullable(value) {
3079
+ return value === null || value === void 0;
3080
+ }
3081
+ /** Return true for non-array object values. */
3082
+ function isPlainObject(data) {
3083
+ return data && typeof data === "object" && !Array.isArray(data);
3084
+ }
3085
+ /** Filter object entries and return a new object. */
3086
+ function filterKeys(object, filter) {
3087
+ return Object.fromEntries(Object.entries(object).filter(([key, value]) => filter(key, value)));
3088
+ }
3089
+ /** Map object values while preserving the original key set. */
3090
+ function mapValues(object, transform) {
3091
+ return Object.fromEntries(Object.entries(object).map(([key, value]) => [key, transform(value, key)]));
3092
+ }
3093
+ /** Pick selected keys from an object, optionally including `undefined` values. */
3094
+ function pick(source, keys, forced) {
3095
+ if (!keys) return { ...source };
3096
+ const result = {};
3097
+ for (const key of keys) if (forced || source[key] !== void 0) result[key] = source[key];
3098
+ return result;
3099
+ }
3100
+ //#endregion
3101
+ //#region ../../../vendor/cosmokit/src/volatile.ts
3102
+ /** Shared config references used by schema validators and plugin runtimes. */
3103
+ const write = Symbol.for("cosmokit.volatile.write");
3104
+ function snapshot(value, ancestors = /* @__PURE__ */ new Set()) {
3105
+ if (typeof value === "function") throw new TypeError("volatile config cannot contain functions");
3106
+ if (value === null || typeof value !== "object") return value;
3107
+ if (ancestors.has(value)) throw new TypeError("volatile config cannot contain cycles");
3108
+ ancestors.add(value);
3109
+ try {
3110
+ if (Array.isArray(value)) return Object.freeze(value.map((item) => snapshot(item, ancestors)));
3111
+ if (Object.getPrototypeOf(value) !== Object.prototype && Object.getPrototypeOf(value) !== null) throw new TypeError("volatile config objects must be plain objects or arrays");
3112
+ return Object.freeze(Object.fromEntries(Object.entries(value).map(([key, item]) => [key, snapshot(item, ancestors)])));
3113
+ } finally {
3114
+ ancestors.delete(value);
3115
+ }
3116
+ }
3117
+ /**
3118
+ * Create a detached reference containing an immutable copy of the supplied data.
3119
+ * @param value - validated config data; class instances and functions are unsupported.
3120
+ * @returns a reference whose value is updated only by its owning runtime.
3121
+ */
3122
+ function createVolatile(value) {
3123
+ let current = snapshot(value);
3124
+ return Object.freeze({
3125
+ get: () => current,
3126
+ [write]: (value) => {
3127
+ current = value;
3128
+ }
3129
+ });
3130
+ }
3131
+ /**
3132
+ * Identify references across ESM/CJS copies of the shared library.
3133
+ * @param value - a parsed config value.
3134
+ * @returns whether the value implements the shared reference protocol.
3135
+ */
3136
+ function isVolatile(value) {
3137
+ return typeof value === "object" && value !== null && write in value;
3138
+ }
3139
+ //#endregion
3140
+ //#region ../../../vendor/cosmokit/src/types.ts
3141
+ /** Test values using `instanceof` with a `toStringTag` fallback. */
3142
+ function is(type, value) {
3143
+ if (arguments.length === 1) return (value) => is(type, value);
3144
+ return type in globalThis && value instanceof globalThis[type] || Object.prototype.toString.call(value).slice(8, -1) === type;
3145
+ }
3146
+ function isArrayBufferLike(value) {
3147
+ return is("ArrayBuffer", value) || is("SharedArrayBuffer", value);
3148
+ }
3149
+ function isArrayBufferSource(value) {
3150
+ return isArrayBufferLike(value) || ArrayBuffer.isView(value);
3151
+ }
3152
+ let Binary;
3153
+ (function(_Binary) {
3154
+ _Binary.is = isArrayBufferLike;
3155
+ _Binary.isSource = isArrayBufferSource;
3156
+ function fromSource(source) {
3157
+ if (ArrayBuffer.isView(source)) return source.buffer.slice(source.byteOffset, source.byteOffset + source.byteLength);
3158
+ else return source;
3159
+ }
3160
+ _Binary.fromSource = fromSource;
3161
+ function toBase64(source) {
3162
+ source = fromSource(source);
3163
+ if (typeof Buffer !== "undefined") return Buffer.from(source).toString("base64");
3164
+ let binary = "";
3165
+ const bytes = new Uint8Array(source);
3166
+ for (let i = 0; i < bytes.byteLength; i++) binary += String.fromCharCode(bytes[i]);
3167
+ return btoa(binary);
3168
+ }
3169
+ _Binary.toBase64 = toBase64;
3170
+ function fromBase64(source) {
3171
+ if (typeof Buffer !== "undefined") return fromSource(Buffer.from(source, "base64"));
3172
+ return Uint8Array.from(atob(source), (c) => c.charCodeAt(0));
3173
+ }
3174
+ _Binary.fromBase64 = fromBase64;
3175
+ function toHex(source) {
3176
+ source = fromSource(source);
3177
+ if (typeof Buffer !== "undefined") return Buffer.from(source).toString("hex");
3178
+ return Array.from(new Uint8Array(source), (byte) => byte.toString(16).padStart(2, "0")).join("");
3179
+ }
3180
+ _Binary.toHex = toHex;
3181
+ function fromHex(source) {
3182
+ if (typeof Buffer !== "undefined") return fromSource(Buffer.from(source, "hex"));
3183
+ const hex = source.length % 2 === 0 ? source : source.slice(0, source.length - 1);
3184
+ const buffer = [];
3185
+ for (let i = 0; i < hex.length; i += 2) buffer.push(parseInt(`${hex[i]}${hex[i + 1]}`, 16));
3186
+ return Uint8Array.from(buffer).buffer;
3187
+ }
3188
+ _Binary.fromHex = fromHex;
3189
+ })(Binary || (Binary = {}));
3190
+ Binary.fromBase64;
3191
+ Binary.toBase64;
3192
+ Binary.fromHex;
3193
+ Binary.toHex;
3194
+ /** Deep-clone common JavaScript values while preserving prototypes and cycles. */
3195
+ function clone(source, refs = /* @__PURE__ */ new Map()) {
3196
+ if (!source || typeof source !== "object") return source;
3197
+ if (is("Date", source)) return new Date(source.valueOf());
3198
+ if (is("RegExp", source)) return new RegExp(source.source, source.flags);
3199
+ if (isArrayBufferLike(source)) return source.slice(0);
3200
+ if (ArrayBuffer.isView(source)) return source.buffer.slice(source.byteOffset, source.byteOffset + source.byteLength);
3201
+ const cached = refs.get(source);
3202
+ if (cached) return cached;
3203
+ if (Array.isArray(source)) {
3204
+ const result = [];
3205
+ refs.set(source, result);
3206
+ source.forEach((value, index) => {
3207
+ result[index] = Reflect.apply(clone, null, [value, refs]);
3208
+ });
3209
+ return result;
3210
+ }
3211
+ const result = Object.create(Object.getPrototypeOf(source));
3212
+ refs.set(source, result);
3213
+ for (const key of Reflect.ownKeys(source)) {
3214
+ const descriptor = { ...Reflect.getOwnPropertyDescriptor(source, key) };
3215
+ if ("value" in descriptor) descriptor.value = Reflect.apply(clone, null, [descriptor.value, refs]);
3216
+ Reflect.defineProperty(result, key, descriptor);
3217
+ }
3218
+ return result;
3219
+ }
3220
+ /**
3221
+ * Compare values recursively, treating two volatile references as equal regardless of value.
3222
+ * Strict comparison distinguishes null/undefined, treats opaque objects by identity,
3223
+ * compares URLs by normalized href, treats array holes as undefined, and considers distinct cyclic structures unequal.
3224
+ * @param a - first value.
3225
+ * @param b - second value.
3226
+ * @param strict - whether to require strict data equality outside volatile references.
3227
+ * @returns whether the values compare equal.
3228
+ */
3229
+ function deepEqual(a, b, strict) {
3230
+ const ancestors = /* @__PURE__ */ new Set();
3231
+ function compare(a, b) {
3232
+ if (a === b) return true;
3233
+ if (isVolatile(a) || isVolatile(b)) return isVolatile(a) && isVolatile(b);
3234
+ if (!strict && isNullable(a) && isNullable(b)) return true;
3235
+ if (typeof a !== typeof b || typeof a !== "object" || !a || !b) return false;
3236
+ if (ancestors.has(a)) return false;
3237
+ function check(test, then) {
3238
+ return test(a) ? test(b) ? then(a, b) : false : test(b) ? false : void 0;
3239
+ }
3240
+ ancestors.add(a);
3241
+ try {
3242
+ return check(Array.isArray, (a, b) => {
3243
+ if (a.length !== b.length) return false;
3244
+ for (let index = 0; index < a.length; index++) if (!compare(a[index], b[index])) return false;
3245
+ return true;
3246
+ }) ?? check(is("Date"), (a, b) => a.valueOf() === b.valueOf()) ?? check(is("URL"), (a, b) => a.href === b.href) ?? check(is("RegExp"), (a, b) => a.source === b.source && a.flags === b.flags) ?? check(isArrayBufferLike, (a, b) => {
3247
+ if (a.byteLength !== b.byteLength) return false;
3248
+ const viewA = new Uint8Array(a);
3249
+ const viewB = new Uint8Array(b);
3250
+ for (let i = 0; i < viewA.length; i++) if (viewA[i] !== viewB[i]) return false;
3251
+ return true;
3252
+ }) ?? ((!strict || [a, b].every((value) => Object.getPrototypeOf(value) === Object.prototype || Object.getPrototypeOf(value) === null)) && Object.keys({
3253
+ ...a,
3254
+ ...b
3255
+ }).every((key) => compare(a[key], b[key])));
3256
+ } finally {
3257
+ ancestors.delete(a);
3258
+ }
3259
+ }
3260
+ return compare(a, b);
3261
+ }
3262
+ //#endregion
3263
+ //#region ../../../vendor/cosmokit/src/time.ts
3264
+ let Time;
3265
+ (function(_Time) {
3266
+ _Time.millisecond = 1;
3267
+ const second = _Time.second = 1e3;
3268
+ const minute = _Time.minute = second * 60;
3269
+ const hour = _Time.hour = minute * 60;
3270
+ const day = _Time.day = hour * 24;
3271
+ const week = _Time.week = day * 7;
3272
+ let timezoneOffset = (/* @__PURE__ */ new Date()).getTimezoneOffset();
3273
+ function setTimezoneOffset(offset) {
3274
+ timezoneOffset = offset;
3275
+ }
3276
+ _Time.setTimezoneOffset = setTimezoneOffset;
3277
+ function getTimezoneOffset() {
3278
+ return timezoneOffset;
3279
+ }
3280
+ _Time.getTimezoneOffset = getTimezoneOffset;
3281
+ function getDateNumber(date = /* @__PURE__ */ new Date(), offset) {
3282
+ if (typeof date === "number") date = new Date(date);
3283
+ if (offset === void 0) offset = timezoneOffset;
3284
+ return Math.floor((date.valueOf() / minute - offset) / 1440);
3285
+ }
3286
+ _Time.getDateNumber = getDateNumber;
3287
+ function fromDateNumber(value, offset) {
3288
+ const date = new Date(value * day);
3289
+ if (offset === void 0) offset = timezoneOffset;
3290
+ return new Date(+date + offset * minute);
3291
+ }
3292
+ _Time.fromDateNumber = fromDateNumber;
3293
+ const numeric = /\d+(?:\.\d+)?/.source;
3294
+ const timeRegExp = new RegExp(`^${[
3295
+ "w(?:eek(?:s)?)?",
3296
+ "d(?:ay(?:s)?)?",
3297
+ "h(?:our(?:s)?)?",
3298
+ "m(?:in(?:ute)?(?:s)?)?",
3299
+ "s(?:ec(?:ond)?(?:s)?)?"
3300
+ ].map((unit) => `(${numeric}${unit})?`).join("")}$`);
3301
+ function parseTime(source) {
3302
+ const capture = timeRegExp.exec(source);
3303
+ if (!capture) return 0;
3304
+ return (parseFloat(capture[1]) * week || 0) + (parseFloat(capture[2]) * day || 0) + (parseFloat(capture[3]) * hour || 0) + (parseFloat(capture[4]) * minute || 0) + (parseFloat(capture[5]) * second || 0);
3305
+ }
3306
+ _Time.parseTime = parseTime;
3307
+ function parseDate(date) {
3308
+ const parsed = parseTime(date);
3309
+ if (parsed) date = Date.now() + parsed;
3310
+ else if (/^\d{1,2}(:\d{1,2}){1,2}$/.test(date)) date = `${(/* @__PURE__ */ new Date()).toLocaleDateString()}-${date}`;
3311
+ else if (/^\d{1,2}-\d{1,2}-\d{1,2}(:\d{1,2}){1,2}$/.test(date)) date = `${(/* @__PURE__ */ new Date()).getFullYear()}-${date}`;
3312
+ return date ? new Date(date) : /* @__PURE__ */ new Date();
3313
+ }
3314
+ _Time.parseDate = parseDate;
3315
+ function format(ms) {
3316
+ const abs = Math.abs(ms);
3317
+ if (abs >= day - hour / 2) return Math.round(ms / day) + "d";
3318
+ else if (abs >= hour - minute / 2) return Math.round(ms / hour) + "h";
3319
+ else if (abs >= minute - second / 2) return Math.round(ms / minute) + "m";
3320
+ else if (abs >= second) return Math.round(ms / second) + "s";
3321
+ return ms + "ms";
3322
+ }
3323
+ _Time.format = format;
3324
+ function toDigits(source, length = 2) {
3325
+ return source.toString().padStart(length, "0");
3326
+ }
3327
+ _Time.toDigits = toDigits;
3328
+ function template(template, time = /* @__PURE__ */ new Date()) {
3329
+ return template.replace("yyyy", time.getFullYear().toString()).replace("yy", time.getFullYear().toString().slice(2)).replace("MM", toDigits(time.getMonth() + 1)).replace("dd", toDigits(time.getDate())).replace("hh", toDigits(time.getHours())).replace("mm", toDigits(time.getMinutes())).replace("ss", toDigits(time.getSeconds())).replace("SSS", toDigits(time.getMilliseconds(), 3));
3330
+ }
3331
+ _Time.template = template;
3332
+ })(Time || (Time = {}));
3333
+ //#endregion
3334
+ //#region ../../../vendor/schemastery/src/index.ts
3335
+ const kSchema = Symbol.for("schemastery");
3336
+ const kValidationError = Symbol.for("ValidationError");
3337
+ globalThis.__schemastery_index__ ??= 0;
3338
+ globalThis.__schemastery_refs__ = void 0;
3339
+ var ValidationError = class extends TypeError {
3340
+ options;
3341
+ name = "ValidationError";
3342
+ constructor(message, options) {
3343
+ let prefix = "$";
3344
+ for (const segment of options.path || []) if (typeof segment === "string") prefix += "." + segment;
3345
+ else if (typeof segment === "number") prefix += "[" + segment + "]";
3346
+ else if (typeof segment === "symbol") prefix += `[Symbol(${segment.toString()})]`;
3347
+ if (prefix.startsWith(".")) prefix = prefix.slice(1);
3348
+ super((prefix === "$" ? "" : `${prefix} `) + message);
3349
+ this.options = options;
3350
+ }
3351
+ static is(error) {
3352
+ return !!error?.[kValidationError];
3353
+ }
3354
+ };
3355
+ Object.defineProperty(ValidationError.prototype, kValidationError, { value: true });
3356
+ const Schema = function(options) {
3357
+ const schema = function(data, options = {}) {
3358
+ return Schema.resolve(data, schema, options)[0];
3359
+ };
3360
+ if (options.refs) {
3361
+ const refs = mapValues(options.refs, (options) => new Schema(options));
3362
+ const getRef = (uid) => refs[uid];
3363
+ for (const key in refs) {
3364
+ const options = refs[key];
3365
+ options.sKey = getRef(options.sKey);
3366
+ options.inner = getRef(options.inner);
3367
+ options.list = options.list && options.list.map(getRef);
3368
+ options.dict = options.dict && mapValues(options.dict, getRef);
3369
+ }
3370
+ return refs[options.uid];
3371
+ }
3372
+ Object.assign(schema, options);
3373
+ if (typeof schema.callback === "string") try {
3374
+ schema.callback = new Function("return " + schema.callback)();
3375
+ } catch {}
3376
+ Object.defineProperty(schema, "uid", { value: globalThis.__schemastery_index__++ });
3377
+ Object.setPrototypeOf(schema, Schema.prototype);
3378
+ schema.meta ||= {};
3379
+ schema.toString = schema.toString.bind(schema);
3380
+ return schema;
3381
+ };
3382
+ Schema.prototype = Object.create(Function.prototype);
3383
+ Schema.prototype[kSchema] = true;
3384
+ Object.defineProperty(Schema.prototype, "~standard", { get() {
3385
+ return {
3386
+ version: 1,
3387
+ vendor: "schemastery",
3388
+ validate: (value) => {
3389
+ try {
3390
+ return { value: Schema.resolve(value, this, {})[0] };
3391
+ } catch (error) {
3392
+ if (ValidationError.is(error)) return { issues: [{
3393
+ message: error.message,
3394
+ path: error.options.path
3395
+ }] };
3396
+ throw error;
3397
+ }
3398
+ }
3399
+ };
3400
+ } });
3401
+ Schema.ValidationError = ValidationError;
3402
+ Schema.prototype.toJSON = function toJSON() {
3403
+ if (globalThis.__schemastery_refs__) {
3404
+ globalThis.__schemastery_refs__[this.uid] ??= JSON.parse(JSON.stringify({ ...this }));
3405
+ return this.uid;
3406
+ }
3407
+ globalThis.__schemastery_refs__ = { [this.uid]: { ...this } };
3408
+ globalThis.__schemastery_refs__[this.uid] = JSON.parse(JSON.stringify({ ...this }));
3409
+ const result = {
3410
+ uid: this.uid,
3411
+ refs: globalThis.__schemastery_refs__
3412
+ };
3413
+ globalThis.__schemastery_refs__ = void 0;
3414
+ return result;
3415
+ };
3416
+ Schema.prototype.set = function set(key, value) {
3417
+ this.dict[key] = value;
3418
+ return this;
3419
+ };
3420
+ Schema.prototype.push = function push(value) {
3421
+ this.list.push(value);
3422
+ return this;
3423
+ };
3424
+ function mergeDesc(original, messages) {
3425
+ const result = typeof original === "string" ? { "": original } : { ...original };
3426
+ for (const locale in messages) {
3427
+ const value = messages[locale];
3428
+ if (value?.$description || value?.$desc) result[locale] = value.$description || value.$desc;
3429
+ else if (typeof value === "string") result[locale] = value;
3430
+ }
3431
+ return result;
3432
+ }
3433
+ function getInner(value) {
3434
+ return value?.$value ?? value?.$inner;
3435
+ }
3436
+ function extractKeys(data) {
3437
+ return filterKeys(data ?? {}, (key) => !key.startsWith("$"));
3438
+ }
3439
+ Schema.prototype.i18n = function i18n(messages) {
3440
+ const schema = Schema(this);
3441
+ const desc = mergeDesc(schema.meta.description, messages);
3442
+ if (Object.keys(desc).length) schema.meta.description = desc;
3443
+ if (schema.dict) schema.dict = mapValues(schema.dict, (inner, key) => {
3444
+ return inner.i18n(mapValues(messages, (data) => getInner(data)?.[key] ?? data?.[key]));
3445
+ });
3446
+ if (schema.list) schema.list = schema.list.map((inner, index) => {
3447
+ return inner.i18n(mapValues(messages, (data = {}) => {
3448
+ if (Array.isArray(getInner(data))) return getInner(data)[index];
3449
+ if (Array.isArray(data)) return data[index];
3450
+ return extractKeys(data);
3451
+ }));
3452
+ });
3453
+ if (schema.inner) schema.inner = schema.inner.i18n(mapValues(messages, (data) => {
3454
+ if (getInner(data)) return getInner(data);
3455
+ return extractKeys(data);
3456
+ }));
3457
+ if (schema.sKey) schema.sKey = schema.sKey.i18n(mapValues(messages, (data) => data?.$key));
3458
+ return schema;
3459
+ };
3460
+ Schema.prototype.extra = function extra(key, value) {
3461
+ const schema = Schema(this);
3462
+ schema.meta = {
3463
+ ...schema.meta,
3464
+ [key]: value
3465
+ };
3466
+ return schema;
3467
+ };
3468
+ for (const key of [
3469
+ "required",
3470
+ "disabled",
3471
+ "collapse",
3472
+ "hidden",
3473
+ "loose"
3474
+ ]) Object.assign(Schema.prototype, { [key](value = true) {
3475
+ const schema = Schema(this);
3476
+ schema.meta = {
3477
+ ...schema.meta,
3478
+ [key]: value
3479
+ };
3480
+ return schema;
3481
+ } });
3482
+ Schema.prototype.deprecated = function deprecated() {
3483
+ const schema = Schema(this);
3484
+ schema.meta.badges ||= [];
3485
+ schema.meta.badges.push({
3486
+ text: "deprecated",
3487
+ type: "danger"
3488
+ });
3489
+ return schema;
3490
+ };
3491
+ Schema.prototype.experimental = function experimental() {
3492
+ const schema = Schema(this);
3493
+ schema.meta.badges ||= [];
3494
+ schema.meta.badges.push({
3495
+ text: "experimental",
3496
+ type: "warning"
3497
+ });
3498
+ return schema;
3499
+ };
3500
+ Schema.prototype.pattern = function pattern(regexp) {
3501
+ const schema = Schema(this);
3502
+ const pattern = pick(regexp, ["source", "flags"]);
3503
+ schema.meta = {
3504
+ ...schema.meta,
3505
+ pattern
3506
+ };
3507
+ return schema;
3508
+ };
3509
+ Schema.prototype.simplify = function simplify(value) {
3510
+ if (isVolatile(value)) value = value.get();
3511
+ if (deepEqual(value, this.meta.default, this.type === "dict")) return null;
3512
+ if (isNullable(value)) return value;
3513
+ if (this.type === "object" || this.type === "dict") {
3514
+ const result = {};
3515
+ for (const key in value) {
3516
+ const item = (this.type === "object" ? this.dict[key] : this.inner)?.simplify(value[key]);
3517
+ if (this.type === "dict" || !isNullable(item)) result[key] = item;
3518
+ }
3519
+ if (deepEqual(result, this.meta.default, this.type === "dict")) return null;
3520
+ return result;
3521
+ } else if (this.type === "array" || this.type === "tuple") {
3522
+ const result = [];
3523
+ value.forEach((value, index) => {
3524
+ const schema = this.type === "array" ? this.inner : this.list[index];
3525
+ const item = schema ? schema.simplify(value) : value;
3526
+ result.push(item);
3527
+ });
3528
+ return result;
3529
+ } else if (this.type === "intersect") {
3530
+ const result = {};
3531
+ for (const item of this.list) Object.assign(result, item.simplify(value));
3532
+ return result;
3533
+ } else if (this.type === "union") for (const schema of this.list) try {
3534
+ Schema.resolve(value, schema, {});
3535
+ return schema.simplify(value);
3536
+ } catch {}
3537
+ return value;
3538
+ };
3539
+ Schema.prototype.toString = function toString(inline) {
3540
+ return formatters[this.type]?.(this, inline) ?? `Schema<${this.type}>`;
3541
+ };
3542
+ Schema.prototype.role = function role(role, extra) {
3543
+ const schema = Schema(this);
3544
+ schema.meta = {
3545
+ ...schema.meta,
3546
+ role,
3547
+ extra
3548
+ };
3549
+ return schema;
3550
+ };
3551
+ for (const key of [
3552
+ "default",
3553
+ "link",
3554
+ "comment",
3555
+ "description",
3556
+ "max",
3557
+ "min",
3558
+ "step"
3559
+ ]) Object.assign(Schema.prototype, { [key](value) {
3560
+ const schema = Schema(this);
3561
+ schema.meta = {
3562
+ ...schema.meta,
3563
+ [key]: value
3564
+ };
3565
+ return schema;
3566
+ } });
3567
+ Schema.prototype.volatile = function volatile() {
3568
+ if (this.meta.volatile) throw new TypeError("volatile schema is already wrapped");
3569
+ return this.extra("volatile", true);
3570
+ };
3571
+ const resolvers = {};
3572
+ const checkedVolatile = Symbol("checked-volatile-schema");
3573
+ function validateVolatileSchema(schema, path = [], blocked = false, seen = /* @__PURE__ */ new Map()) {
3574
+ const states = seen.get(schema) ?? /* @__PURE__ */ new Set();
3575
+ if (states.has(blocked)) return;
3576
+ states.add(blocked);
3577
+ seen.set(schema, states);
3578
+ if (schema.meta?.volatile && blocked) throw new ValidationError("volatile fields require a fixed object path without an enclosing volatile field", { path });
3579
+ const nested = blocked || !!schema.meta?.volatile;
3580
+ if (schema.dict) for (const [key, child] of Object.entries(schema.dict)) validateVolatileSchema(child, [...path, key], nested, seen);
3581
+ if (schema.sKey) validateVolatileSchema(schema.sKey, [...path, "<key>"], true, seen);
3582
+ if (schema.inner && (schema.type !== "lazy" || schema.inner[kSchema])) validateVolatileSchema(schema.inner, [...path, "*"], true, seen);
3583
+ if (schema.list) for (let index = 0; index < schema.list.length; index++) validateVolatileSchema(schema.list[index], [...path, String(index)], true, seen);
3584
+ }
3585
+ Schema.extend = function extend(type, resolve) {
3586
+ resolvers[type] = resolve;
3587
+ };
3588
+ Schema.resolve = function resolve(data, schema, options = {}, strict = false) {
3589
+ if (!schema) return [data];
3590
+ if (!options[checkedVolatile]) {
3591
+ validateVolatileSchema(schema, options.path);
3592
+ options = {
3593
+ ...options,
3594
+ [checkedVolatile]: true
3595
+ };
3596
+ }
3597
+ if (schema.meta?.volatile) {
3598
+ const inner = Schema(schema);
3599
+ inner.meta = {
3600
+ ...schema.meta,
3601
+ volatile: false
3602
+ };
3603
+ const [value, adapted] = Schema.resolve(data, inner, options, strict);
3604
+ try {
3605
+ return [createVolatile(value), adapted];
3606
+ } catch (error) {
3607
+ throw new ValidationError(error instanceof Error ? error.message : String(error), options);
3608
+ }
3609
+ }
3610
+ if (options.ignore?.(data, schema)) return [data];
3611
+ if (isNullable(data) && schema.type !== "lazy") {
3612
+ if (schema.meta.required) throw new ValidationError(`missing required value`, options);
3613
+ let current = schema;
3614
+ let fallback = schema.meta.default;
3615
+ while (current?.type === "intersect" && isNullable(fallback)) {
3616
+ current = current.list[0];
3617
+ fallback = current?.meta.default;
3618
+ }
3619
+ if (isNullable(fallback)) return [data];
3620
+ data = clone(fallback);
3621
+ }
3622
+ const callback = resolvers[schema.type];
3623
+ if (!callback) throw new ValidationError(`unsupported type "${schema.type}"`, options);
3624
+ try {
3625
+ return callback(data, schema, options, strict);
3626
+ } catch (error) {
3627
+ if (!schema.meta.loose) throw error;
3628
+ return [schema.meta.default];
3629
+ }
3630
+ };
3631
+ Schema.from = function from(source) {
3632
+ if (isNullable(source)) return Schema.any();
3633
+ else if ([
3634
+ "string",
3635
+ "number",
3636
+ "boolean"
3637
+ ].includes(typeof source)) return Schema.const(source).required();
3638
+ else if (source[kSchema]) return source;
3639
+ else if (typeof source === "function") switch (source) {
3640
+ case String: return Schema.string().required();
3641
+ case Number: return Schema.number().required();
3642
+ case Boolean: return Schema.boolean().required();
3643
+ case Function: return Schema.function().required();
3644
+ default: return Schema.is(source).required();
3645
+ }
3646
+ else throw new TypeError(`cannot infer schema from ${source}`);
3647
+ };
3648
+ Schema.lazy = function lazy(builder) {
3649
+ const toJSON = () => {
3650
+ if (!schema.inner[kSchema]) {
3651
+ schema.inner = schema.builder();
3652
+ schema.inner.meta = {
3653
+ ...schema.meta,
3654
+ ...schema.inner.meta
3655
+ };
3656
+ }
3657
+ return schema.inner.toJSON();
3658
+ };
3659
+ const schema = new Schema({
3660
+ type: "lazy",
3661
+ builder,
3662
+ inner: { toJSON }
3663
+ });
3664
+ return schema;
3665
+ };
3666
+ Schema.natural = function natural() {
3667
+ return Schema.number().step(1).min(0);
3668
+ };
3669
+ Schema.percent = function percent() {
3670
+ return Schema.number().step(.01).min(0).max(1).role("slider");
3671
+ };
3672
+ Schema.date = function date() {
3673
+ return Schema.union([Schema.is(Date), Schema.transform(Schema.string().role("datetime"), (value, options) => {
3674
+ const date = new Date(value);
3675
+ if (isNaN(+date)) throw new ValidationError(`invalid date "${value}"`, options);
3676
+ return date;
3677
+ }, true)]);
3678
+ };
3679
+ Schema.regExp = function regExp(flag = "") {
3680
+ return Schema.union([Schema.is(RegExp), Schema.transform(Schema.string().role("regexp", { flag }), (value, options) => {
3681
+ try {
3682
+ return new RegExp(value, flag);
3683
+ } catch (e) {
3684
+ throw new ValidationError(e.message, options);
3685
+ }
3686
+ }, true)]);
3687
+ };
3688
+ Schema.arrayBuffer = function arrayBuffer(encoding) {
3689
+ return Schema.union([
3690
+ Schema.is(ArrayBuffer),
3691
+ Schema.is(SharedArrayBuffer),
3692
+ Schema.transform(Schema.any(), (value, options) => {
3693
+ if (Binary.isSource(value)) return Binary.fromSource(value);
3694
+ throw new ValidationError(`expected ArrayBufferSource but got ${value}`, options);
3695
+ }, true),
3696
+ ...encoding ? [Schema.transform(Schema.string(), (value, options) => {
3697
+ try {
3698
+ return encoding === "base64" ? Binary.fromBase64(value) : Binary.fromHex(value);
3699
+ } catch (e) {
3700
+ throw new ValidationError(e.message, options);
3701
+ }
3702
+ }, true)] : []
3703
+ ]);
3704
+ };
3705
+ Schema.extend("lazy", (data, schema, options, strict) => {
3706
+ if (!schema.inner[kSchema]) {
3707
+ schema.inner = schema.builder();
3708
+ schema.inner.meta = {
3709
+ ...schema.meta,
3710
+ ...schema.inner.meta
3711
+ };
3712
+ validateVolatileSchema(schema.inner, options.path, true);
3713
+ }
3714
+ return Schema.resolve(data, schema.inner, options, strict);
3715
+ });
3716
+ Schema.extend("any", (data) => {
3717
+ return [data];
3718
+ });
3719
+ Schema.extend("never", (data, _, options) => {
3720
+ throw new ValidationError(`expected nullable but got ${data}`, options);
3721
+ });
3722
+ Schema.extend("const", (data, { value }, options) => {
3723
+ if (deepEqual(data, value)) return [value];
3724
+ throw new ValidationError(`expected ${value} but got ${data}`, options);
3725
+ });
3726
+ function checkWithinRange(data, meta, description, options, skipMin = false) {
3727
+ const { max = Infinity, min = -Infinity } = meta;
3728
+ if (data > max) throw new ValidationError(`expected ${description} <= ${max} but got ${data}`, options);
3729
+ if (data < min && !skipMin) throw new ValidationError(`expected ${description} >= ${min} but got ${data}`, options);
3730
+ }
3731
+ Schema.extend("string", (data, { meta }, options) => {
3732
+ if (typeof data !== "string") throw new ValidationError(`expected string but got ${data}`, options);
3733
+ if (meta.pattern) {
3734
+ const regexp = new RegExp(meta.pattern.source, meta.pattern.flags);
3735
+ if (!regexp.test(data)) throw new ValidationError(`expect string to match regexp ${regexp}`, options);
3736
+ }
3737
+ checkWithinRange(data.length, meta, "string length", options);
3738
+ return [data];
3739
+ });
3740
+ function decimalShift(data, digits) {
3741
+ const str = data.toString();
3742
+ if (str.includes("e")) return data * Math.pow(10, digits);
3743
+ const index = str.indexOf(".");
3744
+ if (index === -1) return data * Math.pow(10, digits);
3745
+ const frac = str.slice(index + 1);
3746
+ const integer = str.slice(0, index);
3747
+ if (frac.length <= digits) return +(integer + frac.padEnd(digits, "0"));
3748
+ return +(integer + frac.slice(0, digits) + "." + frac.slice(digits));
3749
+ }
3750
+ function isMultipleOf(data, min, step) {
3751
+ step = Math.abs(step);
3752
+ if (!/^\d+\.\d+$/.test(step.toString())) return (data - min) % step === 0;
3753
+ const index = step.toString().indexOf(".");
3754
+ const digits = step.toString().slice(index + 1).length;
3755
+ return Math.abs(decimalShift(data, digits) - decimalShift(min, digits)) % decimalShift(step, digits) === 0;
3756
+ }
3757
+ Schema.extend("number", (data, { meta }, options) => {
3758
+ if (typeof data !== "number") throw new ValidationError(`expected number but got ${data}`, options);
3759
+ checkWithinRange(data, meta, "number", options);
3760
+ const { step } = meta;
3761
+ if (step && !isMultipleOf(data, meta.min ?? 0, step)) throw new ValidationError(`expected number multiple of ${step} but got ${data}`, options);
3762
+ return [data];
3763
+ });
3764
+ Schema.extend("boolean", (data, _, options) => {
3765
+ if (typeof data === "boolean") return [data];
3766
+ throw new ValidationError(`expected boolean but got ${data}`, options);
3767
+ });
3768
+ Schema.extend("bitset", (data, { bits, meta }, options) => {
3769
+ let value = 0, keys = [];
3770
+ if (typeof data === "number") {
3771
+ value = data;
3772
+ for (const key in bits) if (data & bits[key]) keys.push(key);
3773
+ } else if (Array.isArray(data)) {
3774
+ keys = data;
3775
+ for (const key of keys) {
3776
+ if (typeof key !== "string") throw new ValidationError(`expected string but got ${key}`, options);
3777
+ if (key in bits) value |= bits[key];
3778
+ }
3779
+ } else throw new ValidationError(`expected number or array but got ${data}`, options);
3780
+ if (value === meta.default) return [value];
3781
+ return [value, keys];
3782
+ });
3783
+ Schema.extend("function", (data, _, options) => {
3784
+ if (typeof data === "function") return [data];
3785
+ throw new ValidationError(`expected function but got ${data}`, options);
3786
+ });
3787
+ Schema.extend("is", (data, { constructor }, options) => {
3788
+ if (typeof constructor === "function") {
3789
+ if (data instanceof constructor) return [data];
3790
+ throw new ValidationError(`expected ${constructor.name} but got ${data}`, options);
3791
+ } else {
3792
+ if (isNullable(data)) throw new ValidationError(`expected ${constructor} but got ${data}`, options);
3793
+ let prototype = Object.getPrototypeOf(data);
3794
+ while (prototype) {
3795
+ if (prototype.constructor?.name === constructor) return [data];
3796
+ prototype = Object.getPrototypeOf(prototype);
3797
+ }
3798
+ throw new ValidationError(`expected ${constructor} but got ${data}`, options);
3799
+ }
3800
+ });
3801
+ function property(data, key, schema, options) {
3802
+ try {
3803
+ const [value, adapted] = Schema.resolve(data[key], schema, {
3804
+ ...options,
3805
+ path: [...options.path || [], key]
3806
+ });
3807
+ if (adapted !== void 0) data[key] = adapted;
3808
+ return value;
3809
+ } catch (e) {
3810
+ if (!options?.autofix) throw e;
3811
+ delete data[key];
3812
+ return schema.meta.volatile ? createVolatile(schema.meta.default) : schema.meta.default;
3813
+ }
3814
+ }
3815
+ Schema.extend("array", (data, { inner, meta }, options) => {
3816
+ if (!Array.isArray(data)) throw new ValidationError(`expected array but got ${data}`, options);
3817
+ checkWithinRange(data.length, meta, "array length", options, !isNullable(inner.meta.default));
3818
+ return [data.map((_, index) => property(data, index, inner, options))];
3819
+ });
3820
+ Schema.extend("dict", (data, { inner, sKey }, options, strict) => {
3821
+ if (!isPlainObject(data)) throw new ValidationError(`expected object but got ${data}`, options);
3822
+ const result = {};
3823
+ for (const key in data) {
3824
+ let rKey;
3825
+ try {
3826
+ rKey = Schema.resolve(key, sKey, options)[0];
3827
+ } catch (error) {
3828
+ if (strict) continue;
3829
+ throw error;
3830
+ }
3831
+ result[rKey] = property(data, key, inner, options);
3832
+ data[rKey] = data[key];
3833
+ if (key !== rKey) delete data[key];
3834
+ }
3835
+ return [result];
3836
+ });
3837
+ Schema.extend("tuple", (data, { list }, options, strict) => {
3838
+ if (!Array.isArray(data)) throw new ValidationError(`expected array but got ${data}`, options);
3839
+ const result = list.map((inner, index) => property(data, index, inner, options));
3840
+ if (strict) return [result];
3841
+ result.push(...data.slice(list.length));
3842
+ return [result];
3843
+ });
3844
+ function merge(result, data) {
3845
+ for (const key in data) {
3846
+ if (key in result) continue;
3847
+ result[key] = data[key];
3848
+ }
3849
+ }
3850
+ Schema.extend("object", (data, { dict }, options, strict) => {
3851
+ if (!isPlainObject(data)) throw new ValidationError(`expected object but got ${data}`, options);
3852
+ const result = {};
3853
+ for (const key in dict) {
3854
+ const value = property(data, key, dict[key], options);
3855
+ if (!isNullable(value) || key in data) result[key] = value;
3856
+ }
3857
+ if (!strict) merge(result, data);
3858
+ return [result];
3859
+ });
3860
+ Schema.extend("union", (data, { list, toString }, options, strict) => {
3861
+ const messages = [];
3862
+ for (const inner of list) try {
3863
+ return Schema.resolve(data, inner, options, strict);
3864
+ } catch (error) {
3865
+ messages.push(error);
3866
+ }
3867
+ throw new ValidationError(`expected ${toString()} but got ${JSON.stringify(data)}`, options);
3868
+ });
3869
+ Schema.extend("intersect", (data, { list, toString }, options, strict) => {
3870
+ if (!list.length) return [data];
3871
+ let result;
3872
+ for (const inner of list) {
3873
+ const value = Schema.resolve(data, inner, options, true)[0];
3874
+ if (isNullable(value)) continue;
3875
+ if (isNullable(result)) result = value;
3876
+ else if (typeof result !== typeof value) throw new ValidationError(`expected ${toString()} but got ${JSON.stringify(data)}`, options);
3877
+ else if (typeof value === "object") merge(result ??= {}, value);
3878
+ else if (result !== value) throw new ValidationError(`expected ${toString()} but got ${JSON.stringify(data)}`, options);
3879
+ }
3880
+ if (!strict && isPlainObject(data)) merge(result, data);
3881
+ return [result];
3882
+ });
3883
+ Schema.extend("transform", (data, { inner, callback, preserve }, options) => {
3884
+ const [result, adapted = data] = Schema.resolve(data, inner, options, true);
3885
+ if (preserve) return [callback(result)];
3886
+ else return [callback(result), callback(adapted)];
3887
+ });
3888
+ const formatters = {};
3889
+ function defineMethod(name, keys, format) {
3890
+ formatters[name] = format;
3891
+ Object.assign(Schema, { [name](...args) {
3892
+ const schema = new Schema({ type: name });
3893
+ keys.forEach((key, index) => {
3894
+ switch (key) {
3895
+ case "sKey":
3896
+ schema.sKey = args[index] ?? Schema.string();
3897
+ break;
3898
+ case "inner":
3899
+ schema.inner = Schema.from(args[index]);
3900
+ break;
3901
+ case "list":
3902
+ schema.list = args[index].map(Schema.from);
3903
+ break;
3904
+ case "dict":
3905
+ schema.dict = mapValues(args[index], Schema.from);
3906
+ break;
3907
+ case "bits":
3908
+ schema.bits = {};
3909
+ for (const key in args[index]) {
3910
+ if (typeof args[index][key] !== "number") continue;
3911
+ schema.bits[key] = args[index][key];
3912
+ }
3913
+ break;
3914
+ case "callback": {
3915
+ const callback = schema.callback = args[index];
3916
+ callback["toJSON"] ||= () => callback.toString();
3917
+ break;
3918
+ }
3919
+ case "constructor": {
3920
+ const constructor = schema.constructor = args[index];
3921
+ if (typeof constructor === "function") constructor["toJSON"] ||= () => constructor["name"];
3922
+ break;
3923
+ }
3924
+ default: schema[key] = args[index];
3925
+ }
3926
+ });
3927
+ if (name === "object" || name === "dict") schema.meta.default = {};
3928
+ else if (name === "array" || name === "tuple") schema.meta.default = [];
3929
+ else if (name === "bitset") schema.meta.default = 0;
3930
+ return schema;
3931
+ } });
3932
+ }
3933
+ defineMethod("is", ["constructor"], ({ constructor }) => {
3934
+ if (typeof constructor === "function") return constructor.name;
3935
+ else return constructor;
3936
+ });
3937
+ defineMethod("any", [], () => "any");
3938
+ defineMethod("never", [], () => "never");
3939
+ defineMethod("const", ["value"], ({ value }) => typeof value === "string" ? JSON.stringify(value) : value);
3940
+ defineMethod("string", [], () => "string");
3941
+ defineMethod("number", [], () => "number");
3942
+ defineMethod("boolean", [], () => "boolean");
3943
+ defineMethod("bitset", ["bits"], () => "bitset");
3944
+ defineMethod("function", [], () => "function");
3945
+ defineMethod("array", ["inner"], ({ inner }) => `${inner.toString(true)}[]`);
3946
+ defineMethod("dict", ["inner", "sKey"], ({ inner, sKey }) => `{ [key: ${sKey.toString()}]: ${inner.toString()} }`);
3947
+ defineMethod("tuple", ["list"], ({ list }) => `[${list.map((inner) => inner.toString()).join(", ")}]`);
3948
+ defineMethod("object", ["dict"], ({ dict }) => {
3949
+ if (Object.keys(dict).length === 0) return "{}";
3950
+ return `{ ${Object.entries(dict).map(([key, inner]) => {
3951
+ return `${key}${inner.meta.required ? "" : "?"}: ${inner.toString()}`;
3952
+ }).join(", ")} }`;
3953
+ });
3954
+ defineMethod("union", ["list"], ({ list }, inline) => {
3955
+ const result = list.map(({ toString: format }) => format()).join(" | ");
3956
+ return inline ? `(${result})` : result;
3957
+ });
3958
+ defineMethod("intersect", ["list"], ({ list }) => {
3959
+ return `${list.map((inner) => inner.toString(true)).join(" & ")}`;
3960
+ });
3961
+ defineMethod("transform", [
3962
+ "inner",
3963
+ "callback",
3964
+ "preserve"
3965
+ ], ({ inner }, isInner) => inner.toString(isInner));
3966
+ //#endregion
3967
+ //#region lib/types/onboarding-config.js
3968
+ /** Public page-bootstrap options shared by the Host and Client halves. */
3969
+ /** Validate Host configuration and its public page-bootstrap payload. */
3970
+ const Config = Schema.object({ credentialOnboarding: Schema.boolean().default(true) });
3971
+ /** Page-global key carrying only the public onboarding options. */
3972
+ const ONBOARDING_CONFIG_GLOBAL = "__DSH_MODELS_ONBOARDING__";
3973
+ //#endregion
2854
3974
  //#region lib/types/client/index.js
2855
3975
  /** Dictionary namespace owned by this plugin. */
2856
3976
  const NS = "settings.models";
@@ -2875,7 +3995,8 @@ window.__ModuleLoader__.load({
2875
3995
  "remote.credentials",
2876
3996
  "remote.llm",
2877
3997
  "remote.settings",
2878
- "settingsScope",
3998
+ "remote.session",
3999
+ "configForms",
2879
4000
  "settingsSchema"
2880
4001
  ];
2881
4002
  /**
@@ -2885,13 +4006,15 @@ window.__ModuleLoader__.load({
2885
4006
  * @param ctx - client root context.
2886
4007
  */
2887
4008
  function apply(ctx) {
4009
+ const payload = globalThis[ONBOARDING_CONFIG_GLOBAL];
4010
+ const credentialOnboarding = Config(payload === void 0 ? {} : payload).credentialOnboarding && !("dshDesktop" in globalThis);
2888
4011
  ctx.effect(() => ctx.locale.register(NS, {
2889
4012
  zh,
2890
4013
  en
2891
4014
  }), "ui-settings-models: copy dictionaries");
2892
4015
  const schema = createSettingsSchemaOperations(ctx.settingsSchema);
2893
4016
  const operations = createModelsOperations(ctx);
2894
- const controller = new ModelsSettingsStore(ctx, schema, ctx.settingsScope.describe());
4017
+ const controller = new ModelsSettingsStore(ctx, schema, ctx.configForms.describe());
2895
4018
  const t = ctx.locale.bind(NS);
2896
4019
  const injected = () => ({
2897
4020
  controller,
@@ -2901,16 +4024,15 @@ window.__ModuleLoader__.load({
2901
4024
  t
2902
4025
  });
2903
4026
  const deepSeekOnboardingInjected = () => ({
4027
+ automatic: credentialOnboarding,
4028
+ track: (name, attributes) => ctx.get("productAnalytics")?.track(name, attributes),
2904
4029
  controller,
2905
4030
  hooks: { models: controller.store },
2906
4031
  operations,
2907
4032
  schema,
2908
4033
  t
2909
4034
  });
2910
- const welcomeController = new WelcomeNoticeStore(ctx.settingsScope.bind({
2911
- namespace: WELCOME_NOTICE_SETTINGS_NAMESPACE,
2912
- decode: decodeWelcomeSection
2913
- }));
4035
+ const welcomeController = new WelcomeNoticeStore(ctx.configForms.get(WELCOME_NOTICE_SETTINGS_NAMESPACE));
2914
4036
  const welcomeInjected = () => ({
2915
4037
  controller: welcomeController,
2916
4038
  hooks: { welcome: welcomeController.store },
@@ -2924,6 +4046,7 @@ window.__ModuleLoader__.load({
2924
4046
  ctx.remote.$on("settings/document-updated", () => {
2925
4047
  refreshModels();
2926
4048
  }),
4049
+ ctx.remote.$on("credentials/record-updated", refreshModels),
2927
4050
  ctx.remote.$on("credentials/reference-updated", refreshModels),
2928
4051
  ctx.remote.$on("llm/adapters-updated", refreshModels),
2929
4052
  ctx.on("connection/reset", refreshModels)
@@ -2950,7 +4073,7 @@ window.__ModuleLoader__.load({
2950
4073
  }
2951
4074
  }
2952
4075
  }, ModelsSection));
2953
- ctx.slots.inject("settings.onboarding", () => ctx.slots.register({
4076
+ if (!("dshDesktop" in globalThis)) ctx.slots.inject("settings.onboarding", () => ctx.slots.register({
2954
4077
  name: "settings.onboarding",
2955
4078
  id: "welcome-notice",
2956
4079
  order: -100,
@@ -2959,6 +4082,10 @@ window.__ModuleLoader__.load({
2959
4082
  ctx.slots.inject("settings.onboarding", () => ctx.slots.register({
2960
4083
  name: "settings.onboarding",
2961
4084
  id: "deepseek-official",
4085
+ children: { "settings.models.sign-in": {
4086
+ kind: "single",
4087
+ scope: "root"
4088
+ } },
2962
4089
  order: 0,
2963
4090
  inject: deepSeekOnboardingInjected
2964
4091
  }, DeepSeekOnboardingDialog));