@mindstudio-ai/agent 0.1.4 → 0.1.5

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
@@ -1806,67 +1806,6 @@ var init_steps = __esm({
1806
1806
  }
1807
1807
  });
1808
1808
 
1809
- // src/generated/helpers.ts
1810
- var helpers_exports = {};
1811
- __export(helpers_exports, {
1812
- applyHelperMethods: () => applyHelperMethods
1813
- });
1814
- function applyHelperMethods(AgentClass) {
1815
- const proto = AgentClass.prototype;
1816
- proto.listModels = function() {
1817
- return this._request("GET", "/helpers/models").then((r) => r.data);
1818
- };
1819
- proto.listModelsByType = function(modelType) {
1820
- return this._request("GET", `/helpers/models/${modelType}`).then((r) => r.data);
1821
- };
1822
- proto.listModelsSummary = function() {
1823
- return this._request("GET", "/helpers/models-summary").then((r) => r.data);
1824
- };
1825
- proto.listModelsSummaryByType = function(modelType) {
1826
- return this._request("GET", `/helpers/models-summary/${modelType}`).then((r) => r.data);
1827
- };
1828
- proto.listConnectors = function() {
1829
- return this._request("GET", "/helpers/connectors").then((r) => r.data);
1830
- };
1831
- proto.getConnector = function(serviceId) {
1832
- return this._request("GET", `/helpers/connectors/${serviceId}`).then((r) => r.data);
1833
- };
1834
- proto.getConnectorAction = function(serviceId, actionId) {
1835
- return this._request("GET", `/helpers/connectors/${serviceId}/${actionId}`).then((r) => r.data);
1836
- };
1837
- proto.listConnections = function() {
1838
- return this._request("GET", "/helpers/connections").then((r) => r.data);
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
- };
1863
- }
1864
- var init_helpers = __esm({
1865
- "src/generated/helpers.ts"() {
1866
- "use strict";
1867
- }
1868
- });
1869
-
1870
1809
  // src/client.ts
1871
1810
  var client_exports = {};
1872
1811
  __export(client_exports, {
@@ -1898,7 +1837,6 @@ var init_client = __esm({
1898
1837
  init_rate_limit();
1899
1838
  init_config();
1900
1839
  init_steps();
1901
- init_helpers();
1902
1840
  DEFAULT_BASE_URL = "https://v1.mindstudio-api.com";
1903
1841
  DEFAULT_MAX_RETRIES = 3;
1904
1842
  MindStudioAgent = class {
@@ -1969,6 +1907,22 @@ var init_client = __esm({
1969
1907
  $billingEvents: billingEvents != null ? JSON.parse(billingEvents) : void 0
1970
1908
  };
1971
1909
  }
1910
+ /**
1911
+ * Get the authenticated user's identity and organization info.
1912
+ *
1913
+ * ```ts
1914
+ * const info = await agent.getUserInfo();
1915
+ * console.log(info.displayName, info.organizationName);
1916
+ * ```
1917
+ */
1918
+ async getUserInfo() {
1919
+ const { data } = await request(
1920
+ this._httpConfig,
1921
+ "GET",
1922
+ "/account/userinfo"
1923
+ );
1924
+ return data;
1925
+ }
1972
1926
  /**
1973
1927
  * List all pre-built agents in the organization.
1974
1928
  *
@@ -2045,13 +1999,155 @@ var init_client = __esm({
2045
1999
  return poll.result;
2046
2000
  }
2047
2001
  }
2048
- /** @internal Used by generated helper methods. */
2002
+ /** @internal Used by generated action methods. */
2049
2003
  _request(method, path, body) {
2050
2004
  return request(this._httpConfig, method, path, body);
2051
2005
  }
2006
+ // -------------------------------------------------------------------------
2007
+ // Helper methods — models
2008
+ // -------------------------------------------------------------------------
2009
+ /** List all available AI models. */
2010
+ async listModels() {
2011
+ const { data } = await request(
2012
+ this._httpConfig,
2013
+ "GET",
2014
+ "/helpers/models"
2015
+ );
2016
+ return data;
2017
+ }
2018
+ /** List AI models filtered by type. */
2019
+ async listModelsByType(modelType) {
2020
+ const { data } = await request(
2021
+ this._httpConfig,
2022
+ "GET",
2023
+ `/helpers/models/${modelType}`
2024
+ );
2025
+ return data;
2026
+ }
2027
+ /** List all available AI models (summary). Returns only id, name, type, and tags. */
2028
+ async listModelsSummary() {
2029
+ const { data } = await request(
2030
+ this._httpConfig,
2031
+ "GET",
2032
+ "/helpers/models-summary"
2033
+ );
2034
+ return data;
2035
+ }
2036
+ /** List AI models (summary) filtered by type. */
2037
+ async listModelsSummaryByType(modelType) {
2038
+ const { data } = await request(
2039
+ this._httpConfig,
2040
+ "GET",
2041
+ `/helpers/models-summary/${modelType}`
2042
+ );
2043
+ return data;
2044
+ }
2045
+ // -------------------------------------------------------------------------
2046
+ // Helper methods — OAuth connectors & connections
2047
+ // -------------------------------------------------------------------------
2048
+ /**
2049
+ * List available OAuth connector services (Slack, Google, HubSpot, etc.).
2050
+ *
2051
+ * These are third-party integrations from the MindStudio Connector Registry.
2052
+ * For most tasks, use actions directly instead.
2053
+ */
2054
+ async listConnectors() {
2055
+ const { data } = await request(
2056
+ this._httpConfig,
2057
+ "GET",
2058
+ "/helpers/connectors"
2059
+ );
2060
+ return data;
2061
+ }
2062
+ /** Get details for a single OAuth connector service. */
2063
+ async getConnector(serviceId) {
2064
+ const { data } = await request(
2065
+ this._httpConfig,
2066
+ "GET",
2067
+ `/helpers/connectors/${serviceId}`
2068
+ );
2069
+ return data;
2070
+ }
2071
+ /** Get the full configuration for an OAuth connector action, including input fields. */
2072
+ async getConnectorAction(serviceId, actionId) {
2073
+ const { data } = await request(
2074
+ this._httpConfig,
2075
+ "GET",
2076
+ `/helpers/connectors/${serviceId}/${actionId}`
2077
+ );
2078
+ return data;
2079
+ }
2080
+ /** List OAuth connections for the organization. These are authenticated third-party service links. */
2081
+ async listConnections() {
2082
+ const { data } = await request(
2083
+ this._httpConfig,
2084
+ "GET",
2085
+ "/helpers/connections"
2086
+ );
2087
+ return data;
2088
+ }
2089
+ // -------------------------------------------------------------------------
2090
+ // Helper methods — cost estimation
2091
+ // -------------------------------------------------------------------------
2092
+ /** Estimate the cost of executing an action before running it. */
2093
+ async estimateStepCost(stepType, step, options) {
2094
+ const { data } = await request(this._httpConfig, "POST", "/helpers/step-cost-estimate", {
2095
+ step: { type: stepType, ...step },
2096
+ ...options
2097
+ });
2098
+ return data;
2099
+ }
2100
+ // -------------------------------------------------------------------------
2101
+ // Account methods
2102
+ // -------------------------------------------------------------------------
2103
+ /** Update the display name of the authenticated user/agent. */
2104
+ async changeName(displayName) {
2105
+ await request(this._httpConfig, "POST", "/account/change-name", {
2106
+ name: displayName
2107
+ });
2108
+ }
2109
+ /** Update the profile picture of the authenticated user/agent. */
2110
+ async changeProfilePicture(url) {
2111
+ await request(this._httpConfig, "POST", "/account/change-profile-picture", {
2112
+ url
2113
+ });
2114
+ }
2115
+ /**
2116
+ * Upload a file to the MindStudio CDN.
2117
+ *
2118
+ * Gets a signed upload URL, PUTs the file content, and returns the
2119
+ * permanent public URL.
2120
+ */
2121
+ async uploadFile(content, options) {
2122
+ const { data } = await request(
2123
+ this._httpConfig,
2124
+ "POST",
2125
+ "/account/upload",
2126
+ {
2127
+ extension: options.extension,
2128
+ ...options.type != null && { type: options.type }
2129
+ }
2130
+ );
2131
+ const buf = content.buffer.slice(
2132
+ content.byteOffset,
2133
+ content.byteOffset + content.byteLength
2134
+ );
2135
+ const res = await fetch(data.uploadUrl, {
2136
+ method: "PUT",
2137
+ body: buf,
2138
+ headers: options.type ? { "Content-Type": options.type } : {}
2139
+ });
2140
+ if (!res.ok) {
2141
+ throw new MindStudioError(
2142
+ `Upload failed: ${res.status} ${res.statusText}`,
2143
+ "upload_error",
2144
+ res.status
2145
+ );
2146
+ }
2147
+ return { url: data.url };
2148
+ }
2052
2149
  };
2053
2150
  applyStepMethods(MindStudioAgent);
2054
- applyHelperMethods(MindStudioAgent);
2055
2151
  }
2056
2152
  });
2057
2153
 
@@ -2115,9 +2211,9 @@ async function startMcpServer(options) {
2115
2211
  capabilities: { tools: {} },
2116
2212
  serverInfo: {
2117
2213
  name: "mindstudio-agent",
2118
- version: "0.1.4"
2214
+ version: "0.1.5"
2119
2215
  },
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.\n\nImportant:\n- AI-powered steps (text generation, image generation, video, audio, etc.) cost money. Before running these, call `estimateStepCost` and confirm with the user before proceeding \u2014 unless they've explicitly told you to go ahead.\n- Not all agents from `listAgents` are configured for API use. Do not try to run an agent just because it appears in the list \u2014 it will likely fail. Only run agents the user specifically asks you to run."
2216
+ 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 `listActions` to discover all available actions.\n\nThen use the tools to generate text, images, video, audio, search the web, work with data sources, run agents, and more.\n\nImportant:\n- AI-powered actions (text generation, image generation, video, audio, etc.) cost money. Before running these, call `estimateActionCost` and confirm with the user before proceeding \u2014 unless they've explicitly told you to go ahead.\n- Not all agents from `listAgents` are configured for API use. Do not try to run an agent just because it appears in the list \u2014 it will likely fail. Only run agents the user specifically asks you to run."
2121
2217
  });
2122
2218
  break;
2123
2219
  case "notifications/initialized":
@@ -2130,7 +2226,7 @@ async function startMcpServer(options) {
2130
2226
  const args = params.arguments ?? {};
2131
2227
  try {
2132
2228
  let result;
2133
- if (toolName === "listSteps") {
2229
+ if (toolName === "listActions") {
2134
2230
  const meta = await getMetadata();
2135
2231
  const summary = {};
2136
2232
  for (const [name, step] of Object.entries(meta)) {
@@ -2167,7 +2263,7 @@ async function startMcpServer(options) {
2167
2263
  );
2168
2264
  } else if (toolName === "listConnections") {
2169
2265
  result = await getAgent().listConnections();
2170
- } else if (toolName === "estimateStepCost") {
2266
+ } else if (toolName === "estimateActionCost") {
2171
2267
  result = await getAgent().estimateStepCost(
2172
2268
  args.stepType,
2173
2269
  args.step,
@@ -2277,11 +2373,11 @@ var init_mcp = __esm({
2277
2373
  listModelsByType: "List AI models filtered by type.",
2278
2374
  listModelsSummary: "List all AI models (summary: id, name, type, tags).",
2279
2375
  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.",
2376
+ listConnectors: "List available OAuth connector services (third-party integrations). For most tasks, use actions directly instead.",
2377
+ getConnector: "Get details for an OAuth connector service.",
2378
+ getConnectorAction: "Get full configuration for an OAuth connector action.",
2379
+ listConnections: "List OAuth connections for the organization (authenticated third-party service links).",
2380
+ estimateStepCost: "Estimate the cost of executing an action before running it.",
2285
2381
  changeName: "Update the display name of the authenticated agent.",
2286
2382
  changeProfilePicture: "Update the profile picture of the authenticated agent.",
2287
2383
  uploadFile: "Upload a file to the MindStudio CDN.",
@@ -2290,8 +2386,8 @@ var init_mcp = __esm({
2290
2386
  };
2291
2387
  HELPER_TOOLS = [
2292
2388
  {
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.",
2389
+ name: "listActions",
2390
+ description: "List all available actions with their descriptions. Returns a compact { action: description } map. Call this to discover what actions are available, then call a specific action by name. Tip: if you haven't already, call `changeName` to set your display name first.",
2295
2391
  inputSchema: { type: "object", properties: {} }
2296
2392
  },
2297
2393
  {
@@ -2350,12 +2446,12 @@ var init_mcp = __esm({
2350
2446
  },
2351
2447
  {
2352
2448
  name: "listConnectors",
2353
- description: "List available connector services (Slack, Google, HubSpot, etc.) and their actions.",
2449
+ description: "List available OAuth connector services (Slack, Google, HubSpot, etc.) and their actions. These are third-party integrations \u2014 for most tasks, use actions directly instead.",
2354
2450
  inputSchema: { type: "object", properties: {} }
2355
2451
  },
2356
2452
  {
2357
2453
  name: "getConnector",
2358
- description: "Get details for a single connector service by ID.",
2454
+ description: "Get details for a single OAuth connector service by ID.",
2359
2455
  inputSchema: {
2360
2456
  type: "object",
2361
2457
  properties: { serviceId: { type: "string" } },
@@ -2364,7 +2460,7 @@ var init_mcp = __esm({
2364
2460
  },
2365
2461
  {
2366
2462
  name: "getConnectorAction",
2367
- description: "Get the full configuration for a connector action, including all input fields needed to call it via runFromConnectorRegistry.",
2463
+ description: "Get the full configuration for an OAuth connector action, including all input fields needed to call it via runFromConnectorRegistry.",
2368
2464
  inputSchema: {
2369
2465
  type: "object",
2370
2466
  properties: {
@@ -2382,22 +2478,22 @@ var init_mcp = __esm({
2382
2478
  },
2383
2479
  {
2384
2480
  name: "listConnections",
2385
- description: "List OAuth connections for the organization. Use the returned connection IDs when calling connector actions.",
2481
+ description: "List OAuth connections for the organization (authenticated third-party service links). Use the returned connection IDs when calling OAuth connector actions.",
2386
2482
  inputSchema: { type: "object", properties: {} }
2387
2483
  },
2388
2484
  {
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.",
2485
+ name: "estimateActionCost",
2486
+ description: "Estimate the cost of executing an action before running it. Pass the same config you would use for execution.",
2391
2487
  inputSchema: {
2392
2488
  type: "object",
2393
2489
  properties: {
2394
2490
  stepType: {
2395
2491
  type: "string",
2396
- description: 'The step type name (e.g. "generateText").'
2492
+ description: 'The action type name (e.g. "generateText").'
2397
2493
  },
2398
2494
  step: {
2399
2495
  type: "object",
2400
- description: "The step input parameters.",
2496
+ description: "The action input parameters.",
2401
2497
  additionalProperties: true
2402
2498
  },
2403
2499
  appId: {
@@ -2495,44 +2591,62 @@ import { parseArgs } from "util";
2495
2591
  import { execSync } from "child_process";
2496
2592
  import { readFileSync as readFileSync3 } from "fs";
2497
2593
  import { extname as extname2 } from "path";
2498
- var HELP = `Usage: mindstudio <command | method> [options]
2594
+ var HELP = `Usage: mindstudio <command> [options]
2595
+
2596
+ Run actions:
2597
+ <action> [json | --flags] Run an action directly
2598
+ run <action> [json | --flags] Run an action (explicit form)
2599
+ estimate-cost <action> [json] Estimate cost before running
2600
+
2601
+ Discover:
2602
+ list-actions [--json] [--summary] List all available actions
2603
+ info <action> Show action details and parameters
2604
+ list-models [--type <t>] [--summary] List available AI models
2499
2605
 
2500
- Commands:
2501
- login Authenticate with MindStudio (opens browser)
2502
- logout Clear stored credentials
2503
- whoami Show current authentication status
2504
- upload <filepath> Upload a file to the MindStudio CDN
2505
- <method> [json | --flags] Execute a step method (shorthand for exec)
2506
- exec <method> [json | --flags] Execute a step method
2507
- list [--json] [--summary] List available methods (--summary for compact JSON)
2508
- info <method> Show method details (params, types, output)
2509
- agents [--json] List pre-built agents in your organization
2510
- run <appId> [json | --flags] Run a pre-built agent and wait for result
2511
- mcp Start MCP server (JSON-RPC over stdio)
2606
+ Pre-built agents:
2607
+ agents [--json] List agents in your organization
2608
+ run-agent <appId> [json | --flags] Run an agent and wait for result
2609
+
2610
+ Account:
2611
+ login Authenticate with MindStudio
2612
+ logout Clear stored credentials
2613
+ whoami Show current user and organization
2614
+ change-name <name> Update your display name
2615
+ change-profile-picture <url> Update your profile picture
2616
+ upload <filepath> Upload a file to the MindStudio CDN
2617
+
2618
+ OAuth integrations:
2619
+ list-connectors [<id> [<actionId>]] Browse OAuth connector services
2620
+ list-connections List your OAuth connections
2621
+
2622
+ Other:
2623
+ mcp Start MCP server (JSON-RPC over stdio)
2512
2624
 
2513
2625
  Options:
2514
- --api-key <key> API key (or set MINDSTUDIO_API_KEY env)
2515
- --base-url <url> API base URL
2516
- --app-id <id> App ID for thread context
2517
- --thread-id <id> Thread ID for state persistence
2518
- --output-key <key> Extract a single field from the result
2519
- --no-meta Strip $-prefixed metadata from output
2520
- --workflow <name> Workflow to execute (run command)
2521
- --version <ver> App version override, e.g. "draft" (run command)
2522
- --json Output as JSON (list/agents only)
2523
- --help Show this help
2626
+ --api-key <key> API key (or set MINDSTUDIO_API_KEY env var)
2627
+ --base-url <url> API base URL override
2628
+ --app-id <id> App ID for thread context
2629
+ --thread-id <id> Thread ID for state persistence
2630
+ --output-key <key> Extract a single field from the result
2631
+ --no-meta Strip $-prefixed metadata from output
2632
+ --workflow <name> Workflow to execute (run-agent only)
2633
+ --version <ver> App version, e.g. "draft" (run-agent only)
2634
+ --json Output as JSON
2635
+ --summary Compact output (list-actions, list-models)
2636
+ --type <type> Filter by model type (list-models)
2637
+ --help Show this help
2524
2638
 
2525
2639
  Examples:
2526
- mindstudio login
2527
2640
  mindstudio generate-image --prompt "a sunset"
2528
- mindstudio generate-image --prompt "a sunset" --output-key imageUrl
2529
2641
  mindstudio generate-text --message "hello" --no-meta
2530
- mindstudio generate-image '{"prompt":"a sunset"}'
2642
+ mindstudio generate-image '{"prompt":"a sunset"}' --output-key imageUrl
2531
2643
  echo '{"query":"test"}' | mindstudio search-google
2644
+ mindstudio estimate-cost generate-image --prompt "a sunset"
2645
+ mindstudio list-actions --summary
2532
2646
  mindstudio info generate-image
2533
- mindstudio list --json
2647
+ mindstudio list-models --type image_generation
2648
+ mindstudio run-agent <appId> --query "hello"
2534
2649
  mindstudio agents
2535
- mindstudio run <appId> --query "hello"
2536
2650
  mindstudio mcp
2537
2651
  `;
2538
2652
  function camelToKebab(s) {
@@ -2593,19 +2707,6 @@ async function readStdin() {
2593
2707
  }
2594
2708
  return Buffer.concat(chunks).toString("utf-8").trim();
2595
2709
  }
2596
- var HELPER_NAMES = /* @__PURE__ */ new Set([
2597
- "listModels",
2598
- "listModelsByType",
2599
- "listModelsSummary",
2600
- "listModelsSummaryByType",
2601
- "listConnectors",
2602
- "getConnector",
2603
- "getConnectorAction",
2604
- "listConnections",
2605
- "estimateStepCost",
2606
- "changeName",
2607
- "changeProfilePicture"
2608
- ]);
2609
2710
  function resolveMethodOrFail(name, metadataKeys) {
2610
2711
  if (metadataKeys.has(name)) return name;
2611
2712
  const camel = kebabToCamel(name);
@@ -2622,36 +2723,18 @@ function resolveMethodOrFail(name, metadataKeys) {
2622
2723
  }
2623
2724
  const suggestion = bestDist <= 3 ? ` Did you mean '${bestMatch}'?` : "";
2624
2725
  fatal(
2625
- `Unknown method: ${name}.${suggestion} Run 'mindstudio list' to see available methods.`
2726
+ `Unknown action: ${name}.${suggestion} Run 'mindstudio list-actions' to see available actions.`
2626
2727
  );
2627
2728
  }
2628
2729
  async function getAllMethodKeys() {
2629
2730
  const { stepMetadata: stepMetadata2 } = await Promise.resolve().then(() => (init_metadata(), metadata_exports));
2630
- return /* @__PURE__ */ new Set([...Object.keys(stepMetadata2), ...HELPER_NAMES]);
2731
+ return new Set(Object.keys(stepMetadata2));
2631
2732
  }
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
2733
  function buildSummary(stepMetadata2) {
2648
2734
  const summary = {};
2649
2735
  for (const [name, meta] of Object.entries(stepMetadata2)) {
2650
2736
  summary[name] = meta.description;
2651
2737
  }
2652
- for (const [name, desc] of Object.entries(HELPER_DESCRIPTIONS2)) {
2653
- summary[name] = desc;
2654
- }
2655
2738
  return summary;
2656
2739
  }
2657
2740
  async function cmdList(asJson, asSummary) {
@@ -2686,79 +2769,6 @@ async function cmdList(asJson, asSummary) {
2686
2769
  async function cmdInfo(rawMethod) {
2687
2770
  const allKeys = await getAllMethodKeys();
2688
2771
  const method = resolveMethodOrFail(rawMethod, allKeys);
2689
- if (HELPER_NAMES.has(method)) {
2690
- const helpers = {
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
- }
2746
- };
2747
- const h = helpers[method];
2748
- process.stderr.write(`
2749
- ${camelToKebab(method)}
2750
-
2751
- `);
2752
- process.stderr.write(` ${h.desc}
2753
-
2754
- `);
2755
- process.stderr.write(` Input: ${h.input}
2756
- `);
2757
- process.stderr.write(` Output: ${h.output}
2758
-
2759
- `);
2760
- return;
2761
- }
2762
2772
  const { stepMetadata: stepMetadata2 } = await Promise.resolve().then(() => (init_metadata(), metadata_exports));
2763
2773
  const meta = stepMetadata2[method];
2764
2774
  const out = [];
@@ -2814,61 +2824,21 @@ async function cmdExec(method, input, options) {
2814
2824
  await Promise.resolve().then(() => (init_steps(), steps_exports)).then(
2815
2825
  (m) => m.applyStepMethods(MindStudioAgent2)
2816
2826
  );
2817
- await Promise.resolve().then(() => (init_helpers(), helpers_exports)).then(
2818
- (m) => m.applyHelperMethods(MindStudioAgent2)
2819
- );
2820
2827
  const agent = new MindStudioAgent2({
2821
2828
  apiKey: options.apiKey,
2822
2829
  baseUrl: options.baseUrl
2823
2830
  });
2824
- let result;
2825
- if (method === "listModels") {
2826
- result = await agent.listModels();
2827
- } else if (method === "listModelsByType") {
2828
- result = await agent.listModelsByType(input.modelType);
2829
- } else if (method === "listModelsSummary") {
2830
- result = await agent.listModelsSummary();
2831
- } else if (method === "listModelsSummaryByType") {
2832
- result = await agent.listModelsSummaryByType(input.modelType);
2833
- } else if (method === "listConnectors") {
2834
- result = await agent.listConnectors();
2835
- } else if (method === "getConnector") {
2836
- result = await agent.getConnector(input.serviceId);
2837
- } else if (method === "getConnectorAction") {
2838
- result = await agent.getConnectorAction(
2839
- input.serviceId,
2840
- input.actionId
2841
- );
2842
- } else if (method === "listConnections") {
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
- }
2831
+ const { stepMetadata: stepMetadata2 } = await Promise.resolve().then(() => (init_metadata(), metadata_exports));
2832
+ const meta = stepMetadata2[method];
2833
+ if (!meta) {
2834
+ fatal(
2835
+ `Unknown action: ${method}. Run 'mindstudio list-actions' to see available actions.`
2852
2836
  );
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 };
2859
- } else {
2860
- const { stepMetadata: stepMetadata2 } = await Promise.resolve().then(() => (init_metadata(), metadata_exports));
2861
- const meta = stepMetadata2[method];
2862
- if (!meta) {
2863
- fatal(
2864
- `Unknown method: ${method}. Run 'mindstudio list' to see available methods.`
2865
- );
2866
- }
2867
- result = await agent.executeStep(meta.stepType, input, {
2868
- appId: options.appId,
2869
- threadId: options.threadId
2870
- });
2871
2837
  }
2838
+ const result = await agent.executeStep(meta.stepType, input, {
2839
+ appId: options.appId,
2840
+ threadId: options.threadId
2841
+ });
2872
2842
  if (options.outputKey) {
2873
2843
  const val = result[options.outputKey];
2874
2844
  if (typeof val === "string") {
@@ -2915,6 +2885,62 @@ async function cmdAgents(asJson, options) {
2915
2885
  }
2916
2886
  }
2917
2887
  }
2888
+ function createAgent(options) {
2889
+ return Promise.resolve().then(() => (init_client(), client_exports)).then(
2890
+ ({ MindStudioAgent: MindStudioAgent2 }) => new MindStudioAgent2({
2891
+ apiKey: options.apiKey,
2892
+ baseUrl: options.baseUrl
2893
+ })
2894
+ );
2895
+ }
2896
+ function jsonOut(data) {
2897
+ process.stdout.write(JSON.stringify(data, null, 2) + "\n");
2898
+ }
2899
+ async function cmdListModels(options) {
2900
+ const agent = await createAgent(options);
2901
+ if (options.summary) {
2902
+ const result = options.type ? await agent.listModelsSummaryByType(options.type) : await agent.listModelsSummary();
2903
+ jsonOut(result);
2904
+ } else {
2905
+ const result = options.type ? await agent.listModelsByType(options.type) : await agent.listModels();
2906
+ jsonOut(result);
2907
+ }
2908
+ }
2909
+ async function cmdListConnectors(args, options) {
2910
+ const agent = await createAgent(options);
2911
+ if (args.length >= 2) {
2912
+ const result = await agent.getConnectorAction(args[0], args[1]);
2913
+ jsonOut(result);
2914
+ } else if (args.length === 1) {
2915
+ const result = await agent.getConnector(args[0]);
2916
+ jsonOut(result);
2917
+ } else {
2918
+ const result = await agent.listConnectors();
2919
+ jsonOut(result);
2920
+ }
2921
+ }
2922
+ async function cmdListConnections(options) {
2923
+ const agent = await createAgent(options);
2924
+ const result = await agent.listConnections();
2925
+ jsonOut(result);
2926
+ }
2927
+ async function cmdEstimateStepCost(method, input, options) {
2928
+ const agent = await createAgent(options);
2929
+ const result = await agent.estimateStepCost(method, input);
2930
+ jsonOut(result);
2931
+ }
2932
+ async function cmdChangeName(name, options) {
2933
+ const agent = await createAgent(options);
2934
+ await agent.changeName(name);
2935
+ process.stderr.write(` Display name updated to: ${name}
2936
+ `);
2937
+ }
2938
+ async function cmdChangeProfilePicture(url, options) {
2939
+ const agent = await createAgent(options);
2940
+ await agent.changeProfilePicture(url);
2941
+ process.stderr.write(` Profile picture updated.
2942
+ `);
2943
+ }
2918
2944
  async function cmdRun(appId, variables, options) {
2919
2945
  const { MindStudioAgent: MindStudioAgent2 } = await Promise.resolve().then(() => (init_client(), client_exports));
2920
2946
  const agent = new MindStudioAgent2({
@@ -2967,9 +2993,6 @@ async function cmdUpload(filePath, options) {
2967
2993
  const content = readFileSync3(filePath);
2968
2994
  const mimeType = MIME_TYPES2[ext];
2969
2995
  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
2996
  const agent = new MindStudioAgent2({
2974
2997
  apiKey: options.apiKey,
2975
2998
  baseUrl: options.baseUrl
@@ -3003,7 +3026,7 @@ function isNewerVersion(current, latest) {
3003
3026
  return false;
3004
3027
  }
3005
3028
  async function checkForUpdate() {
3006
- const currentVersion = "0.1.4";
3029
+ const currentVersion = "0.1.5";
3007
3030
  if (!currentVersion) return null;
3008
3031
  try {
3009
3032
  const { loadConfig: loadConfig2, saveConfig: saveConfig2 } = await Promise.resolve().then(() => (init_config(), config_exports));
@@ -3032,7 +3055,7 @@ async function checkForUpdate() {
3032
3055
  }
3033
3056
  }
3034
3057
  function printUpdateNotice(latestVersion) {
3035
- const currentVersion = "0.1.4";
3058
+ const currentVersion = "0.1.5";
3036
3059
  process.stderr.write(
3037
3060
  `
3038
3061
  ${ansi.cyanBright("Update available")} ${ansi.gray(currentVersion + " \u2192")} ${ansi.cyanBold(latestVersion)}
@@ -3103,10 +3126,11 @@ var SPINNER_FRAMES = [
3103
3126
  ];
3104
3127
  async function cmdLogin(options) {
3105
3128
  const baseUrl = options.baseUrl ?? process.env.MINDSTUDIO_BASE_URL ?? process.env.REMOTE_HOSTNAME ?? DEFAULT_BASE_URL2;
3129
+ process.stderr.write("\x1B[2J\x1B[H");
3106
3130
  process.stderr.write("\n");
3107
3131
  printLogo();
3108
3132
  process.stderr.write("\n");
3109
- const ver = "0.1.4";
3133
+ const ver = "0.1.5";
3110
3134
  process.stderr.write(
3111
3135
  ` ${ansi.bold("MindStudio Agent")} ${ver ? " " + ansi.gray("v" + ver) : ""}
3112
3136
  `
@@ -3255,11 +3279,62 @@ async function cmdWhoami(options) {
3255
3279
  apiKey: options.apiKey,
3256
3280
  baseUrl: options.baseUrl
3257
3281
  });
3258
- const result = await agent.listAgents();
3282
+ const info = await agent.getUserInfo();
3283
+ process.stderr.write(
3284
+ `\r\x1B[K ${ansi.greenBold("\u25CF")} ${ansi.green("Connected")}
3285
+
3286
+ `
3287
+ );
3288
+ process.stderr.write(` ${ansi.bold("User")}
3289
+ `);
3290
+ process.stderr.write(
3291
+ ` ${ansi.gray("Name:")} ${info.displayName}
3292
+ `
3293
+ );
3294
+ process.stderr.write(
3295
+ ` ${ansi.gray("ID:")} ${ansi.gray(info.userId)}
3296
+ `
3297
+ );
3298
+ process.stderr.write(`
3299
+ ${ansi.bold("Organization")}
3300
+ `);
3301
+ process.stderr.write(
3302
+ ` ${ansi.gray("Name:")} ${info.organizationName}
3303
+ `
3304
+ );
3259
3305
  process.stderr.write(
3260
- `\r\x1B[K ${ansi.greenBold("\u25CF")} ${ansi.green("Connected")} ${ansi.gray("\u2014")} ${result.orgName} ${ansi.gray("(" + result.orgId + ")")}
3306
+ ` ${ansi.gray("ID:")} ${ansi.gray(info.organizationId)}
3261
3307
  `
3262
3308
  );
3309
+ if (info.members && info.members.length > 0) {
3310
+ process.stderr.write(`
3311
+ ${ansi.bold("Members")}
3312
+ `);
3313
+ const nameWidth = Math.max(
3314
+ 4,
3315
+ ...info.members.map((m) => m.displayName.length)
3316
+ );
3317
+ const roleWidth = Math.max(
3318
+ 4,
3319
+ ...info.members.map((m) => m.role.length)
3320
+ );
3321
+ process.stderr.write(
3322
+ ` ${ansi.gray("Name".padEnd(nameWidth))} ${ansi.gray("Role".padEnd(roleWidth))} ${ansi.gray("Type")}
3323
+ `
3324
+ );
3325
+ process.stderr.write(
3326
+ ` ${ansi.gray("\u2500".repeat(nameWidth))} ${ansi.gray("\u2500".repeat(roleWidth))} ${ansi.gray("\u2500".repeat(5))}
3327
+ `
3328
+ );
3329
+ for (const member of info.members) {
3330
+ const type = member.isAgent ? ansi.cyan("agent") : "user";
3331
+ process.stderr.write(
3332
+ ` ${member.displayName.padEnd(nameWidth)} ${ansi.gray(member.role.padEnd(roleWidth))} ${type}
3333
+ `
3334
+ );
3335
+ }
3336
+ }
3337
+ process.stderr.write("\n");
3263
3338
  } catch (err) {
3264
3339
  const message = err instanceof Error ? err.message : String(err);
3265
3340
  process.stderr.write(
@@ -3290,15 +3365,15 @@ var GLOBAL_STRING_FLAGS = /* @__PURE__ */ new Set([
3290
3365
  ]);
3291
3366
  function findMethodSplit(argv) {
3292
3367
  let startIdx = 0;
3293
- let hasExec = false;
3368
+ let hasRun = false;
3294
3369
  for (let i = 0; i < argv.length; i++) {
3295
3370
  const arg = argv[i];
3296
3371
  if (arg.startsWith("--")) {
3297
3372
  if (GLOBAL_STRING_FLAGS.has(arg)) i++;
3298
3373
  continue;
3299
3374
  }
3300
- if (arg === "exec") {
3301
- hasExec = true;
3375
+ if (arg === "run") {
3376
+ hasRun = true;
3302
3377
  startIdx = i + 1;
3303
3378
  } else {
3304
3379
  startIdx = i;
@@ -3311,7 +3386,7 @@ function findMethodSplit(argv) {
3311
3386
  if (GLOBAL_STRING_FLAGS.has(arg)) i++;
3312
3387
  continue;
3313
3388
  }
3314
- if (hasExec || i === startIdx) {
3389
+ if (hasRun || i === startIdx) {
3315
3390
  return { rawMethod: arg, stepArgv: argv.slice(i + 1) };
3316
3391
  }
3317
3392
  break;
@@ -3332,6 +3407,7 @@ async function main() {
3332
3407
  "no-meta": { type: "boolean", default: false },
3333
3408
  workflow: { type: "string" },
3334
3409
  version: { type: "string" },
3410
+ type: { type: "string" },
3335
3411
  json: { type: "boolean", default: false },
3336
3412
  summary: { type: "boolean", default: false },
3337
3413
  help: { type: "boolean", default: false }
@@ -3376,7 +3452,7 @@ async function main() {
3376
3452
  });
3377
3453
  return;
3378
3454
  }
3379
- if (command === "list") {
3455
+ if (command === "list-actions") {
3380
3456
  await cmdList(values.json, values.summary);
3381
3457
  return;
3382
3458
  }
@@ -3387,11 +3463,11 @@ async function main() {
3387
3463
  });
3388
3464
  return;
3389
3465
  }
3390
- if (command === "run") {
3466
+ if (command === "run-agent") {
3391
3467
  const appId = positionals[1];
3392
3468
  if (!appId)
3393
- fatal("Missing app ID. Usage: mindstudio run <appId> [json | --flags]");
3394
- const runArgv = process.argv.slice(process.argv.indexOf("run") + 2);
3469
+ fatal("Missing app ID. Usage: mindstudio run-agent <appId> [json | --flags]");
3470
+ const runArgv = process.argv.slice(process.argv.indexOf("run-agent") + 2);
3395
3471
  const stepArgs = [];
3396
3472
  for (let i = 0; i < runArgv.length; i++) {
3397
3473
  const arg = runArgv[i];
@@ -3446,6 +3522,89 @@ async function main() {
3446
3522
  });
3447
3523
  return;
3448
3524
  }
3525
+ if (command === "list-models" || command === "list-models-by-type" || command === "list-models-summary" || command === "list-models-summary-by-type") {
3526
+ const authOpts = {
3527
+ apiKey: values["api-key"],
3528
+ baseUrl: values["base-url"]
3529
+ };
3530
+ let type;
3531
+ let summary = false;
3532
+ if (command === "list-models-by-type" || command === "list-models-summary-by-type") {
3533
+ type = positionals[1];
3534
+ if (!type)
3535
+ fatal(`Missing model type. Usage: mindstudio ${command} <type>`);
3536
+ }
3537
+ if (command === "list-models-summary" || command === "list-models-summary-by-type") {
3538
+ summary = true;
3539
+ }
3540
+ if (command === "list-models") {
3541
+ const typeFlag = values.type;
3542
+ if (typeFlag) type = typeFlag;
3543
+ if (values.summary) summary = true;
3544
+ }
3545
+ await cmdListModels({ ...authOpts, type, summary });
3546
+ return;
3547
+ }
3548
+ if (command === "list-connectors") {
3549
+ await cmdListConnectors(positionals.slice(1), {
3550
+ apiKey: values["api-key"],
3551
+ baseUrl: values["base-url"]
3552
+ });
3553
+ return;
3554
+ }
3555
+ if (command === "list-connections") {
3556
+ await cmdListConnections({
3557
+ apiKey: values["api-key"],
3558
+ baseUrl: values["base-url"]
3559
+ });
3560
+ return;
3561
+ }
3562
+ if (command === "estimate-cost") {
3563
+ const stepMethod = positionals[1];
3564
+ if (!stepMethod)
3565
+ fatal(
3566
+ "Missing action name. Usage: mindstudio estimate-cost <action> [json | --flags]"
3567
+ );
3568
+ const costArgv = positionals.slice(2);
3569
+ let costInput;
3570
+ const firstArg = costArgv[0];
3571
+ if (firstArg && firstArg.startsWith("{")) {
3572
+ try {
3573
+ costInput = parseJson5(firstArg);
3574
+ } catch {
3575
+ fatal(`Invalid JSON input: ${firstArg}`);
3576
+ }
3577
+ } else {
3578
+ costInput = parseStepFlags(costArgv);
3579
+ }
3580
+ await cmdEstimateStepCost(stepMethod, costInput, {
3581
+ apiKey: values["api-key"],
3582
+ baseUrl: values["base-url"]
3583
+ });
3584
+ return;
3585
+ }
3586
+ if (command === "change-name") {
3587
+ const name = positionals[1];
3588
+ if (!name)
3589
+ fatal("Missing name. Usage: mindstudio change-name <name>");
3590
+ await cmdChangeName(name, {
3591
+ apiKey: values["api-key"],
3592
+ baseUrl: values["base-url"]
3593
+ });
3594
+ return;
3595
+ }
3596
+ if (command === "change-profile-picture") {
3597
+ const url = positionals[1];
3598
+ if (!url)
3599
+ fatal(
3600
+ "Missing URL. Usage: mindstudio change-profile-picture <url>"
3601
+ );
3602
+ await cmdChangeProfilePicture(url, {
3603
+ apiKey: values["api-key"],
3604
+ baseUrl: values["base-url"]
3605
+ });
3606
+ return;
3607
+ }
3449
3608
  if (command === "mcp") {
3450
3609
  const { startMcpServer: startMcpServer2 } = await Promise.resolve().then(() => (init_mcp(), mcp_exports));
3451
3610
  await startMcpServer2({
@@ -3457,13 +3616,13 @@ async function main() {
3457
3616
  if (command === "info") {
3458
3617
  const rawMethod2 = positionals[1];
3459
3618
  if (!rawMethod2)
3460
- fatal("Missing method name. Usage: mindstudio info <method>");
3619
+ fatal("Missing action name. Usage: mindstudio info <action>");
3461
3620
  await cmdInfo(rawMethod2);
3462
3621
  return;
3463
3622
  }
3464
3623
  const split = findMethodSplit(process.argv.slice(2));
3465
3624
  if (!split)
3466
- fatal("Missing method name. Usage: mindstudio <method> [json | --flags]");
3625
+ fatal("Missing action name. Usage: mindstudio <action> [json | --flags]");
3467
3626
  const { rawMethod, stepArgv } = split;
3468
3627
  const allKeys = await getAllMethodKeys();
3469
3628
  const method = resolveMethodOrFail(rawMethod, allKeys);