robot-resources 1.12.2 → 1.12.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.
- package/lib/non-oc-wizard.js +63 -16
- package/package.json +1 -1
package/lib/non-oc-wizard.js
CHANGED
|
@@ -131,16 +131,14 @@ async function showPythonPath() {
|
|
|
131
131
|
info(` Detected SDKs: ${result.sdks.join(', ')}`);
|
|
132
132
|
}
|
|
133
133
|
blank();
|
|
134
|
-
info('
|
|
135
|
-
info('
|
|
136
|
-
info('
|
|
134
|
+
info('Run your Python agent — every anthropic / openai / google_generativeai');
|
|
135
|
+
info('SDK call routes through Robot Resources automatically.');
|
|
136
|
+
info('To opt out for a single command: RR_AUTOATTACH=0 python your-script.py');
|
|
137
137
|
} else {
|
|
138
138
|
warn(result.message);
|
|
139
139
|
blank();
|
|
140
140
|
info('Manual install (run inside your venv):');
|
|
141
141
|
info(' pip install --upgrade robot-resources');
|
|
142
|
-
info('Then set:');
|
|
143
|
-
info(' export RR_AUTOATTACH=1');
|
|
144
142
|
}
|
|
145
143
|
blank();
|
|
146
144
|
info('Docs: https://robotresources.ai/docs/crewai');
|
|
@@ -266,19 +264,40 @@ export async function runNonOcWizard({ nonInteractive = false, target = null } =
|
|
|
266
264
|
|
|
267
265
|
const defaultPath = detectDefaultPath() ?? 'js';
|
|
268
266
|
|
|
267
|
+
// Phase 3.6: race the prompt against a timeout. Some agent runners report
|
|
268
|
+
// stdin.isTTY=true (so `nonInteractive` ends up false), then never deliver
|
|
269
|
+
// a keystroke — `select()` blocks forever and the wizard exits silently
|
|
270
|
+
// without firing wizard_path_chosen. The May-2 23:31 RU cluster all hit
|
|
271
|
+
// this: 5 wizard_started events, zero wizard_path_chosen.
|
|
272
|
+
//
|
|
273
|
+
// After SELECT_TIMEOUT_MS, we treat the session as practically
|
|
274
|
+
// non-interactive and fall through to the same auto-detect path the
|
|
275
|
+
// nonInteractive branch above uses (Phase 3.5).
|
|
276
|
+
const SELECT_TIMEOUT_MS = Number(process.env.RR_WIZARD_SELECT_TIMEOUT_MS) || 30_000;
|
|
277
|
+
const TIMED_OUT = Symbol('select_timeout');
|
|
278
|
+
|
|
269
279
|
let chosen;
|
|
280
|
+
let timer;
|
|
270
281
|
try {
|
|
271
|
-
chosen = await
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
+
chosen = await Promise.race([
|
|
283
|
+
select({
|
|
284
|
+
message: 'What are you building?',
|
|
285
|
+
default: defaultPath,
|
|
286
|
+
choices: [
|
|
287
|
+
{ name: PATH_LABELS.js, value: 'js' },
|
|
288
|
+
{ name: PATH_LABELS.python, value: 'python' },
|
|
289
|
+
{ name: PATH_LABELS.mcp, value: 'mcp' },
|
|
290
|
+
{ name: PATH_LABELS.docs, value: 'docs' },
|
|
291
|
+
{ name: PATH_LABELS['install-oc'], value: 'install-oc' },
|
|
292
|
+
],
|
|
293
|
+
}),
|
|
294
|
+
new Promise((resolve) => {
|
|
295
|
+
timer = setTimeout(() => resolve(TIMED_OUT), SELECT_TIMEOUT_MS);
|
|
296
|
+
// Don't keep the event loop alive purely for this timer — once the
|
|
297
|
+
// user picks, the process should be free to exit.
|
|
298
|
+
if (typeof timer.unref === 'function') timer.unref();
|
|
299
|
+
}),
|
|
300
|
+
]);
|
|
282
301
|
} catch (err) {
|
|
283
302
|
// User hit Ctrl-C or terminal closed — exit cleanly, but mark the funnel
|
|
284
303
|
// so we can distinguish "agent shown the prompt and bailed" from
|
|
@@ -288,6 +307,34 @@ export async function runNonOcWizard({ nonInteractive = false, target = null } =
|
|
|
288
307
|
return;
|
|
289
308
|
}
|
|
290
309
|
throw err;
|
|
310
|
+
} finally {
|
|
311
|
+
if (timer) clearTimeout(timer);
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
if (chosen === TIMED_OUT) {
|
|
315
|
+
// No keystroke after SELECT_TIMEOUT_MS — practically non-interactive.
|
|
316
|
+
// Mirror the Phase 3.5 auto-detect logic.
|
|
317
|
+
blank();
|
|
318
|
+
info(`No input received after ${Math.round(SELECT_TIMEOUT_MS / 1000)}s — treating session as non-interactive.`);
|
|
319
|
+
const runtime = detectAgentRuntime();
|
|
320
|
+
let autoTarget = null;
|
|
321
|
+
if (runtime.kind === 'node' || runtime.kind === 'both') autoTarget = 'js';
|
|
322
|
+
else if (runtime.kind === 'python') autoTarget = 'python';
|
|
323
|
+
|
|
324
|
+
if (autoTarget) {
|
|
325
|
+
info(`Detected a ${autoTarget === 'js' ? 'Node' : 'Python'} project — installing the matching shim automatically.`);
|
|
326
|
+
blank();
|
|
327
|
+
await runPath(autoTarget);
|
|
328
|
+
await emitPathChosen(autoTarget);
|
|
329
|
+
return;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
// Truly empty cwd — nothing to install. Surface the timeout so the
|
|
333
|
+
// funnel can be queried separately from genuine aborts.
|
|
334
|
+
blank();
|
|
335
|
+
info('No project shape detected — nothing to install. Re-run with --for=<target>.');
|
|
336
|
+
await emitPathChosen('interactive_timeout');
|
|
337
|
+
return;
|
|
291
338
|
}
|
|
292
339
|
|
|
293
340
|
await runPath(chosen);
|