deputy-mcp 0.1.5 → 0.1.7
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 +14 -2
- package/dist/cli-81kfebvw.js +30 -0
- package/dist/command-v8tc22yb.js +85 -0
- package/dist/deputy-mcp.js +10 -71103
- package/dist/index-qm2sserj.js +409 -0
- package/dist/pdfjs-etyj9grj.js +42752 -0
- package/dist/serve-8p3e7k1r.js +28861 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -22,7 +22,19 @@ adds the other 17 and hosted models; paste its license key on the extension's se
|
|
|
22
22
|
open-source version is at [github.com/zraisan/deputy](https://github.com/zraisan/deputy).
|
|
23
23
|
|
|
24
24
|
Several clients can use the same browser at once. The first one to start owns the connection to
|
|
25
|
-
the extension on `127.0.0.1:7331`; later ones share it, and take over if it exits.
|
|
26
|
-
|
|
25
|
+
the extension on `127.0.0.1:7331`; later ones share it, and take over if it exits. Each one works
|
|
26
|
+
in its own tab. Deputy enabled in more than one Chrome profile is fine too: each call goes to the
|
|
27
|
+
profile that has the tab. `DEPUTY_PORT` picks another port.
|
|
28
|
+
|
|
29
|
+
Your own model: Deputy can use an [OpenRouter](https://openrouter.ai) key of yours for
|
|
30
|
+
`browser_ask` and `delegate_goal`. Every Deputy process plans with its own key, so put it where
|
|
31
|
+
all of them read it, and no restart is needed:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
mkdir -p ~/.config/deputy && echo 'OPENROUTER_API_KEY=sk-or-...' >> ~/.config/deputy/env
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
`OPENROUTER_MODEL` there picks the model. The same variables in the environment win over the
|
|
38
|
+
file; `DEPUTY_CONFIG` moves the file.
|
|
27
39
|
|
|
28
40
|
License: [PolyForm Shield 1.0.0](LICENSE).
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __toESM = (mod, isNodeMode, target) => {
|
|
8
|
+
target = mod != null ? __create(__getProtoOf(mod)) : {};
|
|
9
|
+
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
10
|
+
for (let key of __getOwnPropNames(mod))
|
|
11
|
+
if (!__hasOwnProp.call(to, key))
|
|
12
|
+
__defProp(to, key, {
|
|
13
|
+
get: () => mod[key],
|
|
14
|
+
enumerable: true
|
|
15
|
+
});
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
19
|
+
var __export = (target, all) => {
|
|
20
|
+
for (var name in all)
|
|
21
|
+
__defProp(target, name, {
|
|
22
|
+
get: all[name],
|
|
23
|
+
enumerable: true,
|
|
24
|
+
configurable: true,
|
|
25
|
+
set: (newValue) => all[name] = () => newValue
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
29
|
+
|
|
30
|
+
export { __toESM, __commonJS, __export, __require };
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import"./cli-81kfebvw.js";
|
|
2
|
+
|
|
3
|
+
// packages/deputyd/src/command.ts
|
|
4
|
+
import { writeFileSync } from "node:fs";
|
|
5
|
+
import { hostname, tmpdir } from "node:os";
|
|
6
|
+
import { join } from "node:path";
|
|
7
|
+
var PORT = Number(process.env.DEPUTY_PORT ?? 7331);
|
|
8
|
+
var HUB = `http://127.0.0.1:${PORT}`;
|
|
9
|
+
function callerFromEnv(env = process.env) {
|
|
10
|
+
const agent = env.DEPUTY_AGENT ?? (env.CLAUDECODE ? "claude-code" : env.CODEX_THREAD_ID || env.CODEX_SANDBOX ? "codex" : env.AI_AGENT || "unknown");
|
|
11
|
+
const session = env.DEPUTY_SESSION ?? env.CLAUDE_CODE_SESSION_ID ?? env.CODEX_THREAD_ID ?? "shared";
|
|
12
|
+
const agentPid = Number(env.CLAUDE_PID) || undefined;
|
|
13
|
+
return { agent, session, pid: process.pid, agentPid, cwd: process.cwd(), host: hostname() };
|
|
14
|
+
}
|
|
15
|
+
async function post(path, body) {
|
|
16
|
+
const res = await fetch(HUB + path, {
|
|
17
|
+
method: "POST",
|
|
18
|
+
headers: { "content-type": "application/json" },
|
|
19
|
+
body: JSON.stringify(body)
|
|
20
|
+
});
|
|
21
|
+
if (!res.ok)
|
|
22
|
+
throw new Error(`${res.status} ${await res.text()}`);
|
|
23
|
+
return res.json();
|
|
24
|
+
}
|
|
25
|
+
var USAGE = `Deputy: drive the browser from the command line.
|
|
26
|
+
|
|
27
|
+
deputy-mcp tools list the tools, with what each does
|
|
28
|
+
deputy-mcp tools <name> one tool's arguments (JSON Schema)
|
|
29
|
+
deputy-mcp call <name> [json] run a tool, e.g. deputy-mcp call browser_navigate '{"url":"https://example.com"}'
|
|
30
|
+
`;
|
|
31
|
+
async function runCommand(argv) {
|
|
32
|
+
const [cmd, name, json] = argv;
|
|
33
|
+
try {
|
|
34
|
+
if (cmd === "tools") {
|
|
35
|
+
const tools = await post("/tools", {});
|
|
36
|
+
if (name) {
|
|
37
|
+
const t = tools.find((x) => x.name === name);
|
|
38
|
+
if (!t) {
|
|
39
|
+
console.error(`No tool "${name}".`);
|
|
40
|
+
return 1;
|
|
41
|
+
}
|
|
42
|
+
console.log(`${t.name}: ${t.description}
|
|
43
|
+
|
|
44
|
+
${JSON.stringify(t.inputSchema, null, 2)}`);
|
|
45
|
+
} else {
|
|
46
|
+
for (const t of tools)
|
|
47
|
+
console.log(`${t.name}
|
|
48
|
+
${t.description.split(". ")[0].replace(/\.$/, "")}.`);
|
|
49
|
+
}
|
|
50
|
+
return 0;
|
|
51
|
+
}
|
|
52
|
+
if (cmd === "call" && name) {
|
|
53
|
+
let args = {};
|
|
54
|
+
if (json) {
|
|
55
|
+
try {
|
|
56
|
+
args = JSON.parse(json);
|
|
57
|
+
} catch {
|
|
58
|
+
console.error("The arguments must be one JSON object, in single quotes.");
|
|
59
|
+
return 2;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
const out = await post("/call", { caller: callerFromEnv(), tool: name, args });
|
|
63
|
+
for (const c of out.content ?? []) {
|
|
64
|
+
if (c.type === "text")
|
|
65
|
+
console.log(c.text);
|
|
66
|
+
else if (c.type === "image" && c.data) {
|
|
67
|
+
const file = join(tmpdir(), `deputy-${Date.now()}.${c.mimeType === "image/png" ? "png" : "jpg"}`);
|
|
68
|
+
writeFileSync(file, Buffer.from(c.data, "base64"));
|
|
69
|
+
console.log(`Image saved to ${file}`);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return out.isError ? 1 : 0;
|
|
73
|
+
}
|
|
74
|
+
console.log(USAGE);
|
|
75
|
+
return cmd === "help" || !cmd ? 0 : 2;
|
|
76
|
+
} catch (err) {
|
|
77
|
+
const why = String(err instanceof Error ? err.cause?.message ?? err.message : err);
|
|
78
|
+
console.error(/ECONNREFUSED|fetch failed/.test(why) ? `Deputy is not running on ${HUB}. Start it with: npx -y deputy-mcp serve` : `Deputy: ${why}`);
|
|
79
|
+
return 1;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
export {
|
|
83
|
+
runCommand,
|
|
84
|
+
callerFromEnv
|
|
85
|
+
};
|