@sparkleideas/integration 3.0.2 → 3.0.4
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 +2 -2
- package/src/__tests__/agent-adapter.test.ts +5 -5
- package/src/__tests__/token-optimizer.test.ts +3 -3
- package/src/agent-adapter.ts +33 -33
- package/src/agentic-flow-agent.ts +34 -34
- package/src/agentic-flow-bridge.ts +39 -39
- package/src/attention-coordinator.ts +14 -14
- package/src/index.ts +6 -6
- package/src/long-running-worker.ts +1 -1
- package/src/multi-model-router.ts +1 -1
- package/src/provider-adapter.ts +1 -1
- package/src/sdk-bridge.ts +7 -7
- package/src/sona-adapter.ts +21 -21
- package/src/specialized-worker.ts +1 -1
- package/src/swarm-adapter.ts +36 -36
- package/src/token-optimizer.ts +7 -7
- package/src/types.ts +5 -5
- package/src/worker-base.ts +3 -3
- package/src/worker-pool.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sparkleideas/integration",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Integration module - agentic-flow@alpha deep integration, ADR-001 compliance, TokenOptimizer",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"swarm"
|
|
25
25
|
],
|
|
26
26
|
"peerDependencies": {
|
|
27
|
-
"@sparkleideas/agentic-flow": "
|
|
27
|
+
"@sparkleideas/agentic-flow": "*"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"vitest": "^4.0.16"
|
|
@@ -148,8 +148,8 @@ describe('AgentAdapter', () => {
|
|
|
148
148
|
});
|
|
149
149
|
});
|
|
150
150
|
|
|
151
|
-
describe('Agent Conversion from
|
|
152
|
-
it('should convert
|
|
151
|
+
describe('Agent Conversion from agentic-flow', () => {
|
|
152
|
+
it('should convert agentic-flow agent format', () => {
|
|
153
153
|
const mockAgenticFlowAgent = {
|
|
154
154
|
id: 'mock-agent-1',
|
|
155
155
|
name: 'Mock Agent',
|
|
@@ -190,8 +190,8 @@ describe('AgentAdapter', () => {
|
|
|
190
190
|
});
|
|
191
191
|
});
|
|
192
192
|
|
|
193
|
-
describe('Agent Conversion to
|
|
194
|
-
it('should convert Claude Flow agent to
|
|
193
|
+
describe('Agent Conversion to agentic-flow', () => {
|
|
194
|
+
it('should convert Claude Flow agent to agentic-flow format', async () => {
|
|
195
195
|
const agent = await adapter.createWithDelegation({
|
|
196
196
|
id: 'convert-agent',
|
|
197
197
|
name: 'Convert Test',
|
|
@@ -221,7 +221,7 @@ describe('AgentAdapter', () => {
|
|
|
221
221
|
priority: 1,
|
|
222
222
|
});
|
|
223
223
|
|
|
224
|
-
// Note: isDelegated will be false unless
|
|
224
|
+
// Note: isDelegated will be false unless agentic-flow is actually available
|
|
225
225
|
const isDelegated = adapter.isDelegated('delegation-check-agent');
|
|
226
226
|
|
|
227
227
|
expect(typeof isDelegated).toBe('boolean');
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Token Optimizer Integration Tests
|
|
3
|
-
* Validates
|
|
3
|
+
* Validates agentic-flow Agent Booster integration
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { describe, it, expect, beforeAll } from 'vitest';
|
|
@@ -23,9 +23,9 @@ describe('TokenOptimizer', () => {
|
|
|
23
23
|
expect(typeof stats.agenticFlowAvailable).toBe('boolean');
|
|
24
24
|
});
|
|
25
25
|
|
|
26
|
-
it('should detect
|
|
26
|
+
it('should detect agentic-flow availability', async () => {
|
|
27
27
|
const stats = optimizer.getStats();
|
|
28
|
-
//
|
|
28
|
+
// agentic-flow is installed in v3/node_modules
|
|
29
29
|
expect(stats.agenticFlowAvailable).toBe(true);
|
|
30
30
|
});
|
|
31
31
|
});
|
package/src/agent-adapter.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* AgentAdapter - Bridge between Claude Flow and
|
|
2
|
+
* AgentAdapter - Bridge between Claude Flow and agentic-flow Agents
|
|
3
3
|
*
|
|
4
4
|
* Provides bidirectional conversion and delegation patterns between:
|
|
5
5
|
* - Claude Flow v3 DDD agent architecture
|
|
6
|
-
* -
|
|
6
|
+
* - agentic-flow's optimized agent implementations
|
|
7
7
|
*
|
|
8
|
-
* This implements ADR-001: Adopt
|
|
8
|
+
* This implements ADR-001: Adopt agentic-flow as Core Foundation
|
|
9
9
|
* by providing clean conversion and delegation patterns.
|
|
10
10
|
*
|
|
11
11
|
* Pattern follows existing adapters:
|
|
@@ -31,8 +31,8 @@ import {
|
|
|
31
31
|
} from './agentic-flow-agent.js';
|
|
32
32
|
|
|
33
33
|
/**
|
|
34
|
-
* Interface for
|
|
35
|
-
* This represents the expected API from
|
|
34
|
+
* Interface for agentic-flow Agent (external package)
|
|
35
|
+
* This represents the expected API from agentic-flow's Agent class
|
|
36
36
|
*/
|
|
37
37
|
interface AgenticFlowAgent_External {
|
|
38
38
|
id: string;
|
|
@@ -60,7 +60,7 @@ interface AgenticFlowAgent_External {
|
|
|
60
60
|
* Adapter configuration
|
|
61
61
|
*/
|
|
62
62
|
export interface AgentAdapterConfig {
|
|
63
|
-
/** Enable bidirectional sync with
|
|
63
|
+
/** Enable bidirectional sync with agentic-flow */
|
|
64
64
|
enableSync: boolean;
|
|
65
65
|
/** Auto-convert agent formats */
|
|
66
66
|
autoConvert: boolean;
|
|
@@ -85,13 +85,13 @@ export interface AgentConversionResult {
|
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
/**
|
|
88
|
-
* AgentAdapter - Bridges Claude Flow and
|
|
88
|
+
* AgentAdapter - Bridges Claude Flow and agentic-flow agents
|
|
89
89
|
*
|
|
90
90
|
* This adapter provides:
|
|
91
91
|
* 1. Format conversion between agent representations
|
|
92
92
|
* 2. Delegation management for optimized operations
|
|
93
93
|
* 3. Bidirectional synchronization of agent state
|
|
94
|
-
* 4. Fallback handling when
|
|
94
|
+
* 4. Fallback handling when agentic-flow is unavailable
|
|
95
95
|
*
|
|
96
96
|
* Usage:
|
|
97
97
|
* ```typescript
|
|
@@ -103,10 +103,10 @@ export interface AgentConversionResult {
|
|
|
103
103
|
*
|
|
104
104
|
* await adapter.initialize();
|
|
105
105
|
*
|
|
106
|
-
* // Convert
|
|
106
|
+
* // Convert agentic-flow agent to Claude Flow agent
|
|
107
107
|
* const { agent, success } = adapter.fromAgenticFlow(agenticFlowAgent);
|
|
108
108
|
*
|
|
109
|
-
* // Create Claude Flow agent with
|
|
109
|
+
* // Create Claude Flow agent with agentic-flow delegation
|
|
110
110
|
* const delegatedAgent = await adapter.createWithDelegation({
|
|
111
111
|
* id: 'agent-1',
|
|
112
112
|
* name: 'Coder',
|
|
@@ -124,7 +124,7 @@ export class AgentAdapter extends EventEmitter {
|
|
|
124
124
|
private delegationMap: Map<string, AgenticFlowAgent_External> = new Map();
|
|
125
125
|
|
|
126
126
|
/**
|
|
127
|
-
* Reference to
|
|
127
|
+
* Reference to agentic-flow core for accessing Agent factory
|
|
128
128
|
*/
|
|
129
129
|
private agenticFlowCore: any = null;
|
|
130
130
|
|
|
@@ -150,7 +150,7 @@ export class AgentAdapter extends EventEmitter {
|
|
|
150
150
|
this.emit('initializing');
|
|
151
151
|
|
|
152
152
|
try {
|
|
153
|
-
// Attempt to load
|
|
153
|
+
// Attempt to load agentic-flow for delegation
|
|
154
154
|
await this.connectToAgenticFlow();
|
|
155
155
|
|
|
156
156
|
this.initialized = true;
|
|
@@ -185,12 +185,12 @@ export class AgentAdapter extends EventEmitter {
|
|
|
185
185
|
}
|
|
186
186
|
|
|
187
187
|
/**
|
|
188
|
-
* Convert
|
|
188
|
+
* Convert agentic-flow agent to Claude Flow AgenticFlowAgent
|
|
189
189
|
*
|
|
190
190
|
* This method creates a Claude Flow agent wrapper around an existing
|
|
191
|
-
*
|
|
191
|
+
* agentic-flow agent instance, enabling delegation and integration.
|
|
192
192
|
*
|
|
193
|
-
* @param agenticFlowAgent -
|
|
193
|
+
* @param agenticFlowAgent - agentic-flow agent instance
|
|
194
194
|
* @returns Conversion result with wrapped agent
|
|
195
195
|
*/
|
|
196
196
|
fromAgenticFlow(
|
|
@@ -200,7 +200,7 @@ export class AgentAdapter extends EventEmitter {
|
|
|
200
200
|
const unmappedFields: string[] = [];
|
|
201
201
|
|
|
202
202
|
try {
|
|
203
|
-
// Map
|
|
203
|
+
// Map agentic-flow config to Claude Flow config
|
|
204
204
|
const config: AgentConfig = {
|
|
205
205
|
id: agenticFlowAgent.id,
|
|
206
206
|
name: agenticFlowAgent.name,
|
|
@@ -277,13 +277,13 @@ export class AgentAdapter extends EventEmitter {
|
|
|
277
277
|
}
|
|
278
278
|
|
|
279
279
|
/**
|
|
280
|
-
* Convert Claude Flow AgenticFlowAgent to
|
|
280
|
+
* Convert Claude Flow AgenticFlowAgent to agentic-flow format
|
|
281
281
|
*
|
|
282
282
|
* This exports the agent configuration in a format compatible with
|
|
283
|
-
*
|
|
283
|
+
* agentic-flow's Agent constructor/factory.
|
|
284
284
|
*
|
|
285
285
|
* @param agent - Claude Flow agent instance
|
|
286
|
-
* @returns
|
|
286
|
+
* @returns agentic-flow compatible configuration
|
|
287
287
|
*/
|
|
288
288
|
toAgenticFlow(agent: AgenticFlowAgent): Record<string, unknown> {
|
|
289
289
|
return {
|
|
@@ -307,12 +307,12 @@ export class AgentAdapter extends EventEmitter {
|
|
|
307
307
|
}
|
|
308
308
|
|
|
309
309
|
/**
|
|
310
|
-
* Create a Claude Flow agent with
|
|
310
|
+
* Create a Claude Flow agent with agentic-flow delegation
|
|
311
311
|
*
|
|
312
312
|
* This is the primary method for creating agents in v3 with
|
|
313
|
-
* automatic delegation to
|
|
313
|
+
* automatic delegation to agentic-flow when available.
|
|
314
314
|
*
|
|
315
|
-
* ADR-001: Eliminates duplicate code by delegating to
|
|
315
|
+
* ADR-001: Eliminates duplicate code by delegating to agentic-flow
|
|
316
316
|
* for core agent operations when the package is available.
|
|
317
317
|
*
|
|
318
318
|
* @param config - Agent configuration
|
|
@@ -326,7 +326,7 @@ export class AgentAdapter extends EventEmitter {
|
|
|
326
326
|
enableDelegation: true,
|
|
327
327
|
});
|
|
328
328
|
|
|
329
|
-
// If
|
|
329
|
+
// If agentic-flow is available, create delegation reference
|
|
330
330
|
if (this.agenticFlowCore && this.agenticFlowCore.createAgent) {
|
|
331
331
|
try {
|
|
332
332
|
const agenticFlowAgent = await this.agenticFlowCore.createAgent({
|
|
@@ -400,7 +400,7 @@ export class AgentAdapter extends EventEmitter {
|
|
|
400
400
|
}
|
|
401
401
|
|
|
402
402
|
/**
|
|
403
|
-
* Check if an agent is delegated to
|
|
403
|
+
* Check if an agent is delegated to agentic-flow
|
|
404
404
|
*/
|
|
405
405
|
isDelegated(agentId: string): boolean {
|
|
406
406
|
return this.delegationMap.has(agentId);
|
|
@@ -437,13 +437,13 @@ export class AgentAdapter extends EventEmitter {
|
|
|
437
437
|
// ===== Private Methods =====
|
|
438
438
|
|
|
439
439
|
/**
|
|
440
|
-
* Connect to
|
|
440
|
+
* Connect to agentic-flow package dynamically
|
|
441
441
|
*/
|
|
442
442
|
private async connectToAgenticFlow(): Promise<void> {
|
|
443
443
|
try {
|
|
444
444
|
// Dynamic import to handle optional dependency
|
|
445
445
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
446
|
-
const agenticFlowModule: any = await import('
|
|
446
|
+
const agenticFlowModule: any = await import('agentic-flow').catch(() => null);
|
|
447
447
|
|
|
448
448
|
if (agenticFlowModule && typeof agenticFlowModule.createAgenticFlow === 'function') {
|
|
449
449
|
this.agenticFlowCore = await agenticFlowModule.createAgenticFlow({});
|
|
@@ -452,7 +452,7 @@ export class AgentAdapter extends EventEmitter {
|
|
|
452
452
|
version: this.agenticFlowCore.version,
|
|
453
453
|
});
|
|
454
454
|
|
|
455
|
-
this.logDebug('Connected to
|
|
455
|
+
this.logDebug('Connected to agentic-flow', {
|
|
456
456
|
version: this.agenticFlowCore.version,
|
|
457
457
|
});
|
|
458
458
|
} else {
|
|
@@ -460,19 +460,19 @@ export class AgentAdapter extends EventEmitter {
|
|
|
460
460
|
this.emit('agentic-flow-unavailable', {
|
|
461
461
|
reason: 'package not found or incompatible',
|
|
462
462
|
});
|
|
463
|
-
this.logDebug('
|
|
463
|
+
this.logDebug('agentic-flow not available, using local implementations');
|
|
464
464
|
}
|
|
465
465
|
} catch (error) {
|
|
466
466
|
this.agenticFlowCore = null;
|
|
467
467
|
this.emit('agentic-flow-connection-failed', {
|
|
468
468
|
error: (error as Error).message,
|
|
469
469
|
});
|
|
470
|
-
this.logDebug('
|
|
470
|
+
this.logDebug('agentic-flow connection failed', error);
|
|
471
471
|
}
|
|
472
472
|
}
|
|
473
473
|
|
|
474
474
|
/**
|
|
475
|
-
* Map
|
|
475
|
+
* Map agentic-flow agent type to Claude Flow AgentType
|
|
476
476
|
*/
|
|
477
477
|
private mapAgentType(type: string, warnings: string[]): AgentType | string {
|
|
478
478
|
// Known valid agent types that pass through directly
|
|
@@ -517,7 +517,7 @@ export class AgentAdapter extends EventEmitter {
|
|
|
517
517
|
}
|
|
518
518
|
|
|
519
519
|
/**
|
|
520
|
-
* Extract capabilities from
|
|
520
|
+
* Extract capabilities from agentic-flow config
|
|
521
521
|
*/
|
|
522
522
|
private extractCapabilities(
|
|
523
523
|
config: Record<string, unknown>,
|
|
@@ -562,13 +562,13 @@ export class AgentAdapter extends EventEmitter {
|
|
|
562
562
|
}
|
|
563
563
|
|
|
564
564
|
/**
|
|
565
|
-
* Sync status between Claude Flow and
|
|
565
|
+
* Sync status between Claude Flow and agentic-flow agents
|
|
566
566
|
*/
|
|
567
567
|
private syncStatus(
|
|
568
568
|
agent: AgenticFlowAgent,
|
|
569
569
|
agenticFlowAgent: AgenticFlowAgent_External
|
|
570
570
|
): void {
|
|
571
|
-
// Map
|
|
571
|
+
// Map agentic-flow status to Claude Flow status
|
|
572
572
|
const statusMap: Record<string, AgentStatus> = {
|
|
573
573
|
'initializing': 'spawning',
|
|
574
574
|
'ready': 'idle',
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* AgenticFlowAgent - Claude Flow Agent with
|
|
2
|
+
* AgenticFlowAgent - Claude Flow Agent with agentic-flow Delegation
|
|
3
3
|
*
|
|
4
|
-
* Per ADR-001: "Use
|
|
5
|
-
* This class wraps
|
|
4
|
+
* Per ADR-001: "Use agentic-flow's Agent base class for all agents"
|
|
5
|
+
* This class wraps agentic-flow functionality while adding Claude Flow specifics.
|
|
6
6
|
*
|
|
7
7
|
* This implements the adapter pattern to bridge between:
|
|
8
8
|
* - Claude Flow's agent lifecycle (v3 DDD architecture)
|
|
9
|
-
* -
|
|
9
|
+
* - agentic-flow's optimized agent implementations
|
|
10
10
|
*
|
|
11
|
-
* When
|
|
12
|
-
*
|
|
11
|
+
* When agentic-flow is available, this class delegates core operations to
|
|
12
|
+
* agentic-flow's Agent implementations, eliminating 10,000+ lines of duplicate code.
|
|
13
13
|
*
|
|
14
14
|
* Performance Benefits:
|
|
15
15
|
* - Flash Attention: 2.49x-7.47x speedup for context processing
|
|
@@ -189,8 +189,8 @@ export interface AgentHealth {
|
|
|
189
189
|
}
|
|
190
190
|
|
|
191
191
|
/**
|
|
192
|
-
* Interface for
|
|
193
|
-
* This represents the
|
|
192
|
+
* Interface for agentic-flow Agent reference (for delegation)
|
|
193
|
+
* This represents the agentic-flow Agent class API
|
|
194
194
|
*/
|
|
195
195
|
interface AgenticFlowAgentReference {
|
|
196
196
|
id: string;
|
|
@@ -208,9 +208,9 @@ interface AgenticFlowAgentReference {
|
|
|
208
208
|
* AgenticFlowAgent Configuration
|
|
209
209
|
*/
|
|
210
210
|
export interface AgentConfig extends IAgentConfig {
|
|
211
|
-
/** Enable delegation to
|
|
211
|
+
/** Enable delegation to agentic-flow */
|
|
212
212
|
enableDelegation?: boolean;
|
|
213
|
-
/**
|
|
213
|
+
/** agentic-flow specific configuration */
|
|
214
214
|
agenticFlowConfig?: Record<string, unknown>;
|
|
215
215
|
}
|
|
216
216
|
|
|
@@ -218,7 +218,7 @@ export interface AgentConfig extends IAgentConfig {
|
|
|
218
218
|
* AgenticFlowAgent - Base class for all Claude Flow v3 agents
|
|
219
219
|
*
|
|
220
220
|
* This class serves as the foundation for all agent types in Claude Flow v3,
|
|
221
|
-
* implementing ADR-001 by delegating to
|
|
221
|
+
* implementing ADR-001 by delegating to agentic-flow when available while
|
|
222
222
|
* maintaining backward compatibility with local implementations.
|
|
223
223
|
*
|
|
224
224
|
* Usage:
|
|
@@ -285,13 +285,13 @@ export class AgenticFlowAgent extends EventEmitter implements IAgent {
|
|
|
285
285
|
private totalTaskDuration: number = 0;
|
|
286
286
|
|
|
287
287
|
/**
|
|
288
|
-
* Reference to
|
|
289
|
-
* When set, core operations delegate to
|
|
288
|
+
* Reference to agentic-flow Agent for delegation (ADR-001)
|
|
289
|
+
* When set, core operations delegate to agentic-flow's optimized implementations
|
|
290
290
|
*/
|
|
291
291
|
private agenticFlowRef: AgenticFlowAgentReference | null = null;
|
|
292
292
|
|
|
293
293
|
/**
|
|
294
|
-
* Indicates if delegation to
|
|
294
|
+
* Indicates if delegation to agentic-flow is active
|
|
295
295
|
*/
|
|
296
296
|
private delegationEnabled: boolean = false;
|
|
297
297
|
|
|
@@ -341,18 +341,18 @@ export class AgenticFlowAgent extends EventEmitter implements IAgent {
|
|
|
341
341
|
}
|
|
342
342
|
|
|
343
343
|
/**
|
|
344
|
-
* Set
|
|
344
|
+
* Set agentic-flow Agent reference for delegation
|
|
345
345
|
*
|
|
346
|
-
* This implements ADR-001: Adopt
|
|
346
|
+
* This implements ADR-001: Adopt agentic-flow as Core Foundation
|
|
347
347
|
* When a reference is provided, task execution and other operations
|
|
348
|
-
* delegate to
|
|
348
|
+
* delegate to agentic-flow's optimized implementations.
|
|
349
349
|
*
|
|
350
350
|
* Benefits:
|
|
351
351
|
* - Flash Attention for faster context processing (2.49x-7.47x speedup)
|
|
352
352
|
* - SONA learning for real-time adaptation (<0.05ms)
|
|
353
353
|
* - AgentDB for faster memory search (150x-12,500x improvement)
|
|
354
354
|
*
|
|
355
|
-
* @param ref - The
|
|
355
|
+
* @param ref - The agentic-flow Agent reference
|
|
356
356
|
*/
|
|
357
357
|
setAgenticFlowReference(ref: AgenticFlowAgentReference): void {
|
|
358
358
|
this.agenticFlowRef = ref;
|
|
@@ -360,20 +360,20 @@ export class AgenticFlowAgent extends EventEmitter implements IAgent {
|
|
|
360
360
|
|
|
361
361
|
this.emit('delegation-enabled', {
|
|
362
362
|
agentId: this.id,
|
|
363
|
-
target: '
|
|
363
|
+
target: 'agentic-flow',
|
|
364
364
|
enabled: this.delegationEnabled,
|
|
365
365
|
});
|
|
366
366
|
}
|
|
367
367
|
|
|
368
368
|
/**
|
|
369
|
-
* Check if delegation to
|
|
369
|
+
* Check if delegation to agentic-flow is enabled
|
|
370
370
|
*/
|
|
371
371
|
isDelegationEnabled(): boolean {
|
|
372
372
|
return this.delegationEnabled && this.agenticFlowRef !== null;
|
|
373
373
|
}
|
|
374
374
|
|
|
375
375
|
/**
|
|
376
|
-
* Get the
|
|
376
|
+
* Get the agentic-flow reference (if available)
|
|
377
377
|
*/
|
|
378
378
|
getAgenticFlowReference(): AgenticFlowAgentReference | null {
|
|
379
379
|
return this.agenticFlowRef;
|
|
@@ -382,8 +382,8 @@ export class AgenticFlowAgent extends EventEmitter implements IAgent {
|
|
|
382
382
|
/**
|
|
383
383
|
* Initialize the agent
|
|
384
384
|
*
|
|
385
|
-
* ADR-001: When
|
|
386
|
-
* to
|
|
385
|
+
* ADR-001: When agentic-flow is available, delegates initialization
|
|
386
|
+
* to agentic-flow's Agent.initialize() for optimized setup.
|
|
387
387
|
*/
|
|
388
388
|
async initialize(): Promise<void> {
|
|
389
389
|
if (this.initialized) {
|
|
@@ -393,7 +393,7 @@ export class AgenticFlowAgent extends EventEmitter implements IAgent {
|
|
|
393
393
|
this.emit('initializing', { agentId: this.id });
|
|
394
394
|
|
|
395
395
|
try {
|
|
396
|
-
// ADR-001: Delegate to
|
|
396
|
+
// ADR-001: Delegate to agentic-flow when available
|
|
397
397
|
if (this.isDelegationEnabled() && this.agenticFlowRef?.initialize) {
|
|
398
398
|
await this.agenticFlowRef.initialize();
|
|
399
399
|
this.emit('delegation-success', {
|
|
@@ -427,8 +427,8 @@ export class AgenticFlowAgent extends EventEmitter implements IAgent {
|
|
|
427
427
|
/**
|
|
428
428
|
* Shutdown the agent gracefully
|
|
429
429
|
*
|
|
430
|
-
* ADR-001: When
|
|
431
|
-
* to
|
|
430
|
+
* ADR-001: When agentic-flow is available, delegates shutdown
|
|
431
|
+
* to agentic-flow's Agent.shutdown() for clean termination.
|
|
432
432
|
*/
|
|
433
433
|
async shutdown(): Promise<void> {
|
|
434
434
|
this.emit('shutting-down', { agentId: this.id });
|
|
@@ -443,7 +443,7 @@ export class AgenticFlowAgent extends EventEmitter implements IAgent {
|
|
|
443
443
|
this.currentTask = null;
|
|
444
444
|
}
|
|
445
445
|
|
|
446
|
-
// ADR-001: Delegate to
|
|
446
|
+
// ADR-001: Delegate to agentic-flow when available
|
|
447
447
|
if (this.isDelegationEnabled() && this.agenticFlowRef?.shutdown) {
|
|
448
448
|
await this.agenticFlowRef.shutdown();
|
|
449
449
|
this.emit('delegation-success', {
|
|
@@ -473,8 +473,8 @@ export class AgenticFlowAgent extends EventEmitter implements IAgent {
|
|
|
473
473
|
/**
|
|
474
474
|
* Execute a task
|
|
475
475
|
*
|
|
476
|
-
* ADR-001: When
|
|
477
|
-
* to
|
|
476
|
+
* ADR-001: When agentic-flow is available, delegates task execution
|
|
477
|
+
* to agentic-flow's Agent.execute() which leverages:
|
|
478
478
|
* - Flash Attention for 2.49x-7.47x faster processing
|
|
479
479
|
* - SONA learning for real-time adaptation
|
|
480
480
|
* - AgentDB for 150x-12,500x faster memory retrieval
|
|
@@ -510,7 +510,7 @@ export class AgenticFlowAgent extends EventEmitter implements IAgent {
|
|
|
510
510
|
try {
|
|
511
511
|
let output: unknown;
|
|
512
512
|
|
|
513
|
-
// ADR-001: Delegate to
|
|
513
|
+
// ADR-001: Delegate to agentic-flow when available for optimized execution
|
|
514
514
|
if (this.isDelegationEnabled() && this.agenticFlowRef?.execute) {
|
|
515
515
|
output = await this.agenticFlowRef.execute(task);
|
|
516
516
|
|
|
@@ -520,7 +520,7 @@ export class AgenticFlowAgent extends EventEmitter implements IAgent {
|
|
|
520
520
|
taskId: task.id,
|
|
521
521
|
});
|
|
522
522
|
} else {
|
|
523
|
-
// Local execution (fallback or when
|
|
523
|
+
// Local execution (fallback or when agentic-flow not available)
|
|
524
524
|
output = await this.localExecuteTask(task);
|
|
525
525
|
}
|
|
526
526
|
|
|
@@ -580,7 +580,7 @@ export class AgenticFlowAgent extends EventEmitter implements IAgent {
|
|
|
580
580
|
/**
|
|
581
581
|
* Send a message to another agent
|
|
582
582
|
*
|
|
583
|
-
* ADR-001: When
|
|
583
|
+
* ADR-001: When agentic-flow is available, delegates to agentic-flow's
|
|
584
584
|
* message routing which uses optimized communication channels.
|
|
585
585
|
*
|
|
586
586
|
* @param to - Target agent ID
|
|
@@ -596,7 +596,7 @@ export class AgenticFlowAgent extends EventEmitter implements IAgent {
|
|
|
596
596
|
});
|
|
597
597
|
|
|
598
598
|
try {
|
|
599
|
-
// ADR-001: Delegate to
|
|
599
|
+
// ADR-001: Delegate to agentic-flow when available
|
|
600
600
|
if (this.isDelegationEnabled() && this.agenticFlowRef?.sendMessage) {
|
|
601
601
|
await this.agenticFlowRef.sendMessage(to, message);
|
|
602
602
|
|
|
@@ -659,7 +659,7 @@ export class AgenticFlowAgent extends EventEmitter implements IAgent {
|
|
|
659
659
|
/**
|
|
660
660
|
* Get agent health information
|
|
661
661
|
*
|
|
662
|
-
* ADR-001: When
|
|
662
|
+
* ADR-001: When agentic-flow is available, delegates to agentic-flow's
|
|
663
663
|
* health monitoring which includes advanced metrics.
|
|
664
664
|
*/
|
|
665
665
|
getHealth(): AgentHealth {
|