claude-flow 3.77.1 → 3.77.2

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 (43) hide show
  1. package/.claude/helpers/hook-handler.cjs +85 -5
  2. package/README.md +12 -2
  3. package/node_modules/@claude-flow/plugin-agent-federation/README.md +18 -0
  4. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/inbound-dispatcher.d.ts +4 -1
  5. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/inbound-dispatcher.d.ts.map +1 -1
  6. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/inbound-dispatcher.js +11 -0
  7. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/inbound-dispatcher.js.map +1 -1
  8. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/inbound-envelope-guard.d.ts +29 -0
  9. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/inbound-envelope-guard.d.ts.map +1 -0
  10. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/inbound-envelope-guard.js +96 -0
  11. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/inbound-envelope-guard.js.map +1 -0
  12. package/node_modules/@claude-flow/plugin-agent-federation/dist/plugin.d.ts.map +1 -1
  13. package/node_modules/@claude-flow/plugin-agent-federation/dist/plugin.js +3 -0
  14. package/node_modules/@claude-flow/plugin-agent-federation/dist/plugin.js.map +1 -1
  15. package/package.json +8 -5
  16. package/v3/@claude-flow/cli/README.md +5 -0
  17. package/v3/@claude-flow/cli/bin/cli.js +8 -3
  18. package/v3/@claude-flow/cli/dist/src/commands/init.js +8 -1
  19. package/v3/@claude-flow/cli/dist/src/commands/session.js +2 -1
  20. package/v3/@claude-flow/cli/dist/src/commands/workflow.js +2 -1
  21. package/v3/@claude-flow/cli/dist/src/init/helpers-generator.js +85 -5
  22. package/v3/@claude-flow/cli/dist/src/mcp-tools/agent-execute-core.js +26 -25
  23. package/v3/@claude-flow/cli/dist/src/mcp-tools/agent-tools.js +161 -157
  24. package/v3/@claude-flow/cli/dist/src/mcp-tools/claims-tools.js +257 -258
  25. package/v3/@claude-flow/cli/dist/src/mcp-tools/hive-mind-tools.js +48 -29
  26. package/v3/@claude-flow/cli/dist/src/mcp-tools/hooks-tools.js +6 -0
  27. package/v3/@claude-flow/cli/dist/src/mcp-tools/locked-json-store.d.ts +20 -0
  28. package/v3/@claude-flow/cli/dist/src/mcp-tools/locked-json-store.js +99 -0
  29. package/v3/@claude-flow/cli/dist/src/mcp-tools/managed-agent-tools.js +51 -7
  30. package/v3/@claude-flow/cli/dist/src/mcp-tools/session-tools.js +19 -9
  31. package/v3/@claude-flow/cli/dist/src/mcp-tools/task-tools.js +299 -270
  32. package/v3/@claude-flow/cli/dist/src/mcp-tools/workflow-tools.js +245 -215
  33. package/v3/@claude-flow/cli/dist/src/memory/memory-initializer.js +5 -4
  34. package/v3/@claude-flow/cli/dist/src/missions/schemas.d.ts +38 -38
  35. package/v3/@claude-flow/cli/dist/src/mods/command-registry/schema.d.ts +210 -210
  36. package/v3/@claude-flow/cli/dist/src/services/managed-run-store.d.ts +11 -0
  37. package/v3/@claude-flow/cli/dist/src/services/managed-run-store.js +125 -3
  38. package/v3/@claude-flow/cli/dist/src/services/policy-runtime.d.ts +3 -0
  39. package/v3/@claude-flow/cli/dist/src/services/policy-runtime.js +3 -1
  40. package/v3/@claude-flow/cli/package.json +9 -6
  41. package/v3/@claude-flow/guidance/package.json +1 -0
  42. package/.claude/.proven-config-version +0 -1
  43. package/.claude/proven-config.json +0 -42
@@ -8,7 +8,7 @@ import * as fs from 'fs';
8
8
  import * as path from 'path';
9
9
  import { AsyncLocalStorage } from 'node:async_hooks';
10
10
  import { createRequire } from 'node:module';
11
- import { readFileMaybeEncrypted, writeDbImagePreservingFormat, writeFileRestricted } from '../fs-secure.js';
11
+ import { readFileMaybeEncrypted, writeDbImagePreservingFormat, writeFileAtomic, writeFileRestricted } from '../fs-secure.js';
12
12
  import { _resetEmbeddingConfigCache, DEFAULT_EMBEDDING_DIMENSION, resolveEffectiveEmbeddingConfig, resolveEmbeddingConfig, } from './embedding-config.js';
13
13
  import { restoreMemoryDbFromBackup } from '../services/memory-backup.js';
14
14
  import { validateIdentifier } from '../mcp-tools/validate-input.js';
@@ -739,10 +739,11 @@ function saveHNSWMetadata() {
739
739
  const swarmDir = getMemoryRoot();
740
740
  const metadataPath = path.join(swarmDir, 'hnsw.metadata.json');
741
741
  const metadata = Array.from(hnswIndex.entries.entries());
742
- fs.writeFileSync(metadataPath, JSON.stringify(metadata));
742
+ writeFileAtomic(metadataPath, Buffer.from(JSON.stringify(metadata), 'utf-8'));
743
743
  }
744
- catch {
745
- // Silently fail - metadata save is best-effort
744
+ catch (error) {
745
+ // Metadata is best-effort, but persistence failures must be visible.
746
+ console.warn('[memory] Failed to save hnsw.metadata.json:', error instanceof Error ? error.message : String(error));
746
747
  }
747
748
  }
748
749
  export function removeHNSWEntriesByLogicalKey(entries, key, namespace) {
@@ -45,12 +45,12 @@ export declare const missionRecordSchema: z.ZodObject<{
45
45
  digest: z.ZodString;
46
46
  taskGraphRef: z.ZodString;
47
47
  }, "strict", z.ZodTypeAny, {
48
- revision: number;
49
48
  digest: string;
49
+ revision: number;
50
50
  taskGraphRef: string;
51
51
  }, {
52
- revision: number;
53
52
  digest: string;
53
+ revision: number;
54
54
  taskGraphRef: string;
55
55
  }>;
56
56
  policyRef: z.ZodString;
@@ -74,54 +74,54 @@ export declare const missionRecordSchema: z.ZodObject<{
74
74
  updatedAt: z.ZodString;
75
75
  }, "strict", z.ZodTypeAny, {
76
76
  createdAt: string;
77
- state: "paused" | "queued" | "running" | "completed" | "failed" | "cancelled" | "blocked" | "planned" | "draft" | "awaitingAuthorization" | "pauseRequested" | "verifying" | "cancelRequested";
77
+ updatedAt: string;
78
78
  schemaVersion: 1;
79
- revision: number;
80
- objective: string;
79
+ state: "completed" | "cancelled" | "failed" | "blocked" | "running" | "paused" | "queued" | "draft" | "planned" | "awaitingAuthorization" | "pauseRequested" | "verifying" | "cancelRequested";
81
80
  plan: {
82
- revision: number;
83
81
  digest: string;
82
+ revision: number;
84
83
  taskGraphRef: string;
85
84
  };
85
+ acceptance: {
86
+ revision: number;
87
+ criteriaDigest: string;
88
+ };
89
+ objective: string;
86
90
  missionId: string;
87
- updatedAt: string;
88
91
  tenantId: string;
89
92
  workspaceId: string;
90
93
  ownerPrincipalId: string;
94
+ revision: number;
91
95
  policyRef: string;
92
96
  budgetRef: string;
93
97
  executionMode: "durable-executor" | "session-bound";
94
98
  evidenceRefs: string[];
95
- acceptance: {
96
- revision: number;
97
- criteriaDigest: string;
98
- };
99
99
  lastEventSequence: number;
100
100
  authorizationRef?: string | undefined;
101
101
  }, {
102
102
  createdAt: string;
103
- state: "paused" | "queued" | "running" | "completed" | "failed" | "cancelled" | "blocked" | "planned" | "draft" | "awaitingAuthorization" | "pauseRequested" | "verifying" | "cancelRequested";
103
+ updatedAt: string;
104
104
  schemaVersion: 1;
105
- revision: number;
106
- objective: string;
105
+ state: "completed" | "cancelled" | "failed" | "blocked" | "running" | "paused" | "queued" | "draft" | "planned" | "awaitingAuthorization" | "pauseRequested" | "verifying" | "cancelRequested";
107
106
  plan: {
108
- revision: number;
109
107
  digest: string;
108
+ revision: number;
110
109
  taskGraphRef: string;
111
110
  };
111
+ acceptance: {
112
+ revision: number;
113
+ criteriaDigest: string;
114
+ };
115
+ objective: string;
112
116
  missionId: string;
113
- updatedAt: string;
114
117
  tenantId: string;
115
118
  workspaceId: string;
116
119
  ownerPrincipalId: string;
120
+ revision: number;
117
121
  policyRef: string;
118
122
  budgetRef: string;
119
123
  executionMode: "durable-executor" | "session-bound";
120
124
  evidenceRefs: string[];
121
- acceptance: {
122
- revision: number;
123
- criteriaDigest: string;
124
- };
125
125
  lastEventSequence: number;
126
126
  authorizationRef?: string | undefined;
127
127
  }>;
@@ -207,15 +207,15 @@ export declare const budgetSpecSchema: z.ZodObject<{
207
207
  }, "strict", z.ZodTypeAny, {
208
208
  currency: string;
209
209
  ceilingMinor: number;
210
- tokens?: number | undefined;
211
210
  concurrency?: number | undefined;
211
+ tokens?: number | undefined;
212
212
  wallTimeSeconds?: number | undefined;
213
213
  retries?: number | undefined;
214
214
  }, {
215
215
  currency: string;
216
216
  ceilingMinor: number;
217
- tokens?: number | undefined;
218
217
  concurrency?: number | undefined;
218
+ tokens?: number | undefined;
219
219
  wallTimeSeconds?: number | undefined;
220
220
  retries?: number | undefined;
221
221
  }>;
@@ -301,15 +301,15 @@ export declare const planBodySchema: z.ZodObject<{
301
301
  }, "strict", z.ZodTypeAny, {
302
302
  currency: string;
303
303
  ceilingMinor: number;
304
- tokens?: number | undefined;
305
304
  concurrency?: number | undefined;
305
+ tokens?: number | undefined;
306
306
  wallTimeSeconds?: number | undefined;
307
307
  retries?: number | undefined;
308
308
  }, {
309
309
  currency: string;
310
310
  ceilingMinor: number;
311
- tokens?: number | undefined;
312
311
  concurrency?: number | undefined;
312
+ tokens?: number | undefined;
313
313
  wallTimeSeconds?: number | undefined;
314
314
  retries?: number | undefined;
315
315
  }>;
@@ -340,8 +340,8 @@ export declare const planBodySchema: z.ZodObject<{
340
340
  budget: {
341
341
  currency: string;
342
342
  ceilingMinor: number;
343
- tokens?: number | undefined;
344
343
  concurrency?: number | undefined;
344
+ tokens?: number | undefined;
345
345
  wallTimeSeconds?: number | undefined;
346
346
  retries?: number | undefined;
347
347
  };
@@ -372,8 +372,8 @@ export declare const planBodySchema: z.ZodObject<{
372
372
  budget: {
373
373
  currency: string;
374
374
  ceilingMinor: number;
375
- tokens?: number | undefined;
376
375
  concurrency?: number | undefined;
376
+ tokens?: number | undefined;
377
377
  wallTimeSeconds?: number | undefined;
378
378
  retries?: number | undefined;
379
379
  };
@@ -397,11 +397,11 @@ export declare const createInputSchema: z.ZodObject<{
397
397
  requestId: z.ZodString;
398
398
  objective: z.ZodString;
399
399
  }, "strict", z.ZodTypeAny, {
400
- objective: string;
401
400
  requestId: string;
402
- }, {
403
401
  objective: string;
402
+ }, {
404
403
  requestId: string;
404
+ objective: string;
405
405
  }>;
406
406
  export declare const planInputSchema: z.ZodObject<{
407
407
  requestId: z.ZodString;
@@ -489,15 +489,15 @@ export declare const planInputSchema: z.ZodObject<{
489
489
  }, "strict", z.ZodTypeAny, {
490
490
  currency: string;
491
491
  ceilingMinor: number;
492
- tokens?: number | undefined;
493
492
  concurrency?: number | undefined;
493
+ tokens?: number | undefined;
494
494
  wallTimeSeconds?: number | undefined;
495
495
  retries?: number | undefined;
496
496
  }, {
497
497
  currency: string;
498
498
  ceilingMinor: number;
499
- tokens?: number | undefined;
500
499
  concurrency?: number | undefined;
500
+ tokens?: number | undefined;
501
501
  wallTimeSeconds?: number | undefined;
502
502
  retries?: number | undefined;
503
503
  }>;
@@ -528,8 +528,8 @@ export declare const planInputSchema: z.ZodObject<{
528
528
  budget: {
529
529
  currency: string;
530
530
  ceilingMinor: number;
531
- tokens?: number | undefined;
532
531
  concurrency?: number | undefined;
532
+ tokens?: number | undefined;
533
533
  wallTimeSeconds?: number | undefined;
534
534
  retries?: number | undefined;
535
535
  };
@@ -560,8 +560,8 @@ export declare const planInputSchema: z.ZodObject<{
560
560
  budget: {
561
561
  currency: string;
562
562
  ceilingMinor: number;
563
- tokens?: number | undefined;
564
563
  concurrency?: number | undefined;
564
+ tokens?: number | undefined;
565
565
  wallTimeSeconds?: number | undefined;
566
566
  retries?: number | undefined;
567
567
  };
@@ -580,7 +580,6 @@ export declare const planInputSchema: z.ZodObject<{
580
580
  } | undefined;
581
581
  }>;
582
582
  }, "strict", z.ZodTypeAny, {
583
- requestId: string;
584
583
  plan: {
585
584
  tasks: {
586
585
  id: string;
@@ -601,8 +600,8 @@ export declare const planInputSchema: z.ZodObject<{
601
600
  budget: {
602
601
  currency: string;
603
602
  ceilingMinor: number;
604
- tokens?: number | undefined;
605
603
  concurrency?: number | undefined;
604
+ tokens?: number | undefined;
606
605
  wallTimeSeconds?: number | undefined;
607
606
  retries?: number | undefined;
608
607
  };
@@ -617,10 +616,10 @@ export declare const planInputSchema: z.ZodObject<{
617
616
  baseline?: string | undefined;
618
617
  }[];
619
618
  };
619
+ requestId: string;
620
620
  missionId: string;
621
621
  expectedRevision: number;
622
622
  }, {
623
- requestId: string;
624
623
  plan: {
625
624
  tasks: {
626
625
  id: string;
@@ -638,8 +637,8 @@ export declare const planInputSchema: z.ZodObject<{
638
637
  budget: {
639
638
  currency: string;
640
639
  ceilingMinor: number;
641
- tokens?: number | undefined;
642
640
  concurrency?: number | undefined;
641
+ tokens?: number | undefined;
643
642
  wallTimeSeconds?: number | undefined;
644
643
  retries?: number | undefined;
645
644
  };
@@ -657,6 +656,7 @@ export declare const planInputSchema: z.ZodObject<{
657
656
  capabilities?: string[] | undefined;
658
657
  } | undefined;
659
658
  };
659
+ requestId: string;
660
660
  missionId: string;
661
661
  expectedRevision: number;
662
662
  }>;
@@ -687,13 +687,13 @@ export declare const requestActionInputSchema: z.ZodObject<{
687
687
  action: z.ZodEnum<["pause", "resume", "cancel", "requestAuthorization", "admit"]>;
688
688
  reason: z.ZodOptional<z.ZodString>;
689
689
  }, "strict", z.ZodTypeAny, {
690
- action: "pause" | "resume" | "cancel" | "admit" | "requestAuthorization";
690
+ action: "pause" | "resume" | "cancel" | "requestAuthorization" | "admit";
691
691
  requestId: string;
692
692
  missionId: string;
693
693
  expectedRevision: number;
694
694
  reason?: string | undefined;
695
695
  }, {
696
- action: "pause" | "resume" | "cancel" | "admit" | "requestAuthorization";
696
+ action: "pause" | "resume" | "cancel" | "requestAuthorization" | "admit";
697
697
  requestId: string;
698
698
  missionId: string;
699
699
  expectedRevision: number;