@linxin666/dsh-client-ui-session-id 0.4.7 → 0.4.9
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 +1 -1
- package/README.zh.md +1 -1
- package/lib/client.js +24 -1
- package/lib/client.js.map +1 -1
- package/lib/types/client/telemetry.d.ts +14 -2
- package/package.json +10 -10
package/README.i18n.yaml
CHANGED
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
# side as of the last confirmed-consistent state. Both languages carry equal authority;
|
|
3
3
|
# after editing either side, bring the other along and re-record with:
|
|
4
4
|
# node scripts/verify-docs.mjs --write <dir>
|
|
5
|
-
README.md:
|
|
6
|
-
README.zh.md:
|
|
5
|
+
README.md: c3faa1038a96d6e1f3f74d1a5cfd66c10e5a43e2
|
|
6
|
+
README.zh.md: 423c5826390e62734c1c0e241d8b387c68535c1c
|
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@ English | [中文](README.zh.md)
|
|
|
5
5
|
<p align="center">
|
|
6
6
|
<img src="https://img.shields.io/npm/v/@linxin666/dsh-client-ui-session-id?style=flat-square" alt="Version">
|
|
7
7
|
|
|
8
|
-
<img src="https://img.shields.io/badge/DSH-%3E%3D0.2.1--rc.
|
|
8
|
+
<img src="https://img.shields.io/badge/DSH-%3E%3D0.2.1--rc.3-4c6ef5?style=flat-square&labelColor=454a54" alt="DSH">
|
|
9
9
|
|
|
10
10
|
<img src="https://img.shields.io/badge/license-Apache--2.0-blue?style=flat-square" alt="License">
|
|
11
11
|
</p>
|
package/README.zh.md
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<p align="center">
|
|
6
6
|
<img src="https://img.shields.io/npm/v/@linxin666/dsh-client-ui-session-id?style=flat-square" alt="Version">
|
|
7
7
|
|
|
8
|
-
<img src="https://img.shields.io/badge/DSH-%3E%3D0.2.1--rc.
|
|
8
|
+
<img src="https://img.shields.io/badge/DSH-%3E%3D0.2.1--rc.3-4c6ef5?style=flat-square&labelColor=454a54" alt="DSH">
|
|
9
9
|
|
|
10
10
|
<img src="https://img.shields.io/badge/license-Apache--2.0-blue?style=flat-square" alt="License">
|
|
11
11
|
</p>
|
package/lib/client.js
CHANGED
|
@@ -355,17 +355,39 @@ window.__ModuleLoader__.load({
|
|
|
355
355
|
};
|
|
356
356
|
//#endregion
|
|
357
357
|
//#region src/client/telemetry.ts
|
|
358
|
+
/** localStorage key carrying the family-wide telemetry opt-out ('1' = off). */
|
|
359
|
+
const TELEMETRY_OPT_OUT_KEY = "dsh-web-ui-telemetry-opt-out";
|
|
358
360
|
const VISITOR_KEY = "dsh-web-ui-telemetry-visitor";
|
|
359
361
|
const DAY_KEY_PREFIX = "dsh-web-ui-telemetry-day:";
|
|
360
362
|
const ENDPOINT = "https://dsh-market.com/api/telemetry/event";
|
|
361
363
|
/** The building package's version, when the bundle carries it. */
|
|
362
364
|
function bakedVersion() {
|
|
363
365
|
try {
|
|
364
|
-
return "0.4.
|
|
366
|
+
return "0.4.9";
|
|
365
367
|
} catch {
|
|
366
368
|
return;
|
|
367
369
|
}
|
|
368
370
|
}
|
|
371
|
+
/** Whether the user switched the family-wide opt-out on (reads storage only). */
|
|
372
|
+
function isTelemetryOptedOut() {
|
|
373
|
+
try {
|
|
374
|
+
return localStorage.getItem(TELEMETRY_OPT_OUT_KEY) === "1";
|
|
375
|
+
} catch {
|
|
376
|
+
return false;
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
/** Whether the browser itself asks not to be tracked; a failed read means no signal. */
|
|
380
|
+
function doNotTrackRequested() {
|
|
381
|
+
try {
|
|
382
|
+
return navigator.doNotTrack === "1" || navigator.doNotTrack === "yes";
|
|
383
|
+
} catch {
|
|
384
|
+
return false;
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
/** Whether a heartbeat must be suppressed right now: opt-out stored, or the browser asks not to be tracked. */
|
|
388
|
+
function isTelemetrySuppressed() {
|
|
389
|
+
return isTelemetryOptedOut() || doNotTrackRequested();
|
|
390
|
+
}
|
|
369
391
|
/** Read or lazily create the anonymous visitor id; null when storage is unavailable. */
|
|
370
392
|
function visitorId() {
|
|
371
393
|
try {
|
|
@@ -394,6 +416,7 @@ window.__ModuleLoader__.load({
|
|
|
394
416
|
*/
|
|
395
417
|
function reportDailyHeartbeat(items) {
|
|
396
418
|
try {
|
|
419
|
+
if (isTelemetrySuppressed()) return;
|
|
397
420
|
if (items.length === 0) return;
|
|
398
421
|
const today = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
|
|
399
422
|
if (navigator.webdriver) return;
|
package/lib/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","names":["css","css"],"sources":["../../../packages/dsh-session-id/src/client/main-session.ts","../../../packages/dsh-session-id/src/client/icons.tsx","../../../packages/dsh-session-id/src/client/semantic.ts","../../../packages/dsh-session-id/src/client/SessionIdPanel.tsx","../../../packages/dsh-session-id/src/client/SessionIdEntry.tsx","../../../packages/dsh-session-id/src/client/locales.ts","../../../packages/dsh-session-id/src/client/telemetry.ts","../../../packages/dsh-session-id/src/client/index.ts"],"sourcesContent":["// Generated by scripts/sync-shared.mjs from shared/client/main-session.ts. Do not edit this copy; edit the shared source and run \"node scripts/sync-shared.mjs\".\n/**\n * Main-view Session derivation for the multi-instance Client Session model.\n *\n * The Client Session Controller carries no global \"current\" selection: view\n * selection belongs to the workspace UI, which owns the main-area reference and\n * publishes it through the catalog's per-source ownership counts\n * (`SessionSummary.retainedBy.mainView`). A plugin that needs the Session the\n * main view shows derives it from that marker instead of the removed\n * `SessionListState.current` field.\n *\n * The marker describes view ownership, not authority. It is the right input for\n * presentation and for deciding which view a navigation targets; it is not a\n * business fallback, because source counts never imply visibility or success.\n * @module dsh-web/shared/main-session\n */\n\n/** The catalog row subset this helper reads (a `SessionSummary` projection). */\nexport interface MainViewOwnedRow<Id extends string = string> {\n /** Catalog row identity. */\n readonly id: Id\n /** Per-source local ownership counts; absent rows are never owned. */\n readonly retainedBy?: Readonly<Partial<Record<string, number>>> | undefined\n}\n\n/**\n * Resolve the Session the main view currently shows.\n *\n * Reads the catalog's rows rather than a per-id retain-info source: ownership\n * counts ride the list snapshot, so this neither allocates observers nor opens\n * history, and a subscription to the list still fires when the selection moves.\n * @param byId - the session catalog's rows (`SessionListState.byId`), when available.\n * @returns the main-view session id, or undefined when the main view shows none.\n */\nexport function mainViewSessionId<Id extends string>(\n byId: Readonly<Record<Id, MainViewOwnedRow<Id> | undefined>> | undefined | null,\n): Id | undefined {\n if (byId === undefined || byId === null) return undefined\n for (const row of Object.values<MainViewOwnedRow<Id> | undefined>(byId)) {\n if (row !== undefined && (row.retainedBy?.mainView ?? 0) > 0) return row.id\n }\n return undefined\n}\n","/**\n * Inline SVG icons for the session-id plugin (16px stroke style matching the\n * shell's nav icons; sized via className where a smaller variant is needed).\n */\nimport type { SVGProps } from 'react'\n\n/** Shared svg attrs for the 16px stroke icon family. */\nfunction iconProps(props: SVGProps<SVGSVGElement>): SVGProps<SVGSVGElement> {\n return {\n width: 16,\n height: 16,\n viewBox: '0 0 16 16',\n fill: 'none',\n stroke: 'currentColor',\n strokeWidth: 1.3,\n strokeLinecap: 'round',\n strokeLinejoin: 'round',\n 'aria-hidden': true,\n ...props,\n }\n}\n\n/** An ID-card / identifier glyph for the seat trigger and panel title. */\nexport function SessionIdIcon(props: SVGProps<SVGSVGElement>) {\n return (\n <svg {...iconProps(props)}>\n <rect x=\"1.5\" y=\"3.5\" width=\"13\" height=\"9\" rx=\"1.5\" />\n <path d=\"M4 6.5h2M4 9h2M7.5 6.5h4.5M7.5 9h4.5\" />\n </svg>\n )\n}\n\n/** Copy glyph. */\nexport function CopyIcon(props: SVGProps<SVGSVGElement>) {\n return (\n <svg {...iconProps(props)}>\n <rect x=\"5.5\" y=\"5.5\" width=\"9\" height=\"9\" rx=\"1.5\" />\n <path d=\"M2.5 10.5v-7A1.5 1.5 0 0 1 4 2h5.5\" />\n </svg>\n )\n}\n\n/** Check glyph for the transient copied state. */\nexport function CheckIcon(props: SVGProps<SVGSVGElement>) {\n return (\n <svg {...iconProps(props)}>\n <path d=\"M3 8.5 6.5 12l6.5-8\" />\n </svg>\n )\n}\n\n/** Close glyph for the panel header. */\nexport function CloseIcon(props: SVGProps<SVGSVGElement>) {\n return (\n <svg {...iconProps(props)}>\n <path d=\"M4 4l8 8M12 4l-8 8\" />\n </svg>\n )\n}\n","/**\n * Semantic attribute values for the session-id plugin (contract:\n * skins/skin-center/contracts/semantic-attrs-v1.md). Root containers carry\n * `data-dsh-plugin`; parts carry bare `data-dsh-part` values owned by the\n * plugin attribute.\n */\n\n/** Plugin short name stamped on the root container and the footer trigger. */\nexport const SESSION_ID_PLUGIN_ATTR = 'session-id'\n\n/** The sidebar footer seat trigger. */\nexport const SESSION_ID_PART_ENTRY = 'entry'\n\n/** The modal panel root. */\nexport const SESSION_ID_PART_PANEL = 'panel'\n\n/** One session list row. */\nexport const SESSION_ID_PART_ROW = 'row'\n\n/** The per-row copy button. */\nexport const SESSION_ID_PART_COPY = 'copy'\n\n/** The panel search input. */\nexport const SESSION_ID_PART_SEARCH = 'search'","/**\n * Session ID panel — a centered modal listing every session with its full id\n * and a copy button. Data rides the injected `sessionList` observable\n * (ctx.sessions.list, see SessionRuntime.list) read through\n * useSyncExternalStore, so the panel stays in sync with host list updates and\n * needs no per-session runtime wiring.\n */\nimport { useEffect, useRef, useSyncExternalStore, useState } from 'react'\nimport type { PropsLocale } from '@deepseek-ai/dsh-client-ui-slots'\nimport type { SessionListState, SessionSummary } from '@deepseek-ai/dsh-api-session-controller/client'\nimport { writeClipboard } from '@deepseek-ai/dsh-client-ui-primitives'\nimport { mainViewSessionId } from './main-session.ts'\nimport { CheckIcon, CopyIcon, CloseIcon } from './icons.tsx'\nimport { SESSION_ID_PART_COPY, SESSION_ID_PART_PANEL, SESSION_ID_PART_ROW, SESSION_ID_PART_SEARCH, SESSION_ID_PLUGIN_ATTR } from './semantic.ts'\nimport css from './session-id.module.css'\n\n/** The sessions-list read face injected by the plugin (ObservableSnapshot). */\nexport type SessionListReadSource = {\n getSnapshot(): SessionListState\n subscribe(fn: () => void): () => void\n}\n\n/** Panel props: the list source + the locale seat. */\nexport type SessionIdPanelProps = PropsLocale<'session-id'> & {\n list: SessionListReadSource\n onClose: () => void\n}\n\n/** Short relative label for a session's update time (zh/en shared w/ locales). */\nfunction relativeTimeLabel(updatedAt: number, now: number, t: PropsLocale<'session-id'>['t']): string {\n const diff = Math.max(0, now - updatedAt)\n const minute = 60_000\n const hour = 60 * minute\n const day = 24 * hour\n if (diff < minute) return t('panel.updatedAt', { t: t('panel.time.now') })\n if (diff < hour) return t('panel.updatedAt', { t: t('panel.time.minutes', { n: Math.floor(diff / minute) }) })\n if (diff < day) return t('panel.updatedAt', { t: t('panel.time.hours', { n: Math.floor(diff / hour) }) })\n return t('panel.updatedAt', { t: t('panel.time.days', { n: Math.floor(diff / day) }) })\n}\n\n/** Sort sessions by update time, newest first; blank rows sink to the bottom. */\nfunction sortSessions(list: SessionListState): SessionSummary[] {\n const rows = list.ids\n .map(id => list.byId[id])\n .filter((row): row is SessionSummary => row !== undefined)\n return [...rows].sort((a, b) => {\n if (a.blank !== b.blank) return a.blank ? 1 : -1\n return b.updatedAt - a.updatedAt\n })\n}\n\n/** One session row: title + id + copy button with transient \"copied\" / failed state. */\nfunction SessionRow({ session, current, t }: {\n session: SessionSummary\n current: string | undefined\n t: PropsLocale<'session-id'>['t']\n}) {\n const [status, setStatus] = useState<'idle' | 'copied' | 'failed'>('idle')\n const idleTimer = useRef<number | undefined>(undefined)\n const active = session.id === current\n const title = session.displayTitle || session.id\n\n // A pending reset timer belongs to the previous copy; drop it when the row\n // leaves the DOM so nothing keeps running after unmount.\n useEffect(() => {\n return () => { window.clearTimeout(idleTimer.current) }\n }, [])\n\n const handleCopy = (): void => {\n // Clear the previous reset before a new write so rapid repeated clicks\n // never stack timers (only the latest copy reaches the idle reset).\n window.clearTimeout(idleTimer.current)\n // Copy must be gesture-driven; a failed write surfaces an actionable\n // message instead of silently swallowing the error (no permission\n // requests, no background retry).\n void writeClipboard(session.id).then((ok) => {\n if (ok) {\n setStatus('copied')\n idleTimer.current = window.setTimeout(() => { setStatus('idle') }, 1200)\n } else {\n setStatus('failed')\n }\n }).catch(() => {\n // A rejected write is the same actionable failure as ok === false.\n setStatus('failed')\n })\n }\n\n const copyLabel = status === 'copied' ? t('panel.copied')\n : status === 'failed' ? t('panel.copyFailed') : t('panel.copy')\n\n return (\n <div className={css.row} data-dsh-part={SESSION_ID_PART_ROW}>\n <span className={css.rowInfo}>\n <span className={`${css.rowTitle}${active ? ` ${css.rowActive}` : ''}`} title={title}>\n {title}\n </span>\n {active && <span className={css.rowMeta}>{t('panel.current')}</span>}\n <span className={css.rowId} title={session.id}>{session.id}</span>\n </span>\n <button\n type=\"button\"\n className={css.copyButton}\n data-dsh-part={SESSION_ID_PART_COPY}\n data-copied={status === 'copied' ? 'true' : undefined}\n data-failed={status === 'failed' ? 'true' : undefined}\n aria-label={`${copyLabel} ${session.id}`}\n onClick={handleCopy}\n >\n {status === 'copied' ? <CheckIcon className={css.iconSmall} /> : <CopyIcon className={css.iconSmall} />}\n {copyLabel}\n </button>\n </div>\n )\n}\n\n/**\n * Render the session-id panel body.\n * @param props - injected list source + locale seat + close callback.\n * @returns the modal panel.\n */\nexport function SessionIdPanel({ list, onClose, t }: SessionIdPanelProps) {\n const snapshot = useSyncExternalStore(list.subscribe, list.getSnapshot)\n const sorted = sortSessions(snapshot)\n // The catalog carries no global selection since 0.1.6-alpha.2; the Session the\n // main view owns is the one to mark as current.\n const currentId = mainViewSessionId(snapshot.byId)\n const [search, setSearch] = useState('')\n\n // Local, read-only filter over the already-visible list (title or id\n // substring, case-insensitive) — no host API, no disk, no other profile.\n const query = search.trim().toLowerCase()\n const rows = query === ''\n ? sorted\n : sorted.filter(row => row.displayTitle.toLowerCase().includes(query) || row.id.toLowerCase().includes(query))\n\n return (\n <div className={css.overlay} role=\"presentation\" data-dsh-plugin={SESSION_ID_PLUGIN_ATTR}>\n <div className={css.mask} aria-hidden=\"true\" onClick={onClose} />\n <div className={css.panel} data-dsh-part={SESSION_ID_PART_PANEL} role=\"dialog\" aria-modal=\"true\" aria-label={t('panel.title')}>\n <div className={css.header}>\n <div className={css.heading}>\n <h2 className={css.title}>{t('panel.title')}</h2>\n </div>\n <button\n type=\"button\"\n className={css.closeButton}\n aria-label={t('panel.close')}\n onClick={onClose}\n >\n <CloseIcon className={css.icon} />\n </button>\n </div>\n <input\n type=\"search\"\n className={css.search}\n data-dsh-part={SESSION_ID_PART_SEARCH}\n placeholder={t('panel.search.placeholder')}\n aria-label={t('panel.search.aria')}\n value={search}\n onChange={(event) => { setSearch(event.target.value) }}\n />\n {rows.length === 0 ? (\n <div className={css.empty}>{query === '' ? t('panel.empty') : t('panel.noMatches')}</div>\n ) : (\n <div className={css.list}>\n {rows.map(row => (\n <SessionRow key={row.id} session={row} current={currentId} t={t} />\n ))}\n </div>\n )}\n </div>\n </div>\n )\n}\n","/**\n * Sidebar footer entry for the session-id plugin: the icon-only trigger\n * beside the sidebar settings seat (wide row / rail circle) that opens the\n * session-id panel. Registered into the official `sidebar.footer.action`\n * list slot (declared by ui-sidebar, same seat dsh-remote-web-ui shares).\n */\nimport { useState } from 'react'\nimport { createPortal } from 'react-dom'\nimport type { PropsLocale } from '@deepseek-ai/dsh-client-ui-slots'\nimport { SessionIdPanel, type SessionListReadSource } from './SessionIdPanel.tsx'\nimport { SESSION_ID_PART_ENTRY, SESSION_ID_PLUGIN_ATTR } from './semantic.ts'\nimport { SessionIdIcon } from './icons.tsx'\nimport css from './session-id.module.css'\n\n/** Entry props: the footer seat's column state + injected list source + locale seat. */\nexport type SessionIdEntryProps = PropsLocale<'session-id'> & {\n /** Whether the sidebar renders wide content (false = 56px rail). */\n wide: boolean\n /** The sessions-list read face (ctx.sessions.list wrapped by the plugin). */\n list: SessionListReadSource\n}\n\n/**\n * Render the session-id seat trigger and panel.\n * @param props - composed slot props.\n * @returns the trigger and, when open, the panel portal.\n */\nexport function SessionIdEntry({ wide, list, t }: SessionIdEntryProps) {\n const [open, setOpen] = useState(false)\n\n const trigger = (\n <button\n type=\"button\"\n className={css.trigger}\n data-dsh-plugin={SESSION_ID_PLUGIN_ATTR}\n data-dsh-part={SESSION_ID_PART_ENTRY}\n data-wide={wide ? 'wide' : 'rail'}\n aria-label={t('entry.label')}\n title={t('entry.label')}\n onClick={() => { setOpen(true) }}\n >\n <SessionIdIcon />\n </button>\n )\n\n return (\n <>\n {trigger}\n {open && createPortal(\n <SessionIdPanel list={list} onClose={() => { setOpen(false) }} t={t} />,\n document.body,\n )}\n </>\n )\n}\n","/**\n * Locale dictionaries for the session-id plugin. `zh` is the key-set source of\n * truth; `en` keeps a full key-for-key mirror (packages/AGENTS.md bilingual\n * rules). Registered through ctx.locale.register(NS, { zh, en }).\n */\n\n/** Simplified Chinese dictionary (key-set source of truth). */\nexport const zh = {\n 'entry.label': '会话 ID',\n 'panel.title': '会话 ID',\n 'panel.empty': '暂无会话',\n 'panel.noMatches': '无匹配会话',\n 'panel.search.placeholder': '搜索标题或 ID…',\n 'panel.search.aria': '搜索会话',\n 'panel.close': '关闭',\n 'panel.copy': '复制',\n 'panel.copied': '已复制',\n 'panel.copyFailed': '复制失败,请重试',\n 'panel.current': '当前',\n 'panel.updatedAt': '更新于 {t}',\n 'panel.time.now': '刚刚',\n 'panel.time.minutes': '{n} 分钟前',\n 'panel.time.hours': '{n} 小时前',\n 'panel.time.days': '{n} 天前',\n}\n\n/** The session-id namespace key union. */\nexport type SessionIdKey = keyof typeof zh\n\n/** English dictionary, key-for-key complete against zh. */\nexport const en: Record<SessionIdKey, string> = {\n 'entry.label': 'Session ID',\n 'panel.title': 'Session IDs',\n 'panel.empty': 'No sessions',\n 'panel.noMatches': 'No matching sessions',\n 'panel.search.placeholder': 'Search title or ID…',\n 'panel.search.aria': 'Search sessions',\n 'panel.close': 'Close',\n 'panel.copy': 'Copy',\n 'panel.copied': 'Copied',\n 'panel.copyFailed': 'Copy failed, retry',\n 'panel.current': 'Current',\n 'panel.updatedAt': 'Updated {t}',\n 'panel.time.now': 'just now',\n 'panel.time.minutes': '{n}m ago',\n 'panel.time.hours': '{n}h ago',\n 'panel.time.days': '{n}d ago',\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 * Session-id plugin — browser half. Registers the `session-id` dictionaries\n * and the sidebar-foot trigger (into the ui-sidebar-declared\n * `sidebar.footer.action` list slot) that opens the session-id panel. The\n * panel lists every session with its full id and a copy button.\n *\n * Export discipline (packages/AGENTS.md): the /client surface carries only\n * what cordis loading needs plus types.\n */\nimport type { Context as ClientContext } from '@deepseek-ai/cordis'\nimport type { ISessions } from '@deepseek-ai/dsh-api-session-controller/client'\nimport type {} from '@deepseek-ai/dsh-client-ui-renderer/client'\n// Type-only: pulls the locale plugin's Context merge (ctx.locale) and its\n// LocaleNamespaceMap merge table.\nimport type {} from '@deepseek-ai/dsh-client-locale/client'\n// Type-only: pulls the ui-sidebar SlotMap merge (the 'sidebar.footer.action' hole).\nimport type {} from '@deepseek-ai/dsh-client-ui-sidebar/client'\nimport { SessionIdEntry } from './SessionIdEntry.tsx'\nimport { en, zh, type SessionIdKey } from './locales.ts'\nimport { reportDailyHeartbeat } from './telemetry.ts'\n\ndeclare module '@deepseek-ai/dsh-client-ui-slots' {\n interface LocaleNamespaceMap {\n /** Session-id surface copy. */\n 'session-id': SessionIdKey\n }\n}\n\n/** Dictionary namespace owned by this plugin. */\nconst NS = 'session-id'\n\n/** Unique occupant id inside the shared footer.action list slot. */\nconst ENTRY_ID = 'session-id'\n\n/** Services required by this plugin. */\nexport const inject = ['slots', 'locale', 'sessions']\n\n/**\n * Register the session-id surface.\n * @param ctx - client root context.\n */\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-session-id' }])\n\n ctx.effect(() => {\n try {\n return ctx.locale.register(NS, { zh, en })\n } catch {\n return () => {}\n }\n }, 'session-id: dictionaries')\n\n // Sidebar foot entry. The shell declares 'sidebar.footer.action' (list kind:\n // multiple occupants may share the seat); registration is declaration-aware\n // via slots.inject. The list read face (ctx.sessions.list) is injected as a\n // plain prop so the component can subscribe without per-session wiring.\n ctx.slots.inject('sidebar.footer.action', () => {\n // Read the browser sessions face explicitly (combined host/client program\n // shares the Cordis Context name; the explicit face keeps types correct).\n const sessions = ctx.get('sessions') as unknown as ISessions\n const list = {\n getSnapshot: () => sessions.list.getSnapshot(),\n subscribe: (fn: () => void) => sessions.list.subscribe(fn),\n }\n try {\n return ctx.slots.register({\n name: 'sidebar.footer.action',\n id: ENTRY_ID,\n locale: NS,\n inject: () => ({ list }),\n }, SessionIdEntry)\n } catch {\n return () => {}\n }\n })\n}\n\nexport type { SessionIdEntryProps } from './SessionIdEntry.tsx'\nexport type { SessionIdKey } from './locales.ts'\nexport type { SessionListReadSource, SessionIdPanelProps } from './SessionIdPanel.tsx'\n"],"mappings":";;;;;;;;;;;;;;;;;;;;EAkCA,SAAgB,kBACd,MACgB;GAChB,IAAI,SAAS,KAAA,KAAa,SAAS,MAAM,OAAO,KAAA;GAChD,KAAK,MAAM,OAAO,OAAO,OAAyC,IAAI,GACpE,IAAI,QAAQ,KAAA,MAAc,IAAI,YAAY,YAAY,KAAK,GAAG,OAAO,IAAI;EAG7E;;;;ECnCA,SAAS,UAAU,OAAyD;GAC1E,OAAO;IACL,OAAO;IACP,QAAQ;IACR,SAAS;IACT,MAAM;IACN,QAAQ;IACR,aAAa;IACb,eAAe;IACf,gBAAgB;IAChB,eAAe;IACf,GAAG;GACL;EACF;;EAGA,SAAgB,cAAc,OAAgC;GAC5D,OACE,iBAAA,GAAA,kBAAA,KAAA,CAAC,OAAD;IAAK,GAAI,UAAU,KAAK;cAAxB,CACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,QAAD;KAAM,GAAE;KAAM,GAAE;KAAM,OAAM;KAAK,QAAO;KAAI,IAAG;IAAO,CAAA,GACtD,iBAAA,GAAA,kBAAA,IAAA,CAAC,QAAD,EAAM,GAAE,uCAAwC,CAAA,CAC7C;;EAET;;EAGA,SAAgB,SAAS,OAAgC;GACvD,OACE,iBAAA,GAAA,kBAAA,KAAA,CAAC,OAAD;IAAK,GAAI,UAAU,KAAK;cAAxB,CACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,QAAD;KAAM,GAAE;KAAM,GA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AC;IAC3C,QAAQ;KACN,aAAa,CAAC;IAChB;GACF,GAAG,0BAA0B;GAM7B,IAAI,MAAM,OAAO,+BAA+B;IAG9C,MAAM,WAAW,IAAI,IAAI,UAAU;IACnC,MAAM,OAAO;KACX,mBAAmB,SAAS,KAAK,YAAY;KAC7C,YAAY,OAAmB,SAAS,KAAK,UAAU,EAAE;IAC3D;IACA,IAAI;KACF,OAAO,IAAI,MAAM,SAAS;MACxB,MAAM;MACN,IAAI;MACJ,QAAQ;MACR,eAAe,EAAE,KAAK;KACxB,GAAG,cAAc;IACnB,QAAQ;KACN,aAAa,CAAC;IAChB;GACF,CAAC;EACH"}
|
|
1
|
+
{"version":3,"file":"client.js","names":["css","css"],"sources":["../../../packages/dsh-session-id/src/client/main-session.ts","../../../packages/dsh-session-id/src/client/icons.tsx","../../../packages/dsh-session-id/src/client/semantic.ts","../../../packages/dsh-session-id/src/client/SessionIdPanel.tsx","../../../packages/dsh-session-id/src/client/SessionIdEntry.tsx","../../../packages/dsh-session-id/src/client/locales.ts","../../../packages/dsh-session-id/src/client/telemetry.ts","../../../packages/dsh-session-id/src/client/index.ts"],"sourcesContent":["// Generated by scripts/sync-shared.mjs from shared/client/main-session.ts. Do not edit this copy; edit the shared source and run \"node scripts/sync-shared.mjs\".\n/**\n * Main-view Session derivation for the multi-instance Client Session model.\n *\n * The Client Session Controller carries no global \"current\" selection: view\n * selection belongs to the workspace UI, which owns the main-area reference and\n * publishes it through the catalog's per-source ownership counts\n * (`SessionSummary.retainedBy.mainView`). A plugin that needs the Session the\n * main view shows derives it from that marker instead of the removed\n * `SessionListState.current` field.\n *\n * The marker describes view ownership, not authority. It is the right input for\n * presentation and for deciding which view a navigation targets; it is not a\n * business fallback, because source counts never imply visibility or success.\n * @module dsh-web/shared/main-session\n */\n\n/** The catalog row subset this helper reads (a `SessionSummary` projection). */\nexport interface MainViewOwnedRow<Id extends string = string> {\n /** Catalog row identity. */\n readonly id: Id\n /** Per-source local ownership counts; absent rows are never owned. */\n readonly retainedBy?: Readonly<Partial<Record<string, number>>> | undefined\n}\n\n/**\n * Resolve the Session the main view currently shows.\n *\n * Reads the catalog's rows rather than a per-id retain-info source: ownership\n * counts ride the list snapshot, so this neither allocates observers nor opens\n * history, and a subscription to the list still fires when the selection moves.\n * @param byId - the session catalog's rows (`SessionListState.byId`), when available.\n * @returns the main-view session id, or undefined when the main view shows none.\n */\nexport function mainViewSessionId<Id extends string>(\n byId: Readonly<Record<Id, MainViewOwnedRow<Id> | undefined>> | undefined | null,\n): Id | undefined {\n if (byId === undefined || byId === null) return undefined\n for (const row of Object.values<MainViewOwnedRow<Id> | undefined>(byId)) {\n if (row !== undefined && (row.retainedBy?.mainView ?? 0) > 0) return row.id\n }\n return undefined\n}\n","/**\n * Inline SVG icons for the session-id plugin (16px stroke style matching the\n * shell's nav icons; sized via className where a smaller variant is needed).\n */\nimport type { SVGProps } from 'react'\n\n/** Shared svg attrs for the 16px stroke icon family. */\nfunction iconProps(props: SVGProps<SVGSVGElement>): SVGProps<SVGSVGElement> {\n return {\n width: 16,\n height: 16,\n viewBox: '0 0 16 16',\n fill: 'none',\n stroke: 'currentColor',\n strokeWidth: 1.3,\n strokeLinecap: 'round',\n strokeLinejoin: 'round',\n 'aria-hidden': true,\n ...props,\n }\n}\n\n/** An ID-card / identifier glyph for the seat trigger and panel title. */\nexport function SessionIdIcon(props: SVGProps<SVGSVGElement>) {\n return (\n <svg {...iconProps(props)}>\n <rect x=\"1.5\" y=\"3.5\" width=\"13\" height=\"9\" rx=\"1.5\" />\n <path d=\"M4 6.5h2M4 9h2M7.5 6.5h4.5M7.5 9h4.5\" />\n </svg>\n )\n}\n\n/** Copy glyph. */\nexport function CopyIcon(props: SVGProps<SVGSVGElement>) {\n return (\n <svg {...iconProps(props)}>\n <rect x=\"5.5\" y=\"5.5\" width=\"9\" height=\"9\" rx=\"1.5\" />\n <path d=\"M2.5 10.5v-7A1.5 1.5 0 0 1 4 2h5.5\" />\n </svg>\n )\n}\n\n/** Check glyph for the transient copied state. */\nexport function CheckIcon(props: SVGProps<SVGSVGElement>) {\n return (\n <svg {...iconProps(props)}>\n <path d=\"M3 8.5 6.5 12l6.5-8\" />\n </svg>\n )\n}\n\n/** Close glyph for the panel header. */\nexport function CloseIcon(props: SVGProps<SVGSVGElement>) {\n return (\n <svg {...iconProps(props)}>\n <path d=\"M4 4l8 8M12 4l-8 8\" />\n </svg>\n )\n}\n","/**\n * Semantic attribute values for the session-id plugin (contract:\n * skins/skin-center/contracts/semantic-attrs-v1.md). Root containers carry\n * `data-dsh-plugin`; parts carry bare `data-dsh-part` values owned by the\n * plugin attribute.\n */\n\n/** Plugin short name stamped on the root container and the footer trigger. */\nexport const SESSION_ID_PLUGIN_ATTR = 'session-id'\n\n/** The sidebar footer seat trigger. */\nexport const SESSION_ID_PART_ENTRY = 'entry'\n\n/** The modal panel root. */\nexport const SESSION_ID_PART_PANEL = 'panel'\n\n/** One session list row. */\nexport const SESSION_ID_PART_ROW = 'row'\n\n/** The per-row copy button. */\nexport const SESSION_ID_PART_COPY = 'copy'\n\n/** The panel search input. */\nexport const SESSION_ID_PART_SEARCH = 'search'","/**\n * Session ID panel — a centered modal listing every session with its full id\n * and a copy button. Data rides the injected `sessionList` observable\n * (ctx.sessions.list, see SessionRuntime.list) read through\n * useSyncExternalStore, so the panel stays in sync with host list updates and\n * needs no per-session runtime wiring.\n */\nimport { useEffect, useRef, useSyncExternalStore, useState } from 'react'\nimport type { PropsLocale } from '@deepseek-ai/dsh-client-ui-slots'\nimport type { SessionListState, SessionSummary } from '@deepseek-ai/dsh-api-session-controller/client'\nimport { writeClipboard } from '@deepseek-ai/dsh-client-ui-primitives'\nimport { mainViewSessionId } from './main-session.ts'\nimport { CheckIcon, CopyIcon, CloseIcon } from './icons.tsx'\nimport { SESSION_ID_PART_COPY, SESSION_ID_PART_PANEL, SESSION_ID_PART_ROW, SESSION_ID_PART_SEARCH, SESSION_ID_PLUGIN_ATTR } from './semantic.ts'\nimport css from './session-id.module.css'\n\n/** The sessions-list read face injected by the plugin (ObservableSnapshot). */\nexport type SessionListReadSource = {\n getSnapshot(): SessionListState\n subscribe(fn: () => void): () => void\n}\n\n/** Panel props: the list source + the locale seat. */\nexport type SessionIdPanelProps = PropsLocale<'session-id'> & {\n list: SessionListReadSource\n onClose: () => void\n}\n\n/** Short relative label for a session's update time (zh/en shared w/ locales). */\nfunction relativeTimeLabel(updatedAt: number, now: number, t: PropsLocale<'session-id'>['t']): string {\n const diff = Math.max(0, now - updatedAt)\n const minute = 60_000\n const hour = 60 * minute\n const day = 24 * hour\n if (diff < minute) return t('panel.updatedAt', { t: t('panel.time.now') })\n if (diff < hour) return t('panel.updatedAt', { t: t('panel.time.minutes', { n: Math.floor(diff / minute) }) })\n if (diff < day) return t('panel.updatedAt', { t: t('panel.time.hours', { n: Math.floor(diff / hour) }) })\n return t('panel.updatedAt', { t: t('panel.time.days', { n: Math.floor(diff / day) }) })\n}\n\n/** Sort sessions by update time, newest first; blank rows sink to the bottom. */\nfunction sortSessions(list: SessionListState): SessionSummary[] {\n const rows = list.ids\n .map(id => list.byId[id])\n .filter((row): row is SessionSummary => row !== undefined)\n return [...rows].sort((a, b) => {\n if (a.blank !== b.blank) return a.blank ? 1 : -1\n return b.updatedAt - a.updatedAt\n })\n}\n\n/** One session row: title + id + copy button with transient \"copied\" / failed state. */\nfunction SessionRow({ session, current, t }: {\n session: SessionSummary\n current: string | undefined\n t: PropsLocale<'session-id'>['t']\n}) {\n const [status, setStatus] = useState<'idle' | 'copied' | 'failed'>('idle')\n const idleTimer = useRef<number | undefined>(undefined)\n const active = session.id === current\n const title = session.displayTitle || session.id\n\n // A pending reset timer belongs to the previous copy; drop it when the row\n // leaves the DOM so nothing keeps running after unmount.\n useEffect(() => {\n return () => { window.clearTimeout(idleTimer.current) }\n }, [])\n\n const handleCopy = (): void => {\n // Clear the previous reset before a new write so rapid repeated clicks\n // never stack timers (only the latest copy reaches the idle reset).\n window.clearTimeout(idleTimer.current)\n // Copy must be gesture-driven; a failed write surfaces an actionable\n // message instead of silently swallowing the error (no permission\n // requests, no background retry).\n void writeClipboard(session.id).then((ok) => {\n if (ok) {\n setStatus('copied')\n idleTimer.current = window.setTimeout(() => { setStatus('idle') }, 1200)\n } else {\n setStatus('failed')\n }\n }).catch(() => {\n // A rejected write is the same actionable failure as ok === false.\n setStatus('failed')\n })\n }\n\n const copyLabel = status === 'copied' ? t('panel.copied')\n : status === 'failed' ? t('panel.copyFailed') : t('panel.copy')\n\n return (\n <div className={css.row} data-dsh-part={SESSION_ID_PART_ROW}>\n <span className={css.rowInfo}>\n <span className={`${css.rowTitle}${active ? ` ${css.rowActive}` : ''}`} title={title}>\n {title}\n </span>\n {active && <span className={css.rowMeta}>{t('panel.current')}</span>}\n <span className={css.rowId} title={session.id}>{session.id}</span>\n </span>\n <button\n type=\"button\"\n className={css.copyButton}\n data-dsh-part={SESSION_ID_PART_COPY}\n data-copied={status === 'copied' ? 'true' : undefined}\n data-failed={status === 'failed' ? 'true' : undefined}\n aria-label={`${copyLabel} ${session.id}`}\n onClick={handleCopy}\n >\n {status === 'copied' ? <CheckIcon className={css.iconSmall} /> : <CopyIcon className={css.iconSmall} />}\n {copyLabel}\n </button>\n </div>\n )\n}\n\n/**\n * Render the session-id panel body.\n * @param props - injected list source + locale seat + close callback.\n * @returns the modal panel.\n */\nexport function SessionIdPanel({ list, onClose, t }: SessionIdPanelProps) {\n const snapshot = useSyncExternalStore(list.subscribe, list.getSnapshot)\n const sorted = sortSessions(snapshot)\n // The catalog carries no global selection since 0.1.6-alpha.2; the Session the\n // main view owns is the one to mark as current.\n const currentId = mainViewSessionId(snapshot.byId)\n const [search, setSearch] = useState('')\n\n // Local, read-only filter over the already-visible list (title or id\n // substring, case-insensitive) — no host API, no disk, no other profile.\n const query = search.trim().toLowerCase()\n const rows = query === ''\n ? sorted\n : sorted.filter(row => row.displayTitle.toLowerCase().includes(query) || row.id.toLowerCase().includes(query))\n\n return (\n <div className={css.overlay} role=\"presentation\" data-dsh-plugin={SESSION_ID_PLUGIN_ATTR}>\n <div className={css.mask} aria-hidden=\"true\" onClick={onClose} />\n <div className={css.panel} data-dsh-part={SESSION_ID_PART_PANEL} role=\"dialog\" aria-modal=\"true\" aria-label={t('panel.title')}>\n <div className={css.header}>\n <div className={css.heading}>\n <h2 className={css.title}>{t('panel.title')}</h2>\n </div>\n <button\n type=\"button\"\n className={css.closeButton}\n aria-label={t('panel.close')}\n onClick={onClose}\n >\n <CloseIcon className={css.icon} />\n </button>\n </div>\n <input\n type=\"search\"\n className={css.search}\n data-dsh-part={SESSION_ID_PART_SEARCH}\n placeholder={t('panel.search.placeholder')}\n aria-label={t('panel.search.aria')}\n value={search}\n onChange={(event) => { setSearch(event.target.value) }}\n />\n {rows.length === 0 ? (\n <div className={css.empty}>{query === '' ? t('panel.empty') : t('panel.noMatches')}</div>\n ) : (\n <div className={css.list}>\n {rows.map(row => (\n <SessionRow key={row.id} session={row} current={currentId} t={t} />\n ))}\n </div>\n )}\n </div>\n </div>\n )\n}\n","/**\n * Sidebar footer entry for the session-id plugin: the icon-only trigger\n * beside the sidebar settings seat (wide row / rail circle) that opens the\n * session-id panel. Registered into the official `sidebar.footer.action`\n * list slot (declared by ui-sidebar, same seat dsh-remote-web-ui shares).\n */\nimport { useState } from 'react'\nimport { createPortal } from 'react-dom'\nimport type { PropsLocale } from '@deepseek-ai/dsh-client-ui-slots'\nimport { SessionIdPanel, type SessionListReadSource } from './SessionIdPanel.tsx'\nimport { SESSION_ID_PART_ENTRY, SESSION_ID_PLUGIN_ATTR } from './semantic.ts'\nimport { SessionIdIcon } from './icons.tsx'\nimport css from './session-id.module.css'\n\n/** Entry props: the footer seat's column state + injected list source + locale seat. */\nexport type SessionIdEntryProps = PropsLocale<'session-id'> & {\n /** Whether the sidebar renders wide content (false = 56px rail). */\n wide: boolean\n /** The sessions-list read face (ctx.sessions.list wrapped by the plugin). */\n list: SessionListReadSource\n}\n\n/**\n * Render the session-id seat trigger and panel.\n * @param props - composed slot props.\n * @returns the trigger and, when open, the panel portal.\n */\nexport function SessionIdEntry({ wide, list, t }: SessionIdEntryProps) {\n const [open, setOpen] = useState(false)\n\n const trigger = (\n <button\n type=\"button\"\n className={css.trigger}\n data-dsh-plugin={SESSION_ID_PLUGIN_ATTR}\n data-dsh-part={SESSION_ID_PART_ENTRY}\n data-wide={wide ? 'wide' : 'rail'}\n aria-label={t('entry.label')}\n title={t('entry.label')}\n onClick={() => { setOpen(true) }}\n >\n <SessionIdIcon />\n </button>\n )\n\n return (\n <>\n {trigger}\n {open && createPortal(\n <SessionIdPanel list={list} onClose={() => { setOpen(false) }} t={t} />,\n document.body,\n )}\n </>\n )\n}\n","/**\n * Locale dictionaries for the session-id plugin. `zh` is the key-set source of\n * truth; `en` keeps a full key-for-key mirror (packages/AGENTS.md bilingual\n * rules). Registered through ctx.locale.register(NS, { zh, en }).\n */\n\n/** Simplified Chinese dictionary (key-set source of truth). */\nexport const zh = {\n 'entry.label': '会话 ID',\n 'panel.title': '会话 ID',\n 'panel.empty': '暂无会话',\n 'panel.noMatches': '无匹配会话',\n 'panel.search.placeholder': '搜索标题或 ID…',\n 'panel.search.aria': '搜索会话',\n 'panel.close': '关闭',\n 'panel.copy': '复制',\n 'panel.copied': '已复制',\n 'panel.copyFailed': '复制失败,请重试',\n 'panel.current': '当前',\n 'panel.updatedAt': '更新于 {t}',\n 'panel.time.now': '刚刚',\n 'panel.time.minutes': '{n} 分钟前',\n 'panel.time.hours': '{n} 小时前',\n 'panel.time.days': '{n} 天前',\n}\n\n/** The session-id namespace key union. */\nexport type SessionIdKey = keyof typeof zh\n\n/** English dictionary, key-for-key complete against zh. */\nexport const en: Record<SessionIdKey, string> = {\n 'entry.label': 'Session ID',\n 'panel.title': 'Session IDs',\n 'panel.empty': 'No sessions',\n 'panel.noMatches': 'No matching sessions',\n 'panel.search.placeholder': 'Search title or ID…',\n 'panel.search.aria': 'Search sessions',\n 'panel.close': 'Close',\n 'panel.copy': 'Copy',\n 'panel.copied': 'Copied',\n 'panel.copyFailed': 'Copy failed, retry',\n 'panel.current': 'Current',\n 'panel.updatedAt': 'Updated {t}',\n 'panel.time.now': 'just now',\n 'panel.time.minutes': '{n}m ago',\n 'panel.time.hours': '{n}h ago',\n 'panel.time.days': '{n}d ago',\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. Frames where\n * storage is unavailable report nothing.\n *\n * The family-wide opt-out and the browser's Do Not Track signal both suppress\n * the heartbeat; the Web Plugins settings switch writes the same localStorage\n * key. The system 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\n/** localStorage key carrying the family-wide telemetry opt-out ('1' = off). */\nexport const TELEMETRY_OPT_OUT_KEY = 'dsh-web-ui-telemetry-opt-out'\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/** Whether the user switched the family-wide opt-out on (reads storage only). */\nexport function isTelemetryOptedOut(): boolean {\n try {\n return localStorage.getItem(TELEMETRY_OPT_OUT_KEY) === '1'\n } catch {\n // Storage unavailable: there is no stored opt-out to honour.\n return false\n }\n}\n\n/** Turn the family-wide opt-out on or off (writing '1' / removing the key); never throws. */\nexport function setTelemetryOptedOut(optedOut: boolean): void {\n try {\n if (optedOut) localStorage.setItem(TELEMETRY_OPT_OUT_KEY, '1')\n else localStorage.removeItem(TELEMETRY_OPT_OUT_KEY)\n } catch {\n // Storage unavailable: the preference cannot be persisted on this machine.\n }\n}\n\n/** Whether the browser itself asks not to be tracked; a failed read means no signal. */\nfunction doNotTrackRequested(): boolean {\n try {\n // '1' per the DNT header spec, 'yes' from older Firefox builds.\n return navigator.doNotTrack === '1' || navigator.doNotTrack === 'yes'\n } catch {\n return false\n }\n}\n\n/** Whether a heartbeat must be suppressed right now: opt-out stored, or the browser asks not to be tracked. */\nexport function isTelemetrySuppressed(): boolean {\n return isTelemetryOptedOut() || doNotTrackRequested()\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 // First guard: a stored opt-out or the browser's Do Not Track stops every\n // read below from minting an id, marking the day, or reaching the network.\n if (isTelemetrySuppressed()) return\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 * Session-id plugin — browser half. Registers the `session-id` dictionaries\n * and the sidebar-foot trigger (into the ui-sidebar-declared\n * `sidebar.footer.action` list slot) that opens the session-id panel. The\n * panel lists every session with its full id and a copy button.\n *\n * Export discipline (packages/AGENTS.md): the /client surface carries only\n * what cordis loading needs plus types.\n */\nimport type { Context as ClientContext } from '@deepseek-ai/cordis'\nimport type { ISessions } from '@deepseek-ai/dsh-api-session-controller/client'\nimport type {} from '@deepseek-ai/dsh-client-ui-renderer/client'\n// Type-only: pulls the locale plugin's Context merge (ctx.locale) and its\n// LocaleNamespaceMap merge table.\nimport type {} from '@deepseek-ai/dsh-client-locale/client'\n// Type-only: pulls the ui-sidebar SlotMap merge (the 'sidebar.footer.action' hole).\nimport type {} from '@deepseek-ai/dsh-client-ui-sidebar/client'\nimport { SessionIdEntry } from './SessionIdEntry.tsx'\nimport { en, zh, type SessionIdKey } from './locales.ts'\nimport { reportDailyHeartbeat } from './telemetry.ts'\n\ndeclare module '@deepseek-ai/dsh-client-ui-slots' {\n interface LocaleNamespaceMap {\n /** Session-id surface copy. */\n 'session-id': SessionIdKey\n }\n}\n\n/** Dictionary namespace owned by this plugin. */\nconst NS = 'session-id'\n\n/** Unique occupant id inside the shared footer.action list slot. */\nconst ENTRY_ID = 'session-id'\n\n/** Services required by this plugin. */\nexport const inject = ['slots', 'locale', 'sessions']\n\n/**\n * Register the session-id surface.\n * @param ctx - client root context.\n */\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-session-id' }])\n\n ctx.effect(() => {\n try {\n return ctx.locale.register(NS, { zh, en })\n } catch {\n return () => {}\n }\n }, 'session-id: dictionaries')\n\n // Sidebar foot entry. The shell declares 'sidebar.footer.action' (list kind:\n // multiple occupants may share the seat); registration is declaration-aware\n // via slots.inject. The list read face (ctx.sessions.list) is injected as a\n // plain prop so the component can subscribe without per-session wiring.\n ctx.slots.inject('sidebar.footer.action', () => {\n // Read the browser sessions face explicitly (combined host/client program\n // shares the Cordis Context name; the explicit face keeps types correct).\n const sessions = ctx.get('sessions') as unknown as ISessions\n const list = {\n getSnapshot: () => sessions.list.getSnapshot(),\n subscribe: (fn: () => void) => sessions.list.subscribe(fn),\n }\n try {\n return ctx.slots.register({\n name: 'sidebar.footer.action',\n id: ENTRY_ID,\n locale: NS,\n inject: () => ({ list }),\n }, SessionIdEntry)\n } catch {\n return () => {}\n }\n })\n}\n\nexport type { SessionIdEntryProps } from './SessionIdEntry.tsx'\nexport type { SessionIdKey } from './locales.ts'\nexport type { SessionListRead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AI;MAAE;MAAI;KAAG,CAAC;IAC3C,QAAQ;KACN,aAAa,CAAC;IAChB;GACF,GAAG,0BAA0B;GAM7B,IAAI,MAAM,OAAO,+BAA+B;IAG9C,MAAM,WAAW,IAAI,IAAI,UAAU;IACnC,MAAM,OAAO;KACX,mBAAmB,SAAS,KAAK,YAAY;KAC7C,YAAY,OAAmB,SAAS,KAAK,UAAU,EAAE;IAC3D;IACA,IAAI;KACF,OAAO,IAAI,MAAM,SAAS;MACxB,MAAM;MACN,IAAI;MACJ,QAAQ;MACR,eAAe,EAAE,KAAK;KACxB,GAAG,cAAc;IACnB,QAAQ;KACN,aAAa,CAAC;IAChB;GACF,CAAC;EACH"}
|
|
@@ -6,8 +6,12 @@
|
|
|
6
6
|
* The payload carries no conversation data and no identifiers beyond a random
|
|
7
7
|
* UUID generated in localStorage; the server hashes it with a deployment salt
|
|
8
8
|
* before storage and never persists IP addresses. Sends are fire-and-forget:
|
|
9
|
-
* failures stay silent and simply retry on a later mount or day.
|
|
10
|
-
* is
|
|
9
|
+
* failures stay silent and simply retry on a later mount or day. Frames where
|
|
10
|
+
* storage is unavailable report nothing.
|
|
11
|
+
*
|
|
12
|
+
* The family-wide opt-out and the browser's Do Not Track signal both suppress
|
|
13
|
+
* the heartbeat; the Web Plugins settings switch writes the same localStorage
|
|
14
|
+
* key. The system is documented in docs/telemetry.md.
|
|
11
15
|
*/
|
|
12
16
|
export type TelemetryChannel = 'market' | 'npm' | 'unknown';
|
|
13
17
|
export interface TelemetryItem {
|
|
@@ -18,6 +22,14 @@ export interface TelemetryItem {
|
|
|
18
22
|
/** Install channel when determinable (market = Workshop install). */
|
|
19
23
|
channel?: TelemetryChannel;
|
|
20
24
|
}
|
|
25
|
+
/** localStorage key carrying the family-wide telemetry opt-out ('1' = off). */
|
|
26
|
+
export declare const TELEMETRY_OPT_OUT_KEY = "dsh-web-ui-telemetry-opt-out";
|
|
27
|
+
/** Whether the user switched the family-wide opt-out on (reads storage only). */
|
|
28
|
+
export declare function isTelemetryOptedOut(): boolean;
|
|
29
|
+
/** Turn the family-wide opt-out on or off (writing '1' / removing the key); never throws. */
|
|
30
|
+
export declare function setTelemetryOptedOut(optedOut: boolean): void;
|
|
31
|
+
/** Whether a heartbeat must be suppressed right now: opt-out stored, or the browser asks not to be tracked. */
|
|
32
|
+
export declare function isTelemetrySuppressed(): boolean;
|
|
21
33
|
/**
|
|
22
34
|
* Fire the daily heartbeat for the given items at most once per UTC day per
|
|
23
35
|
* browser. Never throws and never blocks the caller. Items without an explicit
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@linxin666/dsh-client-ui-session-id",
|
|
3
3
|
"description": "DSH web GUI plugin: sidebar-foot Session ID panel listing every session with its full id and one-click copy (browser-only; no source changes).",
|
|
4
|
-
"version": "0.4.
|
|
4
|
+
"version": "0.4.9",
|
|
5
5
|
"icon": "icon.svg",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "lib/index.js",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
},
|
|
21
21
|
"dsh": {
|
|
22
22
|
"engines": {
|
|
23
|
-
"dsh": ">=0.2.1-rc.
|
|
23
|
+
"dsh": ">=0.2.1-rc.3"
|
|
24
24
|
},
|
|
25
25
|
"bundle": {
|
|
26
26
|
"patch": "./cordis.patch.yml"
|
|
@@ -34,18 +34,18 @@
|
|
|
34
34
|
}
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
|
-
"@deepseek-ai/dsh": ">=0.2.1-rc.
|
|
37
|
+
"@deepseek-ai/dsh": ">=0.2.1-rc.3",
|
|
38
38
|
"react": "^18.2.0"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@deepseek-ai/cordis": "^4.0.5",
|
|
42
|
-
"@deepseek-ai/dsh-api-remotes": "^0.2.1-rc.
|
|
43
|
-
"@deepseek-ai/dsh-api-session-controller": "^0.2.1-rc.
|
|
44
|
-
"@deepseek-ai/dsh-client-locale": "^0.2.1-rc.
|
|
45
|
-
"@deepseek-ai/dsh-client-ui-primitives": "^0.2.1-rc.
|
|
46
|
-
"@deepseek-ai/dsh-client-ui-renderer": "^0.2.1-rc.
|
|
47
|
-
"@deepseek-ai/dsh-client-ui-sidebar": "^0.2.1-rc.
|
|
48
|
-
"@deepseek-ai/dsh-client-ui-slots": "^0.2.1-rc.
|
|
42
|
+
"@deepseek-ai/dsh-api-remotes": "^0.2.1-rc.3",
|
|
43
|
+
"@deepseek-ai/dsh-api-session-controller": "^0.2.1-rc.3",
|
|
44
|
+
"@deepseek-ai/dsh-client-locale": "^0.2.1-rc.3",
|
|
45
|
+
"@deepseek-ai/dsh-client-ui-primitives": "^0.2.1-rc.3",
|
|
46
|
+
"@deepseek-ai/dsh-client-ui-renderer": "^0.2.1-rc.3",
|
|
47
|
+
"@deepseek-ai/dsh-client-ui-sidebar": "^0.2.1-rc.3",
|
|
48
|
+
"@deepseek-ai/dsh-client-ui-slots": "^0.2.1-rc.3",
|
|
49
49
|
"@testing-library/dom": "^10.4.1",
|
|
50
50
|
"@testing-library/react": "^16.1.0",
|
|
51
51
|
"@types/react": "~18.3.1",
|