Files
callstack__agent-device/src/cli/commands/agent-cdp.ts
T
Michał Pierzchała be1e1c9931 feat: add cdp command agent-cdp passthrough (#873)
* feat: add agent-cdp passthrough

* docs: narrow agent-cdp memory guidance

* chore: pin agent-cdp 1.6.0

* test: cover agent-cdp guidance

* fix: preserve agent-cdp passthrough flags

* fix: expose CDP wrapper as cdp

* docs: move CDP workflow to debugging guide

* docs: mention cdp in command reference
2026-06-25 21:44:47 +02:00

33 lines
918 B
TypeScript

import { runCmdStreaming } from '../../utils/exec.ts';
const AGENT_CDP_VERSION = '1.6.0';
export const AGENT_CDP_PACKAGE = `agent-cdp@${AGENT_CDP_VERSION}`;
const AGENT_CDP_BIN = 'agent-cdp';
type AgentCdpCommandOptions = {
cwd?: string;
env?: NodeJS.ProcessEnv;
};
export function buildAgentCdpNpmExecArgs(args: string[]): string[] {
return ['exec', '--yes', '--package', AGENT_CDP_PACKAGE, '--', AGENT_CDP_BIN, ...args];
}
export async function runAgentCdpCommand(
args: string[],
options: AgentCdpCommandOptions = {},
): Promise<number> {
const result = await runCmdStreaming('npm', buildAgentCdpNpmExecArgs(args), {
cwd: options.cwd ?? process.cwd(),
env: options.env ?? process.env,
allowFailure: true,
onStdoutChunk: (chunk) => {
process.stdout.write(chunk);
},
onStderrChunk: (chunk) => {
process.stderr.write(chunk);
},
});
return result.exitCode;
}