@mofeng2223/dsh-claude-provider 0.2.3 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -5
- package/README.zh-CN.md +13 -5
- package/cordis.patch.yml +0 -9
- package/lib/client.js +312 -217
- package/package.json +3 -3
- package/src/index.js +2 -297
package/lib/client.js
CHANGED
|
@@ -4,13 +4,11 @@ window.__ModuleLoader__.load({
|
|
|
4
4
|
var module = { exports: {} };
|
|
5
5
|
var exports = module.exports;
|
|
6
6
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
7
|
-
let _deepseek_ai_dsh_client_web_react = require("@deepseek-ai/dsh-client-web-react");
|
|
8
7
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
9
8
|
let react = require("react");
|
|
10
9
|
let react_dom = require("react-dom");
|
|
11
10
|
let _deepseek_ai_dsh_client_ui_primitives = require("@deepseek-ai/dsh-client-ui-primitives");
|
|
12
11
|
let _deepseek_ai_dsh_client_runtime_client = require("@deepseek-ai/dsh-client-runtime/client");
|
|
13
|
-
let _deepseek_ai_dsh_client_schema_form = require("@deepseek-ai/dsh-client-schema-form");
|
|
14
12
|
//#region lib/types/client/apiKey.js
|
|
15
13
|
/**
|
|
16
14
|
* Browser-side judgement of a typed API key.
|
|
@@ -58,7 +56,7 @@ window.__ModuleLoader__.load({
|
|
|
58
56
|
}
|
|
59
57
|
//#endregion
|
|
60
58
|
//#region \0dsh-css:/home/runner/work/deepseek-harness/deepseek-harness/packages/client/ui-settings-models/src/client/ModelsSection.module.css.mjs
|
|
61
|
-
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:1px solid var(--dsw-alias-border-l2);border-radius:12px;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:1px 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;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:1px solid var(--dsw-alias-border-l2);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:12px;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:1px 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:1px 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:1px solid var(--dsw-alias-border-l2);border-radius:8px;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:1px solid var(--dsw-alias-border-l2);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:1px solid var(--dsw-alias-border-l2);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{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_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}";
|
|
59
|
+
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:1px solid var(--dsw-alias-border-l2);border-radius:12px;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:1px 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;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:1px solid var(--dsw-alias-border-l2);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:12px;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:1px 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:1px 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:1px solid var(--dsw-alias-border-l2);border-radius:8px;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:1px solid var(--dsw-alias-border-l2);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:1px solid var(--dsw-alias-border-l2);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{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_candidateActions{justify-content:flex-end;margin-bottom:6px;display:flex}.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}";
|
|
62
60
|
const tagId$3 = "@mofeng2223/dsh-claude-provider/ModelsSection.module.css";
|
|
63
61
|
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$3) + "]") === null) {
|
|
64
62
|
const tag = document.createElement("style");
|
|
@@ -68,67 +66,68 @@ window.__ModuleLoader__.load({
|
|
|
68
66
|
document.head.appendChild(tag);
|
|
69
67
|
}
|
|
70
68
|
var ModelsSection_module_css_default = {
|
|
71
|
-
"
|
|
72
|
-
"
|
|
73
|
-
"deleteDialog": "zGbnIq_deleteDialog",
|
|
74
|
-
"editorHeader": "zGbnIq_editorHeader",
|
|
75
|
-
"addModelButton": "zGbnIq_addModelButton",
|
|
76
|
-
"fieldLabel": "zGbnIq_fieldLabel",
|
|
77
|
-
"deleteConfirm": "zGbnIq_deleteConfirm",
|
|
69
|
+
"addActions": "zGbnIq_addActions",
|
|
70
|
+
"addBlock": "zGbnIq_addBlock",
|
|
78
71
|
"addButton": "zGbnIq_addButton",
|
|
79
|
-
"
|
|
72
|
+
"addCard": "zGbnIq_addCard",
|
|
73
|
+
"addModelButton": "zGbnIq_addModelButton",
|
|
80
74
|
"advancedHint": "zGbnIq_advancedHint",
|
|
81
|
-
"
|
|
82
|
-
"
|
|
83
|
-
"
|
|
84
|
-
"
|
|
85
|
-
"
|
|
75
|
+
"candidate": "zGbnIq_candidate",
|
|
76
|
+
"candidateActions": "zGbnIq_candidateActions",
|
|
77
|
+
"candidateId": "zGbnIq_candidateId",
|
|
78
|
+
"candidateLabel": "zGbnIq_candidateLabel",
|
|
79
|
+
"candidateList": "zGbnIq_candidateList",
|
|
80
|
+
"credentialDot": "zGbnIq_credentialDot",
|
|
86
81
|
"credentialDotConfigured": "zGbnIq_credentialDotConfigured",
|
|
87
|
-
"
|
|
82
|
+
"credentialDotMissing": "zGbnIq_credentialDotMissing",
|
|
83
|
+
"customized": "zGbnIq_customized",
|
|
84
|
+
"customizedBody": "zGbnIq_customizedBody",
|
|
85
|
+
"customizedSummary": "zGbnIq_customizedSummary",
|
|
88
86
|
"dangerButton": "zGbnIq_dangerButton",
|
|
89
|
-
"
|
|
90
|
-
"
|
|
91
|
-
"selectInput": "zGbnIq_selectInput",
|
|
92
|
-
"error": "zGbnIq_error",
|
|
93
|
-
"secondaryButton": "zGbnIq_secondaryButton",
|
|
94
|
-
"modelCatalogHeading": "zGbnIq_modelCatalogHeading",
|
|
95
|
-
"modelList": "zGbnIq_modelList",
|
|
96
|
-
"modelEntry": "zGbnIq_modelEntry",
|
|
97
|
-
"candidate": "zGbnIq_candidate",
|
|
98
|
-
"modelFieldLabel": "zGbnIq_modelFieldLabel",
|
|
87
|
+
"deleteConfirm": "zGbnIq_deleteConfirm",
|
|
88
|
+
"deleteDialog": "zGbnIq_deleteDialog",
|
|
99
89
|
"editor": "zGbnIq_editor",
|
|
90
|
+
"editorActions": "zGbnIq_editorActions",
|
|
91
|
+
"editorHeader": "zGbnIq_editorHeader",
|
|
92
|
+
"editorRoute": "zGbnIq_editorRoute",
|
|
93
|
+
"editorTitle": "zGbnIq_editorTitle",
|
|
94
|
+
"error": "zGbnIq_error",
|
|
95
|
+
"fetchDialog": "zGbnIq_fetchDialog",
|
|
96
|
+
"field": "zGbnIq_field",
|
|
97
|
+
"fieldLabel": "zGbnIq_fieldLabel",
|
|
98
|
+
"hiddenLabel": "zGbnIq_hiddenLabel",
|
|
99
|
+
"iconButton": "zGbnIq_iconButton",
|
|
100
|
+
"iconButtonDanger": "zGbnIq_iconButtonDanger",
|
|
101
|
+
"input": "zGbnIq_input",
|
|
100
102
|
"intro": "zGbnIq_intro",
|
|
103
|
+
"linkButton": "zGbnIq_linkButton",
|
|
104
|
+
"modelAdvanced": "zGbnIq_modelAdvanced",
|
|
105
|
+
"modelCatalog": "zGbnIq_modelCatalog",
|
|
106
|
+
"modelCatalogHeading": "zGbnIq_modelCatalogHeading",
|
|
107
|
+
"modelCatalogMeta": "zGbnIq_modelCatalogMeta",
|
|
101
108
|
"modelCatalogTitle": "zGbnIq_modelCatalogTitle",
|
|
102
|
-
"input": "zGbnIq_input",
|
|
103
|
-
"rowTag": "zGbnIq_rowTag",
|
|
104
|
-
"notice": "zGbnIq_notice",
|
|
105
109
|
"modelEmpty": "zGbnIq_modelEmpty",
|
|
106
|
-
"
|
|
107
|
-
"iconButton": "zGbnIq_iconButton",
|
|
108
|
-
"linkButton": "zGbnIq_linkButton",
|
|
109
|
-
"hiddenLabel": "zGbnIq_hiddenLabel",
|
|
110
|
-
"candidateId": "zGbnIq_candidateId",
|
|
111
|
-
"setupCard": "zGbnIq_setupCard",
|
|
112
|
-
"iconButtonDanger": "zGbnIq_iconButtonDanger",
|
|
113
|
-
"title": "zGbnIq_title",
|
|
114
|
-
"rowIdentity": "zGbnIq_rowIdentity",
|
|
115
|
-
"savedNotice": "zGbnIq_savedNotice",
|
|
116
|
-
"candidateLabel": "zGbnIq_candidateLabel",
|
|
117
|
-
"rowActions": "zGbnIq_rowActions",
|
|
118
|
-
"addActions": "zGbnIq_addActions",
|
|
119
|
-
"candidateList": "zGbnIq_candidateList",
|
|
120
|
-
"rows": "zGbnIq_rows",
|
|
121
|
-
"rowName": "zGbnIq_rowName",
|
|
110
|
+
"modelEntry": "zGbnIq_modelEntry",
|
|
122
111
|
"modelField": "zGbnIq_modelField",
|
|
123
|
-
"
|
|
112
|
+
"modelFieldLabel": "zGbnIq_modelFieldLabel",
|
|
113
|
+
"modelList": "zGbnIq_modelList",
|
|
124
114
|
"modelListHead": "zGbnIq_modelListHead",
|
|
125
|
-
"
|
|
115
|
+
"modelRow": "zGbnIq_modelRow",
|
|
116
|
+
"notice": "zGbnIq_notice",
|
|
117
|
+
"primaryButton": "zGbnIq_primaryButton",
|
|
118
|
+
"rowActions": "zGbnIq_rowActions",
|
|
119
|
+
"rowCard": "zGbnIq_rowCard",
|
|
126
120
|
"rowHead": "zGbnIq_rowHead",
|
|
127
|
-
"
|
|
128
|
-
"
|
|
129
|
-
"
|
|
130
|
-
"
|
|
131
|
-
"
|
|
121
|
+
"rowIdentity": "zGbnIq_rowIdentity",
|
|
122
|
+
"rowName": "zGbnIq_rowName",
|
|
123
|
+
"rowTag": "zGbnIq_rowTag",
|
|
124
|
+
"rows": "zGbnIq_rows",
|
|
125
|
+
"savedNotice": "zGbnIq_savedNotice",
|
|
126
|
+
"secondaryButton": "zGbnIq_secondaryButton",
|
|
127
|
+
"section": "zGbnIq_section",
|
|
128
|
+
"selectInput": "zGbnIq_selectInput",
|
|
129
|
+
"setupCard": "zGbnIq_setupCard",
|
|
130
|
+
"title": "zGbnIq_title"
|
|
132
131
|
};
|
|
133
132
|
//#endregion
|
|
134
133
|
//#region lib/types/client/EditorFooter.js
|
|
@@ -447,7 +446,7 @@ window.__ModuleLoader__.load({
|
|
|
447
446
|
//#region lib/types/client/store.js
|
|
448
447
|
/**
|
|
449
448
|
* Models settings page store: one snapshot joining the configurable-provider
|
|
450
|
-
* directory (`llm.providers`), the settings namespaces (
|
|
449
|
+
* directory (`llm.providers`), the settings namespaces (shared settings mirror),
|
|
451
450
|
* and the referenced credentials (`credentials.describe`). The host stays the
|
|
452
451
|
* single fact source — every mutation writes through the wire and the page
|
|
453
452
|
* re-renders from the next describe, pushed or refetched.
|
|
@@ -464,7 +463,7 @@ window.__ModuleLoader__.load({
|
|
|
464
463
|
* @param error - the rejection value.
|
|
465
464
|
* @returns the message to show.
|
|
466
465
|
*/
|
|
467
|
-
function messageOf
|
|
466
|
+
function messageOf(error) {
|
|
468
467
|
return error instanceof Error ? error.message : String(error);
|
|
469
468
|
}
|
|
470
469
|
/**
|
|
@@ -483,11 +482,12 @@ window.__ModuleLoader__.load({
|
|
|
483
482
|
* the choices the page offers cannot drift from the ones the adapter accepts:
|
|
484
483
|
* both come from the same `Config`.
|
|
485
484
|
* @param namespace - the namespace view whose schema declares the profile shape.
|
|
485
|
+
* @param schema - settings schema operations.
|
|
486
486
|
* @returns the protocol identifiers, or an empty list when the schema has none.
|
|
487
487
|
*/
|
|
488
|
-
function protocolChoices(namespace) {
|
|
488
|
+
function protocolChoices(namespace, schema) {
|
|
489
489
|
if (namespace === void 0) return [];
|
|
490
|
-
const list =
|
|
490
|
+
const list = schema.nodeAtPath(schema.rehydrate(namespace.schema), [
|
|
491
491
|
"providers",
|
|
492
492
|
PROBE_ROUTE,
|
|
493
493
|
"api"
|
|
@@ -496,9 +496,9 @@ window.__ModuleLoader__.load({
|
|
|
496
496
|
return list.list.map((entry) => entry.value).filter((value) => typeof value === "string");
|
|
497
497
|
}
|
|
498
498
|
/** The credential reference a resolved profile names (its `apiKeyEnv` field). */
|
|
499
|
-
function apiKeyEnvOf(namespace, path) {
|
|
499
|
+
function apiKeyEnvOf(namespace, path, schema) {
|
|
500
500
|
if (namespace === void 0) return void 0;
|
|
501
|
-
const profile =
|
|
501
|
+
const profile = schema.getPath(namespace.value, path);
|
|
502
502
|
if (typeof profile !== "object" || profile === null) return void 0;
|
|
503
503
|
const ref = profile.apiKeyEnv;
|
|
504
504
|
return typeof ref === "string" && ref.length > 0 ? ref : void 0;
|
|
@@ -506,6 +506,8 @@ window.__ModuleLoader__.load({
|
|
|
506
506
|
/** The models settings page controller (one per settings surface). */
|
|
507
507
|
var ModelsSettingsStore = class {
|
|
508
508
|
api;
|
|
509
|
+
schema;
|
|
510
|
+
describeFace;
|
|
509
511
|
/** The snapshot the section renders from (uSES-safe store). */
|
|
510
512
|
store = (0, _deepseek_ai_dsh_client_runtime_client.createSnapshotStore)({
|
|
511
513
|
status: "idle",
|
|
@@ -518,15 +520,20 @@ window.__ModuleLoader__.load({
|
|
|
518
520
|
/** Latest load wins; an older response never overwrites a newer one. */
|
|
519
521
|
generation = 0;
|
|
520
522
|
/**
|
|
521
|
-
* @param api - the wire face (
|
|
523
|
+
* @param api - the wire face (credentials/llm domains, and settings writes).
|
|
524
|
+
* @param describeFace - the shared mirror's describe face (namespace views and writability).
|
|
522
525
|
*/
|
|
523
|
-
constructor(api) {
|
|
526
|
+
constructor(api, schema, describeFace) {
|
|
524
527
|
this.api = api;
|
|
528
|
+
this.schema = schema;
|
|
529
|
+
this.describeFace = describeFace;
|
|
525
530
|
}
|
|
526
531
|
/**
|
|
527
|
-
* Refresh the whole page snapshot: directory and
|
|
528
|
-
* then one batched credential describe over
|
|
529
|
-
*
|
|
532
|
+
* Refresh the whole page snapshot: the provider directory and the mirror's
|
|
533
|
+
* settings answer in parallel, then one batched credential describe over
|
|
534
|
+
* every referenced ref. Provider failure or absence of an initial settings
|
|
535
|
+
* answer keeps the last good rows and surfaces an error; a failed settings
|
|
536
|
+
* refresh reuses the mirror's held view.
|
|
530
537
|
* @returns nothing; the snapshot carries the outcome.
|
|
531
538
|
*/
|
|
532
539
|
async load() {
|
|
@@ -539,12 +546,13 @@ window.__ModuleLoader__.load({
|
|
|
539
546
|
let writable;
|
|
540
547
|
let views;
|
|
541
548
|
try {
|
|
542
|
-
const [providersResponse
|
|
549
|
+
const [providersResponse] = await Promise.all([this.api.llm.providers({}), this.describeFace.ensure()]);
|
|
543
550
|
if (!providersResponse.result.ok) throw new Error(providersResponse.result.error.message);
|
|
544
|
-
|
|
551
|
+
const mirrored = this.describeFace.getSnapshot();
|
|
552
|
+
if (mirrored.view === void 0) throw new Error(mirrored.error ?? "settings are unavailable in this browser");
|
|
545
553
|
providers = providersResponse.result.value.providers.filter((entry) => entry.provider !== CLAUDE_PROVIDER_DIRECTORY_SENTINEL);
|
|
546
|
-
writable =
|
|
547
|
-
views =
|
|
554
|
+
writable = mirrored.view.writable;
|
|
555
|
+
views = mirrored.view.namespaces;
|
|
548
556
|
} catch (error) {
|
|
549
557
|
if (generation !== this.generation) return;
|
|
550
558
|
this.store.update((s) => {
|
|
@@ -558,9 +566,9 @@ window.__ModuleLoader__.load({
|
|
|
558
566
|
const namespace = namespaces.get(entry.settingsNs);
|
|
559
567
|
return {
|
|
560
568
|
entry,
|
|
561
|
-
configured: namespace !== void 0 && (entry.settingsPath.length === 0 ||
|
|
562
|
-
removable: namespace !== void 0 && entry.settingsPath.length > 0 &&
|
|
563
|
-
apiKeyEnv: apiKeyEnvOf(namespace, entry.settingsPath),
|
|
569
|
+
configured: namespace !== void 0 && (entry.settingsPath.length === 0 || this.schema.getPath(namespace.value, entry.settingsPath) !== void 0),
|
|
570
|
+
removable: namespace !== void 0 && entry.settingsPath.length > 0 && this.schema.hasPath(namespace.user, entry.settingsPath) && !this.schema.hasPath(namespace.base, entry.settingsPath),
|
|
571
|
+
apiKeyEnv: apiKeyEnvOf(namespace, entry.settingsPath, this.schema),
|
|
564
572
|
credential: void 0
|
|
565
573
|
};
|
|
566
574
|
});
|
|
@@ -572,7 +580,7 @@ window.__ModuleLoader__.load({
|
|
|
572
580
|
if (response.result.ok) credentials = response.result.value.credentials;
|
|
573
581
|
else credentialError = response.result.error.message;
|
|
574
582
|
} catch (error) {
|
|
575
|
-
credentialError = messageOf
|
|
583
|
+
credentialError = messageOf(error);
|
|
576
584
|
}
|
|
577
585
|
if (generation !== this.generation) return;
|
|
578
586
|
this.store.update((s) => {
|
|
@@ -811,7 +819,7 @@ window.__ModuleLoader__.load({
|
|
|
811
819
|
setCandidates(found);
|
|
812
820
|
setPicked(new Set(found.filter((model) => !known.has(model.id)).map((model) => model.id)));
|
|
813
821
|
} catch (error) {
|
|
814
|
-
setFailure(messageOf
|
|
822
|
+
setFailure(messageOf(error));
|
|
815
823
|
} finally {
|
|
816
824
|
setBusy(false);
|
|
817
825
|
}
|
|
@@ -838,6 +846,13 @@ window.__ModuleLoader__.load({
|
|
|
838
846
|
return next;
|
|
839
847
|
});
|
|
840
848
|
};
|
|
849
|
+
const activeCandidates = candidates ?? [];
|
|
850
|
+
const allCandidatesPicked = activeCandidates.length > 0 && activeCandidates.every((candidate) => picked.has(candidate.id));
|
|
851
|
+
const toggleAllCandidates = () => {
|
|
852
|
+
setPicked((current) => {
|
|
853
|
+
return activeCandidates.every((candidate) => current.has(candidate.id)) ? /* @__PURE__ */ new Set() : new Set(activeCandidates.map((candidate) => candidate.id));
|
|
854
|
+
});
|
|
855
|
+
};
|
|
841
856
|
const askable = probe.provider !== void 0 || probe.baseURL !== void 0 && probe.baseURL.length > 0;
|
|
842
857
|
return (0, react_jsx_runtime.jsxs)("section", {
|
|
843
858
|
className: ModelsSection_module_css_default["modelCatalog"],
|
|
@@ -1003,7 +1018,7 @@ window.__ModuleLoader__.load({
|
|
|
1003
1018
|
className: ModelsSection_module_css_default["error"],
|
|
1004
1019
|
children: failure
|
|
1005
1020
|
}) : null,
|
|
1006
|
-
(0, react_jsx_runtime.
|
|
1021
|
+
(0, react_jsx_runtime.jsxs)(_deepseek_ai_dsh_client_ui_primitives.Modal, {
|
|
1007
1022
|
open: candidates !== void 0,
|
|
1008
1023
|
onClose: closePicker,
|
|
1009
1024
|
title: t("fetchTitle"),
|
|
@@ -1019,7 +1034,15 @@ window.__ModuleLoader__.load({
|
|
|
1019
1034
|
onClick: adoptPicked,
|
|
1020
1035
|
children: t("fetchAdopt")
|
|
1021
1036
|
})] }),
|
|
1022
|
-
children: (0, react_jsx_runtime.jsx)("
|
|
1037
|
+
children: [(0, react_jsx_runtime.jsx)("div", {
|
|
1038
|
+
className: ModelsSection_module_css_default["candidateActions"],
|
|
1039
|
+
children: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
1040
|
+
variant: "ghost",
|
|
1041
|
+
size: "sm",
|
|
1042
|
+
onClick: toggleAllCandidates,
|
|
1043
|
+
children: t(allCandidatesPicked ? "fetchDeselectAll" : "fetchSelectAll")
|
|
1044
|
+
})
|
|
1045
|
+
}), (0, react_jsx_runtime.jsx)("ul", {
|
|
1023
1046
|
className: ModelsSection_module_css_default["candidateList"],
|
|
1024
1047
|
children: (candidates ?? []).map((candidate) => (0, react_jsx_runtime.jsx)("li", {
|
|
1025
1048
|
className: ModelsSection_module_css_default["candidate"],
|
|
@@ -1037,7 +1060,7 @@ window.__ModuleLoader__.load({
|
|
|
1037
1060
|
})]
|
|
1038
1061
|
})
|
|
1039
1062
|
}, candidate.id))
|
|
1040
|
-
})
|
|
1063
|
+
})]
|
|
1041
1064
|
})
|
|
1042
1065
|
]
|
|
1043
1066
|
});
|
|
@@ -1121,7 +1144,7 @@ window.__ModuleLoader__.load({
|
|
|
1121
1144
|
...storesKey ? { apiKeyEnv: keyRef } : {},
|
|
1122
1145
|
api: isAdaptiveClaude ? "anthropic-messages" : protocol,
|
|
1123
1146
|
baseURL,
|
|
1124
|
-
models: models.map((model) => isAdaptiveClaude ?
|
|
1147
|
+
models: models.map((model) => isAdaptiveClaude ? withNativeClaudeModel(model) : { ...model }),
|
|
1125
1148
|
...isAdaptiveClaude ? { reasoning: "high" } : {}
|
|
1126
1149
|
};
|
|
1127
1150
|
const response = await api.settings.mutate({
|
|
@@ -1162,7 +1185,7 @@ window.__ModuleLoader__.load({
|
|
|
1162
1185
|
}
|
|
1163
1186
|
props.onClose(true);
|
|
1164
1187
|
} catch (error) {
|
|
1165
|
-
setFailure(messageOf
|
|
1188
|
+
setFailure(messageOf(error));
|
|
1166
1189
|
} finally {
|
|
1167
1190
|
setBusy(false);
|
|
1168
1191
|
}
|
|
@@ -1350,8 +1373,8 @@ window.__ModuleLoader__.load({
|
|
|
1350
1373
|
/** The public DeepSeek endpoint shown as the deepseek base-URL placeholder. */
|
|
1351
1374
|
const DEEPSEEK_PUBLIC_BASE_URL = "https://api.deepseek.com";
|
|
1352
1375
|
/** A user-section subtree as a plain draft object (absent → empty). */
|
|
1353
|
-
function draftAt(namespace, path) {
|
|
1354
|
-
const subtree =
|
|
1376
|
+
function draftAt(schema, namespace, path) {
|
|
1377
|
+
const subtree = schema.getPath(namespace.user, path);
|
|
1355
1378
|
if (typeof subtree !== "object" || subtree === null || Array.isArray(subtree)) return {};
|
|
1356
1379
|
return structuredClone(subtree);
|
|
1357
1380
|
}
|
|
@@ -1389,8 +1412,8 @@ window.__ModuleLoader__.load({
|
|
|
1389
1412
|
return "unknown";
|
|
1390
1413
|
}
|
|
1391
1414
|
/** The credential reference this profile resolves keys through. */
|
|
1392
|
-
function refFor(namespace, path, provider) {
|
|
1393
|
-
const profile =
|
|
1415
|
+
function refFor(schema, namespace, path, provider) {
|
|
1416
|
+
const profile = schema.getPath(namespace.value, path);
|
|
1394
1417
|
const named = typeof profile === "object" && profile !== null ? profile.apiKeyEnv : void 0;
|
|
1395
1418
|
return typeof named === "string" && named.length > 0 ? named : deriveKeyRef(provider);
|
|
1396
1419
|
}
|
|
@@ -1400,21 +1423,29 @@ window.__ModuleLoader__.load({
|
|
|
1400
1423
|
* @returns the editor card.
|
|
1401
1424
|
*/
|
|
1402
1425
|
function ProviderEditor(props) {
|
|
1403
|
-
const { namespace, settingsPath, api, t } = props;
|
|
1404
|
-
const [draft, setDraft] = (0, react.useState)(() => draftAt(namespace, settingsPath));
|
|
1426
|
+
const { namespace, schema, settingsPath, api, t } = props;
|
|
1427
|
+
const [draft, setDraft] = (0, react.useState)(() => draftAt(schema, namespace, settingsPath));
|
|
1405
1428
|
const [keyDraft, setKeyDraft] = (0, react.useState)("");
|
|
1406
1429
|
const [keyState, setKeyState] = (0, react.useState)(void 0);
|
|
1407
1430
|
const [busy, setBusy] = (0, react.useState)(false);
|
|
1408
1431
|
const [failure, setFailure] = (0, react.useState)(void 0);
|
|
1409
|
-
const [committedOriginal, setCommittedOriginal] = (0, react.useState)(() =>
|
|
1432
|
+
const [committedOriginal, setCommittedOriginal] = (0, react.useState)(() => schema.getPath(namespace.user, settingsPath));
|
|
1410
1433
|
const [expectedRevision, setExpectedRevision] = (0, react.useState)(() => namespace.revision);
|
|
1411
|
-
const root = (0, react.useMemo)(() =>
|
|
1412
|
-
const node = (0, react.useMemo)(() =>
|
|
1413
|
-
|
|
1434
|
+
const root = (0, react.useMemo)(() => schema.rehydrate(namespace.schema), [namespace.schema, schema]);
|
|
1435
|
+
const node = (0, react.useMemo)(() => schema.nodeAtPath(root, settingsPath), [
|
|
1436
|
+
root,
|
|
1437
|
+
schema,
|
|
1438
|
+
settingsPath
|
|
1439
|
+
]);
|
|
1440
|
+
const fallback = schema.getPath(namespace.value, settingsPath);
|
|
1414
1441
|
const disabled = props.readOnly || busy;
|
|
1415
1442
|
const layout = layoutOf(namespace.ns);
|
|
1416
|
-
const keyRef = refFor(namespace, settingsPath, props.provider);
|
|
1417
|
-
const protocols = (0, react.useMemo)(() => layout === "pi-ai" ? protocolChoices(namespace) : [], [
|
|
1443
|
+
const keyRef = refFor(schema, namespace, settingsPath, props.provider);
|
|
1444
|
+
const protocols = (0, react.useMemo)(() => layout === "pi-ai" ? protocolChoices(namespace, schema) : [], [
|
|
1445
|
+
layout,
|
|
1446
|
+
namespace,
|
|
1447
|
+
schema
|
|
1448
|
+
]);
|
|
1418
1449
|
(0, react.useEffect)(() => {
|
|
1419
1450
|
let stale = false;
|
|
1420
1451
|
setKeyState(void 0);
|
|
@@ -1427,14 +1458,14 @@ window.__ModuleLoader__.load({
|
|
|
1427
1458
|
};
|
|
1428
1459
|
}, [api.credentials, keyRef]);
|
|
1429
1460
|
const stringAt = (source, key) => {
|
|
1430
|
-
const value =
|
|
1461
|
+
const value = schema.getPath(source, [key]);
|
|
1431
1462
|
return typeof value === "string" && value.trim().length > 0 ? value : void 0;
|
|
1432
1463
|
};
|
|
1433
1464
|
const setField = (key, next) => {
|
|
1434
1465
|
const value = next === void 0 || next.trim().length === 0 ? void 0 : next;
|
|
1435
|
-
setDraft((current) => value === void 0 ?
|
|
1466
|
+
setDraft((current) => value === void 0 ? schema.deletePath(current, [key]) : schema.setPath(current, [key], value));
|
|
1436
1467
|
};
|
|
1437
|
-
const modelFailure = validateDeepSeekModels(
|
|
1468
|
+
const modelFailure = validateDeepSeekModels(schema.getPath(draft, ["models"]));
|
|
1438
1469
|
const keyFailure = apiKeyFailure(keyDraft);
|
|
1439
1470
|
const keyValue = keyDraft.trim();
|
|
1440
1471
|
const shownKeyFailure = (props.credentialRequired === true && keyDraft.length > 0 && keyValue.length === 0 ? "keyRequired" : void 0) ?? keyFailure;
|
|
@@ -1455,15 +1486,16 @@ window.__ModuleLoader__.load({
|
|
|
1455
1486
|
*/
|
|
1456
1487
|
const applyOnce = async () => {
|
|
1457
1488
|
const ns = namespace.ns;
|
|
1458
|
-
const
|
|
1489
|
+
const credentialDraft = layout === "pi-ai" && stringAt(draft, "apiKeyEnv") === void 0 && stringAt(fallback, "apiKeyEnv") === void 0 && keyValue.length > 0 ? schema.setPath(draft, ["apiKeyEnv"], keyRef) : draft;
|
|
1490
|
+
const next = props.thinkingPresets === true ? withNativeClaudeProfile(credentialDraft) : credentialDraft;
|
|
1459
1491
|
if (props.credentialOnly !== true) {
|
|
1460
|
-
const failure = validateDeepSeekModels(
|
|
1492
|
+
const failure = validateDeepSeekModels(schema.getPath(next, ["models"]));
|
|
1461
1493
|
/* v8 ignore next 3 -- unreachable from the card: the same failure disables submit */
|
|
1462
1494
|
if (failure !== void 0) return `${t("model")} ${String(failure.index + 1)}: ${t(failure.key)}`;
|
|
1463
1495
|
}
|
|
1464
1496
|
/* v8 ignore next -- apply is only reachable from the rendered card, which required a resolved node */
|
|
1465
1497
|
if (props.credentialOnly !== true && node !== void 0 && settingsPath.length === 0) {
|
|
1466
|
-
const sectionError =
|
|
1498
|
+
const sectionError = schema.validate(node, next);
|
|
1467
1499
|
if (sectionError !== void 0) return sectionError;
|
|
1468
1500
|
}
|
|
1469
1501
|
const materializesNativeProfile = layout === "pi-ai" && fallback === void 0 && committedOriginal === void 0 && Object.keys(next).length === 0;
|
|
@@ -1479,7 +1511,7 @@ window.__ModuleLoader__.load({
|
|
|
1479
1511
|
expectedRevision
|
|
1480
1512
|
});
|
|
1481
1513
|
if (!response.result.ok) return response.result.error.code === "settings-conflict" ? t("conflict") : response.result.error.message;
|
|
1482
|
-
setCommittedOriginal(
|
|
1514
|
+
setCommittedOriginal(schema.getPath(response.result.value.user, settingsPath));
|
|
1483
1515
|
setExpectedRevision(response.result.value.revision);
|
|
1484
1516
|
setDraft(next);
|
|
1485
1517
|
}
|
|
@@ -1503,7 +1535,7 @@ window.__ModuleLoader__.load({
|
|
|
1503
1535
|
}
|
|
1504
1536
|
props.onClose(true);
|
|
1505
1537
|
} catch (error) {
|
|
1506
|
-
setFailure(messageOf
|
|
1538
|
+
setFailure(messageOf(error));
|
|
1507
1539
|
} finally {
|
|
1508
1540
|
setBusy(false);
|
|
1509
1541
|
}
|
|
@@ -1521,7 +1553,7 @@ window.__ModuleLoader__.load({
|
|
|
1521
1553
|
* moment reset drops it, leaving the rows unchanged until a reload.
|
|
1522
1554
|
*/
|
|
1523
1555
|
const inheritedModels = () => {
|
|
1524
|
-
return
|
|
1556
|
+
return schema.getPath(namespace.base, [...settingsPath, "models"]) ?? schema.nodeAtPath(root, [...settingsPath, "models"])?.meta.default;
|
|
1525
1557
|
};
|
|
1526
1558
|
/**
|
|
1527
1559
|
* The curated fields of one known adapter family. The family arrives
|
|
@@ -1530,11 +1562,11 @@ window.__ModuleLoader__.load({
|
|
|
1530
1562
|
*/
|
|
1531
1563
|
const curatedFields = (family) => {
|
|
1532
1564
|
const ownsIdentity = family === "pi-ai" && props.declared === true;
|
|
1533
|
-
const customModels =
|
|
1534
|
-
const modelsOverridden =
|
|
1565
|
+
const customModels = schema.getPath(draft, ["models"]);
|
|
1566
|
+
const modelsOverridden = schema.hasPath(draft, ["models"]);
|
|
1535
1567
|
const models = modelDrafts(modelsOverridden ? customModels : inheritedModels());
|
|
1536
|
-
const defaultContextWindow =
|
|
1537
|
-
const defaultMaxTokens =
|
|
1568
|
+
const defaultContextWindow = schema.getPath(fallback, ["defaultContextWindow"]);
|
|
1569
|
+
const defaultMaxTokens = schema.getPath(fallback, ["maxTokens"]);
|
|
1538
1570
|
const keyPlaceholder = keyLocked ? t("keyEnvLocked") : keyState?.configured === true && props.credentialRequired !== true ? t("keyStored") : family === "pi-ai" ? t("keyPlaceholderNative") : t("keyPlaceholder");
|
|
1539
1571
|
/** What both family editors take: the rows, whose layer owns them, and the two writes. */
|
|
1540
1572
|
const catalogProps = {
|
|
@@ -1543,10 +1575,10 @@ window.__ModuleLoader__.load({
|
|
|
1543
1575
|
t,
|
|
1544
1576
|
disabled,
|
|
1545
1577
|
onChange: (next) => {
|
|
1546
|
-
setDraft((current) =>
|
|
1578
|
+
setDraft((current) => schema.setPath(current, ["models"], next));
|
|
1547
1579
|
},
|
|
1548
1580
|
onReset: () => {
|
|
1549
|
-
setDraft((current) =>
|
|
1581
|
+
setDraft((current) => schema.deletePath(current, ["models"]));
|
|
1550
1582
|
}
|
|
1551
1583
|
};
|
|
1552
1584
|
return (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [(0, react_jsx_runtime.jsxs)("div", {
|
|
@@ -1593,7 +1625,7 @@ window.__ModuleLoader__.load({
|
|
|
1593
1625
|
className: ModelsSection_module_css_default["input"],
|
|
1594
1626
|
type: "text",
|
|
1595
1627
|
value: stringAt(draft, "displayName") ?? "",
|
|
1596
|
-
placeholder: stringAt(
|
|
1628
|
+
placeholder: stringAt(schema.getPath(namespace.base, settingsPath), "displayName") ?? props.provider,
|
|
1597
1629
|
"aria-label": t("customDisplayName"),
|
|
1598
1630
|
disabled,
|
|
1599
1631
|
onChange: (event) => {
|
|
@@ -1627,7 +1659,7 @@ window.__ModuleLoader__.load({
|
|
|
1627
1659
|
className: `${ModelsSection_module_css_default["input"]} ${ModelsSection_module_css_default["selectInput"]}`,
|
|
1628
1660
|
value: probeApi ?? "",
|
|
1629
1661
|
"aria-label": t("customApi"),
|
|
1630
|
-
disabled,
|
|
1662
|
+
disabled: disabled || props.thinkingPresets === true,
|
|
1631
1663
|
onChange: (event) => {
|
|
1632
1664
|
setField("api", event.target.value);
|
|
1633
1665
|
},
|
|
@@ -1753,7 +1785,7 @@ window.__ModuleLoader__.load({
|
|
|
1753
1785
|
});
|
|
1754
1786
|
if (!typeResponse.result.ok) return typeResponse.result.error.message;
|
|
1755
1787
|
} catch (error) {
|
|
1756
|
-
return messageOf
|
|
1788
|
+
return messageOf(error);
|
|
1757
1789
|
}
|
|
1758
1790
|
await controller.load();
|
|
1759
1791
|
}
|
|
@@ -1825,6 +1857,30 @@ window.__ModuleLoader__.load({
|
|
|
1825
1857
|
? { ...model }
|
|
1826
1858
|
: { ...model, reasoningEfforts: reasoningEffortsForPreset("five") };
|
|
1827
1859
|
}
|
|
1860
|
+
function withNativeClaudeModel(model) {
|
|
1861
|
+
const next = withDefaultClaudeReasoning(model);
|
|
1862
|
+
const efforts = next.reasoningEfforts;
|
|
1863
|
+
const adaptive = efforts !== null && typeof efforts === "object" && !Array.isArray(efforts)
|
|
1864
|
+
&& ["low", "medium", "high", "max"].every((level) => typeof efforts[level] === "string" && efforts[level].length > 0);
|
|
1865
|
+
const compat = { ...(next.compat ?? {}) };
|
|
1866
|
+
if (adaptive) compat.forceAdaptiveThinking = true;
|
|
1867
|
+
else Reflect.deleteProperty(compat, "forceAdaptiveThinking");
|
|
1868
|
+
const { compat: _compat, ...rest } = next;
|
|
1869
|
+
return { ...rest, ...Object.keys(compat).length === 0 ? {} : { compat } };
|
|
1870
|
+
}
|
|
1871
|
+
function withNativeClaudeProfile(profile) {
|
|
1872
|
+
const { compat: currentCompat, ...rest } = profile ?? {};
|
|
1873
|
+
const compat = { ...(currentCompat ?? {}) };
|
|
1874
|
+
Reflect.deleteProperty(compat, "forceAdaptiveThinking");
|
|
1875
|
+
const models = Array.isArray(profile?.models) ? profile.models.map(withNativeClaudeModel) : profile?.models;
|
|
1876
|
+
return {
|
|
1877
|
+
...rest,
|
|
1878
|
+
api: "anthropic-messages",
|
|
1879
|
+
...Object.keys(compat).length === 0 ? {} : { compat },
|
|
1880
|
+
...models === void 0 ? {} : { models },
|
|
1881
|
+
reasoning: "high"
|
|
1882
|
+
};
|
|
1883
|
+
}
|
|
1828
1884
|
function ClaudeThinkingHelp(props) {
|
|
1829
1885
|
const anchorRef = (0, react.useRef)(null);
|
|
1830
1886
|
const tooltipRef = (0, react.useRef)(null);
|
|
@@ -1892,17 +1948,18 @@ window.__ModuleLoader__.load({
|
|
|
1892
1948
|
* @returns the section, or null while the shell has not injected yet.
|
|
1893
1949
|
*/
|
|
1894
1950
|
function ModelsSection(props) {
|
|
1895
|
-
const { controller, useSnapshot, api, t } = props;
|
|
1896
|
-
if (controller === void 0 || useSnapshot === void 0 || api === void 0 || t === void 0) return null;
|
|
1951
|
+
const { controller, useSnapshot, api, schema, t } = props;
|
|
1952
|
+
if (controller === void 0 || useSnapshot === void 0 || api === void 0 || schema === void 0 || t === void 0) return null;
|
|
1897
1953
|
return (0, react_jsx_runtime.jsx)(Loaded, { injected: {
|
|
1898
1954
|
controller,
|
|
1899
1955
|
useSnapshot,
|
|
1900
1956
|
api,
|
|
1957
|
+
schema,
|
|
1901
1958
|
t
|
|
1902
1959
|
} });
|
|
1903
1960
|
}
|
|
1904
1961
|
function Loaded({ injected }) {
|
|
1905
|
-
const { controller, api, t } = injected;
|
|
1962
|
+
const { controller, api, schema, t } = injected;
|
|
1906
1963
|
const state = injected.useSnapshot((snapshot) => snapshot);
|
|
1907
1964
|
const [editing, setEditing] = (0, react.useState)(void 0);
|
|
1908
1965
|
const [adding, setAdding] = (0, react.useState)(false);
|
|
@@ -1983,7 +2040,7 @@ window.__ModuleLoader__.load({
|
|
|
1983
2040
|
const addable = state.rows.filter((row) => !row.configured && row.entry.settingsNs !== "");
|
|
1984
2041
|
const addTarget = adding ? editing : void 0;
|
|
1985
2042
|
const addNamespace = addTarget === void 0 ? void 0 : state.namespaces.get(addTarget.settingsNs);
|
|
1986
|
-
const protocols = protocolChoices(state.namespaces.get("llm-pi-ai"));
|
|
2043
|
+
const protocols = protocolChoices(state.namespaces.get("llm-pi-ai"), schema);
|
|
1987
2044
|
return (0, react_jsx_runtime.jsxs)("div", {
|
|
1988
2045
|
className: ModelsSection_module_css_default["section"],
|
|
1989
2046
|
children: [
|
|
@@ -2017,6 +2074,7 @@ window.__ModuleLoader__.load({
|
|
|
2017
2074
|
children: renderProviderEditor({
|
|
2018
2075
|
target,
|
|
2019
2076
|
namespace,
|
|
2077
|
+
schema,
|
|
2020
2078
|
thinkingPresets: isClaudeProvider(row, state),
|
|
2021
2079
|
api,
|
|
2022
2080
|
t,
|
|
@@ -2090,6 +2148,7 @@ window.__ModuleLoader__.load({
|
|
|
2090
2148
|
}), open ? renderProviderEditor({
|
|
2091
2149
|
target,
|
|
2092
2150
|
namespace,
|
|
2151
|
+
schema,
|
|
2093
2152
|
thinkingPresets: isClaudeProvider(row, state),
|
|
2094
2153
|
api,
|
|
2095
2154
|
t,
|
|
@@ -2130,6 +2189,7 @@ window.__ModuleLoader__.load({
|
|
|
2130
2189
|
displayName: addTarget.displayName,
|
|
2131
2190
|
hideTitle: true,
|
|
2132
2191
|
namespace: addNamespace,
|
|
2192
|
+
schema,
|
|
2133
2193
|
settingsPath: addTarget.settingsPath,
|
|
2134
2194
|
api,
|
|
2135
2195
|
t,
|
|
@@ -2235,10 +2295,10 @@ window.__ModuleLoader__.load({
|
|
|
2235
2295
|
document.head.appendChild(tag);
|
|
2236
2296
|
}
|
|
2237
2297
|
var OnboardingModal_module_css_default = {
|
|
2298
|
+
"body": "jLrgrW_body",
|
|
2238
2299
|
"content": "jLrgrW_content",
|
|
2239
2300
|
"dialog": "jLrgrW_dialog",
|
|
2240
|
-
"title": "jLrgrW_title"
|
|
2241
|
-
"body": "jLrgrW_body"
|
|
2301
|
+
"title": "jLrgrW_title"
|
|
2242
2302
|
};
|
|
2243
2303
|
//#endregion
|
|
2244
2304
|
//#region lib/types/client/OnboardingModal.js
|
|
@@ -2310,7 +2370,7 @@ window.__ModuleLoader__.load({
|
|
|
2310
2370
|
* the onboarding plugin's shared modal, so the key is entered once.
|
|
2311
2371
|
*/
|
|
2312
2372
|
/* v8 ignore next 3 -- closed-union defaults only defend future source widening */
|
|
2313
|
-
function assertNever(_value) {
|
|
2373
|
+
function assertNever$1(_value) {
|
|
2314
2374
|
throw new Error("unexpected DeepSeek onboarding state");
|
|
2315
2375
|
}
|
|
2316
2376
|
/**
|
|
@@ -2320,7 +2380,7 @@ window.__ModuleLoader__.load({
|
|
|
2320
2380
|
* @returns the onboarding modal or null when onboarding needs no intervention.
|
|
2321
2381
|
*/
|
|
2322
2382
|
function DeepSeekOnboardingDialog(props) {
|
|
2323
|
-
const { complete, controller, useModels, api, t } = props;
|
|
2383
|
+
const { complete, controller, useModels, api, schema, t } = props;
|
|
2324
2384
|
const state = useModels((snapshot) => snapshot);
|
|
2325
2385
|
const readiness = onboardingReadiness(state);
|
|
2326
2386
|
(0, react.useEffect)(() => {
|
|
@@ -2336,7 +2396,7 @@ window.__ModuleLoader__.load({
|
|
|
2336
2396
|
case "unavailable": return null;
|
|
2337
2397
|
case "credential-missing": break;
|
|
2338
2398
|
/* v8 ignore next -- every current readiness variant is handled above */
|
|
2339
|
-
default: return assertNever(readiness);
|
|
2399
|
+
default: return assertNever$1(readiness);
|
|
2340
2400
|
}
|
|
2341
2401
|
const row = state.rows.find((candidate) => candidate.entry.provider === "deepseek-official" && candidate.entry.settingsNs === "llm-deepseek" && candidate.entry.settingsPath.length === 0);
|
|
2342
2402
|
const namespace = state.namespaces.get("llm-deepseek");
|
|
@@ -2360,6 +2420,7 @@ window.__ModuleLoader__.load({
|
|
|
2360
2420
|
provider: row.entry.provider,
|
|
2361
2421
|
displayName: row.entry.displayName,
|
|
2362
2422
|
namespace,
|
|
2423
|
+
schema,
|
|
2363
2424
|
settingsPath: row.entry.settingsPath,
|
|
2364
2425
|
api,
|
|
2365
2426
|
t,
|
|
@@ -2388,10 +2449,10 @@ window.__ModuleLoader__.load({
|
|
|
2388
2449
|
document.head.appendChild(tag);
|
|
2389
2450
|
}
|
|
2390
2451
|
var WelcomeNotice_module_css_default = {
|
|
2391
|
-
"copy": "t1T8VW_copy",
|
|
2392
2452
|
"actions": "t1T8VW_actions",
|
|
2393
|
-
"
|
|
2394
|
-
"error": "t1T8VW_error"
|
|
2453
|
+
"copy": "t1T8VW_copy",
|
|
2454
|
+
"error": "t1T8VW_error",
|
|
2455
|
+
"primary": "t1T8VW_primary"
|
|
2395
2456
|
};
|
|
2396
2457
|
//#endregion
|
|
2397
2458
|
//#region lib/types/client/WelcomeNotice.js
|
|
@@ -2475,120 +2536,147 @@ window.__ModuleLoader__.load({
|
|
|
2475
2536
|
};
|
|
2476
2537
|
//#endregion
|
|
2477
2538
|
//#region lib/types/client/welcome-store.js
|
|
2478
|
-
/**
|
|
2479
|
-
|
|
2480
|
-
|
|
2539
|
+
/**
|
|
2540
|
+
* Welcome-notice state derived from the welcome settings scope. The scope is
|
|
2541
|
+
* the transport: a loopback browser follows the durable Host section, while a
|
|
2542
|
+
* remote browser's memory-mode scope never answers and the acknowledgement
|
|
2543
|
+
* stays process-local here.
|
|
2544
|
+
*/
|
|
2545
|
+
/**
|
|
2546
|
+
* Accept any object section verbatim; a malformed durable value reads as an
|
|
2547
|
+
* empty section, so the notice treats it as unacknowledged instead of leaving
|
|
2548
|
+
* the scope stuck on its previous value.
|
|
2549
|
+
* @param section - the wire section value.
|
|
2550
|
+
* @returns the section object, or an empty one for non-object values.
|
|
2551
|
+
*/
|
|
2552
|
+
function decodeWelcomeSection(section) {
|
|
2553
|
+
return typeof section === "object" && section !== null && !Array.isArray(section) ? section : {};
|
|
2481
2554
|
}
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
return typeof value === "string" ? value : void 0;
|
|
2555
|
+
/* v8 ignore next 3 -- closed-union default only defends future source widening */
|
|
2556
|
+
function assertNever(_value) {
|
|
2557
|
+
throw new Error("unexpected welcome settings status");
|
|
2486
2558
|
}
|
|
2487
2559
|
/** Coordinates durable Host acknowledgement or a process-local remote fallback. */
|
|
2488
2560
|
var WelcomeNoticeStore = class {
|
|
2489
|
-
|
|
2490
|
-
persistence;
|
|
2561
|
+
scope;
|
|
2491
2562
|
/** uSES-safe state source shared by the registered welcome step. */
|
|
2492
2563
|
store = (0, _deepseek_ai_dsh_client_runtime_client.createSnapshotStore)({
|
|
2493
2564
|
status: "idle",
|
|
2494
2565
|
acknowledged: false,
|
|
2495
2566
|
error: null
|
|
2496
2567
|
});
|
|
2497
|
-
|
|
2568
|
+
localAcknowledged = false;
|
|
2569
|
+
saving = false;
|
|
2570
|
+
following;
|
|
2498
2571
|
/**
|
|
2499
|
-
* @param
|
|
2500
|
-
*
|
|
2572
|
+
* @param scope - the welcome settings namespace scope; its memory mode is
|
|
2573
|
+
* what keeps a remote browser process-local.
|
|
2501
2574
|
*/
|
|
2502
|
-
constructor(
|
|
2503
|
-
this.
|
|
2504
|
-
this.persistence = persistence;
|
|
2575
|
+
constructor(scope) {
|
|
2576
|
+
this.scope = scope;
|
|
2505
2577
|
}
|
|
2506
|
-
/**
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
});
|
|
2514
|
-
return;
|
|
2515
|
-
}
|
|
2516
|
-
this.store.update((state) => {
|
|
2517
|
-
state.status = "loading";
|
|
2518
|
-
state.error = null;
|
|
2578
|
+
/**
|
|
2579
|
+
* Begin following the bound scope (idempotent) and publish its current answer.
|
|
2580
|
+
* @returns settlement after the current answer is published.
|
|
2581
|
+
*/
|
|
2582
|
+
load() {
|
|
2583
|
+
this.following ??= this.scope.subscribe(() => {
|
|
2584
|
+
this.derive();
|
|
2519
2585
|
});
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
if (!response.result.ok) throw new Error(response.result.error.message);
|
|
2523
|
-
const view = response.result.value.namespaces.find((candidate) => candidate.ns === WELCOME_NOTICE_SETTINGS_NAMESPACE);
|
|
2524
|
-
if (view === void 0) throw new Error("welcome acknowledgement settings are unavailable");
|
|
2525
|
-
if (generation !== this.generation) return;
|
|
2526
|
-
this.store.update((state) => {
|
|
2527
|
-
state.status = "ready";
|
|
2528
|
-
state.acknowledged = acknowledgementOf(view) === WELCOME_NOTICE_VERSION;
|
|
2529
|
-
state.error = null;
|
|
2530
|
-
});
|
|
2531
|
-
} catch (error) {
|
|
2532
|
-
if (generation !== this.generation) return;
|
|
2533
|
-
this.store.update((state) => {
|
|
2534
|
-
state.status = "error";
|
|
2535
|
-
state.acknowledged = false;
|
|
2536
|
-
state.error = messageOf(error);
|
|
2537
|
-
});
|
|
2538
|
-
}
|
|
2586
|
+
this.derive();
|
|
2587
|
+
return Promise.resolve();
|
|
2539
2588
|
}
|
|
2540
2589
|
/**
|
|
2541
|
-
* Persist this copy version, or advance only this process for a remote
|
|
2542
|
-
*
|
|
2590
|
+
* Persist this copy version, or advance only this process for a remote
|
|
2591
|
+
* browser. Success is judged against the state the write left behind, so a
|
|
2592
|
+
* refused or failed write reports false after its recovery read settles.
|
|
2593
|
+
* @returns true when the selected persistence mode holds the acknowledgement.
|
|
2543
2594
|
*/
|
|
2544
2595
|
async acknowledge() {
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
this.
|
|
2548
|
-
state.status = "ready";
|
|
2549
|
-
state.acknowledged = true;
|
|
2550
|
-
state.error = null;
|
|
2551
|
-
});
|
|
2596
|
+
if (this.scope.getSnapshot().mode === "memory") {
|
|
2597
|
+
this.localAcknowledged = true;
|
|
2598
|
+
this.derive();
|
|
2552
2599
|
return true;
|
|
2553
2600
|
}
|
|
2601
|
+
this.saving = true;
|
|
2554
2602
|
this.store.update((state) => {
|
|
2555
2603
|
state.status = "saving";
|
|
2556
2604
|
state.error = null;
|
|
2557
2605
|
});
|
|
2558
2606
|
try {
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2607
|
+
await this.scope.set(WELCOME_NOTICE_ACK_FIELD, WELCOME_NOTICE_VERSION);
|
|
2608
|
+
} finally {
|
|
2609
|
+
this.saving = false;
|
|
2610
|
+
}
|
|
2611
|
+
this.derive();
|
|
2612
|
+
const { acknowledged } = this.store.getSnapshot();
|
|
2613
|
+
if (!acknowledged) this.store.update((state) => {
|
|
2614
|
+
state.status = "error";
|
|
2615
|
+
state.error = "the acknowledgement did not persist";
|
|
2616
|
+
});
|
|
2617
|
+
return acknowledged;
|
|
2618
|
+
}
|
|
2619
|
+
/** Stop following the scope. */
|
|
2620
|
+
dispose() {
|
|
2621
|
+
this.following?.();
|
|
2622
|
+
this.following = void 0;
|
|
2623
|
+
}
|
|
2624
|
+
derive() {
|
|
2625
|
+
if (this.saving) return;
|
|
2626
|
+
const scope = this.scope.getSnapshot();
|
|
2627
|
+
if (scope.mode === "memory") {
|
|
2628
|
+
this.store.update((state) => {
|
|
2569
2629
|
state.status = "ready";
|
|
2570
|
-
state.acknowledged =
|
|
2630
|
+
state.acknowledged = this.localAcknowledged;
|
|
2571
2631
|
state.error = null;
|
|
2572
2632
|
});
|
|
2573
|
-
return
|
|
2574
|
-
}
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
state
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
|
|
2633
|
+
return;
|
|
2634
|
+
}
|
|
2635
|
+
switch (scope.status) {
|
|
2636
|
+
case "loading":
|
|
2637
|
+
this.store.update((state) => {
|
|
2638
|
+
state.status = "loading";
|
|
2639
|
+
state.error = null;
|
|
2640
|
+
});
|
|
2641
|
+
return;
|
|
2642
|
+
case "unavailable":
|
|
2643
|
+
this.store.update((state) => {
|
|
2644
|
+
state.status = "error";
|
|
2645
|
+
state.acknowledged = false;
|
|
2646
|
+
state.error = "welcome acknowledgement settings are unavailable";
|
|
2647
|
+
});
|
|
2648
|
+
return;
|
|
2649
|
+
case "ready": {
|
|
2650
|
+
const acknowledged = scope.value?.[WELCOME_NOTICE_ACK_FIELD] === WELCOME_NOTICE_VERSION;
|
|
2651
|
+
this.store.update((state) => {
|
|
2652
|
+
state.status = "ready";
|
|
2653
|
+
state.acknowledged = acknowledged;
|
|
2654
|
+
state.error = null;
|
|
2655
|
+
});
|
|
2656
|
+
return;
|
|
2657
|
+
}
|
|
2658
|
+
/* v8 ignore next -- every current settings scope status is handled above */
|
|
2659
|
+
default: return assertNever(scope.status);
|
|
2581
2660
|
}
|
|
2582
2661
|
}
|
|
2583
2662
|
};
|
|
2663
|
+
//#endregion
|
|
2664
|
+
//#region lib/types/client/schema-operations.js
|
|
2584
2665
|
/**
|
|
2585
|
-
*
|
|
2586
|
-
*
|
|
2587
|
-
* @
|
|
2666
|
+
* Hide the Cordis service identity behind bound schema callbacks.
|
|
2667
|
+
* @param service - settings-owned schema service available in the apply context.
|
|
2668
|
+
* @returns callbacks that cannot expose the service context to React components.
|
|
2588
2669
|
*/
|
|
2589
|
-
function
|
|
2590
|
-
|
|
2591
|
-
|
|
2670
|
+
function createSettingsSchemaOperations(service) {
|
|
2671
|
+
return {
|
|
2672
|
+
rehydrate: (serialized) => service.rehydrate(serialized),
|
|
2673
|
+
validate: (schema, draft) => service.validate(schema, draft),
|
|
2674
|
+
nodeAtPath: (root, path) => service.nodeAtPath(root, path),
|
|
2675
|
+
getPath: (value, path) => service.getPath(value, path),
|
|
2676
|
+
hasPath: (value, path) => service.hasPath(value, path),
|
|
2677
|
+
setPath: (root, path, value) => service.setPath(root, path, value),
|
|
2678
|
+
deletePath: (root, path) => service.deletePath(root, path)
|
|
2679
|
+
};
|
|
2592
2680
|
}
|
|
2593
2681
|
//#endregion
|
|
2594
2682
|
//#region lib/types/client/locales.js
|
|
@@ -2663,6 +2751,8 @@ window.__ModuleLoader__.load({
|
|
|
2663
2751
|
fetchEmpty: "The provider listed no models. Add them by hand.",
|
|
2664
2752
|
fetchTitle: "Choose models to add",
|
|
2665
2753
|
fetchDescription: "These are the models this provider has available. Choose the ones to add.",
|
|
2754
|
+
fetchSelectAll: "Select all",
|
|
2755
|
+
fetchDeselectAll: "Deselect all",
|
|
2666
2756
|
fetchAdopt: "Add selected",
|
|
2667
2757
|
customAdd: "Add a custom provider",
|
|
2668
2758
|
customTitle: "Custom provider",
|
|
@@ -2671,8 +2761,8 @@ window.__ModuleLoader__.load({
|
|
|
2671
2761
|
claudeCustomTitle: "Claude provider",
|
|
2672
2762
|
claudeTypeUnavailable: "Claude provider type storage is unavailable.",
|
|
2673
2763
|
claudeTypeTag: "Claude provider",
|
|
2674
|
-
claudeTypeIntro: "
|
|
2675
|
-
adaptiveClaudeEnabled: "Choose a thinking mode for each model
|
|
2764
|
+
claudeTypeIntro: "This provider type saves native RC8 adaptive-thinking compatibility, model reasoning mappings, Claude model discovery, and recorded capacities.",
|
|
2765
|
+
adaptiveClaudeEnabled: "Choose a thinking mode for each model; new models default to five levels.",
|
|
2676
2766
|
adaptiveClaudeHelpLabel: "Thinking mode help",
|
|
2677
2767
|
adaptiveClaudeHelp: "Five (low / medium / high / xhigh / max): Fable 5, Opus 5, Opus 4.8, Opus 4.7, Sonnet 5\nFour (low / medium / high / max): Opus 4.6, Sonnet 4.6\nOn / Off: Haiku 4.5",
|
|
2678
2768
|
adaptiveClaudeTag: "Claude configured",
|
|
@@ -2772,6 +2862,8 @@ window.__ModuleLoader__.load({
|
|
|
2772
2862
|
fetchEmpty: "该提供方没有列出任何模型,请手动添加。",
|
|
2773
2863
|
fetchTitle: "选择要添加的模型",
|
|
2774
2864
|
fetchDescription: "以下是模型提供方的可用模型,勾选要添加的模型。",
|
|
2865
|
+
fetchSelectAll: "全选",
|
|
2866
|
+
fetchDeselectAll: "取消全选",
|
|
2775
2867
|
fetchAdopt: "添加所选",
|
|
2776
2868
|
customAdd: "添加自定义提供方",
|
|
2777
2869
|
customTitle: "自定义提供方",
|
|
@@ -2780,8 +2872,8 @@ window.__ModuleLoader__.load({
|
|
|
2780
2872
|
claudeCustomTitle: "Claude 提供方",
|
|
2781
2873
|
claudeTypeUnavailable: "Claude 提供方类型存储不可用。",
|
|
2782
2874
|
claudeTypeTag: "Claude 提供方",
|
|
2783
|
-
claudeTypeIntro: "
|
|
2784
|
-
adaptiveClaudeEnabled: "
|
|
2875
|
+
claudeTypeIntro: "此提供方类型会写入 RC8 原生自适应思考兼容配置、模型思考映射、Claude 模型发现和已记录容量。",
|
|
2876
|
+
adaptiveClaudeEnabled: "每个模型可单独选择思考模式,新增模型默认使用五档。",
|
|
2785
2877
|
adaptiveClaudeHelpLabel: "思考模式说明",
|
|
2786
2878
|
adaptiveClaudeHelp: "五档(低 / 中 / 高 / 超高 / 最大):Fable 5、Opus 5、Opus 4.8、Opus 4.7、Sonnet 5\n四档(低 / 中 / 高 / 最大):Opus 4.6、Sonnet 4.6\n开启 / 关闭:Haiku 4.5",
|
|
2787
2879
|
adaptiveClaudeTag: "Claude 已适配",
|
|
@@ -2833,7 +2925,9 @@ window.__ModuleLoader__.load({
|
|
|
2833
2925
|
"slots",
|
|
2834
2926
|
"locale",
|
|
2835
2927
|
"connection",
|
|
2836
|
-
"remote"
|
|
2928
|
+
"remote",
|
|
2929
|
+
"settingsScope",
|
|
2930
|
+
"settingsSchema"
|
|
2837
2931
|
];
|
|
2838
2932
|
/**
|
|
2839
2933
|
* Register the Models section once the `settings.section` declaration is on
|
|
@@ -2847,22 +2941,27 @@ window.__ModuleLoader__.load({
|
|
|
2847
2941
|
en
|
|
2848
2942
|
}), "ui-settings-models: copy dictionaries");
|
|
2849
2943
|
const connection = ctx.get("connection");
|
|
2850
|
-
const
|
|
2851
|
-
const
|
|
2944
|
+
const schema = createSettingsSchemaOperations(ctx.settingsSchema);
|
|
2945
|
+
const controller = new ModelsSettingsStore(connection.api, schema, ctx.settingsScope.describe());
|
|
2852
2946
|
const t = ctx.locale.bind(NS);
|
|
2853
2947
|
const injected = () => ({
|
|
2854
2948
|
controller,
|
|
2855
|
-
|
|
2949
|
+
hooks: { snapshot: controller.store },
|
|
2856
2950
|
api: connection.api,
|
|
2951
|
+
schema,
|
|
2857
2952
|
t
|
|
2858
2953
|
});
|
|
2859
2954
|
const deepSeekOnboardingInjected = () => ({
|
|
2860
2955
|
controller,
|
|
2861
2956
|
hooks: { models: controller.store },
|
|
2862
2957
|
api: connection.api,
|
|
2958
|
+
schema,
|
|
2863
2959
|
t
|
|
2864
2960
|
});
|
|
2865
|
-
const welcomeController = new WelcomeNoticeStore(
|
|
2961
|
+
const welcomeController = new WelcomeNoticeStore(ctx.settingsScope.bind({
|
|
2962
|
+
namespace: WELCOME_NOTICE_SETTINGS_NAMESPACE,
|
|
2963
|
+
decode: decodeWelcomeSection
|
|
2964
|
+
}));
|
|
2866
2965
|
const welcomeInjected = () => ({
|
|
2867
2966
|
controller: welcomeController,
|
|
2868
2967
|
hooks: { welcome: welcomeController.store },
|
|
@@ -2872,20 +2971,16 @@ window.__ModuleLoader__.load({
|
|
|
2872
2971
|
const refreshModels = () => {
|
|
2873
2972
|
refreshIfLoaded(controller);
|
|
2874
2973
|
};
|
|
2875
|
-
const refreshAll = () => {
|
|
2876
|
-
refreshModels();
|
|
2877
|
-
refreshWelcomeIfLoaded(welcomeController);
|
|
2878
|
-
};
|
|
2879
2974
|
const disposers = [
|
|
2880
|
-
ctx.remote.$on("settings/document-updated", (
|
|
2975
|
+
ctx.remote.$on("settings/document-updated", () => {
|
|
2881
2976
|
refreshModels();
|
|
2882
|
-
if (ns === "ui-onboarding") refreshWelcomeIfLoaded(welcomeController);
|
|
2883
2977
|
}),
|
|
2884
2978
|
ctx.remote.$on("credentials/updated", refreshModels),
|
|
2885
2979
|
ctx.remote.$on("llm/adapters-updated", refreshModels),
|
|
2886
|
-
ctx.on("connection/reset",
|
|
2980
|
+
ctx.on("connection/reset", refreshModels)
|
|
2887
2981
|
];
|
|
2888
2982
|
return () => {
|
|
2983
|
+
welcomeController.dispose();
|
|
2889
2984
|
for (const dispose of disposers) dispose();
|
|
2890
2985
|
};
|
|
2891
2986
|
}, "ui-settings-models: pushed invalidations");
|