@linxin666/dsh-client-ui-session-id 0.3.24 → 0.4.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.
- package/icon.svg +3 -0
- package/lib/client.js +18 -2
- package/lib/client.js.map +1 -1
- package/lib/types/client/main-session.d.ts +32 -0
- package/package.json +14 -11
package/icon.svg
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
|
|
2
|
+
<path fill="#4d6bfe" fill-rule="evenodd" d="M 67.5 120 L 70.5 120 L 72.5 121 L 80.5 129 L 81.5 129 L 84.5 132 L 85.5 132 L 90.5 136 L 93.5 137 L 95.5 139 L 101.5 142 L 103.5 142 L 106.5 144 L 111.5 145 L 112.5 146 L 115.5 146 L 119.5 148 Q 122.75 147.25 123.5 149 L 127.5 149 L 128.5 150 L 133.5 150 L 134.5 151 L 140.5 151 L 141.5 152 L 150.5 152 L 151.5 153 L 160.5 153 L 161.5 154 L 171.5 154 L 172.5 155 L 178.5 155 L 179.5 156 Q 183.5 155 184.5 157 L 189.5 157 Q 190.5 159 194.5 158 L 195.5 159 L 197.5 159 L 198.5 160 L 200.5 160 L 201.5 161 L 206.5 162 L 209.5 164 L 211.5 164 L 219.5 168 L 224.5 172 L 227.5 173 L 247 191.5 L 247 192.5 L 253 199.5 L 255.5 204 L 258 201.5 L 263 193.5 L 272.5 183 L 273.5 183 L 280.5 176 L 281.5 176 L 292.5 168 L 300.5 164 L 302.5 164 L 305.5 162 L 307.5 162 L 308.5 161 L 310.5 161 L 314.5 159 L 317.5 159 L 318.5 158 Q 321.75 158.75 322.5 157 L 326.5 157 L 327.5 156 L 331.5 156 L 332.5 155 L 337.5 155 L 338.5 154 L 348.5 154 L 349.5 153 L 358.5 153 L 359.5 152 L 368.5 152 L 369.5 151 L 376.5 151 L 377.5 150 L 383.5 150 L 384.5 149 L 388.5 149 L 389.5 148 L 392.5 148 L 393.5 147 L 396.5 147 L 397.5 146 L 399.5 146 L 400.5 145 L 405.5 144 L 423.5 135 L 426.5 132 L 431.5 129 L 439.5 121 L 441.5 120 L 444.5 120 L 448 123.5 L 448 140.5 L 447 141.5 L 447 149.5 L 446 150.5 L 446 154.5 L 445 155.5 Q 445.75 158.75 444 159.5 L 444 163.5 Q 442.25 164.25 443 167.5 L 440 173.5 L 439 178.5 L 435 185.5 L 435 187.5 L 432 193.5 L 430 195.5 L 429 198.5 L 427 200.5 L 425 204.5 L 419 211.5 L 419 212.5 L 402.5 229 L 401.5 229 L 394.5 235 L 393.5 235 L 388.5 239 L 385.5 240 L 383.5 242 L 371.5 248 L 369.5 248 L 364.5 251 L 362.5 251 L 361.5 252 L 359.5 252 L 358.5 253 L 356.5 253 L 355.5 254 L 353.5 254 L 349.5 256 L 342.5 257 L 338.5 259 L 335.5 259 L 334.5 260 L 327.5 261 L 326.5 262 L 324.5 262 L 323.5 263 L 321.5 263 L 320.5 264 L 318.5 264 L 317.5 265 L 312.5 266 L 309.5 268 L 307.5 268 L 295.5 275 L 288 282.5 Q 287.5 286 285 287.5 Q 285.5 290 284 290.5 L 284 293.5 L 283 294.5 L 283 311.5 L 284 312.5 L 284 318.5 L 285 319.5 L 285 323.5 L 286 324.5 L 286 328.5 Q 288 329.5 287 333.5 L 288 334.5 L 288 337.5 L 289 338.5 L 289 341.5 L 290 342.5 L 290 345.5 L 291 346.5 L 292 353.5 L 293 354.5 L 293 356.5 L 295 360.5 L 295 363.5 L 296 364.5 L 296 367.5 L 297 368.5 L 297 370.5 L 298 371.5 L 298 373.5 L 299 374.5 L 299 376.5 L 301 380.5 L 301 386.5 L 298.5 389 L 294.5 391 Q 292 390.5 291.5 392 L 286.5 392 L 285.5 393 L 272.5 393 L 271.5 394 L 240.5 394 L 239.5 393 L 227.5 393 L 226.5 392 L 221.5 392 Q 220.75 390.25 217.5 391 L 212 387.5 L 211 385.5 L 211 381.5 L 212 380.5 Q 211.5 378 213 377.5 L 213 374.5 L 214 373.5 L 214 371.5 L 216 367.5 L 216 364.5 L 217 363.5 L 217 361.5 L 219 357.5 L 219 354.5 L 221 350.5 L 221 347.5 L 222 346.5 L 222 343.5 L 223 342.5 L 223 339.5 L 224 338.5 L 224 335.5 L 225 334.5 Q 224.25 331.25 226 330.5 L 226 326.5 L 227 325.5 Q 226 321.5 228 320.5 L 228 315.5 L 229 314.5 L 229 292.5 L 228 291.5 L 227 286.5 L 225 284.5 L 223 280.5 L 219.5 277 L 218.5 277 L 212.5 272 L 202.5 267 L 200.5 267 L 197.5 265 L 194.5 265 L 193.5 264 L 191.5 264 L 190.5 263 L 188.5 263 L 184.5 261 L 181.5 261 L 180.5 260 L 173.5 259 L 172.5 258 L 170.5 258 L 166.5 256 L 159.5 255 L 158.5 254 L 156.5 254 L 155.5 253 L 150.5 252 L 147.5 250 L 145.5 250 L 142.5 248 L 140.5 248 L 128.5 242 L 123.5 238 L 120.5 237 L 109.5 228 L 108.5 228 L 95 214.5 L 95 213.5 L 87 204.5 L 84 198.5 L 82 196.5 L 80 191.5 L 77 187.5 L 77 185.5 L 72 175.5 L 72 173.5 L 71 172.5 L 71 170.5 L 69 166.5 L 69 163.5 L 68 162.5 Q 68.75 159.25 67 158.5 L 67 154.5 L 66 153.5 L 66 148.5 L 65 147.5 L 65 139.5 L 64 138.5 L 64 124.5 L 67.5 120 Z"/>
|
|
3
|
+
</svg>
|
package/lib/client.js
CHANGED
|
@@ -8,6 +8,21 @@ window.__ModuleLoader__.load({
|
|
|
8
8
|
let react_dom = require("react-dom");
|
|
9
9
|
let _deepseek_ai_dsh_client_ui_primitives = require("@deepseek-ai/dsh-client-ui-primitives");
|
|
10
10
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
11
|
+
//#region src/client/main-session.ts
|
|
12
|
+
/**
|
|
13
|
+
* Resolve the Session the main view currently shows.
|
|
14
|
+
*
|
|
15
|
+
* Reads the catalog's rows rather than a per-id retain-info source: ownership
|
|
16
|
+
* counts ride the list snapshot, so this neither allocates observers nor opens
|
|
17
|
+
* history, and a subscription to the list still fires when the selection moves.
|
|
18
|
+
* @param byId - the session catalog's rows (`SessionListState.byId`), when available.
|
|
19
|
+
* @returns the main-view session id, or undefined when the main view shows none.
|
|
20
|
+
*/
|
|
21
|
+
function mainViewSessionId(byId) {
|
|
22
|
+
if (byId === void 0 || byId === null) return void 0;
|
|
23
|
+
for (const row of Object.values(byId)) if (row !== void 0 && (row.retainedBy?.mainView ?? 0) > 0) return row.id;
|
|
24
|
+
}
|
|
25
|
+
//#endregion
|
|
11
26
|
//#region src/client/icons.tsx
|
|
12
27
|
/** Shared svg attrs for the 16px stroke icon family. */
|
|
13
28
|
function iconProps(props) {
|
|
@@ -197,6 +212,7 @@ window.__ModuleLoader__.load({
|
|
|
197
212
|
function SessionIdPanel({ list, onClose, t }) {
|
|
198
213
|
const snapshot = (0, react.useSyncExternalStore)(list.subscribe, list.getSnapshot);
|
|
199
214
|
const sorted = sortSessions(snapshot);
|
|
215
|
+
const currentId = mainViewSessionId(snapshot.byId);
|
|
200
216
|
const [search, setSearch] = (0, react.useState)("");
|
|
201
217
|
const query = search.trim().toLowerCase();
|
|
202
218
|
const rows = query === "" ? sorted : sorted.filter((row) => row.displayTitle.toLowerCase().includes(query) || row.id.toLowerCase().includes(query));
|
|
@@ -249,7 +265,7 @@ window.__ModuleLoader__.load({
|
|
|
249
265
|
className: session_id_module_css_default.list,
|
|
250
266
|
children: rows.map((row) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SessionRow, {
|
|
251
267
|
session: row,
|
|
252
|
-
current:
|
|
268
|
+
current: currentId,
|
|
253
269
|
t
|
|
254
270
|
}, row.id))
|
|
255
271
|
})
|
|
@@ -345,7 +361,7 @@ window.__ModuleLoader__.load({
|
|
|
345
361
|
/** The building package's version, when the bundle carries it. */
|
|
346
362
|
function bakedVersion() {
|
|
347
363
|
try {
|
|
348
|
-
return "0.
|
|
364
|
+
return "0.4.0";
|
|
349
365
|
} catch {
|
|
350
366
|
return;
|
|
351
367
|
}
|
package/lib/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","names":["css","css"],"sources":["../../../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":["/**\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 { 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 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={snapshot.current} 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":";;;;;;;;;;;;EAOA,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,GAAE;KAAM,OAAM;KAAI,QAAO;KAAI,IAAG;IAAO,CAAA,GACrD,iBAAA,GAAA,kBAAA,IAAA,CAAC,QAAD,EAAM,GAAE,qCAAsC,CAAA,CAC3C;;EAET;;EAGA,SAAgB,UAAU,OAAgC;GACxD,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;IAAK,GAAI,UAAU,KAAK;cACtB,iBAAA,GAAA,kBAAA,IAAA,CAAC,QAAD,EAAM,GAAE,sBAAuB,CAAA;GAC5B,CAAA;EAET;;EAGA,SAAgB,UAAU,OAAgC;GACxD,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;IAAK,GAAI,UAAU,KAAK;cACtB,iBAAA,GAAA,kBAAA,IAAA,CAAC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KACtD,MAAM,UAAU,KAAK,WAAW,aAAa;KAC7C,IAAI,YAAY,KAAA,GAAW,IAAI,UAAU;KACzC,IAAI,KAAK,YAAY,KAAA,GAAW,IAAI,UAAU,KAAK;KACnD,OAAO;IACT,CAAC;IACD,MAAM,OAAO,KAAK,UAAU;KAAE,MAAM;KAAa;KAAS,OAAO;IAAa,CAAC;IAC/E,MAAW,UAAU;KACnB,QAAQ;KACR,SAAS,EAAE,gBAAgB,mBAAmB;KAC9C;KACA,WAAW;IACb,CAAC,CAAC,CAAC,MAAM,aAAa;KAGpB,IAAI,SAAS,IAAI,aAAa,QAAQ,iBAAiB,OAAO,GAAG;IACnE,CAAC,CAAC,CAAC,YAAY,CAA0C,CAAC;GAC5D,QAAQ,CAA+C;EACzD;;;;EC3EA,MAAM,KAAK;;EAGX,MAAM,WAAW;;EAGjB,MAAa,SAAS;GAAC;GAAS;GAAU;EAAU;;;;;EAMpD,SAAgB,MAAM,KAA0B;GAG9C,qBAAqB,CAAC,EAAE,MAAM,sCAAsC,CAAC,CAAC;GAEtE,IAAI,aAAa;IACf,IAAI;KACF,OAAO,IAAI,OAAO,SAAS,IAAI;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"}
|
|
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,IA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
* The Client Session Controller carries no global "current" selection: view
|
|
5
|
+
* selection belongs to the workspace UI, which owns the main-area reference and
|
|
6
|
+
* publishes it through the catalog's per-source ownership counts
|
|
7
|
+
* (`SessionSummary.retainedBy.mainView`). A plugin that needs the Session the
|
|
8
|
+
* main view shows derives it from that marker instead of the removed
|
|
9
|
+
* `SessionListState.current` field.
|
|
10
|
+
*
|
|
11
|
+
* The marker describes view ownership, not authority. It is the right input for
|
|
12
|
+
* presentation and for deciding which view a navigation targets; it is not a
|
|
13
|
+
* business fallback, because source counts never imply visibility or success.
|
|
14
|
+
* @module dsh-web/shared/main-session
|
|
15
|
+
*/
|
|
16
|
+
/** The catalog row subset this helper reads (a `SessionSummary` projection). */
|
|
17
|
+
export interface MainViewOwnedRow<Id extends string = string> {
|
|
18
|
+
/** Catalog row identity. */
|
|
19
|
+
readonly id: Id;
|
|
20
|
+
/** Per-source local ownership counts; absent rows are never owned. */
|
|
21
|
+
readonly retainedBy?: Readonly<Partial<Record<string, number>>> | undefined;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Resolve the Session the main view currently shows.
|
|
25
|
+
*
|
|
26
|
+
* Reads the catalog's rows rather than a per-id retain-info source: ownership
|
|
27
|
+
* counts ride the list snapshot, so this neither allocates observers nor opens
|
|
28
|
+
* history, and a subscription to the list still fires when the selection moves.
|
|
29
|
+
* @param byId - the session catalog's rows (`SessionListState.byId`), when available.
|
|
30
|
+
* @returns the main-view session id, or undefined when the main view shows none.
|
|
31
|
+
*/
|
|
32
|
+
export declare function mainViewSessionId<Id extends string>(byId: Readonly<Record<Id, MainViewOwnedRow<Id> | undefined>> | undefined | null): Id | undefined;
|
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
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
|
+
"version": "0.4.0",
|
|
5
|
+
"icon": "icon.svg",
|
|
5
6
|
"type": "module",
|
|
6
7
|
"main": "lib/index.js",
|
|
7
8
|
"types": "lib/types/index.d.ts",
|
|
@@ -23,7 +24,7 @@
|
|
|
23
24
|
},
|
|
24
25
|
"dsh": {
|
|
25
26
|
"engines": {
|
|
26
|
-
"dsh": ">=0.1.
|
|
27
|
+
"dsh": ">=0.1.7-rc.1"
|
|
27
28
|
},
|
|
28
29
|
"bundle": {
|
|
29
30
|
"patch": "./cordis.patch.yml"
|
|
@@ -37,17 +38,18 @@
|
|
|
37
38
|
}
|
|
38
39
|
},
|
|
39
40
|
"peerDependencies": {
|
|
41
|
+
"@deepseek-ai/dsh": ">=0.1.7-rc.1",
|
|
40
42
|
"react": "^18.2.0"
|
|
41
43
|
},
|
|
42
44
|
"devDependencies": {
|
|
43
|
-
"@deepseek-ai/cordis": "^4.0.
|
|
44
|
-
"@deepseek-ai/dsh-api-remotes": "^0.1.
|
|
45
|
-
"@deepseek-ai/dsh-api-session-controller": "^0.1.
|
|
46
|
-
"@deepseek-ai/dsh-client-locale": "^0.1.
|
|
47
|
-
"@deepseek-ai/dsh-client-ui-primitives": "^0.1.
|
|
48
|
-
"@deepseek-ai/dsh-client-ui-renderer": "^0.1.
|
|
49
|
-
"@deepseek-ai/dsh-client-ui-sidebar": "^0.1.
|
|
50
|
-
"@deepseek-ai/dsh-client-ui-slots": "^0.1.
|
|
45
|
+
"@deepseek-ai/cordis": "^4.0.4",
|
|
46
|
+
"@deepseek-ai/dsh-api-remotes": "^0.1.7-rc.1",
|
|
47
|
+
"@deepseek-ai/dsh-api-session-controller": "^0.1.7-rc.1",
|
|
48
|
+
"@deepseek-ai/dsh-client-locale": "^0.1.7-rc.1",
|
|
49
|
+
"@deepseek-ai/dsh-client-ui-primitives": "^0.1.7-rc.1",
|
|
50
|
+
"@deepseek-ai/dsh-client-ui-renderer": "^0.1.7-rc.1",
|
|
51
|
+
"@deepseek-ai/dsh-client-ui-sidebar": "^0.1.7-rc.1",
|
|
52
|
+
"@deepseek-ai/dsh-client-ui-slots": "^0.1.7-rc.1",
|
|
51
53
|
"@testing-library/dom": "^10.4.1",
|
|
52
54
|
"@testing-library/react": "^16.1.0",
|
|
53
55
|
"@types/react": "~18.3.1",
|
|
@@ -65,7 +67,8 @@
|
|
|
65
67
|
"cordis.patch.yml",
|
|
66
68
|
"README.md",
|
|
67
69
|
"README.zh.md",
|
|
68
|
-
"README.i18n.yaml"
|
|
70
|
+
"README.i18n.yaml",
|
|
71
|
+
"icon.svg"
|
|
69
72
|
],
|
|
70
73
|
"license": "Apache-2.0",
|
|
71
74
|
"scripts": {
|