@clampd/sdk 0.14.0 → 0.15.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.
- package/dist/_frameworkAdapters.d.ts +93 -0
- package/dist/_frameworkAdapters.d.ts.map +1 -0
- package/dist/_frameworkAdapters.js +177 -0
- package/dist/_frameworkAdapters.js.map +1 -0
- package/dist/errors.d.ts +23 -0
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +28 -0
- package/dist/errors.js.map +1 -1
- package/dist/generated/taxonomy-data.d.ts +4 -0
- package/dist/generated/taxonomy-data.d.ts.map +1 -1
- package/dist/generated/taxonomy-data.js +36 -36
- package/dist/generated/taxonomy-data.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 +37 -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 +58 -7
- package/dist/register.d.ts.map +1 -1
- package/dist/register.js +98 -33
- package/dist/register.js.map +1 -1
- package/dist/stream-guard.d.ts.map +1 -1
- package/dist/stream-guard.js +7 -1
- package/dist/stream-guard.js.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,93 @@
|
|
|
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
|
|
64
|
+
* {@link ClampdUnregisteredToolError} if the gateway denied the call
|
|
65
|
+
* specifically because the tool descriptor is missing or unclassified.
|
|
66
|
+
*
|
|
67
|
+
* No-op for any other denial reason — the caller is expected to throw
|
|
68
|
+
* its own {@link ClampdBlockedError} downstream.
|
|
69
|
+
*
|
|
70
|
+
* Detection is string-prefix on `denial_reason`:
|
|
71
|
+
*
|
|
72
|
+
* - `tool_not_registered:<name>` — descriptor missing entirely
|
|
73
|
+
* - `tool_not_classified:<name>` — descriptor exists but rejected
|
|
74
|
+
* classification at registration time
|
|
75
|
+
*
|
|
76
|
+
* Mirrors the prefix scheme used by the Python SDK's
|
|
77
|
+
* `_raise_if_unregistered`.
|
|
78
|
+
*/
|
|
79
|
+
export declare function raiseIfUnregistered(toolName: string, resp: ProxyResponse | undefined): void;
|
|
80
|
+
/**
|
|
81
|
+
* Maps `toolName -> contractHash` for every successful
|
|
82
|
+
* `registerTool()` call in this process. The OpenAI / Anthropic /
|
|
83
|
+
* LangChain wrappers prefer this cached hash over computing one on
|
|
84
|
+
* the fly — that way the hash sent to the gateway exactly matches
|
|
85
|
+
* the hash that was registered, even when the wrapper has incomplete
|
|
86
|
+
* information about the tool's parameter schema (e.g. LangChain
|
|
87
|
+
* callbacks don't surface the pydantic schema through `serialized`).
|
|
88
|
+
*
|
|
89
|
+
* Mirrors `clampd._framework_adapters._registered_descriptors` in the
|
|
90
|
+
* Python SDK.
|
|
91
|
+
*/
|
|
92
|
+
export declare const _registeredDescriptors: Map<string, string>;
|
|
93
|
+
//# 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;AAKjD;;;;;;;;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;AAID;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,aAAa,GAAG,SAAS,GAC9B,IAAI,CAUN;AAID;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,sBAAsB,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAa,CAAC"}
|
|
@@ -0,0 +1,177 @@
|
|
|
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 { 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
|
+
// ── Unregistered-tool detection ─────────────────────────────────────
|
|
135
|
+
/**
|
|
136
|
+
* Inspect a {@link ProxyResponse} and throw
|
|
137
|
+
* {@link ClampdUnregisteredToolError} if the gateway denied the call
|
|
138
|
+
* specifically because the tool descriptor is missing or unclassified.
|
|
139
|
+
*
|
|
140
|
+
* No-op for any other denial reason — the caller is expected to throw
|
|
141
|
+
* its own {@link ClampdBlockedError} downstream.
|
|
142
|
+
*
|
|
143
|
+
* Detection is string-prefix on `denial_reason`:
|
|
144
|
+
*
|
|
145
|
+
* - `tool_not_registered:<name>` — descriptor missing entirely
|
|
146
|
+
* - `tool_not_classified:<name>` — descriptor exists but rejected
|
|
147
|
+
* classification at registration time
|
|
148
|
+
*
|
|
149
|
+
* Mirrors the prefix scheme used by the Python SDK's
|
|
150
|
+
* `_raise_if_unregistered`.
|
|
151
|
+
*/
|
|
152
|
+
export function raiseIfUnregistered(toolName, resp) {
|
|
153
|
+
if (!resp || resp.allowed)
|
|
154
|
+
return;
|
|
155
|
+
const reason = resp.denial_reason;
|
|
156
|
+
if (typeof reason !== "string")
|
|
157
|
+
return;
|
|
158
|
+
if (reason.startsWith("tool_not_registered:") ||
|
|
159
|
+
reason.startsWith("tool_not_classified:")) {
|
|
160
|
+
throw new ClampdUnregisteredToolError(toolName);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
// ── Process-local descriptor cache ──────────────────────────────────
|
|
164
|
+
/**
|
|
165
|
+
* Maps `toolName -> contractHash` for every successful
|
|
166
|
+
* `registerTool()` call in this process. The OpenAI / Anthropic /
|
|
167
|
+
* LangChain wrappers prefer this cached hash over computing one on
|
|
168
|
+
* the fly — that way the hash sent to the gateway exactly matches
|
|
169
|
+
* the hash that was registered, even when the wrapper has incomplete
|
|
170
|
+
* information about the tool's parameter schema (e.g. LangChain
|
|
171
|
+
* callbacks don't surface the pydantic schema through `serialized`).
|
|
172
|
+
*
|
|
173
|
+
* Mirrors `clampd._framework_adapters._registered_descriptors` in the
|
|
174
|
+
* Python SDK.
|
|
175
|
+
*/
|
|
176
|
+
export const _registeredDescriptors = new Map();
|
|
177
|
+
//# sourceMappingURL=_frameworkAdapters.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_frameworkAdapters.js","sourceRoot":"","sources":["../src/_frameworkAdapters.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAGH,OAAO,EAAE,2BAA2B,EAAE,MAAM,aAAa,CAAC;AAmB1D,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,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC;QACnB,IAAI,CAAC,EAAE,YAAY,EAAE,CAAC;YACpB,MAAM,GAAG,GAAG,CAAC,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;YACnC,IAAI,GAAG,IAAI,OAAO,GAAG,KAAK,QAAQ;gBAAE,OAAO,GAAa,CAAC;QAC3D,CAAC;IACH,CAAC;IAAC,MAAM,CAAC;QACP,8DAA8D;QAC9D,qCAAqC;IACvC,CAAC;IACD,OAAO,EAAE,CAAC;AACZ,CAAC;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,qBAAqB,CAAC,KAAc;IAClD,IAAI,CAAC,KAAK,I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M,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;YACzC,cAAc;YACd,MAAM,QAAQ,GAAG,MAA6C,CAAC;YAC/D,IAAI,QAAQ,CAAC,IAAI,IAAI,OAAO,QAAQ,CAAC,KAAK,KAAK,UAAU,EAAE,CAAC;gBAC1D,WAAW,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC;YACxC,CAAC;iBAAM,CAAC;gBACN,WAAW,GAAG,MAAgB,CAAC;YACjC,CAAC;QACH,CAAC;aAAM,CAAC;YACN,WAAW,GAAG,EAAE,CAAC;QACnB,CAAC;QACD,OAAO;YACL,IAAI,EAAE,CAAC,CAAC,IAAI;YACZ,WAAW,EAAE,OAAO,CAAC,CAAC,WAAW,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE;YACnE,WAAW;SACZ,CAAC;IACJ,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAED,uEAAuE;AAEvE;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,mBAAmB,CACjC,QAAgB,EAChB,IAA+B;IAE/B,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,OAAO;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;AACH,CAAC;AAED,uEAAuE;AAEvE;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAwB,IAAI,GAAG,EAAE,CAAC"}
|
package/dist/errors.d.ts
CHANGED
|
@@ -26,4 +26,27 @@ 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
|
+
}
|
|
29
52
|
//# 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"}
|
package/dist/errors.js
CHANGED
|
@@ -35,4 +35,32 @@ 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
|
+
}
|
|
38
66
|
//# 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,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC7B,CAAC;CACF;AAED;;;;;;;;;;;;;;;GAeG;AACH,MAAM,OAAO,2BAA4B,SAAQ,KAAK;IACpC,QAAQ,CAAS;IACjB,IAAI,CAAS;IAE7B,YAAY,QAAgB,EAAE,IAAwB;QACpD,MAAM,IAAI,GACR,IAAI,EAAE,IAAI;YACV,6BAA6B,QAAQ,+DAA+D,CAAC;QACvG,KAAK,CAAC,SAAS,QAAQ,oCAAoC,IAAI,EAAE,CAAC,CAAC;QACnE,IAAI,CAAC,IAAI,GAAG,6BAA6B,CAAC;QAC1C,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF"}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
export interface SubcategorySpec {
|
|
2
2
|
readonly operations: readonly string[];
|
|
3
|
+
/** Subset of `operations` that mean external-egress (data leaving the org boundary). */
|
|
4
|
+
readonly egress: readonly string[];
|
|
5
|
+
/** Subset of `operations` that ALWAYS produce sensitive data. Sets sticky session-level taint flag. */
|
|
6
|
+
readonly sensitive_source: readonly string[];
|
|
3
7
|
}
|
|
4
8
|
export interface CategorySpec {
|
|
5
9
|
readonly description: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"taxonomy-data.d.ts","sourceRoot":"","sources":["../../src/generated/taxonomy-data.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,UAAU,EAAE,SAAS,MAAM,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"taxonomy-data.d.ts","sourceRoot":"","sources":["../../src/generated/taxonomy-data.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,UAAU,EAAE,SAAS,MAAM,EAAE,CAAC;IACvC,wFAAwF;IACxF,QAAQ,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC,uGAAuG;IACvG,QAAQ,CAAC,gBAAgB,EAAE,SAAS,MAAM,EAAE,CAAC;CAC9C;AAED,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;CACzD;AAED,eAAO,MAAM,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAiGjD,CAAC"}
|
|
@@ -7,97 +7,97 @@ export const TAXONOMY = {
|
|
|
7
7
|
agent: {
|
|
8
8
|
description: "Agent delegation, A2A handoff, spawn",
|
|
9
9
|
subcategories: {
|
|
10
|
-
a2a: { operations: ["read", "write"] },
|
|
11
|
-
config: { operations: ["read", "write"] },
|
|
12
|
-
delegate: { operations: ["write"] },
|
|
13
|
-
spawn: { operations: ["write"] },
|
|
10
|
+
a2a: { operations: ["read", "write"], egress: [], sensitive_source: [] },
|
|
11
|
+
config: { operations: ["read", "write"], egress: [], sensitive_source: [] },
|
|
12
|
+
delegate: { operations: ["write"], egress: [], sensitive_source: [] },
|
|
13
|
+
spawn: { operations: ["write"], egress: [], sensitive_source: [] },
|
|
14
14
|
},
|
|
15
15
|
},
|
|
16
16
|
auth: {
|
|
17
17
|
description: "Secrets, credentials, tokens, OAuth flows",
|
|
18
18
|
subcategories: {
|
|
19
|
-
credential: { operations: ["read", "write", "delete"] },
|
|
20
|
-
oauth: { operations: ["read", "write"] },
|
|
21
|
-
secret: { operations: ["read", "write", "delete"] },
|
|
22
|
-
token: { operations: ["read", "write", "delete", "refresh"] },
|
|
19
|
+
credential: { operations: ["read", "write", "delete"], egress: [], sensitive_source: ["read"] },
|
|
20
|
+
oauth: { operations: ["read", "write"], egress: [], sensitive_source: ["read"] },
|
|
21
|
+
secret: { operations: ["read", "write", "delete"], egress: [], sensitive_source: ["read"] },
|
|
22
|
+
token: { operations: ["read", "write", "delete", "refresh"], egress: [], sensitive_source: ["read"] },
|
|
23
23
|
},
|
|
24
24
|
},
|
|
25
25
|
browser: {
|
|
26
26
|
description: "Browser automation, page navigation, scraping",
|
|
27
27
|
subcategories: {
|
|
28
|
-
page: { operations: ["read", "write"] },
|
|
29
|
-
screenshot: { operations: ["read"] },
|
|
28
|
+
page: { operations: ["read", "write"], egress: [], sensitive_source: [] },
|
|
29
|
+
screenshot: { operations: ["read"], egress: [], sensitive_source: [] },
|
|
30
30
|
},
|
|
31
31
|
},
|
|
32
32
|
cloud: {
|
|
33
33
|
description: "Cloud infra, deploys, IAM, object storage",
|
|
34
34
|
subcategories: {
|
|
35
|
-
deploy: { operations: ["read", "write", "destructive"] },
|
|
36
|
-
iam: { operations: ["read", "write", "delete"] },
|
|
37
|
-
infra: { operations: ["read", "write", "destructive"] },
|
|
35
|
+
deploy: { operations: ["read", "write", "destructive"], egress: [], sensitive_source: [] },
|
|
36
|
+
iam: { operations: ["read", "write", "delete"], egress: [], sensitive_source: ["read"] },
|
|
37
|
+
infra: { operations: ["read", "write", "destructive"], egress: [], sensitive_source: [] },
|
|
38
38
|
},
|
|
39
39
|
},
|
|
40
40
|
comms: {
|
|
41
41
|
description: "Email, chat, SMS, notifications — anything agent says to humans or other systems",
|
|
42
42
|
subcategories: {
|
|
43
|
-
email: { operations: ["read", "send", "delete"] },
|
|
44
|
-
messaging: { operations: ["read", "send", "delete"] },
|
|
45
|
-
notification: { operations: ["send"] },
|
|
46
|
-
slack: { operations: ["read", "send", "delete"] },
|
|
47
|
-
sms: { operations: ["read", "send"] },
|
|
43
|
+
email: { operations: ["read", "send", "delete"], egress: ["send"], sensitive_source: [] },
|
|
44
|
+
messaging: { operations: ["read", "send", "delete"], egress: ["send"], sensitive_source: [] },
|
|
45
|
+
notification: { operations: ["send"], egress: ["send"], sensitive_source: [] },
|
|
46
|
+
slack: { operations: ["read", "send", "delete"], egress: ["send"], sensitive_source: [] },
|
|
47
|
+
sms: { operations: ["read", "send"], egress: ["send"], sensitive_source: [] },
|
|
48
48
|
},
|
|
49
49
|
},
|
|
50
50
|
db: {
|
|
51
51
|
description: "Database queries, mutations, schema operations",
|
|
52
52
|
subcategories: {
|
|
53
|
-
mutate: { operations: ["write", "delete", "destructive"] },
|
|
54
|
-
query: { operations: ["read"] },
|
|
55
|
-
schema: { operations: ["read", "destructive"] },
|
|
53
|
+
mutate: { operations: ["write", "delete", "destructive"], egress: [], sensitive_source: [] },
|
|
54
|
+
query: { operations: ["read"], egress: [], sensitive_source: [] },
|
|
55
|
+
schema: { operations: ["read", "destructive"], egress: [], sensitive_source: ["read"] },
|
|
56
56
|
},
|
|
57
57
|
},
|
|
58
58
|
exec: {
|
|
59
59
|
description: "Shell commands, code evaluation, function invocation",
|
|
60
60
|
subcategories: {
|
|
61
|
-
code: { operations: ["run"] },
|
|
62
|
-
function: { operations: ["run"] },
|
|
63
|
-
shell: { operations: ["run", "destructive"] },
|
|
61
|
+
code: { operations: ["run"], egress: [], sensitive_source: [] },
|
|
62
|
+
function: { operations: ["run"], egress: [], sensitive_source: [] },
|
|
63
|
+
shell: { operations: ["run", "destructive"], egress: [], sensitive_source: [] },
|
|
64
64
|
},
|
|
65
65
|
},
|
|
66
66
|
fs: {
|
|
67
67
|
description: "Filesystem, blob / object storage",
|
|
68
68
|
subcategories: {
|
|
69
|
-
blob: { operations: ["read", "write", "delete"] },
|
|
70
|
-
file: { operations: ["read", "write", "delete"] },
|
|
69
|
+
blob: { operations: ["read", "write", "delete"], egress: ["write"], sensitive_source: [] },
|
|
70
|
+
file: { operations: ["read", "write", "delete"], egress: [], sensitive_source: [] },
|
|
71
71
|
},
|
|
72
72
|
},
|
|
73
73
|
llm: {
|
|
74
74
|
description: "LLM prompt / completion, embeddings",
|
|
75
75
|
subcategories: {
|
|
76
|
-
embedding: { operations: ["read", "write"] },
|
|
77
|
-
input: { operations: ["write"] },
|
|
78
|
-
output: { operations: ["read"] },
|
|
76
|
+
embedding: { operations: ["read", "write"], egress: [], sensitive_source: [] },
|
|
77
|
+
input: { operations: ["write"], egress: [], sensitive_source: [] },
|
|
78
|
+
output: { operations: ["read"], egress: [], sensitive_source: [] },
|
|
79
79
|
},
|
|
80
80
|
},
|
|
81
81
|
net: {
|
|
82
82
|
description: "HTTP, webhooks, raw-socket, DNS",
|
|
83
83
|
subcategories: {
|
|
84
|
-
dns: { operations: ["read"] },
|
|
85
|
-
http: { operations: ["read", "write"] },
|
|
86
|
-
socket: { operations: ["read", "write"] },
|
|
84
|
+
dns: { operations: ["read"], egress: [], sensitive_source: [] },
|
|
85
|
+
http: { operations: ["read", "write"], egress: ["write"], sensitive_source: [] },
|
|
86
|
+
socket: { operations: ["read", "write"], egress: ["write"], sensitive_source: [] },
|
|
87
87
|
},
|
|
88
88
|
},
|
|
89
89
|
payment: {
|
|
90
90
|
description: "Payments, billing, refunds, financial transactions",
|
|
91
91
|
subcategories: {
|
|
92
|
-
billing: { operations: ["read", "write"] },
|
|
93
|
-
invoice: { operations: ["read", "write"] },
|
|
94
|
-
transaction: { operations: ["read", "write", "destructive"] },
|
|
92
|
+
billing: { operations: ["read", "write"], egress: [], sensitive_source: [] },
|
|
93
|
+
invoice: { operations: ["read", "write"], egress: [], sensitive_source: [] },
|
|
94
|
+
transaction: { operations: ["read", "write", "destructive"], egress: [], sensitive_source: [] },
|
|
95
95
|
},
|
|
96
96
|
},
|
|
97
97
|
scm: {
|
|
98
98
|
description: "Git / VCS — push, commit, branch management",
|
|
99
99
|
subcategories: {
|
|
100
|
-
git: { operations: ["read", "write", "delete"] },
|
|
100
|
+
git: { operations: ["read", "write", "delete"], egress: [], sensitive_source: [] },
|
|
101
101
|
},
|
|
102
102
|
},
|
|
103
103
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"taxonomy-data.js","sourceRoot":"","sources":["../../src/generated/taxonomy-data.ts"],"names":[],"mappings":"AAAA,oEAAoE;AACpE,sEAAsE;AACtE,mEAAmE;AACnE,wEAAwE;AACxE,oCAAoC;
|
|
1
|
+
{"version":3,"file":"taxonomy-data.js","sourceRoot":"","sources":["../../src/generated/taxonomy-data.ts"],"names":[],"mappings":"AAAA,oEAAoE;AACpE,sEAAsE;AACtE,mEAAmE;AACnE,wEAAwE;AACxE,oCAAoC;AAepC,MAAM,CAAC,MAAM,QAAQ,GAAiC;IACpD,KAAK,EAAE;QACL,WAAW,EAAE,sCAAsC;QACnD,aAAa,EAAE;YACb,GAAG,EAAE,EAAE,UAAU,EAAE,CAAC,MAAM,EAAE,OAAO,CAAU,EAAE,MAAM,EAAE,EAAW,EAAE,gBAAgB,EAAE,EAAW,EAAE;YACnG,MAAM,EAAE,EAAE,UAAU,EAAE,CAAC,MAAM,EAAE,OAAO,CAAU,EAAE,MAAM,EAAE,EAAW,EAAE,gBAAgB,EAAE,EAAW,EAAE;YACtG,QAAQ,EAAE,EAAE,UAAU,EAAE,CAAC,OAAO,CAAU,EAAE,MAAM,EAAE,EAAW,EAAE,gBAAgB,EAAE,EAAW,EAAE;YAChG,KAAK,EAAE,EAAE,UAAU,EAAE,CAAC,OAAO,CAAU,EAAE,MAAM,EAAE,EAAW,EAAE,gBAAgB,EAAE,EAAW,EAAE;SAC9F;KACF;IACD,IAAI,EAAE;QACJ,WAAW,EAAE,2CAA2C;QACxD,aAAa,EAAE;YACb,UAAU,EAAE,EAAE,UAAU,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,QAAQ,CAAU,EAAE,MAAM,EAAE,EAAW,EAAE,gBAAgB,EAAE,CAAC,MAAM,CAAU,EAAE;YAC1H,KAAK,EAAE,EAAE,UAAU,EAAE,CAAC,MAAM,EAAE,OAAO,CAAU,EAAE,MAAM,EAAE,EAAW,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AM,EAAE,EAAW,EAAE,gBAAgB,EAAE,EAAW,EAAE;YAC1F,IAAI,EAAE,EAAE,UAAU,EAAE,CAAC,MAAM,EAAE,OAAO,CAAU,EAAE,MAAM,EAAE,CAAC,OAAO,CAAU,EAAE,gBAAgB,EAAE,EAAW,EAAE;YAC3G,MAAM,EAAE,EAAE,UAAU,EAAE,CAAC,MAAM,EAAE,OAAO,CAAU,EAAE,MAAM,EAAE,CAAC,OAAO,CAAU,EAAE,gBAAgB,EAAE,EAAW,EAAE;SAC9G;KACF;IACD,OAAO,EAAE;QACP,WAAW,EAAE,oDAAoD;QACjE,aAAa,EAAE;YACb,OAAO,EAAE,EAAE,UAAU,EAAE,CAAC,MAAM,EAAE,OAAO,CAAU,EAAE,MAAM,EAAE,EAAW,EAAE,gBAAgB,EAAE,EAAW,EAAE;YACvG,OAAO,EAAE,EAAE,UAAU,EAAE,CAAC,MAAM,EAAE,OAAO,CAAU,EAAE,MAAM,EAAE,EAAW,EAAE,gBAAgB,EAAE,EAAW,EAAE;YACvG,WAAW,EAAE,EAAE,UAAU,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,aAAa,CAAU,EAAE,MAAM,EAAE,EAAW,EAAE,gBAAgB,EAAE,EAAW,EAAE;SAC3H;KACF;IACD,GAAG,EAAE;QACH,WAAW,EAAE,6CAA6C;QAC1D,aAAa,EAAE;YACb,GAAG,EAAE,EAAE,UAAU,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,QAAQ,CAAU,EAAE,MAAM,EAAE,EAAW,EAAE,gBAAgB,EAAE,EAAW,EAAE;SAC9G;KACF;CACF,CAAC"}
|
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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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,YAAoB,EAAE,EACtB,WAAoB,KAAK,EACzB,aAAqB,EAAE;IAEvB,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,YAAY,EAAE,SAAS,IAAI,SAAS,EAAE,UAAU,IAAI,SAAS,CAAC,CAAC;QACtG,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC;YACjB,MAAM,IAAI,kBAAkB,CAAC,GAAG,CAAC,CAAC;QACpC,CAAC;IACH,CAAC;IAAC,OAAO,CAAC,EAAE,CA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