@mindstudio-ai/agent 0.1.0 → 0.1.3

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/cli.js CHANGED
@@ -138,6 +138,15 @@ var init_metadata = __esm({
138
138
  inputSchema: { "type": "object", "properties": { "name": { "type": "string", "description": "Name for the new data source (supports variable interpolation)" } }, "required": ["name"] },
139
139
  outputSchema: { "description": "This step does not produce output data." }
140
140
  },
141
+ "createGmailDraft": {
142
+ stepType: "createGmailDraft",
143
+ description: "Create a draft email in the connected Gmail account.",
144
+ usageNotes: `- Requires a Google OAuth connection with Gmail compose scope.
145
+ - The draft appears in the user's Gmail Drafts folder but is not sent.
146
+ - messageType controls the body format: "plain" for plain text, "html" for raw HTML, "markdown" for auto-converted markdown.`,
147
+ inputSchema: { "type": "object", "properties": { "to": { "type": "string", "description": "Recipient email address(es), comma-separated for multiple" }, "subject": { "type": "string", "description": "Email subject line" }, "message": { "type": "string", "description": "Email body content" }, "connectionId": { "type": "string", "description": "Google OAuth connection ID" }, "messageType": { "enum": ["plain", "html", "markdown"], "type": "string", "description": 'Body format: "plain", "html", or "markdown"' } }, "required": ["to", "subject", "message", "messageType"] },
148
+ outputSchema: { "type": "object", "properties": { "draftId": { "type": "string", "description": "Gmail draft ID" } }, "required": ["draftId"] }
149
+ },
141
150
  "createGoogleCalendarEvent": {
142
151
  stepType: "createGoogleCalendarEvent",
143
152
  description: "Create a new event on a Google Calendar.",
@@ -393,6 +402,13 @@ var init_metadata = __esm({
393
402
  inputSchema: { "type": "object", "properties": { "prompt": { "type": "string", "description": "Text prompt describing the video to generate" }, "skipAssetCreation": { "type": "boolean", "description": "If true, the video will not appear in the user's asset history" }, "videoModelOverride": { "type": "object", "properties": { "model": { "type": "string", "description": "Video generation model identifier" }, "config": { "type": "object", "description": "Additional model-specific configuration" } }, "required": ["model"], "description": "Optional model configuration override. Uses the workflow's default video model if not specified" }, "generateVariants": { "type": "boolean", "description": "Whether to generate multiple video variants in parallel" }, "numVariants": { "type": "number", "description": "Number of variants to generate (max 10)" }, "addWatermark": { "type": "boolean", "description": "Whether to add a MindStudio watermark to the generated video" } }, "required": ["prompt"] },
394
403
  outputSchema: { "type": "object", "properties": { "videoUrl": { "anyOf": [{ "type": "string" }, { "type": "array", "items": { "type": "string" } }] } }, "required": ["videoUrl"] }
395
404
  },
405
+ "getGmailAttachments": {
406
+ stepType: "getGmailAttachments",
407
+ description: "Download attachments from a Gmail email and re-host them on CDN.",
408
+ usageNotes: "- Requires a Google OAuth connection with Gmail readonly scope.\n- Attachments are uploaded to CDN and returned as URLs.\n- Attachments larger than 25MB are skipped.\n- Use the message ID from Search Gmail Emails, List Recent Gmail Emails, or Get Gmail Email steps.",
409
+ inputSchema: { "type": "object", "properties": { "messageId": { "type": "string", "description": "Gmail message ID" }, "connectionId": { "type": "string", "description": "Google OAuth connection ID" } }, "required": ["messageId"] },
410
+ outputSchema: { "description": "This step does not produce output data." }
411
+ },
396
412
  "getGmailDraft": {
397
413
  stepType: "getGmailDraft",
398
414
  description: "Retrieve a specific draft from Gmail by draft ID.",
@@ -407,6 +423,13 @@ var init_metadata = __esm({
407
423
  inputSchema: { "type": "object", "properties": { "messageId": { "type": "string", "description": "Gmail message ID to retrieve" }, "connectionId": { "type": "string", "description": "Google OAuth connection ID" } }, "required": ["messageId"] },
408
424
  outputSchema: { "type": "object", "properties": { "messageId": { "type": "string", "description": "Gmail message ID" }, "subject": { "type": "string", "description": "Email subject" }, "from": { "type": "string", "description": "Sender email" }, "to": { "type": "string", "description": "Recipient email" }, "date": { "type": "string", "description": "Email date" }, "body": { "type": "string", "description": "Email body content" }, "labels": { "type": "string", "description": "Comma-separated label IDs" } }, "required": ["messageId", "subject", "from", "to", "date", "body", "labels"] }
409
425
  },
426
+ "getGmailUnreadCount": {
427
+ stepType: "getGmailUnreadCount",
428
+ description: "Get the number of unread emails in the connected Gmail inbox.",
429
+ usageNotes: "- Requires a Google OAuth connection with Gmail readonly scope.\n- Returns the unread message count for the inbox label.\n- This is a lightweight call that does not fetch any email content.",
430
+ inputSchema: { "type": "object", "properties": { "connectionId": { "type": "string", "description": "Google OAuth connection ID" } } },
431
+ outputSchema: { "description": "This step does not produce output data." }
432
+ },
410
433
  "getGoogleCalendarEvent": {
411
434
  stepType: "getGoogleCalendarEvent",
412
435
  description: "Retrieve a specific event from a Google Calendar by event ID.",
@@ -540,6 +563,13 @@ var init_metadata = __esm({
540
563
  inputSchema: { "type": "object", "properties": { "connectionId": { "type": "string", "description": "Google OAuth connection ID" }, "limit": { "type": "string", "description": "Max drafts to return (default: 10, max: 50)" }, "exportType": { "enum": ["json", "text"], "type": "string", "description": 'Format for the variable output: "json" or "text"' } }, "required": ["exportType"] },
541
564
  outputSchema: { "type": "object", "properties": { "drafts": { "type": "array", "items": { "type": "object", "properties": { "draftId": { "type": "string", "description": "Gmail draft ID" }, "messageId": { "type": "string", "description": "Gmail message ID" }, "subject": { "type": "string", "description": "Email subject" }, "to": { "type": "string", "description": "Recipient email" }, "snippet": { "type": "string", "description": "Short preview text" } }, "required": ["draftId", "messageId", "subject", "to", "snippet"] }, "description": "List of draft summaries" } }, "required": ["drafts"] }
542
565
  },
566
+ "listGmailLabels": {
567
+ stepType: "listGmailLabels",
568
+ description: "List all labels in the connected Gmail account. Use these label IDs or names with the Update Gmail Labels step.",
569
+ usageNotes: '- Requires a Google OAuth connection with Gmail readonly scope.\n- Returns both system labels (INBOX, SENT, TRASH, etc.) and user-created labels.\n- Label type is "system" for built-in labels or "user" for custom labels.',
570
+ inputSchema: { "type": "object", "properties": { "connectionId": { "type": "string", "description": "Google OAuth connection ID" } } },
571
+ outputSchema: { "description": "This step does not produce output data." }
572
+ },
543
573
  "listGoogleCalendarEvents": {
544
574
  stepType: "listGoogleCalendarEvents",
545
575
  description: "List upcoming events from a Google Calendar, ordered by start time.",
@@ -554,6 +584,13 @@ var init_metadata = __esm({
554
584
  inputSchema: { "type": "object", "properties": { "folderId": { "type": "string", "description": "Google Drive folder ID (defaults to root)" }, "limit": { "type": "number", "description": "Max files to return (default: 20)" }, "connectionId": { "type": "string", "description": "Google OAuth connection ID" }, "exportType": { "enum": ["json", "text"], "type": "string", "description": 'Format for the variable output: "json" or "text"' } }, "required": ["exportType"] },
555
585
  outputSchema: { "type": "object", "properties": { "files": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "mimeType": { "type": "string" }, "size": { "type": "string" }, "webViewLink": { "type": "string" }, "createdTime": { "type": "string" }, "modifiedTime": { "type": "string" } }, "required": ["id", "name", "mimeType", "size", "webViewLink", "createdTime", "modifiedTime"] }, "description": "List of files in the folder" } }, "required": ["files"] }
556
586
  },
587
+ "listRecentGmailEmails": {
588
+ stepType: "listRecentGmailEmails",
589
+ description: "List recent emails from the connected Gmail inbox.",
590
+ usageNotes: '- Requires a Google OAuth connection with Gmail readonly scope.\n- Returns up to 100 emails (default 5), ordered by most recent first.\n- Functionally equivalent to Search Gmail Emails with an "in:inbox" query.',
591
+ inputSchema: { "type": "object", "properties": { "connectionId": { "type": "string", "description": "Google OAuth connection ID" }, "exportType": { "enum": ["json", "text"], "type": "string", "description": 'Format for the variable output: "json" or "text"' }, "limit": { "type": "string", "description": "Maximum number of emails to return (1-100, default: 5)" } }, "required": ["exportType", "limit"] },
592
+ outputSchema: { "description": "This step does not produce output data." }
593
+ },
557
594
  "logic": {
558
595
  stepType: "logic",
559
596
  description: "Route execution to different branches based on AI evaluation, comparison operators, or workflow jumps.",
@@ -805,6 +842,13 @@ var init_metadata = __esm({
805
842
  inputSchema: { "type": "object", "properties": { "url": { "type": "string", "description": "Full URL or username for the X profile (e.g. https://x.com/elonmusk)" } }, "required": ["url"] },
806
843
  outputSchema: { "type": "object", "properties": { "profile": { "type": "object", "properties": { "text": { "type": "string", "description": "Markdown/plain-text content of the scraped page" }, "html": { "type": "string", "description": "Raw HTML content of the scraped page" }, "json": { "type": "object", "description": "Structured data extracted from the page" }, "screenshotUrl": { "type": "string", "description": "Screenshot URL of the page (if requested)" }, "metadata": { "type": "object", "properties": { "title": { "type": "string", "description": "Page title" }, "description": { "type": "string", "description": "Page meta description" }, "url": { "type": "string", "description": "Canonical URL" }, "image": { "type": "string", "description": "Open Graph image URL" } }, "required": ["title", "description", "url", "image"], "description": "Page metadata (Open Graph / meta tags)" } }, "required": ["text", "html"], "description": "Scraped profile data including text, HTML, and optional structured JSON" } }, "required": ["profile"] }
807
844
  },
845
+ "searchGmailEmails": {
846
+ stepType: "searchGmailEmails",
847
+ description: "Search for emails in the connected Gmail account using a Gmail search query. To list recent inbox emails, pass an empty query string.",
848
+ usageNotes: '- Requires a Google OAuth connection with Gmail readonly scope.\n- Uses Gmail search syntax (e.g. "from:user@example.com", "subject:invoice", "is:unread").\n- To list recent inbox emails, use an empty query string or "in:inbox".\n- Returns up to 100 emails (default 5). The variable receives text or JSON depending on exportType.\n- The direct execution output always returns structured email objects.',
849
+ inputSchema: { "type": "object", "properties": { "query": { "type": "string", "description": 'Gmail search query (e.g. "from:user@example.com", "subject:invoice", "is:unread")' }, "connectionId": { "type": "string", "description": "Google OAuth connection ID" }, "exportType": { "enum": ["json", "text"], "type": "string", "description": 'Format for the variable output: "json" or "text"' }, "limit": { "type": "string", "description": "Maximum number of emails to return (1-10, default: 5)" } }, "required": ["query", "exportType", "limit"] },
850
+ outputSchema: { "type": "object", "properties": { "emails": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "description": "Gmail message ID" }, "subject": { "type": "string", "description": "Email subject line" }, "from": { "type": "string", "description": "Sender email address" }, "to": { "type": "string", "description": "Recipient email address" }, "date": { "type": "string", "description": "Email date" }, "plainBody": { "type": "string", "description": "Plain text body content" }, "htmlBody": { "type": "string", "description": "HTML body content (if available)" }, "labels": { "type": "string", "description": "Comma-separated label IDs applied to the email" } }, "required": ["id", "subject", "from", "to", "date", "plainBody", "htmlBody", "labels"] }, "description": "List of matching email messages" } }, "required": ["emails"] }
851
+ },
808
852
  "searchGoogle": {
809
853
  stepType: "searchGoogle",
810
854
  description: "Search the web using Google and return structured results.",
@@ -882,6 +926,20 @@ var init_metadata = __esm({
882
926
  inputSchema: { "type": "object", "properties": { "subject": { "type": "string", "description": "Email subject line" }, "body": { "type": "string", "description": "Email body content (plain text, markdown, HTML, or a CDN URL to an HTML file)" }, "connectionId": { "type": "string", "description": "OAuth connection ID(s) for the recipient(s), comma-separated for multiple" }, "generateHtml": { "type": "boolean", "description": "When true, auto-convert the body text into a styled HTML email using AI" }, "generateHtmlInstructions": { "type": "string", "description": "Natural language instructions for the HTML generation style" }, "generateHtmlModelOverride": { "type": "object", "properties": { "model": { "type": "string", "description": 'Model identifier (e.g. "gpt-4", "claude-3-opus")' }, "temperature": { "type": "number", "description": "Sampling temperature for the model (0-2)" }, "maxResponseTokens": { "type": "number", "description": "Maximum number of tokens in the model's response" }, "ignorePreamble": { "type": "boolean", "description": "Whether to skip the system preamble/instructions" }, "userMessagePreprocessor": { "type": "object", "properties": { "dataSource": { "type": "string", "description": "Data source identifier for the preprocessor" }, "messageTemplate": { "type": "string", "description": "Template string applied to user messages before sending to the model" }, "maxResults": { "type": "number", "description": "Maximum number of results to include from the data source" }, "enabled": { "type": "boolean", "description": "Whether the preprocessor is active" }, "shouldInherit": { "type": "boolean", "description": "Whether child steps should inherit this preprocessor configuration" } }, "description": "Preprocessor applied to user messages before sending to the model" }, "preamble": { "type": "string", "description": "System preamble/instructions for the model" }, "multiModelEnabled": { "type": "boolean", "description": "Whether multi-model candidate generation is enabled" }, "editResponseEnabled": { "type": "boolean", "description": "Whether the user can edit the model's response" }, "config": { "type": "object", "description": "Additional model-specific configuration" } }, "required": ["model", "temperature", "maxResponseTokens"], "description": "Model settings override for HTML generation" }, "attachments": { "type": "array", "items": { "type": "string" }, "description": "URLs of files to attach to the email" } }, "required": ["subject", "body"] },
883
927
  outputSchema: { "type": "object", "properties": { "recipients": { "type": "array", "items": { "type": "string" }, "description": "Email addresses the message was sent to" } }, "required": ["recipients"] }
884
928
  },
929
+ "sendGmailDraft": {
930
+ stepType: "sendGmailDraft",
931
+ description: "Send an existing draft from the connected Gmail account.",
932
+ usageNotes: "- Requires a Google OAuth connection with Gmail compose scope.\n- The draft is sent and removed from the Drafts folder.\n- Use the draft ID returned by the Create Gmail Draft or List Gmail Drafts steps.",
933
+ inputSchema: { "type": "object", "properties": { "draftId": { "type": "string", "description": "Gmail draft ID to send" }, "connectionId": { "type": "string", "description": "Google OAuth connection ID" } }, "required": ["draftId"] },
934
+ outputSchema: { "description": "This step does not produce output data." }
935
+ },
936
+ "sendGmailMessage": {
937
+ stepType: "sendGmailMessage",
938
+ description: "Send an email from the connected Gmail account.",
939
+ usageNotes: '- Requires a Google OAuth connection with Gmail compose scope.\n- messageType controls the body format: "plain" for plain text, "html" for raw HTML, "markdown" for auto-converted markdown.',
940
+ inputSchema: { "type": "object", "properties": { "to": { "type": "string", "description": "Recipient email address(es), comma-separated for multiple" }, "subject": { "type": "string", "description": "Email subject line" }, "message": { "type": "string", "description": "Email body content" }, "connectionId": { "type": "string", "description": "Google OAuth connection ID" }, "messageType": { "enum": ["plain", "html", "markdown"], "type": "string", "description": 'Body format: "plain", "html", or "markdown"' } }, "required": ["to", "subject", "message", "messageType"] },
941
+ outputSchema: { "type": "object", "properties": { "messageId": { "type": "string", "description": "Gmail message ID of the sent email" } }, "required": ["messageId"] }
942
+ },
885
943
  "sendSMS": {
886
944
  stepType: "sendSMS",
887
945
  description: "Send an SMS or MMS message to a phone number configured via OAuth connection.",
@@ -889,6 +947,13 @@ var init_metadata = __esm({
889
947
  inputSchema: { "type": "object", "properties": { "body": { "type": "string", "description": "SMS message body text" }, "connectionId": { "type": "string", "description": "OAuth connection ID for the recipient phone number" }, "mediaUrls": { "type": "array", "items": { "type": "string" }, "description": "Optional array of media URLs to send as MMS (up to 10, 5MB each)" } }, "required": ["body"] },
890
948
  outputSchema: { "description": "This step does not produce output data." }
891
949
  },
950
+ "setGmailReadStatus": {
951
+ stepType: "setGmailReadStatus",
952
+ description: "Mark one or more Gmail emails as read or unread.",
953
+ usageNotes: "- Requires a Google OAuth connection with Gmail modify scope.\n- Accepts one or more message IDs as a comma-separated string or array.\n- Set markAsRead to true to mark as read, false to mark as unread.",
954
+ inputSchema: { "type": "object", "properties": { "messageIds": { "type": "string", "description": "Gmail message ID(s), comma-separated" }, "markAsRead": { "type": "boolean", "description": "true = mark as read, false = mark as unread" }, "connectionId": { "type": "string", "description": "Google OAuth connection ID" } }, "required": ["messageIds", "markAsRead"] },
955
+ outputSchema: { "description": "This step does not produce output data." }
956
+ },
892
957
  "setRunTitle": {
893
958
  stepType: "setRunTitle",
894
959
  description: "Set the title of the agent run for the user's history",
@@ -980,6 +1045,13 @@ var init_metadata = __esm({
980
1045
  inputSchema: { "type": "object", "properties": { "inputUrl": { "type": "string", "description": "URL of the source audio or video file to trim" }, "start": { "type": ["number", "string"] }, "duration": { "type": ["string", "number"] }, "skipAssetCreation": { "type": "boolean", "description": "When true, the result will not appear in the user's asset history. Useful for intermediate compositing steps." } }, "required": ["inputUrl"] },
981
1046
  outputSchema: { "type": "object", "properties": { "mediaUrl": { "type": "string", "description": "URL of the trimmed media file" } }, "required": ["mediaUrl"] }
982
1047
  },
1048
+ "updateGmailLabels": {
1049
+ stepType: "updateGmailLabels",
1050
+ description: "Add or remove labels on Gmail messages, identified by message IDs or a search query.",
1051
+ usageNotes: "- Requires a Google OAuth connection with Gmail modify scope.\n- Provide either a query (Gmail search syntax) or explicit messageIds to target messages.\n- Label IDs can be label names or Gmail label IDs \u2014 names are resolved automatically.",
1052
+ inputSchema: { "type": "object", "properties": { "query": { "type": "string", "description": "Gmail search query to find messages (alternative to messageIds)" }, "connectionId": { "type": "string", "description": "Google OAuth connection ID" }, "messageIds": { "type": "string", "description": "Comma-separated message IDs to target (alternative to query)" }, "addLabelIds": { "type": "string", "description": "Comma-separated label names or IDs to add" }, "removeLabelIds": { "type": "string", "description": "Comma-separated label names or IDs to remove" } }, "required": ["query", "messageIds", "addLabelIds", "removeLabelIds"] },
1053
+ outputSchema: { "type": "object", "properties": { "updatedMessageIds": { "type": "array", "items": { "type": "string" }, "description": "Gmail message IDs that were updated" } }, "required": ["updatedMessageIds"] }
1054
+ },
983
1055
  "updateGoogleCalendarEvent": {
984
1056
  stepType: "updateGoogleCalendarEvent",
985
1057
  description: "Update an existing event on a Google Calendar. Only specified fields are changed.",
@@ -1310,6 +1382,9 @@ function applyStepMethods(AgentClass) {
1310
1382
  proto.createDataSource = function(step, options) {
1311
1383
  return this.executeStep("createDataSource", step, options);
1312
1384
  };
1385
+ proto.createGmailDraft = function(step, options) {
1386
+ return this.executeStep("createGmailDraft", step, options);
1387
+ };
1313
1388
  proto.createGoogleCalendarEvent = function(step, options) {
1314
1389
  return this.executeStep("createGoogleCalendarEvent", step, options);
1315
1390
  };
@@ -1412,12 +1487,18 @@ function applyStepMethods(AgentClass) {
1412
1487
  proto.generateVideo = function(step, options) {
1413
1488
  return this.executeStep("generateVideo", step, options);
1414
1489
  };
1490
+ proto.getGmailAttachments = function(step, options) {
1491
+ return this.executeStep("getGmailAttachments", step, options);
1492
+ };
1415
1493
  proto.getGmailDraft = function(step, options) {
1416
1494
  return this.executeStep("getGmailDraft", step, options);
1417
1495
  };
1418
1496
  proto.getGmailEmail = function(step, options) {
1419
1497
  return this.executeStep("getGmailEmail", step, options);
1420
1498
  };
1499
+ proto.getGmailUnreadCount = function(step, options) {
1500
+ return this.executeStep("getGmailUnreadCount", step, options);
1501
+ };
1421
1502
  proto.getGoogleCalendarEvent = function(step, options) {
1422
1503
  return this.executeStep("getGoogleCalendarEvent", step, options);
1423
1504
  };
@@ -1475,12 +1556,18 @@ function applyStepMethods(AgentClass) {
1475
1556
  proto.listGmailDrafts = function(step, options) {
1476
1557
  return this.executeStep("listGmailDrafts", step, options);
1477
1558
  };
1559
+ proto.listGmailLabels = function(step, options) {
1560
+ return this.executeStep("listGmailLabels", step, options);
1561
+ };
1478
1562
  proto.listGoogleCalendarEvents = function(step, options) {
1479
1563
  return this.executeStep("listGoogleCalendarEvents", step, options);
1480
1564
  };
1481
1565
  proto.listGoogleDriveFiles = function(step, options) {
1482
1566
  return this.executeStep("listGoogleDriveFiles", step, options);
1483
1567
  };
1568
+ proto.listRecentGmailEmails = function(step, options) {
1569
+ return this.executeStep("listRecentGmailEmails", step, options);
1570
+ };
1484
1571
  proto.logic = function(step, options) {
1485
1572
  return this.executeStep("logic", step, options);
1486
1573
  };
@@ -1586,6 +1673,9 @@ function applyStepMethods(AgentClass) {
1586
1673
  proto.scrapeXProfile = function(step, options) {
1587
1674
  return this.executeStep("scrapeXProfile", step, options);
1588
1675
  };
1676
+ proto.searchGmailEmails = function(step, options) {
1677
+ return this.executeStep("searchGmailEmails", step, options);
1678
+ };
1589
1679
  proto.searchGoogle = function(step, options) {
1590
1680
  return this.executeStep("searchGoogle", step, options);
1591
1681
  };
@@ -1619,9 +1709,18 @@ function applyStepMethods(AgentClass) {
1619
1709
  proto.sendEmail = function(step, options) {
1620
1710
  return this.executeStep("sendEmail", step, options);
1621
1711
  };
1712
+ proto.sendGmailDraft = function(step, options) {
1713
+ return this.executeStep("sendGmailDraft", step, options);
1714
+ };
1715
+ proto.sendGmailMessage = function(step, options) {
1716
+ return this.executeStep("sendGmailMessage", step, options);
1717
+ };
1622
1718
  proto.sendSMS = function(step, options) {
1623
1719
  return this.executeStep("sendSMS", step, options);
1624
1720
  };
1721
+ proto.setGmailReadStatus = function(step, options) {
1722
+ return this.executeStep("setGmailReadStatus", step, options);
1723
+ };
1625
1724
  proto.setRunTitle = function(step, options) {
1626
1725
  return this.executeStep("setRunTitle", step, options);
1627
1726
  };
@@ -1661,6 +1760,9 @@ function applyStepMethods(AgentClass) {
1661
1760
  proto.trimMedia = function(step, options) {
1662
1761
  return this.executeStep("trimMedia", step, options);
1663
1762
  };
1763
+ proto.updateGmailLabels = function(step, options) {
1764
+ return this.executeStep("updateGmailLabels", step, options);
1765
+ };
1664
1766
  proto.updateGoogleCalendarEvent = function(step, options) {
1665
1767
  return this.executeStep("updateGoogleCalendarEvent", step, options);
1666
1768
  };
@@ -1735,6 +1837,29 @@ function applyHelperMethods(AgentClass) {
1735
1837
  proto.listConnections = function() {
1736
1838
  return this._request("GET", "/helpers/connections").then((r) => r.data);
1737
1839
  };
1840
+ proto.estimateStepCost = function(stepType, step, options) {
1841
+ return this._request("POST", "/helpers/step-cost-estimate", { step: { type: stepType, ...step }, ...options }).then((r) => r.data);
1842
+ };
1843
+ proto.changeName = function(displayName) {
1844
+ return this._request("POST", "/account/change-name", { displayName }).then(() => {
1845
+ });
1846
+ };
1847
+ proto.changeProfilePicture = function(profilePictureUrl) {
1848
+ return this._request("POST", "/account/change-profile-picture", { profilePictureUrl }).then(() => {
1849
+ });
1850
+ };
1851
+ proto.uploadFile = async function(content, options) {
1852
+ const { data } = await this._request("POST", "/account/upload", { extension: options.extension, ...options.type != null && { type: options.type } });
1853
+ const { uploadUrl, url } = data;
1854
+ const buf = content.buffer.slice(content.byteOffset, content.byteOffset + content.byteLength);
1855
+ const res = await fetch(uploadUrl, {
1856
+ method: "PUT",
1857
+ body: buf,
1858
+ headers: options.type ? { "Content-Type": options.type } : {}
1859
+ });
1860
+ if (!res.ok) throw new Error(`Upload failed: ${res.status} ${res.statusText}`);
1861
+ return { url };
1862
+ };
1738
1863
  }
1739
1864
  var init_helpers = __esm({
1740
1865
  "src/generated/helpers.ts"() {
@@ -1936,6 +2061,8 @@ __export(mcp_exports, {
1936
2061
  startMcpServer: () => startMcpServer
1937
2062
  });
1938
2063
  import { createInterface } from "readline";
2064
+ import { readFileSync as readFileSync2 } from "fs";
2065
+ import { extname } from "path";
1939
2066
  function send(message) {
1940
2067
  process.stdout.write(JSON.stringify(message) + "\n");
1941
2068
  }
@@ -1988,8 +2115,9 @@ async function startMcpServer(options) {
1988
2115
  capabilities: { tools: {} },
1989
2116
  serverInfo: {
1990
2117
  name: "mindstudio-agent",
1991
- version: "0.1.0"
1992
- }
2118
+ version: "0.1.3"
2119
+ },
2120
+ instructions: "Welcome to MindStudio \u2014 a platform with 200+ AI models, 850+ third-party integrations, and pre-built agents.\n\nGetting started:\n1. Call `listAgents` to verify your connection and see available agents.\n2. Call `changeName` to set your display name \u2014 use your name or whatever your user calls you. This is how you'll appear in MindStudio request logs.\n3. If you have a profile picture or icon, call `uploadFile` to upload it, then `changeProfilePicture` with the returned URL. This helps users identify your requests in their logs.\n4. Call `listSteps` to discover all available step methods and helpers.\n\nThen use the tools to generate text, images, video, audio, search the web, work with data sources, run agents, and more."
1993
2121
  });
1994
2122
  break;
1995
2123
  case "notifications/initialized":
@@ -2002,7 +2130,19 @@ async function startMcpServer(options) {
2002
2130
  const args = params.arguments ?? {};
2003
2131
  try {
2004
2132
  let result;
2005
- if (toolName === "listModels") {
2133
+ if (toolName === "listSteps") {
2134
+ const meta = await getMetadata();
2135
+ const summary = {};
2136
+ for (const [name, step] of Object.entries(meta)) {
2137
+ summary[name] = step.description;
2138
+ }
2139
+ for (const [name, desc] of Object.entries(
2140
+ HELPER_DESCRIPTIONS
2141
+ )) {
2142
+ summary[name] = desc;
2143
+ }
2144
+ result = summary;
2145
+ } else if (toolName === "listModels") {
2006
2146
  result = await getAgent().listModels();
2007
2147
  } else if (toolName === "listModelsByType") {
2008
2148
  result = await getAgent().listModelsByType(
@@ -2027,6 +2167,35 @@ async function startMcpServer(options) {
2027
2167
  );
2028
2168
  } else if (toolName === "listConnections") {
2029
2169
  result = await getAgent().listConnections();
2170
+ } else if (toolName === "estimateStepCost") {
2171
+ result = await getAgent().estimateStepCost(
2172
+ args.stepType,
2173
+ args.step,
2174
+ {
2175
+ appId: args.appId,
2176
+ workflowId: args.workflowId
2177
+ }
2178
+ );
2179
+ } else if (toolName === "changeName") {
2180
+ await getAgent().changeName(
2181
+ args.displayName
2182
+ );
2183
+ result = { success: true };
2184
+ } else if (toolName === "changeProfilePicture") {
2185
+ await getAgent().changeProfilePicture(
2186
+ args.profilePictureUrl
2187
+ );
2188
+ result = { success: true };
2189
+ } else if (toolName === "uploadFile") {
2190
+ const filePath = args.filePath;
2191
+ const ext = extname(filePath).slice(1).toLowerCase();
2192
+ if (!ext) throw new Error("Cannot determine file extension from path.");
2193
+ const content = readFileSync2(filePath);
2194
+ const mimeType = MIME_TYPES[ext];
2195
+ result = await getAgent().uploadFile(content, {
2196
+ extension: ext,
2197
+ ...mimeType && { type: mimeType }
2198
+ });
2030
2199
  } else if (toolName === "listAgents") {
2031
2200
  result = await getAgent().listAgents();
2032
2201
  } else if (toolName === "runAgent") {
@@ -2081,13 +2250,50 @@ async function startMcpServer(options) {
2081
2250
  }
2082
2251
  }
2083
2252
  }
2084
- var MCP_PROTOCOL_VERSION, HELPER_TOOLS;
2253
+ var MCP_PROTOCOL_VERSION, MIME_TYPES, HELPER_DESCRIPTIONS, HELPER_TOOLS;
2085
2254
  var init_mcp = __esm({
2086
2255
  "src/mcp.ts"() {
2087
2256
  "use strict";
2088
2257
  init_client();
2089
2258
  MCP_PROTOCOL_VERSION = "2024-11-05";
2259
+ MIME_TYPES = {
2260
+ png: "image/png",
2261
+ jpg: "image/jpeg",
2262
+ jpeg: "image/jpeg",
2263
+ gif: "image/gif",
2264
+ webp: "image/webp",
2265
+ svg: "image/svg+xml",
2266
+ mp4: "video/mp4",
2267
+ webm: "video/webm",
2268
+ mp3: "audio/mpeg",
2269
+ wav: "audio/wav",
2270
+ pdf: "application/pdf",
2271
+ json: "application/json",
2272
+ txt: "text/plain",
2273
+ csv: "text/csv"
2274
+ };
2275
+ HELPER_DESCRIPTIONS = {
2276
+ listModels: "List all available AI models.",
2277
+ listModelsByType: "List AI models filtered by type.",
2278
+ listModelsSummary: "List all AI models (summary: id, name, type, tags).",
2279
+ listModelsSummaryByType: "List AI models (summary) filtered by type.",
2280
+ listConnectors: "List available connector services and their actions.",
2281
+ getConnector: "Get details for a connector service.",
2282
+ getConnectorAction: "Get full configuration for a connector action.",
2283
+ listConnections: "List OAuth connections for the organization.",
2284
+ estimateStepCost: "Estimate the cost of executing a step before running it.",
2285
+ changeName: "Update the display name of the authenticated agent.",
2286
+ changeProfilePicture: "Update the profile picture of the authenticated agent.",
2287
+ uploadFile: "Upload a file to the MindStudio CDN.",
2288
+ listAgents: "List all pre-built agents in the organization.",
2289
+ runAgent: "Run a pre-built agent and wait for the result."
2290
+ };
2090
2291
  HELPER_TOOLS = [
2292
+ {
2293
+ name: "listSteps",
2294
+ description: "List all available methods with their descriptions. Returns a compact { method: description } map. Call this to discover what steps and helpers are available, then call a specific method by name. Tip: if you haven't already, call `changeName` to set your display name first.",
2295
+ inputSchema: { type: "object", properties: {} }
2296
+ },
2091
2297
  {
2092
2298
  name: "listModels",
2093
2299
  description: "List all available AI models across all categories.",
@@ -2179,6 +2385,75 @@ var init_mcp = __esm({
2179
2385
  description: "List OAuth connections for the organization. Use the returned connection IDs when calling connector actions.",
2180
2386
  inputSchema: { type: "object", properties: {} }
2181
2387
  },
2388
+ {
2389
+ name: "estimateStepCost",
2390
+ description: "Estimate the cost of executing a step before running it. Pass the same step config you would use for execution.",
2391
+ inputSchema: {
2392
+ type: "object",
2393
+ properties: {
2394
+ stepType: {
2395
+ type: "string",
2396
+ description: 'The step type name (e.g. "generateText").'
2397
+ },
2398
+ step: {
2399
+ type: "object",
2400
+ description: "The step input parameters.",
2401
+ additionalProperties: true
2402
+ },
2403
+ appId: {
2404
+ type: "string",
2405
+ description: "Optional app ID for context-specific pricing."
2406
+ },
2407
+ workflowId: {
2408
+ type: "string",
2409
+ description: "Optional workflow ID for context-specific pricing."
2410
+ }
2411
+ },
2412
+ required: ["stepType"]
2413
+ }
2414
+ },
2415
+ {
2416
+ name: "changeName",
2417
+ description: "Update the display name of the authenticated agent. Useful for agents to set their own name after connecting.",
2418
+ inputSchema: {
2419
+ type: "object",
2420
+ properties: {
2421
+ displayName: {
2422
+ type: "string",
2423
+ description: "The new display name."
2424
+ }
2425
+ },
2426
+ required: ["displayName"]
2427
+ }
2428
+ },
2429
+ {
2430
+ name: "changeProfilePicture",
2431
+ description: "Update the profile picture of the authenticated agent. Useful for agents to set their own avatar after connecting.",
2432
+ inputSchema: {
2433
+ type: "object",
2434
+ properties: {
2435
+ profilePictureUrl: {
2436
+ type: "string",
2437
+ description: "URL of the new profile picture."
2438
+ }
2439
+ },
2440
+ required: ["profilePictureUrl"]
2441
+ }
2442
+ },
2443
+ {
2444
+ name: "uploadFile",
2445
+ description: "Upload a local file to the MindStudio CDN. Returns the permanent public URL.",
2446
+ inputSchema: {
2447
+ type: "object",
2448
+ properties: {
2449
+ filePath: {
2450
+ type: "string",
2451
+ description: "Absolute or relative path to the file to upload."
2452
+ }
2453
+ },
2454
+ required: ["filePath"]
2455
+ }
2456
+ },
2182
2457
  {
2183
2458
  name: "listAgents",
2184
2459
  description: "List all pre-built agents in the organization along with org metadata.",
@@ -2218,15 +2493,18 @@ var init_mcp = __esm({
2218
2493
  // src/cli.ts
2219
2494
  import { parseArgs } from "util";
2220
2495
  import { execSync } from "child_process";
2496
+ import { readFileSync as readFileSync3 } from "fs";
2497
+ import { extname as extname2 } from "path";
2221
2498
  var HELP = `Usage: mindstudio <command | method> [options]
2222
2499
 
2223
2500
  Commands:
2224
2501
  login Authenticate with MindStudio (opens browser)
2225
2502
  logout Clear stored credentials
2226
2503
  whoami Show current authentication status
2504
+ upload <filepath> Upload a file to the MindStudio CDN
2227
2505
  <method> [json | --flags] Execute a step method (shorthand for exec)
2228
2506
  exec <method> [json | --flags] Execute a step method
2229
- list [--json] List available methods
2507
+ list [--json] [--summary] List available methods (--summary for compact JSON)
2230
2508
  info <method> Show method details (params, types, output)
2231
2509
  agents [--json] List pre-built agents in your organization
2232
2510
  run <appId> [json | --flags] Run a pre-built agent and wait for result
@@ -2323,7 +2601,10 @@ var HELPER_NAMES = /* @__PURE__ */ new Set([
2323
2601
  "listConnectors",
2324
2602
  "getConnector",
2325
2603
  "getConnectorAction",
2326
- "listConnections"
2604
+ "listConnections",
2605
+ "estimateStepCost",
2606
+ "changeName",
2607
+ "changeProfilePicture"
2327
2608
  ]);
2328
2609
  function resolveMethodOrFail(name, metadataKeys) {
2329
2610
  if (metadataKeys.has(name)) return name;
@@ -2348,9 +2629,36 @@ async function getAllMethodKeys() {
2348
2629
  const { stepMetadata: stepMetadata2 } = await Promise.resolve().then(() => (init_metadata(), metadata_exports));
2349
2630
  return /* @__PURE__ */ new Set([...Object.keys(stepMetadata2), ...HELPER_NAMES]);
2350
2631
  }
2351
- async function cmdList(asJson) {
2632
+ var HELPER_DESCRIPTIONS2 = {
2633
+ listModels: "List all available AI models.",
2634
+ listModelsByType: "List AI models filtered by type.",
2635
+ listModelsSummary: "List all AI models (summary: id, name, type, tags).",
2636
+ listModelsSummaryByType: "List AI models (summary) filtered by type.",
2637
+ listConnectors: "List available connector services and their actions.",
2638
+ getConnector: "Get details for a connector service.",
2639
+ getConnectorAction: "Get full configuration for a connector action.",
2640
+ listConnections: "List OAuth connections for the organization.",
2641
+ estimateStepCost: "Estimate the cost of executing a step before running it.",
2642
+ changeName: "Update the display name of the authenticated agent.",
2643
+ changeProfilePicture: "Update the profile picture of the authenticated agent.",
2644
+ listAgents: "List all pre-built agents in the organization.",
2645
+ runAgent: "Run a pre-built agent and wait for the result."
2646
+ };
2647
+ function buildSummary(stepMetadata2) {
2648
+ const summary = {};
2649
+ for (const [name, meta] of Object.entries(stepMetadata2)) {
2650
+ summary[name] = meta.description;
2651
+ }
2652
+ for (const [name, desc] of Object.entries(HELPER_DESCRIPTIONS2)) {
2653
+ summary[name] = desc;
2654
+ }
2655
+ return summary;
2656
+ }
2657
+ async function cmdList(asJson, asSummary) {
2352
2658
  const { stepMetadata: stepMetadata2 } = await Promise.resolve().then(() => (init_metadata(), metadata_exports));
2353
- if (asJson) {
2659
+ if (asSummary) {
2660
+ process.stdout.write(JSON.stringify(buildSummary(stepMetadata2)) + "\n");
2661
+ } else if (asJson) {
2354
2662
  const entries = Object.entries(stepMetadata2).map(([name, meta]) => ({
2355
2663
  method: camelToKebab(name),
2356
2664
  description: meta.description,
@@ -2380,14 +2688,61 @@ async function cmdInfo(rawMethod) {
2380
2688
  const method = resolveMethodOrFail(rawMethod, allKeys);
2381
2689
  if (HELPER_NAMES.has(method)) {
2382
2690
  const helpers = {
2383
- listModels: { desc: "List all available AI models.", input: "(none)", output: "{ models: MindStudioModel[] }" },
2384
- listModelsByType: { desc: "List AI models filtered by type.", input: "modelType: string (required)", output: "{ models: MindStudioModel[] }" },
2385
- listModelsSummary: { desc: "List all AI models (summary: id, name, type, tags).", input: "(none)", output: "{ models: MindStudioModelSummary[] }" },
2386
- listModelsSummaryByType: { desc: "List AI models (summary) filtered by type.", input: "modelType: string (required)", output: "{ models: MindStudioModelSummary[] }" },
2387
- listConnectors: { desc: "List available connector services and their actions.", input: "(none)", output: "{ services: ConnectorService[] }" },
2388
- getConnector: { desc: "Get details for a connector service.", input: "serviceId: string (required)", output: "{ service: ConnectorService }" },
2389
- getConnectorAction: { desc: "Get full configuration for a connector action.", input: "serviceId: string, actionId: string (both required)", output: "{ action: ConnectorActionDetail }" },
2390
- listConnections: { desc: "List OAuth connections for the organization.", input: "(none)", output: "{ connections: Connection[] }" }
2691
+ listModels: {
2692
+ desc: "List all available AI models.",
2693
+ input: "(none)",
2694
+ output: "{ models: MindStudioModel[] }"
2695
+ },
2696
+ listModelsByType: {
2697
+ desc: "List AI models filtered by type.",
2698
+ input: "modelType: string (required)",
2699
+ output: "{ models: MindStudioModel[] }"
2700
+ },
2701
+ listModelsSummary: {
2702
+ desc: "List all AI models (summary: id, name, type, tags).",
2703
+ input: "(none)",
2704
+ output: "{ models: MindStudioModelSummary[] }"
2705
+ },
2706
+ listModelsSummaryByType: {
2707
+ desc: "List AI models (summary) filtered by type.",
2708
+ input: "modelType: string (required)",
2709
+ output: "{ models: MindStudioModelSummary[] }"
2710
+ },
2711
+ listConnectors: {
2712
+ desc: "List available connector services and their actions.",
2713
+ input: "(none)",
2714
+ output: "{ services: ConnectorService[] }"
2715
+ },
2716
+ getConnector: {
2717
+ desc: "Get details for a connector service.",
2718
+ input: "serviceId: string (required)",
2719
+ output: "{ service: ConnectorService }"
2720
+ },
2721
+ getConnectorAction: {
2722
+ desc: "Get full configuration for a connector action.",
2723
+ input: "serviceId: string, actionId: string (both required)",
2724
+ output: "{ action: ConnectorActionDetail }"
2725
+ },
2726
+ listConnections: {
2727
+ desc: "List OAuth connections for the organization.",
2728
+ input: "(none)",
2729
+ output: "{ connections: Connection[] }"
2730
+ },
2731
+ estimateStepCost: {
2732
+ desc: "Estimate the cost of executing a step before running it.",
2733
+ input: "stepType: string (required), step: object, appId?: string, workflowId?: string",
2734
+ output: "{ costType?: string, estimates?: StepCostEstimateEntry[] }"
2735
+ },
2736
+ changeName: {
2737
+ desc: "Update the display name of the authenticated agent.",
2738
+ input: "displayName: string (required)",
2739
+ output: "(none)"
2740
+ },
2741
+ changeProfilePicture: {
2742
+ desc: "Update the profile picture of the authenticated agent.",
2743
+ input: "profilePictureUrl: string (required)",
2744
+ output: "(none)"
2745
+ }
2391
2746
  };
2392
2747
  const h = helpers[method];
2393
2748
  process.stderr.write(`
@@ -2446,10 +2801,12 @@ async function cmdInfo(rawMethod) {
2446
2801
  process.stderr.write(out.join("\n") + "\n");
2447
2802
  }
2448
2803
  function formatPropType(prop) {
2449
- if (prop.enum) return prop.enum.map((v) => JSON.stringify(v)).join(" | ");
2804
+ if (prop.enum)
2805
+ return prop.enum.map((v) => JSON.stringify(v)).join(" | ");
2450
2806
  if (prop.type === "array") return "array";
2451
2807
  if (prop.type === "object") return "object";
2452
- if (typeof prop.type === "string") return prop.type === "integer" ? "number" : prop.type;
2808
+ if (typeof prop.type === "string")
2809
+ return prop.type === "integer" ? "number" : prop.type;
2453
2810
  return "string";
2454
2811
  }
2455
2812
  async function cmdExec(method, input, options) {
@@ -2472,9 +2829,7 @@ async function cmdExec(method, input, options) {
2472
2829
  } else if (method === "listModelsSummary") {
2473
2830
  result = await agent.listModelsSummary();
2474
2831
  } else if (method === "listModelsSummaryByType") {
2475
- result = await agent.listModelsSummaryByType(
2476
- input.modelType
2477
- );
2832
+ result = await agent.listModelsSummaryByType(input.modelType);
2478
2833
  } else if (method === "listConnectors") {
2479
2834
  result = await agent.listConnectors();
2480
2835
  } else if (method === "getConnector") {
@@ -2486,6 +2841,21 @@ async function cmdExec(method, input, options) {
2486
2841
  );
2487
2842
  } else if (method === "listConnections") {
2488
2843
  result = await agent.listConnections();
2844
+ } else if (method === "estimateStepCost") {
2845
+ result = await agent.estimateStepCost(
2846
+ input.stepType,
2847
+ input.step,
2848
+ {
2849
+ appId: input.appId,
2850
+ workflowId: input.workflowId
2851
+ }
2852
+ );
2853
+ } else if (method === "changeName") {
2854
+ await agent.changeName(input.displayName);
2855
+ result = { success: true };
2856
+ } else if (method === "changeProfilePicture") {
2857
+ await agent.changeProfilePicture(input.profilePictureUrl);
2858
+ result = { success: true };
2489
2859
  } else {
2490
2860
  const { stepMetadata: stepMetadata2 } = await Promise.resolve().then(() => (init_metadata(), metadata_exports));
2491
2861
  const meta = stepMetadata2[method];
@@ -2540,10 +2910,8 @@ async function cmdAgents(asJson, options) {
2540
2910
  );
2541
2911
  for (const app of result.apps) {
2542
2912
  const desc = app.description || "(no description)";
2543
- process.stdout.write(
2544
- `${app.name.padEnd(maxLen)} ${app.id} ${desc}
2545
- `
2546
- );
2913
+ process.stdout.write(`${app.name.padEnd(maxLen)} ${app.id} ${desc}
2914
+ `);
2547
2915
  }
2548
2916
  }
2549
2917
  }
@@ -2577,6 +2945,41 @@ async function cmdRun(appId, variables, options) {
2577
2945
  process.stdout.write(JSON.stringify(result, null, 2) + "\n");
2578
2946
  }
2579
2947
  }
2948
+ var MIME_TYPES2 = {
2949
+ png: "image/png",
2950
+ jpg: "image/jpeg",
2951
+ jpeg: "image/jpeg",
2952
+ gif: "image/gif",
2953
+ webp: "image/webp",
2954
+ svg: "image/svg+xml",
2955
+ mp4: "video/mp4",
2956
+ webm: "video/webm",
2957
+ mp3: "audio/mpeg",
2958
+ wav: "audio/wav",
2959
+ pdf: "application/pdf",
2960
+ json: "application/json",
2961
+ txt: "text/plain",
2962
+ csv: "text/csv"
2963
+ };
2964
+ async function cmdUpload(filePath, options) {
2965
+ const ext = extname2(filePath).slice(1).toLowerCase();
2966
+ if (!ext) fatal("Cannot determine file extension. Please provide a file with an extension.");
2967
+ const content = readFileSync3(filePath);
2968
+ const mimeType = MIME_TYPES2[ext];
2969
+ const { MindStudioAgent: MindStudioAgent2 } = await Promise.resolve().then(() => (init_client(), client_exports));
2970
+ await Promise.resolve().then(() => (init_helpers(), helpers_exports)).then(
2971
+ (m) => m.applyHelperMethods(MindStudioAgent2)
2972
+ );
2973
+ const agent = new MindStudioAgent2({
2974
+ apiKey: options.apiKey,
2975
+ baseUrl: options.baseUrl
2976
+ });
2977
+ const { url } = await agent.uploadFile(content, {
2978
+ extension: ext,
2979
+ ...mimeType && { type: mimeType }
2980
+ });
2981
+ process.stdout.write(url + "\n");
2982
+ }
2580
2983
  var ansi = {
2581
2984
  cyan: (s) => `\x1B[36m${s}\x1B[0m`,
2582
2985
  cyanBright: (s) => `\x1B[96m${s}\x1B[0m`,
@@ -2600,7 +3003,7 @@ function isNewerVersion(current, latest) {
2600
3003
  return false;
2601
3004
  }
2602
3005
  async function checkForUpdate() {
2603
- const currentVersion = "0.1.0";
3006
+ const currentVersion = "0.1.3";
2604
3007
  if (!currentVersion) return null;
2605
3008
  try {
2606
3009
  const { loadConfig: loadConfig2, saveConfig: saveConfig2 } = await Promise.resolve().then(() => (init_config(), config_exports));
@@ -2629,7 +3032,7 @@ async function checkForUpdate() {
2629
3032
  }
2630
3033
  }
2631
3034
  function printUpdateNotice(latestVersion) {
2632
- const currentVersion = "0.1.0";
3035
+ const currentVersion = "0.1.3";
2633
3036
  process.stderr.write(
2634
3037
  `
2635
3038
  ${ansi.cyanBright("Update available")} ${ansi.gray(currentVersion + " \u2192")} ${ansi.cyanBold(latestVersion)}
@@ -2703,9 +3106,9 @@ async function cmdLogin(options) {
2703
3106
  process.stderr.write("\n");
2704
3107
  printLogo();
2705
3108
  process.stderr.write("\n");
2706
- const ver = "0.1.0";
3109
+ const ver = "0.1.3";
2707
3110
  process.stderr.write(
2708
- ` ${ansi.bold("MindStudio")} ${ansi.gray("CLI")}${ver ? " " + ansi.gray("v" + ver) : ""}
3111
+ ` ${ansi.bold("MindStudio Agent")} ${ver ? " " + ansi.gray("v" + ver) : ""}
2709
3112
  `
2710
3113
  );
2711
3114
  process.stderr.write(
@@ -2722,12 +3125,10 @@ async function cmdLogin(options) {
2722
3125
  );
2723
3126
  await waitForKeypress();
2724
3127
  process.stderr.write("\x1B[4A\r\x1B[J");
2725
- process.stderr.write(
2726
- ` ${ansi.gray("Requesting authorization...")}
2727
- `
2728
- );
3128
+ process.stderr.write(` ${ansi.gray("Requesting authorization...")}
3129
+ `);
2729
3130
  const authRes = await fetch(
2730
- `${baseUrl}/developer/v2/request-auth-url`,
3131
+ `${baseUrl}/developer/v2/request-auth-url?agent=true`,
2731
3132
  {
2732
3133
  headers: {
2733
3134
  "Content-Type": "application/json",
@@ -2771,9 +3172,7 @@ async function cmdLogin(options) {
2771
3172
  });
2772
3173
  if (!pollRes.ok) {
2773
3174
  process.stderr.write("\n");
2774
- fatal(
2775
- `Poll request failed: ${pollRes.status} ${pollRes.statusText}`
2776
- );
3175
+ fatal(`Poll request failed: ${pollRes.status} ${pollRes.statusText}`);
2777
3176
  }
2778
3177
  const result = await pollRes.json();
2779
3178
  if (result.status === "completed" && result.apiKey) {
@@ -2806,10 +3205,8 @@ async function cmdLogout() {
2806
3205
  const { loadConfig: loadConfig2, clearConfig: clearConfig2, getConfigPath: getConfigPath2 } = await Promise.resolve().then(() => (init_config(), config_exports));
2807
3206
  const config = loadConfig2();
2808
3207
  if (!config.apiKey) {
2809
- process.stderr.write(
2810
- ` ${ansi.gray("Not currently logged in.")}
2811
- `
2812
- );
3208
+ process.stderr.write(` ${ansi.gray("Not currently logged in.")}
3209
+ `);
2813
3210
  return;
2814
3211
  }
2815
3212
  clearConfig2();
@@ -2936,12 +3333,28 @@ async function main() {
2936
3333
  workflow: { type: "string" },
2937
3334
  version: { type: "string" },
2938
3335
  json: { type: "boolean", default: false },
3336
+ summary: { type: "boolean", default: false },
2939
3337
  help: { type: "boolean", default: false }
2940
3338
  }
2941
3339
  });
2942
- if (values.help || positionals.length === 0) {
3340
+ if (values.help) {
3341
+ printHelp();
3342
+ process.exit(0);
3343
+ }
3344
+ if (positionals.length === 0) {
3345
+ const hasAuth = values["api-key"] || process.env.MINDSTUDIO_API_KEY || process.env.CALLBACK_TOKEN;
3346
+ if (!hasAuth) {
3347
+ const { loadConfig: loadConfig2 } = await Promise.resolve().then(() => (init_config(), config_exports));
3348
+ const config = loadConfig2();
3349
+ if (!config.apiKey) {
3350
+ await cmdLogin({
3351
+ baseUrl: values["base-url"]
3352
+ });
3353
+ return;
3354
+ }
3355
+ }
2943
3356
  printHelp();
2944
- process.exit(positionals.length === 0 ? 1 : 0);
3357
+ process.exit(1);
2945
3358
  }
2946
3359
  const command = positionals[0];
2947
3360
  const updatePromise = command !== "mcp" && command !== "login" ? checkForUpdate() : Promise.resolve(null);
@@ -2964,7 +3377,7 @@ async function main() {
2964
3377
  return;
2965
3378
  }
2966
3379
  if (command === "list") {
2967
- await cmdList(values.json);
3380
+ await cmdList(values.json, values.summary);
2968
3381
  return;
2969
3382
  }
2970
3383
  if (command === "agents") {
@@ -2978,9 +3391,7 @@ async function main() {
2978
3391
  const appId = positionals[1];
2979
3392
  if (!appId)
2980
3393
  fatal("Missing app ID. Usage: mindstudio run <appId> [json | --flags]");
2981
- const runArgv = process.argv.slice(
2982
- process.argv.indexOf("run") + 2
2983
- );
3394
+ const runArgv = process.argv.slice(process.argv.indexOf("run") + 2);
2984
3395
  const stepArgs = [];
2985
3396
  for (let i = 0; i < runArgv.length; i++) {
2986
3397
  const arg = runArgv[i];
@@ -3025,6 +3436,16 @@ async function main() {
3025
3436
  });
3026
3437
  return;
3027
3438
  }
3439
+ if (command === "upload") {
3440
+ const filePath = positionals[1];
3441
+ if (!filePath)
3442
+ fatal("Missing file path. Usage: mindstudio upload <filepath>");
3443
+ await cmdUpload(filePath, {
3444
+ apiKey: values["api-key"],
3445
+ baseUrl: values["base-url"]
3446
+ });
3447
+ return;
3448
+ }
3028
3449
  if (command === "mcp") {
3029
3450
  const { startMcpServer: startMcpServer2 } = await Promise.resolve().then(() => (init_mcp(), mcp_exports));
3030
3451
  await startMcpServer2({
@@ -3042,9 +3463,7 @@ async function main() {
3042
3463
  }
3043
3464
  const split = findMethodSplit(process.argv.slice(2));
3044
3465
  if (!split)
3045
- fatal(
3046
- "Missing method name. Usage: mindstudio <method> [json | --flags]"
3047
- );
3466
+ fatal("Missing method name. Usage: mindstudio <method> [json | --flags]");
3048
3467
  const { rawMethod, stepArgv } = split;
3049
3468
  const allKeys = await getAllMethodKeys();
3050
3469
  const method = resolveMethodOrFail(rawMethod, allKeys);