log-llm-config 1.3.74 → 1.3.75
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.
|
@@ -92,19 +92,29 @@ function autofixDialogLine(v) {
|
|
|
92
92
|
const short = d.length > 160 ? `${d.slice(0, 157)}…` : d;
|
|
93
93
|
return `• [${v.finding_formatted_id}] ${short}`;
|
|
94
94
|
}
|
|
95
|
-
/**
|
|
96
|
-
|
|
95
|
+
/** Policy name(s) for preventive enforcement dialog copy. */
|
|
96
|
+
function uniquePolicyLabelsFromViolations(appliedViolations) {
|
|
97
97
|
const policyNames = [
|
|
98
98
|
...new Set(appliedViolations
|
|
99
99
|
.map((v) => v.policy_name?.trim() || v.finding_title?.trim() || '')
|
|
100
100
|
.filter(Boolean)),
|
|
101
101
|
];
|
|
102
|
-
|
|
102
|
+
return policyNames.length > 0 ? policyNames.join('\n\n') : 'Agent security policy';
|
|
103
|
+
}
|
|
104
|
+
function formatPreventiveAutofixDialog(appliedViolations, applyLine) {
|
|
103
105
|
return ('Optimus Labs enforced a preventive agent security policy as determined by your security team:\n\n' +
|
|
104
|
-
`${
|
|
105
|
-
|
|
106
|
+
`${uniquePolicyLabelsFromViolations(appliedViolations)}\n\n` +
|
|
107
|
+
`${applyLine}\n\n` +
|
|
106
108
|
'Click OK to continue');
|
|
107
109
|
}
|
|
110
|
+
/** Claude dialog after enforced/preventive remediation is applied locally. */
|
|
111
|
+
export function formatClaudeAutofixDialog(appliedViolations) {
|
|
112
|
+
return formatPreventiveAutofixDialog(appliedViolations, 'Claude will now apply this policy to your environment.');
|
|
113
|
+
}
|
|
114
|
+
/** Cursor restart dialog after enforced/preventive remediation is applied locally. */
|
|
115
|
+
export function formatCursorRestartAutofixDialog(appliedViolations) {
|
|
116
|
+
return formatPreventiveAutofixDialog(appliedViolations, 'Cursor will now restart to apply this policy, and your context will be retained.');
|
|
117
|
+
}
|
|
108
118
|
/**
|
|
109
119
|
* Upload a secondary compliance file to the backend so the server can resolve the finding.
|
|
110
120
|
* Fire-and-forget: upload runs in background; any failure is logged but does not block the gate.
|
|
@@ -221,12 +231,13 @@ export async function runCompliancePromptGate() {
|
|
|
221
231
|
hookRunLog('compliance_prompt_gate: Claude — autofix wrote JSON; recheck still flags same UUID(s) — proceeding (immediate apply)');
|
|
222
232
|
}
|
|
223
233
|
if (deferredSqlitePending || recheckOk || claudeRecheckStaleAfterImmediateApply) {
|
|
224
|
-
const violationLabel = fixed === 1 ? 'policy violation' : 'policy violations';
|
|
225
234
|
const autofixMessage = ide === 'cursor' && restartCommands.length > 0
|
|
226
235
|
? formatCursorRestartAutofixDialog(appliedViolations)
|
|
227
|
-
:
|
|
228
|
-
|
|
229
|
-
|
|
236
|
+
: ide === 'claude'
|
|
237
|
+
? formatClaudeAutofixDialog(appliedViolations)
|
|
238
|
+
: `Optimus Labs auto-fixed ${fixed} ${fixed === 1 ? 'policy violation' : 'policy violations'}:\n\n${appliedViolations
|
|
239
|
+
.map((v) => autofixDialogLine(v))
|
|
240
|
+
.join('\n')}`;
|
|
230
241
|
const payload = { __optimus_autofix: true, autofix_message: autofixMessage };
|
|
231
242
|
if (restartCommands.length > 0)
|
|
232
243
|
payload.restart_commands = restartCommands;
|