mirror of
https://github.com/deepseek-ai/deepseek-harness.git
synced 2026-09-09 04:02:35 +00:00
fix(subprocess): keep native runner private
This commit is contained in:
@@ -113,18 +113,18 @@ pnpm applies local patches to the following packages at install time, so shipped
|
||||
|
||||
The project owner authorizes distribution of every version of the official `@anthropic-ai/claude-agent-sdk` package and the official Claude Code CLI/platform payloads that each version declares through `optionalDependencies`. This identity-scoped authorization does not classify their declared terms as permissive and does not cover any unrelated runtime package; version, declared-license, and payload-set changes still require the ordinary dependency, lockfile, compatibility, terms, and notices review.
|
||||
|
||||
The installed SDK 0.3.220 declares the following optional platform packages. Each carries the official Claude Code 2.1.220 executable; the package identities and versions come from the SDK manifest, while the declared license field is verified against the platform payload installed for the current host.
|
||||
The installed SDK 0.3.241 declares the following optional platform packages. Each carries the official Claude Code 2.1.241 executable; the package identities and versions come from the SDK manifest, while the declared license field is verified against the platform payload installed for the current host.
|
||||
|
||||
| Optional platform package | Version | Declared license |
|
||||
| --- | --- | --- |
|
||||
| [`@anthropic-ai/claude-agent-sdk-darwin-arm64`](https://www.npmjs.com/package/@anthropic-ai/claude-agent-sdk-darwin-arm64) | 0.3.220 | SEE LICENSE IN LICENSE.md |
|
||||
| [`@anthropic-ai/claude-agent-sdk-darwin-x64`](https://www.npmjs.com/package/@anthropic-ai/claude-agent-sdk-darwin-x64) | 0.3.220 | SEE LICENSE IN LICENSE.md |
|
||||
| [`@anthropic-ai/claude-agent-sdk-linux-arm64`](https://www.npmjs.com/package/@anthropic-ai/claude-agent-sdk-linux-arm64) | 0.3.220 | SEE LICENSE IN LICENSE.md |
|
||||
| [`@anthropic-ai/claude-agent-sdk-linux-arm64-musl`](https://www.npmjs.com/package/@anthropic-ai/claude-agent-sdk-linux-arm64-musl) | 0.3.220 | SEE LICENSE IN LICENSE.md |
|
||||
| [`@anthropic-ai/claude-agent-sdk-linux-x64`](https://www.npmjs.com/package/@anthropic-ai/claude-agent-sdk-linux-x64) | 0.3.220 | SEE LICENSE IN LICENSE.md |
|
||||
| [`@anthropic-ai/claude-agent-sdk-linux-x64-musl`](https://www.npmjs.com/package/@anthropic-ai/claude-agent-sdk-linux-x64-musl) | 0.3.220 | SEE LICENSE IN LICENSE.md |
|
||||
| [`@anthropic-ai/claude-agent-sdk-win32-arm64`](https://www.npmjs.com/package/@anthropic-ai/claude-agent-sdk-win32-arm64) | 0.3.220 | SEE LICENSE IN LICENSE.md |
|
||||
| [`@anthropic-ai/claude-agent-sdk-win32-x64`](https://www.npmjs.com/package/@anthropic-ai/claude-agent-sdk-win32-x64) | 0.3.220 | SEE LICENSE IN LICENSE.md |
|
||||
| [`@anthropic-ai/claude-agent-sdk-darwin-arm64`](https://www.npmjs.com/package/@anthropic-ai/claude-agent-sdk-darwin-arm64) | 0.3.241 | SEE LICENSE IN LICENSE.md |
|
||||
| [`@anthropic-ai/claude-agent-sdk-darwin-x64`](https://www.npmjs.com/package/@anthropic-ai/claude-agent-sdk-darwin-x64) | 0.3.241 | SEE LICENSE IN LICENSE.md |
|
||||
| [`@anthropic-ai/claude-agent-sdk-linux-arm64`](https://www.npmjs.com/package/@anthropic-ai/claude-agent-sdk-linux-arm64) | 0.3.241 | SEE LICENSE IN LICENSE.md |
|
||||
| [`@anthropic-ai/claude-agent-sdk-linux-arm64-musl`](https://www.npmjs.com/package/@anthropic-ai/claude-agent-sdk-linux-arm64-musl) | 0.3.241 | SEE LICENSE IN LICENSE.md |
|
||||
| [`@anthropic-ai/claude-agent-sdk-linux-x64`](https://www.npmjs.com/package/@anthropic-ai/claude-agent-sdk-linux-x64) | 0.3.241 | SEE LICENSE IN LICENSE.md |
|
||||
| [`@anthropic-ai/claude-agent-sdk-linux-x64-musl`](https://www.npmjs.com/package/@anthropic-ai/claude-agent-sdk-linux-x64-musl) | 0.3.241 | SEE LICENSE IN LICENSE.md |
|
||||
| [`@anthropic-ai/claude-agent-sdk-win32-arm64`](https://www.npmjs.com/package/@anthropic-ai/claude-agent-sdk-win32-arm64) | 0.3.241 | SEE LICENSE IN LICENSE.md |
|
||||
| [`@anthropic-ai/claude-agent-sdk-win32-x64`](https://www.npmjs.com/package/@anthropic-ai/claude-agent-sdk-win32-x64) | 0.3.241 | SEE LICENSE IN LICENSE.md |
|
||||
|
||||
|
||||
## Development-only npm dependencies
|
||||
|
||||
+5
-1
@@ -25,7 +25,11 @@ function readVersion(): string {
|
||||
|
||||
if (process.argv[2] === PACKAGED_RUNNER_ARG) {
|
||||
process.argv.splice(2, 1)
|
||||
await import('@deepseek-ai/dsh-subprocess-local/spawn-runner')
|
||||
const runnerEntry = new URL(
|
||||
'./lib/spawn-runner.js',
|
||||
import.meta.resolve('@deepseek-ai/dsh-subprocess-local/package.json'),
|
||||
)
|
||||
await import(runnerEntry.href)
|
||||
} else {
|
||||
const invocation = parseDshArgs(process.argv.slice(2), readVersion())
|
||||
|
||||
|
||||
@@ -14,9 +14,6 @@
|
||||
{
|
||||
"path": "../../../vendor/schemastery"
|
||||
},
|
||||
{
|
||||
"path": "../../subprocess/subprocess-local"
|
||||
},
|
||||
{
|
||||
"path": "../../runtime-diagnostics/invariants"
|
||||
},
|
||||
|
||||
@@ -18,10 +18,6 @@
|
||||
"types": "./lib/types/index.d.ts",
|
||||
"default": "./lib/index.js"
|
||||
},
|
||||
"./spawn-runner": {
|
||||
"types": "./lib/types/bin.d.ts",
|
||||
"default": "./lib/spawn-runner.js"
|
||||
},
|
||||
"./invariant": {
|
||||
"types": "./lib/types/invariant.d.ts",
|
||||
"default": "./lib/invariant.js"
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
#!/usr/bin/env node
|
||||
/** Thin process entry for the ordinary subprocess native runner. */
|
||||
|
||||
import { reportSpawnRunnerFailure, runSpawnRunner } from './spawn-runner.ts'
|
||||
|
||||
@@ -28,9 +28,9 @@ export type RunnerInvocation = [string, ...string[]]
|
||||
export function spawnRunnerInvocation(): RunnerInvocation {
|
||||
if ('pkg' in process) return [process.execPath, PACKAGED_RUNNER_ARG]
|
||||
/* v8 ignore start -- source-plane coverage cannot execute the bundled module;
|
||||
the required built-runner smoke executes its published entry. */
|
||||
the required built-runner smoke executes its private built entry. */
|
||||
if (extname(fileURLToPath(import.meta.url)) !== '.ts') {
|
||||
const builtEntry = fileURLToPath(import.meta.resolve('@deepseek-ai/dsh-subprocess-local/spawn-runner'))
|
||||
const builtEntry = fileURLToPath(new URL('./spawn-runner.js', import.meta.url))
|
||||
return [process.execPath, builtEntry]
|
||||
}
|
||||
/* v8 ignore stop */
|
||||
|
||||
@@ -209,10 +209,8 @@ describe.skipIf(!windowsNative)('Windows Job native containment', () => {
|
||||
await expect(missingHandle.waitForExit()).resolves.toBe(true)
|
||||
|
||||
const accessDenied = spec([scratch])
|
||||
const expectedAccessDenied = await directSpawnFailure([scratch])
|
||||
const accessDeniedHandle = bindManagedProcess(accessDenied, launchWindowsJob(accessDenied))
|
||||
await expect(accessDeniedHandle.done).rejects.toMatchObject({ code: 'EACCES' })
|
||||
await expect(accessDeniedHandle.done).rejects.toMatchObject({ code: expectedAccessDenied.code })
|
||||
await expect(accessDeniedHandle.waitForExit()).resolves.toBe(true)
|
||||
|
||||
const missingCwd = join(scratch, `missing-cwd-${Date.now()}`)
|
||||
|
||||
@@ -4,11 +4,14 @@ import { fileURLToPath } from 'node:url'
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { cleanupRunnerFiles, createRunnerFiles, readRunnerEvents } from '../src/runner-protocol.ts'
|
||||
|
||||
const builtEntry = fileURLToPath(import.meta.resolve('@deepseek-ai/dsh-subprocess-local/spawn-runner'))
|
||||
const builtEntry = fileURLToPath(new URL(
|
||||
'./lib/spawn-runner.js',
|
||||
import.meta.resolve('@deepseek-ai/dsh-subprocess-local/package.json'),
|
||||
))
|
||||
const required = process.env.DSH_REQUIRE_BUILT_SUBPROCESS_RUNNER === '1'
|
||||
|
||||
describe.skipIf(!existsSync(builtEntry) && !required)('built subprocess runner entry', () => {
|
||||
it('reports the direct target outcome through the published entry', () => {
|
||||
it('reports the direct target outcome through the built private entry', () => {
|
||||
if (!existsSync(builtEntry)) throw new Error(`required built subprocess runner is missing: ${builtEntry}`)
|
||||
const files = createRunnerFiles({
|
||||
argv: [process.execPath, '-e', 'process.exit(11)'],
|
||||
|
||||
@@ -119,16 +119,14 @@ function runRunner(invocation: string[], requestPath: string, eventsPath: string
|
||||
}
|
||||
|
||||
describe('spawn runner transport', () => {
|
||||
it('selects the source runner from source-plane execution', () => {
|
||||
it('selects the source runner without publishing a runner package face', () => {
|
||||
expect(spawnRunnerInvocation()).toEqual(sourceInvocation)
|
||||
const manifest = JSON.parse(readFileSync(
|
||||
fileURLToPath(new URL('../package.json', import.meta.url)),
|
||||
'utf8',
|
||||
)) as { exports: Record<string, { types: string; default: string }> }
|
||||
expect(manifest.exports['./spawn-runner']).toEqual({
|
||||
types: './lib/types/bin.d.ts',
|
||||
default: './lib/spawn-runner.js',
|
||||
})
|
||||
)) as { exports: Record<string, unknown> }
|
||||
expect(manifest.exports).not.toHaveProperty('./spawn-runner')
|
||||
expect(manifest.exports['./package.json']).toBe('./package.json')
|
||||
})
|
||||
|
||||
it('observes runner events without SharedArrayBuffer', async () => {
|
||||
|
||||
@@ -42,7 +42,6 @@ const EXECUTABLE_SOURCE_ALLOWLIST = new Map<string, string>([
|
||||
['packages/subagent/subagent-claude-code/tests/fixtures/loader/driver.ts', 'test-only subprocess driver'],
|
||||
['packages/subagent/subagent-codex/tests/fixtures/loader/driver.ts', 'test-only subprocess driver'],
|
||||
['packages/subagent/subagent-dsh-sdk/tests/fixtures/loader/driver.ts', 'test-only subprocess driver'],
|
||||
['packages/subprocess/subprocess-local/src/bin.ts', 'private subprocess runner implementation'],
|
||||
['packages/test-support/loader-smoke/tests/fixtures/headless-driver.ts', 'test-only subprocess driver'],
|
||||
['packages/test-support/llm-mock-server/src/bin.ts', 'test-only model server'],
|
||||
])
|
||||
|
||||
Reference in New Issue
Block a user