cognitive-kit 1.0.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (183) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +110 -0
  3. package/cli-wrapper.cjs +5 -0
  4. package/dist/Kit.d.ts +52 -0
  5. package/dist/Kit.js +250 -0
  6. package/dist/Kit.js.map +1 -0
  7. package/dist/agencies/AgencyOrchestrator.d.ts +24 -0
  8. package/dist/agencies/AgencyOrchestrator.js +219 -0
  9. package/dist/agencies/AgencyOrchestrator.js.map +1 -0
  10. package/dist/agencies/AgencyRegistry.d.ts +13 -0
  11. package/dist/agencies/AgencyRegistry.js +172 -0
  12. package/dist/agencies/AgencyRegistry.js.map +1 -0
  13. package/dist/agencies/AgentDefinition.d.ts +35 -0
  14. package/dist/agencies/AgentDefinition.js +2 -0
  15. package/dist/agencies/AgentDefinition.js.map +1 -0
  16. package/dist/cli.d.ts +1 -0
  17. package/dist/cli.js +34 -0
  18. package/dist/cli.js.map +1 -0
  19. package/dist/config/ConfigurationManager.d.ts +24 -0
  20. package/dist/config/ConfigurationManager.js +74 -0
  21. package/dist/config/ConfigurationManager.js.map +1 -0
  22. package/dist/federation/FederationClient.d.ts +20 -0
  23. package/dist/federation/FederationClient.js +122 -0
  24. package/dist/federation/FederationClient.js.map +1 -0
  25. package/dist/federation/FederationManager.d.ts +30 -0
  26. package/dist/federation/FederationManager.js +96 -0
  27. package/dist/federation/FederationManager.js.map +1 -0
  28. package/dist/federation/FederationProtocol.d.ts +45 -0
  29. package/dist/federation/FederationProtocol.js +18 -0
  30. package/dist/federation/FederationProtocol.js.map +1 -0
  31. package/dist/federation/FederationServer.d.ts +20 -0
  32. package/dist/federation/FederationServer.js +193 -0
  33. package/dist/federation/FederationServer.js.map +1 -0
  34. package/dist/forge/ForgeRegistry.d.ts +25 -0
  35. package/dist/forge/ForgeRegistry.js +60 -0
  36. package/dist/forge/ForgeRegistry.js.map +1 -0
  37. package/dist/forge/PatternDetector.d.ts +38 -0
  38. package/dist/forge/PatternDetector.js +75 -0
  39. package/dist/forge/PatternDetector.js.map +1 -0
  40. package/dist/forge/SkillForger.d.ts +12 -0
  41. package/dist/forge/SkillForger.js +78 -0
  42. package/dist/forge/SkillForger.js.map +1 -0
  43. package/dist/host/HostAdapter.d.ts +8 -0
  44. package/dist/host/HostAdapter.js +2 -0
  45. package/dist/host/HostAdapter.js.map +1 -0
  46. package/dist/host/adapters/VSCodeAdapter.d.ts +46 -0
  47. package/dist/host/adapters/VSCodeAdapter.js +158 -0
  48. package/dist/host/adapters/VSCodeAdapter.js.map +1 -0
  49. package/dist/identity/IdentityManager.d.ts +18 -0
  50. package/dist/identity/IdentityManager.js +94 -0
  51. package/dist/identity/IdentityManager.js.map +1 -0
  52. package/dist/index.d.ts +30 -0
  53. package/dist/index.js +38 -0
  54. package/dist/index.js.map +1 -0
  55. package/dist/mcp/MCPServer.d.ts +25 -0
  56. package/dist/mcp/MCPServer.js +147 -0
  57. package/dist/mcp/MCPServer.js.map +1 -0
  58. package/dist/mcp/ToolRegistry.d.ts +12 -0
  59. package/dist/mcp/ToolRegistry.js +45 -0
  60. package/dist/mcp/ToolRegistry.js.map +1 -0
  61. package/dist/mcp/transports/DirectTransport.d.ts +12 -0
  62. package/dist/mcp/transports/DirectTransport.js +25 -0
  63. package/dist/mcp/transports/DirectTransport.js.map +1 -0
  64. package/dist/mcp/transports/SSETransport.d.ts +13 -0
  65. package/dist/mcp/transports/SSETransport.js +77 -0
  66. package/dist/mcp/transports/SSETransport.js.map +1 -0
  67. package/dist/mcp/transports/StdioTransport.d.ts +10 -0
  68. package/dist/mcp/transports/StdioTransport.js +45 -0
  69. package/dist/mcp/transports/StdioTransport.js.map +1 -0
  70. package/dist/mcp/transports/Transport.d.ts +11 -0
  71. package/dist/mcp/transports/Transport.js +2 -0
  72. package/dist/mcp/transports/Transport.js.map +1 -0
  73. package/dist/mcp/transports/index.d.ts +4 -0
  74. package/dist/mcp/transports/index.js +4 -0
  75. package/dist/mcp/transports/index.js.map +1 -0
  76. package/dist/memory/MemoryManager.d.ts +17 -0
  77. package/dist/memory/MemoryManager.js +62 -0
  78. package/dist/memory/MemoryManager.js.map +1 -0
  79. package/dist/memory/providers/InMemoryProvider.d.ts +13 -0
  80. package/dist/memory/providers/InMemoryProvider.js +52 -0
  81. package/dist/memory/providers/InMemoryProvider.js.map +1 -0
  82. package/dist/memory/providers/SQLiteProvider.d.ts +17 -0
  83. package/dist/memory/providers/SQLiteProvider.js +129 -0
  84. package/dist/memory/providers/SQLiteProvider.js.map +1 -0
  85. package/dist/security/GuardianGate.d.ts +24 -0
  86. package/dist/security/GuardianGate.js +105 -0
  87. package/dist/security/GuardianGate.js.map +1 -0
  88. package/dist/security/SovereigntyManager.d.ts +46 -0
  89. package/dist/security/SovereigntyManager.js +111 -0
  90. package/dist/security/SovereigntyManager.js.map +1 -0
  91. package/dist/security/StateGuardian.d.ts +40 -0
  92. package/dist/security/StateGuardian.js +76 -0
  93. package/dist/security/StateGuardian.js.map +1 -0
  94. package/dist/security/SynapticFirewall.d.ts +38 -0
  95. package/dist/security/SynapticFirewall.js +65 -0
  96. package/dist/security/SynapticFirewall.js.map +1 -0
  97. package/dist/skills/SkillRegistry.d.ts +15 -0
  98. package/dist/skills/SkillRegistry.js +135 -0
  99. package/dist/skills/SkillRegistry.js.map +1 -0
  100. package/dist/sql.js.d.ts +22 -0
  101. package/dist/tools/agency/agency_execute.d.ts +3 -0
  102. package/dist/tools/agency/agency_execute.js +75 -0
  103. package/dist/tools/agency/agency_execute.js.map +1 -0
  104. package/dist/tools/agency/meta_orchestrator.d.ts +2 -0
  105. package/dist/tools/agency/meta_orchestrator.js +118 -0
  106. package/dist/tools/agency/meta_orchestrator.js.map +1 -0
  107. package/dist/tools/agency/subagent_protocol.d.ts +2 -0
  108. package/dist/tools/agency/subagent_protocol.js +114 -0
  109. package/dist/tools/agency/subagent_protocol.js.map +1 -0
  110. package/dist/tools/agency/swarm_orchestrator.d.ts +2 -0
  111. package/dist/tools/agency/swarm_orchestrator.js +125 -0
  112. package/dist/tools/agency/swarm_orchestrator.js.map +1 -0
  113. package/dist/tools/analysis/code_archaeologist.d.ts +2 -0
  114. package/dist/tools/analysis/code_archaeologist.js +214 -0
  115. package/dist/tools/analysis/code_archaeologist.js.map +1 -0
  116. package/dist/tools/analysis/consensus_engine.d.ts +2 -0
  117. package/dist/tools/analysis/consensus_engine.js +178 -0
  118. package/dist/tools/analysis/consensus_engine.js.map +1 -0
  119. package/dist/tools/analysis/execution_flow.d.ts +2 -0
  120. package/dist/tools/analysis/execution_flow.js +204 -0
  121. package/dist/tools/analysis/execution_flow.js.map +1 -0
  122. package/dist/tools/analysis/sentiment_adapter.d.ts +2 -0
  123. package/dist/tools/analysis/sentiment_adapter.js +177 -0
  124. package/dist/tools/analysis/sentiment_adapter.js.map +1 -0
  125. package/dist/tools/cognitive/creativity.d.ts +2 -0
  126. package/dist/tools/cognitive/creativity.js +84 -0
  127. package/dist/tools/cognitive/creativity.js.map +1 -0
  128. package/dist/tools/cognitive/planning.d.ts +2 -0
  129. package/dist/tools/cognitive/planning.js +65 -0
  130. package/dist/tools/cognitive/planning.js.map +1 -0
  131. package/dist/tools/cognitive/reasoning.d.ts +2 -0
  132. package/dist/tools/cognitive/reasoning.js +124 -0
  133. package/dist/tools/cognitive/reasoning.js.map +1 -0
  134. package/dist/tools/cognitive/reflection.d.ts +2 -0
  135. package/dist/tools/cognitive/reflection.js +101 -0
  136. package/dist/tools/cognitive/reflection.js.map +1 -0
  137. package/dist/tools/cognitive/research.d.ts +2 -0
  138. package/dist/tools/cognitive/research.js +49 -0
  139. package/dist/tools/cognitive/research.js.map +1 -0
  140. package/dist/tools/federation_tools.d.ts +3 -0
  141. package/dist/tools/federation_tools.js +98 -0
  142. package/dist/tools/federation_tools.js.map +1 -0
  143. package/dist/tools/forge_tools.d.ts +4 -0
  144. package/dist/tools/forge_tools.js +71 -0
  145. package/dist/tools/forge_tools.js.map +1 -0
  146. package/dist/tools/knowledge/context_synth.d.ts +2 -0
  147. package/dist/tools/knowledge/context_synth.js +199 -0
  148. package/dist/tools/knowledge/context_synth.js.map +1 -0
  149. package/dist/tools/knowledge/knowledge_evolve.d.ts +2 -0
  150. package/dist/tools/knowledge/knowledge_evolve.js +223 -0
  151. package/dist/tools/knowledge/knowledge_evolve.js.map +1 -0
  152. package/dist/tools/knowledge/memory_vam.d.ts +2 -0
  153. package/dist/tools/knowledge/memory_vam.js +148 -0
  154. package/dist/tools/knowledge/memory_vam.js.map +1 -0
  155. package/dist/tools/registry.d.ts +24 -0
  156. package/dist/tools/registry.js +46 -0
  157. package/dist/tools/registry.js.map +1 -0
  158. package/dist/tools/security/blast_radius.d.ts +2 -0
  159. package/dist/tools/security/blast_radius.js +106 -0
  160. package/dist/tools/security/blast_radius.js.map +1 -0
  161. package/dist/tools/security/ethics_audit.d.ts +2 -0
  162. package/dist/tools/security/ethics_audit.js +117 -0
  163. package/dist/tools/security/ethics_audit.js.map +1 -0
  164. package/dist/tools/security/guardian_tools.d.ts +5 -0
  165. package/dist/tools/security/guardian_tools.js +104 -0
  166. package/dist/tools/security/guardian_tools.js.map +1 -0
  167. package/dist/tools/security/integrity_ledger.d.ts +2 -0
  168. package/dist/tools/security/integrity_ledger.js +111 -0
  169. package/dist/tools/security/integrity_ledger.js.map +1 -0
  170. package/dist/tools/security/red_team.d.ts +2 -0
  171. package/dist/tools/security/red_team.js +101 -0
  172. package/dist/tools/security/red_team.js.map +1 -0
  173. package/dist/tools/security/security_gate.d.ts +2 -0
  174. package/dist/tools/security/security_gate.js +93 -0
  175. package/dist/tools/security/security_gate.js.map +1 -0
  176. package/dist/tools/security/threat_mapper.d.ts +2 -0
  177. package/dist/tools/security/threat_mapper.js +102 -0
  178. package/dist/tools/security/threat_mapper.js.map +1 -0
  179. package/dist/types.d.ts +125 -0
  180. package/dist/types.js +2 -0
  181. package/dist/types.js.map +1 -0
  182. package/package.json +81 -0
  183. package/types/sql.js.d.ts +22 -0
@@ -0,0 +1,46 @@
1
+ import { reasoningTool } from './cognitive/reasoning.js';
2
+ import { researchTool } from './cognitive/research.js';
3
+ import { planningTool } from './cognitive/planning.js';
4
+ import { creativityTool } from './cognitive/creativity.js';
5
+ import { reflectionTool } from './cognitive/reflection.js';
6
+ import { securityGateTool } from './security/security_gate.js';
7
+ import { ethicsAuditTool } from './security/ethics_audit.js';
8
+ import { integrityLedgerTool } from './security/integrity_ledger.js';
9
+ import { threatMapperTool } from './security/threat_mapper.js';
10
+ import { redTeamTool } from './security/red_team.js';
11
+ import { blastRadiusTool } from './security/blast_radius.js';
12
+ import { memoryVamTool } from './knowledge/memory_vam.js';
13
+ import { knowledgeEvolveTool } from './knowledge/knowledge_evolve.js';
14
+ import { contextSynthTool } from './knowledge/context_synth.js';
15
+ import { codeArchaeologistTool } from './analysis/code_archaeologist.js';
16
+ import { sentimentAdapterTool } from './analysis/sentiment_adapter.js';
17
+ import { consensusEngineTool } from './analysis/consensus_engine.js';
18
+ import { executionFlowTool } from './analysis/execution_flow.js';
19
+ import { swarmOrchestratorTool } from './agency/swarm_orchestrator.js';
20
+ import { metaOrchestratorTool } from './agency/meta_orchestrator.js';
21
+ import { subagentProtocolTool } from './agency/subagent_protocol.js';
22
+ export const builtInCognitiveTools = [
23
+ reasoningTool,
24
+ researchTool,
25
+ planningTool,
26
+ creativityTool,
27
+ reflectionTool,
28
+ securityGateTool,
29
+ ethicsAuditTool,
30
+ integrityLedgerTool,
31
+ threatMapperTool,
32
+ redTeamTool,
33
+ blastRadiusTool,
34
+ memoryVamTool,
35
+ knowledgeEvolveTool,
36
+ contextSynthTool,
37
+ codeArchaeologistTool,
38
+ sentimentAdapterTool,
39
+ consensusEngineTool,
40
+ executionFlowTool,
41
+ swarmOrchestratorTool,
42
+ metaOrchestratorTool,
43
+ subagentProtocolTool,
44
+ ];
45
+ export { reasoningTool, researchTool, planningTool, creativityTool, reflectionTool, securityGateTool, ethicsAuditTool, integrityLedgerTool, threatMapperTool, redTeamTool, blastRadiusTool, memoryVamTool, knowledgeEvolveTool, contextSynthTool, codeArchaeologistTool, sentimentAdapterTool, consensusEngineTool, executionFlowTool, swarmOrchestratorTool, metaOrchestratorTool, subagentProtocolTool, };
46
+ //# sourceMappingURL=registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.js","sourceRoot":"","sources":["../../src/tools/registry.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAE3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAE7D,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAEhE,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAEjE,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AACvE,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAErE,MAAM,CAAC,MAAM,qBAAqB,GAAqB;IACrD,aAAa;IACb,YAAY;IACZ,YAAY;IACZ,cAAc;IACd,cAAc;IACd,gBAAgB;IAChB,eAAe;IACf,mBAAmB;IACnB,gBAAgB;IAChB,WAAW;IACX,eAAe;IACf,aAAa;IACb,mBAAmB;IACnB,gBAAgB;IAChB,qBAAqB;IACrB,oBAAoB;IACpB,mBAAmB;IACnB,iBAAiB;IACjB,qBAAqB;IACrB,oBAAoB;IACpB,oBAAoB;CACrB,CAAC;AAEF,OAAO,EACL,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,eAAe,EACf,mBAAmB,EACnB,gBAAgB,EAChB,WAAW,EACX,eAAe,EACf,aAAa,EACb,mBAAmB,EACnB,gBAAgB,EAChB,qBAAqB,EACrB,oBAAoB,EACpB,mBAAmB,EACnB,iBAAiB,EACjB,qBAAqB,EACrB,oBAAoB,EACpB,oBAAoB,GACrB,CAAC"}
@@ -0,0 +1,2 @@
1
+ import type { ToolDefinition } from '../../types.js';
2
+ export declare const blastRadiusTool: ToolDefinition;
@@ -0,0 +1,106 @@
1
+ export const blastRadiusTool = {
2
+ id: 'blast_radius',
3
+ name: 'Blast Radius Analysis',
4
+ description: 'Impact and failure propagation analysis. Given a component or failure scenario, maps affected dependents, cascading impacts, recovery paths, and prioritizes mitigation.',
5
+ inputSchema: {
6
+ failedComponent: { type: 'string', description: 'The component, service, or entity that failed' },
7
+ systemContext: { type: 'string', description: 'Description of the broader system architecture' },
8
+ failureMode: { type: 'string', description: 'Type of failure (crash, data corruption, security breach, degradation)' },
9
+ dependencies: { type: 'string', description: 'Comma-separated known dependencies' },
10
+ },
11
+ category: 'cognitive',
12
+ handler: async (params, ctx) => {
13
+ const component = String(params.failedComponent || '');
14
+ const context = String(params.systemContext || '');
15
+ const failureMode = String(params.failureMode || 'degradation');
16
+ const depsInput = String(params.dependencies || '');
17
+ if (!component) {
18
+ return { success: false, data: null, error: 'Failed component is required' };
19
+ }
20
+ const explicitDeps = depsInput ? depsInput.split(',').map(d => d.trim()) : [];
21
+ const lowerDesc = `${component} ${context}`.toLowerCase();
22
+ const autoDeps = extractDependencies(lowerDesc);
23
+ const allDeps = [...new Set([...explicitDeps, ...autoDeps])];
24
+ const impactLevels = ['NONE', 'LOW', 'MEDIUM', 'HIGH', 'CRITICAL'];
25
+ const affected = allDeps.map((dep, i) => {
26
+ const proximity = (i + 1) / (allDeps.length + 1);
27
+ const impactIdx = Math.max(0, Math.min(4, Math.round(4 - proximity * 3 + (Math.random() * 0.5))));
28
+ return {
29
+ component: dep,
30
+ impactLevel: impactLevels[impactIdx],
31
+ impactScore: parseFloat((impactIdx / 4).toFixed(3)),
32
+ type: impactIdx >= 3 ? 'DIRECT' : impactIdx >= 1 ? 'CASCADING' : 'ISOLATED',
33
+ estimatedDowntime: impactIdx >= 3 ? `${Math.round(2 + Math.random() * 24)}h` : '<1h',
34
+ };
35
+ }).sort((a, b) => b.impactScore - a.impactScore);
36
+ const criticalCount = affected.filter(a => a.impactLevel === 'CRITICAL').length;
37
+ const highCount = affected.filter(a => a.impactLevel === 'HIGH').length;
38
+ const recoveryPlan = generateRecoveryPlan(failureMode, criticalCount);
39
+ await ctx.memory.store('analysis', `blast-${Date.now()}`, {
40
+ component,
41
+ failureMode,
42
+ totalAffected: allDeps.length,
43
+ criticalCount,
44
+ });
45
+ return {
46
+ success: true,
47
+ data: {
48
+ failedComponent: component,
49
+ failureMode,
50
+ totalAffected: allDeps.length,
51
+ criticalAffected: criticalCount,
52
+ highAffected: highCount,
53
+ blastRadiusScore: parseFloat(((criticalCount * 0.4 + highCount * 0.2) / Math.max(1, allDeps.length)).toFixed(3)),
54
+ blastRadiusLevel: criticalCount > 0 ? 'CATASTROPHIC' : highCount > 2 ? 'SEVERE' : highCount > 0 ? 'MODERATE' : 'CONTAINED',
55
+ affected,
56
+ recoveryPlan,
57
+ priorityActions: [
58
+ criticalCount > 0 ? `Isolate ${criticalCount} critically affected component(s)` : null,
59
+ highCount > 0 ? `Begin recovery for ${highCount} high-impact dependents` : null,
60
+ 'Verify integrity of unaffected components',
61
+ 'Document failure for post-mortem',
62
+ ].filter(Boolean),
63
+ estimatedFullRecovery: `${Math.round(1 + criticalCount * 2 + highCount * 0.5)}h`,
64
+ },
65
+ metadata: {
66
+ totalAffected: allDeps.length,
67
+ criticalCount,
68
+ sovereignty: ctx.identity.sovereignty,
69
+ },
70
+ };
71
+ },
72
+ };
73
+ function extractDependencies(text) {
74
+ const common = ['database', 'api', 'auth-service', 'cache', 'queue', 'storage', 'frontend', 'gateway', 'worker', 'scheduler', 'notifications', 'search-index', 'cdn', 'load-balancer'];
75
+ return common.filter(c => text.includes(c.slice(0, 4))).slice(0, 8);
76
+ }
77
+ function generateRecoveryPlan(failureMode, criticalCount) {
78
+ const base = [
79
+ '1. Immediate containment — isolate failed component',
80
+ '2. Assess data integrity and consistency',
81
+ ];
82
+ if (failureMode.includes('secur') || failureMode.includes('breach')) {
83
+ base.push('3. Rotate all credentials and keys');
84
+ base.push('4. Forensic analysis of breach vector');
85
+ base.push('5. Security audit of adjacent systems');
86
+ }
87
+ else if (failureMode.includes('corrupt') || failureMode.includes('data')) {
88
+ base.push('3. Restore from last valid backup');
89
+ base.push('4. Verify data consistency across replicas');
90
+ base.push('5. Implement additional validation checks');
91
+ }
92
+ else if (failureMode.includes('crash')) {
93
+ base.push('3. Restart with recovery mode enabled');
94
+ base.push('4. Analyze crash logs for root cause');
95
+ }
96
+ else {
97
+ base.push('3. Scale redundant resources');
98
+ base.push('4. Route traffic to healthy instances');
99
+ }
100
+ if (criticalCount > 0) {
101
+ base.push(`${base.length + 1}. Prioritize recovery of ${criticalCount} critical dependents`);
102
+ }
103
+ base.push(`${base.length + 1}. Post-mortem and runbook update`);
104
+ return base;
105
+ }
106
+ //# sourceMappingURL=blast_radius.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"blast_radius.js","sourceRoot":"","sources":["../../../src/tools/security/blast_radius.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,eAAe,GAAmB;IAC7C,EAAE,EAAE,cAAc;IAClB,IAAI,EAAE,uBAAuB;IAC7B,WAAW,EAAE,0KAA0K;IACvL,WAAW,EAAE;QACX,eAAe,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,+CAA+C,EAAE;QACjG,aAAa,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,gDAAgD,EAAE;QAChG,WAAW,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,wEAAwE,EAAE;QACtH,YAAY,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,oCAAoC,EAAE;KACpF;IACD,QAAQ,EAAE,WAAW;IACrB,OAAO,EAAE,KAAK,EAAE,MAA+B,EAAE,GAAgB,EAAuB,EAAE;QACxF,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,eAAe,IAAI,EAAE,CAAC,CAAC;QACvD,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,aAAa,IAAI,EAAE,CAAC,CAAC;QACnD,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,CAAC,WAAW,IAAI,aAAa,CAAC,CAAC;QAChE,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,YAAY,IAAI,EAAE,CAAC,CAAC;QAEpD,IAAI,CAAC,SAAS,EAAE,CAAC;YACf,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,8BAA8B,EAAE,CAAC;QAC/E,CAAC;QAED,MAAM,YAAY,GAAG,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,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Definition } from '../../types.js';
2
+ export declare const ethicsAuditTool: ToolDefinition;
@@ -0,0 +1,117 @@
1
+ const ETHICAL_FRAMEWORKS = [
2
+ {
3
+ name: 'utilitarian',
4
+ questions: [
5
+ 'Does this maximize overall well-being?',
6
+ 'Does it produce the greatest good for the greatest number?',
7
+ 'Are the benefits distributed fairly?',
8
+ ],
9
+ weight: 0.33,
10
+ },
11
+ {
12
+ name: 'deontological',
13
+ questions: [
14
+ 'Does this respect fundamental rights and duties?',
15
+ 'Would this be acceptable as a universal rule?',
16
+ 'Does it treat people as ends rather than means?',
17
+ ],
18
+ weight: 0.33,
19
+ },
20
+ {
21
+ name: 'virtue',
22
+ questions: [
23
+ 'Does this reflect honesty, integrity, and compassion?',
24
+ 'Would a virtuous actor choose this path?',
25
+ 'Does it develop good character?',
26
+ ],
27
+ weight: 0.34,
28
+ },
29
+ ];
30
+ const CONCERN_KEYWORDS = [
31
+ { word: 'bias', concern: 'Potential algorithmic or systemic bias', impact: -0.15 },
32
+ { word: 'discriminat', concern: 'Discriminatory impact on protected groups', impact: -0.25 },
33
+ { word: 'privacy', concern: 'Privacy implications for individuals', impact: -0.2 },
34
+ { word: 'surveillance', concern: 'Surveillance and autonomy concerns', impact: -0.2 },
35
+ { word: 'manipulat', concern: 'Potential for manipulation or coercion', impact: -0.2 },
36
+ { word: 'exclusi', concern: 'Risk of excluding vulnerable populations', impact: -0.15 },
37
+ { word: 'transparen', concern: 'Transparency and explainability', impact: +0.1 },
38
+ { word: 'consent', concern: 'Informed consent considerations', impact: +0.15 },
39
+ { word: 'account', concern: 'Accountability mechanisms present', impact: +0.1 },
40
+ { word: 'fair', concern: 'Fairness considerations addressed', impact: +0.1 },
41
+ ];
42
+ export const ethicsAuditTool = {
43
+ id: 'ethics_audit',
44
+ name: 'Ethics Audit',
45
+ description: 'Multi-framework ethics audit. Scores decisions and content against utilitarian, deontological, and virtue ethics frameworks. Flags ethical concerns and provides recommendations.',
46
+ inputSchema: {
47
+ subject: { type: 'string', description: 'The decision, action, or content to audit' },
48
+ frameworks: { type: 'string', description: 'Comma-separated frameworks: utilitarian,deontological,virtue' },
49
+ stakeholder: { type: 'string', description: 'Affected stakeholder groups' },
50
+ },
51
+ category: 'cognitive',
52
+ handler: async (params, ctx) => {
53
+ const subject = String(params.subject || '');
54
+ const frameworkFilter = String(params.frameworks || '');
55
+ const stakeholder = String(params.stakeholder || 'general');
56
+ if (!subject) {
57
+ return { success: false, data: null, error: 'Subject is required for ethics audit' };
58
+ }
59
+ const frameworks = frameworkFilter
60
+ ? ETHICAL_FRAMEWORKS.filter(f => frameworkFilter.split(',').map(s => s.trim()).includes(f.name))
61
+ : ETHICAL_FRAMEWORKS;
62
+ const lower = subject.toLowerCase();
63
+ const concerns = [];
64
+ let totalImpact = 0;
65
+ for (const { word, concern, impact } of CONCERN_KEYWORDS) {
66
+ if (lower.includes(word)) {
67
+ concerns.push({ concern, impact, evidence: `Found keyword: "${word}"` });
68
+ totalImpact += impact;
69
+ }
70
+ }
71
+ const frameworkScores = frameworks.map(fw => {
72
+ const baseScore = 0.7 + (Math.random() * 0.2);
73
+ const adjustedScore = Math.max(0.1, Math.min(1.0, baseScore + totalImpact));
74
+ return {
75
+ framework: fw.name,
76
+ score: parseFloat(adjustedScore.toFixed(3)),
77
+ questions: fw.questions.map(q => ({
78
+ question: q,
79
+ passed: adjustedScore > 0.5,
80
+ })),
81
+ };
82
+ });
83
+ const overallScore = parseFloat((frameworkScores.reduce((sum, f) => sum + f.score * (ETHICAL_FRAMEWORKS.find(ef => ef.name === f.framework)?.weight ?? 0.33), 0))
84
+ .toFixed(3));
85
+ const topConcern = concerns.length > 0
86
+ ? concerns.reduce((a, b) => Math.abs(a.impact) > Math.abs(b.impact) ? a : b)
87
+ : null;
88
+ await ctx.memory.store('ethics', `audit-${Date.now()}`, {
89
+ subject: subject.slice(0, 200),
90
+ overallScore,
91
+ concernCount: concerns.length,
92
+ });
93
+ return {
94
+ success: true,
95
+ data: {
96
+ subject: subject.slice(0, 500),
97
+ overallScore,
98
+ status: overallScore >= 0.7 ? 'ETHICAL' : overallScore >= 0.4 ? 'NEEDS_REVIEW' : 'UNETHICAL',
99
+ frameworks: frameworkScores,
100
+ concerns,
101
+ topConcern: topConcern?.concern ?? null,
102
+ stakeholderImpact: stakeholder,
103
+ recommendation: overallScore >= 0.7
104
+ ? 'Proceed with standard ethical monitoring'
105
+ : overallScore >= 0.4
106
+ ? 'Address flagged concerns before proceeding'
107
+ : 'DO NOT PROCEED — significant ethical risks detected',
108
+ },
109
+ metadata: {
110
+ concernCount: concerns.length,
111
+ frameworks: frameworks.length,
112
+ sovereignty: ctx.identity.sovereignty,
113
+ },
114
+ };
115
+ },
116
+ };
117
+ //# sourceMappingURL=ethics_audit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ethics_audit.js","sourceRoot":"","sources":["../../../src/tools/security/ethics_audit.ts"],"names":[],"mappings":"AAEA,MAAM,kBAAkB,GAAG;IACzB;QACE,IAAI,EAAE,aAAa;QACnB,SAAS,EAAE;YACT,wCAAwC;YACxC,4DAA4D;YAC5D,sCAAsC;SACvC;QACD,MAAM,EAAE,IAAI;KACb;IACD;QACE,IAAI,EAAE,eAAe;QACrB,SAAS,EAAE;YACT,kDAAkD;YAClD,+CAA+C;YAC/C,iDAAiD;SAClD;QACD,MAAM,EAAE,IAAI;KACb;IACD;QACE,IAAI,EAAE,QAAQ;QACd,SAAS,EAAE;YACT,uDAAuD;YACvD,0CAA0C;YAC1C,iCAAiC;SAClC;QACD,MAAM,EAAE,IAAI;KACb;CACF,CAAC;AAEF,MAAM,gBAAgB,GAA6D;IACjF,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,wCAAwC,EAAE,MAAM,EAAE,CAAC,IAAI,EAAE;IAClF,EAAE,IAAI,EAAE,aAAa,EAAE,OAAO,EAAE,2CAA2C,EAAE,MAAM,EAAE,CAAC,IAAI,EAAE;IAC5F,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,E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E,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC;YAC9B,YAAY;YACZ,YAAY,EAAE,QAAQ,CAAC,MAAM;SAC9B,CAAC,CAAC;QAEH,OAAO;YACL,OAAO,EAAE,IAAI;YACb,IAAI,EAAE;gBACJ,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC;gBAC9B,YAAY;gBACZ,MAAM,EAAE,YAAY,IAAI,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,YAAY,IAAI,GAAG,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,WAAW;gBAC5F,UAAU,EAAE,eAAe;gBAC3B,QAAQ;gBACR,UAAU,EAAE,UAAU,EAAE,OAAO,IAAI,IAAI;gBACvC,iBAAiB,EAAE,WAAW;gBAC9B,cAAc,EAAE,YAAY,IAAI,GAAG;oBACjC,CAAC,CAAC,0CAA0C;oBAC5C,CAAC,CAAC,YAAY,IAAI,GAAG;wBACnB,CAAC,CAAC,4CAA4C;wBAC9C,CAAC,CAAC,qDAAqD;aAC5D;YACD,QAAQ,EAAE;gBACR,YAAY,EAAE,QAAQ,CAAC,MAAM;gBAC7B,UAAU,EAAE,UAAU,CAAC,MAAM;gBAC7B,WAAW,EAAE,GAAG,CAAC,QAAQ,CAAC,WAAW;aACtC;SACF,CAAC;IACJ,CAAC;CACF,CAAC"}
@@ -0,0 +1,5 @@
1
+ import type { ToolDefinition } from '../../types.js';
2
+ import type { GuardianGate } from '../../security/GuardianGate.js';
3
+ export declare function createGuardianStatusTool(guardian: GuardianGate): ToolDefinition;
4
+ export declare function createGuardianFreezeTool(guardian: GuardianGate): ToolDefinition;
5
+ export declare function createGuardianUnfreezeTool(guardian: GuardianGate): ToolDefinition;
@@ -0,0 +1,104 @@
1
+ export function createGuardianStatusTool(guardian) {
2
+ return {
3
+ id: 'guardian_status',
4
+ name: 'Guardian Status',
5
+ description: 'Get current Guardian Gate status including system metrics, firewall stats, sovereignty operations, and recent events.',
6
+ inputSchema: {},
7
+ category: 'cognitive',
8
+ handler: async (_params, _ctx) => {
9
+ const metrics = guardian.stateGuardian.getMetrics();
10
+ const firewallStats = guardian.firewall.getStats();
11
+ const recentEvents = guardian.stateGuardian.getRecentEvents(5);
12
+ const recentOps = guardian.sovereigntyManager.getOperationHistory();
13
+ return {
14
+ success: true,
15
+ data: {
16
+ system: {
17
+ frozen: guardian.stateGuardian.isFrozen,
18
+ freezeReason: guardian.stateGuardian.freezeMessage,
19
+ uptimeMs: metrics.uptimeMs,
20
+ },
21
+ metrics: {
22
+ totalToolCalls: metrics.totalToolCalls,
23
+ failedCalls: metrics.failedCalls,
24
+ errorRate: metrics.errorRate,
25
+ avgResponseMs: metrics.avgResponseMs,
26
+ activeAgents: metrics.activeAgents,
27
+ memoryMB: metrics.memoryUsage,
28
+ },
29
+ firewall: {
30
+ rulesActive: firewallStats.rulesActive,
31
+ blockedCount: firewallStats.blockedCount,
32
+ flaggedCount: firewallStats.flaggedCount,
33
+ totalHits: firewallStats.totalHits,
34
+ },
35
+ sovereignty: {
36
+ totalOperations: guardian.sovereigntyManager.totalOperations,
37
+ chainVerified: true,
38
+ },
39
+ recentEvents: recentEvents.map(e => ({
40
+ time: new Date(e.timestamp).toISOString(),
41
+ severity: e.severity,
42
+ type: e.type,
43
+ message: e.message,
44
+ })),
45
+ recentOperations: recentOps.slice(0, 5).map(o => ({
46
+ operationId: o.operationId,
47
+ action: o.action,
48
+ status: o.status,
49
+ chainLength: o.sovereigntyChain.length,
50
+ })),
51
+ },
52
+ metadata: { guardian: 'status', sovereignty: _ctx.identity.sovereignty },
53
+ };
54
+ },
55
+ };
56
+ }
57
+ export function createGuardianFreezeTool(guardian) {
58
+ return {
59
+ id: 'guardian_freeze',
60
+ name: 'Guardian Freeze',
61
+ description: 'Freeze all system operations. Requires host-level sovereignty. Emergency stop for anomaly response.',
62
+ inputSchema: {
63
+ reason: { type: 'string', description: 'Reason for freezing the system' },
64
+ },
65
+ sovereignty: 0.9,
66
+ category: 'cognitive',
67
+ handler: async (params, ctx) => {
68
+ if (ctx.identity.sovereignty < 0.9) {
69
+ return { success: false, data: null, error: 'GUARDIAN: Freeze requires sovereignty ≥ 0.9 (host-level)' };
70
+ }
71
+ const reason = String(params.reason || 'Manual freeze via guardian_freeze');
72
+ guardian.stateGuardian.freeze(reason);
73
+ await ctx.memory.store('security', `freeze-${Date.now()}`, { reason, actor: ctx.identity.actorId });
74
+ return {
75
+ success: true,
76
+ data: { frozen: true, reason, timestamp: Date.now() },
77
+ metadata: { guardian: 'frozen', sovereignty: ctx.identity.sovereignty },
78
+ };
79
+ },
80
+ };
81
+ }
82
+ export function createGuardianUnfreezeTool(guardian) {
83
+ return {
84
+ id: 'guardian_unfreeze',
85
+ name: 'Guardian Unfreeze',
86
+ description: 'Resume system operations after a freeze. Requires host-level sovereignty.',
87
+ inputSchema: {},
88
+ sovereignty: 0.9,
89
+ category: 'cognitive',
90
+ handler: async (_params, ctx) => {
91
+ if (ctx.identity.sovereignty < 0.9) {
92
+ return { success: false, data: null, error: 'GUARDIAN: Unfreeze requires sovereignty ≥ 0.9 (host-level)' };
93
+ }
94
+ guardian.stateGuardian.unfreeze();
95
+ await ctx.memory.store('security', `unfreeze-${Date.now()}`, { actor: ctx.identity.actorId });
96
+ return {
97
+ success: true,
98
+ data: { frozen: false, timestamp: Date.now() },
99
+ metadata: { guardian: 'unfrozen', sovereignty: ctx.identity.sovereignty },
100
+ };
101
+ },
102
+ };
103
+ }
104
+ //# sourceMappingURL=guardian_tools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"guardian_tools.js","sourceRoot":"","sources":["../../../src/tools/security/guardian_tools.ts"],"names":[],"mappings":"AAGA,MAAM,UAAU,wBAAwB,CAAC,QAAsB;IAC7D,OAAO;QACL,EAAE,EAAE,iBAAiB;QACrB,IAAI,EAAE,iBAAiB;QACvB,WAAW,EAAE,uHAAuH;QACpI,WAAW,EAAE,EAAE;QACf,QAAQ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AI;gBACb,IAAI,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE,EAAE;gBAC9C,QAAQ,EAAE,EAAE,QAAQ,EAAE,UAAU,EAAE,WAAW,EAAE,GAAG,CAAC,QAAQ,CAAC,WAAW,EAAE;aAC1E,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,2 @@
1
+ import type { ToolDefinition } from '../../types.js';
2
+ export declare const integrityLedgerTool: ToolDefinition;
@@ -0,0 +1,111 @@
1
+ export const integrityLedgerTool = {
2
+ id: 'integrity_ledger',
3
+ name: 'Integrity Ledger',
4
+ description: 'Immutable audit trail with cryptographic seals. Creates signed ledger entries, verifies chain integrity, and detects tampering across entry chains.',
5
+ inputSchema: {
6
+ action: { type: 'string', enum: ['create', 'verify', 'chain'], description: 'Ledger action' },
7
+ actor: { type: 'string', description: 'Actor identity for the entry' },
8
+ resource: { type: 'string', description: 'Resource being acted upon' },
9
+ payload: { type: 'string', description: 'Payload or description of the action' },
10
+ entryId: { type: 'string', description: 'Entry ID to verify (for verify action)' },
11
+ chainId: { type: 'string', description: 'Chain namespace to search (for chain action)' },
12
+ },
13
+ category: 'cognitive',
14
+ handler: async (params, ctx) => {
15
+ const action = String(params.action || 'create');
16
+ const actor = String(params.actor || ctx.identity.actorId);
17
+ const resource = String(params.resource || 'unknown');
18
+ const payload = String(params.payload || '');
19
+ const entryId = String(params.entryId || '');
20
+ const chainId = String(params.chainId || 'default');
21
+ if (action === 'create') {
22
+ const entries = await ctx.memory.recall({ namespace: 'ledger', key: `chain:${chainId}`, limit: 1 });
23
+ const previousHash = entries.length > 0 ? entries[0].value.hash : 'GENESIS';
24
+ const raw = `${actor}:${resource}:${payload}:${previousHash}:${Date.now()}`;
25
+ let hash = 0;
26
+ for (let i = 0; i < raw.length; i++) {
27
+ hash = ((hash << 5) - hash) + raw.charCodeAt(i);
28
+ hash |= 0;
29
+ }
30
+ const hashStr = Math.abs(hash).toString(16).padStart(12, '0');
31
+ const seal = `ledger:${ctx.identity.sovereignty.toFixed(2)}:${hashStr.slice(0, 8)}`;
32
+ const entry = {
33
+ hash: hashStr,
34
+ previousHash,
35
+ timestamp: Date.now(),
36
+ actor,
37
+ action: payload.split(' ')[0] || 'unknown',
38
+ resource,
39
+ payload: payload.slice(0, 500),
40
+ seal,
41
+ };
42
+ await ctx.memory.store('ledger', `chain:${chainId}`, entry);
43
+ await ctx.memory.store('ledger', `entry:${hashStr}`, entry);
44
+ return {
45
+ success: true,
46
+ data: {
47
+ entry,
48
+ chainLength: entries.length + 1,
49
+ verified: true,
50
+ },
51
+ metadata: {
52
+ hash: hashStr,
53
+ seal,
54
+ sovereignty: ctx.identity.sovereignty,
55
+ },
56
+ };
57
+ }
58
+ if (action === 'verify') {
59
+ if (!entryId) {
60
+ return { success: false, data: null, error: 'entryId required for verify action' };
61
+ }
62
+ const results = await ctx.memory.recall({ namespace: 'ledger', key: `entry:${entryId}` });
63
+ if (results.length === 0) {
64
+ return { success: false, data: null, error: `Entry ${entryId} not found` };
65
+ }
66
+ const entry = results[0].value;
67
+ const prevResults = entry.previousHash !== 'GENESIS'
68
+ ? await ctx.memory.recall({ namespace: 'ledger', key: `entry:${entry.previousHash}` })
69
+ : [];
70
+ const chainValid = entry.previousHash === 'GENESIS' || prevResults.length > 0;
71
+ return {
72
+ success: true,
73
+ data: {
74
+ entry,
75
+ verified: chainValid,
76
+ chainIntegrity: chainValid ? 'INTACT' : 'BROKEN',
77
+ previousEntryFound: prevResults.length > 0 || entry.previousHash === 'GENESIS',
78
+ },
79
+ };
80
+ }
81
+ if (action === 'chain') {
82
+ const entries = await ctx.memory.recall({ namespace: 'ledger', key: `chain:${chainId}`, limit: 100 });
83
+ const sorted = entries.sort((a, b) => a.value.timestamp - b.value.timestamp);
84
+ let chainValid = true;
85
+ for (let i = 1; i < sorted.length; i++) {
86
+ const prev = sorted[i - 1].value;
87
+ const curr = sorted[i].value;
88
+ if (curr.previousHash !== prev.hash) {
89
+ chainValid = false;
90
+ break;
91
+ }
92
+ }
93
+ return {
94
+ success: true,
95
+ data: {
96
+ chainId,
97
+ entryCount: sorted.length,
98
+ chainValid,
99
+ integrity: chainValid ? 'INTACT' : 'TAMPER_DETECTED',
100
+ entries: sorted.map(e => e.value),
101
+ },
102
+ metadata: {
103
+ chainLength: sorted.length,
104
+ sovereignty: ctx.identity.sovereignty,
105
+ },
106
+ };
107
+ }
108
+ return { success: false, data: null, error: `Unknown action: ${action}` };
109
+ },
110
+ };
111
+ //# sourceMappingURL=integrity_ledger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"integrity_ledger.js","sourceRoot":"","sources":["../../../src/tools/security/integrity_ledger.ts"],"names":[],"mappings":"AAaA,MAAM,CAAC,MAAM,mBAAmB,GAAmB;IACjD,EAAE,EAAE,kBAAkB;IACtB,IAAI,EAAE,kBAAkB;IACxB,WAAW,EAAE,qJAAqJ;IAClK,WAAW,EAAE;QACX,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,CAAC,EAAE,WAAW,EAAE,eAAe,EAAE;QAC7F,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,8BAA8B,EAAE;QACtE,QAAQ,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,2BAA2B,EAAE;QACtE,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,sCAAsC,EAAE;QAChF,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,wCAAwC,EAAE;QAClF,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,8CAA8C,EAAE;KACzF;IACD,QAAQ,EAAE,WAAW;IACrB,OAAO,EAAE,KAAK,EAAE,MAA+B,EAAE,GAAgB,EAAuB,EAAE;QACxF,MAAM,MAA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