lua-cli 2.5.8 → 3.0.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. package/dist/api/job.api.service.d.ts +210 -0
  2. package/dist/api/job.api.service.js +200 -0
  3. package/dist/api/lazy-instances.d.ts +24 -0
  4. package/dist/api/lazy-instances.js +48 -0
  5. package/dist/api/postprocessor.api.service.d.ts +98 -0
  6. package/dist/api/postprocessor.api.service.js +76 -0
  7. package/dist/api/preprocessor.api.service.d.ts +98 -0
  8. package/dist/api/preprocessor.api.service.js +76 -0
  9. package/dist/api/user.data.api.service.d.ts +13 -0
  10. package/dist/api/user.data.api.service.js +20 -0
  11. package/dist/api/webhook.api.service.d.ts +151 -0
  12. package/dist/api/webhook.api.service.js +134 -0
  13. package/dist/api-exports.d.ts +156 -41
  14. package/dist/api-exports.js +182 -21
  15. package/dist/cli/command-definitions.js +75 -5
  16. package/dist/commands/compile.js +124 -5
  17. package/dist/commands/index.d.ts +4 -0
  18. package/dist/commands/index.js +4 -0
  19. package/dist/commands/init.js +53 -7
  20. package/dist/commands/jobs.d.ts +20 -0
  21. package/dist/commands/jobs.js +533 -0
  22. package/dist/commands/logs.js +2 -5
  23. package/dist/commands/postprocessors.d.ts +8 -0
  24. package/dist/commands/postprocessors.js +431 -0
  25. package/dist/commands/preprocessors.d.ts +8 -0
  26. package/dist/commands/preprocessors.js +431 -0
  27. package/dist/commands/push.js +684 -5
  28. package/dist/commands/test.d.ts +9 -18
  29. package/dist/commands/test.js +558 -82
  30. package/dist/commands/webhooks.d.ts +18 -0
  31. package/dist/commands/webhooks.js +424 -0
  32. package/dist/common/job.instance.d.ts +77 -0
  33. package/dist/common/job.instance.js +108 -0
  34. package/dist/common/user.instance.d.ts +1 -0
  35. package/dist/common/user.instance.js +9 -0
  36. package/dist/config/constants.d.ts +2 -2
  37. package/dist/config/constants.js +4 -4
  38. package/dist/interfaces/agent.d.ts +2 -1
  39. package/dist/interfaces/chat.d.ts +22 -0
  40. package/dist/interfaces/index.d.ts +10 -0
  41. package/dist/interfaces/index.js +7 -0
  42. package/dist/interfaces/jobs.d.ts +172 -0
  43. package/dist/interfaces/jobs.js +5 -0
  44. package/dist/interfaces/postprocessors.d.ts +35 -0
  45. package/dist/interfaces/postprocessors.js +4 -0
  46. package/dist/interfaces/preprocessors.d.ts +35 -0
  47. package/dist/interfaces/preprocessors.js +4 -0
  48. package/dist/interfaces/webhooks.d.ts +104 -0
  49. package/dist/interfaces/webhooks.js +5 -0
  50. package/dist/types/api-contracts.d.ts +5 -0
  51. package/dist/types/compile.types.d.ts +49 -0
  52. package/dist/types/index.d.ts +1 -1
  53. package/dist/types/index.js +1 -1
  54. package/dist/types/skill.d.ts +502 -0
  55. package/dist/types/skill.js +477 -0
  56. package/dist/utils/agent-management.d.ts +25 -0
  57. package/dist/utils/agent-management.js +67 -0
  58. package/dist/utils/bundling.d.ts +31 -1
  59. package/dist/utils/bundling.js +653 -10
  60. package/dist/utils/compile.d.ts +63 -0
  61. package/dist/utils/compile.js +691 -36
  62. package/dist/utils/deployment.d.ts +2 -1
  63. package/dist/utils/deployment.js +16 -2
  64. package/dist/utils/init-agent.d.ts +3 -1
  65. package/dist/utils/init-agent.js +6 -4
  66. package/dist/utils/init-prompts.d.ts +2 -1
  67. package/dist/utils/init-prompts.js +14 -9
  68. package/dist/utils/job-management.d.ts +24 -0
  69. package/dist/utils/job-management.js +264 -0
  70. package/dist/utils/postprocessor-management.d.ts +9 -0
  71. package/dist/utils/postprocessor-management.js +118 -0
  72. package/dist/utils/preprocessor-management.d.ts +9 -0
  73. package/dist/utils/preprocessor-management.js +118 -0
  74. package/dist/utils/sandbox.d.ts +61 -1
  75. package/dist/utils/sandbox.js +283 -72
  76. package/dist/utils/tool-detection.d.ts +3 -2
  77. package/dist/utils/tool-detection.js +18 -4
  78. package/dist/utils/webhook-management.d.ts +24 -0
  79. package/dist/utils/webhook-management.js +256 -0
  80. package/package.json +1 -1
  81. package/template/AGENT_CONFIGURATION.md +251 -0
  82. package/template/COMPLEX_JOB_EXAMPLES.md +795 -0
  83. package/template/DYNAMIC_JOB_CREATION.md +371 -0
  84. package/template/README.md +30 -2
  85. package/template/WEBHOOKS_JOBS_QUICKSTART.md +318 -0
  86. package/template/WEBHOOK_JOB_EXAMPLES.md +817 -0
  87. package/template/src/index-agent-example.ts +201 -0
  88. package/template/src/index.ts +39 -0
  89. package/template/src/jobs/AbandonedBasketProcessorJob.ts +139 -0
  90. package/template/src/jobs/DailyCleanupJob.ts +100 -0
  91. package/template/src/jobs/DataMigrationJob.ts +133 -0
  92. package/template/src/jobs/HealthCheckJob.ts +87 -0
  93. package/template/src/postprocessors/ResponseFormatter.ts +151 -0
  94. package/template/src/preprocessors/MessageFilter.ts +91 -0
  95. package/template/src/tools/GameScoreTrackerTool.ts +356 -0
  96. package/template/src/tools/SmartBasketTool.ts +188 -0
  97. package/template/src/webhooks/PaymentWebhook.ts +113 -0
  98. package/template/src/webhooks/UserEventWebhook.ts +77 -0
@@ -27,6 +27,7 @@ export interface ChatRequest {
27
27
  navigate: boolean;
28
28
  skillOverride: SkillOverride[];
29
29
  personaOverride?: string;
30
+ runtimeContext?: string;
30
31
  }
31
32
  /**
32
33
  * Chat response from API.
@@ -59,3 +60,24 @@ export interface DetailedChatResponse {
59
60
  steps: any[];
60
61
  sources: any[];
61
62
  }
63
+ /**
64
+ * Chat history message content item
65
+ */
66
+ export interface ChatHistoryContent {
67
+ type: 'text' | 'image' | 'file';
68
+ text?: string;
69
+ url?: string;
70
+ filename?: string;
71
+ }
72
+ /**
73
+ * Chat history message from conversation
74
+ */
75
+ export interface ChatHistoryMessage {
76
+ role: 'user' | 'assistant';
77
+ id: string;
78
+ createdAt: string;
79
+ resourceId: string;
80
+ threadId: string;
81
+ type: string;
82
+ content: ChatHistoryContent[];
83
+ }
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Interfaces Module - Barrel Export
3
+ *
4
+ * This file serves as the main entry point for all interface definitions.
5
+ * It re-exports interfaces and DTOs from various modules for convenient importing.
6
+ */
7
+ export { CreateWebhookDTO, PushWebhookVersionDTO, UpdateWebhookVersionDTO, WebhookVersion, Webhook, GetWebhooksResponse, DeleteWebhookResponse, CreateWebhookResponse, PushWebhookVersionResponse, } from './webhooks.js';
8
+ export { CreateJobDTO, PushJobVersionDTO, UpdateJobVersionDTO, JobSchedule, JobScheduleType, JobRetryConfig, JobVersion, JobExecutionStatus, JobExecution, JobStatus, Job, GetJobsResponse, DeleteJobResponse, CreateJobResponse, PushJobVersionResponse, JobExecutionResponse, GetJobExecutionsResponse, } from './jobs.js';
9
+ export { ApiResponse, Pagination, } from './common.js';
10
+ export { SkillTool, SkillVersion, Skill, GetSkillsResponse, DeleteSkillResponse, } from './skills.js';
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Interfaces Module - Barrel Export
3
+ *
4
+ * This file serves as the main entry point for all interface definitions.
5
+ * It re-exports interfaces and DTOs from various modules for convenient importing.
6
+ */
7
+ export {};
@@ -0,0 +1,172 @@
1
+ /**
2
+ * Jobs Interfaces
3
+ * Structures for job management
4
+ */
5
+ /**
6
+ * DTO for creating a new job
7
+ */
8
+ export interface CreateJobDTO {
9
+ name: string;
10
+ description?: string;
11
+ context?: string;
12
+ schedule: JobSchedule;
13
+ timeout?: number;
14
+ retry?: JobRetryConfig;
15
+ metadata?: Record<string, any>;
16
+ }
17
+ /**
18
+ * DTO for pushing a job version
19
+ */
20
+ export interface PushJobVersionDTO {
21
+ name: string;
22
+ version: string;
23
+ description?: string;
24
+ context?: string;
25
+ jobId: string;
26
+ schedule: JobSchedule;
27
+ timeout?: number;
28
+ retry?: JobRetryConfig;
29
+ code?: string;
30
+ executeFunction?: string;
31
+ metadata?: Record<string, any>;
32
+ }
33
+ /**
34
+ * DTO for updating a job version
35
+ */
36
+ export interface UpdateJobVersionDTO {
37
+ version?: string;
38
+ description?: string;
39
+ context?: string;
40
+ schedule?: JobSchedule;
41
+ timeout?: number;
42
+ retry?: JobRetryConfig;
43
+ code?: string;
44
+ executeFunction?: string;
45
+ metadata?: Record<string, any>;
46
+ }
47
+ /**
48
+ * Job schedule configuration
49
+ */
50
+ export type JobScheduleType = 'cron' | 'once' | 'interval';
51
+ export interface JobSchedule {
52
+ type: JobScheduleType;
53
+ expression?: string;
54
+ executeAt?: string;
55
+ seconds?: number;
56
+ timezone?: string;
57
+ }
58
+ /**
59
+ * Job retry configuration
60
+ */
61
+ export interface JobRetryConfig {
62
+ maxAttempts: number;
63
+ backoffSeconds?: number;
64
+ }
65
+ /**
66
+ * Job version information
67
+ */
68
+ export interface JobVersion {
69
+ id: string;
70
+ version: string;
71
+ description: string;
72
+ active: boolean;
73
+ context: string;
74
+ schedule: JobSchedule;
75
+ timeout?: number;
76
+ retry?: JobRetryConfig;
77
+ createdAt: string;
78
+ updatedAt: string;
79
+ }
80
+ /**
81
+ * Job execution status
82
+ */
83
+ export type JobExecutionStatus = 'pending' | 'running' | 'completed' | 'failed' | 'timeout';
84
+ /**
85
+ * Job execution record
86
+ */
87
+ export interface JobExecution {
88
+ id: string;
89
+ jobId: string;
90
+ versionId: string;
91
+ status: JobExecutionStatus;
92
+ startedAt: string;
93
+ completedAt?: string;
94
+ duration?: number;
95
+ result?: any;
96
+ error?: string;
97
+ retryCount?: number;
98
+ }
99
+ /**
100
+ * Job status
101
+ */
102
+ export type JobStatus = 'active' | 'paused' | 'failed' | 'inactive';
103
+ /**
104
+ * Job information
105
+ */
106
+ export interface Job {
107
+ id: string;
108
+ name: string;
109
+ description: string;
110
+ public: boolean;
111
+ active: boolean;
112
+ status: JobStatus;
113
+ createdAt: string;
114
+ updatedAt: string;
115
+ versions: JobVersion[];
116
+ activeVersionId?: string;
117
+ lastRunAt?: string;
118
+ nextRunAt?: string;
119
+ lastExecution?: JobExecution;
120
+ }
121
+ /**
122
+ * Response from get all jobs API endpoint
123
+ */
124
+ export interface GetJobsResponse {
125
+ jobs: Job[];
126
+ }
127
+ /**
128
+ * Response from delete job API endpoint
129
+ * If deleted is false and deactivated is true, the job has versions
130
+ * and cannot be deleted, so it was deactivated instead
131
+ */
132
+ export interface DeleteJobResponse {
133
+ message: string;
134
+ deleted: boolean;
135
+ deactivated: boolean;
136
+ }
137
+ /**
138
+ * Response from create job API endpoint
139
+ */
140
+ export interface CreateJobResponse {
141
+ id: string;
142
+ name: string;
143
+ description?: string;
144
+ agentId: string;
145
+ context?: string;
146
+ schedule: JobSchedule;
147
+ }
148
+ /**
149
+ * Response from push job version API endpoint
150
+ */
151
+ export interface PushJobVersionResponse {
152
+ versionId: string;
153
+ jobId: string;
154
+ version: string;
155
+ createdAt: string;
156
+ schedule: JobSchedule;
157
+ }
158
+ /**
159
+ * Response from job execution APIs
160
+ */
161
+ export interface JobExecutionResponse {
162
+ execution: JobExecution;
163
+ }
164
+ /**
165
+ * Response from get job executions API
166
+ */
167
+ export interface GetJobExecutionsResponse {
168
+ executions: JobExecution[];
169
+ total: number;
170
+ page?: number;
171
+ limit?: number;
172
+ }
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Jobs Interfaces
3
+ * Structures for job management
4
+ */
5
+ export {};
@@ -0,0 +1,35 @@
1
+ /**
2
+ * PostProcessor Interfaces
3
+ */
4
+ /**
5
+ * DTO for creating a new postprocessor
6
+ */
7
+ export interface CreatePostProcessorDTO {
8
+ name: string;
9
+ description?: string;
10
+ context?: string;
11
+ }
12
+ /**
13
+ * DTO for pushing a postprocessor version
14
+ */
15
+ export interface PushPostProcessorVersionDTO {
16
+ name: string;
17
+ version: string;
18
+ description?: string;
19
+ context?: string;
20
+ postprocessorId: string;
21
+ code?: string;
22
+ executeFunction?: string;
23
+ }
24
+ /**
25
+ * PostProcessor version information
26
+ */
27
+ export interface PostProcessorVersion {
28
+ id: string;
29
+ version: string;
30
+ description: string;
31
+ active: boolean;
32
+ context: string;
33
+ createdAt: string;
34
+ updatedAt: string;
35
+ }
@@ -0,0 +1,4 @@
1
+ /**
2
+ * PostProcessor Interfaces
3
+ */
4
+ export {};
@@ -0,0 +1,35 @@
1
+ /**
2
+ * PreProcessor Interfaces
3
+ */
4
+ /**
5
+ * DTO for creating a new preprocessor
6
+ */
7
+ export interface CreatePreProcessorDTO {
8
+ name: string;
9
+ description?: string;
10
+ context?: string;
11
+ }
12
+ /**
13
+ * DTO for pushing a preprocessor version
14
+ */
15
+ export interface PushPreProcessorVersionDTO {
16
+ name: string;
17
+ version: string;
18
+ description?: string;
19
+ context?: string;
20
+ preprocessorId: string;
21
+ code?: string;
22
+ executeFunction?: string;
23
+ }
24
+ /**
25
+ * PreProcessor version information
26
+ */
27
+ export interface PreProcessorVersion {
28
+ id: string;
29
+ version: string;
30
+ description: string;
31
+ active: boolean;
32
+ context: string;
33
+ createdAt: string;
34
+ updatedAt: string;
35
+ }
@@ -0,0 +1,4 @@
1
+ /**
2
+ * PreProcessor Interfaces
3
+ */
4
+ export {};
@@ -0,0 +1,104 @@
1
+ /**
2
+ * Webhooks Interfaces
3
+ * Structures for webhook management
4
+ */
5
+ /**
6
+ * DTO for creating a new webhook
7
+ */
8
+ export interface CreateWebhookDTO {
9
+ name: string;
10
+ description?: string;
11
+ context?: string;
12
+ }
13
+ /**
14
+ * DTO for pushing a webhook version
15
+ */
16
+ export interface PushWebhookVersionDTO {
17
+ name: string;
18
+ version: string;
19
+ description?: string;
20
+ context?: string;
21
+ webhookId: string;
22
+ querySchema?: any;
23
+ headerSchema?: any;
24
+ bodySchema?: any;
25
+ code?: string;
26
+ executeFunction?: string;
27
+ }
28
+ /**
29
+ * DTO for updating a webhook version
30
+ */
31
+ export interface UpdateWebhookVersionDTO {
32
+ version?: string;
33
+ description?: string;
34
+ context?: string;
35
+ querySchema?: any;
36
+ headerSchema?: any;
37
+ bodySchema?: any;
38
+ code?: string;
39
+ executeFunction?: string;
40
+ }
41
+ /**
42
+ * Webhook version information
43
+ */
44
+ export interface WebhookVersion {
45
+ id: string;
46
+ version: string;
47
+ description: string;
48
+ active: boolean;
49
+ context: string;
50
+ querySchema?: any;
51
+ headerSchema?: any;
52
+ bodySchema?: any;
53
+ createdAt: string;
54
+ updatedAt: string;
55
+ }
56
+ /**
57
+ * Webhook information
58
+ */
59
+ export interface Webhook {
60
+ id: string;
61
+ name: string;
62
+ description: string;
63
+ public: boolean;
64
+ active: boolean;
65
+ createdAt: string;
66
+ updatedAt: string;
67
+ versions: WebhookVersion[];
68
+ activeVersionId?: string;
69
+ }
70
+ /**
71
+ * Response from get all webhooks API endpoint
72
+ */
73
+ export interface GetWebhooksResponse {
74
+ webhooks: Webhook[];
75
+ }
76
+ /**
77
+ * Response from delete webhook API endpoint
78
+ * If deleted is false and deactivated is true, the webhook has versions
79
+ * and cannot be deleted, so it was deactivated instead
80
+ */
81
+ export interface DeleteWebhookResponse {
82
+ message: string;
83
+ deleted: boolean;
84
+ deactivated: boolean;
85
+ }
86
+ /**
87
+ * Response from create webhook API endpoint
88
+ */
89
+ export interface CreateWebhookResponse {
90
+ id: string;
91
+ name: string;
92
+ description?: string;
93
+ agentId: string;
94
+ context?: string;
95
+ }
96
+ /**
97
+ * Response from push webhook version API endpoint
98
+ */
99
+ export interface PushWebhookVersionResponse {
100
+ versionId: string;
101
+ webhookId: string;
102
+ version: string;
103
+ createdAt: string;
104
+ }
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Webhooks Interfaces
3
+ * Structures for webhook management
4
+ */
5
+ export {};
@@ -35,6 +35,11 @@ export interface UserDataAPI {
35
35
  * @throws Error if the message sending fails or the request is unsuccessful
36
36
  */
37
37
  sendMessage(messages: Message[]): Promise<any>;
38
+ /**
39
+ * Gets chat history.
40
+ * @returns Promise resolving to chat history
41
+ */
42
+ getChatHistory(): Promise<any>;
38
43
  }
39
44
  /**
40
45
  * Product API contract.
@@ -20,6 +20,30 @@ export interface SkillMetadata {
20
20
  context: string;
21
21
  constructorTools: string[];
22
22
  }
23
+ /**
24
+ * Webhook metadata extracted from source code
25
+ */
26
+ export interface WebhookMetadata {
27
+ name: string;
28
+ version: string;
29
+ description: string;
30
+ context: string;
31
+ }
32
+ /**
33
+ * Job metadata extracted from source code
34
+ */
35
+ export interface JobMetadata {
36
+ name: string;
37
+ version: string;
38
+ description: string;
39
+ context: string;
40
+ schedule: any;
41
+ timeout?: number;
42
+ retry?: {
43
+ maxAttempts: number;
44
+ backoffSeconds?: number;
45
+ };
46
+ }
23
47
  /**
24
48
  * Configuration from lua.skill.yaml
25
49
  */
@@ -30,15 +54,40 @@ export interface SkillConfig {
30
54
  skillId?: string;
31
55
  description?: string;
32
56
  context?: string;
57
+ env?: Record<string, string>;
33
58
  };
34
59
  agent?: {
35
60
  agentId?: string;
61
+ orgId?: string;
62
+ persona?: string;
63
+ welcomeMessage?: string;
36
64
  };
37
65
  skills?: Array<{
38
66
  name: string;
39
67
  version: string;
40
68
  skillId: string;
41
69
  }>;
70
+ webhooks?: Array<{
71
+ name: string;
72
+ version: string;
73
+ webhookId: string;
74
+ }>;
75
+ jobs?: Array<{
76
+ name: string;
77
+ version: string;
78
+ jobId: string;
79
+ schedule?: any;
80
+ }>;
81
+ preprocessors?: Array<{
82
+ name: string;
83
+ version: string;
84
+ preprocessorId: string;
85
+ }>;
86
+ postprocessors?: Array<{
87
+ name: string;
88
+ version: string;
89
+ postprocessorId: string;
90
+ }>;
42
91
  }
43
92
  /**
44
93
  * Deployment data format for new deployment system
@@ -14,7 +14,7 @@
14
14
  * import { validateToolName } from './types/tool-validation.js';
15
15
  * ```
16
16
  */
17
- export { LuaSkill, LuaTool, LuaSkillConfig, env } from './skill.js';
17
+ export { LuaSkill, LuaTool, LuaSkillConfig, LuaWebhook, LuaWebhookConfig, LuaJob, LuaJobConfig, JobSchedule, env } from './skill.js';
18
18
  export { validateToolName, assertValidToolName } from './tool-validation.js';
19
19
  export { UserDataAPI, ProductAPI, BasketAPI, OrderAPI, CustomDataAPI } from './api-contracts.js';
20
20
  export { UserData, EmailAddress, Country, Admin, Organization, AgentAuth, OTPResponse, ApiKeyResponse } from '../interfaces/admin.js';
@@ -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