@yemi33/minions 0.1.1716 → 0.1.1718
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/CHANGELOG.md +5 -0
- package/bin/minions.js +71 -3
- package/engine/copilot-models.json +1 -1
- package/engine/runtimes/claude.js +3 -1
- package/engine.js +2 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/bin/minions.js
CHANGED
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
const fs = require('fs');
|
|
26
26
|
const path = require('path');
|
|
27
27
|
const os = require('os');
|
|
28
|
-
const { spawn, execSync } = require('child_process');
|
|
28
|
+
const { spawn, spawnSync, execSync } = require('child_process');
|
|
29
29
|
|
|
30
30
|
const PKG_ROOT = path.resolve(__dirname, '..');
|
|
31
31
|
|
|
@@ -205,6 +205,8 @@ let force = rest.includes('--force');
|
|
|
205
205
|
const skipScan = rest.includes('--skip-scan');
|
|
206
206
|
const skipStart = rest.includes('--skip-start') || rest.includes('--no-start');
|
|
207
207
|
const MINIONS_HOME = resolveMinionsHome(cmd === 'init');
|
|
208
|
+
const POST_UPDATE_INIT_TIMEOUT_MS = 120000;
|
|
209
|
+
const POST_UPDATE_RESTART_TIMEOUT_MS = 60000;
|
|
208
210
|
|
|
209
211
|
function isSubpath(parent, child) {
|
|
210
212
|
const rel = path.relative(path.resolve(parent), path.resolve(child));
|
|
@@ -432,6 +434,70 @@ function showChangelog(fromVersion) {
|
|
|
432
434
|
console.log(` cat ${changelogPath}\n`);
|
|
433
435
|
}
|
|
434
436
|
|
|
437
|
+
function writeCommandOutput(stream, output) {
|
|
438
|
+
if (!output) return;
|
|
439
|
+
stream.write(Buffer.isBuffer(output) ? output.toString('utf8') : String(output));
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
function formatPackageCliCommand(args) {
|
|
443
|
+
const initScript = path.join(PKG_ROOT, 'bin', 'minions.js');
|
|
444
|
+
return `node "${initScript}" ${args.join(' ')}`;
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
function runPackageCli(args, timeout) {
|
|
448
|
+
const initScript = path.join(PKG_ROOT, 'bin', 'minions.js');
|
|
449
|
+
const result = spawnSync(process.execPath, [initScript, ...args], {
|
|
450
|
+
cwd: process.cwd(),
|
|
451
|
+
env: { ...process.env, MINIONS_HOME },
|
|
452
|
+
encoding: 'utf8',
|
|
453
|
+
timeout,
|
|
454
|
+
windowsHide: true,
|
|
455
|
+
});
|
|
456
|
+
|
|
457
|
+
writeCommandOutput(process.stdout, result.stdout);
|
|
458
|
+
writeCommandOutput(process.stderr, result.stderr);
|
|
459
|
+
return result;
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
function runPostUpdateInit() {
|
|
463
|
+
const args = ['init', '--force', '--skip-start'];
|
|
464
|
+
const result = runPackageCli(args, POST_UPDATE_INIT_TIMEOUT_MS);
|
|
465
|
+
|
|
466
|
+
if (!result.error && result.status === 0) return;
|
|
467
|
+
|
|
468
|
+
const timedOut = result.error && result.error.code === 'ETIMEDOUT';
|
|
469
|
+
if (timedOut) {
|
|
470
|
+
console.error(`\n ERROR: Post-update initialization timed out after ${POST_UPDATE_INIT_TIMEOUT_MS / 1000}s.`);
|
|
471
|
+
} else {
|
|
472
|
+
const detail = result.error ? result.error.message : `exit code ${result.status}`;
|
|
473
|
+
console.error(`\n ERROR: Post-update initialization failed (${detail}).`);
|
|
474
|
+
}
|
|
475
|
+
console.error(' The npm package update completed, but runtime files were not fully synchronized.');
|
|
476
|
+
console.error(' After npm finishes settling, run:');
|
|
477
|
+
console.error(` ${formatPackageCliCommand(args)}`);
|
|
478
|
+
console.error(` ${formatPackageCliCommand(['restart'])}\n`);
|
|
479
|
+
process.exit(1);
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
function runPostUpdateRestart() {
|
|
483
|
+
const args = ['restart'];
|
|
484
|
+
const result = runPackageCli(args, POST_UPDATE_RESTART_TIMEOUT_MS);
|
|
485
|
+
|
|
486
|
+
if (!result.error && result.status === 0) return;
|
|
487
|
+
|
|
488
|
+
const timedOut = result.error && result.error.code === 'ETIMEDOUT';
|
|
489
|
+
if (timedOut) {
|
|
490
|
+
console.error(`\n ERROR: Post-update restart timed out after ${POST_UPDATE_RESTART_TIMEOUT_MS / 1000}s.`);
|
|
491
|
+
} else {
|
|
492
|
+
const detail = result.error ? result.error.message : `exit code ${result.status}`;
|
|
493
|
+
console.error(`\n ERROR: Post-update restart failed (${detail}).`);
|
|
494
|
+
}
|
|
495
|
+
console.error(' Runtime files were synchronized, but the engine/dashboard were not restarted.');
|
|
496
|
+
console.error(' Run this command to finish the update without using the Windows command shim:');
|
|
497
|
+
console.error(` ${formatPackageCliCommand(args)}\n`);
|
|
498
|
+
process.exit(1);
|
|
499
|
+
}
|
|
500
|
+
|
|
435
501
|
// ─── Version command ────────────────────────────────────────────────────────
|
|
436
502
|
|
|
437
503
|
function showVersion() {
|
|
@@ -544,11 +610,13 @@ if (!cmd || cmd === 'help' || cmd === '--help' || cmd === '-h') {
|
|
|
544
610
|
console.error(' npm update failed:', e.message);
|
|
545
611
|
process.exit(1);
|
|
546
612
|
}
|
|
547
|
-
|
|
613
|
+
// Equivalent to `minions init --force --skip-start`, but avoids recursing through
|
|
614
|
+
// the global shim while npm is still settling the updated install.
|
|
615
|
+
runPostUpdateInit();
|
|
548
616
|
}
|
|
549
617
|
// Restart engine + dashboard so they pick up the new code
|
|
550
618
|
console.log('\n Restarting engine and dashboard...\n');
|
|
551
|
-
|
|
619
|
+
runPostUpdateRestart();
|
|
552
620
|
} else if (cmd === 'version' || cmd === '--version' || cmd === '-v') {
|
|
553
621
|
showVersion();
|
|
554
622
|
} else if (cmd === 'add' || cmd === 'remove' || cmd === 'list' || cmd === 'scan') {
|
|
@@ -456,7 +456,9 @@ function parseError(rawOutput) {
|
|
|
456
456
|
if (!text) return { message: '', code: null, retriable: true };
|
|
457
457
|
const lower = text.toLowerCase();
|
|
458
458
|
|
|
459
|
-
|
|
459
|
+
const hasExplicitAuthFailure = /invalid api key|api key.*invalid|authentication.*fail|\bunauthorized\b|please.*log.*in|claude\.ai\/login/i.test(text);
|
|
460
|
+
const hasAuthStatusCode = /\b(?:http(?:\/\d(?:\.\d)?)?|status(?:\s+code)?|statuscode|response(?:\s+status)?|api(?:\s+(?:error|response|status))?)\s*[:=]?\s*(?:401|403)\b|\b(?:401\s+unauthorized|403\s+forbidden)\b/i.test(text);
|
|
461
|
+
if (hasExplicitAuthFailure || hasAuthStatusCode) {
|
|
460
462
|
return { message: 'Claude authentication failed', code: 'auth-failure', retriable: false };
|
|
461
463
|
}
|
|
462
464
|
if (/prompt is too long|context window|context.*length.*exceeded|token limit|conversation.*too long/i.test(text)) {
|
package/engine.js
CHANGED
|
@@ -1400,9 +1400,9 @@ async function spawnAgent(dispatchItem, config) {
|
|
|
1400
1400
|
const hardContractFail = completionContractFailure?.severity === 'hard'
|
|
1401
1401
|
|| completionContractFailure?.nonTerminal === true;
|
|
1402
1402
|
const effectiveResult = hardContractFail ? DISPATCH_RESULT.ERROR : (((code === 0 && !agentReportedFailure) || autoRecovered) ? DISPATCH_RESULT.SUCCESS : DISPATCH_RESULT.ERROR);
|
|
1403
|
-
const
|
|
1403
|
+
const finalCompletionReportPath = structuredCompletion?._path || dispatchItem.meta?.completionReportPath || shared.dispatchCompletionReportPath(id);
|
|
1404
1404
|
const completionOpts = {
|
|
1405
|
-
...(
|
|
1405
|
+
...(finalCompletionReportPath ? { completionReportPath: finalCompletionReportPath } : {}),
|
|
1406
1406
|
...(structuredCompletion ? { structuredCompletion } : {}),
|
|
1407
1407
|
};
|
|
1408
1408
|
const completeOpts = hardContractFail
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yemi33/minions",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1718",
|
|
4
4
|
"description": "Multi-agent AI dev team that runs from ~/.minions/ — five autonomous agents share a single engine, dashboard, and knowledge base",
|
|
5
5
|
"bin": {
|
|
6
6
|
"minions": "bin/minions.js"
|