@getmodus/sdk 0.6.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +128 -4
- package/README.md +28 -1
- package/dist/{chunk-HEHHN4D6.js → chunk-GFS7CNON.js} +418 -26
- package/dist/chunk-GFS7CNON.js.map +1 -0
- package/dist/{conversations-BRg8gEKX.d.cts → conversations-COA6NW8I.d.cts} +11987 -3565
- package/dist/{conversations-BRg8gEKX.d.ts → conversations-COA6NW8I.d.ts} +11987 -3565
- package/dist/index.cjs +756 -79
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +409 -58
- package/dist/index.d.ts +409 -58
- package/dist/index.js +340 -55
- package/dist/index.js.map +1 -1
- package/dist/management/index.cjs +1443 -106
- package/dist/management/index.cjs.map +1 -1
- package/dist/management/index.d.cts +729 -12
- package/dist/management/index.d.ts +729 -12
- package/dist/management/index.js +1001 -50
- package/dist/management/index.js.map +1 -1
- package/package.json +3 -4
- package/dist/chunk-HEHHN4D6.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -85,6 +85,26 @@ var OPERATIONS = {
|
|
|
85
85
|
requestSchema: "CreateSavedQueryDto",
|
|
86
86
|
responseSchema: "CreatedContextItemResponseDto"
|
|
87
87
|
},
|
|
88
|
+
"ContextFilesController_finalize": {
|
|
89
|
+
method: "POST",
|
|
90
|
+
path: "/api/v1/context/files/{uploadId}/finalize",
|
|
91
|
+
service: "modus-api",
|
|
92
|
+
serverUrl: "https://api.getmodus.com",
|
|
93
|
+
pathParams: ["uploadId"],
|
|
94
|
+
queryParams: [],
|
|
95
|
+
requestSchema: "FinalizeUploadDto",
|
|
96
|
+
responseSchema: "FileUploadResourceDto"
|
|
97
|
+
},
|
|
98
|
+
"ContextFilesController_finalizeMany": {
|
|
99
|
+
method: "POST",
|
|
100
|
+
path: "/api/v1/context/files/finalize",
|
|
101
|
+
service: "modus-api",
|
|
102
|
+
serverUrl: "https://api.getmodus.com",
|
|
103
|
+
pathParams: [],
|
|
104
|
+
queryParams: [],
|
|
105
|
+
requestSchema: "BulkFinalizeDto",
|
|
106
|
+
responseSchema: "BulkFinalizeResponseDto"
|
|
107
|
+
},
|
|
88
108
|
"ContextFilesController_get": {
|
|
89
109
|
method: "GET",
|
|
90
110
|
path: "/api/v1/context/files/{uploadId}",
|
|
@@ -171,7 +191,7 @@ var OPERATIONS = {
|
|
|
171
191
|
service: "modus-api",
|
|
172
192
|
serverUrl: "https://api.getmodus.com",
|
|
173
193
|
pathParams: [],
|
|
174
|
-
queryParams: ["pageToken", "pageSize", "contextTypes", "verificationStatuses", "searchQuery", "topics"],
|
|
194
|
+
queryParams: ["pageToken", "pageSize", "contextTypes", "verificationStatuses", "searchQuery", "topics", "connectionIds", "parentUids", "ancestorUids"],
|
|
175
195
|
requestSchema: null,
|
|
176
196
|
responseSchema: "ListContextItemsResponseDto"
|
|
177
197
|
},
|
|
@@ -195,6 +215,16 @@ var OPERATIONS = {
|
|
|
195
215
|
requestSchema: "LookupContextItemDto",
|
|
196
216
|
responseSchema: "LookupContextItemResponseDto"
|
|
197
217
|
},
|
|
218
|
+
"ContextItemsController_move": {
|
|
219
|
+
method: "POST",
|
|
220
|
+
path: "/api/v1/context/items/{uid}/move",
|
|
221
|
+
service: "modus-api",
|
|
222
|
+
serverUrl: "https://api.getmodus.com",
|
|
223
|
+
pathParams: ["uid"],
|
|
224
|
+
queryParams: [],
|
|
225
|
+
requestSchema: "MoveContextItemDto",
|
|
226
|
+
responseSchema: "MoveContextItemResponseDto"
|
|
227
|
+
},
|
|
198
228
|
"ContextItemsController_update": {
|
|
199
229
|
method: "PATCH",
|
|
200
230
|
path: "/api/v1/context/items/{uid}",
|
|
@@ -225,6 +255,16 @@ var OPERATIONS = {
|
|
|
225
255
|
requestSchema: "CreateCustomContextItemDto",
|
|
226
256
|
responseSchema: "CreatedCustomContextItemResponseDto"
|
|
227
257
|
},
|
|
258
|
+
"CustomContextItemsController_createRelations": {
|
|
259
|
+
method: "POST",
|
|
260
|
+
path: "/api/v1/context/custom-items/relations",
|
|
261
|
+
service: "modus-api",
|
|
262
|
+
serverUrl: "https://api.getmodus.com",
|
|
263
|
+
pathParams: [],
|
|
264
|
+
queryParams: [],
|
|
265
|
+
requestSchema: "BatchCreateCustomContextItemRelationsDto",
|
|
266
|
+
responseSchema: "BatchCreateCustomContextItemRelationsResponseDto"
|
|
267
|
+
},
|
|
228
268
|
"CustomContextItemsController_delete": {
|
|
229
269
|
method: "DELETE",
|
|
230
270
|
path: "/api/v1/context/custom-items/{uid}",
|
|
@@ -265,6 +305,196 @@ var OPERATIONS = {
|
|
|
265
305
|
requestSchema: "UpdateCustomContextItemDto",
|
|
266
306
|
responseSchema: null
|
|
267
307
|
},
|
|
308
|
+
"DashboardsController_acceptOwnership": {
|
|
309
|
+
method: "POST",
|
|
310
|
+
path: "/api/v1/context/dashboards/{dashboardId}/transfer-ownership/accept",
|
|
311
|
+
service: "modus-api",
|
|
312
|
+
serverUrl: "https://api.getmodus.com",
|
|
313
|
+
pathParams: ["dashboardId"],
|
|
314
|
+
queryParams: [],
|
|
315
|
+
requestSchema: null,
|
|
316
|
+
responseSchema: "DashboardDto"
|
|
317
|
+
},
|
|
318
|
+
"DashboardsController_cancelOwnership": {
|
|
319
|
+
method: "DELETE",
|
|
320
|
+
path: "/api/v1/context/dashboards/{dashboardId}/transfer-ownership",
|
|
321
|
+
service: "modus-api",
|
|
322
|
+
serverUrl: "https://api.getmodus.com",
|
|
323
|
+
pathParams: ["dashboardId"],
|
|
324
|
+
queryParams: [],
|
|
325
|
+
requestSchema: null,
|
|
326
|
+
responseSchema: "DashboardDto"
|
|
327
|
+
},
|
|
328
|
+
"DashboardsController_create": {
|
|
329
|
+
method: "POST",
|
|
330
|
+
path: "/api/v1/context/dashboards",
|
|
331
|
+
service: "modus-api",
|
|
332
|
+
serverUrl: "https://api.getmodus.com",
|
|
333
|
+
pathParams: [],
|
|
334
|
+
queryParams: [],
|
|
335
|
+
requestSchema: "CreateDashboardDto",
|
|
336
|
+
responseSchema: "DashboardDto"
|
|
337
|
+
},
|
|
338
|
+
"DashboardsController_createElement": {
|
|
339
|
+
method: "POST",
|
|
340
|
+
path: "/api/v1/context/dashboards/{dashboardId}/elements",
|
|
341
|
+
service: "modus-api",
|
|
342
|
+
serverUrl: "https://api.getmodus.com",
|
|
343
|
+
pathParams: ["dashboardId"],
|
|
344
|
+
queryParams: [],
|
|
345
|
+
requestSchema: "CreateDashboardElementDto",
|
|
346
|
+
responseSchema: "DashboardElementResponseDto"
|
|
347
|
+
},
|
|
348
|
+
"DashboardsController_delete": {
|
|
349
|
+
method: "DELETE",
|
|
350
|
+
path: "/api/v1/context/dashboards/{dashboardId}",
|
|
351
|
+
service: "modus-api",
|
|
352
|
+
serverUrl: "https://api.getmodus.com",
|
|
353
|
+
pathParams: ["dashboardId"],
|
|
354
|
+
queryParams: [],
|
|
355
|
+
requestSchema: null,
|
|
356
|
+
responseSchema: null
|
|
357
|
+
},
|
|
358
|
+
"DashboardsController_get": {
|
|
359
|
+
method: "GET",
|
|
360
|
+
path: "/api/v1/context/dashboards/{dashboardId}",
|
|
361
|
+
service: "modus-api",
|
|
362
|
+
serverUrl: "https://api.getmodus.com",
|
|
363
|
+
pathParams: ["dashboardId"],
|
|
364
|
+
queryParams: ["view"],
|
|
365
|
+
requestSchema: null,
|
|
366
|
+
responseSchema: "DashboardDto"
|
|
367
|
+
},
|
|
368
|
+
"DashboardsController_getElement": {
|
|
369
|
+
method: "GET",
|
|
370
|
+
path: "/api/v1/context/dashboards/{dashboardId}/elements/{elementId}",
|
|
371
|
+
service: "modus-api",
|
|
372
|
+
serverUrl: "https://api.getmodus.com",
|
|
373
|
+
pathParams: ["dashboardId", "elementId"],
|
|
374
|
+
queryParams: [],
|
|
375
|
+
requestSchema: null,
|
|
376
|
+
responseSchema: "DashboardElementResponseDto"
|
|
377
|
+
},
|
|
378
|
+
"DashboardsController_getVersion": {
|
|
379
|
+
method: "GET",
|
|
380
|
+
path: "/api/v1/context/dashboards/{dashboardId}/versions/{versionId}",
|
|
381
|
+
service: "modus-api",
|
|
382
|
+
serverUrl: "https://api.getmodus.com",
|
|
383
|
+
pathParams: ["dashboardId", "versionId"],
|
|
384
|
+
queryParams: [],
|
|
385
|
+
requestSchema: null,
|
|
386
|
+
responseSchema: "DashboardDto"
|
|
387
|
+
},
|
|
388
|
+
"DashboardsController_list": {
|
|
389
|
+
method: "GET",
|
|
390
|
+
path: "/api/v1/context/dashboards",
|
|
391
|
+
service: "modus-api",
|
|
392
|
+
serverUrl: "https://api.getmodus.com",
|
|
393
|
+
pathParams: [],
|
|
394
|
+
queryParams: ["view"],
|
|
395
|
+
requestSchema: null,
|
|
396
|
+
responseSchema: "ListDashboardsResponseDto"
|
|
397
|
+
},
|
|
398
|
+
"DashboardsController_listDraftSnapshots": {
|
|
399
|
+
method: "GET",
|
|
400
|
+
path: "/api/v1/context/dashboards/{dashboardId}/draft-snapshots",
|
|
401
|
+
service: "modus-api",
|
|
402
|
+
serverUrl: "https://api.getmodus.com",
|
|
403
|
+
pathParams: ["dashboardId"],
|
|
404
|
+
queryParams: [],
|
|
405
|
+
requestSchema: null,
|
|
406
|
+
responseSchema: "ListDashboardDraftSnapshotsResponseDto"
|
|
407
|
+
},
|
|
408
|
+
"DashboardsController_listElements": {
|
|
409
|
+
method: "GET",
|
|
410
|
+
path: "/api/v1/context/dashboards/{dashboardId}/elements",
|
|
411
|
+
service: "modus-api",
|
|
412
|
+
serverUrl: "https://api.getmodus.com",
|
|
413
|
+
pathParams: ["dashboardId"],
|
|
414
|
+
queryParams: [],
|
|
415
|
+
requestSchema: null,
|
|
416
|
+
responseSchema: "DashboardElementsListResponseDto"
|
|
417
|
+
},
|
|
418
|
+
"DashboardsController_listVersions": {
|
|
419
|
+
method: "GET",
|
|
420
|
+
path: "/api/v1/context/dashboards/{dashboardId}/versions",
|
|
421
|
+
service: "modus-api",
|
|
422
|
+
serverUrl: "https://api.getmodus.com",
|
|
423
|
+
pathParams: ["dashboardId"],
|
|
424
|
+
queryParams: [],
|
|
425
|
+
requestSchema: null,
|
|
426
|
+
responseSchema: "ListDashboardVersionsResponseDto"
|
|
427
|
+
},
|
|
428
|
+
"DashboardsController_publish": {
|
|
429
|
+
method: "POST",
|
|
430
|
+
path: "/api/v1/context/dashboards/{dashboardId}/publish",
|
|
431
|
+
service: "modus-api",
|
|
432
|
+
serverUrl: "https://api.getmodus.com",
|
|
433
|
+
pathParams: ["dashboardId"],
|
|
434
|
+
queryParams: [],
|
|
435
|
+
requestSchema: "PublishDashboardDto",
|
|
436
|
+
responseSchema: "PublishDashboardResponseDto"
|
|
437
|
+
},
|
|
438
|
+
"DashboardsController_restore": {
|
|
439
|
+
method: "POST",
|
|
440
|
+
path: "/api/v1/context/dashboards/{dashboardId}/versions/{versionId}/restore",
|
|
441
|
+
service: "modus-api",
|
|
442
|
+
serverUrl: "https://api.getmodus.com",
|
|
443
|
+
pathParams: ["dashboardId", "versionId"],
|
|
444
|
+
queryParams: [],
|
|
445
|
+
requestSchema: null,
|
|
446
|
+
responseSchema: "DashboardDto"
|
|
447
|
+
},
|
|
448
|
+
"DashboardsController_transferOwnership": {
|
|
449
|
+
method: "POST",
|
|
450
|
+
path: "/api/v1/context/dashboards/{dashboardId}/transfer-ownership",
|
|
451
|
+
service: "modus-api",
|
|
452
|
+
serverUrl: "https://api.getmodus.com",
|
|
453
|
+
pathParams: ["dashboardId"],
|
|
454
|
+
queryParams: [],
|
|
455
|
+
requestSchema: "TransferDashboardOwnershipDto",
|
|
456
|
+
responseSchema: "DashboardDto"
|
|
457
|
+
},
|
|
458
|
+
"DashboardsController_updateAccess": {
|
|
459
|
+
method: "PATCH",
|
|
460
|
+
path: "/api/v1/context/dashboards/{dashboardId}/access",
|
|
461
|
+
service: "modus-api",
|
|
462
|
+
serverUrl: "https://api.getmodus.com",
|
|
463
|
+
pathParams: ["dashboardId"],
|
|
464
|
+
queryParams: [],
|
|
465
|
+
requestSchema: "UpdateDashboardAccessDto",
|
|
466
|
+
responseSchema: "DashboardDto"
|
|
467
|
+
},
|
|
468
|
+
"DashboardsController_updateDraft": {
|
|
469
|
+
method: "PATCH",
|
|
470
|
+
path: "/api/v1/context/dashboards/{dashboardId}/draft",
|
|
471
|
+
service: "modus-api",
|
|
472
|
+
serverUrl: "https://api.getmodus.com",
|
|
473
|
+
pathParams: ["dashboardId"],
|
|
474
|
+
queryParams: [],
|
|
475
|
+
requestSchema: "UpdateDashboardDraftDto",
|
|
476
|
+
responseSchema: "DashboardDto"
|
|
477
|
+
},
|
|
478
|
+
"DashboardsController_updateElement": {
|
|
479
|
+
method: "PATCH",
|
|
480
|
+
path: "/api/v1/context/dashboards/{dashboardId}/elements/{elementId}",
|
|
481
|
+
service: "modus-api",
|
|
482
|
+
serverUrl: "https://api.getmodus.com",
|
|
483
|
+
pathParams: ["dashboardId", "elementId"],
|
|
484
|
+
queryParams: [],
|
|
485
|
+
requestSchema: "UpdateDashboardElementDto",
|
|
486
|
+
responseSchema: "DashboardDto"
|
|
487
|
+
},
|
|
488
|
+
"DashboardsController_updateLayout": {
|
|
489
|
+
method: "PATCH",
|
|
490
|
+
path: "/api/v1/context/dashboards/{dashboardId}/layout",
|
|
491
|
+
service: "modus-api",
|
|
492
|
+
serverUrl: "https://api.getmodus.com",
|
|
493
|
+
pathParams: ["dashboardId"],
|
|
494
|
+
queryParams: [],
|
|
495
|
+
requestSchema: "UpdateDashboardLayoutDto",
|
|
496
|
+
responseSchema: "DashboardDto"
|
|
497
|
+
},
|
|
268
498
|
"EvaluationsController_getConfig": {
|
|
269
499
|
method: "GET",
|
|
270
500
|
path: "/api/v1/scopes/{id}/evaluations/config",
|
|
@@ -315,6 +545,16 @@ var OPERATIONS = {
|
|
|
315
545
|
requestSchema: "UpdateEvaluationConfigDto",
|
|
316
546
|
responseSchema: "EvaluationConfigDto"
|
|
317
547
|
},
|
|
548
|
+
"IngestedDataController_upload": {
|
|
549
|
+
method: "POST",
|
|
550
|
+
path: "/api/v1/ingested-data",
|
|
551
|
+
service: "modus-api",
|
|
552
|
+
serverUrl: "https://api.getmodus.com",
|
|
553
|
+
pathParams: [],
|
|
554
|
+
queryParams: [],
|
|
555
|
+
requestSchema: "CreateIngestedDataDto",
|
|
556
|
+
responseSchema: "CreatedIngestedDataResponseDto"
|
|
557
|
+
},
|
|
318
558
|
"MemberGroupsController_list": {
|
|
319
559
|
method: "GET",
|
|
320
560
|
path: "/api/v1/users/member-groups",
|
|
@@ -371,7 +611,7 @@ var OPERATIONS = {
|
|
|
371
611
|
service: "modus-api",
|
|
372
612
|
serverUrl: "https://api.getmodus.com",
|
|
373
613
|
pathParams: [],
|
|
374
|
-
queryParams: ["pageToken", "page", "pageSize", "userId", "toolName", "source", "timeframe", "includeTools", "kind"],
|
|
614
|
+
queryParams: ["pageToken", "page", "pageSize", "userId", "toolName", "source", "sourceRef", "timeframe", "includeTools", "kind"],
|
|
375
615
|
requestSchema: null,
|
|
376
616
|
responseSchema: "ListConversationsResponseDto"
|
|
377
617
|
},
|
|
@@ -521,10 +761,50 @@ var OPERATIONS = {
|
|
|
521
761
|
service: "modus-api",
|
|
522
762
|
serverUrl: "https://api.getmodus.com",
|
|
523
763
|
pathParams: ["id"],
|
|
524
|
-
queryParams: ["pageToken", "page", "pageSize", "userId", "toolName", "source", "timeframe", "includeTools"],
|
|
764
|
+
queryParams: ["pageToken", "page", "pageSize", "userId", "toolName", "source", "sourceRef", "timeframe", "includeTools"],
|
|
525
765
|
requestSchema: null,
|
|
526
766
|
responseSchema: "ListConversationsResponseDto"
|
|
527
767
|
},
|
|
768
|
+
"ScopeInterfacesController_add": {
|
|
769
|
+
method: "POST",
|
|
770
|
+
path: "/api/v1/scopes/{id}/interfaces",
|
|
771
|
+
service: "modus-api",
|
|
772
|
+
serverUrl: "https://api.getmodus.com",
|
|
773
|
+
pathParams: ["id"],
|
|
774
|
+
queryParams: [],
|
|
775
|
+
requestSchema: "AddScopeInterfaceDto",
|
|
776
|
+
responseSchema: "ScopeInterfaceDto"
|
|
777
|
+
},
|
|
778
|
+
"ScopeInterfacesController_delete": {
|
|
779
|
+
method: "DELETE",
|
|
780
|
+
path: "/api/v1/scopes/{id}/interfaces/{interfaceId}",
|
|
781
|
+
service: "modus-api",
|
|
782
|
+
serverUrl: "https://api.getmodus.com",
|
|
783
|
+
pathParams: ["id", "interfaceId"],
|
|
784
|
+
queryParams: [],
|
|
785
|
+
requestSchema: null,
|
|
786
|
+
responseSchema: null
|
|
787
|
+
},
|
|
788
|
+
"ScopeInterfacesController_list": {
|
|
789
|
+
method: "GET",
|
|
790
|
+
path: "/api/v1/scopes/{id}/interfaces",
|
|
791
|
+
service: "modus-api",
|
|
792
|
+
serverUrl: "https://api.getmodus.com",
|
|
793
|
+
pathParams: ["id"],
|
|
794
|
+
queryParams: [],
|
|
795
|
+
requestSchema: null,
|
|
796
|
+
responseSchema: "ListScopeInterfacesResponseDto"
|
|
797
|
+
},
|
|
798
|
+
"ScopeInterfacesController_update": {
|
|
799
|
+
method: "PATCH",
|
|
800
|
+
path: "/api/v1/scopes/{id}/interfaces/{interfaceId}",
|
|
801
|
+
service: "modus-api",
|
|
802
|
+
serverUrl: "https://api.getmodus.com",
|
|
803
|
+
pathParams: ["id", "interfaceId"],
|
|
804
|
+
queryParams: ["updateMask"],
|
|
805
|
+
requestSchema: "UpdateScopeInterfaceDto",
|
|
806
|
+
responseSchema: "ScopeInterfaceDto"
|
|
807
|
+
},
|
|
528
808
|
"ScopeMemoriesController_delete": {
|
|
529
809
|
method: "DELETE",
|
|
530
810
|
path: "/api/v1/scopes/{id}/memories/{memoryId}",
|
|
@@ -1165,16 +1445,29 @@ var WRITE_BODY_ALLOWED_KEYS = {
|
|
|
1165
1445
|
ContextCreatorsController_createLink: ["url", "title", "isCrawl", "pageLimit"],
|
|
1166
1446
|
ContextCreatorsController_createNote: ["title", "content"],
|
|
1167
1447
|
ContextCreatorsController_createSavedQuery: ["name", "connectionId", "query", "description", "path"],
|
|
1168
|
-
|
|
1448
|
+
ContextFilesController_finalize: ["fileName", "folderPath"],
|
|
1449
|
+
ContextFilesController_finalizeMany: ["uploads"],
|
|
1450
|
+
ContextFilesController_uploadFromUrl: ["url", "fileName", "folderPath"],
|
|
1169
1451
|
ContextFilesController_uploadFromUrls: ["urls"],
|
|
1170
1452
|
ContextFilesController_uploadUrl: ["fileName", "contentType", "fileSize"],
|
|
1171
1453
|
ContextFilesController_uploadUrls: ["files"],
|
|
1172
1454
|
ContextItemsController_lookup: ["contextType", "dataPath", "contentProjection"],
|
|
1455
|
+
ContextItemsController_move: ["destinationFolderUid"],
|
|
1173
1456
|
ContextItemsController_update: ["contextType", "content", "description", "userFeedback", "topics"],
|
|
1174
1457
|
CustomContextItemsController_batchCreate: ["items"],
|
|
1175
1458
|
CustomContextItemsController_create: ["kind", "sourceId", "sourceName", "collectionId", "collectionName", "externalId", "fieldName", "name", "entityType", "description", "content", "url", "attributes", "dataType", "value", "samples", "raw", "topics", "idempotencyKey", "access"],
|
|
1459
|
+
CustomContextItemsController_createRelations: ["relations"],
|
|
1176
1460
|
CustomContextItemsController_update: ["name", "entityType", "description", "content", "url", "attributes", "dataType", "value", "samples", "raw", "topics"],
|
|
1461
|
+
DashboardsController_create: ["title", "description", "definition", "access"],
|
|
1462
|
+
DashboardsController_createElement: ["expectedRevision", "kind", "title", "layout"],
|
|
1463
|
+
DashboardsController_publish: ["expectedRevision"],
|
|
1464
|
+
DashboardsController_transferOwnership: ["newOwnerUserId"],
|
|
1465
|
+
DashboardsController_updateAccess: ["visibility", "groupPermissions", "sharedWith"],
|
|
1466
|
+
DashboardsController_updateDraft: ["expectedRevision", "title", "description", "definition"],
|
|
1467
|
+
DashboardsController_updateElement: ["expectedRevision", "patch"],
|
|
1468
|
+
DashboardsController_updateLayout: ["expectedRevision", "elements"],
|
|
1177
1469
|
EvaluationsController_updateConfig: ["enabled", "cadence", "judgeModel", "judgeGuidance", "notifications"],
|
|
1470
|
+
IngestedDataController_upload: ["integration_type", "request", "response"],
|
|
1178
1471
|
ModusChatController_chat: ["message", "model"],
|
|
1179
1472
|
ModusContextController_compose: ["message", "limit"],
|
|
1180
1473
|
ModusRunsController_create: ["message", "sessionId", "organizationId", "version", "fileThreadId", "config", "attachments", "userContext", "source", "runId", "subordinateSkillIds"],
|
|
@@ -1185,11 +1478,13 @@ var WRITE_BODY_ALLOWED_KEYS = {
|
|
|
1185
1478
|
RunLifecycleController_interrupt: [],
|
|
1186
1479
|
ScopeChatController_chat: ["message", "model"],
|
|
1187
1480
|
ScopeContextController_compose: ["message", "limit"],
|
|
1481
|
+
ScopeInterfacesController_add: ["type", "name", "config"],
|
|
1482
|
+
ScopeInterfacesController_update: ["name", "config"],
|
|
1188
1483
|
ScopeMemoriesController_search: ["query", "userId", "limit"],
|
|
1189
1484
|
ScopeMemoriesController_update: ["memory", "metadata"],
|
|
1190
1485
|
ScopeRunsController_create: ["message", "sessionId", "organizationId", "version", "fileThreadId", "config", "attachments", "userContext", "source", "runId", "subordinateSkillIds"],
|
|
1191
1486
|
ScopesController_acceptOwnershipTransfer: [],
|
|
1192
|
-
ScopesController_create: ["name", "description", "expectedOutput", "instructions", "toolset", "model", "connectionSet", "contextSelections", "interfaces", "accessConfig"],
|
|
1487
|
+
ScopesController_create: ["name", "description", "expectedOutput", "instructions", "toolset", "model", "connectionSet", "contextSelections", "includeOwnLearnings", "interfaces", "accessConfig"],
|
|
1193
1488
|
ScopesController_deploy: [],
|
|
1194
1489
|
ScopesController_patchMcpConfig: ["config"],
|
|
1195
1490
|
ScopesController_requestOwnershipTransfer: ["newOwnerUserId"],
|
|
@@ -1229,11 +1524,15 @@ function validateId(resourceId, name = "id") {
|
|
|
1229
1524
|
}
|
|
1230
1525
|
var ALLOWED_CHAT_MODELS = /* @__PURE__ */ new Set([
|
|
1231
1526
|
"claude-sonnet-5",
|
|
1527
|
+
"claude-sonnet-5.5",
|
|
1232
1528
|
"claude-sonnet-4.6",
|
|
1233
1529
|
"claude-opus-4.8",
|
|
1530
|
+
"claude-opus-5.5",
|
|
1234
1531
|
"gpt-5.2",
|
|
1235
1532
|
"gpt-5.5",
|
|
1236
1533
|
"gpt-5-mini",
|
|
1534
|
+
"gpt-5.6-luna",
|
|
1535
|
+
"gpt-6-luna",
|
|
1237
1536
|
"gpt-oss-120b",
|
|
1238
1537
|
"gpt-oss-20b",
|
|
1239
1538
|
"qwen3-235b-a22b-2507",
|
|
@@ -1249,7 +1548,9 @@ var ALLOWED_CHAT_MODELS = /* @__PURE__ */ new Set([
|
|
|
1249
1548
|
"gemini-3.1-pro-preview",
|
|
1250
1549
|
"gemini-3-flash-preview",
|
|
1251
1550
|
"grok-4.3-fast",
|
|
1252
|
-
"grok-4.3"
|
|
1551
|
+
"grok-4.3",
|
|
1552
|
+
"grok-4.7",
|
|
1553
|
+
"kimi-k3"
|
|
1253
1554
|
]);
|
|
1254
1555
|
function validateChatModel(model) {
|
|
1255
1556
|
if (!ALLOWED_CHAT_MODELS.has(model)) {
|
|
@@ -1650,6 +1951,7 @@ function createModusConfig(options = {}) {
|
|
|
1650
1951
|
}),
|
|
1651
1952
|
timeoutMs: resolveTimeoutMs(options.timeoutMs) ?? DEFAULT_TIMEOUT_MS,
|
|
1652
1953
|
maxRetries,
|
|
1954
|
+
defaultHeaders: Object.freeze({ ...options.defaultHeaders }),
|
|
1653
1955
|
fetch: options.fetch ?? globalThis.fetch.bind(globalThis)
|
|
1654
1956
|
});
|
|
1655
1957
|
}
|
|
@@ -1665,7 +1967,7 @@ function formatConfigForLog(config) {
|
|
|
1665
1967
|
}
|
|
1666
1968
|
|
|
1667
1969
|
// src/_http.ts
|
|
1668
|
-
var USER_AGENT = `modus-typescript/${"0.
|
|
1970
|
+
var USER_AGENT = `modus-typescript/${"0.8.0"} (node/${process.version}; ${process.platform})`;
|
|
1669
1971
|
function buildUrl(baseUrl, path, params) {
|
|
1670
1972
|
const url = new URL(path.startsWith("/") ? path : `/${path}`, baseUrl);
|
|
1671
1973
|
if (params) {
|
|
@@ -1680,6 +1982,15 @@ function buildUrl(baseUrl, path, params) {
|
|
|
1680
1982
|
}
|
|
1681
1983
|
return url.toString();
|
|
1682
1984
|
}
|
|
1985
|
+
function mergeHeaders(...layers) {
|
|
1986
|
+
const merged = /* @__PURE__ */ new Map();
|
|
1987
|
+
for (const layer of layers) {
|
|
1988
|
+
for (const [name, value] of Object.entries(layer ?? {})) {
|
|
1989
|
+
merged.set(name.toLowerCase(), [name, value]);
|
|
1990
|
+
}
|
|
1991
|
+
}
|
|
1992
|
+
return Object.fromEntries(merged.values());
|
|
1993
|
+
}
|
|
1683
1994
|
function headersToRecord(headers) {
|
|
1684
1995
|
const out = {};
|
|
1685
1996
|
headers.forEach((value, key) => {
|
|
@@ -1785,12 +2096,15 @@ var HttpClient = class {
|
|
|
1785
2096
|
this.config = config;
|
|
1786
2097
|
}
|
|
1787
2098
|
defaultHeaders() {
|
|
1788
|
-
return
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
2099
|
+
return mergeHeaders(
|
|
2100
|
+
{
|
|
2101
|
+
Accept: "application/json",
|
|
2102
|
+
"Content-Type": "application/json",
|
|
2103
|
+
"User-Agent": USER_AGENT,
|
|
2104
|
+
"X-Modus-Client": "sdk"
|
|
2105
|
+
},
|
|
2106
|
+
this.config.defaultHeaders
|
|
2107
|
+
);
|
|
1794
2108
|
}
|
|
1795
2109
|
async request(method, path, options = {}) {
|
|
1796
2110
|
const baseUrl = options.baseUrl ?? this.config.baseUrl;
|
|
@@ -1798,7 +2112,7 @@ var HttpClient = class {
|
|
|
1798
2112
|
try {
|
|
1799
2113
|
const response = await this.config.fetch(url, {
|
|
1800
2114
|
method,
|
|
1801
|
-
headers:
|
|
2115
|
+
headers: mergeHeaders(this.defaultHeaders(), options.headers, authHeaders(this.config.apiKey)),
|
|
1802
2116
|
body: options.json !== void 0 ? JSON.stringify(options.json) : void 0,
|
|
1803
2117
|
signal: AbortSignal.timeout(this.config.timeoutMs)
|
|
1804
2118
|
});
|
|
@@ -1837,11 +2151,12 @@ var HttpClient = class {
|
|
|
1837
2151
|
method,
|
|
1838
2152
|
// Agent-service negotiates SSE vs JSON polling on Accept; JSON-only
|
|
1839
2153
|
// Accept returns {"runId","status":"pending"} instead of token SSE.
|
|
1840
|
-
headers:
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
Accept: "text/event-stream"
|
|
1844
|
-
|
|
2154
|
+
headers: mergeHeaders(
|
|
2155
|
+
this.defaultHeaders(),
|
|
2156
|
+
options.headers,
|
|
2157
|
+
{ Accept: "text/event-stream" },
|
|
2158
|
+
authHeaders(this.config.apiKey)
|
|
2159
|
+
),
|
|
1845
2160
|
body: options.json !== void 0 ? JSON.stringify(options.json) : void 0,
|
|
1846
2161
|
signal: AbortSignal.timeout(this.config.timeoutMs)
|
|
1847
2162
|
});
|
|
@@ -2092,7 +2407,16 @@ var WorkflowRunsResource = class {
|
|
|
2092
2407
|
* @param options.timeframe - Filter by recency (`last_hour`, `last_day`, or `last_week`).
|
|
2093
2408
|
* @param options.approvalScope - Filter approval-related runs (`mine` or `all`).
|
|
2094
2409
|
* @param options.search - Free-text search filter.
|
|
2095
|
-
* @returns A page of run summaries.
|
|
2410
|
+
* @returns A page of run summaries — use `.autoPagingIter()` for all pages.
|
|
2411
|
+
*
|
|
2412
|
+
* @example
|
|
2413
|
+
* ```ts
|
|
2414
|
+
* for await (const run of (
|
|
2415
|
+
* await client.workflows.runs.list(workflowId, { status: 'completed' })
|
|
2416
|
+
* ).autoPagingIter()) {
|
|
2417
|
+
* console.log(run.workflowId, run.status, run.startedAt)
|
|
2418
|
+
* }
|
|
2419
|
+
* ```
|
|
2096
2420
|
*/
|
|
2097
2421
|
list(workflowId, options = {}) {
|
|
2098
2422
|
validateId(workflowId, "workflow_id");
|
|
@@ -2132,10 +2456,16 @@ var WorkflowRunsResource = class {
|
|
|
2132
2456
|
* Retrieve a workflow run by id.
|
|
2133
2457
|
*
|
|
2134
2458
|
* @param workflowId - Workflow id or slug the run belongs to.
|
|
2135
|
-
* @param runId - Run id.
|
|
2459
|
+
* @param runId - Run id (the list row's `workflowId` field, not the composite `id`).
|
|
2136
2460
|
* @param options.temporalRunId - Optional internal execution id when disambiguating retries.
|
|
2137
2461
|
* @returns Run details including status and output.
|
|
2138
2462
|
* @throws {NotFoundError} When the run does not exist.
|
|
2463
|
+
*
|
|
2464
|
+
* @example
|
|
2465
|
+
* ```ts
|
|
2466
|
+
* const run = await client.workflows.runs.get(workflowId, runId)
|
|
2467
|
+
* console.log(run.status)
|
|
2468
|
+
* ```
|
|
2139
2469
|
*/
|
|
2140
2470
|
async get(workflowId, runId, options = {}) {
|
|
2141
2471
|
validateId(workflowId, "workflow_id");
|
|
@@ -2158,8 +2488,8 @@ var WorkflowRunsResource = class {
|
|
|
2158
2488
|
* @example
|
|
2159
2489
|
* ```ts
|
|
2160
2490
|
* const stream = client.workflows.runs.create(workflowId, {
|
|
2161
|
-
* message:
|
|
2162
|
-
*
|
|
2491
|
+
* message: "Summarize yesterday's sales",
|
|
2492
|
+
* config: { model: 'claude-sonnet-5' },
|
|
2163
2493
|
* })
|
|
2164
2494
|
* for await (const event of stream) {
|
|
2165
2495
|
* if (event.type === 'token') process.stdout.write(event.content)
|
|
@@ -2174,21 +2504,45 @@ var WorkflowRunsResource = class {
|
|
|
2174
2504
|
/**
|
|
2175
2505
|
* Start a scope run and stream run events.
|
|
2176
2506
|
*
|
|
2507
|
+
* Same event stream shape as {@link create}, but targets a published scope.
|
|
2508
|
+
*
|
|
2177
2509
|
* @param scopeId - Scope id to run.
|
|
2178
2510
|
* @param body - Run body (`message`, optional `sessionId`, optional `version` as `published` or `draft`).
|
|
2179
2511
|
* @param options.idempotencyKey - Client-supplied idempotency key; defaults to `body.runId` or a new uuid.
|
|
2180
2512
|
* @returns A stream of run events.
|
|
2513
|
+
*
|
|
2514
|
+
* @example
|
|
2515
|
+
* ```ts
|
|
2516
|
+
* const stream = client.workflows.runs.createScope(scopeId, {
|
|
2517
|
+
* message: 'What is our ARR trend?',
|
|
2518
|
+
* config: { model: 'claude-sonnet-5' },
|
|
2519
|
+
* })
|
|
2520
|
+
* for await (const event of stream) {
|
|
2521
|
+
* if (event.type === 'token') process.stdout.write(event.content)
|
|
2522
|
+
* }
|
|
2523
|
+
* ```
|
|
2181
2524
|
*/
|
|
2182
2525
|
createScope(scopeId, body, options = {}) {
|
|
2183
2526
|
validateId(scopeId, "scope_id");
|
|
2184
2527
|
return this.createRun("ScopeRunsController_create", body, { id: scopeId }, options);
|
|
2185
2528
|
}
|
|
2186
2529
|
/**
|
|
2187
|
-
* Start a Modus assistant run and stream run events.
|
|
2530
|
+
* Start a Modus org-assistant run and stream run events.
|
|
2188
2531
|
*
|
|
2189
2532
|
* @param body - Run body (`message`, optional `sessionId`, optional `subordinateSkillIds` to narrow context).
|
|
2190
2533
|
* @param options.idempotencyKey - Client-supplied idempotency key; defaults to `body.runId` or a new uuid.
|
|
2191
2534
|
* @returns A stream of run events.
|
|
2535
|
+
*
|
|
2536
|
+
* @example
|
|
2537
|
+
* ```ts
|
|
2538
|
+
* const stream = client.workflows.runs.createModus({
|
|
2539
|
+
* message: 'Summarize ARR in three bullets.',
|
|
2540
|
+
* config: { model: 'claude-sonnet-5' },
|
|
2541
|
+
* })
|
|
2542
|
+
* for await (const event of stream) {
|
|
2543
|
+
* if (event.type === 'token') process.stdout.write(event.content)
|
|
2544
|
+
* }
|
|
2545
|
+
* ```
|
|
2192
2546
|
*/
|
|
2193
2547
|
createModus(body, options = {}) {
|
|
2194
2548
|
return this.createRun("ModusRunsController_create", body, {}, options);
|
|
@@ -2200,6 +2554,18 @@ var WorkflowRunsResource = class {
|
|
|
2200
2554
|
* @param body - Resume body (`message`, `sessionId`, and `decision`: `approve` / `deny` / `connected` / `cancelled`).
|
|
2201
2555
|
* @param options.idempotencyKey - Client-supplied idempotency key; defaults to `body.runId` or a new uuid.
|
|
2202
2556
|
* @returns A stream of run events.
|
|
2557
|
+
*
|
|
2558
|
+
* @example
|
|
2559
|
+
* ```ts
|
|
2560
|
+
* const stream = client.workflows.runs.resume(runId, {
|
|
2561
|
+
* decision: 'approve',
|
|
2562
|
+
* message: 'Looks good — continue.',
|
|
2563
|
+
* sessionId,
|
|
2564
|
+
* })
|
|
2565
|
+
* for await (const event of stream) {
|
|
2566
|
+
* if (event.type === 'token') process.stdout.write(event.content)
|
|
2567
|
+
* }
|
|
2568
|
+
* ```
|
|
2203
2569
|
*/
|
|
2204
2570
|
resume(runId, body, options = {}) {
|
|
2205
2571
|
validateId(runId, "run_id");
|
|
@@ -2209,6 +2575,11 @@ var WorkflowRunsResource = class {
|
|
|
2209
2575
|
* Cancel a run that is still in progress.
|
|
2210
2576
|
*
|
|
2211
2577
|
* @param runId - Run id to cancel.
|
|
2578
|
+
*
|
|
2579
|
+
* @example
|
|
2580
|
+
* ```ts
|
|
2581
|
+
* await client.workflows.runs.cancel(runId)
|
|
2582
|
+
* ```
|
|
2212
2583
|
*/
|
|
2213
2584
|
async cancel(runId) {
|
|
2214
2585
|
validateId(runId, "run_id");
|
|
@@ -2402,15 +2773,22 @@ var WorkflowsResource = class {
|
|
|
2402
2773
|
this.workflowActions = new AgentWorkflowActionsResource(http, config);
|
|
2403
2774
|
}
|
|
2404
2775
|
/**
|
|
2405
|
-
* List workflows.
|
|
2776
|
+
* List workflows in the organisation.
|
|
2406
2777
|
*
|
|
2407
2778
|
* @param options.pageSize - Maximum items per page (default 25).
|
|
2408
2779
|
* @param options.pageToken - Opaque token from a previous page.
|
|
2409
|
-
* @param options.search -
|
|
2780
|
+
* @param options.search - Case-insensitive substring filter on the workflow name.
|
|
2410
2781
|
* @param options.type - Workflow kind: `"task"` or `"workflow"`.
|
|
2411
2782
|
* @param options.view - Which saved version to return (`active` or `draft`).
|
|
2412
2783
|
* @param options.includeVariation - Include variation metadata when supported.
|
|
2413
|
-
* @returns A page of workflows.
|
|
2784
|
+
* @returns A page of workflows — use `.autoPagingIter()` for all pages.
|
|
2785
|
+
*
|
|
2786
|
+
* @example
|
|
2787
|
+
* ```ts
|
|
2788
|
+
* for await (const wf of (await client.workflows.list({ search: 'digest' })).autoPagingIter()) {
|
|
2789
|
+
* console.log(wf.id, wf.name, wf.status)
|
|
2790
|
+
* }
|
|
2791
|
+
* ```
|
|
2414
2792
|
*/
|
|
2415
2793
|
list(options = {}) {
|
|
2416
2794
|
const pageSize = options.pageSize ?? 25;
|
|
@@ -2450,8 +2828,14 @@ var WorkflowsResource = class {
|
|
|
2450
2828
|
* @param workflowId - Numeric id or slug.
|
|
2451
2829
|
* @param options.view - Which saved version to return (`active` or `draft`).
|
|
2452
2830
|
* @param options.includeVariation - Include variation metadata when supported.
|
|
2453
|
-
* @returns The workflow.
|
|
2831
|
+
* @returns The workflow (`id`, `name`, `status`, …).
|
|
2454
2832
|
* @throws {NotFoundError} When no workflow matches the id or slug.
|
|
2833
|
+
*
|
|
2834
|
+
* @example
|
|
2835
|
+
* ```ts
|
|
2836
|
+
* const wf = await client.workflows.get('weekly-digest')
|
|
2837
|
+
* console.log(wf.name, wf.status)
|
|
2838
|
+
* ```
|
|
2455
2839
|
*/
|
|
2456
2840
|
async get(workflowId, options = {}) {
|
|
2457
2841
|
validateId(workflowId, "workflow_id");
|
|
@@ -2570,6 +2954,12 @@ var CustomContextItemsResource = class {
|
|
|
2570
2954
|
* @param options.searchQuery - Free-text search filter.
|
|
2571
2955
|
* @param options.topics - Filter to items tagged with any of these topics.
|
|
2572
2956
|
* @returns A page of custom context items.
|
|
2957
|
+
* @example
|
|
2958
|
+
* ```ts
|
|
2959
|
+
* const client = new Modus()
|
|
2960
|
+
* const page = await client.context.customItems.list({ pageSize: 25 })
|
|
2961
|
+
* for (const item of page.items) console.log(item.uid, item.contextType)
|
|
2962
|
+
* ```
|
|
2573
2963
|
*/
|
|
2574
2964
|
list(options = {}) {
|
|
2575
2965
|
const pageSize = options.pageSize ?? 25;
|
|
@@ -2598,6 +2988,11 @@ var CustomContextItemsResource = class {
|
|
|
2598
2988
|
* @param uid - Item uid.
|
|
2599
2989
|
* @returns The custom context item.
|
|
2600
2990
|
* @throws {NotFoundError} When no item matches the uid.
|
|
2991
|
+
* @example
|
|
2992
|
+
* ```ts
|
|
2993
|
+
* const client = new Modus()
|
|
2994
|
+
* const item = await client.context.customItems.get('PLACEHOLDER_UID')
|
|
2995
|
+
* ```
|
|
2601
2996
|
*/
|
|
2602
2997
|
async get(uid) {
|
|
2603
2998
|
return parseContextItem(
|
|
@@ -2618,6 +3013,7 @@ var CustomContextItemsResource = class {
|
|
|
2618
3013
|
*
|
|
2619
3014
|
* @example
|
|
2620
3015
|
* ```ts
|
|
3016
|
+
* const client = new Modus()
|
|
2621
3017
|
* const created = await client.context.customItems.create({
|
|
2622
3018
|
* kind: 'entity',
|
|
2623
3019
|
* sourceId: 'my-source',
|
|
@@ -2641,6 +3037,7 @@ var CustomContextItemsResource = class {
|
|
|
2641
3037
|
*
|
|
2642
3038
|
* @example
|
|
2643
3039
|
* ```ts
|
|
3040
|
+
* const client = new Modus()
|
|
2644
3041
|
* const created = await client.context.customItems.batchCreate([
|
|
2645
3042
|
* { kind: 'field', sourceId: 'src', fieldName: 'region', dataType: 'string' },
|
|
2646
3043
|
* { kind: 'field', sourceId: 'src', fieldName: 'amount', dataType: 'number' },
|
|
@@ -2658,12 +3055,45 @@ var CustomContextItemsResource = class {
|
|
|
2658
3055
|
const items = data.contextItems;
|
|
2659
3056
|
return Array.isArray(items) ? items.map(parseCreatedCustomContextItem) : [];
|
|
2660
3057
|
}
|
|
3058
|
+
/**
|
|
3059
|
+
* Create or update typed relations between context items.
|
|
3060
|
+
*
|
|
3061
|
+
* @param relations - Relations with source and target item uids, a snake_case type, and optional content.
|
|
3062
|
+
* @returns Number of relations created or updated.
|
|
3063
|
+
* @example
|
|
3064
|
+
* ```ts
|
|
3065
|
+
* const client = new Modus()
|
|
3066
|
+
* await client.context.customItems.createRelations([{
|
|
3067
|
+
* fromUid: 'SOURCE_UID',
|
|
3068
|
+
* toUid: 'TARGET_UID',
|
|
3069
|
+
* relationType: 'depends_on',
|
|
3070
|
+
* }])
|
|
3071
|
+
* ```
|
|
3072
|
+
*/
|
|
3073
|
+
async createRelations(relations) {
|
|
3074
|
+
const data = asRecord(
|
|
3075
|
+
await invokeWithRetry(
|
|
3076
|
+
this.config,
|
|
3077
|
+
this.http,
|
|
3078
|
+
"CustomContextItemsController_createRelations",
|
|
3079
|
+
{ jsonBody: { relations } }
|
|
3080
|
+
)
|
|
3081
|
+
);
|
|
3082
|
+
return data.upsertedCount;
|
|
3083
|
+
}
|
|
2661
3084
|
/**
|
|
2662
3085
|
* Update a custom context item.
|
|
2663
3086
|
*
|
|
2664
3087
|
* @param uid - Item uid.
|
|
2665
3088
|
* @param input - Fields to change (kind and hierarchy ids cannot be changed).
|
|
2666
3089
|
* @returns The updated item uid.
|
|
3090
|
+
* @example
|
|
3091
|
+
* ```ts
|
|
3092
|
+
* const client = new Modus()
|
|
3093
|
+
* await client.context.customItems.update('PLACEHOLDER_UID', {
|
|
3094
|
+
* description: 'Updated summary',
|
|
3095
|
+
* })
|
|
3096
|
+
* ```
|
|
2667
3097
|
*/
|
|
2668
3098
|
async update(uid, input) {
|
|
2669
3099
|
return asRecord(
|
|
@@ -2678,6 +3108,11 @@ var CustomContextItemsResource = class {
|
|
|
2678
3108
|
*
|
|
2679
3109
|
* @param uid - Item uid.
|
|
2680
3110
|
* @returns Deletion confirmation with uid and context type.
|
|
3111
|
+
* @example
|
|
3112
|
+
* ```ts
|
|
3113
|
+
* const client = new Modus()
|
|
3114
|
+
* const result = await client.context.customItems.delete('PLACEHOLDER_UID')
|
|
3115
|
+
* ```
|
|
2681
3116
|
*/
|
|
2682
3117
|
async delete(uid) {
|
|
2683
3118
|
return parseDeletion(
|
|
@@ -2689,9 +3124,18 @@ var CustomContextItemsResource = class {
|
|
|
2689
3124
|
};
|
|
2690
3125
|
|
|
2691
3126
|
// src/resources/context/items.ts
|
|
2692
|
-
function contextListParams(pageSize, pageToken,
|
|
3127
|
+
function contextListParams(pageSize, pageToken, filters = {}) {
|
|
2693
3128
|
const extra = {};
|
|
2694
|
-
if (contextType !== void 0) extra.contextTypes = [contextType];
|
|
3129
|
+
if (filters.contextType !== void 0) extra.contextTypes = [filters.contextType];
|
|
3130
|
+
if (filters.parentUids !== void 0) {
|
|
3131
|
+
extra.parentUids = filters.parentUids.length === 0 ? "" : [...filters.parentUids];
|
|
3132
|
+
}
|
|
3133
|
+
if (filters.ancestorUids !== void 0) {
|
|
3134
|
+
extra.ancestorUids = filters.ancestorUids.length === 0 ? "" : [...filters.ancestorUids];
|
|
3135
|
+
}
|
|
3136
|
+
if (filters.connectionIds !== void 0) {
|
|
3137
|
+
extra.connectionIds = filters.connectionIds.length === 0 ? "" : [...filters.connectionIds];
|
|
3138
|
+
}
|
|
2695
3139
|
return aipListParams(pageSize, pageToken, extra);
|
|
2696
3140
|
}
|
|
2697
3141
|
function parseContextItem2(raw) {
|
|
@@ -2716,33 +3160,82 @@ var ContextItemsResource = class {
|
|
|
2716
3160
|
*
|
|
2717
3161
|
* @param options.pageSize - Maximum items per page (default 25).
|
|
2718
3162
|
* @param options.pageToken - Opaque token from a previous page.
|
|
2719
|
-
* @param options.contextType - Filter to a single context type.
|
|
2720
|
-
* @
|
|
3163
|
+
* @param options.contextType - Filter to a single context type (e.g. `"note"`).
|
|
3164
|
+
* @param options.parentUids - Exact ordered native ancestry chain for direct
|
|
3165
|
+
* children. Omit to leave parent unrestricted; pass `[]` for the known-empty
|
|
3166
|
+
* root. Native UIDs are exact tokens (including whitespace); do not use the
|
|
3167
|
+
* hashed context-item `uid`. For a folder's children, send that item's
|
|
3168
|
+
* `ancestry` UIDs plus its last `dataPath` token.
|
|
3169
|
+
* @param options.ancestorUids - Ordered UID ancestry prefix for strict
|
|
3170
|
+
* descendants. Omit to leave unrestricted; pass `[]` for every item with
|
|
3171
|
+
* non-null ancestry.
|
|
3172
|
+
* @param options.connectionIds - Restrict to these connection ids. Omit to
|
|
3173
|
+
* leave unfiltered; pass `[]` to match none. The Files root is
|
|
3174
|
+
* `connectionIds: ['files']` with `parentUids: []`.
|
|
3175
|
+
* @returns A page of context items — use `.autoPagingIter()` for all pages.
|
|
3176
|
+
*
|
|
3177
|
+
* @example
|
|
3178
|
+
* ```ts
|
|
3179
|
+
* const notes = await client.context.items.list({ contextType: 'note', pageSize: 50 })
|
|
3180
|
+
* for (const item of notes.items) {
|
|
3181
|
+
* console.log(item.description ?? item.uid, item.uid)
|
|
3182
|
+
* }
|
|
3183
|
+
* ```
|
|
3184
|
+
*
|
|
3185
|
+
* @example
|
|
3186
|
+
* ```ts
|
|
3187
|
+
* const rootFolders = await client.context.items.list({
|
|
3188
|
+
* connectionIds: ['files'],
|
|
3189
|
+
* contextType: 'file_folder_metadata',
|
|
3190
|
+
* parentUids: [],
|
|
3191
|
+
* })
|
|
3192
|
+
* const folder = rootFolders.items[0]
|
|
3193
|
+
* const nativeUid = folder?.dataPath?.at(-1)
|
|
3194
|
+
* // Known ancestry only — never treat null/omitted ancestry as a root chain.
|
|
3195
|
+
* if (folder?.ancestry != null && nativeUid !== undefined) {
|
|
3196
|
+
* const filesInFolder = await client.context.items.list({
|
|
3197
|
+
* connectionIds: ['files'],
|
|
3198
|
+
* contextType: 'file_upload',
|
|
3199
|
+
* parentUids: [...folder.ancestry.map((a) => a.uid), nativeUid],
|
|
3200
|
+
* })
|
|
3201
|
+
* }
|
|
3202
|
+
* ```
|
|
2721
3203
|
*/
|
|
2722
3204
|
list(options = {}) {
|
|
2723
3205
|
const pageSize = options.pageSize ?? 25;
|
|
2724
3206
|
validatePageSize(pageSize);
|
|
2725
|
-
return this.listPage(pageSize, options.pageToken,
|
|
3207
|
+
return this.listPage(pageSize, options.pageToken, {
|
|
3208
|
+
contextType: options.contextType,
|
|
3209
|
+
parentUids: options.parentUids,
|
|
3210
|
+
ancestorUids: options.ancestorUids,
|
|
3211
|
+
connectionIds: options.connectionIds
|
|
3212
|
+
});
|
|
2726
3213
|
}
|
|
2727
|
-
async listPage(pageSize, pageToken,
|
|
3214
|
+
async listPage(pageSize, pageToken, filters) {
|
|
2728
3215
|
const data = asRecord(
|
|
2729
3216
|
await invokeWithRetry(this.config, this.http, "ContextItemsController_list", {
|
|
2730
|
-
query: contextListParams(pageSize, pageToken,
|
|
3217
|
+
query: contextListParams(pageSize, pageToken, filters)
|
|
2731
3218
|
})
|
|
2732
3219
|
);
|
|
2733
3220
|
return buildAipPage(
|
|
2734
3221
|
data,
|
|
2735
3222
|
"contextItems",
|
|
2736
3223
|
parseContextItem2,
|
|
2737
|
-
(token) => this.listPage(pageSize, token,
|
|
3224
|
+
(token) => this.listPage(pageSize, token, filters)
|
|
2738
3225
|
);
|
|
2739
3226
|
}
|
|
2740
3227
|
/**
|
|
2741
3228
|
* Retrieve a knowledge-base item by uid.
|
|
2742
3229
|
*
|
|
2743
3230
|
* @param uid - Item uid.
|
|
2744
|
-
* @returns The context item.
|
|
3231
|
+
* @returns The context item (`uid`, `contextType`, `content`, …).
|
|
2745
3232
|
* @throws {NotFoundError} When no item matches the uid.
|
|
3233
|
+
*
|
|
3234
|
+
* @example
|
|
3235
|
+
* ```ts
|
|
3236
|
+
* const item = await client.context.items.get(uid)
|
|
3237
|
+
* console.log(item.contextType, item.description ?? item.uid)
|
|
3238
|
+
* ```
|
|
2746
3239
|
*/
|
|
2747
3240
|
async get(uid) {
|
|
2748
3241
|
const data = await invokeWithRetry(this.config, this.http, "ContextItemsController_get", {
|
|
@@ -2753,10 +3246,19 @@ var ContextItemsResource = class {
|
|
|
2753
3246
|
/**
|
|
2754
3247
|
* Look up a knowledge-base item by type and data path.
|
|
2755
3248
|
*
|
|
2756
|
-
* @param options.contextType - Context type to match.
|
|
3249
|
+
* @param options.contextType - Context type to match (e.g. `"note"`).
|
|
2757
3250
|
* @param options.dataPath - Hierarchical path segments that identify the item.
|
|
2758
3251
|
* @param options.contentProjection - Optional fields to include from item content.
|
|
2759
3252
|
* @returns The matching row, or `undefined` when no item is found (404).
|
|
3253
|
+
*
|
|
3254
|
+
* @example
|
|
3255
|
+
* ```ts
|
|
3256
|
+
* const found = await client.context.items.lookup({
|
|
3257
|
+
* contextType: 'note',
|
|
3258
|
+
* dataPath: ['finance', 'arr-definition'],
|
|
3259
|
+
* })
|
|
3260
|
+
* if (found) console.log(found.uid, found.description ?? found.uid)
|
|
3261
|
+
* ```
|
|
2760
3262
|
*/
|
|
2761
3263
|
async lookup(options) {
|
|
2762
3264
|
const body = omitUndefined({
|
|
@@ -2781,10 +3283,22 @@ var ContextItemsResource = class {
|
|
|
2781
3283
|
*
|
|
2782
3284
|
* @param uid - Item uid.
|
|
2783
3285
|
* @param contextType - Context type of the item.
|
|
2784
|
-
* @param contentKeyPath - Dot path to the value field inside item content.
|
|
3286
|
+
* @param contentKeyPath - Dot path to the value field inside item content (e.g. `"enumValues"`).
|
|
2785
3287
|
* @param options.pageSize - Maximum items per page (default 25).
|
|
2786
3288
|
* @param options.pageToken - Opaque token from a previous page.
|
|
2787
3289
|
* @returns A page of value rows.
|
|
3290
|
+
*
|
|
3291
|
+
* @example
|
|
3292
|
+
* ```ts
|
|
3293
|
+
* // Replace PLACEHOLDER_UID with a real uid whose content has enumValues.
|
|
3294
|
+
* const page = await client.context.items.listValues(
|
|
3295
|
+
* 'PLACEHOLDER_UID',
|
|
3296
|
+
* 'table_column',
|
|
3297
|
+
* 'enumValues',
|
|
3298
|
+
* { pageSize: 25 },
|
|
3299
|
+
* )
|
|
3300
|
+
* for (const row of page.items) console.log(row)
|
|
3301
|
+
* ```
|
|
2788
3302
|
*/
|
|
2789
3303
|
listValues(uid, contextType, contentKeyPath, options = {}) {
|
|
2790
3304
|
const pageSize = options.pageSize ?? 25;
|
|
@@ -2799,6 +3313,14 @@ var ContextItemsResource = class {
|
|
|
2799
3313
|
* @param options.pageSize - Maximum items per page (default 25).
|
|
2800
3314
|
* @param options.pageToken - Opaque token from a previous page.
|
|
2801
3315
|
* @returns A page of value rows.
|
|
3316
|
+
*
|
|
3317
|
+
* @example
|
|
3318
|
+
* ```ts
|
|
3319
|
+
* // Replace PLACEHOLDER_UID with a real uid that has enumValues in content.
|
|
3320
|
+
* const item = await client.context.items.get('PLACEHOLDER_UID')
|
|
3321
|
+
* const page = await client.context.items.listValuesFor(item, 'enumValues')
|
|
3322
|
+
* for (const row of page.items) console.log(row)
|
|
3323
|
+
* ```
|
|
2802
3324
|
*/
|
|
2803
3325
|
listValuesFor(item, contentKeyPath, options = {}) {
|
|
2804
3326
|
return this.listValues(item.uid, item.contextType, contentKeyPath, options);
|
|
@@ -2831,9 +3353,51 @@ var ContextResource = class {
|
|
|
2831
3353
|
}
|
|
2832
3354
|
};
|
|
2833
3355
|
|
|
3356
|
+
// src/resources/ingested-data.ts
|
|
3357
|
+
var IngestedDataResource = class {
|
|
3358
|
+
/** @internal */
|
|
3359
|
+
constructor(http, config) {
|
|
3360
|
+
this.http = http;
|
|
3361
|
+
this.config = config;
|
|
3362
|
+
}
|
|
3363
|
+
/**
|
|
3364
|
+
* Store a complete SQL or HTTP request and response exactly once.
|
|
3365
|
+
*
|
|
3366
|
+
* Identity covers the complete organization, integration, request, and response
|
|
3367
|
+
* content. A duplicate raises `ConflictError`, which means the identical payload
|
|
3368
|
+
* is already stored and may be treated as a safe retry outcome.
|
|
3369
|
+
*
|
|
3370
|
+
* @param options.integrationType - Canonical Modus integration identifier.
|
|
3371
|
+
* @param options.request - Exact SQL or HTTP request that produced the response.
|
|
3372
|
+
* @param options.response - Response format, optional source HTTP status, and exact string content. SQL requires CSV.
|
|
3373
|
+
* @returns The checksum of the stored envelope.
|
|
3374
|
+
* @throws {ConflictError} When the complete payload is already stored.
|
|
3375
|
+
*
|
|
3376
|
+
* @example
|
|
3377
|
+
* ```ts
|
|
3378
|
+
* const stored = await client.ingestedData.upload({
|
|
3379
|
+
* integrationType: 'generic',
|
|
3380
|
+
* request: { type: 'sql', query: 'SELECT id, total FROM orders' },
|
|
3381
|
+
* response: { format: 'csv', content: 'id,total\n1,42.00\n' },
|
|
3382
|
+
* })
|
|
3383
|
+
* console.log(stored.checksum)
|
|
3384
|
+
* ```
|
|
3385
|
+
*/
|
|
3386
|
+
async upload(options) {
|
|
3387
|
+
const data = await invokeWithRetry(this.config, this.http, "IngestedDataController_upload", {
|
|
3388
|
+
jsonBody: {
|
|
3389
|
+
integration_type: options.integrationType,
|
|
3390
|
+
request: options.request,
|
|
3391
|
+
response: options.response
|
|
3392
|
+
}
|
|
3393
|
+
});
|
|
3394
|
+
return data;
|
|
3395
|
+
}
|
|
3396
|
+
};
|
|
3397
|
+
|
|
2834
3398
|
// src/resources/modus/conversations.ts
|
|
2835
3399
|
var ALLOWED_KINDS = /* @__PURE__ */ new Set(["all", "modus", "scopes"]);
|
|
2836
|
-
function listParams(pageSize, pageToken, kind) {
|
|
3400
|
+
function listParams(pageSize, pageToken, kind, source, sourceRef) {
|
|
2837
3401
|
if (kind !== void 0 && !ALLOWED_KINDS.has(kind)) {
|
|
2838
3402
|
throw new Error(
|
|
2839
3403
|
`kind must be one of ${[...ALLOWED_KINDS].sort().join(", ")}, got ${JSON.stringify(kind)}`
|
|
@@ -2841,6 +3405,8 @@ function listParams(pageSize, pageToken, kind) {
|
|
|
2841
3405
|
}
|
|
2842
3406
|
const extra = {};
|
|
2843
3407
|
if (kind !== void 0) extra.kind = kind;
|
|
3408
|
+
if (source !== void 0) extra.source = source;
|
|
3409
|
+
if (sourceRef !== void 0) extra.sourceRef = sourceRef;
|
|
2844
3410
|
return aipListParams(pageSize, pageToken, extra);
|
|
2845
3411
|
}
|
|
2846
3412
|
function parseListItem(raw) {
|
|
@@ -2860,24 +3426,32 @@ var ModusConversationsResource = class {
|
|
|
2860
3426
|
* @param options.pageSize - Items per page (default 25).
|
|
2861
3427
|
* @param options.pageToken - Opaque token from a previous page.
|
|
2862
3428
|
* @param options.kind - `"modus"`, `"scopes"`, or `"all"`.
|
|
3429
|
+
* @param options.source - Restrict to conversations started from this UI surface
|
|
3430
|
+
* (e.g. `"context_chat"`, `"dashboard_copilot"`, `"slack"`). Only valid with an
|
|
3431
|
+
* omitted `kind` or `kind: "all"`; the API throws an `UnprocessableError` (422)
|
|
3432
|
+
* if combined with `kind: "modus"` or `kind: "scopes"`.
|
|
3433
|
+
* @param options.sourceRef - Narrow `source` to one instance of that surface — for
|
|
3434
|
+
* `"dashboard_copilot"`, a dashboard id. Requires `source`; the API throws an
|
|
3435
|
+
* `UnprocessableError` (422) if sent on its own. Conversations recorded before
|
|
3436
|
+
* this filter shipped carry no instance key and never match it.
|
|
2863
3437
|
* @returns Page of conversation list items.
|
|
2864
3438
|
*/
|
|
2865
3439
|
list(options = {}) {
|
|
2866
3440
|
const pageSize = options.pageSize ?? 25;
|
|
2867
3441
|
validatePageSize(pageSize);
|
|
2868
|
-
return this.listPage(pageSize, options.pageToken, options.kind);
|
|
3442
|
+
return this.listPage(pageSize, options.pageToken, options.kind, options.source, options.sourceRef);
|
|
2869
3443
|
}
|
|
2870
|
-
async listPage(pageSize, pageToken, kind) {
|
|
3444
|
+
async listPage(pageSize, pageToken, kind, source, sourceRef) {
|
|
2871
3445
|
const data = asRecord(
|
|
2872
3446
|
await invokeWithRetry(this.config, this.http, "ModusConversationsController_list", {
|
|
2873
|
-
query: listParams(pageSize, pageToken, kind)
|
|
3447
|
+
query: listParams(pageSize, pageToken, kind, source, sourceRef)
|
|
2874
3448
|
})
|
|
2875
3449
|
);
|
|
2876
3450
|
return buildAipPage(
|
|
2877
3451
|
data,
|
|
2878
3452
|
"conversations",
|
|
2879
3453
|
parseListItem,
|
|
2880
|
-
(token) => this.listPage(pageSize, token, kind)
|
|
3454
|
+
(token) => this.listPage(pageSize, token, kind, source, sourceRef)
|
|
2881
3455
|
);
|
|
2882
3456
|
}
|
|
2883
3457
|
/**
|
|
@@ -2903,11 +3477,17 @@ var ModusResource = class {
|
|
|
2903
3477
|
this.conversations = new ModusConversationsResource(http, config);
|
|
2904
3478
|
}
|
|
2905
3479
|
/**
|
|
2906
|
-
*
|
|
3480
|
+
* Compose full-environment context for an intent without running chat.
|
|
2907
3481
|
*
|
|
2908
|
-
* @param message -
|
|
2909
|
-
* @param options.limit -
|
|
2910
|
-
* @returns
|
|
3482
|
+
* @param message - Natural-language intent used to select context.
|
|
3483
|
+
* @param options.limit - Maximum context items to return. Omit to return all selected items.
|
|
3484
|
+
* @returns Composition metadata (counts / session id). Use `chat` for a reply.
|
|
3485
|
+
*
|
|
3486
|
+
* @example
|
|
3487
|
+
* ```ts
|
|
3488
|
+
* const ctx = await client.modus.getContext('What tables describe revenue?', { limit: 5 })
|
|
3489
|
+
* console.log(ctx.originalCount, ctx.sessionId)
|
|
3490
|
+
* ```
|
|
2911
3491
|
*/
|
|
2912
3492
|
async getContext(message, options = {}) {
|
|
2913
3493
|
const data = await invokeWithRetry(this.config, this.http, "ModusContextController_compose", {
|
|
@@ -2916,29 +3496,48 @@ var ModusResource = class {
|
|
|
2916
3496
|
return data;
|
|
2917
3497
|
}
|
|
2918
3498
|
/**
|
|
2919
|
-
* Send a message to Modus
|
|
3499
|
+
* Send a message to Modus and wait for the complete reply.
|
|
2920
3500
|
*
|
|
2921
|
-
* @param message -
|
|
3501
|
+
* @param message - User message text.
|
|
2922
3502
|
* @param options.model - Required model id (e.g. `"claude-sonnet-5"`).
|
|
2923
|
-
* @param options.threadId - Continue an existing conversation.
|
|
2924
|
-
* @returns Chat result
|
|
3503
|
+
* @param options.threadId - Continue an existing conversation; omit to start new.
|
|
3504
|
+
* @returns Chat result: `content`, `threadId` (for follow-ups), `runId`.
|
|
2925
3505
|
*
|
|
2926
3506
|
* @example
|
|
2927
3507
|
* ```ts
|
|
2928
|
-
* const result = await client.modus.chat('What tables describe revenue?', {
|
|
3508
|
+
* const result = await client.modus.chat('What tables describe revenue?', {
|
|
3509
|
+
* model: 'claude-sonnet-5',
|
|
3510
|
+
* })
|
|
2929
3511
|
* console.log(result.content, result.threadId)
|
|
3512
|
+
* const follow = await client.modus.chat('Break that down by region.', {
|
|
3513
|
+
* model: 'claude-sonnet-5',
|
|
3514
|
+
* threadId: result.threadId,
|
|
3515
|
+
* })
|
|
2930
3516
|
* ```
|
|
2931
3517
|
*/
|
|
2932
3518
|
chat(message, options) {
|
|
2933
3519
|
return modusChatBuffered(this.http, message, options);
|
|
2934
3520
|
}
|
|
2935
3521
|
/**
|
|
2936
|
-
* Stream a Modus reply token by token.
|
|
3522
|
+
* Stream a Modus reply token by token (SSE).
|
|
2937
3523
|
*
|
|
2938
|
-
*
|
|
3524
|
+
* The request starts when you consume `textStream()` or `eventStream()`.
|
|
3525
|
+
*
|
|
3526
|
+
* @param message - User message text.
|
|
2939
3527
|
* @param options.model - Required model id (e.g. `"claude-sonnet-5"`).
|
|
2940
|
-
* @param options.threadId - Continue an existing conversation.
|
|
2941
|
-
* @returns Chat stream.
|
|
3528
|
+
* @param options.threadId - Continue an existing conversation; omit to start new.
|
|
3529
|
+
* @returns Chat stream — iterate `textStream()` for tokens.
|
|
3530
|
+
*
|
|
3531
|
+
* @example
|
|
3532
|
+
* ```ts
|
|
3533
|
+
* const stream = client.modus.chatStream('Summarize ARR in three bullets.', {
|
|
3534
|
+
* model: 'claude-sonnet-5',
|
|
3535
|
+
* })
|
|
3536
|
+
* for await (const token of stream.textStream()) {
|
|
3537
|
+
* process.stdout.write(token)
|
|
3538
|
+
* }
|
|
3539
|
+
* console.log(stream.getFinalResult().threadId)
|
|
3540
|
+
* ```
|
|
2942
3541
|
*/
|
|
2943
3542
|
chatStream(message, options) {
|
|
2944
3543
|
return modusChatStreamSession(this.http, this.config, message, options);
|
|
@@ -2963,26 +3562,44 @@ var ScopeConversationsResource = class {
|
|
|
2963
3562
|
*
|
|
2964
3563
|
* @param options.pageSize - Items per page (default 25).
|
|
2965
3564
|
* @param options.pageToken - Opaque token from a previous page.
|
|
2966
|
-
* @
|
|
3565
|
+
* @param options.source - Restrict to conversations started from this UI surface
|
|
3566
|
+
* (e.g. `"context_chat"`, `"dashboard_copilot"`, `"slack"`).
|
|
3567
|
+
* @param options.sourceRef - Narrow `source` to one instance of that surface — for
|
|
3568
|
+
* `"dashboard_copilot"`, a dashboard id. Requires `source`; the API throws an
|
|
3569
|
+
* `UnprocessableError` (422) if sent on its own. Conversations recorded before
|
|
3570
|
+
* this filter shipped carry no instance key and never match it.
|
|
3571
|
+
* @returns Page of conversation list items (`threadId`, `firstMessage`, `messageCount`).
|
|
3572
|
+
*
|
|
3573
|
+
* @example
|
|
3574
|
+
* ```ts
|
|
3575
|
+
* for await (const row of (
|
|
3576
|
+
* await client.scopes.conversations(scopeId).list({ pageSize: 10 })
|
|
3577
|
+
* ).autoPagingIter()) {
|
|
3578
|
+
* console.log(row.threadId, row.firstMessage, row.messageCount)
|
|
3579
|
+
* }
|
|
3580
|
+
* ```
|
|
2967
3581
|
*/
|
|
2968
3582
|
list(options = {}) {
|
|
2969
3583
|
const pageSize = options.pageSize ?? 25;
|
|
2970
3584
|
validatePageSize(pageSize);
|
|
2971
|
-
return this.listPage(pageSize, options.pageToken);
|
|
3585
|
+
return this.listPage(pageSize, options.pageToken, options.source, options.sourceRef);
|
|
2972
3586
|
}
|
|
2973
|
-
async listPage(pageSize, pageToken) {
|
|
3587
|
+
async listPage(pageSize, pageToken, source, sourceRef) {
|
|
2974
3588
|
validateId(this.scopeId, "scope_id");
|
|
3589
|
+
const extra = {};
|
|
3590
|
+
if (source !== void 0) extra.source = source;
|
|
3591
|
+
if (sourceRef !== void 0) extra.sourceRef = sourceRef;
|
|
2975
3592
|
const data = asRecord(
|
|
2976
3593
|
await invokeWithRetry(this.config, this.http, "ScopeConversationsController_list", {
|
|
2977
3594
|
pathParams: { id: this.scopeId },
|
|
2978
|
-
query: aipListParams(pageSize, pageToken)
|
|
3595
|
+
query: aipListParams(pageSize, pageToken, extra)
|
|
2979
3596
|
})
|
|
2980
3597
|
);
|
|
2981
3598
|
return buildAipPage(
|
|
2982
3599
|
data,
|
|
2983
3600
|
"conversations",
|
|
2984
3601
|
parseListItem2,
|
|
2985
|
-
(token) => this.listPage(pageSize, token)
|
|
3602
|
+
(token) => this.listPage(pageSize, token, source, sourceRef)
|
|
2986
3603
|
);
|
|
2987
3604
|
}
|
|
2988
3605
|
/**
|
|
@@ -2991,7 +3608,15 @@ var ScopeConversationsResource = class {
|
|
|
2991
3608
|
* @param threadId - Conversation thread id.
|
|
2992
3609
|
* @param options.messageLimit - Maximum messages to return (1–100).
|
|
2993
3610
|
* @param options.beforeMessageIndex - Return messages before this index (requires messageLimit).
|
|
2994
|
-
* @returns Conversation with messages.
|
|
3611
|
+
* @returns Conversation with `messages` (`type`, `content`).
|
|
3612
|
+
*
|
|
3613
|
+
* @example
|
|
3614
|
+
* ```ts
|
|
3615
|
+
* const thread = await client.scopes.conversations(scopeId).get(row.threadId)
|
|
3616
|
+
* for (const msg of thread.messages) {
|
|
3617
|
+
* console.log(msg.type, String(msg.content).slice(0, 80))
|
|
3618
|
+
* }
|
|
3619
|
+
* ```
|
|
2995
3620
|
*/
|
|
2996
3621
|
async get(threadId, options = {}) {
|
|
2997
3622
|
validateId(this.scopeId, "scope_id");
|
|
@@ -3032,6 +3657,15 @@ var ScopesResource = class {
|
|
|
3032
3657
|
*
|
|
3033
3658
|
* @param scopeId - Scope numeric id or slug.
|
|
3034
3659
|
* @returns Conversations resource for the scope.
|
|
3660
|
+
*
|
|
3661
|
+
* @example
|
|
3662
|
+
* ```ts
|
|
3663
|
+
* for await (const row of (
|
|
3664
|
+
* await client.scopes.conversations(scopeId).list({ pageSize: 10 })
|
|
3665
|
+
* ).autoPagingIter()) {
|
|
3666
|
+
* console.log(row.threadId, row.firstMessage)
|
|
3667
|
+
* }
|
|
3668
|
+
* ```
|
|
3035
3669
|
*/
|
|
3036
3670
|
conversations(scopeId) {
|
|
3037
3671
|
return new ScopeConversationsResource(this.http, this.config, scopeId);
|
|
@@ -3044,7 +3678,14 @@ var ScopesResource = class {
|
|
|
3044
3678
|
* @param options.search - Case-insensitive substring filter on the scope name.
|
|
3045
3679
|
* @param options.view - `"active"` (deployed) or `"draft"`.
|
|
3046
3680
|
* @param options.managerId - Only scopes supervised by this manager scope id.
|
|
3047
|
-
* @returns Page of scopes.
|
|
3681
|
+
* @returns Page of scopes — use `.autoPagingIter()` for all pages.
|
|
3682
|
+
*
|
|
3683
|
+
* @example
|
|
3684
|
+
* ```ts
|
|
3685
|
+
* for await (const scope of (await client.scopes.list()).autoPagingIter()) {
|
|
3686
|
+
* console.log(scope.id, scope.name, scope.status)
|
|
3687
|
+
* }
|
|
3688
|
+
* ```
|
|
3048
3689
|
*/
|
|
3049
3690
|
list(options = {}) {
|
|
3050
3691
|
const pageSize = options.pageSize ?? 25;
|
|
@@ -3076,7 +3717,13 @@ var ScopesResource = class {
|
|
|
3076
3717
|
* @param scopeId - Scope numeric id or slug.
|
|
3077
3718
|
* @param options.view - `"active"` (deployed) or `"draft"`.
|
|
3078
3719
|
* @throws {NotFoundError} When no scope matches the id or slug.
|
|
3079
|
-
* @returns Scope.
|
|
3720
|
+
* @returns Scope (`id`, `name`, `status`, …).
|
|
3721
|
+
*
|
|
3722
|
+
* @example
|
|
3723
|
+
* ```ts
|
|
3724
|
+
* const scope = await client.scopes.get('revenue-analysis')
|
|
3725
|
+
* console.log(scope.name, scope.status)
|
|
3726
|
+
* ```
|
|
3080
3727
|
*/
|
|
3081
3728
|
async get(scopeId, options = {}) {
|
|
3082
3729
|
validateId(scopeId, "scope_id");
|
|
@@ -3088,12 +3735,20 @@ var ScopesResource = class {
|
|
|
3088
3735
|
return parseScope(data);
|
|
3089
3736
|
}
|
|
3090
3737
|
/**
|
|
3091
|
-
*
|
|
3738
|
+
* Compose context this scope would use for an intent, without running chat.
|
|
3092
3739
|
*
|
|
3093
3740
|
* @param scopeId - Scope numeric id or slug.
|
|
3094
|
-
* @param message -
|
|
3095
|
-
* @param options.limit -
|
|
3096
|
-
* @returns
|
|
3741
|
+
* @param message - Natural-language intent used to select context.
|
|
3742
|
+
* @param options.limit - Maximum context items to return. Omit to return all selected items.
|
|
3743
|
+
* @returns Composition metadata. Use `chat` when you need an assistant reply.
|
|
3744
|
+
*
|
|
3745
|
+
* @example
|
|
3746
|
+
* ```ts
|
|
3747
|
+
* const ctx = await client.scopes.getContext(scopeId, 'Which tables describe churn?', {
|
|
3748
|
+
* limit: 5,
|
|
3749
|
+
* })
|
|
3750
|
+
* console.log(ctx.originalCount, ctx.sessionId)
|
|
3751
|
+
* ```
|
|
3097
3752
|
*/
|
|
3098
3753
|
async getContext(scopeId, message, options = {}) {
|
|
3099
3754
|
validateId(scopeId, "scope_id");
|
|
@@ -3104,32 +3759,53 @@ var ScopesResource = class {
|
|
|
3104
3759
|
return data;
|
|
3105
3760
|
}
|
|
3106
3761
|
/**
|
|
3107
|
-
* Send a message to a scope and
|
|
3762
|
+
* Send a message to a published scope and wait for the complete reply.
|
|
3108
3763
|
*
|
|
3109
|
-
*
|
|
3110
|
-
*
|
|
3764
|
+
* For the org-wide assistant use `client.modus.chat` instead.
|
|
3765
|
+
*
|
|
3766
|
+
* @param scopeId - Scope numeric id or slug (must be active for chat).
|
|
3767
|
+
* @param message - User message text.
|
|
3111
3768
|
* @param options.model - Required model id (e.g. `"claude-sonnet-5"`).
|
|
3112
|
-
* @param options.threadId - Continue an existing conversation.
|
|
3113
|
-
* @returns Chat result
|
|
3769
|
+
* @param options.threadId - Continue an existing conversation; omit to start new.
|
|
3770
|
+
* @returns Chat result: `content`, `threadId`, `runId`.
|
|
3114
3771
|
*
|
|
3115
3772
|
* @example
|
|
3116
3773
|
* ```ts
|
|
3117
|
-
* const result = await client.scopes.chat(scopeId, '
|
|
3774
|
+
* const result = await client.scopes.chat(scopeId, 'What is our ARR trend?', {
|
|
3775
|
+
* model: 'claude-sonnet-5',
|
|
3776
|
+
* })
|
|
3118
3777
|
* console.log(result.content, result.threadId)
|
|
3778
|
+
* const follow = await client.scopes.chat(scopeId, 'Break that down by segment.', {
|
|
3779
|
+
* model: 'claude-sonnet-5',
|
|
3780
|
+
* threadId: result.threadId,
|
|
3781
|
+
* })
|
|
3119
3782
|
* ```
|
|
3120
3783
|
*/
|
|
3121
3784
|
chat(scopeId, message, options) {
|
|
3122
3785
|
return chatBuffered(this.http, "scopes", scopeId, message, options);
|
|
3123
3786
|
}
|
|
3124
3787
|
/**
|
|
3125
|
-
* Stream a scope reply token by token.
|
|
3788
|
+
* Stream a scope reply token by token (SSE).
|
|
3789
|
+
*
|
|
3790
|
+
* The request starts when you consume `textStream()` or `eventStream()`.
|
|
3126
3791
|
*
|
|
3127
3792
|
* @param scopeId - Scope numeric id or slug.
|
|
3128
|
-
* @param message -
|
|
3793
|
+
* @param message - User message text.
|
|
3129
3794
|
* @param options.model - Required model id (e.g. `"claude-sonnet-5"`).
|
|
3130
|
-
* @param options.threadId - Continue an existing conversation.
|
|
3795
|
+
* @param options.threadId - Continue an existing conversation; omit to start new.
|
|
3131
3796
|
* @param options.version - `"published"` or `"draft"`.
|
|
3132
|
-
* @returns Chat stream.
|
|
3797
|
+
* @returns Chat stream — iterate `textStream()` for tokens.
|
|
3798
|
+
*
|
|
3799
|
+
* @example
|
|
3800
|
+
* ```ts
|
|
3801
|
+
* const stream = client.scopes.chatStream(scopeId, 'Summarize in three bullets.', {
|
|
3802
|
+
* model: 'claude-sonnet-5',
|
|
3803
|
+
* })
|
|
3804
|
+
* for await (const token of stream.textStream()) {
|
|
3805
|
+
* process.stdout.write(token)
|
|
3806
|
+
* }
|
|
3807
|
+
* console.log(stream.getFinalResult().threadId)
|
|
3808
|
+
* ```
|
|
3133
3809
|
*/
|
|
3134
3810
|
chatStream(scopeId, message, options) {
|
|
3135
3811
|
return chatStreamSession(this.http, this.config, "scopes", scopeId, message, options);
|
|
@@ -3208,6 +3884,7 @@ var Modus = class extends ModusClientBase {
|
|
|
3208
3884
|
this.context = new ContextResource(this.http, this.config);
|
|
3209
3885
|
this.connections = new ConnectionsResource(this.http, this.config);
|
|
3210
3886
|
this.suggestions = new SuggestionsResource(this.http, this.config);
|
|
3887
|
+
this.ingestedData = new IngestedDataResource(this.http, this.config);
|
|
3211
3888
|
}
|
|
3212
3889
|
};
|
|
3213
3890
|
// Annotate the CommonJS export names for ESM import in node:
|