@mastra/deployer-vercel 0.1.19-alpha.7 → 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
@@ -135,6 +135,53 @@ var VercelDeployer = class extends deployer.Deployer {
135
135
  import { handle } from 'hono/vercel'
136
136
  import { mastra } from '#mastra';
137
137
  import { createHonoServer } from '#server';
138
+ import { evaluate } from '@mastra/core/eval';
139
+ import { AvailableHooks, registerHook } from '@mastra/core/hooks';
140
+ import { TABLE_EVALS } from '@mastra/core/storage';
141
+ import { checkEvalStorageFields } from '@mastra/core/utils';
142
+
143
+ registerHook(AvailableHooks.ON_GENERATION, ({ input, output, metric, runId, agentName, instructions }) => {
144
+ evaluate({
145
+ agentName,
146
+ input,
147
+ metric,
148
+ output,
149
+ runId,
150
+ globalRunId: runId,
151
+ instructions,
152
+ });
153
+ });
154
+
155
+ if (mastra.getStorage()) {
156
+ // start storage init in the background
157
+ mastra.getStorage().init();
158
+ }
159
+
160
+ registerHook(AvailableHooks.ON_EVALUATION, async traceObject => {
161
+ const storage = mastra.getStorage();
162
+ if (storage) {
163
+ // Check for required fields
164
+ const logger = mastra?.getLogger();
165
+ const areFieldsValid = checkEvalStorageFields(traceObject, logger);
166
+ if (!areFieldsValid) return;
167
+
168
+ await storage.insert({
169
+ tableName: TABLE_EVALS,
170
+ record: {
171
+ input: traceObject.input,
172
+ output: traceObject.output,
173
+ result: JSON.stringify(traceObject.result || {}),
174
+ agent_name: traceObject.agentName,
175
+ metric_name: traceObject.metricName,
176
+ instructions: traceObject.instructions,
177
+ test_info: null,
178
+ global_run_id: traceObject.globalRunId,
179
+ run_id: traceObject.runId,
180
+ created_at: new Date().toISOString(),
181
+ },
182
+ });
183
+ }
184
+ });
138
185
 
139
186
  const app = await createHonoServer(mastra);
140
187
 
package/dist/index.js CHANGED
@@ -110,6 +110,53 @@ var VercelDeployer = class extends Deployer {
110
110
  import { handle } from 'hono/vercel'
111
111
  import { mastra } from '#mastra';
112
112
  import { createHonoServer } from '#server';
113
+ import { evaluate } from '@mastra/core/eval';
114
+ import { AvailableHooks, registerHook } from '@mastra/core/hooks';
115
+ import { TABLE_EVALS } from '@mastra/core/storage';
116
+ import { checkEvalStorageFields } from '@mastra/core/utils';
117
+
118
+ registerHook(AvailableHooks.ON_GENERATION, ({ input, output, metric, runId, agentName, instructions }) => {
119
+ evaluate({
120
+ agentName,
121
+ input,
122
+ metric,
123
+ output,
124
+ runId,
125
+ globalRunId: runId,
126
+ instructions,
127
+ });
128
+ });
129
+
130
+ if (mastra.getStorage()) {
131
+ // start storage init in the background
132
+ mastra.getStorage().init();
133
+ }
134
+
135
+ registerHook(AvailableHooks.ON_EVALUATION, async traceObject => {
136
+ const storage = mastra.getStorage();
137
+ if (storage) {
138
+ // Check for required fields
139
+ const logger = mastra?.getLogger();
140
+ const areFieldsValid = checkEvalStorageFields(traceObject, logger);
141
+ if (!areFieldsValid) return;
142
+
143
+ await storage.insert({
144
+ tableName: TABLE_EVALS,
145
+ record: {
146
+ input: traceObject.input,
147
+ output: traceObject.output,
148
+ result: JSON.stringify(traceObject.result || {}),
149
+ agent_name: traceObject.agentName,
150
+ metric_name: traceObject.metricName,
151
+ instructions: traceObject.instructions,
152
+ test_info: null,
153
+ global_run_id: traceObject.globalRunId,
154
+ run_id: traceObject.runId,
155
+ created_at: new Date().toISOString(),
156
+ },
157
+ });
158
+ }
159
+ });
113
160
 
114
161
  const app = await createHonoServer(mastra);
115
162
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/deployer-vercel",
3
- "version": "0.1.19-alpha.7",
3
+ "version": "0.1.19-alpha.9",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "files": [
@@ -27,8 +27,8 @@
27
27
  "dependencies": {
28
28
  "@rollup/plugin-virtual": "^3.0.2",
29
29
  "fs-extra": "^11.3.0",
30
- "@mastra/core": "^0.9.0-alpha.6",
31
- "@mastra/deployer": "^0.3.0-alpha.7"
30
+ "@mastra/deployer": "^0.3.0-alpha.9",
31
+ "@mastra/core": "^0.9.0-alpha.8"
32
32
  },
33
33
  "devDependencies": {
34
34
  "@microsoft/api-extractor": "^7.52.1",