more info for attached to target

This commit is contained in:
Tommy D. Rossi
2025-11-24 20:09:53 +01:00
parent 04da468b7f
commit 7b247d281e
+7 -3
View File
@@ -297,8 +297,7 @@ export async function startPlayWriterCDPRelayServer({ port = 19988, host = '127.
if (method === 'Target.setAutoAttach' && !sessionId) { if (method === 'Target.setAutoAttach' && !sessionId) {
for (const target of connectedTargets.values()) { for (const target of connectedTargets.values()) {
sendToPlaywright({ const attachedPayload = {
message: {
method: 'Target.attachedToTarget', method: 'Target.attachedToTarget',
params: { params: {
sessionId: target.sessionId, sessionId: target.sessionId,
@@ -308,7 +307,10 @@ export async function startPlayWriterCDPRelayServer({ port = 19988, host = '127.
}, },
waitingForDebugger: false waitingForDebugger: false
} }
} satisfies CDPEvent, } satisfies CDPEvent
logger.log(chalk.magenta('[Server] Target.attachedToTarget full payload:'), JSON.stringify(attachedPayload))
sendToPlaywright({
message: attachedPayload,
clientId, clientId,
source: 'server' source: 'server'
}) })
@@ -415,6 +417,8 @@ export async function startPlayWriterCDPRelayServer({ port = 19988, host = '127.
if (method === 'Target.attachedToTarget') { if (method === 'Target.attachedToTarget') {
const targetParams = params as Protocol.Target.AttachedToTargetEvent const targetParams = params as Protocol.Target.AttachedToTargetEvent
logger.log(chalk.yellow('[Extension] Target.attachedToTarget full payload:'), JSON.stringify({ method, params: targetParams, sessionId }))
// Check if we already sent this target to clients (e.g., from Target.setAutoAttach response) // Check if we already sent this target to clients (e.g., from Target.setAutoAttach response)
const alreadyConnected = connectedTargets.has(targetParams.sessionId) const alreadyConnected = connectedTargets.has(targetParams.sessionId)