burrow-sdk 0.5.0 → 1.0.0
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/README.md +18 -18
- package/dist/integrations/adk.d.ts +18 -47
- package/dist/integrations/adk.d.ts.map +1 -1
- package/dist/integrations/adk.js +19 -81
- package/dist/integrations/adk.js.map +1 -1
- package/dist/integrations/langchain.d.ts +1 -36
- package/dist/integrations/langchain.d.ts.map +1 -1
- package/dist/integrations/langchain.js +2 -71
- package/dist/integrations/langchain.js.map +1 -1
- package/dist/integrations/openai-agents.d.ts +2 -35
- package/dist/integrations/openai-agents.d.ts.map +1 -1
- package/dist/integrations/openai-agents.js +4 -40
- package/dist/integrations/openai-agents.js.map +1 -1
- package/dist/integrations/strands.d.ts +18 -19
- package/dist/integrations/strands.d.ts.map +1 -1
- package/dist/integrations/strands.js +18 -97
- package/dist/integrations/strands.js.map +1 -1
- package/package.json +6 -2
package/README.md
CHANGED
|
@@ -59,7 +59,7 @@ guard.close();
|
|
|
59
59
|
|
|
60
60
|
### Integration Matrix
|
|
61
61
|
|
|
62
|
-
| Framework | Subpath Import |
|
|
62
|
+
| Framework | Subpath Import | Agent Identity | Scan Coverage | Limitations |
|
|
63
63
|
|-----------|---------------|---------------|---------------|-------------|
|
|
64
64
|
| [LangChain.js](https://js.langchain.com/) | `burrow-sdk/integrations/langchain` | `metadata.langgraph_node` | `user_prompt`, `tool_response` | — |
|
|
65
65
|
| [Vercel AI SDK](https://sdk.vercel.ai/) | `burrow-sdk/integrations/ai-sdk` | Static only | `user_prompt`, `tool_response` | Middleware limitation, no tool-level |
|
|
@@ -72,10 +72,10 @@ guard.close();
|
|
|
72
72
|
|
|
73
73
|
```typescript
|
|
74
74
|
import { BurrowGuard } from "burrow-sdk";
|
|
75
|
-
import {
|
|
75
|
+
import { createBurrowCallback } from "burrow-sdk/integrations/langchain";
|
|
76
76
|
|
|
77
77
|
const guard = new BurrowGuard({ clientId: "...", clientSecret: "..." });
|
|
78
|
-
const callback =
|
|
78
|
+
const callback = createBurrowCallback(guard);
|
|
79
79
|
// Automatically reads langgraph_node from metadata
|
|
80
80
|
```
|
|
81
81
|
|
|
@@ -101,14 +101,14 @@ Implements `LanguageModelV3Middleware` with `transformParams` (input scanning) a
|
|
|
101
101
|
|
|
102
102
|
```typescript
|
|
103
103
|
import { BurrowGuard } from "burrow-sdk";
|
|
104
|
-
import {
|
|
104
|
+
import { createBurrowGuardrail, createBurrowOutputGuardrail } from "burrow-sdk/integrations/openai-agents";
|
|
105
105
|
|
|
106
106
|
const guard = new BurrowGuard({ clientId: "...", clientSecret: "..." });
|
|
107
107
|
|
|
108
108
|
const agent = new Agent({
|
|
109
109
|
name: "my-agent",
|
|
110
|
-
inputGuardrails: [
|
|
111
|
-
outputGuardrails: [
|
|
110
|
+
inputGuardrails: [createBurrowGuardrail(guard)],
|
|
111
|
+
outputGuardrails: [createBurrowOutputGuardrail(guard)],
|
|
112
112
|
});
|
|
113
113
|
// Automatically reads agent.name for per-agent identity
|
|
114
114
|
```
|
|
@@ -129,38 +129,38 @@ const options = { hooks }; // Pass to ClaudeAgentOptions
|
|
|
129
129
|
|
|
130
130
|
Intercepts `PreToolUse` (denies blocked tool calls) and `PostToolUse` (flags suspicious tool output) events.
|
|
131
131
|
|
|
132
|
-
### Strands Agents
|
|
132
|
+
### Strands Agents
|
|
133
133
|
|
|
134
134
|
```typescript
|
|
135
135
|
import { BurrowGuard } from "burrow-sdk";
|
|
136
|
-
import {
|
|
136
|
+
import { createBurrowHookProvider } from "burrow-sdk/integrations/strands";
|
|
137
137
|
|
|
138
138
|
const guard = new BurrowGuard({ clientId: "...", clientSecret: "..." });
|
|
139
|
-
const hooks =
|
|
139
|
+
const hooks = createBurrowHookProvider(guard);
|
|
140
140
|
// Automatically reads event.agent.name for per-agent identity
|
|
141
141
|
```
|
|
142
142
|
|
|
143
143
|
Scans user input, tool calls (with `cancel_tool` on block), and tool results. Full per-agent identity via `strands:{name}`.
|
|
144
144
|
|
|
145
|
-
### Google ADK
|
|
145
|
+
### Google ADK
|
|
146
146
|
|
|
147
147
|
```typescript
|
|
148
148
|
import { BurrowGuard } from "burrow-sdk";
|
|
149
149
|
import {
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
150
|
+
createBurrowCallback,
|
|
151
|
+
createBurrowAfterCallback,
|
|
152
|
+
createBurrowToolCallback,
|
|
153
|
+
createBurrowAfterToolCallback,
|
|
154
154
|
} from "burrow-sdk/integrations/adk";
|
|
155
155
|
|
|
156
156
|
const guard = new BurrowGuard({ clientId: "...", clientSecret: "..." });
|
|
157
157
|
|
|
158
158
|
const agent = new Agent({
|
|
159
159
|
model: "gemini-2.0-flash",
|
|
160
|
-
beforeModelCallback:
|
|
161
|
-
afterModelCallback:
|
|
162
|
-
beforeToolCallback:
|
|
163
|
-
afterToolCallback:
|
|
160
|
+
beforeModelCallback: createBurrowCallback(guard),
|
|
161
|
+
afterModelCallback: createBurrowAfterCallback(guard),
|
|
162
|
+
beforeToolCallback: createBurrowToolCallback(guard),
|
|
163
|
+
afterToolCallback: createBurrowAfterToolCallback(guard),
|
|
164
164
|
});
|
|
165
165
|
// Automatically reads callbackContext.agent_name for per-agent identity
|
|
166
166
|
```
|
|
@@ -23,22 +23,22 @@
|
|
|
23
23
|
* });
|
|
24
24
|
* ```
|
|
25
25
|
*
|
|
26
|
-
* Usage (
|
|
26
|
+
* Usage (full coverage):
|
|
27
27
|
*
|
|
28
28
|
* ```ts
|
|
29
29
|
* import {
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
30
|
+
* createBurrowCallback,
|
|
31
|
+
* createBurrowAfterCallback,
|
|
32
|
+
* createBurrowToolCallback,
|
|
33
|
+
* createBurrowAfterToolCallback,
|
|
34
34
|
* } from "burrow-sdk/integrations/adk";
|
|
35
35
|
*
|
|
36
36
|
* const agent = new Agent({
|
|
37
37
|
* model: "gemini-2.0-flash",
|
|
38
|
-
* beforeModelCallback:
|
|
39
|
-
* afterModelCallback:
|
|
40
|
-
* beforeToolCallback:
|
|
41
|
-
* afterToolCallback:
|
|
38
|
+
* beforeModelCallback: createBurrowCallback(guard),
|
|
39
|
+
* afterModelCallback: createBurrowAfterCallback(guard),
|
|
40
|
+
* beforeToolCallback: createBurrowToolCallback(guard),
|
|
41
|
+
* afterToolCallback: createBurrowAfterToolCallback(guard),
|
|
42
42
|
* });
|
|
43
43
|
* ```
|
|
44
44
|
*/
|
|
@@ -59,40 +59,11 @@ interface AdkLlmRequest {
|
|
|
59
59
|
interface AdkLlmResponse {
|
|
60
60
|
content: AdkContent | null;
|
|
61
61
|
}
|
|
62
|
-
/** Options for
|
|
62
|
+
/** Options for callbacks (per-agent identity from callback context). */
|
|
63
63
|
export interface BurrowAdkCallbackOptions {
|
|
64
|
-
/** Agent name for scan context. */
|
|
65
|
-
agentName?: string;
|
|
66
64
|
/** If true, also block on "warn" verdicts. */
|
|
67
65
|
blockOnWarn?: boolean;
|
|
68
66
|
}
|
|
69
|
-
/** Options for V2 callbacks (per-agent identity from callback context). */
|
|
70
|
-
export interface BurrowAdkCallbackV2Options {
|
|
71
|
-
/** If true, also block on "warn" verdicts. */
|
|
72
|
-
blockOnWarn?: boolean;
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* Create a Google ADK `before_model_callback` that scans with Burrow.
|
|
76
|
-
*
|
|
77
|
-
* When injection is detected, returns an `LlmResponse`-shaped object that
|
|
78
|
-
* blocks the original request and informs the user.
|
|
79
|
-
*
|
|
80
|
-
* @param guard - BurrowGuard instance.
|
|
81
|
-
* @param options - Callback options (agentName, blockOnWarn).
|
|
82
|
-
* @returns A callback compatible with ADK's `before_model_callback`.
|
|
83
|
-
*/
|
|
84
|
-
export declare function createBurrowCallback(guard: BurrowGuard, options?: BurrowAdkCallbackOptions): (callbackContext: AdkCallbackContext, llmRequest: AdkLlmRequest) => Promise<AdkLlmResponse | null>;
|
|
85
|
-
/**
|
|
86
|
-
* Create a Google ADK `after_model_callback` that scans LLM responses.
|
|
87
|
-
*
|
|
88
|
-
* Checks if the model's response contains injection-like content
|
|
89
|
-
* that might have been triggered by indirect injection in tool outputs.
|
|
90
|
-
*
|
|
91
|
-
* @param guard - BurrowGuard instance.
|
|
92
|
-
* @param options - Callback options (agentName, blockOnWarn).
|
|
93
|
-
* @returns A callback compatible with ADK's `after_model_callback`.
|
|
94
|
-
*/
|
|
95
|
-
export declare function createBurrowAfterCallback(guard: BurrowGuard, options?: BurrowAdkCallbackOptions): (callbackContext: AdkCallbackContext, llmResponse: AdkLlmResponse) => Promise<AdkLlmResponse | null>;
|
|
96
67
|
/**
|
|
97
68
|
* Create a Google ADK `before_model_callback` with per-agent identity.
|
|
98
69
|
*
|
|
@@ -101,20 +72,20 @@ export declare function createBurrowAfterCallback(guard: BurrowGuard, options?:
|
|
|
101
72
|
* like `adk:research-agent`.
|
|
102
73
|
*
|
|
103
74
|
* @param guard - BurrowGuard instance.
|
|
104
|
-
* @param options -
|
|
75
|
+
* @param options - Callback options (blockOnWarn).
|
|
105
76
|
* @returns A callback compatible with ADK's `before_model_callback`.
|
|
106
77
|
*/
|
|
107
|
-
export declare function
|
|
78
|
+
export declare function createBurrowCallback(guard: BurrowGuard, options?: BurrowAdkCallbackOptions): (callbackContext: AdkCallbackContext, llmRequest: AdkLlmRequest) => Promise<AdkLlmResponse | null>;
|
|
108
79
|
/**
|
|
109
80
|
* Create a Google ADK `after_model_callback` with per-agent identity.
|
|
110
81
|
*
|
|
111
82
|
* Reads the agent name from `callbackContext.agent_name`.
|
|
112
83
|
*
|
|
113
84
|
* @param guard - BurrowGuard instance.
|
|
114
|
-
* @param options -
|
|
85
|
+
* @param options - Callback options (blockOnWarn).
|
|
115
86
|
* @returns A callback compatible with ADK's `after_model_callback`.
|
|
116
87
|
*/
|
|
117
|
-
export declare function
|
|
88
|
+
export declare function createBurrowAfterCallback(guard: BurrowGuard, options?: BurrowAdkCallbackOptions): (callbackContext: AdkCallbackContext, llmResponse: AdkLlmResponse) => Promise<AdkLlmResponse | null>;
|
|
118
89
|
/**
|
|
119
90
|
* Create a Google ADK `before_tool_callback` with per-agent identity.
|
|
120
91
|
*
|
|
@@ -123,11 +94,11 @@ export declare function createBurrowAfterCallbackV2(guard: BurrowGuard, options?
|
|
|
123
94
|
* identity like `adk:research-agent`.
|
|
124
95
|
*
|
|
125
96
|
* @param guard - BurrowGuard instance.
|
|
126
|
-
* @param options -
|
|
97
|
+
* @param options - Callback options (blockOnWarn).
|
|
127
98
|
* @returns A callback compatible with ADK's `before_tool_callback`.
|
|
128
99
|
* Returns a dict to replace the tool result on block, or `null` to allow.
|
|
129
100
|
*/
|
|
130
|
-
export declare function
|
|
101
|
+
export declare function createBurrowToolCallback(guard: BurrowGuard, options?: BurrowAdkCallbackOptions): (callbackContext: AdkCallbackContext, toolName: string, toolArgs: Record<string, unknown>) => Promise<Record<string, unknown> | null>;
|
|
131
102
|
/**
|
|
132
103
|
* Create a Google ADK `after_tool_callback` with per-agent identity.
|
|
133
104
|
*
|
|
@@ -135,10 +106,10 @@ export declare function createBurrowToolCallbackV2(guard: BurrowGuard, options?:
|
|
|
135
106
|
* Reads `callbackContext.agent_name` for per-agent identity.
|
|
136
107
|
*
|
|
137
108
|
* @param guard - BurrowGuard instance.
|
|
138
|
-
* @param options -
|
|
109
|
+
* @param options - Callback options (blockOnWarn).
|
|
139
110
|
* @returns A callback compatible with ADK's `after_tool_callback`.
|
|
140
111
|
* Returns a dict to replace the tool result on block, or `null` to allow.
|
|
141
112
|
*/
|
|
142
|
-
export declare function
|
|
113
|
+
export declare function createBurrowAfterToolCallback(guard: BurrowGuard, options?: BurrowAdkCallbackOptions): (callbackContext: AdkCallbackContext, toolName: string, toolResponse: Record<string, unknown>) => Promise<Record<string, unknown> | null>;
|
|
143
114
|
export {};
|
|
144
115
|
//# sourceMappingURL=adk.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adk.d.ts","sourceRoot":"","sources":["../../src/integrations/adk.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAO/C,UAAU,kBAAkB;IAC1B,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,UAAU,OAAO;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,UAAU,UAAU;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,OAAO,EAAE,CAAC;CAClB;AAED,UAAU,aAAa;IACrB,QAAQ,EAAE,UAAU,EAAE,CAAC;CACxB;AAED,UAAU,cAAc;IACtB,OAAO,EAAE,UAAU,GAAG,IAAI,CAAC;CAC5B;AAMD,
|
|
1
|
+
{"version":3,"file":"adk.d.ts","sourceRoot":"","sources":["../../src/integrations/adk.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAO/C,UAAU,kBAAkB;IAC1B,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,UAAU,OAAO;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,UAAU,UAAU;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,OAAO,EAAE,CAAC;CAClB;AAED,UAAU,aAAa;IACrB,QAAQ,EAAE,UAAU,EAAE,CAAC;CACxB;AAED,UAAU,cAAc;IACtB,OAAO,EAAE,UAAU,GAAG,IAAI,CAAC;CAC5B;AAMD,wEAAwE;AACxE,MAAM,WAAW,wBAAwB;IACvC,8CAA8C;IAC9C,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAkFD;;;;;;;;;;GAUG;AACH,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,WAAW,EAClB,OAAO,GAAE,wBAA6B,GACrC,CAAC,eAAe,EAAE,kBAAkB,EAAE,UAAU,EAAE,aAAa,KAAK,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC,CA8BpG;AAED;;;;;;;;GAQG;AACH,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,WAAW,EAClB,OAAO,GAAE,wBAA6B,GACrC,CAAC,eAAe,EAAE,kBAAkB,EAAE,WAAW,EAAE,cAAc,KAAK,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC,CA6BtG;AAMD;;;;;;;;;;;GAWG;AACH,wBAAgB,wBAAwB,CACtC,KAAK,EAAE,WAAW,EAClB,OAAO,GAAE,wBAA6B,GACrC,CAAC,eAAe,EAAE,kBAAkB,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC,CAwCvI;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,6BAA6B,CAC3C,KAAK,EAAE,WAAW,EAClB,OAAO,GAAE,wBAA6B,GACrC,CAAC,eAAe,EAAE,kBAAkB,EAAE,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC,CAkC3I"}
|
package/dist/integrations/adk.js
CHANGED
|
@@ -23,22 +23,22 @@
|
|
|
23
23
|
* });
|
|
24
24
|
* ```
|
|
25
25
|
*
|
|
26
|
-
* Usage (
|
|
26
|
+
* Usage (full coverage):
|
|
27
27
|
*
|
|
28
28
|
* ```ts
|
|
29
29
|
* import {
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
30
|
+
* createBurrowCallback,
|
|
31
|
+
* createBurrowAfterCallback,
|
|
32
|
+
* createBurrowToolCallback,
|
|
33
|
+
* createBurrowAfterToolCallback,
|
|
34
34
|
* } from "burrow-sdk/integrations/adk";
|
|
35
35
|
*
|
|
36
36
|
* const agent = new Agent({
|
|
37
37
|
* model: "gemini-2.0-flash",
|
|
38
|
-
* beforeModelCallback:
|
|
39
|
-
* afterModelCallback:
|
|
40
|
-
* beforeToolCallback:
|
|
41
|
-
* afterToolCallback:
|
|
38
|
+
* beforeModelCallback: createBurrowCallback(guard),
|
|
39
|
+
* afterModelCallback: createBurrowAfterCallback(guard),
|
|
40
|
+
* beforeToolCallback: createBurrowToolCallback(guard),
|
|
41
|
+
* afterToolCallback: createBurrowAfterToolCallback(guard),
|
|
42
42
|
* });
|
|
43
43
|
* ```
|
|
44
44
|
*/
|
|
@@ -109,69 +109,7 @@ function blockedResponse(message) {
|
|
|
109
109
|
};
|
|
110
110
|
}
|
|
111
111
|
// ---------------------------------------------------------------------------
|
|
112
|
-
//
|
|
113
|
-
// ---------------------------------------------------------------------------
|
|
114
|
-
/**
|
|
115
|
-
* Create a Google ADK `before_model_callback` that scans with Burrow.
|
|
116
|
-
*
|
|
117
|
-
* When injection is detected, returns an `LlmResponse`-shaped object that
|
|
118
|
-
* blocks the original request and informs the user.
|
|
119
|
-
*
|
|
120
|
-
* @param guard - BurrowGuard instance.
|
|
121
|
-
* @param options - Callback options (agentName, blockOnWarn).
|
|
122
|
-
* @returns A callback compatible with ADK's `before_model_callback`.
|
|
123
|
-
*/
|
|
124
|
-
export function createBurrowCallback(guard, options = {}) {
|
|
125
|
-
const agentName = options.agentName ?? "adk";
|
|
126
|
-
const blockOnWarn = options.blockOnWarn ?? false;
|
|
127
|
-
return async (_callbackContext, llmRequest) => {
|
|
128
|
-
const text = extractRequestText(llmRequest);
|
|
129
|
-
if (!text)
|
|
130
|
-
return null;
|
|
131
|
-
const result = await guard.scan(text, {
|
|
132
|
-
contentType: "user_prompt",
|
|
133
|
-
agent: agentName,
|
|
134
|
-
});
|
|
135
|
-
if (shouldBlock(result, blockOnWarn)) {
|
|
136
|
-
return blockedResponse(`[Blocked by Burrow: ${result.category} ` +
|
|
137
|
-
`(${Math.round(result.confidence * 100)}% confidence). ` +
|
|
138
|
-
`This message was flagged as a potential ` +
|
|
139
|
-
`prompt injection and was not processed.]`);
|
|
140
|
-
}
|
|
141
|
-
return null;
|
|
142
|
-
};
|
|
143
|
-
}
|
|
144
|
-
/**
|
|
145
|
-
* Create a Google ADK `after_model_callback` that scans LLM responses.
|
|
146
|
-
*
|
|
147
|
-
* Checks if the model's response contains injection-like content
|
|
148
|
-
* that might have been triggered by indirect injection in tool outputs.
|
|
149
|
-
*
|
|
150
|
-
* @param guard - BurrowGuard instance.
|
|
151
|
-
* @param options - Callback options (agentName, blockOnWarn).
|
|
152
|
-
* @returns A callback compatible with ADK's `after_model_callback`.
|
|
153
|
-
*/
|
|
154
|
-
export function createBurrowAfterCallback(guard, options = {}) {
|
|
155
|
-
const agentName = options.agentName ?? "adk";
|
|
156
|
-
const blockOnWarn = options.blockOnWarn ?? false;
|
|
157
|
-
return async (_callbackContext, llmResponse) => {
|
|
158
|
-
const text = extractResponseText(llmResponse);
|
|
159
|
-
if (!text)
|
|
160
|
-
return null;
|
|
161
|
-
const result = await guard.scan(text, {
|
|
162
|
-
contentType: "tool_response",
|
|
163
|
-
agent: agentName,
|
|
164
|
-
});
|
|
165
|
-
if (shouldBlock(result, blockOnWarn)) {
|
|
166
|
-
return blockedResponse(`[Blocked by Burrow: Model response contained ` +
|
|
167
|
-
`suspected injection content (${result.category}). ` +
|
|
168
|
-
`Response was not delivered.]`);
|
|
169
|
-
}
|
|
170
|
-
return null;
|
|
171
|
-
};
|
|
172
|
-
}
|
|
173
|
-
// ---------------------------------------------------------------------------
|
|
174
|
-
// V2 — model callbacks with per-agent identity from callback context
|
|
112
|
+
// Model callbacks with per-agent identity from callback context
|
|
175
113
|
// ---------------------------------------------------------------------------
|
|
176
114
|
/**
|
|
177
115
|
* Create a Google ADK `before_model_callback` with per-agent identity.
|
|
@@ -181,10 +119,10 @@ export function createBurrowAfterCallback(guard, options = {}) {
|
|
|
181
119
|
* like `adk:research-agent`.
|
|
182
120
|
*
|
|
183
121
|
* @param guard - BurrowGuard instance.
|
|
184
|
-
* @param options -
|
|
122
|
+
* @param options - Callback options (blockOnWarn).
|
|
185
123
|
* @returns A callback compatible with ADK's `before_model_callback`.
|
|
186
124
|
*/
|
|
187
|
-
export function
|
|
125
|
+
export function createBurrowCallback(guard, options = {}) {
|
|
188
126
|
const blockOnWarn = options.blockOnWarn ?? false;
|
|
189
127
|
return async (callbackContext, llmRequest) => {
|
|
190
128
|
const text = extractRequestText(llmRequest);
|
|
@@ -212,10 +150,10 @@ export function createBurrowCallbackV2(guard, options = {}) {
|
|
|
212
150
|
* Reads the agent name from `callbackContext.agent_name`.
|
|
213
151
|
*
|
|
214
152
|
* @param guard - BurrowGuard instance.
|
|
215
|
-
* @param options -
|
|
153
|
+
* @param options - Callback options (blockOnWarn).
|
|
216
154
|
* @returns A callback compatible with ADK's `after_model_callback`.
|
|
217
155
|
*/
|
|
218
|
-
export function
|
|
156
|
+
export function createBurrowAfterCallback(guard, options = {}) {
|
|
219
157
|
const blockOnWarn = options.blockOnWarn ?? false;
|
|
220
158
|
return async (callbackContext, llmResponse) => {
|
|
221
159
|
const text = extractResponseText(llmResponse);
|
|
@@ -237,7 +175,7 @@ export function createBurrowAfterCallbackV2(guard, options = {}) {
|
|
|
237
175
|
};
|
|
238
176
|
}
|
|
239
177
|
// ---------------------------------------------------------------------------
|
|
240
|
-
//
|
|
178
|
+
// Tool callbacks with per-agent identity
|
|
241
179
|
// ---------------------------------------------------------------------------
|
|
242
180
|
/**
|
|
243
181
|
* Create a Google ADK `before_tool_callback` with per-agent identity.
|
|
@@ -247,11 +185,11 @@ export function createBurrowAfterCallbackV2(guard, options = {}) {
|
|
|
247
185
|
* identity like `adk:research-agent`.
|
|
248
186
|
*
|
|
249
187
|
* @param guard - BurrowGuard instance.
|
|
250
|
-
* @param options -
|
|
188
|
+
* @param options - Callback options (blockOnWarn).
|
|
251
189
|
* @returns A callback compatible with ADK's `before_tool_callback`.
|
|
252
190
|
* Returns a dict to replace the tool result on block, or `null` to allow.
|
|
253
191
|
*/
|
|
254
|
-
export function
|
|
192
|
+
export function createBurrowToolCallback(guard, options = {}) {
|
|
255
193
|
const blockOnWarn = options.blockOnWarn ?? false;
|
|
256
194
|
return async (callbackContext, toolName, toolArgs) => {
|
|
257
195
|
let text = "";
|
|
@@ -290,11 +228,11 @@ export function createBurrowToolCallbackV2(guard, options = {}) {
|
|
|
290
228
|
* Reads `callbackContext.agent_name` for per-agent identity.
|
|
291
229
|
*
|
|
292
230
|
* @param guard - BurrowGuard instance.
|
|
293
|
-
* @param options -
|
|
231
|
+
* @param options - Callback options (blockOnWarn).
|
|
294
232
|
* @returns A callback compatible with ADK's `after_tool_callback`.
|
|
295
233
|
* Returns a dict to replace the tool result on block, or `null` to allow.
|
|
296
234
|
*/
|
|
297
|
-
export function
|
|
235
|
+
export function createBurrowAfterToolCallback(guard, options = {}) {
|
|
298
236
|
const blockOnWarn = options.blockOnWarn ?? false;
|
|
299
237
|
return async (callbackContext, toolName, toolResponse) => {
|
|
300
238
|
const raw = toolResponse ? String(toolResponse) : "";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adk.js","sourceRoot":"","sources":["../../src/integrations/adk.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;
|
|
1
|
+
{"version":3,"file":"adk.js","sourceRoot":"","sources":["../../src/integrations/adk.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AAwCH,8EAA8E;AAC9E,UAAU;AACV,8EAA8E;AAE9E,8DAA8D;AAC9D,MAAM,eAAe,GAAG,CAAC,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,SAAS,CAAC,C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32
|
-
/** Agent name for scan context. */
|
|
33
|
-
agent?: string;
|
|
34
|
-
/** If true, also block on "warn" verdicts. */
|
|
35
|
-
blockOnWarn?: boolean;
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Create a LangChain.js callback handler that scans messages with Burrow.
|
|
39
|
-
*
|
|
40
|
-
* Returns an object implementing the BaseCallbackHandler interface from
|
|
41
|
-
* `@langchain/core/callbacks`. Pass it to any LangChain model or chain
|
|
42
|
-
* via the `callbacks` option.
|
|
43
|
-
*
|
|
44
|
-
* The handler is framework-agnostic — it only uses the callback method
|
|
45
|
-
* signatures so you don't need `@langchain/core` installed to import this
|
|
46
|
-
* module. The actual types are resolved at runtime by LangChain.
|
|
47
|
-
*/
|
|
48
|
-
export declare function createBurrowCallback(guard: BurrowGuard, options?: BurrowCallbackOptions): {
|
|
49
|
-
name: string;
|
|
50
|
-
/**
|
|
51
|
-
* Scan prompts before a completion-style LLM call.
|
|
52
|
-
*/
|
|
53
|
-
handleLLMStart(_serialized: Record<string, unknown>, prompts: string[]): Promise<void>;
|
|
54
|
-
/**
|
|
55
|
-
* Scan messages before a chat-style LLM call.
|
|
56
|
-
*/
|
|
57
|
-
handleChatModelStart(_serialized: Record<string, unknown>, messages: Array<Array<{
|
|
58
|
-
content?: string;
|
|
59
|
-
type?: string;
|
|
60
|
-
}>>): Promise<void>;
|
|
61
|
-
/**
|
|
62
|
-
* Scan tool output after execution.
|
|
63
|
-
*/
|
|
64
|
-
handleToolEnd(output: string, kwargs?: Record<string, unknown>): Promise<void>;
|
|
65
|
-
};
|
|
66
|
-
export interface BurrowCallbackV2Options {
|
|
67
32
|
/** Fallback agent name when LangGraph node is unavailable. */
|
|
68
33
|
defaultAgent?: string;
|
|
69
34
|
/** If true, also block on "warn" verdicts. */
|
|
@@ -76,7 +41,7 @@ export interface BurrowCallbackV2Options {
|
|
|
76
41
|
* producing agent names like `langchain:retriever` or `langchain:writer`.
|
|
77
42
|
* Falls back to `defaultAgent` when no node name is available.
|
|
78
43
|
*/
|
|
79
|
-
export declare function
|
|
44
|
+
export declare function createBurrowCallback(guard: BurrowGuard, options?: BurrowCallbackOptions): {
|
|
80
45
|
name: string;
|
|
81
46
|
handleLLMStart(_serialized: Record<string, unknown>, prompts: string[], kwargs?: Record<string, unknown>): Promise<void>;
|
|
82
47
|
handleChatModelStart(_serialized: Record<string, unknown>, messages: Array<Array<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"langchain.d.ts","sourceRoot":"","sources":["../../src/integrations/langchain.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,qDAAqD;AACrD,qBAAa,eAAgB,SAAQ,KAAK;IACxC,SAAgB,MAAM,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,CAAC;gBAErE,MAAM,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE;CAO7E;AAED,MAAM,WAAW,qBAAqB;IACpC,
|
|
1
|
+
{"version":3,"file":"langchain.d.ts","sourceRoot":"","sources":["../../src/integrations/langchain.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,qDAAqD;AACrD,qBAAa,eAAgB,SAAQ,KAAK;IACxC,SAAgB,MAAM,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,CAAC;gBAErE,MAAM,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE;CAO7E;AAED,MAAM,WAAW,qBAAqB;IACpC,8DAA8D;IAC9D,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,8CAA8C;IAC9C,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,WAAW,EAClB,OAAO,GAAE,qBAA0B;;gCAsBlB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,WAC3B,MAAM,EAAE,WACR,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC/B,OAAO,CAAC,IAAI,CAAC;sCAaD,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,YAC1B,KAAK,CAAC,KAAK,CAAC;QAAE,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC,WAClD,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC/B,OAAO,CAAC,IAAI,CAAC;0BAiBY,MAAM,WAAW,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;EAYvF"}
|
|
@@ -23,75 +23,6 @@ export class BurrowScanError extends Error {
|
|
|
23
23
|
this.result = result;
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
|
-
/**
|
|
27
|
-
* Create a LangChain.js callback handler that scans messages with Burrow.
|
|
28
|
-
*
|
|
29
|
-
* Returns an object implementing the BaseCallbackHandler interface from
|
|
30
|
-
* `@langchain/core/callbacks`. Pass it to any LangChain model or chain
|
|
31
|
-
* via the `callbacks` option.
|
|
32
|
-
*
|
|
33
|
-
* The handler is framework-agnostic — it only uses the callback method
|
|
34
|
-
* signatures so you don't need `@langchain/core` installed to import this
|
|
35
|
-
* module. The actual types are resolved at runtime by LangChain.
|
|
36
|
-
*/
|
|
37
|
-
export function createBurrowCallback(guard, options = {}) {
|
|
38
|
-
const agent = options.agent ?? "langchain";
|
|
39
|
-
const blockOnWarn = options.blockOnWarn ?? false;
|
|
40
|
-
function shouldBlock(result) {
|
|
41
|
-
return result.action === "block" || (blockOnWarn && result.action === "warn");
|
|
42
|
-
}
|
|
43
|
-
return {
|
|
44
|
-
name: "burrow_guard",
|
|
45
|
-
/**
|
|
46
|
-
* Scan prompts before a completion-style LLM call.
|
|
47
|
-
*/
|
|
48
|
-
async handleLLMStart(_serialized, prompts) {
|
|
49
|
-
for (const prompt of prompts) {
|
|
50
|
-
if (!prompt.trim())
|
|
51
|
-
continue;
|
|
52
|
-
const result = await guard.scan(prompt, {
|
|
53
|
-
contentType: "user_prompt",
|
|
54
|
-
agent,
|
|
55
|
-
});
|
|
56
|
-
if (shouldBlock(result))
|
|
57
|
-
throw new BurrowScanError(result);
|
|
58
|
-
}
|
|
59
|
-
},
|
|
60
|
-
/**
|
|
61
|
-
* Scan messages before a chat-style LLM call.
|
|
62
|
-
*/
|
|
63
|
-
async handleChatModelStart(_serialized, messages) {
|
|
64
|
-
for (const batch of messages) {
|
|
65
|
-
for (const msg of batch) {
|
|
66
|
-
const content = typeof msg.content === "string" ? msg.content : String(msg.content ?? "");
|
|
67
|
-
if (!content.trim())
|
|
68
|
-
continue;
|
|
69
|
-
const contentType = msg.type === "tool" ? "tool_response" : "user_prompt";
|
|
70
|
-
const result = await guard.scan(content, {
|
|
71
|
-
contentType: contentType,
|
|
72
|
-
agent,
|
|
73
|
-
});
|
|
74
|
-
if (shouldBlock(result))
|
|
75
|
-
throw new BurrowScanError(result);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
},
|
|
79
|
-
/**
|
|
80
|
-
* Scan tool output after execution.
|
|
81
|
-
*/
|
|
82
|
-
async handleToolEnd(output, kwargs) {
|
|
83
|
-
if (typeof output === "string" && output.trim()) {
|
|
84
|
-
const result = await guard.scan(output, {
|
|
85
|
-
contentType: "tool_response",
|
|
86
|
-
agent,
|
|
87
|
-
toolName: kwargs?.name,
|
|
88
|
-
});
|
|
89
|
-
if (shouldBlock(result))
|
|
90
|
-
throw new BurrowScanError(result);
|
|
91
|
-
}
|
|
92
|
-
},
|
|
93
|
-
};
|
|
94
|
-
}
|
|
95
26
|
/**
|
|
96
27
|
* Create a LangChain.js callback handler with per-agent identity.
|
|
97
28
|
*
|
|
@@ -99,7 +30,7 @@ export function createBurrowCallback(guard, options = {}) {
|
|
|
99
30
|
* producing agent names like `langchain:retriever` or `langchain:writer`.
|
|
100
31
|
* Falls back to `defaultAgent` when no node name is available.
|
|
101
32
|
*/
|
|
102
|
-
export function
|
|
33
|
+
export function createBurrowCallback(guard, options = {}) {
|
|
103
34
|
const defaultAgent = options.defaultAgent ?? "langchain";
|
|
104
35
|
const blockOnWarn = options.blockOnWarn ?? false;
|
|
105
36
|
function shouldBlock(result) {
|
|
@@ -114,7 +45,7 @@ export function createBurrowCallbackV2(guard, options = {}) {
|
|
|
114
45
|
return defaultAgent;
|
|
115
46
|
}
|
|
116
47
|
return {
|
|
117
|
-
name: "
|
|
48
|
+
name: "burrow_guard",
|
|
118
49
|
async handleLLMStart(_serialized, prompts, kwargs) {
|
|
119
50
|
const agent = resolveAgent(kwargs);
|
|
120
51
|
for (const prompt of prompts) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"langchain.js","sourceRoot":"","sources":["../../src/integrations/langchain.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAIH,qDAAqD;AACrD,MAAM,OAAO,eAAgB,SAAQ,KAAK;IACxB,MAAM,CAA2D;IAEjF,YAAY,MAAgE;QAC1E,KAAK,CACH,2BAA2B,MAAM,CAAC,QAAQ,KAAK,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,GAAG,GAAG,CAAC,eAAe,CAClG,CAAC;QACF,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;QAC9B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;CACF;AASD
|
|
1
|
+
{"version":3,"file":"langchain.js","sourceRoot":"","sources":["../../src/integrations/lang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CAAC,MAAM,CAAC,CAAC;gBACnC,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE;oBACtC,WAAW,EAAE,eAAe;oBAC5B,KAAK;oBACL,QAAQ,EAAG,MAA8C,EAAE,IAA0B;iBACtF,CAAC,CAAC;gBACH,IAAI,WAAW,CAAC,MAAM,CAAC;oBAAE,MAAM,IAAI,eAAe,CAAC,MAAM,CAAC,CAAC;YAC7D,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -42,39 +42,6 @@ export interface GuardrailFunctionOutput {
|
|
|
42
42
|
tripwireTriggered: boolean;
|
|
43
43
|
}
|
|
44
44
|
export interface BurrowGuardrailOptions {
|
|
45
|
-
/** Agent name for scan context. */
|
|
46
|
-
agentName?: string;
|
|
47
|
-
/** If true, also trigger on "warn" verdicts. */
|
|
48
|
-
blockOnWarn?: boolean;
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Create an OpenAI Agents SDK input guardrail powered by Burrow.
|
|
52
|
-
*
|
|
53
|
-
* The returned object conforms to the `InputGuardrail` interface from
|
|
54
|
-
* `@openai/agents`. It scans the input text and triggers if injection
|
|
55
|
-
* is detected.
|
|
56
|
-
*/
|
|
57
|
-
export declare function createBurrowGuardrail(guard: BurrowGuard, options?: BurrowGuardrailOptions): {
|
|
58
|
-
name: string;
|
|
59
|
-
execute({ input, }: {
|
|
60
|
-
input: unknown;
|
|
61
|
-
context: unknown;
|
|
62
|
-
}): Promise<GuardrailFunctionOutput>;
|
|
63
|
-
};
|
|
64
|
-
/**
|
|
65
|
-
* Create an OpenAI Agents SDK output guardrail powered by Burrow.
|
|
66
|
-
*
|
|
67
|
-
* Scans agent outputs for injection content that may have been
|
|
68
|
-
* triggered by indirect injection in tool results.
|
|
69
|
-
*/
|
|
70
|
-
export declare function createBurrowOutputGuardrail(guard: BurrowGuard, options?: BurrowGuardrailOptions): {
|
|
71
|
-
name: string;
|
|
72
|
-
execute({ agentOutput, }: {
|
|
73
|
-
agentOutput: unknown;
|
|
74
|
-
context: unknown;
|
|
75
|
-
}): Promise<GuardrailFunctionOutput>;
|
|
76
|
-
};
|
|
77
|
-
export interface BurrowGuardrailV2Options {
|
|
78
45
|
/** If true, also trigger on "warn" verdicts. */
|
|
79
46
|
blockOnWarn?: boolean;
|
|
80
47
|
}
|
|
@@ -84,7 +51,7 @@ export interface BurrowGuardrailV2Options {
|
|
|
84
51
|
* Automatically reads `agent.name` from the guardrail context to produce
|
|
85
52
|
* agent names like `openai-agents:research-agent`.
|
|
86
53
|
*/
|
|
87
|
-
export declare function
|
|
54
|
+
export declare function createBurrowGuardrail(guard: BurrowGuard, options?: BurrowGuardrailOptions): {
|
|
88
55
|
name: string;
|
|
89
56
|
execute({ input, agent, }: {
|
|
90
57
|
input: unknown;
|
|
@@ -99,7 +66,7 @@ export declare function createBurrowGuardrailV2(guard: BurrowGuard, options?: Bu
|
|
|
99
66
|
*
|
|
100
67
|
* Automatically reads `agent.name` from the guardrail context.
|
|
101
68
|
*/
|
|
102
|
-
export declare function
|
|
69
|
+
export declare function createBurrowOutputGuardrail(guard: BurrowGuard, options?: BurrowGuardrailOptions): {
|
|
103
70
|
name: string;
|
|
104
71
|
execute({ agentOutput, agent, }: {
|
|
105
72
|
agentOutput: unknown;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openai-agents.d.ts","sourceRoot":"","sources":["../../src/integrations/openai-agents.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,MAAM,WAAW,uBAAuB;IACtC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACpC,iBAAiB,EAAE,OAAO,CAAC;CAC5B;AAED,MAAM,WAAW,sBAAsB;IACrC,
|
|
1
|
+
{"version":3,"file":"openai-agents.d.ts","sourceRoot":"","sources":["../../src/integrations/openai-agents.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,MAAM,WAAW,uBAAuB;IACtC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACpC,iBAAiB,EAAE,OAAO,CAAC;CAC5B;AAED,MAAM,WAAW,sBAAsB;IACrC,gDAAgD;IAChD,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAsCD;;;;;GAKG;AACH,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,WAAW,EAClB,OAAO,GAAE,sBAA2B;;+BAS/B;QACD,KAAK,EAAE,OAAO,CAAC;QACf,KAAK,CAAC,EAAE;YAAE,IAAI,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC;QAC1B,OAAO,EAAE,OAAO,CAAC;KAClB,GAAG,OAAO,CAAC,uBAAuB,CAAC;EAOvC;AAED;;;;GAIG;AACH,wBAAgB,2BAA2B,CACzC,KAAK,EAAE,WAAW,EAClB,OAAO,GAAE,sBAA2B;;qCAS/B;QACD,WAAW,EAAE,OAAO,CAAC;QACrB,KAAK,CAAC,EAAE;YAAE,IAAI,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC;QAC1B,OAAO,EAAE,OAAO,CAAC;KAClB,GAAG,OAAO,CAAC,uBAAuB,CAAC;EAWvC"}
|
|
@@ -62,52 +62,16 @@ async function executeGuardrail(guard, data, contentType, agentName, blockOnWarn
|
|
|
62
62
|
tripwireTriggered: triggered,
|
|
63
63
|
};
|
|
64
64
|
}
|
|
65
|
-
/**
|
|
66
|
-
* Create an OpenAI Agents SDK input guardrail powered by Burrow.
|
|
67
|
-
*
|
|
68
|
-
* The returned object conforms to the `InputGuardrail` interface from
|
|
69
|
-
* `@openai/agents`. It scans the input text and triggers if injection
|
|
70
|
-
* is detected.
|
|
71
|
-
*/
|
|
72
|
-
export function createBurrowGuardrail(guard, options = {}) {
|
|
73
|
-
const agentName = options.agentName ?? "openai-agents";
|
|
74
|
-
const blockOnWarn = options.blockOnWarn ?? false;
|
|
75
|
-
return {
|
|
76
|
-
name: "Burrow Injection Guard",
|
|
77
|
-
async execute({ input, }) {
|
|
78
|
-
return executeGuardrail(guard, input, "user_prompt", agentName, blockOnWarn);
|
|
79
|
-
},
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* Create an OpenAI Agents SDK output guardrail powered by Burrow.
|
|
84
|
-
*
|
|
85
|
-
* Scans agent outputs for injection content that may have been
|
|
86
|
-
* triggered by indirect injection in tool results.
|
|
87
|
-
*/
|
|
88
|
-
export function createBurrowOutputGuardrail(guard, options = {}) {
|
|
89
|
-
const agentName = options.agentName ?? "openai-agents";
|
|
90
|
-
const blockOnWarn = options.blockOnWarn ?? false;
|
|
91
|
-
return {
|
|
92
|
-
name: "Burrow Output Guard",
|
|
93
|
-
async execute({ agentOutput, }) {
|
|
94
|
-
const text = typeof agentOutput === "object" && agentOutput !== null
|
|
95
|
-
? JSON.stringify(agentOutput)
|
|
96
|
-
: String(agentOutput ?? "");
|
|
97
|
-
return executeGuardrail(guard, text, "tool_response", agentName, blockOnWarn);
|
|
98
|
-
},
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
65
|
/**
|
|
102
66
|
* Create an OpenAI Agents SDK input guardrail with per-agent identity.
|
|
103
67
|
*
|
|
104
68
|
* Automatically reads `agent.name` from the guardrail context to produce
|
|
105
69
|
* agent names like `openai-agents:research-agent`.
|
|
106
70
|
*/
|
|
107
|
-
export function
|
|
71
|
+
export function createBurrowGuardrail(guard, options = {}) {
|
|
108
72
|
const blockOnWarn = options.blockOnWarn ?? false;
|
|
109
73
|
return {
|
|
110
|
-
name: "Burrow Injection Guard
|
|
74
|
+
name: "Burrow Injection Guard",
|
|
111
75
|
async execute({ input, agent, }) {
|
|
112
76
|
const agentName = agent?.name
|
|
113
77
|
? `openai-agents:${agent.name}`
|
|
@@ -121,10 +85,10 @@ export function createBurrowGuardrailV2(guard, options = {}) {
|
|
|
121
85
|
*
|
|
122
86
|
* Automatically reads `agent.name` from the guardrail context.
|
|
123
87
|
*/
|
|
124
|
-
export function
|
|
88
|
+
export function createBurrowOutputGuardrail(guard, options = {}) {
|
|
125
89
|
const blockOnWarn = options.blockOnWarn ?? false;
|
|
126
90
|
return {
|
|
127
|
-
name: "Burrow Output Guard
|
|
91
|
+
name: "Burrow Output Guard",
|
|
128
92
|
async execute({ agentOutput, agent, }) {
|
|
129
93
|
const agentName = agent?.name
|
|
130
94
|
? `openai-agents:${agent.name}`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openai-agents.js","sourceRoot":"","sources":["../../src/integrations/openai-agents.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;
|
|
1
|
+
{"version":3,"file":"openai-agents.js","sourceRoot":"","sources":["../../src/integrations/openai-agents.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAcH;;GAEG;AACH,KAAK,UAAU,gBAAgB,CAC7B,KAAkB,EAClB,IAAa,EACb,WAA4C,EAC5C,SAAiB,EACjB,WAAoB;IAEpB,MAAM,IAAI,GAAG,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC;IAClE,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,CAAC;QACjB,OAAO;YACL,UAAU,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE;YAChD,iBAAiB,EAAE,KAAK;SACzB,CAAC;IACJ,CAAC;IAED,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE;QACpC,WAAW;QACX,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CAAC;YACpB,MAAM,IAAI,GACR,OAAO,WAAW,KAAK,QAAQ,IAAI,WAAW,KAAK,IAAI;gBACrD,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC;gBAC7B,CAAC,CAAC,MAAM,CAAC,WAAW,IAAI,EAAE,CAAC,CAAC;YAChC,OAAO,gBAAgB,CAAC,KAAK,EAAE,IAAI,EAAE,eAAe,EAAE,SAAS,EAAE,WAAW,CAAC,CAAC;QAChF,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -5,6 +5,23 @@
|
|
|
5
5
|
* results through Burrow for prompt injection detection using Strands'
|
|
6
6
|
* native hooks system.
|
|
7
7
|
*
|
|
8
|
+
* **User-input scanning limitation:** The Strands `BeforeInvocationEvent`
|
|
9
|
+
* does not expose a cancellation mechanism (unlike
|
|
10
|
+
* `BeforeToolCallEvent.cancel_tool`). This means user-prompt injection is
|
|
11
|
+
* **detected and logged** but cannot be blocked at the invocation level —
|
|
12
|
+
* the agent will still process the message. Tool-level scanning
|
|
13
|
+
* (`BeforeToolCall` / `AfterToolCall`) *does* enforce blocking via
|
|
14
|
+
* `event.cancel_tool`.
|
|
15
|
+
*
|
|
16
|
+
* For full user-input protection, add an input-validation layer before
|
|
17
|
+
* calling the agent:
|
|
18
|
+
*
|
|
19
|
+
* ```ts
|
|
20
|
+
* const result = await guard.scan(userInput, { contentType: "user_prompt" });
|
|
21
|
+
* if (result.action === "block") throw new Error("Blocked by Burrow");
|
|
22
|
+
* agent(userInput);
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
8
25
|
* @example
|
|
9
26
|
* ```ts
|
|
10
27
|
* import { BurrowGuard } from "burrow-sdk";
|
|
@@ -44,27 +61,9 @@ interface HookProvider {
|
|
|
44
61
|
registerHooks(registry: HookRegistry): void;
|
|
45
62
|
}
|
|
46
63
|
export interface BurrowHookProviderOptions {
|
|
47
|
-
/** Static agent name for scan context. Defaults to "strands-agent". */
|
|
48
|
-
agentName?: string;
|
|
49
|
-
/** If true, also block on "warn" verdicts. */
|
|
50
|
-
blockOnWarn?: boolean;
|
|
51
|
-
}
|
|
52
|
-
export interface BurrowHookProviderV2Options {
|
|
53
64
|
/** If true, also block on "warn" verdicts. */
|
|
54
65
|
blockOnWarn?: boolean;
|
|
55
66
|
}
|
|
56
|
-
/**
|
|
57
|
-
* Create a Strands HookProvider that scans through Burrow.
|
|
58
|
-
*
|
|
59
|
-
* Uses a static `agentName` for all scans. The returned object has a
|
|
60
|
-
* `registerHooks(registry)` method that registers callbacks for
|
|
61
|
-
* BeforeInvocation, BeforeToolCall, and AfterToolCall events.
|
|
62
|
-
*
|
|
63
|
-
* @param guard - BurrowGuard instance.
|
|
64
|
-
* @param options - Configuration options.
|
|
65
|
-
* @returns A HookProvider to pass to `Agent({ hooks: [...] })`.
|
|
66
|
-
*/
|
|
67
|
-
export declare function createBurrowHookProvider(guard: BurrowGuard, options?: BurrowHookProviderOptions): HookProvider;
|
|
68
67
|
/**
|
|
69
68
|
* Create a Strands HookProvider with per-agent identity.
|
|
70
69
|
*
|
|
@@ -76,6 +75,6 @@ export declare function createBurrowHookProvider(guard: BurrowGuard, options?: B
|
|
|
76
75
|
* @param options - Configuration options.
|
|
77
76
|
* @returns A HookProvider to pass to `Agent({ hooks: [...] })`.
|
|
78
77
|
*/
|
|
79
|
-
export declare function
|
|
78
|
+
export declare function createBurrowHookProvider(guard: BurrowGuard, options?: BurrowHookProviderOptions): HookProvider;
|
|
80
79
|
export {};
|
|
81
80
|
//# sourceMappingURL=strands.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"strands.d.ts","sourceRoot":"","sources":["../../src/integrations/strands.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"strands.d.ts","sourceRoot":"","sources":["../../src/integrations/strands.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAG/C;;;GAGG;AACH,UAAU,SAAS;IACjB,KAAK,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC1B,QAAQ,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IAC1C,QAAQ,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAA;KAAE,CAAC;IACvE,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,oDAAoD;AACpD,KAAK,YAAY,GAAG,CAAC,KAAK,EAAE,SAAS,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;AAE/D,yDAAyD;AACzD,UAAU,YAAY;IACpB,WAAW,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,YAAY,GAAG,IAAI,CAAC;CAC9D;AAED,yFAAyF;AACzF,UAAU,YAAY;IACpB,aAAa,CAAC,QAAQ,EAAE,YAAY,GAAG,IAAI,CAAC;CAC7C;AAED,MAAM,WAAW,yBAAyB;IACxC,8CAA8C;IAC9C,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AA+DD;;;;;;;;;;GAUG;AACH,wBAAgB,wBAAwB,CACtC,KAAK,EAAE,WAAW,EAClB,OAAO,GAAE,yBAA8B,GACtC,YAAY,CAiHd"}
|
|
@@ -5,6 +5,23 @@
|
|
|
5
5
|
* results through Burrow for prompt injection detection using Strands'
|
|
6
6
|
* native hooks system.
|
|
7
7
|
*
|
|
8
|
+
* **User-input scanning limitation:** The Strands `BeforeInvocationEvent`
|
|
9
|
+
* does not expose a cancellation mechanism (unlike
|
|
10
|
+
* `BeforeToolCallEvent.cancel_tool`). This means user-prompt injection is
|
|
11
|
+
* **detected and logged** but cannot be blocked at the invocation level —
|
|
12
|
+
* the agent will still process the message. Tool-level scanning
|
|
13
|
+
* (`BeforeToolCall` / `AfterToolCall`) *does* enforce blocking via
|
|
14
|
+
* `event.cancel_tool`.
|
|
15
|
+
*
|
|
16
|
+
* For full user-input protection, add an input-validation layer before
|
|
17
|
+
* calling the agent:
|
|
18
|
+
*
|
|
19
|
+
* ```ts
|
|
20
|
+
* const result = await guard.scan(userInput, { contentType: "user_prompt" });
|
|
21
|
+
* if (result.action === "block") throw new Error("Blocked by Burrow");
|
|
22
|
+
* agent(userInput);
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
8
25
|
* @example
|
|
9
26
|
* ```ts
|
|
10
27
|
* import { BurrowGuard } from "burrow-sdk";
|
|
@@ -71,102 +88,6 @@ function buildBlockedMessage(toolName, result) {
|
|
|
71
88
|
`${result.category} (${Math.round(result.confidence * 100)}% confidence). ` +
|
|
72
89
|
`Treat with caution.`);
|
|
73
90
|
}
|
|
74
|
-
/**
|
|
75
|
-
* Create a Strands HookProvider that scans through Burrow.
|
|
76
|
-
*
|
|
77
|
-
* Uses a static `agentName` for all scans. The returned object has a
|
|
78
|
-
* `registerHooks(registry)` method that registers callbacks for
|
|
79
|
-
* BeforeInvocation, BeforeToolCall, and AfterToolCall events.
|
|
80
|
-
*
|
|
81
|
-
* @param guard - BurrowGuard instance.
|
|
82
|
-
* @param options - Configuration options.
|
|
83
|
-
* @returns A HookProvider to pass to `Agent({ hooks: [...] })`.
|
|
84
|
-
*/
|
|
85
|
-
export function createBurrowHookProvider(guard, options = {}) {
|
|
86
|
-
const agentName = options.agentName ?? "strands-agent";
|
|
87
|
-
const blockOnWarn = options.blockOnWarn ?? false;
|
|
88
|
-
return {
|
|
89
|
-
registerHooks(registry) {
|
|
90
|
-
// Scan user input before the agent processes it
|
|
91
|
-
registry.addCallback("BeforeInvocation", async (event) => {
|
|
92
|
-
const messages = event.messages;
|
|
93
|
-
if (!messages || messages.length === 0)
|
|
94
|
-
return;
|
|
95
|
-
const text = extractUserInputText(messages).trim();
|
|
96
|
-
if (!text)
|
|
97
|
-
return;
|
|
98
|
-
const result = await guard.scan(text, {
|
|
99
|
-
contentType: "user_prompt",
|
|
100
|
-
agent: agentName,
|
|
101
|
-
});
|
|
102
|
-
if (shouldBlock(result, blockOnWarn)) {
|
|
103
|
-
console.warn(`[burrow] Blocked user input: ${result.category} (${Math.round(result.confidence * 100)}% confidence)`);
|
|
104
|
-
}
|
|
105
|
-
});
|
|
106
|
-
// Scan tool arguments before execution
|
|
107
|
-
registry.addCallback("BeforeToolCall", async (event) => {
|
|
108
|
-
const toolUse = event.tool_use;
|
|
109
|
-
const toolName = toolUse?.name ?? "unknown";
|
|
110
|
-
const toolInput = toolUse?.input;
|
|
111
|
-
let text = "";
|
|
112
|
-
if (typeof toolInput === "object" && toolInput !== null) {
|
|
113
|
-
text = extractToolInputText(toolInput);
|
|
114
|
-
}
|
|
115
|
-
else if (typeof toolInput === "string") {
|
|
116
|
-
text = toolInput;
|
|
117
|
-
}
|
|
118
|
-
text = text.trim();
|
|
119
|
-
if (!text)
|
|
120
|
-
return;
|
|
121
|
-
const result = await guard.scan(text, {
|
|
122
|
-
contentType: "tool_call",
|
|
123
|
-
agent: agentName,
|
|
124
|
-
toolName,
|
|
125
|
-
});
|
|
126
|
-
if (shouldBlock(result, blockOnWarn)) {
|
|
127
|
-
event.cancel_tool =
|
|
128
|
-
`Blocked by Burrow: ${result.category} ` +
|
|
129
|
-
`(${Math.round(result.confidence * 100)}% confidence). ` +
|
|
130
|
-
`DO NOT retry this tool call.`;
|
|
131
|
-
console.warn(`[burrow] Blocked tool call ${toolName}: ${result.category} (${Math.round(result.confidence * 100)}% confidence)`);
|
|
132
|
-
}
|
|
133
|
-
});
|
|
134
|
-
// Scan tool output for indirect injection
|
|
135
|
-
registry.addCallback("AfterToolCall", async (event) => {
|
|
136
|
-
const resultData = event.result;
|
|
137
|
-
if (resultData == null)
|
|
138
|
-
return;
|
|
139
|
-
const text = String(resultData).slice(0, 4096).trim();
|
|
140
|
-
if (!text)
|
|
141
|
-
return;
|
|
142
|
-
const toolUse = event.tool_use;
|
|
143
|
-
const toolName = toolUse?.name ?? "unknown";
|
|
144
|
-
const scanResult = await guard.scan(text, {
|
|
145
|
-
contentType: "tool_response",
|
|
146
|
-
agent: agentName,
|
|
147
|
-
toolName,
|
|
148
|
-
});
|
|
149
|
-
if (shouldBlock(scanResult, blockOnWarn)) {
|
|
150
|
-
const blockedMsg = buildBlockedMessage(toolName, scanResult);
|
|
151
|
-
if (typeof resultData === "object" &&
|
|
152
|
-
resultData !== null &&
|
|
153
|
-
"toolUseId" in resultData) {
|
|
154
|
-
event.result = {
|
|
155
|
-
toolUseId: resultData.toolUseId,
|
|
156
|
-
status: "error",
|
|
157
|
-
content: [{ text: blockedMsg }],
|
|
158
|
-
};
|
|
159
|
-
}
|
|
160
|
-
else {
|
|
161
|
-
console.warn("[burrow] Blocked tool result is not a dict with toolUseId; replacing with blocked message string.");
|
|
162
|
-
event.result = blockedMsg;
|
|
163
|
-
}
|
|
164
|
-
console.warn(`[burrow] Flagged tool output from ${toolName}: ${scanResult.category} (${Math.round(scanResult.confidence * 100)}% confidence)`);
|
|
165
|
-
}
|
|
166
|
-
});
|
|
167
|
-
},
|
|
168
|
-
};
|
|
169
|
-
}
|
|
170
91
|
/**
|
|
171
92
|
* Create a Strands HookProvider with per-agent identity.
|
|
172
93
|
*
|
|
@@ -178,7 +99,7 @@ export function createBurrowHookProvider(guard, options = {}) {
|
|
|
178
99
|
* @param options - Configuration options.
|
|
179
100
|
* @returns A HookProvider to pass to `Agent({ hooks: [...] })`.
|
|
180
101
|
*/
|
|
181
|
-
export function
|
|
102
|
+
export function createBurrowHookProvider(guard, options = {}) {
|
|
182
103
|
const blockOnWarn = options.blockOnWarn ?? false;
|
|
183
104
|
function resolveAgent(event) {
|
|
184
105
|
const name = event.agent?.name;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"strands.js","sourceRoot":"","sources":["../../src/integrations/strands.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"strands.js","sourceRoot":"","sources":["../../src/integrations/strands.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAmCH;;;GAGG;AACH,SAAS,oBAAoB,CAAC,SAAkC;IAC9D,MAAM,UAAU,GAAG,CAAC,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,SAAS,CAAC,CAAC;IAC1F,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,KAAK,MAAM,GAAG,IAAI,UAAU,EAAE,CAAC;QAC7B,IAAI,GAAG,IAAI,SAAS,IAAI,SAAS,CAAC,GAAG,CAAC,IAAI,IAAI,EAAE,CAAC;YAC/C,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QACrC,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;AAC/E,CAAC;AAED;;;GAGG;AACH,SAAS,oBAAoB,CAAC,QAAwC;IACpE,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAErC,MAAM,OAAO,GAAG,QAAQ,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAC9C,IAAI,CAAC,OAAO;QAAE,OAAO,EAAE,CAAC;IAExB,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;IAChC,IAAI,OAAO,OAAO,KAAK,QAAQ;QAAE,OAAO,OAAO,CAAC;IAEhD,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;QAC3B,MAAM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,CAAC;gBAC/B,MAAM,QAAQ,GAAG,OAAO,EAAE,IAAI,IAAI,SAAS,CAAC;gBAC5C,MAAM,SAAS,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC;gBAEtC,MAAM,UAAU,GAAG,MAAM,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE;oBACxC,WAAW,EAAE,eAAe;oBAC5B,KAAK,EAAE,SAAS;oBAChB,QAAQ;iBACT,CAAC,CAAC;gBAEH,IAAI,WAAW,CAAC,UAAU,EAAE,WAAW,CAAC,EAAE,CAAC;oBACzC,MAAM,UAAU,GAAG,mBAAmB,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;oBAE7D,IACE,OAAO,UAAU,KAAK,QAAQ;wBAC9B,UAAU,KAAK,IAAI;wBACnB,WAAW,IAAI,UAAU,EACzB,CAAC;wBACD,KAAK,CAAC,MAAM,GAAG;4BACb,SAAS,EAAG,UAAsC,CAAC,SAAS;4BAC5D,MAAM,EAAE,OAAO;4BACf,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC;yBAChC,CAAC;oBACJ,CAAC;yBAAM,CAAC;wBACN,OAAO,CAAC,IAAI,CACV,mGAAmG,CACpG,CAAC;wBACF,KAAK,CAAC,MAAM,GAAG,UAAU,CAAC;oBAC5B,CAAC;oBAED,OAAO,CAAC,IAAI,CACV,qCAAqC,QAAQ,eAAe,SAAS,MAAM,UAAU,CAAC,QAAQ,KAAK,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,UAAU,GAAG,GAAG,CAAC,eAAe,CAC1J,CAAC;gBACJ,CAAC;YACH,CAAC,CAAC,CAAC;QACL,CAAC;KACF,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "burrow-sdk",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Runtime security monitoring for AI agents",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
7
7
|
".": {
|
|
@@ -31,6 +31,10 @@
|
|
|
31
31
|
"./integrations/adk": {
|
|
32
32
|
"types": "./dist/integrations/adk.d.ts",
|
|
33
33
|
"import": "./dist/integrations/adk.js"
|
|
34
|
+
},
|
|
35
|
+
"./integrations/mastra": {
|
|
36
|
+
"types": "./dist/integrations/mastra.d.ts",
|
|
37
|
+
"import": "./dist/integrations/mastra.js"
|
|
34
38
|
}
|
|
35
39
|
},
|
|
36
40
|
"main": "dist/index.js",
|