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,158 @@
1
+ import { HttpClient } from "../common/http.client.js";
2
+ import { ApiResponse } from "../interfaces/common.js";
3
+ /**
4
+ * PostProcessor API Response Types
5
+ */
6
+ export interface PostProcessorVersion {
7
+ version: string;
8
+ postprocessorId: string;
9
+ createdAt: string | number;
10
+ isActive?: boolean;
11
+ }
12
+ export interface GetPostProcessorsResponse {
13
+ postprocessors: Array<{
14
+ id: string;
15
+ name: string;
16
+ description?: string;
17
+ context?: string;
18
+ versions: PostProcessorVersion[];
19
+ activeVersionId?: string;
20
+ }>;
21
+ }
22
+ export interface CreatePostProcessorResponse {
23
+ id: string;
24
+ name: string;
25
+ description?: string;
26
+ agentId: string;
27
+ context?: string;
28
+ }
29
+ export interface PostProcessorVersionResponse {
30
+ versionId: string;
31
+ postprocessorId: string;
32
+ version: string;
33
+ createdAt: string;
34
+ }
35
+ export interface DeletePostProcessorResponse {
36
+ deleted: boolean;
37
+ deactivated?: boolean;
38
+ message: string;
39
+ }
40
+ /**
41
+ * PostProcessor API Service
42
+ * Handles all postprocessor-related API calls
43
+ */
44
+ export default class PostProcessorApi extends HttpClient {
45
+ private apiKey;
46
+ private agentId;
47
+ constructor(baseUrl: string, apiKey: string, agentId: string);
48
+ /**
49
+ * Retrieves all postprocessors for the agent
50
+ */
51
+ getPostProcessors(): Promise<ApiResponse<GetPostProcessorsResponse>>;
52
+ /**
53
+ * Creates a new postprocessor for the agent
54
+ */
55
+ createPostProcessor(data: {
56
+ name: string;
57
+ description?: string;
58
+ context?: string;
59
+ }): Promise<ApiResponse<CreatePostProcessorResponse>>;
60
+ /**
61
+ * Pushes a new version of a postprocessor
62
+ *
63
+ * @param postprocessorId - The postprocessor ID
64
+ * @param versionData - Version data including code, description, context, and async flag
65
+ * @param versionData.version - Version number
66
+ * @param versionData.code - Compressed execute function code
67
+ * @param versionData.executeFunction - Raw execute function code
68
+ * @param versionData.description - Postprocessor description
69
+ * @param versionData.context - Postprocessor context
70
+ * @param versionData.async - Async execution flag (true = background, false = blocking)
71
+ */
72
+ pushPostProcessor(postprocessorId: string, versionData: {
73
+ name: string;
74
+ version: string;
75
+ description?: string;
76
+ context?: string;
77
+ postprocessorId: string;
78
+ code: string;
79
+ executeFunction: string;
80
+ async?: boolean;
81
+ }): Promise<ApiResponse<PostProcessorVersionResponse>>;
82
+ /**
83
+ * Retrieves all versions of a specific postprocessor
84
+ */
85
+ getPostProcessorVersions(postprocessorId: string): Promise<ApiResponse<{
86
+ versions: PostProcessorVersion[];
87
+ activeVersionId?: string;
88
+ }>>;
89
+ /**
90
+ * Publishes a specific version of a postprocessor to production
91
+ */
92
+ publishPostProcessorVersion(postprocessorId: string, version: string): Promise<ApiResponse<{
93
+ message: string;
94
+ postprocessorId: string;
95
+ activeVersionId: string;
96
+ publishedAt: string;
97
+ }>>;
98
+ /**
99
+ * Activates a postprocessor
100
+ */
101
+ activatePostProcessor(postprocessorId: string): Promise<ApiResponse<{
102
+ message: string;
103
+ active: boolean;
104
+ }>>;
105
+ /**
106
+ * Deactivates a postprocessor
107
+ */
108
+ deactivatePostProcessor(postprocessorId: string): Promise<ApiResponse<{
109
+ message: string;
110
+ active: boolean;
111
+ }>>;
112
+ /**
113
+ * Deletes a postprocessor
114
+ */
115
+ deletePostProcessor(postprocessorId: string): Promise<ApiResponse<DeletePostProcessorResponse>>;
116
+ /**
117
+ * Pushes a new sandbox (dev) version of a postprocessor
118
+ * Creates a new sandbox version for testing without affecting production
119
+ *
120
+ * @param postprocessorId - The postprocessor ID
121
+ * @param versionData - Version data including code and async flag
122
+ * @returns Sandbox version response with sandboxId
123
+ */
124
+ pushDevPostProcessor(postprocessorId: string, versionData: {
125
+ name: string;
126
+ version?: string;
127
+ description?: string;
128
+ context?: string;
129
+ code: string;
130
+ executeFunction: string;
131
+ async?: boolean;
132
+ }): Promise<ApiResponse<{
133
+ versionId: string;
134
+ postprocessorId: string;
135
+ version: string;
136
+ createdAt: string;
137
+ }>>;
138
+ /**
139
+ * Updates an existing sandbox version of a postprocessor
140
+ *
141
+ * @param postprocessorId - The postprocessor ID
142
+ * @param sandboxVersionId - The sandbox version ID to update
143
+ * @param versionData - Updated version data
144
+ * @returns Update response
145
+ */
146
+ updateDevPostProcessor(postprocessorId: string, sandboxVersionId: string, versionData: {
147
+ name: string;
148
+ version?: string;
149
+ description?: string;
150
+ context?: string;
151
+ code: string;
152
+ executeFunction: string;
153
+ async?: boolean;
154
+ }): Promise<ApiResponse<{
155
+ message: string;
156
+ versionId: string;
157
+ }>>;
158
+ }
@@ -0,0 +1,111 @@
1
+ import { HttpClient } from "../common/http.client.js";
2
+ /**
3
+ * PostProcessor API Service
4
+ * Handles all postprocessor-related API calls
5
+ */
6
+ export default class PostProcessorApi extends HttpClient {
7
+ constructor(baseUrl, apiKey, agentId) {
8
+ super(baseUrl);
9
+ this.apiKey = apiKey;
10
+ this.agentId = agentId;
11
+ }
12
+ /**
13
+ * Retrieves all postprocessors for the agent
14
+ */
15
+ async getPostProcessors() {
16
+ return this.httpGet(`/developer/postprocessors/${this.agentId}`, {
17
+ Authorization: `Bearer ${this.apiKey}`,
18
+ });
19
+ }
20
+ /**
21
+ * Creates a new postprocessor for the agent
22
+ */
23
+ async createPostProcessor(data) {
24
+ return this.httpPost(`/developer/postprocessors/${this.agentId}`, data, {
25
+ Authorization: `Bearer ${this.apiKey}`,
26
+ });
27
+ }
28
+ /**
29
+ * Pushes a new version of a postprocessor
30
+ *
31
+ * @param postprocessorId - The postprocessor ID
32
+ * @param versionData - Version data including code, description, context, and async flag
33
+ * @param versionData.version - Version number
34
+ * @param versionData.code - Compressed execute function code
35
+ * @param versionData.executeFunction - Raw execute function code
36
+ * @param versionData.description - Postprocessor description
37
+ * @param versionData.context - Postprocessor context
38
+ * @param versionData.async - Async execution flag (true = background, false = blocking)
39
+ */
40
+ async pushPostProcessor(postprocessorId, versionData) {
41
+ return this.httpPost(`/developer/postprocessors/${this.agentId}/${postprocessorId}/version`, versionData, {
42
+ Authorization: `Bearer ${this.apiKey}`,
43
+ });
44
+ }
45
+ /**
46
+ * Retrieves all versions of a specific postprocessor
47
+ */
48
+ async getPostProcessorVersions(postprocessorId) {
49
+ return this.httpGet(`/developer/postprocessors/${this.agentId}/${postprocessorId}/versions`, {
50
+ Authorization: `Bearer ${this.apiKey}`,
51
+ });
52
+ }
53
+ /**
54
+ * Publishes a specific version of a postprocessor to production
55
+ */
56
+ async publishPostProcessorVersion(postprocessorId, version) {
57
+ return this.httpPost(`/developer/postprocessors/${this.agentId}/${postprocessorId}/${version}/publish`, {}, {
58
+ Authorization: `Bearer ${this.apiKey}`,
59
+ });
60
+ }
61
+ /**
62
+ * Activates a postprocessor
63
+ */
64
+ async activatePostProcessor(postprocessorId) {
65
+ return this.httpPost(`/developer/postprocessors/${this.agentId}/${postprocessorId}/activate`, {}, {
66
+ Authorization: `Bearer ${this.apiKey}`,
67
+ });
68
+ }
69
+ /**
70
+ * Deactivates a postprocessor
71
+ */
72
+ async deactivatePostProcessor(postprocessorId) {
73
+ return this.httpPost(`/developer/postprocessors/${this.agentId}/${postprocessorId}/deactivate`, {}, {
74
+ Authorization: `Bearer ${this.apiKey}`,
75
+ });
76
+ }
77
+ /**
78
+ * Deletes a postprocessor
79
+ */
80
+ async deletePostProcessor(postprocessorId) {
81
+ return this.httpDelete(`/developer/postprocessors/${this.agentId}/${postprocessorId}`, {
82
+ Authorization: `Bearer ${this.apiKey}`,
83
+ });
84
+ }
85
+ /**
86
+ * Pushes a new sandbox (dev) version of a postprocessor
87
+ * Creates a new sandbox version for testing without affecting production
88
+ *
89
+ * @param postprocessorId - The postprocessor ID
90
+ * @param versionData - Version data including code and async flag
91
+ * @returns Sandbox version response with sandboxId
92
+ */
93
+ async pushDevPostProcessor(postprocessorId, versionData) {
94
+ return this.httpPost(`/developer/postprocessors/${this.agentId}/${postprocessorId}/version/sandbox`, versionData, {
95
+ Authorization: `Bearer ${this.apiKey}`,
96
+ });
97
+ }
98
+ /**
99
+ * Updates an existing sandbox version of a postprocessor
100
+ *
101
+ * @param postprocessorId - The postprocessor ID
102
+ * @param sandboxVersionId - The sandbox version ID to update
103
+ * @param versionData - Updated version data
104
+ * @returns Update response
105
+ */
106
+ async updateDevPostProcessor(postprocessorId, sandboxVersionId, versionData) {
107
+ return this.httpPut(`/developer/postprocessors/${this.agentId}/${postprocessorId}/version/sandbox/${sandboxVersionId}`, versionData, {
108
+ Authorization: `Bearer ${this.apiKey}`,
109
+ });
110
+ }
111
+ }
@@ -0,0 +1,158 @@
1
+ import { HttpClient } from "../common/http.client.js";
2
+ import { ApiResponse } from "../interfaces/common.js";
3
+ /**
4
+ * PreProcessor API Response Types
5
+ */
6
+ export interface PreProcessorVersion {
7
+ version: string;
8
+ preprocessorId: string;
9
+ createdAt: string | number;
10
+ isActive?: boolean;
11
+ }
12
+ export interface GetPreProcessorsResponse {
13
+ preprocessors: Array<{
14
+ id: string;
15
+ name: string;
16
+ description?: string;
17
+ context?: string;
18
+ versions: PreProcessorVersion[];
19
+ activeVersionId?: string;
20
+ }>;
21
+ }
22
+ export interface CreatePreProcessorResponse {
23
+ id: string;
24
+ name: string;
25
+ description?: string;
26
+ agentId: string;
27
+ context?: string;
28
+ }
29
+ export interface PreProcessorVersionResponse {
30
+ versionId: string;
31
+ preprocessorId: string;
32
+ version: string;
33
+ createdAt: string;
34
+ }
35
+ export interface DeletePreProcessorResponse {
36
+ deleted: boolean;
37
+ deactivated?: boolean;
38
+ message: string;
39
+ }
40
+ /**
41
+ * PreProcessor API Service
42
+ * Handles all preprocessor-related API calls
43
+ */
44
+ export default class PreProcessorApi extends HttpClient {
45
+ private apiKey;
46
+ private agentId;
47
+ constructor(baseUrl: string, apiKey: string, agentId: string);
48
+ /**
49
+ * Retrieves all preprocessors for the agent
50
+ */
51
+ getPreProcessors(): Promise<ApiResponse<GetPreProcessorsResponse>>;
52
+ /**
53
+ * Creates a new preprocessor for the agent
54
+ */
55
+ createPreProcessor(data: {
56
+ name: string;
57
+ description?: string;
58
+ context?: string;
59
+ }): Promise<ApiResponse<CreatePreProcessorResponse>>;
60
+ /**
61
+ * Pushes a new version of a preprocessor
62
+ *
63
+ * @param preprocessorId - The preprocessor ID
64
+ * @param versionData - Version data including code, description, context, and async flag
65
+ * @param versionData.version - Version number
66
+ * @param versionData.code - Compressed execute function code
67
+ * @param versionData.executeFunction - Raw execute function code
68
+ * @param versionData.description - Preprocessor description
69
+ * @param versionData.context - Preprocessor context
70
+ * @param versionData.async - Async execution flag (true = background, false = blocking)
71
+ */
72
+ pushPreProcessor(preprocessorId: string, versionData: {
73
+ name: string;
74
+ version: string;
75
+ description?: string;
76
+ context?: string;
77
+ preprocessorId: string;
78
+ code: string;
79
+ executeFunction: string;
80
+ async?: boolean;
81
+ }): Promise<ApiResponse<PreProcessorVersionResponse>>;
82
+ /**
83
+ * Retrieves all versions of a specific preprocessor
84
+ */
85
+ getPreProcessorVersions(preprocessorId: string): Promise<ApiResponse<{
86
+ versions: PreProcessorVersion[];
87
+ activeVersionId?: string;
88
+ }>>;
89
+ /**
90
+ * Publishes a specific version of a preprocessor to production
91
+ */
92
+ publishPreProcessorVersion(preprocessorId: string, version: string): Promise<ApiResponse<{
93
+ message: string;
94
+ preprocessorId: string;
95
+ activeVersionId: string;
96
+ publishedAt: string;
97
+ }>>;
98
+ /**
99
+ * Activates a preprocessor
100
+ */
101
+ activatePreProcessor(preprocessorId: string): Promise<ApiResponse<{
102
+ message: string;
103
+ active: boolean;
104
+ }>>;
105
+ /**
106
+ * Deactivates a preprocessor
107
+ */
108
+ deactivatePreProcessor(preprocessorId: string): Promise<ApiResponse<{
109
+ message: string;
110
+ active: boolean;
111
+ }>>;
112
+ /**
113
+ * Deletes a preprocessor
114
+ */
115
+ deletePreProcessor(preprocessorId: string): Promise<ApiResponse<DeletePreProcessorResponse>>;
116
+ /**
117
+ * Pushes a new sandbox (dev) version of a preprocessor
118
+ * Creates a new sandbox version for testing without affecting production
119
+ *
120
+ * @param preprocessorId - The preprocessor ID
121
+ * @param versionData - Version data including code and async flag
122
+ * @returns Sandbox version response with sandboxId
123
+ */
124
+ pushDevPreProcessor(preprocessorId: string, versionData: {
125
+ name: string;
126
+ version?: string;
127
+ description?: string;
128
+ context?: string;
129
+ code: string;
130
+ executeFunction: string;
131
+ async?: boolean;
132
+ }): Promise<ApiResponse<{
133
+ versionId: string;
134
+ preprocessorId: string;
135
+ version: string;
136
+ createdAt: string;
137
+ }>>;
138
+ /**
139
+ * Updates an existing sandbox version of a preprocessor
140
+ *
141
+ * @param preprocessorId - The preprocessor ID
142
+ * @param sandboxVersionId - The sandbox version ID to update
143
+ * @param versionData - Updated version data
144
+ * @returns Update response
145
+ */
146
+ updateDevPreProcessor(preprocessorId: string, sandboxVersionId: string, versionData: {
147
+ name: string;
148
+ version?: string;
149
+ description?: string;
150
+ context?: string;
151
+ code: string;
152
+ executeFunction: string;
153
+ async?: boolean;
154
+ }): Promise<ApiResponse<{
155
+ message: string;
156
+ versionId: string;
157
+ }>>;
158
+ }
@@ -0,0 +1,111 @@
1
+ import { HttpClient } from "../common/http.client.js";
2
+ /**
3
+ * PreProcessor API Service
4
+ * Handles all preprocessor-related API calls
5
+ */
6
+ export default class PreProcessorApi extends HttpClient {
7
+ constructor(baseUrl, apiKey, agentId) {
8
+ super(baseUrl);
9
+ this.apiKey = apiKey;
10
+ this.agentId = agentId;
11
+ }
12
+ /**
13
+ * Retrieves all preprocessors for the agent
14
+ */
15
+ async getPreProcessors() {
16
+ return this.httpGet(`/developer/preprocessors/${this.agentId}`, {
17
+ Authorization: `Bearer ${this.apiKey}`,
18
+ });
19
+ }
20
+ /**
21
+ * Creates a new preprocessor for the agent
22
+ */
23
+ async createPreProcessor(data) {
24
+ return this.httpPost(`/developer/preprocessors/${this.agentId}`, data, {
25
+ Authorization: `Bearer ${this.apiKey}`,
26
+ });
27
+ }
28
+ /**
29
+ * Pushes a new version of a preprocessor
30
+ *
31
+ * @param preprocessorId - The preprocessor ID
32
+ * @param versionData - Version data including code, description, context, and async flag
33
+ * @param versionData.version - Version number
34
+ * @param versionData.code - Compressed execute function code
35
+ * @param versionData.executeFunction - Raw execute function code
36
+ * @param versionData.description - Preprocessor description
37
+ * @param versionData.context - Preprocessor context
38
+ * @param versionData.async - Async execution flag (true = background, false = blocking)
39
+ */
40
+ async pushPreProcessor(preprocessorId, versionData) {
41
+ return this.httpPost(`/developer/preprocessors/${this.agentId}/${preprocessorId}/version`, versionData, {
42
+ Authorization: `Bearer ${this.apiKey}`,
43
+ });
44
+ }
45
+ /**
46
+ * Retrieves all versions of a specific preprocessor
47
+ */
48
+ async getPreProcessorVersions(preprocessorId) {
49
+ return this.httpGet(`/developer/preprocessors/${this.agentId}/${preprocessorId}/versions`, {
50
+ Authorization: `Bearer ${this.apiKey}`,
51
+ });
52
+ }
53
+ /**
54
+ * Publishes a specific version of a preprocessor to production
55
+ */
56
+ async publishPreProcessorVersion(preprocessorId, version) {
57
+ return this.httpPost(`/developer/preprocessors/${this.agentId}/${preprocessorId}/${version}/publish`, {}, {
58
+ Authorization: `Bearer ${this.apiKey}`,
59
+ });
60
+ }
61
+ /**
62
+ * Activates a preprocessor
63
+ */
64
+ async activatePreProcessor(preprocessorId) {
65
+ return this.httpPost(`/developer/preprocessors/${this.agentId}/${preprocessorId}/activate`, {}, {
66
+ Authorization: `Bearer ${this.apiKey}`,
67
+ });
68
+ }
69
+ /**
70
+ * Deactivates a preprocessor
71
+ */
72
+ async deactivatePreProcessor(preprocessorId) {
73
+ return this.httpPost(`/developer/preprocessors/${this.agentId}/${preprocessorId}/deactivate`, {}, {
74
+ Authorization: `Bearer ${this.apiKey}`,
75
+ });
76
+ }
77
+ /**
78
+ * Deletes a preprocessor
79
+ */
80
+ async deletePreProcessor(preprocessorId) {
81
+ return this.httpDelete(`/developer/preprocessors/${this.agentId}/${preprocessorId}`, {
82
+ Authorization: `Bearer ${this.apiKey}`,
83
+ });
84
+ }
85
+ /**
86
+ * Pushes a new sandbox (dev) version of a preprocessor
87
+ * Creates a new sandbox version for testing without affecting production
88
+ *
89
+ * @param preprocessorId - The preprocessor ID
90
+ * @param versionData - Version data including code and async flag
91
+ * @returns Sandbox version response with sandboxId
92
+ */
93
+ async pushDevPreProcessor(preprocessorId, versionData) {
94
+ return this.httpPost(`/developer/preprocessors/${this.agentId}/${preprocessorId}/version/sandbox`, versionData, {
95
+ Authorization: `Bearer ${this.apiKey}`,
96
+ });
97
+ }
98
+ /**
99
+ * Updates an existing sandbox version of a preprocessor
100
+ *
101
+ * @param preprocessorId - The preprocessor ID
102
+ * @param sandboxVersionId - The sandbox version ID to update
103
+ * @param versionData - Updated version data
104
+ * @returns Update response
105
+ */
106
+ async updateDevPreProcessor(preprocessorId, sandboxVersionId, versionData) {
107
+ return this.httpPut(`/developer/preprocessors/${this.agentId}/${preprocessorId}/version/sandbox/${sandboxVersionId}`, versionData, {
108
+ Authorization: `Bearer ${this.apiKey}`,
109
+ });
110
+ }
111
+ }
@@ -2,6 +2,7 @@ import { HttpClient } from "../common/http.client.js";
2
2
  import UserDataInstance from "../common/user.instance.js";
3
3
  import { Message } from "../interfaces/message.js";
4
4
  import { UserDataAPI } from "../types/index.js";
5
+ import { ChatHistoryMessage } from "../interfaces/chat.js";
5
6
  export default class UserDataApi extends HttpClient implements UserDataAPI {
6
7
  private apiKey;
7
8
  private agentId;
@@ -45,4 +46,16 @@ export default class UserDataApi extends HttpClient implements UserDataAPI {
45
46
  * @throws Error if the admin user cannot be retrieved or the request is unsuccessful
46
47
  */
47
48
  getAdminUser(): Promise<any>;
49
+ /**
50
+ * Gets the chat history for the current user and agent
51
+ * @returns Promise resolving to an array of chat messages
52
+ * @throws Error if the chat history cannot be retrieved or the request is unsuccessful
53
+ *
54
+ * @example
55
+ * ```typescript
56
+ * const history = await User.getChatHistory();
57
+ * // Returns: [{ role: 'user', content: [...], createdAt: '...' }, ...]
58
+ * ```
59
+ */
60
+ getChatHistory(): Promise<ChatHistoryMessage[]>;
48
61
  }
@@ -87,4 +87,24 @@ export default class UserDataApi extends HttpClient {
87
87
  }
88
88
  return response.data;
89
89
  }
90
+ /**
91
+ * Gets the chat history for the current user and agent
92
+ * @returns Promise resolving to an array of chat messages
93
+ * @throws Error if the chat history cannot be retrieved or the request is unsuccessful
94
+ *
95
+ * @example
96
+ * ```typescript
97
+ * const history = await User.getChatHistory();
98
+ * // Returns: [{ role: 'user', content: [...], createdAt: '...' }, ...]
99
+ * ```
100
+ */
101
+ async getChatHistory() {
102
+ const response = await this.httpGet(`/chat/history/${this.agentId}`, {
103
+ Authorization: `Bearer ${this.apiKey}`,
104
+ });
105
+ if (!response.success) {
106
+ throw new Error(response.error?.message || 'Failed to get chat history');
107
+ }
108
+ return response.data || [];
109
+ }
90
110
  }