@getmodus/sdk 0.2.3 → 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.
@@ -203,7 +203,7 @@ function formatConfigForLog(config) {
203
203
  }
204
204
 
205
205
  // src/_http.ts
206
- var USER_AGENT = `modus-typescript/${"0.2.3"} (node/${process.version}; ${process.platform})`;
206
+ var USER_AGENT = `modus-typescript/${"0.3.0"} (node/${process.version}; ${process.platform})`;
207
207
  function buildUrl(baseUrl, path, params) {
208
208
  const url = new URL(path.startsWith("/") ? path : `/${path}`, baseUrl);
209
209
  if (params) {
@@ -737,7 +737,7 @@ var OPERATIONS = {
737
737
  service: "modus-api",
738
738
  serverUrl: "https://api.getmodus.com",
739
739
  pathParams: [],
740
- queryParams: ["pageSize", "pageToken"],
740
+ queryParams: [],
741
741
  requestSchema: null,
742
742
  responseSchema: "ListMemberGroupsResponseDto"
743
743
  },
@@ -807,19 +807,9 @@ var OPERATIONS = {
807
807
  service: "modus-api",
808
808
  serverUrl: "https://api.getmodus.com",
809
809
  pathParams: [],
810
- queryParams: ["pageSize", "pageToken"],
811
- requestSchema: null,
812
- responseSchema: "ListOrgMembersResponseDto"
813
- },
814
- "OrganizationController_deleteOrganization": {
815
- method: "DELETE",
816
- path: "/api/v1/users/organization",
817
- service: "modus-api",
818
- serverUrl: "https://api.getmodus.com",
819
- pathParams: [],
820
810
  queryParams: [],
821
811
  requestSchema: null,
822
- responseSchema: null
812
+ responseSchema: "ListOrgMembersResponseDto"
823
813
  },
824
814
  "ResumeRunsController_create": {
825
815
  method: "POST",
@@ -1039,7 +1029,7 @@ var OPERATIONS = {
1039
1029
  pathParams: ["id"],
1040
1030
  queryParams: [],
1041
1031
  requestSchema: null,
1042
- responseSchema: "SkillDto"
1032
+ responseSchema: "ScopeDto"
1043
1033
  },
1044
1034
  "ScopesController_cancelOwnershipTransfer": {
1045
1035
  method: "DELETE",
@@ -1049,7 +1039,7 @@ var OPERATIONS = {
1049
1039
  pathParams: ["id"],
1050
1040
  queryParams: [],
1051
1041
  requestSchema: null,
1052
- responseSchema: "SkillDto"
1042
+ responseSchema: "ScopeDto"
1053
1043
  },
1054
1044
  "ScopesController_create": {
1055
1045
  method: "POST",
@@ -1059,7 +1049,7 @@ var OPERATIONS = {
1059
1049
  pathParams: [],
1060
1050
  queryParams: [],
1061
1051
  requestSchema: "CreateSkillDto",
1062
- responseSchema: "SkillDto"
1052
+ responseSchema: "ScopeDto"
1063
1053
  },
1064
1054
  "ScopesController_delete": {
1065
1055
  method: "DELETE",
@@ -1089,7 +1079,7 @@ var OPERATIONS = {
1089
1079
  pathParams: ["id"],
1090
1080
  queryParams: ["view"],
1091
1081
  requestSchema: null,
1092
- responseSchema: "SkillDto"
1082
+ responseSchema: "ScopeDto"
1093
1083
  },
1094
1084
  "ScopesController_getVariation": {
1095
1085
  method: "GET",
@@ -1099,7 +1089,7 @@ var OPERATIONS = {
1099
1089
  pathParams: ["id", "variationUid"],
1100
1090
  queryParams: [],
1101
1091
  requestSchema: null,
1102
- responseSchema: "SkillDto"
1092
+ responseSchema: "ScopeDto"
1103
1093
  },
1104
1094
  "ScopesController_list": {
1105
1095
  method: "GET",
@@ -1129,7 +1119,7 @@ var OPERATIONS = {
1129
1119
  pathParams: ["id"],
1130
1120
  queryParams: [],
1131
1121
  requestSchema: "TransferOwnershipDto",
1132
- responseSchema: "SkillDto"
1122
+ responseSchema: "ScopeDto"
1133
1123
  },
1134
1124
  "ScopesController_restore": {
1135
1125
  method: "POST",
@@ -1139,7 +1129,7 @@ var OPERATIONS = {
1139
1129
  pathParams: ["id"],
1140
1130
  queryParams: [],
1141
1131
  requestSchema: null,
1142
- responseSchema: "SkillDto"
1132
+ responseSchema: "ScopeDto"
1143
1133
  },
1144
1134
  "ScopesController_update": {
1145
1135
  method: "PATCH",
@@ -1149,7 +1139,7 @@ var OPERATIONS = {
1149
1139
  pathParams: ["id"],
1150
1140
  queryParams: ["updateMask"],
1151
1141
  requestSchema: "UpdateSkillDto",
1152
- responseSchema: "SkillDto"
1142
+ responseSchema: "ScopeDto"
1153
1143
  },
1154
1144
  "SuggestionsController_listApproved": {
1155
1145
  method: "GET",
@@ -1157,7 +1147,7 @@ var OPERATIONS = {
1157
1147
  service: "modus-api",
1158
1148
  serverUrl: "https://api.getmodus.com",
1159
1149
  pathParams: [],
1160
- queryParams: ["pageToken", "pageSize", "skill_id", "skill_ids"],
1150
+ queryParams: ["pageToken", "pageSize", "scopeId", "scopeIds"],
1161
1151
  requestSchema: null,
1162
1152
  responseSchema: "ListSuggestionQuestionsResponseDto"
1163
1153
  },
@@ -1177,10 +1167,20 @@ var OPERATIONS = {
1177
1167
  service: "modus-api",
1178
1168
  serverUrl: "https://api.getmodus.com",
1179
1169
  pathParams: [],
1180
- queryParams: ["since", "until", "rollup", "model", "group_by", "skill_id", "agent_id", "user_id", "interface"],
1170
+ queryParams: ["since", "until", "rollup", "model", "group_by", "skill_id", "agent_id", "user_id", "interface", "user_email"],
1181
1171
  requestSchema: null,
1182
1172
  responseSchema: "ListUsageResponseDto"
1183
1173
  },
1174
+ "UsageController_listUsers": {
1175
+ method: "GET",
1176
+ path: "/api/v1/usage/users",
1177
+ service: "modus-api",
1178
+ serverUrl: "https://api.getmodus.com",
1179
+ pathParams: [],
1180
+ queryParams: ["since", "until"],
1181
+ requestSchema: null,
1182
+ responseSchema: "ListUsageUsersResponseDto"
1183
+ },
1184
1184
  "WorkflowActionsController_cancel": {
1185
1185
  method: "POST",
1186
1186
  path: "/agent/v1/workflow-actions/{runId}/cancel",
@@ -1237,7 +1237,7 @@ var OPERATIONS = {
1237
1237
  service: "modus-api",
1238
1238
  serverUrl: "https://api.getmodus.com",
1239
1239
  pathParams: ["id"],
1240
- queryParams: ["pageSize", "pageToken"],
1240
+ queryParams: [],
1241
1241
  requestSchema: null,
1242
1242
  responseSchema: "ListAgentInterfacesResponseDto"
1243
1243
  },
@@ -1289,7 +1289,7 @@ var OPERATIONS = {
1289
1289
  pathParams: ["id"],
1290
1290
  queryParams: [],
1291
1291
  requestSchema: null,
1292
- responseSchema: "AgentDto"
1292
+ responseSchema: "WorkflowDto"
1293
1293
  },
1294
1294
  "WorkflowsController_cancelOwnershipTransfer": {
1295
1295
  method: "DELETE",
@@ -1299,7 +1299,7 @@ var OPERATIONS = {
1299
1299
  pathParams: ["id"],
1300
1300
  queryParams: [],
1301
1301
  requestSchema: null,
1302
- responseSchema: "AgentDto"
1302
+ responseSchema: "WorkflowDto"
1303
1303
  },
1304
1304
  "WorkflowsController_create": {
1305
1305
  method: "POST",
@@ -1309,7 +1309,7 @@ var OPERATIONS = {
1309
1309
  pathParams: [],
1310
1310
  queryParams: [],
1311
1311
  requestSchema: "CreateAgentDto",
1312
- responseSchema: "AgentDto"
1312
+ responseSchema: "WorkflowDto"
1313
1313
  },
1314
1314
  "WorkflowsController_delete": {
1315
1315
  method: "DELETE",
@@ -1339,7 +1339,7 @@ var OPERATIONS = {
1339
1339
  pathParams: ["id"],
1340
1340
  queryParams: ["view"],
1341
1341
  requestSchema: null,
1342
- responseSchema: "AgentDto"
1342
+ responseSchema: "WorkflowDto"
1343
1343
  },
1344
1344
  "WorkflowsController_list": {
1345
1345
  method: "GET",
@@ -1359,7 +1359,7 @@ var OPERATIONS = {
1359
1359
  pathParams: ["id"],
1360
1360
  queryParams: [],
1361
1361
  requestSchema: "TransferOwnershipDto",
1362
- responseSchema: "AgentDto"
1362
+ responseSchema: "WorkflowDto"
1363
1363
  },
1364
1364
  "WorkflowsController_restore": {
1365
1365
  method: "POST",
@@ -1369,7 +1369,7 @@ var OPERATIONS = {
1369
1369
  pathParams: ["id"],
1370
1370
  queryParams: [],
1371
1371
  requestSchema: null,
1372
- responseSchema: "AgentDto"
1372
+ responseSchema: "WorkflowDto"
1373
1373
  },
1374
1374
  "WorkflowsController_toggle": {
1375
1375
  method: "POST",
@@ -1379,7 +1379,7 @@ var OPERATIONS = {
1379
1379
  pathParams: ["id"],
1380
1380
  queryParams: [],
1381
1381
  requestSchema: "ToggleAgentDto",
1382
- responseSchema: "AgentDto"
1382
+ responseSchema: "WorkflowDto"
1383
1383
  },
1384
1384
  "WorkflowsController_update": {
1385
1385
  method: "PATCH",
@@ -1389,7 +1389,7 @@ var OPERATIONS = {
1389
1389
  pathParams: ["id"],
1390
1390
  queryParams: ["updateMask"],
1391
1391
  requestSchema: "UpdateAgentDto",
1392
- responseSchema: "AgentDto"
1392
+ responseSchema: "WorkflowDto"
1393
1393
  }
1394
1394
  };
1395
1395
 
@@ -1508,7 +1508,7 @@ var WRITE_BODY_ALLOWED_KEYS = {
1508
1508
  ScopesController_update: ["name", "description", "expectedOutput", "instructions", "toolset", "model", "connectionSet", "contextSelections", "interfaces", "accessConfig", "managerId", "evaluations", "supervisionSubordinateDescriptions"],
1509
1509
  ScopeSupervisionController_set: ["subordinateAgentIds"],
1510
1510
  ScopeSupervisionController_setActive: ["subordinateAgentIds"],
1511
- SuggestionsController_recordEvent: ["event_type", "source", "skill_id", "thread_id", "metadata"],
1511
+ SuggestionsController_recordEvent: ["eventType", "source", "skillId", "threadId", "metadata"],
1512
1512
  WorkflowActionsController_cancel: [],
1513
1513
  WorkflowActionsController_execute: ["organizationId", "sessionId", "fileThreadId", "workflowAction", "previousOutputs", "userTimezone", "runId", "automationId", "source"],
1514
1514
  WorkflowInterfacesController_add: ["type", "name", "config"],
@@ -1607,7 +1607,7 @@ async function accessConfigBodyForUpdate(guardrails, loadResource) {
1607
1607
  return accessConfigWireForUpdate(existing, guardrails);
1608
1608
  }
1609
1609
 
1610
- // src/management/agents/interfaces.ts
1610
+ // src/management/workflows/interfaces.ts
1611
1611
  var WorkflowInterfacesResource = class {
1612
1612
  constructor(http, config, workflowId) {
1613
1613
  this.http = http;
@@ -1652,7 +1652,7 @@ var WorkflowInterfacesResource = class {
1652
1652
  }
1653
1653
  };
1654
1654
 
1655
- // src/management/agents/agents.ts
1655
+ // src/management/workflows/agents.ts
1656
1656
  var MANAGEMENT_WORKFLOW_OPERATIONS = {
1657
1657
  list: "WorkflowsController_list",
1658
1658
  get: "WorkflowsController_get",
@@ -1703,7 +1703,7 @@ var ManagementWorkflowsResource = class {
1703
1703
  );
1704
1704
  return buildAipPage(
1705
1705
  data,
1706
- "agents",
1706
+ "workflows",
1707
1707
  parseWorkflow,
1708
1708
  (token) => this.listPage(pageSize, token, search, type, view, includeVariation)
1709
1709
  );
@@ -1770,7 +1770,7 @@ var ManagementWorkflowsResource = class {
1770
1770
  jsonBody: {}
1771
1771
  })
1772
1772
  );
1773
- return parseWorkflow(data.agent);
1773
+ return parseWorkflow(data.workflow);
1774
1774
  }
1775
1775
  async toggle(workflowId, options) {
1776
1776
  validateId(workflowId, "workflow_id");
@@ -1839,7 +1839,18 @@ function parseContextItem(raw) {
1839
1839
  return raw;
1840
1840
  }
1841
1841
  function parseCreatedCustomContextItem(raw) {
1842
- return raw;
1842
+ const data = asRecord(raw);
1843
+ const contextItemId = data.contextItemId;
1844
+ if (typeof contextItemId !== "string" || !contextItemId) {
1845
+ throw new ValidationError(
1846
+ "Custom context create response missing non-empty string contextItemId"
1847
+ );
1848
+ }
1849
+ return {
1850
+ ...data,
1851
+ contextItemId,
1852
+ uid: contextItemId
1853
+ };
1843
1854
  }
1844
1855
  function parseDeletion(raw) {
1845
1856
  return raw;
@@ -2113,18 +2124,7 @@ var ManagementContextResource = class {
2113
2124
  }
2114
2125
  };
2115
2126
 
2116
- // src/management/organization.ts
2117
- var ManagementOrganizationResource = class {
2118
- constructor(http, config) {
2119
- this.http = http;
2120
- this.config = config;
2121
- }
2122
- async delete() {
2123
- await invokeWithRetry(this.config, this.http, "OrganizationController_deleteOrganization");
2124
- }
2125
- };
2126
-
2127
- // src/resources/skills/conversations.ts
2127
+ // src/resources/scopes/conversations.ts
2128
2128
  function parseListItem(raw) {
2129
2129
  return raw;
2130
2130
  }
@@ -2174,7 +2174,7 @@ var ScopeConversationsResource = class {
2174
2174
  }
2175
2175
  };
2176
2176
 
2177
- // src/management/skills/memories.ts
2177
+ // src/management/scopes/memories.ts
2178
2178
  function parseMemory(raw) {
2179
2179
  return raw;
2180
2180
  }
@@ -2233,7 +2233,7 @@ var ScopeMemoriesResource = class {
2233
2233
  }
2234
2234
  };
2235
2235
 
2236
- // src/management/skills/evaluations.ts
2236
+ // src/management/scopes/evaluations.ts
2237
2237
  function parseConfig(raw) {
2238
2238
  return raw;
2239
2239
  }
@@ -2293,7 +2293,7 @@ var ScopeEvaluationsResource = class {
2293
2293
  }
2294
2294
  };
2295
2295
 
2296
- // src/management/skills/supervision.ts
2296
+ // src/management/scopes/supervision.ts
2297
2297
  var ScopeSupervisionResource = class {
2298
2298
  constructor(http, config, scopeId) {
2299
2299
  this.http = http;
@@ -2322,7 +2322,7 @@ var ScopeSupervisionResource = class {
2322
2322
  }
2323
2323
  };
2324
2324
 
2325
- // src/management/skills/skills.ts
2325
+ // src/management/scopes/skills.ts
2326
2326
  var MANAGEMENT_SCOPE_OPERATIONS = {
2327
2327
  list: "ScopesController_list",
2328
2328
  get: "ScopesController_get",
@@ -2384,7 +2384,7 @@ var ManagementScopesResource = class {
2384
2384
  );
2385
2385
  return buildAipPage(
2386
2386
  data,
2387
- "skills",
2387
+ "scopes",
2388
2388
  parseScope,
2389
2389
  (token) => this.listPage(pageSize, token, search, view, managerId)
2390
2390
  );
@@ -2457,7 +2457,7 @@ var ManagementScopesResource = class {
2457
2457
  jsonBody: {}
2458
2458
  })
2459
2459
  );
2460
- return parseScope(data.skill);
2460
+ return parseScope(data.scope);
2461
2461
  }
2462
2462
  async delete(scopeId) {
2463
2463
  validateId(scopeId, "scope_id");
@@ -2536,9 +2536,20 @@ var ManagementUsageResource = class {
2536
2536
  rollup: options.rollup
2537
2537
  };
2538
2538
  if (options.model !== void 0) query.model = options.model;
2539
+ if (options.userEmail !== void 0) query.user_email = [...options.userEmail];
2539
2540
  const data = await invokeWithRetry(this.config, this.http, "UsageController_list", { query });
2540
2541
  return data;
2541
2542
  }
2543
+ async listUsers(options) {
2544
+ const query = {
2545
+ since: options.since,
2546
+ until: options.until
2547
+ };
2548
+ const data = await invokeWithRetry(this.config, this.http, "UsageController_listUsers", {
2549
+ query
2550
+ });
2551
+ return data;
2552
+ }
2542
2553
  };
2543
2554
 
2544
2555
  // src/management/users.ts
@@ -2573,7 +2584,6 @@ var ModusManagement = class extends ModusClientBase {
2573
2584
  this.workflows = new ManagementWorkflowsResource(this.http, this.config);
2574
2585
  this.context = new ManagementContextResource(this.http, this.config);
2575
2586
  this.usage = new ManagementUsageResource(this.http, this.config);
2576
- this.organization = new ManagementOrganizationResource(this.http, this.config);
2577
2587
  this.users = new ManagementUsersResource(this.http, this.config);
2578
2588
  }
2579
2589
  };