mirror of
https://github.com/deepseek-ai/deepseek-harness.git
synced 2026-08-30 04:40:37 +00:00
Resolve packaged profile proxies with Node ESM import conditions from each package installation, and fail loud when an explicit runtime export or legacy main entry is missing. Serialize the shared profile fallback under the existing cross-process writer lock so concurrent dsh processes cannot observe partial proxies; either carrier now replaces the other carrier’s managed entry without manual cleanup. Give Python initialize its own 10-second default bound and name the selected profile in timeout diagnostics, while leaving ordinary agent turns unbounded by default. Package the dynamically resolved web frontend and skill-badge assets so the runtime wheel’s normal dsh profiles do not depend on pkg static-discovery accidents. Rewrite the root launch rule and every active stale SDK-runtime note to the shipped dsh profile architecture in both languages. Focused tests prove import-only and transitive package exports, lock contention, cross-carrier transitions, missing-entry failures, asset inventory, and bounded initialization.
51 lines
1.6 KiB
JavaScript
51 lines
1.6 KiB
JavaScript
#!/usr/bin/env node
|
|
/**
|
|
* Command-line entry for dsh.
|
|
* @module @deepseek-ai/dsh/bin
|
|
*/
|
|
|
|
/* v8 ignore file -- built-bin acceptance exercises this self-executing dispatch. */
|
|
|
|
import { readFileSync } from 'node:fs'
|
|
import { fileURLToPath } from 'node:url'
|
|
import { loadLayeredEnv } from '@deepseek-ai/dsh-app-boot'
|
|
import { parseDshArgs } from './args.ts'
|
|
|
|
// Both the source tree (apps/cli/src) and the bundled bin (apps/cli/lib) sit
|
|
// one directory under apps/cli, so the checked-in manifest resolves with the
|
|
// same relative hop from either artifact.
|
|
function readVersion(): string {
|
|
const manifest = JSON.parse(
|
|
readFileSync(fileURLToPath(new URL('../package.json', import.meta.url)), 'utf8'),
|
|
) as { version?: unknown }
|
|
return typeof manifest.version === 'string' ? manifest.version : '0.0.0'
|
|
}
|
|
|
|
const invocation = parseDshArgs(process.argv.slice(2), readVersion())
|
|
|
|
switch (invocation.mode) {
|
|
case 'profile': {
|
|
const { runProfile } = await import('./profile-boot.ts')
|
|
await runProfile({
|
|
environment: loadLayeredEnv('dsh'),
|
|
profile: invocation.profile,
|
|
patchFiles: invocation.patches,
|
|
args: invocation.args,
|
|
})
|
|
break
|
|
}
|
|
case 'plugin': {
|
|
const { runPlugin } = await import('./plugin.ts')
|
|
process.exit(runPlugin(invocation.profile, invocation.args))
|
|
break
|
|
}
|
|
case 'dump-config': {
|
|
const { runDumpConfig } = await import('./dump-config.ts')
|
|
await runDumpConfig(invocation.profile, invocation.defaultOnly, invocation.patches)
|
|
break
|
|
}
|
|
default:
|
|
invocation satisfies never
|
|
throw new Error(`dsh: unhandled invocation mode ${JSON.stringify(invocation)}`)
|
|
}
|