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,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `--model` aliases Claude Code accepts, shared by every provider that
|
|
3
|
+
* ultimately spawns the CLI.
|
|
4
|
+
*
|
|
5
|
+
* The alias is handed to a `claude` binary as it is (`--model <alias>`), so
|
|
6
|
+
* the list belongs to the CLI, not to us — mirror `claude --help` here when
|
|
7
|
+
* upstream adds one. Aliases outside the CLI's own set are treated as literal
|
|
8
|
+
* API model names, which means a wrong entry fails at request time rather than
|
|
9
|
+
* at spawn.
|
|
10
|
+
*/
|
|
11
|
+
import { getClaudeVersion, isAtLeast } from '../utils/claude-version.js';
|
|
12
|
+
export const CLAUDE_MODELS = [
|
|
13
|
+
{ id: 'fable', label: 'fable', description: 'Most capable — hardest, longest-running tasks' },
|
|
14
|
+
{ id: 'opus', label: 'opus', description: 'Most capable of the Opus tier' },
|
|
15
|
+
{ id: 'sonnet', label: 'sonnet', description: 'Balanced' },
|
|
16
|
+
{ id: 'haiku', label: 'haiku', description: 'Fast & light' },
|
|
17
|
+
{ id: 'opusplan', label: 'opusplan', description: 'Opus while planning, Sonnet otherwise' },
|
|
18
|
+
{ id: 'best', label: 'best', description: 'Tracks whichever model is currently top-tier' },
|
|
19
|
+
{ id: 'fable[1m]', label: 'fable[1m]', description: 'fable with a 1M-token context window' },
|
|
20
|
+
{ id: 'opus[1m]', label: 'opus[1m]', description: 'opus with a 1M-token context window' },
|
|
21
|
+
{ id: 'sonnet[1m]', label: 'sonnet[1m]', description: 'sonnet with a 1M-token context window' },
|
|
22
|
+
];
|
|
23
|
+
/**
|
|
24
|
+
* Oldest release verified to expose the `fable` aliases. Deliberately
|
|
25
|
+
* conservative: 2.1.140 (shipped inside claude-agent-sdk 0.2.140) knows only
|
|
26
|
+
* sonnet/opus/haiku/best/opusplan and the two [1m] variants, 2.1.220 knows
|
|
27
|
+
* fable, and the exact release in between wasn't worth bisecting. Erring high
|
|
28
|
+
* hides a working alias; erring low breaks the user's next turn.
|
|
29
|
+
*/
|
|
30
|
+
export const FABLE_MIN_CLI_VERSION = [2, 1, 220];
|
|
31
|
+
const FABLE_ALIASES = new Set(['fable', 'fable[1m]']);
|
|
32
|
+
/**
|
|
33
|
+
* True for a model that burns through the plan's limits much faster than the
|
|
34
|
+
* default, so the bot keeps it in sight while it's on. Matches the aliases as
|
|
35
|
+
* well as full IDs (`claude-fable-5-1`, `anthropic/claude-fable-...`), since
|
|
36
|
+
* the status line gets the ID the API reports, not the alias that was picked.
|
|
37
|
+
*/
|
|
38
|
+
export function isPremiumModel(model) {
|
|
39
|
+
return !!model && /fable/i.test(model);
|
|
40
|
+
}
|
|
41
|
+
/** The badge a premium model gets wherever the bot names the model. */
|
|
42
|
+
export const PREMIUM_MODEL_ICON = '💎';
|
|
43
|
+
/**
|
|
44
|
+
* Shape check for a model string typed by hand rather than picked from the
|
|
45
|
+
* catalog — full IDs (`claude-opus-4-8`), dated Vertex snapshots
|
|
46
|
+
* (`claude-opus-4-5@20251101`), Bedrock ARNs and CCR's `vendor/model` and
|
|
47
|
+
* `vendor,model` forms all need to pass through untouched.
|
|
48
|
+
*
|
|
49
|
+
* This is a safety check, not a validity check: whether the ID exists is the
|
|
50
|
+
* CLI's and the API's business. What it does guarantee is that the value can't
|
|
51
|
+
* be mistaken for something other than a model name — leading `-` would make
|
|
52
|
+
* `--model <value>` swallow it as a flag, and whitespace would split the argv
|
|
53
|
+
* entry.
|
|
54
|
+
*/
|
|
55
|
+
const PASSTHROUGH_MODEL_RE = /^[A-Za-z0-9][A-Za-z0-9._/@,:[\]-]{0,99}$/;
|
|
56
|
+
export function isPassthroughModelId(value) {
|
|
57
|
+
return PASSTHROUGH_MODEL_RE.test(value);
|
|
58
|
+
}
|
|
59
|
+
/** Split out so it can be unit-tested without spawning a binary. */
|
|
60
|
+
export function filterModelsForVersion(models, supportsFable) {
|
|
61
|
+
if (supportsFable)
|
|
62
|
+
return models;
|
|
63
|
+
return models.filter((m) => !FABLE_ALIASES.has(m.id));
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* The aliases `bin` can actually serve. A failed probe is treated as "too old"
|
|
67
|
+
* so an unreadable binary costs the user a menu entry rather than a turn.
|
|
68
|
+
*/
|
|
69
|
+
export async function getModelsForBinary(bin) {
|
|
70
|
+
const version = await getClaudeVersion(bin);
|
|
71
|
+
return filterModelsForVersion(CLAUDE_MODELS, isAtLeast(version, FABLE_MIN_CLI_VERSION));
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* The modelUsage entry for `model`, which a reply names by its plain id while
|
|
75
|
+
* modelUsage may key it by an alias or with a suffix such as `[1m]`. Falls back
|
|
76
|
+
* on the first entry when none matches.
|
|
77
|
+
*/
|
|
78
|
+
export function findModelUsageKey(modelUsage, model) {
|
|
79
|
+
const keys = Object.keys(modelUsage);
|
|
80
|
+
return keys.find((k) => k === model)
|
|
81
|
+
?? keys.find((k) => modelUsage[k].canonicalModel === model)
|
|
82
|
+
?? keys.find((k) => k.startsWith(model) || model.startsWith(k.replace(/\[.*\]$/, '')))
|
|
83
|
+
?? keys[0];
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* The name a model id reads as in a sentence: `claude-fable-5-1` is
|
|
87
|
+
* "Fable 5.1", `anthropic/claude-opus-4-5@20251101` is "Opus 4.5" and
|
|
88
|
+
* `claude-3-5-haiku-20241022` is "Haiku 3.5". Anything that isn't a Claude id
|
|
89
|
+
* — a CCR backend such as `deepseek-reasoner` — comes back as it was, since
|
|
90
|
+
* that string is the one its vendor documents.
|
|
91
|
+
*/
|
|
92
|
+
export function describeModelId(model) {
|
|
93
|
+
const bare = model.slice(model.lastIndexOf('/') + 1).replace(/@\d{8}$/, '');
|
|
94
|
+
const m = /^claude-(?:(\d+)-(\d+)-)?([a-z]+)(?:-(\d+)(?:-(\d+))?)?(?:-\d{8})?$/.exec(bare);
|
|
95
|
+
if (!m)
|
|
96
|
+
return model;
|
|
97
|
+
const [, oldMajor, oldMinor, family, major, minor] = m;
|
|
98
|
+
const name = family.charAt(0).toUpperCase() + family.slice(1);
|
|
99
|
+
const version = [oldMajor ?? major, oldMinor ?? minor].filter(Boolean).join('.');
|
|
100
|
+
return version ? `${name} ${version}` : name;
|
|
101
|
+
}
|
|
102
|
+
//# sourceMappingURL=model-catalog.js.map
|