@getmodus/sdk 0.5.0 → 0.7.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 +85 -5
- package/README.md +9 -1
- package/dist/{chunk-H76PTY5G.js → chunk-JMFT5KO5.js} +395 -10
- package/dist/chunk-JMFT5KO5.js.map +1 -0
- package/dist/{conversations-Pe3kNikF.d.cts → conversations-B0_jmEuT.d.cts} +11469 -2916
- package/dist/{conversations-Pe3kNikF.d.ts → conversations-B0_jmEuT.d.ts} +11469 -2916
- package/dist/index.cjs +683 -57
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +373 -55
- package/dist/index.d.ts +373 -55
- package/dist/index.js +290 -49
- package/dist/index.js.map +1 -1
- package/dist/management/index.cjs +1538 -55
- package/dist/management/index.cjs.map +1 -1
- package/dist/management/index.d.cts +747 -9
- package/dist/management/index.d.ts +747 -9
- package/dist/management/index.js +1108 -7
- package/dist/management/index.js.map +1 -1
- package/package.json +2 -3
- package/dist/chunk-H76PTY5G.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -85,6 +85,86 @@ 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
|
+
},
|
|
108
|
+
"ContextFilesController_get": {
|
|
109
|
+
method: "GET",
|
|
110
|
+
path: "/api/v1/context/files/{uploadId}",
|
|
111
|
+
service: "modus-api",
|
|
112
|
+
serverUrl: "https://api.getmodus.com",
|
|
113
|
+
pathParams: ["uploadId"],
|
|
114
|
+
queryParams: [],
|
|
115
|
+
requestSchema: null,
|
|
116
|
+
responseSchema: "FileUploadResourceDto"
|
|
117
|
+
},
|
|
118
|
+
"ContextFilesController_list": {
|
|
119
|
+
method: "GET",
|
|
120
|
+
path: "/api/v1/context/files",
|
|
121
|
+
service: "modus-api",
|
|
122
|
+
serverUrl: "https://api.getmodus.com",
|
|
123
|
+
pathParams: [],
|
|
124
|
+
queryParams: ["pageToken", "pageSize"],
|
|
125
|
+
requestSchema: null,
|
|
126
|
+
responseSchema: "ListFilesResponseDto"
|
|
127
|
+
},
|
|
128
|
+
"ContextFilesController_uploadFromUrl": {
|
|
129
|
+
method: "POST",
|
|
130
|
+
path: "/api/v1/context/files/uploadFromUrl",
|
|
131
|
+
service: "modus-api",
|
|
132
|
+
serverUrl: "https://api.getmodus.com",
|
|
133
|
+
pathParams: [],
|
|
134
|
+
queryParams: [],
|
|
135
|
+
requestSchema: "UploadFromUrlDto",
|
|
136
|
+
responseSchema: "FileUploadResourceDto"
|
|
137
|
+
},
|
|
138
|
+
"ContextFilesController_uploadFromUrls": {
|
|
139
|
+
method: "POST",
|
|
140
|
+
path: "/api/v1/context/files/uploadFromUrls",
|
|
141
|
+
service: "modus-api",
|
|
142
|
+
serverUrl: "https://api.getmodus.com",
|
|
143
|
+
pathParams: [],
|
|
144
|
+
queryParams: [],
|
|
145
|
+
requestSchema: "BulkUploadFromUrlsDto",
|
|
146
|
+
responseSchema: "BulkUploadFromUrlsResponseDto"
|
|
147
|
+
},
|
|
148
|
+
"ContextFilesController_uploadUrl": {
|
|
149
|
+
method: "POST",
|
|
150
|
+
path: "/api/v1/context/files/uploadUrl",
|
|
151
|
+
service: "modus-api",
|
|
152
|
+
serverUrl: "https://api.getmodus.com",
|
|
153
|
+
pathParams: [],
|
|
154
|
+
queryParams: [],
|
|
155
|
+
requestSchema: "UploadUrlDto",
|
|
156
|
+
responseSchema: "UploadUrlResponseDto"
|
|
157
|
+
},
|
|
158
|
+
"ContextFilesController_uploadUrls": {
|
|
159
|
+
method: "POST",
|
|
160
|
+
path: "/api/v1/context/files/uploadUrls",
|
|
161
|
+
service: "modus-api",
|
|
162
|
+
serverUrl: "https://api.getmodus.com",
|
|
163
|
+
pathParams: [],
|
|
164
|
+
queryParams: [],
|
|
165
|
+
requestSchema: "BulkUploadUrlsDto",
|
|
166
|
+
responseSchema: "BulkUploadUrlsResponseDto"
|
|
167
|
+
},
|
|
88
168
|
"ContextItemsController_delete": {
|
|
89
169
|
method: "DELETE",
|
|
90
170
|
path: "/api/v1/context/items/{uid}",
|
|
@@ -165,6 +245,16 @@ var OPERATIONS = {
|
|
|
165
245
|
requestSchema: "CreateCustomContextItemDto",
|
|
166
246
|
responseSchema: "CreatedCustomContextItemResponseDto"
|
|
167
247
|
},
|
|
248
|
+
"CustomContextItemsController_createRelations": {
|
|
249
|
+
method: "POST",
|
|
250
|
+
path: "/api/v1/context/custom-items/relations",
|
|
251
|
+
service: "modus-api",
|
|
252
|
+
serverUrl: "https://api.getmodus.com",
|
|
253
|
+
pathParams: [],
|
|
254
|
+
queryParams: [],
|
|
255
|
+
requestSchema: "BatchCreateCustomContextItemRelationsDto",
|
|
256
|
+
responseSchema: "BatchCreateCustomContextItemRelationsResponseDto"
|
|
257
|
+
},
|
|
168
258
|
"CustomContextItemsController_delete": {
|
|
169
259
|
method: "DELETE",
|
|
170
260
|
path: "/api/v1/context/custom-items/{uid}",
|
|
@@ -205,6 +295,196 @@ var OPERATIONS = {
|
|
|
205
295
|
requestSchema: "UpdateCustomContextItemDto",
|
|
206
296
|
responseSchema: null
|
|
207
297
|
},
|
|
298
|
+
"DashboardsController_acceptOwnership": {
|
|
299
|
+
method: "POST",
|
|
300
|
+
path: "/api/v1/context/dashboards/{dashboardId}/transfer-ownership/accept",
|
|
301
|
+
service: "modus-api",
|
|
302
|
+
serverUrl: "https://api.getmodus.com",
|
|
303
|
+
pathParams: ["dashboardId"],
|
|
304
|
+
queryParams: [],
|
|
305
|
+
requestSchema: null,
|
|
306
|
+
responseSchema: "DashboardDto"
|
|
307
|
+
},
|
|
308
|
+
"DashboardsController_cancelOwnership": {
|
|
309
|
+
method: "DELETE",
|
|
310
|
+
path: "/api/v1/context/dashboards/{dashboardId}/transfer-ownership",
|
|
311
|
+
service: "modus-api",
|
|
312
|
+
serverUrl: "https://api.getmodus.com",
|
|
313
|
+
pathParams: ["dashboardId"],
|
|
314
|
+
queryParams: [],
|
|
315
|
+
requestSchema: null,
|
|
316
|
+
responseSchema: "DashboardDto"
|
|
317
|
+
},
|
|
318
|
+
"DashboardsController_create": {
|
|
319
|
+
method: "POST",
|
|
320
|
+
path: "/api/v1/context/dashboards",
|
|
321
|
+
service: "modus-api",
|
|
322
|
+
serverUrl: "https://api.getmodus.com",
|
|
323
|
+
pathParams: [],
|
|
324
|
+
queryParams: [],
|
|
325
|
+
requestSchema: "CreateDashboardDto",
|
|
326
|
+
responseSchema: "DashboardDto"
|
|
327
|
+
},
|
|
328
|
+
"DashboardsController_createElement": {
|
|
329
|
+
method: "POST",
|
|
330
|
+
path: "/api/v1/context/dashboards/{dashboardId}/elements",
|
|
331
|
+
service: "modus-api",
|
|
332
|
+
serverUrl: "https://api.getmodus.com",
|
|
333
|
+
pathParams: ["dashboardId"],
|
|
334
|
+
queryParams: [],
|
|
335
|
+
requestSchema: "CreateDashboardElementDto",
|
|
336
|
+
responseSchema: "DashboardElementResponseDto"
|
|
337
|
+
},
|
|
338
|
+
"DashboardsController_delete": {
|
|
339
|
+
method: "DELETE",
|
|
340
|
+
path: "/api/v1/context/dashboards/{dashboardId}",
|
|
341
|
+
service: "modus-api",
|
|
342
|
+
serverUrl: "https://api.getmodus.com",
|
|
343
|
+
pathParams: ["dashboardId"],
|
|
344
|
+
queryParams: [],
|
|
345
|
+
requestSchema: null,
|
|
346
|
+
responseSchema: null
|
|
347
|
+
},
|
|
348
|
+
"DashboardsController_get": {
|
|
349
|
+
method: "GET",
|
|
350
|
+
path: "/api/v1/context/dashboards/{dashboardId}",
|
|
351
|
+
service: "modus-api",
|
|
352
|
+
serverUrl: "https://api.getmodus.com",
|
|
353
|
+
pathParams: ["dashboardId"],
|
|
354
|
+
queryParams: ["view"],
|
|
355
|
+
requestSchema: null,
|
|
356
|
+
responseSchema: "DashboardDto"
|
|
357
|
+
},
|
|
358
|
+
"DashboardsController_getElement": {
|
|
359
|
+
method: "GET",
|
|
360
|
+
path: "/api/v1/context/dashboards/{dashboardId}/elements/{elementId}",
|
|
361
|
+
service: "modus-api",
|
|
362
|
+
serverUrl: "https://api.getmodus.com",
|
|
363
|
+
pathParams: ["dashboardId", "elementId"],
|
|
364
|
+
queryParams: [],
|
|
365
|
+
requestSchema: null,
|
|
366
|
+
responseSchema: "DashboardElementResponseDto"
|
|
367
|
+
},
|
|
368
|
+
"DashboardsController_getVersion": {
|
|
369
|
+
method: "GET",
|
|
370
|
+
path: "/api/v1/context/dashboards/{dashboardId}/versions/{versionId}",
|
|
371
|
+
service: "modus-api",
|
|
372
|
+
serverUrl: "https://api.getmodus.com",
|
|
373
|
+
pathParams: ["dashboardId", "versionId"],
|
|
374
|
+
queryParams: [],
|
|
375
|
+
requestSchema: null,
|
|
376
|
+
responseSchema: "DashboardDto"
|
|
377
|
+
},
|
|
378
|
+
"DashboardsController_list": {
|
|
379
|
+
method: "GET",
|
|
380
|
+
path: "/api/v1/context/dashboards",
|
|
381
|
+
service: "modus-api",
|
|
382
|
+
serverUrl: "https://api.getmodus.com",
|
|
383
|
+
pathParams: [],
|
|
384
|
+
queryParams: ["view"],
|
|
385
|
+
requestSchema: null,
|
|
386
|
+
responseSchema: "ListDashboardsResponseDto"
|
|
387
|
+
},
|
|
388
|
+
"DashboardsController_listDraftSnapshots": {
|
|
389
|
+
method: "GET",
|
|
390
|
+
path: "/api/v1/context/dashboards/{dashboardId}/draft-snapshots",
|
|
391
|
+
service: "modus-api",
|
|
392
|
+
serverUrl: "https://api.getmodus.com",
|
|
393
|
+
pathParams: ["dashboardId"],
|
|
394
|
+
queryParams: [],
|
|
395
|
+
requestSchema: null,
|
|
396
|
+
responseSchema: "ListDashboardDraftSnapshotsResponseDto"
|
|
397
|
+
},
|
|
398
|
+
"DashboardsController_listElements": {
|
|
399
|
+
method: "GET",
|
|
400
|
+
path: "/api/v1/context/dashboards/{dashboardId}/elements",
|
|
401
|
+
service: "modus-api",
|
|
402
|
+
serverUrl: "https://api.getmodus.com",
|
|
403
|
+
pathParams: ["dashboardId"],
|
|
404
|
+
queryParams: [],
|
|
405
|
+
requestSchema: null,
|
|
406
|
+
responseSchema: "DashboardElementsListResponseDto"
|
|
407
|
+
},
|
|
408
|
+
"DashboardsController_listVersions": {
|
|
409
|
+
method: "GET",
|
|
410
|
+
path: "/api/v1/context/dashboards/{dashboardId}/versions",
|
|
411
|
+
service: "modus-api",
|
|
412
|
+
serverUrl: "https://api.getmodus.com",
|
|
413
|
+
pathParams: ["dashboardId"],
|
|
414
|
+
queryParams: [],
|
|
415
|
+
requestSchema: null,
|
|
416
|
+
responseSchema: "ListDashboardVersionsResponseDto"
|
|
417
|
+
},
|
|
418
|
+
"DashboardsController_publish": {
|
|
419
|
+
method: "POST",
|
|
420
|
+
path: "/api/v1/context/dashboards/{dashboardId}/publish",
|
|
421
|
+
service: "modus-api",
|
|
422
|
+
serverUrl: "https://api.getmodus.com",
|
|
423
|
+
pathParams: ["dashboardId"],
|
|
424
|
+
queryParams: [],
|
|
425
|
+
requestSchema: "PublishDashboardDto",
|
|
426
|
+
responseSchema: "PublishDashboardResponseDto"
|
|
427
|
+
},
|
|
428
|
+
"DashboardsController_restore": {
|
|
429
|
+
method: "POST",
|
|
430
|
+
path: "/api/v1/context/dashboards/{dashboardId}/versions/{versionId}/restore",
|
|
431
|
+
service: "modus-api",
|
|
432
|
+
serverUrl: "https://api.getmodus.com",
|
|
433
|
+
pathParams: ["dashboardId", "versionId"],
|
|
434
|
+
queryParams: [],
|
|
435
|
+
requestSchema: null,
|
|
436
|
+
responseSchema: "DashboardDto"
|
|
437
|
+
},
|
|
438
|
+
"DashboardsController_transferOwnership": {
|
|
439
|
+
method: "POST",
|
|
440
|
+
path: "/api/v1/context/dashboards/{dashboardId}/transfer-ownership",
|
|
441
|
+
service: "modus-api",
|
|
442
|
+
serverUrl: "https://api.getmodus.com",
|
|
443
|
+
pathParams: ["dashboardId"],
|
|
444
|
+
queryParams: [],
|
|
445
|
+
requestSchema: "TransferDashboardOwnershipDto",
|
|
446
|
+
responseSchema: "DashboardDto"
|
|
447
|
+
},
|
|
448
|
+
"DashboardsController_updateAccess": {
|
|
449
|
+
method: "PATCH",
|
|
450
|
+
path: "/api/v1/context/dashboards/{dashboardId}/access",
|
|
451
|
+
service: "modus-api",
|
|
452
|
+
serverUrl: "https://api.getmodus.com",
|
|
453
|
+
pathParams: ["dashboardId"],
|
|
454
|
+
queryParams: [],
|
|
455
|
+
requestSchema: "UpdateDashboardAccessDto",
|
|
456
|
+
responseSchema: "DashboardDto"
|
|
457
|
+
},
|
|
458
|
+
"DashboardsController_updateDraft": {
|
|
459
|
+
method: "PATCH",
|
|
460
|
+
path: "/api/v1/context/dashboards/{dashboardId}/draft",
|
|
461
|
+
service: "modus-api",
|
|
462
|
+
serverUrl: "https://api.getmodus.com",
|
|
463
|
+
pathParams: ["dashboardId"],
|
|
464
|
+
queryParams: [],
|
|
465
|
+
requestSchema: "UpdateDashboardDraftDto",
|
|
466
|
+
responseSchema: "DashboardDto"
|
|
467
|
+
},
|
|
468
|
+
"DashboardsController_updateElement": {
|
|
469
|
+
method: "PATCH",
|
|
470
|
+
path: "/api/v1/context/dashboards/{dashboardId}/elements/{elementId}",
|
|
471
|
+
service: "modus-api",
|
|
472
|
+
serverUrl: "https://api.getmodus.com",
|
|
473
|
+
pathParams: ["dashboardId", "elementId"],
|
|
474
|
+
queryParams: [],
|
|
475
|
+
requestSchema: "UpdateDashboardElementDto",
|
|
476
|
+
responseSchema: "DashboardDto"
|
|
477
|
+
},
|
|
478
|
+
"DashboardsController_updateLayout": {
|
|
479
|
+
method: "PATCH",
|
|
480
|
+
path: "/api/v1/context/dashboards/{dashboardId}/layout",
|
|
481
|
+
service: "modus-api",
|
|
482
|
+
serverUrl: "https://api.getmodus.com",
|
|
483
|
+
pathParams: ["dashboardId"],
|
|
484
|
+
queryParams: [],
|
|
485
|
+
requestSchema: "UpdateDashboardLayoutDto",
|
|
486
|
+
responseSchema: "DashboardDto"
|
|
487
|
+
},
|
|
208
488
|
"EvaluationsController_getConfig": {
|
|
209
489
|
method: "GET",
|
|
210
490
|
path: "/api/v1/scopes/{id}/evaluations/config",
|
|
@@ -255,6 +535,16 @@ var OPERATIONS = {
|
|
|
255
535
|
requestSchema: "UpdateEvaluationConfigDto",
|
|
256
536
|
responseSchema: "EvaluationConfigDto"
|
|
257
537
|
},
|
|
538
|
+
"IngestedDataController_upload": {
|
|
539
|
+
method: "POST",
|
|
540
|
+
path: "/api/v1/ingested-data",
|
|
541
|
+
service: "modus-api",
|
|
542
|
+
serverUrl: "https://api.getmodus.com",
|
|
543
|
+
pathParams: [],
|
|
544
|
+
queryParams: [],
|
|
545
|
+
requestSchema: "CreateIngestedDataDto",
|
|
546
|
+
responseSchema: "CreatedIngestedDataResponseDto"
|
|
547
|
+
},
|
|
258
548
|
"MemberGroupsController_list": {
|
|
259
549
|
method: "GET",
|
|
260
550
|
path: "/api/v1/users/member-groups",
|
|
@@ -311,7 +601,7 @@ var OPERATIONS = {
|
|
|
311
601
|
service: "modus-api",
|
|
312
602
|
serverUrl: "https://api.getmodus.com",
|
|
313
603
|
pathParams: [],
|
|
314
|
-
queryParams: ["pageToken", "page", "pageSize", "userId", "toolName", "timeframe", "includeTools", "kind"],
|
|
604
|
+
queryParams: ["pageToken", "page", "pageSize", "userId", "toolName", "source", "sourceRef", "timeframe", "includeTools", "kind"],
|
|
315
605
|
requestSchema: null,
|
|
316
606
|
responseSchema: "ListConversationsResponseDto"
|
|
317
607
|
},
|
|
@@ -461,7 +751,7 @@ var OPERATIONS = {
|
|
|
461
751
|
service: "modus-api",
|
|
462
752
|
serverUrl: "https://api.getmodus.com",
|
|
463
753
|
pathParams: ["id"],
|
|
464
|
-
queryParams: ["pageToken", "page", "pageSize", "userId", "toolName", "timeframe", "includeTools"],
|
|
754
|
+
queryParams: ["pageToken", "page", "pageSize", "userId", "toolName", "source", "sourceRef", "timeframe", "includeTools"],
|
|
465
755
|
requestSchema: null,
|
|
466
756
|
responseSchema: "ListConversationsResponseDto"
|
|
467
757
|
},
|
|
@@ -1105,12 +1395,28 @@ var WRITE_BODY_ALLOWED_KEYS = {
|
|
|
1105
1395
|
ContextCreatorsController_createLink: ["url", "title", "isCrawl", "pageLimit"],
|
|
1106
1396
|
ContextCreatorsController_createNote: ["title", "content"],
|
|
1107
1397
|
ContextCreatorsController_createSavedQuery: ["name", "connectionId", "query", "description", "path"],
|
|
1398
|
+
ContextFilesController_finalize: ["fileName", "folderPath"],
|
|
1399
|
+
ContextFilesController_finalizeMany: ["uploads"],
|
|
1400
|
+
ContextFilesController_uploadFromUrl: ["url", "fileName", "folderPath"],
|
|
1401
|
+
ContextFilesController_uploadFromUrls: ["urls"],
|
|
1402
|
+
ContextFilesController_uploadUrl: ["fileName", "contentType", "fileSize"],
|
|
1403
|
+
ContextFilesController_uploadUrls: ["files"],
|
|
1108
1404
|
ContextItemsController_lookup: ["contextType", "dataPath", "contentProjection"],
|
|
1109
1405
|
ContextItemsController_update: ["contextType", "content", "description", "userFeedback", "topics"],
|
|
1110
1406
|
CustomContextItemsController_batchCreate: ["items"],
|
|
1111
1407
|
CustomContextItemsController_create: ["kind", "sourceId", "sourceName", "collectionId", "collectionName", "externalId", "fieldName", "name", "entityType", "description", "content", "url", "attributes", "dataType", "value", "samples", "raw", "topics", "idempotencyKey", "access"],
|
|
1408
|
+
CustomContextItemsController_createRelations: ["relations"],
|
|
1112
1409
|
CustomContextItemsController_update: ["name", "entityType", "description", "content", "url", "attributes", "dataType", "value", "samples", "raw", "topics"],
|
|
1410
|
+
DashboardsController_create: ["title", "description", "definition", "access"],
|
|
1411
|
+
DashboardsController_createElement: ["expectedRevision", "kind", "title", "layout"],
|
|
1412
|
+
DashboardsController_publish: ["expectedRevision"],
|
|
1413
|
+
DashboardsController_transferOwnership: ["newOwnerUserId"],
|
|
1414
|
+
DashboardsController_updateAccess: ["visibility", "groupPermissions", "sharedWith"],
|
|
1415
|
+
DashboardsController_updateDraft: ["expectedRevision", "title", "description", "definition"],
|
|
1416
|
+
DashboardsController_updateElement: ["expectedRevision", "patch"],
|
|
1417
|
+
DashboardsController_updateLayout: ["expectedRevision", "elements"],
|
|
1113
1418
|
EvaluationsController_updateConfig: ["enabled", "cadence", "judgeModel", "judgeGuidance", "notifications"],
|
|
1419
|
+
IngestedDataController_upload: ["integration_type", "request", "response"],
|
|
1114
1420
|
ModusChatController_chat: ["message", "model"],
|
|
1115
1421
|
ModusContextController_compose: ["message", "limit"],
|
|
1116
1422
|
ModusRunsController_create: ["message", "sessionId", "organizationId", "version", "fileThreadId", "config", "attachments", "userContext", "source", "runId", "subordinateSkillIds"],
|
|
@@ -1176,6 +1482,8 @@ var ALLOWED_CHAT_MODELS = /* @__PURE__ */ new Set([
|
|
|
1176
1482
|
"qwen3-coder",
|
|
1177
1483
|
"qwen3-32b",
|
|
1178
1484
|
"deepseek-chat-v3.1",
|
|
1485
|
+
"deepseek-v4-pro",
|
|
1486
|
+
"deepseek-v4-flash-latest",
|
|
1179
1487
|
"minimax-m2.7",
|
|
1180
1488
|
"llama-4-maverick",
|
|
1181
1489
|
"llama-4-scout",
|
|
@@ -1599,7 +1907,7 @@ function formatConfigForLog(config) {
|
|
|
1599
1907
|
}
|
|
1600
1908
|
|
|
1601
1909
|
// src/_http.ts
|
|
1602
|
-
var USER_AGENT = `modus-typescript/${"0.
|
|
1910
|
+
var USER_AGENT = `modus-typescript/${"0.7.0"} (node/${process.version}; ${process.platform})`;
|
|
1603
1911
|
function buildUrl(baseUrl, path, params) {
|
|
1604
1912
|
const url = new URL(path.startsWith("/") ? path : `/${path}`, baseUrl);
|
|
1605
1913
|
if (params) {
|
|
@@ -2026,7 +2334,16 @@ var WorkflowRunsResource = class {
|
|
|
2026
2334
|
* @param options.timeframe - Filter by recency (`last_hour`, `last_day`, or `last_week`).
|
|
2027
2335
|
* @param options.approvalScope - Filter approval-related runs (`mine` or `all`).
|
|
2028
2336
|
* @param options.search - Free-text search filter.
|
|
2029
|
-
* @returns A page of run summaries.
|
|
2337
|
+
* @returns A page of run summaries — use `.autoPagingIter()` for all pages.
|
|
2338
|
+
*
|
|
2339
|
+
* @example
|
|
2340
|
+
* ```ts
|
|
2341
|
+
* for await (const run of (
|
|
2342
|
+
* await client.workflows.runs.list(workflowId, { status: 'completed' })
|
|
2343
|
+
* ).autoPagingIter()) {
|
|
2344
|
+
* console.log(run.workflowId, run.status, run.startedAt)
|
|
2345
|
+
* }
|
|
2346
|
+
* ```
|
|
2030
2347
|
*/
|
|
2031
2348
|
list(workflowId, options = {}) {
|
|
2032
2349
|
validateId(workflowId, "workflow_id");
|
|
@@ -2066,10 +2383,16 @@ var WorkflowRunsResource = class {
|
|
|
2066
2383
|
* Retrieve a workflow run by id.
|
|
2067
2384
|
*
|
|
2068
2385
|
* @param workflowId - Workflow id or slug the run belongs to.
|
|
2069
|
-
* @param runId - Run id.
|
|
2386
|
+
* @param runId - Run id (the list row's `workflowId` field, not the composite `id`).
|
|
2070
2387
|
* @param options.temporalRunId - Optional internal execution id when disambiguating retries.
|
|
2071
2388
|
* @returns Run details including status and output.
|
|
2072
2389
|
* @throws {NotFoundError} When the run does not exist.
|
|
2390
|
+
*
|
|
2391
|
+
* @example
|
|
2392
|
+
* ```ts
|
|
2393
|
+
* const run = await client.workflows.runs.get(workflowId, runId)
|
|
2394
|
+
* console.log(run.status)
|
|
2395
|
+
* ```
|
|
2073
2396
|
*/
|
|
2074
2397
|
async get(workflowId, runId, options = {}) {
|
|
2075
2398
|
validateId(workflowId, "workflow_id");
|
|
@@ -2092,8 +2415,8 @@ var WorkflowRunsResource = class {
|
|
|
2092
2415
|
* @example
|
|
2093
2416
|
* ```ts
|
|
2094
2417
|
* const stream = client.workflows.runs.create(workflowId, {
|
|
2095
|
-
* message:
|
|
2096
|
-
*
|
|
2418
|
+
* message: "Summarize yesterday's sales",
|
|
2419
|
+
* config: { model: 'claude-sonnet-5' },
|
|
2097
2420
|
* })
|
|
2098
2421
|
* for await (const event of stream) {
|
|
2099
2422
|
* if (event.type === 'token') process.stdout.write(event.content)
|
|
@@ -2108,21 +2431,45 @@ var WorkflowRunsResource = class {
|
|
|
2108
2431
|
/**
|
|
2109
2432
|
* Start a scope run and stream run events.
|
|
2110
2433
|
*
|
|
2434
|
+
* Same event stream shape as {@link create}, but targets a published scope.
|
|
2435
|
+
*
|
|
2111
2436
|
* @param scopeId - Scope id to run.
|
|
2112
2437
|
* @param body - Run body (`message`, optional `sessionId`, optional `version` as `published` or `draft`).
|
|
2113
2438
|
* @param options.idempotencyKey - Client-supplied idempotency key; defaults to `body.runId` or a new uuid.
|
|
2114
2439
|
* @returns A stream of run events.
|
|
2440
|
+
*
|
|
2441
|
+
* @example
|
|
2442
|
+
* ```ts
|
|
2443
|
+
* const stream = client.workflows.runs.createScope(scopeId, {
|
|
2444
|
+
* message: 'What is our ARR trend?',
|
|
2445
|
+
* config: { model: 'claude-sonnet-5' },
|
|
2446
|
+
* })
|
|
2447
|
+
* for await (const event of stream) {
|
|
2448
|
+
* if (event.type === 'token') process.stdout.write(event.content)
|
|
2449
|
+
* }
|
|
2450
|
+
* ```
|
|
2115
2451
|
*/
|
|
2116
2452
|
createScope(scopeId, body, options = {}) {
|
|
2117
2453
|
validateId(scopeId, "scope_id");
|
|
2118
2454
|
return this.createRun("ScopeRunsController_create", body, { id: scopeId }, options);
|
|
2119
2455
|
}
|
|
2120
2456
|
/**
|
|
2121
|
-
* Start a Modus assistant run and stream run events.
|
|
2457
|
+
* Start a Modus org-assistant run and stream run events.
|
|
2122
2458
|
*
|
|
2123
2459
|
* @param body - Run body (`message`, optional `sessionId`, optional `subordinateSkillIds` to narrow context).
|
|
2124
2460
|
* @param options.idempotencyKey - Client-supplied idempotency key; defaults to `body.runId` or a new uuid.
|
|
2125
2461
|
* @returns A stream of run events.
|
|
2462
|
+
*
|
|
2463
|
+
* @example
|
|
2464
|
+
* ```ts
|
|
2465
|
+
* const stream = client.workflows.runs.createModus({
|
|
2466
|
+
* message: 'Summarize ARR in three bullets.',
|
|
2467
|
+
* config: { model: 'claude-sonnet-5' },
|
|
2468
|
+
* })
|
|
2469
|
+
* for await (const event of stream) {
|
|
2470
|
+
* if (event.type === 'token') process.stdout.write(event.content)
|
|
2471
|
+
* }
|
|
2472
|
+
* ```
|
|
2126
2473
|
*/
|
|
2127
2474
|
createModus(body, options = {}) {
|
|
2128
2475
|
return this.createRun("ModusRunsController_create", body, {}, options);
|
|
@@ -2134,6 +2481,18 @@ var WorkflowRunsResource = class {
|
|
|
2134
2481
|
* @param body - Resume body (`message`, `sessionId`, and `decision`: `approve` / `deny` / `connected` / `cancelled`).
|
|
2135
2482
|
* @param options.idempotencyKey - Client-supplied idempotency key; defaults to `body.runId` or a new uuid.
|
|
2136
2483
|
* @returns A stream of run events.
|
|
2484
|
+
*
|
|
2485
|
+
* @example
|
|
2486
|
+
* ```ts
|
|
2487
|
+
* const stream = client.workflows.runs.resume(runId, {
|
|
2488
|
+
* decision: 'approve',
|
|
2489
|
+
* message: 'Looks good — continue.',
|
|
2490
|
+
* sessionId,
|
|
2491
|
+
* })
|
|
2492
|
+
* for await (const event of stream) {
|
|
2493
|
+
* if (event.type === 'token') process.stdout.write(event.content)
|
|
2494
|
+
* }
|
|
2495
|
+
* ```
|
|
2137
2496
|
*/
|
|
2138
2497
|
resume(runId, body, options = {}) {
|
|
2139
2498
|
validateId(runId, "run_id");
|
|
@@ -2143,6 +2502,11 @@ var WorkflowRunsResource = class {
|
|
|
2143
2502
|
* Cancel a run that is still in progress.
|
|
2144
2503
|
*
|
|
2145
2504
|
* @param runId - Run id to cancel.
|
|
2505
|
+
*
|
|
2506
|
+
* @example
|
|
2507
|
+
* ```ts
|
|
2508
|
+
* await client.workflows.runs.cancel(runId)
|
|
2509
|
+
* ```
|
|
2146
2510
|
*/
|
|
2147
2511
|
async cancel(runId) {
|
|
2148
2512
|
validateId(runId, "run_id");
|
|
@@ -2336,15 +2700,22 @@ var WorkflowsResource = class {
|
|
|
2336
2700
|
this.workflowActions = new AgentWorkflowActionsResource(http, config);
|
|
2337
2701
|
}
|
|
2338
2702
|
/**
|
|
2339
|
-
* List workflows.
|
|
2703
|
+
* List workflows in the organisation.
|
|
2340
2704
|
*
|
|
2341
2705
|
* @param options.pageSize - Maximum items per page (default 25).
|
|
2342
2706
|
* @param options.pageToken - Opaque token from a previous page.
|
|
2343
|
-
* @param options.search -
|
|
2707
|
+
* @param options.search - Case-insensitive substring filter on the workflow name.
|
|
2344
2708
|
* @param options.type - Workflow kind: `"task"` or `"workflow"`.
|
|
2345
2709
|
* @param options.view - Which saved version to return (`active` or `draft`).
|
|
2346
2710
|
* @param options.includeVariation - Include variation metadata when supported.
|
|
2347
|
-
* @returns A page of workflows.
|
|
2711
|
+
* @returns A page of workflows — use `.autoPagingIter()` for all pages.
|
|
2712
|
+
*
|
|
2713
|
+
* @example
|
|
2714
|
+
* ```ts
|
|
2715
|
+
* for await (const wf of (await client.workflows.list({ search: 'digest' })).autoPagingIter()) {
|
|
2716
|
+
* console.log(wf.id, wf.name, wf.status)
|
|
2717
|
+
* }
|
|
2718
|
+
* ```
|
|
2348
2719
|
*/
|
|
2349
2720
|
list(options = {}) {
|
|
2350
2721
|
const pageSize = options.pageSize ?? 25;
|
|
@@ -2384,8 +2755,14 @@ var WorkflowsResource = class {
|
|
|
2384
2755
|
* @param workflowId - Numeric id or slug.
|
|
2385
2756
|
* @param options.view - Which saved version to return (`active` or `draft`).
|
|
2386
2757
|
* @param options.includeVariation - Include variation metadata when supported.
|
|
2387
|
-
* @returns The workflow.
|
|
2758
|
+
* @returns The workflow (`id`, `name`, `status`, …).
|
|
2388
2759
|
* @throws {NotFoundError} When no workflow matches the id or slug.
|
|
2760
|
+
*
|
|
2761
|
+
* @example
|
|
2762
|
+
* ```ts
|
|
2763
|
+
* const wf = await client.workflows.get('weekly-digest')
|
|
2764
|
+
* console.log(wf.name, wf.status)
|
|
2765
|
+
* ```
|
|
2389
2766
|
*/
|
|
2390
2767
|
async get(workflowId, options = {}) {
|
|
2391
2768
|
validateId(workflowId, "workflow_id");
|
|
@@ -2504,6 +2881,12 @@ var CustomContextItemsResource = class {
|
|
|
2504
2881
|
* @param options.searchQuery - Free-text search filter.
|
|
2505
2882
|
* @param options.topics - Filter to items tagged with any of these topics.
|
|
2506
2883
|
* @returns A page of custom context items.
|
|
2884
|
+
* @example
|
|
2885
|
+
* ```ts
|
|
2886
|
+
* const client = new Modus()
|
|
2887
|
+
* const page = await client.context.customItems.list({ pageSize: 25 })
|
|
2888
|
+
* for (const item of page.items) console.log(item.uid, item.contextType)
|
|
2889
|
+
* ```
|
|
2507
2890
|
*/
|
|
2508
2891
|
list(options = {}) {
|
|
2509
2892
|
const pageSize = options.pageSize ?? 25;
|
|
@@ -2532,6 +2915,11 @@ var CustomContextItemsResource = class {
|
|
|
2532
2915
|
* @param uid - Item uid.
|
|
2533
2916
|
* @returns The custom context item.
|
|
2534
2917
|
* @throws {NotFoundError} When no item matches the uid.
|
|
2918
|
+
* @example
|
|
2919
|
+
* ```ts
|
|
2920
|
+
* const client = new Modus()
|
|
2921
|
+
* const item = await client.context.customItems.get('PLACEHOLDER_UID')
|
|
2922
|
+
* ```
|
|
2535
2923
|
*/
|
|
2536
2924
|
async get(uid) {
|
|
2537
2925
|
return parseContextItem(
|
|
@@ -2552,6 +2940,7 @@ var CustomContextItemsResource = class {
|
|
|
2552
2940
|
*
|
|
2553
2941
|
* @example
|
|
2554
2942
|
* ```ts
|
|
2943
|
+
* const client = new Modus()
|
|
2555
2944
|
* const created = await client.context.customItems.create({
|
|
2556
2945
|
* kind: 'entity',
|
|
2557
2946
|
* sourceId: 'my-source',
|
|
@@ -2575,6 +2964,7 @@ var CustomContextItemsResource = class {
|
|
|
2575
2964
|
*
|
|
2576
2965
|
* @example
|
|
2577
2966
|
* ```ts
|
|
2967
|
+
* const client = new Modus()
|
|
2578
2968
|
* const created = await client.context.customItems.batchCreate([
|
|
2579
2969
|
* { kind: 'field', sourceId: 'src', fieldName: 'region', dataType: 'string' },
|
|
2580
2970
|
* { kind: 'field', sourceId: 'src', fieldName: 'amount', dataType: 'number' },
|
|
@@ -2592,12 +2982,45 @@ var CustomContextItemsResource = class {
|
|
|
2592
2982
|
const items = data.contextItems;
|
|
2593
2983
|
return Array.isArray(items) ? items.map(parseCreatedCustomContextItem) : [];
|
|
2594
2984
|
}
|
|
2985
|
+
/**
|
|
2986
|
+
* Create or update typed relations between context items.
|
|
2987
|
+
*
|
|
2988
|
+
* @param relations - Relations with source and target item uids, a snake_case type, and optional content.
|
|
2989
|
+
* @returns Number of relations created or updated.
|
|
2990
|
+
* @example
|
|
2991
|
+
* ```ts
|
|
2992
|
+
* const client = new Modus()
|
|
2993
|
+
* await client.context.customItems.createRelations([{
|
|
2994
|
+
* fromUid: 'SOURCE_UID',
|
|
2995
|
+
* toUid: 'TARGET_UID',
|
|
2996
|
+
* relationType: 'depends_on',
|
|
2997
|
+
* }])
|
|
2998
|
+
* ```
|
|
2999
|
+
*/
|
|
3000
|
+
async createRelations(relations) {
|
|
3001
|
+
const data = asRecord(
|
|
3002
|
+
await invokeWithRetry(
|
|
3003
|
+
this.config,
|
|
3004
|
+
this.http,
|
|
3005
|
+
"CustomContextItemsController_createRelations",
|
|
3006
|
+
{ jsonBody: { relations } }
|
|
3007
|
+
)
|
|
3008
|
+
);
|
|
3009
|
+
return data.upsertedCount;
|
|
3010
|
+
}
|
|
2595
3011
|
/**
|
|
2596
3012
|
* Update a custom context item.
|
|
2597
3013
|
*
|
|
2598
3014
|
* @param uid - Item uid.
|
|
2599
3015
|
* @param input - Fields to change (kind and hierarchy ids cannot be changed).
|
|
2600
3016
|
* @returns The updated item uid.
|
|
3017
|
+
* @example
|
|
3018
|
+
* ```ts
|
|
3019
|
+
* const client = new Modus()
|
|
3020
|
+
* await client.context.customItems.update('PLACEHOLDER_UID', {
|
|
3021
|
+
* description: 'Updated summary',
|
|
3022
|
+
* })
|
|
3023
|
+
* ```
|
|
2601
3024
|
*/
|
|
2602
3025
|
async update(uid, input) {
|
|
2603
3026
|
return asRecord(
|
|
@@ -2612,6 +3035,11 @@ var CustomContextItemsResource = class {
|
|
|
2612
3035
|
*
|
|
2613
3036
|
* @param uid - Item uid.
|
|
2614
3037
|
* @returns Deletion confirmation with uid and context type.
|
|
3038
|
+
* @example
|
|
3039
|
+
* ```ts
|
|
3040
|
+
* const client = new Modus()
|
|
3041
|
+
* const result = await client.context.customItems.delete('PLACEHOLDER_UID')
|
|
3042
|
+
* ```
|
|
2615
3043
|
*/
|
|
2616
3044
|
async delete(uid) {
|
|
2617
3045
|
return parseDeletion(
|
|
@@ -2650,8 +3078,16 @@ var ContextItemsResource = class {
|
|
|
2650
3078
|
*
|
|
2651
3079
|
* @param options.pageSize - Maximum items per page (default 25).
|
|
2652
3080
|
* @param options.pageToken - Opaque token from a previous page.
|
|
2653
|
-
* @param options.contextType - Filter to a single context type.
|
|
2654
|
-
* @returns A page of context items.
|
|
3081
|
+
* @param options.contextType - Filter to a single context type (e.g. `"note"`).
|
|
3082
|
+
* @returns A page of context items — use `.autoPagingIter()` for all pages.
|
|
3083
|
+
*
|
|
3084
|
+
* @example
|
|
3085
|
+
* ```ts
|
|
3086
|
+
* const notes = await client.context.items.list({ contextType: 'note', pageSize: 50 })
|
|
3087
|
+
* for (const item of notes.items) {
|
|
3088
|
+
* console.log(item.description ?? item.uid, item.uid)
|
|
3089
|
+
* }
|
|
3090
|
+
* ```
|
|
2655
3091
|
*/
|
|
2656
3092
|
list(options = {}) {
|
|
2657
3093
|
const pageSize = options.pageSize ?? 25;
|
|
@@ -2675,8 +3111,14 @@ var ContextItemsResource = class {
|
|
|
2675
3111
|
* Retrieve a knowledge-base item by uid.
|
|
2676
3112
|
*
|
|
2677
3113
|
* @param uid - Item uid.
|
|
2678
|
-
* @returns The context item.
|
|
3114
|
+
* @returns The context item (`uid`, `contextType`, `content`, …).
|
|
2679
3115
|
* @throws {NotFoundError} When no item matches the uid.
|
|
3116
|
+
*
|
|
3117
|
+
* @example
|
|
3118
|
+
* ```ts
|
|
3119
|
+
* const item = await client.context.items.get(uid)
|
|
3120
|
+
* console.log(item.contextType, item.description ?? item.uid)
|
|
3121
|
+
* ```
|
|
2680
3122
|
*/
|
|
2681
3123
|
async get(uid) {
|
|
2682
3124
|
const data = await invokeWithRetry(this.config, this.http, "ContextItemsController_get", {
|
|
@@ -2687,10 +3129,19 @@ var ContextItemsResource = class {
|
|
|
2687
3129
|
/**
|
|
2688
3130
|
* Look up a knowledge-base item by type and data path.
|
|
2689
3131
|
*
|
|
2690
|
-
* @param options.contextType - Context type to match.
|
|
3132
|
+
* @param options.contextType - Context type to match (e.g. `"note"`).
|
|
2691
3133
|
* @param options.dataPath - Hierarchical path segments that identify the item.
|
|
2692
3134
|
* @param options.contentProjection - Optional fields to include from item content.
|
|
2693
3135
|
* @returns The matching row, or `undefined` when no item is found (404).
|
|
3136
|
+
*
|
|
3137
|
+
* @example
|
|
3138
|
+
* ```ts
|
|
3139
|
+
* const found = await client.context.items.lookup({
|
|
3140
|
+
* contextType: 'note',
|
|
3141
|
+
* dataPath: ['finance', 'arr-definition'],
|
|
3142
|
+
* })
|
|
3143
|
+
* if (found) console.log(found.uid, found.description ?? found.uid)
|
|
3144
|
+
* ```
|
|
2694
3145
|
*/
|
|
2695
3146
|
async lookup(options) {
|
|
2696
3147
|
const body = omitUndefined({
|
|
@@ -2715,10 +3166,22 @@ var ContextItemsResource = class {
|
|
|
2715
3166
|
*
|
|
2716
3167
|
* @param uid - Item uid.
|
|
2717
3168
|
* @param contextType - Context type of the item.
|
|
2718
|
-
* @param contentKeyPath - Dot path to the value field inside item content.
|
|
3169
|
+
* @param contentKeyPath - Dot path to the value field inside item content (e.g. `"enumValues"`).
|
|
2719
3170
|
* @param options.pageSize - Maximum items per page (default 25).
|
|
2720
3171
|
* @param options.pageToken - Opaque token from a previous page.
|
|
2721
3172
|
* @returns A page of value rows.
|
|
3173
|
+
*
|
|
3174
|
+
* @example
|
|
3175
|
+
* ```ts
|
|
3176
|
+
* // Replace PLACEHOLDER_UID with a real uid whose content has enumValues.
|
|
3177
|
+
* const page = await client.context.items.listValues(
|
|
3178
|
+
* 'PLACEHOLDER_UID',
|
|
3179
|
+
* 'table_column',
|
|
3180
|
+
* 'enumValues',
|
|
3181
|
+
* { pageSize: 25 },
|
|
3182
|
+
* )
|
|
3183
|
+
* for (const row of page.items) console.log(row)
|
|
3184
|
+
* ```
|
|
2722
3185
|
*/
|
|
2723
3186
|
listValues(uid, contextType, contentKeyPath, options = {}) {
|
|
2724
3187
|
const pageSize = options.pageSize ?? 25;
|
|
@@ -2733,6 +3196,14 @@ var ContextItemsResource = class {
|
|
|
2733
3196
|
* @param options.pageSize - Maximum items per page (default 25).
|
|
2734
3197
|
* @param options.pageToken - Opaque token from a previous page.
|
|
2735
3198
|
* @returns A page of value rows.
|
|
3199
|
+
*
|
|
3200
|
+
* @example
|
|
3201
|
+
* ```ts
|
|
3202
|
+
* // Replace PLACEHOLDER_UID with a real uid that has enumValues in content.
|
|
3203
|
+
* const item = await client.context.items.get('PLACEHOLDER_UID')
|
|
3204
|
+
* const page = await client.context.items.listValuesFor(item, 'enumValues')
|
|
3205
|
+
* for (const row of page.items) console.log(row)
|
|
3206
|
+
* ```
|
|
2736
3207
|
*/
|
|
2737
3208
|
listValuesFor(item, contentKeyPath, options = {}) {
|
|
2738
3209
|
return this.listValues(item.uid, item.contextType, contentKeyPath, options);
|
|
@@ -2765,9 +3236,51 @@ var ContextResource = class {
|
|
|
2765
3236
|
}
|
|
2766
3237
|
};
|
|
2767
3238
|
|
|
3239
|
+
// src/resources/ingested-data.ts
|
|
3240
|
+
var IngestedDataResource = class {
|
|
3241
|
+
/** @internal */
|
|
3242
|
+
constructor(http, config) {
|
|
3243
|
+
this.http = http;
|
|
3244
|
+
this.config = config;
|
|
3245
|
+
}
|
|
3246
|
+
/**
|
|
3247
|
+
* Store a complete SQL or HTTP request and response exactly once.
|
|
3248
|
+
*
|
|
3249
|
+
* Identity covers the complete organization, integration, request, and response
|
|
3250
|
+
* content. A duplicate raises `ConflictError`, which means the identical payload
|
|
3251
|
+
* is already stored and may be treated as a safe retry outcome.
|
|
3252
|
+
*
|
|
3253
|
+
* @param options.integrationType - Canonical Modus integration identifier.
|
|
3254
|
+
* @param options.request - Exact SQL or HTTP request that produced the response.
|
|
3255
|
+
* @param options.response - Response format, optional source HTTP status, and exact string content. SQL requires CSV.
|
|
3256
|
+
* @returns The checksum of the stored envelope.
|
|
3257
|
+
* @throws {ConflictError} When the complete payload is already stored.
|
|
3258
|
+
*
|
|
3259
|
+
* @example
|
|
3260
|
+
* ```ts
|
|
3261
|
+
* const stored = await client.ingestedData.upload({
|
|
3262
|
+
* integrationType: 'generic',
|
|
3263
|
+
* request: { type: 'sql', query: 'SELECT id, total FROM orders' },
|
|
3264
|
+
* response: { format: 'csv', content: 'id,total\n1,42.00\n' },
|
|
3265
|
+
* })
|
|
3266
|
+
* console.log(stored.checksum)
|
|
3267
|
+
* ```
|
|
3268
|
+
*/
|
|
3269
|
+
async upload(options) {
|
|
3270
|
+
const data = await invokeWithRetry(this.config, this.http, "IngestedDataController_upload", {
|
|
3271
|
+
jsonBody: {
|
|
3272
|
+
integration_type: options.integrationType,
|
|
3273
|
+
request: options.request,
|
|
3274
|
+
response: options.response
|
|
3275
|
+
}
|
|
3276
|
+
});
|
|
3277
|
+
return data;
|
|
3278
|
+
}
|
|
3279
|
+
};
|
|
3280
|
+
|
|
2768
3281
|
// src/resources/modus/conversations.ts
|
|
2769
3282
|
var ALLOWED_KINDS = /* @__PURE__ */ new Set(["all", "modus", "scopes"]);
|
|
2770
|
-
function listParams(pageSize, pageToken, kind) {
|
|
3283
|
+
function listParams(pageSize, pageToken, kind, source, sourceRef) {
|
|
2771
3284
|
if (kind !== void 0 && !ALLOWED_KINDS.has(kind)) {
|
|
2772
3285
|
throw new Error(
|
|
2773
3286
|
`kind must be one of ${[...ALLOWED_KINDS].sort().join(", ")}, got ${JSON.stringify(kind)}`
|
|
@@ -2775,6 +3288,8 @@ function listParams(pageSize, pageToken, kind) {
|
|
|
2775
3288
|
}
|
|
2776
3289
|
const extra = {};
|
|
2777
3290
|
if (kind !== void 0) extra.kind = kind;
|
|
3291
|
+
if (source !== void 0) extra.source = source;
|
|
3292
|
+
if (sourceRef !== void 0) extra.sourceRef = sourceRef;
|
|
2778
3293
|
return aipListParams(pageSize, pageToken, extra);
|
|
2779
3294
|
}
|
|
2780
3295
|
function parseListItem(raw) {
|
|
@@ -2794,24 +3309,32 @@ var ModusConversationsResource = class {
|
|
|
2794
3309
|
* @param options.pageSize - Items per page (default 25).
|
|
2795
3310
|
* @param options.pageToken - Opaque token from a previous page.
|
|
2796
3311
|
* @param options.kind - `"modus"`, `"scopes"`, or `"all"`.
|
|
3312
|
+
* @param options.source - Restrict to conversations started from this UI surface
|
|
3313
|
+
* (e.g. `"context_chat"`, `"dashboard_copilot"`, `"slack"`). Only valid with an
|
|
3314
|
+
* omitted `kind` or `kind: "all"`; the API throws an `UnprocessableError` (422)
|
|
3315
|
+
* if combined with `kind: "modus"` or `kind: "scopes"`.
|
|
3316
|
+
* @param options.sourceRef - Narrow `source` to one instance of that surface — for
|
|
3317
|
+
* `"dashboard_copilot"`, a dashboard id. Requires `source`; the API throws an
|
|
3318
|
+
* `UnprocessableError` (422) if sent on its own. Conversations recorded before
|
|
3319
|
+
* this filter shipped carry no instance key and never match it.
|
|
2797
3320
|
* @returns Page of conversation list items.
|
|
2798
3321
|
*/
|
|
2799
3322
|
list(options = {}) {
|
|
2800
3323
|
const pageSize = options.pageSize ?? 25;
|
|
2801
3324
|
validatePageSize(pageSize);
|
|
2802
|
-
return this.listPage(pageSize, options.pageToken, options.kind);
|
|
3325
|
+
return this.listPage(pageSize, options.pageToken, options.kind, options.source, options.sourceRef);
|
|
2803
3326
|
}
|
|
2804
|
-
async listPage(pageSize, pageToken, kind) {
|
|
3327
|
+
async listPage(pageSize, pageToken, kind, source, sourceRef) {
|
|
2805
3328
|
const data = asRecord(
|
|
2806
3329
|
await invokeWithRetry(this.config, this.http, "ModusConversationsController_list", {
|
|
2807
|
-
query: listParams(pageSize, pageToken, kind)
|
|
3330
|
+
query: listParams(pageSize, pageToken, kind, source, sourceRef)
|
|
2808
3331
|
})
|
|
2809
3332
|
);
|
|
2810
3333
|
return buildAipPage(
|
|
2811
3334
|
data,
|
|
2812
3335
|
"conversations",
|
|
2813
3336
|
parseListItem,
|
|
2814
|
-
(token) => this.listPage(pageSize, token, kind)
|
|
3337
|
+
(token) => this.listPage(pageSize, token, kind, source, sourceRef)
|
|
2815
3338
|
);
|
|
2816
3339
|
}
|
|
2817
3340
|
/**
|
|
@@ -2837,11 +3360,17 @@ var ModusResource = class {
|
|
|
2837
3360
|
this.conversations = new ModusConversationsResource(http, config);
|
|
2838
3361
|
}
|
|
2839
3362
|
/**
|
|
2840
|
-
*
|
|
3363
|
+
* Compose full-environment context for an intent without running chat.
|
|
3364
|
+
*
|
|
3365
|
+
* @param message - Natural-language intent used to select context.
|
|
3366
|
+
* @param options.limit - Maximum context items to return. Omit to return all selected items.
|
|
3367
|
+
* @returns Composition metadata (counts / session id). Use `chat` for a reply.
|
|
2841
3368
|
*
|
|
2842
|
-
* @
|
|
2843
|
-
*
|
|
2844
|
-
*
|
|
3369
|
+
* @example
|
|
3370
|
+
* ```ts
|
|
3371
|
+
* const ctx = await client.modus.getContext('What tables describe revenue?', { limit: 5 })
|
|
3372
|
+
* console.log(ctx.originalCount, ctx.sessionId)
|
|
3373
|
+
* ```
|
|
2845
3374
|
*/
|
|
2846
3375
|
async getContext(message, options = {}) {
|
|
2847
3376
|
const data = await invokeWithRetry(this.config, this.http, "ModusContextController_compose", {
|
|
@@ -2850,29 +3379,48 @@ var ModusResource = class {
|
|
|
2850
3379
|
return data;
|
|
2851
3380
|
}
|
|
2852
3381
|
/**
|
|
2853
|
-
* Send a message to Modus
|
|
3382
|
+
* Send a message to Modus and wait for the complete reply.
|
|
2854
3383
|
*
|
|
2855
|
-
* @param message -
|
|
3384
|
+
* @param message - User message text.
|
|
2856
3385
|
* @param options.model - Required model id (e.g. `"claude-sonnet-5"`).
|
|
2857
|
-
* @param options.threadId - Continue an existing conversation.
|
|
2858
|
-
* @returns Chat result
|
|
3386
|
+
* @param options.threadId - Continue an existing conversation; omit to start new.
|
|
3387
|
+
* @returns Chat result: `content`, `threadId` (for follow-ups), `runId`.
|
|
2859
3388
|
*
|
|
2860
3389
|
* @example
|
|
2861
3390
|
* ```ts
|
|
2862
|
-
* const result = await client.modus.chat('What tables describe revenue?', {
|
|
3391
|
+
* const result = await client.modus.chat('What tables describe revenue?', {
|
|
3392
|
+
* model: 'claude-sonnet-5',
|
|
3393
|
+
* })
|
|
2863
3394
|
* console.log(result.content, result.threadId)
|
|
3395
|
+
* const follow = await client.modus.chat('Break that down by region.', {
|
|
3396
|
+
* model: 'claude-sonnet-5',
|
|
3397
|
+
* threadId: result.threadId,
|
|
3398
|
+
* })
|
|
2864
3399
|
* ```
|
|
2865
3400
|
*/
|
|
2866
3401
|
chat(message, options) {
|
|
2867
3402
|
return modusChatBuffered(this.http, message, options);
|
|
2868
3403
|
}
|
|
2869
3404
|
/**
|
|
2870
|
-
* Stream a Modus reply token by token.
|
|
3405
|
+
* Stream a Modus reply token by token (SSE).
|
|
2871
3406
|
*
|
|
2872
|
-
*
|
|
3407
|
+
* The request starts when you consume `textStream()` or `eventStream()`.
|
|
3408
|
+
*
|
|
3409
|
+
* @param message - User message text.
|
|
2873
3410
|
* @param options.model - Required model id (e.g. `"claude-sonnet-5"`).
|
|
2874
|
-
* @param options.threadId - Continue an existing conversation.
|
|
2875
|
-
* @returns Chat stream.
|
|
3411
|
+
* @param options.threadId - Continue an existing conversation; omit to start new.
|
|
3412
|
+
* @returns Chat stream — iterate `textStream()` for tokens.
|
|
3413
|
+
*
|
|
3414
|
+
* @example
|
|
3415
|
+
* ```ts
|
|
3416
|
+
* const stream = client.modus.chatStream('Summarize ARR in three bullets.', {
|
|
3417
|
+
* model: 'claude-sonnet-5',
|
|
3418
|
+
* })
|
|
3419
|
+
* for await (const token of stream.textStream()) {
|
|
3420
|
+
* process.stdout.write(token)
|
|
3421
|
+
* }
|
|
3422
|
+
* console.log(stream.getFinalResult().threadId)
|
|
3423
|
+
* ```
|
|
2876
3424
|
*/
|
|
2877
3425
|
chatStream(message, options) {
|
|
2878
3426
|
return modusChatStreamSession(this.http, this.config, message, options);
|
|
@@ -2897,26 +3445,44 @@ var ScopeConversationsResource = class {
|
|
|
2897
3445
|
*
|
|
2898
3446
|
* @param options.pageSize - Items per page (default 25).
|
|
2899
3447
|
* @param options.pageToken - Opaque token from a previous page.
|
|
2900
|
-
* @
|
|
3448
|
+
* @param options.source - Restrict to conversations started from this UI surface
|
|
3449
|
+
* (e.g. `"context_chat"`, `"dashboard_copilot"`, `"slack"`).
|
|
3450
|
+
* @param options.sourceRef - Narrow `source` to one instance of that surface — for
|
|
3451
|
+
* `"dashboard_copilot"`, a dashboard id. Requires `source`; the API throws an
|
|
3452
|
+
* `UnprocessableError` (422) if sent on its own. Conversations recorded before
|
|
3453
|
+
* this filter shipped carry no instance key and never match it.
|
|
3454
|
+
* @returns Page of conversation list items (`threadId`, `firstMessage`, `messageCount`).
|
|
3455
|
+
*
|
|
3456
|
+
* @example
|
|
3457
|
+
* ```ts
|
|
3458
|
+
* for await (const row of (
|
|
3459
|
+
* await client.scopes.conversations(scopeId).list({ pageSize: 10 })
|
|
3460
|
+
* ).autoPagingIter()) {
|
|
3461
|
+
* console.log(row.threadId, row.firstMessage, row.messageCount)
|
|
3462
|
+
* }
|
|
3463
|
+
* ```
|
|
2901
3464
|
*/
|
|
2902
3465
|
list(options = {}) {
|
|
2903
3466
|
const pageSize = options.pageSize ?? 25;
|
|
2904
3467
|
validatePageSize(pageSize);
|
|
2905
|
-
return this.listPage(pageSize, options.pageToken);
|
|
3468
|
+
return this.listPage(pageSize, options.pageToken, options.source, options.sourceRef);
|
|
2906
3469
|
}
|
|
2907
|
-
async listPage(pageSize, pageToken) {
|
|
3470
|
+
async listPage(pageSize, pageToken, source, sourceRef) {
|
|
2908
3471
|
validateId(this.scopeId, "scope_id");
|
|
3472
|
+
const extra = {};
|
|
3473
|
+
if (source !== void 0) extra.source = source;
|
|
3474
|
+
if (sourceRef !== void 0) extra.sourceRef = sourceRef;
|
|
2909
3475
|
const data = asRecord(
|
|
2910
3476
|
await invokeWithRetry(this.config, this.http, "ScopeConversationsController_list", {
|
|
2911
3477
|
pathParams: { id: this.scopeId },
|
|
2912
|
-
query: aipListParams(pageSize, pageToken)
|
|
3478
|
+
query: aipListParams(pageSize, pageToken, extra)
|
|
2913
3479
|
})
|
|
2914
3480
|
);
|
|
2915
3481
|
return buildAipPage(
|
|
2916
3482
|
data,
|
|
2917
3483
|
"conversations",
|
|
2918
3484
|
parseListItem2,
|
|
2919
|
-
(token) => this.listPage(pageSize, token)
|
|
3485
|
+
(token) => this.listPage(pageSize, token, source, sourceRef)
|
|
2920
3486
|
);
|
|
2921
3487
|
}
|
|
2922
3488
|
/**
|
|
@@ -2925,7 +3491,15 @@ var ScopeConversationsResource = class {
|
|
|
2925
3491
|
* @param threadId - Conversation thread id.
|
|
2926
3492
|
* @param options.messageLimit - Maximum messages to return (1–100).
|
|
2927
3493
|
* @param options.beforeMessageIndex - Return messages before this index (requires messageLimit).
|
|
2928
|
-
* @returns Conversation with messages.
|
|
3494
|
+
* @returns Conversation with `messages` (`type`, `content`).
|
|
3495
|
+
*
|
|
3496
|
+
* @example
|
|
3497
|
+
* ```ts
|
|
3498
|
+
* const thread = await client.scopes.conversations(scopeId).get(row.threadId)
|
|
3499
|
+
* for (const msg of thread.messages) {
|
|
3500
|
+
* console.log(msg.type, String(msg.content).slice(0, 80))
|
|
3501
|
+
* }
|
|
3502
|
+
* ```
|
|
2929
3503
|
*/
|
|
2930
3504
|
async get(threadId, options = {}) {
|
|
2931
3505
|
validateId(this.scopeId, "scope_id");
|
|
@@ -2966,6 +3540,15 @@ var ScopesResource = class {
|
|
|
2966
3540
|
*
|
|
2967
3541
|
* @param scopeId - Scope numeric id or slug.
|
|
2968
3542
|
* @returns Conversations resource for the scope.
|
|
3543
|
+
*
|
|
3544
|
+
* @example
|
|
3545
|
+
* ```ts
|
|
3546
|
+
* for await (const row of (
|
|
3547
|
+
* await client.scopes.conversations(scopeId).list({ pageSize: 10 })
|
|
3548
|
+
* ).autoPagingIter()) {
|
|
3549
|
+
* console.log(row.threadId, row.firstMessage)
|
|
3550
|
+
* }
|
|
3551
|
+
* ```
|
|
2969
3552
|
*/
|
|
2970
3553
|
conversations(scopeId) {
|
|
2971
3554
|
return new ScopeConversationsResource(this.http, this.config, scopeId);
|
|
@@ -2978,7 +3561,14 @@ var ScopesResource = class {
|
|
|
2978
3561
|
* @param options.search - Case-insensitive substring filter on the scope name.
|
|
2979
3562
|
* @param options.view - `"active"` (deployed) or `"draft"`.
|
|
2980
3563
|
* @param options.managerId - Only scopes supervised by this manager scope id.
|
|
2981
|
-
* @returns Page of scopes.
|
|
3564
|
+
* @returns Page of scopes — use `.autoPagingIter()` for all pages.
|
|
3565
|
+
*
|
|
3566
|
+
* @example
|
|
3567
|
+
* ```ts
|
|
3568
|
+
* for await (const scope of (await client.scopes.list()).autoPagingIter()) {
|
|
3569
|
+
* console.log(scope.id, scope.name, scope.status)
|
|
3570
|
+
* }
|
|
3571
|
+
* ```
|
|
2982
3572
|
*/
|
|
2983
3573
|
list(options = {}) {
|
|
2984
3574
|
const pageSize = options.pageSize ?? 25;
|
|
@@ -3010,7 +3600,13 @@ var ScopesResource = class {
|
|
|
3010
3600
|
* @param scopeId - Scope numeric id or slug.
|
|
3011
3601
|
* @param options.view - `"active"` (deployed) or `"draft"`.
|
|
3012
3602
|
* @throws {NotFoundError} When no scope matches the id or slug.
|
|
3013
|
-
* @returns Scope.
|
|
3603
|
+
* @returns Scope (`id`, `name`, `status`, …).
|
|
3604
|
+
*
|
|
3605
|
+
* @example
|
|
3606
|
+
* ```ts
|
|
3607
|
+
* const scope = await client.scopes.get('revenue-analysis')
|
|
3608
|
+
* console.log(scope.name, scope.status)
|
|
3609
|
+
* ```
|
|
3014
3610
|
*/
|
|
3015
3611
|
async get(scopeId, options = {}) {
|
|
3016
3612
|
validateId(scopeId, "scope_id");
|
|
@@ -3022,12 +3618,20 @@ var ScopesResource = class {
|
|
|
3022
3618
|
return parseScope(data);
|
|
3023
3619
|
}
|
|
3024
3620
|
/**
|
|
3025
|
-
*
|
|
3621
|
+
* Compose context this scope would use for an intent, without running chat.
|
|
3026
3622
|
*
|
|
3027
3623
|
* @param scopeId - Scope numeric id or slug.
|
|
3028
|
-
* @param message -
|
|
3029
|
-
* @param options.limit -
|
|
3030
|
-
* @returns
|
|
3624
|
+
* @param message - Natural-language intent used to select context.
|
|
3625
|
+
* @param options.limit - Maximum context items to return. Omit to return all selected items.
|
|
3626
|
+
* @returns Composition metadata. Use `chat` when you need an assistant reply.
|
|
3627
|
+
*
|
|
3628
|
+
* @example
|
|
3629
|
+
* ```ts
|
|
3630
|
+
* const ctx = await client.scopes.getContext(scopeId, 'Which tables describe churn?', {
|
|
3631
|
+
* limit: 5,
|
|
3632
|
+
* })
|
|
3633
|
+
* console.log(ctx.originalCount, ctx.sessionId)
|
|
3634
|
+
* ```
|
|
3031
3635
|
*/
|
|
3032
3636
|
async getContext(scopeId, message, options = {}) {
|
|
3033
3637
|
validateId(scopeId, "scope_id");
|
|
@@ -3038,32 +3642,53 @@ var ScopesResource = class {
|
|
|
3038
3642
|
return data;
|
|
3039
3643
|
}
|
|
3040
3644
|
/**
|
|
3041
|
-
* Send a message to a scope and
|
|
3645
|
+
* Send a message to a published scope and wait for the complete reply.
|
|
3042
3646
|
*
|
|
3043
|
-
*
|
|
3044
|
-
*
|
|
3647
|
+
* For the org-wide assistant use `client.modus.chat` instead.
|
|
3648
|
+
*
|
|
3649
|
+
* @param scopeId - Scope numeric id or slug (must be active for chat).
|
|
3650
|
+
* @param message - User message text.
|
|
3045
3651
|
* @param options.model - Required model id (e.g. `"claude-sonnet-5"`).
|
|
3046
|
-
* @param options.threadId - Continue an existing conversation.
|
|
3047
|
-
* @returns Chat result
|
|
3652
|
+
* @param options.threadId - Continue an existing conversation; omit to start new.
|
|
3653
|
+
* @returns Chat result: `content`, `threadId`, `runId`.
|
|
3048
3654
|
*
|
|
3049
3655
|
* @example
|
|
3050
3656
|
* ```ts
|
|
3051
|
-
* const result = await client.scopes.chat(scopeId, '
|
|
3657
|
+
* const result = await client.scopes.chat(scopeId, 'What is our ARR trend?', {
|
|
3658
|
+
* model: 'claude-sonnet-5',
|
|
3659
|
+
* })
|
|
3052
3660
|
* console.log(result.content, result.threadId)
|
|
3661
|
+
* const follow = await client.scopes.chat(scopeId, 'Break that down by segment.', {
|
|
3662
|
+
* model: 'claude-sonnet-5',
|
|
3663
|
+
* threadId: result.threadId,
|
|
3664
|
+
* })
|
|
3053
3665
|
* ```
|
|
3054
3666
|
*/
|
|
3055
3667
|
chat(scopeId, message, options) {
|
|
3056
3668
|
return chatBuffered(this.http, "scopes", scopeId, message, options);
|
|
3057
3669
|
}
|
|
3058
3670
|
/**
|
|
3059
|
-
* Stream a scope reply token by token.
|
|
3671
|
+
* Stream a scope reply token by token (SSE).
|
|
3672
|
+
*
|
|
3673
|
+
* The request starts when you consume `textStream()` or `eventStream()`.
|
|
3060
3674
|
*
|
|
3061
3675
|
* @param scopeId - Scope numeric id or slug.
|
|
3062
|
-
* @param message -
|
|
3676
|
+
* @param message - User message text.
|
|
3063
3677
|
* @param options.model - Required model id (e.g. `"claude-sonnet-5"`).
|
|
3064
|
-
* @param options.threadId - Continue an existing conversation.
|
|
3678
|
+
* @param options.threadId - Continue an existing conversation; omit to start new.
|
|
3065
3679
|
* @param options.version - `"published"` or `"draft"`.
|
|
3066
|
-
* @returns Chat stream.
|
|
3680
|
+
* @returns Chat stream — iterate `textStream()` for tokens.
|
|
3681
|
+
*
|
|
3682
|
+
* @example
|
|
3683
|
+
* ```ts
|
|
3684
|
+
* const stream = client.scopes.chatStream(scopeId, 'Summarize in three bullets.', {
|
|
3685
|
+
* model: 'claude-sonnet-5',
|
|
3686
|
+
* })
|
|
3687
|
+
* for await (const token of stream.textStream()) {
|
|
3688
|
+
* process.stdout.write(token)
|
|
3689
|
+
* }
|
|
3690
|
+
* console.log(stream.getFinalResult().threadId)
|
|
3691
|
+
* ```
|
|
3067
3692
|
*/
|
|
3068
3693
|
chatStream(scopeId, message, options) {
|
|
3069
3694
|
return chatStreamSession(this.http, this.config, "scopes", scopeId, message, options);
|
|
@@ -3142,6 +3767,7 @@ var Modus = class extends ModusClientBase {
|
|
|
3142
3767
|
this.context = new ContextResource(this.http, this.config);
|
|
3143
3768
|
this.connections = new ConnectionsResource(this.http, this.config);
|
|
3144
3769
|
this.suggestions = new SuggestionsResource(this.http, this.config);
|
|
3770
|
+
this.ingestedData = new IngestedDataResource(this.http, this.config);
|
|
3145
3771
|
}
|
|
3146
3772
|
};
|
|
3147
3773
|
// Annotate the CommonJS export names for ESM import in node:
|