dsh-links-panel 0.81.0 → 0.81.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/client.js CHANGED
@@ -3381,9 +3381,17 @@ window.__ModuleLoader__.load({
3381
3381
  /* fall through to the sidebar service */
3382
3382
  }
3383
3383
  }
3384
- if (ctx && ctx.sidebarRight && typeof ctx.sidebarRight.openTab === 'function') {
3384
+ let sidebar = ctx ? ctx.sidebarRight : undefined
3385
+ if (!sidebar && ctx && typeof ctx.get === 'function') {
3385
3386
  try {
3386
- ctx.sidebarRight.openTab(BROWSER_KIND, { params: { url: reference.url } })
3387
+ sidebar = ctx.get('sidebarRight')
3388
+ } catch (error) {
3389
+ sidebar = undefined
3390
+ }
3391
+ }
3392
+ if (sidebar && typeof sidebar.openTab === 'function') {
3393
+ try {
3394
+ sidebar.openTab(BROWSER_KIND, { params: { url: reference.url } })
3387
3395
  return
3388
3396
  } catch (error) {
3389
3397
  /* fall through to the system browser */
@@ -4150,10 +4158,10 @@ window.__ModuleLoader__.load({
4150
4158
  // ------------------------------------------------------------------
4151
4159
 
4152
4160
  /** Required browser services: the tab registry and the keyed seat. */
4153
- const inject = ['slots', 'sidebarRightTabs', 'sidebarRight', 'sessions', 'locale']
4161
+ const inject = ['slots', 'sidebarRightTabs', 'sessions', 'locale']
4154
4162
 
4155
4163
  /** Build stamp shown in the footer, so a stale bundle is visible at a glance. */
4156
- const BUILD = 'v0.81.0'
4164
+ const BUILD = 'v0.81.1'
4157
4165
  /**
4158
4166
  * Translate one key and fill `{name}` placeholders.
4159
4167
  * @param {string} key - dictionary key.
@@ -4524,13 +4532,33 @@ window.__ModuleLoader__.load({
4524
4532
  }
4525
4533
  for (const sessionId of ids) attach(sessionId)
4526
4534
  }
4527
- sync()
4528
- const off = sessions.list.subscribe(sync)
4535
+ // Never compete with application boot: start the tracker a couple of seconds
4536
+ // later, and never let a failure here escape into the plugin lifecycle.
4537
+ let off = () => {}
4538
+ const startTimer = setTimeout(() => {
4539
+ try {
4540
+ sync()
4541
+ off = sessions.list.subscribe(sync)
4542
+ } catch (error) {
4543
+ off = () => {}
4544
+ }
4545
+ }, 2000)
4529
4546
  return () => {
4530
- off()
4547
+ clearTimeout(startTimer)
4548
+ try {
4549
+ off()
4550
+ } catch (error) {
4551
+ /* ignore */
4552
+ }
4531
4553
  for (const tracker of trackers.values()) {
4532
4554
  if (tracker.timer !== null) clearTimeout(tracker.timer)
4533
- if (typeof tracker.dispose === 'function') tracker.dispose()
4555
+ if (typeof tracker.dispose === 'function') {
4556
+ try {
4557
+ tracker.dispose()
4558
+ } catch (error) {
4559
+ /* ignore */
4560
+ }
4561
+ }
4534
4562
  }
4535
4563
  trackers.clear()
4536
4564
  }
package/lib/index.js CHANGED
@@ -37,7 +37,7 @@ function withOutboundLock(task) {
37
37
  }
38
38
 
39
39
  /** Host build stamp, echoed to the panel so a stale bundle is detectable. */
40
- export const BUILD = 'v0.81.0'
40
+ export const BUILD = 'v0.81.1'
41
41
  /**
42
42
  * The desktop browser reaches the network through the system proxy; the Host's own
43
43
  * Node requests bypass it. Detect that proxy so probes can use the same route.
@@ -652,33 +652,28 @@ async function handleMetaRequest(ctx, cache, req, res) {
652
652
  * Host plugin body: register the metadata route.
653
653
  * @param {object} ctx - host context with the `web` and `webServer` services.
654
654
  */
655
+ /**
656
+ * Register one HTTP route defensively: a route failure must never take the whole
657
+ * harness host down (the desktop shell reports that as a startup/auth failure).
658
+ * @param {object} ctx - host context.
659
+ * @param {string} path - exact route path.
660
+ * @param {Function} handler - request handler.
661
+ * @param {string} label - effect label.
662
+ * @returns {void}
663
+ */
664
+ function registerRoute(ctx, path, handler, label) {
665
+ ctx.effect(() => {
666
+ try {
667
+ return ctx.webServer.register({ kind: 'exact', path, handler })
668
+ } catch (error) {
669
+ return () => {}
670
+ }
671
+ }, label)
672
+ }
673
+
655
674
  export function apply(ctx) {
656
675
  const cache = new Map()
657
- ctx.effect(
658
- () =>
659
- ctx.webServer.register({
660
- kind: 'exact',
661
- path: ROUTE_PATH,
662
- handler: (req, res) => handleMetaRequest(ctx, cache, req, res),
663
- }),
664
- 'dsh-links: metadata route',
665
- )
666
- ctx.effect(
667
- () =>
668
- ctx.webServer.register({
669
- kind: 'exact',
670
- path: FAVICON_ROUTE_PATH,
671
- handler: (req, res) => handleFaviconRequest(req, res),
672
- }),
673
- 'dsh-links: favicon route',
674
- )
675
- ctx.effect(
676
- () =>
677
- ctx.webServer.register({
678
- kind: 'exact',
679
- path: AI_TITLES_ROUTE_PATH,
680
- handler: (req, res) => handleTitlesRequest(ctx, req, res),
681
- }),
682
- 'dsh-links: ai titles route',
683
- )
676
+ registerRoute(ctx, ROUTE_PATH, (req, res) => handleMetaRequest(ctx, cache, req, res), 'dsh-links: metadata route')
677
+ registerRoute(ctx, FAVICON_ROUTE_PATH, (req, res) => handleFaviconRequest(req, res), 'dsh-links: favicon route')
678
+ registerRoute(ctx, AI_TITLES_ROUTE_PATH, (req, res) => handleTitlesRequest(ctx, req, res), 'dsh-links: ai titles route')
684
679
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-links-panel",
3
- "version": "0.81.0",
3
+ "version": "0.81.1",
4
4
  "description": "Reference links panel for DeepSeek Harness: collects every URL of a conversation into the right sidebar with pins, turn counts, metadata and favicon caching. DSH 右栏「应用链接」面板。",
5
5
  "license": "MIT",
6
6
  "type": "module",