refactor: apply repository naming contract

Apply the accepted pre-release package, service, type, directory, and role renames as one repository-wide change.
This commit is contained in:
Tianyi Cui
2026-08-13 00:36:22 +08:00
parent 101df7cf58
commit a2d0f7f411
3281 changed files with 21730 additions and 21592 deletions

View File

@@ -2,5 +2,5 @@
# side as of the last confirmed-consistent state. Both languages carry equal authority;
# after editing either side, bring the other along and re-record with:
# pnpm run verify-translation-pairing --write packages/subprocess/subprocess-local/README.md
README.md: bf0af8779f0cc3e2c20382db40be4715814e78f4
README.zh.md: 6d0e102d9b4c55049106f937b6f04ec26a458cb6
README.md: 645f05a0daf92d64c438f8aaae3b0e115f253a64
README.zh.md: cd8c04071f00b298b2d242624c2ad1327758e16e

View File

@@ -2,7 +2,7 @@
English | [中文](README.zh.md)
Local Service provider for the [`@deepseek-ai/dsh-subprocess`](../subprocess/README.md) seam. `LocalSubprocessService` resolves local executables, spawns ordinary detached process trees with explicit stdio, and implements terminal processes through `node-pty` plus platform process inspection. It has no config: every disposition, limit, terminal dimension, grace, and directory arrives from the calling capability seams ([`dsh-bash-local`](../../bash/bash-local/README.md), [`dsh-lsp-local`](../../lsp/lsp-local/README.md), and [`dsh-pty-local`](../../pty/pty-local/README.md)).
Local Service provider for the [`@deepseek-ai/dsh-subprocess`](../subprocess/README.md) seam. `LocalSubprocessRuntime` resolves local executables, spawns ordinary detached process trees with explicit stdio, and implements terminal processes through `node-pty` plus platform process inspection. It has no config: every disposition, limit, terminal dimension, grace, and directory arrives from the calling capability seams ([`dsh-bash-local`](../../shell/bash-local/README.md), [`dsh-lsp-stdio`](../../lsp/lsp-stdio/README.md), and [`dsh-terminal-bash`](../../terminal/terminal-bash/README.md)).
## Behavior

View File

@@ -2,7 +2,7 @@
[English](README.md) | 中文
[`@deepseek-ai/dsh-subprocess`](../subprocess/README.md) seam 的本地 Service provider。`LocalSubprocessService` 解析本地可执行文件,以显式 stdio spawn 普通 detached 进程树,并通过 `node-pty` 加平台进程检查实现终端进程。该实现没有任何配置:每项处置方式、限制、终端尺寸、宽限期与目录都来自调用方能力 seam[`dsh-bash-local`](../../bash/bash-local/README.md)、[`dsh-lsp-local`](../../lsp/lsp-local/README.md) 和 [`dsh-pty-local`](../../pty/pty-local/README.md))。
[`@deepseek-ai/dsh-subprocess`](../subprocess/README.md) seam 的本地 Service provider。`LocalSubprocessRuntime` 解析本地可执行文件,以显式 stdio spawn 普通 detached 进程树,并通过 `node-pty` 加平台进程检查实现终端进程。该实现没有任何配置:每项处置方式、限制、终端尺寸、宽限期与目录都来自调用方能力 seam[`dsh-bash-local`](../../shell/bash-local/README.md)、[`dsh-lsp-stdio`](../../lsp/lsp-stdio/README.md) 和 [`dsh-terminal-bash`](../../terminal/terminal-bash/README.md))。
## 行为

View File

@@ -14,7 +14,7 @@ import { delimiter, extname, isAbsolute, resolve } from 'node:path'
import { Context } from '@deepseek-ai/cordis'
import * as nodePty from 'node-pty'
import type { IPtyForkOptions } from 'node-pty'
import { SubprocessService } from '@deepseek-ai/dsh-subprocess'
import { SubprocessRuntime } from '@deepseek-ai/dsh-subprocess'
import type {
SubprocessHandle,
SubprocessSpawnSpec,
@@ -34,7 +34,7 @@ import { LocalTerminalHandle } from './terminal.ts'
* SIGTERM→grace→SIGKILL escalation, plus synchronous final termination during
* JavaScript-observable host exit.
*/
export class LocalSubprocessService extends SubprocessService {
export class LocalSubprocessRuntime extends SubprocessRuntime {
/** Live handles retained for normal disposal and synchronous host-exit finalization. */
private live = new Set<LocalSubprocessHandle>()
/** Live terminals retained through normal quiescence or host-exit finalization. */
@@ -192,4 +192,4 @@ function environmentValue(env: NodeJS.ProcessEnv, name: 'PATH' | 'PATHEXT'): str
return Object.entries(env).find(([key]) => key.toUpperCase() === normalized)?.[1]
}
export default LocalSubprocessService
export default LocalSubprocessRuntime

View File

@@ -2,7 +2,7 @@ import { access, readFile, writeFile } from 'node:fs/promises'
import { join } from 'node:path'
import { fileURLToPath } from 'node:url'
import { Context } from '@deepseek-ai/cordis'
import LocalSubprocessService from '@deepseek-ai/dsh-subprocess-local'
import LocalSubprocessRuntime from '@deepseek-ai/dsh-subprocess-local'
const [kind, trigger, root] = process.argv.slice(2)
if ((kind !== 'ordinary' && kind !== 'terminal')
@@ -30,7 +30,7 @@ async function waitForFile(path: string): Promise<void> {
const listenersBefore = process.listenerCount('exit')
const ctx = new Context()
const fiber = await ctx.plugin(LocalSubprocessService)
const fiber = await ctx.plugin(LocalSubprocessRuntime)
const listenersAfterLoad = process.listenerCount('exit')
if (kind === 'ordinary') {
ctx.subprocess.spawn({

View File

@@ -2,7 +2,7 @@ import { PassThrough } from 'node:stream'
import { describe, expect, it, vi } from 'vitest'
import { basename, dirname, relative, resolve } from 'node:path'
import { Context } from '@deepseek-ai/cordis'
import LocalSubprocessService from '@deepseek-ai/dsh-subprocess-local'
import LocalSubprocessRuntime from '@deepseek-ai/dsh-subprocess-local'
import type { SubprocessSpawnSpec, SubprocessTerminalHandle, SubprocessTerminalSpawnSpec } from '@deepseek-ai/dsh-subprocess'
import { childEnv } from '../src/spawn.ts'
@@ -20,13 +20,13 @@ function spec(command: string, overrides: Partial<SubprocessSpawnSpec> = {}): Su
}
}
describe('LocalSubprocessService', () => {
describe('LocalSubprocessRuntime', () => {
it('places the host-exit finalizer before listeners that predate the service', async () => {
const baseline = new Set(process.listeners('exit'))
const prior = vi.fn()
process.on('exit', prior)
const ctx = new Context()
const fiber = await ctx.plugin(LocalSubprocessService)
const fiber = await ctx.plugin(LocalSubprocessRuntime)
try {
const listeners = process.listeners('exit')
const finalizer = listeners.find(candidate => !baseline.has(candidate) && candidate !== prior)
@@ -41,7 +41,7 @@ describe('LocalSubprocessService', () => {
it('keeps the host-exit finalizer active until normal disposal reaches quiescence', async () => {
const before = new Set(process.listeners('exit'))
const ctx = new Context()
const fiber = await ctx.plugin(LocalSubprocessService)
const fiber = await ctx.plugin(LocalSubprocessRuntime)
const listener = process.listeners('exit').find(candidate => !before.has(candidate))
expect(listener).toBeTypeOf('function')
@@ -82,7 +82,7 @@ describe('LocalSubprocessService', () => {
it('contains each host-exit termination failure and continues with the other targets', async () => {
const before = new Set(process.listeners('exit'))
const ctx = new Context()
const fiber = await ctx.plugin(LocalSubprocessService)
const fiber = await ctx.plugin(LocalSubprocessRuntime)
const listener = process.listeners('exit').find(candidate => !before.has(candidate))
expect(listener).toBeTypeOf('function')
const ordinaryFailure = vi.fn(() => { throw new Error('ordinary failed') })
@@ -111,7 +111,7 @@ describe('LocalSubprocessService', () => {
it('resolves absolute and PATH executables and honors lookup cancellation', async () => {
const ctx = new Context()
const fiber = await ctx.plugin(LocalSubprocessService)
const fiber = await ctx.plugin(LocalSubprocessRuntime)
expect(await ctx.subprocess.resolveExecutable(process.execPath)).toBe(process.execPath)
expect(await ctx.subprocess.resolveExecutable(basename(process.execPath), {
PATH: dirname(process.execPath),
@@ -137,8 +137,8 @@ describe('LocalSubprocessService', () => {
it('builds Windows executable candidates with case-insensitive overrides', async () => {
const ctx = new Context()
const fiber = await ctx.plugin(LocalSubprocessService)
const service = ctx.subprocess as LocalSubprocessService
const fiber = await ctx.plugin(LocalSubprocessRuntime)
const service = ctx.subprocess as LocalSubprocessRuntime
const candidates = (service as unknown as {
executableCandidates(command: string, env: NodeJS.ProcessEnv): string[]
}).executableCandidates.bind(service)
@@ -163,7 +163,7 @@ describe('LocalSubprocessService', () => {
it('validates terminal allocation inputs before allocating a PTY', async () => {
const ctx = new Context()
const fiber = await ctx.plugin(LocalSubprocessService)
const fiber = await ctx.plugin(LocalSubprocessRuntime)
const base: SubprocessTerminalSpawnSpec = {
argv: ['bash'], cwd: process.cwd(), rows: 24, cols: 80, graceMs: 10,
}
@@ -175,7 +175,7 @@ describe('LocalSubprocessService', () => {
it('terminates and joins an owned terminal during disposal', async () => {
const ctx = new Context()
const fiber = await ctx.plugin(LocalSubprocessService)
const fiber = await ctx.plugin(LocalSubprocessRuntime)
const terminate = vi.fn(async () => {})
const terminal: SubprocessTerminalHandle = {
pid: 1,
@@ -195,7 +195,7 @@ describe('LocalSubprocessService', () => {
it('waits for every terminal cleanup and aggregates teardown failures', async () => {
const ctx = new Context()
const fiber = await ctx.plugin(LocalSubprocessService)
const fiber = await ctx.plugin(LocalSubprocessRuntime)
const service = ctx.subprocess
const firstFailure = new Error('first cleanup failure')
const secondFailure = new Error('second cleanup failure')
@@ -246,7 +246,7 @@ describe('LocalSubprocessService', () => {
const failure = new Error('single cleanup failure')
const disposalErrors: unknown[] = []
ctx.logger.error = ((error: unknown) => { disposalErrors.push(error) }) as typeof ctx.logger.error
const fiber = await ctx.plugin(LocalSubprocessService)
const fiber = await ctx.plugin(LocalSubprocessRuntime)
const service = ctx.subprocess
const terminal: SubprocessTerminalHandle = {
pid: 1,
@@ -268,7 +268,7 @@ describe('LocalSubprocessService', () => {
it('force-terminates remaining targets before releasing a failed disposal', async () => {
const before = new Set(process.listeners('exit'))
const ctx = new Context()
const fiber = await ctx.plugin(LocalSubprocessService)
const fiber = await ctx.plugin(LocalSubprocessRuntime)
const listener = process.listeners('exit').find(candidate => !before.has(candidate))
expect(listener).toBeTypeOf('function')
const failure = new Error('cleanup failed')
@@ -317,10 +317,10 @@ describe('LocalSubprocessService', () => {
createProcessInspector: () => inspector,
}))
try {
const { default: IsolatedLocalSubprocessService } = await import('../src/index.ts')
const { default: IsolatedLocalSubprocessRuntime } = await import('../src/index.ts')
const ctx = new Context()
const fiber = await ctx.plugin(IsolatedLocalSubprocessService)
const service = ctx.subprocess as InstanceType<typeof IsolatedLocalSubprocessService>
const fiber = await ctx.plugin(IsolatedLocalSubprocessRuntime)
const service = ctx.subprocess as InstanceType<typeof IsolatedLocalSubprocessRuntime>
const handle = await ctx.subprocess.spawnTerminal({
argv: ['shell'], cwd: process.cwd(), rows: 24, cols: 80, graceMs: 1,
})
@@ -352,13 +352,13 @@ describe('LocalSubprocessService', () => {
vi.resetModules()
vi.doMock('node-pty', () => ({ spawn: () => terminal }))
try {
const { default: IsolatedLocalSubprocessService } = await import('../src/index.ts')
const { default: IsolatedLocalSubprocessRuntime } = await import('../src/index.ts')
const ctx = new Context()
const disposalErrors: unknown[] = []
ctx.logger.error = ((error: unknown) => { disposalErrors.push(error) }) as typeof ctx.logger.error
const fiber = await ctx.plugin(IsolatedLocalSubprocessService)
const fiber = await ctx.plugin(IsolatedLocalSubprocessRuntime)
const alive = new Set([124])
;(ctx.subprocess as InstanceType<typeof IsolatedLocalSubprocessService>).terminalInspector = {
;(ctx.subprocess as InstanceType<typeof IsolatedLocalSubprocessRuntime>).terminalInspector = {
foregroundPgid: () => 123,
isStdinWaiting: () => false,
processTree: () => [{ pid: 123, started: 'shell' }, { pid: 124, started: 'child' }],
@@ -384,7 +384,7 @@ describe('LocalSubprocessService', () => {
it('registers as ctx.subprocess and spawns managed handles', async () => {
const ctx = new Context()
const fiber = await ctx.plugin(LocalSubprocessService)
const fiber = await ctx.plugin(LocalSubprocessRuntime)
const handle = ctx.subprocess.spawn(spec('echo managed'))
const result = await handle.done
expect(result.exitCode).toBe(0)
@@ -394,7 +394,7 @@ describe('LocalSubprocessService', () => {
it('disposal kills still-running processes and awaits their exit', async () => {
const ctx = new Context()
const fiber = await ctx.plugin(LocalSubprocessService)
const fiber = await ctx.plugin(LocalSubprocessRuntime)
const handle = ctx.subprocess.spawn(spec('sleep 60'))
await fiber.dispose()
const outcome = await handle.done
@@ -403,7 +403,7 @@ describe('LocalSubprocessService', () => {
it('a settled process leaves the live set (disposal does not re-kill it)', async () => {
const ctx = new Context()
const fiber = await ctx.plugin(LocalSubprocessService)
const fiber = await ctx.plugin(LocalSubprocessRuntime)
const handle = ctx.subprocess.spawn(spec('true'))
const outcome = await handle.done
expect(outcome.exitCode).toBe(0)
@@ -412,7 +412,7 @@ describe('LocalSubprocessService', () => {
it('disposal tolerates a handle whose spawn already failed', async () => {
const ctx = new Context()
const fiber = await ctx.plugin(LocalSubprocessService)
const fiber = await ctx.plugin(LocalSubprocessRuntime)
const handle = ctx.subprocess.spawn(spec('true', { cwd: '/nonexistent-dir-dsh-subprocess-test' }))
await expect(handle.done).rejects.toThrow()
await fiber.dispose()
@@ -420,7 +420,7 @@ describe('LocalSubprocessService', () => {
it('disposal contains a spawn-failure rejection that races teardown', async () => {
const ctx = new Context()
const fiber = await ctx.plugin(LocalSubprocessService)
const fiber = await ctx.plugin(LocalSubprocessRuntime)
// Dispose before the rejection continuation removes the handle from the
// live set, so teardown itself must swallow the rejected done.
const handle = ctx.subprocess.spawn(spec('true', { cwd: '/nonexistent-dir-dsh-subprocess-test' }))
@@ -430,8 +430,8 @@ describe('LocalSubprocessService', () => {
it('loading a second implementation throws (one processes service per context — cordis standard)', async () => {
const ctx = new Context()
await ctx.plugin(LocalSubprocessService)
class SecondManager extends LocalSubprocessService {}
await ctx.plugin(LocalSubprocessRuntime)
class SecondManager extends LocalSubprocessRuntime {}
await expect(ctx.plugin(SecondManager)).rejects.toThrow(/service "subprocess" has been registered/)
})
})

View File

@@ -706,10 +706,10 @@ describe('tree-survivor escalation (terminate and bounded waits reach helpers th
it('service teardown awaits tree survivors, not just handle settlement', async () => {
const { Context } = await import('@deepseek-ai/cordis')
const { default: LocalSubprocessService } = await import('@deepseek-ai/dsh-subprocess-local')
const { default: LocalSubprocessRuntime } = await import('@deepseek-ai/dsh-subprocess-local')
const ctx = new Context()
const fiber = await ctx.plugin(LocalSubprocessService)
;(ctx.subprocess as InstanceType<typeof LocalSubprocessService>).internals = { spillDir }
const fiber = await ctx.plugin(LocalSubprocessRuntime)
;(ctx.subprocess as InstanceType<typeof LocalSubprocessRuntime>).internals = { spillDir }
const pidFile = join(spillDir, `survivor-svc-${Date.now()}.pid`)
const running = ctx.subprocess.spawn(spec(
`bash -c 'trap "" TERM; echo $$ > ${pidFile}; sleep 60' >/dev/null 2>&1 & disown; exit 0`,

View File

@@ -21,7 +21,7 @@
"path": "../../util/timeout"
},
{
"path": "../../support/invariants"
"path": "../../runtime-diagnostics/invariants"
}
]
}