@tryvira/opencode 0.1.7 → 0.1.9

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,10 +1,13 @@
1
- # `@tryvira/opencode` 0.1.7
1
+ # `@tryvira/opencode` 0.1.9
2
2
 
3
- OpenCode V2 server plugin for Vira host lifecycle governance.
3
+ OpenCode V2 server plugin for Vira host lifecycle governance. The package default
4
+ export is the V2 lifecycle plugin; the legacy V1 surface is exported separately
5
+ as `v1Fallback` and is never merged into the V2 export.
4
6
 
5
7
  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
8
 
7
9
  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`).
10
+ For an isolated loopback-only test boundary, `VIRA_ALLOW_INSECURE_LOCALHOST=true` may be set; production API URLs must remain HTTPS.
8
11
 
9
12
  `enforce` requires a host-provided `authorizeAction` callback that calls the
10
13
  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 client = new ViraClient({ baseUrl: required2(apiUrl, "VIRA_HOST_API_URL_REQUIRED"), apiKey });
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,10 +1388,10 @@ 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
- var index_default = { ...v2Plugin, async server() {
1394
+ var v1Fallback = { async server() {
1394
1395
  const configured = v1Runtime();
1395
1396
  if (!configured) return {};
1396
1397
  const { mode, scope, runtime } = configured;
@@ -1427,7 +1428,9 @@ var index_default = { ...v2Plugin, async server() {
1427
1428
  }
1428
1429
  };
1429
1430
  } };
1431
+ var index_default = v2Plugin;
1430
1432
  export {
1431
1433
  ViraOpenCodeActionError,
1432
- index_default as default
1434
+ index_default as default,
1435
+ v1Fallback
1433
1436
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tryvira/opencode",
3
- "version": "0.1.7",
3
+ "version": "0.1.9",
4
4
  "description": "OpenCode V2 host lifecycle integration for Vira",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",