@jive-ai/cli 0.0.20 → 0.0.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.mjs +14 -35
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -190,6 +190,9 @@ var ApiClient = class {
|
|
|
190
190
|
async getMcpServers(teamId) {
|
|
191
191
|
return (await this.client.get(`/api/teams/${teamId}/mcp-servers`)).data;
|
|
192
192
|
}
|
|
193
|
+
async callSubagent(teamId, id, prompt) {
|
|
194
|
+
return (await this.client.post(`/api/subagents/${id}/call`, { prompt })).data;
|
|
195
|
+
}
|
|
193
196
|
async createMcpServer(teamId, data) {
|
|
194
197
|
return (await this.client.post(`/api/teams/${teamId}/mcp-servers`, data)).data;
|
|
195
198
|
}
|
|
@@ -1377,16 +1380,15 @@ async function startMcpServer() {
|
|
|
1377
1380
|
process.exit(1);
|
|
1378
1381
|
return;
|
|
1379
1382
|
}
|
|
1380
|
-
|
|
1381
|
-
if (!apiKey) {
|
|
1383
|
+
if (!(await getCredentials())?.token) {
|
|
1382
1384
|
log("Error: No API key found, please login with `jive login`");
|
|
1383
1385
|
process.exit(1);
|
|
1384
1386
|
return;
|
|
1385
1387
|
}
|
|
1386
|
-
|
|
1387
|
-
log(`Jive server connecting to ${apiUrl}`);
|
|
1388
|
+
log(`Jive server connecting to ${API_URL}`);
|
|
1388
1389
|
const connectionManager = new McpConnectionManager();
|
|
1389
|
-
const
|
|
1390
|
+
const apiClient$1 = getApiClient();
|
|
1391
|
+
const mcpServers = await apiClient$1.getMcpServers(teamId);
|
|
1390
1392
|
if (mcpServers.length > 0) await connectionManager.initialize(mcpServers);
|
|
1391
1393
|
else log("No MCP servers configured for this team");
|
|
1392
1394
|
const server = new Server({
|
|
@@ -1503,33 +1505,6 @@ async function startMcpServer() {
|
|
|
1503
1505
|
}
|
|
1504
1506
|
] };
|
|
1505
1507
|
});
|
|
1506
|
-
async function apiRequest(endpoint, body) {
|
|
1507
|
-
const url = `${apiUrl}${endpoint}`;
|
|
1508
|
-
try {
|
|
1509
|
-
const response = await fetch(url, {
|
|
1510
|
-
method: "POST",
|
|
1511
|
-
headers: {
|
|
1512
|
-
"Content-Type": "application/json",
|
|
1513
|
-
"X-API-Key": apiKey
|
|
1514
|
-
},
|
|
1515
|
-
body: body ? JSON.stringify(body) : void 0
|
|
1516
|
-
});
|
|
1517
|
-
if (!response.ok) {
|
|
1518
|
-
const errorText = await response.text();
|
|
1519
|
-
let errorMessage;
|
|
1520
|
-
try {
|
|
1521
|
-
errorMessage = JSON.parse(errorText).error || errorText;
|
|
1522
|
-
} catch {
|
|
1523
|
-
errorMessage = errorText;
|
|
1524
|
-
}
|
|
1525
|
-
throw new Error(`API request failed (${response.status}): ${errorMessage}`);
|
|
1526
|
-
}
|
|
1527
|
-
return await response.json();
|
|
1528
|
-
} catch (error) {
|
|
1529
|
-
if (error instanceof Error) throw error;
|
|
1530
|
-
throw new Error(`API request failed: ${String(error)}`);
|
|
1531
|
-
}
|
|
1532
|
-
}
|
|
1533
1508
|
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
1534
1509
|
const { name, arguments: args } = request.params;
|
|
1535
1510
|
log(`Tool called: ${name}`, { args });
|
|
@@ -1537,7 +1512,11 @@ async function startMcpServer() {
|
|
|
1537
1512
|
if (!args) throw new Error("Missing arguments");
|
|
1538
1513
|
switch (name) {
|
|
1539
1514
|
case "list_subagents": {
|
|
1540
|
-
const results = await
|
|
1515
|
+
const results = (await apiClient$1.getSubagents(teamId)).map((subagent) => ({
|
|
1516
|
+
name: subagent.name,
|
|
1517
|
+
description: subagent.description,
|
|
1518
|
+
id: subagent.id
|
|
1519
|
+
}));
|
|
1541
1520
|
return { content: [{
|
|
1542
1521
|
type: "text",
|
|
1543
1522
|
text: JSON.stringify(results, null, 2)
|
|
@@ -1545,7 +1524,7 @@ async function startMcpServer() {
|
|
|
1545
1524
|
}
|
|
1546
1525
|
case "call_subagent": return { content: [{
|
|
1547
1526
|
type: "text",
|
|
1548
|
-
text: (await
|
|
1527
|
+
text: (await apiClient$1.callSubagent(teamId, args.id, args.prompt)).prompt
|
|
1549
1528
|
}] };
|
|
1550
1529
|
case "list_mcp_servers": {
|
|
1551
1530
|
const results = mcpServers.filter((server$1) => connectionManager.serverIsActive(server$1.name)).map((server$1) => ({
|
|
@@ -2138,7 +2117,7 @@ async function checkTeamMembership() {
|
|
|
2138
2117
|
|
|
2139
2118
|
//#endregion
|
|
2140
2119
|
//#region package.json
|
|
2141
|
-
var version = "0.0.
|
|
2120
|
+
var version = "0.0.22";
|
|
2142
2121
|
|
|
2143
2122
|
//#endregion
|
|
2144
2123
|
//#region src/index.ts
|