Skip to content

Commit 6ee8faf

Browse files
committed
chore: update dependencies and improve code structure
- Updated node version in convex.json from "24" to "20". - Enhanced api.d.ts by adding internal API reference and improving type imports. - Fixed formatting in storage.ts by adding missing semicolons. - Defined mastraWorkflowSnapshotsTable in schema.ts to ensure proper indexing. - Updated package-lock.json and package.json to bump convex and @types/node versions. - Renamed E2bSandboxTool to E2bSandboxToolComponent for clarity in e2b-sandbox-tool.tsx. - Refactored output handling in web-scraper-tool.tsx to improve data extraction. - Commented out unused ConvertDataFormatUITool type in types.ts for clarity.
1 parent 832aa5b commit 6ee8faf

10 files changed

Lines changed: 128 additions & 38 deletions

File tree

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+
});

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,

package-lock.json

Lines changed: 9 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@
130130
"cmdk": "^1.1.1",
131131
"concurrently": "^9.2.1",
132132
"convert-csv-to-json": "^3.20.0",
133-
"convex": "^1.26.2",
133+
"convex": "^1.31.4",
134134
"crawlee": "^3.15.3",
135135
"critters": "^0.0.25",
136136
"csv-parse": "^6.1.0",
@@ -225,7 +225,7 @@
225225
"@types/jsdom": "^27.0.0",
226226
"@types/leaflet.markercluster": "^1.5.6",
227227
"@types/mdx": "^2.0.13",
228-
"@types/node": "^24.10.6",
228+
"@types/node": "^22.19.7",
229229
"@types/rbush": "^4.0.0",
230230
"@types/react": "^19.2.8",
231231
"@types/react-dom": "^19.2.3",

src/components/ai-elements/tools/e2b-sandbox-tool.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ interface E2bSandboxToolProps {
3636
errorText?: string
3737
}
3838

39-
export function E2bSandboxTool({
39+
export function E2bSandboxToolComponent({
4040
input,
4141
output,
4242
errorText,
@@ -80,7 +80,7 @@ export function E2bSandboxTool({
8080
}
8181

8282
const { action, sandboxId } = input
83-
const { result } = output
83+
const result = output.result
8484

8585
return (
8686
<div className="space-y-4">

src/components/ai-elements/tools/types.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ import type {
2525
codeSearchTool,
2626
colorChangeTool,
2727
contentCleanerTool,
28-
convertDataFormatTool,
2928
copyDataFileTool,
3029
copywriterTool,
3130
createDataDirTool,
@@ -171,7 +170,7 @@ export type CodeChunkerUITool = InferUITool<typeof codeChunkerTool>
171170
export type CodeSearchUITool = InferUITool<typeof codeSearchTool>
172171
export type ColorChangeUITool = InferUITool<typeof colorChangeTool>
173172
export type ContentCleanerUITool = InferUITool<typeof contentCleanerTool>
174-
export type ConvertDataFormatUITool = InferUITool<typeof convertDataFormatTool>
173+
//export type ConvertDataFormatUITool = InferUITool<typeof convertDataFormatTool>
175174
export type CopyDataFileUITool = InferUITool<typeof copyDataFileTool>
176175
export type CopywriterUITool = InferUITool<typeof copywriterTool>
177176
export type CreateDataDirUITool = InferUITool<typeof createDataDirTool>

src/components/ai-elements/tools/web-scraper-tool.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,18 @@ export function WebScraperTool({
6464
)
6565
}
6666

67+
const content = output.content || {}
6768
const {
6869
extractedData,
6970
rawContent,
7071
markdownContent,
72+
} = content
73+
74+
const {
7175
metadata,
7276
images,
7377
structuredData,
74-
} = output
78+
} = output.analysis || {}
7579

7680
return (
7781
<div className="space-y-4">

0 commit comments

Comments
 (0)