@zleap-ai/dsh-sag 0.1.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 (75) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/LICENSE +21 -0
  3. package/README.md +58 -0
  4. package/README.zh.md +58 -0
  5. package/THIRD_PARTY_NOTICES +671 -0
  6. package/cordis.patch.yml +5 -0
  7. package/docs/embedded.md +61 -0
  8. package/lib/brand.d.ts +13 -0
  9. package/lib/brand.js +15 -0
  10. package/lib/cli/runtime.d.ts +40 -0
  11. package/lib/cli/runtime.js +121 -0
  12. package/lib/cli.d.ts +21 -0
  13. package/lib/cli.js +265 -0
  14. package/lib/config.d.ts +60 -0
  15. package/lib/config.js +120 -0
  16. package/lib/connection/descriptor.d.ts +4 -0
  17. package/lib/connection/descriptor.js +66 -0
  18. package/lib/connection/discovery.d.ts +40 -0
  19. package/lib/connection/discovery.js +139 -0
  20. package/lib/connection/guidance.d.ts +7 -0
  21. package/lib/connection/guidance.js +7 -0
  22. package/lib/connection/manager.d.ts +67 -0
  23. package/lib/connection/manager.js +273 -0
  24. package/lib/connection/store.d.ts +42 -0
  25. package/lib/connection/store.js +164 -0
  26. package/lib/connection/types.d.ts +35 -0
  27. package/lib/connection/types.js +2 -0
  28. package/lib/dsh-sag-cli.js +32202 -0
  29. package/lib/index.d.ts +11 -0
  30. package/lib/index.js +68 -0
  31. package/lib/local/api-client.d.ts +157 -0
  32. package/lib/local/api-client.js +338 -0
  33. package/lib/local/gateway.d.ts +43 -0
  34. package/lib/local/gateway.js +34 -0
  35. package/lib/local/mcp-probe.d.ts +27 -0
  36. package/lib/local/mcp-probe.js +92 -0
  37. package/lib/presentation.d.ts +8 -0
  38. package/lib/presentation.js +7 -0
  39. package/lib/runtime/client.d.ts +22 -0
  40. package/lib/runtime/client.js +117 -0
  41. package/lib/runtime/protocol.d.ts +113 -0
  42. package/lib/runtime/protocol.js +118 -0
  43. package/lib/runtime/supervisor.d.ts +30 -0
  44. package/lib/runtime/supervisor.js +107 -0
  45. package/lib/tools/documents.d.ts +8 -0
  46. package/lib/tools/documents.js +134 -0
  47. package/lib/tools/ingest.d.ts +5 -0
  48. package/lib/tools/ingest.js +35 -0
  49. package/lib/tools/local.d.ts +40 -0
  50. package/lib/tools/local.js +111 -0
  51. package/lib/tools/output.d.ts +96 -0
  52. package/lib/tools/output.js +67 -0
  53. package/lib/tools/read.d.ts +6 -0
  54. package/lib/tools/read.js +84 -0
  55. package/lib/tools/search.d.ts +6 -0
  56. package/lib/tools/search.js +107 -0
  57. package/lib/tools/sources.d.ts +5 -0
  58. package/lib/tools/sources.js +61 -0
  59. package/lib/tools/status.d.ts +5 -0
  60. package/lib/tools/status.js +28 -0
  61. package/lib/tools/upload.d.ts +6 -0
  62. package/lib/tools/upload.js +68 -0
  63. package/package.json +96 -0
  64. package/runtime/pyproject.toml +29 -0
  65. package/runtime/src/dsh_sag_runtime/__init__.py +3 -0
  66. package/runtime/src/dsh_sag_runtime/__main__.py +80 -0
  67. package/runtime/src/dsh_sag_runtime/engines.py +139 -0
  68. package/runtime/src/dsh_sag_runtime/errors.py +47 -0
  69. package/runtime/src/dsh_sag_runtime/evidence.py +53 -0
  70. package/runtime/src/dsh_sag_runtime/protocol.py +161 -0
  71. package/runtime/src/dsh_sag_runtime/read.py +61 -0
  72. package/runtime/src/dsh_sag_runtime/search.py +76 -0
  73. package/runtime/src/dsh_sag_runtime/server.py +136 -0
  74. package/runtime/uv.lock +2310 -0
  75. package/scripts/setup-runtime.mjs +47 -0
@@ -0,0 +1,47 @@
1
+ import { access, mkdir } from 'node:fs/promises'
2
+ import { delimiter, dirname, join, resolve } from 'node:path'
3
+ import { fileURLToPath } from 'node:url'
4
+ import { spawnSync } from 'node:child_process'
5
+
6
+ const args = process.argv.slice(2)
7
+ function option(name) {
8
+ const index = args.indexOf(name)
9
+ if (index < 0 || !args[index + 1]) throw new Error(`${name} is required`)
10
+ return args[index + 1]
11
+ }
12
+
13
+ function run(command, commandArgs, options = {}) {
14
+ const result = spawnSync(command, commandArgs, { encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'], ...options })
15
+ if (result.status !== 0) throw new Error(result.stderr.trim() || `${command} exited ${result.status}`)
16
+ return result.stdout.trim()
17
+ }
18
+
19
+ const python = option('--python')
20
+ const target = resolve(option('--target'))
21
+ const version = run(python, ['-c', 'import sys; print(f"{sys.version_info.major}.{sys.version_info.minor}")'])
22
+ const [major, minor] = version.split('.').map(Number)
23
+ if (major < 3 || (major === 3 && minor < 11)) throw new Error(`Python 3.11+ is required; got ${version}`)
24
+
25
+ const scriptDir = dirname(fileURLToPath(import.meta.url))
26
+ const candidates = [resolve(scriptDir, '../python/runtime'), resolve(scriptDir, '../runtime')]
27
+ let project
28
+ for (const candidate of candidates) {
29
+ try {
30
+ await access(join(candidate, 'uv.lock'))
31
+ project = candidate
32
+ break
33
+ } catch (_candidateDoesNotContainRuntimeLock) {
34
+ // The script supports both the source workspace and the packed Bundle layout.
35
+ }
36
+ }
37
+ if (!project) throw new Error('bundled dsh-sag runtime project is missing')
38
+
39
+ const environment = join(target, 'dsh-sag-runtime-0.1.0')
40
+ await mkdir(target, { recursive: true })
41
+ run('uv', ['venv', '--python', python, environment])
42
+ run('uv', ['sync', '--frozen', '--no-dev', '--project', project], {
43
+ env: { ...process.env, UV_PROJECT_ENVIRONMENT: environment, PATH: `${process.env.PATH ?? ''}${delimiter}${dirname(python)}` },
44
+ })
45
+ const executable = process.platform === 'win32' ? join(environment, 'Scripts', 'python.exe') : join(environment, 'bin', 'python')
46
+ run(executable, ['-c', "import importlib.metadata as m; assert m.version('zleap-sag') == '0.10.0'"])
47
+ process.stdout.write(`${executable}\n`)