claude-flow 3.71.2 → 3.71.3

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/auto-memory-hook.mjs +209 -55
  2. package/.claude/proven-config.json +1 -1
  3. package/.claude/security-scans/scan-all-quick.json +201 -0
  4. package/.claude/settings.json +2 -1
  5. package/README.md +2 -0
  6. package/package.json +1 -1
  7. package/v3/@claude-flow/cli/README.md +2 -0
  8. package/v3/@claude-flow/cli/catalog-manifest.json +2 -2
  9. package/v3/@claude-flow/cli/dist/src/commands/daemon.js +20 -1
  10. package/v3/@claude-flow/cli/dist/src/commands/hive-mind-worker.d.ts +10 -0
  11. package/v3/@claude-flow/cli/dist/src/commands/hive-mind-worker.js +20 -0
  12. package/v3/@claude-flow/cli/dist/src/commands/hive-mind.js +27 -4
  13. package/v3/@claude-flow/cli/dist/src/init/settings-generator.js +4 -0
  14. package/v3/@claude-flow/cli/dist/src/mcp-tools/agentdb-tools.js +3 -3
  15. package/v3/@claude-flow/cli/dist/src/mcp-tools/claims-tools.js +16 -9
  16. package/v3/@claude-flow/cli/dist/src/mcp-tools/hooks-tools.js +11 -1
  17. package/v3/@claude-flow/cli/dist/src/mcp-tools/task-tools.js +11 -0
  18. package/v3/@claude-flow/cli/dist/src/missions/schemas.d.ts +10 -10
  19. package/v3/@claude-flow/cli/dist/src/mods/headless-plugins.d.ts +16 -0
  20. package/v3/@claude-flow/cli/dist/src/mods/headless-plugins.js +30 -1
  21. package/v3/@claude-flow/cli/dist/src/services/daemon-autostart.d.ts +24 -0
  22. package/v3/@claude-flow/cli/dist/src/services/daemon-autostart.js +55 -1
  23. package/v3/@claude-flow/cli/dist/src/services/headless-worker-executor.d.ts +15 -0
  24. package/v3/@claude-flow/cli/dist/src/services/headless-worker-executor.js +28 -0
  25. package/v3/@claude-flow/cli/package.json +1 -1
@@ -337,6 +337,23 @@ export function isLocalWorker(type) {
337
337
  export function getModelId(model) {
338
338
  return MODEL_IDS[model];
339
339
  }
340
+ /** Days before a sign-in ends at which the executor emits 'credential-expiring' (matches Claude Code's own stderr warning). */
341
+ export const CREDENTIAL_EXPIRY_WARN_DAYS = 10;
342
+ /**
343
+ * Normalise `credential_expires_at` to ISO 8601. Accepts an ISO string or an
344
+ * epoch number (seconds or milliseconds); anything else is undefined.
345
+ */
346
+ export function normalizeCredentialExpiry(v) {
347
+ let ms;
348
+ if (typeof v === 'number' && Number.isFinite(v) && v > 0)
349
+ ms = v < 1e12 ? v * 1000 : v;
350
+ else if (typeof v === 'string' && v.trim()) {
351
+ const t = Date.parse(v);
352
+ if (Number.isFinite(t))
353
+ ms = t;
354
+ }
355
+ return ms === undefined ? undefined : new Date(ms).toISOString();
356
+ }
340
357
  /**
341
358
  * #2661 root-fix — best-effort parse of `claude --print --output-format
342
359
  * json`'s response envelope. Deliberately lenient: probes a couple of
@@ -371,6 +388,7 @@ export function parseClaudePrintJsonEnvelope(raw) {
371
388
  outputTokens: numOrUndef(usage?.output_tokens ?? usage?.outputTokens),
372
389
  costUsd: numOrUndef(obj.total_cost_usd ?? obj.cost_usd ?? obj.totalCostUsd),
373
390
  durationMs: numOrUndef(obj.duration_ms ?? obj.durationMs),
391
+ credentialExpiresAt: normalizeCredentialExpiry(obj.credential_expires_at ?? obj.credentialExpiresAt),
374
392
  };
375
393
  }
376
394
  /**
@@ -779,7 +797,16 @@ export class HeadlessWorkerExecutor extends EventEmitter {
779
797
  executionId,
780
798
  error: result.error,
781
799
  ...(result.missingPlugins ? { missingPlugins: result.missingPlugins } : {}),
800
+ ...(result.credentialExpiresAt ? { credentialExpiresAt: result.credentialExpiresAt } : {}),
782
801
  };
802
+ // Claude Code 2.1.318: surface a claude.ai sign-in that ends soon, so the
803
+ // daemon can say so before workers start failing on auth.
804
+ if (result.credentialExpiresAt) {
805
+ const daysLeft = (Date.parse(result.credentialExpiresAt) - Date.now()) / 86_400_000;
806
+ if (daysLeft <= CREDENTIAL_EXPIRY_WARN_DAYS) {
807
+ this.emit('credential-expiring', { expiresAt: result.credentialExpiresAt, daysLeft: Math.max(0, Math.floor(daysLeft)), workerType });
808
+ }
809
+ }
783
810
  // Log result
784
811
  this.logExecution(executionId, 'result', JSON.stringify(executionResult, null, 2));
785
812
  // #2661 root-fix — structured per-launch telemetry, receipted
@@ -1182,6 +1209,7 @@ Analyze the above codebase context and provide your response following the forma
1182
1209
  : undefined,
1183
1210
  costUsd: envelope?.costUsd,
1184
1211
  apiDurationMs: envelope?.durationMs,
1212
+ credentialExpiresAt: envelope?.credentialExpiresAt,
1185
1213
  error: code !== 0 ? stderr || `Process exited with code ${code}` : undefined,
1186
1214
  });
1187
1215
  });
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@claude-flow/cli",
3
- "version": "3.71.2",
3
+ "version": "3.71.3",
4
4
  "type": "module",
5
5
  "description": "Ruflo CLI - Enterprise AI agent orchestration with 60+ specialized agents, swarm coordination, MCP server, self-learning hooks, and vector memory for Claude Code",
6
6
  "main": "dist/src/index.js",