-
Notifications
You must be signed in to change notification settings - Fork 2.2k
feat(mastracode): support external tool injection and auth storage init #13561
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
8d99cd6
6fd8e2c
64f6b27
4811be2
f12ed13
e3e4351
0444fb0
8534e16
37202e8
267442f
2b6f926
71938ec
854a476
4c08006
5cf97e0
dd13f27
d717519
acf05f2
efdeda2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| --- | ||
| '@mastra/core': patch | ||
| 'mastracode': patch | ||
| --- | ||
|
|
||
| Renamed `images` to `files` in `harness.sendMessage(...)` to align with the AI SDK `FilePart` shape. | ||
|
|
||
| **Migration** | ||
|
|
||
| Before: | ||
| ```ts | ||
| await harness.sendMessage({ content: "Hi", images: [{ data, mimeType }] }); | ||
| ``` | ||
|
|
||
| After: | ||
| ```ts | ||
| await harness.sendMessage({ content: "Hi", files: [{ data, mediaType, filename }] }); | ||
| ``` |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| --- | ||
| 'mastracode': minor | ||
| '@mastra/core': patch | ||
| --- | ||
|
|
||
| Added pre/post hook wrapping for tool execution via `HookManager` and exported `createAuthStorage` for standalone auth provider initialization. | ||
|
|
||
| `@mastra/core` receives a patch bump as a peer dependency of `mastracode`. | ||
|
|
||
| **New API: `createAuthStorage`** | ||
|
|
||
| ```ts | ||
| import { createAuthStorage } from 'mastracode'; | ||
|
|
||
| const authStorage = createAuthStorage(); | ||
| // authStorage is now wired into Claude Max and OpenAI Codex providers | ||
| ``` |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| --- | ||
|
|
||
| Added a daily GitHub Action workflow for forks to sync the default branch from `mastra-ai/mastra`. | ||
| This is an infrastructure-only change and does not modify published packages. | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| name: Sync Fork With Upstream | ||
|
|
||
| permissions: | ||
| contents: write | ||
|
|
||
| on: | ||
| schedule: | ||
| - cron: '0 6 * * *' | ||
| workflow_dispatch: | ||
|
|
||
| jobs: | ||
| sync-upstream: | ||
| # Run only on forks. Upstream repository does not need this job. | ||
| if: ${{ github.repository != 'mastra-ai/mastra' }} | ||
| runs-on: ubuntu-latest | ||
| env: | ||
| DEFAULT_BRANCH: ${{ github.event.repository.default_branch }} | ||
| UPSTREAM_REPO: mastra-ai/mastra | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v5 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Configure Git user | ||
| run: | | ||
| git config user.name "github-actions[bot]" | ||
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | ||
|
|
||
| - name: Sync default branch from upstream | ||
| run: | | ||
| set -euo pipefail | ||
|
|
||
| if git remote get-url upstream >/dev/null 2>&1; then | ||
| git remote set-url upstream "https://github.com/${UPSTREAM_REPO}.git" | ||
| else | ||
| git remote add upstream "https://github.com/${UPSTREAM_REPO}.git" | ||
| fi | ||
|
|
||
| git fetch origin "${DEFAULT_BRANCH}" | ||
| git fetch upstream "${DEFAULT_BRANCH}" | ||
|
|
||
| git checkout -B "${DEFAULT_BRANCH}" "origin/${DEFAULT_BRANCH}" | ||
|
|
||
| UPSTREAM_NEW_COMMITS="$(git rev-list --count "origin/${DEFAULT_BRANCH}..upstream/${DEFAULT_BRANCH}")" | ||
| if [ "${UPSTREAM_NEW_COMMITS}" -eq 0 ]; then | ||
| echo "No upstream changes to sync." | ||
| exit 0 | ||
| fi | ||
|
|
||
| git merge --no-edit "upstream/${DEFAULT_BRANCH}" | ||
| git push origin "${DEFAULT_BRANCH}" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| import { afterEach, describe, expect, it } from 'vitest'; | ||
| import { createAuthStorage } from '../index.js'; | ||
| import { getAuthStorage as getClaudeAuthStorage, setAuthStorage as setClaudeAuthStorage } from '../providers/claude-max.js'; | ||
| import { getAuthStorage as getOpenAIAuthStorage, setAuthStorage as setOpenAIAuthStorage } from '../providers/openai-codex.js'; | ||
|
|
||
| describe('createAuthStorage', () => { | ||
| afterEach(() => { | ||
| setClaudeAuthStorage(undefined as any); | ||
| setOpenAIAuthStorage(undefined as any); | ||
|
Comment on lines
+8
to
+9
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "=== 1. Locate and read the test file ==="
fd 'create-auth-storage\.test\.ts$' --type f
echo
echo "=== 2. Read the full test file to understand context ==="
cat -n mastracode/src/__tests__/create-auth-storage.test.ts
echo
echo "=== 3. Find auth storage setter functions ==="
find mastracode -name "*.ts" -type f | xargs rg -l "export.*setClaudeAuthStorage|export.*setOpenAIAuthStorage" 2>/dev/null || echo "Searching in broader context..."
echo
echo "=== 4. Search for setAuthStorage/setClaudeAuthStorage/setOpenAIAuthStorage signatures ==="
rg -n "setClaudeAuthStorage|setOpenAIAuthStorage" mastracode/src --type ts -A 2 -B 2
echo
echo "=== 5. Check if 'undefined' is ever used as valid input elsewhere ==="
rg -n "setClaudeAuthStorage|setOpenAIAuthStorage" --type ts -A 1 | grep -E "(undefined|null)" || echo "No undefined/null patterns found"
echo
echo "=== 6. Search for reset patterns in auth-related files ==="
fd 'auth' mastracode/src --type f --glob '*.ts' | head -20Repository: mastra-ai/mastra Length of output: 3425 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "=== Find provider files ==="
fd 'claude-max\.ts|openai-codex\.ts' mastracode/src --type f
echo
echo "=== Read claude-max.ts to find setAuthStorage signature ==="
cat -n mastracode/src/providers/claude-max.ts
echo
echo "=== Read openai-codex.ts to find setAuthStorage signature ==="
cat -n mastracode/src/providers/openai-codex.tsRepository: mastra-ai/mastra Length of output: 16716 Update auth storage setters to accept undefined for test cleanup. Lines 8–9 use 🤖 Prompt for AI Agents |
||
| }); | ||
|
|
||
| it('wires a shared auth storage instance to provider modules', () => { | ||
| const authStorage = createAuthStorage(); | ||
|
|
||
| expect(getClaudeAuthStorage()).toBe(authStorage); | ||
| expect(getOpenAIAuthStorage()).toBe(authStorage); | ||
| }); | ||
| }); | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Empty changeset frontmatter is invalid for release notes.
Line 1–Line 2 has no package entries, and Line 4–Line 5 documents an infrastructure-only change. This should not ship as a package changeset.
potential_issue
As per coding guidelines: "Each changeset file contains a YAML frontmatter at the top. It will be one or more package names followed by a colon and the type of change."
🤖 Prompt for AI Agents