refactor(setup): drop CLI-bonus wiring from init-first-agent

init-first-agent used to double-wire the CLI channel to every new DM
agent as a convenience for `pnpm run chat`, gated by --no-cli-bonus.
With the /new-setup-2 flow gone and a dedicated scratch CLI agent
created earlier in setup:auto, that bonus just stomps on CLI routing
the user already set up. Remove the CLI_CHANNEL/CLI_PLATFORM_ID
constants, ensureCliMessagingGroup, the --no-cli-bonus flag, and the
cli-bonus wiring block.

Pass the paired user's identity through to the welcome delivery so
the sender resolver sees the real owner (e.g. telegram:<id>) instead
of cli:local. Extend the CLI channel's admin-transport payload to
accept optional sender/senderId overrides — falls back to the old
cli/cli:local defaults when omitted, so existing callers are unchanged.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
gavrielc
2026-04-22 02:13:22 +03:00
parent 5269edada4
commit 416fe01855
2 changed files with 26 additions and 54 deletions

View File

@@ -183,6 +183,8 @@ function createAdapter(): ChannelAdapter {
text?: unknown;
to?: unknown;
reply_to?: unknown;
sender?: unknown;
senderId?: unknown;
};
try {
payload = JSON.parse(line);
@@ -209,8 +211,8 @@ function createAdapter(): ChannelAdapter {
timestamp: new Date().toISOString(),
content: JSON.stringify({
text: payload.text,
sender: 'cli',
senderId: `cli:${PLATFORM_ID}`,
sender: typeof payload.sender === 'string' ? payload.sender : 'cli',
senderId: typeof payload.senderId === 'string' ? payload.senderId : `cli:${PLATFORM_ID}`,
}),
},
replyTo: replyTo ?? undefined,