@craftsamo/whatsapp-tools 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/.antigravity-plugin/plugin.json +1 -1
- package/.claude-plugin/plugin.json +1 -1
- package/.codex-plugin/plugin.json +2 -1
- package/README.md +58 -12
- package/dist/cli.js +212 -146
- package/dist/mcp.js +206 -107
- package/dist/opencode.js +192 -105
- package/package.json +1 -1
- package/plugin.yaml +1 -1
- package/src/hermes/whatsapp_tools_hermes/approval.py +1 -6
- package/src/hermes/whatsapp_tools_hermes/plugin.py +2 -2
- package/src/hermes/whatsapp_tools_hermes/project.py +4 -4
- package/src/hermes/whatsapp_tools_hermes/settings.py +15 -69
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "whatsapp-tools",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "WhatsApp tools for coding agents: chats, contacts, history, received files, sends and actions.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "craftsamo",
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
"command": "node",
|
|
16
16
|
"args": ["dist/mcp.js"],
|
|
17
17
|
"cwd": ".",
|
|
18
|
+
"default_tools_approval_mode": "writes",
|
|
18
19
|
"env_vars": [
|
|
19
20
|
"WHATSAPP_TOOLS_TOOLSETS",
|
|
20
21
|
"WHATSAPP_TOOLS_READ_ONLY",
|
package/README.md
CHANGED
|
@@ -79,7 +79,15 @@ codex plugin add whatsapp-tools@craft-agent
|
|
|
79
79
|
|
|
80
80
|
Codex turns `-` into `_` in server names, so it shows the tools as
|
|
81
81
|
`mcp__whatsapp_tools__whatsapp_*`. It starts the MCP server in the plugin's
|
|
82
|
-
install directory
|
|
82
|
+
install directory and passes no roots, so the server takes each call's directory
|
|
83
|
+
from what Codex sends with the call: its sandbox state, which the server asks
|
|
84
|
+
for, else the one workspace it names.
|
|
85
|
+
|
|
86
|
+
The plugin declares `default_tools_approval_mode = "writes"`: Codex asks before
|
|
87
|
+
every tool not marked read-only. A user's
|
|
88
|
+
`[plugins."<plugin>".mcp_servers.<server>]` setting can only tighten it. Setting
|
|
89
|
+
`auto` there yields `prompt` (reads asked too), since Codex treats `auto` and
|
|
90
|
+
`writes` as incomparable.
|
|
83
91
|
|
|
84
92
|
### Grok Build
|
|
85
93
|
|
|
@@ -110,7 +118,10 @@ hermes plugins enable whatsapp-tools
|
|
|
110
118
|
```
|
|
111
119
|
|
|
112
120
|
If a Hermes gateway is already running, restart it (`hermes gateway restart`) to
|
|
113
|
-
load the plugin.
|
|
121
|
+
load the plugin. While a gateway runs, `hermes chat` runs the plugin's tools in
|
|
122
|
+
the gateway too, so they see the gateway's environment, not the shell's: the
|
|
123
|
+
`PATH` that finds `wacli` and `node`, and any `WHATSAPP_TOOLS_*` variable, are
|
|
124
|
+
the ones the gateway started with.
|
|
114
125
|
|
|
115
126
|
The plugin runs the Node it found when Hermes started. If a version manager
|
|
116
127
|
removes that version while Hermes runs, a call looks for Node again; when it
|
|
@@ -326,6 +337,26 @@ in Hermes.
|
|
|
326
337
|
|
|
327
338
|
[`docs/conventions.md`](docs/conventions.md) has the rules each step follows.
|
|
328
339
|
|
|
340
|
+
A package declares each option as `text`, `boolean`, `number`, `list`, `path`
|
|
341
|
+
or `paths`, or as an object with `type` and optional bounds. For example, in
|
|
342
|
+
`src/project.ts`:
|
|
343
|
+
|
|
344
|
+
```ts
|
|
345
|
+
options: {
|
|
346
|
+
notes_dir: "path",
|
|
347
|
+
note_limit: { type: "number", integer: true, min: 1, max: 50 },
|
|
348
|
+
}
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
`integer: true` requires a whole number; `min` and `max` bound a number or
|
|
352
|
+
count a `list` or `paths` value's items. An object with only `type` means the
|
|
353
|
+
same as the type alone. Hermes's `OPTIONS` mirrors the declarations on one
|
|
354
|
+
line, with double quotes and Python's `True` for `integer`:
|
|
355
|
+
|
|
356
|
+
```python
|
|
357
|
+
OPTIONS: dict[str, str | dict[str, object]] = {"notes_dir": "path", "note_limit": {"type": "number", "integer": True, "min": 1, "max": 50}}
|
|
358
|
+
```
|
|
359
|
+
|
|
329
360
|
## Reads and writes
|
|
330
361
|
|
|
331
362
|
Every read tool is named `<prefix>_<domain>_read`. Reads can run unasked;
|
|
@@ -344,8 +375,11 @@ Where a write is asked about, and where it is not:
|
|
|
344
375
|
|
|
345
376
|
- **OpenCode** grants any action no rule names, so a write runs unasked unless
|
|
346
377
|
a rule asks for it: add the `whatsapp_*` rule shown under [OpenCode](#opencode).
|
|
347
|
-
- **Codex**
|
|
348
|
-
|
|
378
|
+
- **Codex** asks before every write because of the plugin's approval mode.
|
|
379
|
+
Under `codex exec` it refuses with "MCP tool call requires approval, but
|
|
380
|
+
approval policy is never".
|
|
381
|
+
- **Grok Build** under `grok -p` refuses a write it cannot ask about, unless it
|
|
382
|
+
is allowed beforehand.
|
|
349
383
|
- **Grok Build** calls the plugin's tools through its `use_tool` tool, and the
|
|
350
384
|
agent often names a tool without its server first. Grok checks the rules
|
|
351
385
|
against the name as given, so the server-qualified rule alone does not match
|
|
@@ -372,13 +406,24 @@ Hermes, noted below.
|
|
|
372
406
|
| `confirm` | `--confirm` | `WHATSAPP_TOOLS_CONFIRM` | MCP server only: `harness` (default) or `elicitation`, as the conventions say |
|
|
373
407
|
| `language` | `--language` | `WHATSAPP_TOOLS_LANGUAGE` | native plugins only: the approval prompt's language, such as `ja` |
|
|
374
408
|
| `emoji` | — | — | Hermes only: the emoji shown beside each toolset, by toolset name (`""` for none) |
|
|
375
|
-
| `state_dir` | `--state-dir` | `WHATSAPP_TOOLS_STATE_DIR` | where every label's state lives; default `$XDG_STATE_HOME/whatsapp-tools`
|
|
376
|
-
| `download_dir` | `--download-dir` | `WHATSAPP_TOOLS_DOWNLOAD_DIR` | where received files are saved; default `~/Downloads/whatsapp-tools`
|
|
377
|
-
| `send_dirs` | `--send-dirs` | `WHATSAPP_TOOLS_SEND_DIRS` | the directories files may be sent from, besides the working directory
|
|
378
|
-
|
|
379
|
-
Lists are comma-separated in a flag or a variable.
|
|
380
|
-
|
|
381
|
-
same way.
|
|
409
|
+
| `state_dir` | `--state-dir` | `WHATSAPP_TOOLS_STATE_DIR` | `path`: where every label's state lives; default `$XDG_STATE_HOME/whatsapp-tools` |
|
|
410
|
+
| `download_dir` | `--download-dir` | `WHATSAPP_TOOLS_DOWNLOAD_DIR` | `path`: where received files are saved; default `~/Downloads/whatsapp-tools` |
|
|
411
|
+
| `send_dirs` | `--send-dirs` | `WHATSAPP_TOOLS_SEND_DIRS` | `paths`: the directories files may be sent from, besides the working directory |
|
|
412
|
+
|
|
413
|
+
Lists are comma-separated in a flag or a variable. `state_dir`, `download_dir`
|
|
414
|
+
and `send_dirs` are this package's own settings, listed in `options` in
|
|
415
|
+
`src/project.ts` and read the same way. A `path` is trimmed; `~` and `~/…`
|
|
416
|
+
(also with the platform separator) stand for the home directory (`HOME` when
|
|
417
|
+
it is absolute, else the account's). It must then be absolute and reaches the
|
|
418
|
+
tool normalized, without a filesystem check. A blank path counts as unset,
|
|
419
|
+
so the default applies. `paths` is a list of such paths, comma-separated in a
|
|
420
|
+
flag or variable and an array of strings in a plugin option. Blank items are
|
|
421
|
+
dropped, and a list with none left counts as unset. Repeated send directories
|
|
422
|
+
are dropped. Bounds check only a given value, not an unset option. Refused
|
|
423
|
+
values are `invalid_argument`, naming the flag, variable or option and what it
|
|
424
|
+
must be.
|
|
425
|
+
Hermes passes paths and lists to the command line, which checks the paths and
|
|
426
|
+
bounds. Where each harness reads them:
|
|
382
427
|
|
|
383
428
|
- **OpenCode** takes the plugin `options` shown above, with lists as arrays,
|
|
384
429
|
`read_only` as a boolean, `state_dir` and `download_dir` as paths and
|
|
@@ -407,7 +452,8 @@ same way. Where each harness reads them:
|
|
|
407
452
|
`send_dirs: []`) passes nothing, so a variable set in that environment
|
|
408
453
|
still applies: `WHATSAPP_TOOLS_READ_ONLY=true` keeps the plugin read-only
|
|
409
454
|
whatever the setting says. A running gateway keeps the environment it
|
|
410
|
-
started with
|
|
455
|
+
started with, and `hermes chat` runs the tools there while it runs; restart
|
|
456
|
+
it (`hermes gateway restart`) after changing one.
|
|
411
457
|
|
|
412
458
|
- **Claude Code, Grok Build and Antigravity** start the plugin's server without
|
|
413
459
|
flags and pass it the client's environment, so set the variables in the
|