@skrillex1224/playwright-toolkit 2.1.210 → 2.1.212

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -221,9 +221,9 @@ const image2 = await Share.captureScreen(page, { restore: 'width-only' });
221
221
  // 显式配置 watermarkify:全页淡水印 + 底部一行细条
222
222
  const image3 = await Share.captureScreen(page, {
223
223
  watermarkify: {
224
- prompt: '你好',
224
+ query: '你好',
225
225
  timezoneOffsetHours: 8,
226
- // 默认会在同一浏览器上下文里访问 http://myip.ipip.net 补充 IP / Loc,超时默认 10000ms
226
+ // 默认会在同一浏览器上下文里访问 https://myip.ipip.net/json 补充 IP / Loc,超时默认 10000ms
227
227
  },
228
228
  });
229
229
 
@@ -242,8 +242,8 @@ const image4 = await Share.captureScreen(page, {
242
242
  },
243
243
  });
244
244
 
245
- // Prompt 字段默认取值链路:prompt -> query -> 页面 title
246
- // 所以如果你只传 query,底部 Prompt 展示的就是实际问 AI 的 query
245
+ // Prompt 字段默认取值链路:query -> prompt -> 页面 title
246
+ // 所以 runtime input 只传 query 就够了,底部 Prompt 展示的就是实际问 AI 的 query
247
247
 
248
248
  // 如需原始截图,可显式关闭 watermarkify
249
249
  const image5 = await Share.captureScreen(page, {
package/dist/browser.js CHANGED
@@ -2874,6 +2874,9 @@ var ByPass = {
2874
2874
  resolveRouteByProxy
2875
2875
  };
2876
2876
 
2877
+ // src/internals/constants.js
2878
+ var PageRuntimeStateKey = "__playwright_toolkit_runtime_state__";
2879
+
2877
2880
  // src/runtime-env.js
2878
2881
  var BROWSER_PROFILE_SCHEMA_VERSION = 1;
2879
2882
  var rememberedRuntimeState = null;
@@ -3383,6 +3386,7 @@ var RuntimeEnv = {
3383
3386
  parseInput(input = {}, actor = "") {
3384
3387
  const runtime = tryParseJSON(input == null ? void 0 : input.runtime) || {};
3385
3388
  const resolvedActor = String(actor || (input == null ? void 0 : input.actor) || "").trim();
3389
+ const query = String((input == null ? void 0 : input.query) || "").trim();
3386
3390
  const cookies = normalizeCookies(runtime == null ? void 0 : runtime.cookies);
3387
3391
  const cookieMap = buildCookieMap(cookies);
3388
3392
  const localStorage = normalizeLocalStorage(runtime == null ? void 0 : runtime.local_storage);
@@ -3406,6 +3410,7 @@ var RuntimeEnv = {
3406
3410
  actor: resolvedActor,
3407
3411
  runtime: normalizedRuntime,
3408
3412
  envId,
3413
+ query,
3409
3414
  auth,
3410
3415
  cookies,
3411
3416
  cookieMap,
@@ -3474,6 +3479,12 @@ var RuntimeEnv = {
3474
3479
  async applyToPage(page, source = {}, options = {}) {
3475
3480
  if (!page) return;
3476
3481
  const state = normalizeRuntimeState(source, (options == null ? void 0 : options.actor) || "");
3482
+ Object.defineProperty(page, PageRuntimeStateKey, {
3483
+ configurable: true,
3484
+ enumerable: false,
3485
+ writable: true,
3486
+ value: state
3487
+ });
3477
3488
  const localStorage = state.localStorage || {};
3478
3489
  const sessionStorage = state.sessionStorage || {};
3479
3490
  const cookies = (state.cookies || []).map((cookie) => {