@mastra/deployer 0.18.0-alpha.2 → 0.18.0

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/CHANGELOG.md CHANGED
@@ -1,5 +1,36 @@
1
1
  # @mastra/deployer
2
2
 
3
+ ## 0.18.0
4
+
5
+ ### Patch Changes
6
+
7
+ - dependencies updates: ([#8007](https://github.com/mastra-ai/mastra/pull/8007))
8
+ - Updated dependency [`fs-extra@^11.3.2` ↗︎](https://www.npmjs.com/package/fs-extra/v/11.3.2) (from `^11.3.1`, in `dependencies`)
9
+
10
+ - Add model fallback handlers and apis ([#7378](https://github.com/mastra-ai/mastra/pull/7378))
11
+
12
+ - build bundle - Configure project root for private packages config ([#8004](https://github.com/mastra-ai/mastra/pull/8004))
13
+
14
+ - Update Peerdeps for packages based on core minor bump ([#8025](https://github.com/mastra-ai/mastra/pull/8025))
15
+
16
+ - Add server api to score traces ([#8064](https://github.com/mastra-ai/mastra/pull/8064))
17
+
18
+ - Updated dependencies [[`cf34503`](https://github.com/mastra-ai/mastra/commit/cf345031de4e157f29087946449e60b965e9c8a9), [`6b4b1e4`](https://github.com/mastra-ai/mastra/commit/6b4b1e4235428d39e51cbda9832704c0ba70ab32), [`3469fca`](https://github.com/mastra-ai/mastra/commit/3469fca7bb7e5e19369ff9f7044716a5e4b02585), [`a61f23f`](https://github.com/mastra-ai/mastra/commit/a61f23fbbca4b88b763d94f1d784c47895ed72d7), [`4b339b8`](https://github.com/mastra-ai/mastra/commit/4b339b8141c20d6a6d80583c7e8c5c05d8c19492), [`8f56160`](https://github.com/mastra-ai/mastra/commit/8f56160fd45c740076529148b9c225f6842d43b0), [`d1dc606`](https://github.com/mastra-ai/mastra/commit/d1dc6067b0557a71190b68d56ee15b48c26d2411), [`c45298a`](https://github.com/mastra-ai/mastra/commit/c45298a0a0791db35cf79f1199d77004da0704cb), [`c4a8204`](https://github.com/mastra-ai/mastra/commit/c4a82046bfd241d6044e234bc5917d5a01fe6b55), [`d3bd4d4`](https://github.com/mastra-ai/mastra/commit/d3bd4d482a685bbb67bfa89be91c90dca3fa71ad), [`c591dfc`](https://github.com/mastra-ai/mastra/commit/c591dfc1e600fae1dedffe239357d250e146378f), [`1920c5c`](https://github.com/mastra-ai/mastra/commit/1920c5c6d666f687785c73021196aa551e579e0d), [`b6a3b65`](https://github.com/mastra-ai/mastra/commit/b6a3b65d830fa0ca7754ad6481661d1f2c878f21), [`af3abb6`](https://github.com/mastra-ai/mastra/commit/af3abb6f7c7585d856e22d27f4e7d2ece2186b9a), [`5b1ee71`](https://github.com/mastra-ai/mastra/commit/5b1ee71dc3ac92383226dc1e375642ca5f9b4224), [`282379f`](https://github.com/mastra-ai/mastra/commit/282379fafed80c6417fe1e791087110decd481ca)]:
19
+ - @mastra/core@0.18.0
20
+ - @mastra/server@0.18.0
21
+
22
+ ## 0.18.0-alpha.3
23
+
24
+ ### Patch Changes
25
+
26
+ - Add model fallback handlers and apis ([#7378](https://github.com/mastra-ai/mastra/pull/7378))
27
+
28
+ - Add server api to score traces ([#8064](https://github.com/mastra-ai/mastra/pull/8064))
29
+
30
+ - Updated dependencies [[`4b339b8`](https://github.com/mastra-ai/mastra/commit/4b339b8141c20d6a6d80583c7e8c5c05d8c19492), [`8f56160`](https://github.com/mastra-ai/mastra/commit/8f56160fd45c740076529148b9c225f6842d43b0), [`c591dfc`](https://github.com/mastra-ai/mastra/commit/c591dfc1e600fae1dedffe239357d250e146378f), [`1920c5c`](https://github.com/mastra-ai/mastra/commit/1920c5c6d666f687785c73021196aa551e579e0d), [`b6a3b65`](https://github.com/mastra-ai/mastra/commit/b6a3b65d830fa0ca7754ad6481661d1f2c878f21), [`af3abb6`](https://github.com/mastra-ai/mastra/commit/af3abb6f7c7585d856e22d27f4e7d2ece2186b9a), [`282379f`](https://github.com/mastra-ai/mastra/commit/282379fafed80c6417fe1e791087110decd481ca)]:
31
+ - @mastra/core@0.18.0-alpha.3
32
+ - @mastra/server@0.18.0-alpha.3
33
+
3
34
  ## 0.18.0-alpha.2
4
35
 
5
36
  ### Patch Changes
@@ -55,6 +55,16 @@ export declare function getAgentsHandler(c: Context): Promise<Response & import(
55
55
  modelVersion: "v2" | "v1";
56
56
  defaultGenerateOptions: any;
57
57
  defaultStreamOptions: any;
58
+ modelList: {
59
+ model: {
60
+ modelId: string;
61
+ provider: string;
62
+ modelVersion: "v2";
63
+ };
64
+ maxRetries: number;
65
+ id: string;
66
+ enabled: boolean;
67
+ }[] | undefined;
58
68
  };
59
69
  }, import("hono/utils/http-status").ContentfulStatusCode, "json">>;
60
70
  export declare function getAgentByIdHandler(c: Context): Promise<Response & import("hono").TypedResponse<never, import("hono/utils/http-status").ContentfulStatusCode, "json">>;
@@ -211,4 +221,6 @@ export declare function deprecatedStreamVNextHandler(c: Context): Promise<Respon
211
221
  export declare function getModelProvidersHandler(c: Context): Promise<(Response & import("hono").TypedResponse<{
212
222
  error: string;
213
223
  }, 403, "json">) | (Response & import("hono").TypedResponse<string[], import("hono/utils/http-status").ContentfulStatusCode, "json">)>;
224
+ export declare function updateAgentModelInModelListHandler(c: Context): Promise<Response>;
225
+ export declare function reorderAgentModelListHandler(c: Context): Promise<Response>;
214
226
  //# sourceMappingURL=handlers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"handlers.d.ts","sourceRoot":"","sources":["../../../../../src/server/handlers/routes/agents/handlers.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAMpC,eAAO,MAAM,iBAAiB,EAAE,GA+B/B,CAAC;AAGF,eAAO,MAAM,gBAAgB,EAAE,GAoB9B,CAAC;AAGF,wBAAsB,gBAAgB,CAAC,CAAC,EAAE,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mEAOhD;AAED,wBAAsB,mBAAmB,CAAC,CAAC,EAAE,OAAO,0HAcnD;AAED,wBAAsB,wBAAwB,CAAC,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AE,OAAO,qBAgBvD;AAED,wBAAsB,4BAA4B,CAAC,CAAC,EAAE,OAAO;;;;;iBAU5D;AAED,wBAAsB,wBAAwB,CAAC,CAAC,EAAE,OAAO;;uIAWxD;AAED,wBAAsB,kCAAkC,CAAC,CAAC,EAAE,OAAO,qBAkBlE;AAED,wBAAsB,4BAA4B,CAAC,CAAC,EAAE,OAAO,qBAgB5D"}
@@ -1 +1 @@
1
- {"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../../../../../src/server/handlers/routes/agents/router.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAG5B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAwBvD,wBAAgB,YAAY,CAAC,gBAAgB,EAAE,gBAAgB,8EAsiC9D;AAED,wBAAgB,eAAe,CAAC,gBAAgB,EAAE,gBAAgB,8EAyHjE"}
1
+ {"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../../../../../src/server/handlers/routes/agents/router.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAG5B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AA0BvD,wBAAgB,YAAY,CAAC,gBAAgB,EAAE,gBAAgB,8EAspC9D;AAED,wBAAgB,eAAe,CAAC,gBAAgB,EAAE,gBAAgB,8EAyHjE"}
@@ -1,4 +1,5 @@
1
1
  import type { Context } from 'hono';
2
2
  export declare function getAITraceHandler(c: Context): Promise<Response>;
3
3
  export declare function getAITracesPaginatedHandler(c: Context): Promise<Response>;
4
+ export declare function processTraceScoringHandler(c: Context): Promise<Response>;
4
5
  //# sourceMappingURL=handlers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"handlers.d.ts","sourceRoot":"","sources":["../../../../../src/server/handlers/routes/observability/handlers.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAGpC,wBAAsB,iBAAiB,CAAC,CAAC,EAAE,OAAO,qBAkBjD;AAED,wBAAsB,2BAA2B,CAAC,CAAC,EAAE,OAAO,qBAoD3D"}
1
+ {"version":3,"file":"handlers.d.ts","sourceRoot":"","sources":["../../../../../src/server/handlers/routes/observability/handlers.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAGpC,wBAAsB,iBAAiB,CAAC,CAAC,EAAE,OAAO,qBAkBjD;AAED,wBAAsB,2BAA2B,CAAC,CAAC,EAAE,OAAO,qBAoD3D;AAED,wBAAsB,0BAA0B,CAAC,CAAC,EAAE,OAAO,qBAc1D"}
@@ -1 +1 @@
1
- {"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../../../../../src/server/handlers/routes/observability/router.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAI5B,wBAAgB,mBAAmB,+EA8FlC"}
1
+ {"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../../../../../src/server/handlers/routes/observability/router.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAI5B,wBAAgB,mBAAmB,+EAsNlC"}
@@ -259,7 +259,9 @@ export declare function getScorerHandler(c: Context): Promise<Response & import(
259
259
  rate: number;
260
260
  } | undefined;
261
261
  agentIds: string[];
262
+ agentNames: string[];
262
263
  workflowIds: string[];
264
+ isRegistered: boolean;
263
265
  } | null, import("hono/utils/http-status").ContentfulStatusCode, "json">>;
264
266
  export declare function getScoresByRunIdHandler(c: Context): Promise<Response>;
265
267
  export declare function getScoresByScorerIdHandler(c: Context): Promise<Response>;
@@ -1 +1 @@
1
- {"version":3,"file":"handlers.d.ts","sourceRoot":"","sources":["../../../../../src/server/handlers/routes/scores/handlers.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAGpC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,CAAC,EAAE,OAAO,qBAkBvD;AAED,wBAAsB,0BAA0B,CAAC,CAAC,EAAE,OAAO,qBAsB1D;AAED,wBAAsB,0BAA0B,CAAC,CAAC,EAAE,OAAO,qBAqB1D;AAED,wBAAsB,gBAAgB,CAAC,CAAC,EAAE,OAAO,qBAchD"}
@@ -624,6 +624,9 @@ var createStreamBody = (stream7) => {
624
624
  stream7.on("data", (chunk) => {
625
625
  controller.enqueue(chunk);
626
626
  });
627
+ stream7.on("error", (err) => {
628
+ controller.error(err);
629
+ });
627
630
  stream7.on("end", () => {
628
631
  controller.close();
629
632
  });
@@ -2683,6 +2686,38 @@ async function getModelProvidersHandler(c2) {
2683
2686
  const availableProvidersNames = availableProviders.map(([key]) => key);
2684
2687
  return c2.json(availableProvidersNames);
2685
2688
  }
2689
+ async function updateAgentModelInModelListHandler(c2) {
2690
+ try {
2691
+ const mastra = c2.get("mastra");
2692
+ const agentId = c2.req.param("agentId");
2693
+ const modelConfigId = c2.req.param("modelConfigId");
2694
+ const body = await c2.req.json();
2695
+ const result = await agents.updateAgentModelInModelListHandler({
2696
+ mastra,
2697
+ agentId,
2698
+ body,
2699
+ modelConfigId
2700
+ });
2701
+ return c2.json(result);
2702
+ } catch (error) {
2703
+ return handleError(error, "Error updating agent model in model list");
2704
+ }
2705
+ }
2706
+ async function reorderAgentModelListHandler(c2) {
2707
+ try {
2708
+ const mastra = c2.get("mastra");
2709
+ const agentId = c2.req.param("agentId");
2710
+ const body = await c2.req.json();
2711
+ const result = await agents.reorderAgentModelListHandler({
2712
+ mastra,
2713
+ agentId,
2714
+ body
2715
+ });
2716
+ return c2.json(result);
2717
+ } catch (error) {
2718
+ return handleError(error, "Error reordering agent model list");
2719
+ }
2720
+ }
2686
2721
  async function generateSystemPromptHandler(c2) {
2687
2722
  try {
2688
2723
  const agentId = c2.req.param("agentId");
@@ -3503,6 +3538,116 @@ function agentsRouter(bodyLimitOptions) {
3503
3538
  }),
3504
3539
  updateAgentModelHandler
3505
3540
  );
3541
+ router.post(
3542
+ "/:agentId/models/reorder",
3543
+ bodyLimit.bodyLimit(bodyLimitOptions),
3544
+ w({
3545
+ description: "Reorder the models for an agent",
3546
+ tags: ["agents"],
3547
+ parameters: [
3548
+ {
3549
+ name: "agentId",
3550
+ in: "path",
3551
+ required: true,
3552
+ schema: { type: "string" }
3553
+ }
3554
+ ],
3555
+ requestBody: {
3556
+ required: true,
3557
+ content: {
3558
+ "application/json": {
3559
+ schema: {
3560
+ type: "object",
3561
+ properties: {
3562
+ reorderedModelIds: {
3563
+ type: "array",
3564
+ items: {
3565
+ type: "string"
3566
+ }
3567
+ }
3568
+ },
3569
+ required: ["reorderedModelIds"]
3570
+ }
3571
+ }
3572
+ }
3573
+ },
3574
+ responses: {
3575
+ 200: {
3576
+ description: "Model list reordered successfully"
3577
+ },
3578
+ 404: {
3579
+ description: "Agent not found"
3580
+ }
3581
+ }
3582
+ }),
3583
+ reorderAgentModelListHandler
3584
+ );
3585
+ router.post(
3586
+ "/:agentId/models/:modelConfigId",
3587
+ bodyLimit.bodyLimit(bodyLimitOptions),
3588
+ w({
3589
+ description: "Update the model for an agent in the model list",
3590
+ tags: ["agents"],
3591
+ parameters: [
3592
+ {
3593
+ name: "agentId",
3594
+ in: "path",
3595
+ required: true,
3596
+ schema: { type: "string" }
3597
+ },
3598
+ {
3599
+ name: "modelConfigId",
3600
+ in: "path",
3601
+ required: true,
3602
+ schema: { type: "string" }
3603
+ }
3604
+ ],
3605
+ requestBody: {
3606
+ required: true,
3607
+ content: {
3608
+ "application/json": {
3609
+ schema: {
3610
+ type: "object",
3611
+ properties: {
3612
+ model: {
3613
+ type: "object",
3614
+ properties: {
3615
+ modelId: {
3616
+ type: "string",
3617
+ description: "The modelId to update the agent to"
3618
+ },
3619
+ provider: {
3620
+ type: "string",
3621
+ enum: ["openai", "anthropic", "groq", "xai", "google"],
3622
+ description: "The provider of the model to update the agent to"
3623
+ }
3624
+ },
3625
+ required: ["modelId", "provider"]
3626
+ },
3627
+ maxRetries: {
3628
+ type: "number",
3629
+ description: "The maximum number of retries for the model"
3630
+ },
3631
+ enabled: {
3632
+ type: "boolean",
3633
+ description: "Whether the model is enabled"
3634
+ }
3635
+ }
3636
+ }
3637
+ }
3638
+ }
3639
+ },
3640
+ responses: {
3641
+ 200: {
3642
+ description: "Model updated successfully"
3643
+ },
3644
+ 404: {
3645
+ description: "Agent not found"
3646
+ }
3647
+ }
3648
+ }),
3649
+ updateAgentModelInModelListHandler
3650
+ );
3506
3651
  router.get(
3507
3652
  "/:agentId/speakers",
3508
3653
  async (c2, next) => {
@@ -8696,6 +8841,19 @@ async function getAITracesPaginatedHandler(c2) {
8696
8841
  return handleError(error, "Error getting AI traces paginated");
8697
8842
  }
8698
8843
  }
8844
+ async function processTraceScoringHandler(c2) {
8845
+ try {
8846
+ const mastra = c2.get("mastra");
8847
+ const { scorerName, targets } = await c2.req.json();
8848
+ const result = await observability.scoreTracesHandler({
8849
+ mastra,
8850
+ body: { scorerName, targets }
8851
+ });
8852
+ return c2.json(result);
8853
+ } catch (error) {
8854
+ return handleError(error, "Error processing trace scoring");
8855
+ }
8856
+ }
8699
8857
 
8700
8858
  // src/server/handlers/routes/observability/router.ts
8701
8859
  function observabilityRouter() {
@@ -8788,6 +8946,125 @@ function observabilityRouter() {
8788
8946
  }),
8789
8947
  getAITraceHandler
8790
8948
  );
8949
+ router.post(
8950
+ "/traces/score",
8951
+ w({
8952
+ description: "Score traces using a specified scorer",
8953
+ tags: ["observability"],
8954
+ requestBody: {
8955
+ content: {
8956
+ "application/json": {
8957
+ schema: {
8958
+ type: "object",
8959
+ required: ["scorerName", "targets"],
8960
+ properties: {
8961
+ scorerName: {
8962
+ type: "string",
8963
+ description: "Name of the scorer to use for evaluation",
8964
+ example: "relevance-scorer"
8965
+ },
8966
+ targets: {
8967
+ type: "array",
8968
+ description: "Array of trace targets to score",
8969
+ minItems: 1,
8970
+ items: {
8971
+ type: "object",
8972
+ required: ["traceId"],
8973
+ properties: {
8974
+ traceId: {
8975
+ type: "string",
8976
+ description: "ID of the trace to score",
8977
+ example: "trace-123"
8978
+ },
8979
+ spanId: {
8980
+ type: "string",
8981
+ description: "Optional specific span ID within the trace to score",
8982
+ example: "span-456"
8983
+ }
8984
+ }
8985
+ }
8986
+ }
8987
+ }
8988
+ }
8989
+ }
8990
+ }
8991
+ },
8992
+ responses: {
8993
+ 200: {
8994
+ description: "Scoring initiated successfully",
8995
+ content: {
8996
+ "application/json": {
8997
+ schema: {
8998
+ type: "object",
8999
+ properties: {
9000
+ status: {
9001
+ type: "string",
9002
+ enum: ["success"],
9003
+ example: "success"
9004
+ },
9005
+ message: {
9006
+ type: "string",
9007
+ example: "Scoring started for 3 traces"
9008
+ },
9009
+ traceCount: {
9010
+ type: "number",
9011
+ example: 3
9012
+ }
9013
+ },
9014
+ required: ["status", "message", "traceCount"]
9015
+ }
9016
+ }
9017
+ }
9018
+ },
9019
+ 400: {
9020
+ description: "Bad request - invalid parameters",
9021
+ content: {
9022
+ "application/json": {
9023
+ schema: {
9024
+ type: "object",
9025
+ properties: {
9026
+ error: {
9027
+ type: "string"
9028
+ }
9029
+ }
9030
+ }
9031
+ }
9032
+ }
9033
+ },
9034
+ 404: {
9035
+ description: "Scorer not found",
9036
+ content: {
9037
+ "application/json": {
9038
+ schema: {
9039
+ type: "object",
9040
+ properties: {
9041
+ error: {
9042
+ type: "string"
9043
+ }
9044
+ }
9045
+ }
9046
+ }
9047
+ }
9048
+ },
9049
+ 500: {
9050
+ description: "Internal server error",
9051
+ content: {
9052
+ "application/json": {
9053
+ schema: {
9054
+ type: "object",
9055
+ properties: {
9056
+ error: {
9057
+ type: "string"
9058
+ }
9059
+ }
9060
+ }
9061
+ }
9062
+ }
9063
+ }
9064
+ }
9065
+ }),
9066
+ processTraceScoringHandler
9067
+ );
8791
9068
  return router;
8792
9069
  }
8793
9070
  async function getScorersHandler(c2) {