@friskai/frisk-js 0.1.5 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +38 -1
- package/dist/adapters/claude/claude-framework-adapter/claude-framework-adapter.d.ts +95 -0
- package/dist/adapters/claude/claude-framework-adapter/claude-framework-adapter.d.ts.map +1 -0
- package/dist/adapters/claude/claude-framework-adapter/wrap-tool-with-llm-reasoning.d.ts +4 -0
- package/dist/adapters/claude/claude-framework-adapter/wrap-tool-with-llm-reasoning.d.ts.map +1 -0
- package/dist/adapters/claude/frisk-claude-session.d.ts +29 -0
- package/dist/adapters/claude/frisk-claude-session.d.ts.map +1 -0
- package/dist/adapters/claude/frisk-claude.d.ts +71 -0
- package/dist/adapters/claude/frisk-claude.d.ts.map +1 -0
- package/dist/adapters/claude/index.d.ts +3 -0
- package/dist/adapters/claude/index.d.ts.map +1 -0
- package/dist/adapters/claude/index.js +73701 -0
- package/dist/adapters/claude/index.js.map +494 -0
- package/dist/adapters/claude/resolve-claude-tool-name.d.ts +2 -0
- package/dist/adapters/claude/resolve-claude-tool-name.d.ts.map +1 -0
- package/dist/adapters/index.d.ts +1 -1
- package/dist/adapters/index.d.ts.map +1 -1
- package/dist/adapters/langchain/frisk-langchain.d.ts +37 -6
- package/dist/adapters/langchain/frisk-langchain.d.ts.map +1 -1
- package/dist/adapters/langchain/frisk-tool-middleware.d.ts +2 -2
- package/dist/adapters/langchain/frisk-tool-middleware.d.ts.map +1 -1
- package/dist/adapters/langchain/index.d.ts +2 -1
- package/dist/adapters/langchain/index.d.ts.map +1 -1
- package/dist/adapters/langchain/index.js +30 -11
- package/dist/adapters/langchain/index.js.map +16 -15
- package/dist/adapters/langchain/langchain-framework-adapter/langchain-framework-adapter.d.ts.map +1 -1
- package/dist/adapters/langchain/langchain-framework-adapter/wrapToolWithLlmReasoning.d.ts.map +1 -1
- package/dist/core/access-token-provider.d.ts +2 -2
- package/dist/core/access-token-provider.d.ts.map +1 -1
- package/dist/core/frisk-session.d.ts +4 -4
- package/dist/core/frisk-session.d.ts.map +1 -1
- package/dist/core/frisk.d.ts +8 -8
- package/dist/core/frisk.d.ts.map +1 -1
- package/dist/core/llm-reasoning/constants.d.ts +3 -1
- package/dist/core/llm-reasoning/constants.d.ts.map +1 -1
- package/dist/core/redaction-options.d.ts +3 -3
- package/dist/core/tool-call-span.d.ts +1 -1
- package/dist/core/types.d.ts +5 -5
- package/dist/core/types.d.ts.map +1 -1
- package/dist/index.d.ts +7 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +16212 -11
- package/dist/index.js.map +23 -15
- package/dist/logging/index.d.ts +1 -1
- package/dist/logging/index.d.ts.map +1 -1
- package/dist/logging/types.d.ts +1 -1
- package/dist/logging/types.d.ts.map +1 -1
- package/dist/telemetry/constants.d.ts +1 -0
- package/dist/telemetry/constants.d.ts.map +1 -1
- package/dist/utils/create-frisk-tool-call-id.d.ts +2 -0
- package/dist/utils/create-frisk-tool-call-id.d.ts.map +1 -0
- package/dist/utils/is-plain-object.d.ts +2 -0
- package/dist/utils/is-plain-object.d.ts.map +1 -0
- package/native/frisk-js.darwin-arm64.node +0 -0
- package/native/frisk-js.darwin-x64.node +0 -0
- package/native/frisk-js.linux-arm64-gnu.node +0 -0
- package/native/frisk-js.linux-arm64-musl.node +0 -0
- package/native/{frisk-js.node → frisk-js.linux-x64-gnu.node} +0 -0
- package/native/frisk-js.linux-x64-musl.node +0 -0
- package/native/frisk-js.win32-arm64-msvc.node +0 -0
- package/native/frisk-js.win32-x64-msvc.node +0 -0
- package/native/index.cjs +52 -52
- package/package.json +17 -2
- package/dist/env/mocks/mockEnv.d.ts +0 -13
- package/dist/env/mocks/mockEnv.d.ts.map +0 -1
- package/dist/telemetry/mocks/index.d.ts +0 -6
- package/dist/telemetry/mocks/index.d.ts.map +0 -1
- package/dist/telemetry/mocks/mockTracer.d.ts +0 -38
- package/dist/telemetry/mocks/mockTracer.d.ts.map +0 -1
- package/dist/telemetry/mocks/mockTracingManager.d.ts +0 -57
- package/dist/telemetry/mocks/mockTracingManager.d.ts.map +0 -1
package/README.md
CHANGED
|
@@ -13,7 +13,7 @@ import { createAgent } from 'langchain'
|
|
|
13
13
|
const frisk = await Frisk.connect({ /* apiKey: process.env.FRISK_API_KEY (default) */ })
|
|
14
14
|
const agent = createAgent({
|
|
15
15
|
stateSchema: yourStateSchema,
|
|
16
|
-
// Collect LLM reasoning for every tool call
|
|
16
|
+
// Optional: Collect LLM reasoning for every tool call
|
|
17
17
|
tools: frisk.wrapTools(yourTools),
|
|
18
18
|
// Block unwanted tool calls using middleware
|
|
19
19
|
middleware: [frisk.guard({ stateSchema: yourSchema })]
|
|
@@ -32,4 +32,41 @@ await agent.invoke(
|
|
|
32
32
|
context: session.context
|
|
33
33
|
},
|
|
34
34
|
)
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Claude Agent SDK
|
|
38
|
+
|
|
39
|
+
```typescript
|
|
40
|
+
import { Frisk } from '@friskai/frisk-js/claude'
|
|
41
|
+
import { query, createSdkMcpServer } from '@anthropic-ai/claude-agent-sdk'
|
|
42
|
+
|
|
43
|
+
/*
|
|
44
|
+
One-time setup
|
|
45
|
+
*/
|
|
46
|
+
const frisk = await Frisk.connect({ /* apiKey: process.env.FRISK_API_KEY (default) */})
|
|
47
|
+
|
|
48
|
+
/*
|
|
49
|
+
Optional: Collect LLM reasoning for every tool call.
|
|
50
|
+
MCP Servers created with `createSdkMcpServer` are currently supported.
|
|
51
|
+
*/
|
|
52
|
+
const friskWrappedTools = createSdkMcpServer({
|
|
53
|
+
name: 'your-tools',
|
|
54
|
+
version: '1.0.0',
|
|
55
|
+
tools: frisk.wrapTools(yourTools)
|
|
56
|
+
})
|
|
57
|
+
|
|
58
|
+
/*
|
|
59
|
+
Per-request setup
|
|
60
|
+
*/
|
|
61
|
+
const session = frisk.session({ /* Optional: application state, e.g. userId, organizationId, etc. */ })
|
|
62
|
+
await query({
|
|
63
|
+
prompt,
|
|
64
|
+
options: {
|
|
65
|
+
// Collect telemetry for this agent invocation.
|
|
66
|
+
hooks: session.hooks(),
|
|
67
|
+
// Wrapping a tool does not alter the name of the tool or its MCP server
|
|
68
|
+
mcpServers: { 'your-tools': friskWrappedTools },
|
|
69
|
+
allowedTools: ['mcp__your-tools__*'],
|
|
70
|
+
}
|
|
71
|
+
})
|
|
35
72
|
```
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @friskai/frisk-js Claude Framework Adapter
|
|
3
|
+
*
|
|
4
|
+
* Framework adapter for Claude integration.
|
|
5
|
+
* Handles Claude-specific tool calls, serialization, and tool wrapping.
|
|
6
|
+
*/
|
|
7
|
+
import { SdkMcpToolDefinition } from '@anthropic-ai/claude-agent-sdk';
|
|
8
|
+
import { ZodRawShape } from 'zod';
|
|
9
|
+
import { FrameworkAdapter, ToolCallInfo, WrapToolOptions } from '../../../framework-adapter/framework-adapter';
|
|
10
|
+
import type { RedactedDictionary, RedactedSerializedObject, RedactOption } from '../../../utils/redact';
|
|
11
|
+
/**
|
|
12
|
+
* Claude ToolCall type
|
|
13
|
+
* Represents a tool call from Claude messages
|
|
14
|
+
*/
|
|
15
|
+
export interface ClaudeToolCall {
|
|
16
|
+
id?: string;
|
|
17
|
+
name: string;
|
|
18
|
+
args: Record<string, unknown>;
|
|
19
|
+
type?: string;
|
|
20
|
+
}
|
|
21
|
+
/** Placeholder type for Claude tool objects accepted by this adapter. */
|
|
22
|
+
export interface ClaudeTool {
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Claude framework adapter
|
|
26
|
+
*
|
|
27
|
+
* Provides Claude-specific implementation of the FrameworkAdapter interface.
|
|
28
|
+
* Handles ToolCall objects, message serialization, and tool wrapping.
|
|
29
|
+
*
|
|
30
|
+
*/
|
|
31
|
+
export declare class ClaudeFrameworkAdapter implements FrameworkAdapter<ClaudeToolCall, ClaudeTool> {
|
|
32
|
+
/**
|
|
33
|
+
* Serialize tool arguments to JSON with optional redaction
|
|
34
|
+
*/
|
|
35
|
+
serializeToolArgs(toolArgs: Record<string, unknown> | null | undefined, options?: {
|
|
36
|
+
redact?: RedactOption;
|
|
37
|
+
}): RedactedSerializedObject;
|
|
38
|
+
/**
|
|
39
|
+
* Serialize agent state to JSON with optional redaction.
|
|
40
|
+
*
|
|
41
|
+
* This implementation delegates to {@link agentStateToDict} to apply any
|
|
42
|
+
* provided redaction options before serializing the result.
|
|
43
|
+
*/
|
|
44
|
+
serializeAgentState(agentState: Record<string, unknown> | null | undefined, options?: {
|
|
45
|
+
redact?: RedactOption;
|
|
46
|
+
}): RedactedSerializedObject;
|
|
47
|
+
/**
|
|
48
|
+
* Convert tool arguments to dictionary with optional redaction
|
|
49
|
+
*/
|
|
50
|
+
toolArgsToDict(toolArgs: Record<string, unknown>, options?: {
|
|
51
|
+
redact?: RedactOption;
|
|
52
|
+
}): RedactedDictionary;
|
|
53
|
+
/**
|
|
54
|
+
* Convert agent state to dictionary with optional redaction.
|
|
55
|
+
*
|
|
56
|
+
* Applies the provided redact option directly to the agent state object.
|
|
57
|
+
*/
|
|
58
|
+
agentStateToDict(agentState: Record<string, unknown>, options?: {
|
|
59
|
+
redact?: RedactOption;
|
|
60
|
+
}): RedactedDictionary;
|
|
61
|
+
/**
|
|
62
|
+
* Extract tool call information from a Claude ToolCall
|
|
63
|
+
*/
|
|
64
|
+
normalizeToolCall(toolCall: ClaudeToolCall): ToolCallInfo;
|
|
65
|
+
/**
|
|
66
|
+
* Get the tool call ID or generate one if not present
|
|
67
|
+
*/
|
|
68
|
+
private getOrCreateToolCallId;
|
|
69
|
+
/**
|
|
70
|
+
* Get the tool name from a ToolCall
|
|
71
|
+
*/
|
|
72
|
+
private getToolName;
|
|
73
|
+
/**
|
|
74
|
+
* Extract the user query from agent state
|
|
75
|
+
*
|
|
76
|
+
* Looks for the last human message in the messages array
|
|
77
|
+
*/
|
|
78
|
+
extractPrompt(input: {
|
|
79
|
+
prompt: string;
|
|
80
|
+
}): string | null;
|
|
81
|
+
/**
|
|
82
|
+
* Wrap tools with additional functionality
|
|
83
|
+
*
|
|
84
|
+
* Note: For Frisk policy enforcement, use session.hooks instead.
|
|
85
|
+
* This method provides basic tool wrapping without policy checks.
|
|
86
|
+
*/
|
|
87
|
+
wrapTools(tools: Iterable<SdkMcpToolDefinition<ZodRawShape>>, options?: WrapToolOptions): SdkMcpToolDefinition<ZodRawShape>[];
|
|
88
|
+
/**
|
|
89
|
+
* Wrap tools with additional functionality.
|
|
90
|
+
*
|
|
91
|
+
* This is a passthrough by default. Override in subclasses for custom wrapping.
|
|
92
|
+
*/
|
|
93
|
+
wrapTool(tool: SdkMcpToolDefinition<ZodRawShape>, options?: WrapToolOptions): SdkMcpToolDefinition<ZodRawShape>;
|
|
94
|
+
}
|
|
95
|
+
//# sourceMappingURL=claude-framework-adapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claude-framework-adapter.d.ts","sourceRoot":"","sources":["../../../../src/adapters/claude/claude-framework-adapter/claude-framework-adapter.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAA;AACrE,OAAO,EAAE,WAAW,EAAE,MAAM,KAAK,CAAA;AACjC,OAAO,EAEL,gBAAgB,EAChB,YAAY,EACZ,eAAe,EAChB,MAAM,8CAA8C,CAAA;AAErD,OAAO,KAAK,EACV,kBAAkB,EAClB,wBAAwB,EACxB,YAAY,EACb,MAAM,uBAAuB,CAAA;AAI9B;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAC7B,IAAI,CAAC,EAAE,MAAM,CAAA;CACd;AAED,yEAAyE;AACzE,MAAM,WAAW,UAAU;CAE1B;AAED;;;;;;GAMG;AAC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AAC,EACvC,OAAO,GAAE,eAAwC,GAChD,oBAAoB,CAAC,WAAW,CAAC;CAOrC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { SdkMcpToolDefinition } from '@anthropic-ai/claude-agent-sdk';
|
|
2
|
+
import { ZodRawShape } from 'zod';
|
|
3
|
+
export declare function wrapToolWithLlmReasoning(originalTool: SdkMcpToolDefinition<ZodRawShape>): SdkMcpToolDefinition<ZodRawShape>;
|
|
4
|
+
//# sourceMappingURL=wrap-tool-with-llm-reasoning.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wrap-tool-with-llm-reasoning.d.ts","sourceRoot":"","sources":["../../../../src/adapters/claude/claude-framework-adapter/wrap-tool-with-llm-reasoning.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAQ,MAAM,gCAAgC,CAAA;AAC3E,OAAO,EAAE,WAAW,EAAE,MAAM,KAAK,CAAA;AAKjC,wBAAgB,wBAAwB,CACtC,YAAY,EAAE,oBAAoB,CAAC,WAAW,CAAC,GAC9C,oBAAoB,CAAC,WAAW,CAAC,CAsBnC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type HookCallback, type HookCallbackMatcher, type HookEvent } from '@anthropic-ai/claude-agent-sdk';
|
|
2
|
+
import type { Tracer } from '@opentelemetry/api';
|
|
3
|
+
import { FriskSession, type FriskSessionOptions } from '../../core/frisk-session';
|
|
4
|
+
import type { ResolvedRedactionOptions } from '../../core/redaction-options';
|
|
5
|
+
import { type FriskSDKLoggingOptions } from '../../logging';
|
|
6
|
+
import { FriskClaude, type FriskClaudeAgentState } from './frisk-claude';
|
|
7
|
+
export interface FriskClaudeSessionOptions extends FriskSessionOptions<FriskClaude> {
|
|
8
|
+
frisk: FriskClaude;
|
|
9
|
+
agentState: FriskClaudeAgentState;
|
|
10
|
+
redact: ResolvedRedactionOptions;
|
|
11
|
+
tracer: Tracer;
|
|
12
|
+
logging?: FriskSDKLoggingOptions;
|
|
13
|
+
}
|
|
14
|
+
export interface FriskClaudeHooksOptions {
|
|
15
|
+
controls?: {
|
|
16
|
+
toolPolicies?: boolean;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
export type ClaudeAgentHooks = Partial<Record<HookEvent, HookCallbackMatcher[]>>;
|
|
20
|
+
/** Claude-specific session object exposing context and callback helpers. */
|
|
21
|
+
export declare class FriskClaudeSession extends FriskSession<FriskClaude> {
|
|
22
|
+
private agentState;
|
|
23
|
+
constructor(options: FriskClaudeSessionOptions);
|
|
24
|
+
hooks(options?: FriskClaudeHooksOptions): ClaudeAgentHooks;
|
|
25
|
+
sessionStopHook(): HookCallback;
|
|
26
|
+
userPromptSubmitHook(): HookCallback;
|
|
27
|
+
preToolUseHook(): HookCallback;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=frisk-claude-session.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"frisk-claude-session.d.ts","sourceRoot":"","sources":["../../../src/adapters/claude/frisk-claude-session.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,mBAAmB,EACxB,KAAK,SAAS,EAIf,MAAM,gCAAgC,CAAA;AACvC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAChD,OAAO,EACL,YAAY,EACZ,KAAK,mBAAmB,EACzB,MAAM,0BAA0B,CAAA;AAEjC,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAA;AAE5E,OAAO,EAAE,KAAK,sBAAsB,EAAE,MAAM,eAAe,CAAA;AAC3D,OAAO,EAAE,WAAW,EAAE,KAAK,qBAAqB,EAAE,MAAM,gBAAgB,CAAA;AAGxE,MAAM,WAAW,yBACf,SAAQ,mBAAmB,CAAC,WAAW,CAAC;IACxC,KAAK,EAAE,WAAW,CAAA;IAClB,UAAU,EAAE,qBAAqB,CAAA;IACjC,MAAM,EAAE,wBAAwB,CAAA;IAChC,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,CAAC,EAAE,sBAAsB,CAAA;CACjC;AAED,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,EAAE;QACT,YAAY,CAAC,EAAE,OAAO,CAAA;KACvB,CAAA;CACF;AAED,MAAM,MAAM,gBAAgB,GAAG,OAAO,CAAC,MAAM,CAAC,SAAS,EAAE,mBAAmB,EAAE,CAAC,CAAC,CAAA;AAEhF,4EAA4E;AAC5E,qBAAa,kBAAmB,SAAQ,YAAY,CAAC,WAAW,CAAC;IAC/D,OAAO,CAAC,UAAU,CAAuB;gBAEtB,OAAO,EAAE,yBAAyB;IAU9C,KAAK,CAAC,OAAO,CAAC,EAAE,uBAAuB,GAAG,gBAAgB;IAa1D,eAAe,IAAI,YAAY;IAQ/B,oBAAoB,IAAI,YAAY;IAYpC,cAAc,IAAI,YAAY;CA+BtC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @friskai/frisk-js Claude Integration
|
|
3
|
+
*
|
|
4
|
+
* FriskClaude class that extends Frisk with Claude-specific functionality.
|
|
5
|
+
*/
|
|
6
|
+
import { SdkMcpToolDefinition } from '@anthropic-ai/claude-agent-sdk';
|
|
7
|
+
import { ZodRawShape } from 'zod';
|
|
8
|
+
import { Frisk } from '../../core/frisk';
|
|
9
|
+
import type { FriskOptions } from '../../core/types';
|
|
10
|
+
import { WrapToolOptions } from '../../framework-adapter/framework-adapter';
|
|
11
|
+
import { ClaudeFrameworkAdapter, type ClaudeTool, type ClaudeToolCall } from './claude-framework-adapter/claude-framework-adapter';
|
|
12
|
+
import { FriskClaudeSession } from './frisk-claude-session';
|
|
13
|
+
/**
|
|
14
|
+
* Claude-specific Frisk init params (without frameworkAdapter since it's preset)
|
|
15
|
+
*/
|
|
16
|
+
export type FriskClaudeOptions = Omit<FriskOptions<ClaudeToolCall, ClaudeTool>, 'adapter'>;
|
|
17
|
+
export type FriskClaudeAgentState = Record<string, unknown>;
|
|
18
|
+
/**
|
|
19
|
+
* FriskClaude - Frisk SDK configured for Claude integration
|
|
20
|
+
*
|
|
21
|
+
* Extends the base Frisk class with Claude-specific functionality.
|
|
22
|
+
* Automatically configures the ClaudeFrameworkAdapter.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```typescript
|
|
26
|
+
* import { Frisk } from '@friskai/frisk-js/claude';
|
|
27
|
+
*
|
|
28
|
+
* const frisk = await Frisk.connect({
|
|
29
|
+
* apiKey: process.env.FRISK_API_KEY,
|
|
30
|
+
* redact: {
|
|
31
|
+
* redactToolArgs: ['password'],
|
|
32
|
+
* },
|
|
33
|
+
* });
|
|
34
|
+
*
|
|
35
|
+
* // Collect LLM reasoning from tools
|
|
36
|
+
* const wrappedTools = frisk.wrapTools(myTools);
|
|
37
|
+
*
|
|
38
|
+
* // Evaluate a tool call against Frisk policies
|
|
39
|
+
* const result = frisk.decideToolCall({
|
|
40
|
+
* toolCall: { name: 'send_email', id: 'tool-call-1', args: { recipient: 'user@example.com' } },
|
|
41
|
+
* agentState: { userId: 123 }
|
|
42
|
+
* })
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
export declare class FriskClaude extends Frisk<ClaudeToolCall, ClaudeTool, ClaudeFrameworkAdapter, FriskClaudeAgentState> {
|
|
46
|
+
constructor(params?: FriskClaudeOptions);
|
|
47
|
+
session(agentState?: FriskClaudeAgentState): FriskClaudeSession;
|
|
48
|
+
/**
|
|
49
|
+
* Wrap many Claude tools with Frisk policy enforcement.
|
|
50
|
+
*
|
|
51
|
+
* This wrapper requires the LLM to provide a **reasoning / justification** before calling a tool.
|
|
52
|
+
* Frisk captures that reasoning and makes it available for review in the Frisk dashboard.
|
|
53
|
+
*
|
|
54
|
+
* ## Accepted tool types
|
|
55
|
+
* Accepts an instance of Claude's SdkMcpToolDefinition.
|
|
56
|
+
* This includes tools created via the `tool()` function, whose arguments are object-shaped.
|
|
57
|
+
*/
|
|
58
|
+
wrapTools(tools: Iterable<SdkMcpToolDefinition<ZodRawShape>>, options?: WrapToolOptions): SdkMcpToolDefinition<ZodRawShape>[];
|
|
59
|
+
/**
|
|
60
|
+
* Wrap a single Claude tool with Frisk policy enforcement.
|
|
61
|
+
*
|
|
62
|
+
* This wrapper requires the LLM to provide a **reasoning / justification** before calling a tool.
|
|
63
|
+
* Frisk captures that reasoning and makes it available for review in the Frisk dashboard.
|
|
64
|
+
*
|
|
65
|
+
* ## Accepted tool types
|
|
66
|
+
* Accepts an instance of Claude's SdkMcpToolDefinition.
|
|
67
|
+
* This includes tools created via the `tool()` function, whose arguments are object-shaped.
|
|
68
|
+
*/
|
|
69
|
+
wrapTool(tool: SdkMcpToolDefinition<ZodRawShape>, options?: WrapToolOptions): SdkMcpToolDefinition<ZodRawShape>;
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=frisk-claude.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"frisk-claude.d.ts","sourceRoot":"","sources":["../../../src/adapters/claude/frisk-claude.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAA;AACrE,OAAO,EAAE,WAAW,EAAE,MAAM,KAAK,CAAA;AACjC,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA;AAExC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AACpD,OAAO,EAEL,eAAe,EAChB,MAAM,2CAA2C,CAAA;AAClD,OAAO,EACL,sBAAsB,EACtB,KAAK,UAAU,EACf,KAAK,cAAc,EACpB,MAAM,qDAAqD,CAAA;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAA;AAE3D;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG,IAAI,CACnC,YAAY,CAAC,cAAc,EAAE,UAAU,CAAC,EACxC,SAAS,CACV,CAAA;AAED,MAAM,MAAM,qBAAqB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