Commit Graph

60 Commits

Author SHA1 Message Date
Peter Steinberger
0f378bb640 limits: chunk replies for twilio/web 2025-12-02 23:10:16 +00:00
Peter Steinberger
f374561579 auto-reply: support multi-text RPC outputs 2025-12-02 23:03:55 +00:00
Peter Steinberger
32f1af6277 logging: emit agent/session meta at command start 2025-12-02 21:30:28 +00:00
Peter Steinberger
45d9bca433 revert: mark system prompt sent on first turn 2025-12-02 21:23:56 +00:00
Peter Steinberger
86302247b6 chore: tidy claude prompt and drop npm lock 2025-12-02 21:07:37 +00:00
Joao Lisboa
7d919ac3bc style: fix biome formatting 2025-12-02 21:07:13 +00:00
Joao Lisboa
26ae8c780e style: fix biome lint errors 2025-12-02 21:07:13 +00:00
Joao Lisboa
57b48d9ad9 fix: send Claude identity prefix on first session message
The systemSent variable was being set to true before being passed to
runCommandReply, causing the identity prefix to never be injected.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-02 21:07:13 +00:00
Joao Lisboa
24bc88b638 chore: user-agnostic Claude identity and tests
- Use ~/Clawd instead of hardcoded /Users/steipete/clawd
- Add MEDIA: syntax instructions to identity prefix
- Update tests to check for 'scratchpad' instead of specific path

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-02 21:07:13 +00:00
Peter Steinberger
2a2b662c3e perf(pi): reuse tau rpc for command auto-replies 2025-12-02 20:09:51 +00:00
Peter Steinberger
84d9501e85 Tests: cover agents and fix web defaults
Co-authored-by: RealSid08 <RealSid08@users.noreply.github.com>
2025-12-02 11:08:00 +00:00
Peter Steinberger
d61e641496 Agents: add pluggable CLIs
Co-authored-by: RealSid08 <RealSid08@users.noreply.github.com>
2025-12-02 11:07:46 +00:00
Peter Steinberger
7ea879ac46 Fix test corrupting production sessions.json
The test 'falls back to most recent session when no to is provided' was
using resolveStorePath() which returns the real ~/.warelay/sessions.json.
This overwrote production session data with test values, causing session
fragmentation issues.

Changed to use a temp directory like other tests.
2025-12-02 05:54:31 +00:00
Peter Steinberger
8a94bc1b30 Fix empty result JSON dump and missing heartbeat prefix
Bug fixes:
- Empty result field handling: Changed truthy check to explicit type
  check (`typeof parsed?.text === "string"`) in command-reply.ts.
  Previously, Claude CLI returning `result: ""` would cause raw JSON
  to be sent to WhatsApp.
- Response prefix on heartbeat: Apply `responsePrefix` to heartbeat
  alert messages in runReplyHeartbeat, matching behavior of regular
  message handler.
2025-12-02 04:29:17 +00:00
Peter Steinberger
a7b6914a64 feat: same-phone mode with echo detection and configurable marker
Adds full support for self-messaging setups where you chat with yourself
and an AI assistant replies in the same WhatsApp bubble.

Changes:
- Same-phone mode (from === to) always allowed, bypasses allowFrom check
- Echo detection via bounded Set (max 100) prevents infinite loops
- Configurable samePhoneMarker in config (default: "[same-phone]")
- Messages prefixed with marker so assistants know the context
- fromMe filter removed from inbound.ts (echo detection in auto-reply)
- Verbose logging for same-phone detection and echo skips

Tests:
- Same-phone allowed without/despite allowFrom configuration
- Body prefixed only when from === to
- Non-same-phone rejected when not in allowFrom
2025-11-29 04:52:21 +00:00
Peter Steinberger
dba1e8c602 Tests: cover identity prefix gating 2025-11-27 04:40:03 +01:00
Peter Steinberger
845594dcc4 Claude prompt: only prepend on first turn 2025-11-27 03:53:13 +01:00
Marcus Neves
b3b23234d3 fix: add @lid format support and allowFrom wildcard handling
- Add support for WhatsApp Linked ID (@lid) format in jidToE164()
- Use existing lid-mapping-*_reverse.json files for LID resolution
- Fix allowFrom wildcard '*' to actually allow all senders
- Maintain backward compatibility with @s.whatsapp.net format

Fixes issues where:
- Messages from newer WhatsApp versions are silently dropped
- allowFrom: ['*'] configuration doesn't work as documented
2025-11-26 18:03:12 +01:00
Peter Steinberger
3dd2baba9d feat: add heartbeat cli and relay trigger 2025-11-26 17:04:43 +01:00
Peter Steinberger
ace549b70a test(auto-reply): cover cwd timeout hint and queue meta 2025-11-26 03:03:13 +01:00
Peter Steinberger
00cd24e7e5 web: add heartbeat and bounded reconnect tuning 2025-11-26 02:34:43 +01:00
Peter Steinberger
8abc500964 chore(auto-reply): include cwd in timeout message 2025-11-26 02:18:16 +01:00
Peter Steinberger
49940f3d01 test(auto-reply): add helper coverage and docs 2025-11-26 02:09:50 +01:00
Peter Steinberger
5da713bbd4 refactor(auto-reply): split reply helpers 2025-11-26 02:03:51 +01:00
Peter Steinberger
2af00b9765 Auto-reply: refresh typing indicator every 8s 2025-11-26 01:27:51 +01:00
Peter Steinberger
f4a3c406d0 refactor(web): split provider module 2025-11-26 01:16:54 +01:00
Peter Steinberger
9fa3cbab8a chore: format to 2-space and bump changelog 2025-11-26 00:53:53 +01:00
Peter Steinberger
41dc5ed5eb feat: keep typing indicators alive during commands 2025-11-26 00:05:11 +01:00
Peter Steinberger
1dfc2ccf6e feat: send session prompt once 2025-11-25 23:52:38 +01:00
Peter Steinberger
918ca94df8 feat: support audio/video/doc media caps and transcript context 2025-11-25 23:21:35 +01:00
Peter Steinberger
ecf0986fe4 feat: transcribe audio and surface transcript to prompts 2025-11-25 23:13:22 +01:00
Peter Steinberger
9b8bcf36c3 feat: optional audio transcription via CLI 2025-11-25 23:06:54 +01:00
Peter Steinberger
87f9b1f0f4 web: compress auto-reply media 2025-11-25 20:09:03 +01:00
Peter Steinberger
7dc5681102 Auto-reply: send timeout fallback and tests 2025-11-25 17:52:57 +01:00
Peter Steinberger
0fef193518 Add cwd option for command replies 2025-11-25 16:19:24 +01:00
Peter Steinberger
48c04dba22 fix: restore zod typing and import ClaudeJsonParseResult 2025-11-25 12:25:05 +01:00
Peter Steinberger
d298ca2d81 chore: sync source updates 2025-11-25 12:12:13 +01:00
Peter Steinberger
c1929e389c ci: fix node path and lint warnings 2025-11-25 12:08:08 +01:00
Peter Steinberger
1012257d43 claude: allow scratchpad markdown or images, remind length 2025-11-25 06:50:52 +01:00
Peter Steinberger
c30ad610a4 claude: expand Clawd prompt, remind 1500 char limit 2025-11-25 06:50:15 +01:00
Peter Steinberger
1cad440404 claude: tell Clawd to use ~/clawd markdown scratchpad 2025-11-25 06:49:10 +01:00
Peter Steinberger
184781b85d claude: prefix prompt with Clawd identity 2025-11-25 06:41:27 +01:00
Peter Steinberger
018c0fab6d auto-reply: handle empty stdout gracefully 2025-11-25 06:33:49 +01:00
Peter Steinberger
e79ea15d47 debug: log MEDIA extraction and parse Claude text for tokens 2025-11-25 06:14:12 +01:00
Peter Steinberger
60e9344c2a refactor: extract MEDIA parsing helper and tidy whitespace 2025-11-25 05:49:18 +01:00
Peter Steinberger
b33f4e710a fix: handle inline MEDIA tokens and host webhook media 2025-11-25 05:47:12 +01:00
Peter Steinberger
ccacfcc223 fix: accept file/media tokens safely and improve web media send 2025-11-25 05:34:08 +01:00
Peter Steinberger
3069bd5c0e fix: harden MEDIA parsing and add tests 2025-11-25 05:25:57 +01:00
Peter Steinberger
0bcb3b404d chore: surface media URL in command prompts and tests 2025-11-25 05:20:50 +01:00
Peter Steinberger
b878d51488 feat: download inbound media and expose to templating 2025-11-25 05:17:59 +01:00