@tryvira/opencode 0.1.37 → 0.1.38

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.37
1
+ # `@tryvira/opencode` 0.1.38
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
@@ -1883,8 +1883,16 @@ var v1Runtime = (options) => {
1883
1883
  const actionContexts = /* @__PURE__ */ new Map();
1884
1884
  const actionDecisions = /* @__PURE__ */ new Map();
1885
1885
  const contextKey = (identity) => identity.organizationId + ":" + identity.projectId + ":" + identity.environmentId + ":" + identity.conversationId + ":" + (identity.sessionId ?? identity.conversationId);
1886
+ const findActionContext = (proposal) => {
1887
+ const exact = actionContexts.get(contextKey(proposal));
1888
+ if (exact) return exact;
1889
+ const sessionId = proposal.sessionId ?? proposal.conversationId;
1890
+ for (const bound of actionContexts.values()) if (bound.sessionId === sessionId && bound.conversationId === proposal.conversationId) return bound;
1891
+ for (const bound of actionContexts.values()) if (bound.sessionId === sessionId) return bound;
1892
+ return void 0;
1893
+ };
1886
1894
  const serverAuthorizeAction = async (proposal) => {
1887
- const bound = actionContexts.get(contextKey(proposal));
1895
+ const bound = findActionContext(proposal);
1888
1896
  if (!bound) return { decision: "BLOCK", reasonCode: "RUNTIME_ACTION_CONTEXT_UNAVAILABLE" };
1889
1897
  if (!Number.isFinite(bound.expiresAt) || Date.now() >= bound.expiresAt) {
1890
1898
  actionContexts.delete(contextKey(proposal));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tryvira/opencode",
3
- "version": "0.1.37",
3
+ "version": "0.1.38",
4
4
  "description": "OpenCode host lifecycle integration for Vira",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",