Skip to content

Commit 569dfcb

Browse files
committed
update logging
1 parent 84c2105 commit 569dfcb

File tree

5 files changed

+21
-20
lines changed

5 files changed

+21
-20
lines changed

packages/core/lib/v3/handlers/actHandler.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,12 @@ export class ActHandler {
7171

7272
const llmClient = this.resolveLlmClient(model);
7373

74+
v3Logger({
75+
category: "action",
76+
message: `[act] ${instruction}`,
77+
level: 1,
78+
});
79+
7480
const doObserveAndAct = async (): Promise<ActResult> => {
7581
await waitForDomNetworkQuiet(
7682
page.mainFrame(),
@@ -325,6 +331,13 @@ export class ActHandler {
325331
): Promise<ActResult> {
326332
const settleTimeout = domSettleTimeoutMs ?? this.defaultDomSettleTimeoutMs;
327333
const effectiveClient = llmClientOverride ?? this.llmClient;
334+
335+
v3Logger({
336+
category: "action",
337+
message: `[act] ${action.description}`,
338+
level: 1,
339+
});
340+
328341
const method = action.method?.trim();
329342
if (!method || method === "not-supported") {
330343
v3Logger({

packages/core/lib/v3/handlers/extractHandler.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,11 +123,8 @@ export class ExtractHandler {
123123

124124
v3Logger({
125125
category: "extraction",
126-
message: "Starting extraction using a11y snapshot",
126+
message: instruction ? `[extract] ${instruction}` : "[extract] Extracting page text",
127127
level: 1,
128-
auxiliary: instruction
129-
? { instruction: { value: instruction, type: "string" } }
130-
: undefined,
131128
});
132129

133130
// Normalize schema: if instruction provided without schema, use defaultExtractSchema

packages/core/lib/v3/handlers/handlerUtils/actHandlerUtils.ts

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ export async function performUnderstudyMethod(
103103
}
104104
}
105105

106-
await handlePossibleNavigation("action", selectorRaw, initialUrl, frame);
106+
await handlePossibleNavigation(initialUrl, frame);
107107
} catch (e) {
108108
const msg = e instanceof Error ? e.message : String(e);
109109
const stack = e instanceof Error ? e.stack : undefined;
@@ -608,7 +608,7 @@ export async function waitForDomNetworkQuiet(
608608
v3Logger({
609609
category: "dom",
610610
message: "⏳ forcing completion of stalled iframe document",
611-
level: 1,
611+
level: 2,
612612
auxiliary: {
613613
url: { value: (m.url ?? "").slice(0, 120), type: "string" },
614614
},
@@ -651,16 +651,13 @@ export async function waitForDomNetworkQuiet(
651651
}
652652

653653
async function handlePossibleNavigation(
654-
actionDescription: string,
655-
xpath: string,
656654
initialUrl: string,
657655
frame: Frame,
658656
): Promise<void> {
659657
v3Logger({
660658
category: "action",
661-
message: `${actionDescription}, checking for page navigation`,
659+
message: `checking for page navigation`,
662660
level: 1,
663-
auxiliary: { xpath: { value: xpath, type: "string" } },
664661
});
665662

666663
// We only have a frame-scoped session, so detect navigation by URL change.
@@ -670,14 +667,14 @@ async function handlePossibleNavigation(
670667
v3Logger({
671668
category: "action",
672669
message: "new page (frame) URL detected",
673-
level: 1,
670+
level: 2,
674671
auxiliary: { url: { value: afterUrl, type: "string" } },
675672
});
676673
} else {
677674
v3Logger({
678675
category: "action",
679676
message: "no new (frame) URL detected",
680-
level: 1,
677+
level: 2,
681678
auxiliary: { url: { value: afterUrl, type: "string" } },
682679
});
683680
}

packages/core/lib/v3/handlers/observeHandler.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -66,14 +66,8 @@ export class ObserveHandler {
6666
const doObserve = async (): Promise<Action[]> => {
6767
v3Logger({
6868
category: "observation",
69-
message: "starting observation",
69+
message: `[observe] ${effectiveInstruction}`,
7070
level: 1,
71-
auxiliary: {
72-
instruction: {
73-
value: effectiveInstruction,
74-
type: "string",
75-
},
76-
},
7771
});
7872

7973
// Build the hybrid snapshot (a11y-centric text tree + lookup maps)

packages/core/lib/v3/llm/aisdk.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ export class AISdkClient extends LLMClient {
194194
this.logger?.({
195195
category: "aisdk",
196196
message: "response",
197-
level: 1,
197+
level: 2,
198198
auxiliary: {
199199
response: {
200200
value: JSON.stringify({

0 commit comments

Comments
 (0)