@yemi33/minions 0.1.2240 → 0.1.2241

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/dashboard.js CHANGED
@@ -14178,6 +14178,14 @@ if (require.main === module) {
14178
14178
  // engine reads, port binding) is captured rather than dying silently.
14179
14179
  _installCrashHandlers();
14180
14180
 
14181
+ // Every copilot the dashboard spawns — Command Center, doc-chat, and the CC
14182
+ // worker pool (`copilot --acp`) — inherits this process's COPILOT_HOME. Point
14183
+ // it at the seeded, MCP-filtered home so those `direct:true` copilot calls
14184
+ // load the filtered config instead of the operator's full `~/.copilot` stack
14185
+ // (which would pop a Microsoft auth window per call). Mirrors the engine's
14186
+ // boot-time set. See shared.ensureAgentCopilotHome. Fail-open.
14187
+ try { process.env.COPILOT_HOME = shared.ensureAgentCopilotHome(MINIONS_DIR, CONFIG?.engine); } catch {}
14188
+
14181
14189
  // Pre-warm the per-project git-status cache before accepting requests so
14182
14190
  // the first /api/status after restart already returns gitState='ok' with a
14183
14191
  // real branch instead of the ~8s pending gap that hides the projects-bar
package/engine/shared.js CHANGED
@@ -5666,6 +5666,40 @@ function resolveAgentCopilotHome(minionsDir) {
5666
5666
  return path.join(base, '.minions-agent-copilot-home');
5667
5667
  }
5668
5668
 
5669
+ // Seed the agent COPILOT_HOME's mcp-config (copy of `~/.copilot/mcp-config.json`
5670
+ // MINUS `engine.copilotAgentDisabledMcpServers`) and return the home path. This
5671
+ // is the single source of truth for "what MCP servers may a minions-spawned
5672
+ // copilot load." It is applied to EVERY copilot spawn path — agent dispatches
5673
+ // (engine), internal `llm.callLLM` calls (engine), and CC / doc-chat / the CC
5674
+ // worker pool (dashboard) — by setting `process.env.COPILOT_HOME` at the boot of
5675
+ // both processes, so every copilot CHILD inherits the filtered config. copilot
5676
+ // SPAWNS every server in its config and authenticates it (`--disable-mcp-server`
5677
+ // only hides tools), so any auth-requiring server pops a Microsoft window per
5678
+ // spawn — filtering the config is the only effective control. Idempotent: writes
5679
+ // only when the content changes (safe under concurrent callers). The operator's
5680
+ // real `~/.copilot` (interactive copilot) is never touched. Fail-open.
5681
+ function ensureAgentCopilotHome(minionsDir, engine) {
5682
+ const home = resolveAgentCopilotHome(minionsDir);
5683
+ try {
5684
+ fs.mkdirSync(home, { recursive: true });
5685
+ const disabled = new Set(resolveCopilotAgentDisabledMcpServers(null, engine));
5686
+ let servers = {};
5687
+ try {
5688
+ const userCfgPath = path.join(os.homedir(), '.copilot', 'mcp-config.json');
5689
+ const userCfg = JSON.parse(fs.readFileSync(userCfgPath, 'utf8').replace(/^/, ''));
5690
+ for (const [name, def] of Object.entries(userCfg.mcpServers || {})) {
5691
+ if (!disabled.has(name)) servers[name] = def;
5692
+ }
5693
+ } catch { servers = {}; /* no/unreadable user config → no MCPs */ }
5694
+ const desired = JSON.stringify({ mcpServers: servers }, null, 2);
5695
+ const cfgFile = path.join(home, 'mcp-config.json');
5696
+ let current = null;
5697
+ try { current = fs.readFileSync(cfgFile, 'utf8'); } catch {}
5698
+ if (current !== desired) fs.writeFileSync(cfgFile, desired);
5699
+ } catch { /* fail-open: leave whatever home/config exists */ }
5700
+ return home;
5701
+ }
5702
+
5669
5703
  // ── Spawn cwd vs worktree placement (W-mp73x32w000l143d) ──────────────────────
5670
5704
  // Work types that don't need a git worktree — they read repo state but don't
5671
5705
  // produce code changes. Centralized here so engine.js spawnAgent and any
@@ -8961,6 +8995,7 @@ module.exports = {
8961
8995
  assertWorktreeOutsideProject,
8962
8996
  resolveProjectRootDir,
8963
8997
  resolveAgentCopilotHome,
8998
+ ensureAgentCopilotHome,
8964
8999
  resolveSpawnPaths,
8965
9000
  validateWorkItemWorkdir,
8966
9001
  applyWorkdir,
package/engine.js CHANGED
@@ -1907,27 +1907,12 @@ async function recoverPartialWorktree(rootDir, worktreePath, branchName, gitOpts
1907
1907
  // real ~/.copilot is untouched. Best-effort/fail-open: any failure leaves the
1908
1908
  // inherited COPILOT_HOME so a hiccup never blocks a dispatch.
1909
1909
  function _applyAgentCopilotHome(childEnv) {
1910
- try {
1911
- const home = shared.resolveAgentCopilotHome(MINIONS_DIR);
1912
- fs.mkdirSync(home, { recursive: true });
1913
- const disabled = new Set(shared.resolveCopilotAgentDisabledMcpServers(null, getConfig()?.engine));
1914
- let servers = {};
1915
- try {
1916
- const userCfgPath = path.join(os.homedir(), '.copilot', 'mcp-config.json');
1917
- const userCfg = JSON.parse(fs.readFileSync(userCfgPath, 'utf8').replace(/^/, ''));
1918
- for (const [name, def] of Object.entries(userCfg.mcpServers || {})) {
1919
- if (!disabled.has(name)) servers[name] = def;
1920
- }
1921
- } catch { servers = {}; /* no/unreadable user config → agents get no MCPs */ }
1922
- // Write only when the content changes — keeps concurrent spawns from racing
1923
- // on the shared file (the engine-level list is identical across agents).
1924
- const desired = JSON.stringify({ mcpServers: servers }, null, 2);
1925
- const cfgFile = path.join(home, 'mcp-config.json');
1926
- let current = null;
1927
- try { current = fs.readFileSync(cfgFile, 'utf8'); } catch {}
1928
- if (current !== desired) fs.writeFileSync(cfgFile, desired);
1929
- childEnv.COPILOT_HOME = home;
1930
- } catch { /* leave inherited COPILOT_HOME untouched */ }
1910
+ // Re-seed (picks up Settings changes to the disabled list) + stamp the env.
1911
+ // process.env.COPILOT_HOME is also set at engine boot (see below) so the
1912
+ // child would inherit it anyway; this is belt-and-suspenders + keeps the
1913
+ // seed fresh per dispatch. See shared.ensureAgentCopilotHome.
1914
+ try { childEnv.COPILOT_HOME = shared.ensureAgentCopilotHome(MINIONS_DIR, getConfig()?.engine); }
1915
+ catch { /* leave inherited COPILOT_HOME untouched */ }
1931
1916
  }
1932
1917
 
1933
1918
  async function spawnAgent(dispatchItem, config) {
@@ -10273,6 +10258,14 @@ module.exports = {
10273
10258
  // ─── Entrypoint ─────────────────────────────────────────────────────────────
10274
10259
 
10275
10260
  if (require.main === module) {
10261
+ // Every copilot this process spawns — agent dispatches AND internal
10262
+ // `llm.callLLM` calls (consolidation, classification, meetings, …) — inherits
10263
+ // this process's COPILOT_HOME, so point it at the seeded, MCP-filtered home.
10264
+ // Without this, those `direct:true` copilot calls load the operator's full
10265
+ // `~/.copilot` stack and pop a Microsoft auth window per call. The dashboard
10266
+ // sets the same at its own boot for CC / doc-chat / the CC worker pool.
10267
+ // See shared.ensureAgentCopilotHome. Fail-open.
10268
+ try { process.env.COPILOT_HOME = shared.ensureAgentCopilotHome(MINIONS_DIR, getConfig()?.engine); } catch {}
10276
10269
  const { handleCommand } = require('./engine/cli');
10277
10270
  const [cmd, ...args] = process.argv.slice(2);
10278
10271
  handleCommand(cmd, args);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yemi33/minions",
3
- "version": "0.1.2240",
3
+ "version": "0.1.2241",
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"