swarmdo 1.58.1 → 1.58.12

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.
Files changed (25) hide show
  1. package/.claude/helpers/statusline.cjs +146 -11
  2. package/README.md +3 -2
  3. package/package.json +1 -1
  4. package/v3/@swarmdo/cli/.claude/commands/sDo/agents/README.md +1 -1
  5. package/v3/@swarmdo/cli/.claude/commands/sDo/agents/agent-capabilities.md +1 -1
  6. package/v3/@swarmdo/cli/.claude/commands/sDo/agents/agent-types.md +2 -2
  7. package/v3/@swarmdo/cli/.claude/commands/sDo/swarm/swarm.md +1 -1
  8. package/v3/@swarmdo/cli/.claude/helpers/statusline.cjs +770 -498
  9. package/v3/@swarmdo/cli/.claude/skills/sdo-agentic-jujutsu/SKILL.md +645 -0
  10. package/v3/@swarmdo/cli/.claude/skills/sdo-hive-mind-advanced/SKILL.md +709 -0
  11. package/v3/@swarmdo/cli/.claude/skills/sdo-performance-analysis/SKILL.md +560 -0
  12. package/v3/@swarmdo/cli/dist/src/commands/hooks.d.ts +26 -0
  13. package/v3/@swarmdo/cli/dist/src/commands/hooks.js +96 -24
  14. package/v3/@swarmdo/cli/dist/src/commands/integrations.js +185 -2
  15. package/v3/@swarmdo/cli/dist/src/commands/statusline.d.ts +22 -1
  16. package/v3/@swarmdo/cli/dist/src/commands/statusline.js +84 -3
  17. package/v3/@swarmdo/cli/dist/src/commands/swarm.js +5 -0
  18. package/v3/@swarmdo/cli/dist/src/init/statusline-generator.d.ts +1 -1
  19. package/v3/@swarmdo/cli/dist/src/init/statusline-generator.js +146 -11
  20. package/v3/@swarmdo/cli/dist/src/integrations/skills-sync.d.ts +120 -0
  21. package/v3/@swarmdo/cli/dist/src/integrations/skills-sync.js +180 -0
  22. package/v3/@swarmdo/cli/dist/src/mcp-tools/swarm-tools.js +2 -0
  23. package/v3/@swarmdo/cli/dist/src/usage/account-plan.d.ts +48 -0
  24. package/v3/@swarmdo/cli/dist/src/usage/account-plan.js +71 -0
  25. package/v3/@swarmdo/cli/package.json +1 -1
@@ -84,6 +84,43 @@ function resolveSegments() {
84
84
  const SEGMENTS = resolveSegments();
85
85
  function seg(name) { return SEGMENTS.has(name); }
86
86
 
87
+ // ─── Cost slot: plan-aware mode + account display ────────────────────────────
88
+ // Resolution mirrors resolveSegments: env → project config → global config →
89
+ // default. mode: auto|dollars|limits|off (auto → limits for a subscription
90
+ // account, dollars otherwise); showAccount prefixes the account label.
91
+ function resolveCostOptions() {
92
+ let mode = null;
93
+ let showAccount = null;
94
+ const envMode = (process.env.SWARMDO_STATUSLINE_COST_MODE || '').trim().toLowerCase();
95
+ if (envMode === 'auto' || envMode === 'dollars' || envMode === 'limits' || envMode === 'off') mode = envMode;
96
+ const envShow = (process.env.SWARMDO_STATUSLINE_SHOW_ACCOUNT || '').trim();
97
+ if (/^(1|true|yes|on)$/i.test(envShow)) showAccount = true;
98
+ else if (/^(0|false|no|off)$/i.test(envShow)) showAccount = false;
99
+ if (mode === null || showAccount === null) {
100
+ const files = [
101
+ path.join(CWD, '.swarmdo', 'statusline.json'),
102
+ path.join(os.homedir(), '.swarmdo', 'statusline.json'),
103
+ ];
104
+ for (const f of files) {
105
+ try {
106
+ const j = JSON.parse(fs.readFileSync(f, 'utf8'));
107
+ const cost = j && j.cost;
108
+ if (cost && typeof cost === 'object') {
109
+ if (mode === null && typeof cost.mode === 'string') {
110
+ const m = cost.mode.trim().toLowerCase();
111
+ if (m === 'auto' || m === 'dollars' || m === 'limits' || m === 'off') mode = m;
112
+ }
113
+ if (showAccount === null && typeof cost.showAccount === 'boolean') showAccount = cost.showAccount;
114
+ }
115
+ } catch (e) { /* absent/invalid — keep looking */ }
116
+ if (mode !== null && showAccount !== null) break;
117
+ }
118
+ }
119
+ if (CONFIG.hideCost) mode = 'off'; // legacy SWARMDO_STATUSLINE_HIDE_COST
120
+ return { mode: mode || 'auto', showAccount: showAccount === true };
121
+ }
122
+ const COST_OPTS = resolveCostOptions();
123
+
87
124
  // #2337: resolve an already-installed @swarmdo/cli (or swarmdo) bin so we
88
125
  // can invoke it directly via `node`. The previous version called
89
126
  // `npx --yes @swarmdo/cli@latest` on every uncached render, which forces
@@ -331,8 +368,8 @@ function buildLocalFallback() {
331
368
  user: { name: 'user', gitBranch: '', modelName: 'Claude Code' },
332
369
  v3Progress: { domainsCompleted: 0, totalDomains: 5, dddProgress: 0, patternsLearned: 0, sessionsCompleted: 0 },
333
370
  security: { status: 'NONE', critical: 0, high: 0, total: 0 },
334
- swarm: { activeAgents: 0, maxAgents: CONFIG.maxAgents, coordinationActive: false },
335
- system: { memoryMB: memMB, contextPct: 0, intelligencePct: 0, subAgents: 0 },
371
+ swarm: { activeSwarms: 0, activeAgents: 0, coordinationActive: false },
372
+ system: { memoryMB: memMB, contextPct: 0, intelligencePct: 0 },
336
373
  lastUpdated: new Date().toISOString(),
337
374
  });
338
375
  }
@@ -516,13 +553,96 @@ function getCostFromStdin() {
516
553
  return null;
517
554
  }
518
555
 
556
+ // ── Account plan + rate-limit windows (for the plan-aware cost slot) ──────────
557
+ // ~/.claude.json holds only the CURRENTLY active account (overwritten on switch),
558
+ // so we read it live each render — that makes the slot correct across account
559
+ // switches without any stored state. We read a few plan fields, never tokens.
560
+ function readClaudeAccount() {
561
+ try {
562
+ const j = JSON.parse(fs.readFileSync(path.join(os.homedir(), '.claude.json'), 'utf8'));
563
+ const a = j && j.oauthAccount;
564
+ if (a && typeof a === 'object') {
565
+ return { billingType: a.billingType, organizationType: a.organizationType, displayName: a.displayName, organizationName: a.organizationName };
566
+ }
567
+ } catch (e) { /* not logged in / unreadable */ }
568
+ return null;
569
+ }
570
+ function detectPlan(a) {
571
+ if (!a || typeof a !== 'object') return 'unknown';
572
+ const b = typeof a.billingType === 'string' ? a.billingType : '';
573
+ const o = typeof a.organizationType === 'string' ? a.organizationType : '';
574
+ if (/subscription/i.test(b) || /claude_(max|team|enterprise|pro)/i.test(o)) return 'subscription';
575
+ if (b) return 'payg';
576
+ return 'unknown';
577
+ }
578
+ function accountLabel(a) {
579
+ if (!a) return '';
580
+ let raw = (typeof a.displayName === 'string' && a.displayName) || (typeof a.organizationName === 'string' && a.organizationName) || '';
581
+ raw = String(raw).trim();
582
+ if (!raw) return '';
583
+ return raw.length > 16 ? raw.slice(0, 15) + '…' : raw;
584
+ }
585
+ function rlToEpochMs(v) {
586
+ if (typeof v === 'number' && isFinite(v)) return v < 1e12 ? v * 1000 : v;
587
+ if (typeof v === 'string') { const t = Date.parse(v); return isNaN(t) ? null : t; }
588
+ return null;
589
+ }
590
+ function rlPickWindow(obj, windowMs, label) {
591
+ if (!obj || typeof obj !== 'object') return null;
592
+ const used = (obj.used_percentage != null ? obj.used_percentage : obj.usedPercentage);
593
+ const resetsAtMs = rlToEpochMs(obj.resets_at != null ? obj.resets_at : obj.resetsAt);
594
+ if (typeof used !== 'number' || !isFinite(used) || resetsAtMs === null) return null;
595
+ return { label: label, used: Math.max(0, Math.min(100, used)), windowMs: windowMs, resetsAtMs: resetsAtMs };
596
+ }
597
+ function getRateLimitWindows() {
598
+ const data = getStdinData();
599
+ if (!data) return [];
600
+ const rl = data.rate_limits || data.rateLimits || data;
601
+ if (!rl || typeof rl !== 'object') return [];
602
+ const out = [];
603
+ const w5 = rlPickWindow(rl.five_hour || rl.fiveHour, 5 * 60 * 60 * 1000, '5h');
604
+ const w7 = rlPickWindow(rl.seven_day || rl.sevenDay, 7 * 24 * 60 * 60 * 1000, '7d');
605
+ if (w5) out.push(w5);
606
+ if (w7) out.push(w7);
607
+ return out;
608
+ }
609
+ function rlWindowStatus(w, nowMs) {
610
+ if (w.used >= 100) return 'over';
611
+ const windowStart = w.resetsAtMs - w.windowMs;
612
+ const elapsed = nowMs - windowStart;
613
+ let willExhaust = false;
614
+ if (w.used > 0 && elapsed > 0) {
615
+ const msTo100 = ((100 - w.used) * elapsed) / w.used;
616
+ willExhaust = (nowMs + msTo100) <= w.resetsAtMs;
617
+ }
618
+ return (willExhaust || w.used >= 80) ? 'warn' : 'ok';
619
+ }
620
+ // { text, color } for the rate-limit cost slot, or null when Claude Code sent
621
+ // no rate_limits payload (older CC / non-subscription session).
622
+ function renderRateLimitSlot() {
623
+ const wins = getRateLimitWindows();
624
+ if (wins.length === 0) return null;
625
+ const now = Date.now();
626
+ let worst = 'ok';
627
+ const parts = [];
628
+ for (const w of wins) {
629
+ const st = rlWindowStatus(w, now);
630
+ if (st === 'over') worst = 'over';
631
+ else if (st === 'warn' && worst !== 'over') worst = 'warn';
632
+ const mark = st === 'over' ? '!' : st === 'warn' ? '⚠' : '';
633
+ parts.push(w.label + ' ' + Math.round(w.used) + '%' + mark);
634
+ }
635
+ const color = worst === 'over' ? c.brightRed : worst === 'warn' ? c.brightYellow : c.brightGreen;
636
+ return { text: parts.join(' · '), color: color };
637
+ }
638
+
519
639
  // Read package version from the first package.json we find. The fallback
520
640
  // (`BAKED_CLI_VERSION`) is the version of @swarmdo/cli that generated THIS
521
641
  // statusline.cjs at `swarmdo init` time — so even when every probe below
522
642
  // misses, the displayed version is meaningful (matches what the user
523
643
  // installed), not a stale hard-coded string.
524
644
  function getPkgVersion() {
525
- let ver = '1.58.0';
645
+ let ver = '1.58.9';
526
646
  try {
527
647
  const home = os.homedir();
528
648
  const pkgPaths = [
@@ -592,12 +712,11 @@ function generateStatusline() {
592
712
  const totalDomains = progress.totalDomains || 5;
593
713
  const dddProgress = progress.dddProgress || 0;
594
714
  const patternsLearned = progress.patternsLearned || 0;
715
+ const activeSwarms = swarm.activeSwarms || 0;
595
716
  const activeAgents = swarm.activeAgents || 0;
596
- const maxAgents = swarm.maxAgents || CONFIG.maxAgents;
597
717
  const coordinationActive = swarm.coordinationActive || false;
598
718
  const intelligencePct = system.intelligencePct || 0;
599
719
  const memoryMB = system.memoryMB || 0;
600
- const subAgents = system.subAgents || 0;
601
720
  const secCritHigh = (security.critical || 0) + (security.high || 0);
602
721
  const secStatus = security.status || 'NONE';
603
722
  const secLabel = secStatus === 'VULN' ? 'sec ' + secCritHigh + '!' : secStatus === 'CLEAN' ? 'sec ✓' : secStatus === 'STALE' ? 'sec stale' : 'sec —';
@@ -637,8 +756,24 @@ function generateStatusline() {
637
756
  const ctxColor = ctxInfo.usedPct >= 90 ? c.brightRed : ctxInfo.usedPct >= 70 ? c.brightYellow : c.brightGreen;
638
757
  header += ' ' + c.dim + '│' + c.reset + ' ' + ctxColor + '● ' + ctxInfo.usedPct + '% ctx' + c.reset;
639
758
  }
640
- if (seg('cost') && !CONFIG.hideCost && costInfo && costInfo.costUsd > 0) {
641
- header += ' ' + c.dim + '│' + c.reset + ' ' + c.brightYellow + CONFIG.costSymbol + costInfo.costUsd.toFixed(2) + c.reset;
759
+ if (seg('cost') && COST_OPTS.mode !== 'off') {
760
+ const acct = readClaudeAccount();
761
+ let eff = COST_OPTS.mode;
762
+ if (eff === 'auto') eff = detectPlan(acct) === 'subscription' ? 'limits' : 'dollars';
763
+ let slotText = null;
764
+ let slotColor = c.brightYellow;
765
+ if (eff === 'limits') {
766
+ const rl = renderRateLimitSlot();
767
+ if (rl) { slotText = rl.text; slotColor = rl.color; }
768
+ else if (costInfo && costInfo.costUsd > 0) { slotText = CONFIG.costSymbol + costInfo.costUsd.toFixed(2); } // no payload → $ fallback
769
+ } else if (costInfo && costInfo.costUsd > 0) {
770
+ slotText = CONFIG.costSymbol + costInfo.costUsd.toFixed(2);
771
+ }
772
+ if (slotText) {
773
+ let prefix = '';
774
+ if (COST_OPTS.showAccount) { const lbl = accountLabel(acct); if (lbl) prefix = c.dim + lbl + ' · ' + c.reset; }
775
+ header += ' ' + c.dim + '│' + c.reset + ' ' + prefix + slotColor + slotText + c.reset;
776
+ }
642
777
  }
643
778
  if (header) lines.push(header);
644
779
 
@@ -664,16 +799,16 @@ function generateStatusline() {
664
799
  );
665
800
 
666
801
  // Line 2: Swarm + Hooks + CVE + Memory + Intelligence
667
- const swarmInd = coordinationActive ? c.brightGreen + '◉' + c.reset : c.dim + '○' + c.reset;
668
- const agentsColor = activeAgents > 0 ? c.brightGreen : c.red;
802
+ const swarmsColor = activeSwarms > 0 ? c.brightGreen : c.dim;
803
+ const agentsColor = activeAgents > 0 ? c.brightGreen : c.dim;
669
804
  const secIcon = secStatus === 'CLEAN' ? '🟢' : secStatus === 'STALE' ? '🟡' : (secStatus === 'NONE' ? '⚪' : '🔴');
670
805
  const secColor = secStatus === 'CLEAN' ? c.brightGreen : secStatus === 'STALE' ? c.brightYellow : (secStatus === 'NONE' ? c.dim : c.brightRed);
671
806
  const hooksColor = hooksEnabled > 0 ? c.brightGreen : c.dim;
672
807
  const intellColor = intelligencePct >= 80 ? c.brightGreen : intelligencePct >= 40 ? c.brightYellow : c.dim;
673
808
 
674
809
  if (seg('swarm')) lines.push(
675
- c.brightYellow + '🤖 Swarm' + c.reset + ' ' + swarmInd + ' [' + agentsColor + String(activeAgents).padStart(2) + c.reset + '/' + c.brightWhite + maxAgents + c.reset + '] ' +
676
- c.brightPurple + '👥 ' + subAgents + c.reset + ' ' +
810
+ c.brightYellow + '🐝 Swarms' + c.reset + ' ' + swarmsColor + activeSwarms + c.reset + ' ' +
811
+ c.brightYellow + '🤖 Agents' + c.reset + ' ' + agentsColor + activeAgents + c.reset + ' ' +
677
812
  c.brightBlue + '🪝 ' + hooksColor + hooksEnabled + c.reset + '/' + c.brightWhite + hooksTotal + c.reset + ' ' +
678
813
  secIcon + ' ' + secColor + secLabel + c.reset + ' ' +
679
814
  c.brightCyan + '💾 ' + memoryMB + 'MB' + c.reset + ' ' +
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  [![swarmdo](swarmdo/assets/brand/logo-full.svg)](https://swarmdo.com)
4
4
 
5
- [![npm version (swarmdo)](https://img.shields.io/badge/npx%20swarmdo-v1.58.1-cb3837?style=for-the-badge&logo=npm&logoColor=white)](https://github.com/SwarmDo/swarmdo/releases)
5
+ [![npm version (swarmdo)](https://img.shields.io/badge/npx%20swarmdo-v1.58.12-cb3837?style=for-the-badge&logo=npm&logoColor=white)](https://github.com/SwarmDo/swarmdo/releases)
6
6
  [![MIT License](https://img.shields.io/badge/License-MIT-yellow?style=for-the-badge)](https://github.com/SwarmDo/swarmdo/blob/main/LICENSE)
7
7
  [![Website](https://img.shields.io/badge/swarmdo.com-e2a33c?style=for-the-badge&logoColor=black)](https://swarmdo.com)
8
8
  [![Star on GitHub](https://img.shields.io/github/stars/SwarmDo/swarmdo?style=for-the-badge&logo=github&color=gold)](https://github.com/SwarmDo/swarmdo)
@@ -476,7 +476,7 @@ Four docs for four audiences:
476
476
  | **[Status](docs/STATUS.md)** | See what currently works — capability counts, test baselines, recent fixes, what's next. The *is-it-ready* doc. |
477
477
  | **[User Guide](docs/USERGUIDE.md)** | Daily reference — every command, every config flag, every plugin. The *how-do-I* doc. |
478
478
  | **[MetaHarness Guide](docs/metaharness-user-guide.md)** | How to grade your agent setup, scan tool configs for security, detect changes between runs, and eject a project into a standalone agent toolkit. The *audit-my-setup* doc. |
479
- | **[Benchmarks](https://gist.the upstream project (see NOTICE))** | v3.8.0 SOTA matrix vs LangGraph / AutoGen / CrewAI on darwin-arm64 + linux-x64. swarmdo wins cold start, single turn, RSS by 1.3×–1953×. The *is-it-fast* doc. |
479
+ | **[Benchmarks](https://gist.the upstream project (see NOTICE))** | SOTA matrix vs LangGraph / AutoGen / CrewAI on darwin-arm64 + linux-x64. swarmdo wins cold start, single turn, RSS by 1.3×–1953×. The *is-it-fast* doc. |
480
480
  | **[Verification](verification.md)** | Cryptographically prove your installed bytes match the signed witness — `swarmdo verify`. The *trust-but-verify* doc. |
481
481
  | **[Team Gateway Checklist](docs/TEAM-GATEWAY-CHECKLIST.md)** | Before-merge gates, dual-mode handoff, memory namespace sharing, and witness manifest entry per merge. The *safer-team-workflows* doc. |
482
482
 
@@ -493,6 +493,7 @@ User Guide section index:
493
493
  | [Security](docs/USERGUIDE.md#%EF%B8%8F-security) | AIDefence, CVE remediation, validation |
494
494
  | [Ecosystem](docs/USERGUIDE.md#-ecosystem--integrations) | SwarmVector, agentic-flow, Flow Nexus |
495
495
  | [Configuration](docs/USERGUIDE.md#%EF%B8%8F-configuration--reference) | Environment variables, config schema |
496
+ | [Slash Commands & Statusline](docs/USERGUIDE.md#-slash-command-reference) | Every `/sDo:` command + `/sdo-` skill, and every statusline item ([live on swarmdo.com](https://swarmdo.com/#commands)) |
496
497
  | [Plugin Marketplace](https://upstream.github.io/swarmdo) | Browse and install plugins |
497
498
 
498
499
  ---
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "swarmdo",
3
- "version": "1.58.1",
3
+ "version": "1.58.12",
4
4
  "description": "Swarmdo - Enterprise AI agent orchestration for Claude Code. Deploy 60+ specialized agents in coordinated swarms with self-learning, fault-tolerant consensus, vector memory, and MCP integration",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -1,6 +1,6 @@
1
1
  # Agents Commands
2
2
 
3
- Complete agent management commands for Swarmdo V3.
3
+ Complete agent management commands for Swarmdo.
4
4
 
5
5
  ## Available Commands
6
6
 
@@ -6,7 +6,7 @@ type: reference
6
6
 
7
7
  # Agent Capabilities Reference
8
8
 
9
- Matrix of agent capabilities and their specializations for Swarmdo V3.
9
+ Matrix of agent capabilities and their specializations for Swarmdo.
10
10
 
11
11
  ## Capability Matrix
12
12
 
@@ -1,12 +1,12 @@
1
1
  ---
2
2
  name: agent-types
3
- description: Complete guide to all 87 available agent types in Swarmdo V3
3
+ description: Complete guide to all 87 available agent types in Swarmdo
4
4
  type: reference
5
5
  ---
6
6
 
7
7
  # Agent Types Reference
8
8
 
9
- Complete guide to all 87 available agent types in Swarmdo V3.
9
+ Complete guide to all 87 available agent types in Swarmdo.
10
10
 
11
11
  ## Core Development (5)
12
12
 
@@ -1,6 +1,6 @@
1
1
  # /swarm
2
2
 
3
- Main swarm orchestration command for Swarmdo V3.
3
+ Main swarm orchestration command for Swarmdo.
4
4
 
5
5
  ## 🚨 CRITICAL: Background Execution Pattern
6
6