@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.
- package/CHANGELOG.md +10 -0
- package/LICENSE +21 -0
- package/README.md +58 -0
- package/README.zh.md +58 -0
- package/THIRD_PARTY_NOTICES +671 -0
- package/cordis.patch.yml +5 -0
- package/docs/embedded.md +61 -0
- package/lib/brand.d.ts +13 -0
- package/lib/brand.js +15 -0
- package/lib/cli/runtime.d.ts +40 -0
- package/lib/cli/runtime.js +121 -0
- package/lib/cli.d.ts +21 -0
- package/lib/cli.js +265 -0
- package/lib/config.d.ts +60 -0
- package/lib/config.js +120 -0
- package/lib/connection/descriptor.d.ts +4 -0
- package/lib/connection/descriptor.js +66 -0
- package/lib/connection/discovery.d.ts +40 -0
- package/lib/connection/discovery.js +139 -0
- package/lib/connection/guidance.d.ts +7 -0
- package/lib/connection/guidance.js +7 -0
- package/lib/connection/manager.d.ts +67 -0
- package/lib/connection/manager.js +273 -0
- package/lib/connection/store.d.ts +42 -0
- package/lib/connection/store.js +164 -0
- package/lib/connection/types.d.ts +35 -0
- package/lib/connection/types.js +2 -0
- package/lib/dsh-sag-cli.js +32202 -0
- package/lib/index.d.ts +11 -0
- package/lib/index.js +68 -0
- package/lib/local/api-client.d.ts +157 -0
- package/lib/local/api-client.js +338 -0
- package/lib/local/gateway.d.ts +43 -0
- package/lib/local/gateway.js +34 -0
- package/lib/local/mcp-probe.d.ts +27 -0
- package/lib/local/mcp-probe.js +92 -0
- package/lib/presentation.d.ts +8 -0
- package/lib/presentation.js +7 -0
- package/lib/runtime/client.d.ts +22 -0
- package/lib/runtime/client.js +117 -0
- package/lib/runtime/protocol.d.ts +113 -0
- package/lib/runtime/protocol.js +118 -0
- package/lib/runtime/supervisor.d.ts +30 -0
- package/lib/runtime/supervisor.js +107 -0
- package/lib/tools/documents.d.ts +8 -0
- package/lib/tools/documents.js +134 -0
- package/lib/tools/ingest.d.ts +5 -0
- package/lib/tools/ingest.js +35 -0
- package/lib/tools/local.d.ts +40 -0
- package/lib/tools/local.js +111 -0
- package/lib/tools/output.d.ts +96 -0
- package/lib/tools/output.js +67 -0
- package/lib/tools/read.d.ts +6 -0
- package/lib/tools/read.js +84 -0
- package/lib/tools/search.d.ts +6 -0
- package/lib/tools/search.js +107 -0
- package/lib/tools/sources.d.ts +5 -0
- package/lib/tools/sources.js +61 -0
- package/lib/tools/status.d.ts +5 -0
- package/lib/tools/status.js +28 -0
- package/lib/tools/upload.d.ts +6 -0
- package/lib/tools/upload.js +68 -0
- package/package.json +96 -0
- package/runtime/pyproject.toml +29 -0
- package/runtime/src/dsh_sag_runtime/__init__.py +3 -0
- package/runtime/src/dsh_sag_runtime/__main__.py +80 -0
- package/runtime/src/dsh_sag_runtime/engines.py +139 -0
- package/runtime/src/dsh_sag_runtime/errors.py +47 -0
- package/runtime/src/dsh_sag_runtime/evidence.py +53 -0
- package/runtime/src/dsh_sag_runtime/protocol.py +161 -0
- package/runtime/src/dsh_sag_runtime/read.py +61 -0
- package/runtime/src/dsh_sag_runtime/search.py +76 -0
- package/runtime/src/dsh_sag_runtime/server.py +136 -0
- package/runtime/uv.lock +2310 -0
- 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`)
|