refactor: hide subagent implementation helpers

This commit is contained in:
Tianyi Cui
2026-07-14 02:41:23 +08:00
parent 225796c90d
commit f85b831bd2
9 changed files with 54 additions and 87 deletions
@@ -36,7 +36,7 @@ declare module '@deepseek-ai/dsh-agent' {
* @param agent - the agent whose options carry the depth.
* @returns its non-negative safe-integer depth.
*/
export function depthOf(agent: Agent): number {
function depthOf(agent: Agent): number {
const depth = agent.options.subagentDepth
if (depth === undefined) return 0
if (!Number.isSafeInteger(depth) || depth < 0 || Object.is(depth, -0)) {
@@ -46,7 +46,7 @@ export function depthOf(agent: Agent): number {
}
/** Thrown when starting a child would exceed the requested depth cap. */
export class SubagentDepthError extends Error {
class SubagentDepthError extends Error {
constructor(public readonly attemptedDepth: number, public readonly maxDepth: number) {
super(`subagent depth ${attemptedDepth} exceeds maxDepth ${maxDepth}`)
this.name = 'SubagentDepthError'