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