@web-auto/camo 0.1.26 → 0.2.1

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.
Files changed (117) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +586 -586
  3. package/bin/browser-service.mjs +11 -11
  4. package/bin/camo.mjs +22 -22
  5. package/package.json +48 -48
  6. package/scripts/build.mjs +19 -19
  7. package/scripts/bump-version.mjs +34 -34
  8. package/scripts/check-file-size.mjs +80 -80
  9. package/scripts/file-size-policy.json +12 -2
  10. package/scripts/install.mjs +76 -76
  11. package/scripts/release.sh +54 -54
  12. package/src/autoscript/action-providers/index.mjs +6 -6
  13. package/src/autoscript/impact-engine.mjs +78 -78
  14. package/src/autoscript/runtime.mjs +1017 -1017
  15. package/src/autoscript/schema.mjs +376 -376
  16. package/src/cli.mjs +405 -405
  17. package/src/commands/attach.mjs +141 -141
  18. package/src/commands/autoscript.mjs +1011 -1011
  19. package/src/commands/browser.mjs +1255 -1257
  20. package/src/commands/container.mjs +401 -401
  21. package/src/commands/cookies.mjs +69 -69
  22. package/src/commands/create.mjs +98 -98
  23. package/src/commands/devtools.mjs +349 -349
  24. package/src/commands/events.mjs +152 -152
  25. package/src/commands/highlight-mode.mjs +24 -24
  26. package/src/commands/init.mjs +68 -68
  27. package/src/commands/lifecycle.mjs +275 -275
  28. package/src/commands/mouse.mjs +45 -45
  29. package/src/commands/profile.mjs +46 -46
  30. package/src/commands/record.mjs +115 -115
  31. package/src/commands/system.mjs +14 -14
  32. package/src/commands/window.mjs +123 -123
  33. package/src/container/change-notifier.mjs +362 -362
  34. package/src/container/element-filter.mjs +143 -143
  35. package/src/container/index.mjs +3 -3
  36. package/src/container/runtime-core/checkpoint.mjs +209 -209
  37. package/src/container/runtime-core/index.mjs +21 -21
  38. package/src/container/runtime-core/operations/index.mjs +774 -774
  39. package/src/container/runtime-core/operations/selector-scripts.mjs +277 -277
  40. package/src/container/runtime-core/operations/tab-pool.mjs +746 -746
  41. package/src/container/runtime-core/operations/viewport.mjs +189 -189
  42. package/src/container/runtime-core/search.mjs +190 -190
  43. package/src/container/runtime-core/subscription.mjs +224 -224
  44. package/src/container/runtime-core/utils.mjs +94 -94
  45. package/src/container/runtime-core/validation.mjs +127 -184
  46. package/src/container/runtime-core.mjs +1 -1
  47. package/src/container/subscription-registry.mjs +459 -459
  48. package/src/core/actions.mjs +561 -561
  49. package/src/core/browser.mjs +266 -266
  50. package/src/core/index.mjs +52 -52
  51. package/src/core/utils.mjs +91 -91
  52. package/src/events/daemon-entry.mjs +33 -33
  53. package/src/events/daemon.mjs +80 -80
  54. package/src/events/progress-log.mjs +109 -109
  55. package/src/events/ws-server.mjs +239 -239
  56. package/src/lib/client.mjs +200 -200
  57. package/src/lifecycle/cleanup.mjs +83 -83
  58. package/src/lifecycle/lock.mjs +126 -126
  59. package/src/lifecycle/session-registry.mjs +279 -279
  60. package/src/lifecycle/session-view.mjs +76 -76
  61. package/src/lifecycle/session-watchdog.mjs +281 -281
  62. package/src/services/browser-service/index.js +671 -674
  63. package/src/services/browser-service/internal/BrowserSession.input.test.js +389 -389
  64. package/src/services/browser-service/internal/BrowserSession.js +325 -336
  65. package/src/services/browser-service/internal/ElementRegistry.js +60 -60
  66. package/src/services/browser-service/internal/ProfileLock.js +84 -84
  67. package/src/services/browser-service/internal/SessionManager.js +184 -184
  68. package/src/services/browser-service/internal/SessionManager.test.js +39 -39
  69. package/src/services/browser-service/internal/browser-session/cookies.js +144 -144
  70. package/src/services/browser-service/internal/browser-session/input-ops.js +222 -219
  71. package/src/services/browser-service/internal/browser-session/input-pipeline.js +144 -144
  72. package/src/services/browser-service/internal/browser-session/logging.js +46 -46
  73. package/src/services/browser-service/internal/browser-session/navigation.js +38 -38
  74. package/src/services/browser-service/internal/browser-session/page-hooks.js +442 -442
  75. package/src/services/browser-service/internal/browser-session/page-management.js +302 -336
  76. package/src/services/browser-service/internal/browser-session/page-management.test.js +148 -148
  77. package/src/services/browser-service/internal/browser-session/recording.js +198 -198
  78. package/src/services/browser-service/internal/browser-session/runtime-events.js +61 -61
  79. package/src/services/browser-service/internal/browser-session/session-core.js +84 -84
  80. package/src/services/browser-service/internal/browser-session/session-state.js +38 -38
  81. package/src/services/browser-service/internal/browser-session/types.js +14 -14
  82. package/src/services/browser-service/internal/browser-session/utils.js +95 -95
  83. package/src/services/browser-service/internal/browser-session/viewport-manager.js +46 -46
  84. package/src/services/browser-service/internal/browser-session/viewport.js +215 -215
  85. package/src/services/browser-service/internal/container-matcher.js +851 -851
  86. package/src/services/browser-service/internal/container-registry.js +182 -182
  87. package/src/services/browser-service/internal/engine-manager.js +259 -259
  88. package/src/services/browser-service/internal/fingerprint.js +203 -203
  89. package/src/services/browser-service/internal/heartbeat.js +137 -137
  90. package/src/services/browser-service/internal/logging.js +46 -46
  91. package/src/services/browser-service/internal/page-runtime/runtime.js +1317 -1317
  92. package/src/services/browser-service/internal/pageRuntime.js +28 -28
  93. package/src/services/browser-service/internal/runtimeInjector.js +31 -31
  94. package/src/services/browser-service/internal/service-process-logger.js +140 -140
  95. package/src/services/browser-service/internal/state-bus.js +45 -45
  96. package/src/services/browser-service/internal/storage-paths.js +42 -42
  97. package/src/services/browser-service/internal/ws-server.js +1194 -1194
  98. package/src/services/browser-service/internal/ws-server.test.js +58 -58
  99. package/src/services/browser-service/server.mjs +6 -6
  100. package/src/services/controller/cli-bridge.js +93 -93
  101. package/src/services/controller/container-index.js +50 -50
  102. package/src/services/controller/container-storage.js +36 -36
  103. package/src/services/controller/controller-actions.js +207 -207
  104. package/src/services/controller/controller.js +1138 -1138
  105. package/src/services/controller/selectors.js +54 -54
  106. package/src/services/controller/transport.js +125 -125
  107. package/src/utils/args.mjs +26 -26
  108. package/src/utils/browser-service.mjs +544 -544
  109. package/src/utils/command-log.mjs +64 -64
  110. package/src/utils/config.mjs +214 -214
  111. package/src/utils/fingerprint.mjs +181 -181
  112. package/src/utils/help.mjs +216 -216
  113. package/src/utils/js-policy.mjs +13 -13
  114. package/src/utils/ws-client.mjs +30 -30
  115. package/src/container/runtime-core/operations/tab-pool.mjs.bak +0 -762
  116. package/src/container/runtime-core/operations/tab-pool.mjs.syntax-error +0 -762
  117. package/src/services/browser-service/index.js.bak +0 -671
@@ -1,144 +1,144 @@
1
- import { resolveInputActionMaxAttempts, resolveInputActionTimeoutMs, resolveInputMode, resolveInputRecoveryBringToFrontTimeoutMs, resolveInputRecoveryDelayMs, resolveInputReadySettleMs, shouldSkipBringToFront } from './utils.js';
2
- import { ensurePageRuntime } from '../pageRuntime.js';
3
- export class BrowserInputPipeline {
4
- ensurePrimaryPage;
5
- isHeadless;
6
- constructor(ensurePrimaryPage, isHeadless) {
7
- this.ensurePrimaryPage = ensurePrimaryPage;
8
- this.isHeadless = isHeadless;
9
- }
10
- inputActionTail = Promise.resolve();
11
- async ensureInputReady(page) {
12
- if (resolveInputMode() === 'cdp')
13
- return;
14
- if (this.isHeadless())
15
- return;
16
- if (shouldSkipBringToFront()) {
17
- const settleMs = resolveInputReadySettleMs();
18
- if (settleMs > 0) {
19
- await page.waitForTimeout(settleMs).catch(() => { });
20
- }
21
- return;
22
- }
23
- const bringToFrontTimeoutMs = resolveInputRecoveryBringToFrontTimeoutMs();
24
- let bringToFrontTimer = null;
25
- try {
26
- await Promise.race([
27
- page.bringToFront(),
28
- new Promise((_resolve, reject) => {
29
- bringToFrontTimer = setTimeout(() => {
30
- reject(new Error(`input ready bringToFront timed out after ${bringToFrontTimeoutMs}ms`));
31
- }, bringToFrontTimeoutMs);
32
- }),
33
- ]);
34
- }
35
- catch {
36
- // Best-effort only
37
- }
38
- finally {
39
- if (bringToFrontTimer)
40
- clearTimeout(bringToFrontTimer);
41
- }
42
- const settleMs = resolveInputReadySettleMs();
43
- if (settleMs > 0) {
44
- await page.waitForTimeout(settleMs).catch(() => { });
45
- }
46
- }
47
- async resolveInputPage(preferredPage) {
48
- try {
49
- const page = await this.ensurePrimaryPage();
50
- if (page && !page.isClosed())
51
- return page;
52
- }
53
- catch { }
54
- if (preferredPage && !preferredPage.isClosed())
55
- return preferredPage;
56
- return this.ensurePrimaryPage();
57
- }
58
- async withInputActionTimeout(label, run, timeoutOverrideMs) {
59
- const resolvedOverride = Number(timeoutOverrideMs);
60
- const timeoutMs = Number.isFinite(resolvedOverride) && resolvedOverride > 0
61
- ? Math.floor(resolvedOverride)
62
- : resolveInputActionTimeoutMs();
63
- let timer = null;
64
- try {
65
- return await Promise.race([
66
- run(),
67
- new Promise((_resolve, reject) => {
68
- timer = setTimeout(() => reject(new Error(`${label} timed out after ${timeoutMs}ms`)), timeoutMs);
69
- }),
70
- ]);
71
- }
72
- finally {
73
- if (timer)
74
- clearTimeout(timer);
75
- }
76
- }
77
- async recoverInputPipeline(page) {
78
- const activePage = await this.resolveInputPage(page).catch(() => page);
79
- if (!shouldSkipBringToFront()) {
80
- const bringToFrontTimeoutMs = resolveInputRecoveryBringToFrontTimeoutMs();
81
- let bringToFrontTimer = null;
82
- try {
83
- await Promise.race([
84
- activePage.bringToFront(),
85
- new Promise((_resolve, reject) => {
86
- bringToFrontTimer = setTimeout(() => {
87
- reject(new Error(`input recovery bringToFront timed out after ${bringToFrontTimeoutMs}ms`));
88
- }, bringToFrontTimeoutMs);
89
- }),
90
- ]);
91
- }
92
- catch {
93
- // Best-effort recovery only.
94
- }
95
- finally {
96
- if (bringToFrontTimer)
97
- clearTimeout(bringToFrontTimer);
98
- }
99
- }
100
- const delayMs = resolveInputRecoveryDelayMs();
101
- if (delayMs > 0) {
102
- try {
103
- await activePage.waitForTimeout(delayMs);
104
- }
105
- catch { }
106
- }
107
- await ensurePageRuntime(activePage, true).catch(() => { });
108
- return this.resolveInputPage(activePage).catch(() => activePage);
109
- }
110
- async runInputAction(page, label, run) {
111
- const maxAttempts = resolveInputActionMaxAttempts();
112
- let lastError = null;
113
- let activePage = page;
114
- for (let attempt = 1; attempt <= maxAttempts; attempt += 1) {
115
- activePage = await this.resolveInputPage(activePage).catch(() => activePage);
116
- try {
117
- return await this.withInputActionTimeout(`${label} (attempt ${attempt}/${maxAttempts})`, () => run(activePage));
118
- }
119
- catch (error) {
120
- lastError = error;
121
- if (attempt >= maxAttempts)
122
- break;
123
- activePage = await this.recoverInputPipeline(activePage);
124
- }
125
- }
126
- if (lastError instanceof Error)
127
- throw lastError;
128
- throw new Error(`${label} failed`);
129
- }
130
- async withInputActionLock(run) {
131
- const previous = this.inputActionTail;
132
- let release = null;
133
- this.inputActionTail = new Promise((resolve) => { release = resolve; });
134
- await previous.catch(() => { });
135
- try {
136
- return await run();
137
- }
138
- finally {
139
- if (release)
140
- release();
141
- }
142
- }
143
- }
144
- //# sourceMappingURL=input-pipeline.js.map
1
+ import { resolveInputActionMaxAttempts, resolveInputActionTimeoutMs, resolveInputMode, resolveInputRecoveryBringToFrontTimeoutMs, resolveInputRecoveryDelayMs, resolveInputReadySettleMs, shouldSkipBringToFront } from './utils.js';
2
+ import { ensurePageRuntime } from '../pageRuntime.js';
3
+ export class BrowserInputPipeline {
4
+ ensurePrimaryPage;
5
+ isHeadless;
6
+ constructor(ensurePrimaryPage, isHeadless) {
7
+ this.ensurePrimaryPage = ensurePrimaryPage;
8
+ this.isHeadless = isHeadless;
9
+ }
10
+ inputActionTail = Promise.resolve();
11
+ async ensureInputReady(page) {
12
+ if (resolveInputMode() === 'cdp')
13
+ return;
14
+ if (this.isHeadless())
15
+ return;
16
+ if (shouldSkipBringToFront()) {
17
+ const settleMs = resolveInputReadySettleMs();
18
+ if (settleMs > 0) {
19
+ await page.waitForTimeout(settleMs).catch(() => { });
20
+ }
21
+ return;
22
+ }
23
+ const bringToFrontTimeoutMs = resolveInputRecoveryBringToFrontTimeoutMs();
24
+ let bringToFrontTimer = null;
25
+ try {
26
+ await Promise.race([
27
+ page.bringToFront(),
28
+ new Promise((_resolve, reject) => {
29
+ bringToFrontTimer = setTimeout(() => {
30
+ reject(new Error(`input ready bringToFront timed out after ${bringToFrontTimeoutMs}ms`));
31
+ }, bringToFrontTimeoutMs);
32
+ }),
33
+ ]);
34
+ }
35
+ catch {
36
+ // Best-effort only
37
+ }
38
+ finally {
39
+ if (bringToFrontTimer)
40
+ clearTimeout(bringToFrontTimer);
41
+ }
42
+ const settleMs = resolveInputReadySettleMs();
43
+ if (settleMs > 0) {
44
+ await page.waitForTimeout(settleMs).catch(() => { });
45
+ }
46
+ }
47
+ async resolveInputPage(preferredPage) {
48
+ try {
49
+ const page = await this.ensurePrimaryPage();
50
+ if (page && !page.isClosed())
51
+ return page;
52
+ }
53
+ catch { }
54
+ if (preferredPage && !preferredPage.isClosed())
55
+ return preferredPage;
56
+ return this.ensurePrimaryPage();
57
+ }
58
+ async withInputActionTimeout(label, run, timeoutOverrideMs) {
59
+ const resolvedOverride = Number(timeoutOverrideMs);
60
+ const timeoutMs = Number.isFinite(resolvedOverride) && resolvedOverride > 0
61
+ ? Math.floor(resolvedOverride)
62
+ : resolveInputActionTimeoutMs();
63
+ let timer = null;
64
+ try {
65
+ return await Promise.race([
66
+ run(),
67
+ new Promise((_resolve, reject) => {
68
+ timer = setTimeout(() => reject(new Error(`${label} timed out after ${timeoutMs}ms`)), timeoutMs);
69
+ }),
70
+ ]);
71
+ }
72
+ finally {
73
+ if (timer)
74
+ clearTimeout(timer);
75
+ }
76
+ }
77
+ async recoverInputPipeline(page) {
78
+ const activePage = await this.resolveInputPage(page).catch(() => page);
79
+ if (!shouldSkipBringToFront()) {
80
+ const bringToFrontTimeoutMs = resolveInputRecoveryBringToFrontTimeoutMs();
81
+ let bringToFrontTimer = null;
82
+ try {
83
+ await Promise.race([
84
+ activePage.bringToFront(),
85
+ new Promise((_resolve, reject) => {
86
+ bringToFrontTimer = setTimeout(() => {
87
+ reject(new Error(`input recovery bringToFront timed out after ${bringToFrontTimeoutMs}ms`));
88
+ }, bringToFrontTimeoutMs);
89
+ }),
90
+ ]);
91
+ }
92
+ catch {
93
+ // Best-effort recovery only.
94
+ }
95
+ finally {
96
+ if (bringToFrontTimer)
97
+ clearTimeout(bringToFrontTimer);
98
+ }
99
+ }
100
+ const delayMs = resolveInputRecoveryDelayMs();
101
+ if (delayMs > 0) {
102
+ try {
103
+ await activePage.waitForTimeout(delayMs);
104
+ }
105
+ catch { }
106
+ }
107
+ await ensurePageRuntime(activePage, true).catch(() => { });
108
+ return this.resolveInputPage(activePage).catch(() => activePage);
109
+ }
110
+ async runInputAction(page, label, run) {
111
+ const maxAttempts = resolveInputActionMaxAttempts();
112
+ let lastError = null;
113
+ let activePage = page;
114
+ for (let attempt = 1; attempt <= maxAttempts; attempt += 1) {
115
+ activePage = await this.resolveInputPage(activePage).catch(() => activePage);
116
+ try {
117
+ return await this.withInputActionTimeout(`${label} (attempt ${attempt}/${maxAttempts})`, () => run(activePage));
118
+ }
119
+ catch (error) {
120
+ lastError = error;
121
+ if (attempt >= maxAttempts)
122
+ break;
123
+ activePage = await this.recoverInputPipeline(activePage);
124
+ }
125
+ }
126
+ if (lastError instanceof Error)
127
+ throw lastError;
128
+ throw new Error(`${label} failed`);
129
+ }
130
+ async withInputActionLock(run) {
131
+ const previous = this.inputActionTail;
132
+ let release = null;
133
+ this.inputActionTail = new Promise((resolve) => { release = resolve; });
134
+ await previous.catch(() => { });
135
+ try {
136
+ return await run();
137
+ }
138
+ finally {
139
+ if (release)
140
+ release();
141
+ }
142
+ }
143
+ }
144
+ //# sourceMappingURL=input-pipeline.js.map
@@ -1,46 +1,46 @@
1
- import fs from 'node:fs';
2
- import path from 'node:path';
3
- import { CONFIG_DIR, ensureDir } from '../../../utils/config.mjs';
4
-
5
- const LOG_DIR = String(process.env.CAMO_LOG_DIR || '').trim() || path.join(CONFIG_DIR, 'logs');
6
- const DEBUG_LOG_FILE = path.join(LOG_DIR, 'debug.jsonl');
7
- let debugReady = false;
8
-
9
- function isDebugEnabled() {
10
- return (
11
- process.env.DEBUG === '1'
12
- || process.env.debug === '1'
13
- || process.env.CAMO_DEBUG === '1'
14
- || process.env.CAMO_DEBUG === '1'
15
- || process.env.CAMO_DEBUG === '1'
16
- );
17
- }
18
-
19
- function ensureDebugLogDir() {
20
- if (debugReady) return;
21
- try {
22
- ensureDir(LOG_DIR);
23
- debugReady = true;
24
- } catch {
25
- // ignore
26
- }
27
- }
28
-
29
- export function logDebug(module, event, data = {}) {
30
- if (!isDebugEnabled()) return;
31
- ensureDebugLogDir();
32
- const entry = {
33
- ts: Date.now(),
34
- level: 'debug',
35
- module,
36
- event,
37
- data,
38
- };
39
- try {
40
- fs.appendFileSync(DEBUG_LOG_FILE, `${JSON.stringify(entry)}\n`, 'utf8');
41
- } catch {
42
- // ignore
43
- }
44
- }
45
-
46
- export { DEBUG_LOG_FILE };
1
+ import fs from 'node:fs';
2
+ import path from 'node:path';
3
+ import { CONFIG_DIR, ensureDir } from '../../../utils/config.mjs';
4
+
5
+ const LOG_DIR = String(process.env.CAMO_LOG_DIR || '').trim() || path.join(CONFIG_DIR, 'logs');
6
+ const DEBUG_LOG_FILE = path.join(LOG_DIR, 'debug.jsonl');
7
+ let debugReady = false;
8
+
9
+ function isDebugEnabled() {
10
+ return (
11
+ process.env.DEBUG === '1'
12
+ || process.env.debug === '1'
13
+ || process.env.CAMO_DEBUG === '1'
14
+ || process.env.CAMO_DEBUG === '1'
15
+ || process.env.CAMO_DEBUG === '1'
16
+ );
17
+ }
18
+
19
+ function ensureDebugLogDir() {
20
+ if (debugReady) return;
21
+ try {
22
+ ensureDir(LOG_DIR);
23
+ debugReady = true;
24
+ } catch {
25
+ // ignore
26
+ }
27
+ }
28
+
29
+ export function logDebug(module, event, data = {}) {
30
+ if (!isDebugEnabled()) return;
31
+ ensureDebugLogDir();
32
+ const entry = {
33
+ ts: Date.now(),
34
+ level: 'debug',
35
+ module,
36
+ event,
37
+ data,
38
+ };
39
+ try {
40
+ fs.appendFileSync(DEBUG_LOG_FILE, `${JSON.stringify(entry)}\n`, 'utf8');
41
+ } catch {
42
+ // ignore
43
+ }
44
+ }
45
+
46
+ export { DEBUG_LOG_FILE };
@@ -1,39 +1,39 @@
1
- import { ensurePageRuntime } from '../pageRuntime.js';
2
- import { normalizeUrl, resolveNavigationWaitUntil } from './utils.js';
3
- export class BrowserSessionNavigation {
4
- deps;
5
- constructor(deps) {
6
- this.deps = deps;
7
- }
8
- async goto(url) {
9
- const page = await this.deps.ensurePrimaryPage();
10
- await page.goto(url, { waitUntil: resolveNavigationWaitUntil() });
11
- await ensurePageRuntime(page);
12
- this.deps.recordLastKnownUrl(url);
13
- }
14
- async goBack() {
15
- const page = await this.deps.ensurePrimaryPage();
16
- const waitUntil = resolveNavigationWaitUntil();
17
- try {
18
- const res = await page.goBack({ waitUntil }).catch(() => null);
19
- await ensurePageRuntime(page, true).catch(() => { });
20
- this.deps.recordLastKnownUrl(page.url());
21
- return { ok: Boolean(res), url: page.url() };
22
- }
23
- catch {
24
- await ensurePageRuntime(page, true).catch(() => { });
25
- this.deps.recordLastKnownUrl(page.url());
26
- return { ok: false, url: page.url() };
27
- }
28
- }
29
- getCurrentUrl() {
30
- const page = this.deps.getActivePage();
31
- if (page)
32
- return page.url() || this.deps.getLastKnownUrl();
33
- return this.deps.getLastKnownUrl();
34
- }
35
- normalizeUrl(raw) {
36
- return normalizeUrl(raw);
37
- }
38
- }
1
+ import { ensurePageRuntime } from '../pageRuntime.js';
2
+ import { normalizeUrl, resolveNavigationWaitUntil } from './utils.js';
3
+ export class BrowserSessionNavigation {
4
+ deps;
5
+ constructor(deps) {
6
+ this.deps = deps;
7
+ }
8
+ async goto(url) {
9
+ const page = await this.deps.ensurePrimaryPage();
10
+ await page.goto(url, { waitUntil: resolveNavigationWaitUntil() });
11
+ await ensurePageRuntime(page);
12
+ this.deps.recordLastKnownUrl(url);
13
+ }
14
+ async goBack() {
15
+ const page = await this.deps.ensurePrimaryPage();
16
+ const waitUntil = resolveNavigationWaitUntil();
17
+ try {
18
+ const res = await page.goBack({ waitUntil }).catch(() => null);
19
+ await ensurePageRuntime(page, true).catch(() => { });
20
+ this.deps.recordLastKnownUrl(page.url());
21
+ return { ok: Boolean(res), url: page.url() };
22
+ }
23
+ catch {
24
+ await ensurePageRuntime(page, true).catch(() => { });
25
+ this.deps.recordLastKnownUrl(page.url());
26
+ return { ok: false, url: page.url() };
27
+ }
28
+ }
29
+ getCurrentUrl() {
30
+ const page = this.deps.getActivePage();
31
+ if (page)
32
+ return page.url() || this.deps.getLastKnownUrl();
33
+ return this.deps.getLastKnownUrl();
34
+ }
35
+ normalizeUrl(raw) {
36
+ return normalizeUrl(raw);
37
+ }
38
+ }
39
39
  //# sourceMappingURL=navigation.js.map