Skip to content

Commit aab4aa9

Browse files
authored
Partial fixes for sample list generator (#1464)
* Partial fixes for sample list generator A number of fixes for the sample list generator: - Removes a comment from one of our manifest files, as we don't currently support JSONC. - Ignores the `node_modules` folder since we have recently added some AI samples with a build step. - Adds the `aiOriginTrial` API to the list of recognised APIs. - Updates `extension-apis.json` with the latest data from the `chrome-types` package. Updating recognised extension APIs still requires access to a non-existent storage bucket, so this does not fully fix the process. * Fix linter issue
1 parent 8fe3174 commit aab4aa9

5 files changed

Lines changed: 141 additions & 30 deletions

File tree

.repo/sample-list-generator/extension-apis.json

Lines changed: 127 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,13 @@
4343
"setPopup",
4444
"setTitle"
4545
],
46-
"types": ["OpenPopupOptions", "TabDetails", "UserSettings"],
47-
"events": ["onClicked"]
46+
"types": [
47+
"OpenPopupOptions",
48+
"TabDetails",
49+
"UserSettings",
50+
"UserSettingsChange"
51+
],
52+
"events": ["onClicked", "onUserSettingsChanged"]
4853
},
4954
"alarms": {
5055
"properties": [],
@@ -55,14 +60,7 @@
5560
"app.runtime": {
5661
"properties": [],
5762
"methods": [],
58-
"types": [
59-
"ActionData",
60-
"EmbedRequest",
61-
"LaunchData",
62-
"LaunchItem",
63-
"ActionType",
64-
"LaunchSource"
65-
],
63+
"types": ["EmbedRequest", "LaunchData", "LaunchItem", "LaunchSource"],
6664
"events": ["onEmbedRequested", "onLaunched", "onRestarted"]
6765
},
6866
"app.window": {
@@ -261,7 +259,8 @@
261259
"types": [
262260
"BookmarkTreeNode",
263261
"CreateDetails",
264-
"BookmarkTreeNodeUnmodifiable"
262+
"BookmarkTreeNodeUnmodifiable",
263+
"FolderType"
265264
],
266265
"events": [
267266
"onChanged",
@@ -373,7 +372,7 @@
373372
"contentScripts": {
374373
"properties": [],
375374
"methods": [],
376-
"types": ["ContentScript", "RunAt"],
375+
"types": ["ContentScript"],
377376
"events": []
378377
},
379378
"contentSettings": {
@@ -420,17 +419,25 @@
420419
"contextMenus": {
421420
"properties": ["ACTION_MENU_TOP_LEVEL_LIMIT"],
422421
"methods": ["create", "remove", "removeAll", "update"],
423-
"types": ["OnClickData", "ContextType", "ItemType"],
422+
"types": ["CreateProperties", "OnClickData", "ContextType", "ItemType"],
424423
"events": ["onClicked"]
425424
},
426425
"cookies": {
427426
"properties": [],
428-
"methods": ["get", "getAll", "getAllCookieStores", "remove", "set"],
427+
"methods": [
428+
"get",
429+
"getAll",
430+
"getAllCookieStores",
431+
"getPartitionKey",
432+
"remove",
433+
"set"
434+
],
429435
"types": [
430436
"Cookie",
431437
"CookieDetails",
432438
"CookiePartitionKey",
433439
"CookieStore",
440+
"FrameDetails",
434441
"OnChangedCause",
435442
"SameSiteStatus"
436443
],
@@ -445,7 +452,13 @@
445452
"debugger": {
446453
"properties": [],
447454
"methods": ["attach", "detach", "getTargets", "sendCommand"],
448-
"types": ["Debuggee", "TargetInfo", "DetachReason", "TargetInfoType"],
455+
"types": [
456+
"Debuggee",
457+
"DebuggerSession",
458+
"TargetInfo",
459+
"DetachReason",
460+
"TargetInfoType"
461+
],
449462
"events": ["onDetach", "onEvent"]
450463
},
451464
"declarativeContent": {
@@ -495,6 +508,7 @@
495508
"ExtensionActionOptions",
496509
"GetDisabledRuleIdsOptions",
497510
"GetRulesFilter",
511+
"HeaderInfo",
498512
"IsRegexSupportedResult",
499513
"MatchedRule",
500514
"MatchedRuleInfo",
@@ -591,6 +605,12 @@
591605
],
592606
"events": []
593607
},
608+
"devtools.performance": {
609+
"properties": [],
610+
"methods": [],
611+
"types": [],
612+
"events": ["onProfilingStarted", "onProfilingStopped"]
613+
},
594614
"devtools.recorder": {
595615
"properties": [],
596616
"methods": ["createView", "registerRecorderExtensionPlugin"],
@@ -611,8 +631,43 @@
611631
},
612632
"documentScan": {
613633
"properties": [],
614-
"methods": ["scan"],
615-
"types": ["ScanOptions", "ScanResults"],
634+
"methods": [
635+
"cancelScan",
636+
"closeScanner",
637+
"getOptionGroups",
638+
"getScannerList",
639+
"openScanner",
640+
"readScanData",
641+
"scan",
642+
"setOptions",
643+
"startScan"
644+
],
645+
"types": [
646+
"CancelScanResponse",
647+
"CloseScannerResponse",
648+
"DeviceFilter",
649+
"GetOptionGroupsResponse",
650+
"GetScannerListResponse",
651+
"OpenScannerResponse",
652+
"OptionConstraint",
653+
"OptionGroup",
654+
"OptionSetting",
655+
"ReadScanDataResponse",
656+
"ScanOptions",
657+
"ScanResults",
658+
"ScannerInfo",
659+
"ScannerOption",
660+
"SetOptionResult",
661+
"SetOptionsResponse",
662+
"StartScanOptions",
663+
"StartScanResponse",
664+
"Configurability",
665+
"ConnectionType",
666+
"ConstraintType",
667+
"OperationResult",
668+
"OptionType",
669+
"OptionUnit"
670+
],
616671
"events": []
617672
},
618673
"dom": {
@@ -677,6 +732,12 @@
677732
"types": ["HardwarePlatformInfo"],
678733
"events": []
679734
},
735+
"enterprise.kioskInput": {
736+
"properties": [],
737+
"methods": ["setCurrentInputMethod"],
738+
"types": ["SetCurrentInputMethodOptions"],
739+
"events": []
740+
},
680741
"enterprise.networkingAttributes": {
681742
"properties": [],
682743
"methods": ["getNetworkDetails"],
@@ -733,6 +794,7 @@
733794
"InjectDetails",
734795
"CSSOrigin",
735796
"DocumentLifecycle",
797+
"ExecutionWorld",
736798
"FrameType",
737799
"ImageFormat",
738800
"RunAt"
@@ -799,6 +861,7 @@
799861
"AddWatcherRequestedOptions",
800862
"Change",
801863
"CloseFileRequestedOptions",
864+
"CloudFileInfo",
802865
"CloudIdentifier",
803866
"ConfigureRequestedOptions",
804867
"CopyEntryRequestedOptions",
@@ -1245,7 +1308,14 @@
12451308
},
12461309
"permissions": {
12471310
"properties": [],
1248-
"methods": ["contains", "getAll", "remove", "request"],
1311+
"methods": [
1312+
"addHostAccessRequest",
1313+
"contains",
1314+
"getAll",
1315+
"remove",
1316+
"removeHostAccessRequest",
1317+
"request"
1318+
],
12491319
"types": ["Permissions"],
12501320
"events": ["onAdded", "onRemoved"]
12511321
},
@@ -1290,7 +1360,13 @@
12901360
"MAX_GET_PRINTER_INFO_CALLS_PER_MINUTE",
12911361
"MAX_SUBMIT_JOB_CALLS_PER_MINUTE"
12921362
],
1293-
"methods": ["cancelJob", "getPrinterInfo", "getPrinters", "submitJob"],
1363+
"methods": [
1364+
"cancelJob",
1365+
"getJobStatus",
1366+
"getPrinterInfo",
1367+
"getPrinters",
1368+
"submitJob"
1369+
],
12941370
"types": [
12951371
"GetPrinterInfoResponse",
12961372
"Printer",
@@ -1408,7 +1484,9 @@
14081484
"onStartup",
14091485
"onSuspend",
14101486
"onSuspendCanceled",
1411-
"onUpdateAvailable"
1487+
"onUpdateAvailable",
1488+
"onUserScriptConnect",
1489+
"onUserScriptMessage"
14121490
]
14131491
},
14141492
"scripting": {
@@ -1719,6 +1797,12 @@
17191797
],
17201798
"events": ["onAttached", "onDetached"]
17211799
},
1800+
"systemLog": {
1801+
"properties": [],
1802+
"methods": ["add"],
1803+
"types": ["MessageOptions"],
1804+
"events": []
1805+
},
17221806
"tabCapture": {
17231807
"properties": [],
17241808
"methods": ["capture", "getCapturedTabs", "getMediaStreamId"],
@@ -1738,7 +1822,11 @@
17381822
"events": ["onCreated", "onMoved", "onRemoved", "onUpdated"]
17391823
},
17401824
"tabs": {
1741-
"properties": ["MAX_CAPTURE_VISIBLE_TAB_CALLS_PER_SECOND", "TAB_ID_NONE"],
1825+
"properties": [
1826+
"MAX_CAPTURE_VISIBLE_TAB_CALLS_PER_SECOND",
1827+
"TAB_ID_NONE",
1828+
"TAB_INDEX_NONE"
1829+
],
17421830
"methods": [
17431831
"captureVisibleTab",
17441832
"connect",
@@ -1806,23 +1894,31 @@
18061894
"properties": [],
18071895
"methods": ["getVoices", "isSpeaking", "pause", "resume", "speak", "stop"],
18081896
"types": ["TtsEvent", "TtsOptions", "TtsVoice", "EventType", "VoiceGender"],
1809-
"events": []
1897+
"events": ["onVoicesChanged"]
18101898
},
18111899
"ttsEngine": {
18121900
"properties": [],
1813-
"methods": ["updateVoices"],
1901+
"methods": ["updateLanguage", "updateVoices"],
18141902
"types": [
18151903
"AudioBuffer",
18161904
"AudioStreamOptions",
1905+
"LanguageStatus",
1906+
"LanguageUninstallOptions",
18171907
"SpeakOptions",
1908+
"TtsClient",
1909+
"LanguageInstallStatus",
1910+
"TtsClientSource",
18181911
"VoiceGender"
18191912
],
18201913
"events": [
1914+
"onInstallLanguageRequest",
1915+
"onLanguageStatusRequest",
18211916
"onPause",
18221917
"onResume",
18231918
"onSpeak",
18241919
"onSpeakWithAudioStream",
1825-
"onStop"
1920+
"onStop",
1921+
"onUninstallLanguageRequest"
18261922
]
18271923
},
18281924
"types": {
@@ -1880,15 +1976,21 @@
18801976
"properties": [],
18811977
"methods": [
18821978
"configureWorld",
1979+
"execute",
18831980
"getScripts",
1981+
"getWorldConfigurations",
18841982
"register",
1983+
"resetWorldConfiguration",
18851984
"unregister",
18861985
"update"
18871986
],
18881987
"types": [
1988+
"InjectionResult",
1989+
"InjectionTarget",
18891990
"RegisteredUserScript",
18901991
"ScriptSource",
18911992
"UserScriptFilter",
1993+
"UserScriptInjection",
18921994
"WorldProperties",
18931995
"ExecutionWorld"
18941996
],
@@ -2056,6 +2158,7 @@
20562158
"FindOptions",
20572159
"FullscreenPermissionRequest",
20582160
"GeolocationPermissionRequest",
2161+
"HidPermissionRequest",
20592162
"InjectDetails",
20602163
"InjectionItems",
20612164
"LoadPluginPermissionRequest",

.repo/sample-list-generator/src/libs/api-loader.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,16 @@ export const loadExtensionApis = (): ExtensionApiMap => {
1515
}
1616

1717
let data = fs.readFileSync(filePath, 'utf8');
18-
return JSON.parse(data);
18+
const apiMap = JSON.parse(data);
19+
20+
// Due to the specific implementation of this API, we need to manually add it
21+
// to the list of APIs recognised by the sample list generator.
22+
apiMap['aiOriginTrial.languageModel'] = {
23+
properties: [],
24+
methods: ['create', 'capabilities', 'params', 'availability'],
25+
types: [],
26+
events: []
27+
};
28+
29+
return apiMap;
1930
};

.repo/sample-list-generator/src/utils/filesystem.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ export const getAllFiles = async (dir: string): Promise<string[]> => {
1212
if (stats.isFile()) {
1313
result.push(filePath);
1414
} else if (stats.isDirectory()) {
15+
if (file === "node_modules") continue;
1516
result.push(...(await getAllFiles(filePath)));
1617
}
1718
}

api-samples/identity/manifest.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
},
1010
"permissions": ["identity", "identity.email"],
1111
"oauth2": {
12-
// client_id below is specific to the application key. Follow the
13-
// documentation to obtain one for your app.
1412
"client_id": "497291774654.apps.googleusercontent.com",
1513
"scopes": ["https://www.googleapis.com/auth/userinfo.profile"]
1614
}

functional-samples/ai.gemini-on-device/sidepanel/index.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,7 @@ async function initDefaults() {
4646
console.log('Model default:', defaults);
4747
const available = await chrome.aiOriginTrial.languageModel.availability();
4848
if (available !== 'available') {
49-
showResponse(
50-
`Model not yet available (current state: "${available}")`
51-
);
49+
showResponse(`Model not yet available (current state: "${available}")`);
5250
return;
5351
}
5452
sliderTemperature.value = defaults.defaultTemperature;

0 commit comments

Comments
 (0)