feat: add is_bot_message column and support dedicated phone numbers (#235)

* feat: add is_bot_message column and support dedicated phone numbers

Replace fragile content-prefix bot detection with an explicit
is_bot_message database column. The old prefix check (content NOT LIKE
'Andy:%') is kept as a backstop for pre-migration messages.

- Add is_bot_message column with automatic backfill migration
- Add ASSISTANT_HAS_OWN_NUMBER env var to skip name prefix when the
  assistant has its own WhatsApp number
- Move prefix logic into WhatsApp channel (no longer a router concern)
- Remove prefixAssistantName from Channel interface
- Load .env via dotenv so launchd-managed processes pick up config
- WhatsApp bot detection: fromMe for own number, prefix match for shared

Based on #160 and #173.

Co-Authored-By: Stefan Gasser <stefan@stefangasser.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* refactor: extract shared .env parser and remove dotenv dependency

Extract .env parsing into src/env.ts, used by both config.ts and
container-runner.ts. Reads only requested keys without loading secrets
into process.env, avoiding leaking API keys to child processes.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Stefan Gasser <stefan@stefangasser.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
gavrielc
2026-02-15 15:31:57 +02:00
committed by GitHub
parent c8ab3d95e1
commit 9261a25531
13 changed files with 202 additions and 140 deletions

View File

@@ -4,7 +4,6 @@ import path from 'path';
import { CronExpressionParser } from 'cron-parser';
import {
ASSISTANT_NAME,
DATA_DIR,
IPC_POLL_INTERVAL,
MAIN_GROUP_FOLDER,
@@ -79,10 +78,7 @@ export function startIpcWatcher(deps: IpcDeps): void {
isMain ||
(targetGroup && targetGroup.folder === sourceGroup)
) {
await deps.sendMessage(
data.chatJid,
`${ASSISTANT_NAME}: ${data.text}`,
);
await deps.sendMessage(data.chatJid, data.text);
logger.info(
{ chatJid: data.chatJid, sourceGroup },
'IPC message sent',