create-mastra 0.10.7 → 0.10.8-alpha.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/dist/index.js CHANGED
@@ -1125,9 +1125,7 @@ var PinoLogger = class extends MastraLogger {
1125
1125
  {
1126
1126
  name: options.name || "app",
1127
1127
  level: options.level || LogLevel.INFO,
1128
- formatters: {
1129
- level: (label) => ({ level: label })
1130
- }
1128
+ formatters: options.formatters
1131
1129
  },
1132
1130
  options.overrideDefaultTransports ? options?.transports?.default : transportsAry.length === 0 ? prettyStream : pino.multistream([
1133
1131
  ...transportsAry.map(([, transport]) => ({
@@ -1536,7 +1534,7 @@ var getProviderImportAndModelItem = (llmProvider) => {
1536
1534
  modelItem = `groq('llama-3.3-70b-versatile')`;
1537
1535
  } else if (llmProvider === "google") {
1538
1536
  providerImport = `import { google } from '${getAISDKPackage(llmProvider)}';`;
1539
- modelItem = `google('gemini-1.5-pro-latest')`;
1537
+ modelItem = `google('gemini-2.5-pro-exp-03-25')`;
1540
1538
  } else if (llmProvider === "cerebras") {
1541
1539
  providerImport = `import { cerebras } from '${getAISDKPackage(llmProvider)}';`;
1542
1540
  modelItem = `cerebras('llama-3.3-70b')`;
@@ -1546,14 +1544,16 @@ var getProviderImportAndModelItem = (llmProvider) => {
1546
1544
  async function writeAgentSample(llmProvider, destPath, addExampleTool) {
1547
1545
  const { providerImport, modelItem } = getProviderImportAndModelItem(llmProvider);
1548
1546
  const instructions = `
1549
- You are a helpful weather assistant that provides accurate weather information.
1547
+ You are a helpful weather assistant that provides accurate weather information and can help planning activities based on the weather.
1550
1548
 
1551
1549
  Your primary function is to help users get weather details for specific locations. When responding:
1552
1550
  - Always ask for a location if none is provided
1553
- - If the location name isn\u2019t in English, please translate it
1551
+ - If the location name isn't in English, please translate it
1554
1552
  - If giving a location with multiple parts (e.g. "New York, NY"), use the most relevant part (e.g. "New York")
1555
1553
  - Include relevant details like humidity, wind conditions, and precipitation
1556
1554
  - Keep responses concise but informative
1555
+ - If the user asks for activities and provides the weather forecast, suggest activities based on the weather forecast.
1556
+ - If the user asks for activities, respond in the format they request.
1557
1557
 
1558
1558
  ${addExampleTool ? "Use the weatherTool to fetch current weather data." : ""}
1559
1559
  `;
@@ -1583,63 +1583,10 @@ export const weatherAgent = new Agent({
1583
1583
  await fs4.writeFile(destPath, "");
1584
1584
  await fs4.writeFile(destPath, formattedContent);
1585
1585
  }
1586
- async function writeWorkflowSample(destPath, llmProvider) {
1587
- const { providerImport, modelItem } = getProviderImportAndModelItem(llmProvider);
1588
- const content = `${providerImport}
1589
- import { Agent } from '@mastra/core/agent';
1590
- import { createStep, createWorkflow } from '@mastra/core/workflows';
1586
+ async function writeWorkflowSample(destPath) {
1587
+ const content = `import { createStep, createWorkflow } from '@mastra/core/workflows';
1591
1588
  import { z } from 'zod';
1592
1589
 
1593
- const llm = ${modelItem};
1594
-
1595
- const agent = new Agent({
1596
- name: 'Weather Agent',
1597
- model: llm,
1598
- instructions: \`
1599
- You are a local activities and travel expert who excels at weather-based planning. Analyze the weather data and provide practical activity recommendations.
1600
-
1601
- For each day in the forecast, structure your response exactly as follows:
1602
-
1603
- \u{1F4C5} [Day, Month Date, Year]
1604
- \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550
1605
-
1606
- \u{1F321}\uFE0F WEATHER SUMMARY
1607
- \u2022 Conditions: [brief description]
1608
- \u2022 Temperature: [X\xB0C/Y\xB0F to A\xB0C/B\xB0F]
1609
- \u2022 Precipitation: [X% chance]
1610
-
1611
- \u{1F305} MORNING ACTIVITIES
1612
- Outdoor:
1613
- \u2022 [Activity Name] - [Brief description including specific location/route]
1614
- Best timing: [specific time range]
1615
- Note: [relevant weather consideration]
1616
-
1617
- \u{1F31E} AFTERNOON ACTIVITIES
1618
- Outdoor:
1619
- \u2022 [Activity Name] - [Brief description including specific location/route]
1620
- Best timing: [specific time range]
1621
- Note: [relevant weather consideration]
1622
-
1623
- \u{1F3E0} INDOOR ALTERNATIVES
1624
- \u2022 [Activity Name] - [Brief description including specific venue]
1625
- Ideal for: [weather condition that would trigger this alternative]
1626
-
1627
- \u26A0\uFE0F SPECIAL CONSIDERATIONS
1628
- \u2022 [Any relevant weather warnings, UV index, wind conditions, etc.]
1629
-
1630
- Guidelines:
1631
- - Suggest 2-3 time-specific outdoor activities per day
1632
- - Include 1-2 indoor backup options
1633
- - For precipitation >50%, lead with indoor activities
1634
- - All activities must be specific to the location
1635
- - Include specific venues, trails, or locations
1636
- - Consider activity intensity based on temperature
1637
- - Keep descriptions concise but informative
1638
-
1639
- Maintain this exact formatting for consistency, using the emoji and section headers as shown.
1640
- \`,
1641
- });
1642
-
1643
1590
  const forecastSchema = z.object({
1644
1591
  date: z.string(),
1645
1592
  maxTemp: z.number(),
@@ -1733,16 +1680,59 @@ const planActivities = createStep({
1733
1680
  outputSchema: z.object({
1734
1681
  activities: z.string(),
1735
1682
  }),
1736
- execute: async ({ inputData }) => {
1683
+ execute: async ({ inputData, mastra }) => {
1737
1684
  const forecast = inputData
1738
1685
 
1739
1686
  if (!forecast) {
1740
1687
  throw new Error('Forecast data not found')
1741
1688
  }
1742
1689
 
1690
+ const agent = mastra?.getAgent('weatherAgent');
1691
+ if (!agent) {
1692
+ throw new Error('Weather agent not found');
1693
+ }
1694
+
1743
1695
  const prompt = \`Based on the following weather forecast for \${forecast.location}, suggest appropriate activities:
1744
1696
  \${JSON.stringify(forecast, null, 2)}
1745
- \`;
1697
+ For each day in the forecast, structure your response exactly as follows:
1698
+
1699
+ \u{1F4C5} [Day, Month Date, Year]
1700
+ \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550
1701
+
1702
+ \u{1F321}\uFE0F WEATHER SUMMARY
1703
+ \u2022 Conditions: [brief description]
1704
+ \u2022 Temperature: [X\xB0C/Y\xB0F to A\xB0C/B\xB0F]
1705
+ \u2022 Precipitation: [X% chance]
1706
+
1707
+ \u{1F305} MORNING ACTIVITIES
1708
+ Outdoor:
1709
+ \u2022 [Activity Name] - [Brief description including specific location/route]
1710
+ Best timing: [specific time range]
1711
+ Note: [relevant weather consideration]
1712
+
1713
+ \u{1F31E} AFTERNOON ACTIVITIES
1714
+ Outdoor:
1715
+ \u2022 [Activity Name] - [Brief description including specific location/route]
1716
+ Best timing: [specific time range]
1717
+ Note: [relevant weather consideration]
1718
+
1719
+ \u{1F3E0} INDOOR ALTERNATIVES
1720
+ \u2022 [Activity Name] - [Brief description including specific venue]
1721
+ Ideal for: [weather condition that would trigger this alternative]
1722
+
1723
+ \u26A0\uFE0F SPECIAL CONSIDERATIONS
1724
+ \u2022 [Any relevant weather warnings, UV index, wind conditions, etc.]
1725
+
1726
+ Guidelines:
1727
+ - Suggest 2-3 time-specific outdoor activities per day
1728
+ - Include 1-2 indoor backup options
1729
+ - For precipitation >50%, lead with indoor activities
1730
+ - All activities must be specific to the location
1731
+ - Include specific venues, trails, or locations
1732
+ - Consider activity intensity based on temperature
1733
+ - Keep descriptions concise but informative
1734
+
1735
+ Maintain this exact formatting for consistency, using the emoji and section headers as shown.\`;
1746
1736
 
1747
1737
  const response = await agent.stream([
1748
1738
  {
@@ -1797,7 +1787,7 @@ async function writeCodeSampleForComponents(llmprovider, component, destPath, im
1797
1787
  case "tools":
1798
1788
  return writeToolSample(destPath);
1799
1789
  case "workflows":
1800
- return writeWorkflowSample(destPath, llmprovider);
1790
+ return writeWorkflowSample(destPath);
1801
1791
  default:
1802
1792
  return "";
1803
1793
  }