llmist 0.1.3 → 0.1.4

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.
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  BaseGadget
3
- } from "./chunk-TP7HE3MN.js";
3
+ } from "./chunk-J3NCIWMY.js";
4
4
 
5
5
  // src/gadgets/create-gadget.ts
6
6
  function createGadget(config) {
@@ -19,4 +19,4 @@ function createGadget(config) {
19
19
  export {
20
20
  createGadget
21
21
  };
22
- //# sourceMappingURL=chunk-JEBGLCDW.js.map
22
+ //# sourceMappingURL=chunk-MO5ONHPZ.js.map
@@ -7,7 +7,7 @@ import {
7
7
  init_client,
8
8
  init_constants,
9
9
  init_logger
10
- } from "./chunk-TP7HE3MN.js";
10
+ } from "./chunk-J3NCIWMY.js";
11
11
 
12
12
  // src/gadgets/validation.ts
13
13
  function validateAndApplyDefaults(schema, params) {
@@ -898,4 +898,4 @@ export {
898
898
  MockGadgetBuilder,
899
899
  mockGadget
900
900
  };
901
- //# sourceMappingURL=chunk-DCW33WV7.js.map
901
+ //# sourceMappingURL=chunk-PVHHXDCV.js.map
package/dist/cli.cjs CHANGED
@@ -420,14 +420,15 @@ var init_messages = __esm({
420
420
  context
421
421
  );
422
422
  parts.push(mainInstruction);
423
- parts.push(this.buildGadgetsXmlSection(gadgets, parameterFormat));
423
+ parts.push(this.buildGadgetsSection(gadgets, parameterFormat));
424
424
  parts.push(this.buildUsageSection(parameterFormat, context));
425
425
  this.messages.push({ role: "system", content: parts.join("") });
426
426
  return this;
427
427
  }
428
- buildGadgetsXmlSection(gadgets, parameterFormat) {
428
+ buildGadgetsSection(gadgets, parameterFormat) {
429
429
  const parts = [];
430
- parts.push("<GADGETS>");
430
+ parts.push("\n\nAVAILABLE GADGETS");
431
+ parts.push("\n=================\n");
431
432
  for (const gadget of gadgets) {
432
433
  const gadgetName = gadget.name ?? gadget.constructor.name;
433
434
  const instruction = gadget.getInstruction(parameterFormat);
@@ -435,18 +436,17 @@ var init_messages = __esm({
435
436
  const schemaIndex = instruction.indexOf(schemaMarker);
436
437
  const description = (schemaIndex !== -1 ? instruction.substring(0, schemaIndex) : instruction).trim();
437
438
  const schema = schemaIndex !== -1 ? instruction.substring(schemaIndex + schemaMarker.length).trim() : "";
438
- parts.push("\n <gadget>");
439
439
  parts.push(`
440
- <name>${gadgetName}</name>`);
440
+ GADGET: ${gadgetName}`);
441
441
  parts.push(`
442
- <description>${description}</description>`);
442
+ ${description}`);
443
443
  if (schema) {
444
444
  parts.push(`
445
- <schema format="${parameterFormat}">
446
- ${schema}
447
- </schema>`);
445
+
446
+ PARAMETERS (${parameterFormat.toUpperCase()}):
447
+ ${schema}`);
448
448
  }
449
- parts.push("\n </gadget>");
449
+ parts.push("\n\n---");
450
450
  }
451
451
  return parts.join("");
452
452
  }
@@ -461,26 +461,26 @@ ${schema}
461
461
  DEFAULT_PROMPTS.formatDescriptionJson,
462
462
  context
463
463
  );
464
- parts.push("<usage>");
464
+ parts.push("\n\nHOW TO INVOKE GADGETS");
465
+ parts.push("\n=====================\n");
465
466
  const criticalUsage = resolvePromptTemplate(
466
467
  this.promptConfig.criticalUsage,
467
468
  DEFAULT_PROMPTS.criticalUsage,
468
469
  context
469
470
  );
470
471
  parts.push(`
471
- <critical>${criticalUsage}</critical>`);
472
- parts.push("\n <format>");
472
+ CRITICAL: ${criticalUsage}
473
+ `);
474
+ parts.push("\nFORMAT:");
473
475
  parts.push(`
474
- <step>Start marker: ${this.startPrefix}gadget_name</step>`);
476
+ 1. Start marker: ${this.startPrefix}gadget_name`);
475
477
  parts.push(`
476
- <step>${formatDescription}</step>`);
478
+ 2. ${formatDescription}`);
477
479
  parts.push(`
478
- <step>End marker: ${this.endPrefix}</step>`);
479
- parts.push("\n </format>");
480
+ 3. End marker: ${this.endPrefix}`);
480
481
  parts.push(this.buildExamplesSection(parameterFormat, context));
481
482
  parts.push(this.buildRulesSection(context));
482
- parts.push("\n</usage>");
483
- parts.push("\n</GADGETS>\n\n");
483
+ parts.push("\n");
484
484
  return parts.join("");
485
485
  }
486
486
  buildExamplesSection(parameterFormat, context) {
@@ -488,7 +488,6 @@ ${schema}
488
488
  return this.promptConfig.customExamples(context);
489
489
  }
490
490
  const parts = [];
491
- parts.push("\n <examples>");
492
491
  const singleExample = parameterFormat === "yaml" ? `${this.startPrefix}translate
493
492
  from: English
494
493
  to: Polish
@@ -497,9 +496,10 @@ ${this.endPrefix}` : `${this.startPrefix}translate
497
496
  {"from": "English", "to": "Polish", "content": "Paris is the capital of France."}
498
497
  ${this.endPrefix}`;
499
498
  parts.push(`
500
- <example title="Single Gadget">
501
- ${singleExample}
502
- </example>`);
499
+
500
+ EXAMPLE (Single Gadget):
501
+
502
+ ${singleExample}`);
503
503
  const multipleExample = parameterFormat === "yaml" ? `${this.startPrefix}translate
504
504
  from: English
505
505
  to: Polish
@@ -516,21 +516,20 @@ ${this.startPrefix}analyze
516
516
  {"type": "economic_analysis", "matter": "Polish Economy", "question": "Polish arms exports 2025."}
517
517
  ${this.endPrefix}`;
518
518
  parts.push(`
519
- <example title="Multiple Gadgets">
520
- ${multipleExample}
521
- </example>`);
522
- parts.push("\n </examples>");
519
+
520
+ EXAMPLE (Multiple Gadgets):
521
+
522
+ ${multipleExample}`);
523
523
  return parts.join("");
524
524
  }
525
525
  buildRulesSection(context) {
526
526
  const parts = [];
527
- parts.push("\n <rules>");
527
+ parts.push("\n\nRULES:");
528
528
  const rules = resolveRulesTemplate(this.promptConfig.rules, context);
529
529
  for (const rule of rules) {
530
530
  parts.push(`
531
- <rule>${rule}</rule>`);
531
+ - ${rule}`);
532
532
  }
533
- parts.push("\n </rules>");
534
533
  return parts.join("");
535
534
  }
536
535
  addUser(content, metadata) {
@@ -1140,19 +1139,19 @@ var init_executor = __esm({
1140
1139
  });
1141
1140
 
1142
1141
  // src/gadgets/parser.ts
1143
- var yaml, StreamParser;
1142
+ var yaml, globalInvocationCounter, StreamParser;
1144
1143
  var init_parser = __esm({
1145
1144
  "src/gadgets/parser.ts"() {
1146
1145
  "use strict";
1147
1146
  yaml = __toESM(require("js-yaml"), 1);
1148
1147
  init_constants();
1148
+ globalInvocationCounter = 0;
1149
1149
  StreamParser = class {
1150
1150
  buffer = "";
1151
1151
  lastReportedTextLength = 0;
1152
1152
  startPrefix;
1153
1153
  endPrefix;
1154
1154
  parameterFormat;
1155
- invocationCounter = 0;
1156
1155
  constructor(options = {}) {
1157
1156
  this.startPrefix = options.startPrefix ?? GADGET_START_PREFIX;
1158
1157
  this.endPrefix = options.endPrefix ?? GADGET_END_PREFIX;
@@ -1219,7 +1218,7 @@ var init_parser = __esm({
1219
1218
  invocationId = parts[1];
1220
1219
  } else {
1221
1220
  actualGadgetName = gadgetName;
1222
- invocationId = `auto_${++this.invocationCounter}`;
1221
+ invocationId = `gadget_${++globalInvocationCounter}`;
1223
1222
  }
1224
1223
  const contentStartIndex = metadataEndIndex + 1;
1225
1224
  let partEndIndex;
@@ -1276,11 +1275,10 @@ var init_parser = __esm({
1276
1275
  yield { type: "text", content: remainingText };
1277
1276
  }
1278
1277
  }
1279
- // Reset parser state
1278
+ // Reset parser state (note: global invocation counter is NOT reset to ensure unique IDs)
1280
1279
  reset() {
1281
1280
  this.buffer = "";
1282
1281
  this.lastReportedTextLength = 0;
1283
- this.invocationCounter = 0;
1284
1282
  }
1285
1283
  };
1286
1284
  }
@@ -4255,7 +4253,7 @@ var import_commander3 = require("commander");
4255
4253
  // package.json
4256
4254
  var package_default = {
4257
4255
  name: "llmist",
4258
- version: "0.1.3",
4256
+ version: "0.1.4",
4259
4257
  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.",
4260
4258
  type: "module",
4261
4259
  main: "dist/index.cjs",
@@ -4339,7 +4337,7 @@ var package_default = {
4339
4337
  chalk: "^5.6.2",
4340
4338
  commander: "^12.1.0",
4341
4339
  "js-yaml": "^4.1.0",
4342
- openai: "^4.0.0",
4340
+ openai: "^6.0.0",
4343
4341
  tiktoken: "^1.0.22",
4344
4342
  tslog: "^4.10.2",
4345
4343
  zod: "^4.1.12"