aethralive 0.2.0 → 0.3.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.
package/README.md CHANGED
@@ -1,121 +1,146 @@
1
- # AethraLive
2
-
3
- Actual coding-agent activity in your private Telegram chat: readable streaming replies, expandable thoughts and tool cards, full output attachments, and automatic pause when a run stops. No AI summaries and no remote agent control.
4
-
5
- Formerly CodeRemote. The bot is [@AethraLiveBot](https://t.me/AethraLiveBot); its username is discovered from the relay token. This project is not published to npm or publicly hosted yet. Use the local commands until publication.
6
-
7
- ## Run locally (relay owner only)
8
-
9
- Requires Node.js 24+, a supported source, and one Telegram bot from [BotFather](https://t.me/BotFather). The bot and token are configured **once by the relay owner**; do not ask every AethraLive user to create a bot.
10
-
11
- ```powershell
12
- npm.cmd install
13
- npm.cmd run build
14
- # First setup only: do not overwrite an existing configured .env
15
- Copy-Item .env.example .env
16
- ```
17
-
18
- Save `TELEGRAM_BOT_TOKEN` directly in the relay owner's `.env`. Never commit, embed, or distribute it. Start the single shared relay:
19
-
20
- ```powershell
21
- npm.cmd run relay
22
- ```
23
-
24
- In another terminal, with your coding agent running:
25
-
26
- ```powershell
27
- npm.cmd start
28
- ```
29
-
30
- On first run, the terminal shows a unique QR code, a clickable Telegram pairing link, and the path to a QR image **before looking for an agent**. Scan the QR or open the link and tap Start. Then choose your agent/session. If `t.me` is inaccessible, open the bot in Telegram and send the exact `/start TOKEN` command printed in the terminal. Pairings expire in ten minutes and work once. Used/expired QR images are removed when the command finishes.
31
-
32
- Use `npm.cmd start -- connect` (or `aethralive connect` after installation) to pair by itself without an agent installed/running. Already-paired installations show their bot link and keep their existing pairing; no fresh QR is required. Installation does not launch a hidden postinstall process: users explicitly run `npx aethralive` or the installed `aethralive` command.
33
-
34
- For public distribution, deploy this one shared relay behind HTTPS and give users its URL. During development it defaults to `http://127.0.0.1:8787`, which is reachable only from the same computer. Other users must supply your hosted address with `--relay` or `AETHRALIVE_RELAY`. End users do not need BotFather, a bot token, or a second relay.
35
-
36
- The relay holds the bot token and determines the recipient from the authenticated device. Each user's chat is isolated. Run only one relay/update receiver for a bot.
37
-
38
- ## Install as an end user
39
-
40
- End users only need Node.js and the package/repository:
41
-
42
- ```powershell
43
- npm.cmd install
44
- npm.cmd run build
45
- npm.cmd start -- connect --relay https://YOUR-HOSTED-RELAY
46
- ```
47
-
48
- The command prints a QR code and pairing link. Scan it with Telegram and tap **Start**. Each installation gets its own pairing credential and receives only its own agent activity, while all users continue using the same shared bot. Never copy the relay owner's `.env` or `TELEGRAM_BOT_TOKEN` to an end-user machine.
49
-
50
- ## Agents and commands
51
-
52
- ```powershell
53
- npm.cmd start -- --agent opencode --session SESSION_ID
54
- npm.cmd start -- --agent codex
55
- npm.cmd start -- --agent jsonl --events ./agent-events.jsonl --session external
56
- npm.cmd start -- agents
57
- npm.cmd start -- connect
58
- npm.cmd start -- status
59
- npm.cmd start -- stop
60
- npm.cmd start -- unpair
61
- ```
62
-
63
- `npm.cmd start` loads `.env`. Direct `node dist/cli.js` uses shell environment variables. Use `AETHRALIVE_HOME` or `--home DIR` consistently; the default is `~/.aethralive`. Previous CodeRemote state can be reused by pointing this variable to its previous directory. One foreground watcher runs per home directory. `stop` stops monitoring without stopping your agent or revoking pairing. `unpair` revokes this device; Telegram `/revoke` revokes all devices belonging to that sender.
64
-
65
- **OpenCode:** discovers an existing OpenCode v2.3.x background service through the official client. It never starts another agent session. `--opencode-url URL` selects an explicit existing endpoint; `OPENCODE_TOKEN` supplies optional bearer authentication. Source events are live-only and session/descendant scoped. Filesystem/global events without session attribution are not guessed or forwarded.
66
-
67
- **Codex:** discovers recent logs in `$CODEX_HOME/sessions` (default `~/.codex/sessions`). `--events FILE` selects an explicit Codex log. It tails newly appended assistant messages, exposed reasoning summaries, tool calls/results, and task lifecycle. Encrypted reasoning, instructions and duplicate agent-message records are ignored. This is an experimental local-log adapter verified against installed records, not an official streaming API. Text timing depends on when Codex writes its log; token-by-token output is not guaranteed.
68
-
69
- **Other agents:** `--agent jsonl` tails a file supplied by another integration. That integration writes the neutral `Activity` contract from `src/activity.ts`, for example:
70
-
71
- ```json
72
- {"agent":"My agent","session":"external","kind":"status","id":"run-1","state":"Running"}
73
- {"agent":"My agent","session":"external","kind":"text","id":"reply-1","phase":"delta","text":"Actual streamed text"}
74
- {"agent":"My agent","session":"external","kind":"tool","id":"tool-1","title":"Read","input":"src/main.ts","state":"Running"}
75
- {"agent":"My agent","session":"external","kind":"tool","id":"tool-1","text":"Actual file contents","state":"Completed"}
76
- {"agent":"My agent","session":"external","kind":"status","id":"run-1","state":"Stopped"}
77
- ```
78
-
79
- Kinds are `text`, `thought`, `tool`, `status`, and `notice`. Text phases are `start`, `delta`, and `end`; block IDs identify the same logical message or tool across updates. Lifecycle states include `Running`, `Completed`, `Failed`, `Idle`, `Stopped`, and `Offline`. The source must emit lifecycle signals to enable automatic stop detection. Antigravity and other editors need a source adapter/feed; they are not automatically observable just because they are installed.
80
-
81
- ## Presentation and lifecycle
82
-
83
- - Assistant text appears directly. IDs, JSON envelopes, model metadata, usage accounting, and lifecycle bookkeeping never appear as chat messages.
84
- - Thoughts and tool inputs/results use native expandable Telegram block quotations. Tool start, input, and completion update the same card. End events finalize streamed blocks without repeating their full content.
85
- - Text continues in a new message after 3,600 UTF-16 units, preserving Unicode pairs. Consecutive queued updates for the same message combine mechanically without summarizing content.
86
- - Large tool outputs become `.txt` attachments containing actual output. Files larger than 512 KiB split into byte parts; concatenate them numerically to recover the full content. Source HTML is escaped before relay-generated formatting is applied.
87
- - Interrupting a run, an unfinished run becoming idle, or a source disconnection cancels pending presentation for that run. Late tool/text events are suppressed. Pairing and monitoring remain alive; the next root Running event resumes delivery. Successful completion preserves its final reply.
88
- - The relay enforces per-device delivery generations and cancels an in-flight request when the generation changes. A message Telegram already accepted cannot be recalled by cancelling its request.
89
- - Closing a TUI alone does not mean its shared background service stopped working. State reflects the actual agent session, not whether a window is visible.
90
- - Telegram API throttling remains in effect. Active-run deliveries retry after `retry_after`; interruption supersedes the old queue. Detailed rate-limit tuning is deferred.
91
-
92
- ## Status widgets
93
-
94
- Private native status cards show the current agent, latest observed state, device, observation time and expandable session details. The fixed HTML uses Telegram theme variables and system fonts with no network access. `sendWidget` creates a card and `editMessageWidgetData` updates message-specific `chat_data`; no session content is published as shared widget data.
95
-
96
- Set `AETHRALIVE_WIDGETS=false` on the relay to use a regular editable status message. Unsupported requests (Bot API 400/404) disable widgets for that device and automatically fall back to that readable status message. Re-pair to retry native widgets after upgrading the API. Older Telegram clients may show unsupported media; expandable thought/tool blocks remain independent of widget support. A timestamp is an observation, not a heartbeat.
97
-
98
- `node scripts/widget-preview.mjs` generates local light/dark previews. Tests check Telegram HTML/compression/state limits and the local details toggle. A real Telegram client is needed to verify native rendering.
99
-
100
- ## Storage, reconnects and privacy
101
-
102
- Raw events are flushed to local `events.jsonl` before delivery. The checkpoint saves presentation state after acknowledgement. An active run can resume delivery through network failures. Interrupting or restarting the watcher intentionally skips old pending presentation while preserving the local archive. A torn final append is repaired; completed corrupt records fail loudly. Unknown agent events stay local until an adapter gives them presentation semantics.
103
-
104
- The relay SQLite database stores pairing ownership, hashed credentials, revocation, message IDs, operation hashes, delivery generations, and the polling offset. It does not store code or chat-history payloads. The relay handles outgoing contents transiently; Telegram stores delivered messages. Protect local files with OS permissions, including Windows ACLs.
105
-
106
- Delivery is at least once. A crash after Telegram accepts a message but before its receipt is committed can duplicate that message. Local logs and receipt metadata currently have no automatic retention policy.
107
-
108
- ## Deploy and validate
109
-
110
- Use one always-on Node process behind HTTPS, with persistent SQLite storage configured through `AETHRALIVE_DB`. Set `AETHRALIVE_HOST=0.0.0.0` only inside the intended private container/network and proxy it securely. CLI remote URLs must use HTTPS. Monitor `/health`, disk space and sanitized logs. Disable request-body/Authorization logging at the proxy. The relay caps JSON requests at 2 MiB and queued operations at 100.
111
-
112
- Polling is the development default. For webhooks, set `TELEGRAM_MODE=webhook`, generate `TELEGRAM_WEBHOOK_SECRET` (32–256 URL-safe characters), and explicitly register `/telegram/webhook` through Telegram's `setWebhook` with the same `secret_token` and `allowed_updates: ["message"]`. Polling refuses to run while a webhook exists. Back up SQLite using SQLite-aware backup or a stopped process.
113
-
114
- ```powershell
115
- npm.cmd test
116
- npm.cmd pack
117
- ```
118
-
119
- Tests use temporary databases and fake sources/Telegram transport, including the actual CLI subprocess. They cover readable streaming, Unicode continuation, attachments, lifecycle cancellation, queue races, account isolation, pairing persistence, and alternate adapters. The package excludes local history, tokens, databases, tests and the source transcript. Publishing and hosting are separate operations.
120
-
121
- Sources: [OpenCode client](https://opencode.ai/docs/build/client/), [Telegram Bot API](https://core.telegram.org/bots/api).
1
+ # AethraLive
2
+
3
+ Actual coding-agent activity in your private Telegram chat: readable streaming replies, expandable thoughts and tool cards, full output attachments, and automatic pause when a run stops. Send the next task from Telegram to your selected OpenCode session. Activity is forwarded without AI summaries.
4
+
5
+ Formerly CodeRemote. All users share [@AethraLiveBot](https://t.me/AethraLiveBot), with separate private pairings. The shared relay is hosted on Convex at `https://standing-armadillo-358.convex.site`. The CLI is published as [`aethralive`](https://www.npmjs.com/package/aethralive).
6
+
7
+ ## Start using AethraLive
8
+
9
+ Requires Node.js 24+ and an existing supported coding agent. Run:
10
+
11
+ ```powershell
12
+ npx.cmd aethralive
13
+ ```
14
+
15
+ Scan the QR code or open the pairing link, tap **Start** in Telegram, then select your OpenCode session. Keep the watcher and OpenCode running. Send a message in Telegram to queue the next task in that same session; its activity streams back here. With multiple active devices, send `/devices` and choose one with `/use <device-id>`. End users do not need a bot token, a separate bot, a server, or a relay URL.
16
+
17
+ For a global installation, use `npm.cmd install --global aethralive`, then `aethralive`. Codex and JSONL currently support viewing activity only; Telegram task submission is implemented for OpenCode.
18
+
19
+ Existing installations retain their saved relay. If you intentionally want to move an older local pairing to the shared bot, stop its watcher, run `aethralive unpair`, then pair again with `aethralive connect`. A self-hosted relay remains supported through `--relay`.
20
+
21
+ ## Run locally (relay owner only)
22
+
23
+ Requires Node.js 24+, a supported source, and one Telegram bot from [BotFather](https://t.me/BotFather). The bot and token are configured **once by the relay owner**; do not ask every AethraLive user to create a bot.
24
+
25
+ ```powershell
26
+ npm.cmd install
27
+ npm.cmd run build
28
+ # First setup only: do not overwrite an existing configured .env
29
+ Copy-Item .env.example .env
30
+ ```
31
+
32
+ Save `TELEGRAM_BOT_TOKEN` directly in the relay owner's `.env`. Never commit, embed, or distribute it. Start the single shared relay:
33
+
34
+ ```powershell
35
+ npm.cmd run relay
36
+ ```
37
+
38
+ In another terminal, with your coding agent running:
39
+
40
+ ```powershell
41
+ npm.cmd start
42
+ ```
43
+
44
+ On first run, the terminal shows a unique QR code, a clickable Telegram pairing link, and the path to a QR image **before looking for an agent**. Scan the QR or open the link and tap Start. Then choose your agent/session. If `t.me` is inaccessible, open the bot in Telegram and send the exact `/start TOKEN` command printed in the terminal. Pairings expire in ten minutes and work once. Used/expired QR images are removed when the command finishes.
45
+
46
+ Use `npm.cmd start -- connect` (or `aethralive connect` after installation) to pair by itself without an agent installed/running. Already-paired installations show their bot link and keep their existing pairing; no fresh QR is required. Installation does not launch a hidden postinstall process: users explicitly run `npx aethralive` or the installed `aethralive` command.
47
+
48
+ The published CLI defaults to the shared Convex relay. When testing a local owner relay, select it explicitly with `--relay http://127.0.0.1:8787` or `AETHRALIVE_RELAY`. End users do not need BotFather, a bot token, or a second relay.
49
+
50
+ The relay holds the bot token and determines the recipient from the authenticated device. Each user's chat is isolated. Run only one relay/update receiver for a bot.
51
+
52
+ ## Install as an end user
53
+
54
+ End users only need Node.js and the published package:
55
+
56
+ ```powershell
57
+ npm.cmd install --global aethralive
58
+ aethralive connect
59
+ ```
60
+
61
+ The command prints a QR code and pairing link. Scan it with Telegram and tap **Start**. Each installation gets its own pairing credential and receives only its own agent activity, while all users continue using the same shared bot. Never copy the relay owner's `.env` or `TELEGRAM_BOT_TOKEN` to an end-user machine.
62
+
63
+ ## Agents and commands
64
+
65
+ ```powershell
66
+ npm.cmd start -- --agent opencode --session SESSION_ID
67
+ npm.cmd start -- --agent codex
68
+ npm.cmd start -- --agent jsonl --events ./agent-events.jsonl --session external
69
+ npm.cmd start -- agents
70
+ npm.cmd start -- connect
71
+ npm.cmd start -- status
72
+ npm.cmd start -- stop
73
+ npm.cmd start -- unpair
74
+ ```
75
+
76
+ `npm.cmd start` loads `.env`. Direct `node dist/cli.js` uses shell environment variables. Use `AETHRALIVE_HOME` or `--home DIR` consistently; the default is `~/.aethralive`. Previous CodeRemote state can be reused by pointing this variable to its previous directory. One foreground watcher runs per home directory. `stop` stops monitoring without stopping your agent or revoking pairing. `unpair` revokes this device; Telegram `/revoke` revokes all devices belonging to that sender.
77
+
78
+ **OpenCode:** discovers an existing OpenCode v2.3.x background service through the official client. It never starts another agent session. `--opencode-url URL` selects an explicit existing endpoint; `OPENCODE_TOKEN` supplies optional bearer authentication. Source events are live-only and session/descendant scoped. Filesystem/global events without session attribution are not guessed or forwarded.
79
+
80
+ **Codex:** discovers recent logs in `$CODEX_HOME/sessions` (default `~/.codex/sessions`). `--events FILE` selects an explicit Codex log. It tails newly appended assistant messages, exposed reasoning summaries, tool calls/results, and task lifecycle. Encrypted reasoning, instructions and duplicate agent-message records are ignored. This is an experimental local-log adapter verified against installed records, not an official streaming API. Text timing depends on when Codex writes its log; token-by-token output is not guaranteed.
81
+
82
+ **Other agents:** `--agent jsonl` tails a file supplied by another integration. That integration writes the neutral `Activity` contract from `src/activity.ts`, for example:
83
+
84
+ ```json
85
+ {"agent":"My agent","session":"external","kind":"status","id":"run-1","state":"Running"}
86
+ {"agent":"My agent","session":"external","kind":"text","id":"reply-1","phase":"delta","text":"Actual streamed text"}
87
+ {"agent":"My agent","session":"external","kind":"tool","id":"tool-1","title":"Read","input":"src/main.ts","state":"Running"}
88
+ {"agent":"My agent","session":"external","kind":"tool","id":"tool-1","text":"Actual file contents","state":"Completed"}
89
+ {"agent":"My agent","session":"external","kind":"status","id":"run-1","state":"Stopped"}
90
+ ```
91
+
92
+ Kinds are `text`, `thought`, `tool`, `status`, and `notice`. Text phases are `start`, `delta`, and `end`; block IDs identify the same logical message or tool across updates. Lifecycle states include `Running`, `Completed`, `Failed`, `Idle`, `Stopped`, and `Offline`. The source must emit lifecycle signals to enable automatic stop detection. Antigravity and other editors need a source adapter/feed; they are not automatically observable just because they are installed.
93
+
94
+ ## Presentation and lifecycle
95
+
96
+ - Assistant text appears directly. IDs, JSON envelopes, model metadata, usage accounting, and lifecycle bookkeeping never appear as chat messages.
97
+ - Thoughts and tool inputs/results use native expandable Telegram block quotations. Tool start, input, and completion update the same card. End events finalize streamed blocks without repeating their full content.
98
+ - Text continues in a new message after 3,600 UTF-16 units, preserving Unicode pairs. Consecutive queued updates for the same message combine mechanically without summarizing content.
99
+ - Large tool outputs become `.txt` attachments containing actual output. Files larger than 512 KiB split into byte parts; concatenate them numerically to recover the full content. Source HTML is escaped before relay-generated formatting is applied.
100
+ - Interrupting a run, an unfinished run becoming idle, or a source disconnection cancels pending presentation for that run. Late tool/text events are suppressed. Pairing and monitoring remain alive; the next root Running event resumes delivery. Successful completion preserves its final reply.
101
+ - The relay enforces per-device delivery generations and cancels an in-flight request when the generation changes. A message Telegram already accepted cannot be recalled by cancelling its request.
102
+ - Closing a TUI alone does not mean its shared background service stopped working. State reflects the actual agent session, not whether a window is visible.
103
+ - Telegram API throttling remains in effect. Active-run deliveries retry after `retry_after`; interruption supersedes the old queue. Detailed rate-limit tuning is deferred.
104
+
105
+ ## Ghost Mode (Windows, reversible)
106
+
107
+ `/ghost on` from Telegram (or `aethralive ghost on`) keeps the laptop awake with the lid closed, so the agent keeps running and the chat stays live. It temporarily sets three Windows power values — lid-close action, automatic sleep timer and automatic hibernate timer — to "do nothing", for **both** plugged-in (AC) and battery (DC). Nothing else changes: no OpenCode configuration, no files, no drivers.
108
+
109
+ - **Originals saved first.** Before changing anything, the current AC and DC values of all three settings are stored in `ghost.json` inside the AethraLive home directory. `/ghost off` restores those exact values and deletes the marker.
110
+ - **Refusal over guessing.** If any current value cannot be read (hidden setting, localized output), Ghost Mode refuses to enable and changes nothing.
111
+ - **Recovery agent.** Two per-user scheduled tasks (logon + every 5 minutes) run `aethralive-ghost-recovery`, which restores the originals when the watcher process is dead, the session expired, or the laptop was shut down mid-session — Windows never reverts `powercfg` changes by itself across a reboot. `aethralive ghost install|remove` manages the tasks; they are installed automatically on the first `/ghost on`.
112
+ - **8-hour expiry.** The marker expires after 8 hours; the recovery agent restores the originals even if the chat is unreachable.
113
+ - **Heat warning.** Every enable reply warns: hard surface, vents clear, never inside a bag — a running laptop with a closed lid builds heat.
114
+
115
+ CLI: `aethralive ghost on|off|status|install|remove`. `/ghost status` shows the expiry time and the saved originals.
116
+
117
+ ## Status widgets
118
+
119
+ Private native status cards show the current agent, latest observed state, device, observation time and expandable session details. The fixed HTML uses Telegram theme variables and system fonts with no network access. `sendWidget` creates a card and `editMessageWidgetData` updates message-specific `chat_data`; no session content is published as shared widget data.
120
+
121
+ Set `AETHRALIVE_WIDGETS=false` on the relay to use a regular editable status message. Unsupported requests (Bot API 400/404) disable widgets for that device and automatically fall back to that readable status message. Re-pair to retry native widgets after upgrading the API. Older Telegram clients may show unsupported media; expandable thought/tool blocks remain independent of widget support. A timestamp is an observation, not a heartbeat.
122
+
123
+ `node scripts/widget-preview.mjs` generates local light/dark previews. Tests check Telegram HTML/compression/state limits and the local details toggle. A real Telegram client is needed to verify native rendering.
124
+
125
+ ## Storage, reconnects and privacy
126
+
127
+ Raw events are flushed to local `events.jsonl` before delivery. The checkpoint saves presentation state after acknowledgement. An active run can resume delivery through network failures. Interrupting or restarting the watcher intentionally skips old pending presentation while preserving the local archive. A torn final append is repaired; completed corrupt records fail loudly. Unknown agent events stay local until an adapter gives them presentation semantics.
128
+
129
+ The relay SQLite database stores pairing ownership, hashed credentials, revocation, message IDs, operation hashes, delivery generations, and the polling offset. It does not store code or chat-history payloads. The relay handles outgoing contents transiently; Telegram stores delivered messages. Protect local files with OS permissions, including Windows ACLs.
130
+
131
+ Delivery is at least once. A crash after Telegram accepts a message but before its receipt is committed can duplicate that message. Local logs and receipt metadata currently have no automatic retention policy.
132
+
133
+ ## Deploy and validate
134
+
135
+ Use one always-on Node process behind HTTPS, with persistent SQLite storage configured through `AETHRALIVE_DB`. Set `AETHRALIVE_HOST=0.0.0.0` only inside the intended private container/network and proxy it securely. CLI remote URLs must use HTTPS. Monitor `/health`, disk space and sanitized logs. Disable request-body/Authorization logging at the proxy. The relay caps JSON requests at 2 MiB and queued operations at 100.
136
+
137
+ Polling is the development default. For webhooks, set `TELEGRAM_MODE=webhook`, generate `TELEGRAM_WEBHOOK_SECRET` (32–256 URL-safe characters), and explicitly register `/telegram/webhook` through Telegram's `setWebhook` with the same `secret_token` and `allowed_updates: ["message"]`. Polling refuses to run while a webhook exists. Back up SQLite using SQLite-aware backup or a stopped process.
138
+
139
+ ```powershell
140
+ npm.cmd test
141
+ npm.cmd pack
142
+ ```
143
+
144
+ Tests use temporary databases and fake sources/Telegram transport, including the actual CLI subprocess. They cover readable streaming, Unicode continuation, attachments, lifecycle cancellation, queue races, account isolation, pairing persistence, and alternate adapters. The package excludes local history, tokens, databases, tests and the source transcript. Publishing and hosting are separate operations.
145
+
146
+ Sources: [OpenCode client](https://opencode.ai/docs/build/client/), [Telegram Bot API](https://core.telegram.org/bots/api).
package/dist/adapter.d.ts CHANGED
@@ -1,11 +1,14 @@
1
1
  import { OpenCode } from '@opencode/client';
2
2
  import type { RawEvent } from './protocol.js';
3
+ import { type ControlResult } from './controls.js';
3
4
  export interface AgentAdapter {
4
5
  sessions(): Promise<{
5
6
  id: string;
6
7
  name: string;
7
8
  }[]>;
8
- watch(session: string, signal: AbortSignal): AsyncIterable<RawEvent>;
9
+ watch(session: string, signal: AbortSignal, onReady?: () => void): AsyncIterable<RawEvent>;
10
+ prompt?(session: string, text: string, signal: AbortSignal): Promise<void>;
11
+ control?(session: string, command: string, signal: AbortSignal): Promise<ControlResult>;
9
12
  }
10
13
  export declare function openCodeAdapter(url?: string): Promise<AgentAdapter>;
11
- export declare function fromClient(client: Pick<ReturnType<typeof OpenCode.make>, 'session' | 'event'>): AgentAdapter;
14
+ export declare function fromClient(client: Pick<ReturnType<typeof OpenCode.make>, 'session' | 'event'> & Partial<ReturnType<typeof OpenCode.make>>): AgentAdapter;
package/dist/adapter.js CHANGED
@@ -2,6 +2,7 @@ import { OpenCode } from '@opencode/client';
2
2
  import { Service } from '@opencode/client/service';
3
3
  import { setTimeout as delay } from 'node:timers/promises';
4
4
  import { openCodeActivity } from './activity.js';
5
+ import { openCodeControls } from './controls.js';
5
6
  export async function openCodeAdapter(url) {
6
7
  const endpoint = url ? undefined : await Service.discover();
7
8
  if (!url && !endpoint)
@@ -13,6 +14,10 @@ export async function openCodeAdapter(url) {
13
14
  export function fromClient(client) {
14
15
  const parents = new Map();
15
16
  return {
17
+ control: openCodeControls(client),
18
+ async prompt(session, text, signal) {
19
+ await client.session.prompt({ sessionID: session, text, delivery: 'queue' }, { signal });
20
+ },
16
21
  async sessions() {
17
22
  const sessions = [];
18
23
  let cursor;
@@ -26,7 +31,7 @@ export function fromClient(client) {
26
31
  } while (cursor);
27
32
  return sessions;
28
33
  },
29
- async *watch(session, signal) {
34
+ async *watch(session, signal, onReady) {
30
35
  let disconnected = false;
31
36
  while (!signal.aborted) {
32
37
  try {
@@ -36,6 +41,7 @@ export function fromClient(client) {
36
41
  const raw = event;
37
42
  if (raw.type === 'server.connected') {
38
43
  disconnected = false;
44
+ onReady?.();
39
45
  if (typeof client.session.get === 'function') {
40
46
  try {
41
47
  const info = await client.session.get({ sessionID: session }, { signal });
@@ -1 +1 @@
1
- {"version":3,"file":"adapter.js","sourceRoot":"","sources":["../src/adapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AACnD,OAAO,EAAE,UAAU,IAAI,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAE3D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,OAAO;oBAAE,OAAO;gBAC3B,IAAI,CAAC,YAAY;oBAAE,MAAM,EAAE,IAAI,EAAE,wBAAwB,EAAE,OAAO,EAAE,IAAI,CAAC,GAAG,EAAE,EAAE,IAAI,EAAE,EAAE,SAAS,EAAE,OAAO;4BACxG,MAAM,EAAE,8GAA8G,EAAE,EAAE,CAAC;gBAC7H,YAAY,GAAG,IAAI,CAAC;gBACpB,MAAM,KAAK,CAAC,IAAI,EAAE,SAAS,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;YAC3D,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC"}
package/dist/cli.js CHANGED
@@ -10,6 +10,8 @@ import QRCode from 'qrcode';
10
10
  import { Journal, readJson, saveJson } from './local.js';
11
11
  import { agentAdapter, AGENTS } from './agents.js';
12
12
  import { LiveQueue } from './lifecycle.js';
13
+ import { ghostOn, ghostOff, ghostStatus, handleGhost } from './ghost.js';
14
+ import { installTasks, removeTasks, taskStatus } from './ghost-tasks.js';
13
15
  class ApiError extends Error {
14
16
  status;
15
17
  retryAfter;
@@ -48,7 +50,7 @@ async function main() {
48
50
  console.log(AGENTS.join('\n'));
49
51
  return;
50
52
  }
51
- if (!['watch', 'connect', 'status', 'stop', 'unpair'].includes(command))
53
+ if (!['watch', 'connect', 'status', 'stop', 'unpair', 'ghost'].includes(command))
52
54
  throw new Error(`Unknown command: ${command}`);
53
55
  const directory = resolve(values.home ?? process.env.AETHRALIVE_HOME ?? join(homedir(), '.aethralive'));
54
56
  mkdirSync(directory, { recursive: true, mode: 0o700 });
@@ -84,6 +86,22 @@ async function main() {
84
86
  console.log('No watcher is running.');
85
87
  return;
86
88
  }
89
+ if (command === 'ghost') {
90
+ const action = (positionals[1] ?? 'status').toLowerCase();
91
+ if (!['on', 'off', 'status', 'install', 'remove'].includes(action))
92
+ throw new Error(`Unknown ghost action: ${action}. Use on, off, status, install or remove.`);
93
+ if (action === 'install')
94
+ console.log(await installTasks(directory));
95
+ else if (action === 'remove')
96
+ console.log(await removeTasks());
97
+ else if (action === 'status')
98
+ console.log(`${await ghostStatus(directory)}\n${await taskStatus()}`);
99
+ else {
100
+ const context = { home: directory, pid: running && lock ? lock.pid : process.pid, instance: lock?.instance ?? 'manual' };
101
+ console.log(action === 'on' ? await ghostOn(directory, context) : await ghostOff(directory));
102
+ }
103
+ return;
104
+ }
87
105
  if (command === 'connect' && running) {
88
106
  if (!config)
89
107
  throw new Error('Pairing is already waiting in the original terminal. Use its QR code or link.');
@@ -133,7 +151,7 @@ async function main() {
133
151
  }
134
152
  }
135
153
  if (!config) {
136
- const relay = secureRelay(values.relay ?? process.env.AETHRALIVE_RELAY ?? 'http://127.0.0.1:8787');
154
+ const relay = secureRelay(values.relay ?? process.env.AETHRALIVE_RELAY ?? 'https://standing-armadillo-358.convex.site');
137
155
  const pairing = await request(relay, '/pairings', 'POST', undefined, { name: values.name ?? hostname() }, abort.signal);
138
156
  const qrPath = join(directory, 'pairing.png');
139
157
  await QRCode.toFile(qrPath, pairing.url, { width: 360, margin: 2 });
@@ -201,6 +219,97 @@ async function main() {
201
219
  live.receive({ type: 'activity', created: Date.now(), activity: { agent: agent === 'opencode' ? 'OpenCode' : agent === 'codex' ? 'Codex' : 'External agent', session: session, kind: 'status', id: 'connected', state: 'Connected' } });
202
220
  console.log(`Streaming ${session}. Press Ctrl+C to stop. Activity remains queued locally during relay outages.`);
203
221
  let fatal;
222
+ let signalReady;
223
+ const observationReady = new Promise(resolve => { signalReady = resolve; });
224
+ abort.signal.addEventListener('abort', signalReady, { once: true });
225
+ let activeSession = session, pendingSession;
226
+ let turn = new AbortController();
227
+ const watching = (async () => {
228
+ while (!abort.signal.aborted) {
229
+ let switched = false;
230
+ try {
231
+ for await (const event of adapter.watch(activeSession, AbortSignal.any([abort.signal, turn.signal]), signalReady)) {
232
+ if (live.receive(event))
233
+ void syncEpoch().catch(() => { });
234
+ if (pendingSession && pendingSession !== activeSession) {
235
+ switched = true;
236
+ break;
237
+ }
238
+ }
239
+ }
240
+ catch { /* Reconnection is handled inside adapter.watch; a turn abort ends the pass. */ }
241
+ if (abort.signal.aborted)
242
+ return;
243
+ if (!switched && !(pendingSession && pendingSession !== activeSession))
244
+ return;
245
+ const next = pendingSession;
246
+ pendingSession = undefined;
247
+ live.switchRoot(next);
248
+ activeSession = next;
249
+ active.session = next;
250
+ saveJson(configPath, active);
251
+ turn = new AbortController();
252
+ console.log(`Now streaming ${next}. New chats keep streaming here.`);
253
+ }
254
+ })();
255
+ const commands = (async () => {
256
+ if (agent !== 'opencode' || (!adapter.prompt && !adapter.control))
257
+ return;
258
+ await observationReady;
259
+ while (!abort.signal.aborted) {
260
+ try {
261
+ const result = await request(active.relay, '/commands/poll', 'POST', active.credential, { agent, session: activeSession, controls: Boolean(adapter.control) }, abort.signal);
262
+ if (typeof result.text === 'string' && result.text.trim()) {
263
+ let ok = false, reply;
264
+ try {
265
+ const text = result.text.trim();
266
+ if (/^\/ghost(\s|$)/i.test(text)) {
267
+ reply = (await handleGhost(text, { home: directory, pid: lock?.pid ?? process.pid, instance: lock?.instance ?? instance })).slice(0, 4000);
268
+ ok = true;
269
+ }
270
+ else if (text.startsWith('/') && adapter.control) {
271
+ const control = await adapter.control(activeSession, text, abort.signal);
272
+ ok = true;
273
+ reply = control.text.slice(0, 4000);
274
+ if (control.session && control.session !== activeSession && !abort.signal.aborted) {
275
+ pendingSession = control.session;
276
+ turn.abort(); // Ends this watch pass; the watching loop performs the switch.
277
+ }
278
+ }
279
+ else if (adapter.prompt) {
280
+ await adapter.prompt(activeSession, text, abort.signal);
281
+ ok = true;
282
+ console.log('Telegram task submitted to the selected OpenCode session.');
283
+ }
284
+ }
285
+ catch (error) {
286
+ if (!abort.signal.aborted) {
287
+ console.error('A Telegram task could not be submitted to OpenCode. Send it again after checking the session.');
288
+ if (reply === undefined && error instanceof Error)
289
+ reply = `The command could not be executed.\n${error.message}`.slice(0, 4000);
290
+ }
291
+ }
292
+ if (typeof result.id === 'string' && !abort.signal.aborted)
293
+ await request(active.relay, '/commands/result', 'POST', active.credential, { id: result.id, ok, ...(reply ? { text: reply } : {}) }, abort.signal).catch(() => { });
294
+ }
295
+ }
296
+ catch (error) {
297
+ if (abort.signal.aborted)
298
+ return;
299
+ if (error instanceof ApiError && error.status === 404) {
300
+ console.log('This relay does not support Telegram tasks. Streaming continues.');
301
+ return;
302
+ }
303
+ if (error instanceof ApiError && error.status === 401) {
304
+ fatal = error;
305
+ stop();
306
+ return;
307
+ }
308
+ console.error('Telegram task polling delayed.');
309
+ }
310
+ await delay(2000, undefined, { signal: abort.signal }).catch(() => { });
311
+ }
312
+ })();
204
313
  const delivery = (async () => {
205
314
  while (!abort.signal.aborted) {
206
315
  try {
@@ -229,14 +338,11 @@ async function main() {
229
338
  }
230
339
  })();
231
340
  try {
232
- for await (const event of adapter.watch(session, abort.signal)) {
233
- if (live.receive(event))
234
- void syncEpoch().catch(() => { });
235
- }
341
+ await watching;
236
342
  }
237
343
  finally {
238
344
  stop();
239
- await delivery;
345
+ await Promise.all([delivery, commands]).catch(() => { });
240
346
  }
241
347
  if (fatal)
242
348
  throw fatal;
package/dist/cli.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,YAAY,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC9G,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,O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