dsh-linked-workspace 0.13.0 → 0.15.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/lib/index.js CHANGED
@@ -32,6 +32,27 @@ export const name = 'dsh-linked-workspace'
32
32
  /** The web server carries the JSON API; the rest are the linked-workspace tool faces. */
33
33
  export const inject = ['webServer', 'tools', 'systemPrompt', 'workingDirectory']
34
34
 
35
+ /**
36
+ * Bumped whenever the Client half starts relying on a newer Host method table.
37
+ * The Client compares this number with its own and warns when the DSH process
38
+ * is still running an older copy of the Host — refreshing the page only swaps
39
+ * the browser bundle, so the two halves can drift by one restart.
40
+ */
41
+ const API_REVISION = 2
42
+
43
+ /** When this copy of the Host was loaded; shown by `meta.info`. */
44
+ const STARTED_AT = new Date().toISOString()
45
+
46
+ /** The published plugin version, read once so `meta.info` can report it. */
47
+ const PACKAGE_VERSION = (() => {
48
+ try {
49
+ const file = fileURLToPath(new URL('../package.json', import.meta.url))
50
+ return JSON.parse(readFileSync(file, 'utf8')).version || ''
51
+ } catch {
52
+ return ''
53
+ }
54
+ })()
55
+
35
56
  const DATA_VERSION = 1
36
57
  const SETTINGS_VERSION = 1
37
58
  const SETTINGS_DEFAULTS = Object.freeze({ editorTheme: 'github-light', editorThemeFamily: 'github', editorThemeMode: 'system', fileOpenMode: 'editor', autoSave: false })
@@ -1545,7 +1566,7 @@ export function apply(ctx) {
1545
1566
  }
1546
1567
 
1547
1568
  /** Copy one local file/folder of a linked workspace to the same relative remote path. */
1548
- const transferLocalToRemote = async (record, remote, rawPath) => {
1569
+ const transferLocalToRemote = async (record, remote, rawPath, job = null) => {
1549
1570
  const localRoot = resolve(record.localPath)
1550
1571
  const source = resolve(String(rawPath || ''))
1551
1572
  if (source !== localRoot && !source.startsWith(localRoot + sep) && !source.startsWith(localRoot + '/')) {
@@ -1557,6 +1578,7 @@ export function apply(ctx) {
1557
1578
  const target = posix.join(record.remotePath, relative)
1558
1579
  const limits = { files: 0, bytes: 0, skipped: 0, truncated: false }
1559
1580
  const visit = async (localPath, remotePath, depth) => {
1581
+ assertTransferAlive(job)
1560
1582
  if (depth > CONTEXT_TREE_LIMITS.maxDepth || limits.files >= CONTEXT_TREE_LIMITS.maxFiles || limits.bytes >= CONTEXT_TREE_LIMITS.maxBytes) {
1561
1583
  limits.truncated = true
1562
1584
  return
@@ -1595,17 +1617,19 @@ export function apply(ctx) {
1595
1617
  await withTimeout(remote.writeFileAtomic(remotePath, data), LINKED_SYNC_TIMEOUT_MS, `transfer ${relative}`)
1596
1618
  limits.files += 1
1597
1619
  limits.bytes += data.length
1620
+ countTransferred(job, data.length)
1598
1621
  }
1599
1622
  await visit(source, target, 0)
1600
1623
  return { side: 'local', files: limits.files, bytes: limits.bytes, skipped: limits.skipped, truncated: limits.truncated, target }
1601
1624
  }
1602
1625
 
1603
1626
  /** Explicit SFTP transfer of one remote file/folder into <local>/.remote. */
1604
- const transferToMirror = async (record, remote, target) => {
1627
+ const transferToMirror = async (record, remote, target, job = null) => {
1605
1628
  const relative = linkedRelative(record, target)
1606
1629
  if (relative === '') throw new ApiError('BAD_REQUEST', '不能传输联动工作区根目录')
1607
1630
  const limits = { files: 0, bytes: 0, skipped: 0, truncated: false }
1608
1631
  const visit = async (remotePath, rel, depth) => {
1632
+ assertTransferAlive(job)
1609
1633
  if (depth > CONTEXT_TREE_LIMITS.maxDepth || limits.files >= CONTEXT_TREE_LIMITS.maxFiles || limits.bytes >= CONTEXT_TREE_LIMITS.maxBytes) {
1610
1634
  limits.truncated = true
1611
1635
  return
@@ -1631,6 +1655,7 @@ export function apply(ctx) {
1631
1655
  await linkedFs.writeMirrorFile(record.localPath, rel, read.data)
1632
1656
  limits.files += 1
1633
1657
  limits.bytes += read.data.length
1658
+ countTransferred(job, read.data.length)
1634
1659
  }
1635
1660
  const stat = await remote.stat(target)
1636
1661
  if (stat.type !== 'dir') {
@@ -1643,6 +1668,46 @@ export function apply(ctx) {
1643
1668
  return { ...limits, dest: join(record.localPath, linkedFs.MIRROR_DIR, relative) }
1644
1669
  }
1645
1670
 
1671
+ // ── transfer progress ──────────────────────────────────────────────────
1672
+ //
1673
+ // A transfer is a sequence of whole-file requests, so progress is "how many
1674
+ // files and bytes landed so far" rather than a percentage: the Host never
1675
+ // walks the tree twice. Cancellation is cooperative — the flag is checked
1676
+ // between files, so a cancel never leaves a half-written file behind.
1677
+
1678
+ const TRANSFER_JOB_TTL_MS = 5 * 60 * 1000
1679
+ const transferJobs = new Map()
1680
+
1681
+ const beginTransferJob = (id) => {
1682
+ if (typeof id !== 'string' || id.trim() === '') return null
1683
+ const now = Date.now()
1684
+ for (const [key, value] of transferJobs) {
1685
+ if (now - value.updatedAt > TRANSFER_JOB_TTL_MS) transferJobs.delete(key)
1686
+ }
1687
+ const job = { id, files: 0, bytes: 0, skipped: 0, state: 'running', cancelled: false, reason: '', updatedAt: now }
1688
+ transferJobs.set(id, job)
1689
+ return job
1690
+ }
1691
+
1692
+ const finishTransferJob = (job, state, reason = '') => {
1693
+ if (!job) return
1694
+ job.state = state
1695
+ job.reason = reason
1696
+ job.updatedAt = Date.now()
1697
+ }
1698
+
1699
+ /** Throw when the client asked the running transfer to stop. */
1700
+ const assertTransferAlive = (job) => {
1701
+ if (job && job.cancelled) throw new ApiError('CANCELLED', '传输已取消')
1702
+ }
1703
+
1704
+ const countTransferred = (job, size) => {
1705
+ if (!job) return
1706
+ job.files += 1
1707
+ job.bytes += size
1708
+ job.updatedAt = Date.now()
1709
+ }
1710
+
1646
1711
  /** Download one remote file/folder into the OS Downloads folder. */
1647
1712
  const downloadRemotePath = async (remote, target, destDir) => {
1648
1713
  await mkdir(destDir, { recursive: true })
@@ -1783,7 +1848,7 @@ export function apply(ctx) {
1783
1848
  }
1784
1849
 
1785
1850
  async function docTarget(params) {
1786
- if (params.linkedId || params.workspaceId) {
1851
+ if (params.linkedId || params.remoteId || params.workspaceId) {
1787
1852
  const scope = await requireScope(params)
1788
1853
  const target = scopeTarget(scope, params.path)
1789
1854
  return { remote: true, scope, path: target }
@@ -1890,24 +1955,70 @@ export function apply(ctx) {
1890
1955
  const GREP_MAX_FILES = 2000
1891
1956
  const GREP_MAX_BYTES = 8 * 1024 * 1024
1892
1957
  const GREP_DEADLINE_MS = 5000
1958
+ const GREP_PREVIEW_CHARS = 120
1959
+ const GREP_MAX_QUERY = 200
1960
+
1961
+ // Dependency trees and build output make a content search useless: they
1962
+ // dwarf the project and always win the result budget. Both sides skip them.
1963
+ const GREP_EXCLUDED_DIRS = [
1964
+ '.git', '.hg', '.svn', 'node_modules', '.local', '.remote', '__pycache__',
1965
+ '.conda', 'conda-meta', '.venv', 'venv', 'site-packages', 'dist', 'build',
1966
+ 'target', '.next', '.nuxt', '.cache', '.mypy_cache', '.pytest_cache',
1967
+ '.ipynb_checkpoints', '.gradle', '.idea', '.vscode',
1968
+ ]
1893
1969
 
1894
1970
  function grepDirectoryExcluded(name) {
1895
- return LINKED_SYNC_EXCLUDES.has(name) || name === '.local' || name === '.remote'
1971
+ return LINKED_SYNC_EXCLUDES.has(name) || GREP_EXCLUDED_DIRS.indexOf(name) !== -1
1896
1972
  }
1897
1973
 
1898
- function contentSearchLocal(root, query, maxResults) {
1899
- const needle = Buffer.from(query, 'utf8')
1974
+ /** Compile the query once: a plain substring match or a regular expression. */
1975
+ function compileSearch(query, options) {
1976
+ const ignoreCase = Boolean(options && options.ignoreCase)
1977
+ if (options && options.regex) {
1978
+ let expression
1979
+ try {
1980
+ expression = new RegExp(query, ignoreCase ? 'i' : '')
1981
+ } catch (error) {
1982
+ throw new ApiError('BAD_REQUEST', `正则表达式无效:${error.message}`)
1983
+ }
1984
+ return {
1985
+ test: (text) => expression.test(text),
1986
+ lineTest: (line) => expression.test(line),
1987
+ }
1988
+ }
1989
+ const needle = ignoreCase ? query.toLowerCase() : query
1990
+ return {
1991
+ test: (text) => (ignoreCase ? text.toLowerCase() : text).includes(needle),
1992
+ lineTest: (line) => (ignoreCase ? line.toLowerCase() : line).includes(needle),
1993
+ }
1994
+ }
1995
+
1996
+ /** First line (1-based) that matches, plus a trimmed preview of it. */
1997
+ function firstMatchLine(text, matcher) {
1998
+ const lines = text.split('\n')
1999
+ for (let index = 0; index < lines.length; index += 1) {
2000
+ if (matcher.lineTest(lines[index])) {
2001
+ return { line: index + 1, preview: lines[index].replace(/\s+/g, ' ').trim().slice(0, GREP_PREVIEW_CHARS) }
2002
+ }
2003
+ }
2004
+ return { line: 0, preview: '' }
2005
+ }
2006
+
2007
+ function contentSearchLocal(root, query, maxResults, options = {}) {
2008
+ const matcher = compileSearch(query, options)
1900
2009
  const entries = []
1901
2010
  const started = Date.now()
1902
2011
  let files = 0
1903
2012
  let bytes = 0
1904
- let truncated = false
2013
+ let truncatedReason = ''
2014
+ const stop = (reason) => {
2015
+ if (truncatedReason === '') truncatedReason = reason
2016
+ }
1905
2017
  const visit = (directory, prefix) => {
1906
- if (truncated) return
1907
- if (files >= GREP_MAX_FILES || bytes >= GREP_MAX_BYTES || Date.now() - started > GREP_DEADLINE_MS) {
1908
- truncated = true
1909
- return
1910
- }
2018
+ if (truncatedReason !== '') return
2019
+ if (files >= GREP_MAX_FILES) return stop('files')
2020
+ if (bytes >= GREP_MAX_BYTES) return stop('bytes')
2021
+ if (Date.now() - started > GREP_DEADLINE_MS) return stop('deadline')
1911
2022
  let listing
1912
2023
  try {
1913
2024
  listing = readdirSync(directory, { withFileTypes: true })
@@ -1915,7 +2026,7 @@ export function apply(ctx) {
1915
2026
  return
1916
2027
  }
1917
2028
  for (const entry of listing) {
1918
- if (truncated) return
2029
+ if (truncatedReason !== '') return
1919
2030
  if (grepDirectoryExcluded(entry.name)) continue
1920
2031
  const absolute = join(directory, entry.name)
1921
2032
  const relative = prefix === '' ? entry.name : `${prefix}/${entry.name}`
@@ -1924,51 +2035,98 @@ export function apply(ctx) {
1924
2035
  continue
1925
2036
  }
1926
2037
  if (!entry.isFile()) continue
1927
- if (files >= GREP_MAX_FILES || bytes >= GREP_MAX_BYTES || Date.now() - started > GREP_DEADLINE_MS) {
1928
- truncated = true
1929
- return
1930
- }
2038
+ if (files >= GREP_MAX_FILES) return stop('files')
2039
+ if (bytes >= GREP_MAX_BYTES) return stop('bytes')
2040
+ if (Date.now() - started > GREP_DEADLINE_MS) return stop('deadline')
1931
2041
  files += 1
2042
+ // Skip oversized files before reading them: pulling a 2 GB blob into
2043
+ // memory to answer a text query would stall the whole Host.
2044
+ try {
2045
+ if (statSync(absolute).size > GREP_MAX_FILE_BYTES) continue
2046
+ } catch {
2047
+ continue
2048
+ }
1932
2049
  let data
1933
2050
  try {
1934
2051
  data = readFileSync(absolute)
1935
2052
  } catch {
1936
2053
  continue
1937
2054
  }
1938
- if (data.length > GREP_MAX_FILE_BYTES) continue
1939
2055
  bytes += data.length
1940
2056
  if (data.includes(0)) continue
1941
- if (data.indexOf(needle) === -1) continue
1942
- if (entries.length >= maxResults) {
1943
- truncated = true
1944
- return
1945
- }
1946
- entries.push({ path: absolute, relative, size: data.length })
2057
+ const text = data.toString('utf8')
2058
+ if (!matcher.test(text)) continue
2059
+ if (entries.length >= maxResults) return stop('results')
2060
+ const hit = firstMatchLine(text, matcher)
2061
+ entries.push({ path: absolute, relative, size: data.length, line: hit.line, preview: hit.preview })
1947
2062
  }
1948
2063
  }
1949
2064
  visit(resolve(root), '')
1950
- return { ok: true, query, entries, truncated }
2065
+ return { ok: true, query, entries, truncated: truncatedReason !== '', truncatedReason }
1951
2066
  }
1952
2067
 
1953
- async function contentSearchRemote(remote, root, query, maxResults) {
1954
- const command = 'grep -rIl --binary-files=without-match'
1955
- + ' --exclude-dir=.git --exclude-dir=node_modules --exclude-dir=.local'
1956
- + ' --exclude-dir=.remote --exclude-dir=__pycache__'
1957
- + ` -e ${shellQuoteArg(query)} -- ${shellQuoteArg(root)} 2>/dev/null`
1958
- + ` | head -n ${maxResults + 1}`
1959
- const result = await remote.exec(command, { timeoutMs: 20000 })
1960
- if (result.code !== 0 && result.stdout.trim() === '') {
2068
+ async function contentSearchRemote(remote, root, query, maxResults, options = {}) {
2069
+ const ignoreCase = Boolean(options.ignoreCase)
2070
+ const useRegex = Boolean(options.regex)
2071
+ if (useRegex) {
2072
+ try {
2073
+ // Validate here so a bad pattern is reported as a user error instead of
2074
+ // surfacing as an opaque grep exit code 2.
2075
+ new RegExp(query)
2076
+ } catch (error) {
2077
+ throw new ApiError('BAD_REQUEST', `正则表达式无效:${error.message}`)
2078
+ }
2079
+ }
2080
+ let searchRoot = root
2081
+ const subPath = typeof options.path === 'string' ? options.path.trim() : ''
2082
+ if (subPath !== '') {
2083
+ const normalized = posix.normalize(subPath).replace(/^\/+/, '')
2084
+ if (normalized === '..' || normalized.startsWith('../')) throw new ApiError('BAD_REQUEST', '搜索路径超出工作区范围')
2085
+ searchRoot = normalized === '' ? root : posix.join(root, normalized)
2086
+ }
2087
+ const excludes = GREP_EXCLUDED_DIRS.map((dir) => `--exclude-dir=${shellQuoteArg(dir)}`).join(' ')
2088
+ const pattern = useRegex ? `-E ${shellQuoteArg(query)}` : `-e ${shellQuoteArg(query)}`
2089
+ const command = `grep -rIn${ignoreCase ? 'i' : ''} --binary-files=without-match ${excludes} ${pattern}`
2090
+ + ` -- ${shellQuoteArg(searchRoot)} 2>/dev/null | head -n ${maxResults + 1}`
2091
+ let result
2092
+ try {
2093
+ result = await remote.exec(command, { timeoutMs: 20000 })
2094
+ } catch (error) {
2095
+ // A timeout means "we looked, but not everywhere": report it as a
2096
+ // truncated result instead of failing the whole search.
2097
+ return { ok: true, query, entries: [], truncated: true, truncatedReason: 'deadline' }
2098
+ }
2099
+ if (result.code !== 0 && String(result.stdout || '').trim() === '') {
1961
2100
  // grep exits 1 when nothing matched; a real failure has code > 1.
1962
- if (result.code > 1) throw new ApiError('INTERNAL', `内容搜索失败:${String(result.stderr || '').trim().slice(0, 200)}`)
1963
- return { ok: true, query, entries: [], truncated: false }
1964
- }
1965
- const lines = String(result.stdout || '').split('\n').map((line) => line.trim()).filter((line) => line !== '')
1966
- const truncated = lines.length > maxResults
1967
- const entries = lines.slice(0, maxResults).map((line) => {
1968
- const relative = line.startsWith(`${root}/`) ? line.slice(root.length + 1) : line
1969
- return { path: line, relative, size: null }
1970
- })
1971
- return { ok: true, query, entries, truncated }
2101
+ if (result.code > 1) {
2102
+ const detail = String(result.stderr || '').trim().slice(0, 200)
2103
+ if (result.code === 2 && /invalid/i.test(detail)) throw new ApiError('BAD_REQUEST', `正则表达式无效:${detail}`)
2104
+ throw new ApiError('INTERNAL', `内容搜索失败:${detail}`)
2105
+ }
2106
+ return { ok: true, query, entries: [], truncated: false, truncatedReason: '' }
2107
+ }
2108
+ const lines = String(result.stdout || '').split('\n').filter((line) => line.trim() !== '')
2109
+ const entries = []
2110
+ let truncatedReason = ''
2111
+ for (const raw of lines) {
2112
+ if (entries.length >= maxResults) {
2113
+ truncatedReason = 'results'
2114
+ break
2115
+ }
2116
+ const match = /^(.*?):(\d+):(.*)$/.exec(raw)
2117
+ if (!match) continue
2118
+ const file = match[1]
2119
+ const relative = file.startsWith(`${searchRoot}/`) ? file.slice(searchRoot.length + 1) : file
2120
+ entries.push({
2121
+ path: file,
2122
+ relative,
2123
+ size: null,
2124
+ line: Number(match[2]),
2125
+ preview: match[3].replace(/\s+/g, ' ').trim().slice(0, GREP_PREVIEW_CHARS),
2126
+ })
2127
+ }
2128
+ if (truncatedReason === '' && lines.length > maxResults) truncatedReason = 'results'
2129
+ return { ok: true, query, entries, truncated: truncatedReason !== '', truncatedReason }
1972
2130
  }
1973
2131
 
1974
2132
  // ── method table ─────────────────────────────────────────────────────────
@@ -2054,6 +2212,24 @@ export function apply(ctx) {
2054
2212
  }
2055
2213
  },
2056
2214
 
2215
+ async 'hosts.mkdir'(params = {}) {
2216
+ const host = await findHost(params.hostId)
2217
+ const remote = await connectHost(host)
2218
+ const rawParent = typeof params.path === 'string' && params.path.trim() !== ''
2219
+ ? params.path
2220
+ : await remote.homeDir()
2221
+ const parent = await normalizeRemotePath(remote, rawParent)
2222
+ const name = typeof params.name === 'string' ? params.name.trim() : ''
2223
+ if (name === '' || name === '.' || name === '..' || /[/\\\u0000]/.test(name)) {
2224
+ throw new ApiError('BAD_REQUEST', '文件夹名称无效')
2225
+ }
2226
+ const target = posix.join(parent, name)
2227
+ const existing = await remote.stat(target).catch(() => null)
2228
+ if (existing) throw new ApiError('FS_EXISTS', `远程目录已存在: ${target}`)
2229
+ await remote.mkdirp(target)
2230
+ return { path: target }
2231
+ },
2232
+
2057
2233
  async 'fs.list'(params = {}) {
2058
2234
  const scope = await requireScope(params)
2059
2235
  const target = params.path === undefined || params.path === ''
@@ -2397,13 +2573,50 @@ export function apply(ctx) {
2397
2573
  async 'fs.transfer'(params = {}) {
2398
2574
  const scope = await requireScope(params)
2399
2575
  if (scope.kind !== 'linked') throw new ApiError('BAD_REQUEST', '只有联动工作区支持文件传输')
2400
- if (params.side === 'local') {
2401
- const result = await transferLocalToRemote(scope.record, scope.remote, params.path)
2402
- forgetListings()
2576
+ const job = beginTransferJob(params.jobId)
2577
+ try {
2578
+ if (params.side === 'local') {
2579
+ const result = await transferLocalToRemote(scope.record, scope.remote, params.path, job)
2580
+ forgetListings()
2581
+ finishTransferJob(job, 'done')
2582
+ return result
2583
+ }
2584
+ const target = scopeTarget(scope, params.path)
2585
+ const result = await transferToMirror(scope.record, scope.remote, target, job)
2586
+ finishTransferJob(job, 'done')
2403
2587
  return result
2588
+ } catch (error) {
2589
+ finishTransferJob(job, error && error.code === 'CANCELLED' ? 'cancelled' : 'failed', error && error.message ? error.message : '')
2590
+ throw error
2404
2591
  }
2405
- const target = scopeTarget(scope, params.path)
2406
- return await transferToMirror(scope.record, scope.remote, target)
2592
+ },
2593
+
2594
+ /** Progress of a transfer that was started with a jobId. */
2595
+ async 'fs.transferProgress'(params = {}) {
2596
+ const id = typeof params.jobId === 'string' ? params.jobId : ''
2597
+ const job = transferJobs.get(id) || null
2598
+ if (job === null) return { job: null }
2599
+ return {
2600
+ job: {
2601
+ id: job.id,
2602
+ files: job.files,
2603
+ bytes: job.bytes,
2604
+ skipped: job.skipped,
2605
+ state: job.state,
2606
+ cancelled: job.cancelled,
2607
+ reason: job.reason,
2608
+ },
2609
+ }
2610
+ },
2611
+
2612
+ /** Ask a running transfer to stop after the file it is writing. */
2613
+ async 'fs.transferCancel'(params = {}) {
2614
+ const id = typeof params.jobId === 'string' ? params.jobId : ''
2615
+ const job = transferJobs.get(id)
2616
+ if (!job) return { cancelled: false }
2617
+ job.cancelled = true
2618
+ job.updatedAt = Date.now()
2619
+ return { cancelled: true }
2407
2620
  },
2408
2621
 
2409
2622
  async 'fs.download'(params = {}) {
@@ -2458,6 +2671,17 @@ export function apply(ctx) {
2458
2671
  return { home: await scope.remote.homeDir() }
2459
2672
  },
2460
2673
 
2674
+ // ── build info ─────────────────────────────────────────────────────────
2675
+
2676
+ /**
2677
+ * Lets the Client detect a Host that predates the code on disk: the method
2678
+ * itself is missing on old builds, and the revision is lower once a Client
2679
+ * needs newer methods.
2680
+ */
2681
+ async 'meta.info'() {
2682
+ return { version: PACKAGE_VERSION, apiRevision: API_REVISION, startedAt: STARTED_AT }
2683
+ },
2684
+
2461
2685
  // ── settings ───────────────────────────────────────────────────────────
2462
2686
 
2463
2687
  async 'settings.get'() {
@@ -2923,11 +3147,17 @@ export function apply(ctx) {
2923
3147
  const scope = await requireScope(params)
2924
3148
  const query = typeof params.query === 'string' ? params.query.trim() : ''
2925
3149
  const maxResults = Math.min(Math.max(Number(params.maxResults) || 200, 1), 1000)
2926
- if (query === '') return { ok: true, query: '', entries: [], truncated: false }
3150
+ if (query === '') return { ok: true, query: '', entries: [], truncated: false, truncatedReason: '' }
3151
+ if (query.length > GREP_MAX_QUERY) throw new ApiError('BAD_REQUEST', `搜索词过长(最多 ${GREP_MAX_QUERY} 个字符)`)
2927
3152
  const side = params.side === 'local' ? 'local' : 'remote'
2928
- if (side === 'remote') return await contentSearchRemote(scope.remote, scope.root, query, maxResults)
3153
+ const options = {
3154
+ path: typeof params.path === 'string' ? params.path : '',
3155
+ ignoreCase: params.ignoreCase !== false,
3156
+ regex: Boolean(params.regex),
3157
+ }
3158
+ if (side === 'remote') return await contentSearchRemote(scope.remote, scope.root, query, maxResults, options)
2929
3159
  if (scope.kind !== 'linked') throw new ApiError('BAD_REQUEST', '只有联动工作区有本地目录')
2930
- return contentSearchLocal(scope.record.localPath, query, maxResults)
3160
+ return contentSearchLocal(scope.record.localPath, query, maxResults, options)
2931
3161
  },
2932
3162
 
2933
3163
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-linked-workspace",
3
- "version": "0.13.0",
3
+ "version": "0.15.0",
4
4
  "description": "Linked local ⇄ remote workspaces and remote workspaces for DeepSeek Harness: theme-aware split editor, file-type icons, and agent tools that edit remote files directly.",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",