@getmodus/sdk 0.6.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 +84 -4
- package/README.md +9 -1
- package/dist/{chunk-HEHHN4D6.js → chunk-JMFT5KO5.js} +330 -11
- package/dist/chunk-JMFT5KO5.js.map +1 -0
- package/dist/{conversations-BRg8gEKX.d.cts → conversations-B0_jmEuT.d.cts} +10469 -3196
- package/dist/{conversations-BRg8gEKX.d.ts → conversations-B0_jmEuT.d.ts} +10469 -3196
- package/dist/index.cjs +618 -58
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +372 -54
- package/dist/index.d.ts +372 -54
- package/dist/index.js +290 -49
- package/dist/index.js.map +1 -1
- package/dist/management/index.cjs +1134 -44
- package/dist/management/index.cjs.map +1 -1
- package/dist/management/index.d.cts +600 -9
- package/dist/management/index.d.ts +600 -9
- package/dist/management/index.js +807 -36
- package/dist/management/index.js.map +1 -1
- package/package.json +2 -3
- 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}",
|
|
@@ -225,6 +245,16 @@ var OPERATIONS = {
|
|
|
225
245
|
requestSchema: "CreateCustomContextItemDto",
|
|
226
246
|
responseSchema: "CreatedCustomContextItemResponseDto"
|
|
227
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
|
+
},
|
|
228
258
|
"CustomContextItemsController_delete": {
|
|
229
259
|
method: "DELETE",
|
|
230
260
|
path: "/api/v1/context/custom-items/{uid}",
|
|
@@ -265,6 +295,196 @@ var OPERATIONS = {
|
|
|
265
295
|
requestSchema: "UpdateCustomContextItemDto",
|
|
266
296
|
responseSchema: null
|
|
267
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
|
+
},
|
|
268
488
|
"EvaluationsController_getConfig": {
|
|
269
489
|
method: "GET",
|
|
270
490
|
path: "/api/v1/scopes/{id}/evaluations/config",
|
|
@@ -315,6 +535,16 @@ var OPERATIONS = {
|
|
|
315
535
|
requestSchema: "UpdateEvaluationConfigDto",
|
|
316
536
|
responseSchema: "EvaluationConfigDto"
|
|
317
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
|
+
},
|
|
318
548
|
"MemberGroupsController_list": {
|
|
319
549
|
method: "GET",
|
|
320
550
|
path: "/api/v1/users/member-groups",
|
|
@@ -371,7 +601,7 @@ var OPERATIONS = {
|
|
|
371
601
|
service: "modus-api",
|
|
372
602
|
serverUrl: "https://api.getmodus.com",
|
|
373
603
|
pathParams: [],
|
|
374
|
-
queryParams: ["pageToken", "page", "pageSize", "userId", "toolName", "source", "timeframe", "includeTools", "kind"],
|
|
604
|
+
queryParams: ["pageToken", "page", "pageSize", "userId", "toolName", "source", "sourceRef", "timeframe", "includeTools", "kind"],
|
|
375
605
|
requestSchema: null,
|
|
376
606
|
responseSchema: "ListConversationsResponseDto"
|
|
377
607
|
},
|
|
@@ -521,7 +751,7 @@ var OPERATIONS = {
|
|
|
521
751
|
service: "modus-api",
|
|
522
752
|
serverUrl: "https://api.getmodus.com",
|
|
523
753
|
pathParams: ["id"],
|
|
524
|
-
queryParams: ["pageToken", "page", "pageSize", "userId", "toolName", "source", "timeframe", "includeTools"],
|
|
754
|
+
queryParams: ["pageToken", "page", "pageSize", "userId", "toolName", "source", "sourceRef", "timeframe", "includeTools"],
|
|
525
755
|
requestSchema: null,
|
|
526
756
|
responseSchema: "ListConversationsResponseDto"
|
|
527
757
|
},
|
|
@@ -1165,7 +1395,9 @@ var WRITE_BODY_ALLOWED_KEYS = {
|
|
|
1165
1395
|
ContextCreatorsController_createLink: ["url", "title", "isCrawl", "pageLimit"],
|
|
1166
1396
|
ContextCreatorsController_createNote: ["title", "content"],
|
|
1167
1397
|
ContextCreatorsController_createSavedQuery: ["name", "connectionId", "query", "description", "path"],
|
|
1168
|
-
|
|
1398
|
+
ContextFilesController_finalize: ["fileName", "folderPath"],
|
|
1399
|
+
ContextFilesController_finalizeMany: ["uploads"],
|
|
1400
|
+
ContextFilesController_uploadFromUrl: ["url", "fileName", "folderPath"],
|
|
1169
1401
|
ContextFilesController_uploadFromUrls: ["urls"],
|
|
1170
1402
|
ContextFilesController_uploadUrl: ["fileName", "contentType", "fileSize"],
|
|
1171
1403
|
ContextFilesController_uploadUrls: ["files"],
|
|
@@ -1173,8 +1405,18 @@ var WRITE_BODY_ALLOWED_KEYS = {
|
|
|
1173
1405
|
ContextItemsController_update: ["contextType", "content", "description", "userFeedback", "topics"],
|
|
1174
1406
|
CustomContextItemsController_batchCreate: ["items"],
|
|
1175
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"],
|
|
1176
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"],
|
|
1177
1418
|
EvaluationsController_updateConfig: ["enabled", "cadence", "judgeModel", "judgeGuidance", "notifications"],
|
|
1419
|
+
IngestedDataController_upload: ["integration_type", "request", "response"],
|
|
1178
1420
|
ModusChatController_chat: ["message", "model"],
|
|
1179
1421
|
ModusContextController_compose: ["message", "limit"],
|
|
1180
1422
|
ModusRunsController_create: ["message", "sessionId", "organizationId", "version", "fileThreadId", "config", "attachments", "userContext", "source", "runId", "subordinateSkillIds"],
|
|
@@ -1665,7 +1907,7 @@ function formatConfigForLog(config) {
|
|
|
1665
1907
|
}
|
|
1666
1908
|
|
|
1667
1909
|
// src/_http.ts
|
|
1668
|
-
var USER_AGENT = `modus-typescript/${"0.
|
|
1910
|
+
var USER_AGENT = `modus-typescript/${"0.7.0"} (node/${process.version}; ${process.platform})`;
|
|
1669
1911
|
function buildUrl(baseUrl, path, params) {
|
|
1670
1912
|
const url = new URL(path.startsWith("/") ? path : `/${path}`, baseUrl);
|
|
1671
1913
|
if (params) {
|
|
@@ -2092,7 +2334,16 @@ var WorkflowRunsResource = class {
|
|
|
2092
2334
|
* @param options.timeframe - Filter by recency (`last_hour`, `last_day`, or `last_week`).
|
|
2093
2335
|
* @param options.approvalScope - Filter approval-related runs (`mine` or `all`).
|
|
2094
2336
|
* @param options.search - Free-text search filter.
|
|
2095
|
-
* @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
|
+
* ```
|
|
2096
2347
|
*/
|
|
2097
2348
|
list(workflowId, options = {}) {
|
|
2098
2349
|
validateId(workflowId, "workflow_id");
|
|
@@ -2132,10 +2383,16 @@ var WorkflowRunsResource = class {
|
|
|
2132
2383
|
* Retrieve a workflow run by id.
|
|
2133
2384
|
*
|
|
2134
2385
|
* @param workflowId - Workflow id or slug the run belongs to.
|
|
2135
|
-
* @param runId - Run id.
|
|
2386
|
+
* @param runId - Run id (the list row's `workflowId` field, not the composite `id`).
|
|
2136
2387
|
* @param options.temporalRunId - Optional internal execution id when disambiguating retries.
|
|
2137
2388
|
* @returns Run details including status and output.
|
|
2138
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
|
+
* ```
|
|
2139
2396
|
*/
|
|
2140
2397
|
async get(workflowId, runId, options = {}) {
|
|
2141
2398
|
validateId(workflowId, "workflow_id");
|
|
@@ -2158,8 +2415,8 @@ var WorkflowRunsResource = class {
|
|
|
2158
2415
|
* @example
|
|
2159
2416
|
* ```ts
|
|
2160
2417
|
* const stream = client.workflows.runs.create(workflowId, {
|
|
2161
|
-
* message:
|
|
2162
|
-
*
|
|
2418
|
+
* message: "Summarize yesterday's sales",
|
|
2419
|
+
* config: { model: 'claude-sonnet-5' },
|
|
2163
2420
|
* })
|
|
2164
2421
|
* for await (const event of stream) {
|
|
2165
2422
|
* if (event.type === 'token') process.stdout.write(event.content)
|
|
@@ -2174,21 +2431,45 @@ var WorkflowRunsResource = class {
|
|
|
2174
2431
|
/**
|
|
2175
2432
|
* Start a scope run and stream run events.
|
|
2176
2433
|
*
|
|
2434
|
+
* Same event stream shape as {@link create}, but targets a published scope.
|
|
2435
|
+
*
|
|
2177
2436
|
* @param scopeId - Scope id to run.
|
|
2178
2437
|
* @param body - Run body (`message`, optional `sessionId`, optional `version` as `published` or `draft`).
|
|
2179
2438
|
* @param options.idempotencyKey - Client-supplied idempotency key; defaults to `body.runId` or a new uuid.
|
|
2180
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
|
+
* ```
|
|
2181
2451
|
*/
|
|
2182
2452
|
createScope(scopeId, body, options = {}) {
|
|
2183
2453
|
validateId(scopeId, "scope_id");
|
|
2184
2454
|
return this.createRun("ScopeRunsController_create", body, { id: scopeId }, options);
|
|
2185
2455
|
}
|
|
2186
2456
|
/**
|
|
2187
|
-
* Start a Modus assistant run and stream run events.
|
|
2457
|
+
* Start a Modus org-assistant run and stream run events.
|
|
2188
2458
|
*
|
|
2189
2459
|
* @param body - Run body (`message`, optional `sessionId`, optional `subordinateSkillIds` to narrow context).
|
|
2190
2460
|
* @param options.idempotencyKey - Client-supplied idempotency key; defaults to `body.runId` or a new uuid.
|
|
2191
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
|
+
* ```
|
|
2192
2473
|
*/
|
|
2193
2474
|
createModus(body, options = {}) {
|
|
2194
2475
|
return this.createRun("ModusRunsController_create", body, {}, options);
|
|
@@ -2200,6 +2481,18 @@ var WorkflowRunsResource = class {
|
|
|
2200
2481
|
* @param body - Resume body (`message`, `sessionId`, and `decision`: `approve` / `deny` / `connected` / `cancelled`).
|
|
2201
2482
|
* @param options.idempotencyKey - Client-supplied idempotency key; defaults to `body.runId` or a new uuid.
|
|
2202
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
|
+
* ```
|
|
2203
2496
|
*/
|
|
2204
2497
|
resume(runId, body, options = {}) {
|
|
2205
2498
|
validateId(runId, "run_id");
|
|
@@ -2209,6 +2502,11 @@ var WorkflowRunsResource = class {
|
|
|
2209
2502
|
* Cancel a run that is still in progress.
|
|
2210
2503
|
*
|
|
2211
2504
|
* @param runId - Run id to cancel.
|
|
2505
|
+
*
|
|
2506
|
+
* @example
|
|
2507
|
+
* ```ts
|
|
2508
|
+
* await client.workflows.runs.cancel(runId)
|
|
2509
|
+
* ```
|
|
2212
2510
|
*/
|
|
2213
2511
|
async cancel(runId) {
|
|
2214
2512
|
validateId(runId, "run_id");
|
|
@@ -2402,15 +2700,22 @@ var WorkflowsResource = class {
|
|
|
2402
2700
|
this.workflowActions = new AgentWorkflowActionsResource(http, config);
|
|
2403
2701
|
}
|
|
2404
2702
|
/**
|
|
2405
|
-
* List workflows.
|
|
2703
|
+
* List workflows in the organisation.
|
|
2406
2704
|
*
|
|
2407
2705
|
* @param options.pageSize - Maximum items per page (default 25).
|
|
2408
2706
|
* @param options.pageToken - Opaque token from a previous page.
|
|
2409
|
-
* @param options.search -
|
|
2707
|
+
* @param options.search - Case-insensitive substring filter on the workflow name.
|
|
2410
2708
|
* @param options.type - Workflow kind: `"task"` or `"workflow"`.
|
|
2411
2709
|
* @param options.view - Which saved version to return (`active` or `draft`).
|
|
2412
2710
|
* @param options.includeVariation - Include variation metadata when supported.
|
|
2413
|
-
* @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
|
+
* ```
|
|
2414
2719
|
*/
|
|
2415
2720
|
list(options = {}) {
|
|
2416
2721
|
const pageSize = options.pageSize ?? 25;
|
|
@@ -2450,8 +2755,14 @@ var WorkflowsResource = class {
|
|
|
2450
2755
|
* @param workflowId - Numeric id or slug.
|
|
2451
2756
|
* @param options.view - Which saved version to return (`active` or `draft`).
|
|
2452
2757
|
* @param options.includeVariation - Include variation metadata when supported.
|
|
2453
|
-
* @returns The workflow.
|
|
2758
|
+
* @returns The workflow (`id`, `name`, `status`, …).
|
|
2454
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
|
+
* ```
|
|
2455
2766
|
*/
|
|
2456
2767
|
async get(workflowId, options = {}) {
|
|
2457
2768
|
validateId(workflowId, "workflow_id");
|
|
@@ -2570,6 +2881,12 @@ var CustomContextItemsResource = class {
|
|
|
2570
2881
|
* @param options.searchQuery - Free-text search filter.
|
|
2571
2882
|
* @param options.topics - Filter to items tagged with any of these topics.
|
|
2572
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
|
+
* ```
|
|
2573
2890
|
*/
|
|
2574
2891
|
list(options = {}) {
|
|
2575
2892
|
const pageSize = options.pageSize ?? 25;
|
|
@@ -2598,6 +2915,11 @@ var CustomContextItemsResource = class {
|
|
|
2598
2915
|
* @param uid - Item uid.
|
|
2599
2916
|
* @returns The custom context item.
|
|
2600
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
|
+
* ```
|
|
2601
2923
|
*/
|
|
2602
2924
|
async get(uid) {
|
|
2603
2925
|
return parseContextItem(
|
|
@@ -2618,6 +2940,7 @@ var CustomContextItemsResource = class {
|
|
|
2618
2940
|
*
|
|
2619
2941
|
* @example
|
|
2620
2942
|
* ```ts
|
|
2943
|
+
* const client = new Modus()
|
|
2621
2944
|
* const created = await client.context.customItems.create({
|
|
2622
2945
|
* kind: 'entity',
|
|
2623
2946
|
* sourceId: 'my-source',
|
|
@@ -2641,6 +2964,7 @@ var CustomContextItemsResource = class {
|
|
|
2641
2964
|
*
|
|
2642
2965
|
* @example
|
|
2643
2966
|
* ```ts
|
|
2967
|
+
* const client = new Modus()
|
|
2644
2968
|
* const created = await client.context.customItems.batchCreate([
|
|
2645
2969
|
* { kind: 'field', sourceId: 'src', fieldName: 'region', dataType: 'string' },
|
|
2646
2970
|
* { kind: 'field', sourceId: 'src', fieldName: 'amount', dataType: 'number' },
|
|
@@ -2658,12 +2982,45 @@ var CustomContextItemsResource = class {
|
|
|
2658
2982
|
const items = data.contextItems;
|
|
2659
2983
|
return Array.isArray(items) ? items.map(parseCreatedCustomContextItem) : [];
|
|
2660
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
|
+
}
|
|
2661
3011
|
/**
|
|
2662
3012
|
* Update a custom context item.
|
|
2663
3013
|
*
|
|
2664
3014
|
* @param uid - Item uid.
|
|
2665
3015
|
* @param input - Fields to change (kind and hierarchy ids cannot be changed).
|
|
2666
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
|
+
* ```
|
|
2667
3024
|
*/
|
|
2668
3025
|
async update(uid, input) {
|
|
2669
3026
|
return asRecord(
|
|
@@ -2678,6 +3035,11 @@ var CustomContextItemsResource = class {
|
|
|
2678
3035
|
*
|
|
2679
3036
|
* @param uid - Item uid.
|
|
2680
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
|
+
* ```
|
|
2681
3043
|
*/
|
|
2682
3044
|
async delete(uid) {
|
|
2683
3045
|
return parseDeletion(
|
|
@@ -2716,8 +3078,16 @@ var ContextItemsResource = class {
|
|
|
2716
3078
|
*
|
|
2717
3079
|
* @param options.pageSize - Maximum items per page (default 25).
|
|
2718
3080
|
* @param options.pageToken - Opaque token from a previous page.
|
|
2719
|
-
* @param options.contextType - Filter to a single context type.
|
|
2720
|
-
* @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
|
+
* ```
|
|
2721
3091
|
*/
|
|
2722
3092
|
list(options = {}) {
|
|
2723
3093
|
const pageSize = options.pageSize ?? 25;
|
|
@@ -2741,8 +3111,14 @@ var ContextItemsResource = class {
|
|
|
2741
3111
|
* Retrieve a knowledge-base item by uid.
|
|
2742
3112
|
*
|
|
2743
3113
|
* @param uid - Item uid.
|
|
2744
|
-
* @returns The context item.
|
|
3114
|
+
* @returns The context item (`uid`, `contextType`, `content`, …).
|
|
2745
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
|
+
* ```
|
|
2746
3122
|
*/
|
|
2747
3123
|
async get(uid) {
|
|
2748
3124
|
const data = await invokeWithRetry(this.config, this.http, "ContextItemsController_get", {
|
|
@@ -2753,10 +3129,19 @@ var ContextItemsResource = class {
|
|
|
2753
3129
|
/**
|
|
2754
3130
|
* Look up a knowledge-base item by type and data path.
|
|
2755
3131
|
*
|
|
2756
|
-
* @param options.contextType - Context type to match.
|
|
3132
|
+
* @param options.contextType - Context type to match (e.g. `"note"`).
|
|
2757
3133
|
* @param options.dataPath - Hierarchical path segments that identify the item.
|
|
2758
3134
|
* @param options.contentProjection - Optional fields to include from item content.
|
|
2759
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
|
+
* ```
|
|
2760
3145
|
*/
|
|
2761
3146
|
async lookup(options) {
|
|
2762
3147
|
const body = omitUndefined({
|
|
@@ -2781,10 +3166,22 @@ var ContextItemsResource = class {
|
|
|
2781
3166
|
*
|
|
2782
3167
|
* @param uid - Item uid.
|
|
2783
3168
|
* @param contextType - Context type of the item.
|
|
2784
|
-
* @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"`).
|
|
2785
3170
|
* @param options.pageSize - Maximum items per page (default 25).
|
|
2786
3171
|
* @param options.pageToken - Opaque token from a previous page.
|
|
2787
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
|
+
* ```
|
|
2788
3185
|
*/
|
|
2789
3186
|
listValues(uid, contextType, contentKeyPath, options = {}) {
|
|
2790
3187
|
const pageSize = options.pageSize ?? 25;
|
|
@@ -2799,6 +3196,14 @@ var ContextItemsResource = class {
|
|
|
2799
3196
|
* @param options.pageSize - Maximum items per page (default 25).
|
|
2800
3197
|
* @param options.pageToken - Opaque token from a previous page.
|
|
2801
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
|
+
* ```
|
|
2802
3207
|
*/
|
|
2803
3208
|
listValuesFor(item, contentKeyPath, options = {}) {
|
|
2804
3209
|
return this.listValues(item.uid, item.contextType, contentKeyPath, options);
|
|
@@ -2831,9 +3236,51 @@ var ContextResource = class {
|
|
|
2831
3236
|
}
|
|
2832
3237
|
};
|
|
2833
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
|
+
|
|
2834
3281
|
// src/resources/modus/conversations.ts
|
|
2835
3282
|
var ALLOWED_KINDS = /* @__PURE__ */ new Set(["all", "modus", "scopes"]);
|
|
2836
|
-
function listParams(pageSize, pageToken, kind) {
|
|
3283
|
+
function listParams(pageSize, pageToken, kind, source, sourceRef) {
|
|
2837
3284
|
if (kind !== void 0 && !ALLOWED_KINDS.has(kind)) {
|
|
2838
3285
|
throw new Error(
|
|
2839
3286
|
`kind must be one of ${[...ALLOWED_KINDS].sort().join(", ")}, got ${JSON.stringify(kind)}`
|
|
@@ -2841,6 +3288,8 @@ function listParams(pageSize, pageToken, kind) {
|
|
|
2841
3288
|
}
|
|
2842
3289
|
const extra = {};
|
|
2843
3290
|
if (kind !== void 0) extra.kind = kind;
|
|
3291
|
+
if (source !== void 0) extra.source = source;
|
|
3292
|
+
if (sourceRef !== void 0) extra.sourceRef = sourceRef;
|
|
2844
3293
|
return aipListParams(pageSize, pageToken, extra);
|
|
2845
3294
|
}
|
|
2846
3295
|
function parseListItem(raw) {
|
|
@@ -2860,24 +3309,32 @@ var ModusConversationsResource = class {
|
|
|
2860
3309
|
* @param options.pageSize - Items per page (default 25).
|
|
2861
3310
|
* @param options.pageToken - Opaque token from a previous page.
|
|
2862
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.
|
|
2863
3320
|
* @returns Page of conversation list items.
|
|
2864
3321
|
*/
|
|
2865
3322
|
list(options = {}) {
|
|
2866
3323
|
const pageSize = options.pageSize ?? 25;
|
|
2867
3324
|
validatePageSize(pageSize);
|
|
2868
|
-
return this.listPage(pageSize, options.pageToken, options.kind);
|
|
3325
|
+
return this.listPage(pageSize, options.pageToken, options.kind, options.source, options.sourceRef);
|
|
2869
3326
|
}
|
|
2870
|
-
async listPage(pageSize, pageToken, kind) {
|
|
3327
|
+
async listPage(pageSize, pageToken, kind, source, sourceRef) {
|
|
2871
3328
|
const data = asRecord(
|
|
2872
3329
|
await invokeWithRetry(this.config, this.http, "ModusConversationsController_list", {
|
|
2873
|
-
query: listParams(pageSize, pageToken, kind)
|
|
3330
|
+
query: listParams(pageSize, pageToken, kind, source, sourceRef)
|
|
2874
3331
|
})
|
|
2875
3332
|
);
|
|
2876
3333
|
return buildAipPage(
|
|
2877
3334
|
data,
|
|
2878
3335
|
"conversations",
|
|
2879
3336
|
parseListItem,
|
|
2880
|
-
(token) => this.listPage(pageSize, token, kind)
|
|
3337
|
+
(token) => this.listPage(pageSize, token, kind, source, sourceRef)
|
|
2881
3338
|
);
|
|
2882
3339
|
}
|
|
2883
3340
|
/**
|
|
@@ -2903,11 +3360,17 @@ var ModusResource = class {
|
|
|
2903
3360
|
this.conversations = new ModusConversationsResource(http, config);
|
|
2904
3361
|
}
|
|
2905
3362
|
/**
|
|
2906
|
-
*
|
|
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.
|
|
2907
3368
|
*
|
|
2908
|
-
* @
|
|
2909
|
-
*
|
|
2910
|
-
*
|
|
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
|
+
* ```
|
|
2911
3374
|
*/
|
|
2912
3375
|
async getContext(message, options = {}) {
|
|
2913
3376
|
const data = await invokeWithRetry(this.config, this.http, "ModusContextController_compose", {
|
|
@@ -2916,29 +3379,48 @@ var ModusResource = class {
|
|
|
2916
3379
|
return data;
|
|
2917
3380
|
}
|
|
2918
3381
|
/**
|
|
2919
|
-
* Send a message to Modus
|
|
3382
|
+
* Send a message to Modus and wait for the complete reply.
|
|
2920
3383
|
*
|
|
2921
|
-
* @param message -
|
|
3384
|
+
* @param message - User message text.
|
|
2922
3385
|
* @param options.model - Required model id (e.g. `"claude-sonnet-5"`).
|
|
2923
|
-
* @param options.threadId - Continue an existing conversation.
|
|
2924
|
-
* @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`.
|
|
2925
3388
|
*
|
|
2926
3389
|
* @example
|
|
2927
3390
|
* ```ts
|
|
2928
|
-
* 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
|
+
* })
|
|
2929
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
|
+
* })
|
|
2930
3399
|
* ```
|
|
2931
3400
|
*/
|
|
2932
3401
|
chat(message, options) {
|
|
2933
3402
|
return modusChatBuffered(this.http, message, options);
|
|
2934
3403
|
}
|
|
2935
3404
|
/**
|
|
2936
|
-
* Stream a Modus reply token by token.
|
|
3405
|
+
* Stream a Modus reply token by token (SSE).
|
|
3406
|
+
*
|
|
3407
|
+
* The request starts when you consume `textStream()` or `eventStream()`.
|
|
2937
3408
|
*
|
|
2938
|
-
* @param message -
|
|
3409
|
+
* @param message - User message text.
|
|
2939
3410
|
* @param options.model - Required model id (e.g. `"claude-sonnet-5"`).
|
|
2940
|
-
* @param options.threadId - Continue an existing conversation.
|
|
2941
|
-
* @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
|
+
* ```
|
|
2942
3424
|
*/
|
|
2943
3425
|
chatStream(message, options) {
|
|
2944
3426
|
return modusChatStreamSession(this.http, this.config, message, options);
|
|
@@ -2963,26 +3445,44 @@ var ScopeConversationsResource = class {
|
|
|
2963
3445
|
*
|
|
2964
3446
|
* @param options.pageSize - Items per page (default 25).
|
|
2965
3447
|
* @param options.pageToken - Opaque token from a previous page.
|
|
2966
|
-
* @
|
|
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
|
+
* ```
|
|
2967
3464
|
*/
|
|
2968
3465
|
list(options = {}) {
|
|
2969
3466
|
const pageSize = options.pageSize ?? 25;
|
|
2970
3467
|
validatePageSize(pageSize);
|
|
2971
|
-
return this.listPage(pageSize, options.pageToken);
|
|
3468
|
+
return this.listPage(pageSize, options.pageToken, options.source, options.sourceRef);
|
|
2972
3469
|
}
|
|
2973
|
-
async listPage(pageSize, pageToken) {
|
|
3470
|
+
async listPage(pageSize, pageToken, source, sourceRef) {
|
|
2974
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;
|
|
2975
3475
|
const data = asRecord(
|
|
2976
3476
|
await invokeWithRetry(this.config, this.http, "ScopeConversationsController_list", {
|
|
2977
3477
|
pathParams: { id: this.scopeId },
|
|
2978
|
-
query: aipListParams(pageSize, pageToken)
|
|
3478
|
+
query: aipListParams(pageSize, pageToken, extra)
|
|
2979
3479
|
})
|
|
2980
3480
|
);
|
|
2981
3481
|
return buildAipPage(
|
|
2982
3482
|
data,
|
|
2983
3483
|
"conversations",
|
|
2984
3484
|
parseListItem2,
|
|
2985
|
-
(token) => this.listPage(pageSize, token)
|
|
3485
|
+
(token) => this.listPage(pageSize, token, source, sourceRef)
|
|
2986
3486
|
);
|
|
2987
3487
|
}
|
|
2988
3488
|
/**
|
|
@@ -2991,7 +3491,15 @@ var ScopeConversationsResource = class {
|
|
|
2991
3491
|
* @param threadId - Conversation thread id.
|
|
2992
3492
|
* @param options.messageLimit - Maximum messages to return (1–100).
|
|
2993
3493
|
* @param options.beforeMessageIndex - Return messages before this index (requires messageLimit).
|
|
2994
|
-
* @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
|
+
* ```
|
|
2995
3503
|
*/
|
|
2996
3504
|
async get(threadId, options = {}) {
|
|
2997
3505
|
validateId(this.scopeId, "scope_id");
|
|
@@ -3032,6 +3540,15 @@ var ScopesResource = class {
|
|
|
3032
3540
|
*
|
|
3033
3541
|
* @param scopeId - Scope numeric id or slug.
|
|
3034
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
|
+
* ```
|
|
3035
3552
|
*/
|
|
3036
3553
|
conversations(scopeId) {
|
|
3037
3554
|
return new ScopeConversationsResource(this.http, this.config, scopeId);
|
|
@@ -3044,7 +3561,14 @@ var ScopesResource = class {
|
|
|
3044
3561
|
* @param options.search - Case-insensitive substring filter on the scope name.
|
|
3045
3562
|
* @param options.view - `"active"` (deployed) or `"draft"`.
|
|
3046
3563
|
* @param options.managerId - Only scopes supervised by this manager scope id.
|
|
3047
|
-
* @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
|
+
* ```
|
|
3048
3572
|
*/
|
|
3049
3573
|
list(options = {}) {
|
|
3050
3574
|
const pageSize = options.pageSize ?? 25;
|
|
@@ -3076,7 +3600,13 @@ var ScopesResource = class {
|
|
|
3076
3600
|
* @param scopeId - Scope numeric id or slug.
|
|
3077
3601
|
* @param options.view - `"active"` (deployed) or `"draft"`.
|
|
3078
3602
|
* @throws {NotFoundError} When no scope matches the id or slug.
|
|
3079
|
-
* @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
|
+
* ```
|
|
3080
3610
|
*/
|
|
3081
3611
|
async get(scopeId, options = {}) {
|
|
3082
3612
|
validateId(scopeId, "scope_id");
|
|
@@ -3088,12 +3618,20 @@ var ScopesResource = class {
|
|
|
3088
3618
|
return parseScope(data);
|
|
3089
3619
|
}
|
|
3090
3620
|
/**
|
|
3091
|
-
*
|
|
3621
|
+
* Compose context this scope would use for an intent, without running chat.
|
|
3092
3622
|
*
|
|
3093
3623
|
* @param scopeId - Scope numeric id or slug.
|
|
3094
|
-
* @param message -
|
|
3095
|
-
* @param options.limit -
|
|
3096
|
-
* @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
|
+
* ```
|
|
3097
3635
|
*/
|
|
3098
3636
|
async getContext(scopeId, message, options = {}) {
|
|
3099
3637
|
validateId(scopeId, "scope_id");
|
|
@@ -3104,32 +3642,53 @@ var ScopesResource = class {
|
|
|
3104
3642
|
return data;
|
|
3105
3643
|
}
|
|
3106
3644
|
/**
|
|
3107
|
-
* Send a message to a scope and
|
|
3645
|
+
* Send a message to a published scope and wait for the complete reply.
|
|
3108
3646
|
*
|
|
3109
|
-
*
|
|
3110
|
-
*
|
|
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.
|
|
3111
3651
|
* @param options.model - Required model id (e.g. `"claude-sonnet-5"`).
|
|
3112
|
-
* @param options.threadId - Continue an existing conversation.
|
|
3113
|
-
* @returns Chat result
|
|
3652
|
+
* @param options.threadId - Continue an existing conversation; omit to start new.
|
|
3653
|
+
* @returns Chat result: `content`, `threadId`, `runId`.
|
|
3114
3654
|
*
|
|
3115
3655
|
* @example
|
|
3116
3656
|
* ```ts
|
|
3117
|
-
* 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
|
+
* })
|
|
3118
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
|
+
* })
|
|
3119
3665
|
* ```
|
|
3120
3666
|
*/
|
|
3121
3667
|
chat(scopeId, message, options) {
|
|
3122
3668
|
return chatBuffered(this.http, "scopes", scopeId, message, options);
|
|
3123
3669
|
}
|
|
3124
3670
|
/**
|
|
3125
|
-
* 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()`.
|
|
3126
3674
|
*
|
|
3127
3675
|
* @param scopeId - Scope numeric id or slug.
|
|
3128
|
-
* @param message -
|
|
3676
|
+
* @param message - User message text.
|
|
3129
3677
|
* @param options.model - Required model id (e.g. `"claude-sonnet-5"`).
|
|
3130
|
-
* @param options.threadId - Continue an existing conversation.
|
|
3678
|
+
* @param options.threadId - Continue an existing conversation; omit to start new.
|
|
3131
3679
|
* @param options.version - `"published"` or `"draft"`.
|
|
3132
|
-
* @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
|
+
* ```
|
|
3133
3692
|
*/
|
|
3134
3693
|
chatStream(scopeId, message, options) {
|
|
3135
3694
|
return chatStreamSession(this.http, this.config, "scopes", scopeId, message, options);
|
|
@@ -3208,6 +3767,7 @@ var Modus = class extends ModusClientBase {
|
|
|
3208
3767
|
this.context = new ContextResource(this.http, this.config);
|
|
3209
3768
|
this.connections = new ConnectionsResource(this.http, this.config);
|
|
3210
3769
|
this.suggestions = new SuggestionsResource(this.http, this.config);
|
|
3770
|
+
this.ingestedData = new IngestedDataResource(this.http, this.config);
|
|
3211
3771
|
}
|
|
3212
3772
|
};
|
|
3213
3773
|
// Annotate the CommonJS export names for ESM import in node:
|