@getmodus/sdk 0.2.2 → 0.3.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 +58 -1
- package/dist/{chunk-OUFN2O5C.js → chunk-D3NU2M6B.js} +82 -37
- package/dist/chunk-D3NU2M6B.js.map +1 -0
- package/dist/{conversations-BP2sI3Q5.d.cts → conversations-GNBMPpyr.d.cts} +1242 -3878
- package/dist/{conversations-BP2sI3Q5.d.ts → conversations-GNBMPpyr.d.ts} +1242 -3878
- package/dist/index.cjs +117 -79
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +12 -25
- package/dist/index.d.ts +12 -25
- package/dist/index.js +35 -44
- package/dist/index.js.map +1 -1
- package/dist/management/index.cjs +102 -58
- package/dist/management/index.cjs.map +1 -1
- package/dist/management/index.d.cts +54 -40
- package/dist/management/index.d.ts +54 -40
- package/dist/management/index.js +22 -23
- package/dist/management/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-OUFN2O5C.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
|
},
|
|
@@ -699,10 +691,20 @@ var OPERATIONS = {
|
|
|
699
691
|
service: "modus-api",
|
|
700
692
|
serverUrl: "https://api.getmodus.com",
|
|
701
693
|
pathParams: [],
|
|
702
|
-
queryParams: ["since", "until", "rollup", "model", "group_by", "skill_id", "agent_id", "user_id", "interface"],
|
|
694
|
+
queryParams: ["since", "until", "rollup", "model", "group_by", "skill_id", "agent_id", "user_id", "interface", "user_email"],
|
|
703
695
|
requestSchema: null,
|
|
704
696
|
responseSchema: "ListUsageResponseDto"
|
|
705
697
|
},
|
|
698
|
+
"UsageController_listUsers": {
|
|
699
|
+
method: "GET",
|
|
700
|
+
path: "/api/v1/usage/users",
|
|
701
|
+
service: "modus-api",
|
|
702
|
+
serverUrl: "https://api.getmodus.com",
|
|
703
|
+
pathParams: [],
|
|
704
|
+
queryParams: ["since", "until"],
|
|
705
|
+
requestSchema: null,
|
|
706
|
+
responseSchema: "ListUsageUsersResponseDto"
|
|
707
|
+
},
|
|
706
708
|
"WorkflowActionsController_cancel": {
|
|
707
709
|
method: "POST",
|
|
708
710
|
path: "/agent/v1/workflow-actions/{runId}/cancel",
|
|
@@ -759,7 +761,7 @@ var OPERATIONS = {
|
|
|
759
761
|
service: "modus-api",
|
|
760
762
|
serverUrl: "https://api.getmodus.com",
|
|
761
763
|
pathParams: ["id"],
|
|
762
|
-
queryParams: [
|
|
764
|
+
queryParams: [],
|
|
763
765
|
requestSchema: null,
|
|
764
766
|
responseSchema: "ListAgentInterfacesResponseDto"
|
|
765
767
|
},
|
|
@@ -811,7 +813,7 @@ var OPERATIONS = {
|
|
|
811
813
|
pathParams: ["id"],
|
|
812
814
|
queryParams: [],
|
|
813
815
|
requestSchema: null,
|
|
814
|
-
responseSchema: "
|
|
816
|
+
responseSchema: "WorkflowDto"
|
|
815
817
|
},
|
|
816
818
|
"WorkflowsController_cancelOwnershipTransfer": {
|
|
817
819
|
method: "DELETE",
|
|
@@ -821,7 +823,7 @@ var OPERATIONS = {
|
|
|
821
823
|
pathParams: ["id"],
|
|
822
824
|
queryParams: [],
|
|
823
825
|
requestSchema: null,
|
|
824
|
-
responseSchema: "
|
|
826
|
+
responseSchema: "WorkflowDto"
|
|
825
827
|
},
|
|
826
828
|
"WorkflowsController_create": {
|
|
827
829
|
method: "POST",
|
|
@@ -831,7 +833,7 @@ var OPERATIONS = {
|
|
|
831
833
|
pathParams: [],
|
|
832
834
|
queryParams: [],
|
|
833
835
|
requestSchema: "CreateAgentDto",
|
|
834
|
-
responseSchema: "
|
|
836
|
+
responseSchema: "WorkflowDto"
|
|
835
837
|
},
|
|
836
838
|
"WorkflowsController_delete": {
|
|
837
839
|
method: "DELETE",
|
|
@@ -861,7 +863,7 @@ var OPERATIONS = {
|
|
|
861
863
|
pathParams: ["id"],
|
|
862
864
|
queryParams: ["view"],
|
|
863
865
|
requestSchema: null,
|
|
864
|
-
responseSchema: "
|
|
866
|
+
responseSchema: "WorkflowDto"
|
|
865
867
|
},
|
|
866
868
|
"WorkflowsController_list": {
|
|
867
869
|
method: "GET",
|
|
@@ -881,7 +883,7 @@ var OPERATIONS = {
|
|
|
881
883
|
pathParams: ["id"],
|
|
882
884
|
queryParams: [],
|
|
883
885
|
requestSchema: "TransferOwnershipDto",
|
|
884
|
-
responseSchema: "
|
|
886
|
+
responseSchema: "WorkflowDto"
|
|
885
887
|
},
|
|
886
888
|
"WorkflowsController_restore": {
|
|
887
889
|
method: "POST",
|
|
@@ -891,7 +893,7 @@ var OPERATIONS = {
|
|
|
891
893
|
pathParams: ["id"],
|
|
892
894
|
queryParams: [],
|
|
893
895
|
requestSchema: null,
|
|
894
|
-
responseSchema: "
|
|
896
|
+
responseSchema: "WorkflowDto"
|
|
895
897
|
},
|
|
896
898
|
"WorkflowsController_toggle": {
|
|
897
899
|
method: "POST",
|
|
@@ -901,7 +903,7 @@ var OPERATIONS = {
|
|
|
901
903
|
pathParams: ["id"],
|
|
902
904
|
queryParams: [],
|
|
903
905
|
requestSchema: "ToggleAgentDto",
|
|
904
|
-
responseSchema: "
|
|
906
|
+
responseSchema: "WorkflowDto"
|
|
905
907
|
},
|
|
906
908
|
"WorkflowsController_update": {
|
|
907
909
|
method: "PATCH",
|
|
@@ -911,7 +913,7 @@ var OPERATIONS = {
|
|
|
911
913
|
pathParams: ["id"],
|
|
912
914
|
queryParams: ["updateMask"],
|
|
913
915
|
requestSchema: "UpdateAgentDto",
|
|
914
|
-
responseSchema: "
|
|
916
|
+
responseSchema: "WorkflowDto"
|
|
915
917
|
}
|
|
916
918
|
};
|
|
917
919
|
|
|
@@ -997,8 +999,12 @@ var ValidationError = class extends ModusError {
|
|
|
997
999
|
}
|
|
998
1000
|
};
|
|
999
1001
|
|
|
1000
|
-
// src/
|
|
1002
|
+
// src/_agent_run_request.ts
|
|
1001
1003
|
var import_node_crypto = require("crypto");
|
|
1004
|
+
function resolveAgentRunSessionId(sessionId) {
|
|
1005
|
+
if (typeof sessionId === "string" && sessionId.trim()) return sessionId.trim();
|
|
1006
|
+
return (0, import_node_crypto.randomUUID)();
|
|
1007
|
+
}
|
|
1002
1008
|
|
|
1003
1009
|
// src/_streaming.ts
|
|
1004
1010
|
var SILENTLY_IGNORED = /* @__PURE__ */ new Set([
|
|
@@ -1117,7 +1123,7 @@ var WRITE_BODY_ALLOWED_KEYS = {
|
|
|
1117
1123
|
ScopesController_update: ["name", "description", "expectedOutput", "instructions", "toolset", "model", "connectionSet", "contextSelections", "interfaces", "accessConfig", "managerId", "evaluations", "supervisionSubordinateDescriptions"],
|
|
1118
1124
|
ScopeSupervisionController_set: ["subordinateAgentIds"],
|
|
1119
1125
|
ScopeSupervisionController_setActive: ["subordinateAgentIds"],
|
|
1120
|
-
SuggestionsController_recordEvent: ["
|
|
1126
|
+
SuggestionsController_recordEvent: ["eventType", "source", "skillId", "threadId", "metadata"],
|
|
1121
1127
|
WorkflowActionsController_cancel: [],
|
|
1122
1128
|
WorkflowActionsController_execute: ["organizationId", "sessionId", "fileThreadId", "workflowAction", "previousOutputs", "userTimezone", "runId", "automationId", "source"],
|
|
1123
1129
|
WorkflowInterfacesController_add: ["type", "name", "config"],
|
|
@@ -1198,7 +1204,7 @@ function effectiveThreadId(threadId) {
|
|
|
1198
1204
|
return threadId;
|
|
1199
1205
|
}
|
|
1200
1206
|
function resolveSessionId(threadId) {
|
|
1201
|
-
return effectiveThreadId(threadId)
|
|
1207
|
+
return resolveAgentRunSessionId(effectiveThreadId(threadId));
|
|
1202
1208
|
}
|
|
1203
1209
|
function chatPath(resource, resourceId, options) {
|
|
1204
1210
|
const safeId = encodeURIComponent(String(resourceId));
|
|
@@ -1403,15 +1409,19 @@ function buildAipPage(data, itemsKey, mapItem, fetchPage) {
|
|
|
1403
1409
|
return new Page(items, nextPageTokenFromResponse(data), fetchPage);
|
|
1404
1410
|
}
|
|
1405
1411
|
|
|
1406
|
-
// src/types/
|
|
1407
|
-
var
|
|
1412
|
+
// src/types/workflows.ts
|
|
1413
|
+
var WorkflowType = {
|
|
1408
1414
|
task: "task",
|
|
1409
1415
|
workflow: "workflow"
|
|
1410
1416
|
};
|
|
1417
|
+
var AgentType = WorkflowType;
|
|
1411
1418
|
|
|
1412
1419
|
// src/types/conversations.ts
|
|
1420
|
+
function conversationScopeId(item) {
|
|
1421
|
+
return item.scopeId === 0 ? void 0 : item.scopeId;
|
|
1422
|
+
}
|
|
1413
1423
|
function conversationSkillId(item) {
|
|
1414
|
-
return item.
|
|
1424
|
+
return item.scopeId;
|
|
1415
1425
|
}
|
|
1416
1426
|
|
|
1417
1427
|
// src/_auth.ts
|
|
@@ -1523,7 +1533,7 @@ function formatConfigForLog(config) {
|
|
|
1523
1533
|
}
|
|
1524
1534
|
|
|
1525
1535
|
// src/_http.ts
|
|
1526
|
-
var USER_AGENT = `modus-typescript/${"0.
|
|
1536
|
+
var USER_AGENT = `modus-typescript/${"0.3.0"} (node/${process.version}; ${process.platform})`;
|
|
1527
1537
|
function buildUrl(baseUrl, path, params) {
|
|
1528
1538
|
const url = new URL(path.startsWith("/") ? path : `/${path}`, baseUrl);
|
|
1529
1539
|
if (params) {
|
|
@@ -1618,6 +1628,26 @@ function wrapNetworkError(error, baseUrl) {
|
|
|
1618
1628
|
async function readBody(response) {
|
|
1619
1629
|
return response.text();
|
|
1620
1630
|
}
|
|
1631
|
+
async function readBodyPreview(response, maxChars = 200) {
|
|
1632
|
+
if (!response.body) return "";
|
|
1633
|
+
const reader = response.body.getReader();
|
|
1634
|
+
const decoder = new TextDecoder();
|
|
1635
|
+
let out = "";
|
|
1636
|
+
try {
|
|
1637
|
+
while (out.length < maxChars) {
|
|
1638
|
+
const { done, value } = await reader.read();
|
|
1639
|
+
if (done) break;
|
|
1640
|
+
out += decoder.decode(value, { stream: true });
|
|
1641
|
+
if (out.length >= maxChars) {
|
|
1642
|
+
out = out.slice(0, maxChars);
|
|
1643
|
+
break;
|
|
1644
|
+
}
|
|
1645
|
+
}
|
|
1646
|
+
} finally {
|
|
1647
|
+
await reader.cancel().catch(() => void 0);
|
|
1648
|
+
}
|
|
1649
|
+
return out;
|
|
1650
|
+
}
|
|
1621
1651
|
var HttpClient = class {
|
|
1622
1652
|
constructor(config) {
|
|
1623
1653
|
this.config = config;
|
|
@@ -1673,7 +1703,13 @@ var HttpClient = class {
|
|
|
1673
1703
|
try {
|
|
1674
1704
|
const response = await this.config.fetch(url, {
|
|
1675
1705
|
method,
|
|
1676
|
-
|
|
1706
|
+
// Agent-service negotiates SSE vs JSON polling on Accept; JSON-only
|
|
1707
|
+
// Accept returns {"runId","status":"pending"} instead of token SSE.
|
|
1708
|
+
headers: {
|
|
1709
|
+
...this.defaultHeaders(),
|
|
1710
|
+
...options.headers,
|
|
1711
|
+
Accept: "text/event-stream"
|
|
1712
|
+
},
|
|
1677
1713
|
body: options.json !== void 0 ? JSON.stringify(options.json) : void 0,
|
|
1678
1714
|
signal: AbortSignal.timeout(this.config.timeoutMs)
|
|
1679
1715
|
});
|
|
@@ -1682,6 +1718,14 @@ var HttpClient = class {
|
|
|
1682
1718
|
raiseForStatus(response, body);
|
|
1683
1719
|
return;
|
|
1684
1720
|
}
|
|
1721
|
+
const contentType = response.headers.get("content-type") ?? "";
|
|
1722
|
+
if (!contentType.toLowerCase().includes("text/event-stream")) {
|
|
1723
|
+
const preview = await readBodyPreview(response);
|
|
1724
|
+
throw new ModusError(
|
|
1725
|
+
`Unexpected stream response: expected Content-Type text/event-stream, got ${JSON.stringify(contentType) || "(missing)"}. Body preview: ${preview}`,
|
|
1726
|
+
{ statusCode: response.status, body: preview }
|
|
1727
|
+
);
|
|
1728
|
+
}
|
|
1685
1729
|
if (!response.body) return;
|
|
1686
1730
|
const reader = response.body.getReader();
|
|
1687
1731
|
const decoder = new TextDecoder();
|
|
@@ -1837,7 +1881,7 @@ function asRecord(data) {
|
|
|
1837
1881
|
throw new Error(`Expected object response, got ${typeof data}`);
|
|
1838
1882
|
}
|
|
1839
1883
|
|
|
1840
|
-
// src/resources/
|
|
1884
|
+
// src/resources/workflows/runs.ts
|
|
1841
1885
|
var import_node_crypto2 = require("crypto");
|
|
1842
1886
|
var RUNS_MAX_PAGE_SIZE = 100;
|
|
1843
1887
|
function runsListParams(pageSize, pageToken, status, timeframe, approvalScope, search) {
|
|
@@ -1888,6 +1932,9 @@ function parseActiveRunsPage(raw, fetchPage) {
|
|
|
1888
1932
|
function randomRunId() {
|
|
1889
1933
|
return (0, import_node_crypto2.randomUUID)();
|
|
1890
1934
|
}
|
|
1935
|
+
function sessionIdFromBody(body) {
|
|
1936
|
+
return resolveAgentRunSessionId(body.sessionId);
|
|
1937
|
+
}
|
|
1891
1938
|
function makeAgentRunStream(runId, events) {
|
|
1892
1939
|
return {
|
|
1893
1940
|
runId,
|
|
@@ -2024,10 +2071,12 @@ var WorkflowRunsResource = class {
|
|
|
2024
2071
|
}
|
|
2025
2072
|
createRun(operationId, body, pathParams, options) {
|
|
2026
2073
|
const runId = options.idempotencyKey?.trim() || body.runId?.trim() || randomRunId();
|
|
2074
|
+
const sessionId = sessionIdFromBody(body);
|
|
2027
2075
|
const op = getOperation(operationId);
|
|
2028
2076
|
const path = formatOperationPath(operationId, pathParams);
|
|
2029
2077
|
const lines = this.http.streamPost(path, {
|
|
2030
2078
|
...body,
|
|
2079
|
+
sessionId,
|
|
2031
2080
|
streamProtocolVersion: 2
|
|
2032
2081
|
}, {
|
|
2033
2082
|
baseUrl: operationBaseUrl(this.http, op),
|
|
@@ -2040,7 +2089,7 @@ var WorkflowRunsResource = class {
|
|
|
2040
2089
|
}
|
|
2041
2090
|
};
|
|
2042
2091
|
|
|
2043
|
-
// src/resources/
|
|
2092
|
+
// src/resources/workflows/workflow-actions.ts
|
|
2044
2093
|
var import_node_crypto3 = require("crypto");
|
|
2045
2094
|
function randomRunId2() {
|
|
2046
2095
|
return (0, import_node_crypto3.randomUUID)();
|
|
@@ -2072,7 +2121,7 @@ var AgentWorkflowActionsResource = class {
|
|
|
2072
2121
|
}
|
|
2073
2122
|
};
|
|
2074
2123
|
|
|
2075
|
-
// src/resources/
|
|
2124
|
+
// src/resources/workflows.ts
|
|
2076
2125
|
function workflowsListParams(pageSize, pageToken, search, type, view, includeVariation) {
|
|
2077
2126
|
const extra = {};
|
|
2078
2127
|
if (search !== void 0) extra.search = search;
|
|
@@ -2118,7 +2167,7 @@ var WorkflowsResource = class {
|
|
|
2118
2167
|
);
|
|
2119
2168
|
return buildAipPage(
|
|
2120
2169
|
data,
|
|
2121
|
-
"
|
|
2170
|
+
"workflows",
|
|
2122
2171
|
parseWorkflow,
|
|
2123
2172
|
(token) => this.listPage(pageSize, token, search, type, view, includeVariation)
|
|
2124
2173
|
);
|
|
@@ -2136,12 +2185,6 @@ var WorkflowsResource = class {
|
|
|
2136
2185
|
});
|
|
2137
2186
|
return parseWorkflow(data);
|
|
2138
2187
|
}
|
|
2139
|
-
chat(workflowId, message, options) {
|
|
2140
|
-
return chatBuffered(this.http, "workflows", workflowId, message, options);
|
|
2141
|
-
}
|
|
2142
|
-
chatStream(workflowId, message, options) {
|
|
2143
|
-
return chatStreamSession(this.http, this.config, "workflows", workflowId, message, options);
|
|
2144
|
-
}
|
|
2145
2188
|
};
|
|
2146
2189
|
|
|
2147
2190
|
// src/resources/connections.ts
|
|
@@ -2197,7 +2240,18 @@ function parseContextItem(raw) {
|
|
|
2197
2240
|
return raw;
|
|
2198
2241
|
}
|
|
2199
2242
|
function parseCreatedCustomContextItem(raw) {
|
|
2200
|
-
|
|
2243
|
+
const data = asRecord(raw);
|
|
2244
|
+
const contextItemId = data.contextItemId;
|
|
2245
|
+
if (typeof contextItemId !== "string" || !contextItemId) {
|
|
2246
|
+
throw new ValidationError(
|
|
2247
|
+
"Custom context create response missing non-empty string contextItemId"
|
|
2248
|
+
);
|
|
2249
|
+
}
|
|
2250
|
+
return {
|
|
2251
|
+
...data,
|
|
2252
|
+
contextItemId,
|
|
2253
|
+
uid: contextItemId
|
|
2254
|
+
};
|
|
2201
2255
|
}
|
|
2202
2256
|
function parseDeletion(raw) {
|
|
2203
2257
|
return raw;
|
|
@@ -2370,7 +2424,7 @@ var ContextResource = class {
|
|
|
2370
2424
|
};
|
|
2371
2425
|
|
|
2372
2426
|
// src/resources/modus/conversations.ts
|
|
2373
|
-
var ALLOWED_KINDS = /* @__PURE__ */ new Set(["all", "modus", "
|
|
2427
|
+
var ALLOWED_KINDS = /* @__PURE__ */ new Set(["all", "modus", "scopes"]);
|
|
2374
2428
|
function listParams(pageSize, pageToken, kind) {
|
|
2375
2429
|
if (kind !== void 0 && !ALLOWED_KINDS.has(kind)) {
|
|
2376
2430
|
throw new Error(
|
|
@@ -2440,7 +2494,7 @@ var ModusResource = class {
|
|
|
2440
2494
|
}
|
|
2441
2495
|
};
|
|
2442
2496
|
|
|
2443
|
-
// src/resources/
|
|
2497
|
+
// src/resources/scopes/conversations.ts
|
|
2444
2498
|
function parseListItem2(raw) {
|
|
2445
2499
|
return raw;
|
|
2446
2500
|
}
|
|
@@ -2490,7 +2544,7 @@ var ScopeConversationsResource = class {
|
|
|
2490
2544
|
}
|
|
2491
2545
|
};
|
|
2492
2546
|
|
|
2493
|
-
// src/resources/
|
|
2547
|
+
// src/resources/scopes.ts
|
|
2494
2548
|
function scopesListParams(pageSize, pageToken, search, view, managerId) {
|
|
2495
2549
|
const extra = {};
|
|
2496
2550
|
if (search !== void 0) extra.search = search;
|
|
@@ -2528,7 +2582,7 @@ var ScopesResource = class {
|
|
|
2528
2582
|
);
|
|
2529
2583
|
return buildAipPage(
|
|
2530
2584
|
data,
|
|
2531
|
-
"
|
|
2585
|
+
"scopes",
|
|
2532
2586
|
parseScope,
|
|
2533
2587
|
(token) => this.listPage(pageSize, token, search, view, managerId)
|
|
2534
2588
|
);
|
|
@@ -2558,24 +2612,6 @@ var ScopesResource = class {
|
|
|
2558
2612
|
}
|
|
2559
2613
|
};
|
|
2560
2614
|
|
|
2561
|
-
// src/types/suggestions.ts
|
|
2562
|
-
function normalizeRecordSuggestionEvent(event) {
|
|
2563
|
-
const eventType = event.event_type ?? event.eventType;
|
|
2564
|
-
if (eventType === void 0) {
|
|
2565
|
-
throw new Error("recordEvent requires event_type (or eventType)");
|
|
2566
|
-
}
|
|
2567
|
-
const body = {
|
|
2568
|
-
event_type: eventType,
|
|
2569
|
-
source: event.source
|
|
2570
|
-
};
|
|
2571
|
-
const skillId = event.skill_id ?? event.skillId;
|
|
2572
|
-
if (skillId !== void 0) body.skill_id = skillId;
|
|
2573
|
-
const threadId = event.thread_id ?? event.threadId;
|
|
2574
|
-
if (threadId !== void 0) body.thread_id = threadId;
|
|
2575
|
-
if (event.metadata !== void 0) body.metadata = event.metadata;
|
|
2576
|
-
return body;
|
|
2577
|
-
}
|
|
2578
|
-
|
|
2579
2615
|
// src/resources/suggestions.ts
|
|
2580
2616
|
var DEFAULT_SUGGESTIONS_PAGE_SIZE = 5;
|
|
2581
2617
|
var MAX_SUGGESTIONS_PAGE_SIZE = 12;
|
|
@@ -2586,8 +2622,8 @@ function suggestionListParams(options) {
|
|
|
2586
2622
|
return {
|
|
2587
2623
|
pageSize: options.pageSize,
|
|
2588
2624
|
pageToken: options.pageToken,
|
|
2589
|
-
|
|
2590
|
-
|
|
2625
|
+
scopeId: options.scopeId,
|
|
2626
|
+
scopeIds: options.scopeIds?.join(",")
|
|
2591
2627
|
};
|
|
2592
2628
|
}
|
|
2593
2629
|
var SuggestionsResource = class {
|
|
@@ -2598,26 +2634,26 @@ var SuggestionsResource = class {
|
|
|
2598
2634
|
list(options = {}) {
|
|
2599
2635
|
const pageSize = options.pageSize ?? DEFAULT_SUGGESTIONS_PAGE_SIZE;
|
|
2600
2636
|
validatePageSize(pageSize, MAX_SUGGESTIONS_PAGE_SIZE);
|
|
2601
|
-
return this.listPage(pageSize, options.pageToken, options.
|
|
2637
|
+
return this.listPage(pageSize, options.pageToken, options.scopeId, options.scopeIds);
|
|
2602
2638
|
}
|
|
2603
|
-
async listPage(pageSize, pageToken,
|
|
2639
|
+
async listPage(pageSize, pageToken, scopeId, scopeIds) {
|
|
2604
2640
|
const data = asRecord(
|
|
2605
2641
|
await invokeWithRetry(this.config, this.http, "SuggestionsController_listApproved", {
|
|
2606
|
-
query: suggestionListParams({ pageSize, pageToken,
|
|
2642
|
+
query: suggestionListParams({ pageSize, pageToken, scopeId, scopeIds })
|
|
2607
2643
|
})
|
|
2608
2644
|
);
|
|
2609
2645
|
return buildAipPage(
|
|
2610
2646
|
data,
|
|
2611
2647
|
"suggestions",
|
|
2612
2648
|
parseSuggestion,
|
|
2613
|
-
(token) => this.listPage(pageSize, token,
|
|
2649
|
+
(token) => this.listPage(pageSize, token, scopeId, scopeIds)
|
|
2614
2650
|
);
|
|
2615
2651
|
}
|
|
2616
2652
|
async recordEvent(id, event) {
|
|
2617
2653
|
validateId(id, "id");
|
|
2618
2654
|
await invokeWithRetry(this.config, this.http, "SuggestionsController_recordEvent", {
|
|
2619
2655
|
pathParams: { id },
|
|
2620
|
-
jsonBody:
|
|
2656
|
+
jsonBody: event
|
|
2621
2657
|
});
|
|
2622
2658
|
}
|
|
2623
2659
|
};
|
|
@@ -2653,6 +2689,8 @@ var Modus = class extends ModusClientBase {
|
|
|
2653
2689
|
StreamTimeoutError,
|
|
2654
2690
|
UnprocessableError,
|
|
2655
2691
|
ValidationError,
|
|
2692
|
+
WorkflowType,
|
|
2693
|
+
conversationScopeId,
|
|
2656
2694
|
conversationSkillId
|
|
2657
2695
|
});
|
|
2658
2696
|
//# sourceMappingURL=index.cjs.map
|