@mindstudio-ai/agent 0.1.3 → 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 +443 -284
- package/dist/index.d.ts +183 -213
- package/dist/index.js +160 -54
- package/dist/index.js.map +1 -1
- package/dist/postinstall.js +444 -285
- package/llms.txt +15 -15
- package/package.json +1 -1
package/dist/postinstall.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
|
|
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.
|
|
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 `
|
|
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 === "
|
|
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 === "
|
|
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
|
|
2281
|
-
getConnector: "Get details for
|
|
2282
|
-
getConnectorAction: "Get full configuration for
|
|
2283
|
-
listConnections: "List OAuth connections for the organization.",
|
|
2284
|
-
estimateStepCost: "Estimate the cost of executing
|
|
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: "
|
|
2294
|
-
description: "List all available
|
|
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
|
|
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: "
|
|
2390
|
-
description: "Estimate the cost of executing
|
|
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
|
|
2492
|
+
description: 'The action type name (e.g. "generateText").'
|
|
2397
2493
|
},
|
|
2398
2494
|
step: {
|
|
2399
2495
|
type: "object",
|
|
2400
|
-
description: "The
|
|
2496
|
+
description: "The action input parameters.",
|
|
2401
2497
|
additionalProperties: true
|
|
2402
2498
|
},
|
|
2403
2499
|
appId: {
|
|
@@ -2570,21 +2666,18 @@ function resolveMethodOrFail(name, metadataKeys) {
|
|
|
2570
2666
|
}
|
|
2571
2667
|
const suggestion = bestDist <= 3 ? ` Did you mean '${bestMatch}'?` : "";
|
|
2572
2668
|
fatal(
|
|
2573
|
-
`Unknown
|
|
2669
|
+
`Unknown action: ${name}.${suggestion} Run 'mindstudio list-actions' to see available actions.`
|
|
2574
2670
|
);
|
|
2575
2671
|
}
|
|
2576
2672
|
async function getAllMethodKeys() {
|
|
2577
2673
|
const { stepMetadata: stepMetadata2 } = await Promise.resolve().then(() => (init_metadata(), metadata_exports));
|
|
2578
|
-
return
|
|
2674
|
+
return new Set(Object.keys(stepMetadata2));
|
|
2579
2675
|
}
|
|
2580
2676
|
function buildSummary(stepMetadata2) {
|
|
2581
2677
|
const summary = {};
|
|
2582
2678
|
for (const [name, meta] of Object.entries(stepMetadata2)) {
|
|
2583
2679
|
summary[name] = meta.description;
|
|
2584
2680
|
}
|
|
2585
|
-
for (const [name, desc] of Object.entries(HELPER_DESCRIPTIONS2)) {
|
|
2586
|
-
summary[name] = desc;
|
|
2587
|
-
}
|
|
2588
2681
|
return summary;
|
|
2589
2682
|
}
|
|
2590
2683
|
async function cmdList(asJson, asSummary) {
|
|
@@ -2619,79 +2712,6 @@ async function cmdList(asJson, asSummary) {
|
|
|
2619
2712
|
async function cmdInfo(rawMethod) {
|
|
2620
2713
|
const allKeys = await getAllMethodKeys();
|
|
2621
2714
|
const method = resolveMethodOrFail(rawMethod, allKeys);
|
|
2622
|
-
if (HELPER_NAMES.has(method)) {
|
|
2623
|
-
const helpers = {
|
|
2624
|
-
listModels: {
|
|
2625
|
-
desc: "List all available AI models.",
|
|
2626
|
-
input: "(none)",
|
|
2627
|
-
output: "{ models: MindStudioModel[] }"
|
|
2628
|
-
},
|
|
2629
|
-
listModelsByType: {
|
|
2630
|
-
desc: "List AI models filtered by type.",
|
|
2631
|
-
input: "modelType: string (required)",
|
|
2632
|
-
output: "{ models: MindStudioModel[] }"
|
|
2633
|
-
},
|
|
2634
|
-
listModelsSummary: {
|
|
2635
|
-
desc: "List all AI models (summary: id, name, type, tags).",
|
|
2636
|
-
input: "(none)",
|
|
2637
|
-
output: "{ models: MindStudioModelSummary[] }"
|
|
2638
|
-
},
|
|
2639
|
-
listModelsSummaryByType: {
|
|
2640
|
-
desc: "List AI models (summary) filtered by type.",
|
|
2641
|
-
input: "modelType: string (required)",
|
|
2642
|
-
output: "{ models: MindStudioModelSummary[] }"
|
|
2643
|
-
},
|
|
2644
|
-
listConnectors: {
|
|
2645
|
-
desc: "List available connector services and their actions.",
|
|
2646
|
-
input: "(none)",
|
|
2647
|
-
output: "{ services: ConnectorService[] }"
|
|
2648
|
-
},
|
|
2649
|
-
getConnector: {
|
|
2650
|
-
desc: "Get details for a connector service.",
|
|
2651
|
-
input: "serviceId: string (required)",
|
|
2652
|
-
output: "{ service: ConnectorService }"
|
|
2653
|
-
},
|
|
2654
|
-
getConnectorAction: {
|
|
2655
|
-
desc: "Get full configuration for a connector action.",
|
|
2656
|
-
input: "serviceId: string, actionId: string (both required)",
|
|
2657
|
-
output: "{ action: ConnectorActionDetail }"
|
|
2658
|
-
},
|
|
2659
|
-
listConnections: {
|
|
2660
|
-
desc: "List OAuth connections for the organization.",
|
|
2661
|
-
input: "(none)",
|
|
2662
|
-
output: "{ connections: Connection[] }"
|
|
2663
|
-
},
|
|
2664
|
-
estimateStepCost: {
|
|
2665
|
-
desc: "Estimate the cost of executing a step before running it.",
|
|
2666
|
-
input: "stepType: string (required), step: object, appId?: string, workflowId?: string",
|
|
2667
|
-
output: "{ costType?: string, estimates?: StepCostEstimateEntry[] }"
|
|
2668
|
-
},
|
|
2669
|
-
changeName: {
|
|
2670
|
-
desc: "Update the display name of the authenticated agent.",
|
|
2671
|
-
input: "displayName: string (required)",
|
|
2672
|
-
output: "(none)"
|
|
2673
|
-
},
|
|
2674
|
-
changeProfilePicture: {
|
|
2675
|
-
desc: "Update the profile picture of the authenticated agent.",
|
|
2676
|
-
input: "profilePictureUrl: string (required)",
|
|
2677
|
-
output: "(none)"
|
|
2678
|
-
}
|
|
2679
|
-
};
|
|
2680
|
-
const h = helpers[method];
|
|
2681
|
-
process.stderr.write(`
|
|
2682
|
-
${camelToKebab(method)}
|
|
2683
|
-
|
|
2684
|
-
`);
|
|
2685
|
-
process.stderr.write(` ${h.desc}
|
|
2686
|
-
|
|
2687
|
-
`);
|
|
2688
|
-
process.stderr.write(` Input: ${h.input}
|
|
2689
|
-
`);
|
|
2690
|
-
process.stderr.write(` Output: ${h.output}
|
|
2691
|
-
|
|
2692
|
-
`);
|
|
2693
|
-
return;
|
|
2694
|
-
}
|
|
2695
2715
|
const { stepMetadata: stepMetadata2 } = await Promise.resolve().then(() => (init_metadata(), metadata_exports));
|
|
2696
2716
|
const meta = stepMetadata2[method];
|
|
2697
2717
|
const out = [];
|
|
@@ -2747,61 +2767,21 @@ async function cmdExec(method, input, options) {
|
|
|
2747
2767
|
await Promise.resolve().then(() => (init_steps(), steps_exports)).then(
|
|
2748
2768
|
(m) => m.applyStepMethods(MindStudioAgent2)
|
|
2749
2769
|
);
|
|
2750
|
-
await Promise.resolve().then(() => (init_helpers(), helpers_exports)).then(
|
|
2751
|
-
(m) => m.applyHelperMethods(MindStudioAgent2)
|
|
2752
|
-
);
|
|
2753
2770
|
const agent = new MindStudioAgent2({
|
|
2754
2771
|
apiKey: options.apiKey,
|
|
2755
2772
|
baseUrl: options.baseUrl
|
|
2756
2773
|
});
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
} else if (method === "listModelsSummary") {
|
|
2763
|
-
result = await agent.listModelsSummary();
|
|
2764
|
-
} else if (method === "listModelsSummaryByType") {
|
|
2765
|
-
result = await agent.listModelsSummaryByType(input.modelType);
|
|
2766
|
-
} else if (method === "listConnectors") {
|
|
2767
|
-
result = await agent.listConnectors();
|
|
2768
|
-
} else if (method === "getConnector") {
|
|
2769
|
-
result = await agent.getConnector(input.serviceId);
|
|
2770
|
-
} else if (method === "getConnectorAction") {
|
|
2771
|
-
result = await agent.getConnectorAction(
|
|
2772
|
-
input.serviceId,
|
|
2773
|
-
input.actionId
|
|
2774
|
-
);
|
|
2775
|
-
} else if (method === "listConnections") {
|
|
2776
|
-
result = await agent.listConnections();
|
|
2777
|
-
} else if (method === "estimateStepCost") {
|
|
2778
|
-
result = await agent.estimateStepCost(
|
|
2779
|
-
input.stepType,
|
|
2780
|
-
input.step,
|
|
2781
|
-
{
|
|
2782
|
-
appId: input.appId,
|
|
2783
|
-
workflowId: input.workflowId
|
|
2784
|
-
}
|
|
2774
|
+
const { stepMetadata: stepMetadata2 } = await Promise.resolve().then(() => (init_metadata(), metadata_exports));
|
|
2775
|
+
const meta = stepMetadata2[method];
|
|
2776
|
+
if (!meta) {
|
|
2777
|
+
fatal(
|
|
2778
|
+
`Unknown action: ${method}. Run 'mindstudio list-actions' to see available actions.`
|
|
2785
2779
|
);
|
|
2786
|
-
} else if (method === "changeName") {
|
|
2787
|
-
await agent.changeName(input.displayName);
|
|
2788
|
-
result = { success: true };
|
|
2789
|
-
} else if (method === "changeProfilePicture") {
|
|
2790
|
-
await agent.changeProfilePicture(input.profilePictureUrl);
|
|
2791
|
-
result = { success: true };
|
|
2792
|
-
} else {
|
|
2793
|
-
const { stepMetadata: stepMetadata2 } = await Promise.resolve().then(() => (init_metadata(), metadata_exports));
|
|
2794
|
-
const meta = stepMetadata2[method];
|
|
2795
|
-
if (!meta) {
|
|
2796
|
-
fatal(
|
|
2797
|
-
`Unknown method: ${method}. Run 'mindstudio list' to see available methods.`
|
|
2798
|
-
);
|
|
2799
|
-
}
|
|
2800
|
-
result = await agent.executeStep(meta.stepType, input, {
|
|
2801
|
-
appId: options.appId,
|
|
2802
|
-
threadId: options.threadId
|
|
2803
|
-
});
|
|
2804
2780
|
}
|
|
2781
|
+
const result = await agent.executeStep(meta.stepType, input, {
|
|
2782
|
+
appId: options.appId,
|
|
2783
|
+
threadId: options.threadId
|
|
2784
|
+
});
|
|
2805
2785
|
if (options.outputKey) {
|
|
2806
2786
|
const val = result[options.outputKey];
|
|
2807
2787
|
if (typeof val === "string") {
|
|
@@ -2848,6 +2828,62 @@ async function cmdAgents(asJson, options) {
|
|
|
2848
2828
|
}
|
|
2849
2829
|
}
|
|
2850
2830
|
}
|
|
2831
|
+
function createAgent(options) {
|
|
2832
|
+
return Promise.resolve().then(() => (init_client(), client_exports)).then(
|
|
2833
|
+
({ MindStudioAgent: MindStudioAgent2 }) => new MindStudioAgent2({
|
|
2834
|
+
apiKey: options.apiKey,
|
|
2835
|
+
baseUrl: options.baseUrl
|
|
2836
|
+
})
|
|
2837
|
+
);
|
|
2838
|
+
}
|
|
2839
|
+
function jsonOut(data) {
|
|
2840
|
+
process.stdout.write(JSON.stringify(data, null, 2) + "\n");
|
|
2841
|
+
}
|
|
2842
|
+
async function cmdListModels(options) {
|
|
2843
|
+
const agent = await createAgent(options);
|
|
2844
|
+
if (options.summary) {
|
|
2845
|
+
const result = options.type ? await agent.listModelsSummaryByType(options.type) : await agent.listModelsSummary();
|
|
2846
|
+
jsonOut(result);
|
|
2847
|
+
} else {
|
|
2848
|
+
const result = options.type ? await agent.listModelsByType(options.type) : await agent.listModels();
|
|
2849
|
+
jsonOut(result);
|
|
2850
|
+
}
|
|
2851
|
+
}
|
|
2852
|
+
async function cmdListConnectors(args, options) {
|
|
2853
|
+
const agent = await createAgent(options);
|
|
2854
|
+
if (args.length >= 2) {
|
|
2855
|
+
const result = await agent.getConnectorAction(args[0], args[1]);
|
|
2856
|
+
jsonOut(result);
|
|
2857
|
+
} else if (args.length === 1) {
|
|
2858
|
+
const result = await agent.getConnector(args[0]);
|
|
2859
|
+
jsonOut(result);
|
|
2860
|
+
} else {
|
|
2861
|
+
const result = await agent.listConnectors();
|
|
2862
|
+
jsonOut(result);
|
|
2863
|
+
}
|
|
2864
|
+
}
|
|
2865
|
+
async function cmdListConnections(options) {
|
|
2866
|
+
const agent = await createAgent(options);
|
|
2867
|
+
const result = await agent.listConnections();
|
|
2868
|
+
jsonOut(result);
|
|
2869
|
+
}
|
|
2870
|
+
async function cmdEstimateStepCost(method, input, options) {
|
|
2871
|
+
const agent = await createAgent(options);
|
|
2872
|
+
const result = await agent.estimateStepCost(method, input);
|
|
2873
|
+
jsonOut(result);
|
|
2874
|
+
}
|
|
2875
|
+
async function cmdChangeName(name, options) {
|
|
2876
|
+
const agent = await createAgent(options);
|
|
2877
|
+
await agent.changeName(name);
|
|
2878
|
+
process.stderr.write(` Display name updated to: ${name}
|
|
2879
|
+
`);
|
|
2880
|
+
}
|
|
2881
|
+
async function cmdChangeProfilePicture(url, options) {
|
|
2882
|
+
const agent = await createAgent(options);
|
|
2883
|
+
await agent.changeProfilePicture(url);
|
|
2884
|
+
process.stderr.write(` Profile picture updated.
|
|
2885
|
+
`);
|
|
2886
|
+
}
|
|
2851
2887
|
async function cmdRun(appId, variables, options) {
|
|
2852
2888
|
const { MindStudioAgent: MindStudioAgent2 } = await Promise.resolve().then(() => (init_client(), client_exports));
|
|
2853
2889
|
const agent = new MindStudioAgent2({
|
|
@@ -2884,9 +2920,6 @@ async function cmdUpload(filePath, options) {
|
|
|
2884
2920
|
const content = readFileSync3(filePath);
|
|
2885
2921
|
const mimeType = MIME_TYPES2[ext];
|
|
2886
2922
|
const { MindStudioAgent: MindStudioAgent2 } = await Promise.resolve().then(() => (init_client(), client_exports));
|
|
2887
|
-
await Promise.resolve().then(() => (init_helpers(), helpers_exports)).then(
|
|
2888
|
-
(m) => m.applyHelperMethods(MindStudioAgent2)
|
|
2889
|
-
);
|
|
2890
2923
|
const agent = new MindStudioAgent2({
|
|
2891
2924
|
apiKey: options.apiKey,
|
|
2892
2925
|
baseUrl: options.baseUrl
|
|
@@ -2909,7 +2942,7 @@ function isNewerVersion(current, latest) {
|
|
|
2909
2942
|
return false;
|
|
2910
2943
|
}
|
|
2911
2944
|
async function checkForUpdate() {
|
|
2912
|
-
const currentVersion = "0.1.
|
|
2945
|
+
const currentVersion = "0.1.5";
|
|
2913
2946
|
if (!currentVersion) return null;
|
|
2914
2947
|
try {
|
|
2915
2948
|
const { loadConfig: loadConfig2, saveConfig: saveConfig2 } = await Promise.resolve().then(() => (init_config(), config_exports));
|
|
@@ -2938,7 +2971,7 @@ async function checkForUpdate() {
|
|
|
2938
2971
|
}
|
|
2939
2972
|
}
|
|
2940
2973
|
function printUpdateNotice(latestVersion) {
|
|
2941
|
-
const currentVersion = "0.1.
|
|
2974
|
+
const currentVersion = "0.1.5";
|
|
2942
2975
|
process.stderr.write(
|
|
2943
2976
|
`
|
|
2944
2977
|
${ansi.cyanBright("Update available")} ${ansi.gray(currentVersion + " \u2192")} ${ansi.cyanBold(latestVersion)}
|
|
@@ -2989,10 +3022,11 @@ function maskKey(key) {
|
|
|
2989
3022
|
}
|
|
2990
3023
|
async function cmdLogin(options) {
|
|
2991
3024
|
const baseUrl = options.baseUrl ?? process.env.MINDSTUDIO_BASE_URL ?? process.env.REMOTE_HOSTNAME ?? DEFAULT_BASE_URL2;
|
|
3025
|
+
process.stderr.write("\x1B[2J\x1B[H");
|
|
2992
3026
|
process.stderr.write("\n");
|
|
2993
3027
|
printLogo();
|
|
2994
3028
|
process.stderr.write("\n");
|
|
2995
|
-
const ver = "0.1.
|
|
3029
|
+
const ver = "0.1.5";
|
|
2996
3030
|
process.stderr.write(
|
|
2997
3031
|
` ${ansi.bold("MindStudio Agent")} ${ver ? " " + ansi.gray("v" + ver) : ""}
|
|
2998
3032
|
`
|
|
@@ -3141,11 +3175,62 @@ async function cmdWhoami(options) {
|
|
|
3141
3175
|
apiKey: options.apiKey,
|
|
3142
3176
|
baseUrl: options.baseUrl
|
|
3143
3177
|
});
|
|
3144
|
-
const
|
|
3178
|
+
const info = await agent.getUserInfo();
|
|
3179
|
+
process.stderr.write(
|
|
3180
|
+
`\r\x1B[K ${ansi.greenBold("\u25CF")} ${ansi.green("Connected")}
|
|
3181
|
+
|
|
3182
|
+
`
|
|
3183
|
+
);
|
|
3184
|
+
process.stderr.write(` ${ansi.bold("User")}
|
|
3185
|
+
`);
|
|
3145
3186
|
process.stderr.write(
|
|
3146
|
-
|
|
3187
|
+
` ${ansi.gray("Name:")} ${info.displayName}
|
|
3147
3188
|
`
|
|
3148
3189
|
);
|
|
3190
|
+
process.stderr.write(
|
|
3191
|
+
` ${ansi.gray("ID:")} ${ansi.gray(info.userId)}
|
|
3192
|
+
`
|
|
3193
|
+
);
|
|
3194
|
+
process.stderr.write(`
|
|
3195
|
+
${ansi.bold("Organization")}
|
|
3196
|
+
`);
|
|
3197
|
+
process.stderr.write(
|
|
3198
|
+
` ${ansi.gray("Name:")} ${info.organizationName}
|
|
3199
|
+
`
|
|
3200
|
+
);
|
|
3201
|
+
process.stderr.write(
|
|
3202
|
+
` ${ansi.gray("ID:")} ${ansi.gray(info.organizationId)}
|
|
3203
|
+
`
|
|
3204
|
+
);
|
|
3205
|
+
if (info.members && info.members.length > 0) {
|
|
3206
|
+
process.stderr.write(`
|
|
3207
|
+
${ansi.bold("Members")}
|
|
3208
|
+
`);
|
|
3209
|
+
const nameWidth = Math.max(
|
|
3210
|
+
4,
|
|
3211
|
+
...info.members.map((m) => m.displayName.length)
|
|
3212
|
+
);
|
|
3213
|
+
const roleWidth = Math.max(
|
|
3214
|
+
4,
|
|
3215
|
+
...info.members.map((m) => m.role.length)
|
|
3216
|
+
);
|
|
3217
|
+
process.stderr.write(
|
|
3218
|
+
` ${ansi.gray("Name".padEnd(nameWidth))} ${ansi.gray("Role".padEnd(roleWidth))} ${ansi.gray("Type")}
|
|
3219
|
+
`
|
|
3220
|
+
);
|
|
3221
|
+
process.stderr.write(
|
|
3222
|
+
` ${ansi.gray("\u2500".repeat(nameWidth))} ${ansi.gray("\u2500".repeat(roleWidth))} ${ansi.gray("\u2500".repeat(5))}
|
|
3223
|
+
`
|
|
3224
|
+
);
|
|
3225
|
+
for (const member of info.members) {
|
|
3226
|
+
const type = member.isAgent ? ansi.cyan("agent") : "user";
|
|
3227
|
+
process.stderr.write(
|
|
3228
|
+
` ${member.displayName.padEnd(nameWidth)} ${ansi.gray(member.role.padEnd(roleWidth))} ${type}
|
|
3229
|
+
`
|
|
3230
|
+
);
|
|
3231
|
+
}
|
|
3232
|
+
}
|
|
3233
|
+
process.stderr.write("\n");
|
|
3149
3234
|
} catch (err) {
|
|
3150
3235
|
const message = err instanceof Error ? err.message : String(err);
|
|
3151
3236
|
process.stderr.write(
|
|
@@ -3167,15 +3252,15 @@ function parseStepFlags(argv) {
|
|
|
3167
3252
|
}
|
|
3168
3253
|
function findMethodSplit(argv) {
|
|
3169
3254
|
let startIdx = 0;
|
|
3170
|
-
let
|
|
3255
|
+
let hasRun = false;
|
|
3171
3256
|
for (let i = 0; i < argv.length; i++) {
|
|
3172
3257
|
const arg = argv[i];
|
|
3173
3258
|
if (arg.startsWith("--")) {
|
|
3174
3259
|
if (GLOBAL_STRING_FLAGS.has(arg)) i++;
|
|
3175
3260
|
continue;
|
|
3176
3261
|
}
|
|
3177
|
-
if (arg === "
|
|
3178
|
-
|
|
3262
|
+
if (arg === "run") {
|
|
3263
|
+
hasRun = true;
|
|
3179
3264
|
startIdx = i + 1;
|
|
3180
3265
|
} else {
|
|
3181
3266
|
startIdx = i;
|
|
@@ -3188,7 +3273,7 @@ function findMethodSplit(argv) {
|
|
|
3188
3273
|
if (GLOBAL_STRING_FLAGS.has(arg)) i++;
|
|
3189
3274
|
continue;
|
|
3190
3275
|
}
|
|
3191
|
-
if (
|
|
3276
|
+
if (hasRun || i === startIdx) {
|
|
3192
3277
|
return { rawMethod: arg, stepArgv: argv.slice(i + 1) };
|
|
3193
3278
|
}
|
|
3194
3279
|
break;
|
|
@@ -3209,6 +3294,7 @@ async function main() {
|
|
|
3209
3294
|
"no-meta": { type: "boolean", default: false },
|
|
3210
3295
|
workflow: { type: "string" },
|
|
3211
3296
|
version: { type: "string" },
|
|
3297
|
+
type: { type: "string" },
|
|
3212
3298
|
json: { type: "boolean", default: false },
|
|
3213
3299
|
summary: { type: "boolean", default: false },
|
|
3214
3300
|
help: { type: "boolean", default: false }
|
|
@@ -3253,7 +3339,7 @@ async function main() {
|
|
|
3253
3339
|
});
|
|
3254
3340
|
return;
|
|
3255
3341
|
}
|
|
3256
|
-
if (command === "list") {
|
|
3342
|
+
if (command === "list-actions") {
|
|
3257
3343
|
await cmdList(values.json, values.summary);
|
|
3258
3344
|
return;
|
|
3259
3345
|
}
|
|
@@ -3264,11 +3350,11 @@ async function main() {
|
|
|
3264
3350
|
});
|
|
3265
3351
|
return;
|
|
3266
3352
|
}
|
|
3267
|
-
if (command === "run") {
|
|
3353
|
+
if (command === "run-agent") {
|
|
3268
3354
|
const appId = positionals[1];
|
|
3269
3355
|
if (!appId)
|
|
3270
|
-
fatal("Missing app ID. Usage: mindstudio run <appId> [json | --flags]");
|
|
3271
|
-
const runArgv = process.argv.slice(process.argv.indexOf("run") + 2);
|
|
3356
|
+
fatal("Missing app ID. Usage: mindstudio run-agent <appId> [json | --flags]");
|
|
3357
|
+
const runArgv = process.argv.slice(process.argv.indexOf("run-agent") + 2);
|
|
3272
3358
|
const stepArgs = [];
|
|
3273
3359
|
for (let i = 0; i < runArgv.length; i++) {
|
|
3274
3360
|
const arg = runArgv[i];
|
|
@@ -3323,6 +3409,89 @@ async function main() {
|
|
|
3323
3409
|
});
|
|
3324
3410
|
return;
|
|
3325
3411
|
}
|
|
3412
|
+
if (command === "list-models" || command === "list-models-by-type" || command === "list-models-summary" || command === "list-models-summary-by-type") {
|
|
3413
|
+
const authOpts = {
|
|
3414
|
+
apiKey: values["api-key"],
|
|
3415
|
+
baseUrl: values["base-url"]
|
|
3416
|
+
};
|
|
3417
|
+
let type;
|
|
3418
|
+
let summary = false;
|
|
3419
|
+
if (command === "list-models-by-type" || command === "list-models-summary-by-type") {
|
|
3420
|
+
type = positionals[1];
|
|
3421
|
+
if (!type)
|
|
3422
|
+
fatal(`Missing model type. Usage: mindstudio ${command} <type>`);
|
|
3423
|
+
}
|
|
3424
|
+
if (command === "list-models-summary" || command === "list-models-summary-by-type") {
|
|
3425
|
+
summary = true;
|
|
3426
|
+
}
|
|
3427
|
+
if (command === "list-models") {
|
|
3428
|
+
const typeFlag = values.type;
|
|
3429
|
+
if (typeFlag) type = typeFlag;
|
|
3430
|
+
if (values.summary) summary = true;
|
|
3431
|
+
}
|
|
3432
|
+
await cmdListModels({ ...authOpts, type, summary });
|
|
3433
|
+
return;
|
|
3434
|
+
}
|
|
3435
|
+
if (command === "list-connectors") {
|
|
3436
|
+
await cmdListConnectors(positionals.slice(1), {
|
|
3437
|
+
apiKey: values["api-key"],
|
|
3438
|
+
baseUrl: values["base-url"]
|
|
3439
|
+
});
|
|
3440
|
+
return;
|
|
3441
|
+
}
|
|
3442
|
+
if (command === "list-connections") {
|
|
3443
|
+
await cmdListConnections({
|
|
3444
|
+
apiKey: values["api-key"],
|
|
3445
|
+
baseUrl: values["base-url"]
|
|
3446
|
+
});
|
|
3447
|
+
return;
|
|
3448
|
+
}
|
|
3449
|
+
if (command === "estimate-cost") {
|
|
3450
|
+
const stepMethod = positionals[1];
|
|
3451
|
+
if (!stepMethod)
|
|
3452
|
+
fatal(
|
|
3453
|
+
"Missing action name. Usage: mindstudio estimate-cost <action> [json | --flags]"
|
|
3454
|
+
);
|
|
3455
|
+
const costArgv = positionals.slice(2);
|
|
3456
|
+
let costInput;
|
|
3457
|
+
const firstArg = costArgv[0];
|
|
3458
|
+
if (firstArg && firstArg.startsWith("{")) {
|
|
3459
|
+
try {
|
|
3460
|
+
costInput = parseJson5(firstArg);
|
|
3461
|
+
} catch {
|
|
3462
|
+
fatal(`Invalid JSON input: ${firstArg}`);
|
|
3463
|
+
}
|
|
3464
|
+
} else {
|
|
3465
|
+
costInput = parseStepFlags(costArgv);
|
|
3466
|
+
}
|
|
3467
|
+
await cmdEstimateStepCost(stepMethod, costInput, {
|
|
3468
|
+
apiKey: values["api-key"],
|
|
3469
|
+
baseUrl: values["base-url"]
|
|
3470
|
+
});
|
|
3471
|
+
return;
|
|
3472
|
+
}
|
|
3473
|
+
if (command === "change-name") {
|
|
3474
|
+
const name = positionals[1];
|
|
3475
|
+
if (!name)
|
|
3476
|
+
fatal("Missing name. Usage: mindstudio change-name <name>");
|
|
3477
|
+
await cmdChangeName(name, {
|
|
3478
|
+
apiKey: values["api-key"],
|
|
3479
|
+
baseUrl: values["base-url"]
|
|
3480
|
+
});
|
|
3481
|
+
return;
|
|
3482
|
+
}
|
|
3483
|
+
if (command === "change-profile-picture") {
|
|
3484
|
+
const url = positionals[1];
|
|
3485
|
+
if (!url)
|
|
3486
|
+
fatal(
|
|
3487
|
+
"Missing URL. Usage: mindstudio change-profile-picture <url>"
|
|
3488
|
+
);
|
|
3489
|
+
await cmdChangeProfilePicture(url, {
|
|
3490
|
+
apiKey: values["api-key"],
|
|
3491
|
+
baseUrl: values["base-url"]
|
|
3492
|
+
});
|
|
3493
|
+
return;
|
|
3494
|
+
}
|
|
3326
3495
|
if (command === "mcp") {
|
|
3327
3496
|
const { startMcpServer: startMcpServer2 } = await Promise.resolve().then(() => (init_mcp(), mcp_exports));
|
|
3328
3497
|
await startMcpServer2({
|
|
@@ -3334,13 +3503,13 @@ async function main() {
|
|
|
3334
3503
|
if (command === "info") {
|
|
3335
3504
|
const rawMethod2 = positionals[1];
|
|
3336
3505
|
if (!rawMethod2)
|
|
3337
|
-
fatal("Missing
|
|
3506
|
+
fatal("Missing action name. Usage: mindstudio info <action>");
|
|
3338
3507
|
await cmdInfo(rawMethod2);
|
|
3339
3508
|
return;
|
|
3340
3509
|
}
|
|
3341
3510
|
const split = findMethodSplit(process.argv.slice(2));
|
|
3342
3511
|
if (!split)
|
|
3343
|
-
fatal("Missing
|
|
3512
|
+
fatal("Missing action name. Usage: mindstudio <action> [json | --flags]");
|
|
3344
3513
|
const { rawMethod, stepArgv } = split;
|
|
3345
3514
|
const allKeys = await getAllMethodKeys();
|
|
3346
3515
|
const method = resolveMethodOrFail(rawMethod, allKeys);
|
|
@@ -3383,78 +3552,68 @@ async function main() {
|
|
|
3383
3552
|
if (latestVersion) printUpdateNotice(latestVersion);
|
|
3384
3553
|
}
|
|
3385
3554
|
}
|
|
3386
|
-
var HELP,
|
|
3555
|
+
var HELP, MIME_TYPES2, ansi, UPDATE_CHECK_INTERVAL, LOGO, DEFAULT_BASE_URL2, SPINNER_FRAMES, GLOBAL_STRING_FLAGS;
|
|
3387
3556
|
var init_cli = __esm({
|
|
3388
3557
|
"src/cli.ts"() {
|
|
3389
3558
|
"use strict";
|
|
3390
|
-
HELP = `Usage: mindstudio <command
|
|
3559
|
+
HELP = `Usage: mindstudio <command> [options]
|
|
3560
|
+
|
|
3561
|
+
Run actions:
|
|
3562
|
+
<action> [json | --flags] Run an action directly
|
|
3563
|
+
run <action> [json | --flags] Run an action (explicit form)
|
|
3564
|
+
estimate-cost <action> [json] Estimate cost before running
|
|
3391
3565
|
|
|
3392
|
-
|
|
3393
|
-
|
|
3394
|
-
|
|
3395
|
-
|
|
3396
|
-
|
|
3397
|
-
|
|
3398
|
-
|
|
3399
|
-
|
|
3400
|
-
|
|
3401
|
-
|
|
3402
|
-
|
|
3403
|
-
|
|
3566
|
+
Discover:
|
|
3567
|
+
list-actions [--json] [--summary] List all available actions
|
|
3568
|
+
info <action> Show action details and parameters
|
|
3569
|
+
list-models [--type <t>] [--summary] List available AI models
|
|
3570
|
+
|
|
3571
|
+
Pre-built agents:
|
|
3572
|
+
agents [--json] List agents in your organization
|
|
3573
|
+
run-agent <appId> [json | --flags] Run an agent and wait for result
|
|
3574
|
+
|
|
3575
|
+
Account:
|
|
3576
|
+
login Authenticate with MindStudio
|
|
3577
|
+
logout Clear stored credentials
|
|
3578
|
+
whoami Show current user and organization
|
|
3579
|
+
change-name <name> Update your display name
|
|
3580
|
+
change-profile-picture <url> Update your profile picture
|
|
3581
|
+
upload <filepath> Upload a file to the MindStudio CDN
|
|
3582
|
+
|
|
3583
|
+
OAuth integrations:
|
|
3584
|
+
list-connectors [<id> [<actionId>]] Browse OAuth connector services
|
|
3585
|
+
list-connections List your OAuth connections
|
|
3586
|
+
|
|
3587
|
+
Other:
|
|
3588
|
+
mcp Start MCP server (JSON-RPC over stdio)
|
|
3404
3589
|
|
|
3405
3590
|
Options:
|
|
3406
|
-
--api-key <key>
|
|
3407
|
-
--base-url <url>
|
|
3408
|
-
--app-id <id>
|
|
3409
|
-
--thread-id <id>
|
|
3410
|
-
--output-key <key>
|
|
3411
|
-
--no-meta
|
|
3412
|
-
--workflow <name>
|
|
3413
|
-
--version <ver>
|
|
3414
|
-
--json
|
|
3415
|
-
--
|
|
3591
|
+
--api-key <key> API key (or set MINDSTUDIO_API_KEY env var)
|
|
3592
|
+
--base-url <url> API base URL override
|
|
3593
|
+
--app-id <id> App ID for thread context
|
|
3594
|
+
--thread-id <id> Thread ID for state persistence
|
|
3595
|
+
--output-key <key> Extract a single field from the result
|
|
3596
|
+
--no-meta Strip $-prefixed metadata from output
|
|
3597
|
+
--workflow <name> Workflow to execute (run-agent only)
|
|
3598
|
+
--version <ver> App version, e.g. "draft" (run-agent only)
|
|
3599
|
+
--json Output as JSON
|
|
3600
|
+
--summary Compact output (list-actions, list-models)
|
|
3601
|
+
--type <type> Filter by model type (list-models)
|
|
3602
|
+
--help Show this help
|
|
3416
3603
|
|
|
3417
3604
|
Examples:
|
|
3418
|
-
mindstudio login
|
|
3419
3605
|
mindstudio generate-image --prompt "a sunset"
|
|
3420
|
-
mindstudio generate-image --prompt "a sunset" --output-key imageUrl
|
|
3421
3606
|
mindstudio generate-text --message "hello" --no-meta
|
|
3422
|
-
mindstudio generate-image '{"prompt":"a sunset"}'
|
|
3607
|
+
mindstudio generate-image '{"prompt":"a sunset"}' --output-key imageUrl
|
|
3423
3608
|
echo '{"query":"test"}' | mindstudio search-google
|
|
3609
|
+
mindstudio estimate-cost generate-image --prompt "a sunset"
|
|
3610
|
+
mindstudio list-actions --summary
|
|
3424
3611
|
mindstudio info generate-image
|
|
3425
|
-
mindstudio list --
|
|
3612
|
+
mindstudio list-models --type image_generation
|
|
3613
|
+
mindstudio run-agent <appId> --query "hello"
|
|
3426
3614
|
mindstudio agents
|
|
3427
|
-
mindstudio run <appId> --query "hello"
|
|
3428
3615
|
mindstudio mcp
|
|
3429
3616
|
`;
|
|
3430
|
-
HELPER_NAMES = /* @__PURE__ */ new Set([
|
|
3431
|
-
"listModels",
|
|
3432
|
-
"listModelsByType",
|
|
3433
|
-
"listModelsSummary",
|
|
3434
|
-
"listModelsSummaryByType",
|
|
3435
|
-
"listConnectors",
|
|
3436
|
-
"getConnector",
|
|
3437
|
-
"getConnectorAction",
|
|
3438
|
-
"listConnections",
|
|
3439
|
-
"estimateStepCost",
|
|
3440
|
-
"changeName",
|
|
3441
|
-
"changeProfilePicture"
|
|
3442
|
-
]);
|
|
3443
|
-
HELPER_DESCRIPTIONS2 = {
|
|
3444
|
-
listModels: "List all available AI models.",
|
|
3445
|
-
listModelsByType: "List AI models filtered by type.",
|
|
3446
|
-
listModelsSummary: "List all AI models (summary: id, name, type, tags).",
|
|
3447
|
-
listModelsSummaryByType: "List AI models (summary) filtered by type.",
|
|
3448
|
-
listConnectors: "List available connector services and their actions.",
|
|
3449
|
-
getConnector: "Get details for a connector service.",
|
|
3450
|
-
getConnectorAction: "Get full configuration for a connector action.",
|
|
3451
|
-
listConnections: "List OAuth connections for the organization.",
|
|
3452
|
-
estimateStepCost: "Estimate the cost of executing a step before running it.",
|
|
3453
|
-
changeName: "Update the display name of the authenticated agent.",
|
|
3454
|
-
changeProfilePicture: "Update the profile picture of the authenticated agent.",
|
|
3455
|
-
listAgents: "List all pre-built agents in the organization.",
|
|
3456
|
-
runAgent: "Run a pre-built agent and wait for the result."
|
|
3457
|
-
};
|
|
3458
3617
|
MIME_TYPES2 = {
|
|
3459
3618
|
png: "image/png",
|
|
3460
3619
|
jpg: "image/jpeg",
|