@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.
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: ["pageSize", "pageToken"],
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: null
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: "SkillDto"
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: "SkillDto"
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: "SkillDto"
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: "SkillDto"
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: "SkillDto"
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: "SkillDto"
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: "SkillDto"
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: "SkillDto"
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", "skill_id", "skill_ids"],
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: ["pageSize", "pageToken"],
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: "AgentDto"
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: "AgentDto"
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: "AgentDto"
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: "AgentDto"
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: "AgentDto"
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: "AgentDto"
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: "AgentDto"
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: "AgentDto"
916
+ responseSchema: "WorkflowDto"
915
917
  }
916
918
  };
917
919
 
@@ -1121,7 +1123,7 @@ var WRITE_BODY_ALLOWED_KEYS = {
1121
1123
  ScopesController_update: ["name", "description", "expectedOutput", "instructions", "toolset", "model", "connectionSet", "contextSelections", "interfaces", "accessConfig", "managerId", "evaluations", "supervisionSubordinateDescriptions"],
1122
1124
  ScopeSupervisionController_set: ["subordinateAgentIds"],
1123
1125
  ScopeSupervisionController_setActive: ["subordinateAgentIds"],
1124
- SuggestionsController_recordEvent: ["event_type", "source", "skill_id", "thread_id", "metadata"],
1126
+ SuggestionsController_recordEvent: ["eventType", "source", "skillId", "threadId", "metadata"],
1125
1127
  WorkflowActionsController_cancel: [],
1126
1128
  WorkflowActionsController_execute: ["organizationId", "sessionId", "fileThreadId", "workflowAction", "previousOutputs", "userTimezone", "runId", "automationId", "source"],
1127
1129
  WorkflowInterfacesController_add: ["type", "name", "config"],
@@ -1407,15 +1409,19 @@ function buildAipPage(data, itemsKey, mapItem, fetchPage) {
1407
1409
  return new Page(items, nextPageTokenFromResponse(data), fetchPage);
1408
1410
  }
1409
1411
 
1410
- // src/types/agents.ts
1411
- var AgentType = {
1412
+ // src/types/workflows.ts
1413
+ var WorkflowType = {
1412
1414
  task: "task",
1413
1415
  workflow: "workflow"
1414
1416
  };
1417
+ var AgentType = WorkflowType;
1415
1418
 
1416
1419
  // src/types/conversations.ts
1420
+ function conversationScopeId(item) {
1421
+ return item.scopeId === 0 ? void 0 : item.scopeId;
1422
+ }
1417
1423
  function conversationSkillId(item) {
1418
- return item.skillId === 0 ? void 0 : item.skillId;
1424
+ return item.scopeId;
1419
1425
  }
1420
1426
 
1421
1427
  // src/_auth.ts
@@ -1527,7 +1533,7 @@ function formatConfigForLog(config) {
1527
1533
  }
1528
1534
 
1529
1535
  // src/_http.ts
1530
- var USER_AGENT = `modus-typescript/${"0.2.3"} (node/${process.version}; ${process.platform})`;
1536
+ var USER_AGENT = `modus-typescript/${"0.3.0"} (node/${process.version}; ${process.platform})`;
1531
1537
  function buildUrl(baseUrl, path, params) {
1532
1538
  const url = new URL(path.startsWith("/") ? path : `/${path}`, baseUrl);
1533
1539
  if (params) {
@@ -1875,7 +1881,7 @@ function asRecord(data) {
1875
1881
  throw new Error(`Expected object response, got ${typeof data}`);
1876
1882
  }
1877
1883
 
1878
- // src/resources/agents/runs.ts
1884
+ // src/resources/workflows/runs.ts
1879
1885
  var import_node_crypto2 = require("crypto");
1880
1886
  var RUNS_MAX_PAGE_SIZE = 100;
1881
1887
  function runsListParams(pageSize, pageToken, status, timeframe, approvalScope, search) {
@@ -2083,7 +2089,7 @@ var WorkflowRunsResource = class {
2083
2089
  }
2084
2090
  };
2085
2091
 
2086
- // src/resources/agents/workflow-actions.ts
2092
+ // src/resources/workflows/workflow-actions.ts
2087
2093
  var import_node_crypto3 = require("crypto");
2088
2094
  function randomRunId2() {
2089
2095
  return (0, import_node_crypto3.randomUUID)();
@@ -2115,7 +2121,7 @@ var AgentWorkflowActionsResource = class {
2115
2121
  }
2116
2122
  };
2117
2123
 
2118
- // src/resources/agents.ts
2124
+ // src/resources/workflows.ts
2119
2125
  function workflowsListParams(pageSize, pageToken, search, type, view, includeVariation) {
2120
2126
  const extra = {};
2121
2127
  if (search !== void 0) extra.search = search;
@@ -2161,7 +2167,7 @@ var WorkflowsResource = class {
2161
2167
  );
2162
2168
  return buildAipPage(
2163
2169
  data,
2164
- "agents",
2170
+ "workflows",
2165
2171
  parseWorkflow,
2166
2172
  (token) => this.listPage(pageSize, token, search, type, view, includeVariation)
2167
2173
  );
@@ -2179,12 +2185,6 @@ var WorkflowsResource = class {
2179
2185
  });
2180
2186
  return parseWorkflow(data);
2181
2187
  }
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
2188
  };
2189
2189
 
2190
2190
  // src/resources/connections.ts
@@ -2240,7 +2240,18 @@ function parseContextItem(raw) {
2240
2240
  return raw;
2241
2241
  }
2242
2242
  function parseCreatedCustomContextItem(raw) {
2243
- return raw;
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
+ };
2244
2255
  }
2245
2256
  function parseDeletion(raw) {
2246
2257
  return raw;
@@ -2413,7 +2424,7 @@ var ContextResource = class {
2413
2424
  };
2414
2425
 
2415
2426
  // src/resources/modus/conversations.ts
2416
- var ALLOWED_KINDS = /* @__PURE__ */ new Set(["all", "modus", "skills"]);
2427
+ var ALLOWED_KINDS = /* @__PURE__ */ new Set(["all", "modus", "scopes"]);
2417
2428
  function listParams(pageSize, pageToken, kind) {
2418
2429
  if (kind !== void 0 && !ALLOWED_KINDS.has(kind)) {
2419
2430
  throw new Error(
@@ -2483,7 +2494,7 @@ var ModusResource = class {
2483
2494
  }
2484
2495
  };
2485
2496
 
2486
- // src/resources/skills/conversations.ts
2497
+ // src/resources/scopes/conversations.ts
2487
2498
  function parseListItem2(raw) {
2488
2499
  return raw;
2489
2500
  }
@@ -2533,7 +2544,7 @@ var ScopeConversationsResource = class {
2533
2544
  }
2534
2545
  };
2535
2546
 
2536
- // src/resources/skills.ts
2547
+ // src/resources/scopes.ts
2537
2548
  function scopesListParams(pageSize, pageToken, search, view, managerId) {
2538
2549
  const extra = {};
2539
2550
  if (search !== void 0) extra.search = search;
@@ -2571,7 +2582,7 @@ var ScopesResource = class {
2571
2582
  );
2572
2583
  return buildAipPage(
2573
2584
  data,
2574
- "skills",
2585
+ "scopes",
2575
2586
  parseScope,
2576
2587
  (token) => this.listPage(pageSize, token, search, view, managerId)
2577
2588
  );
@@ -2601,24 +2612,6 @@ var ScopesResource = class {
2601
2612
  }
2602
2613
  };
2603
2614
 
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
2615
  // src/resources/suggestions.ts
2623
2616
  var DEFAULT_SUGGESTIONS_PAGE_SIZE = 5;
2624
2617
  var MAX_SUGGESTIONS_PAGE_SIZE = 12;
@@ -2629,8 +2622,8 @@ function suggestionListParams(options) {
2629
2622
  return {
2630
2623
  pageSize: options.pageSize,
2631
2624
  pageToken: options.pageToken,
2632
- skill_id: options.skillId,
2633
- skill_ids: options.skillIds?.join(",")
2625
+ scopeId: options.scopeId,
2626
+ scopeIds: options.scopeIds?.join(",")
2634
2627
  };
2635
2628
  }
2636
2629
  var SuggestionsResource = class {
@@ -2641,26 +2634,26 @@ var SuggestionsResource = class {
2641
2634
  list(options = {}) {
2642
2635
  const pageSize = options.pageSize ?? DEFAULT_SUGGESTIONS_PAGE_SIZE;
2643
2636
  validatePageSize(pageSize, MAX_SUGGESTIONS_PAGE_SIZE);
2644
- return this.listPage(pageSize, options.pageToken, options.skillId, options.skillIds);
2637
+ return this.listPage(pageSize, options.pageToken, options.scopeId, options.scopeIds);
2645
2638
  }
2646
- async listPage(pageSize, pageToken, skillId, skillIds) {
2639
+ async listPage(pageSize, pageToken, scopeId, scopeIds) {
2647
2640
  const data = asRecord(
2648
2641
  await invokeWithRetry(this.config, this.http, "SuggestionsController_listApproved", {
2649
- query: suggestionListParams({ pageSize, pageToken, skillId, skillIds })
2642
+ query: suggestionListParams({ pageSize, pageToken, scopeId, scopeIds })
2650
2643
  })
2651
2644
  );
2652
2645
  return buildAipPage(
2653
2646
  data,
2654
2647
  "suggestions",
2655
2648
  parseSuggestion,
2656
- (token) => this.listPage(pageSize, token, skillId, skillIds)
2649
+ (token) => this.listPage(pageSize, token, scopeId, scopeIds)
2657
2650
  );
2658
2651
  }
2659
2652
  async recordEvent(id, event) {
2660
2653
  validateId(id, "id");
2661
2654
  await invokeWithRetry(this.config, this.http, "SuggestionsController_recordEvent", {
2662
2655
  pathParams: { id },
2663
- jsonBody: normalizeRecordSuggestionEvent(event)
2656
+ jsonBody: event
2664
2657
  });
2665
2658
  }
2666
2659
  };
@@ -2696,6 +2689,8 @@ var Modus = class extends ModusClientBase {
2696
2689
  StreamTimeoutError,
2697
2690
  UnprocessableError,
2698
2691
  ValidationError,
2692
+ WorkflowType,
2693
+ conversationScopeId,
2699
2694
  conversationSkillId
2700
2695
  });
2701
2696
  //# sourceMappingURL=index.cjs.map