dsh-local-link 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","names":["useRef","useState","useCallback"],"sources":["../src/locales/en.json","../src/locales/zh.json","../src/client.tsx"],"sourcesContent":["","","import React, { useCallback, useEffect, useRef, useState } from 'react'\nimport type { ClientContext } from '@deepseek-ai/dsh-client-runtime/client'\nimport type { PropsLocale, PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots'\nimport type {} from '@deepseek-ai/dsh-client-connection/client'\nimport type {} from '@deepseek-ai/dsh-client-locale/client'\nimport type {} from '@deepseek-ai/dsh-client-ui-settings/client'\nimport type {} from '@deepseek-ai/dsh-client-ui-sidebar/client'\nimport en from './locales/en.json' with { type: 'json' }\nimport zh from './locales/zh.json' with { type: 'json' }\n\nconst NS = 'dsh.localLink'\ntype LocaleKey = keyof typeof en\n\ndeclare module '@deepseek-ai/dsh-client-ui-slots' {\n interface LocaleNamespaceMap {\n 'dsh.localLink': LocaleKey\n }\n}\n\ndeclare global {\n interface Window {\n __DSH_LOCAL_LINK_AUTHENTICATED__?: boolean\n }\n}\n\ninterface Device {\n id: string\n name: string\n deviceType: string\n browser: string\n}\n\ninterface DevicePayload {\n id?: unknown\n name?: unknown\n deviceType?: unknown\n browser?: unknown\n label?: unknown\n}\n\ninterface StatusPayload {\n devices?: unknown\n}\n\ninterface Status {\n devices: Device[]\n}\n\ninterface DiagnosticEvent {\n id: string\n at: string\n level: 'warn' | 'error'\n code: string\n context?: Record<string, string | number | boolean>\n}\n\ninterface DiagnosticsPayload {\n events?: unknown\n}\n\ninterface Pairing {\n id: string\n url: string\n qrDataUrl: string\n expiresAt: string\n}\n\ninterface PairingState {\n status: 'active' | 'consumed' | 'expired' | 'unknown'\n}\n\ninterface PopoverPosition {\n left: number\n top: number\n}\n\ntype FooterProps = PropsRuntime<'sidebar.footer.action'> & PropsLocale<typeof NS>\ntype LocalLinkFooterProps = FooterProps & { readonly getCurrentSessionId: () => string | undefined }\n\nfunction desktopOrigin(): boolean {\n return location.hostname === 'localhost' || location.hostname === '127.0.0.1' || location.hostname === '::1'\n}\n\nfunction secondsUntil(iso: string): number {\n return Math.max(0, Math.ceil((Date.parse(iso) - Date.now()) / 1_000))\n}\n\nfunction formatCountdown(seconds: number): string {\n const minutes = Math.floor(seconds / 60)\n return `${minutes}:${String(seconds % 60).padStart(2, '0')}`\n}\n\nfunction payloadText(value: unknown, fallback: string): string {\n return typeof value === 'string' && value.trim() !== '' ? value : fallback\n}\n\nfunction legacyDeviceType(label: unknown): string {\n if (typeof label !== 'string') return 'Computer'\n if (/ipad|tablet/iu.test(label)) return 'Tablet'\n if (/iphone|android|mobile|phone|linux\\s+arm/iu.test(label)) return 'Phone'\n return 'Computer'\n}\n\nfunction normalizeDevices(payload: StatusPayload): Device[] {\n if (!Array.isArray(payload.devices)) return []\n return payload.devices.flatMap(value => {\n if (value === null || typeof value !== 'object' || Array.isArray(value)) return []\n const device = value as DevicePayload\n if (typeof device.id !== 'string') return []\n return [{\n id: device.id,\n name: payloadText(device.name, 'My device'),\n deviceType: payloadText(device.deviceType, legacyDeviceType(device.label)),\n browser: payloadText(device.browser, 'Browser'),\n }]\n })\n}\n\nfunction normalizeDiagnostics(payload: DiagnosticsPayload): DiagnosticEvent[] {\n if (!Array.isArray(payload.events)) return []\n return payload.events.flatMap(value => {\n if (value === null || typeof value !== 'object' || Array.isArray(value)) return []\n const event = value as Partial<DiagnosticEvent>\n if (typeof event.id !== 'string' || typeof event.at !== 'string' || typeof event.code !== 'string'\n || (event.level !== 'warn' && event.level !== 'error')) return []\n const context = event.context !== null && typeof event.context === 'object' && !Array.isArray(event.context)\n ? Object.fromEntries(Object.entries(event.context).filter((entry): entry is [string, string | number | boolean] => {\n const item = entry[1]\n return typeof item === 'string' || typeof item === 'number' || typeof item === 'boolean'\n }))\n : undefined\n return [{ id: event.id, at: event.at, level: event.level, code: event.code, ...(context === undefined ? {} : { context }) }]\n })\n}\n\nfunction openSettingsSection(label: string): void {\n const trigger = document.querySelector<HTMLButtonElement>('button[aria-haspopup=\"dialog\"][aria-expanded]')\n if (trigger === null) return\n trigger.click()\n let attempts = 0\n const selectSection = (): void => {\n const dialog = document.querySelector<HTMLElement>('[role=\"dialog\"]')\n const target = dialog === null ? undefined : [...dialog.querySelectorAll<HTMLButtonElement>('nav button')]\n .find(button => button.textContent?.trim() === label)\n if (target !== undefined) {\n target.click()\n return\n }\n attempts += 1\n if (attempts < 10) window.requestAnimationFrame(selectSection)\n }\n window.requestAnimationFrame(selectSection)\n}\n\nasync function jsonRequest<T>(path: string, init?: RequestInit): Promise<T> {\n const response = await fetch(path, {\n ...init,\n headers: { 'content-type': 'application/json', ...init?.headers },\n })\n const body = await response.json() as T & { error?: string }\n if (!response.ok) throw new Error(body.error ?? `HTTP ${response.status}`)\n return body\n}\n\nfunction reportActionError(code: 'CLIPBOARD_COPY_FAILED' | 'DEVICE_REVOKE_FAILED' | 'DEVICE_RENAME_FAILED'): void {\n void fetch('/__dsh-local-link/admin/diagnostics/event', {\n method: 'POST',\n headers: { 'content-type': 'application/json' },\n body: JSON.stringify({ code }),\n }).catch(() => undefined)\n}\n\nconst styles = `\n.dsh-local-link{box-sizing:border-box;width:100%;max-width:760px;padding:4px 4px 32px;color:var(--dsw-alias-label-primary,#16181d)}\n.dsh-local-link h2{margin:0 0 5px;font-size:20px}.dsh-local-link>p{margin:0;color:var(--dsw-alias-label-secondary,#66707c);line-height:1.5}\n.dsh-local-link button{display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;min-height:32px;padding:6px 10px;border:1px solid var(--dsw-alias-border-normal,#cbd2dc);border-radius:8px;background:transparent;color:inherit;font:600 12px/1.2 system-ui;cursor:pointer}.dsh-local-link button:hover{background:var(--dsw-alias-interactive-bg-hover,#e8ebef)}.dsh-local-link button:disabled{opacity:.55;cursor:wait}\n.dsh-local-link__devices{display:grid;margin-top:12px;border-block:1px solid var(--dsw-alias-border-subtle,#dce1e8)}.dsh-local-link__devices>p{margin:0;padding:12px 0;color:var(--dsw-alias-label-secondary,#66707c);line-height:1.45}.dsh-local-link__device{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:12px;padding:8px 0;border-top:1px solid var(--dsw-alias-border-subtle,#dce1e8)}.dsh-local-link__device:first-child{border-top:0}.dsh-local-link__device-info{display:grid;min-width:0;gap:2px}.dsh-local-link__device-info strong{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font:600 14px/1.25 system-ui}.dsh-local-link__device-info small{overflow:hidden;color:var(--dsw-alias-label-secondary,#66707c);font:12px/1.3 system-ui;text-overflow:ellipsis;white-space:nowrap}.dsh-local-link__device-actions{display:flex;gap:6px}.dsh-local-link__device-editor{display:grid;grid-column:1/-1;grid-template-columns:minmax(0,1fr) auto auto;align-items:center;gap:6px}.dsh-local-link__device-editor input{box-sizing:border-box;min-width:0;height:32px;padding:6px 9px;border:1px solid var(--dsw-alias-border-normal,#cbd2dc);border-radius:8px;background:var(--dsw-alias-bg-layer-2,#eef1f5);color:inherit;font:14px/1.2 system-ui;outline:none}.dsh-local-link__device-editor input:focus{border-color:var(--dsw-alias-border-focus,#2878ff)}@media(max-width:440px){.dsh-local-link__device{grid-template-columns:minmax(0,1fr) auto;gap:8px}.dsh-local-link__device-actions{gap:4px}.dsh-local-link button{padding-inline:8px}.dsh-local-link__device-editor{grid-template-columns:1fr auto}.dsh-local-link__device-editor input{grid-column:1/-1}}\n.dsh-local-link__diagnostics{margin-top:30px;overflow:hidden;border:1px solid var(--dsw-alias-border-l2,#45484d);border-radius:12px;background:var(--dsw-alias-bg-layer-3,#303236);transition:border-color .16s,background .16s}.dsh-local-link__diagnostics:hover{border-color:var(--dsw-alias-label-dimmed,#74777d)}.dsh-local-link__diagnostics[open]{border-color:var(--dsw-alias-label-dimmed,#74777d);background:var(--dsw-alias-bg-layer-2,#282a2e)}.dsh-local-link__diagnostics summary{display:flex;align-items:center;justify-content:space-between;gap:12px;width:100%;padding:14px 16px;box-sizing:border-box;cursor:pointer;list-style:none}.dsh-local-link__diagnostics summary::-webkit-details-marker{display:none}.dsh-local-link__diagnostics summary:focus-visible{outline:2px solid var(--dsw-alias-brand-primary,#2878ff);outline-offset:-2px}.dsh-local-link__diagnostics-summary-main,.dsh-local-link__diagnostics-summary-meta{display:flex;align-items:center;min-width:0}.dsh-local-link__diagnostics-summary-main{flex:1;gap:11px}.dsh-local-link__diagnostics-summary-meta{flex:none;gap:12px}.dsh-local-link__diagnostics-icon{display:grid;place-items:center;flex:none;width:34px;height:34px;border-radius:9px;background:color-mix(in srgb,var(--dsw-alias-brand-primary,#2878ff) 14%,transparent);color:var(--dsw-alias-brand-primary,#2878ff)}.dsh-local-link__diagnostics-copy{display:flex;flex:1;flex-direction:column;min-width:0;gap:4px}.dsh-local-link__diagnostics-copy strong{color:var(--dsw-alias-label-primary,#f2f3f5);font:600 15px/1.4 system-ui}.dsh-local-link__diagnostics-copy small{overflow:hidden;color:var(--dsw-alias-label-tertiary,#a6a8ad);font:13px/1.5 system-ui;text-overflow:ellipsis;white-space:nowrap}.dsh-local-link__diagnostics-badge{padding:0;color:var(--dsw-alias-label-tertiary,#a6a8ad);font:400 12px/1.3 system-ui;white-space:nowrap}.dsh-local-link__diagnostics-chevron{flex:none;color:var(--dsw-alias-label-tertiary,#a6a8ad);transition:transform .16s}.dsh-local-link__diagnostics[open] .dsh-local-link__diagnostics-chevron{transform:rotate(180deg)}.dsh-local-link__diagnostics-body{margin:0 16px;padding:12px 0 8px;border-top:1px solid var(--dsw-alias-border-l2,#45484d)}.dsh-local-link__diagnostics-body>p{margin:0 0 12px;color:var(--dsw-alias-label-tertiary,#a6a8ad);font:12px/1.5 system-ui}.dsh-local-link__diagnostics-actions{display:flex;flex-wrap:wrap;gap:6px;margin-bottom:12px}.dsh-local-link__diagnostic-list{display:grid;overflow:hidden;border:1px solid var(--dsw-alias-border-l2,#45484d);border-radius:9px;background:var(--dsw-alias-bg-layer-3,#303236)}.dsh-local-link__diagnostic{display:grid;grid-template-columns:auto minmax(0,1fr) auto;align-items:baseline;gap:8px;padding:8px 10px;border-top:1px solid var(--dsw-alias-border-l2,#45484d);font:12px/1.35 system-ui}.dsh-local-link__diagnostic:first-child{border-top:0}.dsh-local-link__diagnostic-level{width:7px;height:7px;border-radius:50%;background:#6b7280}.dsh-local-link__diagnostic-level--warn{background:#d28b15}.dsh-local-link__diagnostic-level--error{background:#dc4c4c}.dsh-local-link__diagnostic code{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font:600 11px/1.3 ui-monospace,SFMono-Regular,Consolas,monospace}.dsh-local-link__diagnostic time{color:var(--dsw-alias-label-tertiary,#a6a8ad);font-size:11px;white-space:nowrap}.dsh-local-link__diagnostic-context{grid-column:2/-1;overflow:hidden;color:var(--dsw-alias-label-tertiary,#a6a8ad);font:11px/1.35 ui-monospace,SFMono-Regular,Consolas,monospace;text-overflow:ellipsis;white-space:nowrap}@media(max-width:540px){.dsh-local-link__diagnostics-copy small{display:none}.dsh-local-link__diagnostics summary{padding-inline:12px}.dsh-local-link__diagnostics-badge{max-width:92px;overflow:hidden;text-overflow:ellipsis}}\n.dsh-local-link-footer{position:relative;width:100%;min-width:0}:where(div):has(> .dsh-local-link-footer),:where(div):has(> :where(div) > .dsh-local-link-footer){flex-direction:column;gap:4px}:where(div):has(> .dsh-local-link-footer)>.dsh-local-link-footer+:where(div){margin-block-start:0!important}.dsh-local-link-trigger{box-sizing:border-box;display:flex;align-items:center;gap:8px;width:calc(100% + 4px);height:42px;margin:0 -2px;padding:0 10px 0 8px;border:0;border-radius:12px;background:transparent;color:var(--dsw-alias-label-primary,#16181d);font:400 14px/22px inherit;cursor:pointer;overflow:hidden}.dsh-local-link-trigger:hover{background:var(--dsw-alias-interactive-bg-hover,#e8ebef)}.dsh-local-link-trigger--rail{justify-content:center;gap:0;width:36px;height:36px;margin:0;padding:0;border-radius:50%}.dsh-local-link-trigger__label{white-space:nowrap;overflow:hidden}\n.dsh-local-link-popover{position:fixed;z-index:10000;box-sizing:border-box;width:min(360px,calc(100vw - 24px));height:min(453px,calc(100vh - 24px));padding:16px;overflow:auto;overscroll-behavior:contain;border:1px solid var(--dsw-alias-border-subtle,#dce1e8);border-radius:14px;background:var(--dsw-alias-bg-layer-1,#fff);color:var(--dsw-alias-label-primary,#16181d);box-shadow:0 18px 55px #0004}.dsh-local-link-popover__header{display:flex;align-items:center;justify-content:space-between;gap:12px}.dsh-local-link-popover strong{font-size:15px}.dsh-local-link-popover__manage{flex:none;padding:4px 6px;border:0;border-radius:6px;background:transparent;color:var(--dsw-alias-label-secondary,#66707c);font:600 11px/1.2 system-ui;cursor:pointer}.dsh-local-link-popover__manage:hover{background:var(--dsw-alias-interactive-bg-hover,#e8ebef);color:inherit}.dsh-local-link-popover p{margin:8px 0;color:var(--dsw-alias-label-secondary,#66707c);font:13px/1.45 system-ui}.dsh-local-link-popover__qr{display:block;width:200px;height:200px;margin:12px auto 0;padding:7px;border-radius:12px;background:#fff;transition:opacity .2s,filter .2s}.dsh-local-link-popover__qr--expired{opacity:.3;filter:grayscale(1)}.dsh-local-link-popover__link{display:flex;align-items:stretch;min-width:0;height:40px;margin-top:12px;border:1px solid var(--dsw-alias-border-normal,#cbd2dc);border-radius:10px;overflow:hidden;background:var(--dsw-alias-bg-layer-2,#eef1f5)}.dsh-local-link-popover__link-value{position:relative;display:flex;align-items:center;flex:1;min-width:0;padding:0 8px 0 10px;overflow:hidden;white-space:nowrap;font:11px/1.4 ui-monospace,SFMono-Regular,Consolas,monospace;mask-image:linear-gradient(to right,#000 76%,transparent 98%);-webkit-mask-image:linear-gradient(to right,#000 76%,transparent 98%)}.dsh-local-link-popover__copy,.dsh-local-link-popover__regenerate{border:0;background:transparent;color:inherit;font:600 12px/1.2 system-ui;cursor:pointer}.dsh-local-link-popover__copy{min-width:76px;padding:0 11px;border-left:1px solid var(--dsw-alias-border-normal,#cbd2dc);transition:background .18s,color .18s}.dsh-local-link-popover__copy:hover,.dsh-local-link-popover__regenerate:hover{background:var(--dsw-alias-interactive-bg-hover,#e8ebef)}.dsh-local-link-popover__copy--copied{background:#16803a22;color:#39a85b}.dsh-local-link-popover__copy:disabled{opacity:.45;cursor:not-allowed}.dsh-local-link-popover__meta{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-top:9px;color:var(--dsw-alias-label-secondary,#66707c);font:11px/1.35 system-ui}.dsh-local-link-popover__regenerate{display:block;width:100%;min-height:38px;margin-top:10px;border:1px solid var(--dsw-alias-border-normal,#cbd2dc);border-radius:10px}.dsh-local-link-popover__error{color:#c53030!important}\n`\n\nfunction LocalLinkFooter({ wide, t, getCurrentSessionId }: LocalLinkFooterProps): React.JSX.Element | null {\n const desktop = desktopOrigin()\n const root = useRef<HTMLDivElement>(null)\n const popover = useRef<HTMLElement>(null)\n const [open, setOpen] = useState(false)\n const [popoverPosition, setPopoverPosition] = useState<PopoverPosition>()\n const [pairing, setPairing] = useState<Pairing>()\n const [remaining, setRemaining] = useState(0)\n const [copyState, setCopyState] = useState<'idle' | 'copied' | 'error'>('idle')\n const [error, setError] = useState(false)\n const copyReset = useRef<number | undefined>(undefined)\n\n const createLink = useCallback(async () => {\n setPairing(undefined)\n setRemaining(0)\n setCopyState('idle')\n setError(false)\n try {\n const nextPairing = await jsonRequest<Pairing>('/__dsh-local-link/admin/pairing', {\n method: 'POST',\n body: JSON.stringify({ sessionId: getCurrentSessionId() }),\n })\n setPairing(nextPairing)\n setRemaining(secondsUntil(nextPairing.expiresAt))\n } catch { setError(true) }\n }, [getCurrentSessionId])\n\n const copyLink = useCallback(async () => {\n if (pairing === undefined || remaining === 0) return\n try {\n await navigator.clipboard.writeText(pairing.url)\n setCopyState('copied')\n if (copyReset.current !== undefined) window.clearTimeout(copyReset.current)\n copyReset.current = window.setTimeout(() => setCopyState('idle'), 1_800)\n } catch {\n setCopyState('error')\n reportActionError('CLIPBOARD_COPY_FAILED')\n }\n }, [pairing, remaining])\n\n useEffect(() => {\n if (!open || pairing === undefined) return\n let disposed = false\n const update = (): void => setRemaining(secondsUntil(pairing.expiresAt))\n const check = async (): Promise<void> => {\n try {\n const result = await jsonRequest<PairingState>(`/__dsh-local-link/admin/pairing/status?id=${encodeURIComponent(pairing.id)}`)\n if (!disposed && result.status === 'consumed') setOpen(false)\n } catch { /* A transient status failure must not replace a still-visible invitation. */ }\n }\n update()\n void check()\n const countdownTimer = window.setInterval(update, 1_000)\n const statusTimer = window.setInterval(() => void check(), 2_000)\n return () => {\n disposed = true\n window.clearInterval(countdownTimer)\n window.clearInterval(statusTimer)\n }\n }, [open, pairing])\n\n useEffect(() => () => {\n if (copyReset.current !== undefined) window.clearTimeout(copyReset.current)\n }, [])\n\n useEffect(() => {\n if (!open) return\n const close = (event: PointerEvent): void => { if (!root.current?.contains(event.target as Node)) setOpen(false) }\n const escape = (event: KeyboardEvent): void => { if (event.key === 'Escape') setOpen(false) }\n document.addEventListener('pointerdown', close)\n window.addEventListener('keydown', escape)\n return () => {\n document.removeEventListener('pointerdown', close)\n window.removeEventListener('keydown', escape)\n }\n }, [open])\n\n useEffect(() => {\n if (!open) {\n setPopoverPosition(undefined)\n return\n }\n const position = (): void => {\n const anchorRect = root.current?.getBoundingClientRect()\n const popoverRect = popover.current?.getBoundingClientRect()\n if (anchorRect === undefined || popoverRect === undefined) return\n const viewportGutter = 12\n const preferredLeft = anchorRect.right + 20\n const left = preferredLeft + popoverRect.width <= window.innerWidth - viewportGutter\n ? preferredLeft\n : Math.max(viewportGutter, window.innerWidth - popoverRect.width - viewportGutter)\n const top = Math.max(viewportGutter, Math.round((window.innerHeight - popoverRect.height) / 2))\n setPopoverPosition({ left: Math.round(left), top })\n }\n const frame = window.requestAnimationFrame(position)\n const observer = new ResizeObserver(position)\n if (popover.current !== null) observer.observe(popover.current)\n window.addEventListener('resize', position)\n return () => {\n window.cancelAnimationFrame(frame)\n observer.disconnect()\n window.removeEventListener('resize', position)\n }\n }, [open])\n\n if (!desktop) return null\n return <div className=\"dsh-local-link-footer\" ref={root}>\n <button className={`dsh-local-link-trigger${wide ? '' : ' dsh-local-link-trigger--rail'}`} type=\"button\" title={t('footer.trigger')} aria-label={t('footer.trigger')} aria-expanded={open} onClick={() => {\n const next = !open\n setOpen(next)\n if (next) void createLink()\n }}>\n <svg aria-hidden=\"true\" width={wide ? 16 : 18} height={wide ? 16 : 18} viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.8\"><rect x=\"5\" y=\"2.5\" width=\"14\" height=\"19\" rx=\"2.5\"/><path d=\"M9 5.5h6M11 18.5h2\"/></svg>\n {wide && <span className=\"dsh-local-link-trigger__label\">{t('footer.trigger')}</span>}\n </button>\n {open && <section className=\"dsh-local-link-popover\" ref={popover} style={popoverPosition ?? { visibility: 'hidden' }} aria-label={t('connect.title')}>\n <div className=\"dsh-local-link-popover__header\">\n <strong>{t('connect.title')}</strong>\n <button className=\"dsh-local-link-popover__manage\" type=\"button\" onClick={() => { setOpen(false); openSettingsSection(t('nav')) }}>{t('connect.pairedDevices')}</button>\n </div>\n <p>{t('connect.description')}</p>\n {!pairing && !error && <p>{t('connect.creating')}</p>}\n {error && <p className=\"dsh-local-link-popover__error\">{t('connect.error')}</p>}\n {pairing && <>\n <img className={`dsh-local-link-popover__qr${remaining === 0 ? ' dsh-local-link-popover__qr--expired' : ''}`} src={pairing.qrDataUrl} alt={t('connect.qrAlt')} />\n <div className=\"dsh-local-link-popover__link\" aria-label={t('connect.linkLabel')}>\n <code className=\"dsh-local-link-popover__link-value\" title={pairing.url}>{pairing.url}</code>\n <button className={`dsh-local-link-popover__copy${copyState === 'copied' ? ' dsh-local-link-popover__copy--copied' : ''}`} disabled={remaining === 0} type=\"button\" onClick={() => void copyLink()}>{copyState === 'copied' ? t('connect.copied') : t('connect.copy')}</button>\n </div>\n {copyState === 'error' && <p className=\"dsh-local-link-popover__error\">{t('connect.copyError')}</p>}\n <div className=\"dsh-local-link-popover__meta\">\n <span>{t('connect.oneDevice')}</span>\n <span>{remaining === 0 ? t('connect.expired') : `${t('connect.expiresIn')} ${formatCountdown(remaining)}`}</span>\n </div>\n <button className=\"dsh-local-link-popover__regenerate\" type=\"button\" onClick={() => void createLink()}>{t('connect.regenerate')}</button>\n </>}\n </section>}\n </div>\n}\n\nfunction LocalLinkSettings({ t }: PropsLocale<typeof NS>): React.JSX.Element {\n const [status, setStatus] = useState<Status>()\n const [diagnostics, setDiagnostics] = useState<DiagnosticEvent[]>()\n const [busyId, setBusyId] = useState<string>()\n const [editingId, setEditingId] = useState<string>()\n const [draftName, setDraftName] = useState('')\n const [error, setError] = useState(false)\n const [diagnosticsError, setDiagnosticsError] = useState(false)\n const [diagnosticsBusy, setDiagnosticsBusy] = useState(false)\n const [reportState, setReportState] = useState<'idle' | 'copied' | 'error'>('idle')\n\n const loadDevices = useCallback(async () => {\n try {\n const payload = await jsonRequest<StatusPayload>('/__dsh-local-link/admin/devices')\n setStatus({ devices: normalizeDevices(payload) })\n setError(false)\n } catch { setError(true) }\n }, [])\n\n const loadDiagnostics = useCallback(async () => {\n try {\n const payload = await jsonRequest<DiagnosticsPayload>('/__dsh-local-link/admin/diagnostics')\n setDiagnostics(normalizeDiagnostics(payload))\n setDiagnosticsError(false)\n } catch { setDiagnosticsError(true) }\n }, [])\n\n useEffect(() => { void loadDevices(); void loadDiagnostics() }, [loadDevices, loadDiagnostics])\n\n const revoke = async (id: string): Promise<void> => {\n setBusyId(id)\n try {\n await jsonRequest('/__dsh-local-link/admin/revoke', { method: 'POST', body: JSON.stringify({ id }) })\n await loadDevices()\n } catch {\n setError(true)\n reportActionError('DEVICE_REVOKE_FAILED')\n }\n finally { setBusyId(undefined) }\n }\n\n const rename = async (id: string): Promise<void> => {\n setBusyId(id)\n try {\n await jsonRequest('/__dsh-local-link/admin/rename', { method: 'POST', body: JSON.stringify({ id, name: draftName }) })\n setEditingId(undefined)\n await loadDevices()\n } catch {\n setError(true)\n reportActionError('DEVICE_RENAME_FAILED')\n }\n finally { setBusyId(undefined) }\n }\n\n const copyDiagnostics = async (): Promise<void> => {\n try {\n await navigator.clipboard.writeText(JSON.stringify({\n schemaVersion: 1,\n exportedAt: new Date().toISOString(),\n events: diagnostics ?? [],\n }, null, 2))\n setReportState('copied')\n } catch { setReportState('error') }\n }\n\n const clearDiagnostics = async (): Promise<void> => {\n if (!window.confirm(t('diagnostics.clearConfirm'))) return\n setDiagnosticsBusy(true)\n try {\n await jsonRequest('/__dsh-local-link/admin/diagnostics/clear', { method: 'POST', body: '{}' })\n setDiagnostics([])\n setDiagnosticsError(false)\n setReportState('idle')\n } catch { setDiagnosticsError(true) }\n finally { setDiagnosticsBusy(false) }\n }\n\n return <section className=\"dsh-local-link\">\n <h2>{t('devices.title')}</h2>\n <p>{t('devices.description')}</p>\n <div className=\"dsh-local-link__devices\" role=\"list\">\n {error ? <p>{t('devices.error')}</p> : status === undefined ? <p>{t('devices.loading')}</p> : status.devices.length ? status.devices.map(device => <div className=\"dsh-local-link__device\" key={device.id} role=\"listitem\">\n {editingId === device.id ? <div className=\"dsh-local-link__device-editor\">\n <input autoFocus aria-label={t('devices.nameLabel')} maxLength={64} value={draftName} onChange={event => setDraftName(event.target.value)} onKeyDown={event => { if (event.key === 'Enter') void rename(device.id); if (event.key === 'Escape') setEditingId(undefined) }} />\n <button disabled={busyId !== undefined} type=\"button\" onClick={() => void rename(device.id)}>{busyId === device.id ? t('devices.saving') : t('devices.save')}</button>\n <button disabled={busyId !== undefined} type=\"button\" onClick={() => setEditingId(undefined)}>{t('devices.cancel')}</button>\n </div> : <>\n <div className=\"dsh-local-link__device-info\"><strong>{device.name}</strong><small>{device.deviceType} · {device.browser}</small></div>\n <div className=\"dsh-local-link__device-actions\">\n <button disabled={busyId !== undefined} type=\"button\" onClick={() => { setEditingId(device.id); setDraftName(device.name) }}>{t('devices.rename')}</button>\n <button disabled={busyId !== undefined} type=\"button\" onClick={() => void revoke(device.id)}>{busyId === device.id ? t('devices.revoking') : t('devices.revoke')}</button>\n </div>\n </>}\n </div>) : <p>{t('devices.empty')}</p>}\n </div>\n <details className=\"dsh-local-link__diagnostics\">\n <summary>\n <span className=\"dsh-local-link__diagnostics-summary-main\">\n <span className=\"dsh-local-link__diagnostics-icon\" aria-hidden=\"true\">\n <svg width=\"18\" height=\"18\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.8\" strokeLinecap=\"round\" strokeLinejoin=\"round\"><path d=\"M3 12h4l2.2-6 4.2 12 2.1-6H21\"/></svg>\n </span>\n <span className=\"dsh-local-link__diagnostics-copy\">\n <strong>{t('diagnostics.title')}</strong>\n <small>{t('diagnostics.subtitle')}</small>\n </span>\n </span>\n <span className=\"dsh-local-link__diagnostics-summary-meta\">\n <span className=\"dsh-local-link__diagnostics-badge\">{diagnosticsError ? t('diagnostics.unavailable') : diagnostics === undefined ? t('diagnostics.loading') : `${diagnostics.length} ${t('diagnostics.events')}`}</span>\n <svg className=\"dsh-local-link__diagnostics-chevron\" aria-hidden=\"true\" width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\"><path d=\"m6 9 6 6 6-6\"/></svg>\n </span>\n </summary>\n <div className=\"dsh-local-link__diagnostics-body\">\n <p>{t('diagnostics.description')}</p>\n <div className=\"dsh-local-link__diagnostics-actions\">\n <button disabled={diagnosticsBusy} type=\"button\" onClick={() => void loadDiagnostics()}>{t('diagnostics.refresh')}</button>\n <button disabled={diagnosticsBusy || diagnostics === undefined} type=\"button\" onClick={() => void copyDiagnostics()}>{reportState === 'copied' ? t('diagnostics.copied') : t('diagnostics.copy')}</button>\n <button disabled={diagnosticsBusy || diagnostics === undefined || diagnostics.length === 0} type=\"button\" onClick={() => void clearDiagnostics()}>{diagnosticsBusy ? t('diagnostics.clearing') : t('diagnostics.clear')}</button>\n </div>\n {reportState === 'error' && <p>{t('diagnostics.copyError')}</p>}\n {diagnosticsError ? <p>{t('diagnostics.error')}</p> : diagnostics === undefined ? <p>{t('diagnostics.loading')}</p> : diagnostics.length === 0 ? <p>{t('diagnostics.empty')}</p> : <div className=\"dsh-local-link__diagnostic-list\" role=\"list\">\n {diagnostics.slice(0, 12).map(event => <div className=\"dsh-local-link__diagnostic\" key={event.id} role=\"listitem\">\n <span className={`dsh-local-link__diagnostic-level dsh-local-link__diagnostic-level--${event.level}`} title={event.level} />\n <code>{event.code}</code>\n <time dateTime={event.at}>{new Date(event.at).toLocaleTimeString()}</time>\n {event.context !== undefined && <span className=\"dsh-local-link__diagnostic-context\" title={JSON.stringify(event.context)}>{Object.entries(event.context).map(([key, value]) => `${key}=${String(value)}`).join(' · ')}</span>}\n </div>)}\n </div>}\n </div>\n </details>\n </section>\n}\n\nexport const inject = ['connection', 'slots', 'locale', 'sessions']\n\nexport function apply(ctx: ClientContext): void {\n ctx.effect(() => ctx.locale.register(NS, { en, zh }), 'dsh-local-link: locale dictionaries')\n\n ctx.effect(() => {\n if (window.__DSH_LOCAL_LINK_AUTHENTICATED__ !== true) return () => undefined\n const connection = ctx.get('connection') as { isLoopback: boolean }\n const previous = connection.isLoopback\n connection.isLoopback = true\n return () => { connection.isLoopback = previous }\n }, 'dsh-local-link: paired gateway trust hint')\n\n ctx.effect(() => {\n const style = document.createElement('style')\n style.dataset.plugin = 'dsh-local-link'\n style.textContent = styles\n document.head.append(style)\n return () => style.remove()\n }, 'dsh-local-link: interface styles')\n\n ctx.effect(() => {\n const getCurrentSessionId = (): string | undefined => ctx.sessions.list.getSnapshot().current\n const Footer = (props: FooterProps): React.JSX.Element => <LocalLinkFooter {...props} getCurrentSessionId={getCurrentSessionId} />\n return ctx.slots.inject('sidebar.footer.action', () => ctx.slots.register({\n name: 'sidebar.footer.action',\n id: 'local-link-connect',\n order: -10,\n locale: NS,\n }, Footer))\n }, 'dsh-local-link: sidebar connection action')\n\n ctx.effect(() => {\n if (!desktopOrigin()) return () => undefined\n return ctx.slots.inject('settings.section', () => ctx.slots.register({\n name: 'settings.section',\n id: 'local-access-devices',\n order: 12,\n label: () => ctx.locale.bind(NS)('nav'),\n locale: NS,\n }, LocalLinkSettings))\n }, 'dsh-local-link: paired devices settings')\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EEUA,MAAM,KAAK;EAqEX,SAAS,gBAAyB;GAChC,OAAO,SAAS,aAAa,eAAe,SAAS,aAAa,eAAe,SAAS,aAAa;EACzG;EAEA,SAAS,aAAa,KAAqB;GACzC,OAAO,KAAK,IAAI,GAAG,KAAK,MAAM,KAAK,MAAM,GAAG,IAAI,KAAK,IAAI,KAAK,GAAK,CAAC;EACtE;EAEA,SAAS,gBAAgB,SAAyB;GAEhD,OAAO,GADS,KAAK,MAAM,UAAU,EACrB,EAAE,GAAG,OAAO,UAAU,EAAE,CAAC,CAAC,SAAS,GAAG,GAAG;EAC3D;EAEA,SAAS,YAAY,OAAgB,UAA0B;GAC7D,OAAO,OAAO,UAAU,YAAY,MAAM,KAAK,MAAM,KAAK,QAAQ;EACpE;EAEA,SAAS,iBAAiB,OAAwB;GAChD,IAAI,OAAO,UAAU,UAAU,OAAO;GACtC,IAAI,gBAAgB,KAAK,KAAK,GAAG,OAAO;GACxC,IAAI,4CAA4C,KAAK,KAAK,GAAG,OAAO;GACpE,OAAO;EACT;EAEA,SAAS,iBAAiB,SAAkC;GAC1D,IAAI,CAAC,MAAM,QAAQ,QAAQ,OAAO,GAAG,OAAO,CAAC;GAC7C,OAAO,QAAQ,QAAQ,SAAQ,UAAS;IACtC,IAAI,UAAU,QAAQ,OAAO,UAAU,YAAY,MAAM,QAAQ,KAAK,GAAG,OAAO,CAAC;IACjF,MAAM,SAAS;IACf,IAAI,OAAO,OAAO,OAAO,UAAU,OAAO,CAAC;IAC3C,OAAO,C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A;IAAI,IAAA;GAAG,CAAC,GAAG,qCAAqC;GAE3F,IAAI,aAAa;IACf,IAAI,OAAO,qCAAqC,MAAM,aAAa,KAAA;IACnE,MAAM,aAAa,IAAI,IAAI,YAAY;IACvC,MAAM,WAAW,WAAW;IAC5B,WAAW,aAAa;IACxB,aAAa;KAAE,WAAW,aAAa;IAAS;GAClD,GAAG,2CAA2C;GAE9C,IAAI,aAAa;IACf,MAAM,QAAQ,SAAS,cAAc,OAAO;IAC5C,MAAM,QAAQ,SAAS;IACvB,MAAM,cAAc;IACpB,SAAS,KAAK,OAAO,KAAK;IAC1B,aAAa,MAAM,OAAO;GAC5B,GAAG,kCAAkC;GAErC,IAAI,aAAa;IACf,MAAM,4BAAgD,IAAI,SAAS,KAAK,YAAY,CAAC,CAAC;IACtF,MAAM,UAAU,UAA0C,sBAAA,QAAA,cAAC,iBAAD;KAAiB,GAAI;KAA4B;IAAsB,CAAA;IACjI,OAAO,IAAI,MAAM,OAAO,+BAA+B,IAAI,MAAM,SAAS;KACxE,MAAM;KACN,IAAI;KACJ,OAAO;KACP,QAAQ;IACV,GAAG,MAAM,CAAC;GACZ,GAAG,2CAA2C;GAE9C,IAAI,aAAa;IACf,IAAI,CAAC,cAAc,GAAG,aAAa,KAAA;IACnC,OAAO,IAAI,MAAM,OAAO,0BAA0B,IAAI,MAAM,SAAS;KACnE,MAAM;KACN,IAAI;KACJ,OAAO;KACP,aAAa,IAAI,OAAO,KAAK,EAAE,CAAC,CAAC,KAAK;KACtC,QAAQ;IACV,GAAG,iBAAiB,CAAC;GACvB,GAAG,yCAAyC;EAC9C"}
@@ -0,0 +1,137 @@
1
+ import z from "@deepseek-ai/schemastery";
2
+ import { Context } from "@deepseek-ai/cordis";
3
+ //#region src/config.d.ts
4
+ type AccessMode = 'pairing' | 'trusted-lan';
5
+ interface PluginConfig {
6
+ listenHost?: string;
7
+ listenPort?: number;
8
+ upstreamOrigin?: string;
9
+ accessMode?: AccessMode;
10
+ pairingTtlSeconds?: number;
11
+ deviceTtlDays?: number;
12
+ diagnosticsEnabled?: boolean;
13
+ diagnosticsMaxEntries?: number;
14
+ diagnosticsFile?: string;
15
+ stateFile: string;
16
+ }
17
+ interface ResolvedConfig {
18
+ readonly listenHost: string;
19
+ readonly listenPort: number;
20
+ readonly upstreamOrigin: URL;
21
+ readonly accessMode: AccessMode;
22
+ readonly pairingTtlMs: number;
23
+ readonly deviceTtlMs: number;
24
+ readonly diagnosticsEnabled: boolean;
25
+ readonly diagnosticsMaxEntries: number;
26
+ readonly diagnosticsFile: string;
27
+ readonly stateFile: string;
28
+ }
29
+ declare const Config: z<PluginConfig>;
30
+ declare function parseConfig(value: PluginConfig): ResolvedConfig;
31
+ //#endregion
32
+ //#region src/plugin.d.ts
33
+ declare const name = "dsh-local-link";
34
+ declare const inject: string[];
35
+ declare function apply(ctx: Context, config: PluginConfig): Promise<void>;
36
+ //#endregion
37
+ //#region src/auth/device-store.d.ts
38
+ interface DeviceView {
39
+ readonly id: string;
40
+ readonly name: string;
41
+ readonly deviceType: string;
42
+ readonly browser: string;
43
+ readonly createdAt: string;
44
+ readonly lastSeenAt: string;
45
+ }
46
+ declare class DeviceStore {
47
+ private readonly file;
48
+ private readonly ttlMs;
49
+ private devices;
50
+ private loaded;
51
+ private writeTail;
52
+ constructor(file: string, ttlMs: number);
53
+ load(): Promise<void>;
54
+ list(): DeviceView[];
55
+ add(metadata: unknown): Promise<{
56
+ readonly device: DeviceView;
57
+ readonly token: string;
58
+ }>;
59
+ authorize(credential: string | undefined): DeviceView | undefined;
60
+ revoke(id: string): Promise<boolean>;
61
+ renameDevice(id: string, name: unknown): Promise<DeviceView | undefined>;
62
+ private persist;
63
+ }
64
+ //#endregion
65
+ //#region src/auth/pairing.d.ts
66
+ type PairingStatus = 'active' | 'consumed' | 'expired' | 'unknown';
67
+ declare class PairingTokens {
68
+ private readonly ttlMs;
69
+ private current;
70
+ constructor(ttlMs: number);
71
+ issue(now?: number): {
72
+ readonly id: string;
73
+ readonly token: string;
74
+ readonly expiresAt: string;
75
+ };
76
+ consume(token: unknown, now?: number): boolean;
77
+ getStatus(id: unknown, now?: number): PairingStatus;
78
+ }
79
+ //#endregion
80
+ //#region src/gateway/html.d.ts
81
+ /**
82
+ * Mark the proxied page as authenticated and make Settings wait for our client
83
+ * trust adapter. The rest of the stock Harness graph remains byte-for-byte the
84
+ * same JSON data.
85
+ */
86
+ declare function rewriteAuthenticatedIndex(html: string): string;
87
+ //#endregion
88
+ //#region src/diagnostics.d.ts
89
+ type DiagnosticLevel = 'warn' | 'error';
90
+ type DiagnosticCode = 'PAIRING_GENERATION_FAILED' | 'PAIRING_REJECTED' | 'PAIRING_INVALID' | 'REQUEST_REJECTED' | 'AUTH_REQUIRED' | 'HTTP_UPSTREAM_ERROR' | 'INDEX_REWRITE_ERROR' | 'WS_REJECTED' | 'WS_UPSTREAM_ERROR' | 'CLIPBOARD_COPY_FAILED' | 'DEVICE_REVOKE_FAILED' | 'DEVICE_RENAME_FAILED' | 'DIAGNOSTICS_STATE_RESET';
91
+ type DiagnosticValue = string | number | boolean;
92
+ interface DiagnosticEvent {
93
+ readonly id: string;
94
+ readonly at: string;
95
+ readonly level: DiagnosticLevel;
96
+ readonly code: DiagnosticCode;
97
+ readonly context?: Readonly<Record<string, DiagnosticValue>>;
98
+ }
99
+ //#endregion
100
+ //#region src/gateway/local-gateway.d.ts
101
+ declare class LocalGateway {
102
+ readonly config: ResolvedConfig;
103
+ private readonly devices;
104
+ private readonly pairing;
105
+ private readonly diagnostics;
106
+ private readonly upgradedSockets;
107
+ private server;
108
+ private addresses;
109
+ constructor(config: ResolvedConfig);
110
+ start(): Promise<void>;
111
+ pairedDevices(): readonly DeviceView[];
112
+ issuePairing(sessionId?: string): {
113
+ readonly id: string;
114
+ readonly url: string;
115
+ readonly expiresAt: string;
116
+ };
117
+ pairingStatus(id: unknown): PairingStatus;
118
+ diagnosticEvents(): readonly DiagnosticEvent[];
119
+ clearDiagnostics(): Promise<void>;
120
+ recordActionError(code: Extract<DiagnosticCode, 'PAIRING_GENERATION_FAILED' | 'CLIPBOARD_COPY_FAILED' | 'DEVICE_REVOKE_FAILED' | 'DEVICE_RENAME_FAILED'>): void;
121
+ revoke(id: string): Promise<boolean>;
122
+ renameDevice(id: string, name: unknown): Promise<DeviceView | undefined>;
123
+ close(): Promise<void>;
124
+ private requestTrusted;
125
+ private authorized;
126
+ private handle;
127
+ private proxyHttp;
128
+ private proxyWebSocket;
129
+ }
130
+ //#endregion
131
+ //#region src/network.d.ts
132
+ declare function isPrivateAddress(input: string | undefined): boolean;
133
+ declare function privateInterfaceAddresses(): string[];
134
+ declare function allowedGatewayHost(value: string | undefined, listenHost: string, listenPort: number, addresses: readonly string[]): boolean;
135
+ //#endregion
136
+ export { type AccessMode, Config, DeviceStore, type DeviceView, LocalGateway, PairingTokens, type PluginConfig, type ResolvedConfig, allowedGatewayHost, apply, inject, isPrivateAddress, name, parseConfig, privateInterfaceAddresses, rewriteAuthenticatedIndex };
137
+ //# sourceMappingURL=index.d.mts.map