lua-cli 2.5.8 → 3.0.0-alpha.4

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 (115) hide show
  1. package/dist/api/job.api.service.d.ts +219 -0
  2. package/dist/api/job.api.service.js +216 -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 +158 -0
  6. package/dist/api/postprocessor.api.service.js +111 -0
  7. package/dist/api/preprocessor.api.service.d.ts +158 -0
  8. package/dist/api/preprocessor.api.service.js +111 -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 +176 -41
  14. package/dist/api-exports.js +195 -21
  15. package/dist/cli/command-definitions.js +75 -5
  16. package/dist/commands/chat.js +32 -5
  17. package/dist/commands/compile.js +140 -7
  18. package/dist/commands/dev.js +23 -2
  19. package/dist/commands/index.d.ts +4 -0
  20. package/dist/commands/index.js +4 -0
  21. package/dist/commands/init.js +53 -7
  22. package/dist/commands/jobs.d.ts +20 -0
  23. package/dist/commands/jobs.js +533 -0
  24. package/dist/commands/logs.js +2 -5
  25. package/dist/commands/postprocessors.d.ts +8 -0
  26. package/dist/commands/postprocessors.js +431 -0
  27. package/dist/commands/preprocessors.d.ts +8 -0
  28. package/dist/commands/preprocessors.js +431 -0
  29. package/dist/commands/push.js +686 -5
  30. package/dist/commands/test.d.ts +9 -18
  31. package/dist/commands/test.js +574 -82
  32. package/dist/commands/webhooks.d.ts +18 -0
  33. package/dist/commands/webhooks.js +424 -0
  34. package/dist/common/job.instance.d.ts +80 -0
  35. package/dist/common/job.instance.js +116 -0
  36. package/dist/common/user.instance.d.ts +1 -0
  37. package/dist/common/user.instance.js +9 -0
  38. package/dist/config/constants.d.ts +4 -3
  39. package/dist/config/constants.js +10 -8
  40. package/dist/interfaces/agent.d.ts +2 -1
  41. package/dist/interfaces/chat.d.ts +52 -1
  42. package/dist/interfaces/index.d.ts +10 -0
  43. package/dist/interfaces/index.js +7 -0
  44. package/dist/interfaces/jobs.d.ts +193 -0
  45. package/dist/interfaces/jobs.js +5 -0
  46. package/dist/interfaces/postprocessors.d.ts +35 -0
  47. package/dist/interfaces/postprocessors.js +4 -0
  48. package/dist/interfaces/preprocessors.d.ts +35 -0
  49. package/dist/interfaces/preprocessors.js +4 -0
  50. package/dist/interfaces/webhooks.d.ts +104 -0
  51. package/dist/interfaces/webhooks.js +5 -0
  52. package/dist/types/api-contracts.d.ts +5 -0
  53. package/dist/types/compile.types.d.ts +49 -0
  54. package/dist/types/index.d.ts +1 -1
  55. package/dist/types/index.js +1 -1
  56. package/dist/types/skill.d.ts +521 -0
  57. package/dist/types/skill.js +471 -0
  58. package/dist/utils/agent-management.d.ts +25 -0
  59. package/dist/utils/agent-management.js +67 -0
  60. package/dist/utils/bundling.d.ts +44 -5
  61. package/dist/utils/bundling.js +723 -23
  62. package/dist/utils/compile.d.ts +63 -0
  63. package/dist/utils/compile.js +712 -36
  64. package/dist/utils/deployment.d.ts +2 -1
  65. package/dist/utils/deployment.js +16 -2
  66. package/dist/utils/dev-api.d.ts +42 -2
  67. package/dist/utils/dev-api.js +177 -4
  68. package/dist/utils/dev-server.d.ts +1 -1
  69. package/dist/utils/dev-server.js +4 -4
  70. package/dist/utils/dynamic-job-bundler.d.ts +17 -0
  71. package/dist/utils/dynamic-job-bundler.js +143 -0
  72. package/dist/utils/init-agent.d.ts +3 -1
  73. package/dist/utils/init-agent.js +6 -4
  74. package/dist/utils/init-prompts.d.ts +2 -1
  75. package/dist/utils/init-prompts.js +14 -9
  76. package/dist/utils/job-management.d.ts +24 -0
  77. package/dist/utils/job-management.js +264 -0
  78. package/dist/utils/postprocessor-management.d.ts +9 -0
  79. package/dist/utils/postprocessor-management.js +118 -0
  80. package/dist/utils/pre-bundle-jobs.d.ts +26 -0
  81. package/dist/utils/pre-bundle-jobs.js +176 -0
  82. package/dist/utils/preprocessor-management.d.ts +9 -0
  83. package/dist/utils/preprocessor-management.js +118 -0
  84. package/dist/utils/sandbox-storage.d.ts +48 -0
  85. package/dist/utils/sandbox-storage.js +114 -0
  86. package/dist/utils/sandbox.d.ts +61 -1
  87. package/dist/utils/sandbox.js +299 -72
  88. package/dist/utils/tool-detection.d.ts +3 -2
  89. package/dist/utils/tool-detection.js +18 -4
  90. package/dist/utils/webhook-management.d.ts +24 -0
  91. package/dist/utils/webhook-management.js +256 -0
  92. package/package.json +1 -1
  93. package/template/README.md +30 -2
  94. package/template/lua.skill.yaml +47 -0
  95. package/template/package-lock.json +10505 -0
  96. package/template/package.json +2 -1
  97. package/template/src/index.ts +103 -2
  98. package/template/src/jobs/AbandonedBasketProcessorJob.ts +139 -0
  99. package/template/src/jobs/DailyCleanupJob.ts +100 -0
  100. package/template/src/jobs/DataMigrationJob.ts +133 -0
  101. package/template/src/jobs/HealthCheckJob.ts +87 -0
  102. package/template/src/tools/CreateInlineJob.ts +42 -0
  103. package/template/src/tools/GameScoreTrackerTool.ts +356 -0
  104. package/template/src/tools/SmartBasketTool.ts +188 -0
  105. package/template/src/webhooks/PaymentWebhook.ts +113 -0
  106. package/template/src/webhooks/UserEventWebhook.ts +77 -0
  107. package/API_REFERENCE.md +0 -1408
  108. package/CHANGELOG.md +0 -236
  109. package/CLI_REFERENCE.md +0 -908
  110. package/GETTING_STARTED.md +0 -1040
  111. package/INSTANCE_TYPES.md +0 -1158
  112. package/README.md +0 -865
  113. package/TEMPLATE_GUIDE.md +0 -1398
  114. package/USER_DATA_INSTANCE.md +0 -621
  115. package/template/TOOL_EXAMPLES.md +0 -655
@@ -0,0 +1,151 @@
1
+ import { HttpClient } from "../common/http.client.js";
2
+ import { ApiResponse } from "../interfaces/common.js";
3
+ import { CreateWebhookDTO, PushWebhookVersionDTO, UpdateWebhookVersionDTO } from "../interfaces/webhooks.js";
4
+ /**
5
+ * Webhook API Response Types
6
+ */
7
+ export interface WebhookVersion {
8
+ version: string;
9
+ webhookId: string;
10
+ createdAt: string | number;
11
+ isActive?: boolean;
12
+ }
13
+ export interface GetWebhooksResponse {
14
+ webhooks: Array<{
15
+ id: string;
16
+ name: string;
17
+ description?: string;
18
+ context?: string;
19
+ versions: WebhookVersion[];
20
+ activeVersionId?: string;
21
+ }>;
22
+ }
23
+ export interface CreateWebhookResponse {
24
+ id: string;
25
+ name: string;
26
+ description?: string;
27
+ agentId: string;
28
+ context?: string;
29
+ }
30
+ export interface WebhookVersionResponse {
31
+ versionId: string;
32
+ webhookId: string;
33
+ version: string;
34
+ createdAt: string;
35
+ }
36
+ export interface UpdateWebhookVersionResponse {
37
+ versionId: string;
38
+ webhookId: string;
39
+ version: string;
40
+ updatedAt: string;
41
+ }
42
+ export interface DeleteWebhookResponse {
43
+ deleted: boolean;
44
+ deactivated?: boolean;
45
+ message: string;
46
+ }
47
+ /**
48
+ * Webhook API Service
49
+ * Handles all webhook-related API calls
50
+ */
51
+ export default class WebhookApi extends HttpClient {
52
+ private apiKey;
53
+ private agentId;
54
+ /**
55
+ * Creates an instance of WebhookApi
56
+ * @param baseUrl - The base URL for the API
57
+ * @param apiKey - The API key for authentication
58
+ * @param agentId - The unique identifier of the agent
59
+ */
60
+ constructor(baseUrl: string, apiKey: string, agentId: string);
61
+ /**
62
+ * Retrieves all webhooks for the agent
63
+ * @returns Promise resolving to an ApiResponse containing an array of webhooks with their versions
64
+ * @throws Error if the API request fails or the agent is not found
65
+ */
66
+ getWebhooks(): Promise<ApiResponse<GetWebhooksResponse>>;
67
+ /**
68
+ * Creates a new webhook for the agent
69
+ * @param webhookData - The webhook data including name, description, and optional context
70
+ * @returns Promise resolving to an ApiResponse containing the created webhook details
71
+ * @throws Error if the webhook creation fails or validation errors occur
72
+ */
73
+ createWebhook(webhookData: CreateWebhookDTO): Promise<ApiResponse<CreateWebhookResponse>>;
74
+ /**
75
+ * Pushes a new version of a webhook to production
76
+ * @param webhookId - The unique identifier of the webhook
77
+ * @param versionData - The version data including code, configuration, and metadata
78
+ * @returns Promise resolving to an ApiResponse containing the created version details
79
+ * @throws Error if the webhook is not found or the push operation fails
80
+ */
81
+ pushWebhook(webhookId: string, versionData: PushWebhookVersionDTO): Promise<ApiResponse<WebhookVersionResponse>>;
82
+ /**
83
+ * Pushes a new development/sandbox version of a webhook for testing
84
+ * @param webhookId - The unique identifier of the webhook
85
+ * @param versionData - The version data including code, configuration, and metadata
86
+ * @returns Promise resolving to an ApiResponse containing the development version details
87
+ * @throws Error if the webhook is not found or the push operation fails
88
+ */
89
+ pushDevWebhook(webhookId: string, versionData: PushWebhookVersionDTO): Promise<ApiResponse<WebhookVersionResponse>>;
90
+ /**
91
+ * Updates an existing development/sandbox version of a webhook
92
+ * @param webhookId - The unique identifier of the webhook
93
+ * @param sandboxVersionId - The unique identifier of the sandbox version to update
94
+ * @param versionData - The updated version data including code, configuration, and metadata
95
+ * @returns Promise resolving to an ApiResponse containing the updated version details
96
+ * @throws Error if the webhook or version is not found or the update fails
97
+ */
98
+ updateDevWebhook(webhookId: string, sandboxVersionId: string, versionData: UpdateWebhookVersionDTO): Promise<ApiResponse<UpdateWebhookVersionResponse>>;
99
+ /**
100
+ * Retrieves all versions of a specific webhook
101
+ * @param webhookId - The unique identifier of the webhook
102
+ * @returns Promise resolving to an ApiResponse containing an array of webhook versions
103
+ * @throws Error if the webhook is not found or the request fails
104
+ */
105
+ getWebhookVersions(webhookId: string): Promise<ApiResponse<{
106
+ versions: WebhookVersion[];
107
+ activeVersionId?: string;
108
+ }>>;
109
+ /**
110
+ * Publishes a specific version of a webhook to production
111
+ * @param webhookId - The unique identifier of the webhook
112
+ * @param version - The version identifier to publish
113
+ * @returns Promise resolving to an ApiResponse containing publication confirmation details
114
+ * @throws Error if the webhook or version is not found or the publish operation fails
115
+ */
116
+ publishWebhookVersion(webhookId: string, version: string): Promise<ApiResponse<{
117
+ message: string;
118
+ webhookId: string;
119
+ activeVersionId: string;
120
+ publishedAt: string;
121
+ }>>;
122
+ /**
123
+ * Activates a webhook (enables it to receive requests)
124
+ * @param webhookId - The unique identifier of the webhook to activate
125
+ * @returns Promise resolving to an ApiResponse with activation status
126
+ * @throws Error if the webhook is not found or the operation fails
127
+ */
128
+ activateWebhook(webhookId: string): Promise<ApiResponse<{
129
+ message: string;
130
+ active: boolean;
131
+ }>>;
132
+ /**
133
+ * Deactivates a webhook (stops it from receiving requests)
134
+ * @param webhookId - The unique identifier of the webhook to deactivate
135
+ * @returns Promise resolving to an ApiResponse with deactivation status
136
+ * @throws Error if the webhook is not found or the operation fails
137
+ */
138
+ deactivateWebhook(webhookId: string): Promise<ApiResponse<{
139
+ message: string;
140
+ active: boolean;
141
+ }>>;
142
+ /**
143
+ * Deletes a webhook and all its versions, or deactivates it if it has versions
144
+ * @param webhookId - The unique identifier of the webhook to delete
145
+ * @returns Promise resolving to an ApiResponse with deletion status
146
+ * - If deleted is true: webhook was successfully deleted
147
+ * - If deleted is false and deactivated is true: webhook has versions and was deactivated instead
148
+ * @throws Error if the webhook is not found or the delete operation fails
149
+ */
150
+ deleteWebhook(webhookId: string): Promise<ApiResponse<DeleteWebhookResponse>>;
151
+ }
@@ -0,0 +1,134 @@
1
+ import { HttpClient } from "../common/http.client.js";
2
+ /**
3
+ * Webhook API Service
4
+ * Handles all webhook-related API calls
5
+ */
6
+ export default class WebhookApi extends HttpClient {
7
+ /**
8
+ * Creates an instance of WebhookApi
9
+ * @param baseUrl - The base URL for the API
10
+ * @param apiKey - The API key for authentication
11
+ * @param agentId - The unique identifier of the agent
12
+ */
13
+ constructor(baseUrl, apiKey, agentId) {
14
+ super(baseUrl);
15
+ this.apiKey = apiKey;
16
+ this.agentId = agentId;
17
+ }
18
+ /**
19
+ * Retrieves all webhooks for the agent
20
+ * @returns Promise resolving to an ApiResponse containing an array of webhooks with their versions
21
+ * @throws Error if the API request fails or the agent is not found
22
+ */
23
+ async getWebhooks() {
24
+ return this.httpGet(`/developer/webhooks/${this.agentId}`, {
25
+ Authorization: `Bearer ${this.apiKey}`,
26
+ });
27
+ }
28
+ /**
29
+ * Creates a new webhook for the agent
30
+ * @param webhookData - The webhook data including name, description, and optional context
31
+ * @returns Promise resolving to an ApiResponse containing the created webhook details
32
+ * @throws Error if the webhook creation fails or validation errors occur
33
+ */
34
+ async createWebhook(webhookData) {
35
+ return this.httpPost(`/developer/webhooks/${this.agentId}`, webhookData, {
36
+ Authorization: `Bearer ${this.apiKey}`,
37
+ });
38
+ }
39
+ /**
40
+ * Pushes a new version of a webhook to production
41
+ * @param webhookId - The unique identifier of the webhook
42
+ * @param versionData - The version data including code, configuration, and metadata
43
+ * @returns Promise resolving to an ApiResponse containing the created version details
44
+ * @throws Error if the webhook is not found or the push operation fails
45
+ */
46
+ async pushWebhook(webhookId, versionData) {
47
+ return this.httpPost(`/developer/webhooks/${this.agentId}/${webhookId}/version`, versionData, {
48
+ Authorization: `Bearer ${this.apiKey}`,
49
+ });
50
+ }
51
+ /**
52
+ * Pushes a new development/sandbox version of a webhook for testing
53
+ * @param webhookId - The unique identifier of the webhook
54
+ * @param versionData - The version data including code, configuration, and metadata
55
+ * @returns Promise resolving to an ApiResponse containing the development version details
56
+ * @throws Error if the webhook is not found or the push operation fails
57
+ */
58
+ async pushDevWebhook(webhookId, versionData) {
59
+ return this.httpPost(`/developer/webhooks/${this.agentId}/${webhookId}/version/sandbox`, versionData, {
60
+ Authorization: `Bearer ${this.apiKey}`,
61
+ });
62
+ }
63
+ /**
64
+ * Updates an existing development/sandbox version of a webhook
65
+ * @param webhookId - The unique identifier of the webhook
66
+ * @param sandboxVersionId - The unique identifier of the sandbox version to update
67
+ * @param versionData - The updated version data including code, configuration, and metadata
68
+ * @returns Promise resolving to an ApiResponse containing the updated version details
69
+ * @throws Error if the webhook or version is not found or the update fails
70
+ */
71
+ async updateDevWebhook(webhookId, sandboxVersionId, versionData) {
72
+ return this.httpPut(`/developer/webhooks/${this.agentId}/${webhookId}/version/sandbox/${sandboxVersionId}`, versionData, {
73
+ Authorization: `Bearer ${this.apiKey}`,
74
+ });
75
+ }
76
+ /**
77
+ * Retrieves all versions of a specific webhook
78
+ * @param webhookId - The unique identifier of the webhook
79
+ * @returns Promise resolving to an ApiResponse containing an array of webhook versions
80
+ * @throws Error if the webhook is not found or the request fails
81
+ */
82
+ async getWebhookVersions(webhookId) {
83
+ return this.httpGet(`/developer/webhooks/${this.agentId}/${webhookId}/versions`, {
84
+ Authorization: `Bearer ${this.apiKey}`,
85
+ });
86
+ }
87
+ /**
88
+ * Publishes a specific version of a webhook to production
89
+ * @param webhookId - The unique identifier of the webhook
90
+ * @param version - The version identifier to publish
91
+ * @returns Promise resolving to an ApiResponse containing publication confirmation details
92
+ * @throws Error if the webhook or version is not found or the publish operation fails
93
+ */
94
+ async publishWebhookVersion(webhookId, version) {
95
+ return this.httpPut(`/developer/webhooks/${this.agentId}/${webhookId}/${version}/publish`, undefined, {
96
+ Authorization: `Bearer ${this.apiKey}`,
97
+ });
98
+ }
99
+ /**
100
+ * Activates a webhook (enables it to receive requests)
101
+ * @param webhookId - The unique identifier of the webhook to activate
102
+ * @returns Promise resolving to an ApiResponse with activation status
103
+ * @throws Error if the webhook is not found or the operation fails
104
+ */
105
+ async activateWebhook(webhookId) {
106
+ return this.httpPost(`/developer/webhooks/${this.agentId}/${webhookId}/activate`, {}, {
107
+ Authorization: `Bearer ${this.apiKey}`,
108
+ });
109
+ }
110
+ /**
111
+ * Deactivates a webhook (stops it from receiving requests)
112
+ * @param webhookId - The unique identifier of the webhook to deactivate
113
+ * @returns Promise resolving to an ApiResponse with deactivation status
114
+ * @throws Error if the webhook is not found or the operation fails
115
+ */
116
+ async deactivateWebhook(webhookId) {
117
+ return this.httpPost(`/developer/webhooks/${this.agentId}/${webhookId}/deactivate`, {}, {
118
+ Authorization: `Bearer ${this.apiKey}`,
119
+ });
120
+ }
121
+ /**
122
+ * Deletes a webhook and all its versions, or deactivates it if it has versions
123
+ * @param webhookId - The unique identifier of the webhook to delete
124
+ * @returns Promise resolving to an ApiResponse with deletion status
125
+ * - If deleted is true: webhook was successfully deleted
126
+ * - If deleted is false and deactivated is true: webhook has versions and was deactivated instead
127
+ * @throws Error if the webhook is not found or the delete operation fails
128
+ */
129
+ async deleteWebhook(webhookId) {
130
+ return this.httpDelete(`/developer/webhooks/${this.agentId}/${webhookId}`, {
131
+ Authorization: `Bearer ${this.apiKey}`,
132
+ });
133
+ }
134
+ }
@@ -26,20 +26,42 @@
26
26
  * const products = await Products.search('laptop');
27
27
  * ```
28
28
  */
29
- import { LuaSkill, LuaTool, env } from "./types/skill.js";
30
- import { BasketStatus } from "./interfaces/baskets.js";
31
- import { OrderStatus } from "./interfaces/orders.js";
32
- /**
33
- * User Data API
34
- * Access user information and preferences
35
- */
29
+ import { LuaSkill, LuaTool, LuaWebhook, LuaWebhookConfig, LuaJob, LuaJobConfig, JobSchedule, PreProcessor, PreProcessorConfig, PostProcessor, PostProcessorConfig, LuaAgent, LuaAgentConfig, env } from "./types/skill.js";
30
+ import { Basket, BasketStatus, UpdateBasketMetadataResponse } from "./interfaces/baskets.js";
31
+ import { OrderResponse, OrderStatus } from "./interfaces/orders.js";
32
+ import { ChatHistoryMessage, ChatHistoryContent, ChatMessage, TextMessage, ImageMessage, FileMessage, PreProcessorOverride, PostProcessorOverride } from "./interfaces/chat.js";
33
+ import { JobInstance } from "./common/job.instance.js";
34
+ import { DeleteProductResponse, Product } from "./interfaces/product.js";
35
+ import ProductInstance from "./common/product.instance.js";
36
+ import ProductPaginationInstance from "./common/product.pagination.instance.js";
37
+ import ProductSearchInstance from "./common/product.search.instance.js";
38
+ import DataEntryInstance from "./common/data.entry.instance.js";
39
+ import { DeleteCustomDataResponse, GetCustomDataResponse, UpdateCustomDataResponse } from "./interfaces/custom.data.js";
40
+ import UserDataInstance from "./common/user.instance.js";
41
+ import BasketInstance from "./common/basket.instance.js";
42
+ import OrderInstance from "./common/order.instance.js";
36
43
  export declare const User: {
37
44
  /**
38
45
  * Retrieves current user data.
39
46
  *
40
47
  * @returns Promise resolving to user data
41
48
  */
42
- get(): Promise<import("./common/user.instance.js").default>;
49
+ get(): Promise<UserDataInstance>;
50
+ /**
51
+ * Gets the chat history for the current user.
52
+ *
53
+ * @returns Promise resolving to array of chat messages
54
+ *
55
+ * @example
56
+ * ```typescript
57
+ * const history = await User.getChatHistory();
58
+ * // Returns: [
59
+ * // { role: 'user', content: [{type: 'text', text: 'hello'}], createdAt: '...', id: '...', threadId: '...' },
60
+ * // { role: 'assistant', content: [{type: 'text', text: 'hi'}], createdAt: '...', id: '...', threadId: '...' }
61
+ * // ]
62
+ * ```
63
+ */
64
+ getChatHistory(): Promise<import("./interfaces/chat.js").ChatHistoryMessage[]>;
43
65
  };
44
66
  /**
45
67
  * Custom Data API
@@ -54,7 +76,7 @@ export declare const Data: {
54
76
  * @param searchText - Optional text for vector search indexing
55
77
  * @returns Promise resolving to created entry
56
78
  */
57
- create(collectionName: string, data: any, searchText?: string): Promise<import("./common/data.entry.instance.js").default>;
79
+ create(collectionName: string, data: any, searchText?: string): Promise<DataEntryInstance>;
58
80
  /**
59
81
  * Retrieves entries from a collection with optional filtering and pagination.
60
82
  *
@@ -64,7 +86,7 @@ export declare const Data: {
64
86
  * @param limit - Items per page (default: 10)
65
87
  * @returns Promise resolving to array of entries
66
88
  */
67
- get(collectionName: string, filter?: any, page?: number, limit?: number): Promise<import("./interfaces/custom.data.js").GetCustomDataResponse>;
89
+ get(collectionName: string, filter?: any, page?: number, limit?: number): Promise<GetCustomDataResponse>;
68
90
  /**
69
91
  * Retrieves a specific entry by ID.
70
92
  *
@@ -72,7 +94,7 @@ export declare const Data: {
72
94
  * @param entryId - ID of the entry
73
95
  * @returns Promise resolving to entry data
74
96
  */
75
- getEntry(collectionName: string, entryId: string): Promise<import("./common/data.entry.instance.js").default>;
97
+ getEntry(collectionName: string, entryId: string): Promise<DataEntryInstance>;
76
98
  /**
77
99
  * Updates an existing entry.
78
100
  *
@@ -81,7 +103,7 @@ export declare const Data: {
81
103
  * @param data - Updated data
82
104
  * @returns Promise resolving to updated entry
83
105
  */
84
- update(collectionName: string, entryId: string, data: any): Promise<import("./interfaces/custom.data.js").UpdateCustomDataResponse>;
106
+ update(collectionName: string, entryId: string, data: any): Promise<UpdateCustomDataResponse>;
85
107
  /**
86
108
  * Performs vector search on a collection.
87
109
  *
@@ -91,7 +113,7 @@ export declare const Data: {
91
113
  * @param scoreThreshold - Minimum similarity score (0-1)
92
114
  * @returns Promise resolving to search results
93
115
  */
94
- search(collectionName: string, searchText: string, limit?: number, scoreThreshold?: number): Promise<import("./common/data.entry.instance.js").default[]>;
116
+ search(collectionName: string, searchText: string, limit?: number, scoreThreshold?: number): Promise<DataEntryInstance[]>;
95
117
  /**
96
118
  * Deletes an entry from a collection.
97
119
  *
@@ -99,7 +121,7 @@ export declare const Data: {
99
121
  * @param entryId - ID of the entry to delete
100
122
  * @returns Promise resolving when deletion is complete
101
123
  */
102
- delete(collectionName: string, entryId: string): Promise<import("./interfaces/custom.data.js").DeleteCustomDataResponse>;
124
+ delete(collectionName: string, entryId: string): Promise<DeleteCustomDataResponse>;
103
125
  };
104
126
  /**
105
127
  * Products API
@@ -113,43 +135,35 @@ export declare const Products: {
113
135
  * @param page - Page number
114
136
  * @returns Promise resolving to product list
115
137
  */
116
- get(limit?: number, page?: number): Promise<import("./common/product.pagination.instance.js").default>;
138
+ get(limit?: number, page?: number): Promise<ProductPaginationInstance>;
117
139
  /**
118
140
  * Creates a new product.
119
141
  *
120
142
  * @param product - Product data
121
143
  * @returns Promise resolving to created product
122
144
  */
123
- create(product: any): Promise<import("./common/product.instance.js").default>;
124
- /**
125
- * Updates an existing product.
126
- *
127
- * @param data - Updated product data
128
- * @param id - Product ID
129
- * @returns Promise resolving to updated product
130
- */
131
- update(data: any, id: string): Promise<import("./interfaces/product.js").UpdateProductResponse>;
145
+ create(product: Product): Promise<ProductInstance>;
132
146
  /**
133
147
  * Deletes a product.
134
148
  *
135
149
  * @param id - Product ID
136
150
  * @returns Promise resolving when deletion is complete
137
151
  */
138
- delete(id: string): Promise<import("./interfaces/product.js").DeleteProductResponse>;
152
+ delete(id: string): Promise<DeleteProductResponse>;
139
153
  /**
140
154
  * Searches products by query string.
141
155
  *
142
156
  * @param query - Search query
143
157
  * @returns Promise resolving to search results
144
158
  */
145
- search(query: string): Promise<import("./common/product.search.instance.js").default>;
159
+ search(query: string): Promise<ProductSearchInstance>;
146
160
  /**
147
161
  * Retrieves a specific product by ID.
148
162
  *
149
163
  * @param id - Product ID
150
164
  * @returns Promise resolving to product data
151
165
  */
152
- getById(id: string): Promise<import("./common/product.instance.js").default>;
166
+ getById(id: string): Promise<ProductInstance>;
153
167
  };
154
168
  /**
155
169
  * Baskets API
@@ -162,14 +176,14 @@ export declare const Baskets: {
162
176
  * @param basketData - Basket initialization data
163
177
  * @returns Promise resolving to created basket
164
178
  */
165
- create(basketData: any): Promise<import("./common/basket.instance.js").default>;
179
+ create(basketData: any): Promise<BasketInstance>;
166
180
  /**
167
181
  * Retrieves baskets, optionally filtered by status.
168
182
  *
169
183
  * @param status - Optional basket status filter
170
184
  * @returns Promise resolving to basket list
171
185
  */
172
- get(status?: any): Promise<import("./common/basket.instance.js").default[]>;
186
+ get(status?: any): Promise<BasketInstance[]>;
173
187
  /**
174
188
  * Adds an item to a basket.
175
189
  *
@@ -177,7 +191,7 @@ export declare const Baskets: {
177
191
  * @param itemData - Item data to add
178
192
  * @returns Promise resolving to updated basket
179
193
  */
180
- addItem(basketId: string, itemData: any): Promise<import("./interfaces/baskets.js").Basket>;
194
+ addItem(basketId: string, itemData: any): Promise<Basket>;
181
195
  /**
182
196
  * Removes an item from a basket.
183
197
  *
@@ -185,14 +199,14 @@ export declare const Baskets: {
185
199
  * @param itemId - Item ID to remove
186
200
  * @returns Promise resolving to updated basket
187
201
  */
188
- removeItem(basketId: string, itemId: string): Promise<import("./interfaces/baskets.js").Basket>;
202
+ removeItem(basketId: string, itemId: string): Promise<Basket>;
189
203
  /**
190
204
  * Clears all items from a basket.
191
205
  *
192
206
  * @param basketId - Basket ID
193
207
  * @returns Promise resolving to cleared basket
194
208
  */
195
- clear(basketId: string): Promise<import("./interfaces/baskets.js").Basket>;
209
+ clear(basketId: string): Promise<Basket>;
196
210
  /**
197
211
  * Updates basket status.
198
212
  *
@@ -208,7 +222,7 @@ export declare const Baskets: {
208
222
  * @param metadata - Metadata to update
209
223
  * @returns Promise resolving to updated basket
210
224
  */
211
- updateMetadata(basketId: string, metadata: any): Promise<import("./interfaces/baskets.js").UpdateBasketMetadataResponse>;
225
+ updateMetadata(basketId: string, metadata: any): Promise<UpdateBasketMetadataResponse>;
212
226
  /**
213
227
  * Converts basket to order.
214
228
  *
@@ -216,14 +230,14 @@ export declare const Baskets: {
216
230
  * @param basketId - Basket ID to convert
217
231
  * @returns Promise resolving to created order
218
232
  */
219
- placeOrder(data: Record<string, any>, basketId: string): Promise<import("./common/order.instance.js").default>;
233
+ placeOrder(data: Record<string, any>, basketId: string): Promise<OrderInstance>;
220
234
  /**
221
235
  * Retrieves a specific basket by ID.
222
236
  *
223
237
  * @param basketId - Basket ID
224
238
  * @returns Promise resolving to basket data
225
239
  */
226
- getById(basketId: string): Promise<import("./common/basket.instance.js").default>;
240
+ getById(basketId: string): Promise<BasketInstance>;
227
241
  };
228
242
  /**
229
243
  * Orders API
@@ -236,7 +250,7 @@ export declare const Orders: {
236
250
  * @param orderData - Order data
237
251
  * @returns Promise resolving to created order
238
252
  */
239
- create(orderData: any): Promise<import("./common/order.instance.js").default>;
253
+ create(orderData: any): Promise<OrderInstance>;
240
254
  /**
241
255
  * Updates order status.
242
256
  *
@@ -244,7 +258,7 @@ export declare const Orders: {
244
258
  * @param orderId - Order ID
245
259
  * @returns Promise resolving to updated order
246
260
  */
247
- updateStatus(status: any, orderId: string): Promise<import("./interfaces/orders.js").OrderResponse>;
261
+ updateStatus(status: any, orderId: string): Promise<OrderResponse>;
248
262
  /**
249
263
  * Updates order data.
250
264
  *
@@ -252,20 +266,141 @@ export declare const Orders: {
252
266
  * @param orderId - Order ID
253
267
  * @returns Promise resolving to updated order
254
268
  */
255
- updateData(data: Record<string, any>, orderId: string): Promise<import("./interfaces/orders.js").OrderResponse>;
269
+ updateData(data: Record<string, any>, orderId: string): Promise<OrderResponse>;
256
270
  /**
257
271
  * Retrieves orders, optionally filtered by status.
258
272
  *
259
273
  * @param status - Optional order status filter
260
274
  * @returns Promise resolving to order list
261
275
  */
262
- get(status?: any): Promise<import("./common/order.instance.js").default[]>;
276
+ get(status?: any): Promise<OrderInstance[]>;
263
277
  /**
264
278
  * Retrieves a specific order by ID.
265
279
  *
266
280
  * @param orderId - Order ID
267
281
  * @returns Promise resolving to order data
268
282
  */
269
- getById(orderId: string): Promise<import("./common/order.instance.js").default>;
283
+ getById(orderId: string): Promise<OrderInstance>;
284
+ };
285
+ /**
286
+ * Jobs API
287
+ * Manage and trigger scheduled jobs from within your tools
288
+ */
289
+ export declare const Jobs: {
290
+ /**
291
+ * Creates a new job dynamically from within a tool.
292
+ * This allows tools to schedule one-time or recurring jobs programmatically.
293
+ *
294
+ * **What this does:**
295
+ * The server handles everything in ONE API call:
296
+ * 1. Creates the job
297
+ * 2. Creates version 1.0.0 with your execute function
298
+ * 3. Optionally activates the job (if activate: true)
299
+ * 4. Returns a JobInstance for manipulation
300
+ *
301
+ * @param config - Job configuration
302
+ * @param config.name - Unique job name
303
+ * @param config.description - Job description
304
+ * @param config.schedule - Schedule configuration (cron, once, or interval)
305
+ * @param config.execute - Async function to execute
306
+ * @param config.timeout - Optional timeout in seconds
307
+ * @param config.retry - Optional retry configuration
308
+ * @param config.metadata - Optional metadata
309
+ * @returns Promise resolving to JobInstance (already created, versioned, and activated)
310
+ *
311
+ * @example
312
+ * ```typescript
313
+ * // Create a one-time job to check basket in 3 hours
314
+ * const job = await Jobs.create({
315
+ * name: `check-basket-${basketId}`,
316
+ * description: 'Check if basket was abandoned',
317
+ * schedule: {
318
+ * type: 'once',
319
+ * executeAt: new Date(Date.now() + 3 * 60 * 60 * 1000)
320
+ * },
321
+ * metadata: {
322
+ * basketId: basketId,
323
+ * checkType: 'abandoned-cart'
324
+ * },
325
+ * execute: async (job, user) => {
326
+ * // Access user context and metadata
327
+ * console.log('Checking basket for user:', user.name);
328
+ * console.log('Basket ID from metadata:', metadata?.basketId);
329
+ *
330
+ * const basket = await Baskets.getById(metadata.basketId);
331
+ * if (basket.status === 'active') {
332
+ * // Send reminder
333
+ * }
334
+ * return { checked: true };
335
+ * }
336
+ * });
337
+ * // Job is now created, versioned as 1.0.0, and activated!
338
+ * console.log(`Job ${job.jobId} is active: ${job.active}`);
339
+ * ```
340
+ */
341
+ create(config: {
342
+ name: string;
343
+ description?: string;
344
+ schedule: any;
345
+ execute: (job: JobInstance) => Promise<any>;
346
+ timeout?: number;
347
+ retry?: {
348
+ maxAttempts: number;
349
+ backoffSeconds?: number;
350
+ };
351
+ metadata?: Record<string, any>;
352
+ /** Auto-activate the job after creation (default: true) */
353
+ activate?: boolean;
354
+ }): Promise<JobInstance>;
355
+ /**
356
+ * Retrieves a job by its unique identifier
357
+ * @param jobId - The unique identifier of the job to retrieve
358
+ * @returns Promise resolving to an JobInstance representing the job
359
+ * @throws Error if the job is not found or the request fails
360
+ */
361
+ getJob(jobId: string): Promise<JobInstance>;
362
+ };
363
+ /**
364
+ * AI API
365
+ * Generate AI responses with custom context
366
+ */
367
+ export declare const AI: {
368
+ /**
369
+ * Generates an AI response with custom runtime context.
370
+ *
371
+ * @param context - Runtime context to provide to the AI
372
+ * @param messages - Array of messages (text, image, file, etc.)
373
+ * @param agentId - Optional agent ID to use (defaults to current agent)
374
+ * @returns Promise resolving to AI response text
375
+ *
376
+ * @example
377
+ * ```typescript
378
+ * // Simple text message with current agent
379
+ * const response = await AI.generate(
380
+ * 'You are a helpful sales assistant for our e-commerce store.',
381
+ * [{ type: 'text', text: 'What products do you recommend for beginners?' }]
382
+ * );
383
+ * console.log(response); // AI-generated recommendation
384
+ *
385
+ * // Multiple messages with images
386
+ * const response2 = await AI.generate(
387
+ * 'You are an image analysis expert.',
388
+ * [
389
+ * { type: 'text', text: 'What do you see in this image?' },
390
+ * { type: 'image', url: 'https://example.com/image.jpg' }
391
+ * ]
392
+ * );
393
+ *
394
+ * // Use a different agent
395
+ * const response3 = await AI.generate(
396
+ * 'You are a specialized assistant.',
397
+ * [{ type: 'text', text: 'Help me with this task' }],
398
+ * 'agent_different_123'
399
+ * );
400
+ * ```
401
+ */
402
+ generate(context: string, messages: import("./interfaces/chat.js").ChatMessage[], agentId?: string): Promise<string>;
270
403
  };
271
- export { LuaSkill, LuaTool, BasketStatus, OrderStatus, env };
404
+ export { LuaSkill, LuaTool, LuaWebhook, LuaWebhookConfig, LuaJob, LuaJobConfig, JobSchedule, PreProcessor, PreProcessorConfig, PostProcessor, PostProcessorConfig, LuaAgent, LuaAgentConfig, BasketStatus, OrderStatus, env };
405
+ export { JobInstance };
406
+ export { ChatHistoryMessage, ChatHistoryContent, ChatMessage, TextMessage, ImageMessage, FileMessage, PreProcessorOverride, PostProcessorOverride };