@getmodus/sdk 0.1.0
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.
- package/CHANGELOG.md +48 -0
- package/LICENSE +21 -0
- package/README.md +79 -0
- package/dist/chunk-VLHNZJBG.js +1681 -0
- package/dist/chunk-VLHNZJBG.js.map +1 -0
- package/dist/conversations-nx1ujbiv.d.cts +19329 -0
- package/dist/conversations-nx1ujbiv.d.ts +19329 -0
- package/dist/index.cjs +2546 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +365 -0
- package/dist/index.d.ts +365 -0
- package/dist/index.js +888 -0
- package/dist/index.js.map +1 -0
- package/dist/management/index.cjs +2514 -0
- package/dist/management/index.cjs.map +1 -0
- package/dist/management/index.d.cts +351 -0
- package/dist/management/index.d.ts +351 -0
- package/dist/management/index.js +896 -0
- package/dist/management/index.js.map +1 -0
- package/package.json +71 -0
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,2546 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/index.ts
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
|
+
APIConnectionError: () => APIConnectionError,
|
|
24
|
+
AuthenticationError: () => AuthenticationError,
|
|
25
|
+
ChatStream: () => ChatStream,
|
|
26
|
+
ConflictError: () => ConflictError,
|
|
27
|
+
InternalServerError: () => InternalServerError,
|
|
28
|
+
Modus: () => Modus,
|
|
29
|
+
ModusError: () => ModusError,
|
|
30
|
+
NotFoundError: () => NotFoundError,
|
|
31
|
+
OPERATIONS: () => OPERATIONS,
|
|
32
|
+
Page: () => Page,
|
|
33
|
+
PermissionDeniedError: () => PermissionDeniedError,
|
|
34
|
+
RateLimitError: () => RateLimitError,
|
|
35
|
+
RunCancelledError: () => RunCancelledError,
|
|
36
|
+
StreamTimeoutError: () => StreamTimeoutError,
|
|
37
|
+
UnprocessableError: () => UnprocessableError,
|
|
38
|
+
ValidationError: () => ValidationError,
|
|
39
|
+
conversationSkillId: () => conversationSkillId
|
|
40
|
+
});
|
|
41
|
+
module.exports = __toCommonJS(index_exports);
|
|
42
|
+
|
|
43
|
+
// src/_generated/operations.ts
|
|
44
|
+
var OPERATIONS = {
|
|
45
|
+
"ConnectionsController_list": {
|
|
46
|
+
method: "GET",
|
|
47
|
+
path: "/api/v1/connections",
|
|
48
|
+
service: "modus-api",
|
|
49
|
+
serverUrl: "https://api.modus.com",
|
|
50
|
+
pathParams: [],
|
|
51
|
+
queryParams: ["pageToken", "pageSize", "type"],
|
|
52
|
+
requestSchema: null,
|
|
53
|
+
responseSchema: "ListConnectionsResponseDto"
|
|
54
|
+
},
|
|
55
|
+
"ContextCreatorsController_createLink": {
|
|
56
|
+
method: "POST",
|
|
57
|
+
path: "/api/v1/context/links",
|
|
58
|
+
service: "modus-api",
|
|
59
|
+
serverUrl: "https://api.modus.com",
|
|
60
|
+
pathParams: [],
|
|
61
|
+
queryParams: [],
|
|
62
|
+
requestSchema: "CreateLinkDto",
|
|
63
|
+
responseSchema: "CreatedContextItemResponseDto"
|
|
64
|
+
},
|
|
65
|
+
"ContextCreatorsController_createNote": {
|
|
66
|
+
method: "POST",
|
|
67
|
+
path: "/api/v1/context/notes",
|
|
68
|
+
service: "modus-api",
|
|
69
|
+
serverUrl: "https://api.modus.com",
|
|
70
|
+
pathParams: [],
|
|
71
|
+
queryParams: [],
|
|
72
|
+
requestSchema: "CreateNoteDto",
|
|
73
|
+
responseSchema: "CreatedContextItemResponseDto"
|
|
74
|
+
},
|
|
75
|
+
"ContextCreatorsController_createSavedQuery": {
|
|
76
|
+
method: "POST",
|
|
77
|
+
path: "/api/v1/context/saved-queries",
|
|
78
|
+
service: "modus-api",
|
|
79
|
+
serverUrl: "https://api.modus.com",
|
|
80
|
+
pathParams: [],
|
|
81
|
+
queryParams: [],
|
|
82
|
+
requestSchema: "CreateSavedQueryDto",
|
|
83
|
+
responseSchema: "CreatedContextItemResponseDto"
|
|
84
|
+
},
|
|
85
|
+
"ContextItemsController_delete": {
|
|
86
|
+
method: "DELETE",
|
|
87
|
+
path: "/api/v1/context/items/{uid}",
|
|
88
|
+
service: "modus-api",
|
|
89
|
+
serverUrl: "https://api.modus.com",
|
|
90
|
+
pathParams: ["uid"],
|
|
91
|
+
queryParams: [],
|
|
92
|
+
requestSchema: null,
|
|
93
|
+
responseSchema: "DeleteContextItemResponseDto"
|
|
94
|
+
},
|
|
95
|
+
"ContextItemsController_get": {
|
|
96
|
+
method: "GET",
|
|
97
|
+
path: "/api/v1/context/items/{uid}",
|
|
98
|
+
service: "modus-api",
|
|
99
|
+
serverUrl: "https://api.modus.com",
|
|
100
|
+
pathParams: ["uid"],
|
|
101
|
+
queryParams: [],
|
|
102
|
+
requestSchema: null,
|
|
103
|
+
responseSchema: "ContextItemDto"
|
|
104
|
+
},
|
|
105
|
+
"ContextItemsController_list": {
|
|
106
|
+
method: "GET",
|
|
107
|
+
path: "/api/v1/context/items",
|
|
108
|
+
service: "modus-api",
|
|
109
|
+
serverUrl: "https://api.modus.com",
|
|
110
|
+
pathParams: [],
|
|
111
|
+
queryParams: ["pageToken", "pageSize", "contextTypes", "verificationStatuses", "searchQuery", "topics"],
|
|
112
|
+
requestSchema: null,
|
|
113
|
+
responseSchema: "ListContextItemsResponseDto"
|
|
114
|
+
},
|
|
115
|
+
"ContextItemsController_listValues": {
|
|
116
|
+
method: "GET",
|
|
117
|
+
path: "/api/v1/context/items/{uid}/values",
|
|
118
|
+
service: "modus-api",
|
|
119
|
+
serverUrl: "https://api.modus.com",
|
|
120
|
+
pathParams: ["uid"],
|
|
121
|
+
queryParams: ["contextType", "contentKeyPath", "pageSize", "offset", "pageToken", "searchQuery", "dataPathPrefix"],
|
|
122
|
+
requestSchema: null,
|
|
123
|
+
responseSchema: "ListContextItemValuesResponseDto"
|
|
124
|
+
},
|
|
125
|
+
"ContextItemsController_lookup": {
|
|
126
|
+
method: "POST",
|
|
127
|
+
path: "/api/v1/context/items/lookup",
|
|
128
|
+
service: "modus-api",
|
|
129
|
+
serverUrl: "https://api.modus.com",
|
|
130
|
+
pathParams: [],
|
|
131
|
+
queryParams: [],
|
|
132
|
+
requestSchema: "LookupContextItemDto",
|
|
133
|
+
responseSchema: "LookupContextItemResponseDto"
|
|
134
|
+
},
|
|
135
|
+
"ContextItemsController_update": {
|
|
136
|
+
method: "PATCH",
|
|
137
|
+
path: "/api/v1/context/items/{uid}",
|
|
138
|
+
service: "modus-api",
|
|
139
|
+
serverUrl: "https://api.modus.com",
|
|
140
|
+
pathParams: ["uid"],
|
|
141
|
+
queryParams: ["updateMask"],
|
|
142
|
+
requestSchema: "UpdateContextItemDto",
|
|
143
|
+
responseSchema: null
|
|
144
|
+
},
|
|
145
|
+
"CustomContextItemsController_batchCreate": {
|
|
146
|
+
method: "POST",
|
|
147
|
+
path: "/api/v1/context/custom-items/batch",
|
|
148
|
+
service: "modus-api",
|
|
149
|
+
serverUrl: "https://api.modus.com",
|
|
150
|
+
pathParams: [],
|
|
151
|
+
queryParams: [],
|
|
152
|
+
requestSchema: "BatchCreateCustomContextItemsDto",
|
|
153
|
+
responseSchema: "BatchCreateCustomContextItemsResponseDto"
|
|
154
|
+
},
|
|
155
|
+
"CustomContextItemsController_create": {
|
|
156
|
+
method: "POST",
|
|
157
|
+
path: "/api/v1/context/custom-items",
|
|
158
|
+
service: "modus-api",
|
|
159
|
+
serverUrl: "https://api.modus.com",
|
|
160
|
+
pathParams: [],
|
|
161
|
+
queryParams: [],
|
|
162
|
+
requestSchema: "CreateCustomContextItemDto",
|
|
163
|
+
responseSchema: "CreatedCustomContextItemResponseDto"
|
|
164
|
+
},
|
|
165
|
+
"CustomContextItemsController_delete": {
|
|
166
|
+
method: "DELETE",
|
|
167
|
+
path: "/api/v1/context/custom-items/{uid}",
|
|
168
|
+
service: "modus-api",
|
|
169
|
+
serverUrl: "https://api.modus.com",
|
|
170
|
+
pathParams: ["uid"],
|
|
171
|
+
queryParams: [],
|
|
172
|
+
requestSchema: null,
|
|
173
|
+
responseSchema: "DeleteContextItemResponseDto"
|
|
174
|
+
},
|
|
175
|
+
"CustomContextItemsController_get": {
|
|
176
|
+
method: "GET",
|
|
177
|
+
path: "/api/v1/context/custom-items/{uid}",
|
|
178
|
+
service: "modus-api",
|
|
179
|
+
serverUrl: "https://api.modus.com",
|
|
180
|
+
pathParams: ["uid"],
|
|
181
|
+
queryParams: [],
|
|
182
|
+
requestSchema: null,
|
|
183
|
+
responseSchema: "ContextItemDto"
|
|
184
|
+
},
|
|
185
|
+
"CustomContextItemsController_list": {
|
|
186
|
+
method: "GET",
|
|
187
|
+
path: "/api/v1/context/custom-items",
|
|
188
|
+
service: "modus-api",
|
|
189
|
+
serverUrl: "https://api.modus.com",
|
|
190
|
+
pathParams: [],
|
|
191
|
+
queryParams: ["pageToken", "pageSize", "contextTypes", "verificationStatuses", "searchQuery", "topics"],
|
|
192
|
+
requestSchema: null,
|
|
193
|
+
responseSchema: "ListCustomContextItemsResponseDto"
|
|
194
|
+
},
|
|
195
|
+
"CustomContextItemsController_update": {
|
|
196
|
+
method: "PATCH",
|
|
197
|
+
path: "/api/v1/context/custom-items/{uid}",
|
|
198
|
+
service: "modus-api",
|
|
199
|
+
serverUrl: "https://api.modus.com",
|
|
200
|
+
pathParams: ["uid"],
|
|
201
|
+
queryParams: [],
|
|
202
|
+
requestSchema: "UpdateCustomContextItemDto",
|
|
203
|
+
responseSchema: null
|
|
204
|
+
},
|
|
205
|
+
"EvaluationsController_getConfig": {
|
|
206
|
+
method: "GET",
|
|
207
|
+
path: "/api/v1/scopes/{id}/evaluations/config",
|
|
208
|
+
service: "modus-api",
|
|
209
|
+
serverUrl: "https://api.modus.com",
|
|
210
|
+
pathParams: ["id"],
|
|
211
|
+
queryParams: [],
|
|
212
|
+
requestSchema: null,
|
|
213
|
+
responseSchema: "EvaluationConfigDto"
|
|
214
|
+
},
|
|
215
|
+
"EvaluationsController_getRun": {
|
|
216
|
+
method: "GET",
|
|
217
|
+
path: "/api/v1/scopes/{id}/evaluations/runs/{runId}",
|
|
218
|
+
service: "modus-api",
|
|
219
|
+
serverUrl: "https://api.modus.com",
|
|
220
|
+
pathParams: ["id", "runId"],
|
|
221
|
+
queryParams: [],
|
|
222
|
+
requestSchema: null,
|
|
223
|
+
responseSchema: "EvaluationRunWithResultsDto"
|
|
224
|
+
},
|
|
225
|
+
"EvaluationsController_listRuns": {
|
|
226
|
+
method: "GET",
|
|
227
|
+
path: "/api/v1/scopes/{id}/evaluations/runs",
|
|
228
|
+
service: "modus-api",
|
|
229
|
+
serverUrl: "https://api.modus.com",
|
|
230
|
+
pathParams: ["id"],
|
|
231
|
+
queryParams: ["pageSize", "pageToken"],
|
|
232
|
+
requestSchema: null,
|
|
233
|
+
responseSchema: "ListEvaluationRunsResponseDto"
|
|
234
|
+
},
|
|
235
|
+
"EvaluationsController_triggerRun": {
|
|
236
|
+
method: "POST",
|
|
237
|
+
path: "/api/v1/scopes/{id}/evaluations/runs",
|
|
238
|
+
service: "modus-api",
|
|
239
|
+
serverUrl: "https://api.modus.com",
|
|
240
|
+
pathParams: ["id"],
|
|
241
|
+
queryParams: [],
|
|
242
|
+
requestSchema: null,
|
|
243
|
+
responseSchema: "TriggerEvaluationRunResponseDto"
|
|
244
|
+
},
|
|
245
|
+
"EvaluationsController_updateConfig": {
|
|
246
|
+
method: "PUT",
|
|
247
|
+
path: "/api/v1/scopes/{id}/evaluations/config",
|
|
248
|
+
service: "modus-api",
|
|
249
|
+
serverUrl: "https://api.modus.com",
|
|
250
|
+
pathParams: ["id"],
|
|
251
|
+
queryParams: [],
|
|
252
|
+
requestSchema: "UpdateEvaluationConfigDto",
|
|
253
|
+
responseSchema: "EvaluationConfigDto"
|
|
254
|
+
},
|
|
255
|
+
"MemberGroupsController_list": {
|
|
256
|
+
method: "GET",
|
|
257
|
+
path: "/api/v1/users/member-groups",
|
|
258
|
+
service: "modus-api",
|
|
259
|
+
serverUrl: "https://api.modus.com",
|
|
260
|
+
pathParams: [],
|
|
261
|
+
queryParams: ["pageSize", "pageToken"],
|
|
262
|
+
requestSchema: null,
|
|
263
|
+
responseSchema: "ListMemberGroupsResponseDto"
|
|
264
|
+
},
|
|
265
|
+
"ModusChatController_chat": {
|
|
266
|
+
method: "POST",
|
|
267
|
+
path: "/api/v1/modus/chat",
|
|
268
|
+
service: "modus-api",
|
|
269
|
+
serverUrl: "https://api.modus.com",
|
|
270
|
+
pathParams: [],
|
|
271
|
+
queryParams: [],
|
|
272
|
+
requestSchema: "ModusChatRequestDto",
|
|
273
|
+
responseSchema: "ModusChatResponseDto"
|
|
274
|
+
},
|
|
275
|
+
"ModusChatController_chatContinue": {
|
|
276
|
+
method: "POST",
|
|
277
|
+
path: "/api/v1/modus/conversations/{threadId}/chat",
|
|
278
|
+
service: "modus-api",
|
|
279
|
+
serverUrl: "https://api.modus.com",
|
|
280
|
+
pathParams: ["threadId"],
|
|
281
|
+
queryParams: [],
|
|
282
|
+
requestSchema: "ModusChatRequestDto",
|
|
283
|
+
responseSchema: "ModusChatResponseDto"
|
|
284
|
+
},
|
|
285
|
+
"ModusContextController_compose": {
|
|
286
|
+
method: "POST",
|
|
287
|
+
path: "/api/v1/modus/context",
|
|
288
|
+
service: "modus-api",
|
|
289
|
+
serverUrl: "https://api.modus.com",
|
|
290
|
+
pathParams: [],
|
|
291
|
+
queryParams: [],
|
|
292
|
+
requestSchema: "ModusContextRequestDto",
|
|
293
|
+
responseSchema: "ModusContextResponseDto"
|
|
294
|
+
},
|
|
295
|
+
"ModusConversationsController_get": {
|
|
296
|
+
method: "GET",
|
|
297
|
+
path: "/api/v1/modus/conversations/{threadId}",
|
|
298
|
+
service: "modus-api",
|
|
299
|
+
serverUrl: "https://api.modus.com",
|
|
300
|
+
pathParams: ["threadId"],
|
|
301
|
+
queryParams: [],
|
|
302
|
+
requestSchema: null,
|
|
303
|
+
responseSchema: "ConversationDto"
|
|
304
|
+
},
|
|
305
|
+
"ModusConversationsController_list": {
|
|
306
|
+
method: "GET",
|
|
307
|
+
path: "/api/v1/modus/conversations",
|
|
308
|
+
service: "modus-api",
|
|
309
|
+
serverUrl: "https://api.modus.com",
|
|
310
|
+
pathParams: [],
|
|
311
|
+
queryParams: ["pageToken", "page", "pageSize", "userId", "toolName", "timeframe", "includeTools", "kind"],
|
|
312
|
+
requestSchema: null,
|
|
313
|
+
responseSchema: "ListConversationsResponseDto"
|
|
314
|
+
},
|
|
315
|
+
"ModusRunsController_create": {
|
|
316
|
+
method: "POST",
|
|
317
|
+
path: "/agent/v1/modus/runs",
|
|
318
|
+
service: "agent-service",
|
|
319
|
+
serverUrl: "https://agent.modus.com",
|
|
320
|
+
pathParams: [],
|
|
321
|
+
queryParams: [],
|
|
322
|
+
requestSchema: "ModusRunDto",
|
|
323
|
+
responseSchema: null
|
|
324
|
+
},
|
|
325
|
+
"OrgMembersController_list": {
|
|
326
|
+
method: "GET",
|
|
327
|
+
path: "/api/v1/users/org-members",
|
|
328
|
+
service: "modus-api",
|
|
329
|
+
serverUrl: "https://api.modus.com",
|
|
330
|
+
pathParams: [],
|
|
331
|
+
queryParams: ["pageSize", "pageToken"],
|
|
332
|
+
requestSchema: null,
|
|
333
|
+
responseSchema: "ListOrgMembersResponseDto"
|
|
334
|
+
},
|
|
335
|
+
"OrganizationController_deleteOrganization": {
|
|
336
|
+
method: "DELETE",
|
|
337
|
+
path: "/api/v1/users/organization",
|
|
338
|
+
service: "modus-api",
|
|
339
|
+
serverUrl: "https://api.modus.com",
|
|
340
|
+
pathParams: [],
|
|
341
|
+
queryParams: [],
|
|
342
|
+
requestSchema: null,
|
|
343
|
+
responseSchema: null
|
|
344
|
+
},
|
|
345
|
+
"ResumeRunsController_create": {
|
|
346
|
+
method: "POST",
|
|
347
|
+
path: "/agent/v1/runs/{runId}/resume",
|
|
348
|
+
service: "agent-service",
|
|
349
|
+
serverUrl: "https://agent.modus.com",
|
|
350
|
+
pathParams: ["runId"],
|
|
351
|
+
queryParams: [],
|
|
352
|
+
requestSchema: "ResumeRunDto",
|
|
353
|
+
responseSchema: null
|
|
354
|
+
},
|
|
355
|
+
"RunLifecycleController_active": {
|
|
356
|
+
method: "GET",
|
|
357
|
+
path: "/agent/v1/runs/active",
|
|
358
|
+
service: "agent-service",
|
|
359
|
+
serverUrl: "https://agent.modus.com",
|
|
360
|
+
pathParams: [],
|
|
361
|
+
queryParams: ["pageToken", "pageSize"],
|
|
362
|
+
requestSchema: null,
|
|
363
|
+
responseSchema: "ActiveRunsResponseDto"
|
|
364
|
+
},
|
|
365
|
+
"RunLifecycleController_activeBySession": {
|
|
366
|
+
method: "POST",
|
|
367
|
+
path: "/agent/v1/runs/active-by-session",
|
|
368
|
+
service: "agent-service",
|
|
369
|
+
serverUrl: "https://agent.modus.com",
|
|
370
|
+
pathParams: [],
|
|
371
|
+
queryParams: [],
|
|
372
|
+
requestSchema: "ActiveRunsBySessionDto",
|
|
373
|
+
responseSchema: "ActiveRunsBySessionResponseDto"
|
|
374
|
+
},
|
|
375
|
+
"RunLifecycleController_cancel": {
|
|
376
|
+
method: "POST",
|
|
377
|
+
path: "/agent/v1/runs/{runId}/cancel",
|
|
378
|
+
service: "agent-service",
|
|
379
|
+
serverUrl: "https://agent.modus.com",
|
|
380
|
+
pathParams: ["runId"],
|
|
381
|
+
queryParams: [],
|
|
382
|
+
requestSchema: "CancelRunDto",
|
|
383
|
+
responseSchema: null
|
|
384
|
+
},
|
|
385
|
+
"RunLifecycleController_editQueued": {
|
|
386
|
+
method: "POST",
|
|
387
|
+
path: "/agent/v1/runs/{runId}/queue-edit",
|
|
388
|
+
service: "agent-service",
|
|
389
|
+
serverUrl: "https://agent.modus.com",
|
|
390
|
+
pathParams: ["runId"],
|
|
391
|
+
queryParams: [],
|
|
392
|
+
requestSchema: "EditQueuedRunDto",
|
|
393
|
+
responseSchema: null
|
|
394
|
+
},
|
|
395
|
+
"RunLifecycleController_events": {
|
|
396
|
+
method: "GET",
|
|
397
|
+
path: "/agent/v1/runs/{runId}/events",
|
|
398
|
+
service: "agent-service",
|
|
399
|
+
serverUrl: "https://agent.modus.com",
|
|
400
|
+
pathParams: ["runId"],
|
|
401
|
+
queryParams: [],
|
|
402
|
+
requestSchema: null,
|
|
403
|
+
responseSchema: null
|
|
404
|
+
},
|
|
405
|
+
"RunLifecycleController_interrupt": {
|
|
406
|
+
method: "POST",
|
|
407
|
+
path: "/agent/v1/runs/{runId}/interrupt",
|
|
408
|
+
service: "agent-service",
|
|
409
|
+
serverUrl: "https://agent.modus.com",
|
|
410
|
+
pathParams: ["runId"],
|
|
411
|
+
queryParams: [],
|
|
412
|
+
requestSchema: "InterruptRunDto",
|
|
413
|
+
responseSchema: null
|
|
414
|
+
},
|
|
415
|
+
"RunLifecycleController_stream": {
|
|
416
|
+
method: "GET",
|
|
417
|
+
path: "/agent/v1/runs/{runId}/stream",
|
|
418
|
+
service: "agent-service",
|
|
419
|
+
serverUrl: "https://agent.modus.com",
|
|
420
|
+
pathParams: ["runId"],
|
|
421
|
+
queryParams: [],
|
|
422
|
+
requestSchema: null,
|
|
423
|
+
responseSchema: null
|
|
424
|
+
},
|
|
425
|
+
"ScopeChatController_chat": {
|
|
426
|
+
method: "POST",
|
|
427
|
+
path: "/api/v1/scopes/{id}/chat",
|
|
428
|
+
service: "modus-api",
|
|
429
|
+
serverUrl: "https://api.modus.com",
|
|
430
|
+
pathParams: ["id"],
|
|
431
|
+
queryParams: [],
|
|
432
|
+
requestSchema: "SkillChatRequestDto",
|
|
433
|
+
responseSchema: "SkillChatResponseDto"
|
|
434
|
+
},
|
|
435
|
+
"ScopeChatController_chatContinue": {
|
|
436
|
+
method: "POST",
|
|
437
|
+
path: "/api/v1/scopes/{id}/conversations/{threadId}/chat",
|
|
438
|
+
service: "modus-api",
|
|
439
|
+
serverUrl: "https://api.modus.com",
|
|
440
|
+
pathParams: ["id", "threadId"],
|
|
441
|
+
queryParams: [],
|
|
442
|
+
requestSchema: "SkillChatRequestDto",
|
|
443
|
+
responseSchema: "SkillChatResponseDto"
|
|
444
|
+
},
|
|
445
|
+
"ScopeContextController_compose": {
|
|
446
|
+
method: "POST",
|
|
447
|
+
path: "/api/v1/scopes/{id}/context",
|
|
448
|
+
service: "modus-api",
|
|
449
|
+
serverUrl: "https://api.modus.com",
|
|
450
|
+
pathParams: ["id"],
|
|
451
|
+
queryParams: [],
|
|
452
|
+
requestSchema: "ComposeSkillContextRequestDto",
|
|
453
|
+
responseSchema: "ComposeSkillContextResponseDto"
|
|
454
|
+
},
|
|
455
|
+
"ScopeConversationsController_get": {
|
|
456
|
+
method: "GET",
|
|
457
|
+
path: "/api/v1/scopes/{id}/conversations/{threadId}",
|
|
458
|
+
service: "modus-api",
|
|
459
|
+
serverUrl: "https://api.modus.com",
|
|
460
|
+
pathParams: ["id", "threadId"],
|
|
461
|
+
queryParams: ["messageLimit", "beforeMessageIndex"],
|
|
462
|
+
requestSchema: null,
|
|
463
|
+
responseSchema: "ConversationDto"
|
|
464
|
+
},
|
|
465
|
+
"ScopeConversationsController_list": {
|
|
466
|
+
method: "GET",
|
|
467
|
+
path: "/api/v1/scopes/{id}/conversations",
|
|
468
|
+
service: "modus-api",
|
|
469
|
+
serverUrl: "https://api.modus.com",
|
|
470
|
+
pathParams: ["id"],
|
|
471
|
+
queryParams: ["pageToken", "page", "pageSize", "userId", "toolName", "timeframe", "includeTools"],
|
|
472
|
+
requestSchema: null,
|
|
473
|
+
responseSchema: "ListConversationsResponseDto"
|
|
474
|
+
},
|
|
475
|
+
"ScopeMemoriesController_delete": {
|
|
476
|
+
method: "DELETE",
|
|
477
|
+
path: "/api/v1/scopes/{id}/memories/{memoryId}",
|
|
478
|
+
service: "modus-api",
|
|
479
|
+
serverUrl: "https://api.modus.com",
|
|
480
|
+
pathParams: ["id", "memoryId"],
|
|
481
|
+
queryParams: [],
|
|
482
|
+
requestSchema: null,
|
|
483
|
+
responseSchema: null
|
|
484
|
+
},
|
|
485
|
+
"ScopeMemoriesController_list": {
|
|
486
|
+
method: "GET",
|
|
487
|
+
path: "/api/v1/scopes/{id}/memories",
|
|
488
|
+
service: "modus-api",
|
|
489
|
+
serverUrl: "https://api.modus.com",
|
|
490
|
+
pathParams: ["id"],
|
|
491
|
+
queryParams: ["pageToken", "pageSize", "userId", "limit"],
|
|
492
|
+
requestSchema: null,
|
|
493
|
+
responseSchema: "ListMemoriesResponseDto"
|
|
494
|
+
},
|
|
495
|
+
"ScopeMemoriesController_search": {
|
|
496
|
+
method: "POST",
|
|
497
|
+
path: "/api/v1/scopes/{id}/memories/search",
|
|
498
|
+
service: "modus-api",
|
|
499
|
+
serverUrl: "https://api.modus.com",
|
|
500
|
+
pathParams: ["id"],
|
|
501
|
+
queryParams: [],
|
|
502
|
+
requestSchema: "SearchMemoriesRequestDto",
|
|
503
|
+
responseSchema: "ListMemoriesResponseDto"
|
|
504
|
+
},
|
|
505
|
+
"ScopeMemoriesController_update": {
|
|
506
|
+
method: "PATCH",
|
|
507
|
+
path: "/api/v1/scopes/{id}/memories/{memoryId}",
|
|
508
|
+
service: "modus-api",
|
|
509
|
+
serverUrl: "https://api.modus.com",
|
|
510
|
+
pathParams: ["id", "memoryId"],
|
|
511
|
+
queryParams: ["updateMask"],
|
|
512
|
+
requestSchema: "UpdateMemoryRequestDto",
|
|
513
|
+
responseSchema: null
|
|
514
|
+
},
|
|
515
|
+
"ScopeRunsController_create": {
|
|
516
|
+
method: "POST",
|
|
517
|
+
path: "/agent/v1/scopes/{id}/runs",
|
|
518
|
+
service: "agent-service",
|
|
519
|
+
serverUrl: "https://agent.modus.com",
|
|
520
|
+
pathParams: ["id"],
|
|
521
|
+
queryParams: [],
|
|
522
|
+
requestSchema: "SkillRunDto",
|
|
523
|
+
responseSchema: null
|
|
524
|
+
},
|
|
525
|
+
"ScopeSupervisionController_get": {
|
|
526
|
+
method: "GET",
|
|
527
|
+
path: "/api/v1/scopes/{id}/supervision",
|
|
528
|
+
service: "modus-api",
|
|
529
|
+
serverUrl: "https://api.modus.com",
|
|
530
|
+
pathParams: ["id"],
|
|
531
|
+
queryParams: ["view"],
|
|
532
|
+
requestSchema: null,
|
|
533
|
+
responseSchema: "SupervisionDto"
|
|
534
|
+
},
|
|
535
|
+
"ScopeSupervisionController_set": {
|
|
536
|
+
method: "PUT",
|
|
537
|
+
path: "/api/v1/scopes/{id}/supervision",
|
|
538
|
+
service: "modus-api",
|
|
539
|
+
serverUrl: "https://api.modus.com",
|
|
540
|
+
pathParams: ["id"],
|
|
541
|
+
queryParams: [],
|
|
542
|
+
requestSchema: "SetSupervisionRequestDto",
|
|
543
|
+
responseSchema: "SupervisionDto"
|
|
544
|
+
},
|
|
545
|
+
"ScopeSupervisionController_setActive": {
|
|
546
|
+
method: "PUT",
|
|
547
|
+
path: "/api/v1/scopes/{id}/supervision/active",
|
|
548
|
+
service: "modus-api",
|
|
549
|
+
serverUrl: "https://api.modus.com",
|
|
550
|
+
pathParams: ["id"],
|
|
551
|
+
queryParams: [],
|
|
552
|
+
requestSchema: "SetSupervisionRequestDto",
|
|
553
|
+
responseSchema: "SupervisionDto"
|
|
554
|
+
},
|
|
555
|
+
"ScopesController_acceptOwnershipTransfer": {
|
|
556
|
+
method: "POST",
|
|
557
|
+
path: "/api/v1/scopes/{id}/transfer-ownership/accept",
|
|
558
|
+
service: "modus-api",
|
|
559
|
+
serverUrl: "https://api.modus.com",
|
|
560
|
+
pathParams: ["id"],
|
|
561
|
+
queryParams: [],
|
|
562
|
+
requestSchema: null,
|
|
563
|
+
responseSchema: "SkillDto"
|
|
564
|
+
},
|
|
565
|
+
"ScopesController_cancelOwnershipTransfer": {
|
|
566
|
+
method: "DELETE",
|
|
567
|
+
path: "/api/v1/scopes/{id}/transfer-ownership",
|
|
568
|
+
service: "modus-api",
|
|
569
|
+
serverUrl: "https://api.modus.com",
|
|
570
|
+
pathParams: ["id"],
|
|
571
|
+
queryParams: [],
|
|
572
|
+
requestSchema: null,
|
|
573
|
+
responseSchema: "SkillDto"
|
|
574
|
+
},
|
|
575
|
+
"ScopesController_create": {
|
|
576
|
+
method: "POST",
|
|
577
|
+
path: "/api/v1/scopes",
|
|
578
|
+
service: "modus-api",
|
|
579
|
+
serverUrl: "https://api.modus.com",
|
|
580
|
+
pathParams: [],
|
|
581
|
+
queryParams: [],
|
|
582
|
+
requestSchema: "CreateSkillDto",
|
|
583
|
+
responseSchema: "SkillDto"
|
|
584
|
+
},
|
|
585
|
+
"ScopesController_delete": {
|
|
586
|
+
method: "DELETE",
|
|
587
|
+
path: "/api/v1/scopes/{id}",
|
|
588
|
+
service: "modus-api",
|
|
589
|
+
serverUrl: "https://api.modus.com",
|
|
590
|
+
pathParams: ["id"],
|
|
591
|
+
queryParams: [],
|
|
592
|
+
requestSchema: null,
|
|
593
|
+
responseSchema: null
|
|
594
|
+
},
|
|
595
|
+
"ScopesController_deploy": {
|
|
596
|
+
method: "POST",
|
|
597
|
+
path: "/api/v1/scopes/{id}/deploy",
|
|
598
|
+
service: "modus-api",
|
|
599
|
+
serverUrl: "https://api.modus.com",
|
|
600
|
+
pathParams: ["id"],
|
|
601
|
+
queryParams: [],
|
|
602
|
+
requestSchema: "DeploySkillDto",
|
|
603
|
+
responseSchema: "DeployResponseDto"
|
|
604
|
+
},
|
|
605
|
+
"ScopesController_get": {
|
|
606
|
+
method: "GET",
|
|
607
|
+
path: "/api/v1/scopes/{id}",
|
|
608
|
+
service: "modus-api",
|
|
609
|
+
serverUrl: "https://api.modus.com",
|
|
610
|
+
pathParams: ["id"],
|
|
611
|
+
queryParams: ["view"],
|
|
612
|
+
requestSchema: null,
|
|
613
|
+
responseSchema: "SkillDto"
|
|
614
|
+
},
|
|
615
|
+
"ScopesController_getVariation": {
|
|
616
|
+
method: "GET",
|
|
617
|
+
path: "/api/v1/scopes/{id}/variations/{variationUid}",
|
|
618
|
+
service: "modus-api",
|
|
619
|
+
serverUrl: "https://api.modus.com",
|
|
620
|
+
pathParams: ["id", "variationUid"],
|
|
621
|
+
queryParams: [],
|
|
622
|
+
requestSchema: null,
|
|
623
|
+
responseSchema: "SkillDto"
|
|
624
|
+
},
|
|
625
|
+
"ScopesController_list": {
|
|
626
|
+
method: "GET",
|
|
627
|
+
path: "/api/v1/scopes",
|
|
628
|
+
service: "modus-api",
|
|
629
|
+
serverUrl: "https://api.modus.com",
|
|
630
|
+
pathParams: [],
|
|
631
|
+
queryParams: ["pageToken", "pageSize", "view", "search", "managerId", "includeVariation"],
|
|
632
|
+
requestSchema: null,
|
|
633
|
+
responseSchema: "ListSkillsResponseDto"
|
|
634
|
+
},
|
|
635
|
+
"ScopesController_patchMcpConfig": {
|
|
636
|
+
method: "PATCH",
|
|
637
|
+
path: "/api/v1/scopes/{id}/mcp-config",
|
|
638
|
+
service: "modus-api",
|
|
639
|
+
serverUrl: "https://api.modus.com",
|
|
640
|
+
pathParams: ["id"],
|
|
641
|
+
queryParams: [],
|
|
642
|
+
requestSchema: "PatchSkillMcpConfigDto",
|
|
643
|
+
responseSchema: "PatchSkillMcpConfigResponseDto"
|
|
644
|
+
},
|
|
645
|
+
"ScopesController_requestOwnershipTransfer": {
|
|
646
|
+
method: "POST",
|
|
647
|
+
path: "/api/v1/scopes/{id}/transfer-ownership",
|
|
648
|
+
service: "modus-api",
|
|
649
|
+
serverUrl: "https://api.modus.com",
|
|
650
|
+
pathParams: ["id"],
|
|
651
|
+
queryParams: [],
|
|
652
|
+
requestSchema: "TransferOwnershipDto",
|
|
653
|
+
responseSchema: "SkillDto"
|
|
654
|
+
},
|
|
655
|
+
"ScopesController_restore": {
|
|
656
|
+
method: "POST",
|
|
657
|
+
path: "/api/v1/scopes/{id}/restore",
|
|
658
|
+
service: "modus-api",
|
|
659
|
+
serverUrl: "https://api.modus.com",
|
|
660
|
+
pathParams: ["id"],
|
|
661
|
+
queryParams: [],
|
|
662
|
+
requestSchema: null,
|
|
663
|
+
responseSchema: "SkillDto"
|
|
664
|
+
},
|
|
665
|
+
"ScopesController_update": {
|
|
666
|
+
method: "PATCH",
|
|
667
|
+
path: "/api/v1/scopes/{id}",
|
|
668
|
+
service: "modus-api",
|
|
669
|
+
serverUrl: "https://api.modus.com",
|
|
670
|
+
pathParams: ["id"],
|
|
671
|
+
queryParams: ["updateMask"],
|
|
672
|
+
requestSchema: "UpdateSkillDto",
|
|
673
|
+
responseSchema: "SkillDto"
|
|
674
|
+
},
|
|
675
|
+
"SuggestionsController_listApproved": {
|
|
676
|
+
method: "GET",
|
|
677
|
+
path: "/api/v1/suggestions/questions",
|
|
678
|
+
service: "modus-api",
|
|
679
|
+
serverUrl: "https://api.modus.com",
|
|
680
|
+
pathParams: [],
|
|
681
|
+
queryParams: ["pageToken", "pageSize", "skill_id", "skill_ids"],
|
|
682
|
+
requestSchema: null,
|
|
683
|
+
responseSchema: "ListSuggestionQuestionsResponseDto"
|
|
684
|
+
},
|
|
685
|
+
"SuggestionsController_recordEvent": {
|
|
686
|
+
method: "POST",
|
|
687
|
+
path: "/api/v1/suggestions/questions/{id}/events",
|
|
688
|
+
service: "modus-api",
|
|
689
|
+
serverUrl: "https://api.modus.com",
|
|
690
|
+
pathParams: ["id"],
|
|
691
|
+
queryParams: [],
|
|
692
|
+
requestSchema: "RecordSuggestionEventDto",
|
|
693
|
+
responseSchema: null
|
|
694
|
+
},
|
|
695
|
+
"UsageController_list": {
|
|
696
|
+
method: "GET",
|
|
697
|
+
path: "/api/v1/usage",
|
|
698
|
+
service: "modus-api",
|
|
699
|
+
serverUrl: "https://api.modus.com",
|
|
700
|
+
pathParams: [],
|
|
701
|
+
queryParams: ["since", "until", "rollup", "model", "group_by", "skill_id", "agent_id", "user_id", "interface"],
|
|
702
|
+
requestSchema: null,
|
|
703
|
+
responseSchema: "ListUsageResponseDto"
|
|
704
|
+
},
|
|
705
|
+
"WorkflowActionsController_cancel": {
|
|
706
|
+
method: "POST",
|
|
707
|
+
path: "/agent/v1/workflow-actions/{runId}/cancel",
|
|
708
|
+
service: "agent-service",
|
|
709
|
+
serverUrl: "https://agent.modus.com",
|
|
710
|
+
pathParams: ["runId"],
|
|
711
|
+
queryParams: [],
|
|
712
|
+
requestSchema: "CancelRunDto",
|
|
713
|
+
responseSchema: null
|
|
714
|
+
},
|
|
715
|
+
"WorkflowActionsController_execute": {
|
|
716
|
+
method: "POST",
|
|
717
|
+
path: "/agent/v1/workflow-actions",
|
|
718
|
+
service: "agent-service",
|
|
719
|
+
serverUrl: "https://agent.modus.com",
|
|
720
|
+
pathParams: [],
|
|
721
|
+
queryParams: [],
|
|
722
|
+
requestSchema: "WorkflowActionDto",
|
|
723
|
+
responseSchema: null
|
|
724
|
+
},
|
|
725
|
+
"WorkflowInterfacesController_add": {
|
|
726
|
+
method: "POST",
|
|
727
|
+
path: "/api/v1/workflows/{id}/interfaces",
|
|
728
|
+
service: "modus-api",
|
|
729
|
+
serverUrl: "https://api.modus.com",
|
|
730
|
+
pathParams: ["id"],
|
|
731
|
+
queryParams: [],
|
|
732
|
+
requestSchema: "AddAgentInterfaceDto",
|
|
733
|
+
responseSchema: "AgentInterfaceDto"
|
|
734
|
+
},
|
|
735
|
+
"WorkflowInterfacesController_delete": {
|
|
736
|
+
method: "DELETE",
|
|
737
|
+
path: "/api/v1/workflows/{id}/interfaces/{interfaceId}",
|
|
738
|
+
service: "modus-api",
|
|
739
|
+
serverUrl: "https://api.modus.com",
|
|
740
|
+
pathParams: ["id", "interfaceId"],
|
|
741
|
+
queryParams: [],
|
|
742
|
+
requestSchema: null,
|
|
743
|
+
responseSchema: null
|
|
744
|
+
},
|
|
745
|
+
"WorkflowInterfacesController_deleteAll": {
|
|
746
|
+
method: "DELETE",
|
|
747
|
+
path: "/api/v1/workflows/{id}/interfaces",
|
|
748
|
+
service: "modus-api",
|
|
749
|
+
serverUrl: "https://api.modus.com",
|
|
750
|
+
pathParams: ["id"],
|
|
751
|
+
queryParams: [],
|
|
752
|
+
requestSchema: null,
|
|
753
|
+
responseSchema: null
|
|
754
|
+
},
|
|
755
|
+
"WorkflowInterfacesController_list": {
|
|
756
|
+
method: "GET",
|
|
757
|
+
path: "/api/v1/workflows/{id}/interfaces",
|
|
758
|
+
service: "modus-api",
|
|
759
|
+
serverUrl: "https://api.modus.com",
|
|
760
|
+
pathParams: ["id"],
|
|
761
|
+
queryParams: ["pageSize", "pageToken"],
|
|
762
|
+
requestSchema: null,
|
|
763
|
+
responseSchema: "ListAgentInterfacesResponseDto"
|
|
764
|
+
},
|
|
765
|
+
"WorkflowInterfacesController_update": {
|
|
766
|
+
method: "PATCH",
|
|
767
|
+
path: "/api/v1/workflows/{id}/interfaces/{interfaceId}",
|
|
768
|
+
service: "modus-api",
|
|
769
|
+
serverUrl: "https://api.modus.com",
|
|
770
|
+
pathParams: ["id", "interfaceId"],
|
|
771
|
+
queryParams: ["updateMask"],
|
|
772
|
+
requestSchema: "UpdateAgentInterfaceDto",
|
|
773
|
+
responseSchema: "AgentInterfaceDto"
|
|
774
|
+
},
|
|
775
|
+
"WorkflowRunsController_create": {
|
|
776
|
+
method: "POST",
|
|
777
|
+
path: "/agent/v1/workflows/{id}/runs",
|
|
778
|
+
service: "agent-service",
|
|
779
|
+
serverUrl: "https://agent.modus.com",
|
|
780
|
+
pathParams: ["id"],
|
|
781
|
+
queryParams: [],
|
|
782
|
+
requestSchema: "AgentRunDto",
|
|
783
|
+
responseSchema: null
|
|
784
|
+
},
|
|
785
|
+
"WorkflowRunsController_get": {
|
|
786
|
+
method: "GET",
|
|
787
|
+
path: "/api/v1/workflows/{id}/runs/{runId}",
|
|
788
|
+
service: "modus-api",
|
|
789
|
+
serverUrl: "https://api.modus.com",
|
|
790
|
+
pathParams: ["id", "runId"],
|
|
791
|
+
queryParams: ["temporalRunId"],
|
|
792
|
+
requestSchema: null,
|
|
793
|
+
responseSchema: "GetAutomationRunResponseDto"
|
|
794
|
+
},
|
|
795
|
+
"WorkflowRunsController_list": {
|
|
796
|
+
method: "GET",
|
|
797
|
+
path: "/api/v1/workflows/{id}/runs",
|
|
798
|
+
service: "modus-api",
|
|
799
|
+
serverUrl: "https://api.modus.com",
|
|
800
|
+
pathParams: ["id"],
|
|
801
|
+
queryParams: ["status", "timeframe", "approvalScope", "search", "pageSize", "pageToken"],
|
|
802
|
+
requestSchema: null,
|
|
803
|
+
responseSchema: "ListAutomationRunsResponseDto"
|
|
804
|
+
},
|
|
805
|
+
"WorkflowsController_acceptOwnershipTransfer": {
|
|
806
|
+
method: "POST",
|
|
807
|
+
path: "/api/v1/workflows/{id}/transfer-ownership/accept",
|
|
808
|
+
service: "modus-api",
|
|
809
|
+
serverUrl: "https://api.modus.com",
|
|
810
|
+
pathParams: ["id"],
|
|
811
|
+
queryParams: [],
|
|
812
|
+
requestSchema: null,
|
|
813
|
+
responseSchema: "AgentDto"
|
|
814
|
+
},
|
|
815
|
+
"WorkflowsController_cancelOwnershipTransfer": {
|
|
816
|
+
method: "DELETE",
|
|
817
|
+
path: "/api/v1/workflows/{id}/transfer-ownership",
|
|
818
|
+
service: "modus-api",
|
|
819
|
+
serverUrl: "https://api.modus.com",
|
|
820
|
+
pathParams: ["id"],
|
|
821
|
+
queryParams: [],
|
|
822
|
+
requestSchema: null,
|
|
823
|
+
responseSchema: "AgentDto"
|
|
824
|
+
},
|
|
825
|
+
"WorkflowsController_create": {
|
|
826
|
+
method: "POST",
|
|
827
|
+
path: "/api/v1/workflows",
|
|
828
|
+
service: "modus-api",
|
|
829
|
+
serverUrl: "https://api.modus.com",
|
|
830
|
+
pathParams: [],
|
|
831
|
+
queryParams: [],
|
|
832
|
+
requestSchema: "CreateAgentDto",
|
|
833
|
+
responseSchema: "AgentDto"
|
|
834
|
+
},
|
|
835
|
+
"WorkflowsController_delete": {
|
|
836
|
+
method: "DELETE",
|
|
837
|
+
path: "/api/v1/workflows/{id}",
|
|
838
|
+
service: "modus-api",
|
|
839
|
+
serverUrl: "https://api.modus.com",
|
|
840
|
+
pathParams: ["id"],
|
|
841
|
+
queryParams: [],
|
|
842
|
+
requestSchema: null,
|
|
843
|
+
responseSchema: null
|
|
844
|
+
},
|
|
845
|
+
"WorkflowsController_deploy": {
|
|
846
|
+
method: "POST",
|
|
847
|
+
path: "/api/v1/workflows/{id}/deploy",
|
|
848
|
+
service: "modus-api",
|
|
849
|
+
serverUrl: "https://api.modus.com",
|
|
850
|
+
pathParams: ["id"],
|
|
851
|
+
queryParams: [],
|
|
852
|
+
requestSchema: "DeployAgentDto",
|
|
853
|
+
responseSchema: "AgentDeployResponseDto"
|
|
854
|
+
},
|
|
855
|
+
"WorkflowsController_get": {
|
|
856
|
+
method: "GET",
|
|
857
|
+
path: "/api/v1/workflows/{id}",
|
|
858
|
+
service: "modus-api",
|
|
859
|
+
serverUrl: "https://api.modus.com",
|
|
860
|
+
pathParams: ["id"],
|
|
861
|
+
queryParams: ["view"],
|
|
862
|
+
requestSchema: null,
|
|
863
|
+
responseSchema: "AgentDto"
|
|
864
|
+
},
|
|
865
|
+
"WorkflowsController_list": {
|
|
866
|
+
method: "GET",
|
|
867
|
+
path: "/api/v1/workflows",
|
|
868
|
+
service: "modus-api",
|
|
869
|
+
serverUrl: "https://api.modus.com",
|
|
870
|
+
pathParams: [],
|
|
871
|
+
queryParams: ["pageToken", "pageSize", "view", "type", "search", "includeVariation"],
|
|
872
|
+
requestSchema: null,
|
|
873
|
+
responseSchema: "ListAgentsResponseDto"
|
|
874
|
+
},
|
|
875
|
+
"WorkflowsController_requestOwnershipTransfer": {
|
|
876
|
+
method: "POST",
|
|
877
|
+
path: "/api/v1/workflows/{id}/transfer-ownership",
|
|
878
|
+
service: "modus-api",
|
|
879
|
+
serverUrl: "https://api.modus.com",
|
|
880
|
+
pathParams: ["id"],
|
|
881
|
+
queryParams: [],
|
|
882
|
+
requestSchema: "TransferOwnershipDto",
|
|
883
|
+
responseSchema: "AgentDto"
|
|
884
|
+
},
|
|
885
|
+
"WorkflowsController_restore": {
|
|
886
|
+
method: "POST",
|
|
887
|
+
path: "/api/v1/workflows/{id}/restore",
|
|
888
|
+
service: "modus-api",
|
|
889
|
+
serverUrl: "https://api.modus.com",
|
|
890
|
+
pathParams: ["id"],
|
|
891
|
+
queryParams: [],
|
|
892
|
+
requestSchema: null,
|
|
893
|
+
responseSchema: "AgentDto"
|
|
894
|
+
},
|
|
895
|
+
"WorkflowsController_toggle": {
|
|
896
|
+
method: "POST",
|
|
897
|
+
path: "/api/v1/workflows/{id}/toggle",
|
|
898
|
+
service: "modus-api",
|
|
899
|
+
serverUrl: "https://api.modus.com",
|
|
900
|
+
pathParams: ["id"],
|
|
901
|
+
queryParams: [],
|
|
902
|
+
requestSchema: "ToggleAgentDto",
|
|
903
|
+
responseSchema: "AgentDto"
|
|
904
|
+
},
|
|
905
|
+
"WorkflowsController_update": {
|
|
906
|
+
method: "PATCH",
|
|
907
|
+
path: "/api/v1/workflows/{id}",
|
|
908
|
+
service: "modus-api",
|
|
909
|
+
serverUrl: "https://api.modus.com",
|
|
910
|
+
pathParams: ["id"],
|
|
911
|
+
queryParams: ["updateMask"],
|
|
912
|
+
requestSchema: "UpdateAgentDto",
|
|
913
|
+
responseSchema: "AgentDto"
|
|
914
|
+
}
|
|
915
|
+
};
|
|
916
|
+
|
|
917
|
+
// src/_exceptions.ts
|
|
918
|
+
var ModusError = class extends Error {
|
|
919
|
+
constructor(message, options = {}) {
|
|
920
|
+
super(message);
|
|
921
|
+
this.name = "ModusError";
|
|
922
|
+
this.message = message;
|
|
923
|
+
this.statusCode = options.statusCode;
|
|
924
|
+
this.requestId = options.requestId;
|
|
925
|
+
this.responseHeaders = options.responseHeaders;
|
|
926
|
+
this.body = options.body;
|
|
927
|
+
this.code = options.code;
|
|
928
|
+
}
|
|
929
|
+
};
|
|
930
|
+
var APIConnectionError = class extends ModusError {
|
|
931
|
+
constructor(message) {
|
|
932
|
+
super(message);
|
|
933
|
+
this.name = "APIConnectionError";
|
|
934
|
+
}
|
|
935
|
+
};
|
|
936
|
+
var AuthenticationError = class extends ModusError {
|
|
937
|
+
constructor(message, options = {}) {
|
|
938
|
+
super(message, { ...options, statusCode: 401 });
|
|
939
|
+
this.name = "AuthenticationError";
|
|
940
|
+
}
|
|
941
|
+
};
|
|
942
|
+
var PermissionDeniedError = class extends ModusError {
|
|
943
|
+
constructor(message, options = {}) {
|
|
944
|
+
super(message, { ...options, statusCode: 403 });
|
|
945
|
+
this.name = "PermissionDeniedError";
|
|
946
|
+
}
|
|
947
|
+
};
|
|
948
|
+
var NotFoundError = class extends ModusError {
|
|
949
|
+
constructor(message, options = {}) {
|
|
950
|
+
super(message, { ...options, statusCode: 404 });
|
|
951
|
+
this.name = "NotFoundError";
|
|
952
|
+
}
|
|
953
|
+
};
|
|
954
|
+
var ConflictError = class extends ModusError {
|
|
955
|
+
constructor(message, options = {}) {
|
|
956
|
+
super(message, { ...options, statusCode: 409 });
|
|
957
|
+
this.name = "ConflictError";
|
|
958
|
+
}
|
|
959
|
+
};
|
|
960
|
+
var UnprocessableError = class extends ModusError {
|
|
961
|
+
constructor(message, options = {}) {
|
|
962
|
+
super(message, { ...options, statusCode: 422 });
|
|
963
|
+
this.name = "UnprocessableError";
|
|
964
|
+
this.errors = options.errors;
|
|
965
|
+
}
|
|
966
|
+
};
|
|
967
|
+
var RateLimitError = class extends ModusError {
|
|
968
|
+
constructor(message, options = {}) {
|
|
969
|
+
super(message, { ...options, statusCode: 429 });
|
|
970
|
+
this.name = "RateLimitError";
|
|
971
|
+
this.retryAfter = options.retryAfter;
|
|
972
|
+
}
|
|
973
|
+
};
|
|
974
|
+
var InternalServerError = class extends ModusError {
|
|
975
|
+
constructor(message, statusCode, options = {}) {
|
|
976
|
+
super(message, { ...options, statusCode });
|
|
977
|
+
this.name = "InternalServerError";
|
|
978
|
+
}
|
|
979
|
+
};
|
|
980
|
+
var RunCancelledError = class extends ModusError {
|
|
981
|
+
constructor(message = "Run was cancelled.") {
|
|
982
|
+
super(message);
|
|
983
|
+
this.name = "RunCancelledError";
|
|
984
|
+
}
|
|
985
|
+
};
|
|
986
|
+
var StreamTimeoutError = class extends ModusError {
|
|
987
|
+
constructor(message = "Stream timed out.") {
|
|
988
|
+
super(message);
|
|
989
|
+
this.name = "StreamTimeoutError";
|
|
990
|
+
}
|
|
991
|
+
};
|
|
992
|
+
var ValidationError = class extends ModusError {
|
|
993
|
+
constructor(message) {
|
|
994
|
+
super(message);
|
|
995
|
+
this.name = "ValidationError";
|
|
996
|
+
}
|
|
997
|
+
};
|
|
998
|
+
|
|
999
|
+
// src/_streaming.ts
|
|
1000
|
+
var SILENTLY_IGNORED = /* @__PURE__ */ new Set([
|
|
1001
|
+
"heartbeat",
|
|
1002
|
+
"ws_chunk",
|
|
1003
|
+
"unknown",
|
|
1004
|
+
"tool_start",
|
|
1005
|
+
"tool_end",
|
|
1006
|
+
"tool_chunk",
|
|
1007
|
+
"agent_thinking",
|
|
1008
|
+
"warning",
|
|
1009
|
+
"selected_final_content"
|
|
1010
|
+
]);
|
|
1011
|
+
function parseLine(line) {
|
|
1012
|
+
if (!line.startsWith("data:")) return void 0;
|
|
1013
|
+
const raw = line.slice(5).trimStart();
|
|
1014
|
+
if (!raw || raw === "[DONE]") return void 0;
|
|
1015
|
+
try {
|
|
1016
|
+
const data = JSON.parse(raw);
|
|
1017
|
+
if (data && typeof data === "object" && !Array.isArray(data)) {
|
|
1018
|
+
return data;
|
|
1019
|
+
}
|
|
1020
|
+
} catch {
|
|
1021
|
+
return void 0;
|
|
1022
|
+
}
|
|
1023
|
+
return void 0;
|
|
1024
|
+
}
|
|
1025
|
+
function isAsyncIterable(value) {
|
|
1026
|
+
return Symbol.asyncIterator in Object(value);
|
|
1027
|
+
}
|
|
1028
|
+
function* parseData(data) {
|
|
1029
|
+
const eventType = typeof data.type === "string" ? data.type : "unknown";
|
|
1030
|
+
if (eventType === "token") {
|
|
1031
|
+
const event = {
|
|
1032
|
+
type: "token",
|
|
1033
|
+
content: typeof data.content === "string" ? data.content : ""
|
|
1034
|
+
};
|
|
1035
|
+
yield event;
|
|
1036
|
+
} else if (eventType === "done") {
|
|
1037
|
+
const event = {
|
|
1038
|
+
type: "done",
|
|
1039
|
+
runId: typeof data.runId === "string" ? data.runId : "",
|
|
1040
|
+
threadId: typeof data.threadId === "string" ? data.threadId : ""
|
|
1041
|
+
};
|
|
1042
|
+
yield event;
|
|
1043
|
+
} else if (eventType === "error") {
|
|
1044
|
+
const msg = data.error ?? data.message ?? data.content ?? "Unknown run error";
|
|
1045
|
+
const event = { type: "error", message: String(msg) };
|
|
1046
|
+
yield event;
|
|
1047
|
+
} else if (eventType === "cancelled") {
|
|
1048
|
+
const event = { type: "cancelled" };
|
|
1049
|
+
yield event;
|
|
1050
|
+
} else if (eventType === "stream_timeout") {
|
|
1051
|
+
const event = { type: "stream_timeout" };
|
|
1052
|
+
yield event;
|
|
1053
|
+
} else if (eventType === "assistant_content_reset") {
|
|
1054
|
+
if (typeof data.content !== "string") return;
|
|
1055
|
+
const event = {
|
|
1056
|
+
type: "assistant_content_reset",
|
|
1057
|
+
content: data.content,
|
|
1058
|
+
...typeof data.visibleContent === "string" ? { visibleContent: data.visibleContent } : {},
|
|
1059
|
+
attempt: typeof data.attempt === "number" ? data.attempt : 1,
|
|
1060
|
+
reason: "provider_stream_failed"
|
|
1061
|
+
};
|
|
1062
|
+
yield event;
|
|
1063
|
+
} else if (!SILENTLY_IGNORED.has(eventType)) {
|
|
1064
|
+
return;
|
|
1065
|
+
}
|
|
1066
|
+
}
|
|
1067
|
+
function* parseSyncSseLines(lines) {
|
|
1068
|
+
for (const line of lines) {
|
|
1069
|
+
const data = parseLine(line);
|
|
1070
|
+
if (data !== void 0) yield* parseData(data);
|
|
1071
|
+
}
|
|
1072
|
+
}
|
|
1073
|
+
async function* parseAsyncSseLines(lines) {
|
|
1074
|
+
for await (const line of lines) {
|
|
1075
|
+
const data = parseLine(line);
|
|
1076
|
+
if (data !== void 0) yield* parseData(data);
|
|
1077
|
+
}
|
|
1078
|
+
}
|
|
1079
|
+
function parseSseStream(lines) {
|
|
1080
|
+
return isAsyncIterable(lines) ? parseAsyncSseLines(lines) : parseSyncSseLines(lines);
|
|
1081
|
+
}
|
|
1082
|
+
|
|
1083
|
+
// src/_generated/write-body-keys.ts
|
|
1084
|
+
var WRITE_BODY_ALLOWED_KEYS = {
|
|
1085
|
+
ContextCreatorsController_createLink: ["url", "title", "isCrawl", "pageLimit"],
|
|
1086
|
+
ContextCreatorsController_createNote: ["title", "content"],
|
|
1087
|
+
ContextCreatorsController_createSavedQuery: ["name", "connectionId", "query", "description", "path"],
|
|
1088
|
+
ContextItemsController_lookup: ["contextType", "dataPath", "contentProjection"],
|
|
1089
|
+
ContextItemsController_update: ["contextType", "content", "description", "userFeedback", "topics"],
|
|
1090
|
+
CustomContextItemsController_batchCreate: ["items"],
|
|
1091
|
+
CustomContextItemsController_create: ["kind", "sourceId", "sourceName", "collectionId", "collectionName", "externalId", "fieldName", "name", "entityType", "description", "content", "url", "attributes", "dataType", "value", "samples", "raw", "topics", "idempotencyKey", "access"],
|
|
1092
|
+
CustomContextItemsController_update: ["name", "entityType", "description", "content", "url", "attributes", "dataType", "value", "samples", "raw", "topics"],
|
|
1093
|
+
EvaluationsController_updateConfig: ["enabled", "cadence", "judgeModel", "judgeGuidance", "notifications"],
|
|
1094
|
+
ModusChatController_chat: ["message", "model"],
|
|
1095
|
+
ModusContextController_compose: ["message", "limit"],
|
|
1096
|
+
ModusRunsController_create: ["message", "sessionId", "organizationId", "version", "fileThreadId", "config", "attachments", "userContext", "source", "runId", "subordinateSkillIds"],
|
|
1097
|
+
ResumeRunsController_create: ["message", "sessionId", "organizationId", "version", "fileThreadId", "config", "attachments", "userContext", "source", "runId", "decision"],
|
|
1098
|
+
RunLifecycleController_activeBySession: ["sessionIds"],
|
|
1099
|
+
RunLifecycleController_cancel: [],
|
|
1100
|
+
RunLifecycleController_editQueued: [],
|
|
1101
|
+
RunLifecycleController_interrupt: [],
|
|
1102
|
+
ScopeChatController_chat: ["message", "model"],
|
|
1103
|
+
ScopeContextController_compose: ["message", "limit"],
|
|
1104
|
+
ScopeMemoriesController_search: ["query", "userId", "limit"],
|
|
1105
|
+
ScopeMemoriesController_update: ["memory", "metadata"],
|
|
1106
|
+
ScopeRunsController_create: ["message", "sessionId", "organizationId", "version", "fileThreadId", "config", "attachments", "userContext", "source", "runId", "subordinateSkillIds"],
|
|
1107
|
+
ScopesController_acceptOwnershipTransfer: [],
|
|
1108
|
+
ScopesController_create: ["name", "description", "expectedOutput", "instructions", "toolset", "model", "connectionSet", "contextSelections", "interfaces", "accessConfig"],
|
|
1109
|
+
ScopesController_deploy: [],
|
|
1110
|
+
ScopesController_patchMcpConfig: ["config"],
|
|
1111
|
+
ScopesController_requestOwnershipTransfer: ["newOwnerUserId"],
|
|
1112
|
+
ScopesController_restore: [],
|
|
1113
|
+
ScopesController_update: ["name", "description", "expectedOutput", "instructions", "toolset", "model", "connectionSet", "contextSelections", "interfaces", "accessConfig", "managerId", "evaluations", "supervisionSubordinateDescriptions"],
|
|
1114
|
+
ScopeSupervisionController_set: ["subordinateAgentIds"],
|
|
1115
|
+
ScopeSupervisionController_setActive: ["subordinateAgentIds"],
|
|
1116
|
+
SuggestionsController_recordEvent: ["event_type", "source", "skill_id", "thread_id", "metadata"],
|
|
1117
|
+
WorkflowActionsController_cancel: [],
|
|
1118
|
+
WorkflowActionsController_execute: ["organizationId", "sessionId", "fileThreadId", "workflowAction", "previousOutputs", "userTimezone", "runId", "automationId", "source"],
|
|
1119
|
+
WorkflowInterfacesController_add: ["type", "name", "config"],
|
|
1120
|
+
WorkflowInterfacesController_update: ["name", "config"],
|
|
1121
|
+
WorkflowRunsController_create: ["message", "sessionId", "organizationId", "version", "fileThreadId", "config", "attachments", "userContext", "source", "runId"],
|
|
1122
|
+
WorkflowsController_acceptOwnershipTransfer: [],
|
|
1123
|
+
WorkflowsController_create: ["name", "type", "description", "trigger", "agentSelection", "workflowStructure", "accessConfig"],
|
|
1124
|
+
WorkflowsController_deploy: [],
|
|
1125
|
+
WorkflowsController_requestOwnershipTransfer: ["newOwnerUserId"],
|
|
1126
|
+
WorkflowsController_restore: [],
|
|
1127
|
+
WorkflowsController_toggle: ["active"],
|
|
1128
|
+
WorkflowsController_update: ["name", "type", "description", "trigger", "agentSelection", "workflowStructure", "accessConfig"]
|
|
1129
|
+
};
|
|
1130
|
+
|
|
1131
|
+
// src/_validation.ts
|
|
1132
|
+
var DEFAULT_MAX_PAGE_SIZE = 200;
|
|
1133
|
+
function validatePageSize(pageSize, maxPageSize) {
|
|
1134
|
+
if (!Number.isInteger(pageSize) || pageSize < 1) {
|
|
1135
|
+
throw new Error(`page_size must be a positive int, got ${pageSize}`);
|
|
1136
|
+
}
|
|
1137
|
+
if (maxPageSize !== void 0 && pageSize > maxPageSize) {
|
|
1138
|
+
throw new Error(`page_size must be <= ${maxPageSize}, got ${pageSize}`);
|
|
1139
|
+
}
|
|
1140
|
+
}
|
|
1141
|
+
function validateId(resourceId, name = "id") {
|
|
1142
|
+
if (typeof resourceId === "string" && !resourceId.trim()) {
|
|
1143
|
+
throw new Error(`${name} must be a non-empty string or int`);
|
|
1144
|
+
}
|
|
1145
|
+
}
|
|
1146
|
+
var ALLOWED_CHAT_MODELS = /* @__PURE__ */ new Set([
|
|
1147
|
+
"claude-sonnet-5",
|
|
1148
|
+
"claude-sonnet-4.6",
|
|
1149
|
+
"claude-opus-4.8",
|
|
1150
|
+
"gpt-5.2",
|
|
1151
|
+
"gpt-5.5",
|
|
1152
|
+
"gpt-5-mini",
|
|
1153
|
+
"gpt-oss-120b",
|
|
1154
|
+
"gpt-oss-20b",
|
|
1155
|
+
"qwen3-235b-a22b-2507",
|
|
1156
|
+
"qwen3-coder",
|
|
1157
|
+
"qwen3-32b",
|
|
1158
|
+
"deepseek-chat-v3.1",
|
|
1159
|
+
"minimax-m2.7",
|
|
1160
|
+
"llama-4-maverick",
|
|
1161
|
+
"llama-4-scout",
|
|
1162
|
+
"llama-3.3-70b-instruct",
|
|
1163
|
+
"gemini-3.1-pro-preview",
|
|
1164
|
+
"gemini-3-flash-preview",
|
|
1165
|
+
"grok-4.3-fast",
|
|
1166
|
+
"grok-4.3"
|
|
1167
|
+
]);
|
|
1168
|
+
function validateChatModel(model) {
|
|
1169
|
+
if (!ALLOWED_CHAT_MODELS.has(model)) {
|
|
1170
|
+
const supported = [...ALLOWED_CHAT_MODELS].sort().join(", ");
|
|
1171
|
+
throw new Error(`Unsupported model ${JSON.stringify(model)}. Choose one of: ${supported}.`);
|
|
1172
|
+
}
|
|
1173
|
+
}
|
|
1174
|
+
function assertWriteBodyKeys(operationId, body) {
|
|
1175
|
+
const allowed = WRITE_BODY_ALLOWED_KEYS[operationId];
|
|
1176
|
+
if (allowed === void 0) return;
|
|
1177
|
+
if (body === void 0 || body === null) return;
|
|
1178
|
+
if (typeof body !== "object" || Array.isArray(body)) {
|
|
1179
|
+
throw new ValidationError(`Request body must be a plain object for ${operationId}`);
|
|
1180
|
+
}
|
|
1181
|
+
const allowedSet = new Set(allowed);
|
|
1182
|
+
const extra = Object.keys(body).filter((k) => !allowedSet.has(k));
|
|
1183
|
+
if (extra.length > 0) {
|
|
1184
|
+
throw new ValidationError(
|
|
1185
|
+
`${operationId}: disallowed request body field(s): ${extra.sort().join(", ")}`
|
|
1186
|
+
);
|
|
1187
|
+
}
|
|
1188
|
+
}
|
|
1189
|
+
|
|
1190
|
+
// src/_chat.ts
|
|
1191
|
+
function effectiveThreadId(threadId) {
|
|
1192
|
+
if (threadId === void 0) return void 0;
|
|
1193
|
+
if (!threadId.trim()) return void 0;
|
|
1194
|
+
return threadId;
|
|
1195
|
+
}
|
|
1196
|
+
function chatPath(resource, resourceId, options) {
|
|
1197
|
+
const safeId = encodeURIComponent(String(resourceId));
|
|
1198
|
+
const suffix = options.stream ? "/stream" : "";
|
|
1199
|
+
const tid = effectiveThreadId(options.threadId);
|
|
1200
|
+
if (tid !== void 0) {
|
|
1201
|
+
const safeTid = encodeURIComponent(tid);
|
|
1202
|
+
return `/api/v1/${resource}/${safeId}/conversations/${safeTid}/chat${suffix}`;
|
|
1203
|
+
}
|
|
1204
|
+
return `/api/v1/${resource}/${safeId}/chat${suffix}`;
|
|
1205
|
+
}
|
|
1206
|
+
function modusChatPath(options) {
|
|
1207
|
+
const suffix = options.stream ? "/stream" : "";
|
|
1208
|
+
const tid = effectiveThreadId(options.threadId);
|
|
1209
|
+
if (tid !== void 0) {
|
|
1210
|
+
validateId(tid, "thread_id");
|
|
1211
|
+
return `/api/v1/modus/conversations/${encodeURIComponent(tid)}/chat${suffix}`;
|
|
1212
|
+
}
|
|
1213
|
+
return `/api/v1/modus/chat${suffix}`;
|
|
1214
|
+
}
|
|
1215
|
+
function chatBody(message, model) {
|
|
1216
|
+
return { message, model };
|
|
1217
|
+
}
|
|
1218
|
+
function raiseForEvent(event) {
|
|
1219
|
+
if (event.type === "error") throw new ModusError(event.message);
|
|
1220
|
+
if (event.type === "cancelled") throw new RunCancelledError();
|
|
1221
|
+
if (event.type === "stream_timeout") throw new StreamTimeoutError();
|
|
1222
|
+
return event;
|
|
1223
|
+
}
|
|
1224
|
+
var ChatStream = class {
|
|
1225
|
+
constructor(http, path, body) {
|
|
1226
|
+
this.http = http;
|
|
1227
|
+
this.path = path;
|
|
1228
|
+
this.body = body;
|
|
1229
|
+
this.textParts = [];
|
|
1230
|
+
}
|
|
1231
|
+
async *textStream() {
|
|
1232
|
+
for await (const event of this.events(false)) {
|
|
1233
|
+
if (event.type === "token") yield event.content;
|
|
1234
|
+
}
|
|
1235
|
+
}
|
|
1236
|
+
async *eventStream() {
|
|
1237
|
+
yield* this.events(true);
|
|
1238
|
+
}
|
|
1239
|
+
async *events(supportsReset) {
|
|
1240
|
+
const body = supportsReset ? { ...this.body, streamProtocolVersion: 2 } : this.body;
|
|
1241
|
+
for await (const line of this.http.streamPost(this.path, body)) {
|
|
1242
|
+
for (const event of parseSseStream([line])) {
|
|
1243
|
+
const normalized = raiseForEvent(event);
|
|
1244
|
+
if (normalized.type === "token") this.textParts.push(normalized.content);
|
|
1245
|
+
if (normalized.type === "assistant_content_reset") {
|
|
1246
|
+
this.textParts.length = 0;
|
|
1247
|
+
this.textParts.push(normalized.content);
|
|
1248
|
+
}
|
|
1249
|
+
if (normalized.type === "done") {
|
|
1250
|
+
this.final = {
|
|
1251
|
+
content: this.textParts.join(""),
|
|
1252
|
+
threadId: normalized.threadId,
|
|
1253
|
+
runId: normalized.runId
|
|
1254
|
+
};
|
|
1255
|
+
yield normalized;
|
|
1256
|
+
return;
|
|
1257
|
+
}
|
|
1258
|
+
yield normalized;
|
|
1259
|
+
}
|
|
1260
|
+
}
|
|
1261
|
+
}
|
|
1262
|
+
getFinalResult() {
|
|
1263
|
+
if (this.final === void 0) {
|
|
1264
|
+
throw new ModusError(
|
|
1265
|
+
"Stream ended without a done event; call getFinalResult() only after consuming textStream() or eventStream()."
|
|
1266
|
+
);
|
|
1267
|
+
}
|
|
1268
|
+
return this.final;
|
|
1269
|
+
}
|
|
1270
|
+
};
|
|
1271
|
+
async function chatBuffered(http, resource, resourceId, message, options) {
|
|
1272
|
+
validateId(resourceId, `${resource}_id`);
|
|
1273
|
+
validateChatModel(options.model);
|
|
1274
|
+
const path = chatPath(resource, resourceId, {
|
|
1275
|
+
threadId: options.threadId,
|
|
1276
|
+
stream: false
|
|
1277
|
+
});
|
|
1278
|
+
const data = await http.post(path, chatBody(message, options.model));
|
|
1279
|
+
return data;
|
|
1280
|
+
}
|
|
1281
|
+
function chatStreamSession(http, resource, resourceId, message, options) {
|
|
1282
|
+
validateId(resourceId, `${resource}_id`);
|
|
1283
|
+
validateChatModel(options.model);
|
|
1284
|
+
const path = chatPath(resource, resourceId, {
|
|
1285
|
+
threadId: options.threadId,
|
|
1286
|
+
stream: true
|
|
1287
|
+
});
|
|
1288
|
+
return new ChatStream(http, path, chatBody(message, options.model));
|
|
1289
|
+
}
|
|
1290
|
+
async function modusChatBuffered(http, message, options) {
|
|
1291
|
+
validateChatModel(options.model);
|
|
1292
|
+
const path = modusChatPath({ threadId: options.threadId, stream: false });
|
|
1293
|
+
const data = await http.post(path, chatBody(message, options.model));
|
|
1294
|
+
return data;
|
|
1295
|
+
}
|
|
1296
|
+
function modusChatStreamSession(http, message, options) {
|
|
1297
|
+
validateChatModel(options.model);
|
|
1298
|
+
const path = modusChatPath({ threadId: options.threadId, stream: true });
|
|
1299
|
+
return new ChatStream(http, path, chatBody(message, options.model));
|
|
1300
|
+
}
|
|
1301
|
+
|
|
1302
|
+
// src/_pagination.ts
|
|
1303
|
+
var Page = class {
|
|
1304
|
+
constructor(items, nextPageToken, fetchPage) {
|
|
1305
|
+
this.items = items;
|
|
1306
|
+
this.nextPageToken = normalizePageToken(nextPageToken);
|
|
1307
|
+
this.fetchPage = fetchPage;
|
|
1308
|
+
}
|
|
1309
|
+
hasNextPage() {
|
|
1310
|
+
return this.nextPageToken !== void 0;
|
|
1311
|
+
}
|
|
1312
|
+
async getNextPage() {
|
|
1313
|
+
if (this.nextPageToken === void 0) {
|
|
1314
|
+
throw new Error(
|
|
1315
|
+
"No next page available. Check hasNextPage() before calling getNextPage()."
|
|
1316
|
+
);
|
|
1317
|
+
}
|
|
1318
|
+
return this.fetchPage(this.nextPageToken);
|
|
1319
|
+
}
|
|
1320
|
+
async *autoPagingIter() {
|
|
1321
|
+
for (const item of this.items) yield item;
|
|
1322
|
+
let nextPageToken = this.nextPageToken;
|
|
1323
|
+
while (nextPageToken !== void 0) {
|
|
1324
|
+
const page = await this.fetchPage(nextPageToken);
|
|
1325
|
+
for (const item of page.items) yield item;
|
|
1326
|
+
nextPageToken = page.nextPageToken;
|
|
1327
|
+
}
|
|
1328
|
+
}
|
|
1329
|
+
[Symbol.iterator]() {
|
|
1330
|
+
return this.items[Symbol.iterator]();
|
|
1331
|
+
}
|
|
1332
|
+
};
|
|
1333
|
+
function normalizePageToken(token) {
|
|
1334
|
+
if (token === void 0 || token === null || !String(token).trim()) return void 0;
|
|
1335
|
+
return token;
|
|
1336
|
+
}
|
|
1337
|
+
function aipListParams(pageSize, pageToken, extra = {}) {
|
|
1338
|
+
const params = { pageSize, ...extra };
|
|
1339
|
+
const token = normalizePageToken(pageToken);
|
|
1340
|
+
if (token !== void 0) params.pageToken = token;
|
|
1341
|
+
return params;
|
|
1342
|
+
}
|
|
1343
|
+
function nextPageTokenFromResponse(data) {
|
|
1344
|
+
return normalizePageToken(
|
|
1345
|
+
typeof data.nextPageToken === "string" ? data.nextPageToken : void 0
|
|
1346
|
+
);
|
|
1347
|
+
}
|
|
1348
|
+
function requireItemsList(data, itemsKey) {
|
|
1349
|
+
const value = data[itemsKey];
|
|
1350
|
+
if (!Array.isArray(value)) {
|
|
1351
|
+
throw new ModusError(
|
|
1352
|
+
`Unexpected list response shape: ${itemsKey} must be a list, got ${typeof value}. This is likely a backend error.`
|
|
1353
|
+
);
|
|
1354
|
+
}
|
|
1355
|
+
return value;
|
|
1356
|
+
}
|
|
1357
|
+
function buildAipPage(data, itemsKey, mapItem, fetchPage) {
|
|
1358
|
+
if (typeof data !== "object" || data === null || !(itemsKey in data)) {
|
|
1359
|
+
throw new ModusError(
|
|
1360
|
+
`Unexpected list response shape: missing ${itemsKey}. Got: ${typeof data}. This is likely a backend error.`
|
|
1361
|
+
);
|
|
1362
|
+
}
|
|
1363
|
+
const items = requireItemsList(data, itemsKey).map(mapItem);
|
|
1364
|
+
return new Page(items, nextPageTokenFromResponse(data), fetchPage);
|
|
1365
|
+
}
|
|
1366
|
+
|
|
1367
|
+
// src/types/conversations.ts
|
|
1368
|
+
function conversationSkillId(item) {
|
|
1369
|
+
return item.skillId === 0 ? void 0 : item.skillId;
|
|
1370
|
+
}
|
|
1371
|
+
|
|
1372
|
+
// src/_auth.ts
|
|
1373
|
+
var ENV_API_KEY = "MODUS_API_KEY";
|
|
1374
|
+
var ENV_BASE_URL = "MODUS_BASE_URL";
|
|
1375
|
+
var ENV_TIMEOUT = "MODUS_TIMEOUT";
|
|
1376
|
+
var ENV_MAX_RETRIES = "MODUS_MAX_RETRIES";
|
|
1377
|
+
var KEY_PREFIX = "modus_";
|
|
1378
|
+
function resolveApiKey(apiKey) {
|
|
1379
|
+
const key = apiKey ?? process.env[ENV_API_KEY];
|
|
1380
|
+
if (!key) {
|
|
1381
|
+
throw new AuthenticationError(
|
|
1382
|
+
`No API key provided. Pass apiKey or set the ${ENV_API_KEY} environment variable. Create a token at app.modus.com \u2192 Settings \u2192 API Tokens.`
|
|
1383
|
+
);
|
|
1384
|
+
}
|
|
1385
|
+
if (!key.startsWith(KEY_PREFIX)) {
|
|
1386
|
+
throw new AuthenticationError(
|
|
1387
|
+
`Invalid API key format. Modus API keys start with '${KEY_PREFIX}'. Create a token at app.modus.com \u2192 Settings \u2192 API Tokens.`
|
|
1388
|
+
);
|
|
1389
|
+
}
|
|
1390
|
+
return key;
|
|
1391
|
+
}
|
|
1392
|
+
function resolveBaseUrl(baseUrl) {
|
|
1393
|
+
return baseUrl ?? process.env[ENV_BASE_URL] ?? void 0;
|
|
1394
|
+
}
|
|
1395
|
+
function resolveTimeoutMs(explicitMs) {
|
|
1396
|
+
if (explicitMs !== void 0) return explicitMs;
|
|
1397
|
+
const raw = process.env[ENV_TIMEOUT];
|
|
1398
|
+
if (raw === void 0) return void 0;
|
|
1399
|
+
const seconds = Number(raw);
|
|
1400
|
+
return Number.isFinite(seconds) ? seconds * 1e3 : void 0;
|
|
1401
|
+
}
|
|
1402
|
+
function resolveMaxRetries(explicit) {
|
|
1403
|
+
if (explicit !== void 0) {
|
|
1404
|
+
if (explicit < 0) throw new Error(`max_retries must be >= 0, got ${explicit}`);
|
|
1405
|
+
return explicit;
|
|
1406
|
+
}
|
|
1407
|
+
const raw = process.env[ENV_MAX_RETRIES];
|
|
1408
|
+
if (raw === void 0) return void 0;
|
|
1409
|
+
const value = Number.parseInt(raw, 10);
|
|
1410
|
+
return Number.isFinite(value) && value >= 0 ? value : void 0;
|
|
1411
|
+
}
|
|
1412
|
+
function authHeaders(apiKey) {
|
|
1413
|
+
return { Authorization: `Bearer ${apiKey}` };
|
|
1414
|
+
}
|
|
1415
|
+
|
|
1416
|
+
// src/_config.ts
|
|
1417
|
+
var DEFAULT_BASE_URL = "https://api.modus.com";
|
|
1418
|
+
var DEFAULT_TIMEOUT_MS = 3e5;
|
|
1419
|
+
var DEFAULT_MAX_RETRIES = 2;
|
|
1420
|
+
function normalizeBaseUrl(baseUrl) {
|
|
1421
|
+
return baseUrl.replace(/\/$/, "");
|
|
1422
|
+
}
|
|
1423
|
+
function normalizeBaseUrls(baseUrls) {
|
|
1424
|
+
return Object.fromEntries(
|
|
1425
|
+
Object.entries(baseUrls ?? {}).map(([service, baseUrl]) => [
|
|
1426
|
+
service,
|
|
1427
|
+
normalizeBaseUrl(baseUrl)
|
|
1428
|
+
])
|
|
1429
|
+
);
|
|
1430
|
+
}
|
|
1431
|
+
function createModusConfig(options = {}) {
|
|
1432
|
+
const maxRetries = resolveMaxRetries(options.maxRetries) ?? DEFAULT_MAX_RETRIES;
|
|
1433
|
+
if (!Number.isInteger(maxRetries) || maxRetries < 0) {
|
|
1434
|
+
throw new Error(`max_retries must be a non-negative int, got ${maxRetries}`);
|
|
1435
|
+
}
|
|
1436
|
+
const baseUrl = normalizeBaseUrl(resolveBaseUrl(options.baseUrl) ?? DEFAULT_BASE_URL);
|
|
1437
|
+
return Object.freeze({
|
|
1438
|
+
apiKey: resolveApiKey(options.apiKey),
|
|
1439
|
+
baseUrl,
|
|
1440
|
+
baseUrls: Object.freeze({ "modus-api": baseUrl, ...normalizeBaseUrls(options.baseUrls) }),
|
|
1441
|
+
timeoutMs: resolveTimeoutMs(options.timeoutMs) ?? DEFAULT_TIMEOUT_MS,
|
|
1442
|
+
maxRetries,
|
|
1443
|
+
fetch: options.fetch ?? globalThis.fetch.bind(globalThis)
|
|
1444
|
+
});
|
|
1445
|
+
}
|
|
1446
|
+
function resolveServiceBaseUrl(config, service, generatedBaseUrl) {
|
|
1447
|
+
return config.baseUrls[service] ?? generatedBaseUrl ?? config.baseUrl;
|
|
1448
|
+
}
|
|
1449
|
+
function formatConfigForLog(config) {
|
|
1450
|
+
const masked = config.apiKey.length > 10 ? `${config.apiKey.slice(0, 10)}***` : "***";
|
|
1451
|
+
return `ModusConfig(apiKey=${JSON.stringify(masked)}, baseUrl=${JSON.stringify(config.baseUrl)}, timeoutMs=${config.timeoutMs}, maxRetries=${config.maxRetries})`;
|
|
1452
|
+
}
|
|
1453
|
+
|
|
1454
|
+
// src/_http.ts
|
|
1455
|
+
var USER_AGENT = `modus-typescript/${"0.1.0"} (node/${process.version}; ${process.platform})`;
|
|
1456
|
+
function buildUrl(baseUrl, path, params) {
|
|
1457
|
+
const url = new URL(path.startsWith("/") ? path : `/${path}`, baseUrl);
|
|
1458
|
+
if (params) {
|
|
1459
|
+
for (const [key, value] of Object.entries(params)) {
|
|
1460
|
+
if (value === void 0 || value === null) continue;
|
|
1461
|
+
if (Array.isArray(value)) {
|
|
1462
|
+
for (const item of value) url.searchParams.append(key, String(item));
|
|
1463
|
+
} else {
|
|
1464
|
+
url.searchParams.set(key, String(value));
|
|
1465
|
+
}
|
|
1466
|
+
}
|
|
1467
|
+
}
|
|
1468
|
+
return url.toString();
|
|
1469
|
+
}
|
|
1470
|
+
function headersToRecord(headers) {
|
|
1471
|
+
const out = {};
|
|
1472
|
+
headers.forEach((value, key) => {
|
|
1473
|
+
out[key] = value;
|
|
1474
|
+
});
|
|
1475
|
+
return out;
|
|
1476
|
+
}
|
|
1477
|
+
function messageFromBody(raw, statusCode) {
|
|
1478
|
+
if (!raw) return `HTTP ${statusCode}`;
|
|
1479
|
+
try {
|
|
1480
|
+
const body = JSON.parse(raw);
|
|
1481
|
+
if (body && typeof body === "object") {
|
|
1482
|
+
const record = body;
|
|
1483
|
+
const envelope = record.error;
|
|
1484
|
+
if (envelope && typeof envelope === "object") {
|
|
1485
|
+
const msg2 = envelope.message;
|
|
1486
|
+
if (typeof msg2 === "string" && msg2) return msg2;
|
|
1487
|
+
}
|
|
1488
|
+
const msg = record.message ?? record.error;
|
|
1489
|
+
if (Array.isArray(msg)) return msg.map(String).join("; ");
|
|
1490
|
+
if (typeof msg === "string" && msg) return msg;
|
|
1491
|
+
}
|
|
1492
|
+
} catch {
|
|
1493
|
+
}
|
|
1494
|
+
return raw;
|
|
1495
|
+
}
|
|
1496
|
+
function errorCodeFromBody(raw) {
|
|
1497
|
+
try {
|
|
1498
|
+
const body = JSON.parse(raw);
|
|
1499
|
+
return typeof body.error?.code === "string" ? body.error.code : void 0;
|
|
1500
|
+
} catch {
|
|
1501
|
+
return void 0;
|
|
1502
|
+
}
|
|
1503
|
+
}
|
|
1504
|
+
function raiseForStatus(response, body) {
|
|
1505
|
+
if (response.ok) return;
|
|
1506
|
+
const message = messageFromBody(body, response.status);
|
|
1507
|
+
const requestId = response.headers.get("x-request-id") ?? response.headers.get("X-Request-ID") ?? void 0;
|
|
1508
|
+
const headers = headersToRecord(response.headers);
|
|
1509
|
+
const code = errorCodeFromBody(body);
|
|
1510
|
+
const base = { requestId, responseHeaders: headers, body, code };
|
|
1511
|
+
switch (response.status) {
|
|
1512
|
+
case 401:
|
|
1513
|
+
throw new AuthenticationError(message, base);
|
|
1514
|
+
case 403:
|
|
1515
|
+
throw new PermissionDeniedError(message, base);
|
|
1516
|
+
case 404:
|
|
1517
|
+
throw new NotFoundError(message, base);
|
|
1518
|
+
case 409:
|
|
1519
|
+
throw new ConflictError(message, base);
|
|
1520
|
+
case 422: {
|
|
1521
|
+
let errors;
|
|
1522
|
+
try {
|
|
1523
|
+
errors = JSON.parse(body);
|
|
1524
|
+
} catch {
|
|
1525
|
+
errors = void 0;
|
|
1526
|
+
}
|
|
1527
|
+
throw new UnprocessableError(message, { ...base, errors });
|
|
1528
|
+
}
|
|
1529
|
+
case 429: {
|
|
1530
|
+
const retryHeader = response.headers.get("retry-after") ?? "";
|
|
1531
|
+
const retryAfter = /^\d+$/.test(retryHeader) ? Number.parseInt(retryHeader, 10) : void 0;
|
|
1532
|
+
throw new RateLimitError(message, { ...base, retryAfter });
|
|
1533
|
+
}
|
|
1534
|
+
default:
|
|
1535
|
+
if (response.status >= 500) {
|
|
1536
|
+
throw new InternalServerError(message, response.status, base);
|
|
1537
|
+
}
|
|
1538
|
+
throw new ModusError(message, { ...base, statusCode: response.status });
|
|
1539
|
+
}
|
|
1540
|
+
}
|
|
1541
|
+
function wrapNetworkError(error, baseUrl) {
|
|
1542
|
+
const detail = error instanceof Error ? error.message : String(error);
|
|
1543
|
+
return new APIConnectionError(
|
|
1544
|
+
`Network error communicating with Modus API at ${JSON.stringify(baseUrl)}: ${detail}. Check connectivity and that baseUrl is correct.`
|
|
1545
|
+
);
|
|
1546
|
+
}
|
|
1547
|
+
async function readBody(response) {
|
|
1548
|
+
return response.text();
|
|
1549
|
+
}
|
|
1550
|
+
var HttpClient = class {
|
|
1551
|
+
constructor(config) {
|
|
1552
|
+
this.config = config;
|
|
1553
|
+
}
|
|
1554
|
+
defaultHeaders() {
|
|
1555
|
+
return {
|
|
1556
|
+
...authHeaders(this.config.apiKey),
|
|
1557
|
+
Accept: "application/json",
|
|
1558
|
+
"Content-Type": "application/json",
|
|
1559
|
+
"User-Agent": USER_AGENT
|
|
1560
|
+
};
|
|
1561
|
+
}
|
|
1562
|
+
async request(method, path, options = {}) {
|
|
1563
|
+
const baseUrl = options.baseUrl ?? this.config.baseUrl;
|
|
1564
|
+
const url = buildUrl(baseUrl, path, options.params);
|
|
1565
|
+
try {
|
|
1566
|
+
const response = await this.config.fetch(url, {
|
|
1567
|
+
method,
|
|
1568
|
+
headers: { ...this.defaultHeaders(), ...options.headers },
|
|
1569
|
+
body: options.json !== void 0 ? JSON.stringify(options.json) : void 0,
|
|
1570
|
+
signal: AbortSignal.timeout(this.config.timeoutMs)
|
|
1571
|
+
});
|
|
1572
|
+
const body = await readBody(response);
|
|
1573
|
+
raiseForStatus(response, body);
|
|
1574
|
+
if (response.status === 204 || !body) return null;
|
|
1575
|
+
return JSON.parse(body);
|
|
1576
|
+
} catch (error) {
|
|
1577
|
+
if (error instanceof ModusError) throw error;
|
|
1578
|
+
if (error instanceof DOMException && error.name === "AbortError") {
|
|
1579
|
+
throw wrapNetworkError(new Error("Request timed out"), baseUrl);
|
|
1580
|
+
}
|
|
1581
|
+
throw wrapNetworkError(error, baseUrl);
|
|
1582
|
+
}
|
|
1583
|
+
}
|
|
1584
|
+
get(path, params, options = {}) {
|
|
1585
|
+
return this.request("GET", path, { params, ...options });
|
|
1586
|
+
}
|
|
1587
|
+
post(path, json, options = {}) {
|
|
1588
|
+
return this.request("POST", path, { json, ...options });
|
|
1589
|
+
}
|
|
1590
|
+
patch(path, json, params, options = {}) {
|
|
1591
|
+
return this.request("PATCH", path, { json, params, ...options });
|
|
1592
|
+
}
|
|
1593
|
+
delete(path, options = {}) {
|
|
1594
|
+
return this.request("DELETE", path, options);
|
|
1595
|
+
}
|
|
1596
|
+
async *stream(method, path, options = {}) {
|
|
1597
|
+
const baseUrl = options.baseUrl ?? this.config.baseUrl;
|
|
1598
|
+
const url = buildUrl(baseUrl, path, options.params);
|
|
1599
|
+
try {
|
|
1600
|
+
const response = await this.config.fetch(url, {
|
|
1601
|
+
method,
|
|
1602
|
+
headers: { ...this.defaultHeaders(), ...options.headers },
|
|
1603
|
+
body: options.json !== void 0 ? JSON.stringify(options.json) : void 0,
|
|
1604
|
+
signal: AbortSignal.timeout(this.config.timeoutMs)
|
|
1605
|
+
});
|
|
1606
|
+
if (!response.ok) {
|
|
1607
|
+
const body = await readBody(response);
|
|
1608
|
+
raiseForStatus(response, body);
|
|
1609
|
+
return;
|
|
1610
|
+
}
|
|
1611
|
+
if (!response.body) return;
|
|
1612
|
+
const reader = response.body.getReader();
|
|
1613
|
+
const decoder = new TextDecoder();
|
|
1614
|
+
let buffer = "";
|
|
1615
|
+
while (true) {
|
|
1616
|
+
const { done, value } = await reader.read();
|
|
1617
|
+
if (done) break;
|
|
1618
|
+
buffer += decoder.decode(value, { stream: true });
|
|
1619
|
+
const lines = buffer.split("\n");
|
|
1620
|
+
buffer = lines.pop() ?? "";
|
|
1621
|
+
for (const line of lines) {
|
|
1622
|
+
if (line.trim()) yield line;
|
|
1623
|
+
}
|
|
1624
|
+
}
|
|
1625
|
+
if (buffer.trim()) yield buffer;
|
|
1626
|
+
} catch (error) {
|
|
1627
|
+
if (error instanceof ModusError) throw error;
|
|
1628
|
+
if (error instanceof DOMException && error.name === "AbortError") {
|
|
1629
|
+
throw wrapNetworkError(new Error("Request timed out"), baseUrl);
|
|
1630
|
+
}
|
|
1631
|
+
throw wrapNetworkError(error, baseUrl);
|
|
1632
|
+
}
|
|
1633
|
+
}
|
|
1634
|
+
streamGet(path, params, options = {}) {
|
|
1635
|
+
return this.stream("GET", path, { params, ...options });
|
|
1636
|
+
}
|
|
1637
|
+
streamPost(path, json, options = {}) {
|
|
1638
|
+
return this.stream("POST", path, { json, ...options });
|
|
1639
|
+
}
|
|
1640
|
+
};
|
|
1641
|
+
|
|
1642
|
+
// src/_client-base.ts
|
|
1643
|
+
var ModusClientBase = class {
|
|
1644
|
+
constructor(options = {}) {
|
|
1645
|
+
this._config = createModusConfig(options);
|
|
1646
|
+
this._http = new HttpClient(this._config);
|
|
1647
|
+
}
|
|
1648
|
+
get config() {
|
|
1649
|
+
return this._config;
|
|
1650
|
+
}
|
|
1651
|
+
/** @internal */
|
|
1652
|
+
get http() {
|
|
1653
|
+
return this._http;
|
|
1654
|
+
}
|
|
1655
|
+
toString() {
|
|
1656
|
+
return formatConfigForLog(this._config);
|
|
1657
|
+
}
|
|
1658
|
+
};
|
|
1659
|
+
|
|
1660
|
+
// src/_openapi-invoke.ts
|
|
1661
|
+
function getOperation(operationId) {
|
|
1662
|
+
if (!(operationId in OPERATIONS)) {
|
|
1663
|
+
throw new Error(
|
|
1664
|
+
`Unknown API operation ${JSON.stringify(operationId)}. Upgrade @getmodus/sdk or report a version mismatch.`
|
|
1665
|
+
);
|
|
1666
|
+
}
|
|
1667
|
+
return OPERATIONS[operationId];
|
|
1668
|
+
}
|
|
1669
|
+
function formatPath(template, pathParams) {
|
|
1670
|
+
return template.split("/").map((segment) => {
|
|
1671
|
+
if (!segment.startsWith("{") || !segment.endsWith("}")) return segment;
|
|
1672
|
+
const key = segment.slice(1, -1);
|
|
1673
|
+
if (!(key in pathParams)) {
|
|
1674
|
+
throw new Error(`Missing path parameter ${JSON.stringify(key)} for ${JSON.stringify(template)}`);
|
|
1675
|
+
}
|
|
1676
|
+
return encodeURIComponent(String(pathParams[key]));
|
|
1677
|
+
}).join("/");
|
|
1678
|
+
}
|
|
1679
|
+
function operationBaseUrl(http, operation) {
|
|
1680
|
+
return resolveServiceBaseUrl(http.config, operation.service, operation.serverUrl);
|
|
1681
|
+
}
|
|
1682
|
+
function formatOperationPath(operationId, pathParams = {}) {
|
|
1683
|
+
return formatPath(getOperation(operationId).path, pathParams);
|
|
1684
|
+
}
|
|
1685
|
+
async function invokeOperation(http, operationId, options = {}) {
|
|
1686
|
+
const op = getOperation(operationId);
|
|
1687
|
+
const path = formatPath(op.path, options.pathParams ?? {});
|
|
1688
|
+
const params = options.query;
|
|
1689
|
+
const requestOptions = {
|
|
1690
|
+
baseUrl: operationBaseUrl(http, op),
|
|
1691
|
+
headers: options.headers
|
|
1692
|
+
};
|
|
1693
|
+
switch (op.method) {
|
|
1694
|
+
case "GET":
|
|
1695
|
+
return http.get(path, params, requestOptions);
|
|
1696
|
+
case "POST":
|
|
1697
|
+
return http.post(path, options.jsonBody, requestOptions);
|
|
1698
|
+
case "PATCH":
|
|
1699
|
+
return http.patch(path, options.jsonBody, params, requestOptions);
|
|
1700
|
+
case "DELETE":
|
|
1701
|
+
return http.delete(path, requestOptions);
|
|
1702
|
+
default:
|
|
1703
|
+
throw new Error(`Unsupported HTTP method ${JSON.stringify(op.method)}`);
|
|
1704
|
+
}
|
|
1705
|
+
}
|
|
1706
|
+
|
|
1707
|
+
// src/_retry.ts
|
|
1708
|
+
var DEPLOY_NOT_FOUND_BACKOFF_MS = 500;
|
|
1709
|
+
var MAX_DEPLOY_NOT_FOUND_RETRIES = 1;
|
|
1710
|
+
var RETRYABLE = [RateLimitError, InternalServerError, APIConnectionError];
|
|
1711
|
+
function isRetryable(error) {
|
|
1712
|
+
return RETRYABLE.some((Cls) => error instanceof Cls);
|
|
1713
|
+
}
|
|
1714
|
+
function backoffSeconds(attempt, error) {
|
|
1715
|
+
if (error instanceof RateLimitError && error.retryAfter !== void 0) {
|
|
1716
|
+
return Math.max(0, error.retryAfter);
|
|
1717
|
+
}
|
|
1718
|
+
if (attempt === 0) return 0;
|
|
1719
|
+
return Math.max(0.5, 2 ** (attempt - 1) + (Math.random() * 0.6 - 0.3));
|
|
1720
|
+
}
|
|
1721
|
+
function sleep(ms) {
|
|
1722
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
1723
|
+
}
|
|
1724
|
+
async function withRetry(fn, maxRetries, options = {}) {
|
|
1725
|
+
let deployNotFoundRetries = 0;
|
|
1726
|
+
let attempt = 0;
|
|
1727
|
+
while (true) {
|
|
1728
|
+
try {
|
|
1729
|
+
return await fn();
|
|
1730
|
+
} catch (error) {
|
|
1731
|
+
if (options.retryNotFoundOnDeploy && error instanceof NotFoundError && deployNotFoundRetries < MAX_DEPLOY_NOT_FOUND_RETRIES) {
|
|
1732
|
+
deployNotFoundRetries++;
|
|
1733
|
+
await sleep(DEPLOY_NOT_FOUND_BACKOFF_MS);
|
|
1734
|
+
continue;
|
|
1735
|
+
}
|
|
1736
|
+
if (!isRetryable(error) || attempt >= maxRetries) throw error;
|
|
1737
|
+
await sleep(backoffSeconds(attempt, error) * 1e3);
|
|
1738
|
+
attempt++;
|
|
1739
|
+
}
|
|
1740
|
+
}
|
|
1741
|
+
}
|
|
1742
|
+
|
|
1743
|
+
// src/_request.ts
|
|
1744
|
+
async function invokeWithRetry(config, http, operationId, options = {}) {
|
|
1745
|
+
if (options.jsonBody !== void 0) {
|
|
1746
|
+
assertWriteBodyKeys(operationId, options.jsonBody);
|
|
1747
|
+
}
|
|
1748
|
+
return withRetry(() => invokeOperation(http, operationId, options), config.maxRetries, {
|
|
1749
|
+
retryNotFoundOnDeploy: operationId.endsWith("_deploy")
|
|
1750
|
+
});
|
|
1751
|
+
}
|
|
1752
|
+
function omitUndefined(obj) {
|
|
1753
|
+
return Object.fromEntries(
|
|
1754
|
+
Object.entries(obj).filter((entry) => entry[1] !== void 0)
|
|
1755
|
+
);
|
|
1756
|
+
}
|
|
1757
|
+
function asRecord(data) {
|
|
1758
|
+
if (typeof data === "object" && data !== null && !Array.isArray(data)) {
|
|
1759
|
+
return data;
|
|
1760
|
+
}
|
|
1761
|
+
throw new Error(`Expected object response, got ${typeof data}`);
|
|
1762
|
+
}
|
|
1763
|
+
|
|
1764
|
+
// src/resources/agents/runs.ts
|
|
1765
|
+
var RUNS_MAX_PAGE_SIZE = 100;
|
|
1766
|
+
function runsListParams(pageSize, pageToken, status, timeframe, approvalScope, search) {
|
|
1767
|
+
const params = { pageSize };
|
|
1768
|
+
const token = normalizePageToken(pageToken);
|
|
1769
|
+
if (token !== void 0) params.pageToken = token;
|
|
1770
|
+
if (status !== void 0) params.status = status;
|
|
1771
|
+
if (timeframe !== void 0) params.timeframe = timeframe;
|
|
1772
|
+
if (approvalScope !== void 0) params.approvalScope = approvalScope;
|
|
1773
|
+
if (search !== void 0) params.search = search;
|
|
1774
|
+
return params;
|
|
1775
|
+
}
|
|
1776
|
+
function activeRunsParams(pageSize, pageToken) {
|
|
1777
|
+
const params = { pageSize };
|
|
1778
|
+
const token = normalizePageToken(pageToken);
|
|
1779
|
+
if (token !== void 0) params.pageToken = token;
|
|
1780
|
+
return params;
|
|
1781
|
+
}
|
|
1782
|
+
function parseRun(raw) {
|
|
1783
|
+
return raw;
|
|
1784
|
+
}
|
|
1785
|
+
function parseActiveRunsArray(raw) {
|
|
1786
|
+
const data = asRecord(raw);
|
|
1787
|
+
const runs = data.runs;
|
|
1788
|
+
if (!Array.isArray(runs)) {
|
|
1789
|
+
throw new ModusError(
|
|
1790
|
+
`Unexpected active runs response shape: runs must be a list, got ${typeof runs}.`
|
|
1791
|
+
);
|
|
1792
|
+
}
|
|
1793
|
+
return runs;
|
|
1794
|
+
}
|
|
1795
|
+
function parseActiveRunsPage(raw, fetchPage) {
|
|
1796
|
+
const data = asRecord(raw);
|
|
1797
|
+
const runs = data.runs;
|
|
1798
|
+
if (!Array.isArray(runs)) {
|
|
1799
|
+
throw new ModusError(
|
|
1800
|
+
`Unexpected active runs response shape: runs must be a list, got ${typeof runs}.`
|
|
1801
|
+
);
|
|
1802
|
+
}
|
|
1803
|
+
return new Page(
|
|
1804
|
+
runs,
|
|
1805
|
+
normalizePageToken(
|
|
1806
|
+
typeof data.nextPageToken === "string" ? data.nextPageToken : void 0
|
|
1807
|
+
),
|
|
1808
|
+
fetchPage
|
|
1809
|
+
);
|
|
1810
|
+
}
|
|
1811
|
+
function randomRunId() {
|
|
1812
|
+
return crypto.randomUUID();
|
|
1813
|
+
}
|
|
1814
|
+
var WorkflowRunsResource = class {
|
|
1815
|
+
constructor(http, config) {
|
|
1816
|
+
this.http = http;
|
|
1817
|
+
this.config = config;
|
|
1818
|
+
}
|
|
1819
|
+
list(workflowId, options = {}) {
|
|
1820
|
+
validateId(workflowId, "workflow_id");
|
|
1821
|
+
const pageSize = options.pageSize ?? 25;
|
|
1822
|
+
validatePageSize(pageSize, RUNS_MAX_PAGE_SIZE);
|
|
1823
|
+
return this.listPage(workflowId, pageSize, options.pageToken, options);
|
|
1824
|
+
}
|
|
1825
|
+
async listPage(workflowId, pageSize, pageToken, filters) {
|
|
1826
|
+
const data = asRecord(
|
|
1827
|
+
await invokeWithRetry(this.config, this.http, "WorkflowRunsController_list", {
|
|
1828
|
+
pathParams: { id: workflowId },
|
|
1829
|
+
query: runsListParams(
|
|
1830
|
+
pageSize,
|
|
1831
|
+
pageToken,
|
|
1832
|
+
filters.status,
|
|
1833
|
+
filters.timeframe,
|
|
1834
|
+
filters.approvalScope,
|
|
1835
|
+
filters.search
|
|
1836
|
+
)
|
|
1837
|
+
})
|
|
1838
|
+
);
|
|
1839
|
+
const runs = data.runs;
|
|
1840
|
+
if (!Array.isArray(runs)) {
|
|
1841
|
+
throw new ModusError(
|
|
1842
|
+
`Unexpected list response shape: runs must be a list, got ${typeof runs}.`
|
|
1843
|
+
);
|
|
1844
|
+
}
|
|
1845
|
+
return new Page(
|
|
1846
|
+
runs,
|
|
1847
|
+
normalizePageToken(
|
|
1848
|
+
typeof data.nextPageToken === "string" ? data.nextPageToken : void 0
|
|
1849
|
+
),
|
|
1850
|
+
(token) => this.listPage(workflowId, pageSize, token, filters)
|
|
1851
|
+
);
|
|
1852
|
+
}
|
|
1853
|
+
async get(workflowId, runId, options = {}) {
|
|
1854
|
+
validateId(workflowId, "workflow_id");
|
|
1855
|
+
if (!runId.trim()) throw new Error("run_id must be a non-empty string");
|
|
1856
|
+
const query = options.temporalRunId !== void 0 ? { temporalRunId: options.temporalRunId } : void 0;
|
|
1857
|
+
const data = await invokeWithRetry(this.config, this.http, "WorkflowRunsController_get", {
|
|
1858
|
+
pathParams: { id: workflowId, runId },
|
|
1859
|
+
query
|
|
1860
|
+
});
|
|
1861
|
+
return parseRun(data);
|
|
1862
|
+
}
|
|
1863
|
+
async create(workflowId, body, options = {}) {
|
|
1864
|
+
validateId(workflowId, "workflow_id");
|
|
1865
|
+
return this.createRun("WorkflowRunsController_create", body, { id: workflowId }, options);
|
|
1866
|
+
}
|
|
1867
|
+
async createScope(scopeId, body, options = {}) {
|
|
1868
|
+
validateId(scopeId, "scope_id");
|
|
1869
|
+
return this.createRun("ScopeRunsController_create", body, { id: scopeId }, options);
|
|
1870
|
+
}
|
|
1871
|
+
async createModus(body, options = {}) {
|
|
1872
|
+
return this.createRun("ModusRunsController_create", body, {}, options);
|
|
1873
|
+
}
|
|
1874
|
+
async resume(runId, body, options = {}) {
|
|
1875
|
+
validateId(runId, "run_id");
|
|
1876
|
+
return this.createRun("ResumeRunsController_create", body, { runId }, options);
|
|
1877
|
+
}
|
|
1878
|
+
async cancel(runId) {
|
|
1879
|
+
validateId(runId, "run_id");
|
|
1880
|
+
await invokeWithRetry(this.config, this.http, "RunLifecycleController_cancel", {
|
|
1881
|
+
pathParams: { runId },
|
|
1882
|
+
jsonBody: {}
|
|
1883
|
+
});
|
|
1884
|
+
}
|
|
1885
|
+
async events(runId) {
|
|
1886
|
+
validateId(runId, "run_id");
|
|
1887
|
+
return invokeWithRetry(this.config, this.http, "RunLifecycleController_events", {
|
|
1888
|
+
pathParams: { runId }
|
|
1889
|
+
});
|
|
1890
|
+
}
|
|
1891
|
+
async interrupt(runId) {
|
|
1892
|
+
validateId(runId, "run_id");
|
|
1893
|
+
await invokeWithRetry(this.config, this.http, "RunLifecycleController_interrupt", {
|
|
1894
|
+
pathParams: { runId },
|
|
1895
|
+
jsonBody: {}
|
|
1896
|
+
});
|
|
1897
|
+
}
|
|
1898
|
+
async editQueued(runId) {
|
|
1899
|
+
validateId(runId, "run_id");
|
|
1900
|
+
await invokeWithRetry(this.config, this.http, "RunLifecycleController_editQueued", {
|
|
1901
|
+
pathParams: { runId },
|
|
1902
|
+
jsonBody: {}
|
|
1903
|
+
});
|
|
1904
|
+
}
|
|
1905
|
+
active(options = {}) {
|
|
1906
|
+
const pageSize = options.pageSize ?? 50;
|
|
1907
|
+
validatePageSize(pageSize, RUNS_MAX_PAGE_SIZE);
|
|
1908
|
+
return this.activePage(pageSize, options.pageToken);
|
|
1909
|
+
}
|
|
1910
|
+
async activePage(pageSize, pageToken) {
|
|
1911
|
+
return parseActiveRunsPage(
|
|
1912
|
+
await invokeWithRetry(this.config, this.http, "RunLifecycleController_active", {
|
|
1913
|
+
query: activeRunsParams(pageSize, pageToken)
|
|
1914
|
+
}),
|
|
1915
|
+
(token) => this.activePage(pageSize, token)
|
|
1916
|
+
);
|
|
1917
|
+
}
|
|
1918
|
+
async activeBySession(sessionIds) {
|
|
1919
|
+
const uniqueSessionIds = [...new Set(sessionIds.map((id) => id.trim()).filter(Boolean))];
|
|
1920
|
+
if (uniqueSessionIds.length > 100) {
|
|
1921
|
+
throw new Error("sessionIds must contain at most 100 ids");
|
|
1922
|
+
}
|
|
1923
|
+
return parseActiveRunsArray(
|
|
1924
|
+
await invokeWithRetry(this.config, this.http, "RunLifecycleController_activeBySession", {
|
|
1925
|
+
jsonBody: { sessionIds: uniqueSessionIds }
|
|
1926
|
+
})
|
|
1927
|
+
);
|
|
1928
|
+
}
|
|
1929
|
+
stream(runId, options = {}) {
|
|
1930
|
+
validateId(runId, "run_id");
|
|
1931
|
+
const op = getOperation("RunLifecycleController_stream");
|
|
1932
|
+
const path = formatOperationPath("RunLifecycleController_stream", { runId });
|
|
1933
|
+
const lines = this.http.streamGet(path, void 0, {
|
|
1934
|
+
baseUrl: operationBaseUrl(this.http, op),
|
|
1935
|
+
headers: options.lastEventId ? { "Last-Event-ID": options.lastEventId } : void 0
|
|
1936
|
+
});
|
|
1937
|
+
return { runId, events: this.parseEvents(lines) };
|
|
1938
|
+
}
|
|
1939
|
+
createRun(operationId, body, pathParams, options) {
|
|
1940
|
+
const runId = options.idempotencyKey?.trim() || body.runId?.trim() || randomRunId();
|
|
1941
|
+
const op = getOperation(operationId);
|
|
1942
|
+
const path = formatOperationPath(operationId, pathParams);
|
|
1943
|
+
const lines = this.http.streamPost(path, {
|
|
1944
|
+
...body,
|
|
1945
|
+
streamProtocolVersion: 2
|
|
1946
|
+
}, {
|
|
1947
|
+
baseUrl: operationBaseUrl(this.http, op),
|
|
1948
|
+
headers: { "Idempotency-Key": runId }
|
|
1949
|
+
});
|
|
1950
|
+
return { runId, events: this.parseEvents(lines) };
|
|
1951
|
+
}
|
|
1952
|
+
async *parseEvents(lines) {
|
|
1953
|
+
yield* parseSseStream(lines);
|
|
1954
|
+
}
|
|
1955
|
+
};
|
|
1956
|
+
|
|
1957
|
+
// src/resources/agents/workflow-actions.ts
|
|
1958
|
+
function randomRunId2() {
|
|
1959
|
+
return crypto.randomUUID();
|
|
1960
|
+
}
|
|
1961
|
+
var AgentWorkflowActionsResource = class {
|
|
1962
|
+
constructor(http, config) {
|
|
1963
|
+
this.http = http;
|
|
1964
|
+
this.config = config;
|
|
1965
|
+
}
|
|
1966
|
+
async execute(body, options = {}) {
|
|
1967
|
+
const runId = options.idempotencyKey?.trim() || body.runId?.trim() || randomRunId2();
|
|
1968
|
+
const op = getOperation("WorkflowActionsController_execute");
|
|
1969
|
+
const path = formatOperationPath("WorkflowActionsController_execute");
|
|
1970
|
+
const lines = this.http.streamPost(path, body, {
|
|
1971
|
+
baseUrl: operationBaseUrl(this.http, op),
|
|
1972
|
+
headers: { "Idempotency-Key": runId }
|
|
1973
|
+
});
|
|
1974
|
+
return { runId, events: this.parseEvents(lines) };
|
|
1975
|
+
}
|
|
1976
|
+
async cancel(runId) {
|
|
1977
|
+
validateId(runId, "run_id");
|
|
1978
|
+
await invokeWithRetry(this.config, this.http, "WorkflowActionsController_cancel", {
|
|
1979
|
+
pathParams: { runId },
|
|
1980
|
+
jsonBody: {}
|
|
1981
|
+
});
|
|
1982
|
+
}
|
|
1983
|
+
async *parseEvents(lines) {
|
|
1984
|
+
yield* parseSseStream(lines);
|
|
1985
|
+
}
|
|
1986
|
+
};
|
|
1987
|
+
|
|
1988
|
+
// src/resources/agents.ts
|
|
1989
|
+
function workflowsListParams(pageSize, pageToken, search, type, view, includeVariation) {
|
|
1990
|
+
const extra = {};
|
|
1991
|
+
if (search !== void 0) extra.search = search;
|
|
1992
|
+
if (type !== void 0) extra.type = type;
|
|
1993
|
+
if (view !== void 0) extra.view = view;
|
|
1994
|
+
if (includeVariation !== void 0) extra.includeVariation = includeVariation;
|
|
1995
|
+
return aipListParams(pageSize, pageToken, extra);
|
|
1996
|
+
}
|
|
1997
|
+
function parseWorkflow(raw) {
|
|
1998
|
+
return raw;
|
|
1999
|
+
}
|
|
2000
|
+
var WorkflowsResource = class {
|
|
2001
|
+
constructor(http, config) {
|
|
2002
|
+
this.http = http;
|
|
2003
|
+
this.config = config;
|
|
2004
|
+
this.runs = new WorkflowRunsResource(http, config);
|
|
2005
|
+
this.workflowActions = new AgentWorkflowActionsResource(http, config);
|
|
2006
|
+
}
|
|
2007
|
+
list(options = {}) {
|
|
2008
|
+
const pageSize = options.pageSize ?? 25;
|
|
2009
|
+
validatePageSize(pageSize);
|
|
2010
|
+
return this.listPage(
|
|
2011
|
+
pageSize,
|
|
2012
|
+
options.pageToken,
|
|
2013
|
+
options.search,
|
|
2014
|
+
options.type,
|
|
2015
|
+
options.view,
|
|
2016
|
+
options.includeVariation
|
|
2017
|
+
);
|
|
2018
|
+
}
|
|
2019
|
+
async listPage(pageSize, pageToken, search, type, view, includeVariation) {
|
|
2020
|
+
const data = asRecord(
|
|
2021
|
+
await invokeWithRetry(this.config, this.http, "WorkflowsController_list", {
|
|
2022
|
+
query: workflowsListParams(
|
|
2023
|
+
pageSize,
|
|
2024
|
+
pageToken,
|
|
2025
|
+
search,
|
|
2026
|
+
type,
|
|
2027
|
+
view,
|
|
2028
|
+
includeVariation
|
|
2029
|
+
)
|
|
2030
|
+
})
|
|
2031
|
+
);
|
|
2032
|
+
return buildAipPage(
|
|
2033
|
+
data,
|
|
2034
|
+
"agents",
|
|
2035
|
+
parseWorkflow,
|
|
2036
|
+
(token) => this.listPage(pageSize, token, search, type, view, includeVariation)
|
|
2037
|
+
);
|
|
2038
|
+
}
|
|
2039
|
+
async get(workflowId, options = {}) {
|
|
2040
|
+
validateId(workflowId, "workflow_id");
|
|
2041
|
+
const query = {};
|
|
2042
|
+
if (options.view !== void 0) query.view = options.view;
|
|
2043
|
+
if (options.includeVariation !== void 0) {
|
|
2044
|
+
query.includeVariation = options.includeVariation;
|
|
2045
|
+
}
|
|
2046
|
+
const data = await invokeWithRetry(this.config, this.http, "WorkflowsController_get", {
|
|
2047
|
+
pathParams: { id: workflowId },
|
|
2048
|
+
query: Object.keys(query).length > 0 ? query : void 0
|
|
2049
|
+
});
|
|
2050
|
+
return parseWorkflow(data);
|
|
2051
|
+
}
|
|
2052
|
+
};
|
|
2053
|
+
|
|
2054
|
+
// src/resources/connections.ts
|
|
2055
|
+
function connectionsListParams(pageSize, pageToken, type) {
|
|
2056
|
+
const extra = {};
|
|
2057
|
+
if (type !== void 0) extra.type = type;
|
|
2058
|
+
return aipListParams(pageSize, pageToken, extra);
|
|
2059
|
+
}
|
|
2060
|
+
function parseConnection(raw) {
|
|
2061
|
+
return raw;
|
|
2062
|
+
}
|
|
2063
|
+
var ConnectionsResource = class {
|
|
2064
|
+
constructor(http, config) {
|
|
2065
|
+
this.http = http;
|
|
2066
|
+
this.config = config;
|
|
2067
|
+
}
|
|
2068
|
+
list(options = {}) {
|
|
2069
|
+
const pageSize = options.pageSize ?? 25;
|
|
2070
|
+
validatePageSize(pageSize);
|
|
2071
|
+
return this.listPage(pageSize, options.pageToken, options.type);
|
|
2072
|
+
}
|
|
2073
|
+
async listPage(pageSize, pageToken, type) {
|
|
2074
|
+
const data = asRecord(
|
|
2075
|
+
await invokeWithRetry(this.config, this.http, "ConnectionsController_list", {
|
|
2076
|
+
query: connectionsListParams(pageSize, pageToken, type)
|
|
2077
|
+
})
|
|
2078
|
+
);
|
|
2079
|
+
return buildAipPage(
|
|
2080
|
+
data,
|
|
2081
|
+
"connections",
|
|
2082
|
+
parseConnection,
|
|
2083
|
+
(token) => this.listPage(pageSize, token, type)
|
|
2084
|
+
);
|
|
2085
|
+
}
|
|
2086
|
+
async find(options) {
|
|
2087
|
+
const pageSize = options.pageSize ?? 25;
|
|
2088
|
+
validatePageSize(pageSize);
|
|
2089
|
+
const target = options.name.trim().toLowerCase();
|
|
2090
|
+
let token;
|
|
2091
|
+
do {
|
|
2092
|
+
const page = await this.listPage(pageSize, token, options.type);
|
|
2093
|
+
const match = page.items.find((c) => c.name?.toLowerCase() === target);
|
|
2094
|
+
if (match) return match;
|
|
2095
|
+
if (!page.hasNextPage()) break;
|
|
2096
|
+
token = page.nextPageToken;
|
|
2097
|
+
} while (token !== void 0);
|
|
2098
|
+
return void 0;
|
|
2099
|
+
}
|
|
2100
|
+
};
|
|
2101
|
+
|
|
2102
|
+
// src/resources/context/custom-items.ts
|
|
2103
|
+
function parseContextItem(raw) {
|
|
2104
|
+
return raw;
|
|
2105
|
+
}
|
|
2106
|
+
function parseCreatedCustomContextItem(raw) {
|
|
2107
|
+
return raw;
|
|
2108
|
+
}
|
|
2109
|
+
function parseDeletion(raw) {
|
|
2110
|
+
return raw;
|
|
2111
|
+
}
|
|
2112
|
+
var CustomContextItemsResource = class {
|
|
2113
|
+
constructor(http, config) {
|
|
2114
|
+
this.http = http;
|
|
2115
|
+
this.config = config;
|
|
2116
|
+
}
|
|
2117
|
+
list(options = {}) {
|
|
2118
|
+
const pageSize = options.pageSize ?? 25;
|
|
2119
|
+
validatePageSize(pageSize);
|
|
2120
|
+
return this.listPage(pageSize, options.pageToken, options);
|
|
2121
|
+
}
|
|
2122
|
+
async listPage(pageSize, pageToken, options) {
|
|
2123
|
+
const data = asRecord(
|
|
2124
|
+
await invokeWithRetry(this.config, this.http, "CustomContextItemsController_list", {
|
|
2125
|
+
query: aipListParams(pageSize, pageToken, {
|
|
2126
|
+
searchQuery: options.searchQuery,
|
|
2127
|
+
topics: options.topics
|
|
2128
|
+
})
|
|
2129
|
+
})
|
|
2130
|
+
);
|
|
2131
|
+
return buildAipPage(
|
|
2132
|
+
data,
|
|
2133
|
+
"contextItems",
|
|
2134
|
+
parseContextItem,
|
|
2135
|
+
(token) => this.listPage(pageSize, token, options)
|
|
2136
|
+
);
|
|
2137
|
+
}
|
|
2138
|
+
async get(uid) {
|
|
2139
|
+
return parseContextItem(
|
|
2140
|
+
await invokeWithRetry(this.config, this.http, "CustomContextItemsController_get", {
|
|
2141
|
+
pathParams: { uid }
|
|
2142
|
+
})
|
|
2143
|
+
);
|
|
2144
|
+
}
|
|
2145
|
+
async create(input) {
|
|
2146
|
+
return parseCreatedCustomContextItem(
|
|
2147
|
+
await invokeWithRetry(this.config, this.http, "CustomContextItemsController_create", {
|
|
2148
|
+
jsonBody: omitUndefined(input)
|
|
2149
|
+
})
|
|
2150
|
+
);
|
|
2151
|
+
}
|
|
2152
|
+
async batchCreate(inputs) {
|
|
2153
|
+
const data = asRecord(
|
|
2154
|
+
await invokeWithRetry(this.config, this.http, "CustomContextItemsController_batchCreate", {
|
|
2155
|
+
jsonBody: {
|
|
2156
|
+
items: inputs.map((input) => omitUndefined(input))
|
|
2157
|
+
}
|
|
2158
|
+
})
|
|
2159
|
+
);
|
|
2160
|
+
const items = data.contextItems;
|
|
2161
|
+
return Array.isArray(items) ? items.map(parseCreatedCustomContextItem) : [];
|
|
2162
|
+
}
|
|
2163
|
+
async update(uid, input) {
|
|
2164
|
+
return asRecord(
|
|
2165
|
+
await invokeWithRetry(this.config, this.http, "CustomContextItemsController_update", {
|
|
2166
|
+
pathParams: { uid },
|
|
2167
|
+
jsonBody: omitUndefined(input)
|
|
2168
|
+
})
|
|
2169
|
+
);
|
|
2170
|
+
}
|
|
2171
|
+
async delete(uid) {
|
|
2172
|
+
return parseDeletion(
|
|
2173
|
+
await invokeWithRetry(this.config, this.http, "CustomContextItemsController_delete", {
|
|
2174
|
+
pathParams: { uid }
|
|
2175
|
+
})
|
|
2176
|
+
);
|
|
2177
|
+
}
|
|
2178
|
+
};
|
|
2179
|
+
|
|
2180
|
+
// src/resources/context/items.ts
|
|
2181
|
+
function contextListParams(pageSize, pageToken, contextType) {
|
|
2182
|
+
const extra = {};
|
|
2183
|
+
if (contextType !== void 0) extra.contextTypes = [contextType];
|
|
2184
|
+
return aipListParams(pageSize, pageToken, extra);
|
|
2185
|
+
}
|
|
2186
|
+
function parseContextItem2(raw) {
|
|
2187
|
+
return raw;
|
|
2188
|
+
}
|
|
2189
|
+
function parseContextValueRow(raw) {
|
|
2190
|
+
return raw;
|
|
2191
|
+
}
|
|
2192
|
+
function parseLookupResponse(raw) {
|
|
2193
|
+
const item = raw.item;
|
|
2194
|
+
if (item === null || item === void 0) return void 0;
|
|
2195
|
+
return item;
|
|
2196
|
+
}
|
|
2197
|
+
var ContextItemsResource = class {
|
|
2198
|
+
constructor(http, config) {
|
|
2199
|
+
this.http = http;
|
|
2200
|
+
this.config = config;
|
|
2201
|
+
}
|
|
2202
|
+
list(options = {}) {
|
|
2203
|
+
const pageSize = options.pageSize ?? 25;
|
|
2204
|
+
validatePageSize(pageSize);
|
|
2205
|
+
return this.listPage(pageSize, options.pageToken, options.contextType);
|
|
2206
|
+
}
|
|
2207
|
+
async listPage(pageSize, pageToken, contextType) {
|
|
2208
|
+
const data = asRecord(
|
|
2209
|
+
await invokeWithRetry(this.config, this.http, "ContextItemsController_list", {
|
|
2210
|
+
query: contextListParams(pageSize, pageToken, contextType)
|
|
2211
|
+
})
|
|
2212
|
+
);
|
|
2213
|
+
return buildAipPage(
|
|
2214
|
+
data,
|
|
2215
|
+
"contextItems",
|
|
2216
|
+
parseContextItem2,
|
|
2217
|
+
(token) => this.listPage(pageSize, token, contextType)
|
|
2218
|
+
);
|
|
2219
|
+
}
|
|
2220
|
+
async get(uid) {
|
|
2221
|
+
const data = await invokeWithRetry(this.config, this.http, "ContextItemsController_get", {
|
|
2222
|
+
pathParams: { uid }
|
|
2223
|
+
});
|
|
2224
|
+
return parseContextItem2(data);
|
|
2225
|
+
}
|
|
2226
|
+
async lookup(options) {
|
|
2227
|
+
const body = omitUndefined({
|
|
2228
|
+
contextType: options.contextType,
|
|
2229
|
+
dataPath: options.dataPath,
|
|
2230
|
+
contentProjection: options.contentProjection
|
|
2231
|
+
});
|
|
2232
|
+
try {
|
|
2233
|
+
const raw = asRecord(
|
|
2234
|
+
await invokeWithRetry(this.config, this.http, "ContextItemsController_lookup", {
|
|
2235
|
+
jsonBody: body
|
|
2236
|
+
})
|
|
2237
|
+
);
|
|
2238
|
+
return parseLookupResponse(raw);
|
|
2239
|
+
} catch (error) {
|
|
2240
|
+
if (error instanceof NotFoundError) return void 0;
|
|
2241
|
+
throw error;
|
|
2242
|
+
}
|
|
2243
|
+
}
|
|
2244
|
+
listValues(uid, contextType, contentKeyPath, options = {}) {
|
|
2245
|
+
const pageSize = options.pageSize ?? 25;
|
|
2246
|
+
validatePageSize(pageSize, DEFAULT_MAX_PAGE_SIZE);
|
|
2247
|
+
return this.listValuesPage(uid, contextType, contentKeyPath, pageSize, options.pageToken);
|
|
2248
|
+
}
|
|
2249
|
+
listValuesFor(item, contentKeyPath, options = {}) {
|
|
2250
|
+
return this.listValues(item.uid, item.contextType, contentKeyPath, options);
|
|
2251
|
+
}
|
|
2252
|
+
async listValuesPage(uid, contextType, contentKeyPath, pageSize, pageToken) {
|
|
2253
|
+
const data = asRecord(
|
|
2254
|
+
await invokeWithRetry(this.config, this.http, "ContextItemsController_listValues", {
|
|
2255
|
+
pathParams: { uid },
|
|
2256
|
+
query: aipListParams(pageSize, pageToken, {
|
|
2257
|
+
contextType,
|
|
2258
|
+
contentKeyPath
|
|
2259
|
+
})
|
|
2260
|
+
})
|
|
2261
|
+
);
|
|
2262
|
+
return buildAipPage(
|
|
2263
|
+
data,
|
|
2264
|
+
"values",
|
|
2265
|
+
parseContextValueRow,
|
|
2266
|
+
(token) => this.listValuesPage(uid, contextType, contentKeyPath, pageSize, token)
|
|
2267
|
+
);
|
|
2268
|
+
}
|
|
2269
|
+
};
|
|
2270
|
+
|
|
2271
|
+
// src/resources/context/context.ts
|
|
2272
|
+
var ContextResource = class {
|
|
2273
|
+
constructor(http, config) {
|
|
2274
|
+
this.items = new ContextItemsResource(http, config);
|
|
2275
|
+
this.customItems = new CustomContextItemsResource(http, config);
|
|
2276
|
+
}
|
|
2277
|
+
};
|
|
2278
|
+
|
|
2279
|
+
// src/resources/modus/conversations.ts
|
|
2280
|
+
var ALLOWED_KINDS = /* @__PURE__ */ new Set(["all", "modus", "skills"]);
|
|
2281
|
+
function listParams(pageSize, pageToken, kind) {
|
|
2282
|
+
if (kind !== void 0 && !ALLOWED_KINDS.has(kind)) {
|
|
2283
|
+
throw new Error(
|
|
2284
|
+
`kind must be one of ${[...ALLOWED_KINDS].sort().join(", ")}, got ${JSON.stringify(kind)}`
|
|
2285
|
+
);
|
|
2286
|
+
}
|
|
2287
|
+
const extra = {};
|
|
2288
|
+
if (kind !== void 0) extra.kind = kind;
|
|
2289
|
+
return aipListParams(pageSize, pageToken, extra);
|
|
2290
|
+
}
|
|
2291
|
+
function parseListItem(raw) {
|
|
2292
|
+
return raw;
|
|
2293
|
+
}
|
|
2294
|
+
function parseConversation(raw) {
|
|
2295
|
+
return raw;
|
|
2296
|
+
}
|
|
2297
|
+
var ModusConversationsResource = class {
|
|
2298
|
+
constructor(http, config) {
|
|
2299
|
+
this.http = http;
|
|
2300
|
+
this.config = config;
|
|
2301
|
+
}
|
|
2302
|
+
list(options = {}) {
|
|
2303
|
+
const pageSize = options.pageSize ?? 25;
|
|
2304
|
+
validatePageSize(pageSize);
|
|
2305
|
+
return this.listPage(pageSize, options.pageToken, options.kind);
|
|
2306
|
+
}
|
|
2307
|
+
async listPage(pageSize, pageToken, kind) {
|
|
2308
|
+
const data = asRecord(
|
|
2309
|
+
await invokeWithRetry(this.config, this.http, "ModusConversationsController_list", {
|
|
2310
|
+
query: listParams(pageSize, pageToken, kind)
|
|
2311
|
+
})
|
|
2312
|
+
);
|
|
2313
|
+
return buildAipPage(
|
|
2314
|
+
data,
|
|
2315
|
+
"conversations",
|
|
2316
|
+
parseListItem,
|
|
2317
|
+
(token) => this.listPage(pageSize, token, kind)
|
|
2318
|
+
);
|
|
2319
|
+
}
|
|
2320
|
+
async get(threadId) {
|
|
2321
|
+
validateId(threadId, "thread_id");
|
|
2322
|
+
const data = await invokeWithRetry(this.config, this.http, "ModusConversationsController_get", {
|
|
2323
|
+
pathParams: { threadId }
|
|
2324
|
+
});
|
|
2325
|
+
return parseConversation(data);
|
|
2326
|
+
}
|
|
2327
|
+
};
|
|
2328
|
+
|
|
2329
|
+
// src/resources/modus/modus.ts
|
|
2330
|
+
var ModusResource = class {
|
|
2331
|
+
constructor(http, config) {
|
|
2332
|
+
this.http = http;
|
|
2333
|
+
this.config = config;
|
|
2334
|
+
this.conversations = new ModusConversationsResource(http, config);
|
|
2335
|
+
}
|
|
2336
|
+
async getContext(message, options = {}) {
|
|
2337
|
+
const data = await invokeWithRetry(this.config, this.http, "ModusContextController_compose", {
|
|
2338
|
+
jsonBody: omitUndefined({ message, limit: options.limit })
|
|
2339
|
+
});
|
|
2340
|
+
return data;
|
|
2341
|
+
}
|
|
2342
|
+
chat(message, options) {
|
|
2343
|
+
return modusChatBuffered(this.http, message, options);
|
|
2344
|
+
}
|
|
2345
|
+
chatStream(message, options) {
|
|
2346
|
+
return modusChatStreamSession(this.http, message, options);
|
|
2347
|
+
}
|
|
2348
|
+
};
|
|
2349
|
+
|
|
2350
|
+
// src/resources/skills/conversations.ts
|
|
2351
|
+
function parseListItem2(raw) {
|
|
2352
|
+
return raw;
|
|
2353
|
+
}
|
|
2354
|
+
function parseConversation2(raw) {
|
|
2355
|
+
return raw;
|
|
2356
|
+
}
|
|
2357
|
+
var ScopeConversationsResource = class {
|
|
2358
|
+
constructor(http, config, scopeId) {
|
|
2359
|
+
this.http = http;
|
|
2360
|
+
this.config = config;
|
|
2361
|
+
this.scopeId = scopeId;
|
|
2362
|
+
}
|
|
2363
|
+
list(options = {}) {
|
|
2364
|
+
const pageSize = options.pageSize ?? 25;
|
|
2365
|
+
validatePageSize(pageSize);
|
|
2366
|
+
return this.listPage(pageSize, options.pageToken);
|
|
2367
|
+
}
|
|
2368
|
+
async listPage(pageSize, pageToken) {
|
|
2369
|
+
validateId(this.scopeId, "scope_id");
|
|
2370
|
+
const data = asRecord(
|
|
2371
|
+
await invokeWithRetry(this.config, this.http, "ScopeConversationsController_list", {
|
|
2372
|
+
pathParams: { id: this.scopeId },
|
|
2373
|
+
query: aipListParams(pageSize, pageToken)
|
|
2374
|
+
})
|
|
2375
|
+
);
|
|
2376
|
+
return buildAipPage(
|
|
2377
|
+
data,
|
|
2378
|
+
"conversations",
|
|
2379
|
+
parseListItem2,
|
|
2380
|
+
(token) => this.listPage(pageSize, token)
|
|
2381
|
+
);
|
|
2382
|
+
}
|
|
2383
|
+
async get(threadId, options = {}) {
|
|
2384
|
+
validateId(this.scopeId, "scope_id");
|
|
2385
|
+
validateId(threadId, "thread_id");
|
|
2386
|
+
if (options.beforeMessageIndex !== void 0 && options.messageLimit === void 0) {
|
|
2387
|
+
throw new Error("beforeMessageIndex requires messageLimit");
|
|
2388
|
+
}
|
|
2389
|
+
const data = await invokeWithRetry(this.config, this.http, "ScopeConversationsController_get", {
|
|
2390
|
+
pathParams: { id: this.scopeId, threadId },
|
|
2391
|
+
query: {
|
|
2392
|
+
messageLimit: options.messageLimit,
|
|
2393
|
+
beforeMessageIndex: options.beforeMessageIndex
|
|
2394
|
+
}
|
|
2395
|
+
});
|
|
2396
|
+
return parseConversation2(data);
|
|
2397
|
+
}
|
|
2398
|
+
};
|
|
2399
|
+
|
|
2400
|
+
// src/resources/skills.ts
|
|
2401
|
+
function scopesListParams(pageSize, pageToken, search, view, managerId) {
|
|
2402
|
+
const extra = {};
|
|
2403
|
+
if (search !== void 0) extra.search = search;
|
|
2404
|
+
if (view !== void 0) extra.view = view;
|
|
2405
|
+
if (managerId !== void 0) extra.managerId = managerId;
|
|
2406
|
+
return aipListParams(pageSize, pageToken, extra);
|
|
2407
|
+
}
|
|
2408
|
+
function parseScope(raw) {
|
|
2409
|
+
return raw;
|
|
2410
|
+
}
|
|
2411
|
+
var ScopesResource = class {
|
|
2412
|
+
constructor(http, config) {
|
|
2413
|
+
this.http = http;
|
|
2414
|
+
this.config = config;
|
|
2415
|
+
}
|
|
2416
|
+
conversations(scopeId) {
|
|
2417
|
+
return new ScopeConversationsResource(this.http, this.config, scopeId);
|
|
2418
|
+
}
|
|
2419
|
+
list(options = {}) {
|
|
2420
|
+
const pageSize = options.pageSize ?? 25;
|
|
2421
|
+
validatePageSize(pageSize);
|
|
2422
|
+
return this.listPage(
|
|
2423
|
+
pageSize,
|
|
2424
|
+
options.pageToken,
|
|
2425
|
+
options.search,
|
|
2426
|
+
options.view,
|
|
2427
|
+
options.managerId
|
|
2428
|
+
);
|
|
2429
|
+
}
|
|
2430
|
+
async listPage(pageSize, pageToken, search, view, managerId) {
|
|
2431
|
+
const data = asRecord(
|
|
2432
|
+
await invokeWithRetry(this.config, this.http, "ScopesController_list", {
|
|
2433
|
+
query: scopesListParams(pageSize, pageToken, search, view, managerId)
|
|
2434
|
+
})
|
|
2435
|
+
);
|
|
2436
|
+
return buildAipPage(
|
|
2437
|
+
data,
|
|
2438
|
+
"skills",
|
|
2439
|
+
parseScope,
|
|
2440
|
+
(token) => this.listPage(pageSize, token, search, view, managerId)
|
|
2441
|
+
);
|
|
2442
|
+
}
|
|
2443
|
+
async get(scopeId, options = {}) {
|
|
2444
|
+
validateId(scopeId, "scope_id");
|
|
2445
|
+
const query = options.view !== void 0 ? { view: options.view } : void 0;
|
|
2446
|
+
const data = await invokeWithRetry(this.config, this.http, "ScopesController_get", {
|
|
2447
|
+
pathParams: { id: scopeId },
|
|
2448
|
+
query
|
|
2449
|
+
});
|
|
2450
|
+
return parseScope(data);
|
|
2451
|
+
}
|
|
2452
|
+
async getContext(scopeId, message, options = {}) {
|
|
2453
|
+
validateId(scopeId, "scope_id");
|
|
2454
|
+
const data = await invokeWithRetry(this.config, this.http, "ScopeContextController_compose", {
|
|
2455
|
+
pathParams: { id: scopeId },
|
|
2456
|
+
jsonBody: omitUndefined({ message, limit: options.limit })
|
|
2457
|
+
});
|
|
2458
|
+
return data;
|
|
2459
|
+
}
|
|
2460
|
+
chat(scopeId, message, options) {
|
|
2461
|
+
return chatBuffered(this.http, "scopes", scopeId, message, options);
|
|
2462
|
+
}
|
|
2463
|
+
chatStream(scopeId, message, options) {
|
|
2464
|
+
return chatStreamSession(this.http, "scopes", scopeId, message, options);
|
|
2465
|
+
}
|
|
2466
|
+
};
|
|
2467
|
+
|
|
2468
|
+
// src/resources/suggestions.ts
|
|
2469
|
+
var DEFAULT_SUGGESTIONS_PAGE_SIZE = 5;
|
|
2470
|
+
var MAX_SUGGESTIONS_PAGE_SIZE = 12;
|
|
2471
|
+
function parseSuggestion(raw) {
|
|
2472
|
+
return raw;
|
|
2473
|
+
}
|
|
2474
|
+
function suggestionListParams(options) {
|
|
2475
|
+
return {
|
|
2476
|
+
pageSize: options.pageSize,
|
|
2477
|
+
pageToken: options.pageToken,
|
|
2478
|
+
skill_id: options.skillId,
|
|
2479
|
+
skill_ids: options.skillIds?.join(",")
|
|
2480
|
+
};
|
|
2481
|
+
}
|
|
2482
|
+
var SuggestionsResource = class {
|
|
2483
|
+
constructor(http, config) {
|
|
2484
|
+
this.http = http;
|
|
2485
|
+
this.config = config;
|
|
2486
|
+
}
|
|
2487
|
+
list(options = {}) {
|
|
2488
|
+
const pageSize = options.pageSize ?? DEFAULT_SUGGESTIONS_PAGE_SIZE;
|
|
2489
|
+
validatePageSize(pageSize, MAX_SUGGESTIONS_PAGE_SIZE);
|
|
2490
|
+
return this.listPage(pageSize, options.pageToken, options.skillId, options.skillIds);
|
|
2491
|
+
}
|
|
2492
|
+
async listPage(pageSize, pageToken, skillId, skillIds) {
|
|
2493
|
+
const data = asRecord(
|
|
2494
|
+
await invokeWithRetry(this.config, this.http, "SuggestionsController_listApproved", {
|
|
2495
|
+
query: suggestionListParams({ pageSize, pageToken, skillId, skillIds })
|
|
2496
|
+
})
|
|
2497
|
+
);
|
|
2498
|
+
return buildAipPage(
|
|
2499
|
+
data,
|
|
2500
|
+
"suggestions",
|
|
2501
|
+
parseSuggestion,
|
|
2502
|
+
(token) => this.listPage(pageSize, token, skillId, skillIds)
|
|
2503
|
+
);
|
|
2504
|
+
}
|
|
2505
|
+
async recordEvent(id, event) {
|
|
2506
|
+
validateId(id, "id");
|
|
2507
|
+
await invokeWithRetry(this.config, this.http, "SuggestionsController_recordEvent", {
|
|
2508
|
+
pathParams: { id },
|
|
2509
|
+
jsonBody: event
|
|
2510
|
+
});
|
|
2511
|
+
}
|
|
2512
|
+
};
|
|
2513
|
+
|
|
2514
|
+
// src/index.ts
|
|
2515
|
+
var Modus = class extends ModusClientBase {
|
|
2516
|
+
constructor(options = {}) {
|
|
2517
|
+
super(options);
|
|
2518
|
+
this.scopes = new ScopesResource(this.http, this.config);
|
|
2519
|
+
this.modus = new ModusResource(this.http, this.config);
|
|
2520
|
+
this.workflows = new WorkflowsResource(this.http, this.config);
|
|
2521
|
+
this.context = new ContextResource(this.http, this.config);
|
|
2522
|
+
this.connections = new ConnectionsResource(this.http, this.config);
|
|
2523
|
+
this.suggestions = new SuggestionsResource(this.http, this.config);
|
|
2524
|
+
}
|
|
2525
|
+
};
|
|
2526
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
2527
|
+
0 && (module.exports = {
|
|
2528
|
+
APIConnectionError,
|
|
2529
|
+
AuthenticationError,
|
|
2530
|
+
ChatStream,
|
|
2531
|
+
ConflictError,
|
|
2532
|
+
InternalServerError,
|
|
2533
|
+
Modus,
|
|
2534
|
+
ModusError,
|
|
2535
|
+
NotFoundError,
|
|
2536
|
+
OPERATIONS,
|
|
2537
|
+
Page,
|
|
2538
|
+
PermissionDeniedError,
|
|
2539
|
+
RateLimitError,
|
|
2540
|
+
RunCancelledError,
|
|
2541
|
+
StreamTimeoutError,
|
|
2542
|
+
UnprocessableError,
|
|
2543
|
+
ValidationError,
|
|
2544
|
+
conversationSkillId
|
|
2545
|
+
});
|
|
2546
|
+
//# sourceMappingURL=index.cjs.map
|