@klarkxy/dsh-web-search-manager 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -0
- package/docs/README.zh-CN.md +3 -0
- package/lib/client.inner.cjs +147 -26
- package/lib/client.inner.cjs.map +1 -1
- package/lib/client.js +147 -26
- package/lib/contracts.d.ts +3 -25
- package/lib/contracts.js.map +1 -1
- package/lib/index.d.ts +2 -1
- package/lib/index.js +19 -59
- package/lib/index.js.map +1 -1
- package/package.json +3 -3
package/lib/client.inner.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.inner.cjs","names":["useState","useRef","Button","useCallback","useSyncExternalStore","useId","SegmentedTabs","Switch","StateDot","Tag","Input"],"sources":["../../dsh-plugin-kit/src/official-ui.ts","../../dsh-plugin-kit/src/client-utils.ts","../src/contracts.ts","../src/provider-info.ts","../src/client.tsx"],"sourcesContent":["/**\n * Shared contract that keeps every plugin's browser-side UI on the official\n * DeepSeek Harness Web design language.\n *\n * Two rules produce that language, and both are load-bearing here:\n *\n * 1. Colour, radius, elevation and focus come from the host theme's real\n * `--dsw-*` tokens, written under their own names. Plugins never invent a\n * token, never alias the official ones behind a private palette (a private\n * alias is just a second, diverging theme), and never carries a literal\n * fallback — the host publishes light and dark, and a literal would pin one\n * of them. The only non-colour custom properties used are the host's own\n * content-font axis and frame clearance.\n *\n * 2. Anything the host already ships is used, not reimplemented. Controls come\n * from `@deepseek-ai/dsh-client-ui-primitives` (`Button`, `Input`,\n * `Checkbox`, `Switch`, `Tag`, `Pill`, `SegmentedControl`, `Menu`, `Modal`,\n * `Tooltip`, `Toast`, `DisclosureRow`, `StateDot`, `PathLabel`, the settings\n * form suite). This module only styles what primitives do not cover: page\n * scaffolding, field layout, banners, empty states and scroll regions.\n *\n * The metrics below are transcribed from the primitives' own CSS modules so a\n * feature panel lines up pixel-for-pixel with a native one: the 14/22 body and\n * 13/20 compact type tiers, the 0.5px hairline scale, and the elevation family\n * that draws a surface's edge in its shadow (`border: 0`) instead of a border.\n */\n\n/**\n * Every `--dsw-*` token this repo is allowed to reference, grouped by role.\n *\n * Plugins may only colour through this list. It is exported so the guard test\n * can fail a build when a stylesheet reaches for anything else — the failure\n * mode this prevents is silent: an unknown token resolves to nothing, so a\n * border disappears or a label inherits the wrong colour with no error anywhere.\n */\nexport const OFFICIAL_THEME_TOKENS = {\n /** Surfaces, from the page up to the topmost nested card. */\n surface: [\n '--dsw-alias-bg-base',\n '--dsw-alias-bg-layer-1',\n '--dsw-alias-bg-layer-2',\n '--dsw-alias-bg-layer-3',\n '--dsw-alias-bg-layer-4',\n '--dsw-alias-bg-module-platform',\n '--dsw-alias-bg-overlay',\n ],\n /** Hairlines. l1 is near-invisible on a menu surface, so menus use l2+. */\n border: ['--dsw-alias-border-l1', '--dsw-alias-border-l2', '--dsw-alias-border-l3', '--dsw-alias-border-l4'],\n /** Text. `caption` is menu shortcut text, `dimmed` is placeholder text. */\n label: [\n '--dsw-alias-label-primary',\n '--dsw-alias-label-secondary',\n '--dsw-alias-label-tertiary',\n '--dsw-alias-label-caption',\n '--dsw-alias-label-dimmed',\n '--dsw-alias-label-error',\n '--dsw-alias-label-primary-foreground',\n ],\n /** Interactive fills. The `-danger` hover belongs to destructive rows. */\n interactive: [\n '--dsw-alias-interactive-bg-hover',\n '--dsw-alias-interactive-bg-active',\n '--dsw-alias-interactive-bg-hover-danger',\n ],\n /** Accent and status. `business` is the focus ring's default colour. */\n accent: [\n '--dsw-alias-brand-primary',\n '--dsw-alias-button-primary-fill',\n '--dsw-alias-button-primary-hover',\n '--dsw-alias-button-tool-bar-fill',\n '--dsw-alias-button-tool-bar-hover',\n '--dsw-alias-button-ghost-active-fill',\n '--dsw-alias-button-ghost-active-border',\n ],\n state: [\n '--dsw-alias-state-business-primary',\n '--dsw-alias-state-success-primary',\n '--dsw-alias-state-warn-primary',\n '--dsw-alias-state-error-primary',\n '--dsw-alias-state-idle-primary',\n ],\n /** Corner scale: sm 8, md 12, lg the large card, panel the modal. */\n radius: ['--dsw-radius-sm', '--dsw-radius-md', '--dsw-radius-lg', '--dsw-radius-panel'],\n /** An elevated surface draws its edge in the shadow, so it keeps border: 0. */\n elevation: [\n '--dsw-elevation-soft',\n '--dsw-elevation-stroke',\n '--dsw-elevation-stroke-color',\n '--dsw-elevation-panel',\n '--dsw-elevation-prominent',\n ],\n /** Floats, masks and scrollbars. */\n overlay: [\n '--dsw-menu-surface-fill',\n '--dsw-menu-backdrop-filter',\n '--dsw-mask-blur',\n '--dsw-alias-bg-mask-1',\n '--dsw-alias-menu-icon',\n '--dsw-alias-scrollbar-bg-l2',\n '--dsw-alias-scrollbar-hover-l2',\n '--dsw-shadow-lv3',\n ],\n /** Motion, focus and type axis, published by the host rather than by a component. */\n system: [\n '--dsw-focus-ring-width',\n '--dsw-focus-ring-color',\n '--dsw-font-markdown-code-font-family',\n '--ds-transition-duration',\n '--ds-ease-in-out',\n '--ds-font-family-code',\n '--dsh-scrollbar-thumb',\n '--dsh-scrollbar-thumb-hover',\n '--dsh-content-font-size-secondary',\n '--dsh-content-font-delta',\n '--dsh-frame-top-clearance',\n ],\n} as const\n\n/** Every official token name, flat. Used by the token guard test. */\nexport const OFFICIAL_THEME_TOKEN_NAMES: readonly string[] = Object.values(OFFICIAL_THEME_TOKENS).flat()\n\n/** The elevation steps a surface can be raised by, softest first. */\nexport type OfficialElevation = 'soft' | 'stroke' | 'panel' | 'prominent'\n\n/**\n * The host's focus ring shorthand, verbatim. Writing this per control is how\n * rings drift apart; a stylesheet that draws its own focus style should use\n * {@link officialFocus} instead. The colour fallback is the host's own default.\n */\nexport const OFFICIAL_FOCUS_RING =\n 'var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color, var(--dsw-alias-state-business-primary))'\n\n/**\n * A complete `outline` declaration at the official geometry. `offset` defaults\n * to the 2px the native controls use; the host's inline field rules sit at 1px\n * and a segmented tab pulls the ring inside itself at -2px.\n */\nexport function officialFocus(offset = '2px'): string {\n return `outline: ${OFFICIAL_FOCUS_RING}; outline-offset: ${offset}`\n}\n\n/**\n * An elevated surface. The host draws a raised surface's edge inside its\n * shadow rather than as a border, so a card sets `border: 0` and takes the edge\n * from the elevation — which is also why its border stays off the alias-border\n * set that a flat, non-elevated rule would use.\n */\nexport function officialElevation(level: OfficialElevation): string {\n return `border: 0; box-shadow: var(--dsw-elevation-${level})`\n}\n\n/**\n * An elevated surface whose edge should read as a specific hairline. Rebinding\n * the stroke colour is how a menu card picks l1 while a panel picks l3, without\n * the two growing apart by hand.\n */\nexport function officialStrokedElevation(level: OfficialElevation, color: string): string {\n return `--dsw-elevation-stroke-color: ${color}; ${officialElevation(level)}`\n}\n\n/**\n * The shared stylesheet for a plugin UI, scoped under that plugin's root class.\n *\n * Scoping is what keeps this safe to always-bundle into every client: the rules\n * can only match inside the plugin's own subtree, so two plugins can both mount\n * `dsh-ui-card` without either styling the other's markup.\n *\n * Each recipe matches the root element *and* its descendants, because the\n * commonest arrangement is one element that is both — a surface that carries\n * the root class and `dsh-ui-card`, or a portaled dialog that is the root and\n * the `dsh-ui-surface`. A descendant-only scope would silently leave those\n * unstyled, with no error anywhere.\n *\n * A caveat worth knowing: `Modal` and `Menu` portal to `document.body`, so their\n * content leaves the plugin's subtree entirely. A portaled surface therefore\n * needs its own root class on an element inside the portal.\n *\n * Only patterns that primitives do not provide live here. If a control appears\n * below that `Button`/`Input`/`Switch`/`Tag`/`Menu` already covers, that is a\n * bug in this file: use the primitive and delete the recipe.\n */\nexport function officialUiCss(roots: string | readonly string[]): string {\n // One plugin often mounts several unrelated surfaces (a settings seat, a chat\n // card, a header menu), so the caller names every root. The rules below are\n // nested under a single selector list and use `&`, which the browser expands\n // per root — so one stylesheet covers all of them without duplicating itself.\n const scope = (typeof roots === 'string' ? [roots] : roots).map(root => `.${root}`).join(', ')\n const sheet = `\n/* Official DSH Web UI contract. Generated by @klarkxy/dsh-plugin-kit/official-ui.\n * Do not hand-edit the copy inside a plugin: change this module so every plugin\n * moves together. Scope: ${scope} */\n/* The scope rule below stays open for the whole sheet: every rule after it\n * nests with the parent selector, so one stylesheet can cover several unrelated\n * roots without leaking into a neighbouring plugin. Its closing brace is last. */\n${scope} {\n color: var(--dsw-alias-label-primary);\n font-family: inherit;\n font-size: 14px;\n line-height: 22px;\n min-width: 0;\n\n& *, & *::before, & *::after { box-sizing: border-box; }\n& h1, & h2, & h3, & h4, & p, & figure { margin: 0; }\n/* Keyboard focus only: pointer input keeps the native resting appearance. The\n * ring needs no radius of its own — the outline already follows the control's\n * own border-radius, and overriding it here would flatten every control. */\n& :focus-visible { ${officialFocus()}; }\n& [hidden] { display: none !important; }\n\n/* --- Type tiers. The same 14/22 and 13/20 steps the primitives use. --- */\n& .dsh-ui-title { font-size: 16px; line-height: 24px; font-weight: 500; color: var(--dsw-alias-label-primary); }\n& .dsh-ui-heading { font-size: 14px; line-height: 22px; font-weight: 500; color: var(--dsw-alias-label-primary); }\n& .dsh-ui-compact { font-size: 13px; line-height: 20px; color: var(--dsw-alias-label-primary); }\n& .dsh-ui-meta { font-size: 12px; line-height: 18px; color: var(--dsw-alias-label-secondary); }\n& .dsh-ui-hint { font-size: 12px; line-height: 18px; color: var(--dsw-alias-label-tertiary); }\n& .dsh-ui-error { font-size: 12px; line-height: 18px; color: var(--dsw-alias-state-error-primary); }\n& .dsh-ui-warn { color: var(--dsw-alias-state-warn-primary); }\n& .dsh-ui-success { color: var(--dsw-alias-state-success-primary); }\n& .dsh-ui-muted { color: var(--dsw-alias-label-tertiary); }\n& .dsh-ui-truncate { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n& .dsh-ui-wrap { min-width: 0; overflow-wrap: anywhere; }\n\n/* --- Layout scaffolding. --- */\n& .dsh-ui-stack { display: flex; flex-direction: column; gap: 12px; }\n& .dsh-ui-stack-lg { display: flex; flex-direction: column; gap: 20px; }\n& .dsh-ui-row { display: flex; align-items: center; gap: 8px; min-width: 0; }\n& .dsh-ui-row-wrap { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }\n& .dsh-ui-spacer { flex: 1; min-width: 0; }\n/* A 0.5px l2 rule is the host's section divider; reserve the same rhythm. */\n& .dsh-ui-divider { height: 0.5px; background: var(--dsw-alias-border-l2); }\n& .dsh-ui-section { display: flex; flex-direction: column; gap: 12px; padding-top: 16px; border-top: 0.5px solid var(--dsw-alias-border-l2); }\n\n/* --- Card: a raised surface whose edge lives in the shadow. --- */\n& .dsh-ui-card {\n ${officialElevation('stroke')}\n display: flex;\n flex-direction: column;\n gap: 12px;\n padding: 16px;\n border-radius: var(--dsw-radius-lg);\n background: var(--dsw-alias-bg-layer-1);\n color: var(--dsw-alias-label-primary);\n min-width: 0;\n}\n& .dsh-ui-card--flat { border: 0.5px solid var(--dsw-alias-border-l3); box-shadow: none; }\n& .dsh-ui-card--nested { background: var(--dsw-alias-bg-layer-2); }\n& .dsh-ui-card--plain { background: none; }\n\n/* --- Field: label, control, help, error. The control itself is an\n * official primitive, so this only owns the vertical rhythm. --- */\n& .dsh-ui-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }\n& .dsh-ui-field + .dsh-ui-field { border-top: 0.5px solid var(--dsw-alias-border-l2); padding-top: 12px; }\n& .dsh-ui-label { display: flex; align-items: center; gap: 6px; font-size: 13px; line-height: 20px; font-weight: 500; color: var(--dsw-alias-label-primary); }\n& .dsh-ui-label-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }\n& .dsh-ui-help { font-size: 12px; line-height: 1.6; color: var(--dsw-alias-label-secondary); }\n& .dsh-ui-help p { margin: 0; }\n& .dsh-ui-help p + p { margin-top: 8px; }\n& .dsh-ui-required { color: var(--dsw-alias-state-error-primary); }\n& .dsh-ui-control { width: 100%; min-width: 0; }\n/* An invalid control is marked on the control, not only in the message. */\n& .dsh-ui-control[aria-invalid='true'] { border-color: var(--dsw-alias-state-error-primary); }\n& .dsh-ui-readonly { display: flex; flex-direction: column; gap: 4px; min-width: 0; }\n& .dsh-ui-readonly > dt { font-size: 12px; line-height: 18px; color: var(--dsw-alias-label-tertiary); }\n& .dsh-ui-readonly > dd { margin: 0; font-size: 13px; line-height: 20px; overflow-wrap: anywhere; }\n\n/* --- Buttons row. A no-op container: it exists so actions line up on the\n * trailing edge the way every native panel does. --- */\n& .dsh-ui-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding-top: 4px; }\n& .dsh-ui-actions-end { justify-content: flex-end; }\n\n/* --- Banners. A banner is a left-rail notice, the shape used for warnings,\n * deprecations and blocking instructions. --- */\n& .dsh-ui-banner {\n display: flex;\n flex-direction: column;\n gap: 8px;\n padding: 10px 14px;\n border: 0.5px solid var(--dsw-alias-border-l3);\n border-left: 3px solid var(--dsw-alias-state-warn-primary);\n border-radius: var(--dsw-radius-md);\n background: var(--dsw-alias-bg-layer-1);\n font-size: 13px;\n line-height: 20px;\n color: var(--dsw-alias-label-secondary);\n}\n& .dsh-ui-banner-title { font-weight: 500; color: var(--dsw-alias-state-warn-primary); }\n& .dsh-ui-banner--info { border-left-color: var(--dsw-alias-state-business-primary); }\n& .dsh-ui-banner--danger { border-left-color: var(--dsw-alias-state-error-primary); }\n& .dsh-ui-banner--success { border-left-color: var(--dsw-alias-state-success-primary); }\n& .dsh-ui-banner p { margin: 0; }\n\n/* --- Inline notice: a transient confirmation with no chrome of its own. --- */\n& .dsh-ui-notice { display: flex; align-items: center; gap: 6px; font-size: 12px; line-height: 18px; color: var(--dsw-alias-state-success-primary); }\n& .dsh-ui-notice--error { color: var(--dsw-alias-state-error-primary); }\n\n/* --- Empty and loading states. Both sit in a dashed well so an empty panel\n * reads as \"nothing here yet\" rather than as a broken layout. --- */\n& .dsh-ui-empty {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n gap: 6px;\n padding: 20px 16px;\n border: 0.5px dashed var(--dsw-alias-border-l3);\n border-radius: var(--dsw-radius-md);\n font-size: 13px;\n line-height: 20px;\n color: var(--dsw-alias-label-secondary);\n}\n& .dsh-ui-loading { display: flex; align-items: center; gap: 8px; padding: 20px 0; font-size: 13px; line-height: 20px; color: var(--dsw-alias-label-secondary); }\n\n/* --- Selectable list. A row is a button-sized target with a hover fill and\n * a selected fill; the name carries the weight, the description does not. --- */\n& .dsh-ui-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; min-width: 0; }\n& .dsh-ui-list-scroll { max-height: min(66vh, 760px); overflow-y: auto; overflow-x: hidden; }\n& .dsh-ui-list-row { border-radius: var(--dsw-radius-md); }\n& .dsh-ui-list-row:hover { background: var(--dsw-alias-interactive-bg-hover); }\n& .dsh-ui-list-row[aria-selected='true'], & .dsh-ui-list-row[data-selected] { background: var(--dsw-alias-interactive-bg-active); }\n& .dsh-ui-list-item {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n gap: 4px;\n width: 100%;\n min-width: 0;\n padding: 10px 12px;\n border: 0;\n border-radius: var(--dsw-radius-md);\n background: none;\n font: inherit;\n color: inherit;\n text-align: start;\n cursor: pointer;\n}\n& .dsh-ui-list-item:disabled { cursor: default; }\n& .dsh-ui-list-item:disabled:hover { background: none; }\n& .dsh-ui-list-name { font-size: 14px; line-height: 22px; font-weight: 500; color: var(--dsw-alias-label-primary); overflow-wrap: anywhere; }\n& .dsh-ui-list-desc { font-size: 12px; line-height: 18px; color: var(--dsw-alias-label-tertiary); }\n\n/* --- Code and structured output. Wraps rather than scrolls, because a\n * feature panel is read rather than scanned. --- */\n& .dsh-ui-code {\n padding: 10px 12px;\n border: 0.5px solid var(--dsw-alias-border-l3);\n border-radius: var(--dsw-radius-md);\n background: var(--dsw-alias-bg-layer-1);\n font-family: var(--ds-font-family-code, ui-monospace, 'Cascadia Mono', Consolas, monospace);\n font-size: 12px;\n line-height: 20px;\n color: var(--dsw-alias-label-secondary);\n overflow-wrap: anywhere;\n white-space: pre-wrap;\n}\n& .dsh-ui-scroll { max-height: 60vh; overflow: auto; overscroll-behavior: contain; }\n\n/* --- A toggle row: label on the left, switch on the trailing edge. This is\n * layout only; the switch itself is the official primitive. --- */\n& .dsh-ui-toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-width: 0; padding: 12px 0; }\n& .dsh-ui-toggle-row + .dsh-ui-toggle-row { border-top: 0.5px solid var(--dsw-alias-border-l2); }\n& .dsh-ui-toggle-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; }\n& .dsh-ui-toggle-label { font-size: 14px; line-height: 22px; font-weight: 500; color: var(--dsw-alias-label-primary); }\n\n/* --- Floating surface: a panel anchored to a trigger. This is the material\n * a menu card is made of — the translucent fill plus its backdrop blur, with\n * the edge riding inside the prominent elevation. A plugin that hand-rolls this\n * is how tokens like --dsw-specific-menu get invented; use this instead. --- */\n& .dsh-ui-surface {\n --dsw-elevation-stroke-color: var(--dsw-alias-border-l1);\n --dsh-scrollbar-thumb: var(--dsw-alias-scrollbar-bg-l2);\n --dsh-scrollbar-thumb-hover: var(--dsw-alias-scrollbar-hover-l2);\n position: relative;\n display: flex;\n flex-direction: column;\n border: 0;\n border-radius: var(--dsw-radius-lg);\n background: var(--dsw-menu-surface-fill);\n backdrop-filter: var(--dsw-menu-backdrop-filter);\n box-shadow: var(--dsw-elevation-prominent);\n color: var(--dsw-alias-label-primary);\n font-size: 13px;\n line-height: 20px;\n min-width: 0;\n}\n& .dsh-ui-surface-body { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px 14px; overflow-y: auto; }\n& .dsh-ui-surface-head { display: flex; align-items: center; gap: 8px; min-width: 0; }\n& .dsh-ui-surface-title { font-size: 14px; line-height: 22px; font-weight: 500; color: var(--dsw-alias-label-primary); }\n\n/* --- Native select. The primitives ship no select, so a plugin that offers a\n * closed list of choices keeps the platform control and matches the official\n * settings field geometry exactly (34px, 0.5px l4, radius-md, layer-3). A\n * SegmentedControl is the primitive to reach for when the choices are few\n * enough to show at once. --- */\n& .dsh-ui-select {\n box-sizing: border-box;\n width: 100%;\n min-width: 0;\n height: 34px;\n padding: 0 12px;\n border: 0.5px solid var(--dsw-alias-border-l4);\n border-radius: var(--dsw-radius-md);\n background: var(--dsw-alias-bg-layer-3);\n font: inherit;\n font-size: 13px;\n line-height: 1.5;\n color: var(--dsw-alias-label-primary);\n cursor: pointer;\n}\n& .dsh-ui-select:focus-visible { outline: none; border-color: var(--dsw-alias-state-business-primary); }\n& .dsh-ui-select:disabled { color: var(--dsw-alias-label-tertiary); cursor: default; }\n& .dsh-ui-select[aria-invalid='true'] { border-color: var(--dsw-alias-state-error-primary); }\n\n/* Long panels scroll inside themselves instead of growing the host page. */\n& .dsh-ui-panel { display: flex; flex-direction: column; gap: 16px; min-width: 0; }\n& .dsh-ui-panel-wide { max-width: 100%; }\n\n@media (prefers-reduced-motion: reduce) {\n & *, & *::before, & *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }\n}\n}\n`\n // Widen every recipe from \"a descendant of the root\" to \"the root, or one of\n // its descendants\". Written as a transform rather than by hand so no recipe\n // can be added later with only the descendant form. The pattern is narrow on\n // purpose: a leading `&` followed by one recipe class and no combinator, so\n // sibling and child rules such as `.dsh-ui-field + .dsh-ui-field` keep their\n // own meaning and are left alone.\n return sheet.replace(/^& (\\.dsh-ui-[a-z0-9-]+)(?![+>~])/gm, (_match, className: string) =>\n `&${className}, & ${className}`)\n}\n","import { useCallback, useEffect, useRef, useSyncExternalStore } from 'react'\n\n/** Fixed pause for failing background reads; manual work is never replayed. */\nexport function createPluginReadGate(now: () => number = Date.now) {\n let pausedUntil = 0\n let epoch = 0\n return {\n canRead: () => now() >= pausedUntil,\n reset: () => { epoch++; pausedUntil = 0 },\n async run<T>(read: () => Promise<T>): Promise<T> {\n const current = epoch\n try {\n const value = await read()\n if (current === epoch) pausedUntil = 0\n return value\n } catch (error) {\n // The native Connection error is an Error with this exact HTTP text.\n // Authentication, application failures, and cancellation stay distinct.\n const message = error instanceof Error ? error.message : ''\n if (current === epoch && (/(?:^|\\s)transport failure for .+: HTTP (?:404|405|503)\\b/.test(message)\n || (error instanceof TypeError && /^(?:Failed to fetch|fetch failed|NetworkError when attempting to fetch resource\\.?)$/i.test(message)))) {\n pausedUntil = now() + 30_000\n }\n throw error\n }\n },\n }\n}\n\nexport interface NativeSurfaceClient {\n sessions: {\n binding?(sessionId: string): { eventSource: { subscribe(listener: () => void): () => void } } | undefined\n }\n uiWorkspace: { current?: { getSnapshot(): { sessionId: string } | undefined; subscribe(listener: () => void): () => void } }\n uiSession: { adapter: { current: { getSnapshot(): { key?: string }; subscribe(listener: () => void): () => void } } }\n locale: { getSnapshot(): { active: string }; subscribe(listener: () => void): () => void }\n connection?: { generation?: { subscribe(listener: () => void): () => void } }\n}\n\n/** The Editor retains its manuscript session separately; native DSH exposes the main-view binding. */\nexport function selectedSessionId(client: Pick<NativeSurfaceClient, 'uiWorkspace' | 'uiSession'>): string {\n const workspace = client.uiWorkspace?.current\n return workspace\n ? workspace.getSnapshot()?.sessionId ?? ''\n : client.uiSession.adapter.current.getSnapshot().key ?? ''\n}\n\n/**\n * Owner props are data the host composed, never a Cordis context: reading an\n * undeclared property off one throws instead of returning undefined, which\n * would crash the slot entry and abdicate its cell for good. Tolerate a\n * throwing read so a mistaken prop degrades to \"not supplied\".\n */\nfunction read(source: unknown, key: string): unknown {\n if (source === null || typeof source !== 'object') return undefined\n try {\n return (source as Record<string, unknown>)[key]\n } catch {\n return undefined\n }\n}\n\nfunction readString(source: unknown, key: string): string | undefined {\n const value = read(source, key)\n return typeof value === 'string' ? value : undefined\n}\n\n/** Owner props win; native settings only supplies close, so resolve its selected session. */\nexport function useNativeSeat(client: NativeSurfaceClient, props?: unknown) {\n const current = useSyncExternalStore(\n useCallback((fn: () => void) => (client.uiWorkspace?.current ?? client.uiSession.adapter.current).subscribe(fn), [client]),\n useCallback(() => selectedSessionId(client), [client]),\n () => '',\n )\n const language = useSyncExternalStore(\n useCallback((fn: () => void) => client.locale.subscribe(fn), [client]),\n useCallback(() => client.locale.getSnapshot().active, [client]),\n () => 'en',\n )\n const sessionId = readString(props, 'sessionId') ?? readString(read(props, 'owner'), 'sessionId') ?? current\n const requestedLocale = read(props, 'locale') ?? read(read(props, 'owner'), 'locale') ?? language\n return { sessionId, locale: (String(requestedLocale).startsWith('zh') ? 'zh' : 'en') as 'zh' | 'en',\n hidden: read(props, 'hidden') === true || read(read(props, 'owner'), 'hidden') === true }\n}\n\n/** Refresh on native log boundaries/reconnect/focus. Read-only settling is bounded to an observed job. */\nexport function useFeatureRefresh(\n client: NativeSurfaceClient, sessionId: string, refresh: () => void,\n working = false, enabled = true,\n): void {\n const refreshRef = useRef(refresh)\n refreshRef.current = refresh\n useEffect(() => {\n if (!enabled) return\n let timer: ReturnType<typeof setTimeout> | undefined\n const queue = () => {\n if (typeof document !== 'undefined' && document.visibilityState === 'hidden') return\n clearTimeout(timer)\n timer = setTimeout(() => refreshRef.current(), 150)\n }\n const source = sessionId ? client.sessions.binding?.(sessionId)?.eventSource : undefined\n const stopEvents = source?.subscribe(queue)\n const stopConnection = client.connection?.generation?.subscribe(queue)\n const visibility = () => { if (document.visibilityState === 'visible') queue() }\n window.addEventListener('focus', queue)\n document.addEventListener('visibilitychange', visibility)\n // Details are collapsed by default; opening an existing panel must get current state.\n document.addEventListener('toggle', queue, true)\n return () => {\n clearTimeout(timer)\n stopEvents?.(); stopConnection?.()\n window.removeEventListener('focus', queue)\n document.removeEventListener('visibilitychange', visibility)\n document.removeEventListener('toggle', queue, true)\n }\n }, [client, sessionId, enabled])\n useEffect(() => {\n if (!enabled || !working) return\n let delay = 250\n const until = Date.now() + 300_000\n let timer: ReturnType<typeof setTimeout>\n const tick = () => {\n if (Date.now() >= until) return\n if (document.visibilityState !== 'hidden') refreshRef.current()\n delay = Math.min(delay * 2, 2000)\n timer = setTimeout(tick, delay)\n }\n timer = setTimeout(tick, delay)\n return () => clearTimeout(timer)\n }, [client, sessionId, working, enabled])\n}\n","import type { WebFetchProvider, WebSearchProvider } from '@deepseek-ai/dsh-web'\n\nexport const WEB_SEARCH_RPC_CHANNEL = '/web-search-manager'\nexport type RpcResult<T = unknown> = { ok: true; value: T } | {\n ok: false; error: { code: string; message: string; details: Record<string, unknown> }\n}\nexport type ProviderKind = 'search' | 'fetch'\n/** Management metadata only. Execution and source vocabulary belong to ctx.web. */\nexport interface ProviderDescriptor {\n readonly id: string\n readonly label: string\n readonly description: string\n readonly defaultBaseURL?: string\n readonly credentialRef?: string\n /** True when the key is shared with another surface. The page must not delete it. */\n readonly credentialShared?: boolean\n /** Optional notice naming the settings surface that owns a shared credential. */\n readonly credentialHint?: string\n readonly billing: 'request' | 'model-and-tools' | 'none' | 'unknown'\n /** Optional provider-supplied billing summary. */\n readonly pricing?: string\n /** Public HTTPS page explaining provider charges. */\n readonly pricingUrl?: string\n /** Public HTTPS page where the user can create an API key. */\n readonly signupUrl?: string\n /** Plugin that owns configuration. Native providers keep their settings there. */\n readonly configurationOwner?: string\n /** Explicit settings link supplied by the provider, never inferred from its id. */\n readonly configurationUrl?: string\n /** Fixed legacy route migrated by a bundle-owned adapter; not used by native plugins. */\n readonly legacyId?: string\n}\nexport const WEB_MANAGER_OWNER = '@klarkxy/dsh-web-search-manager'\n/** Optional display metadata on a provider registered directly with ctx.web. */\nexport type DiscoverableSearchProvider = WebSearchProvider & { readonly dshWebManagement?: ProviderDescriptor }\nexport type DiscoverableFetchProvider = WebFetchProvider & { readonly dshWebManagement?: ProviderDescriptor }\nexport interface ProviderOptions {\n readonly apiKey?: string\n readonly baseURL?: string\n readonly timeoutMs: number\n readonly maxFetchChars: number\n}\nexport type SearchProviderFactory = (options: ProviderOptions) => WebSearchProvider\nexport type FetchProviderFactory = (options: ProviderOptions) => WebFetchProvider\n/** Never store credential values here. Keys are resolved by reference per call. */\nexport interface WebSettings {\n revision: number\n searchEnabled: boolean\n fetchEnabled: boolean\n searchProvider: string\n fetchProvider: string\n searchOrder: string[]\n maxResults: number\n maxQueries: number\n timeoutMs: number\n maxFetchChars: number\n endpoints: Record<string, string>\n}\nexport const DEFAULT_SEARCH_ORDER = ['ddg'] as const\n\nexport const defaultSettings = (): WebSettings => ({\n revision: 0, searchEnabled: true, fetchEnabled: true,\n searchProvider: 'ddg', fetchProvider: 'http', searchOrder: [...DEFAULT_SEARCH_ORDER],\n maxResults: 5, maxQueries: 1,\n timeoutMs: 30_000, maxFetchChars: 100_000, endpoints: {},\n})\n\n/** Keyed backends first, keyless last — same idea as OpenClaw auto-detect. */\nexport function defaultSearchOrder(ids: readonly string[], keyed: (id: string) => boolean): string[] {\n return [...ids.filter(keyed), ...ids.filter(id => !keyed(id))]\n}\n\nexport function migrateSearchOrder(settings: { searchOrder?: string[]; searchProvider?: string }): string[] {\n return settings.searchOrder ?? (settings.searchProvider ? [settings.searchProvider] : [...DEFAULT_SEARCH_ORDER])\n}\n\nexport function resolveSearchOrder(\n knownIds: readonly string[],\n settings: Pick<WebSettings, 'searchOrder' | 'searchProvider'>,\n _keyed: (id: string) => boolean,\n): string[] {\n return [...new Set(settings.searchOrder.filter(id => knownIds.includes(id)))]\n}\n\nexport function pickActiveSearch(order: readonly string[], configured: (id: string) => boolean): string {\n return order.find(configured) ?? ''\n}\nexport interface ProviderView extends ProviderDescriptor {\n kind: ProviderKind\n configured: boolean\n /** True only for configuration explicitly owned by this manager bundle. */\n configurationOwned?: boolean\n baseURL?: string\n calls: number\n failures: number\n}\nexport interface WebStatus {\n settings: WebSettings\n providers: ProviderView[]\n searchActive: boolean\n fetchActive: boolean\n storageFailed: boolean\n}\nexport function providerKey(kind: ProviderKind, id: string): string { return `${kind}:${id}` }\nexport function safeConfigurationUrl(value: unknown): string | undefined {\n if (typeof value !== 'string' || !value || /[\\u0000-\\u0020\\\\]/.test(value)) return\n try {\n const url = new URL(value, 'https://dsh.invalid')\n if (url.username || url.password) return\n if ((value.startsWith('/') && !value.startsWith('//')) || value.startsWith('#')) {\n return url.origin === 'https://dsh.invalid' ? value : undefined\n }\n return /^https:\\/\\//i.test(value) && url.protocol === 'https:' ? value : undefined\n } catch { return }\n}\nexport function validateBaseURL(value: string): string {\n const url = new URL(value)\n if (url.protocol !== 'https:' || url.username || url.password || url.search || url.hash) {\n throw new Error('供应商地址必须是 HTTPS,且不能包含用户名、密码、查询参数或片段。')\n }\n return url.href.replace(/\\/+$/, '')\n}\n","import { WEB_MANAGER_OWNER, type ProviderView } from './contracts.ts'\n\n// Public prices checked on 2026-09-21; links remain available for current account terms.\n// This date applies only to bundled adapters that still use these static notes.\nexport const PROVIDER_PRICING_CHECKED = '2026-09-21'\n\ninterface ProviderInfo {\n description: string\n pricing: string\n pricingUrl?: string\n}\n\nconst providerInfo: Record<string, ProviderInfo> = {\n ddg: {\n description: '搜索 DuckDuckGo 公开网页,无需注册或 API Key。',\n pricing: '免费使用,不产生搜索 API 费用。',\n pricingUrl: 'https://duckduckgo.com/',\n },\n bocha: {\n description: '面向中文内容的网页搜索,返回标题、链接和摘要。',\n pricing: '按调用次数计费,目录价 ¥0.036/次;试用额度以官方活动为准。',\n pricingUrl: 'https://aq6ky2b8nql.feishu.cn/wiki/JYSbwzdPIiFnz4kDYPXcHSDrnZb',\n },\n brave: {\n description: '使用 Brave 独立网页索引,搜索网页、新闻等内容。',\n pricing: '每月赠 $5(约 1,000 次);超出 $5/千次,激活需绑卡。',\n pricingUrl: 'https://brave.com/search/api/',\n },\n 'deepseek-official': {\n description: '由 DeepSeek 模型调用内置搜索,复用模型 API Key。',\n pricing: '默认 Flash 按 tokens 计费:每百万输入 ¥1–2(缓存命中 ¥0.02–0.04)、输出 ¥4–8,随峰谷时段变化;赠送余额与工具费用以平台为准。',\n pricingUrl: 'https://api-docs.deepseek.com/zh-cn/quick_start/pricing/',\n },\n exa: {\n description: '面向 AI 的网页搜索,提供相关网页与内容片段。',\n pricing: '注册赠 $20,之后每月赠 $10;$7/千次(每次最多 10 条),超出 10 条每条加 $1/千次。',\n pricingUrl: 'https://exa.ai/pricing',\n },\n firecrawl: {\n description: '搜索网页,并可配合网页内容提取。',\n pricing: '每月免费 1,000 积分,搜索每 10 条结果扣 2 积分;Hobby 含 5,000 积分/月,年付折合 $16/月,额外 $5/千积分。',\n pricingUrl: 'https://www.firecrawl.dev/pricing',\n },\n serper: {\n description: '获取 Google 的网页搜索结果。',\n pricing: '注册赠 2,500 次(一次性);充值 $50/5万次($1/千次),付费额度有效期 6 个月。',\n pricingUrl: 'https://serper.dev/',\n },\n tavily: {\n description: '面向 AI 的网页搜索,当前使用基础搜索。',\n pricing: '每月免费 1,000 积分,基础搜索 1 积分/次;按量付费 $0.008/积分($8/千次)。',\n pricingUrl: 'https://docs.tavily.com/documentation/api-credits',\n },\n}\n\nfunction bundledCatalogId(provider: ProviderView): string | undefined {\n const owned = typeof provider.configurationOwned === 'boolean'\n ? provider.configurationOwned\n : !provider.configurationOwner || provider.configurationOwner === WEB_MANAGER_OWNER\n if (!owned) return\n return provider.id === 'deepseek-managed' ? 'deepseek-official' : provider.id\n}\n\nfunction missingPricing(locale: 'zh' | 'en'): string {\n return locale === 'zh' ? '未提供费用信息' : 'No pricing information provided'\n}\n\nexport function usesBundledPricing(provider: ProviderView): boolean {\n if (provider.pricing?.trim()) return false\n const catalogId = bundledCatalogId(provider)\n return Boolean(catalogId && Object.hasOwn(providerInfo, catalogId))\n}\n\nexport function searchProviderInfo(provider: ProviderView, locale: 'zh' | 'en' = 'zh'): ProviderInfo {\n const catalogId = bundledCatalogId(provider)\n const known = catalogId && Object.hasOwn(providerInfo, catalogId) ? providerInfo[catalogId] : undefined\n const description = provider.description.trim() ? provider.description : (known?.description ?? provider.description)\n if (provider.pricing?.trim()) {\n return {\n description,\n pricing: provider.pricing,\n pricingUrl: provider.pricingUrl ?? known?.pricingUrl ?? provider.signupUrl,\n }\n }\n if (known) {\n return {\n description,\n pricing: known.pricing,\n pricingUrl: provider.pricingUrl ?? known.pricingUrl ?? provider.signupUrl,\n }\n }\n return {\n description,\n pricing: missingPricing(locale),\n pricingUrl: provider.pricingUrl ?? provider.signupUrl,\n }\n}\n","import type { Context } from '@deepseek-ai/cordis'\nimport { Button, Input, SegmentedTabs, StateDot, Switch, Tag } from '@deepseek-ai/dsh-client-ui-primitives'\nimport { officialUiCss } from '@klarkxy/dsh-plugin-kit/official-ui'\nimport { createPluginReadGate } from '@klarkxy/dsh-plugin-kit/client-utils'\nimport { useCallback, useEffect, useId, useLayoutEffect, useRef, useState, useSyncExternalStore } from 'react'\nimport { PROVIDER_PRICING_CHECKED, searchProviderInfo, usesBundledPricing } from './provider-info.ts'\nimport {\n WEB_SEARCH_RPC_CHANNEL, WEB_MANAGER_OWNER, pickActiveSearch, safeConfigurationUrl,\n type ProviderView, type RpcResult, type WebSettings, type WebStatus,\n} from './contracts.ts'\n\nexport const name = 'dsh-web-search-manager-client'\nexport const inject = ['slots', 'connection', 'remote', 'remote.credentials', 'locale'] as const\n\ninterface Credentials {\n describe(refs: string[]): Promise<RpcResult<Record<string, { configured: boolean; writable: boolean; source?: string }>>>\n set(ref: string, value: string): Promise<RpcResult<unknown>>\n unset(ref: string): Promise<RpcResult<unknown>>\n}\ninterface Client {\n connection: { rpc: { call(channel: string, endpoint: string, payload: unknown): Promise<unknown> }; generation?: { subscribe(listener: () => void): () => void } }\n remote: { credentials: Credentials }\n /** Host UI language. Optional so bare test harnesses fall back to zh. */\n locale?: { getSnapshot(): { active: string }; subscribe(listener: () => void): () => void }\n slots: {\n inject(key: string, callback: () => unknown): () => void\n register(spec: { name: string; key: string }, render: unknown): () => void\n }\n}\n\nfunction unwrap<T>(result: RpcResult<T>): T {\n if (!result.ok) throw new Error(result.error.message)\n return result.value\n}\nfunction editable(settings: WebSettings): Omit<WebSettings, 'revision'> {\n const { revision: _revision, ...rest } = settings\n return rest\n}\n\nexport const STATUS_REFRESH_MS = 3000\n\nexport function isPageHidden(hidden?: boolean): boolean {\n if (hidden) return true\n return typeof document !== 'undefined' && document.visibilityState === 'hidden'\n}\n\nexport function canStartStatusRead(input: {\n source: 'user' | 'poll'\n mounted: boolean\n hidden: boolean\n busy: boolean\n reordering: boolean\n reading: boolean\n}): boolean {\n if (!input.mounted) return false\n if (input.source === 'poll') {\n return !input.hidden && !input.busy && !input.reordering && !input.reading\n }\n return true\n}\n\nexport function isExternalConfigurationUrl(url: string): boolean {\n return /^https:\\/\\//i.test(url)\n}\n\nexport function shouldApplyPolledStatus(input: {\n requestId: number\n latestRequestId: number\n busy: boolean\n reordering: boolean\n hidden: boolean\n currentRevision?: number\n incomingRevision: number\n}): boolean {\n if (input.hidden || input.busy || input.reordering) return false\n if (input.requestId !== input.latestRequestId) return false\n if (input.currentRevision !== undefined && input.incomingRevision < input.currentRevision) return false\n return true\n}\n\nexport function bindStatusRefresh(options: {\n intervalMs?: number\n isHidden: () => boolean\n tick: () => Promise<void>\n setIntervalFn?: typeof setInterval\n clearIntervalFn?: typeof clearInterval\n addListener?: (type: string, listener: () => void) => void\n removeListener?: (type: string, listener: () => void) => void\n}): () => void {\n const intervalMs = options.intervalMs ?? STATUS_REFRESH_MS\n let inFlight = false\n let stopped = false\n const run = async () => {\n if (stopped || inFlight || options.isHidden()) return\n inFlight = true\n try { await options.tick() }\n finally { inFlight = false }\n }\n const timer = (options.setIntervalFn ?? setInterval)(() => { void run() }, intervalMs)\n const onVisible = () => { if (!options.isHidden()) void run() }\n const add = options.addListener ?? ((type, listener) => {\n if (typeof document !== 'undefined') document.addEventListener(type, listener)\n })\n const remove = options.removeListener ?? ((type, listener) => {\n if (typeof document !== 'undefined') document.removeEventListener(type, listener)\n })\n add('visibilitychange', onVisible)\n return () => {\n stopped = true\n ;(options.clearIntervalFn ?? clearInterval)(timer)\n remove('visibilitychange', onVisible)\n }\n}\n\nexport function isProviderOn(status: WebStatus, provider: ProviderView): boolean {\n if (provider.kind === 'fetch') {\n return status.fetchActive && status.settings.fetchProvider === provider.id && provider.configured\n }\n return status.searchActive && selectedSearchBackend(status)?.id === provider.id\n}\n\nexport function dormantSearchPlaceholder(id: string): ProviderView {\n return {\n id, label: id, description: '', billing: 'unknown',\n kind: 'search', configured: false, calls: 0, failures: 0,\n configurationOwned: false,\n }\n}\n\nexport function isRegisteredSearch(status: WebStatus, id: string): boolean {\n return status.providers.some(provider => provider.kind === 'search' && provider.id === id)\n}\n\nexport function catalogSearchBackends(status: WebStatus): ProviderView[] {\n const byId = new Map(status.providers.filter(provider => provider.kind === 'search').map(provider => [provider.id, provider]))\n const rows: ProviderView[] = []\n const seen = new Set<string>()\n for (const id of status.settings.searchOrder) {\n if (!id || seen.has(id)) continue\n seen.add(id)\n rows.push(byId.get(id) ?? dormantSearchPlaceholder(id))\n }\n for (const provider of status.providers) {\n if (provider.kind !== 'search' || seen.has(provider.id)) continue\n rows.push(provider)\n }\n return rows\n}\n\nexport function searchBackends(status: WebStatus): ProviderView[] {\n const participating = new Set(status.settings.searchOrder)\n return catalogSearchBackends(status).filter(provider => participating.has(provider.id))\n}\n\nexport function selectedSearchBackend(status: WebStatus): ProviderView | undefined {\n const backends = searchBackends(status).filter(provider => isRegisteredSearch(status, provider.id))\n const id = pickActiveSearch(backends.map(provider => provider.id), id => Boolean(backends.find(provider => provider.id === id)?.configured))\n return backends.find(provider => provider.id === id)\n}\n\nexport function droppedDormantIds(\n settings: WebSettings,\n order: readonly string[],\n providers: readonly ProviderView[],\n): string[] {\n const known = new Set(providers.filter(provider => provider.kind === 'search').map(provider => provider.id))\n return [...new Set(settings.searchOrder.filter(id => id && !known.has(id) && !order.includes(id)))]\n}\n\nexport type ConfigurationAccess =\n | { kind: 'owned' }\n | { kind: 'link'; url: string }\n | { kind: 'owner'; name: string }\n | { kind: 'unknown' }\n\nexport function configurationAccess(provider: ProviderView): ConfigurationAccess {\n if (ownsProviderConfiguration(provider)) return { kind: 'owned' }\n const url = safeConfigurationUrl(provider.configurationUrl)\n if (url) return { kind: 'link', url }\n if (provider.configurationOwner?.trim()) return { kind: 'owner', name: provider.configurationOwner }\n return { kind: 'unknown' }\n}\n\nfunction AppLink({ url, label, children }: { url: string; label: string; children: string }) {\n const external = isExternalConfigurationUrl(url)\n return <a href={url} {...(external ? { target: '_blank', rel: 'noreferrer noopener' } : {})} aria-label={label}\n onClick={event => {\n if (!external) return\n const bridge = (globalThis as { dshWindow?: { openExternal?(url: string): void } }).dshWindow\n if (bridge?.openExternal) {\n event.preventDefault()\n bridge.openExternal(url)\n }\n }}>{children}</a>\n}\n\nexport function canEnableSearch(\n order: readonly string[],\n providers: readonly ProviderView[],\n keys: Record<string, string>,\n writable: Record<string, boolean>,\n): boolean {\n return order.some(id => {\n const provider = providers.find(item => item.kind === 'search' && item.id === id)\n if (!provider) return false\n if (provider.configured) return true\n const typed = (keys[provider.id] ?? '').trim()\n return Boolean(ownsProviderConfiguration(provider) && provider.credentialRef && typed && writable[provider.credentialRef] !== false)\n })\n}\n\nexport function ownsProviderConfiguration(provider: Pick<ProviderView, 'configurationOwned' | 'configurationOwner'>): boolean {\n if (typeof provider.configurationOwned === 'boolean') return provider.configurationOwned\n return !provider.configurationOwner || provider.configurationOwner === WEB_MANAGER_OWNER\n}\n\nexport function nextSearchEnabled(\n currentlyEnabled: boolean,\n nextOrder: readonly string[],\n providers: readonly ProviderView[],\n keys: Record<string, string>,\n writable: Record<string, boolean>,\n): boolean {\n return currentlyEnabled && canEnableSearch(nextOrder, providers, keys, writable)\n}\n\nfunction ConfirmButton(props: { label: string; confirmLabel: string; disabled?: boolean; onConfirm(): void }) {\n const [armed, setArmed] = useState(false)\n const timer = useRef<ReturnType<typeof setTimeout>>(undefined)\n useEffect(() => () => clearTimeout(timer.current), [])\n function disarm() {\n clearTimeout(timer.current)\n setArmed(false)\n }\n return <Button variant=\"outline\" size=\"sm\" className=\"ws-danger\" disabled={props.disabled} data-armed={armed || undefined}\n onClick={() => {\n if (!armed) {\n setArmed(true)\n timer.current = setTimeout(() => setArmed(false), 3000)\n return\n }\n disarm()\n props.onConfirm()\n }}\n onBlur={disarm}>{armed ? props.confirmLabel : props.label}</Button>\n}\n\nconst copy = {\n zh: {\n tabsLabel: '网络搜索设置', tabProviders: '搜索服务', tabLimits: '请求限制',\n loading: '正在读取设置…', loadFailed: '读取设置失败:', reconnect: '重新连接',\n failed: '操作失败。', readOnly: '凭据只读,无法保存。',\n keyDeleted: '已删除 Key。', keySaved: '已保存 Key。', saved: '已保存。',\n storageFailed: '保存失败,重新保存前网络访问已暂停。',\n empty: '暂无可用搜索后端,请启用一个供应商。', toolTitle: '联网搜索', needBackend: '需选择搜索服务并配置 Key。',\n backends: '搜索后端', dragPrefix: '拖动排序 ', dragHint: '拖动排序,或用上下方向键',\n inUse: '当前使用', available: '可用', unavailable: '暂不可用', dormant: '未加载,保留选择',\n signup: '去注册', pricing: '费用说明', website: '官网', openConfig: '打开配置',\n needsKey: '待配置 Key', sharedKey: '与其他设置共用凭据',\n keyConfigured: '已配置,留空不替换', keyPlaceholder: '输入 API Key',\n saveKey: '保存 Key', deleteKey: '删除 Key', confirmDelete: '确认删除 Key?',\n test: '测试连接(可能计费)', unsaved: '有未保存的修改', save: '保存',\n saveHint: '开关与排序立即生效;Key 与限制需保存。',\n maxResults: '每条查询结果上限', maxQueries: '每次调用查询上限',\n timeoutMs: '请求超时(毫秒)', maxFetchChars: '正文字符上限',\n fetchTitle: '网页读取', fetchProvider: '读取服务', ownerSettings: '配置入口:',\n unknownOwner: '请在服务所属插件中配置',\n },\n en: {\n tabsLabel: 'Web search settings', tabProviders: 'Search services', tabLimits: 'Request limits',\n loading: 'Loading settings…', loadFailed: 'Could not load settings: ', reconnect: 'Reconnect',\n failed: 'Operation failed.', readOnly: 'Read-only credential; cannot save.',\n keyDeleted: 'Key deleted.', keySaved: 'Key saved.', saved: 'Saved.',\n storageFailed: 'Save failed; network access is paused until you save again.',\n empty: 'No search backends yet; enable a provider.', toolTitle: 'Web search', needBackend: 'Needs a search service with a key.',\n backends: 'Search backends', dragPrefix: 'Reorder ', dragHint: 'Drag to reorder, or use arrow keys',\n inUse: 'In use', available: 'Available', unavailable: 'Unavailable', dormant: 'Not loaded; selection kept',\n signup: 'Sign up', pricing: 'Pricing', website: 'Website', openConfig: 'Open configuration',\n needsKey: 'Key required', sharedKey: 'Shares a credential with other settings',\n keyConfigured: 'Configured; empty keeps it', keyPlaceholder: 'Enter API key',\n saveKey: 'Save key', deleteKey: 'Delete key', confirmDelete: 'Delete this key?',\n test: 'Test connection (may be billed)', unsaved: 'Unsaved changes', save: 'Save',\n saveHint: 'Switches and order apply now; keys and limits need saving.',\n maxResults: 'Max results/query', maxQueries: 'Max queries/call',\n timeoutMs: 'Request timeout (ms)', maxFetchChars: 'Max text chars',\n fetchTitle: 'Read web pages', fetchProvider: 'Fetch service', ownerSettings: 'Configure in: ',\n unknownOwner: 'Configure this service in its plugin',\n },\n} as const\n\ntype Copy = (typeof copy)['zh'] | (typeof copy)['en']\n\nfunction movedText(locale: 'zh' | 'en', label: string, position: number): string {\n return locale === 'zh' ? `${label} 已移至第 ${position} 位` : `${label} moved to position ${position}`\n}\nfunction pricingCheckedText(locale: 'zh' | 'en', date: string): string {\n return locale === 'zh'\n ? `内置适配器价格核对于 ${date},额度与费用以供应商账户为准。`\n : `Bundled adapter prices checked on ${date}; your provider account is authoritative.`\n}\nfunction testOkText(locale: 'zh' | 'en', sources: number): string {\n return locale === 'zh' ? `连接正常,返回 ${sources} 条来源。` : `Connection OK: ${sources} sources returned.`\n}\nfunction limitInvalidText(locale: 'zh' | 'en', label: string, min: number, max: number): string {\n return locale === 'zh' ? `${label}需为 ${min}–${max} 之间的整数。` : `${label} must be a whole number from ${min} to ${max}.`\n}\n\nconst LIMITS = [\n ['maxResults', 1, 20],\n ['maxQueries', 1, 5],\n ['timeoutMs', 1000, 120000],\n ['maxFetchChars', 1000, 200000],\n] as const\ntype LimitKey = (typeof LIMITS)[number][0]\n\n/** A limit field's raw text, or `undefined` when it is not a whole number in range. */\nexport function parseLimit(raw: string, min: number, max: number): number | undefined {\n const text = raw.trim()\n if (!/^\\d+$/u.test(text)) return undefined\n const value = Number(text)\n return value >= min && value <= max ? value : undefined\n}\n\n/**\n * Settings written by an immediate action (a switch or a reorder). It keeps the\n * saved limits and never includes typed-but-unsaved keys or limit drafts.\n */\nexport function immediateUpdate(\n settings: WebSettings,\n on: boolean,\n order: string[],\n providers?: readonly ProviderView[],\n remove: readonly string[] = [],\n): Omit<WebSettings, 'revision'> {\n let searchOrder = order\n if (providers) {\n const known = new Set(providers.filter(provider => provider.kind === 'search').map(provider => provider.id))\n const removed = new Set(remove)\n const following = order.filter(id => !removed.has(id))\n if (following.some(id => !known.has(id))) searchOrder = following\n else {\n searchOrder = settings.searchOrder.flatMap(id => {\n if (removed.has(id)) return []\n return known.has(id) ? following.splice(0, 1) : [id]\n })\n searchOrder.push(...following)\n }\n }\n return { ...editable(settings), searchOrder, searchEnabled: on }\n}\n\nfunction limitTexts(settings: WebSettings): Record<LimitKey, string> {\n return {\n maxResults: String(settings.maxResults), maxQueries: String(settings.maxQueries),\n timeoutMs: String(settings.timeoutMs), maxFetchChars: String(settings.maxFetchChars),\n }\n}\n\nfunction useHostLocale(client: Client): 'zh' | 'en' {\n const subscribe = useCallback((listener: () => void) => client.locale?.subscribe(listener) ?? (() => {}), [client])\n const snapshot = useCallback(() => client.locale?.getSnapshot().active ?? 'zh', [client])\n return String(useSyncExternalStore(subscribe, snapshot, snapshot)).startsWith('zh') ? 'zh' : 'en'\n}\n\n/** Keyboard reorders are batched: persist once the arrows stop for this long. */\nconst REORDER_DEBOUNCE_MS = 500\n\nexport function NetworkSearchSettings({ client, hidden }: { client: Client; hidden?: boolean }) {\n const locale = useHostLocale(client)\n const text: Copy = copy[locale]\n const tabsId = useId()\n const [tab, setTab] = useState<'providers' | 'limits'>('providers')\n const [status, setStatus] = useState<WebStatus>()\n const [limitDraft, setLimitDraft] = useState<Record<LimitKey, string>>()\n const [invalid, setInvalid] = useState<Partial<Record<LimitKey, boolean>>>({})\n const [keys, setKeys] = useState<Record<string, string>>({})\n const [busy, setBusy] = useState(false)\n const [pendingOrder, setPendingOrder] = useState<string[] | null>(null)\n const [dragSource, setDragSource] = useState<string | null>(null)\n const [dropTarget, setDropTarget] = useState<string | null>(null)\n const [sortAnnouncement, setSortAnnouncement] = useState('')\n const [note, setNote] = useState('')\n const [error, setError] = useState('')\n const [loadError, setLoadError] = useState('')\n const [writable, setWritable] = useState<Record<string, boolean>>({})\n const statusRef = useRef(status)\n statusRef.current = status\n const pendingRef = useRef<string[] | null>(null)\n const timerRef = useRef<ReturnType<typeof setTimeout>>(undefined)\n const handleRefs = useRef(new Map<string, HTMLButtonElement>())\n const refocusRef = useRef<string | null>(null)\n const busyRef = useRef(false)\n const hiddenRef = useRef(hidden)\n hiddenRef.current = hidden\n const requestSeq = useRef(0)\n const mountedRef = useRef(true)\n const readingRef = useRef(false)\n const readingRequest = useRef(0)\n const statusRead = useRef(Promise.resolve())\n const readGateRef = useRef<ReturnType<typeof createPluginReadGate>>(undefined)\n if (!readGateRef.current) readGateRef.current = createPluginReadGate()\n const readGate = readGateRef.current\n\n async function call<T>(endpoint: string, payload: unknown = {}): Promise<T> {\n return unwrap(await client.connection.rpc.call(WEB_SEARCH_RPC_CHANNEL, endpoint, payload) as RpcResult<T>)\n }\n function adopt(next: WebStatus, resetDraft = false) {\n const previous = statusRef.current\n statusRef.current = next\n setStatus(next)\n setLimitDraft(current => {\n const incoming = limitTexts(next.settings)\n if (!current || !previous || resetDraft) return incoming\n const baseline = limitTexts(previous.settings)\n return Object.fromEntries(LIMITS.map(([key]) =>\n [key, current[key] === baseline[key] ? incoming[key] : current[key]],\n )) as Record<LimitKey, string>\n })\n if (resetDraft) setInvalid({})\n }\n function pollBlocked(): boolean {\n return !canStartStatusRead({\n source: 'poll',\n mounted: mountedRef.current,\n hidden: isPageHidden(hiddenRef.current),\n busy: busyRef.current,\n reordering: pendingRef.current !== null,\n reading: readingRef.current,\n })\n }\n async function describeOwned(next: WebStatus, mine: number) {\n const refs = next.providers.flatMap(provider => ownsProviderConfiguration(provider) && provider.credentialRef ? [provider.credentialRef] : [])\n if (!refs.length) return\n const credentials = unwrap(await readGate.run(() => client.remote.credentials.describe(refs)))\n if (!mountedRef.current || mine !== requestSeq.current) return\n setWritable(Object.fromEntries(Object.entries(credentials).map(([ref, value]) => [ref, value.writable])))\n }\n async function load(resetDraft = false, source: 'user' | 'poll' = 'user') {\n if (source === 'poll' && !readGate.canRead()) return\n if (source === 'user') { readGate.reset(); requestSeq.current += 1 }\n while (readingRef.current) {\n if (source === 'poll' || !mountedRef.current) return\n await statusRead.current\n }\n if (!mountedRef.current) return\n if (source === 'poll' && pollBlocked()) return\n const mine = ++requestSeq.current\n readingRef.current = true\n readingRequest.current = mine\n let release = () => {}\n statusRead.current = new Promise<void>(resolve => { release = resolve })\n try {\n const next = unwrap(await readGate.run(() => client.connection.rpc.call(WEB_SEARCH_RPC_CHANNEL, 'status', {})) as RpcResult<WebStatus>)\n if (!mountedRef.current || mine !== requestSeq.current) return next\n if (source === 'poll' && !shouldApplyPolledStatus({\n requestId: mine, latestRequestId: requestSeq.current,\n busy: busyRef.current, reordering: pendingRef.current !== null,\n hidden: isPageHidden(hiddenRef.current),\n currentRevision: statusRef.current?.settings.revision,\n incomingRevision: next.settings.revision,\n })) return next\n adopt(next, resetDraft)\n setLoadError('')\n await describeOwned(next, mine)\n return next\n } catch (cause) {\n if (!mountedRef.current || mine !== requestSeq.current) return\n setLoadError(cause instanceof Error && cause.message ? cause.message : text.failed)\n if (source === 'poll') return\n throw cause\n } finally {\n if (readingRequest.current === mine) readingRef.current = false\n release()\n }\n }\n useEffect(() => {\n mountedRef.current = true\n readGate.reset()\n void load().catch(cause => setLoadError(cause instanceof Error && cause.message ? cause.message : text.failed))\n const bind = () => bindStatusRefresh({\n isHidden: () => isPageHidden(hiddenRef.current),\n tick: async () => { await load(false, 'poll').catch(() => {}) },\n })\n let stop = bind()\n const stopConnection = client.connection.generation?.subscribe(() => {\n readGate.reset()\n requestSeq.current += 1\n readingRef.current = false\n statusRead.current = Promise.resolve()\n stop()\n stop = bind()\n void load(false, 'poll')\n })\n return () => {\n mountedRef.current = false\n readGate.reset()\n requestSeq.current += 1\n stop()\n stopConnection?.()\n if (timerRef.current === undefined) return\n clearTimeout(timerRef.current)\n const current = statusRef.current\n const next = pendingRef.current\n if (current && next) {\n void call('update', { settings: immediateUpdate(current.settings, current.settings.searchEnabled, next, current.providers), expectedRevision: current.settings.revision }).catch(() => {})\n }\n }\n }, [client])\n\n useEffect(() => {\n if (hidden) return\n if (!statusRef.current) return\n void load(false, 'poll').catch(() => {})\n }, [hidden])\n\n // Keep keyboard focus on the handle that was just moved.\n useLayoutEffect(() => {\n const id = refocusRef.current\n if (!id) return\n refocusRef.current = null\n const handle = handleRefs.current.get(id)\n if (handle && document.activeElement !== handle) handle.focus()\n })\n\n async function action(run: () => Promise<void>) {\n readGate.reset()\n requestSeq.current += 1\n busyRef.current = true\n setBusy(true); setNote(''); setError('')\n try { await run() }\n catch (cause) { setError(cause instanceof Error && cause.message ? cause.message : text.failed); await load().catch(() => {}) }\n finally { busyRef.current = false; setBusy(false) }\n }\n\n /** Switches and reorders: settings only, applied at once. */\n function runImmediate(on: boolean, order: string[], remove: readonly string[] = []) {\n clearTimeout(timerRef.current); timerRef.current = undefined\n pendingRef.current = null\n void action(async () => {\n const current = statusRef.current\n if (!current) return\n const next = await call<WebStatus>('update', {\n settings: immediateUpdate(current.settings, on, order, current.providers, remove),\n expectedRevision: current.settings.revision,\n })\n setStatus(next)\n await load()\n }).then(() => { if (pendingRef.current === null) setPendingOrder(null) })\n }\n\n /** Writes every typed key. Explicit actions only (Save, Save key, Test). */\n async function saveKeys(only?: ProviderView) {\n if (!status) return\n for (const provider of status.providers) {\n if (provider.kind !== 'search' || (only && provider.id !== only.id)) continue\n const snapshot = keys[provider.id] ?? ''\n const typed = snapshot.trim()\n if (!ownsProviderConfiguration(provider) || !provider.credentialRef || !typed) continue\n if (writable[provider.credentialRef] === false) throw new Error(text.readOnly)\n unwrap(await client.remote.credentials.set(provider.credentialRef, typed))\n setKeys(current => current[provider.id] === snapshot ? { ...current, [provider.id]: '' } : current)\n }\n }\n\n async function removeKey(provider: ProviderView) {\n if (!ownsProviderConfiguration(provider) || !provider.credentialRef || provider.credentialShared || !status) return\n unwrap(await client.remote.credentials.unset(provider.credentialRef))\n setKeys(current => ({ ...current, [provider.id]: '' }))\n await load()\n setNote(text.keyDeleted)\n }\n\n if (!status || !limitDraft) {\n return <section className=\"web-search-settings ws-root dsh-ui-panel\">\n {loadError\n ? <p role=\"alert\" className=\"dsh-ui-error\">{text.loadFailed}{loadError}</p>\n : <p role=\"status\" className=\"dsh-ui-hint\">{text.loading}</p>}\n {loadError ? <div className=\"dsh-ui-actions\"><Button variant=\"outline\" size=\"sm\" disabled={busy}\n onClick={() => void action(async () => { await load() })}>{text.reconnect}</Button></div> : null}\n </section>\n }\n\n const saved = status\n const savedOrder = searchBackends(saved).map(provider => provider.id)\n const order = pendingOrder ?? savedOrder\n const catalog = catalogSearchBackends(saved)\n const backends = [\n ...order.flatMap(id => catalog.find(provider => provider.id === id) ?? []),\n ...catalog.filter(provider => !order.includes(provider.id)),\n ]\n const selected = selectedSearchBackend(saved)\n const on = saved.settings.searchEnabled\n // Immediate switches never write typed keys, so only saved keys count here.\n const canEnable = canEnableSearch(order, saved.providers, {}, writable)\n const savedLimits = limitTexts(saved.settings)\n const limitsDirty = LIMITS.some(([key]) => limitDraft[key] !== savedLimits[key])\n const keysDirty = Object.values(keys).some(value => value.trim())\n const reordering = pendingOrder !== null\n\n function move(id: string, nextIndex: number, keyboard = false) {\n const index = order.indexOf(id)\n if (busy || index < 0 || nextIndex < 0 || nextIndex >= order.length || index === nextIndex) return\n const next = [...order]\n const [item] = next.splice(index, 1)\n next.splice(nextIndex, 0, item)\n pendingRef.current = next\n setPendingOrder(next)\n if (keyboard) refocusRef.current = id\n setSortAnnouncement(movedText(locale, backends.find(provider => provider.id === id)?.label ?? id, nextIndex + 1))\n clearTimeout(timerRef.current)\n const delay = keyboard ? REORDER_DEBOUNCE_MS : 0\n timerRef.current = setTimeout(() => {\n timerRef.current = undefined\n const batched = pendingRef.current\n const current = statusRef.current\n if (batched && current) runImmediate(current.settings.searchEnabled, batched)\n }, delay)\n }\n\n function endDrag() {\n setDragSource(null)\n setDropTarget(null)\n }\n\n function saveAll() {\n const parsed: Partial<Record<LimitKey, number>> = {}\n const nextInvalid: Partial<Record<LimitKey, boolean>> = {}\n const messages: string[] = []\n for (const [key, min, max] of LIMITS) {\n const value = parseLimit(limitDraft![key], min, max)\n if (value === undefined) { nextInvalid[key] = true; messages.push(limitInvalidText(locale, text[key], min, max)) }\n else parsed[key] = value\n }\n setInvalid(nextInvalid)\n if (messages.length) { setNote(''); setError(messages.join(' ')); return }\n void action(async () => {\n await saveKeys()\n const current = statusRef.current!\n const next = await call<WebStatus>('update', {\n settings: { ...editable(current.settings), ...parsed },\n expectedRevision: current.settings.revision,\n })\n adopt(next, true)\n await load()\n setNote(text.saved)\n })\n }\n\n return <section className=\"web-search-settings ws-root dsh-ui-panel\" data-testid=\"web-search-settings\">\n <SegmentedTabs<'providers' | 'limits'>\n value={tab}\n onChange={setTab}\n label={text.tabsLabel}\n items={[\n { value: 'providers', label: text.tabProviders, id: tabsId + '-providers-tab', panelId: tabsId + '-providers-panel' },\n { value: 'limits', label: text.tabLimits, id: tabsId + '-limits-tab', panelId: tabsId + '-limits-panel' },\n ]}\n />\n <span className=\"ws-sr-only\" role=\"status\" aria-live=\"polite\">{sortAnnouncement}</span>\n {error && <p role=\"alert\" className=\"dsh-ui-error\">{error}</p>}\n {loadError ? <div className=\"dsh-ui-stack\">\n <p role=\"alert\" className=\"dsh-ui-error\">{text.loadFailed}{loadError}</p>\n <Button variant=\"outline\" size=\"sm\" disabled={busy} onClick={() => void action(async () => { await load() })}>{text.reconnect}</Button>\n </div> : null}\n {note && <p role=\"status\" className=\"dsh-ui-notice\">{note}</p>}\n {saved.storageFailed && <p role=\"alert\" className=\"dsh-ui-banner dsh-ui-banner--danger\">{text.storageFailed}</p>}\n <div role=\"tabpanel\" id={tabsId + '-providers-panel'} aria-labelledby={tabsId + '-providers-tab'}\n hidden={tab !== 'providers'} tabIndex={0}>\n {backends.length === 0 ? <p className=\"dsh-ui-empty\">{text.empty}</p> : <article\n className=\"web-search-card dsh-ui-card dsh-ui-card--flat\"\n data-testid=\"web-search-tool\"\n data-on={on ? 'true' : 'false'}>\n <header className=\"ws-card-head\">\n <div>\n <h3 className=\"dsh-ui-title\">{text.toolTitle}</h3>\n {!canEnable && <p className=\"dsh-ui-hint\">{text.needBackend}</p>}\n </div>\n <Switch\n checked={on}\n label={text.toolTitle}\n disabled={busy || (!on && !canEnable)}\n onChange={next => runImmediate(next, order)}\n />\n </header>\n <ol className=\"web-search-rank\" aria-label={text.backends}>\n {backends.map(provider => {\n const participating = order.includes(provider.id)\n const rank = order.indexOf(provider.id)\n const dormant = !isRegisteredSearch(saved, provider.id)\n const active = !dormant && saved.searchActive && selected?.id === provider.id\n const info = searchProviderInfo(provider, locale)\n const owned = ownsProviderConfiguration(provider)\n const access = configurationAccess(provider)\n const needsKey = owned && Boolean(provider.credentialRef)\n const shared = Boolean(provider.credentialShared)\n const showKey = !dormant && needsKey && participating && (!shared || !provider.configured)\n const canSort = participating && order.length > 1\n const readOnly = writable[provider.credentialRef ?? ''] === false\n const typedKey = (keys[provider.id] ?? '').trim()\n const availability = dormant ? 'dormant' : provider.configured ? 'available' : 'unavailable'\n return <li key={provider.id} className={active ? 'is-active' : undefined} data-testid={`web-search-rank-${provider.id}`}\n data-availability={availability}\n data-in-use={active || undefined}\n data-dragging={dragSource === provider.id || undefined}\n data-drop={dropTarget === provider.id && dragSource ? (order.indexOf(dragSource) < rank ? 'after' : 'before') : undefined}\n onDragOver={event => {\n if (busy || !canSort || !dragSource || dragSource === provider.id) return\n event.preventDefault()\n event.dataTransfer.dropEffect = 'move'\n setDropTarget(provider.id)\n }}\n onDragLeave={event => {\n if (!event.currentTarget.contains(event.relatedTarget as Node | null)) setDropTarget(null)\n }}\n onDrop={event => {\n if (busy || !canSort || !dragSource) return\n event.preventDefault()\n move(dragSource, rank)\n endDrag()\n }}>\n {canSort ? <Button variant=\"ghost\" size=\"sm\" className=\"web-search-drag-handle\"\n ref={(element: HTMLButtonElement | null) => {\n if (element) handleRefs.current.set(provider.id, element)\n else handleRefs.current.delete(provider.id)\n }}\n icon={<svg width=\"16\" height=\"20\" viewBox=\"0 0 16 20\" fill=\"currentColor\" aria-hidden=\"true\">\n <circle cx=\"5\" cy=\"5\" r=\"1.5\" /><circle cx=\"11\" cy=\"5\" r=\"1.5\" />\n <circle cx=\"5\" cy=\"10\" r=\"1.5\" /><circle cx=\"11\" cy=\"10\" r=\"1.5\" />\n <circle cx=\"5\" cy=\"15\" r=\"1.5\" /><circle cx=\"11\" cy=\"15\" r=\"1.5\" />\n </svg>}\n draggable={!busy} aria-disabled={busy}\n aria-label={text.dragPrefix + provider.label}\n title={text.dragHint}\n onDragStart={event => {\n if (busy) { event.preventDefault(); return }\n event.dataTransfer.effectAllowed = 'move'\n event.dataTransfer.setData('application/x-dsh-search-provider', provider.id)\n const row = event.currentTarget.closest('li')\n if (row) event.dataTransfer.setDragImage(row, 16, 16)\n setDragSource(provider.id)\n setSortAnnouncement('')\n }}\n onDragEnd={endDrag}\n onKeyDown={event => {\n if (event.key !== 'ArrowUp' && event.key !== 'ArrowDown') return\n event.preventDefault()\n move(provider.id, rank + (event.key === 'ArrowUp' ? -1 : 1), true)\n }} /> : <span className=\"web-search-rank-index\">{participating ? rank + 1 : '—'}</span>}\n <div className=\"web-search-provider\">\n <div className=\"web-search-provider-heading\">\n <strong className=\"dsh-ui-heading\">{provider.label}</strong>\n <span className=\"ws-provider-note\">\n <StateDot state={dormant ? 'idle' : provider.configured ? 'done' : 'warning'} />\n <span>{dormant ? text.dormant : provider.configured ? text.available : text.unavailable}</span>\n </span>\n {active && <Tag tone=\"success\">{text.inUse}</Tag>}\n {provider.signupUrl && <AppLink url={provider.signupUrl} label={provider.label + ' ' + text.signup}>{text.signup}</AppLink>}\n </div>\n <div className=\"web-search-provider-info\">\n {info.description ? <p>{info.description}</p> : null}\n <p>{info.pricing}{info.pricingUrl && <> <AppLink url={info.pricingUrl}\n label={provider.label + ' ' + text.pricing}>{provider.id === 'ddg' ? text.website : text.pricing}</AppLink></>}</p>\n </div>\n {access.kind === 'link' ? <p className=\"dsh-ui-hint\"><AppLink url={access.url} label={text.openConfig}>{text.openConfig}</AppLink></p>\n : access.kind === 'owner' ? <p className=\"dsh-ui-hint\">{text.ownerSettings}{access.name}</p>\n : access.kind === 'unknown' ? <p className=\"dsh-ui-hint\">{text.unknownOwner}</p>\n : null}\n {shared && participating && owned ? <small className=\"dsh-ui-meta\">{provider.credentialHint ?? text.sharedKey}</small> : null}\n {showKey ? <label className=\"dsh-ui-field\">\n <span className=\"dsh-ui-label\">API Key</span>\n <Input className=\"ws-input\" type=\"password\" autoComplete=\"off\" spellCheck={false}\n disabled={busy || readOnly}\n value={keys[provider.id] ?? ''}\n placeholder={provider.configured ? text.keyConfigured : text.keyPlaceholder}\n onChange={event => setKeys(current => ({ ...current, [provider.id]: event.target.value }))} />\n </label> : null}\n {showKey || (needsKey && !shared && provider.configured) ? <div className=\"dsh-ui-actions\">\n {showKey ? <Button variant=\"outline\" size=\"sm\" disabled={busy || readOnly || !typedKey}\n onClick={() => void action(async () => { await saveKeys(provider); await load(); setNote(text.keySaved) })}>\n {text.saveKey}</Button> : null}\n {needsKey && !shared && provider.configured ? <ConfirmButton\n disabled={busy || readOnly}\n label={text.deleteKey} confirmLabel={text.confirmDelete}\n onConfirm={() => void action(() => removeKey(provider))} /> : null}\n </div> : null}\n </div>\n <div className=\"web-search-rank-move\">\n <Switch\n checked={participating}\n label={provider.label}\n disabled={busy}\n onChange={next => {\n const following = next ? [...order, provider.id] : order.filter(id => id !== provider.id)\n runImmediate(\n nextSearchEnabled(saved.settings.searchEnabled, following, saved.providers, {}, writable),\n following,\n droppedDormantIds(saved.settings, following, saved.providers),\n )\n }} />\n </div>\n </li>\n })}\n </ol>\n {backends.some(usesBundledPricing) ? <p className=\"dsh-ui-hint\">{pricingCheckedText(locale, PROVIDER_PRICING_CHECKED)}</p> : null}\n {on ? <div className=\"dsh-ui-actions\">\n <Button variant=\"outline\" size=\"md\" disabled={busy || reordering} onClick={() => void action(async () => {\n // Testing is explicit, so typed keys are saved first and the request uses them.\n await saveKeys()\n const result = await call<{ sources: number }>('test')\n await load()\n setNote(testOkText(locale, result.sources))\n })}>{text.test}</Button>\n </div> : null}\n </article>}\n {(saved.providers.some(provider => provider.kind === 'fetch') || saved.settings.fetchProvider) && (() => {\n const fetchId = saved.settings.fetchProvider\n const fetchSelected = saved.providers.find(provider => provider.kind === 'fetch' && provider.id === fetchId)\n const fetchDormant = Boolean(fetchId) && !fetchSelected\n const fetchActive = Boolean(fetchSelected && saved.fetchActive && fetchSelected.configured)\n const fetchAccess = fetchSelected ? configurationAccess(fetchSelected) : fetchDormant ? { kind: 'unknown' as const } : undefined\n return <article className=\"dsh-ui-card dsh-ui-card--flat\" data-testid=\"web-search-fetch\"\n data-availability={fetchDormant ? 'dormant' : fetchSelected?.configured ? 'available' : 'unavailable'}\n data-in-use={fetchActive || undefined}>\n <header className=\"ws-card-head\">\n <div>\n <h3 className=\"dsh-ui-title\">{text.fetchTitle}</h3>\n <p className=\"ws-provider-note\">\n <StateDot state={fetchDormant ? 'idle' : fetchSelected?.configured ? 'done' : 'warning'} />\n <span>{fetchDormant ? text.dormant : fetchSelected?.configured ? text.available : text.unavailable}</span>\n {fetchActive ? <Tag tone=\"success\">{text.inUse}</Tag> : null}\n </p>\n </div>\n <Switch checked={saved.settings.fetchEnabled} label={text.fetchTitle} disabled={busy || reordering}\n onChange={next => void action(async () => {\n const current = statusRef.current!\n const value = await call<WebStatus>('update', { settings: { ...editable(current.settings), fetchEnabled: next }, expectedRevision: current.settings.revision })\n adopt(value); await load()\n })} />\n </header>\n <label className=\"dsh-ui-field\">\n <span className=\"dsh-ui-label\">{text.fetchProvider}</span>\n <select className=\"dsh-ui-select\" aria-label={text.fetchProvider} value={fetchId} disabled={busy || reordering}\n onChange={event => {\n const id = event.target.value\n void action(async () => {\n const current = statusRef.current!\n const value = await call<WebStatus>('update', { settings: { ...editable(current.settings), fetchProvider: id }, expectedRevision: current.settings.revision })\n adopt(value); await load()\n })\n }}>\n {fetchDormant && <option value={fetchId}>{fetchId} · {text.dormant}</option>}\n {saved.providers.filter(provider => provider.kind === 'fetch').map(provider =>\n <option key={provider.id} value={provider.id}>{provider.label}{provider.configured ? '' : ' · ' + text.unavailable}</option>)}\n </select>\n </label>\n {fetchAccess?.kind === 'link' ? <p className=\"dsh-ui-hint\"><AppLink url={fetchAccess.url} label={text.openConfig}>{text.openConfig}</AppLink></p>\n : fetchAccess?.kind === 'owner' ? <p className=\"dsh-ui-hint\">{text.ownerSettings}{fetchAccess.name}</p>\n : fetchAccess?.kind === 'unknown' ? <p className=\"dsh-ui-hint\">{text.unknownOwner}</p>\n : null}\n </article>\n })()}\n </div>\n <div role=\"tabpanel\" id={tabsId + '-limits-panel'} aria-labelledby={tabsId + '-limits-tab'}\n hidden={tab !== 'limits'} tabIndex={0}>\n <fieldset className=\"web-search-limits\" disabled={busy || reordering} aria-label={text.tabLimits}>\n {LIMITS.map(([key, min, max]) => (\n <label key={key} className=\"ws-limit\">\n <span className=\"dsh-ui-label\">{text[key]}</span>\n <Input className=\"ws-input\" type=\"number\" min={min} max={max} step={1} value={limitDraft[key]}\n aria-invalid={invalid[key] || undefined}\n onChange={event => {\n const raw = event.target.value\n setLimitDraft(current => current ? { ...current, [key]: raw } : current)\n setInvalid(current => ({ ...current, [key]: false }))\n }}\n onBlur={() => setInvalid(current => ({ ...current, [key]: parseLimit(limitDraft[key], min, max) === undefined }))} />\n {invalid[key] ? <span className=\"dsh-ui-error\">{limitInvalidText(locale, text[key], min, max)}</span> : null}\n </label>\n ))}\n </fieldset>\n </div>\n <div className=\"dsh-ui-actions dsh-ui-actions-end\">\n <span className=\"dsh-ui-meta\">{limitsDirty || keysDirty ? text.unsaved : text.saveHint}</span>\n <Button variant=\"primary\" size=\"md\" disabled={busy || reordering} onClick={saveAll}>{text.save}</Button>\n </div>\n </section>\n}\n\n/* The contract owns the type tiers, the card, the field, the button row, the\n * notice, the focus ring and the state colours. What is left is this panel's own\n * geometry: the reading width, the ranked three-column row, the drag affordance,\n * the drop indicator, the screen-reader-only announcer and the limits grid. */\nconst styles = `${officialUiCss('ws-root')}\n.ws-root { max-width: 760px; }\n.ws-card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-bottom: 8px; }\n.ws-sr-only {\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip-path: inset(50%);\n white-space: nowrap;\n border: 0;\n}\n.ws-provider-note { display: flex; align-items: center; gap: 6px; }\n.web-search-provider { display: grid; gap: 8px; min-width: 0; }\n.web-search-provider-info { display: grid; gap: 3px; font-size: 12px; line-height: 18px; color: var(--dsw-alias-label-secondary); overflow-wrap: anywhere; }\n.web-search-provider-heading { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; min-height: 24px; }\n.web-search-settings a { color: var(--dsw-alias-state-business-primary); font-size: 12px; line-height: 18px; text-underline-offset: 3px; }\n/* The primitive renders a 32px control in an inline-flex wrapper; a settings\n * field needs it to fill the column it sits in. */\n.ws-input { width: 100%; }\n.web-search-rank { margin: 0; padding: 0; list-style: none; }\n.web-search-rank li {\n position: relative;\n display: grid;\n grid-template-columns: 24px minmax(0, 1fr) auto;\n gap: 10px;\n align-items: start;\n padding: 14px 0;\n border-top: 0.5px solid var(--dsw-alias-border-l2);\n}\n.web-search-settings button.web-search-drag-handle {\n display: grid;\n place-items: center;\n width: 24px;\n height: 24px;\n min-height: 24px;\n padding: 0;\n cursor: grab;\n opacity: 0.65;\n}\n.web-search-settings button.web-search-drag-handle:hover { opacity: 1; }\n.web-search-settings button.web-search-drag-handle:active { cursor: grabbing; }\n.web-search-settings button.web-search-drag-handle[aria-disabled='true'] { cursor: wait; opacity: 0.4; }\n.web-search-rank li[data-dragging] { opacity: 0.45; }\n.web-search-rank li[data-drop]::after { content: ''; position: absolute; left: 0; right: 0; height: 2px; background: var(--dsw-alias-state-business-primary); pointer-events: none; }\n.web-search-rank li[data-drop='before']::after { top: -1px; }\n.web-search-rank li[data-drop='after']::after { bottom: -1px; }\n.web-search-rank-index { color: var(--dsw-alias-label-tertiary); font-variant-numeric: tabular-nums; line-height: 24px; }\n.web-search-rank-move { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: flex-end; padding-top: 2px; }\n.web-search-limits { margin: 0; border: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 20px; }\n/* A two-column grid, so these fields keep the contract's caption and the\n * primitive's control and only own their vertical rhythm — a stacked list is\n * what draws the hairline between fields, and there is nothing to separate. */\n.ws-limit { display: flex; flex-direction: column; gap: 6px; min-width: 0; }\n.ws-danger:hover:not(:disabled),\n.ws-danger[data-armed] { color: var(--dsw-alias-state-error-primary); border-color: var(--dsw-alias-state-error-primary); }\n.ws-danger:hover:not(:disabled) { background: var(--dsw-alias-interactive-bg-hover-danger); }\n@media (max-width: 560px) { .web-search-rank-move { flex-direction: column; align-items: flex-end; } .web-search-limits { grid-template-columns: minmax(0, 1fr); } }\n`\n\nexport function apply(ctx: Context): void {\n const client = ctx as unknown as Client\n ctx.effect(() => {\n if (typeof document === 'undefined') return () => {}\n const style = document.createElement('style')\n style.setAttribute('data-plugin', '@klarkxy/dsh-web-search-manager'); style.textContent = styles\n style.dataset.dshWebSearch = ''; document.head.appendChild(style)\n return () => style.remove()\n }, 'web-search-manager.styles')\n ctx.effect(() => client.slots.inject('plugins.bundle.config', () => client.slots.register({\n name: 'plugins.bundle.config', key: '@klarkxy/dsh-web-search-manager',\n }, (props?: { hidden?: boolean }) => <NetworkSearchSettings client={client} hidden={props?.hidden} />)), 'web-search-manager.settings')\n}\n"],"mappings":";;;;AAuH6D,OAAO,OAAO;;CAlFzE,SAAS;EACP;EACA;EACA;EACA;EACA;EACA;EACA;CACF;;CAEA,QAAQ;EAAC;EAAyB;EAAyB;EAAyB;C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AAc,OAAO;EAC5C,MAAM,aAAa,eAAe,iCAAiC;EAAG,MAAM,cAAc;EAC1F,MAAM,QAAQ,eAAe;EAAI,SAAS,KAAK,YAAY,KAAK;EAChE,aAAa,MAAM,OAAO;CAC5B,GAAG,2BAA2B;CAC9B,IAAI,aAAa,OAAO,MAAM,OAAO,+BAA+B,OAAO,MAAM,SAAS;EACxF,MAAM;EAAyB,KAAK;CACtC,IAAI,UAAiC,iBAAA,GAAA,kBAAA,IAAA,CAAC,uBAAD;EAA+B;EAAQ,QAAQ,OAAO;CAAS,CAAA,CAAC,CAAC,GAAG,6BAA6B;AACxI"}
|
|
1
|
+
{"version":3,"file":"client.inner.cjs","names":["useState","useRef","Button","useCallback","useSyncExternalStore","useId","SegmentedTabs","Switch","StateDot","Tag","Input"],"sources":["../src/client-error.ts","../../dsh-plugin-kit/src/official-ui.ts","../../dsh-plugin-kit/src/client-utils.ts","../src/contracts.ts","../src/provider-info.ts","../src/client.tsx"],"sourcesContent":["/** Local adapter diagnostics only; third-party descriptions remain verbatim. */\nconst localErrors: Record<string, string> = {\n '网络搜索设置格式无效。': 'Invalid web search settings format.',\n '未知操作。': 'Unknown operation.',\n '网络设置操作失败,请刷新后重试。': 'The network settings operation failed. Refresh and try again.',\n '查询须为 1 至 4000 字符。': 'The query must contain 1 to 4,000 characters.',\n '网络搜索插件已停止。': 'The web search plugin has stopped.',\n '请在设置 → 网络搜索中配置凭据并启用。': 'Configure credentials and enable web search in Settings → Web search.',\n '网络访问设置已改变,请重新发起请求。': 'Network access settings changed. Start the request again.',\n '网络请求已取消。': 'The network request was cancelled.',\n '网络请求已取消或超时。': 'The network request was cancelled or timed out.',\n '设置已被其他页面修改,请刷新后重试。': 'Settings changed in another page. Refresh and try again.',\n '供应商不支持自定义地址。': 'The provider does not support a custom address.',\n '供应商地址须为无凭据、无查询参数的 HTTPS 地址。': 'The provider address must use HTTPS without credentials or query parameters.',\n '需选择已安装的供应商并填写有效凭据。': 'Choose an installed provider and enter valid credentials.',\n '保存失败,本次运行已暂停网络访问以防意外联网。': 'Saving failed. Network access is paused for this run to prevent unintended requests.',\n '供应商未提供错误描述。': 'The provider did not supply an error description.',\n '供应商请求失败。': 'Provider request failed.',\n '搜索凭据已删除或不可用,请重新配置。': 'Search credentials were deleted or are unavailable. Configure them again.',\n '供应商配置不可用。': 'Provider configuration is unavailable.',\n '查询无效。': 'Invalid query.',\n '结果数须为 1 至 20。': 'The result count must be from 1 to 20.',\n '搜索已取消。': 'Search cancelled.',\n 'Tavily 搜索已取消。': 'Tavily search cancelled.',\n '响应格式无效。': 'Invalid response shape',\n '响应缺失。': 'Missing response',\n '响应过大。': 'Response too large',\n '地址无效。': 'Invalid endpoint',\n}\n\nexport function localErrorText(message: string, locale: 'zh' | 'en'): string {\n const prefix = message.match(/^(\\[(?:search|fetch):[^\\]]+\\] )(.*)$/s)\n if (prefix) return prefix[1] + localErrorText(prefix[2], locale)\n if (locale === 'zh') {\n const known = Object.entries(localErrors).find(([, english]) => english === message)\n return known?.[0] ?? message\n }\n if (localErrors[message]) return localErrors[message]\n const http = message.match(/^供应商请求失败(HTTP (\\d{3}))。$/)\n if (http) return `Provider request failed (HTTP ${http[1]}).`\n const config = message.match(/^(brave|bocha|firecrawl|serper|Tavily) 配置不可用。$/)\n if (config) return `${config[1]} configuration is unavailable.`\n return message\n}\n","/**\n * Shared contract that keeps every plugin's browser-side UI on the official\n * DeepSeek Harness Web design language.\n *\n * Two rules produce that language, and both are load-bearing here:\n *\n * 1. Colour, radius, elevation and focus come from the host theme's real\n * `--dsw-*` tokens, written under their own names. Plugins never invent a\n * token, never alias the official ones behind a private palette (a private\n * alias is just a second, diverging theme), and never carries a literal\n * fallback — the host publishes light and dark, and a literal would pin one\n * of them. The only non-colour custom properties used are the host's own\n * content-font axis and frame clearance.\n *\n * 2. Anything the host already ships is used, not reimplemented. Controls come\n * from `@deepseek-ai/dsh-client-ui-primitives` (`Button`, `Input`,\n * `Checkbox`, `Switch`, `Tag`, `Pill`, `SegmentedControl`, `Menu`, `Modal`,\n * `Tooltip`, `Toast`, `DisclosureRow`, `StateDot`, `PathLabel`, the settings\n * form suite). This module only styles what primitives do not cover: page\n * scaffolding, field layout, banners, empty states and scroll regions.\n *\n * The metrics below are transcribed from the primitives' own CSS modules so a\n * feature panel lines up pixel-for-pixel with a native one: the 14/22 body and\n * 13/20 compact type tiers, the 0.5px hairline scale, and the elevation family\n * that draws a surface's edge in its shadow (`border: 0`) instead of a border.\n */\n\n/**\n * Every `--dsw-*` token this repo is allowed to reference, grouped by role.\n *\n * Plugins may only colour through this list. It is exported so the guard test\n * can fail a build when a stylesheet reaches for anything else — the failure\n * mode this prevents is silent: an unknown token resolves to nothing, so a\n * border disappears or a label inherits the wrong colour with no error anywhere.\n */\nexport const OFFICIAL_THEME_TOKENS = {\n /** Surfaces, from the page up to the topmost nested card. */\n surface: [\n '--dsw-alias-bg-base',\n '--dsw-alias-bg-layer-1',\n '--dsw-alias-bg-layer-2',\n '--dsw-alias-bg-layer-3',\n '--dsw-alias-bg-layer-4',\n '--dsw-alias-bg-module-platform',\n '--dsw-alias-bg-overlay',\n ],\n /** Hairlines. l1 is near-invisible on a menu surface, so menus use l2+. */\n border: ['--dsw-alias-border-l1', '--dsw-alias-border-l2', '--dsw-alias-border-l3', '--dsw-alias-border-l4'],\n /** Text. `caption` is menu shortcut text, `dimmed` is placeholder text. */\n label: [\n '--dsw-alias-label-primary',\n '--dsw-alias-label-secondary',\n '--dsw-alias-label-tertiary',\n '--dsw-alias-label-caption',\n '--dsw-alias-label-dimmed',\n '--dsw-alias-label-error',\n '--dsw-alias-label-primary-foreground',\n ],\n /** Interactive fills. The `-danger` hover belongs to destructive rows. */\n interactive: [\n '--dsw-alias-interactive-bg-hover',\n '--dsw-alias-interactive-bg-active',\n '--dsw-alias-interactive-bg-hover-danger',\n ],\n /** Accent and status. `business` is the focus ring's default colour. */\n accent: [\n '--dsw-alias-brand-primary',\n '--dsw-alias-button-primary-fill',\n '--dsw-alias-button-primary-hover',\n '--dsw-alias-button-tool-bar-fill',\n '--dsw-alias-button-tool-bar-hover',\n '--dsw-alias-button-ghost-active-fill',\n '--dsw-alias-button-ghost-active-border',\n ],\n state: [\n '--dsw-alias-state-business-primary',\n '--dsw-alias-state-success-primary',\n '--dsw-alias-state-warn-primary',\n '--dsw-alias-state-error-primary',\n '--dsw-alias-state-idle-primary',\n ],\n /** Corner scale: sm 8, md 12, lg the large card, panel the modal. */\n radius: ['--dsw-radius-sm', '--dsw-radius-md', '--dsw-radius-lg', '--dsw-radius-panel'],\n /** An elevated surface draws its edge in the shadow, so it keeps border: 0. */\n elevation: [\n '--dsw-elevation-soft',\n '--dsw-elevation-stroke',\n '--dsw-elevation-stroke-color',\n '--dsw-elevation-panel',\n '--dsw-elevation-prominent',\n ],\n /** Floats, masks and scrollbars. */\n overlay: [\n '--dsw-menu-surface-fill',\n '--dsw-menu-backdrop-filter',\n '--dsw-mask-blur',\n '--dsw-alias-bg-mask-1',\n '--dsw-alias-menu-icon',\n '--dsw-alias-scrollbar-bg-l2',\n '--dsw-alias-scrollbar-hover-l2',\n '--dsw-shadow-lv3',\n ],\n /** Motion, focus and type axis, published by the host rather than by a component. */\n system: [\n '--dsw-focus-ring-width',\n '--dsw-focus-ring-color',\n '--dsw-font-markdown-code-font-family',\n '--ds-transition-duration',\n '--ds-ease-in-out',\n '--ds-font-family-code',\n '--dsh-scrollbar-thumb',\n '--dsh-scrollbar-thumb-hover',\n '--dsh-content-font-size-secondary',\n '--dsh-content-font-delta',\n '--dsh-frame-top-clearance',\n ],\n} as const\n\n/** Every official token name, flat. Used by the token guard test. */\nexport const OFFICIAL_THEME_TOKEN_NAMES: readonly string[] = Object.values(OFFICIAL_THEME_TOKENS).flat()\n\n/** The elevation steps a surface can be raised by, softest first. */\nexport type OfficialElevation = 'soft' | 'stroke' | 'panel' | 'prominent'\n\n/**\n * The host's focus ring shorthand, verbatim. Writing this per control is how\n * rings drift apart; a stylesheet that draws its own focus style should use\n * {@link officialFocus} instead. The colour fallback is the host's own default.\n */\nexport const OFFICIAL_FOCUS_RING =\n 'var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color, var(--dsw-alias-state-business-primary))'\n\n/**\n * A complete `outline` declaration at the official geometry. `offset` defaults\n * to the 2px the native controls use; the host's inline field rules sit at 1px\n * and a segmented tab pulls the ring inside itself at -2px.\n */\nexport function officialFocus(offset = '2px'): string {\n return `outline: ${OFFICIAL_FOCUS_RING}; outline-offset: ${offset}`\n}\n\n/**\n * An elevated surface. The host draws a raised surface's edge inside its\n * shadow rather than as a border, so a card sets `border: 0` and takes the edge\n * from the elevation — which is also why its border stays off the alias-border\n * set that a flat, non-elevated rule would use.\n */\nexport function officialElevation(level: OfficialElevation): string {\n return `border: 0; box-shadow: var(--dsw-elevation-${level})`\n}\n\n/**\n * An elevated surface whose edge should read as a specific hairline. Rebinding\n * the stroke colour is how a menu card picks l1 while a panel picks l3, without\n * the two growing apart by hand.\n */\nexport function officialStrokedElevation(level: OfficialElevation, color: string): string {\n return `--dsw-elevation-stroke-color: ${color}; ${officialElevation(level)}`\n}\n\n/**\n * The shared stylesheet for a plugin UI, scoped under that plugin's root class.\n *\n * Scoping is what keeps this safe to always-bundle into every client: the rules\n * can only match inside the plugin's own subtree, so two plugins can both mount\n * `dsh-ui-card` without either styling the other's markup.\n *\n * Each recipe matches the root element *and* its descendants, because the\n * commonest arrangement is one element that is both — a surface that carries\n * the root class and `dsh-ui-card`, or a portaled dialog that is the root and\n * the `dsh-ui-surface`. A descendant-only scope would silently leave those\n * unstyled, with no error anywhere.\n *\n * A caveat worth knowing: `Modal` and `Menu` portal to `document.body`, so their\n * content leaves the plugin's subtree entirely. A portaled surface therefore\n * needs its own root class on an element inside the portal.\n *\n * Only patterns that primitives do not provide live here. If a control appears\n * below that `Button`/`Input`/`Switch`/`Tag`/`Menu` already covers, that is a\n * bug in this file: use the primitive and delete the recipe.\n */\nexport function officialUiCss(roots: string | readonly string[]): string {\n // One plugin often mounts several unrelated surfaces (a settings seat, a chat\n // card, a header menu), so the caller names every root. The rules below are\n // nested under a single selector list and use `&`, which the browser expands\n // per root — so one stylesheet covers all of them without duplicating itself.\n const scope = (typeof roots === 'string' ? [roots] : roots).map(root => `.${root}`).join(', ')\n const sheet = `\n/* Official DSH Web UI contract. Generated by @klarkxy/dsh-plugin-kit/official-ui.\n * Do not hand-edit the copy inside a plugin: change this module so every plugin\n * moves together. Scope: ${scope} */\n/* The scope rule below stays open for the whole sheet: every rule after it\n * nests with the parent selector, so one stylesheet can cover several unrelated\n * roots without leaking into a neighbouring plugin. Its closing brace is last. */\n${scope} {\n color: var(--dsw-alias-label-primary);\n font-family: inherit;\n font-size: 14px;\n line-height: 22px;\n min-width: 0;\n\n& *, & *::before, & *::after { box-sizing: border-box; }\n& h1, & h2, & h3, & h4, & p, & figure { margin: 0; }\n/* Keyboard focus only: pointer input keeps the native resting appearance. The\n * ring needs no radius of its own — the outline already follows the control's\n * own border-radius, and overriding it here would flatten every control. */\n& :focus-visible { ${officialFocus()}; }\n& [hidden] { display: none !important; }\n\n/* --- Type tiers. The same 14/22 and 13/20 steps the primitives use. --- */\n& .dsh-ui-title { font-size: 16px; line-height: 24px; font-weight: 500; color: var(--dsw-alias-label-primary); }\n& .dsh-ui-heading { font-size: 14px; line-height: 22px; font-weight: 500; color: var(--dsw-alias-label-primary); }\n& .dsh-ui-compact { font-size: 13px; line-height: 20px; color: var(--dsw-alias-label-primary); }\n& .dsh-ui-meta { font-size: 12px; line-height: 18px; color: var(--dsw-alias-label-secondary); }\n& .dsh-ui-hint { font-size: 12px; line-height: 18px; color: var(--dsw-alias-label-tertiary); }\n& .dsh-ui-error { font-size: 12px; line-height: 18px; color: var(--dsw-alias-state-error-primary); }\n& .dsh-ui-warn { color: var(--dsw-alias-state-warn-primary); }\n& .dsh-ui-success { color: var(--dsw-alias-state-success-primary); }\n& .dsh-ui-muted { color: var(--dsw-alias-label-tertiary); }\n& .dsh-ui-truncate { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n& .dsh-ui-wrap { min-width: 0; overflow-wrap: anywhere; }\n\n/* --- Layout scaffolding. --- */\n& .dsh-ui-stack { display: flex; flex-direction: column; gap: 12px; }\n& .dsh-ui-stack-lg { display: flex; flex-direction: column; gap: 20px; }\n& .dsh-ui-row { display: flex; align-items: center; gap: 8px; min-width: 0; }\n& .dsh-ui-row-wrap { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }\n& .dsh-ui-spacer { flex: 1; min-width: 0; }\n/* A 0.5px l2 rule is the host's section divider; reserve the same rhythm. */\n& .dsh-ui-divider { height: 0.5px; background: var(--dsw-alias-border-l2); }\n& .dsh-ui-section { display: flex; flex-direction: column; gap: 12px; padding-top: 16px; border-top: 0.5px solid var(--dsw-alias-border-l2); }\n\n/* --- Card: a raised surface whose edge lives in the shadow. --- */\n& .dsh-ui-card {\n ${officialElevation('stroke')}\n display: flex;\n flex-direction: column;\n gap: 12px;\n padding: 16px;\n border-radius: var(--dsw-radius-lg);\n background: var(--dsw-alias-bg-layer-1);\n color: var(--dsw-alias-label-primary);\n min-width: 0;\n}\n& .dsh-ui-card--flat { border: 0.5px solid var(--dsw-alias-border-l3); box-shadow: none; }\n& .dsh-ui-card--nested { background: var(--dsw-alias-bg-layer-2); }\n& .dsh-ui-card--plain { background: none; }\n\n/* --- Field: label, control, help, error. The control itself is an\n * official primitive, so this only owns the vertical rhythm. --- */\n& .dsh-ui-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }\n& .dsh-ui-field + .dsh-ui-field { border-top: 0.5px solid var(--dsw-alias-border-l2); padding-top: 12px; }\n& .dsh-ui-label { display: flex; align-items: center; gap: 6px; font-size: 13px; line-height: 20px; font-weight: 500; color: var(--dsw-alias-label-primary); }\n& .dsh-ui-label-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }\n& .dsh-ui-help { font-size: 12px; line-height: 1.6; color: var(--dsw-alias-label-secondary); }\n& .dsh-ui-help p { margin: 0; }\n& .dsh-ui-help p + p { margin-top: 8px; }\n& .dsh-ui-required { color: var(--dsw-alias-state-error-primary); }\n& .dsh-ui-control { width: 100%; min-width: 0; }\n/* An invalid control is marked on the control, not only in the message. */\n& .dsh-ui-control[aria-invalid='true'] { border-color: var(--dsw-alias-state-error-primary); }\n& .dsh-ui-readonly { display: flex; flex-direction: column; gap: 4px; min-width: 0; }\n& .dsh-ui-readonly > dt { font-size: 12px; line-height: 18px; color: var(--dsw-alias-label-tertiary); }\n& .dsh-ui-readonly > dd { margin: 0; font-size: 13px; line-height: 20px; overflow-wrap: anywhere; }\n\n/* --- Buttons row. A no-op container: it exists so actions line up on the\n * trailing edge the way every native panel does. --- */\n& .dsh-ui-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding-top: 4px; }\n& .dsh-ui-actions-end { justify-content: flex-end; }\n\n/* --- Banners. A banner is a left-rail notice, the shape used for warnings,\n * deprecations and blocking instructions. --- */\n& .dsh-ui-banner {\n display: flex;\n flex-direction: column;\n gap: 8px;\n padding: 10px 14px;\n border: 0.5px solid var(--dsw-alias-border-l3);\n border-left: 3px solid var(--dsw-alias-state-warn-primary);\n border-radius: var(--dsw-radius-md);\n background: var(--dsw-alias-bg-layer-1);\n font-size: 13px;\n line-height: 20px;\n color: var(--dsw-alias-label-secondary);\n}\n& .dsh-ui-banner-title { font-weight: 500; color: var(--dsw-alias-state-warn-primary); }\n& .dsh-ui-banner--info { border-left-color: var(--dsw-alias-state-business-primary); }\n& .dsh-ui-banner--danger { border-left-color: var(--dsw-alias-state-error-primary); }\n& .dsh-ui-banner--success { border-left-color: var(--dsw-alias-state-success-primary); }\n& .dsh-ui-banner p { margin: 0; }\n\n/* --- Inline notice: a transient confirmation with no chrome of its own. --- */\n& .dsh-ui-notice { display: flex; align-items: center; gap: 6px; font-size: 12px; line-height: 18px; color: var(--dsw-alias-state-success-primary); }\n& .dsh-ui-notice--error { color: var(--dsw-alias-state-error-primary); }\n\n/* --- Empty and loading states. Both sit in a dashed well so an empty panel\n * reads as \"nothing here yet\" rather than as a broken layout. --- */\n& .dsh-ui-empty {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n gap: 6px;\n padding: 20px 16px;\n border: 0.5px dashed var(--dsw-alias-border-l3);\n border-radius: var(--dsw-radius-md);\n font-size: 13px;\n line-height: 20px;\n color: var(--dsw-alias-label-secondary);\n}\n& .dsh-ui-loading { display: flex; align-items: center; gap: 8px; padding: 20px 0; font-size: 13px; line-height: 20px; color: var(--dsw-alias-label-secondary); }\n\n/* --- Selectable list. A row is a button-sized target with a hover fill and\n * a selected fill; the name carries the weight, the description does not. --- */\n& .dsh-ui-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; min-width: 0; }\n& .dsh-ui-list-scroll { max-height: min(66vh, 760px); overflow-y: auto; overflow-x: hidden; }\n& .dsh-ui-list-row { border-radius: var(--dsw-radius-md); }\n& .dsh-ui-list-row:hover { background: var(--dsw-alias-interactive-bg-hover); }\n& .dsh-ui-list-row[aria-selected='true'], & .dsh-ui-list-row[data-selected] { background: var(--dsw-alias-interactive-bg-active); }\n& .dsh-ui-list-item {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n gap: 4px;\n width: 100%;\n min-width: 0;\n padding: 10px 12px;\n border: 0;\n border-radius: var(--dsw-radius-md);\n background: none;\n font: inherit;\n color: inherit;\n text-align: start;\n cursor: pointer;\n}\n& .dsh-ui-list-item:disabled { cursor: default; }\n& .dsh-ui-list-item:disabled:hover { background: none; }\n& .dsh-ui-list-name { font-size: 14px; line-height: 22px; font-weight: 500; color: var(--dsw-alias-label-primary); overflow-wrap: anywhere; }\n& .dsh-ui-list-desc { font-size: 12px; line-height: 18px; color: var(--dsw-alias-label-tertiary); }\n\n/* --- Code and structured output. Wraps rather than scrolls, because a\n * feature panel is read rather than scanned. --- */\n& .dsh-ui-code {\n padding: 10px 12px;\n border: 0.5px solid var(--dsw-alias-border-l3);\n border-radius: var(--dsw-radius-md);\n background: var(--dsw-alias-bg-layer-1);\n font-family: var(--ds-font-family-code);\n font-size: 12px;\n line-height: 20px;\n color: var(--dsw-alias-label-secondary);\n overflow-wrap: anywhere;\n white-space: pre-wrap;\n}\n& .dsh-ui-scroll { max-height: 60vh; overflow: auto; overscroll-behavior: contain; }\n\n/* --- A toggle row: label on the left, switch on the trailing edge. This is\n * layout only; the switch itself is the official primitive. --- */\n& .dsh-ui-toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-width: 0; padding: 12px 0; }\n& .dsh-ui-toggle-row + .dsh-ui-toggle-row { border-top: 0.5px solid var(--dsw-alias-border-l2); }\n& .dsh-ui-toggle-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; }\n& .dsh-ui-toggle-label { font-size: 14px; line-height: 22px; font-weight: 500; color: var(--dsw-alias-label-primary); }\n\n/* --- Floating surface: a panel anchored to a trigger. This is the material\n * a menu card is made of — the translucent fill plus its backdrop blur, with\n * the edge riding inside the prominent elevation. A plugin that hand-rolls this\n * is how tokens like --dsw-specific-menu get invented; use this instead. --- */\n& .dsh-ui-surface {\n --dsw-elevation-stroke-color: var(--dsw-alias-border-l1);\n --dsh-scrollbar-thumb: var(--dsw-alias-scrollbar-bg-l2);\n --dsh-scrollbar-thumb-hover: var(--dsw-alias-scrollbar-hover-l2);\n position: relative;\n display: flex;\n flex-direction: column;\n border: 0;\n border-radius: var(--dsw-radius-lg);\n background: var(--dsw-menu-surface-fill);\n backdrop-filter: var(--dsw-menu-backdrop-filter);\n box-shadow: var(--dsw-elevation-prominent);\n color: var(--dsw-alias-label-primary);\n font-size: 13px;\n line-height: 20px;\n min-width: 0;\n}\n& .dsh-ui-surface-body { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px 14px; overflow-y: auto; }\n& .dsh-ui-surface-head { display: flex; align-items: center; gap: 8px; min-width: 0; }\n& .dsh-ui-surface-title { font-size: 14px; line-height: 22px; font-weight: 500; color: var(--dsw-alias-label-primary); }\n\n/* --- Native select. The primitives ship no select, so a plugin that offers a\n * closed list of choices keeps the platform control and matches the official\n * settings field geometry exactly (34px, 0.5px l4, radius-md, layer-3). A\n * SegmentedControl is the primitive to reach for when the choices are few\n * enough to show at once. --- */\n& .dsh-ui-select {\n box-sizing: border-box;\n width: 100%;\n min-width: 0;\n height: 34px;\n padding: 0 12px;\n border: 0.5px solid var(--dsw-alias-border-l4);\n border-radius: var(--dsw-radius-md);\n background: var(--dsw-alias-bg-layer-3);\n font: inherit;\n font-size: 13px;\n line-height: 1.5;\n color: var(--dsw-alias-label-primary);\n cursor: pointer;\n}\n& .dsh-ui-select:focus-visible { outline: none; border-color: var(--dsw-alias-state-business-primary); }\n& .dsh-ui-select:disabled { color: var(--dsw-alias-label-tertiary); cursor: default; }\n& .dsh-ui-select[aria-invalid='true'] { border-color: var(--dsw-alias-state-error-primary); }\n\n/* Long panels scroll inside themselves instead of growing the host page. */\n& .dsh-ui-panel { display: flex; flex-direction: column; gap: 16px; min-width: 0; }\n& .dsh-ui-panel-wide { max-width: 100%; }\n\n@media (prefers-reduced-motion: reduce) {\n & *, & *::before, & *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }\n}\n}\n`\n // Widen every recipe from \"a descendant of the root\" to \"the root, or one of\n // its descendants\". Written as a transform rather than by hand so no recipe\n // can be added later with only the descendant form. The pattern is narrow on\n // purpose: a leading `&` followed by one recipe class and no combinator, so\n // sibling and child rules such as `.dsh-ui-field + .dsh-ui-field` keep their\n // own meaning and are left alone.\n return sheet.replace(/^& (\\.dsh-ui-[a-z0-9-]+)(?![+>~])/gm, (_match, className: string) =>\n `&${className}, & ${className}`)\n}\n","import { useCallback, useEffect, useRef, useSyncExternalStore } from 'react'\n\n/** Fixed pause for failing background reads; manual work is never replayed. */\nexport function createPluginReadGate(now: () => number = Date.now) {\n let pausedUntil = 0\n let epoch = 0\n return {\n canRead: () => now() >= pausedUntil,\n reset: () => { epoch++; pausedUntil = 0 },\n async run<T>(read: () => Promise<T>): Promise<T> {\n const current = epoch\n try {\n const value = await read()\n if (current === epoch) pausedUntil = 0\n return value\n } catch (error) {\n // The native Connection error is an Error with this exact HTTP text.\n // Authentication, application failures, and cancellation stay distinct.\n const message = error instanceof Error ? error.message : ''\n if (current === epoch && (/(?:^|\\s)transport failure for .+: HTTP (?:404|405|503)\\b/.test(message)\n || (error instanceof TypeError && /^(?:Failed to fetch|fetch failed|NetworkError when attempting to fetch resource\\.?)$/i.test(message)))) {\n pausedUntil = now() + 30_000\n }\n throw error\n }\n },\n }\n}\n\nexport interface NativeSurfaceClient {\n sessions: {\n binding?(sessionId: string): { eventSource: { subscribe(listener: () => void): () => void } } | undefined\n }\n uiWorkspace: { current?: { getSnapshot(): { sessionId: string } | undefined; subscribe(listener: () => void): () => void } }\n uiSession: { adapter: { current: { getSnapshot(): { key?: string }; subscribe(listener: () => void): () => void } } }\n locale: { getSnapshot(): { active: string }; subscribe(listener: () => void): () => void }\n connection?: { generation?: { subscribe(listener: () => void): () => void } }\n}\n\n/** The Editor retains its manuscript session separately; native DSH exposes the main-view binding. */\nexport function selectedSessionId(client: Pick<NativeSurfaceClient, 'uiWorkspace' | 'uiSession'>): string {\n const workspace = client.uiWorkspace?.current\n return workspace\n ? workspace.getSnapshot()?.sessionId ?? ''\n : client.uiSession.adapter.current.getSnapshot().key ?? ''\n}\n\n/**\n * Owner props are data the host composed, never a Cordis context: reading an\n * undeclared property off one throws instead of returning undefined, which\n * would crash the slot entry and abdicate its cell for good. Tolerate a\n * throwing read so a mistaken prop degrades to \"not supplied\".\n */\nfunction read(source: unknown, key: string): unknown {\n if (source === null || typeof source !== 'object') return undefined\n try {\n return (source as Record<string, unknown>)[key]\n } catch {\n return undefined\n }\n}\n\nfunction readString(source: unknown, key: string): string | undefined {\n const value = read(source, key)\n return typeof value === 'string' ? value : undefined\n}\n\n/** Owner props win; native settings only supplies close, so resolve its selected session. */\nexport function useNativeSeat(client: NativeSurfaceClient, props?: unknown) {\n const current = useSyncExternalStore(\n useCallback((fn: () => void) => (client.uiWorkspace?.current ?? client.uiSession.adapter.current).subscribe(fn), [client]),\n useCallback(() => selectedSessionId(client), [client]),\n () => '',\n )\n const language = useSyncExternalStore(\n useCallback((fn: () => void) => client.locale.subscribe(fn), [client]),\n useCallback(() => client.locale.getSnapshot().active, [client]),\n () => 'en',\n )\n const sessionId = readString(props, 'sessionId') ?? readString(read(props, 'owner'), 'sessionId') ?? current\n const requestedLocale = read(props, 'locale') ?? read(read(props, 'owner'), 'locale') ?? language\n return { sessionId, locale: (String(requestedLocale).startsWith('zh') ? 'zh' : 'en') as 'zh' | 'en',\n hidden: read(props, 'hidden') === true || read(read(props, 'owner'), 'hidden') === true }\n}\n\n/** Refresh on native log boundaries/reconnect/focus. Read-only settling is bounded to an observed job. */\nexport function useFeatureRefresh(\n client: NativeSurfaceClient, sessionId: string, refresh: () => void,\n working = false, enabled = true,\n): void {\n const refreshRef = useRef(refresh)\n refreshRef.current = refresh\n useEffect(() => {\n if (!enabled) return\n let timer: ReturnType<typeof setTimeout> | undefined\n const queue = () => {\n if (typeof document !== 'undefined' && document.visibilityState === 'hidden') return\n clearTimeout(timer)\n timer = setTimeout(() => refreshRef.current(), 150)\n }\n const source = sessionId ? client.sessions.binding?.(sessionId)?.eventSource : undefined\n const stopEvents = source?.subscribe(queue)\n const stopConnection = client.connection?.generation?.subscribe(queue)\n const visibility = () => { if (document.visibilityState === 'visible') queue() }\n window.addEventListener('focus', queue)\n document.addEventListener('visibilitychange', visibility)\n // Details are collapsed by default; opening an existing panel must get current state.\n document.addEventListener('toggle', queue, true)\n return () => {\n clearTimeout(timer)\n stopEvents?.(); stopConnection?.()\n window.removeEventListener('focus', queue)\n document.removeEventListener('visibilitychange', visibility)\n document.removeEventListener('toggle', queue, true)\n }\n }, [client, sessionId, enabled])\n useEffect(() => {\n if (!enabled || !working) return\n let delay = 250\n const until = Date.now() + 300_000\n let timer: ReturnType<typeof setTimeout>\n const tick = () => {\n if (Date.now() >= until) return\n if (document.visibilityState !== 'hidden') refreshRef.current()\n delay = Math.min(delay * 2, 2000)\n timer = setTimeout(tick, delay)\n }\n timer = setTimeout(tick, delay)\n return () => clearTimeout(timer)\n }, [client, sessionId, working, enabled])\n}\n","import type { WebFetchProvider, WebSearchProvider } from '@deepseek-ai/dsh-web'\nimport type { DshWebManagementDescriptor } from '@klarkxy/dsh-plugin-kit/contracts'\n\nexport const WEB_SEARCH_RPC_CHANNEL = '/web-search-manager'\nexport type RpcResult<T = unknown> = { ok: true; value: T } | {\n ok: false; error: { code: string; message: string; details: Record<string, unknown> }\n}\nexport type ProviderKind = 'search' | 'fetch'\n/** Management metadata only. Field contract lives in plugin-kit; execution stays with ctx.web. */\nexport interface ProviderDescriptor extends DshWebManagementDescriptor {}\nexport const WEB_MANAGER_OWNER = '@klarkxy/dsh-web-search-manager'\n/** Optional display metadata on a provider registered directly with ctx.web. */\nexport type DiscoverableSearchProvider = WebSearchProvider & { readonly dshWebManagement?: ProviderDescriptor }\nexport type DiscoverableFetchProvider = WebFetchProvider & { readonly dshWebManagement?: ProviderDescriptor }\nexport interface ProviderOptions {\n readonly apiKey?: string\n readonly baseURL?: string\n readonly timeoutMs: number\n readonly maxFetchChars: number\n}\nexport type SearchProviderFactory = (options: ProviderOptions) => WebSearchProvider\nexport type FetchProviderFactory = (options: ProviderOptions) => WebFetchProvider\n/** Never store credential values here. Keys are resolved by reference per call. */\nexport interface WebSettings {\n revision: number\n searchEnabled: boolean\n fetchEnabled: boolean\n searchProvider: string\n fetchProvider: string\n searchOrder: string[]\n maxResults: number\n maxQueries: number\n timeoutMs: number\n maxFetchChars: number\n endpoints: Record<string, string>\n}\nexport const DEFAULT_SEARCH_ORDER = ['ddg'] as const\n\nexport const defaultSettings = (): WebSettings => ({\n revision: 0, searchEnabled: true, fetchEnabled: true,\n searchProvider: 'ddg', fetchProvider: 'http', searchOrder: [...DEFAULT_SEARCH_ORDER],\n maxResults: 5, maxQueries: 1,\n timeoutMs: 30_000, maxFetchChars: 100_000, endpoints: {},\n})\n\n/** Keyed backends first, keyless last — same idea as OpenClaw auto-detect. */\nexport function defaultSearchOrder(ids: readonly string[], keyed: (id: string) => boolean): string[] {\n return [...ids.filter(keyed), ...ids.filter(id => !keyed(id))]\n}\n\nexport function migrateSearchOrder(settings: { searchOrder?: string[]; searchProvider?: string }): string[] {\n return settings.searchOrder ?? (settings.searchProvider ? [settings.searchProvider] : [...DEFAULT_SEARCH_ORDER])\n}\n\nexport function resolveSearchOrder(\n knownIds: readonly string[],\n settings: Pick<WebSettings, 'searchOrder' | 'searchProvider'>,\n _keyed: (id: string) => boolean,\n): string[] {\n return [...new Set(settings.searchOrder.filter(id => knownIds.includes(id)))]\n}\n\nexport function pickActiveSearch(order: readonly string[], configured: (id: string) => boolean): string {\n return order.find(configured) ?? ''\n}\nexport interface ProviderView extends ProviderDescriptor {\n kind: ProviderKind\n configured: boolean\n /** True only for configuration explicitly owned by this manager bundle. */\n configurationOwned?: boolean\n baseURL?: string\n calls: number\n failures: number\n}\nexport interface WebStatus {\n settings: WebSettings\n providers: ProviderView[]\n searchActive: boolean\n fetchActive: boolean\n storageFailed: boolean\n}\nexport function providerKey(kind: ProviderKind, id: string): string { return `${kind}:${id}` }\nexport function safeConfigurationUrl(value: unknown): string | undefined {\n if (typeof value !== 'string' || !value || /[\\u0000-\\u0020\\\\]/.test(value)) return\n try {\n const url = new URL(value, 'https://dsh.invalid')\n if (url.username || url.password) return\n if ((value.startsWith('/') && !value.startsWith('//')) || value.startsWith('#')) {\n return url.origin === 'https://dsh.invalid' ? value : undefined\n }\n return /^https:\\/\\//i.test(value) && url.protocol === 'https:' ? value : undefined\n } catch { return }\n}\nexport function validateBaseURL(value: string): string {\n const url = new URL(value)\n if (url.protocol !== 'https:' || url.username || url.password || url.search || url.hash) {\n throw new Error('供应商地址必须是 HTTPS,且不能包含用户名、密码、查询参数或片段。')\n }\n return url.href.replace(/\\/+$/, '')\n}\n","import { WEB_MANAGER_OWNER, type ProviderView } from './contracts.ts'\n\n// Public prices checked on 2026-09-21; links remain available for current account terms.\n// This date applies only to bundled adapters that still use these static notes.\nexport const PROVIDER_PRICING_CHECKED = '2026-09-21'\n\ninterface ProviderInfo {\n description: string\n pricing: string\n pricingUrl?: string\n}\n\nconst providerInfo: Record<string, ProviderInfo> = {\n ddg: {\n description: '搜索 DuckDuckGo 公开网页,无需注册或 API Key。',\n pricing: '免费使用,不产生搜索 API 费用。',\n pricingUrl: 'https://duckduckgo.com/',\n },\n bocha: {\n description: '面向中文内容的网页搜索,返回标题、链接和摘要。',\n pricing: '按调用次数计费,目录价 ¥0.036/次;试用额度以官方活动为准。',\n pricingUrl: 'https://aq6ky2b8nql.feishu.cn/wiki/JYSbwzdPIiFnz4kDYPXcHSDrnZb',\n },\n brave: {\n description: '使用 Brave 独立网页索引,搜索网页、新闻等内容。',\n pricing: '每月赠 $5(约 1,000 次);超出 $5/千次,激活需绑卡。',\n pricingUrl: 'https://brave.com/search/api/',\n },\n 'deepseek-official': {\n description: '由 DeepSeek 模型调用内置搜索,复用模型 API Key。',\n pricing: '默认 Flash 按 tokens 计费:每百万输入 ¥1–2(缓存命中 ¥0.02–0.04)、输出 ¥4–8,随峰谷时段变化;赠送余额与工具费用以平台为准。',\n pricingUrl: 'https://api-docs.deepseek.com/zh-cn/quick_start/pricing/',\n },\n exa: {\n description: '面向 AI 的网页搜索,提供相关网页与内容片段。',\n pricing: '注册赠 $20,之后每月赠 $10;$7/千次(每次最多 10 条),超出 10 条每条加 $1/千次。',\n pricingUrl: 'https://exa.ai/pricing',\n },\n firecrawl: {\n description: '搜索网页,并可配合网页内容提取。',\n pricing: '每月免费 1,000 积分,搜索每 10 条结果扣 2 积分;Hobby 含 5,000 积分/月,年付折合 $16/月,额外 $5/千积分。',\n pricingUrl: 'https://www.firecrawl.dev/pricing',\n },\n serper: {\n description: '获取 Google 的网页搜索结果。',\n pricing: '注册赠 2,500 次(一次性);充值 $50/5万次($1/千次),付费额度有效期 6 个月。',\n pricingUrl: 'https://serper.dev/',\n },\n tavily: {\n description: '面向 AI 的网页搜索,当前使用基础搜索。',\n pricing: '每月免费 1,000 积分,基础搜索 1 积分/次;按量付费 $0.008/积分($8/千次)。',\n pricingUrl: 'https://docs.tavily.com/documentation/api-credits',\n },\n}\n\n// The prices are the same dated notes in both languages; translation is not a price refresh.\nconst englishInfo: Record<string, Pick<ProviderInfo, 'description' | 'pricing'>> = {\n ddg: { description: 'Search public DuckDuckGo pages without registration or an API key.', pricing: 'Free to use; no search API fees.' },\n bocha: { description: 'Search Chinese web content, returning titles, links and summaries.', pricing: 'Charged per request: listed price ¥0.036/request; trial credits depend on official offers.' },\n brave: { description: 'Search web pages, news and more with Brave’s independent index.', pricing: '$5 in monthly credits (about 1,000 requests); then $5/1,000 requests. A payment card is required to activate.' },\n 'deepseek-official': { description: 'Call built-in search through a DeepSeek model using the model API key.', pricing: 'Default Flash token pricing per million: input ¥1–2 (cache hits ¥0.02–0.04), output ¥4–8, varying by peak/off-peak hours. Platform terms govern promotional balance and tool fees.' },\n exa: { description: 'Web search for AI with relevant pages and content snippets.', pricing: '$20 on signup, then $10 monthly credits; $7/1,000 requests (up to 10 results each), plus $1/1,000 additional results beyond 10.' },\n firecrawl: { description: 'Search the web and extract page content.', pricing: '1,000 free credits/month; 2 credits per 10 search results. Hobby includes 5,000 credits/month at $16/month billed annually; extra credits cost $5/1,000.' },\n serper: { description: 'Get Google web search results.', pricing: '2,500 one-time signup requests; $50/50,000 requests ($1/1,000). Paid credits expire after 6 months.' },\n tavily: { description: 'Web search for AI, currently using basic search.', pricing: '1,000 free credits/month; basic search uses 1 credit/request. Pay as you go: $0.008/credit ($8/1,000 requests).' },\n}\n\nconst bundledDescriptions: Record<string, readonly [string, string]> = {\n ddg: ['无需注册。默认后端。', 'No registration required. Default backend.'],\n 'deepseek-official': ['使用已配置的 DeepSeek API Key,可能产生额外搜索费用。', 'Uses the configured DeepSeek API key; additional search fees may apply.'],\n exa: ['独立 Search API。', 'Independent Search API.'],\n brave: ['Brave Search API。', 'Brave Search API.'],\n bocha: ['中文网页搜索 API。', 'Chinese web search API.'],\n serper: ['Google 结果的 Search API。', 'Search API for Google results.'],\n firecrawl: ['网页搜索与提取 API。', 'Web search and extraction API.'],\n tavily: ['Search API;固定 basic 检索,不自动升级搜索深度。', 'Search API using basic search; search depth is never upgraded automatically.'],\n}\n\n/** Translate only manager-owned labels; externally supplied metadata stays verbatim. */\nexport function providerDisplayLabel(provider: ProviderView, locale: 'zh' | 'en'): string {\n if (!bundledCatalogId(provider)) return provider.label\n if (provider.label === 'DeepSeek 搜索') return locale === 'zh' ? provider.label : 'DeepSeek search'\n if (provider.label === '博查') return locale === 'zh' ? provider.label : 'Bocha'\n if (provider.label === '网页读取') return locale === 'zh' ? provider.label : 'Read web pages'\n return provider.label\n}\n\nfunction bundledCatalogId(provider: ProviderView): string | undefined {\n const owned = typeof provider.configurationOwned === 'boolean'\n ? provider.configurationOwned\n : !provider.configurationOwner || provider.configurationOwner === WEB_MANAGER_OWNER\n if (!owned) return\n return provider.id === 'deepseek-managed' ? 'deepseek-official' : provider.id\n}\n\nfunction missingPricing(locale: 'zh' | 'en'): string {\n return locale === 'zh' ? '未提供费用信息' : 'No pricing information provided'\n}\n\nexport function usesBundledPricing(provider: ProviderView): boolean {\n if (provider.pricing?.trim()) return false\n const catalogId = bundledCatalogId(provider)\n return Boolean(catalogId && Object.hasOwn(providerInfo, catalogId))\n}\n\nexport function searchProviderInfo(provider: ProviderView, locale: 'zh' | 'en' = 'zh'): ProviderInfo {\n const catalogId = bundledCatalogId(provider)\n const base = catalogId && Object.hasOwn(providerInfo, catalogId) ? providerInfo[catalogId] : undefined\n const known = base && locale === 'en' ? { ...base, ...englishInfo[catalogId!] } : base\n const ownedCopy = catalogId ? bundledDescriptions[catalogId] : undefined\n const description = ownedCopy && provider.description === ownedCopy[0]\n ? ownedCopy[locale === 'zh' ? 0 : 1]\n : base && provider.description === base.description ? known!.description\n : provider.description.trim() ? provider.description : (known?.description ?? provider.description)\n if (provider.pricing?.trim()) {\n return {\n description,\n pricing: provider.pricing,\n pricingUrl: provider.pricingUrl ?? known?.pricingUrl ?? provider.signupUrl,\n }\n }\n if (known) {\n return {\n description,\n pricing: known.pricing,\n pricingUrl: provider.pricingUrl ?? known.pricingUrl ?? provider.signupUrl,\n }\n }\n return {\n description,\n pricing: missingPricing(locale),\n pricingUrl: provider.pricingUrl ?? provider.signupUrl,\n }\n}\n","import { localErrorText } from './client-error.ts'\nimport type { Context } from '@deepseek-ai/cordis'\nimport { Button, Input, SegmentedTabs, StateDot, Switch, Tag } from '@deepseek-ai/dsh-client-ui-primitives'\nimport { officialUiCss } from '@klarkxy/dsh-plugin-kit/official-ui'\nimport { createPluginReadGate } from '@klarkxy/dsh-plugin-kit/client-utils'\nimport { useCallback, useEffect, useId, useLayoutEffect, useRef, useState, useSyncExternalStore } from 'react'\nimport { PROVIDER_PRICING_CHECKED, providerDisplayLabel, searchProviderInfo, usesBundledPricing } from './provider-info.ts'\nimport {\n WEB_SEARCH_RPC_CHANNEL, WEB_MANAGER_OWNER, pickActiveSearch, safeConfigurationUrl,\n type ProviderView, type RpcResult, type WebSettings, type WebStatus,\n} from './contracts.ts'\n\nexport const name = 'dsh-web-search-manager-client'\nexport const inject = ['slots', 'connection', 'remote', 'remote.credentials', 'locale'] as const\n\ninterface Credentials {\n describe(refs: string[]): Promise<RpcResult<Record<string, { configured: boolean; writable: boolean; source?: string }>>>\n set(ref: string, value: string): Promise<RpcResult<unknown>>\n unset(ref: string): Promise<RpcResult<unknown>>\n}\ninterface Client {\n connection: { rpc: { call(channel: string, endpoint: string, payload: unknown): Promise<unknown> }; generation?: { subscribe(listener: () => void): () => void } }\n remote: { credentials: Credentials }\n /** Host UI language. Optional so bare test harnesses fall back to zh. */\n locale?: { getSnapshot(): { active: string }; subscribe(listener: () => void): () => void }\n slots: {\n inject(key: string, callback: () => unknown): () => void\n register(spec: { name: string; key: string }, render: unknown): () => void\n }\n}\n\nfunction unwrap<T>(result: RpcResult<T>): T {\n if (!result.ok) throw new Error(result.error.message)\n return result.value\n}\nfunction editable(settings: WebSettings): Omit<WebSettings, 'revision'> {\n const { revision: _revision, ...rest } = settings\n return rest\n}\n\nexport const STATUS_REFRESH_MS = 3000\n\nexport function isPageHidden(hidden?: boolean): boolean {\n if (hidden) return true\n return typeof document !== 'undefined' && document.visibilityState === 'hidden'\n}\n\nexport function canStartStatusRead(input: {\n source: 'user' | 'poll'\n mounted: boolean\n hidden: boolean\n busy: boolean\n reordering: boolean\n reading: boolean\n}): boolean {\n if (!input.mounted) return false\n if (input.source === 'poll') {\n return !input.hidden && !input.busy && !input.reordering && !input.reading\n }\n return true\n}\n\nexport function isExternalConfigurationUrl(url: string): boolean {\n return /^https:\\/\\//i.test(url)\n}\n\nexport function shouldApplyPolledStatus(input: {\n requestId: number\n latestRequestId: number\n busy: boolean\n reordering: boolean\n hidden: boolean\n currentRevision?: number\n incomingRevision: number\n}): boolean {\n if (input.hidden || input.busy || input.reordering) return false\n if (input.requestId !== input.latestRequestId) return false\n if (input.currentRevision !== undefined && input.incomingRevision < input.currentRevision) return false\n return true\n}\n\nexport function bindStatusRefresh(options: {\n intervalMs?: number\n isHidden: () => boolean\n tick: () => Promise<void>\n setIntervalFn?: typeof setInterval\n clearIntervalFn?: typeof clearInterval\n addListener?: (type: string, listener: () => void) => void\n removeListener?: (type: string, listener: () => void) => void\n}): () => void {\n const intervalMs = options.intervalMs ?? STATUS_REFRESH_MS\n let inFlight = false\n let stopped = false\n const run = async () => {\n if (stopped || inFlight || options.isHidden()) return\n inFlight = true\n try { await options.tick() }\n finally { inFlight = false }\n }\n const timer = (options.setIntervalFn ?? setInterval)(() => { void run() }, intervalMs)\n const onVisible = () => { if (!options.isHidden()) void run() }\n const add = options.addListener ?? ((type, listener) => {\n if (typeof document !== 'undefined') document.addEventListener(type, listener)\n })\n const remove = options.removeListener ?? ((type, listener) => {\n if (typeof document !== 'undefined') document.removeEventListener(type, listener)\n })\n add('visibilitychange', onVisible)\n return () => {\n stopped = true\n ;(options.clearIntervalFn ?? clearInterval)(timer)\n remove('visibilitychange', onVisible)\n }\n}\n\nexport function isProviderOn(status: WebStatus, provider: ProviderView): boolean {\n if (provider.kind === 'fetch') {\n return status.fetchActive && status.settings.fetchProvider === provider.id && provider.configured\n }\n return status.searchActive && selectedSearchBackend(status)?.id === provider.id\n}\n\nexport function dormantSearchPlaceholder(id: string): ProviderView {\n return {\n id, label: id, description: '', billing: 'unknown',\n kind: 'search', configured: false, calls: 0, failures: 0,\n configurationOwned: false,\n }\n}\n\nexport function isRegisteredSearch(status: WebStatus, id: string): boolean {\n return status.providers.some(provider => provider.kind === 'search' && provider.id === id)\n}\n\nexport function catalogSearchBackends(status: WebStatus): ProviderView[] {\n const byId = new Map(status.providers.filter(provider => provider.kind === 'search').map(provider => [provider.id, provider]))\n const rows: ProviderView[] = []\n const seen = new Set<string>()\n for (const id of status.settings.searchOrder) {\n if (!id || seen.has(id)) continue\n seen.add(id)\n rows.push(byId.get(id) ?? dormantSearchPlaceholder(id))\n }\n for (const provider of status.providers) {\n if (provider.kind !== 'search' || seen.has(provider.id)) continue\n rows.push(provider)\n }\n return rows\n}\n\nexport function searchBackends(status: WebStatus): ProviderView[] {\n const participating = new Set(status.settings.searchOrder)\n return catalogSearchBackends(status).filter(provider => participating.has(provider.id))\n}\n\nexport function selectedSearchBackend(status: WebStatus): ProviderView | undefined {\n const backends = searchBackends(status).filter(provider => isRegisteredSearch(status, provider.id))\n const id = pickActiveSearch(backends.map(provider => provider.id), id => Boolean(backends.find(provider => provider.id === id)?.configured))\n return backends.find(provider => provider.id === id)\n}\n\nexport function droppedDormantIds(\n settings: WebSettings,\n order: readonly string[],\n providers: readonly ProviderView[],\n): string[] {\n const known = new Set(providers.filter(provider => provider.kind === 'search').map(provider => provider.id))\n return [...new Set(settings.searchOrder.filter(id => id && !known.has(id) && !order.includes(id)))]\n}\n\nexport type ConfigurationAccess =\n | { kind: 'owned' }\n | { kind: 'link'; url: string }\n | { kind: 'owner'; name: string }\n | { kind: 'unknown' }\n\nexport function configurationAccess(provider: ProviderView): ConfigurationAccess {\n if (ownsProviderConfiguration(provider)) return { kind: 'owned' }\n const url = safeConfigurationUrl(provider.configurationUrl)\n if (url) return { kind: 'link', url }\n if (provider.configurationOwner?.trim()) return { kind: 'owner', name: provider.configurationOwner }\n return { kind: 'unknown' }\n}\n\nfunction AppLink({ url, label, children }: { url: string; label: string; children: string }) {\n const external = isExternalConfigurationUrl(url)\n return <a href={url} {...(external ? { target: '_blank', rel: 'noreferrer noopener' } : {})} aria-label={label}\n onClick={event => {\n if (!external) return\n const bridge = (globalThis as { dshWindow?: { openExternal?(url: string): void } }).dshWindow\n if (bridge?.openExternal) {\n event.preventDefault()\n bridge.openExternal(url)\n }\n }}>{children}</a>\n}\n\nexport function canEnableSearch(\n order: readonly string[],\n providers: readonly ProviderView[],\n keys: Record<string, string>,\n writable: Record<string, boolean>,\n): boolean {\n return order.some(id => {\n const provider = providers.find(item => item.kind === 'search' && item.id === id)\n if (!provider) return false\n if (provider.configured) return true\n const typed = (keys[provider.id] ?? '').trim()\n return Boolean(ownsProviderConfiguration(provider) && provider.credentialRef && typed && writable[provider.credentialRef] !== false)\n })\n}\n\nexport function ownsProviderConfiguration(provider: Pick<ProviderView, 'configurationOwned' | 'configurationOwner'>): boolean {\n if (typeof provider.configurationOwned === 'boolean') return provider.configurationOwned\n return !provider.configurationOwner || provider.configurationOwner === WEB_MANAGER_OWNER\n}\n\nexport function nextSearchEnabled(\n currentlyEnabled: boolean,\n nextOrder: readonly string[],\n providers: readonly ProviderView[],\n keys: Record<string, string>,\n writable: Record<string, boolean>,\n): boolean {\n return currentlyEnabled && canEnableSearch(nextOrder, providers, keys, writable)\n}\n\nfunction ConfirmButton(props: { label: string; confirmLabel: string; disabled?: boolean; onConfirm(): void }) {\n const [armed, setArmed] = useState(false)\n const timer = useRef<ReturnType<typeof setTimeout>>(undefined)\n useEffect(() => () => clearTimeout(timer.current), [])\n function disarm() {\n clearTimeout(timer.current)\n setArmed(false)\n }\n return <Button variant=\"outline\" size=\"sm\" className=\"ws-danger\" disabled={props.disabled} data-armed={armed || undefined}\n onClick={() => {\n if (!armed) {\n setArmed(true)\n timer.current = setTimeout(() => setArmed(false), 3000)\n return\n }\n disarm()\n props.onConfirm()\n }}\n onBlur={disarm}>{armed ? props.confirmLabel : props.label}</Button>\n}\n\nconst copy = {\n zh: {\n tabsLabel: '网络搜索设置', tabProviders: '搜索服务', tabLimits: '请求限制',\n loading: '正在读取设置…', loadFailed: '读取设置失败:', reconnect: '重新连接',\n failed: '操作失败。', readOnly: '凭据只读,无法保存。',\n keyDeleted: '已删除 Key。', keySaved: '已保存 Key。', saved: '已保存。',\n storageFailed: '保存失败,重新保存前网络访问已暂停。',\n empty: '暂无可用搜索后端,请启用一个供应商。', toolTitle: '联网搜索', needBackend: '需选择搜索服务并配置 Key。',\n backends: '搜索后端', dragPrefix: '拖动排序 ', dragHint: '拖动排序,或用上下方向键',\n inUse: '当前使用', available: '可用', unavailable: '暂不可用', dormant: '未加载,保留选择',\n signup: '去注册', pricing: '费用说明', website: '官网', openConfig: '打开配置',\n needsKey: '待配置 Key', sharedKey: '与其他设置共用凭据',\n keyConfigured: '已配置,留空不替换', keyPlaceholder: '输入 API Key',\n saveKey: '保存 Key', deleteKey: '删除 Key', confirmDelete: '确认删除 Key?',\n test: '测试连接(可能计费)', unsaved: '有未保存的修改', save: '保存',\n saveHint: '开关与排序立即生效;Key 与限制需保存。',\n maxResults: '每条查询结果上限', maxQueries: '每次调用查询上限',\n timeoutMs: '请求超时(毫秒)', maxFetchChars: '正文字符上限',\n fetchTitle: '网页读取', fetchProvider: '读取服务', ownerSettings: '配置入口:',\n unknownOwner: '请在服务所属插件中配置',\n },\n en: {\n tabsLabel: 'Web search settings', tabProviders: 'Search services', tabLimits: 'Request limits',\n loading: 'Loading settings…', loadFailed: 'Could not load settings: ', reconnect: 'Reconnect',\n failed: 'Operation failed.', readOnly: 'Read-only credential; cannot save.',\n keyDeleted: 'Key deleted.', keySaved: 'Key saved.', saved: 'Saved.',\n storageFailed: 'Save failed; network access is paused until you save again.',\n empty: 'No search backends yet; enable a provider.', toolTitle: 'Web search', needBackend: 'Needs a search service with a key.',\n backends: 'Search backends', dragPrefix: 'Reorder ', dragHint: 'Drag to reorder, or use arrow keys',\n inUse: 'In use', available: 'Available', unavailable: 'Unavailable', dormant: 'Not loaded; selection kept',\n signup: 'Sign up', pricing: 'Pricing', website: 'Website', openConfig: 'Open configuration',\n needsKey: 'Key required', sharedKey: 'Shares a credential with other settings',\n keyConfigured: 'Configured; empty keeps it', keyPlaceholder: 'Enter API key',\n saveKey: 'Save key', deleteKey: 'Delete key', confirmDelete: 'Delete this key?',\n test: 'Test connection (may be billed)', unsaved: 'Unsaved changes', save: 'Save',\n saveHint: 'Switches and order apply now; keys and limits need saving.',\n maxResults: 'Max results/query', maxQueries: 'Max queries/call',\n timeoutMs: 'Request timeout (ms)', maxFetchChars: 'Max text chars',\n fetchTitle: 'Read web pages', fetchProvider: 'Fetch service', ownerSettings: 'Configure in: ',\n unknownOwner: 'Configure this service in its plugin',\n },\n} as const\n\ntype Copy = (typeof copy)['zh'] | (typeof copy)['en']\n\n// Keep action outcomes as data so a language switch also updates existing notices.\ntype UiMessage = string | { key: keyof Copy } | { sources: number } | { moved: string; position: number } | { invalid: LimitKey[] }\nclass UiError extends Error {\n constructor(readonly key: keyof Copy) { super(key) }\n}\n\nfunction uiMessage(message: UiMessage, locale: 'zh' | 'en', providers: ProviderView[] = []): string {\n if (typeof message === 'string') return localErrorText(message, locale)\n if ('key' in message) return copy[locale][message.key]\n if ('sources' in message) return testOkText(locale, message.sources)\n if ('moved' in message) {\n const provider = providers.find(item => item.id === message.moved)\n return movedText(locale, provider ? providerDisplayLabel(provider, locale) : message.moved, message.position)\n }\n return message.invalid.map(key => {\n const [, min, max] = LIMITS.find(item => item[0] === key)!\n return limitInvalidText(locale, copy[locale][key], min, max)\n }).join(' ')\n}\n\nfunction movedText(locale: 'zh' | 'en', label: string, position: number): string {\n return locale === 'zh' ? `${label} 已移至第 ${position} 位` : `${label} moved to position ${position}`\n}\nfunction pricingCheckedText(locale: 'zh' | 'en', date: string): string {\n return locale === 'zh'\n ? `内置适配器价格核对于 ${date},额度与费用以供应商账户为准。`\n : `Bundled adapter prices checked on ${date}; your provider account is authoritative.`\n}\nfunction testOkText(locale: 'zh' | 'en', sources: number): string {\n return locale === 'zh' ? `连接正常,返回 ${sources} 条来源。` : `Connection OK: ${sources} sources returned.`\n}\nfunction limitInvalidText(locale: 'zh' | 'en', label: string, min: number, max: number): string {\n return locale === 'zh' ? `${label}需为 ${min}–${max} 之间的整数。` : `${label} must be a whole number from ${min} to ${max}.`\n}\n\nconst LIMITS = [\n ['maxResults', 1, 20],\n ['maxQueries', 1, 5],\n ['timeoutMs', 1000, 120000],\n ['maxFetchChars', 1000, 200000],\n] as const\ntype LimitKey = (typeof LIMITS)[number][0]\n\n/** A limit field's raw text, or `undefined` when it is not a whole number in range. */\nexport function parseLimit(raw: string, min: number, max: number): number | undefined {\n const text = raw.trim()\n if (!/^\\d+$/u.test(text)) return undefined\n const value = Number(text)\n return value >= min && value <= max ? value : undefined\n}\n\n/**\n * Settings written by an immediate action (a switch or a reorder). It keeps the\n * saved limits and never includes typed-but-unsaved keys or limit drafts.\n */\nexport function immediateUpdate(\n settings: WebSettings,\n on: boolean,\n order: string[],\n providers?: readonly ProviderView[],\n remove: readonly string[] = [],\n): Omit<WebSettings, 'revision'> {\n let searchOrder = order\n if (providers) {\n const known = new Set(providers.filter(provider => provider.kind === 'search').map(provider => provider.id))\n const removed = new Set(remove)\n const following = order.filter(id => !removed.has(id))\n if (following.some(id => !known.has(id))) searchOrder = following\n else {\n searchOrder = settings.searchOrder.flatMap(id => {\n if (removed.has(id)) return []\n return known.has(id) ? following.splice(0, 1) : [id]\n })\n searchOrder.push(...following)\n }\n }\n return { ...editable(settings), searchOrder, searchEnabled: on }\n}\n\nfunction limitTexts(settings: WebSettings): Record<LimitKey, string> {\n return {\n maxResults: String(settings.maxResults), maxQueries: String(settings.maxQueries),\n timeoutMs: String(settings.timeoutMs), maxFetchChars: String(settings.maxFetchChars),\n }\n}\n\nfunction useHostLocale(client: Client): 'zh' | 'en' {\n const subscribe = useCallback((listener: () => void) => client.locale?.subscribe(listener) ?? (() => {}), [client])\n const snapshot = useCallback(() => client.locale?.getSnapshot().active ?? 'zh', [client])\n return String(useSyncExternalStore(subscribe, snapshot, snapshot)).startsWith('zh') ? 'zh' : 'en'\n}\n\n/** Keyboard reorders are batched: persist once the arrows stop for this long. */\nconst REORDER_DEBOUNCE_MS = 500\n\nexport function NetworkSearchSettings({ client, hidden }: { client: Client; hidden?: boolean }) {\n const locale = useHostLocale(client)\n const text: Copy = copy[locale]\n const tabsId = useId()\n const [tab, setTab] = useState<'providers' | 'limits'>('providers')\n const [status, setStatus] = useState<WebStatus>()\n const [limitDraft, setLimitDraft] = useState<Record<LimitKey, string>>()\n const [invalid, setInvalid] = useState<Partial<Record<LimitKey, boolean>>>({})\n const [keys, setKeys] = useState<Record<string, string>>({})\n const [busy, setBusy] = useState(false)\n const [pendingOrder, setPendingOrder] = useState<string[] | null>(null)\n const [dragSource, setDragSource] = useState<string | null>(null)\n const [dropTarget, setDropTarget] = useState<string | null>(null)\n const [sortAnnouncement, setSortAnnouncement] = useState<UiMessage>('')\n const [note, setNote] = useState<UiMessage>('')\n const [error, setError] = useState<UiMessage>('')\n const [loadError, setLoadError] = useState<UiMessage>('')\n const [writable, setWritable] = useState<Record<string, boolean>>({})\n const statusRef = useRef(status)\n statusRef.current = status\n const pendingRef = useRef<string[] | null>(null)\n const timerRef = useRef<ReturnType<typeof setTimeout>>(undefined)\n const handleRefs = useRef(new Map<string, HTMLButtonElement>())\n const refocusRef = useRef<string | null>(null)\n const busyRef = useRef(false)\n const hiddenRef = useRef(hidden)\n hiddenRef.current = hidden\n const requestSeq = useRef(0)\n const mountedRef = useRef(true)\n const readingRef = useRef(false)\n const readingRequest = useRef(0)\n const statusRead = useRef(Promise.resolve())\n const readGateRef = useRef<ReturnType<typeof createPluginReadGate>>(undefined)\n if (!readGateRef.current) readGateRef.current = createPluginReadGate()\n const readGate = readGateRef.current\n\n async function call<T>(endpoint: string, payload: unknown = {}): Promise<T> {\n return unwrap(await client.connection.rpc.call(WEB_SEARCH_RPC_CHANNEL, endpoint, payload) as RpcResult<T>)\n }\n function adopt(next: WebStatus, resetDraft = false) {\n const previous = statusRef.current\n statusRef.current = next\n setStatus(next)\n setLimitDraft(current => {\n const incoming = limitTexts(next.settings)\n if (!current || !previous || resetDraft) return incoming\n const baseline = limitTexts(previous.settings)\n return Object.fromEntries(LIMITS.map(([key]) =>\n [key, current[key] === baseline[key] ? incoming[key] : current[key]],\n )) as Record<LimitKey, string>\n })\n if (resetDraft) setInvalid({})\n }\n function pollBlocked(): boolean {\n return !canStartStatusRead({\n source: 'poll',\n mounted: mountedRef.current,\n hidden: isPageHidden(hiddenRef.current),\n busy: busyRef.current,\n reordering: pendingRef.current !== null,\n reading: readingRef.current,\n })\n }\n async function describeOwned(next: WebStatus, mine: number) {\n const refs = next.providers.flatMap(provider => ownsProviderConfiguration(provider) && provider.credentialRef ? [provider.credentialRef] : [])\n if (!refs.length) return\n const credentials = unwrap(await readGate.run(() => client.remote.credentials.describe(refs)))\n if (!mountedRef.current || mine !== requestSeq.current) return\n setWritable(Object.fromEntries(Object.entries(credentials).map(([ref, value]) => [ref, value.writable])))\n }\n async function load(resetDraft = false, source: 'user' | 'poll' = 'user') {\n if (source === 'poll' && !readGate.canRead()) return\n if (source === 'user') { readGate.reset(); requestSeq.current += 1 }\n while (readingRef.current) {\n if (source === 'poll' || !mountedRef.current) return\n await statusRead.current\n }\n if (!mountedRef.current) return\n if (source === 'poll' && pollBlocked()) return\n const mine = ++requestSeq.current\n readingRef.current = true\n readingRequest.current = mine\n let release = () => {}\n statusRead.current = new Promise<void>(resolve => { release = resolve })\n try {\n const next = unwrap(await readGate.run(() => client.connection.rpc.call(WEB_SEARCH_RPC_CHANNEL, 'status', {})) as RpcResult<WebStatus>)\n if (!mountedRef.current || mine !== requestSeq.current) return next\n if (source === 'poll' && !shouldApplyPolledStatus({\n requestId: mine, latestRequestId: requestSeq.current,\n busy: busyRef.current, reordering: pendingRef.current !== null,\n hidden: isPageHidden(hiddenRef.current),\n currentRevision: statusRef.current?.settings.revision,\n incomingRevision: next.settings.revision,\n })) return next\n adopt(next, resetDraft)\n setLoadError('')\n await describeOwned(next, mine)\n return next\n } catch (cause) {\n if (!mountedRef.current || mine !== requestSeq.current) return\n setLoadError(cause instanceof Error && cause.message ? cause.message : { key: 'failed' })\n if (source === 'poll') return\n throw cause\n } finally {\n if (readingRequest.current === mine) readingRef.current = false\n release()\n }\n }\n useEffect(() => {\n mountedRef.current = true\n readGate.reset()\n void load().catch(cause => setLoadError(cause instanceof Error && cause.message ? cause.message : { key: 'failed' }))\n const bind = () => bindStatusRefresh({\n isHidden: () => isPageHidden(hiddenRef.current),\n tick: async () => { await load(false, 'poll').catch(() => {}) },\n })\n let stop = bind()\n const stopConnection = client.connection.generation?.subscribe(() => {\n readGate.reset()\n requestSeq.current += 1\n readingRef.current = false\n statusRead.current = Promise.resolve()\n stop()\n stop = bind()\n void load(false, 'poll')\n })\n return () => {\n mountedRef.current = false\n readGate.reset()\n requestSeq.current += 1\n stop()\n stopConnection?.()\n if (timerRef.current === undefined) return\n clearTimeout(timerRef.current)\n const current = statusRef.current\n const next = pendingRef.current\n if (current && next) {\n void call('update', { settings: immediateUpdate(current.settings, current.settings.searchEnabled, next, current.providers), expectedRevision: current.settings.revision }).catch(() => {})\n }\n }\n }, [client])\n\n useEffect(() => {\n if (hidden) return\n if (!statusRef.current) return\n void load(false, 'poll').catch(() => {})\n }, [hidden])\n\n // Keep keyboard focus on the handle that was just moved.\n useLayoutEffect(() => {\n const id = refocusRef.current\n if (!id) return\n refocusRef.current = null\n const handle = handleRefs.current.get(id)\n if (handle && document.activeElement !== handle) handle.focus()\n })\n\n async function action(run: () => Promise<void>) {\n readGate.reset()\n requestSeq.current += 1\n busyRef.current = true\n setBusy(true); setNote(''); setError('')\n try { await run() }\n catch (cause) { setError(cause instanceof UiError ? { key: cause.key } : cause instanceof Error && cause.message ? cause.message : { key: 'failed' }); await load().catch(() => {}) }\n finally { busyRef.current = false; setBusy(false) }\n }\n\n /** Switches and reorders: settings only, applied at once. */\n function runImmediate(on: boolean, order: string[], remove: readonly string[] = []) {\n clearTimeout(timerRef.current); timerRef.current = undefined\n pendingRef.current = null\n void action(async () => {\n const current = statusRef.current\n if (!current) return\n const next = await call<WebStatus>('update', {\n settings: immediateUpdate(current.settings, on, order, current.providers, remove),\n expectedRevision: current.settings.revision,\n })\n setStatus(next)\n await load()\n }).then(() => { if (pendingRef.current === null) setPendingOrder(null) })\n }\n\n /** Writes every typed key. Explicit actions only (Save, Save key, Test). */\n async function saveKeys(only?: ProviderView) {\n if (!status) return\n for (const provider of status.providers) {\n if (provider.kind !== 'search' || (only && provider.id !== only.id)) continue\n const snapshot = keys[provider.id] ?? ''\n const typed = snapshot.trim()\n if (!ownsProviderConfiguration(provider) || !provider.credentialRef || !typed) continue\n if (writable[provider.credentialRef] === false) throw new UiError('readOnly')\n unwrap(await client.remote.credentials.set(provider.credentialRef, typed))\n setKeys(current => current[provider.id] === snapshot ? { ...current, [provider.id]: '' } : current)\n }\n }\n\n async function removeKey(provider: ProviderView) {\n if (!ownsProviderConfiguration(provider) || !provider.credentialRef || provider.credentialShared || !status) return\n unwrap(await client.remote.credentials.unset(provider.credentialRef))\n setKeys(current => ({ ...current, [provider.id]: '' }))\n await load()\n setNote({ key: 'keyDeleted' })\n }\n\n if (!status || !limitDraft) {\n return <section className=\"web-search-settings ws-root dsh-ui-panel\">\n {loadError\n ? <p role=\"alert\" className=\"dsh-ui-error\">{text.loadFailed}{uiMessage(loadError, locale, status?.providers)}</p>\n : <p role=\"status\" className=\"dsh-ui-hint\">{text.loading}</p>}\n {loadError ? <div className=\"dsh-ui-actions\"><Button variant=\"outline\" size=\"sm\" disabled={busy}\n onClick={() => void action(async () => { await load() })}>{text.reconnect}</Button></div> : null}\n </section>\n }\n\n const saved = status\n const savedOrder = searchBackends(saved).map(provider => provider.id)\n const order = pendingOrder ?? savedOrder\n const catalog = catalogSearchBackends(saved)\n const backends = [\n ...order.flatMap(id => catalog.find(provider => provider.id === id) ?? []),\n ...catalog.filter(provider => !order.includes(provider.id)),\n ]\n const selected = selectedSearchBackend(saved)\n const on = saved.settings.searchEnabled\n // Immediate switches never write typed keys, so only saved keys count here.\n const canEnable = canEnableSearch(order, saved.providers, {}, writable)\n const savedLimits = limitTexts(saved.settings)\n const limitsDirty = LIMITS.some(([key]) => limitDraft[key] !== savedLimits[key])\n const keysDirty = Object.values(keys).some(value => value.trim())\n const reordering = pendingOrder !== null\n\n function move(id: string, nextIndex: number, keyboard = false) {\n const index = order.indexOf(id)\n if (busy || index < 0 || nextIndex < 0 || nextIndex >= order.length || index === nextIndex) return\n const next = [...order]\n const [item] = next.splice(index, 1)\n next.splice(nextIndex, 0, item)\n pendingRef.current = next\n setPendingOrder(next)\n if (keyboard) refocusRef.current = id\n setSortAnnouncement({ moved: id, position: nextIndex + 1 })\n clearTimeout(timerRef.current)\n const delay = keyboard ? REORDER_DEBOUNCE_MS : 0\n timerRef.current = setTimeout(() => {\n timerRef.current = undefined\n const batched = pendingRef.current\n const current = statusRef.current\n if (batched && current) runImmediate(current.settings.searchEnabled, batched)\n }, delay)\n }\n\n function endDrag() {\n setDragSource(null)\n setDropTarget(null)\n }\n\n function saveAll() {\n const parsed: Partial<Record<LimitKey, number>> = {}\n const nextInvalid: Partial<Record<LimitKey, boolean>> = {}\n const messages: LimitKey[] = []\n for (const [key, min, max] of LIMITS) {\n const value = parseLimit(limitDraft![key], min, max)\n if (value === undefined) { nextInvalid[key] = true; messages.push(key) }\n else parsed[key] = value\n }\n setInvalid(nextInvalid)\n if (messages.length) { setNote(''); setError({ invalid: messages }); return }\n void action(async () => {\n await saveKeys()\n const current = statusRef.current!\n const next = await call<WebStatus>('update', {\n settings: { ...editable(current.settings), ...parsed },\n expectedRevision: current.settings.revision,\n })\n adopt(next, true)\n await load()\n setNote({ key: 'saved' })\n })\n }\n\n return <section className=\"web-search-settings ws-root dsh-ui-panel\" data-testid=\"web-search-settings\">\n <SegmentedTabs<'providers' | 'limits'>\n value={tab}\n onChange={setTab}\n label={text.tabsLabel}\n items={[\n { value: 'providers', label: text.tabProviders, id: tabsId + '-providers-tab', panelId: tabsId + '-providers-panel' },\n { value: 'limits', label: text.tabLimits, id: tabsId + '-limits-tab', panelId: tabsId + '-limits-panel' },\n ]}\n />\n <span className=\"ws-sr-only\" role=\"status\" aria-live=\"polite\">{uiMessage(sortAnnouncement, locale, saved.providers)}</span>\n {error && <p role=\"alert\" className=\"dsh-ui-error\">{uiMessage(error, locale, saved.providers)}</p>}\n {loadError ? <div className=\"dsh-ui-stack\">\n <p role=\"alert\" className=\"dsh-ui-error\">{text.loadFailed}{uiMessage(loadError, locale, status?.providers)}</p>\n <Button variant=\"outline\" size=\"sm\" disabled={busy} onClick={() => void action(async () => { await load() })}>{text.reconnect}</Button>\n </div> : null}\n {note && <p role=\"status\" className=\"dsh-ui-notice\">{uiMessage(note, locale, saved.providers)}</p>}\n {saved.storageFailed && <p role=\"alert\" className=\"dsh-ui-banner dsh-ui-banner--danger\">{text.storageFailed}</p>}\n <div role=\"tabpanel\" id={tabsId + '-providers-panel'} aria-labelledby={tabsId + '-providers-tab'}\n hidden={tab !== 'providers'} tabIndex={0}>\n {backends.length === 0 ? <p className=\"dsh-ui-empty\">{text.empty}</p> : <article\n className=\"web-search-card dsh-ui-card dsh-ui-card--flat\"\n data-testid=\"web-search-tool\"\n data-on={on ? 'true' : 'false'}>\n <header className=\"ws-card-head\">\n <div>\n <h3 className=\"dsh-ui-title\">{text.toolTitle}</h3>\n {!canEnable && <p className=\"dsh-ui-hint\">{text.needBackend}</p>}\n </div>\n <Switch\n checked={on}\n label={text.toolTitle}\n disabled={busy || (!on && !canEnable)}\n onChange={next => runImmediate(next, order)}\n />\n </header>\n <ol className=\"web-search-rank\" aria-label={text.backends}>\n {backends.map(provider => {\n const participating = order.includes(provider.id)\n const rank = order.indexOf(provider.id)\n const dormant = !isRegisteredSearch(saved, provider.id)\n const active = !dormant && saved.searchActive && selected?.id === provider.id\n const info = searchProviderInfo(provider, locale)\n const owned = ownsProviderConfiguration(provider)\n const access = configurationAccess(provider)\n const needsKey = owned && Boolean(provider.credentialRef)\n const shared = Boolean(provider.credentialShared)\n const showKey = !dormant && needsKey && participating && (!shared || !provider.configured)\n const canSort = participating && order.length > 1\n const readOnly = writable[provider.credentialRef ?? ''] === false\n const typedKey = (keys[provider.id] ?? '').trim()\n const availability = dormant ? 'dormant' : provider.configured ? 'available' : 'unavailable'\n return <li key={provider.id} className={active ? 'is-active' : undefined} data-testid={`web-search-rank-${provider.id}`}\n data-availability={availability}\n data-in-use={active || undefined}\n data-dragging={dragSource === provider.id || undefined}\n data-drop={dropTarget === provider.id && dragSource ? (order.indexOf(dragSource) < rank ? 'after' : 'before') : undefined}\n onDragOver={event => {\n if (busy || !canSort || !dragSource || dragSource === provider.id) return\n event.preventDefault()\n event.dataTransfer.dropEffect = 'move'\n setDropTarget(provider.id)\n }}\n onDragLeave={event => {\n if (!event.currentTarget.contains(event.relatedTarget as Node | null)) setDropTarget(null)\n }}\n onDrop={event => {\n if (busy || !canSort || !dragSource) return\n event.preventDefault()\n move(dragSource, rank)\n endDrag()\n }}>\n {canSort ? <Button variant=\"ghost\" size=\"sm\" className=\"web-search-drag-handle\"\n ref={(element: HTMLButtonElement | null) => {\n if (element) handleRefs.current.set(provider.id, element)\n else handleRefs.current.delete(provider.id)\n }}\n icon={<svg width=\"16\" height=\"20\" viewBox=\"0 0 16 20\" fill=\"currentColor\" aria-hidden=\"true\">\n <circle cx=\"5\" cy=\"5\" r=\"1.5\" /><circle cx=\"11\" cy=\"5\" r=\"1.5\" />\n <circle cx=\"5\" cy=\"10\" r=\"1.5\" /><circle cx=\"11\" cy=\"10\" r=\"1.5\" />\n <circle cx=\"5\" cy=\"15\" r=\"1.5\" /><circle cx=\"11\" cy=\"15\" r=\"1.5\" />\n </svg>}\n draggable={!busy} aria-disabled={busy}\n aria-label={text.dragPrefix + providerDisplayLabel(provider, locale)}\n title={text.dragHint}\n onDragStart={event => {\n if (busy) { event.preventDefault(); return }\n event.dataTransfer.effectAllowed = 'move'\n event.dataTransfer.setData('application/x-dsh-search-provider', provider.id)\n const row = event.currentTarget.closest('li')\n if (row) event.dataTransfer.setDragImage(row, 16, 16)\n setDragSource(provider.id)\n setSortAnnouncement('')\n }}\n onDragEnd={endDrag}\n onKeyDown={event => {\n if (event.key !== 'ArrowUp' && event.key !== 'ArrowDown') return\n event.preventDefault()\n move(provider.id, rank + (event.key === 'ArrowUp' ? -1 : 1), true)\n }} /> : <span className=\"web-search-rank-index\">{participating ? rank + 1 : '—'}</span>}\n <div className=\"web-search-provider\">\n <div className=\"web-search-provider-heading\">\n <strong className=\"dsh-ui-heading\">{providerDisplayLabel(provider, locale)}</strong>\n <span className=\"ws-provider-note\">\n <StateDot state={dormant ? 'idle' : provider.configured ? 'done' : 'warning'} />\n <span>{dormant ? text.dormant : provider.configured ? text.available : text.unavailable}</span>\n </span>\n {active && <Tag tone=\"success\">{text.inUse}</Tag>}\n {provider.signupUrl && <AppLink url={provider.signupUrl} label={providerDisplayLabel(provider, locale) + ' ' + text.signup}>{text.signup}</AppLink>}\n </div>\n <div className=\"web-search-provider-info\">\n {info.description ? <p>{info.description}</p> : null}\n <p>{info.pricing}{info.pricingUrl && <> <AppLink url={info.pricingUrl}\n label={providerDisplayLabel(provider, locale) + ' ' + text.pricing}>{provider.id === 'ddg' ? text.website : text.pricing}</AppLink></>}</p>\n </div>\n {access.kind === 'link' ? <p className=\"dsh-ui-hint\"><AppLink url={access.url} label={text.openConfig}>{text.openConfig}</AppLink></p>\n : access.kind === 'owner' ? <p className=\"dsh-ui-hint\">{text.ownerSettings}{access.name}</p>\n : access.kind === 'unknown' ? <p className=\"dsh-ui-hint\">{text.unknownOwner}</p>\n : null}\n {shared && participating && owned ? <small className=\"dsh-ui-meta\">{provider.credentialHint === '与模型设置共用 Key'\n ? locale === 'zh' ? provider.credentialHint : 'Shares a key with model settings'\n : provider.credentialHint ?? text.sharedKey}</small> : null}\n {showKey ? <label className=\"dsh-ui-field\">\n <span className=\"dsh-ui-label\">API Key</span>\n <Input className=\"ws-input\" type=\"password\" autoComplete=\"off\" spellCheck={false}\n disabled={busy || readOnly}\n value={keys[provider.id] ?? ''}\n placeholder={provider.configured ? text.keyConfigured : text.keyPlaceholder}\n onChange={event => setKeys(current => ({ ...current, [provider.id]: event.target.value }))} />\n </label> : null}\n {showKey || (needsKey && !shared && provider.configured) ? <div className=\"dsh-ui-actions\">\n {showKey ? <Button variant=\"outline\" size=\"sm\" disabled={busy || readOnly || !typedKey}\n onClick={() => void action(async () => { await saveKeys(provider); await load(); setNote({ key: 'keySaved' }) })}>\n {text.saveKey}</Button> : null}\n {needsKey && !shared && provider.configured ? <ConfirmButton\n disabled={busy || readOnly}\n label={text.deleteKey} confirmLabel={text.confirmDelete}\n onConfirm={() => void action(() => removeKey(provider))} /> : null}\n </div> : null}\n </div>\n <div className=\"web-search-rank-move\">\n <Switch\n checked={participating}\n label={providerDisplayLabel(provider, locale)}\n disabled={busy}\n onChange={next => {\n const following = next ? [...order, provider.id] : order.filter(id => id !== provider.id)\n runImmediate(\n nextSearchEnabled(saved.settings.searchEnabled, following, saved.providers, {}, writable),\n following,\n droppedDormantIds(saved.settings, following, saved.providers),\n )\n }} />\n </div>\n </li>\n })}\n </ol>\n {backends.some(usesBundledPricing) ? <p className=\"dsh-ui-hint\">{pricingCheckedText(locale, PROVIDER_PRICING_CHECKED)}</p> : null}\n {on ? <div className=\"dsh-ui-actions\">\n <Button variant=\"outline\" size=\"md\" disabled={busy || reordering} onClick={() => void action(async () => {\n // Testing is explicit, so typed keys are saved first and the request uses them.\n await saveKeys()\n const result = await call<{ sources: number }>('test')\n await load()\n setNote({ sources: result.sources })\n })}>{text.test}</Button>\n </div> : null}\n </article>}\n {(saved.providers.some(provider => provider.kind === 'fetch') || saved.settings.fetchProvider) && (() => {\n const fetchId = saved.settings.fetchProvider\n const fetchSelected = saved.providers.find(provider => provider.kind === 'fetch' && provider.id === fetchId)\n const fetchDormant = Boolean(fetchId) && !fetchSelected\n const fetchActive = Boolean(fetchSelected && saved.fetchActive && fetchSelected.configured)\n const fetchAccess = fetchSelected ? configurationAccess(fetchSelected) : fetchDormant ? { kind: 'unknown' as const } : undefined\n return <article className=\"dsh-ui-card dsh-ui-card--flat\" data-testid=\"web-search-fetch\"\n data-availability={fetchDormant ? 'dormant' : fetchSelected?.configured ? 'available' : 'unavailable'}\n data-in-use={fetchActive || undefined}>\n <header className=\"ws-card-head\">\n <div>\n <h3 className=\"dsh-ui-title\">{text.fetchTitle}</h3>\n <p className=\"ws-provider-note\">\n <StateDot state={fetchDormant ? 'idle' : fetchSelected?.configured ? 'done' : 'warning'} />\n <span>{fetchDormant ? text.dormant : fetchSelected?.configured ? text.available : text.unavailable}</span>\n {fetchActive ? <Tag tone=\"success\">{text.inUse}</Tag> : null}\n </p>\n </div>\n <Switch checked={saved.settings.fetchEnabled} label={text.fetchTitle} disabled={busy || reordering}\n onChange={next => void action(async () => {\n const current = statusRef.current!\n const value = await call<WebStatus>('update', { settings: { ...editable(current.settings), fetchEnabled: next }, expectedRevision: current.settings.revision })\n adopt(value); await load()\n })} />\n </header>\n <label className=\"dsh-ui-field\">\n <span className=\"dsh-ui-label\">{text.fetchProvider}</span>\n <select className=\"dsh-ui-select\" aria-label={text.fetchProvider} value={fetchId} disabled={busy || reordering}\n onChange={event => {\n const id = event.target.value\n void action(async () => {\n const current = statusRef.current!\n const value = await call<WebStatus>('update', { settings: { ...editable(current.settings), fetchProvider: id }, expectedRevision: current.settings.revision })\n adopt(value); await load()\n })\n }}>\n {fetchDormant && <option value={fetchId}>{fetchId} · {text.dormant}</option>}\n {saved.providers.filter(provider => provider.kind === 'fetch').map(provider =>\n <option key={provider.id} value={provider.id}>{providerDisplayLabel(provider, locale)}{provider.configured ? '' : ' · ' + text.unavailable}</option>)}\n </select>\n </label>\n {fetchAccess?.kind === 'link' ? <p className=\"dsh-ui-hint\"><AppLink url={fetchAccess.url} label={text.openConfig}>{text.openConfig}</AppLink></p>\n : fetchAccess?.kind === 'owner' ? <p className=\"dsh-ui-hint\">{text.ownerSettings}{fetchAccess.name}</p>\n : fetchAccess?.kind === 'unknown' ? <p className=\"dsh-ui-hint\">{text.unknownOwner}</p>\n : null}\n </article>\n })()}\n </div>\n <div role=\"tabpanel\" id={tabsId + '-limits-panel'} aria-labelledby={tabsId + '-limits-tab'}\n hidden={tab !== 'limits'} tabIndex={0}>\n <fieldset className=\"web-search-limits\" disabled={busy || reordering} aria-label={text.tabLimits}>\n {LIMITS.map(([key, min, max]) => (\n <label key={key} className=\"ws-limit\">\n <span className=\"dsh-ui-label\">{text[key]}</span>\n <Input className=\"ws-input\" type=\"number\" min={min} max={max} step={1} value={limitDraft[key]}\n aria-invalid={invalid[key] || undefined}\n onChange={event => {\n const raw = event.target.value\n setLimitDraft(current => current ? { ...current, [key]: raw } : current)\n setInvalid(current => ({ ...current, [key]: false }))\n }}\n onBlur={() => setInvalid(current => ({ ...current, [key]: parseLimit(limitDraft[key], min, max) === undefined }))} />\n {invalid[key] ? <span className=\"dsh-ui-error\">{limitInvalidText(locale, text[key], min, max)}</span> : null}\n </label>\n ))}\n </fieldset>\n </div>\n <div className=\"dsh-ui-actions dsh-ui-actions-end\">\n <span className=\"dsh-ui-meta\">{limitsDirty || keysDirty ? text.unsaved : text.saveHint}</span>\n <Button variant=\"primary\" size=\"md\" disabled={busy || reordering} onClick={saveAll}>{text.save}</Button>\n </div>\n </section>\n}\n\n/* The contract owns the type tiers, the card, the field, the button row, the\n * notice, the focus ring and the state colours. What is left is this panel's own\n * geometry: the reading width, the ranked three-column row, the drag affordance,\n * the drop indicator, the screen-reader-only announcer and the limits grid. */\nconst styles = `${officialUiCss('ws-root')}\n.ws-root { max-width: 760px; }\n.ws-card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-bottom: 8px; }\n.ws-sr-only {\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip-path: inset(50%);\n white-space: nowrap;\n border: 0;\n}\n.ws-provider-note { display: flex; align-items: center; gap: 6px; }\n.web-search-provider { display: grid; gap: 8px; min-width: 0; }\n.web-search-provider-info { display: grid; gap: 3px; font-size: 12px; line-height: 18px; color: var(--dsw-alias-label-secondary); overflow-wrap: anywhere; }\n.web-search-provider-heading { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; min-height: 24px; }\n.web-search-settings a { color: var(--dsw-alias-state-business-primary); font-size: 12px; line-height: 18px; text-underline-offset: 3px; }\n/* The primitive renders a 32px control in an inline-flex wrapper; a settings\n * field needs it to fill the column it sits in. */\n.ws-input { width: 100%; }\n.web-search-rank { margin: 0; padding: 0; list-style: none; }\n.web-search-rank li {\n position: relative;\n display: grid;\n grid-template-columns: 24px minmax(0, 1fr) auto;\n gap: 10px;\n align-items: start;\n padding: 14px 0;\n border-top: 0.5px solid var(--dsw-alias-border-l2);\n}\n.web-search-settings button.web-search-drag-handle {\n display: grid;\n place-items: center;\n width: 24px;\n height: 24px;\n min-height: 24px;\n padding: 0;\n cursor: grab;\n opacity: 0.65;\n}\n.web-search-settings button.web-search-drag-handle:hover { opacity: 1; }\n.web-search-settings button.web-search-drag-handle:active { cursor: grabbing; }\n.web-search-settings button.web-search-drag-handle[aria-disabled='true'] { cursor: wait; opacity: 0.4; }\n.web-search-rank li[data-dragging] { opacity: 0.45; }\n.web-search-rank li[data-drop]::after { content: ''; position: absolute; left: 0; right: 0; height: 2px; background: var(--dsw-alias-state-business-primary); pointer-events: none; }\n.web-search-rank li[data-drop='before']::after { top: -1px; }\n.web-search-rank li[data-drop='after']::after { bottom: -1px; }\n.web-search-rank-index { color: var(--dsw-alias-label-tertiary); font-variant-numeric: tabular-nums; line-height: 24px; }\n.web-search-rank-move { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: flex-end; padding-top: 2px; }\n.web-search-limits { margin: 0; border: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 20px; }\n/* A two-column grid, so these fields keep the contract's caption and the\n * primitive's control and only own their vertical rhythm — a stacked list is\n * what draws the hairline between fields, and there is nothing to separate. */\n.ws-limit { display: flex; flex-direction: column; gap: 6px; min-width: 0; }\n.ws-danger:hover:not(:disabled),\n.ws-danger[data-armed] { color: var(--dsw-alias-state-error-primary); border-color: var(--dsw-alias-state-error-primary); }\n.ws-danger:hover:not(:disabled) { background: var(--dsw-alias-interactive-bg-hover-danger); }\n@media (max-width: 560px) { .web-search-rank-move { flex-direction: column; align-items: flex-end; } .web-search-limits { grid-template-columns: minmax(0, 1fr); } }\n`\n\nexport function apply(ctx: Context): void {\n const client = ctx as unknown as Client\n ctx.effect(() => {\n if (typeof document === 'undefined') return () => {}\n const style = document.createElement('style')\n style.setAttribute('data-plugin', '@klarkxy/dsh-web-search-manager'); style.textContent = styles\n style.dataset.dshWebSearch = ''; document.head.appendChild(style)\n return () => style.remove()\n }, 'web-search-manager.styles')\n ctx.effect(() => client.slots.inject('plugins.bundle.config', () => client.slots.register({\n name: 'plugins.bundle.config', key: '@klarkxy/dsh-web-search-manager',\n }, (props?: { hidden?: boolean }) => <NetworkSearchSettings client={client} hidden={props?.hidden} />)), 'web-search-manager.settings')\n}\n"],"mappings":";;;;;;AACA,MAAM,cAAsC;CAC1C,eAAe;CACf,SAAS;CACT,oBAAoB;CACpB,qBAAqB;CACrB,cAAc;CACd,wBAAwB;CACxB,sBAAsB;CACtB,YAAY;CACZ,eAAe;CACf,sBAAsB;CACtB,gBAAgB;CAChB,+BAA+B;CAC/B,sBAAsB;CACtB,2BAA2B;CAC3B,eAAe;CACf,YAAY;CACZ,sBAAsB;CACtB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