@mastra/deployer-cloudflare 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 +56 -9
- package/dist/index.js +56 -9
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -59,16 +59,63 @@ var CloudflareDeployer = class extends deployer.Deployer {
|
|
|
59
59
|
}
|
|
60
60
|
getEntry() {
|
|
61
61
|
return `
|
|
62
|
-
import '#polyfills';
|
|
63
|
-
import { mastra } from '#mastra';
|
|
64
|
-
import { createHonoServer } from '#server';
|
|
62
|
+
import '#polyfills';
|
|
63
|
+
import { mastra } from '#mastra';
|
|
64
|
+
import { createHonoServer } from '#server';
|
|
65
|
+
import { evaluate } from '@mastra/core/eval';
|
|
66
|
+
import { AvailableHooks, registerHook } from '@mastra/core/hooks';
|
|
67
|
+
import { TABLE_EVALS } from '@mastra/core/storage';
|
|
68
|
+
import { checkEvalStorageFields } from '@mastra/core/utils';
|
|
65
69
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
70
|
+
registerHook(AvailableHooks.ON_GENERATION, ({ input, output, metric, runId, agentName, instructions }) => {
|
|
71
|
+
evaluate({
|
|
72
|
+
agentName,
|
|
73
|
+
input,
|
|
74
|
+
metric,
|
|
75
|
+
output,
|
|
76
|
+
runId,
|
|
77
|
+
globalRunId: runId,
|
|
78
|
+
instructions,
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
if (mastra.getStorage()) {
|
|
83
|
+
// start storage init in the background
|
|
84
|
+
mastra.getStorage().init();
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
registerHook(AvailableHooks.ON_EVALUATION, async traceObject => {
|
|
88
|
+
const storage = mastra.getStorage();
|
|
89
|
+
if (storage) {
|
|
90
|
+
// Check for required fields
|
|
91
|
+
const logger = mastra?.getLogger();
|
|
92
|
+
const areFieldsValid = checkEvalStorageFields(traceObject, logger);
|
|
93
|
+
if (!areFieldsValid) return;
|
|
94
|
+
|
|
95
|
+
await storage.insert({
|
|
96
|
+
tableName: TABLE_EVALS,
|
|
97
|
+
record: {
|
|
98
|
+
input: traceObject.input,
|
|
99
|
+
output: traceObject.output,
|
|
100
|
+
result: JSON.stringify(traceObject.result || {}),
|
|
101
|
+
agent_name: traceObject.agentName,
|
|
102
|
+
metric_name: traceObject.metricName,
|
|
103
|
+
instructions: traceObject.instructions,
|
|
104
|
+
test_info: null,
|
|
105
|
+
global_run_id: traceObject.globalRunId,
|
|
106
|
+
run_id: traceObject.runId,
|
|
107
|
+
created_at: new Date().toISOString(),
|
|
108
|
+
},
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
export default {
|
|
114
|
+
fetch: async (request, env, context) => {
|
|
115
|
+
const app = await createHonoServer(mastra)
|
|
116
|
+
return app.fetch(request, env, context);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
72
119
|
`;
|
|
73
120
|
}
|
|
74
121
|
async prepare(outputDirectory) {
|
package/dist/index.js
CHANGED
|
@@ -53,16 +53,63 @@ var CloudflareDeployer = class extends Deployer {
|
|
|
53
53
|
}
|
|
54
54
|
getEntry() {
|
|
55
55
|
return `
|
|
56
|
-
import '#polyfills';
|
|
57
|
-
import { mastra } from '#mastra';
|
|
58
|
-
import { createHonoServer } from '#server';
|
|
56
|
+
import '#polyfills';
|
|
57
|
+
import { mastra } from '#mastra';
|
|
58
|
+
import { createHonoServer } from '#server';
|
|
59
|
+
import { evaluate } from '@mastra/core/eval';
|
|
60
|
+
import { AvailableHooks, registerHook } from '@mastra/core/hooks';
|
|
61
|
+
import { TABLE_EVALS } from '@mastra/core/storage';
|
|
62
|
+
import { checkEvalStorageFields } from '@mastra/core/utils';
|
|
59
63
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
64
|
+
registerHook(AvailableHooks.ON_GENERATION, ({ input, output, metric, runId, agentName, instructions }) => {
|
|
65
|
+
evaluate({
|
|
66
|
+
agentName,
|
|
67
|
+
input,
|
|
68
|
+
metric,
|
|
69
|
+
output,
|
|
70
|
+
runId,
|
|
71
|
+
globalRunId: runId,
|
|
72
|
+
instructions,
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
if (mastra.getStorage()) {
|
|
77
|
+
// start storage init in the background
|
|
78
|
+
mastra.getStorage().init();
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
registerHook(AvailableHooks.ON_EVALUATION, async traceObject => {
|
|
82
|
+
const storage = mastra.getStorage();
|
|
83
|
+
if (storage) {
|
|
84
|
+
// Check for required fields
|
|
85
|
+
const logger = mastra?.getLogger();
|
|
86
|
+
const areFieldsValid = checkEvalStorageFields(traceObject, logger);
|
|
87
|
+
if (!areFieldsValid) return;
|
|
88
|
+
|
|
89
|
+
await storage.insert({
|
|
90
|
+
tableName: TABLE_EVALS,
|
|
91
|
+
record: {
|
|
92
|
+
input: traceObject.input,
|
|
93
|
+
output: traceObject.output,
|
|
94
|
+
result: JSON.stringify(traceObject.result || {}),
|
|
95
|
+
agent_name: traceObject.agentName,
|
|
96
|
+
metric_name: traceObject.metricName,
|
|
97
|
+
instructions: traceObject.instructions,
|
|
98
|
+
test_info: null,
|
|
99
|
+
global_run_id: traceObject.globalRunId,
|
|
100
|
+
run_id: traceObject.runId,
|
|
101
|
+
created_at: new Date().toISOString(),
|
|
102
|
+
},
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
export default {
|
|
108
|
+
fetch: async (request, env, context) => {
|
|
109
|
+
const app = await createHonoServer(mastra)
|
|
110
|
+
return app.fetch(request, env, context);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
66
113
|
`;
|
|
67
114
|
}
|
|
68
115
|
async prepare(outputDirectory) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/deployer-cloudflare",
|
|
3
|
-
"version": "0.1.19-alpha.
|
|
3
|
+
"version": "0.1.19-alpha.9",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -43,8 +43,8 @@
|
|
|
43
43
|
"rollup-plugin-shim": "^1.0.0",
|
|
44
44
|
"wrangler": "^4.4.0",
|
|
45
45
|
"zod": "^3.24.2",
|
|
46
|
-
"@mastra/
|
|
47
|
-
"@mastra/
|
|
46
|
+
"@mastra/core": "^0.9.0-alpha.8",
|
|
47
|
+
"@mastra/deployer": "^0.3.0-alpha.9"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"@microsoft/api-extractor": "^7.52.1",
|