appback-remoteagent 0.17.1 → 0.20.0
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 +33 -0
- package/bin/remoteagent.js +1 -1
- package/dist/adapters/codex-adapter.js +22 -4
- package/dist/bot.js +321 -53
- package/dist/cli.js +208 -0
- package/dist/services/agent-memory-service.js +6 -4
- package/dist/services/bot-management-service.js +3 -0
- package/dist/services/bridge-service.js +16 -7
- package/dist/services/cli-config-service.js +154 -0
- package/dist/services/secret-transfer-service.js +237 -0
- package/dist/telegram-command-menu.js +1 -1
- package/docs/CLI_BOOTSTRAP_AND_SECRET_MIGRATION.md +98 -0
- package/docs/RELEASING.md +22 -0
- package/package.json +2 -1
- package/scripts/install.sh +9 -0
- package/scripts/selftest-cli.mjs +121 -0
- package/scripts/selftest-codex-stream.mjs +9 -2
- package/scripts/selftest-telegram-update.mjs +120 -0
package/README.md
CHANGED
|
@@ -103,6 +103,8 @@ Current command surface implemented in `src/bot.ts`:
|
|
|
103
103
|
| `/new` | Creates and binds a new session using the saved default mode in a new managed workspace |
|
|
104
104
|
| `/switch <session>` | Rebinds this chat to an existing RemoteAgent session |
|
|
105
105
|
| `/status` | Shows current session, workspace, provider, and sandbox state |
|
|
106
|
+
| `/model [name]` | Lists selectable provider models or changes the current session model |
|
|
107
|
+
| `/sandbox [codex <mode>]` | Lists Codex sandbox choices or changes the current session sandbox |
|
|
106
108
|
| `/option retry <count>` | Sets the automatic continuation turn limit and persists it to `~/.remoteagent/.env` |
|
|
107
109
|
| `/option timeout <seconds>` | Sets the provider execution timeout and persists it to `~/.remoteagent/.env` |
|
|
108
110
|
| `/option intent <count>` | Sets retries for untagged intent-only provider replies and persists it to `~/.remoteagent/.env` |
|
|
@@ -110,6 +112,7 @@ Current command surface implemented in `src/bot.ts`:
|
|
|
110
112
|
| `/state clear` | Clears the current session ledger without deleting the session |
|
|
111
113
|
| `/state note <text>` | Adds an operator note to the session ledger |
|
|
112
114
|
| `/bots` | Lists the currently configured Telegram bots |
|
|
115
|
+
| `/macro [alias\|number]` | Lists stored macros or runs one against the current session |
|
|
113
116
|
| `/bot add <token>` | Adds a conversation bot, restarts the runtime, and confirms the result after restart |
|
|
114
117
|
| `/bot doctor` | Checks configured Telegram bots and removes bots that Telegram reports as permanently dead |
|
|
115
118
|
| `/bot remove <username\|id>` | Removes a configured Telegram bot, restarts the runtime, and confirms the result after restart |
|
|
@@ -127,6 +130,8 @@ Current command surface implemented in `src/bot.ts`:
|
|
|
127
130
|
| `/queue remove <id>` | Removes one waiting instruction by its `Q001`-style id |
|
|
128
131
|
| `/queue del` | Removes the most recently queued instruction |
|
|
129
132
|
|
|
133
|
+
Selection-oriented replies include Telegram inline buttons for sessions, models, macros, runtime option details, sandbox modes, queued instructions, and configured bot links. Text commands remain the canonical compatible interface. Callback actions use short-lived opaque IDs bound to the originating chat and user; they do not expose secrets or rely on visible list positions as internal identity. Selecting `danger-full-access` through a button requires a second confirmation.
|
|
134
|
+
|
|
130
135
|
Multi-bot polling is tiered by recent activity and active provider work. See [docs/BOT_POLLING_POLICY.md](./docs/BOT_POLLING_POLICY.md).
|
|
131
136
|
|
|
132
137
|
### 2. Terminal control
|
|
@@ -313,6 +318,34 @@ remoteagent-start
|
|
|
313
318
|
|
|
314
319
|
`remoteagent-install` seeds provider install/login hook paths into `~/.remoteagent/.env` automatically, so `/install codex` and `/install claude` work on a fresh machine without manual hook wiring.
|
|
315
320
|
|
|
321
|
+
Register the first Telegram bot without editing `.env` manually:
|
|
322
|
+
|
|
323
|
+
```bash
|
|
324
|
+
remoteagent bot add
|
|
325
|
+
remoteagent-start
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
The command validates the BotFather token, stores the bot configuration, and configures the numeric Telegram owner user ID. Tokens are entered through a hidden prompt by default.
|
|
329
|
+
|
|
330
|
+
To move installation-wide `/secret` values to another PC, export and import a password-encrypted bundle:
|
|
331
|
+
|
|
332
|
+
```bash
|
|
333
|
+
# Old PC
|
|
334
|
+
remoteagent secret export ~/remoteagent-secrets.ra-secrets
|
|
335
|
+
|
|
336
|
+
# New PC
|
|
337
|
+
remoteagent secret import ~/remoteagent-secrets.ra-secrets
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
See [CLI bootstrap and secret migration](./docs/CLI_BOOTSTRAP_AND_SECRET_MIGRATION.md) for the complete interactive and automation-safe commands.
|
|
341
|
+
|
|
342
|
+
Selected Secret keys can also be returned to the current private Telegram chat as a compressed, encrypted bundle without exposing values to the provider:
|
|
343
|
+
|
|
344
|
+
```text
|
|
345
|
+
/secret set REMOTEAGENT_TRANSFER_PASSPHRASE a-long-private-passphrase
|
|
346
|
+
/secret export REMOTEAGENT_TRANSFER_PASSPHRASE KEY_ONE KEY_TWO
|
|
347
|
+
```
|
|
348
|
+
|
|
316
349
|
For one-line installs on a fresh machine:
|
|
317
350
|
|
|
318
351
|
```bash
|
package/bin/remoteagent.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import "../dist/
|
|
2
|
+
import "../dist/cli.js";
|
|
@@ -115,10 +115,7 @@ export class CodexAdapter {
|
|
|
115
115
|
}
|
|
116
116
|
let text;
|
|
117
117
|
try {
|
|
118
|
-
|
|
119
|
-
text = event.type === "item.completed" && event.item?.type === "agent_message"
|
|
120
|
-
? event.item.text?.trim()
|
|
121
|
-
: undefined;
|
|
118
|
+
text = this.extractEventAgentText(JSON.parse(line));
|
|
122
119
|
}
|
|
123
120
|
catch {
|
|
124
121
|
// Ignore non-JSON stdout and let the normal final-response parser handle it.
|
|
@@ -128,6 +125,27 @@ export class CodexAdapter {
|
|
|
128
125
|
await onProgress(text);
|
|
129
126
|
}
|
|
130
127
|
}
|
|
128
|
+
extractEventAgentText(event) {
|
|
129
|
+
if (!event || typeof event !== "object") {
|
|
130
|
+
return undefined;
|
|
131
|
+
}
|
|
132
|
+
const record = event;
|
|
133
|
+
if (record.type === "item.completed" && record.item?.type === "agent_message") {
|
|
134
|
+
return record.item.text?.trim();
|
|
135
|
+
}
|
|
136
|
+
if (record.type === "event_msg" && record.payload?.type === "agent_message") {
|
|
137
|
+
return (record.payload.message ?? record.payload.text)?.trim();
|
|
138
|
+
}
|
|
139
|
+
if (record.type === "response_item" && record.payload?.type === "message") {
|
|
140
|
+
const text = record.payload.content
|
|
141
|
+
?.filter((item) => item.type === "output_text" && typeof item.text === "string")
|
|
142
|
+
.map((item) => item.text)
|
|
143
|
+
.join("\n")
|
|
144
|
+
.trim();
|
|
145
|
+
return text || record.payload.text?.trim();
|
|
146
|
+
}
|
|
147
|
+
return undefined;
|
|
148
|
+
}
|
|
131
149
|
extractThreadId(stdout) {
|
|
132
150
|
for (const line of stdout.split(/\r?\n/)) {
|
|
133
151
|
if (!line.startsWith("{")) {
|