Skip to content

Commit 9d4bac6

Browse files
Lightning00BladeDevtools-frontend LUCI CQ
authored andcommitted
[AI Assistance] Remove unnecessary rpcIds
Only steps coming from the LLM should have these ids Bug: none Change-Id: Icc47826c4403d58fda6a7096383a652fdc084cd3 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6063881 Auto-Submit: Nikolay Vitkov <[email protected]> Commit-Queue: Nikolay Vitkov <[email protected]> Reviewed-by: Ergün Erdoğmuş <[email protected]> Commit-Queue: Ergün Erdoğmuş <[email protected]>
1 parent 8e3a8c7 commit 9d4bac6

File tree

3 files changed

+3
-12
lines changed

3 files changed

+3
-12
lines changed

front_end/panels/freestyler/AiAgent.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,15 +65,13 @@ export interface SideEffectResponse {
6565
type: ResponseType.SIDE_EFFECT;
6666
code: string;
6767
confirm: (confirm: boolean) => void;
68-
rpcId?: number;
6968
}
7069

7170
export interface ActionResponse {
7271
type: ResponseType.ACTION;
7372
code: string;
7473
output: string;
7574
canceled: boolean;
76-
rpcId?: number;
7775
}
7876

7977
export interface QueryResponse {
@@ -303,7 +301,7 @@ export abstract class AiAgent<T> {
303301
return request;
304302
}
305303

306-
handleAction(action: string, rpcId?: number): AsyncGenerator<SideEffectResponse, ActionResponse, void>;
304+
handleAction(action: string): AsyncGenerator<SideEffectResponse, ActionResponse, void>;
307305
handleAction(): never {
308306
throw new Error('Unexpected action found');
309307
}
@@ -557,7 +555,7 @@ STOP`;
557555
}
558556

559557
if (action) {
560-
const result = yield* this.handleAction(action, rpcId);
558+
const result = yield* this.handleAction(action);
561559
this.#addHistory(result);
562560
query = `OBSERVATION: ${result.output}`;
563561
// Capture history state for the next iteration query.

front_end/panels/freestyler/FreestylerAgent.test.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1154,7 +1154,6 @@ ANSWER: this is the answer`,
11541154
code: 'console.log(\'hello\');',
11551155
output: 'hello',
11561156
canceled: false,
1157-
rpcId: undefined,
11581157
},
11591158
{
11601159
type: Freestyler.ResponseType.QUERYING,
@@ -1342,7 +1341,6 @@ ANSWER: this is the answer`,
13421341
code: 'console.log(\'test\')',
13431342
output: 'undefined',
13441343
canceled: false,
1345-
rpcId: undefined,
13461344
},
13471345
{
13481346
type: Freestyler.ResponseType.QUERYING,

front_end/panels/freestyler/FreestylerAgent.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -580,16 +580,14 @@ export class FreestylerAgent extends AiAgent<SDK.DOMModel.DOMNode> {
580580
return output.trim();
581581
}
582582

583-
override async *
584-
handleAction(action: string, rpcId?: number): AsyncGenerator<SideEffectResponse, ActionResponse, void> {
583+
override async * handleAction(action: string): AsyncGenerator<SideEffectResponse, ActionResponse, void> {
585584
debugLog(`Action to execute: ${action}`);
586585
if (this.executionMode === Root.Runtime.HostConfigFreestylerExecutionMode.NO_SCRIPTS) {
587586
return {
588587
type: ResponseType.ACTION,
589588
code: action,
590589
output: 'Error: JavaScript execution is currently disabled.',
591590
canceled: true,
592-
rpcId,
593591
};
594592
}
595593

@@ -605,7 +603,6 @@ export class FreestylerAgent extends AiAgent<SDK.DOMModel.DOMNode> {
605603
code: action,
606604
output: 'Error: JavaScript execution that modifies the page is currently disabled.',
607605
canceled: true,
608-
rpcId,
609606
};
610607
}
611608

@@ -621,7 +618,6 @@ export class FreestylerAgent extends AiAgent<SDK.DOMModel.DOMNode> {
621618
Host.UserMetrics.Action.AiAssistanceSideEffectRejected,
622619
);
623620
},
624-
rpcId,
625621
};
626622

627623
result = await this.#generateObservation(action, {
@@ -634,7 +630,6 @@ export class FreestylerAgent extends AiAgent<SDK.DOMModel.DOMNode> {
634630
code: action,
635631
output: result.observation,
636632
canceled: result.canceled,
637-
rpcId,
638633
};
639634
} finally {
640635
await scope.uninstall();

0 commit comments

Comments
 (0)