dsh-remote 0.8.89 → 0.8.91

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
@@ -3879,7 +3879,9 @@ window.__ModuleLoader__.load({
3879
3879
  * null. A Windows drive colon never trails a digit sequence after a path
3880
3880
  * separator, and `path:0` is meaningless, so the strip is unambiguous. */
3881
3881
  function splitLineAnchor(rawPath) {
3882
- const m = /:(\d+)$/.exec(String(rawPath || ''))
3882
+ // Trailing `:42` or range `:24-30` / `:24:7` (the latter two keep the
3883
+ // start line, mirroring the core's own resolver).
3884
+ const m = /:(\d+)(?::\d+|-\d+)?$/.exec(String(rawPath || ''))
3883
3885
  if (!m) return { path: String(rawPath || ''), line: null }
3884
3886
  const line = Number(m[1])
3885
3887
  const path = String(rawPath).slice(0, m.index)
@@ -4209,10 +4211,11 @@ window.__ModuleLoader__.load({
4209
4211
  // Dropping the leading empty segment keeps a session-root address ('') a
4210
4212
  // legitimate empty path instead of turning it into '/'.
4211
4213
  const decoded = decodeURIComponent(tail.slice(1).join('/'))
4212
- // Issue #104: models cite lines as `path:42` or `path#L42`; the core keeps
4213
- // `:` literal in segments, so both reach us intact. Strip the anchor from
4214
- // the path (resolution must not look for a file literally named "x.c:42").
4215
- const hashLine = /^#L?(\d+)$/i.exec(url.hash || '')
4214
+ // Issue #104 + #108: models cite lines as `path:42` / `path#L42`, and as
4215
+ // RANGES (`path:24-30`, `#L24-L30`) — the core's own prompt teaches the
4216
+ // range form. Range or not, the anchor is stripped from the path (no file
4217
+ // is ever looked up as "x.c:42"); we take the start line, like the core.
4218
+ const hashLine = /^#L?(\d+)(?:-L?\d+)?$/i.exec(url.hash || '')
4216
4219
  const split = splitLineAnchor(decoded)
4217
4220
  const line = hashLine ? Number(hashLine[1]) : split.line
4218
4221
  return { sessionId, path: split.path, ...(line ? { line } : {}) }
@@ -4321,13 +4324,21 @@ window.__ModuleLoader__.load({
4321
4324
  return React.createElement('div', { style: { padding: 16, fontSize: 12, opacity: 0.7 } },
4322
4325
  tr('file.linkUnresolved'))
4323
4326
  }
4327
+ // Issue #104 + #108: the line reaches us two ways — inside the address
4328
+ // (`x.c:42` / `#L42`, ranges take the start line) and, on 0.2.x, through
4329
+ // navigation params (`openResource(url, {params:{line}})`); the address
4330
+ // grammar itself never carries one.
4331
+ const paramsLine = (() => {
4332
+ try {
4333
+ const n = Number(info.tab && info.tab.navigation && info.tab.navigation.params && info.tab.navigation.params.line)
4334
+ return Number.isInteger(n) && n >= 1 ? n : null
4335
+ } catch { return null }
4336
+ })()
4324
4337
  return React.createElement(RemoteFileTab, {
4325
4338
  key: remotePath,
4326
4339
  tab: { path: remotePath },
4327
4340
  scope: { sessionId },
4328
- // Issue #104: a chat link carrying a line (`x.c:42` or `…#L42`) lands
4329
- // the open file on that line instead of its top.
4330
- jumpLine: (parsed && parsed.line) || null,
4341
+ jumpLine: (parsed && parsed.line) || paramsLine,
4331
4342
  })
4332
4343
  }
4333
4344
  /** The local cwd of a session, from the client's own session store. */
@@ -4436,7 +4447,13 @@ window.__ModuleLoader__.load({
4436
4447
  try {
4437
4448
  const dispose = tabs.register({
4438
4449
  id: NATIVE_LINK, kind: NATIVE_LINK,
4439
- patterns: ['dsh-resource://file/**'],
4450
+ // Specificity beats bundle order: the registry ranks longest-glob-first,
4451
+ // and ties fall to registration order (which we do not control). Another
4452
+ // extension claiming `dsh-resource://file/**` used to win those ties and
4453
+ // read the local mirror (ENOENT) even for provably remote sessions
4454
+ // (issue #108). The narrower glob matches exactly what
4455
+ // parseCoreFileAddress accepts — the session scope.
4456
+ patterns: ['dsh-resource://file/session/**'],
4440
4457
  canOpen: (address) => {
4441
4458
  const parsed = parseCoreFileAddress(address)
4442
4459
  if (!parsed) return false