@claude-flow/swarm 3.0.0-alpha.7 → 3.0.0-alpha.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.
- package/dist/agent-pool.d.ts.map +1 -1
- package/dist/agent-pool.js +10 -2
- package/dist/agent-pool.js.map +1 -1
- package/dist/attention-coordinator.d.ts +5 -4
- package/dist/attention-coordinator.d.ts.map +1 -1
- package/dist/attention-coordinator.js +17 -10
- package/dist/attention-coordinator.js.map +1 -1
- package/dist/consensus/byzantine.d.ts +2 -1
- package/dist/consensus/byzantine.d.ts.map +1 -1
- package/dist/consensus/byzantine.js +34 -8
- package/dist/consensus/byzantine.js.map +1 -1
- package/dist/consensus/gossip.d.ts +2 -1
- package/dist/consensus/gossip.d.ts.map +1 -1
- package/dist/consensus/gossip.js +27 -8
- package/dist/consensus/gossip.js.map +1 -1
- package/dist/consensus/index.d.ts +1 -1
- package/dist/consensus/index.d.ts.map +1 -1
- package/dist/consensus/index.js +2 -2
- package/dist/consensus/index.js.map +1 -1
- package/dist/consensus/raft.d.ts +2 -1
- package/dist/consensus/raft.d.ts.map +1 -1
- package/dist/consensus/raft.js +25 -9
- package/dist/consensus/raft.js.map +1 -1
- package/dist/coordination/agent-registry.d.ts +2 -2
- package/dist/coordination/agent-registry.d.ts.map +1 -1
- package/dist/coordination/agent-registry.js +1 -1
- package/dist/coordination/agent-registry.js.map +1 -1
- package/dist/coordination/swarm-hub.d.ts +5 -5
- package/dist/coordination/swarm-hub.d.ts.map +1 -1
- package/dist/coordination/swarm-hub.js +5 -5
- package/dist/coordination/swarm-hub.js.map +1 -1
- package/dist/coordination/task-orchestrator.d.ts +3 -3
- package/dist/coordination/task-orchestrator.d.ts.map +1 -1
- package/dist/coordination/task-orchestrator.js +1 -1
- package/dist/coordination/task-orchestrator.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/message-bus.d.ts.map +1 -1
- package/dist/message-bus.js +13 -4
- package/dist/message-bus.js.map +1 -1
- package/dist/queen-coordinator.d.ts +1 -1
- package/dist/queen-coordinator.d.ts.map +1 -1
- package/dist/queen-coordinator.js +10 -3
- package/dist/queen-coordinator.js.map +1 -1
- package/dist/topology-manager.d.ts.map +1 -1
- package/dist/topology-manager.js +26 -1
- package/dist/topology-manager.js.map +1 -1
- package/dist/types.d.ts +3 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/unified-coordinator.d.ts +1 -1
- package/dist/unified-coordinator.d.ts.map +1 -1
- package/dist/unified-coordinator.js +85 -29
- package/dist/unified-coordinator.js.map +1 -1
- package/package.json +7 -2
- package/.claude-flow/data/pending-insights.jsonl +0 -12
- package/__tests__/byzantine-transport.test.ts +0 -147
- package/__tests__/consensus-failure-injection.test.ts +0 -161
- package/__tests__/consensus-transport.test.ts +0 -200
- package/__tests__/consensus.test.ts +0 -577
- package/__tests__/coordinator.test.ts +0 -501
- package/__tests__/federation-transport.test.ts +0 -145
- package/__tests__/gossip-transport.test.ts +0 -81
- package/__tests__/queen-coordinator.test.ts +0 -1335
- package/__tests__/raft-transport.test.ts +0 -121
- package/__tests__/topology.test.ts +0 -621
- package/ruvector.db +0 -0
- package/src/agent-pool.ts +0 -476
- package/src/application/commands/create-task.command.ts +0 -124
- package/src/application/commands/spawn-agent.command.ts +0 -122
- package/src/application/index.ts +0 -30
- package/src/application/services/swarm-application-service.ts +0 -200
- package/src/attention-coordinator.ts +0 -1000
- package/src/consensus/byzantine.ts +0 -514
- package/src/consensus/federation-transport.ts +0 -185
- package/src/consensus/gossip.ts +0 -599
- package/src/consensus/index.ts +0 -296
- package/src/consensus/raft.ts +0 -561
- package/src/consensus/transport.ts +0 -284
- package/src/coordination/agent-registry.ts +0 -544
- package/src/coordination/index.ts +0 -23
- package/src/coordination/swarm-hub.ts +0 -776
- package/src/coordination/task-orchestrator.ts +0 -605
- package/src/domain/entities/agent.d.ts +0 -151
- package/src/domain/entities/agent.d.ts.map +0 -1
- package/src/domain/entities/agent.js +0 -280
- package/src/domain/entities/agent.js.map +0 -1
- package/src/domain/entities/agent.ts +0 -370
- package/src/domain/entities/task.d.ts +0 -133
- package/src/domain/entities/task.d.ts.map +0 -1
- package/src/domain/entities/task.js +0 -261
- package/src/domain/entities/task.js.map +0 -1
- package/src/domain/entities/task.ts +0 -319
- package/src/domain/index.ts +0 -41
- package/src/domain/repositories/agent-repository.interface.d.ts +0 -57
- package/src/domain/repositories/agent-repository.interface.d.ts.map +0 -1
- package/src/domain/repositories/agent-repository.interface.js +0 -9
- package/src/domain/repositories/agent-repository.interface.js.map +0 -1
- package/src/domain/repositories/agent-repository.interface.ts +0 -69
- package/src/domain/repositories/task-repository.interface.d.ts +0 -61
- package/src/domain/repositories/task-repository.interface.d.ts.map +0 -1
- package/src/domain/repositories/task-repository.interface.js +0 -9
- package/src/domain/repositories/task-repository.interface.js.map +0 -1
- package/src/domain/repositories/task-repository.interface.ts +0 -75
- package/src/domain/services/coordination-service.ts +0 -320
- package/src/federation-hub.d.ts +0 -284
- package/src/federation-hub.d.ts.map +0 -1
- package/src/federation-hub.js +0 -692
- package/src/federation-hub.js.map +0 -1
- package/src/federation-hub.ts +0 -979
- package/src/index.ts +0 -348
- package/src/message-bus.ts +0 -607
- package/src/queen-coordinator.ts +0 -2025
- package/src/shared/events.ts +0 -285
- package/src/shared/types.ts +0 -389
- package/src/topology-manager.ts +0 -656
- package/src/types.ts +0 -545
- package/src/unified-coordinator.ts +0 -1844
- package/src/workers/index.ts +0 -65
- package/src/workers/worker-dispatch.d.ts +0 -234
- package/src/workers/worker-dispatch.d.ts.map +0 -1
- package/src/workers/worker-dispatch.js +0 -842
- package/src/workers/worker-dispatch.js.map +0 -1
- package/src/workers/worker-dispatch.ts +0 -1076
- package/tmp.json +0 -0
- package/tsconfig.json +0 -9
- package/tsconfig.tsbuildinfo +0 -1
- package/vitest.config.ts +0 -20
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* ADR-095 G2 — GossipConsensus + ConsensusTransport wiring.
|
|
3
|
-
*
|
|
4
|
-
* Verifies gossip messages actually go over the transport to neighbors and
|
|
5
|
-
* inbound gossip is routed back into the merge logic (dedup by id). Legacy
|
|
6
|
-
* no-transport behavior is covered by consensus.test.ts.
|
|
7
|
-
*/
|
|
8
|
-
import { describe, it, expect } from 'vitest';
|
|
9
|
-
import { GossipConsensus } from '../src/consensus/gossip.js';
|
|
10
|
-
import { LocalTransport, LocalTransportRegistry, type ConsensusMessage } from '../src/consensus/transport.js';
|
|
11
|
-
|
|
12
|
-
describe('ADR-095 G2 — GossipConsensus transport wiring', () => {
|
|
13
|
-
it('gossip messages to a neighbor go over the transport', async () => {
|
|
14
|
-
const reg = new LocalTransportRegistry();
|
|
15
|
-
const tA = new LocalTransport('a', { registry: reg });
|
|
16
|
-
const tB = new LocalTransport('b', { registry: reg });
|
|
17
|
-
const received: ConsensusMessage[] = [];
|
|
18
|
-
tB.onMessage((m) => { received.push(m); });
|
|
19
|
-
|
|
20
|
-
const a = new GossipConsensus('a', { transport: tA, gossipIntervalMs: 1_000_000 }); // disable the auto-loop for the test
|
|
21
|
-
// Reach into the private node to register a neighbor (gossip needs one to send to).
|
|
22
|
-
(a as unknown as { node: { neighbors: Set<string> } }).node.neighbors.add('b');
|
|
23
|
-
|
|
24
|
-
// Drive a gossip send by calling the private sendToNeighbor through a public path:
|
|
25
|
-
// `propose` queues a proposal message; the gossip loop drains it. We disabled the
|
|
26
|
-
// loop, so call the private drainer directly.
|
|
27
|
-
await (a as unknown as { sendToNeighbor: (id: string, m: unknown) => Promise<void> }).sendToNeighbor('b', {
|
|
28
|
-
id: 'gm-1', type: 'state', senderId: 'a', version: 1, payload: { k: 'v' }, timestamp: new Date(), ttl: 5, hops: 0, path: [],
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
expect(received.length).toBe(1);
|
|
32
|
-
expect(received[0].type).toBe('gossip');
|
|
33
|
-
expect(received[0].from).toBe('a');
|
|
34
|
-
const gm = received[0].payload as { id: string; hops: number; path: string[] };
|
|
35
|
-
expect(gm.id).toBe('gm-1');
|
|
36
|
-
expect(gm.hops).toBe(1); // incremented on the way out
|
|
37
|
-
expect(gm.path).toEqual(['b']); // appended
|
|
38
|
-
|
|
39
|
-
await a.shutdown(); await tA.close(); await tB.close();
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
it('inbound gossip is processed and deduped by id', async () => {
|
|
43
|
-
const reg = new LocalTransportRegistry();
|
|
44
|
-
const tSender = new LocalTransport('sender', { registry: reg });
|
|
45
|
-
const tB = new LocalTransport('b', { registry: reg });
|
|
46
|
-
|
|
47
|
-
const b = new GossipConsensus('b', { transport: tB, gossipIntervalMs: 1_000_000 });
|
|
48
|
-
const processed: string[] = [];
|
|
49
|
-
// Spy on processReceivedMessage by wrapping seenMessages.add (every processed
|
|
50
|
-
// message marks itself seen first).
|
|
51
|
-
const node = (b as unknown as { node: { seenMessages: { add: (id: string) => void } } }).node;
|
|
52
|
-
const origAdd = node.seenMessages.add.bind(node.seenMessages);
|
|
53
|
-
node.seenMessages.add = (id: string) => { processed.push(id); return origAdd(id); };
|
|
54
|
-
|
|
55
|
-
const gm = { id: 'gm-42', type: 'state' as const, senderId: 'sender', version: 1, payload: { x: 1 }, timestamp: new Date().toISOString(), ttl: 5, hops: 1, path: ['b'] };
|
|
56
|
-
// Send the same gossip message twice over the transport.
|
|
57
|
-
await tSender.send('b', { type: 'gossip', payload: gm });
|
|
58
|
-
await tSender.send('b', { type: 'gossip', payload: gm });
|
|
59
|
-
|
|
60
|
-
// First arrival processed; second deduped (seenMessages.add not called again for gm-42).
|
|
61
|
-
expect(processed.filter(id => id === 'gm-42').length).toBe(1);
|
|
62
|
-
|
|
63
|
-
await b.shutdown(); await tSender.close(); await tB.close();
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
it('non-gossip inbound messages are ignored', async () => {
|
|
67
|
-
const reg = new LocalTransportRegistry();
|
|
68
|
-
const tSender = new LocalTransport('sender', { registry: reg });
|
|
69
|
-
const tB = new LocalTransport('b', { registry: reg });
|
|
70
|
-
const b = new GossipConsensus('b', { transport: tB, gossipIntervalMs: 1_000_000 });
|
|
71
|
-
const node = (b as unknown as { node: { seenMessages: { add: (id: string) => void } } }).node;
|
|
72
|
-
const seen: string[] = [];
|
|
73
|
-
const origAdd = node.seenMessages.add.bind(node.seenMessages);
|
|
74
|
-
node.seenMessages.add = (id: string) => { seen.push(id); return origAdd(id); };
|
|
75
|
-
|
|
76
|
-
await tSender.send('b', { type: 'request-vote', payload: { candidateId: 'sender' }, term: 1 });
|
|
77
|
-
expect(seen.length).toBe(0); // not a gossip message → not processed
|
|
78
|
-
|
|
79
|
-
await b.shutdown(); await tSender.close(); await tB.close();
|
|
80
|
-
});
|
|
81
|
-
});
|