lua-cli 2.5.8 → 3.0.0-alpha.10

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.
Files changed (121) hide show
  1. package/dist/api/chat.api.service.d.ts +8 -0
  2. package/dist/api/chat.api.service.js +50 -0
  3. package/dist/api/job.api.service.d.ts +219 -0
  4. package/dist/api/job.api.service.js +216 -0
  5. package/dist/api/lazy-instances.d.ts +24 -0
  6. package/dist/api/lazy-instances.js +48 -0
  7. package/dist/api/postprocessor.api.service.d.ts +158 -0
  8. package/dist/api/postprocessor.api.service.js +111 -0
  9. package/dist/api/preprocessor.api.service.d.ts +158 -0
  10. package/dist/api/preprocessor.api.service.js +111 -0
  11. package/dist/api/user.data.api.service.d.ts +13 -0
  12. package/dist/api/user.data.api.service.js +20 -0
  13. package/dist/api/webhook.api.service.d.ts +151 -0
  14. package/dist/api/webhook.api.service.js +134 -0
  15. package/dist/api-exports.d.ts +176 -41
  16. package/dist/api-exports.js +195 -21
  17. package/dist/cli/command-definitions.js +85 -8
  18. package/dist/commands/chat.js +73 -36
  19. package/dist/commands/compile.js +140 -7
  20. package/dist/commands/dev.js +23 -2
  21. package/dist/commands/index.d.ts +4 -0
  22. package/dist/commands/index.js +4 -0
  23. package/dist/commands/init.js +53 -7
  24. package/dist/commands/jobs.d.ts +20 -0
  25. package/dist/commands/jobs.js +533 -0
  26. package/dist/commands/logs.js +2 -5
  27. package/dist/commands/postprocessors.d.ts +8 -0
  28. package/dist/commands/postprocessors.js +431 -0
  29. package/dist/commands/preprocessors.d.ts +8 -0
  30. package/dist/commands/preprocessors.js +431 -0
  31. package/dist/commands/push.d.ts +3 -2
  32. package/dist/commands/push.js +1216 -7
  33. package/dist/commands/test.d.ts +9 -18
  34. package/dist/commands/test.js +574 -82
  35. package/dist/commands/webhooks.d.ts +18 -0
  36. package/dist/commands/webhooks.js +424 -0
  37. package/dist/common/job.instance.d.ts +80 -0
  38. package/dist/common/job.instance.js +116 -0
  39. package/dist/common/user.instance.d.ts +1 -0
  40. package/dist/common/user.instance.js +9 -0
  41. package/dist/config/constants.d.ts +4 -3
  42. package/dist/config/constants.js +10 -8
  43. package/dist/interfaces/agent.d.ts +2 -1
  44. package/dist/interfaces/chat.d.ts +52 -1
  45. package/dist/interfaces/index.d.ts +10 -0
  46. package/dist/interfaces/index.js +7 -0
  47. package/dist/interfaces/jobs.d.ts +193 -0
  48. package/dist/interfaces/jobs.js +5 -0
  49. package/dist/interfaces/postprocessors.d.ts +35 -0
  50. package/dist/interfaces/postprocessors.js +4 -0
  51. package/dist/interfaces/preprocessors.d.ts +35 -0
  52. package/dist/interfaces/preprocessors.js +4 -0
  53. package/dist/interfaces/webhooks.d.ts +104 -0
  54. package/dist/interfaces/webhooks.js +5 -0
  55. package/dist/services/auth.d.ts +8 -2
  56. package/dist/services/auth.js +35 -3
  57. package/dist/types/api-contracts.d.ts +5 -0
  58. package/dist/types/compile.types.d.ts +49 -0
  59. package/dist/types/index.d.ts +1 -1
  60. package/dist/types/index.js +1 -1
  61. package/dist/types/skill.d.ts +521 -0
  62. package/dist/types/skill.js +471 -0
  63. package/dist/utils/agent-management.d.ts +25 -0
  64. package/dist/utils/agent-management.js +67 -0
  65. package/dist/utils/bundling.d.ts +44 -5
  66. package/dist/utils/bundling.js +723 -23
  67. package/dist/utils/compile.d.ts +63 -0
  68. package/dist/utils/compile.js +712 -36
  69. package/dist/utils/deployment.d.ts +2 -1
  70. package/dist/utils/deployment.js +16 -2
  71. package/dist/utils/dev-api.d.ts +42 -2
  72. package/dist/utils/dev-api.js +177 -4
  73. package/dist/utils/dev-server.d.ts +1 -1
  74. package/dist/utils/dev-server.js +4 -4
  75. package/dist/utils/dynamic-job-bundler.d.ts +17 -0
  76. package/dist/utils/dynamic-job-bundler.js +143 -0
  77. package/dist/utils/init-agent.d.ts +3 -1
  78. package/dist/utils/init-agent.js +6 -4
  79. package/dist/utils/init-prompts.d.ts +2 -1
  80. package/dist/utils/init-prompts.js +14 -9
  81. package/dist/utils/job-management.d.ts +24 -0
  82. package/dist/utils/job-management.js +264 -0
  83. package/dist/utils/postprocessor-management.d.ts +9 -0
  84. package/dist/utils/postprocessor-management.js +118 -0
  85. package/dist/utils/pre-bundle-jobs.d.ts +26 -0
  86. package/dist/utils/pre-bundle-jobs.js +176 -0
  87. package/dist/utils/preprocessor-management.d.ts +9 -0
  88. package/dist/utils/preprocessor-management.js +118 -0
  89. package/dist/utils/sandbox-storage.d.ts +48 -0
  90. package/dist/utils/sandbox-storage.js +114 -0
  91. package/dist/utils/sandbox.d.ts +61 -1
  92. package/dist/utils/sandbox.js +299 -72
  93. package/dist/utils/tool-detection.d.ts +3 -2
  94. package/dist/utils/tool-detection.js +18 -4
  95. package/dist/utils/webhook-management.d.ts +24 -0
  96. package/dist/utils/webhook-management.js +256 -0
  97. package/package.json +1 -1
  98. package/template/README.md +30 -2
  99. package/template/env.example +5 -0
  100. package/template/lua.skill.yaml +47 -0
  101. package/template/package-lock.json +10505 -0
  102. package/template/package.json +2 -1
  103. package/template/src/index.ts +103 -2
  104. package/template/src/jobs/AbandonedBasketProcessorJob.ts +139 -0
  105. package/template/src/jobs/DailyCleanupJob.ts +100 -0
  106. package/template/src/jobs/DataMigrationJob.ts +133 -0
  107. package/template/src/jobs/HealthCheckJob.ts +87 -0
  108. package/template/src/tools/CreateInlineJob.ts +42 -0
  109. package/template/src/tools/GameScoreTrackerTool.ts +356 -0
  110. package/template/src/tools/SmartBasketTool.ts +188 -0
  111. package/template/src/webhooks/PaymentWebhook.ts +113 -0
  112. package/template/src/webhooks/UserEventWebhook.ts +77 -0
  113. package/API_REFERENCE.md +0 -1408
  114. package/CHANGELOG.md +0 -236
  115. package/CLI_REFERENCE.md +0 -908
  116. package/GETTING_STARTED.md +0 -1040
  117. package/INSTANCE_TYPES.md +0 -1158
  118. package/README.md +0 -865
  119. package/TEMPLATE_GUIDE.md +0 -1398
  120. package/USER_DATA_INSTANCE.md +0 -621
  121. package/template/TOOL_EXAMPLES.md +0 -655
@@ -18,7 +18,7 @@
18
18
  // SKILL SYSTEM EXPORTS
19
19
  // ============================================================================
20
20
  // Core skill classes and utilities
21
- export { LuaSkill, env } from './skill.js';
21
+ export { LuaSkill, LuaWebhook, LuaJob, env } from './skill.js';
22
22
  // Tool validation utilities
23
23
  export { validateToolName, assertValidToolName } from './tool-validation.js';
24
24
  // Basket types
@@ -3,6 +3,8 @@
3
3
  * Core types and classes for building Lua AI skills
4
4
  */
5
5
  import { ZodType } from "zod";
6
+ import UserDataInstance from "../common/user.instance.js";
7
+ import { JobInstance } from "../common/job.instance.js";
6
8
  /**
7
9
  * Safe environment variable access function.
8
10
  * Gets injected at runtime with skill-specific environment variables.
@@ -140,3 +142,522 @@ export declare class LuaSkill {
140
142
  */
141
143
  run(input: Record<string, any>): Promise<any>;
142
144
  }
145
+ /**
146
+ * Job schedule configuration
147
+ * Supports either cron-style recurring schedules or one-time execution
148
+ */
149
+ export type JobSchedule = {
150
+ type: 'cron';
151
+ expression: string;
152
+ timezone?: string;
153
+ } | {
154
+ type: 'once';
155
+ executeAt: Date | string;
156
+ } | {
157
+ type: 'interval';
158
+ seconds: number;
159
+ };
160
+ /**
161
+ * Lua Job configuration.
162
+ * Used to initialize a new LuaJob instance.
163
+ */
164
+ export interface LuaJobConfig {
165
+ /** Job name (optional, defaults to 'unnamed-job') */
166
+ name?: string;
167
+ /** Job version (optional, defaults to '1.0.0') */
168
+ version?: string;
169
+ /** Short description of the job (1-2 sentences) */
170
+ description: string;
171
+ /** Detailed context for what this job does */
172
+ context: string;
173
+ /** Schedule configuration - cron, once, or interval */
174
+ schedule: JobSchedule;
175
+ /**
176
+ * Function that executes the job logic.
177
+ * Receives metadata as parameter for accessing job configuration.
178
+ */
179
+ execute: (job: JobInstance) => Promise<any>;
180
+ /** Optional timeout in seconds (default: 300) */
181
+ timeout?: number;
182
+ /** Optional retry configuration */
183
+ retry?: {
184
+ maxAttempts: number;
185
+ backoffSeconds?: number;
186
+ };
187
+ /**
188
+ * Optional metadata for the job.
189
+ * Can store any custom data (tags, config, context, etc.)
190
+ * Sent to server and accessible during execution.
191
+ */
192
+ metadata?: Record<string, any>;
193
+ }
194
+ /**
195
+ * Lua Job class.
196
+ * Main class for building scheduled jobs (cron jobs, one-time tasks, intervals).
197
+ *
198
+ * A job is a scheduled task that executes at specific times or intervals.
199
+ * Jobs can run once, on a recurring schedule (cron), or at fixed intervals.
200
+ *
201
+ * @example
202
+ * ```typescript
203
+ * import { LuaJob } from 'lua-cli';
204
+ *
205
+ * // Daily cleanup job at 2 AM
206
+ * const dailyCleanup = new LuaJob({
207
+ * name: 'daily-cleanup',
208
+ * version: '1.0.0',
209
+ * description: "Daily database cleanup job",
210
+ * context: "Runs at 2 AM daily to clean up old records and optimize tables.",
211
+ * schedule: {
212
+ * type: 'cron',
213
+ * expression: '0 2 * * *', // 2 AM every day
214
+ * timezone: 'America/New_York'
215
+ * },
216
+ * timeout: 600, // 10 minutes
217
+ * retry: {
218
+ * maxAttempts: 3,
219
+ * backoffSeconds: 60
220
+ * },
221
+ * execute: async () => {
222
+ * // Cleanup logic
223
+ * console.log('Running cleanup...');
224
+ * return { recordsDeleted: 150 };
225
+ * }
226
+ * });
227
+ *
228
+ * // One-time job
229
+ * const sendWelcome = new LuaJob({
230
+ * name: 'send-welcome',
231
+ * version: '1.0.0',
232
+ * description: "Send welcome email to new users",
233
+ * context: "Scheduled one-time task to send welcome emails.",
234
+ * schedule: {
235
+ * type: 'once',
236
+ * executeAt: new Date('2025-12-31T10:00:00Z')
237
+ * },
238
+ * execute: async () => {
239
+ * console.log('Sending welcome emails...');
240
+ * return { emailsSent: 100 };
241
+ * }
242
+ * });
243
+ *
244
+ * // Interval-based job (every 5 minutes)
245
+ * const healthCheck = new LuaJob({
246
+ * name: 'health-check',
247
+ * version: '1.0.0',
248
+ * description: "System health check",
249
+ * context: "Runs every 5 minutes to check system health.",
250
+ * schedule: {
251
+ * type: 'interval',
252
+ * seconds: 300 // 5 minutes
253
+ * },
254
+ * execute: async () => {
255
+ * return { status: 'healthy' };
256
+ * }
257
+ * });
258
+ * ```
259
+ */
260
+ export declare class LuaJob {
261
+ private readonly name;
262
+ private readonly version;
263
+ private readonly description;
264
+ private readonly context;
265
+ private readonly schedule;
266
+ private readonly timeout;
267
+ private readonly retry?;
268
+ private readonly metadata?;
269
+ private readonly executeFunction;
270
+ /**
271
+ * Creates a new LuaJob instance.
272
+ *
273
+ * @param config - Configuration object containing job metadata
274
+ * @param config.name - Job name (optional, defaults to 'unnamed-job')
275
+ * @param config.version - Job version (optional, defaults to '1.0.0')
276
+ * @param config.description - Short description of what the job does (1-2 sentences)
277
+ * @param config.context - Detailed explanation of the job's purpose
278
+ * @param config.schedule - Schedule configuration (cron, once, or interval)
279
+ * @param config.timeout - Optional timeout in seconds (default: 300)
280
+ * @param config.retry - Optional retry configuration
281
+ * @param config.metadata - Optional metadata for the job
282
+ * @param config.execute - Function that processes the job (receives job instance as parameter)
283
+ */
284
+ constructor(config: LuaJobConfig);
285
+ /**
286
+ * Gets the job name.
287
+ */
288
+ getName(): string;
289
+ /**
290
+ * Gets the job version.
291
+ */
292
+ getVersion(): string;
293
+ /**
294
+ * Gets the job description.
295
+ */
296
+ getDescription(): string;
297
+ /**
298
+ * Gets the job context.
299
+ */
300
+ getContext(): string;
301
+ /**
302
+ * Gets the job schedule.
303
+ */
304
+ getSchedule(): JobSchedule;
305
+ /**
306
+ * Gets the job timeout in seconds.
307
+ */
308
+ getTimeout(): number;
309
+ /**
310
+ * Gets the retry configuration.
311
+ */
312
+ getRetry(): {
313
+ maxAttempts: number;
314
+ backoffSeconds?: number;
315
+ } | undefined;
316
+ /**
317
+ * Gets the job metadata.
318
+ */
319
+ getMetadata(): Record<string, any> | undefined;
320
+ }
321
+ /**
322
+ * Lua Webhook configuration.
323
+ * Used to initialize a new LuaWebhook instance.
324
+ */
325
+ export interface LuaWebhookConfig {
326
+ /** Webhook name (optional, defaults to 'unnamed-webhook') */
327
+ name?: string;
328
+ /** Webhook version (optional, defaults to '1.0.0') */
329
+ version?: string;
330
+ /** Short description of the webhook (1-2 sentences) */
331
+ description: string;
332
+ /** Detailed context for what this webhook does and how it should be used */
333
+ context: string;
334
+ /** Optional Zod schema for query parameter validation */
335
+ querySchema?: ZodType;
336
+ /** Optional Zod schema for header validation */
337
+ headerSchema?: ZodType;
338
+ /** Optional Zod schema for body validation */
339
+ bodySchema?: ZodType;
340
+ /** Function that executes the webhook logic */
341
+ execute: (query?: any, headers?: any, body?: any) => Promise<any>;
342
+ }
343
+ /**
344
+ * Lua Webhook class.
345
+ * Main class for building webhooks with validated inputs.
346
+ *
347
+ * A webhook is an HTTP endpoint that can receive requests with validated
348
+ * query parameters, headers, and body. The execute function processes the
349
+ * validated input and returns a response.
350
+ *
351
+ * @example
352
+ * ```typescript
353
+ * import { LuaWebhook } from 'lua-cli';
354
+ * import { z } from 'zod';
355
+ *
356
+ * const webhook = new LuaWebhook({
357
+ * name: 'user-created',
358
+ * version: '1.0.0',
359
+ * description: "Webhook that handles user creation events",
360
+ * context: "This webhook processes new user registration events. " +
361
+ * "It validates the user data and sends welcome emails.",
362
+ * querySchema: z.object({
363
+ * source: z.string().optional()
364
+ * }),
365
+ * headerSchema: z.object({
366
+ * 'x-api-key': z.string(),
367
+ * 'content-type': z.string().optional()
368
+ * }),
369
+ * bodySchema: z.object({
370
+ * userId: z.string(),
371
+ * email: z.string().email(),
372
+ * name: z.string()
373
+ * }),
374
+ * execute: async (query, headers, body) => {
375
+ * // Process the webhook...
376
+ * console.log('New user:', body.email);
377
+ * return { success: true, userId: body.userId };
378
+ * }
379
+ * });
380
+ *
381
+ * // Execute the webhook with validated inputs
382
+ * const result = await webhook.execute(
383
+ * { source: 'mobile' },
384
+ * { 'x-api-key': 'secret-key' },
385
+ * { userId: '123', email: 'user@example.com', name: 'John' }
386
+ * );
387
+ * ```
388
+ */
389
+ export declare class LuaWebhook {
390
+ private readonly name;
391
+ private readonly version;
392
+ private readonly description;
393
+ private readonly context;
394
+ private readonly querySchema?;
395
+ private readonly headerSchema?;
396
+ private readonly bodySchema?;
397
+ private readonly executeFunction;
398
+ /**
399
+ * Creates a new LuaWebhook instance.
400
+ *
401
+ * @param config - Configuration object containing webhook metadata
402
+ * @param config.name - Webhook name (optional, defaults to 'unnamed-webhook')
403
+ * @param config.version - Webhook version (optional, defaults to '1.0.0')
404
+ * @param config.description - Short description of what the webhook does (1-2 sentences)
405
+ * @param config.context - Detailed explanation of the webhook's purpose and behavior
406
+ * @param config.querySchema - Optional Zod schema for query parameter validation
407
+ * @param config.headerSchema - Optional Zod schema for header validation
408
+ * @param config.bodySchema - Optional Zod schema for body validation
409
+ * @param config.execute - Function that processes the webhook request
410
+ */
411
+ constructor(config: LuaWebhookConfig);
412
+ /**
413
+ * Gets the webhook name.
414
+ */
415
+ getName(): string;
416
+ /**
417
+ * Gets the webhook version.
418
+ */
419
+ getVersion(): string;
420
+ /**
421
+ * Gets the webhook description.
422
+ */
423
+ getDescription(): string;
424
+ /**
425
+ * Gets the webhook context.
426
+ */
427
+ getContext(): string;
428
+ /**
429
+ * Executes the webhook with validated input.
430
+ * Validates query parameters, headers, and body against their respective schemas
431
+ * before executing the webhook function.
432
+ *
433
+ * @param query - Query parameters object
434
+ * @param headers - Headers object
435
+ * @param body - Request body
436
+ * @returns Promise resolving to webhook execution result
437
+ * @throws Error if validation fails for any input
438
+ *
439
+ * @example
440
+ * ```typescript
441
+ * const result = await webhook.execute(
442
+ * { limit: '10' },
443
+ * { 'x-api-key': 'secret' },
444
+ * { data: 'value' }
445
+ * );
446
+ * ```
447
+ */
448
+ execute(query?: Record<string, any>, headers?: Record<string, any>, body?: any): Promise<any>;
449
+ }
450
+ /**
451
+ * PreProcessor configuration.
452
+ */
453
+ export interface PreProcessorConfig {
454
+ /** PreProcessor name (optional, defaults to 'unnamed-preprocessor') */
455
+ name?: string;
456
+ /** PreProcessor version (optional, defaults to '1.0.0') */
457
+ version?: string;
458
+ /** Short description of the preprocessor */
459
+ description: string;
460
+ /** Detailed context for what this preprocessor does */
461
+ context: string;
462
+ /**
463
+ * Async flag - indicates if processor should run in background on server:
464
+ * - true: Run asynchronously (non-blocking, for slow operations like API calls)
465
+ * - false: Run synchronously (blocking, for fast operations like text filtering)
466
+ * Default: false (synchronous)
467
+ */
468
+ async?: boolean;
469
+ /**
470
+ * Function that processes messages before sending to agent.
471
+ * MUST return ChatMessage[] - array of text, image, or file messages.
472
+ */
473
+ execute: (user: UserDataInstance, messages: import("../interfaces/chat.js").ChatMessage[], channel: string) => Promise<import("../interfaces/chat.js").ChatMessage[]>;
474
+ }
475
+ /**
476
+ * PreProcessor class.
477
+ * Processes user messages before they reach the agent.
478
+ * Can handle rich content (text, images, files).
479
+ *
480
+ * @example
481
+ * ```typescript
482
+ * const contentFilter = new PreProcessor({
483
+ * name: 'content-filter',
484
+ * version: '1.0.0',
485
+ * description: 'Filters and processes message content',
486
+ * context: 'Filters spam, validates images, and adds context',
487
+ * execute: async (user, messages, channel) => {
488
+ * // Process each message
489
+ * return messages.map(msg => {
490
+ * if (msg.type === 'text') {
491
+ * // Filter spam from text
492
+ * const filtered = msg.text.replace(/spam/gi, '[filtered]');
493
+ * return { type: 'text', text: filtered };
494
+ * }
495
+ * if (msg.type === 'image') {
496
+ * // Could validate image, add watermark, etc.
497
+ * return msg;
498
+ * }
499
+ * return msg;
500
+ * });
501
+ * }
502
+ * });
503
+ * ```
504
+ */
505
+ export declare class PreProcessor {
506
+ private readonly name;
507
+ private readonly version;
508
+ private readonly description;
509
+ private readonly context;
510
+ private readonly asyncMode;
511
+ private readonly executeFunction;
512
+ constructor(config: PreProcessorConfig);
513
+ getName(): string;
514
+ getVersion(): string;
515
+ getDescription(): string;
516
+ getContext(): string;
517
+ getAsync(): boolean;
518
+ execute(user: UserDataInstance, messages: import("../interfaces/chat.js").ChatMessage[], channel: string): Promise<import("../interfaces/chat.js").ChatMessage[]>;
519
+ }
520
+ /**
521
+ * PostProcessor configuration.
522
+ */
523
+ export interface PostProcessorConfig {
524
+ /** PostProcessor name (optional, defaults to 'unnamed-postprocessor') */
525
+ name?: string;
526
+ /** PostProcessor version (optional, defaults to '1.0.0') */
527
+ version?: string;
528
+ /** Short description of the postprocessor */
529
+ description: string;
530
+ /** Detailed context for what this postprocessor does */
531
+ context: string;
532
+ /**
533
+ * Async flag - indicates if processor should run in background on server:
534
+ * - true: Run asynchronously (non-blocking, for slow operations like API calls, translations)
535
+ * - false: Run synchronously (blocking, for fast operations like text formatting)
536
+ * Default: false (synchronous)
537
+ */
538
+ async?: boolean;
539
+ /**
540
+ * Function that processes the agent's response before sending to user.
541
+ * MUST return string - the formatted response text.
542
+ */
543
+ execute: (user: UserDataInstance, message: string, response: string, channel: string) => Promise<string>;
544
+ }
545
+ /**
546
+ * PostProcessor class.
547
+ * Processes agent responses before they reach the user.
548
+ *
549
+ * @example
550
+ * ```typescript
551
+ * const responseFormatter = new PostProcessor({
552
+ * name: 'response-formatter',
553
+ * version: '1.0.0',
554
+ * description: 'Formats responses with branding',
555
+ * context: 'Adds company signature to all responses',
556
+ * execute: async (user, message, response, channel) => {
557
+ * return response + '\n\n---\nPowered by Acme Corp';
558
+ * }
559
+ * });
560
+ * ```
561
+ */
562
+ export declare class PostProcessor {
563
+ private readonly name;
564
+ private readonly version;
565
+ private readonly description;
566
+ private readonly context;
567
+ private readonly asyncMode;
568
+ private readonly executeFunction;
569
+ constructor(config: PostProcessorConfig);
570
+ getName(): string;
571
+ getVersion(): string;
572
+ getDescription(): string;
573
+ getContext(): string;
574
+ getAsync(): boolean;
575
+ execute(user: UserDataInstance, message: string, response: string, channel: string): Promise<string>;
576
+ }
577
+ /**
578
+ * LuaAgent configuration interface.
579
+ * Provides a simplified, unified way to configure an agent with all its components.
580
+ *
581
+ * This is the recommended approach for defining your agent. Instead of exporting
582
+ * individual skills, jobs, webhooks, etc., you export a single LuaAgent object
583
+ * that contains everything.
584
+ */
585
+ export interface LuaAgentConfig {
586
+ /** Agent name (used for identification) */
587
+ name: string;
588
+ /** Agent persona - defines the agent's behavior and personality */
589
+ persona: string;
590
+ /** Optional welcome message shown when users first interact */
591
+ welcomeMessage?: string;
592
+ /** Array of skills (each with tools) */
593
+ skills?: LuaSkill[];
594
+ /** Array of webhooks */
595
+ webhooks?: LuaWebhook[];
596
+ /** Array of scheduled jobs */
597
+ jobs?: LuaJob[];
598
+ /** Array of preprocessors (run before messages reach the agent) */
599
+ preProcessors?: PreProcessor[];
600
+ /** Array of postprocessors (run after agent generates responses) */
601
+ postProcessors?: PostProcessor[];
602
+ }
603
+ /**
604
+ * LuaAgent class.
605
+ * Unified agent configuration that consolidates skills, webhooks, jobs, and processors.
606
+ *
607
+ * This is the simplest way to define an agent. Instead of exporting multiple separate
608
+ * components, you create one LuaAgent that contains everything.
609
+ *
610
+ * @example
611
+ * ```typescript
612
+ * import { LuaAgent, LuaSkill, LuaJob, LuaWebhook } from 'lua-cli';
613
+ *
614
+ * // Define your skills, jobs, webhooks in separate files
615
+ * import { userSkill } from './skills/user-skill';
616
+ * import { healthCheckJob } from './jobs/health-check';
617
+ * import { webhookHandler } from './webhooks/handler';
618
+ *
619
+ * // Create a single agent configuration
620
+ * export const agent = new LuaAgent({
621
+ * name: 'my-assistant',
622
+ * persona: 'You are a helpful AI assistant that can manage users and products.',
623
+ * welcomeMessage: 'Hello! How can I help you today?',
624
+ * skills: [userSkill],
625
+ * jobs: [healthCheckJob],
626
+ * webhooks: [webhookHandler],
627
+ * preProcessors: [],
628
+ * postProcessors: []
629
+ * });
630
+ * ```
631
+ */
632
+ export declare class LuaAgent {
633
+ private readonly name;
634
+ private readonly persona;
635
+ private readonly welcomeMessage?;
636
+ private readonly skills;
637
+ private readonly webhooks;
638
+ private readonly jobs;
639
+ private readonly preProcessors;
640
+ private readonly postProcessors;
641
+ /**
642
+ * Creates a new LuaAgent instance.
643
+ *
644
+ * @param config - Agent configuration
645
+ * @param config.name - Agent name
646
+ * @param config.persona - Agent persona (behavior and personality)
647
+ * @param config.welcomeMessage - Optional welcome message
648
+ * @param config.skills - Optional array of skills
649
+ * @param config.webhooks - Optional array of webhooks
650
+ * @param config.jobs - Optional array of jobs
651
+ * @param config.preProcessors - Optional array of preprocessors
652
+ * @param config.postProcessors - Optional array of postprocessors
653
+ */
654
+ constructor(config: LuaAgentConfig);
655
+ getName(): string;
656
+ getPersona(): string;
657
+ getWelcomeMessage(): string | undefined;
658
+ getSkills(): LuaSkill[];
659
+ getWebhooks(): LuaWebhook[];
660
+ getJobs(): LuaJob[];
661
+ getPreProcessors(): PreProcessor[];
662
+ getPostProcessors(): PostProcessor[];
663
+ }