@mastra/deployer-netlify 0.0.0-revert-schema-20250416221206 → 0.0.0-separate-trace-data-from-component-20250501042644
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/_tsup-dts-rollup.d.cts +1 -1
- package/dist/_tsup-dts-rollup.d.ts +1 -1
- package/dist/index.cjs +54 -6
- package/dist/index.js +54 -6
- package/package.json +5 -5
|
@@ -32,7 +32,7 @@ export declare class NetlifyDeployer extends Deployer {
|
|
|
32
32
|
protected installDependencies(outputDirectory: string, rootDir?: string): Promise<void>;
|
|
33
33
|
deploy(outputDirectory: string): Promise<void>;
|
|
34
34
|
prepare(outputDirectory: string): Promise<void>;
|
|
35
|
-
bundle(entryFile: string, outputDirectory: string): Promise<void>;
|
|
35
|
+
bundle(entryFile: string, outputDirectory: string, toolsPaths: string[]): Promise<void>;
|
|
36
36
|
private getEntry;
|
|
37
37
|
}
|
|
38
38
|
|
|
@@ -32,7 +32,7 @@ export declare class NetlifyDeployer extends Deployer {
|
|
|
32
32
|
protected installDependencies(outputDirectory: string, rootDir?: string): Promise<void>;
|
|
33
33
|
deploy(outputDirectory: string): Promise<void>;
|
|
34
34
|
prepare(outputDirectory: string): Promise<void>;
|
|
35
|
-
bundle(entryFile: string, outputDirectory: string): Promise<void>;
|
|
35
|
+
bundle(entryFile: string, outputDirectory: string, toolsPaths: string[]): Promise<void>;
|
|
36
36
|
private getEntry;
|
|
37
37
|
}
|
|
38
38
|
|
package/dist/index.cjs
CHANGED
|
@@ -129,23 +129,71 @@ to = "/.netlify/functions/api/:splat"
|
|
|
129
129
|
await super.prepare(outputDirectory);
|
|
130
130
|
this.writeFiles({ dir: path.join(outputDirectory, this.outputDir) });
|
|
131
131
|
}
|
|
132
|
-
async bundle(entryFile, outputDirectory) {
|
|
132
|
+
async bundle(entryFile, outputDirectory, toolsPaths) {
|
|
133
133
|
return this._bundle(
|
|
134
134
|
this.getEntry(),
|
|
135
135
|
entryFile,
|
|
136
136
|
outputDirectory,
|
|
137
|
+
toolsPaths,
|
|
137
138
|
path.join(outputDirectory, this.outputDir, "netlify", "functions", "api")
|
|
138
139
|
);
|
|
139
140
|
}
|
|
140
141
|
getEntry() {
|
|
141
142
|
return `
|
|
142
|
-
import { handle } from 'hono/netlify'
|
|
143
|
-
import { mastra } from '#mastra';
|
|
144
|
-
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';
|
|
145
150
|
|
|
146
|
-
|
|
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);
|
|
147
195
|
|
|
148
|
-
export default handle(app)
|
|
196
|
+
export default handle(app)
|
|
149
197
|
`;
|
|
150
198
|
}
|
|
151
199
|
};
|
package/dist/index.js
CHANGED
|
@@ -127,23 +127,71 @@ to = "/.netlify/functions/api/:splat"
|
|
|
127
127
|
await super.prepare(outputDirectory);
|
|
128
128
|
this.writeFiles({ dir: join(outputDirectory, this.outputDir) });
|
|
129
129
|
}
|
|
130
|
-
async bundle(entryFile, outputDirectory) {
|
|
130
|
+
async bundle(entryFile, outputDirectory, toolsPaths) {
|
|
131
131
|
return this._bundle(
|
|
132
132
|
this.getEntry(),
|
|
133
133
|
entryFile,
|
|
134
134
|
outputDirectory,
|
|
135
|
+
toolsPaths,
|
|
135
136
|
join(outputDirectory, this.outputDir, "netlify", "functions", "api")
|
|
136
137
|
);
|
|
137
138
|
}
|
|
138
139
|
getEntry() {
|
|
139
140
|
return `
|
|
140
|
-
import { handle } from 'hono/netlify'
|
|
141
|
-
import { mastra } from '#mastra';
|
|
142
|
-
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';
|
|
143
148
|
|
|
144
|
-
|
|
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);
|
|
145
193
|
|
|
146
|
-
export default handle(app)
|
|
194
|
+
export default handle(app)
|
|
147
195
|
`;
|
|
148
196
|
}
|
|
149
197
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/deployer-netlify",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-separate-trace-data-from-component-20250501042644",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -30,16 +30,16 @@
|
|
|
30
30
|
"execa": "^9.5.2",
|
|
31
31
|
"netlify-cli": "^19.0.3",
|
|
32
32
|
"zod": "^3.24.2",
|
|
33
|
-
"@mastra/
|
|
34
|
-
"@mastra/
|
|
33
|
+
"@mastra/deployer": "0.0.0-separate-trace-data-from-component-20250501042644",
|
|
34
|
+
"@mastra/core": "0.0.0-separate-trace-data-from-component-20250501042644"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@microsoft/api-extractor": "^7.52.
|
|
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.
|
|
42
|
+
"vitest": "^3.1.2",
|
|
43
43
|
"@internal/lint": "0.0.2"
|
|
44
44
|
},
|
|
45
45
|
"scripts": {
|