@atbash/atbash-langgraph 0.0.11 → 0.0.12
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/dist/index.js +29 -16
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -33,6 +33,7 @@ function createGuardNode(opts) {
|
|
|
33
33
|
atbashReason: "No tool calls detected"
|
|
34
34
|
};
|
|
35
35
|
}
|
|
36
|
+
const memoryHandledIds = /* @__PURE__ */ new Set();
|
|
36
37
|
if (opts.guardManager) {
|
|
37
38
|
for (const tc of toolCalls) {
|
|
38
39
|
let memDecision;
|
|
@@ -56,27 +57,39 @@ function createGuardNode(opts) {
|
|
|
56
57
|
atbashConfidence: null
|
|
57
58
|
};
|
|
58
59
|
}
|
|
59
|
-
if (memDecision !== null
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
60
|
+
if (memDecision !== null) {
|
|
61
|
+
if (memDecision.block) {
|
|
62
|
+
return {
|
|
63
|
+
messages: toolCalls.map(
|
|
64
|
+
(toolCall) => new ToolMessage({
|
|
65
|
+
tool_call_id: toolCall.id,
|
|
66
|
+
content: toolCall.id === tc.id ? `Memory write blocked by Atbash: ${memDecision.blockReason ?? ""}` : "Blocked \u2014 another tool call was blocked by memory safety"
|
|
67
|
+
})
|
|
68
|
+
),
|
|
69
|
+
atbashVerdict: "BLOCK",
|
|
70
|
+
atbashReason: memDecision.blockReason ?? "memory write blocked",
|
|
71
|
+
atbashToolCallId: null,
|
|
72
|
+
atbashConfidence: null
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
memoryHandledIds.add(tc.id);
|
|
72
76
|
}
|
|
73
77
|
}
|
|
74
78
|
}
|
|
75
|
-
const
|
|
79
|
+
const auditCalls = toolCalls.filter((tc) => !memoryHandledIds.has(tc.id));
|
|
80
|
+
if (auditCalls.length === 0) {
|
|
81
|
+
return {
|
|
82
|
+
atbashVerdict: "ALLOW",
|
|
83
|
+
atbashReason: "Memory operations validated by guard",
|
|
84
|
+
atbashToolCallId: null,
|
|
85
|
+
atbashConfidence: null
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
const actionText = auditCalls.map((toolCall) => `${toolCall.name}(${JSON.stringify(toolCall.args)})`).join("; ");
|
|
76
89
|
try {
|
|
77
90
|
const decision = await opts.client.auditToolCall({
|
|
78
|
-
toolName:
|
|
79
|
-
args:
|
|
91
|
+
toolName: auditCalls.map((t) => t.name).join(",") || "langgraph_batch",
|
|
92
|
+
args: auditCalls,
|
|
80
93
|
context: `LangGraph agent attempting: ${actionText}`
|
|
81
94
|
});
|
|
82
95
|
if (decision.verdict === "BLOCK" || decision.verdict === "ERROR") {
|