agent-swarm-kit 1.1.176 → 1.1.178
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/build/index.cjs +281 -19
- package/build/index.mjs +281 -19
- package/package.json +1 -1
- package/types.d.ts +141 -5
package/build/index.cjs
CHANGED
|
@@ -24475,29 +24475,291 @@ const Adapter = new AdapterUtils();
|
|
|
24475
24475
|
|
|
24476
24476
|
const METHOD_NAME = "function.common.validate";
|
|
24477
24477
|
/**
|
|
24478
|
-
*
|
|
24479
|
-
*
|
|
24480
|
-
*
|
|
24478
|
+
* Retrieves all registered swarms as a map
|
|
24479
|
+
* @private
|
|
24480
|
+
* @returns Map of swarm names
|
|
24481
|
+
*/
|
|
24482
|
+
const getSwarmMap = () => {
|
|
24483
|
+
const swarmMap = {};
|
|
24484
|
+
for (const swarmName of swarm$1.swarmValidationService.getSwarmList()) {
|
|
24485
|
+
Object.assign(swarmMap, { [swarmName]: swarmName });
|
|
24486
|
+
}
|
|
24487
|
+
return swarmMap;
|
|
24488
|
+
};
|
|
24489
|
+
/**
|
|
24490
|
+
* Retrieves all registered agents as a map
|
|
24491
|
+
* @private
|
|
24492
|
+
* @returns Map of agent names
|
|
24493
|
+
*/
|
|
24494
|
+
const getAgentMap = () => {
|
|
24495
|
+
const agentMap = {};
|
|
24496
|
+
for (const agentName of swarm$1.agentValidationService.getAgentList()) {
|
|
24497
|
+
Object.assign(agentMap, { [agentName]: agentName });
|
|
24498
|
+
}
|
|
24499
|
+
return agentMap;
|
|
24500
|
+
};
|
|
24501
|
+
/**
|
|
24502
|
+
* Retrieves all registered outlines as a map
|
|
24503
|
+
* @private
|
|
24504
|
+
* @returns Map of outline names
|
|
24505
|
+
*/
|
|
24506
|
+
const getOutlineMap = () => {
|
|
24507
|
+
const outlineMap = {};
|
|
24508
|
+
for (const outlineName of swarm$1.outlineValidationService.getOutlineList()) {
|
|
24509
|
+
Object.assign(outlineMap, { [outlineName]: outlineName });
|
|
24510
|
+
}
|
|
24511
|
+
return outlineMap;
|
|
24512
|
+
};
|
|
24513
|
+
/**
|
|
24514
|
+
* Retrieves all registered computes as a map
|
|
24515
|
+
* @private
|
|
24516
|
+
* @returns Map of compute names
|
|
24517
|
+
*/
|
|
24518
|
+
const getComputeMap = () => {
|
|
24519
|
+
const computeMap = {};
|
|
24520
|
+
for (const computeName of swarm$1.computeValidationService.getComputeList()) {
|
|
24521
|
+
Object.assign(computeMap, { [computeName]: computeName });
|
|
24522
|
+
}
|
|
24523
|
+
return computeMap;
|
|
24524
|
+
};
|
|
24525
|
+
/**
|
|
24526
|
+
* Retrieves all registered sessions as a map
|
|
24527
|
+
* @private
|
|
24528
|
+
* @returns Map of session IDs
|
|
24529
|
+
*/
|
|
24530
|
+
const getSessionMap = () => {
|
|
24531
|
+
const sessionMap = {};
|
|
24532
|
+
for (const sessionId of swarm$1.sessionValidationService.getSessionList()) {
|
|
24533
|
+
Object.assign(sessionMap, { [sessionId]: sessionId });
|
|
24534
|
+
}
|
|
24535
|
+
return sessionMap;
|
|
24536
|
+
};
|
|
24537
|
+
/**
|
|
24538
|
+
* Retrieves all registered advisors as a map by accessing internal _advisorMap
|
|
24539
|
+
* @private
|
|
24540
|
+
* @returns Map of advisor names
|
|
24541
|
+
*/
|
|
24542
|
+
const getAdvisorMap = () => {
|
|
24543
|
+
const advisorMap = {};
|
|
24544
|
+
// AdvisorValidationService doesn't expose getList, so we return empty map
|
|
24545
|
+
// Advisors will be validated when explicitly provided
|
|
24546
|
+
return advisorMap;
|
|
24547
|
+
};
|
|
24548
|
+
/**
|
|
24549
|
+
* Retrieves all registered completions as a map by accessing internal _completionSet
|
|
24550
|
+
* @private
|
|
24551
|
+
* @returns Map of completion names
|
|
24552
|
+
*/
|
|
24553
|
+
const getCompletionMap = () => {
|
|
24554
|
+
const completionMap = {};
|
|
24555
|
+
// CompletionValidationService doesn't expose getList, so we return empty map
|
|
24556
|
+
// Completions will be validated indirectly through agents and outlines
|
|
24557
|
+
return completionMap;
|
|
24558
|
+
};
|
|
24559
|
+
/**
|
|
24560
|
+
* Retrieves all registered embeddings as a map by accessing internal _embeddingMap
|
|
24561
|
+
* @private
|
|
24562
|
+
* @returns Map of embedding names
|
|
24563
|
+
*/
|
|
24564
|
+
const getEmbeddingMap = () => {
|
|
24565
|
+
const embeddingMap = {};
|
|
24566
|
+
// EmbeddingValidationService doesn't expose getList, so we return empty map
|
|
24567
|
+
// Embeddings will be validated indirectly through storages
|
|
24568
|
+
return embeddingMap;
|
|
24569
|
+
};
|
|
24570
|
+
/**
|
|
24571
|
+
* Retrieves all registered MCPs as a map by accessing internal _mcpMap
|
|
24572
|
+
* @private
|
|
24573
|
+
* @returns Map of MCP names
|
|
24574
|
+
*/
|
|
24575
|
+
const getMCPMap = () => {
|
|
24576
|
+
const mcpMap = {};
|
|
24577
|
+
// MCPValidationService doesn't expose getList, so we return empty map
|
|
24578
|
+
// MCPs will be validated indirectly through agents
|
|
24579
|
+
return mcpMap;
|
|
24580
|
+
};
|
|
24581
|
+
/**
|
|
24582
|
+
* Retrieves all registered pipelines as a map by accessing internal _pipelineMap
|
|
24583
|
+
* @private
|
|
24584
|
+
* @returns Map of pipeline names
|
|
24585
|
+
*/
|
|
24586
|
+
const getPipelineMap = () => {
|
|
24587
|
+
const pipelineMap = {};
|
|
24588
|
+
// PipelineValidationService doesn't expose getList, so we return empty map
|
|
24589
|
+
// Pipelines will be validated when explicitly provided
|
|
24590
|
+
return pipelineMap;
|
|
24591
|
+
};
|
|
24592
|
+
/**
|
|
24593
|
+
* Retrieves all registered policies as a map by accessing internal _policyMap
|
|
24594
|
+
* @private
|
|
24595
|
+
* @returns Map of policy names
|
|
24596
|
+
*/
|
|
24597
|
+
const getPolicyMap = () => {
|
|
24598
|
+
const policyMap = {};
|
|
24599
|
+
// PolicyValidationService doesn't expose getList, so we return empty map
|
|
24600
|
+
// Policies will be validated indirectly through swarms
|
|
24601
|
+
return policyMap;
|
|
24602
|
+
};
|
|
24603
|
+
/**
|
|
24604
|
+
* Retrieves all registered states as a map by accessing internal _stateMap
|
|
24605
|
+
* @private
|
|
24606
|
+
* @returns Map of state names
|
|
24607
|
+
*/
|
|
24608
|
+
const getStateMap = () => {
|
|
24609
|
+
const stateMap = {};
|
|
24610
|
+
// StateValidationService doesn't expose getList, so we return empty map
|
|
24611
|
+
// States will be validated indirectly through agents and computes
|
|
24612
|
+
return stateMap;
|
|
24613
|
+
};
|
|
24614
|
+
/**
|
|
24615
|
+
* Retrieves all registered storages as a map by accessing internal _storageMap
|
|
24616
|
+
* @private
|
|
24617
|
+
* @returns Map of storage names
|
|
24618
|
+
*/
|
|
24619
|
+
const getStorageMap = () => {
|
|
24620
|
+
const storageMap = {};
|
|
24621
|
+
// StorageValidationService doesn't expose getList, so we return empty map
|
|
24622
|
+
// Storages will be validated indirectly through agents
|
|
24623
|
+
return storageMap;
|
|
24624
|
+
};
|
|
24625
|
+
/**
|
|
24626
|
+
* Retrieves all registered tools as a map by accessing internal _toolMap
|
|
24627
|
+
* @private
|
|
24628
|
+
* @returns Map of tool names
|
|
24629
|
+
*/
|
|
24630
|
+
const getToolMap = () => {
|
|
24631
|
+
const toolMap = {};
|
|
24632
|
+
// ToolValidationService doesn't expose getList, so we return empty map
|
|
24633
|
+
// Tools will be validated indirectly through agents
|
|
24634
|
+
return toolMap;
|
|
24635
|
+
};
|
|
24636
|
+
/**
|
|
24637
|
+
* Internal validation function that processes all provided entity enums.
|
|
24638
|
+
*
|
|
24639
|
+
* Iterates through each enum's values and validates them against their
|
|
24640
|
+
* respective validation services. Uses memoized validation for performance.
|
|
24641
|
+
*
|
|
24642
|
+
* If entity enums are not provided, fetches all registered entities from
|
|
24643
|
+
* their respective validation services and validates them.
|
|
24644
|
+
*
|
|
24645
|
+
* Note: Advisors, Completions, Embeddings, MCPs, Pipelines, Policies, States,
|
|
24646
|
+
* Storages, and Tools are validated indirectly through their parent entities
|
|
24647
|
+
* (e.g., agents validate their tools, storages, completions, MCP, states, etc.)
|
|
24481
24648
|
*
|
|
24482
24649
|
* @private
|
|
24483
|
-
|
|
24484
|
-
|
|
24485
|
-
|
|
24486
|
-
|
|
24487
|
-
const
|
|
24488
|
-
|
|
24489
|
-
const
|
|
24490
|
-
|
|
24491
|
-
|
|
24492
|
-
|
|
24493
|
-
|
|
24650
|
+
* @param args - Validation arguments containing entity name enums
|
|
24651
|
+
* @throws {Error} If any entity name is not found in its registry
|
|
24652
|
+
*/
|
|
24653
|
+
const validateInternal = (args) => {
|
|
24654
|
+
const { SwarmName = getSwarmMap(), AgentName = getAgentMap(), OutlineName = getOutlineMap(), ComputeName = getComputeMap(), SessionId = getSessionMap(), AdvisorName = getAdvisorMap(), CompletionName = getCompletionMap(), EmbeddingName = getEmbeddingMap(), MCPName = getMCPMap(), PipelineName = getPipelineMap(), PolicyName = getPolicyMap(), StateName = getStateMap(), StorageName = getStorageMap(), ToolName = getToolMap(), } = args;
|
|
24655
|
+
// Validate swarms (which also validates agents and policies)
|
|
24656
|
+
for (const swarmName of Object.values(SwarmName)) {
|
|
24657
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME);
|
|
24658
|
+
}
|
|
24659
|
+
// Validate agents explicitly (validates tools, storages, completions, MCP, states)
|
|
24660
|
+
for (const agentName of Object.values(AgentName)) {
|
|
24661
|
+
swarm$1.agentValidationService.validate(agentName, METHOD_NAME);
|
|
24662
|
+
}
|
|
24663
|
+
// Validate outlines (validates completions)
|
|
24664
|
+
for (const outlineName of Object.values(OutlineName)) {
|
|
24665
|
+
swarm$1.outlineValidationService.validate(outlineName, METHOD_NAME);
|
|
24666
|
+
}
|
|
24667
|
+
// Validate computes (validates state dependencies)
|
|
24668
|
+
for (const computeName of Object.values(ComputeName)) {
|
|
24669
|
+
swarm$1.computeValidationService.validate(computeName, METHOD_NAME);
|
|
24670
|
+
}
|
|
24671
|
+
// Validate sessions (validates swarm assignments)
|
|
24672
|
+
for (const sessionId of Object.values(SessionId)) {
|
|
24673
|
+
swarm$1.sessionValidationService.validate(sessionId, METHOD_NAME);
|
|
24674
|
+
}
|
|
24675
|
+
// Validate optional direct entities
|
|
24676
|
+
// Note: These are typically validated indirectly through their parent entities,
|
|
24677
|
+
// but can be validated directly when explicitly provided
|
|
24678
|
+
for (const advisorName of Object.values(AdvisorName)) {
|
|
24679
|
+
swarm$1.advisorValidationService.validate(advisorName, METHOD_NAME);
|
|
24680
|
+
}
|
|
24681
|
+
for (const completionName of Object.values(CompletionName)) {
|
|
24682
|
+
swarm$1.completionValidationService.validate(completionName, METHOD_NAME);
|
|
24683
|
+
}
|
|
24684
|
+
for (const embeddingName of Object.values(EmbeddingName)) {
|
|
24685
|
+
swarm$1.embeddingValidationService.validate(embeddingName, METHOD_NAME);
|
|
24686
|
+
}
|
|
24687
|
+
for (const mcpName of Object.values(MCPName)) {
|
|
24688
|
+
swarm$1.mcpValidationService.validate(mcpName, METHOD_NAME);
|
|
24689
|
+
}
|
|
24690
|
+
for (const pipelineName of Object.values(PipelineName)) {
|
|
24691
|
+
swarm$1.pipelineValidationService.validate(pipelineName, METHOD_NAME);
|
|
24692
|
+
}
|
|
24693
|
+
for (const policyName of Object.values(PolicyName)) {
|
|
24694
|
+
swarm$1.policyValidationService.validate(policyName, METHOD_NAME);
|
|
24695
|
+
}
|
|
24696
|
+
for (const stateName of Object.values(StateName)) {
|
|
24697
|
+
swarm$1.stateValidationService.validate(stateName, METHOD_NAME);
|
|
24698
|
+
}
|
|
24699
|
+
for (const storageName of Object.values(StorageName)) {
|
|
24700
|
+
swarm$1.storageValidationService.validate(storageName, METHOD_NAME);
|
|
24701
|
+
}
|
|
24702
|
+
for (const toolName of Object.values(ToolName)) {
|
|
24703
|
+
swarm$1.toolValidationService.validate(toolName, METHOD_NAME);
|
|
24704
|
+
}
|
|
24705
|
+
};
|
|
24494
24706
|
/**
|
|
24495
|
-
* Validates all
|
|
24496
|
-
* This function is idempotent and will only perform validation once per process.
|
|
24707
|
+
* Validates the existence of all provided entity names across validation services.
|
|
24497
24708
|
*
|
|
24498
|
-
|
|
24499
|
-
|
|
24500
|
-
|
|
24709
|
+
* This function accepts enum objects for various entity types (swarms, agents, outlines,
|
|
24710
|
+
* advisors, completions, computes, embeddings, MCPs, pipelines, policies, sessions,
|
|
24711
|
+
* states, storages, tools) and validates that each entity name exists in its respective
|
|
24712
|
+
* registry. Validation results are memoized for performance.
|
|
24713
|
+
*
|
|
24714
|
+
* If no arguments are provided (or specific entity types are omitted), the function
|
|
24715
|
+
* automatically fetches and validates ALL registered entities from their respective
|
|
24716
|
+
* validation services. This is useful for comprehensive validation of the entire setup.
|
|
24717
|
+
*
|
|
24718
|
+
* Use this before running operations to ensure all referenced entities are properly
|
|
24719
|
+
* registered and configured.
|
|
24720
|
+
*
|
|
24721
|
+
* @public
|
|
24722
|
+
* @param args - Partial validation arguments containing entity name enums to validate.
|
|
24723
|
+
* If empty or omitted, validates all registered entities.
|
|
24724
|
+
* @throws {Error} If any entity name is not found in its validation service
|
|
24725
|
+
*
|
|
24726
|
+
* @example
|
|
24727
|
+
* ```typescript
|
|
24728
|
+
* // Validate ALL registered entities (swarms, agents, outlines, etc.)
|
|
24729
|
+
* validate({});
|
|
24730
|
+
* ```
|
|
24731
|
+
*
|
|
24732
|
+
* @example
|
|
24733
|
+
* ```typescript
|
|
24734
|
+
* // Define your entity name enums
|
|
24735
|
+
* enum SwarmName {
|
|
24736
|
+
* MY_SWARM = "my-swarm"
|
|
24737
|
+
* }
|
|
24738
|
+
*
|
|
24739
|
+
* enum AgentName {
|
|
24740
|
+
* MY_AGENT = "my-agent"
|
|
24741
|
+
* }
|
|
24742
|
+
*
|
|
24743
|
+
* // Validate specific entities
|
|
24744
|
+
* validate({
|
|
24745
|
+
* SwarmName,
|
|
24746
|
+
* AgentName,
|
|
24747
|
+
* });
|
|
24748
|
+
* ```
|
|
24749
|
+
*
|
|
24750
|
+
* @example
|
|
24751
|
+
* ```typescript
|
|
24752
|
+
* // Validate specific entity types
|
|
24753
|
+
* validate({
|
|
24754
|
+
* CompletionName: { CLAUDE_SONNET: "claude-sonnet-4-5" },
|
|
24755
|
+
* EmbeddingName: { TEXT_EMBEDDING: "text-embedding-3-small" },
|
|
24756
|
+
* });
|
|
24757
|
+
* ```
|
|
24758
|
+
*/
|
|
24759
|
+
function validate(args = {}) {
|
|
24760
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
24761
|
+
swarm$1.loggerService.log(METHOD_NAME);
|
|
24762
|
+
return validateInternal(args);
|
|
24501
24763
|
}
|
|
24502
24764
|
|
|
24503
24765
|
/**
|
package/build/index.mjs
CHANGED
|
@@ -24455,29 +24455,291 @@ const Adapter = new AdapterUtils();
|
|
|
24455
24455
|
|
|
24456
24456
|
const METHOD_NAME = "function.common.validate";
|
|
24457
24457
|
/**
|
|
24458
|
-
*
|
|
24459
|
-
*
|
|
24460
|
-
*
|
|
24458
|
+
* Retrieves all registered swarms as a map
|
|
24459
|
+
* @private
|
|
24460
|
+
* @returns Map of swarm names
|
|
24461
|
+
*/
|
|
24462
|
+
const getSwarmMap = () => {
|
|
24463
|
+
const swarmMap = {};
|
|
24464
|
+
for (const swarmName of swarm$1.swarmValidationService.getSwarmList()) {
|
|
24465
|
+
Object.assign(swarmMap, { [swarmName]: swarmName });
|
|
24466
|
+
}
|
|
24467
|
+
return swarmMap;
|
|
24468
|
+
};
|
|
24469
|
+
/**
|
|
24470
|
+
* Retrieves all registered agents as a map
|
|
24471
|
+
* @private
|
|
24472
|
+
* @returns Map of agent names
|
|
24473
|
+
*/
|
|
24474
|
+
const getAgentMap = () => {
|
|
24475
|
+
const agentMap = {};
|
|
24476
|
+
for (const agentName of swarm$1.agentValidationService.getAgentList()) {
|
|
24477
|
+
Object.assign(agentMap, { [agentName]: agentName });
|
|
24478
|
+
}
|
|
24479
|
+
return agentMap;
|
|
24480
|
+
};
|
|
24481
|
+
/**
|
|
24482
|
+
* Retrieves all registered outlines as a map
|
|
24483
|
+
* @private
|
|
24484
|
+
* @returns Map of outline names
|
|
24485
|
+
*/
|
|
24486
|
+
const getOutlineMap = () => {
|
|
24487
|
+
const outlineMap = {};
|
|
24488
|
+
for (const outlineName of swarm$1.outlineValidationService.getOutlineList()) {
|
|
24489
|
+
Object.assign(outlineMap, { [outlineName]: outlineName });
|
|
24490
|
+
}
|
|
24491
|
+
return outlineMap;
|
|
24492
|
+
};
|
|
24493
|
+
/**
|
|
24494
|
+
* Retrieves all registered computes as a map
|
|
24495
|
+
* @private
|
|
24496
|
+
* @returns Map of compute names
|
|
24497
|
+
*/
|
|
24498
|
+
const getComputeMap = () => {
|
|
24499
|
+
const computeMap = {};
|
|
24500
|
+
for (const computeName of swarm$1.computeValidationService.getComputeList()) {
|
|
24501
|
+
Object.assign(computeMap, { [computeName]: computeName });
|
|
24502
|
+
}
|
|
24503
|
+
return computeMap;
|
|
24504
|
+
};
|
|
24505
|
+
/**
|
|
24506
|
+
* Retrieves all registered sessions as a map
|
|
24507
|
+
* @private
|
|
24508
|
+
* @returns Map of session IDs
|
|
24509
|
+
*/
|
|
24510
|
+
const getSessionMap = () => {
|
|
24511
|
+
const sessionMap = {};
|
|
24512
|
+
for (const sessionId of swarm$1.sessionValidationService.getSessionList()) {
|
|
24513
|
+
Object.assign(sessionMap, { [sessionId]: sessionId });
|
|
24514
|
+
}
|
|
24515
|
+
return sessionMap;
|
|
24516
|
+
};
|
|
24517
|
+
/**
|
|
24518
|
+
* Retrieves all registered advisors as a map by accessing internal _advisorMap
|
|
24519
|
+
* @private
|
|
24520
|
+
* @returns Map of advisor names
|
|
24521
|
+
*/
|
|
24522
|
+
const getAdvisorMap = () => {
|
|
24523
|
+
const advisorMap = {};
|
|
24524
|
+
// AdvisorValidationService doesn't expose getList, so we return empty map
|
|
24525
|
+
// Advisors will be validated when explicitly provided
|
|
24526
|
+
return advisorMap;
|
|
24527
|
+
};
|
|
24528
|
+
/**
|
|
24529
|
+
* Retrieves all registered completions as a map by accessing internal _completionSet
|
|
24530
|
+
* @private
|
|
24531
|
+
* @returns Map of completion names
|
|
24532
|
+
*/
|
|
24533
|
+
const getCompletionMap = () => {
|
|
24534
|
+
const completionMap = {};
|
|
24535
|
+
// CompletionValidationService doesn't expose getList, so we return empty map
|
|
24536
|
+
// Completions will be validated indirectly through agents and outlines
|
|
24537
|
+
return completionMap;
|
|
24538
|
+
};
|
|
24539
|
+
/**
|
|
24540
|
+
* Retrieves all registered embeddings as a map by accessing internal _embeddingMap
|
|
24541
|
+
* @private
|
|
24542
|
+
* @returns Map of embedding names
|
|
24543
|
+
*/
|
|
24544
|
+
const getEmbeddingMap = () => {
|
|
24545
|
+
const embeddingMap = {};
|
|
24546
|
+
// EmbeddingValidationService doesn't expose getList, so we return empty map
|
|
24547
|
+
// Embeddings will be validated indirectly through storages
|
|
24548
|
+
return embeddingMap;
|
|
24549
|
+
};
|
|
24550
|
+
/**
|
|
24551
|
+
* Retrieves all registered MCPs as a map by accessing internal _mcpMap
|
|
24552
|
+
* @private
|
|
24553
|
+
* @returns Map of MCP names
|
|
24554
|
+
*/
|
|
24555
|
+
const getMCPMap = () => {
|
|
24556
|
+
const mcpMap = {};
|
|
24557
|
+
// MCPValidationService doesn't expose getList, so we return empty map
|
|
24558
|
+
// MCPs will be validated indirectly through agents
|
|
24559
|
+
return mcpMap;
|
|
24560
|
+
};
|
|
24561
|
+
/**
|
|
24562
|
+
* Retrieves all registered pipelines as a map by accessing internal _pipelineMap
|
|
24563
|
+
* @private
|
|
24564
|
+
* @returns Map of pipeline names
|
|
24565
|
+
*/
|
|
24566
|
+
const getPipelineMap = () => {
|
|
24567
|
+
const pipelineMap = {};
|
|
24568
|
+
// PipelineValidationService doesn't expose getList, so we return empty map
|
|
24569
|
+
// Pipelines will be validated when explicitly provided
|
|
24570
|
+
return pipelineMap;
|
|
24571
|
+
};
|
|
24572
|
+
/**
|
|
24573
|
+
* Retrieves all registered policies as a map by accessing internal _policyMap
|
|
24574
|
+
* @private
|
|
24575
|
+
* @returns Map of policy names
|
|
24576
|
+
*/
|
|
24577
|
+
const getPolicyMap = () => {
|
|
24578
|
+
const policyMap = {};
|
|
24579
|
+
// PolicyValidationService doesn't expose getList, so we return empty map
|
|
24580
|
+
// Policies will be validated indirectly through swarms
|
|
24581
|
+
return policyMap;
|
|
24582
|
+
};
|
|
24583
|
+
/**
|
|
24584
|
+
* Retrieves all registered states as a map by accessing internal _stateMap
|
|
24585
|
+
* @private
|
|
24586
|
+
* @returns Map of state names
|
|
24587
|
+
*/
|
|
24588
|
+
const getStateMap = () => {
|
|
24589
|
+
const stateMap = {};
|
|
24590
|
+
// StateValidationService doesn't expose getList, so we return empty map
|
|
24591
|
+
// States will be validated indirectly through agents and computes
|
|
24592
|
+
return stateMap;
|
|
24593
|
+
};
|
|
24594
|
+
/**
|
|
24595
|
+
* Retrieves all registered storages as a map by accessing internal _storageMap
|
|
24596
|
+
* @private
|
|
24597
|
+
* @returns Map of storage names
|
|
24598
|
+
*/
|
|
24599
|
+
const getStorageMap = () => {
|
|
24600
|
+
const storageMap = {};
|
|
24601
|
+
// StorageValidationService doesn't expose getList, so we return empty map
|
|
24602
|
+
// Storages will be validated indirectly through agents
|
|
24603
|
+
return storageMap;
|
|
24604
|
+
};
|
|
24605
|
+
/**
|
|
24606
|
+
* Retrieves all registered tools as a map by accessing internal _toolMap
|
|
24607
|
+
* @private
|
|
24608
|
+
* @returns Map of tool names
|
|
24609
|
+
*/
|
|
24610
|
+
const getToolMap = () => {
|
|
24611
|
+
const toolMap = {};
|
|
24612
|
+
// ToolValidationService doesn't expose getList, so we return empty map
|
|
24613
|
+
// Tools will be validated indirectly through agents
|
|
24614
|
+
return toolMap;
|
|
24615
|
+
};
|
|
24616
|
+
/**
|
|
24617
|
+
* Internal validation function that processes all provided entity enums.
|
|
24618
|
+
*
|
|
24619
|
+
* Iterates through each enum's values and validates them against their
|
|
24620
|
+
* respective validation services. Uses memoized validation for performance.
|
|
24621
|
+
*
|
|
24622
|
+
* If entity enums are not provided, fetches all registered entities from
|
|
24623
|
+
* their respective validation services and validates them.
|
|
24624
|
+
*
|
|
24625
|
+
* Note: Advisors, Completions, Embeddings, MCPs, Pipelines, Policies, States,
|
|
24626
|
+
* Storages, and Tools are validated indirectly through their parent entities
|
|
24627
|
+
* (e.g., agents validate their tools, storages, completions, MCP, states, etc.)
|
|
24461
24628
|
*
|
|
24462
24629
|
* @private
|
|
24463
|
-
|
|
24464
|
-
|
|
24465
|
-
|
|
24466
|
-
|
|
24467
|
-
const
|
|
24468
|
-
|
|
24469
|
-
const
|
|
24470
|
-
|
|
24471
|
-
|
|
24472
|
-
|
|
24473
|
-
|
|
24630
|
+
* @param args - Validation arguments containing entity name enums
|
|
24631
|
+
* @throws {Error} If any entity name is not found in its registry
|
|
24632
|
+
*/
|
|
24633
|
+
const validateInternal = (args) => {
|
|
24634
|
+
const { SwarmName = getSwarmMap(), AgentName = getAgentMap(), OutlineName = getOutlineMap(), ComputeName = getComputeMap(), SessionId = getSessionMap(), AdvisorName = getAdvisorMap(), CompletionName = getCompletionMap(), EmbeddingName = getEmbeddingMap(), MCPName = getMCPMap(), PipelineName = getPipelineMap(), PolicyName = getPolicyMap(), StateName = getStateMap(), StorageName = getStorageMap(), ToolName = getToolMap(), } = args;
|
|
24635
|
+
// Validate swarms (which also validates agents and policies)
|
|
24636
|
+
for (const swarmName of Object.values(SwarmName)) {
|
|
24637
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME);
|
|
24638
|
+
}
|
|
24639
|
+
// Validate agents explicitly (validates tools, storages, completions, MCP, states)
|
|
24640
|
+
for (const agentName of Object.values(AgentName)) {
|
|
24641
|
+
swarm$1.agentValidationService.validate(agentName, METHOD_NAME);
|
|
24642
|
+
}
|
|
24643
|
+
// Validate outlines (validates completions)
|
|
24644
|
+
for (const outlineName of Object.values(OutlineName)) {
|
|
24645
|
+
swarm$1.outlineValidationService.validate(outlineName, METHOD_NAME);
|
|
24646
|
+
}
|
|
24647
|
+
// Validate computes (validates state dependencies)
|
|
24648
|
+
for (const computeName of Object.values(ComputeName)) {
|
|
24649
|
+
swarm$1.computeValidationService.validate(computeName, METHOD_NAME);
|
|
24650
|
+
}
|
|
24651
|
+
// Validate sessions (validates swarm assignments)
|
|
24652
|
+
for (const sessionId of Object.values(SessionId)) {
|
|
24653
|
+
swarm$1.sessionValidationService.validate(sessionId, METHOD_NAME);
|
|
24654
|
+
}
|
|
24655
|
+
// Validate optional direct entities
|
|
24656
|
+
// Note: These are typically validated indirectly through their parent entities,
|
|
24657
|
+
// but can be validated directly when explicitly provided
|
|
24658
|
+
for (const advisorName of Object.values(AdvisorName)) {
|
|
24659
|
+
swarm$1.advisorValidationService.validate(advisorName, METHOD_NAME);
|
|
24660
|
+
}
|
|
24661
|
+
for (const completionName of Object.values(CompletionName)) {
|
|
24662
|
+
swarm$1.completionValidationService.validate(completionName, METHOD_NAME);
|
|
24663
|
+
}
|
|
24664
|
+
for (const embeddingName of Object.values(EmbeddingName)) {
|
|
24665
|
+
swarm$1.embeddingValidationService.validate(embeddingName, METHOD_NAME);
|
|
24666
|
+
}
|
|
24667
|
+
for (const mcpName of Object.values(MCPName)) {
|
|
24668
|
+
swarm$1.mcpValidationService.validate(mcpName, METHOD_NAME);
|
|
24669
|
+
}
|
|
24670
|
+
for (const pipelineName of Object.values(PipelineName)) {
|
|
24671
|
+
swarm$1.pipelineValidationService.validate(pipelineName, METHOD_NAME);
|
|
24672
|
+
}
|
|
24673
|
+
for (const policyName of Object.values(PolicyName)) {
|
|
24674
|
+
swarm$1.policyValidationService.validate(policyName, METHOD_NAME);
|
|
24675
|
+
}
|
|
24676
|
+
for (const stateName of Object.values(StateName)) {
|
|
24677
|
+
swarm$1.stateValidationService.validate(stateName, METHOD_NAME);
|
|
24678
|
+
}
|
|
24679
|
+
for (const storageName of Object.values(StorageName)) {
|
|
24680
|
+
swarm$1.storageValidationService.validate(storageName, METHOD_NAME);
|
|
24681
|
+
}
|
|
24682
|
+
for (const toolName of Object.values(ToolName)) {
|
|
24683
|
+
swarm$1.toolValidationService.validate(toolName, METHOD_NAME);
|
|
24684
|
+
}
|
|
24685
|
+
};
|
|
24474
24686
|
/**
|
|
24475
|
-
* Validates all
|
|
24476
|
-
* This function is idempotent and will only perform validation once per process.
|
|
24687
|
+
* Validates the existence of all provided entity names across validation services.
|
|
24477
24688
|
*
|
|
24478
|
-
|
|
24479
|
-
|
|
24480
|
-
|
|
24689
|
+
* This function accepts enum objects for various entity types (swarms, agents, outlines,
|
|
24690
|
+
* advisors, completions, computes, embeddings, MCPs, pipelines, policies, sessions,
|
|
24691
|
+
* states, storages, tools) and validates that each entity name exists in its respective
|
|
24692
|
+
* registry. Validation results are memoized for performance.
|
|
24693
|
+
*
|
|
24694
|
+
* If no arguments are provided (or specific entity types are omitted), the function
|
|
24695
|
+
* automatically fetches and validates ALL registered entities from their respective
|
|
24696
|
+
* validation services. This is useful for comprehensive validation of the entire setup.
|
|
24697
|
+
*
|
|
24698
|
+
* Use this before running operations to ensure all referenced entities are properly
|
|
24699
|
+
* registered and configured.
|
|
24700
|
+
*
|
|
24701
|
+
* @public
|
|
24702
|
+
* @param args - Partial validation arguments containing entity name enums to validate.
|
|
24703
|
+
* If empty or omitted, validates all registered entities.
|
|
24704
|
+
* @throws {Error} If any entity name is not found in its validation service
|
|
24705
|
+
*
|
|
24706
|
+
* @example
|
|
24707
|
+
* ```typescript
|
|
24708
|
+
* // Validate ALL registered entities (swarms, agents, outlines, etc.)
|
|
24709
|
+
* validate({});
|
|
24710
|
+
* ```
|
|
24711
|
+
*
|
|
24712
|
+
* @example
|
|
24713
|
+
* ```typescript
|
|
24714
|
+
* // Define your entity name enums
|
|
24715
|
+
* enum SwarmName {
|
|
24716
|
+
* MY_SWARM = "my-swarm"
|
|
24717
|
+
* }
|
|
24718
|
+
*
|
|
24719
|
+
* enum AgentName {
|
|
24720
|
+
* MY_AGENT = "my-agent"
|
|
24721
|
+
* }
|
|
24722
|
+
*
|
|
24723
|
+
* // Validate specific entities
|
|
24724
|
+
* validate({
|
|
24725
|
+
* SwarmName,
|
|
24726
|
+
* AgentName,
|
|
24727
|
+
* });
|
|
24728
|
+
* ```
|
|
24729
|
+
*
|
|
24730
|
+
* @example
|
|
24731
|
+
* ```typescript
|
|
24732
|
+
* // Validate specific entity types
|
|
24733
|
+
* validate({
|
|
24734
|
+
* CompletionName: { CLAUDE_SONNET: "claude-sonnet-4-5" },
|
|
24735
|
+
* EmbeddingName: { TEXT_EMBEDDING: "text-embedding-3-small" },
|
|
24736
|
+
* });
|
|
24737
|
+
* ```
|
|
24738
|
+
*/
|
|
24739
|
+
function validate(args = {}) {
|
|
24740
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
24741
|
+
swarm$1.loggerService.log(METHOD_NAME);
|
|
24742
|
+
return validateInternal(args);
|
|
24481
24743
|
}
|
|
24482
24744
|
|
|
24483
24745
|
/**
|
package/package.json
CHANGED
package/types.d.ts
CHANGED
|
@@ -11246,7 +11246,7 @@ declare function ask<T = string>(message: T, advisorName: AdvisorName): Promise<
|
|
|
11246
11246
|
* const result = await json<"MyOutline", { query: string }>("MyOutline", { query: "example" });
|
|
11247
11247
|
* console.log(result.isValid, result.data); // Logs validation status and data
|
|
11248
11248
|
*/
|
|
11249
|
-
declare function json<Data extends IOutlineData = IOutlineData, Param extends IOutlineParam = IOutlineParam>(outlineName: OutlineName, param?:
|
|
11249
|
+
declare function json<Data extends IOutlineData = IOutlineData, Param extends IOutlineParam = IOutlineParam>(outlineName: OutlineName, param?: Param): Promise<IOutlineResult<Data, Param>>;
|
|
11250
11250
|
|
|
11251
11251
|
/**
|
|
11252
11252
|
* Processes a chat completion request by sending messages to a specified completion service.
|
|
@@ -13764,11 +13764,147 @@ declare const Adapter: AdapterUtils;
|
|
|
13764
13764
|
declare const beginContext: <T extends (...args: any[]) => any>(run: T) => ((...args: Parameters<T>) => ReturnType<T>);
|
|
13765
13765
|
|
|
13766
13766
|
/**
|
|
13767
|
-
*
|
|
13768
|
-
|
|
13767
|
+
* Type alias for enum objects with string key-value pairs
|
|
13768
|
+
*/
|
|
13769
|
+
type Enum = Record<string, string>;
|
|
13770
|
+
/**
|
|
13771
|
+
* Type alias for ValidateArgs with any enum type
|
|
13772
|
+
*/
|
|
13773
|
+
type Args = ValidateArgs<any>;
|
|
13774
|
+
/**
|
|
13775
|
+
* Interface defining validation arguments for all entity types.
|
|
13769
13776
|
*
|
|
13770
|
-
|
|
13771
|
-
|
|
13777
|
+
* Each property accepts an enum object where values will be validated
|
|
13778
|
+
* against registered entities in their respective validation services.
|
|
13779
|
+
*
|
|
13780
|
+
* @template T - Enum type extending Record<string, string>
|
|
13781
|
+
*/
|
|
13782
|
+
interface ValidateArgs<T = Enum> {
|
|
13783
|
+
/**
|
|
13784
|
+
* Swarm name enum to validate
|
|
13785
|
+
* @example { MY_SWARM: "my-swarm" }
|
|
13786
|
+
*/
|
|
13787
|
+
SwarmName?: T;
|
|
13788
|
+
/**
|
|
13789
|
+
* Agent name enum to validate
|
|
13790
|
+
* @example { MY_AGENT: "my-agent" }
|
|
13791
|
+
*/
|
|
13792
|
+
AgentName?: T;
|
|
13793
|
+
/**
|
|
13794
|
+
* Outline name enum to validate
|
|
13795
|
+
* @example { MY_OUTLINE: "my-outline" }
|
|
13796
|
+
*/
|
|
13797
|
+
OutlineName?: T;
|
|
13798
|
+
/**
|
|
13799
|
+
* Advisor name enum to validate
|
|
13800
|
+
* @example { MY_ADVISOR: "my-advisor" }
|
|
13801
|
+
*/
|
|
13802
|
+
AdvisorName?: T;
|
|
13803
|
+
/**
|
|
13804
|
+
* Completion name enum to validate
|
|
13805
|
+
* @example { CLAUDE_SONNET: "claude-sonnet-4-5" }
|
|
13806
|
+
*/
|
|
13807
|
+
CompletionName?: T;
|
|
13808
|
+
/**
|
|
13809
|
+
* Compute name enum to validate
|
|
13810
|
+
* @example { MY_COMPUTE: "my-compute" }
|
|
13811
|
+
*/
|
|
13812
|
+
ComputeName?: T;
|
|
13813
|
+
/**
|
|
13814
|
+
* Embedding name enum to validate
|
|
13815
|
+
* @example { TEXT_EMBEDDING: "text-embedding-3-small" }
|
|
13816
|
+
*/
|
|
13817
|
+
EmbeddingName?: T;
|
|
13818
|
+
/**
|
|
13819
|
+
* MCP name enum to validate
|
|
13820
|
+
* @example { MY_MCP: "my-mcp" }
|
|
13821
|
+
*/
|
|
13822
|
+
MCPName?: T;
|
|
13823
|
+
/**
|
|
13824
|
+
* Pipeline name enum to validate
|
|
13825
|
+
* @example { MY_PIPELINE: "my-pipeline" }
|
|
13826
|
+
*/
|
|
13827
|
+
PipelineName?: T;
|
|
13828
|
+
/**
|
|
13829
|
+
* Policy name enum to validate
|
|
13830
|
+
* @example { MY_POLICY: "my-policy" }
|
|
13831
|
+
*/
|
|
13832
|
+
PolicyName?: T;
|
|
13833
|
+
/**
|
|
13834
|
+
* Session ID enum to validate
|
|
13835
|
+
* @example { SESSION_1: "session-1" }
|
|
13836
|
+
*/
|
|
13837
|
+
SessionId?: T;
|
|
13838
|
+
/**
|
|
13839
|
+
* State name enum to validate
|
|
13840
|
+
* @example { MY_STATE: "my-state" }
|
|
13841
|
+
*/
|
|
13842
|
+
StateName?: T;
|
|
13843
|
+
/**
|
|
13844
|
+
* Storage name enum to validate
|
|
13845
|
+
* @example { MY_STORAGE: "my-storage" }
|
|
13846
|
+
*/
|
|
13847
|
+
StorageName?: T;
|
|
13848
|
+
/**
|
|
13849
|
+
* Tool name enum to validate
|
|
13850
|
+
* @example { MY_TOOL: "my-tool" }
|
|
13851
|
+
*/
|
|
13852
|
+
ToolName?: T;
|
|
13853
|
+
}
|
|
13854
|
+
/**
|
|
13855
|
+
* Validates the existence of all provided entity names across validation services.
|
|
13856
|
+
*
|
|
13857
|
+
* This function accepts enum objects for various entity types (swarms, agents, outlines,
|
|
13858
|
+
* advisors, completions, computes, embeddings, MCPs, pipelines, policies, sessions,
|
|
13859
|
+
* states, storages, tools) and validates that each entity name exists in its respective
|
|
13860
|
+
* registry. Validation results are memoized for performance.
|
|
13861
|
+
*
|
|
13862
|
+
* If no arguments are provided (or specific entity types are omitted), the function
|
|
13863
|
+
* automatically fetches and validates ALL registered entities from their respective
|
|
13864
|
+
* validation services. This is useful for comprehensive validation of the entire setup.
|
|
13865
|
+
*
|
|
13866
|
+
* Use this before running operations to ensure all referenced entities are properly
|
|
13867
|
+
* registered and configured.
|
|
13868
|
+
*
|
|
13869
|
+
* @public
|
|
13870
|
+
* @param args - Partial validation arguments containing entity name enums to validate.
|
|
13871
|
+
* If empty or omitted, validates all registered entities.
|
|
13872
|
+
* @throws {Error} If any entity name is not found in its validation service
|
|
13873
|
+
*
|
|
13874
|
+
* @example
|
|
13875
|
+
* ```typescript
|
|
13876
|
+
* // Validate ALL registered entities (swarms, agents, outlines, etc.)
|
|
13877
|
+
* validate({});
|
|
13878
|
+
* ```
|
|
13879
|
+
*
|
|
13880
|
+
* @example
|
|
13881
|
+
* ```typescript
|
|
13882
|
+
* // Define your entity name enums
|
|
13883
|
+
* enum SwarmName {
|
|
13884
|
+
* MY_SWARM = "my-swarm"
|
|
13885
|
+
* }
|
|
13886
|
+
*
|
|
13887
|
+
* enum AgentName {
|
|
13888
|
+
* MY_AGENT = "my-agent"
|
|
13889
|
+
* }
|
|
13890
|
+
*
|
|
13891
|
+
* // Validate specific entities
|
|
13892
|
+
* validate({
|
|
13893
|
+
* SwarmName,
|
|
13894
|
+
* AgentName,
|
|
13895
|
+
* });
|
|
13896
|
+
* ```
|
|
13897
|
+
*
|
|
13898
|
+
* @example
|
|
13899
|
+
* ```typescript
|
|
13900
|
+
* // Validate specific entity types
|
|
13901
|
+
* validate({
|
|
13902
|
+
* CompletionName: { CLAUDE_SONNET: "claude-sonnet-4-5" },
|
|
13903
|
+
* EmbeddingName: { TEXT_EMBEDDING: "text-embedding-3-small" },
|
|
13904
|
+
* });
|
|
13905
|
+
* ```
|
|
13906
|
+
*/
|
|
13907
|
+
declare function validate(args?: Partial<Args>): void;
|
|
13772
13908
|
|
|
13773
13909
|
/**
|
|
13774
13910
|
* Converts a given schema object into a JSON schema format object.
|