@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 CHANGED
@@ -1,12 +1,69 @@
1
1
  # Changelog
2
2
 
3
- **Current npm release:** [`0.2.2`](https://www.npmjs.com/package/@getmodus/sdk/v/0.2.2).
3
+ **Current npm release:** [`0.3.0`](https://www.npmjs.com/package/@getmodus/sdk/v/0.3.0).
4
4
 
5
5
 
6
+
7
+ ## [0.3.0] — 2026-07-26
8
+
9
+ > Breaking surface vs `0.2.x` (pre-1.0 minor bump). See `distribution/docs/COMPATIBILITY.md`.
10
+
11
+ ### Added
12
+
13
+ - `mgmt.usage.list()` gains an optional `userEmail` filter (repeated `user_email` query param).
14
+ - `mgmt.usage.listUsers({ since, until })` — distinct acting-user emails observed in the window.
15
+
16
+ ### Deprecated
17
+
18
+ - **`Skill` / `Agent` type names** — use `Scope` / `Workflow` (OpenAPI `ScopeDto` / `WorkflowDto`).
19
+ - **`CreateSkillOptions` / `UpdateSkillOptions`** — use `CreateScopeOptions` / `UpdateScopeOptions`.
20
+ - **`CreateAgentOptions` / `UpdateAgentOptions`** — use `CreateWorkflowOptions` / `UpdateWorkflowOptions`.
21
+ - **`conversationSkillId()`** — use `conversationScopeId()`.
22
+
23
+ ### Changed
24
+
25
+ - SDK read types are exported as `Scope` / `Workflow` backed by generated `ScopeDto` / `WorkflowDto`.
26
+ - Custom context create responses always expose `.uid` (same value as `contextItemId`).
27
+
28
+ ### Removed
29
+
30
+ - Dual list/deploy envelopes — responses use `scopes` / `workflows` and `scope` / `workflow` only (no `skills` / `agents` / `skill` / `agent` aliases).
31
+ - OpenAPI public schema aliases **`SkillDto` / `AgentDto`** — use `ScopeDto` / `WorkflowDto`.
32
+ - Conversation `kind=skills` — use `kind=scopes`.
33
+ - `mgmt.organization.delete()` — organization deletion is no longer part of the
34
+ public API / PAT surface (SPA-only).
35
+ - `GET /api/v1/users/member-groups` and `/org-members` no longer advertise `pageSize` /
36
+ `pageToken` query params or an always-`null` `nextPageToken` response field (OpenAPI /
37
+ Management MCP surface — `mgmt.users.listMemberGroups()` / `listOrgMembers()` never
38
+ exposed either). Both endpoints return the full org-bounded roster; pagination was never
39
+ honored server-side.
40
+
6
41
  ## [Unreleased]
7
42
 
43
+ ## [0.2.3] — 2026-07-20
44
+
45
+ ### Fixed
46
+
47
+ - Streaming requests send `Accept: text/event-stream`; a non-SSE response (e.g. JSON polling body) raises `ModusError` instead of returning an empty stream.
48
+ - `createModus` / `createScope` / `runs.create()` / `resume()` always mint (or reuse) a `sessionId`.
49
+
8
50
  ## [0.2.2] — 2026-07-20
9
51
 
52
+ ### Fixed
53
+
54
+ - `chatStream` posts to agent-host `/agent/v1/.../runs` (parity with Python), not `/api/v1/.../chat/stream`.
55
+ - Streaming always sends `sessionId`; optional `organizationId` / `MODUS_ORGANIZATION_ID`.
56
+ - Default API/agent hosts are `*.getmodus.com`.
57
+ - `invokeOperation` supports **PUT** (unblocks `supervision.set` / `evaluations.updateConfig`).
58
+ - Agent-service calls honor `agentHost` / `MODUS_AGENT_HOST` over codegen `serverUrl`.
59
+ - `suggestions.recordEvent` accepts camelCase aliases and sends snake_case wire keys.
60
+ - `runs.create` / `createModus` / `createScope` / `resume` return a sync async-iterable stream (not a Promise wrapper).
61
+
62
+ ### Added
63
+
64
+ - Runtime `AgentType.task` / `AgentType.workflow` (not type-only).
65
+ - Create responses expose `.uid` as an alias of `contextItemId`.
66
+
10
67
  ## [0.2.1] — 2026-07-20
11
68
 
12
69
  ### Changed
@@ -216,7 +216,7 @@ var OPERATIONS = {
216
216
  service: "modus-api",
217
217
  serverUrl: "https://api.getmodus.com",
218
218
  pathParams: [],
219
- queryParams: ["pageSize", "pageToken"],
219
+ queryParams: [],
220
220
  requestSchema: null,
221
221
  responseSchema: "ListMemberGroupsResponseDto"
222
222
  },
@@ -286,19 +286,9 @@ var OPERATIONS = {
286
286
  service: "modus-api",
287
287
  serverUrl: "https://api.getmodus.com",
288
288
  pathParams: [],
289
- queryParams: ["pageSize", "pageToken"],
290
- requestSchema: null,
291
- responseSchema: "ListOrgMembersResponseDto"
292
- },
293
- "OrganizationController_deleteOrganization": {
294
- method: "DELETE",
295
- path: "/api/v1/users/organization",
296
- service: "modus-api",
297
- serverUrl: "https://api.getmodus.com",
298
- pathParams: [],
299
289
  queryParams: [],
300
290
  requestSchema: null,
301
- responseSchema: null
291
+ responseSchema: "ListOrgMembersResponseDto"
302
292
  },
303
293
  "ResumeRunsController_create": {
304
294
  method: "POST",
@@ -518,7 +508,7 @@ var OPERATIONS = {
518
508
  pathParams: ["id"],
519
509
  queryParams: [],
520
510
  requestSchema: null,
521
- responseSchema: "SkillDto"
511
+ responseSchema: "ScopeDto"
522
512
  },
523
513
  "ScopesController_cancelOwnershipTransfer": {
524
514
  method: "DELETE",
@@ -528,7 +518,7 @@ var OPERATIONS = {
528
518
  pathParams: ["id"],
529
519
  queryParams: [],
530
520
  requestSchema: null,
531
- responseSchema: "SkillDto"
521
+ responseSchema: "ScopeDto"
532
522
  },
533
523
  "ScopesController_create": {
534
524
  method: "POST",
@@ -538,7 +528,7 @@ var OPERATIONS = {
538
528
  pathParams: [],
539
529
  queryParams: [],
540
530
  requestSchema: "CreateSkillDto",
541
- responseSchema: "SkillDto"
531
+ responseSchema: "ScopeDto"
542
532
  },
543
533
  "ScopesController_delete": {
544
534
  method: "DELETE",
@@ -568,7 +558,7 @@ var OPERATIONS = {
568
558
  pathParams: ["id"],
569
559
  queryParams: ["view"],
570
560
  requestSchema: null,
571
- responseSchema: "SkillDto"
561
+ responseSchema: "ScopeDto"
572
562
  },
573
563
  "ScopesController_getVariation": {
574
564
  method: "GET",
@@ -578,7 +568,7 @@ var OPERATIONS = {
578
568
  pathParams: ["id", "variationUid"],
579
569
  queryParams: [],
580
570
  requestSchema: null,
581
- responseSchema: "SkillDto"
571
+ responseSchema: "ScopeDto"
582
572
  },
583
573
  "ScopesController_list": {
584
574
  method: "GET",
@@ -608,7 +598,7 @@ var OPERATIONS = {
608
598
  pathParams: ["id"],
609
599
  queryParams: [],
610
600
  requestSchema: "TransferOwnershipDto",
611
- responseSchema: "SkillDto"
601
+ responseSchema: "ScopeDto"
612
602
  },
613
603
  "ScopesController_restore": {
614
604
  method: "POST",
@@ -618,7 +608,7 @@ var OPERATIONS = {
618
608
  pathParams: ["id"],
619
609
  queryParams: [],
620
610
  requestSchema: null,
621
- responseSchema: "SkillDto"
611
+ responseSchema: "ScopeDto"
622
612
  },
623
613
  "ScopesController_update": {
624
614
  method: "PATCH",
@@ -628,7 +618,7 @@ var OPERATIONS = {
628
618
  pathParams: ["id"],
629
619
  queryParams: ["updateMask"],
630
620
  requestSchema: "UpdateSkillDto",
631
- responseSchema: "SkillDto"
621
+ responseSchema: "ScopeDto"
632
622
  },
633
623
  "SuggestionsController_listApproved": {
634
624
  method: "GET",
@@ -636,7 +626,7 @@ var OPERATIONS = {
636
626
  service: "modus-api",
637
627
  serverUrl: "https://api.getmodus.com",
638
628
  pathParams: [],
639
- queryParams: ["pageToken", "pageSize", "skill_id", "skill_ids"],
629
+ queryParams: ["pageToken", "pageSize", "scopeId", "scopeIds"],
640
630
  requestSchema: null,
641
631
  responseSchema: "ListSuggestionQuestionsResponseDto"
642
632
  },
@@ -656,10 +646,20 @@ var OPERATIONS = {
656
646
  service: "modus-api",
657
647
  serverUrl: "https://api.getmodus.com",
658
648
  pathParams: [],
659
- queryParams: ["since", "until", "rollup", "model", "group_by", "skill_id", "agent_id", "user_id", "interface"],
649
+ queryParams: ["since", "until", "rollup", "model", "group_by", "skill_id", "agent_id", "user_id", "interface", "user_email"],
660
650
  requestSchema: null,
661
651
  responseSchema: "ListUsageResponseDto"
662
652
  },
653
+ "UsageController_listUsers": {
654
+ method: "GET",
655
+ path: "/api/v1/usage/users",
656
+ service: "modus-api",
657
+ serverUrl: "https://api.getmodus.com",
658
+ pathParams: [],
659
+ queryParams: ["since", "until"],
660
+ requestSchema: null,
661
+ responseSchema: "ListUsageUsersResponseDto"
662
+ },
663
663
  "WorkflowActionsController_cancel": {
664
664
  method: "POST",
665
665
  path: "/agent/v1/workflow-actions/{runId}/cancel",
@@ -716,7 +716,7 @@ var OPERATIONS = {
716
716
  service: "modus-api",
717
717
  serverUrl: "https://api.getmodus.com",
718
718
  pathParams: ["id"],
719
- queryParams: ["pageSize", "pageToken"],
719
+ queryParams: [],
720
720
  requestSchema: null,
721
721
  responseSchema: "ListAgentInterfacesResponseDto"
722
722
  },
@@ -768,7 +768,7 @@ var OPERATIONS = {
768
768
  pathParams: ["id"],
769
769
  queryParams: [],
770
770
  requestSchema: null,
771
- responseSchema: "AgentDto"
771
+ responseSchema: "WorkflowDto"
772
772
  },
773
773
  "WorkflowsController_cancelOwnershipTransfer": {
774
774
  method: "DELETE",
@@ -778,7 +778,7 @@ var OPERATIONS = {
778
778
  pathParams: ["id"],
779
779
  queryParams: [],
780
780
  requestSchema: null,
781
- responseSchema: "AgentDto"
781
+ responseSchema: "WorkflowDto"
782
782
  },
783
783
  "WorkflowsController_create": {
784
784
  method: "POST",
@@ -788,7 +788,7 @@ var OPERATIONS = {
788
788
  pathParams: [],
789
789
  queryParams: [],
790
790
  requestSchema: "CreateAgentDto",
791
- responseSchema: "AgentDto"
791
+ responseSchema: "WorkflowDto"
792
792
  },
793
793
  "WorkflowsController_delete": {
794
794
  method: "DELETE",
@@ -818,7 +818,7 @@ var OPERATIONS = {
818
818
  pathParams: ["id"],
819
819
  queryParams: ["view"],
820
820
  requestSchema: null,
821
- responseSchema: "AgentDto"
821
+ responseSchema: "WorkflowDto"
822
822
  },
823
823
  "WorkflowsController_list": {
824
824
  method: "GET",
@@ -838,7 +838,7 @@ var OPERATIONS = {
838
838
  pathParams: ["id"],
839
839
  queryParams: [],
840
840
  requestSchema: "TransferOwnershipDto",
841
- responseSchema: "AgentDto"
841
+ responseSchema: "WorkflowDto"
842
842
  },
843
843
  "WorkflowsController_restore": {
844
844
  method: "POST",
@@ -848,7 +848,7 @@ var OPERATIONS = {
848
848
  pathParams: ["id"],
849
849
  queryParams: [],
850
850
  requestSchema: null,
851
- responseSchema: "AgentDto"
851
+ responseSchema: "WorkflowDto"
852
852
  },
853
853
  "WorkflowsController_toggle": {
854
854
  method: "POST",
@@ -858,7 +858,7 @@ var OPERATIONS = {
858
858
  pathParams: ["id"],
859
859
  queryParams: [],
860
860
  requestSchema: "ToggleAgentDto",
861
- responseSchema: "AgentDto"
861
+ responseSchema: "WorkflowDto"
862
862
  },
863
863
  "WorkflowsController_update": {
864
864
  method: "PATCH",
@@ -868,7 +868,7 @@ var OPERATIONS = {
868
868
  pathParams: ["id"],
869
869
  queryParams: ["updateMask"],
870
870
  requestSchema: "UpdateAgentDto",
871
- responseSchema: "AgentDto"
871
+ responseSchema: "WorkflowDto"
872
872
  }
873
873
  };
874
874
 
@@ -1128,7 +1128,7 @@ function formatConfigForLog(config) {
1128
1128
  }
1129
1129
 
1130
1130
  // src/_http.ts
1131
- var USER_AGENT = `modus-typescript/${"0.2.2"} (node/${process.version}; ${process.platform})`;
1131
+ var USER_AGENT = `modus-typescript/${"0.3.0"} (node/${process.version}; ${process.platform})`;
1132
1132
  function buildUrl(baseUrl, path, params) {
1133
1133
  const url = new URL(path.startsWith("/") ? path : `/${path}`, baseUrl);
1134
1134
  if (params) {
@@ -1223,6 +1223,26 @@ function wrapNetworkError(error, baseUrl) {
1223
1223
  async function readBody(response) {
1224
1224
  return response.text();
1225
1225
  }
1226
+ async function readBodyPreview(response, maxChars = 200) {
1227
+ if (!response.body) return "";
1228
+ const reader = response.body.getReader();
1229
+ const decoder = new TextDecoder();
1230
+ let out = "";
1231
+ try {
1232
+ while (out.length < maxChars) {
1233
+ const { done, value } = await reader.read();
1234
+ if (done) break;
1235
+ out += decoder.decode(value, { stream: true });
1236
+ if (out.length >= maxChars) {
1237
+ out = out.slice(0, maxChars);
1238
+ break;
1239
+ }
1240
+ }
1241
+ } finally {
1242
+ await reader.cancel().catch(() => void 0);
1243
+ }
1244
+ return out;
1245
+ }
1226
1246
  var HttpClient = class {
1227
1247
  constructor(config) {
1228
1248
  this.config = config;
@@ -1278,7 +1298,13 @@ var HttpClient = class {
1278
1298
  try {
1279
1299
  const response = await this.config.fetch(url, {
1280
1300
  method,
1281
- headers: { ...this.defaultHeaders(), ...options.headers },
1301
+ // Agent-service negotiates SSE vs JSON polling on Accept; JSON-only
1302
+ // Accept returns {"runId","status":"pending"} instead of token SSE.
1303
+ headers: {
1304
+ ...this.defaultHeaders(),
1305
+ ...options.headers,
1306
+ Accept: "text/event-stream"
1307
+ },
1282
1308
  body: options.json !== void 0 ? JSON.stringify(options.json) : void 0,
1283
1309
  signal: AbortSignal.timeout(this.config.timeoutMs)
1284
1310
  });
@@ -1287,6 +1313,14 @@ var HttpClient = class {
1287
1313
  raiseForStatus(response, body);
1288
1314
  return;
1289
1315
  }
1316
+ const contentType = response.headers.get("content-type") ?? "";
1317
+ if (!contentType.toLowerCase().includes("text/event-stream")) {
1318
+ const preview = await readBodyPreview(response);
1319
+ throw new ModusError(
1320
+ `Unexpected stream response: expected Content-Type text/event-stream, got ${JSON.stringify(contentType) || "(missing)"}. Body preview: ${preview}`,
1321
+ { statusCode: response.status, body: preview }
1322
+ );
1323
+ }
1290
1324
  if (!response.body) return;
1291
1325
  const reader = response.body.getReader();
1292
1326
  const decoder = new TextDecoder();
@@ -1369,7 +1403,7 @@ var WRITE_BODY_ALLOWED_KEYS = {
1369
1403
  ScopesController_update: ["name", "description", "expectedOutput", "instructions", "toolset", "model", "connectionSet", "contextSelections", "interfaces", "accessConfig", "managerId", "evaluations", "supervisionSubordinateDescriptions"],
1370
1404
  ScopeSupervisionController_set: ["subordinateAgentIds"],
1371
1405
  ScopeSupervisionController_setActive: ["subordinateAgentIds"],
1372
- SuggestionsController_recordEvent: ["event_type", "source", "skill_id", "thread_id", "metadata"],
1406
+ SuggestionsController_recordEvent: ["eventType", "source", "skillId", "threadId", "metadata"],
1373
1407
  WorkflowActionsController_cancel: [],
1374
1408
  WorkflowActionsController_execute: ["organizationId", "sessionId", "fileThreadId", "workflowAction", "previousOutputs", "userTimezone", "runId", "automationId", "source"],
1375
1409
  WorkflowInterfacesController_add: ["type", "name", "config"],
@@ -1554,7 +1588,18 @@ function parseContextItem(raw) {
1554
1588
  return raw;
1555
1589
  }
1556
1590
  function parseCreatedCustomContextItem(raw) {
1557
- return raw;
1591
+ const data = asRecord(raw);
1592
+ const contextItemId = data.contextItemId;
1593
+ if (typeof contextItemId !== "string" || !contextItemId) {
1594
+ throw new ValidationError(
1595
+ "Custom context create response missing non-empty string contextItemId"
1596
+ );
1597
+ }
1598
+ return {
1599
+ ...data,
1600
+ contextItemId,
1601
+ uid: contextItemId
1602
+ };
1558
1603
  }
1559
1604
  function parseDeletion(raw) {
1560
1605
  return raw;
@@ -1627,7 +1672,7 @@ var CustomContextItemsResource = class {
1627
1672
  }
1628
1673
  };
1629
1674
 
1630
- // src/resources/skills/conversations.ts
1675
+ // src/resources/scopes/conversations.ts
1631
1676
  function parseListItem(raw) {
1632
1677
  return raw;
1633
1678
  }
@@ -1709,4 +1754,4 @@ export {
1709
1754
  CustomContextItemsResource,
1710
1755
  ScopeConversationsResource
1711
1756
  };
1712
- //# sourceMappingURL=chunk-OUFN2O5C.js.map
1757
+ //# sourceMappingURL=chunk-D3NU2M6B.js.map