Commit Graph

7 Commits

Author SHA1 Message Date
Wylabb 262dc2ec91 Add stream event logging to worker engine for debugging
Build Claw Telegram / build (push) Successful in 50s
Build Claw Telegram / cleanup (push) Successful in 1s
Logs every SSE event and final message content block types to stdout
to diagnose what the user sees as "full tool calls" in Telegram.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-08 03:16:39 +02:00
Wylabb 12fdf7cf58 Persist conversation history to disk + mount workers under gateway appdata
Build Claw Telegram / build (push) Successful in 56s
Build Claw Telegram / cleanup (push) Successful in 1s
- TS worker saves/loads messages to {stateRoot}/conversation.json
- Saves after user message, assistant response, and session reset
- Loads on engine construction (survives container restarts)
- Add CLAW_GATEWAY_WORKER_HOST_STATE_ROOT and
  CLAW_GATEWAY_WORKER_HOST_WORKSPACE_ROOT to Unraid XML, defaulting
  to /mnt/user/appdata/claw-telegram-gateway/workers

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-08 02:22:25 +02:00
Wylabb dc691c13b6 Fix OAuth: system prompt blocks + beta headers
Build Claw Telegram / build (push) Successful in 49s
Build Claw Telegram / cleanup (push) Successful in 0s
OAuth tokens require:
- System prompt as array of content blocks with the SDK prefix first
- anthropic-beta, anthropic-dangerous-direct-browser-access,
  user-agent, and x-app headers
- Beta flags: claude-code-20250219,oauth-2025-04-20

Tested end-to-end: real Claude response received (Hey!, 409/5 tokens).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-08 00:34:42 +02:00
Wylabb 6d7efa734e Fix OAuth authentication for Claude API
Build Claw Telegram / build (push) Successful in 48s
Build Claw Telegram / cleanup (push) Successful in 0s
OAuth tokens (sk-ant-oat) require:
- System prompt prefixed with "You are a Claude agent, built on
  Anthropic's Claude Agent SDK."
- anthropic-beta, anthropic-dangerous-direct-browser-access, and
  x-app headers

Tested locally: 401 → 429 (auth succeeds, rate limited).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-08 00:21:02 +02:00
Wylabb ee247d0c92 Skip auth check on /healthz endpoint
Build Claw Telegram / build (push) Successful in 47s
Build Claw Telegram / cleanup (push) Successful in 0s
The gateway health check calls /healthz without auth headers.
Move the healthz route before the auth check.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-08 00:09:01 +02:00
Wylabb 361b43cf47 Add Ask/Learn/Remember system prompt for worker agent
Build Claw Telegram / build (push) Successful in 58s
Build Claw Telegram / cleanup (push) Successful in 0s
The agent is instructed to actively learn about the user, recognize
new information worth keeping, and offer to persist useful artifacts
across session resets. Concise for Telegram.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-08 00:01:24 +02:00
Wylabb f7c23fb325 Replace Rust worker with TS worker in single image
Build Claw Telegram / build (push) Successful in 5m26s
Build Claw Telegram / cleanup (push) Successful in 0s
Add ts-worker/ with the Bun/TypeScript worker that replaces
claw-profile-worker. The Dockerfile now builds a single image
containing both the Rust gateway (claw-telegram) and the TS worker.

The image defaults to worker mode (bun run ts-worker/main.ts).
The gateway Unraid XML overrides with --entrypoint claw-telegram.
Worker containers use the same image with the default CMD.

- Add ts-worker/ (12 files): HTTP/SSE server, Anthropic SDK engine,
  approval broker, event translator, state stores
- Add package.json with @anthropic-ai/sdk dependency
- Rewrite Dockerfile: three-stage build (Rust + Bun + runtime)
- Revert CLAW_GATEWAY_WORKER_IMAGE to claw-telegram:latest
- Remove image pull from docker_worker_manager (same image, already local)
- Add ts-worker paths to CI trigger

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-07 23:44:57 +02:00