taskwindow 0.1.0 → 0.1.1

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 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,118 @@
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
59
+
60
+ The daemon prints the ready-made command at startup. For Claude Code:
61
+
62
+ ```bash
63
+ claude mcp add taskwindow --transport http http://127.0.0.1:9377/mcp \
64
+ --header "Authorization: Bearer <token from the daemon output>"
65
+ ```
66
+
67
+ For other clients, the config is an HTTP MCP server at
68
+ `http://127.0.0.1:9377/mcp` with header `Authorization: Bearer <token>`.
69
+
70
+ ### 5. Try it
71
+
72
+ Ask your agent: *"Open example.com in a new tab and take a screenshot."*
73
+
74
+ A green tab group named after your task appears in its own window — that's
75
+ the agent's workspace. Screenshot done. Now try:
76
+ *"Find the sign-up link and read the page's headings."*
77
+
78
+ ## What the agent gets
79
+
80
+ | Area | Tools |
81
+ |---|---|
82
+ | Tabs | `tabs_list`, `tabs_create`, `tabs_close`, `navigate` |
83
+ | See | `computer` (screenshot + click/type/key/scroll), `read_page`, `find`, `get_page_text` |
84
+ | Act | `form_input`, `file_upload`, `upload_image`, `javascript_execute` |
85
+ | Debug | `read_console_messages`, `read_network_requests` |
86
+ | Efficiency | `browser_batch` (multi-step in one call), `gif_record`, `set_viewport` (responsive view), `shortcuts_*` |
87
+
88
+ ## How the isolation works
89
+
90
+ - **Task groups**: every tab the agent creates goes into a green tab group
91
+ named after the task, in the agent's own window. By default the agent can
92
+ only see and act on tabs in its own groups — never yours. You can click a
93
+ group in the toolbar popover to watch, and the user can widen access in
94
+ settings.
95
+ - **Pairing**: the daemon listens on 127.0.0.1 only; the extension pairs with
96
+ a 6-character code printed at daemon start. MCP requests require a bearer
97
+ token.
98
+ - **Agent actions are visible**: a phantom cursor and glow show where the
99
+ agent is acting; while it does, Chrome shows a
100
+ *"started debugging this browser"* infobar — an unavoidable Chrome policy
101
+ for this capability, same as Claude's own extension.
102
+
103
+ ## Requirements & limits
104
+
105
+ - Chrome/Chromium 116+ (Chrome, Edge, Brave, Arc…)
106
+ - Node 18+ for the daemon
107
+ - Page tools run in the top frame; native `alert()`/`confirm()` dialogs block
108
+ the attached tab
109
+
110
+ ## Development
111
+
112
+ ```bash
113
+ git clone https://github.com/clawnify/taskwindow
114
+ cd taskwindow/daemon && npm install && npm test
115
+ ```
116
+
117
+ The test suite boots the daemon with a fake extension and runs a real MCP
118
+ client against it (auth, dispatch, batching, error paths).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "taskwindow",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
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",
package/src/index.js CHANGED
@@ -1,9 +1,21 @@
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
+
10
+ // `taskwindow install|uninstall` manage the login service, then exit.
11
+ if (process.argv[2] === "install") {
12
+ installService(fileURLToPath(new URL("./index.js", import.meta.url)));
13
+ process.exit(0);
14
+ }
15
+ if (process.argv[2] === "uninstall") {
16
+ uninstallService();
17
+ process.exit(0);
18
+ }
7
19
 
8
20
  const config = loadConfig();
9
21
  const bridge = new Bridge({ token: config.token });
@@ -139,6 +151,8 @@ server.listen(config.port, "127.0.0.1", () => {
139
151
  console.log(`[taskwindow] daemon listening on http://127.0.0.1:${config.port}`);
140
152
  console.log(`[taskwindow] MCP endpoint: http://127.0.0.1:${config.port}/mcp`);
141
153
  console.log(`[taskwindow] pairing code: ${pairCode} — enter it in the TaskWindow extension options to connect (valid while this daemon runs)`);
154
+ console.log(`[taskwindow] your MCP client config: endpoint http://127.0.0.1:${config.port}/mcp, header "Authorization: Bearer ${config.token}"`);
155
+ console.log(`[taskwindow] claude code: claude mcp add taskwindow --transport http http://127.0.0.1:${config.port}/mcp --header "Authorization: Bearer ${config.token}"`);
142
156
  console.log(`[taskwindow] waiting for the TaskWindow extension to connect on ws://127.0.0.1:${config.port}/ws`);
143
157
  });
144
158
 
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
+ }