Skip to content

feat(opencode): add optional Jev auto-approve backend - #2

Open
BrendanMartin wants to merge 1 commit into
auto-approve-prfrom
auto-approve-jev
Open

BrendanMartin wants to merge 1 commit into
auto-approve-prfrom
auto-approve-jev

Conversation

@BrendanMartin

Copy link
Copy Markdown
Owner

Adds an optional TypeSafe Jev backend on top of anomalyco#39015.

The existing OpenCode classifier remains the default. Setting auto_approve.backend to jev reads the typesafe credential from OpenCode's existing auth store and classifies each consequential action as approve, ask, or deny. Approve runs the action, ask opens the normal prompt, and deny rejects it. Question wording and the probability threshold are configurable; the answer labels stay fixed.

This branch is one commit on that pull request's head, ac6133f633b2b5bed0a9bebf45e21041455fa065.

@BrendanMartin

Copy link
Copy Markdown
Owner Author

I built an optional TypeSafe Jev backend on top of this branch, without changing the default classifier.

It is one commit on ac6133f633b2b5bed0a9bebf45e21041455fa065. Setting auto_approve.backend to jev classifies each consequential action as approve, ask, or deny: approve runs it, ask opens the normal prompt, and deny rejects it.

TypeSafe is not in the built-in provider list, so the key goes through the existing custom-provider login:

  1. Run opencode auth login.
  2. At Select provider, choose Other.
  3. At Enter provider id, enter typesafe. The login warns that this only stores a credential and that the provider still needs configuration in opencode.json.
  4. At Enter your API key, paste the TypeSafe key. The prompt hides the input and writes it to OpenCode's auth store. It does not belong in opencode.json.

Then enable the backend:

{
  "$schema": "https://opencode.ai/config.json",
  "experimental": { "auto_approve": true },
  "auto_approve": {
    "backend": "jev",
    "jev": { "model": "jev-latest" }
  }
}

jev.model is optional and defaults to jev-latest. The question labels stay fixed, but the guidance and acceptance threshold are configurable. Omit any field to keep its built-in wording. min_probability defaults to 0.95.

"jev": {
  "model": "jev-latest",
  "instructions": "Your trusted policy guidance.",
  "criteria": {
    "approve": "When to run it.",
    "ask": "When to prompt.",
    "deny": "When to reject it."
  },
  "min_probability": 0.95
}

Restart OpenCode, then press Tab from Build until Auto-approve is selected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant