lua-cli 2.5.6 โ†’ 2.5.8

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 (40) hide show
  1. package/dist/api/agent.api.service.d.ts +45 -0
  2. package/dist/api/agent.api.service.js +54 -0
  3. package/dist/api/user.data.api.service.d.ts +15 -0
  4. package/dist/api/user.data.api.service.js +31 -0
  5. package/dist/cli/command-definitions.js +77 -5
  6. package/dist/commands/completion.d.ts +11 -0
  7. package/dist/commands/completion.js +209 -0
  8. package/dist/commands/env.d.ts +3 -2
  9. package/dist/commands/env.js +42 -17
  10. package/dist/commands/features.d.ts +16 -0
  11. package/dist/commands/features.js +352 -0
  12. package/dist/commands/index.d.ts +3 -0
  13. package/dist/commands/index.js +3 -0
  14. package/dist/commands/persona.d.ts +3 -2
  15. package/dist/commands/persona.js +43 -18
  16. package/dist/commands/push.d.ts +9 -13
  17. package/dist/commands/push.js +271 -82
  18. package/dist/commands/skills.d.ts +16 -0
  19. package/dist/commands/skills.js +438 -0
  20. package/dist/common/basket.instance.js +38 -19
  21. package/dist/common/data.entry.instance.d.ts +7 -0
  22. package/dist/common/data.entry.instance.js +35 -9
  23. package/dist/common/order.instance.d.ts +6 -0
  24. package/dist/common/order.instance.js +48 -15
  25. package/dist/common/product.instance.d.ts +6 -0
  26. package/dist/common/product.instance.js +34 -9
  27. package/dist/common/product.pagination.instance.js +6 -2
  28. package/dist/common/product.search.instance.js +4 -1
  29. package/dist/common/user.instance.d.ts +14 -0
  30. package/dist/common/user.instance.js +49 -9
  31. package/dist/index.js +14 -3
  32. package/dist/interfaces/agent.d.ts +31 -0
  33. package/dist/interfaces/message.d.ts +18 -0
  34. package/dist/interfaces/message.js +1 -0
  35. package/dist/types/api-contracts.d.ts +9 -0
  36. package/dist/types/api-contracts.js +0 -7
  37. package/dist/web/app.css +152 -736
  38. package/dist/web/app.js +45 -45
  39. package/package.json +2 -2
  40. package/template/package.json +1 -1
@@ -11,8 +11,9 @@ export default class OrderInstance {
11
11
  * @returns Proxied instance that allows direct access to data and common properties
12
12
  */
13
13
  constructor(api, order) {
14
- this.data = order.data;
15
- this.common = order.common;
14
+ // Ensure data and common are always objects, never null or undefined
15
+ this.data = order.data && typeof order.data === 'object' ? order.data : {};
16
+ this.common = order.common && typeof order.common === 'object' ? order.common : {};
16
17
  this.id = order.id;
17
18
  this.userId = order.userId;
18
19
  this.agentId = order.agentId;
@@ -31,12 +32,12 @@ export default class OrderInstance {
31
32
  if (prop in target) {
32
33
  return Reflect.get(target, prop, receiver);
33
34
  }
34
- // Check data object
35
- if (typeof prop === 'string' && prop in target.data) {
35
+ // Check data object (with null check)
36
+ if (typeof prop === 'string' && target.data && typeof target.data === 'object' && prop in target.data) {
36
37
  return target.data[prop];
37
38
  }
38
- // Check common object
39
- if (typeof prop === 'string' && prop in target.common) {
39
+ // Check common object (with null check)
40
+ if (typeof prop === 'string' && target.common && typeof target.common === 'object' && prop in target.common) {
40
41
  return target.common[prop];
41
42
  }
42
43
  return undefined;
@@ -49,6 +50,13 @@ export default class OrderInstance {
49
50
  }
50
51
  // Check if property exists in data or common, otherwise default to data
51
52
  if (typeof prop === 'string') {
53
+ // Initialize objects if they don't exist
54
+ if (!target.data || typeof target.data !== 'object') {
55
+ target.data = {};
56
+ }
57
+ if (!target.common || typeof target.common !== 'object') {
58
+ target.common = {};
59
+ }
52
60
  if (prop in target.common) {
53
61
  target.common[prop] = value;
54
62
  }
@@ -60,14 +68,25 @@ export default class OrderInstance {
60
68
  return false;
61
69
  },
62
70
  has(target, prop) {
63
- // Check if property exists on instance, in data, or in common
64
- return prop in target || (typeof prop === 'string' && (prop in target.data || prop in target.common));
71
+ // Check if property exists on instance, in data, or in common (with null checks)
72
+ if (prop in target) {
73
+ return true;
74
+ }
75
+ if (typeof prop === 'string') {
76
+ if (target.data && typeof target.data === 'object' && prop in target.data) {
77
+ return true;
78
+ }
79
+ if (target.common && typeof target.common === 'object' && prop in target.common) {
80
+ return true;
81
+ }
82
+ }
83
+ return false;
65
84
  },
66
85
  ownKeys(target) {
67
- // Return instance keys, data keys, and common keys
86
+ // Return instance keys, data keys, and common keys (with null checks)
68
87
  const instanceKeys = Reflect.ownKeys(target);
69
- const dataKeys = Object.keys(target.data);
70
- const commonKeys = Object.keys(target.common);
88
+ const dataKeys = target.data && typeof target.data === 'object' ? Object.keys(target.data) : [];
89
+ const commonKeys = target.common && typeof target.common === 'object' ? Object.keys(target.common) : [];
71
90
  return [...new Set([...instanceKeys, ...dataKeys, ...commonKeys])];
72
91
  },
73
92
  getOwnPropertyDescriptor(target, prop) {
@@ -76,8 +95,8 @@ export default class OrderInstance {
76
95
  if (instanceDesc) {
77
96
  return instanceDesc;
78
97
  }
79
- // Then check data properties
80
- if (typeof prop === 'string' && prop in target.data) {
98
+ // Then check data properties (with null check)
99
+ if (typeof prop === 'string' && target.data && typeof target.data === 'object' && prop in target.data) {
81
100
  return {
82
101
  configurable: true,
83
102
  enumerable: true,
@@ -85,8 +104,8 @@ export default class OrderInstance {
85
104
  value: target.data[prop]
86
105
  };
87
106
  }
88
- // Then check common properties
89
- if (typeof prop === 'string' && prop in target.common) {
107
+ // Then check common properties (with null check)
108
+ if (typeof prop === 'string' && target.common && typeof target.common === 'object' && prop in target.common) {
90
109
  return {
91
110
  configurable: true,
92
111
  enumerable: true,
@@ -151,4 +170,18 @@ export default class OrderInstance {
151
170
  id: this.id
152
171
  };
153
172
  }
173
+ /**
174
+ * Saves the order's data
175
+ * @returns Promise resolving to true if saving was successful
176
+ * @throws Error if the save operation fails
177
+ */
178
+ async save() {
179
+ try {
180
+ await this.orderAPI.updateData(this.data, this.id);
181
+ return true;
182
+ }
183
+ catch (error) {
184
+ throw new Error('Failed to save order data');
185
+ }
186
+ }
154
187
  }
@@ -33,4 +33,10 @@ export default class ProductInstance {
33
33
  * @throws Error if the deletion fails or the product is not found
34
34
  */
35
35
  delete(): Promise<Product>;
36
+ /**
37
+ * Saves the product's data
38
+ * @returns Promise resolving to true if saving was successful
39
+ * @throws Error if the save operation fails
40
+ */
41
+ save(): Promise<boolean>;
36
42
  }
@@ -11,7 +11,8 @@ export default class ProductInstance {
11
11
  * @returns Proxied instance that allows direct access to product properties
12
12
  */
13
13
  constructor(api, product) {
14
- this.data = product;
14
+ // Ensure data is always an object, never null or undefined
15
+ this.data = product && typeof product === 'object' ? product : {};
15
16
  // Make productAPI non-enumerable so it doesn't show up in console.log
16
17
  Object.defineProperty(this, 'productAPI', {
17
18
  value: api,
@@ -26,8 +27,8 @@ export default class ProductInstance {
26
27
  if (prop in target) {
27
28
  return Reflect.get(target, prop, receiver);
28
29
  }
29
- // Otherwise, try to get it from the data object
30
- if (typeof prop === 'string' && prop in target.data) {
30
+ // Otherwise, try to get it from the data object (with null check)
31
+ if (typeof prop === 'string' && target.data && typeof target.data === 'object' && prop in target.data) {
31
32
  return target.data[prop];
32
33
  }
33
34
  return undefined;
@@ -40,19 +41,29 @@ export default class ProductInstance {
40
41
  }
41
42
  // All other properties get set on the data object
42
43
  if (typeof prop === 'string') {
44
+ // Initialize data object if it doesn't exist
45
+ if (!target.data || typeof target.data !== 'object') {
46
+ target.data = {};
47
+ }
43
48
  target.data[prop] = value;
44
49
  return true;
45
50
  }
46
51
  return false;
47
52
  },
48
53
  has(target, prop) {
49
- // Check if property exists on instance or in data
50
- return prop in target || (typeof prop === 'string' && prop in target.data);
54
+ // Check if property exists on instance or in data (with null check)
55
+ if (prop in target) {
56
+ return true;
57
+ }
58
+ if (typeof prop === 'string' && target.data && typeof target.data === 'object') {
59
+ return prop in target.data;
60
+ }
61
+ return false;
51
62
  },
52
63
  ownKeys(target) {
53
- // Return both instance keys and data keys
64
+ // Return both instance keys and data keys (with null check)
54
65
  const instanceKeys = Reflect.ownKeys(target);
55
- const dataKeys = Object.keys(target.data);
66
+ const dataKeys = target.data && typeof target.data === 'object' ? Object.keys(target.data) : [];
56
67
  return [...new Set([...instanceKeys, ...dataKeys])];
57
68
  },
58
69
  getOwnPropertyDescriptor(target, prop) {
@@ -61,8 +72,8 @@ export default class ProductInstance {
61
72
  if (instanceDesc) {
62
73
  return instanceDesc;
63
74
  }
64
- // Then check if it's a data property
65
- if (typeof prop === 'string' && prop in target.data) {
75
+ // Then check if it's a data property (with null check)
76
+ if (typeof prop === 'string' && target.data && typeof target.data === 'object' && prop in target.data) {
66
77
  return {
67
78
  configurable: true,
68
79
  enumerable: true,
@@ -116,4 +127,18 @@ export default class ProductInstance {
116
127
  }
117
128
  return this.data;
118
129
  }
130
+ /**
131
+ * Saves the product's data
132
+ * @returns Promise resolving to true if saving was successful
133
+ * @throws Error if the save operation fails
134
+ */
135
+ async save() {
136
+ try {
137
+ await this.productAPI.update(this.data, this.data.id);
138
+ return true;
139
+ }
140
+ catch (error) {
141
+ throw new Error('Failed to save product data');
142
+ }
143
+ }
119
144
  }
@@ -11,8 +11,12 @@ export default class ProductPaginationInstance {
11
11
  * @param results - The paginated product results from the API
12
12
  */
13
13
  constructor(api, results) {
14
- this.products = results.data?.map(product => new ProductInstance(api, product)) || [];
15
- this.pagination = results.pagination || {
14
+ // Ensure products array is always initialized, with null checks
15
+ const productsData = results?.data;
16
+ this.products = (Array.isArray(productsData) ? productsData : [])
17
+ .map(product => new ProductInstance(api, product));
18
+ // Ensure pagination is always initialized with safe defaults
19
+ this.pagination = results?.pagination || {
16
20
  currentPage: 1,
17
21
  totalPages: 1,
18
22
  totalCount: 0,
@@ -11,7 +11,10 @@ export default class ProductSearchInstance {
11
11
  * @param results - The product search results from the API
12
12
  */
13
13
  constructor(api, results) {
14
- this.products = results.data?.map(product => new ProductInstance(api, product)) || [];
14
+ // Ensure products array is always initialized, with null checks
15
+ const productsData = results?.data;
16
+ this.products = (Array.isArray(productsData) ? productsData : [])
17
+ .map(product => new ProductInstance(api, product));
15
18
  // Make productAPI non-enumerable so it doesn't show up in console.log
16
19
  Object.defineProperty(this, 'productAPI', {
17
20
  value: api,
@@ -1,3 +1,4 @@
1
+ import { Message } from "../interfaces/message.js";
1
2
  import { UserDataAPI } from "../types/index.js";
2
3
  /**
3
4
  * User data instance class providing a fluent API for managing user data
@@ -33,4 +34,17 @@ export default class UserDataInstance {
33
34
  * @throws Error if the clear operation fails
34
35
  */
35
36
  clear(): Promise<boolean>;
37
+ /**
38
+ * Saves the user's data
39
+ * @returns Promise resolving to true if saving was successful
40
+ * @throws Error if the save operation fails
41
+ */
42
+ save(): Promise<boolean>;
43
+ /**
44
+ * Sends a message to a specific user conversation for the agent
45
+ * @param messages - An array of messages to send (can be text, image, or file types)
46
+ * @returns Promise resolving to the response data from the server
47
+ * @throws Error if the message sending fails or the request is unsuccessful
48
+ */
49
+ send(messages: Message[]): Promise<any>;
36
50
  }
@@ -11,7 +11,8 @@ export default class UserDataInstance {
11
11
  * @returns Proxied instance that allows direct access to data properties
12
12
  */
13
13
  constructor(api, data) {
14
- this.data = data;
14
+ // Ensure data is always an object, never null or undefined
15
+ this.data = data && typeof data === 'object' ? data : {};
15
16
  // Make userAPI non-enumerable so it doesn't show up in console.log
16
17
  Object.defineProperty(this, 'userAPI', {
17
18
  value: api,
@@ -26,8 +27,8 @@ export default class UserDataInstance {
26
27
  if (prop in target) {
27
28
  return Reflect.get(target, prop, receiver);
28
29
  }
29
- // Otherwise, try to get it from the data object
30
- if (typeof prop === 'string' && prop in target.data) {
30
+ // Otherwise, try to get it from the data object (with null check)
31
+ if (typeof prop === 'string' && target.data && typeof target.data === 'object' && prop in target.data) {
31
32
  return target.data[prop];
32
33
  }
33
34
  return undefined;
@@ -40,19 +41,29 @@ export default class UserDataInstance {
40
41
  }
41
42
  // All other properties get set on the data object
42
43
  if (typeof prop === 'string') {
44
+ // Initialize data object if it doesn't exist
45
+ if (!target.data || typeof target.data !== 'object') {
46
+ target.data = {};
47
+ }
43
48
  target.data[prop] = value;
44
49
  return true;
45
50
  }
46
51
  return false;
47
52
  },
48
53
  has(target, prop) {
49
- // Check if property exists on instance or in data
50
- return prop in target || (typeof prop === 'string' && prop in target.data);
54
+ // Check if property exists on instance or in data (with null check)
55
+ if (prop in target) {
56
+ return true;
57
+ }
58
+ if (typeof prop === 'string' && target.data && typeof target.data === 'object') {
59
+ return prop in target.data;
60
+ }
61
+ return false;
51
62
  },
52
63
  ownKeys(target) {
53
- // Return both instance keys and data keys
64
+ // Return both instance keys and data keys (with null check)
54
65
  const instanceKeys = Reflect.ownKeys(target);
55
- const dataKeys = Object.keys(target.data);
66
+ const dataKeys = target.data && typeof target.data === 'object' ? Object.keys(target.data) : [];
56
67
  return [...new Set([...instanceKeys, ...dataKeys])];
57
68
  },
58
69
  getOwnPropertyDescriptor(target, prop) {
@@ -61,8 +72,8 @@ export default class UserDataInstance {
61
72
  if (instanceDesc) {
62
73
  return instanceDesc;
63
74
  }
64
- // Then check if it's a data property
65
- if (typeof prop === 'string' && prop in target.data) {
75
+ // Then check if it's a data property (with null check)
76
+ if (typeof prop === 'string' && target.data && typeof target.data === 'object' && prop in target.data) {
66
77
  return {
67
78
  configurable: true,
68
79
  enumerable: true,
@@ -118,4 +129,33 @@ export default class UserDataInstance {
118
129
  throw new Error('Failed to clear user data');
119
130
  }
120
131
  }
132
+ /**
133
+ * Saves the user's data
134
+ * @returns Promise resolving to true if saving was successful
135
+ * @throws Error if the save operation fails
136
+ */
137
+ async save() {
138
+ try {
139
+ await this.userAPI.update(this.data);
140
+ return true;
141
+ }
142
+ catch (error) {
143
+ throw new Error('Failed to save user data');
144
+ }
145
+ }
146
+ /**
147
+ * Sends a message to a specific user conversation for the agent
148
+ * @param messages - An array of messages to send (can be text, image, or file types)
149
+ * @returns Promise resolving to the response data from the server
150
+ * @throws Error if the message sending fails or the request is unsuccessful
151
+ */
152
+ async send(messages) {
153
+ try {
154
+ await this.userAPI.sendMessage(messages);
155
+ return true;
156
+ }
157
+ catch (error) {
158
+ throw new Error('Failed to send message');
159
+ }
160
+ }
121
161
  }
package/dist/index.js CHANGED
@@ -37,13 +37,24 @@ Examples:
37
37
  $ lua init ๐Ÿš€ Initialize a new project
38
38
  $ lua compile ๐Ÿ“ฆ Compile your skills
39
39
  $ lua test ๐Ÿงช Test tools interactively
40
- $ lua push โ˜๏ธ Push to server
40
+ $ lua push โ˜๏ธ Push to server (interactive)
41
+ $ lua push skill โ˜๏ธ Push skill directly
42
+ $ lua push persona โ˜๏ธ Push persona directly
41
43
  $ lua deploy ๐Ÿš€ Deploy to production
42
44
  $ lua chat ๐Ÿ’ฌ Start interactive chat
43
- $ lua env โš™๏ธ Manage environment variables
44
- $ lua persona ๐Ÿค– Manage agent persona
45
+ $ lua env โš™๏ธ Manage environment variables (interactive)
46
+ $ lua env staging โš™๏ธ Manage staging env vars directly
47
+ $ lua env production โš™๏ธ Manage production env vars directly
48
+ $ lua persona ๐Ÿค– Manage agent persona (interactive)
49
+ $ lua persona staging ๐Ÿค– Manage staging persona directly
50
+ $ lua persona production ๐Ÿค– Manage production persona directly
51
+ $ lua skills โš™๏ธ Manage skills (interactive)
52
+ $ lua skills staging โš™๏ธ View staging skills directly
53
+ $ lua skills production โš™๏ธ Manage production skills directly
54
+ $ lua features ๐ŸŽฏ Manage agent features
45
55
  $ lua admin ๐Ÿ”ง Open admin dashboard
46
56
  $ lua docs ๐Ÿ“– Open documentation
57
+ $ lua completion ๐ŸŽฏ Enable shell autocomplete
47
58
 
48
59
  ๐ŸŒ™ Documentation: https://docs.heylua.ai
49
60
  ๐ŸŒ™ Support: https://heylua.ai/support
@@ -307,3 +307,34 @@ export interface CreateEmailChannelResponse {
307
307
  forwardTo: string;
308
308
  status: string;
309
309
  }
310
+ /**
311
+ * Agent feature configuration.
312
+ * Represents a feature that can be enabled/disabled for an agent.
313
+ */
314
+ export interface AgentFeature {
315
+ name: string;
316
+ title: string;
317
+ context: string;
318
+ active: boolean;
319
+ }
320
+ /**
321
+ * Response from get agent features API.
322
+ */
323
+ export interface GetAgentFeaturesResponse {
324
+ features: AgentFeature[];
325
+ }
326
+ /**
327
+ * Request payload for updating an agent feature.
328
+ * At least one of active or featureContext must be provided.
329
+ */
330
+ export interface UpdateAgentFeatureRequest {
331
+ featureName: string;
332
+ active?: boolean;
333
+ featureContext?: string;
334
+ }
335
+ /**
336
+ * Response from updating an agent feature.
337
+ */
338
+ export interface UpdateAgentFeatureResponse {
339
+ message: string;
340
+ }
@@ -0,0 +1,18 @@
1
+ export type TextMessage = {
2
+ type: "text";
3
+ text: string;
4
+ };
5
+ export type ImageMessage = {
6
+ type: "image";
7
+ image: string;
8
+ mimeType: string;
9
+ };
10
+ export type FileMessage = {
11
+ type: "file";
12
+ data: string;
13
+ mimeType: string;
14
+ };
15
+ export type Message = TextMessage | ImageMessage | FileMessage;
16
+ export interface SendMessageRequest {
17
+ messages: Message[];
18
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -1,3 +1,4 @@
1
+ import { Message } from "../interfaces/message.js";
1
2
  /**
2
3
  * API Contract Interfaces
3
4
  * TypeScript interfaces that API service classes must implement
@@ -26,6 +27,14 @@ export interface UserDataAPI {
26
27
  * @returns Promise resolving when data is cleared
27
28
  */
28
29
  clear(): Promise<any>;
30
+ /**
31
+ * Sends a message to a specific user conversation for the agent
32
+ * @param userId - The unique identifier of the user to send the message to
33
+ * @param messages - An array of messages to send (can be text, image, or file types)
34
+ * @returns Promise resolving to the response data from the server
35
+ * @throws Error if the message sending fails or the request is unsuccessful
36
+ */
37
+ sendMessage(messages: Message[]): Promise<any>;
29
38
  }
30
39
  /**
31
40
  * Product API contract.
@@ -1,8 +1 @@
1
- /**
2
- * API Contract Interfaces
3
- * TypeScript interfaces that API service classes must implement
4
- *
5
- * These interfaces define the contract that API services must fulfill.
6
- * They ensure consistent method signatures across all API implementations.
7
- */
8
1
  export {};