Repository host
repositoryHost() gives an Agent a provider-neutral Repository Host Capability.
Use it when the Agent needs GitHub, GitLab, Bitbucket, or another repository host through a configured client boundary.
Installation
Import the Capability factory from @vite-hub/agent/capabilities and add it to defineAgent({ capabilities }).
Provide a client directly or configure a repository-host primitive.
What it adds
The Capability adds repository_host_read in read mode.
In write mode it also adds repository_host_write for comments and reactions through the configured Repository Host client.
Configuration
import { defineAgent } from '@vite-hub/agent'
import { repositoryHost } from '@vite-hub/agent/capabilities'
export default defineAgent({
driver: { model },
capabilities: [
repositoryHost({
client: githubRepositoryHostClient,
mode: 'read',
provider: 'github',
}),
],
})
Runtime behavior
repository_host_read accepts normalized operations for repositories, Change Requests, Change Request files, issues, comments, checks, and statuses.
Operations that target a single Change Request, issue, comment, check, or status require target.id.
repository_host_write requires write mode and a client with write().
Comment writes require a body; all writes require a target id.
Requirements
When client is omitted, ViteHub requires a configured repository-host primitive.
The client must expose read(), and write mode also requires write() before the write tool can succeed.
Driver support
| Agent Driver | Support |
|---|---|
| Model-backed | Receives repository_host_read, plus repository_host_write in write mode. |
| Harness-backed | Does not receive model-facing Repository Host tools by default. |
| Custom-run-backed | Can use the configured client directly through runtime context if the runner owns that behavior. |
Options
| Option | Type | Default | Description |
|---|---|---|---|
client | RepositoryHostClient | function | primitive | Provider client with read() and optional write(). |
mode | "read" | "write" | "read" | Adds repository_host_write when set to "write". |
policy | AgentToolPolicyDecision | function | "require-approval" | Policy for repository_host_write. |
provider | "github" | "gitlab" | "bitbucket" | string | client provider | Provider metadata for inspection. |
Inspect and verify
Inspect the Agent tool list in DevTools.
Read one repository or Change Request through repository_host_read, then verify write mode requires approval before posting comments or reactions.
Reference
- Custom capabilities
- Agent triggers
- Source:
packages/agent/src/capabilities/repository-host.ts