llmist 0.6.2 → 0.7.0

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 CHANGED
@@ -22,7 +22,7 @@ import {
22
22
  init_model_shortcuts,
23
23
  init_registry,
24
24
  resolveModel
25
- } from "./chunk-DVK6ZQOV.js";
25
+ } from "./chunk-ZFHFBEQ5.js";
26
26
 
27
27
  // src/cli/constants.ts
28
28
  var CLI_NAME = "llmist";
@@ -71,7 +71,7 @@ import { Command, InvalidArgumentError as InvalidArgumentError3 } from "commande
71
71
  // package.json
72
72
  var package_default = {
73
73
  name: "llmist",
74
- version: "0.6.1",
74
+ version: "0.6.2",
75
75
  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.",
76
76
  type: "module",
77
77
  main: "dist/index.cjs",
@@ -219,7 +219,7 @@ var tellUser = createGadget({
219
219
  name: "TellUser",
220
220
  description: "Tell the user something important. Set done=true when your work is complete and you want to end the conversation.",
221
221
  schema: z.object({
222
- message: z.string().describe("The message to display to the user in Markdown"),
222
+ message: z.string().optional().describe("The message to display to the user in Markdown"),
223
223
  done: z.boolean().default(false).describe("Set to true to end the conversation, false to continue"),
224
224
  type: z.enum(["info", "success", "warning", "error"]).default("info").describe("Message type: info, success, warning, or error")
225
225
  }),
@@ -239,9 +239,20 @@ var tellUser = createGadget({
239
239
  done: false,
240
240
  type: "warning"
241
241
  }
242
+ },
243
+ {
244
+ comment: "Share detailed analysis with bullet points (use heredoc for multiline)",
245
+ params: {
246
+ message: "Here's what I found in the codebase:\n\n1. **Main entry point**: `src/index.ts` exports all public APIs\n2. **Core logic**: Located in `src/core/` with 5 modules\n3. **Tests**: Good coverage in `src/__tests__/`\n\nI'll continue exploring the core modules.",
247
+ done: false,
248
+ type: "info"
249
+ }
242
250
  }
243
251
  ],
244
252
  execute: ({ message, done, type }) => {
253
+ if (!message || message.trim() === "") {
254
+ return "\u26A0\uFE0F TellUser was called without a message. Please provide content in the 'message' field.";
255
+ }
245
256
  const prefixes = {
246
257
  info: "\u2139\uFE0F ",
247
258
  success: "\u2705 ",
@@ -523,53 +534,6 @@ ${rendered}`;
523
534
  }
524
535
 
525
536
  // src/cli/utils.ts
526
- var RARE_EMOJI = [
527
- "\u{1F531}",
528
- "\u2697\uFE0F",
529
- "\u{1F9FF}",
530
- "\u{1F530}",
531
- "\u269B\uFE0F",
532
- "\u{1F3FA}",
533
- "\u{1F9EB}",
534
- "\u{1F52C}",
535
- "\u2695\uFE0F",
536
- "\u{1F5DD}\uFE0F",
537
- "\u2696\uFE0F",
538
- "\u{1F52E}",
539
- "\u{1FAAC}",
540
- "\u{1F9EC}",
541
- "\u2699\uFE0F",
542
- "\u{1F529}",
543
- "\u{1FA9B}",
544
- "\u26CF\uFE0F",
545
- "\u{1FA83}",
546
- "\u{1F3F9}",
547
- "\u{1F6E1}\uFE0F",
548
- "\u2694\uFE0F",
549
- "\u{1F5E1}\uFE0F",
550
- "\u{1FA93}",
551
- "\u{1F5C3}\uFE0F",
552
- "\u{1F4DC}",
553
- "\u{1F4EF}",
554
- "\u{1F3B4}",
555
- "\u{1F004}",
556
- "\u{1F3B2}"
557
- ];
558
- function generateMarkers() {
559
- const pick = (count) => {
560
- const result = [];
561
- const pool = [...RARE_EMOJI];
562
- for (let i = 0; i < count && pool.length > 0; i++) {
563
- const idx = Math.floor(Math.random() * pool.length);
564
- result.push(pool.splice(idx, 1)[0]);
565
- }
566
- return result.join("");
567
- };
568
- return {
569
- startPrefix: pick(5),
570
- endPrefix: pick(5)
571
- };
572
- }
573
537
  function createNumericParser({
574
538
  label,
575
539
  integer = false,
@@ -995,6 +959,10 @@ function configToAgentOptions(config) {
995
959
  if (config.builtins !== void 0) result.builtins = config.builtins;
996
960
  if (config["builtin-interaction"] !== void 0)
997
961
  result.builtinInteraction = config["builtin-interaction"];
962
+ if (config["gadget-start-prefix"] !== void 0)
963
+ result.gadgetStartPrefix = config["gadget-start-prefix"];
964
+ if (config["gadget-end-prefix"] !== void 0)
965
+ result.gadgetEndPrefix = config["gadget-end-prefix"];
998
966
  return result;
999
967
  }
1000
968
 
@@ -1209,9 +1177,27 @@ Command rejected by user with message: "${response}"`
1209
1177
  builder.withGadgets(...gadgets);
1210
1178
  }
1211
1179
  builder.withParameterFormat(options.parameterFormat);
1212
- const markers = generateMarkers();
1213
- builder.withGadgetStartPrefix(markers.startPrefix);
1214
- builder.withGadgetEndPrefix(markers.endPrefix);
1180
+ if (options.gadgetStartPrefix) {
1181
+ builder.withGadgetStartPrefix(options.gadgetStartPrefix);
1182
+ }
1183
+ if (options.gadgetEndPrefix) {
1184
+ builder.withGadgetEndPrefix(options.gadgetEndPrefix);
1185
+ }
1186
+ builder.withSyntheticGadgetCall(
1187
+ "TellUser",
1188
+ {
1189
+ message: "\u{1F44B} Hello! I'm ready to help.\n\nHere's what I can do:\n- Analyze your codebase\n- Execute commands\n- Answer questions\n\nWhat would you like me to work on?",
1190
+ done: false,
1191
+ type: "info"
1192
+ },
1193
+ "\u2139\uFE0F \u{1F44B} Hello! I'm ready to help.\n\nHere's what I can do:\n- Analyze your codebase\n- Execute commands\n- Answer questions\n\nWhat would you like me to work on?"
1194
+ );
1195
+ builder.withTextOnlyHandler("acknowledge");
1196
+ builder.withTextWithGadgetsHandler({
1197
+ gadgetName: "TellUser",
1198
+ parameterMapping: (text) => ({ message: text, done: false, type: "info" }),
1199
+ resultMapping: (text) => `\u2139\uFE0F ${text}`
1200
+ });
1215
1201
  const agent = builder.ask(prompt);
1216
1202
  for await (const event of agent.run()) {
1217
1203
  if (event.type === "text") {
@@ -1333,7 +1319,9 @@ var AGENT_CONFIG_KEYS = /* @__PURE__ */ new Set([
1333
1319
  "gadget",
1334
1320
  "parameter-format",
1335
1321
  "builtins",
1336
- "builtin-interaction"
1322
+ "builtin-interaction",
1323
+ "gadget-start-prefix",
1324
+ "gadget-end-prefix"
1337
1325
  ]);
1338
1326
  var CUSTOM_CONFIG_KEYS = /* @__PURE__ */ new Set([
1339
1327
  ...COMPLETE_CONFIG_KEYS,
@@ -1495,6 +1483,20 @@ function validateAgentConfig(raw, section) {
1495
1483
  section
1496
1484
  );
1497
1485
  }
1486
+ if ("gadget-start-prefix" in rawObj) {
1487
+ result["gadget-start-prefix"] = validateString(
1488
+ rawObj["gadget-start-prefix"],
1489
+ "gadget-start-prefix",
1490
+ section
1491
+ );
1492
+ }
1493
+ if ("gadget-end-prefix" in rawObj) {
1494
+ result["gadget-end-prefix"] = validateString(
1495
+ rawObj["gadget-end-prefix"],
1496
+ "gadget-end-prefix",
1497
+ section
1498
+ );
1499
+ }
1498
1500
  return result;
1499
1501
  }
1500
1502
  function validateCustomConfig(raw, section) {
@@ -1550,6 +1552,20 @@ function validateCustomConfig(raw, section) {
1550
1552
  section
1551
1553
  );
1552
1554
  }
1555
+ if ("gadget-start-prefix" in rawObj) {
1556
+ result["gadget-start-prefix"] = validateString(
1557
+ rawObj["gadget-start-prefix"],
1558
+ "gadget-start-prefix",
1559
+ section
1560
+ );
1561
+ }
1562
+ if ("gadget-end-prefix" in rawObj) {
1563
+ result["gadget-end-prefix"] = validateString(
1564
+ rawObj["gadget-end-prefix"],
1565
+ "gadget-end-prefix",
1566
+ section
1567
+ );
1568
+ }
1553
1569
  if ("max-tokens" in rawObj) {
1554
1570
  result["max-tokens"] = validateNumber(rawObj["max-tokens"], "max-tokens", section, {
1555
1571
  integer: true,