Skip to content

feat(tri-bot): Replace claude CLI with direct Anthropic API + SSE streaming (Issue #62)#63

Merged
gHashTag merged 1 commit into
mainfrom
ralph/w1/tri-bot-direct-api
Mar 9, 2026
Merged

feat(tri-bot): Replace claude CLI with direct Anthropic API + SSE streaming (Issue #62)#63
gHashTag merged 1 commit into
mainfrom
ralph/w1/tri-bot-direct-api

Conversation

@gHashTag
Copy link
Copy Markdown
Owner

@gHashTag gHashTag commented Mar 9, 2026

Summary

  • claude_stream.zig: FULL REWRITE — POST to api.anthropic.com/v1/messages with stream:true, parse SSE data: lines inline, extract content_block_delta text
  • handlers.zig: /status uses git commands directly (branch, log, status), /sessions stubbed for Phase 5, dead code removed (old handleAsk/handleContinue)
  • bot_loop.zig: /continue + /resume deferred to Phase 5, simplified dispatch
  • telegram_api.zig: api_key added to BotConfig
  • main.zig: reads ANTHROPIC_API_KEY from env
  • /stop: cancel flag (atomic bool) instead of SIGTERM — no child process to kill

Zero references to "claude" binary remain in bot/.

Net result: -88 lines. Pipeline: Telegram → Zig → api.anthropic.com (pure std.http.Client).

Before vs After

BEFORE: tri-bot → claude CLI (Node.js/TS) → Anthropic API
AFTER:  tri-bot → api.anthropic.com (Zig std.http.Client, SSE)

Test plan

  • zig build — all targets compile (0 errors)
  • zig fmt — clean
  • grep "claude" bot/ — zero matches (CLI fully removed)
  • tri-bot binary: 4.3MB
  • CI build passes
  • End-to-end: /ask streams via SSE with real API key

Closes #62

🤖 Generated with Claude Code

…eaming (Issue #62)

BREAKING: tri-bot no longer depends on claude CLI (Node.js/TypeScript).
Full pipeline: Telegram → Zig → api.anthropic.com (pure std.http.Client).

Changes:
- claude_stream.zig: REWRITE — POST with stream:true, parse SSE events inline
- handlers.zig: /status uses git commands directly (no claude), /sessions stubbed
- bot_loop.zig: /continue, /resume deferred to Phase 5 (sessions)
- telegram_api.zig: add api_key to BotConfig
- main.zig: read ANTHROPIC_API_KEY from env
- /stop: cancel flag instead of SIGTERM (no child process)

Zero references to "claude" binary remain in bot/. Net -88 lines.

Closes #62

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

Co-Authored-By: Claude <noreply@anthropic.com>
@gHashTag gHashTag merged commit 23bde55 into main Mar 9, 2026
6 checks passed
gHashTag added a commit that referenced this pull request Mar 18, 2026
…des) [Golden Chain #63]

- Add 8 QuarkType variants (80-87): community_node, gossip_broadcast,
  dht_lookup, community_sync, gossip_propagate, dht_store,
  community_consensus, community_anchor (88/128 u7 capacity)
- Add 4 types: CommunityNodeState27, GossipProtocolState, DHTState,
  CommunityNodeRecord
- Add 5 agent methods: joinCommunity, gossipBroadcast, dhtLookup,
  registerCommunityNode, communityVerify (Phase N)
- Update quark distribution 112→120 (15+15+15+16+15+14+15+15)
- Add Phase N verification: N1 active>=10k, N2 gossip active, N3 DHT operational
- Add 4 ChainMessageTypes: CommunityNode, GossipBroadcast, DHTLookup,
  CommunitySyncEvent
- Export v11: 62-byte header (+4 bytes: community_active_nodes + dht_lookups)
- Sync WASM stub with all v2.7 additions
- Canvas: +4 ChatMsgType with colors (lime green, coral, dodger blue, orchid)
- 20 new tests, 3054/3060 pass (pre-existing failures only)

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

Co-Authored-By: Claude <noreply@anthropic.com>
gHashTag added a commit that referenced this pull request Mar 18, 2026
…eaming (Issue #62) (#63)

BREAKING: tri-bot no longer depends on claude CLI (Node.js/TypeScript).
Full pipeline: Telegram → Zig → api.anthropic.com (pure std.http.Client).

Changes:
- claude_stream.zig: REWRITE — POST with stream:true, parse SSE events inline
- handlers.zig: /status uses git commands directly (no claude), /sessions stubbed
- bot_loop.zig: /continue, /resume deferred to Phase 5 (sessions)
- telegram_api.zig: add api_key to BotConfig
- main.zig: read ANTHROPIC_API_KEY from env
- /stop: cancel flag instead of SIGTERM (no child process)

Zero references to "claude" binary remain in bot/. Net -88 lines.

Closes #62

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

Co-authored-by: Antigravity Agent <antigravity@vibee.org>
Co-authored-by: Claude <noreply@anthropic.com>
@gHashTag gHashTag deleted the ralph/w1/tri-bot-direct-api branch April 3, 2026 11:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

tri-bot: Replace claude CLI with direct Anthropic API (SSE streaming)

1 participant