@ax0l0tl/agent-governance-opencode 4.0.5 → 4.0.6
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/package.json +1 -1
- package/src/index.mjs +9 -0
package/package.json
CHANGED
package/src/index.mjs
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
3
|
|
|
4
|
+
import { appendFileSync } from "fs";
|
|
5
|
+
import { dirname, join } from "path";
|
|
4
6
|
import {
|
|
5
7
|
checkArbitraryText,
|
|
6
8
|
evaluateOpenCodePrompt,
|
|
@@ -88,6 +90,13 @@ export const AgtGovernance = async (ctx) => {
|
|
|
88
90
|
sessionId: event?.properties?.sessionID ?? event?.properties?.sessionId,
|
|
89
91
|
});
|
|
90
92
|
if (result.effect === "deny") {
|
|
93
|
+
// TEMP: file log to verify event hook fires on user input
|
|
94
|
+
try {
|
|
95
|
+
const entry = `[AGT DENY] ${new Date().toISOString()} sessionId=${event?.properties?.sessionID ?? event?.properties?.sessionId ?? "unknown"} reason=${result.reason}\n`;
|
|
96
|
+
appendFileSync(join(dirname(state.auditPath), "agt-deny.log"), entry, "utf8");
|
|
97
|
+
} catch {
|
|
98
|
+
// best-effort — do not suppress the deny
|
|
99
|
+
}
|
|
91
100
|
throw new Error(result.reason || "AGT governance blocked the submitted prompt.");
|
|
92
101
|
}
|
|
93
102
|
},
|