@lornatang/dsh-caveman 0.1.0 → 0.1.1

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/package.json CHANGED
@@ -1,129 +1,129 @@
1
- {
2
- "name": "@lornatang/dsh-caveman",
3
- "version": "0.1.0",
4
- "description": "Caveman integration for DeepSeek Harness.",
5
- "type": "module",
6
- "license": "Apache-2.0",
7
- "author": "Lornatang",
8
- "keywords": [
9
- "deepseek-harness",
10
- "dsh",
11
- "dsh-plugin",
12
- "caveman",
13
- "skills"
14
- ],
15
- "engines": {
16
- "node": ">=22.19",
17
- "dsh": "*"
18
- },
19
- "main": "lib/index.js",
20
- "types": "lib/types/index.d.ts",
21
- "bin": {
22
- "dsh-caveman": "./scripts/caveman-cli.mjs"
23
- },
24
- "exports": {
25
- ".": {
26
- "types": "./lib/types/index.d.ts",
27
- "default": "./lib/index.js"
28
- },
29
- "./cavecrew": {
30
- "types": "./lib/types/cavecrew.d.ts",
31
- "default": "./lib/cavecrew.js"
32
- },
33
- "./cordis.patch.yml": "./cordis.patch.yml",
34
- "./package.json": "./package.json"
35
- },
36
- "files": [
37
- "lib",
38
- "scripts/caveman-cli.mjs",
39
- "scripts/learn-binary.mjs",
40
- "scripts/learn-checksums.json",
41
- "scripts/benchmark.mjs",
42
- "examples",
43
- "presets",
44
- "vendor/caveman/skills",
45
- "vendor/caveman/agents/cavecrew-*.md",
46
- "vendor/caveman/src/hooks/caveman-config.js",
47
- "vendor/caveman/src/hooks/caveman-parse.js",
48
- "vendor/caveman/src/hooks/package.json",
49
- "vendor/caveman/LICENSE",
50
- "vendor/caveman/LICENSE-MIT",
51
- "vendor/caveman/NOTICE",
52
- "cordis.patch.yml",
53
- "README.md",
54
- "README.zh.md",
55
- "CHANGELOG.md",
56
- "LICENSE",
57
- "LICENSE-MIT",
58
- "NOTICE"
59
- ],
60
- "scripts": {
61
- "clean": "node -e \"require('node:fs').rmSync('lib',{recursive:true,force:true})\"",
62
- "build": "npm run clean && tsc -p tsconfig.json",
63
- "typecheck": "tsc -p tsconfig.json --noEmit",
64
- "test": "npm run build && node --test tests/*.test.mjs",
65
- "test:dsh": "node scripts/verify-dsh.mjs",
66
- "benchmark": "node scripts/benchmark.mjs",
67
- "prepack": "npm test"
68
- },
69
- "dsh": {
70
- "bundle": {
71
- "patch": [
72
- "./cordis.patch.yml",
73
- "./presets/cavecrew.patch.yml"
74
- ]
75
- }
76
- },
77
- "dependencies": {
78
- "@caveman-ai/cli": "4.1.0",
79
- "@caveman-ai/sdk": "1.2.0",
80
- "@deepseek-ai/schemastery": "~3.19.0",
81
- "undici": "^7.30.2",
82
- "yaml": "^2.8.1"
83
- },
84
- "peerDependencies": {
85
- "@deepseek-ai/cordis": "~4.1.0",
86
- "@deepseek-ai/dsh-llm": "*"
87
- },
88
- "devDependencies": {
89
- "@deepseek-ai/cordis": "~4.1.0",
90
- "@deepseek-ai/cordis-plugin-group": "1.1.0",
91
- "@deepseek-ai/dsh-agent": "0.2.2-rc.3",
92
- "@deepseek-ai/dsh-agent-loop": "^0.2.2-rc.3",
93
- "@deepseek-ai/dsh-agent-preset": "0.2.2-rc.3",
94
- "@deepseek-ai/dsh-agent-preset-registry": "0.2.2-rc.3",
95
- "@deepseek-ai/dsh-fs-local": "0.2.2-rc.3",
96
- "@deepseek-ai/dsh-llm": "0.2.2-rc.3",
97
- "@deepseek-ai/dsh-llm-pi-ai": "0.2.2-rc.3",
98
- "@deepseek-ai/dsh-mcp-manager": "0.2.2-rc.3",
99
- "@deepseek-ai/dsh-ptc-runtime": "0.2.2-rc.3",
100
- "@deepseek-ai/dsh-sandbox-policy": "0.2.2-rc.3",
101
- "@deepseek-ai/dsh-session-persistence-jsonl": "0.2.2-rc.3",
102
- "@deepseek-ai/dsh-skill": "0.2.2-rc.3",
103
- "@deepseek-ai/dsh-subagent": "0.2.2-rc.3",
104
- "@deepseek-ai/dsh-subagent-spawn-in-process": "0.2.2-rc.3",
105
- "@deepseek-ai/dsh-subprocess-local": "0.2.2-rc.3",
106
- "@deepseek-ai/dsh-system-prompt": "0.2.2-rc.3",
107
- "@deepseek-ai/dsh-tool-executor-native": "^0.2.2-rc.3",
108
- "@deepseek-ai/dsh-tool-executor-ptc": "0.2.2-rc.3",
109
- "@deepseek-ai/dsh-tool-fs": "0.2.2-rc.3",
110
- "@deepseek-ai/dsh-tool-fs-search": "0.2.2-rc.3",
111
- "@deepseek-ai/dsh-tool-subagent": "0.2.2-rc.3",
112
- "@deepseek-ai/dsh-tools": "^0.2.2-rc.3",
113
- "@deepseek-ai/dsh-working-directory": "0.2.2-rc.3",
114
- "@types/node": "^22.18.0",
115
- "typescript": "^5.9.3"
116
- },
117
- "repository": {
118
- "type": "git",
119
- "url": "git+https://github.com/Lornatang/dsh-caveman.git"
120
- },
121
- "homepage": "https://github.com/Lornatang/dsh-caveman#readme",
122
- "bugs": {
123
- "url": "https://github.com/Lornatang/dsh-caveman/issues"
124
- },
125
- "publishConfig": {
126
- "access": "public",
127
- "registry": "https://registry.npmjs.org/"
128
- }
129
- }
1
+ {
2
+ "name": "@lornatang/dsh-caveman",
3
+ "version": "0.1.1",
4
+ "description": "Caveman integration for DeepSeek Harness.",
5
+ "type": "module",
6
+ "license": "Apache-2.0",
7
+ "author": "Lornatang",
8
+ "keywords": [
9
+ "deepseek-harness",
10
+ "dsh",
11
+ "dsh-plugin",
12
+ "caveman",
13
+ "skills"
14
+ ],
15
+ "engines": {
16
+ "node": ">=22.19",
17
+ "dsh": "*"
18
+ },
19
+ "main": "lib/index.js",
20
+ "types": "lib/types/index.d.ts",
21
+ "bin": {
22
+ "dsh-caveman": "./scripts/caveman-cli.mjs"
23
+ },
24
+ "exports": {
25
+ ".": {
26
+ "types": "./lib/types/index.d.ts",
27
+ "default": "./lib/index.js"
28
+ },
29
+ "./cavecrew": {
30
+ "types": "./lib/types/cavecrew.d.ts",
31
+ "default": "./lib/cavecrew.js"
32
+ },
33
+ "./cordis.patch.yml": "./cordis.patch.yml",
34
+ "./package.json": "./package.json"
35
+ },
36
+ "files": [
37
+ "lib",
38
+ "scripts/caveman-cli.mjs",
39
+ "scripts/learn-binary.mjs",
40
+ "scripts/learn-checksums.json",
41
+ "scripts/benchmark.mjs",
42
+ "examples",
43
+ "presets",
44
+ "vendor/caveman/skills",
45
+ "vendor/caveman/agents/cavecrew-*.md",
46
+ "vendor/caveman/src/hooks/caveman-config.js",
47
+ "vendor/caveman/src/hooks/caveman-parse.js",
48
+ "vendor/caveman/src/hooks/package.json",
49
+ "vendor/caveman/LICENSE",
50
+ "vendor/caveman/LICENSE-MIT",
51
+ "vendor/caveman/NOTICE",
52
+ "cordis.patch.yml",
53
+ "README.md",
54
+ "README.zh.md",
55
+ "CHANGELOG.md",
56
+ "LICENSE",
57
+ "LICENSE-MIT",
58
+ "NOTICE"
59
+ ],
60
+ "scripts": {
61
+ "clean": "node -e \"require('node:fs').rmSync('lib',{recursive:true,force:true})\"",
62
+ "build": "npm run clean && tsc -p tsconfig.json",
63
+ "typecheck": "tsc -p tsconfig.json --noEmit",
64
+ "test": "npm run build && node --test tests/*.test.mjs",
65
+ "test:dsh": "node scripts/verify-dsh.mjs",
66
+ "benchmark": "node scripts/benchmark.mjs",
67
+ "prepack": "npm test"
68
+ },
69
+ "dsh": {
70
+ "bundle": {
71
+ "patch": [
72
+ "./cordis.patch.yml",
73
+ "./presets/cavecrew.patch.yml"
74
+ ]
75
+ }
76
+ },
77
+ "dependencies": {
78
+ "@caveman-ai/cli": "4.1.0",
79
+ "@caveman-ai/sdk": "1.2.0",
80
+ "@deepseek-ai/schemastery": "~3.19.0",
81
+ "undici": "^7.30.2",
82
+ "yaml": "^2.8.1"
83
+ },
84
+ "peerDependencies": {
85
+ "@deepseek-ai/cordis": "~4.1.0",
86
+ "@deepseek-ai/dsh-llm": "*"
87
+ },
88
+ "devDependencies": {
89
+ "@deepseek-ai/cordis": "~4.1.0",
90
+ "@deepseek-ai/cordis-plugin-group": "1.1.0",
91
+ "@deepseek-ai/dsh-agent": "0.2.2-rc.3",
92
+ "@deepseek-ai/dsh-agent-loop": "^0.2.2-rc.3",
93
+ "@deepseek-ai/dsh-agent-preset": "0.2.2-rc.3",
94
+ "@deepseek-ai/dsh-agent-preset-registry": "0.2.2-rc.3",
95
+ "@deepseek-ai/dsh-fs-local": "0.2.2-rc.3",
96
+ "@deepseek-ai/dsh-llm": "0.2.2-rc.3",
97
+ "@deepseek-ai/dsh-llm-pi-ai": "0.2.2-rc.3",
98
+ "@deepseek-ai/dsh-mcp-manager": "0.2.2-rc.3",
99
+ "@deepseek-ai/dsh-ptc-runtime": "0.2.2-rc.3",
100
+ "@deepseek-ai/dsh-sandbox-policy": "0.2.2-rc.3",
101
+ "@deepseek-ai/dsh-session-persistence-jsonl": "0.2.2-rc.3",
102
+ "@deepseek-ai/dsh-skill": "0.2.2-rc.3",
103
+ "@deepseek-ai/dsh-subagent": "0.2.2-rc.3",
104
+ "@deepseek-ai/dsh-subagent-spawn-in-process": "0.2.2-rc.3",
105
+ "@deepseek-ai/dsh-subprocess-local": "0.2.2-rc.3",
106
+ "@deepseek-ai/dsh-system-prompt": "0.2.2-rc.3",
107
+ "@deepseek-ai/dsh-tool-executor-native": "^0.2.2-rc.3",
108
+ "@deepseek-ai/dsh-tool-executor-ptc": "0.2.2-rc.3",
109
+ "@deepseek-ai/dsh-tool-fs": "0.2.2-rc.3",
110
+ "@deepseek-ai/dsh-tool-fs-search": "0.2.2-rc.3",
111
+ "@deepseek-ai/dsh-tool-subagent": "0.2.2-rc.3",
112
+ "@deepseek-ai/dsh-tools": "^0.2.2-rc.3",
113
+ "@deepseek-ai/dsh-working-directory": "0.2.2-rc.3",
114
+ "@types/node": "^22.18.0",
115
+ "typescript": "^5.9.3"
116
+ },
117
+ "repository": {
118
+ "type": "git",
119
+ "url": "git+https://github.com/Lornatang/dsh-caveman.git"
120
+ },
121
+ "homepage": "https://github.com/Lornatang/dsh-caveman#readme",
122
+ "bugs": {
123
+ "url": "https://github.com/Lornatang/dsh-caveman/issues"
124
+ },
125
+ "publishConfig": {
126
+ "access": "public",
127
+ "registry": "https://registry.npmjs.org/"
128
+ }
129
+ }
@@ -1,30 +1,30 @@
1
- #!/usr/bin/env node
2
- import { spawn } from 'node:child_process'
3
- import { constants } from 'node:os'
4
- import { createRequire } from 'node:module'
5
- import { dirname, join } from 'node:path'
6
-
7
- const require = createRequire(import.meta.url)
8
- const cli = join(dirname(require.resolve('@caveman-ai/cli/package.json')), 'dist', 'index.js')
9
- const args = process.argv.slice(2)
10
- let learnBinary
11
- if (args[0] === 'learn' && !['--help', '-h', 'help'].includes(args[1])) {
12
- try { learnBinary = await (await import('./learn-binary.mjs')).resolveLearnBinary() }
13
- catch (error) { console.error(`dsh-caveman: ${error.message}`); process.exit(1) }
14
- }
15
- const direct = learnBinary && args[1] === 'locate'
16
- const child = spawn(direct ? learnBinary : process.execPath, direct ? args : [cli, ...args], {
17
- stdio: 'inherit', windowsHide: true,
18
- env: learnBinary ? { ...process.env, CAVEMAN_PROXY_BIN: learnBinary } : process.env,
19
- })
20
-
21
- for (const signal of ['SIGINT', 'SIGTERM']) {
22
- process.on(signal, () => { if (child.exitCode === null && child.signalCode === null) child.kill(signal) })
23
- }
24
- child.once('error', error => {
25
- console.error(`dsh-caveman: could not start the CLI: ${error.message}`)
26
- process.exitCode = 1
27
- })
28
- child.once('exit', (code, signal) => {
29
- process.exitCode = code ?? (signal ? 128 + (constants.signals[signal] ?? 0) : 1)
30
- })
1
+ #!/usr/bin/env node
2
+ import { spawn } from 'node:child_process'
3
+ import { constants } from 'node:os'
4
+ import { createRequire } from 'node:module'
5
+ import { dirname, join } from 'node:path'
6
+
7
+ const require = createRequire(import.meta.url)
8
+ const cli = join(dirname(require.resolve('@caveman-ai/cli/package.json')), 'dist', 'index.js')
9
+ const args = process.argv.slice(2)
10
+ let learnBinary
11
+ if (args[0] === 'learn' && !['--help', '-h', 'help'].includes(args[1])) {
12
+ try { learnBinary = await (await import('./learn-binary.mjs')).resolveLearnBinary() }
13
+ catch (error) { console.error(`dsh-caveman: ${error.message}`); process.exit(1) }
14
+ }
15
+ const direct = learnBinary && args[1] === 'locate'
16
+ const child = spawn(direct ? learnBinary : process.execPath, direct ? args : [cli, ...args], {
17
+ stdio: 'inherit', windowsHide: true,
18
+ env: learnBinary ? { ...process.env, CAVEMAN_PROXY_BIN: learnBinary } : process.env,
19
+ })
20
+
21
+ for (const signal of ['SIGINT', 'SIGTERM']) {
22
+ process.on(signal, () => { if (child.exitCode === null && child.signalCode === null) child.kill(signal) })
23
+ }
24
+ child.once('error', error => {
25
+ console.error(`dsh-caveman: could not start the CLI: ${error.message}`)
26
+ process.exitCode = 1
27
+ })
28
+ child.once('exit', (code, signal) => {
29
+ process.exitCode = code ?? (signal ? 128 + (constants.signals[signal] ?? 0) : 1)
30
+ })
@@ -1,82 +1,82 @@
1
- import { createHash, randomBytes } from 'node:crypto'
2
- import { createReadStream } from 'node:fs'
3
- import { chmod, mkdir, open, readFile, rename, rm } from 'node:fs/promises'
4
- import { homedir } from 'node:os'
5
- import { join } from 'node:path'
6
-
7
- const MAX_BINARY_BYTES = 120 * 1024 * 1024
8
- const manifestUrl = new URL('./learn-checksums.json', import.meta.url)
9
- const packageUrl = new URL('../package.json', import.meta.url)
10
-
11
- async function fileDigest(path) {
12
- try {
13
- const hash = createHash('sha256')
14
- for await (const chunk of createReadStream(path)) hash.update(chunk)
15
- return hash.digest('hex')
16
- } catch (error) {
17
- if (error?.code === 'ENOENT') return undefined
18
- throw error
19
- }
20
- }
21
-
22
- /** Download and verify the executable once for the current platform and version. */
23
- export async function resolveLearnBinary(options = {}) {
24
- const { env = process.env, platform = process.platform, arch = process.arch } = options
25
- if (env.DSH_CAVEMAN_LEARN_BINARY) return env.DSH_CAVEMAN_LEARN_BINARY
26
- const manifest = options.manifest ?? JSON.parse(await readFile(manifestUrl, 'utf8'))
27
- const version = JSON.parse(await readFile(packageUrl, 'utf8')).version
28
- if (manifest.version !== version || !/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/u.test(version)) throw new Error('Invalid analyzer version manifest')
29
- const os = { linux: 'linux', darwin: 'darwin', win32: 'win32' }[platform]
30
- const cpu = { x64: 'amd64', arm64: 'arm64' }[arch]
31
- const entry = manifest.binaries?.[`${platform}-${arch}`]
32
- const expectedName = os && cpu ? `dsh-caveman-learn_${os}_${cpu}` : undefined
33
- if (!expectedName || entry?.name !== expectedName || !/^[a-f0-9]{64}$/u.test(entry.sha256 ?? '')) {
34
- throw new Error(`No verified analyzer is available for ${platform}/${arch}`)
35
- }
36
- const directory = join(options.cacheRoot ?? join(homedir(), '.dsh', 'cache', 'dsh-caveman', 'learn'), version)
37
- const target = join(directory, `${expectedName}${platform === 'win32' ? '.exe' : ''}`)
38
- if (await fileDigest(target) === entry.sha256) return target
39
- await mkdir(directory, { recursive: true, mode: 0o700 })
40
- const temporary = join(directory, `.${expectedName}.${randomBytes(12).toString('hex')}.tmp`)
41
- let handle
42
- let dispatcher
43
- try {
44
- const url = `https://github.com/Lornatang/dsh-caveman/releases/download/v${version}/${expectedName}`
45
- let fetcher = options.fetcher ?? fetch
46
- if (!options.fetcher && (env.https_proxy || env.HTTPS_PROXY || env.http_proxy || env.HTTP_PROXY)) {
47
- const { EnvHttpProxyAgent, fetch: proxyFetch } = await import('undici')
48
- dispatcher = new EnvHttpProxyAgent({
49
- httpProxy: env.http_proxy ?? env.HTTP_PROXY ?? '',
50
- httpsProxy: env.https_proxy ?? env.HTTPS_PROXY ?? '',
51
- noProxy: env.no_proxy ?? env.NO_PROXY ?? '',
52
- })
53
- fetcher = (input, init) => proxyFetch(input, { ...init, dispatcher })
54
- }
55
- const response = await fetcher(url, { signal: AbortSignal.timeout(120_000) })
56
- if (!response.ok || !response.body) throw new Error(`Analyzer download failed (HTTP ${response.status})`)
57
- const advertised = Number(response.headers.get('content-length'))
58
- if (advertised > MAX_BINARY_BYTES) throw new Error('Analyzer download exceeds the size limit')
59
- handle = await open(temporary, 'wx', 0o700)
60
- const hash = createHash('sha256')
61
- let size = 0
62
- for await (const chunk of response.body) {
63
- size += chunk.length
64
- if (size > MAX_BINARY_BYTES) throw new Error('Analyzer download exceeds the size limit')
65
- hash.update(chunk)
66
- await handle.writeFile(chunk)
67
- }
68
- await handle.close()
69
- handle = undefined
70
- if (hash.digest('hex') !== entry.sha256) throw new Error('Analyzer checksum mismatch')
71
- await chmod(temporary, 0o700)
72
- try { await rename(temporary, target) } catch (error) {
73
- // Another invocation may have finished the same verified download.
74
- if (await fileDigest(target) !== entry.sha256) throw error
75
- }
76
- return target
77
- } finally {
78
- await handle?.close().catch(() => {})
79
- await rm(temporary, { force: true }).catch(() => {})
80
- await dispatcher?.destroy().catch(() => {})
81
- }
82
- }
1
+ import { createHash, randomBytes } from 'node:crypto'
2
+ import { createReadStream } from 'node:fs'
3
+ import { chmod, mkdir, open, readFile, rename, rm } from 'node:fs/promises'
4
+ import { homedir } from 'node:os'
5
+ import { join } from 'node:path'
6
+
7
+ const MAX_BINARY_BYTES = 120 * 1024 * 1024
8
+ const manifestUrl = new URL('./learn-checksums.json', import.meta.url)
9
+ const packageUrl = new URL('../package.json', import.meta.url)
10
+
11
+ async function fileDigest(path) {
12
+ try {
13
+ const hash = createHash('sha256')
14
+ for await (const chunk of createReadStream(path)) hash.update(chunk)
15
+ return hash.digest('hex')
16
+ } catch (error) {
17
+ if (error?.code === 'ENOENT') return undefined
18
+ throw error
19
+ }
20
+ }
21
+
22
+ /** Download and verify the executable once for the current platform and version. */
23
+ export async function resolveLearnBinary(options = {}) {
24
+ const { env = process.env, platform = process.platform, arch = process.arch } = options
25
+ if (env.DSH_CAVEMAN_LEARN_BINARY) return env.DSH_CAVEMAN_LEARN_BINARY
26
+ const manifest = options.manifest ?? JSON.parse(await readFile(manifestUrl, 'utf8'))
27
+ const version = JSON.parse(await readFile(packageUrl, 'utf8')).version
28
+ if (manifest.version !== version || !/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/u.test(version)) throw new Error('Invalid analyzer version manifest')
29
+ const os = { linux: 'linux', darwin: 'darwin', win32: 'win32' }[platform]
30
+ const cpu = { x64: 'amd64', arm64: 'arm64' }[arch]
31
+ const entry = manifest.binaries?.[`${platform}-${arch}`]
32
+ const expectedName = os && cpu ? `dsh-caveman-learn_${os}_${cpu}` : undefined
33
+ if (!expectedName || entry?.name !== expectedName || !/^[a-f0-9]{64}$/u.test(entry.sha256 ?? '')) {
34
+ throw new Error(`No verified analyzer is available for ${platform}/${arch}`)
35
+ }
36
+ const directory = join(options.cacheRoot ?? join(homedir(), '.dsh', 'cache', 'dsh-caveman', 'learn'), version)
37
+ const target = join(directory, `${expectedName}${platform === 'win32' ? '.exe' : ''}`)
38
+ if (await fileDigest(target) === entry.sha256) return target
39
+ await mkdir(directory, { recursive: true, mode: 0o700 })
40
+ const temporary = join(directory, `.${expectedName}.${randomBytes(12).toString('hex')}.tmp`)
41
+ let handle
42
+ let dispatcher
43
+ try {
44
+ const url = `https://github.com/Lornatang/dsh-caveman/releases/download/v${version}/${expectedName}`
45
+ let fetcher = options.fetcher ?? fetch
46
+ if (!options.fetcher && (env.https_proxy || env.HTTPS_PROXY || env.http_proxy || env.HTTP_PROXY)) {
47
+ const { EnvHttpProxyAgent, fetch: proxyFetch } = await import('undici')
48
+ dispatcher = new EnvHttpProxyAgent({
49
+ httpProxy: env.http_proxy ?? env.HTTP_PROXY ?? '',
50
+ httpsProxy: env.https_proxy ?? env.HTTPS_PROXY ?? '',
51
+ noProxy: env.no_proxy ?? env.NO_PROXY ?? '',
52
+ })
53
+ fetcher = (input, init) => proxyFetch(input, { ...init, dispatcher })
54
+ }
55
+ const response = await fetcher(url, { signal: AbortSignal.timeout(120_000) })
56
+ if (!response.ok || !response.body) throw new Error(`Analyzer download failed (HTTP ${response.status})`)
57
+ const advertised = Number(response.headers.get('content-length'))
58
+ if (advertised > MAX_BINARY_BYTES) throw new Error('Analyzer download exceeds the size limit')
59
+ handle = await open(temporary, 'wx', 0o700)
60
+ const hash = createHash('sha256')
61
+ let size = 0
62
+ for await (const chunk of response.body) {
63
+ size += chunk.length
64
+ if (size > MAX_BINARY_BYTES) throw new Error('Analyzer download exceeds the size limit')
65
+ hash.update(chunk)
66
+ await handle.writeFile(chunk)
67
+ }
68
+ await handle.close()
69
+ handle = undefined
70
+ if (hash.digest('hex') !== entry.sha256) throw new Error('Analyzer checksum mismatch')
71
+ await chmod(temporary, 0o700)
72
+ try { await rename(temporary, target) } catch (error) {
73
+ // Another invocation may have finished the same verified download.
74
+ if (await fileDigest(target) !== entry.sha256) throw error
75
+ }
76
+ return target
77
+ } finally {
78
+ await handle?.close().catch(() => {})
79
+ await rm(temporary, { force: true }).catch(() => {})
80
+ await dispatcher?.destroy().catch(() => {})
81
+ }
82
+ }
@@ -1,29 +1,29 @@
1
- {
2
- "version": "0.1.0",
3
- "binaries": {
4
- "linux-x64": {
5
- "name": "dsh-caveman-learn_linux_amd64",
6
- "sha256": "0bbc8d74cb5c1f7494fc6fed5582a1e0f0259200df490b4b866ce43ba555d889"
7
- },
8
- "linux-arm64": {
9
- "name": "dsh-caveman-learn_linux_arm64",
10
- "sha256": "b3ddb175c675023c6c091f26a1f992c545e03df0ccf46632a577e48db8ec1fa9"
11
- },
12
- "darwin-x64": {
13
- "name": "dsh-caveman-learn_darwin_amd64",
14
- "sha256": "8145380c71fe57e8829a856c808c887b271e6d004078ca989c23d997c61ffbab"
15
- },
16
- "darwin-arm64": {
17
- "name": "dsh-caveman-learn_darwin_arm64",
18
- "sha256": "03be0ecc7f9d4d0669edf1c79a5d3f20921e8d89d210fdadc99f0e2c16b1e7b4"
19
- },
20
- "win32-x64": {
21
- "name": "dsh-caveman-learn_win32_amd64",
22
- "sha256": "ce0b6834457c8f188c883b6c46892930b0fad63d85cf9f7033ddd53cc1fd5b4a"
23
- },
24
- "win32-arm64": {
25
- "name": "dsh-caveman-learn_win32_arm64",
26
- "sha256": "bceddc401c9711c6c67194dbf27e7a227100eb315397018affce9cd8ea0a2f5b"
27
- }
28
- }
29
- }
1
+ {
2
+ "version": "0.1.1",
3
+ "binaries": {
4
+ "linux-x64": {
5
+ "name": "dsh-caveman-learn_linux_amd64",
6
+ "sha256": "0bbc8d74cb5c1f7494fc6fed5582a1e0f0259200df490b4b866ce43ba555d889"
7
+ },
8
+ "linux-arm64": {
9
+ "name": "dsh-caveman-learn_linux_arm64",
10
+ "sha256": "b3ddb175c675023c6c091f26a1f992c545e03df0ccf46632a577e48db8ec1fa9"
11
+ },
12
+ "darwin-x64": {
13
+ "name": "dsh-caveman-learn_darwin_amd64",
14
+ "sha256": "8145380c71fe57e8829a856c808c887b271e6d004078ca989c23d997c61ffbab"
15
+ },
16
+ "darwin-arm64": {
17
+ "name": "dsh-caveman-learn_darwin_arm64",
18
+ "sha256": "03be0ecc7f9d4d0669edf1c79a5d3f20921e8d89d210fdadc99f0e2c16b1e7b4"
19
+ },
20
+ "win32-x64": {
21
+ "name": "dsh-caveman-learn_win32_amd64",
22
+ "sha256": "ce0b6834457c8f188c883b6c46892930b0fad63d85cf9f7033ddd53cc1fd5b4a"
23
+ },
24
+ "win32-arm64": {
25
+ "name": "dsh-caveman-learn_win32_arm64",
26
+ "sha256": "bceddc401c9711c6c67194dbf27e7a227100eb315397018affce9cd8ea0a2f5b"
27
+ }
28
+ }
29
+ }