multi-agents-cli 1.1.73 → 1.1.74
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/lib/steps.js +3 -2
- package/lib/ui.js +23 -15
- package/package.json +1 -1
package/lib/steps.js
CHANGED
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
const BACK = Symbol('BACK');
|
|
6
6
|
const CONTINUE = Symbol('CONTINUE');
|
|
7
|
-
const RESTART
|
|
7
|
+
const RESTART = Symbol('RESTART');
|
|
8
|
+
const SHOW_LIST = Symbol('SHOW_LIST');
|
|
8
9
|
|
|
9
10
|
// ── Step machine ──────────────────────────────────────────────────────────────
|
|
10
11
|
|
|
@@ -132,4 +133,4 @@ const runQuestions = async (stepDefs, machine) => {
|
|
|
132
133
|
|
|
133
134
|
// ── Exports ───────────────────────────────────────────────────────────────────
|
|
134
135
|
|
|
135
|
-
module.exports = { StepMachine, BACK, CONTINUE, RESTART, runQuestions };
|
|
136
|
+
module.exports = { StepMachine, BACK, CONTINUE, RESTART, SHOW_LIST, runQuestions };
|
package/lib/ui.js
CHANGED
|
@@ -120,7 +120,7 @@ const stepHeader = (stepIndex, totalSteps) => {
|
|
|
120
120
|
|
|
121
121
|
// ── Step selection helpers ────────────────────────────────────────────────────
|
|
122
122
|
|
|
123
|
-
const { BACK, RESTART } = require('./steps');
|
|
123
|
+
const { BACK, RESTART, SHOW_LIST } = require('./steps');
|
|
124
124
|
const { validateCombination, resolveFramework } = require('./validate');
|
|
125
125
|
const { BLOCKS } = require('./data-config');
|
|
126
126
|
|
|
@@ -154,7 +154,7 @@ const handleFreeText = async (prompt, items, stepMachine, stepIndex, context, is
|
|
|
154
154
|
{ label: `→ Type a different value` },
|
|
155
155
|
{ label: `→ Choose from the ${block} list` },
|
|
156
156
|
]);
|
|
157
|
-
if (choice === 1) return
|
|
157
|
+
if (choice === 1) return SHOW_LIST;
|
|
158
158
|
return handleFreeText(prompt, items, stepMachine, stepIndex, context, isOptional, block);
|
|
159
159
|
}
|
|
160
160
|
|
|
@@ -170,14 +170,17 @@ const handleFreeText = async (prompt, items, stepMachine, stepIndex, context, is
|
|
|
170
170
|
return typed;
|
|
171
171
|
}
|
|
172
172
|
|
|
173
|
-
// unverified - risk block
|
|
173
|
+
// unverified - show options first, risk block only if user insists
|
|
174
174
|
console.log('');
|
|
175
|
-
const
|
|
176
|
-
|
|
177
|
-
`→
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
if (
|
|
175
|
+
const unverifiedChoice = await arrowSelect(`"${typed}" couldn't be verified.`, [
|
|
176
|
+
{ label: `→ Type a different value` },
|
|
177
|
+
{ label: `→ Choose from the ${block || 'available'} list` },
|
|
178
|
+
{ label: `→ Proceed with "${typed}" - I accept the risks` },
|
|
179
|
+
]);
|
|
180
|
+
if (unverifiedChoice === 0) return handleFreeText(prompt, items, stepMachine, stepIndex, context, isOptional, block);
|
|
181
|
+
if (unverifiedChoice === 1) return SHOW_LIST;
|
|
182
|
+
|
|
183
|
+
// Proceed with risks - show consequence block
|
|
181
184
|
console.log('');
|
|
182
185
|
console.log(` ${yellow('⚠ Proceeding with an unverified framework may result in:')}`);
|
|
183
186
|
console.log(dim(' · Agent spending excessive tokens resolving unknown setup'));
|
|
@@ -193,9 +196,7 @@ const handleFreeText = async (prompt, items, stepMachine, stepIndex, context, is
|
|
|
193
196
|
|
|
194
197
|
const check = validateCombination(typed, context);
|
|
195
198
|
if (!check.valid) {
|
|
196
|
-
console.log(`
|
|
197
|
-
${yellow('⚠')} ${check.reason}
|
|
198
|
-
`);
|
|
199
|
+
console.log(`\n ${yellow('⚠')} ${check.reason}\n`);
|
|
199
200
|
const opts = [
|
|
200
201
|
'→ Continue - I understand the tradeoff',
|
|
201
202
|
...check.alternatives.map(a => `→ ${a}`),
|
|
@@ -206,7 +207,6 @@ const handleFreeText = async (prompt, items, stepMachine, stepIndex, context, is
|
|
|
206
207
|
if (choice === opts.length - 1) return handleFreeText(prompt, items, stepMachine, stepIndex, context, isOptional, block);
|
|
207
208
|
return check.alternatives[choice - 1];
|
|
208
209
|
}
|
|
209
|
-
|
|
210
210
|
console.log(dim(' Custom value - the agent will handle compatibility at runtime.'));
|
|
211
211
|
return typed;
|
|
212
212
|
};
|
|
@@ -218,7 +218,11 @@ const selectRequired = async (prompt, items, stepMachine, stepIndex, context = {
|
|
|
218
218
|
|
|
219
219
|
const idx = await arrowSelect(prompt, allItems.map(i => ({ label: typeof i === 'string' ? i : i.label })));
|
|
220
220
|
|
|
221
|
-
if (block !== null && idx === items.length)
|
|
221
|
+
if (block !== null && idx === items.length) {
|
|
222
|
+
const ftResult = await handleFreeText(prompt, items, stepMachine, stepIndex, context, false, block);
|
|
223
|
+
if (ftResult === SHOW_LIST) return selectRequired(prompt, items, stepMachine, stepIndex, context, block);
|
|
224
|
+
return ftResult;
|
|
225
|
+
}
|
|
222
226
|
|
|
223
227
|
const navStart = block !== null ? items.length + 1 : items.length;
|
|
224
228
|
if (idx >= navStart) {
|
|
@@ -244,7 +248,11 @@ const selectOptional = async (prompt, items, stepMachine, stepIndex, context = {
|
|
|
244
248
|
if (idx === items.length) return null; // skip
|
|
245
249
|
|
|
246
250
|
const noneIdx = block !== null ? items.length + 1 : -1;
|
|
247
|
-
if (block !== null && idx === noneIdx)
|
|
251
|
+
if (block !== null && idx === noneIdx) {
|
|
252
|
+
const ftResult = await handleFreeText(prompt, items, stepMachine, stepIndex, context, true, block);
|
|
253
|
+
if (ftResult === SHOW_LIST) return selectOptional(prompt, items, stepMachine, stepIndex, context, block);
|
|
254
|
+
return ftResult;
|
|
255
|
+
}
|
|
248
256
|
|
|
249
257
|
const navStart = block !== null ? items.length + 2 : items.length + 1;
|
|
250
258
|
if (idx >= navStart) {
|
package/package.json
CHANGED