@agora-build/atem 0.6.18 → 0.7.1

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.
Files changed (2) hide show
  1. package/README.md +109 -28
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @agora-build/atem
2
2
 
3
- A terminal that connects builders, Agora platform, and AI agents. Manage Agora projects and tokens, route tasks between [Astation](https://github.com/Agora-Build/Astation) and AI coding agents, generate diagrams, drive voice-powered coding workflows, and more -- all from a single CLI/TUI.
3
+ A terminal that connects builders, Agora platform, and AI agents. Manage Agora projects and tokens, route tasks between [Astation](https://github.com/Agora-Build/Astation) and AI coding agents, and more -- all from a single CLI/TUI.
4
4
 
5
5
  ## Install
6
6
 
@@ -34,16 +34,18 @@ atem repl # Interactive REPL with AI command inter
34
34
  ```bash
35
35
  atem login # Log in with Agora Console (opens browser)
36
36
  atem logout # Log out from SSO
37
- atem pair # Pair with Astation, then verify this device
37
+ atem status # Account, pairing, verification and credentials (offline, read-only)
38
+ atem pair # Pair with Astation, then verify this device (shows the status when already paired)
38
39
  atem pair --save # Same, and keep credentials for offline use
39
- atem unpair [--yes] # Remove all Astation pairings (asks first)
40
+ atem pair verify # Verify this device with the paired Astation (no re-pairing)
41
+ atem unpair [--yes] # Remove all Astation pairings and saved sessions (asks first)
40
42
  ```
41
43
 
42
44
  `atem login` unlocks a limited set: project list, tokens for the active
43
45
  project, and the dev servers (`serv rtc`, `serv convo`, `serv webhooks`).
44
46
  Pairing with Astation unlocks the full set: vault, sync, memory, skills,
45
- `atem cred`, and Astation-driven remote agent control, voice coding, mark
46
- tasks and diagrams. `serv files`, `config`, and tokens from
47
+ `atem cred`, and Astation-driven terminal viewing, chat and mark
48
+ tasks. `serv files`, `config`, and tokens from
47
49
  `AGORA_APP_ID`/`AGORA_APP_CERTIFICATE` need neither.
48
50
 
49
51
  `atem pair` receives your Agora login from Astation, then verifies the device:
@@ -52,15 +54,23 @@ atem and your Mac each show a 12-character safety code. If they match, type
52
54
  Either side can finish first. atem reads that `y` from the terminal itself,
53
55
  never from piped input or keys typed earlier, so run `atem pair` in an
54
56
  interactive terminal. If verification fails, the pairing stays saved, Astation
55
- is told, and `atem pair` exits nonzero; run it again to verify. A connected or SSO-paired session alone does not
56
- mean the device is verified; check `atem cred status`. With `--save`
57
+ is told, and `atem pair` exits nonzero; run `atem pair verify` to retry. A connected or SSO-paired session alone does not
58
+ mean the device is verified; check `atem status`. With `--save`
57
59
  the credentials keep working when Astation disconnects; without it they stop
58
60
  5 minutes after the disconnect (atem asks when `--save` isn't given).
59
61
 
62
+ Once paired, `atem pair` only prints the status (`Already paired. Verify this
63
+ device: atem pair verify · Replace the pairing: atem unpair, then atem pair`):
64
+ it never pairs again or changes keys, trust or sessions. `atem pair verify`
65
+ verifies the existing pairing on the runtime's Astation link, does nothing when the
66
+ device is already verified, and refuses after a revocation (run `atem unpair`,
67
+ which sets the revoked keys aside, then `atem pair`). `atem status` reads only
68
+ local files and an already running key agent; it never connects, so
69
+ authorization and relay show as `unknown (stale)`.
70
+
60
71
  ### Device keys (`atem cred`)
61
72
 
62
73
  ```bash
63
- atem cred status # Show whether this device is verified, its home Astation and its key agent
64
74
  atem cred unlock # Unlock this device's keys (approve with Touch ID on your Mac)
65
75
  atem cred lock # Wipe unlocked keys and stop the key agent
66
76
  atem cred projects # Send known Git projects to Astation's credential picker (keys must be unlocked)
@@ -68,7 +78,9 @@ atem cred projects # Send known Git projects to Astation's
68
78
 
69
79
  This device's keys are sealed on disk under a storage key that only the paired
70
80
  Mac (the home Astation) holds. `atem cred unlock` asks the Mac for it (Touch
71
- ID) and starts a background `atem key-agent` that holds the keys in memory.
81
+ ID) and starts a background `atem key-agent` that holds the keys in memory;
82
+ on a device no Astation verified it stops with `This device isn't verified.
83
+ Run atem pair verify first.` and never starts pairing or verification.
72
84
  `atem cred lock` wipes them and stops the agent. After upgrading atem, run
73
85
  `atem cred lock` then `atem cred unlock` to pick up the new agent.
74
86
 
@@ -203,7 +215,7 @@ such as timestamps and ciphertext sizes; it is not authoritative for device
203
215
  trust or encryption state. Migration cannot prove that a server erased old
204
216
  plaintext backups.
205
217
 
206
- The device must be verified (`atem pair`) and unlocked (`atem cred unlock`).
218
+ The device must be verified (`atem pair`, or `atem pair verify` to retry) and unlocked (`atem cred unlock`).
207
219
  While it is locked, `atem sync` keeps changes queued. Switching encryption on
208
220
  or off migrates existing data; each verified atem finishes its part at its next
209
221
  `atem cred unlock` (`atem sync` alone doesn't contact Astation). **Turning on**
@@ -226,9 +238,6 @@ atem serv attach 3 # …or by index from `atem serv list`
226
238
  atem serv rtc # Launch RTC test page (HTTPS)
227
239
  atem serv rtc --channel test --port 8443
228
240
  atem serv rtc --background # Run as background daemon
229
- atem serv diagrams # Host diagrams from SQLite (HTTP)
230
- atem serv diagrams --port 9000
231
- atem serv diagrams --background
232
241
  atem serv files ~/docs # Serve a directory or file over HTTPS (Markdown rendered)
233
242
  atem serv files ~/docs --background # Port auto-picked; reused next run
234
243
  atem serv webhooks # Receive Agora webhooks locally (auto-tunneled via ngrok)
@@ -252,8 +261,6 @@ done
252
261
 
253
262
  **`serv rtc`** — RTC test page: join/leave, publish/subscribe audio+video, token generation, RTM messaging, RTC encryption (8 modes; gcm2 modes auto-generate a copyable salt).
254
263
 
255
- **`serv diagrams`** — SQLite-backed HTTP server for hosting AI-generated HTML diagrams.
256
-
257
264
  **`serv files`** — serves a directory (or a single file) over HTTPS. Markdown is rendered to HTML; append `?raw=1` to any URL for the raw bytes. Useful for browsing AI-generated docs on a remote machine.
258
265
 
259
266
  **`serv webhooks`** — local receiver for Agora webhook events (ConvoAI: `agent_joined`, `agent_left`, `agent_history`, `agent_error`, `agent_metrics`, …; RTC NCS events). Validates `Agora-Signature-V2` (HMAC-SHA256) when a `secret` is configured in `webhooks.toml`; accepts unsigned events otherwise with a warning. Live web console at `http://127.0.0.1:9090/` shows incoming events; each event also prints a one-line summary to stdout. Default tunnel provider is **ngrok**; set `tunnel_provider = "cloudflared"` for zero-auth quick tunnels. Use `--no-tunnel` if you're running cloudflared / ngrok separately for stable URLs across atem restarts.
@@ -263,31 +270,48 @@ done
263
270
  ### AI Agents (WIP)
264
271
 
265
272
  ```bash
266
- atem agent list # Scan and list detected AI agents
267
273
  atem agent launch # Open the original Claude Code CLI in an Atem terminal
268
274
  atem agent launch codex # Open the original Codex CLI in an Atem terminal
269
275
  atem agent launch claude --continue # Arguments after the agent type go to that CLI: continue the last Claude session
270
276
  atem agent launch codex resume --last # Continue the last Codex session
271
277
  atem agent launch claude -- --help # Use -- to read the agent's own help
272
- atem agent connect <WS_URL> # Connect to ACP agent and show info
273
- atem agent prompt <WS_URL> "text" # Send prompt to ACP agent
274
- atem agent probe <WS_URL> # Probe URL for ACP support
275
- atem agent visualize "topic" # Generate visual HTML diagram via ACP agent
278
+ atem agent list # The sessions the background runtime holds
279
+ atem agent attach ses-… # Reopen a session (screen restored)
280
+ atem agent stop ses-… # Stop a session
276
281
  ```
277
282
 
278
283
  `atem agent launch [claude|claude-code|codex] [ARGS]...` runs the installed
279
284
  `claude` or `codex` CLI, unchanged, in a full-screen Atem terminal. It uses
280
285
  your working directory and your own login for that CLI. Nothing here replaces
281
- the CLI with an API conversation. It works without Astation. If you are
282
- paired, Astation can view the same session and take control of it (one
283
- viewer per session; while Astation holds control, local typing is refused until you press
284
- the prefix, then `g`). Quitting Atem ends the session.
286
+ the CLI with an API conversation. It works without Astation.
287
+
288
+ Sessions belong to a background `atem runtime` (started on demand, one per
289
+ profile; it exits after 10 minutes with no sessions and no frontends), and each agent runs in its own `atem
290
+ worker` process. Closing the terminal window or hiding it (prefix, then `h`)
291
+ leaves the session running; `atem agent attach` reopens it. Several Claude
292
+ and Codex sessions can run at once, and they keep running if the runtime
293
+ itself restarts. The runtime also holds this machine's one Astation
294
+ connection: `atem pair`, `atem pair verify`, `atem cred unlock` and `atem cred
295
+ projects` run on it (they start the runtime if needed) and never open their
296
+ own, so pairing never disconnects a running session. When an agent that
297
+ printed something ends, its last output and a short summary are saved under
298
+ `~/.config/atem/logs/<session id>/`.
299
+
300
+ If you are paired and verified, Astation can view each session, take control
301
+ of it (one controller at a time, on a lease Astation keeps renewing; typing
302
+ locally takes control back at once), and chat with the agent: sending a
303
+ prompt takes control when nobody holds it (if another device does, Astation
304
+ asks before taking over), the whole retained conversation can be scrolled
305
+ back page by page, and each finished prompt names its reply messages.
306
+ Every remote request names the exact session and speaks atem-session r8
307
+ (Astation must be current: older clients are refused); old `agentInput`,
308
+ `agentPrompt`, voice and `userCommand` messages were removed.
285
309
 
286
310
  Atem's own keys start with a prefix, Ctrl+] by default. Press it, then:
287
311
 
288
312
  | Key | Action |
289
313
  |-----|--------|
290
- | `h` | Hide the terminal; the agent keeps running |
314
+ | `h` or `m` | Hide the terminal; the agent keeps running |
291
315
  | `g` | Take control back locally |
292
316
  | `x` | Stop the agent |
293
317
  | `r` | Redraw the screen |
@@ -295,20 +319,77 @@ Atem's own keys start with a prefix, Ctrl+] by default. Press it, then:
295
319
  | `c` | Copy the visible text (tmux buffer inside tmux, otherwise OSC 52) |
296
320
  | `?` | Help and recent notices |
297
321
 
322
+ The bottom row reads, for example,
323
+ `Atem | Claude | Local | Astation ✓ | Notice | Ctrl+] then ?:help`:
324
+
325
+ - `Claude` or `Codex` is the agent on screen.
326
+ - `Local` means your keyboard drives the agent; `Remote` means Astation holds
327
+ control. Typing takes it back (prefix, then `g`, does it without typing).
328
+ - `Astation ✓` means the runtime's Astation link is authenticated; `Astation
329
+ ✗` means none (not paired, Astation unreachable, or re-authenticating).
330
+ Every reconnect or re-authentication is a new remote attachment: Astation
331
+ views again and asks for control again.
332
+ - `Notice` appears once Atem has recorded a warning or status message. Press
333
+ the prefix, then `?`, to read the recent notices (newest first).
334
+
298
335
  Press the prefix twice to send it to the agent. To change it, set
299
336
  `terminal_prefix = "Ctrl-a"` in `~/.config/atem/config.toml`, or
300
337
  `ATEM_TERMINAL_PREFIX` (which wins over the file). Ctrl+], Ctrl+\ or
301
338
  Ctrl+<letter> other than i or m are accepted. The `CLAUDE_CLI_BIN`/`CLAUDE_CLI_ARGS`
302
339
  and `CODEX_CLI_BIN`/`CODEX_CLI_ARGS` variables still override the command.
303
- See [`designs/terminal-v1-implementation.md`](https://github.com/Agora-Build/Atem/blob/main/designs/terminal-v1-implementation.md).
340
+ See [`designs/agent-runtime.md`](https://github.com/Agora-Build/Atem/blob/main/designs/agent-runtime.md).
341
+
342
+ **Chat from Astation.** Astation can open a chat view of a Claude session
343
+ launched with `atem agent launch claude`: your prompts appear as messages and
344
+ Claude's replies come from its own session log, with a status of ready,
345
+ working, waiting or unknown. Atem adds its hooks with `--settings` for that run
346
+ only; your `~/.claude` settings are not changed. A prompt sent from chat needs
347
+ control of the session, is typed into Claude once, and is reported as
348
+ accepted, then complete (or failed) when Claude's turn ends.
349
+ Codex works the same way once you allow Atem's Codex hooks (asked
350
+ once on the first `atem agent launch codex`, see below): Atem reads Codex's
351
+ own session log, so Codex shows ready, working, waiting or unknown. Codex
352
+ reports nothing before its first prompt, so type the first prompt in the
353
+ terminal; after that chat prompts work. Replies arrive whole (no streaming),
354
+ and Codex's chat has no reasoning text or error details.
355
+ Interrupt from chat stops a running turn only. See
356
+ [`designs/agent-chat-host.md`](https://github.com/Agora-Build/Atem/blob/main/designs/agent-chat-host.md).
357
+
358
+ **Approve prompts from Astation and your phone.** When Claude Code or Codex
359
+ asks for permission to run a tool, Astation shows the request as a card (in
360
+ a Claude chat view too) and Atem asks the relay to notify your devices
361
+ with control. A card shows the tool and a short summary — the command's first
362
+ line or the file path, never file contents — and offers **Allow once**,
363
+ **Always allow** (Claude: one of the rules Claude itself suggests, with where
364
+ it is saved; Codex, for shell commands only: **Always allow this command** —
365
+ exactly this command in this folder, for the rest of this Codex process, kept
366
+ by Atem; later runs of
367
+ the very same command are allowed without asking and show as "auto allowed",
368
+ and the rule can be revoked from Astation) or **Deny** (with an optional
369
+ note for the agent).
370
+ Answering needs no control of the session: any of your devices that can
371
+ control it answers, whoever is typing, and the first answer wins. The
372
+ finished card shows how it ended. The terminal can
373
+ always answer instead: Claude keeps its own dialog on screen (the first
374
+ answer wins), and for Codex any key you type in the terminal hands the
375
+ prompt back to Codex's own dialog. If nobody answers, nothing is allowed:
376
+ after the hook's wait (Claude 10 min, Codex 5 min) the agent asks in the
377
+ terminal as usual. Claude gets the hook with `--settings` for each launch;
378
+ to turn it off, set `approvals_hook = false` under `[claude]` in
379
+ `~/.config/atem/config.toml` (Claude sessions launched afterwards keep their
380
+ prompts in the terminal).
381
+ The first `atem agent launch codex` asks once whether to add Atem's hooks
382
+ (one per Codex event, for approvals and chat) to `~/.codex/hooks.json`, after
383
+ your own (a backup is kept as `hooks.json.atem-bak`); to turn them off later,
384
+ set `hooks = false` under `[codex]` in `~/.config/atem/config.toml` — the next
385
+ `atem agent launch codex` removes them. See §6a and the r8 appendix of the [session protocol](https://github.com/Agora-Build/Atem/blob/main/designs/protocol/atem-session-v1.md).
304
386
 
305
387
  ## TUI Modes
306
388
 
307
389
  | Mode | Description |
308
390
  |------|-------------|
309
391
  | **Main Menu** | Navigate between features |
310
- | **Claude Chat** | Claude Code CLI integration via PTY |
311
- | **Codex Chat** | Codex terminal integration via PTY |
392
+ | **Agent Sessions** | The runtime's Claude/Codex sessions: launch or attach |
312
393
  | **Token Gen** | Generate Agora RTC/RTM tokens locally |
313
394
  | **Projects** | Browse Agora projects via API |
314
395
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agora-build/atem",
3
- "version": "0.6.18",
3
+ "version": "0.7.1",
4
4
  "description": "A terminal that connects people, Agora platform, and AI agents.",
5
5
  "bin": {
6
6
  "atem": "bin/atem"