create-mastra 0.18.0-alpha.0 → 1.0.0-beta.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,38 +1,18 @@
1
1
  # create-mastra
2
2
 
3
- ## 0.18.0-alpha.0
3
+ ## 1.0.0-beta.0
4
4
 
5
- ### Patch Changes
6
-
7
- - update peerdeps ([`5ca1cca`](https://github.com/mastra-ai/mastra/commit/5ca1ccac61ffa7141e6d9fa8f22d3ad4d03bf5dc))
8
-
9
- ## 0.17.7
10
-
11
- ## 0.17.7-alpha.0
12
-
13
- ## 0.17.6
14
-
15
- ### Patch Changes
5
+ ### Major Changes
16
6
 
17
- - Update MainSidebar component to fit required changes in Cloud CTA link ([#9364](https://github.com/mastra-ai/mastra/pull/9364))
7
+ - Bump minimum required Node.js version to 22.13.0 ([#9706](https://github.com/mastra-ai/mastra/pull/9706))
18
8
 
19
- ## 0.17.6-alpha.1
9
+ - Removed old tracing code based on OpenTelemetry ([#9237](https://github.com/mastra-ai/mastra/pull/9237))
20
10
 
21
- ## 0.17.6-alpha.0
11
+ - Mark as stable ([`83d5942`](https://github.com/mastra-ai/mastra/commit/83d5942669ce7bba4a6ca4fd4da697a10eb5ebdc))
22
12
 
23
13
  ### Patch Changes
24
14
 
25
- - Update MainSidebar component to fit required changes in Cloud CTA link ([#9364](https://github.com/mastra-ai/mastra/pull/9364))
26
-
27
- ## 0.17.5
28
-
29
- ### Patch Changes
30
-
31
- - Fix peerdependencies ([`eb7c1c8`](https://github.com/mastra-ai/mastra/commit/eb7c1c8c592d8fb16dfd250e337d9cdc73c8d5de))
32
-
33
- ## 0.17.4
34
-
35
- ## 0.17.4-alpha.0
15
+ - Update MainSidebar component to fit required changes in Cloud CTA link ([#9318](https://github.com/mastra-ai/mastra/pull/9318))
36
16
 
37
17
  ## 0.17.3
38
18
 
package/dist/index.js CHANGED
@@ -1095,11 +1095,11 @@ var MastraLogger = class {
1095
1095
  }
1096
1096
  trackException(_error) {
1097
1097
  }
1098
- async getLogs(transportId, params) {
1098
+ async listLogs(transportId, params) {
1099
1099
  if (!transportId || !this.transports.has(transportId)) {
1100
1100
  return { logs: [], total: 0, page: params?.page ?? 1, perPage: params?.perPage ?? 100, hasMore: false };
1101
1101
  }
1102
- return this.transports.get(transportId).getLogs(params) ?? {
1102
+ return this.transports.get(transportId).listLogs(params) ?? {
1103
1103
  logs: [],
1104
1104
  total: 0,
1105
1105
  page: params?.page ?? 1,
@@ -1107,7 +1107,7 @@ var MastraLogger = class {
1107
1107
  hasMore: false
1108
1108
  };
1109
1109
  }
1110
- async getLogsByRunId({
1110
+ async listLogsByRunId({
1111
1111
  transportId,
1112
1112
  runId,
1113
1113
  fromDate,
@@ -1120,7 +1120,7 @@ var MastraLogger = class {
1120
1120
  if (!transportId || !this.transports.has(transportId) || !runId) {
1121
1121
  return { logs: [], total: 0, page: page ?? 1, perPage: perPage ?? 100, hasMore: false };
1122
1122
  }
1123
- return this.transports.get(transportId).getLogsByRunId({ runId, fromDate, toDate, logLevel, filters, page, perPage }) ?? {
1123
+ return this.transports.get(transportId).listLogsByRunId({ runId, fromDate, toDate, logLevel, filters, page, perPage }) ?? {
1124
1124
  logs: [],
1125
1125
  total: 0,
1126
1126
  page: page ?? 1,
@@ -1532,6 +1532,7 @@ ${addExampleTool ? `import { weatherTool } from '../tools/weather-tool';` : ""}
1532
1532
  ${addScorers ? `import { scorers } from '../scorers/weather-scorer';` : ""}
1533
1533
 
1534
1534
  export const weatherAgent = new Agent({
1535
+ id: 'weather-agent',
1535
1536
  name: 'Weather Agent',
1536
1537
  instructions: \`${instructions}\`,
1537
1538
  model: ${modelString},
@@ -1561,6 +1562,7 @@ export const weatherAgent = new Agent({
1561
1562
  },` : ""}
1562
1563
  memory: new Memory({
1563
1564
  storage: new LibSQLStore({
1565
+ id: "memory-storage",
1564
1566
  url: "file:../mastra.db", // path is relative to the .mastra/output directory
1565
1567
  })
1566
1568
  })
@@ -1773,9 +1775,10 @@ async function writeToolSample(destPath) {
1773
1775
  async function writeScorersSample(llmProvider, destPath) {
1774
1776
  const modelString = getModelIdentifier(llmProvider);
1775
1777
  const content = `import { z } from 'zod';
1776
- import { createToolCallAccuracyScorerCode } from '@mastra/evals/scorers/code';
1777
- import { createCompletenessScorer } from '@mastra/evals/scorers/code';
1778
- import { createScorer } from '@mastra/core/scores';
1778
+ import { createToolCallAccuracyScorerCode } from '@mastra/evals/scorers/prebuilt';
1779
+ import { createCompletenessScorer } from '@mastra/evals/scorers/prebuilt';
1780
+ import { getAssistantMessageFromRunOutput, getUserMessageFromRunInput } from '@mastra/evals/scorers/utils';
1781
+ import { createScorer } from '@mastra/core/evals';
1779
1782
 
1780
1783
  export const toolCallAppropriatenessScorer = createToolCallAccuracyScorerCode({
1781
1784
  expectedTool: 'weatherTool',
@@ -1786,6 +1789,7 @@ export const completenessScorer = createCompletenessScorer();
1786
1789
 
1787
1790
  // Custom LLM-judged scorer: evaluates if non-English locations are translated appropriately
1788
1791
  export const translationScorer = createScorer({
1792
+ id: 'translation-quality-scorer',
1789
1793
  name: 'Translation Quality',
1790
1794
  description: 'Checks that non-English location names are translated and used correctly',
1791
1795
  type: 'agent',
@@ -1799,8 +1803,8 @@ export const translationScorer = createScorer({
1799
1803
  },
1800
1804
  })
1801
1805
  .preprocess(({ run }) => {
1802
- const userText = (run.input?.inputMessages?.[0]?.content as string) || '';
1803
- const assistantText = (run.output?.[0]?.content as string) || '';
1806
+ const userText = getUserMessageFromRunInput(run.input) || '';
1807
+ const assistantText = getAssistantMessageFromRunOutput(run.output) || '';
1804
1808
  return { userText, assistantText };
1805
1809
  })
1806
1810
  .analyze({
@@ -1899,7 +1903,7 @@ var writeIndexFile = async ({
1899
1903
  await fs4.writeFile(
1900
1904
  destPath,
1901
1905
  `
1902
- import { Mastra } from '@mastra/core';
1906
+ import { Mastra } from '@mastra/core/mastra';
1903
1907
 
1904
1908
  export const mastra = new Mastra()
1905
1909
  `
@@ -1912,6 +1916,7 @@ export const mastra = new Mastra()
1912
1916
  import { Mastra } from '@mastra/core/mastra';
1913
1917
  import { PinoLogger } from '@mastra/loggers';
1914
1918
  import { LibSQLStore } from '@mastra/libsql';
1919
+ import { Observability } from '@mastra/observability';
1915
1920
  ${addWorkflow ? `import { weatherWorkflow } from './workflows/weather-workflow';` : ""}
1916
1921
  ${addAgent ? `import { weatherAgent } from './agents/weather-agent';` : ""}
1917
1922
  ${addScorers ? `import { toolCallAppropriatenessScorer, completenessScorer, translationScorer } from './scorers/weather-scorer';` : ""}
@@ -1919,6 +1924,7 @@ ${addScorers ? `import { toolCallAppropriatenessScorer, completenessScorer, tran
1919
1924
  export const mastra = new Mastra({
1920
1925
  ${filteredExports.join("\n ")}
1921
1926
  storage: new LibSQLStore({
1927
+ id: "mastra-storage",
1922
1928
  // stores observability, scores, ... into memory storage, if it needs to persist, change to file:../mastra.db
1923
1929
  url: ":memory:",
1924
1930
  }),
@@ -1926,14 +1932,10 @@ export const mastra = new Mastra({
1926
1932
  name: 'Mastra',
1927
1933
  level: 'info',
1928
1934
  }),
1929
- telemetry: {
1930
- // Telemetry is deprecated and will be removed in the Nov 4th release
1931
- enabled: false,
1932
- },
1933
- observability: {
1934
- // Enables DefaultExporter and CloudExporter for AI tracing
1935
- default: { enabled: true },
1936
- },
1935
+ observability: new Observability({
1936
+ // Enables DefaultExporter and CloudExporter for tracing
1937
+ default: { enabled: true },
1938
+ }),
1937
1939
  });
1938
1940
  `
1939
1941
  );
@@ -2307,9 +2309,11 @@ var init = async ({
2307
2309
  llmProvider = "openai",
2308
2310
  llmApiKey,
2309
2311
  addExample = false,
2310
- configureEditorWithDocsMCP
2312
+ configureEditorWithDocsMCP,
2313
+ versionTag
2311
2314
  }) => {
2312
2315
  s.start("Initializing Mastra");
2316
+ const packageVersionTag = versionTag ? `@${versionTag}` : "";
2313
2317
  try {
2314
2318
  const result = await createMastraDir(directory);
2315
2319
  if (!result.ok) {
@@ -2337,19 +2341,23 @@ var init = async ({
2337
2341
  const depService = new DepsService();
2338
2342
  const needsLibsql = await depService.checkDependencies(["@mastra/libsql"]) !== `ok`;
2339
2343
  if (needsLibsql) {
2340
- await depService.installPackages(["@mastra/libsql"]);
2344
+ await depService.installPackages([`@mastra/libsql${packageVersionTag}`]);
2341
2345
  }
2342
2346
  const needsMemory = components.includes(`agents`) && await depService.checkDependencies(["@mastra/memory"]) !== `ok`;
2343
2347
  if (needsMemory) {
2344
- await depService.installPackages(["@mastra/memory"]);
2348
+ await depService.installPackages([`@mastra/memory${packageVersionTag}`]);
2345
2349
  }
2346
2350
  const needsLoggers = await depService.checkDependencies(["@mastra/loggers"]) !== `ok`;
2347
2351
  if (needsLoggers) {
2348
- await depService.installPackages(["@mastra/loggers"]);
2352
+ await depService.installPackages([`@mastra/loggers${packageVersionTag}`]);
2353
+ }
2354
+ const needsObservability = await depService.checkDependencies(["@mastra/observability"]) !== `ok`;
2355
+ if (needsObservability) {
2356
+ await depService.installPackages([`@mastra/observability${packageVersionTag}`]);
2349
2357
  }
2350
2358
  const needsEvals = components.includes(`scorers`) && await depService.checkDependencies(["@mastra/evals"]) !== `ok`;
2351
2359
  if (needsEvals) {
2352
- await depService.installPackages(["@mastra/evals"]);
2360
+ await depService.installPackages([`@mastra/evals${packageVersionTag}`]);
2353
2361
  }
2354
2362
  }
2355
2363
  const key = await getAPIKey(llmProvider || "openai");
@@ -2581,7 +2589,8 @@ var create = async (args2) => {
2581
2589
  ...result,
2582
2590
  llmApiKey: result?.llmApiKey,
2583
2591
  components: ["agents", "tools", "workflows", "scorers"],
2584
- addExample: true
2592
+ addExample: true,
2593
+ versionTag: args2.createVersionTag
2585
2594
  });
2586
2595
  postCreate({ projectName });
2587
2596
  return;
@@ -2593,7 +2602,8 @@ var create = async (args2) => {
2593
2602
  llmProvider,
2594
2603
  addExample,
2595
2604
  llmApiKey,
2596
- configureEditorWithDocsMCP: args2.mcpServer
2605
+ configureEditorWithDocsMCP: args2.mcpServer,
2606
+ versionTag: args2.createVersionTag
2597
2607
  });
2598
2608
  postCreate({ projectName });
2599
2609
  };