taskwindow 0.2.12 → 0.2.14
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 +18 -5
- package/package.json +2 -2
- package/src/agents.js +49 -1
- package/src/index.js +2 -1
- package/src/tools.js +15 -1
package/README.md
CHANGED
|
@@ -9,8 +9,8 @@ already signed into — without touching the windows you're working in.
|
|
|
9
9
|
[coding agent] --MCP--> [TaskWindow daemon] --WebSocket--> [Chrome extension] --CDP--> [your tab]
|
|
10
10
|
```
|
|
11
11
|
|
|
12
|
-
Works with Claude Code, Cursor, Windsurf, Codex, or any
|
|
13
|
-
MCP over HTTP.
|
|
12
|
+
Works with Claude Code, Cursor, Windsurf, Codex, OpenCode, OpenClaw, or any
|
|
13
|
+
client that speaks MCP over HTTP.
|
|
14
14
|
|
|
15
15
|
## Setup (5 minutes)
|
|
16
16
|
|
|
@@ -56,8 +56,17 @@ taskwindow install --claude # add Claude Code without repeating setup
|
|
|
56
56
|
taskwindow install --codex # add Codex without repeating setup
|
|
57
57
|
taskwindow install --cursor # add Cursor without repeating setup
|
|
58
58
|
taskwindow install --opencode # add OpenCode without repeating setup
|
|
59
|
+
taskwindow install --openclaw # add OpenClaw without repeating setup
|
|
59
60
|
```
|
|
60
61
|
|
|
62
|
+
The OpenClaw option requires the `openclaw` CLI on PATH and saves the server
|
|
63
|
+
as `mcp.servers.taskwindow` in the config that CLI uses (`OPENCLAW_CONFIG_PATH`
|
|
64
|
+
and `OPENCLAW_STATE_DIR` are respected). A running Gateway picks it up without
|
|
65
|
+
a restart. The Gateway has to run on the same machine as Chrome, since the
|
|
66
|
+
daemon only listens on 127.0.0.1. `openclaw mcp doctor` warns that the
|
|
67
|
+
Authorization header holds a literal token. That is expected: OpenClaw headers
|
|
68
|
+
cannot read a file, and the token only opens the local daemon.
|
|
69
|
+
|
|
61
70
|
The Codex option requires the `codex` CLI on PATH. It configures the shared
|
|
62
71
|
user-level MCP connection; restart Codex after registration to load the tools.
|
|
63
72
|
If you use `CODEX_HOME`, that directory is respected.
|
|
@@ -133,9 +142,13 @@ in the mouse-dynamics literature, so do not build on it as camouflage.
|
|
|
133
142
|
- **Your focus is never taken**: nothing the agent does brings a tab or window
|
|
134
143
|
forward on you. Chrome's `tabs.create` makes a new tab active by default and
|
|
135
144
|
`windows.create` focuses the new window by default; TaskWindow always opens
|
|
136
|
-
tabs in the background
|
|
137
|
-
|
|
138
|
-
|
|
145
|
+
tabs in the background, creates the agent window unfocused, and hands focus
|
|
146
|
+
back if Chrome raises a window anyway. Chrome barely paints a background
|
|
147
|
+
tab, which most pages don't mind; one that fetches or draws only while
|
|
148
|
+
watched stays on a skeleton or an empty chart. For those the agent passes
|
|
149
|
+
`render: true` to `tabs_create`, `navigate` or `reload`, and TaskWindow runs
|
|
150
|
+
a one-frame DevTools screencast on the tab, which Chrome treats as a capture
|
|
151
|
+
and keeps painting at full rate, without activating the tab. A background tab also takes mouse, wheel and
|
|
139
152
|
keyboard input over the DevTools protocol (checked in Chrome: click, scroll
|
|
140
153
|
and type all land in a tab that is not its window's active tab, and it stays
|
|
141
154
|
that way), so nothing ever brings a tab forward. Clicking a group in the
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "taskwindow",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.14",
|
|
4
4
|
"description": "TaskWindow local daemon: bridges the TaskWindow Chrome extension to any MCP client over Streamable HTTP",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.js",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
},
|
|
10
10
|
"scripts": {
|
|
11
11
|
"start": "node src/index.js",
|
|
12
|
-
"test": "node --test test/agents.test.mjs test/pairing.test.mjs test/extension-bootstrap.test.mjs test/extension-connection.test.mjs test/extension-tabs.test.mjs test/extension-responsive.test.mjs test/extension-human.test.mjs test/bridge.test.mjs test/tool-contract.test.mjs test/updates.test.mjs && node test/run.mjs"
|
|
12
|
+
"test": "node --test test/agents.test.mjs test/pairing.test.mjs test/extension-bootstrap.test.mjs test/extension-connection.test.mjs test/extension-idle.test.mjs test/extension-tabs.test.mjs test/extension-responsive.test.mjs test/extension-human.test.mjs test/bridge.test.mjs test/tool-contract.test.mjs test/updates.test.mjs && node test/run.mjs"
|
|
13
13
|
},
|
|
14
14
|
"engines": {
|
|
15
15
|
"node": ">=18"
|
package/src/agents.js
CHANGED
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
* taskwindow install --claude → Claude Code
|
|
4
4
|
* taskwindow install --codex → Codex
|
|
5
5
|
* taskwindow install --cursor → Cursor
|
|
6
|
+
* taskwindow install --opencode → OpenCode
|
|
7
|
+
* taskwindow install --openclaw → OpenClaw
|
|
6
8
|
* Registered only when selected in the installer or explicitly requested.
|
|
7
9
|
*/
|
|
8
10
|
import { homedir } from "node:os";
|
|
@@ -48,7 +50,14 @@ function codexConfigPath(homeDir, codexHome = process.env.CODEX_HOME) {
|
|
|
48
50
|
return join(codexHome || join(homeDir, ".codex"), "config.toml");
|
|
49
51
|
}
|
|
50
52
|
|
|
51
|
-
|
|
53
|
+
// OpenClaw's own resolution, minus profiles: OPENCLAW_CONFIG_PATH wins, else
|
|
54
|
+
// openclaw.json in OPENCLAW_STATE_DIR (default ~/.openclaw).
|
|
55
|
+
function openClawConfigPath(homeDir, env = process.env) {
|
|
56
|
+
if (env.OPENCLAW_CONFIG_PATH?.trim()) return env.OPENCLAW_CONFIG_PATH.trim();
|
|
57
|
+
return join(env.OPENCLAW_STATE_DIR?.trim() || join(homeDir, ".openclaw"), "openclaw.json");
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export function inspectAgents({ homeDir = homedir(), codexHome, hasCommand = commandExists, env = process.env } = {}) {
|
|
52
61
|
const claudePath = join(homeDir, ".claude.json");
|
|
53
62
|
const codexPath = codexConfigPath(homeDir, codexHome);
|
|
54
63
|
const cursorPath = join(homeDir, ".cursor", "mcp.json");
|
|
@@ -56,6 +65,8 @@ export function inspectAgents({ homeDir = homedir(), codexHome, hasCommand = com
|
|
|
56
65
|
const claude = readJson(claudePath);
|
|
57
66
|
const cursor = readJson(cursorPath);
|
|
58
67
|
const openCode = readJson(openCodePath);
|
|
68
|
+
// OpenClaw writes plain JSON; a hand-edited JSON5 file reads as unconfigured.
|
|
69
|
+
const openClaw = readJson(openClawConfigPath(homeDir, env));
|
|
59
70
|
let codex = "";
|
|
60
71
|
try {
|
|
61
72
|
codex = readFileSync(codexPath, "utf8");
|
|
@@ -85,6 +96,12 @@ export function inspectAgents({ homeDir = homedir(), codexHome, hasCommand = com
|
|
|
85
96
|
detected: hasCommand("opencode") || existsSync(join(homeDir, ".config", "opencode")),
|
|
86
97
|
configured: !!openCode.mcp?.taskwindow,
|
|
87
98
|
},
|
|
99
|
+
{
|
|
100
|
+
id: "openclaw",
|
|
101
|
+
label: "OpenClaw",
|
|
102
|
+
detected: hasCommand("openclaw") || existsSync(join(homeDir, ".openclaw")),
|
|
103
|
+
configured: !!openClaw.mcp?.servers?.taskwindow,
|
|
104
|
+
},
|
|
88
105
|
];
|
|
89
106
|
}
|
|
90
107
|
|
|
@@ -192,6 +209,33 @@ export function registerOpenCode({ port, token }) {
|
|
|
192
209
|
console.log(`[taskwindow] registered in OpenCode (${path})`);
|
|
193
210
|
}
|
|
194
211
|
|
|
212
|
+
const OPENCLAW_OPTIONS = { timeout: 60_000, stdio: ["pipe", "pipe", "pipe"], encoding: "utf8" };
|
|
213
|
+
|
|
214
|
+
export function registerOpenClaw({ port, token }, { execFile = execFileSync } = {}) {
|
|
215
|
+
const url = `http://127.0.0.1:${port}/mcp`;
|
|
216
|
+
// Without `transport`, OpenClaw falls back to SSE, which this daemon does not serve.
|
|
217
|
+
const server = { url, transport: "streamable-http", headers: { Authorization: `Bearer ${token}` } };
|
|
218
|
+
try {
|
|
219
|
+
// `config patch` writes while a Gateway runs (newer `mcp set` refuses to)
|
|
220
|
+
// and the Gateway hot-reloads mcp.* changes. stdin keeps the token out of
|
|
221
|
+
// argv; --replace-path drops fields left over from an older entry.
|
|
222
|
+
execFile("openclaw", ["config", "patch", "--stdin", "--replace-path", "mcp.servers.taskwindow"], {
|
|
223
|
+
...OPENCLAW_OPTIONS,
|
|
224
|
+
input: JSON.stringify({ mcp: { servers: { taskwindow: server } } }),
|
|
225
|
+
});
|
|
226
|
+
const saved = JSON.parse(execFile("openclaw", ["mcp", "show", "taskwindow", "--json"], OPENCLAW_OPTIONS));
|
|
227
|
+
if (saved.url !== url || saved.transport !== "streamable-http" ||
|
|
228
|
+
saved.headers?.Authorization !== `Bearer ${token}`) {
|
|
229
|
+
throw new Error("saved server does not match the requested connection");
|
|
230
|
+
}
|
|
231
|
+
} catch (err) {
|
|
232
|
+
// CLI output can include the saved server, credentials and all.
|
|
233
|
+
const reason = err.code === "ENOENT" ? "install the OpenClaw CLI and ensure it is on PATH" : "run openclaw mcp doctor taskwindow";
|
|
234
|
+
throw new Error(`OpenClaw registration failed (${reason})`);
|
|
235
|
+
}
|
|
236
|
+
console.log("[taskwindow] registered in OpenClaw (mcp.servers.taskwindow) — the Gateway picks it up without a restart");
|
|
237
|
+
}
|
|
238
|
+
|
|
195
239
|
export function unregisterAgents({ port }) {
|
|
196
240
|
try {
|
|
197
241
|
execFileSync("claude", ["mcp", "remove", "taskwindow"], { stdio: "ignore" });
|
|
@@ -210,4 +254,8 @@ export function unregisterAgents({ port }) {
|
|
|
210
254
|
console.log("[taskwindow] removed from Cursor");
|
|
211
255
|
}
|
|
212
256
|
} catch {}
|
|
257
|
+
try {
|
|
258
|
+
execFileSync("openclaw", ["config", "unset", "mcp.servers.taskwindow"], { stdio: "ignore", timeout: 60_000 });
|
|
259
|
+
console.log("[taskwindow] removed from OpenClaw");
|
|
260
|
+
} catch {}
|
|
213
261
|
}
|
package/src/index.js
CHANGED
|
@@ -32,7 +32,7 @@ import { UpdateChecker, fetchLatestVersion, isNewer, readUpdateState, updateChec
|
|
|
32
32
|
import { createRequire } from "node:module";
|
|
33
33
|
|
|
34
34
|
const { version: VERSION } = createRequire(import.meta.url)("../package.json");
|
|
35
|
-
import { inspectAgents, registerClaude, registerCodex, registerCursor, registerOpenCode, unregisterAgents } from "./agents.js";
|
|
35
|
+
import { inspectAgents, registerClaude, registerCodex, registerCursor, registerOpenCode, registerOpenClaw, unregisterAgents } from "./agents.js";
|
|
36
36
|
import { clearLine, cursorTo, emitKeypressEvents, moveCursor } from "node:readline";
|
|
37
37
|
|
|
38
38
|
// `taskwindow install` manages the login service and offers to register the
|
|
@@ -47,6 +47,7 @@ const AGENT_CHOICES = [
|
|
|
47
47
|
["codex", "Codex", registerCodex],
|
|
48
48
|
["cursor", "Cursor", registerCursor],
|
|
49
49
|
["opencode", "OpenCode", registerOpenCode],
|
|
50
|
+
["openclaw", "OpenClaw", registerOpenClaw],
|
|
50
51
|
];
|
|
51
52
|
|
|
52
53
|
const AGENT_FLAGS = AGENT_CHOICES.map(([id]) => `--${id}`).join("|");
|
package/src/tools.js
CHANGED
|
@@ -17,6 +17,18 @@ const sessionToken = z
|
|
|
17
17
|
"Session token returned by tabs_create — pass it in every browser tool call so the call acts only on your session's tabs (sessions are isolated from each other). Every result restates it as a trailing \"session: ...\" line, so the latest one is always at hand."
|
|
18
18
|
);
|
|
19
19
|
|
|
20
|
+
// Opt-in: it costs what a visible tab costs, so only when the page needs it.
|
|
21
|
+
const render = z
|
|
22
|
+
.boolean()
|
|
23
|
+
.optional()
|
|
24
|
+
.describe(
|
|
25
|
+
"Keep this tab painting at full rate while it stays in the background, as if someone were watching it. Off by default: a background " +
|
|
26
|
+
"tab paints barely at all, which most pages don't mind. Some only fetch or draw once seen, so turn this on if you suspect the page " +
|
|
27
|
+
"needs a viewer: skeleton placeholders or spinners that never resolve, a chart area that stays empty, an animation stuck mid-way, " +
|
|
28
|
+
"or a screenshot that times out. On a page already showing that, reload with render: true. It stays on for the tab, across " +
|
|
29
|
+
"navigations. The tab is still never made active and never takes focus."
|
|
30
|
+
);
|
|
31
|
+
|
|
20
32
|
// Result contract with the extension: {text?, image?: {data, mimeType}, data?}.
|
|
21
33
|
// The MCP layer turns `image` into an image content block and everything else
|
|
22
34
|
// into text blocks.
|
|
@@ -65,6 +77,7 @@ const rawDefs = [
|
|
|
65
77
|
.string()
|
|
66
78
|
.optional()
|
|
67
79
|
.describe("Your existing session token from an earlier tabs_create, to keep using that session's groups. Omit on your first call — a fresh token is minted and returned."),
|
|
80
|
+
render,
|
|
68
81
|
},
|
|
69
82
|
timeoutMs: 15_000,
|
|
70
83
|
},
|
|
@@ -78,7 +91,7 @@ const rawDefs = [
|
|
|
78
91
|
name: "navigate",
|
|
79
92
|
description:
|
|
80
93
|
"Navigate a tab to a URL. Waits (up to 10s) for the load event, then returns the tab's URL and title.",
|
|
81
|
-
inputSchema: { url: z.string().url(), tabId: tabId.optional() },
|
|
94
|
+
inputSchema: { url: z.string().url(), tabId: tabId.optional(), render },
|
|
82
95
|
timeoutMs: 30_000,
|
|
83
96
|
},
|
|
84
97
|
{
|
|
@@ -89,6 +102,7 @@ const rawDefs = [
|
|
|
89
102
|
inputSchema: {
|
|
90
103
|
tabId: tabId.optional(),
|
|
91
104
|
bypassCache: z.boolean().optional().describe("Skip the HTTP cache, like a hard reload (default false)"),
|
|
105
|
+
render,
|
|
92
106
|
},
|
|
93
107
|
timeoutMs: 30_000,
|
|
94
108
|
},
|