Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
TypeScript automationchromechromiume2e-testingelectronend-to-end-testingfirefoxjavascriptplaywrighttesttest-automationtestingtesting-toolswebwebkit
chore: copy perform snapshtos on write (#38620)
Pavel Feldman8777b0e050b8
diff --git a/docs/src/api/params.md b/docs/src/api/params.mdindex 807670d29a..a4f6a5f535 100644--- a/docs/src/api/params.md+++ b/docs/src/api/params.md@@ -372,10 +372,10 @@ Emulates consistent window screen size available inside web page via `window.scr## context-option-agent- `agent` <[Object]>- - `provider` <[string]> LLM provider to use.- - `model` <[string]> Model identifier within provider.+ - `provider` ?<[string]> LLM provider to use. Required in non-cache mode.+ - `model` ?<[string]> Model identifier within the provider. Required in non-cache mode.- `cacheFile` ?<[string]> Cache file to use/generate code for performed actions into. Cache is not used if not specified (default).- - `cacheMode` ?<[CacheMode]<"force"|"ignore"|"update"|"auto">> Cache control, defaults to 'auto'.+ - `cacheOutFile` ?<[string]> When specified, generated entries are written into the `cacheOutFile` instead of updating the `cacheFile`.- `secrets` ?<[Object]<[string], [string]>> Secrets to hide from the LLM.- `maxTurns` ?<[int]> Maximum number of agentic turns to take per call. Defaults to 10.- `maxTokens` ?<[int]> Maximum number of tokens to consume per call. The agentic loop will stop after input + output tokens exceed this value. Defaults on unlimited.diff --git a/docs/src/test-api/class-testoptions.md b/docs/src/test-api/class-testoptions.mdindex 3e00f43929..8488da9845 100644--- a/docs/src/test-api/class-testoptions.md+++ b/docs/src/test-api/class-testoptions.md@@ -49,11 +49,11 @@ export default defineConfig({## property: TestOptions.agent* since: v1.58- type: <[Object]>+ - `provider` ?<[string]> LLM provider to use. Required in non-cache mode.+ - `model` ?<[string]> Model identifier within the provider. Required in non-cache mode.- `cachePathTemplate` ?<[string]> Cache file template to use/generate code for performed actions into.- `maxTurns` ?<[int]> Maximum number of agentic turns to take per call. Defaults to 10.- `maxTokens` ?<[int]> Maximum number of tokens to consume per call. The agentic loop will stop after input + output tokens exceed this value. Defaults on unlimited.- - `model` <[string]> Model identifier within provider.- - `provider` <[string]> LLM provider to use.- `secrets` ?<[Object]<[string], [string]>> Secrets to hide from the LLM.## property: TestOptions.baseURL = %%-context-option-baseURL-%%diff --git a/packages/playwright-client/types/types.d.ts b/packages/playwright-client/types/types.d.tsindex 471274b115..002616f81a 100644--- a/packages/playwright-client/types/types.d.ts+++ b/packages/playwright-client/types/types.d.ts@@ -22232,14 +22232,14 @@ export interface BrowserContextOptions {*/agent?: {/**- * LLM provider to use.+ * LLM provider to use. Required in non-cache mode.*/- provider: string;+ provider?: string;/**- * Model identifier within provider.+ * Model identifier within the provider. Required in non-cache mode.*/- model: string;+ model?: string;/*** Cache file to use/generate code for performed actions into. Cache is not used if not specified (default).@@ -22247,9 +22247,9 @@ export interface BrowserContextOptions {cacheFile?: string;/**- * Cache control, defaults to 'auto'.+ * When specified, generated entries are written into the `cacheOutFile` instead of updating the `cacheFile`.*/- cacheMode?: "force"|"ignore"|"update"|"auto";+ cacheOutFile?: string;/*** Secrets to hide from the LLM.diff --git a/packages/playwright-core/src/protocol/validator.ts b/packages/playwright-core/src/protocol/validator.tsindex f54c9a2563..f2fd5f3851 100644--- a/packages/playwright-core/src/protocol/validator.ts+++ b/packages/playwright-core/src/protocol/validator.ts@@ -603,10 +603,10 @@ scheme.BrowserTypeLaunchPersistentContextParams = tObject({selectorEngines: tOptional(tArray(tType('SelectorEngine'))),testIdAttributeName: tOptional(tString),agent: tOptional(tObject({- provider: tString,- model: tString,+ provider: tOptional(tString),+ model: tOptional(tString),cacheFile: tOptional(tString),- cacheMode: tOptional(tEnum(['ignore', 'force', 'update', 'auto'])),+ cacheOutFile: tOptional(tString),secrets: tOptional(tArray(tType('NameValue'))),maxTurns: tOptional(tInt),maxTokens: tOptional(tInt),@@ -705,10 +705,10 @@ scheme.BrowserNewContextParams = tObject({selectorEngines: tOptional(tArray(tType('SelectorEngine'))),testIdAttributeName: tOptional(tString),agent: tOptional(tObject({- provider: tString,- model: tString,+ provider: tOptional(tString),+ model: tOptional(tString),cacheFile: tOptional(tString),- cacheMode: tOptional(tEnum(['ignore', 'force', 'update', 'auto'])),+ cacheOutFile: tOptional(tString),secrets: tOptional(tArray(tType('NameValue'))),maxTurns: tOptional(tInt),maxTokens: tOptional(tInt),@@ -785,10 +785,10 @@ scheme.BrowserNewContextForReuseParams = tObject({selectorEngines: tOptional(tArray(tType('SelectorEngine'))),testIdAttributeName: tOptional(tString),agent: tOptional(tObject({- provider: tString,- model: tString,+ provider: tOptional(tString),+ model: tOptional(tString),cacheFile: tOptional(tString),- cacheMode: tOptional(tEnum(['ignore', 'force', 'update', 'auto'])),+ cacheOutFile: tOptional(tString),secrets: tOptional(tArray(tType('NameValue'))),maxTurns: tOptional(tInt),maxTokens: tOptional(tInt),@@ -910,10 +910,10 @@ scheme.BrowserContextInitializer = tObject({selectorEngines: tOptional(tArray(tType('SelectorEngine'))),testIdAttributeName: tOptional(tString),agent: tOptional(tObject({- provider: tString,- model: tString,+ provider: tOptional(tString),+ model: tOptional(tString),cacheFile: tOptional(tString),- cacheMode: tOptional(tEnum(['ignore', 'force', 'update', 'auto'])),+ cacheOutFile: tOptional(tString),secrets: tOptional(tArray(tType('NameValue'))),maxTurns: tOptional(tInt),maxTokens: tOptional(tInt),@@ -2838,10 +2838,10 @@ scheme.AndroidDeviceLaunchBrowserParams = tObject({selectorEngines: tOptional(tArray(tType('SelectorEngine'))),testIdAttributeName: tOptional(tString),agent: tOptional(tObject({- provider: tString,- model: tString,+ provider: tOptional(tString),+ model: tOptional(tString),cacheFile: tOptional(tString),- cacheMode: tOptional(tEnum(['ignore', 'force', 'update', 'auto'])),+ cacheOutFile: tOptional(tString),secrets: tOptional(tArray(tType('NameValue'))),maxTurns: tOptional(tInt),maxTokens: tOptional(tInt),diff --git a/packages/playwright-core/src/server/agent/agent.ts b/packages/playwright-core/src/server/agent/agent.tsindex d2d92f3088..4147ef1602 100644--- a/packages/playwright-core/src/server/agent/agent.ts+++ b/packages/playwright-core/src/server/agent/agent.ts@@ -66,8 +66,8 @@ async function perform(progress: Progress, context: Context, userTask: string, r}> {const { page } = context;const browserContext = page.browserContext;- if (!browserContext._options.agent)- throw new Error(`page.perform() and page.extract() require the agent to be set on the browser context`);+ if (!browserContext._options.agent?.provider || !browserContext._options.agent?.model)+ throw new Error(`This action requires the agent provider and model to be set on the browser context`);const { full } = await page.snapshotForAI(progress);const { tools, callTool } = toolsForLoop(context);@@ -137,20 +137,15 @@ type CachedActions = Record<string, {actions: actions.Action[],}>;-const allCaches = new Map<string, CachedActions>();-async function cachedPerform(progress: Progress, context: Context, options: channels.PagePerformParams): Promise<boolean> {- if (!context.options?.cacheFile || context.options.cacheMode === 'ignore' || context.options.cacheMode === 'update')+ if (!context.options?.cacheFile)return false;- const cache = await cachedActions(context.options.cacheFile);+ const cache = await cachedActions(context, context.options?.cacheFile);const cacheKey = (options.key ?? options.task).trim();- const entry = cache[cacheKey];- if (!entry) {- if (context.options.cacheMode === 'force')- throw new Error(`No cached actions for key "${cacheKey}", but cache mode is set to "force"`);+ const entry = cache.actions[cacheKey];+ if (!entry)return false;- }for (const action of entry.actions)await runAction(progress, 'run', context.page, action, context.options.secrets ?? []);@@ -159,24 +154,41 @@ async function cachedPerform(progress: Progress, context: Context, options: chanasync function updateCache(context: Context, options: channels.PagePerformParams) {const cacheFile = context.options?.cacheFile;- if (!cacheFile)- return;- const cache = await cachedActions(cacheFile);+ const cacheOutFile = context.options?.cacheOutFile;++ const cache = cacheFile ? await cachedActions(context, cacheFile) : { actions: {}, newActions: {} };const cacheKey = (options.key ?? options.task).trim();- cache[cacheKey] = {+ const newEntry = {timestamp: Date.now(),actions: context.actions,};- const entries = Object.entries(cache);- entries.sort((e1, e2) => e1[0].localeCompare(e2[0]));- await fs.promises.writeFile(cacheFile, JSON.stringify(Object.fromEntries(entries), undefined, 2));+ cache.actions[cacheKey] = newEntry;+ cache.newActions[cacheKey] = newEntry;++ if (cacheOutFile) {+ const entries = Object.entries(cache.newActions);+ entries.sort((e1, e2) => e1[0].localeCompare(e2[0]));+ await fs.promises.writeFile(cacheOutFile, JSON.stringify(Object.fromEntries(entries), undefined, 2));+ } else if (cacheFile) {+ const entries = Object.entries(cache.actions);+ entries.sort((e1, e2) => e1[0].localeCompare(e2[0]));+ await fs.promises.writeFile(cacheFile, JSON.stringify(Object.fromEntries(entries), undefined, 2));+ }}-async function cachedActions(cacheFile: string): Promise<CachedActions> {- let cache = allCaches.get(cacheFile);+type Cache = {+ actions: CachedActions;+ newActions: CachedActions;+};++async function cachedActions(context: Context, cacheFile: string): Promise<Cache> {+ let cache = (context as any)[agentCacheSymbol] as Cache | undefined;if (!cache) {- cache = await fs.promises.readFile(cacheFile, 'utf-8').then(text => JSON.parse(text)).catch(() => ({})) as CachedActions;- allCaches.set(cacheFile, cache);+ const actions = await fs.promises.readFile(cacheFile, 'utf-8').then(text => JSON.parse(text)).catch(() => ({})) as CachedActions;+ cache = { actions, newActions: {} };+ (context as any)[agentCacheSymbol] = cache;}return cache;}++const agentCacheSymbol = Symbol('agentCache');diff --git a/packages/playwright-core/types/types.d.ts b/packages/playwright-core/types/types.d.tsindex 471274b115..002616f81a 100644--- a/packages/playwright-core/types/types.d.ts+++ b/packages/playwright-core/types/types.d.ts@@ -22232,14 +22232,14 @@ export interface BrowserContextOptions {*/agent?: {/**- * LLM provider to use.+ * LLM provider to use. Required in non-cache mode.*/- provider: string;+ provider?: string;/**- * Model identifier within provider.+ * Model identifier within the provider. Required in non-cache mode.*/- model: string;+ model?: string;/*** Cache file to use/generate code for performed actions into. Cache is not used if not specified (default).@@ -22247,9 +22247,9 @@ export interface BrowserContextOptions {cacheFile?: string;/**- * Cache control, defaults to 'auto'.+ * When specified, generated entries are written into the `cacheOutFile` instead of updating the `cacheFile`.*/- cacheMode?: "force"|"ignore"|"update"|"auto";+ cacheOutFile?: string;/*** Secrets to hide from the LLM.diff --git a/packages/playwright/src/common/ipc.ts b/packages/playwright/src/common/ipc.tsindex 65ec1be783..ffe6a5e438 100644--- a/packages/playwright/src/common/ipc.ts+++ b/packages/playwright/src/common/ipc.ts@@ -102,7 +102,8 @@ export type CloneStoragePayload = {};export type UpstreamStoragePayload = {- workerFile: string;+ storageFile: string;+ storageOutFile: string;};export type CustomMessageRequestPayload = {diff --git a/packages/playwright/src/index.ts b/packages/playwright/src/index.tsindex 0bd6d0cb5f..d07e1662d5 100644--- a/packages/playwright/src/index.ts+++ b/packages/playwright/src/index.ts@@ -645,6 +645,8 @@ class ArtifactsRecorder {private _screenshotRecorder: SnapshotRecorder;private _pageSnapshot: string | undefined;private _agent: PlaywrightTestOptions['agent'];+ private _agentCacheFile: string | undefined;+ private _agentCacheOutFile: string | undefined;constructor(playwright: PlaywrightImpl, artifactsDir: string, screenshot: ScreenshotOption, agent: PlaywrightTestOptions['agent']) {this._playwright = playwright;@@ -711,19 +713,23 @@ class ArtifactsRecorder {return;const cachePathTemplate = this._agent.cachePathTemplate ?? '{testDir}/{testFilePath}-cache.json';- const cacheFile = this._testInfo._applyPathTemplate(cachePathTemplate, '', '.json');- const workerFile = await this._testInfo._cloneStorage(cacheFile);+ this._agentCacheFile = this._testInfo._applyPathTemplate(cachePathTemplate, '', '.json');+ this._agentCacheOutFile = path.join(this._testInfo.artifactsDir(), 'agent-cache-' + createGuid() + '.json');++ const cacheFile = this._testInfo.config.runAgents ? undefined : await this._testInfo._cloneStorage(this._agentCacheFile);options.agent = {...this._agent,- cacheFile: workerFile,- cacheMode: this._testInfo.config.runAgents ? 'update' : 'force',+ cacheFile,+ cacheOutFile: this._agentCacheOutFile,};}private async _upstreamAgentCache(context: BrowserContextImpl) {- const agent = context._options.agent;- if (this._testInfo.status === 'passed' && agent?.cacheFile)- await this._testInfo._upstreamStorage(agent.cacheFile);+ if (!this._agentCacheFile || !this._agentCacheOutFile)+ return;+ if (this._testInfo.status !== 'passed')+ return;+ await this._testInfo._upstreamStorage(this._agentCacheFile, this._agentCacheOutFile);}async didCreateRequestContext(context: APIRequestContextImpl) {diff --git a/packages/playwright/src/runner/dispatcher.ts b/packages/playwright/src/runner/dispatcher.tsindex 6b223f0643..d12091d629 100644--- a/packages/playwright/src/runner/dispatcher.ts+++ b/packages/playwright/src/runner/dispatcher.ts@@ -263,10 +263,10 @@ export class Dispatcher {this._producedEnvByProjectId.set(testGroup.projectId, { ...producedEnv, ...worker.producedEnv() });});worker.onRequest('cloneStorage', async (params: ipc.CloneStoragePayload) => {- return await Storage.clone(params.storageFile, worker.artifactsDir());+ return await Storage.clone(params.storageFile, outputDir);});worker.onRequest('upstreamStorage', async (params: ipc.UpstreamStoragePayload) => {- await Storage.upstream(params.workerFile);+ await Storage.upstream(params.storageFile, params.storageOutFile);});return worker;}diff --git a/packages/playwright/src/runner/storage.ts b/packages/playwright/src/runner/storage.tsindex 90aace6faf..59987f2f52 100644--- a/packages/playwright/src/runner/storage.ts+++ b/packages/playwright/src/runner/storage.ts@@ -23,61 +23,53 @@ type StorageEnties = Record<string, { timestamp: number, value: any }>;export class Storage {private static _storages = new Map<string, Storage>();- private static _workerFiles = new Map<string, {- storageFile: string;- lastModified: number;- }>();+ private static _serializeQueue: Promise<any> = Promise.resolve();private _fileName: string;+ private _lastSnapshotFileName: string | undefined;private _entriesPromise: Promise<StorageEnties> | undefined;- private _writeChain: Promise<void> = Promise.resolve();- static async clone(storageFile: string, artifactsDir: string): Promise<string> {- const workerFile = await this._storage(storageFile)._clone(artifactsDir);- const stat = await fs.promises.stat(workerFile);- const lastModified = stat.mtime.getTime();- Storage._workerFiles.set(workerFile, { storageFile, lastModified });- return workerFile;+ static clone(storageFile: string, outputDir: string): Promise<string> {+ return Storage._withStorage(storageFile, storage => storage._clone(outputDir));}- static async upstream(workerFile: string) {- const entry = Storage._workerFiles.get(workerFile);- if (!entry)- return;- const { storageFile, lastModified } = entry;- const stat = await fs.promises.stat(workerFile);- const newLastModified = stat.mtime.getTime();- if (lastModified !== newLastModified)- await this._storage(storageFile)._upstream(workerFile);- Storage._workerFiles.delete(workerFile);+ static upstream(storageFile: string, storageOutFile: string) {+ return Storage._withStorage(storageFile, storage => storage._upstream(storageOutFile));}- private static _storage(fileName: string) {- if (!Storage._storages.has(fileName))- Storage._storages.set(fileName, new Storage(fileName));- return Storage._storages.get(fileName)!;+ private static _withStorage<T>(fileName: string, runnable: (storage: Storage) => Promise<T>) {+ this._serializeQueue = this._serializeQueue.then(() => {+ let storage = Storage._storages.get(fileName);+ if (!storage) {+ storage = new Storage(fileName);+ Storage._storages.set(fileName, storage);+ }+ return runnable(storage);+ });+ return this._serializeQueue;}private constructor(fileName: string) {this._fileName = fileName;}- async _clone(artifactsDir: string): Promise<string> {+ async _clone(outputDir: string): Promise<string> {const entries = await this._load();- const workerFile = path.join(artifactsDir, `pw-storage-${createGuid()}.json`);- await fs.promises.writeFile(workerFile, JSON.stringify(entries, null, 2)).catch(() => {});- return workerFile;+ if (this._lastSnapshotFileName)+ return this._lastSnapshotFileName;+ const snapshotFile = path.join(outputDir, `pw-storage-${createGuid()}.json`);+ await fs.promises.writeFile(snapshotFile, JSON.stringify(entries, null, 2)).catch(() => {});+ this._lastSnapshotFileName = snapshotFile;+ return snapshotFile;}- async _upstream(workerFile: string) {+ async _upstream(storageOutFile: string) {const entries = await this._load();- const newEntries = await fs.promises.readFile(workerFile, 'utf8').then(JSON.parse).catch(() => ({})) as StorageEnties;- for (const [key, newValue] of Object.entries(newEntries)) {- const existing = entries[key];- if (!existing || existing.timestamp < newValue.timestamp)- entries[key] = newValue;- }- await this._writeFile(entries);+ const newEntries = await fs.promises.readFile(storageOutFile, 'utf8').then(JSON.parse).catch(() => ({})) as StorageEnties;+ for (const [key, newValue] of Object.entries(newEntries))+ entries[key] = newValue;+ this._lastSnapshotFileName = undefined;+ await fs.promises.writeFile(this._fileName, JSON.stringify(entries, null, 2));}private async _load(): Promise<StorageEnties> {@@ -85,13 +77,4 @@ export class Storage {this._entriesPromise = fs.promises.readFile(this._fileName, 'utf8').then(JSON.parse).catch(() => ({}));return this._entriesPromise;}-- private _writeFile(entries: Record<string, any>) {- this._writeChain = this._writeChain.then(() => fs.promises.writeFile(this._fileName, JSON.stringify(entries, null, 2)));- return this._writeChain;- }-- async flush() {- await this._writeChain;- }}diff --git a/packages/playwright/src/worker/testInfo.ts b/packages/playwright/src/worker/testInfo.tsindex 09f6d8f13c..1b37fd89d5 100644--- a/packages/playwright/src/worker/testInfo.ts+++ b/packages/playwright/src/worker/testInfo.ts@@ -668,13 +668,16 @@ export class TestInfoImpl implements TestInfo {this._timeoutManager.setTimeout(timeout);}- async _cloneStorage(cacheFileTemplate: string): Promise<string> {- const storageFile = this._applyPathTemplate(cacheFileTemplate, 'cache', '.json');+ async _cloneStorage(storageFile: string): Promise<string> {return await this._callbacks.onCloneStorage!({ storageFile });}- async _upstreamStorage(workerFile: string) {- await this._callbacks.onUpstreamStorage?.({ workerFile });+ async _upstreamStorage(storageFile: string, storageOutFile: string) {+ await this._callbacks.onUpstreamStorage!({ storageFile, storageOutFile });+ }++ artifactsDir(): string {+ return this._workerParams.artifactsDir;}}diff --git a/packages/protocol/src/channels.d.ts b/packages/protocol/src/channels.d.tsindex c17f6022c8..5f0a341247 100644--- a/packages/protocol/src/channels.d.ts+++ b/packages/protocol/src/channels.d.ts@@ -1009,10 +1009,10 @@ export type BrowserTypeLaunchPersistentContextParams = {selectorEngines?: SelectorEngine[],testIdAttributeName?: string,agent?: {- provider: string,- model: string,+ provider?: string,+ model?: string,cacheFile?: string,- cacheMode?: 'ignore' | 'force' | 'update' | 'auto',+ cacheOutFile?: string,secrets?: NameValue[],maxTurns?: number,maxTokens?: number,@@ -1100,10 +1100,10 @@ export type BrowserTypeLaunchPersistentContextOptions = {selectorEngines?: SelectorEngine[],testIdAttributeName?: string,agent?: {- provider: string,- model: string,+ provider?: string,+ model?: string,cacheFile?: string,- cacheMode?: 'ignore' | 'force' | 'update' | 'auto',+ cacheOutFile?: string,secrets?: NameValue[],maxTurns?: number,maxTokens?: number,@@ -1232,10 +1232,10 @@ export type BrowserNewContextParams = {selectorEngines?: SelectorEngine[],testIdAttributeName?: string,agent?: {- provider: string,- model: string,+ provider?: string,+ model?: string,cacheFile?: string,- cacheMode?: 'ignore' | 'force' | 'update' | 'auto',+ cacheOutFile?: string,secrets?: NameValue[],maxTurns?: number,maxTokens?: number,@@ -1309,10 +1309,10 @@ export type BrowserNewContextOptions = {selectorEngines?: SelectorEngine[],testIdAttributeName?: string,agent?: {- provider: string,- model: string,+ provider?: string,+ model?: string,cacheFile?: string,- cacheMode?: 'ignore' | 'force' | 'update' | 'auto',+ cacheOutFile?: string,secrets?: NameValue[],maxTurns?: number,maxTokens?: number,@@ -1389,10 +1389,10 @@ export type BrowserNewContextForReuseParams = {selectorEngines?: SelectorEngine[],testIdAttributeName?: string,agent?: {- provider: string,- model: string,+ provider?: string,+ model?: string,cacheFile?: string,- cacheMode?: 'ignore' | 'force' | 'update' | 'auto',+ cacheOutFile?: string,secrets?: NameValue[],maxTurns?: number,maxTokens?: number,@@ -1466,10 +1466,10 @@ export type BrowserNewContextForReuseOptions = {selectorEngines?: SelectorEngine[],testIdAttributeName?: string,agent?: {- provider: string,- model: string,+ provider?: string,+ model?: string,cacheFile?: string,- cacheMode?: 'ignore' | 'force' | 'update' | 'auto',+ cacheOutFile?: string,secrets?: NameValue[],maxTurns?: number,maxTokens?: number,@@ -1610,10 +1610,10 @@ export type BrowserContextInitializer = {selectorEngines?: SelectorEngine[],testIdAttributeName?: string,agent?: {- provider: string,- model: string,+ provider?: string,+ model?: string,cacheFile?: string,- cacheMode?: 'ignore' | 'force' | 'update' | 'auto',+ cacheOutFile?: string,secrets?: NameValue[],maxTurns?: number,maxTokens?: number,@@ -4944,10 +4944,10 @@ export type AndroidDeviceLaunchBrowserParams = {selectorEngines?: SelectorEngine[],testIdAttributeName?: string,agent?: {- provider: string,- model: string,+ provider?: string,+ model?: string,cacheFile?: string,- cacheMode?: 'ignore' | 'force' | 'update' | 'auto',+ cacheOutFile?: string,secrets?: NameValue[],maxTurns?: number,maxTokens?: number,@@ -5019,10 +5019,10 @@ export type AndroidDeviceLaunchBrowserOptions = {selectorEngines?: SelectorEngine[],testIdAttributeName?: string,agent?: {- provider: string,- model: string,+ provider?: string,+ model?: string,cacheFile?: string,- cacheMode?: 'ignore' | 'force' | 'update' | 'auto',+ cacheOutFile?: string,secrets?: NameValue[],maxTurns?: number,maxTokens?: number,diff --git a/packages/protocol/src/protocol.yml b/packages/protocol/src/protocol.ymlindex c6bd21db33..7e9d78a1e4 100644--- a/packages/protocol/src/protocol.yml+++ b/packages/protocol/src/protocol.yml@@ -592,16 +592,10 @@ ContextOptions:agent:type: object?properties:- provider: string- model: string+ provider: string?+ model: string?cacheFile: string?- cacheMode:- type: enum?- literals:- - ignore- - force- - update- - auto+ cacheOutFile: string?secrets:type: array?items: NameValue