UNPKG

@light-merlin-dark/tok

Version:

Fast token estimation and cost calculation for enterprise LLMs with CLI and MCP support

84 lines (80 loc) 3.47 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.configCommand = exports.trackResetCommand = exports.trackSummaryCommand = exports.priceSetCommand = exports.priceListCommand = exports.estimateCommand = exports.commands = void 0; const estimate_1 = __importDefault(require("./estimate")); exports.estimateCommand = estimate_1.default; const price_1 = require("./price"); Object.defineProperty(exports, "priceListCommand", { enumerable: true, get: function () { return price_1.priceListCommand; } }); Object.defineProperty(exports, "priceSetCommand", { enumerable: true, get: function () { return price_1.priceSetCommand; } }); const track_1 = require("./track"); Object.defineProperty(exports, "trackSummaryCommand", { enumerable: true, get: function () { return track_1.trackSummaryCommand; } }); Object.defineProperty(exports, "trackResetCommand", { enumerable: true, get: function () { return track_1.trackResetCommand; } }); const config_1 = __importDefault(require("./config")); exports.configCommand = config_1.default; // Main commands exports.commands = { estimate: estimate_1.default, config: config_1.default, // Price sub-commands - we'll handle routing in the main entry 'price': { description: 'Manage model pricing', help: ` Usage: tok price <subcommand> [options] Subcommands: list List all model prices set Set price for a model Run 'tok price <subcommand> --help' for more information. `, async execute(args, options, ctx) { const subcommand = args[0]; if (!subcommand || subcommand === 'help' || options.help) { console.log(this.help); return { success: true }; } switch (subcommand) { case 'list': return price_1.priceListCommand.execute(args.slice(1), options, ctx); case 'set': return price_1.priceSetCommand.execute(args.slice(1), options, ctx); default: return { success: false, message: `Unknown price subcommand: ${subcommand}` }; } } }, // Track sub-commands 'track': { description: 'Cost tracking session management', help: ` Usage: tok track <subcommand> [options] Subcommands: summary Show cost tracking summary reset Reset cost tracking data Run 'tok track <subcommand> --help' for more information. `, async execute(args, options, ctx) { const subcommand = args[0]; if (!subcommand || subcommand === 'help' || options.help) { console.log(this.help); return { success: true }; } switch (subcommand) { case 'summary': return track_1.trackSummaryCommand.execute(args.slice(1), options, ctx); case 'reset': return track_1.trackResetCommand.execute(args.slice(1), options, ctx); default: return { success: false, message: `Unknown track subcommand: ${subcommand}` }; } } } }; //# sourceMappingURL=index.js.map