multi-agents-cli 1.1.72 → 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 +28 -23
- 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
|
|
|
@@ -149,15 +149,12 @@ const handleFreeText = async (prompt, items, stepMachine, stepIndex, context, is
|
|
|
149
149
|
if (resolved.status === 'valid') return resolved.match;
|
|
150
150
|
|
|
151
151
|
if (resolved.status === 'partial_cross') {
|
|
152
|
-
console.log(`
|
|
153
|
-
|
|
154
|
-
`
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
];
|
|
159
|
-
const choice = await arrowSelect('What would you like to do?', opts.map(o => ({ label: o })));
|
|
160
|
-
if (choice < resolved.matches.length) return resolved.matches[choice];
|
|
152
|
+
console.log(`\n ${yellow('⚠')} ${resolved.message}\n`);
|
|
153
|
+
const choice = await arrowSelect(`"${typed}" couldn't be verified.`, [
|
|
154
|
+
{ label: `→ Type a different value` },
|
|
155
|
+
{ label: `→ Choose from the ${block} list` },
|
|
156
|
+
]);
|
|
157
|
+
if (choice === 1) return SHOW_LIST;
|
|
161
158
|
return handleFreeText(prompt, items, stepMachine, stepIndex, context, isOptional, block);
|
|
162
159
|
}
|
|
163
160
|
|
|
@@ -173,14 +170,17 @@ const handleFreeText = async (prompt, items, stepMachine, stepIndex, context, is
|
|
|
173
170
|
return typed;
|
|
174
171
|
}
|
|
175
172
|
|
|
176
|
-
// unverified - risk block
|
|
173
|
+
// unverified - show options first, risk block only if user insists
|
|
177
174
|
console.log('');
|
|
178
|
-
const
|
|
179
|
-
|
|
180
|
-
`→
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
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
|
|
184
184
|
console.log('');
|
|
185
185
|
console.log(` ${yellow('⚠ Proceeding with an unverified framework may result in:')}`);
|
|
186
186
|
console.log(dim(' · Agent spending excessive tokens resolving unknown setup'));
|
|
@@ -196,9 +196,7 @@ const handleFreeText = async (prompt, items, stepMachine, stepIndex, context, is
|
|
|
196
196
|
|
|
197
197
|
const check = validateCombination(typed, context);
|
|
198
198
|
if (!check.valid) {
|
|
199
|
-
console.log(`
|
|
200
|
-
${yellow('⚠')} ${check.reason}
|
|
201
|
-
`);
|
|
199
|
+
console.log(`\n ${yellow('⚠')} ${check.reason}\n`);
|
|
202
200
|
const opts = [
|
|
203
201
|
'→ Continue - I understand the tradeoff',
|
|
204
202
|
...check.alternatives.map(a => `→ ${a}`),
|
|
@@ -209,7 +207,6 @@ const handleFreeText = async (prompt, items, stepMachine, stepIndex, context, is
|
|
|
209
207
|
if (choice === opts.length - 1) return handleFreeText(prompt, items, stepMachine, stepIndex, context, isOptional, block);
|
|
210
208
|
return check.alternatives[choice - 1];
|
|
211
209
|
}
|
|
212
|
-
|
|
213
210
|
console.log(dim(' Custom value - the agent will handle compatibility at runtime.'));
|
|
214
211
|
return typed;
|
|
215
212
|
};
|
|
@@ -221,7 +218,11 @@ const selectRequired = async (prompt, items, stepMachine, stepIndex, context = {
|
|
|
221
218
|
|
|
222
219
|
const idx = await arrowSelect(prompt, allItems.map(i => ({ label: typeof i === 'string' ? i : i.label })));
|
|
223
220
|
|
|
224
|
-
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
|
+
}
|
|
225
226
|
|
|
226
227
|
const navStart = block !== null ? items.length + 1 : items.length;
|
|
227
228
|
if (idx >= navStart) {
|
|
@@ -247,7 +248,11 @@ const selectOptional = async (prompt, items, stepMachine, stepIndex, context = {
|
|
|
247
248
|
if (idx === items.length) return null; // skip
|
|
248
249
|
|
|
249
250
|
const noneIdx = block !== null ? items.length + 1 : -1;
|
|
250
|
-
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
|
+
}
|
|
251
256
|
|
|
252
257
|
const navStart = block !== null ? items.length + 2 : items.length + 1;
|
|
253
258
|
if (idx >= navStart) {
|
package/package.json
CHANGED