micro-models-agent 0.20.1 → 0.20.2

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.
Files changed (2) hide show
  1. package/dist/main.js +6 -291
  2. package/package.json +1 -1
package/dist/main.js CHANGED
@@ -10115,285 +10115,6 @@ var init_web_browse = __esm(() => {
10115
10115
  };
10116
10116
  });
10117
10117
 
10118
- // src/tools/user-input.ts
10119
- import * as readline from "readline";
10120
- function parseSelection(input, optionCount, multiple) {
10121
- const trimmed = input.trim();
10122
- if (!trimmed)
10123
- return null;
10124
- const parts = trimmed.split(",").map((p) => p.trim());
10125
- if (!multiple && parts.length > 1)
10126
- return null;
10127
- const indexes = [];
10128
- for (const part of parts) {
10129
- if (!/^\d+$/.test(part))
10130
- return null;
10131
- const idx = Number(part) - 1;
10132
- if (idx < 0 || idx >= optionCount)
10133
- return null;
10134
- if (indexes.includes(idx))
10135
- return null;
10136
- indexes.push(idx);
10137
- }
10138
- return indexes.length ? indexes : null;
10139
- }
10140
- function formatMenu(question, options, opts = {}) {
10141
- const lines = [question];
10142
- options.forEach((opt, i) => {
10143
- lines.push(` [${i + 1}] ${opt.label} — ${opt.description}`);
10144
- });
10145
- if (opts.allowCustom) {
10146
- lines.push(` [${options.length + 1}] ${t("tool.user_input.custom_option")}`);
10147
- }
10148
- return lines.join(`
10149
- `);
10150
- }
10151
- function choicePrompt(optionCount, multiple) {
10152
- return multiple ? t("tool.user_input.choice_multiple") : t("tool.user_input.choice_single", { max: optionCount });
10153
- }
10154
- function createRl() {
10155
- return readline.createInterface({
10156
- input: process.stdin,
10157
- output: process.stdout
10158
- });
10159
- }
10160
- function promptLine(rl, prompt) {
10161
- return new Promise((resolve11) => {
10162
- rl.question(prompt, (answer) => resolve11(answer));
10163
- });
10164
- }
10165
- async function askText(question) {
10166
- const rl = createRl();
10167
- try {
10168
- const answer = await promptLine(rl, `${question} `);
10169
- return answer.trim();
10170
- } finally {
10171
- rl.close();
10172
- }
10173
- }
10174
- async function askChoice(question, options, opts = {}) {
10175
- const multiple = opts.multiple ?? false;
10176
- const entryCount = options.length + (opts.allowCustom ? 1 : 0);
10177
- const customEntry = options.length;
10178
- const rl = createRl();
10179
- try {
10180
- console.log(formatMenu(question, options, opts));
10181
- for (;; ) {
10182
- const answer = await promptLine(rl, choicePrompt(entryCount, multiple));
10183
- const parsed = parseSelection(answer, entryCount, multiple);
10184
- if (parsed) {
10185
- return parsed.map((i) => opts.allowCustom && i === customEntry ? CUSTOM_INDEX : i);
10186
- }
10187
- console.log(t("tool.user_input.invalid"));
10188
- }
10189
- } finally {
10190
- rl.close();
10191
- }
10192
- }
10193
- async function askUser(question, opts = {}) {
10194
- const header = [opts.progress, opts.header].filter(Boolean).join(" — ");
10195
- const text = header ? `${header}
10196
- ${question}` : question;
10197
- if (!opts.options || opts.options.length === 0) {
10198
- const answer = await askText(text);
10199
- return answer ? [answer] : [];
10200
- }
10201
- const allowCustom = opts.custom ?? true;
10202
- const indexes = await askChoice(text, opts.options, {
10203
- multiple: opts.multiple,
10204
- allowCustom
10205
- });
10206
- const labels = [];
10207
- for (const idx of indexes) {
10208
- if (idx === CUSTOM_INDEX) {
10209
- const custom = await askText(t("tool.user_input.custom_prompt"));
10210
- if (custom)
10211
- labels.push(custom);
10212
- } else {
10213
- labels.push(opts.options[idx].label);
10214
- }
10215
- }
10216
- return labels;
10217
- }
10218
- var CUSTOM_INDEX = -1;
10219
- var init_user_input = __esm(() => {
10220
- init_i18n();
10221
- });
10222
-
10223
- // src/tools/question.ts
10224
- function isOption(val) {
10225
- if (!val || typeof val !== "object")
10226
- return false;
10227
- const opt = val;
10228
- return typeof opt.label === "string" && typeof opt.description === "string";
10229
- }
10230
- function normalizeQuestions(args) {
10231
- const raw = args.questions;
10232
- if (Array.isArray(raw)) {
10233
- const specs = [];
10234
- for (const item of raw) {
10235
- if (!item || typeof item !== "object")
10236
- continue;
10237
- const q = item;
10238
- if (typeof q.question !== "string" || !q.question.trim())
10239
- continue;
10240
- const options = Array.isArray(q.options) ? q.options.filter(isOption) : undefined;
10241
- if (Array.isArray(q.options) && options.length === 0)
10242
- continue;
10243
- specs.push({
10244
- question: q.question,
10245
- header: typeof q.header === "string" ? q.header : undefined,
10246
- options,
10247
- multiple: q.multiple === true,
10248
- custom: q.custom === false ? false : undefined
10249
- });
10250
- }
10251
- return specs;
10252
- }
10253
- if (typeof args.question === "string" && args.question.trim()) {
10254
- return [{ question: args.question }];
10255
- }
10256
- return [];
10257
- }
10258
- var DESCRIPTION = `Use this tool when you need to ask the user questions during execution. This allows you to:
10259
- 1. Gather user preferences or requirements
10260
- 2. Clarify ambiguous instructions
10261
- 3. Get decisions on implementation choices as you work
10262
- 4. Offer choices to the user about what direction to take.
10263
-
10264
- Usage notes:
10265
- - When "custom" is enabled (default), a "Type your own answer" option is added automatically; don't include "Other" or catch-all options
10266
- - Answers are returned as arrays of labels; set "multiple": true to allow selecting more than one
10267
- - If you recommend a specific option, make that the first option in the list and add "(Recommended)" at the end of the label
10268
- - Execution blocks until the user answers every question
10269
- - Omit "options" for a free-text question`, questionTool;
10270
- var init_question = __esm(() => {
10271
- init_i18n();
10272
- init_user_input();
10273
- questionTool = {
10274
- name: "question",
10275
- description: DESCRIPTION,
10276
- tags: ["core"],
10277
- interactive: true,
10278
- parameters: {
10279
- type: "object",
10280
- properties: {
10281
- questions: {
10282
- type: "array",
10283
- description: "Questions to ask",
10284
- items: {
10285
- type: "object",
10286
- properties: {
10287
- question: { type: "string", description: "Complete question" },
10288
- header: {
10289
- type: "string",
10290
- description: "Very short label (max 30 chars)"
10291
- },
10292
- options: {
10293
- type: "array",
10294
- description: "Available choices; omit for a free-text question",
10295
- items: {
10296
- type: "object",
10297
- properties: {
10298
- label: {
10299
- type: "string",
10300
- description: "Display text (1-5 words, concise)"
10301
- },
10302
- description: {
10303
- type: "string",
10304
- description: "Explanation of choice"
10305
- }
10306
- },
10307
- required: ["label", "description"]
10308
- }
10309
- },
10310
- multiple: {
10311
- type: "boolean",
10312
- description: "Allow selecting multiple choices"
10313
- },
10314
- custom: {
10315
- type: "boolean",
10316
- description: "Allow typing a custom answer (default: true)"
10317
- }
10318
- },
10319
- required: ["question"]
10320
- }
10321
- },
10322
- question: {
10323
- type: "string",
10324
- description: "Legacy single free-text question"
10325
- }
10326
- }
10327
- },
10328
- handler: async (ctx, args) => {
10329
- if (ctx.exitOnComplete) {
10330
- return { success: false, output: t("tool.interactive_disabled") };
10331
- }
10332
- const questions = normalizeQuestions(args);
10333
- if (questions.length === 0) {
10334
- return { success: false, output: t("tool.question.no_questions") };
10335
- }
10336
- const answers = [];
10337
- for (let i = 0;i < questions.length; i++) {
10338
- const q = questions[i];
10339
- const progress = questions.length > 1 ? t("tool.question.progress", {
10340
- current: i + 1,
10341
- total: questions.length
10342
- }) : undefined;
10343
- answers.push(await askUser(q.question, {
10344
- header: q.header,
10345
- options: q.options,
10346
- multiple: q.multiple,
10347
- custom: q.custom,
10348
- progress
10349
- }));
10350
- }
10351
- const formatted = questions.map((q, i) => `"${q.question}"="${answers[i].length ? answers[i].join(", ") : t("tool.question.unanswered")}"`).join(", ");
10352
- return {
10353
- success: true,
10354
- output: t("tool.question.answered", { formatted })
10355
- };
10356
- }
10357
- };
10358
- });
10359
-
10360
- // src/tools/approve.ts
10361
- var approveTool;
10362
- var init_approve = __esm(() => {
10363
- init_i18n();
10364
- init_user_input();
10365
- approveTool = {
10366
- name: "approve",
10367
- description: "Request user approval for an action. The user picks Yes or No from a menu.",
10368
- tags: ["core"],
10369
- interactive: true,
10370
- parameters: {
10371
- type: "object",
10372
- properties: {
10373
- action: {
10374
- type: "string",
10375
- description: "Description of the action requiring approval"
10376
- }
10377
- },
10378
- required: ["action"]
10379
- },
10380
- handler: async (ctx, args) => {
10381
- if (ctx.exitOnComplete) {
10382
- return { success: false, output: t("tool.interactive_disabled") };
10383
- }
10384
- const action = String(args.action || "");
10385
- const indexes = await askChoice(t("tool.approve_prompt", { action }), [
10386
- { label: t("tool.approve_yes"), description: t("tool.approve_yes_desc") },
10387
- { label: t("tool.approve_no"), description: t("tool.approve_no_desc") }
10388
- ]);
10389
- if (indexes[0] === 0) {
10390
- return { success: true, output: t("tool.approved") };
10391
- }
10392
- return { success: false, output: t("tool.rejected") };
10393
- }
10394
- };
10395
- });
10396
-
10397
10118
  // src/tools/load-skill.ts
10398
10119
  function createLoadSkillTool(skillsModule) {
10399
10120
  return {
@@ -12394,8 +12115,6 @@ function registerAllTools(registry2, skillsModule) {
12394
12115
  webSearchTool,
12395
12116
  webFetchTool,
12396
12117
  webBrowseTool,
12397
- questionTool,
12398
- approveTool,
12399
12118
  pipelineRunTool,
12400
12119
  mcpCallTool,
12401
12120
  searchHistoryTool,
@@ -12428,8 +12147,6 @@ var init_tools = __esm(() => {
12428
12147
  init_web_search();
12429
12148
  init_web_fetch();
12430
12149
  init_web_browse();
12431
- init_question();
12432
- init_approve();
12433
12150
  init_load_skill();
12434
12151
  init_pipeline_run();
12435
12152
  init_mcp_call();
@@ -13336,9 +13053,7 @@ Sub-tasks: ${note}`
13336
13053
  "glob",
13337
13054
  "grep",
13338
13055
  "file_info",
13339
- "load_skill",
13340
- "question",
13341
- "approve"
13056
+ "load_skill"
13342
13057
  ];
13343
13058
  if (allowedAlways.includes(call.name))
13344
13059
  return null;
@@ -15629,7 +15344,7 @@ init_config();
15629
15344
  init_colors();
15630
15345
  init_i18n();
15631
15346
  init_spinner();
15632
- import * as readline2 from "readline";
15347
+ import * as readline from "readline";
15633
15348
 
15634
15349
  // src/ui/box.ts
15635
15350
  init_string_width();
@@ -15809,7 +15524,7 @@ async function testChat(apiBase, apiKey, model) {
15809
15524
  }
15810
15525
  async function runSetup() {
15811
15526
  console.log(t("setup.title"));
15812
- const rl = readline2.createInterface({
15527
+ const rl = readline.createInterface({
15813
15528
  input: process.stdin,
15814
15529
  output: process.stdout
15815
15530
  });
@@ -16676,7 +16391,7 @@ init_bootstrap();
16676
16391
 
16677
16392
  // src/cli/repl.ts
16678
16393
  init_colors();
16679
- import * as readline3 from "readline";
16394
+ import * as readline2 from "readline";
16680
16395
  import { existsSync as existsSync35, readFileSync as readFileSync24, writeFileSync as writeFileSync15 } from "fs";
16681
16396
  import { join as join29, dirname as dirname10 } from "path";
16682
16397
  import { homedir as homedir14 } from "os";
@@ -17207,7 +16922,7 @@ class Repl {
17207
16922
  this.registerSessionCommands();
17208
16923
  this.registerSkillCommands();
17209
16924
  this.setupCompleter();
17210
- this.rl = readline3.createInterface({
16925
+ this.rl = readline2.createInterface({
17211
16926
  input: process.stdin,
17212
16927
  output: process.stdout,
17213
16928
  prompt: pc.cyan("> "),
@@ -17844,7 +17559,7 @@ class Repl {
17844
17559
  this.running = false;
17845
17560
  });
17846
17561
  if (process.stdin.isTTY) {
17847
- readline3.emitKeypressEvents(process.stdin);
17562
+ readline2.emitKeypressEvents(process.stdin);
17848
17563
  process.stdin.on("keypress", async (str, key) => {
17849
17564
  if (key.name === "escape") {
17850
17565
  const now = Date.now();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "micro-models-agent",
3
- "version": "0.20.1",
3
+ "version": "0.20.2",
4
4
  "description": "Micro Models Agent (MMA) — LLM agent harness for small models (Qwen3.5-9B, 32K-64K context)",
5
5
  "type": "module",
6
6
  "bin": {