taskwindow 0.2.9 → 0.2.10
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/README.md +4 -4
- package/package.json +1 -1
- package/src/tools.js +36 -12
- package/src/updates.js +7 -0
package/README.md
CHANGED
|
@@ -98,14 +98,14 @@ cursor that teleports onto a button never fires the `mouseenter` a hover menu
|
|
|
98
98
|
opens on. `Input.insertText` fires no key events at all, so a type-ahead search
|
|
99
99
|
box stays empty however right the text looks.
|
|
100
100
|
|
|
101
|
-
|
|
102
|
-
does it: the pointer travels a curved, decelerating path with an overshoot and
|
|
101
|
+
By default every `computer` click, scroll, type and `mouse_move` is performed
|
|
102
|
+
the way a hand does it: the pointer travels a curved, decelerating path with an overshoot and
|
|
103
103
|
a dwell before the press, a scroll becomes several uneven wheel gestures, and
|
|
104
104
|
text is typed as real per-character key events. The coordinates and deltas you
|
|
105
105
|
asked for are exact — the variation is in the journey, never the destination.
|
|
106
106
|
|
|
107
|
-
It costs a few hundred milliseconds per action
|
|
108
|
-
|
|
107
|
+
It costs a few hundred milliseconds per action. Pass `human: false` for one
|
|
108
|
+
instant synthetic event when speed matters more than realism.
|
|
109
109
|
|
|
110
110
|
There is also `action: "idle"`, which drifts the cursor around for a moment
|
|
111
111
|
without clicking anything; give it a `dy` and it also rocks the wheel by that
|
package/package.json
CHANGED
package/src/tools.js
CHANGED
|
@@ -101,11 +101,11 @@ const rawDefs = [
|
|
|
101
101
|
"key (named key press, e.g. Enter, Tab, Escape, ArrowLeft, Backspace), scroll (by dx/dy pixels), " +
|
|
102
102
|
"mouse_move, wait, idle. Screenshots are in CSS pixels (1 image pixel = 1 coordinate unit, on any display density), so " +
|
|
103
103
|
"read x,y straight off the last screenshot. " +
|
|
104
|
-
"
|
|
105
|
-
"
|
|
106
|
-
"
|
|
107
|
-
"
|
|
108
|
-
"
|
|
104
|
+
"Clicks, scrolls, typing and mouse_move are human by default: the pointer moves along a real path, scrolls arrive " +
|
|
105
|
+
"as a real wheel gesture, and text as real per-key events. That is what lazy-loading lists, infinite scroll, " +
|
|
106
|
+
"hover-revealed menus and type-ahead inputs are waiting for — they ignore a single jumbo scroll delta, a teleported " +
|
|
107
|
+
"cursor and insertText. It costs a few hundred ms per action; pass human:false for one instant synthetic event when " +
|
|
108
|
+
"speed matters more than realism. NOTE: while attached, Chrome shows a " +
|
|
109
109
|
'"TaskWindow started debugging this browser" infobar — this is unavoidable with CDP-based control.',
|
|
110
110
|
inputSchema: {
|
|
111
111
|
action: z.enum([
|
|
@@ -127,9 +127,9 @@ const rawDefs = [
|
|
|
127
127
|
),
|
|
128
128
|
human: z
|
|
129
129
|
.boolean()
|
|
130
|
-
.
|
|
130
|
+
.default(true)
|
|
131
131
|
.describe(
|
|
132
|
-
"Perform the action the way a hand would: a curved, decelerating pointer path with overshoot and a dwell before the press; a scroll split into uneven wheel bursts so every intermediate position fires; per-character key events instead of a bulk insert. Default false."
|
|
132
|
+
"Perform the action the way a hand would: a curved, decelerating pointer path with overshoot and a dwell before the press; a scroll split into uneven wheel bursts so every intermediate position fires; per-character key events instead of a bulk insert. Default true; false sends one instant synthetic event."
|
|
133
133
|
),
|
|
134
134
|
targetWidth: z
|
|
135
135
|
.number()
|
|
@@ -137,7 +137,7 @@ const rawDefs = [
|
|
|
137
137
|
.positive()
|
|
138
138
|
.optional()
|
|
139
139
|
.describe(
|
|
140
|
-
"With human
|
|
140
|
+
"With human on (the default), the width in pixels of the thing being clicked. Fitts's Law uses it to pick the approach speed — a wide button is caught first time, a small one is approached carefully. Default 24."
|
|
141
141
|
),
|
|
142
142
|
ms: z.number().int().min(0).max(10_000).optional().describe('Milliseconds for the "wait" action (max 10000)'),
|
|
143
143
|
fullPage: z.boolean().optional().describe('For "screenshot": capture the whole scrollable page instead of the viewport'),
|
|
@@ -328,9 +328,27 @@ const rawDefs = [
|
|
|
328
328
|
* a tab opts out with `noSession`; a tool that declares its own sessionToken
|
|
329
329
|
* (tabs_create's has different semantics) keeps it.
|
|
330
330
|
*/
|
|
331
|
-
const toolDefs = rawDefs.map((def) =>
|
|
332
|
-
def.local || def.noSession ? def : {
|
|
333
|
-
);
|
|
331
|
+
const toolDefs = rawDefs.map((def) => {
|
|
332
|
+
const shape = def.local || def.noSession ? def.inputSchema : { sessionToken, ...def.inputSchema };
|
|
333
|
+
return { ...def, inputSchema: Object.fromEntries(Object.entries(shape).map(([key, field]) => [key, acceptStringScalars(field)])) };
|
|
334
|
+
});
|
|
335
|
+
|
|
336
|
+
/**
|
|
337
|
+
* Models sometimes send a scalar as a string (`human: "true"`, `x: "120"`), and
|
|
338
|
+
* a strict schema fails the whole call over it. Every top-level boolean and
|
|
339
|
+
* number param accepts the unambiguous spellings; anything else still fails.
|
|
340
|
+
*/
|
|
341
|
+
function acceptStringScalars(field) {
|
|
342
|
+
let base = field;
|
|
343
|
+
while (base instanceof z.ZodOptional || base instanceof z.ZodDefault) base = base._def.innerType;
|
|
344
|
+
if (base instanceof z.ZodBoolean) {
|
|
345
|
+
return z.preprocess((v) => (v === "true" ? true : v === "false" ? false : v), field);
|
|
346
|
+
}
|
|
347
|
+
if (base instanceof z.ZodNumber) {
|
|
348
|
+
return z.preprocess((v) => (typeof v === "string" && v.trim() !== "" && Number.isFinite(Number(v)) ? Number(v) : v), field);
|
|
349
|
+
}
|
|
350
|
+
return field;
|
|
351
|
+
}
|
|
334
352
|
|
|
335
353
|
const toolNames = new Set(toolDefs.filter((tool) => !tool.local).map((tool) => tool.name));
|
|
336
354
|
|
|
@@ -481,7 +499,13 @@ async function runBatch({ steps, sessionToken }, bridge, logger) {
|
|
|
481
499
|
}
|
|
482
500
|
try {
|
|
483
501
|
const def = toolDefs.find((d) => d.name === tool);
|
|
484
|
-
|
|
502
|
+
// The same schema a direct call goes through, so a step gets its
|
|
503
|
+
// defaults and coercion too, and bad params fail here, named.
|
|
504
|
+
const parsed = z.object(def.inputSchema).safeParse({ ...params, sessionToken });
|
|
505
|
+
if (!parsed.success) {
|
|
506
|
+
throw new Error(`invalid params: ${parsed.error.issues.map((e) => `${e.message} at ${e.path.join(".") || "(root)"}`).join("; ")}`);
|
|
507
|
+
}
|
|
508
|
+
const result = await bridge.sendTool(tool, parsed.data, def.timeoutMs);
|
|
485
509
|
results.push({ step: i + 1, tool, ok: true, result });
|
|
486
510
|
} catch (err) {
|
|
487
511
|
logger.error(`[mcp] batch step ${i + 1} (${tool}) failed:`, err.message);
|
package/src/updates.js
CHANGED
|
@@ -86,6 +86,13 @@ export function updateNotice({ version, latest, extensionVersion, extensionStore
|
|
|
86
86
|
"Chrome updates it from the Web Store on its own (usually within a day) — no command fixes this, " +
|
|
87
87
|
"though the user can click Update on chrome://extensions."
|
|
88
88
|
);
|
|
89
|
+
} else if (extensionStore && latest && !isNewer(latest, version)) {
|
|
90
|
+
// The store shipped a build whose daemon is not on npm yet: `taskwindow
|
|
91
|
+
// update` would only answer "already up to date".
|
|
92
|
+
notes.push(
|
|
93
|
+
`The TaskWindow Chrome extension is ${extensionVersion} while the daemon is ${version}, ` +
|
|
94
|
+
"and npm had no newer daemon at the last check — nothing to run yet; the matching daemon arrives with the next npm release."
|
|
95
|
+
);
|
|
89
96
|
} else {
|
|
90
97
|
problems.push(`The TaskWindow Chrome extension is ${extensionVersion} while the daemon is ${version}.`);
|
|
91
98
|
}
|