dsh-tg-bridge 1.30.2 → 1.31.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 +7 -1
- package/callbacks.mjs +10 -0
- package/commands-registry.mjs +2 -2
- package/control/cmd-diff.mjs +176 -0
- package/control.mjs +2 -1
- package/diff.mjs +238 -0
- package/docs/MOBILE-FIRST.md +244 -0
- package/help-explain.mjs +1 -1
- package/i18n/en/core.mjs +1 -1
- package/i18n/en/diff.mjs +31 -0
- package/i18n/en.mjs +2 -1
- package/i18n/ru/core.mjs +1 -1
- package/i18n/ru/diff.mjs +31 -0
- package/i18n/ru.mjs +2 -1
- package/i18n/zh/core.mjs +1 -1
- package/i18n/zh/diff.mjs +30 -0
- package/i18n/zh.mjs +2 -1
- package/menu-card.mjs +2 -1
- package/package.json +6 -3
package/README.md
CHANGED
|
@@ -20,6 +20,11 @@ a bot that answers, one step at a time.
|
|
|
20
20
|
a permission-enabled profile the sandbox is narrowed to it too, so the agent
|
|
21
21
|
cannot write outside the project.
|
|
22
22
|
- **Goal and checklist per topic**: `/goal`, `/tasks`; both survive restarts and are prepended to every turn.
|
|
23
|
+
- **`/diff` — review the turn, one hunk at a time.** The working tree is split into
|
|
24
|
+
files and hunks; every hunk gets two buttons: explain it, or revert just that
|
|
25
|
+
hunk. A button carries a hash of the hunk it was drawn from, so a press that
|
|
26
|
+
arrives after the file moved on is refused instead of touching a line nobody was
|
|
27
|
+
looking at. `/diff stat` is the file list alone.
|
|
23
28
|
- **Live progress**: one edited message per turn — steps, a timer and the cache hit rate, plus
|
|
24
29
|
the model's reasoning in a collapsed block you can tap open. A long turn adds a second
|
|
25
30
|
collapsed block with every tool call, so the whole run stays in the chat as one message.
|
|
@@ -290,13 +295,14 @@ Send the bot:
|
|
|
290
295
|
| `/thoughts [file\|all\|off]` | the last turn's reasoning as a message; `file`/`all` send the full log as a Markdown document, `off` hides the block |
|
|
291
296
|
| `/help` | commands grouped by category |
|
|
292
297
|
| `/cd my-app` | topic bound to the project, and the sandbox narrowed to it |
|
|
298
|
+
| `/diff [stat]` | what the turn changed, one hunk at a time: every hunk has "explain" and "revert this hunk"; a stale button is refused |
|
|
293
299
|
| `/report` | a redacted bundle (version, profile, preset, model, cwd, last failure, log tail) sent to the owner as a document; in a group, the path only |
|
|
294
300
|
| `/prices` | what the current model costs, and whose price that is: your provider's, the same model on another gateway, or "no public price" when nobody publishes one |
|
|
295
301
|
|
|
296
302
|
## Commands
|
|
297
303
|
|
|
298
304
|
```
|
|
299
|
-
Work: /cd · /new · /stop · /send · /seed
|
|
305
|
+
Work: /cd · /new · /stop · /send · /seed · /diff
|
|
300
306
|
Goals: /goal (plan + checklist) · /goal reopen · /tasks (checklist only) · /tasks done|rm|edit <n>
|
|
301
307
|
Sessions: /status · /sessions · /sessions <id> · /rewind [n|undo|fork [n]|branches]
|
|
302
308
|
Agents: /agents · /agents <id> · /agents set model|depth|filter
|
package/callbacks.mjs
CHANGED
|
@@ -14,6 +14,7 @@ import { DIR, DSH_HOME, LOG } from './paths.mjs';
|
|
|
14
14
|
import { approvals, enqueue, lastPrompt, maxParallel, redeliver, rewindUsed } from './queue.mjs';
|
|
15
15
|
import { answerRewindPress, cutSession, isRewindPress } from './rewind-buttons.mjs';
|
|
16
16
|
import { applyRewind, newestBackup, restoreBackup } from './rewind.mjs';
|
|
17
|
+
import { diffPressRouter } from './control/cmd-diff.mjs';
|
|
17
18
|
import { runCommandFromButton } from './run-command.mjs';
|
|
18
19
|
import { commandFor, renderSettingsCard, settingsCurrent } from './settings-card.mjs';
|
|
19
20
|
import { config, done, log, saveConfig, saveState, state } from './state.mjs';
|
|
@@ -287,6 +288,15 @@ export async function handleCallback(query) {
|
|
|
287
288
|
return;
|
|
288
289
|
}
|
|
289
290
|
|
|
291
|
+
if (data.startsWith('df:')) {
|
|
292
|
+
// A diff card button. The diff is re-read inside the handler, not taken
|
|
293
|
+
// from the card: the hunk id is a hash of the hunk's own text, so a press
|
|
294
|
+
// that arrives after the file moved on matches nothing and is refused
|
|
295
|
+
// instead of reverting whatever now sits at that line number.
|
|
296
|
+
const press = diffPressRouter({ chatId, threadId, key, lang, config, state, answer, clearKeyboard, log, enqueue, handleMessage });
|
|
297
|
+
if (await press(data)) return;
|
|
298
|
+
}
|
|
299
|
+
|
|
290
300
|
if (data.startsWith('t:')) {
|
|
291
301
|
// A task card. The whole message is redrawn from state, so a double tap or
|
|
292
302
|
// two people pressing converge on one truth instead of stacking ✅ marks.
|
package/commands-registry.mjs
CHANGED
|
@@ -12,7 +12,7 @@ export const CONTROL_COMMANDS = [
|
|
|
12
12
|
'skills', 'soul', 'restart', 'app', 'stop', 'new', 'seed', 'send', 'cd',
|
|
13
13
|
'prices', 'cost', 'help', 'doctor', 'logs', 'report', 'lang', 'reasoning', 'pin', 'goal', 'task', 'tasks',
|
|
14
14
|
'thoughts', 'version', 'update', 'crew', 'agentset', 'subscribe', 'settings',
|
|
15
|
-
'rewind', 'fork', 'branches', 'menu', 'fallback', 'load',
|
|
15
|
+
'rewind', 'fork', 'branches', 'menu', 'fallback', 'load', 'diff',
|
|
16
16
|
];
|
|
17
17
|
|
|
18
18
|
/**
|
|
@@ -60,6 +60,6 @@ export const DOCUMENTED_COMMANDS = CONTROL_COMMANDS.filter((name) => !COMMAND_AL
|
|
|
60
60
|
* the pair of names this list exists to avoid.
|
|
61
61
|
*/
|
|
62
62
|
export const MENU_COMMANDS = [
|
|
63
|
-
'new', 'status', 'sessions', 'goal', 'tasks', 'model', 'plugins',
|
|
63
|
+
'new', 'status', 'diff', 'sessions', 'goal', 'tasks', 'model', 'plugins',
|
|
64
64
|
'settings', 'menu', 'rewind', 'stop', 'help', 'update',
|
|
65
65
|
];
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
// `/diff` and the buttons under it: the review loop, from a phone.
|
|
2
|
+
//
|
|
3
|
+
// A turn that changes files ends with one question — "did it change what I
|
|
4
|
+
// asked for, and is any of it wrong". A unified diff answers that on a desktop
|
|
5
|
+
// and drowns a phone, so the card splits the diff into hunks and gives each hunk
|
|
6
|
+
// two buttons. Both act on an id that only matches the diff as it is right now.
|
|
7
|
+
//
|
|
8
|
+
// The git calls live here rather than in `diff.mjs`, which stays pure: it turns
|
|
9
|
+
// text into a card, and everything that touches a repository is one function
|
|
10
|
+
// below. One group of the `/` surface — `control.mjs` owns the dispatch.
|
|
11
|
+
import { execFileSync } from 'node:child_process';
|
|
12
|
+
import { normalizeLang, t } from '../i18n.mjs';
|
|
13
|
+
import { sendWithMarkup } from '../telegram.mjs';
|
|
14
|
+
import { diffPress, findHunk, hunkPatch, parseDiff, renderDiffCard } from '../diff.mjs';
|
|
15
|
+
|
|
16
|
+
/** How many hunks get buttons before the rest are only counted. */
|
|
17
|
+
const HUNK_BUTTONS = 12;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* `git -C <cwd> <args>` as `{ ok, out, err }`.
|
|
21
|
+
*
|
|
22
|
+
* The exit code is the answer to "did it work", and the old helper that returned
|
|
23
|
+
* `''` for both success and failure made a failed revert look like a successful
|
|
24
|
+
* one. One shape for every call, so no caller has to guess.
|
|
25
|
+
*/
|
|
26
|
+
function git(cwd, args, input) {
|
|
27
|
+
try {
|
|
28
|
+
const out = execFileSync('git', ['-C', cwd, ...args], {
|
|
29
|
+
encoding: 'utf8',
|
|
30
|
+
maxBuffer: 16 * 1024 * 1024,
|
|
31
|
+
input,
|
|
32
|
+
stdio: [input === undefined ? 'ignore' : 'pipe', 'pipe', 'pipe'],
|
|
33
|
+
windowsHide: true,
|
|
34
|
+
});
|
|
35
|
+
return { ok: true, out, err: '' };
|
|
36
|
+
} catch (error) {
|
|
37
|
+
const err = String(error?.stderr || error?.message || '').split('\n').find((line) => line.trim()) || '';
|
|
38
|
+
return { ok: false, out: String(error?.stdout || ''), err: err.trim() };
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** True when `cwd` is inside a work tree, the only place a diff exists. */
|
|
43
|
+
export function isRepo(cwd) {
|
|
44
|
+
return git(cwd, ['rev-parse', '--is-inside-work-tree']).out.trim() === 'true';
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* The working tree as data: tracked changes against HEAD, plus the names of new
|
|
49
|
+
* files. Untracked files are listed and never rendered — they have no hunks, and
|
|
50
|
+
* a screen of `+` lines from a fresh `node_modules` is not a review.
|
|
51
|
+
*/
|
|
52
|
+
export function readDiff(cwd) {
|
|
53
|
+
const files = parseDiff(git(cwd, ['diff', '--no-color', '--no-ext-diff', 'HEAD']).out);
|
|
54
|
+
const untracked = git(cwd, ['ls-files', '--others', '--exclude-standard'])
|
|
55
|
+
.out.split('\n')
|
|
56
|
+
.map((line) => line.trim())
|
|
57
|
+
.filter(Boolean);
|
|
58
|
+
return { files, untracked };
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* The card for one directory in one language, with the button list capped.
|
|
63
|
+
*
|
|
64
|
+
* A keyboard of forty rows is a keyboard nobody presses, so the tail is counted
|
|
65
|
+
* in the text instead: nothing is hidden without saying so.
|
|
66
|
+
*/
|
|
67
|
+
export function diffCard(cwd, lang, { detail = true } = {}) {
|
|
68
|
+
const { files, untracked } = readDiff(cwd);
|
|
69
|
+
const card = renderDiffCard({ files, untracked, t: (key, vars) => t(lang, key, vars), detail });
|
|
70
|
+
const rows = card.keyboard.filter((row) => row[0]?.data !== 'df:f');
|
|
71
|
+
if (rows.length <= HUNK_BUTTONS) return card;
|
|
72
|
+
const dropped = rows.length - HUNK_BUTTONS;
|
|
73
|
+
return {
|
|
74
|
+
...card,
|
|
75
|
+
text: `${card.text}\n\n${t(lang, 'diff.tooManyButtons', { n: dropped })}`,
|
|
76
|
+
keyboard: [...rows.slice(0, HUNK_BUTTONS), ...card.keyboard.slice(rows.length)],
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export async function handleDiffCommands(ctx) {
|
|
81
|
+
const { reply, log, config, state, key, lang: rawLang } = ctx;
|
|
82
|
+
const lang = normalizeLang(rawLang) || normalizeLang(config?.lang) || 'en';
|
|
83
|
+
const effective = ctx.effective || ctx.command;
|
|
84
|
+
if (effective !== '/diff') return false;
|
|
85
|
+
|
|
86
|
+
const cwd = (state?.cwd && state.cwd[key]) || config?.cwd || '';
|
|
87
|
+
if (!cwd || !isRepo(cwd)) {
|
|
88
|
+
await reply(t(lang, 'diff.notRepo', { dir: cwd || t(lang, 'diff.noDir') }));
|
|
89
|
+
return true;
|
|
90
|
+
}
|
|
91
|
+
// `/diff stat` is the summary alone: on a phone the file list is often the
|
|
92
|
+
// whole answer, and it costs one message instead of six.
|
|
93
|
+
const detail = !/^(stat|files|short)$/i.test(String(ctx.arg || '').trim());
|
|
94
|
+
const card = diffCard(cwd, lang, { detail });
|
|
95
|
+
await reply(card.text, { keyboard: card.keyboard });
|
|
96
|
+
log(`diff card for ${key} in ${cwd}: ${card.keyboard.length} button(s)`);
|
|
97
|
+
return true;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* The press handler, bound to one chat.
|
|
102
|
+
*
|
|
103
|
+
* `callbacks.mjs` sits at the 500-line ceiling, and this button needs seven
|
|
104
|
+
* things from it: the answer, the keyboard wipe, a sender, the queue, the turn
|
|
105
|
+
* pipeline, the topic and its language. Binding them here keeps the router to
|
|
106
|
+
* four lines and keeps this module out of `handle-message.mjs`, which would be
|
|
107
|
+
* a cycle. The returned function answers `false` for a button that is not ours.
|
|
108
|
+
*/
|
|
109
|
+
export function diffPressRouter({ chatId, threadId, key, lang, config, state, answer, clearKeyboard, log, enqueue, handleMessage }) {
|
|
110
|
+
return (data) => handleDiffPress({
|
|
111
|
+
data,
|
|
112
|
+
cwd: (state?.cwd && state.cwd[key]) || config?.cwd || '',
|
|
113
|
+
lang,
|
|
114
|
+
key,
|
|
115
|
+
answer,
|
|
116
|
+
clearKeyboard,
|
|
117
|
+
log,
|
|
118
|
+
send: (body, keyboard) => sendWithMarkup(chatId, threadId, body, { keyboard }),
|
|
119
|
+
explain: (prompt) => enqueue(key, () => handleMessage({
|
|
120
|
+
chat: { id: chatId },
|
|
121
|
+
from: { id: config.allowedUserIds[0] },
|
|
122
|
+
message_id: 0,
|
|
123
|
+
message_thread_id: threadId || undefined,
|
|
124
|
+
is_topic_message: threadId > 0,
|
|
125
|
+
text: prompt,
|
|
126
|
+
})),
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export async function handleDiffPress({ data, cwd, lang, key, answer, clearKeyboard, send, explain, log }) {
|
|
131
|
+
const press = diffPress(data);
|
|
132
|
+
if (!press) return false;
|
|
133
|
+
|
|
134
|
+
if (press.action === 'f') {
|
|
135
|
+
const card = diffCard(cwd, lang);
|
|
136
|
+
await send(card.text, card.keyboard);
|
|
137
|
+
await answer(t(lang, 'diff.refreshed'));
|
|
138
|
+
return true;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
const found = findHunk(readDiff(cwd).files, press.id);
|
|
142
|
+
if (!found) {
|
|
143
|
+
// The hunk is not in the diff any more: the file was reverted, edited or
|
|
144
|
+
// committed since the card was drawn. Refusing is the only safe answer —
|
|
145
|
+
// acting on the line number would touch code nobody was looking at.
|
|
146
|
+
await answer(t(lang, 'diff.stale'));
|
|
147
|
+
return true;
|
|
148
|
+
}
|
|
149
|
+
const { file, hunk } = found;
|
|
150
|
+
const where = hunk.newStart || hunk.oldStart;
|
|
151
|
+
|
|
152
|
+
if (press.action === 'x') {
|
|
153
|
+
await answer(t(lang, 'diff.explaining'));
|
|
154
|
+
log(`diff explain ${file.path}:${where} for ${key}`);
|
|
155
|
+
await explain(`${t(lang, 'diff.explainPrompt', { file: file.path, line: where })}\n\n\`\`\`diff\n${hunkPatch(file, hunk)}\`\`\``);
|
|
156
|
+
return true;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
// Revert exactly this hunk, and only if it still applies cleanly. `-R` turns
|
|
160
|
+
// "add these lines" into "take them away"; `--recount` lets git fix a header
|
|
161
|
+
// that a single hunk taken out of context often gets wrong. A hunk that no
|
|
162
|
+
// longer matches fails here and changes nothing, which is the whole point of
|
|
163
|
+
// addressing it by content hash rather than by line number.
|
|
164
|
+
const applied = git(cwd, ['apply', '-R', '--recount', '-'], hunkPatch(file, hunk));
|
|
165
|
+
if (!applied.ok) {
|
|
166
|
+
await answer(t(lang, 'diff.revertFailed', { why: applied.err || t(lang, 'diff.noReason') }));
|
|
167
|
+
log(`diff revert failed ${file.path}:${where}: ${applied.err}`);
|
|
168
|
+
return true;
|
|
169
|
+
}
|
|
170
|
+
await clearKeyboard();
|
|
171
|
+
log(`diff reverted ${file.path}:${where} for ${key}`);
|
|
172
|
+
await answer(t(lang, 'diff.reverted', { file: file.path, line: where }));
|
|
173
|
+
const card = diffCard(cwd, lang);
|
|
174
|
+
await send(card.text, card.keyboard);
|
|
175
|
+
return true;
|
|
176
|
+
}
|
package/control.mjs
CHANGED
|
@@ -30,6 +30,7 @@ import { COMMAND_ALIASES, CONTROL_COMMANDS, DOCUMENTED_COMMANDS } from './comman
|
|
|
30
30
|
import { handleAgentCommands } from './control/cmd-agents.mjs';
|
|
31
31
|
import { handleBridgeCommands } from './control/cmd-bridge.mjs';
|
|
32
32
|
import { handleFallbackCommands } from './control/cmd-fallback.mjs';
|
|
33
|
+
import { handleDiffCommands } from './control/cmd-diff.mjs';
|
|
33
34
|
import { handleLoadCommands } from './control/cmd-load.mjs';
|
|
34
35
|
import { handlePluginCommands } from './control/cmd-plugin.mjs';
|
|
35
36
|
import { handleSessionCommands } from './control/cmd-session.mjs';
|
|
@@ -107,7 +108,7 @@ export async function handleControl(ctx) {
|
|
|
107
108
|
// that is not its job. The order is alphabetical, not meaningful: no two
|
|
108
109
|
// groups claim the same command, so a miss falls through to `default` below.
|
|
109
110
|
const child = { ...ctx, effective, command, arg: effectiveArgText, send, reply, log, profile, state, key, config, lang };
|
|
110
|
-
for (const handler of [handleAgentCommands, handleBridgeCommands, handleFallbackCommands, handleLoadCommands, handlePluginCommands, handleSessionCommands, handleSkillCommands, handleTaskCommands, handleViewCommands]) {
|
|
111
|
+
for (const handler of [handleAgentCommands, handleBridgeCommands, handleDiffCommands, handleFallbackCommands, handleLoadCommands, handlePluginCommands, handleSessionCommands, handleSkillCommands, handleTaskCommands, handleViewCommands]) {
|
|
111
112
|
if (await handler(child)) return true;
|
|
112
113
|
}
|
|
113
114
|
// Nothing claimed it: the bridge answers an unknown `/` command itself, with
|
package/diff.mjs
ADDED
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
// The diff card: what changed, one hunk at a time.
|
|
2
|
+
//
|
|
3
|
+
// A unified diff pasted into a chat is a wall. On a six-inch screen it wraps at
|
|
4
|
+
// forty columns, and the one question a person actually has — "should this hunk
|
|
5
|
+
// stay?" — cannot be asked of a wall. So the diff is parsed into files and
|
|
6
|
+
// hunks, every hunk gets a short id derived from its own content, and the card
|
|
7
|
+
// carries a row of buttons per hunk.
|
|
8
|
+
//
|
|
9
|
+
// The id is the load-bearing part. It is a hash of the path, the header and the
|
|
10
|
+
// body, so re-running `git diff` later finds the same id only when the hunk is
|
|
11
|
+
// still byte for byte what the person was looking at. That is what makes a
|
|
12
|
+
// button press safe: a stale id matches nothing, and the press is refused
|
|
13
|
+
// instead of reverting whatever now sits at that line number.
|
|
14
|
+
//
|
|
15
|
+
// Pure on purpose: text in, text out. The cases below are a test rather than a
|
|
16
|
+
// story about a repository.
|
|
17
|
+
import { createHash } from 'node:crypto';
|
|
18
|
+
|
|
19
|
+
export const DIFF_PREFIX = 'df:';
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* `df:x:1a2b3c4d` → `{ action: 'x', id: '1a2b3c4d' }`; anything else is null.
|
|
23
|
+
*
|
|
24
|
+
* `x` explains a hunk, `r` reverts it, `f` redraws the card. Only an eight-hex
|
|
25
|
+
* id is accepted, because anything else is not a button this code drew.
|
|
26
|
+
*/
|
|
27
|
+
export function diffPress(data) {
|
|
28
|
+
const text = String(data || '');
|
|
29
|
+
if (!text.startsWith(DIFF_PREFIX)) return null;
|
|
30
|
+
const [action, id] = text.slice(DIFF_PREFIX.length).split(':');
|
|
31
|
+
if (action === 'f') return { action, id: '' };
|
|
32
|
+
if (!/^[xr]$/.test(action || '')) return null;
|
|
33
|
+
return /^[0-9a-f]{8}$/.test(id || '') ? { action, id } : null;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** `+++ b/src/app.mjs` → `src/app.mjs`; `/dev/null` stays itself. */
|
|
37
|
+
function pathOf(line) {
|
|
38
|
+
return String(line).replace(/^(?:\+\+\+|---) [ab]\//, '').replace(/^(?:\+\+\+|---) /, '').trim();
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Split a unified diff into files, and each file into hunks.
|
|
43
|
+
*
|
|
44
|
+
* Only the shapes `git diff` produces are understood, and anything unrecognised
|
|
45
|
+
* lands in the file header where it does no harm — an unparsed line must never
|
|
46
|
+
* be dropped, because the header is what a revert replays.
|
|
47
|
+
*/
|
|
48
|
+
export function parseDiff(text) {
|
|
49
|
+
const files = [];
|
|
50
|
+
let file = null;
|
|
51
|
+
let hunk = null;
|
|
52
|
+
|
|
53
|
+
for (const line of String(text ?? '').split('\n')) {
|
|
54
|
+
if (line.startsWith('diff --git ')) {
|
|
55
|
+
if (file) finish(file);
|
|
56
|
+
file = { path: '', status: 'modified', added: 0, removed: 0, binary: false, header: [line], hunks: [] };
|
|
57
|
+
files.push(file);
|
|
58
|
+
hunk = null;
|
|
59
|
+
continue;
|
|
60
|
+
}
|
|
61
|
+
// Anything before the first `diff --git` is git's own chatter, such as
|
|
62
|
+
// "warning: CRLF will be replaced", and belongs to no file. An empty line is
|
|
63
|
+
// the trailing newline of the output, never a line of a diff: a blank line
|
|
64
|
+
// in a hunk is a space-prefixed context line, and the header has none.
|
|
65
|
+
if (!file || line === '') continue;
|
|
66
|
+
|
|
67
|
+
if (hunk && (line.startsWith(' ') || line.startsWith('+') || line.startsWith('-') || line.startsWith('\\'))) {
|
|
68
|
+
hunk.lines.push(line);
|
|
69
|
+
if (line.startsWith('+')) file.added += 1;
|
|
70
|
+
else if (line.startsWith('-')) file.removed += 1;
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
hunk = null;
|
|
74
|
+
|
|
75
|
+
if (line.startsWith('@@')) {
|
|
76
|
+
const at = /^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@ ?(.*)$/.exec(line);
|
|
77
|
+
hunk = {
|
|
78
|
+
header: line,
|
|
79
|
+
tail: at ? at[5] : '',
|
|
80
|
+
oldStart: Number(at ? at[1] : 0),
|
|
81
|
+
oldLines: Number(at?.[2] ?? 1),
|
|
82
|
+
newStart: Number(at ? at[3] : 0),
|
|
83
|
+
newLines: Number(at?.[4] ?? 1),
|
|
84
|
+
lines: [],
|
|
85
|
+
id: '',
|
|
86
|
+
};
|
|
87
|
+
file.hunks.push(hunk);
|
|
88
|
+
continue;
|
|
89
|
+
}
|
|
90
|
+
file.header.push(line);
|
|
91
|
+
}
|
|
92
|
+
if (file) finish(file);
|
|
93
|
+
return files.filter((one) => one.path !== '');
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/** Work out the path, the status and whether the file is binary. */
|
|
97
|
+
function finish(file) {
|
|
98
|
+
const plus = file.header.find((line) => line.startsWith('+++ '));
|
|
99
|
+
const minus = file.header.find((line) => line.startsWith('--- '));
|
|
100
|
+
const renameTo = file.header.find((line) => line.startsWith('rename to '));
|
|
101
|
+
const renameFrom = file.header.find((line) => line.startsWith('rename from '));
|
|
102
|
+
const newPath = plus ? pathOf(plus) : '';
|
|
103
|
+
const oldPath = minus ? pathOf(minus) : '';
|
|
104
|
+
// A binary file has neither `---` nor `+++`: git writes `Binary files a/x and
|
|
105
|
+
// b/x differ` instead, and the only place the name survives is the first line.
|
|
106
|
+
const fromGit = /^diff --git a\/(.+?) b\/(.+)$/.exec(file.header[0] || '');
|
|
107
|
+
const named = (newPath || oldPath) || (fromGit ? fromGit[2] : '');
|
|
108
|
+
|
|
109
|
+
if (renameTo && renameFrom) {
|
|
110
|
+
file.path = renameTo.slice('rename to '.length).trim();
|
|
111
|
+
file.status = 'renamed';
|
|
112
|
+
} else if (newPath === '/dev/null' || (!plus && oldPath)) {
|
|
113
|
+
file.path = oldPath;
|
|
114
|
+
file.status = 'deleted';
|
|
115
|
+
} else if (oldPath === '/dev/null') {
|
|
116
|
+
file.path = newPath;
|
|
117
|
+
file.status = 'added';
|
|
118
|
+
} else {
|
|
119
|
+
file.path = named;
|
|
120
|
+
file.status = 'modified';
|
|
121
|
+
}
|
|
122
|
+
file.binary = file.header.some((line) => line.startsWith('Binary files ') || line.startsWith('GIT binary patch'));
|
|
123
|
+
// A binary file has no hunks and therefore no buttons: nothing to review line
|
|
124
|
+
// by line, and an empty keyboard is a promise the card cannot keep.
|
|
125
|
+
for (const one of file.hunks) one.id = hunkId(file.path, one);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/** Eight hex characters, derived from everything the hunk is. */
|
|
129
|
+
export function hunkId(path, hunk) {
|
|
130
|
+
const body = `${path}\n${hunk.header}\n${hunk.lines.join('\n')}`;
|
|
131
|
+
return createHash('sha1').update(body).digest('hex').slice(0, 8);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/** Find a hunk by the id a button carried, or nothing at all. */
|
|
135
|
+
export function findHunk(files, id) {
|
|
136
|
+
for (const file of files) {
|
|
137
|
+
for (const hunk of file.hunks) {
|
|
138
|
+
if (hunk.id === id) return { file, hunk };
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
return null;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* One hunk as a patch of its own, ready for `git apply -R`.
|
|
146
|
+
*
|
|
147
|
+
* The `index` line is dropped: it pins blob hashes that only matter to a
|
|
148
|
+
* three-way merge, and keeping it would make a revert fail for a reason the
|
|
149
|
+
* person cannot act on.
|
|
150
|
+
*/
|
|
151
|
+
export function hunkPatch(file, hunk) {
|
|
152
|
+
// Trailing blank lines are the ones the split left behind, and `git apply`
|
|
153
|
+
// reads a blank line between `+++` and `@@` as the end of the header — the
|
|
154
|
+
// patch is then "garbage" and the revert fails for a reason nobody can see.
|
|
155
|
+
const header = file.header.filter((line) => !line.startsWith('index '));
|
|
156
|
+
while (header.length > 0 && header.at(-1).trim() === '') header.pop();
|
|
157
|
+
return `${header.join('\n')}\n${hunk.header}\n${hunk.lines.join('\n')}\n`;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* The card.
|
|
162
|
+
*
|
|
163
|
+
* `limit` is a character budget, not a hunk count: one lockfile hunk is bigger
|
|
164
|
+
* than twenty hunks of source, and a card Telegram refuses is worse than a card
|
|
165
|
+
* that says how much it left out. `detail` false draws the summary only, which
|
|
166
|
+
* is what `/diff stat` is for.
|
|
167
|
+
*/
|
|
168
|
+
export function renderDiffCard({ files = [], untracked = [], t, limit = 3400, detail = true }) {
|
|
169
|
+
const added = files.reduce((sum, file) => sum + file.added, 0);
|
|
170
|
+
const removed = files.reduce((sum, file) => sum + file.removed, 0);
|
|
171
|
+
|
|
172
|
+
if (files.length === 0 && untracked.length === 0) {
|
|
173
|
+
return { text: t('diff.noChanges'), keyboard: [], shown: 0, hidden: 0 };
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
const lines = [];
|
|
177
|
+
const keyboard = [];
|
|
178
|
+
let used = 0;
|
|
179
|
+
let hidden = 0;
|
|
180
|
+
let filesHidden = 0;
|
|
181
|
+
const push = (line) => {
|
|
182
|
+
lines.push(line);
|
|
183
|
+
used += line.length + 1;
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
if (files.length > 0) push(t('diff.head', { files: files.length, added, removed }));
|
|
187
|
+
if (untracked.length > 0) {
|
|
188
|
+
const shown = untracked.slice(0, 8);
|
|
189
|
+
const more = untracked.length > shown.length ? ` +${untracked.length - shown.length}` : '';
|
|
190
|
+
push(t('diff.untracked', { list: `${shown.join(', ')}${more}` }));
|
|
191
|
+
}
|
|
192
|
+
push('');
|
|
193
|
+
|
|
194
|
+
for (const file of files) {
|
|
195
|
+
const marks = [];
|
|
196
|
+
if (file.status === 'added') marks.push(t('diff.newFile'));
|
|
197
|
+
if (file.status === 'deleted') marks.push(t('diff.deletedFile'));
|
|
198
|
+
if (file.status === 'renamed') marks.push(t('diff.renamedFile'));
|
|
199
|
+
if (file.binary) marks.push(t('diff.binaryFile'));
|
|
200
|
+
const label = `${file.path} +${file.added} -${file.removed}${marks.length ? ` (${marks.join(' · ')})` : ''}`;
|
|
201
|
+
// The budget covers the file names too. A repository with two hundred
|
|
202
|
+
// changed files would otherwise spend the whole message on names and hand
|
|
203
|
+
// Telegram something it refuses, which is worse than a card that counts.
|
|
204
|
+
if (used + label.length + 1 > limit) {
|
|
205
|
+
filesHidden += 1;
|
|
206
|
+
hidden += file.hunks.length;
|
|
207
|
+
continue;
|
|
208
|
+
}
|
|
209
|
+
push(label);
|
|
210
|
+
|
|
211
|
+
if (!detail) {
|
|
212
|
+
push('');
|
|
213
|
+
continue;
|
|
214
|
+
}
|
|
215
|
+
for (const hunk of file.hunks) {
|
|
216
|
+
const block = [hunk.header, ...hunk.lines];
|
|
217
|
+
const size = block.reduce((sum, line) => sum + line.length + 1, 0);
|
|
218
|
+
if (used + size > limit) {
|
|
219
|
+
hidden += 1;
|
|
220
|
+
continue;
|
|
221
|
+
}
|
|
222
|
+
for (const line of block) push(line);
|
|
223
|
+
const where = hunk.newStart || hunk.oldStart;
|
|
224
|
+
keyboard.push([
|
|
225
|
+
{ text: t('diff.explainShort', { line: where }), data: `${DIFF_PREFIX}x:${hunk.id}` },
|
|
226
|
+
{ text: t('diff.revertShort', { line: where }), data: `${DIFF_PREFIX}r:${hunk.id}` },
|
|
227
|
+
]);
|
|
228
|
+
}
|
|
229
|
+
push('');
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
if (hidden > 0) push(t('diff.truncated', { n: hidden }));
|
|
233
|
+
if (filesHidden > 0) push(t('diff.truncatedFiles', { n: filesHidden }));
|
|
234
|
+
if (detail && keyboard.length > 0) {
|
|
235
|
+
keyboard.push([{ text: t('diff.refresh'), data: `${DIFF_PREFIX}f` }]);
|
|
236
|
+
}
|
|
237
|
+
return { text: lines.join('\n').replace(/\n{3,}/g, '\n\n').trim(), keyboard, shown: keyboard.length, hidden, filesHidden };
|
|
238
|
+
}
|
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
# Working from a phone
|
|
2
|
+
|
|
3
|
+
Updated: 2026-10-30. Companion to `ROADMAP.md` (which is older and narrower) and
|
|
4
|
+
`CHANGELOG.md` (what shipped).
|
|
5
|
+
|
|
6
|
+
The goal this document serves: **100% of development happens from a smartphone,
|
|
7
|
+
about 80% of it by voice**, with the agent, the repo and the shell on a server or
|
|
8
|
+
a home machine. Every item below is judged by one test — does it work one-handed,
|
|
9
|
+
from voice or two taps? Anything that assumes a desktop is out.
|
|
10
|
+
|
|
11
|
+
Prices are per-item and are the *user's* cost to run, not the cost to build.
|
|
12
|
+
Effort is for one maintainer: **S** ≤ 1 day, **M** ≤ 4 days, **L** > 1 week. The
|
|
13
|
+
project ships `dependencies: {}`, so anything that needs an npm dependency is
|
|
14
|
+
flagged and refused.
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## 1. What desktop users actually do
|
|
19
|
+
|
|
20
|
+
Desktop harnesses win on four things a Telegram chat structurally lacks:
|
|
21
|
+
selection-aware context, line-level diff review, rewind, and parallel visibility.
|
|
22
|
+
What people actually run, by frequency:
|
|
23
|
+
|
|
24
|
+
| Feature | Workflow | Frequency |
|
|
25
|
+
|---|---|---|
|
|
26
|
+
| `/ide` — pull the open file and the current selection into the prompt | "fix this function" without naming the file | many×/hour |
|
|
27
|
+
| Inline diff review before accept | reject one hunk, keep the rest | many×/hour |
|
|
28
|
+
| Rewind and checkpoints | undo a bad turn without git surgery | daily, at the worst moment |
|
|
29
|
+
| Branch / fork / subagents | try two designs; delegate a side task | daily |
|
|
30
|
+
| Tool hooks that can block | enforce lint and permission policy mechanically | set once, fires constantly |
|
|
31
|
+
| Repo map + explicit file scoping | keep a large repo inside the window | every turn |
|
|
32
|
+
| Background agents that outlive the app | lock the phone, come back to a result | daily |
|
|
33
|
+
|
|
34
|
+
Two of these are **not** desktop-only and are missing here: **line-level diff
|
|
35
|
+
review** and **selection context**. The bridge is already ahead of most
|
|
36
|
+
competitors on session plumbing (`/rewind`, `/plan`, `/skills`, `/plugins`, cost
|
|
37
|
+
and context meters, goals and tasks per topic, i18n) and behind on the two things
|
|
38
|
+
people touch every few minutes.
|
|
39
|
+
|
|
40
|
+
## 2. What breaks when the only device is a phone
|
|
41
|
+
|
|
42
|
+
| Breaks today | Why | Highest-leverage single fix |
|
|
43
|
+
|---|---|---|
|
|
44
|
+
| Long output | 4096 characters per message, then a wall to scroll | rich message (32 768 chars) with collapsible blocks, else a `.md` file |
|
|
45
|
+
| Diffs | monospace wraps unreadably past ~40 columns on a 6" screen | per-hunk buttons over a truncated unified diff |
|
|
46
|
+
| File review | no usable picker, no memory of where you were | `/ls` card + `copy_text` on the path + "last 20 lines" |
|
|
47
|
+
| Approvals | every tool call asks, and the person is walking | approval memory with a TTL, plus "approve the rest of this turn" |
|
|
48
|
+
| Keyboard-hostile flows | typing a path, a branch or a regex on a phone | voice and buttons; never require typing a path |
|
|
49
|
+
| Notification fatigue | progress pings the phone | one edited card per turn (already done) + silent progress |
|
|
50
|
+
| Session switching | `/sessions`, then read a list | a pinned status card per topic, plus a reaction as a state dot |
|
|
51
|
+
|
|
52
|
+
## 3. The 80/20 list
|
|
53
|
+
|
|
54
|
+
Ranked by value to a phone-only user over cost for one maintainer. Cost column is
|
|
55
|
+
what the *person* pays to run it, at DeepSeek Flash off-peak rates ($0.15/1M input
|
|
56
|
+
cache-miss, $0.003/1M cache-hit, $0.60/1M output; peak is 2×).
|
|
57
|
+
|
|
58
|
+
| # | Feature | Why it closes the loop | Effort | User cost |
|
|
59
|
+
|---|---|---|---|---|
|
|
60
|
+
| 1 | **Diff card with per-hunk buttons** — one rich message, one `<details>` per file, a keyboard row per hunk: *keep / revert / explain / rewrite* | the one thing that makes "review my change" possible from a phone | M | $0 extra (~$0.004–0.01 per turn) |
|
|
61
|
+
| 2 | **Voice → confirm card → run**, with a ≤200-character spoken summary back | 80% of the work is spoken; the card is what makes a risky voice command safe without typing | M | local speech-to-text $0; cloud transcription ~$0.001 per 15-second note; local TTS $0 |
|
|
62
|
+
| 3 | **One-action test loop** (`/fix`) — run the suite, feed the failures back, iterate ≤3, one summary card | kills the read-paste-rerun cycle, which is brutal on a phone | S | ~$0.02–0.05 per run |
|
|
63
|
+
| 4 | **`copy_text` buttons** for paths, hashes and commands | one tap instead of long-press-drag on a 6" screen | S | $0 |
|
|
64
|
+
| 5 | **Long output that does not flood** — rich message with folding, else the answer as a document | 4096 characters is a hard wall | S | $0 |
|
|
65
|
+
| 6 | **Approval memory** — "allow this tool here for 1 hour / always / deny" | approval fatigue is why phone-driven agents get abandoned | S | $0 |
|
|
66
|
+
| 7 | **Scheduled agents and a morning digest** — `/every 08:00 mail triage`, `/jobs` to check | the shape that actually justifies a phone | M | ~$0.02–0.10 per day |
|
|
67
|
+
| 8 | **Per-topic daily budget with a hard stop** | an unattended agent needs a spend fuse before it needs features | S | saves money |
|
|
68
|
+
| 9 | **File browse and upload from the topic** | 20 MB download cap, 50 MB upload cap | S/M | $0 |
|
|
69
|
+
| 10 | **Mini App diff viewer** | the last 5%: tapping hunks in a big diff | L | $0 hosting on a static host + a free tunnel; ~$6/month if the agent moves to a VPS |
|
|
70
|
+
|
|
71
|
+
### Tasks for the top four
|
|
72
|
+
|
|
73
|
+
**1. Diff card with per-hunk buttons** (M)
|
|
74
|
+
- collect the turn's `git diff` from tool results, not from a shell call at the end;
|
|
75
|
+
- split into hunks, hash each into a ≤64-byte callback id;
|
|
76
|
+
- render one rich message with a 32 768-character guard and an explicit truncation notice;
|
|
77
|
+
- wire the callbacks to a scoped "apply this hunk" / "revert this hunk" prompt;
|
|
78
|
+
- fall back to a paginated `<pre>` where rich messages are unavailable;
|
|
79
|
+
- tests: hunk ids are stable, the truncation notice is honest, callbacks survive a restart.
|
|
80
|
+
|
|
81
|
+
**2. Voice-first loop** (M)
|
|
82
|
+
- show the transcript as a card *before* dispatch, with *Run / Edit / Cancel*;
|
|
83
|
+
- mark destructive transcripts with a distinct danger-styled button;
|
|
84
|
+
- send the summary back as a voice bubble, capped at one per turn;
|
|
85
|
+
- `/voice off | short | full`;
|
|
86
|
+
- reuse the existing load guard before spending CPU on transcription.
|
|
87
|
+
|
|
88
|
+
**3. One-action test loop** (S)
|
|
89
|
+
- detect the project's test command;
|
|
90
|
+
- cap iterations at three and each run at a budget;
|
|
91
|
+
- one summary card carrying the diff, plus a stop button;
|
|
92
|
+
- record the failing test names in `/tasks` so they survive the turn.
|
|
93
|
+
|
|
94
|
+
**4. `copy_text` buttons** (S)
|
|
95
|
+
- one helper that turns a value into a copy button, used by every card that shows a path, a hash or a command;
|
|
96
|
+
- keep the visible text short and the copied text exact.
|
|
97
|
+
|
|
98
|
+
## 4. Voice as the primary input
|
|
99
|
+
|
|
100
|
+
Telegram delivers voice notes as `voice` with a reusable `file_id`. Local
|
|
101
|
+
transcription (`faster-whisper`, `whisper.cpp`) is free but costs 75–500 MB of
|
|
102
|
+
model and roughly 0.4–2.5 GB of RAM; cloud transcription is about $0.0043/minute
|
|
103
|
+
(Deepgram Nova-3) or $0.0048/minute (Whisper Large), i.e. ~$0.001 for a
|
|
104
|
+
15-second command. A transcript has to appear in under ~2 seconds or people
|
|
105
|
+
re-record.
|
|
106
|
+
|
|
107
|
+
Spoken output is worth it for *status* and not for anything that may need
|
|
108
|
+
copying: a one-to-three sentence summary as a voice bubble beats a paragraph
|
|
109
|
+
while walking. Local TTS (`piper`, `espeak`) is free; hosted TTS is roughly $0.008
|
|
110
|
+
per 200-character summary.
|
|
111
|
+
|
|
112
|
+
## 5. Always-on agents
|
|
113
|
+
|
|
114
|
+
The Bot API has **no** scheduling parameter — the bot must own a timer, so
|
|
115
|
+
crash-safe persistence and a catch-up-on-boot policy are the real work. What the
|
|
116
|
+
bridge needs beyond the existing `/every`:
|
|
117
|
+
|
|
118
|
+
- jobs survive a restart, and a job missed while the machine was off is either
|
|
119
|
+
run once on boot or explicitly skipped, never silently dropped;
|
|
120
|
+
- a per-job budget cap with a hard stop;
|
|
121
|
+
- one digest card instead of N messages;
|
|
122
|
+
- `/every pause`, `/every rm`, and a `/jobs` view with next run, last result and spend.
|
|
123
|
+
|
|
124
|
+
## 6. Telegram-native surfaces worth using
|
|
125
|
+
|
|
126
|
+
The most consequential constraint: **`web_app` buttons work in private chats
|
|
127
|
+
only**, so a Mini App cannot be opened from inside a forum topic — it needs a DM
|
|
128
|
+
or a `t.me/<bot>?startapp=` deep link, which works anywhere.
|
|
129
|
+
|
|
130
|
+
- **Rich messages** — 32 768 characters, 500 blocks, collapsible `<details>`,
|
|
131
|
+
tables. This is the whole reason the diff card is a day of work rather than a
|
|
132
|
+
hosting project.
|
|
133
|
+
- **`copy_text` buttons** — 1–256 characters. Cheapest win available.
|
|
134
|
+
- **Ephemeral messages** — a group message visible to one person. The right
|
|
135
|
+
surface for approvals inside a shared forum.
|
|
136
|
+
- **Topics** — rename a topic to the running task, close it when done, colour it
|
|
137
|
+
by state. Free session UX.
|
|
138
|
+
- **Polls** — a native surface for "which of these three do you want", without
|
|
139
|
+
squeezing options into a 64-byte callback.
|
|
140
|
+
- **`sendChatAction`** — 5-second TTL, cleared by any message; re-send every ~4 s
|
|
141
|
+
during a long tool call.
|
|
142
|
+
- **`deleteMessages`** — 1–100 ids per call; keep a topic readable by cleaning up
|
|
143
|
+
intermediate cards.
|
|
144
|
+
- **Editing** — no published cap, but 1 message/s per chat and 20/min in groups,
|
|
145
|
+
and an identical re-render returns 400 `message is not modified`, which is not
|
|
146
|
+
a fault. The one-card-per-turn design is right; add a content hash and back off
|
|
147
|
+
on 429.
|
|
148
|
+
|
|
149
|
+
## 7. The diff viewer, honestly
|
|
150
|
+
|
|
151
|
+
Ordered by cost, cheapest first:
|
|
152
|
+
|
|
153
|
+
1. **Rich message with folding and per-hunk buttons.** No hosting, no TLS, no NAT,
|
|
154
|
+
works inside topics, survives going offline. This is 80% of the value for 5%
|
|
155
|
+
of the effort, and it is item 1 of the 80/20 list. **Shipped in 1.31.0 as
|
|
156
|
+
`/diff`** — with one deliberate difference from the plan: the buttons live
|
|
157
|
+
under the card rather than inside a fold, because a fold inside a message is
|
|
158
|
+
not tappable in Telegram, and twelve hunks with two buttons each fit in the
|
|
159
|
+
keyboard Telegram already draws.
|
|
160
|
+
2. **A Mini App** for the cases a message cannot hold: a static page, `initData`
|
|
161
|
+
validated by recomputing the HMAC with the bot token and comparing in constant
|
|
162
|
+
time, `auth_date` freshness checked, the Telegram user id mapped to an allowed
|
|
163
|
+
id. It has to be served over HTTPS with a valid certificate.
|
|
164
|
+
3. **A local instance plus a tunnel** only if the Mini App proves necessary. The
|
|
165
|
+
hard parts are not the page: CGNAT kills port-forwarding outright, a tunnel URL
|
|
166
|
+
changes per run unless there is a domain, and an endpoint that applies patches
|
|
167
|
+
is remote code execution by design — it must be bound to a signed user id, a
|
|
168
|
+
per-session token, a size cap and a rate limit, and it must expose a narrow
|
|
169
|
+
queue the agent polls rather than the agent's own port.
|
|
170
|
+
|
|
171
|
+
An image-rendered diff is the wrong answer: not selectable, not searchable, and it
|
|
172
|
+
needs a rasteriser the project will not take as a dependency.
|
|
173
|
+
|
|
174
|
+
## 8. The plugin system
|
|
175
|
+
|
|
176
|
+
The bridge already has a `plugin/` directory with `steer-inbox`. What makes a
|
|
177
|
+
plugin surface genuinely useful, in the order it matters:
|
|
178
|
+
|
|
179
|
+
**Manifest.** `id`, `version`, `engines.bridge` (a semver range), `contract` (an
|
|
180
|
+
integer, refused on mismatch), `capabilities`, a config schema, and `secrets` as
|
|
181
|
+
*names only* — the host resolves them and injects them, never into the agent's
|
|
182
|
+
context.
|
|
183
|
+
|
|
184
|
+
**Lifecycle.** `preTurn`, `postTurn`, `preToolCall` (the only one that may block),
|
|
185
|
+
`onApproval`, `onError`, `onRelease`. The split that works, and that OpenCode
|
|
186
|
+
already models: **middleware** for `preToolCall` — ordered, may block, may rewrite
|
|
187
|
+
arguments — and a fire-and-forget **bus** for everything else. Declare, per hook,
|
|
188
|
+
whether it can block, as data rather than as prose.
|
|
189
|
+
|
|
190
|
+
**Failure isolation, which is the whole point.** A release of this bridge once
|
|
191
|
+
threw on its first turn; a plugin must not be able to do that. Every hook call
|
|
192
|
+
wrapped in `try/catch` with a per-hook timeout (2 s before a turn, 10 s after),
|
|
193
|
+
and a per-plugin circuit breaker — three failures and it is disabled for the
|
|
194
|
+
session, announced in the chat with a one-tap re-enable. Anything touching the
|
|
195
|
+
filesystem or the network runs in a child process, not in the host. `node:vm` is
|
|
196
|
+
not a security boundary and the docs must say so.
|
|
197
|
+
|
|
198
|
+
**What to copy, and what to avoid:**
|
|
199
|
+
|
|
200
|
+
| System | Copy | Avoid |
|
|
201
|
+
|---|---|---|
|
|
202
|
+
| Claude Code plugins | a documented can-block flag per hook — capability as declared data | loading by directory convention, so behaviour depends on which files happen to be present |
|
|
203
|
+
| OpenCode | a plugin is a function returning a hook map plus a disposer; multiple plugins per hook run in a defined order | telling users to install third-party packages into the host at startup |
|
|
204
|
+
| MCP | capability and protocol-version negotiation at handshake; unknown capabilities refused | treating it as a lifecycle — it has no pre-turn or approval slot |
|
|
205
|
+
| VS Code | the extension host in its own process: a bad extension dies without taking the workbench | letting the "narrow API" promise erode as the surface grows |
|
|
206
|
+
| Home Assistant | declarative dependency ordering, validated by CI | installing requirements at runtime |
|
|
207
|
+
|
|
208
|
+
**The first three plugins**, chosen to prove the system rather than to demo it:
|
|
209
|
+
`diff-review` (post-turn rendering plus callback routing — it also ships item 1 of
|
|
210
|
+
the 80/20 list on day one), `approval-policy` (the one hook that can stop the
|
|
211
|
+
agent, plus TTL rules and "safe to run unattended"), and `cron-digest` (a plugin
|
|
212
|
+
that owns a background loop, holds a secret and spends money under a cap).
|
|
213
|
+
|
|
214
|
+
## 9. Roadmap
|
|
215
|
+
|
|
216
|
+
Ordered. Effort and user cost as above.
|
|
217
|
+
|
|
218
|
+
1. ~~**Diff card with per-hunk buttons** — product, M, $0 extra.~~ **Done, 1.31.0.**
|
|
219
|
+
2. **Voice-first loop with a spoken confirmation** — product, M, $0–0.001 per note.
|
|
220
|
+
3. **One-action test loop** — product, S, ~$0.02–0.05 per run.
|
|
221
|
+
4. **`copy_text` everywhere** — product, S, $0.
|
|
222
|
+
5. **Approval memory and ephemeral approval cards** — product, S, $0.
|
|
223
|
+
6. **Budget fuse and cost card** — product, S, saves money.
|
|
224
|
+
7. **Scheduled agents and a morning digest** — product, M, ~$0.02–0.10 per day.
|
|
225
|
+
8. **Plugin host v0: manifest, hooks, failure isolation** — platform, L, high risk.
|
|
226
|
+
9. **Publish the plugin contract and the three reference plugins** — platform, M.
|
|
227
|
+
10. **Mini App diff viewer, opt-in and DM-only** — product, L, high risk; ship it
|
|
228
|
+
after item 1, as an upgrade, never as the only path.
|
|
229
|
+
|
|
230
|
+
## 10. Where the competition stands
|
|
231
|
+
|
|
232
|
+
Checked 2026-10-30, stars from the GitHub API.
|
|
233
|
+
|
|
234
|
+
| Project | ★ | Has that this bridge does not |
|
|
235
|
+
|---|---|---|
|
|
236
|
+
| `chenhg5/cc-connect` | 16 172 | multi-platform, multi-agent, a web UI for config, OS-user isolation, scheduled tasks |
|
|
237
|
+
| `overwirehq/claude-code-telegram` | 2 819 | GitHub webhooks, a built-in cron scheduler, cost-based rate limiting, audit logging |
|
|
238
|
+
| `grinev/opencode-telegram-bot` | 1 298 | a pinned live-status message, worktree switching, a file browser, queue-versus-steer |
|
|
239
|
+
| `littlebearapps/untether` | 74 | per-run and daily budgets with stop-at-limit, one-shot `/at 30m` runs, webhooks |
|
|
240
|
+
| `etcircle/cc-telegram` | 0 | multi-select question toggles, permission cards with TTL rules |
|
|
241
|
+
|
|
242
|
+
What none of them have: diff review that works on a phone, a voice-first confirm
|
|
243
|
+
loop, or a plugin surface for the bridge itself — and none of them ship with zero
|
|
244
|
+
dependencies. That is the space this project can own.
|
package/help-explain.mjs
CHANGED
|
@@ -9,7 +9,7 @@ import { t } from './i18n.mjs';
|
|
|
9
9
|
|
|
10
10
|
/** The /help group each command is listed under. */
|
|
11
11
|
const SECTION = {
|
|
12
|
-
cd: 'Work', new: 'Work', stop: 'Work', send: 'Work', seed: 'Work',
|
|
12
|
+
cd: 'Work', new: 'Work', stop: 'Work', send: 'Work', seed: 'Work', diff: 'Work',
|
|
13
13
|
goal: 'Goals', task: 'Goals', tasks: 'Goals',
|
|
14
14
|
status: 'Sessions', sessions: 'Sessions', rewind: 'Sessions', profile: 'Sessions',
|
|
15
15
|
agents: 'Agents', model: 'Models', prices: 'Models', cost: 'Models', thoughts: 'Models', fallback: 'Models',
|
package/i18n/en/core.mjs
CHANGED
|
@@ -14,7 +14,7 @@ export default {
|
|
|
14
14
|
'settings.state.on': 'on',
|
|
15
15
|
'settings.state.off': 'off',
|
|
16
16
|
'settings.state.auto': 'auto',
|
|
17
|
-
'help.body': "Write the task as plain text. Each forum topic is its own session:\n\nWork: /cd \u003cproject\u003e · /new · /stop · /send \u003cfile\u003e · /seed \u003ctext\u003e\nGoals: /goal · /tasks [\u003ctext\u003e|done N] · /tasks (tap to tick)\nSessions: /status · /sessions [\u003cid\u003e] · /rewind [n|undo|fork [n]|branches] · /new · /profile \u003cname\u003e\nAgents: /agents · /agents set model|depth|filter … @tool\nModels: /model · /model \u003cid\u003e · /fallback · /load · /prices · /cost · /thoughts\nTuning: /effort · /permissions · /preset · /crew [use|show|off|new] · /plan · /jobs [n] · /remind\nExtensions: /skills · /plugins [add|remove] · /soul\nVersions: /update [confirm|on|off|auto] · /subscribe on|off\nOther: /settings · /lang · /reasoning · /pin · /doctor · /logs [errors|N] · /report · /app · /restart · /help\nPanels: /menu — the same commands as buttons, page by page. /menu on puts four keys under the message field.",
|
|
17
|
+
'help.body': "Write the task as plain text. Each forum topic is its own session:\n\nWork: /cd \u003cproject\u003e · /new · /stop · /send \u003cfile\u003e · /seed \u003ctext\u003e · /diff [stat]\nGoals: /goal · /tasks [\u003ctext\u003e|done N] · /tasks (tap to tick)\nSessions: /status · /sessions [\u003cid\u003e] · /rewind [n|undo|fork [n]|branches] · /new · /profile \u003cname\u003e\nAgents: /agents · /agents set model|depth|filter … @tool\nModels: /model · /model \u003cid\u003e · /fallback · /load · /prices · /cost · /thoughts\nTuning: /effort · /permissions · /preset · /crew [use|show|off|new] · /plan · /jobs [n] · /remind\nExtensions: /skills · /plugins [add|remove] · /soul\nVersions: /update [confirm|on|off|auto] · /subscribe on|off\nOther: /settings · /lang · /reasoning · /pin · /doctor · /logs [errors|N] · /report · /app · /restart · /help\nPanels: /menu — the same commands as buttons, page by page. /menu on puts four keys under the message field.",
|
|
18
18
|
'settings.reply.title': 'What the bot says',
|
|
19
19
|
'settings.agent.title': 'Who answers, and how hard it works',
|
|
20
20
|
'settings.updates.title': 'New releases (this install, not this topic)',
|
package/i18n/en/diff.mjs
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// `/diff` and its buttons: the review loop, from a phone.
|
|
2
|
+
//
|
|
3
|
+
// Kept out of `ctrl.mjs` because it is a surface of its own — the card, the two
|
|
4
|
+
// buttons per hunk and the four ways a press can end — and it has to agree with
|
|
5
|
+
// itself in three languages.
|
|
6
|
+
export default {
|
|
7
|
+
'diff.noChanges': 'No changes in the working tree.',
|
|
8
|
+
'diff.head': '{files} file(s) changed, +{added} -{removed}',
|
|
9
|
+
'diff.untracked': 'new, not added yet: {list}',
|
|
10
|
+
'diff.newFile': 'new',
|
|
11
|
+
'diff.deletedFile': 'deleted',
|
|
12
|
+
'diff.renamedFile': 'renamed',
|
|
13
|
+
'diff.binaryFile': 'binary',
|
|
14
|
+
'diff.truncated': '…{n} more hunk(s) left out — they do not fit in one message.',
|
|
15
|
+
'diff.truncatedFiles': '…{n} more file(s) left out for the same reason.',
|
|
16
|
+
'diff.tooManyButtons': 'Only the first hunks have buttons; {n} more are in the diff but not on the keyboard.',
|
|
17
|
+
'diff.refresh': '🔄 Refresh',
|
|
18
|
+
'diff.explainShort': '💭 line {line}',
|
|
19
|
+
'diff.revertShort': '↩️ line {line}',
|
|
20
|
+
'diff.refreshed': 'Refreshed.',
|
|
21
|
+
'diff.explaining': 'Asking about that hunk.',
|
|
22
|
+
'diff.explainPrompt': 'Explain what this hunk changes in {file} (around line {line}), and say whether it is right.',
|
|
23
|
+
'diff.stale': 'That hunk is not in the diff any more — the file changed since the card was drawn. Send /diff again.',
|
|
24
|
+
'diff.reverted': 'Reverted that hunk in {file} (line {line}).',
|
|
25
|
+
'diff.revertFailed': 'Could not revert that hunk: {why}. The file is untouched.',
|
|
26
|
+
'diff.noReason': 'git gave no reason',
|
|
27
|
+
'diff.notRepo': '{dir} is not a git repository, so there is nothing to compare.',
|
|
28
|
+
'diff.noDir': 'this topic has no directory yet — set one with /cd',
|
|
29
|
+
'menu.cmd.diff': 'What this turn changed: one hunk at a time, with explain and revert',
|
|
30
|
+
'ctrl.help.about.diff': 'What the turn changed in this topic, one hunk at a time. Every hunk gets two buttons: explain it, or revert just that hunk. `/diff stat` is the file list alone.',
|
|
31
|
+
};
|
package/i18n/en.mjs
CHANGED
|
@@ -8,4 +8,5 @@ import sandbox from './en/sandbox.mjs';
|
|
|
8
8
|
import core from './en/core.mjs';
|
|
9
9
|
import fallback from './en/fallback.mjs';
|
|
10
10
|
import release from './en/release.mjs';
|
|
11
|
-
|
|
11
|
+
import diff from './en/diff.mjs';
|
|
12
|
+
export default { ...core, ...ctrl, ...cost, ...sandbox, ...fallback, ...release, ...diff };
|
package/i18n/ru/core.mjs
CHANGED
|
@@ -14,7 +14,7 @@ export default {
|
|
|
14
14
|
'settings.state.on': 'вкл',
|
|
15
15
|
'settings.state.off': 'выкл',
|
|
16
16
|
'settings.state.auto': 'авто',
|
|
17
|
-
'help.body': "Задачу можно писать обычным текстом. Каждая ветка форума — отдельная сессия:\n\nРабота: /cd \u003cпроект\u003e · /new · /stop · /send \u003cфайл\u003e · /seed \u003cтекст\u003e\nЦели: /goal · /tasks [\u003ctext\u003e|done N] · /tasks (нажать, чтобы отметить)\nСессии: /status · /sessions [\u003cid\u003e] · /rewind [n|undo|fork [n]|branches] · /new · /profile \u003cимя\u003e\nАгенты: /agents · /agents set model|depth|filter … @tool\nМодели: /model · /model \u003cid\u003e · /fallback · /load · /prices · /cost · /thoughts\nНастройка: /effort · /permissions · /preset · /crew [use|show|off|new] · /plan · /jobs [n] · /remind\nРасширения: /skills · /plugins [add|remove] · /soul\nВерсии: /update [confirm|on|off|auto] · /subscribe on|off\nПрочее: /settings · /lang · /reasoning · /pin · /doctor · /logs [errors|N] · /report · /app · /restart · /help\nПанели: /menu — те же команды кнопками, по страницам. /menu on добавляет четыре клавиши под полем ввода.",
|
|
17
|
+
'help.body': "Задачу можно писать обычным текстом. Каждая ветка форума — отдельная сессия:\n\nРабота: /cd \u003cпроект\u003e · /new · /stop · /send \u003cфайл\u003e · /seed \u003cтекст\u003e · /diff [stat]\nЦели: /goal · /tasks [\u003ctext\u003e|done N] · /tasks (нажать, чтобы отметить)\nСессии: /status · /sessions [\u003cid\u003e] · /rewind [n|undo|fork [n]|branches] · /new · /profile \u003cимя\u003e\nАгенты: /agents · /agents set model|depth|filter … @tool\nМодели: /model · /model \u003cid\u003e · /fallback · /load · /prices · /cost · /thoughts\nНастройка: /effort · /permissions · /preset · /crew [use|show|off|new] · /plan · /jobs [n] · /remind\nРасширения: /skills · /plugins [add|remove] · /soul\nВерсии: /update [confirm|on|off|auto] · /subscribe on|off\nПрочее: /settings · /lang · /reasoning · /pin · /doctor · /logs [errors|N] · /report · /app · /restart · /help\nПанели: /menu — те же команды кнопками, по страницам. /menu on добавляет четыре клавиши под полем ввода.",
|
|
18
18
|
'settings.reply.title': 'Что бот говорит',
|
|
19
19
|
'settings.agent.title': 'Кто отвечает и как старается',
|
|
20
20
|
'settings.updates.title': 'Новые версии (эта установка, не тема)',
|
package/i18n/ru/diff.mjs
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// `/diff` и его кнопки: цикл ревью с телефона.
|
|
2
|
+
//
|
|
3
|
+
// Отдельно от `ctrl.mjs`, потому что это самостоятельная поверхность — карточка,
|
|
4
|
+
// две кнопки на каждый хунк и четыре варианта, чем может кончиться нажатие, — и
|
|
5
|
+
// в трёх языках она должна говорить одно и то же.
|
|
6
|
+
export default {
|
|
7
|
+
'diff.noChanges': 'В рабочей копии изменений нет.',
|
|
8
|
+
'diff.head': 'Изменено файлов: {files}, +{added} -{removed}',
|
|
9
|
+
'diff.untracked': 'новые, ещё не добавлены: {list}',
|
|
10
|
+
'diff.newFile': 'новый',
|
|
11
|
+
'diff.deletedFile': 'удалён',
|
|
12
|
+
'diff.renamedFile': 'переименован',
|
|
13
|
+
'diff.binaryFile': 'бинарный',
|
|
14
|
+
'diff.truncated': '…ещё {n} хунк(ов) не показаны — они не влезают в одно сообщение.',
|
|
15
|
+
'diff.truncatedFiles': '…ещё {n} файл(ов) не показаны по той же причине.',
|
|
16
|
+
'diff.tooManyButtons': 'Кнопки только у первых хунов; ещё {n} есть в диффе, но не на клавиатуре.',
|
|
17
|
+
'diff.refresh': '🔄 Обновить',
|
|
18
|
+
'diff.explainShort': '💭 строка {line}',
|
|
19
|
+
'diff.revertShort': '↩️ строка {line}',
|
|
20
|
+
'diff.refreshed': 'Обновил.',
|
|
21
|
+
'diff.explaining': 'Спрашиваю про этот хунк.',
|
|
22
|
+
'diff.explainPrompt': 'Объясни, что меняет этот хунк в {file} (примерно строка {line}), и скажи, правильно ли это.',
|
|
23
|
+
'diff.stale': 'Этого хуна в диффе уже нет — файл изменился после того, как карточка была нарисована. Отправь /diff снова.',
|
|
24
|
+
'diff.reverted': 'Откатил этот хунк в {file} (строка {line}).',
|
|
25
|
+
'diff.revertFailed': 'Откатить этот хунк не вышло: {why}. Файл не тронут.',
|
|
26
|
+
'diff.noReason': 'git не назвал причину',
|
|
27
|
+
'diff.notRepo': '{dir} — не git-репозиторий, сравнивать не с чем.',
|
|
28
|
+
'diff.noDir': 'у этого топика ещё нет папки — задай её через /cd',
|
|
29
|
+
'menu.cmd.diff': 'Что изменил этот ход: по одному хуну, с объяснением и откатом',
|
|
30
|
+
'ctrl.help.about.diff': 'Что изменил ход в этом топике, по одному хуну за раз. У каждого хуна две кнопки: объяснить его или откатить только его. `/diff stat` — только список файлов.',
|
|
31
|
+
};
|
package/i18n/ru.mjs
CHANGED
|
@@ -8,4 +8,5 @@ import sandbox from './ru/sandbox.mjs';
|
|
|
8
8
|
import core from './ru/core.mjs';
|
|
9
9
|
import fallback from './ru/fallback.mjs';
|
|
10
10
|
import release from './ru/release.mjs';
|
|
11
|
-
|
|
11
|
+
import diff from './ru/diff.mjs';
|
|
12
|
+
export default { ...core, ...ctrl, ...cost, ...sandbox, ...fallback, ...release, ...diff };
|
package/i18n/zh/core.mjs
CHANGED
|
@@ -14,7 +14,7 @@ export default {
|
|
|
14
14
|
'settings.state.on': '开',
|
|
15
15
|
'settings.state.off': '关',
|
|
16
16
|
'settings.state.auto': '自动',
|
|
17
|
-
'help.body': "任务直接以文本发送。每个论坛话题是一个独立会话:\n\n工作: /cd \u003c项目\u003e · /new · /stop · /send \u003c文件\u003e · /seed \u003c文本\u003e\n目标: /goal · /tasks [\u003ctext\u003e|done N] · /tasks(点击勾选)\n会话: /status · /sessions [\u003cid\u003e] · /rewind [n|undo|fork [n]|branches] · /new · /profile \u003c名称\u003e\n智能体: /agents · /agents set model|depth|filter … @tool\n模型: /model · /model \u003cid\u003e · /fallback · /load · /prices · /cost · /thoughts\n调优: /effort · /permissions · /preset · /crew [use|show|off|new] · /plan · /jobs [n] · /remind\n扩展: /skills · /plugins [add|remove] · /soul\n版本: /update [confirm|on|off|auto] · /subscribe on|off\n其他: /settings · /lang · /reasoning · /pin · /doctor · /logs [errors|N] · /report · /app · /restart · /help\n面板: /menu — 同样的命令做成按钮,分页浏览。/menu on 在输入框下方加四个键。",
|
|
17
|
+
'help.body': "任务直接以文本发送。每个论坛话题是一个独立会话:\n\n工作: /cd \u003c项目\u003e · /new · /stop · /send \u003c文件\u003e · /seed \u003c文本\u003e · /diff [stat]\n目标: /goal · /tasks [\u003ctext\u003e|done N] · /tasks(点击勾选)\n会话: /status · /sessions [\u003cid\u003e] · /rewind [n|undo|fork [n]|branches] · /new · /profile \u003c名称\u003e\n智能体: /agents · /agents set model|depth|filter … @tool\n模型: /model · /model \u003cid\u003e · /fallback · /load · /prices · /cost · /thoughts\n调优: /effort · /permissions · /preset · /crew [use|show|off|new] · /plan · /jobs [n] · /remind\n扩展: /skills · /plugins [add|remove] · /soul\n版本: /update [confirm|on|off|auto] · /subscribe on|off\n其他: /settings · /lang · /reasoning · /pin · /doctor · /logs [errors|N] · /report · /app · /restart · /help\n面板: /menu — 同样的命令做成按钮,分页浏览。/menu on 在输入框下方加四个键。",
|
|
18
18
|
'settings.reply.title': '机器人怎么说',
|
|
19
19
|
'settings.agent.title': '谁来回答、投入多少',
|
|
20
20
|
'settings.updates.title': '新版本(针对本次安装,而非话题)',
|
package/i18n/zh/diff.mjs
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// `/diff` 及其按钮:在手机上完成审阅。
|
|
2
|
+
//
|
|
3
|
+
// 不放在 `ctrl.mjs` 里,因为它自成一套界面——卡片、每个 hunk 的两个按钮、按下
|
|
4
|
+
// 之后的四种结局——三种语言必须说同一件事。
|
|
5
|
+
export default {
|
|
6
|
+
'diff.noChanges': '工作区没有改动。',
|
|
7
|
+
'diff.head': '改了 {files} 个文件,+{added} -{removed}',
|
|
8
|
+
'diff.untracked': '新增但还没加入版本库:{list}',
|
|
9
|
+
'diff.newFile': '新增',
|
|
10
|
+
'diff.deletedFile': '删除',
|
|
11
|
+
'diff.renamedFile': '重命名',
|
|
12
|
+
'diff.binaryFile': '二进制',
|
|
13
|
+
'diff.truncated': '……还有 {n} 个 hunk 没显示——一条消息放不下。',
|
|
14
|
+
'diff.truncatedFiles': '……还有 {n} 个文件因同样原因没显示。',
|
|
15
|
+
'diff.tooManyButtons': '只有前面的 hunk 有按钮;还有 {n} 个在 diff 里,但没放到键盘上。',
|
|
16
|
+
'diff.refresh': '🔄 刷新',
|
|
17
|
+
'diff.explainShort': '💭 第 {line} 行',
|
|
18
|
+
'diff.revertShort': '↩️ 第 {line} 行',
|
|
19
|
+
'diff.refreshed': '已刷新。',
|
|
20
|
+
'diff.explaining': '正在问这个 hunk。',
|
|
21
|
+
'diff.explainPrompt': '解释这个 hunk 在 {file} 里改了什么(大约第 {line} 行),并说明它对不对。',
|
|
22
|
+
'diff.stale': '这个 hunk 已经不在 diff 里了——卡片画出之后文件变了。请再发一次 /diff。',
|
|
23
|
+
'diff.reverted': '已回退 {file} 里这个 hunk(第 {line} 行)。',
|
|
24
|
+
'diff.revertFailed': '没能回退这个 hunk:{why}。文件没有被改动。',
|
|
25
|
+
'diff.noReason': 'git 没给出原因',
|
|
26
|
+
'diff.notRepo': '{dir} 不是 git 仓库,没有可比较的内容。',
|
|
27
|
+
'diff.noDir': '这个话题还没有目录——用 /cd 设置',
|
|
28
|
+
'menu.cmd.diff': '这一回合改了什么:逐个 hunk 查看,可解释也可回退',
|
|
29
|
+
'ctrl.help.about.diff': '这个话题里这一回合改了什么,一个 hunk 一个 hunk 地看。每个 hunk 有两个按钮:解释它,或者只回退它。`/diff stat` 只看文件列表。',
|
|
30
|
+
};
|
package/i18n/zh.mjs
CHANGED
|
@@ -8,4 +8,5 @@ import sandbox from './zh/sandbox.mjs';
|
|
|
8
8
|
import core from './zh/core.mjs';
|
|
9
9
|
import fallback from './zh/fallback.mjs';
|
|
10
10
|
import release from './zh/release.mjs';
|
|
11
|
-
|
|
11
|
+
import diff from './zh/diff.mjs';
|
|
12
|
+
export default { ...core, ...ctrl, ...cost, ...sandbox, ...fallback, ...release, ...diff };
|
package/menu-card.mjs
CHANGED
|
@@ -15,7 +15,7 @@ import { CONTROL_COMMANDS, DOCUMENTED_COMMANDS } from './commands-registry.mjs';
|
|
|
15
15
|
* a panel that hides half the bot sends people back to typing.
|
|
16
16
|
*/
|
|
17
17
|
const SECTIONS = {
|
|
18
|
-
work: ['cd', 'seed', 'send'],
|
|
18
|
+
work: ['cd', 'seed', 'send', 'diff'],
|
|
19
19
|
session: ['sessions', 'rewind', 'profile', 'agents'],
|
|
20
20
|
goals: ['goal', 'task', 'tasks', 'plan', 'jobs', 'remind'],
|
|
21
21
|
talk: ['effort', 'reasoning', 'pin', 'thoughts', 'prices', 'cost', 'lang', 'fallback'],
|
|
@@ -57,6 +57,7 @@ export function isMenuPress(value) {
|
|
|
57
57
|
/** The label a button carries: the command itself, with its argument if it needs one. */
|
|
58
58
|
const LABELS = {
|
|
59
59
|
cd: '/cd <project>',
|
|
60
|
+
diff: '/diff [stat]',
|
|
60
61
|
seed: '/seed <text>',
|
|
61
62
|
send: '/send <file>',
|
|
62
63
|
stop: '/stop',
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-tg-bridge",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "Telegram bridge for
|
|
3
|
+
"version": "1.31.0",
|
|
4
|
+
"description": "Telegram bridge for [DSH]: text, voice, photos and project-per-topic sessions without opening the desktop app",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "plugin-bridge.mjs",
|
|
7
7
|
"bin": {
|
|
@@ -62,6 +62,8 @@
|
|
|
62
62
|
"install-check.mjs",
|
|
63
63
|
"sandbox-note.mjs",
|
|
64
64
|
"stability.mjs",
|
|
65
|
+
"diff.mjs",
|
|
66
|
+
"control/cmd-diff.mjs",
|
|
65
67
|
"turn-events.mjs",
|
|
66
68
|
"cost.mjs",
|
|
67
69
|
"price-cache.mjs",
|
|
@@ -163,7 +165,8 @@
|
|
|
163
165
|
"jobs-cap.mjs",
|
|
164
166
|
"job-loops.mjs",
|
|
165
167
|
"report.mjs",
|
|
166
|
-
"docs/SUPPORT.md"
|
|
168
|
+
"docs/SUPPORT.md",
|
|
169
|
+
"docs/MOBILE-FIRST.md"
|
|
167
170
|
],
|
|
168
171
|
"homepage": "https://github.com/aleksvega/dsh-tg-bridge#readme",
|
|
169
172
|
"bugs": {
|