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
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 @@
### Изменено — может сломать скрипты

- **Профили на этом компьютере теперь показывает `max session list`, а `max account list` удалена** (WC-ACCT-12,
WC-CMD-8). Ответ тот же, запрос тот же (`profile:`, `current:`), профиль не нужен. Старого имени больше нет:
скрипт, который вызывает `max account list`, должен вызывать `max session list`. `account show`, `account update`,
`account sessions` и остальные команды `account` остаются.
- **Хранилище переходит на версию 77** при первом открытии (cli-core 1.1.0 и 1.2.0). Как и любая миграция хранилища,
она идёт только вперёд.

### Что нового

- **`max <профиль> session status` говорит, выполнен ли вход в профиль и под каким аккаунтом**, только по данным
этого компьютера. С `--check` она спрашивает MAX, работает ли сессия, и не показывает номер телефона (он есть в
`account show`). Из cli-core 1.3.0 (была 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: max personal setup (any profile name works)
max account list your profiles and their logged-in accounts
max session list your profiles and their logged-in accounts
Next: max commands every command, by section
max guide scenarios: command sequences for common tasks
max help options output, offline, timeouts, dry run
Expand Down
32 changes: 23 additions & 9 deletions contracts/wirecat.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,27 +30,37 @@
},
{
"path": [
"setup"
"session",
"status"
],
"summary": "set up your personal MAX account and connect your agent",
"summary": "show whether this profile is logged in, and as whom",
"effects": {
"remote": "write",
"local": "write"
"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 your personal MAX account and connect your agent",
"effects": {
"remote": "write",
"local": "write"
}
},
{
"path": [
"account",
Expand Down Expand Up @@ -5199,6 +5209,8 @@
"label",
"list",
"is",
"type",
"reach",
"chat",
"date",
"source",
Expand Down Expand Up @@ -5242,6 +5254,8 @@
"label",
"list",
"is",
"type",
"reach",
"chat",
"date",
"source",
Expand Down Expand Up @@ -5541,7 +5555,7 @@
"tagline": "Your MAX account, searchable on your computer",
"profiles": {
"args": [
"account",
"session",
"list",
"--no-record",
"--json"
Expand Down
48 changes: 31 additions & 17 deletions docs/commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ max [профиль] [опции] <команда> <действие> [аргу
**Профиль никогда не подразумевается**: если его не назвать, команда, которой нужен аккаунт,
останавливается и перечисляет профили этого компьютера — даже если профиль один. Первый вход тоже
с именем: `max personal setup`. Без профиля работают только команды, которым аккаунт не нужен:
`--help`, `--version`, `commands`, `skill show`, `account list`, `config show`.
`--help`, `--version`, `commands`, `skill show`, `session list`, `config show`.

⚠ Описания команд и опций ниже — ровно те, что печатает `max --help`, то есть по-английски. Это
не недоработка перевода: текст живёт в программе, и второй его копии здесь быть не должно.
Expand Down Expand Up @@ -89,42 +89,56 @@ max session end

**Example:** `max personal session end`

## `max setup`
### `max session status`

set up your personal MAX account and connect your agent

**Меняет что-то вне этого компьютера: в MAX или во внешнем сервисе.**
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
max setup [options]
max session status [options]
```

| Опция | Что делает |
|---|---|
| `--agent <agent>` | install the skill for this agent; asks at a terminal, otherwise none. Одно из: `none`, `codex`, `cursor`, `claude`, `gemini`, `all`. |
| `--method <method>` | how to log in when there is no session. Одно из: `token`, `qr`, `qr-chrome`, `sms`. По умолчанию: `qr`. |
| `--check` | ask the messenger whether the session still works, and whose it is. |

**Example:** `max personal setup`
**Example:** `max personal session status`, `max personal session status --check --json`

## `max account`

the logged-in account

### `max account list`
### `max 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
max account list [query]
max session list [query]
```

| Аргумент | | Что это |
|---|---|---|
| `query` | необязательный | field:value terms that narrow the list — the fields are below. |

**Returns:** account profile — profile, current, account, name, signed_in, bot; every field: max commands info account list
**Returns:** account profile — profile, current, account, name, signed_in, bot; every field: max commands info session list

**Example:** `max session list`, `max session list --json`

## `max setup`

set up your personal MAX account and connect your agent

**Example:** `max personal account list`
**Меняет что-то вне этого компьютера: в MAX или во внешнем сервисе.**

```sh
max setup [options]
```

| Опция | Что делает |
|---|---|
| `--agent <agent>` | install the skill for this agent; asks at a terminal, otherwise none. Одно из: `none`, `codex`, `cursor`, `claude`, `gemini`, `all`. |
| `--method <method>` | how to log in when there is no session. Одно из: `token`, `qr`, `qr-chrome`, `sms`. По умолчанию: `qr`. |

**Example:** `max personal setup`

## `max account`

the logged-in account

### `max account show`

Expand Down
2 changes: 1 addition & 1 deletion docs/configuration-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ max config show --json # то же одним объектом

`~/.config/max-cli/config.json` на Linux; пути на других системах — в
[руководстве по настройкам](configuration.md#где-лежит-файл). Первая команда, читающая настройки, —
например `config show`, `account list` или `chats list` — создаёт его с `limit`, `keep_runs_for_days`, `sends_per_hour`, `update_check` и `skill_hint` в `defaults`.
например `config show`, `session list` или `chats list` — создаёт его с `limit`, `keep_runs_for_days`, `sends_per_hour`, `update_check` и `skill_hint` в `defaults`.
Файл создаётся и записывается `max personal config set` с правами `0600`, каталог — `0700`. `max personal doctor`
называет файл или каталог, которые могут читать другие, в `files.problems` и печатает `chmod`, который это исправляет.
`max personal doctor` файл только читает: если его нет, он отвечает `config.found: false` и не создаёт его.
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,18 +7,20 @@ 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.

**930 ✅ · 251 ⛔ · 0 ❌** — 386 commands, 795 options.
**932 ✅ · 251 ⛔ · 0 ❌** — 387 commands, 796 options.

| Command | Option | | Note |
|---|---|---|---|
| `session start` | | ✅ | |
| `session start` | `--answer-stdin` | ✅ | |
| `session start` | `--credential-storage` | ✅ | |
| `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
1 change: 1 addition & 0 deletions docs/mcp.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ MCP и ограничиваются собственными ключами, н
| `chats delete`, `chats clear` | удаляют чат или его историю в аккаунте: через MCP уровень `ask` прошёл бы без вопроса, а в терминале он спрашивает |
| `models chats set` | ослабить правило отправки текста чатов внешней модели может только владелец |
| `store reset` | нужен общий `--yes`, а вызов через MCP его не передаёт |
| `schedule exec` | запускает файл расписания по пути, а агент запускает сохранённое расписание через `schedule run <имя>` |
| `bot uploads put` | читает файл с вашего компьютера |
| `schedule exec` | запускает файл расписания по таймеру; агент запускает сохранённое расписание через `schedule run <name>` |
| `images read` | отдает картинку вашему агенту в терминале (Claude Code или Codex): агент в MCP читает файл по `local_path` сам |
Expand Down
4 changes: 2 additions & 2 deletions docs/profiles.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
| Дать агенту меньше прав, чем у вас | Профиль со своими [правами](permissions.md) |
| Удержать агента в этом профиле | `MAX_PROFILE_LOCK` ([профили во входе и сессиях](sessions.md#профили)) |
| Вести бота MAX рядом с аккаунтом | Профиль бота: `max support bot api get-my-info` |
| Увидеть все профили на этом компьютере | `max account list` |
| Увидеть все профили на этом компьютере | `max session list` |

## Выбрать профиль

Expand All @@ -27,7 +27,7 @@
max work config show
```

`max account list` показывает все профили на этом компьютере и аккаунт каждого;
`max session list` показывает все профили на этом компьютере и аккаунт каждого;
`max work session end` выводит из MAX профиль `work`.

Запись в `profiles.work` в файле настроек действует для этого профиля; `defaults` применяется,
Expand Down
4 changes: 2 additions & 2 deletions docs/sessions.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ MAX_TOKEN="$(cat /path/to/token)" max personal chats list --json

```sh
max personal account show # под кем выполнен вход: id, имя, последние четыре цифры телефона
max account list # все профили на этом компьютере и аккаунт каждого
max session list # все профили на этом компьютере и аккаунт каждого
max personal account sessions list # все устройства и приложения, вошедшие в аккаунт; ничего не завершает
max personal session end # выйти из MAX и забыть токен на этой машине
```
Expand Down Expand Up @@ -195,7 +195,7 @@ export MAX_PROFILE=personal # или на всю сессию оболочки

На компьютере без профилей сообщение говорит, как создать первый: `max personal setup`. Без
профиля работают только команды, которым аккаунт не нужен: `--help`, `--version`, `commands`,
`skill show`, `account list`, `config show`.
`skill show`, `session list`, `config show`.

Если первое слово не команда и команды за ним нет, программа не показывает справку молча, а
говорит, что произошло:
Expand Down
2 changes: 1 addition & 1 deletion docs/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ max personal account show --hide-phone # без номера
```

```sh
max account list # все профили на этом компьютере и аккаунт каждого; в MAX не обращается
max session list # все профили на этом компьютере и аккаунт каждого; в MAX не обращается
```

```sh
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@
"dependencies": {
"@msgpack/msgpack": "3.1.3",
"@wirecat/cli-base": "1.0.0",
"@wirecat/cli-core": "1.0.0",
"@wirecat/cli-core": "1.3.0",
"commander": "15.0.0",
"lossless-json": "4.3.3",
"ogg-opus-decoder": "1.7.5",
Expand Down
10 changes: 5 additions & 5 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion scripts/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ max [профиль] [опции] <команда> <действие> [аргу
**Профиль никогда не подразумевается**: если его не назвать, команда, которой нужен аккаунт,
останавливается и перечисляет профили этого компьютера — даже если профиль один. Первый вход тоже
с именем: \`max personal setup\`. Без профиля работают только команды, которым аккаунт не нужен:
\`--help\`, \`--version\`, \`commands\`, \`skill show\`, \`account list\`, \`config show\`.
\`--help\`, \`--version\`, \`commands\`, \`skill show\`, \`session list\`, \`config show\`.

⚠ Описания команд и опций ниже — ровно те, что печатает \`max --help\`, то есть по-английски. Это
не недоработка перевода: текст живёт в программе, и второй его копии здесь быть не должно.`,
Expand Down
2 changes: 1 addition & 1 deletion skills/max-cli/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ metadata:

**Первое слово — профиль:** `max work chats list` — профиль `work`; флага `--profile` нет. **Профиль не
подразумевается, даже единственный:** без него код `2` и список `error.details.profiles` — спросите владельца,
не берите первый. Без профиля работают `--help`, `commands`, `skill show`, `account list`, `config show`.
не берите первый. Без профиля работают `--help`, `commands`, `skill show`, `session list`, `config show`.
Ниже `personal` — пример. Нет входа (код `4`) — владелец сам запускает `max personal setup` в своём терминале
([setup.md](references/setup.md)).

Expand Down
28 changes: 25 additions & 3 deletions src/account.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -820,14 +820,14 @@ describe("sessions", () => {
})
})

describe("account list", () => {
describe("session list", () => {
it("lists the profiles on this computer without asking MAX", async () => {
const streams = captureStreams()
const code = await run(["a-list", "account", "list", "--json"], {
const code = await run(["a-list", "session", "list", "--json"], {
streams,
tty: false,
connection: () => {
throw new Error("account list asked MAX")
throw new Error("session list asked MAX")
},
})

Expand All @@ -836,4 +836,26 @@ describe("account list", () => {
const listed = JSON.parse(streams.stdout.join("\n"))
expect(JSON.stringify(listed)).toContain("a-list")
})
it("**says a profile with no session is not logged in**, even with --check, asking MAX nothing", async () => {
for (const argv of [
["fresh", "session", "status", "--json"],
["fresh", "session", "status", "--check", "--json"],
]) {
const streams = captureStreams()
const code = await run(argv, {
streams,
tty: false,
connection: () => {
throw new Error("session status asked MAX")
},
})

expect(code).toBe(0)
expect(JSON.parse(streams.stdout.join("\n")).item).toMatchObject({
profile: "fresh",
signed_in: false,
verified: false,
})
}
})
})
3 changes: 3 additions & 0 deletions src/commands/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
answerStdinOption,
itemOf,
logsInOrOut,
messengerSessionCommands,
REMOTE_WRITE,
renderAnswer,
type SignInSteps,
Expand All @@ -17,6 +18,7 @@ import { MAX_APP } from "../app.js"
import { type MaxClientOptions, refuseWhilePaused } from "../client.js"
import { SHELL_OVERRIDES } from "../contract-overrides.js"
import { maskedProfile } from "../domain/map.js"
import { maxMessenger } from "../messenger.js"
import { asFirstWord, commandWords, refuseCommandName, rootOf } from "../profile.js"
import { stopServer } from "../server/server-connection.js"
import { adoptToken } from "../session/adopt.js"
Expand Down Expand Up @@ -142,6 +144,7 @@ const sessionCommandDefinition = (): Command => {
})
})

for (const shared of messengerSessionCommands(maxMessenger)) command.addCommand(shared)
return command
}

Expand Down
Loading
Loading