@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 +1 -1
- package/dist/index.js +9 -1
- package/package.json +1 -1
package/README.md
CHANGED
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 =
|
|
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));
|