@mastra/deployer-netlify 0.1.19-alpha.8 → 0.1.19-alpha.9

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.
package/dist/index.cjs CHANGED
@@ -140,13 +140,60 @@ to = "/.netlify/functions/api/:splat"
140
140
  }
141
141
  getEntry() {
142
142
  return `
143
- import { handle } from 'hono/netlify'
144
- import { mastra } from '#mastra';
145
- 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';
146
150
 
147
- const app = await createHonoServer(mastra);
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
+ }
167
+
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;
175
+
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);
148
195
 
149
- export default handle(app)
196
+ export default handle(app)
150
197
  `;
151
198
  }
152
199
  };
package/dist/index.js CHANGED
@@ -138,13 +138,60 @@ to = "/.netlify/functions/api/:splat"
138
138
  }
139
139
  getEntry() {
140
140
  return `
141
- import { handle } from 'hono/netlify'
142
- import { mastra } from '#mastra';
143
- 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';
144
148
 
145
- const app = await createHonoServer(mastra);
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
+ }
165
+
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;
173
+
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);
146
193
 
147
- export default handle(app)
194
+ export default handle(app)
148
195
  `;
149
196
  }
150
197
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/deployer-netlify",
3
- "version": "0.1.19-alpha.8",
3
+ "version": "0.1.19-alpha.9",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "files": [
@@ -30,8 +30,8 @@
30
30
  "execa": "^9.5.2",
31
31
  "netlify-cli": "^19.0.3",
32
32
  "zod": "^3.24.2",
33
- "@mastra/core": "^0.9.0-alpha.7",
34
- "@mastra/deployer": "^0.3.0-alpha.8"
33
+ "@mastra/core": "^0.9.0-alpha.8",
34
+ "@mastra/deployer": "^0.3.0-alpha.9"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@microsoft/api-extractor": "^7.52.1",