@getmodus/sdk 0.2.3 → 0.4.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 +7 -35
- package/README.md +4 -0
- package/dist/{chunk-ZFZQ2UMA.js → chunk-I56O44TR.js} +168 -37
- package/dist/chunk-I56O44TR.js.map +1 -0
- package/dist/{conversations-BP2sI3Q5.d.cts → conversations-Cq6OVlpQ.d.cts} +875 -3154
- package/dist/{conversations-BP2sI3Q5.d.ts → conversations-Cq6OVlpQ.d.ts} +875 -3154
- package/dist/index.cjs +546 -77
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +494 -32
- package/dist/index.d.ts +494 -32
- package/dist/index.js +378 -42
- package/dist/index.js.map +1 -1
- package/dist/management/index.cjs +635 -65
- package/dist/management/index.cjs.map +1 -1
- package/dist/management/index.d.cts +501 -43
- package/dist/management/index.d.ts +501 -43
- package/dist/management/index.js +469 -30
- package/dist/management/index.js.map +1 -1
- package/package.json +3 -1
- package/dist/chunk-ZFZQ2UMA.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -37,6 +37,8 @@ __export(index_exports, {
|
|
|
37
37
|
StreamTimeoutError: () => StreamTimeoutError,
|
|
38
38
|
UnprocessableError: () => UnprocessableError,
|
|
39
39
|
ValidationError: () => ValidationError,
|
|
40
|
+
WorkflowType: () => WorkflowType,
|
|
41
|
+
conversationScopeId: () => conversationScopeId,
|
|
40
42
|
conversationSkillId: () => conversationSkillId
|
|
41
43
|
});
|
|
42
44
|
module.exports = __toCommonJS(index_exports);
|
|
@@ -259,7 +261,7 @@ var OPERATIONS = {
|
|
|
259
261
|
service: "modus-api",
|
|
260
262
|
serverUrl: "https://api.getmodus.com",
|
|
261
263
|
pathParams: [],
|
|
262
|
-
queryParams: [
|
|
264
|
+
queryParams: [],
|
|
263
265
|
requestSchema: null,
|
|
264
266
|
responseSchema: "ListMemberGroupsResponseDto"
|
|
265
267
|
},
|
|
@@ -329,19 +331,9 @@ var OPERATIONS = {
|
|
|
329
331
|
service: "modus-api",
|
|
330
332
|
serverUrl: "https://api.getmodus.com",
|
|
331
333
|
pathParams: [],
|
|
332
|
-
queryParams: ["pageSize", "pageToken"],
|
|
333
|
-
requestSchema: null,
|
|
334
|
-
responseSchema: "ListOrgMembersResponseDto"
|
|
335
|
-
},
|
|
336
|
-
"OrganizationController_deleteOrganization": {
|
|
337
|
-
method: "DELETE",
|
|
338
|
-
path: "/api/v1/users/organization",
|
|
339
|
-
service: "modus-api",
|
|
340
|
-
serverUrl: "https://api.getmodus.com",
|
|
341
|
-
pathParams: [],
|
|
342
334
|
queryParams: [],
|
|
343
335
|
requestSchema: null,
|
|
344
|
-
responseSchema:
|
|
336
|
+
responseSchema: "ListOrgMembersResponseDto"
|
|
345
337
|
},
|
|
346
338
|
"ResumeRunsController_create": {
|
|
347
339
|
method: "POST",
|
|
@@ -561,7 +553,7 @@ var OPERATIONS = {
|
|
|
561
553
|
pathParams: ["id"],
|
|
562
554
|
queryParams: [],
|
|
563
555
|
requestSchema: null,
|
|
564
|
-
responseSchema: "
|
|
556
|
+
responseSchema: "ScopeDto"
|
|
565
557
|
},
|
|
566
558
|
"ScopesController_cancelOwnershipTransfer": {
|
|
567
559
|
method: "DELETE",
|
|
@@ -571,7 +563,7 @@ var OPERATIONS = {
|
|
|
571
563
|
pathParams: ["id"],
|
|
572
564
|
queryParams: [],
|
|
573
565
|
requestSchema: null,
|
|
574
|
-
responseSchema: "
|
|
566
|
+
responseSchema: "ScopeDto"
|
|
575
567
|
},
|
|
576
568
|
"ScopesController_create": {
|
|
577
569
|
method: "POST",
|
|
@@ -581,7 +573,7 @@ var OPERATIONS = {
|
|
|
581
573
|
pathParams: [],
|
|
582
574
|
queryParams: [],
|
|
583
575
|
requestSchema: "CreateSkillDto",
|
|
584
|
-
responseSchema: "
|
|
576
|
+
responseSchema: "ScopeDto"
|
|
585
577
|
},
|
|
586
578
|
"ScopesController_delete": {
|
|
587
579
|
method: "DELETE",
|
|
@@ -611,7 +603,7 @@ var OPERATIONS = {
|
|
|
611
603
|
pathParams: ["id"],
|
|
612
604
|
queryParams: ["view"],
|
|
613
605
|
requestSchema: null,
|
|
614
|
-
responseSchema: "
|
|
606
|
+
responseSchema: "ScopeDto"
|
|
615
607
|
},
|
|
616
608
|
"ScopesController_getVariation": {
|
|
617
609
|
method: "GET",
|
|
@@ -621,7 +613,7 @@ var OPERATIONS = {
|
|
|
621
613
|
pathParams: ["id", "variationUid"],
|
|
622
614
|
queryParams: [],
|
|
623
615
|
requestSchema: null,
|
|
624
|
-
responseSchema: "
|
|
616
|
+
responseSchema: "ScopeDto"
|
|
625
617
|
},
|
|
626
618
|
"ScopesController_list": {
|
|
627
619
|
method: "GET",
|
|
@@ -651,7 +643,7 @@ var OPERATIONS = {
|
|
|
651
643
|
pathParams: ["id"],
|
|
652
644
|
queryParams: [],
|
|
653
645
|
requestSchema: "TransferOwnershipDto",
|
|
654
|
-
responseSchema: "
|
|
646
|
+
responseSchema: "ScopeDto"
|
|
655
647
|
},
|
|
656
648
|
"ScopesController_restore": {
|
|
657
649
|
method: "POST",
|
|
@@ -661,7 +653,7 @@ var OPERATIONS = {
|
|
|
661
653
|
pathParams: ["id"],
|
|
662
654
|
queryParams: [],
|
|
663
655
|
requestSchema: null,
|
|
664
|
-
responseSchema: "
|
|
656
|
+
responseSchema: "ScopeDto"
|
|
665
657
|
},
|
|
666
658
|
"ScopesController_update": {
|
|
667
659
|
method: "PATCH",
|
|
@@ -671,7 +663,7 @@ var OPERATIONS = {
|
|
|
671
663
|
pathParams: ["id"],
|
|
672
664
|
queryParams: ["updateMask"],
|
|
673
665
|
requestSchema: "UpdateSkillDto",
|
|
674
|
-
responseSchema: "
|
|
666
|
+
responseSchema: "ScopeDto"
|
|
675
667
|
},
|
|
676
668
|
"SuggestionsController_listApproved": {
|
|
677
669
|
method: "GET",
|
|
@@ -679,7 +671,7 @@ var OPERATIONS = {
|
|
|
679
671
|
service: "modus-api",
|
|
680
672
|
serverUrl: "https://api.getmodus.com",
|
|
681
673
|
pathParams: [],
|
|
682
|
-
queryParams: ["pageToken", "pageSize", "
|
|
674
|
+
queryParams: ["pageToken", "pageSize", "scopeId", "scopeIds"],
|
|
683
675
|
requestSchema: null,
|
|
684
676
|
responseSchema: "ListSuggestionQuestionsResponseDto"
|
|
685
677
|
},
|
|
@@ -693,16 +685,36 @@ var OPERATIONS = {
|
|
|
693
685
|
requestSchema: "RecordSuggestionEventDto",
|
|
694
686
|
responseSchema: null
|
|
695
687
|
},
|
|
688
|
+
"ToolsController_list": {
|
|
689
|
+
method: "GET",
|
|
690
|
+
path: "/api/v1/tools",
|
|
691
|
+
service: "modus-api",
|
|
692
|
+
serverUrl: "https://api.getmodus.com",
|
|
693
|
+
pathParams: [],
|
|
694
|
+
queryParams: ["pageToken", "pageSize"],
|
|
695
|
+
requestSchema: null,
|
|
696
|
+
responseSchema: "ListToolsResponseDto"
|
|
697
|
+
},
|
|
696
698
|
"UsageController_list": {
|
|
697
699
|
method: "GET",
|
|
698
700
|
path: "/api/v1/usage",
|
|
699
701
|
service: "modus-api",
|
|
700
702
|
serverUrl: "https://api.getmodus.com",
|
|
701
703
|
pathParams: [],
|
|
702
|
-
queryParams: ["since", "until", "rollup", "model", "group_by", "skill_id", "agent_id", "user_id", "interface"],
|
|
704
|
+
queryParams: ["since", "until", "rollup", "model", "group_by", "skill_id", "agent_id", "user_id", "interface", "user_email"],
|
|
703
705
|
requestSchema: null,
|
|
704
706
|
responseSchema: "ListUsageResponseDto"
|
|
705
707
|
},
|
|
708
|
+
"UsageController_listUsers": {
|
|
709
|
+
method: "GET",
|
|
710
|
+
path: "/api/v1/usage/users",
|
|
711
|
+
service: "modus-api",
|
|
712
|
+
serverUrl: "https://api.getmodus.com",
|
|
713
|
+
pathParams: [],
|
|
714
|
+
queryParams: ["since", "until"],
|
|
715
|
+
requestSchema: null,
|
|
716
|
+
responseSchema: "ListUsageUsersResponseDto"
|
|
717
|
+
},
|
|
706
718
|
"WorkflowActionsController_cancel": {
|
|
707
719
|
method: "POST",
|
|
708
720
|
path: "/agent/v1/workflow-actions/{runId}/cancel",
|
|
@@ -759,7 +771,7 @@ var OPERATIONS = {
|
|
|
759
771
|
service: "modus-api",
|
|
760
772
|
serverUrl: "https://api.getmodus.com",
|
|
761
773
|
pathParams: ["id"],
|
|
762
|
-
queryParams: [
|
|
774
|
+
queryParams: [],
|
|
763
775
|
requestSchema: null,
|
|
764
776
|
responseSchema: "ListAgentInterfacesResponseDto"
|
|
765
777
|
},
|
|
@@ -811,7 +823,7 @@ var OPERATIONS = {
|
|
|
811
823
|
pathParams: ["id"],
|
|
812
824
|
queryParams: [],
|
|
813
825
|
requestSchema: null,
|
|
814
|
-
responseSchema: "
|
|
826
|
+
responseSchema: "WorkflowDto"
|
|
815
827
|
},
|
|
816
828
|
"WorkflowsController_cancelOwnershipTransfer": {
|
|
817
829
|
method: "DELETE",
|
|
@@ -821,7 +833,7 @@ var OPERATIONS = {
|
|
|
821
833
|
pathParams: ["id"],
|
|
822
834
|
queryParams: [],
|
|
823
835
|
requestSchema: null,
|
|
824
|
-
responseSchema: "
|
|
836
|
+
responseSchema: "WorkflowDto"
|
|
825
837
|
},
|
|
826
838
|
"WorkflowsController_create": {
|
|
827
839
|
method: "POST",
|
|
@@ -831,7 +843,7 @@ var OPERATIONS = {
|
|
|
831
843
|
pathParams: [],
|
|
832
844
|
queryParams: [],
|
|
833
845
|
requestSchema: "CreateAgentDto",
|
|
834
|
-
responseSchema: "
|
|
846
|
+
responseSchema: "WorkflowDto"
|
|
835
847
|
},
|
|
836
848
|
"WorkflowsController_delete": {
|
|
837
849
|
method: "DELETE",
|
|
@@ -861,7 +873,7 @@ var OPERATIONS = {
|
|
|
861
873
|
pathParams: ["id"],
|
|
862
874
|
queryParams: ["view"],
|
|
863
875
|
requestSchema: null,
|
|
864
|
-
responseSchema: "
|
|
876
|
+
responseSchema: "WorkflowDto"
|
|
865
877
|
},
|
|
866
878
|
"WorkflowsController_list": {
|
|
867
879
|
method: "GET",
|
|
@@ -881,7 +893,7 @@ var OPERATIONS = {
|
|
|
881
893
|
pathParams: ["id"],
|
|
882
894
|
queryParams: [],
|
|
883
895
|
requestSchema: "TransferOwnershipDto",
|
|
884
|
-
responseSchema: "
|
|
896
|
+
responseSchema: "WorkflowDto"
|
|
885
897
|
},
|
|
886
898
|
"WorkflowsController_restore": {
|
|
887
899
|
method: "POST",
|
|
@@ -891,7 +903,7 @@ var OPERATIONS = {
|
|
|
891
903
|
pathParams: ["id"],
|
|
892
904
|
queryParams: [],
|
|
893
905
|
requestSchema: null,
|
|
894
|
-
responseSchema: "
|
|
906
|
+
responseSchema: "WorkflowDto"
|
|
895
907
|
},
|
|
896
908
|
"WorkflowsController_toggle": {
|
|
897
909
|
method: "POST",
|
|
@@ -901,7 +913,7 @@ var OPERATIONS = {
|
|
|
901
913
|
pathParams: ["id"],
|
|
902
914
|
queryParams: [],
|
|
903
915
|
requestSchema: "ToggleAgentDto",
|
|
904
|
-
responseSchema: "
|
|
916
|
+
responseSchema: "WorkflowDto"
|
|
905
917
|
},
|
|
906
918
|
"WorkflowsController_update": {
|
|
907
919
|
method: "PATCH",
|
|
@@ -911,7 +923,7 @@ var OPERATIONS = {
|
|
|
911
923
|
pathParams: ["id"],
|
|
912
924
|
queryParams: ["updateMask"],
|
|
913
925
|
requestSchema: "UpdateAgentDto",
|
|
914
|
-
responseSchema: "
|
|
926
|
+
responseSchema: "WorkflowDto"
|
|
915
927
|
}
|
|
916
928
|
};
|
|
917
929
|
|
|
@@ -1121,7 +1133,7 @@ var WRITE_BODY_ALLOWED_KEYS = {
|
|
|
1121
1133
|
ScopesController_update: ["name", "description", "expectedOutput", "instructions", "toolset", "model", "connectionSet", "contextSelections", "interfaces", "accessConfig", "managerId", "evaluations", "supervisionSubordinateDescriptions"],
|
|
1122
1134
|
ScopeSupervisionController_set: ["subordinateAgentIds"],
|
|
1123
1135
|
ScopeSupervisionController_setActive: ["subordinateAgentIds"],
|
|
1124
|
-
SuggestionsController_recordEvent: ["
|
|
1136
|
+
SuggestionsController_recordEvent: ["eventType", "source", "skillId", "threadId", "metadata"],
|
|
1125
1137
|
WorkflowActionsController_cancel: [],
|
|
1126
1138
|
WorkflowActionsController_execute: ["organizationId", "sessionId", "fileThreadId", "workflowAction", "previousOutputs", "userTimezone", "runId", "automationId", "source"],
|
|
1127
1139
|
WorkflowInterfacesController_add: ["type", "name", "config"],
|
|
@@ -1257,11 +1269,27 @@ var ChatStream = class {
|
|
|
1257
1269
|
this.baseUrl = baseUrl;
|
|
1258
1270
|
this.textParts = [];
|
|
1259
1271
|
}
|
|
1272
|
+
/**
|
|
1273
|
+
* Async iterable of assistant text token chunks as they arrive.
|
|
1274
|
+
*
|
|
1275
|
+
* @returns An async generator yielding partial text strings.
|
|
1276
|
+
* @throws {ModusError} When the stream emits an error event.
|
|
1277
|
+
* @throws {RunCancelledError} When the run is cancelled.
|
|
1278
|
+
* @throws {StreamTimeoutError} When the stream times out.
|
|
1279
|
+
*/
|
|
1260
1280
|
async *textStream() {
|
|
1261
1281
|
for await (const event of this.events(false)) {
|
|
1262
1282
|
if (event.type === "token") yield event.content;
|
|
1263
1283
|
}
|
|
1264
1284
|
}
|
|
1285
|
+
/**
|
|
1286
|
+
* Async iterable of structured run events (tokens, tool calls, done, and so on).
|
|
1287
|
+
*
|
|
1288
|
+
* @returns An async generator yielding {@link RunEvent} objects.
|
|
1289
|
+
* @throws {ModusError} When the stream emits an error event.
|
|
1290
|
+
* @throws {RunCancelledError} When the run is cancelled.
|
|
1291
|
+
* @throws {StreamTimeoutError} When the stream times out.
|
|
1292
|
+
*/
|
|
1265
1293
|
async *eventStream() {
|
|
1266
1294
|
yield* this.events(true);
|
|
1267
1295
|
}
|
|
@@ -1290,6 +1318,15 @@ var ChatStream = class {
|
|
|
1290
1318
|
}
|
|
1291
1319
|
}
|
|
1292
1320
|
}
|
|
1321
|
+
/**
|
|
1322
|
+
* Final chat result after the stream completes.
|
|
1323
|
+
*
|
|
1324
|
+
* Call only after fully consuming {@link ChatStream.textStream} or
|
|
1325
|
+
* {@link ChatStream.eventStream}.
|
|
1326
|
+
*
|
|
1327
|
+
* @returns The assembled assistant reply, thread id, and run id.
|
|
1328
|
+
* @throws {ModusError} When called before the stream finishes with a done event.
|
|
1329
|
+
*/
|
|
1293
1330
|
getFinalResult() {
|
|
1294
1331
|
if (this.final === void 0) {
|
|
1295
1332
|
throw new ModusError(
|
|
@@ -1349,9 +1386,20 @@ var Page = class {
|
|
|
1349
1386
|
this.nextPageToken = normalizePageToken(nextPageToken);
|
|
1350
1387
|
this.fetchPage = fetchPage;
|
|
1351
1388
|
}
|
|
1389
|
+
/**
|
|
1390
|
+
* Whether another page of results is available.
|
|
1391
|
+
*
|
|
1392
|
+
* @returns `true` when {@link Page.nextPageToken} is set.
|
|
1393
|
+
*/
|
|
1352
1394
|
hasNextPage() {
|
|
1353
1395
|
return this.nextPageToken !== void 0;
|
|
1354
1396
|
}
|
|
1397
|
+
/**
|
|
1398
|
+
* Fetch the next page using {@link Page.nextPageToken}.
|
|
1399
|
+
*
|
|
1400
|
+
* @returns The following page of results.
|
|
1401
|
+
* @throws {Error} When there is no next page. Check {@link Page.hasNextPage} first.
|
|
1402
|
+
*/
|
|
1355
1403
|
async getNextPage() {
|
|
1356
1404
|
if (this.nextPageToken === void 0) {
|
|
1357
1405
|
throw new Error(
|
|
@@ -1360,6 +1408,12 @@ var Page = class {
|
|
|
1360
1408
|
}
|
|
1361
1409
|
return this.fetchPage(this.nextPageToken);
|
|
1362
1410
|
}
|
|
1411
|
+
/**
|
|
1412
|
+
* Async-iterate over all items across every page, fetching additional pages as needed.
|
|
1413
|
+
*
|
|
1414
|
+
* @returns An async generator yielding every item in the result set.
|
|
1415
|
+
* @throws {ModusError} When a follow-up page request fails.
|
|
1416
|
+
*/
|
|
1363
1417
|
async *autoPagingIter() {
|
|
1364
1418
|
for (const item of this.items) yield item;
|
|
1365
1419
|
let nextPageToken = this.nextPageToken;
|
|
@@ -1369,6 +1423,7 @@ var Page = class {
|
|
|
1369
1423
|
nextPageToken = page.nextPageToken;
|
|
1370
1424
|
}
|
|
1371
1425
|
}
|
|
1426
|
+
/** Iterate over the current page's items only. */
|
|
1372
1427
|
[Symbol.iterator]() {
|
|
1373
1428
|
return this.items[Symbol.iterator]();
|
|
1374
1429
|
}
|
|
@@ -1407,15 +1462,19 @@ function buildAipPage(data, itemsKey, mapItem, fetchPage) {
|
|
|
1407
1462
|
return new Page(items, nextPageTokenFromResponse(data), fetchPage);
|
|
1408
1463
|
}
|
|
1409
1464
|
|
|
1410
|
-
// src/types/
|
|
1411
|
-
var
|
|
1465
|
+
// src/types/workflows.ts
|
|
1466
|
+
var WorkflowType = {
|
|
1412
1467
|
task: "task",
|
|
1413
1468
|
workflow: "workflow"
|
|
1414
1469
|
};
|
|
1470
|
+
var AgentType = WorkflowType;
|
|
1415
1471
|
|
|
1416
1472
|
// src/types/conversations.ts
|
|
1473
|
+
function conversationScopeId(item) {
|
|
1474
|
+
return item.scopeId === 0 ? void 0 : item.scopeId;
|
|
1475
|
+
}
|
|
1417
1476
|
function conversationSkillId(item) {
|
|
1418
|
-
return item.
|
|
1477
|
+
return item.scopeId;
|
|
1419
1478
|
}
|
|
1420
1479
|
|
|
1421
1480
|
// src/_auth.ts
|
|
@@ -1446,6 +1505,19 @@ function resolveBaseUrl(baseUrl) {
|
|
|
1446
1505
|
function resolveAgentHost(agentHost) {
|
|
1447
1506
|
return agentHost ?? process.env[ENV_AGENT_HOST] ?? void 0;
|
|
1448
1507
|
}
|
|
1508
|
+
function isModusApiHostname(hostname) {
|
|
1509
|
+
return hostname === "api.getmodus.com" || /^api\.[a-z0-9-]+\.getmodus\.com$/i.test(hostname);
|
|
1510
|
+
}
|
|
1511
|
+
function deriveAgentHostFromBaseUrl(baseUrl) {
|
|
1512
|
+
try {
|
|
1513
|
+
const url = new URL(baseUrl);
|
|
1514
|
+
if (!isModusApiHostname(url.hostname)) return void 0;
|
|
1515
|
+
url.hostname = `agent.${url.hostname.slice("api.".length)}`;
|
|
1516
|
+
return url.origin;
|
|
1517
|
+
} catch {
|
|
1518
|
+
return void 0;
|
|
1519
|
+
}
|
|
1520
|
+
}
|
|
1449
1521
|
function resolveOrganizationId(organizationId) {
|
|
1450
1522
|
const raw = organizationId ?? process.env[ENV_ORGANIZATION_ID];
|
|
1451
1523
|
if (raw === void 0) return void 0;
|
|
@@ -1497,7 +1569,7 @@ function createModusConfig(options = {}) {
|
|
|
1497
1569
|
const baseUrl = normalizeBaseUrl(resolveBaseUrl(options.baseUrl) ?? DEFAULT_BASE_URL);
|
|
1498
1570
|
const baseUrlOverrides = normalizeBaseUrls(options.baseUrls);
|
|
1499
1571
|
const agentHost = normalizeBaseUrl(
|
|
1500
|
-
baseUrlOverrides["agent-service"] ?? resolveAgentHost(options.agentHost) ?? DEFAULT_AGENT_HOST
|
|
1572
|
+
baseUrlOverrides["agent-service"] ?? resolveAgentHost(options.agentHost) ?? deriveAgentHostFromBaseUrl(baseUrl) ?? DEFAULT_AGENT_HOST
|
|
1501
1573
|
);
|
|
1502
1574
|
const organizationId = resolveOrganizationId(options.organizationId);
|
|
1503
1575
|
return Object.freeze({
|
|
@@ -1527,7 +1599,7 @@ function formatConfigForLog(config) {
|
|
|
1527
1599
|
}
|
|
1528
1600
|
|
|
1529
1601
|
// src/_http.ts
|
|
1530
|
-
var USER_AGENT = `modus-typescript/${"0.
|
|
1602
|
+
var USER_AGENT = `modus-typescript/${"0.4.0"} (node/${process.version}; ${process.platform})`;
|
|
1531
1603
|
function buildUrl(baseUrl, path, params) {
|
|
1532
1604
|
const url = new URL(path.startsWith("/") ? path : `/${path}`, baseUrl);
|
|
1533
1605
|
if (params) {
|
|
@@ -1875,7 +1947,7 @@ function asRecord(data) {
|
|
|
1875
1947
|
throw new Error(`Expected object response, got ${typeof data}`);
|
|
1876
1948
|
}
|
|
1877
1949
|
|
|
1878
|
-
// src/resources/
|
|
1950
|
+
// src/resources/workflows/runs.ts
|
|
1879
1951
|
var import_node_crypto2 = require("crypto");
|
|
1880
1952
|
var RUNS_MAX_PAGE_SIZE = 100;
|
|
1881
1953
|
function runsListParams(pageSize, pageToken, status, timeframe, approvalScope, search) {
|
|
@@ -1939,10 +2011,23 @@ function makeAgentRunStream(runId, events) {
|
|
|
1939
2011
|
};
|
|
1940
2012
|
}
|
|
1941
2013
|
var WorkflowRunsResource = class {
|
|
2014
|
+
/** @internal */
|
|
1942
2015
|
constructor(http, config) {
|
|
1943
2016
|
this.http = http;
|
|
1944
2017
|
this.config = config;
|
|
1945
2018
|
}
|
|
2019
|
+
/**
|
|
2020
|
+
* List runs for a workflow.
|
|
2021
|
+
*
|
|
2022
|
+
* @param workflowId - Workflow id or slug.
|
|
2023
|
+
* @param options.pageSize - Maximum items per page (default 25, max 100).
|
|
2024
|
+
* @param options.pageToken - Opaque token from a previous page.
|
|
2025
|
+
* @param options.status - Filter by run status.
|
|
2026
|
+
* @param options.timeframe - Filter by recency (`last_hour`, `last_day`, or `last_week`).
|
|
2027
|
+
* @param options.approvalScope - Filter approval-related runs (`mine` or `all`).
|
|
2028
|
+
* @param options.search - Free-text search filter.
|
|
2029
|
+
* @returns A page of run summaries.
|
|
2030
|
+
*/
|
|
1946
2031
|
list(workflowId, options = {}) {
|
|
1947
2032
|
validateId(workflowId, "workflow_id");
|
|
1948
2033
|
const pageSize = options.pageSize ?? 25;
|
|
@@ -1977,6 +2062,15 @@ var WorkflowRunsResource = class {
|
|
|
1977
2062
|
(token) => this.listPage(workflowId, pageSize, token, filters)
|
|
1978
2063
|
);
|
|
1979
2064
|
}
|
|
2065
|
+
/**
|
|
2066
|
+
* Retrieve a workflow run by id.
|
|
2067
|
+
*
|
|
2068
|
+
* @param workflowId - Workflow id or slug the run belongs to.
|
|
2069
|
+
* @param runId - Run id.
|
|
2070
|
+
* @param options.temporalRunId - Optional internal execution id when disambiguating retries.
|
|
2071
|
+
* @returns Run details including status and output.
|
|
2072
|
+
* @throws {NotFoundError} When the run does not exist.
|
|
2073
|
+
*/
|
|
1980
2074
|
async get(workflowId, runId, options = {}) {
|
|
1981
2075
|
validateId(workflowId, "workflow_id");
|
|
1982
2076
|
if (!runId.trim()) throw new Error("run_id must be a non-empty string");
|
|
@@ -1987,21 +2081,69 @@ var WorkflowRunsResource = class {
|
|
|
1987
2081
|
});
|
|
1988
2082
|
return parseRun(data);
|
|
1989
2083
|
}
|
|
2084
|
+
/**
|
|
2085
|
+
* Start a workflow run and stream run events.
|
|
2086
|
+
*
|
|
2087
|
+
* @param workflowId - Workflow id or slug to run.
|
|
2088
|
+
* @param body - Run body (`message`, optional `sessionId`, optional `version` as `published` or `draft`).
|
|
2089
|
+
* @param options.idempotencyKey - Client-supplied idempotency key; defaults to `body.runId` or a new uuid.
|
|
2090
|
+
* @returns A stream of run events (tokens, completion, errors, and related signals).
|
|
2091
|
+
*
|
|
2092
|
+
* @example
|
|
2093
|
+
* ```ts
|
|
2094
|
+
* const stream = client.workflows.runs.create(workflowId, {
|
|
2095
|
+
* message: 'Summarize yesterday\'s sales',
|
|
2096
|
+
* sessionId: 'conv-abc',
|
|
2097
|
+
* })
|
|
2098
|
+
* for await (const event of stream) {
|
|
2099
|
+
* if (event.type === 'token') process.stdout.write(event.content)
|
|
2100
|
+
* if (event.type === 'done') break
|
|
2101
|
+
* }
|
|
2102
|
+
* ```
|
|
2103
|
+
*/
|
|
1990
2104
|
create(workflowId, body, options = {}) {
|
|
1991
2105
|
validateId(workflowId, "workflow_id");
|
|
1992
2106
|
return this.createRun("WorkflowRunsController_create", body, { id: workflowId }, options);
|
|
1993
2107
|
}
|
|
2108
|
+
/**
|
|
2109
|
+
* Start a scope run and stream run events.
|
|
2110
|
+
*
|
|
2111
|
+
* @param scopeId - Scope id to run.
|
|
2112
|
+
* @param body - Run body (`message`, optional `sessionId`, optional `version` as `published` or `draft`).
|
|
2113
|
+
* @param options.idempotencyKey - Client-supplied idempotency key; defaults to `body.runId` or a new uuid.
|
|
2114
|
+
* @returns A stream of run events.
|
|
2115
|
+
*/
|
|
1994
2116
|
createScope(scopeId, body, options = {}) {
|
|
1995
2117
|
validateId(scopeId, "scope_id");
|
|
1996
2118
|
return this.createRun("ScopeRunsController_create", body, { id: scopeId }, options);
|
|
1997
2119
|
}
|
|
2120
|
+
/**
|
|
2121
|
+
* Start a Modus assistant run and stream run events.
|
|
2122
|
+
*
|
|
2123
|
+
* @param body - Run body (`message`, optional `sessionId`, optional `subordinateSkillIds` to narrow context).
|
|
2124
|
+
* @param options.idempotencyKey - Client-supplied idempotency key; defaults to `body.runId` or a new uuid.
|
|
2125
|
+
* @returns A stream of run events.
|
|
2126
|
+
*/
|
|
1998
2127
|
createModus(body, options = {}) {
|
|
1999
2128
|
return this.createRun("ModusRunsController_create", body, {}, options);
|
|
2000
2129
|
}
|
|
2130
|
+
/**
|
|
2131
|
+
* Resume an interrupted run and stream run events.
|
|
2132
|
+
*
|
|
2133
|
+
* @param runId - Run id to resume.
|
|
2134
|
+
* @param body - Resume body (`message`, `sessionId`, and `decision`: `approve` / `deny` / `connected` / `cancelled`).
|
|
2135
|
+
* @param options.idempotencyKey - Client-supplied idempotency key; defaults to `body.runId` or a new uuid.
|
|
2136
|
+
* @returns A stream of run events.
|
|
2137
|
+
*/
|
|
2001
2138
|
resume(runId, body, options = {}) {
|
|
2002
2139
|
validateId(runId, "run_id");
|
|
2003
2140
|
return this.createRun("ResumeRunsController_create", body, { runId }, options);
|
|
2004
2141
|
}
|
|
2142
|
+
/**
|
|
2143
|
+
* Cancel a run that is still in progress.
|
|
2144
|
+
*
|
|
2145
|
+
* @param runId - Run id to cancel.
|
|
2146
|
+
*/
|
|
2005
2147
|
async cancel(runId) {
|
|
2006
2148
|
validateId(runId, "run_id");
|
|
2007
2149
|
await invokeWithRetry(this.config, this.http, "RunLifecycleController_cancel", {
|
|
@@ -2009,12 +2151,23 @@ var WorkflowRunsResource = class {
|
|
|
2009
2151
|
jsonBody: {}
|
|
2010
2152
|
});
|
|
2011
2153
|
}
|
|
2154
|
+
/**
|
|
2155
|
+
* Fetch stored run events for a run.
|
|
2156
|
+
*
|
|
2157
|
+
* @param runId - Run id.
|
|
2158
|
+
* @returns Run event history for replay or inspection.
|
|
2159
|
+
*/
|
|
2012
2160
|
async events(runId) {
|
|
2013
2161
|
validateId(runId, "run_id");
|
|
2014
2162
|
return invokeWithRetry(this.config, this.http, "RunLifecycleController_events", {
|
|
2015
2163
|
pathParams: { runId }
|
|
2016
2164
|
});
|
|
2017
2165
|
}
|
|
2166
|
+
/**
|
|
2167
|
+
* Request a graceful stop for a running execution.
|
|
2168
|
+
*
|
|
2169
|
+
* @param runId - Run id to interrupt.
|
|
2170
|
+
*/
|
|
2018
2171
|
async interrupt(runId) {
|
|
2019
2172
|
validateId(runId, "run_id");
|
|
2020
2173
|
await invokeWithRetry(this.config, this.http, "RunLifecycleController_interrupt", {
|
|
@@ -2022,6 +2175,11 @@ var WorkflowRunsResource = class {
|
|
|
2022
2175
|
jsonBody: {}
|
|
2023
2176
|
});
|
|
2024
2177
|
}
|
|
2178
|
+
/**
|
|
2179
|
+
* Move a queued run back into an editable state before it starts.
|
|
2180
|
+
*
|
|
2181
|
+
* @param runId - Queued run id.
|
|
2182
|
+
*/
|
|
2025
2183
|
async editQueued(runId) {
|
|
2026
2184
|
validateId(runId, "run_id");
|
|
2027
2185
|
await invokeWithRetry(this.config, this.http, "RunLifecycleController_editQueued", {
|
|
@@ -2029,6 +2187,13 @@ var WorkflowRunsResource = class {
|
|
|
2029
2187
|
jsonBody: {}
|
|
2030
2188
|
});
|
|
2031
2189
|
}
|
|
2190
|
+
/**
|
|
2191
|
+
* List active conversation runs across the organization.
|
|
2192
|
+
*
|
|
2193
|
+
* @param options.pageSize - Maximum items per page (default 50, max 100).
|
|
2194
|
+
* @param options.pageToken - Opaque token from a previous page.
|
|
2195
|
+
* @returns A page of active runs with session and status metadata.
|
|
2196
|
+
*/
|
|
2032
2197
|
active(options = {}) {
|
|
2033
2198
|
const pageSize = options.pageSize ?? 50;
|
|
2034
2199
|
validatePageSize(pageSize, RUNS_MAX_PAGE_SIZE);
|
|
@@ -2042,6 +2207,13 @@ var WorkflowRunsResource = class {
|
|
|
2042
2207
|
(token) => this.activePage(pageSize, token)
|
|
2043
2208
|
);
|
|
2044
2209
|
}
|
|
2210
|
+
/**
|
|
2211
|
+
* Look up active runs for specific conversation sessions.
|
|
2212
|
+
*
|
|
2213
|
+
* @param sessionIds - Up to 100 session ids.
|
|
2214
|
+
* @returns Active runs matching any of the given sessions.
|
|
2215
|
+
* @throws {Error} When more than 100 session ids are provided.
|
|
2216
|
+
*/
|
|
2045
2217
|
async activeBySession(sessionIds) {
|
|
2046
2218
|
const uniqueSessionIds = [...new Set(sessionIds.map((id) => id.trim()).filter(Boolean))];
|
|
2047
2219
|
if (uniqueSessionIds.length > 100) {
|
|
@@ -2053,6 +2225,21 @@ var WorkflowRunsResource = class {
|
|
|
2053
2225
|
})
|
|
2054
2226
|
);
|
|
2055
2227
|
}
|
|
2228
|
+
/**
|
|
2229
|
+
* Reconnect to an in-progress run and stream run events.
|
|
2230
|
+
*
|
|
2231
|
+
* @param runId - Run id to follow.
|
|
2232
|
+
* @param options.lastEventId - Resume after this event id when catching up.
|
|
2233
|
+
* @returns A stream of run events from the current execution point.
|
|
2234
|
+
*
|
|
2235
|
+
* @example
|
|
2236
|
+
* ```ts
|
|
2237
|
+
* const stream = client.workflows.runs.stream(runId, { lastEventId: checkpoint })
|
|
2238
|
+
* for await (const event of stream) {
|
|
2239
|
+
* if (event.type === 'token') process.stdout.write(event.content)
|
|
2240
|
+
* }
|
|
2241
|
+
* ```
|
|
2242
|
+
*/
|
|
2056
2243
|
stream(runId, options = {}) {
|
|
2057
2244
|
validateId(runId, "run_id");
|
|
2058
2245
|
const op = getOperation("RunLifecycleController_stream");
|
|
@@ -2083,16 +2270,24 @@ var WorkflowRunsResource = class {
|
|
|
2083
2270
|
}
|
|
2084
2271
|
};
|
|
2085
2272
|
|
|
2086
|
-
// src/resources/
|
|
2273
|
+
// src/resources/workflows/workflow-actions.ts
|
|
2087
2274
|
var import_node_crypto3 = require("crypto");
|
|
2088
2275
|
function randomRunId2() {
|
|
2089
2276
|
return (0, import_node_crypto3.randomUUID)();
|
|
2090
2277
|
}
|
|
2091
2278
|
var AgentWorkflowActionsResource = class {
|
|
2279
|
+
/** @internal */
|
|
2092
2280
|
constructor(http, config) {
|
|
2093
2281
|
this.http = http;
|
|
2094
2282
|
this.config = config;
|
|
2095
2283
|
}
|
|
2284
|
+
/**
|
|
2285
|
+
* Execute a workflow action and stream run events.
|
|
2286
|
+
*
|
|
2287
|
+
* @param body - Action body (`organizationId`, `sessionId`, `workflowAction`, optional `previousOutputs`).
|
|
2288
|
+
* @param options.idempotencyKey - Client-supplied idempotency key; defaults to `body.runId` or a new uuid.
|
|
2289
|
+
* @returns A stream of run events for the action execution.
|
|
2290
|
+
*/
|
|
2096
2291
|
execute(body, options = {}) {
|
|
2097
2292
|
const runId = options.idempotencyKey?.trim() || body.runId?.trim() || randomRunId2();
|
|
2098
2293
|
const op = getOperation("WorkflowActionsController_execute");
|
|
@@ -2103,6 +2298,11 @@ var AgentWorkflowActionsResource = class {
|
|
|
2103
2298
|
});
|
|
2104
2299
|
return makeAgentRunStream(runId, this.parseEvents(lines));
|
|
2105
2300
|
}
|
|
2301
|
+
/**
|
|
2302
|
+
* Cancel a workflow action run.
|
|
2303
|
+
*
|
|
2304
|
+
* @param runId - Action run id to cancel.
|
|
2305
|
+
*/
|
|
2106
2306
|
async cancel(runId) {
|
|
2107
2307
|
validateId(runId, "run_id");
|
|
2108
2308
|
await invokeWithRetry(this.config, this.http, "WorkflowActionsController_cancel", {
|
|
@@ -2115,7 +2315,7 @@ var AgentWorkflowActionsResource = class {
|
|
|
2115
2315
|
}
|
|
2116
2316
|
};
|
|
2117
2317
|
|
|
2118
|
-
// src/resources/
|
|
2318
|
+
// src/resources/workflows.ts
|
|
2119
2319
|
function workflowsListParams(pageSize, pageToken, search, type, view, includeVariation) {
|
|
2120
2320
|
const extra = {};
|
|
2121
2321
|
if (search !== void 0) extra.search = search;
|
|
@@ -2128,12 +2328,24 @@ function parseWorkflow(raw) {
|
|
|
2128
2328
|
return raw;
|
|
2129
2329
|
}
|
|
2130
2330
|
var WorkflowsResource = class {
|
|
2331
|
+
/** @internal */
|
|
2131
2332
|
constructor(http, config) {
|
|
2132
2333
|
this.http = http;
|
|
2133
2334
|
this.config = config;
|
|
2134
2335
|
this.runs = new WorkflowRunsResource(http, config);
|
|
2135
2336
|
this.workflowActions = new AgentWorkflowActionsResource(http, config);
|
|
2136
2337
|
}
|
|
2338
|
+
/**
|
|
2339
|
+
* List workflows.
|
|
2340
|
+
*
|
|
2341
|
+
* @param options.pageSize - Maximum items per page (default 25).
|
|
2342
|
+
* @param options.pageToken - Opaque token from a previous page.
|
|
2343
|
+
* @param options.search - Free-text search filter.
|
|
2344
|
+
* @param options.type - Workflow kind: `"task"` or `"workflow"`.
|
|
2345
|
+
* @param options.view - Which saved version to return (`active` or `draft`).
|
|
2346
|
+
* @param options.includeVariation - Include variation metadata when supported.
|
|
2347
|
+
* @returns A page of workflows.
|
|
2348
|
+
*/
|
|
2137
2349
|
list(options = {}) {
|
|
2138
2350
|
const pageSize = options.pageSize ?? 25;
|
|
2139
2351
|
validatePageSize(pageSize);
|
|
@@ -2161,11 +2373,20 @@ var WorkflowsResource = class {
|
|
|
2161
2373
|
);
|
|
2162
2374
|
return buildAipPage(
|
|
2163
2375
|
data,
|
|
2164
|
-
"
|
|
2376
|
+
"workflows",
|
|
2165
2377
|
parseWorkflow,
|
|
2166
2378
|
(token) => this.listPage(pageSize, token, search, type, view, includeVariation)
|
|
2167
2379
|
);
|
|
2168
2380
|
}
|
|
2381
|
+
/**
|
|
2382
|
+
* Retrieve a workflow by ID or slug.
|
|
2383
|
+
*
|
|
2384
|
+
* @param workflowId - Numeric id or slug.
|
|
2385
|
+
* @param options.view - Which saved version to return (`active` or `draft`).
|
|
2386
|
+
* @param options.includeVariation - Include variation metadata when supported.
|
|
2387
|
+
* @returns The workflow.
|
|
2388
|
+
* @throws {NotFoundError} When no workflow matches the id or slug.
|
|
2389
|
+
*/
|
|
2169
2390
|
async get(workflowId, options = {}) {
|
|
2170
2391
|
validateId(workflowId, "workflow_id");
|
|
2171
2392
|
const query = {};
|
|
@@ -2179,12 +2400,6 @@ var WorkflowsResource = class {
|
|
|
2179
2400
|
});
|
|
2180
2401
|
return parseWorkflow(data);
|
|
2181
2402
|
}
|
|
2182
|
-
chat(workflowId, message, options) {
|
|
2183
|
-
return chatBuffered(this.http, "workflows", workflowId, message, options);
|
|
2184
|
-
}
|
|
2185
|
-
chatStream(workflowId, message, options) {
|
|
2186
|
-
return chatStreamSession(this.http, this.config, "workflows", workflowId, message, options);
|
|
2187
|
-
}
|
|
2188
2403
|
};
|
|
2189
2404
|
|
|
2190
2405
|
// src/resources/connections.ts
|
|
@@ -2197,10 +2412,19 @@ function parseConnection(raw) {
|
|
|
2197
2412
|
return raw;
|
|
2198
2413
|
}
|
|
2199
2414
|
var ConnectionsResource = class {
|
|
2415
|
+
/** @internal */
|
|
2200
2416
|
constructor(http, config) {
|
|
2201
2417
|
this.http = http;
|
|
2202
2418
|
this.config = config;
|
|
2203
2419
|
}
|
|
2420
|
+
/**
|
|
2421
|
+
* List integration connections.
|
|
2422
|
+
*
|
|
2423
|
+
* @param options.pageSize - Maximum items per page (default 25).
|
|
2424
|
+
* @param options.pageToken - Opaque token from a previous page.
|
|
2425
|
+
* @param options.type - Integration category; exact match filter.
|
|
2426
|
+
* @returns A page of connections.
|
|
2427
|
+
*/
|
|
2204
2428
|
list(options = {}) {
|
|
2205
2429
|
const pageSize = options.pageSize ?? 25;
|
|
2206
2430
|
validatePageSize(pageSize);
|
|
@@ -2219,6 +2443,16 @@ var ConnectionsResource = class {
|
|
|
2219
2443
|
(token) => this.listPage(pageSize, token, type)
|
|
2220
2444
|
);
|
|
2221
2445
|
}
|
|
2446
|
+
/**
|
|
2447
|
+
* Find the first connection whose name matches (case-insensitive).
|
|
2448
|
+
*
|
|
2449
|
+
* Pages through {@link ConnectionsResource.list} until a match is found.
|
|
2450
|
+
*
|
|
2451
|
+
* @param options.name - Connection name to search for.
|
|
2452
|
+
* @param options.type - Optional integration category filter.
|
|
2453
|
+
* @param options.pageSize - Page size when scanning (default 25).
|
|
2454
|
+
* @returns The matching connection, or `undefined` if none is found.
|
|
2455
|
+
*/
|
|
2222
2456
|
async find(options) {
|
|
2223
2457
|
const pageSize = options.pageSize ?? 25;
|
|
2224
2458
|
validatePageSize(pageSize);
|
|
@@ -2240,16 +2474,37 @@ function parseContextItem(raw) {
|
|
|
2240
2474
|
return raw;
|
|
2241
2475
|
}
|
|
2242
2476
|
function parseCreatedCustomContextItem(raw) {
|
|
2243
|
-
|
|
2477
|
+
const data = asRecord(raw);
|
|
2478
|
+
const contextItemId = data.contextItemId;
|
|
2479
|
+
if (typeof contextItemId !== "string" || !contextItemId) {
|
|
2480
|
+
throw new ValidationError(
|
|
2481
|
+
"Custom context create response missing non-empty string contextItemId"
|
|
2482
|
+
);
|
|
2483
|
+
}
|
|
2484
|
+
return {
|
|
2485
|
+
...data,
|
|
2486
|
+
contextItemId,
|
|
2487
|
+
uid: contextItemId
|
|
2488
|
+
};
|
|
2244
2489
|
}
|
|
2245
2490
|
function parseDeletion(raw) {
|
|
2246
2491
|
return raw;
|
|
2247
2492
|
}
|
|
2248
2493
|
var CustomContextItemsResource = class {
|
|
2494
|
+
/** @internal */
|
|
2249
2495
|
constructor(http, config) {
|
|
2250
2496
|
this.http = http;
|
|
2251
2497
|
this.config = config;
|
|
2252
2498
|
}
|
|
2499
|
+
/**
|
|
2500
|
+
* List custom context items.
|
|
2501
|
+
*
|
|
2502
|
+
* @param options.pageSize - Maximum items per page (default 25).
|
|
2503
|
+
* @param options.pageToken - Opaque token from a previous page.
|
|
2504
|
+
* @param options.searchQuery - Free-text search filter.
|
|
2505
|
+
* @param options.topics - Filter to items tagged with any of these topics.
|
|
2506
|
+
* @returns A page of custom context items.
|
|
2507
|
+
*/
|
|
2253
2508
|
list(options = {}) {
|
|
2254
2509
|
const pageSize = options.pageSize ?? 25;
|
|
2255
2510
|
validatePageSize(pageSize);
|
|
@@ -2271,6 +2526,13 @@ var CustomContextItemsResource = class {
|
|
|
2271
2526
|
(token) => this.listPage(pageSize, token, options)
|
|
2272
2527
|
);
|
|
2273
2528
|
}
|
|
2529
|
+
/**
|
|
2530
|
+
* Retrieve a custom context item by uid.
|
|
2531
|
+
*
|
|
2532
|
+
* @param uid - Item uid.
|
|
2533
|
+
* @returns The custom context item.
|
|
2534
|
+
* @throws {NotFoundError} When no item matches the uid.
|
|
2535
|
+
*/
|
|
2274
2536
|
async get(uid) {
|
|
2275
2537
|
return parseContextItem(
|
|
2276
2538
|
await invokeWithRetry(this.config, this.http, "CustomContextItemsController_get", {
|
|
@@ -2278,6 +2540,26 @@ var CustomContextItemsResource = class {
|
|
|
2278
2540
|
})
|
|
2279
2541
|
);
|
|
2280
2542
|
}
|
|
2543
|
+
/**
|
|
2544
|
+
* Create a custom context item.
|
|
2545
|
+
*
|
|
2546
|
+
* @param input.kind - Item kind (`source`, `collection`, `entity`, `field`, or `entity_samples`).
|
|
2547
|
+
* @param input.sourceId - Source identifier for the item hierarchy.
|
|
2548
|
+
* @param input.name - Display name when applicable.
|
|
2549
|
+
* @param input.content - Item payload.
|
|
2550
|
+
* @param input.idempotencyKey - Optional idempotency key for safe retries.
|
|
2551
|
+
* @returns Created item ids and hierarchy metadata.
|
|
2552
|
+
*
|
|
2553
|
+
* @example
|
|
2554
|
+
* ```ts
|
|
2555
|
+
* const created = await client.context.customItems.create({
|
|
2556
|
+
* kind: 'entity',
|
|
2557
|
+
* sourceId: 'my-source',
|
|
2558
|
+
* name: 'Q3 churn notes',
|
|
2559
|
+
* content: { summary: 'Key findings…' },
|
|
2560
|
+
* })
|
|
2561
|
+
* ```
|
|
2562
|
+
*/
|
|
2281
2563
|
async create(input) {
|
|
2282
2564
|
return parseCreatedCustomContextItem(
|
|
2283
2565
|
await invokeWithRetry(this.config, this.http, "CustomContextItemsController_create", {
|
|
@@ -2285,6 +2567,20 @@ var CustomContextItemsResource = class {
|
|
|
2285
2567
|
})
|
|
2286
2568
|
);
|
|
2287
2569
|
}
|
|
2570
|
+
/**
|
|
2571
|
+
* Create multiple custom context items in one request.
|
|
2572
|
+
*
|
|
2573
|
+
* @param inputs - Items to create (same fields as {@link CustomContextItemsResource.create}).
|
|
2574
|
+
* @returns Created item metadata for each input.
|
|
2575
|
+
*
|
|
2576
|
+
* @example
|
|
2577
|
+
* ```ts
|
|
2578
|
+
* const created = await client.context.customItems.batchCreate([
|
|
2579
|
+
* { kind: 'field', sourceId: 'src', fieldName: 'region', dataType: 'string' },
|
|
2580
|
+
* { kind: 'field', sourceId: 'src', fieldName: 'amount', dataType: 'number' },
|
|
2581
|
+
* ])
|
|
2582
|
+
* ```
|
|
2583
|
+
*/
|
|
2288
2584
|
async batchCreate(inputs) {
|
|
2289
2585
|
const data = asRecord(
|
|
2290
2586
|
await invokeWithRetry(this.config, this.http, "CustomContextItemsController_batchCreate", {
|
|
@@ -2296,6 +2592,13 @@ var CustomContextItemsResource = class {
|
|
|
2296
2592
|
const items = data.contextItems;
|
|
2297
2593
|
return Array.isArray(items) ? items.map(parseCreatedCustomContextItem) : [];
|
|
2298
2594
|
}
|
|
2595
|
+
/**
|
|
2596
|
+
* Update a custom context item.
|
|
2597
|
+
*
|
|
2598
|
+
* @param uid - Item uid.
|
|
2599
|
+
* @param input - Fields to change (kind and hierarchy ids cannot be changed).
|
|
2600
|
+
* @returns The updated item uid.
|
|
2601
|
+
*/
|
|
2299
2602
|
async update(uid, input) {
|
|
2300
2603
|
return asRecord(
|
|
2301
2604
|
await invokeWithRetry(this.config, this.http, "CustomContextItemsController_update", {
|
|
@@ -2304,6 +2607,12 @@ var CustomContextItemsResource = class {
|
|
|
2304
2607
|
})
|
|
2305
2608
|
);
|
|
2306
2609
|
}
|
|
2610
|
+
/**
|
|
2611
|
+
* Delete a custom context item.
|
|
2612
|
+
*
|
|
2613
|
+
* @param uid - Item uid.
|
|
2614
|
+
* @returns Deletion confirmation with uid and context type.
|
|
2615
|
+
*/
|
|
2307
2616
|
async delete(uid) {
|
|
2308
2617
|
return parseDeletion(
|
|
2309
2618
|
await invokeWithRetry(this.config, this.http, "CustomContextItemsController_delete", {
|
|
@@ -2331,10 +2640,19 @@ function parseLookupResponse(raw) {
|
|
|
2331
2640
|
return item;
|
|
2332
2641
|
}
|
|
2333
2642
|
var ContextItemsResource = class {
|
|
2643
|
+
/** @internal */
|
|
2334
2644
|
constructor(http, config) {
|
|
2335
2645
|
this.http = http;
|
|
2336
2646
|
this.config = config;
|
|
2337
2647
|
}
|
|
2648
|
+
/**
|
|
2649
|
+
* List knowledge-base items.
|
|
2650
|
+
*
|
|
2651
|
+
* @param options.pageSize - Maximum items per page (default 25).
|
|
2652
|
+
* @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.
|
|
2655
|
+
*/
|
|
2338
2656
|
list(options = {}) {
|
|
2339
2657
|
const pageSize = options.pageSize ?? 25;
|
|
2340
2658
|
validatePageSize(pageSize);
|
|
@@ -2353,12 +2671,27 @@ var ContextItemsResource = class {
|
|
|
2353
2671
|
(token) => this.listPage(pageSize, token, contextType)
|
|
2354
2672
|
);
|
|
2355
2673
|
}
|
|
2674
|
+
/**
|
|
2675
|
+
* Retrieve a knowledge-base item by uid.
|
|
2676
|
+
*
|
|
2677
|
+
* @param uid - Item uid.
|
|
2678
|
+
* @returns The context item.
|
|
2679
|
+
* @throws {NotFoundError} When no item matches the uid.
|
|
2680
|
+
*/
|
|
2356
2681
|
async get(uid) {
|
|
2357
2682
|
const data = await invokeWithRetry(this.config, this.http, "ContextItemsController_get", {
|
|
2358
2683
|
pathParams: { uid }
|
|
2359
2684
|
});
|
|
2360
2685
|
return parseContextItem2(data);
|
|
2361
2686
|
}
|
|
2687
|
+
/**
|
|
2688
|
+
* Look up a knowledge-base item by type and data path.
|
|
2689
|
+
*
|
|
2690
|
+
* @param options.contextType - Context type to match.
|
|
2691
|
+
* @param options.dataPath - Hierarchical path segments that identify the item.
|
|
2692
|
+
* @param options.contentProjection - Optional fields to include from item content.
|
|
2693
|
+
* @returns The matching row, or `undefined` when no item is found (404).
|
|
2694
|
+
*/
|
|
2362
2695
|
async lookup(options) {
|
|
2363
2696
|
const body = omitUndefined({
|
|
2364
2697
|
contextType: options.contextType,
|
|
@@ -2377,11 +2710,30 @@ var ContextItemsResource = class {
|
|
|
2377
2710
|
throw error;
|
|
2378
2711
|
}
|
|
2379
2712
|
}
|
|
2713
|
+
/**
|
|
2714
|
+
* List values stored under a content key on a context item.
|
|
2715
|
+
*
|
|
2716
|
+
* @param uid - Item uid.
|
|
2717
|
+
* @param contextType - Context type of the item.
|
|
2718
|
+
* @param contentKeyPath - Dot path to the value field inside item content.
|
|
2719
|
+
* @param options.pageSize - Maximum items per page (default 25).
|
|
2720
|
+
* @param options.pageToken - Opaque token from a previous page.
|
|
2721
|
+
* @returns A page of value rows.
|
|
2722
|
+
*/
|
|
2380
2723
|
listValues(uid, contextType, contentKeyPath, options = {}) {
|
|
2381
2724
|
const pageSize = options.pageSize ?? 25;
|
|
2382
2725
|
validatePageSize(pageSize, DEFAULT_MAX_PAGE_SIZE);
|
|
2383
2726
|
return this.listValuesPage(uid, contextType, contentKeyPath, pageSize, options.pageToken);
|
|
2384
2727
|
}
|
|
2728
|
+
/**
|
|
2729
|
+
* List values for a context item already loaded via {@link ContextItemsResource.list} or {@link ContextItemsResource.get}.
|
|
2730
|
+
*
|
|
2731
|
+
* @param item - Context item (uses `item.uid` and `item.contextType`).
|
|
2732
|
+
* @param contentKeyPath - Dot path to the value field inside item content.
|
|
2733
|
+
* @param options.pageSize - Maximum items per page (default 25).
|
|
2734
|
+
* @param options.pageToken - Opaque token from a previous page.
|
|
2735
|
+
* @returns A page of value rows.
|
|
2736
|
+
*/
|
|
2385
2737
|
listValuesFor(item, contentKeyPath, options = {}) {
|
|
2386
2738
|
return this.listValues(item.uid, item.contextType, contentKeyPath, options);
|
|
2387
2739
|
}
|
|
@@ -2406,6 +2758,7 @@ var ContextItemsResource = class {
|
|
|
2406
2758
|
|
|
2407
2759
|
// src/resources/context/context.ts
|
|
2408
2760
|
var ContextResource = class {
|
|
2761
|
+
/** @internal */
|
|
2409
2762
|
constructor(http, config) {
|
|
2410
2763
|
this.items = new ContextItemsResource(http, config);
|
|
2411
2764
|
this.customItems = new CustomContextItemsResource(http, config);
|
|
@@ -2413,7 +2766,7 @@ var ContextResource = class {
|
|
|
2413
2766
|
};
|
|
2414
2767
|
|
|
2415
2768
|
// src/resources/modus/conversations.ts
|
|
2416
|
-
var ALLOWED_KINDS = /* @__PURE__ */ new Set(["all", "modus", "
|
|
2769
|
+
var ALLOWED_KINDS = /* @__PURE__ */ new Set(["all", "modus", "scopes"]);
|
|
2417
2770
|
function listParams(pageSize, pageToken, kind) {
|
|
2418
2771
|
if (kind !== void 0 && !ALLOWED_KINDS.has(kind)) {
|
|
2419
2772
|
throw new Error(
|
|
@@ -2435,6 +2788,14 @@ var ModusConversationsResource = class {
|
|
|
2435
2788
|
this.http = http;
|
|
2436
2789
|
this.config = config;
|
|
2437
2790
|
}
|
|
2791
|
+
/**
|
|
2792
|
+
* List conversations.
|
|
2793
|
+
*
|
|
2794
|
+
* @param options.pageSize - Items per page (default 25).
|
|
2795
|
+
* @param options.pageToken - Opaque token from a previous page.
|
|
2796
|
+
* @param options.kind - `"modus"`, `"scopes"`, or `"all"`.
|
|
2797
|
+
* @returns Page of conversation list items.
|
|
2798
|
+
*/
|
|
2438
2799
|
list(options = {}) {
|
|
2439
2800
|
const pageSize = options.pageSize ?? 25;
|
|
2440
2801
|
validatePageSize(pageSize);
|
|
@@ -2453,6 +2814,12 @@ var ModusConversationsResource = class {
|
|
|
2453
2814
|
(token) => this.listPage(pageSize, token, kind)
|
|
2454
2815
|
);
|
|
2455
2816
|
}
|
|
2817
|
+
/**
|
|
2818
|
+
* Retrieve a conversation thread with full message history.
|
|
2819
|
+
*
|
|
2820
|
+
* @param threadId - Conversation thread id.
|
|
2821
|
+
* @returns Conversation with messages.
|
|
2822
|
+
*/
|
|
2456
2823
|
async get(threadId) {
|
|
2457
2824
|
validateId(threadId, "thread_id");
|
|
2458
2825
|
const data = await invokeWithRetry(this.config, this.http, "ModusConversationsController_get", {
|
|
@@ -2469,21 +2836,50 @@ var ModusResource = class {
|
|
|
2469
2836
|
this.config = config;
|
|
2470
2837
|
this.conversations = new ModusConversationsResource(http, config);
|
|
2471
2838
|
}
|
|
2839
|
+
/**
|
|
2840
|
+
* Return composed full-environment context for an intent, without running chat.
|
|
2841
|
+
*
|
|
2842
|
+
* @param message - User intent or question to compose context for.
|
|
2843
|
+
* @param options.limit - Optional cap on structured fallback items.
|
|
2844
|
+
* @returns Composed Modus context.
|
|
2845
|
+
*/
|
|
2472
2846
|
async getContext(message, options = {}) {
|
|
2473
2847
|
const data = await invokeWithRetry(this.config, this.http, "ModusContextController_compose", {
|
|
2474
2848
|
jsonBody: omitUndefined({ message, limit: options.limit })
|
|
2475
2849
|
});
|
|
2476
2850
|
return data;
|
|
2477
2851
|
}
|
|
2852
|
+
/**
|
|
2853
|
+
* Send a message to Modus (org-wide assistant) and get the complete reply.
|
|
2854
|
+
*
|
|
2855
|
+
* @param message - Message to send.
|
|
2856
|
+
* @param options.model - Required model id (e.g. `"claude-sonnet-5"`).
|
|
2857
|
+
* @param options.threadId - Continue an existing conversation.
|
|
2858
|
+
* @returns Chat result with content and threadId.
|
|
2859
|
+
*
|
|
2860
|
+
* @example
|
|
2861
|
+
* ```ts
|
|
2862
|
+
* const result = await client.modus.chat('What tables describe revenue?', { model: 'claude-sonnet-5' })
|
|
2863
|
+
* console.log(result.content, result.threadId)
|
|
2864
|
+
* ```
|
|
2865
|
+
*/
|
|
2478
2866
|
chat(message, options) {
|
|
2479
2867
|
return modusChatBuffered(this.http, message, options);
|
|
2480
2868
|
}
|
|
2869
|
+
/**
|
|
2870
|
+
* Stream a Modus reply token by token.
|
|
2871
|
+
*
|
|
2872
|
+
* @param message - Message to send.
|
|
2873
|
+
* @param options.model - Required model id (e.g. `"claude-sonnet-5"`).
|
|
2874
|
+
* @param options.threadId - Continue an existing conversation.
|
|
2875
|
+
* @returns Chat stream.
|
|
2876
|
+
*/
|
|
2481
2877
|
chatStream(message, options) {
|
|
2482
2878
|
return modusChatStreamSession(this.http, this.config, message, options);
|
|
2483
2879
|
}
|
|
2484
2880
|
};
|
|
2485
2881
|
|
|
2486
|
-
// src/resources/
|
|
2882
|
+
// src/resources/scopes/conversations.ts
|
|
2487
2883
|
function parseListItem2(raw) {
|
|
2488
2884
|
return raw;
|
|
2489
2885
|
}
|
|
@@ -2496,6 +2892,13 @@ var ScopeConversationsResource = class {
|
|
|
2496
2892
|
this.config = config;
|
|
2497
2893
|
this.scopeId = scopeId;
|
|
2498
2894
|
}
|
|
2895
|
+
/**
|
|
2896
|
+
* List conversation threads for this scope, newest first.
|
|
2897
|
+
*
|
|
2898
|
+
* @param options.pageSize - Items per page (default 25).
|
|
2899
|
+
* @param options.pageToken - Opaque token from a previous page.
|
|
2900
|
+
* @returns Page of conversation list items.
|
|
2901
|
+
*/
|
|
2499
2902
|
list(options = {}) {
|
|
2500
2903
|
const pageSize = options.pageSize ?? 25;
|
|
2501
2904
|
validatePageSize(pageSize);
|
|
@@ -2516,6 +2919,14 @@ var ScopeConversationsResource = class {
|
|
|
2516
2919
|
(token) => this.listPage(pageSize, token)
|
|
2517
2920
|
);
|
|
2518
2921
|
}
|
|
2922
|
+
/**
|
|
2923
|
+
* Retrieve a thread with full message history.
|
|
2924
|
+
*
|
|
2925
|
+
* @param threadId - Conversation thread id.
|
|
2926
|
+
* @param options.messageLimit - Maximum messages to return (1–100).
|
|
2927
|
+
* @param options.beforeMessageIndex - Return messages before this index (requires messageLimit).
|
|
2928
|
+
* @returns Conversation with messages.
|
|
2929
|
+
*/
|
|
2519
2930
|
async get(threadId, options = {}) {
|
|
2520
2931
|
validateId(this.scopeId, "scope_id");
|
|
2521
2932
|
validateId(threadId, "thread_id");
|
|
@@ -2533,7 +2944,7 @@ var ScopeConversationsResource = class {
|
|
|
2533
2944
|
}
|
|
2534
2945
|
};
|
|
2535
2946
|
|
|
2536
|
-
// src/resources/
|
|
2947
|
+
// src/resources/scopes.ts
|
|
2537
2948
|
function scopesListParams(pageSize, pageToken, search, view, managerId) {
|
|
2538
2949
|
const extra = {};
|
|
2539
2950
|
if (search !== void 0) extra.search = search;
|
|
@@ -2545,13 +2956,30 @@ function parseScope(raw) {
|
|
|
2545
2956
|
return raw;
|
|
2546
2957
|
}
|
|
2547
2958
|
var ScopesResource = class {
|
|
2959
|
+
/** @internal */
|
|
2548
2960
|
constructor(http, config) {
|
|
2549
2961
|
this.http = http;
|
|
2550
2962
|
this.config = config;
|
|
2551
2963
|
}
|
|
2964
|
+
/**
|
|
2965
|
+
* Return the conversations sub-resource scoped to `scopeId`.
|
|
2966
|
+
*
|
|
2967
|
+
* @param scopeId - Scope numeric id or slug.
|
|
2968
|
+
* @returns Conversations resource for the scope.
|
|
2969
|
+
*/
|
|
2552
2970
|
conversations(scopeId) {
|
|
2553
2971
|
return new ScopeConversationsResource(this.http, this.config, scopeId);
|
|
2554
2972
|
}
|
|
2973
|
+
/**
|
|
2974
|
+
* List scopes in the organisation.
|
|
2975
|
+
*
|
|
2976
|
+
* @param options.pageSize - Items per page (default 25).
|
|
2977
|
+
* @param options.pageToken - Opaque token from a previous page.
|
|
2978
|
+
* @param options.search - Case-insensitive substring filter on the scope name.
|
|
2979
|
+
* @param options.view - `"active"` (deployed) or `"draft"`.
|
|
2980
|
+
* @param options.managerId - Only scopes supervised by this manager scope id.
|
|
2981
|
+
* @returns Page of scopes.
|
|
2982
|
+
*/
|
|
2555
2983
|
list(options = {}) {
|
|
2556
2984
|
const pageSize = options.pageSize ?? 25;
|
|
2557
2985
|
validatePageSize(pageSize);
|
|
@@ -2571,11 +2999,19 @@ var ScopesResource = class {
|
|
|
2571
2999
|
);
|
|
2572
3000
|
return buildAipPage(
|
|
2573
3001
|
data,
|
|
2574
|
-
"
|
|
3002
|
+
"scopes",
|
|
2575
3003
|
parseScope,
|
|
2576
3004
|
(token) => this.listPage(pageSize, token, search, view, managerId)
|
|
2577
3005
|
);
|
|
2578
3006
|
}
|
|
3007
|
+
/**
|
|
3008
|
+
* Retrieve a scope by ID or slug.
|
|
3009
|
+
*
|
|
3010
|
+
* @param scopeId - Scope numeric id or slug.
|
|
3011
|
+
* @param options.view - `"active"` (deployed) or `"draft"`.
|
|
3012
|
+
* @throws {NotFoundError} When no scope matches the id or slug.
|
|
3013
|
+
* @returns Scope.
|
|
3014
|
+
*/
|
|
2579
3015
|
async get(scopeId, options = {}) {
|
|
2580
3016
|
validateId(scopeId, "scope_id");
|
|
2581
3017
|
const query = options.view !== void 0 ? { view: options.view } : void 0;
|
|
@@ -2585,6 +3021,14 @@ var ScopesResource = class {
|
|
|
2585
3021
|
});
|
|
2586
3022
|
return parseScope(data);
|
|
2587
3023
|
}
|
|
3024
|
+
/**
|
|
3025
|
+
* Return composed context Modus would use for a scope query, without running chat.
|
|
3026
|
+
*
|
|
3027
|
+
* @param scopeId - Scope numeric id or slug.
|
|
3028
|
+
* @param message - User intent or question to compose context for.
|
|
3029
|
+
* @param options.limit - Optional cap on structured fallback items.
|
|
3030
|
+
* @returns Composed scope context.
|
|
3031
|
+
*/
|
|
2588
3032
|
async getContext(scopeId, message, options = {}) {
|
|
2589
3033
|
validateId(scopeId, "scope_id");
|
|
2590
3034
|
const data = await invokeWithRetry(this.config, this.http, "ScopeContextController_compose", {
|
|
@@ -2593,32 +3037,39 @@ var ScopesResource = class {
|
|
|
2593
3037
|
});
|
|
2594
3038
|
return data;
|
|
2595
3039
|
}
|
|
3040
|
+
/**
|
|
3041
|
+
* Send a message to a scope and get the complete reply.
|
|
3042
|
+
*
|
|
3043
|
+
* @param scopeId - Scope numeric id or slug.
|
|
3044
|
+
* @param message - Message to send.
|
|
3045
|
+
* @param options.model - Required model id (e.g. `"claude-sonnet-5"`).
|
|
3046
|
+
* @param options.threadId - Continue an existing conversation.
|
|
3047
|
+
* @returns Chat result with content and threadId.
|
|
3048
|
+
*
|
|
3049
|
+
* @example
|
|
3050
|
+
* ```ts
|
|
3051
|
+
* const result = await client.scopes.chat(scopeId, 'Hello', { model: 'claude-sonnet-5' })
|
|
3052
|
+
* console.log(result.content, result.threadId)
|
|
3053
|
+
* ```
|
|
3054
|
+
*/
|
|
2596
3055
|
chat(scopeId, message, options) {
|
|
2597
3056
|
return chatBuffered(this.http, "scopes", scopeId, message, options);
|
|
2598
3057
|
}
|
|
3058
|
+
/**
|
|
3059
|
+
* Stream a scope reply token by token.
|
|
3060
|
+
*
|
|
3061
|
+
* @param scopeId - Scope numeric id or slug.
|
|
3062
|
+
* @param message - Message to send.
|
|
3063
|
+
* @param options.model - Required model id (e.g. `"claude-sonnet-5"`).
|
|
3064
|
+
* @param options.threadId - Continue an existing conversation.
|
|
3065
|
+
* @param options.version - `"published"` or `"draft"`.
|
|
3066
|
+
* @returns Chat stream.
|
|
3067
|
+
*/
|
|
2599
3068
|
chatStream(scopeId, message, options) {
|
|
2600
3069
|
return chatStreamSession(this.http, this.config, "scopes", scopeId, message, options);
|
|
2601
3070
|
}
|
|
2602
3071
|
};
|
|
2603
3072
|
|
|
2604
|
-
// src/types/suggestions.ts
|
|
2605
|
-
function normalizeRecordSuggestionEvent(event) {
|
|
2606
|
-
const eventType = event.event_type ?? event.eventType;
|
|
2607
|
-
if (eventType === void 0) {
|
|
2608
|
-
throw new Error("recordEvent requires event_type (or eventType)");
|
|
2609
|
-
}
|
|
2610
|
-
const body = {
|
|
2611
|
-
event_type: eventType,
|
|
2612
|
-
source: event.source
|
|
2613
|
-
};
|
|
2614
|
-
const skillId = event.skill_id ?? event.skillId;
|
|
2615
|
-
if (skillId !== void 0) body.skill_id = skillId;
|
|
2616
|
-
const threadId = event.thread_id ?? event.threadId;
|
|
2617
|
-
if (threadId !== void 0) body.thread_id = threadId;
|
|
2618
|
-
if (event.metadata !== void 0) body.metadata = event.metadata;
|
|
2619
|
-
return body;
|
|
2620
|
-
}
|
|
2621
|
-
|
|
2622
3073
|
// src/resources/suggestions.ts
|
|
2623
3074
|
var DEFAULT_SUGGESTIONS_PAGE_SIZE = 5;
|
|
2624
3075
|
var MAX_SUGGESTIONS_PAGE_SIZE = 12;
|
|
@@ -2629,38 +3080,54 @@ function suggestionListParams(options) {
|
|
|
2629
3080
|
return {
|
|
2630
3081
|
pageSize: options.pageSize,
|
|
2631
3082
|
pageToken: options.pageToken,
|
|
2632
|
-
|
|
2633
|
-
|
|
3083
|
+
scopeId: options.scopeId,
|
|
3084
|
+
scopeIds: options.scopeIds?.join(",")
|
|
2634
3085
|
};
|
|
2635
3086
|
}
|
|
2636
3087
|
var SuggestionsResource = class {
|
|
3088
|
+
/** @internal */
|
|
2637
3089
|
constructor(http, config) {
|
|
2638
3090
|
this.http = http;
|
|
2639
3091
|
this.config = config;
|
|
2640
3092
|
}
|
|
3093
|
+
/**
|
|
3094
|
+
* List approved suggested questions.
|
|
3095
|
+
*
|
|
3096
|
+
* @param options.pageSize - Maximum items per page (default 5, max 12).
|
|
3097
|
+
* @param options.pageToken - Opaque token from a previous page.
|
|
3098
|
+
* @param options.scopeId - Filter to a single scope.
|
|
3099
|
+
* @param options.scopeIds - Filter to one or more scopes.
|
|
3100
|
+
* @returns A page of suggested questions.
|
|
3101
|
+
*/
|
|
2641
3102
|
list(options = {}) {
|
|
2642
3103
|
const pageSize = options.pageSize ?? DEFAULT_SUGGESTIONS_PAGE_SIZE;
|
|
2643
3104
|
validatePageSize(pageSize, MAX_SUGGESTIONS_PAGE_SIZE);
|
|
2644
|
-
return this.listPage(pageSize, options.pageToken, options.
|
|
3105
|
+
return this.listPage(pageSize, options.pageToken, options.scopeId, options.scopeIds);
|
|
2645
3106
|
}
|
|
2646
|
-
async listPage(pageSize, pageToken,
|
|
3107
|
+
async listPage(pageSize, pageToken, scopeId, scopeIds) {
|
|
2647
3108
|
const data = asRecord(
|
|
2648
3109
|
await invokeWithRetry(this.config, this.http, "SuggestionsController_listApproved", {
|
|
2649
|
-
query: suggestionListParams({ pageSize, pageToken,
|
|
3110
|
+
query: suggestionListParams({ pageSize, pageToken, scopeId, scopeIds })
|
|
2650
3111
|
})
|
|
2651
3112
|
);
|
|
2652
3113
|
return buildAipPage(
|
|
2653
3114
|
data,
|
|
2654
3115
|
"suggestions",
|
|
2655
3116
|
parseSuggestion,
|
|
2656
|
-
(token) => this.listPage(pageSize, token,
|
|
3117
|
+
(token) => this.listPage(pageSize, token, scopeId, scopeIds)
|
|
2657
3118
|
);
|
|
2658
3119
|
}
|
|
3120
|
+
/**
|
|
3121
|
+
* Record that a suggested question was shown, clicked, dismissed, or submitted.
|
|
3122
|
+
*
|
|
3123
|
+
* @param id - Suggestion id.
|
|
3124
|
+
* @param event - Event details, including `eventType` (`shown`, `clicked`, `dismissed`, or `submitted`).
|
|
3125
|
+
*/
|
|
2659
3126
|
async recordEvent(id, event) {
|
|
2660
3127
|
validateId(id, "id");
|
|
2661
3128
|
await invokeWithRetry(this.config, this.http, "SuggestionsController_recordEvent", {
|
|
2662
3129
|
pathParams: { id },
|
|
2663
|
-
jsonBody:
|
|
3130
|
+
jsonBody: event
|
|
2664
3131
|
});
|
|
2665
3132
|
}
|
|
2666
3133
|
};
|
|
@@ -2696,6 +3163,8 @@ var Modus = class extends ModusClientBase {
|
|
|
2696
3163
|
StreamTimeoutError,
|
|
2697
3164
|
UnprocessableError,
|
|
2698
3165
|
ValidationError,
|
|
3166
|
+
WorkflowType,
|
|
3167
|
+
conversationScopeId,
|
|
2699
3168
|
conversationSkillId
|
|
2700
3169
|
});
|
|
2701
3170
|
//# sourceMappingURL=index.cjs.map
|