@getmodus/sdk 0.8.0 → 0.10.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 +189 -0
- package/README.md +182 -14
- package/dist/{conversations-COA6NW8I.d.cts → _client-base-H5rt5EGy.d.cts} +3789 -972
- package/dist/{conversations-COA6NW8I.d.ts → _client-base-H5rt5EGy.d.ts} +3789 -972
- package/dist/{chunk-GFS7CNON.js → chunk-BMYCORZF.js} +656 -325
- package/dist/chunk-BMYCORZF.js.map +1 -0
- package/dist/chunk-NA3ZD35T.cjs +2666 -0
- package/dist/chunk-NA3ZD35T.cjs.map +1 -0
- package/dist/index.cjs +722 -2870
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +743 -497
- package/dist/index.d.ts +743 -497
- package/dist/index.js +601 -434
- package/dist/index.js.map +1 -1
- package/dist/management/index.cjs +1293 -3126
- package/dist/management/index.cjs.map +1 -1
- package/dist/management/index.d.cts +867 -436
- package/dist/management/index.d.ts +867 -436
- package/dist/management/index.js +1110 -680
- package/dist/management/index.js.map +1 -1
- package/package.json +15 -8
- package/dist/chunk-GFS7CNON.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1,1373 +1,46 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
19
|
|
|
20
|
-
// src/index.ts
|
|
21
|
-
var index_exports = {};
|
|
22
|
-
__export(index_exports, {
|
|
23
|
-
APIConnectionError: () => APIConnectionError,
|
|
24
|
-
AgentType: () => AgentType,
|
|
25
|
-
AuthenticationError: () => AuthenticationError,
|
|
26
|
-
ChatStream: () => ChatStream,
|
|
27
|
-
ConflictError: () => ConflictError,
|
|
28
|
-
InternalServerError: () => InternalServerError,
|
|
29
|
-
Modus: () => Modus,
|
|
30
|
-
ModusError: () => ModusError,
|
|
31
|
-
NotFoundError: () => NotFoundError,
|
|
32
|
-
OPERATIONS: () => OPERATIONS,
|
|
33
|
-
Page: () => Page,
|
|
34
|
-
PermissionDeniedError: () => PermissionDeniedError,
|
|
35
|
-
RateLimitError: () => RateLimitError,
|
|
36
|
-
RunCancelledError: () => RunCancelledError,
|
|
37
|
-
StreamTimeoutError: () => StreamTimeoutError,
|
|
38
|
-
UnprocessableError: () => UnprocessableError,
|
|
39
|
-
ValidationError: () => ValidationError,
|
|
40
|
-
WorkflowType: () => WorkflowType,
|
|
41
|
-
conversationScopeId: () => conversationScopeId,
|
|
42
|
-
conversationSkillId: () => conversationSkillId
|
|
43
|
-
});
|
|
44
|
-
module.exports = __toCommonJS(index_exports);
|
|
45
|
-
|
|
46
|
-
// src/_generated/operations.ts
|
|
47
|
-
var OPERATIONS = {
|
|
48
|
-
"ConnectionsController_list": {
|
|
49
|
-
method: "GET",
|
|
50
|
-
path: "/api/v1/connections",
|
|
51
|
-
service: "modus-api",
|
|
52
|
-
serverUrl: "https://api.getmodus.com",
|
|
53
|
-
pathParams: [],
|
|
54
|
-
queryParams: ["pageToken", "pageSize", "type"],
|
|
55
|
-
requestSchema: null,
|
|
56
|
-
responseSchema: "ListConnectionsResponseDto"
|
|
57
|
-
},
|
|
58
|
-
"ContextCreatorsController_createLink": {
|
|
59
|
-
method: "POST",
|
|
60
|
-
path: "/api/v1/context/links",
|
|
61
|
-
service: "modus-api",
|
|
62
|
-
serverUrl: "https://api.getmodus.com",
|
|
63
|
-
pathParams: [],
|
|
64
|
-
queryParams: [],
|
|
65
|
-
requestSchema: "CreateLinkDto",
|
|
66
|
-
responseSchema: "CreatedContextItemResponseDto"
|
|
67
|
-
},
|
|
68
|
-
"ContextCreatorsController_createNote": {
|
|
69
|
-
method: "POST",
|
|
70
|
-
path: "/api/v1/context/notes",
|
|
71
|
-
service: "modus-api",
|
|
72
|
-
serverUrl: "https://api.getmodus.com",
|
|
73
|
-
pathParams: [],
|
|
74
|
-
queryParams: [],
|
|
75
|
-
requestSchema: "CreateNoteDto",
|
|
76
|
-
responseSchema: "CreatedContextItemResponseDto"
|
|
77
|
-
},
|
|
78
|
-
"ContextCreatorsController_createSavedQuery": {
|
|
79
|
-
method: "POST",
|
|
80
|
-
path: "/api/v1/context/saved-queries",
|
|
81
|
-
service: "modus-api",
|
|
82
|
-
serverUrl: "https://api.getmodus.com",
|
|
83
|
-
pathParams: [],
|
|
84
|
-
queryParams: [],
|
|
85
|
-
requestSchema: "CreateSavedQueryDto",
|
|
86
|
-
responseSchema: "CreatedContextItemResponseDto"
|
|
87
|
-
},
|
|
88
|
-
"ContextFilesController_finalize": {
|
|
89
|
-
method: "POST",
|
|
90
|
-
path: "/api/v1/context/files/{uploadId}/finalize",
|
|
91
|
-
service: "modus-api",
|
|
92
|
-
serverUrl: "https://api.getmodus.com",
|
|
93
|
-
pathParams: ["uploadId"],
|
|
94
|
-
queryParams: [],
|
|
95
|
-
requestSchema: "FinalizeUploadDto",
|
|
96
|
-
responseSchema: "FileUploadResourceDto"
|
|
97
|
-
},
|
|
98
|
-
"ContextFilesController_finalizeMany": {
|
|
99
|
-
method: "POST",
|
|
100
|
-
path: "/api/v1/context/files/finalize",
|
|
101
|
-
service: "modus-api",
|
|
102
|
-
serverUrl: "https://api.getmodus.com",
|
|
103
|
-
pathParams: [],
|
|
104
|
-
queryParams: [],
|
|
105
|
-
requestSchema: "BulkFinalizeDto",
|
|
106
|
-
responseSchema: "BulkFinalizeResponseDto"
|
|
107
|
-
},
|
|
108
|
-
"ContextFilesController_get": {
|
|
109
|
-
method: "GET",
|
|
110
|
-
path: "/api/v1/context/files/{uploadId}",
|
|
111
|
-
service: "modus-api",
|
|
112
|
-
serverUrl: "https://api.getmodus.com",
|
|
113
|
-
pathParams: ["uploadId"],
|
|
114
|
-
queryParams: [],
|
|
115
|
-
requestSchema: null,
|
|
116
|
-
responseSchema: "FileUploadResourceDto"
|
|
117
|
-
},
|
|
118
|
-
"ContextFilesController_list": {
|
|
119
|
-
method: "GET",
|
|
120
|
-
path: "/api/v1/context/files",
|
|
121
|
-
service: "modus-api",
|
|
122
|
-
serverUrl: "https://api.getmodus.com",
|
|
123
|
-
pathParams: [],
|
|
124
|
-
queryParams: ["pageToken", "pageSize"],
|
|
125
|
-
requestSchema: null,
|
|
126
|
-
responseSchema: "ListFilesResponseDto"
|
|
127
|
-
},
|
|
128
|
-
"ContextFilesController_uploadFromUrl": {
|
|
129
|
-
method: "POST",
|
|
130
|
-
path: "/api/v1/context/files/uploadFromUrl",
|
|
131
|
-
service: "modus-api",
|
|
132
|
-
serverUrl: "https://api.getmodus.com",
|
|
133
|
-
pathParams: [],
|
|
134
|
-
queryParams: [],
|
|
135
|
-
requestSchema: "UploadFromUrlDto",
|
|
136
|
-
responseSchema: "FileUploadResourceDto"
|
|
137
|
-
},
|
|
138
|
-
"ContextFilesController_uploadFromUrls": {
|
|
139
|
-
method: "POST",
|
|
140
|
-
path: "/api/v1/context/files/uploadFromUrls",
|
|
141
|
-
service: "modus-api",
|
|
142
|
-
serverUrl: "https://api.getmodus.com",
|
|
143
|
-
pathParams: [],
|
|
144
|
-
queryParams: [],
|
|
145
|
-
requestSchema: "BulkUploadFromUrlsDto",
|
|
146
|
-
responseSchema: "BulkUploadFromUrlsResponseDto"
|
|
147
|
-
},
|
|
148
|
-
"ContextFilesController_uploadUrl": {
|
|
149
|
-
method: "POST",
|
|
150
|
-
path: "/api/v1/context/files/uploadUrl",
|
|
151
|
-
service: "modus-api",
|
|
152
|
-
serverUrl: "https://api.getmodus.com",
|
|
153
|
-
pathParams: [],
|
|
154
|
-
queryParams: [],
|
|
155
|
-
requestSchema: "UploadUrlDto",
|
|
156
|
-
responseSchema: "UploadUrlResponseDto"
|
|
157
|
-
},
|
|
158
|
-
"ContextFilesController_uploadUrls": {
|
|
159
|
-
method: "POST",
|
|
160
|
-
path: "/api/v1/context/files/uploadUrls",
|
|
161
|
-
service: "modus-api",
|
|
162
|
-
serverUrl: "https://api.getmodus.com",
|
|
163
|
-
pathParams: [],
|
|
164
|
-
queryParams: [],
|
|
165
|
-
requestSchema: "BulkUploadUrlsDto",
|
|
166
|
-
responseSchema: "BulkUploadUrlsResponseDto"
|
|
167
|
-
},
|
|
168
|
-
"ContextItemsController_delete": {
|
|
169
|
-
method: "DELETE",
|
|
170
|
-
path: "/api/v1/context/items/{uid}",
|
|
171
|
-
service: "modus-api",
|
|
172
|
-
serverUrl: "https://api.getmodus.com",
|
|
173
|
-
pathParams: ["uid"],
|
|
174
|
-
queryParams: [],
|
|
175
|
-
requestSchema: null,
|
|
176
|
-
responseSchema: "DeleteContextItemResponseDto"
|
|
177
|
-
},
|
|
178
|
-
"ContextItemsController_get": {
|
|
179
|
-
method: "GET",
|
|
180
|
-
path: "/api/v1/context/items/{uid}",
|
|
181
|
-
service: "modus-api",
|
|
182
|
-
serverUrl: "https://api.getmodus.com",
|
|
183
|
-
pathParams: ["uid"],
|
|
184
|
-
queryParams: [],
|
|
185
|
-
requestSchema: null,
|
|
186
|
-
responseSchema: "ContextItemDto"
|
|
187
|
-
},
|
|
188
|
-
"ContextItemsController_list": {
|
|
189
|
-
method: "GET",
|
|
190
|
-
path: "/api/v1/context/items",
|
|
191
|
-
service: "modus-api",
|
|
192
|
-
serverUrl: "https://api.getmodus.com",
|
|
193
|
-
pathParams: [],
|
|
194
|
-
queryParams: ["pageToken", "pageSize", "contextTypes", "verificationStatuses", "searchQuery", "topics", "connectionIds", "parentUids", "ancestorUids"],
|
|
195
|
-
requestSchema: null,
|
|
196
|
-
responseSchema: "ListContextItemsResponseDto"
|
|
197
|
-
},
|
|
198
|
-
"ContextItemsController_listValues": {
|
|
199
|
-
method: "GET",
|
|
200
|
-
path: "/api/v1/context/items/{uid}/values",
|
|
201
|
-
service: "modus-api",
|
|
202
|
-
serverUrl: "https://api.getmodus.com",
|
|
203
|
-
pathParams: ["uid"],
|
|
204
|
-
queryParams: ["contextType", "contentKeyPath", "pageSize", "offset", "pageToken", "searchQuery", "dataPathPrefix"],
|
|
205
|
-
requestSchema: null,
|
|
206
|
-
responseSchema: "ListContextItemValuesResponseDto"
|
|
207
|
-
},
|
|
208
|
-
"ContextItemsController_lookup": {
|
|
209
|
-
method: "POST",
|
|
210
|
-
path: "/api/v1/context/items/lookup",
|
|
211
|
-
service: "modus-api",
|
|
212
|
-
serverUrl: "https://api.getmodus.com",
|
|
213
|
-
pathParams: [],
|
|
214
|
-
queryParams: [],
|
|
215
|
-
requestSchema: "LookupContextItemDto",
|
|
216
|
-
responseSchema: "LookupContextItemResponseDto"
|
|
217
|
-
},
|
|
218
|
-
"ContextItemsController_move": {
|
|
219
|
-
method: "POST",
|
|
220
|
-
path: "/api/v1/context/items/{uid}/move",
|
|
221
|
-
service: "modus-api",
|
|
222
|
-
serverUrl: "https://api.getmodus.com",
|
|
223
|
-
pathParams: ["uid"],
|
|
224
|
-
queryParams: [],
|
|
225
|
-
requestSchema: "MoveContextItemDto",
|
|
226
|
-
responseSchema: "MoveContextItemResponseDto"
|
|
227
|
-
},
|
|
228
|
-
"ContextItemsController_update": {
|
|
229
|
-
method: "PATCH",
|
|
230
|
-
path: "/api/v1/context/items/{uid}",
|
|
231
|
-
service: "modus-api",
|
|
232
|
-
serverUrl: "https://api.getmodus.com",
|
|
233
|
-
pathParams: ["uid"],
|
|
234
|
-
queryParams: ["updateMask"],
|
|
235
|
-
requestSchema: "UpdateContextItemDto",
|
|
236
|
-
responseSchema: null
|
|
237
|
-
},
|
|
238
|
-
"CustomContextItemsController_batchCreate": {
|
|
239
|
-
method: "POST",
|
|
240
|
-
path: "/api/v1/context/custom-items/batch",
|
|
241
|
-
service: "modus-api",
|
|
242
|
-
serverUrl: "https://api.getmodus.com",
|
|
243
|
-
pathParams: [],
|
|
244
|
-
queryParams: [],
|
|
245
|
-
requestSchema: "BatchCreateCustomContextItemsDto",
|
|
246
|
-
responseSchema: "BatchCreateCustomContextItemsResponseDto"
|
|
247
|
-
},
|
|
248
|
-
"CustomContextItemsController_create": {
|
|
249
|
-
method: "POST",
|
|
250
|
-
path: "/api/v1/context/custom-items",
|
|
251
|
-
service: "modus-api",
|
|
252
|
-
serverUrl: "https://api.getmodus.com",
|
|
253
|
-
pathParams: [],
|
|
254
|
-
queryParams: [],
|
|
255
|
-
requestSchema: "CreateCustomContextItemDto",
|
|
256
|
-
responseSchema: "CreatedCustomContextItemResponseDto"
|
|
257
|
-
},
|
|
258
|
-
"CustomContextItemsController_createRelations": {
|
|
259
|
-
method: "POST",
|
|
260
|
-
path: "/api/v1/context/custom-items/relations",
|
|
261
|
-
service: "modus-api",
|
|
262
|
-
serverUrl: "https://api.getmodus.com",
|
|
263
|
-
pathParams: [],
|
|
264
|
-
queryParams: [],
|
|
265
|
-
requestSchema: "BatchCreateCustomContextItemRelationsDto",
|
|
266
|
-
responseSchema: "BatchCreateCustomContextItemRelationsResponseDto"
|
|
267
|
-
},
|
|
268
|
-
"CustomContextItemsController_delete": {
|
|
269
|
-
method: "DELETE",
|
|
270
|
-
path: "/api/v1/context/custom-items/{uid}",
|
|
271
|
-
service: "modus-api",
|
|
272
|
-
serverUrl: "https://api.getmodus.com",
|
|
273
|
-
pathParams: ["uid"],
|
|
274
|
-
queryParams: [],
|
|
275
|
-
requestSchema: null,
|
|
276
|
-
responseSchema: "DeleteContextItemResponseDto"
|
|
277
|
-
},
|
|
278
|
-
"CustomContextItemsController_get": {
|
|
279
|
-
method: "GET",
|
|
280
|
-
path: "/api/v1/context/custom-items/{uid}",
|
|
281
|
-
service: "modus-api",
|
|
282
|
-
serverUrl: "https://api.getmodus.com",
|
|
283
|
-
pathParams: ["uid"],
|
|
284
|
-
queryParams: [],
|
|
285
|
-
requestSchema: null,
|
|
286
|
-
responseSchema: "ContextItemDto"
|
|
287
|
-
},
|
|
288
|
-
"CustomContextItemsController_list": {
|
|
289
|
-
method: "GET",
|
|
290
|
-
path: "/api/v1/context/custom-items",
|
|
291
|
-
service: "modus-api",
|
|
292
|
-
serverUrl: "https://api.getmodus.com",
|
|
293
|
-
pathParams: [],
|
|
294
|
-
queryParams: ["pageToken", "pageSize", "contextTypes", "verificationStatuses", "searchQuery", "topics"],
|
|
295
|
-
requestSchema: null,
|
|
296
|
-
responseSchema: "ListCustomContextItemsResponseDto"
|
|
297
|
-
},
|
|
298
|
-
"CustomContextItemsController_update": {
|
|
299
|
-
method: "PATCH",
|
|
300
|
-
path: "/api/v1/context/custom-items/{uid}",
|
|
301
|
-
service: "modus-api",
|
|
302
|
-
serverUrl: "https://api.getmodus.com",
|
|
303
|
-
pathParams: ["uid"],
|
|
304
|
-
queryParams: [],
|
|
305
|
-
requestSchema: "UpdateCustomContextItemDto",
|
|
306
|
-
responseSchema: null
|
|
307
|
-
},
|
|
308
|
-
"DashboardsController_acceptOwnership": {
|
|
309
|
-
method: "POST",
|
|
310
|
-
path: "/api/v1/context/dashboards/{dashboardId}/transfer-ownership/accept",
|
|
311
|
-
service: "modus-api",
|
|
312
|
-
serverUrl: "https://api.getmodus.com",
|
|
313
|
-
pathParams: ["dashboardId"],
|
|
314
|
-
queryParams: [],
|
|
315
|
-
requestSchema: null,
|
|
316
|
-
responseSchema: "DashboardDto"
|
|
317
|
-
},
|
|
318
|
-
"DashboardsController_cancelOwnership": {
|
|
319
|
-
method: "DELETE",
|
|
320
|
-
path: "/api/v1/context/dashboards/{dashboardId}/transfer-ownership",
|
|
321
|
-
service: "modus-api",
|
|
322
|
-
serverUrl: "https://api.getmodus.com",
|
|
323
|
-
pathParams: ["dashboardId"],
|
|
324
|
-
queryParams: [],
|
|
325
|
-
requestSchema: null,
|
|
326
|
-
responseSchema: "DashboardDto"
|
|
327
|
-
},
|
|
328
|
-
"DashboardsController_create": {
|
|
329
|
-
method: "POST",
|
|
330
|
-
path: "/api/v1/context/dashboards",
|
|
331
|
-
service: "modus-api",
|
|
332
|
-
serverUrl: "https://api.getmodus.com",
|
|
333
|
-
pathParams: [],
|
|
334
|
-
queryParams: [],
|
|
335
|
-
requestSchema: "CreateDashboardDto",
|
|
336
|
-
responseSchema: "DashboardDto"
|
|
337
|
-
},
|
|
338
|
-
"DashboardsController_createElement": {
|
|
339
|
-
method: "POST",
|
|
340
|
-
path: "/api/v1/context/dashboards/{dashboardId}/elements",
|
|
341
|
-
service: "modus-api",
|
|
342
|
-
serverUrl: "https://api.getmodus.com",
|
|
343
|
-
pathParams: ["dashboardId"],
|
|
344
|
-
queryParams: [],
|
|
345
|
-
requestSchema: "CreateDashboardElementDto",
|
|
346
|
-
responseSchema: "DashboardElementResponseDto"
|
|
347
|
-
},
|
|
348
|
-
"DashboardsController_delete": {
|
|
349
|
-
method: "DELETE",
|
|
350
|
-
path: "/api/v1/context/dashboards/{dashboardId}",
|
|
351
|
-
service: "modus-api",
|
|
352
|
-
serverUrl: "https://api.getmodus.com",
|
|
353
|
-
pathParams: ["dashboardId"],
|
|
354
|
-
queryParams: [],
|
|
355
|
-
requestSchema: null,
|
|
356
|
-
responseSchema: null
|
|
357
|
-
},
|
|
358
|
-
"DashboardsController_get": {
|
|
359
|
-
method: "GET",
|
|
360
|
-
path: "/api/v1/context/dashboards/{dashboardId}",
|
|
361
|
-
service: "modus-api",
|
|
362
|
-
serverUrl: "https://api.getmodus.com",
|
|
363
|
-
pathParams: ["dashboardId"],
|
|
364
|
-
queryParams: ["view"],
|
|
365
|
-
requestSchema: null,
|
|
366
|
-
responseSchema: "DashboardDto"
|
|
367
|
-
},
|
|
368
|
-
"DashboardsController_getElement": {
|
|
369
|
-
method: "GET",
|
|
370
|
-
path: "/api/v1/context/dashboards/{dashboardId}/elements/{elementId}",
|
|
371
|
-
service: "modus-api",
|
|
372
|
-
serverUrl: "https://api.getmodus.com",
|
|
373
|
-
pathParams: ["dashboardId", "elementId"],
|
|
374
|
-
queryParams: [],
|
|
375
|
-
requestSchema: null,
|
|
376
|
-
responseSchema: "DashboardElementResponseDto"
|
|
377
|
-
},
|
|
378
|
-
"DashboardsController_getVersion": {
|
|
379
|
-
method: "GET",
|
|
380
|
-
path: "/api/v1/context/dashboards/{dashboardId}/versions/{versionId}",
|
|
381
|
-
service: "modus-api",
|
|
382
|
-
serverUrl: "https://api.getmodus.com",
|
|
383
|
-
pathParams: ["dashboardId", "versionId"],
|
|
384
|
-
queryParams: [],
|
|
385
|
-
requestSchema: null,
|
|
386
|
-
responseSchema: "DashboardDto"
|
|
387
|
-
},
|
|
388
|
-
"DashboardsController_list": {
|
|
389
|
-
method: "GET",
|
|
390
|
-
path: "/api/v1/context/dashboards",
|
|
391
|
-
service: "modus-api",
|
|
392
|
-
serverUrl: "https://api.getmodus.com",
|
|
393
|
-
pathParams: [],
|
|
394
|
-
queryParams: ["view"],
|
|
395
|
-
requestSchema: null,
|
|
396
|
-
responseSchema: "ListDashboardsResponseDto"
|
|
397
|
-
},
|
|
398
|
-
"DashboardsController_listDraftSnapshots": {
|
|
399
|
-
method: "GET",
|
|
400
|
-
path: "/api/v1/context/dashboards/{dashboardId}/draft-snapshots",
|
|
401
|
-
service: "modus-api",
|
|
402
|
-
serverUrl: "https://api.getmodus.com",
|
|
403
|
-
pathParams: ["dashboardId"],
|
|
404
|
-
queryParams: [],
|
|
405
|
-
requestSchema: null,
|
|
406
|
-
responseSchema: "ListDashboardDraftSnapshotsResponseDto"
|
|
407
|
-
},
|
|
408
|
-
"DashboardsController_listElements": {
|
|
409
|
-
method: "GET",
|
|
410
|
-
path: "/api/v1/context/dashboards/{dashboardId}/elements",
|
|
411
|
-
service: "modus-api",
|
|
412
|
-
serverUrl: "https://api.getmodus.com",
|
|
413
|
-
pathParams: ["dashboardId"],
|
|
414
|
-
queryParams: [],
|
|
415
|
-
requestSchema: null,
|
|
416
|
-
responseSchema: "DashboardElementsListResponseDto"
|
|
417
|
-
},
|
|
418
|
-
"DashboardsController_listVersions": {
|
|
419
|
-
method: "GET",
|
|
420
|
-
path: "/api/v1/context/dashboards/{dashboardId}/versions",
|
|
421
|
-
service: "modus-api",
|
|
422
|
-
serverUrl: "https://api.getmodus.com",
|
|
423
|
-
pathParams: ["dashboardId"],
|
|
424
|
-
queryParams: [],
|
|
425
|
-
requestSchema: null,
|
|
426
|
-
responseSchema: "ListDashboardVersionsResponseDto"
|
|
427
|
-
},
|
|
428
|
-
"DashboardsController_publish": {
|
|
429
|
-
method: "POST",
|
|
430
|
-
path: "/api/v1/context/dashboards/{dashboardId}/publish",
|
|
431
|
-
service: "modus-api",
|
|
432
|
-
serverUrl: "https://api.getmodus.com",
|
|
433
|
-
pathParams: ["dashboardId"],
|
|
434
|
-
queryParams: [],
|
|
435
|
-
requestSchema: "PublishDashboardDto",
|
|
436
|
-
responseSchema: "PublishDashboardResponseDto"
|
|
437
|
-
},
|
|
438
|
-
"DashboardsController_restore": {
|
|
439
|
-
method: "POST",
|
|
440
|
-
path: "/api/v1/context/dashboards/{dashboardId}/versions/{versionId}/restore",
|
|
441
|
-
service: "modus-api",
|
|
442
|
-
serverUrl: "https://api.getmodus.com",
|
|
443
|
-
pathParams: ["dashboardId", "versionId"],
|
|
444
|
-
queryParams: [],
|
|
445
|
-
requestSchema: null,
|
|
446
|
-
responseSchema: "DashboardDto"
|
|
447
|
-
},
|
|
448
|
-
"DashboardsController_transferOwnership": {
|
|
449
|
-
method: "POST",
|
|
450
|
-
path: "/api/v1/context/dashboards/{dashboardId}/transfer-ownership",
|
|
451
|
-
service: "modus-api",
|
|
452
|
-
serverUrl: "https://api.getmodus.com",
|
|
453
|
-
pathParams: ["dashboardId"],
|
|
454
|
-
queryParams: [],
|
|
455
|
-
requestSchema: "TransferDashboardOwnershipDto",
|
|
456
|
-
responseSchema: "DashboardDto"
|
|
457
|
-
},
|
|
458
|
-
"DashboardsController_updateAccess": {
|
|
459
|
-
method: "PATCH",
|
|
460
|
-
path: "/api/v1/context/dashboards/{dashboardId}/access",
|
|
461
|
-
service: "modus-api",
|
|
462
|
-
serverUrl: "https://api.getmodus.com",
|
|
463
|
-
pathParams: ["dashboardId"],
|
|
464
|
-
queryParams: [],
|
|
465
|
-
requestSchema: "UpdateDashboardAccessDto",
|
|
466
|
-
responseSchema: "DashboardDto"
|
|
467
|
-
},
|
|
468
|
-
"DashboardsController_updateDraft": {
|
|
469
|
-
method: "PATCH",
|
|
470
|
-
path: "/api/v1/context/dashboards/{dashboardId}/draft",
|
|
471
|
-
service: "modus-api",
|
|
472
|
-
serverUrl: "https://api.getmodus.com",
|
|
473
|
-
pathParams: ["dashboardId"],
|
|
474
|
-
queryParams: [],
|
|
475
|
-
requestSchema: "UpdateDashboardDraftDto",
|
|
476
|
-
responseSchema: "DashboardDto"
|
|
477
|
-
},
|
|
478
|
-
"DashboardsController_updateElement": {
|
|
479
|
-
method: "PATCH",
|
|
480
|
-
path: "/api/v1/context/dashboards/{dashboardId}/elements/{elementId}",
|
|
481
|
-
service: "modus-api",
|
|
482
|
-
serverUrl: "https://api.getmodus.com",
|
|
483
|
-
pathParams: ["dashboardId", "elementId"],
|
|
484
|
-
queryParams: [],
|
|
485
|
-
requestSchema: "UpdateDashboardElementDto",
|
|
486
|
-
responseSchema: "DashboardDto"
|
|
487
|
-
},
|
|
488
|
-
"DashboardsController_updateLayout": {
|
|
489
|
-
method: "PATCH",
|
|
490
|
-
path: "/api/v1/context/dashboards/{dashboardId}/layout",
|
|
491
|
-
service: "modus-api",
|
|
492
|
-
serverUrl: "https://api.getmodus.com",
|
|
493
|
-
pathParams: ["dashboardId"],
|
|
494
|
-
queryParams: [],
|
|
495
|
-
requestSchema: "UpdateDashboardLayoutDto",
|
|
496
|
-
responseSchema: "DashboardDto"
|
|
497
|
-
},
|
|
498
|
-
"EvaluationsController_getConfig": {
|
|
499
|
-
method: "GET",
|
|
500
|
-
path: "/api/v1/scopes/{id}/evaluations/config",
|
|
501
|
-
service: "modus-api",
|
|
502
|
-
serverUrl: "https://api.getmodus.com",
|
|
503
|
-
pathParams: ["id"],
|
|
504
|
-
queryParams: [],
|
|
505
|
-
requestSchema: null,
|
|
506
|
-
responseSchema: "EvaluationConfigDto"
|
|
507
|
-
},
|
|
508
|
-
"EvaluationsController_getRun": {
|
|
509
|
-
method: "GET",
|
|
510
|
-
path: "/api/v1/scopes/{id}/evaluations/runs/{runId}",
|
|
511
|
-
service: "modus-api",
|
|
512
|
-
serverUrl: "https://api.getmodus.com",
|
|
513
|
-
pathParams: ["id", "runId"],
|
|
514
|
-
queryParams: [],
|
|
515
|
-
requestSchema: null,
|
|
516
|
-
responseSchema: "EvaluationRunWithResultsDto"
|
|
517
|
-
},
|
|
518
|
-
"EvaluationsController_listRuns": {
|
|
519
|
-
method: "GET",
|
|
520
|
-
path: "/api/v1/scopes/{id}/evaluations/runs",
|
|
521
|
-
service: "modus-api",
|
|
522
|
-
serverUrl: "https://api.getmodus.com",
|
|
523
|
-
pathParams: ["id"],
|
|
524
|
-
queryParams: ["pageSize", "pageToken"],
|
|
525
|
-
requestSchema: null,
|
|
526
|
-
responseSchema: "ListEvaluationRunsResponseDto"
|
|
527
|
-
},
|
|
528
|
-
"EvaluationsController_triggerRun": {
|
|
529
|
-
method: "POST",
|
|
530
|
-
path: "/api/v1/scopes/{id}/evaluations/runs",
|
|
531
|
-
service: "modus-api",
|
|
532
|
-
serverUrl: "https://api.getmodus.com",
|
|
533
|
-
pathParams: ["id"],
|
|
534
|
-
queryParams: [],
|
|
535
|
-
requestSchema: null,
|
|
536
|
-
responseSchema: "TriggerEvaluationRunResponseDto"
|
|
537
|
-
},
|
|
538
|
-
"EvaluationsController_updateConfig": {
|
|
539
|
-
method: "PUT",
|
|
540
|
-
path: "/api/v1/scopes/{id}/evaluations/config",
|
|
541
|
-
service: "modus-api",
|
|
542
|
-
serverUrl: "https://api.getmodus.com",
|
|
543
|
-
pathParams: ["id"],
|
|
544
|
-
queryParams: [],
|
|
545
|
-
requestSchema: "UpdateEvaluationConfigDto",
|
|
546
|
-
responseSchema: "EvaluationConfigDto"
|
|
547
|
-
},
|
|
548
|
-
"IngestedDataController_upload": {
|
|
549
|
-
method: "POST",
|
|
550
|
-
path: "/api/v1/ingested-data",
|
|
551
|
-
service: "modus-api",
|
|
552
|
-
serverUrl: "https://api.getmodus.com",
|
|
553
|
-
pathParams: [],
|
|
554
|
-
queryParams: [],
|
|
555
|
-
requestSchema: "CreateIngestedDataDto",
|
|
556
|
-
responseSchema: "CreatedIngestedDataResponseDto"
|
|
557
|
-
},
|
|
558
|
-
"MemberGroupsController_list": {
|
|
559
|
-
method: "GET",
|
|
560
|
-
path: "/api/v1/users/member-groups",
|
|
561
|
-
service: "modus-api",
|
|
562
|
-
serverUrl: "https://api.getmodus.com",
|
|
563
|
-
pathParams: [],
|
|
564
|
-
queryParams: [],
|
|
565
|
-
requestSchema: null,
|
|
566
|
-
responseSchema: "ListMemberGroupsResponseDto"
|
|
567
|
-
},
|
|
568
|
-
"ModusChatController_chat": {
|
|
569
|
-
method: "POST",
|
|
570
|
-
path: "/api/v1/modus/chat",
|
|
571
|
-
service: "modus-api",
|
|
572
|
-
serverUrl: "https://api.getmodus.com",
|
|
573
|
-
pathParams: [],
|
|
574
|
-
queryParams: [],
|
|
575
|
-
requestSchema: "ModusChatRequestDto",
|
|
576
|
-
responseSchema: "ModusChatResponseDto"
|
|
577
|
-
},
|
|
578
|
-
"ModusChatController_chatContinue": {
|
|
579
|
-
method: "POST",
|
|
580
|
-
path: "/api/v1/modus/conversations/{threadId}/chat",
|
|
581
|
-
service: "modus-api",
|
|
582
|
-
serverUrl: "https://api.getmodus.com",
|
|
583
|
-
pathParams: ["threadId"],
|
|
584
|
-
queryParams: [],
|
|
585
|
-
requestSchema: "ModusChatRequestDto",
|
|
586
|
-
responseSchema: "ModusChatResponseDto"
|
|
587
|
-
},
|
|
588
|
-
"ModusContextController_compose": {
|
|
589
|
-
method: "POST",
|
|
590
|
-
path: "/api/v1/modus/context",
|
|
591
|
-
service: "modus-api",
|
|
592
|
-
serverUrl: "https://api.getmodus.com",
|
|
593
|
-
pathParams: [],
|
|
594
|
-
queryParams: [],
|
|
595
|
-
requestSchema: "ModusContextRequestDto",
|
|
596
|
-
responseSchema: "ModusContextResponseDto"
|
|
597
|
-
},
|
|
598
|
-
"ModusConversationsController_get": {
|
|
599
|
-
method: "GET",
|
|
600
|
-
path: "/api/v1/modus/conversations/{threadId}",
|
|
601
|
-
service: "modus-api",
|
|
602
|
-
serverUrl: "https://api.getmodus.com",
|
|
603
|
-
pathParams: ["threadId"],
|
|
604
|
-
queryParams: [],
|
|
605
|
-
requestSchema: null,
|
|
606
|
-
responseSchema: "ConversationDto"
|
|
607
|
-
},
|
|
608
|
-
"ModusConversationsController_list": {
|
|
609
|
-
method: "GET",
|
|
610
|
-
path: "/api/v1/modus/conversations",
|
|
611
|
-
service: "modus-api",
|
|
612
|
-
serverUrl: "https://api.getmodus.com",
|
|
613
|
-
pathParams: [],
|
|
614
|
-
queryParams: ["pageToken", "page", "pageSize", "userId", "toolName", "source", "sourceRef", "timeframe", "includeTools", "kind"],
|
|
615
|
-
requestSchema: null,
|
|
616
|
-
responseSchema: "ListConversationsResponseDto"
|
|
617
|
-
},
|
|
618
|
-
"ModusRunsController_create": {
|
|
619
|
-
method: "POST",
|
|
620
|
-
path: "/agent/v1/modus/runs",
|
|
621
|
-
service: "agent-service",
|
|
622
|
-
serverUrl: "https://agent.getmodus.com",
|
|
623
|
-
pathParams: [],
|
|
624
|
-
queryParams: [],
|
|
625
|
-
requestSchema: "ModusRunDto",
|
|
626
|
-
responseSchema: null
|
|
627
|
-
},
|
|
628
|
-
"OrgMembersController_list": {
|
|
629
|
-
method: "GET",
|
|
630
|
-
path: "/api/v1/users/org-members",
|
|
631
|
-
service: "modus-api",
|
|
632
|
-
serverUrl: "https://api.getmodus.com",
|
|
633
|
-
pathParams: [],
|
|
634
|
-
queryParams: [],
|
|
635
|
-
requestSchema: null,
|
|
636
|
-
responseSchema: "ListOrgMembersResponseDto"
|
|
637
|
-
},
|
|
638
|
-
"ResumeRunsController_create": {
|
|
639
|
-
method: "POST",
|
|
640
|
-
path: "/agent/v1/runs/{runId}/resume",
|
|
641
|
-
service: "agent-service",
|
|
642
|
-
serverUrl: "https://agent.getmodus.com",
|
|
643
|
-
pathParams: ["runId"],
|
|
644
|
-
queryParams: [],
|
|
645
|
-
requestSchema: "ResumeRunDto",
|
|
646
|
-
responseSchema: null
|
|
647
|
-
},
|
|
648
|
-
"RunLifecycleController_active": {
|
|
649
|
-
method: "GET",
|
|
650
|
-
path: "/agent/v1/runs/active",
|
|
651
|
-
service: "agent-service",
|
|
652
|
-
serverUrl: "https://agent.getmodus.com",
|
|
653
|
-
pathParams: [],
|
|
654
|
-
queryParams: ["pageToken", "pageSize"],
|
|
655
|
-
requestSchema: null,
|
|
656
|
-
responseSchema: "ActiveRunsResponseDto"
|
|
657
|
-
},
|
|
658
|
-
"RunLifecycleController_activeBySession": {
|
|
659
|
-
method: "POST",
|
|
660
|
-
path: "/agent/v1/runs/active-by-session",
|
|
661
|
-
service: "agent-service",
|
|
662
|
-
serverUrl: "https://agent.getmodus.com",
|
|
663
|
-
pathParams: [],
|
|
664
|
-
queryParams: [],
|
|
665
|
-
requestSchema: "ActiveRunsBySessionDto",
|
|
666
|
-
responseSchema: "ActiveRunsBySessionResponseDto"
|
|
667
|
-
},
|
|
668
|
-
"RunLifecycleController_cancel": {
|
|
669
|
-
method: "POST",
|
|
670
|
-
path: "/agent/v1/runs/{runId}/cancel",
|
|
671
|
-
service: "agent-service",
|
|
672
|
-
serverUrl: "https://agent.getmodus.com",
|
|
673
|
-
pathParams: ["runId"],
|
|
674
|
-
queryParams: [],
|
|
675
|
-
requestSchema: "CancelRunDto",
|
|
676
|
-
responseSchema: null
|
|
677
|
-
},
|
|
678
|
-
"RunLifecycleController_editQueued": {
|
|
679
|
-
method: "POST",
|
|
680
|
-
path: "/agent/v1/runs/{runId}/queue-edit",
|
|
681
|
-
service: "agent-service",
|
|
682
|
-
serverUrl: "https://agent.getmodus.com",
|
|
683
|
-
pathParams: ["runId"],
|
|
684
|
-
queryParams: [],
|
|
685
|
-
requestSchema: "EditQueuedRunDto",
|
|
686
|
-
responseSchema: null
|
|
687
|
-
},
|
|
688
|
-
"RunLifecycleController_events": {
|
|
689
|
-
method: "GET",
|
|
690
|
-
path: "/agent/v1/runs/{runId}/events",
|
|
691
|
-
service: "agent-service",
|
|
692
|
-
serverUrl: "https://agent.getmodus.com",
|
|
693
|
-
pathParams: ["runId"],
|
|
694
|
-
queryParams: [],
|
|
695
|
-
requestSchema: null,
|
|
696
|
-
responseSchema: null
|
|
697
|
-
},
|
|
698
|
-
"RunLifecycleController_interrupt": {
|
|
699
|
-
method: "POST",
|
|
700
|
-
path: "/agent/v1/runs/{runId}/interrupt",
|
|
701
|
-
service: "agent-service",
|
|
702
|
-
serverUrl: "https://agent.getmodus.com",
|
|
703
|
-
pathParams: ["runId"],
|
|
704
|
-
queryParams: [],
|
|
705
|
-
requestSchema: "InterruptRunDto",
|
|
706
|
-
responseSchema: null
|
|
707
|
-
},
|
|
708
|
-
"RunLifecycleController_stream": {
|
|
709
|
-
method: "GET",
|
|
710
|
-
path: "/agent/v1/runs/{runId}/stream",
|
|
711
|
-
service: "agent-service",
|
|
712
|
-
serverUrl: "https://agent.getmodus.com",
|
|
713
|
-
pathParams: ["runId"],
|
|
714
|
-
queryParams: [],
|
|
715
|
-
requestSchema: null,
|
|
716
|
-
responseSchema: null
|
|
717
|
-
},
|
|
718
|
-
"ScopeChatController_chat": {
|
|
719
|
-
method: "POST",
|
|
720
|
-
path: "/api/v1/scopes/{id}/chat",
|
|
721
|
-
service: "modus-api",
|
|
722
|
-
serverUrl: "https://api.getmodus.com",
|
|
723
|
-
pathParams: ["id"],
|
|
724
|
-
queryParams: [],
|
|
725
|
-
requestSchema: "SkillChatRequestDto",
|
|
726
|
-
responseSchema: "SkillChatResponseDto"
|
|
727
|
-
},
|
|
728
|
-
"ScopeChatController_chatContinue": {
|
|
729
|
-
method: "POST",
|
|
730
|
-
path: "/api/v1/scopes/{id}/conversations/{threadId}/chat",
|
|
731
|
-
service: "modus-api",
|
|
732
|
-
serverUrl: "https://api.getmodus.com",
|
|
733
|
-
pathParams: ["id", "threadId"],
|
|
734
|
-
queryParams: [],
|
|
735
|
-
requestSchema: "SkillChatRequestDto",
|
|
736
|
-
responseSchema: "SkillChatResponseDto"
|
|
737
|
-
},
|
|
738
|
-
"ScopeContextController_compose": {
|
|
739
|
-
method: "POST",
|
|
740
|
-
path: "/api/v1/scopes/{id}/context",
|
|
741
|
-
service: "modus-api",
|
|
742
|
-
serverUrl: "https://api.getmodus.com",
|
|
743
|
-
pathParams: ["id"],
|
|
744
|
-
queryParams: [],
|
|
745
|
-
requestSchema: "ComposeSkillContextRequestDto",
|
|
746
|
-
responseSchema: "ComposeSkillContextResponseDto"
|
|
747
|
-
},
|
|
748
|
-
"ScopeConversationsController_get": {
|
|
749
|
-
method: "GET",
|
|
750
|
-
path: "/api/v1/scopes/{id}/conversations/{threadId}",
|
|
751
|
-
service: "modus-api",
|
|
752
|
-
serverUrl: "https://api.getmodus.com",
|
|
753
|
-
pathParams: ["id", "threadId"],
|
|
754
|
-
queryParams: ["messageLimit", "beforeMessageIndex"],
|
|
755
|
-
requestSchema: null,
|
|
756
|
-
responseSchema: "ConversationDto"
|
|
757
|
-
},
|
|
758
|
-
"ScopeConversationsController_list": {
|
|
759
|
-
method: "GET",
|
|
760
|
-
path: "/api/v1/scopes/{id}/conversations",
|
|
761
|
-
service: "modus-api",
|
|
762
|
-
serverUrl: "https://api.getmodus.com",
|
|
763
|
-
pathParams: ["id"],
|
|
764
|
-
queryParams: ["pageToken", "page", "pageSize", "userId", "toolName", "source", "sourceRef", "timeframe", "includeTools"],
|
|
765
|
-
requestSchema: null,
|
|
766
|
-
responseSchema: "ListConversationsResponseDto"
|
|
767
|
-
},
|
|
768
|
-
"ScopeInterfacesController_add": {
|
|
769
|
-
method: "POST",
|
|
770
|
-
path: "/api/v1/scopes/{id}/interfaces",
|
|
771
|
-
service: "modus-api",
|
|
772
|
-
serverUrl: "https://api.getmodus.com",
|
|
773
|
-
pathParams: ["id"],
|
|
774
|
-
queryParams: [],
|
|
775
|
-
requestSchema: "AddScopeInterfaceDto",
|
|
776
|
-
responseSchema: "ScopeInterfaceDto"
|
|
777
|
-
},
|
|
778
|
-
"ScopeInterfacesController_delete": {
|
|
779
|
-
method: "DELETE",
|
|
780
|
-
path: "/api/v1/scopes/{id}/interfaces/{interfaceId}",
|
|
781
|
-
service: "modus-api",
|
|
782
|
-
serverUrl: "https://api.getmodus.com",
|
|
783
|
-
pathParams: ["id", "interfaceId"],
|
|
784
|
-
queryParams: [],
|
|
785
|
-
requestSchema: null,
|
|
786
|
-
responseSchema: null
|
|
787
|
-
},
|
|
788
|
-
"ScopeInterfacesController_list": {
|
|
789
|
-
method: "GET",
|
|
790
|
-
path: "/api/v1/scopes/{id}/interfaces",
|
|
791
|
-
service: "modus-api",
|
|
792
|
-
serverUrl: "https://api.getmodus.com",
|
|
793
|
-
pathParams: ["id"],
|
|
794
|
-
queryParams: [],
|
|
795
|
-
requestSchema: null,
|
|
796
|
-
responseSchema: "ListScopeInterfacesResponseDto"
|
|
797
|
-
},
|
|
798
|
-
"ScopeInterfacesController_update": {
|
|
799
|
-
method: "PATCH",
|
|
800
|
-
path: "/api/v1/scopes/{id}/interfaces/{interfaceId}",
|
|
801
|
-
service: "modus-api",
|
|
802
|
-
serverUrl: "https://api.getmodus.com",
|
|
803
|
-
pathParams: ["id", "interfaceId"],
|
|
804
|
-
queryParams: ["updateMask"],
|
|
805
|
-
requestSchema: "UpdateScopeInterfaceDto",
|
|
806
|
-
responseSchema: "ScopeInterfaceDto"
|
|
807
|
-
},
|
|
808
|
-
"ScopeMemoriesController_delete": {
|
|
809
|
-
method: "DELETE",
|
|
810
|
-
path: "/api/v1/scopes/{id}/memories/{memoryId}",
|
|
811
|
-
service: "modus-api",
|
|
812
|
-
serverUrl: "https://api.getmodus.com",
|
|
813
|
-
pathParams: ["id", "memoryId"],
|
|
814
|
-
queryParams: [],
|
|
815
|
-
requestSchema: null,
|
|
816
|
-
responseSchema: null
|
|
817
|
-
},
|
|
818
|
-
"ScopeMemoriesController_list": {
|
|
819
|
-
method: "GET",
|
|
820
|
-
path: "/api/v1/scopes/{id}/memories",
|
|
821
|
-
service: "modus-api",
|
|
822
|
-
serverUrl: "https://api.getmodus.com",
|
|
823
|
-
pathParams: ["id"],
|
|
824
|
-
queryParams: ["pageToken", "pageSize", "userId", "limit"],
|
|
825
|
-
requestSchema: null,
|
|
826
|
-
responseSchema: "ListMemoriesResponseDto"
|
|
827
|
-
},
|
|
828
|
-
"ScopeMemoriesController_search": {
|
|
829
|
-
method: "POST",
|
|
830
|
-
path: "/api/v1/scopes/{id}/memories/search",
|
|
831
|
-
service: "modus-api",
|
|
832
|
-
serverUrl: "https://api.getmodus.com",
|
|
833
|
-
pathParams: ["id"],
|
|
834
|
-
queryParams: [],
|
|
835
|
-
requestSchema: "SearchMemoriesRequestDto",
|
|
836
|
-
responseSchema: "ListMemoriesResponseDto"
|
|
837
|
-
},
|
|
838
|
-
"ScopeMemoriesController_update": {
|
|
839
|
-
method: "PATCH",
|
|
840
|
-
path: "/api/v1/scopes/{id}/memories/{memoryId}",
|
|
841
|
-
service: "modus-api",
|
|
842
|
-
serverUrl: "https://api.getmodus.com",
|
|
843
|
-
pathParams: ["id", "memoryId"],
|
|
844
|
-
queryParams: ["updateMask"],
|
|
845
|
-
requestSchema: "UpdateMemoryRequestDto",
|
|
846
|
-
responseSchema: null
|
|
847
|
-
},
|
|
848
|
-
"ScopeRunsController_create": {
|
|
849
|
-
method: "POST",
|
|
850
|
-
path: "/agent/v1/scopes/{id}/runs",
|
|
851
|
-
service: "agent-service",
|
|
852
|
-
serverUrl: "https://agent.getmodus.com",
|
|
853
|
-
pathParams: ["id"],
|
|
854
|
-
queryParams: [],
|
|
855
|
-
requestSchema: "SkillRunDto",
|
|
856
|
-
responseSchema: null
|
|
857
|
-
},
|
|
858
|
-
"ScopeSupervisionController_get": {
|
|
859
|
-
method: "GET",
|
|
860
|
-
path: "/api/v1/scopes/{id}/supervision",
|
|
861
|
-
service: "modus-api",
|
|
862
|
-
serverUrl: "https://api.getmodus.com",
|
|
863
|
-
pathParams: ["id"],
|
|
864
|
-
queryParams: ["view"],
|
|
865
|
-
requestSchema: null,
|
|
866
|
-
responseSchema: "SupervisionDto"
|
|
867
|
-
},
|
|
868
|
-
"ScopeSupervisionController_set": {
|
|
869
|
-
method: "PUT",
|
|
870
|
-
path: "/api/v1/scopes/{id}/supervision",
|
|
871
|
-
service: "modus-api",
|
|
872
|
-
serverUrl: "https://api.getmodus.com",
|
|
873
|
-
pathParams: ["id"],
|
|
874
|
-
queryParams: [],
|
|
875
|
-
requestSchema: "SetSupervisionRequestDto",
|
|
876
|
-
responseSchema: "SupervisionDto"
|
|
877
|
-
},
|
|
878
|
-
"ScopeSupervisionController_setActive": {
|
|
879
|
-
method: "PUT",
|
|
880
|
-
path: "/api/v1/scopes/{id}/supervision/active",
|
|
881
|
-
service: "modus-api",
|
|
882
|
-
serverUrl: "https://api.getmodus.com",
|
|
883
|
-
pathParams: ["id"],
|
|
884
|
-
queryParams: [],
|
|
885
|
-
requestSchema: "SetSupervisionRequestDto",
|
|
886
|
-
responseSchema: "SupervisionDto"
|
|
887
|
-
},
|
|
888
|
-
"ScopesController_acceptOwnershipTransfer": {
|
|
889
|
-
method: "POST",
|
|
890
|
-
path: "/api/v1/scopes/{id}/transfer-ownership/accept",
|
|
891
|
-
service: "modus-api",
|
|
892
|
-
serverUrl: "https://api.getmodus.com",
|
|
893
|
-
pathParams: ["id"],
|
|
894
|
-
queryParams: [],
|
|
895
|
-
requestSchema: null,
|
|
896
|
-
responseSchema: "ScopeDto"
|
|
897
|
-
},
|
|
898
|
-
"ScopesController_cancelOwnershipTransfer": {
|
|
899
|
-
method: "DELETE",
|
|
900
|
-
path: "/api/v1/scopes/{id}/transfer-ownership",
|
|
901
|
-
service: "modus-api",
|
|
902
|
-
serverUrl: "https://api.getmodus.com",
|
|
903
|
-
pathParams: ["id"],
|
|
904
|
-
queryParams: [],
|
|
905
|
-
requestSchema: null,
|
|
906
|
-
responseSchema: "ScopeDto"
|
|
907
|
-
},
|
|
908
|
-
"ScopesController_create": {
|
|
909
|
-
method: "POST",
|
|
910
|
-
path: "/api/v1/scopes",
|
|
911
|
-
service: "modus-api",
|
|
912
|
-
serverUrl: "https://api.getmodus.com",
|
|
913
|
-
pathParams: [],
|
|
914
|
-
queryParams: [],
|
|
915
|
-
requestSchema: "CreateSkillDto",
|
|
916
|
-
responseSchema: "ScopeDto"
|
|
917
|
-
},
|
|
918
|
-
"ScopesController_delete": {
|
|
919
|
-
method: "DELETE",
|
|
920
|
-
path: "/api/v1/scopes/{id}",
|
|
921
|
-
service: "modus-api",
|
|
922
|
-
serverUrl: "https://api.getmodus.com",
|
|
923
|
-
pathParams: ["id"],
|
|
924
|
-
queryParams: [],
|
|
925
|
-
requestSchema: null,
|
|
926
|
-
responseSchema: null
|
|
927
|
-
},
|
|
928
|
-
"ScopesController_deploy": {
|
|
929
|
-
method: "POST",
|
|
930
|
-
path: "/api/v1/scopes/{id}/deploy",
|
|
931
|
-
service: "modus-api",
|
|
932
|
-
serverUrl: "https://api.getmodus.com",
|
|
933
|
-
pathParams: ["id"],
|
|
934
|
-
queryParams: [],
|
|
935
|
-
requestSchema: "DeploySkillDto",
|
|
936
|
-
responseSchema: "DeployResponseDto"
|
|
937
|
-
},
|
|
938
|
-
"ScopesController_get": {
|
|
939
|
-
method: "GET",
|
|
940
|
-
path: "/api/v1/scopes/{id}",
|
|
941
|
-
service: "modus-api",
|
|
942
|
-
serverUrl: "https://api.getmodus.com",
|
|
943
|
-
pathParams: ["id"],
|
|
944
|
-
queryParams: ["view"],
|
|
945
|
-
requestSchema: null,
|
|
946
|
-
responseSchema: "ScopeDto"
|
|
947
|
-
},
|
|
948
|
-
"ScopesController_getVariation": {
|
|
949
|
-
method: "GET",
|
|
950
|
-
path: "/api/v1/scopes/{id}/variations/{variationUid}",
|
|
951
|
-
service: "modus-api",
|
|
952
|
-
serverUrl: "https://api.getmodus.com",
|
|
953
|
-
pathParams: ["id", "variationUid"],
|
|
954
|
-
queryParams: [],
|
|
955
|
-
requestSchema: null,
|
|
956
|
-
responseSchema: "ScopeDto"
|
|
957
|
-
},
|
|
958
|
-
"ScopesController_list": {
|
|
959
|
-
method: "GET",
|
|
960
|
-
path: "/api/v1/scopes",
|
|
961
|
-
service: "modus-api",
|
|
962
|
-
serverUrl: "https://api.getmodus.com",
|
|
963
|
-
pathParams: [],
|
|
964
|
-
queryParams: ["pageToken", "pageSize", "view", "search", "managerId", "includeVariation"],
|
|
965
|
-
requestSchema: null,
|
|
966
|
-
responseSchema: "ListSkillsResponseDto"
|
|
967
|
-
},
|
|
968
|
-
"ScopesController_patchMcpConfig": {
|
|
969
|
-
method: "PATCH",
|
|
970
|
-
path: "/api/v1/scopes/{id}/mcp-config",
|
|
971
|
-
service: "modus-api",
|
|
972
|
-
serverUrl: "https://api.getmodus.com",
|
|
973
|
-
pathParams: ["id"],
|
|
974
|
-
queryParams: [],
|
|
975
|
-
requestSchema: "PatchSkillMcpConfigDto",
|
|
976
|
-
responseSchema: "PatchSkillMcpConfigResponseDto"
|
|
977
|
-
},
|
|
978
|
-
"ScopesController_requestOwnershipTransfer": {
|
|
979
|
-
method: "POST",
|
|
980
|
-
path: "/api/v1/scopes/{id}/transfer-ownership",
|
|
981
|
-
service: "modus-api",
|
|
982
|
-
serverUrl: "https://api.getmodus.com",
|
|
983
|
-
pathParams: ["id"],
|
|
984
|
-
queryParams: [],
|
|
985
|
-
requestSchema: "TransferOwnershipDto",
|
|
986
|
-
responseSchema: "ScopeDto"
|
|
987
|
-
},
|
|
988
|
-
"ScopesController_restore": {
|
|
989
|
-
method: "POST",
|
|
990
|
-
path: "/api/v1/scopes/{id}/restore",
|
|
991
|
-
service: "modus-api",
|
|
992
|
-
serverUrl: "https://api.getmodus.com",
|
|
993
|
-
pathParams: ["id"],
|
|
994
|
-
queryParams: [],
|
|
995
|
-
requestSchema: null,
|
|
996
|
-
responseSchema: "ScopeDto"
|
|
997
|
-
},
|
|
998
|
-
"ScopesController_update": {
|
|
999
|
-
method: "PATCH",
|
|
1000
|
-
path: "/api/v1/scopes/{id}",
|
|
1001
|
-
service: "modus-api",
|
|
1002
|
-
serverUrl: "https://api.getmodus.com",
|
|
1003
|
-
pathParams: ["id"],
|
|
1004
|
-
queryParams: ["updateMask"],
|
|
1005
|
-
requestSchema: "UpdateSkillDto",
|
|
1006
|
-
responseSchema: "ScopeDto"
|
|
1007
|
-
},
|
|
1008
|
-
"SuggestionsController_listApproved": {
|
|
1009
|
-
method: "GET",
|
|
1010
|
-
path: "/api/v1/suggestions/questions",
|
|
1011
|
-
service: "modus-api",
|
|
1012
|
-
serverUrl: "https://api.getmodus.com",
|
|
1013
|
-
pathParams: [],
|
|
1014
|
-
queryParams: ["pageToken", "pageSize", "scopeId", "scopeIds"],
|
|
1015
|
-
requestSchema: null,
|
|
1016
|
-
responseSchema: "ListSuggestionQuestionsResponseDto"
|
|
1017
|
-
},
|
|
1018
|
-
"SuggestionsController_recordEvent": {
|
|
1019
|
-
method: "POST",
|
|
1020
|
-
path: "/api/v1/suggestions/questions/{id}/events",
|
|
1021
|
-
service: "modus-api",
|
|
1022
|
-
serverUrl: "https://api.getmodus.com",
|
|
1023
|
-
pathParams: ["id"],
|
|
1024
|
-
queryParams: [],
|
|
1025
|
-
requestSchema: "RecordSuggestionEventDto",
|
|
1026
|
-
responseSchema: null
|
|
1027
|
-
},
|
|
1028
|
-
"ToolsController_list": {
|
|
1029
|
-
method: "GET",
|
|
1030
|
-
path: "/api/v1/tools",
|
|
1031
|
-
service: "modus-api",
|
|
1032
|
-
serverUrl: "https://api.getmodus.com",
|
|
1033
|
-
pathParams: [],
|
|
1034
|
-
queryParams: ["pageToken", "pageSize"],
|
|
1035
|
-
requestSchema: null,
|
|
1036
|
-
responseSchema: "ListToolsResponseDto"
|
|
1037
|
-
},
|
|
1038
|
-
"UsageController_list": {
|
|
1039
|
-
method: "GET",
|
|
1040
|
-
path: "/api/v1/usage",
|
|
1041
|
-
service: "modus-api",
|
|
1042
|
-
serverUrl: "https://api.getmodus.com",
|
|
1043
|
-
pathParams: [],
|
|
1044
|
-
queryParams: ["since", "until", "rollup", "model", "group_by", "skill_id", "agent_id", "user_id", "interface", "user_email"],
|
|
1045
|
-
requestSchema: null,
|
|
1046
|
-
responseSchema: "ListUsageResponseDto"
|
|
1047
|
-
},
|
|
1048
|
-
"UsageController_listUsers": {
|
|
1049
|
-
method: "GET",
|
|
1050
|
-
path: "/api/v1/usage/users",
|
|
1051
|
-
service: "modus-api",
|
|
1052
|
-
serverUrl: "https://api.getmodus.com",
|
|
1053
|
-
pathParams: [],
|
|
1054
|
-
queryParams: ["since", "until"],
|
|
1055
|
-
requestSchema: null,
|
|
1056
|
-
responseSchema: "ListUsageUsersResponseDto"
|
|
1057
|
-
},
|
|
1058
|
-
"WorkflowActionsController_cancel": {
|
|
1059
|
-
method: "POST",
|
|
1060
|
-
path: "/agent/v1/workflow-actions/{runId}/cancel",
|
|
1061
|
-
service: "agent-service",
|
|
1062
|
-
serverUrl: "https://agent.getmodus.com",
|
|
1063
|
-
pathParams: ["runId"],
|
|
1064
|
-
queryParams: [],
|
|
1065
|
-
requestSchema: "CancelRunDto",
|
|
1066
|
-
responseSchema: null
|
|
1067
|
-
},
|
|
1068
|
-
"WorkflowActionsController_execute": {
|
|
1069
|
-
method: "POST",
|
|
1070
|
-
path: "/agent/v1/workflow-actions",
|
|
1071
|
-
service: "agent-service",
|
|
1072
|
-
serverUrl: "https://agent.getmodus.com",
|
|
1073
|
-
pathParams: [],
|
|
1074
|
-
queryParams: [],
|
|
1075
|
-
requestSchema: "WorkflowActionDto",
|
|
1076
|
-
responseSchema: null
|
|
1077
|
-
},
|
|
1078
|
-
"WorkflowInterfacesController_add": {
|
|
1079
|
-
method: "POST",
|
|
1080
|
-
path: "/api/v1/workflows/{id}/interfaces",
|
|
1081
|
-
service: "modus-api",
|
|
1082
|
-
serverUrl: "https://api.getmodus.com",
|
|
1083
|
-
pathParams: ["id"],
|
|
1084
|
-
queryParams: [],
|
|
1085
|
-
requestSchema: "AddAgentInterfaceDto",
|
|
1086
|
-
responseSchema: "AgentInterfaceDto"
|
|
1087
|
-
},
|
|
1088
|
-
"WorkflowInterfacesController_delete": {
|
|
1089
|
-
method: "DELETE",
|
|
1090
|
-
path: "/api/v1/workflows/{id}/interfaces/{interfaceId}",
|
|
1091
|
-
service: "modus-api",
|
|
1092
|
-
serverUrl: "https://api.getmodus.com",
|
|
1093
|
-
pathParams: ["id", "interfaceId"],
|
|
1094
|
-
queryParams: [],
|
|
1095
|
-
requestSchema: null,
|
|
1096
|
-
responseSchema: null
|
|
1097
|
-
},
|
|
1098
|
-
"WorkflowInterfacesController_deleteAll": {
|
|
1099
|
-
method: "DELETE",
|
|
1100
|
-
path: "/api/v1/workflows/{id}/interfaces",
|
|
1101
|
-
service: "modus-api",
|
|
1102
|
-
serverUrl: "https://api.getmodus.com",
|
|
1103
|
-
pathParams: ["id"],
|
|
1104
|
-
queryParams: [],
|
|
1105
|
-
requestSchema: null,
|
|
1106
|
-
responseSchema: null
|
|
1107
|
-
},
|
|
1108
|
-
"WorkflowInterfacesController_list": {
|
|
1109
|
-
method: "GET",
|
|
1110
|
-
path: "/api/v1/workflows/{id}/interfaces",
|
|
1111
|
-
service: "modus-api",
|
|
1112
|
-
serverUrl: "https://api.getmodus.com",
|
|
1113
|
-
pathParams: ["id"],
|
|
1114
|
-
queryParams: [],
|
|
1115
|
-
requestSchema: null,
|
|
1116
|
-
responseSchema: "ListAgentInterfacesResponseDto"
|
|
1117
|
-
},
|
|
1118
|
-
"WorkflowInterfacesController_update": {
|
|
1119
|
-
method: "PATCH",
|
|
1120
|
-
path: "/api/v1/workflows/{id}/interfaces/{interfaceId}",
|
|
1121
|
-
service: "modus-api",
|
|
1122
|
-
serverUrl: "https://api.getmodus.com",
|
|
1123
|
-
pathParams: ["id", "interfaceId"],
|
|
1124
|
-
queryParams: ["updateMask"],
|
|
1125
|
-
requestSchema: "UpdateAgentInterfaceDto",
|
|
1126
|
-
responseSchema: "AgentInterfaceDto"
|
|
1127
|
-
},
|
|
1128
|
-
"WorkflowRunsController_create": {
|
|
1129
|
-
method: "POST",
|
|
1130
|
-
path: "/agent/v1/workflows/{id}/runs",
|
|
1131
|
-
service: "agent-service",
|
|
1132
|
-
serverUrl: "https://agent.getmodus.com",
|
|
1133
|
-
pathParams: ["id"],
|
|
1134
|
-
queryParams: [],
|
|
1135
|
-
requestSchema: "AgentRunDto",
|
|
1136
|
-
responseSchema: null
|
|
1137
|
-
},
|
|
1138
|
-
"WorkflowRunsController_get": {
|
|
1139
|
-
method: "GET",
|
|
1140
|
-
path: "/api/v1/workflows/{id}/runs/{runId}",
|
|
1141
|
-
service: "modus-api",
|
|
1142
|
-
serverUrl: "https://api.getmodus.com",
|
|
1143
|
-
pathParams: ["id", "runId"],
|
|
1144
|
-
queryParams: ["temporalRunId"],
|
|
1145
|
-
requestSchema: null,
|
|
1146
|
-
responseSchema: "GetAutomationRunResponseDto"
|
|
1147
|
-
},
|
|
1148
|
-
"WorkflowRunsController_list": {
|
|
1149
|
-
method: "GET",
|
|
1150
|
-
path: "/api/v1/workflows/{id}/runs",
|
|
1151
|
-
service: "modus-api",
|
|
1152
|
-
serverUrl: "https://api.getmodus.com",
|
|
1153
|
-
pathParams: ["id"],
|
|
1154
|
-
queryParams: ["status", "timeframe", "approvalScope", "search", "pageSize", "pageToken"],
|
|
1155
|
-
requestSchema: null,
|
|
1156
|
-
responseSchema: "ListAutomationRunsResponseDto"
|
|
1157
|
-
},
|
|
1158
|
-
"WorkflowsController_acceptOwnershipTransfer": {
|
|
1159
|
-
method: "POST",
|
|
1160
|
-
path: "/api/v1/workflows/{id}/transfer-ownership/accept",
|
|
1161
|
-
service: "modus-api",
|
|
1162
|
-
serverUrl: "https://api.getmodus.com",
|
|
1163
|
-
pathParams: ["id"],
|
|
1164
|
-
queryParams: [],
|
|
1165
|
-
requestSchema: null,
|
|
1166
|
-
responseSchema: "WorkflowDto"
|
|
1167
|
-
},
|
|
1168
|
-
"WorkflowsController_cancelOwnershipTransfer": {
|
|
1169
|
-
method: "DELETE",
|
|
1170
|
-
path: "/api/v1/workflows/{id}/transfer-ownership",
|
|
1171
|
-
service: "modus-api",
|
|
1172
|
-
serverUrl: "https://api.getmodus.com",
|
|
1173
|
-
pathParams: ["id"],
|
|
1174
|
-
queryParams: [],
|
|
1175
|
-
requestSchema: null,
|
|
1176
|
-
responseSchema: "WorkflowDto"
|
|
1177
|
-
},
|
|
1178
|
-
"WorkflowsController_create": {
|
|
1179
|
-
method: "POST",
|
|
1180
|
-
path: "/api/v1/workflows",
|
|
1181
|
-
service: "modus-api",
|
|
1182
|
-
serverUrl: "https://api.getmodus.com",
|
|
1183
|
-
pathParams: [],
|
|
1184
|
-
queryParams: [],
|
|
1185
|
-
requestSchema: "CreateAgentDto",
|
|
1186
|
-
responseSchema: "WorkflowDto"
|
|
1187
|
-
},
|
|
1188
|
-
"WorkflowsController_delete": {
|
|
1189
|
-
method: "DELETE",
|
|
1190
|
-
path: "/api/v1/workflows/{id}",
|
|
1191
|
-
service: "modus-api",
|
|
1192
|
-
serverUrl: "https://api.getmodus.com",
|
|
1193
|
-
pathParams: ["id"],
|
|
1194
|
-
queryParams: [],
|
|
1195
|
-
requestSchema: null,
|
|
1196
|
-
responseSchema: null
|
|
1197
|
-
},
|
|
1198
|
-
"WorkflowsController_deploy": {
|
|
1199
|
-
method: "POST",
|
|
1200
|
-
path: "/api/v1/workflows/{id}/deploy",
|
|
1201
|
-
service: "modus-api",
|
|
1202
|
-
serverUrl: "https://api.getmodus.com",
|
|
1203
|
-
pathParams: ["id"],
|
|
1204
|
-
queryParams: [],
|
|
1205
|
-
requestSchema: "DeployAgentDto",
|
|
1206
|
-
responseSchema: "AgentDeployResponseDto"
|
|
1207
|
-
},
|
|
1208
|
-
"WorkflowsController_get": {
|
|
1209
|
-
method: "GET",
|
|
1210
|
-
path: "/api/v1/workflows/{id}",
|
|
1211
|
-
service: "modus-api",
|
|
1212
|
-
serverUrl: "https://api.getmodus.com",
|
|
1213
|
-
pathParams: ["id"],
|
|
1214
|
-
queryParams: ["view"],
|
|
1215
|
-
requestSchema: null,
|
|
1216
|
-
responseSchema: "WorkflowDto"
|
|
1217
|
-
},
|
|
1218
|
-
"WorkflowsController_list": {
|
|
1219
|
-
method: "GET",
|
|
1220
|
-
path: "/api/v1/workflows",
|
|
1221
|
-
service: "modus-api",
|
|
1222
|
-
serverUrl: "https://api.getmodus.com",
|
|
1223
|
-
pathParams: [],
|
|
1224
|
-
queryParams: ["pageToken", "pageSize", "view", "type", "search", "includeVariation"],
|
|
1225
|
-
requestSchema: null,
|
|
1226
|
-
responseSchema: "ListAgentsResponseDto"
|
|
1227
|
-
},
|
|
1228
|
-
"WorkflowsController_requestOwnershipTransfer": {
|
|
1229
|
-
method: "POST",
|
|
1230
|
-
path: "/api/v1/workflows/{id}/transfer-ownership",
|
|
1231
|
-
service: "modus-api",
|
|
1232
|
-
serverUrl: "https://api.getmodus.com",
|
|
1233
|
-
pathParams: ["id"],
|
|
1234
|
-
queryParams: [],
|
|
1235
|
-
requestSchema: "TransferOwnershipDto",
|
|
1236
|
-
responseSchema: "WorkflowDto"
|
|
1237
|
-
},
|
|
1238
|
-
"WorkflowsController_restore": {
|
|
1239
|
-
method: "POST",
|
|
1240
|
-
path: "/api/v1/workflows/{id}/restore",
|
|
1241
|
-
service: "modus-api",
|
|
1242
|
-
serverUrl: "https://api.getmodus.com",
|
|
1243
|
-
pathParams: ["id"],
|
|
1244
|
-
queryParams: [],
|
|
1245
|
-
requestSchema: null,
|
|
1246
|
-
responseSchema: "WorkflowDto"
|
|
1247
|
-
},
|
|
1248
|
-
"WorkflowsController_toggle": {
|
|
1249
|
-
method: "POST",
|
|
1250
|
-
path: "/api/v1/workflows/{id}/toggle",
|
|
1251
|
-
service: "modus-api",
|
|
1252
|
-
serverUrl: "https://api.getmodus.com",
|
|
1253
|
-
pathParams: ["id"],
|
|
1254
|
-
queryParams: [],
|
|
1255
|
-
requestSchema: "ToggleAgentDto",
|
|
1256
|
-
responseSchema: "WorkflowDto"
|
|
1257
|
-
},
|
|
1258
|
-
"WorkflowsController_update": {
|
|
1259
|
-
method: "PATCH",
|
|
1260
|
-
path: "/api/v1/workflows/{id}",
|
|
1261
|
-
service: "modus-api",
|
|
1262
|
-
serverUrl: "https://api.getmodus.com",
|
|
1263
|
-
pathParams: ["id"],
|
|
1264
|
-
queryParams: ["updateMask"],
|
|
1265
|
-
requestSchema: "UpdateAgentDto",
|
|
1266
|
-
responseSchema: "WorkflowDto"
|
|
1267
|
-
}
|
|
1268
|
-
};
|
|
1269
20
|
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
var
|
|
1284
|
-
constructor(message) {
|
|
1285
|
-
super(message);
|
|
1286
|
-
this.name = "APIConnectionError";
|
|
1287
|
-
}
|
|
1288
|
-
};
|
|
1289
|
-
var AuthenticationError = class extends ModusError {
|
|
1290
|
-
constructor(message, options = {}) {
|
|
1291
|
-
super(message, { ...options, statusCode: 401 });
|
|
1292
|
-
this.name = "AuthenticationError";
|
|
1293
|
-
}
|
|
1294
|
-
};
|
|
1295
|
-
var PermissionDeniedError = class extends ModusError {
|
|
1296
|
-
constructor(message, options = {}) {
|
|
1297
|
-
super(message, { ...options, statusCode: 403 });
|
|
1298
|
-
this.name = "PermissionDeniedError";
|
|
1299
|
-
}
|
|
1300
|
-
};
|
|
1301
|
-
var NotFoundError = class extends ModusError {
|
|
1302
|
-
constructor(message, options = {}) {
|
|
1303
|
-
super(message, { ...options, statusCode: 404 });
|
|
1304
|
-
this.name = "NotFoundError";
|
|
1305
|
-
}
|
|
1306
|
-
};
|
|
1307
|
-
var ConflictError = class extends ModusError {
|
|
1308
|
-
constructor(message, options = {}) {
|
|
1309
|
-
super(message, { ...options, statusCode: 409 });
|
|
1310
|
-
this.name = "ConflictError";
|
|
1311
|
-
}
|
|
1312
|
-
};
|
|
1313
|
-
var UnprocessableError = class extends ModusError {
|
|
1314
|
-
constructor(message, options = {}) {
|
|
1315
|
-
super(message, { ...options, statusCode: 422 });
|
|
1316
|
-
this.name = "UnprocessableError";
|
|
1317
|
-
this.errors = options.errors;
|
|
1318
|
-
}
|
|
1319
|
-
};
|
|
1320
|
-
var RateLimitError = class extends ModusError {
|
|
1321
|
-
constructor(message, options = {}) {
|
|
1322
|
-
super(message, { ...options, statusCode: 429 });
|
|
1323
|
-
this.name = "RateLimitError";
|
|
1324
|
-
this.retryAfter = options.retryAfter;
|
|
1325
|
-
}
|
|
1326
|
-
};
|
|
1327
|
-
var InternalServerError = class extends ModusError {
|
|
1328
|
-
constructor(message, statusCode, options = {}) {
|
|
1329
|
-
super(message, { ...options, statusCode });
|
|
1330
|
-
this.name = "InternalServerError";
|
|
1331
|
-
}
|
|
1332
|
-
};
|
|
1333
|
-
var RunCancelledError = class extends ModusError {
|
|
1334
|
-
constructor(message = "Run was cancelled.") {
|
|
1335
|
-
super(message);
|
|
1336
|
-
this.name = "RunCancelledError";
|
|
1337
|
-
}
|
|
1338
|
-
};
|
|
1339
|
-
var StreamTimeoutError = class extends ModusError {
|
|
1340
|
-
constructor(message = "Stream timed out.") {
|
|
1341
|
-
super(message);
|
|
1342
|
-
this.name = "StreamTimeoutError";
|
|
1343
|
-
}
|
|
1344
|
-
};
|
|
1345
|
-
var ValidationError = class extends ModusError {
|
|
1346
|
-
constructor(message) {
|
|
1347
|
-
super(message);
|
|
1348
|
-
this.name = "ValidationError";
|
|
1349
|
-
}
|
|
1350
|
-
};
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
var _chunkNA3ZD35Tcjs = require('./chunk-NA3ZD35T.cjs');
|
|
1351
35
|
|
|
1352
36
|
// src/_agent_run_request.ts
|
|
1353
|
-
var
|
|
37
|
+
var _crypto = require('crypto');
|
|
1354
38
|
function resolveAgentRunSessionId(sessionId) {
|
|
1355
39
|
if (typeof sessionId === "string" && sessionId.trim()) return sessionId.trim();
|
|
1356
|
-
return (0,
|
|
40
|
+
return _crypto.randomUUID.call(void 0, );
|
|
1357
41
|
}
|
|
1358
42
|
|
|
1359
43
|
// src/_streaming.ts
|
|
1360
|
-
var SILENTLY_IGNORED = /* @__PURE__ */ new Set([
|
|
1361
|
-
"heartbeat",
|
|
1362
|
-
"ws_chunk",
|
|
1363
|
-
"unknown",
|
|
1364
|
-
"tool_start",
|
|
1365
|
-
"tool_end",
|
|
1366
|
-
"tool_chunk",
|
|
1367
|
-
"agent_thinking",
|
|
1368
|
-
"warning",
|
|
1369
|
-
"selected_final_content"
|
|
1370
|
-
]);
|
|
1371
44
|
function parseLine(line) {
|
|
1372
45
|
if (!line.startsWith("data:")) return void 0;
|
|
1373
46
|
const raw = line.slice(5).trimStart();
|
|
@@ -1377,7 +50,7 @@ function parseLine(line) {
|
|
|
1377
50
|
if (data && typeof data === "object" && !Array.isArray(data)) {
|
|
1378
51
|
return data;
|
|
1379
52
|
}
|
|
1380
|
-
} catch {
|
|
53
|
+
} catch (e) {
|
|
1381
54
|
return void 0;
|
|
1382
55
|
}
|
|
1383
56
|
return void 0;
|
|
@@ -1385,30 +58,61 @@ function parseLine(line) {
|
|
|
1385
58
|
function isAsyncIterable(value) {
|
|
1386
59
|
return Symbol.asyncIterator in Object(value);
|
|
1387
60
|
}
|
|
1388
|
-
|
|
61
|
+
var NODE_TERMINAL_TYPES = /* @__PURE__ */ new Set(["done", "error", "cancelled", "stream_timeout"]);
|
|
62
|
+
function* parseData(data, id) {
|
|
1389
63
|
const eventType = typeof data.type === "string" ? data.type : "unknown";
|
|
1390
|
-
|
|
64
|
+
const withId = id === void 0 ? {} : { id };
|
|
65
|
+
if (eventType === "node_content") {
|
|
66
|
+
const inner = data.event;
|
|
67
|
+
if (inner && typeof inner === "object" && !Array.isArray(inner)) {
|
|
68
|
+
const frame = inner;
|
|
69
|
+
if (!NODE_TERMINAL_TYPES.has(frame.type)) yield* parseData(frame, id);
|
|
70
|
+
}
|
|
71
|
+
} else if (eventType === "token") {
|
|
1391
72
|
const event = {
|
|
1392
73
|
type: "token",
|
|
1393
|
-
content: typeof data.content === "string" ? data.content : ""
|
|
74
|
+
content: typeof data.content === "string" ? data.content : "",
|
|
75
|
+
...typeof data.subAgent === "string" ? { subAgent: data.subAgent } : {},
|
|
76
|
+
...withId
|
|
1394
77
|
};
|
|
1395
78
|
yield event;
|
|
1396
|
-
} else if (eventType === "done") {
|
|
79
|
+
} else if (eventType === "done" || eventType === "workflow_done") {
|
|
80
|
+
const content = eventType === "done" ? data.content : data.finalOutput;
|
|
1397
81
|
const event = {
|
|
1398
82
|
type: "done",
|
|
1399
83
|
runId: typeof data.runId === "string" ? data.runId : "",
|
|
1400
|
-
threadId: typeof data.threadId === "string" ? data.threadId : ""
|
|
84
|
+
threadId: typeof data.threadId === "string" ? data.threadId : "",
|
|
85
|
+
...typeof content === "string" ? { content } : {},
|
|
86
|
+
...withId
|
|
1401
87
|
};
|
|
1402
88
|
yield event;
|
|
1403
|
-
} else if (eventType === "
|
|
1404
|
-
const
|
|
1405
|
-
const
|
|
89
|
+
} else if (eventType === "approval_required") {
|
|
90
|
+
const event = { type: "approval_required" };
|
|
91
|
+
for (const key of ["toolId", "toolName", "title", "description", "nodeId", "prompt"]) {
|
|
92
|
+
const value = data[key];
|
|
93
|
+
if (typeof value === "string") event[key] = value;
|
|
94
|
+
}
|
|
95
|
+
const { args, options } = data;
|
|
96
|
+
if (args && typeof args === "object" && !Array.isArray(args)) event.args = args;
|
|
97
|
+
if (Array.isArray(options)) event.options = options;
|
|
98
|
+
yield { ...event, ...withId };
|
|
99
|
+
} else if (eventType === "workflow_cancelled") {
|
|
100
|
+
const event = { type: "cancelled", ...withId };
|
|
101
|
+
yield event;
|
|
102
|
+
} else if (eventType === "error" || eventType === "workflow_error") {
|
|
103
|
+
const msg = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(data.error, () => ( data.message)), () => ( data.content)), () => ( "Unknown run error"));
|
|
104
|
+
const event = {
|
|
105
|
+
type: "error",
|
|
106
|
+
message: String(msg),
|
|
107
|
+
...typeof data.requestId === "string" ? { requestId: data.requestId } : {},
|
|
108
|
+
...withId
|
|
109
|
+
};
|
|
1406
110
|
yield event;
|
|
1407
111
|
} else if (eventType === "cancelled") {
|
|
1408
|
-
const event = { type: "cancelled" };
|
|
112
|
+
const event = { type: "cancelled", ...withId };
|
|
1409
113
|
yield event;
|
|
1410
114
|
} else if (eventType === "stream_timeout") {
|
|
1411
|
-
const event = { type: "stream_timeout" };
|
|
115
|
+
const event = { type: "stream_timeout", ...withId };
|
|
1412
116
|
yield event;
|
|
1413
117
|
} else if (eventType === "assistant_content_reset") {
|
|
1414
118
|
if (typeof data.content !== "string") return;
|
|
@@ -1417,416 +121,231 @@ function* parseData(data) {
|
|
|
1417
121
|
content: data.content,
|
|
1418
122
|
...typeof data.visibleContent === "string" ? { visibleContent: data.visibleContent } : {},
|
|
1419
123
|
attempt: typeof data.attempt === "number" ? data.attempt : 1,
|
|
1420
|
-
reason: "provider_stream_failed"
|
|
124
|
+
reason: "provider_stream_failed",
|
|
125
|
+
...data.subAgent && typeof data.subAgent === "object" && !Array.isArray(data.subAgent) ? { subAgent: data.subAgent } : {},
|
|
126
|
+
...withId
|
|
1421
127
|
};
|
|
1422
128
|
yield event;
|
|
1423
|
-
} else if (!SILENTLY_IGNORED.has(eventType)) {
|
|
1424
|
-
return;
|
|
1425
129
|
}
|
|
1426
130
|
}
|
|
1427
|
-
function
|
|
1428
|
-
|
|
131
|
+
function sseLineParser() {
|
|
132
|
+
let lastId;
|
|
133
|
+
return function* (line) {
|
|
134
|
+
if (line.startsWith("id:")) {
|
|
135
|
+
lastId = line.slice(3).trim() || void 0;
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
1429
138
|
const data = parseLine(line);
|
|
1430
|
-
if (data !== void 0) yield* parseData(data);
|
|
1431
|
-
}
|
|
139
|
+
if (data !== void 0) yield* parseData(data, lastId);
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
function* parseSyncSseLines(lines) {
|
|
143
|
+
const parse = sseLineParser();
|
|
144
|
+
for (const line of lines) yield* parse(line);
|
|
1432
145
|
}
|
|
1433
146
|
async function* parseAsyncSseLines(lines) {
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
if (data !== void 0) yield* parseData(data);
|
|
1437
|
-
}
|
|
147
|
+
const parse = sseLineParser();
|
|
148
|
+
for await (const line of lines) yield* parse(line);
|
|
1438
149
|
}
|
|
1439
150
|
function parseSseStream(lines) {
|
|
1440
151
|
return isAsyncIterable(lines) ? parseAsyncSseLines(lines) : parseSyncSseLines(lines);
|
|
1441
152
|
}
|
|
1442
153
|
|
|
1443
|
-
// src/_generated/write-body-keys.ts
|
|
1444
|
-
var WRITE_BODY_ALLOWED_KEYS = {
|
|
1445
|
-
ContextCreatorsController_createLink: ["url", "title", "isCrawl", "pageLimit"],
|
|
1446
|
-
ContextCreatorsController_createNote: ["title", "content"],
|
|
1447
|
-
ContextCreatorsController_createSavedQuery: ["name", "connectionId", "query", "description", "path"],
|
|
1448
|
-
ContextFilesController_finalize: ["fileName", "folderPath"],
|
|
1449
|
-
ContextFilesController_finalizeMany: ["uploads"],
|
|
1450
|
-
ContextFilesController_uploadFromUrl: ["url", "fileName", "folderPath"],
|
|
1451
|
-
ContextFilesController_uploadFromUrls: ["urls"],
|
|
1452
|
-
ContextFilesController_uploadUrl: ["fileName", "contentType", "fileSize"],
|
|
1453
|
-
ContextFilesController_uploadUrls: ["files"],
|
|
1454
|
-
ContextItemsController_lookup: ["contextType", "dataPath", "contentProjection"],
|
|
1455
|
-
ContextItemsController_move: ["destinationFolderUid"],
|
|
1456
|
-
ContextItemsController_update: ["contextType", "content", "description", "userFeedback", "topics"],
|
|
1457
|
-
CustomContextItemsController_batchCreate: ["items"],
|
|
1458
|
-
CustomContextItemsController_create: ["kind", "sourceId", "sourceName", "collectionId", "collectionName", "externalId", "fieldName", "name", "entityType", "description", "content", "url", "attributes", "dataType", "value", "samples", "raw", "topics", "idempotencyKey", "access"],
|
|
1459
|
-
CustomContextItemsController_createRelations: ["relations"],
|
|
1460
|
-
CustomContextItemsController_update: ["name", "entityType", "description", "content", "url", "attributes", "dataType", "value", "samples", "raw", "topics"],
|
|
1461
|
-
DashboardsController_create: ["title", "description", "definition", "access"],
|
|
1462
|
-
DashboardsController_createElement: ["expectedRevision", "kind", "title", "layout"],
|
|
1463
|
-
DashboardsController_publish: ["expectedRevision"],
|
|
1464
|
-
DashboardsController_transferOwnership: ["newOwnerUserId"],
|
|
1465
|
-
DashboardsController_updateAccess: ["visibility", "groupPermissions", "sharedWith"],
|
|
1466
|
-
DashboardsController_updateDraft: ["expectedRevision", "title", "description", "definition"],
|
|
1467
|
-
DashboardsController_updateElement: ["expectedRevision", "patch"],
|
|
1468
|
-
DashboardsController_updateLayout: ["expectedRevision", "elements"],
|
|
1469
|
-
EvaluationsController_updateConfig: ["enabled", "cadence", "judgeModel", "judgeGuidance", "notifications"],
|
|
1470
|
-
IngestedDataController_upload: ["integration_type", "request", "response"],
|
|
1471
|
-
ModusChatController_chat: ["message", "model"],
|
|
1472
|
-
ModusContextController_compose: ["message", "limit"],
|
|
1473
|
-
ModusRunsController_create: ["message", "sessionId", "organizationId", "version", "fileThreadId", "config", "attachments", "userContext", "source", "runId", "subordinateSkillIds"],
|
|
1474
|
-
ResumeRunsController_create: ["message", "sessionId", "organizationId", "version", "fileThreadId", "config", "attachments", "userContext", "source", "runId", "decision"],
|
|
1475
|
-
RunLifecycleController_activeBySession: ["sessionIds"],
|
|
1476
|
-
RunLifecycleController_cancel: [],
|
|
1477
|
-
RunLifecycleController_editQueued: [],
|
|
1478
|
-
RunLifecycleController_interrupt: [],
|
|
1479
|
-
ScopeChatController_chat: ["message", "model"],
|
|
1480
|
-
ScopeContextController_compose: ["message", "limit"],
|
|
1481
|
-
ScopeInterfacesController_add: ["type", "name", "config"],
|
|
1482
|
-
ScopeInterfacesController_update: ["name", "config"],
|
|
1483
|
-
ScopeMemoriesController_search: ["query", "userId", "limit"],
|
|
1484
|
-
ScopeMemoriesController_update: ["memory", "metadata"],
|
|
1485
|
-
ScopeRunsController_create: ["message", "sessionId", "organizationId", "version", "fileThreadId", "config", "attachments", "userContext", "source", "runId", "subordinateSkillIds"],
|
|
1486
|
-
ScopesController_acceptOwnershipTransfer: [],
|
|
1487
|
-
ScopesController_create: ["name", "description", "expectedOutput", "instructions", "toolset", "model", "connectionSet", "contextSelections", "includeOwnLearnings", "interfaces", "accessConfig"],
|
|
1488
|
-
ScopesController_deploy: [],
|
|
1489
|
-
ScopesController_patchMcpConfig: ["config"],
|
|
1490
|
-
ScopesController_requestOwnershipTransfer: ["newOwnerUserId"],
|
|
1491
|
-
ScopesController_restore: [],
|
|
1492
|
-
ScopesController_update: ["name", "description", "expectedOutput", "instructions", "toolset", "model", "connectionSet", "contextSelections", "interfaces", "accessConfig", "managerId", "evaluations", "supervisionSubordinateDescriptions"],
|
|
1493
|
-
ScopeSupervisionController_set: ["subordinateAgentIds"],
|
|
1494
|
-
ScopeSupervisionController_setActive: ["subordinateAgentIds"],
|
|
1495
|
-
SuggestionsController_recordEvent: ["eventType", "source", "skillId", "threadId", "metadata"],
|
|
1496
|
-
WorkflowActionsController_cancel: [],
|
|
1497
|
-
WorkflowActionsController_execute: ["organizationId", "sessionId", "fileThreadId", "workflowAction", "previousOutputs", "userTimezone", "runId", "automationId", "source"],
|
|
1498
|
-
WorkflowInterfacesController_add: ["type", "name", "config"],
|
|
1499
|
-
WorkflowInterfacesController_update: ["name", "config"],
|
|
1500
|
-
WorkflowRunsController_create: ["message", "sessionId", "organizationId", "version", "fileThreadId", "config", "attachments", "userContext", "source", "runId"],
|
|
1501
|
-
WorkflowsController_acceptOwnershipTransfer: [],
|
|
1502
|
-
WorkflowsController_create: ["name", "type", "description", "trigger", "agentSelection", "workflowStructure", "accessConfig"],
|
|
1503
|
-
WorkflowsController_deploy: [],
|
|
1504
|
-
WorkflowsController_requestOwnershipTransfer: ["newOwnerUserId"],
|
|
1505
|
-
WorkflowsController_restore: [],
|
|
1506
|
-
WorkflowsController_toggle: ["active"],
|
|
1507
|
-
WorkflowsController_update: ["name", "type", "description", "trigger", "agentSelection", "workflowStructure", "accessConfig"]
|
|
1508
|
-
};
|
|
1509
|
-
|
|
1510
|
-
// src/_validation.ts
|
|
1511
|
-
var DEFAULT_MAX_PAGE_SIZE = 200;
|
|
1512
|
-
function validatePageSize(pageSize, maxPageSize) {
|
|
1513
|
-
if (!Number.isInteger(pageSize) || pageSize < 1) {
|
|
1514
|
-
throw new Error(`page_size must be a positive int, got ${pageSize}`);
|
|
1515
|
-
}
|
|
1516
|
-
if (maxPageSize !== void 0 && pageSize > maxPageSize) {
|
|
1517
|
-
throw new Error(`page_size must be <= ${maxPageSize}, got ${pageSize}`);
|
|
1518
|
-
}
|
|
1519
|
-
}
|
|
1520
|
-
function validateId(resourceId, name = "id") {
|
|
1521
|
-
if (typeof resourceId === "string" && !resourceId.trim()) {
|
|
1522
|
-
throw new Error(`${name} must be a non-empty string or int`);
|
|
1523
|
-
}
|
|
1524
|
-
}
|
|
1525
|
-
var ALLOWED_CHAT_MODELS = /* @__PURE__ */ new Set([
|
|
1526
|
-
"claude-sonnet-5",
|
|
1527
|
-
"claude-sonnet-5.5",
|
|
1528
|
-
"claude-sonnet-4.6",
|
|
1529
|
-
"claude-opus-4.8",
|
|
1530
|
-
"claude-opus-5.5",
|
|
1531
|
-
"gpt-5.2",
|
|
1532
|
-
"gpt-5.5",
|
|
1533
|
-
"gpt-5-mini",
|
|
1534
|
-
"gpt-5.6-luna",
|
|
1535
|
-
"gpt-6-luna",
|
|
1536
|
-
"gpt-oss-120b",
|
|
1537
|
-
"gpt-oss-20b",
|
|
1538
|
-
"qwen3-235b-a22b-2507",
|
|
1539
|
-
"qwen3-coder",
|
|
1540
|
-
"qwen3-32b",
|
|
1541
|
-
"deepseek-chat-v3.1",
|
|
1542
|
-
"deepseek-v4-pro",
|
|
1543
|
-
"deepseek-v4-flash-latest",
|
|
1544
|
-
"minimax-m2.7",
|
|
1545
|
-
"llama-4-maverick",
|
|
1546
|
-
"llama-4-scout",
|
|
1547
|
-
"llama-3.3-70b-instruct",
|
|
1548
|
-
"gemini-3.1-pro-preview",
|
|
1549
|
-
"gemini-3-flash-preview",
|
|
1550
|
-
"grok-4.3-fast",
|
|
1551
|
-
"grok-4.3",
|
|
1552
|
-
"grok-4.7",
|
|
1553
|
-
"kimi-k3"
|
|
1554
|
-
]);
|
|
1555
|
-
function validateChatModel(model) {
|
|
1556
|
-
if (!ALLOWED_CHAT_MODELS.has(model)) {
|
|
1557
|
-
const supported = [...ALLOWED_CHAT_MODELS].sort().join(", ");
|
|
1558
|
-
throw new Error(`Unsupported model ${JSON.stringify(model)}. Choose one of: ${supported}.`);
|
|
1559
|
-
}
|
|
1560
|
-
}
|
|
1561
|
-
function assertWriteBodyKeys(operationId, body) {
|
|
1562
|
-
const allowed = WRITE_BODY_ALLOWED_KEYS[operationId];
|
|
1563
|
-
if (allowed === void 0) return;
|
|
1564
|
-
if (body === void 0 || body === null) return;
|
|
1565
|
-
if (typeof body !== "object" || Array.isArray(body)) {
|
|
1566
|
-
throw new ValidationError(`Request body must be a plain object for ${operationId}`);
|
|
1567
|
-
}
|
|
1568
|
-
const allowedSet = new Set(allowed);
|
|
1569
|
-
const extra = Object.keys(body).filter((k) => !allowedSet.has(k));
|
|
1570
|
-
if (extra.length > 0) {
|
|
1571
|
-
throw new ValidationError(
|
|
1572
|
-
`${operationId}: disallowed request body field(s): ${extra.sort().join(", ")}`
|
|
1573
|
-
);
|
|
1574
|
-
}
|
|
1575
|
-
}
|
|
1576
|
-
|
|
1577
154
|
// src/_chat.ts
|
|
1578
155
|
function effectiveThreadId(threadId) {
|
|
1579
|
-
if (threadId === void 0) return void 0;
|
|
1580
|
-
if (!threadId.trim()) return void 0;
|
|
156
|
+
if (threadId === void 0 || !threadId.trim()) return void 0;
|
|
1581
157
|
return threadId;
|
|
1582
158
|
}
|
|
1583
|
-
function
|
|
1584
|
-
|
|
1585
|
-
}
|
|
1586
|
-
function chatPath(resource, resourceId, options) {
|
|
1587
|
-
const safeId = encodeURIComponent(String(resourceId));
|
|
1588
|
-
const tid = effectiveThreadId(options.threadId);
|
|
1589
|
-
if (tid !== void 0) {
|
|
1590
|
-
const safeTid = encodeURIComponent(tid);
|
|
1591
|
-
return `/api/v1/${resource}/${safeId}/conversations/${safeTid}/chat`;
|
|
1592
|
-
}
|
|
1593
|
-
return `/api/v1/${resource}/${safeId}/chat`;
|
|
1594
|
-
}
|
|
1595
|
-
function modusChatPath(options) {
|
|
1596
|
-
const tid = effectiveThreadId(options.threadId);
|
|
1597
|
-
if (tid !== void 0) {
|
|
1598
|
-
validateId(tid, "thread_id");
|
|
1599
|
-
return `/api/v1/modus/conversations/${encodeURIComponent(tid)}/chat`;
|
|
1600
|
-
}
|
|
1601
|
-
return `/api/v1/modus/chat`;
|
|
1602
|
-
}
|
|
1603
|
-
function agentHostRunsPath(resource, resourceId) {
|
|
1604
|
-
if (resource === "modus") return "/agent/v1/modus/runs";
|
|
1605
|
-
const safeId = encodeURIComponent(String(resourceId));
|
|
1606
|
-
return `/agent/v1/${resource}/${safeId}/runs`;
|
|
1607
|
-
}
|
|
1608
|
-
function chatBody(message, model) {
|
|
1609
|
-
return { message, model };
|
|
1610
|
-
}
|
|
1611
|
-
function agentRunsBody(message, model, options) {
|
|
1612
|
-
const body = {
|
|
1613
|
-
message,
|
|
1614
|
-
config: { model },
|
|
1615
|
-
sessionId: options.sessionId
|
|
1616
|
-
};
|
|
1617
|
-
if (options.organizationId !== void 0) {
|
|
1618
|
-
body.organizationId = options.organizationId;
|
|
1619
|
-
}
|
|
1620
|
-
if (options.version !== void 0) {
|
|
1621
|
-
body.version = options.version;
|
|
1622
|
-
}
|
|
1623
|
-
return body;
|
|
159
|
+
function runsPath(target) {
|
|
160
|
+
if (target.kind === "modus") return "/agent/v1/modus/runs";
|
|
161
|
+
return `/agent/v1/${target.kind}/${encodeURIComponent(String(target.id))}/runs`;
|
|
1624
162
|
}
|
|
1625
163
|
function raiseForEvent(event) {
|
|
1626
|
-
if (event.type === "error") throw new ModusError(event.message);
|
|
1627
|
-
if (event.type === "cancelled") throw new RunCancelledError();
|
|
1628
|
-
if (event.type === "stream_timeout") throw new StreamTimeoutError();
|
|
164
|
+
if (event.type === "error") throw new (0, _chunkNA3ZD35Tcjs.ModusError)(event.message, { requestId: event.requestId });
|
|
165
|
+
if (event.type === "cancelled") throw new (0, _chunkNA3ZD35Tcjs.RunCancelledError)();
|
|
166
|
+
if (event.type === "stream_timeout") throw new (0, _chunkNA3ZD35Tcjs.StreamTimeoutError)();
|
|
1629
167
|
return event;
|
|
1630
168
|
}
|
|
1631
|
-
var
|
|
1632
|
-
|
|
169
|
+
var ChatSession = class _ChatSession {
|
|
170
|
+
/**
|
|
171
|
+
* @internal A session built with `failure` never sends; every read rejects
|
|
172
|
+
* with it, as the promise `chat()` used to return did.
|
|
173
|
+
*/
|
|
174
|
+
constructor(http, request, failure) {
|
|
1633
175
|
this.http = http;
|
|
1634
|
-
this.
|
|
1635
|
-
this.
|
|
1636
|
-
this.
|
|
1637
|
-
|
|
176
|
+
this.request = request;
|
|
177
|
+
this.received = [];
|
|
178
|
+
this.finished = false;
|
|
179
|
+
if (failure !== void 0) {
|
|
180
|
+
this.failure = failure;
|
|
181
|
+
this.finished = true;
|
|
182
|
+
}
|
|
1638
183
|
}
|
|
1639
184
|
/**
|
|
1640
|
-
*
|
|
185
|
+
* The assistant's reply as text chunks, as they arrive. Sub-agent output is
|
|
186
|
+
* left out.
|
|
1641
187
|
*
|
|
1642
|
-
* @
|
|
1643
|
-
* @throws {ModusError} When the stream emits an error event.
|
|
188
|
+
* @throws {ModusError} When the run reports an error.
|
|
1644
189
|
* @throws {RunCancelledError} When the run is cancelled.
|
|
1645
|
-
* @throws {StreamTimeoutError} When the
|
|
190
|
+
* @throws {StreamTimeoutError} When the run times out.
|
|
1646
191
|
*/
|
|
1647
192
|
async *textStream() {
|
|
1648
|
-
|
|
1649
|
-
|
|
193
|
+
const lastReset = this.received.findLastIndex(
|
|
194
|
+
(event) => event.type === "assistant_content_reset" && event.subAgent === void 0
|
|
195
|
+
);
|
|
196
|
+
let index = 0;
|
|
197
|
+
for await (const event of this.replay(false)) {
|
|
198
|
+
const at = index++;
|
|
199
|
+
if (at < lastReset) continue;
|
|
200
|
+
if (at === lastReset && event.type === "assistant_content_reset") {
|
|
201
|
+
if (event.content) yield event.content;
|
|
202
|
+
} else if (event.type === "token" && event.subAgent === void 0) {
|
|
203
|
+
yield event.content;
|
|
204
|
+
}
|
|
1650
205
|
}
|
|
1651
206
|
}
|
|
1652
207
|
/**
|
|
1653
|
-
*
|
|
208
|
+
* Every run event (tokens, approvals, `done`, …) as it arrives.
|
|
1654
209
|
*
|
|
1655
|
-
* @
|
|
1656
|
-
* @throws {ModusError} When the stream emits an error event.
|
|
210
|
+
* @throws {ModusError} When the run reports an error.
|
|
1657
211
|
* @throws {RunCancelledError} When the run is cancelled.
|
|
1658
|
-
* @throws {StreamTimeoutError} When the
|
|
212
|
+
* @throws {StreamTimeoutError} When the run times out.
|
|
1659
213
|
*/
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
}
|
|
1663
|
-
async *events(supportsReset) {
|
|
1664
|
-
const body = supportsReset ? { ...this.body, streamProtocolVersion: 2 } : this.body;
|
|
1665
|
-
for await (const line of this.http.streamPost(this.path, body, {
|
|
1666
|
-
baseUrl: this.baseUrl
|
|
1667
|
-
})) {
|
|
1668
|
-
for (const event of parseSseStream([line])) {
|
|
1669
|
-
const normalized = raiseForEvent(event);
|
|
1670
|
-
if (normalized.type === "token") this.textParts.push(normalized.content);
|
|
1671
|
-
if (normalized.type === "assistant_content_reset") {
|
|
1672
|
-
this.textParts.length = 0;
|
|
1673
|
-
this.textParts.push(normalized.content);
|
|
1674
|
-
}
|
|
1675
|
-
if (normalized.type === "done") {
|
|
1676
|
-
this.final = {
|
|
1677
|
-
content: this.textParts.join(""),
|
|
1678
|
-
threadId: normalized.threadId,
|
|
1679
|
-
runId: normalized.runId
|
|
1680
|
-
};
|
|
1681
|
-
yield normalized;
|
|
1682
|
-
return;
|
|
1683
|
-
}
|
|
1684
|
-
yield normalized;
|
|
1685
|
-
}
|
|
1686
|
-
}
|
|
214
|
+
eventStream() {
|
|
215
|
+
return this.replay(true);
|
|
1687
216
|
}
|
|
1688
217
|
/**
|
|
1689
|
-
*
|
|
1690
|
-
*
|
|
1691
|
-
* Call only after fully consuming {@link ChatStream.textStream} or
|
|
1692
|
-
* {@link ChatStream.eventStream}.
|
|
218
|
+
* Waits for the run to finish and returns its final answer. `approval` is
|
|
219
|
+
* set when the run stopped for a decision; continue with {@link resume}.
|
|
1693
220
|
*
|
|
1694
|
-
* @
|
|
1695
|
-
* @throws {ModusError} When called before the stream finishes with a done event.
|
|
221
|
+
* @throws {ModusError} When the run reports an error or ends without finishing.
|
|
1696
222
|
*/
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
throw new ModusError(
|
|
1700
|
-
"Stream ended without a done event; call getFinalResult() only after consuming textStream() or eventStream()."
|
|
1701
|
-
);
|
|
223
|
+
async result() {
|
|
224
|
+
for await (const _event of this.replay(true)) {
|
|
1702
225
|
}
|
|
226
|
+
if (this.final === void 0) throw new (0, _chunkNA3ZD35Tcjs.ModusError)("Chat stream ended without a done event");
|
|
1703
227
|
return this.final;
|
|
1704
228
|
}
|
|
1705
|
-
}
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
validateChatModel(options.model);
|
|
1709
|
-
const path = chatPath(resource, resourceId, {
|
|
1710
|
-
threadId: options.threadId
|
|
1711
|
-
});
|
|
1712
|
-
const data = await http.post(path, chatBody(message, options.model));
|
|
1713
|
-
return data;
|
|
1714
|
-
}
|
|
1715
|
-
function chatStreamSession(http, config, resource, resourceId, message, options) {
|
|
1716
|
-
validateId(resourceId, `${resource}_id`);
|
|
1717
|
-
validateChatModel(options.model);
|
|
1718
|
-
const path = agentHostRunsPath(resource, resourceId);
|
|
1719
|
-
return new ChatStream(
|
|
1720
|
-
http,
|
|
1721
|
-
path,
|
|
1722
|
-
agentRunsBody(message, options.model, {
|
|
1723
|
-
sessionId: resolveSessionId(options.threadId),
|
|
1724
|
-
organizationId: config.organizationId,
|
|
1725
|
-
version: options.version
|
|
1726
|
-
}),
|
|
1727
|
-
config.agentHost
|
|
1728
|
-
);
|
|
1729
|
-
}
|
|
1730
|
-
async function modusChatBuffered(http, message, options) {
|
|
1731
|
-
validateChatModel(options.model);
|
|
1732
|
-
const path = modusChatPath({ threadId: options.threadId });
|
|
1733
|
-
const data = await http.post(path, chatBody(message, options.model));
|
|
1734
|
-
return data;
|
|
1735
|
-
}
|
|
1736
|
-
function modusChatStreamSession(http, config, message, options) {
|
|
1737
|
-
validateChatModel(options.model);
|
|
1738
|
-
return new ChatStream(
|
|
1739
|
-
http,
|
|
1740
|
-
agentHostRunsPath("modus"),
|
|
1741
|
-
agentRunsBody(message, options.model, {
|
|
1742
|
-
sessionId: resolveSessionId(options.threadId),
|
|
1743
|
-
organizationId: config.organizationId
|
|
1744
|
-
}),
|
|
1745
|
-
config.agentHost
|
|
1746
|
-
);
|
|
1747
|
-
}
|
|
1748
|
-
|
|
1749
|
-
// src/_pagination.ts
|
|
1750
|
-
var Page = class {
|
|
1751
|
-
constructor(items, nextPageToken, fetchPage) {
|
|
1752
|
-
this.items = items;
|
|
1753
|
-
this.nextPageToken = normalizePageToken(nextPageToken);
|
|
1754
|
-
this.fetchPage = fetchPage;
|
|
229
|
+
/** Resolve with the final {@link ChatResult}, so the session can be awaited. */
|
|
230
|
+
then(onfulfilled, onrejected) {
|
|
231
|
+
return this.result().then(onfulfilled, onrejected);
|
|
1755
232
|
}
|
|
1756
|
-
/**
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
return this.
|
|
233
|
+
/** Handle a failed run, as on the promise `chat()` used to return. */
|
|
234
|
+
catch(onrejected) {
|
|
235
|
+
return this.result().catch(onrejected);
|
|
236
|
+
}
|
|
237
|
+
/** Run `onfinally` once the run settles, as on the promise `chat()` used to return. */
|
|
238
|
+
finally(onfinally) {
|
|
239
|
+
return this.result().finally(onfinally);
|
|
1763
240
|
}
|
|
1764
241
|
/**
|
|
1765
|
-
*
|
|
242
|
+
* Approve or deny the action this run stopped for, continuing the same
|
|
243
|
+
* conversation.
|
|
1766
244
|
*
|
|
1767
|
-
* @
|
|
1768
|
-
* @
|
|
245
|
+
* @param input.decision - `approve` or `deny`.
|
|
246
|
+
* @returns A new session for the continued run.
|
|
247
|
+
* @throws {ModusError} When called before the run has finished.
|
|
248
|
+
*
|
|
249
|
+
* @example
|
|
250
|
+
* ```ts
|
|
251
|
+
* const chat = client.modus.chat('Fix the typo in accounts', { model: 'claude-sonnet-5.5' })
|
|
252
|
+
* const first = await chat
|
|
253
|
+
* if (first.approval) {
|
|
254
|
+
* const done = await chat.resume({ decision: 'approve' })
|
|
255
|
+
* }
|
|
256
|
+
* ```
|
|
1769
257
|
*/
|
|
1770
|
-
|
|
1771
|
-
if (this.
|
|
1772
|
-
throw new
|
|
1773
|
-
"No next page available. Check hasNextPage() before calling getNextPage()."
|
|
1774
|
-
);
|
|
258
|
+
resume(input) {
|
|
259
|
+
if (this.final === void 0) {
|
|
260
|
+
throw new (0, _chunkNA3ZD35Tcjs.ModusError)("resume() needs a finished run: await the chat first");
|
|
1775
261
|
}
|
|
1776
|
-
|
|
262
|
+
const { runId, threadId } = this.final;
|
|
263
|
+
_chunkNA3ZD35Tcjs.validateId.call(void 0, runId, "run_id");
|
|
264
|
+
return new _ChatSession(this.http, {
|
|
265
|
+
path: `/agent/v1/runs/${encodeURIComponent(runId)}/resume`,
|
|
266
|
+
body: { sessionId: threadId, decision: input.decision },
|
|
267
|
+
sessionId: threadId,
|
|
268
|
+
baseUrl: this.request.baseUrl
|
|
269
|
+
});
|
|
1777
270
|
}
|
|
1778
271
|
/**
|
|
1779
|
-
*
|
|
1780
|
-
*
|
|
1781
|
-
*
|
|
1782
|
-
* @throws {ModusError} When a follow-up page request fails.
|
|
272
|
+
* Stop reading the run and release its connection. Call it when you stop
|
|
273
|
+
* iterating before the run ends; a session that reached `done` has already
|
|
274
|
+
* let go. The run itself keeps going on the server.
|
|
1783
275
|
*/
|
|
1784
|
-
async
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
276
|
+
async close() {
|
|
277
|
+
this.finished = true;
|
|
278
|
+
await _optionalChain([this, 'access', _ => _.live, 'optionalAccess', _2 => _2.return, 'call', _3 => _3(void 0)]);
|
|
279
|
+
}
|
|
280
|
+
// ponytail: one consumer at a time; concurrent iterators would race on `live`.
|
|
281
|
+
async *replay(resetAware) {
|
|
282
|
+
let index = 0;
|
|
283
|
+
while (true) {
|
|
284
|
+
if (index < this.received.length) {
|
|
285
|
+
yield this.received[index++];
|
|
286
|
+
continue;
|
|
287
|
+
}
|
|
288
|
+
if (this.failure !== void 0) throw this.failure;
|
|
289
|
+
if (this.finished) return;
|
|
290
|
+
_nullishCoalesce(this.live, () => ( (this.live = this.open(resetAware))));
|
|
291
|
+
try {
|
|
292
|
+
const next = await this.live.next();
|
|
293
|
+
if (next.done) {
|
|
294
|
+
this.finished = true;
|
|
295
|
+
} else {
|
|
296
|
+
this.received.push(next.value);
|
|
297
|
+
if (next.value.type === "done") await this.close();
|
|
298
|
+
}
|
|
299
|
+
} catch (error) {
|
|
300
|
+
this.failure = error;
|
|
301
|
+
throw error;
|
|
302
|
+
}
|
|
1791
303
|
}
|
|
1792
304
|
}
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
305
|
+
async *open(resetAware) {
|
|
306
|
+
const request = this.request;
|
|
307
|
+
const body = resetAware ? { ...request.body, streamProtocolVersion: 2 } : request.body;
|
|
308
|
+
const lines = this.http.streamPost(request.path, body, { baseUrl: request.baseUrl });
|
|
309
|
+
for await (const event of parseSseStream(lines)) {
|
|
310
|
+
raiseForEvent(event);
|
|
311
|
+
if (event.type === "approval_required") this.approval = event;
|
|
312
|
+
if (event.type === "done") {
|
|
313
|
+
this.final = {
|
|
314
|
+
content: _nullishCoalesce(event.content, () => ( "")),
|
|
315
|
+
threadId: event.threadId || this.request.sessionId,
|
|
316
|
+
runId: event.runId,
|
|
317
|
+
...this.approval !== void 0 ? { approval: this.approval } : {}
|
|
318
|
+
};
|
|
319
|
+
yield event;
|
|
320
|
+
return;
|
|
321
|
+
}
|
|
322
|
+
yield event;
|
|
323
|
+
}
|
|
1796
324
|
}
|
|
1797
325
|
};
|
|
1798
|
-
function
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
}
|
|
1802
|
-
|
|
1803
|
-
const params = { pageSize, ...extra };
|
|
1804
|
-
const token = normalizePageToken(pageToken);
|
|
1805
|
-
if (token !== void 0) params.pageToken = token;
|
|
1806
|
-
return params;
|
|
1807
|
-
}
|
|
1808
|
-
function nextPageTokenFromResponse(data) {
|
|
1809
|
-
return normalizePageToken(
|
|
1810
|
-
typeof data.nextPageToken === "string" ? data.nextPageToken : void 0
|
|
1811
|
-
);
|
|
1812
|
-
}
|
|
1813
|
-
function requireItemsList(data, itemsKey) {
|
|
1814
|
-
const value = data[itemsKey];
|
|
1815
|
-
if (!Array.isArray(value)) {
|
|
1816
|
-
throw new ModusError(
|
|
1817
|
-
`Unexpected list response shape: ${itemsKey} must be a list, got ${typeof value}. This is likely a backend error.`
|
|
1818
|
-
);
|
|
326
|
+
function startChat(http, config, target, message, options) {
|
|
327
|
+
try {
|
|
328
|
+
return new ChatSession(http, chatRequest(config, target, message, options));
|
|
329
|
+
} catch (error) {
|
|
330
|
+
return new ChatSession(http, void 0, error);
|
|
1819
331
|
}
|
|
1820
|
-
return value;
|
|
1821
332
|
}
|
|
1822
|
-
function
|
|
1823
|
-
if (
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
333
|
+
function chatRequest(config, target, message, options) {
|
|
334
|
+
if (target.kind !== "modus") _chunkNA3ZD35Tcjs.validateId.call(void 0, target.id, `${target.kind.slice(0, -1)}_id`);
|
|
335
|
+
_chunkNA3ZD35Tcjs.validateChatModel.call(void 0, options.model);
|
|
336
|
+
const baseUrl = _chunkNA3ZD35Tcjs.requireAgentHost.call(void 0, config);
|
|
337
|
+
const sessionId = resolveAgentRunSessionId(effectiveThreadId(options.threadId));
|
|
338
|
+
return {
|
|
339
|
+
path: runsPath(target),
|
|
340
|
+
body: {
|
|
341
|
+
message,
|
|
342
|
+
config: { model: options.model },
|
|
343
|
+
sessionId,
|
|
344
|
+
...config.organizationId !== void 0 ? { organizationId: config.organizationId } : {}
|
|
345
|
+
},
|
|
346
|
+
sessionId,
|
|
347
|
+
baseUrl
|
|
348
|
+
};
|
|
1830
349
|
}
|
|
1831
350
|
|
|
1832
351
|
// src/types/workflows.ts
|
|
@@ -1844,496 +363,71 @@ function conversationSkillId(item) {
|
|
|
1844
363
|
return item.scopeId;
|
|
1845
364
|
}
|
|
1846
365
|
|
|
1847
|
-
// src/
|
|
1848
|
-
var
|
|
1849
|
-
var ENV_BASE_URL = "MODUS_BASE_URL";
|
|
1850
|
-
var ENV_AGENT_HOST = "MODUS_AGENT_HOST";
|
|
1851
|
-
var ENV_ORGANIZATION_ID = "MODUS_ORGANIZATION_ID";
|
|
1852
|
-
var ENV_TIMEOUT = "MODUS_TIMEOUT";
|
|
1853
|
-
var ENV_MAX_RETRIES = "MODUS_MAX_RETRIES";
|
|
1854
|
-
var KEY_PREFIX = "modus_";
|
|
1855
|
-
function resolveApiKey(apiKey) {
|
|
1856
|
-
const key = apiKey ?? process.env[ENV_API_KEY];
|
|
1857
|
-
if (!key) {
|
|
1858
|
-
throw new AuthenticationError(
|
|
1859
|
-
`No API key provided. Pass apiKey or set the ${ENV_API_KEY} environment variable. Create a token at app.getmodus.com \u2192 Settings \u2192 API Tokens.`
|
|
1860
|
-
);
|
|
1861
|
-
}
|
|
1862
|
-
if (!key.startsWith(KEY_PREFIX)) {
|
|
1863
|
-
throw new AuthenticationError(
|
|
1864
|
-
`Invalid API key format. Modus API keys start with '${KEY_PREFIX}'. Create a token at app.getmodus.com \u2192 Settings \u2192 API Tokens.`
|
|
1865
|
-
);
|
|
1866
|
-
}
|
|
1867
|
-
return key;
|
|
1868
|
-
}
|
|
1869
|
-
function resolveBaseUrl(baseUrl) {
|
|
1870
|
-
return baseUrl ?? process.env[ENV_BASE_URL] ?? void 0;
|
|
1871
|
-
}
|
|
1872
|
-
function resolveAgentHost(agentHost) {
|
|
1873
|
-
return agentHost ?? process.env[ENV_AGENT_HOST] ?? void 0;
|
|
1874
|
-
}
|
|
1875
|
-
function isModusApiHostname(hostname) {
|
|
1876
|
-
return hostname === "api.getmodus.com" || /^api\.[a-z0-9-]+\.getmodus\.com$/i.test(hostname);
|
|
1877
|
-
}
|
|
1878
|
-
function deriveAgentHostFromBaseUrl(baseUrl) {
|
|
1879
|
-
try {
|
|
1880
|
-
const url = new URL(baseUrl);
|
|
1881
|
-
if (!isModusApiHostname(url.hostname)) return void 0;
|
|
1882
|
-
url.hostname = `agent.${url.hostname.slice("api.".length)}`;
|
|
1883
|
-
return url.origin;
|
|
1884
|
-
} catch {
|
|
1885
|
-
return void 0;
|
|
1886
|
-
}
|
|
1887
|
-
}
|
|
1888
|
-
function resolveOrganizationId(organizationId) {
|
|
1889
|
-
const raw = organizationId ?? process.env[ENV_ORGANIZATION_ID];
|
|
1890
|
-
if (raw === void 0) return void 0;
|
|
1891
|
-
const stripped = raw.trim();
|
|
1892
|
-
return stripped || void 0;
|
|
1893
|
-
}
|
|
1894
|
-
function resolveTimeoutMs(explicitMs) {
|
|
1895
|
-
if (explicitMs !== void 0) return explicitMs;
|
|
1896
|
-
const raw = process.env[ENV_TIMEOUT];
|
|
1897
|
-
if (raw === void 0) return void 0;
|
|
1898
|
-
const seconds = Number(raw);
|
|
1899
|
-
return Number.isFinite(seconds) ? seconds * 1e3 : void 0;
|
|
1900
|
-
}
|
|
1901
|
-
function resolveMaxRetries(explicit) {
|
|
1902
|
-
if (explicit !== void 0) {
|
|
1903
|
-
if (explicit < 0) throw new Error(`max_retries must be >= 0, got ${explicit}`);
|
|
1904
|
-
return explicit;
|
|
1905
|
-
}
|
|
1906
|
-
const raw = process.env[ENV_MAX_RETRIES];
|
|
1907
|
-
if (raw === void 0) return void 0;
|
|
1908
|
-
const value = Number.parseInt(raw, 10);
|
|
1909
|
-
return Number.isFinite(value) && value >= 0 ? value : void 0;
|
|
1910
|
-
}
|
|
1911
|
-
function authHeaders(apiKey) {
|
|
1912
|
-
return { Authorization: `Bearer ${apiKey}` };
|
|
1913
|
-
}
|
|
1914
|
-
|
|
1915
|
-
// src/_config.ts
|
|
1916
|
-
var DEFAULT_BASE_URL = "https://api.getmodus.com";
|
|
1917
|
-
var DEFAULT_AGENT_HOST = "https://agent.getmodus.com";
|
|
1918
|
-
var DEFAULT_TIMEOUT_MS = 3e5;
|
|
1919
|
-
var DEFAULT_MAX_RETRIES = 2;
|
|
1920
|
-
function normalizeBaseUrl(baseUrl) {
|
|
1921
|
-
return baseUrl.replace(/\/$/, "");
|
|
1922
|
-
}
|
|
1923
|
-
function normalizeBaseUrls(baseUrls) {
|
|
1924
|
-
return Object.fromEntries(
|
|
1925
|
-
Object.entries(baseUrls ?? {}).map(([service, baseUrl]) => [
|
|
1926
|
-
service,
|
|
1927
|
-
normalizeBaseUrl(baseUrl)
|
|
1928
|
-
])
|
|
1929
|
-
);
|
|
1930
|
-
}
|
|
1931
|
-
function createModusConfig(options = {}) {
|
|
1932
|
-
const maxRetries = resolveMaxRetries(options.maxRetries) ?? DEFAULT_MAX_RETRIES;
|
|
1933
|
-
if (!Number.isInteger(maxRetries) || maxRetries < 0) {
|
|
1934
|
-
throw new Error(`max_retries must be a non-negative int, got ${maxRetries}`);
|
|
1935
|
-
}
|
|
1936
|
-
const baseUrl = normalizeBaseUrl(resolveBaseUrl(options.baseUrl) ?? DEFAULT_BASE_URL);
|
|
1937
|
-
const baseUrlOverrides = normalizeBaseUrls(options.baseUrls);
|
|
1938
|
-
const agentHost = normalizeBaseUrl(
|
|
1939
|
-
baseUrlOverrides["agent-service"] ?? resolveAgentHost(options.agentHost) ?? deriveAgentHostFromBaseUrl(baseUrl) ?? DEFAULT_AGENT_HOST
|
|
1940
|
-
);
|
|
1941
|
-
const organizationId = resolveOrganizationId(options.organizationId);
|
|
1942
|
-
return Object.freeze({
|
|
1943
|
-
apiKey: resolveApiKey(options.apiKey),
|
|
1944
|
-
baseUrl,
|
|
1945
|
-
agentHost,
|
|
1946
|
-
...organizationId !== void 0 ? { organizationId } : {},
|
|
1947
|
-
baseUrls: Object.freeze({
|
|
1948
|
-
"modus-api": baseUrl,
|
|
1949
|
-
"agent-service": agentHost,
|
|
1950
|
-
...baseUrlOverrides
|
|
1951
|
-
}),
|
|
1952
|
-
timeoutMs: resolveTimeoutMs(options.timeoutMs) ?? DEFAULT_TIMEOUT_MS,
|
|
1953
|
-
maxRetries,
|
|
1954
|
-
defaultHeaders: Object.freeze({ ...options.defaultHeaders }),
|
|
1955
|
-
fetch: options.fetch ?? globalThis.fetch.bind(globalThis)
|
|
1956
|
-
});
|
|
1957
|
-
}
|
|
1958
|
-
function resolveServiceBaseUrl(config, service, generatedBaseUrl) {
|
|
1959
|
-
if (service === "agent-service") {
|
|
1960
|
-
return config.baseUrls["agent-service"] ?? config.agentHost ?? generatedBaseUrl ?? config.baseUrl;
|
|
1961
|
-
}
|
|
1962
|
-
return config.baseUrls[service] ?? generatedBaseUrl ?? config.baseUrl;
|
|
1963
|
-
}
|
|
1964
|
-
function formatConfigForLog(config) {
|
|
1965
|
-
const masked = config.apiKey.length > 10 ? `${config.apiKey.slice(0, 10)}***` : "***";
|
|
1966
|
-
return `ModusConfig(apiKey=${JSON.stringify(masked)}, baseUrl=${JSON.stringify(config.baseUrl)}, timeoutMs=${config.timeoutMs}, maxRetries=${config.maxRetries})`;
|
|
1967
|
-
}
|
|
1968
|
-
|
|
1969
|
-
// src/_http.ts
|
|
1970
|
-
var USER_AGENT = `modus-typescript/${"0.8.0"} (node/${process.version}; ${process.platform})`;
|
|
1971
|
-
function buildUrl(baseUrl, path, params) {
|
|
1972
|
-
const url = new URL(path.startsWith("/") ? path : `/${path}`, baseUrl);
|
|
1973
|
-
if (params) {
|
|
1974
|
-
for (const [key, value] of Object.entries(params)) {
|
|
1975
|
-
if (value === void 0 || value === null) continue;
|
|
1976
|
-
if (Array.isArray(value)) {
|
|
1977
|
-
for (const item of value) url.searchParams.append(key, String(item));
|
|
1978
|
-
} else {
|
|
1979
|
-
url.searchParams.set(key, String(value));
|
|
1980
|
-
}
|
|
1981
|
-
}
|
|
1982
|
-
}
|
|
1983
|
-
return url.toString();
|
|
1984
|
-
}
|
|
1985
|
-
function mergeHeaders(...layers) {
|
|
1986
|
-
const merged = /* @__PURE__ */ new Map();
|
|
1987
|
-
for (const layer of layers) {
|
|
1988
|
-
for (const [name, value] of Object.entries(layer ?? {})) {
|
|
1989
|
-
merged.set(name.toLowerCase(), [name, value]);
|
|
1990
|
-
}
|
|
1991
|
-
}
|
|
1992
|
-
return Object.fromEntries(merged.values());
|
|
1993
|
-
}
|
|
1994
|
-
function headersToRecord(headers) {
|
|
1995
|
-
const out = {};
|
|
1996
|
-
headers.forEach((value, key) => {
|
|
1997
|
-
out[key] = value;
|
|
1998
|
-
});
|
|
1999
|
-
return out;
|
|
2000
|
-
}
|
|
2001
|
-
function messageFromBody(raw, statusCode) {
|
|
2002
|
-
if (!raw) return `HTTP ${statusCode}`;
|
|
2003
|
-
try {
|
|
2004
|
-
const body = JSON.parse(raw);
|
|
2005
|
-
if (body && typeof body === "object") {
|
|
2006
|
-
const record = body;
|
|
2007
|
-
const envelope = record.error;
|
|
2008
|
-
if (envelope && typeof envelope === "object") {
|
|
2009
|
-
const msg2 = envelope.message;
|
|
2010
|
-
if (typeof msg2 === "string" && msg2) return msg2;
|
|
2011
|
-
}
|
|
2012
|
-
const msg = record.message ?? record.error;
|
|
2013
|
-
if (Array.isArray(msg)) return msg.map(String).join("; ");
|
|
2014
|
-
if (typeof msg === "string" && msg) return msg;
|
|
2015
|
-
}
|
|
2016
|
-
} catch {
|
|
2017
|
-
}
|
|
2018
|
-
return raw;
|
|
2019
|
-
}
|
|
2020
|
-
function errorCodeFromBody(raw) {
|
|
2021
|
-
try {
|
|
2022
|
-
const body = JSON.parse(raw);
|
|
2023
|
-
return typeof body.error?.code === "string" ? body.error.code : void 0;
|
|
2024
|
-
} catch {
|
|
2025
|
-
return void 0;
|
|
2026
|
-
}
|
|
2027
|
-
}
|
|
2028
|
-
function raiseForStatus(response, body) {
|
|
2029
|
-
if (response.ok) return;
|
|
2030
|
-
const message = messageFromBody(body, response.status);
|
|
2031
|
-
const requestId = response.headers.get("x-request-id") ?? response.headers.get("X-Request-ID") ?? void 0;
|
|
2032
|
-
const headers = headersToRecord(response.headers);
|
|
2033
|
-
const code = errorCodeFromBody(body);
|
|
2034
|
-
const base = { requestId, responseHeaders: headers, body, code };
|
|
2035
|
-
switch (response.status) {
|
|
2036
|
-
case 401:
|
|
2037
|
-
throw new AuthenticationError(message, base);
|
|
2038
|
-
case 403:
|
|
2039
|
-
throw new PermissionDeniedError(message, base);
|
|
2040
|
-
case 404:
|
|
2041
|
-
throw new NotFoundError(message, base);
|
|
2042
|
-
case 409:
|
|
2043
|
-
throw new ConflictError(message, base);
|
|
2044
|
-
case 422: {
|
|
2045
|
-
let errors;
|
|
2046
|
-
try {
|
|
2047
|
-
errors = JSON.parse(body);
|
|
2048
|
-
} catch {
|
|
2049
|
-
errors = void 0;
|
|
2050
|
-
}
|
|
2051
|
-
throw new UnprocessableError(message, { ...base, errors });
|
|
2052
|
-
}
|
|
2053
|
-
case 429: {
|
|
2054
|
-
const retryHeader = response.headers.get("retry-after") ?? "";
|
|
2055
|
-
const retryAfter = /^\d+$/.test(retryHeader) ? Number.parseInt(retryHeader, 10) : void 0;
|
|
2056
|
-
throw new RateLimitError(message, { ...base, retryAfter });
|
|
2057
|
-
}
|
|
2058
|
-
default:
|
|
2059
|
-
if (response.status >= 500) {
|
|
2060
|
-
throw new InternalServerError(message, response.status, base);
|
|
2061
|
-
}
|
|
2062
|
-
throw new ModusError(message, { ...base, statusCode: response.status });
|
|
2063
|
-
}
|
|
2064
|
-
}
|
|
2065
|
-
function wrapNetworkError(error, baseUrl) {
|
|
2066
|
-
const detail = error instanceof Error ? error.message : String(error);
|
|
2067
|
-
return new APIConnectionError(
|
|
2068
|
-
`Network error communicating with Modus API at ${JSON.stringify(baseUrl)}: ${detail}. Check connectivity and that baseUrl is correct.`
|
|
2069
|
-
);
|
|
2070
|
-
}
|
|
2071
|
-
async function readBody(response) {
|
|
2072
|
-
return response.text();
|
|
2073
|
-
}
|
|
2074
|
-
async function readBodyPreview(response, maxChars = 200) {
|
|
2075
|
-
if (!response.body) return "";
|
|
2076
|
-
const reader = response.body.getReader();
|
|
2077
|
-
const decoder = new TextDecoder();
|
|
2078
|
-
let out = "";
|
|
2079
|
-
try {
|
|
2080
|
-
while (out.length < maxChars) {
|
|
2081
|
-
const { done, value } = await reader.read();
|
|
2082
|
-
if (done) break;
|
|
2083
|
-
out += decoder.decode(value, { stream: true });
|
|
2084
|
-
if (out.length >= maxChars) {
|
|
2085
|
-
out = out.slice(0, maxChars);
|
|
2086
|
-
break;
|
|
2087
|
-
}
|
|
2088
|
-
}
|
|
2089
|
-
} finally {
|
|
2090
|
-
await reader.cancel().catch(() => void 0);
|
|
2091
|
-
}
|
|
2092
|
-
return out;
|
|
2093
|
-
}
|
|
2094
|
-
var HttpClient = class {
|
|
2095
|
-
constructor(config) {
|
|
2096
|
-
this.config = config;
|
|
2097
|
-
}
|
|
2098
|
-
defaultHeaders() {
|
|
2099
|
-
return mergeHeaders(
|
|
2100
|
-
{
|
|
2101
|
-
Accept: "application/json",
|
|
2102
|
-
"Content-Type": "application/json",
|
|
2103
|
-
"User-Agent": USER_AGENT,
|
|
2104
|
-
"X-Modus-Client": "sdk"
|
|
2105
|
-
},
|
|
2106
|
-
this.config.defaultHeaders
|
|
2107
|
-
);
|
|
2108
|
-
}
|
|
2109
|
-
async request(method, path, options = {}) {
|
|
2110
|
-
const baseUrl = options.baseUrl ?? this.config.baseUrl;
|
|
2111
|
-
const url = buildUrl(baseUrl, path, options.params);
|
|
2112
|
-
try {
|
|
2113
|
-
const response = await this.config.fetch(url, {
|
|
2114
|
-
method,
|
|
2115
|
-
headers: mergeHeaders(this.defaultHeaders(), options.headers, authHeaders(this.config.apiKey)),
|
|
2116
|
-
body: options.json !== void 0 ? JSON.stringify(options.json) : void 0,
|
|
2117
|
-
signal: AbortSignal.timeout(this.config.timeoutMs)
|
|
2118
|
-
});
|
|
2119
|
-
const body = await readBody(response);
|
|
2120
|
-
raiseForStatus(response, body);
|
|
2121
|
-
if (response.status === 204 || !body) return null;
|
|
2122
|
-
return JSON.parse(body);
|
|
2123
|
-
} catch (error) {
|
|
2124
|
-
if (error instanceof ModusError) throw error;
|
|
2125
|
-
if (error instanceof DOMException && error.name === "AbortError") {
|
|
2126
|
-
throw wrapNetworkError(new Error("Request timed out"), baseUrl);
|
|
2127
|
-
}
|
|
2128
|
-
throw wrapNetworkError(error, baseUrl);
|
|
2129
|
-
}
|
|
2130
|
-
}
|
|
2131
|
-
get(path, params, options = {}) {
|
|
2132
|
-
return this.request("GET", path, { params, ...options });
|
|
2133
|
-
}
|
|
2134
|
-
post(path, json, options = {}) {
|
|
2135
|
-
return this.request("POST", path, { json, ...options });
|
|
2136
|
-
}
|
|
2137
|
-
put(path, json, options = {}) {
|
|
2138
|
-
return this.request("PUT", path, { json, ...options });
|
|
2139
|
-
}
|
|
2140
|
-
patch(path, json, params, options = {}) {
|
|
2141
|
-
return this.request("PATCH", path, { json, params, ...options });
|
|
2142
|
-
}
|
|
2143
|
-
delete(path, options = {}) {
|
|
2144
|
-
return this.request("DELETE", path, options);
|
|
2145
|
-
}
|
|
2146
|
-
async *stream(method, path, options = {}) {
|
|
2147
|
-
const baseUrl = options.baseUrl ?? this.config.baseUrl;
|
|
2148
|
-
const url = buildUrl(baseUrl, path, options.params);
|
|
2149
|
-
try {
|
|
2150
|
-
const response = await this.config.fetch(url, {
|
|
2151
|
-
method,
|
|
2152
|
-
// Agent-service negotiates SSE vs JSON polling on Accept; JSON-only
|
|
2153
|
-
// Accept returns {"runId","status":"pending"} instead of token SSE.
|
|
2154
|
-
headers: mergeHeaders(
|
|
2155
|
-
this.defaultHeaders(),
|
|
2156
|
-
options.headers,
|
|
2157
|
-
{ Accept: "text/event-stream" },
|
|
2158
|
-
authHeaders(this.config.apiKey)
|
|
2159
|
-
),
|
|
2160
|
-
body: options.json !== void 0 ? JSON.stringify(options.json) : void 0,
|
|
2161
|
-
signal: AbortSignal.timeout(this.config.timeoutMs)
|
|
2162
|
-
});
|
|
2163
|
-
if (!response.ok) {
|
|
2164
|
-
const body = await readBody(response);
|
|
2165
|
-
raiseForStatus(response, body);
|
|
2166
|
-
return;
|
|
2167
|
-
}
|
|
2168
|
-
const contentType = response.headers.get("content-type") ?? "";
|
|
2169
|
-
if (!contentType.toLowerCase().includes("text/event-stream")) {
|
|
2170
|
-
const preview = await readBodyPreview(response);
|
|
2171
|
-
throw new ModusError(
|
|
2172
|
-
`Unexpected stream response: expected Content-Type text/event-stream, got ${JSON.stringify(contentType) || "(missing)"}. Body preview: ${preview}`,
|
|
2173
|
-
{ statusCode: response.status, body: preview }
|
|
2174
|
-
);
|
|
2175
|
-
}
|
|
2176
|
-
if (!response.body) return;
|
|
2177
|
-
const reader = response.body.getReader();
|
|
2178
|
-
const decoder = new TextDecoder();
|
|
2179
|
-
let buffer = "";
|
|
2180
|
-
while (true) {
|
|
2181
|
-
const { done, value } = await reader.read();
|
|
2182
|
-
if (done) break;
|
|
2183
|
-
buffer += decoder.decode(value, { stream: true });
|
|
2184
|
-
const lines = buffer.split("\n");
|
|
2185
|
-
buffer = lines.pop() ?? "";
|
|
2186
|
-
for (const line of lines) {
|
|
2187
|
-
if (line.trim()) yield line;
|
|
2188
|
-
}
|
|
2189
|
-
}
|
|
2190
|
-
if (buffer.trim()) yield buffer;
|
|
2191
|
-
} catch (error) {
|
|
2192
|
-
if (error instanceof ModusError) throw error;
|
|
2193
|
-
if (error instanceof DOMException && error.name === "AbortError") {
|
|
2194
|
-
throw wrapNetworkError(new Error("Request timed out"), baseUrl);
|
|
2195
|
-
}
|
|
2196
|
-
throw wrapNetworkError(error, baseUrl);
|
|
2197
|
-
}
|
|
2198
|
-
}
|
|
2199
|
-
streamGet(path, params, options = {}) {
|
|
2200
|
-
return this.stream("GET", path, { params, ...options });
|
|
2201
|
-
}
|
|
2202
|
-
streamPost(path, json, options = {}) {
|
|
2203
|
-
return this.stream("POST", path, { json, ...options });
|
|
2204
|
-
}
|
|
2205
|
-
};
|
|
2206
|
-
|
|
2207
|
-
// src/_client-base.ts
|
|
2208
|
-
var ModusClientBase = class {
|
|
2209
|
-
constructor(options = {}) {
|
|
2210
|
-
this._config = createModusConfig(options);
|
|
2211
|
-
this._http = new HttpClient(this._config);
|
|
2212
|
-
}
|
|
2213
|
-
get config() {
|
|
2214
|
-
return this._config;
|
|
2215
|
-
}
|
|
366
|
+
// src/_generated/resources/consumption/workflows.ts
|
|
367
|
+
var WorkflowsResourceBase = class {
|
|
2216
368
|
/** @internal */
|
|
2217
|
-
|
|
2218
|
-
|
|
369
|
+
constructor(http, config) {
|
|
370
|
+
this.http = http;
|
|
371
|
+
this.config = config;
|
|
2219
372
|
}
|
|
2220
|
-
|
|
2221
|
-
|
|
373
|
+
/**
|
|
374
|
+
* List workflows.
|
|
375
|
+
*
|
|
376
|
+
* Returns a paginated page of workflows the caller can at least `use`. Workflows the caller
|
|
377
|
+
* cannot see are filtered out. Pagination uses an opaque token returned in `nextPageToken`.
|
|
378
|
+
*
|
|
379
|
+
* **Requires:** `workflows:read`
|
|
380
|
+
*
|
|
381
|
+
* @param options.pageSize - Items per page. Defaults to 25.
|
|
382
|
+
* @param options.pageToken - Opaque page token from a previous response's `nextPageToken`. Omit
|
|
383
|
+
* for the first page.
|
|
384
|
+
* @param options.search - Case-insensitive substring filter on workflow name.
|
|
385
|
+
* @param options.type - Filter by workflow type.
|
|
386
|
+
* @param options.view - Variation view. `active` reads the deployed version. `draft` reads the
|
|
387
|
+
* latest builder snapshot. `published` reads only a published workflow of type workflow that
|
|
388
|
+
* you can use; tasks are excluded.
|
|
389
|
+
* @param options.includeVariation - Include the requested variation payload (`trigger`,
|
|
390
|
+
* `workflowStructure`, `agentSelection`) on list rows.
|
|
391
|
+
* @returns A page of workflows.
|
|
392
|
+
*
|
|
393
|
+
* @example
|
|
394
|
+
* ```ts
|
|
395
|
+
* for await (const wf of (await client.workflows.list({ search: 'digest' })).autoPagingIter()) {
|
|
396
|
+
* console.log(wf.id, wf.name, wf.status)
|
|
397
|
+
* }
|
|
398
|
+
* ```
|
|
399
|
+
*/
|
|
400
|
+
list(options = {}) {
|
|
401
|
+
const pageSize = _nullishCoalesce(options.pageSize, () => ( 25));
|
|
402
|
+
_chunkNA3ZD35Tcjs.validatePageSize.call(void 0, pageSize);
|
|
403
|
+
return this.listPage(pageSize, options.pageToken, options.search, options.type, options.view, options.includeVariation);
|
|
2222
404
|
}
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
405
|
+
async listPage(pageSize, pageToken, search, type, view, includeVariation) {
|
|
406
|
+
const extra = {};
|
|
407
|
+
if (search !== void 0) extra.search = search;
|
|
408
|
+
if (type !== void 0) extra.type = type;
|
|
409
|
+
if (view !== void 0) extra.view = view;
|
|
410
|
+
if (includeVariation !== void 0) extra.includeVariation = includeVariation;
|
|
411
|
+
const data = _chunkNA3ZD35Tcjs.asRecord.call(void 0,
|
|
412
|
+
await _chunkNA3ZD35Tcjs.invokeWithRetry.call(void 0, this.config, this.http, "WorkflowsController_list", {
|
|
413
|
+
query: _chunkNA3ZD35Tcjs.aipListParams.call(void 0, pageSize, pageToken, extra)
|
|
414
|
+
})
|
|
415
|
+
);
|
|
416
|
+
return _chunkNA3ZD35Tcjs.buildAipPage.call(void 0,
|
|
417
|
+
data,
|
|
418
|
+
"workflows",
|
|
419
|
+
(raw) => raw,
|
|
420
|
+
(token) => this.listPage(pageSize, token, search, type, view, includeVariation)
|
|
2230
421
|
);
|
|
2231
422
|
}
|
|
2232
|
-
|
|
2233
|
-
}
|
|
2234
|
-
function formatPath(template, pathParams) {
|
|
2235
|
-
return template.split("/").map((segment) => {
|
|
2236
|
-
if (!segment.startsWith("{") || !segment.endsWith("}")) return segment;
|
|
2237
|
-
const key = segment.slice(1, -1);
|
|
2238
|
-
if (!(key in pathParams)) {
|
|
2239
|
-
throw new Error(`Missing path parameter ${JSON.stringify(key)} for ${JSON.stringify(template)}`);
|
|
2240
|
-
}
|
|
2241
|
-
return encodeURIComponent(String(pathParams[key]));
|
|
2242
|
-
}).join("/");
|
|
2243
|
-
}
|
|
2244
|
-
function operationBaseUrl(http, operation) {
|
|
2245
|
-
return resolveServiceBaseUrl(http.config, operation.service, operation.serverUrl);
|
|
2246
|
-
}
|
|
2247
|
-
function formatOperationPath(operationId, pathParams = {}) {
|
|
2248
|
-
return formatPath(getOperation(operationId).path, pathParams);
|
|
2249
|
-
}
|
|
2250
|
-
async function invokeOperation(http, operationId, options = {}) {
|
|
2251
|
-
const op = getOperation(operationId);
|
|
2252
|
-
const path = formatPath(op.path, options.pathParams ?? {});
|
|
2253
|
-
const params = options.query;
|
|
2254
|
-
const requestOptions = {
|
|
2255
|
-
baseUrl: operationBaseUrl(http, op),
|
|
2256
|
-
headers: options.headers
|
|
2257
|
-
};
|
|
2258
|
-
switch (op.method) {
|
|
2259
|
-
case "GET":
|
|
2260
|
-
return http.get(path, params, requestOptions);
|
|
2261
|
-
case "POST":
|
|
2262
|
-
return http.post(path, options.jsonBody, requestOptions);
|
|
2263
|
-
case "PUT":
|
|
2264
|
-
return http.put(path, options.jsonBody, requestOptions);
|
|
2265
|
-
case "PATCH":
|
|
2266
|
-
return http.patch(path, options.jsonBody, params, requestOptions);
|
|
2267
|
-
case "DELETE":
|
|
2268
|
-
return http.delete(path, requestOptions);
|
|
2269
|
-
default:
|
|
2270
|
-
throw new Error(`Unsupported HTTP method ${JSON.stringify(op.method)}`);
|
|
2271
|
-
}
|
|
2272
|
-
}
|
|
2273
|
-
|
|
2274
|
-
// src/_retry.ts
|
|
2275
|
-
var DEPLOY_NOT_FOUND_BACKOFF_MS = 500;
|
|
2276
|
-
var MAX_DEPLOY_NOT_FOUND_RETRIES = 1;
|
|
2277
|
-
var RETRYABLE = [RateLimitError, InternalServerError, APIConnectionError];
|
|
2278
|
-
function isRetryable(error) {
|
|
2279
|
-
return RETRYABLE.some((Cls) => error instanceof Cls);
|
|
2280
|
-
}
|
|
2281
|
-
function backoffSeconds(attempt, error) {
|
|
2282
|
-
if (error instanceof RateLimitError && error.retryAfter !== void 0) {
|
|
2283
|
-
return Math.max(0, error.retryAfter);
|
|
2284
|
-
}
|
|
2285
|
-
if (attempt === 0) return 0;
|
|
2286
|
-
return Math.max(0.5, 2 ** (attempt - 1) + (Math.random() * 0.6 - 0.3));
|
|
2287
|
-
}
|
|
2288
|
-
function sleep(ms) {
|
|
2289
|
-
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
2290
|
-
}
|
|
2291
|
-
async function withRetry(fn, maxRetries, options = {}) {
|
|
2292
|
-
let deployNotFoundRetries = 0;
|
|
2293
|
-
let attempt = 0;
|
|
2294
|
-
while (true) {
|
|
2295
|
-
try {
|
|
2296
|
-
return await fn();
|
|
2297
|
-
} catch (error) {
|
|
2298
|
-
if (options.retryNotFoundOnDeploy && error instanceof NotFoundError && deployNotFoundRetries < MAX_DEPLOY_NOT_FOUND_RETRIES) {
|
|
2299
|
-
deployNotFoundRetries++;
|
|
2300
|
-
await sleep(DEPLOY_NOT_FOUND_BACKOFF_MS);
|
|
2301
|
-
continue;
|
|
2302
|
-
}
|
|
2303
|
-
if (!isRetryable(error) || attempt >= maxRetries) throw error;
|
|
2304
|
-
await sleep(backoffSeconds(attempt, error) * 1e3);
|
|
2305
|
-
attempt++;
|
|
2306
|
-
}
|
|
2307
|
-
}
|
|
2308
|
-
}
|
|
2309
|
-
|
|
2310
|
-
// src/_request.ts
|
|
2311
|
-
async function invokeWithRetry(config, http, operationId, options = {}) {
|
|
2312
|
-
if (options.jsonBody !== void 0) {
|
|
2313
|
-
assertWriteBodyKeys(operationId, options.jsonBody);
|
|
2314
|
-
}
|
|
2315
|
-
return withRetry(() => invokeOperation(http, operationId, options), config.maxRetries, {
|
|
2316
|
-
retryNotFoundOnDeploy: operationId.endsWith("_deploy")
|
|
2317
|
-
});
|
|
2318
|
-
}
|
|
2319
|
-
function omitUndefined(obj) {
|
|
2320
|
-
return Object.fromEntries(
|
|
2321
|
-
Object.entries(obj).filter((entry) => entry[1] !== void 0)
|
|
2322
|
-
);
|
|
2323
|
-
}
|
|
2324
|
-
function asRecord(data) {
|
|
2325
|
-
if (typeof data === "object" && data !== null && !Array.isArray(data)) {
|
|
2326
|
-
return data;
|
|
2327
|
-
}
|
|
2328
|
-
throw new Error(`Expected object response, got ${typeof data}`);
|
|
2329
|
-
}
|
|
423
|
+
};
|
|
2330
424
|
|
|
2331
425
|
// src/resources/workflows/runs.ts
|
|
2332
|
-
|
|
426
|
+
|
|
2333
427
|
var RUNS_MAX_PAGE_SIZE = 100;
|
|
2334
428
|
function runsListParams(pageSize, pageToken, status, timeframe, approvalScope, search) {
|
|
2335
429
|
const params = { pageSize };
|
|
2336
|
-
const token = normalizePageToken(pageToken);
|
|
430
|
+
const token = _chunkNA3ZD35Tcjs.normalizePageToken.call(void 0, pageToken);
|
|
2337
431
|
if (token !== void 0) params.pageToken = token;
|
|
2338
432
|
if (status !== void 0) params.status = status;
|
|
2339
433
|
if (timeframe !== void 0) params.timeframe = timeframe;
|
|
@@ -2343,7 +437,7 @@ function runsListParams(pageSize, pageToken, status, timeframe, approvalScope, s
|
|
|
2343
437
|
}
|
|
2344
438
|
function activeRunsParams(pageSize, pageToken) {
|
|
2345
439
|
const params = { pageSize };
|
|
2346
|
-
const token = normalizePageToken(pageToken);
|
|
440
|
+
const token = _chunkNA3ZD35Tcjs.normalizePageToken.call(void 0, pageToken);
|
|
2347
441
|
if (token !== void 0) params.pageToken = token;
|
|
2348
442
|
return params;
|
|
2349
443
|
}
|
|
@@ -2351,37 +445,42 @@ function parseRun(raw) {
|
|
|
2351
445
|
return raw;
|
|
2352
446
|
}
|
|
2353
447
|
function parseActiveRunsArray(raw) {
|
|
2354
|
-
const data = asRecord(raw);
|
|
448
|
+
const data = _chunkNA3ZD35Tcjs.asRecord.call(void 0, raw);
|
|
2355
449
|
const runs = data.runs;
|
|
2356
450
|
if (!Array.isArray(runs)) {
|
|
2357
|
-
throw new ModusError(
|
|
451
|
+
throw new (0, _chunkNA3ZD35Tcjs.ModusError)(
|
|
2358
452
|
`Unexpected active runs response shape: runs must be a list, got ${typeof runs}.`
|
|
2359
453
|
);
|
|
2360
454
|
}
|
|
2361
455
|
return runs;
|
|
2362
456
|
}
|
|
2363
457
|
function parseActiveRunsPage(raw, fetchPage) {
|
|
2364
|
-
const data = asRecord(raw);
|
|
458
|
+
const data = _chunkNA3ZD35Tcjs.asRecord.call(void 0, raw);
|
|
2365
459
|
const runs = data.runs;
|
|
2366
460
|
if (!Array.isArray(runs)) {
|
|
2367
|
-
throw new ModusError(
|
|
461
|
+
throw new (0, _chunkNA3ZD35Tcjs.ModusError)(
|
|
2368
462
|
`Unexpected active runs response shape: runs must be a list, got ${typeof runs}.`
|
|
2369
463
|
);
|
|
2370
464
|
}
|
|
2371
|
-
return new Page(
|
|
465
|
+
return new (0, _chunkNA3ZD35Tcjs.Page)(
|
|
2372
466
|
runs,
|
|
2373
|
-
normalizePageToken(
|
|
467
|
+
_chunkNA3ZD35Tcjs.normalizePageToken.call(void 0,
|
|
2374
468
|
typeof data.nextPageToken === "string" ? data.nextPageToken : void 0
|
|
2375
469
|
),
|
|
2376
470
|
fetchPage
|
|
2377
471
|
);
|
|
2378
472
|
}
|
|
2379
473
|
function randomRunId() {
|
|
2380
|
-
return (0,
|
|
474
|
+
return _crypto.randomUUID.call(void 0, );
|
|
2381
475
|
}
|
|
2382
476
|
function sessionIdFromBody(body) {
|
|
2383
477
|
return resolveAgentRunSessionId(body.sessionId);
|
|
2384
478
|
}
|
|
479
|
+
function requireSessionId(sessionId) {
|
|
480
|
+
if (!_optionalChain([sessionId, 'optionalAccess', _4 => _4.trim, 'call', _5 => _5()])) {
|
|
481
|
+
throw new (0, _chunkNA3ZD35Tcjs.ValidationError)("sessionId must be the run's conversation id (a non-empty string)");
|
|
482
|
+
}
|
|
483
|
+
}
|
|
2385
484
|
function makeAgentRunStream(runId, events) {
|
|
2386
485
|
return {
|
|
2387
486
|
runId,
|
|
@@ -2400,7 +499,7 @@ var WorkflowRunsResource = class {
|
|
|
2400
499
|
/**
|
|
2401
500
|
* List runs for a workflow.
|
|
2402
501
|
*
|
|
2403
|
-
* @param workflowId -
|
|
502
|
+
* @param workflowId - Numeric workflow id.
|
|
2404
503
|
* @param options.pageSize - Maximum items per page (default 25, max 100).
|
|
2405
504
|
* @param options.pageToken - Opaque token from a previous page.
|
|
2406
505
|
* @param options.status - Filter by run status.
|
|
@@ -2419,14 +518,14 @@ var WorkflowRunsResource = class {
|
|
|
2419
518
|
* ```
|
|
2420
519
|
*/
|
|
2421
520
|
list(workflowId, options = {}) {
|
|
2422
|
-
validateId(workflowId, "workflow_id");
|
|
2423
|
-
const pageSize = options.pageSize
|
|
2424
|
-
validatePageSize(pageSize, RUNS_MAX_PAGE_SIZE);
|
|
521
|
+
_chunkNA3ZD35Tcjs.validateId.call(void 0, workflowId, "workflow_id");
|
|
522
|
+
const pageSize = _nullishCoalesce(options.pageSize, () => ( 25));
|
|
523
|
+
_chunkNA3ZD35Tcjs.validatePageSize.call(void 0, pageSize, RUNS_MAX_PAGE_SIZE);
|
|
2425
524
|
return this.listPage(workflowId, pageSize, options.pageToken, options);
|
|
2426
525
|
}
|
|
2427
526
|
async listPage(workflowId, pageSize, pageToken, filters) {
|
|
2428
|
-
const data = asRecord(
|
|
2429
|
-
await invokeWithRetry(this.config, this.http, "WorkflowRunsController_list", {
|
|
527
|
+
const data = _chunkNA3ZD35Tcjs.asRecord.call(void 0,
|
|
528
|
+
await _chunkNA3ZD35Tcjs.invokeWithRetry.call(void 0, this.config, this.http, "WorkflowRunsController_list", {
|
|
2430
529
|
pathParams: { id: workflowId },
|
|
2431
530
|
query: runsListParams(
|
|
2432
531
|
pageSize,
|
|
@@ -2440,13 +539,13 @@ var WorkflowRunsResource = class {
|
|
|
2440
539
|
);
|
|
2441
540
|
const runs = data.runs;
|
|
2442
541
|
if (!Array.isArray(runs)) {
|
|
2443
|
-
throw new ModusError(
|
|
542
|
+
throw new (0, _chunkNA3ZD35Tcjs.ModusError)(
|
|
2444
543
|
`Unexpected list response shape: runs must be a list, got ${typeof runs}.`
|
|
2445
544
|
);
|
|
2446
545
|
}
|
|
2447
|
-
return new Page(
|
|
546
|
+
return new (0, _chunkNA3ZD35Tcjs.Page)(
|
|
2448
547
|
runs,
|
|
2449
|
-
normalizePageToken(
|
|
548
|
+
_chunkNA3ZD35Tcjs.normalizePageToken.call(void 0,
|
|
2450
549
|
typeof data.nextPageToken === "string" ? data.nextPageToken : void 0
|
|
2451
550
|
),
|
|
2452
551
|
(token) => this.listPage(workflowId, pageSize, token, filters)
|
|
@@ -2455,7 +554,7 @@ var WorkflowRunsResource = class {
|
|
|
2455
554
|
/**
|
|
2456
555
|
* Retrieve a workflow run by id.
|
|
2457
556
|
*
|
|
2458
|
-
* @param workflowId -
|
|
557
|
+
* @param workflowId - Numeric workflow id the run belongs to.
|
|
2459
558
|
* @param runId - Run id (the list row's `workflowId` field, not the composite `id`).
|
|
2460
559
|
* @param options.temporalRunId - Optional internal execution id when disambiguating retries.
|
|
2461
560
|
* @returns Run details including status and output.
|
|
@@ -2468,10 +567,10 @@ var WorkflowRunsResource = class {
|
|
|
2468
567
|
* ```
|
|
2469
568
|
*/
|
|
2470
569
|
async get(workflowId, runId, options = {}) {
|
|
2471
|
-
validateId(workflowId, "workflow_id");
|
|
2472
|
-
if (!runId.trim()) throw new
|
|
570
|
+
_chunkNA3ZD35Tcjs.validateId.call(void 0, workflowId, "workflow_id");
|
|
571
|
+
if (!runId.trim()) throw new (0, _chunkNA3ZD35Tcjs.ValidationError)("run_id must be a non-empty string");
|
|
2473
572
|
const query = options.temporalRunId !== void 0 ? { temporalRunId: options.temporalRunId } : void 0;
|
|
2474
|
-
const data = await invokeWithRetry(this.config, this.http, "WorkflowRunsController_get", {
|
|
573
|
+
const data = await _chunkNA3ZD35Tcjs.invokeWithRetry.call(void 0, this.config, this.http, "WorkflowRunsController_get", {
|
|
2475
574
|
pathParams: { id: workflowId, runId },
|
|
2476
575
|
query
|
|
2477
576
|
});
|
|
@@ -2480,7 +579,7 @@ var WorkflowRunsResource = class {
|
|
|
2480
579
|
/**
|
|
2481
580
|
* Start a workflow run and stream run events.
|
|
2482
581
|
*
|
|
2483
|
-
* @param workflowId -
|
|
582
|
+
* @param workflowId - Numeric workflow id to run.
|
|
2484
583
|
* @param body - Run body (`message`, optional `sessionId`, optional `version` as `published` or `draft`).
|
|
2485
584
|
* @param options.idempotencyKey - Client-supplied idempotency key; defaults to `body.runId` or a new uuid.
|
|
2486
585
|
* @returns A stream of run events (tokens, completion, errors, and related signals).
|
|
@@ -2498,7 +597,7 @@ var WorkflowRunsResource = class {
|
|
|
2498
597
|
* ```
|
|
2499
598
|
*/
|
|
2500
599
|
create(workflowId, body, options = {}) {
|
|
2501
|
-
validateId(workflowId, "workflow_id");
|
|
600
|
+
_chunkNA3ZD35Tcjs.validateId.call(void 0, workflowId, "workflow_id");
|
|
2502
601
|
return this.createRun("WorkflowRunsController_create", body, { id: workflowId }, options);
|
|
2503
602
|
}
|
|
2504
603
|
/**
|
|
@@ -2523,7 +622,7 @@ var WorkflowRunsResource = class {
|
|
|
2523
622
|
* ```
|
|
2524
623
|
*/
|
|
2525
624
|
createScope(scopeId, body, options = {}) {
|
|
2526
|
-
validateId(scopeId, "scope_id");
|
|
625
|
+
_chunkNA3ZD35Tcjs.validateId.call(void 0, scopeId, "scope_id");
|
|
2527
626
|
return this.createRun("ScopeRunsController_create", body, { id: scopeId }, options);
|
|
2528
627
|
}
|
|
2529
628
|
/**
|
|
@@ -2548,18 +647,21 @@ var WorkflowRunsResource = class {
|
|
|
2548
647
|
return this.createRun("ModusRunsController_create", body, {}, options);
|
|
2549
648
|
}
|
|
2550
649
|
/**
|
|
2551
|
-
* Resume an
|
|
650
|
+
* Resume a run paused at an approval or connect interrupt, and stream the continuation's events.
|
|
2552
651
|
*
|
|
2553
|
-
*
|
|
2554
|
-
*
|
|
652
|
+
* The decision is the whole turn: send no `message` (a non-empty one is rejected).
|
|
653
|
+
*
|
|
654
|
+
* @param runId - Id of the interrupted run.
|
|
655
|
+
* @param body - `sessionId` (the run's conversation id, required) and `decision`
|
|
656
|
+
* (`approve` / `deny` / `connected` / `cancelled`); optional `approvalTarget`.
|
|
2555
657
|
* @param options.idempotencyKey - Client-supplied idempotency key; defaults to `body.runId` or a new uuid.
|
|
2556
658
|
* @returns A stream of run events.
|
|
659
|
+
* @throws {ValidationError} When `sessionId` is blank, before any request is sent.
|
|
2557
660
|
*
|
|
2558
661
|
* @example
|
|
2559
662
|
* ```ts
|
|
2560
663
|
* const stream = client.workflows.runs.resume(runId, {
|
|
2561
664
|
* decision: 'approve',
|
|
2562
|
-
* message: 'Looks good — continue.',
|
|
2563
665
|
* sessionId,
|
|
2564
666
|
* })
|
|
2565
667
|
* for await (const event of stream) {
|
|
@@ -2568,7 +670,8 @@ var WorkflowRunsResource = class {
|
|
|
2568
670
|
* ```
|
|
2569
671
|
*/
|
|
2570
672
|
resume(runId, body, options = {}) {
|
|
2571
|
-
validateId(runId, "run_id");
|
|
673
|
+
_chunkNA3ZD35Tcjs.validateId.call(void 0, runId, "run_id");
|
|
674
|
+
requireSessionId(body.sessionId);
|
|
2572
675
|
return this.createRun("ResumeRunsController_create", body, { runId }, options);
|
|
2573
676
|
}
|
|
2574
677
|
/**
|
|
@@ -2582,46 +685,86 @@ var WorkflowRunsResource = class {
|
|
|
2582
685
|
* ```
|
|
2583
686
|
*/
|
|
2584
687
|
async cancel(runId) {
|
|
2585
|
-
validateId(runId, "run_id");
|
|
2586
|
-
await invokeWithRetry(this.config, this.http, "RunLifecycleController_cancel", {
|
|
688
|
+
_chunkNA3ZD35Tcjs.validateId.call(void 0, runId, "run_id");
|
|
689
|
+
await _chunkNA3ZD35Tcjs.invokeWithRetry.call(void 0, this.config, this.http, "RunLifecycleController_cancel", {
|
|
2587
690
|
pathParams: { runId },
|
|
2588
691
|
jsonBody: {}
|
|
2589
692
|
});
|
|
2590
693
|
}
|
|
2591
694
|
/**
|
|
2592
|
-
*
|
|
695
|
+
* Poll a run's buffered events once (the JSON transport, not SSE).
|
|
2593
696
|
*
|
|
2594
697
|
* @param runId - Run id.
|
|
2595
|
-
* @returns
|
|
698
|
+
* @returns The poll response: `events` (each with its stream `id` and `type`), `cursor`,
|
|
699
|
+
* `status` and `done`.
|
|
2596
700
|
*/
|
|
2597
701
|
async events(runId) {
|
|
2598
|
-
validateId(runId, "run_id");
|
|
2599
|
-
return invokeWithRetry(this.config, this.http, "RunLifecycleController_events", {
|
|
702
|
+
_chunkNA3ZD35Tcjs.validateId.call(void 0, runId, "run_id");
|
|
703
|
+
return await _chunkNA3ZD35Tcjs.invokeWithRetry.call(void 0, this.config, this.http, "RunLifecycleController_events", {
|
|
2600
704
|
pathParams: { runId }
|
|
2601
705
|
});
|
|
2602
706
|
}
|
|
2603
707
|
/**
|
|
2604
|
-
*
|
|
708
|
+
* Supersede a run's current turn with a follow-up turn.
|
|
709
|
+
*
|
|
710
|
+
* The run is cancelled and `nextRun` starts as a new run on the same conversation.
|
|
711
|
+
* On a run that has already finished nothing is cancelled, and `nextRun` simply
|
|
712
|
+
* starts a follow-up turn. `nextRun.runId` is pinned (a new uuid when you do not
|
|
713
|
+
* set one), so a retried request returns the same run instead of starting another.
|
|
2605
714
|
*
|
|
2606
715
|
* @param runId - Run id to interrupt.
|
|
716
|
+
* @param nextRun - The follow-up turn: `message` and `sessionId` (the run's conversation id).
|
|
717
|
+
* @param options.lastSeenEventId - Id of the last event you rendered, so the cancelled
|
|
718
|
+
* turn's saved output stops there.
|
|
719
|
+
* @returns The new run (`runId`, `status`); follow it with {@link stream}.
|
|
720
|
+
* @throws {ValidationError} When `nextRun.sessionId` is blank, before any request is sent.
|
|
721
|
+
*
|
|
722
|
+
* @example
|
|
723
|
+
* ```ts
|
|
724
|
+
* const { runId: nextRunId } = await client.workflows.runs.interrupt(runId, {
|
|
725
|
+
* message: 'Only count EMEA.',
|
|
726
|
+
* sessionId,
|
|
727
|
+
* })
|
|
728
|
+
* for await (const event of client.workflows.runs.stream(nextRunId)) {
|
|
729
|
+
* if (event.type === 'token') process.stdout.write(event.content)
|
|
730
|
+
* }
|
|
731
|
+
* ```
|
|
2607
732
|
*/
|
|
2608
|
-
async interrupt(runId) {
|
|
2609
|
-
validateId(runId, "run_id");
|
|
2610
|
-
|
|
733
|
+
async interrupt(runId, nextRun, options = {}) {
|
|
734
|
+
_chunkNA3ZD35Tcjs.validateId.call(void 0, runId, "run_id");
|
|
735
|
+
requireSessionId(nextRun.sessionId);
|
|
736
|
+
const jsonBody = {
|
|
737
|
+
nextRun: { ...nextRun, runId: _optionalChain([nextRun, 'access', _6 => _6.runId, 'optionalAccess', _7 => _7.trim, 'call', _8 => _8()]) || randomRunId() },
|
|
738
|
+
...options.lastSeenEventId ? { lastSeenEventId: options.lastSeenEventId } : {}
|
|
739
|
+
};
|
|
740
|
+
return await _chunkNA3ZD35Tcjs.invokeWithRetry.call(void 0, this.config, this.http, "RunLifecycleController_interrupt", {
|
|
2611
741
|
pathParams: { runId },
|
|
2612
|
-
jsonBody
|
|
742
|
+
jsonBody
|
|
2613
743
|
});
|
|
2614
744
|
}
|
|
2615
745
|
/**
|
|
2616
|
-
*
|
|
746
|
+
* Replace the turn of a run that is still queued (not yet started).
|
|
2617
747
|
*
|
|
2618
748
|
* @param runId - Queued run id.
|
|
749
|
+
* @param nextRun - The replacement turn: `message` and `sessionId` (the run's conversation id).
|
|
750
|
+
* @returns The edited run (`runId`, `status`).
|
|
751
|
+
* @throws {ValidationError} When `nextRun.sessionId` is blank, before any request is sent.
|
|
752
|
+
* @throws {ConflictError} When the run has already started.
|
|
753
|
+
*
|
|
754
|
+
* @example
|
|
755
|
+
* ```ts
|
|
756
|
+
* await client.workflows.runs.editQueued(queuedRunId, {
|
|
757
|
+
* message: 'Summarize last week instead.',
|
|
758
|
+
* sessionId,
|
|
759
|
+
* })
|
|
760
|
+
* ```
|
|
2619
761
|
*/
|
|
2620
|
-
async editQueued(runId) {
|
|
2621
|
-
validateId(runId, "run_id");
|
|
2622
|
-
|
|
762
|
+
async editQueued(runId, nextRun) {
|
|
763
|
+
_chunkNA3ZD35Tcjs.validateId.call(void 0, runId, "run_id");
|
|
764
|
+
requireSessionId(nextRun.sessionId);
|
|
765
|
+
return await _chunkNA3ZD35Tcjs.invokeWithRetry.call(void 0, this.config, this.http, "RunLifecycleController_editQueued", {
|
|
2623
766
|
pathParams: { runId },
|
|
2624
|
-
jsonBody: {}
|
|
767
|
+
jsonBody: { nextRun }
|
|
2625
768
|
});
|
|
2626
769
|
}
|
|
2627
770
|
/**
|
|
@@ -2632,13 +775,13 @@ var WorkflowRunsResource = class {
|
|
|
2632
775
|
* @returns A page of active runs with session and status metadata.
|
|
2633
776
|
*/
|
|
2634
777
|
active(options = {}) {
|
|
2635
|
-
const pageSize = options.pageSize
|
|
2636
|
-
validatePageSize(pageSize, RUNS_MAX_PAGE_SIZE);
|
|
778
|
+
const pageSize = _nullishCoalesce(options.pageSize, () => ( 50));
|
|
779
|
+
_chunkNA3ZD35Tcjs.validatePageSize.call(void 0, pageSize, RUNS_MAX_PAGE_SIZE);
|
|
2637
780
|
return this.activePage(pageSize, options.pageToken);
|
|
2638
781
|
}
|
|
2639
782
|
async activePage(pageSize, pageToken) {
|
|
2640
783
|
return parseActiveRunsPage(
|
|
2641
|
-
await invokeWithRetry(this.config, this.http, "RunLifecycleController_active", {
|
|
784
|
+
await _chunkNA3ZD35Tcjs.invokeWithRetry.call(void 0, this.config, this.http, "RunLifecycleController_active", {
|
|
2642
785
|
query: activeRunsParams(pageSize, pageToken)
|
|
2643
786
|
}),
|
|
2644
787
|
(token) => this.activePage(pageSize, token)
|
|
@@ -2649,55 +792,57 @@ var WorkflowRunsResource = class {
|
|
|
2649
792
|
*
|
|
2650
793
|
* @param sessionIds - Up to 100 session ids.
|
|
2651
794
|
* @returns Active runs matching any of the given sessions.
|
|
2652
|
-
* @throws {
|
|
795
|
+
* @throws {ValidationError} When more than 100 session ids are provided.
|
|
2653
796
|
*/
|
|
2654
797
|
async activeBySession(sessionIds) {
|
|
2655
798
|
const uniqueSessionIds = [...new Set(sessionIds.map((id) => id.trim()).filter(Boolean))];
|
|
2656
799
|
if (uniqueSessionIds.length > 100) {
|
|
2657
|
-
throw new
|
|
800
|
+
throw new (0, _chunkNA3ZD35Tcjs.ValidationError)("sessionIds must contain at most 100 ids");
|
|
2658
801
|
}
|
|
2659
802
|
return parseActiveRunsArray(
|
|
2660
|
-
await invokeWithRetry(this.config, this.http, "RunLifecycleController_activeBySession", {
|
|
803
|
+
await _chunkNA3ZD35Tcjs.invokeWithRetry.call(void 0, this.config, this.http, "RunLifecycleController_activeBySession", {
|
|
2661
804
|
jsonBody: { sessionIds: uniqueSessionIds }
|
|
2662
805
|
})
|
|
2663
806
|
);
|
|
2664
807
|
}
|
|
2665
808
|
/**
|
|
2666
|
-
* Reconnect to
|
|
809
|
+
* Reconnect to a run and stream its events.
|
|
2667
810
|
*
|
|
2668
811
|
* @param runId - Run id to follow.
|
|
2669
|
-
* @param options.lastEventId -
|
|
2670
|
-
*
|
|
812
|
+
* @param options.lastEventId - The `id` of the last event you handled; the stream resumes
|
|
813
|
+
* after it. Omit to replay the run from its first event.
|
|
814
|
+
* @returns A stream of run events.
|
|
2671
815
|
*
|
|
2672
816
|
* @example
|
|
2673
817
|
* ```ts
|
|
2674
|
-
*
|
|
2675
|
-
* for await (const event of stream) {
|
|
818
|
+
* let lastEventId: string | undefined
|
|
819
|
+
* for await (const event of client.workflows.runs.stream(runId, { lastEventId })) {
|
|
2676
820
|
* if (event.type === 'token') process.stdout.write(event.content)
|
|
821
|
+
* lastEventId = event.id // after handling it: reconnect with it if the connection drops
|
|
2677
822
|
* }
|
|
2678
823
|
* ```
|
|
2679
824
|
*/
|
|
2680
825
|
stream(runId, options = {}) {
|
|
2681
|
-
validateId(runId, "run_id");
|
|
2682
|
-
const op = getOperation("RunLifecycleController_stream");
|
|
2683
|
-
const path = formatOperationPath("RunLifecycleController_stream", { runId });
|
|
826
|
+
_chunkNA3ZD35Tcjs.validateId.call(void 0, runId, "run_id");
|
|
827
|
+
const op = _chunkNA3ZD35Tcjs.getOperation.call(void 0, "RunLifecycleController_stream");
|
|
828
|
+
const path = _chunkNA3ZD35Tcjs.formatOperationPath.call(void 0, "RunLifecycleController_stream", { runId });
|
|
2684
829
|
const lines = this.http.streamGet(path, void 0, {
|
|
2685
|
-
baseUrl: operationBaseUrl(this.http, op),
|
|
830
|
+
baseUrl: _chunkNA3ZD35Tcjs.operationBaseUrl.call(void 0, this.http, op),
|
|
2686
831
|
headers: options.lastEventId ? { "Last-Event-ID": options.lastEventId } : void 0
|
|
2687
832
|
});
|
|
2688
833
|
return makeAgentRunStream(runId, this.parseEvents(lines));
|
|
2689
834
|
}
|
|
2690
835
|
createRun(operationId, body, pathParams, options) {
|
|
2691
|
-
const runId = options.idempotencyKey
|
|
836
|
+
const runId = _optionalChain([options, 'access', _9 => _9.idempotencyKey, 'optionalAccess', _10 => _10.trim, 'call', _11 => _11()]) || _optionalChain([body, 'access', _12 => _12.runId, 'optionalAccess', _13 => _13.trim, 'call', _14 => _14()]) || randomRunId();
|
|
2692
837
|
const sessionId = sessionIdFromBody(body);
|
|
2693
|
-
const op = getOperation(operationId);
|
|
2694
|
-
const path = formatOperationPath(operationId, pathParams);
|
|
838
|
+
const op = _chunkNA3ZD35Tcjs.getOperation.call(void 0, operationId);
|
|
839
|
+
const path = _chunkNA3ZD35Tcjs.formatOperationPath.call(void 0, operationId, pathParams);
|
|
2695
840
|
const lines = this.http.streamPost(path, {
|
|
2696
841
|
...body,
|
|
2697
842
|
sessionId,
|
|
2698
843
|
streamProtocolVersion: 2
|
|
2699
844
|
}, {
|
|
2700
|
-
baseUrl: operationBaseUrl(this.http, op),
|
|
845
|
+
baseUrl: _chunkNA3ZD35Tcjs.operationBaseUrl.call(void 0, this.http, op),
|
|
2701
846
|
headers: { "Idempotency-Key": runId }
|
|
2702
847
|
});
|
|
2703
848
|
return makeAgentRunStream(runId, this.parseEvents(lines));
|
|
@@ -2708,9 +853,9 @@ var WorkflowRunsResource = class {
|
|
|
2708
853
|
};
|
|
2709
854
|
|
|
2710
855
|
// src/resources/workflows/workflow-actions.ts
|
|
2711
|
-
|
|
856
|
+
|
|
2712
857
|
function randomRunId2() {
|
|
2713
|
-
return (0,
|
|
858
|
+
return _crypto.randomUUID.call(void 0, );
|
|
2714
859
|
}
|
|
2715
860
|
var AgentWorkflowActionsResource = class {
|
|
2716
861
|
/** @internal */
|
|
@@ -2726,11 +871,11 @@ var AgentWorkflowActionsResource = class {
|
|
|
2726
871
|
* @returns A stream of run events for the action execution.
|
|
2727
872
|
*/
|
|
2728
873
|
execute(body, options = {}) {
|
|
2729
|
-
const runId = options.idempotencyKey
|
|
2730
|
-
const op = getOperation("WorkflowActionsController_execute");
|
|
2731
|
-
const path = formatOperationPath("WorkflowActionsController_execute");
|
|
874
|
+
const runId = _optionalChain([options, 'access', _15 => _15.idempotencyKey, 'optionalAccess', _16 => _16.trim, 'call', _17 => _17()]) || _optionalChain([body, 'access', _18 => _18.runId, 'optionalAccess', _19 => _19.trim, 'call', _20 => _20()]) || randomRunId2();
|
|
875
|
+
const op = _chunkNA3ZD35Tcjs.getOperation.call(void 0, "WorkflowActionsController_execute");
|
|
876
|
+
const path = _chunkNA3ZD35Tcjs.formatOperationPath.call(void 0, "WorkflowActionsController_execute");
|
|
2732
877
|
const lines = this.http.streamPost(path, body, {
|
|
2733
|
-
baseUrl: operationBaseUrl(this.http, op),
|
|
878
|
+
baseUrl: _chunkNA3ZD35Tcjs.operationBaseUrl.call(void 0, this.http, op),
|
|
2734
879
|
headers: { "Idempotency-Key": runId }
|
|
2735
880
|
});
|
|
2736
881
|
return makeAgentRunStream(runId, this.parseEvents(lines));
|
|
@@ -2741,8 +886,8 @@ var AgentWorkflowActionsResource = class {
|
|
|
2741
886
|
* @param runId - Action run id to cancel.
|
|
2742
887
|
*/
|
|
2743
888
|
async cancel(runId) {
|
|
2744
|
-
validateId(runId, "run_id");
|
|
2745
|
-
await invokeWithRetry(this.config, this.http, "WorkflowActionsController_cancel", {
|
|
889
|
+
_chunkNA3ZD35Tcjs.validateId.call(void 0, runId, "run_id");
|
|
890
|
+
await _chunkNA3ZD35Tcjs.invokeWithRetry.call(void 0, this.config, this.http, "WorkflowActionsController_cancel", {
|
|
2746
891
|
pathParams: { runId },
|
|
2747
892
|
jsonBody: {}
|
|
2748
893
|
});
|
|
@@ -2753,146 +898,116 @@ var AgentWorkflowActionsResource = class {
|
|
|
2753
898
|
};
|
|
2754
899
|
|
|
2755
900
|
// src/resources/workflows.ts
|
|
2756
|
-
function workflowsListParams(pageSize, pageToken, search, type, view, includeVariation) {
|
|
2757
|
-
const extra = {};
|
|
2758
|
-
if (search !== void 0) extra.search = search;
|
|
2759
|
-
if (type !== void 0) extra.type = type;
|
|
2760
|
-
if (view !== void 0) extra.view = view;
|
|
2761
|
-
if (includeVariation !== void 0) extra.includeVariation = includeVariation;
|
|
2762
|
-
return aipListParams(pageSize, pageToken, extra);
|
|
2763
|
-
}
|
|
2764
901
|
function parseWorkflow(raw) {
|
|
2765
902
|
return raw;
|
|
2766
903
|
}
|
|
2767
|
-
var WorkflowsResource = class {
|
|
904
|
+
var WorkflowsResource = class extends WorkflowsResourceBase {
|
|
2768
905
|
/** @internal */
|
|
2769
906
|
constructor(http, config) {
|
|
2770
|
-
|
|
2771
|
-
this.config = config;
|
|
907
|
+
super(http, config);
|
|
2772
908
|
this.runs = new WorkflowRunsResource(http, config);
|
|
2773
909
|
this.workflowActions = new AgentWorkflowActionsResource(http, config);
|
|
2774
910
|
}
|
|
2775
911
|
/**
|
|
2776
|
-
*
|
|
2777
|
-
*
|
|
2778
|
-
* @param options.pageSize - Maximum items per page (default 25).
|
|
2779
|
-
* @param options.pageToken - Opaque token from a previous page.
|
|
2780
|
-
* @param options.search - Case-insensitive substring filter on the workflow name.
|
|
2781
|
-
* @param options.type - Workflow kind: `"task"` or `"workflow"`.
|
|
2782
|
-
* @param options.view - Which saved version to return (`active` or `draft`).
|
|
2783
|
-
* @param options.includeVariation - Include variation metadata when supported.
|
|
2784
|
-
* @returns A page of workflows — use `.autoPagingIter()` for all pages.
|
|
2785
|
-
*
|
|
2786
|
-
* @example
|
|
2787
|
-
* ```ts
|
|
2788
|
-
* for await (const wf of (await client.workflows.list({ search: 'digest' })).autoPagingIter()) {
|
|
2789
|
-
* console.log(wf.id, wf.name, wf.status)
|
|
2790
|
-
* }
|
|
2791
|
-
* ```
|
|
2792
|
-
*/
|
|
2793
|
-
list(options = {}) {
|
|
2794
|
-
const pageSize = options.pageSize ?? 25;
|
|
2795
|
-
validatePageSize(pageSize);
|
|
2796
|
-
return this.listPage(
|
|
2797
|
-
pageSize,
|
|
2798
|
-
options.pageToken,
|
|
2799
|
-
options.search,
|
|
2800
|
-
options.type,
|
|
2801
|
-
options.view,
|
|
2802
|
-
options.includeVariation
|
|
2803
|
-
);
|
|
2804
|
-
}
|
|
2805
|
-
async listPage(pageSize, pageToken, search, type, view, includeVariation) {
|
|
2806
|
-
const data = asRecord(
|
|
2807
|
-
await invokeWithRetry(this.config, this.http, "WorkflowsController_list", {
|
|
2808
|
-
query: workflowsListParams(
|
|
2809
|
-
pageSize,
|
|
2810
|
-
pageToken,
|
|
2811
|
-
search,
|
|
2812
|
-
type,
|
|
2813
|
-
view,
|
|
2814
|
-
includeVariation
|
|
2815
|
-
)
|
|
2816
|
-
})
|
|
2817
|
-
);
|
|
2818
|
-
return buildAipPage(
|
|
2819
|
-
data,
|
|
2820
|
-
"workflows",
|
|
2821
|
-
parseWorkflow,
|
|
2822
|
-
(token) => this.listPage(pageSize, token, search, type, view, includeVariation)
|
|
2823
|
-
);
|
|
2824
|
-
}
|
|
2825
|
-
/**
|
|
2826
|
-
* Retrieve a workflow by ID or slug.
|
|
912
|
+
* Retrieve a workflow by its numeric id.
|
|
2827
913
|
*
|
|
2828
|
-
* @param workflowId - Numeric id
|
|
914
|
+
* @param workflowId - Numeric workflow id.
|
|
2829
915
|
* @param options.view - Which saved version to return (`active` or `draft`).
|
|
2830
916
|
* @param options.includeVariation - Include variation metadata when supported.
|
|
2831
917
|
* @returns The workflow (`id`, `name`, `status`, …).
|
|
2832
|
-
* @throws {NotFoundError} When no workflow
|
|
918
|
+
* @throws {NotFoundError} When no workflow has this id.
|
|
2833
919
|
*
|
|
2834
920
|
* @example
|
|
2835
921
|
* ```ts
|
|
2836
|
-
* const
|
|
922
|
+
* const [first] = (await client.workflows.list()).items
|
|
923
|
+
* const wf = await client.workflows.get(first.id)
|
|
2837
924
|
* console.log(wf.name, wf.status)
|
|
2838
925
|
* ```
|
|
2839
926
|
*/
|
|
2840
927
|
async get(workflowId, options = {}) {
|
|
2841
|
-
validateId(workflowId, "workflow_id");
|
|
928
|
+
_chunkNA3ZD35Tcjs.validateId.call(void 0, workflowId, "workflow_id");
|
|
2842
929
|
const query = {};
|
|
2843
930
|
if (options.view !== void 0) query.view = options.view;
|
|
2844
931
|
if (options.includeVariation !== void 0) {
|
|
2845
932
|
query.includeVariation = options.includeVariation;
|
|
2846
933
|
}
|
|
2847
|
-
const data = await invokeWithRetry(this.config, this.http, "WorkflowsController_get", {
|
|
934
|
+
const data = await _chunkNA3ZD35Tcjs.invokeWithRetry.call(void 0, this.config, this.http, "WorkflowsController_get", {
|
|
2848
935
|
pathParams: { id: workflowId },
|
|
2849
936
|
query: Object.keys(query).length > 0 ? query : void 0
|
|
2850
937
|
});
|
|
2851
938
|
return parseWorkflow(data);
|
|
2852
939
|
}
|
|
940
|
+
/**
|
|
941
|
+
* Chat with a published workflow. Node output streams live from the agent
|
|
942
|
+
* host: iterate `textStream()` for tokens, or `await` the result for the
|
|
943
|
+
* workflow's final output.
|
|
944
|
+
*
|
|
945
|
+
* @param workflowId - Numeric workflow id.
|
|
946
|
+
* @param message - User message text.
|
|
947
|
+
* @param options.model - Required model id (e.g. `"claude-sonnet-5.5"`).
|
|
948
|
+
* @param options.threadId - Continue an existing conversation; omit to start new.
|
|
949
|
+
* @returns A chat session — iterate it or `await` it for `content`, `threadId`, `runId`.
|
|
950
|
+
* @throws {ModusError} When no agent host is known for a custom `baseUrl`.
|
|
951
|
+
*
|
|
952
|
+
* @example
|
|
953
|
+
* ```ts
|
|
954
|
+
* const { content } = await client.workflows.chat(workflowId, 'Run this week\'s digest', {
|
|
955
|
+
* model: 'claude-sonnet-5.5',
|
|
956
|
+
* })
|
|
957
|
+
* console.log(content)
|
|
958
|
+
* ```
|
|
959
|
+
*/
|
|
960
|
+
chat(workflowId, message, options) {
|
|
961
|
+
return startChat(this.http, this.config, { kind: "workflows", id: workflowId }, message, options);
|
|
962
|
+
}
|
|
2853
963
|
};
|
|
2854
964
|
|
|
2855
|
-
// src/resources/connections.ts
|
|
2856
|
-
|
|
2857
|
-
const extra = {};
|
|
2858
|
-
if (type !== void 0) extra.type = type;
|
|
2859
|
-
return aipListParams(pageSize, pageToken, extra);
|
|
2860
|
-
}
|
|
2861
|
-
function parseConnection(raw) {
|
|
2862
|
-
return raw;
|
|
2863
|
-
}
|
|
2864
|
-
var ConnectionsResource = class {
|
|
965
|
+
// src/_generated/resources/consumption/connections.ts
|
|
966
|
+
var ConnectionsResourceBase = class {
|
|
2865
967
|
/** @internal */
|
|
2866
968
|
constructor(http, config) {
|
|
2867
969
|
this.http = http;
|
|
2868
970
|
this.config = config;
|
|
2869
971
|
}
|
|
2870
972
|
/**
|
|
2871
|
-
* List
|
|
973
|
+
* List connections.
|
|
2872
974
|
*
|
|
2873
|
-
*
|
|
2874
|
-
*
|
|
2875
|
-
*
|
|
975
|
+
* Returns a paginated page of warehouse and SaaS integration connections the caller can `use`.
|
|
976
|
+
* Connections the caller cannot access are filtered out. Use the returned `id` when creating
|
|
977
|
+
* saved-query context items. Pagination uses an opaque token returned in `nextPageToken`.
|
|
978
|
+
*
|
|
979
|
+
* **Requires:** `context:read`
|
|
980
|
+
*
|
|
981
|
+
* @param options.pageSize - Items per page. Defaults to 25.
|
|
982
|
+
* @param options.pageToken - Opaque page token from a previous response's `nextPageToken`. Omit
|
|
983
|
+
* for the first page.
|
|
984
|
+
* @param options.type - Filter by effective integration category (case-sensitive exact match).
|
|
2876
985
|
* @returns A page of connections.
|
|
2877
986
|
*/
|
|
2878
987
|
list(options = {}) {
|
|
2879
|
-
const pageSize = options.pageSize
|
|
2880
|
-
validatePageSize(pageSize);
|
|
988
|
+
const pageSize = _nullishCoalesce(options.pageSize, () => ( 25));
|
|
989
|
+
_chunkNA3ZD35Tcjs.validatePageSize.call(void 0, pageSize);
|
|
2881
990
|
return this.listPage(pageSize, options.pageToken, options.type);
|
|
2882
991
|
}
|
|
2883
992
|
async listPage(pageSize, pageToken, type) {
|
|
2884
|
-
const
|
|
2885
|
-
|
|
2886
|
-
|
|
993
|
+
const extra = {};
|
|
994
|
+
if (type !== void 0) extra.type = type;
|
|
995
|
+
const data = _chunkNA3ZD35Tcjs.asRecord.call(void 0,
|
|
996
|
+
await _chunkNA3ZD35Tcjs.invokeWithRetry.call(void 0, this.config, this.http, "ConnectionsController_list", {
|
|
997
|
+
query: _chunkNA3ZD35Tcjs.aipListParams.call(void 0, pageSize, pageToken, extra)
|
|
2887
998
|
})
|
|
2888
999
|
);
|
|
2889
|
-
return buildAipPage(
|
|
1000
|
+
return _chunkNA3ZD35Tcjs.buildAipPage.call(void 0,
|
|
2890
1001
|
data,
|
|
2891
1002
|
"connections",
|
|
2892
|
-
|
|
1003
|
+
(raw) => raw,
|
|
2893
1004
|
(token) => this.listPage(pageSize, token, type)
|
|
2894
1005
|
);
|
|
2895
1006
|
}
|
|
1007
|
+
};
|
|
1008
|
+
|
|
1009
|
+
// src/resources/connections.ts
|
|
1010
|
+
var ConnectionsResource = class extends ConnectionsResourceBase {
|
|
2896
1011
|
/**
|
|
2897
1012
|
* Find the first connection whose name matches (case-insensitive).
|
|
2898
1013
|
*
|
|
@@ -2904,222 +1019,64 @@ var ConnectionsResource = class {
|
|
|
2904
1019
|
* @returns The matching connection, or `undefined` if none is found.
|
|
2905
1020
|
*/
|
|
2906
1021
|
async find(options) {
|
|
2907
|
-
const pageSize = options.pageSize
|
|
2908
|
-
validatePageSize(pageSize);
|
|
1022
|
+
const pageSize = _nullishCoalesce(options.pageSize, () => ( 25));
|
|
1023
|
+
_chunkNA3ZD35Tcjs.validatePageSize.call(void 0, pageSize);
|
|
2909
1024
|
const target = options.name.trim().toLowerCase();
|
|
2910
1025
|
let token;
|
|
2911
1026
|
do {
|
|
2912
1027
|
const page = await this.listPage(pageSize, token, options.type);
|
|
2913
|
-
const match = page.items.find((c) => c.name
|
|
1028
|
+
const match = page.items.find((c) => _optionalChain([c, 'access', _21 => _21.name, 'optionalAccess', _22 => _22.toLowerCase, 'call', _23 => _23()]) === target);
|
|
2914
1029
|
if (match) return match;
|
|
2915
1030
|
if (!page.hasNextPage()) break;
|
|
2916
1031
|
token = page.nextPageToken;
|
|
2917
1032
|
} while (token !== void 0);
|
|
2918
1033
|
return void 0;
|
|
2919
1034
|
}
|
|
2920
|
-
};
|
|
2921
|
-
|
|
2922
|
-
// src/resources/context/custom-items.ts
|
|
2923
|
-
function parseContextItem(raw) {
|
|
2924
|
-
return raw;
|
|
2925
|
-
}
|
|
2926
|
-
function parseCreatedCustomContextItem(raw) {
|
|
2927
|
-
const data = asRecord(raw);
|
|
2928
|
-
const contextItemId = data.contextItemId;
|
|
2929
|
-
if (typeof contextItemId !== "string" || !contextItemId) {
|
|
2930
|
-
throw new ValidationError(
|
|
2931
|
-
"Custom context create response missing non-empty string contextItemId"
|
|
2932
|
-
);
|
|
2933
|
-
}
|
|
2934
|
-
return {
|
|
2935
|
-
...data,
|
|
2936
|
-
contextItemId,
|
|
2937
|
-
uid: contextItemId
|
|
2938
|
-
};
|
|
2939
|
-
}
|
|
2940
|
-
function parseDeletion(raw) {
|
|
2941
|
-
return raw;
|
|
2942
|
-
}
|
|
2943
|
-
var CustomContextItemsResource = class {
|
|
2944
|
-
/** @internal */
|
|
2945
|
-
constructor(http, config) {
|
|
2946
|
-
this.http = http;
|
|
2947
|
-
this.config = config;
|
|
2948
|
-
}
|
|
2949
1035
|
/**
|
|
2950
|
-
* List
|
|
1036
|
+
* List the selectable units on a connection (a repository, a schema, a project).
|
|
2951
1037
|
*
|
|
1038
|
+
* @param connectionId - Connection id.
|
|
2952
1039
|
* @param options.pageSize - Maximum items per page (default 25).
|
|
2953
1040
|
* @param options.pageToken - Opaque token from a previous page.
|
|
2954
|
-
* @
|
|
2955
|
-
* @param options.topics - Filter to items tagged with any of these topics.
|
|
2956
|
-
* @returns A page of custom context items.
|
|
1041
|
+
* @returns A page of selectable units — use {@link iterSelections} or `.autoPagingIter()` for every page.
|
|
2957
1042
|
* @example
|
|
2958
|
-
*
|
|
2959
|
-
*
|
|
2960
|
-
*
|
|
2961
|
-
* for (const item of page.items) console.log(item.uid, item.contextType)
|
|
2962
|
-
* ```
|
|
1043
|
+
* for await (const unit of client.connections.iterSelections('7a3f9d2c-1111-4000-a000-000000000abc')) {
|
|
1044
|
+
* console.log(unit.objectType, unit.path)
|
|
1045
|
+
* }
|
|
2963
1046
|
*/
|
|
2964
|
-
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
})
|
|
1047
|
+
listSelections(connectionId, options = {}) {
|
|
1048
|
+
_chunkNA3ZD35Tcjs.validateId.call(void 0, connectionId, "connection_id");
|
|
1049
|
+
const pageSize = _nullishCoalesce(options.pageSize, () => ( 25));
|
|
1050
|
+
_chunkNA3ZD35Tcjs.validatePageSize.call(void 0, pageSize);
|
|
1051
|
+
return this.listSelectionsPage(connectionId, pageSize, options.pageToken);
|
|
1052
|
+
}
|
|
1053
|
+
async listSelectionsPage(connectionId, pageSize, pageToken) {
|
|
1054
|
+
const data = _chunkNA3ZD35Tcjs.asRecord.call(void 0,
|
|
1055
|
+
await _chunkNA3ZD35Tcjs.invokeWithRetry.call(void 0, this.config, this.http, "ConnectionsController_listSelections", {
|
|
1056
|
+
pathParams: { connectionId },
|
|
1057
|
+
query: _chunkNA3ZD35Tcjs.aipListParams.call(void 0, pageSize, pageToken)
|
|
2976
1058
|
})
|
|
2977
1059
|
);
|
|
2978
|
-
return buildAipPage(
|
|
1060
|
+
return _chunkNA3ZD35Tcjs.buildAipPage.call(void 0,
|
|
2979
1061
|
data,
|
|
2980
|
-
"
|
|
2981
|
-
|
|
2982
|
-
(token) => this.
|
|
2983
|
-
);
|
|
2984
|
-
}
|
|
2985
|
-
/**
|
|
2986
|
-
* Retrieve a custom context item by uid.
|
|
2987
|
-
*
|
|
2988
|
-
* @param uid - Item uid.
|
|
2989
|
-
* @returns The custom context item.
|
|
2990
|
-
* @throws {NotFoundError} When no item matches the uid.
|
|
2991
|
-
* @example
|
|
2992
|
-
* ```ts
|
|
2993
|
-
* const client = new Modus()
|
|
2994
|
-
* const item = await client.context.customItems.get('PLACEHOLDER_UID')
|
|
2995
|
-
* ```
|
|
2996
|
-
*/
|
|
2997
|
-
async get(uid) {
|
|
2998
|
-
return parseContextItem(
|
|
2999
|
-
await invokeWithRetry(this.config, this.http, "CustomContextItemsController_get", {
|
|
3000
|
-
pathParams: { uid }
|
|
3001
|
-
})
|
|
3002
|
-
);
|
|
3003
|
-
}
|
|
3004
|
-
/**
|
|
3005
|
-
* Create a custom context item.
|
|
3006
|
-
*
|
|
3007
|
-
* @param input.kind - Item kind (`source`, `collection`, `entity`, `field`, or `entity_samples`).
|
|
3008
|
-
* @param input.sourceId - Source identifier for the item hierarchy.
|
|
3009
|
-
* @param input.name - Display name when applicable.
|
|
3010
|
-
* @param input.content - Item payload.
|
|
3011
|
-
* @param input.idempotencyKey - Optional idempotency key for safe retries.
|
|
3012
|
-
* @returns Created item ids and hierarchy metadata.
|
|
3013
|
-
*
|
|
3014
|
-
* @example
|
|
3015
|
-
* ```ts
|
|
3016
|
-
* const client = new Modus()
|
|
3017
|
-
* const created = await client.context.customItems.create({
|
|
3018
|
-
* kind: 'entity',
|
|
3019
|
-
* sourceId: 'my-source',
|
|
3020
|
-
* name: 'Q3 churn notes',
|
|
3021
|
-
* content: { summary: 'Key findings…' },
|
|
3022
|
-
* })
|
|
3023
|
-
* ```
|
|
3024
|
-
*/
|
|
3025
|
-
async create(input) {
|
|
3026
|
-
return parseCreatedCustomContextItem(
|
|
3027
|
-
await invokeWithRetry(this.config, this.http, "CustomContextItemsController_create", {
|
|
3028
|
-
jsonBody: omitUndefined(input)
|
|
3029
|
-
})
|
|
3030
|
-
);
|
|
3031
|
-
}
|
|
3032
|
-
/**
|
|
3033
|
-
* Create multiple custom context items in one request.
|
|
3034
|
-
*
|
|
3035
|
-
* @param inputs - Items to create (same fields as {@link CustomContextItemsResource.create}).
|
|
3036
|
-
* @returns Created item metadata for each input.
|
|
3037
|
-
*
|
|
3038
|
-
* @example
|
|
3039
|
-
* ```ts
|
|
3040
|
-
* const client = new Modus()
|
|
3041
|
-
* const created = await client.context.customItems.batchCreate([
|
|
3042
|
-
* { kind: 'field', sourceId: 'src', fieldName: 'region', dataType: 'string' },
|
|
3043
|
-
* { kind: 'field', sourceId: 'src', fieldName: 'amount', dataType: 'number' },
|
|
3044
|
-
* ])
|
|
3045
|
-
* ```
|
|
3046
|
-
*/
|
|
3047
|
-
async batchCreate(inputs) {
|
|
3048
|
-
const data = asRecord(
|
|
3049
|
-
await invokeWithRetry(this.config, this.http, "CustomContextItemsController_batchCreate", {
|
|
3050
|
-
jsonBody: {
|
|
3051
|
-
items: inputs.map((input) => omitUndefined(input))
|
|
3052
|
-
}
|
|
3053
|
-
})
|
|
3054
|
-
);
|
|
3055
|
-
const items = data.contextItems;
|
|
3056
|
-
return Array.isArray(items) ? items.map(parseCreatedCustomContextItem) : [];
|
|
3057
|
-
}
|
|
3058
|
-
/**
|
|
3059
|
-
* Create or update typed relations between context items.
|
|
3060
|
-
*
|
|
3061
|
-
* @param relations - Relations with source and target item uids, a snake_case type, and optional content.
|
|
3062
|
-
* @returns Number of relations created or updated.
|
|
3063
|
-
* @example
|
|
3064
|
-
* ```ts
|
|
3065
|
-
* const client = new Modus()
|
|
3066
|
-
* await client.context.customItems.createRelations([{
|
|
3067
|
-
* fromUid: 'SOURCE_UID',
|
|
3068
|
-
* toUid: 'TARGET_UID',
|
|
3069
|
-
* relationType: 'depends_on',
|
|
3070
|
-
* }])
|
|
3071
|
-
* ```
|
|
3072
|
-
*/
|
|
3073
|
-
async createRelations(relations) {
|
|
3074
|
-
const data = asRecord(
|
|
3075
|
-
await invokeWithRetry(
|
|
3076
|
-
this.config,
|
|
3077
|
-
this.http,
|
|
3078
|
-
"CustomContextItemsController_createRelations",
|
|
3079
|
-
{ jsonBody: { relations } }
|
|
3080
|
-
)
|
|
3081
|
-
);
|
|
3082
|
-
return data.upsertedCount;
|
|
3083
|
-
}
|
|
3084
|
-
/**
|
|
3085
|
-
* Update a custom context item.
|
|
3086
|
-
*
|
|
3087
|
-
* @param uid - Item uid.
|
|
3088
|
-
* @param input - Fields to change (kind and hierarchy ids cannot be changed).
|
|
3089
|
-
* @returns The updated item uid.
|
|
3090
|
-
* @example
|
|
3091
|
-
* ```ts
|
|
3092
|
-
* const client = new Modus()
|
|
3093
|
-
* await client.context.customItems.update('PLACEHOLDER_UID', {
|
|
3094
|
-
* description: 'Updated summary',
|
|
3095
|
-
* })
|
|
3096
|
-
* ```
|
|
3097
|
-
*/
|
|
3098
|
-
async update(uid, input) {
|
|
3099
|
-
return asRecord(
|
|
3100
|
-
await invokeWithRetry(this.config, this.http, "CustomContextItemsController_update", {
|
|
3101
|
-
pathParams: { uid },
|
|
3102
|
-
jsonBody: omitUndefined(input)
|
|
3103
|
-
})
|
|
1062
|
+
"selections",
|
|
1063
|
+
(raw) => raw,
|
|
1064
|
+
(token) => this.listSelectionsPage(connectionId, pageSize, token)
|
|
3104
1065
|
);
|
|
3105
1066
|
}
|
|
3106
1067
|
/**
|
|
3107
|
-
*
|
|
1068
|
+
* Yield every selectable unit on a connection, following pages.
|
|
3108
1069
|
*
|
|
3109
|
-
* @param
|
|
3110
|
-
* @
|
|
1070
|
+
* @param connectionId - Connection id.
|
|
1071
|
+
* @param options.pageSize - Maximum items per page (default 25).
|
|
3111
1072
|
* @example
|
|
3112
|
-
*
|
|
3113
|
-
*
|
|
3114
|
-
*
|
|
3115
|
-
* ```
|
|
1073
|
+
* for await (const unit of client.connections.iterSelections('7a3f9d2c-1111-4000-a000-000000000abc')) {
|
|
1074
|
+
* console.log(unit.objectType, unit.displayName)
|
|
1075
|
+
* }
|
|
3116
1076
|
*/
|
|
3117
|
-
async
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
pathParams: { uid }
|
|
3121
|
-
})
|
|
3122
|
-
);
|
|
1077
|
+
async *iterSelections(connectionId, options = {}) {
|
|
1078
|
+
const page = await this.listSelections(connectionId, options);
|
|
1079
|
+
yield* page.autoPagingIter();
|
|
3123
1080
|
}
|
|
3124
1081
|
};
|
|
3125
1082
|
|
|
@@ -3136,9 +1093,9 @@ function contextListParams(pageSize, pageToken, filters = {}) {
|
|
|
3136
1093
|
if (filters.connectionIds !== void 0) {
|
|
3137
1094
|
extra.connectionIds = filters.connectionIds.length === 0 ? "" : [...filters.connectionIds];
|
|
3138
1095
|
}
|
|
3139
|
-
return aipListParams(pageSize, pageToken, extra);
|
|
1096
|
+
return _chunkNA3ZD35Tcjs.aipListParams.call(void 0, pageSize, pageToken, extra);
|
|
3140
1097
|
}
|
|
3141
|
-
function
|
|
1098
|
+
function parseContextItem(raw) {
|
|
3142
1099
|
return raw;
|
|
3143
1100
|
}
|
|
3144
1101
|
function parseContextValueRow(raw) {
|
|
@@ -3202,8 +1159,8 @@ var ContextItemsResource = class {
|
|
|
3202
1159
|
* ```
|
|
3203
1160
|
*/
|
|
3204
1161
|
list(options = {}) {
|
|
3205
|
-
const pageSize = options.pageSize
|
|
3206
|
-
validatePageSize(pageSize);
|
|
1162
|
+
const pageSize = _nullishCoalesce(options.pageSize, () => ( 25));
|
|
1163
|
+
_chunkNA3ZD35Tcjs.validatePageSize.call(void 0, pageSize);
|
|
3207
1164
|
return this.listPage(pageSize, options.pageToken, {
|
|
3208
1165
|
contextType: options.contextType,
|
|
3209
1166
|
parentUids: options.parentUids,
|
|
@@ -3212,15 +1169,15 @@ var ContextItemsResource = class {
|
|
|
3212
1169
|
});
|
|
3213
1170
|
}
|
|
3214
1171
|
async listPage(pageSize, pageToken, filters) {
|
|
3215
|
-
const data = asRecord(
|
|
3216
|
-
await invokeWithRetry(this.config, this.http, "ContextItemsController_list", {
|
|
1172
|
+
const data = _chunkNA3ZD35Tcjs.asRecord.call(void 0,
|
|
1173
|
+
await _chunkNA3ZD35Tcjs.invokeWithRetry.call(void 0, this.config, this.http, "ContextItemsController_list", {
|
|
3217
1174
|
query: contextListParams(pageSize, pageToken, filters)
|
|
3218
1175
|
})
|
|
3219
1176
|
);
|
|
3220
|
-
return buildAipPage(
|
|
1177
|
+
return _chunkNA3ZD35Tcjs.buildAipPage.call(void 0,
|
|
3221
1178
|
data,
|
|
3222
1179
|
"contextItems",
|
|
3223
|
-
|
|
1180
|
+
parseContextItem,
|
|
3224
1181
|
(token) => this.listPage(pageSize, token, filters)
|
|
3225
1182
|
);
|
|
3226
1183
|
}
|
|
@@ -3238,10 +1195,10 @@ var ContextItemsResource = class {
|
|
|
3238
1195
|
* ```
|
|
3239
1196
|
*/
|
|
3240
1197
|
async get(uid) {
|
|
3241
|
-
const data = await invokeWithRetry(this.config, this.http, "ContextItemsController_get", {
|
|
1198
|
+
const data = await _chunkNA3ZD35Tcjs.invokeWithRetry.call(void 0, this.config, this.http, "ContextItemsController_get", {
|
|
3242
1199
|
pathParams: { uid }
|
|
3243
1200
|
});
|
|
3244
|
-
return
|
|
1201
|
+
return parseContextItem(data);
|
|
3245
1202
|
}
|
|
3246
1203
|
/**
|
|
3247
1204
|
* Look up a knowledge-base item by type and data path.
|
|
@@ -3257,36 +1214,41 @@ var ContextItemsResource = class {
|
|
|
3257
1214
|
* contextType: 'note',
|
|
3258
1215
|
* dataPath: ['finance', 'arr-definition'],
|
|
3259
1216
|
* })
|
|
3260
|
-
* if (found) console.log(found.uid, found.
|
|
1217
|
+
* if (found) console.log(found.uid, found.content)
|
|
3261
1218
|
* ```
|
|
3262
1219
|
*/
|
|
3263
1220
|
async lookup(options) {
|
|
3264
|
-
const body = omitUndefined({
|
|
1221
|
+
const body = _chunkNA3ZD35Tcjs.omitUndefined.call(void 0, {
|
|
3265
1222
|
contextType: options.contextType,
|
|
3266
1223
|
dataPath: options.dataPath,
|
|
3267
1224
|
contentProjection: options.contentProjection
|
|
3268
1225
|
});
|
|
3269
1226
|
try {
|
|
3270
|
-
const raw = asRecord(
|
|
3271
|
-
await invokeWithRetry(this.config, this.http, "ContextItemsController_lookup", {
|
|
1227
|
+
const raw = _chunkNA3ZD35Tcjs.asRecord.call(void 0,
|
|
1228
|
+
await _chunkNA3ZD35Tcjs.invokeWithRetry.call(void 0, this.config, this.http, "ContextItemsController_lookup", {
|
|
3272
1229
|
jsonBody: body
|
|
3273
1230
|
})
|
|
3274
1231
|
);
|
|
3275
1232
|
return parseLookupResponse(raw);
|
|
3276
1233
|
} catch (error) {
|
|
3277
|
-
if (error instanceof NotFoundError) return void 0;
|
|
1234
|
+
if (error instanceof _chunkNA3ZD35Tcjs.NotFoundError) return void 0;
|
|
3278
1235
|
throw error;
|
|
3279
1236
|
}
|
|
3280
1237
|
}
|
|
3281
1238
|
/**
|
|
3282
|
-
*
|
|
1239
|
+
* Page through the elements of an array field inside one context item's content.
|
|
1240
|
+
*
|
|
1241
|
+
* Each row is `{ index, value }`: the element's position in the array and the
|
|
1242
|
+
* element itself. A field that is not an array reads as one element; a missing
|
|
1243
|
+
* field as none. Rejects with a not-found error when the item does not exist,
|
|
1244
|
+
* you cannot read it, or its context type is not `contextType`.
|
|
3283
1245
|
*
|
|
3284
1246
|
* @param uid - Item uid.
|
|
3285
1247
|
* @param contextType - Context type of the item.
|
|
3286
|
-
* @param contentKeyPath - Dot path to the
|
|
3287
|
-
* @param options.pageSize - Maximum
|
|
3288
|
-
* @param options.pageToken - Opaque token from a previous page.
|
|
3289
|
-
* @returns A page of value rows.
|
|
1248
|
+
* @param contentKeyPath - Dot path to the array inside item content (e.g. `"enumValues"`).
|
|
1249
|
+
* @param options.pageSize - Maximum elements per page (default 25).
|
|
1250
|
+
* @param options.pageToken - Opaque token from a previous page of the same item.
|
|
1251
|
+
* @returns A page of `{ index, value }` rows.
|
|
3290
1252
|
*
|
|
3291
1253
|
* @example
|
|
3292
1254
|
* ```ts
|
|
@@ -3297,22 +1259,22 @@ var ContextItemsResource = class {
|
|
|
3297
1259
|
* 'enumValues',
|
|
3298
1260
|
* { pageSize: 25 },
|
|
3299
1261
|
* )
|
|
3300
|
-
* for (const row of page.items) console.log(row)
|
|
1262
|
+
* for (const row of page.items) console.log(row.index, row.value)
|
|
3301
1263
|
* ```
|
|
3302
1264
|
*/
|
|
3303
1265
|
listValues(uid, contextType, contentKeyPath, options = {}) {
|
|
3304
|
-
const pageSize = options.pageSize
|
|
3305
|
-
validatePageSize(pageSize, DEFAULT_MAX_PAGE_SIZE);
|
|
1266
|
+
const pageSize = _nullishCoalesce(options.pageSize, () => ( 25));
|
|
1267
|
+
_chunkNA3ZD35Tcjs.validatePageSize.call(void 0, pageSize, _chunkNA3ZD35Tcjs.DEFAULT_MAX_PAGE_SIZE);
|
|
3306
1268
|
return this.listValuesPage(uid, contextType, contentKeyPath, pageSize, options.pageToken);
|
|
3307
1269
|
}
|
|
3308
1270
|
/**
|
|
3309
|
-
*
|
|
1271
|
+
* Page through an array field of a context item already loaded via {@link ContextItemsResource.list} or {@link ContextItemsResource.get}.
|
|
3310
1272
|
*
|
|
3311
1273
|
* @param item - Context item (uses `item.uid` and `item.contextType`).
|
|
3312
|
-
* @param contentKeyPath - Dot path to the
|
|
3313
|
-
* @param options.pageSize - Maximum
|
|
3314
|
-
* @param options.pageToken - Opaque token from a previous page.
|
|
3315
|
-
* @returns A page of value rows.
|
|
1274
|
+
* @param contentKeyPath - Dot path to the array inside item content.
|
|
1275
|
+
* @param options.pageSize - Maximum elements per page (default 25).
|
|
1276
|
+
* @param options.pageToken - Opaque token from a previous page of the same item.
|
|
1277
|
+
* @returns A page of `{ index, value }` rows.
|
|
3316
1278
|
*
|
|
3317
1279
|
* @example
|
|
3318
1280
|
* ```ts
|
|
@@ -3326,16 +1288,16 @@ var ContextItemsResource = class {
|
|
|
3326
1288
|
return this.listValues(item.uid, item.contextType, contentKeyPath, options);
|
|
3327
1289
|
}
|
|
3328
1290
|
async listValuesPage(uid, contextType, contentKeyPath, pageSize, pageToken) {
|
|
3329
|
-
const data = asRecord(
|
|
3330
|
-
await invokeWithRetry(this.config, this.http, "ContextItemsController_listValues", {
|
|
1291
|
+
const data = _chunkNA3ZD35Tcjs.asRecord.call(void 0,
|
|
1292
|
+
await _chunkNA3ZD35Tcjs.invokeWithRetry.call(void 0, this.config, this.http, "ContextItemsController_listValues", {
|
|
3331
1293
|
pathParams: { uid },
|
|
3332
|
-
query: aipListParams(pageSize, pageToken, {
|
|
1294
|
+
query: _chunkNA3ZD35Tcjs.aipListParams.call(void 0, pageSize, pageToken, {
|
|
3333
1295
|
contextType,
|
|
3334
1296
|
contentKeyPath
|
|
3335
1297
|
})
|
|
3336
1298
|
})
|
|
3337
1299
|
);
|
|
3338
|
-
return buildAipPage(
|
|
1300
|
+
return _chunkNA3ZD35Tcjs.buildAipPage.call(void 0,
|
|
3339
1301
|
data,
|
|
3340
1302
|
"values",
|
|
3341
1303
|
parseContextValueRow,
|
|
@@ -3349,7 +1311,7 @@ var ContextResource = class {
|
|
|
3349
1311
|
/** @internal */
|
|
3350
1312
|
constructor(http, config) {
|
|
3351
1313
|
this.items = new ContextItemsResource(http, config);
|
|
3352
|
-
this.customItems = new CustomContextItemsResource(http, config);
|
|
1314
|
+
this.customItems = new (0, _chunkNA3ZD35Tcjs.CustomContextItemsResource)(http, config);
|
|
3353
1315
|
}
|
|
3354
1316
|
};
|
|
3355
1317
|
|
|
@@ -3384,7 +1346,7 @@ var IngestedDataResource = class {
|
|
|
3384
1346
|
* ```
|
|
3385
1347
|
*/
|
|
3386
1348
|
async upload(options) {
|
|
3387
|
-
const data = await invokeWithRetry(this.config, this.http, "IngestedDataController_upload", {
|
|
1349
|
+
const data = await _chunkNA3ZD35Tcjs.invokeWithRetry.call(void 0, this.config, this.http, "IngestedDataController_upload", {
|
|
3388
1350
|
jsonBody: {
|
|
3389
1351
|
integration_type: options.integrationType,
|
|
3390
1352
|
request: options.request,
|
|
@@ -3395,11 +1357,36 @@ var IngestedDataResource = class {
|
|
|
3395
1357
|
}
|
|
3396
1358
|
};
|
|
3397
1359
|
|
|
1360
|
+
// src/_generated/resources/consumption/modus/conversations.ts
|
|
1361
|
+
var ModusConversationsResourceBase = class {
|
|
1362
|
+
/** @internal */
|
|
1363
|
+
constructor(http, config) {
|
|
1364
|
+
this.http = http;
|
|
1365
|
+
this.config = config;
|
|
1366
|
+
}
|
|
1367
|
+
/**
|
|
1368
|
+
* Get a Modus conversation.
|
|
1369
|
+
*
|
|
1370
|
+
* Returns the full message history for a conversation thread.
|
|
1371
|
+
*
|
|
1372
|
+
* **Requires:** `scopes:read`
|
|
1373
|
+
*
|
|
1374
|
+
* @param threadId - Thread id from a conversation list or chat response.
|
|
1375
|
+
*/
|
|
1376
|
+
async get(threadId) {
|
|
1377
|
+
_chunkNA3ZD35Tcjs.validateId.call(void 0, threadId, "thread_id");
|
|
1378
|
+
const data = await _chunkNA3ZD35Tcjs.invokeWithRetry.call(void 0, this.config, this.http, "ModusConversationsController_get", {
|
|
1379
|
+
pathParams: { threadId }
|
|
1380
|
+
});
|
|
1381
|
+
return data;
|
|
1382
|
+
}
|
|
1383
|
+
};
|
|
1384
|
+
|
|
3398
1385
|
// src/resources/modus/conversations.ts
|
|
3399
1386
|
var ALLOWED_KINDS = /* @__PURE__ */ new Set(["all", "modus", "scopes"]);
|
|
3400
1387
|
function listParams(pageSize, pageToken, kind, source, sourceRef) {
|
|
3401
1388
|
if (kind !== void 0 && !ALLOWED_KINDS.has(kind)) {
|
|
3402
|
-
throw new
|
|
1389
|
+
throw new (0, _chunkNA3ZD35Tcjs.ValidationError)(
|
|
3403
1390
|
`kind must be one of ${[...ALLOWED_KINDS].sort().join(", ")}, got ${JSON.stringify(kind)}`
|
|
3404
1391
|
);
|
|
3405
1392
|
}
|
|
@@ -3407,18 +1394,14 @@ function listParams(pageSize, pageToken, kind, source, sourceRef) {
|
|
|
3407
1394
|
if (kind !== void 0) extra.kind = kind;
|
|
3408
1395
|
if (source !== void 0) extra.source = source;
|
|
3409
1396
|
if (sourceRef !== void 0) extra.sourceRef = sourceRef;
|
|
3410
|
-
return aipListParams(pageSize, pageToken, extra);
|
|
1397
|
+
return _chunkNA3ZD35Tcjs.aipListParams.call(void 0, pageSize, pageToken, extra);
|
|
3411
1398
|
}
|
|
3412
1399
|
function parseListItem(raw) {
|
|
3413
1400
|
return raw;
|
|
3414
1401
|
}
|
|
3415
|
-
|
|
3416
|
-
return raw;
|
|
3417
|
-
}
|
|
3418
|
-
var ModusConversationsResource = class {
|
|
1402
|
+
var ModusConversationsResource = class extends ModusConversationsResourceBase {
|
|
3419
1403
|
constructor(http, config) {
|
|
3420
|
-
|
|
3421
|
-
this.config = config;
|
|
1404
|
+
super(http, config);
|
|
3422
1405
|
}
|
|
3423
1406
|
/**
|
|
3424
1407
|
* List conversations.
|
|
@@ -3437,36 +1420,23 @@ var ModusConversationsResource = class {
|
|
|
3437
1420
|
* @returns Page of conversation list items.
|
|
3438
1421
|
*/
|
|
3439
1422
|
list(options = {}) {
|
|
3440
|
-
const pageSize = options.pageSize
|
|
3441
|
-
validatePageSize(pageSize);
|
|
1423
|
+
const pageSize = _nullishCoalesce(options.pageSize, () => ( 25));
|
|
1424
|
+
_chunkNA3ZD35Tcjs.validatePageSize.call(void 0, pageSize);
|
|
3442
1425
|
return this.listPage(pageSize, options.pageToken, options.kind, options.source, options.sourceRef);
|
|
3443
1426
|
}
|
|
3444
1427
|
async listPage(pageSize, pageToken, kind, source, sourceRef) {
|
|
3445
|
-
const data = asRecord(
|
|
3446
|
-
await invokeWithRetry(this.config, this.http, "ModusConversationsController_list", {
|
|
1428
|
+
const data = _chunkNA3ZD35Tcjs.asRecord.call(void 0,
|
|
1429
|
+
await _chunkNA3ZD35Tcjs.invokeWithRetry.call(void 0, this.config, this.http, "ModusConversationsController_list", {
|
|
3447
1430
|
query: listParams(pageSize, pageToken, kind, source, sourceRef)
|
|
3448
1431
|
})
|
|
3449
1432
|
);
|
|
3450
|
-
return buildAipPage(
|
|
1433
|
+
return _chunkNA3ZD35Tcjs.buildAipPage.call(void 0,
|
|
3451
1434
|
data,
|
|
3452
1435
|
"conversations",
|
|
3453
1436
|
parseListItem,
|
|
3454
1437
|
(token) => this.listPage(pageSize, token, kind, source, sourceRef)
|
|
3455
1438
|
);
|
|
3456
1439
|
}
|
|
3457
|
-
/**
|
|
3458
|
-
* Retrieve a conversation thread with full message history.
|
|
3459
|
-
*
|
|
3460
|
-
* @param threadId - Conversation thread id.
|
|
3461
|
-
* @returns Conversation with messages.
|
|
3462
|
-
*/
|
|
3463
|
-
async get(threadId) {
|
|
3464
|
-
validateId(threadId, "thread_id");
|
|
3465
|
-
const data = await invokeWithRetry(this.config, this.http, "ModusConversationsController_get", {
|
|
3466
|
-
pathParams: { threadId }
|
|
3467
|
-
});
|
|
3468
|
-
return parseConversation(data);
|
|
3469
|
-
}
|
|
3470
1440
|
};
|
|
3471
1441
|
|
|
3472
1442
|
// src/resources/modus/modus.ts
|
|
@@ -3479,6 +1449,9 @@ var ModusResource = class {
|
|
|
3479
1449
|
/**
|
|
3480
1450
|
* Compose full-environment context for an intent without running chat.
|
|
3481
1451
|
*
|
|
1452
|
+
* Runs on the agent host, like `chat`, so a compose may take up to 90 seconds; keep `timeoutMs`
|
|
1453
|
+
* above that. A compose still running at 90 seconds fails with `UPSTREAM_TIMEOUT` (504).
|
|
1454
|
+
*
|
|
3482
1455
|
* @param message - Natural-language intent used to select context.
|
|
3483
1456
|
* @param options.limit - Maximum context items to return. Omit to return all selected items.
|
|
3484
1457
|
* @returns Composition metadata (counts / session id). Use `chat` for a reply.
|
|
@@ -3490,172 +1463,130 @@ var ModusResource = class {
|
|
|
3490
1463
|
* ```
|
|
3491
1464
|
*/
|
|
3492
1465
|
async getContext(message, options = {}) {
|
|
3493
|
-
const data = await invokeWithRetry(this.config, this.http, "
|
|
3494
|
-
jsonBody: omitUndefined({ message, limit: options.limit })
|
|
1466
|
+
const data = await _chunkNA3ZD35Tcjs.invokeWithRetry.call(void 0, this.config, this.http, "ModusContextComposeController_compose", {
|
|
1467
|
+
jsonBody: _chunkNA3ZD35Tcjs.omitUndefined.call(void 0, { message, limit: options.limit })
|
|
3495
1468
|
});
|
|
3496
1469
|
return data;
|
|
3497
1470
|
}
|
|
3498
1471
|
/**
|
|
3499
|
-
*
|
|
1472
|
+
* Chat with Modus, the org-wide assistant. The reply streams live from the
|
|
1473
|
+
* agent host: iterate `textStream()` for tokens, or `await` the result for
|
|
1474
|
+
* the final answer. Pass the returned `threadId` back to continue.
|
|
3500
1475
|
*
|
|
3501
1476
|
* @param message - User message text.
|
|
3502
|
-
* @param options.model - Required model id (e.g. `"claude-sonnet-5"`).
|
|
1477
|
+
* @param options.model - Required model id (e.g. `"claude-sonnet-5.5"`).
|
|
3503
1478
|
* @param options.threadId - Continue an existing conversation; omit to start new.
|
|
3504
|
-
* @returns
|
|
1479
|
+
* @returns A chat session — iterate it or `await` it for `content`, `threadId`, `runId`.
|
|
1480
|
+
* @throws {ModusError} When no agent host is known for a custom `baseUrl`.
|
|
3505
1481
|
*
|
|
3506
1482
|
* @example
|
|
3507
1483
|
* ```ts
|
|
3508
1484
|
* const result = await client.modus.chat('What tables describe revenue?', {
|
|
3509
|
-
* model: 'claude-sonnet-5',
|
|
1485
|
+
* model: 'claude-sonnet-5.5',
|
|
3510
1486
|
* })
|
|
3511
|
-
* console.log(result.content
|
|
3512
|
-
* const follow =
|
|
3513
|
-
* model: 'claude-sonnet-5',
|
|
1487
|
+
* console.log(result.content)
|
|
1488
|
+
* const follow = client.modus.chat('Break that down by region.', {
|
|
1489
|
+
* model: 'claude-sonnet-5.5',
|
|
3514
1490
|
* threadId: result.threadId,
|
|
3515
1491
|
* })
|
|
1492
|
+
* for await (const token of follow.textStream()) process.stdout.write(token)
|
|
3516
1493
|
* ```
|
|
3517
1494
|
*/
|
|
3518
1495
|
chat(message, options) {
|
|
3519
|
-
return
|
|
3520
|
-
}
|
|
3521
|
-
/**
|
|
3522
|
-
* Stream a Modus reply token by token (SSE).
|
|
3523
|
-
*
|
|
3524
|
-
* The request starts when you consume `textStream()` or `eventStream()`.
|
|
3525
|
-
*
|
|
3526
|
-
* @param message - User message text.
|
|
3527
|
-
* @param options.model - Required model id (e.g. `"claude-sonnet-5"`).
|
|
3528
|
-
* @param options.threadId - Continue an existing conversation; omit to start new.
|
|
3529
|
-
* @returns Chat stream — iterate `textStream()` for tokens.
|
|
3530
|
-
*
|
|
3531
|
-
* @example
|
|
3532
|
-
* ```ts
|
|
3533
|
-
* const stream = client.modus.chatStream('Summarize ARR in three bullets.', {
|
|
3534
|
-
* model: 'claude-sonnet-5',
|
|
3535
|
-
* })
|
|
3536
|
-
* for await (const token of stream.textStream()) {
|
|
3537
|
-
* process.stdout.write(token)
|
|
3538
|
-
* }
|
|
3539
|
-
* console.log(stream.getFinalResult().threadId)
|
|
3540
|
-
* ```
|
|
3541
|
-
*/
|
|
3542
|
-
chatStream(message, options) {
|
|
3543
|
-
return modusChatStreamSession(this.http, this.config, message, options);
|
|
1496
|
+
return startChat(this.http, this.config, { kind: "modus" }, message, options);
|
|
3544
1497
|
}
|
|
3545
1498
|
};
|
|
3546
1499
|
|
|
3547
|
-
// src/resources/scopes
|
|
3548
|
-
|
|
3549
|
-
|
|
3550
|
-
|
|
3551
|
-
function parseConversation2(raw) {
|
|
3552
|
-
return raw;
|
|
3553
|
-
}
|
|
3554
|
-
var ScopeConversationsResource = class {
|
|
3555
|
-
constructor(http, config, scopeId) {
|
|
1500
|
+
// src/_generated/resources/consumption/scopes.ts
|
|
1501
|
+
var ScopesResourceBase = class {
|
|
1502
|
+
/** @internal */
|
|
1503
|
+
constructor(http, config) {
|
|
3556
1504
|
this.http = http;
|
|
3557
1505
|
this.config = config;
|
|
3558
|
-
this.scopeId = scopeId;
|
|
3559
1506
|
}
|
|
3560
1507
|
/**
|
|
3561
|
-
* List
|
|
1508
|
+
* List scopes.
|
|
3562
1509
|
*
|
|
3563
|
-
*
|
|
3564
|
-
*
|
|
3565
|
-
*
|
|
3566
|
-
*
|
|
3567
|
-
*
|
|
3568
|
-
*
|
|
3569
|
-
*
|
|
3570
|
-
*
|
|
3571
|
-
* @
|
|
1510
|
+
* Returns a paginated page of scopes the caller can at least `use`. Scopes the caller cannot see
|
|
1511
|
+
* are filtered out. Pagination uses an opaque token returned in `nextPageToken`.
|
|
1512
|
+
*
|
|
1513
|
+
* **Requires:** `scopes:read`
|
|
1514
|
+
*
|
|
1515
|
+
* @param options.pageSize - Items per page. Defaults to 25.
|
|
1516
|
+
* @param options.pageToken - Opaque page token from a previous response's `nextPageToken`. Omit
|
|
1517
|
+
* for the first page.
|
|
1518
|
+
* @param options.search - Case-insensitive substring filter on scope name.
|
|
1519
|
+
* @param options.view - Variation view. `active` reads the deployed version, or the latest draft
|
|
1520
|
+
* when nothing is published. `draft` reads the latest builder snapshot. `published` reads only
|
|
1521
|
+
* the published version, and only scopes you can use.
|
|
1522
|
+
* @param options.managerId - Return only scopes supervised by this manager scope id.
|
|
1523
|
+
* @returns A page of scopes.
|
|
3572
1524
|
*
|
|
3573
1525
|
* @example
|
|
3574
1526
|
* ```ts
|
|
3575
|
-
* for await (const
|
|
3576
|
-
*
|
|
3577
|
-
* ).autoPagingIter()) {
|
|
3578
|
-
* console.log(row.threadId, row.firstMessage, row.messageCount)
|
|
1527
|
+
* for await (const scope of (await client.scopes.list()).autoPagingIter()) {
|
|
1528
|
+
* console.log(scope.id, scope.name, scope.status)
|
|
3579
1529
|
* }
|
|
3580
1530
|
* ```
|
|
3581
1531
|
*/
|
|
3582
1532
|
list(options = {}) {
|
|
3583
|
-
const pageSize = options.pageSize
|
|
3584
|
-
validatePageSize(pageSize);
|
|
3585
|
-
return this.listPage(pageSize, options.pageToken, options.
|
|
1533
|
+
const pageSize = _nullishCoalesce(options.pageSize, () => ( 25));
|
|
1534
|
+
_chunkNA3ZD35Tcjs.validatePageSize.call(void 0, pageSize);
|
|
1535
|
+
return this.listPage(pageSize, options.pageToken, options.search, options.view, options.managerId);
|
|
3586
1536
|
}
|
|
3587
|
-
async listPage(pageSize, pageToken,
|
|
3588
|
-
validateId(this.scopeId, "scope_id");
|
|
1537
|
+
async listPage(pageSize, pageToken, search, view, managerId) {
|
|
3589
1538
|
const extra = {};
|
|
3590
|
-
if (
|
|
3591
|
-
if (
|
|
3592
|
-
|
|
3593
|
-
|
|
3594
|
-
|
|
3595
|
-
query: aipListParams(pageSize, pageToken, extra)
|
|
1539
|
+
if (search !== void 0) extra.search = search;
|
|
1540
|
+
if (view !== void 0) extra.view = view;
|
|
1541
|
+
if (managerId !== void 0) extra.managerId = managerId;
|
|
1542
|
+
const data = _chunkNA3ZD35Tcjs.asRecord.call(void 0,
|
|
1543
|
+
await _chunkNA3ZD35Tcjs.invokeWithRetry.call(void 0, this.config, this.http, "ScopesController_list", {
|
|
1544
|
+
query: _chunkNA3ZD35Tcjs.aipListParams.call(void 0, pageSize, pageToken, extra)
|
|
3596
1545
|
})
|
|
3597
1546
|
);
|
|
3598
|
-
return buildAipPage(
|
|
1547
|
+
return _chunkNA3ZD35Tcjs.buildAipPage.call(void 0,
|
|
3599
1548
|
data,
|
|
3600
|
-
"
|
|
3601
|
-
|
|
3602
|
-
(token) => this.listPage(pageSize, token,
|
|
1549
|
+
"scopes",
|
|
1550
|
+
(raw) => raw,
|
|
1551
|
+
(token) => this.listPage(pageSize, token, search, view, managerId)
|
|
3603
1552
|
);
|
|
3604
1553
|
}
|
|
3605
1554
|
/**
|
|
3606
|
-
*
|
|
1555
|
+
* Get a scope.
|
|
1556
|
+
*
|
|
1557
|
+
* Returns a scope. `view=active` (default) is the deployed version, or the latest draft when
|
|
1558
|
+
* nothing is published. `view=draft` is the latest edits. `view=published` is only the published
|
|
1559
|
+
* version, and only if you can use the scope. Returns 404 if you cannot access it.
|
|
3607
1560
|
*
|
|
3608
|
-
*
|
|
3609
|
-
*
|
|
3610
|
-
* @param
|
|
3611
|
-
* @
|
|
1561
|
+
* **Requires:** `scopes:read`
|
|
1562
|
+
*
|
|
1563
|
+
* @param scopeId - Numeric scope id.
|
|
1564
|
+
* @param options.view - Which version to read. Defaults to `active`. `published` is only the
|
|
1565
|
+
* published version, and only if you can use the scope.
|
|
3612
1566
|
*
|
|
3613
1567
|
* @example
|
|
3614
1568
|
* ```ts
|
|
3615
|
-
* const
|
|
3616
|
-
*
|
|
3617
|
-
*
|
|
3618
|
-
* }
|
|
1569
|
+
* const [first] = (await client.scopes.list()).items
|
|
1570
|
+
* const scope = await client.scopes.get(first.id)
|
|
1571
|
+
* console.log(scope.name, scope.status)
|
|
3619
1572
|
* ```
|
|
3620
1573
|
*/
|
|
3621
|
-
async get(
|
|
3622
|
-
validateId(
|
|
3623
|
-
|
|
3624
|
-
|
|
3625
|
-
|
|
3626
|
-
}
|
|
3627
|
-
const data = await invokeWithRetry(this.config, this.http, "ScopeConversationsController_get", {
|
|
3628
|
-
pathParams: { id: this.scopeId, threadId },
|
|
3629
|
-
query: {
|
|
3630
|
-
messageLimit: options.messageLimit,
|
|
3631
|
-
beforeMessageIndex: options.beforeMessageIndex
|
|
3632
|
-
}
|
|
1574
|
+
async get(scopeId, options = {}) {
|
|
1575
|
+
_chunkNA3ZD35Tcjs.validateId.call(void 0, scopeId, "scope_id");
|
|
1576
|
+
const data = await _chunkNA3ZD35Tcjs.invokeWithRetry.call(void 0, this.config, this.http, "ScopesController_get", {
|
|
1577
|
+
pathParams: { id: scopeId },
|
|
1578
|
+
query: { view: options.view }
|
|
3633
1579
|
});
|
|
3634
|
-
return
|
|
1580
|
+
return data;
|
|
3635
1581
|
}
|
|
3636
1582
|
};
|
|
3637
1583
|
|
|
3638
1584
|
// src/resources/scopes.ts
|
|
3639
|
-
|
|
3640
|
-
const extra = {};
|
|
3641
|
-
if (search !== void 0) extra.search = search;
|
|
3642
|
-
if (view !== void 0) extra.view = view;
|
|
3643
|
-
if (managerId !== void 0) extra.managerId = managerId;
|
|
3644
|
-
return aipListParams(pageSize, pageToken, extra);
|
|
3645
|
-
}
|
|
3646
|
-
function parseScope(raw) {
|
|
3647
|
-
return raw;
|
|
3648
|
-
}
|
|
3649
|
-
var ScopesResource = class {
|
|
3650
|
-
/** @internal */
|
|
3651
|
-
constructor(http, config) {
|
|
3652
|
-
this.http = http;
|
|
3653
|
-
this.config = config;
|
|
3654
|
-
}
|
|
1585
|
+
var ScopesResource = class extends ScopesResourceBase {
|
|
3655
1586
|
/**
|
|
3656
1587
|
* Return the conversations sub-resource scoped to `scopeId`.
|
|
3657
1588
|
*
|
|
3658
|
-
* @param scopeId -
|
|
1589
|
+
* @param scopeId - Numeric scope id.
|
|
3659
1590
|
* @returns Conversations resource for the scope.
|
|
3660
1591
|
*
|
|
3661
1592
|
* @example
|
|
@@ -3668,79 +1599,20 @@ var ScopesResource = class {
|
|
|
3668
1599
|
* ```
|
|
3669
1600
|
*/
|
|
3670
1601
|
conversations(scopeId) {
|
|
3671
|
-
return new ScopeConversationsResource(this.http, this.config, scopeId);
|
|
3672
|
-
}
|
|
3673
|
-
/**
|
|
3674
|
-
* List scopes in the organisation.
|
|
3675
|
-
*
|
|
3676
|
-
* @param options.pageSize - Items per page (default 25).
|
|
3677
|
-
* @param options.pageToken - Opaque token from a previous page.
|
|
3678
|
-
* @param options.search - Case-insensitive substring filter on the scope name.
|
|
3679
|
-
* @param options.view - `"active"` (deployed) or `"draft"`.
|
|
3680
|
-
* @param options.managerId - Only scopes supervised by this manager scope id.
|
|
3681
|
-
* @returns Page of scopes — use `.autoPagingIter()` for all pages.
|
|
3682
|
-
*
|
|
3683
|
-
* @example
|
|
3684
|
-
* ```ts
|
|
3685
|
-
* for await (const scope of (await client.scopes.list()).autoPagingIter()) {
|
|
3686
|
-
* console.log(scope.id, scope.name, scope.status)
|
|
3687
|
-
* }
|
|
3688
|
-
* ```
|
|
3689
|
-
*/
|
|
3690
|
-
list(options = {}) {
|
|
3691
|
-
const pageSize = options.pageSize ?? 25;
|
|
3692
|
-
validatePageSize(pageSize);
|
|
3693
|
-
return this.listPage(
|
|
3694
|
-
pageSize,
|
|
3695
|
-
options.pageToken,
|
|
3696
|
-
options.search,
|
|
3697
|
-
options.view,
|
|
3698
|
-
options.managerId
|
|
3699
|
-
);
|
|
3700
|
-
}
|
|
3701
|
-
async listPage(pageSize, pageToken, search, view, managerId) {
|
|
3702
|
-
const data = asRecord(
|
|
3703
|
-
await invokeWithRetry(this.config, this.http, "ScopesController_list", {
|
|
3704
|
-
query: scopesListParams(pageSize, pageToken, search, view, managerId)
|
|
3705
|
-
})
|
|
3706
|
-
);
|
|
3707
|
-
return buildAipPage(
|
|
3708
|
-
data,
|
|
3709
|
-
"scopes",
|
|
3710
|
-
parseScope,
|
|
3711
|
-
(token) => this.listPage(pageSize, token, search, view, managerId)
|
|
3712
|
-
);
|
|
3713
|
-
}
|
|
3714
|
-
/**
|
|
3715
|
-
* Retrieve a scope by ID or slug.
|
|
3716
|
-
*
|
|
3717
|
-
* @param scopeId - Scope numeric id or slug.
|
|
3718
|
-
* @param options.view - `"active"` (deployed) or `"draft"`.
|
|
3719
|
-
* @throws {NotFoundError} When no scope matches the id or slug.
|
|
3720
|
-
* @returns Scope (`id`, `name`, `status`, …).
|
|
3721
|
-
*
|
|
3722
|
-
* @example
|
|
3723
|
-
* ```ts
|
|
3724
|
-
* const scope = await client.scopes.get('revenue-analysis')
|
|
3725
|
-
* console.log(scope.name, scope.status)
|
|
3726
|
-
* ```
|
|
3727
|
-
*/
|
|
3728
|
-
async get(scopeId, options = {}) {
|
|
3729
|
-
validateId(scopeId, "scope_id");
|
|
3730
|
-
const query = options.view !== void 0 ? { view: options.view } : void 0;
|
|
3731
|
-
const data = await invokeWithRetry(this.config, this.http, "ScopesController_get", {
|
|
3732
|
-
pathParams: { id: scopeId },
|
|
3733
|
-
query
|
|
3734
|
-
});
|
|
3735
|
-
return parseScope(data);
|
|
1602
|
+
return new (0, _chunkNA3ZD35Tcjs.ScopeConversationsResource)(this.http, this.config, scopeId);
|
|
3736
1603
|
}
|
|
3737
1604
|
/**
|
|
3738
1605
|
* Compose context this scope would use for an intent, without running chat.
|
|
3739
1606
|
*
|
|
3740
|
-
*
|
|
1607
|
+
* Large bodies are bounded inline previews. This REST method does not expose file references
|
|
1608
|
+
* or a full-content fetch operation. Runs on the agent host, like `chat`, so a compose may take
|
|
1609
|
+
* up to 90 seconds; keep `timeoutMs` above that. A compose still running at 90 seconds fails
|
|
1610
|
+
* with `UPSTREAM_TIMEOUT` (504).
|
|
1611
|
+
*
|
|
1612
|
+
* @param scopeId - Numeric scope id.
|
|
3741
1613
|
* @param message - Natural-language intent used to select context.
|
|
3742
1614
|
* @param options.limit - Maximum context items to return. Omit to return all selected items.
|
|
3743
|
-
* @returns
|
|
1615
|
+
* @returns Composed context text plus selection counts, item UIDs, and correlation session id.
|
|
3744
1616
|
*
|
|
3745
1617
|
* @example
|
|
3746
1618
|
* ```ts
|
|
@@ -3751,64 +1623,41 @@ var ScopesResource = class {
|
|
|
3751
1623
|
* ```
|
|
3752
1624
|
*/
|
|
3753
1625
|
async getContext(scopeId, message, options = {}) {
|
|
3754
|
-
validateId(scopeId, "scope_id");
|
|
3755
|
-
const data = await invokeWithRetry(this.config, this.http, "
|
|
1626
|
+
_chunkNA3ZD35Tcjs.validateId.call(void 0, scopeId, "scope_id");
|
|
1627
|
+
const data = await _chunkNA3ZD35Tcjs.invokeWithRetry.call(void 0, this.config, this.http, "ScopeContextComposeController_compose", {
|
|
3756
1628
|
pathParams: { id: scopeId },
|
|
3757
|
-
jsonBody: omitUndefined({ message, limit: options.limit })
|
|
1629
|
+
jsonBody: _chunkNA3ZD35Tcjs.omitUndefined.call(void 0, { message, limit: options.limit })
|
|
3758
1630
|
});
|
|
3759
1631
|
return data;
|
|
3760
1632
|
}
|
|
3761
1633
|
/**
|
|
3762
|
-
*
|
|
1634
|
+
* Chat with a published scope. The reply streams live from the agent host:
|
|
1635
|
+
* iterate `textStream()` for tokens, or `await` the result for the final
|
|
1636
|
+
* answer. Pass the returned `threadId` back to continue the conversation.
|
|
3763
1637
|
*
|
|
3764
1638
|
* For the org-wide assistant use `client.modus.chat` instead.
|
|
3765
1639
|
*
|
|
3766
|
-
* @param scopeId -
|
|
1640
|
+
* @param scopeId - Numeric scope id (must be active for chat).
|
|
3767
1641
|
* @param message - User message text.
|
|
3768
|
-
* @param options.model - Required model id (e.g. `"claude-sonnet-5"`).
|
|
1642
|
+
* @param options.model - Required model id (e.g. `"claude-sonnet-5.5"`).
|
|
3769
1643
|
* @param options.threadId - Continue an existing conversation; omit to start new.
|
|
3770
|
-
* @returns
|
|
1644
|
+
* @returns A chat session — iterate it or `await` it for `content`, `threadId`, `runId`.
|
|
1645
|
+
* @throws {ModusError} When no agent host is known for a custom `baseUrl`.
|
|
3771
1646
|
*
|
|
3772
1647
|
* @example
|
|
3773
1648
|
* ```ts
|
|
3774
|
-
* const
|
|
3775
|
-
*
|
|
3776
|
-
* }
|
|
3777
|
-
* console.log(result.content, result.threadId)
|
|
1649
|
+
* const chat = client.scopes.chat(scopeId, 'What is our ARR trend?', { model: 'claude-sonnet-5.5' })
|
|
1650
|
+
* for await (const token of chat.textStream()) process.stdout.write(token)
|
|
1651
|
+
* const { threadId } = await chat
|
|
3778
1652
|
* const follow = await client.scopes.chat(scopeId, 'Break that down by segment.', {
|
|
3779
|
-
* model: 'claude-sonnet-5',
|
|
3780
|
-
* threadId
|
|
1653
|
+
* model: 'claude-sonnet-5.5',
|
|
1654
|
+
* threadId,
|
|
3781
1655
|
* })
|
|
1656
|
+
* console.log(follow.content)
|
|
3782
1657
|
* ```
|
|
3783
1658
|
*/
|
|
3784
1659
|
chat(scopeId, message, options) {
|
|
3785
|
-
return
|
|
3786
|
-
}
|
|
3787
|
-
/**
|
|
3788
|
-
* Stream a scope reply token by token (SSE).
|
|
3789
|
-
*
|
|
3790
|
-
* The request starts when you consume `textStream()` or `eventStream()`.
|
|
3791
|
-
*
|
|
3792
|
-
* @param scopeId - Scope numeric id or slug.
|
|
3793
|
-
* @param message - User message text.
|
|
3794
|
-
* @param options.model - Required model id (e.g. `"claude-sonnet-5"`).
|
|
3795
|
-
* @param options.threadId - Continue an existing conversation; omit to start new.
|
|
3796
|
-
* @param options.version - `"published"` or `"draft"`.
|
|
3797
|
-
* @returns Chat stream — iterate `textStream()` for tokens.
|
|
3798
|
-
*
|
|
3799
|
-
* @example
|
|
3800
|
-
* ```ts
|
|
3801
|
-
* const stream = client.scopes.chatStream(scopeId, 'Summarize in three bullets.', {
|
|
3802
|
-
* model: 'claude-sonnet-5',
|
|
3803
|
-
* })
|
|
3804
|
-
* for await (const token of stream.textStream()) {
|
|
3805
|
-
* process.stdout.write(token)
|
|
3806
|
-
* }
|
|
3807
|
-
* console.log(stream.getFinalResult().threadId)
|
|
3808
|
-
* ```
|
|
3809
|
-
*/
|
|
3810
|
-
chatStream(scopeId, message, options) {
|
|
3811
|
-
return chatStreamSession(this.http, this.config, "scopes", scopeId, message, options);
|
|
1660
|
+
return startChat(this.http, this.config, { kind: "scopes", id: scopeId }, message, options);
|
|
3812
1661
|
}
|
|
3813
1662
|
};
|
|
3814
1663
|
|
|
@@ -3823,7 +1672,7 @@ function suggestionListParams(options) {
|
|
|
3823
1672
|
pageSize: options.pageSize,
|
|
3824
1673
|
pageToken: options.pageToken,
|
|
3825
1674
|
scopeId: options.scopeId,
|
|
3826
|
-
scopeIds: options.scopeIds
|
|
1675
|
+
scopeIds: _optionalChain([options, 'access', _24 => _24.scopeIds, 'optionalAccess', _25 => _25.join, 'call', _26 => _26(",")])
|
|
3827
1676
|
};
|
|
3828
1677
|
}
|
|
3829
1678
|
var SuggestionsResource = class {
|
|
@@ -3838,21 +1687,24 @@ var SuggestionsResource = class {
|
|
|
3838
1687
|
* @param options.pageSize - Maximum items per page (default 5, max 12).
|
|
3839
1688
|
* @param options.pageToken - Opaque token from a previous page.
|
|
3840
1689
|
* @param options.scopeId - Filter to a single scope.
|
|
3841
|
-
* @param options.scopeIds - Filter to one or more scopes.
|
|
1690
|
+
* @param options.scopeIds - Filter to one or more scopes. An empty list throws; omit it for every scope.
|
|
3842
1691
|
* @returns A page of suggested questions.
|
|
3843
1692
|
*/
|
|
3844
1693
|
list(options = {}) {
|
|
3845
|
-
const pageSize = options.pageSize
|
|
3846
|
-
validatePageSize(pageSize, MAX_SUGGESTIONS_PAGE_SIZE);
|
|
1694
|
+
const pageSize = _nullishCoalesce(options.pageSize, () => ( DEFAULT_SUGGESTIONS_PAGE_SIZE));
|
|
1695
|
+
_chunkNA3ZD35Tcjs.validatePageSize.call(void 0, pageSize, MAX_SUGGESTIONS_PAGE_SIZE);
|
|
1696
|
+
if (_optionalChain([options, 'access', _27 => _27.scopeIds, 'optionalAccess', _28 => _28.length]) === 0) {
|
|
1697
|
+
throw new (0, _chunkNA3ZD35Tcjs.ValidationError)("scopeIds requires at least one id; omit it to list suggestions for every scope");
|
|
1698
|
+
}
|
|
3847
1699
|
return this.listPage(pageSize, options.pageToken, options.scopeId, options.scopeIds);
|
|
3848
1700
|
}
|
|
3849
1701
|
async listPage(pageSize, pageToken, scopeId, scopeIds) {
|
|
3850
|
-
const data = asRecord(
|
|
3851
|
-
await invokeWithRetry(this.config, this.http, "SuggestionsController_listApproved", {
|
|
1702
|
+
const data = _chunkNA3ZD35Tcjs.asRecord.call(void 0,
|
|
1703
|
+
await _chunkNA3ZD35Tcjs.invokeWithRetry.call(void 0, this.config, this.http, "SuggestionsController_listApproved", {
|
|
3852
1704
|
query: suggestionListParams({ pageSize, pageToken, scopeId, scopeIds })
|
|
3853
1705
|
})
|
|
3854
1706
|
);
|
|
3855
|
-
return buildAipPage(
|
|
1707
|
+
return _chunkNA3ZD35Tcjs.buildAipPage.call(void 0,
|
|
3856
1708
|
data,
|
|
3857
1709
|
"suggestions",
|
|
3858
1710
|
parseSuggestion,
|
|
@@ -3866,8 +1718,8 @@ var SuggestionsResource = class {
|
|
|
3866
1718
|
* @param event - Event details, including `eventType` (`shown`, `clicked`, `dismissed`, or `submitted`).
|
|
3867
1719
|
*/
|
|
3868
1720
|
async recordEvent(id, event) {
|
|
3869
|
-
validateId(id, "id");
|
|
3870
|
-
await invokeWithRetry(this.config, this.http, "SuggestionsController_recordEvent", {
|
|
1721
|
+
_chunkNA3ZD35Tcjs.validateId.call(void 0, id, "id");
|
|
1722
|
+
await _chunkNA3ZD35Tcjs.invokeWithRetry.call(void 0, this.config, this.http, "SuggestionsController_recordEvent", {
|
|
3871
1723
|
pathParams: { id },
|
|
3872
1724
|
jsonBody: event
|
|
3873
1725
|
});
|
|
@@ -3875,7 +1727,7 @@ var SuggestionsResource = class {
|
|
|
3875
1727
|
};
|
|
3876
1728
|
|
|
3877
1729
|
// src/index.ts
|
|
3878
|
-
var Modus = class extends ModusClientBase {
|
|
1730
|
+
var Modus = class extends _chunkNA3ZD35Tcjs.ModusClientBase {
|
|
3879
1731
|
constructor(options = {}) {
|
|
3880
1732
|
super(options);
|
|
3881
1733
|
this.scopes = new ScopesResource(this.http, this.config);
|
|
@@ -3887,27 +1739,27 @@ var Modus = class extends ModusClientBase {
|
|
|
3887
1739
|
this.ingestedData = new IngestedDataResource(this.http, this.config);
|
|
3888
1740
|
}
|
|
3889
1741
|
};
|
|
3890
|
-
|
|
3891
|
-
|
|
3892
|
-
|
|
3893
|
-
|
|
3894
|
-
|
|
3895
|
-
|
|
3896
|
-
|
|
3897
|
-
|
|
3898
|
-
|
|
3899
|
-
|
|
3900
|
-
|
|
3901
|
-
|
|
3902
|
-
|
|
3903
|
-
|
|
3904
|
-
|
|
3905
|
-
|
|
3906
|
-
|
|
3907
|
-
|
|
3908
|
-
|
|
3909
|
-
|
|
3910
|
-
|
|
3911
|
-
|
|
3912
|
-
|
|
1742
|
+
|
|
1743
|
+
|
|
1744
|
+
|
|
1745
|
+
|
|
1746
|
+
|
|
1747
|
+
|
|
1748
|
+
|
|
1749
|
+
|
|
1750
|
+
|
|
1751
|
+
|
|
1752
|
+
|
|
1753
|
+
|
|
1754
|
+
|
|
1755
|
+
|
|
1756
|
+
|
|
1757
|
+
|
|
1758
|
+
|
|
1759
|
+
|
|
1760
|
+
|
|
1761
|
+
|
|
1762
|
+
|
|
1763
|
+
|
|
1764
|
+
exports.APIConnectionError = _chunkNA3ZD35Tcjs.APIConnectionError; exports.AgentType = AgentType; exports.AuthenticationError = _chunkNA3ZD35Tcjs.AuthenticationError; exports.BadRequestError = _chunkNA3ZD35Tcjs.BadRequestError; exports.ChatSession = ChatSession; exports.ConflictError = _chunkNA3ZD35Tcjs.ConflictError; exports.InternalServerError = _chunkNA3ZD35Tcjs.InternalServerError; exports.Modus = Modus; exports.ModusError = _chunkNA3ZD35Tcjs.ModusError; exports.NotFoundError = _chunkNA3ZD35Tcjs.NotFoundError; exports.OPERATIONS = _chunkNA3ZD35Tcjs.OPERATIONS; exports.Page = _chunkNA3ZD35Tcjs.Page; exports.PermissionDeniedError = _chunkNA3ZD35Tcjs.PermissionDeniedError; exports.RateLimitError = _chunkNA3ZD35Tcjs.RateLimitError; exports.RunCancelledError = _chunkNA3ZD35Tcjs.RunCancelledError; exports.StreamTimeoutError = _chunkNA3ZD35Tcjs.StreamTimeoutError; exports.UnprocessableError = _chunkNA3ZD35Tcjs.UnprocessableError; exports.ValidationError = _chunkNA3ZD35Tcjs.ValidationError; exports.WorkflowType = WorkflowType; exports.conversationScopeId = conversationScopeId; exports.conversationSkillId = conversationSkillId;
|
|
3913
1765
|
//# sourceMappingURL=index.cjs.map
|