Files
deepseek-harness/packages/bundle/headless/src/runner-internals.ts
T
lsdsjy 3be1ea10b9 refactor(headless): move the runner process hooks out of the package entry
Address the Code Entropy follow-up on d9c4f53758: the runner entry still
expanded its process-substitution object with a `readStdin` hook used only by
tests. Move that seam to `src/runner-internals.ts`, mirroring
`src/startup-internals.ts`, so neither entry grows package API for tests.
2026-09-10 19:13:05 +08:00

22 lines
760 B
TypeScript

/**
* Process streams the runner reads and writes, kept out of the package entry so
* substituting them in tests adds no public package API. The shape matches the
* runner's own IO carrier structurally.
* @module @deepseek-ai/dsh-headless/runner-internals
*/
/** The process streams the runner reads and writes; tests substitute captures. */
export const internals: {
stdout: { write(chunk: string): unknown }
stderr: { write(chunk: string): unknown }
readStdin: () => Promise<string>
} = {
stdout: process.stdout,
stderr: process.stderr,
readStdin: async () => {
const chunks: Buffer[] = []
for await (const chunk of process.stdin as AsyncIterable<Buffer>) chunks.push(chunk)
return Buffer.concat(chunks).toString('utf8')
},
}