feat(opencode): expose search filters in OpenCode plugin - #26
Conversation
Adds includeDomains, excludeDomains, category, and date filters to the OpenCode plugin search tool, matching the AI SDK integration.
📝 WalkthroughWalkthroughNew optional search filters added to the websxa tool: includeDomains, excludeDomains, category, startPublishedDate, and endPublishedDate. These consolidate into a searchOptions object passed to both searchAll and provider-specific search methods. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
✨ Simplify code
📝 Coding Plan
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/opencode.ts`:
- Around line 24-25: Validate the startPublishedDate and endPublishedDate
strings before they are forwarded in searchOptions inside the execute function:
ensure each provided value is a valid ISO 8601 date (parseable to a Date) and,
if both are present, ensure startPublishedDate <= endPublishedDate; on
validation failure return a clear error (or reject) instead of calling provider
search methods. Locate the code paths that build searchOptions (references:
execute, searchOptions, startPublishedDate, endPublishedDate) and add input
validation/normalization there so only valid date strings are passed to provider
calls.
🪄 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: ASSERTIVE
Plan: Pro
Run ID: e3dc78bd-0a97-41ec-827e-eb449d631fca
📒 Files selected for processing (1)
src/opencode.ts
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: cubic · AI code reviewer
🧰 Additional context used
📓 Path-based instructions (2)
src/**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
Keep provider names and capability flags as literal unions in TypeScript
Files:
src/opencode.ts
**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
Do not add
as any,@ts-ignore, or placeholder unsafe types
Files:
src/opencode.ts
🧠 Learnings (2)
📚 Learning: 2026-03-10T19:52:07.717Z
Learnt from: aeitwoen
Repo: oritwoen/websxa PR: 5
File: packages/opencode-websxa/package.json:42-44
Timestamp: 2026-03-10T19:52:07.717Z
Learning: In the `oritwoen/websxa` monorepo, `packages/opencode-websxa` is a thin re-export shim (`export { default, WebsxaPlugin } from 'websxa/opencode'`) with no direct `opencode-ai/plugin` API usage. Its wide `>=1.0.0` peerDependency range for `opencode-ai/plugin` is intentional and mirrors the root `websxa` package; API compatibility is the root package's responsibility.
Applied to files:
src/opencode.ts
📚 Learning: 2026-03-17T23:08:03.291Z
Learnt from: oritwoen
Repo: oritwoen/websxa PR: 20
File: test/unit/all.test.ts:345-349
Timestamp: 2026-03-17T23:08:03.291Z
Learning: In the `oritwoen/websxa` repo, `searxng` self-registers on import (via `src/providers/index.ts`), so `detectAvailableProviders()` never returns an empty array in practice during tests. Mocking the provider registry to force an empty result is not worth the ceremony since the `NoProviderConfiguredError` throw is the same codepath as passing an explicit `providers: []`.
Applied to files:
src/opencode.ts
🧬 Code graph analysis (1)
src/opencode.ts (3)
src/core/all.ts (1)
searchAll(29-32)src/index.ts (3)
searchAll(15-15)resolveDefaultProvider(18-18)create(13-13)src/core/resolve.ts (1)
resolveDefaultProvider(28-40)
🔇 Additional comments (2)
src/opencode.ts (2)
21-23: Domain/category filters are threaded correctlyGood change. These new args are exposed and then carried forward through execution, so plugin and SDK behavior stay aligned.
32-32: SharedsearchOptionson both paths is the right shapeGood call using the same options object for
searchAllandcreate(name).search. It avoids branch drift and keeps filter behavior consistent.Also applies to: 36-36
There was a problem hiding this comment.
No issues found across 1 file
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Auto-approved: Adds optional search filter parameters to the OpenCode plugin tool schema to align with core functionality, which is a low-risk feature enhancement.
The AI SDK searchTool got filter support in #23 but the OpenCode plugin was left behind. Both integrations wrap the same core, so there's no reason for the gap.
Adds includeDomains, excludeDomains, category, startPublishedDate, and endPublishedDate to the OpenCode websxa tool args, matching what ai.ts already exposes. The options flow through to providers the same way.