@getmodus/sdk 0.10.0 → 0.12.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,6 +9,50 @@ release, including pre-1.0 (`0.x`) releases.
9
9
 
10
10
  ## [Unreleased]
11
11
 
12
+ ## [0.12.0] — 2026-11-21
13
+
14
+ ### Removed
15
+
16
+ - **MAJOR:** Custom context item relations no longer accept `content`. Use `edgeProperties` (`edge_properties` in Python) for a flat map of primitives or primitive arrays; omitting it replaces the map with `{}`.
17
+
18
+ ### Added
19
+
20
+ - **Personal tools in a toolset.** `PlatformToolsetEntry.personal` (`{ actions, rules? }`, beside `byConnection`) grants actions on the personal connection of whoever runs the skill. A runner who has not connected the platform is asked to connect it in chat, or gets a tool error elsewhere; nobody else's connection is used. Only platforms people connect personally (Gmail, Google Calendar, Google Drive and others) take it.
21
+ - **`personal` MCP exposure family.** `McpExposureFamily` includes `personal`: the MCP exposure catalog lists a platform's personal grant as one row (`toolset_personal:<platform>`, with `toolset_action:<platform>:personal:<action>` per tool) that runs on the own personal connection of whoever calls it.
22
+ - **`email` run source.** `RunSource` and `SupplementalContextSource` include `email`, for runs started by an email sent to a workflow's address; the conversation list's `source` filter accepts it. Only the email trigger records it: an API-token run asking for it still records its server-owned source (`api`, or `modus_api` for Modus runs), and `supplementalContext.source: 'email'` is refused with 400.
23
+ - **`attachments` and `origin` on a workflow run.** `workflows.runs.get()` (the run detail) includes `attachments`, the files the run was started with by name, with MIME type and size when known (a file the trigger left out carries `skipped.reason`, `too_large` or `too_many`), and `origin`, where the run came from (`source`, such as `api` or `schedule`; `unknown` for a run that did not record it). An email-started run will also carry `from`, `fromName` and `subject` when the email has them. Both fields can be absent on responses from older servers. File contents are not returned.
24
+ - **`includeOrgLearnings` on `scopes.create`.** The org-wide learnings path is added to a new scope's selections unless `includeOrgLearnings: false`, or `contextSelections` already mention learnings or are context filters without a rule-based query; the scope reads the entries the caller can see. They are a learnings path in the scope's context selections (`auto_generated:org`), so they can be removed or added later like the scope's own learnings; `includeOrgLearnings: false` only skips adding the path, and selections that already name it still read them.
25
+ - **Move into a folder path.** `mgmt.context.items.move(uid, { destinationFolderPath })` moves a file or folder to a root-relative path such as `reports/2026`; missing folders on the path are created with the move, and existing ones are reused. `{ destinationFolderUid }` is unchanged.
26
+ - Context item access updates now support organization learnings, with the same user and group sharing controls as notes.
27
+
28
+ ### Changed
29
+
30
+ - **`workflows.chat()` runs a workflow without a message or a model.** `message` defaults to `''` and `options` is optional, so `await client.workflows.chat(workflowId)` triggers a run with no input, like Run Now in the app. `workflows.runs.create()` accepts a body without `message` or `sessionId` too.
31
+ - A scope save that adds a personal connection's UUID to `<platform>.byConnection`, or adds actions to one stored there, is refused with 422 (`UnprocessableError`, rule `toolset.personal_connection`); grant it with `personal` instead. Sending a stored entry back unchanged, or with fewer actions, still saves.
32
+ - **Changed:** a workflow created without `accessConfig` (`workflows.create()`) is now private, with no group grants and no invitees; its creator can share it later. Pass an `accessConfig` with `visibility: 'shared'` for the previous behaviour. A service account token that omits it still creates the workflow shared with the whole organization. Existing workflows are unchanged.
33
+ - **Changed:** an unfiltered scope conversation list (or one filtered by user or timeframe) now includes conversations you did not take part in, but such a conversation carries only who took part and when: an empty first message, a null title and source, a message count of 0 and no tools. Each item has a new optional `ownedByCaller` that says whether you took part. Getting such a conversation, its files, or renaming it now fails with 404, whatever your role. A `toolName` or `source` filter matches only conversations you took part in, and combining either with another member's user id fails with 400.
34
+ - Custom context relation documentation lists reserved system names (`contains`, `reads`, `joins_with`, `has_context`, `has_feedback`, `filters_by`, `context_relation`) and explains that dotted names are reserved.
35
+
36
+ ### Deprecated
37
+
38
+ - **`model` on `workflows.chat()`** (`WorkflowChatOptions.model`). A workflow's steps run with the models set in the workflow, so the option was never used; it is no longer sent. The `config`, `fileThreadId`, `debug`, `experimentalFeatures` and `streamProtocolVersion` fields of a workflow run body are deprecated for the same reason: the server accepts and ignores them.
39
+
40
+ ### Removed
41
+
42
+ - **Breaking (pre-1.0): a scope read returns one `connectionSet` entry per connection.** `variation.connectionSet` is `{ connection_id: string; preferences?: Record<string, unknown> }[]`: `path` (one row per included path) and `context_enabled` are removed, so a connection appears once, with its `preferences`. `preferences` is absent only on the entry of a deleted connection, whose `connection_id` is a placeholder and which grants nothing. An entry with `preferences` can be sent back unchanged in `scopes.update()`; drop one without `preferences` first, or the write fails with 400 `legacy_entry`. Migration: read what a connection selects from its `preferences` instead of `path`.
43
+ - **Breaking (pre-1.0): `context_enabled` and `contextEnabled` are removed from scope writes.** A `connectionSet` entry in `scopes.create()` and `scopes.update()` is `{ connection_id, preferences }`, and a `setConnectionPreferences` op in `applySelectionOps()` is `{ op, connectionId, preferences }`. A scope reads context from every connection it lists. Sending `false` fails with 400 (`info.reason` `legacy_entry` on a `connectionSet` entry); `true` is ignored.
44
+
45
+ ## [0.11.0] — 2026-11-14
46
+
47
+ ### Added
48
+
49
+ - **`model` on a conversation.** Conversation reads include `model` (`string | null`), the identifier of the model the conversation's most recent turn ran on. `null` when no turn recorded a model; absent when it could not be read.
50
+ - **`context.items.query({ sql, maxRows? })`.** Runs one read-only SQL statement over the `context_items` table and returns `{ rows, rowCount, truncated }`. The query sees only the items you can read. At most 1,000 rows come back (`maxRows` lowers it); `truncated` says when there were more. A query that is not read-only or not valid fails with 400, and one that runs past 20 s with 422. Off by default per organization; ask Modus to enable it. `ContextItemsQuery` and `ContextItemsQueryResult` import from `@getmodus/sdk`.
51
+
52
+ ### Removed
53
+
54
+ - **Breaking (pre-1.0): scope writes send a connection's selection only as `preferences`.** Each `connectionSet` entry `scopes.create()` and `scopes.update()` send is `{ connection_id, preferences, context_enabled? }`: `path` is removed from the request and `preferences` is required. An entry with `path` or without `preferences` is rejected with 400 and `info.reason` `legacy_entry`. `applySelectionOps()` no longer takes `selectRoot`, `deselectRoot` or `setRootDeepRules`, nor their `path`, `includes` and `excludes` fields: set a connection with `setConnectionPreferences` and remove it with the new `removeConnection`. Reads still return one row per included path, with `path`, so turn a read into one entry per connection before you write it back.
55
+
12
56
  ## [0.10.0] — 2026-11-08
13
57
 
14
58
  ### Added
@@ -55,7 +99,7 @@ release, including pre-1.0 (`0.x`) releases.
55
99
  - **A refused run raises before any event.** When the agent host refuses a run (an empty turn, a scope you cannot see, a conflicting `Idempotency-Key`, a full conversation queue), `runs.create*`, `runs.resume` and `workflowActions` streams now raise the typed error for the HTTP status (`NotFoundError`, `PermissionDeniedError`, `ConflictError`, `RateLimitError`, or `ModusError` with `statusCode` 400) with the server's `code` and message, instead of yielding one `error` event. No SDK code changed: the host now answers with the real status. An `error` event still ends a run that fails after it started.
56
100
  - **Evaluation types are now accurate (were `Record<string, never>`).** `EvaluationRun` `finishedAt` and `avgScore`, and the result fields `actualOutput`, `passed`, `score`, `reasoning` and `wasPassingBefore`, are `string | null`, `number | null` or `boolean | null`, so they no longer need a cast. An evaluation recipient's `name` is `string | null`, and `slackUserIdByRecipient` is a string-keyed map. `startedAt` and `finishedAt` are ISO 8601 strings (the server sent a JavaScript date string before).
57
101
  - **Run request types document the API-token rules.** `message` notes the 32,000-character limit the server holds API tokens to, and `config.model` lists the models an API token may send.
58
- - **Breaking (pre-1.0): scope `connectionSet` rows have one shape.** `scopes.create` and `scopes.update` accept each entry only as `{ connection_id, path, preferences?, context_enabled? }`, where `path` is an array of strings, `preferences` an object and `context_enabled` a boolean. An empty path selects the whole connection. Any other field, a non-string path segment or an empty or null `connection_id` is rejected with 400; a null `connectionSet` clears the list. `variation.connectionSet` is now `{ connection_id: string; path: string[]; preferences?: Record<string, unknown>; context_enabled?: boolean }` instead of `Record<string, unknown>[]`.
102
+ - **Breaking (pre-1.0): scope `connectionSet` rows have one shape.** `scopes.create` and `scopes.update` accept each entry only as `{ connection_id, path?, preferences?, context_enabled? }`, where `path` is an array of strings, required unless `preferences` is sent and ignored when it is, `preferences` an object and `context_enabled` a boolean. An empty path selects the whole connection. Any other field, a non-string path segment or an empty or null `connection_id` is rejected with 400; a null `connectionSet` clears the list. `variation.connectionSet` is now `{ connection_id: string; path: string[]; preferences?: Record<string, unknown>; context_enabled?: boolean }` instead of `Record<string, unknown>[]`.
59
103
  - **Breaking (pre-1.0): workflow `guardrails` removed.** `workflows.create` and `workflows.update` no longer take `guardrails`. The workflow access configuration has no guardrails, so every call that set it failed with 400 and changed nothing. Scope `guardrails` are unchanged.
60
104
  - **Breaking (pre-1.0): `scopes.memories(id).update()` returns `Promise<void>`.** The server answers 204 with no body; the method returned `null` typed as `Memory`.
61
105
  - **Breaking (pre-1.0): `managerId` is `number | null`.** `scopes.update({ managerId })` takes the numeric id of the manager scope, or `null` to detach. It was typed `string`, which the server rejects with 400.
package/README.md CHANGED
@@ -170,6 +170,13 @@ for await (const chunk of live.textStream()) {
170
170
  for await (const item of (await client.context.items.list()).autoPagingIter()) {
171
171
  console.log(item.uid, item.description ?? item.uid)
172
172
  }
173
+
174
+ // One read-only SQL statement over the items you can read (at most 1,000 rows; `truncated` says when cut).
175
+ // Off by default for an organization; ask Modus to enable it.
176
+ const result = await client.context.items.query({
177
+ sql: 'SELECT context_type, count(*) AS items FROM context_items GROUP BY context_type ORDER BY items DESC',
178
+ })
179
+ console.log(result.rows, result.truncated)
173
180
  ```
174
181
 
175
182
  ### Workflows
@@ -281,7 +288,7 @@ console.log(access.canManage)
281
288
 
282
289
  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`.
283
290
 
284
- Updating a scope replaces whole lists such as `connectionSet`, `contextSelections`, and `evaluations`. Add or change one evaluation case with `scopes.evaluations(id).addCase`, `updateCase`, or `deleteCase`. Change one connection's selection with `applySelectionOps` (`validateOnly: true` previews and does not write). `selectRoot`, `deselectRoot`, and `setRootDeepRules` are deprecated.
291
+ Updating a scope replaces whole lists such as `connectionSet`, `contextSelections`, and `evaluations`. Add or change one evaluation case with `scopes.evaluations(id).addCase`, `updateCase`, or `deleteCase`. Change one connection's selection with `applySelectionOps` (`validateOnly: true` previews and does not write). Each `connectionSet` entry is `{ connection_id, preferences }`; remove a connection with the `removeConnection` op.
285
292
  ### Connection-specific toolsets
286
293
 
287
294
  Use the catalog platform key and an explicit lowercase connection UUID. SQL platforms