@tryvira/opencode 0.1.35 → 0.1.37

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.35
1
+ # `@tryvira/opencode` 0.1.37
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
package/dist/index.js CHANGED
@@ -1659,6 +1659,16 @@ var v2Plugin = Plugin.define({
1659
1659
  const actionDecisions = /* @__PURE__ */ new Map();
1660
1660
  const desktopPermission = createDesktopPermissionBridge();
1661
1661
  const contextKey = (identity) => identity.organizationId + ":" + identity.projectId + ":" + identity.environmentId + ":" + identity.conversationId + ":" + (identity.sessionId ?? identity.conversationId);
1662
+ const findActionContext = (proposal) => {
1663
+ const exact = actionContexts.get(contextKey(proposal));
1664
+ if (exact) return exact;
1665
+ const sessionId = proposal.sessionId ?? proposal.conversationId;
1666
+ for (const bound of actionContexts.values()) {
1667
+ if (bound.sessionId === sessionId && bound.conversationId === proposal.conversationId) return bound;
1668
+ }
1669
+ for (const bound of actionContexts.values()) if (bound.sessionId === sessionId) return bound;
1670
+ return void 0;
1671
+ };
1662
1672
  const callKey = (proposal) => contextKey(proposal) + ":" + proposal.callId;
1663
1673
  const clearSessionState = (event) => {
1664
1674
  const sessionId = text2(event.sessionID ?? event.sessionId);
@@ -1709,7 +1719,7 @@ var v2Plugin = Plugin.define({
1709
1719
  }
1710
1720
  }
1711
1721
  const runtime2 = createViraHostRuntime(client, { mode, capabilities, authorizeAction: options.authorizeAction ?? (async (proposal) => {
1712
- const bound = actionContexts.get(contextKey(proposal));
1722
+ const bound = findActionContext(proposal);
1713
1723
  if (!bound) return { decision: "BLOCK", reasonCode: "RUNTIME_ACTION_CONTEXT_UNAVAILABLE" };
1714
1724
  if (!Number.isFinite(bound.expiresAt) || Date.now() >= bound.expiresAt) {
1715
1725
  actionContexts.delete(contextKey(proposal));
@@ -1983,7 +1993,7 @@ var server = v1Fallback.server;
1983
1993
  var index_default = legacyDefault;
1984
1994
 
1985
1995
  // src/runtime-entry.ts
1986
- var runtime = {
1996
+ var runtime = Object.assign(index_default, {
1987
1997
  id: "vira",
1988
1998
  setup: index_default.setup,
1989
1999
  server: index_default.server,
@@ -1992,7 +2002,7 @@ var runtime = {
1992
2002
  recordModelMetrics,
1993
2003
  recordModelResponse,
1994
2004
  recordUserCorrection
1995
- };
2005
+ });
1996
2006
  var runtime_entry_default = runtime;
1997
2007
  export {
1998
2008
  runtime_entry_default as default
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tryvira/opencode",
3
- "version": "0.1.35",
3
+ "version": "0.1.37",
4
4
  "description": "OpenCode host lifecycle integration for Vira",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",