@hailer/mcp 0.0.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/.claude/commands/tool-builder.md +37 -0
- package/.claude/commands/ws-pull.md +44 -0
- package/.claude/settings.json +8 -0
- package/.claude/settings.local.json +49 -0
- package/.claude/skills/activity-api/SKILL.md +96 -0
- package/.claude/skills/activity-api/references/activity-endpoints.md +845 -0
- package/.claude/skills/add-app-member-skill/SKILL.md +977 -0
- package/.claude/skills/agent-building/SKILL.md +243 -0
- package/.claude/skills/agent-building/references/architecture-patterns.md +446 -0
- package/.claude/skills/agent-building/references/code-examples.md +587 -0
- package/.claude/skills/agent-building/references/implementation-guide.md +619 -0
- package/.claude/skills/app-api/SKILL.md +219 -0
- package/.claude/skills/app-api/references/app-endpoints.md +759 -0
- package/.claude/skills/building-hailer-apps-skill/SKILL.md +548 -0
- package/.claude/skills/create-app-skill/SKILL.md +1101 -0
- package/.claude/skills/create-insight-skill/SKILL.md +1317 -0
- package/.claude/skills/get-insight-data-skill/SKILL.md +1053 -0
- package/.claude/skills/hailer-api/SKILL.md +283 -0
- package/.claude/skills/hailer-api/references/activities.md +620 -0
- package/.claude/skills/hailer-api/references/authentication.md +216 -0
- package/.claude/skills/hailer-api/references/datasets.md +437 -0
- package/.claude/skills/hailer-api/references/files.md +301 -0
- package/.claude/skills/hailer-api/references/insights.md +469 -0
- package/.claude/skills/hailer-api/references/workflows.md +720 -0
- package/.claude/skills/hailer-api/references/workspaces-users.md +445 -0
- package/.claude/skills/insight-api/SKILL.md +185 -0
- package/.claude/skills/insight-api/references/insight-endpoints.md +514 -0
- package/.claude/skills/install-workflow-skill/SKILL.md +1056 -0
- package/.claude/skills/list-apps-skill/SKILL.md +1010 -0
- package/.claude/skills/list-workflows-minimal-skill/SKILL.md +992 -0
- package/.claude/skills/local-first-skill/SKILL.md +570 -0
- package/.claude/skills/mcp-tools/SKILL.md +419 -0
- package/.claude/skills/mcp-tools/references/api-endpoints.md +499 -0
- package/.claude/skills/mcp-tools/references/data-structures.md +554 -0
- package/.claude/skills/mcp-tools/references/implementation-patterns.md +717 -0
- package/.claude/skills/preview-insight-skill/SKILL.md +1290 -0
- package/.claude/skills/publish-hailer-app-skill/SKILL.md +453 -0
- package/.claude/skills/remove-app-member-skill/SKILL.md +671 -0
- package/.claude/skills/remove-app-skill/SKILL.md +985 -0
- package/.claude/skills/remove-insight-skill/SKILL.md +1011 -0
- package/.claude/skills/remove-workflow-skill/SKILL.md +920 -0
- package/.claude/skills/scaffold-hailer-app-skill/SKILL.md +1034 -0
- package/.claude/skills/skill-testing/README.md +137 -0
- package/.claude/skills/skill-testing/SKILL.md +348 -0
- package/.claude/skills/skill-testing/references/test-patterns.md +705 -0
- package/.claude/skills/skill-testing/references/testing-guide.md +603 -0
- package/.claude/skills/skill-testing/references/validation-checklist.md +537 -0
- package/.claude/skills/tool-builder/SKILL.md +328 -0
- package/.claude/skills/update-app-skill/SKILL.md +970 -0
- package/.claude/skills/update-workflow-field-skill/SKILL.md +1098 -0
- package/.env.example +81 -0
- package/.mcp.json +13 -0
- package/README.md +297 -0
- package/dist/app.d.ts +4 -0
- package/dist/app.js +74 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.js +5 -0
- package/dist/client/adaptive-documentation-bot.d.ts +108 -0
- package/dist/client/adaptive-documentation-bot.js +475 -0
- package/dist/client/adaptive-documentation-types.d.ts +66 -0
- package/dist/client/adaptive-documentation-types.js +9 -0
- package/dist/client/agent-activity-bot.d.ts +51 -0
- package/dist/client/agent-activity-bot.js +166 -0
- package/dist/client/agent-tracker.d.ts +499 -0
- package/dist/client/agent-tracker.js +659 -0
- package/dist/client/description-updater.d.ts +56 -0
- package/dist/client/description-updater.js +259 -0
- package/dist/client/log-parser.d.ts +72 -0
- package/dist/client/log-parser.js +387 -0
- package/dist/client/mcp-client.d.ts +50 -0
- package/dist/client/mcp-client.js +532 -0
- package/dist/client/message-processor.d.ts +35 -0
- package/dist/client/message-processor.js +352 -0
- package/dist/client/multi-bot-manager.d.ts +24 -0
- package/dist/client/multi-bot-manager.js +74 -0
- package/dist/client/providers/anthropic-provider.d.ts +19 -0
- package/dist/client/providers/anthropic-provider.js +631 -0
- package/dist/client/providers/llm-provider.d.ts +47 -0
- package/dist/client/providers/llm-provider.js +367 -0
- package/dist/client/providers/openai-provider.d.ts +23 -0
- package/dist/client/providers/openai-provider.js +621 -0
- package/dist/client/simple-llm-caller.d.ts +19 -0
- package/dist/client/simple-llm-caller.js +100 -0
- package/dist/client/skill-generator.d.ts +81 -0
- package/dist/client/skill-generator.js +386 -0
- package/dist/client/test-adaptive-bot.d.ts +9 -0
- package/dist/client/test-adaptive-bot.js +82 -0
- package/dist/client/token-pricing.d.ts +38 -0
- package/dist/client/token-pricing.js +127 -0
- package/dist/client/token-tracker.d.ts +232 -0
- package/dist/client/token-tracker.js +457 -0
- package/dist/client/token-usage-bot.d.ts +53 -0
- package/dist/client/token-usage-bot.js +153 -0
- package/dist/client/tool-executor.d.ts +69 -0
- package/dist/client/tool-executor.js +159 -0
- package/dist/client/tool-schema-loader.d.ts +60 -0
- package/dist/client/tool-schema-loader.js +178 -0
- package/dist/client/types.d.ts +69 -0
- package/dist/client/types.js +7 -0
- package/dist/config.d.ts +162 -0
- package/dist/config.js +296 -0
- package/dist/core.d.ts +26 -0
- package/dist/core.js +147 -0
- package/dist/lib/context-manager.d.ts +111 -0
- package/dist/lib/context-manager.js +431 -0
- package/dist/lib/logger.d.ts +74 -0
- package/dist/lib/logger.js +277 -0
- package/dist/lib/materialize.d.ts +3 -0
- package/dist/lib/materialize.js +101 -0
- package/dist/lib/normalizedName.d.ts +7 -0
- package/dist/lib/normalizedName.js +48 -0
- package/dist/lib/prompt-length-manager.d.ts +81 -0
- package/dist/lib/prompt-length-manager.js +457 -0
- package/dist/lib/terminal-prompt.d.ts +9 -0
- package/dist/lib/terminal-prompt.js +108 -0
- package/dist/mcp/UserContextCache.d.ts +56 -0
- package/dist/mcp/UserContextCache.js +163 -0
- package/dist/mcp/auth.d.ts +2 -0
- package/dist/mcp/auth.js +29 -0
- package/dist/mcp/hailer-clients.d.ts +42 -0
- package/dist/mcp/hailer-clients.js +246 -0
- package/dist/mcp/signal-handler.d.ts +45 -0
- package/dist/mcp/signal-handler.js +317 -0
- package/dist/mcp/tool-registry.d.ts +100 -0
- package/dist/mcp/tool-registry.js +306 -0
- package/dist/mcp/tools/activity.d.ts +15 -0
- package/dist/mcp/tools/activity.js +955 -0
- package/dist/mcp/tools/app.d.ts +20 -0
- package/dist/mcp/tools/app.js +1488 -0
- package/dist/mcp/tools/discussion.d.ts +19 -0
- package/dist/mcp/tools/discussion.js +950 -0
- package/dist/mcp/tools/file.d.ts +15 -0
- package/dist/mcp/tools/file.js +119 -0
- package/dist/mcp/tools/insight.d.ts +17 -0
- package/dist/mcp/tools/insight.js +806 -0
- package/dist/mcp/tools/skill.d.ts +10 -0
- package/dist/mcp/tools/skill.js +279 -0
- package/dist/mcp/tools/user.d.ts +10 -0
- package/dist/mcp/tools/user.js +108 -0
- package/dist/mcp/tools/workflow-template.d.ts +19 -0
- package/dist/mcp/tools/workflow-template.js +822 -0
- package/dist/mcp/tools/workflow.d.ts +18 -0
- package/dist/mcp/tools/workflow.js +1362 -0
- package/dist/mcp/utils/api-errors.d.ts +45 -0
- package/dist/mcp/utils/api-errors.js +160 -0
- package/dist/mcp/utils/data-transformers.d.ts +102 -0
- package/dist/mcp/utils/data-transformers.js +194 -0
- package/dist/mcp/utils/file-upload.d.ts +33 -0
- package/dist/mcp/utils/file-upload.js +148 -0
- package/dist/mcp/utils/hailer-api-client.d.ts +120 -0
- package/dist/mcp/utils/hailer-api-client.js +323 -0
- package/dist/mcp/utils/index.d.ts +13 -0
- package/dist/mcp/utils/index.js +39 -0
- package/dist/mcp/utils/logger.d.ts +42 -0
- package/dist/mcp/utils/logger.js +103 -0
- package/dist/mcp/utils/types.d.ts +286 -0
- package/dist/mcp/utils/types.js +7 -0
- package/dist/mcp/workspace-cache.d.ts +42 -0
- package/dist/mcp/workspace-cache.js +97 -0
- package/dist/mcp-server.d.ts +42 -0
- package/dist/mcp-server.js +280 -0
- package/package.json +56 -0
- package/tsconfig.json +23 -0
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Clean Tool Registry with Dependency Injection
|
|
4
|
+
*
|
|
5
|
+
* No singletons, no statics - just clean, explicit tool registration
|
|
6
|
+
* with per-agent access control via dependency injection.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.ToolRegistry = exports.ToolGroup = void 0;
|
|
10
|
+
const zod_1 = require("zod");
|
|
11
|
+
const logger_1 = require("../lib/logger");
|
|
12
|
+
const logger = (0, logger_1.createLogger)({ component: 'tool-registry' });
|
|
13
|
+
/**
|
|
14
|
+
* Tool groups for access control
|
|
15
|
+
* READ: Safe read operations (workflows, activities, schemas)
|
|
16
|
+
* WRITE: Create/update operations (activities, discussions)
|
|
17
|
+
* PLAYGROUND: Admin/dev tools (workflow/app management)
|
|
18
|
+
* NUCLEAR: Destructive operations (remove workflows, apps, insights, templates)
|
|
19
|
+
*/
|
|
20
|
+
var ToolGroup;
|
|
21
|
+
(function (ToolGroup) {
|
|
22
|
+
ToolGroup["READ"] = "read";
|
|
23
|
+
ToolGroup["WRITE"] = "write";
|
|
24
|
+
ToolGroup["PLAYGROUND"] = "playground";
|
|
25
|
+
ToolGroup["NUCLEAR"] = "nuclear";
|
|
26
|
+
})(ToolGroup || (exports.ToolGroup = ToolGroup = {}));
|
|
27
|
+
/**
|
|
28
|
+
* ToolRegistry - Clean, testable, dependency-injected tool registry
|
|
29
|
+
*
|
|
30
|
+
* NO SINGLETON PATTERN - instantiated explicitly and passed through DI
|
|
31
|
+
*/
|
|
32
|
+
class ToolRegistry {
|
|
33
|
+
tools = new Map();
|
|
34
|
+
enableNuclearTools;
|
|
35
|
+
constructor(options = {}) {
|
|
36
|
+
this.enableNuclearTools = options.enableNuclearTools ?? false;
|
|
37
|
+
logger.debug('ToolRegistry instance created', {
|
|
38
|
+
enableNuclearTools: this.enableNuclearTools
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Add a tool to the registry
|
|
43
|
+
*/
|
|
44
|
+
addTool(tool) {
|
|
45
|
+
// Short-circuit: Skip NUCLEAR tools when not enabled
|
|
46
|
+
if (tool.group === ToolGroup.NUCLEAR && !this.enableNuclearTools) {
|
|
47
|
+
logger.info('Skipping NUCLEAR tool (not enabled)', {
|
|
48
|
+
name: tool.name,
|
|
49
|
+
group: tool.group
|
|
50
|
+
});
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
if (this.tools.has(tool.name)) {
|
|
54
|
+
logger.warn('Tool already registered, replacing', { name: tool.name });
|
|
55
|
+
}
|
|
56
|
+
this.tools.set(tool.name, tool);
|
|
57
|
+
logger.debug('Tool registered', { name: tool.name, group: tool.group });
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Get tool definitions with optional filtering
|
|
61
|
+
*
|
|
62
|
+
* @param filter - Optional filter configuration
|
|
63
|
+
* @param filter.allowedGroups - Filter by tool groups
|
|
64
|
+
* @param filter.allowedTools - Explicit whitelist of tool names
|
|
65
|
+
*/
|
|
66
|
+
getToolDefinitions(filter) {
|
|
67
|
+
let toolsToExpose = Array.from(this.tools.values());
|
|
68
|
+
if (filter) {
|
|
69
|
+
if (filter.allowedTools) {
|
|
70
|
+
// Explicit whitelist by tool name (takes precedence)
|
|
71
|
+
toolsToExpose = toolsToExpose.filter(t => filter.allowedTools.includes(t.name));
|
|
72
|
+
logger.debug('Filtered tools by allowedTools', {
|
|
73
|
+
count: toolsToExpose.length,
|
|
74
|
+
allowedTools: filter.allowedTools
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
else if (filter.allowedGroups) {
|
|
78
|
+
// Filter by tool groups
|
|
79
|
+
toolsToExpose = toolsToExpose.filter(t => filter.allowedGroups.includes(t.group));
|
|
80
|
+
logger.debug('Filtered tools by allowedGroups', {
|
|
81
|
+
count: toolsToExpose.length,
|
|
82
|
+
allowedGroups: filter.allowedGroups
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return toolsToExpose.map(tool => ({
|
|
87
|
+
name: tool.name,
|
|
88
|
+
description: tool.description,
|
|
89
|
+
inputSchema: this.convertZodSchemaToJsonSchema(tool.schema)
|
|
90
|
+
}));
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Get specific tool schema on-demand
|
|
94
|
+
* Token-efficient: ~200 tokens per tool vs loading all tools upfront
|
|
95
|
+
*/
|
|
96
|
+
getToolSchema(toolName) {
|
|
97
|
+
const tool = this.tools.get(toolName);
|
|
98
|
+
if (!tool) {
|
|
99
|
+
logger.warn('Tool not found', { toolName });
|
|
100
|
+
return null;
|
|
101
|
+
}
|
|
102
|
+
return {
|
|
103
|
+
name: tool.name,
|
|
104
|
+
description: tool.description,
|
|
105
|
+
inputSchema: this.convertZodSchemaToJsonSchema(tool.schema)
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Execute tool with validation
|
|
110
|
+
*/
|
|
111
|
+
async executeTool(name, args, context) {
|
|
112
|
+
const tool = this.tools.get(name);
|
|
113
|
+
if (!tool) {
|
|
114
|
+
throw new Error(`Tool "${name}" not found`);
|
|
115
|
+
}
|
|
116
|
+
logger.debug('Executing tool', {
|
|
117
|
+
name,
|
|
118
|
+
apiKey: context.apiKey.substring(0, 8) + '...'
|
|
119
|
+
});
|
|
120
|
+
// Zod validation
|
|
121
|
+
try {
|
|
122
|
+
const validated = tool.schema.parse(args);
|
|
123
|
+
return await tool.execute(validated, context);
|
|
124
|
+
}
|
|
125
|
+
catch (error) {
|
|
126
|
+
if (error instanceof zod_1.z.ZodError) {
|
|
127
|
+
const errorDetails = error.errors.map(e => `${e.path.join('.')}: ${e.message}`).join(', ');
|
|
128
|
+
logger.warn('Tool validation failed', {
|
|
129
|
+
toolName: name,
|
|
130
|
+
errors: errorDetails,
|
|
131
|
+
receivedArgs: JSON.stringify(args)
|
|
132
|
+
});
|
|
133
|
+
// Check if tool has a skill hint
|
|
134
|
+
const hasSkillHint = tool.description.includes('Use Skill');
|
|
135
|
+
const skillName = hasSkillHint ? tool.description.match(/`([^`]+)-skill`/)?.[1] + '-skill' : null;
|
|
136
|
+
const errorMessage = `❌ **Validation Error for \`${name}\`**
|
|
137
|
+
|
|
138
|
+
**Errors:** ${errorDetails}
|
|
139
|
+
|
|
140
|
+
**You provided:**
|
|
141
|
+
\`\`\`json
|
|
142
|
+
${JSON.stringify(args, null, 2)}
|
|
143
|
+
\`\`\`
|
|
144
|
+
|
|
145
|
+
${skillName ? `💡 **Next step:** Load the skill first to see correct format and examples:
|
|
146
|
+
\`\`\`
|
|
147
|
+
get_skill({ skillName: "${skillName}" })
|
|
148
|
+
\`\`\`
|
|
149
|
+
|
|
150
|
+
Then retry \`${name}\` with the correct format from the skill examples.` : `💡 **Next step:** Use \`tools/get_schema\` to see the full schema for \`${name}\`, then retry with correct parameters.`}`;
|
|
151
|
+
return {
|
|
152
|
+
content: [{
|
|
153
|
+
type: "text",
|
|
154
|
+
text: errorMessage
|
|
155
|
+
}]
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
throw error;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Get tool metadata (for access control checks)
|
|
163
|
+
*/
|
|
164
|
+
getTool(name) {
|
|
165
|
+
return this.tools.get(name);
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Get total tool count
|
|
169
|
+
*/
|
|
170
|
+
getToolCount() {
|
|
171
|
+
return this.tools.size;
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Get statistics for monitoring/debugging
|
|
175
|
+
*/
|
|
176
|
+
getCacheStats() {
|
|
177
|
+
const byGroup = {
|
|
178
|
+
[ToolGroup.READ]: 0,
|
|
179
|
+
[ToolGroup.WRITE]: 0,
|
|
180
|
+
[ToolGroup.PLAYGROUND]: 0,
|
|
181
|
+
[ToolGroup.NUCLEAR]: 0
|
|
182
|
+
};
|
|
183
|
+
for (const tool of this.tools.values()) {
|
|
184
|
+
byGroup[tool.group]++;
|
|
185
|
+
}
|
|
186
|
+
return {
|
|
187
|
+
totalTools: this.tools.size,
|
|
188
|
+
toolNames: Array.from(this.tools.keys()),
|
|
189
|
+
byGroup
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Convert Zod schema to JSON Schema format (required by MCP protocol)
|
|
194
|
+
*/
|
|
195
|
+
convertZodSchemaToJsonSchema(zodSchema) {
|
|
196
|
+
// Handle ZodObject by extracting its shape
|
|
197
|
+
if (zodSchema._def?.typeName === 'ZodObject') {
|
|
198
|
+
zodSchema = zodSchema._def.shape();
|
|
199
|
+
}
|
|
200
|
+
const properties = {};
|
|
201
|
+
const required = [];
|
|
202
|
+
// Handle the schema object
|
|
203
|
+
for (const [key, value] of Object.entries(zodSchema)) {
|
|
204
|
+
if (value && typeof value === "object" && "_def" in value) {
|
|
205
|
+
const zodType = value;
|
|
206
|
+
const property = this.convertZodTypeToJsonSchema(zodType);
|
|
207
|
+
// Handle optional vs required - Check for ZodOptional and ZodDefault wrappers
|
|
208
|
+
const isOptional = zodType._def?.typeName === 'ZodOptional';
|
|
209
|
+
const hasDefault = zodType._def?.typeName === 'ZodDefault';
|
|
210
|
+
if (!isOptional && !hasDefault) {
|
|
211
|
+
required.push(key);
|
|
212
|
+
}
|
|
213
|
+
// Handle default values - Extract from ZodDefault wrapper
|
|
214
|
+
if (hasDefault && typeof zodType._def?.defaultValue === 'function') {
|
|
215
|
+
property.default = zodType._def.defaultValue();
|
|
216
|
+
}
|
|
217
|
+
properties[key] = property;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
return {
|
|
221
|
+
type: "object",
|
|
222
|
+
properties,
|
|
223
|
+
required,
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Convert a single Zod type to JSON Schema
|
|
228
|
+
*/
|
|
229
|
+
convertZodTypeToJsonSchema(zodType) {
|
|
230
|
+
// Unwrap ZodOptional and ZodDefault wrappers to get the inner type
|
|
231
|
+
let unwrappedType = zodType;
|
|
232
|
+
while (unwrappedType._def?.typeName === 'ZodOptional' || unwrappedType._def?.typeName === 'ZodDefault') {
|
|
233
|
+
unwrappedType = unwrappedType._def.innerType;
|
|
234
|
+
}
|
|
235
|
+
const typeName = unwrappedType._def?.typeName;
|
|
236
|
+
const property = {};
|
|
237
|
+
// Add description if available (check both wrapped and unwrapped)
|
|
238
|
+
if (zodType._def?.description) {
|
|
239
|
+
property.description = zodType._def.description;
|
|
240
|
+
}
|
|
241
|
+
else if (unwrappedType._def?.description) {
|
|
242
|
+
property.description = unwrappedType._def.description;
|
|
243
|
+
}
|
|
244
|
+
switch (typeName) {
|
|
245
|
+
case "ZodString":
|
|
246
|
+
property.type = "string";
|
|
247
|
+
break;
|
|
248
|
+
case "ZodNumber":
|
|
249
|
+
property.type = "number";
|
|
250
|
+
break;
|
|
251
|
+
case "ZodBoolean":
|
|
252
|
+
property.type = "boolean";
|
|
253
|
+
break;
|
|
254
|
+
case "ZodArray":
|
|
255
|
+
property.type = "array";
|
|
256
|
+
// Handle array items
|
|
257
|
+
if (unwrappedType._def?.type) {
|
|
258
|
+
property.items = this.convertZodTypeToJsonSchema(unwrappedType._def.type);
|
|
259
|
+
}
|
|
260
|
+
else {
|
|
261
|
+
property.items = { type: "string" };
|
|
262
|
+
}
|
|
263
|
+
break;
|
|
264
|
+
case "ZodObject":
|
|
265
|
+
property.type = "object";
|
|
266
|
+
// Recursively handle object properties if needed
|
|
267
|
+
if (unwrappedType._def?.shape) {
|
|
268
|
+
const nestedSchema = this.convertZodSchemaToJsonSchema(unwrappedType._def.shape);
|
|
269
|
+
property.properties = nestedSchema.properties;
|
|
270
|
+
if (nestedSchema.required?.length > 0) {
|
|
271
|
+
property.required = nestedSchema.required;
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
break;
|
|
275
|
+
case "ZodRecord":
|
|
276
|
+
property.type = "object";
|
|
277
|
+
break;
|
|
278
|
+
case "ZodEnum":
|
|
279
|
+
property.type = "string";
|
|
280
|
+
// Handle enum values
|
|
281
|
+
if (unwrappedType._def?.values) {
|
|
282
|
+
property.enum = Array.from(unwrappedType._def.values);
|
|
283
|
+
}
|
|
284
|
+
break;
|
|
285
|
+
case "ZodUnion":
|
|
286
|
+
// For unions, try to extract types
|
|
287
|
+
if (unwrappedType._def?.options && unwrappedType._def.options.length > 0) {
|
|
288
|
+
const firstOption = unwrappedType._def.options[0];
|
|
289
|
+
const firstType = this.convertZodTypeToJsonSchema(firstOption);
|
|
290
|
+
property.type = firstType.type;
|
|
291
|
+
if (firstType.enum) {
|
|
292
|
+
property.enum = firstType.enum;
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
else {
|
|
296
|
+
property.type = "string";
|
|
297
|
+
}
|
|
298
|
+
break;
|
|
299
|
+
default:
|
|
300
|
+
property.type = "string";
|
|
301
|
+
}
|
|
302
|
+
return property;
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
exports.ToolRegistry = ToolRegistry;
|
|
306
|
+
//# sourceMappingURL=tool-registry.js.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Activity Tools - Clean Architecture Implementation
|
|
3
|
+
*
|
|
4
|
+
* Tools for managing Hailer activities:
|
|
5
|
+
* - List activities with filtering and pagination (READ)
|
|
6
|
+
* - Show activity details (READ)
|
|
7
|
+
* - Create new activities (WRITE)
|
|
8
|
+
* - Update existing activities (WRITE)
|
|
9
|
+
*/
|
|
10
|
+
import { Tool } from '../tool-registry';
|
|
11
|
+
export declare const listActivitiesTool: Tool;
|
|
12
|
+
export declare const showActivityByIdTool: Tool;
|
|
13
|
+
export declare const createActivityTool: Tool;
|
|
14
|
+
export declare const updateActivityTool: Tool;
|
|
15
|
+
//# sourceMappingURL=activity.d.ts.map
|