picoclaw/pkg/tools
Leandro Barbosa e77b0a6755
feat: add Codex CLI provider for subprocess integration (#80)
* feat: add Codex CLI provider for OpenAI subprocess integration

Add CodexCliProvider that wraps `codex exec --json` as a subprocess,
analogous to the existing ClaudeCliProvider pattern. This enables using
OpenAI's Codex CLI tool as a local LLM backend.

- CodexCliProvider: subprocess wrapper parsing JSONL event stream
- Credential reader for ~/.codex/auth.json with token expiry detection
- Factory integration: provider "codex-cli" and auth_method "codex-cli"
- Fix tilde expansion in workspace path for CLI providers
- 37 unit tests covering parsing, prompt building, credentials, and mocks

* fix: add tool call extraction to Codex CLI provider

- Extract shared tool call parsing into tool_call_extract.go
  (extractToolCallsFromText, stripToolCallsFromText, findMatchingBrace)
- Both ClaudeCliProvider and CodexCliProvider now share the same
  tool call extraction logic for PicoClaw-specific tools
- Fix cache token accounting: include cached_input_tokens in total
- Add 2 new tests for tool call extraction from JSONL events
- Update existing tests for corrected token calculations

* fix(docker): update Go version to match go.mod requirement

Dockerfile used golang:1.24-alpine but go.mod requires go >= 1.25.7.
This caused Docker builds to fail on all branches with:
  "go: go.mod requires go >= 1.25.7 (running go 1.24.13)"

Update to golang:1.25-alpine to match the project requirement.

* fix: handle codex CLI stderr noise without losing valid stdout

Codex writes diagnostic messages to stderr (e.g. rollout errors) which
cause non-zero exit codes even when valid JSONL output exists on stdout.
Parse stdout first before checking exit code to avoid false errors.

* style: fix gofmt formatting and update web search API in tests

- Remove trailing whitespace in web.go and base_test.go
- Update config_test.go and web_test.go for WebSearchToolOptions API
2026-02-16 11:40:17 +08:00
..
base.go feat: US-006 - Add AsyncCallback type and AsyncTool interface 2026-02-12 19:35:41 +08:00
cron.go misc: fmt code 2026-02-13 17:51:47 +08:00
edit.go Merge upstream/main into ralph/tool-result-refactor 2026-02-13 01:00:26 +08:00
edit_test.go Merge upstream/main into ralph/tool-result-refactor 2026-02-13 01:00:26 +08:00
filesystem.go Merge upstream/main into ralph/tool-result-refactor 2026-02-13 01:00:26 +08:00
filesystem_test.go * Delete unused file 2026-02-12 21:58:40 +08:00
i2c.go add I2C and SPI tools for hardware interaction (#140) 2026-02-14 16:53:17 +08:00
i2c_linux.go add I2C and SPI tools for hardware interaction (#140) 2026-02-14 16:53:17 +08:00
i2c_other.go add I2C and SPI tools for hardware interaction (#140) 2026-02-14 16:53:17 +08:00
message.go misc: fmt code 2026-02-13 17:51:47 +08:00
message_test.go feat: US-011 - Add MessageTool tests 2026-02-12 19:50:53 +08:00
registry.go refactor(tools): extract shared logic for internal channels and tool definitions 2026-02-13 15:05:16 +08:00
result.go feat: US-002 - Modify Tool interface to return *ToolResult 2026-02-12 19:28:56 +08:00
result_test.go feat: US-002 - Modify Tool interface to return *ToolResult 2026-02-12 19:28:56 +08:00
shell.go misc: fmt code 2026-02-13 17:51:47 +08:00
shell_test.go Merge upstream/main into ralph/tool-result-refactor 2026-02-13 01:00:26 +08:00
spawn.go fix: resolve code review issues in tool-result-refactor 2026-02-13 01:59:50 +08:00
spi.go add I2C and SPI tools for hardware interaction (#140) 2026-02-14 16:53:17 +08:00
spi_linux.go add I2C and SPI tools for hardware interaction (#140) 2026-02-14 16:53:17 +08:00
spi_other.go add I2C and SPI tools for hardware interaction (#140) 2026-02-14 16:53:17 +08:00
subagent.go misc: fmt code 2026-02-13 17:51:47 +08:00
subagent_tool_test.go refactor(heartbeat): add configurable interval and channel-aware routing 2026-02-13 11:13:32 +08:00
toolloop.go refactor(tools): extract shared logic for internal channels and tool definitions 2026-02-13 15:05:16 +08:00
types.go * First commit 2026-02-09 19:20:19 +08:00
web.go refactor: remove unused min func 2026-02-14 16:24:20 +08:00
web_test.go feat: add Codex CLI provider for subprocess integration (#80) 2026-02-16 11:40:17 +08:00