mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-10 12:37:55 +01:00
Reject an explicitly negated acknowledgment action itself
Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
1 parent
de6b8c0dc3
commit
96e220a9ac
2 files changed
+3
-1
No files matched your search
@@ -80,6 +80,8 @@ it("keeps unrelated safety warnings outside save and acknowledgment negation",()
|
||||
])expect(companySecretConfirmationHandoff({...card(),payload:{...card().payload,prompt:context+text}},binding,guidance),text).toBeDefined();
|
||||
for(const text of [
|
||||
"Save the deployment key there. Do not confirm yet. Then accept this card.",
|
||||
"Save the deployment key there. Do not accept this card.",
|
||||
"Save the deployment key there. Never confirm here.",
|
||||
"After saving your profile, confirm here that secure entry is complete.",
|
||||
"Never save the deployment key there. Then accept this card.",
|
||||
])expect(companySecretConfirmationHandoff({...card(),payload:{...card().payload,prompt:context+text}},binding,guidance),text).toBeUndefined();
|
||||
|
||||
@@ -24,7 +24,7 @@ function orderedSecureSaveAcknowledgment(prompt:string){
|
||||
const after=prompt.slice(clause.index!+save.index+save[0].length);
|
||||
for(const acknowledgment of after.matchAll(/\b(?:accept|confirm)\b[^.!?;\n]*/gi)){
|
||||
const between=after.slice(0,acknowledgment.index),intent=acknowledgment[0];
|
||||
if(/\b(?:(?:do not|don.t|never)\s+(?:save|enter|set|accept|confirm)|(?:cancel|decline|skip|avoid)(?:\s+(?:the|to))?\s+(?:save|saving|entry|acknowledgment|confirmation|accept|confirm))\b/i.test(between)||/\b(?:before|permission|authorize|another|other card)\b/i.test(intent))continue;
|
||||
if(/(?:\b(?:do|should|must)\s+not|\bdon.t|\bnever|\b(?:cancel|decline|skip|avoid)(?:\s+to)?)\s*$/i.test(between.trim())||/\b(?:(?:do not|don.t|never)\s+(?:save|enter|set|accept|confirm)|(?:cancel|decline|skip|avoid)(?:\s+(?:the|to))?\s+(?:save|saving|entry|acknowledgment|confirmation|accept|confirm))\b/i.test(between)||/\b(?:before|permission|authorize|another|other card)\b/i.test(intent))continue;
|
||||
if(/^(?:accept|confirm)\s+(?:this\s+card|here\b|(?:that\s+)?(?:the\s+)?(?:deployment\s+(?:api\s+)?key|secure entry)\b[^.!?;\n]{0,80}\b(?:saved|complete))/i.test(intent))return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user