@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.
- package/package.json +1 -1
- package/src/index.mjs +6 -9
package/package.json
CHANGED
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
|
-
|
|
85
|
-
|
|
86
|
-
|
|
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;
|