taskwindow 0.2.12 → 0.2.13

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 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 client that speaks
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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "taskwindow",
3
- "version": "0.2.12",
3
+ "version": "0.2.13",
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
- export function inspectAgents({ homeDir = homedir(), codexHome, hasCommand = commandExists } = {}) {
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("|");