mirror of
https://github.com/multica-ai/multica.git
synced 2026-07-12 12:18:55 +02:00
Three robustness improvements to the OpenClaw agent backend:
1. Hardened JSON parsing — tryParseOpenclawResult now requires lines to
start with '{', eliminating the fragile brace-scanning fallback that
could false-match JSON fragments inside log lines.
2. Lifecycle event handling — new "lifecycle" event type with phase
tracking (error/failed/cancelled). Structured error objects are now
parsed (error.name, error.data.message, error.message) matching the
PaperClip adapter pattern.
3. Usage field name variants — parseOpenclawUsage supports multiple
naming conventions (input/inputTokens/input_tokens, cacheRead/
cachedInputTokens/cache_read_input_tokens, etc.) so usage is
correctly extracted regardless of which OpenClaw version or protocol
the agent uses. Usage accumulates incrementally across step_finish
events.
Adds 13 new tests (31 total for the openclaw backend).
Refs MUL-726