@artyfacts/claude 1.2.3 → 1.3.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/chunk-7ULDABOE.mjs +755 -0
- package/dist/cli.js +15 -1
- package/dist/cli.mjs +1 -1
- package/dist/index.d.mts +225 -7
- package/dist/index.d.ts +225 -7
- package/dist/index.js +5200 -3
- package/dist/index.mjs +5174 -2
- package/package.json +1 -1
- package/src/executor-with-tools.ts +402 -0
- package/src/index.ts +34 -0
- package/src/listener.ts +16 -1
- package/src/tools/api-client.ts +68 -0
- package/src/tools/handlers.ts +460 -0
- package/src/tools/index.ts +30 -0
- package/src/tools/registry.ts +780 -0
- package/src/tools/types.ts +82 -0
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool Types for Artyfacts
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* JSON Schema for tool input
|
|
7
|
+
*/
|
|
8
|
+
export interface ToolInputSchema {
|
|
9
|
+
type: 'object';
|
|
10
|
+
properties: Record<string, {
|
|
11
|
+
type: string;
|
|
12
|
+
description?: string;
|
|
13
|
+
enum?: string[] | number[];
|
|
14
|
+
default?: unknown;
|
|
15
|
+
items?: { type: string; properties?: Record<string, unknown> };
|
|
16
|
+
}>;
|
|
17
|
+
required: string[];
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Tool schema (for Claude tool_use)
|
|
22
|
+
*/
|
|
23
|
+
export interface ToolSchema {
|
|
24
|
+
name: string;
|
|
25
|
+
description: string;
|
|
26
|
+
input_schema: ToolInputSchema;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Tool execution result
|
|
31
|
+
*/
|
|
32
|
+
export interface ToolResult {
|
|
33
|
+
success: boolean;
|
|
34
|
+
data?: unknown;
|
|
35
|
+
error?: string;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* API client interface for tool handlers
|
|
40
|
+
*/
|
|
41
|
+
export interface ApiClient {
|
|
42
|
+
get<T = unknown>(path: string): Promise<T>;
|
|
43
|
+
post<T = unknown>(path: string, body?: unknown): Promise<T>;
|
|
44
|
+
patch<T = unknown>(path: string, body?: unknown): Promise<T>;
|
|
45
|
+
delete<T = unknown>(path: string): Promise<T>;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Tool handler function
|
|
50
|
+
*/
|
|
51
|
+
export type ToolHandler = (
|
|
52
|
+
args: Record<string, unknown>,
|
|
53
|
+
client: ApiClient
|
|
54
|
+
) => Promise<ToolResult>;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Tool definition with schema and handler
|
|
58
|
+
*/
|
|
59
|
+
export interface Tool {
|
|
60
|
+
schema: ToolSchema;
|
|
61
|
+
handler: ToolHandler;
|
|
62
|
+
permission: string;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Tool call from Claude
|
|
67
|
+
*/
|
|
68
|
+
export interface ToolCall {
|
|
69
|
+
id: string;
|
|
70
|
+
name: string;
|
|
71
|
+
input: Record<string, unknown>;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Tool result to send back to Claude
|
|
76
|
+
*/
|
|
77
|
+
export interface ToolCallResult {
|
|
78
|
+
type: 'tool_result';
|
|
79
|
+
tool_use_id: string;
|
|
80
|
+
content: string;
|
|
81
|
+
is_error?: boolean;
|
|
82
|
+
}
|