@tpmjs/types 0.1.2 → 0.2.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/agent.d.ts +300 -0
- package/dist/agent.js +206 -0
- package/dist/collection.d.ts +125 -0
- package/dist/collection.js +131 -0
- package/dist/executor.d.ts +127 -0
- package/dist/executor.js +43 -0
- package/dist/tpmjs.d.ts +83 -99
- package/dist/tpmjs.js +19 -16
- package/dist/user.d.ts +54 -0
- package/dist/user.js +81 -0
- package/package.json +19 -3
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
// src/collection.ts
|
|
4
|
+
var ExecutorTypeSchema = z.enum(["default", "custom_url"]);
|
|
5
|
+
var DefaultExecutorConfigSchema = z.object({
|
|
6
|
+
type: z.literal("default")
|
|
7
|
+
});
|
|
8
|
+
var CustomUrlExecutorConfigSchema = z.object({
|
|
9
|
+
type: z.literal("custom_url"),
|
|
10
|
+
/** URL of the custom executor (must be HTTPS in production) */
|
|
11
|
+
url: z.string().url(),
|
|
12
|
+
/** Optional API key for Bearer token authentication */
|
|
13
|
+
apiKey: z.string().optional()
|
|
14
|
+
});
|
|
15
|
+
z.discriminatedUnion("type", [
|
|
16
|
+
DefaultExecutorConfigSchema,
|
|
17
|
+
CustomUrlExecutorConfigSchema
|
|
18
|
+
]);
|
|
19
|
+
z.object({
|
|
20
|
+
packageName: z.string().min(1),
|
|
21
|
+
name: z.string().min(1),
|
|
22
|
+
version: z.string().optional(),
|
|
23
|
+
importUrl: z.string().url().optional(),
|
|
24
|
+
params: z.record(z.string(), z.unknown()),
|
|
25
|
+
env: z.record(z.string(), z.string()).optional()
|
|
26
|
+
});
|
|
27
|
+
z.object({
|
|
28
|
+
success: z.boolean(),
|
|
29
|
+
output: z.unknown().optional(),
|
|
30
|
+
error: z.string().optional(),
|
|
31
|
+
executionTimeMs: z.number()
|
|
32
|
+
});
|
|
33
|
+
z.object({
|
|
34
|
+
status: z.enum(["ok", "degraded", "error"]),
|
|
35
|
+
version: z.string().optional(),
|
|
36
|
+
info: z.record(z.string(), z.unknown()).optional()
|
|
37
|
+
});
|
|
38
|
+
z.object({
|
|
39
|
+
url: z.string().url(),
|
|
40
|
+
apiKey: z.string().optional()
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
// src/collection.ts
|
|
44
|
+
var NAME_REGEX = /^[a-zA-Z0-9\s\-_]+$/;
|
|
45
|
+
var ExecutorConfigUpdateSchema = z.object({
|
|
46
|
+
url: z.string().url(),
|
|
47
|
+
apiKey: z.string().optional()
|
|
48
|
+
}).nullable().optional();
|
|
49
|
+
var CreateCollectionSchema = z.object({
|
|
50
|
+
name: z.string().min(1, "Name is required").max(100, "Name must be 100 characters or less").regex(NAME_REGEX, "Name can only contain letters, numbers, spaces, hyphens, and underscores"),
|
|
51
|
+
description: z.string().max(500, "Description must be 500 characters or less").optional(),
|
|
52
|
+
isPublic: z.boolean().default(false)
|
|
53
|
+
});
|
|
54
|
+
var UpdateCollectionSchema = z.object({
|
|
55
|
+
name: z.string().min(1, "Name is required").max(100, "Name must be 100 characters or less").regex(NAME_REGEX, "Name can only contain letters, numbers, spaces, hyphens, and underscores").optional(),
|
|
56
|
+
description: z.string().max(500, "Description must be 500 characters or less").nullable().optional(),
|
|
57
|
+
isPublic: z.boolean().optional(),
|
|
58
|
+
// Executor configuration
|
|
59
|
+
executorType: ExecutorTypeSchema.nullable().optional(),
|
|
60
|
+
executorConfig: ExecutorConfigUpdateSchema,
|
|
61
|
+
// Tool environment variables
|
|
62
|
+
envVars: z.record(z.string(), z.string()).nullable().optional()
|
|
63
|
+
});
|
|
64
|
+
var AddToolToCollectionSchema = z.object({
|
|
65
|
+
toolId: z.string().min(1, "Tool ID is required"),
|
|
66
|
+
note: z.string().max(500, "Note must be 500 characters or less").optional(),
|
|
67
|
+
position: z.number().int().min(0).optional()
|
|
68
|
+
});
|
|
69
|
+
var UpdateCollectionToolSchema = z.object({
|
|
70
|
+
note: z.string().max(500, "Note must be 500 characters or less").nullable().optional(),
|
|
71
|
+
position: z.number().int().min(0).optional()
|
|
72
|
+
});
|
|
73
|
+
var ReorderToolsSchema = z.object({
|
|
74
|
+
toolIds: z.array(z.string().min(1))
|
|
75
|
+
});
|
|
76
|
+
var AddBridgeToolToCollectionSchema = z.object({
|
|
77
|
+
serverId: z.string().min(1, "Server ID is required").max(100),
|
|
78
|
+
toolName: z.string().min(1, "Tool name is required").max(100),
|
|
79
|
+
displayName: z.string().max(100).optional(),
|
|
80
|
+
note: z.string().max(500, "Note must be 500 characters or less").optional()
|
|
81
|
+
});
|
|
82
|
+
var UpdateCollectionBridgeToolSchema = z.object({
|
|
83
|
+
displayName: z.string().max(100).nullable().optional(),
|
|
84
|
+
note: z.string().max(500, "Note must be 500 characters or less").nullable().optional()
|
|
85
|
+
});
|
|
86
|
+
var CloneCollectionSchema = z.object({
|
|
87
|
+
name: z.string().min(1, "Name is required").max(100, "Name must be 100 characters or less").regex(NAME_REGEX, "Name can only contain letters, numbers, spaces, hyphens, and underscores").optional()
|
|
88
|
+
// If not provided, will use original name or append "(copy)"
|
|
89
|
+
});
|
|
90
|
+
var CollectionSchema = z.object({
|
|
91
|
+
id: z.string(),
|
|
92
|
+
name: z.string(),
|
|
93
|
+
slug: z.string().nullable(),
|
|
94
|
+
description: z.string().nullable(),
|
|
95
|
+
isPublic: z.boolean(),
|
|
96
|
+
toolCount: z.number(),
|
|
97
|
+
forkCount: z.number().default(0),
|
|
98
|
+
forkedFromId: z.string().nullable().optional(),
|
|
99
|
+
createdAt: z.date(),
|
|
100
|
+
updatedAt: z.date()
|
|
101
|
+
});
|
|
102
|
+
var CollectionToolSchema = z.object({
|
|
103
|
+
id: z.string(),
|
|
104
|
+
toolId: z.string(),
|
|
105
|
+
position: z.number(),
|
|
106
|
+
note: z.string().nullable(),
|
|
107
|
+
addedAt: z.date(),
|
|
108
|
+
tool: z.object({
|
|
109
|
+
id: z.string(),
|
|
110
|
+
name: z.string(),
|
|
111
|
+
description: z.string(),
|
|
112
|
+
package: z.object({
|
|
113
|
+
id: z.string(),
|
|
114
|
+
npmPackageName: z.string(),
|
|
115
|
+
category: z.string()
|
|
116
|
+
})
|
|
117
|
+
})
|
|
118
|
+
});
|
|
119
|
+
var CollectionWithToolsSchema = CollectionSchema.extend({
|
|
120
|
+
tools: z.array(CollectionToolSchema)
|
|
121
|
+
});
|
|
122
|
+
var COLLECTION_LIMITS = {
|
|
123
|
+
MAX_COLLECTIONS_PER_USER: 50,
|
|
124
|
+
MAX_TOOLS_PER_COLLECTION: 100,
|
|
125
|
+
MAX_BRIDGE_TOOLS_PER_COLLECTION: 50,
|
|
126
|
+
MAX_NAME_LENGTH: 100,
|
|
127
|
+
MAX_DESCRIPTION_LENGTH: 500,
|
|
128
|
+
MAX_NOTE_LENGTH: 500
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
export { AddBridgeToolToCollectionSchema, AddToolToCollectionSchema, COLLECTION_LIMITS, CloneCollectionSchema, CollectionSchema, CollectionToolSchema, CollectionWithToolsSchema, CreateCollectionSchema, ReorderToolsSchema, UpdateCollectionBridgeToolSchema, UpdateCollectionSchema, UpdateCollectionToolSchema };
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Executor API Types
|
|
5
|
+
*
|
|
6
|
+
* These types define the contract between TPMJS and any executor service.
|
|
7
|
+
* Custom executors must implement the ExecuteToolRequest/Response interface.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Request payload for POST /execute-tool
|
|
12
|
+
*/
|
|
13
|
+
interface ExecuteToolRequest {
|
|
14
|
+
/** NPM package name, e.g., "@tpmjs/hello" */
|
|
15
|
+
packageName: string;
|
|
16
|
+
/** Tool name within the package, e.g., "helloWorld" */
|
|
17
|
+
name: string;
|
|
18
|
+
/** Package version, e.g., "1.0.0" or "latest" */
|
|
19
|
+
version?: string;
|
|
20
|
+
/** Direct esm.sh URL override for the package */
|
|
21
|
+
importUrl?: string;
|
|
22
|
+
/** Tool parameters to pass to execute() */
|
|
23
|
+
params: Record<string, unknown>;
|
|
24
|
+
/** Environment variables to inject during execution */
|
|
25
|
+
env?: Record<string, string>;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Response from POST /execute-tool
|
|
29
|
+
*/
|
|
30
|
+
interface ExecuteToolResponse {
|
|
31
|
+
/** Whether the execution succeeded */
|
|
32
|
+
success: boolean;
|
|
33
|
+
/** Tool output on success */
|
|
34
|
+
output?: unknown;
|
|
35
|
+
/** Error message on failure */
|
|
36
|
+
error?: string;
|
|
37
|
+
/** Execution duration in milliseconds */
|
|
38
|
+
executionTimeMs: number;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Response from GET /health (optional but recommended)
|
|
42
|
+
*/
|
|
43
|
+
interface ExecutorHealthResponse {
|
|
44
|
+
/** Executor status */
|
|
45
|
+
status: 'ok' | 'degraded' | 'error';
|
|
46
|
+
/** Executor version string */
|
|
47
|
+
version?: string;
|
|
48
|
+
/** Optional additional info */
|
|
49
|
+
info?: Record<string, unknown>;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Executor type enum
|
|
53
|
+
*/
|
|
54
|
+
declare const ExecutorTypeSchema: z.ZodEnum<{
|
|
55
|
+
default: "default";
|
|
56
|
+
custom_url: "custom_url";
|
|
57
|
+
}>;
|
|
58
|
+
type ExecutorType = z.infer<typeof ExecutorTypeSchema>;
|
|
59
|
+
/**
|
|
60
|
+
* Default executor config (uses TPMJS Railway executor)
|
|
61
|
+
*/
|
|
62
|
+
declare const DefaultExecutorConfigSchema: z.ZodObject<{
|
|
63
|
+
type: z.ZodLiteral<"default">;
|
|
64
|
+
}, z.core.$strip>;
|
|
65
|
+
/**
|
|
66
|
+
* Custom URL executor config
|
|
67
|
+
*/
|
|
68
|
+
declare const CustomUrlExecutorConfigSchema: z.ZodObject<{
|
|
69
|
+
type: z.ZodLiteral<"custom_url">;
|
|
70
|
+
url: z.ZodString;
|
|
71
|
+
apiKey: z.ZodOptional<z.ZodString>;
|
|
72
|
+
}, z.core.$strip>;
|
|
73
|
+
/**
|
|
74
|
+
* Union of all executor config types
|
|
75
|
+
*/
|
|
76
|
+
declare const ExecutorConfigSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
77
|
+
type: z.ZodLiteral<"default">;
|
|
78
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
79
|
+
type: z.ZodLiteral<"custom_url">;
|
|
80
|
+
url: z.ZodString;
|
|
81
|
+
apiKey: z.ZodOptional<z.ZodString>;
|
|
82
|
+
}, z.core.$strip>], "type">;
|
|
83
|
+
type ExecutorConfig = z.infer<typeof ExecutorConfigSchema>;
|
|
84
|
+
type DefaultExecutorConfig = z.infer<typeof DefaultExecutorConfigSchema>;
|
|
85
|
+
type CustomUrlExecutorConfig = z.infer<typeof CustomUrlExecutorConfigSchema>;
|
|
86
|
+
declare const ExecuteToolRequestSchema: z.ZodObject<{
|
|
87
|
+
packageName: z.ZodString;
|
|
88
|
+
name: z.ZodString;
|
|
89
|
+
version: z.ZodOptional<z.ZodString>;
|
|
90
|
+
importUrl: z.ZodOptional<z.ZodString>;
|
|
91
|
+
params: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
92
|
+
env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
93
|
+
}, z.core.$strip>;
|
|
94
|
+
declare const ExecuteToolResponseSchema: z.ZodObject<{
|
|
95
|
+
success: z.ZodBoolean;
|
|
96
|
+
output: z.ZodOptional<z.ZodUnknown>;
|
|
97
|
+
error: z.ZodOptional<z.ZodString>;
|
|
98
|
+
executionTimeMs: z.ZodNumber;
|
|
99
|
+
}, z.core.$strip>;
|
|
100
|
+
declare const ExecutorHealthResponseSchema: z.ZodObject<{
|
|
101
|
+
status: z.ZodEnum<{
|
|
102
|
+
ok: "ok";
|
|
103
|
+
degraded: "degraded";
|
|
104
|
+
error: "error";
|
|
105
|
+
}>;
|
|
106
|
+
version: z.ZodOptional<z.ZodString>;
|
|
107
|
+
info: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
108
|
+
}, z.core.$strip>;
|
|
109
|
+
declare const VerifyExecutorRequestSchema: z.ZodObject<{
|
|
110
|
+
url: z.ZodString;
|
|
111
|
+
apiKey: z.ZodOptional<z.ZodString>;
|
|
112
|
+
}, z.core.$strip>;
|
|
113
|
+
interface VerifyExecutorRequest {
|
|
114
|
+
url: string;
|
|
115
|
+
apiKey?: string;
|
|
116
|
+
}
|
|
117
|
+
interface VerifyExecutorResponse {
|
|
118
|
+
valid: boolean;
|
|
119
|
+
healthCheck?: ExecutorHealthResponse;
|
|
120
|
+
testExecution?: {
|
|
121
|
+
success: boolean;
|
|
122
|
+
executionTimeMs: number;
|
|
123
|
+
};
|
|
124
|
+
errors?: string[];
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export { type CustomUrlExecutorConfig, CustomUrlExecutorConfigSchema, type DefaultExecutorConfig, DefaultExecutorConfigSchema, type ExecuteToolRequest, ExecuteToolRequestSchema, type ExecuteToolResponse, ExecuteToolResponseSchema, type ExecutorConfig, ExecutorConfigSchema, type ExecutorHealthResponse, ExecutorHealthResponseSchema, type ExecutorType, ExecutorTypeSchema, type VerifyExecutorRequest, VerifyExecutorRequestSchema, type VerifyExecutorResponse };
|
package/dist/executor.js
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
// src/executor.ts
|
|
4
|
+
var ExecutorTypeSchema = z.enum(["default", "custom_url"]);
|
|
5
|
+
var DefaultExecutorConfigSchema = z.object({
|
|
6
|
+
type: z.literal("default")
|
|
7
|
+
});
|
|
8
|
+
var CustomUrlExecutorConfigSchema = z.object({
|
|
9
|
+
type: z.literal("custom_url"),
|
|
10
|
+
/** URL of the custom executor (must be HTTPS in production) */
|
|
11
|
+
url: z.string().url(),
|
|
12
|
+
/** Optional API key for Bearer token authentication */
|
|
13
|
+
apiKey: z.string().optional()
|
|
14
|
+
});
|
|
15
|
+
var ExecutorConfigSchema = z.discriminatedUnion("type", [
|
|
16
|
+
DefaultExecutorConfigSchema,
|
|
17
|
+
CustomUrlExecutorConfigSchema
|
|
18
|
+
]);
|
|
19
|
+
var ExecuteToolRequestSchema = z.object({
|
|
20
|
+
packageName: z.string().min(1),
|
|
21
|
+
name: z.string().min(1),
|
|
22
|
+
version: z.string().optional(),
|
|
23
|
+
importUrl: z.string().url().optional(),
|
|
24
|
+
params: z.record(z.string(), z.unknown()),
|
|
25
|
+
env: z.record(z.string(), z.string()).optional()
|
|
26
|
+
});
|
|
27
|
+
var ExecuteToolResponseSchema = z.object({
|
|
28
|
+
success: z.boolean(),
|
|
29
|
+
output: z.unknown().optional(),
|
|
30
|
+
error: z.string().optional(),
|
|
31
|
+
executionTimeMs: z.number()
|
|
32
|
+
});
|
|
33
|
+
var ExecutorHealthResponseSchema = z.object({
|
|
34
|
+
status: z.enum(["ok", "degraded", "error"]),
|
|
35
|
+
version: z.string().optional(),
|
|
36
|
+
info: z.record(z.string(), z.unknown()).optional()
|
|
37
|
+
});
|
|
38
|
+
var VerifyExecutorRequestSchema = z.object({
|
|
39
|
+
url: z.string().url(),
|
|
40
|
+
apiKey: z.string().optional()
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
export { CustomUrlExecutorConfigSchema, DefaultExecutorConfigSchema, ExecuteToolRequestSchema, ExecuteToolResponseSchema, ExecutorConfigSchema, ExecutorHealthResponseSchema, ExecutorTypeSchema, VerifyExecutorRequestSchema };
|
package/dist/tpmjs.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { z } from 'zod';
|
|
|
3
3
|
/**
|
|
4
4
|
* Valid tool categories for TPMJS registry
|
|
5
5
|
*/
|
|
6
|
-
declare const TPMJS_CATEGORIES: readonly ["web-scraping", "data-processing", "file-operations", "communication", "database", "api-integration", "image-processing", "text-analysis", "automation", "ai-ml", "
|
|
6
|
+
declare const TPMJS_CATEGORIES: readonly ["research", "web", "data", "documentation", "engineering", "security", "statistics", "ops", "agent", "sandbox", "utilities", "html", "compliance", "web-scraping", "data-processing", "file-operations", "communication", "database", "api-integration", "image-processing", "text-analysis", "automation", "ai-ml", "monitoring", "doc", "text"];
|
|
7
7
|
type TpmjsCategory = (typeof TPMJS_CATEGORIES)[number];
|
|
8
8
|
/**
|
|
9
9
|
* Tool parameter schema
|
|
@@ -62,15 +62,13 @@ type TpmjsAiAgent = z.infer<typeof TpmjsAiAgentSchema>;
|
|
|
62
62
|
* Optional fields (auto-extracted if not provided):
|
|
63
63
|
* - description: A description of what the tool does (20-500 chars) - auto-extracted from tool
|
|
64
64
|
*
|
|
65
|
-
* @deprecated fields (now auto-extracted
|
|
65
|
+
* @deprecated fields (now auto-extracted):
|
|
66
66
|
* - parameters: Tool input parameters - auto-extracted from inputSchema
|
|
67
67
|
* - returns: Tool return type - auto-extracted from tool
|
|
68
68
|
* - aiAgent: AI agent guidance - auto-extracted from tool
|
|
69
|
-
* - exportName: Renamed to 'name' - kept for backward compatibility with published packages
|
|
70
69
|
*/
|
|
71
|
-
declare const TpmjsToolDefinitionSchema: z.
|
|
72
|
-
name: z.
|
|
73
|
-
exportName: z.ZodOptional<z.ZodString>;
|
|
70
|
+
declare const TpmjsToolDefinitionSchema: z.ZodObject<{
|
|
71
|
+
name: z.ZodString;
|
|
74
72
|
description: z.ZodOptional<z.ZodString>;
|
|
75
73
|
parameters: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
76
74
|
name: z.ZodString;
|
|
@@ -88,46 +86,7 @@ declare const TpmjsToolDefinitionSchema: z.ZodPipe<z.ZodObject<{
|
|
|
88
86
|
limitations: z.ZodOptional<z.ZodString>;
|
|
89
87
|
examples: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
90
88
|
}, z.core.$strip>>;
|
|
91
|
-
}, z.core.$strip
|
|
92
|
-
name: string;
|
|
93
|
-
description: string | undefined;
|
|
94
|
-
parameters: {
|
|
95
|
-
name: string;
|
|
96
|
-
type: string;
|
|
97
|
-
description: string;
|
|
98
|
-
required: boolean;
|
|
99
|
-
default?: unknown;
|
|
100
|
-
}[] | undefined;
|
|
101
|
-
returns: {
|
|
102
|
-
type: string;
|
|
103
|
-
description: string;
|
|
104
|
-
} | undefined;
|
|
105
|
-
aiAgent: {
|
|
106
|
-
useCase: string;
|
|
107
|
-
limitations?: string | undefined;
|
|
108
|
-
examples?: string[] | undefined;
|
|
109
|
-
} | undefined;
|
|
110
|
-
}, {
|
|
111
|
-
name?: string | undefined;
|
|
112
|
-
exportName?: string | undefined;
|
|
113
|
-
description?: string | undefined;
|
|
114
|
-
parameters?: {
|
|
115
|
-
name: string;
|
|
116
|
-
type: string;
|
|
117
|
-
description: string;
|
|
118
|
-
required: boolean;
|
|
119
|
-
default?: unknown;
|
|
120
|
-
}[] | undefined;
|
|
121
|
-
returns?: {
|
|
122
|
-
type: string;
|
|
123
|
-
description: string;
|
|
124
|
-
} | undefined;
|
|
125
|
-
aiAgent?: {
|
|
126
|
-
useCase: string;
|
|
127
|
-
limitations?: string | undefined;
|
|
128
|
-
examples?: string[] | undefined;
|
|
129
|
-
} | undefined;
|
|
130
|
-
}>>;
|
|
89
|
+
}, z.core.$strip>;
|
|
131
90
|
type TpmjsToolDefinition = z.infer<typeof TpmjsToolDefinitionSchema>;
|
|
132
91
|
/**
|
|
133
92
|
* Multi-tool format - NEW SCHEMA
|
|
@@ -138,6 +97,19 @@ type TpmjsToolDefinition = z.infer<typeof TpmjsToolDefinitionSchema>;
|
|
|
138
97
|
*/
|
|
139
98
|
declare const TpmjsMultiToolSchema: z.ZodObject<{
|
|
140
99
|
category: z.ZodEnum<{
|
|
100
|
+
research: "research";
|
|
101
|
+
web: "web";
|
|
102
|
+
data: "data";
|
|
103
|
+
documentation: "documentation";
|
|
104
|
+
engineering: "engineering";
|
|
105
|
+
security: "security";
|
|
106
|
+
statistics: "statistics";
|
|
107
|
+
ops: "ops";
|
|
108
|
+
agent: "agent";
|
|
109
|
+
sandbox: "sandbox";
|
|
110
|
+
utilities: "utilities";
|
|
111
|
+
html: "html";
|
|
112
|
+
compliance: "compliance";
|
|
141
113
|
"web-scraping": "web-scraping";
|
|
142
114
|
"data-processing": "data-processing";
|
|
143
115
|
"file-operations": "file-operations";
|
|
@@ -148,13 +120,12 @@ declare const TpmjsMultiToolSchema: z.ZodObject<{
|
|
|
148
120
|
"text-analysis": "text-analysis";
|
|
149
121
|
automation: "automation";
|
|
150
122
|
"ai-ml": "ai-ml";
|
|
151
|
-
security: "security";
|
|
152
123
|
monitoring: "monitoring";
|
|
153
|
-
|
|
124
|
+
doc: "doc";
|
|
125
|
+
text: "text";
|
|
154
126
|
}>;
|
|
155
|
-
tools: z.ZodOptional<z.ZodArray<z.
|
|
156
|
-
name: z.
|
|
157
|
-
exportName: z.ZodOptional<z.ZodString>;
|
|
127
|
+
tools: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
128
|
+
name: z.ZodString;
|
|
158
129
|
description: z.ZodOptional<z.ZodString>;
|
|
159
130
|
parameters: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
160
131
|
name: z.ZodString;
|
|
@@ -172,46 +143,7 @@ declare const TpmjsMultiToolSchema: z.ZodObject<{
|
|
|
172
143
|
limitations: z.ZodOptional<z.ZodString>;
|
|
173
144
|
examples: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
174
145
|
}, z.core.$strip>>;
|
|
175
|
-
}, z.core.$strip
|
|
176
|
-
name: string;
|
|
177
|
-
description: string | undefined;
|
|
178
|
-
parameters: {
|
|
179
|
-
name: string;
|
|
180
|
-
type: string;
|
|
181
|
-
description: string;
|
|
182
|
-
required: boolean;
|
|
183
|
-
default?: unknown;
|
|
184
|
-
}[] | undefined;
|
|
185
|
-
returns: {
|
|
186
|
-
type: string;
|
|
187
|
-
description: string;
|
|
188
|
-
} | undefined;
|
|
189
|
-
aiAgent: {
|
|
190
|
-
useCase: string;
|
|
191
|
-
limitations?: string | undefined;
|
|
192
|
-
examples?: string[] | undefined;
|
|
193
|
-
} | undefined;
|
|
194
|
-
}, {
|
|
195
|
-
name?: string | undefined;
|
|
196
|
-
exportName?: string | undefined;
|
|
197
|
-
description?: string | undefined;
|
|
198
|
-
parameters?: {
|
|
199
|
-
name: string;
|
|
200
|
-
type: string;
|
|
201
|
-
description: string;
|
|
202
|
-
required: boolean;
|
|
203
|
-
default?: unknown;
|
|
204
|
-
}[] | undefined;
|
|
205
|
-
returns?: {
|
|
206
|
-
type: string;
|
|
207
|
-
description: string;
|
|
208
|
-
} | undefined;
|
|
209
|
-
aiAgent?: {
|
|
210
|
-
useCase: string;
|
|
211
|
-
limitations?: string | undefined;
|
|
212
|
-
examples?: string[] | undefined;
|
|
213
|
-
} | undefined;
|
|
214
|
-
}>>>>;
|
|
146
|
+
}, z.core.$strip>>>;
|
|
215
147
|
env: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
216
148
|
name: z.ZodString;
|
|
217
149
|
description: z.ZodString;
|
|
@@ -233,6 +165,19 @@ type TpmjsMultiTool = z.infer<typeof TpmjsMultiToolSchema>;
|
|
|
233
165
|
*/
|
|
234
166
|
declare const TpmjsLegacyMinimalSchema: z.ZodObject<{
|
|
235
167
|
category: z.ZodEnum<{
|
|
168
|
+
research: "research";
|
|
169
|
+
web: "web";
|
|
170
|
+
data: "data";
|
|
171
|
+
documentation: "documentation";
|
|
172
|
+
engineering: "engineering";
|
|
173
|
+
security: "security";
|
|
174
|
+
statistics: "statistics";
|
|
175
|
+
ops: "ops";
|
|
176
|
+
agent: "agent";
|
|
177
|
+
sandbox: "sandbox";
|
|
178
|
+
utilities: "utilities";
|
|
179
|
+
html: "html";
|
|
180
|
+
compliance: "compliance";
|
|
236
181
|
"web-scraping": "web-scraping";
|
|
237
182
|
"data-processing": "data-processing";
|
|
238
183
|
"file-operations": "file-operations";
|
|
@@ -243,9 +188,9 @@ declare const TpmjsLegacyMinimalSchema: z.ZodObject<{
|
|
|
243
188
|
"text-analysis": "text-analysis";
|
|
244
189
|
automation: "automation";
|
|
245
190
|
"ai-ml": "ai-ml";
|
|
246
|
-
security: "security";
|
|
247
191
|
monitoring: "monitoring";
|
|
248
|
-
|
|
192
|
+
doc: "doc";
|
|
193
|
+
text: "text";
|
|
249
194
|
}>;
|
|
250
195
|
description: z.ZodString;
|
|
251
196
|
}, z.core.$strip>;
|
|
@@ -256,6 +201,19 @@ type TpmjsLegacyMinimal = z.infer<typeof TpmjsLegacyMinimalSchema>;
|
|
|
256
201
|
*/
|
|
257
202
|
declare const TpmjsLegacyRichSchema: z.ZodObject<{
|
|
258
203
|
category: z.ZodEnum<{
|
|
204
|
+
research: "research";
|
|
205
|
+
web: "web";
|
|
206
|
+
data: "data";
|
|
207
|
+
documentation: "documentation";
|
|
208
|
+
engineering: "engineering";
|
|
209
|
+
security: "security";
|
|
210
|
+
statistics: "statistics";
|
|
211
|
+
ops: "ops";
|
|
212
|
+
agent: "agent";
|
|
213
|
+
sandbox: "sandbox";
|
|
214
|
+
utilities: "utilities";
|
|
215
|
+
html: "html";
|
|
216
|
+
compliance: "compliance";
|
|
259
217
|
"web-scraping": "web-scraping";
|
|
260
218
|
"data-processing": "data-processing";
|
|
261
219
|
"file-operations": "file-operations";
|
|
@@ -266,9 +224,9 @@ declare const TpmjsLegacyRichSchema: z.ZodObject<{
|
|
|
266
224
|
"text-analysis": "text-analysis";
|
|
267
225
|
automation: "automation";
|
|
268
226
|
"ai-ml": "ai-ml";
|
|
269
|
-
security: "security";
|
|
270
227
|
monitoring: "monitoring";
|
|
271
|
-
|
|
228
|
+
doc: "doc";
|
|
229
|
+
text: "text";
|
|
272
230
|
}>;
|
|
273
231
|
description: z.ZodString;
|
|
274
232
|
parameters: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
@@ -314,6 +272,19 @@ type TpmjsMinimal = TpmjsLegacyMinimal;
|
|
|
314
272
|
type TpmjsRich = TpmjsLegacyRich;
|
|
315
273
|
declare const TpmjsMinimalSchema: z.ZodObject<{
|
|
316
274
|
category: z.ZodEnum<{
|
|
275
|
+
research: "research";
|
|
276
|
+
web: "web";
|
|
277
|
+
data: "data";
|
|
278
|
+
documentation: "documentation";
|
|
279
|
+
engineering: "engineering";
|
|
280
|
+
security: "security";
|
|
281
|
+
statistics: "statistics";
|
|
282
|
+
ops: "ops";
|
|
283
|
+
agent: "agent";
|
|
284
|
+
sandbox: "sandbox";
|
|
285
|
+
utilities: "utilities";
|
|
286
|
+
html: "html";
|
|
287
|
+
compliance: "compliance";
|
|
317
288
|
"web-scraping": "web-scraping";
|
|
318
289
|
"data-processing": "data-processing";
|
|
319
290
|
"file-operations": "file-operations";
|
|
@@ -324,14 +295,27 @@ declare const TpmjsMinimalSchema: z.ZodObject<{
|
|
|
324
295
|
"text-analysis": "text-analysis";
|
|
325
296
|
automation: "automation";
|
|
326
297
|
"ai-ml": "ai-ml";
|
|
327
|
-
security: "security";
|
|
328
298
|
monitoring: "monitoring";
|
|
329
|
-
|
|
299
|
+
doc: "doc";
|
|
300
|
+
text: "text";
|
|
330
301
|
}>;
|
|
331
302
|
description: z.ZodString;
|
|
332
303
|
}, z.core.$strip>;
|
|
333
304
|
declare const TpmjsRichSchema: z.ZodObject<{
|
|
334
305
|
category: z.ZodEnum<{
|
|
306
|
+
research: "research";
|
|
307
|
+
web: "web";
|
|
308
|
+
data: "data";
|
|
309
|
+
documentation: "documentation";
|
|
310
|
+
engineering: "engineering";
|
|
311
|
+
security: "security";
|
|
312
|
+
statistics: "statistics";
|
|
313
|
+
ops: "ops";
|
|
314
|
+
agent: "agent";
|
|
315
|
+
sandbox: "sandbox";
|
|
316
|
+
utilities: "utilities";
|
|
317
|
+
html: "html";
|
|
318
|
+
compliance: "compliance";
|
|
335
319
|
"web-scraping": "web-scraping";
|
|
336
320
|
"data-processing": "data-processing";
|
|
337
321
|
"file-operations": "file-operations";
|
|
@@ -342,9 +326,9 @@ declare const TpmjsRichSchema: z.ZodObject<{
|
|
|
342
326
|
"text-analysis": "text-analysis";
|
|
343
327
|
automation: "automation";
|
|
344
328
|
"ai-ml": "ai-ml";
|
|
345
|
-
security: "security";
|
|
346
329
|
monitoring: "monitoring";
|
|
347
|
-
|
|
330
|
+
doc: "doc";
|
|
331
|
+
text: "text";
|
|
348
332
|
}>;
|
|
349
333
|
description: z.ZodString;
|
|
350
334
|
parameters: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
package/dist/tpmjs.js
CHANGED
|
@@ -2,6 +2,21 @@ import { z } from 'zod';
|
|
|
2
2
|
|
|
3
3
|
// src/tpmjs.ts
|
|
4
4
|
var TPMJS_CATEGORIES = [
|
|
5
|
+
// Core categories
|
|
6
|
+
"research",
|
|
7
|
+
"web",
|
|
8
|
+
"data",
|
|
9
|
+
"documentation",
|
|
10
|
+
"engineering",
|
|
11
|
+
"security",
|
|
12
|
+
"statistics",
|
|
13
|
+
"ops",
|
|
14
|
+
"agent",
|
|
15
|
+
"sandbox",
|
|
16
|
+
"utilities",
|
|
17
|
+
"html",
|
|
18
|
+
"compliance",
|
|
19
|
+
// Legacy categories (kept for backward compatibility)
|
|
5
20
|
"web-scraping",
|
|
6
21
|
"data-processing",
|
|
7
22
|
"file-operations",
|
|
@@ -12,9 +27,10 @@ var TPMJS_CATEGORIES = [
|
|
|
12
27
|
"text-analysis",
|
|
13
28
|
"automation",
|
|
14
29
|
"ai-ml",
|
|
15
|
-
"security",
|
|
16
30
|
"monitoring",
|
|
17
|
-
|
|
31
|
+
// Aliases
|
|
32
|
+
"doc",
|
|
33
|
+
"text"
|
|
18
34
|
];
|
|
19
35
|
var TpmjsParameterSchema = z.object({
|
|
20
36
|
name: z.string().min(1),
|
|
@@ -40,10 +56,7 @@ var TpmjsAiAgentSchema = z.object({
|
|
|
40
56
|
});
|
|
41
57
|
var TpmjsToolDefinitionSchema = z.object({
|
|
42
58
|
// Required: The export name of the tool from the package
|
|
43
|
-
|
|
44
|
-
name: z.string().min(1).optional(),
|
|
45
|
-
// @deprecated - renamed to 'name', kept for backward compatibility
|
|
46
|
-
exportName: z.string().min(1).optional(),
|
|
59
|
+
name: z.string().min(1, "Tool name is required"),
|
|
47
60
|
// Optional - auto-extracted from tool if not provided
|
|
48
61
|
description: z.string().min(20, "Description must be at least 20 characters").max(500).optional(),
|
|
49
62
|
// @deprecated - now auto-extracted from tool's inputSchema
|
|
@@ -52,16 +65,6 @@ var TpmjsToolDefinitionSchema = z.object({
|
|
|
52
65
|
returns: TpmjsReturnsSchema.optional(),
|
|
53
66
|
// @deprecated - now auto-extracted from tool
|
|
54
67
|
aiAgent: TpmjsAiAgentSchema.optional()
|
|
55
|
-
}).transform((data) => ({
|
|
56
|
-
// Transform exportName to name for backward compatibility
|
|
57
|
-
name: data.name || data.exportName || "",
|
|
58
|
-
description: data.description,
|
|
59
|
-
parameters: data.parameters,
|
|
60
|
-
returns: data.returns,
|
|
61
|
-
aiAgent: data.aiAgent
|
|
62
|
-
})).refine((data) => data.name.length > 0, {
|
|
63
|
-
message: "Either name or exportName is required",
|
|
64
|
-
path: ["name"]
|
|
65
68
|
});
|
|
66
69
|
var TpmjsMultiToolSchema = z.object({
|
|
67
70
|
category: z.enum(TPMJS_CATEGORIES, {
|