Commit Graph

182 Commits

Author SHA1 Message Date
yinwm ec86b21d3f fix: improve migration logic and reduce code duplication
- Preserve user's configured model during config migration (issue #5)
- Simplify ExtractProtocol using strings.Cut
- Extract NormalizeToolCall to shared utility, removing ~70 lines of duplicate code
- Clean up unused fields in providerMigrationConfig struct

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 09:22:39 +08:00
yinwm 09a0d19119 fix: add VLLM default API base and implement MaxTokensField support
1. Add VLLM default API base (http://localhost:8000/v1)
   - Previously returned empty string, causing provider creation to fail

2. Implement MaxTokensField configuration
   - Add maxTokensField field to HTTPProvider
   - Add NewHTTPProviderWithMaxTokensField constructor
   - Use configured field name for max_tokens parameter
   - Fallback to model-based detection for backward compatibility

3. Add tests for VLLM, deepseek, ollama default API bases

Example config usage:
{
  "model_name": "glm-4",
  "model": "openai/glm-4",
  "max_tokens_field": "max_completion_tokens"
}

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 01:43:24 +08:00
yinwm e1583f3b13 refactor: simplify legacy_provider.go from 349 to 49 lines
- Move OAuth helper functions to factory_provider.go
- Add auto-migration in LoadConfig: old providers -> model_list
- Add Workspace field to ModelConfig for CLI-based providers
- Fix OAuth handling to use auth store instead of raw APIKey
- Update tests to use new model_list configuration format

This eliminates the giant switch-case in legacy_provider.go,
achieving the goal of "zero-code provider addition" from the
design document (issue #283).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 01:30:19 +08:00
yinwm ef7078a356 refactor: reorganize commands and provider architecture
Refactor command handlers into separate files to improve code organization
and maintainability. Each command (agent, auth, cron, gateway, migrate,
onboard, skills, status) now has its own dedicated file.

Restructure provider creation to support new model_list configuration
system that enables zero-code addition of OpenAI-compatible providers.
Move legacy provider logic to separate file for backward compatibility.

Move configuration functions from config.go to separate files
(defaults.go, migration.go) for better organization.
2026-02-19 01:03:34 +08:00
yinwm a73d8e1a16 feat: add model_list configuration for zero-code provider addition
- Add ModelConfig struct with protocol prefix support (openai/, anthropic/, etc.)
- Implement GetModelConfig with round-robin load balancing
- Add CreateProviderFromConfig factory for protocol-based routing
- Add ModelRegistry for thread-safe endpoint selection
- Maintain full backward compatibility with legacy providers config
- Update README.md and README.zh.md with model_list documentation
- Add migration guide at docs/migration/model-list-migration.md

Supported protocols: openai, anthropic, antigravity, claude-cli, codex-cli,
github-copilot, openrouter, groq, deepseek, cerebras, qwen, zhipu, gemini

Closes #283

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 23:26:00 +08:00
yinwm 5d1669ecc4 Merge PR #343: Add Google Antigravity provider and harden tool-call compatibility 2026-02-18 00:13:24 +08:00
yinwm 6913edbb5b Merge PR #368: Add Volcengine (doubao) provider 2026-02-17 23:51:40 +08:00
yinwm 6992012737 Merge PR #333: Add Cerebras provider 2026-02-17 23:41:19 +08:00
yinwm de4ef9a8be Merge PR #365: Add Qwen provider 2026-02-17 23:37:55 +08:00
likeaturtle 6cd419b6e2 Fix the case sensitivity issue when automatically recognizing VolcEngine LLM model names. 2026-02-17 22:49:43 +08:00
mrbeandev 84110aa408 fix(antigravity): preserve thought signature on tool call parts 2026-02-17 20:05:47 +05:30
mrbeandev 99c32714f1 fix(antigravity): sanitize invalid tool-call history ordering 2026-02-17 20:05:41 +05:30
mrbeandev caf3913347 fix(antigravity): normalize tool calls to avoid empty function names 2026-02-17 20:05:35 +05:30
mrbeandev d1655d5996 fix(antigravity): update default model from gemini-3-flash-preview to gemini-3-flash 2026-02-17 20:05:29 +05:30
mrbeandev 1765f6d0e7 fix: strip antigravity prefix and improve model list for flash-preview 2026-02-17 20:05:25 +05:30
mrbeandev d3fe8c5e17 feat: use gemini-3-flash-preview as default model name 2026-02-17 20:05:20 +05:30
mrbeandev 29e07ec7b4 feat: add manual callback URL entry for headless OAuth flow 2026-02-17 20:05:10 +05:30
mrbeandev 848aaedc24 feat: complete Antigravity provider integration with robust error handling and docs 2026-02-17 20:05:06 +05:30
mrbeandev 33915fb712 fix(gemini): preserve thought_signature in tool calls to prevent 400 errors 2026-02-17 20:04:45 +05:30
likeaturtle 2f24be6c59 add Volcengine LLM (doubao) support 2026-02-17 22:31:19 +08:00
HansonJames f0e90e6379 feat: Add the Qwen provider 2026-02-17 22:07:58 +08:00
daming大铭 7b9b8104c8 Merge pull request #225 from yinwm/feat/cron-exec-timeout-config
feat(cron): add configurable execution timeout for cron jobs
2026-02-17 21:12:59 +08:00
yinwm 881999aceb refactor(shell): interpret zero timeout as unlimited execution
Replace unconditional WithTimeout usage with conditional context creation
based on timeout configuration. Zero values now bypass timeout enforcement,
using WithCancel for graceful cancellation while preserving existing timeout
behavior for positive values. Simplifies CronTool initialization by removing
unnecessary conditional timeout assignment.
2026-02-17 21:10:20 +08:00
Hua Audio f929268ab2 feat: Add Perplexity search provider integration (#138)
* feat: Add Perplexity search provider integration

- Add PerplexityConfig struct to config package
- Add PerplexitySearchProvider implementing SearchProvider interface
- Update WebSearchTool to support Perplexity with priority system (Perplexity > Brave > DuckDuckGo)
- Update agent loop to pass Perplexity config options
- Update config.example.json with Perplexity configuration template
- Uses Perplexity's 'sonar' model for web search capabilities

* Edit config example

* make fmt

---------

Co-authored-by: Hua <zhangmikoto@gmail.com>
2026-02-17 21:02:56 +08:00
yinwm 684e7413e1 Merge remote-tracking branch 'origin/main' into feat/cron-exec-timeout-config 2026-02-17 20:53:31 +08:00
Yasuhiro Matsumoto 852d361eb0 Add new provider cerebras 2026-02-17 08:23:44 +09:00
Tzufucius 8d757fbb6f Feat issue 183 (#189)
* feat: add slash command support (e.g., /show model, /help)

* style: fix code formatting

* feat: implement robust context compression and error recovery with user notifications
2026-02-16 16:30:54 +08:00
Goksu Ceylan e3f65fc3d6 fix(security): block critical symlink workspace escape (#188) 2026-02-16 16:20:35 +08:00
is-Xiaoen 5c321a90de fix: tighten file perms and enforce Slack ACL checks (#186)
- write config and cron store with 0600 instead of 0644
- check allow list in Slack slash commands and app mentions
- pass workspace restrict flag to cron exec tool

Closes #179
2026-02-16 16:06:39 +08:00
mattn a371d53438 Prevent panic on publish after MessageBus is closed (#223) 2026-02-16 15:04:25 +08:00
Avisek Ray 9d5728ec5b feat: implement structured Telegram command handling with a dedicated command service and telegohandler integration. (#164) 2026-02-16 14:20:16 +08:00
Huaaudio 32cb8fdc12 Feat: Discord message length check and auto split (#143)
* feat: discord message auto split

* make fmt

* chore: remove failing discord_test.go

---------

Co-authored-by: Hua <zhangmikoto@gmail.com>
2026-02-16 13:39:26 +08:00
fahadahmadansari111 341dbd3007 Add health check endpoints (/health and /ready) for container orchestration liveness and readiness probes. (#104)
* added health endpoint

* formatted files

---------

Co-authored-by: lxowalle <83055338+lxowalle@users.noreply.github.com>
2026-02-16 11:53:11 +08:00
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
mattn 1d748fb742 Remove duplicate file extension in DownloadFile (#230) 2026-02-16 02:20:20 +08:00
ian c6c82b3c44 feat(skills): add validation for skill info and test cases (#231)
Add validation logic for SkillInfo to ensure name and description meet requirements
Include test cases covering various validation scenarios
Add testify dependency for testing assertions
2026-02-16 02:12:50 +08:00
Luke Milby 811e4f8728 add when picoclaw responsed to discord message will show its typing (#236) 2026-02-16 01:37:32 +08:00
yinwm 40f90281e5 Merge remote-tracking branch 'upstream/main' into feat/cron-exec-timeout-config 2026-02-15 18:41:54 +08:00
yinwm 82856bc57a feat(cron): add configurable execution timeout for cron jobs
Add a new configuration option `exec_timeout_minutes` under the `tools.cron`
section to control the maximum execution time for cron jobs. The default
timeout is set to 5 minutes, which is appropriate for LLM operations.

The configuration can be set in the config file or via the
`PICOCLAW_TOOLS_CRON_EXEC_TIMEOUT_MINUTES` environment variable. A value of
0 disables the timeout entirely.

This change improves system reliability by preventing cron jobs from running
indefinitely in case of unexpected failures or hanging processes.
2026-02-15 18:41:39 +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
Meng Zhuo 0f506d4202 Merge pull request #165 from alexhoshina/feat/onebot
feat: add OneBot channel support
2026-02-15 09:12:00 +08:00
Meng Zhuo 6f2e730eba Merge pull request #178 from Lixeer/main
feat: Add `GitHub Copilot` provider support
2026-02-15 09:04:05 +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