Commit Graph

173 Commits

Author SHA1 Message Date
xj
05d36862c5 feat(plugins): add hot-reload state and activate observer bridge 2026-02-28 21:33:11 -05:00
argenis de la rosa
f677367e4b style: apply rustfmt to agent-authored changes 2026-02-28 19:51:37 -05:00
argenis de la rosa
467fea87c6 refactor(hooks): extract HookRunner factory and make plugin registry init idempotent
- Add HookRunner::from_config() factory that encapsulates hook construction
  from HooksConfig, replacing 3 duplicated blocks in agent/loop_, gateway,
  and channels modules.
- Make plugin registry initialize_from_config() idempotent: skip re-init
  if already initialized, log debug message instead of silently overwriting.
- Add capability gating for tool_result_persist hook modifications.
2026-02-28 19:51:37 -05:00
argenis de la rosa
ade0e91898 feat(plugins): route declared tools/providers through plugin registry 2026-02-28 19:51:37 -05:00
argenis de la rosa
1d6afe792b feat(plugins): scaffold wasm runtime and wire core hook lifecycle 2026-02-28 19:51:37 -05:00
argenis de la rosa
d9dba0c76f fix(observability): propagate prometheus metric registration failures 2026-02-28 19:34:19 -05:00
argenis de la rosa
9a16098f49 fix(gateway): pass session id in bluebubbles chat path 2026-02-28 19:23:30 -05:00
xj
f2c7498345 Merge remote-tracking branch 'upstream/main' into feat/channel-bluebubbles
# Conflicts:
#	src/channels/mod.rs
2026-02-28 14:52:34 -08:00
argenis de la rosa
f7de9cda3a Merge remote-tracking branch 'origin/main' into pr2093-mainmerge 2026-02-28 17:33:17 -05:00
argenis de la rosa
5d248bf6bf fix(build): restore gateway and cursor compile compatibility 2026-02-28 16:32:38 -05:00
argenis de la rosa
bd0a12ad3c fix(gateway): persist ws chat history by session 2026-02-28 16:23:15 -05:00
argenis de la rosa
991955ddce fix(gateway): pass optional session id in github webhook path 2026-02-28 16:01:42 -05:00
maxtongwang
4d195be713 feat(channel): add BlueBubbles iMessage channel
Adds a BlueBubbles channel so ZeroClaw can send and receive iMessages
via a locally-running BlueBubbles server on macOS.

What changed:
- src/channels/bluebubbles.rs — new BlueBubblesChannel implementing Channel
  - Webhook-based ingestion (push, no polling)
  - Allowlist + ignore_senders filtering
  - Rich text via iMessage Private API (attributedBody bold/italic/underline)
  - Typing indicator (start_typing / stop_typing) while LLM processes
  - Message effects ([EFFECT:confetti], [EFFECT:slam], etc.)
  - 500-entry fromMe FIFO cache for reply-context resolution
  - Attachment placeholder format matching OpenClaw (<media:image>)
  - 38 unit tests covering parsing, filtering, timestamps, effects
- src/config/schema.rs — BlueBubblesConfig struct + ChannelsConfig field
  - Fields: server_url, password, allowed_senders, webhook_secret, ignore_senders
  - Debug impl redacts password and webhook_secret
- src/gateway/mod.rs — POST /bluebubbles route + handler
  - Bearer token auth if webhook_secret is set
  - Typing indicator around LLM call
  - Memory auto-save on incoming messages
- src/channels/mod.rs — module + re-export + iMessage delivery instructions
- src/providers/cursor.rs — fix pre-existing missing quota_metadata field

Non-goals: BlueBubbles Private API pairing, polling mode, contact management.

Closes #2268
2026-02-28 12:08:24 -08:00
argenis de la rosa
3825eca3dc fix(memory): thread session IDs through runtime paths 2026-02-28 15:00:27 -05:00
argenis de la rosa
9784e3bfc1 feat(channel): add github native channel MVP 2026-02-28 14:03:10 -05:00
argenis de la rosa
3f70cbbf9b feat(gateway): add paired devices API and dashboard tab 2026-02-28 13:34:33 -05:00
argenis de la rosa
cc0bc49b2f feat(channel): add napcat support for qq protocol 2026-02-28 13:02:55 -05:00
argenis de la rosa
62b719c447 fix(gateway): allow ws query fallback without subprotocol header 2026-02-28 08:36:18 -05:00
Chummy
51ad52d0e8 security: harden sensitive I/O and outbound leak controls 2026-02-28 21:30:37 +08:00
Chummy
61e738287b chore(ws): mention query token auth in unauthorized hint 2026-02-28 21:21:33 +08:00
Chummy
2a865ac713 chore(gateway): remove unused ws chat artifacts 2026-02-28 21:21:33 +08:00
Chummy
32205fb038 fix(gateway): accept websocket token query fallback 2026-02-28 21:21:33 +08:00
VirtualHotBar
857cb3c054 Merge remote-tracking branch 'origin/main' 2026-02-28 19:00:27 +08:00
VirtualHotBar
0a357064d9 session/history: allowlist persistable roles (user, assistant) via ROLE_* constants; unify filtering in channel + agent; memory/session: reduce read contention with RwLock+AtomicI64 and refresh updated_at on get_history; providers: export role constants and helper; security: switch HMAC verifications to ring::hmac for Linq/Nextcloud/WhatsApp; channels tests: auto-approve mock_price to avoid non-CLI approval dead-wait; misc: ignore target_ci/.idea; main: use local rag module. 2026-02-28 18:40:48 +08:00
VirtualHotBar
fae10cd5c4 Merge remote-tracking branch 'origin/main'
# Conflicts:
#	src/channels/mod.rs
#	src/config/mod.rs
#	src/config/schema.rs
2026-02-28 16:12:02 +08:00
Chummy
7470bded5d fix: harden browser and web search validation paths 2026-02-28 15:50:06 +08:00
Chummy
6716391502 feat: harden web access policy and add flexible web search/runtime config 2026-02-28 15:50:06 +08:00
VirtualHotBar
0a42329ca5 fix: session leftovers after db47f56
- Demote session normal flow logs to debug\n- Skip session operations when CHANNEL_SESSION_CONFIG is uninitialized\n- Add spawn_blocking panic context for SQLite session manager\n- Fix fmt/clippy regressions (Box::pin large futures, cfg features, misc lints)
2026-02-28 15:23:42 +08:00
Preventnetworkhacking
479b6da4ce feat(cost): wire provider token usage to cost tracking (#2111)
Implement CostObserver that intercepts LlmResponse observer events and
records token usage to the CostTracker with proper cost calculations.

Changes:
- Add src/observability/cost.rs: CostObserver implementation
  - Listens for LlmResponse events with token counts
  - Looks up model pricing from CostConfig (with fallback defaults)
  - Records usage via CostTracker.record_usage()
  - Includes model family matching for pricing lookups

- Update src/observability/mod.rs:
  - Export CostObserver
  - Add create_observer_with_cost_tracking() helper that wraps base
    observer with CostObserver when cost tracking is enabled

- Update src/gateway/mod.rs:
  - Use create_observer_with_cost_tracking() to wire cost observer
    into the gateway observer stack when config.cost.enabled is true

The /api/cost endpoint already exists and will now return accurate
session/daily/monthly cost data populated by the CostObserver.

Resolves #2111
2026-02-28 02:00:13 -05:00
Chummy
81387f9896 fix(codex): preserve transport overrides across runtimes 2026-02-28 13:48:41 +08:00
Chummy
b721754ead feat(codex): add websocket-first transport selection 2026-02-28 13:48:41 +08:00
VirtualHotBar
fa8a98113e Merge remote-tracking branch 'origin/main' 2026-02-28 12:06:01 +08:00
argenis de la rosa
b8de8ce8b9 feat(transcription): support config-level api_key 2026-02-27 15:15:02 -05:00
VirtualHotBar
0d68992fb7 feat(session): Add channel session persistence 2026-02-28 00:41:30 +08:00
argenis de la rosa
ff1f2d6c1a feat(gateway): add streaming mode for webhook responses 2026-02-27 11:32:48 -05:00
argenis de la rosa
1ebaa673b5 feat(gateway): add streaming mode for webhook responses 2026-02-27 11:28:48 -05:00
Samy
860e8b2442 fix: address remaining CodeRabbit review items
- Fix convert_channels() return type: dict → tuple[dict, list[str]]
- Remove unnecessary f-string prefixes on plain string literals
- Add blank lines after markdown headings (MD022 compliance)
- Handle triple-quote edge case in TOML multiline string output
- Add handler-level validation tests: missing message rejection,
  empty messages detection, whitespace-only user message, and
  context extraction correctness

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-27 04:43:16 +00:00
sudomove
0aa2994423 fix: address PR review issues — auth guard, doc refs, TOML escaping
- Add non-loopback auth guard to /v1/chat/completions (matching /api/chat)
- Fix migration guide references to non-existent files (api_chat.rs,
  openai_compat_shim.rs, mod_patch.rs) — endpoints live in openclaw_compat.rs
- Remove phantom `provider` field from /api/chat response docs
- Add TOML string escaping to config converter to handle special chars
- Add proper JSON parse error handling in config converter
- Update deployment checklist and troubleshooting to match actual file layout

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-27 04:43:16 +00:00
Samy
dde8b82ea0 feat(gateway): add OpenClaw migration compat layer with /api/chat and tools-enabled /v1/chat/completions
Add a complete OpenClaw → ZeroClaw migration toolkit:

- POST /api/chat: ZeroClaw-native endpoint with full agent loop (tools, memory,
  context enrichment). Supports session_id scoping and context[] injection for
  conversation history. Same code path as Linq/WhatsApp/Nextcloud handlers.

- POST /v1/chat/completions: OpenAI-compatible shim that routes through
  run_gateway_chat_with_tools instead of the simple provider.chat_with_history
  path. Extracts last user message + up to 10 messages of conversation context
  from the messages[] array. Supports streaming (simulated SSE). Drop-in
  replacement for OpenClaw callers with zero code changes.

Both endpoints include full observability instrumentation (AgentStart, LlmRequest,
LlmResponse, RequestLatency, AgentEnd), auth (pairing + webhook secret), rate
limiting, auto-save to memory, and response sanitization.

Also adds:
- scripts/convert-openclaw-config.py: Converts openclaw.json → config.toml with
  provider mapping, channel detection, and migration notes
- docs/migration/openclaw-migration-guide.md: Full migration walkthrough with
  endpoint reference, config mapping, callsite examples, and deployment checklist

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-27 04:43:16 +00:00
argenis de la rosa
e3e4878ade fix(gateway): add explicit webhook usage and empty-message errors 2026-02-26 23:24:35 -05:00
argenis de la rosa
bfe3e4295d feat(security): add opt-in perplexity adversarial suffix filter 2026-02-26 22:55:23 -05:00
argenis de la rosa
21e13c8ae5 fix(qq): add sandbox mode and passive msg id fallback 2026-02-26 22:53:06 -05:00
argenis de la rosa
8180e7dc82 feat(skills): add WASM skill engine with secure registry install 2026-02-26 22:09:24 -05:00
argenis de la rosa
4196fd32a4 fix(gateway): align webchat system prompt with tool protocol 2026-02-26 21:43:43 -05:00
argenis de la rosa
b27b44829a chore: promote dev snapshot to main (resolve #1978/#1970) 2026-02-26 21:09:33 -05:00
Chummy
c54a30f68c supersede: file-replay changes from #1897
Automated conflict recovery via changed-file replay on latest main.
2026-02-26 16:37:17 +00:00
Reid
f836291200
fix(gateway): acknowledge WebSocket subprotocol to unblock agent chat (#1954) 2026-02-26 09:25:35 -05:00
Argenis
f220973192 fix(web/gateway): prevent empty dashboard replies after tool calls (#1930)
* fix(gateway): prevent empty websocket tool-call responses

* fix(web): render fallback for empty done messages
2026-02-26 04:51:05 -05:00
Chum Yin
9b0e70b2f2
supersede: file-replay changes from #1895 (#1926)
Automated conflict recovery via changed-file replay on latest main.
2026-02-26 04:15:47 -05:00
argenis de la rosa
ae0159bad6 fix(linq): support current v3 webhook payload shape 2026-02-25 17:25:08 -05:00