mavenagi 0.0.0-alpha.4 → 0.0.0-alpha.6

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 (184) hide show
  1. package/Client.d.ts +5 -5
  2. package/Client.js +3 -3
  3. package/README.md +15 -31
  4. package/api/resources/actions/client/Client.d.ts +19 -65
  5. package/api/resources/actions/client/Client.js +31 -292
  6. package/api/resources/actions/types/{Action.d.ts → ActionBase.d.ts} +1 -7
  7. package/api/resources/actions/types/ActionParameter.d.ts +1 -0
  8. package/api/resources/actions/types/ActionRequest.d.ts +21 -0
  9. package/api/resources/actions/types/ActionResponse.d.ts +25 -0
  10. package/api/resources/actions/types/index.d.ts +3 -4
  11. package/api/resources/actions/types/index.js +3 -4
  12. package/api/resources/commons/types/EntityId.d.ts +14 -0
  13. package/api/resources/commons/types/EntityIdBase.d.ts +10 -0
  14. package/api/resources/commons/types/EntityType.d.ts +14 -0
  15. package/api/resources/commons/types/EntityType.js +13 -0
  16. package/api/resources/commons/types/index.d.ts +3 -0
  17. package/api/resources/commons/types/index.js +3 -0
  18. package/api/resources/conversation/client/Client.d.ts +20 -3
  19. package/api/resources/conversation/client/Client.js +118 -25
  20. package/api/resources/conversation/types/ConversationBase.d.ts +0 -2
  21. package/api/resources/conversation/types/ConversationRequest.d.ts +2 -0
  22. package/api/resources/conversation/types/ConversationResponse.d.ts +2 -0
  23. package/api/resources/index.d.ts +1 -1
  24. package/api/resources/index.js +1 -1
  25. package/api/resources/knowledge/client/Client.d.ts +2 -2
  26. package/api/resources/knowledge/client/Client.js +21 -21
  27. package/api/resources/knowledge/types/KnowledgeBase.d.ts +1 -1
  28. package/api/resources/triggers/client/Client.d.ts +14 -12
  29. package/api/resources/triggers/client/Client.js +25 -23
  30. package/{dist/api/resources/triggers/types/EventTrigger.d.ts → api/resources/triggers/types/EventTriggerBase.d.ts} +1 -3
  31. package/api/resources/triggers/types/EventTriggerRequest.d.ts +18 -0
  32. package/api/resources/triggers/types/EventTriggerResponse.d.ts +22 -0
  33. package/api/resources/triggers/types/index.d.ts +3 -1
  34. package/api/resources/triggers/types/index.js +3 -1
  35. package/api/resources/{user → users}/client/Client.d.ts +12 -12
  36. package/api/resources/{user → users}/client/Client.js +11 -11
  37. package/dist/Client.d.ts +5 -5
  38. package/dist/Client.js +3 -3
  39. package/dist/api/resources/actions/client/Client.d.ts +19 -65
  40. package/dist/api/resources/actions/client/Client.js +31 -292
  41. package/dist/api/resources/actions/types/{Action.d.ts → ActionBase.d.ts} +1 -7
  42. package/dist/api/resources/actions/types/ActionParameter.d.ts +1 -0
  43. package/dist/api/resources/actions/types/ActionRequest.d.ts +21 -0
  44. package/dist/api/resources/actions/types/ActionResponse.d.ts +25 -0
  45. package/dist/api/resources/actions/types/ActionResponse.js +4 -0
  46. package/dist/api/resources/actions/types/index.d.ts +3 -4
  47. package/dist/api/resources/actions/types/index.js +3 -4
  48. package/dist/api/resources/commons/types/EntityId.d.ts +14 -0
  49. package/dist/api/resources/commons/types/EntityId.js +4 -0
  50. package/dist/api/resources/commons/types/EntityIdBase.d.ts +10 -0
  51. package/dist/api/resources/commons/types/EntityIdBase.js +4 -0
  52. package/dist/api/resources/commons/types/EntityType.d.ts +14 -0
  53. package/dist/api/resources/commons/types/EntityType.js +13 -0
  54. package/dist/api/resources/commons/types/index.d.ts +3 -0
  55. package/dist/api/resources/commons/types/index.js +3 -0
  56. package/dist/api/resources/conversation/client/Client.d.ts +20 -3
  57. package/dist/api/resources/conversation/client/Client.js +118 -25
  58. package/dist/api/resources/conversation/types/ConversationBase.d.ts +0 -2
  59. package/dist/api/resources/conversation/types/ConversationRequest.d.ts +2 -0
  60. package/dist/api/resources/conversation/types/ConversationResponse.d.ts +2 -0
  61. package/dist/api/resources/index.d.ts +1 -1
  62. package/dist/api/resources/index.js +1 -1
  63. package/dist/api/resources/knowledge/client/Client.d.ts +2 -2
  64. package/dist/api/resources/knowledge/client/Client.js +21 -21
  65. package/dist/api/resources/knowledge/types/KnowledgeBase.d.ts +1 -1
  66. package/dist/api/resources/triggers/client/Client.d.ts +14 -12
  67. package/dist/api/resources/triggers/client/Client.js +25 -23
  68. package/{api/resources/triggers/types/EventTrigger.d.ts → dist/api/resources/triggers/types/EventTriggerBase.d.ts} +1 -3
  69. package/dist/api/resources/triggers/types/EventTriggerBase.js +4 -0
  70. package/dist/api/resources/triggers/types/EventTriggerRequest.d.ts +18 -0
  71. package/dist/api/resources/triggers/types/EventTriggerRequest.js +4 -0
  72. package/dist/api/resources/triggers/types/EventTriggerResponse.d.ts +22 -0
  73. package/dist/api/resources/triggers/types/EventTriggerResponse.js +4 -0
  74. package/dist/api/resources/triggers/types/index.d.ts +3 -1
  75. package/dist/api/resources/triggers/types/index.js +3 -1
  76. package/dist/api/resources/{user → users}/client/Client.d.ts +12 -12
  77. package/dist/api/resources/{user → users}/client/Client.js +11 -11
  78. package/dist/serialization/resources/actions/types/{Action.d.ts → ActionBase.d.ts} +2 -5
  79. package/{serialization/resources/actions/types/Action.js → dist/serialization/resources/actions/types/ActionBase.js} +1 -4
  80. package/dist/serialization/resources/actions/types/ActionParameter.d.ts +1 -0
  81. package/dist/serialization/resources/actions/types/ActionParameter.js +1 -0
  82. package/dist/serialization/resources/actions/types/ActionRequest.d.ts +14 -0
  83. package/dist/serialization/resources/actions/types/ActionRequest.js +11 -0
  84. package/dist/serialization/resources/actions/types/ActionResponse.d.ts +14 -0
  85. package/dist/serialization/resources/actions/types/ActionResponse.js +11 -0
  86. package/dist/serialization/resources/actions/types/index.d.ts +3 -4
  87. package/dist/serialization/resources/actions/types/index.js +3 -4
  88. package/dist/serialization/resources/commons/types/EntityId.d.ts +17 -0
  89. package/dist/serialization/resources/commons/types/EntityId.js +14 -0
  90. package/{serialization/resources/actions/types/ActionSetBase.d.ts → dist/serialization/resources/commons/types/EntityIdBase.d.ts} +3 -4
  91. package/dist/serialization/resources/commons/types/EntityIdBase.js +7 -0
  92. package/dist/serialization/resources/commons/types/EntityType.d.ts +10 -0
  93. package/dist/serialization/resources/commons/types/EntityType.js +14 -0
  94. package/dist/serialization/resources/commons/types/index.d.ts +3 -0
  95. package/dist/serialization/resources/commons/types/index.js +3 -0
  96. package/dist/serialization/resources/conversation/client/addConversationMetadata.d.ts +13 -0
  97. package/dist/serialization/resources/conversation/client/addConversationMetadata.js +6 -0
  98. package/dist/serialization/resources/conversation/client/index.d.ts +1 -0
  99. package/dist/serialization/resources/conversation/client/index.js +1 -0
  100. package/dist/serialization/resources/conversation/types/ConversationBase.d.ts +0 -2
  101. package/dist/serialization/resources/conversation/types/ConversationBase.js +0 -2
  102. package/dist/serialization/resources/conversation/types/ConversationRequest.d.ts +2 -0
  103. package/dist/serialization/resources/conversation/types/ConversationRequest.js +2 -0
  104. package/dist/serialization/resources/conversation/types/ConversationResponse.d.ts +2 -0
  105. package/dist/serialization/resources/conversation/types/ConversationResponse.js +2 -0
  106. package/dist/serialization/resources/triggers/types/{EventTrigger.d.ts → EventTriggerBase.d.ts} +2 -3
  107. package/dist/serialization/resources/triggers/types/{EventTrigger.js → EventTriggerBase.js} +1 -2
  108. package/dist/serialization/resources/triggers/types/EventTriggerRequest.d.ts +14 -0
  109. package/dist/serialization/resources/triggers/types/EventTriggerRequest.js +11 -0
  110. package/dist/serialization/resources/triggers/types/EventTriggerResponse.d.ts +14 -0
  111. package/dist/serialization/resources/triggers/types/EventTriggerResponse.js +11 -0
  112. package/dist/serialization/resources/triggers/types/index.d.ts +3 -1
  113. package/dist/serialization/resources/triggers/types/index.js +3 -1
  114. package/package.json +1 -1
  115. package/serialization/resources/actions/types/{Action.d.ts → ActionBase.d.ts} +2 -5
  116. package/{dist/serialization/resources/actions/types/Action.js → serialization/resources/actions/types/ActionBase.js} +1 -4
  117. package/serialization/resources/actions/types/ActionParameter.d.ts +1 -0
  118. package/serialization/resources/actions/types/ActionParameter.js +1 -0
  119. package/serialization/resources/actions/types/ActionRequest.d.ts +14 -0
  120. package/serialization/resources/actions/types/ActionRequest.js +11 -0
  121. package/serialization/resources/actions/types/ActionResponse.d.ts +14 -0
  122. package/serialization/resources/actions/types/ActionResponse.js +11 -0
  123. package/serialization/resources/actions/types/index.d.ts +3 -4
  124. package/serialization/resources/actions/types/index.js +3 -4
  125. package/serialization/resources/commons/types/EntityId.d.ts +17 -0
  126. package/serialization/resources/commons/types/EntityId.js +14 -0
  127. package/{dist/serialization/resources/actions/types/ActionSetBase.d.ts → serialization/resources/commons/types/EntityIdBase.d.ts} +3 -4
  128. package/serialization/resources/commons/types/EntityIdBase.js +7 -0
  129. package/serialization/resources/commons/types/EntityType.d.ts +10 -0
  130. package/serialization/resources/commons/types/EntityType.js +14 -0
  131. package/serialization/resources/commons/types/index.d.ts +3 -0
  132. package/serialization/resources/commons/types/index.js +3 -0
  133. package/serialization/resources/conversation/client/addConversationMetadata.d.ts +13 -0
  134. package/serialization/resources/conversation/client/addConversationMetadata.js +6 -0
  135. package/serialization/resources/conversation/client/index.d.ts +1 -0
  136. package/serialization/resources/conversation/client/index.js +1 -0
  137. package/serialization/resources/conversation/types/ConversationBase.d.ts +0 -2
  138. package/serialization/resources/conversation/types/ConversationBase.js +0 -2
  139. package/serialization/resources/conversation/types/ConversationRequest.d.ts +2 -0
  140. package/serialization/resources/conversation/types/ConversationRequest.js +2 -0
  141. package/serialization/resources/conversation/types/ConversationResponse.d.ts +2 -0
  142. package/serialization/resources/conversation/types/ConversationResponse.js +2 -0
  143. package/serialization/resources/triggers/types/{EventTrigger.d.ts → EventTriggerBase.d.ts} +2 -3
  144. package/serialization/resources/triggers/types/{EventTrigger.js → EventTriggerBase.js} +1 -2
  145. package/serialization/resources/triggers/types/EventTriggerRequest.d.ts +14 -0
  146. package/serialization/resources/triggers/types/EventTriggerRequest.js +11 -0
  147. package/serialization/resources/triggers/types/EventTriggerResponse.d.ts +14 -0
  148. package/serialization/resources/triggers/types/EventTriggerResponse.js +11 -0
  149. package/serialization/resources/triggers/types/index.d.ts +3 -1
  150. package/serialization/resources/triggers/types/index.js +3 -1
  151. package/api/resources/actions/types/ActionSetBase.d.ts +0 -9
  152. package/api/resources/actions/types/ActionSetRequest.d.ts +0 -6
  153. package/api/resources/actions/types/ActionSetResponse.d.ts +0 -6
  154. package/dist/api/resources/actions/types/ActionSetBase.d.ts +0 -9
  155. package/dist/api/resources/actions/types/ActionSetRequest.d.ts +0 -6
  156. package/dist/api/resources/actions/types/ActionSetResponse.d.ts +0 -6
  157. package/dist/serialization/resources/actions/types/ActionSetBase.js +0 -8
  158. package/dist/serialization/resources/actions/types/ActionSetRequest.d.ts +0 -12
  159. package/dist/serialization/resources/actions/types/ActionSetRequest.js +0 -6
  160. package/dist/serialization/resources/actions/types/ActionSetResponse.d.ts +0 -12
  161. package/dist/serialization/resources/actions/types/ActionSetResponse.js +0 -6
  162. package/serialization/resources/actions/types/ActionSetBase.js +0 -8
  163. package/serialization/resources/actions/types/ActionSetRequest.d.ts +0 -12
  164. package/serialization/resources/actions/types/ActionSetRequest.js +0 -6
  165. package/serialization/resources/actions/types/ActionSetResponse.d.ts +0 -12
  166. package/serialization/resources/actions/types/ActionSetResponse.js +0 -6
  167. /package/api/resources/actions/types/{Action.js → ActionBase.js} +0 -0
  168. /package/api/resources/actions/types/{ActionSetBase.js → ActionRequest.js} +0 -0
  169. /package/api/resources/actions/types/{ActionSetRequest.js → ActionResponse.js} +0 -0
  170. /package/api/resources/{actions/types/ActionSetResponse.js → commons/types/EntityId.js} +0 -0
  171. /package/api/resources/{triggers/types/EventTrigger.js → commons/types/EntityIdBase.js} +0 -0
  172. /package/{dist/api/resources/actions/types/Action.js → api/resources/triggers/types/EventTriggerBase.js} +0 -0
  173. /package/{dist/api/resources/actions/types/ActionSetBase.js → api/resources/triggers/types/EventTriggerRequest.js} +0 -0
  174. /package/{dist/api/resources/actions/types/ActionSetRequest.js → api/resources/triggers/types/EventTriggerResponse.js} +0 -0
  175. /package/api/resources/{user → users}/client/index.d.ts +0 -0
  176. /package/api/resources/{user → users}/client/index.js +0 -0
  177. /package/api/resources/{user → users}/index.d.ts +0 -0
  178. /package/api/resources/{user → users}/index.js +0 -0
  179. /package/dist/api/resources/actions/types/{ActionSetResponse.js → ActionBase.js} +0 -0
  180. /package/dist/api/resources/{triggers/types/EventTrigger.js → actions/types/ActionRequest.js} +0 -0
  181. /package/dist/api/resources/{user → users}/client/index.d.ts +0 -0
  182. /package/dist/api/resources/{user → users}/client/index.js +0 -0
  183. /package/dist/api/resources/{user → users}/index.d.ts +0 -0
  184. /package/dist/api/resources/{user → users}/index.js +0 -0
@@ -20,270 +20,10 @@ export class Actions {
20
20
  constructor(_options) {
21
21
  this._options = _options;
22
22
  }
23
- /**
24
- * Update an action set or create it if it doesn't exist
25
- *
26
- * @param {MavenAGI.ActionSetRequest} request
27
- * @param {Actions.RequestOptions} requestOptions - Request-specific configuration.
28
- *
29
- * @throws {@link MavenAGI.NotFoundError}
30
- * @throws {@link MavenAGI.BadRequestError}
31
- * @throws {@link MavenAGI.ServerError}
32
- *
33
- * @example
34
- * await client.actions.createActionSet({
35
- * id: "string",
36
- * name: "string"
37
- * })
38
- */
39
- createActionSet(request, requestOptions) {
40
- var _a, _b;
41
- return __awaiter(this, void 0, void 0, function* () {
42
- const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
43
- url: urlJoin((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.MavenAGIEnvironment.Production, "/v1/actions/sets"),
44
- method: "POST",
45
- headers: {
46
- Authorization: yield this._getAuthorizationHeader(),
47
- "X-Organization-Id": yield core.Supplier.get(this._options.organizationId),
48
- "X-Agent-Id": yield core.Supplier.get(this._options.agentId),
49
- "X-Fern-Language": "JavaScript",
50
- "X-Fern-SDK-Name": "mavenagi",
51
- "X-Fern-SDK-Version": "0.0.0-alpha.4",
52
- "X-Fern-Runtime": core.RUNTIME.type,
53
- "X-Fern-Runtime-Version": core.RUNTIME.version,
54
- },
55
- contentType: "application/json",
56
- body: yield serializers.ActionSetRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
57
- timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
58
- maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
59
- abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
60
- });
61
- if (_response.ok) {
62
- return yield serializers.ActionSetResponse.parseOrThrow(_response.body, {
63
- unrecognizedObjectKeys: "passthrough",
64
- allowUnrecognizedUnionMembers: true,
65
- allowUnrecognizedEnumValues: true,
66
- breadcrumbsPrefix: ["response"],
67
- });
68
- }
69
- if (_response.error.reason === "status-code") {
70
- switch (_response.error.statusCode) {
71
- case 404:
72
- throw new MavenAGI.NotFoundError(yield serializers.ErrorMessage.parseOrThrow(_response.error.body, {
73
- unrecognizedObjectKeys: "passthrough",
74
- allowUnrecognizedUnionMembers: true,
75
- allowUnrecognizedEnumValues: true,
76
- breadcrumbsPrefix: ["response"],
77
- }));
78
- case 400:
79
- throw new MavenAGI.BadRequestError(yield serializers.ErrorMessage.parseOrThrow(_response.error.body, {
80
- unrecognizedObjectKeys: "passthrough",
81
- allowUnrecognizedUnionMembers: true,
82
- allowUnrecognizedEnumValues: true,
83
- breadcrumbsPrefix: ["response"],
84
- }));
85
- case 500:
86
- throw new MavenAGI.ServerError(yield serializers.ErrorMessage.parseOrThrow(_response.error.body, {
87
- unrecognizedObjectKeys: "passthrough",
88
- allowUnrecognizedUnionMembers: true,
89
- allowUnrecognizedEnumValues: true,
90
- breadcrumbsPrefix: ["response"],
91
- }));
92
- default:
93
- throw new errors.MavenAGIError({
94
- statusCode: _response.error.statusCode,
95
- body: _response.error.body,
96
- });
97
- }
98
- }
99
- switch (_response.error.reason) {
100
- case "non-json":
101
- throw new errors.MavenAGIError({
102
- statusCode: _response.error.statusCode,
103
- body: _response.error.rawBody,
104
- });
105
- case "timeout":
106
- throw new errors.MavenAGITimeoutError();
107
- case "unknown":
108
- throw new errors.MavenAGIError({
109
- message: _response.error.errorMessage,
110
- });
111
- }
112
- });
113
- }
114
- /**
115
- * Get an action set by its supplied ID
116
- *
117
- * @param {string} actionSetId - The ID of the action set to get
118
- * @param {Actions.RequestOptions} requestOptions - Request-specific configuration.
119
- *
120
- * @throws {@link MavenAGI.NotFoundError}
121
- * @throws {@link MavenAGI.BadRequestError}
122
- * @throws {@link MavenAGI.ServerError}
123
- *
124
- * @example
125
- * await client.actions.getActionSet("string")
126
- */
127
- getActionSet(actionSetId, requestOptions) {
128
- var _a, _b;
129
- return __awaiter(this, void 0, void 0, function* () {
130
- const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
131
- url: urlJoin((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.MavenAGIEnvironment.Production, `/v1/actions/sets/${encodeURIComponent(actionSetId)}`),
132
- method: "GET",
133
- headers: {
134
- Authorization: yield this._getAuthorizationHeader(),
135
- "X-Organization-Id": yield core.Supplier.get(this._options.organizationId),
136
- "X-Agent-Id": yield core.Supplier.get(this._options.agentId),
137
- "X-Fern-Language": "JavaScript",
138
- "X-Fern-SDK-Name": "mavenagi",
139
- "X-Fern-SDK-Version": "0.0.0-alpha.4",
140
- "X-Fern-Runtime": core.RUNTIME.type,
141
- "X-Fern-Runtime-Version": core.RUNTIME.version,
142
- },
143
- contentType: "application/json",
144
- timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
145
- maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
146
- abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
147
- });
148
- if (_response.ok) {
149
- return yield serializers.ActionSetResponse.parseOrThrow(_response.body, {
150
- unrecognizedObjectKeys: "passthrough",
151
- allowUnrecognizedUnionMembers: true,
152
- allowUnrecognizedEnumValues: true,
153
- breadcrumbsPrefix: ["response"],
154
- });
155
- }
156
- if (_response.error.reason === "status-code") {
157
- switch (_response.error.statusCode) {
158
- case 404:
159
- throw new MavenAGI.NotFoundError(yield serializers.ErrorMessage.parseOrThrow(_response.error.body, {
160
- unrecognizedObjectKeys: "passthrough",
161
- allowUnrecognizedUnionMembers: true,
162
- allowUnrecognizedEnumValues: true,
163
- breadcrumbsPrefix: ["response"],
164
- }));
165
- case 400:
166
- throw new MavenAGI.BadRequestError(yield serializers.ErrorMessage.parseOrThrow(_response.error.body, {
167
- unrecognizedObjectKeys: "passthrough",
168
- allowUnrecognizedUnionMembers: true,
169
- allowUnrecognizedEnumValues: true,
170
- breadcrumbsPrefix: ["response"],
171
- }));
172
- case 500:
173
- throw new MavenAGI.ServerError(yield serializers.ErrorMessage.parseOrThrow(_response.error.body, {
174
- unrecognizedObjectKeys: "passthrough",
175
- allowUnrecognizedUnionMembers: true,
176
- allowUnrecognizedEnumValues: true,
177
- breadcrumbsPrefix: ["response"],
178
- }));
179
- default:
180
- throw new errors.MavenAGIError({
181
- statusCode: _response.error.statusCode,
182
- body: _response.error.body,
183
- });
184
- }
185
- }
186
- switch (_response.error.reason) {
187
- case "non-json":
188
- throw new errors.MavenAGIError({
189
- statusCode: _response.error.statusCode,
190
- body: _response.error.rawBody,
191
- });
192
- case "timeout":
193
- throw new errors.MavenAGITimeoutError();
194
- case "unknown":
195
- throw new errors.MavenAGIError({
196
- message: _response.error.errorMessage,
197
- });
198
- }
199
- });
200
- }
201
- /**
202
- * Delete an action set
203
- *
204
- * @param {string} actionSetId - The ID of the action set to delete
205
- * @param {Actions.RequestOptions} requestOptions - Request-specific configuration.
206
- *
207
- * @throws {@link MavenAGI.NotFoundError}
208
- * @throws {@link MavenAGI.BadRequestError}
209
- * @throws {@link MavenAGI.ServerError}
210
- *
211
- * @example
212
- * await client.actions.deleteActionSet("string")
213
- */
214
- deleteActionSet(actionSetId, requestOptions) {
215
- var _a, _b;
216
- return __awaiter(this, void 0, void 0, function* () {
217
- const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
218
- url: urlJoin((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.MavenAGIEnvironment.Production, `/v1/actions/sets/${encodeURIComponent(actionSetId)}`),
219
- method: "DELETE",
220
- headers: {
221
- Authorization: yield this._getAuthorizationHeader(),
222
- "X-Organization-Id": yield core.Supplier.get(this._options.organizationId),
223
- "X-Agent-Id": yield core.Supplier.get(this._options.agentId),
224
- "X-Fern-Language": "JavaScript",
225
- "X-Fern-SDK-Name": "mavenagi",
226
- "X-Fern-SDK-Version": "0.0.0-alpha.4",
227
- "X-Fern-Runtime": core.RUNTIME.type,
228
- "X-Fern-Runtime-Version": core.RUNTIME.version,
229
- },
230
- contentType: "application/json",
231
- timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
232
- maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
233
- abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
234
- });
235
- if (_response.ok) {
236
- return;
237
- }
238
- if (_response.error.reason === "status-code") {
239
- switch (_response.error.statusCode) {
240
- case 404:
241
- throw new MavenAGI.NotFoundError(yield serializers.ErrorMessage.parseOrThrow(_response.error.body, {
242
- unrecognizedObjectKeys: "passthrough",
243
- allowUnrecognizedUnionMembers: true,
244
- allowUnrecognizedEnumValues: true,
245
- breadcrumbsPrefix: ["response"],
246
- }));
247
- case 400:
248
- throw new MavenAGI.BadRequestError(yield serializers.ErrorMessage.parseOrThrow(_response.error.body, {
249
- unrecognizedObjectKeys: "passthrough",
250
- allowUnrecognizedUnionMembers: true,
251
- allowUnrecognizedEnumValues: true,
252
- breadcrumbsPrefix: ["response"],
253
- }));
254
- case 500:
255
- throw new MavenAGI.ServerError(yield serializers.ErrorMessage.parseOrThrow(_response.error.body, {
256
- unrecognizedObjectKeys: "passthrough",
257
- allowUnrecognizedUnionMembers: true,
258
- allowUnrecognizedEnumValues: true,
259
- breadcrumbsPrefix: ["response"],
260
- }));
261
- default:
262
- throw new errors.MavenAGIError({
263
- statusCode: _response.error.statusCode,
264
- body: _response.error.body,
265
- });
266
- }
267
- }
268
- switch (_response.error.reason) {
269
- case "non-json":
270
- throw new errors.MavenAGIError({
271
- statusCode: _response.error.statusCode,
272
- body: _response.error.rawBody,
273
- });
274
- case "timeout":
275
- throw new errors.MavenAGITimeoutError();
276
- case "unknown":
277
- throw new errors.MavenAGIError({
278
- message: _response.error.errorMessage,
279
- });
280
- }
281
- });
282
- }
283
23
  /**
284
24
  * Update an action or create it if it doesn't exist
285
25
  *
286
- * @param {MavenAGI.Action} request
26
+ * @param {MavenAGI.ActionRequest} request
287
27
  * @param {Actions.RequestOptions} requestOptions - Request-specific configuration.
288
28
  *
289
29
  * @throws {@link MavenAGI.NotFoundError}
@@ -291,19 +31,18 @@ export class Actions {
291
31
  * @throws {@link MavenAGI.ServerError}
292
32
  *
293
33
  * @example
294
- * await client.actions.registerAction({
295
- * id: "string",
296
- * actionSetId: "string",
297
- * appId: "string",
298
- * name: "string",
299
- * description: "string",
300
- * userInteractionRequired: true,
301
- * buttonName: "string",
302
- * requiredUserContextFieldNames: new Set(["string"]),
303
- * userFormParameters: [{}]
34
+ * await client.actions.createOrUpdateAction({
35
+ * entityId: {
36
+ * referenceId: "get-balance"
37
+ * },
38
+ * name: "Get the user's balance",
39
+ * description: "This action calls an API to get the user's current balance.",
40
+ * userInteractionRequired: false,
41
+ * requiredUserContextFieldNames: new Set(["my-billing-system.userId"]),
42
+ * userFormParameters: []
304
43
  * })
305
44
  */
306
- registerAction(request, requestOptions) {
45
+ createOrUpdateAction(request, requestOptions) {
307
46
  var _a, _b;
308
47
  return __awaiter(this, void 0, void 0, function* () {
309
48
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
@@ -311,22 +50,22 @@ export class Actions {
311
50
  method: "PUT",
312
51
  headers: {
313
52
  Authorization: yield this._getAuthorizationHeader(),
314
- "X-Organization-Id": yield core.Supplier.get(this._options.organizationId),
315
- "X-Agent-Id": yield core.Supplier.get(this._options.agentId),
53
+ "X-Organization-Id": yield core.Supplier.get(this._options.xOrganizationId),
54
+ "X-Agent-Id": yield core.Supplier.get(this._options.xAgentId),
316
55
  "X-Fern-Language": "JavaScript",
317
56
  "X-Fern-SDK-Name": "mavenagi",
318
- "X-Fern-SDK-Version": "0.0.0-alpha.4",
57
+ "X-Fern-SDK-Version": "0.0.0-alpha.6",
319
58
  "X-Fern-Runtime": core.RUNTIME.type,
320
59
  "X-Fern-Runtime-Version": core.RUNTIME.version,
321
60
  },
322
61
  contentType: "application/json",
323
- body: yield serializers.Action.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
62
+ body: yield serializers.ActionRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
324
63
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
325
64
  maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
326
65
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
327
66
  });
328
67
  if (_response.ok) {
329
- return yield serializers.Action.parseOrThrow(_response.body, {
68
+ return yield serializers.ActionResponse.parseOrThrow(_response.body, {
330
69
  unrecognizedObjectKeys: "passthrough",
331
70
  allowUnrecognizedUnionMembers: true,
332
71
  allowUnrecognizedEnumValues: true,
@@ -381,7 +120,7 @@ export class Actions {
381
120
  /**
382
121
  * Get an action by its supplied ID
383
122
  *
384
- * @param {string} actionId - The ID of the action to get
123
+ * @param {string} referenceId - The reference ID of the action to get. All other entity ID fields are inferred from the request.
385
124
  * @param {Actions.RequestOptions} requestOptions - Request-specific configuration.
386
125
  *
387
126
  * @throws {@link MavenAGI.NotFoundError}
@@ -389,21 +128,21 @@ export class Actions {
389
128
  * @throws {@link MavenAGI.ServerError}
390
129
  *
391
130
  * @example
392
- * await client.actions.getAction("string")
131
+ * await client.actions.getAction("get-balance")
393
132
  */
394
- getAction(actionId, requestOptions) {
133
+ getAction(referenceId, requestOptions) {
395
134
  var _a, _b;
396
135
  return __awaiter(this, void 0, void 0, function* () {
397
136
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
398
- url: urlJoin((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.MavenAGIEnvironment.Production, `/v1/actions/${encodeURIComponent(actionId)}`),
137
+ url: urlJoin((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.MavenAGIEnvironment.Production, `/v1/actions/${encodeURIComponent(referenceId)}`),
399
138
  method: "GET",
400
139
  headers: {
401
140
  Authorization: yield this._getAuthorizationHeader(),
402
- "X-Organization-Id": yield core.Supplier.get(this._options.organizationId),
403
- "X-Agent-Id": yield core.Supplier.get(this._options.agentId),
141
+ "X-Organization-Id": yield core.Supplier.get(this._options.xOrganizationId),
142
+ "X-Agent-Id": yield core.Supplier.get(this._options.xAgentId),
404
143
  "X-Fern-Language": "JavaScript",
405
144
  "X-Fern-SDK-Name": "mavenagi",
406
- "X-Fern-SDK-Version": "0.0.0-alpha.4",
145
+ "X-Fern-SDK-Version": "0.0.0-alpha.6",
407
146
  "X-Fern-Runtime": core.RUNTIME.type,
408
147
  "X-Fern-Runtime-Version": core.RUNTIME.version,
409
148
  },
@@ -413,7 +152,7 @@ export class Actions {
413
152
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
414
153
  });
415
154
  if (_response.ok) {
416
- return yield serializers.Action.parseOrThrow(_response.body, {
155
+ return yield serializers.ActionResponse.parseOrThrow(_response.body, {
417
156
  unrecognizedObjectKeys: "passthrough",
418
157
  allowUnrecognizedUnionMembers: true,
419
158
  allowUnrecognizedEnumValues: true,
@@ -468,7 +207,7 @@ export class Actions {
468
207
  /**
469
208
  * Delete an action
470
209
  *
471
- * @param {string} actionId - The ID of the action to delete
210
+ * @param {string} referenceId - The reference ID of the action to unregister. All other entity ID fields are inferred from the request.
472
211
  * @param {Actions.RequestOptions} requestOptions - Request-specific configuration.
473
212
  *
474
213
  * @throws {@link MavenAGI.NotFoundError}
@@ -476,21 +215,21 @@ export class Actions {
476
215
  * @throws {@link MavenAGI.ServerError}
477
216
  *
478
217
  * @example
479
- * await client.actions.deleteAction("string")
218
+ * await client.actions.deleteAction("get-balance")
480
219
  */
481
- deleteAction(actionId, requestOptions) {
220
+ deleteAction(referenceId, requestOptions) {
482
221
  var _a, _b;
483
222
  return __awaiter(this, void 0, void 0, function* () {
484
223
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
485
- url: urlJoin((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.MavenAGIEnvironment.Production, `/v1/actions/${encodeURIComponent(actionId)}`),
224
+ url: urlJoin((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.MavenAGIEnvironment.Production, `/v1/actions/${encodeURIComponent(referenceId)}`),
486
225
  method: "DELETE",
487
226
  headers: {
488
227
  Authorization: yield this._getAuthorizationHeader(),
489
- "X-Organization-Id": yield core.Supplier.get(this._options.organizationId),
490
- "X-Agent-Id": yield core.Supplier.get(this._options.agentId),
228
+ "X-Organization-Id": yield core.Supplier.get(this._options.xOrganizationId),
229
+ "X-Agent-Id": yield core.Supplier.get(this._options.xAgentId),
491
230
  "X-Fern-Language": "JavaScript",
492
231
  "X-Fern-SDK-Name": "mavenagi",
493
- "X-Fern-SDK-Version": "0.0.0-alpha.4",
232
+ "X-Fern-SDK-Version": "0.0.0-alpha.6",
494
233
  "X-Fern-Runtime": core.RUNTIME.type,
495
234
  "X-Fern-Runtime-Version": core.RUNTIME.version,
496
235
  },
@@ -2,13 +2,7 @@
2
2
  * This file was auto-generated by Fern from our API Definition.
3
3
  */
4
4
  import * as MavenAGI from "../../../index";
5
- export interface Action {
6
- /** Externally supplied ID to uniquely identify this action */
7
- id: string;
8
- /** The ID of the action set this action belongs to. Must be an existing action set ID. */
9
- actionSetId: string;
10
- /** The maven app id of the app that runs this action */
11
- appId: string;
5
+ export interface ActionBase {
12
6
  /** The name of the action */
13
7
  name: string;
14
8
  /** The description of the action. This helps Maven decide when to trigger the action and is not displayed directly to the end user. */
@@ -3,6 +3,7 @@
3
3
  */
4
4
  export interface ActionParameter {
5
5
  id: string;
6
+ label: string;
6
7
  description: string;
7
8
  required: boolean;
8
9
  }
@@ -0,0 +1,21 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as MavenAGI from "../../../index";
5
+ /**
6
+ * @example
7
+ * {
8
+ * entityId: {
9
+ * referenceId: "get-balance"
10
+ * },
11
+ * name: "Get the user's balance",
12
+ * description: "This action calls an API to get the user's current balance.",
13
+ * userInteractionRequired: false,
14
+ * requiredUserContextFieldNames: new Set(["my-billing-system.userId"]),
15
+ * userFormParameters: []
16
+ * }
17
+ */
18
+ export interface ActionRequest extends MavenAGI.ActionBase {
19
+ /** ID that uniquely identifies this action */
20
+ entityId: MavenAGI.EntityIdBase;
21
+ }
@@ -0,0 +1,25 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as MavenAGI from "../../../index";
5
+ /**
6
+ * @example
7
+ * {
8
+ * entityId: {
9
+ * referenceId: "get-balance",
10
+ * appId: "my-billing-system",
11
+ * organizationId: "acme",
12
+ * agentId: "support",
13
+ * type: MavenAGI.EntityType.Action
14
+ * },
15
+ * name: "Get the user's balance",
16
+ * description: "This action calls an API to get the user's current balance.",
17
+ * userInteractionRequired: false,
18
+ * requiredUserContextFieldNames: new Set(["my-billing-system.userId"]),
19
+ * userFormParameters: []
20
+ * }
21
+ */
22
+ export interface ActionResponse extends MavenAGI.ActionBase {
23
+ /** ID that uniquely identifies this action */
24
+ entityId: MavenAGI.EntityId;
25
+ }
@@ -1,5 +1,4 @@
1
- export * from "./ActionSetBase";
2
- export * from "./ActionSetRequest";
3
- export * from "./ActionSetResponse";
4
- export * from "./Action";
1
+ export * from "./ActionBase";
5
2
  export * from "./ActionParameter";
3
+ export * from "./ActionRequest";
4
+ export * from "./ActionResponse";
@@ -1,5 +1,4 @@
1
- export * from "./ActionSetBase";
2
- export * from "./ActionSetRequest";
3
- export * from "./ActionSetResponse";
4
- export * from "./Action";
1
+ export * from "./ActionBase";
5
2
  export * from "./ActionParameter";
3
+ export * from "./ActionRequest";
4
+ export * from "./ActionResponse";
@@ -0,0 +1,14 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as MavenAGI from "../../../index";
5
+ export interface EntityId extends MavenAGI.EntityIdBase {
6
+ /** The object type */
7
+ type: MavenAGI.EntityType;
8
+ /** The ID of the application that created this object */
9
+ appId: string;
10
+ /** The ID of the organization that this object belongs too */
11
+ organizationId: string;
12
+ /** The ID of the agent that this object belongs too */
13
+ agentId: string;
14
+ }
@@ -0,0 +1,10 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ /**
5
+ * All other entityId fields are inferred from the API request.
6
+ */
7
+ export interface EntityIdBase {
8
+ /** Externally supplied ID to uniquely identify this object. Is globally unique when combined with all other entityId fields (type, appId, organizationId, agentId) */
9
+ referenceId: string;
10
+ }
@@ -0,0 +1,14 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ export declare type EntityType = "CONVERSATION" | "CONVERSATION_MESSAGE" | "KNOWLEDGE_BASE" | "KNOWLEDGE_DOCUMENT" | "ACTION" | "USER" | "USER_EVENT" | "EVENT_TRIGGER";
5
+ export declare const EntityType: {
6
+ readonly Conversation: "CONVERSATION";
7
+ readonly ConversationMessage: "CONVERSATION_MESSAGE";
8
+ readonly KnowledgeBase: "KNOWLEDGE_BASE";
9
+ readonly KnowledgeDocument: "KNOWLEDGE_DOCUMENT";
10
+ readonly Action: "ACTION";
11
+ readonly User: "USER";
12
+ readonly UserEvent: "USER_EVENT";
13
+ readonly EventTrigger: "EVENT_TRIGGER";
14
+ };
@@ -0,0 +1,13 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ export const EntityType = {
5
+ Conversation: "CONVERSATION",
6
+ ConversationMessage: "CONVERSATION_MESSAGE",
7
+ KnowledgeBase: "KNOWLEDGE_BASE",
8
+ KnowledgeDocument: "KNOWLEDGE_DOCUMENT",
9
+ Action: "ACTION",
10
+ User: "USER",
11
+ UserEvent: "USER_EVENT",
12
+ EventTrigger: "EVENT_TRIGGER",
13
+ };
@@ -1,4 +1,7 @@
1
1
  export * from "./ErrorMessage";
2
+ export * from "./EntityType";
3
+ export * from "./EntityIdBase";
4
+ export * from "./EntityId";
2
5
  export * from "./User";
3
6
  export * from "./FeedbackType";
4
7
  export * from "./Feedback";
@@ -1,4 +1,7 @@
1
1
  export * from "./ErrorMessage";
2
+ export * from "./EntityType";
3
+ export * from "./EntityIdBase";
4
+ export * from "./EntityId";
2
5
  export * from "./User";
3
6
  export * from "./FeedbackType";
4
7
  export * from "./Feedback";
@@ -9,8 +9,8 @@ export declare namespace Conversation {
9
9
  environment?: core.Supplier<environments.MavenAGIEnvironment | string>;
10
10
  appId?: core.Supplier<string | undefined>;
11
11
  appSecret?: core.Supplier<string | undefined>;
12
- organizationId: core.Supplier<string>;
13
- agentId: core.Supplier<string>;
12
+ xOrganizationId: core.Supplier<string>;
13
+ xAgentId: core.Supplier<string>;
14
14
  fetcher?: core.FetchFunction;
15
15
  }
16
16
  interface RequestOptions {
@@ -35,8 +35,8 @@ export declare class Conversation {
35
35
  * @example
36
36
  * await client.conversation.initialize({
37
37
  * messages: [{}],
38
- * id: "string",
39
38
  * context: {},
39
+ * id: "string",
40
40
  * responseConfig: {
41
41
  * capabilities: [MavenAGI.Capability.Markdown],
42
42
  * isCopilot: true,
@@ -172,5 +172,22 @@ export declare class Conversation {
172
172
  * })
173
173
  */
174
174
  submitActionForm(conversationId: string, request: MavenAGI.ActionExecutionRequest, requestOptions?: Conversation.RequestOptions): Promise<MavenAGI.ActionExecutionResponse>;
175
+ /**
176
+ * Add metadata to an existing conversation's Context. If a metadata field already exists, it will be overwritten.
177
+ *
178
+ * @param {string} conversationId - The ID of a conversation the metadata being added belongs to
179
+ * @param {Record<string, string>} request
180
+ * @param {Conversation.RequestOptions} requestOptions - Request-specific configuration.
181
+ *
182
+ * @throws {@link MavenAGI.NotFoundError}
183
+ * @throws {@link MavenAGI.BadRequestError}
184
+ * @throws {@link MavenAGI.ServerError}
185
+ *
186
+ * @example
187
+ * await client.conversation.addConversationMetadata("string", {
188
+ * "string": "string"
189
+ * })
190
+ */
191
+ addConversationMetadata(conversationId: string, request: Record<string, string>, requestOptions?: Conversation.RequestOptions): Promise<Record<string, string>>;
175
192
  protected _getAuthorizationHeader(): Promise<string | undefined>;
176
193
  }