claude-flow 3.32.33 → 3.32.35
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/package.json +1 -1
- package/v3/@claude-flow/cli/catalog-manifest.json +4 -4
- package/v3/@claude-flow/cli/dist/src/commands/agent.js +49 -1
- package/v3/@claude-flow/cli/dist/src/commands/hooks.js +24 -0
- package/v3/@claude-flow/cli/dist/src/commands/metaharness.js +4 -0
- package/v3/@claude-flow/cli/dist/src/commands/swarm.js +61 -5
- package/v3/@claude-flow/cli/dist/src/config-adapter.js +1 -0
- package/v3/@claude-flow/cli/dist/src/index.js +3 -2
- package/v3/@claude-flow/cli/dist/src/mcp-tools/agent-tools.js +10 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/hooks-tools.js +86 -52
- package/v3/@claude-flow/cli/dist/src/mcp-tools/memory-tools.js +14 -2
- package/v3/@claude-flow/cli/dist/src/mcp-tools/metaharness-tools.js +7 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/swarm-tools.d.ts +16 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/swarm-tools.js +172 -7
- package/v3/@claude-flow/cli/dist/src/memory/memory-bridge.d.ts +42 -0
- package/v3/@claude-flow/cli/dist/src/memory/memory-bridge.js +144 -40
- package/v3/@claude-flow/cli/dist/src/memory/memory-initializer.d.ts +9 -1
- package/v3/@claude-flow/cli/dist/src/memory/memory-initializer.js +95 -31
- package/v3/@claude-flow/cli/dist/src/services/daemon-autostart.js +7 -4
- package/v3/@claude-flow/cli/dist/src/services/flywheel-receipt.d.ts +3 -0
- package/v3/@claude-flow/cli/dist/src/services/flywheel-receipt.js +1 -0
- package/v3/@claude-flow/cli/dist/src/services/harness-flywheel-runtime.d.ts +6 -0
- package/v3/@claude-flow/cli/dist/src/services/harness-flywheel-runtime.js +19 -19
- package/v3/@claude-flow/cli/dist/src/services/harness-flywheel.d.ts +2 -0
- package/v3/@claude-flow/cli/dist/src/services/harness-flywheel.js +1 -0
- package/v3/@claude-flow/cli/dist/src/services/harness-project-anchor.d.ts +23 -0
- package/v3/@claude-flow/cli/dist/src/services/harness-project-anchor.js +129 -0
- package/v3/@claude-flow/cli/dist/src/services/learned-routing.d.ts +34 -0
- package/v3/@claude-flow/cli/dist/src/services/learned-routing.js +85 -0
- package/v3/@claude-flow/cli/dist/src/services/pheromone-adaptive.d.ts +71 -0
- package/v3/@claude-flow/cli/dist/src/services/pheromone-adaptive.js +214 -0
- package/v3/@claude-flow/cli/dist/src/services/worker-daemon.js +4 -1
- package/v3/@claude-flow/cli/package.json +1 -1
- package/v3/@claude-flow/shared/dist/core/config/loader.js +1 -1
- package/v3/@claude-flow/shared/dist/core/config/schema.d.ts +12 -12
- package/v3/@claude-flow/shared/dist/core/config/schema.js +1 -1
- package/v3/@claude-flow/shared/dist/core/interfaces/coordinator.interface.d.ts +1 -1
- package/v3/@claude-flow/shared/dist/types/swarm.types.js +18 -0
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ADR-330 — Adaptive Pheromone Swarm Consensus.
|
|
3
|
+
*
|
|
4
|
+
* This is a scheduling eligibility layer, not an agent terminator. It learns a
|
|
5
|
+
* bounded EMA signal per agent, compares agents against role-local baselines,
|
|
6
|
+
* and may suspend them from future dispatch. Coordinators and other protected
|
|
7
|
+
* roles remain eligible, quorum is never crossed, pruning per round is capped,
|
|
8
|
+
* and exploration periodically reactivates a suspended agent.
|
|
9
|
+
*/
|
|
10
|
+
export declare const APSC_SCHEMA = "ruflo.apsc-state/v1";
|
|
11
|
+
export interface ApscConfig {
|
|
12
|
+
alpha: number;
|
|
13
|
+
beta: number;
|
|
14
|
+
gamma: number;
|
|
15
|
+
emaDecay: number;
|
|
16
|
+
pruningFactor: number;
|
|
17
|
+
reactivationThreshold: number;
|
|
18
|
+
minActiveAgents: number;
|
|
19
|
+
minSamples: number;
|
|
20
|
+
maxSuspendFraction: number;
|
|
21
|
+
explorationRate: number;
|
|
22
|
+
dryRun: boolean;
|
|
23
|
+
protectedRoles: string[];
|
|
24
|
+
}
|
|
25
|
+
export interface ApscAgentState {
|
|
26
|
+
agentId: string;
|
|
27
|
+
role: string;
|
|
28
|
+
status: 'active' | 'suspended';
|
|
29
|
+
samples: number;
|
|
30
|
+
rawScore: number;
|
|
31
|
+
normalizedScore: number;
|
|
32
|
+
emaScore: number;
|
|
33
|
+
lastUpdatedAt: string;
|
|
34
|
+
lastDecision?: 'keep' | 'would-suspend' | 'suspend' | 'reactivate' | 'explore';
|
|
35
|
+
}
|
|
36
|
+
export interface ApscState {
|
|
37
|
+
schemaVersion: typeof APSC_SCHEMA;
|
|
38
|
+
config: ApscConfig;
|
|
39
|
+
round: number;
|
|
40
|
+
threshold: number;
|
|
41
|
+
roleBaselines: Record<string, number>;
|
|
42
|
+
agents: Record<string, ApscAgentState>;
|
|
43
|
+
}
|
|
44
|
+
export interface ApscSignal {
|
|
45
|
+
agentId: string;
|
|
46
|
+
role: string;
|
|
47
|
+
taskSuccess: number;
|
|
48
|
+
normalizedLatency: number;
|
|
49
|
+
consensusAlignment: number;
|
|
50
|
+
}
|
|
51
|
+
export interface ApscDecision {
|
|
52
|
+
agentId: string;
|
|
53
|
+
score: number;
|
|
54
|
+
normalizedScore: number;
|
|
55
|
+
emaScore: number;
|
|
56
|
+
threshold: number;
|
|
57
|
+
action: 'keep' | 'would-suspend' | 'suspend' | 'reactivate' | 'explore';
|
|
58
|
+
applied: boolean;
|
|
59
|
+
reason: string;
|
|
60
|
+
activeAgents: number;
|
|
61
|
+
suspendedAgents: number;
|
|
62
|
+
}
|
|
63
|
+
export declare const DEFAULT_APSC_CONFIG: ApscConfig;
|
|
64
|
+
export declare function normalizeApscConfig(input?: Partial<ApscConfig>): ApscConfig;
|
|
65
|
+
export declare function createApscState(config?: Partial<ApscConfig>): ApscState;
|
|
66
|
+
export declare function recordApscSignal(current: ApscState, signal: ApscSignal, now?: number): {
|
|
67
|
+
state: ApscState;
|
|
68
|
+
decision: ApscDecision;
|
|
69
|
+
};
|
|
70
|
+
export declare function isApscAgentEligible(state: ApscState | undefined, agentId: string): boolean;
|
|
71
|
+
//# sourceMappingURL=pheromone-adaptive.d.ts.map
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ADR-330 — Adaptive Pheromone Swarm Consensus.
|
|
3
|
+
*
|
|
4
|
+
* This is a scheduling eligibility layer, not an agent terminator. It learns a
|
|
5
|
+
* bounded EMA signal per agent, compares agents against role-local baselines,
|
|
6
|
+
* and may suspend them from future dispatch. Coordinators and other protected
|
|
7
|
+
* roles remain eligible, quorum is never crossed, pruning per round is capped,
|
|
8
|
+
* and exploration periodically reactivates a suspended agent.
|
|
9
|
+
*/
|
|
10
|
+
export const APSC_SCHEMA = 'ruflo.apsc-state/v1';
|
|
11
|
+
export const DEFAULT_APSC_CONFIG = {
|
|
12
|
+
alpha: 0.5,
|
|
13
|
+
beta: 0.2,
|
|
14
|
+
gamma: 0.3,
|
|
15
|
+
emaDecay: 0.85,
|
|
16
|
+
pruningFactor: 0.6,
|
|
17
|
+
reactivationThreshold: 0.75,
|
|
18
|
+
minActiveAgents: 3,
|
|
19
|
+
minSamples: 3,
|
|
20
|
+
maxSuspendFraction: 0.25,
|
|
21
|
+
explorationRate: 0.1,
|
|
22
|
+
dryRun: true,
|
|
23
|
+
protectedRoles: ['coordinator', 'queen', 'security-architect', 'security-auditor'],
|
|
24
|
+
};
|
|
25
|
+
const unit = (value, field) => {
|
|
26
|
+
if (!Number.isFinite(value) || value < 0 || value > 1) {
|
|
27
|
+
throw new Error(`${field} must be a finite number in [0,1]`);
|
|
28
|
+
}
|
|
29
|
+
return value;
|
|
30
|
+
};
|
|
31
|
+
export function normalizeApscConfig(input = {}) {
|
|
32
|
+
const alpha = unit(input.alpha ?? DEFAULT_APSC_CONFIG.alpha, 'alpha');
|
|
33
|
+
const beta = unit(input.beta ?? DEFAULT_APSC_CONFIG.beta, 'beta');
|
|
34
|
+
const gamma = unit(input.gamma ?? DEFAULT_APSC_CONFIG.gamma, 'gamma');
|
|
35
|
+
const weight = alpha + beta + gamma;
|
|
36
|
+
if (weight <= 0)
|
|
37
|
+
throw new Error('at least one APSC score weight must be positive');
|
|
38
|
+
const minActiveAgents = input.minActiveAgents ?? DEFAULT_APSC_CONFIG.minActiveAgents;
|
|
39
|
+
const minSamples = input.minSamples ?? DEFAULT_APSC_CONFIG.minSamples;
|
|
40
|
+
if (!Number.isInteger(minActiveAgents) || minActiveAgents < 1 || minActiveAgents > 50) {
|
|
41
|
+
throw new Error('minActiveAgents must be an integer in [1,50]');
|
|
42
|
+
}
|
|
43
|
+
if (!Number.isInteger(minSamples) || minSamples < 1 || minSamples > 1000) {
|
|
44
|
+
throw new Error('minSamples must be an integer in [1,1000]');
|
|
45
|
+
}
|
|
46
|
+
const protectedRoles = [...new Set((input.protectedRoles ?? DEFAULT_APSC_CONFIG.protectedRoles)
|
|
47
|
+
.map((role) => role.trim().toLowerCase())
|
|
48
|
+
.filter(Boolean))].sort();
|
|
49
|
+
return {
|
|
50
|
+
alpha: alpha / weight,
|
|
51
|
+
beta: beta / weight,
|
|
52
|
+
gamma: gamma / weight,
|
|
53
|
+
emaDecay: unit(input.emaDecay ?? DEFAULT_APSC_CONFIG.emaDecay, 'emaDecay'),
|
|
54
|
+
pruningFactor: unit(input.pruningFactor ?? DEFAULT_APSC_CONFIG.pruningFactor, 'pruningFactor'),
|
|
55
|
+
reactivationThreshold: unit(input.reactivationThreshold ?? DEFAULT_APSC_CONFIG.reactivationThreshold, 'reactivationThreshold'),
|
|
56
|
+
minActiveAgents,
|
|
57
|
+
minSamples,
|
|
58
|
+
maxSuspendFraction: unit(input.maxSuspendFraction ?? DEFAULT_APSC_CONFIG.maxSuspendFraction, 'maxSuspendFraction'),
|
|
59
|
+
explorationRate: unit(input.explorationRate ?? DEFAULT_APSC_CONFIG.explorationRate, 'explorationRate'),
|
|
60
|
+
dryRun: input.dryRun ?? DEFAULT_APSC_CONFIG.dryRun,
|
|
61
|
+
protectedRoles,
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
export function createApscState(config = {}) {
|
|
65
|
+
return {
|
|
66
|
+
schemaVersion: APSC_SCHEMA,
|
|
67
|
+
config: normalizeApscConfig(config),
|
|
68
|
+
round: 0,
|
|
69
|
+
threshold: 0.5,
|
|
70
|
+
roleBaselines: {},
|
|
71
|
+
agents: {},
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
function counts(state) {
|
|
75
|
+
const values = Object.values(state.agents);
|
|
76
|
+
return {
|
|
77
|
+
activeAgents: values.filter((agent) => agent.status === 'active').length,
|
|
78
|
+
suspendedAgents: values.filter((agent) => agent.status === 'suspended').length,
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
function protectedRole(state, role) {
|
|
82
|
+
return state.config.protectedRoles.includes(role.toLowerCase());
|
|
83
|
+
}
|
|
84
|
+
export function recordApscSignal(current, signal, now = Date.now()) {
|
|
85
|
+
if (!/^[A-Za-z0-9._:-]{1,160}$/.test(signal.agentId))
|
|
86
|
+
throw new Error('invalid APSC agentId');
|
|
87
|
+
if (!/^[A-Za-z0-9._:-]{1,100}$/.test(signal.role))
|
|
88
|
+
throw new Error('invalid APSC role');
|
|
89
|
+
const config = normalizeApscConfig(current.config);
|
|
90
|
+
const state = {
|
|
91
|
+
...current,
|
|
92
|
+
config,
|
|
93
|
+
round: current.round + 1,
|
|
94
|
+
roleBaselines: { ...current.roleBaselines },
|
|
95
|
+
agents: Object.fromEntries(Object.entries(current.agents).map(([id, agent]) => [id, { ...agent }])),
|
|
96
|
+
};
|
|
97
|
+
const success = unit(signal.taskSuccess, 'taskSuccess');
|
|
98
|
+
const latency = unit(signal.normalizedLatency, 'normalizedLatency');
|
|
99
|
+
const alignment = unit(signal.consensusAlignment, 'consensusAlignment');
|
|
100
|
+
const rawScore = config.alpha * success + config.beta * (1 - latency) + config.gamma * alignment;
|
|
101
|
+
const role = signal.role.toLowerCase();
|
|
102
|
+
// Compare against peers in the same role, excluding the current agent.
|
|
103
|
+
// Letting an agent update its own baseline before normalization caused a
|
|
104
|
+
// persistently weak agent to redefine "normal" downward and reactivate
|
|
105
|
+
// without any recovery.
|
|
106
|
+
const rolePeers = Object.values(state.agents)
|
|
107
|
+
.filter((item) => item.agentId !== signal.agentId && item.role === role && item.samples > 0);
|
|
108
|
+
const peerMean = rolePeers.length
|
|
109
|
+
? rolePeers.reduce((sum, item) => sum + item.rawScore, 0) / rolePeers.length
|
|
110
|
+
: undefined;
|
|
111
|
+
const priorRoleBaseline = peerMean ?? state.roleBaselines[role] ?? rawScore;
|
|
112
|
+
// A common absolute scale unfairly prunes coordinators/specialists whose
|
|
113
|
+
// observable task signal differs by role. Center each score on its role EMA.
|
|
114
|
+
const normalizedScore = Math.max(0, Math.min(1, 0.5 + rawScore - priorRoleBaseline));
|
|
115
|
+
const previous = state.agents[signal.agentId];
|
|
116
|
+
const agent = {
|
|
117
|
+
agentId: signal.agentId,
|
|
118
|
+
role,
|
|
119
|
+
status: previous?.status ?? 'active',
|
|
120
|
+
samples: (previous?.samples ?? 0) + 1,
|
|
121
|
+
rawScore,
|
|
122
|
+
normalizedScore,
|
|
123
|
+
emaScore: previous
|
|
124
|
+
? config.emaDecay * previous.emaScore + (1 - config.emaDecay) * normalizedScore
|
|
125
|
+
: normalizedScore,
|
|
126
|
+
lastUpdatedAt: new Date(now).toISOString(),
|
|
127
|
+
lastDecision: 'keep',
|
|
128
|
+
};
|
|
129
|
+
state.agents[signal.agentId] = agent;
|
|
130
|
+
const allRoleAgents = Object.values(state.agents).filter((item) => item.role === role);
|
|
131
|
+
const observedRoleMean = allRoleAgents.reduce((sum, item) => sum + item.rawScore, 0) / allRoleAgents.length;
|
|
132
|
+
state.roleBaselines[role] = config.emaDecay * priorRoleBaseline + (1 - config.emaDecay) * observedRoleMean;
|
|
133
|
+
const mature = Object.values(state.agents).filter((item) => item.samples >= config.minSamples);
|
|
134
|
+
const observedMean = mature.length
|
|
135
|
+
? mature.reduce((sum, item) => sum + item.emaScore, 0) / mature.length
|
|
136
|
+
: state.threshold;
|
|
137
|
+
state.threshold = config.emaDecay * state.threshold + (1 - config.emaDecay) * observedMean;
|
|
138
|
+
let action = 'keep';
|
|
139
|
+
let applied = false;
|
|
140
|
+
let reason = agent.samples < config.minSamples
|
|
141
|
+
? `warm-up ${agent.samples}/${config.minSamples}`
|
|
142
|
+
: 'within adaptive envelope';
|
|
143
|
+
if (agent.status === 'suspended' && agent.emaScore >= state.threshold * config.reactivationThreshold) {
|
|
144
|
+
action = 'reactivate';
|
|
145
|
+
reason = 'score recovered above reactivation threshold';
|
|
146
|
+
if (!config.dryRun) {
|
|
147
|
+
agent.status = 'active';
|
|
148
|
+
applied = true;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
else if (agent.status === 'active'
|
|
152
|
+
&& agent.samples >= config.minSamples
|
|
153
|
+
&& !protectedRole(state, agent.role)
|
|
154
|
+
&& agent.emaScore < state.threshold * config.pruningFactor) {
|
|
155
|
+
const before = counts(state);
|
|
156
|
+
const maxThisRound = Math.floor(before.activeAgents * config.maxSuspendFraction);
|
|
157
|
+
const quorumCapacity = Math.max(0, before.activeAgents - config.minActiveAgents);
|
|
158
|
+
if (maxThisRound < 1 || quorumCapacity < 1) {
|
|
159
|
+
reason = 'safety floor prevents suspension';
|
|
160
|
+
}
|
|
161
|
+
else {
|
|
162
|
+
action = config.dryRun ? 'would-suspend' : 'suspend';
|
|
163
|
+
reason = 'score below adaptive pruning threshold';
|
|
164
|
+
if (!config.dryRun) {
|
|
165
|
+
agent.status = 'suspended';
|
|
166
|
+
applied = true;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
else if (protectedRole(state, agent.role)) {
|
|
171
|
+
reason = 'protected role remains eligible';
|
|
172
|
+
}
|
|
173
|
+
// Deterministic exploration: at a bounded cadence, reactivate the stalest
|
|
174
|
+
// suspended agent so a transient failure cannot permanently exclude it.
|
|
175
|
+
if (!config.dryRun && config.explorationRate > 0) {
|
|
176
|
+
const cadence = Math.max(1, Math.round(1 / config.explorationRate));
|
|
177
|
+
if (state.round % cadence === 0) {
|
|
178
|
+
const explorer = Object.values(state.agents)
|
|
179
|
+
.filter((item) => item.status === 'suspended')
|
|
180
|
+
.sort((a, b) => a.lastUpdatedAt.localeCompare(b.lastUpdatedAt) || a.agentId.localeCompare(b.agentId))[0];
|
|
181
|
+
if (explorer) {
|
|
182
|
+
explorer.status = 'active';
|
|
183
|
+
explorer.lastDecision = 'explore';
|
|
184
|
+
if (explorer.agentId === agent.agentId) {
|
|
185
|
+
action = 'explore';
|
|
186
|
+
applied = true;
|
|
187
|
+
reason = 'bounded exploration reactivation';
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
agent.lastDecision = action;
|
|
193
|
+
const after = counts(state);
|
|
194
|
+
return {
|
|
195
|
+
state,
|
|
196
|
+
decision: {
|
|
197
|
+
agentId: agent.agentId,
|
|
198
|
+
score: rawScore,
|
|
199
|
+
normalizedScore,
|
|
200
|
+
emaScore: agent.emaScore,
|
|
201
|
+
threshold: state.threshold,
|
|
202
|
+
action,
|
|
203
|
+
applied,
|
|
204
|
+
reason,
|
|
205
|
+
...after,
|
|
206
|
+
},
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
export function isApscAgentEligible(state, agentId) {
|
|
210
|
+
if (!state || state.config.dryRun)
|
|
211
|
+
return true;
|
|
212
|
+
return state.agents[agentId]?.status !== 'suspended';
|
|
213
|
+
}
|
|
214
|
+
//# sourceMappingURL=pheromone-adaptive.js.map
|
|
@@ -70,7 +70,10 @@ const NO_DISTILL_ENV = 'RUFLO_DAEMON_NO_DISTILL';
|
|
|
70
70
|
// half a day; set RUFLO_DAEMON_TTL_SECS=0 (or `--ttl 0`) to opt out. Idle
|
|
71
71
|
// shutdown is opt-in (0 = disabled) since a legitimately quiet daemon is not a leak.
|
|
72
72
|
const DEFAULT_DAEMON_TTL_MS = 12 * 60 * 60 * 1000;
|
|
73
|
-
|
|
73
|
+
// #2834 — an auto-started daemon must not remain alive for the full 12h TTL
|
|
74
|
+
// after its workspace goes idle. Explicit 0 via config/env still disables the
|
|
75
|
+
// idle cap for operators who intentionally want a resident daemon.
|
|
76
|
+
const DEFAULT_DAEMON_IDLE_SHUTDOWN_MS = 30 * 60 * 1000;
|
|
74
77
|
/**
|
|
75
78
|
* Read a non-negative seconds value from an env var and return it as ms.
|
|
76
79
|
* Unlike the `parseInt(x) || default` idiom used elsewhere, an explicit `0`
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@claude-flow/cli",
|
|
3
|
-
"version": "3.32.
|
|
3
|
+
"version": "3.32.35",
|
|
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",
|
|
@@ -100,7 +100,7 @@ function loadEnvConfig() {
|
|
|
100
100
|
const defaultSwarm = defaultSystemConfig.swarm ?? { topology: 'hierarchical-mesh', maxAgents: 20 };
|
|
101
101
|
if (process.env.CLAUDE_FLOW_SWARM_TOPOLOGY) {
|
|
102
102
|
const topology = process.env.CLAUDE_FLOW_SWARM_TOPOLOGY;
|
|
103
|
-
if (['hierarchical', 'mesh', 'ring', 'star', 'adaptive', 'hierarchical-mesh'].includes(topology)) {
|
|
103
|
+
if (['hierarchical', 'mesh', 'ring', 'star', 'adaptive', 'pheromone-adaptive', 'hierarchical-mesh'].includes(topology)) {
|
|
104
104
|
config.swarm = {
|
|
105
105
|
...defaultSwarm,
|
|
106
106
|
topology,
|
|
@@ -147,7 +147,7 @@ export declare const TaskConfigSchema: z.ZodObject<{
|
|
|
147
147
|
* Swarm configuration schema
|
|
148
148
|
*/
|
|
149
149
|
export declare const SwarmConfigSchema: z.ZodObject<{
|
|
150
|
-
topology: z.ZodEnum<["hierarchical", "mesh", "ring", "star", "adaptive", "hierarchical-mesh"]>;
|
|
150
|
+
topology: z.ZodEnum<["hierarchical", "mesh", "ring", "star", "adaptive", "pheromone-adaptive", "hierarchical-mesh"]>;
|
|
151
151
|
maxAgents: z.ZodDefault<z.ZodNumber>;
|
|
152
152
|
autoScale: z.ZodOptional<z.ZodObject<{
|
|
153
153
|
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
@@ -211,7 +211,7 @@ export declare const SwarmConfigSchema: z.ZodObject<{
|
|
|
211
211
|
}>>;
|
|
212
212
|
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
213
213
|
}, "strip", z.ZodTypeAny, {
|
|
214
|
-
topology: "hierarchical-mesh" | "mesh" | "hierarchical" | "ring" | "star" | "adaptive";
|
|
214
|
+
topology: "hierarchical-mesh" | "mesh" | "hierarchical" | "ring" | "star" | "adaptive" | "pheromone-adaptive";
|
|
215
215
|
maxAgents: number;
|
|
216
216
|
metadata?: Record<string, unknown> | undefined;
|
|
217
217
|
autoScale?: {
|
|
@@ -235,7 +235,7 @@ export declare const SwarmConfigSchema: z.ZodObject<{
|
|
|
235
235
|
flushIntervalMs: number;
|
|
236
236
|
} | undefined;
|
|
237
237
|
}, {
|
|
238
|
-
topology: "hierarchical-mesh" | "mesh" | "hierarchical" | "ring" | "star" | "adaptive";
|
|
238
|
+
topology: "hierarchical-mesh" | "mesh" | "hierarchical" | "ring" | "star" | "adaptive" | "pheromone-adaptive";
|
|
239
239
|
maxAgents?: number | undefined;
|
|
240
240
|
metadata?: Record<string, unknown> | undefined;
|
|
241
241
|
autoScale?: {
|
|
@@ -819,7 +819,7 @@ export declare const SystemConfigSchema: z.ZodObject<{
|
|
|
819
819
|
version?: string | undefined;
|
|
820
820
|
}>>;
|
|
821
821
|
swarm: z.ZodOptional<z.ZodObject<{
|
|
822
|
-
topology: z.ZodEnum<["hierarchical", "mesh", "ring", "star", "adaptive", "hierarchical-mesh"]>;
|
|
822
|
+
topology: z.ZodEnum<["hierarchical", "mesh", "ring", "star", "adaptive", "pheromone-adaptive", "hierarchical-mesh"]>;
|
|
823
823
|
maxAgents: z.ZodDefault<z.ZodNumber>;
|
|
824
824
|
autoScale: z.ZodOptional<z.ZodObject<{
|
|
825
825
|
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
@@ -883,7 +883,7 @@ export declare const SystemConfigSchema: z.ZodObject<{
|
|
|
883
883
|
}>>;
|
|
884
884
|
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
885
885
|
}, "strip", z.ZodTypeAny, {
|
|
886
|
-
topology: "hierarchical-mesh" | "mesh" | "hierarchical" | "ring" | "star" | "adaptive";
|
|
886
|
+
topology: "hierarchical-mesh" | "mesh" | "hierarchical" | "ring" | "star" | "adaptive" | "pheromone-adaptive";
|
|
887
887
|
maxAgents: number;
|
|
888
888
|
metadata?: Record<string, unknown> | undefined;
|
|
889
889
|
autoScale?: {
|
|
@@ -907,7 +907,7 @@ export declare const SystemConfigSchema: z.ZodObject<{
|
|
|
907
907
|
flushIntervalMs: number;
|
|
908
908
|
} | undefined;
|
|
909
909
|
}, {
|
|
910
|
-
topology: "hierarchical-mesh" | "mesh" | "hierarchical" | "ring" | "star" | "adaptive";
|
|
910
|
+
topology: "hierarchical-mesh" | "mesh" | "hierarchical" | "ring" | "star" | "adaptive" | "pheromone-adaptive";
|
|
911
911
|
maxAgents?: number | undefined;
|
|
912
912
|
metadata?: Record<string, unknown> | undefined;
|
|
913
913
|
autoScale?: {
|
|
@@ -1205,7 +1205,7 @@ export declare const SystemConfigSchema: z.ZodObject<{
|
|
|
1205
1205
|
version?: string | undefined;
|
|
1206
1206
|
}>>;
|
|
1207
1207
|
swarm: z.ZodOptional<z.ZodObject<{
|
|
1208
|
-
topology: z.ZodEnum<["hierarchical", "mesh", "ring", "star", "adaptive", "hierarchical-mesh"]>;
|
|
1208
|
+
topology: z.ZodEnum<["hierarchical", "mesh", "ring", "star", "adaptive", "pheromone-adaptive", "hierarchical-mesh"]>;
|
|
1209
1209
|
maxAgents: z.ZodDefault<z.ZodNumber>;
|
|
1210
1210
|
autoScale: z.ZodOptional<z.ZodObject<{
|
|
1211
1211
|
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
@@ -1269,7 +1269,7 @@ export declare const SystemConfigSchema: z.ZodObject<{
|
|
|
1269
1269
|
}>>;
|
|
1270
1270
|
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
1271
1271
|
}, "strip", z.ZodTypeAny, {
|
|
1272
|
-
topology: "hierarchical-mesh" | "mesh" | "hierarchical" | "ring" | "star" | "adaptive";
|
|
1272
|
+
topology: "hierarchical-mesh" | "mesh" | "hierarchical" | "ring" | "star" | "adaptive" | "pheromone-adaptive";
|
|
1273
1273
|
maxAgents: number;
|
|
1274
1274
|
metadata?: Record<string, unknown> | undefined;
|
|
1275
1275
|
autoScale?: {
|
|
@@ -1293,7 +1293,7 @@ export declare const SystemConfigSchema: z.ZodObject<{
|
|
|
1293
1293
|
flushIntervalMs: number;
|
|
1294
1294
|
} | undefined;
|
|
1295
1295
|
}, {
|
|
1296
|
-
topology: "hierarchical-mesh" | "mesh" | "hierarchical" | "ring" | "star" | "adaptive";
|
|
1296
|
+
topology: "hierarchical-mesh" | "mesh" | "hierarchical" | "ring" | "star" | "adaptive" | "pheromone-adaptive";
|
|
1297
1297
|
maxAgents?: number | undefined;
|
|
1298
1298
|
metadata?: Record<string, unknown> | undefined;
|
|
1299
1299
|
autoScale?: {
|
|
@@ -1591,7 +1591,7 @@ export declare const SystemConfigSchema: z.ZodObject<{
|
|
|
1591
1591
|
version?: string | undefined;
|
|
1592
1592
|
}>>;
|
|
1593
1593
|
swarm: z.ZodOptional<z.ZodObject<{
|
|
1594
|
-
topology: z.ZodEnum<["hierarchical", "mesh", "ring", "star", "adaptive", "hierarchical-mesh"]>;
|
|
1594
|
+
topology: z.ZodEnum<["hierarchical", "mesh", "ring", "star", "adaptive", "pheromone-adaptive", "hierarchical-mesh"]>;
|
|
1595
1595
|
maxAgents: z.ZodDefault<z.ZodNumber>;
|
|
1596
1596
|
autoScale: z.ZodOptional<z.ZodObject<{
|
|
1597
1597
|
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
@@ -1655,7 +1655,7 @@ export declare const SystemConfigSchema: z.ZodObject<{
|
|
|
1655
1655
|
}>>;
|
|
1656
1656
|
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
1657
1657
|
}, "strip", z.ZodTypeAny, {
|
|
1658
|
-
topology: "hierarchical-mesh" | "mesh" | "hierarchical" | "ring" | "star" | "adaptive";
|
|
1658
|
+
topology: "hierarchical-mesh" | "mesh" | "hierarchical" | "ring" | "star" | "adaptive" | "pheromone-adaptive";
|
|
1659
1659
|
maxAgents: number;
|
|
1660
1660
|
metadata?: Record<string, unknown> | undefined;
|
|
1661
1661
|
autoScale?: {
|
|
@@ -1679,7 +1679,7 @@ export declare const SystemConfigSchema: z.ZodObject<{
|
|
|
1679
1679
|
flushIntervalMs: number;
|
|
1680
1680
|
} | undefined;
|
|
1681
1681
|
}, {
|
|
1682
|
-
topology: "hierarchical-mesh" | "mesh" | "hierarchical" | "ring" | "star" | "adaptive";
|
|
1682
|
+
topology: "hierarchical-mesh" | "mesh" | "hierarchical" | "ring" | "star" | "adaptive" | "pheromone-adaptive";
|
|
1683
1683
|
maxAgents?: number | undefined;
|
|
1684
1684
|
metadata?: Record<string, unknown> | undefined;
|
|
1685
1685
|
autoScale?: {
|
|
@@ -49,7 +49,7 @@ export const TaskConfigSchema = z.object({
|
|
|
49
49
|
* Swarm configuration schema
|
|
50
50
|
*/
|
|
51
51
|
export const SwarmConfigSchema = z.object({
|
|
52
|
-
topology: z.enum(['hierarchical', 'mesh', 'ring', 'star', 'adaptive', 'hierarchical-mesh']),
|
|
52
|
+
topology: z.enum(['hierarchical', 'mesh', 'ring', 'star', 'adaptive', 'pheromone-adaptive', 'hierarchical-mesh']),
|
|
53
53
|
maxAgents: z.number().int().positive().default(20),
|
|
54
54
|
autoScale: z.object({
|
|
55
55
|
enabled: z.boolean().default(false),
|
|
@@ -8,7 +8,7 @@ import type { IAgent, IAgentConfig } from './agent.interface.js';
|
|
|
8
8
|
/**
|
|
9
9
|
* Swarm topology types
|
|
10
10
|
*/
|
|
11
|
-
export type SwarmTopology = 'hierarchical' | 'mesh' | 'ring' | 'star' | 'adaptive' | 'hierarchical-mesh';
|
|
11
|
+
export type SwarmTopology = 'hierarchical' | 'mesh' | 'ring' | 'star' | 'adaptive' | 'pheromone-adaptive' | 'hierarchical-mesh';
|
|
12
12
|
/**
|
|
13
13
|
* Coordination status
|
|
14
14
|
*/
|
|
@@ -53,6 +53,24 @@ export const TopologyPresets = {
|
|
|
53
53
|
retryPolicy: { maxRetries: 5, backoffMs: 500 }
|
|
54
54
|
}
|
|
55
55
|
},
|
|
56
|
+
'pheromone-adaptive': {
|
|
57
|
+
topology: 'pheromone-adaptive',
|
|
58
|
+
autoScale: {
|
|
59
|
+
enabled: true,
|
|
60
|
+
minAgents: 3,
|
|
61
|
+
maxAgents: 20,
|
|
62
|
+
scaleUpThreshold: 0.8,
|
|
63
|
+
scaleDownThreshold: 0.3
|
|
64
|
+
},
|
|
65
|
+
coordination: {
|
|
66
|
+
consensusRequired: true,
|
|
67
|
+
timeoutMs: 10000,
|
|
68
|
+
retryPolicy: { maxRetries: 5, backoffMs: 500 }
|
|
69
|
+
},
|
|
70
|
+
metadata: {
|
|
71
|
+
apsc: { dryRun: true, minActiveAgents: 3, minSamples: 3 }
|
|
72
|
+
}
|
|
73
|
+
},
|
|
56
74
|
'hierarchical-mesh': {
|
|
57
75
|
topology: 'hierarchical-mesh',
|
|
58
76
|
coordination: {
|