@tryvira/opencode 0.1.7 → 0.1.8
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 +2 -1
- package/dist/index.js +3 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
# `@tryvira/opencode` 0.1.
|
|
1
|
+
# `@tryvira/opencode` 0.1.8
|
|
2
2
|
|
|
3
3
|
OpenCode V2 server plugin for Vira host lifecycle governance.
|
|
4
4
|
|
|
5
5
|
It resolves Vira behavior on every `context` hook, observes tool results, and in `enforce` mode blocks tool execution unless a host action authorizer returns an exact Vira `ALLOW` receipt. OpenCode V2 does not expose a supported response-before-display hook, so post-model verification is reported as unsupported rather than claimed as enforced.
|
|
6
6
|
|
|
7
7
|
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_AI_SYSTEM_ID`, `VIRA_CONNECTION_ID`, and `VIRA_HOST_MODE` (`off`, `observe`, `enforce`).
|
|
8
|
+
For an isolated loopback-only test boundary, `VIRA_ALLOW_INSECURE_LOCALHOST=true` may be set; production API URLs must remain HTTPS.
|
|
8
9
|
|
|
9
10
|
`enforce` requires a host-provided `authorizeAction` callback that calls the
|
|
10
11
|
server-owned action authorization boundary and returns the exact Vira
|
package/dist/index.js
CHANGED
|
@@ -1288,7 +1288,8 @@ var v2Plugin = Plugin.define({
|
|
|
1288
1288
|
const apiUrl = options.apiUrl ?? env("VIRA_CONTROL_URL") ?? env("VIRA_API_URL");
|
|
1289
1289
|
const apiKey = options.apiKey ?? env("VIRA_API_KEY");
|
|
1290
1290
|
const scope = { organizationId: required2(options.organizationId ?? env("VIRA_ORGANIZATION_ID"), "VIRA_HOST_ORGANIZATION_REQUIRED"), projectId: required2(options.projectId ?? env("VIRA_PROJECT_ID"), "VIRA_HOST_PROJECT_REQUIRED"), environmentId: required2(options.environmentId ?? env("VIRA_ENVIRONMENT_ID"), "VIRA_HOST_ENVIRONMENT_REQUIRED") };
|
|
1291
|
-
const
|
|
1291
|
+
const allowInsecureLocalhost = options.allowInsecureLocalhost ?? env("VIRA_ALLOW_INSECURE_LOCALHOST") === "true";
|
|
1292
|
+
const client = new ViraClient({ baseUrl: required2(apiUrl, "VIRA_HOST_API_URL_REQUIRED"), apiKey, allowInsecureLocalhost });
|
|
1292
1293
|
const capabilities = { canObserveModel: true, canInjectContext: true, canInterceptToolBefore: true, canInspectToolAfter: true, canPreventSideEffect: mode === "enforce", canInterceptResponseBeforeDisplay: false, ...options.capabilities ?? {} };
|
|
1293
1294
|
const actionContexts = /* @__PURE__ */ new Map();
|
|
1294
1295
|
const actionDecisions = /* @__PURE__ */ new Map();
|
|
@@ -1387,7 +1388,7 @@ var v1Runtime = () => {
|
|
|
1387
1388
|
const mode = env("VIRA_HOST_MODE") ?? "off";
|
|
1388
1389
|
if (mode === "off") return null;
|
|
1389
1390
|
const scope = { organizationId: required2(env("VIRA_ORGANIZATION_ID"), "VIRA_HOST_ORGANIZATION_REQUIRED"), projectId: required2(env("VIRA_PROJECT_ID"), "VIRA_HOST_PROJECT_REQUIRED"), environmentId: required2(env("VIRA_ENVIRONMENT_ID"), "VIRA_HOST_ENVIRONMENT_REQUIRED") };
|
|
1390
|
-
const client = new ViraClient({ baseUrl: required2(env("VIRA_CONTROL_URL") ?? env("VIRA_API_URL"), "VIRA_HOST_API_URL_REQUIRED"), apiKey: env("VIRA_API_KEY") });
|
|
1391
|
+
const client = new ViraClient({ baseUrl: required2(env("VIRA_CONTROL_URL") ?? env("VIRA_API_URL"), "VIRA_HOST_API_URL_REQUIRED"), apiKey: env("VIRA_API_KEY"), allowInsecureLocalhost: env("VIRA_ALLOW_INSECURE_LOCALHOST") === "true" });
|
|
1391
1392
|
return { mode, scope, client, runtime: createViraHostRuntime(client, { mode, connect: { ...scope, name: "OpenCode", systemType: "agent", adapterType: "custom-node", adapterVersion: "1.19.5", idempotencyKey: "opencode:vira:connect" }, capabilities: { canObserveModel: true, canInjectContext: true, canInterceptToolBefore: true, canInspectToolAfter: true, canPreventSideEffect: mode === "enforce", canInterceptResponseBeforeDisplay: false }, authorizeAction: async () => ({ decision: "BLOCK", reasonCode: "VIRA_V1_ACTION_AUTHORIZER_UNAVAILABLE" }) }) };
|
|
1392
1393
|
};
|
|
1393
1394
|
var index_default = { ...v2Plugin, async server() {
|