Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ link once, from the phone, and the device keys go to one file only your user can
wa personal session start # a QR code: WhatsApp → Settings → Linked devices → Link a device
wa personal session start phone # or your number, then a pairing code you type on the phone
wa personal account show # who this profile is linked as
wa account list # every profile here, and who each is linked as
wa session list # every profile here, and who each is linked as
wa personal session end # unlink, and delete the device keys here
```

Expand Down
2 changes: 1 addition & 1 deletion bin/fix-own-contact-name
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ cleanup() {
# The keys stay if WhatsApp did not answer; they go anyway, and the phone can still remove the device.
drop_keys
rmdir -- "$state/profiles/$profile" 2>/dev/null || true
# session end leaves the account record, which holds the main account's id and keeps fix-own in `account list`.
# session end leaves the account record, which holds the main account's id and keeps fix-own in `session list`.
rm -f -- "$state/accounts/$profile.json"
rm -rf -- "$store"
echo "device unlinked: $unlinked"
Expand Down
6 changes: 3 additions & 3 deletions bin/lib/live.sh
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,12 @@ json() {
}

profiles() {
wa_json account list --timeout 30s | json 'd.items.map((one) => one.profile).join(" ")'
wa_json session list --timeout 30s | json 'd.items.map((one) => one.profile).join(" ")'
}

# Never picks a profile: a missing or unknown one stops with the choices.
need_profile() {
known=$(profiles) || die "wa account list failed"
known=$(profiles) || die "wa session list failed"
[ -n "${1:-}" ] || die "name the profile: $(basename -- "$0") <profile> — profiles here: ${known:-none}"
case " $known " in
*" $1 "*) ;;
Expand All @@ -91,7 +91,7 @@ need_profile() {

# The account's own chat, as the profile recorded it at login. Kept in a variable by the caller; never printed.
own_chat() {
own=$(wa_json account list --timeout 30s | json 'd.items.find((one) => one.profile === a)?.account' "$1")
own=$(wa_json session list --timeout 30s | json 'd.items.find((one) => one.profile === a)?.account' "$1")
case "$own" in
*@lid) printf '%s\n' "$own" ;;
*) die "profile $1 has no recorded own id in LID form — run $wa $1 account show once" ;;
Expand Down
4 changes: 2 additions & 2 deletions bin/live-fresh-link
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ case "$mode" in
"" | --finish) ;;
*) die "usage: $(basename -- "$0") <new-profile>, or $(basename -- "$0") <profile> --finish" ;;
esac
known=$(profiles) || die "wa account list failed"
known=$(profiles) || die "wa session list failed"
[ -n "$profile" ] || die "name a new profile: $(basename -- "$0") <new-profile> — taken already: ${known:-none}"
has_device() {
wa_json "$profile" doctor --timeout 30s | json 'd.item.whatsapp.device.exists'
Expand Down Expand Up @@ -120,7 +120,7 @@ kept=$(fresh "$profile" doctor --json --no-input --timeout 30s 2>/dev/null |
chats=${kept%% *}
messages=${kept##* }
# The id itself names the account, so only whether it was recorded, in LID form, leaves this script.
self=$(fresh account list --json --no-input --timeout 30s 2>/dev/null |
self=$(fresh session list --json --no-input --timeout 30s 2>/dev/null |
json 'd.items.find((one) => one.profile === a)?.account?.endsWith("@lid") ? "yes" : "no"' "$profile") || self="no"

verdict=FAIL
Expand Down
4 changes: 2 additions & 2 deletions bin/move-to-shared-store
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# bin/move-to-shared-store <profile> compare after the re-sync: the old counts beside the shared store's
#
# Before the backup only `config show`, `doctor` and `server status` touch the shared file, and they open it without
# migrating. `account list` and every messages or store command (other than `store backup`) migrate it to this
# migrating. `session list` and every messages or store command (other than `store backup`) migrate it to this
# build's schema, which cannot be undone, so none of them runs before the backup.
# shellcheck disable=SC2016 # json takes JavaScript, whose ${} is its own
set -eu
Expand Down Expand Up @@ -99,7 +99,7 @@ What is left, by hand:
1. Start serve: $wa $profile serve (or $wa $profile server start, with a service)
2. From the phone, send yourself one message in your own chat. A sync counts back from the oldest message held,
so an empty chat cannot be asked about.
3. Your own chat's id is the …@lid value under "account" in: $wa account list --json
3. Your own chat's id is the …@lid value under "account" in: $wa session list --json
4. Keep WhatsApp open on the phone. Run, until it brings nothing new:
$wa $profile messages sync <own chat id>
5. Compare: $main/bin/move-to-shared-store $profile compare
Expand Down
14 changes: 14 additions & 0 deletions changes/feat-session-list.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
### Changed — may break callers

- **`wa session list` lists the profiles on this computer, and `wa account list` is gone** (WC-ACCT-12, WC-CMD-8).
It answers the same rows, takes the same query (`profile:`, `current:`) and needs no profile. There is no alias:
a script that runs `wa account list` must say `wa session list`. `account show`, `account update`,
`account sessions` and the rest of `account` stay.
- **The store moves to version 77** on its first open (cli-core 1.1.0 and 1.2.0). Like every store migration it only
goes forward.

### Added

- **`wa <profile> session status` says whether the profile is logged in, and as whom**, from this computer alone.
`--check` asks the messenger whether the session still works, and leaves the phone number out (`account show`
has it). From cli-core 1.3.0 (was 1.0.0).
2 changes: 1 addition & 1 deletion contracts/help.snap
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Works with:
linear Linear issues and projects, searchable with your other WireCat data

Start here: wa personal setup (any profile name works)
wa account list your profiles and their logged-in accounts
wa session list your profiles and their logged-in accounts
Next: wa commands every command, by section
wa guide scenarios: command sequences for common tasks
wa help options output, offline, timeouts, dry run
Expand Down
36 changes: 25 additions & 11 deletions contracts/wirecat.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,28 +32,38 @@
},
{
"path": [
"setup"
"session",
"status"
],
"summary": "set up WhatsApp and connect your agent",
"summary": "show whether this profile is logged in, and as whom",
"effects": {
"remote": "write",
"local": "write"
},
"entity": "setup"
"remote": "read",
"local": "read"
}
},
{
"path": [
"account",
"session",
"list"
],
"summary": "profiles on this computer and their signed-in accounts",
"summary": "list the profiles on this computer and the account each is logged in as",
"effects": {
"remote": "read",
"remote": "none",
"local": "read"
},
"permission": "account.list",
"entity": "account_profile"
},
{
"path": [
"setup"
],
"summary": "set up WhatsApp and connect your agent",
"effects": {
"remote": "write",
"local": "write"
},
"entity": "setup"
},
{
"path": [
"account",
Expand Down Expand Up @@ -5224,6 +5234,8 @@
"label",
"list",
"is",
"type",
"reach",
"chat",
"date",
"source",
Expand Down Expand Up @@ -5267,6 +5279,8 @@
"label",
"list",
"is",
"type",
"reach",
"chat",
"date",
"source",
Expand Down Expand Up @@ -5481,7 +5495,7 @@
"tagline": "Your WhatsApp account, searchable on your computer",
"profiles": {
"args": [
"account",
"session",
"list",
"--no-record",
"--json"
Expand Down
2 changes: 1 addition & 1 deletion docs/bot.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ no WhatsApp account.
| `bot mcp serve` | The bot's commands as MCP tools for an agent. |
| `bot list` | Every bot profile on this computer that has a token; `--check` asks Meta which number each is. Needs no profile word. |

A bot profile is not one of your accounts: `wa account list` leaves out a name that only a bot uses, and marks a
A bot profile is not one of your accounts: `wa session list` leaves out a name that only a bot uses, and marks a
name that is your account and a bot too with `bot: true`.

A chat is the person's phone number in digits, such as `70000000001`. Meta names some people only by a
Expand Down
38 changes: 25 additions & 13 deletions docs/commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ wa [profile] [options] <resource> <verb> [arguments]
profile `work`. `WA_PROFILE` does the same for a whole shell session; no setting in the config file
picks one. **No profile is assumed**, not even the only one: without either, a command
that uses an account stops with exit 2 and lists the profiles on this computer. Commands that use no
account (`--help`, `--version`, `commands`, `skill show`, `account list`, `config show`) run
account (`--help`, `--version`, `commands`, `skill show`, `session list`, `config show`) run
without one.

## Options for every command
Expand Down Expand Up @@ -76,6 +76,30 @@ unlink this device on WhatsApp's side and delete its keys here
wa session end
```

### `wa session status`

show whether this profile has a session on this computer and the account it was logged in as; --check asks the messenger whose the session is, without the phone number (`account show` has it)

```sh
wa session status [options]
```

| Option | What it does |
|---|---|
| `--check` | ask the messenger whether the session still works, and whose it is. |

### `wa session list`

every account profile on this computer, and the account each is logged in as; a name that is only a bot is left out (`bot list` has it), one that is a bot too says `bot: true`; asks the messenger nothing

```sh
wa session list [query]
```

| Argument | | What it is |
|---|---|---|
| `query` | optional | field:value terms that narrow the list — the fields are below. |

## `wa setup`

set up WhatsApp and connect your agent
Expand All @@ -95,18 +119,6 @@ wa setup [options]

the logged-in account

### `wa account list`

every account profile on this computer, and the account each is logged in as; a name that is only a bot is left out (`bot list` has it), one that is a bot too says `bot: true`; asks the messenger nothing

```sh
wa account list [query]
```

| Argument | | What it is |
|---|---|---|
| `query` | optional | field:value terms that narrow the list — the fields are below. |

### `wa account show`

who this profile is logged in as, with the phone number
Expand Down
2 changes: 1 addition & 1 deletion docs/dev/BACKLOG-NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ since the plain shape is the one seen to group.
A fresh `session start` must keep the history push, and `self()` must be set right after pairing: the engine's
`link` answers with `me()`, which fails while WhatsApp has not given the account its LID, so a `session start` that
exits 0 has one. `bin/live-fresh-link` links a new profile, counts what the push left in a throwaway store and
checks that `account list` recorded the own id in LID form; its last line is `WA-5: PASS` or `FAIL`. The owner's run
checks that `session list` recorded the own id in LID form; its last line is `WA-5: PASS` or `FAIL`. The owner's run
of 2026-11-08 linking a spare account (profile `spar`) ended `WA-5: PASS`.

## WA-11 · How long a rate limit and a ban hold writes
Expand Down
14 changes: 7 additions & 7 deletions docs/dev/live-scenarios.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ also say the phone answered the LID chat under another id, such as its phone num

These checks are scripts in `bin/`; most need a person at the phone. Only the owner runs them, from a terminal;
an agent never does (`WC-TEST-18`). Each takes the profile as its first argument and never picks one: without it, or
with a name that is not there, it stops and lists the profiles `account list` knows (`WC-ACCT-3`). Each runs the
with a name that is not there, it stops and lists the profiles `session list` knows (`WC-ACCT-3`). Each runs the
main checkout's `bin/wa`, the one whose `serve` holds the device, with `--json`, `--no-input` and a `--timeout`
(`WC-LIFE-5`). Some calls differ: the restarted `serve` runs without a timeout, `live-fresh-link` runs
`session start` through `node` with a throwaway store, in human mode on the terminal so that wa draws the QR code
Expand Down Expand Up @@ -121,7 +121,7 @@ Confirm the plan once at the terminal. No phone typing is needed in this mode; o
alone does not create the marker and control messages. Without `--sender-profile`, the script instead prompts
you to send both words from the phone's Message yourself chat. Both modes use the main checkout's installed build.

1. Read both accounts' LIDs from `account list`, without printing them. Automatic mode refuses missing profiles
1. Read both accounts' LIDs from `session list`, without printing them. Automatic mode refuses missing profiles
and profiles for the same account. Verify receiver `serve` and its engine by the device lock and process
arguments; stop nothing if they cannot be restored the same way. For a persistent systemd user service,
verify its MainPID and use the same service to stop and start. An implicit profile must be set by the unit's
Expand Down Expand Up @@ -151,7 +151,7 @@ The owner deletes the two probe messages from the phone afterwards. The script c
recipient lists and sends no read receipts. While receiver `serve` is stopped, other incoming messages queue too.

**`live-poll-vote`** needs `serve` running, so its writes go through it and no one-shot connection takes the
device. It reads the own chat's id from `account list` (it must be in LID form) and never prints it. Then:
device. It reads the own chat's id from `session list` (it must be in LID form) and never prints it. Then:
`polls create` with a question carrying a fresh run number and the answers `yes` and `no`; `polls show` for the
answer ids; `polls vote` for `yes`; `polls show` again after 10 s; `messages delete --for-everyone`. It prints the
votes per answer and whether the owner's vote is the chosen one, from the vote's answer and from the store.
Expand Down Expand Up @@ -181,28 +181,28 @@ and checks `serve` as `live-oneshot-drop` does (the helpers are shared in `bin/l
is no verdict: the store may already hold the chat's start, or the phone was offline.
6. The `EXIT` trap deletes the log.

**`live-fresh-link`** refuses a profile that `account list` shows or that has device keys. It says plainly that it
**`live-fresh-link`** refuses a profile that `session list` shows or that has device keys. It says plainly that it
links a second device and goes on only after `yes`. It runs `session start qr --timeout 15m` in human mode, with the
terminal attached and nothing redirected, so wa draws the QR code in the terminal as tg and max do; Ctrl+C there
ends the history wait, not the script. That run's own lines name the account, so only the result block is pasted.
The device keys go to the main checkout's `.wa/state`, like any profile there. The pushed history goes to a throwaway
store, removed at the end, because the store keys an account by its WhatsApp id and not by its profile: the push would
otherwise land in the owner's store. The result block holds `session start`'s exit code and the chats and messages in
that store, read afterwards with `doctor --json`: distinct rows, which can be fewer than the pushed batches held, and
whether `account list` recorded the profile's own id in LID form (the id itself is not printed). The last line is
whether `session list` recorded the profile's own id in LID form (the id itself is not printed). The last line is
`WA-5: PASS` only for exit 0, the own id and more than 0 chats and messages; the exit code follows it. On
every exit, Ctrl-C included, it removes the throwaway store and, while the new profile has device keys, says how to
unlink it. A store that was never created reads "nothing", not a count.

When `session start` fails but the device is linked, the result block says to run `--finish`. That refuses a profile
without device keys and one whose lock is held, and goes on only after `yes`. It asks for the device keys, not for
`account list`: a link that ended early may never have saved the account record, and the `watch` connection saves
`session list`: a link that ended early may never have saved the account record, and the `watch` connection saves
it. It runs `watch --jsonl --timeout 5m` with stdout to `/dev/null` and the same throwaway store, so whatever the
phone still pushes, and whatever WhatsApp queued for that device, lands there and is counted the same way.
`--jsonl`, because a stdout that is not a terminal gets `--json`, which `watch` refuses. It is only for a profile
this script linked: the queued messages are gone with the throwaway store.

**`live-chat-state`** needs `serve` running, and works in the own chat only, by its LID id from `account list`,
**`live-chat-state`** needs `serve` running, and works in the own chat only, by its LID id from `session list`,
never printed. After each step it asks the owner what the phone shows and records yes or no:

1. `account privacy show`, read only. It prints each setting that came back with its value (`everyone`,
Expand Down
6 changes: 4 additions & 2 deletions docs/dev/test-matrix.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,19 @@ ran it · ⛔ not tested offline, with the reason and where it is checked instea
Measured from the test run (`coverage/argv.jsonl`), not searched for — see
[TESTING.md](TESTING.md) for how, and for the states and failures that cut across commands.

**287 ✅ · 878 ⛔ · 0 ❌** — 383 commands, 782 options.
**289 ✅ · 878 ⛔ · 0 ❌** — 384 commands, 783 options.

| Command | Option | | Note |
|---|---|---|---|
| `session start` | | ✅ | |
| `session start` | `--answer-stdin` | ✅ | |
| `session end` | | ✅ | |
| `session status` | | ✅ | |
| `session status` | `--check` | ✅ | |
| `session list` | | ✅ | |
| `setup` | | ✅ | |
| `setup` | `--agent` | ✅ | |
| `setup` | `--method` | ✅ | |
| `account list` | | ✅ | |
| `account show` | | ✅ | |
| `account show` | `--hide-phone` | ✅ | |
| `account update` | | ✅ | |
Expand Down
4 changes: 2 additions & 2 deletions docs/profiles.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ know how to pick a profile for a command and how to give it its own settings.
| Use two WhatsApp accounts on one computer | Link once per profile: `wa work session start` |
| Give your agent fewer rights than you have | A profile with its own [permissions](permissions.md) |
| Keep an agent on that one profile | `WA_PROFILE_LOCK` ([profiles in linking](sessions.md#profiles)) |
| See every profile on this computer | `wa account list` |
| See every profile on this computer | `wa session list` |

## Choose a profile

Expand All @@ -24,7 +24,7 @@ Put the profile name before the command:
wa work config show
```

`wa account list` shows every profile on this computer and the account each is linked as; `wa work session end`
`wa session list` shows every profile on this computer and the account each is linked as; `wa work session end`
unlinks the profile `work`.

A setting under `profiles.work` in the config file applies to that profile; values under `defaults` apply when it
Expand Down
4 changes: 2 additions & 2 deletions docs/sessions.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ news and says so in one more `"step":"waiting"` line: keep WhatsApp open on the

```sh
wa personal account show # who this profile is linked as; the phone number shows only its last four digits
wa account list # every profile on this computer, and the account each is linked as
wa session list # every profile on this computer, and the account each is linked as
wa personal session end # unlink the device on WhatsApp's side, and delete its keys here
```

Expand Down Expand Up @@ -171,7 +171,7 @@ a digit.

The order, first match wins: the first word, then `WA_PROFILE`. With neither, a command that uses an account stops
with exit code `2` and lists the profiles on this computer. `wa` never picks one, not even the only one. Commands
that use no account run without a profile: `--help`, `--version`, `commands`, `skill show`, `account list` and
that use no account run without a profile: `--help`, `--version`, `commands`, `skill show`, `session list` and
`config show`.

**`WA_PROFILE_LOCK` pins a process to one profile.** Set it where an agent runs, and a first word or `WA_PROFILE`
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
},
"dependencies": {
"@wirecat/cli-base": "1.0.0",
"@wirecat/cli-core": "1.0.0",
"@wirecat/cli-core": "1.3.0",
"commander": "15.0.0",
"valibot": "1.5.0"
},
Expand Down
Loading
Loading