feat: bubbletea TUI for picoclaw agent#600
Open
rbansal42 wants to merge 40 commits intosipeed:mainfrom
Open
Conversation
Adds three auth flows for Anthropic: browser OAuth for Max/Pro (free inference via Bearer token), browser OAuth for console (creates API key), and manual paste. Includes SDK middleware for tool name prefixing, prompt sanitization, and required beta headers.
Checks workspace structure, config validation, session integrity (orphan tool_calls, missing tool_results), and auth credential health. Supports --fix flag for auto-repair (delete corrupt sessions, fix permissions, refresh expired tokens).
Covers build/test commands, project structure, code style (imports, naming, errors, types, logging, testing), git workflow (atomic commits, upstream syncing), and CI pipeline expectations.
…c API
The assistant message stored in loop.go omitted the Arguments map from
ToolCall, leaving it nil. When sent back to Anthropic, nil serialized as
JSON null instead of {}, which the API rejects.
- Copy Arguments map into stored ToolCall in agent loop (root cause)
- Add nil-guard in Anthropic provider to recover from Function.Arguments
- Normalize ToolCalls when loading sessions from disk (migration)
…nd tool integration Add PermissibleTool interface and validatePathWithPermission for filesystem tools (read_file, write_file, list_dir, edit_file, append_file) and guardCommandWithPermission for exec tool. When a path outside the workspace is detected, the tool checks cached approvals in PermissionStore, then calls PermissionFunc to ask the user. Deny patterns and path traversal checks remain non-bypassable. Includes CLI stdin prompt implementation.
Add PermStore to AgentInstance, SetPermissionFuncFactory to AgentLoop, and update updateToolContexts to set per-request PermissionFunc on all PermissibleTools. CLI agent command creates a stdin-based permission prompt for the cli channel.
TelegramPermissionManager sends inline keyboard buttons (Allow/Deny) and blocks until the user responds via callback query. HandleCallbackQuery registered in telegram bot handler. Gateway wires the permission factory so telegram channel uses inline buttons while other channels fall back to LLM-driven confirmation.
Fixes sipeed#562: picoclaw --help and -h now print help and exit 0 instead of showing 'Unknown command'. No-args also exits 0. Fixes sipeed#574: every subcommand (agent, auth, cron, gateway, onboard, status, skills) now responds to --help/-h with usage info.
Fixes sipeed#564: LLM errors are now classified (auth, rate limit, network, server, context) and shown as actionable messages. Raw errors logged server-side only. Includes 24 test cases for error classification.
Fixes sipeed#565: /list models now references config.json instead of config.yaml. Fixes sipeed#579: /help now includes /show agents, /list agents, /switch commands.
Fixes sipeed#569: /help now returns a formatted list of all available commands across all channels. Fixes sipeed#570: /list models now shows actual configured models with fallbacks instead of a static unhelpful message. Fixes sipeed#580: memory/context feedback messages are now more user-friendly.
Fixes sipeed#563: default model changed from glm-4.7 (Zhipu AI) to llama3 (local Ollama — free, no API key needed). Fixes sipeed#567: model list trimmed from 18 to 5 essential entries (ollama, openrouter, anthropic, openai, deepseek). Removed 13 niche providers to reduce config from ~265 lines to ~80.
Fixes sipeed#572: /new saves current session and clears conversation history, giving users a fresh start without restarting the process. Fixes sipeed#573: /status shows model, agent ID, channel, message count, and max iterations for debugging and visibility.
Fixes sipeed#576: shows a rotating Braille dot animation with 'Thinking...' on stderr while waiting for LLM responses. Spinner runs in all three agent modes (single message, interactive, simple interactive).
Fixes sipeed#577: config load failures, provider creation errors, and gateway startup errors now hint at running 'picoclaw doctor'. Onboarding success message includes troubleshooting section. Help text updated.
…erification Fixes sipeed#566: onboarding now prompts for provider choice (Ollama, OpenRouter, Anthropic, OpenAI, DeepSeek, or manual), asks for API key, and sets the default model automatically. Fixes sipeed#568: after writing config, verifies API key validity or Ollama reachability with a 5-second HTTP check and reports results.
Fixes sipeed#583: Telegram /help, /show, /list now match agent loop output. Added /switch command, /show agents, /list agents. Added comprehensive channel detection for all 12 channel types. Fixes sipeed#584: /list channels with no channels enabled now shows 'No channels enabled' instead of a dangling bullet point.
Fixes sipeed#575: new sessions command with list, show, delete, and clear subcommands. Lists sessions with message count and last modified time. Show displays last messages. Includes 10 tests covering core logic.
…patch Fixes sipeed#581: agent and gateway commands now error on unknown flags instead of silently ignoring them. Fixes sipeed#582: auth, cron, and skills help text now includes Usage header and --help in flags list, matching doctor command format. Fixes sipeed#585: skills subcommand dispatch moved from main.go to cmd_skills.go via new skillsCmd() function.
…e/tool_result pairs
Calls repairOrphanedToolPairs as the first step so that assistant messages with tool_calls that lack matching tool_results get synthetic results injected. This prevents Anthropic API 400 errors. Fixes sipeed#475
When the cut point falls inside a tool_use/tool_result group, snap backward to include the full group.
The midpoint calculation now walks forward past tool_result messages to avoid splitting an assistant+tool_calls from its tool_results.
Adds repairSessionMessages that injects synthetic tool_result messages for orphaned tool_use blocks and drops orphaned tool_result messages. Sessions are written back to disk with the repairs applied, preserving conversation history.
…tor command The sanitizeHistoryForProvider check for tool messages only looked at the immediately preceding message, requiring it to be an assistant. But when an assistant makes 2+ tool calls, the 2nd tool_result follows another tool message. Fixed to look back past consecutive tool messages. Also adds /doctor slash command for in-session diagnosis and repair.
…d tool indicators
Collaborator
|
Thank you for your work on this. At the moment, we are planning to introduce a separate bootstrap/launcher repository that will communicate with the current Pico project. We believe this separation will help us keep the core system clean while allowing more flexibility for orchestration and distributed features. Would you be open to contributing this implementation in that new repository instead? We think it may be a better architectural fit there, and we would be happy to collaborate on shaping the direction together. |
Author
|
Sounds good! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Changes
Test Plan