@mantyx/sdk 0.25.0 → 2026.9.3

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.
Files changed (47) hide show
  1. package/CHANGELOG.md +24 -1
  2. package/LICENSE +201 -0
  3. package/README.md +16 -7
  4. package/dist/a2a-server.cjs +0 -1
  5. package/dist/a2a-server.d.ts +0 -1
  6. package/dist/a2a-server.js +1 -2
  7. package/dist/{chunk-4EJRV6KZ.js → chunk-G46SVM2Q.js} +33 -2
  8. package/dist/client.d.ts +31 -1
  9. package/dist/computer-use.d.ts +0 -1
  10. package/dist/errors.d.ts +0 -1
  11. package/dist/index.cjs +34 -3
  12. package/dist/index.d.ts +1 -2
  13. package/dist/index.js +2 -3
  14. package/dist/local-resolver.d.ts +0 -1
  15. package/dist/oauth.d.ts +0 -1
  16. package/dist/playwright.cjs +0 -1
  17. package/dist/playwright.d.ts +0 -1
  18. package/dist/playwright.js +0 -1
  19. package/dist/sse.d.ts +0 -1
  20. package/dist/structured-output.d.ts +0 -1
  21. package/dist/tools.d.ts +0 -1
  22. package/dist/version.d.ts +2 -3
  23. package/dist/zod-to-json-schema.d.ts +0 -1
  24. package/docs/agent-runs-protocol.md +63 -4
  25. package/package.json +17 -18
  26. package/CONTRIBUTING.md +0 -72
  27. package/EXTRACT.md +0 -70
  28. package/dist/a2a-server.cjs.map +0 -1
  29. package/dist/a2a-server.d.ts.map +0 -1
  30. package/dist/a2a-server.js.map +0 -1
  31. package/dist/chunk-4EJRV6KZ.js.map +0 -1
  32. package/dist/client.d.ts.map +0 -1
  33. package/dist/computer-use.d.ts.map +0 -1
  34. package/dist/errors.d.ts.map +0 -1
  35. package/dist/index.cjs.map +0 -1
  36. package/dist/index.d.ts.map +0 -1
  37. package/dist/index.js.map +0 -1
  38. package/dist/local-resolver.d.ts.map +0 -1
  39. package/dist/oauth.d.ts.map +0 -1
  40. package/dist/playwright.cjs.map +0 -1
  41. package/dist/playwright.d.ts.map +0 -1
  42. package/dist/playwright.js.map +0 -1
  43. package/dist/sse.d.ts.map +0 -1
  44. package/dist/structured-output.d.ts.map +0 -1
  45. package/dist/tools.d.ts.map +0 -1
  46. package/dist/version.d.ts.map +0 -1
  47. package/dist/zod-to-json-schema.d.ts.map +0 -1
@@ -119,6 +119,7 @@ two differences:
119
119
  | ------------------------------------------------ | ---------------------- |
120
120
  | `GET .../models` | `models:read` |
121
121
  | `POST .../agent-runs` | `runs:write` |
122
+ | `GET .../agent-runs` | `runs:read` |
122
123
  | `GET .../agent-runs/{runId}` | `runs:read` |
123
124
  | `GET .../agent-runs/{runId}/stream` | `runs:read` |
124
125
  | `POST .../agent-runs/{runId}/cancel` | `runs:write` |
@@ -1146,6 +1147,7 @@ public `GET /agent-sessions` endpoint and the admin list endpoints; see
1146
1147
 
1147
1148
  ```
1148
1149
  POST /api/v1/workspaces/{slug}/agent-runs
1150
+ GET /api/v1/workspaces/{slug}/agent-runs
1149
1151
  GET /api/v1/workspaces/{slug}/agent-runs/{runId}
1150
1152
  GET /api/v1/workspaces/{slug}/agent-runs/{runId}/stream
1151
1153
  POST /api/v1/workspaces/{slug}/agent-runs/{runId}/tool-results
@@ -1164,6 +1166,52 @@ POST /api/v1/workspaces/{slug}/agent-runs/{runId}/feedback
1164
1166
 
1165
1167
  `GET .../stream` is the canonical event channel; see §7.
1166
1168
 
1169
+ `GET /agent-runs` returns compact calls newest-first. Pass its opaque
1170
+ `nextCursor` value back as `cursor` for stable keyset pagination. Supported
1171
+ filters are `status`, `modelId`, `agentId`, and repeatable, AND-combined
1172
+ `metadata=key:value`; `limit` defaults to 50 (max 200). Exact counts are
1173
+ skipped by default; `includeTotal=1` adds `total`.
1174
+
1175
+ ```json
1176
+ {
1177
+ "total": null,
1178
+ "limit": 50,
1179
+ "nextCursor": "eyJjcmVhdGVkQXQiOiIyMDI5…",
1180
+ "runs": [
1181
+ {
1182
+ "id": "run_abc",
1183
+ "sessionId": null,
1184
+ "status": "succeeded",
1185
+ "specName": "support-bot",
1186
+ "agentId": null,
1187
+ "modelId": "platform:demo",
1188
+ "inputPreview": "Where is my order?",
1189
+ "outputPreview": "It shipped on Tuesday.",
1190
+ "error": null,
1191
+ "tokens": {
1192
+ "inputTokens": 812,
1193
+ "cachedTokens": 0,
1194
+ "reasoningTokens": 0,
1195
+ "outputTokens": 96
1196
+ },
1197
+ "turns": 2,
1198
+ "durationMs": 4213,
1199
+ "toolCallCount": 1,
1200
+ "metadata": { "customer": "acme" },
1201
+ "createdAt": "2029-01-05T13:00:00.000Z",
1202
+ "completedAt": "2029-01-05T13:00:04.213Z"
1203
+ }
1204
+ ]
1205
+ }
1206
+ ```
1207
+
1208
+ The list is a projection, not a snapshot: `inputPreview` / `outputPreview` /
1209
+ `error` are truncated, and `total` is `null` unless `includeTotal=1`. Fetch
1210
+ `GET /agent-runs/{runId}` for full text, the spec, and `model`. `modelId`,
1211
+ `durationMs`, and `toolCallCount` are populated when the run reaches a
1212
+ terminal state; `agentId` is `null` for runs that did not target a saved
1213
+ workspace agent.
1214
+
1167
1215
  `GET /agent-runs/{runId}` returns the run snapshot (status, final text, error,
1168
1216
  spec, plus the cost-attribution triple `tokens` / `turns` / `model` —
1169
1217
  see §7.1) without subscribing to live events. Useful for polling long
@@ -1199,7 +1247,9 @@ application identifiers they attached at create time (see §4.9).
1199
1247
  | `metadata` | Repeatable `key:value` filter; AND-combined. Malformed entries return `400 invalid_request`. |
1200
1248
  | `status` | Optional exact match (`active` / `ended`). |
1201
1249
  | `limit` | Default `50`, max `200`. |
1202
- | `offset` | Default `0`. |
1250
+ | `cursor` | Opaque `nextCursor` from the prior page; preferred for deep paging. |
1251
+ | `offset` | Legacy fallback, default `0`; ignored when `cursor` is present. |
1252
+ | `includeTotal` | Defaults to true; set `0` to skip the exact count query. |
1203
1253
 
1204
1254
  ```http
1205
1255
  GET /api/v1/workspaces/acme/agent-sessions?metadata=customer:acme&metadata=env:prod&limit=20
@@ -1210,6 +1260,7 @@ GET /api/v1/workspaces/acme/agent-sessions?metadata=customer:acme&metadata=env:p
1210
1260
  "total": 1,
1211
1261
  "limit": 20,
1212
1262
  "offset": 0,
1263
+ "nextCursor": null,
1213
1264
  "sessions": [
1214
1265
  {
1215
1266
  "sessionId": "ses_abc",
@@ -1235,8 +1286,13 @@ stream (§7). Unknown session ids return `404 not_found`.
1235
1286
 
1236
1287
  | Query param | Notes |
1237
1288
  | -------------- | ------------------------------------------------------------------------------- |
1238
- | `full` | `1` / `true` returns every message (the default when no paging param is given). |
1239
- | `lastMessages` | Return only the last `N` messages. Ignored when `full` is set. |
1289
+ | `full` | `1` / `true` returns the complete history and overrides paging parameters. |
1290
+ | `lastMessages` | Opt into paging and return the last `N` messages (max 500). |
1291
+ | `beforeSeq` | Page backward from an earlier message sequence (default page size 100). |
1292
+
1293
+ For backwards compatibility, omitting all three parameters returns the complete
1294
+ history. New clients should use `lastMessages` and follow `nextBeforeSeq` for
1295
+ bounded reads.
1240
1296
 
1241
1297
  ```http
1242
1298
  GET /api/v1/workspaces/acme/agent-sessions/ses_abc/events?lastMessages=2
@@ -1250,12 +1306,15 @@ GET /api/v1/workspaces/acme/agent-sessions/ses_abc/events?lastMessages=2
1250
1306
  { "seq": 3, "type": "user_message", "text": "three" },
1251
1307
  { "seq": 4, "type": "assistant_message", "text": "four" },
1252
1308
  ],
1309
+ "nextBeforeSeq": 3,
1310
+ "truncated": true,
1253
1311
  }
1254
1312
  ```
1255
1313
 
1256
1314
  Frames use the flattened wire shape clients already consume from SSE
1257
1315
  (`{ seq, type, ...payload }`). `seq` is the message's position in the full
1258
- conversation (stable across paging). Reconstructed turns map as:
1316
+ conversation (stable across paging). `truncated` is true while older messages
1317
+ remain. Reconstructed turns map as:
1259
1318
 
1260
1319
  | Stored role | Frame `type` |
1261
1320
  | ----------- | ---------------------------------- |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mantyx/sdk",
3
- "version": "0.25.0",
3
+ "version": "2026.9.3",
4
4
  "description": "MANTYX as a hosted agent runtime: define ephemeral agents, mix server-side MANTYX tools with locally-executed tools, run them remotely.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -28,24 +28,14 @@
28
28
  "docs",
29
29
  "README.md",
30
30
  "CHANGELOG.md",
31
- "CONTRIBUTING.md",
32
- "EXTRACT.md"
31
+ "LICENSE"
33
32
  ],
34
- "scripts": {
35
- "sync-version": "node ../scripts/sync-version.mjs",
36
- "build": "tsup --config tsup.config.ts && tsc -p tsconfig.build.json",
37
- "dev": "tsup --config tsup.config.ts --watch",
38
- "typecheck": "tsc --noEmit",
39
- "test": "vitest run",
40
- "test:watch": "vitest",
41
- "prepublishOnly": "npm run build"
42
- },
43
33
  "engines": {
44
34
  "node": ">=18.17.0"
45
35
  },
46
36
  "dependencies": {
47
- "@modelcontextprotocol/sdk": "^1.29.0",
48
- "zod": "^4.4.3"
37
+ "@modelcontextprotocol/sdk": "^1.30.0",
38
+ "zod": "^4.6.5"
49
39
  },
50
40
  "peerDependencies": {
51
41
  "@a2a-js/sdk": "^0.3.0",
@@ -66,12 +56,12 @@
66
56
  "devDependencies": {
67
57
  "@a2a-js/sdk": "^0.3.14",
68
58
  "@types/express": "^5.0.6",
69
- "@types/node": "^26.1.1",
59
+ "@types/node": "^26.6.1",
70
60
  "express": "^5.2.1",
71
61
  "playwright": "^1.61.1",
72
62
  "tsup": "^8.5.1",
73
- "typescript": "^7.0.2",
74
- "vitest": "^4.1.10"
63
+ "typescript": "~7.0.2",
64
+ "vitest": "^4.1.11"
75
65
  },
76
66
  "keywords": [
77
67
  "mantyx",
@@ -85,5 +75,14 @@
85
75
  "license": "Apache-2.0",
86
76
  "publishConfig": {
87
77
  "access": "public"
78
+ },
79
+ "homepage": "https://mantyx-io.github.io/mantyx-sdk/",
80
+ "scripts": {
81
+ "sync-version": "node ../scripts/sync-version.mjs",
82
+ "build": "tsup --config tsup.config.ts && tsc -p tsconfig.build.json",
83
+ "dev": "tsup --config tsup.config.ts --watch",
84
+ "typecheck": "tsc --noEmit",
85
+ "test": "vitest run",
86
+ "test:watch": "vitest"
88
87
  }
89
- }
88
+ }
package/CONTRIBUTING.md DELETED
@@ -1,72 +0,0 @@
1
- # Contributing to `@mantyx/sdk`
2
-
3
- Thanks for considering a contribution! This SDK is a small, dependency-light
4
- client for the [MANTYX](https://mantyx.com) agent-runs HTTP/SSE protocol; the
5
- goal is to keep it that way.
6
-
7
- ## Ground rules
8
-
9
- 1. **Public-protocol only.** The SDK MUST NOT depend on any MANTYX-internal
10
- package, type, or repository layout. Anything it does is a side effect of
11
- sending HTTP requests against the public protocol documented in
12
- [`docs/agent-runs-protocol.md`](./docs/agent-runs-protocol.md).
13
- 2. **No `workspace:*`.** The SDK ships to npm as a standalone package. Pull
14
- requests that introduce a `workspace:*` dependency in `package.json` will
15
- not be merged.
16
- 3. **Tiny dep tree.** The only runtime dependency today is `zod`. Adding a
17
- new runtime dependency requires a strong justification.
18
- 4. **Standalone tests.** `pnpm test` must pass with `node_modules/` populated
19
- from this package's own `package.json`, with no MANTYX server running.
20
- 5. **Backwards compatibility.** Bump the SDK version per
21
- [SemVer](https://semver.org/spec/v2.0.0.html). Breaking changes need a
22
- major version bump and a `CHANGELOG.md` entry.
23
-
24
- ## Local setup
25
-
26
- ```bash
27
- pnpm install
28
- pnpm test
29
- pnpm typecheck
30
- pnpm build
31
- ```
32
-
33
- The repository is a pnpm monorepo, but this package is a leaf with no
34
- internal consumers, so it is safe to develop in isolation.
35
-
36
- ## Adding tests
37
-
38
- Tests live under [`test/`](./test) and use Vitest. Network calls are routed
39
- through the in-process mock server in
40
- [`test/helpers/mock-server.ts`](./test/helpers/mock-server.ts) — extend it
41
- when you need to exercise a new server behaviour rather than reaching out to
42
- a real MANTYX instance.
43
-
44
- When fixing a bug, prefer a regression test against the mock server. When
45
- adding a feature, add an example under [`examples/`](./examples) that
46
- exercises it end-to-end.
47
-
48
- ## Style
49
-
50
- - TypeScript strict mode. No `any` unless there's no choice.
51
- - Public types are re-exported from [`src/index.ts`](./src/index.ts). Keep
52
- the public surface minimal and well-typed.
53
- - Use `MantyxError` (and its subclasses) for thrown errors so callers can
54
- branch on `instanceof`.
55
- - Prefer the Web `fetch` / `ReadableStream` APIs over Node-only modules so
56
- the SDK keeps working in edge / browser-like runtimes.
57
-
58
- ## Pull requests
59
-
60
- 1. Fork and create a feature branch.
61
- 2. Add or update tests.
62
- 3. `pnpm test && pnpm typecheck && pnpm build`.
63
- 4. Use [Conventional Commits](https://www.conventionalcommits.org/) with scope `ts` — `CHANGELOG.md` is regenerated from git history on release (do not edit it by hand).
64
- 5. Open a PR. Describe the change and any protocol implications.
65
-
66
- ## Releasing
67
-
68
- Releases are handled by the shared **Publish** GitHub Actions workflow on `main` (lockstep across all three SDKs). See the [top-level CONTRIBUTING.md](../CONTRIBUTING.md#releasing). The npm tag is `vX.Y.Z`; do not publish or tag manually from this package.
69
-
70
- ## Code of Conduct
71
-
72
- Be kind. Assume good intent. Be patient with reviewers and maintainers.
package/EXTRACT.md DELETED
@@ -1,70 +0,0 @@
1
- # Extracting `@mantyx/sdk` into its own repository
2
-
3
- The `@mantyx/sdk` package is intentionally self-contained. Lifting it out of
4
- the MANTYX monorepo into a public repository is a five-minute job:
5
-
6
- ## Steps
7
-
8
- 1. Copy this folder verbatim:
9
-
10
- ```bash
11
- cp -r packages/mantyx-sdk/ts ~/code/mantyx-sdk
12
- cd ~/code/mantyx-sdk
13
- ```
14
-
15
- 2. Initialize git:
16
-
17
- ```bash
18
- git init -b main
19
- git add .
20
- git commit -m "Import @mantyx/sdk from monorepo"
21
- ```
22
-
23
- 3. Re-generate the lockfile against npm:
24
-
25
- ```bash
26
- rm -rf node_modules
27
- pnpm install # or: npm install
28
- ```
29
-
30
- 4. Update `examples/*/package.json` so each example installs `@mantyx/sdk`
31
- from npm rather than via the monorepo's pnpm workspace symlink. Each
32
- example already sets the dep to `"@mantyx/sdk": "*"`; replace `"*"` with
33
- the published version once you've cut a release.
34
-
35
- 5. Confirm the test suite still passes:
36
-
37
- ```bash
38
- pnpm test
39
- pnpm typecheck
40
- pnpm build
41
- ```
42
-
43
- 6. Push to a new GitHub repo and (optionally) wire up CI by copying
44
- `.github/workflows/sdk-typescript.yml` from the monorepo into
45
- `.github/workflows/ci.yml` in the new repo.
46
-
47
- ## What you can leave behind
48
-
49
- The following monorepo-only files do **not** apply to a standalone repo:
50
-
51
- - The MANTYX monorepo's root `pnpm-workspace.yaml`, `AGENTS.md`, `run.sh`,
52
- `infra/`, `mobile/`, etc. None of them are required by the SDK.
53
-
54
- ## Things to update once extracted
55
-
56
- - `package.json` `repository`, `homepage`, and `bugs` URLs.
57
- - `README.md` install instructions if the package name changes (e.g. you
58
- publish under a different scope).
59
- - The `DEFAULT_BASE_URL` constant in `src/client.ts` if you intend to talk to
60
- a non-default MANTYX deployment.
61
-
62
- ## What stays the same
63
-
64
- - The wire protocol the SDK speaks (`docs/agent-runs-protocol.md`).
65
- - The `MantyxClient` API surface.
66
- - The example projects.
67
- - Tests and the mock server (zero MANTYX dependencies).
68
-
69
- That's it. The extracted package can be built, tested, and published from
70
- any environment with Node.js 18.17+ installed.