Skip to content

Commit edab4ef

Browse files
author
Sam
authored
Merge pull request #101 from ssdeanx/develop
Develop
2 parents b5bbaaa + 0c1317b commit edab4ef

23 files changed

Lines changed: 513 additions & 447 deletions

convex.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"node": {
3-
"nodeVersion": "24"
3+
"nodeVersion": "20"
44
},
55
"$schema": "./node_modules/convex/schemas/convex.schema.json"
66
}

convex/_generated/api.d.ts

Lines changed: 39 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
1+
/* eslint-disable */
22
/**
33
* Generated `api` utility.
44
*
@@ -8,8 +8,42 @@
88
* @module
99
*/
1010

11-
import type { AnyApi, AnyComponents } from "convex/server";
11+
import type * as mastra_storage from "../mastra/storage.js";
12+
13+
import type {
14+
ApiFromModules,
15+
FilterApi,
16+
FunctionReference,
17+
} from "convex/server";
18+
19+
declare const fullApi: ApiFromModules<{
20+
"mastra/storage": typeof mastra_storage;
21+
}>;
22+
23+
/**
24+
* A utility for referencing Convex functions in your app's public API.
25+
*
26+
* Usage:
27+
* ```js
28+
* const myFunctionReference = api.myModule.myFunction;
29+
* ```
30+
*/
31+
export declare const api: FilterApi<
32+
typeof fullApi,
33+
FunctionReference<any, "public">
34+
>;
35+
36+
/**
37+
* A utility for referencing Convex functions in your app's internal API.
38+
*
39+
* Usage:
40+
* ```js
41+
* const myFunctionReference = internal.myModule.myFunction;
42+
* ```
43+
*/
44+
export declare const internal: FilterApi<
45+
typeof fullApi,
46+
FunctionReference<any, "internal">
47+
>;
1248

13-
export declare const api: AnyApi;
14-
export declare const internal: AnyApi;
15-
export declare const components: AnyComponents;
49+
export declare const components: {};

convex/mastra/storage.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
import { mastraStorage } from '@mastra/convex/server'
1+
import { mastraStorage } from '@mastra/convex/server';
22

3-
export const handle = mastraStorage
3+
export const handle = mastraStorage;

convex/schema.ts

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,27 @@
1+
import { defineSchema, defineTable } from 'convex/server';
2+
import { v } from 'convex/values';
13
import {
2-
mastraDocumentsTable,
4+
mastraThreadsTable,
35
mastraMessagesTable,
46
mastraResourcesTable,
57
mastraScoresTable,
6-
mastraThreadsTable,
78
mastraVectorIndexesTable,
89
mastraVectorsTable,
9-
mastraWorkflowSnapshotsTable,
10-
} from '@mastra/convex'
11-
import { defineSchema } from 'convex/server'
10+
mastraDocumentsTable,
11+
} from '@mastra/convex/schema';
12+
13+
// Explicitly define mastra_workflow_snapshots to ensure the `id` field exists
14+
// (some downstream Convex schema variants omit `id` which causes an invalid
15+
// index declaration during Convex schema push).
16+
const mastraWorkflowSnapshotsTable = defineTable({
17+
id: v.string(),
18+
workflow_name: v.string(),
19+
run_id: v.string(),
20+
resourceId: v.optional(v.string()),
21+
snapshot: v.any(),
22+
createdAt: v.string(),
23+
updatedAt: v.string(),
24+
}).index('by_record_id', ['id']).index('by_workflow_run', ['workflow_name', 'run_id']).index('by_workflow', ['workflow_name']).index('by_resource', ['resourceId']).index('by_created', ['createdAt']);
1225

1326
export default defineSchema({
1427
mastra_threads: mastraThreadsTable,
@@ -19,4 +32,4 @@ export default defineSchema({
1932
mastra_vector_indexes: mastraVectorIndexesTable,
2033
mastra_vectors: mastraVectorsTable,
2134
mastra_documents: mastraDocumentsTable,
22-
})
35+
});

mdx-components.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import type { MDXComponents } from 'mdx/types'
2+
import type { ReactNode } from 'react'
23
import Link from 'next/link'
34

45
// Custom components that work with MDX plugins
@@ -47,7 +48,7 @@ export function useMDXComponents(components: MDXComponents): MDXComponents {
4748
// Links with hover effects
4849
a: ({ href, children }) => (
4950
<Link
50-
href={href ?? '#'}
51+
href={typeof href === 'string' ? href : '#'}
5152
className="font-medium text-primary underline underline-offset-4 hover:text-primary/80 transition-colors"
5253
>
5354
{children}
@@ -75,8 +76,8 @@ export function useMDXComponents(components: MDXComponents): MDXComponents {
7576
),
7677

7778
// Code blocks and inline code - these work with rehype-highlight
78-
code: ({ children, className }) => {
79-
const isInline = !className?.includes('language-')
79+
code: ({ children, className }: { children?: ReactNode; className?: string }) => {
80+
const isInline = typeof className !== 'string' || !className.includes('language-')
8081
return isInline ? (
8182
<code className="relative rounded bg-muted px-1.5 py-0.5 font-mono text-sm text-foreground">
8283
{children}
@@ -116,9 +117,9 @@ export function useMDXComponents(components: MDXComponents): MDXComponents {
116117
),
117118

118119
// Images with responsive design
119-
img: ({ src, alt, title }) => (
120+
img: ({ src, alt, title }: { src?: string; alt?: string; title?: string }) => (
120121
<img
121-
src={src}
122+
src={src ?? undefined}
122123
alt={alt ?? ''}
123124
title={title}
124125
className="my-4 rounded-lg border border-border"

next.config.ts

Lines changed: 48 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import createMDX from '@next/mdx'
22
import MonacoWebpackPlugin from 'monaco-editor-webpack-plugin'
33
import type { NextConfig } from 'next'
4+
import type { Configuration } from 'webpack'
45

56
const nextConfig: NextConfig = {
67
pageExtensions: ['js', 'jsx', 'md', 'mdx', 'ts', 'tsx'],
@@ -38,7 +39,7 @@ const nextConfig: NextConfig = {
3839
typedRoutes: false,
3940
reactStrictMode: true,
4041
distDir: '.next',
41-
webpack: (config, { isServer }) => {
42+
webpack: (config: Configuration, { isServer }) => {
4243
if (!isServer) {
4344
config.plugins = config.plugins ?? []
4445
config.plugins.push(
@@ -52,10 +53,55 @@ const nextConfig: NextConfig = {
5253
],
5354
})
5455
)
56+
57+
// Sanitize resolve.alias so values are serializable for Turbopack/worker cloning
58+
// Ensure resolve exists and normalize alias values to strings/arrays of strings
59+
const existingResolve = config.resolve ?? {}
60+
const aliasObj = (existingResolve as unknown as Record<string, unknown>).alias ?? {}
61+
if (typeof aliasObj === 'object' && aliasObj !== null) {
62+
const normalized: Record<string, string | string[]> = {}
63+
for (const [k, v] of Object.entries(aliasObj as Record<string, unknown>)) {
64+
if (Array.isArray(v)) {
65+
normalized[k] = v.map((x) => String(x))
66+
} else if (typeof v === 'object' && v !== null) {
67+
// For objects, stringify to avoid '[object Object]' implicit string coercion
68+
try {
69+
normalized[k] = JSON.stringify(v)
70+
} catch {
71+
normalized[k] = ''
72+
}
73+
} else if (typeof v === 'function') {
74+
// For functions, prefer the function name to avoid serializing the entire function
75+
// Narrow to an object with an optional name property to avoid using the broad Function type
76+
const fnName = (v as { name?: string })?.name ?? ''
77+
normalized[k] = fnName
78+
} else if (v === null || v === undefined) {
79+
// Keep null/undefined normalized to an empty string
80+
normalized[k] = ''
81+
} else {
82+
// At this point, expect primitives (string/number/boolean/symbol/bigint).
83+
// Guard against objects to avoid default Object stringification '[object Object]'.
84+
const t = typeof v
85+
if (t === 'string' || t === 'number' || t === 'boolean' || t === 'symbol' || t === 'bigint') {
86+
// Narrow the type for the linter to avoid base-to-string coercion warnings
87+
normalized[k] = String(v as string | number | boolean | symbol | bigint)
88+
} else {
89+
// Fallback for unexpected non-serializable values
90+
try {
91+
normalized[k] = JSON.stringify(v)
92+
} catch {
93+
normalized[k] = ''
94+
}
95+
}
96+
}
97+
}
98+
config.resolve = { ...existingResolve, alias: normalized } as Configuration['resolve']
99+
}
55100
}
56101

57102
return config
58103
},
104+
59105
typescript: {
60106
ignoreBuildErrors: true,
61107
tsconfigPath: './tsconfig.json',
@@ -92,7 +138,7 @@ const nextConfig: NextConfig = {
92138
// optimizeCss: true,
93139
esmExternals: true,
94140
scrollRestoration: true,
95-
// cpus: 16,
141+
// cpus: 16,
96142
// cssChunking: true,
97143
// craCompat: true,
98144
// validateRSCRequestHeaders: true,

0 commit comments

Comments
 (0)