@clampd/sdk 0.4.0 → 0.4.1

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/README.md +31 -10
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,17 +1,17 @@
1
- # Clampd TypeScript SDK
1
+ # @clampd/sdk TypeScript SDK
2
2
 
3
- Runtime security for AI agents. Guard every tool call — OpenAI, Anthropic, LangChain.js — in 1 line.
3
+ Runtime security for AI agents. Guard every tool call — OpenAI, Anthropic, LangChain.js — in 1 line. Prompt and response scanning enabled by default.
4
4
 
5
5
  ## Installation
6
6
 
7
7
  ```bash
8
- npm install clampd
8
+ npm install @clampd/sdk
9
9
  ```
10
10
 
11
11
  ## Quick Start
12
12
 
13
13
  ```typescript
14
- import clampd from "clampd";
14
+ import clampd from "@clampd/sdk";
15
15
  import OpenAI from "openai";
16
16
 
17
17
  // Configure once at startup
@@ -33,8 +33,15 @@ const response = await client.chat.completions.create({
33
33
  });
34
34
  // Dangerous tool calls → blocked before execution
35
35
  // Safe tool calls → proceed normally
36
+ // Prompts scanned before LLM, responses scanned after
36
37
  ```
37
38
 
39
+ ## What's New in 0.4.0
40
+
41
+ - **`scanInput` and `scanOutput` now default to `true`** — prompts are scanned before the LLM call, responses are scanned after. Set `scanInput: false` to opt out.
42
+ - 50 detection rules across 20 languages
43
+ - 7 compliance frameworks (HIPAA, GDPR, PCI-DSS, CCPA, SOC 2, EU AI Act, NIST AI RMF)
44
+
38
45
  ## Configuration
39
46
 
40
47
  Three ways to configure (pick one):
@@ -60,7 +67,7 @@ const safeFn = clampd.guard(myFn, {
60
67
  ## Anthropic / Claude
61
68
 
62
69
  ```typescript
63
- import clampd from "clampd";
70
+ import clampd from "@clampd/sdk";
64
71
  import Anthropic from "@anthropic-ai/sdk";
65
72
 
66
73
  clampd.init({ agentId: "my-agent", secret: "ags_..." });
@@ -77,7 +84,7 @@ const response = await client.messages.create({
77
84
  ## Direct Guard (any function)
78
85
 
79
86
  ```typescript
80
- import clampd from "clampd";
87
+ import clampd from "@clampd/sdk";
81
88
 
82
89
  clampd.init({ agentId: "my-agent", secret: "ags_..." });
83
90
 
@@ -95,10 +102,24 @@ await safeQuery("SELECT * FROM users"); // allowed
95
102
  await safeQuery("DROP TABLE users"); // throws ClampdBlockedError
96
103
  ```
97
104
 
105
+ ## Scanning Options
106
+
107
+ ```typescript
108
+ // Defaults (v0.4.0+): scanInput=true, scanOutput=true
109
+ const client = clampd.openai(new OpenAI(), { agentId: "my-agent" });
110
+
111
+ // Opt out of scanning
112
+ const client = clampd.openai(new OpenAI(), {
113
+ agentId: "my-agent",
114
+ scanInput: false, // skip prompt scanning
115
+ scanOutput: false, // skip response scanning
116
+ });
117
+ ```
118
+
98
119
  ## Tool Definitions Wrapper
99
120
 
100
121
  ```typescript
101
- import clampd from "clampd";
122
+ import clampd from "@clampd/sdk";
102
123
 
103
124
  // Wrap OpenAI-style tool definitions
104
125
  const safeTools = clampd.tools(myToolDefs, { agentId: "my-agent", secret: "ags_..." });
@@ -107,7 +128,7 @@ const safeTools = clampd.tools(myToolDefs, { agentId: "my-agent", secret: "ags_.
107
128
  ## Error Handling
108
129
 
109
130
  ```typescript
110
- import { ClampdBlockedError } from "clampd";
131
+ import { ClampdBlockedError } from "@clampd/sdk";
111
132
 
112
133
  try {
113
134
  await safeQuery("DROP TABLE users");
@@ -124,8 +145,8 @@ try {
124
145
  | Function | Description |
125
146
  |----------|-------------|
126
147
  | `clampd.init(opts)` | Configure global client (once at startup) |
127
- | `clampd.openai(client)` | Wrap OpenAI client |
128
- | `clampd.anthropic(client)` | Wrap Anthropic client |
148
+ | `clampd.openai(client, opts?)` | Wrap OpenAI client (scanInput/scanOutput on by default) |
149
+ | `clampd.anthropic(client, opts?)` | Wrap Anthropic client (scanInput/scanOutput on by default) |
129
150
  | `clampd.guard(fn, opts)` | Wrap any async function |
130
151
  | `clampd.tools(defs, opts)` | Wrap OpenAI tool definitions |
131
152
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clampd/sdk",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "description": "Runtime security SDK for AI agents — guard tool calls in 1 line",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",