@ax0l0tl/agent-governance-opencode 4.0.2 → 4.0.3

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 +6 -9
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ax0l0tl/agent-governance-opencode",
3
- "version": "4.0.2",
3
+ "version": "4.0.3",
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,9 @@
1
1
  // Copyright (c) Microsoft Corporation.
2
2
  // Licensed under the MIT License.
3
3
 
4
+ import { appendFileSync } from "node:fs";
5
+ import { homedir } from "node:os";
6
+ import { join } from "node:path";
4
7
  import { tool } from "@opencode-ai/plugin";
5
8
  import {
6
9
  checkArbitraryText,
@@ -81,15 +84,9 @@ export const AgtGovernance = async (ctx) => {
81
84
  const prompt = extractPromptFromEvent(event);
82
85
  // TODO(temporary): remove after verifying which event types reach this hook.
83
86
  try {
84
- if (typeof ctx?.client?.app?.log === "function") {
85
- await ctx.client.app.log({
86
- body: {
87
- service: "agt-governance",
88
- level: "info",
89
- message: `[AGT] event type=${event?.type ?? "unknown"} covered=${Boolean(prompt)}`,
90
- },
91
- });
92
- }
87
+ const logPath = join(homedir(), ".config", "opencode", "agt", "event-debug.ndjson");
88
+ const entry = JSON.stringify({ ts: new Date().toISOString(), type: event?.type ?? null, covered: Boolean(prompt), event }) + "\n";
89
+ appendFileSync(logPath, entry, "utf8");
93
90
  } catch { /* best-effort */ }
94
91
  if (!prompt) {
95
92
  return;