@cyanheads/mcp-ts-core 0.13.1 → 0.13.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.
- package/AGENTS.md +7 -7
- package/CLAUDE.md +7 -7
- package/README.md +2 -2
- package/changelog/0.12.x/0.12.2.md +1 -1
- package/changelog/0.13.x/0.13.2.md +43 -0
- package/changelog/0.13.x/0.13.3.md +44 -0
- package/changelog/0.8.x/0.8.11.md +2 -2
- package/dist/mcp-server/resources/utils/resourceHandlerFactory.d.ts.map +1 -1
- package/dist/mcp-server/resources/utils/resourceHandlerFactory.js +17 -9
- package/dist/mcp-server/resources/utils/resourceHandlerFactory.js.map +1 -1
- package/dist/mcp-server/tools/utils/toolHandlerFactory.d.ts +22 -2
- package/dist/mcp-server/tools/utils/toolHandlerFactory.d.ts.map +1 -1
- package/dist/mcp-server/tools/utils/toolHandlerFactory.js +216 -20
- package/dist/mcp-server/tools/utils/toolHandlerFactory.js.map +1 -1
- package/dist/mcp-server/transports/http/serverCard.d.ts +23 -0
- package/dist/mcp-server/transports/http/serverCard.d.ts.map +1 -1
- package/dist/mcp-server/transports/http/serverCard.js +7 -0
- package/dist/mcp-server/transports/http/serverCard.js.map +1 -1
- package/dist/testing/index.d.ts +5 -0
- package/dist/testing/index.d.ts.map +1 -1
- package/dist/testing/index.js +7 -2
- package/dist/testing/index.js.map +1 -1
- package/dist/utils/internal/error-handler/errorHandler.d.ts +33 -0
- package/dist/utils/internal/error-handler/errorHandler.d.ts.map +1 -1
- package/dist/utils/internal/error-handler/errorHandler.js +45 -3
- package/dist/utils/internal/error-handler/errorHandler.js.map +1 -1
- package/framework-skills/add-tool/SKILL.md +3 -3
- package/framework-skills/api-errors/SKILL.md +14 -9
- package/framework-skills/api-testing/SKILL.md +3 -1
- package/framework-skills/git-wrapup/SKILL.md +11 -7
- package/framework-skills/orchestrations/SKILL.md +3 -3
- package/framework-skills/polish-docs-meta/SKILL.md +4 -3
- package/framework-skills/release-and-publish/SKILL.md +6 -6
- package/framework-skills/release-pr-review/SKILL.md +16 -23
- package/framework-skills/tool-defs-analysis/SKILL.md +4 -4
- package/package.json +6 -6
- package/scripts/build.ts +28 -6
- package/scripts/clean-mcpb.ts +8 -2
- package/scripts/clean.ts +40 -4
- package/scripts/devcheck.ts +46 -15
- package/scripts/lint-packaging.ts +79 -4
- package/templates/.github/workflows/codeql.yml +39 -0
- package/templates/AGENTS.md +3 -1
- package/templates/CLAUDE.md +3 -1
- package/templates/package.json +2 -2
- package/templates/src/index.ts +4 -3
package/AGENTS.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# Developer Protocol
|
|
2
2
|
|
|
3
3
|
**Package:** `@cyanheads/mcp-ts-core`
|
|
4
|
-
**Version:** 0.13.
|
|
4
|
+
**Version:** 0.13.3
|
|
5
5
|
**Engines:** Bun ≥1.4.0, Node ≥24.0.0
|
|
6
6
|
**MCP SDK:** `@modelcontextprotocol/server` ^2.0.0 (protocol revisions 2026-07-28 and 2025-*)
|
|
7
|
-
**Zod:** ^4.6.
|
|
7
|
+
**Zod:** ^4.6.5
|
|
8
8
|
**GitHub:** [cyanheads/mcp-ts-core](https://github.com/cyanheads/mcp-ts-core)
|
|
9
9
|
**npm:** [@cyanheads/mcp-ts-core](https://www.npmjs.com/package/@cyanheads/mcp-ts-core)
|
|
10
10
|
**Docker:** [ghcr.io/cyanheads/mcp-ts-core](https://ghcr.io/cyanheads/mcp-ts-core)
|
|
@@ -22,7 +22,7 @@ This package serves two consumer paths. When making changes, know which audience
|
|
|
22
22
|
| **Direct package import** — existing project pulls in the package | `bun add @cyanheads/mcp-ts-core` → `import { createApp, tool, z } from '@cyanheads/mcp-ts-core'` | Public API surface (`src/`) — existing consumers feel changes immediately on upgrade |
|
|
23
23
|
| **Init-scaffolded server** — fresh project bootstrapped from this repo's templates | `bunx @cyanheads/mcp-ts-core init [name]` copies `templates/` into the new directory | `templates/` — only affects newly scaffolded servers, not existing ones |
|
|
24
24
|
|
|
25
|
-
Both paths share the same public API. Init copies starter `package.json`, configs (`tsconfig`, `biome.json`, `vitest.config.ts`, `devcheck.config.json`, `bunfig.toml`), `.env.example`, `Dockerfile`, `LICENSE`, `.gitattributes`, `CLAUDE.md`/`AGENTS.md`, `.github/` (issue forms, `CONTRIBUTING.md`, `CODE_OF_CONDUCT.md`, `SECURITY.md`), example definitions and tests, framework `scripts/`, and external-audience `framework-skills/`. `_`-prefixed files (e.g. `_.gitignore`) drop the prefix on copy. Existing files are never overwritten; `init` without a name scaffolds in place (upgrade flow). After init, consult the `setup` skill.
|
|
25
|
+
Both paths share the same public API. Init copies starter `package.json`, configs (`tsconfig`, `biome.json`, `vitest.config.ts`, `devcheck.config.json`, `bunfig.toml`), `.env.example`, `Dockerfile`, `LICENSE`, `.gitattributes`, `CLAUDE.md`/`AGENTS.md`, `.github/` (issue forms, `CONTRIBUTING.md`, `CODE_OF_CONDUCT.md`, `SECURITY.md`, `workflows/codeql.yml`), example definitions and tests, framework `scripts/`, and external-audience `framework-skills/`. `_`-prefixed files (e.g. `_.gitignore`) drop the prefix on copy. Existing files are never overwritten; `init` without a name scaffolds in place (upgrade flow). After init, consult the `setup` skill.
|
|
26
26
|
|
|
27
27
|
---
|
|
28
28
|
|
|
@@ -414,9 +414,9 @@ Available factories: `invalidParams`, `invalidRequest`, `notFound`, `forbidden`,
|
|
|
414
414
|
|
|
415
415
|
For HTTP responses from upstream APIs, use `httpErrorFromResponse(response, { service, data })` from `/utils` — maps the full status table (401/403/408/422/429/5xx) and captures body + `Retry-After`.
|
|
416
416
|
|
|
417
|
-
**Auto-classification.** Plain `Error`, `ZodError`, and any other thrown value are caught and classified automatically. Resolution order: `McpError` code (preserved as-is) → SDK `ConnectionClosed` (→ `RequestCancelled`) → JS constructor name (`TypeError` → `ValidationError`) → provider patterns (HTTP status codes, AWS errors, DB errors) → common message patterns → `AbortError` name (→ `Timeout`) → `InternalError` fallback.
|
|
417
|
+
**Auto-classification.** Plain `Error`, `ZodError`, and any other thrown value are caught and classified automatically. Resolution order: request signal already aborted (→ `RequestCancelled`, outranking the thrown value's own code, `McpError` included) → `McpError` code (preserved as-is) → SDK `ConnectionClosed` (→ `RequestCancelled`) → JS constructor name (`TypeError` → `ValidationError`) → provider patterns (HTTP status codes, AWS errors, DB errors) → common message patterns → `AbortError` name (→ `Timeout`) → `InternalError` fallback.
|
|
418
418
|
|
|
419
|
-
**Error-path parity.** Tool errors: `content[]` carries markdown with `data.recovery.hint`; `structuredContent.error` carries `{ code, message, data? }`. No `_meta.error`. Resources re-throw via JSON-RPC error envelope.
|
|
419
|
+
**Error-path parity.** Tool errors: `content[]` carries markdown with `data.recovery.hint`; `structuredContent.error` carries `{ code, message, data? }`. No `_meta.error`. Resources re-throw via JSON-RPC error envelope. An argument rejection is one of them: `-32602` with `data.issues`, plus `data.reason: 'invalid_arguments'` and a hint synthesized from the issues and the root schema — never a tool-declared `reason`, since the handler never ran.
|
|
420
420
|
|
|
421
421
|
**Lint rules** (all warnings, surfaced in `devcheck`): `prefer-mcp-error-in-handler`, `prefer-error-factory`, `preserve-cause-on-rethrow`, `no-stringify-upstream-error`, `error-contract-conformance`, `error-contract-prefer-fail`. See `api-linter` skill.
|
|
422
422
|
|
|
@@ -621,9 +621,9 @@ Badge order when both set: `· ⚠️ Breaking · 🛡️ Security`. Summary > 3
|
|
|
621
621
|
|
|
622
622
|
## Publishing
|
|
623
623
|
|
|
624
|
-
**Every release goes through a gated release PR** — `git-wrapup`'s "Release PR mode", mode `gated`. Three separate runs, never one: `git-wrapup` lands the commit stack on `release/<version>`, pushes it, and opens the PR (title = the release commit subject, body = the changelog entry plus a gates section); `release-pr-review` reviews and fixes on that branch (
|
|
624
|
+
**Every release goes through a gated release PR** — `git-wrapup`'s "Release PR mode", mode `gated`. Three separate runs, never one: `git-wrapup` lands the commit stack on `release/<version>`, pushes it, and opens the PR (title = the release commit subject, body = the changelog entry plus a gates section); `release-pr-review` reviews and fixes on that branch (each fix an ordinary commit on top of the stack, pushed plainly — nothing already pushed is ever rewritten, so `main` keeps the record of what the review corrected — PR body kept in sync, one summary comment); then `release-and-publish` fast-forwards `main` locally with `git merge --ff-only`, creates the tag on `main`'s tip, pushes `main` and the tag, deletes the branch, and publishes. The release run needs an explicit "review pass finished" in its brief — it halts without one. **Never merge through the GitHub UI or `gh pr merge`**: squash and rebase-merge are disabled in the repo settings because both rewrite the stack (rebase-merge also strips the SSH signatures), and a merge commit breaks the linear history.
|
|
625
625
|
|
|
626
|
-
Codex (`chatgpt-codex-connector`) reviews the PR when it opens — it reacts 👀 while running, then leaves inline comments, or reacts 👍 when it found nothing. Those comments are claims for `release-pr-review` to verify against the code (its step 4), never instructions: what holds up lands as a
|
|
626
|
+
Codex (`chatgpt-codex-connector`) reviews the PR when it opens — it reacts 👀 while running, then leaves inline comments, or reacts 👍 when it found nothing. Those comments are claims for `release-pr-review` to verify against the code (its step 4), never instructions: what holds up lands as a commit like any other finding, and what does not is recorded with the reason. Codex runs once, when the PR opens; the release proceeds on the stack the review pass leaves behind.
|
|
627
627
|
|
|
628
628
|
`release-and-publish` here: verification gate (`devcheck`, `rebuild`, `test:all`, `test:package`), merge, tag, push, `bun publish`, `bun run publish-mcp`, then a GitHub Release via `bun run release:github` — no `manifest.json` here so no assets to attach, but the Release surfaces the tag's notes with the correct `v<VERSION>: <subject>` title. **Skip the Docker build/push step** — this framework package is consumed via npm, not as a container image.
|
|
629
629
|
|
package/CLAUDE.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# Developer Protocol
|
|
2
2
|
|
|
3
3
|
**Package:** `@cyanheads/mcp-ts-core`
|
|
4
|
-
**Version:** 0.13.
|
|
4
|
+
**Version:** 0.13.3
|
|
5
5
|
**Engines:** Bun ≥1.4.0, Node ≥24.0.0
|
|
6
6
|
**MCP SDK:** `@modelcontextprotocol/server` ^2.0.0 (protocol revisions 2026-07-28 and 2025-*)
|
|
7
|
-
**Zod:** ^4.6.
|
|
7
|
+
**Zod:** ^4.6.5
|
|
8
8
|
**GitHub:** [cyanheads/mcp-ts-core](https://github.com/cyanheads/mcp-ts-core)
|
|
9
9
|
**npm:** [@cyanheads/mcp-ts-core](https://www.npmjs.com/package/@cyanheads/mcp-ts-core)
|
|
10
10
|
**Docker:** [ghcr.io/cyanheads/mcp-ts-core](https://ghcr.io/cyanheads/mcp-ts-core)
|
|
@@ -22,7 +22,7 @@ This package serves two consumer paths. When making changes, know which audience
|
|
|
22
22
|
| **Direct package import** — existing project pulls in the package | `bun add @cyanheads/mcp-ts-core` → `import { createApp, tool, z } from '@cyanheads/mcp-ts-core'` | Public API surface (`src/`) — existing consumers feel changes immediately on upgrade |
|
|
23
23
|
| **Init-scaffolded server** — fresh project bootstrapped from this repo's templates | `bunx @cyanheads/mcp-ts-core init [name]` copies `templates/` into the new directory | `templates/` — only affects newly scaffolded servers, not existing ones |
|
|
24
24
|
|
|
25
|
-
Both paths share the same public API. Init copies starter `package.json`, configs (`tsconfig`, `biome.json`, `vitest.config.ts`, `devcheck.config.json`, `bunfig.toml`), `.env.example`, `Dockerfile`, `LICENSE`, `.gitattributes`, `CLAUDE.md`/`AGENTS.md`, `.github/` (issue forms, `CONTRIBUTING.md`, `CODE_OF_CONDUCT.md`, `SECURITY.md`), example definitions and tests, framework `scripts/`, and external-audience `framework-skills/`. `_`-prefixed files (e.g. `_.gitignore`) drop the prefix on copy. Existing files are never overwritten; `init` without a name scaffolds in place (upgrade flow). After init, consult the `setup` skill.
|
|
25
|
+
Both paths share the same public API. Init copies starter `package.json`, configs (`tsconfig`, `biome.json`, `vitest.config.ts`, `devcheck.config.json`, `bunfig.toml`), `.env.example`, `Dockerfile`, `LICENSE`, `.gitattributes`, `CLAUDE.md`/`AGENTS.md`, `.github/` (issue forms, `CONTRIBUTING.md`, `CODE_OF_CONDUCT.md`, `SECURITY.md`, `workflows/codeql.yml`), example definitions and tests, framework `scripts/`, and external-audience `framework-skills/`. `_`-prefixed files (e.g. `_.gitignore`) drop the prefix on copy. Existing files are never overwritten; `init` without a name scaffolds in place (upgrade flow). After init, consult the `setup` skill.
|
|
26
26
|
|
|
27
27
|
---
|
|
28
28
|
|
|
@@ -414,9 +414,9 @@ Available factories: `invalidParams`, `invalidRequest`, `notFound`, `forbidden`,
|
|
|
414
414
|
|
|
415
415
|
For HTTP responses from upstream APIs, use `httpErrorFromResponse(response, { service, data })` from `/utils` — maps the full status table (401/403/408/422/429/5xx) and captures body + `Retry-After`.
|
|
416
416
|
|
|
417
|
-
**Auto-classification.** Plain `Error`, `ZodError`, and any other thrown value are caught and classified automatically. Resolution order: `McpError` code (preserved as-is) → SDK `ConnectionClosed` (→ `RequestCancelled`) → JS constructor name (`TypeError` → `ValidationError`) → provider patterns (HTTP status codes, AWS errors, DB errors) → common message patterns → `AbortError` name (→ `Timeout`) → `InternalError` fallback.
|
|
417
|
+
**Auto-classification.** Plain `Error`, `ZodError`, and any other thrown value are caught and classified automatically. Resolution order: request signal already aborted (→ `RequestCancelled`, outranking the thrown value's own code, `McpError` included) → `McpError` code (preserved as-is) → SDK `ConnectionClosed` (→ `RequestCancelled`) → JS constructor name (`TypeError` → `ValidationError`) → provider patterns (HTTP status codes, AWS errors, DB errors) → common message patterns → `AbortError` name (→ `Timeout`) → `InternalError` fallback.
|
|
418
418
|
|
|
419
|
-
**Error-path parity.** Tool errors: `content[]` carries markdown with `data.recovery.hint`; `structuredContent.error` carries `{ code, message, data? }`. No `_meta.error`. Resources re-throw via JSON-RPC error envelope.
|
|
419
|
+
**Error-path parity.** Tool errors: `content[]` carries markdown with `data.recovery.hint`; `structuredContent.error` carries `{ code, message, data? }`. No `_meta.error`. Resources re-throw via JSON-RPC error envelope. An argument rejection is one of them: `-32602` with `data.issues`, plus `data.reason: 'invalid_arguments'` and a hint synthesized from the issues and the root schema — never a tool-declared `reason`, since the handler never ran.
|
|
420
420
|
|
|
421
421
|
**Lint rules** (all warnings, surfaced in `devcheck`): `prefer-mcp-error-in-handler`, `prefer-error-factory`, `preserve-cause-on-rethrow`, `no-stringify-upstream-error`, `error-contract-conformance`, `error-contract-prefer-fail`. See `api-linter` skill.
|
|
422
422
|
|
|
@@ -621,9 +621,9 @@ Badge order when both set: `· ⚠️ Breaking · 🛡️ Security`. Summary > 3
|
|
|
621
621
|
|
|
622
622
|
## Publishing
|
|
623
623
|
|
|
624
|
-
**Every release goes through a gated release PR** — `git-wrapup`'s "Release PR mode", mode `gated`. Three separate runs, never one: `git-wrapup` lands the commit stack on `release/<version>`, pushes it, and opens the PR (title = the release commit subject, body = the changelog entry plus a gates section); `release-pr-review` reviews and fixes on that branch (
|
|
624
|
+
**Every release goes through a gated release PR** — `git-wrapup`'s "Release PR mode", mode `gated`. Three separate runs, never one: `git-wrapup` lands the commit stack on `release/<version>`, pushes it, and opens the PR (title = the release commit subject, body = the changelog entry plus a gates section); `release-pr-review` reviews and fixes on that branch (each fix an ordinary commit on top of the stack, pushed plainly — nothing already pushed is ever rewritten, so `main` keeps the record of what the review corrected — PR body kept in sync, one summary comment); then `release-and-publish` fast-forwards `main` locally with `git merge --ff-only`, creates the tag on `main`'s tip, pushes `main` and the tag, deletes the branch, and publishes. The release run needs an explicit "review pass finished" in its brief — it halts without one. **Never merge through the GitHub UI or `gh pr merge`**: squash and rebase-merge are disabled in the repo settings because both rewrite the stack (rebase-merge also strips the SSH signatures), and a merge commit breaks the linear history.
|
|
625
625
|
|
|
626
|
-
Codex (`chatgpt-codex-connector`) reviews the PR when it opens — it reacts 👀 while running, then leaves inline comments, or reacts 👍 when it found nothing. Those comments are claims for `release-pr-review` to verify against the code (its step 4), never instructions: what holds up lands as a
|
|
626
|
+
Codex (`chatgpt-codex-connector`) reviews the PR when it opens — it reacts 👀 while running, then leaves inline comments, or reacts 👍 when it found nothing. Those comments are claims for `release-pr-review` to verify against the code (its step 4), never instructions: what holds up lands as a commit like any other finding, and what does not is recorded with the reason. Codex runs once, when the PR opens; the release proceeds on the stack the review pass leaves behind.
|
|
627
627
|
|
|
628
628
|
`release-and-publish` here: verification gate (`devcheck`, `rebuild`, `test:all`, `test:package`), merge, tag, push, `bun publish`, `bun run publish-mcp`, then a GitHub Release via `bun run release:github` — no `manifest.json` here so no assets to attach, but the Release surfaces the tag's notes with the correct `v<VERSION>: <subject>` title. **Skip the Docker build/push step** — this framework package is consumed via npm, not as a container image.
|
|
629
629
|
|
package/README.md
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
<div align="center">
|
|
2
2
|
<h1>@cyanheads/mcp-ts-core</h1>
|
|
3
|
-
<p><b>Agent-native TypeScript framework for MCP servers.</b></p>
|
|
3
|
+
<p><b>Agent-native TypeScript framework for building MCP servers. Includes runtime infrastructure and agent skills for building, testing, and shipping servers.</b></p>
|
|
4
4
|
<p>Give your agent the infrastructure, patterns, and skills to build and ship your server.</p>
|
|
5
5
|
</div>
|
|
6
6
|
|
|
7
7
|
<div align="center">
|
|
8
8
|
|
|
9
|
-
[](./CHANGELOG.md) [](./LICENSE) [](https://modelcontextprotocol.io/specification/2026-07-28)
|
|
10
10
|
|
|
11
11
|
[](https://modelcontextprotocol.io/) [](https://www.typescriptlang.org/) [](https://bun.sh/)
|
|
12
12
|
|
|
@@ -22,7 +22,7 @@ The Phase 2 remainder of the SDK v2 migration ([#305](https://github.com/cyanhea
|
|
|
22
22
|
|
|
23
23
|
## Fixed
|
|
24
24
|
|
|
25
|
-
- **`transport.sessionMode` reports the mode the server actually runs in, never `auto`** ([#357](https://github.com/cyanheads/mcp-ts-core/issues/357)). A default HTTP deployment serves sessions statefully while
|
|
25
|
+
- **`transport.sessionMode` reports the mode the server actually runs in, never `auto`** ([#357](https://github.com/cyanheads/mcp-ts-core/issues/357)). A default HTTP deployment serves sessions statefully while the `GET /mcp` status JSON reported `auto`; it reads `stateful` there now.
|
|
26
26
|
|
|
27
27
|
## Dependencies
|
|
28
28
|
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
---
|
|
2
|
+
summary: "A fresh init scaffold builds again — the shipped build scripts resolve both tsconfig layouts — and devcheck gains a README version-badge check. runToolContract rejects out-of-schema arguments with the InvalidParams envelope a client actually receives."
|
|
3
|
+
breaking: false
|
|
4
|
+
security: false
|
|
5
|
+
agent-notes: |
|
|
6
|
+
Two adoption steps for a consumer upgrading from 0.13.1.
|
|
7
|
+
|
|
8
|
+
1. A test asserting `ValidationError` (`-32007`) on an argument rejection
|
|
9
|
+
through `runToolContract` now receives `InvalidParams` (`-32602`) with the
|
|
10
|
+
production message — flip the assertion. Message assertions hold either
|
|
11
|
+
way, since both texts name the offending field.
|
|
12
|
+
2. After the next `scripts/` sync, `devcheck` fails when the `README.md`
|
|
13
|
+
`Version-` badge disagrees with the `package.json` `version`. Fix the
|
|
14
|
+
badge before syncing.
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
# 0.13.2 — 2026-09-13
|
|
18
|
+
|
|
19
|
+
## Added
|
|
20
|
+
|
|
21
|
+
- **`lint:packaging` check 12 — README version badge parity** ([#418](https://github.com/cyanheads/mcp-ts-core/issues/418)). A shields.io `Version-<semver>-` badge in `README.md` must carry the `package.json` `version`, with `--` decoded so a prerelease matches. `devcheck`'s Packaging step now triggers on `README.md` too, so the check gates a project carrying no bundle or plugin metadata.
|
|
22
|
+
- **Server card publishes the resolved session mode** ([#387](https://github.com/cyanheads/mcp-ts-core/issues/387)) under the `_meta` key `io.github.cyanheads.mcp-ts-core/sessionMode` — `stateful` or `stateless`, never `auto`. SEP-2127 closes the card's top-level field set, so it ships as a namespaced extension; every field the card already emitted is unchanged.
|
|
23
|
+
|
|
24
|
+
## Changed
|
|
25
|
+
|
|
26
|
+
- **Sync-guarantee comments in `scripts/clean-mcpb.ts` and `scripts/lint-packaging.ts` read true in a consumer's copy** ([#313](https://github.com/cyanheads/mcp-ts-core/issues/313)). The four `AGENT_DOC_ENTRY` / `NATIVE_BINDING_ENTRY` blocks no longer claim a unit test enforces the pair where `tests/` never ships, and the `KNOWN_DEV_DIRS` note names `.mcpbignore` rather than `templates/_.mcpbignore`.
|
|
27
|
+
- **`add-tool` skill and the 0.8.11 entry drop the server-card disabled-tool claim** ([#409](https://github.com/cyanheads/mcp-ts-core/issues/409)). The card carries no per-tool entries; the landing page is the only surface that renders a disabled tool.
|
|
28
|
+
- **0.12.2's session-mode entry names `GET /mcp`** — the surface that actually reported the resolved mode, rather than the landing page and server card it claimed (#387).
|
|
29
|
+
- **README tagline matches the `package.json` `description` verbatim.**
|
|
30
|
+
- Skill versions: `add-tool` 2.25 → 2.26, `api-testing` 1.9 → 1.10, `git-wrapup` 1.16 → 1.17, `polish-docs-meta` 2.16 → 2.17.
|
|
31
|
+
|
|
32
|
+
## Fixed
|
|
33
|
+
|
|
34
|
+
- **`scripts/build.ts` resolves the build tsconfig in either layout** ([#440](https://github.com/cyanheads/mcp-ts-core/issues/440)). It probes `config/tsconfig.build.json`, then `tsconfig.build.json`, so a fresh `init` scaffold builds with no `--project` and no consumer edit; an explicit `--project` still reaches the compiler verbatim.
|
|
35
|
+
- **`devcheck`'s TypeScript (Worker) step probes both tsconfig locations** ([#440](https://github.com/cyanheads/mcp-ts-core/issues/440)). A worker tsconfig at the project root rendered `SKIPPED`, indistinguishable from a project with no Workers lane.
|
|
36
|
+
- **`scripts/verify-package.ts` builds the scaffold through its own `build` script** and asserts `dist/index.js` ([#440](https://github.com/cyanheads/mcp-ts-core/issues/440)), so a default-path regression fails `bun run test:package`.
|
|
37
|
+
- **`scripts/clean.ts` removes every build-info file the project's tsconfigs write** ([#441](https://github.com/cyanheads/mcp-ts-core/issues/441)) — the lane-suffixed `.tsbuildinfo.<lane>` forms, and files written beside a tsconfig in `config/`. Explicit positional arguments still replace the default set entirely.
|
|
38
|
+
- **`devcheck`'s running log marks a warning-demoted step as a warning** ([#344](https://github.com/cyanheads/mcp-ts-core/issues/344)). `formatCheckResult` read `exitCode` alone and printed `finished successfully` for a result the summary reported as `WARNING`; both surfaces now key on the same guard.
|
|
39
|
+
- **`runToolContract` rejects out-of-schema arguments as `InvalidParams` (`-32602`)** ([#416](https://github.com/cyanheads/mcp-ts-core/issues/416)), through the same `parseToolArguments` call `createToolHandler` makes, so the code, message, and `content[0].text` are what a client receives. A `ZodError` thrown inside a handler and an output-schema rejection still classify as `ValidationError`.
|
|
40
|
+
|
|
41
|
+
## Dependencies
|
|
42
|
+
|
|
43
|
+
- `zod` ^4.6.1 → ^4.6.2
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
---
|
|
2
|
+
summary: "Argument rejections carry a reason and a schema-derived recovery hint, and render an omitted required field as missing rather than as a wrong choice. A handler unwound after its request was cancelled classifies RequestCancelled whatever it threw."
|
|
3
|
+
breaking: false
|
|
4
|
+
security: false
|
|
5
|
+
agent-notes: |
|
|
6
|
+
Two adoption steps for a consumer upgrading from 0.13.2.
|
|
7
|
+
|
|
8
|
+
1. Every argument rejection's `content[0].text` now ends with a
|
|
9
|
+
`\n\nRecovery: <hint>` suffix, and its `data` carries
|
|
10
|
+
`reason: "invalid_arguments"`. `runToolContract` routes through the
|
|
11
|
+
production rejection path, so a test pinning that text byte-exact fails on
|
|
12
|
+
upgrade — assert that it *contains* the offending field instead.
|
|
13
|
+
`toolContractSuite` asserts only the `Error:` prefix and is unaffected.
|
|
14
|
+
2. A cancelled call now logs at `info` with `metrics.errorCode: "-32011"`. A
|
|
15
|
+
dashboard or alert keyed on `UNKNOWN_ERROR` / `InternalError` to count
|
|
16
|
+
client disconnects no longer matches — key it on `-32011`.
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
# 0.13.3 — 2026-09-17
|
|
20
|
+
|
|
21
|
+
## Added
|
|
22
|
+
|
|
23
|
+
- **`data.reason: "invalid_arguments"` and a synthesized `data.recovery.hint` on every argument rejection** ([#445](https://github.com/cyanheads/mcp-ts-core/issues/445)). The hint is derived from the Zod issues, the arguments as sent, and the root schema: an unknown key names the root properties the tool does accept, a wrong type names the type to send instead, and missing fields collapse into one `Provide …` sentence. It rides `content[]` as `Recovery: …` like any handler-thrown hint. A `z.discriminatedUnion()` root omits the accepted-key list, since no single call accepts the union of every variant's keys.
|
|
24
|
+
- **`.github/workflows/codeql.yml`, at the repo root and in the scaffold** — the one workflow a server carries, copied by `init`. It runs only while the repo's CodeQL *default setup* is off.
|
|
25
|
+
|
|
26
|
+
## Changed
|
|
27
|
+
|
|
28
|
+
- **A required field omitted from an enum or literal renders as missing** ([#378](https://github.com/cyanheads/mcp-ts-core/issues/378)) — `what: Missing required field. Expected one of "os"|"cpu"|"memory"`, where an omission and a wrong choice were previously byte-identical. A value outside the set keeps Zod's invalid-option sentence. Absence is resolved from the arguments in-process, so no value a caller sent is copied onto `data.issues`.
|
|
29
|
+
- **A union rejection renders its branch messages** ([#417](https://github.com/cyanheads/mcp-ts-core/issues/417)) joined by ` or `, instead of Zod's `Invalid input` placeholder. A branch whose only issue is a single-valued `invalid_value` — the `z.literal('')` blank-field sentinel — is skipped.
|
|
30
|
+
- **The scaffold's `instructions` comment shows the shape to write** — two to three cohesive sentences in one string literal, addressed to the calling agent, with operator configuration left to the README. `tool-defs-analysis` checks the same shape on `description` and `instructions`.
|
|
31
|
+
- Skill versions: `api-errors` 1.10 → 1.12, `git-wrapup` 1.17 → 1.18, `orchestrations` 1.9 → 1.10, `release-and-publish` 2.17 → 2.18, `release-pr-review` 1.1 → 1.3, `tool-defs-analysis` 1.5 → 1.6.
|
|
32
|
+
|
|
33
|
+
## Fixed
|
|
34
|
+
|
|
35
|
+
- **A handler unwound after its request's abort signal fired classifies `RequestCancelled` (`-32011`)** ([#421](https://github.com/cyanheads/mcp-ts-core/issues/421)) whatever it threw — a `notifications/cancelled` `reason` string, the `AbortError` `DOMException` a reason-less cancellation leaves, a service's own `McpError`. It is resolved inside the measured region of both handler factories, so the completion log's `metrics.errorCode` and the execution span carry `-32011` too, and the record logs at `info` with neither a stack nor a cause chain. A throw raised while the signal is still live is untouched.
|
|
36
|
+
- **`git-wrapup` step 7 and `release-pr-review` step 5 commit by pathspec** ([#444](https://github.com/cyanheads/mcp-ts-core/issues/444)) — `git commit --only <paths>`, so anything staged before the run (a migration's `git mv`, a hook's output, a concurrent session) cannot ride into the first concern's commit. `release-pr-review` step 5 lands each review fix as an ordinary commit on top of the release branch and pushes plainly, so nothing already pushed is rewritten and `main` keeps the record of what the review corrected. `git-wrapup` step 1 also diffs against `HEAD` rather than the index, so a pre-staged group is reviewed rather than skipped.
|
|
37
|
+
|
|
38
|
+
## Dependencies
|
|
39
|
+
|
|
40
|
+
- `zod` ^4.6.2 → ^4.6.5
|
|
41
|
+
- `@duckdb/node-api` ^1.5.5-r.4 → ^1.5.5-r.5 (dev)
|
|
42
|
+
- `fast-check` ^4.9.0 → ^4.10.0 (dev)
|
|
43
|
+
- `js-yaml` ^5.4.1 → ^5.4.2 (dev)
|
|
44
|
+
- `tsc-alias` ^1.9.4 → ^1.9.5 (dev; scaffold pin ^1.9.2 → ^1.9.5, alongside `ignore` ^7.0.7 → ^7.0.9)
|
|
@@ -9,9 +9,9 @@ Three small surface changes plus a documentation policy. The framework gains a `
|
|
|
9
9
|
|
|
10
10
|
## Added
|
|
11
11
|
|
|
12
|
-
- **`disabledTool(def, meta)` wrapper** — new `@cyanheads/mcp-ts-core/tools` export (also re-exported from the framework root). Marks a tool definition as present-in-manifest but skipped at MCP registration so `tools/list` clients can't invoke it while operators reading
|
|
12
|
+
- **`disabledTool(def, meta)` wrapper** — new `@cyanheads/mcp-ts-core/tools` export (also re-exported from the framework root). Marks a tool definition as present-in-manifest but skipped at MCP registration so `tools/list` clients can't invoke it while operators reading the HTML landing page still see the gated tool with an operator-facing `reason`, optional `hint`, and optional `since`. Public `ToolDefinition` interface and the `tool()` builder are untouched — the wrapper attaches an internal `__mcpDisabled` field that only `ToolRegistry` and `buildServerManifest()` read. ([#96](https://github.com/cyanheads/mcp-ts-core/issues/96))
|
|
13
13
|
- **`DisabledMetadata` type** — `{ reason: string; hint?: string; since?: string }`. Re-exported from `@cyanheads/mcp-ts-core` and `/tools`.
|
|
14
|
-
- **`ManifestTool.disabled`** — optional `DisabledMetadata` field threaded through `buildServerManifest()`.
|
|
14
|
+
- **`ManifestTool.disabled`** — optional `DisabledMetadata` field threaded through `buildServerManifest()`. Read by the HTML landing page, which renders the gate for operators who need to know a tool is unavailable without invoking it.
|
|
15
15
|
- **Landing page `disabled` bucket** — new fourth bucket rendered after `read | unspecified | write | destructive`. Cards use a muted dashed-border variant (`tool-card--disabled`), replace the invocation `<details>` with a callout containing reason + optional hint + optional `since`, and keep the schema preview so operators can still read the tool's contract. Companion "would be `<mutability>`" pill surfaces the underlying classification, suppressed when underlying is `unspecified`.
|
|
16
16
|
- **Landing page `unspecified` bucket** — new third bucket between `read` and `write`. Pills, chip, and card spine use muted/italic styling to read as indeterminate, distinct from the `write` bucket's deliberate-mutation signal. ([#92](https://github.com/cyanheads/mcp-ts-core/issues/92))
|
|
17
17
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resourceHandlerFactory.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/resources/utils/resourceHandlerFactory.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EACV,mBAAmB,EACnB,kBAAkB,EAClB,aAAa,EACb,SAAS,EACV,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EAEL,KAAK,eAAe,EAGrB,MAAM,gCAAgC,CAAC;AAExC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oDAAoD,CAAC;AAWhG,gEAAgE;AAChE,YAAY,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACtE,YAAY,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAiBrE;;;;GAIG;AACH,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,OAAO,EACf,IAAI,EAAE;IAAE,GAAG,EAAE,GAAG,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,GACnC,kBAAkB,CAAC,UAAU,CAAC,CAShC;AAkBD;;;;;;;;;;;GAWG;AACH,wBAAgB,qBAAqB,CACnC,GAAG,EAAE,qBAAqB,EAC1B,QAAQ,EAAE,eAAe,EACzB,SAAS,EAAE,eAAe,GACzB,CACD,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,SAAS,EACpB,GAAG,EAAE,aAAa,KACf,OAAO,CAAC,kBAAkB,GAAG,mBAAmB,CAAC,
|
|
1
|
+
{"version":3,"file":"resourceHandlerFactory.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/resources/utils/resourceHandlerFactory.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EACV,mBAAmB,EACnB,kBAAkB,EAClB,aAAa,EACb,SAAS,EACV,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EAEL,KAAK,eAAe,EAGrB,MAAM,gCAAgC,CAAC;AAExC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oDAAoD,CAAC;AAWhG,gEAAgE;AAChE,YAAY,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACtE,YAAY,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAiBrE;;;;GAIG;AACH,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,OAAO,EACf,IAAI,EAAE;IAAE,GAAG,EAAE,GAAG,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,GACnC,kBAAkB,CAAC,UAAU,CAAC,CAShC;AAkBD;;;;;;;;;;;GAWG;AACH,wBAAgB,qBAAqB,CACnC,GAAG,EAAE,qBAAqB,EAC1B,QAAQ,EAAE,eAAe,EACzB,SAAS,EAAE,eAAe,GACzB,CACD,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,SAAS,EACpB,GAAG,EAAE,aAAa,KACf,OAAO,CAAC,kBAAkB,GAAG,mBAAmB,CAAC,CA6ErD"}
|
|
@@ -7,7 +7,7 @@ import { buildHandlerContext, handlerParentContext, resolveHandlerRequest, } fro
|
|
|
7
7
|
import { isInputRequiredSignal } from '../../inputRequired.js';
|
|
8
8
|
import { withRequiredScopes } from '../../transports/auth/lib/authUtils.js';
|
|
9
9
|
import { McpError } from '../../../types-global/errors.js';
|
|
10
|
-
import { ErrorHandler } from '../../../utils/internal/error-handler/errorHandler.js';
|
|
10
|
+
import { asRequestCancelled, ErrorHandler } from '../../../utils/internal/error-handler/errorHandler.js';
|
|
11
11
|
import { measureResourceExecution } from '../../../utils/internal/performance.js';
|
|
12
12
|
import { requestContextService } from '../../../utils/internal/requestContext.js';
|
|
13
13
|
// ---------------------------------------------------------------------------
|
|
@@ -94,14 +94,22 @@ export function createResourceHandler(def, services, notifiers) {
|
|
|
94
94
|
// the handler returned recorded those as successes (#346).
|
|
95
95
|
return await measureResourceExecution(async (spanContext, recordOutput) => {
|
|
96
96
|
const ctx = buildHandlerContext(request, services, spanContext, def.errors, uri);
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
97
|
+
try {
|
|
98
|
+
// Handler may return sync or async.
|
|
99
|
+
const handlerResult = await def.handler(validatedParams, ctx);
|
|
100
|
+
// The domain value is what `mcp.resource.output_bytes` measures — not
|
|
101
|
+
// the assembled `contents` this callback returns.
|
|
102
|
+
recordOutput(handlerResult);
|
|
103
|
+
// Validate output against schema when defined
|
|
104
|
+
const validatedResult = def.output ? def.output.parse(handlerResult) : handlerResult;
|
|
105
|
+
return { contents: formatter(validatedResult, { uri, mimeType }) };
|
|
106
|
+
}
|
|
107
|
+
catch (error) {
|
|
108
|
+
// Inside the measurement on purpose: the completion log's
|
|
109
|
+
// `metrics.errorCode` and the span's error-code attribute are
|
|
110
|
+
// derived from what leaves this callback (#421).
|
|
111
|
+
throw asRequestCancelled(error, request.signal);
|
|
112
|
+
}
|
|
105
113
|
}, { ...appContext, resourceName }, { uri: resourceUri, mimeType });
|
|
106
114
|
}
|
|
107
115
|
catch (error) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resourceHandlerFactory.js","sourceRoot":"","sources":["../../../../src/mcp-server/resources/utils/resourceHandlerFactory.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AASH,OAAO,EACL,mBAAmB,EAEnB,oBAAoB,EACpB,qBAAqB,GACtB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAGtE,OAAO,EAAE,kBAAkB,EAAE,MAAM,+CAA+C,CAAC;AACnF,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,gDAAgD,CAAC;
|
|
1
|
+
{"version":3,"file":"resourceHandlerFactory.js","sourceRoot":"","sources":["../../../../src/mcp-server/resources/utils/resourceHandlerFactory.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AASH,OAAO,EACL,mBAAmB,EAEnB,oBAAoB,EACpB,qBAAqB,GACtB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAGtE,OAAO,EAAE,kBAAkB,EAAE,MAAM,+CAA+C,CAAC;AACnF,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,gDAAgD,CAAC;AAClG,OAAO,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAC3E,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAU3E,8EAA8E;AAC9E,oBAAoB;AACpB,8EAA8E;AAE9E,SAAS,cAAc,CAAC,QAAgB;IACtC,MAAM,kBAAkB,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,WAAW,EAAE,IAAI,EAAE,CAAC;IACjF,OAAO,kBA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erFactory
|
|
5
5
|
*/
|
|
6
6
|
import type { CallToolResult, ContentBlock, InputRequiredResult, ServerContext } from '@modelcontextprotocol/server';
|
|
7
|
-
import { ZodError, type ZodObject, type ZodRawShape } from 'zod';
|
|
7
|
+
import { ZodError, type ZodObject, type ZodRawShape, z } from 'zod';
|
|
8
8
|
import type { Context } from '../../../core/context.js';
|
|
9
9
|
import { type HandlerServices } from '../../handlerContext.js';
|
|
10
10
|
import type { NotifierSources } from '../../notifications.js';
|
|
@@ -45,8 +45,28 @@ export declare function buildToolErrorResult(code: JsonRpcErrorCode, message: st
|
|
|
45
45
|
* is unchanged for clients that read `content[]` text. The framework owns this
|
|
46
46
|
* rejection (see `deferInputValidation`) purely so it can also carry
|
|
47
47
|
* `structuredContent.error`.
|
|
48
|
+
*
|
|
49
|
+
* `args` are the caller's raw arguments, read only through
|
|
50
|
+
* {@link readArgumentAt}; see {@link renderIssueMessage} for what that decides.
|
|
51
|
+
*/
|
|
52
|
+
export declare function formatInputValidationMessage(toolName: string, error: ZodError, args: unknown): string;
|
|
53
|
+
/**
|
|
54
|
+
* Validates raw tool arguments against the definition's `input` schema, or
|
|
55
|
+
* throws the rejection a client receives on the wire: `InvalidParams`
|
|
56
|
+
* (`-32602`), the message {@link formatInputValidationMessage} renders, the Zod
|
|
57
|
+
* issues as `data.issues`, and — as with any other declared failure —
|
|
58
|
+
* `data.reason` plus a `data.recovery.hint` {@link buildArgumentRecoveryHint}
|
|
59
|
+
* synthesizes (#445). {@link buildToolErrorResult} mirrors that hint into
|
|
60
|
+
* `content[]`, so it reaches format()-only clients with no extra work.
|
|
61
|
+
*
|
|
62
|
+
* The single argument-rejection path. {@link createToolHandler} and the
|
|
63
|
+
* `runToolContract` test helper both route through it, so a test written to
|
|
64
|
+
* the helper pins the code, message, and `content[]` text a deployment
|
|
65
|
+
* actually produces (#416). Anything that classifies a `ZodError` as
|
|
66
|
+
* `ValidationError` — a handler's own validation, the output-schema parse —
|
|
67
|
+
* is a different failure and does not come through here.
|
|
48
68
|
*/
|
|
49
|
-
export declare function
|
|
69
|
+
export declare function parseToolArguments<TDefinition extends AnyToolDefinition>(def: TDefinition, input: unknown): z.infer<TDefinition['input']>;
|
|
50
70
|
/**
|
|
51
71
|
* Builds an error `CallToolResult` from a raw thrown value. Classifies via
|
|
52
72
|
* {@link ErrorHandler.classifyOnly} when the value isn't already an
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toolHandlerFactory.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/utils/toolHandlerFactory.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EACV,cAAc,EACd,YAAY,EACZ,mBAAmB,EACnB,aAAa,EACd,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EAAE,QAAQ,EAAE,KAAK,SAAS,EAAE,KAAK,WAAW,
|
|
1
|
+
{"version":3,"file":"toolHandlerFactory.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/utils/toolHandlerFactory.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EACV,cAAc,EACd,YAAY,EACZ,mBAAmB,EACnB,aAAa,EACd,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EAAE,QAAQ,EAAE,KAAK,SAAS,EAAE,KAAK,WAAW,EAAgB,CAAC,EAAE,MAAM,KAAK,CAAC;AAElF,OAAO,KAAK,EAAE,OAAO,EAAmB,MAAM,mBAAmB,CAAC;AAElE,OAAO,EAEL,KAAK,eAAe,EAGrB,MAAM,gCAAgC,CAAC;AAExC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAErE,OAAO,EAAiB,gBAAgB,EAAY,MAAM,0BAA0B,CAAC;AAMrF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAM7D,oEAAoE;AACpE,YAAY,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACtE,YAAY,EAAE,eAAe,EAAE,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