@nite07/dsh-search 0.1.2 → 0.1.4

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/dist/client.js CHANGED
@@ -29,7 +29,7 @@ var NiteSearchClient = (() => {
29
29
  var client_default = ".ns-page{max-width:1120px;margin:0 auto;padding:24px;color:var(--dsw-alias-label-primary);font:inherit;line-height:1.55;overflow-wrap:anywhere}.ns-page *{box-sizing:border-box}.ns-page h2,.ns-page h3,.ns-page h4,.ns-page h5,.ns-page p{margin:0 0 12px}.ns-page h2{font-size:24px;line-height:1.3}.ns-page h3{font-size:17px}.ns-page h4{font-size:15px}.ns-page h5{font-size:14px}.ns-header{display:flex;justify-content:space-between;align-items:flex-start;gap:24px;margin-bottom:16px}.ns-header p,.ns-muted,.ns-page small{color:var(--dsw-alias-label-secondary)}.ns-eyebrow{font-size:12px;font-weight:600;letter-spacing:.08em}.ns-card{margin:16px 0;padding:20px;border:1px solid var(--dsw-alias-border-l1);border-radius:12px;background:var(--dsw-alias-bg-layer-1)}.ns-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:18px 24px}.ns-field{display:flex;min-width:0;flex-direction:column;gap:6px}.ns-field label,.ns-credential label{font-size:13px;font-weight:600}.ns-field small{font-size:12px;line-height:1.5}.ns-page input:not([type=checkbox]),.ns-page select,.ns-page textarea{width:100%;min-height:40px;padding:8px 10px;border:1px solid var(--dsw-alias-border-l2);border-radius:6px;background:var(--dsw-alias-bg-base);color:var(--dsw-alias-label-primary);font:inherit;font-size:13px}.ns-page textarea{resize:vertical}.ns-check{display:grid;grid-template-columns:1fr auto;align-content:start;align-items:center}.ns-check small{grid-column:1/-1}.ns-page input[type=checkbox]{width:18px;height:18px;accent-color:var(--dsw-alias-brand-primary)}.ns-page button{min-height:40px;padding:8px 14px;border:1px solid var(--dsw-alias-border-l2);border-radius:6px;background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-primary);font:inherit;font-size:13px;cursor:pointer}.ns-page button:hover:not(:disabled){border-color:var(--dsw-alias-brand-primary)}.ns-page button:disabled,.ns-page input:disabled,.ns-page select:disabled{opacity:.55;cursor:not-allowed}.ns-page :is(button,input,select,textarea,a,summary):focus-visible,.ns-summary:focus{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:3px;scroll-margin-block:100px}.ns-page a{color:var(--dsw-alias-brand-primary);text-underline-offset:3px}.ns-status{display:flex;justify-content:space-between;gap:12px;min-height:44px;padding:10px 14px;background:var(--dsw-alias-bg-layer-2);border:1px solid var(--dsw-alias-border-l1);border-radius:8px;font-size:13px}.ns-summary{margin:16px 0;padding:16px;border:1px solid var(--dsw-alias-state-error-primary);border-radius:8px}.ns-summary h3{margin:0}.ns-summary ul{padding-left:20px}.ns-error{color:var(--dsw-alias-state-error-primary)!important}.ns-success{color:var(--dsw-alias-state-success-primary)}.ns-warning{color:var(--dsw-alias-state-warn-primary)}.ns-backends{margin-top:28px}.ns-tier{margin-top:24px}.ns-tier>h4{color:var(--dsw-alias-label-secondary)}.ns-backend{padding:0}.ns-backend > summary{display:flex;gap:16px;align-items:center;justify-content:space-between;padding:16px 20px;cursor:pointer;list-style:revert;font-weight:600}.ns-backend > summary::before{content:'\u203A';font-size:20px}.ns-backend[open] > summary::before{transform:rotate(90deg)}.ns-backend summary>span:first-of-type{flex:1}.ns-badge{padding:3px 8px;border:1px solid var(--dsw-alias-border-l1);border-radius:5px;font-size:11px;font-weight:500;color:var(--dsw-alias-label-secondary)}.ns-backend-body{padding:0 20px 20px}.ns-quota{padding:12px;background:var(--dsw-alias-bg-layer-2);border-radius:6px;font-size:12px}.ns-credential{margin:20px 0;padding-top:16px;border-top:1px solid var(--dsw-alias-border-l1)}.ns-credential p{font-size:12px;color:var(--dsw-alias-label-secondary)}.ns-credential input{margin:6px 0 12px}.ns-actions{display:flex;align-items:center;gap:8px;flex-wrap:wrap}.ns-table-wrap{overflow:auto;margin-top:16px}.ns-page table{width:100%;border-collapse:collapse;font-size:12px;text-align:left}.ns-page th,.ns-page td{padding:10px;border-bottom:1px solid var(--dsw-alias-border-l1);white-space:nowrap}.ns-page th{color:var(--dsw-alias-label-secondary);font-weight:500}.ns-result pre{max-height:320px;overflow:auto;padding:12px;background:var(--dsw-alias-bg-base);border:1px solid var(--dsw-alias-border-l1);white-space:pre-wrap;font-size:12px}.ns-footer{position:sticky;bottom:0;display:flex;align-items:center;justify-content:space-between;gap:16px;padding:16px;margin-top:24px;border:1px solid var(--dsw-alias-border-l2);border-radius:10px;background:var(--dsw-alias-bg-layer-1);font-size:12px}.ns-page .ns-primary{border-color:var(--dsw-alias-brand-primary);color:var(--dsw-alias-brand-primary);font-weight:600}.ns-page [aria-invalid=true]{border-color:var(--dsw-alias-state-error-primary)!important}.ns-card>.ns-field{margin-top:16px}@media(max-width:640px){.ns-page{padding:16px 12px}.ns-header{gap:12px}.ns-grid{grid-template-columns:1fr;gap:16px}.ns-card{padding:16px}.ns-backend{padding:0}.ns-backend-body{padding:0 16px 16px}.ns-backend > summary{padding:16px}.ns-footer{position:static;align-items:flex-start;flex-direction:column}.ns-header h2{font-size:21px}}@media(prefers-reduced-motion:reduce){.ns-page *{scroll-behavior:auto!important;transition:none!important}}\n";
30
30
 
31
31
  // src/client.overrides.css
32
- var client_overrides_default = '.ns-backends:focus{outline:none}.ns-backends h3{display:flex;flex-wrap:wrap;gap:8px;align-items:baseline}\n.ns-toolbar{display:grid;grid-template-columns:minmax(0,2fr) minmax(0,1fr);gap:16px;margin:12px 0 4px}\n.ns-backend > summary{display:flex;align-items:center;justify-content:space-between;gap:12px;cursor:pointer;list-style:none;min-height:28px}\n.ns-backend > summary::-webkit-details-marker{display:none}\n.ns-backend > summary::before{content:"\u25B8";color:var(--dsw-alias-label-secondary);font-size:11px}\n.ns-backend[open] > summary::before{content:"\u25BE"}\n.ns-backend-title{flex:1 1 auto;font-weight:600;font-size:14px}\n.ns-chips{display:flex;align-items:center;gap:6px;flex-wrap:wrap;justify-content:flex-end}\n.ns-chip{font-size:11px;line-height:1;padding:4px 7px;border-radius:999px;border:1px solid var(--dsw-alias-border-l1);color:var(--dsw-alias-label-secondary);white-space:nowrap}\n.ns-chip--ok{border-color:var(--dsw-alias-state-success-primary);color:var(--dsw-alias-state-success-primary)}\n.ns-chip--warn{border-color:var(--dsw-alias-state-warn-primary);color:var(--dsw-alias-state-warn-primary)}\n.ns-chip--risk{border-color:var(--dsw-alias-state-error-primary);color:var(--dsw-alias-state-error-primary)}\n.ns-chip--off{border-color:var(--dsw-alias-border-l2);color:var(--dsw-alias-state-idle-primary)}\n.ns-dot{width:8px;height:8px;border-radius:50%;flex:0 0 auto}\n.ns-dot.is-on{background:var(--dsw-alias-state-success-primary)}\n.ns-dot.is-off{background:var(--dsw-alias-state-idle-primary);opacity:.6}\n.ns-badge.is-on{border-color:var(--dsw-alias-brand-primary);color:var(--dsw-alias-brand-primary)}\n.ns-advanced{margin:12px 0;border-top:1px solid var(--dsw-alias-border-l1);padding-top:10px}\n.ns-advanced summary{cursor:pointer;font-size:13px;font-weight:600;color:var(--dsw-alias-label-secondary);margin-bottom:10px}\n.ns-blockers{margin:16px 0;padding:16px 20px;border:1px solid var(--dsw-alias-state-warn-primary);border-radius:12px;background:var(--dsw-alias-bg-layer-1)}\n.ns-blockers h3{font-size:14px;margin-bottom:8px;color:var(--dsw-alias-state-warn-primary)}\n.ns-blockers ul{margin:0;padding-left:18px}\n.ns-blockers li{margin:4px 0}\n.ns-statuses{display:flex;flex-wrap:wrap;gap:8px 16px}\n.ns-status-choice{display:inline-flex;align-items:center;gap:6px;font-size:13px;padding:6px 4px;cursor:pointer}\n.ns-status-choice input{width:18px;height:18px;accent-color:var(--dsw-alias-brand-primary)}\n.ns-sources{margin:8px 0;padding-left:20px}\n.ns-sources li{margin:10px 0}\n.ns-sources p{margin:2px 0;font-size:12px}\n.ns-failure{margin-top:12px;padding:12px 14px;border:1px solid var(--dsw-alias-state-error-primary);border-radius:8px}\n.ns-failure h5{color:var(--dsw-alias-state-error-primary)}\n.ns-failure dl{display:grid;grid-template-columns:auto minmax(0,1fr);gap:4px 14px;margin:0;font-size:12px}\n.ns-failure dt{color:var(--dsw-alias-label-secondary)}\n.ns-failure dd{margin:0;overflow-wrap:anywhere}\n.ns-confirm{margin:10px 0;padding:12px 14px;border:1px solid var(--dsw-alias-state-error-primary);border-radius:8px;background:var(--dsw-alias-bg-layer-2)}\n.ns-confirm p{margin:0 0 10px;font-size:13px}\n.ns-danger{border-color:var(--dsw-alias-state-error-primary)!important;color:var(--dsw-alias-state-error-primary)}\n.ns-link{background:none;border:none;padding:0;margin-left:6px;min-height:0;font-size:12px;color:var(--dsw-alias-brand-primary);text-decoration:underline;cursor:pointer}\n.ns-link:hover{background:none;border:none}\n.ns-cell-message{max-width:320px;overflow-wrap:anywhere;font-size:12px;color:var(--dsw-alias-label-secondary)}\n.ns-footer{position:sticky;bottom:0;z-index:2;display:flex;align-items:center;justify-content:space-between;gap:16px;flex-wrap:wrap;margin:16px -4px 0;padding:12px 16px;border:1px solid var(--dsw-alias-border-l1);border-radius:12px;background:var(--dsw-alias-bg-layer-1);box-shadow:0 -2px 12px rgba(0,0,0,.06)}\n.ns-footer>span{font-size:13px;color:var(--dsw-alias-label-secondary)}\n@media (max-width:720px){.ns-toolbar{grid-template-columns:minmax(0,1fr)}.ns-chips{justify-content:flex-start}.ns-footer>span{width:100%}}\n\n.ns-advanced summary{display:inline-flex;align-items:center;gap:6px;width:auto;min-height:32px;padding:0 2px;color:var(--dsw-alias-brand-primary);font-weight:600}\n.ns-advanced summary::marker{font-size:10px}\n.ns-advanced[open] summary{margin-bottom:12px}\n.ns-tabs{display:flex;flex-wrap:wrap;gap:4px;margin:18px 0 14px;padding:4px;border:1px solid var(--dsw-alias-border-l1);border-radius:10px;background:var(--dsw-alias-bg-layer-1)}\n.ns-tab{display:inline-flex;align-items:center;gap:8px;min-height:36px;padding:6px 14px;border:1px solid transparent;border-radius:7px;background:transparent;color:var(--dsw-alias-label-secondary);font:inherit;font-size:13px;cursor:pointer}\n.ns-tab:hover:not(.is-active){background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-primary)}\n.ns-tab.is-active{border-color:var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-base);color:var(--dsw-alias-label-primary);font-weight:600}\n.ns-tab-count{font-size:11px;font-weight:600;padding:2px 6px;border-radius:999px;background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-secondary)}\n[role=tabpanel]{outline:none}\n.ns-test-actions{display:flex;align-items:center;gap:12px;flex-wrap:wrap;margin-top:16px}\n.ns-test-actions small{color:var(--dsw-alias-label-secondary)}\n@media (max-width:720px){.ns-tabs{gap:2px}.ns-tab{padding:6px 10px}}\n.ns-header{margin-bottom:8px}\n\n.ns-backend-body{padding:0 20px 20px}\n.ns-backend-body .ns-muted{font-size:12.5px;line-height:1.6;margin:10px 0}\n.ns-meta{display:flex;flex-wrap:wrap;align-items:baseline;gap:6px;margin:14px 0 0;padding-top:12px;border-top:1px solid var(--dsw-alias-border-l1);font-size:12px;line-height:1.5;color:var(--dsw-alias-label-secondary);font-variant-numeric:tabular-nums}\n.ns-meta strong{font-weight:600;color:var(--dsw-alias-label-primary)}\n.ns-blockers--info{border-color:var(--dsw-alias-border-l2)}.ns-blockers--info h3{color:var(--dsw-alias-label-primary)}\n';
32
+ var client_overrides_default = '.ns-backends:focus{outline:none}.ns-backends h3{display:flex;flex-wrap:wrap;gap:8px;align-items:baseline}\n.ns-toolbar{display:grid;grid-template-columns:minmax(0,2fr) minmax(0,1fr);gap:16px;margin:12px 0 4px}\n.ns-backend > summary{display:flex;align-items:center;justify-content:space-between;gap:12px;cursor:pointer;list-style:none;min-height:28px}\n.ns-backend > summary::-webkit-details-marker{display:none}\n.ns-backend > summary::before{content:"\u25B8";color:var(--dsw-alias-label-secondary);font-size:11px}\n.ns-backend[open] > summary::before{content:"\u25BE"}\n.ns-backend-title{flex:1 1 auto;font-weight:600;font-size:14px}\n.ns-chips{display:flex;align-items:center;gap:6px;flex-wrap:wrap;justify-content:flex-end}\n.ns-chip{font-size:11px;line-height:1;padding:4px 7px;border-radius:999px;border:1px solid var(--dsw-alias-border-l1);color:var(--dsw-alias-label-secondary);white-space:nowrap}\n.ns-chip--ok{border-color:var(--dsw-alias-state-success-primary);color:var(--dsw-alias-state-success-primary)}\n.ns-chip--warn{border-color:var(--dsw-alias-state-warn-primary);color:var(--dsw-alias-state-warn-primary)}\n.ns-chip--risk{border-color:var(--dsw-alias-state-error-primary);color:var(--dsw-alias-state-error-primary)}\n.ns-chip.is-on{background:color-mix(in oklab,var(--dsw-alias-brand-primary) 14%,transparent);border-color:currentColor;font-weight:600}\n.ns-chip--off{border-color:var(--dsw-alias-border-l2);color:var(--dsw-alias-state-idle-primary)}\n.ns-dot{width:8px;height:8px;border-radius:50%;flex:0 0 auto}\n.ns-dot.is-on{background:var(--dsw-alias-state-success-primary)}\n.ns-dot.is-off{background:var(--dsw-alias-state-idle-primary);opacity:.6}\n.ns-badge.is-on{border-color:var(--dsw-alias-brand-primary);color:var(--dsw-alias-brand-primary)}\n.ns-advanced{margin:12px 0;border-top:1px solid var(--dsw-alias-border-l1);padding-top:10px}\n.ns-advanced summary{cursor:pointer;font-size:13px;font-weight:600;color:var(--dsw-alias-label-secondary);margin-bottom:10px}\n.ns-blockers{margin:16px 0;padding:16px 20px;border:1px solid var(--dsw-alias-state-warn-primary);border-radius:12px;background:var(--dsw-alias-bg-layer-1)}\n.ns-blockers h3{font-size:14px;margin-bottom:8px;color:var(--dsw-alias-state-warn-primary)}\n.ns-blockers ul{margin:0;padding-left:18px}\n.ns-blockers li{margin:4px 0}\n.ns-statuses{display:flex;flex-wrap:wrap;gap:8px 16px}\n.ns-status-choice{display:inline-flex;align-items:center;gap:6px;font-size:13px;padding:6px 4px;cursor:pointer}\n.ns-status-choice input{width:18px;height:18px;accent-color:var(--dsw-alias-brand-primary)}\n.ns-sources{margin:8px 0;padding-left:20px}\n.ns-sources li{margin:10px 0}\n.ns-sources p{margin:2px 0;font-size:12px}\n.ns-failure{margin-top:12px;padding:12px 14px;border:1px solid var(--dsw-alias-state-error-primary);border-radius:8px}\n.ns-failure h5{color:var(--dsw-alias-state-error-primary)}\n.ns-failure dl{display:grid;grid-template-columns:auto minmax(0,1fr);gap:4px 14px;margin:0;font-size:12px}\n.ns-failure dt{color:var(--dsw-alias-label-secondary)}\n.ns-failure dd{margin:0;overflow-wrap:anywhere}\n.ns-confirm{margin:10px 0;padding:12px 14px;border:1px solid var(--dsw-alias-state-error-primary);border-radius:8px;background:var(--dsw-alias-bg-layer-2)}\n.ns-confirm p{margin:0 0 10px;font-size:13px}\n.ns-danger{border-color:var(--dsw-alias-state-error-primary)!important;color:var(--dsw-alias-state-error-primary)}\n.ns-link{background:none;border:none;padding:0;margin-left:6px;min-height:0;font-size:12px;color:var(--dsw-alias-brand-primary);text-decoration:underline;cursor:pointer}\n.ns-link:hover{background:none;border:none}\n.ns-cell-message{max-width:320px;overflow-wrap:anywhere;font-size:12px;color:var(--dsw-alias-label-secondary)}\n.ns-footer{position:sticky;bottom:0;z-index:2;display:flex;align-items:center;justify-content:space-between;gap:16px;flex-wrap:wrap;margin:16px -4px 0;padding:12px 16px;border:1px solid var(--dsw-alias-border-l1);border-radius:12px;background:var(--dsw-alias-bg-layer-1);box-shadow:0 -2px 12px rgba(0,0,0,.06)}\n.ns-footer>span{font-size:13px;color:var(--dsw-alias-label-secondary)}\n@media (max-width:720px){.ns-toolbar{grid-template-columns:minmax(0,1fr)}.ns-chips{justify-content:flex-start}.ns-footer>span{width:100%}}\n\n.ns-advanced summary{display:inline-flex;align-items:center;gap:6px;width:auto;min-height:32px;padding:0 2px;color:var(--dsw-alias-brand-primary);font-weight:600}\n.ns-advanced summary::marker{font-size:10px}\n.ns-advanced[open] summary{margin-bottom:12px}\n.ns-tabs{display:flex;flex-wrap:wrap;gap:4px;margin:18px 0 14px;padding:4px;border:1px solid var(--dsw-alias-border-l1);border-radius:10px;background:var(--dsw-alias-bg-layer-1)}\n.ns-tab{display:inline-flex;align-items:center;gap:8px;min-height:36px;padding:6px 14px;border:1px solid transparent;border-radius:7px;background:transparent;color:var(--dsw-alias-label-secondary);font:inherit;font-size:13px;cursor:pointer}\n.ns-tab:hover:not(.is-active){background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-primary)}\n.ns-tab.is-active{border-color:var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-base);color:var(--dsw-alias-label-primary);font-weight:600}\n.ns-tab-count{font-size:11px;font-weight:600;padding:2px 6px;border-radius:999px;background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-secondary)}\n[role=tabpanel]{outline:none}\n.ns-test-actions{display:flex;align-items:center;gap:12px;flex-wrap:wrap;margin-top:16px}\n.ns-test-actions small{color:var(--dsw-alias-label-secondary)}\n@media (max-width:720px){.ns-tabs{gap:2px}.ns-tab{padding:6px 10px}}\n.ns-header{margin-bottom:8px}\n\n.ns-backend-body{padding:0 20px 20px}\n.ns-backend-body .ns-muted{font-size:12.5px;line-height:1.6;margin:10px 0}\n.ns-meta{display:flex;flex-wrap:wrap;align-items:baseline;gap:6px;margin:14px 0 0;padding-top:12px;border-top:1px solid var(--dsw-alias-border-l1);font-size:12px;line-height:1.5;color:var(--dsw-alias-label-secondary);font-variant-numeric:tabular-nums}\n.ns-meta strong{font-weight:600;color:var(--dsw-alias-label-primary)}\n.ns-blockers--info{border-color:var(--dsw-alias-border-l2)}.ns-blockers--info h3{color:var(--dsw-alias-label-primary)}\n\n.ns-credential-shape code{display:block;padding:8px 10px;border:1px solid var(--dsw-alias-border-l1);border-radius:6px;background:var(--dsw-alias-bg-base);font-size:11px;overflow-wrap:anywhere}\n';
33
33
 
34
34
  // locale/en.json
35
35
  var en_default = {
@@ -86,10 +86,10 @@ var NiteSearchClient = (() => {
86
86
  notVerified: "Not verified",
87
87
  noData: "No data",
88
88
  attemptsToday: "Attempts today",
89
- "tier.free": "Free \xB7 no key",
90
- "tier.allowance": "Free allowance \xB7 key required",
89
+ "tier.free": "Free",
90
+ "tier.allowance": "Free allowance",
91
91
  "tier.trial": "Trial credits",
92
- "tier.paid": "Paid usage",
92
+ "tier.paid": "Paid",
93
93
  "tier.self-hosted": "Self-hosted",
94
94
  "tier.unverified": "Contract unverified \xB7 cannot enable",
95
95
  credentialTitle: "Credential storage",
@@ -100,7 +100,6 @@ var NiteSearchClient = (() => {
100
100
  replaceCredential: "Replace credential",
101
101
  deleteCredential: "Delete credential",
102
102
  deleteCredentialConfirm: "Delete this saved credential? This cannot be undone.",
103
- saveBeforeCredential: "Save the configuration before changing credentials.",
104
103
  credentialSaved: "Credential change confirmed.",
105
104
  credentialFailed: "Credential change could not be confirmed. The input has been cleared; inspect the current state before trying again.",
106
105
  testTitle: "Test a saved backend",
@@ -242,7 +241,6 @@ var NiteSearchClient = (() => {
242
241
  "failure.budget": "Local budget exhausted",
243
242
  "failure.circuit-open": "Circuit open",
244
243
  "failure.unverified": "Unverified backend",
245
- liveVerified: "Live-tested",
246
244
  tabsLabel: "Search settings sections",
247
245
  "tab.behavior": "Search behavior",
248
246
  "tab.reliability": "Reliability",
@@ -254,9 +252,19 @@ var NiteSearchClient = (() => {
254
252
  activeTitle: "This plugin is not the active search provider",
255
253
  activeOther: "The web seam currently selects \u201C{{provider}}\u201D. Searches keep going there until this plugin is selected.",
256
254
  activateSelf: "Use this plugin for web search",
257
- tierCount: "{{total}} total",
258
- tierEnabled: "{{enabled}} on",
259
- tierFiltered: "{{shown}} after filter"
255
+ "choice.oauth": "OAuth",
256
+ "tier.account": "Own account",
257
+ "choice.session": "Browser session cookies",
258
+ colorLegend: "Green: free path, own account or self-hosted. Yellow: free allowance. Red: trial credits or paid. Sorted cheapest first.",
259
+ credentialPending: "Wait for the current action to finish.",
260
+ credentialRefRequired: "Set a credential reference name first.",
261
+ credentialReadOnly: "This reference is read-only: another source supplies its value, so the plugin cannot overwrite it. Pick a different reference name, such as DSH_SEARCH_X_SESSION.",
262
+ credentialPlainKey: "Paste the key itself.",
263
+ credentialShapeLabel: "Credential format",
264
+ "field.tools.webSearchPlus": "Allow web_search_plus",
265
+ "help.tools.webSearchPlus": "Off hides the tool entirely: the agent then searches only through the configured strategy.",
266
+ "field.tools.compactByDefault": "Compact results by default",
267
+ "help.tools.compactByDefault": "Sources carry only URL, title and date. Saves context when the agent only needs links; a call can still ask for full snippets."
260
268
  };
261
269
 
262
270
  // locale/zh.json
@@ -314,10 +322,10 @@ var NiteSearchClient = (() => {
314
322
  notVerified: "\u672A\u6838\u5B9E",
315
323
  noData: "\u6682\u65E0\u6570\u636E",
316
324
  attemptsToday: "\u4ECA\u65E5\u5C1D\u8BD5\u6B21\u6570",
317
- "tier.free": "\u514D\u8D39 \xB7 \u65E0\u9700\u5BC6\u94A5",
318
- "tier.allowance": "\u514D\u8D39\u989D\u5EA6 \xB7 \u9700\u8981\u5BC6\u94A5",
325
+ "tier.free": "\u514D\u8D39",
326
+ "tier.allowance": "\u514D\u8D39\u989D\u5EA6",
319
327
  "tier.trial": "\u8BD5\u7528\u989D\u5EA6",
320
- "tier.paid": "\u4ED8\u8D39\u7528\u91CF",
328
+ "tier.paid": "\u4ED8\u8D39",
321
329
  "tier.self-hosted": "\u81EA\u6258\u7BA1",
322
330
  "tier.unverified": "\u534F\u8BAE\u672A\u6838\u5B9E \xB7 \u4E0D\u53EF\u542F\u7528",
323
331
  credentialTitle: "\u51ED\u8BC1\u5B58\u50A8",
@@ -328,7 +336,6 @@ var NiteSearchClient = (() => {
328
336
  replaceCredential: "\u66FF\u6362\u51ED\u8BC1",
329
337
  deleteCredential: "\u5220\u9664\u51ED\u8BC1",
330
338
  deleteCredentialConfirm: "\u786E\u5B9A\u5220\u9664\u5DF2\u4FDD\u5B58\u7684\u51ED\u8BC1\uFF1F\u6B64\u64CD\u4F5C\u65E0\u6CD5\u64A4\u9500\u3002",
331
- saveBeforeCredential: "\u8BF7\u5148\u4FDD\u5B58\u914D\u7F6E\uFF0C\u518D\u4FEE\u6539\u51ED\u8BC1\u3002",
332
339
  credentialSaved: "\u51ED\u8BC1\u66F4\u6539\u5DF2\u786E\u8BA4\u3002",
333
340
  credentialFailed: "\u65E0\u6CD5\u786E\u8BA4\u51ED\u8BC1\u66F4\u6539\u7ED3\u679C\uFF0C\u8F93\u5165\u5185\u5BB9\u5DF2\u6E05\u7A7A\u3002\u8BF7\u5148\u6838\u5BF9\u5F53\u524D\u72B6\u6001\uFF0C\u518D\u51B3\u5B9A\u662F\u5426\u91CD\u65B0\u64CD\u4F5C\u3002",
334
341
  testTitle: "\u6D4B\u8BD5\u5DF2\u4FDD\u5B58\u7684\u540E\u7AEF",
@@ -470,7 +477,6 @@ var NiteSearchClient = (() => {
470
477
  "failure.budget": "\u672C\u5730\u989D\u5EA6\u8017\u5C3D",
471
478
  "failure.circuit-open": "\u7194\u65AD\u4E2D",
472
479
  "failure.unverified": "\u540E\u7AEF\u672A\u6838\u5B9E",
473
- liveVerified: "\u5DF2\u5B9E\u6D4B",
474
480
  tabsLabel: "\u641C\u7D22\u8BBE\u7F6E\u5206\u533A",
475
481
  "tab.behavior": "\u641C\u7D22\u884C\u4E3A",
476
482
  "tab.reliability": "\u7A33\u5B9A\u6027",
@@ -482,15 +488,25 @@ var NiteSearchClient = (() => {
482
488
  activeTitle: "\u5F53\u524D\u672A\u542F\u7528\u672C\u63D2\u4EF6\u4F5C\u4E3A\u641C\u7D22\u6E90",
483
489
  activeOther: "\u5185\u7F6E\u641C\u7D22\u5F53\u524D\u9009\u62E9\u7684\u662F\u300C{{provider}}\u300D\u3002\u5728\u9009\u4E2D\u672C\u63D2\u4EF6\u4E4B\u524D\uFF0C\u641C\u7D22\u4ECD\u4F1A\u8D70\u5B83\u3002",
484
490
  activateSelf: "\u8BBE\u4E3A\u7F51\u9875\u641C\u7D22\u6765\u6E90",
485
- tierCount: "\u5171 {{total}} \u5BB6",
486
- tierEnabled: "\u542F\u7528 {{enabled}}",
487
- tierFiltered: "\u7B5B\u9009\u540E {{shown}}"
491
+ "choice.oauth": "OAuth \u6388\u6743",
492
+ "tier.account": "\u81EA\u5E26\u8D26\u53F7",
493
+ "choice.session": "\u6D4F\u89C8\u5668\u4F1A\u8BDD Cookie",
494
+ colorLegend: "\u7EFF\u8272\uFF1D\u514D\u8D39/\u81EA\u5E26\u8D26\u53F7/\u81EA\u6258\u7BA1\uFF0C\u9EC4\u8272\uFF1D\u514D\u8D39\u989D\u5EA6\uFF0C\u7EA2\u8272\uFF1D\u8BD5\u7528\u6216\u4ED8\u8D39\u3002\u7531\u4FBF\u5B9C\u5230\u8D35\u6392\u5E8F\u3002",
495
+ credentialPending: "\u5F53\u524D\u64CD\u4F5C\u8FD8\u6CA1\u7ED3\u675F\uFF0C\u7A0D\u7B49\u3002",
496
+ credentialRefRequired: "\u8BF7\u5148\u586B\u4E00\u4E2A\u51ED\u8BC1\u5F15\u7528\u540D\u3002",
497
+ credentialReadOnly: "\u8FD9\u4E2A\u51ED\u8BC1\u5F15\u7528\u662F\u53EA\u8BFB\u7684\uFF1A\u5B83\u7684\u503C\u7531\u5176\u5B83\u6765\u6E90\u63D0\u4F9B\uFF0C\u63D2\u4EF6\u65E0\u6CD5\u8986\u76D6\u3002\u6362\u4E00\u4E2A\u5F15\u7528\u540D\u8BD5\u8BD5\uFF0C\u4F8B\u5982 DSH_SEARCH_X_SESSION\u3002",
498
+ credentialPlainKey: "\u76F4\u63A5\u586B\u5BC6\u94A5\u5B57\u7B26\u4E32\u3002",
499
+ credentialShapeLabel: "\u51ED\u8BC1\u683C\u5F0F",
500
+ "field.tools.webSearchPlus": "\u5141\u8BB8\u4F7F\u7528 web_search_plus",
501
+ "help.tools.webSearchPlus": "\u5173\u95ED\u540E\u8FD9\u4E2A\u5DE5\u5177\u4E0D\u4F1A\u6CE8\u518C\uFF0Cagent \u53EA\u80FD\u7528\u914D\u7F6E\u91CC\u7684\u56FA\u5B9A\u7B56\u7565\u641C\u7D22\u3002",
502
+ "field.tools.compactByDefault": "\u9ED8\u8BA4\u8FD4\u56DE\u7CBE\u7B80\u7ED3\u679C",
503
+ "help.tools.compactByDefault": "\u7ED3\u679C\u53EA\u4FDD\u7559\u94FE\u63A5\u3001\u6807\u9898\u548C\u65E5\u671F\u3002agent \u53EA\u9700\u8981\u94FE\u63A5\u65F6\u80FD\u7701\u4E0B\u5927\u91CF\u4E0A\u4E0B\u6587\uFF1B\u5355\u6B21\u8C03\u7528\u4ECD\u53EF\u8981\u6C42\u5B8C\u6574\u6458\u8981\u3002"
488
504
  };
489
505
 
490
- // src/catalog.ts
506
+ // ../search-core/dist/catalog.js
491
507
  var text = (en, zh) => ({ en, zh });
492
508
  var option = (key, label, zh, value, choices) => ({ key, type: choices ? "select" : typeof value, label: text(label, zh), help: text(`Native ${key} parameter. See the backend documentation.`, `\u539F\u751F ${key} \u53C2\u6570\uFF0C\u8BE6\u89C1\u540E\u7AEF\u6587\u6863\u3002`), default: value, ...choices ? { choices } : {} });
493
- var mode = (access, endpoint, tier, en, zh, pricingUrl) => ({ mode: access, endpoint, tier, limits: text(en, zh), pricingUrl });
509
+ var mode = (access, endpoint, tier, en, zh, pricingUrl, shape) => ({ mode: access, endpoint, tier, limits: text(en, zh), pricingUrl, ...shape ? { credentialShape: text(shape.en, shape.zh) } : {} });
494
510
  var backend = (id, title, docs, modes, options = [], capabilities = [], status = "documented", evidence = "documented") => ({ id, title, docs, modes, options, capabilities, status, evidence, verifiedAt: "2026-11-17" });
495
511
  var catalog = [
496
512
  backend("keenable", "Keenable", "https://docs.keenable.ai/api-reference/search.md", [mode("anonymous", "https://api.keenable.ai/v1/search/public", "free", "1,000 requests/hour and 10/second per IP/endpoint; public title header required.", "\u6BCF IP\uFF0F\u7AEF\u70B9 1000 \u6B21/\u5C0F\u65F6\u300110 \u6B21/\u79D2\uFF1B\u9700\u8981\u516C\u5F00\u8C03\u7528\u6807\u8BC6\u3002", "https://docs.keenable.ai/pricing.md"), mode("key", "https://api.keenable.ai/v1/search", "allowance", "100,000 searches/month free; then $4/1,000. Confirm current account terms.", "\u6BCF\u6708 10 \u4E07\u6B21\u514D\u8D39\uFF0C\u5176\u540E $4/\u5343\u6B21\uFF1B\u4EE5\u8D26\u6237\u5F53\u524D\u6761\u6B3E\u4E3A\u51C6\u3002", "https://docs.keenable.ai/pricing.md")], [option("clientTitle", "Client title", "\u8C03\u7528\u65B9\u540D\u79F0", "dsh-search"), option("snippet_max_length", "Snippet maximum length", "\u6458\u8981\u6700\u5927\u957F\u5EA6", 2e3)], ["includeDomains"], "documented", "live"),
@@ -513,14 +529,16 @@ var NiteSearchClient = (() => {
513
529
  backend("doubao", "Volcengine Doubao", "https://docs.volcengine.com/docs/networked-search/networked-search?lang=zh", [mode("key", "https://open.feedcoopapi.com/search_api/web_search", "allowance", "500/month shared free allowance, 10 QPS; usage-based web \xA50.020/request. Subscription keys have independent limits.", "\u6BCF\u6708\u5171\u4EAB 500 \u6B21\u514D\u8D39\uFF0C10 QPS\uFF1B\u6309\u91CF web \xA50.020/\u6B21\uFF1B\u8BA2\u9605 Key \u6709\u72EC\u7ACB\u9650\u5236\u3002", "https://docs.volcengine.com/docs/networked-search/online-search-product-billing?lang=zh")], [option("queryRewrite", "Provider query rewrite", "\u4F9B\u5E94\u5546\u6539\u5199\u67E5\u8BE2", false)]),
514
530
  backend("open-websearch", "open-websearch", "https://github.com/Aas-ee/open-webSearch", [mode("anonymous", "http://127.0.0.1:3210/search", "self-hosted", "Self-hosted daemon; no guaranteed quota, engine blocking and infrastructure costs apply. Project personal-use restrictions apply.", "\u81EA\u5EFA daemon\uFF0C\u65E0\u4FDD\u8BC1\u989D\u5EA6\uFF1B\u6709\u5F15\u64CE\u9650\u6D41\u53CA\u8FD0\u884C\u6210\u672C\uFF0C\u6CE8\u610F\u9879\u76EE\u4E2A\u4EBA\u4F7F\u7528\u9650\u5236\u3002", "https://github.com/Aas-ee/open-webSearch")], [option("engine", "Fixed upstream engine", "\u56FA\u5B9A\u4E0A\u6E38\u5F15\u64CE", "duckduckgo"), option("searchMode", "Request strategy", "\u8BF7\u6C42\u65B9\u5F0F", "request", ["request", "playwright"])]),
515
531
  backend("serpex", "Serpex", "https://serpex.dev/docs/api/search", [mode("key", "https://api.serpex.dev/api/search", "trial", "200 one-time credits; paid top-ups start around $0.80/1,000. Vendor routes internally; no fixed upstream engine.", "\u4E00\u6B21\u6027 200 credits\uFF1B\u5145\u503C\u7EA6 $0.80/\u5343\u6B21\u8D77\uFF1B\u4F9B\u5E94\u5546\u5185\u90E8\u8DEF\u7531\uFF0C\u4E0D\u80FD\u56FA\u5B9A\u5176\u4E0A\u6E38\u5F15\u64CE\u3002", "https://serpex.dev/docs/getting-started/pricing")]),
516
- backend("tencent-wsa", "Tencent Cloud WSA", "https://cloud.tencent.com/document/product/1806/121811", [mode("key", "https://wsa.tencentcloudapi.com/", "paid", "\xA514/\xA520/\xA526 per 1,000 by tier. Store a JSON credential {secretId,secretKey}; no free allowance verified.", "\u5206\u6863 \xA514\uFF0F\xA520\uFF0F\xA526 \u6BCF\u5343\u6B21\u3002\u51ED\u8BC1\u586B\u5199 JSON {secretId,secretKey}\uFF1B\u514D\u8D39\u989D\u5EA6\u672A\u6838\u5B9E\u3002", "https://cloud.tencent.com/product/wsa")], [{ ...option("Mode", "Search mode", "\u641C\u7D22\u6A21\u5F0F", 0), min: 0, max: 2 }])
532
+ backend("x", "X (Twitter)", "https://docs.x.com/x-api/posts/search/quickstart/recent-search", [mode("session", "https://x.com/i/api/graphql", "account", "Uses the browser session cookies (auth_token, ct0) of your own X account. No fee, but X changes its request signing and query ids regularly, so this mode can break until the adapter is updated.", "\u4F7F\u7528\u4F60\u81EA\u5DF1 X \u8D26\u53F7\u7684\u7F51\u9875 cookie\uFF08auth_token\u3001ct0\uFF09\u3002\u4E0D\u4EA7\u751F\u8D39\u7528\uFF0C\u4F46 X \u4F1A\u4E0D\u5B9A\u671F\u6539\u52A8\u524D\u7AEF\u7B7E\u540D\u4E0E queryId\uFF0C\u5931\u6548\u540E\u9700\u8981\u7EF4\u62A4\u8005\u66F4\u65B0\u9002\u914D\u5668\u3002", "https://github.com/bestnite/x-mcp", { en: '{"authToken":"...","ct0":"..."}, or paste auth_token=...; ct0=... straight from DevTools', zh: '{"authToken":"...","ct0":"..."}\uFF0C\u4E5F\u53EF\u4EE5\u76F4\u63A5\u7C98\u8D34\u6D4F\u89C8\u5668\u91CC\u7684 auth_token=...; ct0=...' }), mode("key", "https://api.x.com/2/tweets/search/recent", "paid", "Official API with an app-only bearer token as the key. Pay per post read: about $0.005 each, so a 10-result search costs roughly $0.05. Recent search covers the last 7 days; reads are capped by the posts-per-search option.", "\u5B98\u65B9 API\uFF0C\u5BC6\u94A5\u586B app-only bearer token\u3002\u6309\u8BFB\u53D6\u5E16\u6570\u8BA1\u8D39\uFF1A\u7EA6 $0.005/\u6761\uFF0C\u53D6 10 \u6761\u7EA6 $0.05\u3002\u8FD1\u671F\u641C\u7D22\u53EA\u8986\u76D6\u6700\u8FD1 7 \u5929\uFF0C\u8BFB\u53D6\u6761\u6570\u53D7\u300C\u6BCF\u6B21\u641C\u7D22\u5E16\u6570\u300D\u53C2\u6570\u9650\u5236\u3002", "https://docs.x.com/x-api/getting-started/pricing", { en: '{"bearerToken":"<app-only bearer token>"}', zh: '{"bearerToken":"<app-only bearer \u4EE4\u724C>"}' })], [option("postsPerSearch", "Posts read per search", "\u6BCF\u6B21\u641C\u7D22\u8BFB\u53D6\u5E16\u6570", 10)], ["recency"]),
533
+ backend("reddit", "Reddit", "https://github.com/reddit-archive/reddit/wiki/API", [mode("anonymous", "https://gql-fed.reddit.com/", "free", "No credentials. Uses the Reddit Android app endpoint, because the public REST search and comments endpoints answer 403 to anonymous tokens since 2026-10. No published quota; shared rate limits.", "\u65E0\u9700\u51ED\u8BC1\u3002\u8D70 Reddit \u5B89\u5353\u5BA2\u6237\u7AEF\u7AEF\u70B9\u2014\u2014\u81EA 2026-10 \u8D77\u516C\u5F00 REST \u7684\u641C\u7D22\u4E0E\u8BC4\u8BBA\u5BF9\u533F\u540D token \u4E00\u5F8B\u8FD4\u56DE 403\u3002\u989D\u5EA6\u672A\u516C\u5E03\uFF0C\u5C5E\u5171\u4EAB\u9650\u6D41\u3002", "https://github.com/bestnite/reddit-readonly-mcp"), mode("oauth", "https://oauth.reddit.com/search", "allowance", "Official OAuth API: about 100 queries/minute per client for non-commercial use. client_credentials reads public data; add a username and password for a script grant.", "\u5B98\u65B9 OAuth API\uFF1A\u975E\u5546\u4E1A\u7528\u9014\u7EA6\u6BCF\u5BA2\u6237\u7AEF 100 \u6B21/\u5206\u949F\u3002client_credentials \u5373\u53EF\u8BFB\u516C\u5F00\u6570\u636E\uFF1B\u8865\u7528\u6237\u540D\u5BC6\u7801\u5219\u7528 script \u6388\u6743\u3002", "https://support.reddithelp.com/hc/en-us/articles/16160319875092-Reddit-Data-API-Wiki", { en: '{"clientId":"...","clientSecret":"..."}; add "username" and "password" for a script grant', zh: '{"clientId":"...","clientSecret":"..."}\uFF1B\u9700\u8981\u811A\u672C\u6388\u6743\u5C31\u518D\u52A0 "username" \u4E0E "password"' })], [option("sort", "Sort", "\u6392\u5E8F", "relevance", ["relevance", "hot", "top", "new", "comments"]), option("time", "Time window", "\u65F6\u95F4\u8303\u56F4", "all", ["all", "hour", "day", "week", "month", "year"]), option("subreddit", "Limit to subreddit", "\u9650\u5B9A\u7248\u5757", "")], ["recency"]),
534
+ backend("tencent-wsa", "Tencent Cloud WSA", "https://cloud.tencent.com/document/product/1806/121811", [mode("key", "https://wsa.tencentcloudapi.com/", "paid", "\xA514/\xA520/\xA526 per 1,000 by tier. Store a JSON credential {secretId,secretKey}; no free allowance verified.", "\u5206\u6863 \xA514\uFF0F\xA520\uFF0F\xA526 \u6BCF\u5343\u6B21\u3002\u51ED\u8BC1\u586B\u5199 JSON {secretId,secretKey}\uFF1B\u514D\u8D39\u989D\u5EA6\u672A\u6838\u5B9E\u3002", "https://cloud.tencent.com/product/wsa", { en: '{"secretId":"...","secretKey":"..."}', zh: '{"secretId":"...","secretKey":"..."}' })], [{ ...option("Mode", "Search mode", "\u641C\u7D22\u6A21\u5F0F", 0), min: 0, max: 2 }])
517
535
  ];
518
536
 
519
- // src/locale-map.ts
537
+ // ../search-core/dist/locale-map.js
520
538
  var LANGUAGES = ["", "en", "zh-Hans", "zh-Hant", "ja", "ko", "fr", "de", "es", "pt", "ru", "it", "ar", "nl", "pl", "tr", "vi", "th", "id"];
521
539
  var REGIONS = ["", "US", "GB", "CN", "HK", "TW", "JP", "KR", "SG", "IN", "AU", "CA", "DE", "FR", "ES", "IT", "NL", "BR", "MX", "RU", "TR", "SA"];
522
540
 
523
- // src/config.ts
541
+ // ../search-core/dist/config.js
524
542
  function defaultConfig() {
525
543
  return {
526
544
  mode: "parallel",
@@ -540,6 +558,7 @@ var NiteSearchClient = (() => {
540
558
  cache: { enabled: true, ttlSeconds: 900, maxEntries: 100 },
541
559
  breaker: { enabled: false, threshold: 3, cooldownMs: 6e4 },
542
560
  diagnostics: { enabled: true, maxEntries: 50 },
561
+ tools: { webSearchPlus: true, compactByDefault: false },
543
562
  backends: Object.fromEntries(catalog.map((d) => [d.id, { enabled: false, mode: d.modes[0].mode, endpoint: d.modes[0].endpoint, credentialRef: `DSH_SEARCH_${d.id.replaceAll("-", "_").toUpperCase()}_KEY`, timeoutMs: 15e3, rateLimitPerMinute: 0, dailyAttemptLimit: 0, options: Object.fromEntries(d.options.map((o) => [o.key, o.default])) }]))
544
563
  };
545
564
  }
@@ -547,38 +566,52 @@ var NiteSearchClient = (() => {
547
566
  const issues = [];
548
567
  const fail = (path, message) => issues.push({ path, message });
549
568
  const object = (v) => !!v && typeof v === "object" && !Array.isArray(v);
550
- if (!object(value)) return [{ path: "config", message: "Expected a configuration object." }];
569
+ if (!object(value))
570
+ return [{ path: "config", message: "Expected a configuration object." }];
551
571
  function shape(v, exemplar, path) {
552
572
  if (Array.isArray(exemplar)) {
553
573
  if (!Array.isArray(v)) {
554
574
  fail(path, "Expected an array.");
555
575
  return;
556
576
  }
557
- if (v.length > 200) fail(path, "Too many entries.");
577
+ if (v.length > 200)
578
+ fail(path, "Too many entries.");
558
579
  if (path === "retry.statuses") {
559
- if (v.some((n) => !Number.isInteger(n) || n < 400 || n > 599)) fail(path, "Expected HTTP error status codes (400\u2013599).");
560
- } else if (v.some((x) => typeof x !== "string" || x.length > 253 || !/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/.test(x))) fail(path, "Expected domain names without scheme, path, or wildcards.");
580
+ if (v.some((n) => !Number.isInteger(n) || n < 400 || n > 599))
581
+ fail(path, "Expected HTTP error status codes (400\u2013599).");
582
+ } else if (v.some((x) => typeof x !== "string" || x.length > 253 || !/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/.test(x)))
583
+ fail(path, "Expected domain names without scheme, path, or wildcards.");
561
584
  } else if (object(exemplar)) {
562
585
  if (!object(v)) {
563
586
  fail(path, "Expected an object.");
564
587
  return;
565
588
  }
566
- for (const k of Object.keys(v)) if (!(k in exemplar) && path !== "backends") fail(path ? `${path}.${k}` : k, "Unknown configuration field.");
567
- for (const [k, e] of Object.entries(exemplar)) shape(v[k], e, path ? `${path}.${k}` : k);
568
- } else if (typeof v !== typeof exemplar || typeof v === "number" && !Number.isFinite(v)) fail(path, `Expected ${typeof exemplar}.`);
569
- else if (typeof v === "string" && v.length > 4096) fail(path, "Value is too long.");
589
+ for (const k of Object.keys(v))
590
+ if (!(k in exemplar) && path !== "backends")
591
+ fail(path ? `${path}.${k}` : k, "Unknown configuration field.");
592
+ for (const [k, e] of Object.entries(exemplar))
593
+ shape(v[k], e, path ? `${path}.${k}` : k);
594
+ } else if (typeof v !== typeof exemplar || typeof v === "number" && !Number.isFinite(v))
595
+ fail(path, `Expected ${typeof exemplar}.`);
596
+ else if (typeof v === "string" && v.length > 4096)
597
+ fail(path, "Value is too long.");
570
598
  }
571
599
  shape(value, defaultConfig(), "");
572
- if (issues.length) return issues;
600
+ if (issues.length)
601
+ return issues;
573
602
  const c = value;
574
603
  const choice = (v, allowed, p) => {
575
- if (!allowed.includes(v)) fail(p, "Unsupported selection.");
604
+ if (!allowed.includes(v))
605
+ fail(p, "Unsupported selection.");
576
606
  };
577
607
  const num = (v, min, max, p) => {
578
- if (!Number.isInteger(v) || v < min || v > max) fail(p, `Expected an integer between ${min} and ${max}.`);
608
+ if (!Number.isInteger(v) || v < min || v > max)
609
+ fail(p, `Expected an integer between ${min} and ${max}.`);
579
610
  };
580
- if (c.language && !LANGUAGES.includes(c.language)) fail("language", "Unsupported language code.");
581
- if (c.region && !REGIONS.includes(c.region)) fail("region", "Unsupported region code.");
611
+ if (c.language && !LANGUAGES.includes(c.language))
612
+ fail("language", "Unsupported language code.");
613
+ if (c.region && !REGIONS.includes(c.region))
614
+ fail("region", "Unsupported region code.");
582
615
  choice(c.mode, ["single", "parallel"], "mode");
583
616
  choice(c.singleBackend, catalog.map((x) => x.id), "singleBackend");
584
617
  choice(c.recency, ["any", "day", "week", "month", "year"], "recency");
@@ -590,7 +623,8 @@ var NiteSearchClient = (() => {
590
623
  num(c.retry.maxRetries, 0, 5, "retry.maxRetries");
591
624
  num(c.retry.initialDelayMs, 0, 6e4, "retry.initialDelayMs");
592
625
  num(c.retry.maxDelayMs, 0, 12e4, "retry.maxDelayMs");
593
- if (c.retry.initialDelayMs > c.retry.maxDelayMs) fail("retry.maxDelayMs", "Maximum delay must not be shorter than initial delay.");
626
+ if (c.retry.initialDelayMs > c.retry.maxDelayMs)
627
+ fail("retry.maxDelayMs", "Maximum delay must not be shorter than initial delay.");
594
628
  num(c.cache.ttlSeconds, 1, 86400, "cache.ttlSeconds");
595
629
  num(c.cache.maxEntries, 1, 1e3, "cache.maxEntries");
596
630
  num(c.breaker.threshold, 1, 100, "breaker.threshold");
@@ -600,25 +634,32 @@ var NiteSearchClient = (() => {
600
634
  const b = c.backends[d.id];
601
635
  const p = `backends.${d.id}`;
602
636
  choice(b.mode, d.modes.map((m) => m.mode), `${p}.mode`);
603
- if (b.enabled && d.status === "unverified") fail(`${p}.enabled`, "Backend protocol is not verified.");
637
+ if (b.enabled && d.status === "unverified")
638
+ fail(`${p}.enabled`, "Backend protocol is not verified.");
604
639
  if (b.endpoint) {
605
640
  try {
606
641
  const url = new URL(b.endpoint);
607
- if (!["http:", "https:"].includes(url.protocol) || url.username || url.password || url.hash || url.search) throw 0;
642
+ if (!["http:", "https:"].includes(url.protocol) || url.username || url.password || url.hash || url.search)
643
+ throw 0;
608
644
  const local = url.hostname === "localhost" || url.hostname === "127.0.0.1" || url.hostname === "[::1]";
609
- if (url.protocol === "http:" && !local) throw 0;
645
+ if (url.protocol === "http:" && !local)
646
+ throw 0;
610
647
  } catch {
611
648
  fail(`${p}.endpoint`, "Use an HTTPS endpoint without credentials, query, or fragment; HTTP is allowed only on loopback.");
612
649
  }
613
- } else if (b.enabled) fail(`${p}.endpoint`, "An endpoint is required.");
614
- if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(b.credentialRef)) fail(`${p}.credentialRef`, "Expected an environment-style credential reference.");
650
+ } else if (b.enabled)
651
+ fail(`${p}.endpoint`, "An endpoint is required.");
652
+ if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(b.credentialRef))
653
+ fail(`${p}.credentialRef`, "Expected an environment-style credential reference.");
615
654
  num(b.timeoutMs, 1e3, 12e4, `${p}.timeoutMs`);
616
655
  num(b.rateLimitPerMinute, 0, 1e5, `${p}.rateLimitPerMinute`);
617
656
  num(b.dailyAttemptLimit, 0, 1e6, `${p}.dailyAttemptLimit`);
618
657
  for (const o of d.options) {
619
658
  const v = b.options[o.key];
620
- if (o.choices && !o.choices.includes(String(v))) fail(`${p}.options.${o.key}`, "Unsupported option.");
621
- if (typeof v === "number") num(v, o.min ?? 1, o.max ?? 1e5, `${p}.options.${o.key}`);
659
+ if (o.choices && !o.choices.includes(String(v)))
660
+ fail(`${p}.options.${o.key}`, "Unsupported option.");
661
+ if (typeof v === "number")
662
+ num(v, o.min ?? 1, o.max ?? 1e5, `${p}.options.${o.key}`);
622
663
  }
623
664
  }
624
665
  return issues;
@@ -875,13 +916,13 @@ var NiteSearchClient = (() => {
875
916
  }
876
917
  }
877
918
  async function credential(id, remove) {
878
- if (!snapshot || dirty) return;
879
- const backend2 = snapshot.config.backends[id];
919
+ if (!snapshot) return;
920
+ const reference = draft.backends[id]?.credentialRef;
880
921
  setPending(`credential-${id}`);
881
922
  setFailed(false);
882
923
  setNotice("working");
883
924
  try {
884
- await request("credential", { backendId: id, ref: backend2.credentialRef, ...remove ? { remove: true } : { value: secrets[id] } });
925
+ await request("credential", { backendId: id, ref: reference, ...remove ? { remove: true } : { value: secrets[id] } });
885
926
  setSecrets((previous) => ({ ...previous, [id]: "" }));
886
927
  await refresh();
887
928
  setNotice("credentialSaved");
@@ -933,9 +974,29 @@ var NiteSearchClient = (() => {
933
974
  if (backendFilter === "configured" && !snapshot?.credentials[def.id]?.configured) return false;
934
975
  return true;
935
976
  };
936
- const tierOf = (def) => def.status === "unverified" ? "unverified" : def.modes.find((mode2) => mode2.mode === draft.backends[def.id]?.mode)?.tier || "unverified";
977
+ const TIER_ORDER = ["free", "account", "self-hosted", "allowance", "trial", "paid", "unverified"];
978
+ const tierRank = (tier) => {
979
+ const index = TIER_ORDER.indexOf(tier);
980
+ return index < 0 ? TIER_ORDER.length : index;
981
+ };
982
+ const bestTier = (def) => def.status === "unverified" ? "unverified" : def.modes.reduce((best, mode2) => tierRank(mode2.tier) < tierRank(best) ? mode2.tier : best, def.modes[0]?.tier || "unverified");
983
+ const readyRank = (def) => {
984
+ const backend2 = draft.backends[def.id];
985
+ const selected = def.modes.find((mode2) => mode2.mode === backend2?.mode)?.tier;
986
+ return (backend2?.enabled ? 0 : 2) + (selected === "free" ? 0 : 1);
987
+ };
988
+ const ranked = definitions.slice().sort((left, right) => tierRank(bestTier(left)) - tierRank(bestTier(right)) || readyRank(left) - readyRank(right) || left.title.localeCompare(right.title));
937
989
  const tierRisk = (tier) => tier === "paid" || tier === "trial" ? "ns-chip--risk" : tier === "unverified" ? "ns-chip--off" : tier === "allowance" ? "ns-chip--warn" : "ns-chip--ok";
938
990
  const TABS = ["behavior", "reliability", "diagnostics", "backends"];
991
+ const credentialDisabledReason = (id) => {
992
+ if (pending) return t("credentialPending");
993
+ const reference = draft.backends[id]?.credentialRef;
994
+ if (!reference) return t("credentialRefRequired");
995
+ const savedReference = snapshot?.config.backends[id]?.credentialRef;
996
+ if (reference === savedReference && snapshot?.credentials[id] && !snapshot.credentials[id].writable) return t("credentialReadOnly");
997
+ return "";
998
+ };
999
+ const credentialDisabled = (id) => credentialDisabledReason(id) !== "";
939
1000
  return /* @__PURE__ */ React.createElement("div", { className: "ns-page", "aria-busy": !!pending }, /* @__PURE__ */ React.createElement("style", null, client_default, client_overrides_default), /* @__PURE__ */ React.createElement("header", { className: "ns-header" }, /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("h2", null, t("title")), /* @__PURE__ */ React.createElement("p", null, tr("intro", { enabled: enabledCount, total: definitions.length })))), /* @__PURE__ */ React.createElement("div", { className: "ns-status", role: "status", "aria-live": "polite" }, /* @__PURE__ */ React.createElement("span", { className: failed ? "ns-error" : "" }, notice ? t(notice) : !snapshot ? t("loading") : dirty ? t("unsaved") : t("upToDate")), !!pending && /* @__PURE__ */ React.createElement("span", null, t("pending"))), !!issues.length && /* @__PURE__ */ React.createElement("div", { className: "ns-summary", role: "alert", tabIndex: -1, ref: summary }, /* @__PURE__ */ React.createElement("h3", null, t("validationTitle")), /* @__PURE__ */ React.createElement("ul", null, issues.map((issue, index) => /* @__PURE__ */ React.createElement("li", { key: `${issue.path}-${index}` }, /* @__PURE__ */ React.createElement("a", { href: `#${fieldId(issue.path)}`, onClick: (event) => {
940
1001
  event.preventDefault();
941
1002
  focusPath(issue.path);
@@ -952,7 +1013,7 @@ var NiteSearchClient = (() => {
952
1013
  } finally {
953
1014
  setPending("");
954
1015
  }
955
- } }, t("reload")) : /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", { className: "ns-tabs", role: "tablist", "aria-label": t("tabsLabel") }, TABS.map((id) => /* @__PURE__ */ React.createElement("button", { key: id, role: "tab", type: "button", id: `tab-${id}`, "aria-selected": tab === id, "aria-controls": `panel-${id}`, className: `ns-tab ${tab === id ? "is-active" : ""}`, onClick: () => setTab(id) }, t(`tab.${id}`), id === "backends" && /* @__PURE__ */ React.createElement("span", { className: "ns-tab-count" }, enabledCount, "/", definitions.length)))), tab === "behavior" && /* @__PURE__ */ React.createElement("div", { role: "tabpanel", id: "panel-behavior", "aria-labelledby": "tab-behavior" }, /* @__PURE__ */ React.createElement("section", { className: "ns-card", "aria-labelledby": "sec-behavior" }, /* @__PURE__ */ React.createElement("h3", { id: "sec-behavior" }, t("general")), /* @__PURE__ */ React.createElement("div", { className: "ns-grid" }, fields(["mode", "singleBackend", "maxResults", "concurrency", "overallTimeoutMs", "language", "region", "recency", "safeSearch", "includeDomains", "excludeDomains", "dedup", "fusion"], { mode: { choices: ["single", "parallel"] }, singleBackend: { choices: definitions.map((def) => def.id) }, maxResults: { type: "number" }, concurrency: { type: "number" }, overallTimeoutMs: { type: "number" }, language: { choices: [...LANGUAGES] }, region: { choices: [...REGIONS] }, recency: { choices: ["any", "day", "week", "month", "year"] }, safeSearch: { type: "checkbox" }, includeDomains: { type: "list" }, excludeDomains: { type: "list" }, dedup: { choices: ["url", "url-title"] }, fusion: { choices: ["rrf", "ordered"] } })))), tab === "reliability" && /* @__PURE__ */ React.createElement("div", { role: "tabpanel", id: "panel-reliability", "aria-labelledby": "tab-reliability" }, section("resilience", ["sec-resilience"], ["retry.enabled", "retry.maxRetries", "retry.initialDelayMs", "retry.maxDelayMs", "retry.networkErrors", "retry.timeouts", "breaker.enabled", "breaker.threshold", "breaker.cooldownMs"], { "retry.enabled": { type: "checkbox" }, "retry.maxRetries": { type: "number" }, "retry.initialDelayMs": { type: "number" }, "retry.maxDelayMs": { type: "number" }, "retry.networkErrors": { type: "checkbox" }, "retry.timeouts": { type: "checkbox" }, "breaker.enabled": { type: "checkbox" }, "breaker.threshold": { type: "number" }, "breaker.cooldownMs": { type: "number" } }), draft.retry.enabled && /* @__PURE__ */ React.createElement("section", { className: "ns-card", "aria-labelledby": "sec-retry-statuses" }, /* @__PURE__ */ React.createElement("h3", { id: "sec-retry-statuses" }, t("field.retry.statuses")), /* @__PURE__ */ React.createElement("p", { className: "ns-muted" }, t("help.retry.statuses")), /* @__PURE__ */ React.createElement("div", { className: "ns-statuses" }, RETRY_STATUSES.map((code) => /* @__PURE__ */ React.createElement("label", { key: code, className: "ns-status-choice" }, /* @__PURE__ */ React.createElement("input", { type: "checkbox", checked: draft.retry.statuses.includes(code), disabled: !!pending, onChange: (event) => update("retry.statuses", event.target.checked ? [...draft.retry.statuses, code].sort((a, b) => a - b) : draft.retry.statuses.filter((item) => item !== code)) }), /* @__PURE__ */ React.createElement("span", null, code)))), !!issues.filter((issue) => issue.path === "retry.statuses").length && /* @__PURE__ */ React.createElement("p", { className: "ns-error", role: "alert" }, t("invalidField"))), section("storage", ["sec-storage"], ["cache.enabled", "cache.ttlSeconds", "cache.maxEntries", "diagnostics.enabled", "diagnostics.maxEntries"], { "cache.enabled": { type: "checkbox" }, "cache.ttlSeconds": { type: "number" }, "cache.maxEntries": { type: "number" }, "diagnostics.enabled": { type: "checkbox" }, "diagnostics.maxEntries": { type: "number" } })), tab === "diagnostics" && /* @__PURE__ */ React.createElement("div", { role: "tabpanel", id: "panel-diagnostics", "aria-labelledby": "tab-diagnostics" }, /* @__PURE__ */ React.createElement("section", { className: "ns-card", "aria-labelledby": "sec-test" }, /* @__PURE__ */ React.createElement("h3", { id: "sec-test" }, t("testTitle")), /* @__PURE__ */ React.createElement("p", null, t("testHelp")), enabledSaved.length === 0 ? /* @__PURE__ */ React.createElement("p", { className: "ns-muted" }, t("testNeedsBackend")) : /* @__PURE__ */ React.createElement("div", { className: "ns-grid" }, /* @__PURE__ */ React.createElement("div", { className: "ns-field" }, /* @__PURE__ */ React.createElement("label", { htmlFor: "ns-test-backend" }, t("testBackend")), /* @__PURE__ */ React.createElement("select", { id: "ns-test-backend", disabled: !!pending || dirty, value: testBackend, onChange: (event) => setTestBackend(event.target.value) }, enabledSaved.map((def) => /* @__PURE__ */ React.createElement("option", { value: def.id, key: def.id }, def.title)))), /* @__PURE__ */ React.createElement("div", { className: "ns-field" }, /* @__PURE__ */ React.createElement("label", { htmlFor: "ns-test-query" }, t("testQuery")), /* @__PURE__ */ React.createElement("input", { id: "ns-test-query", value: query, disabled: !!pending || dirty, onChange: (event) => setQuery(event.target.value), placeholder: t("testQueryPlaceholder") }))), enabledSaved.length > 0 && /* @__PURE__ */ React.createElement("div", { className: "ns-test-actions" }, /* @__PURE__ */ React.createElement("button", { className: "ns-primary", disabled: !!pending || dirty || !query.trim() || !enabledSaved.some((def) => def.id === testBackend), onClick: () => action("test", { backendId: testBackend, query }) }, t("runTest")), dirty && /* @__PURE__ */ React.createElement("small", null, t("saveBeforeTest"))), testResult && /* @__PURE__ */ React.createElement("div", { className: "ns-result" }, /* @__PURE__ */ React.createElement("h4", null, t("testResult")), testResult.sources?.length ? /* @__PURE__ */ React.createElement("ol", { className: "ns-sources" }, testResult.sources.map((source, index) => /* @__PURE__ */ React.createElement("li", { key: `${source.url}-${index}` }, /* @__PURE__ */ React.createElement("a", { href: source.url, target: "_blank", rel: "noreferrer" }, source.title || source.url), /* @__PURE__ */ React.createElement("p", { className: "ns-muted" }, source.url), source.snippet && /* @__PURE__ */ React.createElement("p", null, source.snippet)))) : /* @__PURE__ */ React.createElement("p", { className: "ns-muted" }, t("noSources")), (testResult.outcomes || []).filter((outcome) => !outcome.ok).map((outcome) => /* @__PURE__ */ React.createElement("div", { className: "ns-failure", key: outcome.backend }, /* @__PURE__ */ React.createElement("h5", null, t("testFailure")), /* @__PURE__ */ React.createElement("dl", null, /* @__PURE__ */ React.createElement("dt", null, t("diagnostic.backend")), /* @__PURE__ */ React.createElement("dd", null, outcome.backend), /* @__PURE__ */ React.createElement("dt", null, t("diagnostic.mode")), /* @__PURE__ */ React.createElement("dd", null, t(`choice.${outcome.mode}`)), /* @__PURE__ */ React.createElement("dt", null, t("diagnostic.attempts")), /* @__PURE__ */ React.createElement("dd", null, outcome.attempts), /* @__PURE__ */ React.createElement("dt", null, t("diagnostic.reason")), /* @__PURE__ */ React.createElement("dd", null, t(`failure.${outcome.error?.kind || "protocol"}`), outcome.error?.status ? ` \xB7 HTTP ${outcome.error.status}` : ""), /* @__PURE__ */ React.createElement("dt", null, t("diagnostic.message")), /* @__PURE__ */ React.createElement("dd", null, outcome.error?.message)))), (testResult.outcomes || []).flatMap((outcome) => outcome.warnings.map((warning) => /* @__PURE__ */ React.createElement("p", { className: "ns-muted", key: `${outcome.backend}-${warning}` }, "[", outcome.backend, "] ", warning))))), /* @__PURE__ */ React.createElement("section", { className: "ns-card", "aria-labelledby": "sec-diagnostics" }, /* @__PURE__ */ React.createElement("h3", { id: "sec-diagnostics" }, t("diagnosticsTitle")), /* @__PURE__ */ React.createElement("p", null, t("diagnosticsHelp")), /* @__PURE__ */ React.createElement("div", { className: "ns-actions" }, /* @__PURE__ */ React.createElement("button", { disabled: !!pending, onClick: () => action("clear-cache") }, t("clearCache")), /* @__PURE__ */ React.createElement("button", { disabled: !!pending, onClick: () => setConfirming({ kind: "clear-diagnostics" }) }, t("clearDiagnostics")), /* @__PURE__ */ React.createElement("button", { disabled: !!pending, onClick: async () => {
1016
+ } }, t("reload")) : /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", { className: "ns-tabs", role: "tablist", "aria-label": t("tabsLabel") }, TABS.map((id) => /* @__PURE__ */ React.createElement("button", { key: id, role: "tab", type: "button", id: `tab-${id}`, "aria-selected": tab === id, "aria-controls": `panel-${id}`, className: `ns-tab ${tab === id ? "is-active" : ""}`, onClick: () => setTab(id) }, t(`tab.${id}`), id === "backends" && /* @__PURE__ */ React.createElement("span", { className: "ns-tab-count" }, enabledCount, "/", definitions.length)))), tab === "behavior" && /* @__PURE__ */ React.createElement("div", { role: "tabpanel", id: "panel-behavior", "aria-labelledby": "tab-behavior" }, /* @__PURE__ */ React.createElement("section", { className: "ns-card", "aria-labelledby": "sec-behavior" }, /* @__PURE__ */ React.createElement("h3", { id: "sec-behavior" }, t("general")), /* @__PURE__ */ React.createElement("div", { className: "ns-grid" }, fields(["safeSearch", "tools.webSearchPlus", "tools.compactByDefault", "mode", "singleBackend", "maxResults", "concurrency", "overallTimeoutMs", "language", "region", "recency", "includeDomains", "excludeDomains", "dedup", "fusion"], { "tools.webSearchPlus": { type: "checkbox" }, "tools.compactByDefault": { type: "checkbox" }, mode: { choices: ["single", "parallel"] }, singleBackend: { choices: definitions.map((def) => def.id) }, maxResults: { type: "number" }, concurrency: { type: "number" }, overallTimeoutMs: { type: "number" }, language: { choices: [...LANGUAGES] }, region: { choices: [...REGIONS] }, recency: { choices: ["any", "day", "week", "month", "year"] }, safeSearch: { type: "checkbox" }, includeDomains: { type: "list" }, excludeDomains: { type: "list" }, dedup: { choices: ["url", "url-title"] }, fusion: { choices: ["rrf", "ordered"] } })))), tab === "reliability" && /* @__PURE__ */ React.createElement("div", { role: "tabpanel", id: "panel-reliability", "aria-labelledby": "tab-reliability" }, section("resilience", ["sec-resilience"], ["retry.enabled", "breaker.enabled", "retry.maxRetries", "retry.initialDelayMs", "retry.maxDelayMs", "retry.networkErrors", "retry.timeouts", "breaker.threshold", "breaker.cooldownMs"], { "retry.enabled": { type: "checkbox" }, "retry.maxRetries": { type: "number" }, "retry.initialDelayMs": { type: "number" }, "retry.maxDelayMs": { type: "number" }, "retry.networkErrors": { type: "checkbox" }, "retry.timeouts": { type: "checkbox" }, "breaker.enabled": { type: "checkbox" }, "breaker.threshold": { type: "number" }, "breaker.cooldownMs": { type: "number" } }), draft.retry.enabled && /* @__PURE__ */ React.createElement("section", { className: "ns-card", "aria-labelledby": "sec-retry-statuses" }, /* @__PURE__ */ React.createElement("h3", { id: "sec-retry-statuses" }, t("field.retry.statuses")), /* @__PURE__ */ React.createElement("p", { className: "ns-muted" }, t("help.retry.statuses")), /* @__PURE__ */ React.createElement("div", { className: "ns-statuses" }, RETRY_STATUSES.map((code) => /* @__PURE__ */ React.createElement("label", { key: code, className: "ns-status-choice" }, /* @__PURE__ */ React.createElement("input", { type: "checkbox", checked: draft.retry.statuses.includes(code), disabled: !!pending, onChange: (event) => update("retry.statuses", event.target.checked ? [...draft.retry.statuses, code].sort((a, b) => a - b) : draft.retry.statuses.filter((item) => item !== code)) }), /* @__PURE__ */ React.createElement("span", null, code)))), !!issues.filter((issue) => issue.path === "retry.statuses").length && /* @__PURE__ */ React.createElement("p", { className: "ns-error", role: "alert" }, t("invalidField"))), section("storage", ["sec-storage"], ["cache.enabled", "diagnostics.enabled", "cache.ttlSeconds", "cache.maxEntries", "diagnostics.maxEntries"], { "cache.enabled": { type: "checkbox" }, "cache.ttlSeconds": { type: "number" }, "cache.maxEntries": { type: "number" }, "diagnostics.enabled": { type: "checkbox" }, "diagnostics.maxEntries": { type: "number" } })), tab === "diagnostics" && /* @__PURE__ */ React.createElement("div", { role: "tabpanel", id: "panel-diagnostics", "aria-labelledby": "tab-diagnostics" }, /* @__PURE__ */ React.createElement("section", { className: "ns-card", "aria-labelledby": "sec-test" }, /* @__PURE__ */ React.createElement("h3", { id: "sec-test" }, t("testTitle")), /* @__PURE__ */ React.createElement("p", null, t("testHelp")), enabledSaved.length === 0 ? /* @__PURE__ */ React.createElement("p", { className: "ns-muted" }, t("testNeedsBackend")) : /* @__PURE__ */ React.createElement("div", { className: "ns-grid" }, /* @__PURE__ */ React.createElement("div", { className: "ns-field" }, /* @__PURE__ */ React.createElement("label", { htmlFor: "ns-test-backend" }, t("testBackend")), /* @__PURE__ */ React.createElement("select", { id: "ns-test-backend", disabled: !!pending || dirty, value: testBackend, onChange: (event) => setTestBackend(event.target.value) }, enabledSaved.map((def) => /* @__PURE__ */ React.createElement("option", { value: def.id, key: def.id }, def.title)))), /* @__PURE__ */ React.createElement("div", { className: "ns-field" }, /* @__PURE__ */ React.createElement("label", { htmlFor: "ns-test-query" }, t("testQuery")), /* @__PURE__ */ React.createElement("input", { id: "ns-test-query", value: query, disabled: !!pending || dirty, onChange: (event) => setQuery(event.target.value), placeholder: t("testQueryPlaceholder") }))), enabledSaved.length > 0 && /* @__PURE__ */ React.createElement("div", { className: "ns-test-actions" }, /* @__PURE__ */ React.createElement("button", { className: "ns-primary", disabled: !!pending || dirty || !query.trim() || !enabledSaved.some((def) => def.id === testBackend), onClick: () => action("test", { backendId: testBackend, query }) }, t("runTest")), dirty && /* @__PURE__ */ React.createElement("small", null, t("saveBeforeTest"))), testResult && /* @__PURE__ */ React.createElement("div", { className: "ns-result" }, /* @__PURE__ */ React.createElement("h4", null, t("testResult")), testResult.sources?.length ? /* @__PURE__ */ React.createElement("ol", { className: "ns-sources" }, testResult.sources.map((source, index) => /* @__PURE__ */ React.createElement("li", { key: `${source.url}-${index}` }, /* @__PURE__ */ React.createElement("a", { href: source.url, target: "_blank", rel: "noreferrer" }, source.title || source.url), /* @__PURE__ */ React.createElement("p", { className: "ns-muted" }, source.url), source.snippet && /* @__PURE__ */ React.createElement("p", null, source.snippet)))) : /* @__PURE__ */ React.createElement("p", { className: "ns-muted" }, t("noSources")), (testResult.outcomes || []).filter((outcome) => !outcome.ok).map((outcome) => /* @__PURE__ */ React.createElement("div", { className: "ns-failure", key: outcome.backend }, /* @__PURE__ */ React.createElement("h5", null, t("testFailure")), /* @__PURE__ */ React.createElement("dl", null, /* @__PURE__ */ React.createElement("dt", null, t("diagnostic.backend")), /* @__PURE__ */ React.createElement("dd", null, outcome.backend), /* @__PURE__ */ React.createElement("dt", null, t("diagnostic.mode")), /* @__PURE__ */ React.createElement("dd", null, t(`choice.${outcome.mode}`)), /* @__PURE__ */ React.createElement("dt", null, t("diagnostic.attempts")), /* @__PURE__ */ React.createElement("dd", null, outcome.attempts), /* @__PURE__ */ React.createElement("dt", null, t("diagnostic.reason")), /* @__PURE__ */ React.createElement("dd", null, t(`failure.${outcome.error?.kind || "protocol"}`), outcome.error?.status ? ` \xB7 HTTP ${outcome.error.status}` : ""), /* @__PURE__ */ React.createElement("dt", null, t("diagnostic.message")), /* @__PURE__ */ React.createElement("dd", null, outcome.error?.message)))), (testResult.outcomes || []).flatMap((outcome) => outcome.warnings.map((warning) => /* @__PURE__ */ React.createElement("p", { className: "ns-muted", key: `${outcome.backend}-${warning}` }, "[", outcome.backend, "] ", warning))))), /* @__PURE__ */ React.createElement("section", { className: "ns-card", "aria-labelledby": "sec-diagnostics" }, /* @__PURE__ */ React.createElement("h3", { id: "sec-diagnostics" }, t("diagnosticsTitle")), /* @__PURE__ */ React.createElement("p", null, t("diagnosticsHelp")), /* @__PURE__ */ React.createElement("div", { className: "ns-actions" }, /* @__PURE__ */ React.createElement("button", { disabled: !!pending, onClick: () => action("clear-cache") }, t("clearCache")), /* @__PURE__ */ React.createElement("button", { disabled: !!pending, onClick: () => setConfirming({ kind: "clear-diagnostics" }) }, t("clearDiagnostics")), /* @__PURE__ */ React.createElement("button", { disabled: !!pending, onClick: async () => {
956
1017
  setPending("refresh");
957
1018
  try {
958
1019
  await refresh();
@@ -970,22 +1031,17 @@ var NiteSearchClient = (() => {
970
1031
  setDraft(clone(snapshot.defaults));
971
1032
  setIssues([]);
972
1033
  setNotice("defaultsRestored");
973
- }), showTransfer && /* @__PURE__ */ React.createElement("div", { className: "ns-field" }, /* @__PURE__ */ React.createElement("label", { htmlFor: "ns-import" }, t("importLabel")), /* @__PURE__ */ React.createElement("textarea", { id: "ns-import", value: importText, disabled: !!pending, onChange: (event) => setImportText(event.target.value), rows: 8 }), /* @__PURE__ */ React.createElement("button", { disabled: !!pending || !importText.trim(), onClick: importConfig }, t("applyImport"))))), tab === "backends" && /* @__PURE__ */ React.createElement("div", { role: "tabpanel", id: "panel-backends", "aria-labelledby": "tab-backends" }, /* @__PURE__ */ React.createElement("section", { className: "ns-backends", id: "sec-backends", tabIndex: -1, "aria-labelledby": "sec-backends-title" }, /* @__PURE__ */ React.createElement("h3", { id: "sec-backends-title" }, t("backends"), " ", /* @__PURE__ */ React.createElement("span", { className: "ns-muted" }, tr("enabledSummary", { enabled: enabledCount, total: definitions.length }))), /* @__PURE__ */ React.createElement("p", { className: "ns-muted" }, t("backendIntro")), /* @__PURE__ */ React.createElement("div", { className: "ns-toolbar" }, /* @__PURE__ */ React.createElement("div", { className: "ns-field" }, /* @__PURE__ */ React.createElement("label", { htmlFor: "ns-backend-search" }, t("searchBackends")), /* @__PURE__ */ React.createElement("input", { id: "ns-backend-search", type: "search", value: backendQuery, onChange: (event) => setBackendQuery(event.target.value), placeholder: t("searchBackendsPlaceholder") })), /* @__PURE__ */ React.createElement("div", { className: "ns-field" }, /* @__PURE__ */ React.createElement("label", { htmlFor: "ns-backend-filter" }, t("filterBackends")), /* @__PURE__ */ React.createElement("select", { id: "ns-backend-filter", value: backendFilter, onChange: (event) => setBackendFilter(event.target.value) }, ["all", "enabled", "configured"].map((value) => /* @__PURE__ */ React.createElement("option", { key: value, value }, t(`filter.${value}`)))))), ["free", "allowance", "trial", "paid", "self-hosted", "unverified"].map((tier) => {
974
- const inTier = definitions.filter((def) => tierOf(def) === tier);
975
- const members = inTier.filter(matches);
976
- const enabledInTier = inTier.filter((def) => draft.backends[def.id]?.enabled).length;
977
- return members.length ? /* @__PURE__ */ React.createElement("div", { className: "ns-tier", key: tier }, /* @__PURE__ */ React.createElement("h4", null, t(`tier.${tier}`), " ", /* @__PURE__ */ React.createElement("span", { className: "ns-muted" }, tr("tierCount", { total: inTier.length }), " \xB7 ", tr("tierEnabled", { enabled: enabledInTier }), members.length < inTier.length ? ` \xB7 ${tr("tierFiltered", { shown: members.length })}` : "")), members.map((def) => {
978
- const backend2 = draft.backends[def.id];
979
- if (!backend2) return null;
980
- const mode2 = def.modes.find((item) => item.mode === backend2.mode);
981
- const base = `backends.${def.id}`;
982
- const credentialState = snapshot.credentials[def.id];
983
- const locked = def.status !== "documented";
984
- const anonymous = backend2.mode === "anonymous";
985
- return /* @__PURE__ */ React.createElement("details", { className: "ns-card ns-backend", key: def.id }, /* @__PURE__ */ React.createElement("summary", null, /* @__PURE__ */ React.createElement("span", { className: "ns-backend-title" }, def.title), /* @__PURE__ */ React.createElement("span", { className: "ns-chips" }, /* @__PURE__ */ React.createElement("span", { className: `ns-chip ${locked ? "ns-chip--off" : tierRisk(tier)}` }, locked ? t("unverified") : t(`tier.${tier}`)), /* @__PURE__ */ React.createElement("span", { className: "ns-chip" }, t(`choice.${backend2.mode}`)), def.evidence === "live" && /* @__PURE__ */ React.createElement("span", { className: "ns-chip ns-chip--ok" }, t("liveVerified")), /* @__PURE__ */ React.createElement("span", { className: `ns-dot ${credentialState?.configured ? "is-on" : "is-off"}`, "aria-hidden": "true" }), /* @__PURE__ */ React.createElement("span", { className: `ns-badge ${backend2.enabled ? "is-on" : ""}` }, backend2.enabled ? t("enabled") : t("disabled")))), /* @__PURE__ */ React.createElement("div", { className: "ns-backend-body" }, locked && /* @__PURE__ */ React.createElement("p", { className: "ns-warning" }, t("unverifiedHelp")), /* @__PURE__ */ React.createElement("p", { className: "ns-quota" }, mode2?.limits[lang], " ", /* @__PURE__ */ React.createElement("a", { href: mode2?.pricingUrl || def.docs, target: "_blank", rel: "noreferrer" }, t("source")), " \xB7 ", t("verifiedAt"), " ", def.verifiedAt || t("notVerified")), /* @__PURE__ */ React.createElement("div", { className: "ns-grid" }, fields([`${base}.enabled`, `${base}.mode`, `${base}.endpoint`, `${base}.credentialRef`, `${base}.timeoutMs`, `${base}.rateLimitPerMinute`, `${base}.dailyAttemptLimit`], { [`${base}.enabled`]: { type: "checkbox", disabled: locked }, [`${base}.mode`]: { choices: def.modes.map((item) => item.mode), disabled: locked }, [`${base}.timeoutMs`]: { type: "number" }, [`${base}.rateLimitPerMinute`]: { type: "number" }, [`${base}.dailyAttemptLimit`]: { type: "number" } }).filter((node) => !(anonymous && node.key === `${base}.credentialRef`))), anonymous && !locked && /* @__PURE__ */ React.createElement("p", { className: "ns-muted" }, t("anonymousNoCredential")), def.options.length > 0 && /* @__PURE__ */ React.createElement("details", { className: "ns-advanced" }, /* @__PURE__ */ React.createElement("summary", null, t("advancedOptions")), /* @__PURE__ */ React.createElement("div", { className: "ns-grid" }, def.options.map((option2) => field(`${base}.options.${option2.key}`, { type: option2.type === "boolean" ? "checkbox" : option2.type === "number" ? "number" : "text", choices: option2.choices, help: option2.help[lang], customLabel: option2.label[lang], disabled: locked, min: option2.min, max: option2.max })))), !anonymous && !locked && /* @__PURE__ */ React.createElement("div", { className: "ns-credential" }, /* @__PURE__ */ React.createElement("h5", null, t("credentialTitle")), /* @__PURE__ */ React.createElement("p", null, t(credentialState?.configured ? "credentialConfigured" : "credentialMissing"), " \xB7 ", t("credentialHelp")), /* @__PURE__ */ React.createElement("label", { htmlFor: `secret-${def.id}` }, t("credentialValue")), /* @__PURE__ */ React.createElement("input", { id: `secret-${def.id}`, type: "password", autoComplete: "new-password", value: secrets[def.id] || "", disabled: !!pending || dirty || !credentialState?.writable || !backend2.credentialRef, onChange: (event) => setSecrets((previous) => ({ ...previous, [def.id]: event.target.value })) }), dirty && /* @__PURE__ */ React.createElement("small", { id: `secret-${def.id}-why` }, t("saveBeforeCredential")), /* @__PURE__ */ React.createElement("div", { className: "ns-actions" }, /* @__PURE__ */ React.createElement("button", { disabled: !!pending || dirty || !credentialState?.writable || !secrets[def.id], onClick: () => credential(def.id, false) }, t("replaceCredential")), /* @__PURE__ */ React.createElement("button", { disabled: !!pending || dirty || !credentialState?.writable || !credentialState?.configured, onClick: () => setConfirming({ kind: `delete-credential-${def.id}`, backendId: def.id }) }, t("deleteCredential"))), confirmRow(`delete-credential-${def.id}`, "deleteCredentialConfirm", () => {
986
- void credential(def.id, true);
987
- })), /* @__PURE__ */ React.createElement("p", { className: "ns-meta" }, /* @__PURE__ */ React.createElement("span", null, t("attemptsToday"), " ", /* @__PURE__ */ React.createElement("strong", null, snapshot.counters[def.id]?.attempts ?? 0)), /* @__PURE__ */ React.createElement("span", { "aria-hidden": "true" }, "\xB7"), /* @__PURE__ */ React.createElement("span", null, snapshot.counters[def.id]?.day ?? t("noData")))));
988
- })) : null;
1034
+ }), showTransfer && /* @__PURE__ */ React.createElement("div", { className: "ns-field" }, /* @__PURE__ */ React.createElement("label", { htmlFor: "ns-import" }, t("importLabel")), /* @__PURE__ */ React.createElement("textarea", { id: "ns-import", value: importText, disabled: !!pending, onChange: (event) => setImportText(event.target.value), rows: 8 }), /* @__PURE__ */ React.createElement("button", { disabled: !!pending || !importText.trim(), onClick: importConfig }, t("applyImport"))))), tab === "backends" && /* @__PURE__ */ React.createElement("div", { role: "tabpanel", id: "panel-backends", "aria-labelledby": "tab-backends" }, /* @__PURE__ */ React.createElement("section", { className: "ns-backends", id: "sec-backends", tabIndex: -1, "aria-labelledby": "sec-backends-title" }, /* @__PURE__ */ React.createElement("h3", { id: "sec-backends-title" }, t("backends"), " ", /* @__PURE__ */ React.createElement("span", { className: "ns-muted" }, tr("enabledSummary", { enabled: enabledCount, total: definitions.length }))), /* @__PURE__ */ React.createElement("p", { className: "ns-muted" }, t("backendIntro"), " ", t("colorLegend")), /* @__PURE__ */ React.createElement("div", { className: "ns-toolbar" }, /* @__PURE__ */ React.createElement("div", { className: "ns-field" }, /* @__PURE__ */ React.createElement("label", { htmlFor: "ns-backend-search" }, t("searchBackends")), /* @__PURE__ */ React.createElement("input", { id: "ns-backend-search", type: "search", value: backendQuery, onChange: (event) => setBackendQuery(event.target.value), placeholder: t("searchBackendsPlaceholder") })), /* @__PURE__ */ React.createElement("div", { className: "ns-field" }, /* @__PURE__ */ React.createElement("label", { htmlFor: "ns-backend-filter" }, t("filterBackends")), /* @__PURE__ */ React.createElement("select", { id: "ns-backend-filter", value: backendFilter, onChange: (event) => setBackendFilter(event.target.value) }, ["all", "enabled", "configured"].map((value) => /* @__PURE__ */ React.createElement("option", { key: value, value }, t(`filter.${value}`)))))), ranked.filter(matches).map((def) => {
1035
+ const backend2 = draft.backends[def.id];
1036
+ if (!backend2) return null;
1037
+ const mode2 = def.modes.find((item) => item.mode === backend2.mode);
1038
+ const base = `backends.${def.id}`;
1039
+ const credentialState = snapshot.credentials[def.id];
1040
+ const locked = def.status !== "documented";
1041
+ const anonymous = backend2.mode === "anonymous";
1042
+ return /* @__PURE__ */ React.createElement("details", { className: "ns-card ns-backend", key: def.id }, /* @__PURE__ */ React.createElement("summary", null, /* @__PURE__ */ React.createElement("span", { className: "ns-backend-title" }, def.title), /* @__PURE__ */ React.createElement("span", { className: "ns-chips" }, def.modes.map((item) => /* @__PURE__ */ React.createElement("span", { key: item.mode, className: `ns-chip ${item.mode === backend2.mode ? "is-on" : ""} ${item.tier === "unverified" ? "ns-chip--off" : tierRisk(item.tier)}`, "aria-current": item.mode === backend2.mode ? "true" : void 0, title: t(`choice.${item.mode}`) }, t(`choice.${item.mode}`), " \xB7 ", t(`tier.${item.tier}`))), locked && /* @__PURE__ */ React.createElement("span", { className: "ns-chip ns-chip--off" }, t("unverified")), /* @__PURE__ */ React.createElement("span", { className: `ns-dot ${credentialState?.configured ? "is-on" : "is-off"}`, "aria-hidden": "true" }), /* @__PURE__ */ React.createElement("span", { className: `ns-badge ${backend2.enabled ? "is-on" : ""}` }, backend2.enabled ? t("enabled") : t("disabled")))), /* @__PURE__ */ React.createElement("div", { className: "ns-backend-body" }, locked && /* @__PURE__ */ React.createElement("p", { className: "ns-warning" }, t("unverifiedHelp")), /* @__PURE__ */ React.createElement("p", { className: "ns-quota" }, mode2?.limits[lang], " ", /* @__PURE__ */ React.createElement("a", { href: mode2?.pricingUrl || def.docs, target: "_blank", rel: "noreferrer" }, t("source")), " \xB7 ", t("verifiedAt"), " ", def.verifiedAt || t("notVerified")), /* @__PURE__ */ React.createElement("div", { className: "ns-grid" }, fields([`${base}.enabled`, `${base}.mode`, `${base}.endpoint`, `${base}.credentialRef`, `${base}.timeoutMs`, `${base}.rateLimitPerMinute`, `${base}.dailyAttemptLimit`], { [`${base}.enabled`]: { type: "checkbox", disabled: locked }, [`${base}.mode`]: { choices: def.modes.map((item) => item.mode), disabled: locked }, [`${base}.timeoutMs`]: { type: "number" }, [`${base}.rateLimitPerMinute`]: { type: "number" }, [`${base}.dailyAttemptLimit`]: { type: "number" } }).filter((node) => !(anonymous && node.key === `${base}.credentialRef`))), anonymous && !locked && /* @__PURE__ */ React.createElement("p", { className: "ns-muted" }, t("anonymousNoCredential")), def.options.length > 0 && /* @__PURE__ */ React.createElement("details", { className: "ns-advanced" }, /* @__PURE__ */ React.createElement("summary", null, t("advancedOptions")), /* @__PURE__ */ React.createElement("div", { className: "ns-grid" }, def.options.map((option2) => field(`${base}.options.${option2.key}`, { type: option2.type === "boolean" ? "checkbox" : option2.type === "number" ? "number" : "text", choices: option2.choices, help: option2.help[lang], customLabel: option2.label[lang], disabled: locked, min: option2.min, max: option2.max })))), !anonymous && !locked && /* @__PURE__ */ React.createElement("div", { className: "ns-credential" }, /* @__PURE__ */ React.createElement("h5", null, t("credentialTitle")), /* @__PURE__ */ React.createElement("p", null, t(credentialState?.configured ? "credentialConfigured" : "credentialMissing"), " \xB7 ", t("credentialHelp")), /* @__PURE__ */ React.createElement("p", { className: "ns-credential-shape", "aria-label": t("credentialShapeLabel") }, /* @__PURE__ */ React.createElement("code", null, mode2?.credentialShape?.[lang] ?? t("credentialPlainKey"))), /* @__PURE__ */ React.createElement("label", { htmlFor: `secret-${def.id}` }, t("credentialValue")), /* @__PURE__ */ React.createElement("input", { id: `secret-${def.id}`, type: "password", autoComplete: "new-password", "aria-describedby": `secret-${def.id}-why`, value: secrets[def.id] || "", disabled: credentialDisabled(def.id), onChange: (event) => setSecrets((previous) => ({ ...previous, [def.id]: event.target.value })) }), credentialDisabledReason(def.id) && /* @__PURE__ */ React.createElement("small", { id: `secret-${def.id}-why`, className: "ns-warning" }, credentialDisabledReason(def.id)), /* @__PURE__ */ React.createElement("div", { className: "ns-actions" }, /* @__PURE__ */ React.createElement("button", { disabled: credentialDisabled(def.id) || !secrets[def.id], onClick: () => credential(def.id, false) }, t("replaceCredential")), /* @__PURE__ */ React.createElement("button", { disabled: credentialDisabled(def.id) || !credentialState?.configured, onClick: () => setConfirming({ kind: `delete-credential-${def.id}`, backendId: def.id }) }, t("deleteCredential"))), confirmRow(`delete-credential-${def.id}`, "deleteCredentialConfirm", () => {
1043
+ void credential(def.id, true);
1044
+ })), /* @__PURE__ */ React.createElement("p", { className: "ns-meta" }, /* @__PURE__ */ React.createElement("span", null, t("attemptsToday"), " ", /* @__PURE__ */ React.createElement("strong", null, snapshot.counters[def.id]?.attempts ?? 0)), /* @__PURE__ */ React.createElement("span", { "aria-hidden": "true" }, "\xB7"), /* @__PURE__ */ React.createElement("span", null, snapshot.counters[def.id]?.day ?? t("noData")))));
989
1045
  }), !definitions.some(matches) && /* @__PURE__ */ React.createElement("p", { className: "ns-muted" }, t("noMatch")))), /* @__PURE__ */ React.createElement("footer", { className: "ns-footer" }, /* @__PURE__ */ React.createElement("span", { "aria-live": "polite" }, dirty ? tr("unsavedWithErrors", { errors: issues.length }) : t("upToDate")), /* @__PURE__ */ React.createElement("div", { className: "ns-actions" }, /* @__PURE__ */ React.createElement("button", { disabled: !!pending || !dirty, onClick: () => setConfirming({ kind: "discard" }) }, t("discard")), /* @__PURE__ */ React.createElement("button", { className: "ns-primary", disabled: !!pending || !dirty, onClick: save }, t(pending === "save" ? "saving" : "save"))), confirmRow("discard", "discardConfirm", () => {
990
1046
  setDraft(clone(snapshot.config));
991
1047
  setIssues([]);