@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.
Files changed (2) hide show
  1. package/dist/index.js +29 -16
  2. 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 && memDecision.block) {
60
- return {
61
- messages: toolCalls.map(
62
- (toolCall) => new ToolMessage({
63
- tool_call_id: toolCall.id,
64
- content: toolCall.id === tc.id ? `Memory write blocked by Atbash: ${memDecision.blockReason ?? ""}` : "Blocked \u2014 another tool call was blocked by memory safety"
65
- })
66
- ),
67
- atbashVerdict: "BLOCK",
68
- atbashReason: memDecision.blockReason ?? "memory write blocked",
69
- atbashToolCallId: null,
70
- atbashConfidence: null
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 actionText = toolCalls.map((toolCall) => `${toolCall.name}(${JSON.stringify(toolCall.args)})`).join("; ");
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: toolCalls.map((t) => t.name).join(",") || "langgraph_batch",
79
- args: toolCalls,
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") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atbash/atbash-langgraph",
3
- "version": "0.0.11",
3
+ "version": "0.0.12",
4
4
  "description": "Atbash safety guard and audit nodes for LangGraph workflows",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",