@ax0l0tl/agent-governance-opencode 4.0.5 → 4.0.7

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/index.mjs +11 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ax0l0tl/agent-governance-opencode",
3
- "version": "4.0.5",
3
+ "version": "4.0.7",
4
4
  "description": "Public Preview — OpenCode CLI governance plugin for Agent Governance Toolkit developer protection policies",
5
5
  "type": "module",
6
6
  "main": "src/index.mjs",
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,
@@ -87,7 +89,15 @@ export const AgtGovernance = async (ctx) => {
87
89
  prompt,
88
90
  sessionId: event?.properties?.sessionID ?? event?.properties?.sessionId,
89
91
  });
90
- if (result.effect === "deny") {
92
+
93
+ // TEMP: file log to verify event hook fires on user input
94
+ try {
95
+ const entry = `[AGT] ${new Date().toISOString()} sessionId=${event?.properties?.sessionID ?? event?.properties?.sessionId ?? "unknown"} effect=${result.effect} 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
+ }
100
+ if (result.effect === "deny") {
91
101
  throw new Error(result.reason || "AGT governance blocked the submitted prompt.");
92
102
  }
93
103
  },