@getmodus/sdk 0.7.0 → 0.8.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
@@ -9,10 +9,54 @@ release, including pre-1.0 (`0.x`) releases.
9
9
 
10
10
  ## [Unreleased]
11
11
 
12
+ ## [0.8.0] — 2026-10-18
13
+
14
+ ### Added
15
+
16
+ - **`includeOwnLearnings` on `scopes.create`.** A new scope reads what is taught while
17
+ using it by default; pass `false` to create it without its own learnings.
18
+ - **`defaultHeaders` client option.** `Modus` and `ModusManagement` accept headers to
19
+ send on every request. They override the SDK's own defaults, except `Authorization`,
20
+ which always comes from `apiKey`.
21
+ - **`X-Modus-Client: sdk` request header.** Every request names the SDK as the client.
22
+ - **`gpt-6-luna` model.** The chat request `model` union accepts the new
23
+ OpenAI model.
24
+ - **`gpt-5.6-luna` model.** The chat request `model` union accepts the new
25
+ OpenAI model.
26
+ - **Move Files items.** `mgmt.context.items.move(uid, { destinationFolderUid })`
27
+ relocates a live file or folder. Pass `null` for the Files root.
28
+ - **Generic context item browse.** `client.context.items.list()` and
29
+ `mgmt.context.items.list()` accept optional `connectionIds`, `parentUids`,
30
+ and `ancestorUids` arrays. Omit a filter to leave it unrestricted; pass `[]`
31
+ for the known-empty / match-none forms (`parentUids: []` is the Files root).
32
+ - **Upload destinations.** Upload helpers accept an optional `folderPath`
33
+ prefix for single files, batches, and directories.
34
+
35
+ ### Changed
36
+
37
+ - **Connected-integration toolset entries bind to a connection.** A scope toolset entry
38
+ given as `{ actions: [...], rules }` is bound on create/update to the organization's
39
+ newest workspace connection of that integration and returned as
40
+ `{ byConnection: { <connection id>: {...} } }`. A create or update whose entry has no
41
+ workspace connection to bind to returns `422`; re-sending an entry already stored
42
+ unchanged is accepted.
43
+ - Deleting a Files folder through context items also deletes its contained files,
44
+ subfolders, and parsed file items.
45
+
12
46
  ## [0.7.0] — 2026-09-30
13
47
 
14
48
  ### Added
15
49
 
50
+ - **Scope Slack/Teams interfaces.** `scopes.interfaces(scopeId)` lists, adds, updates and
51
+ removes the Slack and Microsoft Teams interfaces of a scope.
52
+ - **`claude-sonnet-5.5` model.** The chat request `model` union accepts the new
53
+ Anthropic model.
54
+ - **`deepseek-v4-pro`, `deepseek-v4-flash-latest`, and `kimi-k3` models.** The
55
+ chat request `model` union accepts these models.
56
+ - **Optional `ancestry` on context items.** List, get, lookup, and custom-item
57
+ responses may include ordered ancestors (`uid`, `display_name`, `type`). The
58
+ field is omitted on older responses, `null` when stored ancestry is unknown,
59
+ and `[]` when the item has no ancestors.
16
60
  - **`contextItemUids` on composed context.** `POST /modus/context` and
17
61
  `POST /scopes/{id}/context` now return the UIDs of the context items the composer
18
62
  kept, in selection order. Previously the response reported `selectedCount` with no
package/README.md CHANGED
@@ -167,12 +167,31 @@ const note = await mgmt.context.createNote('Title', 'Body')
167
167
  console.log(note.contextItemId, note.uid) // same UUID
168
168
 
169
169
  // Context file upload (presign → PUT → finalize; polls until processing by default)
170
- const upload = await mgmt.context.files.upload('report.pdf')
170
+ const upload = await mgmt.context.files.upload('report.pdf', { folderPath: 'reports/2026' })
171
171
  console.log(upload.uploadId, upload.status)
172
172
 
173
173
  // Directory / many files — bulk uploadUrls + finalize (chunks of 100)
174
- const batch = await mgmt.context.files.uploadDir('./reports')
174
+ const batch = await mgmt.context.files.uploadDir('./reports', { folderPath: 'archive' })
175
175
  console.log(batch.uploaded.length, batch.failed.length)
176
+
177
+ const file = await mgmt.context.files.get(upload.uploadId)
178
+ const files = await mgmt.context.files.list()
179
+ console.log(file.status, files.items.length)
180
+
181
+ const rootFolders = await mgmt.context.items.list({
182
+ connectionIds: ['files'],
183
+ contextType: 'file_folder_metadata',
184
+ parentUids: [],
185
+ })
186
+ console.log(rootFolders.items.length)
187
+
188
+ const destination = rootFolders.items[0]
189
+ if (destination) {
190
+ const moved = await mgmt.context.items.move(upload.uploadId, {
191
+ destinationFolderUid: destination.uid,
192
+ })
193
+ console.log(moved.movedItems)
194
+ }
176
195
  ```
177
196
 
178
197
  Requires a token with write access to scopes and workflows (same as the Modus UI). Context file upload/finalize also needs `context:write`; polling status and listing context items need `context:read`.
@@ -146,7 +146,7 @@ var OPERATIONS = {
146
146
  service: "modus-api",
147
147
  serverUrl: "https://api.getmodus.com",
148
148
  pathParams: [],
149
- queryParams: ["pageToken", "pageSize", "contextTypes", "verificationStatuses", "searchQuery", "topics"],
149
+ queryParams: ["pageToken", "pageSize", "contextTypes", "verificationStatuses", "searchQuery", "topics", "connectionIds", "parentUids", "ancestorUids"],
150
150
  requestSchema: null,
151
151
  responseSchema: "ListContextItemsResponseDto"
152
152
  },
@@ -170,6 +170,16 @@ var OPERATIONS = {
170
170
  requestSchema: "LookupContextItemDto",
171
171
  responseSchema: "LookupContextItemResponseDto"
172
172
  },
173
+ "ContextItemsController_move": {
174
+ method: "POST",
175
+ path: "/api/v1/context/items/{uid}/move",
176
+ service: "modus-api",
177
+ serverUrl: "https://api.getmodus.com",
178
+ pathParams: ["uid"],
179
+ queryParams: [],
180
+ requestSchema: "MoveContextItemDto",
181
+ responseSchema: "MoveContextItemResponseDto"
182
+ },
173
183
  "ContextItemsController_update": {
174
184
  method: "PATCH",
175
185
  path: "/api/v1/context/items/{uid}",
@@ -710,6 +720,46 @@ var OPERATIONS = {
710
720
  requestSchema: null,
711
721
  responseSchema: "ListConversationsResponseDto"
712
722
  },
723
+ "ScopeInterfacesController_add": {
724
+ method: "POST",
725
+ path: "/api/v1/scopes/{id}/interfaces",
726
+ service: "modus-api",
727
+ serverUrl: "https://api.getmodus.com",
728
+ pathParams: ["id"],
729
+ queryParams: [],
730
+ requestSchema: "AddScopeInterfaceDto",
731
+ responseSchema: "ScopeInterfaceDto"
732
+ },
733
+ "ScopeInterfacesController_delete": {
734
+ method: "DELETE",
735
+ path: "/api/v1/scopes/{id}/interfaces/{interfaceId}",
736
+ service: "modus-api",
737
+ serverUrl: "https://api.getmodus.com",
738
+ pathParams: ["id", "interfaceId"],
739
+ queryParams: [],
740
+ requestSchema: null,
741
+ responseSchema: null
742
+ },
743
+ "ScopeInterfacesController_list": {
744
+ method: "GET",
745
+ path: "/api/v1/scopes/{id}/interfaces",
746
+ service: "modus-api",
747
+ serverUrl: "https://api.getmodus.com",
748
+ pathParams: ["id"],
749
+ queryParams: [],
750
+ requestSchema: null,
751
+ responseSchema: "ListScopeInterfacesResponseDto"
752
+ },
753
+ "ScopeInterfacesController_update": {
754
+ method: "PATCH",
755
+ path: "/api/v1/scopes/{id}/interfaces/{interfaceId}",
756
+ service: "modus-api",
757
+ serverUrl: "https://api.getmodus.com",
758
+ pathParams: ["id", "interfaceId"],
759
+ queryParams: ["updateMask"],
760
+ requestSchema: "UpdateScopeInterfaceDto",
761
+ responseSchema: "ScopeInterfaceDto"
762
+ },
713
763
  "ScopeMemoriesController_delete": {
714
764
  method: "DELETE",
715
765
  path: "/api/v1/scopes/{id}/memories/{memoryId}",
@@ -1444,6 +1494,7 @@ function createModusConfig(options = {}) {
1444
1494
  }),
1445
1495
  timeoutMs: resolveTimeoutMs(options.timeoutMs) ?? DEFAULT_TIMEOUT_MS,
1446
1496
  maxRetries,
1497
+ defaultHeaders: Object.freeze({ ...options.defaultHeaders }),
1447
1498
  fetch: options.fetch ?? globalThis.fetch.bind(globalThis)
1448
1499
  });
1449
1500
  }
@@ -1459,7 +1510,7 @@ function formatConfigForLog(config) {
1459
1510
  }
1460
1511
 
1461
1512
  // src/_http.ts
1462
- var USER_AGENT = `modus-typescript/${"0.7.0"} (node/${process.version}; ${process.platform})`;
1513
+ var USER_AGENT = `modus-typescript/${"0.8.0"} (node/${process.version}; ${process.platform})`;
1463
1514
  function buildUrl(baseUrl, path, params) {
1464
1515
  const url = new URL(path.startsWith("/") ? path : `/${path}`, baseUrl);
1465
1516
  if (params) {
@@ -1474,6 +1525,15 @@ function buildUrl(baseUrl, path, params) {
1474
1525
  }
1475
1526
  return url.toString();
1476
1527
  }
1528
+ function mergeHeaders(...layers) {
1529
+ const merged = /* @__PURE__ */ new Map();
1530
+ for (const layer of layers) {
1531
+ for (const [name, value] of Object.entries(layer ?? {})) {
1532
+ merged.set(name.toLowerCase(), [name, value]);
1533
+ }
1534
+ }
1535
+ return Object.fromEntries(merged.values());
1536
+ }
1477
1537
  function headersToRecord(headers) {
1478
1538
  const out = {};
1479
1539
  headers.forEach((value, key) => {
@@ -1579,12 +1639,15 @@ var HttpClient = class {
1579
1639
  this.config = config;
1580
1640
  }
1581
1641
  defaultHeaders() {
1582
- return {
1583
- ...authHeaders(this.config.apiKey),
1584
- Accept: "application/json",
1585
- "Content-Type": "application/json",
1586
- "User-Agent": USER_AGENT
1587
- };
1642
+ return mergeHeaders(
1643
+ {
1644
+ Accept: "application/json",
1645
+ "Content-Type": "application/json",
1646
+ "User-Agent": USER_AGENT,
1647
+ "X-Modus-Client": "sdk"
1648
+ },
1649
+ this.config.defaultHeaders
1650
+ );
1588
1651
  }
1589
1652
  async request(method, path, options = {}) {
1590
1653
  const baseUrl = options.baseUrl ?? this.config.baseUrl;
@@ -1592,7 +1655,7 @@ var HttpClient = class {
1592
1655
  try {
1593
1656
  const response = await this.config.fetch(url, {
1594
1657
  method,
1595
- headers: { ...this.defaultHeaders(), ...options.headers },
1658
+ headers: mergeHeaders(this.defaultHeaders(), options.headers, authHeaders(this.config.apiKey)),
1596
1659
  body: options.json !== void 0 ? JSON.stringify(options.json) : void 0,
1597
1660
  signal: AbortSignal.timeout(this.config.timeoutMs)
1598
1661
  });
@@ -1631,11 +1694,12 @@ var HttpClient = class {
1631
1694
  method,
1632
1695
  // Agent-service negotiates SSE vs JSON polling on Accept; JSON-only
1633
1696
  // Accept returns {"runId","status":"pending"} instead of token SSE.
1634
- headers: {
1635
- ...this.defaultHeaders(),
1636
- ...options.headers,
1637
- Accept: "text/event-stream"
1638
- },
1697
+ headers: mergeHeaders(
1698
+ this.defaultHeaders(),
1699
+ options.headers,
1700
+ { Accept: "text/event-stream" },
1701
+ authHeaders(this.config.apiKey)
1702
+ ),
1639
1703
  body: options.json !== void 0 ? JSON.stringify(options.json) : void 0,
1640
1704
  signal: AbortSignal.timeout(this.config.timeoutMs)
1641
1705
  });
@@ -1713,6 +1777,7 @@ var WRITE_BODY_ALLOWED_KEYS = {
1713
1777
  ContextFilesController_uploadUrl: ["fileName", "contentType", "fileSize"],
1714
1778
  ContextFilesController_uploadUrls: ["files"],
1715
1779
  ContextItemsController_lookup: ["contextType", "dataPath", "contentProjection"],
1780
+ ContextItemsController_move: ["destinationFolderUid"],
1716
1781
  ContextItemsController_update: ["contextType", "content", "description", "userFeedback", "topics"],
1717
1782
  CustomContextItemsController_batchCreate: ["items"],
1718
1783
  CustomContextItemsController_create: ["kind", "sourceId", "sourceName", "collectionId", "collectionName", "externalId", "fieldName", "name", "entityType", "description", "content", "url", "attributes", "dataType", "value", "samples", "raw", "topics", "idempotencyKey", "access"],
@@ -1738,11 +1803,13 @@ var WRITE_BODY_ALLOWED_KEYS = {
1738
1803
  RunLifecycleController_interrupt: [],
1739
1804
  ScopeChatController_chat: ["message", "model"],
1740
1805
  ScopeContextController_compose: ["message", "limit"],
1806
+ ScopeInterfacesController_add: ["type", "name", "config"],
1807
+ ScopeInterfacesController_update: ["name", "config"],
1741
1808
  ScopeMemoriesController_search: ["query", "userId", "limit"],
1742
1809
  ScopeMemoriesController_update: ["memory", "metadata"],
1743
1810
  ScopeRunsController_create: ["message", "sessionId", "organizationId", "version", "fileThreadId", "config", "attachments", "userContext", "source", "runId", "subordinateSkillIds"],
1744
1811
  ScopesController_acceptOwnershipTransfer: [],
1745
- ScopesController_create: ["name", "description", "expectedOutput", "instructions", "toolset", "model", "connectionSet", "contextSelections", "interfaces", "accessConfig"],
1812
+ ScopesController_create: ["name", "description", "expectedOutput", "instructions", "toolset", "model", "connectionSet", "contextSelections", "includeOwnLearnings", "interfaces", "accessConfig"],
1746
1813
  ScopesController_deploy: [],
1747
1814
  ScopesController_patchMcpConfig: ["config"],
1748
1815
  ScopesController_requestOwnershipTransfer: ["newOwnerUserId"],
@@ -1782,11 +1849,15 @@ function validateId(resourceId, name = "id") {
1782
1849
  }
1783
1850
  var ALLOWED_CHAT_MODELS = /* @__PURE__ */ new Set([
1784
1851
  "claude-sonnet-5",
1852
+ "claude-sonnet-5.5",
1785
1853
  "claude-sonnet-4.6",
1786
1854
  "claude-opus-4.8",
1855
+ "claude-opus-5.5",
1787
1856
  "gpt-5.2",
1788
1857
  "gpt-5.5",
1789
1858
  "gpt-5-mini",
1859
+ "gpt-5.6-luna",
1860
+ "gpt-6-luna",
1790
1861
  "gpt-oss-120b",
1791
1862
  "gpt-oss-20b",
1792
1863
  "qwen3-235b-a22b-2507",
@@ -1802,7 +1873,9 @@ var ALLOWED_CHAT_MODELS = /* @__PURE__ */ new Set([
1802
1873
  "gemini-3.1-pro-preview",
1803
1874
  "gemini-3-flash-preview",
1804
1875
  "grok-4.3-fast",
1805
- "grok-4.3"
1876
+ "grok-4.3",
1877
+ "grok-4.7",
1878
+ "kimi-k3"
1806
1879
  ]);
1807
1880
  function validateChatModel(model) {
1808
1881
  if (!ALLOWED_CHAT_MODELS.has(model)) {
@@ -2259,4 +2332,4 @@ export {
2259
2332
  CustomContextItemsResource,
2260
2333
  ScopeConversationsResource
2261
2334
  };
2262
- //# sourceMappingURL=chunk-JMFT5KO5.js.map
2335
+ //# sourceMappingURL=chunk-GFS7CNON.js.map