@skrillex1224/playwright-toolkit 3.0.43 → 3.0.45

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/dist/index.js CHANGED
@@ -71,6 +71,12 @@ var createActorInfo = (info) => {
71
71
  if (!raw) return "/";
72
72
  return raw.startsWith("/") ? raw : `/${raw}`;
73
73
  };
74
+ const normalizePaths = (value) => {
75
+ const raw = value && typeof value === "object" && !Array.isArray(value) ? value : {};
76
+ return Object.fromEntries(
77
+ Object.entries(raw).map(([key, item]) => [String(key || "").trim(), normalizePath(item)]).filter(([key]) => Boolean(key))
78
+ );
79
+ };
74
80
  const normalizeShare2 = (value) => {
75
81
  const raw = value && typeof value === "object" ? value : {};
76
82
  const modeRaw = String(raw.mode || "dom").trim().toLowerCase();
@@ -137,6 +143,7 @@ var createActorInfo = (info) => {
137
143
  const protocol = info.protocol || "https";
138
144
  const domain = normalizeDomain(info.domain);
139
145
  const path3 = normalizePath(info.path);
146
+ const paths = Object.freeze(normalizePaths(info.paths));
140
147
  const share = normalizeShare2(info.share);
141
148
  const device = normalizeDevice(info.device);
142
149
  return {
@@ -146,6 +153,9 @@ var createActorInfo = (info) => {
146
153
  path: path3,
147
154
  share,
148
155
  device,
156
+ get paths() {
157
+ return paths;
158
+ },
149
159
  get icon() {
150
160
  if (info.icon) return info.icon;
151
161
  return buildIcon(this);
@@ -183,6 +193,11 @@ var ActorInfo = {
183
193
  name: "\u7075\u5149",
184
194
  domain: "www.lingguang.com",
185
195
  path: "/",
196
+ paths: {
197
+ settings: "/settings/personal",
198
+ personalization: "/settings/personal",
199
+ memory: "/settings/personal"
200
+ },
186
201
  share: {
187
202
  mode: "response",
188
203
  prefix: "https://www.lingguang.com/share/",
@@ -197,6 +212,11 @@ var ActorInfo = {
197
212
  name: "\u8C46\u5305",
198
213
  domain: "www.doubao.com",
199
214
  path: "/",
215
+ paths: {
216
+ settings: "/settings/memory",
217
+ privacy: "/settings/memory",
218
+ memory: "/settings/memory"
219
+ },
200
220
  device: Device.Desktop,
201
221
  share: {
202
222
  mode: "response",
@@ -213,6 +233,10 @@ var ActorInfo = {
213
233
  name: "DeepSeek",
214
234
  domain: "chat.deepseek.com",
215
235
  path: "/",
236
+ paths: {
237
+ settings: "/",
238
+ personalization: "/"
239
+ },
216
240
  share: {
217
241
  mode: "response",
218
242
  prefix: "https://chat.deepseek.com/share/",
@@ -267,6 +291,11 @@ var ActorInfo = {
267
291
  name: "\u5143\u5B9D",
268
292
  domain: "yuanbao.tencent.com",
269
293
  path: "/chat/",
294
+ paths: {
295
+ settings: "/setting",
296
+ personalization: "/setting",
297
+ memory: "/setting"
298
+ },
270
299
  device: Device.Mobile,
271
300
  share: {
272
301
  mode: "response",
@@ -282,6 +311,10 @@ var ActorInfo = {
282
311
  name: "Kimi",
283
312
  domain: "www.kimi.com",
284
313
  path: "/",
314
+ paths: {
315
+ settings: "/settings?toOpenItem=memory",
316
+ memory: "/settings?toOpenItem=memory"
317
+ },
285
318
  device: Device.Mobile,
286
319
  share: {
287
320
  mode: "response",
@@ -298,6 +331,10 @@ var ActorInfo = {
298
331
  name: "\u901A\u4E49\u5343\u95EE",
299
332
  domain: "www.qianwen.com",
300
333
  path: "/chat",
334
+ paths: {
335
+ settings: "/chat",
336
+ memory: "/chat"
337
+ },
301
338
  device: Device.Mobile,
302
339
  share: {
303
340
  mode: "response",
@@ -314,6 +351,10 @@ var ActorInfo = {
314
351
  name: "\u7EB3\u7C73",
315
352
  domain: "www.n.cn",
316
353
  path: "/",
354
+ paths: {
355
+ settings: "/mine/memory",
356
+ memory: "/mine/memory"
357
+ },
317
358
  share: {
318
359
  mode: "response",
319
360
  prefix: "https://www.n.cn/share/mcp?id=",
@@ -1603,6 +1644,7 @@ var PageRuntimeStateKey = "__playwright_toolkit_runtime_state__";
1603
1644
  var BROWSER_PROFILE_SCHEMA_VERSION = 1;
1604
1645
  var SUPPORTED_CLOAK_FINGERPRINT_PLATFORMS = /* @__PURE__ */ new Set(["linux", "macos", "windows"]);
1605
1646
  var logger3 = createInternalLogger("RuntimeEnv");
1647
+ var MAX_RUNTIME_STORAGE_VALUE_CHARS = 256 * 1024;
1606
1648
  var rememberedRuntimeState = null;
1607
1649
  var isPlainObject = (value) => value && typeof value === "object" && !Array.isArray(value);
1608
1650
  var normalizeKnownDevice = (value) => {
@@ -1646,25 +1688,23 @@ var tryParseJSON = (value) => {
1646
1688
  return null;
1647
1689
  }
1648
1690
  };
1649
- var normalizeLocalStorage = (value) => {
1691
+ var normalizeStorageString = (value) => String(value ?? "").replace(/\u0000/g, "").trim();
1692
+ var normalizeStorageEntries = (value) => {
1650
1693
  const source = value && typeof value === "object" && !Array.isArray(value) ? value : {};
1651
1694
  return Object.entries(source).reduce((acc, [key, item]) => {
1652
- const safeKey = String(key || "").trim();
1653
- const safeValue = String(item ?? "").trim();
1695
+ const safeKey = normalizeStorageString(key);
1696
+ const safeValue = normalizeStorageString(item);
1654
1697
  if (!safeKey || !safeValue || safeValue === "<nil>") return acc;
1698
+ if (safeValue.length > MAX_RUNTIME_STORAGE_VALUE_CHARS) return acc;
1655
1699
  acc[safeKey] = safeValue;
1656
1700
  return acc;
1657
1701
  }, {});
1658
1702
  };
1703
+ var normalizeLocalStorage = (value) => {
1704
+ return normalizeStorageEntries(value);
1705
+ };
1659
1706
  var normalizeSessionStorage = (value) => {
1660
- const source = value && typeof value === "object" && !Array.isArray(value) ? value : {};
1661
- return Object.entries(source).reduce((acc, [key, item]) => {
1662
- const safeKey = String(key || "").trim();
1663
- const safeValue = String(item ?? "").trim();
1664
- if (!safeKey || !safeValue || safeValue === "<nil>") return acc;
1665
- acc[safeKey] = safeValue;
1666
- return acc;
1667
- }, {});
1707
+ return normalizeStorageEntries(value);
1668
1708
  };
1669
1709
  var normalizeCookieSameSite = (value) => {
1670
1710
  const raw = String(value || "").trim().toLowerCase();
@@ -1854,29 +1894,28 @@ var captureRawSnapshotFromPage = async (page) => {
1854
1894
  return "";
1855
1895
  }
1856
1896
  }) : [];
1857
- const snapshot = await page.evaluate(() => {
1858
- const localStorage = {};
1859
- const sessionStorage = {};
1897
+ const snapshot = await page.evaluate((maxStorageValueChars) => {
1898
+ const normalizeStorageStringInPage = (value) => String(value ?? "").replace(/\u0000/g, "").trim();
1899
+ const readStorageArea = (storage) => {
1900
+ const result = {};
1901
+ try {
1902
+ for (let i = 0; i < storage.length; i += 1) {
1903
+ const rawKey = storage.key(i);
1904
+ const key = normalizeStorageStringInPage(rawKey);
1905
+ if (!key) continue;
1906
+ const value = normalizeStorageStringInPage(storage.getItem(rawKey));
1907
+ if (!value || value === "<nil>") continue;
1908
+ if (value.length > maxStorageValueChars) continue;
1909
+ result[key] = value;
1910
+ }
1911
+ } catch {
1912
+ }
1913
+ return result;
1914
+ };
1915
+ const localStorage = readStorageArea(window.localStorage);
1916
+ const sessionStorage = readStorageArea(window.sessionStorage);
1860
1917
  const resourceUrls = [];
1861
1918
  const frameUrls2 = [];
1862
- try {
1863
- for (let i = 0; i < window.localStorage.length; i += 1) {
1864
- const key = window.localStorage.key(i);
1865
- if (!key) continue;
1866
- const value = window.localStorage.getItem(key);
1867
- if (value !== null) localStorage[key] = value;
1868
- }
1869
- } catch {
1870
- }
1871
- try {
1872
- for (let i = 0; i < window.sessionStorage.length; i += 1) {
1873
- const key = window.sessionStorage.key(i);
1874
- if (!key) continue;
1875
- const value = window.sessionStorage.getItem(key);
1876
- if (value !== null) sessionStorage[key] = value;
1877
- }
1878
- } catch {
1879
- }
1880
1919
  try {
1881
1920
  const perfEntries = performance.getEntriesByType("resource") || [];
1882
1921
  perfEntries.forEach((entry) => {
@@ -1923,7 +1962,7 @@ var captureRawSnapshotFromPage = async (page) => {
1923
1962
  }
1924
1963
  }
1925
1964
  };
1926
- });
1965
+ }, MAX_RUNTIME_STORAGE_VALUE_CHARS);
1927
1966
  return normalizeRawSnapshot({
1928
1967
  ...snapshot,
1929
1968
  frame_urls: [...frameUrls, ...snapshot?.frame_urls || []]