Skip to content

Commit 73adf2f

Browse files
OrKoNDevtools-frontend LUCI CQ
authored andcommitted
Explicitly set required to parameters
Bug: 467254906 Change-Id: Ib436f0ab62d454ac214e335535cfecd4c9c6ab57 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/7483011 Commit-Queue: Alex Rudenko <alexrudenko@chromium.org> Reviewed-by: Connor Clark <cjamcl@chromium.org>
1 parent c57cb25 commit 73adf2f

File tree

6 files changed

+40
-5
lines changed

6 files changed

+40
-5
lines changed

front_end/core/host/AidaClient.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ export interface FunctionObjectParam<T extends string|number|symbol = string> ex
7979
type: ParametersTypes.OBJECT;
8080
// TODO: this can be also be ObjectParams
8181
properties: Record<T, FunctionPrimitiveParams|FunctionArrayParam>;
82+
required: string[];
8283
}
8384

8485
/**

front_end/models/ai_assistance/agents/AiAgent.test.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,12 @@ describeWithEnvironment('AiAgent', () => {
430430
super(opts);
431431
this.declareFunction('testFn', {
432432
description: 'test fn description',
433-
parameters: {type: Host.AidaClient.ParametersTypes.OBJECT, properties: {}, description: 'arg description'},
433+
parameters: {
434+
type: Host.AidaClient.ParametersTypes.OBJECT,
435+
properties: {},
436+
description: 'arg description',
437+
required: []
438+
},
434439
handler: this.#test.bind(this),
435440
});
436441
}
@@ -469,6 +474,7 @@ describeWithEnvironment('AiAgent', () => {
469474
description: 'arg description',
470475
properties: {},
471476
type: 6,
477+
required: [],
472478
},
473479
}],
474480
);

front_end/models/ai_assistance/agents/PatchAgent.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ export class PatchAgent extends AiAgent<Workspace.Workspace.Project> {
9797
description: '',
9898
nullable: true,
9999
properties: {},
100+
required: [],
100101
},
101102
handler: async () => {
102103
const files = this.#project.getFiles();
@@ -143,9 +144,10 @@ export class PatchAgent extends AiAgent<Workspace.Workspace.Project> {
143144
isRegex: {
144145
type: Host.AidaClient.ParametersTypes.BOOLEAN,
145146
description: 'Whether the query is a regular expression or not',
146-
nullable: true,
147+
nullable: false,
147148
}
148149
},
150+
required: ['query']
149151
},
150152
handler: async (args, options) => {
151153
return {
@@ -182,6 +184,7 @@ export class PatchAgent extends AiAgent<Workspace.Workspace.Project> {
182184
}
183185
}
184186
},
187+
required: ['files']
185188
},
186189
handler: async (args, options) => {
187190
debugLog('updateFiles', args.files);

front_end/models/ai_assistance/agents/PerformanceAgent.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -782,6 +782,7 @@ export class PerformanceAgent extends AiAgent<AgentFocus> {
782782
nullable: false,
783783
}
784784
},
785+
required: ['insightSetId', 'insightName']
785786
},
786787
displayInfoFromArgs: params => {
787788
return {
@@ -829,6 +830,7 @@ export class PerformanceAgent extends AiAgent<AgentFocus> {
829830
nullable: false,
830831
}
831832
},
833+
required: ['eventKey']
832834
},
833835
displayInfoFromArgs: params => {
834836
return {title: lockedString('Looking at trace event…'), action: `getEventByKey('${params.eventKey}')`};
@@ -886,6 +888,7 @@ export class PerformanceAgent extends AiAgent<AgentFocus> {
886888
nullable: false,
887889
},
888890
},
891+
required: ['min', 'max']
889892
},
890893
displayInfoFromArgs: args => {
891894
return {
@@ -943,6 +946,7 @@ export class PerformanceAgent extends AiAgent<AgentFocus> {
943946
nullable: false,
944947
},
945948
},
949+
required: ['min', 'max']
946950
},
947951
displayInfoFromArgs: args => {
948952
return {
@@ -993,6 +997,7 @@ export class PerformanceAgent extends AiAgent<AgentFocus> {
993997
nullable: false,
994998
},
995999
},
1000+
required: ['eventKey']
9961001
},
9971002
displayInfoFromArgs: args => {
9981003
return {title: lockedString('Looking at call tree…'), action: `getDetailedCallTree('${args.eventKey}')`};
@@ -1046,7 +1051,9 @@ export class PerformanceAgent extends AiAgent<AgentFocus> {
10461051
description: 'The message the annotation should show to the user.',
10471052
nullable: false,
10481053
},
1054+
10491055
},
1056+
required: ['elementId', 'annotationMessage']
10501057
},
10511058
handler: async params => {
10521059
return await this.addElementAnnotation(params.elementId, params.annotationMessage);
@@ -1077,6 +1084,7 @@ export class PerformanceAgent extends AiAgent<AgentFocus> {
10771084
nullable: false,
10781085
},
10791086
},
1087+
required: ['eventKey', 'annotationMessage']
10801088
},
10811089
handler: async params => {
10821090
return await this.addNetworkRequestAnnotation(params.eventKey, params.annotationMessage);
@@ -1108,6 +1116,7 @@ export class PerformanceAgent extends AiAgent<AgentFocus> {
11081116
nullable: false,
11091117
},
11101118
},
1119+
required: ['scriptUrl', 'line', 'column']
11111120
},
11121121
displayInfoFromArgs: args => {
11131122
return {
@@ -1166,6 +1175,7 @@ export class PerformanceAgent extends AiAgent<AgentFocus> {
11661175
nullable: false,
11671176
},
11681177
},
1178+
required: ['url']
11691179
},
11701180
displayInfoFromArgs: args => {
11711181
return {title: lockedString('Looking at resource content…'), action: `getResourceContent('${args.url}')`};
@@ -1220,6 +1230,7 @@ export class PerformanceAgent extends AiAgent<AgentFocus> {
12201230
nullable: false,
12211231
}
12221232
},
1233+
required: ['eventKey']
12231234
},
12241235
displayInfoFromArgs: params => {
12251236
return {title: lockedString('Selecting event…'), action: `selectEventByKey('${params.eventKey}')`};
@@ -1281,6 +1292,7 @@ export class PerformanceAgent extends AiAgent<AgentFocus> {
12811292
nullable: true,
12821293
},
12831294
},
1295+
required: ['type']
12841296
},
12851297
handler: async params => {
12861298
switch (params.type) {

front_end/models/ai_assistance/agents/StylingAgent.snapshot.txt

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,12 @@ Content:
8686
"description": "A CSS style property name to retrieve. For example, 'background-color'."
8787
}
8888
}
89-
}
89+
},
90+
"required": [
91+
"explanation",
92+
"elements",
93+
"styleProperties"
94+
]
9095
}
9196
},
9297
{
@@ -109,7 +114,12 @@ Content:
109114
"type": 1,
110115
"description": "Provide a summary of what the code does. For example, \"Checking related element styles\"."
111116
}
112-
}
117+
},
118+
"required": [
119+
"code",
120+
"thought",
121+
"title"
122+
]
113123
}
114124
}
115125
],

front_end/models/ai_assistance/agents/StylingAgent.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,8 @@ export class StylingAgent extends AiAgent<SDK.DOMModel.DOMNode> {
313313
description: 'A CSS style property name to retrieve. For example, \'background-color\'.'
314314
}
315315
},
316-
}
316+
},
317+
required: ['explanation', 'elements', 'styleProperties']
317318
},
318319
displayInfoFromArgs: params => {
319320
return {
@@ -396,6 +397,7 @@ const data = {
396397
description: 'Provide a summary of what the code does. For example, "Checking related element styles".',
397398
},
398399
},
400+
required: ['code', 'thought', 'title']
399401
},
400402
displayInfoFromArgs: params => {
401403
return {
@@ -436,6 +438,7 @@ const data = {
436438
nullable: false,
437439
},
438440
},
441+
required: ['elementId', 'annotationMessage']
439442
},
440443
handler: async params => {
441444
return await this.addElementAnnotation(params.elementId, params.annotationMessage);

0 commit comments

Comments
 (0)