Commit Graph

32 Commits

Author SHA1 Message Date
Zenix
0cb9387cf8 fix: codex agent 400 error (#102) 2026-02-16 11:46:02 +08:00
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
trungtt6
cd638fff6c Add local AI ollama for security purpose (#226)
Co-authored-by: PhotoPortfolio Developer <developer@photportfolio.local>
2026-02-16 11:28:38 +08:00
Meng Zhuo
8eb9dcd99a Merge pull request #173 from is-Xiaoen/fix/code-review-bugs-116
fix: resolve multiple bugs from code review #116
2026-02-15 09:42:26 +08:00
xiaoen
0a88ff0817 fix: resolve multiple bugs from code review #116
Fixes four issues identified in the community code review:

- Session persistence broken on Windows: session keys like
  "telegram:123456" contain ':', which is illegal in Windows
  filenames. filepath.Base() strips drive-letter prefixes on Windows,
  causing Save() to silently fail. Added sanitizeFilename() to
  replace invalid chars in the filename while keeping the original
  key in the JSON payload.

- HTTP client with no timeout: HTTPProvider used Timeout: 0 (infinite
  wait), which can hang the entire agent if an API endpoint becomes
  unresponsive. Set a 120s safety timeout.

- Slack AllowFrom type mismatch: SlackConfig used plain []string
  while every other channel uses FlexibleStringSlice, so numeric
  user IDs in Slack config would fail to parse.

- Token estimation wrong for CJK: estimateTokens() divided byte
  length by 4, but CJK characters are 3 bytes each, causing ~3x
  overestimation and premature summarization. Switched to
  utf8.RuneCountInString() / 3 for better cross-language accuracy.

Also added unit tests for the session filename sanitization.

Ref #116
2026-02-15 09:36:59 +08:00
Meng Zhuo
ddd73cad48 Merge pull request #151 from qiaoborui/codex/fix-openai-oauth-authorize-url
fix(auth): align OpenAI OAuth browser login URL
2026-02-15 09:27:19 +08:00
Lixeer
16e5a02953 fix(http_provider): Remove extra parameter from CreateProvider function. 2026-02-15 08:06:29 +08:00
Lixeer
4b886b6573 fix: not used result 2026-02-15 08:02:23 +08:00
Lixeer
0a4bf32e81 try after workflow fix 2026-02-15 07:54:04 +08:00
Lixeer
5a6ad37dab code fmt 2026-02-15 07:34:12 +08:00
Lixeer
f6d6221c09 make fmt 2026-02-15 07:00:40 +08:00
Lixeer
7a9659971d make fmt 2026-02-15 06:55:20 +08:00
Lixeer
ecbe31599e chore: remove redundant debug output 2026-02-15 06:30:31 +08:00
Lixeer
6c392c3387 fix: openclaw crash because of empty config 2026-02-15 06:11:07 +08:00
Lixeer
0aab8d8afc feat:add github_copilot to providers factory 2026-02-15 06:10:00 +08:00
Lixeer
5faa67b77d feat: add Github Copilot provider 2026-02-15 05:23:42 +08:00
Lixeer
18d3634f1b feat: Improve parameter fault tolerance for DeepSeek 2026-02-14 16:47:46 +08:00
Lixeer
afc3a2cda3 feat: add provider deepseek 2026-02-14 16:35:49 +08:00
qiaoborui
da804a0748 fix(codex): include required instructions and improve account-id extraction 2026-02-14 12:48:16 +08:00
Avisek
45351a6a79 refactor: Trim trailing slashes from the API base URL and enhance API error messages with status codes. 2026-02-14 02:09:55 +08:00
Meng Zhuo
584a3dcc87 misc: fmt code 2026-02-13 17:51:47 +08:00
Meng Zhuo
c58f8b740f Merge pull request #111 from shengsuan/ssy
add ShengSuanYun (胜算云) as a models provider
2026-02-13 17:41:15 +08:00
coohu
896eae4c56 feat: add ShengSuanYun(胜算云) as a models provider. 2026-02-13 15:55:59 +08:00
yinwm
e7e086155e feat: merge heartbeat service improvements from feat-heartbeat branch
- Add ChannelSender interface for sending heartbeat results to users
- Add sendResponse() to automatically deliver results to last channel
- Add createDefaultHeartbeatTemplate() for first-run setup
- Support HEARTBEAT_OK silent response (legacy compatibility)
- Add structured logging with INFO/ERROR levels
- Move integration tests to separate file with build tag

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-13 01:42:22 +08:00
Leandro Barbosa
f6362ce7b1 feat: add cli-based LLM provider
Add ClaudeCliProvider that executes the local CLI as a subprocess,
enabling PicoClaw to leverage advanced capabilities (MCP tools,
workspace awareness, session management) through any messaging channel.

- Implement LLMProvider interface via subprocess execution
- Support --system-prompt, --model, --output-format json flags
- Parse real v2.x JSON response format including usage tokens
- Handle error responses, stderr, context cancellation
- Register "claude-cli", "claude-code", "claudecode" aliases in CreateProvider
- 56 unit tests with mock scripts + 3 integration tests against real binary
- 100% coverage on all functions except stripToolCallsJSON (85.7%)
2026-02-12 11:51:51 -03:00
mxrain
a9a7a89c07 feat: add Moonshot/Kimi and NVIDIA provider support with proxy 2026-02-12 22:39:38 +08:00
Wutachi
f4a8ff7571 Add provider field support for explicit provider selection
- Add Provider field to AgentDefaults struct
- Modify CreateProvider to use explicit provider field first, fallback to model name detection
- Allows using models without provider prefix (e.g., llama-3.1-8b-instant instead of groq/llama-3.1-8b-instant)
- Supports all providers: groq, openai, anthropic, openrouter, zhipu, gemini, vllm
- Backward compatible with existing configs

Fixes issue where models without provider prefix could not use configured API keys.
2026-02-12 01:01:23 -03:00
Cory LaNou
83f6e44b02 chore(deps): upgrade openai-go from v1.12.0 to v3.21.0
Update to latest major version of the official OpenAI Go SDK.
Fix breaking change: FunctionCallOutput.Output is now a union type
(ResponseInputItemFunctionCallOutputOutputUnionParam) instead of string.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-11 13:39:19 -06:00
Cory LaNou
fbad753b2a feat(providers): add SDK-based providers for subscription OAuth login
Add ClaudeProvider (anthropic-sdk-go) and CodexProvider (openai-go) that
use the correct subscription endpoints and API formats:

- CodexProvider: chatgpt.com/backend-api/codex/responses (Responses API)
  with OAuth Bearer auth and Chatgpt-Account-Id header
- ClaudeProvider: api.anthropic.com/v1/messages (Messages API) with
  Authorization: Bearer token auth

Update CreateProvider() routing to use new SDK-based providers when
auth_method is "oauth" or "token", removing the stopgap that sent
subscription tokens to pay-per-token endpoints.

Closes #18

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-11 13:27:59 -06:00
Cory LaNou
5efe8a2020 feat(auth): add OAuth and token-based login for OpenAI and Anthropic
Add `picoclaw auth` CLI command supporting:
- OpenAI OAuth2 (PKCE + browser callback or device code flow)
- Anthropic paste-token flow
- Token storage at ~/.picoclaw/auth.json with 0600 permissions
- Auto-refresh for expired OAuth tokens in provider

Closes #18

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-11 11:41:13 -06:00
Only_Xianzo
6ccd9d0a99 Fix: prioritize explicit provider prefixes and update max_tokens schema 2026-02-11 22:49:47 +08:00
lxowalle
e17693b17c * First commit 2026-02-09 19:20:19 +08:00