llmist 0.1.6 → 0.2.1

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.cjs CHANGED
@@ -86,17 +86,17 @@ var init_model_shortcuts = __esm({
86
86
  "gpt5-mini": "openai:gpt-5-mini",
87
87
  "gpt5-nano": "openai:gpt-5-nano",
88
88
  // Anthropic aliases
89
- sonnet: "anthropic:claude-3-5-sonnet-latest",
90
- "claude-sonnet": "anthropic:claude-3-5-sonnet-latest",
91
- haiku: "anthropic:claude-3-5-haiku-latest",
92
- "claude-haiku": "anthropic:claude-3-5-haiku-latest",
93
- opus: "anthropic:claude-3-opus-latest",
94
- "claude-opus": "anthropic:claude-3-opus-latest",
89
+ sonnet: "anthropic:claude-sonnet-4-5",
90
+ "claude-sonnet": "anthropic:claude-sonnet-4-5",
91
+ haiku: "anthropic:claude-haiku-4-5",
92
+ "claude-haiku": "anthropic:claude-haiku-4-5",
93
+ opus: "anthropic:claude-opus-4-5",
94
+ "claude-opus": "anthropic:claude-opus-4-5",
95
95
  // Gemini aliases
96
96
  flash: "gemini:gemini-2.0-flash",
97
97
  "gemini-flash": "gemini:gemini-2.0-flash",
98
- "gemini-pro": "gemini:gemini-2.0-pro",
99
- pro: "gemini:gemini-2.0-pro"
98
+ "gemini-pro": "gemini:gemini-2.5-pro",
99
+ pro: "gemini:gemini-2.5-pro"
100
100
  };
101
101
  KNOWN_MODEL_PATTERNS = [
102
102
  /^gpt-?\d/i,
@@ -2070,30 +2070,6 @@ var init_anthropic_models = __esm({
2070
2070
  "src/providers/anthropic-models.ts"() {
2071
2071
  "use strict";
2072
2072
  ANTHROPIC_MODELS = [
2073
- {
2074
- provider: "anthropic",
2075
- modelId: "claude-opus-4-5-20251124",
2076
- displayName: "Claude Opus 4.5",
2077
- contextWindow: 2e5,
2078
- maxOutputTokens: 64e3,
2079
- pricing: {
2080
- input: 5,
2081
- output: 25,
2082
- cachedInput: 0.5
2083
- },
2084
- knowledgeCutoff: "2025-03",
2085
- features: {
2086
- streaming: true,
2087
- functionCalling: true,
2088
- vision: true,
2089
- reasoning: true
2090
- },
2091
- metadata: {
2092
- family: "Claude 4",
2093
- releaseDate: "2025-11-24",
2094
- notes: "Most powerful model. 80.9% SWE-bench Verified, 66.3% OSWorld. Best for coding and computer use."
2095
- }
2096
- },
2097
2073
  {
2098
2074
  provider: "anthropic",
2099
2075
  modelId: "claude-sonnet-4-5-20250929",
@@ -2282,6 +2258,79 @@ var init_anthropic_models = __esm({
2282
2258
  releaseDate: "2024-03-07",
2283
2259
  notes: "Legacy model - upgrade to Haiku 4.5 for better performance"
2284
2260
  }
2261
+ },
2262
+ // Modern aliases (recommended by Anthropic)
2263
+ {
2264
+ provider: "anthropic",
2265
+ modelId: "claude-haiku-4-5",
2266
+ displayName: "Claude Haiku 4.5",
2267
+ contextWindow: 2e5,
2268
+ maxOutputTokens: 64e3,
2269
+ pricing: {
2270
+ input: 1,
2271
+ output: 5,
2272
+ cachedInput: 0.1
2273
+ },
2274
+ knowledgeCutoff: "2025-02",
2275
+ features: {
2276
+ streaming: true,
2277
+ functionCalling: true,
2278
+ vision: true,
2279
+ reasoning: true
2280
+ },
2281
+ metadata: {
2282
+ family: "Claude 4",
2283
+ releaseDate: "2025-10-01",
2284
+ notes: "Alias for claude-haiku-4-5-20251001. Fastest model with near-frontier intelligence."
2285
+ }
2286
+ },
2287
+ {
2288
+ provider: "anthropic",
2289
+ modelId: "claude-sonnet-4-5",
2290
+ displayName: "Claude Sonnet 4.5",
2291
+ contextWindow: 2e5,
2292
+ maxOutputTokens: 64e3,
2293
+ pricing: {
2294
+ input: 3,
2295
+ output: 15,
2296
+ cachedInput: 0.3
2297
+ },
2298
+ knowledgeCutoff: "2025-01",
2299
+ features: {
2300
+ streaming: true,
2301
+ functionCalling: true,
2302
+ vision: true,
2303
+ reasoning: true
2304
+ },
2305
+ metadata: {
2306
+ family: "Claude 4",
2307
+ releaseDate: "2025-09-29",
2308
+ notes: "Alias for claude-sonnet-4-5-20250929. Smartest model for complex agents and coding."
2309
+ }
2310
+ },
2311
+ {
2312
+ provider: "anthropic",
2313
+ modelId: "claude-opus-4-5",
2314
+ displayName: "Claude Opus 4.5",
2315
+ contextWindow: 2e5,
2316
+ maxOutputTokens: 64e3,
2317
+ pricing: {
2318
+ input: 5,
2319
+ output: 25,
2320
+ cachedInput: 0.5
2321
+ },
2322
+ knowledgeCutoff: "2025-03",
2323
+ features: {
2324
+ streaming: true,
2325
+ functionCalling: true,
2326
+ vision: true,
2327
+ reasoning: true
2328
+ },
2329
+ metadata: {
2330
+ family: "Claude 4",
2331
+ releaseDate: "2025-11-24",
2332
+ notes: "Alias for claude-opus-4-5-20251124. Most powerful model for coding and computer use."
2333
+ }
2285
2334
  }
2286
2335
  ];
2287
2336
  }
@@ -4216,7 +4265,8 @@ var CLI_NAME = "llmist";
4216
4265
  var CLI_DESCRIPTION = "Command line utilities for llmist agents and direct LLM access.";
4217
4266
  var COMMANDS = {
4218
4267
  complete: "complete",
4219
- agent: "agent"
4268
+ agent: "agent",
4269
+ models: "models"
4220
4270
  };
4221
4271
  var LOG_LEVELS = ["silly", "trace", "debug", "info", "warn", "error", "fatal"];
4222
4272
  var DEFAULT_MODEL = "openai:gpt-5-nano";
@@ -4234,7 +4284,7 @@ var OPTION_FLAGS = {
4234
4284
  noBuiltins: "--no-builtins"
4235
4285
  };
4236
4286
  var OPTION_DESCRIPTIONS = {
4237
- model: "Model identifier, e.g. openai:gpt-5-nano or anthropic:claude-3-5-sonnet-latest.",
4287
+ model: "Model identifier, e.g. openai:gpt-5-nano or anthropic:claude-sonnet-4-5.",
4238
4288
  systemPrompt: "Optional system prompt prepended to the conversation.",
4239
4289
  temperature: "Sampling temperature between 0 and 2.",
4240
4290
  maxTokens: "Maximum number of output tokens requested from the model.",
@@ -4253,7 +4303,7 @@ var import_commander3 = require("commander");
4253
4303
  // package.json
4254
4304
  var package_default = {
4255
4305
  name: "llmist",
4256
- version: "0.1.6",
4306
+ version: "0.2.0",
4257
4307
  description: "Universal TypeScript LLM client with streaming-first agent framework. Works with any model - no structured outputs or native tool calling required. Implements its own flexible grammar for function calling.",
4258
4308
  type: "module",
4259
4309
  main: "dist/index.cjs",
@@ -4295,7 +4345,8 @@ var package_default = {
4295
4345
  "test:e2e:watch": "bun test src/e2e --watch --timeout 60000",
4296
4346
  "test:all": "bun run test && bun run test:e2e",
4297
4347
  clean: "rimraf dist",
4298
- prepare: "node scripts/install-hooks.js || true"
4348
+ prepare: "node scripts/install-hooks.js || true",
4349
+ "release:dry": "bunx semantic-release --dry-run"
4299
4350
  },
4300
4351
  bin: {
4301
4352
  llmist: "dist/cli.js"
@@ -4344,11 +4395,16 @@ var package_default = {
4344
4395
  },
4345
4396
  devDependencies: {
4346
4397
  "@biomejs/biome": "^2.3.2",
4398
+ "@commitlint/cli": "^20.1.0",
4399
+ "@commitlint/config-conventional": "^20.0.0",
4400
+ "@semantic-release/changelog": "^6.0.3",
4401
+ "@semantic-release/git": "^10.0.1",
4347
4402
  "@types/js-yaml": "^4.0.9",
4348
4403
  "@types/node": "^20.12.7",
4349
4404
  "bun-types": "^1.3.2",
4350
4405
  dotenv: "^17.2.3",
4351
4406
  rimraf: "^5.0.5",
4407
+ "semantic-release": "^25.0.2",
4352
4408
  tsup: "^8.3.5",
4353
4409
  typescript: "^5.4.5"
4354
4410
  }
@@ -5279,9 +5335,169 @@ function registerCompleteCommand(program, env) {
5279
5335
  );
5280
5336
  }
5281
5337
 
5338
+ // src/cli/models-command.ts
5339
+ var import_chalk3 = __toESM(require("chalk"), 1);
5340
+ init_model_shortcuts();
5341
+ async function handleModelsCommand(options, env) {
5342
+ const client = env.createClient();
5343
+ const models = client.modelRegistry.listModels(options.provider);
5344
+ if (options.format === "json") {
5345
+ renderJSON(models, env.stdout);
5346
+ } else {
5347
+ renderTable(models, options.verbose || false, env.stdout);
5348
+ }
5349
+ }
5350
+ function renderTable(models, verbose, stream2) {
5351
+ const grouped = /* @__PURE__ */ new Map();
5352
+ for (const model of models) {
5353
+ const provider = model.provider;
5354
+ if (!grouped.has(provider)) {
5355
+ grouped.set(provider, []);
5356
+ }
5357
+ grouped.get(provider).push(model);
5358
+ }
5359
+ stream2.write(import_chalk3.default.bold.cyan("\nAvailable Models\n"));
5360
+ stream2.write(import_chalk3.default.cyan("=".repeat(80)) + "\n\n");
5361
+ const providers = Array.from(grouped.keys()).sort();
5362
+ for (const provider of providers) {
5363
+ const providerModels = grouped.get(provider);
5364
+ const providerName = provider.charAt(0).toUpperCase() + provider.slice(1);
5365
+ stream2.write(import_chalk3.default.bold.yellow(`${providerName} Models
5366
+ `));
5367
+ if (verbose) {
5368
+ renderVerboseTable(providerModels, stream2);
5369
+ } else {
5370
+ renderCompactTable(providerModels, stream2);
5371
+ }
5372
+ stream2.write("\n");
5373
+ }
5374
+ stream2.write(import_chalk3.default.bold.magenta("Model Shortcuts\n"));
5375
+ stream2.write(import_chalk3.default.dim("\u2500".repeat(80)) + "\n");
5376
+ const shortcuts = Object.entries(MODEL_ALIASES).sort((a, b) => a[0].localeCompare(b[0]));
5377
+ for (const [shortcut, fullName] of shortcuts) {
5378
+ stream2.write(import_chalk3.default.cyan(` ${shortcut.padEnd(15)}`) + import_chalk3.default.dim(" \u2192 ") + import_chalk3.default.white(fullName) + "\n");
5379
+ }
5380
+ stream2.write("\n");
5381
+ }
5382
+ function renderCompactTable(models, stream2) {
5383
+ const idWidth = 25;
5384
+ const nameWidth = 22;
5385
+ const contextWidth = 13;
5386
+ const inputWidth = 10;
5387
+ const outputWidth = 10;
5388
+ stream2.write(import_chalk3.default.dim("\u2500".repeat(idWidth + nameWidth + contextWidth + inputWidth + outputWidth + 8)) + "\n");
5389
+ stream2.write(
5390
+ import_chalk3.default.bold(
5391
+ "Model ID".padEnd(idWidth) + " " + "Display Name".padEnd(nameWidth) + " " + "Context".padEnd(contextWidth) + " " + "Input".padEnd(inputWidth) + " " + "Output".padEnd(outputWidth)
5392
+ ) + "\n"
5393
+ );
5394
+ stream2.write(import_chalk3.default.dim("\u2500".repeat(idWidth + nameWidth + contextWidth + inputWidth + outputWidth + 8)) + "\n");
5395
+ for (const model of models) {
5396
+ const contextFormatted = formatTokens(model.contextWindow);
5397
+ const inputPrice = `$${model.pricing.input.toFixed(2)}`;
5398
+ const outputPrice = `$${model.pricing.output.toFixed(2)}`;
5399
+ stream2.write(
5400
+ import_chalk3.default.green(model.modelId.padEnd(idWidth)) + " " + import_chalk3.default.white(model.displayName.padEnd(nameWidth)) + " " + import_chalk3.default.yellow(contextFormatted.padEnd(contextWidth)) + " " + import_chalk3.default.cyan(inputPrice.padEnd(inputWidth)) + " " + import_chalk3.default.cyan(outputPrice.padEnd(outputWidth)) + "\n"
5401
+ );
5402
+ }
5403
+ stream2.write(import_chalk3.default.dim("\u2500".repeat(idWidth + nameWidth + contextWidth + inputWidth + outputWidth + 8)) + "\n");
5404
+ stream2.write(import_chalk3.default.dim(` * Prices are per 1M tokens
5405
+ `));
5406
+ }
5407
+ function renderVerboseTable(models, stream2) {
5408
+ for (const model of models) {
5409
+ stream2.write(import_chalk3.default.bold.green(`
5410
+ ${model.modelId}
5411
+ `));
5412
+ stream2.write(import_chalk3.default.dim(" " + "\u2500".repeat(60)) + "\n");
5413
+ stream2.write(` ${import_chalk3.default.dim("Name:")} ${import_chalk3.default.white(model.displayName)}
5414
+ `);
5415
+ stream2.write(` ${import_chalk3.default.dim("Context:")} ${import_chalk3.default.yellow(formatTokens(model.contextWindow))}
5416
+ `);
5417
+ stream2.write(` ${import_chalk3.default.dim("Max Output:")} ${import_chalk3.default.yellow(formatTokens(model.maxOutputTokens))}
5418
+ `);
5419
+ stream2.write(` ${import_chalk3.default.dim("Pricing:")} ${import_chalk3.default.cyan(`$${model.pricing.input.toFixed(2)} input`)} ${import_chalk3.default.dim("/")} ${import_chalk3.default.cyan(`$${model.pricing.output.toFixed(2)} output`)} ${import_chalk3.default.dim("(per 1M tokens)")}
5420
+ `);
5421
+ if (model.pricing.cachedInput !== void 0) {
5422
+ stream2.write(` ${import_chalk3.default.dim("Cached Input:")} ${import_chalk3.default.cyan(`$${model.pricing.cachedInput.toFixed(2)} per 1M tokens`)}
5423
+ `);
5424
+ }
5425
+ if (model.knowledgeCutoff) {
5426
+ stream2.write(` ${import_chalk3.default.dim("Knowledge:")} ${model.knowledgeCutoff}
5427
+ `);
5428
+ }
5429
+ const features = [];
5430
+ if (model.features.streaming) features.push("streaming");
5431
+ if (model.features.functionCalling) features.push("function-calling");
5432
+ if (model.features.vision) features.push("vision");
5433
+ if (model.features.reasoning) features.push("reasoning");
5434
+ if (model.features.structuredOutputs) features.push("structured-outputs");
5435
+ if (model.features.fineTuning) features.push("fine-tuning");
5436
+ if (features.length > 0) {
5437
+ stream2.write(` ${import_chalk3.default.dim("Features:")} ${import_chalk3.default.blue(features.join(", "))}
5438
+ `);
5439
+ }
5440
+ if (model.metadata) {
5441
+ if (model.metadata.family) {
5442
+ stream2.write(` ${import_chalk3.default.dim("Family:")} ${model.metadata.family}
5443
+ `);
5444
+ }
5445
+ if (model.metadata.releaseDate) {
5446
+ stream2.write(` ${import_chalk3.default.dim("Released:")} ${model.metadata.releaseDate}
5447
+ `);
5448
+ }
5449
+ if (model.metadata.notes) {
5450
+ stream2.write(` ${import_chalk3.default.dim("Notes:")} ${import_chalk3.default.italic(model.metadata.notes)}
5451
+ `);
5452
+ }
5453
+ }
5454
+ }
5455
+ stream2.write("\n");
5456
+ }
5457
+ function renderJSON(models, stream2) {
5458
+ const output = {
5459
+ models: models.map((model) => ({
5460
+ provider: model.provider,
5461
+ modelId: model.modelId,
5462
+ displayName: model.displayName,
5463
+ contextWindow: model.contextWindow,
5464
+ maxOutputTokens: model.maxOutputTokens,
5465
+ pricing: {
5466
+ input: model.pricing.input,
5467
+ output: model.pricing.output,
5468
+ cachedInput: model.pricing.cachedInput,
5469
+ currency: "USD",
5470
+ per: "1M tokens"
5471
+ },
5472
+ knowledgeCutoff: model.knowledgeCutoff,
5473
+ features: model.features,
5474
+ metadata: model.metadata
5475
+ })),
5476
+ shortcuts: MODEL_ALIASES
5477
+ };
5478
+ stream2.write(JSON.stringify(output, null, 2) + "\n");
5479
+ }
5480
+ function formatTokens(count) {
5481
+ if (count >= 1e6) {
5482
+ return `${(count / 1e6).toFixed(1)}M tokens`;
5483
+ } else if (count >= 1e3) {
5484
+ return `${(count / 1e3).toFixed(0)}K tokens`;
5485
+ } else {
5486
+ return `${count} tokens`;
5487
+ }
5488
+ }
5489
+ function registerModelsCommand(program, env) {
5490
+ program.command(COMMANDS.models).description("List all available LLM models with pricing and capabilities.").option("--provider <name>", "Filter by provider (openai, anthropic, gemini)").option("--format <format>", "Output format: table or json", "table").option("--verbose", "Show detailed model information", false).action(
5491
+ (options) => executeAction(
5492
+ () => handleModelsCommand(options, env),
5493
+ env
5494
+ )
5495
+ );
5496
+ }
5497
+
5282
5498
  // src/cli/environment.ts
5283
5499
  var import_node_readline = __toESM(require("readline"), 1);
5284
- var import_chalk3 = __toESM(require("chalk"), 1);
5500
+ var import_chalk4 = __toESM(require("chalk"), 1);
5285
5501
  init_client();
5286
5502
  init_logger();
5287
5503
  var LOG_LEVEL_MAP = {
@@ -5327,14 +5543,14 @@ function createPromptFunction(stdin, stdout) {
5327
5543
  output: stdout
5328
5544
  });
5329
5545
  stdout.write("\n");
5330
- stdout.write(`${import_chalk3.default.cyan("\u2500".repeat(60))}
5546
+ stdout.write(`${import_chalk4.default.cyan("\u2500".repeat(60))}
5331
5547
  `);
5332
- stdout.write(import_chalk3.default.cyan.bold("\u{1F916} Agent asks:\n"));
5548
+ stdout.write(import_chalk4.default.cyan.bold("\u{1F916} Agent asks:\n"));
5333
5549
  stdout.write(`${question}
5334
5550
  `);
5335
- stdout.write(`${import_chalk3.default.cyan("\u2500".repeat(60))}
5551
+ stdout.write(`${import_chalk4.default.cyan("\u2500".repeat(60))}
5336
5552
  `);
5337
- rl.question(import_chalk3.default.green.bold("You: "), (answer) => {
5553
+ rl.question(import_chalk4.default.green.bold("You: "), (answer) => {
5338
5554
  rl.close();
5339
5555
  resolve(answer);
5340
5556
  });
@@ -5377,6 +5593,7 @@ function createProgram(env) {
5377
5593
  });
5378
5594
  registerCompleteCommand(program, env);
5379
5595
  registerAgentCommand(program, env);
5596
+ registerModelsCommand(program, env);
5380
5597
  return program;
5381
5598
  }
5382
5599
  async function runCLI(overrides = {}) {