@blockrun/runcode 1.6.1 → 1.6.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.
@@ -0,0 +1,6 @@
1
+ /**
2
+ * AskUser capability — let the agent ask the user a clarifying question.
3
+ * The question is displayed and the response is returned as tool output.
4
+ */
5
+ import type { CapabilityHandler } from '../agent/types.js';
6
+ export declare const askUserCapability: CapabilityHandler;
@@ -0,0 +1,58 @@
1
+ /**
2
+ * AskUser capability — let the agent ask the user a clarifying question.
3
+ * The question is displayed and the response is returned as tool output.
4
+ */
5
+ import readline from 'node:readline';
6
+ import chalk from 'chalk';
7
+ async function execute(input, _ctx) {
8
+ const { question, options } = input;
9
+ if (!question) {
10
+ return { output: 'Error: question is required', isError: true };
11
+ }
12
+ console.error('');
13
+ console.error(chalk.yellow(' ╭─ Question ────────────────────────────'));
14
+ console.error(chalk.yellow(` │ ${question}`));
15
+ if (options && options.length > 0) {
16
+ for (let i = 0; i < options.length; i++) {
17
+ console.error(chalk.dim(` │ ${i + 1}. ${options[i]}`));
18
+ }
19
+ }
20
+ console.error(chalk.yellow(' ╰───────────────────────────────────────'));
21
+ const rl = readline.createInterface({
22
+ input: process.stdin,
23
+ output: process.stderr,
24
+ terminal: process.stdin.isTTY ?? false,
25
+ });
26
+ return new Promise((resolve) => {
27
+ let answered = false;
28
+ rl.question(chalk.bold(' answer> '), (answer) => {
29
+ answered = true;
30
+ rl.close();
31
+ resolve({ output: answer.trim() || '(no response)' });
32
+ });
33
+ rl.on('close', () => {
34
+ if (!answered)
35
+ resolve({ output: '(user skipped)' });
36
+ });
37
+ });
38
+ }
39
+ export const askUserCapability = {
40
+ spec: {
41
+ name: 'AskUser',
42
+ description: 'Ask the user a clarifying question. Use when you need more information before proceeding.',
43
+ input_schema: {
44
+ type: 'object',
45
+ properties: {
46
+ question: { type: 'string', description: 'The question to ask the user' },
47
+ options: {
48
+ type: 'array',
49
+ items: { type: 'string' },
50
+ description: 'Optional list of suggested answers to present',
51
+ },
52
+ },
53
+ required: ['question'],
54
+ },
55
+ },
56
+ execute,
57
+ concurrent: false,
58
+ };
@@ -11,6 +11,7 @@ import { webFetchCapability } from './webfetch.js';
11
11
  import { webSearchCapability } from './websearch.js';
12
12
  import { taskCapability } from './task.js';
13
13
  import { imageGenCapability } from './imagegen.js';
14
+ import { askUserCapability } from './askuser.js';
14
15
  /** All capabilities available to the runcode agent (excluding sub-agent, which needs config). */
15
16
  export const allCapabilities = [
16
17
  readCapability,
@@ -23,6 +24,7 @@ export const allCapabilities = [
23
24
  webSearchCapability,
24
25
  taskCapability,
25
26
  imageGenCapability,
27
+ askUserCapability,
26
28
  ];
27
29
  export { readCapability, writeCapability, editCapability, bashCapability, globCapability, grepCapability, webFetchCapability, webSearchCapability, taskCapability, };
28
30
  export { createSubAgentCapability } from './subagent.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blockrun/runcode",
3
- "version": "1.6.1",
3
+ "version": "1.6.2",
4
4
  "description": "RunCode — AI coding agent powered by 41+ models. Pay per use with USDC.",
5
5
  "type": "module",
6
6
  "bin": {