@getmodus/sdk 0.1.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 ADDED
@@ -0,0 +1,48 @@
1
+ # Changelog
2
+
3
+ **Current npm release:** not yet published. Pre-release via `@beta` dist-tag when available.
4
+
5
+ ## [Unreleased]
6
+
7
+ ### Changed
8
+
9
+ - npm package scope is **`@getmodus/sdk`** (npm org `getmodus`; `@modus` scope was unavailable). Install with `npm install @getmodus/sdk`.
10
+
11
+ ### Changed (BREAKING)
12
+
13
+ - **MCP `get_context_data` batch + ACL (BREAKING)** — Renamed from `fetch_context_file`. Pass `{ items[], sessionId? }` instead of top-level `itemId`. Response `{ results[] }` with per-item `ok` / errors (max 20). ACL + scope surface authorization; optional `sessionId` for Mongo offload cache.
14
+ - **`/scopes` + `/workflows` are now the only public surface.** `client.scopes` / `client.workflows` and `mgmt.scopes` / `mgmt.workflows` are canonical; they call the `/api/v1/scopes` and `/api/v1/workflows` routes and the `ScopesController_*` / `WorkflowsController_*` operationIds.
15
+ - Run creation: `client.workflows.runs.createScope(scopeId, body)` replaces the old `createSkill(...)` (routes to `/agent/v1/scopes/:id/runs`).
16
+ - Existing tokens that carry the legacy `skills:*` / `agents:*` scopes continue to authorize the renamed routes via server-side scope equivalence — no token re-issuance is required.
17
+
18
+ ### Removed (BREAKING)
19
+
20
+ - **`client.skills` / `client.agents`** and **`mgmt.skills` / `mgmt.agents`** accessors — use `client.scopes` / `client.workflows` and `mgmt.scopes` / `mgmt.workflows`. The legacy `/api/v1/skills` and `/api/v1/agents` routes (and their `SkillsController_*` / `AgentsController_*` operationIds) no longer exist.
21
+ - Placeholder `SECURITY.md` (no verified security contact yet).
22
+
23
+ ### Added
24
+
25
+ - Shipped examples under `examples/scripts/` (`quickstart`, `modus_chat`, `chat`, `manage_skill`) with revenue / ARR analyst prompts.
26
+ - `skills.conversations(id).get()` accepts an optional `{ messageLimit, beforeMessageIndex }` to request a bounded message window; the response gains an optional `messageWindow` field describing the returned slice. Omit both for the full conversation (unchanged default behavior).
27
+ - **`client.suggestions`** — `list()` returns approved suggested questions (optional `skillId`/`skillIds` filter), `recordEvent()` records an impression/click/dismiss event against a suggestion.
28
+ - **`client.workflows.runs.active(options)` / `activeBySession(sessionIds)`** — list active (queued/pending/running) conversation runs for the current user, or look up active runs for specific conversation thread ids.
29
+ - **`claude-sonnet-4.6`** restored as an allowed run `model` value (scope/workflow run creation and chat).
30
+ - **`mgmt.scopes.evaluations(scopeId)`** — `getConfig()` / `updateConfig()` manage a scope's evaluation schedule and judge settings; `triggerRun()` starts a manual evaluation run; `listRuns()` / `getRun(runId)` read run history and per-case results.
31
+
32
+ ### Fixed
33
+
34
+ - Typed run event streams now recover from interrupted model providers and emit `assistant_content_reset` when previously streamed assistant content is replaced.
35
+
36
+ ## [0.1.0] — 2026-06-21
37
+
38
+ ### Added
39
+
40
+ - **`@getmodus/sdk`** — official TypeScript client for Modus (Node.js 18+).
41
+ - **`Modus`** client — read / invoke: skills, agents, context, connections, Modus assistant chat, runs.
42
+ - **`ModusManagement`** (`@getmodus/sdk/management`) — configure: CRUD, deploy, context creators, usage, org admin.
43
+ - Cursor-based **`Page<T>`** pagination with `autoPagingIter()` (AIP-158 `pageSize` / `pageToken`).
44
+ - Automatic retry on 429 and 5xx with exponential backoff and `Retry-After` support.
45
+ - SSE streaming chat via `ChatStream` (`textStream()`, `eventStream()`).
46
+ - **58/58** public API operations covered; contract tests enforce OpenAPI parity.
47
+ - Dual **ESM + CommonJS** build (`import` and `require()`).
48
+ - Zero runtime dependencies.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) Modus
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,79 @@
1
+ # @getmodus/sdk
2
+
3
+ Official TypeScript client for Modus (pre-release).
4
+
5
+ **Runtime:** Node.js 18+. Ships **ESM** and **CommonJS**. Not intended for browsers or edge runtimes (uses Node APIs such as `process.env`).
6
+
7
+ ## Install (coming soon)
8
+
9
+ ```bash
10
+ npm install @getmodus/sdk@beta
11
+ ```
12
+
13
+ ## Usage
14
+
15
+ ### ESM (`import`)
16
+
17
+ ```ts
18
+ import { Modus } from '@getmodus/sdk'
19
+ import { ModusManagement } from '@getmodus/sdk/management'
20
+
21
+ const client = new Modus({ apiKey: process.env.MODUS_API_KEY })
22
+ const mgmt = new ModusManagement({ apiKey: process.env.MODUS_API_KEY })
23
+
24
+ const scopes = await client.scopes.list()
25
+ const draft = await mgmt.scopes.create({ name: 'Analyst', model: 'claude-sonnet-5' })
26
+ ```
27
+
28
+ ### CommonJS (`require`)
29
+
30
+ ```js
31
+ const { Modus } = require('@getmodus/sdk')
32
+ const { ModusManagement } = require('@getmodus/sdk/management')
33
+
34
+ const client = new Modus({ apiKey: process.env.MODUS_API_KEY })
35
+ ```
36
+
37
+ ## Examples
38
+
39
+ Runnable scripts (mirrored to the public GitHub repo):
40
+
41
+ - `examples/scripts/quickstart.ts` — list scopes and context (`Modus`)
42
+ - `examples/scripts/modus_chat.ts` — buffered and streaming Modus chat, context compose, conversations
43
+ - `examples/scripts/chat.ts` — buffered scope chat with thread follow-up
44
+ - `examples/scripts/manage_skill.ts` — create and deploy a scope (`ModusManagement`, `--write` optional)
45
+
46
+ ```bash
47
+ export MODUS_API_KEY=modus_xxx
48
+ npx tsx examples/scripts/quickstart.ts
49
+ ```
50
+
51
+ From the Modus monorepo (after build):
52
+
53
+ ```bash
54
+ pnpm nx run modus-sdk-typescript:build
55
+ MODUS_API_KEY=modus_xxx node --import tsx distribution/clients/typescript/modus-sdk/examples/scripts/quickstart.ts
56
+ ```
57
+
58
+ ## Development
59
+
60
+ From the Modus monorepo root:
61
+
62
+ ```bash
63
+ pnpm nx run modus-sdk-typescript:generate
64
+ pnpm nx run modus-sdk-typescript:build
65
+ pnpm nx run modus-sdk-typescript:test
66
+ ```
67
+
68
+ See [`../dev-examples/`](../dev-examples/) for additional runnable scripts (monorepo only).
69
+
70
+ ```bash
71
+ # Batch smoke (from repo root; uses .env for MODUS_API_KEY / MODUS_BASE_URL)
72
+ bash distribution/clients/typescript/dev-examples/run_all.sh
73
+ bash distribution/clients/typescript/dev-examples/run_all.sh --write
74
+ bash distribution/clients/typescript/dev-examples/run_all.sh --chat # LLM credits; needs healthy agent backend
75
+ ```
76
+
77
+ Shipped `chat.ts` accepts optional `MODUS_SCOPE_ID` to pick the scope. Chat may return `INTERNAL_ERROR` when the target environment's agent runtime is down — that is not an SDK bug.
78
+
79
+ See [CHANGELOG.md](./CHANGELOG.md) for release history.