Commit Graph

558 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 aed5b1787f Fix stuck thinking reaction: done reaction was skipped when miniapp active
Build Claw Telegram / build (push) Successful in 5m37s
Build Claw Telegram / cleanup (push) Successful in 1s
The miniapp feed path had an early `break` before the done reaction code,
so the 👍→clear sequence never ran when CLAW_GATEWAY_MINIAPP_PUBLIC_BASE_URL
was set. Move the break after the done reaction.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-08 03:04:42 +02:00
Wylabb 33093b90ae Translate host paths to container-local paths for worker dir creation
Build Claw Telegram / build (push) Successful in 8m11s
Build Claw Telegram / cleanup (push) Successful in 1s
The gateway creates worker state/workspace dirs before Docker bind-mounts
them. These are host paths (e.g. /mnt/user/appdata/.../workers/wylab/state)
but the gateway can only access them through its /appdata mount. Translate
host paths to container-local equivalents before mkdir.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-08 02:52:58 +02:00
Wylabb b185dfe36f Save manifest when worker_image or network changes, not just roots
Build Claw Telegram / build (push) Successful in 5m39s
Build Claw Telegram / cleanup (push) Successful in 0s
Fixes stale claw-ts-worker:latest image name persisting in profiles.json
after the image was renamed to claw-telegram:latest.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-08 02:42:45 +02:00
Wylabb 4c71b367f5 Re-apply env var overrides on manifest load, migrate profile paths
Build Claw Telegram / build (push) Successful in 5m37s
Build Claw Telegram / cleanup (push) Successful in 0s
load_or_init_manifest now updates worker_defaults roots, worker_image,
and worker_network from env vars on every startup. If the state/workspace
roots changed, existing profile paths are migrated and the manifest is
saved. No need to delete profiles.json when changing mount paths.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-08 02:27:28 +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 4ba8098f7a Port OpenClaw Telegram UX: reactions-only status, no text noise
Build Claw Telegram / build (push) Successful in 5m37s
Build Claw Telegram / cleanup (push) Successful in 0s
- Remove "Thinking..." initial message (reactions + typing indicator only)
- Remove tool status text ("Running tool: X", "Tool returned error")
- Silence internal events (tasks, agents, teams, mailbox, compaction)
- Keep progressive text streaming via sync_text_messages
- Keep approval requests with inline keyboard
- Errors shown as reaction + text message (no status_message editing)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-08 02:08:19 +02:00
Wylabb 1ce8c97bf1 Add OpenClaw-style reactions alongside existing status messages
Build Claw Telegram / build (push) Successful in 5m49s
Build Claw Telegram / cleanup (push) Successful in 0s
Adds emoji reactions on the user's incoming message at each lifecycle
point (thinking, tool use, compaction, done, error) with fallback
chains matching OpenClaw's status-reaction-variants. Existing text-based
status messages are preserved — reactions are additive.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-08 01:56:42 +02:00
Wylabb aaccab1bbd Revert "Match OpenClaw Telegram UX: reactions, hide tool events"
This reverts commit a536ddca5e.
2026-04-08 01:44:02 +02:00
Wylabb a536ddca5e Match OpenClaw Telegram UX: reactions, hide tool events
Build Claw Telegram / build (push) Successful in 5m14s
Build Claw Telegram / cleanup (push) Successful in 0s
Replace "Thinking..." text message with emoji reactions on the
user's message (🤔 thinking, 🔥 tool running, 😱 error, clear on done).
Tool use/result events are now silent — no text sent to Telegram.
Auto-compaction, task, team, agent, and mailbox events are silent.
Only assistant text and approval requests are shown to the user.

Adds setMessageReaction to TelegramApi.

Tested: real Claude response through Docker image, clean output.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-08 01:16:24 +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
Wylabb 1e06c05d9b Pull worker image before creating container
Build Claw Telegram / build (push) Successful in 5m24s
Build Claw Telegram / cleanup (push) Successful in 1s
The gateway no longer shares an image with the worker, so the
worker image needs to be pulled explicitly. Previously both used
claw-telegram:latest which was already present from the gateway.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-07 23:17:55 +02:00
Wylabb 923404fae1 Replace Rust worker with TS worker
Build Claw Telegram / build (push) Successful in 6m2s
Build Claw Telegram / cleanup (push) Successful in 1s
- Remove claw-profile-worker from Dockerfile (no longer built or shipped)
- Remove hardcoded entrypoint/cmd in docker_worker_manager.rs (let
  the worker image's own CMD run)
- Clear entrypoint override in Unraid worker templates
- Point CLAW_GATEWAY_WORKER_IMAGE to claw-ts-worker:latest in both
  XML templates and template manager test fixture

The gateway now launches claw-ts-worker containers instead of
claw-profile-worker. The TS worker uses @anthropic-ai/sdk directly
and speaks the same HTTP/SSE protocol.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-07 22:29:30 +02:00
Wylabb 5b1225fb5c Revert "Point worker image to claw-ts-worker"
Build Claw Telegram / build (push) Successful in 5m44s
Build Claw Telegram / cleanup (push) Successful in 1s
This reverts commit 93216e260a.
2026-04-07 22:02:57 +02:00
Wylabb 93216e260a Point worker image to claw-ts-worker
Build Claw Telegram / build (push) Successful in 5m26s
Build Claw Telegram / cleanup (push) Successful in 0s
Update Unraid XML templates and template manager to default
CLAW_GATEWAY_WORKER_IMAGE to git.wylab.me/wylab/claw-ts-worker:latest
instead of the old Rust worker image.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-07 21:49:40 +02:00
Wylabb 9e9d440770 Decouple gateway protocol from Rust runtime types
Build Claw Telegram / build (push) Successful in 5m39s
Build Claw Telegram / cleanup (push) Successful in 8s
Move all worker-facing record types (TaskListRecord, RuntimeTaskRecord,
TeamRecord, MailboxSummary, FeedItemRecord, LibraryAppRecord, etc.)
into protocol-owned mirrors in records.rs. The gateway and worker_client
now use these protocol types instead of importing from the runtime crate.

Add worker-protocol/ with OpenAPI spec and JSON schemas as the
language-neutral contract authority for the gateway-worker boundary.
This is the migration surface for the TS worker replacement.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-07 20:12:16 +02:00
Wylabb 951e48248b Report missing git prerequisite for app library
Build Claw Telegram / build (push) Successful in 5m6s
Build Claw Telegram / cleanup (push) Successful in 2s
2026-04-06 02:16:20 +02:00
Wylabb e7f03e0645 Make feed and app lookups self-diagnosing
Build Claw Telegram / build (push) Successful in 5m4s
Build Claw Telegram / cleanup (push) Successful in 2s
2026-04-05 23:45:37 +02:00
Wylabb 44f21595db Skip invalid app records when listing library apps
Build Claw Telegram / build (push) Successful in 5m53s
Build Claw Telegram / cleanup (push) Successful in 2s
2026-04-05 23:04:54 +02:00
Wylabb 2b86743d8d Add git-backed app lifecycle tools and Mini App wiring
Build Claw Telegram / build (push) Successful in 5m27s
Build Claw Telegram / cleanup (push) Successful in 3s
2026-04-05 22:27:53 +02:00
Wylabb f636ef7d72 Remove unused Mini App conversations and expand UI
Build Claw Telegram / build (push) Successful in 6m14s
Build Claw Telegram / cleanup (push) Successful in 3s
2026-04-05 21:16:34 +02:00
Wylabb 418877405d Render JSX feed items as interactive previews
Build Claw Telegram / build (push) Successful in 6m3s
Build Claw Telegram / cleanup (push) Successful in 2s
2026-04-05 20:50:59 +02:00
Wylabb 09611aeddb Fix Mini App shell script parsing
Build Claw Telegram / build (push) Successful in 5m47s
Build Claw Telegram / cleanup (push) Successful in 2s
2026-04-05 20:39:19 +02:00
Wylabb 732f227376 Redesign Mini App around feed and app library
Build Claw Telegram / build (push) Successful in 5m54s
Build Claw Telegram / cleanup (push) Successful in 2s
2026-04-05 20:29:33 +02:00
Wylabb 642b1734b6 Test JSX artifact rendering path
Build Claw Telegram / build (push) Successful in 11m51s
Build Claw Telegram / cleanup (push) Successful in 2s
2026-04-05 19:09:22 +02:00
Wylabb a02dd94542 Add Mini App artifact viewer tests
Build Claw Telegram / cleanup (push) Has been cancelled
Build Claw Telegram / build (push) Has been cancelled
2026-04-05 19:07:51 +02:00
Wylabb 0f0d41bd8d Use marked.js for Markdown and add React artifact renderer
Build Claw Telegram / build (push) Successful in 4m30s
Build Claw Telegram / cleanup (push) Successful in 1s
- Markdown: swap regex converter for marked.js (full GFM support)
- JSX/TSX: render in sandboxed iframe with React 18 + Babel standalone

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-05 13:11:36 +02:00
ClaudeBot 1cf06bfa69 fix(template): change Mini App port to 18081
Build Claw Telegram / build (push) Successful in 5m3s
Build Claw Telegram / cleanup (push) Successful in 1s
Entire 808x range is occupied on the Unraid host.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-05 12:55:56 +02:00
Wylabb bab7fb7d01 Add artifact routing diagnostics
Build Claw Telegram / cleanup (push) Has been cancelled
Build Claw Telegram / build (push) Has been cancelled
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-05 12:50:39 +02:00
ClaudeBot 93f74e37c0 fix(template): change Mini App port from 8081 to 8087
Build Claw Telegram / build (push) Successful in 5m0s
Build Claw Telegram / cleanup (push) Successful in 1s
8081 is already in use on the Unraid host.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-05 12:40:43 +02:00
Wylabb ce74ec34cb Add Mini App config to Unraid gateway template
Build Claw Telegram / build (push) Successful in 5m4s
Build Claw Telegram / cleanup (push) Successful in 2s
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-05 12:10:16 +02:00
Wylabb c04d952b1b Add Mini App artifact delivery for previewable files
Build Claw Telegram / build (push) Successful in 5m44s
Build Claw Telegram / cleanup (push) Successful in 1s
Previewable files (HTML, MD, code, JSON, etc.) now open in
the Telegram Mini App instead of being uploaded as raw files.
Images and binaries still use Telegram upload.

- Add is_previewable() classifier for ~40 text/code extensions
- Add artifact registry with TTL-based expiry
- Add /miniapp/api/artifacts/:turn_id/:file_id proxy endpoint
- Add /miniapp/view/:turn_id/:file_id viewer with auto-auth
- Route previewable artifacts to "View in Mini App" web_app button
- Extract fetch_generated_file() for raw byte + content-type access

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-05 11:50:52 +02:00
Wylabb e7eaf9ed93 Port teamwork parity slice and add miniapp foundation 2026-04-05 11:50:52 +02:00
Wylabb d164dc5f8e Add session-scoped Telegram approvals
Build Claw Telegram / build (push) Successful in 4m38s
Build Claw Telegram / cleanup (push) Successful in 1s
2026-04-05 07:40:39 +02:00
Wylabb 04b482fbc8 Persist Unraid gateway template values
Build Claw Telegram / build (push) Successful in 4m34s
Build Claw Telegram / cleanup (push) Successful in 1s
2026-04-05 07:22:01 +02:00
Wylabb 51b47c93d2 Render Telegram output as HTML
Build Claw Telegram / build (push) Successful in 4m27s
Build Claw Telegram / cleanup (push) Successful in 1s
2026-04-05 07:11:56 +02:00
Wylabb 83e313ec6d Add Anthropic prompt-cache request shaping
Build Claw Telegram / build (push) Successful in 4m38s
Build Claw Telegram / cleanup (push) Successful in 1s
2026-04-05 06:59:01 +02:00
Wylabb 721f05892f Log Anthropic rate limit context
Build Claw Telegram / build (push) Successful in 4m8s
Build Claw Telegram / cleanup (push) Successful in 1s
2026-04-05 05:39:56 +02:00
Wylabb 6546a0fef9 Improve Anthropic rate limit reporting
Build Claw Telegram / build (push) Successful in 4m16s
Build Claw Telegram / cleanup (push) Successful in 2s
2026-04-05 05:29:47 +02:00
Wylabb a46eb730c2 Keep Anthropic beta flags out of JSON body
Build Claw Telegram / build (push) Successful in 4m41s
Build Claw Telegram / cleanup (push) Successful in 1s
2026-04-05 02:56:03 +02:00
Wylabb 9f4bf2c3ee Support Anthropic subscription OAuth
Build Claw Telegram / build (push) Successful in 4m54s
Build Claw Telegram / cleanup (push) Successful in 1s
2026-04-05 02:23:55 +02:00
Wylabb 6431bcac50 Require API key in Unraid gateway templates
Build Claw Telegram / build (push) Successful in 4m45s
Build Claw Telegram / cleanup (push) Successful in 1s
2026-04-04 23:56:53 +02:00
Wylabb 5f0bda134e Make root Unraid template gateway-first 2026-04-04 23:44:14 +02:00
Wylabb 9e4030ccee Set explicit worker container entrypoint
Build Claw Telegram / build (push) Successful in 4m30s
Build Claw Telegram / cleanup (push) Successful in 1s
2026-04-04 23:27:33 +02:00
Wylabb fb3e632c8c Document Telegram gateway operations 2026-04-04 23:23:39 +02:00
Wylabb 5eba6aedcf Fix Unraid standalone template value persistence 2026-04-04 22:33:45 +02:00