@tryvira/opencode 0.1.77 → 0.1.78

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # `@tryvira/opencode` 0.1.77
1
+ # `@tryvira/opencode` 0.1.78
2
2
 
3
3
  OpenCode V2 server plugin for Vira host lifecycle governance. The package default
4
4
  exports the V2 setup surface plus a compatibility `server()` transport required
@@ -17,14 +17,15 @@ events must submit output observations through their normal Vira SDK integration
17
17
 
18
18
  Configuration is supplied through OpenCode plugin options or environment variables: `VIRA_CONTROL_URL`, `VIRA_API_KEY`, `VIRA_ORGANIZATION_ID`, `VIRA_PROJECT_ID`, `VIRA_ENVIRONMENT_ID`, `VIRA_ORGANIZATION_UNIT_ID`, `VIRA_AI_SYSTEM_ID`, `VIRA_CONNECTION_ID`, and `VIRA_HOST_MODE` (`off`, `observe`, `enforce`). `VIRA_HOST_TIMEOUT_MS` controls the bounded host lifecycle timeout (default 30 seconds, maximum 120 seconds) and is applied consistently to the SDK HTTP request and semantic/runtime hook. Use it when a provider-backed semantic decision legitimately takes longer than the default; timeouts still fail closed. `adapterVersion` (or `VIRA_ADAPTER_VERSION`) is the stable Vira adapter protocol version and is intentionally separate from the OpenCode application version; leave it at `1` unless the adapter contract changes. V1 `server()` and V2 `setup()` read the same options, so a fixed connection identity is not recreated with a changing host application version.
19
19
 
20
- An embedding host that can construct plugin options programmatically may supply an
21
- `accessTokenProvider` callback. The SDK calls it for each API request and sends
22
- the returned token only as `Authorization: Bearer`; when provided, it takes
23
- precedence over `apiKey`. Keep token refresh, expiry, storage and revocation in
24
- the host's credential manager. This callback cannot be represented in OpenCode's
25
- JSON configuration and does not provide browser OAuth or native OpenCode OAuth
26
- consent by itself. OpenCode OAuth support remains host-acceptance work; the
27
- existing API-key configuration continues to work.
20
+ An embedding host that constructs plugin options programmatically may supply an
21
+ `apiCredentialProvider` callback returning a Vira customer API key. It is called
22
+ for each request and sends the key in `x-vira-api-key`; Vira derives tenant scope
23
+ from its persisted credential record. Supabase/Better Auth OAuth JWTs are not
24
+ Vira credentials and cannot establish tenant membership. The deprecated
25
+ `accessTokenProvider` option is a compatibility alias with the same key-only
26
+ contract. Keep key rotation and storage in the host's credential manager. This
27
+ callback cannot be represented in OpenCode JSON configuration and does not
28
+ provide OAuth consent or tenant provisioning.
28
29
 
29
30
  In `enforce` mode, V2 uses OpenCode's native `permission.evaluate` hook. Effectful tool calls are changed to `ask`; the customer confirms the exact tool in OpenCode's own permission UI, and only a matching native `permission.asked` followed by `permission.replied` with `reply: once` can create a server-owned one-use approval bound to the exact proposal. The host must supply exact tool-call identity and arguments in the permission metadata; without those or the event stream, approval-required actions remain blocked. An ask, saved/always permission, rejection, mismatched arguments or missing reply is not confirmation. JSON options cannot contain a confirmation callback or a `confirmed` flag. `permissionMode:"deny"` disables the native bridge and therefore fails closed. A denial, expiry, changed argument set, or replay remains blocked. The optional `confirmAction` is retained only as a programmatic embedding seam for tests/host adapters; it is not a JSON-configured approval mechanism. V1 hosts without the native permission hook remain fail-closed for approval-required actions.
30
31
  For an isolated loopback-only test boundary, `VIRA_ALLOW_INSECURE_LOCALHOST=true` may be set; production API URLs must remain HTTPS.