claude-flow 3.32.2 → 3.32.9

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 (50) hide show
  1. package/.claude/helpers/statusline.cjs +93 -39
  2. package/.claude-plugin/hooks/hooks.json +3 -1
  3. package/.claude-plugin/scripts/ruflo-hook.cjs +2 -2
  4. package/.claude-plugin/scripts/ruflo-hook.sh +17 -17
  5. package/package.json +9 -3
  6. package/v3/@claude-flow/cli/catalog-manifest.json +2 -2
  7. package/v3/@claude-flow/cli/dist/src/auth/client.d.ts +89 -0
  8. package/v3/@claude-flow/cli/dist/src/auth/client.js +242 -0
  9. package/v3/@claude-flow/cli/dist/src/auth/constants.d.ts +7 -0
  10. package/v3/@claude-flow/cli/dist/src/auth/constants.js +7 -0
  11. package/v3/@claude-flow/cli/dist/src/auth/scopes.d.ts +14 -0
  12. package/v3/@claude-flow/cli/dist/src/auth/scopes.js +21 -0
  13. package/v3/@claude-flow/cli/dist/src/auth/security-bridge.d.ts +36 -0
  14. package/v3/@claude-flow/cli/dist/src/auth/security-bridge.js +42 -0
  15. package/v3/@claude-flow/cli/dist/src/auth/session.d.ts +20 -0
  16. package/v3/@claude-flow/cli/dist/src/auth/session.js +32 -0
  17. package/v3/@claude-flow/cli/dist/src/auth/state.d.ts +19 -0
  18. package/v3/@claude-flow/cli/dist/src/auth/state.js +53 -0
  19. package/v3/@claude-flow/cli/dist/src/auth/types.d.ts +27 -0
  20. package/v3/@claude-flow/cli/dist/src/auth/types.js +11 -0
  21. package/v3/@claude-flow/cli/dist/src/commands/auth.d.ts +15 -0
  22. package/v3/@claude-flow/cli/dist/src/commands/auth.js +244 -0
  23. package/v3/@claude-flow/cli/dist/src/commands/doctor.js +478 -24
  24. package/v3/@claude-flow/cli/dist/src/commands/hooks.js +43 -1
  25. package/v3/@claude-flow/cli/dist/src/commands/index.js +2 -0
  26. package/v3/@claude-flow/cli/dist/src/commands/proxy-lifecycle.d.ts +20 -0
  27. package/v3/@claude-flow/cli/dist/src/commands/proxy-lifecycle.js +277 -0
  28. package/v3/@claude-flow/cli/dist/src/commands/proxy.js +97 -4
  29. package/v3/@claude-flow/cli/dist/src/funnel/message-transport.d.ts +11 -4
  30. package/v3/@claude-flow/cli/dist/src/funnel/message-transport.js +11 -4
  31. package/v3/@claude-flow/cli/dist/src/mcp-tools/memory-tools.js +11 -3
  32. package/v3/@claude-flow/cli/dist/src/memory/graph-edge-writer.d.ts +9 -0
  33. package/v3/@claude-flow/cli/dist/src/memory/graph-edge-writer.js +13 -0
  34. package/v3/@claude-flow/cli/dist/src/memory/memory-bridge.js +32 -5
  35. package/v3/@claude-flow/cli/dist/src/memory/memory-initializer.js +72 -0
  36. package/v3/@claude-flow/cli/dist/src/proxy/install.d.ts +29 -0
  37. package/v3/@claude-flow/cli/dist/src/proxy/install.js +135 -0
  38. package/v3/@claude-flow/cli/dist/src/proxy/lifecycle.d.ts +61 -0
  39. package/v3/@claude-flow/cli/dist/src/proxy/lifecycle.js +249 -0
  40. package/v3/@claude-flow/cli/dist/src/proxy/paths.d.ts +34 -0
  41. package/v3/@claude-flow/cli/dist/src/proxy/paths.js +70 -0
  42. package/v3/@claude-flow/cli/dist/src/proxy/release.d.ts +47 -0
  43. package/v3/@claude-flow/cli/dist/src/proxy/release.js +138 -0
  44. package/v3/@claude-flow/cli/dist/src/proxy/token-bridge.d.ts +5 -0
  45. package/v3/@claude-flow/cli/dist/src/proxy/token-bridge.js +61 -0
  46. package/v3/@claude-flow/cli/dist/src/proxy/verify.d.ts +44 -0
  47. package/v3/@claude-flow/cli/dist/src/proxy/verify.js +68 -0
  48. package/v3/@claude-flow/cli/package.json +6 -4
  49. package/.claude/.proven-config-version +0 -1
  50. package/.claude/proven-config.json +0 -42
@@ -26,11 +26,11 @@ const { execSync } = require('child_process');
26
26
  const os = require('os');
27
27
 
28
28
  // Configuration
29
- const CONFIG = {
30
- maxAgents: 15,
31
- // Header identity defaults to project/repository name. Set `author` to
32
- // retain the previous `git config user.name` display (#2682).
33
- identityMode: (process.env.RUFLO_STATUSLINE_IDENTITY || 'project').toLowerCase(),
29
+ const CONFIG = {
30
+ maxAgents: 15,
31
+ // Header identity defaults to project/repository name. Set `author` to
32
+ // retain the previous `git config user.name` display (#2682).
33
+ identityMode: (process.env.RUFLO_STATUSLINE_IDENTITY || 'project').toLowerCase(),
34
34
  // Session-cost display. Claude Code's cost.total_cost_usd is a client-side
35
35
  // estimate that "may differ from your actual bill" and reads as misleading on
36
36
  // subscription plans, where token usage is not billed per dollar. These let
@@ -213,9 +213,9 @@ function getStatuslineData() {
213
213
  // 60s TTL (#2337 — don't re-spawn the CLI on every rapid re-render) AND the
214
214
  // tighter promo-rotation clock (this fix — don't let a still-fresh 60s
215
215
  // cache silently freeze the promo/insight row across multiple 20s slots).
216
- if (cache.fresh && cache.promoFresh) {
217
- return applyLocalOverlays(overlayMemoPromo(cache.data));
218
- }
216
+ if (cache.fresh && cache.promoFresh) {
217
+ return applyLocalOverlays(overlayMemoPromo(cache.data));
218
+ }
219
219
 
220
220
  // #2337: prefer an already-installed CLI bin via direct `node` invocation —
221
221
  // no npx, no registry round-trip, no @latest re-resolve per render. Try
@@ -422,7 +422,7 @@ function buildLocalFallback() {
422
422
  return applyLocalOverlays({
423
423
  user: { name: 'user', gitBranch: '', modelName: 'Claude Code' },
424
424
  v3Progress: { domainsCompleted: 0, totalDomains: 5, dddProgress: 0, patternsLearned: 0, sessionsCompleted: 0 },
425
- security: { status: 'NONE', findings: 0, cvesFixed: 0, totalCves: 0 },
425
+ security: { status: 'NONE', findings: 0, cvesFixed: 0, totalCves: 0 },
426
426
  swarm: { activeAgents: 0, maxAgents: CONFIG.maxAgents, coordinationActive: false },
427
427
  system: { memoryMB: memMB, contextPct: 0, intelligencePct: 0, subAgents: 0 },
428
428
  lastUpdated: new Date().toISOString(),
@@ -479,16 +479,16 @@ function readJSON(filePath) {
479
479
 
480
480
  // ─── Git info (pure-Node / single exec — needed for branch display) ──────────
481
481
 
482
- function getGitInfo() {
483
- const result = {
484
- name: path.basename(CWD) || 'project', gitBranch: '', modified: 0, untracked: 0,
485
- staged: 0, ahead: 0, behind: 0,
486
- };
487
-
488
- const script = [
489
- 'git rev-parse --show-toplevel 2>/dev/null || pwd',
490
- 'echo "---SEP---"',
491
- 'git config user.name 2>/dev/null || echo user',
482
+ function getGitInfo() {
483
+ const result = {
484
+ name: path.basename(CWD) || 'project', gitBranch: '', modified: 0, untracked: 0,
485
+ staged: 0, ahead: 0, behind: 0,
486
+ };
487
+
488
+ const script = [
489
+ 'git rev-parse --show-toplevel 2>/dev/null || pwd',
490
+ 'echo "---SEP---"',
491
+ 'git config user.name 2>/dev/null || echo user',
492
492
  'echo "---SEP---"',
493
493
  'git branch --show-current 2>/dev/null',
494
494
  'echo "---SEP---"',
@@ -501,14 +501,14 @@ function getGitInfo() {
501
501
  if (!raw) return result;
502
502
 
503
503
  const parts = raw.split('---SEP---').map(function(s) { return s.trim(); });
504
- if (parts.length >= 5) {
505
- const projectName = path.basename(parts[0] || CWD) || path.basename(CWD) || 'project';
506
- const authorName = parts[1] || 'user';
507
- result.name = CONFIG.identityMode === 'author' ? authorName : projectName;
508
- result.gitBranch = parts[2] || '';
509
-
510
- if (parts[3]) {
511
- for (const line of parts[3].split('\n')) {
504
+ if (parts.length >= 5) {
505
+ const projectName = path.basename(parts[0] || CWD) || path.basename(CWD) || 'project';
506
+ const authorName = parts[1] || 'user';
507
+ result.name = CONFIG.identityMode === 'author' ? authorName : projectName;
508
+ result.gitBranch = parts[2] || '';
509
+
510
+ if (parts[3]) {
511
+ for (const line of parts[3].split('\n')) {
512
512
  if (!line || line.length < 2) continue;
513
513
  const x = line[0], y = line[1];
514
514
  if (x === '?' && y === '?') { result.untracked++; continue; }
@@ -517,7 +517,7 @@ function getGitInfo() {
517
517
  }
518
518
  }
519
519
 
520
- const ab = (parts[4] || '0 0').split(/\s+/);
520
+ const ab = (parts[4] || '0 0').split(/\s+/);
521
521
  result.ahead = parseInt(ab[0]) || 0;
522
522
  result.behind = parseInt(ab[1]) || 0;
523
523
  }
@@ -633,12 +633,55 @@ function compareVersions(a, b) {
633
633
  return 0;
634
634
  }
635
635
 
636
+ // #2742: when CWD is a linked git worktree, it has no node_modules of its
637
+ // own (worktrees don't get their own `npm install`), so every CWD-relative
638
+ // probe in getPkgVersion() misses and the version silently falls back to
639
+ // the baked-in default — even though the main repo's install a few
640
+ // directories away is perfectly resolvable. A linked worktree's `.git` is
641
+ // a plain FILE (not a directory) containing `gitdir: <main>/.git/worktrees/
642
+ // <name>`; walk up from CWD to find it, parse the pointer, and strip the
643
+ // trailing `.git/worktrees/<name>` segment to recover the main repo root.
644
+ // Pure fs — no `git rev-parse` spawn (statusline renders are latency-
645
+ // sensitive; this doc comment's neighbors are explicit about avoiding
646
+ // spawns in the render path).
647
+ function resolveWorktreeMainRoot() {
648
+ try {
649
+ let dir = CWD;
650
+ for (;;) {
651
+ const dotGit = path.join(dir, '.git');
652
+ if (fs.existsSync(dotGit)) {
653
+ if (fs.statSync(dotGit).isFile()) {
654
+ const contents = fs.readFileSync(dotGit, 'utf-8');
655
+ const m = contents.match(/^gitdir:\s*(.+)$/m);
656
+ const wtGitDir = m && m[1].trim();
657
+ if (wtGitDir) {
658
+ // Git writes this pointer with forward slashes even on Windows
659
+ // (a git-for-windows convention for its own internal files) —
660
+ // path.sep (backslash on win32) never matches, so normalize
661
+ // before searching rather than building an OS-specific marker.
662
+ const normalized = wtGitDir.replace(/\\/g, '/');
663
+ const marker = '/.git/worktrees/';
664
+ const idx = normalized.lastIndexOf(marker);
665
+ if (idx > 0) return normalized.slice(0, idx);
666
+ }
667
+ }
668
+ return null; // a real (non-worktree) .git dir — nothing to resolve
669
+ }
670
+ const parent = path.dirname(dir);
671
+ if (parent === dir) return null; // reached filesystem root
672
+ dir = parent;
673
+ }
674
+ } catch {
675
+ return null;
676
+ }
677
+ }
678
+
636
679
  function getPkgVersion() {
637
680
  // Baked in at generation time from the real running CLI's own resolved
638
681
  // version (see generateStatuslineScript()'s doc comment) — correct even
639
682
  // when this renders via a pure npx invocation with no local install for
640
683
  // the candidate scan below to find.
641
- let ver = "3.28.0";
684
+ let ver = "3.32.8";
642
685
  try {
643
686
  const home = os.homedir();
644
687
  const pkgPaths = [
@@ -647,6 +690,17 @@ function getPkgVersion() {
647
690
  path.join(CWD, 'node_modules', 'ruflo', 'package.json'),
648
691
  path.join(CWD, 'v3', '@claude-flow', 'cli', 'package.json'),
649
692
  ];
693
+ // #2742: CWD is a linked git worktree with no node_modules of its own —
694
+ // probe the main repo's install too, so a worktree session shows the
695
+ // same version a main-repo session would.
696
+ const worktreeMainRoot = resolveWorktreeMainRoot();
697
+ if (worktreeMainRoot) {
698
+ pkgPaths.push(
699
+ path.join(worktreeMainRoot, 'node_modules', '@claude-flow', 'cli', 'package.json'),
700
+ path.join(worktreeMainRoot, 'node_modules', 'ruflo', 'package.json'),
701
+ path.join(worktreeMainRoot, 'v3', '@claude-flow', 'cli', 'package.json'),
702
+ );
703
+ }
650
704
  // #2221: global installs (npm i -g ruflo) live outside CWD/node_modules, so the
651
705
  // probes above all miss and the version falls back to the hard-coded default.
652
706
  // Derive the global node_modules dir from the running node binary (no npm spawn —
@@ -731,7 +785,7 @@ function generateStatusline() {
731
785
  const intelligencePct = system.intelligencePct || 0;
732
786
  const memoryMB = system.memoryMB || 0;
733
787
  const subAgents = system.subAgents || 0;
734
- const findings = Math.max(0, security.findings || 0);
788
+ const findings = Math.max(0, security.findings || 0);
735
789
  const secStatus = security.status || 'NONE';
736
790
  const adrCount = adrs.count || 0;
737
791
  const adrImpl = adrs.implemented || 0;
@@ -786,7 +840,7 @@ function generateStatusline() {
786
840
  const hooksColor = hooksEnabled > 0 ? c.brightGreen : c.dim;
787
841
  const intellColor = intelligencePct >= 80 ? c.brightGreen : intelligencePct >= 40 ? c.brightYellow : c.dim;
788
842
  const swarmInd = coordinationActive ? c.brightGreen + '◉' + c.reset + ' ' : c.dim + '○' + c.reset + ' ';
789
- const healthAllGreen = (secStatus === 'CLEAN' || secStatus === 'NONE') && findings === 0;
843
+ const healthAllGreen = (secStatus === 'CLEAN' || secStatus === 'NONE') && findings === 0;
790
844
  const opsParts = [];
791
845
  opsParts.push(c.cyan + 'Swarm ' + swarmInd + agentsColor + activeAgents + c.reset + '/' + c.brightWhite + maxAgents + c.reset);
792
846
  if (subAgents > 0) opsParts.push(c.brightPurple + '👥 ' + subAgents + c.reset);
@@ -797,14 +851,14 @@ function generateStatusline() {
797
851
  if (healthAllGreen) {
798
852
  opsParts.push(c.brightGreen + '🛡 ✓' + c.reset);
799
853
  } else {
800
- if (secStatus === 'PENDING') opsParts.push(c.brightYellow + '🛡 scan pending' + c.reset);
801
- else if (secStatus === 'IN_PROGRESS') opsParts.push(c.brightYellow + '🛡 scanning…' + c.reset);
802
- else if (secStatus === 'ISSUES') opsParts.push(c.brightRed + '🛡 findings' + c.reset);
803
- else if (secStatus === 'STALE') opsParts.push(c.brightYellow + '🛡 scan stale' + c.reset);
804
- else if (secStatus !== 'NONE' && secStatus !== 'CLEAN') opsParts.push(c.brightRed + '🛡 ' + secStatus.toLowerCase() + c.reset);
805
- if (findings > 0) {
806
- opsParts.push(c.brightRed + '⚠ ' + findings + ' finding' + (findings === 1 ? '' : 's') + c.reset);
807
- }
854
+ if (secStatus === 'PENDING') opsParts.push(c.brightYellow + '🛡 scan pending' + c.reset);
855
+ else if (secStatus === 'IN_PROGRESS') opsParts.push(c.brightYellow + '🛡 scanning…' + c.reset);
856
+ else if (secStatus === 'ISSUES') opsParts.push(c.brightRed + '🛡 findings' + c.reset);
857
+ else if (secStatus === 'STALE') opsParts.push(c.brightYellow + '🛡 scan stale' + c.reset);
858
+ else if (secStatus !== 'NONE' && secStatus !== 'CLEAN') opsParts.push(c.brightRed + '🛡 ' + secStatus.toLowerCase() + c.reset);
859
+ if (findings > 0) {
860
+ opsParts.push(c.brightRed + '⚠ ' + findings + ' finding' + (findings === 1 ? '' : 's') + c.reset);
861
+ }
808
862
  }
809
863
  lines.push(opsParts.join(' ' + c.dim + '·' + c.reset + ' '));
810
864
 
@@ -1,7 +1,9 @@
1
1
  {
2
2
  "_note": "#1921 — hook commands invoke scripts/ruflo-hook.sh (resilient shim): prefers a locally-installed `ruflo`/`claude-flow` binary, falls back to `npx --prefer-offline`, and always exits 0 so a CLI/install failure (e.g. arborist `Invalid Version` on npm 10.8.x) never surfaces an error in Claude Code or blocks a turn. The trailing `|| true` guards the case where $CLAUDE_PLUGIN_ROOT is unset (older Claude Code) — the hook then no-ops silently. DO NOT revert to a bare `npx <pkg>@alpha hooks …` per fire.",
3
3
  "_platform": "posix",
4
- "_platform_note": "#2132 — This hooks.json uses /bin/bash, POSIX pipelines (jq, xargs, tr), and .sh scripts. It is intentionally POSIX-only (Mac/Linux). On Windows, ruflo init writes a .claude/settings.json that overrides these entries with node-based equivalents via plugins/ruflo-core/scripts/ruflo-hook.cjs. The audit exempts files with _platform:posix from the cross-platform check.",
4
+ "_platform_note": "#2132 — This hooks.json uses /bin/bash, POSIX pipelines (jq, xargs, tr), and .sh scripts. It is intentionally POSIX-only (Mac/Linux) today and known-broken on native Windows (#2721 shape). The previous claim here that `ruflo init` overrides these entries with node-based equivalents on Windows was never actually implemented and is incorrect — Claude Code merges plugin-declared hooks additively with any init-generated settings.json, it does not replace them. This package (separate from plugins/ruflo-core, which got the #2721 fix) still needs its own Windows-compatible rewrite; see _legacy_unaudited_shim below.",
5
+ "_legacy_unaudited_shim": true,
6
+ "_legacy_unaudited_shim_note": "#2721 fixed plugins/ruflo-core and plugins/ruflo-cost-tracker (marketplace-listed in .claude-plugin/marketplace.json) by rewiring hooks.json to a `node -e` bootstrap around scripts/ruflo-hook.cjs. This older, separately-published \"claude-flow\" plugin package (not in the ruflo marketplace list) has its own, larger jq/xargs-based hook set and its own scripts/ruflo-hook.cjs that hooks.json never references — same underlying bug shape, NOT fixed as part of #2721. Needs its own audited pass before this flag can be removed.",
5
7
  "hooks": {
6
8
  "PreToolUse": [
7
9
  {
@@ -14,7 +14,7 @@
14
14
  * Behaviour mirrors ruflo-hook.sh:
15
15
  * 1. Reads hook JSON payload from stdin.
16
16
  * 2. Prefers a locally installed `ruflo` or `claude-flow` binary.
17
- * 3. Falls back to `npx --prefer-offline ruflo@latest`.
17
+ * 3. Falls back to `npx --prefer-offline ruflo@latest`.
18
18
  * 4. Always exits 0 — hook subcommands are best-effort telemetry.
19
19
  * 5. Swallows all stderr — nothing should surface to Claude Code.
20
20
  *
@@ -157,7 +157,7 @@ function main() {
157
157
  // a spurious failure even though the shim itself works correctly.
158
158
  // The bash version doesn't hit this because it backgrounded the work.
159
159
  if (process.env.RUFLO_HOOK_SKIP_NPX !== '1') {
160
- invokeHook('npx', ['--prefer-offline', '--yes', 'ruflo@latest'], hookArgs, stdinData);
160
+ invokeHook('npx', ['--prefer-offline', '--yes', 'ruflo@latest'], hookArgs, stdinData);
161
161
  }
162
162
 
163
163
  done();
@@ -24,29 +24,29 @@
24
24
  # so redirecting it is a pure cleanup with no functional cost.
25
25
  exec 1>/dev/null 2>/dev/null
26
26
 
27
- # Bound every hook process. A partially initialized native embedding pool can
28
- # otherwise keep a logically completed Stop hook alive indefinitely (#2691).
29
- run() {
30
- "$@" &
31
- child=$!
32
- (
33
- sleep 15
34
- kill -TERM "$child" 2>/dev/null || true
35
- sleep 1
36
- kill -KILL "$child" 2>/dev/null || true
37
- ) &
38
- watchdog=$!
39
- wait "$child" 2>/dev/null || true
40
- kill "$watchdog" 2>/dev/null || true
41
- wait "$watchdog" 2>/dev/null || true
42
- }
27
+ # Bound every hook process. A partially initialized native embedding pool can
28
+ # otherwise keep a logically completed Stop hook alive indefinitely (#2691).
29
+ run() {
30
+ "$@" &
31
+ child=$!
32
+ (
33
+ sleep 15
34
+ kill -TERM "$child" 2>/dev/null || true
35
+ sleep 1
36
+ kill -KILL "$child" 2>/dev/null || true
37
+ ) &
38
+ watchdog=$!
39
+ wait "$child" 2>/dev/null || true
40
+ kill "$watchdog" 2>/dev/null || true
41
+ wait "$watchdog" 2>/dev/null || true
42
+ }
43
43
 
44
44
  if command -v ruflo >/dev/null 2>&1; then
45
45
  run ruflo hooks "$@"
46
46
  elif command -v claude-flow >/dev/null 2>&1; then
47
47
  run claude-flow hooks "$@"
48
48
  else
49
- run npx --prefer-offline --yes ruflo@latest hooks "$@"
49
+ run npx --prefer-offline --yes ruflo@latest hooks "$@"
50
50
  fi
51
51
 
52
52
  exit 0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-flow",
3
- "version": "3.32.2",
3
+ "version": "3.32.9",
4
4
  "description": "Ruflo - 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",
@@ -78,11 +78,12 @@
78
78
  "@ruvector/router-linux-x64-gnu": "^0.1.30",
79
79
  "@ruvector/sona": "^0.1.5",
80
80
  "agentdb": "^3.0.0-alpha.17",
81
- "agentic-flow": "^2.0.14"
81
+ "agentic-flow": "^2.0.14",
82
+ "better-sqlite3": "12.9.0"
82
83
  },
83
84
  "overrides": {
84
85
  "ruvector": "^0.2.27",
85
- "better-sqlite3": ">=12.8.0",
86
+ "better-sqlite3": "12.9.0",
86
87
  "js-yaml": ">=4.3.0",
87
88
  "hono": ">=4.12.25",
88
89
  "@ruvector/rvf-wasm": "0.1.5",
@@ -131,6 +132,11 @@
131
132
  "typescript": "^5.0.0",
132
133
  "vitest": "^3.2.6"
133
134
  },
135
+ "pnpm": {
136
+ "overrides": {
137
+ "better-sqlite3": "12.9.0"
138
+ }
139
+ },
134
140
  "engines": {
135
141
  "node": ">=20.0.0"
136
142
  },
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
3
  "generation": 1,
4
- "generatedAt": "2026-07-17T04:00:15.717Z",
5
- "gitSha": "61047df4",
4
+ "generatedAt": "2026-07-20T23:20:52.239Z",
5
+ "gitSha": "745dfbe3",
6
6
  "catalog": {
7
7
  "agents": 164,
8
8
  "tools": 387,
@@ -0,0 +1,89 @@
1
+ /**
2
+ * `ruflo auth login` flow orchestration (ADR-306) — composes
3
+ * `@claude-flow/security`'s ported OAuth primitives (loopback PKCE, OOB
4
+ * manual-paste, refresh) the same way meta-proxy's `oauth/login.rs`
5
+ * orchestrates its own Rust primitives. See security-bridge.ts for why the
6
+ * package is loaded lazily, and oauth/client.ts (in @claude-flow/security)
7
+ * for why this targets the live `auth.cognitum.one` surface rather than
8
+ * ADR-308's unconfirmed `/v1/auth/*` spec.
9
+ *
10
+ * @module auth/client
11
+ */
12
+ import { type OAuthTokenResponse } from './security-bridge.js';
13
+ /** Refresh before there is less than one minute left on the access token. */
14
+ export declare const ACCESS_TOKEN_REFRESH_WINDOW_MS = 60000;
15
+ export interface LoginResult {
16
+ tokens: OAuthTokenResponse;
17
+ method: 'pkce' | 'device' | 'token-stdin';
18
+ }
19
+ /**
20
+ * Best-effort headlessness signal — a false negative just means the browser
21
+ * flow is attempted and a real browser opens fine anyway; a false positive
22
+ * means the user falls back to the manual OOB flow, which always works
23
+ * regardless. Mirrors meta-proxy's `login.rs::is_probably_headless()`.
24
+ */
25
+ export declare function isProbablyHeadless(): boolean;
26
+ /**
27
+ * Validates the OAuth callback params against the request that started the
28
+ * flow — the CSRF-critical step, extracted so it's independently testable.
29
+ * Order matters: an explicit `error` (user denied) and a missing code are
30
+ * reported as their own reasons; a missing or mismatched `state` is always
31
+ * a state-mismatch, even when a code is present.
32
+ */
33
+ export declare function validateCallback(error: string | null, code: string | null, returnedState: string | null, expectedState: string): {
34
+ ok: true;
35
+ code: string;
36
+ } | {
37
+ ok: false;
38
+ reason: 'denied' | 'state-mismatch';
39
+ detail?: string;
40
+ };
41
+ export declare class LoginCancelledError extends Error {
42
+ constructor();
43
+ }
44
+ export declare class LoginDeniedError extends Error {
45
+ constructor(detail: string);
46
+ }
47
+ export declare class StateMismatchError extends Error {
48
+ constructor();
49
+ }
50
+ export declare class NotLoggedInError extends Error {
51
+ constructor(profile: string);
52
+ }
53
+ export declare class SessionOnlyExpiredError extends Error {
54
+ constructor(profile: string);
55
+ }
56
+ export declare class ScopeConsentMismatchError extends Error {
57
+ constructor(profile: string, scopes: string[]);
58
+ }
59
+ /** Browser-based loopback PKCE login — the ADR-306 default for an interactive desktop. */
60
+ export declare function browserLogin(print: (line: string) => void): Promise<LoginResult>;
61
+ /** Headless fallback: prints the authorize URL with the OOB redirect, prompts for the pasted code. */
62
+ export declare function manualLogin(print: (line: string) => void, input?: NodeJS.ReadableStream): Promise<LoginResult>;
63
+ /**
64
+ * `--token-stdin`: reads one JSON object from stdin,
65
+ * `{access_token, refresh_token?, expires_in, scope}`. Wire format is not
66
+ * specified by ADR-306 — defined here as typed JSON rather than a bare
67
+ * token string, so scope/expiry are explicit rather than inferred.
68
+ */
69
+ export declare function tokenStdinLogin(input?: NodeJS.ReadableStream): Promise<LoginResult>;
70
+ /**
71
+ * Refreshes an access token. Classifies failure into network-unreachable
72
+ * vs. a reachable-but-erroring server so callers can print an honest
73
+ * message instead of collapsing both into "offline" (ADR-308 failure
74
+ * policy: local ruflo functionality is never affected by auth being
75
+ * unavailable, but the diagnostic should say WHY it's unavailable).
76
+ */
77
+ export declare function refreshAccessToken(refreshTokenValue: string): Promise<OAuthTokenResponse>;
78
+ /**
79
+ * Returns an access token suitable for an authenticated call.
80
+ *
81
+ * Fast path: a process-memory token with more than one minute remaining.
82
+ * Slow path: load the profile's refresh token from the OS keychain, perform
83
+ * one refresh, persist a rotated refresh token BEFORE exposing the new access
84
+ * token, then update metadata and the process cache. Refresh is deliberately
85
+ * demand-driven: offline-safe commands such as plain `auth status` never call
86
+ * this function and therefore never create background traffic or retry loops.
87
+ */
88
+ export declare function getValidAccessToken(profileName?: string): Promise<string>;
89
+ //# sourceMappingURL=client.d.ts.map