@linxin666/dsh-client-ui-plugin-manager 0.4.1 → 0.4.3
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.i18n.yaml +2 -2
- package/README.md +17 -25
- package/README.zh.md +17 -25
- package/lib/client.js +171 -914
- package/lib/client.js.map +1 -1
- package/lib/index.js +423 -49
- package/lib/types/client/PluginUpdatePatch.d.ts +70 -0
- package/lib/types/client/index.d.ts +33 -21
- package/lib/types/client/locales.d.ts +19 -170
- package/lib/types/core/conflict.d.ts +13 -35
- package/lib/types/core/protocol.d.ts +0 -13
- package/lib/types/host/gateway.d.ts +111 -7
- package/lib/types/host/profile.d.ts +60 -5
- package/lib/types/mount-once.d.ts +38 -7
- package/package.json +15 -19
- package/lib/types/client/PluginManagerTab.d.ts +0 -32
- package/lib/types/core/repair.d.ts +0 -58
package/lib/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","names":["css","Button"],"sources":["../../../packages/dsh-plugin-manager/src/core/conflict.ts","../../../packages/dsh-plugin-manager/src/core/repair.ts","../../../packages/dsh-plugin-manager/src/core/version.ts","../../../packages/dsh-plugin-manager/src/client/PluginManagerTab.tsx","../../../packages/dsh-plugin-manager/src/client/locales.ts","../../../packages/dsh-plugin-manager/src/core/protocol.ts","../../../packages/dsh-plugin-manager/src/core/service.ts","../../../packages/dsh-plugin-manager/src/client/telemetry.ts","../../../packages/dsh-plugin-manager/src/client/index.ts"],"sourcesContent":["/**\n * Conflict-ledger diffing. The official host applies structural conflict\n * rules at install time (disableControlsOnInstall: installing the dsh-web\n * family disables the built-in web-ui product rows so the two never\n * double-mount), but no UI surfaces what the rules just did. This module\n * diffs the plugin-control snapshots taken before and after an install and\n * classifies every state change so the tab can render it as a reversible,\n * attributable conflict notice.\n *\n * The install-time authority ends here: duplicate insert-id claims between\n * two user plugins carry no at-install signal through the RPC channels (the\n * Loader only re-reads the composition at the next start), so that failure\n * shape is left to the boot-failure ring — the real start is the authoritative\n * conflict detector.\n * @module @linxin666/dsh-client-ui-plugin-manager/core\n */\n\nimport type { PluginControlItem } from './protocol.ts'\n\n/** One observed product-control state change between two snapshots. */\nexport interface ControlChange {\n id: string\n name: string\n from: PluginControlItem['state']\n to: PluginControlItem['state']\n}\n\n/** Meaningful change kinds a conflict notice distinguishes. */\nexport type ControlChangeKind = 'rule-disabled' | 'rule-enabled' | 'state-change'\n\n/**\n * Diff two plugin-control snapshots by id. Only entries present in both\n * snapshots with a changed state are reported; entries appearing or\n * disappearing are ordinary install/uninstall outcomes, not conflicts.\n * @param before - snapshot taken before the install.\n * @param after - snapshot taken after the install.\n * @returns one change per id whose state moved, in id order.\n */\nexport function diffControls(before: readonly PluginControlItem[], after: readonly PluginControlItem[]): ControlChange[] {\n const afterById = new Map(after.map(item => [item.id, item]))\n const changes: ControlChange[] = []\n for (const item of before) {\n const current = afterById.get(item.id)\n if (current === undefined || current.state === item.state) continue\n changes.push({ id: item.id, name: item.name, from: item.state, to: current.state })\n }\n return changes\n}\n\n/**\n * Classify one control-state change for messaging. A change into `disabled`\n * is the conflict rule's action (reversible by re-enabling); a change out of\n * `disabled` is a manual undo; anything else is reported neutrally.\n * @param change - one diff entry.\n * @returns the message kind.\n */\nexport function classifyChange(change: ControlChange): ControlChangeKind {\n if (change.to === 'disabled') return 'rule-disabled'\n if (change.from === 'disabled') return 'rule-enabled'\n return 'state-change'\n}\n","/**\n * Repair-conversation seed text. The failure surfaces this package still owns\n * hand off to the agent through the same shape: a recorded boot failure (the\n * failure-ring row) and an install-conflict change. The seeded message must be\n * self-contained — the repair session's workspace is the plugin install root,\n * so the agent's file tools reach the plugin code without leaving the\n * workspace boundary.\n *\n * Secret discipline: the seed carries only the spec, the host's truncated\n * failure message/stack, and paths. Callers must never append credentials,\n * tokens, or environment contents; the failure ring is the host's bounded,\n * pruned record and nothing else is added.\n * @module @linxin666/dsh-client-ui-plugin-manager/core\n */\n\nimport type { PluginFailureItem } from './protocol.ts'\nimport type { LayerState } from './patch-diff.ts'\n\n/** Localized fragments the builders assemble. */\nexport interface RepairCopy {\n failureTitle: string\n failurePluginLabel: string\n failureKindLabel: string\n failureAtLabel: string\n failureMessageLabel: string\n failureStackLabel: string\n failurePathLabel: string\n failureAsk: string\n conflictTitle: string\n conflictPluginLabel: string\n conflictChangeLabel: string\n conflictAsk: string\n /** Localized names of the failure kinds. */\n kindNames: Record<PluginFailureItem['kind'], string>\n /** Localized names of the layer states a conflict change traverses. */\n stateNames: Record<LayerState, string>\n}\n\n/** Default copy (zh): the package's zh dictionary keys map onto these strings. */\nexport const DEFAULT_REPAIR_COPY: RepairCopy = {\n failureTitle: '正在修复插件启动失败',\n failurePluginLabel: '插件',\n failureKindLabel: '失败类型',\n failureAtLabel: '时间',\n failureMessageLabel: '错误信息',\n failureStackLabel: '堆栈',\n failurePathLabel: '安装路径',\n failureAsk: '请修复插件后重新启用并重启 dsh web。',\n conflictTitle: '正在处理插件安装冲突',\n conflictPluginLabel: '冲突条目',\n conflictChangeLabel: '状态变化',\n conflictAsk: '请检查冲突双方的入口行 id 与挂载方式,消除重复挂载后告诉我如何重新启用。',\n kindNames: {\n 'load-failure': '加载失败',\n hang: '启动挂起',\n 'late-rejection': '迟到拒绝',\n },\n stateNames: {\n enabled: '已开启',\n disabled: '已关闭',\n uninstalled: '已卸载',\n },\n}\n\n/**\n * Seed text for one boot-failure ring row: the failure record, so the agent\n * can attribute and fix it in place.\n * @param failure - the recorded failure row.\n * @param copy - localized fragments.\n * @returns the repair prompt text.\n */\nexport function failureRepairMessage(failure: PluginFailureItem, copy: RepairCopy = DEFAULT_REPAIR_COPY): string {\n const parts = [\n copy.failureTitle,\n `${copy.failurePluginLabel}: ${failure.pluginId || '-'}`,\n `${copy.failureKindLabel}: ${copy.kindNames[failure.kind] ?? failure.kind}`,\n `${copy.failureAtLabel}: ${failure.at}`,\n `${copy.failureMessageLabel}:\\n${failure.message}`,\n ]\n if (failure.stack !== '') parts.push(`${copy.failureStackLabel}:\\n${failure.stack}`)\n if (failure.installPath !== '') parts.push(`${copy.failurePathLabel}: ${failure.installPath}`)\n parts.push(copy.failureAsk)\n return parts.join('\\n\\n')\n}\n\n/**\n * Seed text for one install-conflict notice: the entry and its state change,\n * so the agent can attribute the conflict and resolve the double mount.\n * @param change - the conflict change (id, display name, from/to states).\n * @param copy - localized fragments.\n * @returns the repair prompt text.\n */\nexport function conflictRepairMessage(\n change: { id: string; name: string; from: LayerState; to: LayerState },\n copy: RepairCopy = DEFAULT_REPAIR_COPY,\n): string {\n return [\n copy.conflictTitle,\n `${copy.conflictPluginLabel}: ${change.name} (${change.id})`,\n `${copy.conflictChangeLabel}: ${copy.stateNames[change.from] ?? change.from} -> ${copy.stateNames[change.to] ?? change.to}`,\n copy.conflictAsk,\n ].join('\\n\\n')\n}\n","/**\n * DSH host version parsing and comparison for the update compatibility\n * check. The declared minimum lives in the published package manifest under\n * `dsh.engines.dsh`, falling back to the top-level `engines.dsh`; the only\n * supported form is `>=X.Y.Z[-prerelease]`.\n *\n * Comparison deliberately uses plain semver ordering instead of\n * `semver.satisfies`: npm's prerelease rule only allows a prerelease version\n * to satisfy a comparator set carrying a prerelease on the same\n * major.minor.patch tuple, which would reject a newer host line (0.1.1-rc.2)\n * against a declared `>=0.1.0-rc.8` — exactly the cross-cohort upgrade path\n * this check must allow. Everything here is pure and tolerant of untrusted\n * input: a malformed value means \"cannot verify\", which the callers treat as\n * a fail-closed verdict when a requirement was declared (issue #754).\n * @module @linxin666/dsh-client-ui-plugin-manager/core\n */\n\n/** One parsed DSH host or package version. */\nexport interface DshVersion {\n major: number\n minor: number\n patch: number\n /** Prerelease identifiers, numeric identifiers kept as numbers (semver order). */\n prerelease: readonly (number | string)[]\n}\n\nconst VERSION_PATTERN = /^v?(\\d+)\\.(\\d+)\\.(\\d+)(?:-([0-9A-Za-z.-]+))?$/\n\n/**\n * Parse a DSH host or package version string.\n * @param value - e.g. `0.1.0-rc.8`, `v1.2.3`.\n * @returns the parsed version, or undefined when malformed.\n */\nexport function parseDshVersion(value: string): DshVersion | undefined {\n const match = VERSION_PATTERN.exec(value.trim())\n if (match === null) return undefined\n const prereleaseParts = match[4] === undefined ? [] : match[4].split('.')\n if (prereleaseParts.some(part => part === '')) return undefined\n return {\n major: Number(match[1]),\n minor: Number(match[2]),\n patch: Number(match[3]),\n prerelease: prereleaseParts.map(part => /^\\d+$/.test(part) ? Number(part) : part),\n }\n}\n\n/**\n * Compare two version strings by semver order (a release is newer than any\n * prerelease of the same tuple).\n * @returns -1 / 0 / 1, or undefined when either side is malformed.\n */\nexport function compareVersions(left: string, right: string): number | undefined {\n const a = parseDshVersion(left)\n const b = parseDshVersion(right)\n if (a === undefined || b === undefined) return undefined\n for (const key of ['major', 'minor', 'patch'] as const) {\n if (a[key] !== b[key]) return a[key] < b[key] ? -1 : 1\n }\n return comparePrerelease(a.prerelease, b.prerelease)\n}\n\n/**\n * Semver prerelease ordering: numeric identifiers compare numerically,\n * numeric identifiers rank below alphanumeric ones, alphanumeric identifiers\n * compare lexically, and a longer list wins when the shared prefix is equal.\n */\nfunction comparePrerelease(left: readonly (number | string)[], right: readonly (number | string)[]): number {\n if (left.length === 0 && right.length === 0) return 0\n if (left.length === 0) return 1\n if (right.length === 0) return -1\n const length = Math.max(left.length, right.length)\n for (let index = 0; index < length; index += 1) {\n const a = left[index]\n const b = right[index]\n if (a === undefined) return -1\n if (b === undefined) return 1\n if (typeof a === 'number' && typeof b === 'number') {\n if (a !== b) return a < b ? -1 : 1\n } else if (typeof a === 'number') {\n return -1\n } else if (typeof b === 'number') {\n return 1\n } else if (a !== b) {\n return a < b ? -1 : 1\n }\n }\n return 0\n}\n\nconst MINIMUM_RANGE_PATTERN = /^>=\\s*(v?\\d+\\.\\d+\\.\\d+(?:-[0-9A-Za-z.-]+)?)$/\n\n/**\n * Whether a host version satisfies a declared `>=X.Y.Z[-prerelease]` minimum.\n * @param host - the running DSH host version.\n * @param minimum - the declared minimum; any form other than `>=<semver>`\n * (plain semver, `^`, `~`, multi-comparator ranges, empty) returns undefined.\n * @returns true / false, or undefined when the host version is malformed or\n * the minimum uses an unsupported form — callers treat undefined as\n * \"cannot verify\" and fail closed for declared requirements.\n */\nexport function meetsMinimumDsh(host: string, minimum: string): boolean | undefined {\n const match = MINIMUM_RANGE_PATTERN.exec(minimum.trim())\n if (match === null) return undefined\n const compared = compareVersions(host, match[1])\n if (compared === undefined) return undefined\n return compared >= 0\n}\n\n/**\n * The bare minimum version for display: strips the `>=` operator (and an\n * optional leading `v`) from a declared requirement so UI copy that already\n * contains the comparison operator renders `0.1.1-rc.1` instead of\n * `>= >=0.1.1-rc.1`. Unsupported range forms render unchanged.\n * @param minimum - the declared minimum range.\n * @returns the version portion for display.\n */\nexport function displayMinimumVersion(minimum: string): string {\n const match = MINIMUM_RANGE_PATTERN.exec(minimum.trim())\n return match === null ? minimum.trim() : match[1].replace(/^v/, '')\n}\n\n/**\n * Read the declared DSH minimum from a published registry manifest:\n * `dsh.engines.dsh` first, top-level `engines.dsh` as the fallback.\n * Defensive against malformed or untrusted metadata: anything that is not a\n * non-empty string reads as absent.\n * @param manifest - the decoded registry version manifest.\n * @returns the declared minimum, or undefined when not declared.\n */\nexport function dshRequirementOf(manifest: { dsh?: unknown; engines?: unknown }): string | undefined {\n const dshEngines = (manifest.dsh as { engines?: unknown } | undefined)?.engines as { dsh?: unknown } | undefined\n const engines = (manifest.engines as { dsh?: unknown } | undefined)?.dsh\n const value = dshEngines?.dsh ?? engines\n return typeof value === 'string' && value.trim() !== '' ? value.trim() : undefined\n}\n","/**\n * The plugin-manager tab keeps only what the official plugin manager page does\n * not do. Installing, uninstalling and enabling or disabling a bundle or a row\n * — with live switching and a build-script approval dialog — belong to the\n * official page since 0.1.6-alpha.2, so this tab renders a read-only inventory\n * and points there. Its own surface is the differentiating half: registry\n * update checks with DSH-runtime compatibility gating, the install-conflict\n * ledger the host records around an install or update (with undo and a repair\n * handoff), the boot-failure ring with its repair conversation, and the\n * safe-mode banner. Changes that need a restart say so.\n *\n * This tab registers into the official Plugins settings section\n * (`settings.plugins.tab` slot) next to the official inventory tab.\n */\nimport { useEffect, useRef, useState } from 'react'\nimport { Button } from '@deepseek-ai/dsh-client-ui-primitives'\nimport type { InjectFace, PropsLocale, PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots'\nimport { classifyChange, diffControls, type ControlChange } from '../core/conflict.ts'\nimport type {\n InstallProgressItem,\n InstalledPluginItem,\n PluginControlItem,\n PluginFailureItem,\n PluginFailuresSnapshot,\n PluginUpdateItem,\n} from '../core/protocol.ts'\nimport { conflictRepairMessage, failureRepairMessage, type RepairCopy } from '../core/repair.ts'\nimport { displayMinimumVersion } from '../core/version.ts'\nimport css from './plugin-manager.module.css'\n\n/** Registration-side wire face used by the tab. */\nexport interface PluginManagerTabInjected {\n /** Whether this browser has loopback authority to use the host routes. */\n isLoopback: boolean\n /** Read the installed snapshot (the tab renders it read-only). */\n list: () => Promise<InstalledPluginItem[]>\n /** Re-install one plugin from its recorded source. */\n update: (id: string) => Promise<InstalledPluginItem>\n /** Compare installed versions against their sources. */\n checkUpdates: () => Promise<PluginUpdateItem[]>\n /** Read the current install/update progress. */\n status: () => Promise<InstallProgressItem>\n /** Read the recorded boot failures, plugin root, and safe-mode state. */\n failures: () => Promise<PluginFailuresSnapshot>\n /** Persist the safe-mode marker (web: applied at the next manual restart). */\n setSafeMode: (enabled: boolean) => Promise<void>\n /** Start a repair conversation over the plugin install root. */\n repairPlugin: (pluginRoot: string, message: string) => Promise<void>\n /** Read the deployment-configured built-in product switches. */\n controlsList: () => Promise<PluginControlItem[]>\n /** Persist one product's next-start enablement. */\n controlsSetEnabled: (pluginId: string, enabled: boolean) => Promise<PluginControlItem[]>\n /** Conflicts the gateway host computed around the last install (gateway mode only). */\n lastInstallConflicts?: () => readonly ControlChange[]\n}\n\n/** Full component props assembled by the Settings slot renderer. */\nexport type PluginManagerTabProps =\n PropsRuntime<'settings.plugins.tab'>\n & PropsLocale<'settings.pluginManager'>\n & InjectFace<PluginManagerTabInjected>\n\ntype ViewState =\n | { readonly status: 'loading' }\n | { readonly status: 'error' }\n | {\n readonly status: 'ready'\n readonly plugins: readonly InstalledPluginItem[]\n readonly controls: readonly PluginControlItem[]\n readonly failures: PluginFailuresSnapshot\n }\n\n/** One row operation in flight. */\ntype BusyAction = { readonly kind: 'update' | 'check'; readonly id?: string }\n\n/** One switch write in flight (only the conflict ledger's undo writes one). */\ntype ToggleBusy = { readonly kind: 'product'; readonly id: string }\n\n/** Error text for a caught request or lifecycle failure. */\nfunction messageOf(error: unknown): string {\n if (error instanceof AggregateError) {\n const details = error.errors.map(messageOf).join('; ')\n return details === '' ? error.message : `${error.message}: ${details}`\n }\n return error instanceof Error ? error.message : String(error)\n}\n\n/** Localized fragments for the repair seed builders, read from the tab's dictionaries. */\nfunction repairCopy(t: PluginManagerTabProps['t']): RepairCopy {\n return {\n failureTitle: t('repairFailureTitle'),\n failurePluginLabel: t('repairFailurePluginLabel'),\n failureKindLabel: t('repairFailureKindLabel'),\n failureAtLabel: t('repairFailureAtLabel'),\n failureMessageLabel: t('repairFailureMessageLabel'),\n failureStackLabel: t('repairFailureStackLabel'),\n failurePathLabel: t('repairFailurePathLabel'),\n failureAsk: t('repairFailureAsk'),\n kindNames: {\n 'load-failure': t('repairKindLoad'),\n hang: t('repairKindHang'),\n 'late-rejection': t('repairKindLate'),\n },\n conflictTitle: t('repairConflictTitle'),\n conflictPluginLabel: t('repairConflictPluginLabel'),\n conflictChangeLabel: t('repairConflictChangeLabel'),\n conflictAsk: t('repairConflictAsk'),\n stateNames: {\n enabled: t('repairStateEnabled'),\n disabled: t('repairStateDisabled'),\n uninstalled: t('repairStateUninstalled'),\n },\n }\n}\n\n/** Localized label for one install phase, with percent when the download has one. */\nfunction progressLabel(progress: InstallProgressItem, t: PluginManagerTabProps['t']): string {\n if (progress.stage === 'fetch') return t('fetching')\n if (progress.stage === 'extract') return t('extracting')\n if (progress.stage === 'write') return t('writing')\n return progress.percent === undefined ? t('downloading') : t('downloadingPercent', { percent: String(progress.percent) })\n}\n\n/** The plugin-manager settings tab. */\nexport function PluginManagerTab(props: PluginManagerTabProps) {\n const {\n t,\n isLoopback,\n list,\n update,\n checkUpdates,\n status,\n failures,\n setSafeMode,\n repairPlugin,\n controlsList,\n controlsSetEnabled,\n lastInstallConflicts,\n } = props\n\n const [view, setView] = useState<ViewState>({ status: 'loading' })\n const [busy, setBusy] = useState<BusyAction | undefined>(undefined)\n const [toggleBusy, setToggleBusy] = useState<ToggleBusy | undefined>(undefined)\n const [error, setError] = useState<string | undefined>(undefined)\n const [dirty, setDirty] = useState(false)\n const [repairing, setRepairing] = useState<string | undefined>(undefined)\n const [copied, setCopied] = useState<string | undefined>(undefined)\n const [updates, setUpdates] = useState<ReadonlyMap<string, PluginUpdateItem>>(new Map())\n const [conflicts, setConflicts] = useState<readonly ControlChange[]>([])\n const [progress, setProgress] = useState<InstallProgressItem>({ kind: 'idle', stage: 'fetch' })\n /** Parent rows whose aggregate child list is expanded; collapsed by default. */\n const [expandedChildren, setExpandedChildren] = useState<ReadonlySet<string>>(() => new Set())\n /** Synchronous in-flight mirror of `busy`: the render-time guard alone lets a\n * click and an Enter land in the same frame and double-fire. */\n const busyRef = useRef(false)\n\n /**\n * Reload every snapshot into the ready view. The conflict ledger is the\n * host's record of the last install or update that ran through this\n * package's gateway channel — including a Workshop install driven through\n * the shared service — so it is read here rather than diffed around an\n * install this tab no longer performs.\n */\n const reload = async (): Promise<void> => {\n const [plugins, controls, failureSnapshot] = await Promise.all([list(), controlsList(), failures()])\n if (lastInstallConflicts !== undefined) setConflicts(lastInstallConflicts())\n setView({ status: 'ready', plugins, controls, failures: failureSnapshot })\n }\n\n useEffect(() => {\n let cancelled = false\n void reload().catch(() => {\n if (!cancelled) setView({ status: 'error' })\n })\n return () => { cancelled = true }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [])\n\n /** One row/form operation: busy state, error row, dirty flag on success. */\n const run = async (action: BusyAction, body: () => Promise<void>): Promise<void> => {\n if (busyRef.current) return\n busyRef.current = true\n setBusy(action)\n setError(undefined)\n try {\n await body()\n setDirty(true)\n } catch (reason) {\n setError(t('failed', { reason: messageOf(reason) }))\n } finally {\n busyRef.current = false\n setBusy(undefined)\n }\n }\n\n /** Poll update progress while such an operation is in flight. */\n useEffect(() => {\n if (busy === undefined || busy.kind !== 'update') {\n setProgress({ kind: 'idle', stage: 'fetch' })\n return\n }\n let stopped = false\n let timer: ReturnType<typeof setTimeout> | undefined\n const tick = (delay: number): void => {\n timer = setTimeout(() => {\n void status().then(next => {\n if (!stopped && next !== undefined) {\n setProgress(next)\n tick(400)\n }\n }).catch(() => { /* status polling fails silently; the operation itself owns the error row */ })\n }, delay)\n }\n tick(100)\n return () => {\n stopped = true\n if (timer !== undefined) clearTimeout(timer)\n }\n }, [busy, status])\n\n const toggleDisabled = busy !== undefined || toggleBusy !== undefined\n || (view.status === 'ready' && view.failures.safeMode)\n\n /** Expand or collapse one aggregate row's child list (pure view state). */\n const toggleChildren = (id: string): void => {\n setExpandedChildren(current => {\n const next = new Set(current)\n if (next.has(id)) next.delete(id)\n else next.add(id)\n return next\n })\n }\n\n const onProductToggle = (id: string, enabled: boolean): void => {\n setToggleBusy({ kind: 'product', id })\n setError(undefined)\n void controlsSetEnabled(id, enabled).then(controls => {\n setView(current => current.status === 'ready' ? { ...current, controls } : current)\n setConflicts(previous => previous.filter(change => change.id !== id))\n setDirty(true)\n setToggleBusy(undefined)\n }).catch(reason => {\n setError(t('failed', { reason: messageOf(reason) }))\n setToggleBusy(undefined)\n })\n }\n\n const onCheck = (): void => {\n void run({ kind: 'check' }, async () => {\n const found = await checkUpdates()\n setUpdates(new Map(found.map(item => [item.id, item])))\n })\n }\n\n const onUpdate = (id: string): void => {\n void run({ kind: 'update', id }, async () => {\n // The gateway host records the conflicts its own CLI run produced; the\n // official channel records none, so that mode diffs the product snapshot\n // around this update instead — the only install-shaped action this tab\n // still performs.\n const before = view.status === 'ready' ? view.controls : await controlsList().catch(() => [] as readonly PluginControlItem[])\n await update(id)\n setUpdates(previous => {\n const next = new Map(previous)\n next.delete(id)\n return next\n })\n await reload()\n if ((lastInstallConflicts?.() ?? []).length > 0) return\n const after = await controlsList().catch(() => [] as readonly PluginControlItem[])\n setConflicts(diffControls(before, after))\n })\n }\n\n /** Open a repair conversation seeded with one boot-failure record. `token`\n * identifies the row for the in-flight label (plugin id, or a row key for\n * unattributable failures). */\n const onRepair = (failure: PluginFailureItem, token: string): void => {\n if (view.status !== 'ready' || busy !== undefined || repairing !== undefined) return\n setError(undefined)\n setRepairing(token)\n void repairPlugin(view.failures.pluginRoot, failureRepairMessage(failure, repairCopy(t))).then(() => {\n setRepairing(undefined)\n }).catch(reason => {\n setError(t('failed', { reason: messageOf(reason) }))\n setRepairing(undefined)\n })\n }\n\n /** Copy a boot failure's message and stack for a manual repair conversation. */\n const onCopy = (failure: PluginFailureItem, token: string): void => {\n void navigator.clipboard.writeText(`${failure.message}\\n\\n${failure.stack}`).then(() => {\n setCopied(token)\n }).catch(() => {\n setError(t('failed', { reason: 'clipboard unavailable' }))\n })\n }\n\n const onExitSafeMode = (): void => {\n if (busy !== undefined) return\n setError(undefined)\n void setSafeMode(false).then(() => {\n setDirty(true)\n void reload().catch(reason => {\n setError(t('failed', { reason: messageOf(reason) }))\n })\n }).catch(reason => {\n setError(t('failed', { reason: messageOf(reason) }))\n })\n }\n\n /** Undo one conflict action by flipping the product switch back. */\n const onUndoConflict = (change: ControlChange): void => {\n if (change.to !== 'disabled') return\n onProductToggle(change.id, true)\n }\n\n /** Hand one conflict notice off to a repair conversation over the plugin root. */\n const onRepairConflict = (change: ControlChange): void => {\n if (view.status !== 'ready' || busy !== undefined || repairing !== undefined) return\n setError(undefined)\n const token = `conflict:${change.id}`\n setRepairing(token)\n void repairPlugin(view.failures.pluginRoot, conflictRepairMessage({\n id: change.id,\n name: change.name,\n from: change.from === 'enabled' || change.from === 'disabled' ? change.from : 'uninstalled',\n to: change.to === 'enabled' || change.to === 'disabled' ? change.to : 'uninstalled',\n }, repairCopy(t))).then(() => {\n setRepairing(undefined)\n }).catch(reason => {\n setError(t('failed', { reason: messageOf(reason) }))\n setRepairing(undefined)\n })\n }\n\n if (!isLoopback) {\n return (\n <div className={css.notice}>\n <strong>{t('localOnlyTitle')}</strong>\n <p>{t('localOnlyBody')}</p>\n </div>\n )\n }\n if (view.status === 'loading') return <div className={css.state}>{t('loading')}</div>\n if (view.status === 'error') return <div className={css.state}>{t('failed', { reason: 'load' })}</div>\n\n const attributable = new Map(view.failures.items.filter(item => item.pluginId !== '').map(item => [item.pluginId, item]))\n const unattributable = view.failures.items.filter(item => item.pluginId === '')\n\n return (\n <div className={css.section} aria-busy={busy !== undefined || toggleBusy !== undefined}>\n {view.failures.safeMode && (\n <div className={css.safeModeBanner} data-safe-mode>\n <p>{t('safeModeBanner')}</p>\n <Button variant=\"primary\" disabled={busy !== undefined} onClick={onExitSafeMode}>\n {t('exitSafeMode')}\n </Button>\n </div>\n )}\n\n <p className={css.hint} data-manage-elsewhere>{t('manageElsewhere')}</p>\n\n {busy?.kind === 'update' && (\n <div className={css.progressRow} role=\"status\">\n <div className={css.progressTrack}>\n <div\n className={css.progressBar}\n style={progress.percent === undefined ? undefined : { width: `${progress.percent}%` }}\n data-indeterminate={progress.percent === undefined ? 'true' : undefined}\n />\n </div>\n <p className={css.progressLabel}>{progressLabel(progress, t)}</p>\n </div>\n )}\n\n {error !== undefined && (\n <div className={css.errorRow}>\n <span className={css.error}>{error}</span>\n </div>\n )}\n\n {conflicts.length > 0 && (\n <div className={css.conflicts}>\n <h3 className={css.sectionTitle}>{t('conflictTitle')}</h3>\n <ul className={css.list}>\n {conflicts.map(change => (\n <li key={change.id} className={css.row} data-conflict={change.id}>\n <div className={css.meta}>\n <span className={css.name}>{change.name}</span>\n <span className={css.sub}>\n {classifyChange(change) === 'rule-disabled'\n ? t('conflictDisabled', { name: change.name })\n : classifyChange(change) === 'rule-enabled'\n ? t('conflictEnabled', { name: change.name })\n : t('conflictChanged', { name: change.name })}\n </span>\n </div>\n <div className={css.actions}>\n {change.to === 'disabled' && (\n <Button\n variant=\"outline\"\n disabled={toggleDisabled}\n onClick={() => { onUndoConflict(change) }}\n >\n {t('undoConflict')}\n </Button>\n )}\n <Button\n variant=\"outline\"\n disabled={busy !== undefined || repairing !== undefined}\n onClick={() => { onRepairConflict(change) }}\n >\n {repairing === `conflict:${change.id}` ? t('repairing') : t('repair')}\n </Button>\n </div>\n </li>\n ))}\n </ul>\n <p className={css.hint}>{t('conflictHint')}</p>\n </div>\n )}\n\n <div className={css.group}>\n <h3 className={css.sectionTitle}>{t('userPlugins')}</h3>\n {view.plugins.length === 0\n ? <p className={css.empty}>{t('empty')}</p>\n : (\n <ul className={css.list}>\n {view.plugins.map(plugin => {\n const updateItem = updates.get(plugin.id)\n const latest = updateItem?.latest\n const dshRequirement = updateItem?.requiresDsh\n const failure = attributable.get(plugin.id)\n const children = plugin.children\n const mixed = children !== undefined && !plugin.enabled && children.some(child => child.enabled)\n return (\n <li key={plugin.id} data-plugin-id={plugin.id}>\n <div className={css.row}>\n <div className={css.meta}>\n <span className={css.name}>{plugin.name}</span>\n <span className={css.sub}>\n <span className={css.version}>{t('version', { version: plugin.version })}</span>\n <span className={css.sourceBadge} data-source={plugin.source.kind}>\n {plugin.source.kind === 'npm' ? t('npmSource') : t('gitSource')}\n </span>\n <span className={css.specText} title={plugin.source.spec}>{plugin.source.spec}</span>\n </span>\n {latest !== undefined && <span className={css.latest}>{t('latest', { version: latest })}</span>}\n {updateItem !== undefined && dshRequirement !== undefined && (\n <span className={updateItem.compatible === false ? css.compatBlocked : css.compatHint}>\n {updateItem.compatible === false\n ? t('updateBlockedDsh', { min: displayMinimumVersion(dshRequirement) })\n : t('updateRequiresDsh', { min: displayMinimumVersion(dshRequirement) })}\n </span>\n )}\n {failure !== undefined && (\n <div className={css.failure} data-plugin-failure={plugin.id}>\n <span className={css.badge}>{t('failureBadge')}</span>\n <span className={css.failureMessage} title={failure.message}>{failure.message}</span>\n <div className={css.failureActions}>\n <Button\n variant=\"primary\"\n disabled={busy !== undefined || repairing !== undefined}\n onClick={() => { onRepair(failure, plugin.id) }}\n >\n {repairing === plugin.id ? t('repairing') : t('repair')}\n </Button>\n <Button variant=\"outline\" disabled={busy !== undefined} onClick={() => { onCopy(failure, plugin.id) }}>\n {copied === plugin.id ? t('copied') : t('copyError')}\n </Button>\n </div>\n </div>\n )}\n </div>\n <div className={css.actions}>\n <span className={css.stateLabel} data-state={plugin.enabled ? 'enabled' : mixed ? 'mixed' : 'disabled'}>\n {plugin.enabled ? t('enabled') : mixed ? t('mixed') : t('disabled')}\n </span>\n {latest !== undefined && (\n <Button\n variant=\"outline\"\n disabled={busy !== undefined || updateItem?.compatible === false}\n onClick={() => { onUpdate(plugin.id) }}\n >\n {busy?.kind === 'update' && busy.id === plugin.id ? t('updating') : t('update')}\n </Button>\n )}\n </div>\n </div>\n {children !== undefined && children.length > 0 && (() => {\n // Default-collapsed child list: an aggregate such as\n // @linxin666/dsh-web-all expands to 20+ rows that would\n // otherwise push the whole settings page down.\n const listId = 'pm-children-' + plugin.id.replace(/[^a-zA-Z0-9_-]/g, '-')\n const expanded = expandedChildren.has(plugin.id)\n const enabledCount = children.filter(child => child.enabled).length\n return (\n <>\n <button\n type=\"button\"\n className={css.childrenToggle}\n aria-expanded={expanded}\n aria-controls={listId}\n aria-label={expanded\n ? t('childrenHide', { name: plugin.name })\n : t('childrenShow', { name: plugin.name })}\n onClick={() => { toggleChildren(plugin.id) }}\n >\n <span className={css.chevron} data-expanded={expanded} aria-hidden=\"true\" />\n <span className={css.childrenSummary}>\n {t('childrenSummary', { enabled: enabledCount, total: children.length })}\n </span>\n </button>\n {expanded && (\n <>\n <ul id={listId} className={css.childList}>\n {children.map(child => (\n <li key={child.id} className={css.childRow} data-plugin-row={child.id}>\n <span className={css.childName} title={child.id}>{child.name}</span>\n <div className={css.actions}>\n <span className={css.stateLabel} data-state={child.enabled ? 'enabled' : 'disabled'}>\n {child.enabled ? t('enabled') : t('disabled')}\n </span>\n {child.locked === true\n ? <span className={css.lockedHint}>{t('lockedRowHint')}</span>\n : null}\n </div>\n </li>\n ))}\n </ul>\n <p className={css.hint}>{t('childrenHint')}</p>\n </>\n )}\n </>\n )\n })()}\n </li>\n )\n })}\n </ul>\n )}\n </div>\n\n {view.controls.length > 0 && (\n <div className={css.group}>\n <h3 className={css.sectionTitle}>{t('products')}</h3>\n <ul className={css.list}>\n {view.controls.map(control => (\n <li key={control.id} className={css.row} data-product-id={control.id}>\n <div className={css.meta}>\n <span className={css.name}>{control.name}</span>\n <span className={css.sub}>\n <a className={css.link} href={control.repository} target=\"_blank\" rel=\"noreferrer\">{t('source')}</a>\n </span>\n </div>\n <div className={css.actions}>\n <span className={css.stateLabel} data-state={control.state}>\n {t(control.state)}\n </span>\n </div>\n </li>\n ))}\n </ul>\n </div>\n )}\n\n {unattributable.length > 0 && (\n <div className={css.group}>\n <h3 className={css.sectionTitle}>{t('failureGroupTitle')}</h3>\n <ul className={css.list}>\n {unattributable.map((failure, index) => {\n const token = `other:${index}`\n return (\n <li key={`${failure.at}-${index}`} className={css.row} data-plugin-failure=\"other\">\n <div className={css.meta}>\n <span className={css.badge}>{t('failureBadge')}</span>\n <span className={css.failureMessage} title={failure.message}>{failure.message}</span>\n <div className={css.failureActions}>\n <Button\n variant=\"primary\"\n disabled={busy !== undefined || repairing !== undefined}\n onClick={() => { onRepair(failure, token) }}\n >\n {repairing === token ? t('repairing') : t('repair')}\n </Button>\n <Button variant=\"outline\" disabled={busy !== undefined} onClick={() => { onCopy(failure, token) }}>\n {copied === token ? t('copied') : t('copyError')}\n </Button>\n </div>\n </div>\n </li>\n )\n })}\n </ul>\n </div>\n )}\n\n <div className={css.actionsRow}>\n <Button variant=\"outline\" disabled={busy !== undefined} onClick={onCheck}>\n {busy?.kind === 'check' ? t('checking') : t('checkUpdates')}\n </Button>\n {updates.size === 0 && busy === undefined && view.plugins.length > 0 && (\n <p className={css.ok}>{t('noUpdates')}</p>\n )}\n </div>\n\n {toggleBusy !== undefined && <p className={css.applying} aria-live=\"polite\">{t('applying')}</p>}\n\n {dirty && (\n <div className={css.restartRow}>\n <p>{t('restartHint')}</p>\n </div>\n )}\n\n </div>\n )\n}\n","/**\n * Locale dictionaries for the plugin-manager tab. The zh dictionary is the\n * key source; the en dictionary mirrors the exact key set.\n * @module @linxin666/dsh-client-ui-plugin-manager/client\n */\n\n/** Simplified Chinese copy (the key-set source of truth). */\nconst STATIC_ZH = {\n tab: '插件管理',\n manageElsewhere: '安装、卸载与启停已由官方插件管理页负责(侧边栏「插件」);这里保留更新检查、安装冲突与启动失败修复。',\n loading: '正在读取插件…',\n empty: '尚未安装任何用户插件。',\n userPlugins: '用户插件',\n products: '内置产品',\n conflictTitle: '安装冲突',\n conflictDisabled: '已自动禁用 {name},避免重复挂载。',\n conflictEnabled: '已重新启用 {name}。',\n conflictChanged: '{name} 的状态已变更。',\n undoConflict: '撤销',\n conflictHint: '冲突动作在安装时自动执行,撤销会写回开关并在重启后生效。',\n version: '已安装 {version}',\n latest: '最新 {version}',\n update: '更新',\n updating: '更新中…',\n checkUpdates: '检查更新',\n checking: '检查中…',\n noUpdates: '所有插件都是最新版本。',\n updateRequiresDsh: '需要 DSH ≥ {min}',\n updateBlockedDsh: '需要 DSH ≥ {min},请先升级 DSH 再更新',\n restartHint: '插件变更将在重启应用后生效。',\n failed: '操作失败:{reason}',\n enabled: '已开启',\n disabled: '已关闭',\n mixed: '部分开启',\n unavailable: '不可用',\n uninstalled: '已卸载',\n source: '查看源码',\n applying: '正在应用更改…',\n fetching: '正在获取插件信息…',\n downloading: '正在下载…',\n downloadingPercent: '正在下载 {percent}%',\n extracting: '正在解压…',\n writing: '正在写入配置…',\n localOnlyTitle: '仅限本机操作',\n localOnlyBody: '为了保护主机配置,插件管理只能从本机打开。',\n failureBadge: '启动失败',\n failureGroupTitle: '其他启动失败',\n repair: '让 Agent 修复',\n repairing: '正在创建修复对话…',\n copyError: '复制错误',\n copied: '已复制',\n safeModeBanner: '安全模式:用户插件配置已跳过,插件开关不可用。',\n exitSafeMode: '恢复正常模式并重启',\n npmSource: 'npm',\n gitSource: 'git',\n lockedRowHint: '核心行',\n childrenHint: '子插件的启停在官方插件管理页操作;停用后不再加载,代码仍随全家桶更新。',\n childrenSummary: '子插件 {enabled}/{total} 已启用',\n childrenShow: '展开 {name} 的子插件',\n childrenHide: '收起 {name} 的子插件',\n repairFailureTitle: '插件上次启动失败。请修复它。',\n repairFailurePluginLabel: '插件',\n repairFailureKindLabel: '失败类型',\n repairFailureAtLabel: '时间',\n repairFailureMessageLabel: '失败详情',\n repairFailureStackLabel: '原始堆栈',\n repairFailurePathLabel: '插件安装目录',\n repairFailureAsk: '请检查并修复该插件;修复完成后告诉我如何重新启用。',\n repairKindLoad: '加载失败',\n repairKindHang: '启动挂起',\n repairKindLate: '迟到拒绝',\n repairConflictTitle: '正在处理插件安装冲突',\n repairConflictPluginLabel: '冲突条目',\n repairConflictChangeLabel: '状态变化',\n repairConflictAsk: '请检查冲突双方的入口行 id 与挂载方式,消除重复挂载后告诉我如何重新启用。',\n repairStateEnabled: '已开启',\n repairStateDisabled: '已关闭',\n repairStateUninstalled: '已卸载',\n} satisfies Record<string, string>\n\n/** English copy, checked complete against the zh key set. */\nconst STATIC_EN = {\n tab: 'Plugin manager',\n manageElsewhere: 'Installing, uninstalling and enabling plugins now live on the official plugin manager page (the Plugins entry in the sidebar); this tab keeps update checks, install conflicts and startup-failure repair.',\n loading: 'Reading plugins…',\n empty: 'No user plugins installed yet.',\n userPlugins: 'User plugins',\n products: 'Built-in products',\n conflictTitle: 'Install conflicts',\n conflictDisabled: 'Automatically disabled {name} to avoid double mounting.',\n conflictEnabled: 'Re-enabled {name}.',\n conflictChanged: 'The state of {name} changed.',\n undoConflict: 'Undo',\n conflictHint: 'Conflict actions run automatically at install time; undoing writes the switch back and applies after a restart.',\n version: 'Installed {version}',\n latest: 'Latest {version}',\n update: 'Update',\n updating: 'Updating…',\n checkUpdates: 'Check for updates',\n checking: 'Checking…',\n noUpdates: 'All plugins are up to date.',\n updateRequiresDsh: 'Requires DSH >= {min}',\n updateBlockedDsh: 'Requires DSH >= {min}; upgrade DSH before updating',\n restartHint: 'Plugin changes take effect after restarting the application.',\n failed: 'Operation failed: {reason}',\n enabled: 'On',\n disabled: 'Off',\n mixed: 'Partially on',\n unavailable: 'Unavailable',\n uninstalled: 'Uninstalled',\n source: 'View source',\n applying: 'Applying change…',\n fetching: 'Fetching plugin metadata…',\n downloading: 'Downloading…',\n downloadingPercent: 'Downloading {percent}%',\n extracting: 'Extracting…',\n writing: 'Writing configuration…',\n localOnlyTitle: 'Available on this computer only',\n localOnlyBody: 'To protect host configuration, plugin management is only available from a local browser.',\n failureBadge: 'Startup failure',\n failureGroupTitle: 'Other startup failures',\n repair: 'Ask the agent to fix',\n repairing: 'Opening repair conversation…',\n copyError: 'Copy error',\n copied: 'Copied',\n safeModeBanner: 'Safe mode: user plugin configuration is skipped; plugin switches are disabled.',\n exitSafeMode: 'Restore normal mode and restart',\n npmSource: 'npm',\n gitSource: 'git',\n lockedRowHint: 'Core row',\n childrenHint: 'Bundle child plugins are switched on the official plugin manager page; a disabled child is never loaded, while its code still updates with the bundle.',\n childrenSummary: '{enabled}/{total} child plugins on',\n childrenShow: 'Show child plugins of {name}',\n childrenHide: 'Hide child plugins of {name}',\n repairFailureTitle: 'A plugin failed to start last time. Please fix it.',\n repairFailurePluginLabel: 'Plugin',\n repairFailureKindLabel: 'Failure kind',\n repairFailureAtLabel: 'At',\n repairFailureMessageLabel: 'Failure details',\n repairFailureStackLabel: 'Original stack',\n repairFailurePathLabel: 'Plugin install directory',\n repairFailureAsk: 'Please inspect and fix the plugin; tell me how to re-enable it afterwards.',\n repairKindLoad: 'Load failure',\n repairKindHang: 'Startup hang',\n repairKindLate: 'Late rejection',\n repairConflictTitle: 'Handling a plugin install conflict',\n repairConflictPluginLabel: 'Conflicting entry',\n repairConflictChangeLabel: 'State change',\n repairConflictAsk: 'Inspect the entry ids and mounting of both sides, resolve the double mount, and tell me how to re-enable.',\n repairStateEnabled: 'On',\n repairStateDisabled: 'Off',\n repairStateUninstalled: 'Uninstalled',\n} satisfies Record<keyof typeof STATIC_ZH, string>\n\nexport const zh = STATIC_ZH\nexport const en = STATIC_EN\nexport type PluginManagerKey = keyof typeof STATIC_ZH\n","/**\n * Wire parsing for the official plugin-installer / plugin-control RPC\n * channels. This package is a browser-side consumer of those channels: every\n * response is decoded but untrusted, so each parser validates the shape it\n * needs and throws a typed error on mismatch. Callers treat a parse failure\n * as \"channel unavailable or drifted\" and degrade to command hints.\n *\n * The shapes mirror the official web installer tab's wire protocol (see the\n * DSH checkout's packages/client/ui-settings-plugin-installer/src/client/\n * protocol.ts); they are a contract observation, not an import.\n * @module @linxin666/dsh-client-ui-plugin-manager/core\n */\n\n/** One loader entry row claimed by an installed bundle package (aggregate child). */\nexport interface InstalledPluginChild {\n /** The loader entry id, e.g. web-ui-pet. */\n id: string\n /** Display name: the real plugin package (shell config.plugin) when known. */\n name: string\n /** Effective next-start enablement of this row alone (bundle default plus user override). */\n enabled: boolean\n /** Rows the manager must never disable (the manager tab itself, the compat face). */\n locked?: boolean\n}\n\n/** One installed user-plugin row served by `/plugin-installer list`. */\nexport interface InstalledPluginItem {\n id: string\n name: string\n version: string\n source: { kind: 'npm' | 'git'; spec: string }\n installedAt: string\n /** Effective next-start enablement across the bundle's own rows and the managed profile patch row. */\n enabled: boolean\n commit?: string\n /**\n * Entry rows this package's bundle patch claims, present when the package\n * is an aggregate claiming more than one row (gateway mode only — the\n * official channel wire has no children). Child enablement is individually\n * switchable; uninstall stays whole-package (the code ships in one npm\n * package).\n */\n children?: InstalledPluginChild[]\n}\n\n/** Point-in-time install/update progress reported by the host. */\nexport interface InstallProgressItem {\n kind: 'idle' | 'install' | 'update'\n stage: 'fetch' | 'download' | 'extract' | 'write'\n percent?: number\n}\n\n/** Whether an update row is a normal same-name update or a legacy package migration. */\nexport type PluginUpdateKind = 'update' | 'migrate'\n\n/** One plugin with a newer version available. */\nexport interface PluginUpdateItem {\n id: string\n current: string\n latest: string\n /** Normal same-name update or legacy aggregate migration. Defaults to update. */\n kind?: PluginUpdateKind\n /** Target package name when kind is migrate. */\n target?: string\n /** Exact target package version when kind is migrate. */\n targetVersion?: string\n /** Declared DSH minimum the update needs (package manifest's `dsh.engines.dsh`). */\n requiresDsh?: string\n /** Whether the running DSH host satisfies requiresDsh; absent when unknown. */\n compatible?: boolean\n}\n\n/** One recorded plugin boot failure served by the host. */\nexport interface PluginFailureItem {\n /** Installed plugin id (package name); empty for unattributable failures. */\n pluginId: string\n kind: 'load-failure' | 'hang' | 'late-rejection'\n message: string\n stack: string\n installPath: string\n at: string\n}\n\n/** Recovery facts served by the host: the failure ring, the plugin root, and safe mode. */\nexport interface PluginFailuresSnapshot {\n items: PluginFailureItem[]\n /** Absolute plugin install root — the repair conversation's workspace. */\n pluginRoot: string\n /** Whether the host is running in safe mode (user plugins skipped). */\n safeMode: boolean\n}\n\n/** One deployment-configured logical product switch. */\nexport interface PluginControlItem {\n id: string\n name: string\n repository: string\n state: 'enabled' | 'disabled' | 'mixed' | 'unavailable' | 'uninstalled'\n}\n\n/** Whether a decoded value is a non-array object. */\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value)\n}\n\n/** Whether a decoded value is a string. */\nfunction isString(value: unknown): value is string {\n return typeof value === 'string'\n}\n\n/** Validate one aggregate child row. */\nfunction parsePluginChild(value: unknown, rowIndex: number, childIndex: number): InstalledPluginChild {\n if (!isRecord(value) || !isString(value.id) || !isString(value.name) || typeof value.enabled !== 'boolean') {\n throw new Error(`plugin-manager: plugin row ${String(rowIndex)} child ${String(childIndex)} is invalid`)\n }\n return {\n id: value.id,\n name: value.name,\n enabled: value.enabled,\n ...typeof value.locked === 'boolean' ? { locked: value.locked } : {},\n }\n}\n\n/** Validate one installed-plugin row. */\nfunction parsePlugin(value: unknown, index: number): InstalledPluginItem {\n if (!isRecord(value) || !isString(value.id) || !isString(value.name)\n || !isString(value.version) || !isString(value.installedAt)\n || typeof value.enabled !== 'boolean'\n || !isRecord(value.source) || (value.source.kind !== 'npm' && value.source.kind !== 'git')\n || !isString(value.source.spec)) {\n throw new Error(`plugin-manager: plugin row ${String(index)} is invalid`)\n }\n if (value.children !== undefined && !Array.isArray(value.children)) {\n throw new Error(`plugin-manager: plugin row ${String(index)} children is invalid`)\n }\n const children = (value.children as unknown[] | undefined)?.map((child, childIndex) => parsePluginChild(child, index, childIndex))\n return {\n id: value.id,\n name: value.name,\n version: value.version,\n source: { kind: value.source.kind, spec: value.source.spec },\n installedAt: value.installedAt,\n enabled: value.enabled,\n ...isString(value.commit) ? { commit: value.commit } : {},\n ...children !== undefined ? { children } : {},\n }\n}\n\n/**\n * Validate and normalize a `list` / `uninstall` response value.\n * @param value - decoded but untrusted response value.\n * @returns typed installed-plugin rows.\n */\nexport function parsePluginList(value: unknown): InstalledPluginItem[] {\n if (!isRecord(value) || !Array.isArray(value.plugins)) {\n throw new Error('plugin-manager: response must contain a plugins array')\n }\n return value.plugins.map((plugin, index) => parsePlugin(plugin, index))\n}\n\n/**\n * Validate and normalize an `install` / `update` / `set-enabled` response value.\n * @param value - decoded but untrusted response value.\n * @returns the typed installed-plugin row.\n */\nexport function parseInstalledPlugin(value: unknown): InstalledPluginItem {\n if (!isRecord(value) || value.plugin === undefined) {\n throw new Error('plugin-manager: response must contain a plugin row')\n }\n return parsePlugin(value.plugin, 0)\n}\n\n/**\n * Validate and normalize a plugin-control `list` / `set-enabled` response value.\n * @param value - decoded but untrusted response value.\n * @returns the typed control items.\n */\nexport function parsePluginControlSnapshot(value: unknown): PluginControlItem[] {\n if (!isRecord(value) || !Array.isArray(value.controls)) {\n throw new Error('plugin-manager: response must contain a controls array')\n }\n return value.controls.map((control, index) => {\n if (!isRecord(control) || !isString(control.id) || !isString(control.name)\n || !isString(control.repository)\n || (control.state !== 'enabled' && control.state !== 'disabled'\n && control.state !== 'mixed' && control.state !== 'unavailable'\n && control.state !== 'uninstalled')) {\n throw new Error(`plugin-manager: control row ${String(index)} is invalid`)\n }\n return {\n id: control.id,\n name: control.name,\n repository: control.repository,\n state: control.state,\n }\n })\n}\n\n/**\n * Validate and normalize a `status` response value.\n * @param value - decoded but untrusted response value.\n * @returns the typed progress state.\n */\nexport function parseInstallStatus(value: unknown): InstallProgressItem {\n if (!isRecord(value) || !isRecord(value.progress)\n || (value.progress.kind !== 'idle' && value.progress.kind !== 'install' && value.progress.kind !== 'update')\n || (value.progress.stage !== 'fetch' && value.progress.stage !== 'download'\n && value.progress.stage !== 'extract' && value.progress.stage !== 'write')\n || (value.progress.percent !== undefined\n && (typeof value.progress.percent !== 'number' || !Number.isFinite(value.progress.percent)))) {\n throw new Error('plugin-manager: response must contain a valid progress state')\n }\n return {\n kind: value.progress.kind,\n stage: value.progress.stage,\n ...typeof value.progress.percent === 'number' ? { percent: value.progress.percent } : {},\n }\n}\n\n/**\n * Validate and normalize a `check-updates` response value.\n * @param value - decoded but untrusted response value.\n * @returns typed update rows.\n */\nexport function parseUpdateList(value: unknown): PluginUpdateItem[] {\n if (!isRecord(value) || !Array.isArray(value.updates)) {\n throw new Error('plugin-manager: response must contain an updates array')\n }\n return value.updates.map((update, index) => {\n if (!isRecord(update) || !isString(update.id) || !isString(update.current) || !isString(update.latest)) {\n throw new Error(`plugin-manager: update row ${String(index)} is invalid`)\n }\n const kind = update.kind === undefined ? 'update' : update.kind\n if (kind !== 'update' && kind !== 'migrate') {\n throw new Error(`plugin-manager: update row ${String(index)} is invalid`)\n }\n const row: PluginUpdateItem = { id: update.id, current: update.current, latest: update.latest }\n if (kind === 'migrate') {\n if (!isString(update.target) || !isString(update.targetVersion)) {\n throw new Error(`plugin-manager: update row ${String(index)} is invalid`)\n }\n row.kind = 'migrate'\n row.target = update.target\n row.targetVersion = update.targetVersion\n }\n if (update.requiresDsh !== undefined) {\n if (!isString(update.requiresDsh)) {\n throw new Error(`plugin-manager: update row ${String(index)} is invalid`)\n }\n row.requiresDsh = update.requiresDsh\n }\n if (update.compatible !== undefined) {\n if (typeof update.compatible !== 'boolean') {\n throw new Error(`plugin-manager: update row ${String(index)} is invalid`)\n }\n row.compatible = update.compatible\n }\n return row\n })\n}\n\n/**\n * Validate and normalize a `failures` response value.\n * @param value - decoded but untrusted response value.\n * @returns the typed failures snapshot.\n */\nexport function parseFailuresSnapshot(value: unknown): PluginFailuresSnapshot {\n if (!isRecord(value) || !Array.isArray(value.items)\n || !isString(value.pluginRoot) || typeof value.safeMode !== 'boolean') {\n throw new Error('plugin-manager: response must contain a failures snapshot')\n }\n return {\n items: value.items.map((item, index) => {\n if (!isRecord(item) || !isString(item.pluginId)\n || (item.kind !== 'load-failure' && item.kind !== 'hang' && item.kind !== 'late-rejection')\n || !isString(item.message) || !isString(item.stack)\n || !isString(item.installPath) || !isString(item.at)) {\n throw new Error(`plugin-manager: failure row ${String(index)} is invalid`)\n }\n return {\n pluginId: item.pluginId,\n kind: item.kind,\n message: item.message,\n stack: item.stack,\n installPath: item.installPath,\n at: item.at,\n }\n }),\n pluginRoot: value.pluginRoot,\n safeMode: value.safeMode,\n }\n}\n","/**\n * The cordis service contract this package exposes to sibling client plugins\n * under the name `'pluginManager'`. The browser half builds one dual-channel\n * face (official /plugin-installer + /plugin-control RPC channels when\n * available, else this package's loopback HTTP gateway) and provides it via\n * `ctx.provide('pluginManager', face)`; consumers resolve it with\n * `ctx.inject(['pluginManager'], cb)` and read `ctx.pluginManager`.\n *\n * The interface is intentionally narrower than the face the Plugin manager\n * tab receives (`PluginManagerFace` in the client half): it is the stable\n * cross-plugin surface, so it only carries the operations a sibling plugin\n * needs to observe and drive the installed-plugin set.\n * @module @linxin666/dsh-client-ui-plugin-manager/core\n */\n\nimport type { InstallProgressItem, InstalledPluginItem, PluginFailuresSnapshot } from './protocol.ts'\n\n/** The cordis service name the browser half provides the face under. */\nexport const PLUGIN_MANAGER_SERVICE = 'pluginManager'\n\n/**\n * The dual-channel plugin-management face, shared between the Plugin manager\n * tab and sibling client plugins.\n */\nexport interface PluginManagerService {\n /** Whether this browser has loopback authority to use the host routes. */\n readonly isLoopback: boolean\n /** Read the installed snapshot. */\n list(): Promise<InstalledPluginItem[]>\n /** Install one plugin from an npm spec or git URL. */\n install(spec: string): Promise<InstalledPluginItem>\n /** Remove one plugin. */\n uninstall(id: string): Promise<InstalledPluginItem[]>\n /** Read the current install/update progress. */\n status(): Promise<InstallProgressItem>\n /**\n * Read the recorded plugin boot-failure ring (plugin id, message, stack,\n * install path). On runtimes without a failure ring the host answers an\n * empty snapshot.\n */\n failures(): Promise<PluginFailuresSnapshot>\n /**\n * Flip one plugin's next-start enablement through the active channel (the\n * official installer RPC when available, else the loopback gateway's patch\n * `disabled` override row). The change takes effect after the host restart;\n * a running plugin is not stopped.\n */\n setEnabled(id: string, enabled: boolean): Promise<InstalledPluginItem>\n /**\n * Subscribe to successful mutations: the callback runs after install(),\n * update(), uninstall(), or setEnabled() resolves. One listener throwing\n * never breaks the others. Returns the unsubscribe function.\n */\n onChange(cb: () => void): () => void\n}\n\ndeclare module '@deepseek-ai/cordis' {\n interface Context {\n /** The plugin-manager face (provided by the dsh-plugin-manager client half). */\n pluginManager: PluginManagerService\n }\n}\n","// Generated by scripts/sync-shared.mjs from shared/client/telemetry.ts. Do not edit this copy; edit the shared source and run \"node scripts/sync-shared.mjs\".\n/**\n * Anonymous install telemetry shared by the DSH Web UI family plugins.\n *\n * Once per UTC day per browser, each wired plugin sends one heartbeat to\n * the dsh-market edge API listing its package name (and version when known).\n * The payload carries no conversation data and no identifiers beyond a random\n * UUID generated in localStorage; the server hashes it with a deployment salt\n * before storage and never persists IP addresses. Sends are fire-and-forget:\n * failures stay silent and simply retry on a later mount or day. The system\n * is documented in docs/telemetry.md.\n */\n\nexport type TelemetryChannel = 'market' | 'npm' | 'unknown'\n\nexport interface TelemetryItem {\n /** npm package name or asset id, e.g. \"@linxin666/dsh-pet\" or \"skin:harbor\". */\n name: string\n /** Installed version when known; omitted otherwise. */\n version?: string\n /** Install channel when determinable (market = Workshop install). */\n channel?: TelemetryChannel\n}\n\nconst VISITOR_KEY = 'dsh-web-ui-telemetry-visitor'\nconst DAY_KEY_PREFIX = 'dsh-web-ui-telemetry-day:'\nconst ENDPOINT = 'https://dsh-market.com/api/telemetry/event'\n\n// Baked into each client bundle by shared/tsdown.client.ts (the package's own\n// package.json version at build time). Undefined in dev/test builds.\ndeclare const __DSH_PKG_VERSION__: string | undefined\n\n/** The building package's version, when the bundle carries it. */\nfunction bakedVersion(): string | undefined {\n try {\n return typeof __DSH_PKG_VERSION__ === 'string' && __DSH_PKG_VERSION__ !== ''\n ? __DSH_PKG_VERSION__\n : undefined\n } catch {\n return undefined\n }\n}\n\n/** Read or lazily create the anonymous visitor id; null when storage is unavailable. */\nfunction visitorId(): string | null {\n try {\n const existing = localStorage.getItem(VISITOR_KEY)\n if (existing && /^[A-Za-z0-9_-]{16,64}$/.test(existing)) return existing\n const fresh = crypto.randomUUID().replaceAll('-', '')\n localStorage.setItem(VISITOR_KEY, fresh)\n return fresh\n } catch {\n // Storage unavailable (privacy mode, sandboxed frame): report nothing.\n return null\n }\n}\n\n/** Drop stale per-day dedup keys so localStorage does not grow forever. */\nfunction pruneDayKeys(today: string): void {\n try {\n for (let index = localStorage.length - 1; index >= 0; index -= 1) {\n const key = localStorage.key(index)\n if (key !== null && key.startsWith(DAY_KEY_PREFIX) && key !== DAY_KEY_PREFIX + today) {\n localStorage.removeItem(key)\n }\n }\n } catch { /* best effort */ }\n}\n\n/**\n * Fire the daily heartbeat for the given items at most once per UTC day per\n * browser. Never throws and never blocks the caller. Items without an explicit\n * version inherit the bundle's baked build version.\n */\nexport function reportDailyHeartbeat(items: readonly TelemetryItem[]): void {\n try {\n if (items.length === 0) return\n const today = new Date().toISOString().slice(0, 10)\n // Automation contexts (CDP-driven QA browsers, fresh isolated profiles)\n // mint a new visitor id per run and would inflate instance counts.\n if (navigator.webdriver) return\n if (localStorage.getItem(DAY_KEY_PREFIX + today) !== null) return\n const visitor = visitorId()\n if (visitor === null) return\n pruneDayKeys(today)\n const payloadItems = items.map((item) => {\n const out: Record<string, string> = { name: item.name }\n const version = item.version ?? bakedVersion()\n if (version !== undefined) out.version = version\n if (item.channel !== undefined) out.channel = item.channel\n return out\n })\n const body = JSON.stringify({ kind: 'heartbeat', visitor, items: payloadItems })\n void fetch(ENDPOINT, {\n method: 'POST',\n headers: { 'content-type': 'application/json' },\n body,\n keepalive: true,\n }).then((response) => {\n // Mark the day only after an accepted send, so offline browsers retry\n // on a later mount instead of going dark until tomorrow.\n if (response.ok) localStorage.setItem(DAY_KEY_PREFIX + today, '1')\n }).catch(() => { /* unreachable endpoint: stay silent */ })\n } catch { /* never break the host UI over telemetry */ }\n}\n","/**\n * Plugin-manager browser half: contributes the family plugin-manager tab to\n * the official Plugins settings section (`settings.plugins.tab` slot) and\n * provides the same dual-channel face as the `'pluginManager'` cordis\n * service for sibling client plugins. It is dual-channel: on runtimes with\n * the official installer services (DSHCode, the 1.0.4 checkout web) every\n * operation rides the official `/plugin-installer` and `/plugin-control`\n * loopback RPC channels (the single writer); on the npm-published web runtime\n * those channels do not exist, so the same face falls back to this package's\n * own loopback HTTP gateway, which spawns the official CLI for writes.\n * Neither the tab nor service consumers know which mode the face runs in.\n * @module @linxin666/dsh-client-ui-plugin-manager/client\n */\n\n// Type-only: pulls the locale plugin's Context merge (ctx.locale).\nimport type {} from '@deepseek-ai/dsh-client-locale/client'\n// Type-only: pulls the settings surface's slot contracts (settings.plugins.tab).\nimport type {} from '@deepseek-ai/dsh-client-ui-settings/client'\n// Type-only: pulls the client runtime Context merge (ctx.workspaces, ctx.sessions).\nimport type { Context as ClientContext } from '@deepseek-ai/cordis'\nimport type {} from '@deepseek-ai/dsh-api-session-controller/client'\n// Type-only: pulls the workspace plugin's Context merge (ctx.uiWorkspace), the\n// multi-instance navigation face that replaced ISessions.open().\nimport type {} from '@deepseek-ai/dsh-client-ui-workspace/client'\nimport type {} from '@deepseek-ai/dsh-api-workspace-controller/client'\nimport type {} from '@deepseek-ai/dsh-client-ui-renderer/client'\nimport type { ConnectionHandle } from '@deepseek-ai/dsh-client-connection/client'\nimport { PluginManagerTab, type PluginManagerTabInjected } from './PluginManagerTab.tsx'\nimport { en, zh, type PluginManagerKey } from './locales.ts'\nimport {\n parseFailuresSnapshot,\n parseInstallStatus,\n parseInstalledPlugin,\n parsePluginControlSnapshot,\n parsePluginList,\n parseUpdateList,\n type InstalledPluginItem,\n type InstallProgressItem,\n type PluginControlItem,\n type PluginFailuresSnapshot,\n type PluginUpdateItem,\n} from '../core/protocol.ts'\nimport { PLUGIN_MANAGER_SERVICE, type PluginManagerService } from '../core/service.ts'\nimport type { ControlChange } from '../core/conflict.ts'\nimport { reportDailyHeartbeat } from './telemetry.ts'\n\ndeclare module '@deepseek-ai/dsh-client-ui-slots' {\n interface LocaleNamespaceMap {\n /** Copy for the family plugin-manager tab. */\n 'settings.pluginManager': PluginManagerKey\n }\n}\n\nconst NS = 'settings.pluginManager'\nconst CHANNEL = '/plugin-installer'\nconst CONTROL_CHANNEL = '/plugin-control'\nconst LIST_ENDPOINT = 'list'\nconst INSTALL_ENDPOINT = 'install'\nconst UPDATE_ENDPOINT = 'update'\nconst UNINSTALL_ENDPOINT = 'uninstall'\nconst SET_ENABLED_ENDPOINT = 'set-enabled'\nconst CHECK_UPDATES_ENDPOINT = 'check-updates'\nconst STATUS_ENDPOINT = 'status'\nconst FAILURES_ENDPOINT = 'failures'\nconst SET_SAFE_MODE_ENDPOINT = 'set-safe-mode'\n\nconst GATEWAY_PREFIX = '/api/plugin-manager'\n/** Gateway job polling cadence. */\nconst JOB_POLL_MS = 500\n/** Gateway job wait ceiling (the host add deadline is six minutes). */\nconst JOB_WAIT_MS = 7 * 60_000\n\n/** Services required by the slot registration and both channels. */\nexport const inject = ['slots', 'locale', 'connection', 'workspaces', 'sessions', 'uiWorkspace']\n\n/** The gateway job wire shape served by /status. */\ninterface GatewayJobWire {\n phase: 'running' | 'done' | 'error'\n plugin?: unknown\n conflicts?: unknown\n error?: string\n}\n\n/**\n * The face the Plugin manager tab and the `'pluginManager'` cordis service\n * share: the full tab surface plus the cross-plugin service contract.\n */\nexport type PluginManagerFace = PluginManagerTabInjected & PluginManagerService\n\n/**\n * Build the dual-channel face once: official-channel and gateway-channel\n * implementations, the mode detection that picks between them, the repair\n * handoff, and the change-notification listener set. The returned face is\n * both the tab's injected props and the value provided as the\n * `'pluginManager'` cordis service.\n * @param ctx - the client context (connection, workspaces, sessions).\n * @returns the shared face.\n */\nexport function createPluginManagerFace(ctx: ClientContext): PluginManagerFace {\n const connection = ctx.get('connection') as ConnectionHandle\n\n // ── official channel implementations ──────────────────────────────────────\n\n const call = async (endpoint: string, payload: unknown): Promise<unknown> => {\n const result = await connection.rpc.call(CHANNEL, endpoint, payload)\n if (!result.ok) {\n throw new Error(`plugin-installer ${endpoint} failed: ${result.error.code}: ${result.error.message}`)\n }\n return result.value\n }\n const official = {\n list: async (): Promise<InstalledPluginItem[]> => parsePluginList(await call(LIST_ENDPOINT, {})),\n install: async (spec: string): Promise<InstalledPluginItem> => parseInstalledPlugin(await call(INSTALL_ENDPOINT, { spec })),\n update: async (id: string): Promise<InstalledPluginItem> => parseInstalledPlugin(await call(UPDATE_ENDPOINT, { id })),\n uninstall: async (id: string): Promise<InstalledPluginItem[]> => parsePluginList(await call(UNINSTALL_ENDPOINT, { id })),\n setEnabled: async (id: string, enabled: boolean): Promise<InstalledPluginItem> =>\n parseInstalledPlugin(await call(SET_ENABLED_ENDPOINT, { id, enabled })),\n checkUpdates: async (): Promise<PluginUpdateItem[]> => parseUpdateList(await call(CHECK_UPDATES_ENDPOINT, {})),\n status: async (): Promise<InstallProgressItem> => parseInstallStatus(await call(STATUS_ENDPOINT, {})),\n failures: async (): Promise<PluginFailuresSnapshot> => parseFailuresSnapshot(await call(FAILURES_ENDPOINT, {})),\n setSafeMode: async (enabled: boolean): Promise<void> => {\n await call(SET_SAFE_MODE_ENDPOINT, { enabled })\n },\n controlsList: async (): Promise<PluginControlItem[]> =>\n parsePluginControlSnapshot(await connection.rpc.call(CONTROL_CHANNEL, 'list', {}).then(result => {\n if (!result.ok) throw new Error(`plugin-control list failed: ${result.error.code}: ${result.error.message}`)\n return result.value\n })),\n controlsSetEnabled: async (pluginId: string, enabled: boolean): Promise<PluginControlItem[]> =>\n parsePluginControlSnapshot(await connection.rpc.call(CONTROL_CHANNEL, 'set-enabled', { pluginId, enabled }).then(result => {\n if (!result.ok) throw new Error(`plugin-control set-enabled failed: ${result.error.code}: ${result.error.message}`)\n return result.value\n })),\n }\n\n // ── gateway channel implementations ──────────────────────────────────────\n\n const gatewayJson = async (path: string, init?: RequestInit): Promise<unknown> => {\n const response = await fetch(path, {\n ...init,\n headers: { 'content-type': 'application/json', ...init?.headers },\n })\n if (response.status === 403) {\n throw new Error('plugin-manager: plugin management is only available from a local browser')\n }\n if (!response.ok) {\n const body = await response.json().catch(() => ({})) as { error?: string }\n throw new Error(body.error ?? `plugin-manager: gateway ${path} failed: HTTP ${String(response.status)}`)\n }\n return response.json()\n }\n\n /** Wait for one gateway job to settle, returning its wire state. */\n const waitJob = async (jobId: string): Promise<GatewayJobWire> => {\n const deadline = Date.now() + JOB_WAIT_MS\n for (;;) {\n const body = await gatewayJson(`${GATEWAY_PREFIX}/status?job=${encodeURIComponent(jobId)}`) as { job?: GatewayJobWire }\n const job = body.job\n if (job === undefined) throw new Error('plugin-manager: gateway job vanished')\n if (job.phase === 'done') return job\n if (job.phase === 'error') throw new Error(job.error ?? 'plugin-manager: gateway job failed')\n if (Date.now() > deadline) throw new Error('plugin-manager: gateway job timed out')\n await new Promise(resolve => { setTimeout(resolve, JOB_POLL_MS) })\n }\n }\n\n /** The conflict ledger of the last settled gateway install. */\n let lastInstallConflicts: ControlChange[] = []\n /** Whether a gateway install/remove is in flight (drives the progress row). */\n let gatewayInflight = false\n\n const gateway = {\n list: async (): Promise<InstalledPluginItem[]> =>\n parsePluginList(await gatewayJson(`${GATEWAY_PREFIX}/list`)),\n install: async (spec: string): Promise<InstalledPluginItem> => {\n gatewayInflight = true\n try {\n const started = await gatewayJson(`${GATEWAY_PREFIX}/install`, {\n method: 'POST',\n body: JSON.stringify({ spec }),\n }) as { jobId?: string }\n if (started.jobId === undefined) throw new Error('plugin-manager: gateway install returned no job')\n const job = await waitJob(started.jobId)\n lastInstallConflicts = Array.isArray(job.conflicts) ? job.conflicts as ControlChange[] : []\n return parseInstalledPlugin({ plugin: job.plugin })\n } finally {\n gatewayInflight = false\n }\n },\n update: async (id: string): Promise<InstalledPluginItem> => {\n gatewayInflight = true\n try {\n const started = await gatewayJson(`${GATEWAY_PREFIX}/update`, {\n method: 'POST',\n body: JSON.stringify({ id }),\n }) as { jobId?: string }\n if (started.jobId === undefined) throw new Error('plugin-manager: gateway update returned no job')\n const job = await waitJob(started.jobId)\n lastInstallConflicts = Array.isArray(job.conflicts) ? job.conflicts as ControlChange[] : []\n return parseInstalledPlugin({ plugin: job.plugin })\n } finally {\n gatewayInflight = false\n }\n },\n uninstall: async (id: string): Promise<InstalledPluginItem[]> => {\n gatewayInflight = true\n try {\n const started = await gatewayJson(`${GATEWAY_PREFIX}/remove`, {\n method: 'POST',\n body: JSON.stringify({ id }),\n }) as { jobId?: string }\n if (started.jobId === undefined) throw new Error('plugin-manager: gateway remove returned no job')\n await waitJob(started.jobId)\n return gateway.list()\n } finally {\n gatewayInflight = false\n }\n },\n setEnabled: async (id: string, enabled: boolean): Promise<InstalledPluginItem> =>\n parseInstalledPlugin(await gatewayJson(`${GATEWAY_PREFIX}/set-enabled`, {\n method: 'POST',\n body: JSON.stringify({ id, enabled }),\n })),\n checkUpdates: async (): Promise<PluginUpdateItem[]> =>\n parseUpdateList(await gatewayJson(`${GATEWAY_PREFIX}/check-updates`)),\n status: async (): Promise<InstallProgressItem> =>\n gatewayInflight ? { kind: 'install', stage: 'download' } : { kind: 'idle', stage: 'fetch' },\n failures: async (): Promise<PluginFailuresSnapshot> =>\n parseFailuresSnapshot(await gatewayJson(`${GATEWAY_PREFIX}/failures`)),\n setSafeMode: async (): Promise<void> => {\n throw new Error('plugin-manager: safe mode is unavailable in this runtime')\n },\n controlsList: async (): Promise<PluginControlItem[]> => [],\n controlsSetEnabled: async (pluginId: string, enabled: boolean): Promise<PluginControlItem[]> => {\n await gateway.setEnabled(pluginId, enabled)\n return []\n },\n }\n\n // ── mode selection ────────────────────────────────────────────────────────\n\n let modePromise: Promise<'official' | 'gateway'> | undefined\n const ensureMode = (): Promise<'official' | 'gateway'> => {\n if (modePromise === undefined) {\n modePromise = (async () => {\n // Prefer the host verdict: the gateway's /mode route reports whether\n // the official installer channels exist, so the direct channel probe\n // below (which 405s into the browser console on the npm web runtime)\n // only runs when the host half is absent or explicitly returns null\n // for a desktop runtime whose services are registered in-process.\n try {\n const mode = await gatewayJson(`${GATEWAY_PREFIX}/mode`) as { official?: boolean | null }\n if (mode.official === true) return 'official' as const\n if (mode.official === false) return 'gateway' as const\n } catch {\n // Host half absent (an official runtime without a boot profile):\n // fall back to the direct channel probe.\n }\n try {\n const result = await connection.rpc.call(CHANNEL, LIST_ENDPOINT, {})\n return result.ok ? 'official' as const : 'gateway' as const\n } catch {\n return 'gateway' as const\n }\n })()\n }\n return modePromise\n }\n\n /**\n * Start a repair conversation for a failed plugin: resolve a workspace over\n * the plugin install root (created once, reused after), open a fresh\n * session there, and seed its first prompt with the failure details. The\n * session's workspace is the plugin home so the agent's file tools reach\n * the plugin code without leaving the workspace boundary.\n * @param pluginRoot - absolute plugin install root.\n * @param message - the seeded first user message.\n * @returns resolution after the prompt is accepted and the session opens.\n */\n const repairPlugin = async (pluginRoot: string, message: string): Promise<void> => {\n const workspace = await ctx.workspaces.create({ path: pluginRoot })\n const sessionId = await ctx.sessions.create({ workspaceId: workspace.workspaceId })\n const binding = ctx.sessions.binding(sessionId)\n if (binding === undefined) throw new Error(`plugin-manager: repair session ${sessionId} is unavailable`)\n const result = await binding.session.prompt([{ type: 'text', text: message }], 'queue')\n if (!result.ok) throw new Error(`plugin-manager: repair prompt failed: ${result.error.code}: ${result.error.message}`)\n ctx.uiWorkspace.openSession(sessionId)\n }\n\n // ── change notification ───────────────────────────────────────────────────\n\n /** Listeners subscribed through onChange; fired after successful mutations. */\n const listeners = new Set<() => void>()\n /** Notify every listener; one listener throwing never breaks the others. */\n const notifyChange = (): void => {\n for (const listener of [...listeners]) {\n try {\n listener()\n } catch {\n // A consumer's listener failure is its own; keep notifying the rest.\n }\n }\n }\n\n // ── the shared face ───────────────────────────────────────────────────────\n\n return {\n isLoopback: connection.isLoopback,\n list: async () => (await ensureMode()) === 'official' ? official.list() : gateway.list(),\n install: async spec => {\n const item = await ((await ensureMode()) === 'official' ? official.install(spec) : gateway.install(spec))\n notifyChange()\n return item\n },\n update: async id => {\n const item = await ((await ensureMode()) === 'official' ? official.update(id) : gateway.update(id))\n notifyChange()\n return item\n },\n uninstall: async id => {\n const rows = await ((await ensureMode()) === 'official' ? official.uninstall(id) : gateway.uninstall(id))\n notifyChange()\n return rows\n },\n setEnabled: async (id, enabled) => {\n const item = await ((await ensureMode()) === 'official' ? official.setEnabled(id, enabled) : gateway.setEnabled(id, enabled))\n notifyChange()\n return item\n },\n checkUpdates: async () => (await ensureMode()) === 'official' ? official.checkUpdates() : gateway.checkUpdates(),\n status: async () => (await ensureMode()) === 'official' ? official.status() : gateway.status(),\n failures: async () => (await ensureMode()) === 'official' ? official.failures() : gateway.failures(),\n setSafeMode: async enabled => (await ensureMode()) === 'official' ? official.setSafeMode(enabled) : gateway.setSafeMode(),\n repairPlugin,\n controlsList: async () => (await ensureMode()) === 'official' ? official.controlsList() : gateway.controlsList(),\n controlsSetEnabled: async (id, enabled) => (await ensureMode()) === 'official' ? official.controlsSetEnabled(id, enabled) : gateway.controlsSetEnabled(id, enabled),\n lastInstallConflicts: () => lastInstallConflicts,\n onChange: cb => {\n listeners.add(cb)\n return () => { listeners.delete(cb) }\n },\n }\n}\n\n/** Contribute the family plugin-manager tab and provide the shared face. */\nexport function apply(ctx: ClientContext): void {\n // Anonymous install heartbeat (docs/telemetry.md): one beat per browser per\n // UTC day, package name only, silent failure.\n reportDailyHeartbeat([{ name: '@linxin666/dsh-client-ui-plugin-manager' }])\n\n ctx.effect(() => {\n try {\n return ctx.locale.register(NS, { zh, en })\n } catch {\n return () => {}\n }\n }, 'plugin-manager: dictionaries')\n\n // Built once: the tab and the 'pluginManager' cordis service share one\n // face, so consumers observe exactly the mutations the tab performs.\n const face = createPluginManagerFace(ctx)\n try {\n if (!ctx.get(PLUGIN_MANAGER_SERVICE)) {\n ctx.provide(PLUGIN_MANAGER_SERVICE, face)\n }\n } catch {\n // ignore duplicate provide\n }\n\n ctx.slots.inject('settings.plugins.tab', () => {\n try {\n return ctx.slots.register({\n name: 'settings.plugins.tab',\n id: 'family-plugins',\n order: 20,\n label: () => ctx.locale.bind(NS)('tab'),\n locale: NS,\n inject: () => face,\n }, PluginManagerTab)\n } catch {\n return () => {}\n }\n })\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;EAsCA,SAAgB,aAAa,QAAsC,OAAsD;GACvH,MAAM,YAAY,IAAI,IAAI,MAAM,KAAI,SAAQ,CAAC,KAAK,IAAI,IAAI,CAAC,CAAC;GAC5D,MAAM,UAA2B,CAAC;GAClC,KAAK,MAAM,QAAQ,QAAQ;IACzB,MAAM,UAAU,UAAU,IAAI,KAAK,EAAE;IACrC,IAAI,YAAY,KAAA,KAAa,QAAQ,UAAU,KAAK,OAAO;IAC3D,QAAQ,KAAK;KAAE,IAAI,KAAK;KAAI,MAAM,KAAK;KAAM,MAAM,KAAK;KAAO,IAAI,QAAQ;IAAM,CAAC;GACpF;GACA,OAAO;EACT;;;;;;;;EASA,SAAgB,eAAe,QAA0C;GACvE,IAAI,OAAO,OAAO,YAAY,OAAO;GACrC,IAAI,OAAO,SAAS,YAAY,OAAO;GACvC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I,OAAO;IAClK,4BAA4B;IAC5B,WAAU,OAAM;KACd,UAAU,IAAI,EAAE;KAChB,aAAa;MAAE,UAAU,OAAO,EAAE;KAAE;IACtC;GACF;EACF;;EAGA,SAAgB,MAAM,KAA0B;GAG9C,qBAAqB,CAAC,EAAE,MAAM,0CAA0C,CAAC,CAAC;GAE1E,IAAI,aAAa;IACf,IAAI;KACF,OAAO,IAAI,OAAO,SAAS,IAAI;MAAE;MAAI;KAAG,CAAC;IAC3C,QAAQ;KACN,aAAa,CAAC;IAChB;GACF,GAAG,8BAA8B;GAIjC,MAAM,OAAO,wBAAwB,GAAG;GACxC,IAAI;IACF,IAAI,CAAC,IAAI,IAAA,eAA0B,GACjC,IAAI,QAAQ,wBAAwB,IAAI;GAE5C,QAAQ,CAER;GAEA,IAAI,MAAM,OAAO,8BAA8B;IAC7C,IAAI;KACF,OAAO,IAAI,MAAM,SAAS;MACxB,MAAM;MACN,IAAI;MACJ,OAAO;MACP,aAAa,IAAI,OAAO,KAAK,EAAE,CAAC,CAAC,KAAK;MACtC,QAAQ;MACR,cAAc;KAChB,GAAG,gBAAgB;IACrB,QAAQ;KACN,aAAa,CAAC;IAChB;GACF,CAAC;EACH"}
|
|
1
|
+
{"version":3,"file":"client.js","names":["css"],"sources":["../../../packages/dsh-plugin-manager/src/core/version.ts","../../../packages/dsh-plugin-manager/src/client/PluginUpdatePatch.tsx","../../../packages/dsh-plugin-manager/src/client/locales.ts","../../../packages/dsh-plugin-manager/src/core/protocol.ts","../../../packages/dsh-plugin-manager/src/core/service.ts","../../../packages/dsh-plugin-manager/src/client/telemetry.ts","../../../packages/dsh-plugin-manager/src/client/index.ts"],"sourcesContent":["/**\n * DSH host version parsing and comparison for the update compatibility\n * check. The declared minimum lives in the published package manifest under\n * `dsh.engines.dsh`, falling back to the top-level `engines.dsh`; the only\n * supported form is `>=X.Y.Z[-prerelease]`.\n *\n * Comparison deliberately uses plain semver ordering instead of\n * `semver.satisfies`: npm's prerelease rule only allows a prerelease version\n * to satisfy a comparator set carrying a prerelease on the same\n * major.minor.patch tuple, which would reject a newer host line (0.1.1-rc.2)\n * against a declared `>=0.1.0-rc.8` — exactly the cross-cohort upgrade path\n * this check must allow. Everything here is pure and tolerant of untrusted\n * input: a malformed value means \"cannot verify\", which the callers treat as\n * a fail-closed verdict when a requirement was declared (issue #754).\n * @module @linxin666/dsh-client-ui-plugin-manager/core\n */\n\n/** One parsed DSH host or package version. */\nexport interface DshVersion {\n major: number\n minor: number\n patch: number\n /** Prerelease identifiers, numeric identifiers kept as numbers (semver order). */\n prerelease: readonly (number | string)[]\n}\n\nconst VERSION_PATTERN = /^v?(\\d+)\\.(\\d+)\\.(\\d+)(?:-([0-9A-Za-z.-]+))?$/\n\n/**\n * Parse a DSH host or package version string.\n * @param value - e.g. `0.1.0-rc.8`, `v1.2.3`.\n * @returns the parsed version, or undefined when malformed.\n */\nexport function parseDshVersion(value: string): DshVersion | undefined {\n const match = VERSION_PATTERN.exec(value.trim())\n if (match === null) return undefined\n const prereleaseParts = match[4] === undefined ? [] : match[4].split('.')\n if (prereleaseParts.some(part => part === '')) return undefined\n return {\n major: Number(match[1]),\n minor: Number(match[2]),\n patch: Number(match[3]),\n prerelease: prereleaseParts.map(part => /^\\d+$/.test(part) ? Number(part) : part),\n }\n}\n\n/**\n * Compare two version strings by semver order (a release is newer than any\n * prerelease of the same tuple).\n * @returns -1 / 0 / 1, or undefined when either side is malformed.\n */\nexport function compareVersions(left: string, right: string): number | undefined {\n const a = parseDshVersion(left)\n const b = parseDshVersion(right)\n if (a === undefined || b === undefined) return undefined\n for (const key of ['major', 'minor', 'patch'] as const) {\n if (a[key] !== b[key]) return a[key] < b[key] ? -1 : 1\n }\n return comparePrerelease(a.prerelease, b.prerelease)\n}\n\n/**\n * Semver prerelease ordering: numeric identifiers compare numerically,\n * numeric identifiers rank below alphanumeric ones, alphanumeric identifiers\n * compare lexically, and a longer list wins when the shared prefix is equal.\n */\nfunction comparePrerelease(left: readonly (number | string)[], right: readonly (number | string)[]): number {\n if (left.length === 0 && right.length === 0) return 0\n if (left.length === 0) return 1\n if (right.length === 0) return -1\n const length = Math.max(left.length, right.length)\n for (let index = 0; index < length; index += 1) {\n const a = left[index]\n const b = right[index]\n if (a === undefined) return -1\n if (b === undefined) return 1\n if (typeof a === 'number' && typeof b === 'number') {\n if (a !== b) return a < b ? -1 : 1\n } else if (typeof a === 'number') {\n return -1\n } else if (typeof b === 'number') {\n return 1\n } else if (a !== b) {\n return a < b ? -1 : 1\n }\n }\n return 0\n}\n\nconst MINIMUM_RANGE_PATTERN = /^>=\\s*(v?\\d+\\.\\d+\\.\\d+(?:-[0-9A-Za-z.-]+)?)$/\n\n/**\n * Whether a host version satisfies a declared `>=X.Y.Z[-prerelease]` minimum.\n * @param host - the running DSH host version.\n * @param minimum - the declared minimum; any form other than `>=<semver>`\n * (plain semver, `^`, `~`, multi-comparator ranges, empty) returns undefined.\n * @returns true / false, or undefined when the host version is malformed or\n * the minimum uses an unsupported form — callers treat undefined as\n * \"cannot verify\" and fail closed for declared requirements.\n */\nexport function meetsMinimumDsh(host: string, minimum: string): boolean | undefined {\n const match = MINIMUM_RANGE_PATTERN.exec(minimum.trim())\n if (match === null) return undefined\n const compared = compareVersions(host, match[1])\n if (compared === undefined) return undefined\n return compared >= 0\n}\n\n/**\n * The bare minimum version for display: strips the `>=` operator (and an\n * optional leading `v`) from a declared requirement so UI copy that already\n * contains the comparison operator renders `0.1.1-rc.1` instead of\n * `>= >=0.1.1-rc.1`. Unsupported range forms render unchanged.\n * @param minimum - the declared minimum range.\n * @returns the version portion for display.\n */\nexport function displayMinimumVersion(minimum: string): string {\n const match = MINIMUM_RANGE_PATTERN.exec(minimum.trim())\n return match === null ? minimum.trim() : match[1].replace(/^v/, '')\n}\n\n/**\n * Read the declared DSH minimum from a published registry manifest:\n * `dsh.engines.dsh` first, top-level `engines.dsh` as the fallback.\n * Defensive against malformed or untrusted metadata: anything that is not a\n * non-empty string reads as absent.\n * @param manifest - the decoded registry version manifest.\n * @returns the declared minimum, or undefined when not declared.\n */\nexport function dshRequirementOf(manifest: { dsh?: unknown; engines?: unknown }): string | undefined {\n const dshEngines = (manifest.dsh as { engines?: unknown } | undefined)?.engines as { dsh?: unknown } | undefined\n const engines = (manifest.engines as { dsh?: unknown } | undefined)?.dsh\n const value = dshEngines?.dsh ?? engines\n return typeof value === 'string' && value.trim() !== '' ? value.trim() : undefined\n}\n","/**\n * The check-for-updates patch contributed to the official Plugins page.\n *\n * This package used to own a \"Plugin manager\" tab inside the Plugins settings\n * section (`settings.plugins.tab`). Installing, uninstalling, enabling and\n * disabling moved to the official plugin manager page long ago, and the tab's\n * remaining half (read-only inventory, install-conflict ledger, boot-failure\n * repair conversation, safe-mode banner) is UI no official page renders. It is\n * gone; the one capability the official page still lacks is comparing an\n * installed plugin against its registry source.\n *\n * So this package now contributes exactly that, into the seat the official\n * Plugins page declares for contributed sections (`plugins.detail.section`,\n * a root-scope list rendered on every bundle / row / official-plugin page with\n * the page's `subject`). The official page owns the page chrome; this entry\n * renders one compact block, only on an installed bundle's page, drawing only\n * a plain button and its own section so it carries no dependency on the\n * official primitives bundle.\n * @module @linxin666/dsh-client-ui-plugin-manager/client\n */\nimport { useEffect, useRef, useState } from 'react'\nimport type { InjectFace, PropsLocale, PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots'\nimport type { InstallProgressItem, PluginUpdateItem } from '../core/protocol.ts'\nimport { displayMinimumVersion } from '../core/version.ts'\nimport css from './plugin-manager.module.css'\n\n/** One loader row of a bundle, as the official page's subject carries it. */\nexport interface PluginPageRowRef {\n rowId: string\n moduleName: string\n enabled: boolean\n}\n\n/** One bundle, as the official page's subject carries it. */\nexport interface PluginPageBundleRef {\n name: string\n version?: string\n installed: boolean\n enabled: boolean\n rows: readonly PluginPageRowRef[]\n}\n\n/**\n * The subject the official Plugins page renders a contributed section with:\n * its bundle page, its row page, or an official plugin's page. This package\n * only speaks to the bundle case.\n */\nexport type PluginPageSubject =\n | { kind: 'bundle'; pkg: PluginPageBundleRef }\n | { kind: 'row'; pkg: PluginPageBundleRef; row: PluginPageRowRef }\n | { kind: 'item'; id: string }\n\ndeclare module '@deepseek-ai/dsh-client-ui-slots' {\n interface SlotMap {\n /**\n * One section contributed under a Plugins page's own content. Declared at\n * runtime by the official plugin-manager page's `main` registration; the\n * type is re-declared here, identically, so this package can register into\n * it without importing the page (the same way family plugins re-declare\n * `plugins.bundle.config`).\n */\n 'plugins.detail.section': {\n kind: 'list'\n scope: 'root'\n owner: { subject: PluginPageSubject }\n }\n }\n}\n\n/** Registration-side wire face the patch consumes. */\nexport interface PluginUpdatePatchInjected {\n /** Whether this browser has loopback authority to use the host routes. */\n isLoopback: boolean\n /** Compare every installed plugin against the version its source serves. */\n checkUpdates: () => Promise<PluginUpdateItem[]>\n /** Re-install one plugin from its recorded source. */\n update: (id: string) => Promise<unknown>\n /** Read the current install/update progress. */\n status: () => Promise<InstallProgressItem>\n}\n\n/** Full component props assembled by the Plugins page's section renderer. */\nexport type PluginUpdatePatchProps =\n PropsRuntime<'plugins.detail.section'>\n & PropsLocale<'settings.pluginManager'>\n & InjectFace<PluginUpdatePatchInjected>\n\n/** Error text for a caught request or lifecycle failure. */\nfunction messageOf(error: unknown): string {\n if (error instanceof AggregateError) {\n const details = error.errors.map(messageOf).join('; ')\n return details === '' ? error.message : `${error.message}: ${details}`\n }\n return error instanceof Error ? error.message : String(error)\n}\n\n/** Localized label for one install phase, with percent when the download has one. */\nfunction progressLabel(progress: InstallProgressItem, t: PluginUpdatePatchProps['t']): string {\n if (progress.stage === 'write') return t('writing')\n return progress.percent === undefined ? t('downloading') : t('downloadingPercent', { percent: String(progress.percent) })\n}\n\n/**\n * The update block on one official Plugins page: one check action, the verdict\n * for this page's bundle, and the update action it unlocks. The check is\n * explicit rather than automatic because one check reads every installed\n * plugin's registry manifest; a page visit must not fan that out.\n */\nexport function PluginUpdatePatch(props: PluginUpdatePatchProps) {\n const { t, subject, isLoopback, checkUpdates, update, status } = props\n\n const [checked, setChecked] = useState(false)\n const [found, setFound] = useState<PluginUpdateItem | undefined>(undefined)\n const [busy, setBusy] = useState<'check' | 'update' | undefined>(undefined)\n const [error, setError] = useState<string | undefined>(undefined)\n const [progress, setProgress] = useState<InstallProgressItem>({ kind: 'idle', stage: 'fetch' })\n const [dirty, setDirty] = useState(false)\n /** Synchronous in-flight mirror of `busy`: the render guard alone lets a click and an Enter land in the same frame and double-fire. */\n const busyRef = useRef(false)\n\n const name = subject.kind === 'bundle' ? subject.pkg.name : undefined\n const installed = subject.kind === 'bundle' && subject.pkg.installed\n\n /** Poll update progress while an update is in flight. */\n useEffect(() => {\n if (busy !== 'update') {\n setProgress({ kind: 'idle', stage: 'fetch' })\n return\n }\n let stopped = false\n let timer: ReturnType<typeof setTimeout> | undefined\n const tick = (delay: number): void => {\n timer = setTimeout(() => {\n void status().then(next => {\n if (!stopped && next !== undefined) {\n setProgress(next)\n tick(400)\n }\n }).catch(() => { /* polling fails silently; the update itself owns the error row */ })\n }, delay)\n }\n tick(100)\n return () => {\n stopped = true\n if (timer !== undefined) clearTimeout(timer)\n }\n }, [busy, status])\n\n if (name === undefined || !installed) return null\n\n const onCheck = (): void => {\n if (busyRef.current) return\n busyRef.current = true\n setBusy('check')\n setError(undefined)\n void checkUpdates().then(items => {\n setFound(items.find(item => item.id === name))\n setChecked(true)\n }).catch(reason => {\n setError(t('failed', { reason: messageOf(reason) }))\n }).finally(() => {\n busyRef.current = false\n setBusy(undefined)\n })\n }\n\n const onUpdate = (): void => {\n if (busyRef.current || found === undefined) return\n busyRef.current = true\n setBusy('update')\n setError(undefined)\n void update(found.id).then(() => {\n setFound(undefined)\n setChecked(false)\n setDirty(true)\n }).catch(reason => {\n setError(t('failed', { reason: messageOf(reason) }))\n }).finally(() => {\n busyRef.current = false\n setBusy(undefined)\n })\n }\n\n if (!isLoopback) {\n return (\n <section className={css.notice} data-update-patch data-state=\"local-only\">\n <strong>{t('localOnlyTitle')}</strong>\n <p>{t('localOnlyBody')}</p>\n </section>\n )\n }\n\n const requiresDsh = found?.requiresDsh\n const blocked = found?.compatible === false\n\n return (\n <section className={css.section} data-update-patch aria-busy={busy !== undefined}>\n <h3 className={css.title}>{t('updateSection')}</h3>\n <div className={css.actionRow}>\n <button\n type=\"button\"\n className={css.button}\n disabled={busy !== undefined}\n onClick={onCheck}\n >\n {busy === 'check' ? t('checking') : t('checkUpdates')}\n </button>\n {checked && found === undefined && busy === undefined && (\n <p className={css.ok}>{t('noUpdates')}</p>\n )}\n {found !== undefined && (\n <span className={css.latest} data-update-latest={found.latest}>{t('latest', { version: found.latest })}</span>\n )}\n {found !== undefined && requiresDsh !== undefined && (\n <span className={blocked ? css.compatBlocked : css.compatHint} data-update-compat={blocked ? 'blocked' : 'ok'}>\n {blocked\n ? t('updateBlockedDsh', { min: displayMinimumVersion(requiresDsh) })\n : t('updateRequiresDsh', { min: displayMinimumVersion(requiresDsh) })}\n </span>\n )}\n {found !== undefined && (\n <button\n type=\"button\"\n className={`${css.button} ${css.primary}`}\n disabled={busy !== undefined || blocked}\n onClick={onUpdate}\n >\n {busy === 'update' ? t('updating') : t('update')}\n </button>\n )}\n </div>\n\n {busy === 'update' && (\n <div className={css.progressRow} role=\"status\">\n <div className={css.progressTrack}>\n <div\n className={css.progressBar}\n style={progress.percent === undefined ? undefined : { width: `${String(progress.percent)}%` }}\n data-indeterminate={progress.percent === undefined ? 'true' : undefined}\n />\n </div>\n <p className={css.hint}>{progressLabel(progress, t)}</p>\n </div>\n )}\n\n {error !== undefined && (\n <p className={css.error} role=\"alert\" data-update-error>{error}</p>\n )}\n\n {dirty && (\n <div className={css.restartRow}>\n <p>{t('restartHint')}</p>\n </div>\n )}\n </section>\n )\n}\n","/**\n * Locale dictionaries for the plugin-manager's official-page patch. The zh\n * dictionary is the key source; the en dictionary mirrors the exact key set.\n *\n * The key set covers only what this package still renders: the\n * check-for-updates block on a bundle's page in the official Plugins panel.\n * The former tab's keys (inventory, conflicts, repair seeds, safe mode,\n * aggregate children) left with that tab.\n * @module @linxin666/dsh-client-ui-plugin-manager/client\n */\n\n/** Simplified Chinese copy (the key-set source of truth). */\nconst STATIC_ZH = {\n 'updateSection': '更新',\n 'checkUpdates': '检查更新',\n 'checking': '检查中…',\n 'noUpdates': '已是最新版本。',\n 'update': '更新',\n 'updating': '更新中…',\n 'latest': '最新 {version}',\n 'updateRequiresDsh': '需要 DSH ≥ {min}',\n 'updateBlockedDsh': '需要 DSH ≥ {min},请先升级 DSH 再更新',\n 'restartHint': '插件变更将在重启应用后生效。',\n 'failed': '操作失败:{reason}',\n 'fetching': '正在获取插件信息…',\n 'downloading': '正在下载…',\n 'downloadingPercent': '正在下载 {percent}%',\n 'extracting': '正在解压…',\n 'writing': '正在写入配置…',\n 'localOnlyTitle': '仅限本机操作',\n 'localOnlyBody': '为了保护主机配置,插件管理只能从本机打开。'\n} satisfies Record<string, string>\n\n/** English copy, checked complete against the zh key set. */\nconst STATIC_EN = {\n 'updateSection': 'Update',\n 'checkUpdates': 'Check for updates',\n 'checking': 'Checking…',\n 'noUpdates': 'The installed version is the latest.',\n 'update': 'Update',\n 'updating': 'Updating…',\n 'latest': 'Latest {version}',\n 'updateRequiresDsh': 'Requires DSH >= {min}',\n 'updateBlockedDsh': 'Requires DSH >= {min}; upgrade DSH before updating',\n 'restartHint': 'Plugin changes take effect after restarting the application.',\n 'failed': 'Operation failed: {reason}',\n 'fetching': 'Fetching plugin metadata…',\n 'downloading': 'Downloading…',\n 'downloadingPercent': 'Downloading {percent}%',\n 'extracting': 'Extracting…',\n 'writing': 'Writing configuration…',\n 'localOnlyTitle': 'Available on this computer only',\n 'localOnlyBody': 'To protect host configuration, plugin management is only available from a local browser.'\n} satisfies Record<keyof typeof STATIC_ZH, string>\n\nexport const zh = STATIC_ZH\nexport const en = STATIC_EN\nexport type PluginManagerKey = keyof typeof STATIC_ZH\n","/**\n * Wire parsing for the official plugin-installer / plugin-control RPC\n * channels. This package is a browser-side consumer of those channels: every\n * response is decoded but untrusted, so each parser validates the shape it\n * needs and throws a typed error on mismatch. Callers treat a parse failure\n * as \"channel unavailable or drifted\" and degrade to command hints.\n *\n * The shapes mirror the official web installer tab's wire protocol (see the\n * DSH checkout's packages/client/ui-settings-plugin-installer/src/client/\n * protocol.ts); they are a contract observation, not an import.\n * @module @linxin666/dsh-client-ui-plugin-manager/core\n */\n\n/** One loader entry row claimed by an installed bundle package (aggregate child). */\nexport interface InstalledPluginChild {\n /** The loader entry id, e.g. web-ui-pet. */\n id: string\n /** Display name: the real plugin package (shell config.plugin) when known. */\n name: string\n /** Effective next-start enablement of this row alone (bundle default plus user override). */\n enabled: boolean\n /** Rows the manager must never disable (the manager tab itself, the compat face). */\n locked?: boolean\n}\n\n/** One installed user-plugin row served by `/plugin-installer list`. */\nexport interface InstalledPluginItem {\n id: string\n name: string\n version: string\n source: { kind: 'npm' | 'git'; spec: string }\n installedAt: string\n /** Effective next-start enablement across the bundle's own rows and the managed profile patch row. */\n enabled: boolean\n commit?: string\n /**\n * Entry rows this package's bundle patch claims, present when the package\n * is an aggregate claiming more than one row (gateway mode only — the\n * official channel wire has no children). Child enablement is individually\n * switchable; uninstall stays whole-package (the code ships in one npm\n * package).\n */\n children?: InstalledPluginChild[]\n}\n\n/** Point-in-time install/update progress reported by the host. */\nexport interface InstallProgressItem {\n kind: 'idle' | 'install' | 'update'\n stage: 'fetch' | 'download' | 'extract' | 'write'\n percent?: number\n}\n\n/** Whether an update row is a normal same-name update or a legacy package migration. */\nexport type PluginUpdateKind = 'update' | 'migrate'\n\n/** One plugin with a newer version available. */\nexport interface PluginUpdateItem {\n id: string\n current: string\n latest: string\n /** Normal same-name update or legacy aggregate migration. Defaults to update. */\n kind?: PluginUpdateKind\n /** Target package name when kind is migrate. */\n target?: string\n /** Exact target package version when kind is migrate. */\n targetVersion?: string\n /** Declared DSH minimum the update needs (package manifest's `dsh.engines.dsh`). */\n requiresDsh?: string\n /** Whether the running DSH host satisfies requiresDsh; absent when unknown. */\n compatible?: boolean\n}\n\n/** One recorded plugin boot failure served by the host. */\nexport interface PluginFailureItem {\n /** Installed plugin id (package name); empty for unattributable failures. */\n pluginId: string\n kind: 'load-failure' | 'hang' | 'late-rejection'\n message: string\n stack: string\n installPath: string\n at: string\n}\n\n/** Recovery facts served by the host: the failure ring, the plugin root, and safe mode. */\nexport interface PluginFailuresSnapshot {\n items: PluginFailureItem[]\n /** Absolute plugin install root — the repair conversation's workspace. */\n pluginRoot: string\n /** Whether the host is running in safe mode (user plugins skipped). */\n safeMode: boolean\n}\n\n/** Whether a decoded value is a non-array object. */\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value)\n}\n\n/** Whether a decoded value is a string. */\nfunction isString(value: unknown): value is string {\n return typeof value === 'string'\n}\n\n/** Validate one aggregate child row. */\nfunction parsePluginChild(value: unknown, rowIndex: number, childIndex: number): InstalledPluginChild {\n if (!isRecord(value) || !isString(value.id) || !isString(value.name) || typeof value.enabled !== 'boolean') {\n throw new Error(`plugin-manager: plugin row ${String(rowIndex)} child ${String(childIndex)} is invalid`)\n }\n return {\n id: value.id,\n name: value.name,\n enabled: value.enabled,\n ...typeof value.locked === 'boolean' ? { locked: value.locked } : {},\n }\n}\n\n/** Validate one installed-plugin row. */\nfunction parsePlugin(value: unknown, index: number): InstalledPluginItem {\n if (!isRecord(value) || !isString(value.id) || !isString(value.name)\n || !isString(value.version) || !isString(value.installedAt)\n || typeof value.enabled !== 'boolean'\n || !isRecord(value.source) || (value.source.kind !== 'npm' && value.source.kind !== 'git')\n || !isString(value.source.spec)) {\n throw new Error(`plugin-manager: plugin row ${String(index)} is invalid`)\n }\n if (value.children !== undefined && !Array.isArray(value.children)) {\n throw new Error(`plugin-manager: plugin row ${String(index)} children is invalid`)\n }\n const children = (value.children as unknown[] | undefined)?.map((child, childIndex) => parsePluginChild(child, index, childIndex))\n return {\n id: value.id,\n name: value.name,\n version: value.version,\n source: { kind: value.source.kind, spec: value.source.spec },\n installedAt: value.installedAt,\n enabled: value.enabled,\n ...isString(value.commit) ? { commit: value.commit } : {},\n ...children !== undefined ? { children } : {},\n }\n}\n\n/**\n * Validate and normalize a `list` / `uninstall` response value.\n * @param value - decoded but untrusted response value.\n * @returns typed installed-plugin rows.\n */\nexport function parsePluginList(value: unknown): InstalledPluginItem[] {\n if (!isRecord(value) || !Array.isArray(value.plugins)) {\n throw new Error('plugin-manager: response must contain a plugins array')\n }\n return value.plugins.map((plugin, index) => parsePlugin(plugin, index))\n}\n\n/**\n * Validate and normalize an `install` / `update` / `set-enabled` response value.\n * @param value - decoded but untrusted response value.\n * @returns the typed installed-plugin row.\n */\nexport function parseInstalledPlugin(value: unknown): InstalledPluginItem {\n if (!isRecord(value) || value.plugin === undefined) {\n throw new Error('plugin-manager: response must contain a plugin row')\n }\n return parsePlugin(value.plugin, 0)\n}\n\n/**\n * Validate and normalize a `status` response value.\n * @param value - decoded but untrusted response value.\n * @returns the typed progress state.\n */\nexport function parseInstallStatus(value: unknown): InstallProgressItem {\n if (!isRecord(value) || !isRecord(value.progress)\n || (value.progress.kind !== 'idle' && value.progress.kind !== 'install' && value.progress.kind !== 'update')\n || (value.progress.stage !== 'fetch' && value.progress.stage !== 'download'\n && value.progress.stage !== 'extract' && value.progress.stage !== 'write')\n || (value.progress.percent !== undefined\n && (typeof value.progress.percent !== 'number' || !Number.isFinite(value.progress.percent)))) {\n throw new Error('plugin-manager: response must contain a valid progress state')\n }\n return {\n kind: value.progress.kind,\n stage: value.progress.stage,\n ...typeof value.progress.percent === 'number' ? { percent: value.progress.percent } : {},\n }\n}\n\n/**\n * Validate and normalize a `check-updates` response value.\n * @param value - decoded but untrusted response value.\n * @returns typed update rows.\n */\nexport function parseUpdateList(value: unknown): PluginUpdateItem[] {\n if (!isRecord(value) || !Array.isArray(value.updates)) {\n throw new Error('plugin-manager: response must contain an updates array')\n }\n return value.updates.map((update, index) => {\n if (!isRecord(update) || !isString(update.id) || !isString(update.current) || !isString(update.latest)) {\n throw new Error(`plugin-manager: update row ${String(index)} is invalid`)\n }\n const kind = update.kind === undefined ? 'update' : update.kind\n if (kind !== 'update' && kind !== 'migrate') {\n throw new Error(`plugin-manager: update row ${String(index)} is invalid`)\n }\n const row: PluginUpdateItem = { id: update.id, current: update.current, latest: update.latest }\n if (kind === 'migrate') {\n if (!isString(update.target) || !isString(update.targetVersion)) {\n throw new Error(`plugin-manager: update row ${String(index)} is invalid`)\n }\n row.kind = 'migrate'\n row.target = update.target\n row.targetVersion = update.targetVersion\n }\n if (update.requiresDsh !== undefined) {\n if (!isString(update.requiresDsh)) {\n throw new Error(`plugin-manager: update row ${String(index)} is invalid`)\n }\n row.requiresDsh = update.requiresDsh\n }\n if (update.compatible !== undefined) {\n if (typeof update.compatible !== 'boolean') {\n throw new Error(`plugin-manager: update row ${String(index)} is invalid`)\n }\n row.compatible = update.compatible\n }\n return row\n })\n}\n\n/**\n * Validate and normalize a `failures` response value.\n * @param value - decoded but untrusted response value.\n * @returns the typed failures snapshot.\n */\nexport function parseFailuresSnapshot(value: unknown): PluginFailuresSnapshot {\n if (!isRecord(value) || !Array.isArray(value.items)\n || !isString(value.pluginRoot) || typeof value.safeMode !== 'boolean') {\n throw new Error('plugin-manager: response must contain a failures snapshot')\n }\n return {\n items: value.items.map((item, index) => {\n if (!isRecord(item) || !isString(item.pluginId)\n || (item.kind !== 'load-failure' && item.kind !== 'hang' && item.kind !== 'late-rejection')\n || !isString(item.message) || !isString(item.stack)\n || !isString(item.installPath) || !isString(item.at)) {\n throw new Error(`plugin-manager: failure row ${String(index)} is invalid`)\n }\n return {\n pluginId: item.pluginId,\n kind: item.kind,\n message: item.message,\n stack: item.stack,\n installPath: item.installPath,\n at: item.at,\n }\n }),\n pluginRoot: value.pluginRoot,\n safeMode: value.safeMode,\n }\n}\n","/**\n * The cordis service contract this package exposes to sibling client plugins\n * under the name `'pluginManager'`. The browser half builds one dual-channel\n * face (official /plugin-installer + /plugin-control RPC channels when\n * available, else this package's loopback HTTP gateway) and provides it via\n * `ctx.provide('pluginManager', face)`; consumers resolve it with\n * `ctx.inject(['pluginManager'], cb)` and read `ctx.pluginManager`.\n *\n * The interface is intentionally narrower than the face the Plugin manager\n * tab receives (`PluginManagerFace` in the client half): it is the stable\n * cross-plugin surface, so it only carries the operations a sibling plugin\n * needs to observe and drive the installed-plugin set.\n * @module @linxin666/dsh-client-ui-plugin-manager/core\n */\n\nimport type { InstallProgressItem, InstalledPluginItem, PluginFailuresSnapshot } from './protocol.ts'\n\n/** The cordis service name the browser half provides the face under. */\nexport const PLUGIN_MANAGER_SERVICE = 'pluginManager'\n\n/**\n * The dual-channel plugin-management face, shared between the Plugin manager\n * tab and sibling client plugins.\n */\nexport interface PluginManagerService {\n /** Whether this browser has loopback authority to use the host routes. */\n readonly isLoopback: boolean\n /** Read the installed snapshot. */\n list(): Promise<InstalledPluginItem[]>\n /** Install one plugin from an npm spec or git URL. */\n install(spec: string): Promise<InstalledPluginItem>\n /** Remove one plugin. */\n uninstall(id: string): Promise<InstalledPluginItem[]>\n /** Read the current install/update progress. */\n status(): Promise<InstallProgressItem>\n /**\n * Read the recorded plugin boot-failure ring (plugin id, message, stack,\n * install path). On runtimes without a failure ring the host answers an\n * empty snapshot.\n */\n failures(): Promise<PluginFailuresSnapshot>\n /**\n * Flip one plugin's next-start enablement through the active channel (the\n * official installer RPC when available, else the loopback gateway's patch\n * `disabled` override row). The change takes effect after the host restart;\n * a running plugin is not stopped.\n */\n setEnabled(id: string, enabled: boolean): Promise<InstalledPluginItem>\n /**\n * Subscribe to successful mutations: the callback runs after install(),\n * update(), uninstall(), or setEnabled() resolves. One listener throwing\n * never breaks the others. Returns the unsubscribe function.\n */\n onChange(cb: () => void): () => void\n}\n\ndeclare module '@deepseek-ai/cordis' {\n interface Context {\n /** The plugin-manager face (provided by the dsh-plugin-manager client half). */\n pluginManager: PluginManagerService\n }\n}\n","// Generated by scripts/sync-shared.mjs from shared/client/telemetry.ts. Do not edit this copy; edit the shared source and run \"node scripts/sync-shared.mjs\".\n/**\n * Anonymous install telemetry shared by the DSH Web UI family plugins.\n *\n * Once per UTC day per browser, each wired plugin sends one heartbeat to\n * the dsh-market edge API listing its package name (and version when known).\n * The payload carries no conversation data and no identifiers beyond a random\n * UUID generated in localStorage; the server hashes it with a deployment salt\n * before storage and never persists IP addresses. Sends are fire-and-forget:\n * failures stay silent and simply retry on a later mount or day. The system\n * is documented in docs/telemetry.md.\n */\n\nexport type TelemetryChannel = 'market' | 'npm' | 'unknown'\n\nexport interface TelemetryItem {\n /** npm package name or asset id, e.g. \"@linxin666/dsh-pet\" or \"skin:harbor\". */\n name: string\n /** Installed version when known; omitted otherwise. */\n version?: string\n /** Install channel when determinable (market = Workshop install). */\n channel?: TelemetryChannel\n}\n\nconst VISITOR_KEY = 'dsh-web-ui-telemetry-visitor'\nconst DAY_KEY_PREFIX = 'dsh-web-ui-telemetry-day:'\nconst ENDPOINT = 'https://dsh-market.com/api/telemetry/event'\n\n// Baked into each client bundle by shared/tsdown.client.ts (the package's own\n// package.json version at build time). Undefined in dev/test builds.\ndeclare const __DSH_PKG_VERSION__: string | undefined\n\n/** The building package's version, when the bundle carries it. */\nfunction bakedVersion(): string | undefined {\n try {\n return typeof __DSH_PKG_VERSION__ === 'string' && __DSH_PKG_VERSION__ !== ''\n ? __DSH_PKG_VERSION__\n : undefined\n } catch {\n return undefined\n }\n}\n\n/** Read or lazily create the anonymous visitor id; null when storage is unavailable. */\nfunction visitorId(): string | null {\n try {\n const existing = localStorage.getItem(VISITOR_KEY)\n if (existing && /^[A-Za-z0-9_-]{16,64}$/.test(existing)) return existing\n const fresh = crypto.randomUUID().replaceAll('-', '')\n localStorage.setItem(VISITOR_KEY, fresh)\n return fresh\n } catch {\n // Storage unavailable (privacy mode, sandboxed frame): report nothing.\n return null\n }\n}\n\n/** Drop stale per-day dedup keys so localStorage does not grow forever. */\nfunction pruneDayKeys(today: string): void {\n try {\n for (let index = localStorage.length - 1; index >= 0; index -= 1) {\n const key = localStorage.key(index)\n if (key !== null && key.startsWith(DAY_KEY_PREFIX) && key !== DAY_KEY_PREFIX + today) {\n localStorage.removeItem(key)\n }\n }\n } catch { /* best effort */ }\n}\n\n/**\n * Fire the daily heartbeat for the given items at most once per UTC day per\n * browser. Never throws and never blocks the caller. Items without an explicit\n * version inherit the bundle's baked build version.\n */\nexport function reportDailyHeartbeat(items: readonly TelemetryItem[]): void {\n try {\n if (items.length === 0) return\n const today = new Date().toISOString().slice(0, 10)\n // Automation contexts (CDP-driven QA browsers, fresh isolated profiles)\n // mint a new visitor id per run and would inflate instance counts.\n if (navigator.webdriver) return\n if (localStorage.getItem(DAY_KEY_PREFIX + today) !== null) return\n const visitor = visitorId()\n if (visitor === null) return\n pruneDayKeys(today)\n const payloadItems = items.map((item) => {\n const out: Record<string, string> = { name: item.name }\n const version = item.version ?? bakedVersion()\n if (version !== undefined) out.version = version\n if (item.channel !== undefined) out.channel = item.channel\n return out\n })\n const body = JSON.stringify({ kind: 'heartbeat', visitor, items: payloadItems })\n void fetch(ENDPOINT, {\n method: 'POST',\n headers: { 'content-type': 'application/json' },\n body,\n keepalive: true,\n }).then((response) => {\n // Mark the day only after an accepted send, so offline browsers retry\n // on a later mount instead of going dark until tomorrow.\n if (response.ok) localStorage.setItem(DAY_KEY_PREFIX + today, '1')\n }).catch(() => { /* unreachable endpoint: stay silent */ })\n } catch { /* never break the host UI over telemetry */ }\n}\n","/**\n * Plugin-manager browser half: contributes the package's one remaining\n * surface — the check-for-updates block on the official Plugins page — and\n * provides the dual-channel face as the `'pluginManager'` cordis service for\n * sibling client plugins.\n *\n * It is dual-channel: on runtimes with the official installer services\n * (DSHCode, the 1.0.4 checkout web) every operation rides the official\n * `/plugin-installer` and `/plugin-control` loopback RPC channels (the single\n * writer); on the npm-published web runtime those channels do not exist, so the\n * same face falls back to this package's own loopback HTTP gateway, which\n * spawns the official CLI for writes. Neither the patch nor service consumers\n * know which mode the face runs in.\n *\n * The package used to register its own \"Plugin manager\" tab into the official\n * Plugins settings section (`settings.plugins.tab`). Installing, uninstalling\n * and enabling moved to the official page long ago, and the tab's remaining\n * half was UI no official page renders; the tab is gone and its one genuinely\n * missing capability — comparing an installed plugin against its registry\n * source, with the DSH-runtime compatibility gate — now renders inside the\n * official page through the `plugins.detail.section` seat it declares.\n * @module @linxin666/dsh-client-ui-plugin-manager/client\n */\n\n// Type-only: pulls the locale plugin's Context merge (ctx.locale).\nimport type {} from '@deepseek-ai/dsh-client-locale/client'\n// Type-only: pulls the renderer plugin's Context merge (ctx.slots, the\n// registry this package registers its contribution into).\nimport type {} from '@deepseek-ai/dsh-client-ui-renderer/client'\nimport type { Context as ClientContext } from '@deepseek-ai/cordis'\nimport type { ConnectionHandle } from '@deepseek-ai/dsh-client-connection/client'\nimport { PluginUpdatePatch, type PluginUpdatePatchInjected } from './PluginUpdatePatch.tsx'\nimport { en, zh, type PluginManagerKey } from './locales.ts'\nimport {\n parseFailuresSnapshot,\n parseInstallStatus,\n parseInstalledPlugin,\n parsePluginList,\n parseUpdateList,\n type InstalledPluginItem,\n type InstallProgressItem,\n type PluginFailuresSnapshot,\n type PluginUpdateItem,\n} from '../core/protocol.ts'\nimport { PLUGIN_MANAGER_SERVICE, type PluginManagerService } from '../core/service.ts'\nimport { reportDailyHeartbeat } from './telemetry.ts'\n\ndeclare module '@deepseek-ai/dsh-client-ui-slots' {\n interface LocaleNamespaceMap {\n /** Copy for the check-for-updates patch. */\n 'settings.pluginManager': PluginManagerKey\n }\n}\n\nconst NS = 'settings.pluginManager'\nconst CHANNEL = '/plugin-installer'\nconst LIST_ENDPOINT = 'list'\nconst INSTALL_ENDPOINT = 'install'\nconst UPDATE_ENDPOINT = 'update'\nconst UNINSTALL_ENDPOINT = 'uninstall'\nconst SET_ENABLED_ENDPOINT = 'set-enabled'\nconst CHECK_UPDATES_ENDPOINT = 'check-updates'\nconst STATUS_ENDPOINT = 'status'\nconst FAILURES_ENDPOINT = 'failures'\n\n// DOCUMENT-RELATIVE (issue #1707): the GUI is served with `<base href=\"./\">`,\n// so a sub-path deployment resolves the gateway prefix against its entry\n// directory rather than the origin root.\nconst GATEWAY_PREFIX = 'api/plugin-manager'\n/** Gateway job polling cadence. */\nconst JOB_POLL_MS = 500\n/** Gateway job wait ceiling (the host add deadline is six minutes). */\nconst JOB_WAIT_MS = 7 * 60_000\n\n/** Services required by the patch registration and both channels. */\nexport const inject = ['slots', 'locale', 'connection']\n\n/** The gateway job wire shape served by /status. */\ninterface GatewayJobWire {\n phase: 'running' | 'done' | 'error'\n plugin?: unknown\n error?: string\n}\n\n/**\n * The face the update patch and the `'pluginManager'` cordis service share:\n * the patch's wire surface plus the cross-plugin service contract. The gateway\n * host still records install conflicts and boot failures; no client surface\n * consumes either since the tab left, so neither is on this face.\n */\nexport type PluginManagerFace = PluginUpdatePatchInjected & PluginManagerService\n\n/**\n * Build the dual-channel face once: official-channel and gateway-channel\n * implementations, the mode detection that picks between them, and the\n * change-notification listener set. The returned face is both the update\n * patch's injected props and the value provided as the\n * `'pluginManager'` cordis service.\n * @param ctx - the client context (connection).\n * @returns the shared face.\n */\nexport function createPluginManagerFace(ctx: ClientContext): PluginManagerFace {\n const connection = ctx.get('connection') as ConnectionHandle\n\n // Official channel implementations.\n\n const call = async (endpoint: string, payload: unknown): Promise<unknown> => {\n const result = await connection.rpc.call(CHANNEL, endpoint, payload)\n if (!result.ok) {\n throw new Error(`plugin-installer ${endpoint} failed: ${result.error.code}: ${result.error.message}`)\n }\n return result.value\n }\n const official = {\n list: async (): Promise<InstalledPluginItem[]> => parsePluginList(await call(LIST_ENDPOINT, {})),\n install: async (spec: string): Promise<InstalledPluginItem> => parseInstalledPlugin(await call(INSTALL_ENDPOINT, { spec })),\n update: async (id: string): Promise<InstalledPluginItem> => parseInstalledPlugin(await call(UPDATE_ENDPOINT, { id })),\n uninstall: async (id: string): Promise<InstalledPluginItem[]> => parsePluginList(await call(UNINSTALL_ENDPOINT, { id })),\n setEnabled: async (id: string, enabled: boolean): Promise<InstalledPluginItem> =>\n parseInstalledPlugin(await call(SET_ENABLED_ENDPOINT, { id, enabled })),\n checkUpdates: async (): Promise<PluginUpdateItem[]> => parseUpdateList(await call(CHECK_UPDATES_ENDPOINT, {})),\n status: async (): Promise<InstallProgressItem> => parseInstallStatus(await call(STATUS_ENDPOINT, {})),\n failures: async (): Promise<PluginFailuresSnapshot> => parseFailuresSnapshot(await call(FAILURES_ENDPOINT, {})),\n }\n\n // Gateway channel implementations.\n\n const gatewayJson = async (path: string, init?: RequestInit): Promise<unknown> => {\n const response = await fetch(path, {\n ...init,\n headers: { 'content-type': 'application/json', ...init?.headers },\n })\n if (response.status === 403) {\n throw new Error('plugin-manager: plugin management is only available from a local browser')\n }\n if (!response.ok) {\n const body = await response.json().catch(() => ({})) as { error?: string }\n throw new Error(body.error ?? `plugin-manager: gateway ${path} failed: HTTP ${String(response.status)}`)\n }\n return response.json()\n }\n\n /** Wait for one gateway job to settle, returning its wire state. */\n const waitJob = async (jobId: string): Promise<GatewayJobWire> => {\n const deadline = Date.now() + JOB_WAIT_MS\n for (;;) {\n const body = await gatewayJson(`${GATEWAY_PREFIX}/status?job=${encodeURIComponent(jobId)}`) as { job?: GatewayJobWire }\n const job = body.job\n if (job === undefined) throw new Error('plugin-manager: gateway job vanished')\n if (job.phase === 'done') return job\n if (job.phase === 'error') throw new Error(job.error ?? 'plugin-manager: gateway job failed')\n if (Date.now() > deadline) throw new Error('plugin-manager: gateway job timed out')\n await new Promise(resolve => { setTimeout(resolve, JOB_POLL_MS) })\n }\n }\n\n /** Whether a gateway install/remove is in flight (drives the progress row). */\n let gatewayInflight = false\n\n const gateway = {\n list: async (): Promise<InstalledPluginItem[]> =>\n parsePluginList(await gatewayJson(`${GATEWAY_PREFIX}/list`)),\n install: async (spec: string): Promise<InstalledPluginItem> => {\n gatewayInflight = true\n try {\n const started = await gatewayJson(`${GATEWAY_PREFIX}/install`, {\n method: 'POST',\n body: JSON.stringify({ spec }),\n }) as { jobId?: string }\n if (started.jobId === undefined) throw new Error('plugin-manager: gateway install returned no job')\n const job = await waitJob(started.jobId)\n return parseInstalledPlugin({ plugin: job.plugin })\n } finally {\n gatewayInflight = false\n }\n },\n update: async (id: string): Promise<InstalledPluginItem> => {\n gatewayInflight = true\n try {\n const started = await gatewayJson(`${GATEWAY_PREFIX}/update`, {\n method: 'POST',\n body: JSON.stringify({ id }),\n }) as { jobId?: string }\n if (started.jobId === undefined) throw new Error('plugin-manager: gateway update returned no job')\n const job = await waitJob(started.jobId)\n return parseInstalledPlugin({ plugin: job.plugin })\n } finally {\n gatewayInflight = false\n }\n },\n uninstall: async (id: string): Promise<InstalledPluginItem[]> => {\n gatewayInflight = true\n try {\n const started = await gatewayJson(`${GATEWAY_PREFIX}/remove`, {\n method: 'POST',\n body: JSON.stringify({ id }),\n }) as { jobId?: string }\n if (started.jobId === undefined) throw new Error('plugin-manager: gateway remove returned no job')\n await waitJob(started.jobId)\n return gateway.list()\n } finally {\n gatewayInflight = false\n }\n },\n setEnabled: async (id: string, enabled: boolean): Promise<InstalledPluginItem> =>\n parseInstalledPlugin(await gatewayJson(`${GATEWAY_PREFIX}/set-enabled`, {\n method: 'POST',\n body: JSON.stringify({ id, enabled }),\n })),\n checkUpdates: async (): Promise<PluginUpdateItem[]> =>\n parseUpdateList(await gatewayJson(`${GATEWAY_PREFIX}/check-updates`)),\n status: async (): Promise<InstallProgressItem> =>\n gatewayInflight ? { kind: 'install', stage: 'download' } : { kind: 'idle', stage: 'fetch' },\n failures: async (): Promise<PluginFailuresSnapshot> =>\n parseFailuresSnapshot(await gatewayJson(`${GATEWAY_PREFIX}/failures`)),\n }\n\n // Mode selection.\n\n let modePromise: Promise<'official' | 'gateway'> | undefined\n const ensureMode = (): Promise<'official' | 'gateway'> => {\n if (modePromise === undefined) {\n modePromise = (async () => {\n // Prefer the host verdict: the gateway's /mode route reports whether\n // the official installer channels exist, so the direct channel probe\n // below (which 405s into the browser console on the npm web runtime)\n // only runs when the host half is absent or explicitly returns null\n // for a desktop runtime whose services are registered in-process.\n try {\n const mode = await gatewayJson(`${GATEWAY_PREFIX}/mode`) as { official?: boolean | null }\n if (mode.official === true) return 'official' as const\n if (mode.official === false) return 'gateway' as const\n } catch {\n // Host half absent (an official runtime without a boot profile):\n // fall back to the direct channel probe.\n }\n try {\n const result = await connection.rpc.call(CHANNEL, LIST_ENDPOINT, {})\n return result.ok ? 'official' as const : 'gateway' as const\n } catch {\n return 'gateway' as const\n }\n })()\n }\n return modePromise\n }\n\n // Change notification.\n\n /** Listeners subscribed through onChange; fired after successful mutations. */\n const listeners = new Set<() => void>()\n /** Notify every listener; one listener throwing never breaks the others. */\n const notifyChange = (): void => {\n for (const listener of [...listeners]) {\n try {\n listener()\n } catch {\n // A consumer's listener failure is its own; keep notifying the rest.\n }\n }\n }\n\n // The shared face.\n\n return {\n isLoopback: connection.isLoopback,\n list: async () => (await ensureMode()) === 'official' ? official.list() : gateway.list(),\n install: async spec => {\n const item = await ((await ensureMode()) === 'official' ? official.install(spec) : gateway.install(spec))\n notifyChange()\n return item\n },\n update: async id => {\n const item = await ((await ensureMode()) === 'official' ? official.update(id) : gateway.update(id))\n notifyChange()\n return item\n },\n uninstall: async id => {\n const rows = await ((await ensureMode()) === 'official' ? official.uninstall(id) : gateway.uninstall(id))\n notifyChange()\n return rows\n },\n setEnabled: async (id, enabled) => {\n const item = await ((await ensureMode()) === 'official' ? official.setEnabled(id, enabled) : gateway.setEnabled(id, enabled))\n notifyChange()\n return item\n },\n checkUpdates: async () => (await ensureMode()) === 'official' ? official.checkUpdates() : gateway.checkUpdates(),\n status: async () => (await ensureMode()) === 'official' ? official.status() : gateway.status(),\n failures: async () => (await ensureMode()) === 'official' ? official.failures() : gateway.failures(),\n onChange: cb => {\n listeners.add(cb)\n return () => { listeners.delete(cb) }\n },\n }\n}\n\n/** Contribute the check-for-updates patch and provide the shared face. */\nexport function apply(ctx: ClientContext): void {\n // Anonymous install heartbeat (docs/telemetry.md): one beat per browser per\n // UTC day, package name only, silent failure.\n reportDailyHeartbeat([{ name: '@linxin666/dsh-client-ui-plugin-manager' }])\n\n ctx.effect(() => {\n try {\n return ctx.locale.register(NS, { zh, en })\n } catch {\n return () => {}\n }\n }, 'plugin-manager: dictionaries')\n\n // Built once: the patch and the 'pluginManager' cordis service share one\n // face, so consumers observe exactly the mutations the patch performs.\n const face = createPluginManagerFace(ctx)\n try {\n if (!ctx.get(PLUGIN_MANAGER_SERVICE)) {\n ctx.provide(PLUGIN_MANAGER_SERVICE, face)\n }\n } catch {\n // ignore duplicate provide\n }\n\n // The official Plugins page declares this seat on its main-panel entry and\n // renders one section per contribution on each bundle / row / plugin page;\n // `inject` waits for that declaration, exactly like the family plugin cards\n // that register into `plugins.bundle.config`.\n ctx.slots.inject('plugins.detail.section', () => {\n try {\n return ctx.slots.register({\n name: 'plugins.detail.section',\n id: 'family-update-check',\n order: 30,\n locale: NS,\n inject: () => face,\n }, PluginUpdatePatch)\n } catch {\n return () => {}\n }\n })\n}\n"],"mappings":";;;;;;;;;EAyFA,MAAM,wBAAwB;;;;;;;;;EA2B9B,SAAgB,sBAAsB,SAAyB;GAC7D,MAAM,QAAQ,sBAAsB,KAAK,QAAQ,KAAK,CAAC;GACvD,OAAO,UAAU,OAAO,QAAQ,KAAK,IAAI,MAAM,EAAE,CAAC,QAAQ,MAAM,EAAE;EACpE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EC/BA,SAAS,UAAU,OAAwB;GACzC,IAAI,iBAAiB,gBAAgB;IACnC,MAAM,UAAU,MAAM,OAAO,IAAI,SAAS,CAAC,CAAC,KAAK,IAAI;IACrD,OAAO,YAAY,KAAK,MAAM,UAAU,GAAG,MAAM,QAAQ,IAAI;GAC/D;GACA,OAAO,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;EAC9D;;EAGA,SAAS,cAAc,UAA+B,GAAwC;GAC5F,IAAI,SAAS,UAAU,SAAS,OAAO,EAAE,SAAS;GAClD,OA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