@grwnd/pi-governance 3.0.0 → 3.0.1
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/LICENSE +1 -1
- package/README.md +11 -11
- package/dist/extensions/index.cjs +7 -4
- package/dist/extensions/index.cjs.map +1 -1
- package/dist/extensions/index.js +7 -4
- package/dist/extensions/index.js.map +1 -1
- package/package.json +3 -3
package/dist/extensions/index.js
CHANGED
|
@@ -3103,6 +3103,7 @@ var piGovernance = (pi) => {
|
|
|
3103
3103
|
);
|
|
3104
3104
|
});
|
|
3105
3105
|
pi.on("tool_call", async (event, _ctx) => {
|
|
3106
|
+
if (!audit || !policyEngine || !identity) return void 0;
|
|
3106
3107
|
const { toolName, input } = event;
|
|
3107
3108
|
const params = summarizeParams(toolName, input);
|
|
3108
3109
|
const baseRecord = {
|
|
@@ -3319,6 +3320,7 @@ var piGovernance = (pi) => {
|
|
|
3319
3320
|
return void 0;
|
|
3320
3321
|
});
|
|
3321
3322
|
pi.on("tool_result", async (event, _ctx) => {
|
|
3323
|
+
if (!audit || !identity) return;
|
|
3322
3324
|
if (dlpScanner && dlpMasker && event.output) {
|
|
3323
3325
|
const result = dlpScanner.scan(event.output);
|
|
3324
3326
|
if (result.hasMatches) {
|
|
@@ -3370,15 +3372,16 @@ var piGovernance = (pi) => {
|
|
|
3370
3372
|
});
|
|
3371
3373
|
pi.on("session_shutdown", async (_event, _ctx) => {
|
|
3372
3374
|
configWatcher?.stop();
|
|
3375
|
+
if (!audit) return;
|
|
3373
3376
|
await audit.log({
|
|
3374
3377
|
sessionId,
|
|
3375
3378
|
event: "session_end",
|
|
3376
|
-
userId: identity
|
|
3377
|
-
role: identity
|
|
3378
|
-
orgUnit: identity
|
|
3379
|
+
userId: identity?.userId,
|
|
3380
|
+
role: identity?.role,
|
|
3381
|
+
orgUnit: identity?.orgUnit,
|
|
3379
3382
|
metadata: {
|
|
3380
3383
|
stats: { ...stats },
|
|
3381
|
-
budget: { used: budgetTracker.used(), remaining: budgetTracker.remaining() },
|
|
3384
|
+
budget: budgetTracker ? { used: budgetTracker.used(), remaining: budgetTracker.remaining() } : void 0,
|
|
3382
3385
|
summary: Object.fromEntries(audit.getSummary())
|
|
3383
3386
|
}
|
|
3384
3387
|
});
|