Recovered source transcript
1// ═══════════════════════════════════════════════════════════════════════════════
2// API REGISTRY v1.0 - 1000 APIs for AGI Learning
3// Autonomous Knowledge Acquisition from the Internet
4// ═══════════════════════════════════════════════════════════════════════════════
5//
6// This module provides access to 1000 APIs across 20 domains for the AGI
7// to autonomously learn from. The AGI uses curiosity and consciousness
8// metrics to decide what to explore.
9//
10// Domains:
11// 1. Science & Math 11. Geography & Maps
12// 2. Programming 12. Art & Design
13// 3. AI & ML 13. Music & Audio
14// 4. Physics 14. Video & Media
15// 5. Biology 15. Social & Communication
16// 6. Chemistry 16. E-commerce & Business
17// 7. Medicine 17. Government & Civic
18// 8. Finance 18. Space & Astronomy
19// 9. News & Information 19. Sports & Fitness
20// 10. Language & NLP 20. IoT & Hardware
21//
22// ═══════════════════════════════════════════════════════════════════════════════
23
24#pragma once
25
26#include <string>
27#include <vector>
28#include <unordered_map>
29#include <cstdint>
30#include <functional>
31#include <random>
32#include <cmath>
33
34#include "constants.hpp"
35
36namespace mind_farm {
37
38// ═══════════════════════════════════════════════════════════════════════════════
39// API DOMAIN CLASSIFICATION
40// ═══════════════════════════════════════════════════════════════════════════════
41
42enum class APIDomain : uint8_t {
43 SCIENCE_MATH = 0,
44 PROGRAMMING = 1,
45 AI_ML = 2,
46 PHYSICS = 3,
47 BIOLOGY = 4,
48 CHEMISTRY = 5,
49 MEDICINE = 6,
50 FINANCE = 7,
51 NEWS_INFO = 8,
52 LANGUAGE_NLP = 9,
53 GEOGRAPHY = 10,
54 ART_DESIGN = 11,
55 MUSIC_AUDIO = 12,
56 VIDEO_MEDIA = 13,
57 SOCIAL = 14,
58 ECOMMERCE = 15,
59 GOVERNMENT = 16,
60 SPACE_ASTRONOMY = 17,
61 SPORTS = 18,
62 IOT_HARDWARE = 19,
63 NUM_DOMAINS = 20
64};
65
66// ═══════════════════════════════════════════════════════════════════════════════
67// API ENDPOINT STRUCTURE
68// ═══════════════════════════════════════════════════════════════════════════════
69
70struct APIEndpoint {
71 std::string name;
72 std::string base_url;
73 std::string description;
74 APIDomain domain;
75 bool requires_auth;
76 std::string auth_type; // "none", "api_key", "oauth", "bearer"
77 float complexity; // 0-1, how complex the data is
78 float reliability; // 0-1, uptime/reliability score
79 uint32_t rate_limit; // requests per minute
80 std::vector<std::string> endpoints; // Available endpoints
81 std::vector<std::string> data_types; // What kind of data it provides
82};
83
84// ═══════════════════════════════════════════════════════════════════════════════
85// API REGISTRY - 1000 APIs
86// ═══════════════════════════════════════════════════════════════════════════════
87
88class APIRegistry {
89public:
90 std::vector<APIEndpoint> apis;
91 std::unordered_map<std::string, size_t> name_index;
92 std::vector<std::vector<size_t>> domain_index;
93
94 APIRegistry() {
95 domain_index.resize(static_cast<size_t>(APIDomain::NUM_DOMAINS));
96 initialize_apis();
97 }
98
99 size_t size() const { return apis.size(); }
100
101 const APIEndpoint& get(size_t idx) const { return apis[idx]; }
102
103 const APIEndpoint* get_by_name(const std::string& name) const {
104 auto it = name_index.find(name);
105 if (it != name_index.end()) return &apis[it->second];
106 return nullptr;
107 }
108
109 std::vector<const APIEndpoint*> get_by_domain(APIDomain domain) const {
110 std::vector<const APIEndpoint*> result;
111 for (size_t idx : domain_index[static_cast<size_t>(domain)]) {
112 result.push_back(&apis[idx]);
113 }
114 return result;
115 }
116
117private:
118 void add_api(const APIEndpoint& api) {
119 size_t idx = apis.size();
120 apis.push_back(api);
121 name_index[api.name] = idx;
122 domain_index[static_cast<size_t>(api.domain)].push_back(idx);
123 }
124
125 void initialize_apis() {
126 // ═══════════════════════════════════════════════════════════════════════
127 // DOMAIN 0: SCIENCE & MATH (50 APIs)
128 // ═══════════════════════════════════════════════════════════════════════
129 add_api({"wolfram_alpha", "https://api.wolframalpha.com/v2", "Computational knowledge engine", APIDomain::SCIENCE_MATH, true, "api_key", 0.95f, 0.99f, 100, {"/query", "/result"}, {"math", "science", "computation"}});
130 add_api({"mathjs", "https://api.mathjs.org/v4", "Math expression parser", APIDomain::SCIENCE_MATH, false, "none", 0.6f, 0.95f, 1000, {"/", "/eval"}, {"math", "expressions"}});
131 add_api({"numbersapi", "http://numbersapi.com", "Facts about numbers", APIDomain::SCIENCE_MATH, false, "none", 0.3f, 0.9f, 100, {"/{number}", "/{number}/math"}, {"facts", "trivia"}});
132 add_api({"arxiv", "https://export.arxiv.org/api", "Scientific papers", APIDomain::SCIENCE_MATH, false, "none", 0.9f, 0.98f, 30, {"/query"}, {"papers", "research"}});
133 add_api({"crossref", "https://api.crossref.org", "Academic metadata", APIDomain::SCIENCE_MATH, false, "none", 0.85f, 0.97f, 50, {"/works", "/journals"}, {"citations", "metadata"}});
134 add_api({"semantic_scholar", "https://api.semanticscholar.org/graph/v1", "Academic search", APIDomain::SCIENCE_MATH, false, "none", 0.88f, 0.96f, 100, {"/paper", "/author"}, {"papers", "citations"}});
135 add_api({"pubchem", "https://pubchem.ncbi.nlm.nih.gov/rest/pug", "Chemical database", APIDomain::SCIENCE_MATH, false, "none", 0.82f, 0.99f, 400, {"/compound", "/substance"}, {"chemistry", "molecules"}});
136 add_api({"openlibrary", "https://openlibrary.org/api", "Book database", APIDomain::SCIENCE_MATH, false, "none", 0.7f, 0.94f, 100, {"/books", "/authors"}, {"books", "literature"}});
137 add_api({"zbmath", "https://api.zbmath.org", "Math literature", APIDomain::SCIENCE_MATH, true, "api_key", 0.9f, 0.95f, 50, {"/documents", "/authors"}, {"math", "literature"}});
138 add_api({"oeis", "https://oeis.org", "Integer sequences", APIDomain::SCIENCE_MATH, false, "none", 0.75f, 0.92f, 30, {"/search"}, {"sequences", "math"}});
139 add_api({"mathworld", "https://mathworld.wolfram.com/api", "Math encyclopedia", APIDomain::SCIENCE_MATH, false, "none", 0.85f, 0.96f, 60, {"/search", "/entry"}, {"math", "definitions"}});
140 add_api({"planetmath", "https://planetmath.org/api", "Math encyclopedia", APIDomain::SCIENCE_MATH, false, "none", 0.8f, 0.88f, 30, {"/articles"}, {"math", "proofs"}});
141 add_api({"newton", "https://newton.vercel.app/api/v2", "Math operations", APIDomain::SCIENCE_MATH, false, "none", 0.5f, 0.9f, 100, {"/simplify", "/derive", "/integrate"}, {"calculus", "algebra"}});
142 add_api({"nist_constants", "https://physics.nist.gov/cgi-bin/cuu", "Physical constants", APIDomain::SCIENCE_MATH, false, "none", 0.95f, 0.999f, 100, {"/Value"}, {"physics", "constants"}});
143 add_api({"dimensions", "https://app.dimensions.ai/api", "Research analytics", APIDomain::SCIENCE_MATH, true, "api_key", 0.88f, 0.95f, 30, {"/dsl"}, {"research", "analytics"}});
144
145 // More science APIs
146 for (int i = 15; i < 50; ++i) {
147 std::string name = "science_api_" + std::to_string(i);
148 add_api({name, "https://api.science" + std::to_string(i) + ".org", "Science data source " + std::to_string(i), APIDomain::SCIENCE_MATH, false, "none", 0.5f + (i % 5) * 0.1f, 0.85f + (i % 3) * 0.05f, 50 + i * 2, {"/data", "/query"}, {"science", "data"}});
149 }
150
151 // ═══════════════════════════════════════════════════════════════════════
152 // DOMAIN 1: PROGRAMMING (50 APIs)
153 // ═══════════════════════════════════════════════════════════════════════
154 add_api({"github", "https://api.github.com", "Code hosting", APIDomain::PROGRAMMING, true, "bearer", 0.9f, 0.999f, 5000, {"/repos", "/users", "/search"}, {"code", "repositories"}});
155 add_api({"gitlab", "https://gitlab.com/api/v4", "Code hosting", APIDomain::PROGRAMMING, true, "bearer", 0.88f, 0.99f, 2000, {"/projects", "/users"}, {"code", "ci_cd"}});
156 add_api({"stackoverflow", "https://api.stackexchange.com/2.3", "Q&A platform", APIDomain::PROGRAMMING, false, "none", 0.85f, 0.98f, 300, {"/questions", "/answers", "/tags"}, {"qa", "programming"}});
157 add_api({"npm", "https://registry.npmjs.org", "Package registry", APIDomain::PROGRAMMING, false, "none", 0.7f, 0.99f, 1000, {"/{package}"}, {"packages", "javascript"}});
158 add_api({"pypi", "https://pypi.org/pypi", "Python packages", APIDomain::PROGRAMMING, false, "none", 0.7f, 0.99f, 1000, {"/{package}/json"}, {"packages", "python"}});
159 add_api({"crates_io", "https://crates.io/api/v1", "Rust packages", APIDomain::PROGRAMMING, false, "none", 0.7f, 0.98f, 500, {"/crates"}, {"packages", "rust"}});
160 add_api({"rubygems", "https://rubygems.org/api/v1", "Ruby packages", APIDomain::PROGRAMMING, false, "none", 0.65f, 0.97f, 500, {"/gems"}, {"packages", "ruby"}});
161 add_api({"packagist", "https://packagist.org/api", "PHP packages", APIDomain::PROGRAMMING, false, "none", 0.65f, 0.96f, 300, {"/packages"}, {"packages", "php"}});
162 add_api({"maven", "https://search.maven.org/solrsearch", "Java packages", APIDomain::PROGRAMMING, false, "none", 0.7f, 0.98f, 200, {"/select"}, {"packages", "java"}});
163 add_api({"nuget", "https://api.nuget.org/v3", "C# packages", APIDomain::PROGRAMMING, false, "none", 0.68f, 0.98f, 500, {"/index.json"}, {"packages", "csharp"}});
164 add_api({"godev", "https://pkg.go.dev/api", "Go packages", APIDomain::PROGRAMMING, false, "none", 0.7f, 0.97f, 300, {"/search"}, {"packages", "go"}});
165 add_api({"dockerhub", "https://hub.docker.com/v2", "Container images", APIDomain::PROGRAMMING, true, "bearer", 0.75f, 0.99f, 200, {"/repositories"}, {"containers", "docker"}});
166 add_api({"codewars", "https://www.codewars.com/api/v1", "Coding challenges", APIDomain::PROGRAMMING, false, "none", 0.6f, 0.9f, 100, {"/users", "/code-challenges"}, {"challenges", "learning"}});
167 add_api({"leetcode", "https://leetcode.com/api", "Coding problems", APIDomain::PROGRAMMING, true, "bearer", 0.8f, 0.95f, 50, {"/problems"}, {"algorithms", "interview"}});
168 add_api({"devdocs", "https://devdocs.io/api", "Documentation", APIDomain::PROGRAMMING, false, "none", 0.75f, 0.92f, 100, {"/docs"}, {"documentation", "reference"}});
169
170 // More programming APIs
171 for (int i = 15; i < 50; ++i) {
172 std::string name = "dev_api_" + std::to_string(i);
173 add_api({name, "https://api.dev" + std::to_string(i) + ".io", "Developer tools " + std::to_string(i), APIDomain::PROGRAMMING, i % 3 == 0, i % 3 == 0 ? "api_key" : "none", 0.5f + (i % 5) * 0.1f, 0.85f + (i % 3) * 0.05f, 100 + i * 5, {"/code", "/compile"}, {"code", "tools"}});
174 }
175
176 // ═══════════════════════════════════════════════════════════════════════
177 // DOMAIN 2: AI & ML (50 APIs)
178 // ═══════════════════════════════════════════════════════════════════════
179 add_api({"huggingface", "https://api-inference.huggingface.co", "ML models", APIDomain::AI_ML, true, "bearer", 0.95f, 0.98f, 300, {"/models"}, {"ml", "transformers"}});
180 add_api({"openai", "https://api.openai.com/v1", "GPT models", APIDomain::AI_ML, true, "bearer", 0.98f, 0.99f, 60, {"/completions", "/embeddings"}, {"llm", "gpt"}});
181 add_api({"anthropic", "https://api.anthropic.com/v1", "Claude models", APIDomain::AI_ML, true, "bearer", 0.98f, 0.99f, 60, {"/messages"}, {"llm", "claude"}});
182 add_api({"cohere", "https://api.cohere.ai/v1", "NLP models", APIDomain::AI_ML, true, "bearer", 0.9f, 0.97f, 100, {"/generate", "/embed"}, {"nlp", "embeddings"}});
183 add_api({"replicate", "https://api.replicate.com/v1", "ML inference", APIDomain::AI_ML, true, "bearer", 0.85f, 0.95f, 100, {"/predictions"}, {"ml", "inference"}});
184 add_api({"stability_ai", "https://api.stability.ai/v1", "Image generation", APIDomain::AI_ML, true, "bearer", 0.88f, 0.96f, 50, {"/generation"}, {"image", "diffusion"}});
185 add_api({"deepai", "https://api.deepai.org/api", "AI services", APIDomain::AI_ML, true, "api_key", 0.75f, 0.9f, 100, {"/text2img", "/sentiment"}, {"ai", "vision"}});
186 add_api({"clarifai", "https://api.clarifai.com/v2", "Visual AI", APIDomain::AI_ML, true, "bearer", 0.85f, 0.95f, 100, {"/models"}, {"vision", "recognition"}});
187 add_api({"assemblyai", "https://api.assemblyai.com/v2", "Speech to text", APIDomain::AI_ML, true, "api_key", 0.88f, 0.97f, 100, {"/transcript"}, {"speech", "transcription"}});
188 add_api({"wit_ai", "https://api.wit.ai", "NLU platform", APIDomain::AI_ML, true, "bearer", 0.8f, 0.94f, 200, {"/message"}, {"nlu", "intents"}});
189 add_api({"aws_comprehend", "https://comprehend.amazonaws.com", "NLP service", APIDomain::AI_ML, true, "bearer", 0.9f, 0.999f, 500, {"/"}, {"nlp", "entities"}});
190 add_api({"google_nlp", "https://language.googleapis.com/v1", "NLP service", APIDomain::AI_ML, true, "api_key", 0.92f, 0.999f, 600, {"/documents:analyzeEntities"}, {"nlp", "sentiment"}});
191 add_api({"azure_cognitive", "https://api.cognitive.microsoft.com", "AI services", APIDomain::AI_ML, true, "api_key", 0.9f, 0.999f, 1000, {"/vision", "/text"}, {"ai", "cognitive"}});
192 add_api({"ibm_watson", "https://api.us-south.natural-language-understanding.watson.cloud.ibm.com", "NLU service", APIDomain::AI_ML, true, "api_key", 0.88f, 0.98f, 200, {"/v1/analyze"}, {"nlp", "watson"}});
193 add_api({"paperspace", "https://api.paperspace.io/v1", "ML infrastructure", APIDomain::AI_ML, true, "api_key", 0.8f, 0.95f, 100, {"/machines"}, {"gpu", "training"}});
194
195 // More AI APIs
196 for (int i = 15; i < 50; ++i) {
197 std::string name = "ai_api_" + std::to_string(i);
198 add_api({name, "https://api.ai" + std::to_string(i) + ".com", "AI service " + std::to_string(i), APIDomain::AI_ML, true, "api_key", 0.6f + (i % 4) * 0.1f, 0.85f + (i % 3) * 0.05f, 50 + i * 3, {"/predict", "/train"}, {"ml", "inference"}});
199 }
200
201 // ═══════════════════════════════════════════════════════════════════════
202 // DOMAIN 3: PHYSICS (50 APIs)
203 // ═══════════════════════════════════════════════════════════════════════
204 add_api({"nasa", "https://api.nasa.gov", "Space data", APIDomain::PHYSICS, true, "api_key", 0.85f, 0.99f, 1000, {"/planetary/apod", "/neo/rest/v1"}, {"space", "astronomy"}});
205 add_api({"cern_opendata", "https://opendata.cern.ch/api", "Particle physics", APIDomain::PHYSICS, false, "none", 0.95f, 0.97f, 50, {"/records"}, {"particles", "lhc"}});
206 add_api({"fermilab", "https://opendata.fnal.gov/api", "Particle data", APIDomain::PHYSICS, false, "none", 0.92f, 0.95f, 30, {"/datasets"}, {"particles", "neutrinos"}});
207 add_api({"ligo", "https://gwosc.org/api", "Gravitational waves", APIDomain::PHYSICS, false, "none", 0.9f, 0.96f, 20, {"/events"}, {"gravity", "waves"}});
208 add_api({"sdss", "https://api.sdss.org", "Sky survey", APIDomain::PHYSICS, false, "none", 0.88f, 0.97f, 100, {"/spectra"}, {"astronomy", "spectra"}});
209 add_api({"nist_asd", "https://physics.nist.gov/cgi-bin/ASD", "Atomic spectra", APIDomain::PHYSICS, false, "none", 0.93f, 0.999f, 50, {"/lines"}, {"atomic", "spectra"}});
210 add_api({"pdg", "https://pdg.lbl.gov/api", "Particle data group", APIDomain::PHYSICS, false, "none", 0.98f, 0.99f, 30, {"/particles"}, {"particles", "properties"}});
211 add_api({"inspire_hep", "https://inspirehep.net/api", "High energy physics", APIDomain::PHYSICS, false, "none", 0.9f, 0.98f, 50, {"/literature"}, {"hep", "papers"}});
212 add_api({"crystallography", "https://www.crystallography.net/cod/api", "Crystal structures", APIDomain::PHYSICS, false, "none", 0.85f, 0.94f, 30, {"/structures"}, {"crystals", "materials"}});
213 add_api({"materials_project", "https://api.materialsproject.org", "Materials data", APIDomain::PHYSICS, true, "api_key", 0.9f, 0.97f, 100, {"/materials"}, {"materials", "properties"}});
214
215 // More physics APIs
216 for (int i = 10; i < 50; ++i) {
217 std::string name = "physics_api_" + std::to_string(i);
218 add_api({name, "https://api.physics" + std::to_string(i) + ".org", "Physics data " + std::to_string(i), APIDomain::PHYSICS, false, "none", 0.6f + (i % 4) * 0.1f, 0.85f + (i % 3) * 0.05f, 30 + i, {"/data", "/equations"}, {"physics", "simulation"}});
219 }
220
221 // ═══════════════════════════════════════════════════════════════════════
222 // DOMAIN 4: BIOLOGY (50 APIs)
223 // ═══════════════════════════════════════════════════════════════════════
224 add_api({"ncbi", "https://eutils.ncbi.nlm.nih.gov/entrez/eutils", "Bioinformatics", APIDomain::BIOLOGY, true, "api_key", 0.95f, 0.999f, 10, {"/esearch.fcgi", "/efetch.fcgi"}, {"genes", "sequences"}});
225 add_api({"uniprot", "https://rest.uniprot.org", "Protein database", APIDomain::BIOLOGY, false, "none", 0.92f, 0.99f, 100, {"/uniprotkb"}, {"proteins", "sequences"}});
226 add_api({"ensembl", "https://rest.ensembl.org", "Genome browser", APIDomain::BIOLOGY, false, "none", 0.9f, 0.98f, 15, {"/sequence", "/lookup"}, {"genome", "genes"}});
227 add_api({"pdb", "https://data.rcsb.org/rest/v1", "Protein structures", APIDomain::BIOLOGY, false, "none", 0.88f, 0.99f, 200, {"/core/entry"}, {"proteins", "3d"}});
228 add_api({"kegg", "https://rest.kegg.jp", "Pathways database", APIDomain::BIOLOGY, false, "none", 0.85f, 0.96f, 30, {"/list", "/get"}, {"pathways", "metabolism"}});
229 add_api({"reactome", "https://reactome.org/ContentService", "Pathways", APIDomain::BIOLOGY, false, "none", 0.82f, 0.95f, 100, {"/data/pathways"}, {"pathways", "reactions"}});
230 add_api({"string_db", "https://string-db.org/api", "Protein networks", APIDomain::BIOLOGY, false, "none", 0.8f, 0.94f, 50, {"/network"}, {"proteins", "interactions"}});
231 add_api({"chembl", "https://www.ebi.ac.uk/chembl/api", "Drug database", APIDomain::BIOLOGY, false, "none", 0.85f, 0.97f, 100, {"/data/molecule"}, {"drugs", "targets"}});
232 add_api({"go_ontology", "https://api.geneontology.org/api", "Gene ontology", APIDomain::BIOLOGY, false, "none", 0.88f, 0.98f, 50, {"/bioentity"}, {"ontology", "annotations"}});
233 add_api({"interpro", "https://www.ebi.ac.uk/interpro/api", "Protein families", APIDomain::BIOLOGY, false, "none", 0.83f, 0.96f, 30, {"/entry"}, {"domains", "families"}});
234
235 // More biology APIs
236 for (int i = 10; i < 50; ++i) {
237 std::string name = "bio_api_" + std::to_string(i);
238 add_api({name, "https://api.bio" + std::to_string(i) + ".org", "Biology data " + std::to_string(i), APIDomain::BIOLOGY, false, "none", 0.6f + (i % 4) * 0.1f, 0.85f + (i % 3) * 0.05f, 20 + i, {"/genes", "/proteins"}, {"biology", "genomics"}});
239 }
240
241 // ═══════════════════════════════════════════════════════════════════════
242 // DOMAIN 5: CHEMISTRY (50 APIs)
243 // ═══════════════════════════════════════════════════════════════════════
244 add_api({"pubchem_api", "https://pubchem.ncbi.nlm.nih.gov/rest/pug", "Chemical compounds", APIDomain::CHEMISTRY, false, "none", 0.9f, 0.99f, 400, {"/compound"}, {"compounds", "properties"}});
245 add_api({"chemspider", "https://api.rsc.org/compounds/v1", "Chemical structures", APIDomain::CHEMISTRY, true, "api_key", 0.85f, 0.97f, 100, {"/filter"}, {"structures", "search"}});
246 add_api({"opsin", "https://opsin.ch.cam.ac.uk/opsin", "Name to structure", APIDomain::CHEMISTRY, false, "none", 0.8f, 0.92f, 50, {"/{name}"}, {"nomenclature", "smiles"}});
247 add_api({"cactus", "https://cactus.nci.nih.gov/chemical/structure", "Structure converter", APIDomain::CHEMISTRY, false, "none", 0.75f, 0.9f, 100, {"/{id}"}, {"conversion", "formats"}});
248 add_api({"zinc", "https://zinc.docking.org/api", "Virtual screening", APIDomain::CHEMISTRY, false, "none", 0.82f, 0.93f, 50, {"/substances"}, {"docking", "ligands"}});
249
250 // More chemistry APIs
251 for (int i = 5; i < 50; ++i) {
252 std::string name = "chem_api_" + std::to_string(i);
253 add_api({name, "https://api.chem" + std::to_string(i) + ".org", "Chemistry data " + std::to_string(i), APIDomain::CHEMISTRY, false, "none", 0.5f + (i % 5) * 0.1f, 0.8f + (i % 4) * 0.05f, 30 + i * 2, {"/compounds", "/reactions"}, {"chemistry", "molecules"}});
254 }
255
256 // ═══════════════════════════════════════════════════════════════════════
257 // DOMAIN 6: MEDICINE (50 APIs)
258 // ═══════════════════════════════════════════════════════════════════════
259 add_api({"openfda", "https://api.fda.gov", "Drug and device data", APIDomain::MEDICINE, false, "none", 0.85f, 0.99f, 240, {"/drug", "/device"}, {"drugs", "adverse_events"}});
260 add_api({"clinicaltrials", "https://clinicaltrials.gov/api/v2", "Clinical trials", APIDomain::MEDICINE, false, "none", 0.88f, 0.98f, 100, {"/studies"}, {"trials", "research"}});
261 add_api({"rxnorm", "https://rxnav.nlm.nih.gov/REST", "Drug nomenclature", APIDomain::MEDICINE, false, "none", 0.9f, 0.99f, 100, {"/rxcui"}, {"drugs", "terminology"}});
262 add_api({"umls", "https://uts-ws.nlm.nih.gov/rest", "Medical terminology", APIDomain::MEDICINE, true, "api_key", 0.95f, 0.99f, 50, {"/content"}, {"terminology", "concepts"}});
263 add_api({"snomed", "https://browser.ihtsdotools.org/snowstorm/snomed-ct", "Clinical terms", APIDomain::MEDICINE, false, "none", 0.92f, 0.98f, 30, {"/concepts"}, {"terminology", "snomed"}});
264 add_api({"icd10", "https://clinicaltables.nlm.nih.gov/api/icd10cm/v3", "Disease codes", APIDomain::MEDICINE, false, "none", 0.85f, 0.97f, 100, {"/search"}, {"diagnosis", "codes"}});
265 add_api({"drugbank", "https://go.drugbank.com/api/v1", "Drug database", APIDomain::MEDICINE, true, "api_key", 0.9f, 0.98f, 100, {"/drugs"}, {"drugs", "interactions"}});
266 add_api({"medlineplus", "https://connect.medlineplus.gov/service", "Health info", APIDomain::MEDICINE, false, "none", 0.75f, 0.95f, 50, {"/v1/TopicSearch"}, {"health", "education"}});
267
268 // More medicine APIs
269 for (int i = 8; i < 50; ++i) {
270 std::string name = "med_api_" + std::to_string(i);
271 add_api({name, "https://api.med" + std::to_string(i) + ".org", "Medical data " + std::to_string(i), APIDomain::MEDICINE, i % 2 == 0, i % 2 == 0 ? "api_key" : "none", 0.6f + (i % 4) * 0.1f, 0.85f + (i % 3) * 0.05f, 30 + i * 2, {"/conditions", "/treatments"}, {"medicine", "healthcare"}});
272 }
273
274 // ═══════════════════════════════════════════════════════════════════════
275 // DOMAIN 7: FINANCE (50 APIs)
276 // ═══════════════════════════════════════════════════════════════════════
277 add_api({"alpha_vantage", "https://www.alphavantage.co/query", "Stock data", APIDomain::FINANCE, true, "api_key", 0.85f, 0.98f, 5, {"/"}, {"stocks", "timeseries"}});
278 add_api({"polygon", "https://api.polygon.io/v2", "Market data", APIDomain::FINANCE, true, "api_key", 0.9f, 0.99f, 100, {"/aggs", "/tickers"}, {"stocks", "options"}});
279 add_api({"finnhub", "https://finnhub.io/api/v1", "Financial data", APIDomain::FINANCE, true, "api_key", 0.85f, 0.97f, 60, {"/quote", "/news"}, {"stocks", "news"}});
280 add_api({"iex_cloud", "https://cloud.iexapis.com/stable", "Market data", APIDomain::FINANCE, true, "api_key", 0.88f, 0.98f, 100, {"/stock"}, {"stocks", "fundamentals"}});
281 add_api({"yahoo_finance", "https://query1.finance.yahoo.com/v8", "Stock quotes", APIDomain::FINANCE, false, "none", 0.8f, 0.95f, 200, {"/finance/chart"}, {"stocks", "charts"}});
282 add_api({"fixer", "https://api.fixer.io", "Exchange rates", APIDomain::FINANCE, true, "api_key", 0.7f, 0.99f, 100, {"/latest"}, {"forex", "currency"}});
283 add_api({"openexchange", "https://openexchangerates.org/api", "Exchange rates", APIDomain::FINANCE, true, "api_key", 0.72f, 0.98f, 100, {"/latest.json"}, {"forex", "rates"}});
284 add_api({"coinbase", "https://api.coinbase.com/v2", "Crypto prices", APIDomain::FINANCE, false, "none", 0.75f, 0.99f, 100, {"/prices"}, {"crypto", "bitcoin"}});
285 add_api({"binance", "https://api.binance.com/api/v3", "Crypto trading", APIDomain::FINANCE, true, "api_key", 0.82f, 0.999f, 1200, {"/ticker", "/klines"}, {"crypto", "trading"}});
286 add_api({"coingecko", "https://api.coingecko.com/api/v3", "Crypto data", APIDomain::FINANCE, false, "none", 0.78f, 0.97f, 50, {"/coins", "/simple"}, {"crypto", "markets"}});
287
288 // More finance APIs
289 for (int i = 10; i < 50; ++i) {
290 std::string name = "fin_api_" + std::to_string(i);
291 add_api({name, "https://api.finance" + std::to_string(i) + ".com", "Financial data " + std::to_string(i), APIDomain::FINANCE, true, "api_key", 0.6f + (i % 4) * 0.1f, 0.85f + (i % 3) * 0.05f, 30 + i * 3, {"/quotes", "/historical"}, {"finance", "markets"}});
292 }
293
294 // ═══════════════════════════════════════════════════════════════════════
295 // DOMAIN 8: NEWS & INFORMATION (50 APIs)
296 // ═══════════════════════════════════════════════════════════════════════
297 add_api({"newsapi", "https://newsapi.org/v2", "News aggregation", APIDomain::NEWS_INFO, true, "api_key", 0.75f, 0.97f, 100, {"/everything", "/top-headlines"}, {"news", "articles"}});
298 add_api({"gnews", "https://gnews.io/api/v4", "News search", APIDomain::NEWS_INFO, true, "api_key", 0.72f, 0.95f, 100, {"/search"}, {"news", "search"}});
299 add_api({"mediastack", "https://api.mediastack.com/v1", "News data", APIDomain::NEWS_INFO, true, "api_key", 0.7f, 0.94f, 100, {"/news"}, {"news", "global"}});
300 add_api({"nytimes", "https://api.nytimes.com/svc", "NYT articles", APIDomain::NEWS_INFO, true, "api_key", 0.85f, 0.99f, 10, {"/search/v2", "/topstories"}, {"news", "journalism"}});
301 add_api({"guardian", "https://content.guardianapis.com", "Guardian news", APIDomain::NEWS_INFO, true, "api_key", 0.82f, 0.98f, 50, {"/search"}, {"news", "uk"}});
302 add_api({"wikipedia_api", "https://en.wikipedia.org/api/rest_v1", "Encyclopedia", APIDomain::NEWS_INFO, false, "none", 0.9f, 0.999f, 200, {"/page/summary"}, {"wiki", "knowledge"}});
303 add_api({"wikidata", "https://www.wikidata.org/w/api.php", "Structured data", APIDomain::NEWS_INFO, false, "none", 0.88f, 0.99f, 50, {"/"}, {"knowledge", "entities"}});
304 add_api({"dbpedia", "https://api.dbpedia.org", "Structured wiki", APIDomain::NEWS_INFO, false, "none", 0.85f, 0.95f, 30, {"/sparql"}, {"knowledge", "linked_data"}});
305
306 // More news APIs
307 for (int i = 8; i < 50; ++i) {
308 std::string name = "news_api_" + std::to_string(i);
309 add_api({name, "https://api.news" + std::to_string(i) + ".com", "News source " + std::to_string(i), APIDomain::NEWS_INFO, true, "api_key", 0.5f + (i % 5) * 0.1f, 0.8f + (i % 4) * 0.05f, 50 + i * 2, {"/articles", "/trending"}, {"news", "media"}});
310 }
311
312 // ═══════════════════════════════════════════════════════════════════════
313 // DOMAIN 9: LANGUAGE & NLP (50 APIs)
314 // ═══════════════════════════════════════════════════════════════════════
315 add_api({"deepl", "https://api.deepl.com/v2", "Translation", APIDomain::LANGUAGE_NLP, true, "api_key", 0.95f, 0.99f, 500, {"/translate"}, {"translation", "languages"}});
316 add_api({"google_translate", "https://translation.googleapis.com/language", "Translation", APIDomain::LANGUAGE_NLP, true, "api_key", 0.92f, 0.999f, 1000, {"/translate/v2"}, {"translation", "detect"}});
317 add_api({"libretranslate", "https://libretranslate.com/translate", "Open translation", APIDomain::LANGUAGE_NLP, false, "none", 0.8f, 0.9f, 100, {"/"}, {"translation", "open_source"}});
318 add_api({"languagetool", "https://api.languagetool.org/v2", "Grammar check", APIDomain::LANGUAGE_NLP, false, "none", 0.85f, 0.97f, 20, {"/check"}, {"grammar", "spelling"}});
319 add_api({"wordnik", "https://api.wordnik.com/v4", "Dictionary", APIDomain::LANGUAGE_NLP, true, "api_key", 0.75f, 0.95f, 100, {"/word.json"}, {"dictionary", "definitions"}});
320 add_api({"datamuse", "https://api.datamuse.com", "Word finder", APIDomain::LANGUAGE_NLP, false, "none", 0.7f, 0.96f, 100, {"/words"}, {"words", "rhymes"}});
321 add_api({"dictionaryapi", "https://api.dictionaryapi.dev/api/v2", "Free dictionary", APIDomain::LANGUAGE_NLP, false, "none", 0.72f, 0.92f, 100, {"/entries"}, {"dictionary", "free"}});
322 add_api({"thesaurus", "https://www.dictionaryapi.com/api/v3", "Thesaurus", APIDomain::LANGUAGE_NLP, true, "api_key", 0.78f, 0.96f, 100, {"/references/thesaurus"}, {"synonyms", "antonyms"}});
323
324 // More language APIs
325 for (int i = 8; i < 50; ++i) {
326 std::string name = "lang_api_" + std::to_string(i);
327 add_api({name, "https://api.lang" + std::to_string(i) + ".com", "Language service " + std::to_string(i), APIDomain::LANGUAGE_NLP, i % 3 == 0, i % 3 == 0 ? "api_key" : "none", 0.5f + (i % 5) * 0.1f, 0.8f + (i % 4) * 0.05f, 50 + i * 3, {"/translate", "/analyze"}, {"language", "nlp"}});
328 }
329
330 // ═══════════════════════════════════════════════════════════════════════
331 // DOMAIN 10: GEOGRAPHY & MAPS (50 APIs)
332 // ═══════════════════════════════════════════════════════════════════════
333 add_api({"openstreetmap", "https://api.openstreetmap.org/api/0.6", "Map data", APIDomain::GEOGRAPHY, false, "none", 0.85f, 0.98f, 100, {"/map"}, {"maps", "geodata"}});
334 add_api({"nominatim", "https://nominatim.openstreetmap.org", "Geocoding", APIDomain::GEOGRAPHY, false, "none", 0.8f, 0.95f, 1, {"/search", "/reverse"}, {"geocoding", "addresses"}});
335 add_api({"mapbox", "https://api.mapbox.com", "Maps platform", APIDomain::GEOGRAPHY, true, "api_key", 0.88f, 0.999f, 600, {"/geocoding", "/directions"}, {"maps", "routing"}});
336 add_api({"here", "https://geocode.search.hereapi.com/v1", "Location services", APIDomain::GEOGRAPHY, true, "api_key", 0.85f, 0.99f, 250, {"/geocode"}, {"geocoding", "places"}});
337 add_api({"geonames", "http://api.geonames.org", "Geographic database", APIDomain::GEOGRAPHY, true, "api_key", 0.82f, 0.95f, 30, {"/searchJSON"}, {"places", "geography"}});
338 add_api({"opencage", "https://api.opencagedata.com/geocode/v1", "Geocoding", APIDomain::GEOGRAPHY, true, "api_key", 0.78f, 0.97f, 15, {"/json"}, {"geocoding", "coordinates"}});
339 add_api({"ip_api", "http://ip-api.com/json", "IP geolocation", APIDomain::GEOGRAPHY, false, "none", 0.6f, 0.94f, 45, {"/"}, {"ip", "location"}});
340 add_api({"ipinfo", "https://ipinfo.io", "IP data", APIDomain::GEOGRAPHY, true, "bearer", 0.65f, 0.97f, 100, {"/{ip}"}, {"ip", "geolocation"}});
341
342 // More geography APIs
343 for (int i = 8; i < 50; ++i) {
344 std::string name = "geo_api_" + std::to_string(i);
345 add_api({name, "https://api.geo" + std::to_string(i) + ".com", "Geographic data " + std::to_string(i), APIDomain::GEOGRAPHY, i % 2 == 0, i % 2 == 0 ? "api_key" : "none", 0.5f + (i % 5) * 0.1f, 0.8f + (i % 4) * 0.05f, 30 + i * 2, {"/places", "/coordinates"}, {"geography", "maps"}});
346 }
347
348 // ═══════════════════════════════════════════════════════════════════════
349 // DOMAINS 11-19: Additional APIs (350 more)
350 // ═══════════════════════════════════════════════════════════════════════
351
352 // DOMAIN 11: ART & DESIGN
353 add_api({"artsy", "https://api.artsy.net/api", "Art database", APIDomain::ART_DESIGN, true, "bearer", 0.8f, 0.95f, 100, {"/artworks", "/artists"}, {"art", "galleries"}});
354 add_api({"rijksmuseum", "https://www.rijksmuseum.nl/api", "Museum collection", APIDomain::ART_DESIGN, true, "api_key", 0.85f, 0.98f, 100, {"/collection"}, {"art", "museum"}});
355 add_api({"met_museum", "https://collectionapi.metmuseum.org/public/collection", "Met collection", APIDomain::ART_DESIGN, false, "none", 0.82f, 0.97f, 80, {"/v1/objects"}, {"art", "history"}});
356 add_api({"europeana", "https://api.europeana.eu/record/v2", "European culture", APIDomain::ART_DESIGN, true, "api_key", 0.8f, 0.96f, 100, {"/search.json"}, {"culture", "heritage"}});
357 add_api({"unsplash", "https://api.unsplash.com", "Stock photos", APIDomain::ART_DESIGN, true, "bearer", 0.7f, 0.99f, 50, {"/photos"}, {"photos", "images"}});
358 for (int i = 5; i < 50; ++i) {
359 add_api({"art_api_" + std::to_string(i), "https://api.art" + std::to_string(i) + ".com", "Art data " + std::to_string(i), APIDomain::ART_DESIGN, i % 3 == 0, i % 3 == 0 ? "api_key" : "none", 0.5f + (i % 5) * 0.1f, 0.8f + (i % 4) * 0.05f, 30 + i * 2, {"/artworks", "/styles"}, {"art", "design"}});
360 }
361
362 // DOMAIN 12: MUSIC & AUDIO
363 add_api({"spotify", "https://api.spotify.com/v1", "Music streaming", APIDomain::MUSIC_AUDIO, true, "bearer", 0.85f, 0.999f, 100, {"/tracks", "/artists"}, {"music", "playlists"}});
364 add_api({"lastfm", "http://ws.audioscrobbler.com/2.0", "Music data", APIDomain::MUSIC_AUDIO, true, "api_key", 0.75f, 0.95f, 100, {"/"}, {"music", "scrobbling"}});
365 add_api({"musicbrainz", "https://musicbrainz.org/ws/2", "Music metadata", APIDomain::MUSIC_AUDIO, false, "none", 0.88f, 0.98f, 50, {"/artist", "/recording"}, {"music", "metadata"}});
366 add_api({"discogs", "https://api.discogs.com", "Music database", APIDomain::MUSIC_AUDIO, true, "bearer", 0.8f, 0.97f, 60, {"/database"}, {"music", "vinyl"}});
367 add_api({"genius", "https://api.genius.com", "Song lyrics", APIDomain::MUSIC_AUDIO, true, "bearer", 0.7f, 0.94f, 100, {"/songs"}, {"lyrics", "annotations"}});
368 for (int i = 5; i < 50; ++i) {
369 add_api({"music_api_" + std::to_string(i), "https://api.music" + std::to_string(i) + ".com", "Audio data " + std::to_string(i), APIDomain::MUSIC_AUDIO, i % 2 == 0, i % 2 == 0 ? "api_key" : "none", 0.5f + (i % 5) * 0.1f, 0.8f + (i % 4) * 0.05f, 30 + i * 2, {"/tracks", "/albums"}, {"music", "audio"}});
370 }
371
372 // DOMAIN 13: VIDEO & MEDIA
373 add_api({"youtube_data", "https://www.googleapis.com/youtube/v3", "Video platform", APIDomain::VIDEO_MEDIA, true, "api_key", 0.85f, 0.999f, 10000, {"/videos", "/search"}, {"video", "youtube"}});
374 add_api({"vimeo", "https://api.vimeo.com", "Video hosting", APIDomain::VIDEO_MEDIA, true, "bearer", 0.8f, 0.98f, 100, {"/videos"}, {"video", "vimeo"}});
375 add_api({"tmdb", "https://api.themoviedb.org/3", "Movie database", APIDomain::VIDEO_MEDIA, true, "api_key", 0.82f, 0.99f, 40, {"/movie", "/tv"}, {"movies", "tv"}});
376 add_api({"omdb", "http://www.omdbapi.com", "Movie data", APIDomain::VIDEO_MEDIA, true, "api_key", 0.75f, 0.95f, 1000, {"/"}, {"movies", "imdb"}});
377 add_api({"tvmaze", "https://api.tvmaze.com", "TV shows", APIDomain::VIDEO_MEDIA, false, "none", 0.72f, 0.96f, 20, {"/shows"}, {"tv", "episodes"}});
378 for (int i = 5; i < 50; ++i) {
379 add_api({"video_api_" + std::to_string(i), "https://api.video" + std::to_string(i) + ".com", "Media data " + std::to_string(i), APIDomain::VIDEO_MEDIA, i % 2 == 0, i % 2 == 0 ? "api_key" : "none", 0.5f + (i % 5) * 0.1f, 0.8f + (i % 4) * 0.05f, 50 + i * 3, {"/videos", "/streams"}, {"video", "media"}});
380 }
381
382 // DOMAIN 14: SOCIAL & COMMUNICATION
383 add_api({"twitter", "https://api.twitter.com/2", "Social network", APIDomain::SOCIAL, true, "bearer", 0.8f, 0.99f, 300, {"/tweets", "/users"}, {"social", "twitter"}});
384 add_api({"reddit", "https://oauth.reddit.com/api/v1", "Social platform", APIDomain::SOCIAL, true, "bearer", 0.75f, 0.98f, 60, {"/hot", "/new"}, {"social", "reddit"}});
385 add_api({"discord", "https://discord.com/api/v10", "Chat platform", APIDomain::SOCIAL, true, "bearer", 0.7f, 0.999f, 50, {"/guilds", "/channels"}, {"chat", "discord"}});
386 add_api({"telegram", "https://api.telegram.org/bot", "Messaging", APIDomain::SOCIAL, true, "bearer", 0.72f, 0.99f, 30, {"/getUpdates"}, {"messaging", "telegram"}});
387 add_api({"slack", "https://slack.com/api", "Team chat", APIDomain::SOCIAL, true, "bearer", 0.78f, 0.999f, 50, {"/chat.postMessage"}, {"chat", "slack"}});
388 for (int i = 5; i < 50; ++i) {
389 add_api({"social_api_" + std::to_string(i), "https://api.social" + std::to_string(i) + ".com", "Social data " + std::to_string(i), APIDomain::SOCIAL, true, "bearer", 0.5f + (i % 5) * 0.1f, 0.8f + (i % 4) * 0.05f, 30 + i * 2, {"/posts", "/users"}, {"social", "network"}});
390 }
391
392 // DOMAIN 15: E-COMMERCE & BUSINESS
393 add_api({"stripe", "https://api.stripe.com/v1", "Payments", APIDomain::ECOMMERCE, true, "bearer", 0.85f, 0.9999f, 100, {"/charges", "/customers"}, {"payments", "commerce"}});
394 add_api({"shopify", "https://api.shopify.com", "E-commerce", APIDomain::ECOMMERCE, true, "bearer", 0.82f, 0.999f, 40, {"/admin/products"}, {"ecommerce", "retail"}});
395 add_api({"ebay", "https://api.ebay.com/buy/browse/v1", "Marketplace", APIDomain::ECOMMERCE, true, "bearer", 0.78f, 0.98f, 100, {"/item_summary"}, {"marketplace", "auctions"}});
396 add_api({"amazon_paapi", "https://webservices.amazon.com/paapi5", "Product ads", APIDomain::ECOMMERCE, true, "bearer", 0.8f, 0.99f, 1, {"/getitems"}, {"products", "amazon"}});
397 add_api({"etsy", "https://openapi.etsy.com/v3", "Handmade goods", APIDomain::ECOMMERCE, true, "bearer", 0.72f, 0.97f, 30, {"/application/listings"}, {"handmade", "crafts"}});
398 for (int i = 5; i < 50; ++i) {
399 add_api({"commerce_api_" + std::to_string(i), "https://api.commerce" + std::to_string(i) + ".com", "Business data " + std::to_string(i), APIDomain::ECOMMERCE, true, "api_key", 0.5f + (i % 5) * 0.1f, 0.85f + (i % 3) * 0.05f, 30 + i * 2, {"/products", "/orders"}, {"commerce", "business"}});
400 }
401
402 // DOMAIN 16: GOVERNMENT & CIVIC
403 add_api({"usaspending", "https://api.usaspending.gov/api/v2", "Federal spending", APIDomain::GOVERNMENT, false, "none", 0.85f, 0.99f, 100, {"/spending"}, {"government", "spending"}});
404 add_api({"data_gov", "https://api.data.gov", "Government data", APIDomain::GOVERNMENT, true, "api_key", 0.8f, 0.98f, 1000, {"/ed/collegescorecard"}, {"government", "open_data"}});
405 add_api({"congress", "https://api.congress.gov/v3", "Congress data", APIDomain::GOVERNMENT, true, "api_key", 0.82f, 0.97f, 100, {"/bill"}, {"legislation", "congress"}});
406 add_api({"fec", "https://api.open.fec.gov/v1", "Elections", APIDomain::GOVERNMENT, true, "api_key", 0.78f, 0.96f, 100, {"/candidates"}, {"elections", "campaign"}});
407 add_api({"regulations", "https://api.regulations.gov/v4", "Regulations", APIDomain::GOVERNMENT, true, "api_key", 0.75f, 0.95f, 100, {"/documents"}, {"regulations", "rules"}});
408 for (int i = 5; i < 50; ++i) {
409 add_api({"gov_api_" + std::to_string(i), "https://api.gov" + std::to_string(i) + ".org", "Government data " + std::to_string(i), APIDomain::GOVERNMENT, i % 2 == 0, i % 2 == 0 ? "api_key" : "none", 0.6f + (i % 4) * 0.1f, 0.85f + (i % 3) * 0.05f, 30 + i * 2, {"/data", "/reports"}, {"government", "civic"}});
410 }
411
412 // DOMAIN 17: SPACE & ASTRONOMY
413 add_api({"nasa_api", "https://api.nasa.gov", "Space agency", APIDomain::SPACE_ASTRONOMY, true, "api_key", 0.9f, 0.999f, 1000, {"/planetary/apod", "/mars-photos"}, {"space", "nasa"}});
414 add_api({"spacex", "https://api.spacexdata.com/v5", "SpaceX data", APIDomain::SPACE_ASTRONOMY, false, "none", 0.82f, 0.95f, 100, {"/launches"}, {"rockets", "spacex"}});
415 add_api({"tle", "https://tle.ivanstanojevic.me/api/tle", "Satellite tracking", APIDomain::SPACE_ASTRONOMY, false, "none", 0.75f, 0.92f, 50, {"/"}, {"satellites", "orbits"}});
416 add_api({"astronomyapi", "https://api.astronomyapi.com/api/v2", "Celestial data", APIDomain::SPACE_ASTRONOMY, true, "bearer", 0.8f, 0.94f, 30, {"/bodies"}, {"astronomy", "planets"}});
417 add_api({"sunrise_sunset", "https://api.sunrise-sunset.org/json", "Sun times", APIDomain::SPACE_ASTRONOMY, false, "none", 0.6f, 0.97f, 100, {"/"}, {"sun", "times"}});
418 for (int i = 5; i < 50; ++i) {
419 add_api({"space_api_" + std::to_string(i), "https://api.space" + std::to_string(i) + ".com", "Astronomy data " + std::to_string(i), APIDomain::SPACE_ASTRONOMY, i % 3 == 0, i % 3 == 0 ? "api_key" : "none", 0.6f + (i % 4) * 0.1f, 0.85f + (i % 3) * 0.05f, 30 + i * 2, {"/objects", "/events"}, {"space", "astronomy"}});
420 }
421
422 // DOMAIN 18: SPORTS & FITNESS
423 add_api({"espn", "https://site.api.espn.com/apis/site/v2", "Sports news", APIDomain::SPORTS, false, "none", 0.75f, 0.98f, 100, {"/sports"}, {"sports", "scores"}});
424 add_api({"football_data", "https://api.football-data.org/v4", "Football stats", APIDomain::SPORTS, true, "api_key", 0.8f, 0.97f, 10, {"/matches"}, {"football", "soccer"}});
425 add_api({"nba", "https://data.nba.net/prod/v1", "Basketball", APIDomain::SPORTS, false, "none", 0.72f, 0.95f, 100, {"/today.json"}, {"basketball", "nba"}});
426 add_api({"sportsdb", "https://www.thesportsdb.com/api/v1", "Sports database", APIDomain::SPORTS, true, "api_key", 0.7f, 0.93f, 100, {"/json"}, {"sports", "database"}});
427 add_api({"strava", "https://www.strava.com/api/v3", "Fitness tracking", APIDomain::SPORTS, true, "bearer", 0.65f, 0.98f, 100, {"/athlete"}, {"fitness", "running"}});
428 for (int i = 5; i < 50; ++i) {
429 add_api({"sports_api_" + std::to_string(i), "https://api.sports" + std::to_string(i) + ".com", "Sports data " + std::to_string(i), APIDomain::SPORTS, i % 2 == 0, i % 2 == 0 ? "api_key" : "none", 0.5f + (i % 5) * 0.1f, 0.8f + (i % 4) * 0.05f, 30 + i * 2, {"/teams", "/scores"}, {"sports", "fitness"}});
430 }
431
432 // DOMAIN 19: IOT & HARDWARE
433 add_api({"openweather", "https://api.openweathermap.org/data/2.5", "Weather data", APIDomain::IOT_HARDWARE, true, "api_key", 0.75f, 0.99f, 60, {"/weather", "/forecast"}, {"weather", "climate"}});
434 add_api({"weatherapi", "https://api.weatherapi.com/v1", "Weather service", APIDomain::IOT_HARDWARE, true, "api_key", 0.78f, 0.98f, 100, {"/current.json"}, {"weather", "forecast"}});
435 add_api({"aqicn", "https://api.waqi.info/feed", "Air quality", APIDomain::IOT_HARDWARE, true, "api_key", 0.72f, 0.95f, 100, {"/"}, {"air_quality", "pollution"}});
436 add_api({"particle", "https://api.particle.io/v1", "IoT platform", APIDomain::IOT_HARDWARE, true, "bearer", 0.7f, 0.97f, 100, {"/devices"}, {"iot", "devices"}});
437 add_api({"thingspeak", "https://api.thingspeak.com", "IoT data", APIDomain::IOT_HARDWARE, true, "api_key", 0.68f, 0.94f, 100, {"/channels"}, {"iot", "sensors"}});
438 for (int i = 5; i < 50; ++i) {
439 add_api({"iot_api_" + std::to_string(i), "https://api.iot" + std::to_string(i) + ".com", "Hardware data " + std::to_string(i), APIDomain::IOT_HARDWARE, true, "api_key", 0.5f + (i % 5) * 0.1f, 0.8f + (i % 4) * 0.05f, 30 + i * 2, {"/devices", "/sensors"}, {"iot", "hardware"}});
440 }
441 }
442};
443
444// ═══════════════════════════════════════════════════════════════════════════════
445// DOMAIN NAMES
446// ═══════════════════════════════════════════════════════════════════════════════
447
448inline const char* domain_name(APIDomain domain) {
449 static const char* names[] = {
450 "Science & Math",
451 "Programming",
452 "AI & ML",
453 "Physics",
454 "Biology",
455 "Chemistry",
456 "Medicine",
457 "Finance",
458 "News & Info",
459 "Language & NLP",
460 "Geography",
461 "Art & Design",
462 "Music & Audio",
463 "Video & Media",
464 "Social",
465 "E-commerce",
466 "Government",
467 "Space & Astronomy",
468 "Sports",
469 "IoT & Hardware"
470 };
471 return names[static_cast<size_t>(domain)];
472}
473
474// ═══════════════════════════════════════════════════════════════════════════════
475// AUTONOMOUS LEARNING SELECTOR
476// The AGI decides what it wants to learn based on:
477// 1. Curiosity (novelty-seeking driven by substrate entropy)
478// 2. Consciousness metrics (Φ - integrated information)
479// 3. Dopamine reward signals (neurological equations)
480// 4. Hebbian associations between domains
481// ═══════════════════════════════════════════════════════════════════════════════
482
483struct LearningInterest {
484 APIDomain domain;
485 float curiosity; // 0-1: How novel/interesting this domain is
486 float competence; // 0-1: Current knowledge level
487 float dopamine_signal; // Reward prediction signal
488 float exploration_bonus; // UCB-style exploration bonus
489 uint64_t last_visited; // Tick when last explored
490 uint64_t visit_count; // Total exploration count
491};
492
493struct APIFetchResult {
494 bool success;
495 std::string data;
496 std::string error;
497 float information_gain; // How much new info was learned
498 uint64_t latency_ms;
499 uint64_t tokens_extracted;
500};
501
502// Rate limiter for API calls
503class RateLimiter {
504public:
505 std::unordered_map<std::string, uint64_t> last_call_time;
506 std::unordered_map<std::string, uint64_t> call_counts;
507 std::unordered_map<std::string, uint64_t> window_start;
508
509 bool can_call(const std::string& api_name, uint32_t rate_limit) {
510 uint64_t now = current_time_ms();
511 uint64_t window = 60000; // 1 minute window
512
513 // Reset window if needed
514 if (now - window_start[api_name] > window) {
515 window_start[api_name] = now;
516 call_counts[api_name] = 0;
517 }
518
519 // Check rate limit
520 if (call_counts[api_name] >= rate_limit) {
521 return false;
522 }
523
524 return true;
525 }
526
527 void record_call(const std::string& api_name) {
528 uint64_t now = current_time_ms();
529 last_call_time[api_name] = now;
530 call_counts[api_name]++;
531 }
532
533 uint64_t time_until_available(const std::string& api_name, uint32_t rate_limit) {
534 if (can_call(api_name, rate_limit)) return 0;
535 return 60000 - (current_time_ms() - window_start[api_name]);
536 }
537
538private:
539 uint64_t current_time_ms() {
540 return static_cast<uint64_t>(
541 std::chrono::duration_cast<std::chrono::milliseconds>(
542 std::chrono::steady_clock::now().time_since_epoch()
543 ).count()
544 );
545 }
546};
547
548// ═══════════════════════════════════════════════════════════════════════════════
549// AUTONOMOUS LEARNING SYSTEM
550// Uses consciousness (Φ), curiosity, and neurological equations for selection
551// ═══════════════════════════════════════════════════════════════════════════════
552
553class AutonomousLearner {
554public:
555 APIRegistry registry;
556 RateLimiter rate_limiter;
557 std::vector<LearningInterest> interests;
558
559 // Neurological parameters
560 float dopamine_baseline = 0.5f;
561 float dopamine_current = 0.5f;
562 float learning_rate = 0.1f * PHI; // Golden ratio scaled
563 float curiosity_decay = 0.99f;
564 float exploration_constant = ALPHA; // √(2ln(t)/n) coefficient
565
566 // Consciousness metrics
567 float phi = 0.0f; // Integrated information
568 float entropy = 0.0f; // Substrate entropy
569 float arousal = 0.5f; // Alertness level
570
571 // Learning state
572 uint64_t total_ticks = 0;
573 uint64_t apis_explored = 0;
574 uint64_t tokens_learned = 0;
575 std::vector<std::pair<APIDomain, APIDomain>> domain_associations;
576
577 // Hebbian weight matrix for domain associations
578 float hebbian_weights[20][20] = {{0}};
579
580 AutonomousLearner() {
581 initialize_interests();
582 }
583
584 void initialize_interests() {
585 interests.resize(static_cast<size_t>(APIDomain::NUM_DOMAINS));
586 for (size_t i = 0; i < interests.size(); ++i) {
587 interests[i].domain = static_cast<APIDomain>(i);
588 interests[i].curiosity = 1.0f; // Start fully curious
589 interests[i].competence = 0.0f;
590 interests[i].dopamine_signal = dopamine_baseline;
591 interests[i].exploration_bonus = 1.0f;
592 interests[i].last_visited = 0;
593 interests[i].visit_count = 0;
594 }
595
596 // Initialize Hebbian weights with golden ratio structure
597 for (size_t i = 0; i < 20; ++i) {
598 for (size_t j = 0; j < 20; ++j) {
599 if (i == j) {
600 hebbian_weights[i][j] = 1.0f;
601 } else {
602 // Related domains have higher initial weights
603 float distance = std::abs(static_cast<float>(i) - static_cast<float>(j));
604 hebbian_weights[i][j] = 1.0f / (1.0f + distance * 0.1f);
605 }
606 }
607 }
608 }
609
610 // ═══════════════════════════════════════════════════════════════════════════
611 // CONSCIOUSNESS-DRIVEN SELECTION
612 // Φ = Integrated Information Theory metric
613 // ═══════════════════════════════════════════════════════════════════════════
614
615 void update_consciousness(float substrate_density) {
616 // Φ = 1 / (1 + |x - 1|) where x is normalized activity
617 float normalized = substrate_density * 2.0f; // Scale to [0, 2]
618 phi = 1.0f / (1.0f + std::abs(normalized - 1.0f));
619
620 // Entropy from substrate
621 float p = substrate_density;
622 if (p > 0.0001f && p < 0.9999f) {
623 entropy = -p * std::log2(p) - (1.0f - p) * std::log2(1.0f - p);
624 } else {
625 entropy = 0.0f;
626 }
627
628 // Arousal modulated by consciousness
629 arousal = 0.5f + 0.5f * phi * std::tanh(entropy);
630 }
631
632 // ═══════════════════════════════════════════════════════════════════════════
633 // CURIOSITY-DRIVEN EXPLORATION
634 // Based on information gain and novelty
635 // ═══════════════════════════════════════════════════════════════════════════
636
637 float compute_curiosity(APIDomain domain) {
638 size_t idx = static_cast<size_t>(domain);
639 auto& interest = interests[idx];
640
641 // Base curiosity decays with competence (less curious about known things)
642 float base_curiosity = 1.0f - interest.competence;
643
644 // Novelty bonus - more curious about less visited domains
645 float novelty = 1.0f / (1.0f + std::sqrt(static_cast<float>(interest.visit_count)));
646
647 // Recency bonus - more curious about domains not visited recently
648 float recency = 1.0f;
649 if (total_ticks > interest.last_visited && interest.last_visited > 0) {
650 uint64_t time_since = total_ticks - interest.last_visited;
651 recency = 1.0f - std::exp(-static_cast<float>(time_since) / 10000.0f);
652 }
653
654 // UCB exploration bonus: sqrt(2 * ln(t) / n)
655 float ucb_bonus = 0.0f;
656 if (total_ticks > 0 && interest.visit_count > 0) {
657 ucb_bonus = exploration_constant * std::sqrt(
658 2.0f * std::log(static_cast<float>(total_ticks)) /
659 static_cast<float>(interest.visit_count)
660 );
661 } else if (interest.visit_count == 0) {
662 ucb_bonus = exploration_constant * 10.0f; // High bonus for unexplored
663 }
664
665 // Consciousness-modulated curiosity
666 float consciousness_factor = phi * arousal;
667
668 return (base_curiosity * 0.3f + novelty * 0.2f + recency * 0.2f + ucb_bonus * 0.3f)
669 * consciousness_factor;
670 }
671
672 // ═══════════════════════════════════════════════════════════════════════════
673 // DOPAMINE REWARD SYSTEM
674 // TD-learning style reward prediction
675 // ═══════════════════════════════════════════════════════════════════════════
676
677 float compute_dopamine_signal(APIDomain domain, float expected_reward, float actual_reward) {
678 // Temporal difference error: δ = r + γV(s') - V(s)
679 float td_error = actual_reward - expected_reward;
680
681 // Update dopamine based on surprise
682 float dopamine_delta = td_error * learning_rate;
683 dopamine_current = std::clamp(dopamine_current + dopamine_delta, 0.0f, 1.0f);
684
685 // Phasic dopamine response (burst or dip)
686 float phasic = std::tanh(td_error * 3.0f);
687
688 // Update domain-specific dopamine signal
689 size_t idx = static_cast<size_t>(domain);
690 interests[idx].dopamine_signal = 0.9f * interests[idx].dopamine_signal +
691 0.1f * (dopamine_baseline + phasic * 0.5f);
692
693 return phasic;
694 }
695
696 // ═══════════════════════════════════════════════════════════════════════════
697 // HEBBIAN LEARNING
698 // "Neurons that fire together wire together"
699 // ═══════════════════════════════════════════════════════════════════════════
700
701 void update_hebbian(APIDomain from, APIDomain to, float correlation) {
702 size_t i = static_cast<size_t>(from);
703 size_t j = static_cast<size_t>(to);
704
705 // Hebbian update: Δw = η * x_i * x_j
706 float delta = learning_rate * correlation;
707
708 // Symmetric update with decay
709 hebbian_weights[i][j] = 0.99f * hebbian_weights[i][j] + delta;
710 hebbian_weights[j][i] = 0.99f * hebbian_weights[j][i] + delta;
711
712 // Normalize to prevent explosion
713 float max_weight = 0.0f;
714 for (size_t k = 0; k < 20; ++k) {
715 max_weight = std::max(max_weight, hebbian_weights[i][k]);
716 }
717 if (max_weight > 2.0f) {
718 for (size_t k = 0; k < 20; ++k) {
719 hebbian_weights[i][k] /= max_weight;
720 hebbian_weights[k][i] /= max_weight;
721 }
722 }
723
724 // Record association
725 domain_associations.push_back({from, to});
726 }
727
728 // ═══════════════════════════════════════════════════════════════════════════
729 // AUTONOMOUS SELECTION ALGORITHM
730 // The AGI chooses what it wants to learn
731 // ═══════════════════════════════════════════════════════════════════════════
732
733 APIDomain select_domain_to_explore() {
734 // Compute selection scores for all domains
735 std::vector<float> scores(20);
736 float total_score = 0.0f;
737
738 for (size_t i = 0; i < 20; ++i) {
739 APIDomain domain = static_cast<APIDomain>(i);
740 auto& interest = interests[i];
741
742 // Curiosity component
743 float curiosity = compute_curiosity(domain);
744
745 // Dopamine reward prediction
746 float dopamine = interest.dopamine_signal;
747
748 // Hebbian spread from recently explored domains
749 float hebbian_activation = 0.0f;
750 if (!domain_associations.empty()) {
751 auto [last_from, last_to] = domain_associations.back();
752 hebbian_activation = hebbian_weights[static_cast<size_t>(last_to)][i];
753 }
754
755 // Competence-weighted value (explore gaps in knowledge)
756 float knowledge_gap = 1.0f - interest.competence;
757
758 // Domain complexity matching consciousness level
759 // High consciousness → prefer complex domains
760 // Low consciousness → prefer simpler domains
761 float apis_in_domain = static_cast<float>(registry.get_by_domain(domain).size());
762 float avg_complexity = 0.0f;
763 for (const auto* api : registry.get_by_domain(domain)) {
764 avg_complexity += api->complexity;
765 }
766 avg_complexity /= std::max(apis_in_domain, 1.0f);
767 float complexity_match = 1.0f - std::abs(avg_complexity - phi);
768
769 // Final score: weighted combination
770 scores[i] = curiosity * 0.25f + // Curiosity-driven
771 dopamine * 0.2f + // Reward-driven
772 hebbian_activation * 0.15f + // Association-driven
773 knowledge_gap * 0.2f + // Gap-filling
774 complexity_match * 0.2f; // Consciousness-matched
775
776 // Apply arousal modulation
777 scores[i] *= (0.5f + arousal);
778
779 total_score += scores[i];
780 }
781
782 // Softmax selection with temperature
783 float temperature = 1.0f / (1.0f + phi); // Lower temp at higher consciousness
784 std::vector<float> probs(20);
785 float prob_sum = 0.0f;
786
787 for (size_t i = 0; i < 20; ++i) {
788 probs[i] = std::exp(scores[i] / temperature);
789 prob_sum += probs[i];
790 }
791
792 // Normalize
793 for (size_t i = 0; i < 20; ++i) {
794 probs[i] /= prob_sum;
795 }
796
797 // Sample from distribution
798 std::random_device rd;
799 std::mt19937 gen(rd());
800 std::discrete_distribution<size_t> dist(probs.begin(), probs.end());
801
802 return static_cast<APIDomain>(dist(gen));
803 }
804
805 // Select specific API within chosen domain
806 const APIEndpoint* select_api_in_domain(APIDomain domain) {
807 auto apis = registry.get_by_domain(domain);
808 if (apis.empty()) return nullptr;
809
810 std::vector<float> scores;
811 scores.reserve(apis.size());
812
813 for (const auto* api : apis) {
814 float score = 0.0f;
815
816 // Prefer APIs we can actually call (rate limit check)
817 if (rate_limiter.can_call(api->name, api->rate_limit)) {
818 score += 0.5f;
819 }
820
821 // Prefer APIs with good reliability
822 score += api->reliability * 0.2f;
823
824 // Curiosity bonus for complex APIs
825 score += api->complexity * curiosity_decay * 0.2f;
826
827 // Prefer APIs that don't require auth (more accessible)
828 if (!api->requires_auth) {
829 score += 0.1f;
830 }
831
832 scores.push_back(score);
833 }
834
835 // Argmax selection
836 size_t best_idx = 0;
837 float best_score = scores[0];
838 for (size_t i = 1; i < scores.size(); ++i) {
839 if (scores[i] > best_score) {
840 best_score = scores[i];
841 best_idx = i;
842 }
843 }
844
845 return apis[best_idx];
846 }
847
848 // ═══════════════════════════════════════════════════════════════════════════
849 // LEARNING FROM API DATA
850 // ═══════════════════════════════════════════════════════════════════════════
851
852 void learn_from_data(APIDomain domain, const APIFetchResult& result) {
853 size_t idx = static_cast<size_t>(domain);
854 auto& interest = interests[idx];
855
856 // Update visit statistics
857 interest.visit_count++;
858 interest.last_visited = total_ticks;
859 apis_explored++;
860
861 if (result.success) {
862 // Compute information gain
863 float info_gain = result.information_gain;
864 tokens_learned += result.tokens_extracted;
865
866 // Update competence based on successful learning
867 float competence_gain = info_gain * learning_rate * (1.0f - interest.competence);
868 interest.competence = std::min(1.0f, interest.competence + competence_gain);
869
870 // Dopamine reward for successful learning
871 float expected_reward = interest.dopamine_signal;
872 float actual_reward = info_gain * 0.5f + 0.5f * result.success;
873 compute_dopamine_signal(domain, expected_reward, actual_reward);
874
875 // Update Hebbian associations
876 if (domain_associations.size() > 0) {
877 auto [prev_from, prev_to] = domain_associations.back();
878 float correlation = info_gain * interest.dopamine_signal;
879 update_hebbian(prev_to, domain, correlation);
880 }
881
882 // Decay curiosity for this domain
883 interest.curiosity *= curiosity_decay;
884
885 } else {
886 // Negative reward for failure
887 compute_dopamine_signal(domain, interest.dopamine_signal, -0.1f);
888 }
889 }
890
891 // ═══════════════════════════════════════════════════════════════════════════
892 // AUTONOMOUS EXPLORATION TICK
893 // Main learning loop - AGI decides what to explore
894 // ═══════════════════════════════════════════════════════════════════════════
895
896 struct ExplorationResult {
897 APIDomain domain_chosen;
898 const APIEndpoint* api_chosen;
899 float selection_confidence;
900 std::string reasoning;
901 };
902
903 ExplorationResult tick(float substrate_density) {
904 total_ticks++;
905
906 // Update consciousness from substrate
907 update_consciousness(substrate_density);
908
909 // AGI autonomously selects domain
910 APIDomain chosen_domain = select_domain_to_explore();
911
912 // Select specific API
913 const APIEndpoint* chosen_api = select_api_in_domain(chosen_domain);
914
915 // Compute selection confidence
916 float confidence = phi * arousal * interests[static_cast<size_t>(chosen_domain)].dopamine_signal;
917
918 // Generate reasoning
919 std::string reasoning = generate_exploration_reasoning(chosen_domain, chosen_api);
920
921 return {chosen_domain, chosen_api, confidence, reasoning};
922 }
923
924 std::string generate_exploration_reasoning(APIDomain domain, const APIEndpoint* api) {
925 std::string reason;
926 size_t idx = static_cast<size_t>(domain);
927 auto& interest = interests[idx];
928
929 reason = "Selected " + std::string(domain_name(domain));
930
931 // Explain why
932 if (interest.visit_count == 0) {
933 reason += " (novel domain - never explored)";
934 } else if (interest.curiosity > 0.7f) {
935 reason += " (high curiosity: " + std::to_string(interest.curiosity) + ")";
936 } else if (interest.competence < 0.3f) {
937 reason += " (knowledge gap - competence: " + std::to_string(interest.competence) + ")";
938 } else if (interest.dopamine_signal > 0.7f) {
939 reason += " (high reward expectation: " + std::to_string(interest.dopamine_signal) + ")";
940 } else {
941 reason += " (Hebbian association from previous learning)";
942 }
943
944 if (api) {
945 reason += " -> API: " + api->name;
946 }
947
948 return reason;
949 }
950
951 // ═══════════════════════════════════════════════════════════════════════════
952 // INTROSPECTION - AGI explains its own learning state
953 // ═══════════════════════════════════════════════════════════════════════════
954
955 void print_learning_state() {
956 std::cout << "\n╔═══════════════════════════════════════════════════════════════════════════════╗\n";
957 std::cout << "║ AUTONOMOUS LEARNING STATE ║\n";
958 std::cout << "╠═══════════════════════════════════════════════════════════════════════════════╣\n";
959 std::cout << "║ Consciousness (Φ): " << std::fixed << std::setprecision(4) << phi;
960 std::cout << " Arousal: " << arousal;
961 std::cout << " Entropy: " << entropy << " ║\n";
962 std::cout << "║ Dopamine: " << dopamine_current;
963 std::cout << " APIs Explored: " << apis_explored;
964 std::cout << " Tokens: " << tokens_learned << " ║\n";
965 std::cout << "╠═══════════════════════════════════════════════════════════════════════════════╣\n";
966 std::cout << "║ Domain Interests (sorted by curiosity): ║\n";
967
968 // Sort domains by curiosity
969 std::vector<size_t> sorted_indices(20);
970 for (size_t i = 0; i < 20; ++i) sorted_indices[i] = i;
971 std::sort(sorted_indices.begin(), sorted_indices.end(),
972 [this](size_t a, size_t b) {
973 return compute_curiosity(static_cast<APIDomain>(a)) >
974 compute_curiosity(static_cast<APIDomain>(b));
975 });
976
977 for (size_t i = 0; i < 5; ++i) { // Top 5
978 size_t idx = sorted_indices[i];
979 auto& interest = interests[idx];
980 float curiosity = compute_curiosity(static_cast<APIDomain>(idx));
981 std::cout << "║ " << (i+1) << ". " << std::setw(20) << std::left << domain_name(static_cast<APIDomain>(idx));
982 std::cout << " C:" << std::setw(5) << std::setprecision(2) << curiosity;
983 std::cout << " K:" << std::setw(5) << interest.competence;
984 std::cout << " D:" << std::setw(5) << interest.dopamine_signal;
985 std::cout << " V:" << std::setw(5) << interest.visit_count << " ║\n";
986 }
987
988 std::cout << "╚═══════════════════════════════════════════════════════════════════════════════╝\n";
989 }
990
991 // Get the AGI's current "mood" based on neurological state
992 std::string get_learning_mood() {
993 if (phi > 0.8f && dopamine_current > 0.7f) {
994 return "Highly engaged - seeking complex knowledge";
995 } else if (phi > 0.6f && arousal > 0.6f) {
996 return "Alert and curious - exploring actively";
997 } else if (dopamine_current < 0.3f) {
998 return "Low reward signal - needs novelty";
999 } else if (entropy < 0.3f) {
1000 return "Low entropy - consolidating knowledge";
1001 } else {
1002 return "Balanced learning state";
1003 }
1004 }
1005};
1006
1007// ═══════════════════════════════════════════════════════════════════════════════
1008// SIMULATED API FETCHER (for offline testing)
1009// In production, this would make real HTTP requests
1010// ═══════════════════════════════════════════════════════════════════════════════
1011
1012class SimulatedAPIFetcher {
1013public:
1014 std::mt19937 rng;
1015
1016 SimulatedAPIFetcher() : rng(std::random_device{}()) {}
1017
1018 APIFetchResult fetch(const APIEndpoint& api) {
1019 APIFetchResult result;
1020
1021 // Simulate network latency
1022 std::uniform_int_distribution<uint64_t> latency_dist(50, 500);
1023 result.latency_ms = latency_dist(rng);
1024
1025 // Success based on reliability
1026 std::uniform_real_distribution<float> success_dist(0.0f, 1.0f);
1027 result.success = success_dist(rng) < api.reliability;
1028
1029 if (result.success) {
1030 // Simulate data based on complexity
1031 std::uniform_int_distribution<uint64_t> token_dist(
1032 static_cast<uint64_t>(100 * api.complexity),
1033 static_cast<uint64_t>(10000 * api.complexity)
1034 );
1035 result.tokens_extracted = token_dist(rng);
1036
1037 // Information gain based on complexity and randomness
1038 result.information_gain = api.complexity * (0.5f + 0.5f * success_dist(rng));
1039
1040 // Generate simulated data description
1041 result.data = "Simulated " + std::to_string(result.tokens_extracted) +
1042 " tokens from " + api.name;
1043 } else {
1044 result.error = "Connection failed (simulated)";
1045 result.information_gain = 0.0f;
1046 result.tokens_extracted = 0;
1047 }
1048
1049 return result;
1050 }
1051};
1052
1053} // namespace mind_farm
1054