machinaos 0.0.10 → 0.0.13
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.template +16 -0
- package/client/package.json +1 -1
- package/client/src/Dashboard.tsx +3 -3
- package/client/src/components/AIAgentNode.tsx +24 -12
- package/client/src/components/OutputPanel.tsx +3 -2
- package/client/src/components/parameterPanel/InputSection.tsx +16 -3
- package/client/src/nodeDefinitions/aiAgentNodes.ts +12 -0
- package/client/src/nodeDefinitions/specializedAgentNodes.ts +68 -320
- package/client/src/nodeDefinitions/toolNodes.ts +87 -1
- package/client/src/nodeDefinitions/workflowNodes.ts +55 -1
- package/package.json +12 -3
- package/scripts/daemon.js +427 -0
- package/scripts/start.js +7 -1
- package/scripts/sync-version.js +108 -0
- package/server/Dockerfile +6 -7
- package/server/constants.py +2 -0
- package/server/core/cleanup.py +123 -0
- package/server/core/config.py +16 -0
- package/server/core/database.py +92 -1
- package/server/core/health.py +121 -0
- package/server/examples/__init__.py +1 -0
- package/server/gunicorn.conf.py +46 -0
- package/server/main.py +38 -3
- package/server/models/database.py +1 -0
- package/server/models/nodes.py +18 -2
- package/server/requirements-docker.txt +86 -0
- package/server/routers/database.py +16 -0
- package/server/routers/websocket.py +6 -5
- package/server/services/ai.py +115 -14
- package/server/services/auth.py +6 -1
- package/server/services/deployment/manager.py +14 -0
- package/server/services/event_waiter.py +55 -0
- package/server/services/example_loader.py +60 -0
- package/server/services/execution/executor.py +2 -0
- package/server/services/execution/models.py +8 -0
- package/server/services/handlers/__init__.py +2 -0
- package/server/services/handlers/ai.py +164 -11
- package/server/services/handlers/document.py +13 -4
- package/server/services/handlers/tools.py +445 -14
- package/server/services/node_executor.py +3 -0
- package/server/services/temporal/activities.py +3 -0
- package/server/services/workflow.py +2 -0
- package/server/skills/android_agent/app-launcher-skill/SKILL.md +137 -0
- package/server/skills/android_agent/app-list-skill/SKILL.md +148 -0
- package/server/skills/android_agent/audio-skill/SKILL.md +169 -0
- package/server/skills/android_agent/battery-skill/SKILL.md +114 -0
- package/server/skills/android_agent/bluetooth-skill/SKILL.md +151 -0
- package/server/skills/android_agent/camera-skill/SKILL.md +148 -0
- package/server/skills/android_agent/environmental-skill/SKILL.md +140 -0
- package/server/skills/android_agent/location-skill/SKILL.md +163 -0
- package/server/skills/android_agent/motion-skill/SKILL.md +141 -0
- package/server/skills/android_agent/screen-control-skill/SKILL.md +164 -0
- package/server/skills/android_agent/wifi-skill/SKILL.md +182 -0
- package/server/skills/assistant/subagent-skill/SKILL.md +205 -0
- package/server/skills/coding_agent/javascript-skill/SKILL.md +196 -0
- package/server/skills/coding_agent/python-skill/SKILL.md +165 -0
- package/server/skills/social_agent/whatsapp-db-skill/SKILL.md +284 -0
- package/server/skills/social_agent/whatsapp-send-skill/SKILL.md +180 -0
- package/server/skills/task_agent/cron-scheduler-skill/SKILL.md +215 -0
- package/server/skills/task_agent/task-manager-skill/SKILL.md +251 -0
- package/server/skills/task_agent/timer-skill/SKILL.md +168 -0
- package/server/skills/travel_agent/geocoding-skill/SKILL.md +186 -0
- package/server/skills/travel_agent/nearby-places-skill/SKILL.md +234 -0
- package/server/skills/web_agent/http-request-skill/SKILL.md +211 -0
- package/server/skills/android/skill/SKILL.md +0 -84
- package/server/skills/assistant/code-skill/SKILL.md +0 -176
- package/server/skills/assistant/http-skill/SKILL.md +0 -163
- package/server/skills/assistant/maps-skill/SKILL.md +0 -172
- package/server/skills/assistant/scheduler-skill/SKILL.md +0 -86
- package/server/skills/assistant/whatsapp-skill/SKILL.md +0 -285
- /package/server/skills/{android → android_agent}/personality/SKILL.md +0 -0
- /package/server/skills/{assistant → web_agent}/web-search-skill/SKILL.md +0 -0
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: http-request-skill
|
|
3
|
+
description: Make HTTP requests to external APIs and web services. Supports GET, POST, PUT, DELETE, PATCH methods with headers and JSON body.
|
|
4
|
+
allowed-tools: http_request
|
|
5
|
+
metadata:
|
|
6
|
+
author: machina
|
|
7
|
+
version: "1.0"
|
|
8
|
+
category: integration
|
|
9
|
+
icon: "🌐"
|
|
10
|
+
color: "#EF4444"
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# HTTP Request Tool
|
|
14
|
+
|
|
15
|
+
Make HTTP requests to external APIs and web services.
|
|
16
|
+
|
|
17
|
+
## How It Works
|
|
18
|
+
|
|
19
|
+
This skill provides instructions for the **HTTP Request** tool node. Connect the **HTTP Request** node to Zeenie's `input-tools` handle to enable API calls.
|
|
20
|
+
|
|
21
|
+
## http_request Tool
|
|
22
|
+
|
|
23
|
+
Make an HTTP request to any URL.
|
|
24
|
+
|
|
25
|
+
### Schema Fields
|
|
26
|
+
|
|
27
|
+
| Field | Type | Required | Description |
|
|
28
|
+
|-------|------|----------|-------------|
|
|
29
|
+
| url | string | Yes | Full URL to request (e.g., `https://api.example.com/data`) |
|
|
30
|
+
| method | string | No | HTTP method: `GET`, `POST`, `PUT`, `DELETE`, `PATCH` (default: `GET`) |
|
|
31
|
+
| body | object | No | Request body as JSON object (for POST/PUT/PATCH) |
|
|
32
|
+
|
|
33
|
+
### Node Parameters
|
|
34
|
+
|
|
35
|
+
Additional options can be configured on the node:
|
|
36
|
+
|
|
37
|
+
| Parameter | Description |
|
|
38
|
+
|-----------|-------------|
|
|
39
|
+
| headers | Custom headers as JSON (e.g., `{"Authorization": "Bearer token"}`) |
|
|
40
|
+
| base_url | Base URL prepended to the url parameter |
|
|
41
|
+
|
|
42
|
+
### Response Format
|
|
43
|
+
|
|
44
|
+
```json
|
|
45
|
+
{
|
|
46
|
+
"status": 200,
|
|
47
|
+
"data": { "key": "value" },
|
|
48
|
+
"url": "https://api.example.com/data",
|
|
49
|
+
"method": "GET"
|
|
50
|
+
}
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Examples
|
|
54
|
+
|
|
55
|
+
**GET request (fetch data):**
|
|
56
|
+
```json
|
|
57
|
+
{
|
|
58
|
+
"url": "https://api.example.com/users/123",
|
|
59
|
+
"method": "GET"
|
|
60
|
+
}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
**POST request (create resource):**
|
|
64
|
+
```json
|
|
65
|
+
{
|
|
66
|
+
"url": "https://api.example.com/users",
|
|
67
|
+
"method": "POST",
|
|
68
|
+
"body": {
|
|
69
|
+
"name": "John Doe",
|
|
70
|
+
"email": "john@example.com"
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
**PUT request (update resource):**
|
|
76
|
+
```json
|
|
77
|
+
{
|
|
78
|
+
"url": "https://api.example.com/users/123",
|
|
79
|
+
"method": "PUT",
|
|
80
|
+
"body": {
|
|
81
|
+
"name": "John Updated"
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
**DELETE request:**
|
|
87
|
+
```json
|
|
88
|
+
{
|
|
89
|
+
"url": "https://api.example.com/users/123",
|
|
90
|
+
"method": "DELETE"
|
|
91
|
+
}
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
**PATCH request (partial update):**
|
|
95
|
+
```json
|
|
96
|
+
{
|
|
97
|
+
"url": "https://api.example.com/users/123",
|
|
98
|
+
"method": "PATCH",
|
|
99
|
+
"body": {
|
|
100
|
+
"status": "active"
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### Real-World Examples
|
|
106
|
+
|
|
107
|
+
**Get Bitcoin price:**
|
|
108
|
+
```json
|
|
109
|
+
{
|
|
110
|
+
"url": "https://api.coindesk.com/v1/bpi/currentprice.json",
|
|
111
|
+
"method": "GET"
|
|
112
|
+
}
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
**Get weather:**
|
|
116
|
+
```json
|
|
117
|
+
{
|
|
118
|
+
"url": "https://api.openweathermap.org/data/2.5/weather?q=London&appid=YOUR_KEY",
|
|
119
|
+
"method": "GET"
|
|
120
|
+
}
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
**Post to webhook:**
|
|
124
|
+
```json
|
|
125
|
+
{
|
|
126
|
+
"url": "https://hooks.slack.com/services/xxx",
|
|
127
|
+
"method": "POST",
|
|
128
|
+
"body": {
|
|
129
|
+
"text": "Hello from MachinaOS!"
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
**Check website status:**
|
|
135
|
+
```json
|
|
136
|
+
{
|
|
137
|
+
"url": "https://example.com",
|
|
138
|
+
"method": "GET"
|
|
139
|
+
}
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
### Error Responses
|
|
143
|
+
|
|
144
|
+
**Timeout:**
|
|
145
|
+
```json
|
|
146
|
+
{
|
|
147
|
+
"error": "Request timed out"
|
|
148
|
+
}
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
**Connection failed:**
|
|
152
|
+
```json
|
|
153
|
+
{
|
|
154
|
+
"error": "Connection failed: Unable to reach host"
|
|
155
|
+
}
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
**HTTP error:**
|
|
159
|
+
```json
|
|
160
|
+
{
|
|
161
|
+
"status": 404,
|
|
162
|
+
"data": "Not Found",
|
|
163
|
+
"url": "https://api.example.com/missing",
|
|
164
|
+
"method": "GET"
|
|
165
|
+
}
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
## HTTP Status Codes
|
|
169
|
+
|
|
170
|
+
| Status | Meaning | Action |
|
|
171
|
+
|--------|---------|--------|
|
|
172
|
+
| 200-299 | Success | Process the response data |
|
|
173
|
+
| 400 | Bad Request | Check request parameters |
|
|
174
|
+
| 401 | Unauthorized | Check API key/authentication |
|
|
175
|
+
| 403 | Forbidden | Insufficient permissions |
|
|
176
|
+
| 404 | Not Found | Check URL path |
|
|
177
|
+
| 429 | Too Many Requests | Rate limited, wait and retry |
|
|
178
|
+
| 500-599 | Server Error | External service issue |
|
|
179
|
+
|
|
180
|
+
## Use Cases
|
|
181
|
+
|
|
182
|
+
| Use Case | Method | Description |
|
|
183
|
+
|----------|--------|-------------|
|
|
184
|
+
| Fetch data | GET | Retrieve resources |
|
|
185
|
+
| Create resource | POST | Add new data |
|
|
186
|
+
| Update resource | PUT/PATCH | Modify existing data |
|
|
187
|
+
| Delete resource | DELETE | Remove data |
|
|
188
|
+
| Health check | GET | Verify service availability |
|
|
189
|
+
| Webhook trigger | POST | Send events to services |
|
|
190
|
+
|
|
191
|
+
## Guidelines
|
|
192
|
+
|
|
193
|
+
1. **URLs**: Must be fully qualified with protocol (https://)
|
|
194
|
+
2. **Authentication**: Use node headers for API keys/tokens
|
|
195
|
+
3. **Timeout**: Default 30 seconds
|
|
196
|
+
4. **JSON body**: Automatically serialized for POST/PUT/PATCH
|
|
197
|
+
5. **Response**: JSON responses are automatically parsed
|
|
198
|
+
|
|
199
|
+
## Security Notes
|
|
200
|
+
|
|
201
|
+
1. Never expose API keys in responses to users
|
|
202
|
+
2. Validate URLs before making requests
|
|
203
|
+
3. Avoid internal/private network addresses (localhost, 192.168.x.x)
|
|
204
|
+
4. Respect rate limits of external services
|
|
205
|
+
5. Don't store sensitive data from API responses
|
|
206
|
+
|
|
207
|
+
## Setup Requirements
|
|
208
|
+
|
|
209
|
+
1. Connect the **HTTP Request** node to Zeenie's `input-tools` handle
|
|
210
|
+
2. Configure authentication headers on the node if needed
|
|
211
|
+
3. Ensure network access to target APIs
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: android-skill
|
|
3
|
-
description: Control Android devices - battery, wifi, bluetooth, apps, location, camera, and sensors. Use when user wants to interact with their Android phone or tablet.
|
|
4
|
-
metadata:
|
|
5
|
-
author: machina
|
|
6
|
-
version: "2.0"
|
|
7
|
-
category: device
|
|
8
|
-
icon: "📱"
|
|
9
|
-
color: "#3DDC84"
|
|
10
|
-
---
|
|
11
|
-
|
|
12
|
-
# Android Device Control
|
|
13
|
-
|
|
14
|
-
This skill provides context for monitoring and controlling Android devices.
|
|
15
|
-
|
|
16
|
-
## How It Works
|
|
17
|
-
|
|
18
|
-
This skill provides instructions and context. To execute Android actions, connect the **Android Toolkit** node to the Zeenie's `input-tools` handle, then connect Android service nodes to the toolkit:
|
|
19
|
-
|
|
20
|
-
```
|
|
21
|
-
[Battery Monitor] --+
|
|
22
|
-
|
|
|
23
|
-
[WiFi Automation] --+--> [Android Toolkit] --> [Zeenie]
|
|
24
|
-
|
|
|
25
|
-
[Location] ---+
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
## Available Android Service Nodes
|
|
29
|
-
|
|
30
|
-
Connect these to the Android Toolkit:
|
|
31
|
-
|
|
32
|
-
| Node | Capabilities |
|
|
33
|
-
|------|-------------|
|
|
34
|
-
| **Battery Monitor** | Battery level, charging status, health, temperature |
|
|
35
|
-
| **WiFi Automation** | Enable/disable WiFi, scan networks, get status |
|
|
36
|
-
| **Bluetooth Automation** | Enable/disable Bluetooth, paired devices |
|
|
37
|
-
| **App Launcher** | Launch applications by package name |
|
|
38
|
-
| **App List** | List installed applications |
|
|
39
|
-
| **Location** | Get current GPS coordinates |
|
|
40
|
-
| **Audio Automation** | Volume control, mute/unmute |
|
|
41
|
-
| **Screen Control** | Brightness, wake/sleep screen |
|
|
42
|
-
| **Camera Control** | Camera info, capture photos |
|
|
43
|
-
| **Motion Detection** | Accelerometer, gyroscope data |
|
|
44
|
-
| **Environmental Sensors** | Temperature, humidity, pressure |
|
|
45
|
-
|
|
46
|
-
## Example Interactions
|
|
47
|
-
|
|
48
|
-
**User**: "What's my phone's battery level?"
|
|
49
|
-
- Use the Battery Monitor service with action "status"
|
|
50
|
-
|
|
51
|
-
**User**: "Turn off WiFi"
|
|
52
|
-
- Use the WiFi Automation service with action "disable"
|
|
53
|
-
|
|
54
|
-
**User**: "What apps are installed?"
|
|
55
|
-
- Use the App List service with action "list"
|
|
56
|
-
|
|
57
|
-
**User**: "Open Chrome"
|
|
58
|
-
- Use the App Launcher service with action "launch", package_name "com.android.chrome"
|
|
59
|
-
|
|
60
|
-
**User**: "Where is my phone?"
|
|
61
|
-
- Use the Location service with action "current"
|
|
62
|
-
|
|
63
|
-
**User**: "Set volume to 50%"
|
|
64
|
-
- Use the Audio Automation service with action "set_volume", volume 50
|
|
65
|
-
|
|
66
|
-
## Device Connection
|
|
67
|
-
|
|
68
|
-
Before using Android tools, ensure:
|
|
69
|
-
1. Device is connected via ADB (USB) or remote WebSocket
|
|
70
|
-
2. Android Device Setup node shows connected status (green indicator)
|
|
71
|
-
3. Required permissions are granted on the device
|
|
72
|
-
|
|
73
|
-
## Error Handling
|
|
74
|
-
|
|
75
|
-
- If device is not connected, inform user to check connection
|
|
76
|
-
- If permission is denied, suggest enabling it in device settings
|
|
77
|
-
- If action fails, provide the error message and suggest alternatives
|
|
78
|
-
|
|
79
|
-
## Setup Requirements
|
|
80
|
-
|
|
81
|
-
1. Connect this skill to Zeenie's `input-skill` handle
|
|
82
|
-
2. Add **Android Toolkit** node and connect to Zeenie's `input-tools` handle
|
|
83
|
-
3. Connect desired Android service nodes to the Android Toolkit
|
|
84
|
-
4. Ensure Android device is paired (green status indicator)
|
|
@@ -1,176 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: code-skill
|
|
3
|
-
description: Execute Python or JavaScript code for calculations, data processing, and automation. Use when user needs to run code, do calculations, or process data.
|
|
4
|
-
allowed-tools: python_code javascript_code
|
|
5
|
-
metadata:
|
|
6
|
-
author: machina
|
|
7
|
-
version: "3.0"
|
|
8
|
-
category: code
|
|
9
|
-
icon: "💻"
|
|
10
|
-
color: "#F59E0B"
|
|
11
|
-
---
|
|
12
|
-
|
|
13
|
-
# Code Execution
|
|
14
|
-
|
|
15
|
-
This skill enables you to execute Python and JavaScript code for various tasks using the `python_code` and `javascript_code` tools.
|
|
16
|
-
|
|
17
|
-
## Tool: python_code
|
|
18
|
-
|
|
19
|
-
Execute Python code for calculations, data processing, and automation.
|
|
20
|
-
|
|
21
|
-
### Parameters
|
|
22
|
-
|
|
23
|
-
| Parameter | Type | Required | Description |
|
|
24
|
-
|-----------|------|----------|-------------|
|
|
25
|
-
| `code` | string | Yes | Python code to execute. Set `output` variable with result. Use `print()` for console output. |
|
|
26
|
-
|
|
27
|
-
### Available Libraries
|
|
28
|
-
- Standard library: `math`, `json`, `datetime`, `timedelta`, `re`, `random`
|
|
29
|
-
- Collections: `Counter`, `defaultdict`
|
|
30
|
-
- All built-in functions
|
|
31
|
-
|
|
32
|
-
### Variables Available
|
|
33
|
-
- `input_data` - Data from connected workflow nodes (dict)
|
|
34
|
-
- `output` - Set this variable to return a result
|
|
35
|
-
|
|
36
|
-
### Returns
|
|
37
|
-
|
|
38
|
-
| Field | Type | Description |
|
|
39
|
-
|-------|------|-------------|
|
|
40
|
-
| `success` | boolean | Whether execution succeeded |
|
|
41
|
-
| `result` | any | Value of `output` variable if set |
|
|
42
|
-
| `output` | string | Captured print() statements |
|
|
43
|
-
| `error` | string | Error message if execution failed |
|
|
44
|
-
|
|
45
|
-
### Example Usage
|
|
46
|
-
```python
|
|
47
|
-
# Calculate with data
|
|
48
|
-
data = input_data.get("numbers", [1, 2, 3])
|
|
49
|
-
total = sum(data)
|
|
50
|
-
average = total / len(data)
|
|
51
|
-
print(f"Total: {total}, Average: {average}")
|
|
52
|
-
output = {"total": total, "average": average}
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
---
|
|
56
|
-
|
|
57
|
-
## Tool: javascript_code
|
|
58
|
-
|
|
59
|
-
Execute JavaScript code for calculations, data processing, and JSON manipulation.
|
|
60
|
-
|
|
61
|
-
### Parameters
|
|
62
|
-
|
|
63
|
-
| Parameter | Type | Required | Description |
|
|
64
|
-
|-----------|------|----------|-------------|
|
|
65
|
-
| `code` | string | Yes | JavaScript code to execute. Set `output` variable with result. Use `console.log()` for output. |
|
|
66
|
-
|
|
67
|
-
### Variables Available
|
|
68
|
-
- `input_data` - Data from connected workflow nodes (object)
|
|
69
|
-
- `output` - Set this variable to return a result
|
|
70
|
-
|
|
71
|
-
### Returns
|
|
72
|
-
|
|
73
|
-
| Field | Type | Description |
|
|
74
|
-
|-------|------|-------------|
|
|
75
|
-
| `success` | boolean | Whether execution succeeded |
|
|
76
|
-
| `result` | any | Value of `output` variable if set |
|
|
77
|
-
| `output` | string | Captured console.log() statements |
|
|
78
|
-
| `error` | string | Error message if execution failed |
|
|
79
|
-
|
|
80
|
-
### Example Usage
|
|
81
|
-
```javascript
|
|
82
|
-
// Process JSON data
|
|
83
|
-
const data = input_data.numbers || [1, 2, 3];
|
|
84
|
-
const total = data.reduce((a, b) => a + b, 0);
|
|
85
|
-
const average = total / data.length;
|
|
86
|
-
console.log(`Total: ${total}, Average: ${average}`);
|
|
87
|
-
output = { total, average };
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
---
|
|
91
|
-
|
|
92
|
-
## Examples
|
|
93
|
-
|
|
94
|
-
### Calculate a tip (Python)
|
|
95
|
-
**User**: "Calculate 15% tip on $85.50"
|
|
96
|
-
|
|
97
|
-
**Tool Call** (python_code):
|
|
98
|
-
```json
|
|
99
|
-
{
|
|
100
|
-
"code": "bill = 85.50\ntip_percent = 15\ntip = bill * (tip_percent / 100)\ntotal = bill + tip\nprint(f\"Tip: ${tip:.2f}\")\nprint(f\"Total: ${total:.2f}\")\noutput = {\"tip\": tip, \"total\": total}"
|
|
101
|
-
}
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
### Generate random numbers (Python)
|
|
105
|
-
**User**: "Generate 5 random numbers between 1 and 100"
|
|
106
|
-
|
|
107
|
-
**Tool Call** (python_code):
|
|
108
|
-
```json
|
|
109
|
-
{
|
|
110
|
-
"code": "import random\nnumbers = [random.randint(1, 100) for _ in range(5)]\nprint(f\"Random numbers: {numbers}\")\noutput = numbers"
|
|
111
|
-
}
|
|
112
|
-
```
|
|
113
|
-
|
|
114
|
-
### Process JSON data (JavaScript)
|
|
115
|
-
**User**: "Sum all the values in this object"
|
|
116
|
-
|
|
117
|
-
**Tool Call** (javascript_code):
|
|
118
|
-
```json
|
|
119
|
-
{
|
|
120
|
-
"code": "const values = Object.values(input_data);\nconst sum = values.reduce((a, b) => a + b, 0);\nconsole.log(`Sum: ${sum}`);\noutput = sum;"
|
|
121
|
-
}
|
|
122
|
-
```
|
|
123
|
-
|
|
124
|
-
### Date calculations (Python)
|
|
125
|
-
**User**: "What date is 30 days from now?"
|
|
126
|
-
|
|
127
|
-
**Tool Call** (python_code):
|
|
128
|
-
```json
|
|
129
|
-
{
|
|
130
|
-
"code": "from datetime import datetime, timedelta\ntoday = datetime.now()\nfuture = today + timedelta(days=30)\nresult = future.strftime('%Y-%m-%d')\nprint(f\"30 days from now: {result}\")\noutput = result"
|
|
131
|
-
}
|
|
132
|
-
```
|
|
133
|
-
|
|
134
|
-
### Array manipulation (JavaScript)
|
|
135
|
-
**User**: "Filter this array to only even numbers"
|
|
136
|
-
|
|
137
|
-
**Tool Call** (javascript_code):
|
|
138
|
-
```json
|
|
139
|
-
{
|
|
140
|
-
"code": "const numbers = input_data.numbers || [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];\nconst evens = numbers.filter(n => n % 2 === 0);\nconsole.log(`Even numbers: ${evens}`);\noutput = evens;"
|
|
141
|
-
}
|
|
142
|
-
```
|
|
143
|
-
|
|
144
|
-
---
|
|
145
|
-
|
|
146
|
-
## When to Use Each Tool
|
|
147
|
-
|
|
148
|
-
| Use Case | Recommended Tool |
|
|
149
|
-
|----------|------------------|
|
|
150
|
-
| Math calculations | `python_code` |
|
|
151
|
-
| Date/time operations | `python_code` |
|
|
152
|
-
| Data analysis | `python_code` |
|
|
153
|
-
| Random number generation | `python_code` |
|
|
154
|
-
| JSON manipulation | `javascript_code` |
|
|
155
|
-
| Array operations | Either |
|
|
156
|
-
| String processing | Either |
|
|
157
|
-
|
|
158
|
-
---
|
|
159
|
-
|
|
160
|
-
## Security Guidelines
|
|
161
|
-
|
|
162
|
-
1. **No file system access** outside designated directories
|
|
163
|
-
2. **No network requests** from code (use http-skill instead)
|
|
164
|
-
3. **No system commands** or shell access
|
|
165
|
-
4. **Limited execution time** (timeout configurable, default 30 seconds)
|
|
166
|
-
5. **No sensitive data** in code outputs
|
|
167
|
-
|
|
168
|
-
## Best Practices
|
|
169
|
-
|
|
170
|
-
1. Keep code simple and focused on one task
|
|
171
|
-
2. Use descriptive variable names
|
|
172
|
-
3. Always set the `output` variable with your result
|
|
173
|
-
4. Use `print()` / `console.log()` for debugging
|
|
174
|
-
5. Handle potential errors gracefully
|
|
175
|
-
6. Prefer Python for math, dates, and data processing
|
|
176
|
-
7. Prefer JavaScript for JSON manipulation
|
|
@@ -1,163 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: http-skill
|
|
3
|
-
description: Make HTTP requests to external APIs and web services. Use when user needs to fetch data from URLs, call APIs, or interact with web services.
|
|
4
|
-
allowed-tools: http-request
|
|
5
|
-
metadata:
|
|
6
|
-
author: machina
|
|
7
|
-
version: "2.0"
|
|
8
|
-
category: integration
|
|
9
|
-
icon: "🌐"
|
|
10
|
-
color: "#EF4444"
|
|
11
|
-
---
|
|
12
|
-
|
|
13
|
-
# HTTP Requests
|
|
14
|
-
|
|
15
|
-
This skill enables you to make HTTP requests to external APIs and web services.
|
|
16
|
-
|
|
17
|
-
## Capabilities
|
|
18
|
-
|
|
19
|
-
- Make GET, POST, PUT, DELETE, PATCH requests
|
|
20
|
-
- Send JSON payloads in request body
|
|
21
|
-
- Set custom headers (authentication, content-type, etc.)
|
|
22
|
-
- Handle API responses (JSON and text)
|
|
23
|
-
|
|
24
|
-
## Tool Reference
|
|
25
|
-
|
|
26
|
-
### http-request
|
|
27
|
-
|
|
28
|
-
Make an HTTP request to a URL.
|
|
29
|
-
|
|
30
|
-
**Parameters:**
|
|
31
|
-
| Parameter | Type | Required | Default | Description |
|
|
32
|
-
|-----------|------|----------|---------|-------------|
|
|
33
|
-
| `url` | string | Yes | - | Full URL to request (e.g., `https://api.example.com/data`) |
|
|
34
|
-
| `method` | string | No | `GET` | HTTP method: `GET`, `POST`, `PUT`, `DELETE`, `PATCH` |
|
|
35
|
-
| `body` | object | No | null | Request body as JSON object (for POST/PUT/PATCH) |
|
|
36
|
-
| `headers` | object | No | null | Custom headers as key-value pairs |
|
|
37
|
-
|
|
38
|
-
**Returns:**
|
|
39
|
-
| Field | Type | Description |
|
|
40
|
-
|-------|------|-------------|
|
|
41
|
-
| `status` | number | HTTP status code (200, 404, 500, etc.) |
|
|
42
|
-
| `data` | any | Response body (parsed JSON or text) |
|
|
43
|
-
| `headers` | object | Response headers |
|
|
44
|
-
| `url` | string | Final URL (may differ if redirected) |
|
|
45
|
-
| `method` | string | HTTP method used |
|
|
46
|
-
|
|
47
|
-
## Common Use Cases
|
|
48
|
-
|
|
49
|
-
### Fetching Data (GET)
|
|
50
|
-
```json
|
|
51
|
-
{
|
|
52
|
-
"url": "https://api.example.com/users/123",
|
|
53
|
-
"method": "GET"
|
|
54
|
-
}
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
### Creating Resources (POST)
|
|
58
|
-
```json
|
|
59
|
-
{
|
|
60
|
-
"url": "https://api.example.com/users",
|
|
61
|
-
"method": "POST",
|
|
62
|
-
"body": {"name": "John", "email": "john@example.com"},
|
|
63
|
-
"headers": {"Content-Type": "application/json"}
|
|
64
|
-
}
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
### Updating Resources (PUT/PATCH)
|
|
68
|
-
```json
|
|
69
|
-
{
|
|
70
|
-
"url": "https://api.example.com/users/123",
|
|
71
|
-
"method": "PUT",
|
|
72
|
-
"body": {"name": "John Updated"}
|
|
73
|
-
}
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
### Deleting Resources (DELETE)
|
|
77
|
-
```json
|
|
78
|
-
{
|
|
79
|
-
"url": "https://api.example.com/users/123",
|
|
80
|
-
"method": "DELETE"
|
|
81
|
-
}
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
### With Authentication
|
|
85
|
-
```json
|
|
86
|
-
{
|
|
87
|
-
"url": "https://api.example.com/protected",
|
|
88
|
-
"method": "GET",
|
|
89
|
-
"headers": {
|
|
90
|
-
"Authorization": "Bearer your-api-token",
|
|
91
|
-
"X-API-Key": "your-api-key"
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
## Examples
|
|
97
|
-
|
|
98
|
-
**User**: "Get the current Bitcoin price"
|
|
99
|
-
**Action**: Use http-request with:
|
|
100
|
-
```json
|
|
101
|
-
{
|
|
102
|
-
"url": "https://api.coindesk.com/v1/bpi/currentprice.json",
|
|
103
|
-
"method": "GET"
|
|
104
|
-
}
|
|
105
|
-
```
|
|
106
|
-
|
|
107
|
-
**User**: "Post this data to my webhook"
|
|
108
|
-
**Action**: Use http-request with:
|
|
109
|
-
```json
|
|
110
|
-
{
|
|
111
|
-
"url": "https://webhook.example.com/endpoint",
|
|
112
|
-
"method": "POST",
|
|
113
|
-
"body": {"event": "user_action", "data": "..."},
|
|
114
|
-
"headers": {"Content-Type": "application/json"}
|
|
115
|
-
}
|
|
116
|
-
```
|
|
117
|
-
|
|
118
|
-
**User**: "Check if example.com is up"
|
|
119
|
-
**Action**: Use http-request with:
|
|
120
|
-
```json
|
|
121
|
-
{
|
|
122
|
-
"url": "https://example.com",
|
|
123
|
-
"method": "GET"
|
|
124
|
-
}
|
|
125
|
-
```
|
|
126
|
-
Then check if status is 200.
|
|
127
|
-
|
|
128
|
-
**User**: "Get weather for New York"
|
|
129
|
-
**Action**: Use http-request with:
|
|
130
|
-
```json
|
|
131
|
-
{
|
|
132
|
-
"url": "https://api.openweathermap.org/data/2.5/weather?q=New York&appid=YOUR_KEY",
|
|
133
|
-
"method": "GET"
|
|
134
|
-
}
|
|
135
|
-
```
|
|
136
|
-
|
|
137
|
-
## Security Guidelines
|
|
138
|
-
|
|
139
|
-
1. **Never expose API keys** in responses to the user
|
|
140
|
-
2. **Validate URLs** - only request from trusted domains
|
|
141
|
-
3. **Don't make requests** to internal/private networks (localhost, 192.168.x.x, 10.x.x.x)
|
|
142
|
-
4. **Respect rate limits** of external services
|
|
143
|
-
5. **Handle errors gracefully** and inform the user clearly
|
|
144
|
-
6. **Don't store sensitive data** from API responses
|
|
145
|
-
|
|
146
|
-
## Error Handling
|
|
147
|
-
|
|
148
|
-
Common HTTP status codes and what they mean:
|
|
149
|
-
|
|
150
|
-
| Status | Meaning | Action |
|
|
151
|
-
|--------|---------|--------|
|
|
152
|
-
| 200-299 | Success | Process the response data |
|
|
153
|
-
| 400 | Bad Request | Check request parameters |
|
|
154
|
-
| 401 | Unauthorized | Check API key/authentication |
|
|
155
|
-
| 403 | Forbidden | Access denied, may need different permissions |
|
|
156
|
-
| 404 | Not Found | Check URL path |
|
|
157
|
-
| 429 | Too Many Requests | Rate limited, wait before retrying |
|
|
158
|
-
| 500-599 | Server Error | External service issue, try again later |
|
|
159
|
-
|
|
160
|
-
When an error occurs, inform the user about:
|
|
161
|
-
- What was attempted
|
|
162
|
-
- What went wrong (status code and message)
|
|
163
|
-
- Suggested next steps
|