taskwindow 0.1.0 → 0.1.2
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/LICENSE +21 -0
- package/README.md +117 -0
- package/package.json +1 -1
- package/src/agents.js +60 -0
- package/src/index.js +34 -4
- package/src/service.js +99 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Clawnify
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
# TaskWindow
|
|
2
|
+
|
|
3
|
+
Let any coding agent drive your real, logged-in Chrome — the tabs you're
|
|
4
|
+
already signed into — without touching the windows you're working in.
|
|
5
|
+
|
|
6
|
+
```
|
|
7
|
+
[coding agent] --MCP--> [TaskWindow daemon] --WebSocket--> [Chrome extension] --CDP--> [your tab]
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
Works with Claude Code, Cursor, Windsurf, Codex, or any client that speaks
|
|
11
|
+
MCP over HTTP.
|
|
12
|
+
|
|
13
|
+
## Setup (5 minutes)
|
|
14
|
+
|
|
15
|
+
### 1. Start the daemon
|
|
16
|
+
|
|
17
|
+
Requires Node 18+.
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npx taskwindow
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
You'll see:
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
[taskwindow] daemon listening on http://127.0.0.1:9377
|
|
27
|
+
[taskwindow] pairing code: A6LU5X — enter it in the TaskWindow extension options
|
|
28
|
+
[taskwindow] claude code: claude mcp add taskwindow --transport http http://127.0.0.1:9377/mcp --header "Authorization: Bearer …"
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
The daemon is what your agent talks to, so it needs to stay running.
|
|
32
|
+
To make it survive laptop restarts (installs a login service):
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
npm install -g taskwindow
|
|
36
|
+
taskwindow install
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Or just keep `npx taskwindow` running in a terminal — both work.
|
|
40
|
+
|
|
41
|
+
### 2. Install the Chrome extension
|
|
42
|
+
|
|
43
|
+
1. Download `TaskWindow-extension-*.zip` from the
|
|
44
|
+
[latest release](https://github.com/clawnify/taskwindow/releases) and unzip it
|
|
45
|
+
2. Open `chrome://extensions`
|
|
46
|
+
3. Enable **Developer mode** (top right)
|
|
47
|
+
4. Click **Load unpacked** and select the unzipped folder
|
|
48
|
+
5. Click the TaskWindow icon in the toolbar
|
|
49
|
+
|
|
50
|
+
### 3. Pair the extension with the daemon
|
|
51
|
+
|
|
52
|
+
1. Click the TaskWindow toolbar icon → **Settings**
|
|
53
|
+
2. Type the 6-character pairing code from step 1 → **Pair**
|
|
54
|
+
3. The dot turns green: connected ✓
|
|
55
|
+
|
|
56
|
+
(Manual token paste also works — `~/.taskwindow/token`.)
|
|
57
|
+
|
|
58
|
+
### 4. Connect your coding agent (one agent at a time, only when you ask)
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
taskwindow install --claude # Claude Code
|
|
62
|
+
taskwindow install --cursor # Cursor
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Nothing is registered for agents you don't name. For anything else, the
|
|
66
|
+
config is an HTTP MCP server at `http://127.0.0.1:9377/mcp` with header
|
|
67
|
+
`Authorization: Bearer <token>` (the token is in `~/.taskwindow/token`).
|
|
68
|
+
|
|
69
|
+
### 5. Try it
|
|
70
|
+
|
|
71
|
+
Ask your agent: *"Open example.com in a new tab and take a screenshot."*
|
|
72
|
+
|
|
73
|
+
A green tab group named after your task appears in its own window — that's
|
|
74
|
+
the agent's workspace. Screenshot done. Now try:
|
|
75
|
+
*"Find the sign-up link and read the page's headings."*
|
|
76
|
+
|
|
77
|
+
## What the agent gets
|
|
78
|
+
|
|
79
|
+
| Area | Tools |
|
|
80
|
+
|---|---|
|
|
81
|
+
| Tabs | `tabs_list`, `tabs_create`, `tabs_close`, `navigate` |
|
|
82
|
+
| See | `computer` (screenshot + click/type/key/scroll), `read_page`, `find`, `get_page_text` |
|
|
83
|
+
| Act | `form_input`, `file_upload`, `upload_image`, `javascript_execute` |
|
|
84
|
+
| Debug | `read_console_messages`, `read_network_requests` |
|
|
85
|
+
| Efficiency | `browser_batch` (multi-step in one call), `gif_record`, `set_viewport` (responsive view), `shortcuts_*` |
|
|
86
|
+
|
|
87
|
+
## How the isolation works
|
|
88
|
+
|
|
89
|
+
- **Task groups**: every tab the agent creates goes into a green tab group
|
|
90
|
+
named after the task, in the agent's own window. By default the agent can
|
|
91
|
+
only see and act on tabs in its own groups — never yours. You can click a
|
|
92
|
+
group in the toolbar popover to watch, and the user can widen access in
|
|
93
|
+
settings.
|
|
94
|
+
- **Pairing**: the daemon listens on 127.0.0.1 only; the extension pairs with
|
|
95
|
+
a 6-character code printed at daemon start. MCP requests require a bearer
|
|
96
|
+
token.
|
|
97
|
+
- **Agent actions are visible**: a phantom cursor and glow show where the
|
|
98
|
+
agent is acting; while it does, Chrome shows a
|
|
99
|
+
*"started debugging this browser"* infobar — an unavoidable Chrome policy
|
|
100
|
+
for this capability, same as Claude's own extension.
|
|
101
|
+
|
|
102
|
+
## Requirements & limits
|
|
103
|
+
|
|
104
|
+
- Chrome/Chromium 116+ (Chrome, Edge, Brave, Arc…)
|
|
105
|
+
- Node 18+ for the daemon
|
|
106
|
+
- Page tools run in the top frame; native `alert()`/`confirm()` dialogs block
|
|
107
|
+
the attached tab
|
|
108
|
+
|
|
109
|
+
## Development
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
git clone https://github.com/clawnify/taskwindow
|
|
113
|
+
cd taskwindow/daemon && npm install && npm test
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
The test suite boots the daemon with a fake extension and runs a real MCP
|
|
117
|
+
client against it (auth, dispatch, batching, error paths).
|
package/package.json
CHANGED
package/src/agents.js
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Optional per-agent MCP registration, always explicit:
|
|
3
|
+
* taskwindow install --claude → Claude Code
|
|
4
|
+
* taskwindow install --cursor → Cursor
|
|
5
|
+
* Nothing is registered unless the matching flag is given.
|
|
6
|
+
*/
|
|
7
|
+
import { homedir } from "node:os";
|
|
8
|
+
import { join, dirname } from "node:path";
|
|
9
|
+
import { readFileSync, writeFileSync, mkdirSync } from "node:fs";
|
|
10
|
+
import { execFileSync } from "node:child_process";
|
|
11
|
+
|
|
12
|
+
export function registerClaude({ port, token }) {
|
|
13
|
+
try {
|
|
14
|
+
// Replace an older registration, if any.
|
|
15
|
+
execFileSync("claude", ["mcp", "remove", "taskwindow"], { stdio: "ignore" });
|
|
16
|
+
} catch {}
|
|
17
|
+
execFileSync(
|
|
18
|
+
"claude",
|
|
19
|
+
[
|
|
20
|
+
"mcp", "add", "taskwindow",
|
|
21
|
+
"--transport", "http",
|
|
22
|
+
`http://127.0.0.1:${port}/mcp`,
|
|
23
|
+
"--header", `Authorization: Bearer ${token}`,
|
|
24
|
+
],
|
|
25
|
+
{ stdio: "inherit" }
|
|
26
|
+
);
|
|
27
|
+
console.log("[taskwindow] registered in Claude Code — verify with: claude mcp list");
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export function registerCursor({ port, token }) {
|
|
31
|
+
const path = join(homedir(), ".cursor", "mcp.json");
|
|
32
|
+
let cfg = {};
|
|
33
|
+
try {
|
|
34
|
+
cfg = JSON.parse(readFileSync(path, "utf8"));
|
|
35
|
+
} catch {}
|
|
36
|
+
cfg.mcpServers = cfg.mcpServers || {};
|
|
37
|
+
cfg.mcpServers.taskwindow = {
|
|
38
|
+
url: `http://127.0.0.1:${port}/mcp`,
|
|
39
|
+
headers: { Authorization: `Bearer ${token}` },
|
|
40
|
+
};
|
|
41
|
+
mkdirSync(dirname(path), { recursive: true });
|
|
42
|
+
writeFileSync(path, JSON.stringify(cfg, null, 2) + "\n");
|
|
43
|
+
console.log(`[taskwindow] registered in Cursor (${path})`);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export function unregisterAgents({ port }) {
|
|
47
|
+
try {
|
|
48
|
+
execFileSync("claude", ["mcp", "remove", "taskwindow"], { stdio: "ignore" });
|
|
49
|
+
console.log("[taskwindow] removed from Claude Code");
|
|
50
|
+
} catch {}
|
|
51
|
+
try {
|
|
52
|
+
const path = join(homedir(), ".cursor", "mcp.json");
|
|
53
|
+
const cfg = JSON.parse(readFileSync(path, "utf8"));
|
|
54
|
+
if (cfg.mcpServers?.taskwindow) {
|
|
55
|
+
delete cfg.mcpServers.taskwindow;
|
|
56
|
+
writeFileSync(path, JSON.stringify(cfg, null, 2) + "\n");
|
|
57
|
+
console.log("[taskwindow] removed from Cursor");
|
|
58
|
+
}
|
|
59
|
+
} catch {}
|
|
60
|
+
}
|
package/src/index.js
CHANGED
|
@@ -1,22 +1,50 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import http from "node:http";
|
|
3
3
|
import { randomBytes } from "node:crypto";
|
|
4
|
+
import { fileURLToPath } from "node:url";
|
|
4
5
|
import { loadConfig } from "./config.js";
|
|
5
6
|
import { Bridge } from "./bridge.js";
|
|
6
7
|
import { createMcpRequestHandler } from "./mcp-http.js";
|
|
8
|
+
import { installService, uninstallService } from "./service.js";
|
|
9
|
+
import { registerClaude, registerCursor, unregisterAgents } from "./agents.js";
|
|
10
|
+
|
|
11
|
+
// `taskwindow install` manages the login service and — only with an explicit
|
|
12
|
+
// per-agent flag — registers the MCP server in that agent.
|
|
13
|
+
const args = process.argv.slice(2);
|
|
14
|
+
const verb = args[0];
|
|
15
|
+
const flags = args.slice(1);
|
|
16
|
+
|
|
17
|
+
if (verb === "install") {
|
|
18
|
+
const config = loadConfig();
|
|
19
|
+
if (!flags.includes("--no-service")) {
|
|
20
|
+
installService(fileURLToPath(new URL("./index.js", import.meta.url)));
|
|
21
|
+
}
|
|
22
|
+
if (flags.includes("--claude")) registerClaude(config);
|
|
23
|
+
if (flags.includes("--cursor")) registerCursor(config);
|
|
24
|
+
if (flags.includes("--claude") || flags.includes("--cursor")) {
|
|
25
|
+
console.log(`[taskwindow] pairing code (if the extension asks): ${pairCode ?? "restart the daemon to see it"}`);
|
|
26
|
+
}
|
|
27
|
+
process.exit(0);
|
|
28
|
+
}
|
|
29
|
+
if (verb === "uninstall") {
|
|
30
|
+
if (!flags.includes("--keep-agents")) unregisterAgents({ port: 9377 });
|
|
31
|
+
if (!flags.includes("--no-service")) uninstallService();
|
|
32
|
+
process.exit(0);
|
|
33
|
+
}
|
|
7
34
|
|
|
8
35
|
const config = loadConfig();
|
|
9
36
|
const bridge = new Bridge({ token: config.token });
|
|
37
|
+
|
|
38
|
+
const PAIR_ALPHABET = "ABCDEFGHJKLMNPQRSTUVWXYZ23456789"; // no 0/O/1/I
|
|
39
|
+
const pairCode = Array.from(randomBytes(6))
|
|
40
|
+
.map((b) => PAIR_ALPHABET[b % PAIR_ALPHABET.length])
|
|
41
|
+
.join("");
|
|
10
42
|
const handleMcp = createMcpRequestHandler({ bridge });
|
|
11
43
|
|
|
12
44
|
// One-time pairing: the daemon prints a short code at startup; the extension
|
|
13
45
|
// exchanges it for the real token via POST /pair (loopback-only). This defends
|
|
14
46
|
// the pairing endpoint against other local user accounts; a same-user process
|
|
15
47
|
// could read the token file directly, so the code adds no obstacle there.
|
|
16
|
-
const PAIR_ALPHABET = "ABCDEFGHJKLMNPQRSTUVWXYZ23456789"; // no 0/O/1/I
|
|
17
|
-
const pairCode = Array.from(randomBytes(6))
|
|
18
|
-
.map((b) => PAIR_ALPHABET[b % PAIR_ALPHABET.length])
|
|
19
|
-
.join("");
|
|
20
48
|
const pairFailures = []; // timestamps of failed attempts, rolling window
|
|
21
49
|
const PAIR_WINDOW_MS = 60_000;
|
|
22
50
|
const PAIR_MAX_FAILURES = 5;
|
|
@@ -139,6 +167,8 @@ server.listen(config.port, "127.0.0.1", () => {
|
|
|
139
167
|
console.log(`[taskwindow] daemon listening on http://127.0.0.1:${config.port}`);
|
|
140
168
|
console.log(`[taskwindow] MCP endpoint: http://127.0.0.1:${config.port}/mcp`);
|
|
141
169
|
console.log(`[taskwindow] pairing code: ${pairCode} — enter it in the TaskWindow extension options to connect (valid while this daemon runs)`);
|
|
170
|
+
console.log(`[taskwindow] your MCP client config: endpoint http://127.0.0.1:${config.port}/mcp, header "Authorization: Bearer ${config.token}"`);
|
|
171
|
+
console.log(`[taskwindow] register an agent with: taskwindow install --claude (or --cursor)`);
|
|
142
172
|
console.log(`[taskwindow] waiting for the TaskWindow extension to connect on ws://127.0.0.1:${config.port}/ws`);
|
|
143
173
|
});
|
|
144
174
|
|
package/src/service.js
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Login-service installer: keeps the daemon running across restarts without a
|
|
3
|
+
* terminal. macOS uses launchd; Linux uses a systemd user unit; anything else
|
|
4
|
+
* gets manual instructions.
|
|
5
|
+
*/
|
|
6
|
+
import { homedir, platform } from "node:os";
|
|
7
|
+
import { join } from "node:path";
|
|
8
|
+
import { writeFileSync, unlinkSync, mkdirSync } from "node:fs";
|
|
9
|
+
import { execSync } from "node:child_process";
|
|
10
|
+
|
|
11
|
+
const LABEL = "com.clawnify.taskwindow";
|
|
12
|
+
|
|
13
|
+
function nodePath() {
|
|
14
|
+
return process.execPath;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function installService(daemonEntryPath, port) {
|
|
18
|
+
const system = platform();
|
|
19
|
+
const logPath = join(homedir(), ".taskwindow", "daemon.log");
|
|
20
|
+
mkdirSync(join(homedir(), ".taskwindow"), { recursive: true });
|
|
21
|
+
|
|
22
|
+
if (system === "darwin") {
|
|
23
|
+
const plistPath = join(homedir(), "Library", "LaunchAgents", `${LABEL}.plist`);
|
|
24
|
+
const plist = `<?xml version="1.0" encoding="UTF-8"?>
|
|
25
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
26
|
+
<plist version="1.0">
|
|
27
|
+
<dict>
|
|
28
|
+
<key>Label</key><string>${LABEL}</string>
|
|
29
|
+
<key>ProgramArguments</key>
|
|
30
|
+
<array>
|
|
31
|
+
<string>${nodePath()}</string>
|
|
32
|
+
<string>${daemonEntryPath}</string>
|
|
33
|
+
</array>
|
|
34
|
+
<key>RunAtLoad</key><true/>
|
|
35
|
+
<key>KeepAlive</key><true/>
|
|
36
|
+
<key>StandardOutPath</key><string>${logPath}</string>
|
|
37
|
+
<key>StandardErrorPath</key><string>${logPath}</string>
|
|
38
|
+
</dict>
|
|
39
|
+
</plist>
|
|
40
|
+
`;
|
|
41
|
+
writeFileSync(plistPath, plist);
|
|
42
|
+
const uid = process.getuid?.() ?? 501;
|
|
43
|
+
try {
|
|
44
|
+
execSync(`launchctl bootout gui/${uid}/${LABEL} 2>/dev/null`, { shell: "/bin/bash" });
|
|
45
|
+
} catch {}
|
|
46
|
+
execSync(`launchctl bootstrap gui/${uid} "${plistPath}"`);
|
|
47
|
+
console.log(`[taskwindow] login service installed (${plistPath})`);
|
|
48
|
+
console.log(`[taskwindow] daemon starts at login, restarts on crash, logs to ${logPath}`);
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (system === "linux") {
|
|
53
|
+
const unitPath = join(homedir(), ".config", "systemd", "user", "taskwindow.service");
|
|
54
|
+
mkdirSync(join(homedir(), ".config", "systemd", "user"), { recursive: true });
|
|
55
|
+
const unit = `[Unit]
|
|
56
|
+
Description=TaskWindow daemon
|
|
57
|
+
|
|
58
|
+
[Service]
|
|
59
|
+
ExecStart=${nodePath()} ${daemonEntryPath}
|
|
60
|
+
Restart=on-failure
|
|
61
|
+
StandardOutput=append:${logPath}
|
|
62
|
+
StandardError=append:${logPath}
|
|
63
|
+
|
|
64
|
+
[Install]
|
|
65
|
+
WantedBy=default.target
|
|
66
|
+
`;
|
|
67
|
+
writeFileSync(unitPath, unit);
|
|
68
|
+
execSync("systemctl --user daemon-reload");
|
|
69
|
+
execSync("systemctl --user enable --now taskwindow.service");
|
|
70
|
+
console.log(`[taskwindow] login service installed (${unitPath})`);
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
console.log(`[taskwindow] automatic login services aren't supported on ${system}.`);
|
|
75
|
+
console.log(`[taskwindow] run the daemon with: node ${daemonEntryPath}`);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export function uninstallService() {
|
|
79
|
+
const system = platform();
|
|
80
|
+
try {
|
|
81
|
+
if (system === "darwin") {
|
|
82
|
+
const uid = process.getuid?.() ?? 501;
|
|
83
|
+
try {
|
|
84
|
+
execSync(`launchctl bootout gui/${uid}/${LABEL}`);
|
|
85
|
+
} catch {}
|
|
86
|
+
unlinkSync(join(homedir(), "Library", "LaunchAgents", `${LABEL}.plist`));
|
|
87
|
+
} else if (system === "linux") {
|
|
88
|
+
execSync("systemctl --user disable --now taskwindow.service");
|
|
89
|
+
unlinkSync(join(homedir(), ".config", "systemd", "user", "taskwindow.service"));
|
|
90
|
+
execSync("systemctl --user daemon-reload");
|
|
91
|
+
} else {
|
|
92
|
+
console.log("[taskwindow] nothing to uninstall on this platform");
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
console.log("[taskwindow] login service removed");
|
|
96
|
+
} catch (err) {
|
|
97
|
+
console.error("[taskwindow] uninstall failed:", err.message);
|
|
98
|
+
}
|
|
99
|
+
}
|