@mastra/deployer-netlify 0.0.0-fix-memory-xxhash-20250409202110 → 0.0.0-fix-message-embedding-20250506021742

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.
@@ -1,4 +1,6 @@
1
- Elastic License 2.0 (ELv2)
1
+ # Elastic License 2.0 (ELv2)
2
+
3
+ Copyright (c) 2025 Mastra AI, Inc.
2
4
 
3
5
  **Acceptance**
4
6
  By using the software, you agree to all of the terms and conditions below.
@@ -29,10 +29,12 @@ export declare class NetlifyDeployer extends Deployer {
29
29
  writeFiles({ dir }: {
30
30
  dir: string;
31
31
  }): void;
32
+ protected installDependencies(outputDirectory: string, rootDir?: string): Promise<void>;
32
33
  deploy(outputDirectory: string): Promise<void>;
33
34
  prepare(outputDirectory: string): Promise<void>;
34
- bundle(entryFile: string, outputDirectory: string): Promise<void>;
35
+ bundle(entryFile: string, outputDirectory: string, toolsPaths: string[]): Promise<void>;
35
36
  private getEntry;
37
+ lint(entryFile: string, outputDirectory: string, toolsPaths: string[]): Promise<void>;
36
38
  }
37
39
 
38
40
  export { }
@@ -29,10 +29,12 @@ export declare class NetlifyDeployer extends Deployer {
29
29
  writeFiles({ dir }: {
30
30
  dir: string;
31
31
  }): void;
32
+ protected installDependencies(outputDirectory: string, rootDir?: string): Promise<void>;
32
33
  deploy(outputDirectory: string): Promise<void>;
33
34
  prepare(outputDirectory: string): Promise<void>;
34
- bundle(entryFile: string, outputDirectory: string): Promise<void>;
35
+ bundle(entryFile: string, outputDirectory: string, toolsPaths: string[]): Promise<void>;
35
36
  private getEntry;
37
+ lint(entryFile: string, outputDirectory: string, toolsPaths: string[]): Promise<void>;
36
38
  }
37
39
 
38
40
  export { }
package/dist/index.cjs CHANGED
@@ -3,6 +3,7 @@
3
3
  var fs = require('fs');
4
4
  var path = require('path');
5
5
  var deployer = require('@mastra/deployer');
6
+ var services = require('@mastra/deployer/services');
6
7
  var execa = require('execa');
7
8
 
8
9
  // src/index.ts
@@ -89,6 +90,18 @@ to = "/.netlify/functions/api/:splat"
89
90
  `
90
91
  );
91
92
  }
93
+ async installDependencies(outputDirectory, rootDir = process.cwd()) {
94
+ const deps = new services.DepsService(rootDir);
95
+ deps.__setLogger(this.logger);
96
+ await deps.install({
97
+ dir: path.join(outputDirectory, this.outputDir),
98
+ architecture: {
99
+ os: ["linux"],
100
+ cpu: ["x64"],
101
+ libc: ["gnu"]
102
+ }
103
+ });
104
+ }
92
105
  async deploy(outputDirectory) {
93
106
  const site = await getOrCreateSite({ token: this.token, name: this.projectName || `mastra`, scope: this.scope });
94
107
  const p2 = execa.execa(
@@ -116,25 +129,76 @@ to = "/.netlify/functions/api/:splat"
116
129
  await super.prepare(outputDirectory);
117
130
  this.writeFiles({ dir: path.join(outputDirectory, this.outputDir) });
118
131
  }
119
- async bundle(entryFile, outputDirectory) {
132
+ async bundle(entryFile, outputDirectory, toolsPaths) {
120
133
  return this._bundle(
121
134
  this.getEntry(),
122
135
  entryFile,
123
136
  outputDirectory,
137
+ toolsPaths,
124
138
  path.join(outputDirectory, this.outputDir, "netlify", "functions", "api")
125
139
  );
126
140
  }
127
141
  getEntry() {
128
142
  return `
129
- import { handle } from 'hono/netlify'
130
- import { mastra } from '#mastra';
131
- import { createHonoServer } from '#server';
143
+ import { handle } from 'hono/netlify'
144
+ import { mastra } from '#mastra';
145
+ import { createHonoServer } from '#server';
146
+ import { evaluate } from '@mastra/core/eval';
147
+ import { AvailableHooks, registerHook } from '@mastra/core/hooks';
148
+ import { TABLE_EVALS } from '@mastra/core/storage';
149
+ import { checkEvalStorageFields } from '@mastra/core/utils';
150
+
151
+ registerHook(AvailableHooks.ON_GENERATION, ({ input, output, metric, runId, agentName, instructions }) => {
152
+ evaluate({
153
+ agentName,
154
+ input,
155
+ metric,
156
+ output,
157
+ runId,
158
+ globalRunId: runId,
159
+ instructions,
160
+ });
161
+ });
162
+
163
+ if (mastra.getStorage()) {
164
+ // start storage init in the background
165
+ mastra.getStorage().init();
166
+ }
132
167
 
133
- const app = await createHonoServer(mastra);
168
+ registerHook(AvailableHooks.ON_EVALUATION, async traceObject => {
169
+ const storage = mastra.getStorage();
170
+ if (storage) {
171
+ // Check for required fields
172
+ const logger = mastra?.getLogger();
173
+ const areFieldsValid = checkEvalStorageFields(traceObject, logger);
174
+ if (!areFieldsValid) return;
134
175
 
135
- export default handle(app)
176
+ await storage.insert({
177
+ tableName: TABLE_EVALS,
178
+ record: {
179
+ input: traceObject.input,
180
+ output: traceObject.output,
181
+ result: JSON.stringify(traceObject.result || {}),
182
+ agent_name: traceObject.agentName,
183
+ metric_name: traceObject.metricName,
184
+ instructions: traceObject.instructions,
185
+ test_info: null,
186
+ global_run_id: traceObject.globalRunId,
187
+ run_id: traceObject.runId,
188
+ created_at: new Date().toISOString(),
189
+ },
190
+ });
191
+ }
192
+ });
193
+
194
+ const app = await createHonoServer(mastra);
195
+
196
+ export default handle(app)
136
197
  `;
137
198
  }
199
+ async lint(entryFile, outputDirectory, toolsPaths) {
200
+ await super.lint(entryFile, outputDirectory, toolsPaths);
201
+ }
138
202
  };
139
203
 
140
204
  exports.NetlifyDeployer = NetlifyDeployer;
package/dist/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import { existsSync, mkdirSync, writeFileSync } from 'fs';
2
2
  import { join } from 'path';
3
3
  import { Deployer } from '@mastra/deployer';
4
+ import { DepsService } from '@mastra/deployer/services';
4
5
  import { execa } from 'execa';
5
6
 
6
7
  // src/index.ts
@@ -87,6 +88,18 @@ to = "/.netlify/functions/api/:splat"
87
88
  `
88
89
  );
89
90
  }
91
+ async installDependencies(outputDirectory, rootDir = process.cwd()) {
92
+ const deps = new DepsService(rootDir);
93
+ deps.__setLogger(this.logger);
94
+ await deps.install({
95
+ dir: join(outputDirectory, this.outputDir),
96
+ architecture: {
97
+ os: ["linux"],
98
+ cpu: ["x64"],
99
+ libc: ["gnu"]
100
+ }
101
+ });
102
+ }
90
103
  async deploy(outputDirectory) {
91
104
  const site = await getOrCreateSite({ token: this.token, name: this.projectName || `mastra`, scope: this.scope });
92
105
  const p2 = execa(
@@ -114,25 +127,76 @@ to = "/.netlify/functions/api/:splat"
114
127
  await super.prepare(outputDirectory);
115
128
  this.writeFiles({ dir: join(outputDirectory, this.outputDir) });
116
129
  }
117
- async bundle(entryFile, outputDirectory) {
130
+ async bundle(entryFile, outputDirectory, toolsPaths) {
118
131
  return this._bundle(
119
132
  this.getEntry(),
120
133
  entryFile,
121
134
  outputDirectory,
135
+ toolsPaths,
122
136
  join(outputDirectory, this.outputDir, "netlify", "functions", "api")
123
137
  );
124
138
  }
125
139
  getEntry() {
126
140
  return `
127
- import { handle } from 'hono/netlify'
128
- import { mastra } from '#mastra';
129
- import { createHonoServer } from '#server';
141
+ import { handle } from 'hono/netlify'
142
+ import { mastra } from '#mastra';
143
+ import { createHonoServer } from '#server';
144
+ import { evaluate } from '@mastra/core/eval';
145
+ import { AvailableHooks, registerHook } from '@mastra/core/hooks';
146
+ import { TABLE_EVALS } from '@mastra/core/storage';
147
+ import { checkEvalStorageFields } from '@mastra/core/utils';
148
+
149
+ registerHook(AvailableHooks.ON_GENERATION, ({ input, output, metric, runId, agentName, instructions }) => {
150
+ evaluate({
151
+ agentName,
152
+ input,
153
+ metric,
154
+ output,
155
+ runId,
156
+ globalRunId: runId,
157
+ instructions,
158
+ });
159
+ });
160
+
161
+ if (mastra.getStorage()) {
162
+ // start storage init in the background
163
+ mastra.getStorage().init();
164
+ }
130
165
 
131
- const app = await createHonoServer(mastra);
166
+ registerHook(AvailableHooks.ON_EVALUATION, async traceObject => {
167
+ const storage = mastra.getStorage();
168
+ if (storage) {
169
+ // Check for required fields
170
+ const logger = mastra?.getLogger();
171
+ const areFieldsValid = checkEvalStorageFields(traceObject, logger);
172
+ if (!areFieldsValid) return;
132
173
 
133
- export default handle(app)
174
+ await storage.insert({
175
+ tableName: TABLE_EVALS,
176
+ record: {
177
+ input: traceObject.input,
178
+ output: traceObject.output,
179
+ result: JSON.stringify(traceObject.result || {}),
180
+ agent_name: traceObject.agentName,
181
+ metric_name: traceObject.metricName,
182
+ instructions: traceObject.instructions,
183
+ test_info: null,
184
+ global_run_id: traceObject.globalRunId,
185
+ run_id: traceObject.runId,
186
+ created_at: new Date().toISOString(),
187
+ },
188
+ });
189
+ }
190
+ });
191
+
192
+ const app = await createHonoServer(mastra);
193
+
194
+ export default handle(app)
134
195
  `;
135
196
  }
197
+ async lint(entryFile, outputDirectory, toolsPaths) {
198
+ await super.lint(entryFile, outputDirectory, toolsPaths);
199
+ }
136
200
  };
137
201
 
138
202
  export { NetlifyDeployer };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/deployer-netlify",
3
- "version": "0.0.0-fix-memory-xxhash-20250409202110",
3
+ "version": "0.0.0-fix-message-embedding-20250506021742",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "files": [
@@ -23,24 +23,24 @@
23
23
  },
24
24
  "keywords": [],
25
25
  "author": "",
26
- "license": "ISC",
26
+ "license": "Elastic-2.0",
27
27
  "dependencies": {
28
28
  "@rollup/plugin-virtual": "^3.0.2",
29
29
  "date-fns": "^4.1.0",
30
30
  "execa": "^9.5.2",
31
31
  "netlify-cli": "^19.0.3",
32
32
  "zod": "^3.24.2",
33
- "@mastra/core": "0.0.0-fix-memory-xxhash-20250409202110",
34
- "@mastra/deployer": "0.0.0-fix-memory-xxhash-20250409202110"
33
+ "@mastra/core": "0.0.0-fix-message-embedding-20250506021742",
34
+ "@mastra/deployer": "0.0.0-fix-message-embedding-20250506021742"
35
35
  },
36
36
  "devDependencies": {
37
- "@microsoft/api-extractor": "^7.52.1",
37
+ "@microsoft/api-extractor": "^7.52.5",
38
38
  "@types/node": "^20.17.27",
39
39
  "eslint": "^9.23.0",
40
40
  "tsup": "^8.4.0",
41
41
  "typescript": "^5.8.2",
42
- "vitest": "^3.0.9",
43
- "@internal/lint": "0.0.1"
42
+ "vitest": "^3.1.2",
43
+ "@internal/lint": "0.0.0-fix-message-embedding-20250506021742"
44
44
  },
45
45
  "scripts": {
46
46
  "build": "tsup src/index.ts --format esm,cjs --experimental-dts --clean --treeshake=smallest --splitting",