sweetlink 0.1.0 → 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.
- package/CHANGELOG.md +20 -0
- package/LICENSE +1 -1
- package/README.md +22 -11
- package/dist/daemon/src/codename.d.ts.map +1 -1
- package/dist/daemon/src/codename.js +11 -11
- package/dist/daemon/src/codename.js.map +1 -1
- package/dist/daemon/src/index.d.ts +1 -1
- package/dist/daemon/src/index.js +131 -122
- package/dist/daemon/src/index.js.map +1 -1
- package/dist/shared/src/env.d.ts.map +1 -1
- package/dist/shared/src/env.js +12 -12
- package/dist/shared/src/env.js.map +1 -1
- package/dist/shared/src/index.d.ts +30 -30
- package/dist/shared/src/index.d.ts.map +1 -1
- package/dist/shared/src/index.js +17 -17
- package/dist/shared/src/index.js.map +1 -1
- package/dist/shared/src/node.d.ts +1 -1
- package/dist/shared/src/node.d.ts.map +1 -1
- package/dist/shared/src/node.js +18 -18
- package/dist/shared/src/node.js.map +1 -1
- package/dist/src/codex.d.ts +1 -1
- package/dist/src/codex.js +19 -19
- package/dist/src/codex.js.map +1 -1
- package/dist/src/commands/click.d.ts +1 -1
- package/dist/src/commands/click.d.ts.map +1 -1
- package/dist/src/commands/click.js +32 -24
- package/dist/src/commands/click.js.map +1 -1
- package/dist/src/commands/run-js.d.ts +1 -1
- package/dist/src/commands/run-js.d.ts.map +1 -1
- package/dist/src/commands/run-js.js +10 -10
- package/dist/src/commands/run-js.js.map +1 -1
- package/dist/src/commands/trust-ca.d.ts +1 -1
- package/dist/src/commands/trust-ca.js +15 -15
- package/dist/src/core/config-file.d.ts +6 -0
- package/dist/src/core/config-file.d.ts.map +1 -1
- package/dist/src/core/config-file.js +73 -38
- package/dist/src/core/config-file.js.map +1 -1
- package/dist/src/core/config.d.ts +3 -2
- package/dist/src/core/config.d.ts.map +1 -1
- package/dist/src/core/config.js +31 -18
- package/dist/src/core/config.js.map +1 -1
- package/dist/src/core/dev-bootstrap.d.ts +10 -0
- package/dist/src/core/dev-bootstrap.d.ts.map +1 -0
- package/dist/src/core/dev-bootstrap.js +112 -0
- package/dist/src/core/dev-bootstrap.js.map +1 -0
- package/dist/src/core/env.d.ts +1 -1
- package/dist/src/core/env.d.ts.map +1 -1
- package/dist/src/core/env.js +3 -3
- package/dist/src/core/env.js.map +1 -1
- package/dist/src/devtools-registry.d.ts.map +1 -1
- package/dist/src/devtools-registry.js +48 -46
- package/dist/src/devtools-registry.js.map +1 -1
- package/dist/src/env.d.ts +1 -1
- package/dist/src/env.js +1 -1
- package/dist/src/http.d.ts.map +1 -1
- package/dist/src/http.js +7 -6
- package/dist/src/http.js.map +1 -1
- package/dist/src/index.d.ts +7 -7
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +450 -363
- package/dist/src/index.js.map +1 -1
- package/dist/src/runtime/browser/client.d.ts +3 -3
- package/dist/src/runtime/browser/client.d.ts.map +1 -1
- package/dist/src/runtime/browser/client.js +79 -72
- package/dist/src/runtime/browser/client.js.map +1 -1
- package/dist/src/runtime/browser/commands/index.d.ts +2 -2
- package/dist/src/runtime/browser/commands/index.js +17 -17
- package/dist/src/runtime/browser/commands/index.js.map +1 -1
- package/dist/src/runtime/browser/dom-to-image-loader.d.ts.map +1 -1
- package/dist/src/runtime/browser/dom-to-image-loader.js +7 -7
- package/dist/src/runtime/browser/dom-to-image-loader.js.map +1 -1
- package/dist/src/runtime/browser/index.d.ts +3 -3
- package/dist/src/runtime/browser/index.js +2 -2
- package/dist/src/runtime/browser/module-loader.js +2 -2
- package/dist/src/runtime/browser/screenshot/hooks.d.ts +25 -53
- package/dist/src/runtime/browser/screenshot/hooks.d.ts.map +1 -1
- package/dist/src/runtime/browser/screenshot/hooks.js +32 -29
- package/dist/src/runtime/browser/screenshot/hooks.js.map +1 -1
- package/dist/src/runtime/browser/screenshot/index.d.ts +3 -3
- package/dist/src/runtime/browser/screenshot/index.d.ts.map +1 -1
- package/dist/src/runtime/browser/screenshot/index.js +17 -15
- package/dist/src/runtime/browser/screenshot/index.js.map +1 -1
- package/dist/src/runtime/browser/screenshot/renderers/dom-to-image.d.ts +1 -1
- package/dist/src/runtime/browser/screenshot/renderers/dom-to-image.js +13 -13
- package/dist/src/runtime/browser/screenshot/renderers/dom-to-image.js.map +1 -1
- package/dist/src/runtime/browser/screenshot/renderers/html2canvas.d.ts +1 -1
- package/dist/src/runtime/browser/screenshot/renderers/html2canvas.d.ts.map +1 -1
- package/dist/src/runtime/browser/screenshot/renderers/html2canvas.js +24 -24
- package/dist/src/runtime/browser/screenshot/renderers/html2canvas.js.map +1 -1
- package/dist/src/runtime/browser/screenshot/targets.d.ts +2 -2
- package/dist/src/runtime/browser/screenshot/targets.js +9 -9
- package/dist/src/runtime/browser/screenshot/utils.d.ts +1 -1
- package/dist/src/runtime/browser/screenshot/utils.d.ts.map +1 -1
- package/dist/src/runtime/browser/screenshot/utils.js +73 -71
- package/dist/src/runtime/browser/screenshot/utils.js.map +1 -1
- package/dist/src/runtime/browser/selector-discovery.d.ts +1 -1
- package/dist/src/runtime/browser/selector-discovery.d.ts.map +1 -1
- package/dist/src/runtime/browser/selector-discovery.js +24 -22
- package/dist/src/runtime/browser/selector-discovery.js.map +1 -1
- package/dist/src/runtime/browser/storage/session-storage.d.ts +1 -1
- package/dist/src/runtime/browser/storage/session-storage.d.ts.map +1 -1
- package/dist/src/runtime/browser/storage/session-storage.js +12 -10
- package/dist/src/runtime/browser/storage/session-storage.js.map +1 -1
- package/dist/src/runtime/browser/types.d.ts +7 -7
- package/dist/src/runtime/browser/types.js +1 -1
- package/dist/src/runtime/browser/utils/console.d.ts +1 -1
- package/dist/src/runtime/browser/utils/console.js +16 -16
- package/dist/src/runtime/browser/utils/console.js.map +1 -1
- package/dist/src/runtime/browser/utils/environment.js +2 -2
- package/dist/src/runtime/browser/utils/errors.d.ts.map +1 -1
- package/dist/src/runtime/browser/utils/errors.js +11 -11
- package/dist/src/runtime/browser/utils/number.d.ts.map +1 -1
- package/dist/src/runtime/browser/utils/number.js.map +1 -1
- package/dist/src/runtime/browser/utils/object.d.ts.map +1 -1
- package/dist/src/runtime/browser/utils/object.js +2 -2
- package/dist/src/runtime/browser/utils/object.js.map +1 -1
- package/dist/src/runtime/browser/utils/sanitize.js +2 -2
- package/dist/src/runtime/browser/utils/time.d.ts.map +1 -1
- package/dist/src/runtime/browser/utils/time.js +1 -1
- package/dist/src/runtime/chrome/cookies.d.ts +4 -4
- package/dist/src/runtime/chrome/cookies.d.ts.map +1 -1
- package/dist/src/runtime/chrome/cookies.js +31 -31
- package/dist/src/runtime/chrome/cookies.js.map +1 -1
- package/dist/src/runtime/chrome/deep-link.d.ts +13 -0
- package/dist/src/runtime/chrome/deep-link.d.ts.map +1 -0
- package/dist/src/runtime/chrome/deep-link.js +292 -0
- package/dist/src/runtime/chrome/deep-link.js.map +1 -0
- package/dist/src/runtime/chrome/diagnostics.d.ts.map +1 -1
- package/dist/src/runtime/chrome/diagnostics.js +13 -11
- package/dist/src/runtime/chrome/diagnostics.js.map +1 -1
- package/dist/src/runtime/chrome/focus.d.ts.map +1 -1
- package/dist/src/runtime/chrome/focus.js +5 -5
- package/dist/src/runtime/chrome/focus.js.map +1 -1
- package/dist/src/runtime/chrome/launch.d.ts.map +1 -1
- package/dist/src/runtime/chrome/launch.js +30 -30
- package/dist/src/runtime/chrome/launch.js.map +1 -1
- package/dist/src/runtime/chrome/puppeteer.d.ts +2 -2
- package/dist/src/runtime/chrome/puppeteer.d.ts.map +1 -1
- package/dist/src/runtime/chrome/puppeteer.js +16 -11
- package/dist/src/runtime/chrome/puppeteer.js.map +1 -1
- package/dist/src/runtime/chrome/reuse.d.ts.map +1 -1
- package/dist/src/runtime/chrome/reuse.js +38 -35
- package/dist/src/runtime/chrome/reuse.js.map +1 -1
- package/dist/src/runtime/chrome/session.d.ts +1 -1
- package/dist/src/runtime/chrome/session.d.ts.map +1 -1
- package/dist/src/runtime/chrome/session.js +12 -10
- package/dist/src/runtime/chrome/session.js.map +1 -1
- package/dist/src/runtime/chrome.d.ts +8 -8
- package/dist/src/runtime/chrome.js +8 -8
- package/dist/src/runtime/cookies.d.ts +1 -16
- package/dist/src/runtime/cookies.d.ts.map +1 -1
- package/dist/src/runtime/cookies.js +177 -281
- package/dist/src/runtime/cookies.js.map +1 -1
- package/dist/src/runtime/devstack.d.ts +1 -1
- package/dist/src/runtime/devstack.d.ts.map +1 -1
- package/dist/src/runtime/devstack.js +31 -28
- package/dist/src/runtime/devstack.js.map +1 -1
- package/dist/src/runtime/devtools/background.js +22 -22
- package/dist/src/runtime/devtools/cdp.d.ts +3 -2
- package/dist/src/runtime/devtools/cdp.d.ts.map +1 -1
- package/dist/src/runtime/devtools/cdp.js +61 -56
- package/dist/src/runtime/devtools/cdp.js.map +1 -1
- package/dist/src/runtime/devtools/config.d.ts +44 -1
- package/dist/src/runtime/devtools/config.d.ts.map +1 -1
- package/dist/src/runtime/devtools/config.js +15 -15
- package/dist/src/runtime/devtools/config.js.map +1 -1
- package/dist/src/runtime/devtools/constants.d.ts.map +1 -1
- package/dist/src/runtime/devtools/constants.js +18 -10
- package/dist/src/runtime/devtools/constants.js.map +1 -1
- package/dist/src/runtime/devtools/diagnostics.d.ts +6 -3
- package/dist/src/runtime/devtools/diagnostics.d.ts.map +1 -1
- package/dist/src/runtime/devtools/diagnostics.js +40 -38
- package/dist/src/runtime/devtools/diagnostics.js.map +1 -1
- package/dist/src/runtime/devtools/oauth.d.ts +1 -1
- package/dist/src/runtime/devtools/oauth.d.ts.map +1 -1
- package/dist/src/runtime/devtools/oauth.js +35 -28
- package/dist/src/runtime/devtools/oauth.js.map +1 -1
- package/dist/src/runtime/devtools/types.d.ts +3 -48
- package/dist/src/runtime/devtools/types.d.ts.map +1 -1
- package/dist/src/runtime/devtools.d.ts +7 -7
- package/dist/src/runtime/devtools.js +7 -7
- package/dist/src/runtime/next-devtools.d.ts.map +1 -1
- package/dist/src/runtime/next-devtools.js +12 -12
- package/dist/src/runtime/next-devtools.js.map +1 -1
- package/dist/src/runtime/screenshot.d.ts +9 -9
- package/dist/src/runtime/screenshot.d.ts.map +1 -1
- package/dist/src/runtime/screenshot.js +65 -46
- package/dist/src/runtime/screenshot.js.map +1 -1
- package/dist/src/runtime/scripts.d.ts +1 -1
- package/dist/src/runtime/scripts.d.ts.map +1 -1
- package/dist/src/runtime/scripts.js +28 -28
- package/dist/src/runtime/scripts.js.map +1 -1
- package/dist/src/runtime/session.d.ts +6 -6
- package/dist/src/runtime/session.d.ts.map +1 -1
- package/dist/src/runtime/session.js +35 -35
- package/dist/src/runtime/session.js.map +1 -1
- package/dist/src/runtime/smoke.d.ts +3 -3
- package/dist/src/runtime/smoke.d.ts.map +1 -1
- package/dist/src/runtime/smoke.js +85 -79
- package/dist/src/runtime/smoke.js.map +1 -1
- package/dist/src/runtime/url.d.ts +2 -2
- package/dist/src/runtime/url.d.ts.map +1 -1
- package/dist/src/runtime/url.js +20 -20
- package/dist/src/runtime/url.js.map +1 -1
- package/dist/src/screenshot-hooks.d.ts +1 -1
- package/dist/src/screenshot-hooks.d.ts.map +1 -1
- package/dist/src/screenshot-hooks.js +12 -12
- package/dist/src/screenshot-hooks.js.map +1 -1
- package/dist/src/shared/env.d.ts.map +1 -1
- package/dist/src/shared/env.js +11 -11
- package/dist/src/shared/env.js.map +1 -1
- package/dist/src/shared/index.d.ts +30 -30
- package/dist/src/shared/index.d.ts.map +1 -1
- package/dist/src/shared/index.js +17 -17
- package/dist/src/shared/index.js.map +1 -1
- package/dist/src/shared/node.d.ts +1 -1
- package/dist/src/shared/node.d.ts.map +1 -1
- package/dist/src/shared/node.js +18 -18
- package/dist/src/shared/node.js.map +1 -1
- package/dist/src/token.d.ts +1 -1
- package/dist/src/token.d.ts.map +1 -1
- package/dist/src/token.js +21 -18
- package/dist/src/token.js.map +1 -1
- package/dist/src/types.d.ts +7 -1
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/util/app-label.js +4 -4
- package/dist/src/util/errors.d.ts.map +1 -1
- package/dist/src/util/errors.js +12 -10
- package/dist/src/util/errors.js.map +1 -1
- package/dist/src/util/path.js +2 -2
- package/dist/src/util/regex.js +4 -4
- package/package.json +48 -40
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { mkdir, readFile, writeFile } from
|
|
2
|
-
import os from
|
|
3
|
-
import path from
|
|
4
|
-
import { createSweetLinkCommandId } from
|
|
5
|
-
import { fetchJson } from
|
|
6
|
-
import { fetchCliToken } from
|
|
7
|
-
const VALID_SELECTOR_HOOKS = new Set([
|
|
1
|
+
import { mkdir, readFile, writeFile } from "node:fs/promises";
|
|
2
|
+
import os from "node:os";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import { createSweetLinkCommandId } from "../../shared/src/index.js";
|
|
5
|
+
import { fetchJson } from "../http.js";
|
|
6
|
+
import { fetchCliToken } from "../token.js";
|
|
7
|
+
const VALID_SELECTOR_HOOKS = new Set(["data-target", "id", "aria", "role", "structure", "testid"]);
|
|
8
8
|
const SESSION_ID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
9
|
-
const CODENAME_CACHE_PATH = path.join(os.homedir(),
|
|
9
|
+
const CODENAME_CACHE_PATH = path.join(os.homedir(), ".sweetlink", "session-codenames.json");
|
|
10
10
|
async function loadCodenameCache() {
|
|
11
11
|
try {
|
|
12
|
-
const raw = await readFile(CODENAME_CACHE_PATH,
|
|
12
|
+
const raw = await readFile(CODENAME_CACHE_PATH, "utf8");
|
|
13
13
|
const parsed = JSON.parse(raw);
|
|
14
|
-
if (parsed && typeof parsed ===
|
|
14
|
+
if (parsed && typeof parsed === "object") {
|
|
15
15
|
return parsed;
|
|
16
16
|
}
|
|
17
17
|
}
|
|
@@ -24,7 +24,7 @@ async function saveCodenameCache(cache) {
|
|
|
24
24
|
try {
|
|
25
25
|
const directory = path.dirname(CODENAME_CACHE_PATH);
|
|
26
26
|
await mkdir(directory, { recursive: true });
|
|
27
|
-
await writeFile(CODENAME_CACHE_PATH, JSON.stringify(cache, null, 2),
|
|
27
|
+
await writeFile(CODENAME_CACHE_PATH, JSON.stringify(cache, null, 2), "utf8");
|
|
28
28
|
}
|
|
29
29
|
catch {
|
|
30
30
|
/* ignore cache write issues */
|
|
@@ -75,7 +75,7 @@ export function formatSessionHeadline(session) {
|
|
|
75
75
|
export async function resolveSessionIdFromHint(sessionHint, config) {
|
|
76
76
|
const input = sessionHint.trim();
|
|
77
77
|
if (input.length === 0) {
|
|
78
|
-
throw new Error(
|
|
78
|
+
throw new Error("A SweetLink session identifier is required.");
|
|
79
79
|
}
|
|
80
80
|
if (SESSION_ID_PATTERN.test(input)) {
|
|
81
81
|
return input;
|
|
@@ -95,12 +95,12 @@ export async function resolveSessionIdFromHint(sessionHint, config) {
|
|
|
95
95
|
throw new Error(`No active SweetLink session matches "${sessionHint}". Run \`pnpm sweetlink sessions\` to list active sessions.`);
|
|
96
96
|
}
|
|
97
97
|
if (matches.length > 1) {
|
|
98
|
-
const headlines = matches.map((session) => formatSessionHeadline(session)).join(
|
|
98
|
+
const headlines = matches.map((session) => formatSessionHeadline(session)).join(", ");
|
|
99
99
|
throw new Error(`Multiple SweetLink sessions match "${sessionHint}". Refine using one of: ${headlines}.`);
|
|
100
100
|
}
|
|
101
101
|
const match = matches[0];
|
|
102
102
|
if (!match) {
|
|
103
|
-
throw new Error(
|
|
103
|
+
throw new Error("Unexpected missing SweetLink session match.");
|
|
104
104
|
}
|
|
105
105
|
return match.sessionId;
|
|
106
106
|
}
|
|
@@ -108,17 +108,17 @@ export async function resolveSessionIdFromHint(sessionHint, config) {
|
|
|
108
108
|
export async function executeRunScriptCommand(config, options) {
|
|
109
109
|
const token = await fetchCliToken(config);
|
|
110
110
|
const payload = {
|
|
111
|
-
type:
|
|
111
|
+
type: "runScript",
|
|
112
112
|
id: createSweetLinkCommandId(),
|
|
113
113
|
code: options.code,
|
|
114
114
|
timeoutMs: options.timeoutMs,
|
|
115
115
|
captureConsole: Boolean(options.captureConsole),
|
|
116
116
|
};
|
|
117
117
|
const result = await fetchJson(`${config.daemonBaseUrl}/sessions/${encodeURIComponent(options.sessionId)}/command`, {
|
|
118
|
-
method:
|
|
118
|
+
method: "POST",
|
|
119
119
|
headers: {
|
|
120
120
|
Authorization: `Bearer ${token}`,
|
|
121
|
-
|
|
121
|
+
"Content-Type": "application/json",
|
|
122
122
|
},
|
|
123
123
|
body: JSON.stringify(payload),
|
|
124
124
|
});
|
|
@@ -149,51 +149,51 @@ export function resolvePromptOption(options) {
|
|
|
149
149
|
return;
|
|
150
150
|
}
|
|
151
151
|
/** Builds a DOM click script scoped to the provided selector. */
|
|
152
|
-
export function buildClickScript({ selector, scrollIntoView, bubbles }) {
|
|
152
|
+
export function buildClickScript({ selector, scrollIntoView, bubbles, }) {
|
|
153
153
|
const safeSelector = JSON.stringify(selector);
|
|
154
154
|
const notFoundMessage = `SweetLink click: selector ${selector} not found`;
|
|
155
155
|
const lines = [
|
|
156
|
-
|
|
156
|
+
"(() => {",
|
|
157
157
|
` const target = document.querySelector(${safeSelector});`,
|
|
158
|
-
|
|
158
|
+
" if (!target) {",
|
|
159
159
|
` throw new Error(${JSON.stringify(notFoundMessage)});`,
|
|
160
|
-
|
|
160
|
+
" }",
|
|
161
161
|
];
|
|
162
162
|
if (scrollIntoView) {
|
|
163
|
-
lines.push(' if (typeof target.scrollIntoView === "function") {',
|
|
163
|
+
lines.push(' if (typeof target.scrollIntoView === "function") {', " try {", ' target.scrollIntoView({ block: "center", inline: "center", behavior: "smooth" });', " } catch {", " target.scrollIntoView();", " }", " }");
|
|
164
164
|
}
|
|
165
|
-
lines.push(' const event = new MouseEvent("click", {',
|
|
166
|
-
return lines.join(
|
|
165
|
+
lines.push(' const event = new MouseEvent("click", {', " view: window,", ` bubbles: ${bubbles},`, " cancelable: true,", " composed: true", " });", " target.dispatchEvent(event);", ' if (typeof target.click === "function") {', " target.click();", " }", ' return "clicked";', "})()");
|
|
166
|
+
return lines.join("\n");
|
|
167
167
|
}
|
|
168
168
|
/** Shared guard ensuring candidates from selector discovery are valid. */
|
|
169
169
|
export const isSweetLinkSelectorCandidate = (value) => {
|
|
170
|
-
if (typeof value !==
|
|
170
|
+
if (typeof value !== "object" || value === null) {
|
|
171
171
|
return false;
|
|
172
172
|
}
|
|
173
173
|
const candidate = value;
|
|
174
|
-
if (typeof candidate.selector !==
|
|
175
|
-
typeof candidate.tagName !==
|
|
176
|
-
typeof candidate.hook !==
|
|
174
|
+
if (typeof candidate.selector !== "string" ||
|
|
175
|
+
typeof candidate.tagName !== "string" ||
|
|
176
|
+
typeof candidate.hook !== "string" ||
|
|
177
177
|
!VALID_SELECTOR_HOOKS.has(candidate.hook) ||
|
|
178
|
-
typeof candidate.textSnippet !==
|
|
179
|
-
typeof candidate.score !==
|
|
180
|
-
typeof candidate.visible !==
|
|
181
|
-
typeof candidate.path !==
|
|
178
|
+
typeof candidate.textSnippet !== "string" ||
|
|
179
|
+
typeof candidate.score !== "number" ||
|
|
180
|
+
typeof candidate.visible !== "boolean" ||
|
|
181
|
+
typeof candidate.path !== "string") {
|
|
182
182
|
return false;
|
|
183
183
|
}
|
|
184
184
|
const size = candidate.size;
|
|
185
185
|
const position = candidate.position;
|
|
186
|
-
if (!size || typeof size.width !==
|
|
186
|
+
if (!size || typeof size.width !== "number" || typeof size.height !== "number") {
|
|
187
187
|
return false;
|
|
188
188
|
}
|
|
189
|
-
if (!position || typeof position.top !==
|
|
189
|
+
if (!position || typeof position.top !== "number" || typeof position.left !== "number") {
|
|
190
190
|
return false;
|
|
191
191
|
}
|
|
192
192
|
return true;
|
|
193
193
|
};
|
|
194
194
|
/** Wrapper guards selector discovery responses. */
|
|
195
195
|
export const isSweetLinkSelectorDiscoveryResult = (value) => {
|
|
196
|
-
if (typeof value !==
|
|
196
|
+
if (typeof value !== "object" || value === null) {
|
|
197
197
|
return false;
|
|
198
198
|
}
|
|
199
199
|
const record = value;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session.js","sourceRoot":"","sources":["../../../src/runtime/session.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"session.js","sourceRoot":"","sources":["../../../src/runtime/session.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAK7B,OAAO,EAAE,wBAAwB,EAA+B,MAAM,2BAA2B,CAAC;AAClG,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AA4C5C,MAAM,oBAAoB,GAAG,IAAI,GAAG,CAAC,CAAC,aAAa,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,QAAQ,CAAC,CAAC,CAAC;AACnG,MAAM,kBAAkB,GAAG,iEAAiE,CAAC;AAC7F,MAAM,mBAAmB,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,YAAY,EAAE,wBAAwB,CAAC,CAAC;AAI5F,KAAK,UAAU,iBAAiB;IAC9B,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,MAAM,QAAQ,CAAC,mBAAmB,EAAE,MAAM,CAAC,CAAC;QACxD,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAkB,CAAC;QAChD,IAAI,MAAM,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;YACzC,OAAO,MAAM,CAAC;QAChB,CAAC;IACH,CAAC;IAAC,MAAM,CAAC;QACP,8BAA8B;IAChC,CAAC;IACD,OA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EAAE;IAC7C,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;QAChD,OAAO,KAAK,CAAC;IACf,CAAC;IACD,MAAM,MAAM,GAAG,KAAgC,CAAC;IAChD,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE,CAAC;QACtC,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,4BAA4B,CAAC,SAAS,CAAC,CAAC,CAAC;AACzF,CAAC,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { CliConfig } from
|
|
2
|
-
import { type SweetLinkBootstrapDiagnostics } from
|
|
3
|
-
import type { SweetLinkConsoleDump } from
|
|
1
|
+
import type { CliConfig } from "../types.js";
|
|
2
|
+
import { type SweetLinkBootstrapDiagnostics } from "./devtools.js";
|
|
3
|
+
import type { SweetLinkConsoleDump } from "./session.js";
|
|
4
4
|
export declare const SMOKE_ROUTE_PRESETS: Record<string, string[]>;
|
|
5
5
|
export declare const DEFAULT_SMOKE_ROUTES: string[];
|
|
6
6
|
export declare const deriveSmokeRoutes: (raw: string | undefined, defaults: readonly string[]) => string[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"smoke.d.ts","sourceRoot":"","sources":["../../../src/runtime/smoke.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAG7C,OAAO,EAIL,KAAK,6BAA6B,EACnC,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"smoke.d.ts","sourceRoot":"","sources":["../../../src/runtime/smoke.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAG7C,OAA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0B,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,CAE5E;AAED,wBAAsB,sBAAsB,CAC1C,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,SAAS,MAAM,EAAE,GACxB,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAUxB;AAED,wBAAsB,sBAAsB,CAC1C,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,SAAS,MAAM,EAAE,EACzB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,IAAI,CAAC,CAkBf;AAED,wBAAsB,kBAAkB,CACtC,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,SAAS,MAAM,EAAE,GACxB,OAAO,CAAC,IAAI,CAAC,CAUf;AAED,eAAO,MAAM,8BAA8B,UAAW,oBAAoB,KAAG,OAsB5E,CAAC;AAEF,eAAO,MAAM,iCAAiC,UAAW,oBAAoB,KAAG,OA2D/E,CAAC;AAEF,eAAO,MAAM,yBAAyB,UAAW,oBAAoB,KAAG,MASvE,CAAC"}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { regex } from
|
|
2
|
-
import { mkdir, readFile, writeFile } from
|
|
3
|
-
import os from
|
|
4
|
-
import path from
|
|
5
|
-
import { compact, uniq } from
|
|
6
|
-
import { loadSweetLinkFileConfig } from
|
|
7
|
-
import { sweetLinkDebug } from
|
|
8
|
-
import { describeUnknown, isErrnoException } from
|
|
9
|
-
import { delay } from
|
|
10
|
-
import { collectBootstrapDiagnostics, diagnosticsContainBlockingIssues, evaluateInDevToolsTab, } from
|
|
11
|
-
import { executeRunScriptCommand, fetchSessionSummaries, getSessionSummaryById } from
|
|
12
|
-
import { buildWaitCandidateUrls, configurePathRedirects, urlsRoughlyMatch } from
|
|
13
|
-
const ABSOLUTE_URL_PATTERN = regex.as(
|
|
1
|
+
import { regex } from "arkregex";
|
|
2
|
+
import { mkdir, readFile, writeFile } from "node:fs/promises";
|
|
3
|
+
import os from "node:os";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
import { compact, uniq } from "es-toolkit";
|
|
6
|
+
import { loadSweetLinkFileConfig } from "../core/config-file.js";
|
|
7
|
+
import { sweetLinkDebug } from "../env.js";
|
|
8
|
+
import { describeUnknown, isErrnoException } from "../util/errors.js";
|
|
9
|
+
import { delay } from "../util/time.js";
|
|
10
|
+
import { collectBootstrapDiagnostics, diagnosticsContainBlockingIssues, evaluateInDevToolsTab, } from "./devtools.js";
|
|
11
|
+
import { executeRunScriptCommand, fetchSessionSummaries, getSessionSummaryById, } from "./session.js";
|
|
12
|
+
import { buildWaitCandidateUrls, configurePathRedirects, urlsRoughlyMatch } from "./url.js";
|
|
13
|
+
const ABSOLUTE_URL_PATTERN = regex.as("^https?:", "i");
|
|
14
14
|
const normalizeRouteList = (input) => {
|
|
15
|
-
if (typeof input ===
|
|
15
|
+
if (typeof input === "string") {
|
|
16
16
|
const trimmed = input.trim();
|
|
17
17
|
return trimmed.length > 0 ? [trimmed] : [];
|
|
18
18
|
}
|
|
@@ -20,7 +20,7 @@ const normalizeRouteList = (input) => {
|
|
|
20
20
|
return [];
|
|
21
21
|
}
|
|
22
22
|
return compact(input.map((route) => {
|
|
23
|
-
if (typeof route !==
|
|
23
|
+
if (typeof route !== "string") {
|
|
24
24
|
return null;
|
|
25
25
|
}
|
|
26
26
|
const trimmed = route.trim();
|
|
@@ -28,7 +28,7 @@ const normalizeRouteList = (input) => {
|
|
|
28
28
|
}));
|
|
29
29
|
};
|
|
30
30
|
const normalizeSmokePresets = (presets) => {
|
|
31
|
-
if (!presets || typeof presets !==
|
|
31
|
+
if (!presets || typeof presets !== "object") {
|
|
32
32
|
return {};
|
|
33
33
|
}
|
|
34
34
|
const result = {};
|
|
@@ -40,22 +40,22 @@ const normalizeSmokePresets = (presets) => {
|
|
|
40
40
|
}
|
|
41
41
|
return result;
|
|
42
42
|
};
|
|
43
|
-
const SMOKE_PROGRESS_PATH = path.join(os.homedir(),
|
|
43
|
+
const SMOKE_PROGRESS_PATH = path.join(os.homedir(), ".sweetlink", "smoke-progress.json");
|
|
44
44
|
const builtinSmokePresets = {
|
|
45
|
-
main: [
|
|
45
|
+
main: ["timeline", "insights", "search", "pulse"],
|
|
46
46
|
settings: [
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
47
|
+
"settings/account",
|
|
48
|
+
"settings/activity",
|
|
49
|
+
"settings/billing",
|
|
50
|
+
"settings/notifications",
|
|
51
|
+
"settings/social",
|
|
52
|
+
"settings/sync",
|
|
53
|
+
"settings/import",
|
|
54
|
+
"settings/extension",
|
|
55
|
+
"settings/beta",
|
|
56
56
|
],
|
|
57
|
-
|
|
58
|
-
|
|
57
|
+
"billing-only": ["settings/billing"],
|
|
58
|
+
"pulse-only": ["pulse"],
|
|
59
59
|
};
|
|
60
60
|
const { config: fileConfig } = loadSweetLinkFileConfig();
|
|
61
61
|
configurePathRedirects(fileConfig.redirects);
|
|
@@ -66,8 +66,8 @@ export const SMOKE_ROUTE_PRESETS = {
|
|
|
66
66
|
};
|
|
67
67
|
const getPresetRoutes = (name) => normalizeRouteList(SMOKE_ROUTE_PRESETS[name]);
|
|
68
68
|
const configuredDefaults = normalizeRouteList(fileConfig.smokeRoutes?.defaults ?? []);
|
|
69
|
-
const mainPresetRoutes = getPresetRoutes(
|
|
70
|
-
const settingsPresetRoutes = getPresetRoutes(
|
|
69
|
+
const mainPresetRoutes = getPresetRoutes("main");
|
|
70
|
+
const settingsPresetRoutes = getPresetRoutes("settings");
|
|
71
71
|
const fallbackDefaults = [];
|
|
72
72
|
if (mainPresetRoutes.length > 0) {
|
|
73
73
|
fallbackDefaults.push(...mainPresetRoutes);
|
|
@@ -86,7 +86,7 @@ export const deriveSmokeRoutes = (raw, defaults) => {
|
|
|
86
86
|
if (!raw || raw.trim().length === 0) {
|
|
87
87
|
return [...defaults];
|
|
88
88
|
}
|
|
89
|
-
const segments = compact(raw.split(
|
|
89
|
+
const segments = compact(raw.split(",").map((segment) => segment.trim()));
|
|
90
90
|
if (segments.length === 0) {
|
|
91
91
|
return [...defaults];
|
|
92
92
|
}
|
|
@@ -98,48 +98,48 @@ export const deriveSmokeRoutes = (raw, defaults) => {
|
|
|
98
98
|
return uniqueRoutes.length > 0 ? uniqueRoutes : [...defaults];
|
|
99
99
|
};
|
|
100
100
|
const normalizeRoutePath = (route) => {
|
|
101
|
-
const routeValue = typeof route ===
|
|
101
|
+
const routeValue = typeof route === "string" ? route : String(route ?? "");
|
|
102
102
|
if (!routeValue) {
|
|
103
|
-
return
|
|
103
|
+
return "/";
|
|
104
104
|
}
|
|
105
105
|
if (ABSOLUTE_URL_PATTERN.test(routeValue)) {
|
|
106
106
|
try {
|
|
107
107
|
const parsed = new URL(routeValue);
|
|
108
|
-
return parsed.pathname ||
|
|
108
|
+
return parsed.pathname || "/";
|
|
109
109
|
}
|
|
110
110
|
catch {
|
|
111
|
-
return
|
|
111
|
+
return "/";
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
114
|
const trimmed = String.prototype.trim.call(routeValue);
|
|
115
115
|
if (!trimmed) {
|
|
116
|
-
return
|
|
116
|
+
return "/";
|
|
117
117
|
}
|
|
118
|
-
const withSlash = String.prototype.startsWith.call(trimmed,
|
|
119
|
-
return withSlash.replaceAll(/\/{2,}/g,
|
|
118
|
+
const withSlash = String.prototype.startsWith.call(trimmed, "/") ? trimmed : `/${trimmed}`;
|
|
119
|
+
return withSlash.replaceAll(/\/{2,}/g, "/");
|
|
120
120
|
};
|
|
121
121
|
export const buildSmokeRouteUrl = (base, route) => {
|
|
122
122
|
if (ABSOLUTE_URL_PATTERN.test(route)) {
|
|
123
123
|
try {
|
|
124
124
|
const parsed = new URL(route);
|
|
125
|
-
parsed.searchParams.set(
|
|
125
|
+
parsed.searchParams.set("sweetlink", "auto");
|
|
126
126
|
return parsed;
|
|
127
127
|
}
|
|
128
128
|
catch {
|
|
129
129
|
// Fall back to treating as relative path.
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
|
-
const [pathPart, searchPart] = route.split(
|
|
132
|
+
const [pathPart, searchPart] = route.split("?", 2);
|
|
133
133
|
const next = new URL(base.toString());
|
|
134
|
-
next.search =
|
|
135
|
-
next.pathname = normalizeRoutePath(pathPart ??
|
|
134
|
+
next.search = "";
|
|
135
|
+
next.pathname = normalizeRoutePath(pathPart ?? "/");
|
|
136
136
|
if (searchPart) {
|
|
137
137
|
const extra = new URLSearchParams(searchPart);
|
|
138
138
|
for (const [key, value] of extra.entries()) {
|
|
139
139
|
next.searchParams.set(key, value);
|
|
140
140
|
}
|
|
141
141
|
}
|
|
142
|
-
next.searchParams.set(
|
|
142
|
+
next.searchParams.set("sweetlink", "auto");
|
|
143
143
|
return next;
|
|
144
144
|
};
|
|
145
145
|
export const navigateSweetLinkSession = async (params) => {
|
|
@@ -194,7 +194,7 @@ export const triggerSweetLinkCliAuto = async (devtoolsUrl, candidateUrl) => {
|
|
|
194
194
|
}
|
|
195
195
|
catch (error) {
|
|
196
196
|
if (sweetLinkDebug) {
|
|
197
|
-
console.warn(
|
|
197
|
+
console.warn("Failed to trigger SweetLink CLI auto bootstrap:", error);
|
|
198
198
|
}
|
|
199
199
|
}
|
|
200
200
|
}
|
|
@@ -210,7 +210,7 @@ export const ensureSweetLinkSessionConnected = async (params) => {
|
|
|
210
210
|
try {
|
|
211
211
|
// biome-ignore lint/performance/noAwaitInLoops: polling for a session must remain sequential.
|
|
212
212
|
const summary = await getSessionSummaryById(params.config, params.token, activeSessionId);
|
|
213
|
-
if (summary && summary.socketState ===
|
|
213
|
+
if (summary && summary.socketState === "open") {
|
|
214
214
|
return true;
|
|
215
215
|
}
|
|
216
216
|
if (!summary) {
|
|
@@ -224,7 +224,7 @@ export const ensureSweetLinkSessionConnected = async (params) => {
|
|
|
224
224
|
if (replacement) {
|
|
225
225
|
activeSessionId = replacement.sessionId;
|
|
226
226
|
params.onSessionIdChanged?.(replacement.sessionId);
|
|
227
|
-
if (replacement.socketState ===
|
|
227
|
+
if (replacement.socketState === "open") {
|
|
228
228
|
return true;
|
|
229
229
|
}
|
|
230
230
|
}
|
|
@@ -257,14 +257,14 @@ export const waitForSmokeRouteReady = async (params) => {
|
|
|
257
257
|
if (diagnostics.locationHref &&
|
|
258
258
|
urlsRoughlyMatch(diagnostics.locationHref, params.targetUrl.toString()) &&
|
|
259
259
|
diagnostics.readyState &&
|
|
260
|
-
(diagnostics.readyState ===
|
|
260
|
+
(diagnostics.readyState === "complete" || diagnostics.readyState === "interactive")) {
|
|
261
261
|
return diagnostics;
|
|
262
262
|
}
|
|
263
263
|
}
|
|
264
264
|
}
|
|
265
265
|
catch (error) {
|
|
266
266
|
if (sweetLinkDebug) {
|
|
267
|
-
console.warn(
|
|
267
|
+
console.warn("Smoke wait diagnostics error:", error);
|
|
268
268
|
}
|
|
269
269
|
}
|
|
270
270
|
await delay(500);
|
|
@@ -276,7 +276,7 @@ function routesSignatureKey(routes) {
|
|
|
276
276
|
}
|
|
277
277
|
async function readSmokeProgressFile() {
|
|
278
278
|
try {
|
|
279
|
-
const raw = await readFile(SMOKE_PROGRESS_PATH,
|
|
279
|
+
const raw = await readFile(SMOKE_PROGRESS_PATH, "utf8");
|
|
280
280
|
const parsed = JSON.parse(raw);
|
|
281
281
|
if (parsed && Array.isArray(parsed.entries)) {
|
|
282
282
|
return {
|
|
@@ -287,13 +287,13 @@ async function readSmokeProgressFile() {
|
|
|
287
287
|
nextIndex: entry.nextIndex ?? 0,
|
|
288
288
|
updatedAt: entry.updatedAt ?? Date.now(),
|
|
289
289
|
}))
|
|
290
|
-
.filter((entry) => typeof entry.baseOrigin ===
|
|
290
|
+
.filter((entry) => typeof entry.baseOrigin === "string" && typeof entry.routesSignature === "string"),
|
|
291
291
|
};
|
|
292
292
|
}
|
|
293
293
|
}
|
|
294
294
|
catch (error) {
|
|
295
|
-
if (!isErrnoException(error) || error.code !==
|
|
296
|
-
console.warn(
|
|
295
|
+
if (!isErrnoException(error) || error.code !== "ENOENT") {
|
|
296
|
+
console.warn("Failed to read SweetLink smoke progress file:", error);
|
|
297
297
|
}
|
|
298
298
|
}
|
|
299
299
|
return { entries: [] };
|
|
@@ -302,7 +302,7 @@ async function writeSmokeProgressFile(file) {
|
|
|
302
302
|
const directory = path.dirname(SMOKE_PROGRESS_PATH);
|
|
303
303
|
await mkdir(directory, { recursive: true });
|
|
304
304
|
const payload = JSON.stringify({ entries: file.entries }, null, 2);
|
|
305
|
-
await writeFile(SMOKE_PROGRESS_PATH, payload,
|
|
305
|
+
await writeFile(SMOKE_PROGRESS_PATH, payload, "utf8");
|
|
306
306
|
}
|
|
307
307
|
export function computeSmokeRouteSignature(routes) {
|
|
308
308
|
return routesSignatureKey(routes);
|
|
@@ -344,62 +344,66 @@ export async function clearSmokeProgress(baseOrigin, routes) {
|
|
|
344
344
|
await writeSmokeProgressFile({ entries: filtered });
|
|
345
345
|
}
|
|
346
346
|
export const consoleEventIndicatesAuthIssue = (event) => {
|
|
347
|
-
const level = typeof event?.level ===
|
|
348
|
-
if (level && level !==
|
|
347
|
+
const level = typeof event?.level === "string" ? event.level.toLowerCase() : "";
|
|
348
|
+
if (level && level !== "error" && level !== "warn" && level !== "assert") {
|
|
349
349
|
return false;
|
|
350
350
|
}
|
|
351
351
|
if (!(event && Array.isArray(event.args))) {
|
|
352
352
|
return false;
|
|
353
353
|
}
|
|
354
354
|
for (const value of event.args) {
|
|
355
|
-
const text = describeUnknown(value,
|
|
355
|
+
const text = describeUnknown(value, "").toLowerCase();
|
|
356
356
|
if (!text) {
|
|
357
357
|
continue;
|
|
358
358
|
}
|
|
359
|
-
if (text.includes(
|
|
359
|
+
if (text.includes("authentication required") ||
|
|
360
|
+
text.includes("unauthorized") ||
|
|
361
|
+
text.includes("401")) {
|
|
360
362
|
return true;
|
|
361
363
|
}
|
|
362
364
|
}
|
|
363
365
|
return false;
|
|
364
366
|
};
|
|
365
367
|
export const consoleEventIndicatesRuntimeError = (event) => {
|
|
366
|
-
const level = typeof event?.level ===
|
|
367
|
-
const isErrorLevel = level ===
|
|
368
|
+
const level = typeof event?.level === "string" ? event.level.toLowerCase() : "";
|
|
369
|
+
const isErrorLevel = level === "error" || level === "assert";
|
|
368
370
|
const args = Array.isArray(event?.args) ? event.args : [];
|
|
369
371
|
const renderedArgs = args
|
|
370
|
-
.map((value) => describeUnknown(value,
|
|
371
|
-
.filter((value) => typeof value ===
|
|
372
|
+
.map((value) => describeUnknown(value, ""))
|
|
373
|
+
.filter((value) => typeof value === "string" && value.trim().length > 0);
|
|
372
374
|
if (renderedArgs.length === 0) {
|
|
373
375
|
return isErrorLevel;
|
|
374
376
|
}
|
|
375
|
-
const combined = renderedArgs.join(
|
|
376
|
-
if (combined.includes(
|
|
377
|
+
const combined = renderedArgs.join(" ").toLowerCase();
|
|
378
|
+
if (combined.includes("[fast refresh]")) {
|
|
377
379
|
return false;
|
|
378
380
|
}
|
|
379
|
-
const isTrpcMetadataLog = combined.includes(
|
|
381
|
+
const isTrpcMetadataLog = combined.includes("[trpc]") && combined.includes("trpcclienterror");
|
|
380
382
|
if (isTrpcMetadataLog) {
|
|
381
383
|
return false;
|
|
382
384
|
}
|
|
383
385
|
if (isErrorLevel) {
|
|
384
386
|
return true;
|
|
385
387
|
}
|
|
386
|
-
if (level ===
|
|
387
|
-
if (combined.includes(
|
|
388
|
+
if (level === "warn") {
|
|
389
|
+
if (combined.includes("[trpc]")) {
|
|
388
390
|
return false;
|
|
389
391
|
}
|
|
390
|
-
return (combined.includes(
|
|
391
|
-
combined.includes(
|
|
392
|
-
combined.includes(
|
|
393
|
-
(combined.includes(
|
|
392
|
+
return (combined.includes("uncaught") ||
|
|
393
|
+
combined.includes("unhandled") ||
|
|
394
|
+
combined.includes("sweetlink auto-activation failed") ||
|
|
395
|
+
(combined.includes("error:") && !combined.includes("trpcclienterror")));
|
|
394
396
|
}
|
|
395
|
-
if (!level || level ===
|
|
396
|
-
if (combined.includes(
|
|
397
|
+
if (!level || level === "log" || level === "info" || level === "debug") {
|
|
398
|
+
if (combined.includes("sweetlink auto-activation failed")) {
|
|
397
399
|
return true;
|
|
398
400
|
}
|
|
399
|
-
if (combined.includes(
|
|
401
|
+
if (combined.includes("uncaught") || combined.includes("unhandled")) {
|
|
400
402
|
return true;
|
|
401
403
|
}
|
|
402
|
-
if (combined.includes(
|
|
404
|
+
if (combined.includes("error:") &&
|
|
405
|
+
!combined.includes("trpcclienterror") &&
|
|
406
|
+
!combined.includes("[trpc]")) {
|
|
403
407
|
return true;
|
|
404
408
|
}
|
|
405
409
|
return false;
|
|
@@ -407,11 +411,13 @@ export const consoleEventIndicatesRuntimeError = (event) => {
|
|
|
407
411
|
return false;
|
|
408
412
|
};
|
|
409
413
|
export const formatConsoleEventSummary = (event) => {
|
|
410
|
-
const timestamp = Number.isFinite(event.timestamp)
|
|
414
|
+
const timestamp = Number.isFinite(event.timestamp)
|
|
415
|
+
? new Date(event.timestamp).toISOString()
|
|
416
|
+
: "unknown-time";
|
|
411
417
|
const message = event.args
|
|
412
|
-
.map((value) => describeUnknown(value,
|
|
413
|
-
.join(
|
|
418
|
+
.map((value) => describeUnknown(value, ""))
|
|
419
|
+
.join(" ")
|
|
414
420
|
.trim();
|
|
415
|
-
return `[${timestamp}] ${event.level ??
|
|
421
|
+
return `[${timestamp}] ${event.level ?? "log"} ${message}`;
|
|
416
422
|
};
|
|
417
423
|
//# sourceMappingURL=smoke.js.map
|