UNPKG

@2501-ai/cli

Version:

[![npm version](https://img.shields.io/npm/v/@2501-ai/cli.svg)](https://www.npmjs.com/package/@2501-ai/cli) [![HumanEval Score](https://img.shields.io/badge/HumanEval-96.95%25-brightgreen.svg)](https://www.2501.ai/research/full-humaneval-benchmark) [![Lic

61 lines (60 loc) 2.6 kB
"use strict"; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.agentsCommand = void 0; const terminal_kit_1 = require("terminal-kit"); const conf_1 = require("../utils/conf"); const workspace_1 = require("../helpers/workspace"); const agentsCommand = (options) => __awaiter(void 0, void 0, void 0, function* () { const workspaceUrl = (0, workspace_1.resolveWorkspacePath)({ workspace: options.workspace }); if (options.flush) { yield (0, conf_1.flushAgents)(workspaceUrl, options.all); (0, terminal_kit_1.terminal)('All agents have been flushed from the configuration.\n'); return; } let agents; if (options.all) { agents = (0, conf_1.listAgents)(); } else { agents = (0, conf_1.listAgentsFromWorkspace)(workspaceUrl); } if (agents.length > 0) { terminal_kit_1.terminal.table([ ['Name', 'ID', 'Configuration', 'Workspace', 'Remote Exec'], ...agents.map((agent) => { var _a; return [ agent.name.substring(0, 10), agent.id, agent.configuration, agent.workspace, ((_a = agent.remote_exec) === null || _a === void 0 ? void 0 : _a.enabled) ? `${agent.remote_exec.user}@${agent.remote_exec.target}:${agent.remote_exec.port}` : 'Disabled', ]; }), ], { hasBorder: true, contentHasMarkup: true, borderChars: 'lightRounded', borderAttr: { color: 'blue' }, textAttr: { bgColor: 'default' }, firstRowTextAttr: { bgColor: 'blue' }, width: 120, fit: true, }); } else { (0, terminal_kit_1.terminal)('No agents found.\n'); } }); exports.agentsCommand = agentsCommand;