lua-cli 3.0.0-alpha.1 â 3.0.0-alpha.5
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/api/job.api.service.d.ts +16 -7
- package/dist/api/job.api.service.js +21 -5
- package/dist/api/postprocessor.api.service.d.ts +61 -1
- package/dist/api/postprocessor.api.service.js +35 -0
- package/dist/api/preprocessor.api.service.d.ts +61 -1
- package/dist/api/preprocessor.api.service.js +35 -0
- package/dist/api-exports.d.ts +26 -6
- package/dist/api-exports.js +42 -29
- package/dist/cli/command-definitions.js +13 -6
- package/dist/commands/chat.js +32 -5
- package/dist/commands/compile.js +16 -2
- package/dist/commands/dev.js +23 -2
- package/dist/commands/push.d.ts +6 -2
- package/dist/commands/push.js +412 -6
- package/dist/commands/test.js +18 -2
- package/dist/common/job.instance.d.ts +3 -0
- package/dist/common/job.instance.js +8 -0
- package/dist/config/constants.d.ts +6 -5
- package/dist/config/constants.js +12 -10
- package/dist/interfaces/chat.d.ts +30 -1
- package/dist/interfaces/jobs.d.ts +21 -0
- package/dist/types/skill.d.ts +75 -56
- package/dist/types/skill.js +53 -59
- package/dist/utils/bundling.d.ts +13 -4
- package/dist/utils/bundling.js +83 -26
- package/dist/utils/compile.js +27 -6
- package/dist/utils/dev-api.d.ts +42 -2
- package/dist/utils/dev-api.js +177 -4
- package/dist/utils/dev-server.d.ts +1 -1
- package/dist/utils/dev-server.js +4 -4
- package/dist/utils/dynamic-job-bundler.d.ts +17 -0
- package/dist/utils/dynamic-job-bundler.js +143 -0
- package/dist/utils/pre-bundle-jobs.d.ts +26 -0
- package/dist/utils/pre-bundle-jobs.js +176 -0
- package/dist/utils/sandbox-storage.d.ts +48 -0
- package/dist/utils/sandbox-storage.js +114 -0
- package/dist/utils/sandbox.d.ts +2 -2
- package/dist/utils/sandbox.js +23 -7
- package/package.json +1 -1
- package/template/lua.skill.yaml +47 -0
- package/template/package-lock.json +10505 -0
- package/template/package.json +2 -1
- package/template/src/index.ts +65 -3
- package/template/src/tools/CreateInlineJob.ts +42 -0
- package/API_REFERENCE.md +0 -1408
- package/CHANGELOG.md +0 -236
- package/CLI_REFERENCE.md +0 -908
- package/GETTING_STARTED.md +0 -1040
- package/INSTANCE_TYPES.md +0 -1158
- package/README.md +0 -865
- package/TEMPLATE_GUIDE.md +0 -1398
- package/USER_DATA_INSTANCE.md +0 -621
- package/template/AGENT_CONFIGURATION.md +0 -251
- package/template/COMPLEX_JOB_EXAMPLES.md +0 -795
- package/template/DYNAMIC_JOB_CREATION.md +0 -371
- package/template/TOOL_EXAMPLES.md +0 -655
- package/template/WEBHOOKS_JOBS_QUICKSTART.md +0 -318
- package/template/WEBHOOK_JOB_EXAMPLES.md +0 -817
- package/template/src/index-agent-example.ts +0 -201
- package/template/src/postprocessors/ResponseFormatter.ts +0 -151
- package/template/src/preprocessors/MessageFilter.ts +0 -91
|
@@ -1,251 +0,0 @@
|
|
|
1
|
-
# Agent Configuration Guide
|
|
2
|
-
|
|
3
|
-
## Overview
|
|
4
|
-
|
|
5
|
-
There are two ways to configure your Lua agent:
|
|
6
|
-
|
|
7
|
-
1. **LuaAgent (Recommended)** - Unified, simple approach
|
|
8
|
-
2. **Individual Components (Legacy)** - Separate exports for each component
|
|
9
|
-
|
|
10
|
-
Both approaches are fully supported and backward compatible.
|
|
11
|
-
|
|
12
|
-
## Approach 1: LuaAgent (Recommended)
|
|
13
|
-
|
|
14
|
-
The `LuaAgent` provides a simplified, unified way to configure your agent. All components (skills, webhooks, jobs, processors) are defined in one place.
|
|
15
|
-
|
|
16
|
-
### Benefits
|
|
17
|
-
|
|
18
|
-
- **Simpler**: One object contains everything
|
|
19
|
-
- **Clearer**: Easy to see all components at a glance
|
|
20
|
-
- **Persona Sync**: Agent persona automatically syncs with `lua.skill.yaml`
|
|
21
|
-
- **Better Organization**: Natural hierarchy of components
|
|
22
|
-
- **Less Boilerplate**: No need to export multiple separate items
|
|
23
|
-
|
|
24
|
-
### Example
|
|
25
|
-
|
|
26
|
-
```typescript
|
|
27
|
-
import { LuaAgent, LuaSkill } from 'lua-cli';
|
|
28
|
-
import { weatherSkill } from './skills/weather';
|
|
29
|
-
import { userSkill } from './skills/user';
|
|
30
|
-
import { healthCheckJob } from './jobs/health-check';
|
|
31
|
-
import { userWebhook } from './webhooks/user';
|
|
32
|
-
|
|
33
|
-
// Define your agent with all components in one place
|
|
34
|
-
export const agent = new LuaAgent({
|
|
35
|
-
name: 'my-assistant',
|
|
36
|
-
|
|
37
|
-
// Agent personality and behavior
|
|
38
|
-
persona: `You are a helpful assistant that can provide weather information
|
|
39
|
-
and manage user accounts. Be friendly and concise.`,
|
|
40
|
-
|
|
41
|
-
// Welcome message shown to new users
|
|
42
|
-
welcomeMessage: 'Hello! How can I help you today?',
|
|
43
|
-
|
|
44
|
-
// Skills - collections of tools
|
|
45
|
-
skills: [weatherSkill, userSkill],
|
|
46
|
-
|
|
47
|
-
// Webhooks - HTTP endpoints for external events
|
|
48
|
-
webhooks: [userWebhook],
|
|
49
|
-
|
|
50
|
-
// Jobs - scheduled tasks
|
|
51
|
-
jobs: [healthCheckJob],
|
|
52
|
-
|
|
53
|
-
// Preprocessors - modify messages before they reach the agent
|
|
54
|
-
preProcessors: [],
|
|
55
|
-
|
|
56
|
-
// Postprocessors - modify responses before they reach the user
|
|
57
|
-
postProcessors: []
|
|
58
|
-
});
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
### File Structure
|
|
62
|
-
|
|
63
|
-
When using `LuaAgent`, organize your code like this:
|
|
64
|
-
|
|
65
|
-
```
|
|
66
|
-
src/
|
|
67
|
-
âââ index.ts # Main agent configuration
|
|
68
|
-
âââ skills/
|
|
69
|
-
â âââ weather-skill.ts # Weather skill with tools
|
|
70
|
-
â âââ user-skill.ts # User management skill
|
|
71
|
-
âââ tools/
|
|
72
|
-
â âââ WeatherTool.ts # Individual tool classes
|
|
73
|
-
â âââ UserTool.ts
|
|
74
|
-
âââ webhooks/
|
|
75
|
-
â âââ UserWebhook.ts # Webhook handlers
|
|
76
|
-
âââ jobs/
|
|
77
|
-
â âââ HealthCheckJob.ts # Scheduled jobs
|
|
78
|
-
âââ processors/
|
|
79
|
-
âââ MessageFilter.ts # Preprocessors
|
|
80
|
-
âââ ResponseFormatter.ts # Postprocessors
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
### Compilation
|
|
84
|
-
|
|
85
|
-
When you run `lua compile`, the compiler will:
|
|
86
|
-
|
|
87
|
-
1. Detect the `LuaAgent` in `index.ts`
|
|
88
|
-
2. Extract the agent's persona and welcome message
|
|
89
|
-
3. Sync them with `lua.skill.yaml`
|
|
90
|
-
4. Extract all skills, webhooks, jobs, and processors
|
|
91
|
-
5. Bundle and deploy everything
|
|
92
|
-
|
|
93
|
-
Output during compilation:
|
|
94
|
-
```
|
|
95
|
-
⨠Found LuaAgent: my-assistant
|
|
96
|
-
Using new unified agent configuration approach
|
|
97
|
-
â
Synced agent persona to lua.skill.yaml
|
|
98
|
-
đĻ Agent contains: 2 skill(s), 1 webhook(s), 1 job(s), 0 preprocessor(s), 0 postprocessor(s)
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
## Approach 2: Individual Components (Legacy)
|
|
102
|
-
|
|
103
|
-
The legacy approach exports each component type separately. This is still fully supported for backward compatibility.
|
|
104
|
-
|
|
105
|
-
### Example
|
|
106
|
-
|
|
107
|
-
```typescript
|
|
108
|
-
import { LuaSkill, LuaJob, LuaWebhook } from 'lua-cli';
|
|
109
|
-
|
|
110
|
-
// Export skills individually
|
|
111
|
-
export const weatherSkill = new LuaSkill({
|
|
112
|
-
name: 'weather-skill',
|
|
113
|
-
version: '1.0.0',
|
|
114
|
-
description: 'Weather information',
|
|
115
|
-
context: 'Provides current weather data',
|
|
116
|
-
tools: [new GetWeatherTool()]
|
|
117
|
-
});
|
|
118
|
-
|
|
119
|
-
export const userSkill = new LuaSkill({
|
|
120
|
-
name: 'user-skill',
|
|
121
|
-
version: '1.0.0',
|
|
122
|
-
description: 'User management',
|
|
123
|
-
context: 'Manages user accounts',
|
|
124
|
-
tools: [new GetUserTool()]
|
|
125
|
-
});
|
|
126
|
-
|
|
127
|
-
// Export jobs individually
|
|
128
|
-
export const healthCheckJob = new LuaJob({
|
|
129
|
-
name: 'health-check',
|
|
130
|
-
version: '1.0.0',
|
|
131
|
-
description: 'System health check',
|
|
132
|
-
context: 'Monitors system status',
|
|
133
|
-
schedule: { type: 'interval', seconds: 300 },
|
|
134
|
-
execute: async () => {
|
|
135
|
-
return { status: 'healthy' };
|
|
136
|
-
}
|
|
137
|
-
});
|
|
138
|
-
|
|
139
|
-
// Export webhooks individually
|
|
140
|
-
export const userWebhook = new LuaWebhook({
|
|
141
|
-
name: 'user-webhook',
|
|
142
|
-
version: '1.0.0',
|
|
143
|
-
description: 'User event handler',
|
|
144
|
-
context: 'Processes user events',
|
|
145
|
-
execute: async ({ body }) => {
|
|
146
|
-
return { received: true };
|
|
147
|
-
}
|
|
148
|
-
});
|
|
149
|
-
```
|
|
150
|
-
|
|
151
|
-
### Compilation
|
|
152
|
-
|
|
153
|
-
When you run `lua compile`, the compiler will:
|
|
154
|
-
|
|
155
|
-
1. Scan for individual `LuaSkill`, `LuaJob`, `LuaWebhook`, etc.
|
|
156
|
-
2. Extract each component separately
|
|
157
|
-
3. Bundle and deploy everything
|
|
158
|
-
|
|
159
|
-
Output during compilation:
|
|
160
|
-
```
|
|
161
|
-
âšī¸ No LuaAgent found, using legacy detection for individual components
|
|
162
|
-
đĻ Found 2 skill(s)...
|
|
163
|
-
đĻ Found 1 webhook(s)...
|
|
164
|
-
đĻ Found 1 job(s)...
|
|
165
|
-
```
|
|
166
|
-
|
|
167
|
-
## Comparison
|
|
168
|
-
|
|
169
|
-
| Feature | LuaAgent | Individual Components |
|
|
170
|
-
|---------|----------|----------------------|
|
|
171
|
-
| **Configuration Style** | Single unified object | Multiple separate exports |
|
|
172
|
-
| **Persona Management** | Auto-synced with YAML | Manual YAML editing |
|
|
173
|
-
| **Code Organization** | Hierarchical | Flat |
|
|
174
|
-
| **Ease of Use** | âââââ | âââ |
|
|
175
|
-
| **Backward Compatible** | â
| â
|
|
|
176
|
-
| **Use Case** | New projects, simple setup | Existing projects, gradual migration |
|
|
177
|
-
|
|
178
|
-
## When to Use Each Approach
|
|
179
|
-
|
|
180
|
-
### Use LuaAgent when:
|
|
181
|
-
|
|
182
|
-
- â
Starting a new project
|
|
183
|
-
- â
You want a simple, unified configuration
|
|
184
|
-
- â
You want automatic persona synchronization
|
|
185
|
-
- â
You prefer a clear hierarchy of components
|
|
186
|
-
|
|
187
|
-
### Use Individual Components when:
|
|
188
|
-
|
|
189
|
-
- â
Maintaining an existing project
|
|
190
|
-
- â
Gradually migrating to the new approach
|
|
191
|
-
- â
You prefer more granular control
|
|
192
|
-
- â
Working with a legacy codebase
|
|
193
|
-
|
|
194
|
-
## Migration Guide
|
|
195
|
-
|
|
196
|
-
If you have an existing project using individual components, you can migrate to `LuaAgent` gradually:
|
|
197
|
-
|
|
198
|
-
### Step 1: Keep Your Existing Files
|
|
199
|
-
|
|
200
|
-
Don't change your skill/webhook/job definitions. They can stay in separate files.
|
|
201
|
-
|
|
202
|
-
### Step 2: Create LuaAgent
|
|
203
|
-
|
|
204
|
-
In your `index.ts`, import all components and create a `LuaAgent`:
|
|
205
|
-
|
|
206
|
-
```typescript
|
|
207
|
-
// Import existing components
|
|
208
|
-
import { weatherSkill } from './skills/weather';
|
|
209
|
-
import { userSkill } from './skills/user';
|
|
210
|
-
import { healthCheckJob } from './jobs/health-check';
|
|
211
|
-
|
|
212
|
-
// Create LuaAgent that references them
|
|
213
|
-
export const agent = new LuaAgent({
|
|
214
|
-
name: 'my-assistant',
|
|
215
|
-
persona: 'Your agent persona here',
|
|
216
|
-
skills: [weatherSkill, userSkill],
|
|
217
|
-
jobs: [healthCheckJob]
|
|
218
|
-
});
|
|
219
|
-
```
|
|
220
|
-
|
|
221
|
-
### Step 3: Remove Individual Exports
|
|
222
|
-
|
|
223
|
-
Remove any `export` keywords from your skill/webhook/job files, or keep them for testing.
|
|
224
|
-
|
|
225
|
-
### Step 4: Test
|
|
226
|
-
|
|
227
|
-
Run `lua compile` to verify everything works:
|
|
228
|
-
|
|
229
|
-
```bash
|
|
230
|
-
lua compile
|
|
231
|
-
```
|
|
232
|
-
|
|
233
|
-
You should see:
|
|
234
|
-
```
|
|
235
|
-
⨠Found LuaAgent: my-assistant
|
|
236
|
-
```
|
|
237
|
-
|
|
238
|
-
## Examples
|
|
239
|
-
|
|
240
|
-
See the following files for complete examples:
|
|
241
|
-
|
|
242
|
-
- `src/index-agent-example.ts` - LuaAgent approach (recommended)
|
|
243
|
-
- `src/index.ts` - Individual components approach (legacy)
|
|
244
|
-
|
|
245
|
-
## Questions?
|
|
246
|
-
|
|
247
|
-
- Check the main README.md for more information
|
|
248
|
-
- See QUICKSTART.md for getting started
|
|
249
|
-
- View WEBHOOK_JOB_EXAMPLES.md for webhook and job examples
|
|
250
|
-
- Read COMPLEX_JOB_EXAMPLES.md for advanced job patterns
|
|
251
|
-
|