Commit Graph

8362 Commits

Author SHA1 Message Date
spiceoogway
41b2dd1f27 fix: Add missing moltbot compatibility shim binary
Fixes #4529

The moltbot compatibility package was broken because bin/moltbot.js
was missing. This file is referenced in package.json but was never
created during the openclaw rename.

This commit adds the missing binary that:
- Forwards all commands to openclaw
- Shows clear deprecation warning
- Guides users to migrate to openclaw package

Without this fix, users who upgraded from moltbot to openclaw by
git pull could not use the gateway because their global moltbot
installation had no working binary.

Test: node packages/moltbot/bin/moltbot.js --version
(requires built openclaw)
2026-01-30 08:24:11 -05:00
spiceoogway
8280ce880e fix: resolve lint error - ensure email is properly typed as string 2026-01-30 08:11:43 -05:00
spiceoogway
5305e54adf fix: Remove unused variables and imports to pass lint
- Prefix unused variable _isExecEvent in heartbeat-runner.ts
- Remove unused TelegramGramJSAccountConfig import from config.ts
- Remove unused SessionOptions import from client.ts
- Prefix unused proxy parameter as _proxy in client.ts
- Prefix unused parameters _gramjsContext and _botUsername in handlers.ts
- Remove unused OpenClawConfig import from types.ts
- Remove unused AuthState import from auth.test.ts

Fixes lint CI failure on PR #4465
2026-01-30 03:22:43 -05:00
spiceoogway
56bf6f5e49 Fix WebSocket 1006 disconnect with ping/pong keepalive (#4142)
Implements WebSocket ping/pong keepalive mechanism to prevent random
disconnects with close code 1006 (abnormal closure).

Changes:
- Add 20-second ping interval when WebSocket connection is open
- Monitor pong responses for connection health
- Enhanced error and close event logging with detailed diagnostics
- Clean up ping interval when connection closes

This fix addresses the root cause of issue #4142 where network
intermediaries (NAT, firewalls, proxies) timeout idle WebSocket
connections. The 20-second ping interval is industry standard practice
for preventing idle connection timeouts.

Fixes #4142
2026-01-30 03:20:52 -05:00
spiceoogway
bd214dc061 docs: Add PR preparation checklist for GramJS Phase 1 2026-01-30 03:04:29 -05:00
spiceoogway
84c1ab4d55 feat(telegram-gramjs): Phase 1 - User account adapter with tests and docs
Implements Telegram user account support via GramJS/MTProto (#937).

## What's New
- Complete GramJS channel adapter for user accounts (not bots)
- Interactive auth flow (phone → SMS → 2FA)
- Session persistence via StringSession
- DM and group message support
- Security policies (allowFrom, dmPolicy, groupPolicy)
- Multi-account configuration

## Files Added

### Core Implementation (src/telegram-gramjs/)
- auth.ts - Interactive authentication flow
- auth.test.ts - Auth flow tests (mocked)
- client.ts - GramJS TelegramClient wrapper
- config.ts - Config adapter for multi-account
- gateway.ts - Gateway adapter (poll/send)
- handlers.ts - Message conversion (GramJS → openclaw)
- handlers.test.ts - Message conversion tests
- setup.ts - CLI setup wizard
- types.ts - TypeScript type definitions
- index.ts - Module exports

### Configuration
- src/config/types.telegram-gramjs.ts - Config schema

### Plugin Extension
- extensions/telegram-gramjs/index.ts - Plugin registration
- extensions/telegram-gramjs/src/channel.ts - Channel plugin implementation
- extensions/telegram-gramjs/openclaw.plugin.json - Plugin manifest
- extensions/telegram-gramjs/package.json - Dependencies

### Documentation
- docs/channels/telegram-gramjs.md - Complete setup guide (14KB)
- GRAMJS-PHASE1-SUMMARY.md - Implementation summary

### Registry
- src/channels/registry.ts - Added telegram-gramjs to CHAT_CHANNEL_ORDER

## Test Coverage
-  Auth flow with phone/SMS/2FA (mocked)
-  Phone number validation
-  Session verification
-  Message conversion (DM, group, reply)
-  Session key routing
-  Command extraction
-  Edge cases (empty messages, special chars)

## Features Implemented (Phase 1)
-  User account authentication via MTProto
-  DM message send/receive
-  Group message send/receive
-  Reply context preservation
-  Security policies (pairing, allowlist)
-  Multi-account support
-  Session persistence
-  Command detection

## Next Steps (Phase 2)
- Media support (photos, videos, files)
- Voice messages and stickers
- Message editing and deletion
- Reactions
- Channel messages

## Documentation Highlights
- Getting API credentials from my.telegram.org
- Interactive setup wizard walkthrough
- DM and group policies configuration
- Multi-account examples
- Rate limits and troubleshooting
- Security best practices
- Migration guide from Bot API

Closes #937 (Phase 1)
2026-01-30 03:03:15 -05:00
spiceoogway
cc2f8e3351 fix: Make cron systemEvents trigger autonomous agent action
Fixes #4107

Problem:
- Cron jobs with systemEvent payloads enqueue events as passive text
- Agent sees events but doesn't autonomously process them
- Expected behavior: agent should execute complex tasks (spawn subagents, etc.)

Root Cause:
- systemEvents are injected as 'System: [timestamp] text' messages
- Standard heartbeat prompt is passive: 'Read HEARTBEAT.md... reply HEARTBEAT_OK'
- No explicit instruction to process and act on systemEvents
- Exec completion events already had directive prompt, but generic events didn't

Solution:
- Added SYSTEM_EVENT_PROMPT constant with directive language
- Modified heartbeat runner to detect generic (non-exec) systemEvents
- When generic events are present, use directive prompt instead of passive one
- Directive prompt explicitly instructs agent to:
  1. Check HEARTBEAT.md for event-specific handling
  2. Execute required actions (spawn subagent, perform task, etc.)
  3. Reply HEARTBEAT_OK only if no action needed

Changes:
- src/infra/heartbeat-runner.ts:
  - Added SYSTEM_EVENT_PROMPT constant (lines 100-105)
  - Modified prompt selection logic to detect generic systemEvents (lines 510-523)
  - Updated Provider field to reflect 'system-event' context

Testing:
- Build passes (TypeScript compilation successful)
- Pattern follows existing exec-event precedent
- Backward compatible (only affects sessions with pending systemEvents)

Follow-up:
- Add integration test for cron → subagent spawn workflow
- Update documentation on systemEvent best practices
2026-01-30 02:48:16 -05:00
spiceoogway
a39811caca test: add comprehensive tests for categorizeError() function
- Tests timeout errors (timeout keyword, 'timed out', ETIMEDOUT)
- Tests authentication errors (401, unauthorized, 403, forbidden)
- Tests rate limit errors (rate limit keyword, HTTP 429)
- Tests unknown/unrecognized errors
- Tests API/model errors (400, 500, 503, quota, billing)
- Tests network errors (ECONNREFUSED, ENOTFOUND, DNS, ENETUNREACH)
- Tests file system errors (ENOENT, EACCES, EPERM, EISDIR)
- Tests configuration errors (missing key/token)
- Tests context/memory errors
- Export categorizeError() function for testing
- 37 passing tests covering all error categorization paths
2026-01-30 02:38:26 -05:00
spiceoogway
44aea44fc8 Improve subagent error messages with categorization and hints
- Enhanced SubagentRunOutcome type with errorType and errorHint fields
- Added categorizeError() helper to classify common error patterns:
  * File system errors (ENOENT, EACCES, etc.)
  * API/model errors (rate limits, auth failures, invalid requests)
  * Network errors (connection refused, DNS failures)
  * Timeout errors
  * Configuration errors (missing credentials, quota limits)
- Updated error emission in agent-runner-execution.ts to categorize errors
- Updated subagent-registry.ts to capture and propagate new error fields
- Added buildErrorStatusLabel() helper for user-friendly error messages
- Error announcements now include error type and remediation hints

Example improved messages:
- Before: 'failed: unknown error'
- After: 'failed (tool error): ENOENT — File or directory not found'

This makes subagent failures much easier to understand and debug while
maintaining backward compatibility.
2026-01-30 02:10:29 -05:00
spiceoogway
c555c00cb3 fix: repair tool_use/tool_result pairings after history truncation (fixes #4367)
The message processing pipeline had a synchronization bug where
limitHistoryTurns() truncated conversation history AFTER
repairToolUseResultPairing() had already fixed tool_use/tool_result
pairings. This could split assistant messages (with tool_use) from
their corresponding tool_result blocks, creating orphaned tool_result
blocks that the Anthropic API rejects.

This fix calls sanitizeToolUseResultPairing() AFTER limitHistoryTurns()
to repair any pairings broken by truncation, ensuring the transcript
remains valid before being sent to the LLM API.

Changes:
- Added import for sanitizeToolUseResultPairing from session-transcript-repair.js
- Call sanitizeToolUseResultPairing() on the limited message array
- Updated variable name from 'limited' to 'repaired' for clarity
2026-01-30 02:10:29 -05:00
spiceoogway
d89ca4ae73 fix: apply format to onboard-helpers.ts (pre-existing formatting issue) 2026-01-30 01:15:56 -05:00
spiceoogway
ee50fb8528 fix: slug-generator uses configured default model instead of hardcoded Opus
Resolves #4315. The slug-generator embedded run was hardcoded to use
DEFAULT_MODEL (claude-opus-4-5) regardless of the user's configured
agents.defaults.model.primary. This caused unexpected Opus charges on
every /new command.

Now uses resolveDefaultModelForAgent() to honor the user's configured
default model, falling back to DEFAULT_MODEL only when no config exists.
2026-01-30 01:01:41 -05:00
Peter Steinberger
87267fad4f docs: move WhatsApp image below dashboard 2026-01-30 06:55:15 +01:00
Gustavo Madeira Santana
613724c26e Update index.md 2026-01-30 00:33:06 -05:00
Peter Steinberger
77e703c69b chore: update appcast for 2026.1.29 2026-01-30 06:25:45 +01:00
Peter Steinberger
62e4ad23d3 chore: release 2026.1.29 2026-01-30 06:25:45 +01:00
Peter Steinberger
23c424899c docs: reorder 2026.1.29 changelog 2026-01-30 06:25:21 +01:00
Peter Steinberger
c5d7d1110b chore: update pnpm lockfile 2026-01-30 05:15:50 +00:00
Gustavo Madeira Santana
12e8a8410f Update logo and contributor name in docs
Replaced the static image with a responsive logo using the <picture> element for light/dark mode support. Updated contributor name from 'Clawd' to 'Molty'.
2026-01-30 00:13:44 -05:00
Gustavo Madeira Santana
4de0bae45a
Update README with responsive logo for dark mode 2026-01-29 23:38:32 -05:00
Gustavo Madeira Santana
ddad65588f
Add files via upload 2026-01-29 23:37:32 -05:00
Peter Steinberger
bf6ec64fd9 docs: move deepwiki link 2026-01-30 05:33:05 +01:00
Gustavo Madeira Santana
4ec9d98821 Update ASCII art banners for CLI and wizard header
Replaces the previous ASCII art in both the CLI banner and the wizard header with a new, wider design and updates the label to 'OPENCLAW' for consistency.
2026-01-29 23:29:47 -05:00
Peter Steinberger
151ddd624b fix: detect legacy gateway launchd labels 2026-01-30 05:01:46 +01:00
Peter Steinberger
b9afa3d33f fix: migrate symlinked legacy state dirs 2026-01-30 04:48:04 +01:00
Peter Steinberger
d9c81991b1 chore: bump beta 2026-01-30 04:37:46 +01:00
Peter Steinberger
9886fd1a5a fix: migrate legacy state dirs 2026-01-30 04:26:00 +01:00
Peter Steinberger
67918dc41b chore: bump beta 2026-01-30 04:10:47 +01:00
Peter Steinberger
a155e2f8ae fix: migrate legacy config 2026-01-30 04:09:49 +01:00
Peter Steinberger
02576615cb fix: migrate legacy gateway services 2026-01-30 04:01:31 +01:00
Peter Steinberger
d47b4e6f81 fix: update config types 2026-01-30 03:20:28 +01:00
Peter Steinberger
7d03cae66a chore: bump npm version 2026-01-30 03:16:48 +01:00
Peter Steinberger
9a7160786a refactor: rename to openclaw 2026-01-30 03:16:21 +01:00
Shakker
4583f88626 fix: preserve reasoning tags inside code blocks (#4118) (thanks @vinaygit18) 2026-01-29 18:53:05 +00:00
Peter Steinberger
c9fe062824 chore: update clawtributors 2026-01-29 17:31:39 +00:00
Peter Steinberger
78b9876641 feat: add Xiaomi MiMo provider onboarding (#3454)
Thanks @WqyJh.

Co-authored-by: Qiying Wang <15232241+WqyJh@users.noreply.github.com>
2026-01-29 17:29:58 +00:00
Vibe Kanban
50d44d0bd9 feat: support xiaomi/mimo-v2-flash 2026-01-29 17:15:51 +00:00
Peter Steinberger
cb4b3f74b5 chore(release): bump versions to 2026.1.29 2026-01-29 16:48:13 +00:00
Peter Steinberger
5152060121 docs(changelog): rewrite 2026.1.29 notes 2026-01-29 16:48:05 +00:00
Peter Steinberger
06289b36da fix(security): harden SSH target handling (#4001)
Thanks @YLChen-007.

Co-authored-by: Edward-x <YLChen-007@users.noreply.github.com>
2026-01-29 16:33:36 +00:00
Josh Palmer
4b5514a259 Tests: default-disable plugins in VITEST 2026-01-29 17:14:14 +01:00
Josh Palmer
5f4715acfc fix flaky gateway tests in CI
What:
- resolve shell from PATH in bash-tools tests (avoid /bin/bash dependency)
- mock DNS for web-fetch SSRF tests (no real network)
- stub a2ui bundle in canvas-host server test when missing

Why:
- keep gateway test suite deterministic on Nix/Garnix Linux

Tests:
- not run locally (known missing deps in unit test run)
2026-01-29 12:14:27 +01:00
Josh Palmer
c41ea252b0 fix flaky web-fetch tests + lock cleanup
What:
- stub resolvePinnedHostname in web-fetch tests to avoid DNS flake
- close lock file handles via FileHandle.close during cleanup to avoid EBADF

Why:
- make CI deterministic without network/DNS dependence
- prevent double-close errors from GC

Tests:
- pnpm vitest run --config vitest.unit.config.ts src/agents/tools/web-tools.fetch.test.ts src/agents/session-write-lock.test.ts (failed: missing @aws-sdk/client-bedrock)
2026-01-29 11:05:11 +01:00
Tyler Yust
6372242da7
fix(ui): improve chat session dropdown and refresh behavior (#3682)
* refactor(ui): enhance loadSessions function to accept overrides for session loading parameters

- Updated loadSessions to include optional parameters for activeMinutes, limit, includeGlobal, and includeUnknown.
- Modified refreshChat to use the new activeMinutes parameter when loading sessions.
- Removed duplicate applySettingsFromUrl call in handleConnected function.

* feat(ui): implement session refresh functionality after chat

- Added `refreshSessionsAfterChat` property to `ChatHost` and `GatewayHost` types.
- Introduced `isChatResetCommand` function to identify chat reset commands.
- Updated `handleSendChat` to set `refreshSessions` based on chat reset commands.
- Modified `handleGatewayEventUnsafe` to load sessions when chat is finalized and `refreshSessionsAfterChat` is true.
- Enhanced `refreshChat` to load sessions with `activeMinutes` set to 0 for immediate refresh.
2026-01-28 23:24:46 -08:00
Ayaan Zaidi
718bc3f9c8
fix: avoid silent telegram empty replies (#3796) (#3796) 2026-01-29 11:34:47 +05:30
Conroy Whitney
c20035094d
fix: use & instead of <> in XML escaping test for Windows NTFS compatibility (#3750)
NTFS does not allow < or > in filenames, causing the XML filename
escaping test to fail on Windows CI with ENOENT.

Replace file<test>.txt with file&test.txt — & is valid on all platforms
and still requires XML escaping (&amp;), preserving the test's intent.

Fixes #3748
2026-01-29 05:46:50 +00:00
kiranjd
0761652701 fix(telegram): handle empty reply array in notifyEmptyResponse
Previous fix only checked skippedEmpty > 0, but when model returns
content: [] no payloads are created at all. Now also checks
replies.length === 0 to catch this case.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 11:13:39 +05:30
kiranjd
a2d06e75b0 fix(telegram): notify users when agent returns empty response
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 11:13:39 +05:30
Ayaan Zaidi
34291321b4 chore: update clawtributors (add @HirokiKobayashi-R) 2026-01-29 10:33:25 +05:30
Ayaan Zaidi
16a5549ec0 docs: update changelog for mention patterns (#3303) (thanks @HirokiKobayashi-R) 2026-01-29 10:31:47 +05:30