mirror of
https://github.com/mastra-ai/mastra.git
synced 2026-11-17 08:44:46 +00:00
## Summary Upgrades `templates/template-mongodb-bedrock-agent` to the AI SDK v6 stack used by the other templates, which clears the vulnerable dependencies we'd held back because the fixes needed major upgrades. - `ai` ^5.0.289 → ^6.0.332, `@ai-sdk/amazon-bedrock` 3.0.146 (exact pin) → ^4.0.216. ai v5's `@ai-sdk/provider-utils@3` pins `undici` 5.x, which has no patched release. v4 brings `undici` 6.29.1 and drops `@fastify/busboy`. - Removes `patch-package`, the `postinstall` script, the `patches/` directory and the Dockerfile `COPY patches` step. Bedrock v4 already ships the upstream fix (`BedrockToolUseSchema.input` is optional), and the patch only existed because that fix wasn't available on ai v5. Removed the matching notes from CONTRIBUTING.md and AGENTS.md. - Bumps Mastra packages to current versions (`@mastra/core` ^1.83.0, memory, mongodb, rag, observability, editor, `mastra` CLI). - Bumps `@opentelemetry/auto-instrumentations-node` ^0.79 → ^0.83.1 to fix GHSA-3v2p-hm54-8qcq (moderate). That package needs Node ≥22.15, so `engines.node` goes from `>=22.13.0` to `>=22.15.0`. The Dockerfile already uses `node:22-slim`. - Regenerated `package-lock.json` with npm. No source code changes were needed. `embed`/`embedMany`, `createAmazonBedrock`, and the Bedrock `dimensions` provider option work the same on v6/v4. ## Verification - `npm ls undici @fastify/busboy shell-quote image-size uuid follow-redirects proxy-addr`: `undici` 6.29.1 / 7.30.2 and `uuid` 11.1.1 only. No `@fastify/busboy`, and `shell-quote`, `image-size`, `follow-redirects` and `proxy-addr` are no longer in the tree. - `npm audit --omit=dev` and `npm audit`: **0 vulnerabilities** (before: 9, 2 high). - `npx tsc --noEmit` and `npm run build` pass. - `npx mastra build` succeeds. - `npm test`: 8 passed, 6 skipped. The skipped tests need `TEST_MONGODB_URI`, the same as before this change. - `npm ci --omit=dev` installs cleanly without the postinstall. Closes Dependabot alerts #3517–#3534 (undici / @fastify/busboy). Ref SEC-315 Ref SEC-263 Ref SEC-264 Ref SEC-252 <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> **ELI5:** This change updates a MongoDB Bedrock agent template to newer libraries. It removes a patch that is no longer needed, because the newer Bedrock library includes the fix. It also raises the minimum Node.js version. ## Summary This change upgrades the `templates/template-mongodb-bedrock-agent` template to the AI SDK v6 stack. The `ai` package moves from `^5.0.289` to `^6.0.332`. `@ai-sdk/amazon-bedrock` moves from the exact version `3.0.146` to `^4.0.216`. The change also updates Mastra packages, `@opentelemetry/auto-instrumentations-node` (now `^0.83.1`), and the `mastra` CLI. The change removes the Bedrock tool-use workaround. That workaround used `patch-package`. The author states that Bedrock v4 includes the upstream fix, so the workaround is no longer needed. The change includes no source code changes. ### Changes by file - `package.json`: - Raises the Node.js requirement (`engines.node`) from `>=22.13.0` to `>=22.15.0`. - Removes the `postinstall` script and the `patch-package` dependency. - Updates the `ai`, `@ai-sdk/amazon-bedrock`, Mastra, OpenTelemetry instrumentation, and `mastra` CLI versions. - `patches/@ai-sdk+amazon-bedrock+3.0.146.patch`: Deleted. The patch made `input` optional in `BedrockToolUseSchema` in the CommonJS and ESM bundles. - `Dockerfile`: Removes the step that copies the `patches` directory into `/app` before `npm install`. - `CONTRIBUTING.md`: Removes the section on the pinned `@ai-sdk/amazon-bedrock` dependency, the `patch-package` workaround, the `ai` v5 constraint, and the rule that `patch-package` remain a runtime dependency for `npm ci --omit=dev`. - `AGENTS.md`: Removes the instruction to keep the pinned Bedrock provider version and its `patch-package` fix until a deliberate migration. - `README.md`: The Prerequisites section now states Node.js 22.15 or later. The diff reports 7 changed files, with 1,685 lines added and 2,071 removed. The per-file summaries cover 6 files. The summaries report about 12 added lines in total, so most of the added lines come from a file that is not described. That file is probably a lockfile, but this summary does not confirm it. ### Reported verification (author-reported, not independently confirmed) - `npm audit --omit=dev` and `npm audit`: 0 vulnerabilities. - `npx tsc --noEmit`, `npm run build`, and `npx mastra build`: succeeded. - `npm ci --omit=dev`: installed without the postinstall script. - `npm test`: 8 passed, 6 skipped. The skipped tests require `TEST_MONGODB_URI`. - `npm ls undici @fastify/busboy shell-quote image-size uuid follow-redirects proxy-addr`: results reported by the author, not summarized here. The PR states that it closes Dependabot alerts `#3517`–#3534. It references SEC-315, SEC-263, SEC-264, and SEC-252. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: mastra-platform[bot] <mastra-platform[bot]@users.noreply.github.com> Co-authored-by: mastra-platform[bot] <284800079+mastra-platform[bot]@users.noreply.github.com> |
History
|
|
|---|---|---|
| .. | ||
| template-accounts-payable-invoice-processing | ||
| template-agent-builder | ||
| template-agent-harness | ||
| template-browser-agent | ||
| template-browsing-agent | ||
| template-chat-with-pdf | ||
| template-chat-with-youtube | ||
| template-claw-assistant | ||
| template-company-knowledge | ||
| template-competitor-monitor-jev | ||
| template-connect-agent | ||
| template-csv-to-questions | ||
| template-customer-feedback-summarization | ||
| template-customer-refund-agent | ||
| template-deep-search | ||
| template-docs-chatbot | ||
| template-docs-expert | ||
| template-factory | ||
| template-factory-self-hosted | ||
| template-flash-cards-from-pdf | ||
| template-genui-data-explorer | ||
| template-github-review-agent | ||
| template-google-sheets | ||
| template-insurance-policy-checking | ||
| template-kyc-customer-onboarding | ||
| template-lead-qualification | ||
| template-meeting-notes | ||
| template-mongodb-bedrock-agent | ||
| template-organization-intelligence | ||
| template-personal-assistant | ||
| template-security-incident-triage | ||
| template-starter-agent | ||
| template-text-to-sql | ||
| template-vendor-risk-questionnaire | ||
| weather-agent | ||
| .gitignore | ||
| README.md | ||
Mastra templates
This directory contains standalone Mastra project templates.
New Gateway-first templates
template-docs-expert: Answers documentation questions with Gateway web search, citations, memory, and structured responses.template-browser-agent: Uses AgentBrowser to browse, inspect, and interact with web pages.template-meeting-notes: Turns Zoom transcripts or uploaded transcripts into structured notes with decisions and action items.template-company-knowledge: Indexes Linear and Notion content into pgvector and answers internal knowledge questions.template-claw-assistant: Operates a workspace with filesystem, sandbox, browser, and web-search tools.template-connect-agent: Turns Mastra platform integration connections into live agent tools with@mastra/connect, plus a cross-integration activity-digest workflow.template-starter-agent: Starter Agent — durable agent harness with@mastra/connecttools and channels, a platform-backed workspace, Studio agent/workflow editing via@mastra/editor, Postgres storage, and Redis-backed resumable streams.
How to add a new template
To add a new template to the templates/ directory, follow these steps:
1. Create a new template folder
- Inside the
templates/directory, create a new folder named after your template (e.g.,my-new-template/).
2. Required files
Your template folder must include the following files:
a. package.json
- Use OpenAI as the LLM provider in your code/config.
- All
@mastra/*dependencies should be set to"latest"in thedependenciessection. mastradevDependency should be set to"latest"in thedevDependenciessection.- The
descriptionfield should clearly describe what the template does.
b. .env.example
- List all required environment variables, such as API keys and configuration values.
c. README.md
Follow this template for your README.md:
# Title
Introductory paragraph describing what this template does.
## Why we built this
Explain the motivation behind creating this template and the problem it solves. And which features of Mastra it demonstrates.
## Demo
This demo runs in Mastra Studio, but you can connect this workflow to your React, Next.js, or Vue app using the [Mastra Client SDK](https://mastra.ai/docs/server/mastra-client) or agentic UI libraries like [AI SDK UI](https://mastra.ai/guides/build-your-ui/ai-sdk-ui), [CopilotKit](https://mastra.ai/guides/build-your-ui/copilotkit), or [Assistant UI](https://mastra.ai/guides/build-your-ui/assistant-ui).
## Prerequisites
- [OpenAI API key](https://platform.openai.com/api-keys): Used by default, but you can swap in any model
## Quickstart 🚀
1. **Clone the template**
- Run `npx create-mastra@latest --template TEMPLATE_NAME` to scaffold the project locally.
2. **Add your API keys**
- Copy `.env.example` to `.env` and fill in your keys.
3. **Start the dev server**
- Run `npm run dev` and open [localhost:4111](http://localhost:4111) to try it out.
## Making it yours
Explain how they can use it and how they can customize it for their needs.
## About Mastra templates
[Mastra templates](https://mastra.ai/templates) are ready-to-use projects that show off what you can build — clone one, poke around, and make it yours. They live in the [Mastra monorepo](https://github.com/mastra-ai/mastra) and are automatically synced to standalone repositories for easier cloning.
Want to contribute? See [CONTRIBUTING.md](./CONTRIBUTING.md).
d. CONTRIBUTING.md
Create a CONTRIBUTING.md file:
# Contributing
This repository is auto-generated from the [Mastra monorepo](https://github.com/mastra-ai/mastra). Pull requests opened here will be ignored.
To contribute:
1. Fork the [Mastra monorepo](https://github.com/mastra-ai/mastra)
2. Find this template in `templates/TEMPLATE_NAME`
3. Make your changes
4. Open a pull request against the monorepo
A bot syncs accepted changes to this repository.