burrow-sdk 0.5.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.
Files changed (38) hide show
  1. package/README.md +176 -0
  2. package/dist/errors.d.ts +12 -0
  3. package/dist/errors.d.ts.map +1 -0
  4. package/dist/errors.js +21 -0
  5. package/dist/errors.js.map +1 -0
  6. package/dist/index.d.ts +19 -0
  7. package/dist/index.d.ts.map +1 -0
  8. package/dist/index.js +102 -0
  9. package/dist/index.js.map +1 -0
  10. package/dist/integrations/adk.d.ts +144 -0
  11. package/dist/integrations/adk.d.ts.map +1 -0
  12. package/dist/integrations/adk.js +323 -0
  13. package/dist/integrations/adk.js.map +1 -0
  14. package/dist/integrations/ai-sdk.d.ts +71 -0
  15. package/dist/integrations/ai-sdk.d.ts.map +1 -0
  16. package/dist/integrations/ai-sdk.js +115 -0
  17. package/dist/integrations/ai-sdk.js.map +1 -0
  18. package/dist/integrations/claude-sdk.d.ts +75 -0
  19. package/dist/integrations/claude-sdk.d.ts.map +1 -0
  20. package/dist/integrations/claude-sdk.js +127 -0
  21. package/dist/integrations/claude-sdk.js.map +1 -0
  22. package/dist/integrations/langchain.d.ts +88 -0
  23. package/dist/integrations/langchain.d.ts.map +1 -0
  24. package/dist/integrations/langchain.js +162 -0
  25. package/dist/integrations/langchain.js.map +1 -0
  26. package/dist/integrations/openai-agents.d.ts +112 -0
  27. package/dist/integrations/openai-agents.d.ts.map +1 -0
  28. package/dist/integrations/openai-agents.js +139 -0
  29. package/dist/integrations/openai-agents.js.map +1 -0
  30. package/dist/integrations/strands.d.ts +81 -0
  31. package/dist/integrations/strands.d.ts.map +1 -0
  32. package/dist/integrations/strands.js +274 -0
  33. package/dist/integrations/strands.js.map +1 -0
  34. package/dist/types.d.ts +30 -0
  35. package/dist/types.d.ts.map +1 -0
  36. package/dist/types.js +7 -0
  37. package/dist/types.js.map +1 -0
  38. package/package.json +66 -0
@@ -0,0 +1,81 @@
1
+ /**
2
+ * Burrow adapter for the Strands Agents framework (TypeScript).
3
+ *
4
+ * Provides HookProvider objects that scan user input, tool calls, and tool
5
+ * results through Burrow for prompt injection detection using Strands'
6
+ * native hooks system.
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * import { BurrowGuard } from "burrow-sdk";
11
+ * import { createBurrowHookProvider } from "burrow-sdk/integrations/strands";
12
+ *
13
+ * const guard = new BurrowGuard({ clientId: "...", clientSecret: "..." });
14
+ * const burrowHooks = createBurrowHookProvider(guard);
15
+ *
16
+ * const agent = new Agent({ model, tools: [...], hooks: [burrowHooks] });
17
+ * ```
18
+ */
19
+ import type { BurrowGuard } from "../index.js";
20
+ /**
21
+ * Strands hook event shape, defined locally to avoid requiring
22
+ * `@strands-agents/sdk-typescript` as a dependency.
23
+ */
24
+ interface HookEvent {
25
+ agent?: {
26
+ name?: string;
27
+ };
28
+ messages?: Array<Record<string, unknown>>;
29
+ tool_use?: {
30
+ name?: string;
31
+ input?: Record<string, unknown> | string;
32
+ };
33
+ result?: unknown;
34
+ cancel_tool?: string;
35
+ }
36
+ /** Callback registered on a specific event type. */
37
+ type HookCallback = (event: HookEvent) => Promise<void> | void;
38
+ /** Registry for adding hook callbacks to event types. */
39
+ interface HookRegistry {
40
+ addCallback(eventType: string, callback: HookCallback): void;
41
+ }
42
+ /** Object returned by factory functions, matching the Strands HookProvider interface. */
43
+ interface HookProvider {
44
+ registerHooks(registry: HookRegistry): void;
45
+ }
46
+ 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
+ /** If true, also block on "warn" verdicts. */
54
+ blockOnWarn?: boolean;
55
+ }
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
+ /**
69
+ * Create a Strands HookProvider with per-agent identity.
70
+ *
71
+ * Reads `event.agent.name` from hook events to produce agent identifiers
72
+ * like `strands:research-agent`. Falls back to `strands` when no agent
73
+ * name is available.
74
+ *
75
+ * @param guard - BurrowGuard instance.
76
+ * @param options - Configuration options.
77
+ * @returns A HookProvider to pass to `Agent({ hooks: [...] })`.
78
+ */
79
+ export declare function createBurrowHookProviderV2(guard: BurrowGuard, options?: BurrowHookProviderV2Options): HookProvider;
80
+ export {};
81
+ //# sourceMappingURL=strands.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"strands.d.ts","sourceRoot":"","sources":["../../src/integrations/strands.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;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,uEAAuE;IACvE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,8CAA8C;IAC9C,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,MAAM,WAAW,2BAA2B;IAC1C,8CAA8C;IAC9C,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AA+DD;;;;;;;;;;GAUG;AACH,wBAAgB,wBAAwB,CACtC,KAAK,EAAE,WAAW,EAClB,OAAO,GAAE,yBAA8B,GACtC,YAAY,CAuGd;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,WAAW,EAClB,OAAO,GAAE,2BAAgC,GACxC,YAAY,CAiHd"}
@@ -0,0 +1,274 @@
1
+ /**
2
+ * Burrow adapter for the Strands Agents framework (TypeScript).
3
+ *
4
+ * Provides HookProvider objects that scan user input, tool calls, and tool
5
+ * results through Burrow for prompt injection detection using Strands'
6
+ * native hooks system.
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * import { BurrowGuard } from "burrow-sdk";
11
+ * import { createBurrowHookProvider } from "burrow-sdk/integrations/strands";
12
+ *
13
+ * const guard = new BurrowGuard({ clientId: "...", clientSecret: "..." });
14
+ * const burrowHooks = createBurrowHookProvider(guard);
15
+ *
16
+ * const agent = new Agent({ model, tools: [...], hooks: [burrowHooks] });
17
+ * ```
18
+ */
19
+ /**
20
+ * Extract scannable text from tool input arguments.
21
+ * Prioritizes known text-bearing fields, falls back to JSON serialization.
22
+ */
23
+ function extractToolInputText(toolInput) {
24
+ const textFields = ["command", "content", "query", "text", "url", "file_path", "pattern"];
25
+ const parts = [];
26
+ for (const key of textFields) {
27
+ if (key in toolInput && toolInput[key] != null) {
28
+ parts.push(String(toolInput[key]));
29
+ }
30
+ }
31
+ return parts.length > 0 ? parts.join(" ").trim() : JSON.stringify(toolInput);
32
+ }
33
+ /**
34
+ * Extract user-facing text from the last message in the conversation.
35
+ * Handles both string content and content arrays with text parts.
36
+ */
37
+ function extractUserInputText(messages) {
38
+ if (messages.length === 0)
39
+ return "";
40
+ const lastMsg = messages[messages.length - 1];
41
+ if (!lastMsg)
42
+ return "";
43
+ const content = lastMsg.content;
44
+ if (typeof content === "string")
45
+ return content;
46
+ if (Array.isArray(content)) {
47
+ const parts = [];
48
+ for (const part of content) {
49
+ if (typeof part === "object" && part !== null && "text" in part) {
50
+ parts.push(String(part.text));
51
+ }
52
+ else if (typeof part === "string") {
53
+ parts.push(part);
54
+ }
55
+ }
56
+ return parts.join(" ");
57
+ }
58
+ return "";
59
+ }
60
+ /**
61
+ * Determine whether a scan result should trigger a block.
62
+ */
63
+ function shouldBlock(result, blockOnWarn) {
64
+ return result.action === "block" || (blockOnWarn && result.action === "warn");
65
+ }
66
+ /**
67
+ * Build the blocked-message string used when tool output is flagged.
68
+ */
69
+ function buildBlockedMessage(toolName, result) {
70
+ return (`[BLOCKED by Burrow] Tool output from '${toolName}' was flagged: ` +
71
+ `${result.category} (${Math.round(result.confidence * 100)}% confidence). ` +
72
+ `Treat with caution.`);
73
+ }
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
+ /**
171
+ * Create a Strands HookProvider with per-agent identity.
172
+ *
173
+ * Reads `event.agent.name` from hook events to produce agent identifiers
174
+ * like `strands:research-agent`. Falls back to `strands` when no agent
175
+ * name is available.
176
+ *
177
+ * @param guard - BurrowGuard instance.
178
+ * @param options - Configuration options.
179
+ * @returns A HookProvider to pass to `Agent({ hooks: [...] })`.
180
+ */
181
+ export function createBurrowHookProviderV2(guard, options = {}) {
182
+ const blockOnWarn = options.blockOnWarn ?? false;
183
+ function resolveAgent(event) {
184
+ const name = event.agent?.name;
185
+ if (name)
186
+ return `strands:${name}`;
187
+ return "strands";
188
+ }
189
+ return {
190
+ registerHooks(registry) {
191
+ // Scan user input before the agent processes it
192
+ registry.addCallback("BeforeInvocation", async (event) => {
193
+ const messages = event.messages;
194
+ if (!messages || messages.length === 0)
195
+ return;
196
+ const text = extractUserInputText(messages).trim();
197
+ if (!text)
198
+ return;
199
+ const agentName = resolveAgent(event);
200
+ const result = await guard.scan(text, {
201
+ contentType: "user_prompt",
202
+ agent: agentName,
203
+ });
204
+ if (shouldBlock(result, blockOnWarn)) {
205
+ console.warn(`[burrow] Blocked user input for agent '${agentName}': ${result.category} (${Math.round(result.confidence * 100)}% confidence)`);
206
+ }
207
+ });
208
+ // Scan tool arguments before execution
209
+ registry.addCallback("BeforeToolCall", async (event) => {
210
+ const toolUse = event.tool_use;
211
+ const toolName = toolUse?.name ?? "unknown";
212
+ const toolInput = toolUse?.input;
213
+ let text = "";
214
+ if (typeof toolInput === "object" && toolInput !== null) {
215
+ text = extractToolInputText(toolInput);
216
+ }
217
+ else if (typeof toolInput === "string") {
218
+ text = toolInput;
219
+ }
220
+ text = text.trim();
221
+ if (!text)
222
+ return;
223
+ const agentName = resolveAgent(event);
224
+ const result = await guard.scan(text, {
225
+ contentType: "tool_call",
226
+ agent: agentName,
227
+ toolName,
228
+ });
229
+ if (shouldBlock(result, blockOnWarn)) {
230
+ event.cancel_tool =
231
+ `Blocked by Burrow: ${result.category} ` +
232
+ `(${Math.round(result.confidence * 100)}% confidence). ` +
233
+ `DO NOT retry this tool call.`;
234
+ console.warn(`[burrow] Blocked tool call ${toolName} for agent '${agentName}': ${result.category} (${Math.round(result.confidence * 100)}% confidence)`);
235
+ }
236
+ });
237
+ // Scan tool output for indirect injection
238
+ registry.addCallback("AfterToolCall", async (event) => {
239
+ const resultData = event.result;
240
+ if (resultData == null)
241
+ return;
242
+ const text = String(resultData).slice(0, 4096).trim();
243
+ if (!text)
244
+ return;
245
+ const toolUse = event.tool_use;
246
+ const toolName = toolUse?.name ?? "unknown";
247
+ const agentName = resolveAgent(event);
248
+ const scanResult = await guard.scan(text, {
249
+ contentType: "tool_response",
250
+ agent: agentName,
251
+ toolName,
252
+ });
253
+ if (shouldBlock(scanResult, blockOnWarn)) {
254
+ const blockedMsg = buildBlockedMessage(toolName, scanResult);
255
+ if (typeof resultData === "object" &&
256
+ resultData !== null &&
257
+ "toolUseId" in resultData) {
258
+ event.result = {
259
+ toolUseId: resultData.toolUseId,
260
+ status: "error",
261
+ content: [{ text: blockedMsg }],
262
+ };
263
+ }
264
+ else {
265
+ console.warn("[burrow] Blocked tool result is not a dict with toolUseId; replacing with blocked message string.");
266
+ event.result = blockedMsg;
267
+ }
268
+ console.warn(`[burrow] Flagged tool output from ${toolName} for agent '${agentName}': ${scanResult.category} (${Math.round(scanResult.confidence * 100)}% confidence)`);
269
+ }
270
+ });
271
+ },
272
+ };
273
+ }
274
+ //# sourceMappingURL=strands.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"strands.js","sourceRoot":"","sources":["../../src/integrations/strands.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AA0CH;;;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,OA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AM,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"}
@@ -0,0 +1,30 @@
1
+ export declare enum ScanAction {
2
+ ALLOW = "allow",
3
+ WARN = "warn",
4
+ BLOCK = "block"
5
+ }
6
+ export interface ScanResult {
7
+ action: string;
8
+ confidence: number;
9
+ category: string;
10
+ request_id: string;
11
+ latency_ms: number;
12
+ }
13
+ export type ContentType = "user_prompt" | "tool_call" | "tool_response";
14
+ export interface BurrowConfig {
15
+ clientId?: string;
16
+ clientSecret?: string;
17
+ apiUrl?: string;
18
+ authUrl?: string;
19
+ timeout?: number;
20
+ failOpen?: boolean;
21
+ sessionId?: string;
22
+ }
23
+ export interface ScanOptions {
24
+ contentType?: ContentType;
25
+ agent?: string;
26
+ toolName?: string;
27
+ toolArgs?: Record<string, unknown>;
28
+ resource?: string;
29
+ }
30
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,oBAAY,UAAU;IACpB,KAAK,UAAU;IACf,IAAI,SAAS;IACb,KAAK,UAAU;CAChB;AAED,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,MAAM,WAAW,GAAG,aAAa,GAAG,WAAW,GAAG,eAAe,CAAC;AAExE,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,WAAW;IAC1B,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnC,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB"}
package/dist/types.js ADDED
@@ -0,0 +1,7 @@
1
+ export var ScanAction;
2
+ (function (ScanAction) {
3
+ ScanAction["ALLOW"] = "allow";
4
+ ScanAction["WARN"] = "warn";
5
+ ScanAction["BLOCK"] = "block";
6
+ })(ScanAction || (ScanAction = {}));
7
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,UAIX;AAJD,WAAY,UAAU;IACpB,6BAAe,CAAA;IACf,2BAAa,CAAA;IACb,6BAAe,CAAA;AACjB,CAAC,EAJW,UAAU,KAAV,UAAU,QAIrB"}
package/package.json ADDED
@@ -0,0 +1,66 @@
1
+ {
2
+ "name": "burrow-sdk",
3
+ "version": "0.5.0",
4
+ "description": "Prompt injection firewall SDK for AI agents",
5
+ "type": "module",
6
+ "exports": {
7
+ ".": {
8
+ "types": "./dist/index.d.ts",
9
+ "import": "./dist/index.js"
10
+ },
11
+ "./integrations/langchain": {
12
+ "types": "./dist/integrations/langchain.d.ts",
13
+ "import": "./dist/integrations/langchain.js"
14
+ },
15
+ "./integrations/ai-sdk": {
16
+ "types": "./dist/integrations/ai-sdk.d.ts",
17
+ "import": "./dist/integrations/ai-sdk.js"
18
+ },
19
+ "./integrations/openai-agents": {
20
+ "types": "./dist/integrations/openai-agents.d.ts",
21
+ "import": "./dist/integrations/openai-agents.js"
22
+ },
23
+ "./integrations/claude-sdk": {
24
+ "types": "./dist/integrations/claude-sdk.d.ts",
25
+ "import": "./dist/integrations/claude-sdk.js"
26
+ },
27
+ "./integrations/strands": {
28
+ "types": "./dist/integrations/strands.d.ts",
29
+ "import": "./dist/integrations/strands.js"
30
+ },
31
+ "./integrations/adk": {
32
+ "types": "./dist/integrations/adk.d.ts",
33
+ "import": "./dist/integrations/adk.js"
34
+ }
35
+ },
36
+ "main": "dist/index.js",
37
+ "types": "dist/index.d.ts",
38
+ "scripts": {
39
+ "build": "tsc",
40
+ "test": "vitest run",
41
+ "test:watch": "vitest",
42
+ "lint": "tsc --noEmit"
43
+ },
44
+ "keywords": [
45
+ "prompt-injection",
46
+ "firewall",
47
+ "ai-security",
48
+ "llm",
49
+ "guardrails"
50
+ ],
51
+ "author": "Burrow",
52
+ "license": "MIT",
53
+ "engines": {
54
+ "node": ">=18"
55
+ },
56
+ "files": [
57
+ "dist",
58
+ "README.md",
59
+ "LICENSE"
60
+ ],
61
+ "devDependencies": {
62
+ "@types/node": "^25.2.3",
63
+ "typescript": "^5.5.0",
64
+ "vitest": "^2.0.0"
65
+ }
66
+ }