tapline-host 1.2.0 → 1.3.0
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/crash.d.ts +24 -0
- package/dist/crash.js +91 -0
- package/dist/crash.js.map +1 -0
- package/dist/format.d.ts +20 -1
- package/dist/format.js +55 -5
- package/dist/format.js.map +1 -1
- package/dist/mcp.js +12 -1
- package/dist/mcp.js.map +1 -1
- package/dist/perf.d.ts +42 -0
- package/dist/perf.js +95 -0
- package/dist/perf.js.map +1 -0
- package/dist/protocol.d.ts +13 -1
- package/dist/protocol.js +11 -0
- package/dist/protocol.js.map +1 -1
- package/dist/run.d.ts +7 -1
- package/dist/run.js +17 -5
- package/dist/run.js.map +1 -1
- package/dist/script.d.ts +6 -0
- package/dist/script.js +35 -3
- package/dist/script.js.map +1 -1
- package/dist/server.d.ts +64 -0
- package/dist/server.js +145 -5
- package/dist/server.js.map +1 -1
- package/dist/tool-text-data.d.ts +3 -1
- package/dist/tool-text-data.js +3 -1
- package/dist/tool-text-data.js.map +1 -1
- package/dist/tools.d.ts +63 -0
- package/dist/tools.js +410 -35
- package/dist/tools.js.map +1 -1
- package/package.json +1 -1
- package/skills/tapline/SKILL.md +3 -2
package/dist/protocol.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"protocol.js","sourceRoot":"","sources":["../src/protocol.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,6EAA6E;AAC7E,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC;AAElC,6BAA6B;AAC7B,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,CAAC;AACpC,MAAM,CAAC,MAAM,uBAAuB,GAAG,IAAI,CAAC;AAC5C,MAAM,CAAC,MAAM,kBAAkB,GAAG,IAAI,CAAC;AACvC,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,CAAC;AAExC,MAAM,CAAC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AAC,MAAM,CAAC;IACrC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC5B,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;IACnB,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACzB,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC5B,KAAK,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;IAC7B,0FAA0F;IAC1F,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC3B,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CACtC,CAAC,CAAC;AAGH,uGAAuG;AACvG,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IACvC,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC3B,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;IACnB,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC5B,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACrC,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC1B,CAAC,CAAC"}
|
package/dist/run.d.ts
CHANGED
|
@@ -5,10 +5,14 @@ import { z } from "zod";
|
|
|
5
5
|
* goes to the app as it would alone (no screen list in between), and the one change block at the end covers
|
|
6
6
|
* the whole batch.
|
|
7
7
|
*/
|
|
8
|
-
export declare const RUN_TOOLS: readonly ["tap", "long_press", "type_text", "scroll", "toggle", "back", "swipe", "open_url", "wait", "wait_for", "app_command", "compare_screen"];
|
|
8
|
+
export declare const RUN_TOOLS: readonly ["tap", "long_press", "type_text", "scroll", "toggle", "back", "swipe", "open_url", "wait", "wait_for", "app_command", "compare_screen", "performance"];
|
|
9
9
|
export type RunTool = (typeof RUN_TOOLS)[number];
|
|
10
10
|
/** Tools a step may not be (they read or manage, rather than act): `bad_params`. */
|
|
11
11
|
export declare const NOT_IN_RUN: string[];
|
|
12
|
+
/** AGENT-TOOLS §15.3: the limits a `performance` step may carry in `expect.under`. */
|
|
13
|
+
export declare const UNDER_KEYS: readonly ["launch_s", "memory_mb", "js_heap_mb", "cpu_percent", "fps_min", "drops", "busy_ms"];
|
|
14
|
+
/** Limits Tapline can't measure: ignored with a note, one per key. */
|
|
15
|
+
export declare const UNDER_NOT_MEASURED: readonly ["memory_mb", "cpu_percent"];
|
|
12
16
|
export declare const expectSchema: z.ZodObject<{
|
|
13
17
|
text: z.ZodOptional<z.ZodString>;
|
|
14
18
|
id: z.ZodOptional<z.ZodString>;
|
|
@@ -19,6 +23,7 @@ export declare const expectSchema: z.ZodObject<{
|
|
|
19
23
|
threshold: z.ZodOptional<z.ZodNumber>;
|
|
20
24
|
ignore: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
21
25
|
timeout: z.ZodOptional<z.ZodNumber>;
|
|
26
|
+
under: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
|
|
22
27
|
}, z.core.$strip>;
|
|
23
28
|
export type Expect = z.infer<typeof expectSchema>;
|
|
24
29
|
export declare const stepSchema: z.ZodObject<{
|
|
@@ -33,6 +38,7 @@ export declare const stepSchema: z.ZodObject<{
|
|
|
33
38
|
threshold: z.ZodOptional<z.ZodNumber>;
|
|
34
39
|
ignore: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
35
40
|
timeout: z.ZodOptional<z.ZodNumber>;
|
|
41
|
+
under: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
|
|
36
42
|
}, z.core.$strip>>;
|
|
37
43
|
}, z.core.$loose>;
|
|
38
44
|
export type Step = z.infer<typeof stepSchema>;
|
package/dist/run.js
CHANGED
|
@@ -5,9 +5,13 @@ import { z } from "zod";
|
|
|
5
5
|
* goes to the app as it would alone (no screen list in between), and the one change block at the end covers
|
|
6
6
|
* the whole batch.
|
|
7
7
|
*/
|
|
8
|
-
export const RUN_TOOLS = ["tap", "long_press", "type_text", "scroll", "toggle", "back", "swipe", "open_url", "wait", "wait_for", "app_command", "compare_screen"];
|
|
8
|
+
export const RUN_TOOLS = ["tap", "long_press", "type_text", "scroll", "toggle", "back", "swipe", "open_url", "wait", "wait_for", "app_command", "compare_screen", "performance"];
|
|
9
9
|
/** Tools a step may not be (they read or manage, rather than act): `bad_params`. */
|
|
10
|
-
export const NOT_IN_RUN = ["look", "run", "audit", "apps", "viewer", "record", "replay", "inspect", "check_layout", "pair", "open_app", "logs", "reload", "filmstrip"];
|
|
10
|
+
export const NOT_IN_RUN = ["look", "run", "audit", "apps", "viewer", "record", "replay", "inspect", "check_layout", "pair", "open_app", "logs", "crash", "reload", "filmstrip"];
|
|
11
|
+
/** AGENT-TOOLS §15.3: the limits a `performance` step may carry in `expect.under`. */
|
|
12
|
+
export const UNDER_KEYS = ["launch_s", "memory_mb", "js_heap_mb", "cpu_percent", "fps_min", "drops", "busy_ms"];
|
|
13
|
+
/** Limits Tapline can't measure: ignored with a note, one per key. */
|
|
14
|
+
export const UNDER_NOT_MEASURED = ["memory_mb", "cpu_percent"];
|
|
11
15
|
export const expectSchema = z
|
|
12
16
|
.object({
|
|
13
17
|
text: z.string().optional(),
|
|
@@ -21,10 +25,16 @@ export const expectSchema = z
|
|
|
21
25
|
/** Targets or rects painted out before the picture check (the shape of compare_screen's ignore); checked by the executor. */
|
|
22
26
|
ignore: z.array(z.record(z.string(), z.unknown())).optional(),
|
|
23
27
|
timeout: z.number().min(0.5).max(30).optional(),
|
|
28
|
+
/** On a `performance` step only; the keys are checked when the batch runs (`bad_params`). */
|
|
29
|
+
under: z.record(z.string(), z.number()).optional(),
|
|
24
30
|
})
|
|
25
|
-
.refine((e) =>
|
|
26
|
-
|
|
27
|
-
|
|
31
|
+
.refine((e) => {
|
|
32
|
+
const named = [e.text, e.id, e.label].filter((v) => v !== undefined).length;
|
|
33
|
+
// `under` (a performance step) stands alone.
|
|
34
|
+
if (e.under !== undefined)
|
|
35
|
+
return named === 0 && e.matches === undefined;
|
|
36
|
+
return named === 1 || (e.matches !== undefined && named === 0);
|
|
37
|
+
}, { message: "expect needs exactly one of text, id or label, or matches (alone, or with one of them); on a performance step, under alone" })
|
|
28
38
|
.refine((e) => e.threshold === undefined || e.matches !== undefined, { message: "expect.threshold goes with matches" })
|
|
29
39
|
.refine((e) => e.ignore === undefined || e.matches !== undefined, { message: "expect.ignore goes with matches" })
|
|
30
40
|
.refine((e) => e.value === undefined || e.text === undefined, { message: "expect.value goes with id or label" });
|
|
@@ -65,6 +75,8 @@ export function describeRunStep(step) {
|
|
|
65
75
|
return "open_url";
|
|
66
76
|
case "app_command":
|
|
67
77
|
return `app_command ${String(p["name"] ?? "")}`.trim();
|
|
78
|
+
case "performance":
|
|
79
|
+
return p["launch"] === true ? "performance launch" : `performance ${Number(p["seconds"] ?? 3)} s`;
|
|
68
80
|
case "back":
|
|
69
81
|
return "back";
|
|
70
82
|
case "compare_screen":
|
package/dist/run.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run.js","sourceRoot":"","sources":["../src/run.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,aAAa,EAAE,gBAAgB,CAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"run.js","sourceRoot":"","sources":["../src/run.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;GA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CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAE,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,CAAE,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAChG,CAAC"}
|
package/dist/script.d.ts
CHANGED
|
@@ -24,6 +24,7 @@ export declare const sharedScriptSchema: z.ZodObject<{
|
|
|
24
24
|
threshold: z.ZodOptional<z.ZodNumber>;
|
|
25
25
|
ignore: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
26
26
|
timeout: z.ZodOptional<z.ZodNumber>;
|
|
27
|
+
under: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
|
|
27
28
|
}, z.core.$strip>>;
|
|
28
29
|
}, z.core.$loose>>;
|
|
29
30
|
}, z.core.$strip>;
|
|
@@ -68,6 +69,11 @@ export declare function refStep(steps: Step[]): number | null;
|
|
|
68
69
|
* line (the failure message) ends with ` (diff: <path>)`.
|
|
69
70
|
*/
|
|
70
71
|
export declare function failureWithDiff(failure: string): string;
|
|
72
|
+
/**
|
|
73
|
+
* What a failed replay's answer says about the app (AGENT-TOOLS 1.10 §15.4), for JUnit's `<system-out>`: the
|
|
74
|
+
* `Logs (since step <n>):` block and the crash note.
|
|
75
|
+
*/
|
|
76
|
+
export declare function failureDiagnostics(failure: string): string | null;
|
|
71
77
|
/** JUnit XML for `tapline replay --junit`: one test case per script, the stop message as the failure. */
|
|
72
78
|
export declare function junitXml(results: Array<{
|
|
73
79
|
name: string;
|
package/dist/script.js
CHANGED
|
@@ -40,6 +40,7 @@ const TOOL_OF = {
|
|
|
40
40
|
command: "app_command",
|
|
41
41
|
waitFor: "wait_for",
|
|
42
42
|
sleep: "wait",
|
|
43
|
+
performance: "performance",
|
|
43
44
|
};
|
|
44
45
|
/** The app's target (`testID`) as a tool target (`id`). */
|
|
45
46
|
function toolTarget(target) {
|
|
@@ -131,7 +132,8 @@ export function readScript(text) {
|
|
|
131
132
|
/** A step a script can't keep: a ref (it doesn't survive a session). */
|
|
132
133
|
export function refStep(steps) {
|
|
133
134
|
const at = steps.findIndex((step) => {
|
|
134
|
-
|
|
135
|
+
// A performance step's tap is a target too.
|
|
136
|
+
const target = step[step.tool === "performance" ? "tap" : "target"];
|
|
135
137
|
return typeof target === "object" && target !== null && "ref" in target;
|
|
136
138
|
});
|
|
137
139
|
return at >= 0 ? at : null;
|
|
@@ -148,14 +150,44 @@ export function failureWithDiff(failure) {
|
|
|
148
150
|
lines[0] = `${lines[0] ?? ""} (diff: ${note[1] ?? ""})`;
|
|
149
151
|
return lines.join("\n");
|
|
150
152
|
}
|
|
153
|
+
/**
|
|
154
|
+
* What a failed replay's answer says about the app (AGENT-TOOLS 1.10 §15.4), for JUnit's `<system-out>`: the
|
|
155
|
+
* `Logs (since step <n>):` block and the crash note.
|
|
156
|
+
*/
|
|
157
|
+
export function failureDiagnostics(failure) {
|
|
158
|
+
const lines = failure.split("\n");
|
|
159
|
+
const out = [];
|
|
160
|
+
const start = lines.findIndex((line) => /^Logs \(since step \d+\):$/.test(line));
|
|
161
|
+
if (start >= 0) {
|
|
162
|
+
out.push(lines[start] ?? "");
|
|
163
|
+
for (const line of lines.slice(start + 1)) {
|
|
164
|
+
if (!/^\d\d:\d\d:\d\d\.\d{3} (error|warning|info) /.test(line))
|
|
165
|
+
break;
|
|
166
|
+
out.push(line);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
out.push(...lines.filter((line) => /^Note: the app (crashed|disconnected)\b/.test(line)));
|
|
170
|
+
return out.length > 0 ? out.join("\n") : null;
|
|
171
|
+
}
|
|
151
172
|
/** JUnit XML for `tapline replay --junit`: one test case per script, the stop message as the failure. */
|
|
152
173
|
export function junitXml(results) {
|
|
153
|
-
|
|
174
|
+
// XML 1.0 forbids control characters other than tab, newline and carriage return (an ANSI colour code's ESC too).
|
|
175
|
+
// eslint-disable-next-line no-control-regex
|
|
176
|
+
const esc = (s) => s.replace(/[\u0000-\u0008\u000B\u000C\u000E-\u001F]/g, "").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
177
|
+
const diagnosticsOut = (failure) => {
|
|
178
|
+
const said = failureDiagnostics(failure);
|
|
179
|
+
return said === null ? [] : [` <system-out>${esc(said)}</system-out>`];
|
|
180
|
+
};
|
|
154
181
|
const failures = results.filter((r) => r.failure !== null).length;
|
|
155
182
|
const total = results.reduce((sum, r) => sum + r.seconds, 0);
|
|
156
183
|
const cases = results.map((r) => r.failure === null
|
|
157
184
|
? ` <testcase classname="tapline" name="${esc(r.name)}" time="${r.seconds.toFixed(3)}"/>`
|
|
158
|
-
:
|
|
185
|
+
: [
|
|
186
|
+
` <testcase classname="tapline" name="${esc(r.name)}" time="${r.seconds.toFixed(3)}">`,
|
|
187
|
+
` <failure message="${esc(r.failure.split("\n")[0] ?? "")}">${esc(r.failure)}</failure>`,
|
|
188
|
+
...diagnosticsOut(r.failure),
|
|
189
|
+
" </testcase>",
|
|
190
|
+
].join("\n"));
|
|
159
191
|
return [
|
|
160
192
|
'<?xml version="1.0" encoding="UTF-8"?>',
|
|
161
193
|
`<testsuites tests="${results.length}" failures="${failures}" time="${total.toFixed(3)}">`,
|
package/dist/script.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"script.js","sourceRoot":"","sources":["../src/script.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,UAAU,EAAa,MAAM,UAAU,CAAC;AAEjD;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IACzC,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,oBAAoB,CAAC;IACvC,OAAO,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;IACrB,I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|
42
42
|
width?: number;
|
|
43
43
|
height?: number;
|
|
44
44
|
}
|
|
45
|
+
/** A fatal JS error of an app (AGENT-TOOLS 15.2), kept per app so it outlives the app's session. */
|
|
46
|
+
export interface CrashRecord {
|
|
47
|
+
/** When the app says it happened (the phone's clock, epoch ms). */
|
|
48
|
+
ts: number;
|
|
49
|
+
/** The error type, e.g. "TypeError". */
|
|
50
|
+
name: string;
|
|
51
|
+
message: string;
|
|
52
|
+
stack: string;
|
|
53
|
+
componentStack?: string;
|
|
54
|
+
/** `live`: the app sent it as it happened; `saved`: the app kept it on the phone and sent it on a later connection. */
|
|
55
|
+
source: "live" | "saved";
|
|
56
|
+
}
|
|
57
|
+
/** Which app on which phone an event belongs to (what `identityOf` is made from). */
|
|
58
|
+
export type AppIdentity = Pick<SessionInfo, "app" | "device">;
|
|
59
|
+
/**
|
|
60
|
+
* Something that stopped an app, in the order the host learned of it. `seq` counts up from 1. `of` says which app
|
|
61
|
+
* it was, so another app's answers don't carry it.
|
|
62
|
+
*/
|
|
63
|
+
export type CrashEvent = {
|
|
64
|
+
seq: number;
|
|
65
|
+
at: number;
|
|
66
|
+
kind: "crash";
|
|
67
|
+
app: string;
|
|
68
|
+
of: AppIdentity;
|
|
69
|
+
crash: CrashRecord;
|
|
70
|
+
} | {
|
|
71
|
+
seq: number;
|
|
72
|
+
at: number;
|
|
73
|
+
kind: "disconnect";
|
|
74
|
+
app: string;
|
|
75
|
+
of: AppIdentity;
|
|
76
|
+
};
|
|
45
77
|
/** The most recent app that dropped, for explaining "no app is connected". */
|
|
46
78
|
export interface LastDisconnect {
|
|
47
79
|
session: SessionInfo;
|
|
@@ -138,6 +170,7 @@ interface HostEvents {
|
|
|
138
170
|
selected: [session: SessionInfo | undefined];
|
|
139
171
|
warning: [message: string];
|
|
140
172
|
}
|
|
173
|
+
export declare function identityOf(info: AppIdentity): string;
|
|
141
174
|
export declare class TaplineHost extends EventEmitter<HostEvents> {
|
|
142
175
|
private readonly token;
|
|
143
176
|
private readonly port;
|
|
@@ -157,8 +190,16 @@ export declare class TaplineHost extends EventEmitter<HostEvents> {
|
|
|
157
190
|
private agentTouchUntil;
|
|
158
191
|
private readonly servers;
|
|
159
192
|
private readonly sessionMap;
|
|
193
|
+
/** The logs of the last few sessions that ended, so a failure that ended its app still reports that app's lines. */
|
|
194
|
+
private readonly goneLogs;
|
|
160
195
|
private selectedId;
|
|
161
196
|
private lastDrop;
|
|
197
|
+
/** When this host process started (this computer's clock), to tell a crash from an earlier run. */
|
|
198
|
+
readonly startedAt: number;
|
|
199
|
+
/** Fatal JS errors per app (by `identityOf`), newest last. */
|
|
200
|
+
private readonly crashMap;
|
|
201
|
+
private readonly crashLog;
|
|
202
|
+
private crashSeq;
|
|
162
203
|
private httpExtension;
|
|
163
204
|
/** Open after `pair`: development builds on the local network may fetch this code (one use, 10 minutes). */
|
|
164
205
|
private devOffer;
|
|
@@ -218,6 +259,29 @@ export declare class TaplineHost extends EventEmitter<HostEvents> {
|
|
|
218
259
|
select(sessionId: string): SessionInfo;
|
|
219
260
|
/** Buffered log/error events for a session, optionally only those after `since` (epoch ms). */
|
|
220
261
|
logs(sessionId: string, since?: number): LogEntry[];
|
|
262
|
+
/**
|
|
263
|
+
* A session's lines whether it is connected or ended (the last few ended ones are kept), and its app and device
|
|
264
|
+
* identity; undefined when nothing is known of it.
|
|
265
|
+
*/
|
|
266
|
+
sessionRecord(sessionId: string): {
|
|
267
|
+
identity: string;
|
|
268
|
+
events: LogEntry[];
|
|
269
|
+
} | undefined;
|
|
270
|
+
/** The agent is about to end the app's connection on purpose (a reload): that is no crash. */
|
|
271
|
+
expectEnd(sessionId: string, expected?: boolean): void;
|
|
272
|
+
/** The number of crash events so far; pass it to `crashEventsAfter` later. */
|
|
273
|
+
crashMark(): number;
|
|
274
|
+
/** Crash events after `seq`, oldest first; only those of the app `of` when it is given. */
|
|
275
|
+
crashEventsAfter(seq: number, of?: AppIdentity): CrashEvent[];
|
|
276
|
+
/** The newest crash event of any app, if any is still kept. */
|
|
277
|
+
lastCrashEvent(): CrashEvent | undefined;
|
|
278
|
+
/**
|
|
279
|
+
* Fatal JS errors of the app `of` (or of every app when it is undefined), newest first. They outlive the
|
|
280
|
+
* app's sessions, so a crash that ended the session can still be read.
|
|
281
|
+
*/
|
|
282
|
+
crashes(of?: Pick<SessionInfo, "app" | "device">): CrashRecord[];
|
|
283
|
+
private recordCrash;
|
|
284
|
+
private pushCrashEvent;
|
|
221
285
|
private describeIds;
|
|
222
286
|
private currentSession;
|
|
223
287
|
/** Sends a request to an app and resolves with its `result` (or rejects with a TaplineError). */
|
package/dist/server.js
CHANGED
|
@@ -4,7 +4,7 @@ import { createServer } from "node:http";
|
|
|
4
4
|
import { randomBytes, timingSafeEqual } from "node:crypto";
|
|
5
5
|
import { WebSocketServer } from "ws";
|
|
6
6
|
import { createPairCode, pairCodeExpiry, verifyPairCode } from "./pairing.js";
|
|
7
|
-
import { CLOSE_BAD_PAIR_CODE, CLOSE_BAD_PROTOCOL, CLOSE_BAD_TOKEN, CLOSE_NOT_AUTHENTICATED, PROTOCOL_VERSION, appInfoSchema, deviceInfoSchema, eventSchema, appFrameSchema, logEntrySchema, responseSchema, } from "./protocol.js";
|
|
7
|
+
import { CLOSE_BAD_PAIR_CODE, CLOSE_BAD_PROTOCOL, CLOSE_BAD_TOKEN, CLOSE_NOT_AUTHENTICATED, PROTOCOL_VERSION, appInfoSchema, crashEventSchema, deviceInfoSchema, eventSchema, appFrameSchema, logEntrySchema, responseSchema, } from "./protocol.js";
|
|
8
8
|
export const CLOSE_REPLACED = 4010;
|
|
9
9
|
export const CLOSE_SILENT = 4011;
|
|
10
10
|
/**
|
|
@@ -22,6 +22,24 @@ export function viaOf(address) {
|
|
|
22
22
|
return "tailscale";
|
|
23
23
|
return "wifi";
|
|
24
24
|
}
|
|
25
|
+
/** Whether two messages are the same one, when the phone may have cut the longer to fit its storage (`fitRecord`). */
|
|
26
|
+
function sameMessage(a, b) {
|
|
27
|
+
return a === b || a.startsWith(b) || b.startsWith(a) || (a.length >= 200 && b.length >= 200 && a.slice(0, 200) === b.slice(0, 200));
|
|
28
|
+
}
|
|
29
|
+
/** How many crashes are kept per app. */
|
|
30
|
+
const MAX_CRASHES = 20;
|
|
31
|
+
/** Close reasons that mean the app (or this host) ended the connection on purpose. */
|
|
32
|
+
const ORDERLY_REASONS = new Set(["host closed", "replaced by a new connection", "stopped", "host silent", "replaced"]);
|
|
33
|
+
function crashRecordOf(data, source) {
|
|
34
|
+
return {
|
|
35
|
+
ts: data.ts ?? Date.now(),
|
|
36
|
+
name: data.name !== undefined && data.name !== "" ? data.name : "Error",
|
|
37
|
+
message: data.message,
|
|
38
|
+
stack: data.stack ?? "",
|
|
39
|
+
...(data.componentStack !== undefined && data.componentStack !== "" ? { componentStack: data.componentStack } : {}),
|
|
40
|
+
source,
|
|
41
|
+
};
|
|
42
|
+
}
|
|
25
43
|
/** The longest touch another tool may announce (`POST /agent-touch`), in milliseconds. */
|
|
26
44
|
export const MAX_AGENT_TOUCH_MS = 10_000;
|
|
27
45
|
/** Whether a socket's peer is this computer. */
|
|
@@ -96,9 +114,13 @@ function isRecord(value) {
|
|
|
96
114
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
97
115
|
}
|
|
98
116
|
/** Identity of "the same app on the same phone", used to replace stale sessions. */
|
|
99
|
-
|
|
117
|
+
/** How many ended sessions' logs the host keeps. */
|
|
118
|
+
const GONE_LOGS_KEPT = 8;
|
|
119
|
+
export function identityOf(info) {
|
|
100
120
|
const device = info.device.id ?? info.device.name ?? info.device.model ?? "";
|
|
101
|
-
|
|
121
|
+
// An app that sends no id (the default "unknown") is told apart by its name, so two such apps never share crashes.
|
|
122
|
+
const app = info.app.id === "unknown" || info.app.id === "" ? `name:${info.app.name}` : info.app.id;
|
|
123
|
+
return `${app}\u0000${info.device.platform}\u0000${device}`;
|
|
102
124
|
}
|
|
103
125
|
function errorCode(error) {
|
|
104
126
|
if (typeof error !== "object" || error === null || !("code" in error))
|
|
@@ -124,8 +146,16 @@ export class TaplineHost extends EventEmitter {
|
|
|
124
146
|
agentTouchUntil = 0;
|
|
125
147
|
servers = [];
|
|
126
148
|
sessionMap = new Map();
|
|
149
|
+
/** The logs of the last few sessions that ended, so a failure that ended its app still reports that app's lines. */
|
|
150
|
+
goneLogs = new Map();
|
|
127
151
|
selectedId;
|
|
128
152
|
lastDrop;
|
|
153
|
+
/** When this host process started (this computer's clock), to tell a crash from an earlier run. */
|
|
154
|
+
startedAt = Date.now();
|
|
155
|
+
/** Fatal JS errors per app (by `identityOf`), newest last. */
|
|
156
|
+
crashMap = new Map();
|
|
157
|
+
crashLog = [];
|
|
158
|
+
crashSeq = 0;
|
|
129
159
|
httpExtension;
|
|
130
160
|
/** Open after `pair`: development builds on the local network may fetch this code (one use, 10 minutes). */
|
|
131
161
|
devOffer;
|
|
@@ -445,6 +475,70 @@ export class TaplineHost extends EventEmitter {
|
|
|
445
475
|
}
|
|
446
476
|
return session.events.filter((e) => since === undefined || (e.ts ?? 0) > since).map((e) => ({ ...e }));
|
|
447
477
|
}
|
|
478
|
+
/**
|
|
479
|
+
* A session's lines whether it is connected or ended (the last few ended ones are kept), and its app and device
|
|
480
|
+
* identity; undefined when nothing is known of it.
|
|
481
|
+
*/
|
|
482
|
+
sessionRecord(sessionId) {
|
|
483
|
+
const live = this.sessionMap.get(sessionId);
|
|
484
|
+
if (live !== undefined)
|
|
485
|
+
return { identity: identityOf(live.info), events: live.events.map((e) => ({ ...e })) };
|
|
486
|
+
const gone = this.goneLogs.get(sessionId);
|
|
487
|
+
return gone === undefined ? undefined : { identity: gone.identity, events: gone.events.map((e) => ({ ...e })) };
|
|
488
|
+
}
|
|
489
|
+
/** The agent is about to end the app's connection on purpose (a reload): that is no crash. */
|
|
490
|
+
expectEnd(sessionId, expected = true) {
|
|
491
|
+
const session = this.sessionMap.get(sessionId);
|
|
492
|
+
if (session !== undefined)
|
|
493
|
+
session.expectedEnd = expected;
|
|
494
|
+
}
|
|
495
|
+
/** The number of crash events so far; pass it to `crashEventsAfter` later. */
|
|
496
|
+
crashMark() {
|
|
497
|
+
return this.crashSeq;
|
|
498
|
+
}
|
|
499
|
+
/** Crash events after `seq`, oldest first; only those of the app `of` when it is given. */
|
|
500
|
+
crashEventsAfter(seq, of) {
|
|
501
|
+
const key = of !== undefined ? identityOf(of) : undefined;
|
|
502
|
+
return this.crashLog.filter((event) => event.seq > seq && (key === undefined || identityOf(event.of) === key));
|
|
503
|
+
}
|
|
504
|
+
/** The newest crash event of any app, if any is still kept. */
|
|
505
|
+
lastCrashEvent() {
|
|
506
|
+
return this.crashLog[this.crashLog.length - 1];
|
|
507
|
+
}
|
|
508
|
+
/**
|
|
509
|
+
* Fatal JS errors of the app `of` (or of every app when it is undefined), newest first. They outlive the
|
|
510
|
+
* app's sessions, so a crash that ended the session can still be read.
|
|
511
|
+
*/
|
|
512
|
+
crashes(of) {
|
|
513
|
+
const lists = of !== undefined ? [this.crashMap.get(identityOf(of)) ?? []] : [...this.crashMap.values()];
|
|
514
|
+
return lists.flat().sort((a, b) => b.ts - a.ts).map((c) => ({ ...c }));
|
|
515
|
+
}
|
|
516
|
+
recordCrash(session, crash) {
|
|
517
|
+
const key = identityOf(session.info);
|
|
518
|
+
const list = this.crashMap.get(key) ?? [];
|
|
519
|
+
// The same crash arrives twice: live, and again from the phone's storage on the next connection.
|
|
520
|
+
// The phone cuts a saved message to fit its storage, so one may be the start of the other.
|
|
521
|
+
const known = list.find((c) => c.ts === crash.ts && sameMessage(c.message, crash.message));
|
|
522
|
+
if (known !== undefined) {
|
|
523
|
+
if (crash.stack !== "" && crash.source === "saved")
|
|
524
|
+
known.stack = crash.stack;
|
|
525
|
+
if (known.componentStack === undefined && crash.componentStack !== undefined)
|
|
526
|
+
known.componentStack = crash.componentStack;
|
|
527
|
+
return;
|
|
528
|
+
}
|
|
529
|
+
list.push(crash);
|
|
530
|
+
if (list.length > MAX_CRASHES)
|
|
531
|
+
list.splice(0, list.length - MAX_CRASHES);
|
|
532
|
+
this.crashMap.set(key, list);
|
|
533
|
+
this.pushCrashEvent(session, { kind: "crash", crash });
|
|
534
|
+
}
|
|
535
|
+
pushCrashEvent(session, event) {
|
|
536
|
+
this.crashSeq += 1;
|
|
537
|
+
const of = { app: { ...session.info.app }, device: { ...session.info.device } };
|
|
538
|
+
this.crashLog.push({ ...event, app: session.info.app.name, of, seq: this.crashSeq, at: Date.now() });
|
|
539
|
+
if (this.crashLog.length > 50)
|
|
540
|
+
this.crashLog.splice(0, this.crashLog.length - 50);
|
|
541
|
+
}
|
|
448
542
|
describeIds() {
|
|
449
543
|
const ids = [...this.sessionMap.keys()];
|
|
450
544
|
return ids.length === 0 ? "none" : ids.join(", ");
|
|
@@ -539,8 +633,12 @@ export class TaplineHost extends EventEmitter {
|
|
|
539
633
|
}
|
|
540
634
|
this.handleMessage(session, message);
|
|
541
635
|
});
|
|
542
|
-
socket.on("close", (
|
|
636
|
+
socket.on("close", (code, reason) => {
|
|
543
637
|
clearTimeout(helloTimer);
|
|
638
|
+
// A close with a normal code (1000, 1001, or 1005 for a bare close) is the app ending the connection
|
|
639
|
+
// itself (it unpaired, or was stopped); a crash or a lost network closes abnormally (1006).
|
|
640
|
+
if (session !== undefined && (code === 1000 || code === 1001 || code === 1005))
|
|
641
|
+
session.expectedEnd = true;
|
|
544
642
|
if (session !== undefined)
|
|
545
643
|
this.dropSession(session, reason.toString("utf8") || "disconnected");
|
|
546
644
|
});
|
|
@@ -694,21 +792,42 @@ export class TaplineHost extends EventEmitter {
|
|
|
694
792
|
return;
|
|
695
793
|
const at = Date.now();
|
|
696
794
|
session.info.appState = { state, at };
|
|
795
|
+
// Back in front: an earlier fatal error no longer explains a later end.
|
|
796
|
+
if (state === "active")
|
|
797
|
+
session.fatalSeen = false;
|
|
697
798
|
const where = state === "active" ? "came back to the front" : state === "background" ? "went to the background" : `is ${state}`;
|
|
698
799
|
this.pushEntry(session, { level: "info", message: `[tapline] the app ${where}`, ts: at });
|
|
699
800
|
this.safely(() => this.emit("appState", { ...session.info }, state));
|
|
700
801
|
return;
|
|
701
802
|
}
|
|
803
|
+
if (event === "crash") {
|
|
804
|
+
// A fatal error the app kept on the phone and sends after it connects again.
|
|
805
|
+
const saved = crashEventSchema.safeParse(data);
|
|
806
|
+
if (saved.success) {
|
|
807
|
+
this.recordCrash(session, crashRecordOf(saved.data, "saved"));
|
|
808
|
+
// The phone keeps its copy until told it arrived (also when this host already had it).
|
|
809
|
+
const ts = saved.data.ts;
|
|
810
|
+
if (ts !== undefined) {
|
|
811
|
+
this.safely(() => session.socket.send(JSON.stringify({ type: "request", id: session.nextId++, method: "crashAck", params: { ts } })));
|
|
812
|
+
}
|
|
813
|
+
}
|
|
814
|
+
return;
|
|
815
|
+
}
|
|
702
816
|
if (event !== "log" && event !== "error")
|
|
703
817
|
return;
|
|
704
818
|
const parsed = logEntrySchema.safeParse(data);
|
|
705
819
|
if (!parsed.success)
|
|
706
820
|
return;
|
|
821
|
+
const ts = parsed.data.ts ?? Date.now();
|
|
707
822
|
this.pushEntry(session, {
|
|
708
823
|
...parsed.data,
|
|
709
824
|
level: event === "error" ? "error" : (parsed.data.level ?? "log"),
|
|
710
|
-
ts
|
|
825
|
+
ts,
|
|
711
826
|
});
|
|
827
|
+
if (event === "error" && parsed.data.fatal === true) {
|
|
828
|
+
session.fatalSeen = true;
|
|
829
|
+
this.recordCrash(session, crashRecordOf({ ...parsed.data, ts }, "live"));
|
|
830
|
+
}
|
|
712
831
|
}
|
|
713
832
|
pushEntry(session, entry) {
|
|
714
833
|
session.events.push(entry);
|
|
@@ -722,6 +841,13 @@ export class TaplineHost extends EventEmitter {
|
|
|
722
841
|
if (this.sessionMap.get(session.info.id) !== session)
|
|
723
842
|
return;
|
|
724
843
|
this.sessionMap.delete(session.info.id);
|
|
844
|
+
this.goneLogs.set(session.info.id, { identity: identityOf(session.info), events: session.events.map((e) => ({ ...e })) });
|
|
845
|
+
while (this.goneLogs.size > GONE_LOGS_KEPT) {
|
|
846
|
+
const oldest = this.goneLogs.keys().next().value;
|
|
847
|
+
if (oldest === undefined)
|
|
848
|
+
break;
|
|
849
|
+
this.goneLogs.delete(oldest);
|
|
850
|
+
}
|
|
725
851
|
this.lastDrop = {
|
|
726
852
|
session: { ...session.info },
|
|
727
853
|
reason,
|
|
@@ -730,6 +856,20 @@ export class TaplineHost extends EventEmitter {
|
|
|
730
856
|
};
|
|
731
857
|
if (this.selectedId === session.info.id)
|
|
732
858
|
this.selectedId = undefined;
|
|
859
|
+
// An app that went away while a request was in flight, with no JS error to explain it, may have crashed.
|
|
860
|
+
// Not when the agent asked for it (a reload), the app or host ended the connection on purpose, the app had
|
|
861
|
+
// gone to the background (iOS pauses it), or it merely went silent (that is `not_answering`, not a crash).
|
|
862
|
+
const appState = session.info.appState?.state;
|
|
863
|
+
const orderly = session.expectedEnd === true ||
|
|
864
|
+
ORDERLY_REASONS.has(reason) ||
|
|
865
|
+
silentForMs !== undefined ||
|
|
866
|
+
appState === "background" ||
|
|
867
|
+
appState === "inactive";
|
|
868
|
+
// Known gap, left as it is: Fast Refresh and dev-menu reloads close the socket with 1006 in the middle of a
|
|
869
|
+
// call, so a request in flight then is noted as a possible crash. Only `reload` (expectEnd) is told apart.
|
|
870
|
+
if (!orderly && session.fatalSeen !== true && session.pending.size > 0) {
|
|
871
|
+
this.pushCrashEvent(session, { kind: "disconnect" });
|
|
872
|
+
}
|
|
733
873
|
for (const [id, pending] of session.pending) {
|
|
734
874
|
clearTimeout(pending.timer);
|
|
735
875
|
session.pending.delete(id);
|