@atbash/atbash-langgraph 0.0.5-dev.1 → 0.0.5-dev.2

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.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as _langchain_core_messages from '@langchain/core/messages';
2
2
  import * as _langchain_langgraph from '@langchain/langgraph';
3
3
  import { StateGraph } from '@langchain/langgraph';
4
- import { AtbashClient, AgentAuth, ClientOpts } from '@atbash/sdk';
4
+ import { Atbash, AgentAuth, AtbashOptions } from '@atbash/sdk';
5
5
  import * as _langchain_core_tools from '@langchain/core/tools';
6
6
  import { z } from 'zod';
7
7
 
@@ -15,13 +15,13 @@ declare const AtbashStateAnnotation: _langchain_langgraph.AnnotationRoot<{
15
15
  type AtbashState = typeof AtbashStateAnnotation.State;
16
16
 
17
17
  interface GuardNodeOptions {
18
- client: AtbashClient;
18
+ client: Atbash;
19
19
  }
20
20
  declare function createGuardNode(opts: GuardNodeOptions): (state: AtbashState) => Promise<Partial<AtbashState>>;
21
21
 
22
22
  interface AuditNodeOptions {
23
23
  agent: AgentAuth;
24
- clientOpts?: ClientOpts;
24
+ clientOpts?: AtbashOptions;
25
25
  }
26
26
  declare function createAuditNode(opts: AuditNodeOptions): (state: AtbashState) => Promise<Partial<AtbashState>>;
27
27
 
package/dist/index.js CHANGED
@@ -54,6 +54,26 @@ function createGuardNode(opts) {
54
54
  atbashConfidence: null
55
55
  };
56
56
  }
57
+ if (decision.verdict === "HOLD") {
58
+ const holdParts = [
59
+ "Action held for operator review. The agent will not be jailed \u2014 please approve or reject this request from the Atbash dashboard, then ask the agent to try again.",
60
+ `Reason: ${decision.reason ?? ""}`
61
+ ];
62
+ if (decision.toolCallId) holdParts.push(`Tool Call ID: ${decision.toolCallId}`);
63
+ const holdMessage = holdParts.join("\n");
64
+ return {
65
+ messages: toolCalls.map(
66
+ (toolCall) => new ToolMessage({
67
+ tool_call_id: toolCall.id,
68
+ content: holdMessage
69
+ })
70
+ ),
71
+ atbashVerdict: "HOLD",
72
+ atbashReason: decision.reason ?? "held for review",
73
+ atbashToolCallId: decision.toolCallId,
74
+ atbashConfidence: null
75
+ };
76
+ }
57
77
  return {
58
78
  atbashVerdict: "ALLOW",
59
79
  atbashReason: decision.reason,
@@ -82,7 +102,7 @@ function createGuardNode(opts) {
82
102
  }
83
103
 
84
104
  // src/nodes/auditNode.ts
85
- import { judgeAction } from "@atbash/sdk";
105
+ import { Atbash } from "@atbash/sdk";
86
106
 
87
107
  // src/utils.ts
88
108
  function truncateText(value, max = 500) {
@@ -95,11 +115,10 @@ function createAuditNode(opts) {
95
115
  const lastMessage = state.messages[state.messages.length - 1];
96
116
  const content = typeof lastMessage?.content === "string" ? lastMessage.content : JSON.stringify(lastMessage?.content ?? "");
97
117
  try {
98
- await judgeAction(
118
+ const client = new Atbash(opts.agent.privkey, opts.clientOpts);
119
+ await client.judgeAction(
99
120
  truncateText(content, 500),
100
- "LangGraph tool execution completed",
101
- opts.agent,
102
- opts.clientOpts
121
+ "LangGraph tool execution completed"
103
122
  );
104
123
  } catch {
105
124
  }
@@ -109,7 +128,7 @@ function createAuditNode(opts) {
109
128
 
110
129
  // src/builder.ts
111
130
  import {
112
- createAtbashClient,
131
+ Atbash as Atbash2,
113
132
  loadAgent,
114
133
  setupTelemetry,
115
134
  shutdownTelemetry
@@ -122,10 +141,7 @@ function addAtbashSafety(builder, opts) {
122
141
  const privkey = opts.privkey ?? process.env.ATBASH_AGENT_PRIVKEY;
123
142
  const agent = opts.agent ?? loadAgent(privkey ?? "");
124
143
  const clientOpts = opts.endpoint ? { endpoint: opts.endpoint } : void 0;
125
- const client = createAtbashClient({
126
- keyPair: { privKey: agent.privkey, pubKey: agent.pubkey },
127
- judge: opts.endpoint ? { endpoint: opts.endpoint } : void 0
128
- });
144
+ const client = new Atbash2(agent.privkey, clientOpts);
129
145
  const graph = builder;
130
146
  const toolsNode = opts.toolsNode ?? "tools";
131
147
  const agentNode = opts.agentNode ?? "agent";
@@ -140,23 +156,19 @@ function addAtbashSafety(builder, opts) {
140
156
  }
141
157
 
142
158
  // src/tools/judgeTool.ts
143
- import { judgeAction as judgeAction2 } from "@atbash/sdk";
159
+ import { Atbash as Atbash3 } from "@atbash/sdk";
144
160
  import { tool } from "@langchain/core/tools";
145
161
  import { z } from "zod";
146
162
  function createJudgeTool(agent, endpoint) {
147
163
  return tool(
148
164
  async ({ action, context }) => {
149
- const result = await judgeAction2(
150
- action,
151
- context,
152
- agent,
153
- endpoint ? { endpoint } : void 0
154
- );
165
+ const client = new Atbash3(agent.privkey, endpoint ? { endpoint } : void 0);
166
+ const result = await client.judgeAction(action, context);
155
167
  return JSON.stringify({
156
168
  verdict: result.verdict,
157
169
  reason: result.reason,
158
170
  confidence: result.confidence,
159
- tool_call_id: result.tool_call_id
171
+ tool_call_id: result.toolCallId
160
172
  });
161
173
  },
162
174
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atbash/atbash-langgraph",
3
- "version": "0.0.5-dev.1",
3
+ "version": "0.0.5-dev.2",
4
4
  "description": "Atbash safety guard and audit nodes for LangGraph workflows",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -34,12 +34,10 @@
34
34
  },
35
35
  "scripts": {
36
36
  "build": "tsup src/index.ts --format esm --dts --clean",
37
- "prepublishOnly": "npm run build",
38
- "publish:prod": "npm publish --tag latest --access public",
39
- "publish:dev": "node scripts/publish-dev.mjs"
37
+ "prepublishOnly": "npm run build"
40
38
  },
41
39
  "dependencies": {
42
- "@atbash/sdk": "*",
40
+ "@atbash/sdk": "0.5.3-dev.0",
43
41
  "zod": "^3.25.76"
44
42
  },
45
43
  "peerDependencies": {