@tryvira/opencode 0.1.36 → 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 +1 -1
- package/dist/index.js +20 -2
- package/package.json +1 -1
package/README.md
CHANGED
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 =
|
|
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));
|
|
@@ -1873,8 +1883,16 @@ var v1Runtime = (options) => {
|
|
|
1873
1883
|
const actionContexts = /* @__PURE__ */ new Map();
|
|
1874
1884
|
const actionDecisions = /* @__PURE__ */ new Map();
|
|
1875
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
|
+
};
|
|
1876
1894
|
const serverAuthorizeAction = async (proposal) => {
|
|
1877
|
-
const bound =
|
|
1895
|
+
const bound = findActionContext(proposal);
|
|
1878
1896
|
if (!bound) return { decision: "BLOCK", reasonCode: "RUNTIME_ACTION_CONTEXT_UNAVAILABLE" };
|
|
1879
1897
|
if (!Number.isFinite(bound.expiresAt) || Date.now() >= bound.expiresAt) {
|
|
1880
1898
|
actionContexts.delete(contextKey(proposal));
|