@fortressllm/sybil 0.0.3
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/.env copy +91 -0
- package/.env.example +139 -0
- package/BROWSER_CONTROL.md +354 -0
- package/CLI_CHAT_FEATURE.md +224 -0
- package/CLI_GUIDE.md +359 -0
- package/DYNAMIC_SKILLS.md +345 -0
- package/DockerFile.sandbox +14 -0
- package/PROGRESS.md +249 -0
- package/README.md +281 -0
- package/RENAME_LOG.md +62 -0
- package/SIMPLIFIED_TELEGRAM_UX.md +273 -0
- package/SYBIL_SUMMARY.md +360 -0
- package/TASK11_NETWORK.md +202 -0
- package/TASK14_CLI.md +432 -0
- package/TASK8_SAFETY.md +317 -0
- package/TASK9_COMPLETION.md +186 -0
- package/TASK9_SUMMARY.md +201 -0
- package/TELEGRAM_OTP_AUTH.md +359 -0
- package/VECTOR_MEMORY.md +163 -0
- package/assets/logo.png +0 -0
- package/cypfq_code_search.md +287 -0
- package/cypfq_driver_search.md +297 -0
- package/cypfq_github_search.md +297 -0
- package/cypfq_repo_search.md +370 -0
- package/dist/agents/autonomous-agent.d.ts +61 -0
- package/dist/agents/autonomous-agent.d.ts.map +1 -0
- package/dist/agents/autonomous-agent.js +536 -0
- package/dist/agents/autonomous-agent.js.map +1 -0
- package/dist/agents/network.d.ts +1006 -0
- package/dist/agents/network.d.ts.map +1 -0
- package/dist/agents/network.js +1266 -0
- package/dist/agents/network.js.map +1 -0
- package/dist/cli/commands/backup.d.ts +3 -0
- package/dist/cli/commands/backup.d.ts.map +1 -0
- package/dist/cli/commands/backup.js +63 -0
- package/dist/cli/commands/backup.js.map +1 -0
- package/dist/cli/commands/config.d.ts +3 -0
- package/dist/cli/commands/config.d.ts.map +1 -0
- package/dist/cli/commands/config.js +163 -0
- package/dist/cli/commands/config.js.map +1 -0
- package/dist/cli/commands/doctor.d.ts +3 -0
- package/dist/cli/commands/doctor.d.ts.map +1 -0
- package/dist/cli/commands/doctor.js +107 -0
- package/dist/cli/commands/doctor.js.map +1 -0
- package/dist/cli/commands/init.d.ts +3 -0
- package/dist/cli/commands/init.d.ts.map +1 -0
- package/dist/cli/commands/init.js +138 -0
- package/dist/cli/commands/init.js.map +1 -0
- package/dist/cli/commands/logs.d.ts +3 -0
- package/dist/cli/commands/logs.d.ts.map +1 -0
- package/dist/cli/commands/logs.js +81 -0
- package/dist/cli/commands/logs.js.map +1 -0
- package/dist/cli/commands/otp.d.ts +3 -0
- package/dist/cli/commands/otp.d.ts.map +1 -0
- package/dist/cli/commands/otp.js +142 -0
- package/dist/cli/commands/otp.js.map +1 -0
- package/dist/cli/commands/restore.d.ts +3 -0
- package/dist/cli/commands/restore.d.ts.map +1 -0
- package/dist/cli/commands/restore.js +99 -0
- package/dist/cli/commands/restore.js.map +1 -0
- package/dist/cli/commands/start.d.ts +3 -0
- package/dist/cli/commands/start.d.ts.map +1 -0
- package/dist/cli/commands/start.js +65 -0
- package/dist/cli/commands/start.js.map +1 -0
- package/dist/cli/commands/status.d.ts +3 -0
- package/dist/cli/commands/status.d.ts.map +1 -0
- package/dist/cli/commands/status.js +68 -0
- package/dist/cli/commands/status.js.map +1 -0
- package/dist/cli/commands/stop.d.ts +3 -0
- package/dist/cli/commands/stop.d.ts.map +1 -0
- package/dist/cli/commands/stop.js +62 -0
- package/dist/cli/commands/stop.js.map +1 -0
- package/dist/cli/commands/update.d.ts +3 -0
- package/dist/cli/commands/update.d.ts.map +1 -0
- package/dist/cli/commands/update.js +49 -0
- package/dist/cli/commands/update.js.map +1 -0
- package/dist/cli/commands/whatsapp.d.ts +3 -0
- package/dist/cli/commands/whatsapp.d.ts.map +1 -0
- package/dist/cli/commands/whatsapp.js +281 -0
- package/dist/cli/commands/whatsapp.js.map +1 -0
- package/dist/cli/index.d.ts +7 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +58 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli.d.ts +9 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +750 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +109 -0
- package/dist/index.js.map +1 -0
- package/dist/mastra/index.d.ts +4 -0
- package/dist/mastra/index.d.ts.map +1 -0
- package/dist/mastra/index.js +37 -0
- package/dist/mastra/index.js.map +1 -0
- package/dist/mastra/memory.d.ts +9 -0
- package/dist/mastra/memory.d.ts.map +1 -0
- package/dist/mastra/memory.js +92 -0
- package/dist/mastra/memory.js.map +1 -0
- package/dist/processors/index.d.ts +74 -0
- package/dist/processors/index.d.ts.map +1 -0
- package/dist/processors/index.js +153 -0
- package/dist/processors/index.js.map +1 -0
- package/dist/processors/semantic-recall.d.ts +63 -0
- package/dist/processors/semantic-recall.d.ts.map +1 -0
- package/dist/processors/semantic-recall.js +216 -0
- package/dist/processors/semantic-recall.js.map +1 -0
- package/dist/processors/tool-search.d.ts +26 -0
- package/dist/processors/tool-search.d.ts.map +1 -0
- package/dist/processors/tool-search.js +41 -0
- package/dist/processors/tool-search.js.map +1 -0
- package/dist/skills/dynamic/skill-generator.d.ts +169 -0
- package/dist/skills/dynamic/skill-generator.d.ts.map +1 -0
- package/dist/skills/dynamic/skill-generator.js +488 -0
- package/dist/skills/dynamic/skill-generator.js.map +1 -0
- package/dist/tools/agent-delegation-tools.d.ts +142 -0
- package/dist/tools/agent-delegation-tools.d.ts.map +1 -0
- package/dist/tools/agent-delegation-tools.js +263 -0
- package/dist/tools/agent-delegation-tools.js.map +1 -0
- package/dist/tools/browser-tools.d.ts +374 -0
- package/dist/tools/browser-tools.d.ts.map +1 -0
- package/dist/tools/browser-tools.js +752 -0
- package/dist/tools/browser-tools.js.map +1 -0
- package/dist/tools/dynamic/registry.d.ts +61 -0
- package/dist/tools/dynamic/registry.d.ts.map +1 -0
- package/dist/tools/dynamic/registry.js +121 -0
- package/dist/tools/dynamic/registry.js.map +1 -0
- package/dist/tools/dynamic/tool-generator.d.ts +99 -0
- package/dist/tools/dynamic/tool-generator.d.ts.map +1 -0
- package/dist/tools/dynamic/tool-generator.js +367 -0
- package/dist/tools/dynamic/tool-generator.js.map +1 -0
- package/dist/tools/extended-tools.d.ts +176 -0
- package/dist/tools/extended-tools.d.ts.map +1 -0
- package/dist/tools/extended-tools.js +464 -0
- package/dist/tools/extended-tools.js.map +1 -0
- package/dist/tools/library/calendar/index.d.ts +134 -0
- package/dist/tools/library/calendar/index.d.ts.map +1 -0
- package/dist/tools/library/calendar/index.js +160 -0
- package/dist/tools/library/calendar/index.js.map +1 -0
- package/dist/tools/podman-workspace-mcp-cli.d.ts +3 -0
- package/dist/tools/podman-workspace-mcp-cli.d.ts.map +1 -0
- package/dist/tools/podman-workspace-mcp-cli.js +12 -0
- package/dist/tools/podman-workspace-mcp-cli.js.map +1 -0
- package/dist/tools/podman-workspace-mcp.d.ts +247 -0
- package/dist/tools/podman-workspace-mcp.d.ts.map +1 -0
- package/dist/tools/podman-workspace-mcp.js +1093 -0
- package/dist/tools/podman-workspace-mcp.js.map +1 -0
- package/dist/tools/podman-workspace.d.ts +148 -0
- package/dist/tools/podman-workspace.d.ts.map +1 -0
- package/dist/tools/podman-workspace.js +682 -0
- package/dist/tools/podman-workspace.js.map +1 -0
- package/dist/tools/telegram-file-tools.d.ts +78 -0
- package/dist/tools/telegram-file-tools.d.ts.map +1 -0
- package/dist/tools/telegram-file-tools.js +294 -0
- package/dist/tools/telegram-file-tools.js.map +1 -0
- package/dist/tools/tool-registry.d.ts +467 -0
- package/dist/tools/tool-registry.d.ts.map +1 -0
- package/dist/tools/tool-registry.js +156 -0
- package/dist/tools/tool-registry.js.map +1 -0
- package/dist/tools/web-tools.d.ts +77 -0
- package/dist/tools/web-tools.d.ts.map +1 -0
- package/dist/tools/web-tools.js +416 -0
- package/dist/tools/web-tools.js.map +1 -0
- package/dist/tools/whatsapp-autoreply-tools.d.ts +118 -0
- package/dist/tools/whatsapp-autoreply-tools.d.ts.map +1 -0
- package/dist/tools/whatsapp-autoreply-tools.js +503 -0
- package/dist/tools/whatsapp-autoreply-tools.js.map +1 -0
- package/dist/tools/whatsapp-tools.d.ts +175 -0
- package/dist/tools/whatsapp-tools.d.ts.map +1 -0
- package/dist/tools/whatsapp-tools.js +566 -0
- package/dist/tools/whatsapp-tools.js.map +1 -0
- package/dist/utils/logger.d.ts +65 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +307 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/model-config.d.ts +73 -0
- package/dist/utils/model-config.d.ts.map +1 -0
- package/dist/utils/model-config.js +366 -0
- package/dist/utils/model-config.js.map +1 -0
- package/dist/utils/semantic-memory.d.ts +82 -0
- package/dist/utils/semantic-memory.d.ts.map +1 -0
- package/dist/utils/semantic-memory.js +189 -0
- package/dist/utils/semantic-memory.js.map +1 -0
- package/dist/utils/system.d.ts +2 -0
- package/dist/utils/system.d.ts.map +1 -0
- package/dist/utils/system.js +24 -0
- package/dist/utils/system.js.map +1 -0
- package/dist/utils/telegram-auth.d.ts +54 -0
- package/dist/utils/telegram-auth.d.ts.map +1 -0
- package/dist/utils/telegram-auth.js +146 -0
- package/dist/utils/telegram-auth.js.map +1 -0
- package/dist/utils/telegram.d.ts +7 -0
- package/dist/utils/telegram.d.ts.map +1 -0
- package/dist/utils/telegram.js +1494 -0
- package/dist/utils/telegram.js.map +1 -0
- package/dist/utils/whatsapp-client.d.ts +166 -0
- package/dist/utils/whatsapp-client.d.ts.map +1 -0
- package/dist/utils/whatsapp-client.js +722 -0
- package/dist/utils/whatsapp-client.js.map +1 -0
- package/dist/workflows/planner-workflow.d.ts +39 -0
- package/dist/workflows/planner-workflow.d.ts.map +1 -0
- package/dist/workflows/planner-workflow.js +165 -0
- package/dist/workflows/planner-workflow.js.map +1 -0
- package/dist/workflows/skill-builder-workflow.d.ts +16 -0
- package/dist/workflows/skill-builder-workflow.d.ts.map +1 -0
- package/dist/workflows/skill-builder-workflow.js +157 -0
- package/dist/workflows/skill-builder-workflow.js.map +1 -0
- package/dist/workspace/index.d.ts +23 -0
- package/dist/workspace/index.d.ts.map +1 -0
- package/dist/workspace/index.js +64 -0
- package/dist/workspace/index.js.map +1 -0
- package/docs/README.md +140 -0
- package/docs/api/agents.md +481 -0
- package/docs/api/browser-tools.md +469 -0
- package/docs/api/memory.md +629 -0
- package/docs/architecture/agent-networks.md +586 -0
- package/docs/architecture/memory.md +579 -0
- package/docs/architecture/overview.md +436 -0
- package/docs/architecture/tools.md +637 -0
- package/docs/cli-tui.md +367 -0
- package/docs/guides/environment-variables.md +502 -0
- package/docs/guides/troubleshooting.md +882 -0
- package/docs/tutorials/agent-networks.md +432 -0
- package/docs/tutorials/dynamic-tools.md +469 -0
- package/docs/tutorials/getting-started.md +263 -0
- package/docs/tutorials/skills.md +561 -0
- package/docs/tutorials/web-browsing.md +329 -0
- package/mastra.db-shm +0 -0
- package/mastra.db-wal +0 -0
- package/package.json +71 -0
- package/plan.md +601 -0
- package/skills/code-review/SKILL.md +48 -0
- package/skills/task-planning/SKILL.md +55 -0
- package/skills/web-research/SKILL.md +79 -0
- package/skills/whatsapp-management/SKILL.md +78 -0
- package/src/agents/autonomous-agent.ts +626 -0
- package/src/agents/network.ts +1307 -0
- package/src/cli/commands/backup.ts +78 -0
- package/src/cli/commands/config.ts +176 -0
- package/src/cli/commands/doctor.ts +111 -0
- package/src/cli/commands/init.ts +150 -0
- package/src/cli/commands/logs.ts +94 -0
- package/src/cli/commands/otp.ts +162 -0
- package/src/cli/commands/restore.ts +118 -0
- package/src/cli/commands/start.ts +76 -0
- package/src/cli/commands/status.ts +81 -0
- package/src/cli/commands/stop.ts +68 -0
- package/src/cli/commands/update.ts +61 -0
- package/src/cli/commands/whatsapp.ts +322 -0
- package/src/cli/index.ts +69 -0
- package/src/cli.ts +830 -0
- package/src/index.ts +124 -0
- package/src/mastra/index.ts +49 -0
- package/src/mastra/memory.ts +99 -0
- package/src/mastra/public/workspace/plan.md +115 -0
- package/src/mastra/public/workspace/research/react-tailwind/skill.md +47 -0
- package/src/processors/index.ts +170 -0
- package/src/processors/semantic-recall.ts +277 -0
- package/src/processors/tool-search.ts +46 -0
- package/src/skills/dynamic/skill-generator.ts +568 -0
- package/src/tools/agent-delegation-tools.ts +301 -0
- package/src/tools/browser-tools.ts +792 -0
- package/src/tools/dynamic/registry.ts +144 -0
- package/src/tools/dynamic/tool-generator.ts +406 -0
- package/src/tools/extended-tools.ts +498 -0
- package/src/tools/library/calendar/index.ts +172 -0
- package/src/tools/podman-workspace-mcp-cli.ts +14 -0
- package/src/tools/podman-workspace-mcp.ts +1290 -0
- package/src/tools/podman-workspace.ts +858 -0
- package/src/tools/telegram-file-tools.ts +320 -0
- package/src/tools/tool-registry.ts +233 -0
- package/src/tools/web-tools.ts +461 -0
- package/src/tools/whatsapp-autoreply-tools.ts +616 -0
- package/src/tools/whatsapp-tools.ts +602 -0
- package/src/utils/logger.ts +368 -0
- package/src/utils/model-config.ts +437 -0
- package/src/utils/semantic-memory.ts +230 -0
- package/src/utils/system.ts +25 -0
- package/src/utils/telegram-auth.ts +201 -0
- package/src/utils/telegram.ts +1847 -0
- package/src/utils/whatsapp-client.ts +808 -0
- package/src/workflows/planner-workflow.ts +178 -0
- package/src/workflows/skill-builder-workflow.ts +175 -0
- package/src/workspace/index.ts +69 -0
- package/tsconfig.json +22 -0
- package/view-logs.sh +116 -0
- package/whatsapp-session.sh +197 -0
|
@@ -0,0 +1,469 @@
|
|
|
1
|
+
# Dynamic Tools Tutorial
|
|
2
|
+
|
|
3
|
+
Creating custom tools on demand with Sybil.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
Unlike traditional bots with fixed tool sets, Sybil can:
|
|
8
|
+
|
|
9
|
+
1. **Generate tools** from natural language descriptions
|
|
10
|
+
2. **Validate tool code** automatically
|
|
11
|
+
3. **Register tools** in real-time
|
|
12
|
+
4. **Persist tools** across sessions
|
|
13
|
+
5. **Manage tool metadata**
|
|
14
|
+
|
|
15
|
+
All created tools are:
|
|
16
|
+
- ✅ Validated TypeScript code
|
|
17
|
+
- ✅ Type-schemas with Zod
|
|
18
|
+
- ✅ Error handling
|
|
19
|
+
- ✅ Self-documenting
|
|
20
|
+
|
|
21
|
+
## Creating a Custom Tool
|
|
22
|
+
|
|
23
|
+
### Method 1: `/create-tool` Command
|
|
24
|
+
|
|
25
|
+
**Simple Request:**
|
|
26
|
+
```
|
|
27
|
+
User: Create a tool that converts Celsius to Fahrenheit
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
**What Happens:**
|
|
31
|
+
```
|
|
32
|
+
[Agent analyzes request]
|
|
33
|
+
[Generates Zod schema for inputs]
|
|
34
|
+
[Writes TypeScript code]
|
|
35
|
+
[Validates code]
|
|
36
|
+
[Registers tool in tool registry]
|
|
37
|
+
[Returns tool ID for use]
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
**Result:**
|
|
41
|
+
```json
|
|
42
|
+
{
|
|
43
|
+
"success": true,
|
|
44
|
+
"toolId": "temperature-converter",
|
|
45
|
+
"location": "./workspace/generated-tools/temperature-converter.ts"
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
**Using the tool:**
|
|
50
|
+
```
|
|
51
|
+
User: Convert 25°C to Fahrenheit
|
|
52
|
+
→ Agent calls temperature-converter tool
|
|
53
|
+
→ Returns: { celsius: 25, fahrenheit: 77 }
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Method 2: `/network` Creation
|
|
57
|
+
|
|
58
|
+
**Request:**
|
|
59
|
+
```
|
|
60
|
+
User: Create a tool that validates email addresses
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
**Agent Network:**
|
|
64
|
+
```
|
|
65
|
+
[Executor Agent]
|
|
66
|
+
→ Generates validation logic
|
|
67
|
+
→ Uses Zod.email() schema
|
|
68
|
+
→ Creates validateEmailTool()
|
|
69
|
+
→ Registers and saves
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
**Using immediately:**
|
|
73
|
+
```
|
|
74
|
+
User: Validate my email address alice@example.com
|
|
75
|
+
→ [Calls validateEmailTool]
|
|
76
|
+
→: { valid: true }
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## Tool Capabilities
|
|
80
|
+
|
|
81
|
+
### Supported Categories
|
|
82
|
+
|
|
83
|
+
1. **Utility Tools** - Calculations, conversions, data transformations
|
|
84
|
+
2. **API Tools** - HTTP requests, API interactions, data fetching
|
|
85
|
+
3. **Validation Tools** - Data validation, format checking
|
|
86
|
+
4. **Conversion Tools** - Format transformations, file processing
|
|
87
|
+
5. **Analysis Tools** - Data analysis, pattern matching
|
|
88
|
+
6. **Custom Tools** - Any custom logic you need
|
|
89
|
+
|
|
90
|
+
### Tool Generator Features
|
|
91
|
+
|
|
92
|
+
**What it generates:**
|
|
93
|
+
|
|
94
|
+
1. Complete TypeScript file with imports
|
|
95
|
+
2. Zod input/output schemas
|
|
96
|
+
3. Proper TypeScript types
|
|
97
|
+
4. Error handling
|
|
98
|
+
5. Clear descriptions
|
|
99
|
+
6. Usage documentation in comments
|
|
100
|
+
7. Export statement for tool registration
|
|
101
|
+
|
|
102
|
+
**What it validates:**
|
|
103
|
+
- TypeScript syntax
|
|
104
|
+
- Zod schema correctness
|
|
105
|
+
- Proper imports
|
|
106
|
+
- Export format
|
|
107
|
+
|
|
108
|
+
### Generated Tool Structure
|
|
109
|
+
|
|
110
|
+
```typescript
|
|
111
|
+
import { createTool } from "@mastra/core/tools";
|
|
112
|
+
import { z } from "zod";
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* [Generated Tool Description]
|
|
116
|
+
*/
|
|
117
|
+
export const generatedTool = createTool({
|
|
118
|
+
id: "tool-id",
|
|
119
|
+
description: "Human-readable description of what the tool does",
|
|
120
|
+
inputSchema: z.object({
|
|
121
|
+
// Input parameters
|
|
122
|
+
param1: z.string().describe("Description"),
|
|
123
|
+
param2: z.number().optional().describe("Description"),
|
|
124
|
+
}),
|
|
125
|
+
outputSchema: z.object({
|
|
126
|
+
// Output structure
|
|
127
|
+
result: z.any().describe("Description of result"),
|
|
128
|
+
success: z.boolean(),
|
|
129
|
+
}),
|
|
130
|
+
execute: async (inputData) => {
|
|
131
|
+
// Implementation
|
|
132
|
+
try {
|
|
133
|
+
const result = /* logic here */;
|
|
134
|
+
return {
|
|
135
|
+
result,
|
|
136
|
+
success: true,
|
|
137
|
+
};
|
|
138
|
+
} catch (error) {
|
|
139
|
+
console.error("Tool error:", error);
|
|
140
|
+
return {
|
|
141
|
+
result: null,
|
|
142
|
+
success: false,
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
},
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
export default generatedTool;
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
## Real-World Examples
|
|
152
|
+
|
|
153
|
+
### Example 1: Currency Converter
|
|
154
|
+
|
|
155
|
+
**Request:**
|
|
156
|
+
```
|
|
157
|
+
User: Create a tool that converts USD currencies to EUR and GBP
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
**Generated Tool:**
|
|
161
|
+
```typescript
|
|
162
|
+
inputSchema: z.object({
|
|
163
|
+
amount: z.number().describe("Amount in USD"),
|
|
164
|
+
toCurrency: z.enum(["EUR", "GBP"]).describe("Target currency"),
|
|
165
|
+
rates: z.record(z.number()).optional().describe("Exchange rates (defaults to hard-coded)"),
|
|
166
|
+
}),
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
**Usage:**
|
|
170
|
+
```
|
|
171
|
+
User: Convert 100 USD to EUR
|
|
172
|
+
→ { amount: 100, from: "USD", to: "EUR", usd: 100, eur: 92.05 }
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
### Example 2: Validator Tool
|
|
176
|
+
|
|
177
|
+
**Request:**
|
|
178
|
+
```
|
|
179
|
+
User: Create a tool to validate GitHub usernames
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
**Generated Tool:**
|
|
183
|
+
```typescript
|
|
184
|
+
inputSchema: z.object({
|
|
185
|
+
username: z.string()
|
|
186
|
+
.minLength(1)
|
|
187
|
+
.maxLength(39)
|
|
188
|
+
.regex(/^[a-z0-9-]+$/),
|
|
189
|
+
}),
|
|
190
|
+
outputSchema: z.object({
|
|
191
|
+
valid: z.boolean(),
|
|
192
|
+
available: z.boolean(),
|
|
193
|
+
repoCount: z.number(),
|
|
194
|
+
}),
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
**Logic:**
|
|
198
|
+
```javascript
|
|
199
|
+
// Check if username exists via GitHub API
|
|
200
|
+
// Return availability and repo count
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
### Example 3: File Processor
|
|
204
|
+
|
|
205
|
+
**Request:**
|
|
206
|
+
```
|
|
207
|
+
User: Create a tool that reads CSV files and extracts specific columns
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
**Generated Tool:**
|
|
211
|
+
```typescript
|
|
212
|
+
inputSchema: z.object({
|
|
213
|
+
filepath: z.string(),
|
|
214
|
+
columns: z.array(z.string()),
|
|
215
|
+
hasHeader: z.boolean().default(true),
|
|
216
|
+
delimiter: z.string().default(","),
|
|
217
|
+
}),
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
**Logic:**
|
|
221
|
+
```javascript
|
|
222
|
+
// Parse CSV file
|
|
223
|
+
// Extract requested columns
|
|
224
|
+
// Return as array of objects
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
### Example 4: Aggregator
|
|
228
|
+
|
|
229
|
+
**Request:**
|
|
230
|
+
```
|
|
231
|
+
User: Create a tool that aggregates data from multiple API endpoints
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
**Generated Tool:**
|
|
235
|
+
```typescript
|
|
236
|
+
inputSchema: z.object({
|
|
237
|
+
endpoints: z.array(z.string()),
|
|
238
|
+
filterFields: z.array(z.string()),
|
|
239
|
+
sortBy: z.string().optional(),
|
|
240
|
+
}),
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
**Logic:**
|
|
244
|
+
```javascript
|
|
245
|
+
// Make parallel requests to all endpoints
|
|
246
|
+
// Filter and transform data
|
|
247
|
+
// Sort results
|
|
248
|
+
// Return aggregated data
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
### Example 5: Transformer
|
|
252
|
+
|
|
253
|
+
**Request:**
|
|
254
|
+
```
|
|
255
|
+
User: Create a tool that converts JSON data to CSV format
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
**Generated Tool:**
|
|
259
|
+
```typescript
|
|
260
|
+
inputSchema: z.object({
|
|
261
|
+
jsonData: z.record(z.any()),
|
|
262
|
+
fields: z.array(z.string()),
|
|
263
|
+
headers: z.boolean().default(false),
|
|
264
|
+
}),
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
**Logic:**
|
|
268
|
+
```javascript
|
|
269
|
+
// Flatten JSON structure if nested
|
|
270
|
+
// Apply field mapping
|
|
271
|
+
// Format as CSV string
|
|
272
|
+
// Save or return CSV
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
## Advanced Features
|
|
276
|
+
|
|
277
|
+
### Tool Composition
|
|
278
|
+
|
|
279
|
+
Use existing tools within new tools:
|
|
280
|
+
|
|
281
|
+
```typescript
|
|
282
|
+
// Use fetch from existing tool
|
|
283
|
+
import { fetchWebContent, extractStructuredData } from "./web-tools.ts";
|
|
284
|
+
|
|
285
|
+
export const advancedTool = createTool({
|
|
286
|
+
// ...
|
|
287
|
+
});
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
### Tool Metadata
|
|
291
|
+
|
|
292
|
+
Each generated tool includes:
|
|
293
|
+
- Creation timestamp
|
|
294
|
+
- Version number
|
|
295
|
+
- Author (Sybil AI)
|
|
296
|
+
- Usage examples
|
|
297
|
+
- Dependencies and imports
|
|
298
|
+
- Known limitations
|
|
299
|
+
|
|
300
|
+
### Tool Versioning
|
|
301
|
+
|
|
302
|
+
Tools support versioning:
|
|
303
|
+
|
|
304
|
+
```typescript
|
|
305
|
+
export const myTool_v1 = createTool({
|
|
306
|
+
// Version 1 implementation
|
|
307
|
+
});
|
|
308
|
+
|
|
309
|
+
export const myTool_v2 = createTool({
|
|
310
|
+
// Version 2 with improvements
|
|
311
|
+
// Backward compatible if possible
|
|
312
|
+
});
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
## Best Practices
|
|
316
|
+
|
|
317
|
+
### 1. Be Specific in Descriptions
|
|
318
|
+
|
|
319
|
+
**Good:**
|
|
320
|
+
```
|
|
321
|
+
Create a tool that validates IPv4 addresses and can check if they're from a private range
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
**Bad:**
|
|
325
|
+
```
|
|
326
|
+
Create an IP validator tool
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
### 2. Include Clear Error Messages
|
|
330
|
+
|
|
331
|
+
```typescript
|
|
332
|
+
return {
|
|
333
|
+
result: null,
|
|
334
|
+
success: false,
|
|
335
|
+
error: "Invalid IP address: Format should be x.x.x.x",
|
|
336
|
+
};
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
### 3. Use Appropriate Types
|
|
340
|
+
|
|
341
|
+
- ✅ `z.string()` - Text data
|
|
342
|
+
- ✅ `z.number()` - Numeric data
|
|
343
|
+
- ✅ `z.boolean()` - True/false
|
|
344
|
+
- ✅ `z.enum([...])` - Fixed choices
|
|
345
|
+
- ✅ `z.date()` - Dates
|
|
346
|
+
- ✅ `z.array(...)` - Arrays
|
|
347
|
+
- ✅ `z.record({...})` - Objects/dictionaries
|
|
348
|
+
|
|
349
|
+
### 4. Use Optional Fields
|
|
350
|
+
|
|
351
|
+
```typescript
|
|
352
|
+
inputSchema: z.object({
|
|
353
|
+
required: z.string(),
|
|
354
|
+
optional: z.string().optional(), // ← Optional
|
|
355
|
+
config: z.object({...}).optional(),
|
|
356
|
+
settings: z.object({...}).optional(),
|
|
357
|
+
}),
|
|
358
|
+
```
|
|
359
|
+
|
|
360
|
+
### 5. Document the Tool
|
|
361
|
+
|
|
362
|
+
Add clear documentation in comments:
|
|
363
|
+
|
|
364
|
+
```typescript
|
|
365
|
+
/**
|
|
366
|
+
* Temperature Converter Tool
|
|
367
|
+
*
|
|
368
|
+
* Converts between Celsius, Fahrenheit, and Kelvin.
|
|
369
|
+
*
|
|
370
|
+
* Usage:
|
|
371
|
+
* - Convert temperatures between common scales
|
|
372
|
+
* - Round to 2 decimal places for readability
|
|
373
|
+
* - Invalid values return null
|
|
374
|
+
*
|
|
375
|
+
* Author: Sybil AI
|
|
376
|
+
* Version: 1.0.0
|
|
377
|
+
* Created: 2026-02-12
|
|
378
|
+
*/
|
|
379
|
+
```
|
|
380
|
+
|
|
381
|
+
### 6. Handle Edge Cases
|
|
382
|
+
|
|
383
|
+
```typescript
|
|
384
|
+
execute: async (inputData) => {
|
|
385
|
+
// Validate inputs
|
|
386
|
+
if (!inputData || typeof inputData !== "object") {
|
|
387
|
+
throw new Error("Invalid input: expected object");
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
// Check for required fields
|
|
391
|
+
if (!inputData.required) {
|
|
392
|
+
return {
|
|
393
|
+
result: null,
|
|
394
|
+
success: false,
|
|
395
|
+
error: "Required field: required",
|
|
396
|
+
};
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
// Handle missing optional fields
|
|
400
|
+
const optional = inputData.optional ?? "default value";
|
|
401
|
+
},
|
|
402
|
+
```
|
|
403
|
+
|
|
404
|
+
## Managing Tools
|
|
405
|
+
|
|
406
|
+
### List All Tools
|
|
407
|
+
|
|
408
|
+
```bash
|
|
409
|
+
User: /list-tools
|
|
410
|
+
→ Shows all available tools (32 standard + dynamic)
|
|
411
|
+
```
|
|
412
|
+
|
|
413
|
+
### Delete a Tool
|
|
414
|
+
|
|
415
|
+
```bash
|
|
416
|
+
User: Remove the temperature converter tool
|
|
417
|
+
→ [Checks if tool exists]
|
|
418
|
+
→ [Unregisters from registry]
|
|
419
|
+
→ [Deletes generated file]
|
|
420
|
+
→ ✅ Tool removed
|
|
421
|
+
```
|
|
422
|
+
|
|
423
|
+
### View Tool Code
|
|
424
|
+
|
|
425
|
+
```
|
|
426
|
+
User: Show me the code for the temperature converter tool
|
|
427
|
+
→ [Reads tool file]
|
|
428
|
+
→ [Displays TypeScript code]
|
|
429
|
+
```
|
|
430
|
+
|
|
431
|
+
## Integration
|
|
432
|
+
|
|
433
|
+
### With Agent Networks
|
|
434
|
+
|
|
435
|
+
```typescript
|
|
436
|
+
// Routing Agent sees tool creation requests
|
|
437
|
+
// Executor Agent generates the tool
|
|
438
|
+
// Immediately available for use
|
|
439
|
+
```
|
|
440
|
+
|
|
441
|
+
### With Skills
|
|
442
|
+
|
|
443
|
+
```typescript
|
|
444
|
+
// Skills can create tools dynamically
|
|
445
|
+
// Tools persist beyond skill context
|
|
446
|
+
// Available to all sessions
|
|
447
|
+
```
|
|
448
|
+
|
|
449
|
+
### With Memory
|
|
450
|
+
|
|
451
|
+
```typescript
|
|
452
|
+
// Successful tools logged to memory
|
|
453
|
+
// Learned from tool usage patterns
|
|
454
|
+
```
|
|
455
|
+
|
|
456
|
+
|
|
457
|
+
```
|
|
458
|
+
|
|
459
|
+
Tool creation becomes increasingly dynamic with intelligent context-aware mechanisms. The system adapts to user needs, creating specialized instruments for specific use cases through learning and autonomous generation. Agents can evolve their capabilities continuously, transforming requirements into functional code across multiple interactions.
|
|
460
|
+
|
|
461
|
+
**Dynamic Tool Registry** - Persistent generated tools stored in `workspace/generated-tools/`
|
|
462
|
+
```typescript
|
|
463
|
+
// Load all generated tools on startup
|
|
464
|
+
await dynamicToolRegistry.loadAllTools();
|
|
465
|
+
```
|
|
466
|
+
|
|
467
|
+
---
|
|
468
|
+
|
|
469
|
+
**Your agents can now create their own tools on demand! 🔧**
|
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
# Getting Started with Sybil
|
|
2
|
+
|
|
3
|
+
Complete guide to setting up and running Sybil for the first time.
|
|
4
|
+
|
|
5
|
+
## 1. Environment Setup
|
|
6
|
+
|
|
7
|
+
### Install Dependencies
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
cd /path/to/sybil
|
|
11
|
+
npm install
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
### Configure Environment
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
cp .env.example .env
|
|
18
|
+
nano .env # Or your preferred editor
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
### Minimum Required Configuration
|
|
22
|
+
|
|
23
|
+
```env
|
|
24
|
+
# Required
|
|
25
|
+
TELEGRAM_BOT_TOKEN=<your_telegram_bot_token> # Get from @BotFather
|
|
26
|
+
|
|
27
|
+
# AI Provider (choose one)
|
|
28
|
+
AI_PROVIDER=openai
|
|
29
|
+
OPENAI_API_KEY=<your_openai_key>
|
|
30
|
+
OPENAI_MODEL=gpt-4o
|
|
31
|
+
|
|
32
|
+
# Telegram Bot Token Setup
|
|
33
|
+
1. Open Telegram
|
|
34
|
+
2. Search for @BotFather
|
|
35
|
+
3. Send /newbot
|
|
36
|
+
4. Follow instructions
|
|
37
|
+
5. Copy bot token
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### Recommended AI Providers by Use Case
|
|
41
|
+
|
|
42
|
+
| Use Case | Provider | Cost | Speed | Quality |
|
|
43
|
+
|---------|----------|------|-------|--------|
|
|
44
|
+
| Best Quality | OpenAI | High | Medium | ⭐⭐⭐⭐⭐ |
|
|
45
|
+
| Speed | Groq | Free tier fast | ⭐⭐⭐⭐⭐ | ⭐⭐⭐⭐ |
|
|
46
|
+
| Privacy | Ollama | Free (local) | ⭐⭐⭐ | ⭐⭐⭐ | |
|
|
47
|
+
| GPU Accelerated | NVIDIA AI | Paid (fast) | ⭐⭐⭐⭐⭐ | ⭐⭐⭐⭐ |
|
|
48
|
+
|
|
49
|
+
## 2. Authenticate Your Bot Users
|
|
50
|
+
|
|
51
|
+
Sybil uses OTP-based authentication to allow access only to approved users.
|
|
52
|
+
|
|
53
|
+
### Generate a User OTP
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
sybil otp
|
|
57
|
+
# Select: 🆕 Generate New OTP
|
|
58
|
+
# Enter Chat ID (or leave blank for pending mode)
|
|
59
|
+
# Share the displayed 6-digit code with user
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### User Authentication Flow
|
|
63
|
+
|
|
64
|
+
**User sends first message:**
|
|
65
|
+
```
|
|
66
|
+
You: Hi there!
|
|
67
|
+
Bot: 🔐 Send 6-digit code from admin to unlock Sybil Bot
|
|
68
|
+
|
|
69
|
+
You: 123456
|
|
70
|
+
Bot: ✅ Welcome to Sybil! Just start chatting!
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Manage Users
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
# List authenticated users
|
|
77
|
+
sybil otp --list
|
|
78
|
+
|
|
79
|
+
# Revoke user access
|
|
80
|
+
sybil otp --revoke <chatId>
|
|
81
|
+
|
|
82
|
+
# Show pending OTPs
|
|
83
|
+
sybil otp
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## 3. Basic Conversation
|
|
87
|
+
|
|
88
|
+
After authentication, users can chat naturally:
|
|
89
|
+
|
|
90
|
+
**Examples:**
|
|
91
|
+
|
|
92
|
+
```
|
|
93
|
+
You: What's 15 * 7?
|
|
94
|
+
Bot: 105
|
|
95
|
+
|
|
96
|
+
You: Remember my name is Alice
|
|
97
|
+
Bot: Got it, Alice! I've saved that.
|
|
98
|
+
|
|
99
|
+
You: Plan my day - I need to learn Python, do grocery shopping, and reply to emails.
|
|
100
|
+
Bot: [Creates structured plan for the day]
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## 4. Common First Tasks
|
|
104
|
+
|
|
105
|
+
### Task: Change AI Provider
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
# Interactive method
|
|
109
|
+
sybil config --edit
|
|
110
|
+
# Select: Change AI Provider
|
|
111
|
+
# Choose: groq, anthropic, google, ollama, etc.
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### Task: Check Bot Status
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
sybil status
|
|
118
|
+
# Shows: Configuration, Process Status, Resource Usage
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### Task: View Logs
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
sybil logs --follow
|
|
125
|
+
# Stream logs in real-time
|
|
126
|
+
sybil logs --level error # Only errors
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### Task: Backup Data
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
# Create backup
|
|
133
|
+
sybil backup
|
|
134
|
+
|
|
135
|
+
# Restore from backup
|
|
136
|
+
sybil restore backup-2026-02-12
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
## 5. Enable Additional Features
|
|
140
|
+
|
|
141
|
+
### WhatsApp Integration
|
|
142
|
+
|
|
143
|
+
1. Edit `.env`:
|
|
144
|
+
```env
|
|
145
|
+
ENABLE_WHATSAPP=true
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
2. Initialize WhatsApp:
|
|
149
|
+
```bash
|
|
150
|
+
# Start bot
|
|
151
|
+
npm start
|
|
152
|
+
|
|
153
|
+
# On another terminal:
|
|
154
|
+
sybil whatsapp --initialize
|
|
155
|
+
|
|
156
|
+
# Scan QR code with WhatsApp on phone
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
3. Verify connection:
|
|
160
|
+
```bash
|
|
161
|
+
sybil whatsapp --status
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
### Vector Memory (Semantic Search)
|
|
165
|
+
|
|
166
|
+
Enable intelligent memory retrieval via embeddings:
|
|
167
|
+
|
|
168
|
+
```env
|
|
169
|
+
# In .env:
|
|
170
|
+
EMBEDDING_MODEL=openai/text-embedding-3-small
|
|
171
|
+
SEMANTIC_RECALL_TOPK=5
|
|
172
|
+
SEMANTIC_RECALL_RANGE=2
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
### Browser Control
|
|
176
|
+
|
|
177
|
+
Browser tools are automatically available to agents. Try:
|
|
178
|
+
|
|
179
|
+
```
|
|
180
|
+
User: Research the latest AI news and save to a file
|
|
181
|
+
→ Agent will:
|
|
182
|
+
1. Search Google
|
|
183
|
+
2. Navigate to articles
|
|
184
|
+
3. Extract content
|
|
185
|
+
4. Convert to Markdown
|
|
186
|
+
5. Save to workspace/ai-news.md
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
## Troubleshooting
|
|
190
|
+
|
|
191
|
+
### "Bot not responding"
|
|
192
|
+
```bash
|
|
193
|
+
# Check if running
|
|
194
|
+
sybil status
|
|
195
|
+
|
|
196
|
+
# View logs
|
|
197
|
+
sybil logs --follow
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
### "Could not connect to Ollama"
|
|
201
|
+
```bash
|
|
202
|
+
# Start Ollama
|
|
203
|
+
ollama serve
|
|
204
|
+
|
|
205
|
+
# Verify
|
|
206
|
+
curl http://localhost:11434/api/tags
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
### "Missing API key"
|
|
210
|
+
```bash
|
|
211
|
+
# Verify env file loaded
|
|
212
|
+
cat .env | grep API_KEY
|
|
213
|
+
|
|
214
|
+
# Check which provider you're using
|
|
215
|
+
cat .env | grep AI_PROVIDER
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
### "Memory not working"
|
|
219
|
+
```bash
|
|
220
|
+
# Check database
|
|
221
|
+
ls -la ./mastra.db
|
|
222
|
+
|
|
223
|
+
# Check storage path
|
|
224
|
+
cat .env | grep DATABASE_URL
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
### "Browser tools failing"
|
|
228
|
+
```bash
|
|
229
|
+
# Install Playwright browsers
|
|
230
|
+
npx playwright install chromium
|
|
231
|
+
|
|
232
|
+
# Verify installation
|
|
233
|
+
npx playwright --version
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
## Next Steps
|
|
237
|
+
|
|
238
|
+
Now that Sybil is running:
|
|
239
|
+
|
|
240
|
+
1. **Try these commands:**
|
|
241
|
+
- `/network Research AI trends` - Multi-agent research
|
|
242
|
+
- `/model groq` - Switch to faster provider
|
|
243
|
+
- `/create-tool weather checker` - Create new tool
|
|
244
|
+
|
|
245
|
+
2. **Try asking:**
|
|
246
|
+
- "Create a skill for managing GitHub projects"
|
|
247
|
+
- "Browse tech.com and save the article"
|
|
248
|
+
- "Generate a plan to learn Rust"
|
|
249
|
+
|
|
250
|
+
3. **Explore:**
|
|
251
|
+
- Vector memory - `/memory` shows semantic search results
|
|
252
|
+
- Dynamic skills - `/create-skill` creates persistent skills
|
|
253
|
+
- Agent networks - `/network` coordinates specialized agents
|
|
254
|
+
|
|
255
|
+
## Support
|
|
256
|
+
|
|
257
|
+
- Issues: https://github.com/anomalyco/opencode/issues
|
|
258
|
+
- Documentation: See README.md and docs/ folder
|
|
259
|
+
- Mastra Docs: https://mastra.ai/docs
|
|
260
|
+
|
|
261
|
+
---
|
|
262
|
+
|
|
263
|
+
**Enjoy using Sybil! 🤖**
|