dsh-opencode-go 0.1.21 → 0.1.23
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/LICENSE +1 -0
- package/README.en.md +74 -194
- package/README.md +73 -184
- package/THIRD_PARTY_NOTICES.md +7 -1
- package/docs/advanced.en.md +137 -0
- package/docs/advanced.md +135 -0
- package/docs/assets/accounts.png +0 -0
- package/docs/assets/advanced-settings.png +0 -0
- package/docs/assets/model-settings.png +0 -0
- package/docs/assets/usage-panel.png +0 -0
- package/docs/development.md +65 -7
- package/docs/fork-review-2026-09-25.md +191 -0
- package/docs/independent-package.md +2 -2
- package/docs/verification.md +283 -0
- package/lib/build-info.json +8 -1
- package/lib/client.js +830 -635
- package/lib/index.js +52687 -856
- package/lib/types/account-manager.d.ts +25 -0
- package/lib/types/account-operations.d.ts +31 -0
- package/lib/types/account-policy.d.ts +16 -0
- package/lib/types/account-recovery.d.ts +2 -0
- package/lib/types/account-selection.d.ts +30 -0
- package/lib/types/account-service.d.ts +12 -0
- package/lib/types/accounts-contract.d.ts +38 -0
- package/lib/types/accounts.d.ts +8 -1
- package/lib/types/adapter.d.ts +33 -11
- package/lib/types/call-trace.d.ts +54 -0
- package/lib/types/catalog-manager.d.ts +20 -0
- package/lib/types/catalog.d.ts +6 -4
- package/lib/types/client/accounts-controller.d.ts +8 -17
- package/lib/types/client/hint-mark.d.ts +17 -0
- package/lib/types/client/host-compat.d.ts +7 -0
- package/lib/types/client/host-primitives.d.ts +11 -0
- package/lib/types/client/locales.d.ts +14 -3
- package/lib/types/client/section-controller.d.ts +11 -48
- package/lib/types/client/staged-form.d.ts +1 -3
- package/lib/types/client/usage.d.ts +1 -1
- package/lib/types/config-contract.d.ts +70 -0
- package/lib/types/config.d.ts +13 -54
- package/lib/types/conversion/context.d.ts +5 -1
- package/lib/types/conversion/image-pool.d.ts +24 -0
- package/lib/types/conversion/replay.d.ts +1 -1
- package/lib/types/conversion/stream.d.ts +1 -1
- package/lib/types/gateway-diagnostics.d.ts +22 -0
- package/lib/types/gateway-error.d.ts +2 -0
- package/lib/types/gateway-url.d.ts +7 -0
- package/lib/types/google-fetch.d.ts +6 -0
- package/lib/types/google-generative-ai.d.ts +3 -0
- package/lib/types/host-settings.d.ts +11 -0
- package/lib/types/index.d.ts +2 -2
- package/lib/types/model-metadata.d.ts +5 -3
- package/lib/types/models-contract.d.ts +7 -0
- package/lib/types/protocol-contract.d.ts +5 -0
- package/lib/types/protocol-policy.d.ts +4 -0
- package/lib/types/reasoning.d.ts +36 -6
- package/lib/types/request-control.d.ts +2 -0
- package/lib/types/sdk-types.d.ts +3156 -0
- package/lib/types/settings-bridge.d.ts +22 -0
- package/lib/vendor-licenses.txt +1861 -0
- package/package.json +7 -2
package/lib/client.js
CHANGED
|
@@ -40,7 +40,43 @@ module.exports = __toCommonJS(index_exports);
|
|
|
40
40
|
// src/client/Section.tsx
|
|
41
41
|
var import_react3 = require("react");
|
|
42
42
|
var import_dsh_client_ui_primitives3 = require("@deepseek-ai/dsh-client-ui-primitives");
|
|
43
|
-
var
|
|
43
|
+
var primitives3 = __toESM(require("@deepseek-ai/dsh-client-ui-primitives"), 1);
|
|
44
|
+
|
|
45
|
+
// src/client/host-primitives.ts
|
|
46
|
+
function hostAtom(host, current, previous) {
|
|
47
|
+
return host[current] ?? host[previous];
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// src/client/hint-mark.tsx
|
|
51
|
+
var primitives = __toESM(require("@deepseek-ai/dsh-client-ui-primitives"), 1);
|
|
52
|
+
|
|
53
|
+
// plugin-css:src/client/Section.module.css
|
|
54
|
+
var id = "dsh-opencode-go/Section.module.css";
|
|
55
|
+
if (!document.querySelector("style[data-plugin-css=" + JSON.stringify(id) + "]")) {
|
|
56
|
+
const style = document.createElement("style");
|
|
57
|
+
style.dataset.plugin = "dsh-opencode-go";
|
|
58
|
+
style.dataset.pluginCss = id;
|
|
59
|
+
style.textContent = '.N807zW_accounts{gap:10px;margin:6px 0;padding:6px 0;display:grid}.N807zW_accountRow{border:.5px solid var(--dsw-alias-border-l2);border-radius:10px;position:relative}.N807zW_accountRow[data-dragging=true]{opacity:.55}.N807zW_accountMain{grid-template-columns:16px 112px 92px minmax(0,1fr) 38px 106px 14px;align-items:center;gap:9px;padding:9px 11px;display:grid}.N807zW_accountHandle{width:16px;height:16px;color:var(--dsw-alias-label-tertiary);cursor:grab;-webkit-user-drag:element;background:0 0;border:0;place-items:center;padding:0;display:grid}.N807zW_accountHandle:disabled{cursor:default;opacity:.5}.N807zW_accountHandle:focus-visible,.N807zW_accountToggle:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:2px;border-radius:4px}.N807zW_accountName{white-space:nowrap;text-overflow:ellipsis;min-width:0;color:var(--dsw-alias-label-primary);font-size:12.5px;font-weight:600;overflow:hidden}.N807zW_accountState{min-width:0;color:var(--dsw-alias-label-tertiary);align-items:center;gap:5px;font-size:11.5px;display:inline-flex;overflow:hidden}.N807zW_accountDot{background:#39a878;border-radius:50%;flex:none;width:6px;height:6px}.N807zW_accountDot[data-off=true]{background:#d9a441}.N807zW_accountPercent{text-align:right;font-variant-numeric:tabular-nums;color:var(--dsw-alias-label-primary);font-size:12.5px;font-weight:650}.N807zW_accountBar{background:#ffffff1a;border-radius:99px;height:12px;position:relative;overflow:hidden}.N807zW_accountBarFill{background:#39a878;border-radius:99px;position:absolute;inset:0 auto 0 0}.N807zW_accountBar[data-level=high] .N807zW_accountBarFill{background:#e0a100}.N807zW_accountBar[data-level=limited] .N807zW_accountBarFill{background:#e5484d}.N807zW_accountBarTick{background:#fff3;width:1px;position:absolute;top:0;bottom:0}.N807zW_accountReset{text-align:right;color:var(--dsw-alias-label-tertiary);font-size:11.5px}.N807zW_accountIdle{text-align:right;color:var(--dsw-alias-label-tertiary);grid-column:4/7;font-size:11.5px;line-height:1.5}.N807zW_accountToggle{color:var(--dsw-alias-label-tertiary);cursor:pointer;background:0 0;border:0;place-items:center;padding:0;display:grid}.N807zW_accountProblems{align-items:baseline;gap:8px;padding:0 11px 9px 36px;display:flex}.N807zW_accountRetry{font:inherit;color:var(--dsw-alias-brand-primary);cursor:pointer;background:0 0;border:none;flex:none;padding:0;font-size:11.5px;line-height:1.5}.N807zW_accountRetry:disabled{color:var(--dsw-alias-label-tertiary);cursor:default}.N807zW_accountHandle:active{cursor:grabbing}.N807zW_accountDetail{border-top:.5px solid var(--dsw-alias-border-l2);flex-direction:column;gap:8px;padding:9px 11px 10px 36px;display:flex}.N807zW_accountRow:after{content:"";background:var(--dsw-alias-brand-primary);opacity:0;pointer-events:none;border-radius:2px;height:2px;position:absolute;left:0;right:0}.N807zW_accountRow[data-drop=before]:after{opacity:1;top:-6px}.N807zW_accountRow[data-drop=after]:after{opacity:1;bottom:-6px}.N807zW_accountUsage{grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;font-size:12px;display:grid}.N807zW_accountUsage progress{accent-color:#39a878;width:100%;height:8px;margin:6px 0;display:block}.N807zW_accountUsage progress[data-level=high]{accent-color:#e0a100}.N807zW_accountUsage progress[data-level=limited]{accent-color:#e5484d}.N807zW_accountUsage .N807zW_hint{overflow-wrap:anywhere;display:block}.N807zW_accountActions{flex-wrap:wrap;gap:8px;margin-top:10px;display:flex}.N807zW_accountEditor{border:.5px solid var(--dsw-alias-border-l2);background:color-mix(in srgb, var(--dsw-alias-bg-layer-3) 25%, transparent);border-radius:10px;flex-direction:column;gap:8px;margin:0 11px 10px 36px;padding:10px 12px;display:flex}.N807zW_accountEditorHead{align-items:baseline;gap:6px;min-width:0;display:flex}.N807zW_accountEditorTitle{color:var(--dsw-alias-label-primary);flex:none;font-size:12.5px;font-weight:600;line-height:1.5}.N807zW_accountEditorFor{min-width:0;color:var(--dsw-alias-label-tertiary);overflow-wrap:anywhere;font-size:11.5px;line-height:1.5}.N807zW_accountField{color:var(--dsw-alias-label-tertiary);flex-direction:column;gap:5px;font-size:11.5px;line-height:1.5;display:flex}.N807zW_accountEditorActions{align-items:center;gap:8px;margin-top:2px;display:flex}@media (width<=480px){.N807zW_accountUsage{grid-template-columns:1fr}}.N807zW_page{flex-direction:column;min-width:0;height:100%;min-height:0;display:flex;container-type:size}.N807zW_pageBody{scrollbar-gutter:stable;flex-direction:column;flex:1;min-height:0;padding:0 4px 16px 0;display:flex;overflow-y:auto}.N807zW_pageBody,.N807zW_modelList,.N807zW_modelDetails{scrollbar-width:thin;scrollbar-color:var(--dsw-alias-border-l3) transparent}.N807zW_pageBody::-webkit-scrollbar,.N807zW_modelList::-webkit-scrollbar,.N807zW_modelDetails::-webkit-scrollbar{width:8px;height:8px}.N807zW_pageBody::-webkit-scrollbar-track,.N807zW_modelList::-webkit-scrollbar-track,.N807zW_modelDetails::-webkit-scrollbar-track{background:0 0}.N807zW_pageBody::-webkit-scrollbar-thumb,.N807zW_modelList::-webkit-scrollbar-thumb,.N807zW_modelDetails::-webkit-scrollbar-thumb{background:var(--dsw-alias-border-l3);background-clip:content-box;border:2px solid #0000;border-radius:999px}.N807zW_pageBody:hover::-webkit-scrollbar-thumb,.N807zW_modelList:hover::-webkit-scrollbar-thumb,.N807zW_modelDetails:hover::-webkit-scrollbar-thumb{background:var(--dsw-alias-label-tertiary);background-clip:content-box}.N807zW_field{flex-direction:column;gap:6px;padding:12px 0;display:flex}.N807zW_field+.N807zW_field{border-top:.5px solid var(--dsw-alias-border-l2)}.N807zW_head{align-items:center;gap:8px;display:flex}.N807zW_label{min-width:0;color:var(--dsw-alias-label-primary);flex:1;font-size:13px;font-weight:500;line-height:1.5}.N807zW_trailing{flex:none;align-items:center;gap:8px;display:inline-flex}.N807zW_reset{font:inherit;color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border:none;padding:0;font-size:12px;line-height:1.5}.N807zW_reset:hover:not(:disabled){color:var(--dsw-alias-label-primary)}.N807zW_reset:disabled{color:var(--dsw-alias-label-tertiary);cursor:default}.N807zW_reset:focus-visible,.N807zW_cardTrigger:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:3px}.N807zW_input{border:.5px solid var(--dsw-alias-border-l4);background:var(--dsw-alias-bg-layer-3);height:34px;font:inherit;color:var(--dsw-alias-label-primary);border-radius:8px;padding:0 12px;font-size:13px;line-height:1.5}.N807zW_input:focus-visible{border-color:var(--dsw-alias-brand-primary);outline:none}.N807zW_inputInvalid:focus-visible{border-color:var(--dsw-alias-label-error);box-shadow:0 0 0 3px color-mix(in srgb, var(--dsw-alias-label-error) 28%, transparent)}.N807zW_input:disabled{color:var(--dsw-alias-label-tertiary);cursor:default}.N807zW_inputInvalid{border-color:var(--dsw-alias-label-error);}.N807zW_invalid{color:var(--dsw-alias-label-error);margin:0;font-size:12px;line-height:1.5}.N807zW_hint{color:var(--dsw-alias-label-tertiary);margin:0;font-size:12px;line-height:1.5}.N807zW_rows{flex-direction:column;display:flex}.N807zW_row{grid-template-columns:minmax(0,1fr) 300px;align-items:center;gap:6px 14px;padding:10px 0;display:grid}.N807zW_rowLabel{align-items:center;gap:7px;min-width:0;display:flex}.N807zW_rowTitle{overflow-wrap:anywhere;-webkit-line-clamp:2;min-width:0;color:var(--dsw-alias-label-primary);-webkit-box-orient:vertical;font-size:13px;line-height:1.5;display:-webkit-box;overflow:hidden}.N807zW_rowControl{align-items:center;min-width:0;display:flex}.N807zW_rowControl>.N807zW_input{box-sizing:border-box;width:100%}.N807zW_advancedHead{flex-wrap:wrap;justify-content:space-between;align-items:baseline;gap:6px 12px;display:flex}.N807zW_advancedHead .N807zW_hint{flex:auto;min-width:0}.N807zW_advancedHead .N807zW_reset{flex:none}.N807zW_rowHint,.N807zW_rowInvalid{grid-column:1/-1;margin:0;font-size:12px;line-height:1.5}.N807zW_rowHint{color:var(--dsw-alias-label-tertiary)}.N807zW_rowInvalid{color:var(--dsw-alias-label-error)}.N807zW_groupHead{letter-spacing:.04em;color:var(--dsw-alias-label-tertiary);align-items:center;gap:8px;margin:14px 0 0;font-size:11.5px;line-height:1.5;display:flex}.N807zW_groupHead:first-child{margin-top:4px}.N807zW_groupHead:after{content:"";background:var(--dsw-alias-border-l2);flex:1;height:.5px}.N807zW_info{width:16px;height:16px;font:inherit;color:var(--dsw-alias-label-tertiary);cursor:help;background:0 0;border:0;flex:none;justify-content:center;align-items:center;padding:0;font-size:12px;line-height:1;display:inline-flex}.N807zW_info:hover,.N807zW_info:focus-visible{color:var(--dsw-alias-label-primary)}.N807zW_info:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:2px;border-radius:3px}.N807zW_info svg{width:13px;height:13px}.N807zW_label .N807zW_info,.N807zW_cardTitle .N807zW_info{vertical-align:middle;margin-left:6px}.N807zW_seg{box-sizing:border-box;border:.5px solid var(--dsw-alias-border-l4);background:var(--dsw-alias-bg-layer-3);border-radius:8px;flex:1;min-width:0;padding:2px;display:flex;position:relative}.N807zW_segThumb{background:color-mix(in srgb, var(--dsw-alias-label-primary) 16%, transparent);border-radius:6px;width:calc(50% - 2px);transition:transform .16s cubic-bezier(.2,0,0,1);position:absolute;top:2px;bottom:2px;left:2px}.N807zW_seg[data-count="3"] .N807zW_segThumb{width:calc(33.3333% - 1.33333px)}.N807zW_seg[data-index="1"] .N807zW_segThumb{transform:translate(100%)}.N807zW_seg[data-index="2"] .N807zW_segThumb{transform:translate(200%)}.N807zW_segOption{min-width:0;font:inherit;color:var(--dsw-alias-label-secondary);text-overflow:ellipsis;white-space:nowrap;cursor:pointer;background:0 0;border:0;border-radius:6px;flex:1 1 0;padding:4px 8px;font-size:12.5px;line-height:1.5;transition:color .16s;position:relative;overflow:hidden}.N807zW_segOption:hover:not(:disabled){color:var(--dsw-alias-label-primary)}.N807zW_segOption[aria-checked=true]{color:var(--dsw-alias-label-primary);font-weight:600}.N807zW_segOption:disabled{opacity:.55;cursor:default}.N807zW_segOption:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:1px}.N807zW_pageTop{flex-direction:column;gap:3px;padding:2px 0 12px;display:flex}.N807zW_title{color:var(--dsw-alias-label-primary);margin:0;font-size:15px;font-weight:600;line-height:1.4}.N807zW_intro{color:var(--dsw-alias-label-secondary);margin:0;font-size:13px;line-height:1.5}.N807zW_card,.N807zW_cardModels{border:.5px solid var(--dsw-alias-border-l2);background:color-mix(in srgb, var(--dsw-alias-bg-layer-3) 40%, transparent);border-radius:12px;padding:8px 0 10px}.N807zW_card{flex:none}.N807zW_card+.N807zW_card,.N807zW_card+.N807zW_cardModels,.N807zW_cardModels+.N807zW_card{margin-top:8px}.N807zW_cardModels{flex-direction:column;flex:1 0 auto;display:flex}.N807zW_cardFolded{flex:none}.N807zW_cardHead{align-items:center;gap:8px;min-height:24px;padding:0 14px;display:flex}.N807zW_cardTitle{min-width:0;color:var(--dsw-alias-label-primary);flex:1;font-size:13.5px;font-weight:600;line-height:1.5}.N807zW_cardSub{color:var(--dsw-alias-label-tertiary);flex:none;font-size:11.5px;line-height:1.5}.N807zW_cardStamp{white-space:nowrap;color:var(--dsw-alias-label-tertiary);flex:none;font-size:11.5px;line-height:1.5}.N807zW_cardBody{flex-direction:column;gap:8px;padding:4px 14px 0;display:flex}.N807zW_cardBody>.N807zW_input{box-sizing:border-box;width:100%}.N807zW_cardModels>.N807zW_cardBody{flex:1 0 auto}.N807zW_cardNotes{flex-direction:column;gap:8px;padding:6px 14px 2px;display:flex}.N807zW_cardNotes:empty{display:none}.N807zW_cardDivider{border-top:.5px solid var(--dsw-alias-border-l2);margin:10px 14px}.N807zW_cardTrigger{width:100%;min-height:24px;font:inherit;text-align:left;color:inherit;cursor:pointer;background:0 0;border:none;align-items:center;gap:8px;margin:0;padding:0 14px;display:flex}.N807zW_cardTrigger:hover .N807zW_cardTitle{color:var(--dsw-alias-brand-primary)}.N807zW_cardHead>.N807zW_cardTrigger{padding:0}.N807zW_limitsEditor{flex-direction:column;flex:1 0 auto;gap:10px;padding-top:4px;display:flex}.N807zW_limitsFoot{border-top:.5px solid var(--dsw-alias-border-l2);align-items:center;gap:8px;margin:2px -14px 0;padding:10px 14px 0;display:flex}.N807zW_limitsSummary{min-width:0;color:var(--dsw-alias-label-tertiary);white-space:nowrap;flex:1;font-size:12px;line-height:1.5}.N807zW_modelMeta{align-items:baseline;gap:10px;display:flex}.N807zW_modelMeta .N807zW_limitsModelId{flex:1;min-width:0}.N807zW_releaseDate{color:var(--dsw-alias-label-tertiary);font-variant-numeric:tabular-nums;flex:none;font-size:11px;line-height:1.4}.N807zW_limitsModelId{text-overflow:ellipsis;white-space:nowrap;color:var(--dsw-alias-label-tertiary);font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:11px;line-height:1.4;display:block;overflow:hidden}.N807zW_visuallyHidden{clip:rect(0, 0, 0, 0);white-space:nowrap;border:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.N807zW_actions{border-top:.5px solid var(--dsw-alias-border-l2);flex-wrap:wrap;flex:none;align-items:center;gap:8px;padding:12px 0;display:flex}.N807zW_starLink{max-width:100%;color:var(--dsw-alias-label-secondary);border-radius:4px;align-items:center;gap:7px;margin-left:auto;padding:6px 0;font-size:12px;line-height:1.5;text-decoration:none;display:inline-flex}.N807zW_starLink svg{flex:none}.N807zW_starLink:hover{color:var(--dsw-alias-brand-primary)}.N807zW_starLink:hover span{text-underline-offset:3px;text-decoration:underline}.N807zW_starLink:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:3px}.N807zW_failedNote{color:var(--dsw-alias-label-error);margin:0;font-size:12px;line-height:1.5}.N807zW_slot{width:16px;height:16px;color:var(--dsw-alias-label-tertiary);flex:none;justify-content:center;align-items:center;display:inline-flex}.N807zW_slot svg{width:15px;height:15px}.N807zW_chevron,.N807zW_chevronOpen{width:14px;height:14px;color:var(--dsw-alias-label-tertiary);flex:none;transition:transform .15s}.N807zW_chevron{transform:rotate(-90deg)}.N807zW_filters{flex-wrap:wrap;align-items:center;gap:6px;display:flex}.N807zW_filterAction{align-items:center;margin-left:auto;display:inline-flex}.N807zW_filter{font:inherit;color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border:0;border-radius:6px;padding:6px 9px;font-size:12px}.N807zW_filter[aria-pressed=true]{color:var(--dsw-alias-label-primary);background:var(--dsw-alias-bg-layer-3)}.N807zW_filter span{color:var(--dsw-alias-label-tertiary);margin-left:4px}.N807zW_modelLayout{border:.5px solid var(--dsw-alias-border-l4);border-radius:10px;flex:auto;grid-template-columns:minmax(0,45fr) minmax(0,55fr);min-height:260px;max-height:560px;display:grid;overflow:hidden}.N807zW_modelList{border-right:.5px solid var(--dsw-alias-border-l2);min-height:0;padding:4px 6px;overflow-y:auto}.N807zW_modelRow{align-items:center;gap:8px;padding-right:6px;display:flex}.N807zW_modelRow+.N807zW_modelRow{border-top:.5px solid var(--dsw-alias-border-l2)}.N807zW_modelRowSelected{background:var(--dsw-alias-bg-layer-3);border-top-color:#0000;border-radius:6px}.N807zW_modelRow>[role=switch]{flex-shrink:0}.N807zW_modelChoice{text-align:left;min-width:0;color:var(--dsw-alias-label-primary);cursor:pointer;background:0 0;border:0;border-radius:6px;flex:1;align-items:baseline;padding:9px 3px 9px 6px;display:flex}.N807zW_modelRow:hover:not(.N807zW_modelRowSelected){background:color-mix(in srgb, var(--dsw-alias-bg-layer-3) 92%, var(--dsw-alias-label-primary));border-top-color:#0000;border-radius:6px}.N807zW_modelName{overflow-wrap:anywhere;flex-wrap:wrap;flex:0 auto;align-items:center;gap:5px;min-width:0;font-size:13px;display:flex}.N807zW_overrideDot{background:var(--dsw-alias-brand-primary);border-radius:50%;flex:none;width:6px;height:6px}.N807zW_modelDetails{flex-direction:column;gap:10px;min-height:0;padding:14px;display:flex;overflow-y:auto}.N807zW_modelDetails h3{overflow-wrap:anywhere;margin:0;font-size:14px}.N807zW_modelHeading{flex-wrap:wrap;align-items:center;gap:6px;display:flex}.N807zW_stats{flex-direction:column;gap:10px;display:flex}.N807zW_stat{flex-direction:column;gap:4px;display:flex}.N807zW_statLabel{color:var(--dsw-alias-label-tertiary);font-size:11px;line-height:1.5}.N807zW_budgetEditor{margin-top:12px;font-size:12px}.N807zW_budgetEditor summary{cursor:pointer}.N807zW_budgetInput{align-items:center;gap:8px;margin-top:4px;display:flex}.N807zW_budgetPresets{flex-wrap:wrap;gap:6px;margin-top:8px;display:flex}.N807zW_modelDetails .N807zW_input{box-sizing:border-box;width:100%;min-width:0;height:30px;padding:0 9px;font-size:12px}.N807zW_modalities{flex-wrap:wrap;gap:4px;display:flex}.N807zW_modality,.N807zW_modalityOff{border-radius:6px;padding:2px 7px;font-size:11px;line-height:1.5}.N807zW_modality{background:var(--dsw-alias-bg-layer-3);color:var(--dsw-alias-label-secondary)}.N807zW_modalityOff{border:.5px dashed var(--dsw-alias-border-l4);color:var(--dsw-alias-label-tertiary)}.N807zW_modelDetails .N807zW_reset{align-self:flex-start}.N807zW_paneFoot{color:var(--dsw-alias-label-tertiary);margin:auto 0 0;font-size:11px;line-height:1.5}.N807zW_newBadge{color:var(--dsw-alias-label-primary);background:var(--dsw-alias-bg-layer-3);border:.5px solid var(--dsw-alias-border-l4);border-radius:4px;padding:2px 4px;font-size:9px}.N807zW_modelChoice:focus-visible,.N807zW_filter:focus-visible,.N807zW_cardTrigger:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:-2px}@container (width<=440px){.N807zW_row{grid-template-columns:minmax(0,1fr);gap:6px}.N807zW_modelLayout{flex:none;grid-template-columns:minmax(0,1fr);max-height:none}.N807zW_modelList{border-right:0;border-bottom:.5px solid var(--dsw-alias-border-l2);max-height:240px}.N807zW_modelDetails{max-height:460px}}@media (prefers-reduced-motion:reduce){.N807zW_chevron,.N807zW_chevronOpen,.N807zW_segThumb,.N807zW_segOption{transition:none}}';
|
|
60
|
+
document.head.appendChild(style);
|
|
61
|
+
}
|
|
62
|
+
var Section_default = { "accountActions": "N807zW_accountActions", "accountBar": "N807zW_accountBar", "accountBarFill": "N807zW_accountBarFill", "accountBarTick": "N807zW_accountBarTick", "accountDetail": "N807zW_accountDetail", "accountDot": "N807zW_accountDot", "accountEditor": "N807zW_accountEditor", "accountEditorActions": "N807zW_accountEditorActions", "accountEditorFor": "N807zW_accountEditorFor", "accountEditorHead": "N807zW_accountEditorHead", "accountEditorTitle": "N807zW_accountEditorTitle", "accountField": "N807zW_accountField", "accountHandle": "N807zW_accountHandle", "accountIdle": "N807zW_accountIdle", "accountMain": "N807zW_accountMain", "accountName": "N807zW_accountName", "accountPercent": "N807zW_accountPercent", "accountProblems": "N807zW_accountProblems", "accountReset": "N807zW_accountReset", "accountRetry": "N807zW_accountRetry", "accountRow": "N807zW_accountRow", "accountState": "N807zW_accountState", "accountToggle": "N807zW_accountToggle", "accountUsage": "N807zW_accountUsage", "accounts": "N807zW_accounts", "actions": "N807zW_actions", "advancedHead": "N807zW_advancedHead", "budgetEditor": "N807zW_budgetEditor", "budgetInput": "N807zW_budgetInput", "budgetPresets": "N807zW_budgetPresets", "card": "N807zW_card", "cardBody": "N807zW_cardBody", "cardDivider": "N807zW_cardDivider", "cardFolded": "N807zW_cardFolded", "cardHead": "N807zW_cardHead", "cardModels": "N807zW_cardModels", "cardNotes": "N807zW_cardNotes", "cardStamp": "N807zW_cardStamp", "cardSub": "N807zW_cardSub", "cardTitle": "N807zW_cardTitle", "cardTrigger": "N807zW_cardTrigger", "chevron": "N807zW_chevron", "chevronOpen": "N807zW_chevronOpen", "failedNote": "N807zW_failedNote", "field": "N807zW_field", "filter": "N807zW_filter", "filterAction": "N807zW_filterAction", "filters": "N807zW_filters", "groupHead": "N807zW_groupHead", "head": "N807zW_head", "hint": "N807zW_hint", "info": "N807zW_info", "input": "N807zW_input", "inputInvalid": "N807zW_inputInvalid N807zW_input", "intro": "N807zW_intro", "invalid": "N807zW_invalid", "label": "N807zW_label", "limitsEditor": "N807zW_limitsEditor", "limitsFoot": "N807zW_limitsFoot", "limitsModelId": "N807zW_limitsModelId", "limitsSummary": "N807zW_limitsSummary", "modalities": "N807zW_modalities", "modality": "N807zW_modality", "modalityOff": "N807zW_modalityOff", "modelChoice": "N807zW_modelChoice", "modelDetails": "N807zW_modelDetails", "modelHeading": "N807zW_modelHeading", "modelLayout": "N807zW_modelLayout", "modelList": "N807zW_modelList", "modelMeta": "N807zW_modelMeta", "modelName": "N807zW_modelName", "modelRow": "N807zW_modelRow", "modelRowSelected": "N807zW_modelRowSelected", "newBadge": "N807zW_newBadge", "overrideDot": "N807zW_overrideDot", "page": "N807zW_page", "pageBody": "N807zW_pageBody", "pageTop": "N807zW_pageTop", "paneFoot": "N807zW_paneFoot", "releaseDate": "N807zW_releaseDate", "reset": "N807zW_reset", "row": "N807zW_row", "rowControl": "N807zW_rowControl", "rowHint": "N807zW_rowHint", "rowInvalid": "N807zW_rowInvalid", "rowLabel": "N807zW_rowLabel", "rowTitle": "N807zW_rowTitle", "rows": "N807zW_rows", "seg": "N807zW_seg", "segOption": "N807zW_segOption", "segThumb": "N807zW_segThumb", "slot": "N807zW_slot", "starLink": "N807zW_starLink", "stat": "N807zW_stat", "statLabel": "N807zW_statLabel", "stats": "N807zW_stats", "title": "N807zW_title", "trailing": "N807zW_trailing", "visuallyHidden": "N807zW_visuallyHidden" };
|
|
63
|
+
|
|
64
|
+
// src/client/hint-mark.tsx
|
|
65
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
66
|
+
var QuestionMark = hostAtom(
|
|
67
|
+
primitives,
|
|
68
|
+
"IconQuestionOutlineRegular",
|
|
69
|
+
"IconQuestionOutline14"
|
|
70
|
+
);
|
|
71
|
+
var HintTooltip = primitives.Tooltip;
|
|
72
|
+
function HintMark(props) {
|
|
73
|
+
const glyph = QuestionMark ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(QuestionMark, {}) : "?";
|
|
74
|
+
if (!HintTooltip) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: Section_default.info, "aria-hidden": "true", children: glyph });
|
|
75
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(HintTooltip, { label: props.hint, side: "bottom", maxWidth: 280, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", className: Section_default.info, "aria-label": props.hint, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { "aria-hidden": "true", children: glyph }) }) });
|
|
76
|
+
}
|
|
77
|
+
function HintText(props) {
|
|
78
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { id: props.id, className: HintTooltip ? Section_default.visuallyHidden : Section_default.rowHint, children: props.hint });
|
|
79
|
+
}
|
|
44
80
|
|
|
45
81
|
// src/client/ModelEditor.tsx
|
|
46
82
|
var import_react = require("react");
|
|
@@ -82,6 +118,10 @@ function parseGoModels(value) {
|
|
|
82
118
|
for (const key of ["contextWindow", "maxTokens"]) {
|
|
83
119
|
if (typeof row[key] === "number" && Number.isSafeInteger(row[key]) && row[key] > 0) model[key] = row[key];
|
|
84
120
|
}
|
|
121
|
+
if (row.reasoningBudget !== null && typeof row.reasoningBudget === "object") {
|
|
122
|
+
const { min, max } = row.reasoningBudget;
|
|
123
|
+
if (typeof min === "number" && Number.isSafeInteger(min) && min > 0 && typeof max === "number" && Number.isSafeInteger(max) && max >= min) model.reasoningBudget = { min, max };
|
|
124
|
+
}
|
|
85
125
|
if (typeof row.deprecated === "boolean") model.deprecated = row.deprecated;
|
|
86
126
|
if (typeof row.configurationMissing === "boolean") model.configurationMissing = row.configurationMissing;
|
|
87
127
|
if (validReleaseDate(row.releaseDate)) model.releaseDate = row.releaseDate;
|
|
@@ -113,9 +153,11 @@ function parseSources(value) {
|
|
|
113
153
|
throw new Error("Invalid OpenCode Go catalog source timestamp");
|
|
114
154
|
}
|
|
115
155
|
if (source.error !== void 0 && typeof source.error !== "string") throw new Error("Invalid OpenCode Go catalog source error");
|
|
156
|
+
if (source.warning !== void 0 && typeof source.warning !== "string") throw new Error("Invalid OpenCode Go catalog source warning");
|
|
116
157
|
return {
|
|
117
158
|
...source.updatedAt === void 0 ? {} : { updatedAt: source.updatedAt },
|
|
118
|
-
...source.error === void 0 ? {} : { error: source.error }
|
|
159
|
+
...source.error === void 0 ? {} : { error: source.error },
|
|
160
|
+
...source.warning === void 0 ? {} : { warning: source.warning }
|
|
119
161
|
};
|
|
120
162
|
};
|
|
121
163
|
return { listing: parse(sources.listing), metadata: parse(sources.metadata) };
|
|
@@ -139,19 +181,8 @@ var modelsRemote = {
|
|
|
139
181
|
}]
|
|
140
182
|
};
|
|
141
183
|
|
|
142
|
-
// plugin-css:src/client/Section.module.css
|
|
143
|
-
var id = "dsh-opencode-go/Section.module.css";
|
|
144
|
-
if (!document.querySelector("style[data-plugin-css=" + JSON.stringify(id) + "]")) {
|
|
145
|
-
const style = document.createElement("style");
|
|
146
|
-
style.dataset.plugin = "dsh-opencode-go";
|
|
147
|
-
style.dataset.pluginCss = id;
|
|
148
|
-
style.textContent = ".N807zW_accounts{gap:10px;margin:12px 0;display:grid}.N807zW_accountRow{border:.5px solid var(--dsw-alias-border-l2);border-radius:10px}.N807zW_accountRow[data-dragging=true]{opacity:.55}.N807zW_accountMain{grid-template-columns:16px 112px 92px minmax(0,1fr) 38px 106px 14px;align-items:center;gap:9px;padding:9px 11px;display:grid}.N807zW_accountHandle{width:16px;height:16px;color:var(--dsw-alias-label-tertiary);cursor:grab;-webkit-user-drag:element;background:0 0;border:0;place-items:center;padding:0;display:grid}.N807zW_accountHandle:disabled{cursor:default;opacity:.5}.N807zW_accountHandle:focus-visible,.N807zW_accountToggle:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:2px;border-radius:4px}.N807zW_accountName{white-space:nowrap;text-overflow:ellipsis;min-width:0;color:var(--dsw-alias-label-primary);font-size:12.5px;font-weight:600;overflow:hidden}.N807zW_accountState{min-width:0;color:var(--dsw-alias-label-tertiary);align-items:center;gap:5px;font-size:11.5px;display:inline-flex;overflow:hidden}.N807zW_accountDot{background:#39a878;border-radius:50%;flex:none;width:6px;height:6px}.N807zW_accountDot[data-off=true]{background:#d9a441}.N807zW_accountPercent{text-align:right;font-variant-numeric:tabular-nums;color:var(--dsw-alias-label-primary);font-size:12.5px;font-weight:650}.N807zW_accountBar{background:#ffffff1a;border-radius:99px;height:12px;position:relative;overflow:hidden}.N807zW_accountBarFill{background:#39a878;border-radius:99px;position:absolute;inset:0 auto 0 0}.N807zW_accountBar[data-level=high] .N807zW_accountBarFill{background:#e0a100}.N807zW_accountBar[data-level=limited] .N807zW_accountBarFill{background:#e5484d}.N807zW_accountBarTick{background:#fff3;width:1px;position:absolute;top:0;bottom:0}.N807zW_accountReset{text-align:right;color:var(--dsw-alias-label-tertiary);font-size:11.5px}.N807zW_accountIdle{text-align:right;color:var(--dsw-alias-label-tertiary);grid-column:4/7;font-size:11.5px;line-height:1.5}.N807zW_accountToggle{color:var(--dsw-alias-label-tertiary);cursor:pointer;background:0 0;border:0;place-items:center;padding:0;display:grid}.N807zW_accountProblems{align-items:baseline;gap:8px;padding:0 11px 9px 36px;display:flex}.N807zW_accountRetry{font:inherit;color:var(--dsw-alias-brand-primary);cursor:pointer;background:0 0;border:none;flex:none;padding:0;font-size:11.5px;line-height:1.5}.N807zW_accountRetry:disabled{color:var(--dsw-alias-label-tertiary);cursor:default}.N807zW_accountHandle:active{cursor:grabbing}.N807zW_accountDetail{border-top:.5px solid var(--dsw-alias-border-l2);flex-direction:column;gap:8px;padding:9px 11px 10px 36px;display:flex}.N807zW_accountDropLine{background:var(--dsw-alias-brand-primary);border-radius:2px;height:2px}.N807zW_accountUsage{grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;font-size:12px;display:grid}.N807zW_accountUsage progress{accent-color:#39a878;width:100%;height:8px;margin:6px 0;display:block}.N807zW_accountUsage progress[data-level=high]{accent-color:#e0a100}.N807zW_accountUsage progress[data-level=limited]{accent-color:#e5484d}.N807zW_accountUsage .N807zW_hint{overflow-wrap:anywhere;display:block}.N807zW_accountActions{flex-wrap:wrap;gap:8px;margin-top:10px;display:flex}.N807zW_accountEditor{border:.5px solid var(--dsw-alias-border-l2);background:color-mix(in srgb, var(--dsw-alias-bg-layer-3) 25%, transparent);border-radius:10px;flex-direction:column;gap:8px;margin:0 11px 10px 36px;padding:10px 12px;display:flex}.N807zW_accountEditorHead{align-items:baseline;gap:6px;min-width:0;display:flex}.N807zW_accountEditorTitle{color:var(--dsw-alias-label-primary);flex:none;font-size:12.5px;font-weight:600;line-height:1.5}.N807zW_accountEditorFor{min-width:0;color:var(--dsw-alias-label-tertiary);overflow-wrap:anywhere;font-size:11.5px;line-height:1.5}.N807zW_accountField{color:var(--dsw-alias-label-tertiary);flex-direction:column;gap:5px;font-size:11.5px;line-height:1.5;display:flex}.N807zW_accountEditorActions{align-items:center;gap:8px;margin-top:2px;display:flex}@media (width<=480px){.N807zW_accountUsage{grid-template-columns:1fr}}.N807zW_page{flex-direction:column;min-width:0;height:100%;min-height:0;display:flex;container-type:size}.N807zW_pageBody{scrollbar-gutter:stable;flex-direction:column;flex:1;min-height:0;padding:0 4px 16px 0;display:flex;overflow-y:auto}.N807zW_pageBody,.N807zW_modelList,.N807zW_modelDetails{scrollbar-width:thin;scrollbar-color:var(--dsw-alias-border-l3) transparent}.N807zW_pageBody::-webkit-scrollbar,.N807zW_modelList::-webkit-scrollbar,.N807zW_modelDetails::-webkit-scrollbar{width:8px;height:8px}.N807zW_pageBody::-webkit-scrollbar-track,.N807zW_modelList::-webkit-scrollbar-track,.N807zW_modelDetails::-webkit-scrollbar-track{background:0 0}.N807zW_pageBody::-webkit-scrollbar-thumb,.N807zW_modelList::-webkit-scrollbar-thumb,.N807zW_modelDetails::-webkit-scrollbar-thumb{background:var(--dsw-alias-border-l3);background-clip:content-box;border:2px solid #0000;border-radius:999px}.N807zW_pageBody:hover::-webkit-scrollbar-thumb,.N807zW_modelList:hover::-webkit-scrollbar-thumb,.N807zW_modelDetails:hover::-webkit-scrollbar-thumb{background:var(--dsw-alias-label-tertiary);background-clip:content-box}.N807zW_field{flex-direction:column;gap:6px;padding:12px 0;display:flex}.N807zW_field+.N807zW_field{border-top:.5px solid var(--dsw-alias-border-l2)}.N807zW_head{align-items:center;gap:8px;display:flex}.N807zW_label{min-width:0;color:var(--dsw-alias-label-primary);flex:1;font-size:13px;font-weight:500;line-height:1.5}.N807zW_badges{align-items:center;gap:8px;display:inline-flex}.N807zW_trailing{flex:none;align-items:center;gap:8px;display:inline-flex}.N807zW_reset{font:inherit;color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border:none;padding:0;font-size:12px;line-height:1.5}.N807zW_reset:hover:not(:disabled){color:var(--dsw-alias-label-primary)}.N807zW_reset:disabled{cursor:default}.N807zW_reset:focus-visible,.N807zW_cardTrigger:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:3px}.N807zW_input{border:.5px solid var(--dsw-alias-border-l4);background:var(--dsw-alias-bg-layer-3);height:34px;font:inherit;color:var(--dsw-alias-label-primary);border-radius:8px;padding:0 12px;font-size:13px;line-height:1.5}.N807zW_input:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:1px;border-color:var(--dsw-alias-brand-primary)}.N807zW_input:disabled{color:var(--dsw-alias-label-tertiary);cursor:default}.N807zW_inputInvalid{border-color:var(--dsw-alias-label-error);}.N807zW_invalid{color:var(--dsw-alias-label-error);margin:0;font-size:12px;line-height:1.5}.N807zW_hint{color:var(--dsw-alias-label-tertiary);margin:0;font-size:12px;line-height:1.5}.N807zW_pageTop{flex-direction:column;gap:3px;padding:2px 0 12px;display:flex}.N807zW_title{color:var(--dsw-alias-label-primary);margin:0;font-size:15px;font-weight:600;line-height:1.4}.N807zW_intro{color:var(--dsw-alias-label-secondary);margin:0;font-size:13px;line-height:1.5}.N807zW_card,.N807zW_cardModels{border:.5px solid var(--dsw-alias-border-l2);background:color-mix(in srgb, var(--dsw-alias-bg-layer-3) 40%, transparent);border-radius:12px;padding:8px 0 10px}.N807zW_card{flex:none}.N807zW_card+.N807zW_card,.N807zW_card+.N807zW_cardModels,.N807zW_cardModels+.N807zW_card{margin-top:8px}.N807zW_cardModels{flex-direction:column;flex:1 0 auto;display:flex}.N807zW_cardFolded{flex:none}.N807zW_cardHead{align-items:center;gap:8px;min-height:24px;padding:0 14px;display:flex}.N807zW_cardTitle{min-width:0;color:var(--dsw-alias-label-primary);flex:1;font-size:13.5px;font-weight:600;line-height:1.5}.N807zW_cardSub{color:var(--dsw-alias-label-tertiary);flex:none;font-size:11.5px;line-height:1.5}.N807zW_cardStamp{white-space:nowrap;color:var(--dsw-alias-label-tertiary);flex:none;font-size:11.5px;line-height:1.5}.N807zW_cardBody{flex-direction:column;gap:8px;padding:4px 14px 0;display:flex}.N807zW_cardBody>.N807zW_input{box-sizing:border-box;width:100%}.N807zW_cardModels>.N807zW_cardBody{flex:1 0 auto}.N807zW_cardNotes{flex-direction:column;gap:8px;padding:6px 14px 2px;display:flex}.N807zW_cardNotes:empty{display:none}.N807zW_cardDivider{border-top:.5px solid var(--dsw-alias-border-l2);margin:10px 14px}.N807zW_cardTrigger{width:100%;min-height:24px;font:inherit;text-align:left;color:inherit;cursor:pointer;background:0 0;border:none;align-items:center;gap:8px;margin:0;padding:0 14px;display:flex}.N807zW_cardTrigger:hover .N807zW_cardTitle{color:var(--dsw-alias-brand-primary)}.N807zW_cardHead>.N807zW_cardTrigger{padding:0}.N807zW_advancedGrid{grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:12px 18px;display:grid}.N807zW_advancedGrid .N807zW_field{padding:0}.N807zW_advancedGrid .N807zW_field+.N807zW_field{border-top:none}.N807zW_limitsEditor{flex-direction:column;flex:1 0 auto;gap:10px;padding-top:4px;display:flex}.N807zW_limitsFoot{border-top:.5px solid var(--dsw-alias-border-l2);align-items:center;gap:8px;margin:2px -14px 0;padding:10px 14px 0;display:flex}.N807zW_limitsSummary{min-width:0;color:var(--dsw-alias-label-tertiary);white-space:nowrap;flex:1;font-size:12px;line-height:1.5}.N807zW_modelMeta{align-items:baseline;gap:10px;display:flex}.N807zW_modelMeta .N807zW_limitsModelId{flex:1;min-width:0}.N807zW_releaseDate{color:var(--dsw-alias-label-tertiary);font-variant-numeric:tabular-nums;flex:none;font-size:11px;line-height:1.4}.N807zW_limitsModelId{text-overflow:ellipsis;white-space:nowrap;color:var(--dsw-alias-label-tertiary);font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:11px;line-height:1.4;display:block;overflow:hidden}.N807zW_visuallyHidden{clip:rect(0, 0, 0, 0);white-space:nowrap;border:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.N807zW_actions{border-top:.5px solid var(--dsw-alias-border-l2);flex-wrap:wrap;flex:none;align-items:center;gap:8px;padding:12px 0;display:flex}.N807zW_starLink{max-width:100%;color:var(--dsw-alias-label-secondary);border-radius:4px;align-items:center;gap:7px;margin-left:auto;padding:6px 0;font-size:12px;line-height:1.5;text-decoration:none;display:inline-flex}.N807zW_starLink svg{flex:none}.N807zW_starLink:hover{color:var(--dsw-alias-brand-primary)}.N807zW_starLink:hover span{text-underline-offset:3px;text-decoration:underline}.N807zW_starLink:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:3px}.N807zW_failedNote{color:var(--dsw-alias-label-error);margin:0;font-size:12px;line-height:1.5}.N807zW_slot{width:16px;height:16px;color:var(--dsw-alias-label-tertiary);flex:none;justify-content:center;align-items:center;display:inline-flex}.N807zW_slot svg{width:15px;height:15px}.N807zW_chevron,.N807zW_chevronOpen{width:14px;height:14px;color:var(--dsw-alias-label-tertiary);flex:none;transition:transform .15s}.N807zW_chevron{transform:rotate(-90deg)}.N807zW_filters{flex-wrap:wrap;align-items:center;gap:6px;display:flex}.N807zW_filterAction{align-items:center;margin-left:auto;display:inline-flex}.N807zW_filter{font:inherit;color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border:0;border-radius:6px;padding:6px 9px;font-size:12px}.N807zW_filter[aria-pressed=true]{color:var(--dsw-alias-label-primary);background:var(--dsw-alias-bg-layer-3)}.N807zW_filter span{color:var(--dsw-alias-label-tertiary);margin-left:4px}.N807zW_modelLayout{border:.5px solid var(--dsw-alias-border-l4);border-radius:10px;flex:auto;grid-template-columns:minmax(0,45fr) minmax(0,55fr);min-height:260px;max-height:560px;display:grid;overflow:hidden}.N807zW_modelList{border-right:.5px solid var(--dsw-alias-border-l2);min-height:0;padding:4px 6px;overflow-y:auto}.N807zW_modelRow{align-items:center;gap:8px;padding-right:6px;display:flex}.N807zW_modelRow+.N807zW_modelRow{border-top:.5px solid var(--dsw-alias-border-l2)}.N807zW_modelRowSelected{background:var(--dsw-alias-bg-layer-3);border-top-color:#0000;border-radius:6px}.N807zW_modelRow>[role=switch]{flex-shrink:0}.N807zW_modelChoice{text-align:left;min-width:0;color:var(--dsw-alias-label-primary);cursor:pointer;background:0 0;border:0;border-radius:6px;flex:1;align-items:baseline;padding:9px 3px 9px 6px;display:flex}.N807zW_modelRow:hover:not(.N807zW_modelRowSelected){background:color-mix(in srgb, var(--dsw-alias-bg-layer-3) 92%, var(--dsw-alias-label-primary));border-top-color:#0000;border-radius:6px}.N807zW_modelName{overflow-wrap:anywhere;flex-wrap:wrap;flex:0 auto;align-items:center;gap:5px;min-width:0;font-size:13px;display:flex}.N807zW_overrideDot{background:var(--dsw-alias-brand-primary);border-radius:50%;flex:none;width:6px;height:6px}.N807zW_modelDetails{flex-direction:column;gap:10px;min-height:0;padding:14px;display:flex;overflow-y:auto}.N807zW_modelDetails h3{overflow-wrap:anywhere;margin:0;font-size:14px}.N807zW_modelHeading{flex-wrap:wrap;align-items:center;gap:6px;display:flex}.N807zW_stats{flex-direction:column;gap:10px;display:flex}.N807zW_stat{flex-direction:column;gap:4px;display:flex}.N807zW_statLabel{color:var(--dsw-alias-label-tertiary);font-size:11px;line-height:1.5}.N807zW_modelDetails .N807zW_input{box-sizing:border-box;width:100%;min-width:0;height:30px;padding:0 9px;font-size:12px}.N807zW_modalities{flex-wrap:wrap;gap:4px;display:flex}.N807zW_modality,.N807zW_modalityOff{border-radius:6px;padding:2px 7px;font-size:11px;line-height:1.5}.N807zW_modality{background:var(--dsw-alias-bg-layer-3);color:var(--dsw-alias-label-secondary)}.N807zW_modalityOff{border:.5px dashed var(--dsw-alias-border-l4);color:var(--dsw-alias-label-tertiary)}.N807zW_modelDetails .N807zW_reset{align-self:flex-start}.N807zW_paneFoot{color:var(--dsw-alias-label-tertiary);margin:auto 0 0;font-size:11px;line-height:1.5}.N807zW_newBadge{color:var(--dsw-alias-label-primary);background:var(--dsw-alias-bg-layer-3);border:.5px solid var(--dsw-alias-border-l4);border-radius:4px;padding:2px 4px;font-size:9px}.N807zW_modelChoice:focus-visible,.N807zW_filter:focus-visible,.N807zW_cardTrigger:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:-2px}@container (width<=440px){.N807zW_advancedGrid{grid-template-columns:minmax(0,1fr)}.N807zW_modelLayout{flex:none;grid-template-columns:minmax(0,1fr);max-height:none}.N807zW_modelList{border-right:0;border-bottom:.5px solid var(--dsw-alias-border-l2);max-height:240px}.N807zW_modelDetails{max-height:460px}}@media (prefers-reduced-motion:reduce){.N807zW_chevron,.N807zW_chevronOpen{transition:none}}";
|
|
149
|
-
document.head.appendChild(style);
|
|
150
|
-
}
|
|
151
|
-
var Section_default = { "accountActions": "N807zW_accountActions", "accountBar": "N807zW_accountBar", "accountBarFill": "N807zW_accountBarFill", "accountBarTick": "N807zW_accountBarTick", "accountDetail": "N807zW_accountDetail", "accountDot": "N807zW_accountDot", "accountDropLine": "N807zW_accountDropLine", "accountEditor": "N807zW_accountEditor", "accountEditorActions": "N807zW_accountEditorActions", "accountEditorFor": "N807zW_accountEditorFor", "accountEditorHead": "N807zW_accountEditorHead", "accountEditorTitle": "N807zW_accountEditorTitle", "accountField": "N807zW_accountField", "accountHandle": "N807zW_accountHandle", "accountIdle": "N807zW_accountIdle", "accountMain": "N807zW_accountMain", "accountName": "N807zW_accountName", "accountPercent": "N807zW_accountPercent", "accountProblems": "N807zW_accountProblems", "accountReset": "N807zW_accountReset", "accountRetry": "N807zW_accountRetry", "accountRow": "N807zW_accountRow", "accountState": "N807zW_accountState", "accountToggle": "N807zW_accountToggle", "accountUsage": "N807zW_accountUsage", "accounts": "N807zW_accounts", "actions": "N807zW_actions", "advancedGrid": "N807zW_advancedGrid", "badges": "N807zW_badges", "card": "N807zW_card", "cardBody": "N807zW_cardBody", "cardDivider": "N807zW_cardDivider", "cardFolded": "N807zW_cardFolded", "cardHead": "N807zW_cardHead", "cardModels": "N807zW_cardModels", "cardNotes": "N807zW_cardNotes", "cardStamp": "N807zW_cardStamp", "cardSub": "N807zW_cardSub", "cardTitle": "N807zW_cardTitle", "cardTrigger": "N807zW_cardTrigger", "chevron": "N807zW_chevron", "chevronOpen": "N807zW_chevronOpen", "failedNote": "N807zW_failedNote", "field": "N807zW_field", "filter": "N807zW_filter", "filterAction": "N807zW_filterAction", "filters": "N807zW_filters", "head": "N807zW_head", "hint": "N807zW_hint", "input": "N807zW_input", "inputInvalid": "N807zW_inputInvalid N807zW_input", "intro": "N807zW_intro", "invalid": "N807zW_invalid", "label": "N807zW_label", "limitsEditor": "N807zW_limitsEditor", "limitsFoot": "N807zW_limitsFoot", "limitsModelId": "N807zW_limitsModelId", "limitsSummary": "N807zW_limitsSummary", "modalities": "N807zW_modalities", "modality": "N807zW_modality", "modalityOff": "N807zW_modalityOff", "modelChoice": "N807zW_modelChoice", "modelDetails": "N807zW_modelDetails", "modelHeading": "N807zW_modelHeading", "modelLayout": "N807zW_modelLayout", "modelList": "N807zW_modelList", "modelMeta": "N807zW_modelMeta", "modelName": "N807zW_modelName", "modelRow": "N807zW_modelRow", "modelRowSelected": "N807zW_modelRowSelected", "newBadge": "N807zW_newBadge", "overrideDot": "N807zW_overrideDot", "page": "N807zW_page", "pageBody": "N807zW_pageBody", "pageTop": "N807zW_pageTop", "paneFoot": "N807zW_paneFoot", "releaseDate": "N807zW_releaseDate", "reset": "N807zW_reset", "slot": "N807zW_slot", "starLink": "N807zW_starLink", "stat": "N807zW_stat", "statLabel": "N807zW_statLabel", "stats": "N807zW_stats", "title": "N807zW_title", "trailing": "N807zW_trailing", "visuallyHidden": "N807zW_visuallyHidden" };
|
|
152
|
-
|
|
153
184
|
// src/client/ModelEditor.tsx
|
|
154
|
-
var
|
|
185
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
155
186
|
var MODALITY_COPY = {
|
|
156
187
|
text: "modalityText",
|
|
157
188
|
image: "modalityImage",
|
|
@@ -160,7 +191,7 @@ var MODALITY_COPY = {
|
|
|
160
191
|
pdf: "modalityPdf"
|
|
161
192
|
};
|
|
162
193
|
function hasCapacityOverride(limit) {
|
|
163
|
-
return limit?.contextWindow != null || limit?.maxTokens != null;
|
|
194
|
+
return limit?.contextWindow != null || limit?.maxTokens != null || (limit?.thinkingBudgets?.length ?? 0) > 0;
|
|
164
195
|
}
|
|
165
196
|
function ModelEditor({ models, draft, modelVisibility, t, locale, disabled, visibilitySaving, filterAction, onEdit, onModelEnabled }) {
|
|
166
197
|
const [query, setQuery] = (0, import_react.useState)("");
|
|
@@ -189,18 +220,18 @@ function ModelEditor({ models, draft, modelVisibility, t, locale, disabled, visi
|
|
|
189
220
|
["deprecated", "filterDeprecated", all.filter((entry) => entry.deprecated).length]
|
|
190
221
|
];
|
|
191
222
|
const write = (id3, field, value) => {
|
|
192
|
-
const current = draft[id3] === null ? { contextWindow: null, maxTokens: null } : draft[id3] ?? {};
|
|
223
|
+
const current = draft[id3] === null ? { contextWindow: null, maxTokens: null, thinkingBudgets: null } : draft[id3] ?? {};
|
|
193
224
|
onEdit({ ...draft, [id3]: { ...current, [field]: value ?? null } });
|
|
194
225
|
};
|
|
195
|
-
const badges = (entry) => /* @__PURE__ */ (0,
|
|
196
|
-
entry.configurationMissing ? /* @__PURE__ */ (0,
|
|
197
|
-
isNewModel(entry, now) ? /* @__PURE__ */ (0,
|
|
198
|
-
entry.deprecated ? /* @__PURE__ */ (0,
|
|
226
|
+
const badges = (entry) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
|
|
227
|
+
entry.configurationMissing ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_dsh_client_ui_primitives.Tag, { tone: "warning", children: t(metadataUnavailable ? "configurationUnavailable" : "configurationMissing") }) : null,
|
|
228
|
+
isNewModel(entry, now) ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: Section_default.newBadge, title: t("newHint"), children: t("newBadge") }) : null,
|
|
229
|
+
entry.deprecated ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_dsh_client_ui_primitives.Tag, { tone: "warning", children: t("deprecatedBadge") }) : null
|
|
199
230
|
] });
|
|
200
|
-
return /* @__PURE__ */ (0,
|
|
201
|
-
/* @__PURE__ */ (0,
|
|
202
|
-
/* @__PURE__ */ (0,
|
|
203
|
-
/* @__PURE__ */ (0,
|
|
231
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: Section_default.limitsEditor, children: [
|
|
232
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: Section_default.hint, children: t("visibilityHint") }),
|
|
233
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("label", { className: Section_default.visuallyHidden, htmlFor: "opencode-go-model-filter", children: t("limitsFilterLabel") }),
|
|
234
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
204
235
|
"input",
|
|
205
236
|
{
|
|
206
237
|
id: "opencode-go-model-filter",
|
|
@@ -214,8 +245,8 @@ function ModelEditor({ models, draft, modelVisibility, t, locale, disabled, visi
|
|
|
214
245
|
}
|
|
215
246
|
}
|
|
216
247
|
),
|
|
217
|
-
/* @__PURE__ */ (0,
|
|
218
|
-
filters.map(([key, label, count]) => /* @__PURE__ */ (0,
|
|
248
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: Section_default.filters, role: "group", "aria-label": t("filterLabel"), children: [
|
|
249
|
+
filters.map(([key, label, count]) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
219
250
|
"button",
|
|
220
251
|
{
|
|
221
252
|
type: "button",
|
|
@@ -227,20 +258,20 @@ function ModelEditor({ models, draft, modelVisibility, t, locale, disabled, visi
|
|
|
227
258
|
children: [
|
|
228
259
|
t(label),
|
|
229
260
|
" ",
|
|
230
|
-
/* @__PURE__ */ (0,
|
|
261
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: count })
|
|
231
262
|
]
|
|
232
263
|
},
|
|
233
264
|
key
|
|
234
265
|
)),
|
|
235
|
-
filterAction ? /* @__PURE__ */ (0,
|
|
266
|
+
filterAction ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: Section_default.filterAction, children: filterAction }) : null
|
|
236
267
|
] }),
|
|
237
|
-
model ? /* @__PURE__ */ (0,
|
|
238
|
-
/* @__PURE__ */ (0,
|
|
268
|
+
model ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: Section_default.modelLayout, children: [
|
|
269
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("nav", { className: Section_default.modelList, "aria-label": t("modelsLabel"), children: entries.map((entry) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
239
270
|
"div",
|
|
240
271
|
{
|
|
241
272
|
className: entry.id === model.id ? `${Section_default.modelRow} ${Section_default.modelRowSelected}` : Section_default.modelRow,
|
|
242
273
|
children: [
|
|
243
|
-
/* @__PURE__ */ (0,
|
|
274
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
244
275
|
"button",
|
|
245
276
|
{
|
|
246
277
|
type: "button",
|
|
@@ -249,15 +280,15 @@ function ModelEditor({ models, draft, modelVisibility, t, locale, disabled, visi
|
|
|
249
280
|
onClick: () => {
|
|
250
281
|
setSelected(entry.id);
|
|
251
282
|
},
|
|
252
|
-
children: /* @__PURE__ */ (0,
|
|
283
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { className: Section_default.modelName, children: [
|
|
253
284
|
entry.name ?? entry.id,
|
|
254
285
|
" ",
|
|
255
286
|
badges(entry)
|
|
256
287
|
] })
|
|
257
288
|
}
|
|
258
289
|
),
|
|
259
|
-
hasCapacityOverride(draft[entry.id]) ? /* @__PURE__ */ (0,
|
|
260
|
-
/* @__PURE__ */ (0,
|
|
290
|
+
hasCapacityOverride(draft[entry.id]) ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: Section_default.overrideDot, title: t("overridden"), "aria-hidden": "true" }) : null,
|
|
291
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
261
292
|
import_dsh_client_ui_primitives.Switch,
|
|
262
293
|
{
|
|
263
294
|
label: t("modelVisibleLabel", { name: entry.name ?? entry.id }),
|
|
@@ -272,26 +303,40 @@ function ModelEditor({ models, draft, modelVisibility, t, locale, disabled, visi
|
|
|
272
303
|
},
|
|
273
304
|
entry.id
|
|
274
305
|
)) }),
|
|
275
|
-
/* @__PURE__ */ (0,
|
|
276
|
-
/* @__PURE__ */ (0,
|
|
277
|
-
/* @__PURE__ */ (0,
|
|
306
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("section", { className: Section_default.modelDetails, "aria-label": t("modelDetails"), children: [
|
|
307
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: Section_default.modelHeading, children: [
|
|
308
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("h3", { children: model.name ?? model.id }),
|
|
278
309
|
badges(model)
|
|
279
310
|
] }),
|
|
280
|
-
/* @__PURE__ */ (0,
|
|
281
|
-
/* @__PURE__ */ (0,
|
|
282
|
-
model.releaseDate ? /* @__PURE__ */ (0,
|
|
311
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: Section_default.modelMeta, children: [
|
|
312
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("code", { className: Section_default.limitsModelId, translate: "no", children: model.id }),
|
|
313
|
+
model.releaseDate ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: Section_default.releaseDate, title: t("releaseSource", { date: model.releaseDate }), children: model.releaseDate }) : null
|
|
283
314
|
] }),
|
|
284
|
-
model.configurationMissing ? /* @__PURE__ */ (0,
|
|
285
|
-
model.deprecated ? /* @__PURE__ */ (0,
|
|
286
|
-
/* @__PURE__ */ (0,
|
|
287
|
-
/* @__PURE__ */ (0,
|
|
288
|
-
/* @__PURE__ */ (0,
|
|
289
|
-
/* @__PURE__ */ (0,
|
|
290
|
-
/* @__PURE__ */ (0,
|
|
291
|
-
/* @__PURE__ */ (0,
|
|
315
|
+
model.configurationMissing ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: Section_default.hint, children: t(metadataUnavailable ? "configurationUnavailableHint" : "configurationMissingHint") }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
|
|
316
|
+
model.deprecated ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: Section_default.hint, children: t("deprecatedHint") }) : null,
|
|
317
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: Section_default.stats, children: [
|
|
318
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Capacity, { model, field: "contextWindow", limit: draft[model.id], t, locale, disabled, onChange: write }),
|
|
319
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Capacity, { model, field: "maxTokens", limit: draft[model.id], t, locale, disabled, onChange: write }),
|
|
320
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: Section_default.stat, children: [
|
|
321
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: Section_default.statLabel, children: t("modalityLabel") }),
|
|
322
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Modalities, { model, t })
|
|
292
323
|
] })
|
|
293
324
|
] }),
|
|
294
|
-
|
|
325
|
+
model.reasoningBudget ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
326
|
+
BudgetPresets,
|
|
327
|
+
{
|
|
328
|
+
model,
|
|
329
|
+
limit: draft[model.id],
|
|
330
|
+
t,
|
|
331
|
+
locale,
|
|
332
|
+
disabled,
|
|
333
|
+
onChange: (values) => {
|
|
334
|
+
write(model.id, "thinkingBudgets", values);
|
|
335
|
+
}
|
|
336
|
+
},
|
|
337
|
+
model.id
|
|
338
|
+
) : null,
|
|
339
|
+
hasCapacityOverride(draft[model.id]) ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
295
340
|
"button",
|
|
296
341
|
{
|
|
297
342
|
type: "button",
|
|
@@ -303,7 +348,7 @@ function ModelEditor({ models, draft, modelVisibility, t, locale, disabled, visi
|
|
|
303
348
|
children: t("limitsResetModel")
|
|
304
349
|
}
|
|
305
350
|
) : null,
|
|
306
|
-
/* @__PURE__ */ (0,
|
|
351
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("p", { className: Section_default.paneFoot, children: [
|
|
307
352
|
t("limitsHint"),
|
|
308
353
|
" ",
|
|
309
354
|
t("modalitiesSource"),
|
|
@@ -311,10 +356,10 @@ function ModelEditor({ models, draft, modelVisibility, t, locale, disabled, visi
|
|
|
311
356
|
] })
|
|
312
357
|
] })
|
|
313
358
|
] })
|
|
314
|
-
] }) : models.status === "ready" && all.length > 0 ? /* @__PURE__ */ (0,
|
|
315
|
-
/* @__PURE__ */ (0,
|
|
316
|
-
/* @__PURE__ */ (0,
|
|
317
|
-
Object.values(draft).some(hasCapacityOverride) ? /* @__PURE__ */ (0,
|
|
359
|
+
] }) : models.status === "ready" && all.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: Section_default.hint, children: t("limitsNoMatches", { query }) }) : null,
|
|
360
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: Section_default.limitsFoot, children: [
|
|
361
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: Section_default.limitsSummary, children: t("limitsSummary", { count: customized }) }),
|
|
362
|
+
Object.values(draft).some(hasCapacityOverride) ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
318
363
|
import_dsh_client_ui_primitives.Button,
|
|
319
364
|
{
|
|
320
365
|
variant: "outline",
|
|
@@ -331,8 +376,8 @@ function ModelEditor({ models, draft, modelVisibility, t, locale, disabled, visi
|
|
|
331
376
|
}
|
|
332
377
|
function Modalities({ model, t }) {
|
|
333
378
|
const declared = model.inputModalities;
|
|
334
|
-
if (declared === void 0 || declared.length === 0) return /* @__PURE__ */ (0,
|
|
335
|
-
return /* @__PURE__ */ (0,
|
|
379
|
+
if (declared === void 0 || declared.length === 0) return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: Section_default.hint, children: t("modalityUnknown") });
|
|
380
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: Section_default.modalities, children: INPUT_MODALITIES.map((modality) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
336
381
|
"span",
|
|
337
382
|
{
|
|
338
383
|
className: declared.includes(modality) ? Section_default.modality : Section_default.modalityOff,
|
|
@@ -344,9 +389,9 @@ function Modalities({ model, t }) {
|
|
|
344
389
|
function Capacity({ model, field, limit, disabled, t, locale, onChange }) {
|
|
345
390
|
const id3 = `opencode-go-${field}-${encodeURIComponent(model.id)}`;
|
|
346
391
|
const defaultValue = model[field];
|
|
347
|
-
return /* @__PURE__ */ (0,
|
|
348
|
-
/* @__PURE__ */ (0,
|
|
349
|
-
/* @__PURE__ */ (0,
|
|
392
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: Section_default.stat, children: [
|
|
393
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("label", { className: Section_default.statLabel, htmlFor: id3, children: t(field === "contextWindow" ? "limitsContext" : "limitsOutput") }),
|
|
394
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
350
395
|
"input",
|
|
351
396
|
{
|
|
352
397
|
id: id3,
|
|
@@ -368,40 +413,110 @@ function Capacity({ model, field, limit, disabled, t, locale, onChange }) {
|
|
|
368
413
|
}
|
|
369
414
|
}
|
|
370
415
|
),
|
|
371
|
-
/* @__PURE__ */ (0,
|
|
416
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { id: `${id3}-default`, className: Section_default.hint, children: [
|
|
372
417
|
t("capacityDefault", { value: defaultValue === void 0 ? t("capacityMissing") : defaultValue.toLocaleString(locale) }),
|
|
373
418
|
limit?.[field] != null ? ` \xB7 ${t("overridden")}` : ""
|
|
374
419
|
] })
|
|
375
420
|
] });
|
|
376
421
|
}
|
|
422
|
+
function BudgetPresets({ model, limit, disabled, t, locale, onChange }) {
|
|
423
|
+
const [text, setText] = (0, import_react.useState)("");
|
|
424
|
+
const range = model.reasoningBudget;
|
|
425
|
+
const max = Math.min(range.max, (limit?.maxTokens ?? model.maxTokens ?? range.max + 1024) - 1024);
|
|
426
|
+
const values = limit?.thinkingBudgets ?? [];
|
|
427
|
+
const tokens = Number(text);
|
|
428
|
+
const valid = text.trim() !== "" && Number.isSafeInteger(tokens) && tokens >= range.min && tokens <= max;
|
|
429
|
+
const id3 = `opencode-go-thinking-budget-${encodeURIComponent(model.id)}`;
|
|
430
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("details", { className: Section_default.budgetEditor, children: [
|
|
431
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("summary", { children: t("thinkingBudgets") }),
|
|
432
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: Section_default.hint, children: t("thinkingBudgetsHint", { min: range.min.toLocaleString(locale), max: max.toLocaleString(locale) }) }),
|
|
433
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("label", { className: Section_default.statLabel, htmlFor: id3, children: t("thinkingBudgetAddLabel", { name: model.name ?? model.id }) }),
|
|
434
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: Section_default.budgetInput, children: [
|
|
435
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
436
|
+
"input",
|
|
437
|
+
{
|
|
438
|
+
id: id3,
|
|
439
|
+
className: Section_default.input,
|
|
440
|
+
type: "number",
|
|
441
|
+
step: 1,
|
|
442
|
+
min: range.min,
|
|
443
|
+
max,
|
|
444
|
+
inputMode: "numeric",
|
|
445
|
+
value: text,
|
|
446
|
+
placeholder: "4096",
|
|
447
|
+
disabled,
|
|
448
|
+
"aria-invalid": text !== "" && !valid,
|
|
449
|
+
onChange: (event) => {
|
|
450
|
+
setText(event.target.value);
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
),
|
|
454
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
455
|
+
import_dsh_client_ui_primitives.Button,
|
|
456
|
+
{
|
|
457
|
+
variant: "outline",
|
|
458
|
+
size: "sm",
|
|
459
|
+
disabled: disabled || !valid || values.includes(tokens) || values.length >= 16,
|
|
460
|
+
onClick: () => {
|
|
461
|
+
onChange([...values, tokens].sort((a, b) => a - b));
|
|
462
|
+
setText("");
|
|
463
|
+
},
|
|
464
|
+
children: t("thinkingBudgetAdd")
|
|
465
|
+
}
|
|
466
|
+
)
|
|
467
|
+
] }),
|
|
468
|
+
values.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: Section_default.budgetPresets, children: values.map((value) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
469
|
+
"button",
|
|
470
|
+
{
|
|
471
|
+
type: "button",
|
|
472
|
+
className: Section_default.filter,
|
|
473
|
+
disabled,
|
|
474
|
+
"aria-label": t("thinkingBudgetRemove", { value }),
|
|
475
|
+
onClick: () => {
|
|
476
|
+
const next = values.filter((tokens2) => tokens2 !== value);
|
|
477
|
+
onChange(next.length > 0 ? next : void 0);
|
|
478
|
+
},
|
|
479
|
+
children: [
|
|
480
|
+
value.toLocaleString(locale),
|
|
481
|
+
" tokens \xD7"
|
|
482
|
+
]
|
|
483
|
+
},
|
|
484
|
+
value
|
|
485
|
+
)) }) : null
|
|
486
|
+
] });
|
|
487
|
+
}
|
|
377
488
|
|
|
378
489
|
// src/client/AccountsCard.tsx
|
|
379
490
|
var import_react2 = require("react");
|
|
380
|
-
var
|
|
491
|
+
var primitives2 = __toESM(require("@deepseek-ai/dsh-client-ui-primitives"), 1);
|
|
381
492
|
var import_dsh_client_ui_primitives2 = require("@deepseek-ai/dsh-client-ui-primitives");
|
|
382
493
|
|
|
383
494
|
// src/accounts.ts
|
|
384
495
|
var MAX_ACCOUNTS = 20;
|
|
385
|
-
var ACCOUNT_REF_PREFIX = "DSH_OPENCODE_GO_ACCOUNT_";
|
|
386
496
|
var DEFAULT_ACCOUNT_REF = "OPENCODE_API_KEY";
|
|
497
|
+
var ACCOUNT_REF_PATTERN = /^[A-Za-z_][A-Za-z0-9_]*$/;
|
|
387
498
|
function accountRefOf(settings) {
|
|
388
499
|
return settings.apiKeyEnv || DEFAULT_ACCOUNT_REF;
|
|
389
500
|
}
|
|
501
|
+
function moveAccountFirst(accounts, ref) {
|
|
502
|
+
const index = accounts.findIndex((account) => account.apiKeyEnv === ref);
|
|
503
|
+
return index <= 0 ? accounts : [accounts[index], ...accounts.slice(0, index), ...accounts.slice(index + 1)];
|
|
504
|
+
}
|
|
390
505
|
function accountsOf(settings) {
|
|
391
506
|
const ref = accountRefOf(settings);
|
|
392
507
|
if (settings.accounts?.length === 0) return [];
|
|
393
508
|
const accounts = settings.accounts ?? [];
|
|
394
|
-
return accounts.some((account) => account.apiKeyEnv === ref) ? accounts : [
|
|
509
|
+
return accounts.some((account) => account.apiKeyEnv === ref) ? moveAccountFirst(accounts, ref) : [
|
|
395
510
|
{ id: `legacy:${ref}`, name: "", apiKeyEnv: ref },
|
|
396
511
|
...accounts
|
|
397
512
|
];
|
|
398
513
|
}
|
|
399
514
|
|
|
400
515
|
// src/client/AccountsCard.tsx
|
|
401
|
-
var
|
|
516
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
402
517
|
var WINDOWS = ["rolling", "weekly", "monthly"];
|
|
403
518
|
var TICKS = [25, 50, 75];
|
|
404
|
-
var ChevronDown =
|
|
519
|
+
var ChevronDown = primitives2.IconChevronDownOutlineRegular ?? primitives2.IconChevronDownOutline14;
|
|
405
520
|
function resetText(resetsAt, t) {
|
|
406
521
|
const remaining = Date.parse(resetsAt) - Date.now();
|
|
407
522
|
if (!Number.isFinite(remaining)) return t("usageResetUnknown");
|
|
@@ -422,15 +537,23 @@ function stampText(at, locale) {
|
|
|
422
537
|
return date.toDateString() === (/* @__PURE__ */ new Date()).toDateString() ? time : `${date.toLocaleDateString(locale)} ${time}`;
|
|
423
538
|
}
|
|
424
539
|
function GripIcon() {
|
|
425
|
-
return /* @__PURE__ */ (0,
|
|
426
|
-
/* @__PURE__ */ (0,
|
|
427
|
-
/* @__PURE__ */ (0,
|
|
428
|
-
/* @__PURE__ */ (0,
|
|
429
|
-
/* @__PURE__ */ (0,
|
|
430
|
-
/* @__PURE__ */ (0,
|
|
431
|
-
/* @__PURE__ */ (0,
|
|
540
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("svg", { width: "10", height: "14", viewBox: "0 0 10 14", fill: "currentColor", "aria-hidden": "true", children: [
|
|
541
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("circle", { cx: "2.5", cy: "2.5", r: "1.3" }),
|
|
542
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("circle", { cx: "7.5", cy: "2.5", r: "1.3" }),
|
|
543
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("circle", { cx: "2.5", cy: "7", r: "1.3" }),
|
|
544
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("circle", { cx: "7.5", cy: "7", r: "1.3" }),
|
|
545
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("circle", { cx: "2.5", cy: "11.5", r: "1.3" }),
|
|
546
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("circle", { cx: "7.5", cy: "11.5", r: "1.3" })
|
|
432
547
|
] });
|
|
433
548
|
}
|
|
549
|
+
function slotAt(container, clientY) {
|
|
550
|
+
const rows = container.querySelectorAll("[data-account-row]");
|
|
551
|
+
for (let index = 0; index < rows.length; index++) {
|
|
552
|
+
const box = rows[index].getBoundingClientRect();
|
|
553
|
+
if (clientY < box.top + box.height / 2) return index;
|
|
554
|
+
}
|
|
555
|
+
return rows.length;
|
|
556
|
+
}
|
|
434
557
|
function AccountsCard({ state, actions, writable, t, locale }) {
|
|
435
558
|
const [open, setOpen] = (0, import_react2.useState)(false);
|
|
436
559
|
const [details, setDetails] = (0, import_react2.useState)(null);
|
|
@@ -445,6 +568,13 @@ function AccountsCard({ state, actions, writable, t, locale }) {
|
|
|
445
568
|
const unreadable = state.entries.filter((entry) => entry.failed === true).length;
|
|
446
569
|
const preferred = state.entries.find((entry) => entry.apiKeyEnv === state.activeRef);
|
|
447
570
|
const reorderable = !disabled && total > 1;
|
|
571
|
+
const draggingFrom = dragging === null ? -1 : state.entries.findIndex((entry) => entry.apiKeyEnv === dragging);
|
|
572
|
+
const noopSlot = draggingFrom >= 0 && (dropAt === draggingFrom || dropAt === draggingFrom + 1);
|
|
573
|
+
const markAt = (index) => {
|
|
574
|
+
if (!reorderable || dropAt === null || noopSlot) return void 0;
|
|
575
|
+
if (dropAt === index) return "before";
|
|
576
|
+
return dropAt === total && index === total - 1 ? "after" : void 0;
|
|
577
|
+
};
|
|
448
578
|
const updatedAt = state.entries.reduce((latest, entry) => Math.max(latest, entry.updatedAt ?? 0), 0);
|
|
449
579
|
(0, import_react2.useEffect)(() => {
|
|
450
580
|
actions.loadAccounts();
|
|
@@ -456,11 +586,13 @@ function AccountsCard({ state, actions, writable, t, locale }) {
|
|
|
456
586
|
};
|
|
457
587
|
}, [actions.loadAccounts]);
|
|
458
588
|
const start = (next, label = "") => {
|
|
589
|
+
if (next.kind === "add") actions.resetAddition?.();
|
|
459
590
|
setEditor(next);
|
|
460
591
|
setName(label);
|
|
461
592
|
setKey("");
|
|
462
593
|
};
|
|
463
594
|
const cancel = () => {
|
|
595
|
+
if (editor?.kind === "add") actions.resetAddition?.();
|
|
464
596
|
setEditor(null);
|
|
465
597
|
setName("");
|
|
466
598
|
setKey("");
|
|
@@ -468,6 +600,12 @@ function AccountsCard({ state, actions, writable, t, locale }) {
|
|
|
468
600
|
(0, import_react2.useEffect)(() => {
|
|
469
601
|
if (editor?.ref != null && !state.entries.some((entry) => entry.apiKeyEnv === editor.ref)) cancel();
|
|
470
602
|
}, [state.entries, editor]);
|
|
603
|
+
(0, import_react2.useEffect)(() => {
|
|
604
|
+
if (dragging !== null && !state.entries.some((entry) => entry.apiKeyEnv === dragging)) {
|
|
605
|
+
setDragging(null);
|
|
606
|
+
setDropAt(null);
|
|
607
|
+
}
|
|
608
|
+
}, [state.entries, dragging]);
|
|
471
609
|
const submit = async () => {
|
|
472
610
|
if (!editor) return;
|
|
473
611
|
const accepted = editor.kind === "add" ? await actions.addAccount(name, key) : editor.kind === "rename" ? await actions.renameAccount(editor.ref, name) : editor.kind === "key" ? await actions.replaceAccountKey(editor.ref, key) : await actions.removeAccount(editor.ref);
|
|
@@ -478,7 +616,7 @@ function AccountsCard({ state, actions, writable, t, locale }) {
|
|
|
478
616
|
};
|
|
479
617
|
const summary = total ? t("accountsSummary", { count: total, name: preferred ? preferred.name || t("accountDefault") : "" }) : t("accountsSummaryEmpty");
|
|
480
618
|
const editorTitle = (kind) => t(kind === "add" ? "accountAdd" : kind === "rename" ? "accountRename" : kind === "key" ? "accountReplaceKey" : "accountRemove");
|
|
481
|
-
const editorForm = (label = "") => editor ? /* @__PURE__ */ (0,
|
|
619
|
+
const editorForm = (label = "") => editor ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
482
620
|
"form",
|
|
483
621
|
{
|
|
484
622
|
className: Section_default.accountEditor,
|
|
@@ -493,14 +631,14 @@ function AccountsCard({ state, actions, writable, t, locale }) {
|
|
|
493
631
|
}
|
|
494
632
|
},
|
|
495
633
|
children: [
|
|
496
|
-
/* @__PURE__ */ (0,
|
|
497
|
-
/* @__PURE__ */ (0,
|
|
498
|
-
label ? /* @__PURE__ */ (0,
|
|
634
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: Section_default.accountEditorHead, children: [
|
|
635
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: Section_default.accountEditorTitle, children: editorTitle(editor.kind) }),
|
|
636
|
+
label ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: Section_default.accountEditorFor, children: label }) : null
|
|
499
637
|
] }),
|
|
500
|
-
editor.kind === "remove" ? /* @__PURE__ */ (0,
|
|
501
|
-
editor.kind === "add" || editor.kind === "rename" ? /* @__PURE__ */ (0,
|
|
638
|
+
editor.kind === "remove" ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: Section_default.hint, children: t("accountRemoveHint", { name }) }) : null,
|
|
639
|
+
editor.kind === "add" || editor.kind === "rename" ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("label", { className: Section_default.accountField, children: [
|
|
502
640
|
t("accountName"),
|
|
503
|
-
/* @__PURE__ */ (0,
|
|
641
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
504
642
|
"input",
|
|
505
643
|
{
|
|
506
644
|
className: Section_default.input,
|
|
@@ -515,10 +653,10 @@ function AccountsCard({ state, actions, writable, t, locale }) {
|
|
|
515
653
|
}
|
|
516
654
|
)
|
|
517
655
|
] }) : null,
|
|
518
|
-
editor.kind === "add" || editor.kind === "key" ? /* @__PURE__ */ (0,
|
|
519
|
-
/* @__PURE__ */ (0,
|
|
656
|
+
editor.kind === "add" || editor.kind === "key" ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
|
|
657
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("label", { className: Section_default.accountField, children: [
|
|
520
658
|
t("keyLabel"),
|
|
521
|
-
/* @__PURE__ */ (0,
|
|
659
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
522
660
|
"input",
|
|
523
661
|
{
|
|
524
662
|
className: Section_default.input,
|
|
@@ -534,10 +672,10 @@ function AccountsCard({ state, actions, writable, t, locale }) {
|
|
|
534
672
|
}
|
|
535
673
|
)
|
|
536
674
|
] }),
|
|
537
|
-
/* @__PURE__ */ (0,
|
|
675
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: Section_default.hint, children: t("accountKeyHint") })
|
|
538
676
|
] }) : null,
|
|
539
|
-
/* @__PURE__ */ (0,
|
|
540
|
-
/* @__PURE__ */ (0,
|
|
677
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: Section_default.accountEditorActions, children: [
|
|
678
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
541
679
|
import_dsh_client_ui_primitives2.Button,
|
|
542
680
|
{
|
|
543
681
|
variant: "primary",
|
|
@@ -547,20 +685,20 @@ function AccountsCard({ state, actions, writable, t, locale }) {
|
|
|
547
685
|
children: t(state.busy ? "saving" : "accountConfirm")
|
|
548
686
|
}
|
|
549
687
|
),
|
|
550
|
-
/* @__PURE__ */ (0,
|
|
688
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_dsh_client_ui_primitives2.Button, { variant: "outline", size: "sm", type: "button", disabled: state.busy, onClick: cancel, children: t("accountCancel") })
|
|
551
689
|
] })
|
|
552
690
|
]
|
|
553
691
|
}
|
|
554
692
|
) : null;
|
|
555
|
-
const detail = (account, label) => /* @__PURE__ */ (0,
|
|
556
|
-
account.usage ? /* @__PURE__ */ (0,
|
|
557
|
-
/* @__PURE__ */ (0,
|
|
693
|
+
const detail = (account, label) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: Section_default.accountDetail, children: [
|
|
694
|
+
account.usage ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: Section_default.accountUsage, children: WINDOWS.map((window) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { children: [
|
|
695
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { children: [
|
|
558
696
|
t(`usage_${window}`),
|
|
559
697
|
" \xB7 ",
|
|
560
698
|
account.usage[window].percent,
|
|
561
699
|
"%"
|
|
562
700
|
] }),
|
|
563
|
-
/* @__PURE__ */ (0,
|
|
701
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
564
702
|
"progress",
|
|
565
703
|
{
|
|
566
704
|
"data-level": barLevel(account.usage[window]),
|
|
@@ -569,27 +707,27 @@ function AccountsCard({ state, actions, writable, t, locale }) {
|
|
|
569
707
|
"aria-label": `${label} ${t(`usage_${window}`)}`
|
|
570
708
|
}
|
|
571
709
|
),
|
|
572
|
-
/* @__PURE__ */ (0,
|
|
710
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { className: Section_default.hint, children: [
|
|
573
711
|
t("usageResets"),
|
|
574
712
|
" ",
|
|
575
713
|
new Date(account.usage[window].resetsAt).toLocaleString(locale)
|
|
576
714
|
] })
|
|
577
|
-
] }, window)) }) : /* @__PURE__ */ (0,
|
|
578
|
-
/* @__PURE__ */ (0,
|
|
579
|
-
/* @__PURE__ */ (0,
|
|
715
|
+
] }, window)) }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: Section_default.hint, children: t(account.loading ? "usageLoading" : "usageUnavailable") }),
|
|
716
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: Section_default.accountActions, children: [
|
|
717
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_dsh_client_ui_primitives2.Button, { variant: "outline", size: "sm", disabled, onClick: () => {
|
|
580
718
|
start({ kind: "rename", ref: account.apiKeyEnv }, label);
|
|
581
719
|
}, children: t("accountRename") }),
|
|
582
|
-
/* @__PURE__ */ (0,
|
|
720
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_dsh_client_ui_primitives2.Button, { variant: "outline", size: "sm", disabled: state.busy || state.blocked || account.writable === false, onClick: () => {
|
|
583
721
|
start({ kind: "key", ref: account.apiKeyEnv }, label);
|
|
584
722
|
}, children: t("accountReplaceKey") }),
|
|
585
|
-
/* @__PURE__ */ (0,
|
|
723
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_dsh_client_ui_primitives2.Button, { variant: "outline", size: "sm", disabled, onClick: () => {
|
|
586
724
|
start({ kind: "remove", ref: account.apiKeyEnv }, label);
|
|
587
725
|
}, children: t("accountRemove") })
|
|
588
726
|
] })
|
|
589
727
|
] });
|
|
590
|
-
return /* @__PURE__ */ (0,
|
|
591
|
-
/* @__PURE__ */ (0,
|
|
592
|
-
/* @__PURE__ */ (0,
|
|
728
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("section", { className: open ? Section_default.card : Section_default.card + " " + Section_default.cardFolded, children: [
|
|
729
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: Section_default.cardHead, children: [
|
|
730
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
593
731
|
"button",
|
|
594
732
|
{
|
|
595
733
|
type: "button",
|
|
@@ -600,20 +738,20 @@ function AccountsCard({ state, actions, writable, t, locale }) {
|
|
|
600
738
|
setOpen(!open);
|
|
601
739
|
},
|
|
602
740
|
children: [
|
|
603
|
-
/* @__PURE__ */ (0,
|
|
604
|
-
/* @__PURE__ */ (0,
|
|
605
|
-
total > 0 ? /* @__PURE__ */ (0,
|
|
606
|
-
/* @__PURE__ */ (0,
|
|
741
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: Section_default.cardTitle, children: t("accountsTitle") }),
|
|
742
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: Section_default.cardSub, children: summary }),
|
|
743
|
+
total > 0 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_dsh_client_ui_primitives2.Tag, { tone: unreadable > 0 || ready < total ? "warning" : "success", children: t(unreadable > 0 ? "accountsAvailabilityFailed" : "accountsAvailability", { ready, total, failed: unreadable }) }) : null,
|
|
744
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ChevronDown, { className: open ? Section_default.chevronOpen : Section_default.chevron })
|
|
607
745
|
]
|
|
608
746
|
}
|
|
609
747
|
),
|
|
610
|
-
/* @__PURE__ */ (0,
|
|
611
|
-
updatedAt > 0 ? /* @__PURE__ */ (0,
|
|
748
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { className: Section_default.trailing, children: [
|
|
749
|
+
updatedAt > 0 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { className: Section_default.cardStamp, title: new Date(updatedAt).toLocaleString(locale), children: [
|
|
612
750
|
t("usageLastUpdated"),
|
|
613
751
|
" ",
|
|
614
752
|
stampText(updatedAt, locale)
|
|
615
753
|
] }) : null,
|
|
616
|
-
/* @__PURE__ */ (0,
|
|
754
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
617
755
|
import_dsh_client_ui_primitives2.Button,
|
|
618
756
|
{
|
|
619
757
|
variant: "outline",
|
|
@@ -625,24 +763,52 @@ function AccountsCard({ state, actions, writable, t, locale }) {
|
|
|
625
763
|
)
|
|
626
764
|
] })
|
|
627
765
|
] }),
|
|
628
|
-
open ? /* @__PURE__ */ (0,
|
|
629
|
-
state.blocked ? /* @__PURE__ */ (0,
|
|
630
|
-
state.failure ? /* @__PURE__ */ (0,
|
|
631
|
-
!total ? /* @__PURE__ */ (0,
|
|
632
|
-
/* @__PURE__ */ (0,
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
766
|
+
open ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { id: "opencode-go-accounts", className: Section_default.cardBody, children: [
|
|
767
|
+
state.blocked ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: Section_default.hint, children: t("accountsBlocked") }) : null,
|
|
768
|
+
state.failure ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: Section_default.failedNote, role: "alert", children: t(state.failure === "cleanup" ? "accountsCleanupFailed" : state.failure === "remove" ? "accountsRemoveKeyFailed" : state.failure === "read" ? "accountsReadFailed" : "accountsWriteFailed") }) : null,
|
|
769
|
+
!total ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: Section_default.hint, children: t("accountsEmpty") }) : null,
|
|
770
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
771
|
+
"div",
|
|
772
|
+
{
|
|
773
|
+
className: Section_default.accounts,
|
|
774
|
+
onDragEnter: (event) => {
|
|
775
|
+
if (reorderable && dragging !== null) event.preventDefault();
|
|
776
|
+
},
|
|
777
|
+
onDragOver: (event) => {
|
|
778
|
+
if (!reorderable || dragging === null) return;
|
|
779
|
+
event.preventDefault();
|
|
780
|
+
if (event.dataTransfer) event.dataTransfer.dropEffect = "move";
|
|
781
|
+
setDropAt(slotAt(event.currentTarget, event.clientY));
|
|
782
|
+
},
|
|
783
|
+
onDrop: (event) => {
|
|
784
|
+
const source = dragging;
|
|
785
|
+
setDragging(null);
|
|
786
|
+
setDropAt(null);
|
|
787
|
+
if (source === null) return;
|
|
788
|
+
event.preventDefault();
|
|
789
|
+
const from = state.entries.findIndex((entry) => entry.apiKeyEnv === source);
|
|
790
|
+
if (from < 0) return;
|
|
791
|
+
const slot = Number.isFinite(event.clientY) ? slotAt(event.currentTarget, event.clientY) : dropAt;
|
|
792
|
+
if (slot === null) return;
|
|
793
|
+
const to = slot > from ? slot - 1 : slot;
|
|
794
|
+
if (to !== from) move(source, to);
|
|
795
|
+
},
|
|
796
|
+
onDragEnd: () => {
|
|
797
|
+
setDragging(null);
|
|
798
|
+
setDropAt(null);
|
|
799
|
+
},
|
|
800
|
+
children: state.entries.map((account, index) => {
|
|
801
|
+
const label = account.name || t("accountDefault");
|
|
802
|
+
const rolling = account.usage?.rolling;
|
|
803
|
+
const expanded = details === account.apiKeyEnv;
|
|
804
|
+
const panelId = `opencode-go-account-${index}`;
|
|
805
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react2.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
641
806
|
"div",
|
|
642
807
|
{
|
|
643
808
|
className: Section_default.accountRow,
|
|
644
809
|
"data-account-row": account.apiKeyEnv,
|
|
645
810
|
"data-dragging": dragging === account.apiKeyEnv ? "true" : void 0,
|
|
811
|
+
"data-drop": markAt(index),
|
|
646
812
|
onDragStart: (event) => {
|
|
647
813
|
if (!reorderable || event.target?.closest?.("[data-account-handle]") == null) {
|
|
648
814
|
event.preventDefault();
|
|
@@ -657,30 +823,9 @@ function AccountsCard({ state, actions, writable, t, locale }) {
|
|
|
657
823
|
}
|
|
658
824
|
setDragging(account.apiKeyEnv);
|
|
659
825
|
},
|
|
660
|
-
onDragOver: (event) => {
|
|
661
|
-
if (!reorderable || dragging === null || dragging === account.apiKeyEnv) return;
|
|
662
|
-
event.preventDefault();
|
|
663
|
-
if (event.dataTransfer) event.dataTransfer.dropEffect = "move";
|
|
664
|
-
const box = event.currentTarget.getBoundingClientRect();
|
|
665
|
-
setDropAt(event.clientY < box.top + box.height / 2 ? index : index + 1);
|
|
666
|
-
},
|
|
667
|
-
onDrop: (event) => {
|
|
668
|
-
const source = dragging;
|
|
669
|
-
const slot = dropAt;
|
|
670
|
-
setDragging(null);
|
|
671
|
-
setDropAt(null);
|
|
672
|
-
if (source === null || slot === null) return;
|
|
673
|
-
event.preventDefault();
|
|
674
|
-
const from = state.entries.findIndex((entry) => entry.apiKeyEnv === source);
|
|
675
|
-
if (from >= 0) move(source, slot > from ? slot - 1 : slot);
|
|
676
|
-
},
|
|
677
|
-
onDragEnd: () => {
|
|
678
|
-
setDragging(null);
|
|
679
|
-
setDropAt(null);
|
|
680
|
-
},
|
|
681
826
|
children: [
|
|
682
|
-
/* @__PURE__ */ (0,
|
|
683
|
-
/* @__PURE__ */ (0,
|
|
827
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: Section_default.accountMain, "data-account-main": "", children: [
|
|
828
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
684
829
|
"button",
|
|
685
830
|
{
|
|
686
831
|
type: "button",
|
|
@@ -700,16 +845,16 @@ function AccountsCard({ state, actions, writable, t, locale }) {
|
|
|
700
845
|
move(account.apiKeyEnv, index + 1);
|
|
701
846
|
}
|
|
702
847
|
},
|
|
703
|
-
children: /* @__PURE__ */ (0,
|
|
848
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(GripIcon, {})
|
|
704
849
|
}
|
|
705
850
|
),
|
|
706
|
-
/* @__PURE__ */ (0,
|
|
707
|
-
/* @__PURE__ */ (0,
|
|
708
|
-
/* @__PURE__ */ (0,
|
|
851
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("strong", { className: Section_default.accountName, title: label, children: label }),
|
|
852
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { className: Section_default.accountState, children: [
|
|
853
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: Section_default.accountDot, "data-off": account.configured === false ? "true" : void 0 }),
|
|
709
854
|
account.configured === void 0 ? t(account.failed ? "accountsStatusUnknown" : "usageLoading") : account.configured ? t("keyConfigured") : t("keyMissing")
|
|
710
855
|
] }),
|
|
711
|
-
rolling ? /* @__PURE__ */ (0,
|
|
712
|
-
/* @__PURE__ */ (0,
|
|
856
|
+
rolling ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
|
|
857
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
713
858
|
"span",
|
|
714
859
|
{
|
|
715
860
|
className: Section_default.accountBar,
|
|
@@ -720,18 +865,18 @@ function AccountsCard({ state, actions, writable, t, locale }) {
|
|
|
720
865
|
"aria-valuenow": Math.min(100, rolling.percent),
|
|
721
866
|
"aria-label": `${label} ${t("usage_rolling")}`,
|
|
722
867
|
children: [
|
|
723
|
-
/* @__PURE__ */ (0,
|
|
724
|
-
TICKS.map((at) => /* @__PURE__ */ (0,
|
|
868
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: Section_default.accountBarFill, style: { width: `${Math.min(100, rolling.percent)}%` } }),
|
|
869
|
+
TICKS.map((at) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: Section_default.accountBarTick, style: { left: `${at}%` } }, at))
|
|
725
870
|
]
|
|
726
871
|
}
|
|
727
872
|
),
|
|
728
|
-
/* @__PURE__ */ (0,
|
|
873
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { className: Section_default.accountPercent, children: [
|
|
729
874
|
rolling.percent,
|
|
730
875
|
"%"
|
|
731
876
|
] }),
|
|
732
|
-
/* @__PURE__ */ (0,
|
|
733
|
-
] }) : /* @__PURE__ */ (0,
|
|
734
|
-
/* @__PURE__ */ (0,
|
|
877
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: Section_default.accountReset, children: resetText(rolling.resetsAt, t) })
|
|
878
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: Section_default.accountIdle, children: account.configured === false ? t("accountConfigureHint") : t(account.loading ? "usageLoading" : "usageUnavailable") }),
|
|
879
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
735
880
|
"button",
|
|
736
881
|
{
|
|
737
882
|
type: "button",
|
|
@@ -742,13 +887,13 @@ function AccountsCard({ state, actions, writable, t, locale }) {
|
|
|
742
887
|
onClick: () => {
|
|
743
888
|
setDetails(expanded ? null : account.apiKeyEnv);
|
|
744
889
|
},
|
|
745
|
-
children: /* @__PURE__ */ (0,
|
|
890
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ChevronDown, { className: expanded ? Section_default.chevronOpen : Section_default.chevron })
|
|
746
891
|
}
|
|
747
892
|
)
|
|
748
893
|
] }),
|
|
749
|
-
account.failed ? /* @__PURE__ */ (0,
|
|
750
|
-
/* @__PURE__ */ (0,
|
|
751
|
-
/* @__PURE__ */ (0,
|
|
894
|
+
account.failed ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: Section_default.accountProblems, role: "alert", children: [
|
|
895
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: Section_default.failedNote, children: account.problem ?? t(account.stale ? "usageStaleHint" : "usageRefreshFailed") }),
|
|
896
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
752
897
|
"button",
|
|
753
898
|
{
|
|
754
899
|
type: "button",
|
|
@@ -763,12 +908,11 @@ function AccountsCard({ state, actions, writable, t, locale }) {
|
|
|
763
908
|
editor?.ref === account.apiKeyEnv ? editorForm(label) : null
|
|
764
909
|
]
|
|
765
910
|
}
|
|
766
|
-
)
|
|
767
|
-
|
|
768
|
-
}
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
editor ? editor.kind === "add" ? editorForm() : null : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
911
|
+
) }, account.id);
|
|
912
|
+
})
|
|
913
|
+
}
|
|
914
|
+
),
|
|
915
|
+
editor ? editor.kind === "add" ? editorForm() : null : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
772
916
|
import_dsh_client_ui_primitives2.Button,
|
|
773
917
|
{
|
|
774
918
|
variant: "outline",
|
|
@@ -780,23 +924,24 @@ function AccountsCard({ state, actions, writable, t, locale }) {
|
|
|
780
924
|
children: t("accountAdd")
|
|
781
925
|
}
|
|
782
926
|
),
|
|
783
|
-
/* @__PURE__ */ (0,
|
|
784
|
-
/* @__PURE__ */ (0,
|
|
785
|
-
|
|
786
|
-
/* @__PURE__ */ (0,
|
|
787
|
-
import_dsh_client_ui_primitives2.Switch,
|
|
788
|
-
{
|
|
789
|
-
checked: state.autoSwitch,
|
|
790
|
-
disabled,
|
|
791
|
-
label: t("accountAutoSwitch"),
|
|
792
|
-
onChange: (next) => {
|
|
793
|
-
void actions.setAutoSwitch(next);
|
|
794
|
-
}
|
|
795
|
-
}
|
|
796
|
-
)
|
|
927
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: Section_default.field, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: Section_default.head, children: [
|
|
928
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { className: Section_default.label, children: [
|
|
929
|
+
t("accountAutoSwitch"),
|
|
930
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(HintMark, { hint: t("accountAutoSwitchHint") })
|
|
797
931
|
] }),
|
|
798
|
-
/* @__PURE__ */ (0,
|
|
799
|
-
|
|
932
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
933
|
+
import_dsh_client_ui_primitives2.Switch,
|
|
934
|
+
{
|
|
935
|
+
checked: state.autoSwitch,
|
|
936
|
+
disabled,
|
|
937
|
+
label: t("accountAutoSwitch"),
|
|
938
|
+
title: t("accountAutoSwitchHint"),
|
|
939
|
+
onChange: (next) => {
|
|
940
|
+
void actions.setAutoSwitch(next);
|
|
941
|
+
}
|
|
942
|
+
}
|
|
943
|
+
)
|
|
944
|
+
] }) })
|
|
800
945
|
] }) : null
|
|
801
946
|
] });
|
|
802
947
|
}
|
|
@@ -806,50 +951,82 @@ var USAGE_DISPLAY_MODES = ["auto", "always", "off"];
|
|
|
806
951
|
var DEFAULT_USAGE_DISPLAY = "auto";
|
|
807
952
|
|
|
808
953
|
// src/client/Section.tsx
|
|
809
|
-
var
|
|
810
|
-
var ChevronDown2 =
|
|
954
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
955
|
+
var ChevronDown2 = hostAtom(
|
|
956
|
+
primitives3,
|
|
957
|
+
"IconChevronDownOutlineRegular",
|
|
958
|
+
"IconChevronDownOutline14"
|
|
959
|
+
) ?? primitives3.IconChevronDownOutline14;
|
|
960
|
+
var ADVANCED_FIELDS = [
|
|
961
|
+
"usageDisplay",
|
|
962
|
+
"protocolOverrides",
|
|
963
|
+
"baseURL",
|
|
964
|
+
"proxyURL",
|
|
965
|
+
"refreshMinutes",
|
|
966
|
+
"streamIdleTimeoutMs",
|
|
967
|
+
"maxImages",
|
|
968
|
+
"maxRequestImageBytes",
|
|
969
|
+
"requestImagePixelBudget",
|
|
970
|
+
"requestImageMaxBytes"
|
|
971
|
+
];
|
|
811
972
|
function ValueField(props) {
|
|
812
973
|
const hintId = props.id + "-hint";
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
className: Section_default.reset,
|
|
823
|
-
disabled: props.disabled,
|
|
824
|
-
onClick: props.onReset,
|
|
825
|
-
children: props.resetLabel
|
|
826
|
-
}
|
|
827
|
-
)
|
|
828
|
-
] }) : null
|
|
974
|
+
const errorId = props.id + "-error";
|
|
975
|
+
const labelId = props.id + "-label";
|
|
976
|
+
const options = props.options;
|
|
977
|
+
const selected = options ? options.findIndex((option) => option.value === props.field.text) : -1;
|
|
978
|
+
const describedBy = props.field.invalid ? `${errorId} ${hintId}` : hintId;
|
|
979
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: Section_default.row, children: [
|
|
980
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: Section_default.rowLabel, children: [
|
|
981
|
+
options ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { id: labelId, className: Section_default.rowTitle, children: props.label }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("label", { htmlFor: props.id, className: Section_default.rowTitle, children: props.label }),
|
|
982
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(HintMark, { hint: props.hint })
|
|
829
983
|
] }),
|
|
830
|
-
|
|
831
|
-
"
|
|
984
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: Section_default.rowControl, children: options ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
985
|
+
"div",
|
|
832
986
|
{
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
"aria-
|
|
836
|
-
|
|
837
|
-
"
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
987
|
+
className: Section_default.seg,
|
|
988
|
+
role: "radiogroup",
|
|
989
|
+
"aria-labelledby": labelId,
|
|
990
|
+
"aria-describedby": describedBy,
|
|
991
|
+
"data-count": options.length,
|
|
992
|
+
"data-index": selected < 0 ? 0 : selected,
|
|
993
|
+
...props.field.invalid ? { "aria-invalid": true } : {},
|
|
994
|
+
onKeyDown: (event) => {
|
|
995
|
+
const step = event.key === "ArrowRight" || event.key === "ArrowDown" ? 1 : event.key === "ArrowLeft" || event.key === "ArrowUp" ? -1 : 0;
|
|
996
|
+
if (step === 0) return;
|
|
997
|
+
event.preventDefault();
|
|
998
|
+
const next = (Math.max(0, selected) + step + options.length) % options.length;
|
|
999
|
+
props.onEdit(options[next].value);
|
|
1000
|
+
event.currentTarget.querySelectorAll('[role="radio"]')[next]?.focus();
|
|
842
1001
|
},
|
|
843
|
-
children:
|
|
1002
|
+
children: [
|
|
1003
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: Section_default.segThumb, "aria-hidden": "true" }),
|
|
1004
|
+
options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1005
|
+
"button",
|
|
1006
|
+
{
|
|
1007
|
+
type: "button",
|
|
1008
|
+
role: "radio",
|
|
1009
|
+
"aria-checked": option.value === props.field.text,
|
|
1010
|
+
tabIndex: option.value === props.field.text ? 0 : -1,
|
|
1011
|
+
className: Section_default.segOption,
|
|
1012
|
+
disabled: props.disabled,
|
|
1013
|
+
onClick: () => {
|
|
1014
|
+
props.onEdit(option.value);
|
|
1015
|
+
},
|
|
1016
|
+
children: option.label
|
|
1017
|
+
},
|
|
1018
|
+
option.value
|
|
1019
|
+
))
|
|
1020
|
+
]
|
|
844
1021
|
}
|
|
845
|
-
) : /* @__PURE__ */ (0,
|
|
1022
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
846
1023
|
"input",
|
|
847
1024
|
{
|
|
848
1025
|
id: props.id,
|
|
849
1026
|
name: props.id,
|
|
850
1027
|
autoComplete: "off",
|
|
851
1028
|
placeholder: props.placeholder,
|
|
852
|
-
"aria-describedby":
|
|
1029
|
+
"aria-describedby": describedBy,
|
|
853
1030
|
className: props.field.invalid ? Section_default.inputInvalid : Section_default.input,
|
|
854
1031
|
type: props.numeric === true ? "number" : "text",
|
|
855
1032
|
...props.numeric === true ? { inputMode: "numeric" } : {},
|
|
@@ -860,8 +1037,9 @@ function ValueField(props) {
|
|
|
860
1037
|
props.onEdit(event.target.value);
|
|
861
1038
|
}
|
|
862
1039
|
}
|
|
863
|
-
),
|
|
864
|
-
/* @__PURE__ */ (0,
|
|
1040
|
+
) }),
|
|
1041
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(HintText, { id: hintId, hint: props.hint }),
|
|
1042
|
+
props.field.invalid ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { id: errorId, className: Section_default.rowInvalid, role: "alert", children: props.invalidLabel }) : null
|
|
865
1043
|
] });
|
|
866
1044
|
}
|
|
867
1045
|
function ModelsBody({ models, t, locale }) {
|
|
@@ -869,39 +1047,46 @@ function ModelsBody({ models, t, locale }) {
|
|
|
869
1047
|
const metadataOnlyFailure = sources?.metadata.error !== void 0 && sources.listing.error === void 0;
|
|
870
1048
|
const sourceStatus = sources ? ["listing", "metadata"].map((source) => {
|
|
871
1049
|
const status = sources[source];
|
|
872
|
-
return /* @__PURE__ */ (0,
|
|
1050
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("p", { className: Section_default.hint, children: [
|
|
873
1051
|
t(source === "listing" ? "modelsListingSource" : "modelsMetadataSource"),
|
|
874
1052
|
": ",
|
|
875
1053
|
" ",
|
|
876
1054
|
status.error ? t("modelsSourceFailed") : t("modelsSourceCurrent"),
|
|
877
1055
|
". ",
|
|
878
1056
|
" ",
|
|
879
|
-
status.updatedAt === void 0 ? t("modelsSourceNeverFetched") : t("modelsSourceUpdated", { time: new Date(status.updatedAt).toLocaleString(locale) })
|
|
1057
|
+
status.updatedAt === void 0 ? t("modelsSourceNeverFetched") : t("modelsSourceUpdated", { time: new Date(status.updatedAt).toLocaleString(locale) }),
|
|
1058
|
+
status.warning ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
|
|
1059
|
+
" ",
|
|
1060
|
+
status.warning
|
|
1061
|
+
] }) : null
|
|
880
1062
|
] }, source);
|
|
881
1063
|
}) : null;
|
|
882
1064
|
if (models.status === "failed") {
|
|
883
|
-
return /* @__PURE__ */ (0,
|
|
884
|
-
/* @__PURE__ */ (0,
|
|
885
|
-
models.message ? /* @__PURE__ */ (0,
|
|
1065
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
|
|
1066
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: Section_default.failedNote, role: "alert", children: t(metadataOnlyFailure ? "modelsMetadataFailed" : "modelsFailed") }),
|
|
1067
|
+
models.message ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: Section_default.hint, children: models.message }) : null,
|
|
886
1068
|
sourceStatus
|
|
887
1069
|
] });
|
|
888
1070
|
}
|
|
889
|
-
if (models.status !== "ready") return /* @__PURE__ */ (0,
|
|
890
|
-
const progress = models.refreshing ? /* @__PURE__ */ (0,
|
|
891
|
-
if (models.stale) return /* @__PURE__ */ (0,
|
|
1071
|
+
if (models.status !== "ready") return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: Section_default.hint, role: "status", "aria-live": "polite", children: t("modelsLoading") });
|
|
1072
|
+
const progress = models.refreshing ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: Section_default.hint, role: "status", children: t("modelsRefreshing") }) : null;
|
|
1073
|
+
if (models.stale) return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
|
|
892
1074
|
progress,
|
|
893
|
-
/* @__PURE__ */ (0,
|
|
894
|
-
models.message ? /* @__PURE__ */ (0,
|
|
1075
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: Section_default.failedNote, role: "alert", children: t(metadataOnlyFailure ? "modelsMetadataFailed" : "modelsStale") }),
|
|
1076
|
+
models.message ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: Section_default.hint, children: models.message }) : null,
|
|
895
1077
|
sourceStatus
|
|
896
1078
|
] });
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
1079
|
+
const warning = sources?.listing.warning ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: Section_default.failedNote, role: "alert", children: sources.listing.warning }) : null;
|
|
1080
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
|
|
1081
|
+
progress,
|
|
1082
|
+
warning,
|
|
1083
|
+
models.count === 0 ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: Section_default.hint, children: t("modelsEmpty") }) : null
|
|
1084
|
+
] });
|
|
900
1085
|
}
|
|
901
1086
|
function OpencodeGoSection(props) {
|
|
902
1087
|
const { useOpencodeGo, edit, resetField, save, discard, loadModels, setEnabled, setModelEnabled, t } = props;
|
|
903
1088
|
if (useOpencodeGo === void 0 || edit === void 0 || resetField === void 0 || save === void 0 || discard === void 0 || loadModels === void 0 || setEnabled === void 0 || setModelEnabled === void 0 || t === void 0) return null;
|
|
904
|
-
return /* @__PURE__ */ (0,
|
|
1089
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
905
1090
|
Loaded,
|
|
906
1091
|
{
|
|
907
1092
|
state: useOpencodeGo((snapshot) => snapshot),
|
|
@@ -918,6 +1103,7 @@ function OpencodeGoSection(props) {
|
|
|
918
1103
|
loadAccounts: props.loadAccounts,
|
|
919
1104
|
addAccount: props.addAccount,
|
|
920
1105
|
renameAccount: props.renameAccount,
|
|
1106
|
+
resetAddition: props.resetAddition,
|
|
921
1107
|
removeAccount: props.removeAccount,
|
|
922
1108
|
selectAccount: props.selectAccount,
|
|
923
1109
|
setAutoSwitch: props.setAutoSwitch,
|
|
@@ -931,18 +1117,19 @@ function Loaded(props) {
|
|
|
931
1117
|
const { t, state, loadModels } = props;
|
|
932
1118
|
const [advanced, setAdvanced] = (0, import_react3.useState)(false);
|
|
933
1119
|
const [modelsOpen, setModelsOpen] = (0, import_react3.useState)(false);
|
|
934
|
-
const modelNotices = /* @__PURE__ */ (0,
|
|
935
|
-
/* @__PURE__ */ (0,
|
|
936
|
-
state.pickerFailed ? /* @__PURE__ */ (0,
|
|
1120
|
+
const modelNotices = /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
|
|
1121
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ModelsBody, { models: state.models, t, locale: props.locale }),
|
|
1122
|
+
state.pickerFailed ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: Section_default.failedNote, role: "alert", children: t("pickerFailed") }) : null
|
|
937
1123
|
] });
|
|
938
1124
|
(0, import_react3.useEffect)(() => {
|
|
939
1125
|
if (state.available && state.models.status === "idle") loadModels();
|
|
940
1126
|
}, [state.available, state.models.status, loadModels]);
|
|
941
1127
|
if (!state.available) {
|
|
942
|
-
return /* @__PURE__ */ (0,
|
|
1128
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: Section_default.intro, children: t("unavailable") });
|
|
943
1129
|
}
|
|
944
1130
|
const disabled = !state.writable;
|
|
945
|
-
const
|
|
1131
|
+
const enabledHint = state.enabled ? t("enabledHint") : t("enabledOff");
|
|
1132
|
+
const accountCard = state.accounts && props.accountActions ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
946
1133
|
AccountsCard,
|
|
947
1134
|
{
|
|
948
1135
|
state: state.accounts,
|
|
@@ -954,43 +1141,44 @@ function Loaded(props) {
|
|
|
954
1141
|
) : null;
|
|
955
1142
|
const fieldProps = {
|
|
956
1143
|
invalidLabel: t("invalidValue"),
|
|
957
|
-
overriddenLabel: t("overridden"),
|
|
958
|
-
resetLabel: t("reset"),
|
|
959
1144
|
disabled
|
|
960
1145
|
};
|
|
961
|
-
const advancedOverridden = state.usageDisplay.overridden || state.
|
|
962
|
-
return /* @__PURE__ */ (0,
|
|
963
|
-
/* @__PURE__ */ (0,
|
|
964
|
-
/* @__PURE__ */ (0,
|
|
965
|
-
/* @__PURE__ */ (0,
|
|
966
|
-
/* @__PURE__ */ (0,
|
|
1146
|
+
const advancedOverridden = state.usageDisplay.overridden || state.protocolOverrides.overridden || state.baseURL.overridden || state.proxyURL.overridden || state.refreshMinutes.overridden || state.streamIdleTimeoutMs.overridden || state.maxImages.overridden || state.maxRequestImageBytes.overridden || state.requestImagePixelBudget.overridden || state.requestImageMaxBytes.overridden;
|
|
1147
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: Section_default.page, children: [
|
|
1148
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: Section_default.pageBody, children: [
|
|
1149
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: Section_default.pageTop, children: [
|
|
1150
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("h2", { className: Section_default.title, children: t("titleLabel") }),
|
|
1151
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: Section_default.intro, children: t("intro") })
|
|
967
1152
|
] }),
|
|
968
|
-
/* @__PURE__ */ (0,
|
|
969
|
-
/* @__PURE__ */ (0,
|
|
970
|
-
/* @__PURE__ */ (0,
|
|
971
|
-
|
|
1153
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("section", { className: Section_default.card, children: [
|
|
1154
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: Section_default.cardHead, children: [
|
|
1155
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("h3", { className: Section_default.cardTitle, children: [
|
|
1156
|
+
t("enabledLabel"),
|
|
1157
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(HintMark, { hint: enabledHint })
|
|
1158
|
+
] }),
|
|
1159
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
972
1160
|
import_dsh_client_ui_primitives3.Switch,
|
|
973
1161
|
{
|
|
974
1162
|
checked: state.enabled,
|
|
975
1163
|
label: t("enabledLabel"),
|
|
1164
|
+
title: enabledHint,
|
|
976
1165
|
disabled: disabled || state.saving || state.pickerSaving,
|
|
977
1166
|
onChange: props.setEnabled
|
|
978
1167
|
}
|
|
979
1168
|
)
|
|
980
1169
|
] }),
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
/* @__PURE__ */ (0,
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
/* @__PURE__ */ (0,
|
|
987
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M8.5 8h5.3M11.9 8v2.2M10.2 8v1.6" })
|
|
1170
|
+
accountCard ? null : /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
|
|
1171
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: Section_default.cardDivider }),
|
|
1172
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: Section_default.cardHead, children: [
|
|
1173
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: Section_default.slot, "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("svg", { viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", focusable: "false", children: [
|
|
1174
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("circle", { cx: "5.4", cy: "8", r: "3.1" }),
|
|
1175
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M8.5 8h5.3M11.9 8v2.2M10.2 8v1.6" })
|
|
988
1176
|
] }) }),
|
|
989
|
-
/* @__PURE__ */ (0,
|
|
990
|
-
/* @__PURE__ */ (0,
|
|
1177
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("label", { className: Section_default.label, htmlFor: "opencode-go-key", children: t("keyLabel") }),
|
|
1178
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: Section_default.trailing, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.Tag, { tone: state.apiKeyConfigured ? "success" : "warning", children: state.apiKeyConfigured ? t("keyConfigured") : t("keyMissing") }) })
|
|
991
1179
|
] }),
|
|
992
|
-
/* @__PURE__ */ (0,
|
|
993
|
-
/* @__PURE__ */ (0,
|
|
1180
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: Section_default.cardBody, children: [
|
|
1181
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
994
1182
|
"input",
|
|
995
1183
|
{
|
|
996
1184
|
id: "opencode-go-key",
|
|
@@ -1006,13 +1194,13 @@ function Loaded(props) {
|
|
|
1006
1194
|
}
|
|
1007
1195
|
}
|
|
1008
1196
|
),
|
|
1009
|
-
/* @__PURE__ */ (0,
|
|
1197
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { id: "opencode-go-key-hint", className: Section_default.hint, children: state.apiKeyWritable ? t("keyHint") : t("keyNotWritable") })
|
|
1010
1198
|
] })
|
|
1011
1199
|
] })
|
|
1012
1200
|
] }),
|
|
1013
1201
|
accountCard,
|
|
1014
|
-
/* @__PURE__ */ (0,
|
|
1015
|
-
/* @__PURE__ */ (0,
|
|
1202
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("section", { className: modelsOpen ? Section_default.cardModels : Section_default.cardModels + " " + Section_default.cardFolded, children: [
|
|
1203
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
1016
1204
|
"button",
|
|
1017
1205
|
{
|
|
1018
1206
|
type: "button",
|
|
@@ -1023,14 +1211,14 @@ function Loaded(props) {
|
|
|
1023
1211
|
setModelsOpen(!modelsOpen);
|
|
1024
1212
|
},
|
|
1025
1213
|
children: [
|
|
1026
|
-
/* @__PURE__ */ (0,
|
|
1027
|
-
/* @__PURE__ */ (0,
|
|
1214
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: Section_default.cardTitle, children: t("modelsLabel") }),
|
|
1215
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ChevronDown2, { className: modelsOpen ? Section_default.chevronOpen : Section_default.chevron })
|
|
1028
1216
|
]
|
|
1029
1217
|
}
|
|
1030
1218
|
),
|
|
1031
|
-
modelsOpen ? /* @__PURE__ */ (0,
|
|
1219
|
+
modelsOpen ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { id: "opencode-go-models", className: Section_default.cardBody, children: [
|
|
1032
1220
|
modelNotices,
|
|
1033
|
-
/* @__PURE__ */ (0,
|
|
1221
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1034
1222
|
ModelEditor,
|
|
1035
1223
|
{
|
|
1036
1224
|
models: state.models,
|
|
@@ -1040,7 +1228,7 @@ function Loaded(props) {
|
|
|
1040
1228
|
disabled: disabled || state.saving,
|
|
1041
1229
|
modelVisibility: state.modelVisibility,
|
|
1042
1230
|
visibilitySaving: state.pickerSaving,
|
|
1043
|
-
filterAction: /* @__PURE__ */ (0,
|
|
1231
|
+
filterAction: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1044
1232
|
import_dsh_client_ui_primitives3.Button,
|
|
1045
1233
|
{
|
|
1046
1234
|
variant: "outline",
|
|
@@ -1056,10 +1244,10 @@ function Loaded(props) {
|
|
|
1056
1244
|
}
|
|
1057
1245
|
}
|
|
1058
1246
|
)
|
|
1059
|
-
] }) : /* @__PURE__ */ (0,
|
|
1247
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: Section_default.cardNotes, children: modelNotices })
|
|
1060
1248
|
] }),
|
|
1061
|
-
/* @__PURE__ */ (0,
|
|
1062
|
-
/* @__PURE__ */ (0,
|
|
1249
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("section", { className: Section_default.card, children: [
|
|
1250
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
1063
1251
|
"button",
|
|
1064
1252
|
{
|
|
1065
1253
|
type: "button",
|
|
@@ -1070,17 +1258,33 @@ function Loaded(props) {
|
|
|
1070
1258
|
setAdvanced(!advanced);
|
|
1071
1259
|
},
|
|
1072
1260
|
children: [
|
|
1073
|
-
/* @__PURE__ */ (0,
|
|
1074
|
-
/* @__PURE__ */ (0,
|
|
1075
|
-
|
|
1076
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ChevronDown2, { className: advanced ? Section_default.chevronOpen : Section_default.chevron })
|
|
1261
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: Section_default.cardTitle, children: t("advancedLabel") }),
|
|
1262
|
+
advancedOverridden ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.Tag, { tone: "neutral", children: t("overridden") }) : null,
|
|
1263
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ChevronDown2, { className: advanced ? Section_default.chevronOpen : Section_default.chevron })
|
|
1077
1264
|
]
|
|
1078
1265
|
}
|
|
1079
1266
|
),
|
|
1080
|
-
advanced ? /* @__PURE__ */ (0,
|
|
1081
|
-
/* @__PURE__ */ (0,
|
|
1082
|
-
|
|
1083
|
-
/* @__PURE__ */ (0,
|
|
1267
|
+
advanced ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { id: "opencode-go-advanced", className: Section_default.cardBody, children: [
|
|
1268
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: Section_default.advancedHead, children: [
|
|
1269
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: Section_default.hint, children: t("advancedHint") }),
|
|
1270
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1271
|
+
"button",
|
|
1272
|
+
{
|
|
1273
|
+
type: "button",
|
|
1274
|
+
className: Section_default.reset,
|
|
1275
|
+
disabled: disabled || !advancedOverridden,
|
|
1276
|
+
onClick: () => {
|
|
1277
|
+
for (const field of ADVANCED_FIELDS) {
|
|
1278
|
+
if (state[field].overridden) props.resetField(field);
|
|
1279
|
+
}
|
|
1280
|
+
},
|
|
1281
|
+
children: t("advancedResetAll")
|
|
1282
|
+
}
|
|
1283
|
+
)
|
|
1284
|
+
] }),
|
|
1285
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: Section_default.rows, children: [
|
|
1286
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: Section_default.groupHead, children: t("groupUsageProtocol") }),
|
|
1287
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1084
1288
|
ValueField,
|
|
1085
1289
|
{
|
|
1086
1290
|
id: "opencode-go-usage-display",
|
|
@@ -1091,29 +1295,28 @@ function Loaded(props) {
|
|
|
1091
1295
|
...fieldProps,
|
|
1092
1296
|
onEdit: (text) => {
|
|
1093
1297
|
props.edit("usageDisplay", text);
|
|
1094
|
-
},
|
|
1095
|
-
onReset: () => {
|
|
1096
|
-
props.resetField("usageDisplay");
|
|
1097
1298
|
}
|
|
1098
1299
|
}
|
|
1099
1300
|
),
|
|
1100
|
-
/* @__PURE__ */ (0,
|
|
1301
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1101
1302
|
ValueField,
|
|
1102
1303
|
{
|
|
1103
|
-
id: "opencode-go-
|
|
1104
|
-
label: t("
|
|
1105
|
-
hint: t("
|
|
1106
|
-
field: state.
|
|
1304
|
+
id: "opencode-go-protocol-overrides",
|
|
1305
|
+
label: t("protocolOverridesLabel"),
|
|
1306
|
+
hint: t("protocolOverridesHint"),
|
|
1307
|
+
field: state.protocolOverrides,
|
|
1308
|
+
options: [
|
|
1309
|
+
{ value: "auto", label: t("protocolOverridesAuto") },
|
|
1310
|
+
{ value: "openai-responses", label: t("protocolOverridesResponses") }
|
|
1311
|
+
],
|
|
1107
1312
|
...fieldProps,
|
|
1108
1313
|
onEdit: (text) => {
|
|
1109
|
-
props.edit("
|
|
1110
|
-
},
|
|
1111
|
-
onReset: () => {
|
|
1112
|
-
props.resetField("apiKeyEnv");
|
|
1314
|
+
props.edit("protocolOverrides", text);
|
|
1113
1315
|
}
|
|
1114
1316
|
}
|
|
1115
1317
|
),
|
|
1116
|
-
/* @__PURE__ */ (0,
|
|
1318
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: Section_default.groupHead, children: t("groupConnection") }),
|
|
1319
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1117
1320
|
ValueField,
|
|
1118
1321
|
{
|
|
1119
1322
|
id: "opencode-go-base-url",
|
|
@@ -1123,13 +1326,10 @@ function Loaded(props) {
|
|
|
1123
1326
|
...fieldProps,
|
|
1124
1327
|
onEdit: (text) => {
|
|
1125
1328
|
props.edit("baseURL", text);
|
|
1126
|
-
},
|
|
1127
|
-
onReset: () => {
|
|
1128
|
-
props.resetField("baseURL");
|
|
1129
1329
|
}
|
|
1130
1330
|
}
|
|
1131
1331
|
),
|
|
1132
|
-
/* @__PURE__ */ (0,
|
|
1332
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1133
1333
|
ValueField,
|
|
1134
1334
|
{
|
|
1135
1335
|
id: "opencode-go-proxy-url",
|
|
@@ -1141,13 +1341,11 @@ function Loaded(props) {
|
|
|
1141
1341
|
invalidLabel: t("proxyURLInvalid"),
|
|
1142
1342
|
onEdit: (text) => {
|
|
1143
1343
|
props.edit("proxyURL", text);
|
|
1144
|
-
},
|
|
1145
|
-
onReset: () => {
|
|
1146
|
-
props.resetField("proxyURL");
|
|
1147
1344
|
}
|
|
1148
1345
|
}
|
|
1149
1346
|
),
|
|
1150
|
-
/* @__PURE__ */ (0,
|
|
1347
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: Section_default.groupHead, children: t("groupCacheTimeouts") }),
|
|
1348
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1151
1349
|
ValueField,
|
|
1152
1350
|
{
|
|
1153
1351
|
id: "opencode-go-refresh-minutes",
|
|
@@ -1158,13 +1356,10 @@ function Loaded(props) {
|
|
|
1158
1356
|
...fieldProps,
|
|
1159
1357
|
onEdit: (text) => {
|
|
1160
1358
|
props.edit("refreshMinutes", text);
|
|
1161
|
-
},
|
|
1162
|
-
onReset: () => {
|
|
1163
|
-
props.resetField("refreshMinutes");
|
|
1164
1359
|
}
|
|
1165
1360
|
}
|
|
1166
1361
|
),
|
|
1167
|
-
/* @__PURE__ */ (0,
|
|
1362
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1168
1363
|
ValueField,
|
|
1169
1364
|
{
|
|
1170
1365
|
id: "opencode-go-stream-idle",
|
|
@@ -1175,13 +1370,11 @@ function Loaded(props) {
|
|
|
1175
1370
|
...fieldProps,
|
|
1176
1371
|
onEdit: (text) => {
|
|
1177
1372
|
props.edit("streamIdleTimeoutMs", text);
|
|
1178
|
-
},
|
|
1179
|
-
onReset: () => {
|
|
1180
|
-
props.resetField("streamIdleTimeoutMs");
|
|
1181
1373
|
}
|
|
1182
1374
|
}
|
|
1183
1375
|
),
|
|
1184
|
-
/* @__PURE__ */ (0,
|
|
1376
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: Section_default.groupHead, children: t("groupImages") }),
|
|
1377
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1185
1378
|
ValueField,
|
|
1186
1379
|
{
|
|
1187
1380
|
id: "opencode-go-max-images",
|
|
@@ -1192,13 +1385,10 @@ function Loaded(props) {
|
|
|
1192
1385
|
...fieldProps,
|
|
1193
1386
|
onEdit: (text) => {
|
|
1194
1387
|
props.edit("maxImages", text);
|
|
1195
|
-
},
|
|
1196
|
-
onReset: () => {
|
|
1197
|
-
props.resetField("maxImages");
|
|
1198
1388
|
}
|
|
1199
1389
|
}
|
|
1200
1390
|
),
|
|
1201
|
-
/* @__PURE__ */ (0,
|
|
1391
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1202
1392
|
ValueField,
|
|
1203
1393
|
{
|
|
1204
1394
|
id: "opencode-go-max-request-image-bytes",
|
|
@@ -1209,13 +1399,10 @@ function Loaded(props) {
|
|
|
1209
1399
|
...fieldProps,
|
|
1210
1400
|
onEdit: (text) => {
|
|
1211
1401
|
props.edit("maxRequestImageBytes", text);
|
|
1212
|
-
},
|
|
1213
|
-
onReset: () => {
|
|
1214
|
-
props.resetField("maxRequestImageBytes");
|
|
1215
1402
|
}
|
|
1216
1403
|
}
|
|
1217
1404
|
),
|
|
1218
|
-
/* @__PURE__ */ (0,
|
|
1405
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1219
1406
|
ValueField,
|
|
1220
1407
|
{
|
|
1221
1408
|
id: "opencode-go-image-pixel-budget",
|
|
@@ -1226,13 +1413,10 @@ function Loaded(props) {
|
|
|
1226
1413
|
...fieldProps,
|
|
1227
1414
|
onEdit: (text) => {
|
|
1228
1415
|
props.edit("requestImagePixelBudget", text);
|
|
1229
|
-
},
|
|
1230
|
-
onReset: () => {
|
|
1231
|
-
props.resetField("requestImagePixelBudget");
|
|
1232
1416
|
}
|
|
1233
1417
|
}
|
|
1234
1418
|
),
|
|
1235
|
-
/* @__PURE__ */ (0,
|
|
1419
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1236
1420
|
ValueField,
|
|
1237
1421
|
{
|
|
1238
1422
|
id: "opencode-go-image-max-bytes",
|
|
@@ -1243,21 +1427,18 @@ function Loaded(props) {
|
|
|
1243
1427
|
...fieldProps,
|
|
1244
1428
|
onEdit: (text) => {
|
|
1245
1429
|
props.edit("requestImageMaxBytes", text);
|
|
1246
|
-
},
|
|
1247
|
-
onReset: () => {
|
|
1248
|
-
props.resetField("requestImageMaxBytes");
|
|
1249
1430
|
}
|
|
1250
1431
|
}
|
|
1251
1432
|
)
|
|
1252
1433
|
] })
|
|
1253
1434
|
] }) : null
|
|
1254
1435
|
] }),
|
|
1255
|
-
disabled ? /* @__PURE__ */ (0,
|
|
1436
|
+
disabled ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: Section_default.hint, children: t("readOnly") }) : null
|
|
1256
1437
|
] }),
|
|
1257
|
-
/* @__PURE__ */ (0,
|
|
1258
|
-
/* @__PURE__ */ (0,
|
|
1259
|
-
/* @__PURE__ */ (0,
|
|
1260
|
-
/* @__PURE__ */ (0,
|
|
1438
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: Section_default.actions, children: [
|
|
1439
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.Button, { variant: "primary", size: "md", disabled: disabled || !state.dirty || state.invalid || state.saving || state.pickerSaving, onClick: props.save, children: state.saving ? t("saving") : t("save") }),
|
|
1440
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.Button, { variant: "outline", size: "md", disabled: disabled || !state.dirty || state.saving, onClick: props.discard, children: t("discard") }),
|
|
1441
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
1261
1442
|
"a",
|
|
1262
1443
|
{
|
|
1263
1444
|
className: Section_default.starLink,
|
|
@@ -1266,12 +1447,12 @@ function Loaded(props) {
|
|
|
1266
1447
|
rel: "noopener noreferrer",
|
|
1267
1448
|
title: t("starProjectTitle"),
|
|
1268
1449
|
children: [
|
|
1269
|
-
/* @__PURE__ */ (0,
|
|
1270
|
-
/* @__PURE__ */ (0,
|
|
1450
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("svg", { viewBox: "0 0 24 24", width: "18", height: "18", fill: "currentColor", "aria-hidden": "true", focusable: "false", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12" }) }),
|
|
1451
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: t("starProject") })
|
|
1271
1452
|
]
|
|
1272
1453
|
}
|
|
1273
1454
|
),
|
|
1274
|
-
state.failed ? /* @__PURE__ */ (0,
|
|
1455
|
+
state.failed ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: Section_default.failedNote, children: t("savedFailed") }) : null
|
|
1275
1456
|
] })
|
|
1276
1457
|
] });
|
|
1277
1458
|
}
|
|
@@ -1279,6 +1460,17 @@ function Loaded(props) {
|
|
|
1279
1460
|
// src/provider-identity.ts
|
|
1280
1461
|
var PROVIDER_ID = "dsh-opencode-go";
|
|
1281
1462
|
|
|
1463
|
+
// src/config-contract.ts
|
|
1464
|
+
var SETTINGS_NAMESPACE = "llm-opencode-go";
|
|
1465
|
+
var PROFILE_ENTRY_ID = "opencode-go";
|
|
1466
|
+
|
|
1467
|
+
// src/settings-bridge.ts
|
|
1468
|
+
function settingsWriteResult(verdict, committed) {
|
|
1469
|
+
if (verdict === true) return "applied";
|
|
1470
|
+
if (verdict === false) return "rejected";
|
|
1471
|
+
return committed() ? "applied" : "unknown";
|
|
1472
|
+
}
|
|
1473
|
+
|
|
1282
1474
|
// src/proxy-url.ts
|
|
1283
1475
|
function assertProxyURL(raw) {
|
|
1284
1476
|
const value = raw?.trim() ?? "";
|
|
@@ -1304,19 +1496,33 @@ function assertProxyURL(raw) {
|
|
|
1304
1496
|
return url.href;
|
|
1305
1497
|
}
|
|
1306
1498
|
|
|
1499
|
+
// src/protocol-contract.ts
|
|
1500
|
+
var RESPONSES_OVERRIDE_MODEL = "deepseek-v4.1-flash";
|
|
1501
|
+
|
|
1502
|
+
// src/account-operations.ts
|
|
1503
|
+
function visibleAccountsOf(settings) {
|
|
1504
|
+
const entries = [...accountsOf(settings)];
|
|
1505
|
+
for (const operation of settings.accountOperations ?? []) {
|
|
1506
|
+
if (!entries.some((account) => account.apiKeyEnv === operation.account.apiKeyEnv)) entries.push(operation.account);
|
|
1507
|
+
}
|
|
1508
|
+
return entries;
|
|
1509
|
+
}
|
|
1510
|
+
|
|
1307
1511
|
// src/client/accounts-controller.ts
|
|
1308
|
-
function
|
|
1309
|
-
|
|
1310
|
-
const { name, code, message } = error;
|
|
1311
|
-
return /conflict/i.test(`${String(name ?? "")} ${String(code ?? "")} ${String(message ?? "")}`);
|
|
1512
|
+
function operationId() {
|
|
1513
|
+
return Array.from(crypto.getRandomValues(new Uint8Array(16)), (byte) => byte.toString(16).padStart(2, "0")).join("");
|
|
1312
1514
|
}
|
|
1313
1515
|
var GoAccountsController = class {
|
|
1314
|
-
constructor(scope, ctx, readUsage, publish, blocked) {
|
|
1516
|
+
constructor(scope, ctx, readUsage, publish, blocked, execute = async (command) => {
|
|
1517
|
+
const response = await ctx.remote.opencodeGoAccounts.execute(command);
|
|
1518
|
+
return response.ok ? response.value : "unknown";
|
|
1519
|
+
}) {
|
|
1315
1520
|
this.scope = scope;
|
|
1316
1521
|
this.ctx = ctx;
|
|
1317
1522
|
this.readUsage = readUsage;
|
|
1318
1523
|
this.publish = publish;
|
|
1319
1524
|
this.blocked = blocked;
|
|
1525
|
+
this.execute = execute;
|
|
1320
1526
|
this.sync();
|
|
1321
1527
|
}
|
|
1322
1528
|
rows = /* @__PURE__ */ new Map();
|
|
@@ -1327,10 +1533,11 @@ var GoAccountsController = class {
|
|
|
1327
1533
|
identity = "";
|
|
1328
1534
|
loaded = false;
|
|
1329
1535
|
disposed = false;
|
|
1536
|
+
addition;
|
|
1330
1537
|
snapshot() {
|
|
1331
1538
|
const config = this.scope.getSnapshot().value ?? {};
|
|
1332
1539
|
return {
|
|
1333
|
-
entries:
|
|
1540
|
+
entries: visibleAccountsOf(config).map((account) => ({ ...this.rows.get(account.apiKeyEnv), ...account })),
|
|
1334
1541
|
activeRef: accountRefOf(config),
|
|
1335
1542
|
autoSwitch: config.autoSwitch === true,
|
|
1336
1543
|
busy: this.busy,
|
|
@@ -1342,7 +1549,7 @@ var GoAccountsController = class {
|
|
|
1342
1549
|
sync() {
|
|
1343
1550
|
const config = this.scope.getSnapshot().value ?? {};
|
|
1344
1551
|
const identity = JSON.stringify([
|
|
1345
|
-
|
|
1552
|
+
visibleAccountsOf(config).map((account) => [account.id, account.apiKeyEnv]).sort((left, right) => left[1] < right[1] ? -1 : left[1] > right[1] ? 1 : 0),
|
|
1346
1553
|
config.baseURL,
|
|
1347
1554
|
config.proxyURL
|
|
1348
1555
|
]);
|
|
@@ -1358,7 +1565,7 @@ var GoAccountsController = class {
|
|
|
1358
1565
|
this.epoch++;
|
|
1359
1566
|
}
|
|
1360
1567
|
invalidate(ref) {
|
|
1361
|
-
if (!
|
|
1568
|
+
if (!visibleAccountsOf(this.scope.getSnapshot().value ?? {}).some((account) => account.apiKeyEnv === ref)) return;
|
|
1362
1569
|
this.epoch++;
|
|
1363
1570
|
this.rows.delete(ref);
|
|
1364
1571
|
if (this.loaded) void this.refresh();
|
|
@@ -1366,7 +1573,7 @@ var GoAccountsController = class {
|
|
|
1366
1573
|
async refresh() {
|
|
1367
1574
|
this.loaded = true;
|
|
1368
1575
|
const epoch = ++this.epoch;
|
|
1369
|
-
const accounts = [...
|
|
1576
|
+
const accounts = [...visibleAccountsOf(this.scope.getSnapshot().value ?? {})];
|
|
1370
1577
|
this.refreshing = true;
|
|
1371
1578
|
this.publish();
|
|
1372
1579
|
try {
|
|
@@ -1434,155 +1641,38 @@ var GoAccountsController = class {
|
|
|
1434
1641
|
this.publish();
|
|
1435
1642
|
}
|
|
1436
1643
|
actions() {
|
|
1644
|
+
const command = (request) => this.execute(request).then((status) => status === "applied");
|
|
1437
1645
|
return {
|
|
1438
1646
|
loadAccounts: () => {
|
|
1439
1647
|
void this.refresh();
|
|
1440
1648
|
},
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1649
|
+
resetAddition: () => {
|
|
1650
|
+
this.addition = void 0;
|
|
1651
|
+
},
|
|
1652
|
+
addAccount: (name, key) => this.run(async () => {
|
|
1653
|
+
if (!name.trim() || name.trim().length > 80 || !key.trim()) return false;
|
|
1654
|
+
if (this.addition?.name !== name.trim()) this.addition = { name: name.trim(), id: operationId() };
|
|
1655
|
+
const accepted = await command({ kind: "add", id: this.addition.id, name, key });
|
|
1656
|
+
if (accepted) this.addition = void 0;
|
|
1657
|
+
return accepted;
|
|
1658
|
+
}),
|
|
1659
|
+
renameAccount: (ref, name) => this.run(() => command({ kind: "rename", ref, name })),
|
|
1660
|
+
removeAccount: (ref) => this.run(async () => {
|
|
1661
|
+
const accepted = await command({ kind: "remove", ref });
|
|
1662
|
+
if (!accepted) this.failure = "remove";
|
|
1663
|
+
return accepted;
|
|
1448
1664
|
}),
|
|
1665
|
+
selectAccount: (ref) => this.run(() => command({ kind: "select", ref })),
|
|
1666
|
+
setAutoSwitch: (value) => this.run(() => command({ kind: "auto-switch", value })),
|
|
1449
1667
|
replaceAccountKey: (ref, key) => this.run(async () => {
|
|
1450
|
-
if (!key.trim() ||
|
|
1451
|
-
const
|
|
1452
|
-
if (
|
|
1453
|
-
|
|
1454
|
-
return true;
|
|
1668
|
+
if (!key.trim() || this.rows.get(ref)?.writable === false) return false;
|
|
1669
|
+
const accepted = await command({ kind: "replace-key", ref, key });
|
|
1670
|
+
if (accepted) this.invalidate(ref);
|
|
1671
|
+
return accepted;
|
|
1455
1672
|
}, false),
|
|
1456
|
-
moveAccount: (ref, toIndex) => this.move
|
|
1673
|
+
moveAccount: (ref, toIndex) => this.run(() => command({ kind: "move", ref, toIndex }))
|
|
1457
1674
|
};
|
|
1458
1675
|
}
|
|
1459
|
-
/**
|
|
1460
|
-
* Reorder the visible accounts and keep the preferred reference on the first row.
|
|
1461
|
-
* The adapter tries the preferred reference first and the rest in array order, so
|
|
1462
|
-
* one write is what makes top-to-bottom the real call order. A placeholder row the
|
|
1463
|
-
* settings never stored is materialized here, which its `legacy:` id admits.
|
|
1464
|
-
*/
|
|
1465
|
-
move(ref, toIndex) {
|
|
1466
|
-
return this.run(async () => {
|
|
1467
|
-
const snapshot = this.scope.getSnapshot();
|
|
1468
|
-
const entries = [...accountsOf(snapshot.value ?? {})];
|
|
1469
|
-
const from = entries.findIndex((account) => account.apiKeyEnv === ref);
|
|
1470
|
-
if (from < 0 || !Number.isInteger(toIndex) || toIndex < 0 || toIndex >= entries.length || toIndex === from) return false;
|
|
1471
|
-
const [moved] = entries.splice(from, 1);
|
|
1472
|
-
entries.splice(toIndex, 0, moved);
|
|
1473
|
-
await this.mutate([
|
|
1474
|
-
{ op: "set", path: ["accounts"], value: entries },
|
|
1475
|
-
{ op: "set", path: ["apiKeyEnv"], value: entries[0].apiKeyEnv }
|
|
1476
|
-
], snapshot.revision);
|
|
1477
|
-
const after = this.scope.getSnapshot().value;
|
|
1478
|
-
return after?.apiKeyEnv === entries[0].apiKeyEnv && after.accounts?.[toIndex]?.apiKeyEnv === ref;
|
|
1479
|
-
});
|
|
1480
|
-
}
|
|
1481
|
-
account(ref) {
|
|
1482
|
-
return accountsOf(this.scope.getSnapshot().value ?? {}).find((account) => account.apiKeyEnv === ref);
|
|
1483
|
-
}
|
|
1484
|
-
async mutate(ops, revision = this.scope.getSnapshot().revision) {
|
|
1485
|
-
await this.scope.mutate(ops, revision);
|
|
1486
|
-
}
|
|
1487
|
-
add(name, key) {
|
|
1488
|
-
return this.run(async () => {
|
|
1489
|
-
if (!name.trim() || name.trim().length > 80 || !key.trim()) return false;
|
|
1490
|
-
const id3 = Array.from(crypto.getRandomValues(new Uint8Array(16)), (byte) => byte.toString(16).padStart(2, "0")).join("");
|
|
1491
|
-
const ref = ACCOUNT_REF_PREFIX + id3.replaceAll("-", "").toUpperCase();
|
|
1492
|
-
const account = { id: id3, name: name.trim(), apiKeyEnv: ref };
|
|
1493
|
-
const response = await this.ctx.remote.credentials.set(ref, key.trim());
|
|
1494
|
-
if (!response.ok) return false;
|
|
1495
|
-
for (let attempt = 0; attempt < 3; attempt++) {
|
|
1496
|
-
const snapshot = this.scope.getSnapshot();
|
|
1497
|
-
const existing = accountsOf(snapshot.value ?? {});
|
|
1498
|
-
if (existing.some((entry) => entry.id === id3)) return true;
|
|
1499
|
-
const configured = await this.configuredOf(existing.map((entry) => entry.apiKeyEnv));
|
|
1500
|
-
const accounts = existing.filter((entry) => !(snapshot.value?.accounts == null && !entry.name && configured.get(entry.apiKeyEnv) === false));
|
|
1501
|
-
if (accounts.length >= MAX_ACCOUNTS) break;
|
|
1502
|
-
const first = existing.length === 0 || existing.every((entry) => configured.get(entry.apiKeyEnv) === false);
|
|
1503
|
-
try {
|
|
1504
|
-
await this.mutate([
|
|
1505
|
-
{ op: "set", path: ["accounts"], value: [...accounts, account] },
|
|
1506
|
-
...first ? [{ op: "set", path: ["apiKeyEnv"], value: ref }] : []
|
|
1507
|
-
], snapshot.revision);
|
|
1508
|
-
} catch (error) {
|
|
1509
|
-
if (attempt < 2 && isSettingsConflict(error)) continue;
|
|
1510
|
-
return false;
|
|
1511
|
-
}
|
|
1512
|
-
if (this.scope.getSnapshot().value?.accounts?.some((entry) => entry.id === id3)) return true;
|
|
1513
|
-
break;
|
|
1514
|
-
}
|
|
1515
|
-
try {
|
|
1516
|
-
if (!(await this.ctx.remote.credentials.unset(ref)).ok) this.failure = "cleanup";
|
|
1517
|
-
} catch {
|
|
1518
|
-
this.failure = "cleanup";
|
|
1519
|
-
}
|
|
1520
|
-
return false;
|
|
1521
|
-
});
|
|
1522
|
-
}
|
|
1523
|
-
/** Loaded rows answer from cache; anything they do not know is described on
|
|
1524
|
-
* the spot, so a placeholder decision never races the page's first describe. */
|
|
1525
|
-
async configuredOf(refs) {
|
|
1526
|
-
const configured = /* @__PURE__ */ new Map();
|
|
1527
|
-
const unknown = refs.filter((ref) => {
|
|
1528
|
-
const known = this.rows.get(ref)?.configured;
|
|
1529
|
-
if (known === void 0) return true;
|
|
1530
|
-
configured.set(ref, known);
|
|
1531
|
-
return false;
|
|
1532
|
-
});
|
|
1533
|
-
if (unknown.length === 0) return configured;
|
|
1534
|
-
try {
|
|
1535
|
-
const described = await this.ctx.remote.credentials.describe(unknown);
|
|
1536
|
-
if (described.ok) for (const ref of unknown) configured.set(ref, described.value[ref]?.configured ?? false);
|
|
1537
|
-
} catch {
|
|
1538
|
-
}
|
|
1539
|
-
return configured;
|
|
1540
|
-
}
|
|
1541
|
-
rename(ref, name) {
|
|
1542
|
-
return this.run(async () => {
|
|
1543
|
-
if (!this.account(ref) || !name.trim() || name.trim().length > 80) return false;
|
|
1544
|
-
const accounts = accountsOf(this.scope.getSnapshot().value ?? {}).map((account) => account.apiKeyEnv === ref ? { ...account, name: name.trim() } : account);
|
|
1545
|
-
await this.mutate([{ op: "set", path: ["accounts"], value: accounts }]);
|
|
1546
|
-
return this.scope.getSnapshot().value?.accounts?.find((account) => account.apiKeyEnv === ref)?.name === name.trim();
|
|
1547
|
-
});
|
|
1548
|
-
}
|
|
1549
|
-
select(ref) {
|
|
1550
|
-
return this.run(async () => {
|
|
1551
|
-
if (!this.account(ref)) return false;
|
|
1552
|
-
await this.mutate([{ op: "set", path: ["apiKeyEnv"], value: ref }]);
|
|
1553
|
-
return accountRefOf(this.scope.getSnapshot().value ?? {}) === ref;
|
|
1554
|
-
});
|
|
1555
|
-
}
|
|
1556
|
-
remove(ref) {
|
|
1557
|
-
return this.run(async () => {
|
|
1558
|
-
if (!this.account(ref)) return false;
|
|
1559
|
-
if (ref.startsWith(ACCOUNT_REF_PREFIX)) {
|
|
1560
|
-
const described = await this.ctx.remote.credentials.describe([ref]).catch(() => void 0);
|
|
1561
|
-
if (!described?.ok || described.value[ref] === void 0) {
|
|
1562
|
-
this.failure = "remove";
|
|
1563
|
-
return false;
|
|
1564
|
-
}
|
|
1565
|
-
if (described.value[ref].configured === true) {
|
|
1566
|
-
let removed = false;
|
|
1567
|
-
try {
|
|
1568
|
-
removed = (await this.ctx.remote.credentials.unset(ref)).ok;
|
|
1569
|
-
} catch {
|
|
1570
|
-
}
|
|
1571
|
-
if (!removed) {
|
|
1572
|
-
this.failure = "remove";
|
|
1573
|
-
return false;
|
|
1574
|
-
}
|
|
1575
|
-
}
|
|
1576
|
-
}
|
|
1577
|
-
const config = this.scope.getSnapshot().value ?? {};
|
|
1578
|
-
const remaining = accountsOf(config).filter((account) => account.apiKeyEnv !== ref);
|
|
1579
|
-
await this.mutate([
|
|
1580
|
-
{ op: "set", path: ["accounts"], value: remaining },
|
|
1581
|
-
...accountRefOf(config) === ref && remaining.length ? [{ op: "set", path: ["apiKeyEnv"], value: remaining[0].apiKeyEnv }] : []
|
|
1582
|
-
]);
|
|
1583
|
-
return !this.account(ref);
|
|
1584
|
-
});
|
|
1585
|
-
}
|
|
1586
1676
|
async run(action, requiresSettings = true) {
|
|
1587
1677
|
if (this.busy || this.blocked() || requiresSettings && !this.scope.getSnapshot().writable) return false;
|
|
1588
1678
|
this.busy = true;
|
|
@@ -1701,7 +1791,7 @@ var StagedForm = class {
|
|
|
1701
1791
|
available: snapshot.status === "ready",
|
|
1702
1792
|
writable: snapshot.writable,
|
|
1703
1793
|
dirty: plan.length > 0,
|
|
1704
|
-
invalid: plan.some((item) => item.run === void 0),
|
|
1794
|
+
invalid: plan.some((item) => item.run === void 0 && item.write === void 0),
|
|
1705
1795
|
saving: this.saving,
|
|
1706
1796
|
failed: this.failed
|
|
1707
1797
|
};
|
|
@@ -1762,20 +1852,34 @@ var StagedForm = class {
|
|
|
1762
1852
|
*/
|
|
1763
1853
|
async save() {
|
|
1764
1854
|
const plan = this.plan();
|
|
1765
|
-
|
|
1766
|
-
|
|
1855
|
+
if (plan.length === 0 || this.saving || plan.some((item) => !item.write && !item.run)) return;
|
|
1856
|
+
const revision = this.snapshotOf().revision;
|
|
1767
1857
|
this.saving = true;
|
|
1768
1858
|
this.failed = false;
|
|
1769
1859
|
this.publish();
|
|
1770
1860
|
let landed = true;
|
|
1771
|
-
|
|
1861
|
+
const settings = plan.filter((item) => item.write !== void 0);
|
|
1862
|
+
const accept = (item) => {
|
|
1863
|
+
if (this.staged.get(item.field) === item.edit) this.staged.delete(item.field);
|
|
1864
|
+
};
|
|
1865
|
+
if (settings.length > 0) {
|
|
1866
|
+
const ops = settings.map(({ field, write }) => write.kind === "clear" ? { op: "unset", path: [field] } : { op: "set", path: [field], value: write.value });
|
|
1772
1867
|
try {
|
|
1773
|
-
|
|
1868
|
+
const accepted = await this.scope.mutate(ops, revision);
|
|
1869
|
+
landed = settingsWriteResult(accepted, () => settings.every((item) => item.write.kind === "clear" ? !this.stored(item.field) : sameJsonValue(this.userLayer()?.[item.field], item.write.value))) === "applied";
|
|
1870
|
+
if (landed) settings.forEach(accept);
|
|
1871
|
+
} catch {
|
|
1872
|
+
landed = false;
|
|
1873
|
+
}
|
|
1874
|
+
}
|
|
1875
|
+
if (landed) for (const item of plan.filter((item2) => item2.run !== void 0)) {
|
|
1876
|
+
try {
|
|
1877
|
+
if (await item.run()) accept(item);
|
|
1878
|
+
else landed = false;
|
|
1774
1879
|
} catch {
|
|
1775
1880
|
landed = false;
|
|
1776
1881
|
}
|
|
1777
1882
|
}
|
|
1778
|
-
if (landed) this.staged.clear();
|
|
1779
1883
|
this.saving = false;
|
|
1780
1884
|
this.failed = !landed;
|
|
1781
1885
|
this.publish();
|
|
@@ -1792,30 +1896,20 @@ var StagedForm = class {
|
|
|
1792
1896
|
const secret = this.secretSpecs.get(field);
|
|
1793
1897
|
if (secret !== void 0) {
|
|
1794
1898
|
const value = staged.text.trim();
|
|
1795
|
-
if (value !== "") plan.push({ field, run: () => secret.write(value) });
|
|
1899
|
+
if (value !== "") plan.push({ field, edit: staged, run: () => secret.write(value) });
|
|
1796
1900
|
continue;
|
|
1797
1901
|
}
|
|
1798
1902
|
const spec = this.spec(field);
|
|
1799
1903
|
if (staged.clear) {
|
|
1800
|
-
if (this.stored(field)) plan.push({ field,
|
|
1904
|
+
if (this.stored(field)) plan.push({ field, edit: staged, write: { kind: "clear" }, run: void 0 });
|
|
1801
1905
|
continue;
|
|
1802
1906
|
}
|
|
1803
1907
|
if (this.unchangedDraft(field, staged)) continue;
|
|
1804
1908
|
const write = spec.parse(staged.text);
|
|
1805
|
-
|
|
1806
|
-
else if (write.kind === "clear") plan.push({ field, run: () => this.clear(field) });
|
|
1807
|
-
else plan.push({ field, run: () => this.store(field, write.value) });
|
|
1909
|
+
plan.push({ field, edit: staged, write, run: void 0 });
|
|
1808
1910
|
}
|
|
1809
1911
|
return plan;
|
|
1810
1912
|
}
|
|
1811
|
-
async clear(field) {
|
|
1812
|
-
await this.scope.unset(field);
|
|
1813
|
-
return !this.stored(field);
|
|
1814
|
-
}
|
|
1815
|
-
async store(field, value) {
|
|
1816
|
-
await this.scope.set(field, value);
|
|
1817
|
-
return sameJsonValue(this.userLayer()?.[field], value);
|
|
1818
|
-
}
|
|
1819
1913
|
stage(field, edit) {
|
|
1820
1914
|
this.staged.set(field, edit);
|
|
1821
1915
|
this.failed = false;
|
|
@@ -1871,8 +1965,7 @@ function sameJsonValue(left, right) {
|
|
|
1871
1965
|
}
|
|
1872
1966
|
|
|
1873
1967
|
// src/client/section-controller.ts
|
|
1874
|
-
var OPENCODE_GO_NS =
|
|
1875
|
-
var DEFAULT_API_KEY_REF = "OPENCODE_API_KEY";
|
|
1968
|
+
var OPENCODE_GO_NS = SETTINGS_NAMESPACE;
|
|
1876
1969
|
var API_KEY_FIELD = "apiKey";
|
|
1877
1970
|
var OpencodeGoSectionController = class {
|
|
1878
1971
|
/**
|
|
@@ -1887,10 +1980,14 @@ var OpencodeGoSectionController = class {
|
|
|
1887
1980
|
const result = await ctx.remote.opencodeGoUsage.readAccount(ref);
|
|
1888
1981
|
if (!result.ok) throw result.error;
|
|
1889
1982
|
return result.value;
|
|
1983
|
+
}, executeAccountCommand = async (command) => {
|
|
1984
|
+
const result = await ctx.remote.opencodeGoAccounts.execute(command);
|
|
1985
|
+
return result.ok ? result.value : "unknown";
|
|
1890
1986
|
}) {
|
|
1891
1987
|
this.scope = scope;
|
|
1892
1988
|
this.ctx = ctx;
|
|
1893
1989
|
this.readModels = readModels;
|
|
1990
|
+
this.executeAccountCommand = executeAccountCommand;
|
|
1894
1991
|
this.form = new StagedForm(
|
|
1895
1992
|
scope,
|
|
1896
1993
|
[
|
|
@@ -1902,7 +1999,11 @@ var OpencodeGoSectionController = class {
|
|
|
1902
1999
|
format: (value) => typeof value === "string" ? value : DEFAULT_USAGE_DISPLAY,
|
|
1903
2000
|
parse: (text) => USAGE_DISPLAY_MODES.some((mode) => mode === text) ? { kind: "set", value: text } : void 0
|
|
1904
2001
|
},
|
|
1905
|
-
|
|
2002
|
+
{
|
|
2003
|
+
field: "protocolOverrides",
|
|
2004
|
+
format: (value) => value?.[RESPONSES_OVERRIDE_MODEL] ?? "auto",
|
|
2005
|
+
parse: (text) => text === "auto" || text === "openai-responses" ? { kind: "set", value: { [RESPONSES_OVERRIDE_MODEL]: text === "auto" ? null : text } } : void 0
|
|
2006
|
+
},
|
|
1906
2007
|
textField("baseURL"),
|
|
1907
2008
|
{
|
|
1908
2009
|
...textField("proxyURL"),
|
|
@@ -1934,7 +2035,8 @@ var OpencodeGoSectionController = class {
|
|
|
1934
2035
|
() => {
|
|
1935
2036
|
this.store.set(this.projection());
|
|
1936
2037
|
},
|
|
1937
|
-
() => this.form.shell().saving || this.pickerSaving || Boolean(this.form.field(API_KEY_FIELD).text.trim())
|
|
2038
|
+
() => this.form.shell().saving || this.pickerSaving || Boolean(this.form.field(API_KEY_FIELD).text.trim()),
|
|
2039
|
+
this.executeAccountCommand
|
|
1938
2040
|
);
|
|
1939
2041
|
this.store.set(this.projection());
|
|
1940
2042
|
const networkIdentity = () => JSON.stringify([
|
|
@@ -1983,10 +2085,10 @@ var OpencodeGoSectionController = class {
|
|
|
1983
2085
|
accounts: this.accounts?.snapshot(),
|
|
1984
2086
|
enabled: this.enabled(),
|
|
1985
2087
|
usageDisplay: this.form.field("usageDisplay"),
|
|
2088
|
+
protocolOverrides: this.form.field("protocolOverrides"),
|
|
1986
2089
|
modelVisibility: this.scope.getSnapshot().value?.modelVisibility ?? {},
|
|
1987
2090
|
pickerSaving: this.pickerSaving,
|
|
1988
2091
|
pickerFailed: this.pickerFailed,
|
|
1989
|
-
apiKeyEnv: this.form.field("apiKeyEnv"),
|
|
1990
2092
|
baseURL: this.form.field("baseURL"),
|
|
1991
2093
|
proxyURL: this.form.field("proxyURL"),
|
|
1992
2094
|
refreshMinutes: this.form.field("refreshMinutes"),
|
|
@@ -2058,8 +2160,8 @@ var OpencodeGoSectionController = class {
|
|
|
2058
2160
|
this.pickerFailed = false;
|
|
2059
2161
|
this.store.set(this.projection());
|
|
2060
2162
|
try {
|
|
2061
|
-
await this.scope.set(field, value);
|
|
2062
|
-
this.pickerFailed =
|
|
2163
|
+
const verdict = await this.scope.set(field, value);
|
|
2164
|
+
this.pickerFailed = settingsWriteResult(verdict, accepted) !== "applied";
|
|
2063
2165
|
} catch {
|
|
2064
2166
|
this.pickerFailed = true;
|
|
2065
2167
|
} finally {
|
|
@@ -2195,17 +2297,16 @@ var OpencodeGoSectionController = class {
|
|
|
2195
2297
|
return this.face;
|
|
2196
2298
|
}
|
|
2197
2299
|
/**
|
|
2198
|
-
*
|
|
2300
|
+
* Ask the account service to write the staged key, then refresh its display.
|
|
2199
2301
|
* @param value - the staged credential literal.
|
|
2200
|
-
* @returns whether the Host
|
|
2302
|
+
* @returns whether the Host confirmed the write.
|
|
2201
2303
|
*/
|
|
2202
2304
|
async writeKey(value) {
|
|
2203
2305
|
const ref = this.keyDraftRef ?? refOf(this.scope.getSnapshot());
|
|
2204
|
-
|
|
2205
|
-
if (!response.ok) return false;
|
|
2306
|
+
if (await this.executeAccountCommand({ kind: "replace-key", ref, key: value }) !== "applied") return false;
|
|
2206
2307
|
this.accounts?.invalidate(ref);
|
|
2207
2308
|
await this.readCredential();
|
|
2208
|
-
return
|
|
2309
|
+
return true;
|
|
2209
2310
|
}
|
|
2210
2311
|
};
|
|
2211
2312
|
function modelLimitsOf(value) {
|
|
@@ -2221,19 +2322,22 @@ function modelLimitsOf(value) {
|
|
|
2221
2322
|
const limit = {};
|
|
2222
2323
|
if (fields.contextWindow === null) limit.contextWindow = null;
|
|
2223
2324
|
if (fields.maxTokens === null) limit.maxTokens = null;
|
|
2325
|
+
if (fields.thinkingBudgets === null) limit.thinkingBudgets = null;
|
|
2326
|
+
if (Array.isArray(fields.thinkingBudgets) && fields.thinkingBudgets.length <= 16 && fields.thinkingBudgets.every((value2) => typeof value2 === "number" && Number.isSafeInteger(value2) && value2 > 0)) {
|
|
2327
|
+
limit.thinkingBudgets = fields.thinkingBudgets;
|
|
2328
|
+
}
|
|
2224
2329
|
if (typeof fields.contextWindow === "number" && Number.isSafeInteger(fields.contextWindow) && fields.contextWindow > 0) {
|
|
2225
2330
|
limit.contextWindow = fields.contextWindow;
|
|
2226
2331
|
}
|
|
2227
2332
|
if (typeof fields.maxTokens === "number" && Number.isSafeInteger(fields.maxTokens) && fields.maxTokens > 0) {
|
|
2228
2333
|
limit.maxTokens = fields.maxTokens;
|
|
2229
2334
|
}
|
|
2230
|
-
if (limit.contextWindow !== void 0 || limit.maxTokens !== void 0) limits[id3] = limit;
|
|
2335
|
+
if (limit.contextWindow !== void 0 || limit.maxTokens !== void 0 || limit.thinkingBudgets !== void 0) limits[id3] = limit;
|
|
2231
2336
|
}
|
|
2232
2337
|
return limits;
|
|
2233
2338
|
}
|
|
2234
2339
|
function refOf(snapshot) {
|
|
2235
|
-
|
|
2236
|
-
return declared !== void 0 && declared.length > 0 ? declared : DEFAULT_API_KEY_REF;
|
|
2340
|
+
return accountRefOf(snapshot.value ?? {});
|
|
2237
2341
|
}
|
|
2238
2342
|
|
|
2239
2343
|
// src/client/locales.ts
|
|
@@ -2252,22 +2356,22 @@ var en = {
|
|
|
2252
2356
|
accountRename: "Rename",
|
|
2253
2357
|
accountReplaceKey: "Replace key",
|
|
2254
2358
|
accountRemove: "Remove account",
|
|
2255
|
-
accountRemoveHint: "Remove \u201C{name}\u201D? If it is
|
|
2359
|
+
accountRemoveHint: "Remove \u201C{name}\u201D? If it is the current account, the next account takes over. Keys added here are deleted from the credential service; existing external references are kept.",
|
|
2256
2360
|
accountName: "Account name",
|
|
2257
2361
|
accountKeyHint: "The key is saved through the host credential service and is never returned to this page.",
|
|
2258
2362
|
accountConfirm: "Confirm",
|
|
2259
2363
|
accountCancel: "Cancel",
|
|
2260
2364
|
accountAutoSwitch: "Automatic fallback",
|
|
2261
|
-
accountAutoSwitchHint: "
|
|
2262
|
-
accountPreferredTag: "
|
|
2365
|
+
accountAutoSwitchHint: "When a quota runs out or a key is unusable, the other accounts are tried in order; the account that starts producing output moves to the first position and becomes current.",
|
|
2366
|
+
accountPreferredTag: "Current",
|
|
2263
2367
|
accountSwitchAction: "Switch",
|
|
2264
2368
|
accountSwitchTitle: "Switch account",
|
|
2265
2369
|
accountSwitchBack: "Back to usage",
|
|
2266
|
-
accountSwitchHint: "
|
|
2370
|
+
accountSwitchHint: "This account moves to the first position and serves later requests in this profile. The other accounts keep their relative order.",
|
|
2267
2371
|
accountSwitchFailed: "Could not switch account. Please retry.",
|
|
2268
|
-
accountFallbackQuota: "The
|
|
2269
|
-
accountFallbackCredential: "The
|
|
2270
|
-
accountsSummary: "{count} accounts \xB7
|
|
2372
|
+
accountFallbackQuota: "The current account reached its quota; switched to",
|
|
2373
|
+
accountFallbackCredential: "The current key was unavailable or rejected; switched to",
|
|
2374
|
+
accountsSummary: "{count} accounts \xB7 Current {name}",
|
|
2271
2375
|
accountsSummaryEmpty: "No accounts yet",
|
|
2272
2376
|
accountsAvailability: "{ready}/{total} configured",
|
|
2273
2377
|
accountsAvailabilityFailed: "{ready}/{total} configured \xB7 {failed} unreadable",
|
|
@@ -2304,8 +2408,8 @@ var en = {
|
|
|
2304
2408
|
starProject: "Enjoying the plugin? Star it on GitHub",
|
|
2305
2409
|
starProjectTitle: "Open the GitHub project in a new tab",
|
|
2306
2410
|
enabledLabel: "Enable OpenCode Go",
|
|
2307
|
-
enabledHint: "While
|
|
2308
|
-
enabledOff: "OpenCode Go is off
|
|
2411
|
+
enabledHint: "While on, it appears in every model picker and can serve requests; turning it off withdraws it immediately and this page stays reachable.",
|
|
2412
|
+
enabledOff: "OpenCode Go is off: its models are withdrawn from every picker and no request reaches the gateway.",
|
|
2309
2413
|
enabledUnavailable: "This deployment pins the switch on in its composition, so it cannot be changed here.",
|
|
2310
2414
|
keyLabel: "API key",
|
|
2311
2415
|
keyHint: "From your OpenCode Go subscription (opencode.ai). Leaving this blank keeps the key already saved, and a saved key applies to the next request without a restart.",
|
|
@@ -2334,6 +2438,11 @@ var en = {
|
|
|
2334
2438
|
limitsModel: "Model",
|
|
2335
2439
|
limitsContext: "Context window",
|
|
2336
2440
|
limitsOutput: "Max output",
|
|
2441
|
+
thinkingBudgets: "Thinking budgets",
|
|
2442
|
+
thinkingBudgetsHint: "Add token budgets to the conversation picker, then Save. Range: {min}\u2013{max} tokens. Existing reasoning choices stay available; Default uses the service settings. The SDK may reduce a budget to leave room for the answer.",
|
|
2443
|
+
thinkingBudgetAddLabel: "New thinking budget for {name}",
|
|
2444
|
+
thinkingBudgetAdd: "Add",
|
|
2445
|
+
thinkingBudgetRemove: "Remove {value} token budget",
|
|
2337
2446
|
capacityDefault: "Default: {value} tokens",
|
|
2338
2447
|
capacityMissing: "API did not provide a value",
|
|
2339
2448
|
modalityLabel: "Input modalities",
|
|
@@ -2369,33 +2478,39 @@ var en = {
|
|
|
2369
2478
|
limitsEmpty: "Read the model list first; capacities are edited per model the gateway serves.",
|
|
2370
2479
|
limitsContextLabel: "Context window for {name}",
|
|
2371
2480
|
limitsOutputLabel: "Max output for {name}",
|
|
2372
|
-
|
|
2481
|
+
advancedResetAll: "Reset all to defaults",
|
|
2373
2482
|
advancedLabel: "Advanced settings",
|
|
2374
|
-
|
|
2483
|
+
groupUsageProtocol: "Usage and protocol",
|
|
2484
|
+
groupConnection: "Connection",
|
|
2485
|
+
groupCacheTimeouts: "Cache and timeouts",
|
|
2486
|
+
groupImages: "Image handling",
|
|
2487
|
+
advancedHint: "The inherited values work as they are; below are only the settings you may need to change.",
|
|
2375
2488
|
usageDisplayLabel: "Usage display",
|
|
2376
|
-
usageDisplayHint: "Auto shows
|
|
2489
|
+
usageDisplayHint: "Auto shows it only for DSH OpenCode Go models; Always keeps it visible with any model; Off hides it and stops polling. While visible it refreshes every minute.",
|
|
2377
2490
|
usageDisplay_auto: "Auto (default)",
|
|
2378
2491
|
usageDisplay_always: "Always",
|
|
2379
2492
|
usageDisplay_off: "Off",
|
|
2380
|
-
|
|
2381
|
-
|
|
2493
|
+
protocolOverridesLabel: "DeepSeek V4.1 Flash protocol",
|
|
2494
|
+
protocolOverridesHint: "Auto follows the model catalog; Responses is experimental and applies only to DeepSeek V4.1 Flash. Save to apply to new requests.",
|
|
2495
|
+
protocolOverridesAuto: "Auto (default)",
|
|
2496
|
+
protocolOverridesResponses: "Responses (experimental)",
|
|
2382
2497
|
baseURLLabel: "Gateway URL",
|
|
2383
|
-
baseURLHint: "The endpoint that serves requests and the live model
|
|
2498
|
+
baseURLHint: "The endpoint that serves model requests and the live model listing.",
|
|
2384
2499
|
proxyURLLabel: "Proxy address",
|
|
2385
|
-
proxyURLHint: "HTTP(S) or SOCKS5 proxy for conversations,
|
|
2500
|
+
proxyURLHint: "The HTTP(S) or SOCKS5 proxy for conversations, catalog refreshes and usage queries; leave empty for the default network.",
|
|
2386
2501
|
proxyURLInvalid: "Enter an http://, https:// or socks5:// proxy address without a path, query or fragment.",
|
|
2387
2502
|
refreshMinutesLabel: "Catalog refresh (minutes)",
|
|
2388
|
-
refreshMinutesHint: "
|
|
2503
|
+
refreshMinutesHint: "How long the model catalog is cached; opening this page or refreshing re-checks it immediately.",
|
|
2389
2504
|
streamIdleTimeoutMsLabel: "Stream idle timeout (ms)",
|
|
2390
|
-
streamIdleTimeoutMsHint: "
|
|
2505
|
+
streamIdleTimeoutMsHint: "The longest silence between stream events; a longer gap fails the request.",
|
|
2391
2506
|
maxImagesLabel: "Request image count cap (maxImages)",
|
|
2392
|
-
maxImagesHint: "
|
|
2507
|
+
maxImagesHint: "Leave empty to inherit the base configuration (uncapped only when the base sets none); above the cap the oldest images become text placeholders.",
|
|
2393
2508
|
maxRequestImageBytesLabel: "Request image payload cap (bytes)",
|
|
2394
|
-
maxRequestImageBytesHint: "
|
|
2509
|
+
maxRequestImageBytesHint: "The cap on the accumulated base64 image payload in one request.",
|
|
2395
2510
|
requestImagePixelBudgetLabel: "Image pixel budget",
|
|
2396
|
-
requestImagePixelBudgetHint: "
|
|
2511
|
+
requestImagePixelBudgetHint: "The total pixel budget of one image after conversion.",
|
|
2397
2512
|
requestImageMaxBytesLabel: "Image byte target (bytes)",
|
|
2398
|
-
requestImageMaxBytesHint: "
|
|
2513
|
+
requestImageMaxBytesHint: "The original byte target of one image before base64 expansion.",
|
|
2399
2514
|
overridden: "Customized",
|
|
2400
2515
|
reset: "Reset to default",
|
|
2401
2516
|
invalidValue: "Not a valid value",
|
|
@@ -2421,22 +2536,22 @@ var zh = {
|
|
|
2421
2536
|
accountRename: "\u91CD\u547D\u540D",
|
|
2422
2537
|
accountReplaceKey: "\u66FF\u6362 Key",
|
|
2423
2538
|
accountRemove: "\u5220\u9664\u8D26\u53F7",
|
|
2424
|
-
accountRemoveHint: "\u5220\u9664\u201C{name}\u201D\uFF1F\u82E5\u5B83\u662F\u5F53\u524D\
|
|
2539
|
+
accountRemoveHint: "\u5220\u9664\u201C{name}\u201D\uFF1F\u82E5\u5B83\u662F\u5F53\u524D\u8D26\u53F7\uFF0C\u5C06\u4F7F\u7528\u4E0B\u4E00\u4E2A\u8D26\u53F7\u3002\u5728\u8FD9\u91CC\u6DFB\u52A0\u7684 Key \u4F1A\u4ECE\u51ED\u636E\u670D\u52A1\u5220\u9664\uFF1B\u5DF2\u6709\u5916\u90E8\u5F15\u7528\u4F1A\u4FDD\u7559\u3002",
|
|
2425
2540
|
accountName: "\u8D26\u53F7\u540D\u79F0",
|
|
2426
2541
|
accountKeyHint: "Key \u901A\u8FC7\u5BBF\u4E3B\u51ED\u636E\u670D\u52A1\u4FDD\u5B58\uFF0C\u9875\u9762\u4E0D\u4F1A\u56DE\u663E\u5DF2\u4FDD\u5B58\u7684\u5BC6\u94A5\u3002",
|
|
2427
2542
|
accountConfirm: "\u786E\u8BA4",
|
|
2428
2543
|
accountCancel: "\u53D6\u6D88",
|
|
2429
2544
|
accountAutoSwitch: "\u81EA\u52A8\u4F7F\u7528\u5907\u7528\u8D26\u53F7",
|
|
2430
|
-
accountAutoSwitchHint: "\
|
|
2431
|
-
accountPreferredTag: "\
|
|
2545
|
+
accountAutoSwitchHint: "\u989D\u5EA6\u8017\u5C3D\u6216 Key \u4E0D\u53EF\u7528\u65F6\uFF0C\u6309\u987A\u5E8F\u5C1D\u8BD5\u5176\u4ED6\u8D26\u53F7\uFF1B\u5F00\u59CB\u6B63\u5E38\u8F93\u51FA\u7684\u8D26\u53F7\u4F1A\u79FB\u81F3\u9996\u4F4D\u5E76\u6210\u4E3A\u5F53\u524D\u8D26\u53F7\u3002",
|
|
2546
|
+
accountPreferredTag: "\u5F53\u524D\u8D26\u53F7",
|
|
2432
2547
|
accountSwitchAction: "\u5207\u6362",
|
|
2433
2548
|
accountSwitchTitle: "\u5207\u6362\u8D26\u53F7",
|
|
2434
2549
|
accountSwitchBack: "\u8FD4\u56DE\u989D\u5EA6",
|
|
2435
|
-
accountSwitchHint: "\u5207\u6362\u540E\uFF0C\u672C profile \u7684\u540E\u7EED\u8BF7\u6C42\u4F7F\u7528\
|
|
2550
|
+
accountSwitchHint: "\u5207\u6362\u540E\uFF0C\u8BE5\u8D26\u53F7\u79FB\u81F3\u9996\u4F4D\uFF0C\u4F9B\u672C profile \u7684\u540E\u7EED\u8BF7\u6C42\u4F7F\u7528\uFF1B\u5176\u4ED6\u8D26\u53F7\u7684\u76F8\u5BF9\u987A\u5E8F\u4FDD\u6301\u4E0D\u53D8\u3002",
|
|
2436
2551
|
accountSwitchFailed: "\u8D26\u53F7\u5207\u6362\u672A\u751F\u6548\uFF0C\u8BF7\u91CD\u8BD5\u3002",
|
|
2437
|
-
accountFallbackQuota: "\
|
|
2438
|
-
accountFallbackCredential: "\
|
|
2439
|
-
accountsSummary: "{count} \u4E2A \xB7 \
|
|
2552
|
+
accountFallbackQuota: "\u5F53\u524D\u8D26\u53F7\u989D\u5EA6\u8017\u5C3D\uFF0C\u5DF2\u81EA\u52A8\u5207\u6362\u4E3A\uFF1A",
|
|
2553
|
+
accountFallbackCredential: "\u5F53\u524D Key \u4E0D\u53EF\u7528\u6216\u88AB\u62D2\u7EDD\uFF0C\u5DF2\u81EA\u52A8\u5207\u6362\u4E3A\uFF1A",
|
|
2554
|
+
accountsSummary: "{count} \u4E2A \xB7 \u5F53\u524D {name}",
|
|
2440
2555
|
accountsSummaryEmpty: "\u5C1A\u672A\u6DFB\u52A0\u8D26\u53F7",
|
|
2441
2556
|
accountsAvailability: "{ready}/{total} \u5DF2\u914D\u7F6E",
|
|
2442
2557
|
accountsAvailabilityFailed: "{ready}/{total} \u5DF2\u914D\u7F6E \xB7 {failed} \u4E2A\u8BFB\u53D6\u5931\u8D25",
|
|
@@ -2473,8 +2588,8 @@ var zh = {
|
|
|
2473
2588
|
starProject: "\u559C\u6B22\u8FD9\u4E2A\u63D2\u4EF6\uFF1F\u53BB GitHub \u70B9\u4E2A Star",
|
|
2474
2589
|
starProjectTitle: "\u5728\u65B0\u6807\u7B7E\u9875\u6253\u5F00 GitHub \u9879\u76EE",
|
|
2475
2590
|
enabledLabel: "\u542F\u7528 OpenCode Go",
|
|
2476
|
-
enabledHint: "\u5F00\u542F\
|
|
2477
|
-
enabledOff: "OpenCode Go \u5DF2\u5173\u95ED\
|
|
2591
|
+
enabledHint: "\u5F00\u542F\u540E\u51FA\u73B0\u5728\u6240\u6709\u6A21\u578B\u9009\u62E9\u5668\u4E2D\u5E76\u53EF\u5904\u7406\u8BF7\u6C42\uFF1B\u5173\u95ED\u7ACB\u5373\u64A4\u4E0B\uFF0C\u672C\u9875\u4ECD\u53EF\u8BBF\u95EE\u3002",
|
|
2592
|
+
enabledOff: "OpenCode Go \u5DF2\u5173\u95ED\uFF1A\u6A21\u578B\u5DF2\u4ECE\u6240\u6709\u9009\u62E9\u5668\u64A4\u4E0B\uFF0C\u4E5F\u6CA1\u6709\u8BF7\u6C42\u53D1\u5F80\u7F51\u5173\u3002",
|
|
2478
2593
|
enabledUnavailable: "\u6B64\u90E8\u7F72\u5728\u7EC4\u5408\u5C42\u56FA\u5B9A\u5F00\u542F\u4E86\u8BE5\u5F00\u5173\uFF0C\u65E0\u6CD5\u5728\u6B64\u4FEE\u6539\u3002",
|
|
2479
2594
|
keyLabel: "API key",
|
|
2480
2595
|
keyHint: "\u6765\u81EA\u4F60\u7684 OpenCode Go \u8BA2\u9605\uFF08opencode.ai\uFF09\u3002\u7559\u7A7A\u8868\u793A\u4FDD\u6301\u5DF2\u4FDD\u5B58\u7684 key\uFF1B\u4FDD\u5B58\u540E\u4E0B\u4E00\u6B21\u8BF7\u6C42\u5373\u751F\u6548\uFF0C\u65E0\u9700\u91CD\u542F\u3002",
|
|
@@ -2503,6 +2618,11 @@ var zh = {
|
|
|
2503
2618
|
limitsModel: "\u6A21\u578B",
|
|
2504
2619
|
limitsContext: "\u4E0A\u4E0B\u6587\u7A97\u53E3",
|
|
2505
2620
|
limitsOutput: "\u6700\u5927\u8F93\u51FA",
|
|
2621
|
+
thinkingBudgets: "\u601D\u8003\u9884\u7B97",
|
|
2622
|
+
thinkingBudgetsHint: "\u6DFB\u52A0 token \u9884\u7B97\u5E76\u4FDD\u5B58\uFF0C\u5373\u53EF\u5728\u4F1A\u8BDD\u4E2D\u9009\u62E9\u3002\u8303\u56F4\uFF1A{min}\u2013{max} tokens\u3002\u4FDD\u7559\u539F\u6709\u601D\u8003\u9009\u9879\uFF1B\u201C\u9ED8\u8BA4\u201D\u4F7F\u7528\u670D\u52A1\u5546\u8BBE\u7F6E\u3002SDK \u4F1A\u6309\u5269\u4F59\u8F93\u51FA\u7A7A\u95F4\u7F29\u5C0F\u9884\u7B97\uFF0C\u4E3A\u56DE\u7B54\u7559\u51FA\u7A7A\u95F4\u3002",
|
|
2623
|
+
thinkingBudgetAddLabel: "\u4E3A {name} \u6DFB\u52A0\u601D\u8003\u9884\u7B97",
|
|
2624
|
+
thinkingBudgetAdd: "\u6DFB\u52A0",
|
|
2625
|
+
thinkingBudgetRemove: "\u79FB\u9664 {value} token \u9884\u7B97",
|
|
2506
2626
|
capacityDefault: "\u9ED8\u8BA4\uFF1A{value} tokens",
|
|
2507
2627
|
capacityMissing: "API \u672A\u63D0\u4F9B",
|
|
2508
2628
|
modalityLabel: "\u8F93\u5165\u6A21\u6001",
|
|
@@ -2538,33 +2658,39 @@ var zh = {
|
|
|
2538
2658
|
limitsEmpty: "\u8BF7\u5148\u8BFB\u53D6\u6A21\u578B\u5217\u8868\uFF1B\u5BB9\u91CF\u6309\u7F51\u5173\u63D0\u4F9B\u7684\u6A21\u578B\u9010\u4E2A\u7F16\u8F91\u3002",
|
|
2539
2659
|
limitsContextLabel: "{name} \u7684\u4E0A\u4E0B\u6587\u7A97\u53E3",
|
|
2540
2660
|
limitsOutputLabel: "{name} \u7684\u6700\u5927\u8F93\u51FA",
|
|
2541
|
-
|
|
2661
|
+
advancedResetAll: "\u5168\u90E8\u6062\u590D\u9ED8\u8BA4",
|
|
2542
2662
|
advancedLabel: "\u9AD8\u7EA7\u8BBE\u7F6E",
|
|
2543
|
-
|
|
2663
|
+
groupUsageProtocol: "\u7528\u91CF\u4E0E\u534F\u8BAE",
|
|
2664
|
+
groupConnection: "\u8FDE\u63A5",
|
|
2665
|
+
groupCacheTimeouts: "\u7F13\u5B58\u4E0E\u8D85\u65F6",
|
|
2666
|
+
groupImages: "\u56FE\u7247\u5904\u7406",
|
|
2667
|
+
advancedHint: "\u7EE7\u627F\u6765\u7684\u53D6\u503C\u5373\u53EF\u6B63\u5E38\u4F7F\u7528\uFF1B\u4E0B\u9762\u53EA\u5217\u9700\u8981\u6539\u7684\u9879\u3002",
|
|
2544
2668
|
usageDisplayLabel: "\u989D\u5EA6\u663E\u793A",
|
|
2545
|
-
usageDisplayHint: "\u81EA\u52A8\uFF1A\u4EC5\u9009\u4E2D DSH OpenCode Go \u6A21\u578B\u65F6\u663E\u793A\
|
|
2669
|
+
usageDisplayHint: "\u81EA\u52A8\uFF1A\u4EC5\u9009\u4E2D DSH OpenCode Go \u6A21\u578B\u65F6\u663E\u793A\uFF1B\u5E38\u9A7B\uFF1A\u4EFB\u610F\u6A21\u578B\u90FD\u663E\u793A\uFF1B\u5173\u95ED\uFF1A\u9690\u85CF\u5E76\u505C\u6B62\u5237\u65B0\u3002\u663E\u793A\u65F6\u6BCF\u5206\u949F\u5237\u65B0\u3002",
|
|
2546
2670
|
usageDisplay_auto: "\u81EA\u52A8\uFF08\u9ED8\u8BA4\uFF09",
|
|
2547
2671
|
usageDisplay_always: "\u5E38\u9A7B",
|
|
2548
2672
|
usageDisplay_off: "\u5173\u95ED",
|
|
2549
|
-
|
|
2550
|
-
|
|
2673
|
+
protocolOverridesLabel: "DeepSeek V4.1 Flash \u534F\u8BAE",
|
|
2674
|
+
protocolOverridesHint: "\u81EA\u52A8\u8DDF\u968F\u6A21\u578B\u76EE\u5F55\uFF1BResponses \u4E3A\u5B9E\u9A8C\u6027\uFF0C\u4EC5\u5F71\u54CD DeepSeek V4.1 Flash\uFF0C\u4FDD\u5B58\u540E\u5BF9\u65B0\u8BF7\u6C42\u751F\u6548\u3002",
|
|
2675
|
+
protocolOverridesAuto: "\u81EA\u52A8\uFF08\u9ED8\u8BA4\uFF09",
|
|
2676
|
+
protocolOverridesResponses: "Responses\uFF08\u5B9E\u9A8C\u6027\uFF09",
|
|
2551
2677
|
baseURLLabel: "\u7F51\u5173\u5730\u5740",
|
|
2552
|
-
baseURLHint: "\
|
|
2678
|
+
baseURLHint: "\u6A21\u578B\u8BF7\u6C42\u4E0E\u5B9E\u65F6\u6A21\u578B\u5217\u8868\u5171\u7528\u7684\u7AEF\u70B9\u3002",
|
|
2553
2679
|
proxyURLLabel: "\u4EE3\u7406\u5730\u5740",
|
|
2554
|
-
proxyURLHint: "\u5BF9\u8BDD\u3001\
|
|
2680
|
+
proxyURLHint: "\u5BF9\u8BDD\u3001\u76EE\u5F55\u5237\u65B0\u4E0E\u7528\u91CF\u67E5\u8BE2\u4F7F\u7528\u7684 HTTP(S)/SOCKS5 \u4EE3\u7406\uFF1B\u7559\u7A7A\u4F7F\u7528\u9ED8\u8BA4\u7F51\u7EDC\u3002",
|
|
2555
2681
|
proxyURLInvalid: "\u8BF7\u8F93\u5165 http://\u3001https:// \u6216 socks5:// \u4EE3\u7406\u5730\u5740\uFF0C\u4E0D\u5305\u542B\u8DEF\u5F84\u3001\u67E5\u8BE2\u53C2\u6570\u6216\u7247\u6BB5\u3002",
|
|
2556
2682
|
refreshMinutesLabel: "\u76EE\u5F55\u5237\u65B0\uFF08\u5206\u949F\uFF09",
|
|
2557
|
-
refreshMinutesHint: "\
|
|
2683
|
+
refreshMinutesHint: "\u6A21\u578B\u76EE\u5F55\u7684\u7F13\u5B58\u65F6\u957F\uFF1B\u6253\u5F00\u672C\u9875\u6216\u70B9\u51FB\u5237\u65B0\u4F1A\u7ACB\u5373\u91CD\u65B0\u6838\u5BF9\u3002",
|
|
2558
2684
|
streamIdleTimeoutMsLabel: "\u6D41\u7A7A\u95F2\u8D85\u65F6\uFF08\u6BEB\u79D2\uFF09",
|
|
2559
|
-
streamIdleTimeoutMsHint: "\u6D41\u4E8B\u4EF6\u95F4\
|
|
2685
|
+
streamIdleTimeoutMsHint: "\u6D41\u4E8B\u4EF6\u4E4B\u95F4\u7684\u6700\u5927\u9759\u9ED8\u95F4\u9694\uFF0C\u8D85\u51FA\u5219\u8BF7\u6C42\u5931\u8D25\u3002",
|
|
2560
2686
|
maxImagesLabel: "\u8BF7\u6C42\u56FE\u7247\u6570\u91CF\u4E0A\u9650\uFF08maxImages\uFF09",
|
|
2561
|
-
maxImagesHint: "\
|
|
2687
|
+
maxImagesHint: "\u7559\u7A7A\u7EE7\u627F\u57FA\u7840\u914D\u7F6E\uFF08\u57FA\u7840\u672A\u8BBE\u4E0A\u9650\u65F6\u624D\u4E0D\u9650\u5236\u5F20\u6570\uFF09\uFF1B\u8D85\u9650\u65F6\u6700\u65E7\u7684\u56FE\u7247\u4F1A\u88AB\u66FF\u6362\u4E3A\u6587\u5B57\u5360\u4F4D\u3002",
|
|
2562
2688
|
maxRequestImageBytesLabel: "\u8BF7\u6C42\u56FE\u7247\u8F7D\u8377\u4E0A\u9650\uFF08\u5B57\u8282\uFF09",
|
|
2563
2689
|
maxRequestImageBytesHint: "\u5355\u4E2A\u8BF7\u6C42\u7D2F\u8BA1 base64 \u56FE\u7247\u8F7D\u8377\u7684\u4E0A\u9650\u3002",
|
|
2564
2690
|
requestImagePixelBudgetLabel: "\u56FE\u7247\u50CF\u7D20\u9884\u7B97",
|
|
2565
|
-
requestImagePixelBudgetHint: "\u5355\u5F20\u8F6C\u6362\u540E\
|
|
2691
|
+
requestImagePixelBudgetHint: "\u5355\u5F20\u56FE\u7247\u8F6C\u6362\u540E\u7684\u603B\u50CF\u7D20\u9884\u7B97\u3002",
|
|
2566
2692
|
requestImageMaxBytesLabel: "\u56FE\u7247\u5B57\u8282\u76EE\u6807\uFF08\u5B57\u8282\uFF09",
|
|
2567
|
-
requestImageMaxBytesHint: "\u5355\u5F20\
|
|
2693
|
+
requestImageMaxBytesHint: "\u5355\u5F20\u56FE\u7247 base64 \u6269\u5C55\u524D\u7684\u539F\u59CB\u7F16\u7801\u5B57\u8282\u76EE\u6807\u3002",
|
|
2568
2694
|
overridden: "\u5DF2\u81EA\u5B9A\u4E49",
|
|
2569
2695
|
reset: "\u6062\u590D\u9ED8\u8BA4",
|
|
2570
2696
|
invalidValue: "\u4E0D\u662F\u6709\u6548\u503C",
|
|
@@ -2597,7 +2723,7 @@ function parseGoUsage(value) {
|
|
|
2597
2723
|
}
|
|
2598
2724
|
for (const key of ["rolling", "weekly", "monthly"]) {
|
|
2599
2725
|
const row = source[key];
|
|
2600
|
-
if (!row || row.status !== "ok" && row.status !== "rate-limited" || typeof row.percent !== "number" || !Number.isFinite(row.percent) || row.percent < 0 || typeof row.resetsAt !== "string" || !Number.isFinite(Date.parse(row.resetsAt))) {
|
|
2726
|
+
if (!row || row.status !== "ok" && row.status !== "rate-limited" || typeof row.percent !== "number" || !Number.isFinite(row.percent) || row.percent < 0 || row.percent > 100 || typeof row.resetsAt !== "string" || !Number.isFinite(Date.parse(row.resetsAt))) {
|
|
2601
2727
|
throw new Error("Invalid OpenCode Go usage response");
|
|
2602
2728
|
}
|
|
2603
2729
|
result[key] = { status: row.status, percent: row.percent, resetsAt: row.resetsAt };
|
|
@@ -2641,10 +2767,61 @@ var usageRemote = {
|
|
|
2641
2767
|
}]
|
|
2642
2768
|
};
|
|
2643
2769
|
|
|
2770
|
+
// src/accounts-contract.ts
|
|
2771
|
+
function parseAccountCommand(value) {
|
|
2772
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) throw new Error("Invalid account command");
|
|
2773
|
+
const row = value;
|
|
2774
|
+
const fields = {
|
|
2775
|
+
add: ["kind", "id", "name", "key"],
|
|
2776
|
+
remove: ["kind", "ref"],
|
|
2777
|
+
select: ["kind", "ref"],
|
|
2778
|
+
rename: ["kind", "ref", "name"],
|
|
2779
|
+
"replace-key": ["kind", "ref", "key"],
|
|
2780
|
+
move: ["kind", "ref", "toIndex"],
|
|
2781
|
+
"auto-switch": ["kind", "value"]
|
|
2782
|
+
};
|
|
2783
|
+
if (typeof row.kind !== "string" || !Object.hasOwn(fields, row.kind) || Object.keys(row).some((key) => !fields[row.kind].includes(key)) || fields[row.kind].some((key) => !Object.hasOwn(row, key))) throw new Error("Invalid account command");
|
|
2784
|
+
if ("ref" in row && (typeof row.ref !== "string" || !ACCOUNT_REF_PATTERN.test(row.ref))) throw new Error("Invalid account reference");
|
|
2785
|
+
if ("name" in row && (typeof row.name !== "string" || !row.name.trim() || row.name.trim().length > 80)) throw new Error("Invalid account name");
|
|
2786
|
+
if ("key" in row && (typeof row.key !== "string" || !row.key.trim())) throw new Error("Missing account credential");
|
|
2787
|
+
if (row.kind === "add" && (typeof row.id !== "string" || !/^[a-f0-9]{32}$/.test(row.id))) throw new Error("Invalid account operation ID");
|
|
2788
|
+
if (row.kind === "move" && (!Number.isInteger(row.toIndex) || row.toIndex < 0)) throw new Error("Invalid account position");
|
|
2789
|
+
if (row.kind === "auto-switch" && typeof row.value !== "boolean") throw new Error("Invalid account switch");
|
|
2790
|
+
return { ...row };
|
|
2791
|
+
}
|
|
2792
|
+
function parseResult(value) {
|
|
2793
|
+
if (value !== "applied" && value !== "rejected" && value !== "unknown") throw new Error("Invalid account command result");
|
|
2794
|
+
return value;
|
|
2795
|
+
}
|
|
2796
|
+
var commandCodec = {
|
|
2797
|
+
mode: "strict",
|
|
2798
|
+
typeSymbol: "dsh-opencode-go#AccountCommand",
|
|
2799
|
+
schema: { parse: parseAccountCommand },
|
|
2800
|
+
create: () => ({ parse: parseAccountCommand })
|
|
2801
|
+
};
|
|
2802
|
+
var resultCodec = {
|
|
2803
|
+
mode: "strict",
|
|
2804
|
+
typeSymbol: "dsh-opencode-go#AccountCommandResult",
|
|
2805
|
+
schema: { parse: parseResult },
|
|
2806
|
+
create: () => ({ parse: parseResult })
|
|
2807
|
+
};
|
|
2808
|
+
var accountsRemote = {
|
|
2809
|
+
package: "dsh-opencode-go",
|
|
2810
|
+
descriptors: [{
|
|
2811
|
+
id: "dsh-opencode-go#opencodeGoAccounts/execute",
|
|
2812
|
+
service: "opencodeGoAccounts",
|
|
2813
|
+
namespace: "opencodeGoAccounts",
|
|
2814
|
+
method: "execute",
|
|
2815
|
+
invocation: { kind: "direct" },
|
|
2816
|
+
parameters: [{ name: "command", wire: "command", source: "json", codec: commandCodec }],
|
|
2817
|
+
result: resultCodec
|
|
2818
|
+
}]
|
|
2819
|
+
};
|
|
2820
|
+
|
|
2644
2821
|
// src/remote-contract.ts
|
|
2645
2822
|
var goRemote = {
|
|
2646
2823
|
package: "dsh-opencode-go",
|
|
2647
|
-
descriptors: [...usageRemote.descriptors, ...modelsRemote.descriptors]
|
|
2824
|
+
descriptors: [...usageRemote.descriptors, ...modelsRemote.descriptors, ...accountsRemote.descriptors]
|
|
2648
2825
|
};
|
|
2649
2826
|
|
|
2650
2827
|
// src/client/UsagePill.tsx
|
|
@@ -2656,13 +2833,13 @@ if (!document.querySelector("style[data-plugin-css=" + JSON.stringify(id2) + "]"
|
|
|
2656
2833
|
const style = document.createElement("style");
|
|
2657
2834
|
style.dataset.plugin = "dsh-opencode-go";
|
|
2658
2835
|
style.dataset.pluginCss = id2;
|
|
2659
|
-
style.textContent = '.mAjYhq_root{min-width:0;display:inline-flex;position:relative}.mAjYhq_trigger{color:inherit;opacity:.75;font:inherit;cursor:pointer;white-space:nowrap;background:0 0;border:0;border-radius:6px;padding:4px 6px;font-size:12px}.mAjYhq_trigger:hover,.mAjYhq_trigger:focus-visible{opacity:1;background:color-mix(in srgb, currentColor 8%, transparent)}.mAjYhq_account{text-overflow:ellipsis;vertical-align:bottom;max-width:12ch;display:inline-block;overflow:hidden}@container (width<=460px){.mAjYhq_brand,.mAjYhq_stale,.mAjYhq_account,.mAjYhq_fallback{display:none}.mAjYhq_reading[data-stale]:after{content:"*"}.mAjYhq_trigger[data-fallback]:after{content:" \u21B3"}}@container (width<=360px){.mAjYhq_unit{display:none}}.mAjYhq_panel{z-index:100;box-sizing:border-box;border-radius:var(--dsw-radius-lg,16px);width:320px;max-width:calc(100vw - 32px);max-height:70vh;color:var(--dsw-alias-label-primary,CanvasText);isolation:isolate;--dsw-elevation-stroke-color:var(--dsw-alias-border-l1,color-mix(in srgb, currentColor 10%, transparent));box-shadow:var(--dsw-elevation-prominent,0 8px 30px #0003);border:0;flex-direction:column;font-size:12px;display:flex;position:absolute;bottom:calc(100% + 12px);right:0}.mAjYhq_material{z-index:-1;border-radius:inherit;pointer-events:none;background:var(--dsw-menu-surface-fill,var(--dsw-specific-menu,#43454a73));backdrop-filter:var(--dsw-menu-backdrop-filter,blur(40px) saturate(150%));position:absolute;inset:0}@supports not (backdrop-filter:blur(1px)){.mAjYhq_material{background:var(--dsw-alias-bg-layer-2,Canvas)}}.mAjYhq_body{overscroll-behavior:contain;box-sizing:border-box;flex-direction:column;flex:1;gap:6px;min-height:0;padding:10px;display:flex;overflow-y:auto}.mAjYhq_panelTitle,.mAjYhq_panelHead{color:var(--dsw-alias-label-tertiary,currentColor);flex:none;padding:2px 6px 0;font-size:11.5px;line-height:1.6}.mAjYhq_panelHead{align-items:center;gap:6px;display:flex}.mAjYhq_panelHead strong{color:var(--dsw-alias-label-primary,CanvasText);font-size:12px;font-weight:600}.mAjYhq_back{width:18px;height:18px;color:inherit;cursor:pointer;background:0 0;border:0;border-radius:5px;place-items:center;padding:0;display:grid}.mAjYhq_back:hover{background:color-mix(in srgb, currentColor 8%, transparent)}.mAjYhq_icon{flex:none;width:14px;height:14px}.mAjYhq_tick{color:#39a878;flex:none;width:14px;height:14px}.mAjYhq_tile{background:color-mix(in srgb, currentColor 6%, transparent);border-radius:10px;flex:none;overflow:hidden}.mAjYhq_divider{background:color-mix(in srgb, currentColor 10%, transparent);height:.5px;margin:0 12px}.mAjYhq_accHead{align-items:center;gap:8px;min-height:42px;padding:0 12px;display:flex}.mAjYhq_dot{background:#39a878;border-radius:50%;flex:none;width:7px;height:7px}.mAjYhq_accName{text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0;font-size:13.5px;font-weight:600;overflow:hidden}.mAjYhq_tag{color:#39a878;background:#39a8781f;border:.5px solid #39a87873;border-radius:999px;flex:none;padding:0 7px;font-size:10.5px;line-height:1.7}.mAjYhq_switch{font:inherit;color:var(--dsw-alias-label-tertiary,currentColor);cursor:pointer;background:0 0;border:0;border-radius:6px;flex:none;align-items:center;gap:3px;padding:3px 6px;font-size:11.5px;display:inline-flex}.mAjYhq_switch:hover:not(:disabled){background:color-mix(in srgb, currentColor 8%, transparent)}.mAjYhq_switch:disabled{opacity:.55;cursor:default}.mAjYhq_option{width:100%;min-height:38px;font:inherit;text-align:left;cursor:pointer;background:0 0;border:0;align-items:center;gap:8px;padding:0 12px;display:flex}.mAjYhq_option:hover:not(:disabled){background:color-mix(in srgb, currentColor 6%, transparent)}.mAjYhq_option:disabled{opacity:.6;cursor:default}.mAjYhq_optionName{text-overflow:ellipsis;white-space:nowrap;min-width:0;color:var(--dsw-alias-label-secondary,currentColor);flex:1;font-size:13px;overflow:hidden}.mAjYhq_option[data-selected] .mAjYhq_optionName{color:var(--dsw-alias-label-primary,CanvasText);font-weight:600}.mAjYhq_hint{opacity:.65;font-size:11px;line-height:1.6}.mAjYhq_warning{background:color-mix(in srgb, currentColor 6%, transparent);overflow-wrap:anywhere;border-radius:6px;margin:10px 0;padding:10px;line-height:1.5}.mAjYhq_warning p{margin:5px 0 0}.mAjYhq_retry{border:1px solid color-mix(in srgb, currentColor 25%, transparent);color:inherit;font:inherit;cursor:pointer;background:0 0;border-radius:6px;padding:5px 9px}.mAjYhq_retry:disabled{opacity:.6;cursor:default}.mAjYhq_back:focus-visible,.mAjYhq_switch:focus-visible,.mAjYhq_option:focus-visible,.mAjYhq_retry:focus-visible{outline-offset:2px;outline:2px solid}.mAjYhq_window{padding:10px 12px}.mAjYhq_windowRow{align-items:center;gap:10px;display:flex}.mAjYhq_windowLabel{width:48px;color:var(--dsw-alias-label-secondary,currentColor);flex:none;font-size:12.5px}.mAjYhq_windowPercent{text-align:right;font-variant-numeric:tabular-nums;flex:none;width:38px;font-size:13px;font-weight:650}.mAjYhq_window progress{appearance:none;background:color-mix(in srgb, currentColor 15%, transparent);border:0;border-radius:99px;flex:1;min-width:60px;height:10px;display:block}.mAjYhq_window progress::-webkit-progress-bar{background:0 0;border-radius:99px}.mAjYhq_window progress::-webkit-progress-value{background:#39a878;border-radius:99px}.mAjYhq_window progress::-moz-progress-bar{background:#39a878;border-radius:99px}.mAjYhq_windowReset{color:var(--dsw-alias-label-tertiary,currentColor);margin-top:6px;font-size:11px;line-height:1.6}.mAjYhq_foot{color:var(--dsw-alias-label-tertiary,currentColor);justify-content:space-between;align-items:center;gap:8px;padding:3px 6px 1px;font-size:11px;display:flex}.mAjYhq_window progress.mAjYhq_high::-webkit-progress-value{background:#e0a100}.mAjYhq_window progress.mAjYhq_high::-moz-progress-bar{background:#e0a100}.mAjYhq_window progress.mAjYhq_limited::-webkit-progress-value{background:#e5484d}.mAjYhq_window progress.mAjYhq_limited::-moz-progress-bar{background:#e5484d}.mAjYhq_limitedText{color:#e5484d;margin-top:2px;font-weight:600}';
|
|
2836
|
+
style.textContent = '.mAjYhq_root{min-width:0;display:inline-flex;position:relative}.mAjYhq_trigger{color:inherit;opacity:.75;font:inherit;cursor:pointer;white-space:nowrap;background:0 0;border:0;border-radius:6px;padding:4px 6px;font-size:12px}.mAjYhq_trigger:hover,.mAjYhq_trigger:focus-visible{opacity:1;background:color-mix(in srgb, currentColor 8%, transparent)}.mAjYhq_account{text-overflow:ellipsis;vertical-align:bottom;max-width:12ch;display:inline-block;overflow:hidden}@container (width<=460px){.mAjYhq_brand,.mAjYhq_stale,.mAjYhq_account,.mAjYhq_fallback{display:none}.mAjYhq_reading[data-stale]:after{content:"*"}.mAjYhq_trigger[data-fallback]:after{content:" \u21B3"}}@container (width<=360px){.mAjYhq_unit{display:none}}.mAjYhq_panel{z-index:100;box-sizing:border-box;border-radius:var(--dsw-radius-lg,16px);width:320px;max-width:calc(100vw - 32px);max-height:70vh;color:var(--dsw-alias-label-primary,CanvasText);isolation:isolate;--dsw-elevation-stroke-color:var(--dsw-alias-border-l1,color-mix(in srgb, currentColor 10%, transparent));box-shadow:var(--dsw-elevation-prominent,0 8px 30px #0003);border:0;flex-direction:column;font-size:12px;display:flex;position:absolute;bottom:calc(100% + 12px);right:0}.mAjYhq_material{z-index:-1;border-radius:inherit;pointer-events:none;background:var(--dsw-menu-surface-fill,var(--dsw-specific-menu,#43454a73));backdrop-filter:var(--dsw-menu-backdrop-filter,blur(40px) saturate(150%));position:absolute;inset:0}@supports not (backdrop-filter:blur(1px)){.mAjYhq_material{background:var(--dsw-alias-bg-layer-2,Canvas)}}.mAjYhq_body{overscroll-behavior:contain;box-sizing:border-box;flex-direction:column;flex:1;gap:6px;min-height:0;padding:10px;display:flex;overflow-y:auto}.mAjYhq_panelTitle,.mAjYhq_panelHead{color:var(--dsw-alias-label-tertiary,currentColor);flex:none;padding:2px 6px 0;font-size:11.5px;line-height:1.6}.mAjYhq_panelHead{align-items:center;gap:6px;display:flex}.mAjYhq_panelHead strong{color:var(--dsw-alias-label-primary,CanvasText);font-size:12px;font-weight:600}.mAjYhq_back{width:18px;height:18px;color:inherit;cursor:pointer;background:0 0;border:0;border-radius:5px;place-items:center;padding:0;display:grid}.mAjYhq_back:hover{background:color-mix(in srgb, currentColor 8%, transparent)}.mAjYhq_icon{flex:none;width:14px;height:14px}.mAjYhq_tick{color:#39a878;flex:none;width:14px;height:14px}.mAjYhq_tile{background:color-mix(in srgb, currentColor 6%, transparent);border-radius:10px;flex:none;overflow:hidden}.mAjYhq_divider{background:color-mix(in srgb, currentColor 10%, transparent);height:.5px;margin:0 12px}.mAjYhq_accHead{align-items:center;gap:8px;min-height:42px;padding:0 12px;display:flex}.mAjYhq_dot{background:#39a878;border-radius:50%;flex:none;width:7px;height:7px}.mAjYhq_accName{text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0;font-size:13.5px;font-weight:600;overflow:hidden}.mAjYhq_tag{color:#39a878;background:#39a8781f;border:.5px solid #39a87873;border-radius:999px;flex:none;padding:0 7px;font-size:10.5px;line-height:1.7}.mAjYhq_switch{font:inherit;color:var(--dsw-alias-label-tertiary,currentColor);cursor:pointer;background:0 0;border:0;border-radius:6px;flex:none;align-items:center;gap:3px;padding:3px 6px;font-size:11.5px;display:inline-flex}.mAjYhq_switch:hover:not(:disabled){background:color-mix(in srgb, currentColor 8%, transparent)}.mAjYhq_switch:disabled{opacity:.55;cursor:default}.mAjYhq_switch svg{display:block;transform:translateY(.5px)}.mAjYhq_option{width:100%;min-height:38px;font:inherit;text-align:left;cursor:pointer;background:0 0;border:0;align-items:center;gap:8px;padding:0 12px;display:flex}.mAjYhq_option:hover:not(:disabled){background:color-mix(in srgb, currentColor 6%, transparent)}.mAjYhq_option:disabled{opacity:.6;cursor:default}.mAjYhq_optionName{text-overflow:ellipsis;white-space:nowrap;min-width:0;color:var(--dsw-alias-label-secondary,currentColor);flex:1;font-size:13px;overflow:hidden}.mAjYhq_option[data-selected] .mAjYhq_optionName{color:var(--dsw-alias-label-primary,CanvasText);font-weight:600}.mAjYhq_hint{opacity:.65;font-size:11px;line-height:1.6}.mAjYhq_warning{background:color-mix(in srgb, currentColor 6%, transparent);overflow-wrap:anywhere;border-radius:6px;margin:10px 0;padding:10px;line-height:1.5}.mAjYhq_warning p{margin:5px 0 0}.mAjYhq_retry{border:1px solid color-mix(in srgb, currentColor 25%, transparent);color:inherit;font:inherit;cursor:pointer;background:0 0;border-radius:6px;padding:5px 9px}.mAjYhq_retry:disabled{opacity:.6;cursor:default}.mAjYhq_back:focus-visible,.mAjYhq_switch:focus-visible,.mAjYhq_option:focus-visible,.mAjYhq_retry:focus-visible{outline-offset:2px;outline:2px solid}.mAjYhq_window{padding:10px 12px}.mAjYhq_windowRow{align-items:center;gap:10px;display:flex}.mAjYhq_windowLabel{width:48px;color:var(--dsw-alias-label-secondary,currentColor);flex:none;font-size:12.5px}.mAjYhq_windowPercent{text-align:right;font-variant-numeric:tabular-nums;flex:none;width:38px;font-size:13px;font-weight:650}.mAjYhq_window progress{appearance:none;background:color-mix(in srgb, currentColor 15%, transparent);border:0;border-radius:99px;flex:1;min-width:60px;height:10px;display:block}.mAjYhq_window progress::-webkit-progress-bar{background:0 0;border-radius:99px}.mAjYhq_window progress::-webkit-progress-value{background:#39a878;border-radius:99px}.mAjYhq_window progress::-moz-progress-bar{background:#39a878;border-radius:99px}.mAjYhq_windowReset{color:var(--dsw-alias-label-tertiary,currentColor);margin-top:6px;font-size:11px;line-height:1.6}.mAjYhq_foot{color:var(--dsw-alias-label-tertiary,currentColor);justify-content:space-between;align-items:center;gap:8px;padding:3px 6px 1px;font-size:11px;display:flex}.mAjYhq_window progress.mAjYhq_high::-webkit-progress-value{background:#e0a100}.mAjYhq_window progress.mAjYhq_high::-moz-progress-bar{background:#e0a100}.mAjYhq_window progress.mAjYhq_limited::-webkit-progress-value{background:#e5484d}.mAjYhq_window progress.mAjYhq_limited::-moz-progress-bar{background:#e5484d}.mAjYhq_limitedText{color:#e5484d;margin-top:2px;font-weight:600}';
|
|
2660
2837
|
document.head.appendChild(style);
|
|
2661
2838
|
}
|
|
2662
2839
|
var UsagePill_default = { "accHead": "mAjYhq_accHead", "accName": "mAjYhq_accName", "account": "mAjYhq_account", "back": "mAjYhq_back", "body": "mAjYhq_body", "brand": "mAjYhq_brand", "divider": "mAjYhq_divider", "dot": "mAjYhq_dot", "fallback": "mAjYhq_fallback", "foot": "mAjYhq_foot", "high": "mAjYhq_high", "hint": "mAjYhq_hint", "icon": "mAjYhq_icon", "limited": "mAjYhq_limited", "limitedText": "mAjYhq_limitedText", "material": "mAjYhq_material", "option": "mAjYhq_option", "optionName": "mAjYhq_optionName", "panel": "mAjYhq_panel", "panelHead": "mAjYhq_panelHead", "panelTitle": "mAjYhq_panelTitle", "reading": "mAjYhq_reading", "retry": "mAjYhq_retry", "root": "mAjYhq_root", "stale": "mAjYhq_stale", "switch": "mAjYhq_switch", "tag": "mAjYhq_tag", "tick": "mAjYhq_tick", "tile": "mAjYhq_tile", "trigger": "mAjYhq_trigger", "unit": "mAjYhq_unit", "warning": "mAjYhq_warning", "window": "mAjYhq_window", "windowLabel": "mAjYhq_windowLabel", "windowPercent": "mAjYhq_windowPercent", "windowReset": "mAjYhq_windowReset", "windowRow": "mAjYhq_windowRow" };
|
|
2663
2840
|
|
|
2664
2841
|
// src/client/UsagePill.tsx
|
|
2665
|
-
var
|
|
2842
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
2666
2843
|
var unchanged = () => 0;
|
|
2667
2844
|
var noSubscription = () => () => {
|
|
2668
2845
|
};
|
|
@@ -2688,13 +2865,13 @@ function usageLevel(window) {
|
|
|
2688
2865
|
return window.percent >= 80 ? UsagePill_default.high : void 0;
|
|
2689
2866
|
}
|
|
2690
2867
|
function ChevronRight() {
|
|
2691
|
-
return /* @__PURE__ */ (0,
|
|
2868
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("svg", { className: UsagePill_default.icon, viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("path", { d: "M6 4l4 4-4 4" }) });
|
|
2692
2869
|
}
|
|
2693
2870
|
function ChevronLeft() {
|
|
2694
|
-
return /* @__PURE__ */ (0,
|
|
2871
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("svg", { className: UsagePill_default.icon, viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("path", { d: "M10 4 6 8l4 4" }) });
|
|
2695
2872
|
}
|
|
2696
2873
|
function Tick() {
|
|
2697
|
-
return /* @__PURE__ */ (0,
|
|
2874
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("svg", { className: UsagePill_default.tick, viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("path", { d: "M3.5 8.5 6.5 11.5 12.5 4.5" }) });
|
|
2698
2875
|
}
|
|
2699
2876
|
function UsagePill({ directory, settings, credentialChanges, ...props }) {
|
|
2700
2877
|
const state = (0, import_react4.useSyncExternalStore)(directory.subscribe, directory.getSnapshot, directory.getSnapshot);
|
|
@@ -2708,7 +2885,7 @@ function UsagePill({ directory, settings, credentialChanges, ...props }) {
|
|
|
2708
2885
|
const visible = config.status === "ready" && config.value?.enabled !== false && (mode === "always" || mode === "auto" && state.current?.provider === PROVIDER_ID);
|
|
2709
2886
|
const accounts = accountsOf(config.value ?? {});
|
|
2710
2887
|
const activeRef = accountRefOf(config.value ?? {});
|
|
2711
|
-
return visible ? /* @__PURE__ */ (0,
|
|
2888
|
+
return visible ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
2712
2889
|
ActiveUsage,
|
|
2713
2890
|
{
|
|
2714
2891
|
...props,
|
|
@@ -2815,49 +2992,49 @@ function ActiveUsage({ readUsage, t, getLocale, accounts, activeRef, writable, s
|
|
|
2815
2992
|
});
|
|
2816
2993
|
};
|
|
2817
2994
|
const label = usage ? `Go \xB7 ${t("usageRollingShort")} ${usage.rolling.percent}% \xB7 ${t("usageWeekShort")} ${usage.weekly.percent}%${failure ? ` \xB7 ${t("usageStaleShort")}` : ""}${notice ? ` \xB7 ${t("usageFallbackShort")}` : ""}${accounts.length > 1 ? ` \xB7 ${accountName}` : ""}` : `Go \xB7 ${failure ? t("usageUnavailable") : "\u2026"}${notice ? ` \xB7 ${t("usageFallbackShort")}` : ""}${accounts.length > 1 ? ` \xB7 ${accountName}` : ""}`;
|
|
2818
|
-
const segments = usage ? /* @__PURE__ */ (0,
|
|
2819
|
-
/* @__PURE__ */ (0,
|
|
2820
|
-
/* @__PURE__ */ (0,
|
|
2821
|
-
/* @__PURE__ */ (0,
|
|
2995
|
+
const segments = usage ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
|
|
2996
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: UsagePill_default.brand, children: "Go \xB7 " }),
|
|
2997
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { className: UsagePill_default.reading, "data-stale": failure ? "" : void 0, children: [
|
|
2998
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { className: UsagePill_default.unit, children: [
|
|
2822
2999
|
t("usageRollingShort"),
|
|
2823
3000
|
" "
|
|
2824
3001
|
] }),
|
|
2825
3002
|
usage.rolling.percent,
|
|
2826
3003
|
"%",
|
|
2827
3004
|
" \xB7 ",
|
|
2828
|
-
/* @__PURE__ */ (0,
|
|
3005
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { className: UsagePill_default.unit, children: [
|
|
2829
3006
|
t("usageWeekShort"),
|
|
2830
3007
|
" "
|
|
2831
3008
|
] }),
|
|
2832
3009
|
usage.weekly.percent,
|
|
2833
3010
|
"%"
|
|
2834
3011
|
] }),
|
|
2835
|
-
failure ? /* @__PURE__ */ (0,
|
|
3012
|
+
failure ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { className: UsagePill_default.stale, children: [
|
|
2836
3013
|
" \xB7 ",
|
|
2837
3014
|
t("usageStaleShort")
|
|
2838
3015
|
] }) : null,
|
|
2839
|
-
notice ? /* @__PURE__ */ (0,
|
|
3016
|
+
notice ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { className: UsagePill_default.fallback, children: [
|
|
2840
3017
|
" \xB7 ",
|
|
2841
3018
|
t("usageFallbackShort")
|
|
2842
3019
|
] }) : null,
|
|
2843
|
-
accounts.length > 1 ? /* @__PURE__ */ (0,
|
|
3020
|
+
accounts.length > 1 ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { className: UsagePill_default.account, children: [
|
|
2844
3021
|
" \xB7 ",
|
|
2845
3022
|
accountName
|
|
2846
3023
|
] }) : null
|
|
2847
|
-
] }) : /* @__PURE__ */ (0,
|
|
2848
|
-
/* @__PURE__ */ (0,
|
|
3024
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
|
|
3025
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: UsagePill_default.brand, children: "Go \xB7 " }),
|
|
2849
3026
|
failure ? t("usageUnavailable") : "\u2026",
|
|
2850
|
-
notice ? /* @__PURE__ */ (0,
|
|
3027
|
+
notice ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { className: UsagePill_default.fallback, children: [
|
|
2851
3028
|
" \xB7 ",
|
|
2852
3029
|
t("usageFallbackShort")
|
|
2853
3030
|
] }) : null,
|
|
2854
|
-
accounts.length > 1 ? /* @__PURE__ */ (0,
|
|
3031
|
+
accounts.length > 1 ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { className: UsagePill_default.account, children: [
|
|
2855
3032
|
" \xB7 ",
|
|
2856
3033
|
accountName
|
|
2857
3034
|
] }) : null
|
|
2858
3035
|
] });
|
|
2859
|
-
return /* @__PURE__ */ (0,
|
|
2860
|
-
/* @__PURE__ */ (0,
|
|
3036
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { className: UsagePill_default.root, ref: root, children: [
|
|
3037
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
2861
3038
|
"button",
|
|
2862
3039
|
{
|
|
2863
3040
|
type: "button",
|
|
@@ -2874,16 +3051,16 @@ function ActiveUsage({ readUsage, t, getLocale, accounts, activeRef, writable, s
|
|
|
2874
3051
|
children: segments
|
|
2875
3052
|
}
|
|
2876
3053
|
),
|
|
2877
|
-
open && /* @__PURE__ */ (0,
|
|
2878
|
-
/* @__PURE__ */ (0,
|
|
2879
|
-
/* @__PURE__ */ (0,
|
|
2880
|
-
/* @__PURE__ */ (0,
|
|
2881
|
-
/* @__PURE__ */ (0,
|
|
3054
|
+
open && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: UsagePill_default.panel, role: "dialog", "aria-label": t("usageTitle"), "aria-busy": refreshing, children: [
|
|
3055
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: UsagePill_default.material, "aria-hidden": "true" }),
|
|
3056
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: UsagePill_default.body, children: accountsView ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
|
|
3057
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: UsagePill_default.panelHead, children: [
|
|
3058
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "button", className: UsagePill_default.back, "aria-label": t("accountSwitchBack"), onClick: () => {
|
|
2882
3059
|
setView("usage");
|
|
2883
|
-
}, children: /* @__PURE__ */ (0,
|
|
2884
|
-
/* @__PURE__ */ (0,
|
|
3060
|
+
}, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(ChevronLeft, {}) }),
|
|
3061
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("strong", { children: t("accountSwitchTitle") })
|
|
2885
3062
|
] }),
|
|
2886
|
-
/* @__PURE__ */ (0,
|
|
3063
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
2887
3064
|
"div",
|
|
2888
3065
|
{
|
|
2889
3066
|
className: UsagePill_default.tile,
|
|
@@ -2902,9 +3079,9 @@ function ActiveUsage({ readUsage, t, getLocale, accounts, activeRef, writable, s
|
|
|
2902
3079
|
const at = options.indexOf(document.activeElement);
|
|
2903
3080
|
options[(at + step + options.length) % options.length]?.focus();
|
|
2904
3081
|
},
|
|
2905
|
-
children: accounts.map((account, index) => /* @__PURE__ */ (0,
|
|
2906
|
-
index ? /* @__PURE__ */ (0,
|
|
2907
|
-
/* @__PURE__ */ (0,
|
|
3082
|
+
children: accounts.map((account, index) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_react4.Fragment, { children: [
|
|
3083
|
+
index ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: UsagePill_default.divider }) : null,
|
|
3084
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
2908
3085
|
"button",
|
|
2909
3086
|
{
|
|
2910
3087
|
type: "button",
|
|
@@ -2917,23 +3094,23 @@ function ActiveUsage({ readUsage, t, getLocale, accounts, activeRef, writable, s
|
|
|
2917
3094
|
switchTo(account.apiKeyEnv);
|
|
2918
3095
|
},
|
|
2919
3096
|
children: [
|
|
2920
|
-
/* @__PURE__ */ (0,
|
|
2921
|
-
account.apiKeyEnv === activeRef ? /* @__PURE__ */ (0,
|
|
3097
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: UsagePill_default.optionName, children: account.name || t("accountDefault") }),
|
|
3098
|
+
account.apiKeyEnv === activeRef ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Tick, {}) : null
|
|
2922
3099
|
]
|
|
2923
3100
|
}
|
|
2924
3101
|
)
|
|
2925
3102
|
] }, account.id))
|
|
2926
3103
|
}
|
|
2927
3104
|
),
|
|
2928
|
-
switchFailed ? /* @__PURE__ */ (0,
|
|
2929
|
-
/* @__PURE__ */ (0,
|
|
2930
|
-
] }) : /* @__PURE__ */ (0,
|
|
2931
|
-
/* @__PURE__ */ (0,
|
|
2932
|
-
accounts.length ? /* @__PURE__ */ (0,
|
|
2933
|
-
/* @__PURE__ */ (0,
|
|
2934
|
-
/* @__PURE__ */ (0,
|
|
2935
|
-
accounts.length > 1 ? /* @__PURE__ */ (0,
|
|
2936
|
-
accounts.length > 1 ? /* @__PURE__ */ (0,
|
|
3105
|
+
switchFailed ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: UsagePill_default.warning, role: "alert", children: t("accountSwitchFailed") }) : null,
|
|
3106
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: UsagePill_default.hint, children: t("accountSwitchHint") })
|
|
3107
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
|
|
3108
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: UsagePill_default.panelTitle, children: t("usageTitle") }),
|
|
3109
|
+
accounts.length ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: UsagePill_default.tile, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: UsagePill_default.accHead, children: [
|
|
3110
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: UsagePill_default.dot }),
|
|
3111
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: UsagePill_default.accName, children: accountName }),
|
|
3112
|
+
accounts.length > 1 ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: UsagePill_default.tag, children: t("accountPreferredTag") }) : null,
|
|
3113
|
+
accounts.length > 1 ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
2937
3114
|
"button",
|
|
2938
3115
|
{
|
|
2939
3116
|
type: "button",
|
|
@@ -2945,25 +3122,25 @@ function ActiveUsage({ readUsage, t, getLocale, accounts, activeRef, writable, s
|
|
|
2945
3122
|
},
|
|
2946
3123
|
children: [
|
|
2947
3124
|
t("accountSwitchAction"),
|
|
2948
|
-
/* @__PURE__ */ (0,
|
|
3125
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(ChevronRight, {})
|
|
2949
3126
|
]
|
|
2950
3127
|
}
|
|
2951
3128
|
) : null
|
|
2952
3129
|
] }) }) : null,
|
|
2953
|
-
switchFailed ? /* @__PURE__ */ (0,
|
|
2954
|
-
notice ? /* @__PURE__ */ (0,
|
|
3130
|
+
switchFailed ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: UsagePill_default.warning, role: "alert", children: t("accountSwitchFailed") }) : null,
|
|
3131
|
+
notice ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("p", { className: UsagePill_default.warning, role: "status", children: [
|
|
2955
3132
|
t(notice.reason === "quota" ? "accountFallbackQuota" : "accountFallbackCredential"),
|
|
2956
3133
|
" ",
|
|
2957
3134
|
accounts.find((account) => account.apiKeyEnv === notice.toRef)?.name || t("accountDefault"),
|
|
2958
3135
|
" \xB7 ",
|
|
2959
3136
|
new Date(notice.at).toLocaleString(getLocale?.())
|
|
2960
3137
|
] }) : null,
|
|
2961
|
-
failure ? /* @__PURE__ */ (0,
|
|
2962
|
-
/* @__PURE__ */ (0,
|
|
2963
|
-
/* @__PURE__ */ (0,
|
|
2964
|
-
usage ? /* @__PURE__ */ (0,
|
|
3138
|
+
failure ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: UsagePill_default.warning, role: "alert", children: [
|
|
3139
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("strong", { children: t("usageRefreshFailed") }),
|
|
3140
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { children: failure.message ?? t("usageUnavailable") }),
|
|
3141
|
+
usage ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { children: t("usageStaleHint") }) : null
|
|
2965
3142
|
] }) : null,
|
|
2966
|
-
failure ? /* @__PURE__ */ (0,
|
|
3143
|
+
failure ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
2967
3144
|
"button",
|
|
2968
3145
|
{
|
|
2969
3146
|
type: "button",
|
|
@@ -2975,26 +3152,26 @@ function ActiveUsage({ readUsage, t, getLocale, accounts, activeRef, writable, s
|
|
|
2975
3152
|
children: t(refreshing ? "usageRefreshing" : "usageRetry")
|
|
2976
3153
|
}
|
|
2977
3154
|
) : null,
|
|
2978
|
-
usage ? /* @__PURE__ */ (0,
|
|
2979
|
-
index ? /* @__PURE__ */ (0,
|
|
2980
|
-
/* @__PURE__ */ (0,
|
|
2981
|
-
/* @__PURE__ */ (0,
|
|
2982
|
-
/* @__PURE__ */ (0,
|
|
2983
|
-
/* @__PURE__ */ (0,
|
|
2984
|
-
/* @__PURE__ */ (0,
|
|
3155
|
+
usage ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: UsagePill_default.tile, children: ["rolling", "weekly", "monthly"].map((key, index) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_react4.Fragment, { children: [
|
|
3156
|
+
index ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: UsagePill_default.divider }) : null,
|
|
3157
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: UsagePill_default.window, children: [
|
|
3158
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: UsagePill_default.windowRow, children: [
|
|
3159
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: UsagePill_default.windowLabel, children: t(`usage_${key}`) }),
|
|
3160
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("progress", { className: usageLevel(usage[key]), "aria-label": t(`usage_${key}`), max: 100, value: Math.min(100, usage[key].percent) }),
|
|
3161
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("strong", { className: UsagePill_default.windowPercent, children: [
|
|
2985
3162
|
usage[key].percent,
|
|
2986
3163
|
"%"
|
|
2987
3164
|
] })
|
|
2988
3165
|
] }),
|
|
2989
|
-
/* @__PURE__ */ (0,
|
|
3166
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: UsagePill_default.windowReset, children: [
|
|
2990
3167
|
t("usageResets"),
|
|
2991
3168
|
" ",
|
|
2992
3169
|
new Date(usage[key].resetsAt).toLocaleString(getLocale?.())
|
|
2993
3170
|
] }),
|
|
2994
|
-
usage[key].status === "rate-limited" && /* @__PURE__ */ (0,
|
|
3171
|
+
usage[key].status === "rate-limited" && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: UsagePill_default.limitedText, children: t("usageLimited") })
|
|
2995
3172
|
] })
|
|
2996
|
-
] }, key)) }) : failure ? null : /* @__PURE__ */ (0,
|
|
2997
|
-
current ? /* @__PURE__ */ (0,
|
|
3173
|
+
] }, key)) }) : failure ? null : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: UsagePill_default.hint, children: t("usageLoading") }),
|
|
3174
|
+
current ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: UsagePill_default.foot, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { children: [
|
|
2998
3175
|
t("usageLastUpdated"),
|
|
2999
3176
|
" ",
|
|
3000
3177
|
new Date(current.updatedAt).toLocaleString(getLocale?.())
|
|
@@ -3006,7 +3183,7 @@ function ActiveUsage({ readUsage, t, getLocale, accounts, activeRef, writable, s
|
|
|
3006
3183
|
|
|
3007
3184
|
// src/client/usage.ts
|
|
3008
3185
|
var import_dsh_client_store2 = require("@deepseek-ai/dsh-client-store");
|
|
3009
|
-
function registerUsagePill(ctx, settings) {
|
|
3186
|
+
function registerUsagePill(ctx, settings, selectAccount) {
|
|
3010
3187
|
ctx.inject(["modelDirectories", "sessions", "remote.session"], (scope) => {
|
|
3011
3188
|
scope.inject(["remote.opencodeGoUsage"], (ready) => {
|
|
3012
3189
|
const credentialChanges = (0, import_dsh_client_store2.createSnapshotStore)(0);
|
|
@@ -3032,12 +3209,7 @@ function registerUsagePill(ctx, settings) {
|
|
|
3032
3209
|
selectAccount: async (ref) => {
|
|
3033
3210
|
const snapshot = settings.getSnapshot();
|
|
3034
3211
|
if (!snapshot.writable || !accountsOf(snapshot.value ?? {}).some((account) => account.apiKeyEnv === ref)) return false;
|
|
3035
|
-
|
|
3036
|
-
await settings.mutate([{ op: "set", path: ["apiKeyEnv"], value: ref }], snapshot.revision);
|
|
3037
|
-
return accountRefOf(settings.getSnapshot().value ?? {}) === ref;
|
|
3038
|
-
} catch {
|
|
3039
|
-
return false;
|
|
3040
|
-
}
|
|
3212
|
+
return selectAccount ? selectAccount(ref).catch(() => false) : false;
|
|
3041
3213
|
},
|
|
3042
3214
|
readUsage,
|
|
3043
3215
|
getLocale: () => ready.locale.getLocale().active,
|
|
@@ -3048,6 +3220,37 @@ function registerUsagePill(ctx, settings) {
|
|
|
3048
3220
|
});
|
|
3049
3221
|
}
|
|
3050
3222
|
|
|
3223
|
+
// src/client/host-compat.ts
|
|
3224
|
+
function mountSettingsScopes(ctx, mount) {
|
|
3225
|
+
ctx.inject(["configForms", "remote.opencodeGoModels"], (child) => {
|
|
3226
|
+
const forms = child.get("configForms");
|
|
3227
|
+
mount(child, forms.get(PROFILE_ENTRY_ID));
|
|
3228
|
+
});
|
|
3229
|
+
ctx.inject(["settingsScope", "remote.opencodeGoModels"], (child) => {
|
|
3230
|
+
mount(child, child.settingsScope.bind({
|
|
3231
|
+
namespace: SETTINGS_NAMESPACE,
|
|
3232
|
+
decode: (section) => typeof section === "object" && section !== null ? section : void 0
|
|
3233
|
+
}));
|
|
3234
|
+
});
|
|
3235
|
+
}
|
|
3236
|
+
function accountCommands(ctx) {
|
|
3237
|
+
const unavailable = async () => "unknown";
|
|
3238
|
+
let execute = unavailable;
|
|
3239
|
+
ctx.inject(["remote.opencodeGoAccounts"], (ready) => {
|
|
3240
|
+
ready.effect(() => {
|
|
3241
|
+
const connected = async (command) => {
|
|
3242
|
+
const result = await ready.remote.opencodeGoAccounts.execute(command);
|
|
3243
|
+
return result.ok ? result.value : "unknown";
|
|
3244
|
+
};
|
|
3245
|
+
execute = connected;
|
|
3246
|
+
return () => {
|
|
3247
|
+
if (execute === connected) execute = unavailable;
|
|
3248
|
+
};
|
|
3249
|
+
});
|
|
3250
|
+
});
|
|
3251
|
+
return (command) => execute(command);
|
|
3252
|
+
}
|
|
3253
|
+
|
|
3051
3254
|
// src/client/index.ts
|
|
3052
3255
|
var NS = "settings.opencode-go";
|
|
3053
3256
|
var inject = ["slots", "locale", "remote", "remote.credentials", "remote.llm"];
|
|
@@ -3055,19 +3258,11 @@ function apply(ctx) {
|
|
|
3055
3258
|
ctx.effect(() => ctx.locale.register(NS, { zh, en }), "llm-opencode-go: copy dictionaries");
|
|
3056
3259
|
const modelsReady = ctx.remote.$mount(goRemote);
|
|
3057
3260
|
ctx.effect(async () => await modelsReady);
|
|
3058
|
-
ctx
|
|
3059
|
-
const forms = child.get("configForms");
|
|
3060
|
-
mountSettings(child, forms.get("opencode-go"), modelsReady);
|
|
3061
|
-
});
|
|
3062
|
-
ctx.inject(["settingsScope", "remote.opencodeGoModels"], (child) => {
|
|
3063
|
-
mountSettings(child, child.settingsScope.bind({
|
|
3064
|
-
namespace: "llm-opencode-go",
|
|
3065
|
-
decode: (section) => typeof section === "object" && section !== null ? section : void 0
|
|
3066
|
-
}), modelsReady);
|
|
3067
|
-
});
|
|
3261
|
+
mountSettingsScopes(ctx, (child, scope) => mountSettings(child, scope, modelsReady));
|
|
3068
3262
|
}
|
|
3069
3263
|
function mountSettings(ctx, scope, modelsReady) {
|
|
3070
|
-
|
|
3264
|
+
const executeAccountCommand = accountCommands(ctx);
|
|
3265
|
+
registerUsagePill(ctx, scope, async (ref) => await executeAccountCommand({ kind: "select", ref }) === "applied");
|
|
3071
3266
|
let readAccount;
|
|
3072
3267
|
ctx.inject(["remote.opencodeGoUsage"], (ready) => {
|
|
3073
3268
|
readAccount = async (ref) => {
|
|
@@ -3083,7 +3278,7 @@ function mountSettings(ctx, scope, modelsReady) {
|
|
|
3083
3278
|
await modelsReady;
|
|
3084
3279
|
if (readAccount === void 0) throw new Error("OpenCode Go account usage is unavailable in this session");
|
|
3085
3280
|
return readAccount(ref);
|
|
3086
|
-
});
|
|
3281
|
+
}, executeAccountCommand);
|
|
3087
3282
|
ctx.effect(() => () => controller.dispose());
|
|
3088
3283
|
const t = ctx.locale.bind(NS);
|
|
3089
3284
|
const injected = () => ({ ...controller.inject(), t, getLocale: () => ctx.locale.getLocale().active });
|