feat: update supercode-cli version and enhance tool handlin#201
Conversation
- Bumped version to 0.1.63 in package.json. - Improved tool parameter handling in toolParams function to return a default object structure when necessary. - Enhanced nonStreamingRequest to accept tools as an optional parameter and include them in the request body. - Updated ConcentrateService to track tool events during streaming responses. - Simplified chat initialization logic in wakeUpAction for better clarity and efficiency. - Added a new model entry for "Opus 4.8" in the model list.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Your trial has ended. Reactivate Greptile to resume code reviews.
WalkthroughThe update improves ConcentrateAI tool-call handling, normalizes missing tool schemas, changes CLI session startup routing, adds a ConcentrateAI Opus 4.8 model option, and increments the server package version. ChangesAI and CLI updates
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant CLI as CLI session
participant sendMessage
participant Stream as ConcentrateAI stream
participant Fallback as nonStreamingRequest
CLI->>sendMessage: send tool-enabled request
sendMessage->>Stream: consume streamed events
Stream-->>sendMessage: content or tool-call/tool-result events
alt tool events or tool_calls finish reason
sendMessage-->>CLI: preserve streamed tool response
else empty stream without tool events
sendMessage->>Fallback: retry with tools payload
Fallback-->>CLI: return response
end
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint install failed. For unrecoverable errors, disable the tool in CodeRabbit configuration. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@apps/supercode-cli/server/src/index.ts`:
- Around line 17-21: Update toolParams() in
apps/supercode-cli/server/src/index.ts (lines 17-21) to convert Zod schemas to
JSON Schema with the repository’s zod-to-json-schema dependency instead of
returning an empty object; preserve existing handling for absent or
already-serializable schemas. In
apps/supercode-cli/server/src/cli/ai/concentrate-service.ts (lines 40-45),
normalize the tool schema by selecting fn.inputSchema ?? fn.parameters and
applying the same Zod-to-JSON-Schema conversion before forwarding it.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: ab620038-4ebe-4439-9acf-793c0132dbff
📒 Files selected for processing (5)
apps/supercode-cli/server/package.jsonapps/supercode-cli/server/src/cli/ai/concentrate-service.tsapps/supercode-cli/server/src/cli/commands/ai/init.tsapps/supercode-cli/server/src/cli/commands/slashCommands/model.tsapps/supercode-cli/server/src/index.ts
| const raw = fn.inputSchema ?? fn.parameters | ||
| if (!raw || (typeof raw === "object" && "_def" in raw)) { | ||
| return { type: "object", properties: {} } | ||
| } | ||
| return raw |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Description: Check for zod-to-json-schema package to use for converting Zod schemas
rg "zod-to-json-schema" package.json apps/supercode-cli/server/package.jsonRepository: yashdev9274/supercli
Length of output: 233
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf '\n== outline: apps/supercode-cli/server/src/index.ts ==\n'
ast-grep outline apps/supercode-cli/server/src/index.ts --view expanded || true
printf '\n== outline: apps/supercode-cli/server/src/cli/ai/concentrate-service.ts ==\n'
ast-grep outline apps/supercode-cli/server/src/cli/ai/concentrate-service.ts --view expanded || true
printf '\n== relevant ranges ==\n'
sed -n '1,120p' apps/supercode-cli/server/src/index.ts
printf '\n---\n'
sed -n '1,140p' apps/supercode-cli/server/src/cli/ai/concentrate-service.tsRepository: yashdev9274/supercli
Length of output: 11564
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf '\n== toolParams references ==\n'
rg -n "toolParams\\(" apps/supercode-cli/server/src/index.ts apps/supercode-cli/server/src/cli/ai/concentrate-service.ts
printf '\n== parameters / inputSchema references in server src ==\n'
rg -n "inputSchema|\\.parameters\\b|zod-to-json-schema|toJsonSchema|json schema|tool schema" apps/supercode-cli/server/src -g '!**/node_modules/**'
printf '\n== surrounding block in index.ts around tool usage ==\n'
sed -n '140,260p' apps/supercode-cli/server/src/index.ts
printf '\n== surrounding block in concentrate-service.ts around nonStreamingRequest ==\n'
sed -n '1,110p' apps/supercode-cli/server/src/cli/ai/concentrate-service.tsRepository: yashdev9274/supercli
Length of output: 11035
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf '\n== toolParams references ==\n'
rg -n "toolParams\\(" apps/supercode-cli/server/src/index.ts apps/supercode-cli/server/src/cli/ai/concentrate-service.ts
printf '\n== nonStreamingRequest references ==\n'
rg -n "nonStreamingRequest\\(" apps/supercode-cli/server/src/cli/ai/concentrate-service.ts
printf '\n== parameters / inputSchema references in server src ==\n'
rg -n "inputSchema|\\.parameters\\b|zod-to-json-schema|toJsonSchema|json schema|tool schema" apps/supercode-cli/server/src -g '!**/node_modules/**'
printf '\n== surrounding block in index.ts around tool usage ==\n'
sed -n '140,260p' apps/supercode-cli/server/src/index.ts
printf '\n== surrounding block in concentrate-service.ts around nonStreamingRequest ==\n'
sed -n '1,110p' apps/supercode-cli/server/src/cli/ai/concentrate-service.tsRepository: yashdev9274/supercli
Length of output: 11691
Convert tool schemas before serializing.
apps/supercode-cli/server/src/index.ts#L16-L21:toolParams()returns{ type: "object", properties: {} }for any Zod schema, so tool arguments are stripped.apps/supercode-cli/server/src/cli/ai/concentrate-service.ts#L40-L45: this path still forwardsfn.parametersdirectly and never normalizesfn.inputSchema. Pullfn.inputSchema ?? fn.parametersand convert Zod inputs to JSON Schema (the repo already includeszod-to-json-schema).
📍 Affects 2 files
apps/supercode-cli/server/src/index.ts#L17-L21(this comment)apps/supercode-cli/server/src/cli/ai/concentrate-service.ts#L40-L45
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@apps/supercode-cli/server/src/index.ts` around lines 17 - 21, Update
toolParams() in apps/supercode-cli/server/src/index.ts (lines 17-21) to convert
Zod schemas to JSON Schema with the repository’s zod-to-json-schema dependency
instead of returning an empty object; preserve existing handling for absent or
already-serializable schemas. In
apps/supercode-cli/server/src/cli/ai/concentrate-service.ts (lines 40-45),
normalize the tool schema by selecting fn.inputSchema ?? fn.parameters and
applying the same Zod-to-JSON-Schema conversion before forwarding it.
Description
Type of change
How Has This Been Tested?
Please describe the tests that you ran to verify your changes.
bun testpassesbun run typecheckpassesbun run lintpasses (if applicable)Checklist:
Summary by CodeRabbit
New Features
Bug Fixes
Chores