telecoder 0.0.0-stage → 1.3.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/.env.example +375 -0
- package/CHANGELOG.md +1867 -0
- package/LICENSE +22 -0
- package/README.md +130 -2
- package/dist/audio/transcribe.js +41 -0
- package/dist/bin/mcp-server.js +363 -0
- package/dist/bin/tool-result.js +22 -0
- package/dist/bot/access/group-access.js +147 -0
- package/dist/bot/bot.js +573 -0
- package/dist/bot/command-catalog.js +263 -0
- package/dist/bot/deleted-threads.js +103 -0
- package/dist/bot/file-access.js +150 -0
- package/dist/bot/handlers/album.handler.js +128 -0
- package/dist/bot/handlers/branch.handler.js +1096 -0
- package/dist/bot/handlers/command/access.js +407 -0
- package/dist/bot/handlers/command/admin.js +803 -0
- package/dist/bot/handlers/command/all-view.js +33 -0
- package/dist/bot/handlers/command/auto-approve.js +138 -0
- package/dist/bot/handlers/command/background.js +37 -0
- package/dist/bot/handlers/command/botname.js +76 -0
- package/dist/bot/handlers/command/btw.js +175 -0
- package/dist/bot/handlers/command/cleanup.js +329 -0
- package/dist/bot/handlers/command/model.js +226 -0
- package/dist/bot/handlers/command/prefs-scope.js +362 -0
- package/dist/bot/handlers/command/project.js +458 -0
- package/dist/bot/handlers/command/resume.js +325 -0
- package/dist/bot/handlers/command/session.js +299 -0
- package/dist/bot/handlers/command/settings.js +657 -0
- package/dist/bot/handlers/command/shared.js +207 -0
- package/dist/bot/handlers/command/tasks.js +681 -0
- package/dist/bot/handlers/command/thread.js +128 -0
- package/dist/bot/handlers/command/topic-store.js +74 -0
- package/dist/bot/handlers/command/topic.js +27 -0
- package/dist/bot/handlers/command/usage.js +382 -0
- package/dist/bot/handlers/command-fallback.js +179 -0
- package/dist/bot/handlers/command.handler.js +446 -0
- package/dist/bot/handlers/loop.handler.js +389 -0
- package/dist/bot/handlers/media-fallback.js +126 -0
- package/dist/bot/handlers/message/replies.js +56 -0
- package/dist/bot/handlers/message/shared.js +95 -0
- package/dist/bot/handlers/message/turn-notify.js +135 -0
- package/dist/bot/handlers/message/turn-runner.js +56 -0
- package/dist/bot/handlers/message.handler.js +114 -0
- package/dist/bot/handlers/newbot.handler.js +230 -0
- package/dist/bot/handlers/photo.handler.js +286 -0
- package/dist/bot/handlers/prompts.handler.js +343 -0
- package/dist/bot/handlers/running-note.js +44 -0
- package/dist/bot/handlers/session-guard.js +78 -0
- package/dist/bot/handlers/suggestion.handler.js +84 -0
- package/dist/bot/handlers/tree.handler.js +480 -0
- package/dist/bot/handlers/view.js +41 -0
- package/dist/bot/handlers/voice.handler.js +147 -0
- package/dist/bot/kept-threads.js +51 -0
- package/dist/bot/middleware/admin-only.js +49 -0
- package/dist/bot/middleware/album-collector.js +69 -0
- package/dist/bot/middleware/auth.middleware.js +122 -0
- package/dist/bot/middleware/group-mention.middleware.js +145 -0
- package/dist/bot/middleware/group-role.middleware.js +75 -0
- package/dist/bot/middleware/message-batcher.js +87 -0
- package/dist/bot/middleware/queued-messages.js +1082 -0
- package/dist/bot/middleware/stale-filter.js +9 -0
- package/dist/build-info.json +8 -0
- package/dist/claude/ask-user-form.js +517 -0
- package/dist/claude/ask-user.js +363 -0
- package/dist/claude/auto-approve.js +225 -0
- package/dist/claude/auto-topic-haiku.js +143 -0
- package/dist/claude/available-commands.js +156 -0
- package/dist/claude/background-hint.js +91 -0
- package/dist/claude/branch-tree.js +393 -0
- package/dist/claude/carry-over.js +25 -0
- package/dist/claude/ccr-shim.js +48 -0
- package/dist/claude/charter-judge.js +214 -0
- package/dist/claude/claude-auth.js +117 -0
- package/dist/claude/command-parser.js +206 -0
- package/dist/claude/cost-overlay-scraper.js +134 -0
- package/dist/claude/effort-level.js +5 -0
- package/dist/claude/enabled-plugins.js +52 -0
- package/dist/claude/in-flight-tracker.js +82 -0
- package/dist/claude/ipc-server.js +192 -0
- package/dist/claude/mcp-bridge.js +481 -0
- package/dist/claude/memory-guard.js +400 -0
- package/dist/claude/message-offsets.js +88 -0
- package/dist/claude/modal-relay.js +817 -0
- package/dist/claude/model-catalog.js +102 -0
- package/dist/claude/monitor-relay.js +712 -0
- package/dist/claude/native-commands.js +40 -0
- package/dist/claude/pending-branches.js +93 -0
- package/dist/claude/pending-suggestions.js +50 -0
- package/dist/claude/permission-gate.js +338 -0
- package/dist/claude/permission-mode.js +152 -0
- package/dist/claude/poll-user.js +51 -0
- package/dist/claude/prewarm.js +70 -0
- package/dist/claude/project-commands.js +69 -0
- package/dist/claude/prompt-hold.js +124 -0
- package/dist/claude/prompt-suggestion-scraper.js +89 -0
- package/dist/claude/pty-idle-reaper.js +96 -0
- package/dist/claude/pty-provider.js +2499 -0
- package/dist/claude/pty-spawn-config.js +343 -0
- package/dist/claude/pty-stream.js +363 -0
- package/dist/claude/pty-watch.js +201 -0
- package/dist/claude/request-queue.js +107 -0
- package/dist/claude/rewind.js +111 -0
- package/dist/claude/scheduled-runner.js +89 -0
- package/dist/claude/scheduler.js +241 -0
- package/dist/claude/scope-guard.js +279 -0
- package/dist/claude/screen-marks.js +83 -0
- package/dist/claude/screen-render.js +96 -0
- package/dist/claude/secret-request.js +576 -0
- package/dist/claude/session-history.js +288 -0
- package/dist/claude/session-jsonl.js +1067 -0
- package/dist/claude/session-manager.js +216 -0
- package/dist/claude/session-move.js +70 -0
- package/dist/claude/session-scan.js +270 -0
- package/dist/claude/setup-token.js +285 -0
- package/dist/claude/shell-mode-gate.js +60 -0
- package/dist/claude/side-call-options.js +45 -0
- package/dist/claude/side-question.js +252 -0
- package/dist/claude/stage-images.js +62 -0
- package/dist/claude/subagent-tools.js +12 -0
- package/dist/claude/synthetic-ctx.js +51 -0
- package/dist/claude/tasks-overlay-scraper.js +217 -0
- package/dist/claude/thread-judge-haiku.js +88 -0
- package/dist/claude/tip-scraper.js +77 -0
- package/dist/claude/tui-modal.js +746 -0
- package/dist/claude/tui-state.js +456 -0
- package/dist/claude/turn-end.js +105 -0
- package/dist/claude/turn-prose.js +64 -0
- package/dist/claude/typed-answer.js +104 -0
- package/dist/claude/update-banner-relay.js +70 -0
- package/dist/cli/commands/doctor.js +338 -0
- package/dist/cli/commands/help.js +34 -0
- package/dist/cli/commands/init.js +126 -0
- package/dist/cli/commands/service.js +710 -0
- package/dist/cli/commands/start.js +63 -0
- package/dist/cli/commands/version.js +11 -0
- package/dist/cli/commands/watch.js +322 -0
- package/dist/cli/dispatch.js +84 -0
- package/dist/cli/init/env-file.js +99 -0
- package/dist/cli/init/flow.js +705 -0
- package/dist/cli/init/prompter.js +124 -0
- package/dist/cli/init/telegram.js +120 -0
- package/dist/cli/service/render.js +212 -0
- package/dist/cli.js +18 -0
- package/dist/config-report.js +107 -0
- package/dist/config.js +525 -0
- package/dist/index.js +443 -0
- package/dist/launcher.js +960 -0
- package/dist/node-version-check.js +27 -0
- package/dist/providers/ccr-health.js +119 -0
- package/dist/providers/ccr-introspect.js +142 -0
- package/dist/providers/ccr-provider.js +59 -0
- package/dist/providers/claude-provider.js +10 -0
- package/dist/providers/prefs-sync.js +121 -0
- package/dist/providers/project-favorites.js +74 -0
- package/dist/providers/provider-router.js +128 -0
- package/dist/providers/provider-switch.js +91 -0
- package/dist/providers/spawn-settings.js +45 -0
- package/dist/providers/types.js +8 -0
- package/dist/providers/user-preferences.js +322 -0
- package/dist/restart-when-idle.js +173 -0
- package/dist/startup/auto-continue.js +67 -0
- package/dist/startup/auto-resume.js +161 -0
- package/dist/startup/notices.js +120 -0
- package/dist/startup/shared.js +44 -0
- package/dist/startup/verify-token.js +31 -0
- package/dist/telegram/access-request.js +153 -0
- package/dist/telegram/action-logger.js +522 -0
- package/dist/telegram/admin-mention.js +107 -0
- package/dist/telegram/background-activity-card.js +502 -0
- package/dist/telegram/botname-settings.js +282 -0
- package/dist/telegram/button-text.js +26 -0
- package/dist/telegram/client-options.js +26 -0
- package/dist/telegram/deduplication.js +33 -0
- package/dist/telegram/entities.js +295 -0
- package/dist/telegram/force-reply-tracker.js +96 -0
- package/dist/telegram/lettered-options.js +87 -0
- package/dist/telegram/markdown.js +362 -0
- package/dist/telegram/message-sender.js +1019 -0
- package/dist/telegram/prompt-label.js +148 -0
- package/dist/telegram/prompt-suggestion.js +54 -0
- package/dist/telegram/send.js +123 -0
- package/dist/telegram/streaming-turn.js +103 -0
- package/dist/telegram/suggestions-settings.js +30 -0
- package/dist/telegram/table-lists.js +56 -0
- package/dist/telegram/task-list.js +367 -0
- package/dist/telegram/task-tracker.js +128 -0
- package/dist/telegram/terminal-renderer.js +667 -0
- package/dist/telegram/thread-titles.js +262 -0
- package/dist/telegram/threads-setup.js +117 -0
- package/dist/utils/admins.js +143 -0
- package/dist/utils/agent-timer.js +55 -0
- package/dist/utils/atomic-write.js +24 -0
- package/dist/utils/bot-icon.js +248 -0
- package/dist/utils/bot-token.js +77 -0
- package/dist/utils/bounded-map.js +55 -0
- package/dist/utils/build-info.js +57 -0
- package/dist/utils/caffeinate.js +53 -0
- package/dist/utils/claude-env.js +53 -0
- package/dist/utils/claude-version.js +48 -0
- package/dist/utils/config-home.js +62 -0
- package/dist/utils/download.js +137 -0
- package/dist/utils/exit-codes.js +59 -0
- package/dist/utils/file-type.js +149 -0
- package/dist/utils/format.js +78 -0
- package/dist/utils/home-project.js +30 -0
- package/dist/utils/host-stall.js +51 -0
- package/dist/utils/id-list.js +44 -0
- package/dist/utils/idle-restart.js +92 -0
- package/dist/utils/install-mode.js +63 -0
- package/dist/utils/instance-config.js +148 -0
- package/dist/utils/instances.js +95 -0
- package/dist/utils/json-store.js +140 -0
- package/dist/utils/keyed-settings.js +62 -0
- package/dist/utils/legacy-env.js +35 -0
- package/dist/utils/memory-pressure.js +60 -0
- package/dist/utils/npm-version.js +134 -0
- package/dist/utils/prefs-relay.js +107 -0
- package/dist/utils/proc-children.js +102 -0
- package/dist/utils/resolve-bin.js +86 -0
- package/dist/utils/resolve-claude-bin.js +52 -0
- package/dist/utils/respawn-backoff.js +28 -0
- package/dist/utils/sanitize.js +91 -0
- package/dist/utils/session-key.js +37 -0
- package/dist/utils/stale-launcher.js +109 -0
- package/dist/utils/state-dir-migration.js +92 -0
- package/dist/utils/systemd.js +126 -0
- package/dist/utils/telegram-proxy.js +72 -0
- package/dist/utils/uploads-dir.js +27 -0
- package/dist/utils/user-roster.js +275 -0
- package/dist/utils/verbosity.js +118 -0
- package/dist/utils/version-check.js +166 -0
- package/dist/utils/workspace-guard.js +44 -0
- package/dist/worker-restart.js +141 -0
- package/instances.json.example +41 -0
- package/package.json +75 -4
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Helpers shared across the command handlers.
|
|
3
|
+
*
|
|
4
|
+
* These are the pieces that several unrelated command domains all reach for —
|
|
5
|
+
* the markdown reply shorthand, the callback-query preamble, the project
|
|
6
|
+
* status block. They live here so the domain modules depend on one small
|
|
7
|
+
* shared surface instead of on each other.
|
|
8
|
+
*/
|
|
9
|
+
import { sessionManager } from '../../../claude/session-manager.js';
|
|
10
|
+
import { envFilePath } from '../../../config.js';
|
|
11
|
+
import { getModel, getEffort, getActiveProviderName, } from '../../../providers/provider-router.js';
|
|
12
|
+
import { EntityText } from '../../../telegram/entities.js';
|
|
13
|
+
import { replyMarkdown } from '../../../telegram/send.js';
|
|
14
|
+
import { fitsOnButton } from '../../../telegram/button-text.js';
|
|
15
|
+
import { getSessionKeyFromCtx } from '../../../utils/session-key.js';
|
|
16
|
+
import { formatTimeAgo } from '../../../utils/format.js';
|
|
17
|
+
import { PACKAGE_ROOT } from '../../../utils/install-mode.js';
|
|
18
|
+
/** Repo root (the package root, in an npm install). */
|
|
19
|
+
export const PROJECT_ROOT = PACKAGE_ROOT;
|
|
20
|
+
/**
|
|
21
|
+
* Reply with standard markdown, sent as entities. For static text only: a
|
|
22
|
+
* dynamic part (a path, a name, an error) goes through an {@link EntityText}
|
|
23
|
+
* instead, since nothing escapes it here.
|
|
24
|
+
*/
|
|
25
|
+
export async function replyMd(ctx, markdown) {
|
|
26
|
+
await replyMarkdown(ctx, markdown);
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Resolve the session-key info and callback-data for a callback-query handler,
|
|
30
|
+
* gated on the data starting with `prefix`. Returns null (so the caller can
|
|
31
|
+
* early-return) when there is no session key, no callback data, or the data
|
|
32
|
+
* doesn't match the prefix. Folds the repeated keyInfo + data guard preamble
|
|
33
|
+
* that every prefix-scoped callback handler shares.
|
|
34
|
+
*/
|
|
35
|
+
export function parseCallback(ctx, prefix) {
|
|
36
|
+
const keyInfo = getSessionKeyFromCtx(ctx);
|
|
37
|
+
if (!keyInfo)
|
|
38
|
+
return null;
|
|
39
|
+
const data = ctx.callbackQuery?.data;
|
|
40
|
+
if (!data || !data.startsWith(prefix))
|
|
41
|
+
return null;
|
|
42
|
+
return { ...keyInfo, data };
|
|
43
|
+
}
|
|
44
|
+
export function buildFeatureDisabledMessage(feature) {
|
|
45
|
+
return `⚠️ ${feature} feature is disabled in configuration.`;
|
|
46
|
+
}
|
|
47
|
+
export async function replyFeatureDisabled(ctx, feature) {
|
|
48
|
+
await ctx.reply(buildFeatureDisabledMessage(feature));
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* What a voice note gets when no Groq key is set: how to turn
|
|
52
|
+
* transcription on, instead of a "Transcribing..." ack followed by a raw
|
|
53
|
+
* "GROQ_API_KEY not configured" error. Declining voice in `telecoder init` is
|
|
54
|
+
* the common case, so this is where most people learn how to add it later.
|
|
55
|
+
*/
|
|
56
|
+
export function buildVoiceNotSetUpMessage() {
|
|
57
|
+
return [
|
|
58
|
+
'🎤 Voice transcription is off: no Groq API key is set.',
|
|
59
|
+
'',
|
|
60
|
+
'To turn it on, get a key at https://console.groq.com/keys (Groq has a free tier), then either:',
|
|
61
|
+
'• run `telecoder init` again — it keeps your other answers and asks for the key, or',
|
|
62
|
+
`• add GROQ_API_KEY=gsk_... to ${envFilePath} and /botrestart.`,
|
|
63
|
+
].join('\n');
|
|
64
|
+
}
|
|
65
|
+
export async function replyVoiceNotSetUp(ctx) {
|
|
66
|
+
await ctx.reply(buildVoiceNotSetUpMessage());
|
|
67
|
+
}
|
|
68
|
+
export const EFFORT_LEVELS = [
|
|
69
|
+
{ id: 'low', label: '🐇 Low', description: 'Minimal thinking, fastest' },
|
|
70
|
+
{ id: 'medium', label: '⚖️ Medium', description: 'Balanced speed/quality' },
|
|
71
|
+
{ id: 'high', label: '🧠 High', description: 'Deep reasoning' },
|
|
72
|
+
{ id: 'xhigh', label: '🔬 XHigh', description: 'Deeper than high (default on current models)' },
|
|
73
|
+
{ id: 'max', label: '🚀 Max', description: 'Maximum effort' },
|
|
74
|
+
];
|
|
75
|
+
/** Get the full label (e.g. "🐇 Low") for a thread's or chat's current effort level. */
|
|
76
|
+
export function getEffortLabel(scope) {
|
|
77
|
+
const effort = getEffort(scope);
|
|
78
|
+
if (!effort)
|
|
79
|
+
return undefined;
|
|
80
|
+
return effortLevelLabel(effort);
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* The label for an effort level by name, for the one the session log reports
|
|
84
|
+
* when the chat set none itself. The CLI logs the API's four levels, so
|
|
85
|
+
* 'xhigh' never comes from there; a level this list doesn't know is shown as
|
|
86
|
+
* it was logged rather than dropped.
|
|
87
|
+
*/
|
|
88
|
+
export function effortLevelLabel(effort) {
|
|
89
|
+
return EFFORT_LEVELS.find((l) => l.id === effort)?.label
|
|
90
|
+
?? `🧠 ${effort.charAt(0).toUpperCase()}${effort.slice(1)}`;
|
|
91
|
+
}
|
|
92
|
+
/** Build status lines appended to project confirmation messages. */
|
|
93
|
+
export function projectStatusSuffix(sessionKey) {
|
|
94
|
+
const model = getModel(sessionKey);
|
|
95
|
+
const provider = getActiveProviderName(sessionKey);
|
|
96
|
+
const session = sessionManager.getSession(sessionKey);
|
|
97
|
+
const created = session?.createdAt
|
|
98
|
+
? new Date(session.createdAt).toLocaleString()
|
|
99
|
+
: new Date().toLocaleString();
|
|
100
|
+
const sessionId = session?.claudeSessionId;
|
|
101
|
+
const effortLabel = getEffortLabel(sessionKey) ?? 'Default';
|
|
102
|
+
const suffix = new EntityText()
|
|
103
|
+
.add('\n• ').bold('Provider:').add(` ${provider}`)
|
|
104
|
+
.add('\n• ').bold('Model:').add(` ${model}`)
|
|
105
|
+
.add('\n• ').bold('Effort:').add(` ${effortLabel}`)
|
|
106
|
+
.add('\n• ').bold('Created:').add(` ${created}`)
|
|
107
|
+
.add('\n• ').bold('Session ID:').add(' ');
|
|
108
|
+
if (sessionId) {
|
|
109
|
+
suffix.code(sessionId);
|
|
110
|
+
suffix.add('\n\n💡 To continue this session from the terminal, copy the command below.');
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
suffix.italic('pending — send a message to start');
|
|
114
|
+
}
|
|
115
|
+
return suffix.build();
|
|
116
|
+
}
|
|
117
|
+
/** The copyable command sent as a separate message. */
|
|
118
|
+
export function resumeCommandMessage(sessionId) {
|
|
119
|
+
return new EntityText().code(`claude --resume ${sessionId}`).build();
|
|
120
|
+
}
|
|
121
|
+
/** Truncate a string to fit within `maxBytes` UTF-8 bytes without splitting a codepoint. */
|
|
122
|
+
export function truncateToBytes(s, maxBytes) {
|
|
123
|
+
if (Buffer.byteLength(s, 'utf8') <= maxBytes)
|
|
124
|
+
return s;
|
|
125
|
+
let out = '';
|
|
126
|
+
for (const ch of s) {
|
|
127
|
+
if (Buffer.byteLength(out + ch, 'utf8') > maxBytes)
|
|
128
|
+
break;
|
|
129
|
+
out += ch;
|
|
130
|
+
}
|
|
131
|
+
return out;
|
|
132
|
+
}
|
|
133
|
+
export { formatTimeAgo };
|
|
134
|
+
/**
|
|
135
|
+
* How much of a session's name a picker spells out.
|
|
136
|
+
*
|
|
137
|
+
* Nothing the model writes comes close — a topic is a handful of words — but
|
|
138
|
+
* `/topic` takes whatever you type, and unbounded names could push a message
|
|
139
|
+
* past Telegram's 4096-char ceiling, which would 400 and deliver nothing at
|
|
140
|
+
* all. Generous enough never to touch a real name, low enough that a full
|
|
141
|
+
* history can't cost the whole list.
|
|
142
|
+
*/
|
|
143
|
+
const MAX_SESSION_NAME_LEN = 120;
|
|
144
|
+
/**
|
|
145
|
+
* How a session is named wherever one is offered: the project, plus the topic
|
|
146
|
+
* when it has one. Shared so /resume and the back button name the same
|
|
147
|
+
* session the same way.
|
|
148
|
+
*/
|
|
149
|
+
export function sessionDisplayName(entry) {
|
|
150
|
+
const name = entry.topic ? `${entry.projectName} · ${entry.topic}` : entry.projectName;
|
|
151
|
+
return name.length > MAX_SESSION_NAME_LEN
|
|
152
|
+
? name.slice(0, MAX_SESSION_NAME_LEN - 1) + '…'
|
|
153
|
+
: name;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Attach the one-tap "back to the session you just left" affordance to a
|
|
157
|
+
* message, reusing the /resume callback. Returns the text to send and the
|
|
158
|
+
* options to send it with, so the six commands that offer it don't each
|
|
159
|
+
* repeat the append; with no session key, or no session to go back to, that
|
|
160
|
+
* is the message unchanged.
|
|
161
|
+
*
|
|
162
|
+
* The session's name rides on the button while it fits, which is the whole of
|
|
163
|
+
* the common case — `↩️ Back to telecoder (2h ago)` is one tap and adds
|
|
164
|
+
* nothing to the chat. It stops fitting as soon as the session has a topic,
|
|
165
|
+
* and a button is not a place to put text that doesn't fit: Telegram gives the
|
|
166
|
+
* reader no way to expand the ellipsis, so the name was simply gone and the
|
|
167
|
+
* button said "back to" something you couldn't read. Past that width the
|
|
168
|
+
* button keeps a fixed short label and the name goes in the body, where it
|
|
169
|
+
* survives whole.
|
|
170
|
+
*
|
|
171
|
+
* Skips the entry whose conversationId matches `excludeConversationId` so we
|
|
172
|
+
* don't offer to return to the session you're already in.
|
|
173
|
+
*/
|
|
174
|
+
export function withBackToPrevious(text, sessionKey, excludeConversationId) {
|
|
175
|
+
const plain = { text, options: {} };
|
|
176
|
+
if (!sessionKey)
|
|
177
|
+
return plain;
|
|
178
|
+
const history = sessionManager.getSessionHistory(sessionKey, 5);
|
|
179
|
+
const entry = history.find((e) => e.claudeSessionId && e.conversationId !== excludeConversationId);
|
|
180
|
+
if (!entry)
|
|
181
|
+
return plain;
|
|
182
|
+
const timeAgo = formatTimeAgo(new Date(entry.lastActivity));
|
|
183
|
+
const name = sessionDisplayName(entry);
|
|
184
|
+
const label = `↩️ Back to ${name} (${timeAgo})`;
|
|
185
|
+
const fits = fitsOnButton(label);
|
|
186
|
+
return {
|
|
187
|
+
text: fits ? text : new EntityText().append(text).add(`\n\n↩️ Previous: ${name} (${timeAgo})`).build(),
|
|
188
|
+
options: {
|
|
189
|
+
reply_markup: {
|
|
190
|
+
inline_keyboard: [
|
|
191
|
+
[
|
|
192
|
+
{
|
|
193
|
+
text: fits ? label : '↩️ Back to previous',
|
|
194
|
+
callback_data: `resume:${entry.conversationId}`,
|
|
195
|
+
},
|
|
196
|
+
],
|
|
197
|
+
],
|
|
198
|
+
},
|
|
199
|
+
},
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
/** Note appended when a pty restart is pending. */
|
|
203
|
+
export const PTY_RESTART_NOTE = new EntityText()
|
|
204
|
+
.add('\n\n')
|
|
205
|
+
.italic('Claude Code restarts on your next message to pick this up (the conversation is kept).')
|
|
206
|
+
.build();
|
|
207
|
+
//# sourceMappingURL=shared.js.map
|