@clampd/sdk 0.15.0 → 0.16.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/dist/_frameworkAdapters.d.ts +109 -0
- package/dist/_frameworkAdapters.d.ts.map +1 -0
- package/dist/_frameworkAdapters.js +203 -0
- package/dist/_frameworkAdapters.js.map +1 -0
- package/dist/errors.d.ts +50 -0
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +73 -0
- package/dist/errors.js.map +1 -1
- package/dist/guardrails.d.ts.map +1 -1
- package/dist/guardrails.js +16 -1
- package/dist/guardrails.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +46 -5
- package/dist/index.js.map +1 -1
- package/dist/interceptor.d.ts.map +1 -1
- package/dist/interceptor.js +8 -0
- package/dist/interceptor.js.map +1 -1
- package/dist/langchain.d.ts.map +1 -1
- package/dist/langchain.js +11 -1
- package/dist/langchain.js.map +1 -1
- package/dist/register.d.ts +67 -24
- package/dist/register.d.ts.map +1 -1
- package/dist/register.js +109 -44
- package/dist/register.js.map +1 -1
- package/dist/stream-guard.d.ts.map +1 -1
- package/dist/stream-guard.js +9 -1
- package/dist/stream-guard.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Framework tool-object adapters and the unregistered-tool detector.
|
|
3
|
+
*
|
|
4
|
+
* Mirrors `clampd._framework_adapters` in the Python SDK. Two
|
|
5
|
+
* unrelated-but-thin concerns live here so we don't multiply tiny
|
|
6
|
+
* helper modules:
|
|
7
|
+
*
|
|
8
|
+
* 1. {@link extractToolDescriptor} — duck-type a LangChain
|
|
9
|
+
* `BaseTool` / OpenAI tool def / Anthropic tool def into a
|
|
10
|
+
* plain `{ name, description, paramSchema }` triple. Used by
|
|
11
|
+
* the `registerTool(toolObject, opts)` overload so callers can
|
|
12
|
+
* pass their existing framework tool object instead of
|
|
13
|
+
* restating its name / description / schema.
|
|
14
|
+
*
|
|
15
|
+
* 2. {@link raiseIfUnregistered} — convert the gateway's
|
|
16
|
+
* `denial_reason` strings starting with `tool_not_registered:`
|
|
17
|
+
* or `tool_not_classified:` into a typed
|
|
18
|
+
* {@link ClampdUnregisteredToolError}. Centralised here so
|
|
19
|
+
* every wrapper that calls `client.proxy()` can short-circuit
|
|
20
|
+
* with the same exception, ahead of throwing the more general
|
|
21
|
+
* {@link ClampdBlockedError}.
|
|
22
|
+
*
|
|
23
|
+
* Pure TypeScript — no framework imports. Every shape check is duck
|
|
24
|
+
* typing so loading the SDK does not require LangChain / OpenAI /
|
|
25
|
+
* Anthropic SDKs to be installed.
|
|
26
|
+
*/
|
|
27
|
+
import type { ProxyResponse } from "./client.js";
|
|
28
|
+
/**
|
|
29
|
+
* Plain triple extracted from an arbitrary framework tool object.
|
|
30
|
+
*
|
|
31
|
+
* `paramSchema` is whatever the framework gave us (zod schema, JSON
|
|
32
|
+
* Schema, ad-hoc dict). Downstream code that hashes it (`contractHash`)
|
|
33
|
+
* tolerates anything serialisable; LangChain `zod` schemas are passed
|
|
34
|
+
* through `_zodToJsonSchema` first so the hash stays stable across
|
|
35
|
+
* runs.
|
|
36
|
+
*/
|
|
37
|
+
export interface ExtractedDescriptor {
|
|
38
|
+
name: string;
|
|
39
|
+
description: string;
|
|
40
|
+
paramSchema: object;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Detect and extract `{ name, description, paramSchema }` from a
|
|
44
|
+
* LangChain `BaseTool`, OpenAI tool def, Anthropic tool def, or
|
|
45
|
+
* Vercel AI SDK tool def.
|
|
46
|
+
*
|
|
47
|
+
* Returns `null` when the value doesn't look like any known tool
|
|
48
|
+
* shape — caller should fall through to the `(name, opts)` overload
|
|
49
|
+
* or raise.
|
|
50
|
+
*
|
|
51
|
+
* Detection rules (duck typing — order matters, most specific first):
|
|
52
|
+
*
|
|
53
|
+
* - OpenAI tool def: `{ type: 'function', function: { name, ... } }`
|
|
54
|
+
* - Anthropic tool def: `{ name, input_schema }` (no `function` key)
|
|
55
|
+
* - LangChain BaseTool: has `.name` plus either `.schema` (zod) or
|
|
56
|
+
* `.args_schema` (legacy)
|
|
57
|
+
* - Vercel AI SDK: has `.parameters` plus `.execute`/`.description`
|
|
58
|
+
* (handled via the LangChain branch since `.name` is keyed
|
|
59
|
+
* externally for Vercel; if `.name` is missing, returns `null`)
|
|
60
|
+
*/
|
|
61
|
+
export declare function extractToolDescriptor(value: unknown): ExtractedDescriptor | null;
|
|
62
|
+
/**
|
|
63
|
+
* Inspect a {@link ProxyResponse} and throw a typed exception if the
|
|
64
|
+
* gateway denied the call for a descriptor-related reason.
|
|
65
|
+
*
|
|
66
|
+
* Three prefixes on `denial_reason` are handled:
|
|
67
|
+
*
|
|
68
|
+
* - `tool_not_registered:<name>` → {@link ClampdUnregisteredToolError}
|
|
69
|
+
* (descriptor missing entirely)
|
|
70
|
+
* - `tool_not_classified:<name>` → {@link ClampdUnregisteredToolError}
|
|
71
|
+
* (descriptor exists but rejected classification at registration time)
|
|
72
|
+
* - `descriptor_hash_mismatch:<...>` → {@link ClampdDescriptorMismatchError}
|
|
73
|
+
* (descriptor exists but the hash sent doesn't match any approved
|
|
74
|
+
* version — rug-pull-detection signal)
|
|
75
|
+
*
|
|
76
|
+
* For `descriptor_hash_mismatch`, the attempted hash is parsed from the
|
|
77
|
+
* reason text (`"with hash <hex>"`) and attached to the error.
|
|
78
|
+
*
|
|
79
|
+
* No-op for any other denial reason — the caller is expected to throw
|
|
80
|
+
* its own {@link ClampdBlockedError} downstream.
|
|
81
|
+
*
|
|
82
|
+
* Mirrors the prefix scheme used by the Python SDK's
|
|
83
|
+
* `_raise_for_descriptor_errors`.
|
|
84
|
+
*/
|
|
85
|
+
export declare function raiseForDescriptorErrors(toolName: string, resp: ProxyResponse | undefined): void;
|
|
86
|
+
/**
|
|
87
|
+
* Backward-compat alias for {@link raiseForDescriptorErrors}.
|
|
88
|
+
*
|
|
89
|
+
* Originally only handled `tool_not_registered:` / `tool_not_classified:`
|
|
90
|
+
* prefixes. It now also throws {@link ClampdDescriptorMismatchError}
|
|
91
|
+
* on `descriptor_hash_mismatch:` — kept under the old name so existing
|
|
92
|
+
* call sites (interceptor, langchain, stream-guard, guardrails) keep
|
|
93
|
+
* working without a rename touching every wrapper.
|
|
94
|
+
*/
|
|
95
|
+
export declare function raiseIfUnregistered(toolName: string, resp: ProxyResponse | undefined): void;
|
|
96
|
+
/**
|
|
97
|
+
* Maps `toolName -> contractHash` for every successful
|
|
98
|
+
* `registerTool()` call in this process. The OpenAI / Anthropic /
|
|
99
|
+
* LangChain wrappers prefer this cached hash over computing one on
|
|
100
|
+
* the fly — that way the hash sent to the gateway exactly matches
|
|
101
|
+
* the hash that was registered, even when the wrapper has incomplete
|
|
102
|
+
* information about the tool's parameter schema (e.g. LangChain
|
|
103
|
+
* callbacks don't surface the pydantic schema through `serialized`).
|
|
104
|
+
*
|
|
105
|
+
* Mirrors `clampd._framework_adapters._registered_descriptors` in the
|
|
106
|
+
* Python SDK.
|
|
107
|
+
*/
|
|
108
|
+
export declare const _registeredDescriptors: Map<string, string>;
|
|
109
|
+
//# sourceMappingURL=_frameworkAdapters.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_frameworkAdapters.d.ts","sourceRoot":"","sources":["../src/_frameworkAdapters.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAQjD;;;;;;;;GAQG;AACH,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;CACrB;AA0CD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,GAAG,mBAAmB,GAAG,IAAI,CAgDhF;AAQD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,aAAa,GAAG,SAAS,GAC9B,IAAI,CAeN;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,aAAa,GAAG,SAAS,GAC9B,IAAI,CAEN;AAID;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,sBAAsB,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAa,CAAC"}
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Framework tool-object adapters and the unregistered-tool detector.
|
|
3
|
+
*
|
|
4
|
+
* Mirrors `clampd._framework_adapters` in the Python SDK. Two
|
|
5
|
+
* unrelated-but-thin concerns live here so we don't multiply tiny
|
|
6
|
+
* helper modules:
|
|
7
|
+
*
|
|
8
|
+
* 1. {@link extractToolDescriptor} — duck-type a LangChain
|
|
9
|
+
* `BaseTool` / OpenAI tool def / Anthropic tool def into a
|
|
10
|
+
* plain `{ name, description, paramSchema }` triple. Used by
|
|
11
|
+
* the `registerTool(toolObject, opts)` overload so callers can
|
|
12
|
+
* pass their existing framework tool object instead of
|
|
13
|
+
* restating its name / description / schema.
|
|
14
|
+
*
|
|
15
|
+
* 2. {@link raiseIfUnregistered} — convert the gateway's
|
|
16
|
+
* `denial_reason` strings starting with `tool_not_registered:`
|
|
17
|
+
* or `tool_not_classified:` into a typed
|
|
18
|
+
* {@link ClampdUnregisteredToolError}. Centralised here so
|
|
19
|
+
* every wrapper that calls `client.proxy()` can short-circuit
|
|
20
|
+
* with the same exception, ahead of throwing the more general
|
|
21
|
+
* {@link ClampdBlockedError}.
|
|
22
|
+
*
|
|
23
|
+
* Pure TypeScript — no framework imports. Every shape check is duck
|
|
24
|
+
* typing so loading the SDK does not require LangChain / OpenAI /
|
|
25
|
+
* Anthropic SDKs to be installed.
|
|
26
|
+
*/
|
|
27
|
+
import { ClampdDescriptorMismatchError, ClampdUnregisteredToolError, } from "./errors.js";
|
|
28
|
+
import { createRequire } from "node:module";
|
|
29
|
+
const _moduleRequire = createRequire(import.meta.url);
|
|
30
|
+
/**
|
|
31
|
+
* Best-effort conversion of a zod schema to a JSON Schema dict.
|
|
32
|
+
*
|
|
33
|
+
* zod 4 ships `z.toJSONSchema()`; we resolve it lazily because the SDK
|
|
34
|
+
* lists zod as an optional peer dep. Returns `{}` if anything fails so
|
|
35
|
+
* the caller still gets a stable (if less informative) descriptor.
|
|
36
|
+
*
|
|
37
|
+
* Sync resolution via `createRequire` is deliberate: `extractToolDescriptor`
|
|
38
|
+
* runs inside `registerTool()` which is already async, but the rest of the
|
|
39
|
+
* SDK (notably the LangChain callback fast-path) treats descriptor
|
|
40
|
+
* extraction as a synchronous step. Dynamic `import()` would force every
|
|
41
|
+
* caller to await, which would ripple through the whole adapter surface
|
|
42
|
+
* for no real benefit — `node:module.createRequire` gives us the same
|
|
43
|
+
* lazy-load semantics with a sync return.
|
|
44
|
+
*/
|
|
45
|
+
function zodToJsonSchema(schema) {
|
|
46
|
+
if (!schema || typeof schema !== "object")
|
|
47
|
+
return {};
|
|
48
|
+
// Heuristic: zod schemas have `_def` and `parse`.
|
|
49
|
+
const maybeZod = schema;
|
|
50
|
+
if (!maybeZod._def || typeof maybeZod.parse !== "function")
|
|
51
|
+
return {};
|
|
52
|
+
try {
|
|
53
|
+
const zodMod = _moduleRequire("zod");
|
|
54
|
+
const z = zodMod.z;
|
|
55
|
+
if (z?.toJSONSchema) {
|
|
56
|
+
const out = z.toJSONSchema(schema);
|
|
57
|
+
if (out && typeof out === "object")
|
|
58
|
+
return out;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
catch {
|
|
62
|
+
// Either zod isn't installed or it's an older version without
|
|
63
|
+
// toJSONSchema — fall through to {}.
|
|
64
|
+
}
|
|
65
|
+
return {};
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Detect and extract `{ name, description, paramSchema }` from a
|
|
69
|
+
* LangChain `BaseTool`, OpenAI tool def, Anthropic tool def, or
|
|
70
|
+
* Vercel AI SDK tool def.
|
|
71
|
+
*
|
|
72
|
+
* Returns `null` when the value doesn't look like any known tool
|
|
73
|
+
* shape — caller should fall through to the `(name, opts)` overload
|
|
74
|
+
* or raise.
|
|
75
|
+
*
|
|
76
|
+
* Detection rules (duck typing — order matters, most specific first):
|
|
77
|
+
*
|
|
78
|
+
* - OpenAI tool def: `{ type: 'function', function: { name, ... } }`
|
|
79
|
+
* - Anthropic tool def: `{ name, input_schema }` (no `function` key)
|
|
80
|
+
* - LangChain BaseTool: has `.name` plus either `.schema` (zod) or
|
|
81
|
+
* `.args_schema` (legacy)
|
|
82
|
+
* - Vercel AI SDK: has `.parameters` plus `.execute`/`.description`
|
|
83
|
+
* (handled via the LangChain branch since `.name` is keyed
|
|
84
|
+
* externally for Vercel; if `.name` is missing, returns `null`)
|
|
85
|
+
*/
|
|
86
|
+
export function extractToolDescriptor(value) {
|
|
87
|
+
if (!value || typeof value !== "object")
|
|
88
|
+
return null;
|
|
89
|
+
const v = value;
|
|
90
|
+
// OpenAI: { type: 'function', function: { name, description, parameters } }
|
|
91
|
+
if (v.type === "function" && v.function && typeof v.function === "object") {
|
|
92
|
+
const fn = v.function;
|
|
93
|
+
if (typeof fn.name === "string") {
|
|
94
|
+
return {
|
|
95
|
+
name: fn.name,
|
|
96
|
+
description: typeof fn.description === "string" ? fn.description : "",
|
|
97
|
+
paramSchema: fn.parameters ?? {},
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
// Anthropic: { name, description, input_schema }
|
|
102
|
+
if (typeof v.name === "string" && v.input_schema && typeof v.input_schema === "object") {
|
|
103
|
+
return {
|
|
104
|
+
name: v.name,
|
|
105
|
+
description: typeof v.description === "string" ? v.description : "",
|
|
106
|
+
paramSchema: v.input_schema,
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
// LangChain BaseTool: .name + (.schema (zod) | .args_schema (legacy))
|
|
110
|
+
if (typeof v.name === "string" && (v.schema !== undefined || v.args_schema !== undefined)) {
|
|
111
|
+
const schema = v.schema ?? v.args_schema;
|
|
112
|
+
let paramSchema;
|
|
113
|
+
if (schema && typeof schema === "object") {
|
|
114
|
+
// zod schema?
|
|
115
|
+
const maybeZod = schema;
|
|
116
|
+
if (maybeZod._def && typeof maybeZod.parse === "function") {
|
|
117
|
+
paramSchema = zodToJsonSchema(schema);
|
|
118
|
+
}
|
|
119
|
+
else {
|
|
120
|
+
paramSchema = schema;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
else {
|
|
124
|
+
paramSchema = {};
|
|
125
|
+
}
|
|
126
|
+
return {
|
|
127
|
+
name: v.name,
|
|
128
|
+
description: typeof v.description === "string" ? v.description : "",
|
|
129
|
+
paramSchema,
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
return null;
|
|
133
|
+
}
|
|
134
|
+
// ── Descriptor-error detection ──────────────────────────────────────
|
|
135
|
+
/** Regex matching the `with hash <hex>` fragment the gateway embeds in
|
|
136
|
+
* `descriptor_hash_mismatch:` denial reasons. */
|
|
137
|
+
const DESCRIPTOR_HASH_RE = /with hash ([0-9a-fA-F]+)/;
|
|
138
|
+
/**
|
|
139
|
+
* Inspect a {@link ProxyResponse} and throw a typed exception if the
|
|
140
|
+
* gateway denied the call for a descriptor-related reason.
|
|
141
|
+
*
|
|
142
|
+
* Three prefixes on `denial_reason` are handled:
|
|
143
|
+
*
|
|
144
|
+
* - `tool_not_registered:<name>` → {@link ClampdUnregisteredToolError}
|
|
145
|
+
* (descriptor missing entirely)
|
|
146
|
+
* - `tool_not_classified:<name>` → {@link ClampdUnregisteredToolError}
|
|
147
|
+
* (descriptor exists but rejected classification at registration time)
|
|
148
|
+
* - `descriptor_hash_mismatch:<...>` → {@link ClampdDescriptorMismatchError}
|
|
149
|
+
* (descriptor exists but the hash sent doesn't match any approved
|
|
150
|
+
* version — rug-pull-detection signal)
|
|
151
|
+
*
|
|
152
|
+
* For `descriptor_hash_mismatch`, the attempted hash is parsed from the
|
|
153
|
+
* reason text (`"with hash <hex>"`) and attached to the error.
|
|
154
|
+
*
|
|
155
|
+
* No-op for any other denial reason — the caller is expected to throw
|
|
156
|
+
* its own {@link ClampdBlockedError} downstream.
|
|
157
|
+
*
|
|
158
|
+
* Mirrors the prefix scheme used by the Python SDK's
|
|
159
|
+
* `_raise_for_descriptor_errors`.
|
|
160
|
+
*/
|
|
161
|
+
export function raiseForDescriptorErrors(toolName, resp) {
|
|
162
|
+
if (!resp || resp.allowed)
|
|
163
|
+
return;
|
|
164
|
+
const reason = resp.denial_reason;
|
|
165
|
+
if (typeof reason !== "string")
|
|
166
|
+
return;
|
|
167
|
+
if (reason.startsWith("tool_not_registered:") ||
|
|
168
|
+
reason.startsWith("tool_not_classified:")) {
|
|
169
|
+
throw new ClampdUnregisteredToolError(toolName);
|
|
170
|
+
}
|
|
171
|
+
if (reason.startsWith("descriptor_hash_mismatch:")) {
|
|
172
|
+
const match = DESCRIPTOR_HASH_RE.exec(reason);
|
|
173
|
+
const attemptedHash = match ? match[1] : undefined;
|
|
174
|
+
throw new ClampdDescriptorMismatchError(toolName, { attemptedHash });
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Backward-compat alias for {@link raiseForDescriptorErrors}.
|
|
179
|
+
*
|
|
180
|
+
* Originally only handled `tool_not_registered:` / `tool_not_classified:`
|
|
181
|
+
* prefixes. It now also throws {@link ClampdDescriptorMismatchError}
|
|
182
|
+
* on `descriptor_hash_mismatch:` — kept under the old name so existing
|
|
183
|
+
* call sites (interceptor, langchain, stream-guard, guardrails) keep
|
|
184
|
+
* working without a rename touching every wrapper.
|
|
185
|
+
*/
|
|
186
|
+
export function raiseIfUnregistered(toolName, resp) {
|
|
187
|
+
raiseForDescriptorErrors(toolName, resp);
|
|
188
|
+
}
|
|
189
|
+
// ── Process-local descriptor cache ──────────────────────────────────
|
|
190
|
+
/**
|
|
191
|
+
* Maps `toolName -> contractHash` for every successful
|
|
192
|
+
* `registerTool()` call in this process. The OpenAI / Anthropic /
|
|
193
|
+
* LangChain wrappers prefer this cached hash over computing one on
|
|
194
|
+
* the fly — that way the hash sent to the gateway exactly matches
|
|
195
|
+
* the hash that was registered, even when the wrapper has incomplete
|
|
196
|
+
* information about the tool's parameter schema (e.g. LangChain
|
|
197
|
+
* callbacks don't surface the pydantic schema through `serialized`).
|
|
198
|
+
*
|
|
199
|
+
* Mirrors `clampd._framework_adapters._registered_descriptors` in the
|
|
200
|
+
* Python SDK.
|
|
201
|
+
*/
|
|
202
|
+
export const _registeredDescriptors = new Map();
|
|
203
|
+
//# sourceMappingURL=_frameworkAdapters.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_frameworkAdapters.js","sourceRoot":"","sources":["../src/_frameworkAdapters.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAGH,OAAO,EACL,6BAA6B,EAC7B,2BAA2B,GAC5B,MAAM,aAAa,CAAC;AAmBrB,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,MAAM,cAAc,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAEtD;;;;;;;;;;;;;;GAcG;AACH,SAAS,eAAe,CAAC,MAAe;IACtC,IAAI,CAAC,MAAM,IAAI,OAAO,MAAM,KAAK,QAAQ;QAAE,OAAO,EAAE,CAAC;IACrD,kDAAkD;IAClD,MAAM,QAAQ,GAAG,MAA6C,CAAC;IAC/D,IAAI,CAAC,QAAQ,CAAC,IAAI,IAAI,OAAO,QAAQ,CAAC,KAAK,KAAK,UAAU;QAAE,OAAO,EAAE,CAAC;IACtE,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,cAAc,CAAC,KAAK,CAElC,CAAC;QACF,MAAM,CAA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O;QAAE,OAAO;IAClC,MAAM,MAAM,GAAG,IAAI,CAAC,aAAa,CAAC;IAClC,IAAI,OAAO,MAAM,KAAK,QAAQ;QAAE,OAAO;IACvC,IACE,MAAM,CAAC,UAAU,CAAC,sBAAsB,CAAC;QACzC,MAAM,CAAC,UAAU,CAAC,sBAAsB,CAAC,EACzC,CAAC;QACD,MAAM,IAAI,2BAA2B,CAAC,QAAQ,CAAC,CAAC;IAClD,CAAC;IACD,IAAI,MAAM,CAAC,UAAU,CAAC,2BAA2B,CAAC,EAAE,CAAC;QACnD,MAAM,KAAK,GAAG,kBAAkB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAC9C,MAAM,aAAa,GAAG,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QACnD,MAAM,IAAI,6BAA6B,CAAC,QAAQ,EAAE,EAAE,aAAa,EAAE,CAAC,CAAC;IACvE,CAAC;AACH,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,mBAAmB,CACjC,QAAgB,EAChB,IAA+B;IAE/B,wBAAwB,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;AAC3C,CAAC;AAED,uEAAuE;AAEvE;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAwB,IAAI,GAAG,EAAE,CAAC"}
|
package/dist/errors.d.ts
CHANGED
|
@@ -26,4 +26,54 @@ export declare class ClampdClassificationError extends Error {
|
|
|
26
26
|
readonly operation: string;
|
|
27
27
|
constructor(category: string, subcategory: string, operation: string);
|
|
28
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* Thrown when a tool call is denied because the gateway has no descriptor
|
|
31
|
+
* registered for that tool name (or the descriptor failed classification
|
|
32
|
+
* and was rejected at registration time).
|
|
33
|
+
*
|
|
34
|
+
* Distinct from {@link import("./interceptor.js").ClampdBlockedError}
|
|
35
|
+
* (which signals a policy / risk / scope decision against a *known*
|
|
36
|
+
* tool) — this error means the tool is unknown to Clampd and the fix
|
|
37
|
+
* is to register it at module load time, not to relax a policy.
|
|
38
|
+
*
|
|
39
|
+
* The SDK raises this when the gateway returns
|
|
40
|
+
* `denial_reason` starting with `"tool_not_registered:"` or
|
|
41
|
+
* `"tool_not_classified:"`. Mirrors
|
|
42
|
+
* `clampd._errors.ClampdUnregisteredToolError` in the Python SDK so
|
|
43
|
+
* cross-language docs / examples stay in lockstep.
|
|
44
|
+
*/
|
|
45
|
+
export declare class ClampdUnregisteredToolError extends Error {
|
|
46
|
+
readonly toolName: string;
|
|
47
|
+
readonly hint: string;
|
|
48
|
+
constructor(toolName: string, opts?: {
|
|
49
|
+
hint?: string;
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Thrown when a tool call is denied because the descriptor hash sent to
|
|
54
|
+
* the gateway doesn't match any approved hash for that tool name.
|
|
55
|
+
*
|
|
56
|
+
* Distinct from {@link ClampdUnregisteredToolError} (the tool is unknown
|
|
57
|
+
* entirely) and from {@link import("./interceptor.js").ClampdBlockedError}
|
|
58
|
+
* (a policy / risk / scope decision against an *approved* descriptor):
|
|
59
|
+
* this error means the descriptor exists, but its current hash isn't on
|
|
60
|
+
* the approved list — most often the tool's name / description /
|
|
61
|
+
* parameter schema changed since the dashboard approved it (rug-pull
|
|
62
|
+
* detection) and the new version needs to be approved.
|
|
63
|
+
*
|
|
64
|
+
* The SDK raises this when the gateway returns a `denial_reason`
|
|
65
|
+
* starting with `"descriptor_hash_mismatch:"`. The optional
|
|
66
|
+
* `attemptedHash` field is parsed from the reason text when present
|
|
67
|
+
* (gateway includes it as `"... with hash <hex> ..."`). Mirrors
|
|
68
|
+
* `clampd._errors.ClampdDescriptorMismatchError` in the Python SDK.
|
|
69
|
+
*/
|
|
70
|
+
export declare class ClampdDescriptorMismatchError extends Error {
|
|
71
|
+
readonly toolName: string;
|
|
72
|
+
readonly attemptedHash: string | undefined;
|
|
73
|
+
readonly hint: string;
|
|
74
|
+
constructor(toolName: string, opts?: {
|
|
75
|
+
attemptedHash?: string;
|
|
76
|
+
hint?: string;
|
|
77
|
+
});
|
|
78
|
+
}
|
|
29
79
|
//# sourceMappingURL=errors.d.ts.map
|
package/dist/errors.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH;;;;;;;;;;;GAWG;AACH,qBAAa,yBAA0B,SAAQ,KAAK;IAClD,SAAgB,QAAQ,EAAE,MAAM,CAAC;IACjC,SAAgB,WAAW,EAAE,MAAM,CAAC;IACpC,SAAgB,SAAS,EAAE,MAAM,CAAC;gBAEtB,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;CAYrE"}
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH;;;;;;;;;;;GAWG;AACH,qBAAa,yBAA0B,SAAQ,KAAK;IAClD,SAAgB,QAAQ,EAAE,MAAM,CAAC;IACjC,SAAgB,WAAW,EAAE,MAAM,CAAC;IACpC,SAAgB,SAAS,EAAE,MAAM,CAAC;gBAEtB,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;CAYrE;AAED;;;;;;;;;;;;;;;GAeG;AACH,qBAAa,2BAA4B,SAAQ,KAAK;IACpD,SAAgB,QAAQ,EAAE,MAAM,CAAC;IACjC,SAAgB,IAAI,EAAE,MAAM,CAAC;gBAEjB,QAAQ,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE;CASvD;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,qBAAa,6BAA8B,SAAQ,KAAK;IACtD,SAAgB,QAAQ,EAAE,MAAM,CAAC;IACjC,SAAgB,aAAa,EAAE,MAAM,GAAG,SAAS,CAAC;IAClD,SAAgB,IAAI,EAAE,MAAM,CAAC;gBAG3B,QAAQ,EAAE,MAAM,EAChB,IAAI,CAAC,EAAE;QAAE,aAAa,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE;CAuBnD"}
|
package/dist/errors.js
CHANGED
|
@@ -35,4 +35,77 @@ export class ClampdClassificationError extends Error {
|
|
|
35
35
|
this.operation = operation;
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
+
/**
|
|
39
|
+
* Thrown when a tool call is denied because the gateway has no descriptor
|
|
40
|
+
* registered for that tool name (or the descriptor failed classification
|
|
41
|
+
* and was rejected at registration time).
|
|
42
|
+
*
|
|
43
|
+
* Distinct from {@link import("./interceptor.js").ClampdBlockedError}
|
|
44
|
+
* (which signals a policy / risk / scope decision against a *known*
|
|
45
|
+
* tool) — this error means the tool is unknown to Clampd and the fix
|
|
46
|
+
* is to register it at module load time, not to relax a policy.
|
|
47
|
+
*
|
|
48
|
+
* The SDK raises this when the gateway returns
|
|
49
|
+
* `denial_reason` starting with `"tool_not_registered:"` or
|
|
50
|
+
* `"tool_not_classified:"`. Mirrors
|
|
51
|
+
* `clampd._errors.ClampdUnregisteredToolError` in the Python SDK so
|
|
52
|
+
* cross-language docs / examples stay in lockstep.
|
|
53
|
+
*/
|
|
54
|
+
export class ClampdUnregisteredToolError extends Error {
|
|
55
|
+
toolName;
|
|
56
|
+
hint;
|
|
57
|
+
constructor(toolName, opts) {
|
|
58
|
+
const hint = opts?.hint ??
|
|
59
|
+
`Call clampd.registerTool('${toolName}', { category, subcategory, operation }) at module load time.`;
|
|
60
|
+
super(`Tool '${toolName}' is not registered with Clampd. ${hint}`);
|
|
61
|
+
this.name = "ClampdUnregisteredToolError";
|
|
62
|
+
this.toolName = toolName;
|
|
63
|
+
this.hint = hint;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Thrown when a tool call is denied because the descriptor hash sent to
|
|
68
|
+
* the gateway doesn't match any approved hash for that tool name.
|
|
69
|
+
*
|
|
70
|
+
* Distinct from {@link ClampdUnregisteredToolError} (the tool is unknown
|
|
71
|
+
* entirely) and from {@link import("./interceptor.js").ClampdBlockedError}
|
|
72
|
+
* (a policy / risk / scope decision against an *approved* descriptor):
|
|
73
|
+
* this error means the descriptor exists, but its current hash isn't on
|
|
74
|
+
* the approved list — most often the tool's name / description /
|
|
75
|
+
* parameter schema changed since the dashboard approved it (rug-pull
|
|
76
|
+
* detection) and the new version needs to be approved.
|
|
77
|
+
*
|
|
78
|
+
* The SDK raises this when the gateway returns a `denial_reason`
|
|
79
|
+
* starting with `"descriptor_hash_mismatch:"`. The optional
|
|
80
|
+
* `attemptedHash` field is parsed from the reason text when present
|
|
81
|
+
* (gateway includes it as `"... with hash <hex> ..."`). Mirrors
|
|
82
|
+
* `clampd._errors.ClampdDescriptorMismatchError` in the Python SDK.
|
|
83
|
+
*/
|
|
84
|
+
export class ClampdDescriptorMismatchError extends Error {
|
|
85
|
+
toolName;
|
|
86
|
+
attemptedHash;
|
|
87
|
+
hint;
|
|
88
|
+
constructor(toolName, opts) {
|
|
89
|
+
let hint;
|
|
90
|
+
if (opts?.hint !== undefined) {
|
|
91
|
+
hint = opts.hint;
|
|
92
|
+
}
|
|
93
|
+
else if (opts?.attemptedHash) {
|
|
94
|
+
hint =
|
|
95
|
+
`Approve hash ${opts.attemptedHash.slice(0, 16)}... in the ` +
|
|
96
|
+
`dashboard for tool '${toolName}'.`;
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
hint =
|
|
100
|
+
`Approve the new descriptor hash for tool '${toolName}' ` +
|
|
101
|
+
`in the dashboard.`;
|
|
102
|
+
}
|
|
103
|
+
super(`Tool '${toolName}' descriptor hash does not match any approved ` +
|
|
104
|
+
`version. ${hint}`);
|
|
105
|
+
this.name = "ClampdDescriptorMismatchError";
|
|
106
|
+
this.toolName = toolName;
|
|
107
|
+
this.attemptedHash = opts?.attemptedHash;
|
|
108
|
+
this.hint = hint;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
38
111
|
//# sourceMappingURL=errors.js.map
|
package/dist/errors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH;;;;;;;;;;;GAWG;AACH,MAAM,OAAO,yBAA0B,SAAQ,KAAK;IAClC,QAAQ,CAAS;IACjB,WAAW,CAAS;IACpB,SAAS,CAAS;IAElC,YAAY,QAAgB,EAAE,WAAmB,EAAE,SAAiB;QAClE,KAAK,CACH,6CAA6C,QAAQ,oBAAoB,WAAW,kBAAkB,SAAS,MAAM;YACnH,kCAAkC;YAClC,yEAAyE;YACzE,yFAAyF,CAC5F,CAAC;QACF,IAAI,CAAC,IAAI,GAAG,2BAA2B,CAAC;QACxC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC7B,CAAC;CACF"}
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH;;;;;;;;;;;GAWG;AACH,MAAM,OAAO,yBAA0B,SAAQ,KAAK;IAClC,QAAQ,CAAS;IACjB,WAAW,CAAS;IACpB,SAAS,CAAS;IAElC,YAAY,QAAgB,EAAE,WAAmB,EAAE,SAAiB;QAClE,KAAK,CACH,6CAA6C,QAAQ,oBAAoB,WAAW,kBAAkB,SAAS,MAAM;YACnH,kCAAkC;YAClC,yEAAyE;YACzE,yFAAyF,CAC5F,CAAC;QACF,IAAI,CAAC,IAAI,GAAG,2BAA2B,CAAC;QACxC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,WA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C;QACzB,IAAI,CAAC,aAAa,GAAG,IAAI,EAAE,aAAa,CAAC;QACzC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF"}
|
package/dist/guardrails.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"guardrails.d.ts","sourceRoot":"","sources":["../src/guardrails.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,YAAY,EAAqB,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"guardrails.d.ts","sourceRoot":"","sources":["../src/guardrails.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,YAAY,EAAqB,MAAM,aAAa,CAAC;AAQ9D,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAI/D;;;;;;;;;GASG;AACH,wBAAsB,eAAe,CACnC,MAAM,EAAE,YAAY,EACpB,IAAI,EAAE,MAAM,EACZ,YAAY,EAAE,OAAO,EACrB,SAAS,GAAE,MAAW,EACtB,QAAQ,GAAE,OAAe,EACzB,UAAU,GAAE,MAAW,GACtB,OAAO,CAAC,IAAI,CAAC,CAcf;AAID;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,IAAI,CAarF;AAID;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,GAAG,MAAM,EAAE,GAAG,SAAS,CAOxG;AAED;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,GAAG,MAAM,EAAE,GAAG,SAAS,CAO3G;AAID;;GAEG;AACH,wBAAsB,eAAe,CACnC,MAAM,EAAE,YAAY,EACpB,QAAQ,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EACxC,QAAQ,EAAE,OAAO,GAChB,OAAO,CAAC,IAAI,CAAC,CA+Bf;AAED;;;GAGG;AACH,wBAAsB,kBAAkB,CACtC,MAAM,EAAE,YAAY,EACpB,QAAQ,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EACxC,QAAQ,EAAE,OAAO,GAChB,OAAO,CAAC,IAAI,CAAC,CAoCf;AAID;;GAEG;AACH,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,YAAY,EACpB,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,OAAO,GAChB,OAAO,CAAC,IAAI,CAAC,CAoBf;AAID;;GAEG;AACH,wBAAsB,2BAA2B,CAC/C,MAAM,EAAE,YAAY,EACpB,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACjC,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,OAAO,EACjB,eAAe,CAAC,EAAE,MAAM,EAAE,GACzB,OAAO,CAAC,IAAI,CAAC,CA+Bf"}
|
package/dist/guardrails.js
CHANGED
|
@@ -10,6 +10,7 @@ import { ClampdBlockedError } from "./interceptor.js";
|
|
|
10
10
|
import { scanForSchemaInjection } from "./schema-injection.js";
|
|
11
11
|
import { withDelegation, getDelegation } from "./delegation.js";
|
|
12
12
|
import { setScopeToken } from "./tool-verify.js";
|
|
13
|
+
import { raiseIfUnregistered, _registeredDescriptors } from "./_frameworkAdapters.js";
|
|
13
14
|
// Re-export scanForSchemaInjection so callers that import from guardrails.js get it
|
|
14
15
|
export { scanForSchemaInjection } from "./schema-injection.js";
|
|
15
16
|
// ── Response inspection helper ────────────────────────────────────
|
|
@@ -111,11 +112,16 @@ export async function scanInputOpenAI(client, messages, failOpen) {
|
|
|
111
112
|
try {
|
|
112
113
|
const inputResult = await client.scanInput(userMessages, messages.length);
|
|
113
114
|
if (!inputResult.allowed) {
|
|
115
|
+
// Lift the ScanResponse fields (notably matched_rules) onto the
|
|
116
|
+
// synthesized ProxyResponse so the resulting ClampdBlockedError
|
|
117
|
+
// carries the same `.matchedRules` / `.response` ergonomic
|
|
118
|
+
// surface as a real proxy denial.
|
|
114
119
|
throw new ClampdBlockedError({
|
|
115
120
|
request_id: "scan-input",
|
|
116
121
|
allowed: false,
|
|
117
122
|
risk_score: inputResult.risk_score,
|
|
118
123
|
denial_reason: inputResult.denial_reason || "Input blocked by guardrail",
|
|
124
|
+
matched_rules: inputResult.matched_rules ?? [],
|
|
119
125
|
latency_ms: inputResult.latency_ms,
|
|
120
126
|
degraded_stages: [],
|
|
121
127
|
session_flags: [],
|
|
@@ -159,6 +165,7 @@ export async function scanInputAnthropic(client, messages, failOpen) {
|
|
|
159
165
|
allowed: false,
|
|
160
166
|
risk_score: inputResult.risk_score,
|
|
161
167
|
denial_reason: inputResult.denial_reason || "Input blocked by guardrail",
|
|
168
|
+
matched_rules: inputResult.matched_rules ?? [],
|
|
162
169
|
latency_ms: inputResult.latency_ms,
|
|
163
170
|
degraded_stages: [],
|
|
164
171
|
session_flags: [],
|
|
@@ -187,6 +194,7 @@ export async function scanOutputContent(client, content, failOpen) {
|
|
|
187
194
|
allowed: false,
|
|
188
195
|
risk_score: outputResult.risk_score,
|
|
189
196
|
denial_reason: outputResult.denial_reason || "Output blocked by guardrail",
|
|
197
|
+
matched_rules: outputResult.matched_rules ?? [],
|
|
190
198
|
latency_ms: outputResult.latency_ms,
|
|
191
199
|
degraded_stages: [],
|
|
192
200
|
session_flags: [],
|
|
@@ -215,7 +223,14 @@ export async function guardToolCallWithDelegation(client, agentId, toolName, too
|
|
|
215
223
|
};
|
|
216
224
|
}
|
|
217
225
|
try {
|
|
218
|
-
|
|
226
|
+
// Prefer the descriptor hash captured at registerTool() time over
|
|
227
|
+
// recomputing from partial info — framework callbacks (notably
|
|
228
|
+
// LangChain's on_tool_start) only see name + description, never
|
|
229
|
+
// the parameter schema, so an on-the-fly hash would miss the
|
|
230
|
+
// registered one and trip rug-pull detection.
|
|
231
|
+
const registeredHash = _registeredDescriptors.get(toolName);
|
|
232
|
+
const res = await client.proxy(toolName, proxyParams, targetUrl, undefined, registeredHash, authorizedTools);
|
|
233
|
+
raiseIfUnregistered(toolName, res);
|
|
219
234
|
if (res.allowed && res.scope_token) {
|
|
220
235
|
setScopeToken(res.scope_token);
|
|
221
236
|
}
|
package/dist/guardrails.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"guardrails.js","sourceRoot":"","sources":["../src/guardrails.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChE,OAAO,EAAE,aAAa,EAAkB,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"guardrails.js","sourceRoot":"","sources":["../src/guardrails.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChE,OAAO,EAAE,aAAa,EAAkB,MAAM,kBAAkB,CAAC;AACjE,OAAO,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AAEtF,oFAAoF;AACpF,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAE/D,qEAAqE;AAErE;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,MAAoB,EACpB,IAAY,EACZ,YAAqB,EACrB,YAAo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I,EAAE;QACvC,MAAM,UAAU,GAAG,aAAa,EAAE,CAAC;QACnC,MAAM,WAAW,GAA4B,EAAE,GAAG,QAAQ,EAAE,CAAC;QAC7D,IAAI,UAAU,IAAI,UAAU,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC9C,WAAW,CAAC,WAAW,GAAG;gBACxB,gBAAgB,EAAE,UAAU,CAAC,KAAK;gBAClC,mBAAmB,EAAE,UAAU,CAAC,OAAO;aACxC,CAAC;QACJ,CAAC;QAED,IAAI,CAAC;YACH,kEAAkE;YAClE,+DAA+D;YAC/D,gEAAgE;YAChE,6DAA6D;YAC7D,8CAA8C;YAC9C,MAAM,cAAc,GAAG,sBAAsB,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;YAC5D,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,KAAK,CAAC,QAAQ,EAAE,WAAW,EAAE,SAAS,EAAE,SAAS,EAAE,cAAc,EAAE,eAAe,CAAC,CAAC;YAC7G,mBAAmB,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;YACnC,IAAI,GAAG,CAAC,OAAO,IAAI,GAAG,CAAC,WAAW,EAAE,CAAC;gBACnC,aAAa,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;YACjC,CAAC;YACD,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC;gBACjB,MAAM,IAAI,kBAAkB,CAAC,GAAG,CAAC,CAAC;YACpC,CAAC;QACH,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,IAAI,CAAC,YAAY,kBAAkB;gBAAE,MAAM,CAAC,CAAC;YAC7C,IAAI,CAAC,QAAQ;gBAAE,MAAM,CAAC,CAAC;QACzB,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -31,9 +31,9 @@ export type { ScopeTokenClaims } from "./tool-verify.js";
|
|
|
31
31
|
export { ClampdClient, type ClampdClientOptions } from "./client.js";
|
|
32
32
|
export { makeAgentJwt } from "./auth.js";
|
|
33
33
|
export type { ProxyResponse, ScanResponse, ScanOutputResponse } from "./client.js";
|
|
34
|
-
export { registerTool, type RegisterToolOptions } from "./register.js";
|
|
34
|
+
export { registerTool, type RegisterToolOptions, type RegisterToolClassificationOptions, type RegisterToolClassificationOnly, } from "./register.js";
|
|
35
35
|
export { TAXONOMY, validateClassification, computeScope, type ToolClassification, type CategorySpec, type SubcategorySpec, } from "./taxonomy.js";
|
|
36
|
-
export { ClampdClassificationError } from "./errors.js";
|
|
36
|
+
export { ClampdClassificationError, ClampdUnregisteredToolError, ClampdDescriptorMismatchError } from "./errors.js";
|
|
37
37
|
export { contractHash, type ToolContract } from "./contract-hash.js";
|
|
38
38
|
declare function guard<TArgs extends unknown[], TReturn>(fn: (...args: TArgs) => Promise<TReturn>, opts: GuardOptions): (...args: TArgs) => Promise<TReturn>;
|
|
39
39
|
declare function tools(toolDefs: OpenAITool[], opts: WrapOptions): OpenAITool[];
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAGH,OAAO,EAAsB,KAAK,UAAU,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAGH,OAAO,EAAsB,KAAK,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEvE,OAAO,EAAiC,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACnF,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAG/D,OAAO,EAAa,IAAI,EAAE,MAAM,EAAmB,KAAK,YAAY,EAAE,KAAK,WAAW,EAAE,MAAM,aAAa,CAAC;AAG5G,OAAO,EAAE,YAAY,IAAI,aA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