tapline-host 1.4.0 → 1.6.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/accounts.d.ts +72 -0
- package/dist/accounts.js +208 -0
- package/dist/accounts.js.map +1 -0
- package/dist/actionlog.d.ts +20 -0
- package/dist/actionlog.js.map +1 -1
- package/dist/animations.d.ts +39 -0
- package/dist/animations.js +124 -0
- package/dist/animations.js.map +1 -0
- package/dist/api.d.ts +43 -0
- package/dist/api.js +154 -0
- package/dist/api.js.map +1 -0
- package/dist/audit.d.ts +3 -0
- package/dist/audit.js +1 -1
- package/dist/audit.js.map +1 -1
- package/dist/bin.d.ts +2 -0
- package/dist/bin.js +19 -0
- package/dist/bin.js.map +1 -0
- package/dist/brief.d.ts +41 -0
- package/dist/brief.js +78 -0
- package/dist/brief.js.map +1 -0
- package/dist/cli.d.ts +41 -1
- package/dist/cli.js +100 -53
- package/dist/cli.js.map +1 -1
- package/dist/conditions.d.ts +36 -0
- package/dist/conditions.js +67 -0
- package/dist/conditions.js.map +1 -0
- package/dist/confirm.d.ts +21 -2
- package/dist/confirm.js +39 -6
- package/dist/confirm.js.map +1 -1
- package/dist/dispatch.d.ts +27 -0
- package/dist/dispatch.js +114 -0
- package/dist/dispatch.js.map +1 -0
- package/dist/doctor.d.ts +5 -0
- package/dist/doctor.js +20 -0
- package/dist/doctor.js.map +1 -1
- package/dist/drive.d.ts +184 -0
- package/dist/drive.js +908 -0
- package/dist/drive.js.map +1 -0
- package/dist/elicit.d.ts +90 -0
- package/dist/elicit.js +179 -0
- package/dist/elicit.js.map +1 -0
- package/dist/format.d.ts +16 -0
- package/dist/format.js +81 -24
- package/dist/format.js.map +1 -1
- package/dist/images.d.ts +35 -0
- package/dist/images.js +76 -6
- package/dist/images.js.map +1 -1
- package/dist/inspect.d.ts +1 -0
- package/dist/journey.d.ts +276 -0
- package/dist/journey.js +368 -0
- package/dist/journey.js.map +1 -0
- package/dist/journeyexport.d.ts +58 -0
- package/dist/journeyexport.js +318 -0
- package/dist/journeyexport.js.map +1 -0
- package/dist/journeygif.d.ts +62 -0
- package/dist/journeygif.js +192 -0
- package/dist/journeygif.js.map +1 -0
- package/dist/journeyreport.d.ts +202 -0
- package/dist/journeyreport.js +666 -0
- package/dist/journeyreport.js.map +1 -0
- package/dist/mapcmd.d.ts +200 -0
- package/dist/mapcmd.js +412 -0
- package/dist/mapcmd.js.map +1 -0
- package/dist/mapfile.d.ts +155 -0
- package/dist/mapfile.js +575 -0
- package/dist/mapfile.js.map +1 -0
- package/dist/mcp.d.ts +14 -11
- package/dist/mcp.js +50 -318
- package/dist/mcp.js.map +1 -1
- package/dist/media.d.ts +88 -0
- package/dist/media.js +263 -0
- package/dist/media.js.map +1 -0
- package/dist/nochange.d.ts +77 -0
- package/dist/nochange.js +77 -0
- package/dist/nochange.js.map +1 -0
- package/dist/places.d.ts +239 -0
- package/dist/places.js +823 -0
- package/dist/places.js.map +1 -0
- package/dist/policy.d.ts +18 -0
- package/dist/policy.js +52 -0
- package/dist/policy.js.map +1 -1
- package/dist/protocol.d.ts +27 -1
- package/dist/protocol.js +25 -0
- package/dist/protocol.js.map +1 -1
- package/dist/reflexes.d.ts +59 -0
- package/dist/reflexes.js +133 -0
- package/dist/reflexes.js.map +1 -0
- package/dist/report.d.ts +32 -2
- package/dist/report.js +154 -9
- package/dist/report.js.map +1 -1
- package/dist/routes.d.ts +115 -0
- package/dist/routes.js +287 -0
- package/dist/routes.js.map +1 -0
- package/dist/run.d.ts +28 -1
- package/dist/run.js +32 -3
- package/dist/run.js.map +1 -1
- package/dist/runtime.d.ts +60 -0
- package/dist/runtime.js +255 -0
- package/dist/runtime.js.map +1 -0
- package/dist/script.d.ts +114 -10
- package/dist/script.js +30 -2
- package/dist/script.js.map +1 -1
- package/dist/server.d.ts +48 -2
- package/dist/server.js +88 -13
- package/dist/server.js.map +1 -1
- package/dist/thincall.d.ts +13 -0
- package/dist/thincall.js +335 -0
- package/dist/thincall.js.map +1 -0
- package/dist/tool-text-data.d.ts +10 -5
- package/dist/tool-text-data.js +11 -6
- package/dist/tool-text-data.js.map +1 -1
- package/dist/tool-text.d.ts +1 -1
- package/dist/tools.d.ts +585 -5
- package/dist/tools.js +2926 -185
- package/dist/tools.js.map +1 -1
- package/dist/uxcheck.d.ts +103 -0
- package/dist/uxcheck.js +128 -0
- package/dist/uxcheck.js.map +1 -0
- package/package.json +3 -2
- package/skills/tapline/SKILL.md +57 -11
- package/skills/tapline/references/personas.md +45 -0
- package/skills/tapline/references/setup.md +6 -1
package/dist/media.js
ADDED
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
import { randomBytes } from "node:crypto";
|
|
2
|
+
import { readFileSync, statSync } from "node:fs";
|
|
3
|
+
import { basename, resolve } from "node:path";
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
/**
|
|
6
|
+
* `media` (AGENT-TOOLS 1.12 §17.6): test pictures for an app's photo picker. The host reads the pictures from this
|
|
7
|
+
* computer, checks them, and sends them to the app one per request (a request stays well under the protocol's
|
|
8
|
+
* 64 MiB message limit: 10 MB of picture is about 13.4 MB of base64). The app saves them with its own photo-library
|
|
9
|
+
* module. Nothing here reads the phone's photo library.
|
|
10
|
+
*/
|
|
11
|
+
export const MEDIA_MAX_FILES = 10;
|
|
12
|
+
export const MEDIA_MAX_BYTES = 10 * 1024 * 1024;
|
|
13
|
+
/** All the pictures of one call together. */
|
|
14
|
+
export const MEDIA_MAX_TOTAL_BYTES = 20 * 1024 * 1024;
|
|
15
|
+
export const mediaShape = {
|
|
16
|
+
add: z
|
|
17
|
+
.array(z.string().min(1))
|
|
18
|
+
.min(1)
|
|
19
|
+
.max(MEDIA_MAX_FILES)
|
|
20
|
+
.optional()
|
|
21
|
+
.describe(`Paths of pictures on this computer (JPEG or PNG, at most ${MEDIA_MAX_FILES} per call, each at most 10 MB, 20 MB in all)`),
|
|
22
|
+
confirm: z.boolean().optional().describe("true: your user agreed that these pictures may be added to the phone's photo library"),
|
|
23
|
+
remove: z.boolean().optional().describe("true: delete the pictures this session added (iOS asks the person to confirm)"),
|
|
24
|
+
picker: z
|
|
25
|
+
.boolean()
|
|
26
|
+
.optional()
|
|
27
|
+
.describe("Tapline only: the next image pick returns these pictures without the OS picker or the photo library"),
|
|
28
|
+
};
|
|
29
|
+
export const CONFIRM_ERROR = "Error bad_params: media adds to the phone's photo library; ask your user first, then pass confirm: true.";
|
|
30
|
+
function ok(message) {
|
|
31
|
+
return { content: [{ type: "text", text: message }] };
|
|
32
|
+
}
|
|
33
|
+
function fail(message) {
|
|
34
|
+
return { content: [{ type: "text", text: message }], isError: true };
|
|
35
|
+
}
|
|
36
|
+
const PNG_MAGIC = [0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a];
|
|
37
|
+
/** Width and height of a PNG (its header) or a JPEG (its first start-of-frame marker); 0 x 0 when not found. */
|
|
38
|
+
export function pictureSize(bytes, mime) {
|
|
39
|
+
if (mime === "image/png") {
|
|
40
|
+
return bytes.length >= 24 ? { width: bytes.readUInt32BE(16), height: bytes.readUInt32BE(20) } : { width: 0, height: 0 };
|
|
41
|
+
}
|
|
42
|
+
let at = 2;
|
|
43
|
+
while (at + 9 < bytes.length) {
|
|
44
|
+
if (bytes[at] !== 0xff) {
|
|
45
|
+
at += 1;
|
|
46
|
+
continue;
|
|
47
|
+
}
|
|
48
|
+
const marker = bytes[at + 1] ?? 0;
|
|
49
|
+
if (marker === 0xff) {
|
|
50
|
+
at += 1;
|
|
51
|
+
continue;
|
|
52
|
+
}
|
|
53
|
+
const isFrame = marker >= 0xc0 && marker <= 0xcf && marker !== 0xc4 && marker !== 0xc8 && marker !== 0xcc;
|
|
54
|
+
if (isFrame)
|
|
55
|
+
return { width: bytes.readUInt16BE(at + 7), height: bytes.readUInt16BE(at + 5) };
|
|
56
|
+
if (marker === 0xd8 || marker === 0x01 || (marker >= 0xd0 && marker <= 0xd7)) {
|
|
57
|
+
at += 2;
|
|
58
|
+
continue;
|
|
59
|
+
}
|
|
60
|
+
at += 2 + bytes.readUInt16BE(at + 2);
|
|
61
|
+
}
|
|
62
|
+
return { width: 0, height: 0 };
|
|
63
|
+
}
|
|
64
|
+
/** Reads and checks the pictures: they exist, are JPEG or PNG (by content, not name), are at most 10 MB, and at most 10 are given. */
|
|
65
|
+
export function readPictures(paths) {
|
|
66
|
+
if (paths.length === 0)
|
|
67
|
+
return { error: "Error bad_params: add needs at least one picture path." };
|
|
68
|
+
if (paths.length > MEDIA_MAX_FILES) {
|
|
69
|
+
return { error: `Error bad_params: add takes at most ${MEDIA_MAX_FILES} pictures per call (got ${paths.length}).` };
|
|
70
|
+
}
|
|
71
|
+
const files = [];
|
|
72
|
+
let total = 0;
|
|
73
|
+
for (const given of paths) {
|
|
74
|
+
const path = resolve(given);
|
|
75
|
+
let size;
|
|
76
|
+
try {
|
|
77
|
+
const stat = statSync(path);
|
|
78
|
+
if (!stat.isFile())
|
|
79
|
+
return { error: `Error bad_params: ${given} is not a file.` };
|
|
80
|
+
size = stat.size;
|
|
81
|
+
}
|
|
82
|
+
catch {
|
|
83
|
+
return { error: `Error bad_params: ${given} was not found on this computer.` };
|
|
84
|
+
}
|
|
85
|
+
if (size > MEDIA_MAX_BYTES) {
|
|
86
|
+
return { error: `Error bad_params: ${given} is ${(size / (1024 * 1024)).toFixed(1)} MB; each picture may be at most 10 MB.` };
|
|
87
|
+
}
|
|
88
|
+
// The app holds what one call sends in memory: 20 MB in all per call (1.5 review, finding 10).
|
|
89
|
+
total += size;
|
|
90
|
+
if (total > MEDIA_MAX_TOTAL_BYTES) {
|
|
91
|
+
return { error: `Error bad_params: these pictures come to more than ${MEDIA_MAX_TOTAL_BYTES / (1024 * 1024)} MB; send at most 20 MB per call.` };
|
|
92
|
+
}
|
|
93
|
+
const bytes = readFileSync(path);
|
|
94
|
+
const isPng = bytes.length > 8 && PNG_MAGIC.every((b, i) => bytes[i] === b);
|
|
95
|
+
const isJpeg = bytes.length > 3 && bytes[0] === 0xff && bytes[1] === 0xd8 && bytes[2] === 0xff;
|
|
96
|
+
if (!isPng && !isJpeg)
|
|
97
|
+
return { error: `Error bad_params: ${given} is not a JPEG or PNG picture; media takes only those.` };
|
|
98
|
+
const mime = isPng ? "image/png" : "image/jpeg";
|
|
99
|
+
files.push({ name: basename(path), mime, data: bytes.toString("base64"), ...pictureSize(bytes, mime), bytes: bytes.length });
|
|
100
|
+
}
|
|
101
|
+
return { files };
|
|
102
|
+
}
|
|
103
|
+
export const addResultSchema = z.object({ id: z.string().optional(), needsPerson: z.boolean().optional(), late: z.array(z.string()).optional() });
|
|
104
|
+
export const removeResultSchema = z.object({
|
|
105
|
+
removed: z.number(),
|
|
106
|
+
pending: z.boolean().optional(),
|
|
107
|
+
declined: z.boolean().optional(),
|
|
108
|
+
});
|
|
109
|
+
export const pickerResultSchema = z.object({ pictures: z.number() });
|
|
110
|
+
/** What the host remembers per app (by app id), in memory only. */
|
|
111
|
+
export class MediaState {
|
|
112
|
+
/** This host's token on every add and remove: the app deletes only the pictures this host added (one per process). */
|
|
113
|
+
owner = randomBytes(8).toString("hex");
|
|
114
|
+
added = new Map();
|
|
115
|
+
skips = new Map();
|
|
116
|
+
listeners = new Set();
|
|
117
|
+
addedIds(app) {
|
|
118
|
+
return [...(this.added.get(app) ?? [])];
|
|
119
|
+
}
|
|
120
|
+
remember(app, ids) {
|
|
121
|
+
const known = this.added.get(app) ?? [];
|
|
122
|
+
this.added.set(app, [...known, ...ids.filter((id, at) => !known.includes(id) && ids.indexOf(id) === at)]);
|
|
123
|
+
}
|
|
124
|
+
forget(app) {
|
|
125
|
+
this.added.delete(app);
|
|
126
|
+
}
|
|
127
|
+
/** The next photo pick in `app` returns `count` pictures without the OS picker: a journey report marks it "picker skipped". */
|
|
128
|
+
recordPickerSkipped(app, count) {
|
|
129
|
+
this.skips.set(app, (this.skips.get(app) ?? 0) + 1);
|
|
130
|
+
for (const listener of [...this.listeners])
|
|
131
|
+
listener(app, count);
|
|
132
|
+
}
|
|
133
|
+
/** How many times the picker was skipped in `app` since the last `takePickerSkips` (the journey reads and clears it). */
|
|
134
|
+
pickerSkips(app) {
|
|
135
|
+
return this.skips.get(app) ?? 0;
|
|
136
|
+
}
|
|
137
|
+
takePickerSkips(app) {
|
|
138
|
+
const n = this.skips.get(app) ?? 0;
|
|
139
|
+
this.skips.delete(app);
|
|
140
|
+
return n;
|
|
141
|
+
}
|
|
142
|
+
onPickerSkipped(listener) {
|
|
143
|
+
this.listeners.add(listener);
|
|
144
|
+
return () => {
|
|
145
|
+
this.listeners.delete(listener);
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
/** What the dialog says when the photo-access prompt is up (AGENT-TOOLS 1.13 §11.5). */
|
|
150
|
+
const PERSON_ASK = "Needs a person: allow photo access on the phone. I'll go on by myself when the prompt is gone.";
|
|
151
|
+
const PERSON_NOTE = "Note: needs a person: allow photo access on the phone (an OS alert Tapline can't tap).";
|
|
152
|
+
function plural(n, word) {
|
|
153
|
+
return `${n} ${word}${n === 1 ? "" : "s"}`;
|
|
154
|
+
}
|
|
155
|
+
function parseOr(schema, raw) {
|
|
156
|
+
const parsed = schema.safeParse(raw);
|
|
157
|
+
return parsed.success ? parsed.data : null;
|
|
158
|
+
}
|
|
159
|
+
/** The host side of `media`, after the cheap checks. */
|
|
160
|
+
export async function runMedia(args, ctx) {
|
|
161
|
+
// Ids are kept per app install, never per app: another phone with the same app must never be sent them (1.5 review,
|
|
162
|
+
// finding 9). An app that sends no install id gets only what it remembers itself.
|
|
163
|
+
const app = ctx.session.device.id !== undefined && ctx.session.device.id !== "" ? `${ctx.session.app.id}@${ctx.session.device.id}` : null;
|
|
164
|
+
if (!ctx.session.capabilities.includes("media")) {
|
|
165
|
+
return fail("Error unsupported: this app's Tapline is too old for media; update react-native-tapline.");
|
|
166
|
+
}
|
|
167
|
+
if (args.remove === true) {
|
|
168
|
+
const ids = app === null ? [] : ctx.state.addedIds(app);
|
|
169
|
+
let raw;
|
|
170
|
+
try {
|
|
171
|
+
raw = await ctx.request({ op: "remove", ids, owner: ctx.state.owner });
|
|
172
|
+
}
|
|
173
|
+
catch (error) {
|
|
174
|
+
return fail(ctx.describeError(error));
|
|
175
|
+
}
|
|
176
|
+
const result = parseOr(removeResultSchema, raw);
|
|
177
|
+
if (result === null)
|
|
178
|
+
return fail("Error internal: the app returned a media answer the host could not read.");
|
|
179
|
+
if (result.declined === true) {
|
|
180
|
+
return ok("The person declined the delete on the phone; the pictures this session added are still there. Call media with remove: true to ask again.");
|
|
181
|
+
}
|
|
182
|
+
if (app !== null)
|
|
183
|
+
ctx.state.forget(app);
|
|
184
|
+
if (result.removed === 0)
|
|
185
|
+
return ok("Nothing to remove: this session added no pictures.");
|
|
186
|
+
const ios = ctx.session.device.platform === "ios";
|
|
187
|
+
const confirm = ios ? " iOS asks the person to confirm the delete on the phone: ask your user to tap Delete." : "";
|
|
188
|
+
const pending = result.pending === true ? " The delete is still waiting for the person." : "";
|
|
189
|
+
return ok(`Removed ${plural(result.removed, "picture")} this session added.${confirm}${pending}`);
|
|
190
|
+
}
|
|
191
|
+
const read = readPictures(args.add ?? []);
|
|
192
|
+
if ("error" in read)
|
|
193
|
+
return fail(read.error);
|
|
194
|
+
const { files } = read;
|
|
195
|
+
if (args.picker === true) {
|
|
196
|
+
let armed = 0;
|
|
197
|
+
for (const [i, file] of files.entries()) {
|
|
198
|
+
let raw;
|
|
199
|
+
try {
|
|
200
|
+
raw = await ctx.request({ op: "picker", index: i + 1, total: files.length, name: file.name, mime: file.mime, data: file.data, width: file.width, height: file.height });
|
|
201
|
+
}
|
|
202
|
+
catch (error) {
|
|
203
|
+
return fail(ctx.describeError(error));
|
|
204
|
+
}
|
|
205
|
+
armed = parseOr(pickerResultSchema, raw)?.pictures ?? armed;
|
|
206
|
+
}
|
|
207
|
+
// Counted when the app uses the stub (its `pickerSkipped` event), not here: an armed stub may never be used.
|
|
208
|
+
return ok(`The next photo pick returns ${plural(files.length, "picture")} without the OS picker (marked "picker skipped" in a journey report).`);
|
|
209
|
+
}
|
|
210
|
+
const added = [];
|
|
211
|
+
// §11.5: the photo-access prompt asked once through the dialog, then the same picture is tried again.
|
|
212
|
+
let asked = false;
|
|
213
|
+
for (let i = 0; i < files.length; i++) {
|
|
214
|
+
const file = files[i];
|
|
215
|
+
if (file === undefined)
|
|
216
|
+
break;
|
|
217
|
+
let raw;
|
|
218
|
+
try {
|
|
219
|
+
raw = await ctx.request({ op: "add", name: file.name, mime: file.mime, data: file.data, owner: ctx.state.owner });
|
|
220
|
+
}
|
|
221
|
+
catch (error) {
|
|
222
|
+
if (app !== null)
|
|
223
|
+
ctx.state.remember(app, added);
|
|
224
|
+
const left = files.slice(i).map((f) => f.name).join(", ");
|
|
225
|
+
const done = added.length > 0 ? ` ${plural(added.length, "picture")} were added before it; left: ${left}.` : "";
|
|
226
|
+
return fail(`${ctx.describeError(error)}${done}`);
|
|
227
|
+
}
|
|
228
|
+
const result = parseOr(addResultSchema, raw);
|
|
229
|
+
if (result !== null && result.late !== undefined && app !== null)
|
|
230
|
+
ctx.state.remember(app, result.late);
|
|
231
|
+
if (result !== null && (result.needsPerson === true || result.id === undefined) && !asked && ctx.askPerson !== undefined) {
|
|
232
|
+
asked = true;
|
|
233
|
+
// With pictures already added the call is not run again: the person is waited for, then the answer below says
|
|
234
|
+
// which pictures are left, and the agent calls media again with them.
|
|
235
|
+
if ((await ctx.askPerson(PERSON_ASK)) && added.length === 0) {
|
|
236
|
+
i--;
|
|
237
|
+
continue;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
if (result === null) {
|
|
241
|
+
if (app !== null)
|
|
242
|
+
ctx.state.remember(app, added);
|
|
243
|
+
return fail("Error internal: the app returned a media answer the host could not read.");
|
|
244
|
+
}
|
|
245
|
+
// Saves that finished after an earlier needsPerson: kept, so remove: true still finds them after a JS reload.
|
|
246
|
+
if (app !== null && result.late !== undefined)
|
|
247
|
+
ctx.state.remember(app, result.late);
|
|
248
|
+
if (result.needsPerson === true || result.id === undefined) {
|
|
249
|
+
if (app !== null)
|
|
250
|
+
ctx.state.remember(app, added);
|
|
251
|
+
const left = files.length - i;
|
|
252
|
+
return ok([
|
|
253
|
+
`Added ${added.length} of ${files.length} pictures. A person must allow photo access on the phone first (an OS alert); ask your user to tap Allow, then call media again with the ${plural(left, "picture")} left (${files.slice(i).map((f) => f.name).join(", ")}).`,
|
|
254
|
+
PERSON_NOTE,
|
|
255
|
+
].join("\n"));
|
|
256
|
+
}
|
|
257
|
+
added.push(result.id);
|
|
258
|
+
}
|
|
259
|
+
if (app !== null)
|
|
260
|
+
ctx.state.remember(app, added);
|
|
261
|
+
return ok(`Added ${plural(added.length, "picture")} to the phone's photo library (${files.map((f) => f.name).join(", ")}); they show in the picker as Recently Added. Call media with remove: true to delete them afterwards.`);
|
|
262
|
+
}
|
|
263
|
+
//# sourceMappingURL=media.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"media.js","sourceRoot":"","sources":["../src/media.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAE9C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,eAAe,GAAG,EAAE,CAAC;AAClC,MAAM,CAAC,MAAM,eAAe,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC;AAChD,6CAA6C;AAC7C,MAAM,CAAC,MAAM,qBAAqB,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC;AAEtD,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,GAAG,EAAE,CAAC;SACH,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,C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SAAS,CAAC,kCAAkC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,uGAAuG,CACrN,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { type TreeElement } from "./protocol.js";
|
|
3
|
+
/** The shortest time the screen is watched before saying a touch changed nothing (Tapline's floor, §3). */
|
|
4
|
+
export declare const NO_CHANGE_WATCH_MS = 500;
|
|
5
|
+
/** The action's name in the note, from one map (lead's answer 7): `the tap`, `the long press`, `the double tap`. */
|
|
6
|
+
export declare const ACTION_NAMES: {
|
|
7
|
+
readonly tap: "tap";
|
|
8
|
+
readonly long_press: "long press";
|
|
9
|
+
readonly double_tap: "double tap";
|
|
10
|
+
};
|
|
11
|
+
export type NoChangeAction = keyof typeof ACTION_NAMES;
|
|
12
|
+
/** The handler a touch calls, for the clause: a tap calls onPress, a long press onLongPress. */
|
|
13
|
+
export declare const HANDLER_NAMES: Record<NoChangeAction, string>;
|
|
14
|
+
/** What the app says of the touch (`press` and `longPress` results, capability `pressFacts`). */
|
|
15
|
+
export declare const pressFactsSchema: z.ZodObject<{
|
|
16
|
+
handler: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
17
|
+
kind: z.ZodLiteral<"own">;
|
|
18
|
+
threw: z.ZodOptional<z.ZodString>;
|
|
19
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
20
|
+
kind: z.ZodLiteral<"parent">;
|
|
21
|
+
element: z.ZodObject<{
|
|
22
|
+
ref: z.ZodString;
|
|
23
|
+
type: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
24
|
+
role: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
25
|
+
testID: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
26
|
+
label: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
27
|
+
text: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
28
|
+
textMore: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
29
|
+
value: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
|
|
30
|
+
placeholder: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
31
|
+
frame: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
32
|
+
x: z.ZodNumber;
|
|
33
|
+
y: z.ZodNumber;
|
|
34
|
+
width: z.ZodNumber;
|
|
35
|
+
height: z.ZodNumber;
|
|
36
|
+
}, z.core.$strip>>>;
|
|
37
|
+
actions: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
|
|
38
|
+
disabled: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
39
|
+
selected: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
40
|
+
checked: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodBoolean, z.ZodString]>>>;
|
|
41
|
+
row: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
42
|
+
}, z.core.$strip>;
|
|
43
|
+
threw: z.ZodOptional<z.ZodString>;
|
|
44
|
+
}, z.core.$strip>]>>;
|
|
45
|
+
startedRequests: z.ZodOptional<z.ZodNumber>;
|
|
46
|
+
}, z.core.$strip>;
|
|
47
|
+
export type PressFacts = z.infer<typeof pressFactsSchema>;
|
|
48
|
+
/** The facts from a result, or an empty set when the app sent none or sent something unreadable. */
|
|
49
|
+
export declare function readPressFacts(result: unknown): PressFacts;
|
|
50
|
+
/** A message for the answer: control characters (and line breaks) gone, cut to 120 characters. */
|
|
51
|
+
export declare function cleanMessage(message: string): string;
|
|
52
|
+
/** `Note: the tap was delivered, and nothing on screen changed within 0.5 s.` `seconds` is the time watched. */
|
|
53
|
+
export declare function noChangeNote(action: NoChangeAction, seconds: number): string;
|
|
54
|
+
/**
|
|
55
|
+
* The one clause after the note, in this order: the handler threw, a parent took the touch, a request it
|
|
56
|
+
* started is still running, else the handler ran and returned. Without the app's facts only the request
|
|
57
|
+
* can be said (from the `Network:` line); otherwise there is no clause.
|
|
58
|
+
*/
|
|
59
|
+
export declare function noChangeClause(action: NoChangeAction, facts: PressFacts | null, requestRunning: boolean, nameOf: (element: TreeElement) => string): string | null;
|
|
60
|
+
/** What a handler that threw is said to be, in every answer: `its onPress threw: <message> (see logs).` Null when it didn't. */
|
|
61
|
+
export declare function threwText(action: NoChangeAction, facts: PressFacts): string | null;
|
|
62
|
+
/** Whether an answer's text says the screen didn't change (a change block with only that line). */
|
|
63
|
+
export declare function saysNoVisibleChange(answer: string): boolean;
|
|
64
|
+
/** Whether the answer's header says requests are still running. */
|
|
65
|
+
export declare function saysRequestsRunning(answer: string): boolean;
|
|
66
|
+
/** What the app says of a double tap's second tap (`threw`: the handler threw on it, so the tap did land). */
|
|
67
|
+
export type SecondTap = {
|
|
68
|
+
done: true;
|
|
69
|
+
afterMs: number;
|
|
70
|
+
threw?: string | undefined;
|
|
71
|
+
} | {
|
|
72
|
+
done: false;
|
|
73
|
+
reason: string;
|
|
74
|
+
afterMs: number;
|
|
75
|
+
};
|
|
76
|
+
/** The sentence for a double tap's second tap: it went through, it reached the handler and threw, or it didn't land. */
|
|
77
|
+
export declare function secondTapSentence(second: SecondTap): string;
|
package/dist/nochange.js
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { elementSchema } from "./protocol.js";
|
|
3
|
+
// "A tap that changes nothing" (AGENT-TOOLS 1.13 §3): the note after `No visible change.` and its one clause.
|
|
4
|
+
/** The shortest time the screen is watched before saying a touch changed nothing (Tapline's floor, §3). */
|
|
5
|
+
export const NO_CHANGE_WATCH_MS = 500;
|
|
6
|
+
/** The action's name in the note, from one map (lead's answer 7): `the tap`, `the long press`, `the double tap`. */
|
|
7
|
+
export const ACTION_NAMES = { tap: "tap", long_press: "long press", double_tap: "double tap" };
|
|
8
|
+
/** The handler a touch calls, for the clause: a tap calls onPress, a long press onLongPress. */
|
|
9
|
+
export const HANDLER_NAMES = { tap: "onPress", long_press: "onLongPress", double_tap: "onPress" };
|
|
10
|
+
/** What the app says of the touch (`press` and `longPress` results, capability `pressFacts`). */
|
|
11
|
+
export const pressFactsSchema = z.object({
|
|
12
|
+
handler: z
|
|
13
|
+
.union([
|
|
14
|
+
z.object({ kind: z.literal("own"), threw: z.string().optional() }),
|
|
15
|
+
z.object({ kind: z.literal("parent"), element: elementSchema, threw: z.string().optional() }),
|
|
16
|
+
])
|
|
17
|
+
.optional(),
|
|
18
|
+
startedRequests: z.number().optional(),
|
|
19
|
+
});
|
|
20
|
+
/** The facts from a result, or an empty set when the app sent none or sent something unreadable. */
|
|
21
|
+
export function readPressFacts(result) {
|
|
22
|
+
const parsed = pressFactsSchema.safeParse(result);
|
|
23
|
+
return parsed.success ? parsed.data : {};
|
|
24
|
+
}
|
|
25
|
+
/** A message for the answer: control characters (and line breaks) gone, cut to 120 characters. */
|
|
26
|
+
export function cleanMessage(message) {
|
|
27
|
+
// eslint-disable-next-line no-control-regex
|
|
28
|
+
const flat = message.replace(/[\u0000-\u001f\u007f-\u009f]+/g, " ").replace(/\s+/g, " ").trim();
|
|
29
|
+
return flat.length > 120 ? `${flat.slice(0, 119)}…` : flat;
|
|
30
|
+
}
|
|
31
|
+
/** `Note: the tap was delivered, and nothing on screen changed within 0.5 s.` `seconds` is the time watched. */
|
|
32
|
+
export function noChangeNote(action, seconds) {
|
|
33
|
+
return `Note: the ${ACTION_NAMES[action]} was delivered, and nothing on screen changed within ${Math.max(0.5, seconds).toFixed(1)} s.`;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* The one clause after the note, in this order: the handler threw, a parent took the touch, a request it
|
|
37
|
+
* started is still running, else the handler ran and returned. Without the app's facts only the request
|
|
38
|
+
* can be said (from the `Network:` line); otherwise there is no clause.
|
|
39
|
+
*/
|
|
40
|
+
export function noChangeClause(action, facts, requestRunning, nameOf) {
|
|
41
|
+
if (facts === null)
|
|
42
|
+
return requestRunning ? "A request is still running: wait_for network_idle." : null;
|
|
43
|
+
const handler = facts.handler;
|
|
44
|
+
if (handler === undefined)
|
|
45
|
+
return requestRunning ? "A request is still running: wait_for network_idle." : null;
|
|
46
|
+
const name = HANDLER_NAMES[action];
|
|
47
|
+
if (handler.threw !== undefined)
|
|
48
|
+
return `Its ${name} threw: ${cleanMessage(handler.threw)} (see logs).`;
|
|
49
|
+
if (handler.kind === "parent")
|
|
50
|
+
return `It has no handler of its own; ${nameOf(handler.element)} took it.`;
|
|
51
|
+
if (requestRunning && (facts.startedRequests ?? 0) > 0)
|
|
52
|
+
return "It started a request that is still running: wait_for network_idle.";
|
|
53
|
+
return `Its ${name} ran and returned.`;
|
|
54
|
+
}
|
|
55
|
+
/** What a handler that threw is said to be, in every answer: `its onPress threw: <message> (see logs).` Null when it didn't. */
|
|
56
|
+
export function threwText(action, facts) {
|
|
57
|
+
const threw = facts.handler?.threw;
|
|
58
|
+
return threw === undefined ? null : `its ${HANDLER_NAMES[action]} threw: ${cleanMessage(threw)} (see logs).`;
|
|
59
|
+
}
|
|
60
|
+
/** Whether an answer's text says the screen didn't change (a change block with only that line). */
|
|
61
|
+
export function saysNoVisibleChange(answer) {
|
|
62
|
+
return /^Same screen\. Changes:\n(?:[^\n]*\n)*?No visible change\.$/m.test(answer) || /^No visible change\.$/m.test(answer);
|
|
63
|
+
}
|
|
64
|
+
/** Whether the answer's header says requests are still running. */
|
|
65
|
+
export function saysRequestsRunning(answer) {
|
|
66
|
+
return /^Network: \d+ requests? in flight$/m.test(answer);
|
|
67
|
+
}
|
|
68
|
+
/** The sentence for a double tap's second tap: it went through, it reached the handler and threw, or it didn't land. */
|
|
69
|
+
export function secondTapSentence(second) {
|
|
70
|
+
if (!second.done)
|
|
71
|
+
return `The first tap went through; the second, ${second.afterMs} ms later, didn't land (${second.reason}).`;
|
|
72
|
+
if (second.threw !== undefined) {
|
|
73
|
+
return `The first tap went through; the second, ${second.afterMs} ms later, reached the handler, but the handler threw: ${cleanMessage(second.threw)}`;
|
|
74
|
+
}
|
|
75
|
+
return `Both taps went through, ${second.afterMs} ms apart.`;
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=nochange.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nochange.js","sourceRoot":"","sources":["../src/nochange.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,aAAa,EAAoB,MAAM,eAAe,CAAC;AAEhE,8GAA8G;AAE9G,2GAA2G;AAC3G,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAAG,CAAC;AAEtC,oHAAoH;AACpH,MAAM,CAAC,MAAM,YAAY,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,UAAU,EAAE,YAAY,EAAW,CAAC;AAGxG,gGAAgG;AAChG,MAAM,CAAC,MAAM,aAAa,GAAmC,EAAE,GAAG,EAAE,SAAS,EAAE,UAAU,EAAE,aAAa,EAAE,UAAU,EAAE,SAAS,EAAE,CAAC;AAElI,iGAAiG;AACjG,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IACvC,OAAO,EAAE,CAAC;SACP,KAAK,CAAC;QACL,CAAC,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC;QAClE,CAAC,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC;KAC9F,CAAC;SACD,QAAQ,EAAE;IACb,eAAe,EAAE,CAAC,CAAC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