refactor: replace exportName with name throughout codebase
- Update TpmjsToolDefinitionSchema to only use 'name' field - Add 'sandbox' as valid category for sprites tools - Update all package.json files to use 'name' instead of 'exportName' - Update documentation and source files accordingly - Add 11 new sprites tools for sandbox/code-execution
This commit is contained in:
parent
b1dd3371cd
commit
2cd2b10cd0
91 changed files with 4019 additions and 195 deletions
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@tpmjs/types",
|
||||
"version": "0.2.0",
|
||||
"version": "0.2.1",
|
||||
"description": "Shared TypeScript types and Zod schemas for TPMJS",
|
||||
"author": "TPMJS",
|
||||
"license": "MIT",
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ export const TPMJS_CATEGORIES = [
|
|||
'statistics',
|
||||
'ops',
|
||||
'agent',
|
||||
'sandbox',
|
||||
'utilities',
|
||||
'html',
|
||||
'compliance',
|
||||
|
|
@ -101,44 +102,23 @@ export type TpmjsAiAgent = z.infer<typeof TpmjsAiAgentSchema>;
|
|||
* Optional fields (auto-extracted if not provided):
|
||||
* - description: A description of what the tool does (20-500 chars) - auto-extracted from tool
|
||||
*
|
||||
* @deprecated fields (now auto-extracted, kept for backward compatibility):
|
||||
* @deprecated fields (now auto-extracted):
|
||||
* - parameters: Tool input parameters - auto-extracted from inputSchema
|
||||
* - returns: Tool return type - auto-extracted from tool
|
||||
* - aiAgent: AI agent guidance - auto-extracted from tool
|
||||
* - exportName: Renamed to 'name' - kept for backward compatibility with published packages
|
||||
*/
|
||||
export const TpmjsToolDefinitionSchema = z
|
||||
.object({
|
||||
// Required: The export name of the tool from the package
|
||||
// Accepts both 'name' and legacy 'exportName' field
|
||||
name: z.string().min(1).optional(),
|
||||
// @deprecated - renamed to 'name', kept for backward compatibility
|
||||
exportName: z.string().min(1).optional(),
|
||||
// Optional - auto-extracted from tool if not provided
|
||||
description: z
|
||||
.string()
|
||||
.min(20, 'Description must be at least 20 characters')
|
||||
.max(500)
|
||||
.optional(),
|
||||
// @deprecated - now auto-extracted from tool's inputSchema
|
||||
parameters: z.array(TpmjsParameterSchema).optional(),
|
||||
// @deprecated - now auto-extracted from tool
|
||||
returns: TpmjsReturnsSchema.optional(),
|
||||
// @deprecated - now auto-extracted from tool
|
||||
aiAgent: TpmjsAiAgentSchema.optional(),
|
||||
})
|
||||
.transform((data) => ({
|
||||
// Transform exportName to name for backward compatibility
|
||||
name: data.name || data.exportName || '',
|
||||
description: data.description,
|
||||
parameters: data.parameters,
|
||||
returns: data.returns,
|
||||
aiAgent: data.aiAgent,
|
||||
}))
|
||||
.refine((data) => data.name.length > 0, {
|
||||
message: 'Either name or exportName is required',
|
||||
path: ['name'],
|
||||
});
|
||||
export const TpmjsToolDefinitionSchema = z.object({
|
||||
// Required: The export name of the tool from the package
|
||||
name: z.string().min(1, 'Tool name is required'),
|
||||
// Optional - auto-extracted from tool if not provided
|
||||
description: z.string().min(20, 'Description must be at least 20 characters').max(500).optional(),
|
||||
// @deprecated - now auto-extracted from tool's inputSchema
|
||||
parameters: z.array(TpmjsParameterSchema).optional(),
|
||||
// @deprecated - now auto-extracted from tool
|
||||
returns: TpmjsReturnsSchema.optional(),
|
||||
// @deprecated - now auto-extracted from tool
|
||||
aiAgent: TpmjsAiAgentSchema.optional(),
|
||||
});
|
||||
|
||||
export type TpmjsToolDefinition = z.infer<typeof TpmjsToolDefinitionSchema>;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue