cc1261ba2a
3 Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
cc1261ba2a
|
feat(tool): add myself and list_projects actions to jira tool (#4061)
* Sync jira tool description between .rs and en.toml
Replace multi-line operational guide in en.toml with the same one-liner
already in jira_tool.rs description(), matching the pattern used by all
other tools where both sources are in sync.
* Add myself action to jira tool for credential verification
* Add tests for myself action in jira tool
* Review and fix list_projects action added to jira tool
- Fix doc comment: update action count from four to five and add missing
myself entry
- Remove redundant statuses_url variable (was identical to url)
The list_projects action fetches all projects with their issue types,
statuses, and assignable users by combining /rest/api/3/project,
per-project /statuses, and /user/assignable/multiProjectSearch endpoints.
* Remove hardcoded project-specific statuses from shape_projects
Replace fixed known_order list (which included project-specific statuses
like 'Collecting Intel', 'Design', 'Verification') with a simple
alphabetical sort. Any Jira project can use arbitrary status names so
hardcoding an order is not applicable universally.
* Fix list_projects: bounded concurrency, error surfacing, and output shape
- Use tokio::task::JoinSet with STATUS_CONCURRENCY=5 to fetch per-project
statuses concurrently instead of sequentially, bounding API blast radius
- Surface user fetch errors: non-2xx and JSON parse failures now bail
instead of silently falling back to empty vec
- Surface per-project status JSON parse errors instead of swallowing them
with unwrap_or_else
- Move users to top-level output {projects, users} so they are not
duplicated across every project entry
* fix(tool): apply rustfmt formatting to jira_tool.rs
|
||
|
|
3a19f1466d
|
Fix Jira tool panics and dedup bug (#4003)
* feat: add Jira tool with get_ticket, search_tickets, and comment_ticket Implements a new `jira` tool following the existing zeroclaw tool conventions (Tool trait, SecurityPolicy, config-gated registration). - get_ticket: configurable detail level (basic/basic_search/full/changelog) with response shaping; always in the default allowed_actions list - search_tickets: JQL-based search with cursor pagination (nextPageToken); always returns basic_search shape; gated by allowed_actions - comment_ticket: posts ADF comments with inline markdown-like syntax — @email mentions resolved to Jira accountId, **bold**, bullet lists, newlines; gated by allowed_actions and SecurityPolicy Act operation Config: [jira] section with base_url, email, api_token (encrypted at rest, falls back to JIRA_API_TOKEN env var), allowed_actions (default: ["get_ticket"]), and timeout_secs. Validated on load. Tool description in tool_descriptions/en.toml documents all three actions and the full comment syntax for the AI system prompt. * fix: address jira tool code review findings High priority: - Validate issue_key against ^[A-Z][A-Z0-9]+-\d+$ before URL interpolation to prevent path traversal in get_ticket and comment_ticket Medium priority: - Add email guard in tool registration (mod.rs) to skip with a warning instead of registering a broken tool when jira.email is empty - Shape comment_ticket response to return only id, author, created — avoids exposing internal Jira metadata to the AI - Replace O(n²) comment matching in shape_basic with a HashMap lookup keyed by comment ID for O(1) access - Add api_token validation in Config::validate() checking both the config field and JIRA_API_TOKEN env var when jira.enabled = true Low priority: - Make shape_basic_search private (was accidentally pub) - Extend clean_email to strip leading punctuation (( and [) so that @(john@co.com) resolves correctly; fix suffix computation via pointer arithmetic to handle the shifted offset - Clarify tool_descriptions/en.toml: @prefix is required for mentions, bare emails without @ are treated as plain text - Handle unmatched ** in parse_inline: emit as literal text instead of silently producing a bold node with no closing marker * fix(jira): allow lowercase project keys in issue_key validation Relax validate_issue_key to accept both PROJ-123 and proj-123, since some Jira instances use lowercase custom project keys. Path traversal protection is preserved via alphanumeric + digit-number requirement. * feat(tools): add tool honesty instructions to system prompt Prevent AI from fabricating tool results by injecting a CRITICAL: Tool Honesty section into both channel and CLI/agent system prompts. Rules: never fabricate or guess tool results, report errors as-is, and ask the user when unsure if a tool call succeeded. * style: sort JiraConfig import alphabetically in config/mod.rs * style(jira): fix strict clippy lints in jira_tool - Derive Default for LevelOfDetails instead of manual impl - Use char arrays in trim_start_matches/trim_end_matches - Allow cast_possible_truncation on search_tickets (usize->u32 bounded by max_results) - Remove needless borrow on &email * fix(ci): adapt to upstream autonomy_level additions in channels/mod.rs - Add missing autonomy_level argument to build_system_prompt_with_mode call in test - Add missing autonomy_level field in ChannelRuntimeContext test initializer - Allow large_futures in load_or_init test (Config struct growth from JiraConfig) * fix(ci): resolve duplicate and missing autonomy_level in test initializers * fix(ci): use TelegramRecordingChannel in telegram-specific test The test process_channel_message_executes_tool_calls_instead_of_sending_raw_json sent messages on channel "telegram" but registered RecordingChannel (name: "test-channel"), causing the channel lookup to return None and no messages to be sent. * fix(jira): prevent panics on short dates, fix dedup bug, normalize base_url - Add date_prefix() helper to safely slice date strings instead of panicking on empty or short strings from the Jira API. - Replace Vec::dedup() with HashSet-based retain in extract_emails() to correctly deduplicate non-adjacent duplicates. - Strip trailing slashes from base_url during construction to prevent double-slash URLs. - Add tests for date_prefix and non-adjacent email dedup. --------- Co-authored-by: Anatolii <anatolii@Anatoliis-MacBook.local> Co-authored-by: Anatolii <anatolii.fesiuk@gmail.com> |
||
|
|
81d99f513c
|
feat(i18n): externalize tool descriptions for translation (#3912)
Add a locale-aware tool description system that loads translations from TOML files in tool_descriptions/. This enables non-English users to see tool descriptions in their language. - Add src/i18n.rs module with ToolDescriptions loader, locale detection (ZEROCLAW_LOCALE, LANG, LC_ALL env vars), and English fallback chain - Add locale config field to Config struct for explicit locale override - Create tool_descriptions/en.toml with all 47 tool descriptions - Create tool_descriptions/zh-CN.toml with Chinese translations - Integrate with ToolsSection::build() and build_tool_instructions() to resolve descriptions from locale files before hardcoded fallback - Add PromptContext.tool_descriptions field for prompt-time resolution - Add AgentBuilder.tool_descriptions() setter for Agent construction - Include tool_descriptions/ in Cargo.toml package include list - Add 8 unit tests covering locale loading, fallback chains, env detection, and config override Closes #3901 |