dsh-locator 0.5.2 → 0.6.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.
Files changed (70) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/LICENSE +0 -0
  3. package/README-es.md +0 -0
  4. package/README-hi.md +0 -0
  5. package/README-pt.md +0 -0
  6. package/README.en.md +5 -0
  7. package/README.md +109 -153
  8. package/SECURITY.md +0 -0
  9. package/bin/darwin-arm64/indexd +0 -0
  10. package/bin/darwin-x64/indexd +0 -0
  11. package/bin/linux-arm64/indexd +0 -0
  12. package/bin/linux-x64/indexd +0 -0
  13. package/bin/win32-arm64/indexd.exe +0 -0
  14. package/bin/win32-x64/indexd.exe +0 -0
  15. package/client.js +83 -16
  16. package/cordis.patch.yml +0 -0
  17. package/docs/assets/architecture.svg +0 -0
  18. package/docs/assets/panel-en.png +0 -0
  19. package/docs/assets/panel-zh.png +0 -0
  20. package/lib/config.d.ts +12 -0
  21. package/lib/config.d.ts.map +1 -1
  22. package/lib/config.js +6 -0
  23. package/lib/config.js.map +1 -1
  24. package/lib/content.d.ts +56 -0
  25. package/lib/content.d.ts.map +1 -0
  26. package/lib/content.js +274 -0
  27. package/lib/content.js.map +1 -0
  28. package/lib/export.d.ts +0 -0
  29. package/lib/export.d.ts.map +0 -0
  30. package/lib/export.js +0 -0
  31. package/lib/export.js.map +0 -0
  32. package/lib/find.d.ts +8 -0
  33. package/lib/find.d.ts.map +1 -0
  34. package/lib/find.js +75 -0
  35. package/lib/find.js.map +1 -0
  36. package/lib/http.d.ts +2 -1
  37. package/lib/http.d.ts.map +1 -1
  38. package/lib/http.js +12 -1
  39. package/lib/http.js.map +1 -1
  40. package/lib/index.d.ts +0 -0
  41. package/lib/index.d.ts.map +1 -1
  42. package/lib/index.js +33 -1
  43. package/lib/index.js.map +1 -1
  44. package/lib/paths.d.ts +0 -0
  45. package/lib/paths.d.ts.map +0 -0
  46. package/lib/paths.js +0 -0
  47. package/lib/paths.js.map +0 -0
  48. package/lib/reveal.d.ts +0 -0
  49. package/lib/reveal.d.ts.map +0 -0
  50. package/lib/reveal.js +0 -0
  51. package/lib/reveal.js.map +0 -0
  52. package/lib/runtime.d.ts +0 -0
  53. package/lib/runtime.d.ts.map +1 -1
  54. package/lib/runtime.js +2 -0
  55. package/lib/runtime.js.map +1 -1
  56. package/lib/tools.d.ts +0 -0
  57. package/lib/tools.d.ts.map +0 -0
  58. package/lib/tools.js +0 -0
  59. package/lib/tools.js.map +0 -0
  60. package/package.json +1 -1
  61. package/src/config.ts +18 -0
  62. package/src/content.ts +253 -0
  63. package/src/export.ts +0 -0
  64. package/src/find.ts +76 -0
  65. package/src/http.ts +13 -1
  66. package/src/index.ts +30 -1
  67. package/src/paths.ts +0 -0
  68. package/src/reveal.ts +0 -0
  69. package/src/runtime.ts +1 -0
  70. package/src/tools.ts +0 -0
package/src/index.ts CHANGED
@@ -7,7 +7,9 @@
7
7
  import type { Context } from '@deepseek-ai/cordis'
8
8
  import { Config as ConfigSchema } from './config.ts'
9
9
  import type { Config } from './config.ts'
10
+ import { ContentIndex } from './content.ts'
10
11
  import { makeExportTool } from './export.ts'
12
+ import { makeFindTool } from './find.ts'
11
13
  import { registerHttp } from './http.ts'
12
14
  import { resolveBinary, resolveRoots, resolveStateDir } from './paths.ts'
13
15
  import { LocatorRuntime } from './runtime.ts'
@@ -34,15 +36,26 @@ export function apply(ctx: Context, config: Config): void {
34
36
  const binary = resolveBinary(config, cwd)
35
37
  const logger = ctx.logger('dsh-locator')
36
38
  const rt = new LocatorRuntime(config, roots, stateDir, binary, cwd)
39
+ const content = config.contentIndex
40
+ ? new ContentIndex(rt, {
41
+ stateDir,
42
+ sessionDirs: config.contentSessionDirs,
43
+ maxFileBytes: config.contentMaxFileBytes,
44
+ maxFiles: config.contentMaxFiles,
45
+ maxSessions: config.contentMaxSessions,
46
+ })
47
+ : undefined
37
48
 
38
49
  ctx.effect(() => {
39
50
  // Let the host finish starting before a cold scan starts reading the disk.
40
51
  const timer = setTimeout(() => {
41
52
  rt.start()
42
53
  logger.info(`index roots: ${roots.join(', ')} (state ${stateDir})`)
54
+ if (content !== undefined) void startContent(rt, content, logger)
43
55
  }, 1500)
44
56
  return () => {
45
57
  clearTimeout(timer)
58
+ content?.close()
46
59
  void rt.stop()
47
60
  }
48
61
  })
@@ -51,8 +64,24 @@ export function apply(ctx: Context, config: Config): void {
51
64
  ctx.tools.register(makeStatusTool(rt))
52
65
  ctx.tools.register(makeRebuildTool(rt))
53
66
  ctx.tools.register(makeExportTool(rt))
67
+ if (content !== undefined) ctx.tools.register(makeFindTool(content))
54
68
 
55
69
  // The Web GUI panel is optional: profiles without a Web server keep the
56
70
  // three tools and never mount an HTTP route.
57
- registerHttp(ctx, rt)
71
+ registerHttp(ctx, rt, content)
72
+ }
73
+
74
+ async function startContent(rt: LocatorRuntime, content: ContentIndex, logger: { info(message: string): void }): Promise<void> {
75
+ try {
76
+ await rt.waitReady()
77
+ for (let i = 0; i < 900; i++) {
78
+ const status = await rt.engineStatus()
79
+ if (status === undefined || !status.scanning) break
80
+ await new Promise(resolve => setTimeout(resolve, 2_000))
81
+ }
82
+ content.start()
83
+ logger.info('content index started')
84
+ } catch (error) {
85
+ logger.info(`content index skipped: ${error instanceof Error ? error.message : String(error)}`)
86
+ }
58
87
  }
package/src/paths.ts CHANGED
File without changes
package/src/reveal.ts CHANGED
File without changes
package/src/runtime.ts CHANGED
@@ -157,6 +157,7 @@ export class LocatorRuntime {
157
157
  if (!this.config.watch) args.push('--no-watch')
158
158
  if (this.config.refreshIntervalMs > 0) args.push('--refresh', `${String(this.config.refreshIntervalMs)}ms`)
159
159
  if (this.config.scanWorkers > 0) args.push('--workers', String(this.config.scanWorkers))
160
+ if (this.config.memoryLimitMB > 0) args.push('--memory-limit-mb', String(this.config.memoryLimitMB))
160
161
  if (this.config.windowsUsn) args.push('--usn')
161
162
 
162
163
  let child: ChildProcessWithoutNullStreams
package/src/tools.ts CHANGED
File without changes