diff --git a/scripts/build_tools/interfaces.ts b/scripts/build_tools/interfaces.ts index df6e0043..0c28a515 100644 --- a/scripts/build_tools/interfaces.ts +++ b/scripts/build_tools/interfaces.ts @@ -41,6 +41,9 @@ export interface Metadata { query: string; }[]; oauth: Record[] | null; + runner: string; + operating_system: string[]; + tool_set: string; } export interface StoreMetadata { diff --git a/scripts/build_tools/save_tools.ts b/scripts/build_tools/save_tools.ts index ac4a8083..30de00a0 100644 --- a/scripts/build_tools/save_tools.ts +++ b/scripts/build_tools/save_tools.ts @@ -63,7 +63,10 @@ async function buildToolJson( sql_tables: metadata.sqlTables, tools: metadata.tools, version: metadata.version, - [toolType === "Python" ? "py_code" : "js_code"]: toolContent + [toolType === "Python" ? "py_code" : "js_code"]: toolContent, + runner: metadata.runner, + operating_system: metadata.operating_system, + tool_set: metadata.tool_set, }, false ], @@ -273,6 +276,8 @@ export async function saveToolsInNode(toolsOriginal: DirectoryEntry[]): Promise< const tools: DirectoryEntry[] = JSON.parse(JSON.stringify(toolsOriginal)); const toolsSaved: DirectoryEntry[] = []; for (const tool of tools) { + // Wait 250ms between tool uploads + await new Promise(resolve => setTimeout(resolve, 250)); // Read files const metadata: Metadata = JSON.parse(await Deno.readTextFile(join(tool.dir, "metadata.json"))); diff --git a/tools/article-scraper/.tool-dump.test.json b/tools/article-scraper/.tool-dump.test.json new file mode 100644 index 00000000..1bef6a72 --- /dev/null +++ b/tools/article-scraper/.tool-dump.test.json @@ -0,0 +1 @@ +{"type":"Python","content":[{"version":"1.0.0","name":"Article Scraper","homepage":null,"author":"@@official.shinkai","py_code":"# /// script\n# dependencies = [\n# \"requests\",\n# \"beautifulsoup4\",\n# \"lxml\"\n# ]\n# ///\n\nimport requests\nfrom bs4 import BeautifulSoup\nfrom typing import List, Optional, Dict, Any\nimport datetime\n\nclass CONFIG:\n \"\"\"\n This class holds the tool's configuration, such as\n default language or advanced flags.\n \"\"\"\n default_language: str = \"en\"\n\nclass INPUTS:\n \"\"\"\n This class holds the user-provided inputs.\n \"\"\"\n url: str\n html: Optional[str] = None\n language: Optional[str] = None\n\nclass OUTPUT:\n \"\"\"\n This class represents the result structure to be returned.\n \"\"\"\n title: str\n authors: List[str]\n publish_date: str\n summary: str\n keywords: List[str]\n top_image: str\n text: str\n\ndef extract_text_content(soup: BeautifulSoup) -> str:\n \"\"\"Extract main text content from the article.\"\"\"\n # Remove script and style elements\n for script in soup([\"script\", \"style\"]):\n script.decompose()\n \n # Get text\n text = soup.get_text(separator='\\n', strip=True)\n return text\n\ndef extract_metadata(soup: BeautifulSoup) -> Dict[str, Any]:\n \"\"\"Extract metadata from meta tags.\"\"\"\n metadata = {\n \"title\": \"\",\n \"authors\": [],\n \"publish_date\": \"\",\n \"keywords\": [],\n \"top_image\": \"\"\n }\n \n # Try to get title\n title_tag = soup.find('title')\n if title_tag:\n metadata[\"title\"] = title_tag.string.strip()\n \n # Try meta tags\n meta_mappings = {\n \"author\": [\"author\", \"article:author\", \"og:article:author\"],\n \"publish_date\": [\"article:published_time\", \"publishdate\", \"date\", \"published_time\"],\n \"image\": [\"og:image\", \"twitter:image\"],\n \"keywords\": [\"keywords\", \"news_keywords\"]\n }\n \n for meta in soup.find_all('meta'):\n name = meta.get('name', '').lower()\n property = meta.get('property', '').lower()\n content = meta.get('content', '')\n \n if not content:\n continue\n \n # Authors\n if name in meta_mappings[\"author\"] or property in meta_mappings[\"author\"]:\n if content not in metadata[\"authors\"]:\n metadata[\"authors\"].append(content)\n \n # Publish date\n elif name in meta_mappings[\"publish_date\"] or property in meta_mappings[\"publish_date\"]:\n metadata[\"publish_date\"] = content\n \n # Image\n elif name in meta_mappings[\"image\"] or property in meta_mappings[\"image\"]:\n if not metadata[\"top_image\"]:\n metadata[\"top_image\"] = content\n \n # Keywords\n elif name in meta_mappings[\"keywords\"] or property in meta_mappings[\"keywords\"]:\n keywords = [k.strip() for k in content.split(',')]\n metadata[\"keywords\"].extend(keywords)\n \n return metadata\n\nasync def run(c: CONFIG, p: INPUTS) -> Dict[str, Any]:\n \"\"\"\n The main run function that processes the article.\n \"\"\"\n if p.html:\n html_content = p.html\n else:\n # Fetch the URL\n headers = {\n 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36'\n }\n response = requests.get(p.url, headers=headers)\n response.raise_for_status()\n html_content = response.text\n\n # Parse HTML\n soup = BeautifulSoup(html_content, 'lxml')\n \n # Extract metadata\n metadata = extract_metadata(soup)\n \n # Extract text content\n text_content = extract_text_content(soup)\n \n # Create summary (first 500 characters of text)\n summary = text_content[:500].strip()\n \n result = {\n \"title\": metadata[\"title\"],\n \"authors\": metadata[\"authors\"],\n \"publish_date\": metadata[\"publish_date\"],\n \"summary\": summary,\n \"keywords\": metadata[\"keywords\"],\n \"top_image\": metadata[\"top_image\"],\n \"text\": text_content\n }\n \n return result ","tools":[],"config":[{"BasicConfig":{"key_name":"default_language","description":"The default language to assume for articles","required":false,"type":null,"key_value":null}}],"description":"Extracts article text, authors, images, and metadata from a given URL or raw HTML using newspaper3k","keywords":["article","news","newspaper3k","scraper","metadata","text extraction"],"input_args":{"type":"object","properties":{"html":{"type":"string","description":"Optional raw HTML content (if you already have it), will override fetching from 'url'"},"language":{"type":"string","description":"Override default language, e.g. 'en', 'zh'"},"url":{"type":"string","description":"Article URL to scrape"}},"required":["url"]},"output_arg":{"json":""},"activated":false,"embedding":[0.69941324,0.64064425,-0.8242118,-0.20212075,-0.0026108846,-0.015203901,-0.9524106,-0.015597768,0.080349006,0.15950476,0.07163128,0.5253768,0.5516496,0.117237054,0.14839432,-0.07454805,-0.15771993,-0.32681906,-1.7062681,0.079335906,0.7563415,0.93879145,0.5255999,-0.050526172,0.31186634,-0.31516442,-0.317042,-0.8968821,-0.7061774,-1.2805489,0.34653315,-0.06946293,-0.38671303,-0.38466397,0.03807852,-0.4254118,0.26365077,-0.2770071,-0.65233713,-0.6415964,0.07296899,0.37815177,-0.18328999,-0.25453016,0.62554437,0.023577802,-0.024233885,-0.78328097,0.5548543,0.84306854,-0.24449272,-0.6769733,-0.36387423,-0.47791514,-0.10911339,-0.25945944,-0.41551962,0.3341912,-0.0977878,0.16487683,0.3199462,0.28385603,-3.8530324,0.082349226,0.6133101,0.04000172,0.009939375,-0.34541604,-0.2724772,-0.069931336,0.04572821,0.11202561,-0.14612137,0.21732494,0.13858303,-1.0522708,0.26680806,0.226521,0.02490455,-0.6104649,0.021241015,0.33769563,-0.6432464,0.4505488,-0.6576282,0.8213175,-0.51968646,-0.5023192,0.27919054,0.16295187,0.7402312,-0.65924335,-0.4153273,-0.17680705,-0.39726406,0.035670493,0.0712568,0.68875307,0.3967821,3.2755167,0.91599333,-0.04625012,-0.09378637,-1.0914956,0.70594496,-0.71022606,-0.08095429,0.38602623,0.34430817,0.17422038,0.22477517,-0.2959589,-0.42709592,-0.0005936455,-0.1604625,0.1939446,-0.64268064,-0.42358655,0.6000193,0.7521763,0.0050160587,0.40755403,-0.48660865,-0.61343753,0.27787632,0.39944577,0.06094875,0.6259906,0.3867572,-0.122751,0.2874025,-0.36750785,-1.2879946,-0.27463716,-0.41514495,-0.12326933,0.6739438,-0.8465257,0.5324717,-0.8915728,0.09410974,-0.9958719,0.17186475,0.4575055,0.31466278,0.5138172,-0.07581605,0.26031354,-0.65164775,0.06830618,0.10675892,0.7442521,0.04799307,0.35385343,0.8834854,-0.20027967,-0.07487042,-0.39091894,-0.6426438,0.068887234,-0.36406964,-0.4486674,0.74584216,0.20281845,0.038113885,-0.41550457,0.4658897,0.27080587,0.5783553,0.3564225,0.6557421,-0.25712466,0.31269276,0.2567668,-0.09374846,-0.18509637,-0.30487815,-0.18620446,0.30211902,-0.2980997,1.1075373,0.53284484,0.016027093,-0.40134674,-0.5831429,0.18777403,0.19905213,0.41588104,0.97698915,0.7943896,-0.09064364,1.7852771,-0.52919954,-0.96481776,0.4668316,-0.12777343,-0.16401082,0.108757004,0.4017435,0.11989166,0.15786746,-0.035420753,-0.298809,-0.15346563,0.08553788,-0.09210476,0.6943215,0.069616936,0.071044974,-0.8762087,-0.09279807,-0.9468175,0.4682254,-0.29124272,0.58419573,0.049899533,-0.4787472,0.36137012,0.31148908,0.69186544,-0.043289892,0.2936322,-0.50015646,-0.6425251,-0.8887293,0.53056914,0.111264,0.37473297,-0.3324417,-0.1119518,0.8927302,1.0051562,0.468221,1.2657965,1.0531231,-0.2599583,-0.11277374,0.58682287,1.1168257,-0.13469021,0.75258553,0.20202796,-0.23202433,0.18664481,-0.11527233,-0.8335793,-0.4779065,-0.112425655,0.61546636,1.3688636,0.43593183,0.03427375,0.4447992,0.39139223,0.2445595,-0.14925617,-1.784064,0.11501313,-0.03271967,1.0284023,0.13603842,-0.47397316,0.725747,0.58368397,0.50861865,-0.81741315,-0.46407428,-0.5428107,-0.08870637,-0.03713212,-0.6832232,0.34509057,-0.15277311,-0.23207927,0.18668383,0.15238805,1.0182273,0.16069826,-0.7515116,-0.4797083,0.53332186,0.05925063,0.062034234,0.67584586,-0.28007317,-0.7663089,-0.6134092,0.6118777,-0.55895805,0.6261777,-0.051148105,-0.68185204,-0.048983205,0.22133046,1.3931886,-0.122785434,0.33762306,-0.4109923,-0.2381622,-0.28884274,-0.49689972,0.5387871,-0.8388947,-0.27300158,-0.044576533,-0.79690516,0.86298144,-0.5045956,-0.17869407,0.21723235,-0.9806924,-0.23222165,0.21176931,0.10187938,0.14710796,-0.39029527,-0.17337228,-0.062158257,0.19290414,-1.9061534,-0.4343448,-0.16389084,0.21875419,-0.20962098,-0.43167254,0.9444105,-0.6146229,-0.43349522,-0.67292005,1.2295314,0.38771087,-0.046566505,0.1834136,0.27592087,0.3318329,-0.02733611,-0.5154438,-0.14502653,-0.9736136,-0.053445745,-0.09253003,1.1189029,0.22760381,0.23968303,0.056988988,0.70392644,-1.0532606,-0.8967281,0.55461484,-0.021515287,-0.42339802,0.46432325,-0.50498694,-0.79036516,0.47943944,1.2220789,-0.43718585,-0.6154099,-0.76879495,1.6305152,-0.607415,0.055705592,-0.6232083,-0.100991845,0.19413708,0.41611272,0.4850095,-0.29752842,0.10240604,-0.6654748,0.25095123,-0.20786086,0.5775305,-0.28614354,0.61468095,0.22875509,0.5750578,0.70075417,0.5889914,0.5124304,0.91121185,0.08331992,-0.6880028,0.36062735],"result":{"type":"object","properties":{"authors":{"items":{"type":"string"},"type":"array"},"keywords":{"items":{"type":"string"},"type":"array"},"publish_date":{"type":"string"},"summary":{"type":"string"},"text":{"type":"string"},"title":{"type":"string"},"top_image":{"type":"string"}},"required":["title","authors","publish_date","summary","keywords","top_image","text"]},"sql_tables":null,"sql_queries":null,"file_inbox":null,"oauth":null,"assets":null,"runner":"any","operating_system":["linux","macos","windows"],"tool_set":""},false]} \ No newline at end of file diff --git a/tools/article-scraper/metadata.json b/tools/article-scraper/metadata.json index c56e480c..489aeaf4 100644 --- a/tools/article-scraper/metadata.json +++ b/tools/article-scraper/metadata.json @@ -12,6 +12,9 @@ "metadata", "text extraction" ], + "runner": "any", + "operating_system": ["linux", "macos", "windows"], + "tool_set": "", "configurations": { "type": "object", "properties": { diff --git a/tools/arxiv-download/.tool-dump.test.json b/tools/arxiv-download/.tool-dump.test.json new file mode 100644 index 00000000..a1196d4c --- /dev/null +++ b/tools/arxiv-download/.tool-dump.test.json @@ -0,0 +1 @@ +{"type":"Python","content":[{"version":"1.0.0","name":"arxiv-download","homepage":null,"author":"@@official.shinkai","py_code":"# /// script\n# dependencies = [\n# \"requests\",\n# \"arxiv>=1.4.7\",\n# \"pymupdf4llm\",\n# \"pathlib\"\n# ]\n# ///\n\nimport arxiv\nimport requests\nimport json\nimport pymupdf4llm\nfrom pathlib import Path\nfrom typing import Dict, Any\n\nclass CONFIG:\n storage_folder: str = \"arxiv_papers\"\n\nclass INPUTS:\n paper_id: str # e.g. \"2101.00001\"\n convert_to_md: bool = True\n\nclass OUTPUT:\n status: str\n message: str\n md_file: str\n\nasync def run(c: CONFIG, p: INPUTS) -> OUTPUT:\n \"\"\"\n Download a paper from arXiv by ID, store as PDF in the storage folder, optionally convert to .md\n \"\"\"\n folder = Path(c.storage_folder)\n folder.mkdir(parents=True, exist_ok=True)\n\n # if we already have .md for that paper, skip\n md_path = folder / f\"{p.paper_id}.md\"\n if md_path.exists():\n out = OUTPUT()\n out.status = \"exists\"\n out.message = f\"Paper {p.paper_id} already downloaded/converted.\"\n out.md_file = str(md_path)\n return out\n\n # otherwise, we do the download\n search = arxiv.Search(id_list=[p.paper_id])\n client = arxiv.Client()\n try:\n paper = next(client.results(search))\n except StopIteration:\n out = OUTPUT()\n out.status = \"error\"\n out.message = f\"Paper not found: {p.paper_id}\"\n out.md_file = \"\"\n return out\n\n # Download PDF\n pdf_path = folder / f\"{p.paper_id}.pdf\"\n if not pdf_path.exists():\n paper.download_pdf(dirpath=str(folder), filename=pdf_path.name)\n\n # Optionally convert\n if p.convert_to_md:\n # Convert using pymupdf4llm\n try:\n markdown_text = pymupdf4llm.to_markdown(str(pdf_path), show_progress=False)\n md_path.write_text(markdown_text, encoding='utf-8')\n # remove pdf if you want\n # pdf_path.unlink()\n except Exception as e:\n out = OUTPUT()\n out.status = \"error\"\n out.message = f\"Conversion failed: {str(e)}\"\n out.md_file = \"\"\n return out\n\n out = OUTPUT()\n out.status = \"success\"\n out.message = f\"Paper {p.paper_id} downloaded successfully.\"\n out.md_file = str(md_path) if p.convert_to_md else \"\"\n return out ","tools":[],"config":[{"BasicConfig":{"key_name":"storage_folder","description":"Where to store PDFs/MD outputs","required":false,"type":null,"key_value":null}}],"description":"Download an arXiv paper PDF and optionally convert it to Markdown","keywords":["arxiv","pdf","download","markdown","research","paper"],"input_args":{"type":"object","properties":{"convert_to_md":{"type":"boolean","description":"Whether to convert the downloaded PDF to .md"},"paper_id":{"type":"string","description":"ArXiv paper ID to download"}},"required":["paper_id"]},"output_arg":{"json":""},"activated":false,"embedding":[-0.06772009,0.33074895,-0.12433264,-0.055927545,0.09624629,-0.12388899,-0.71083736,-0.3618617,0.10271849,-0.8440084,0.5556332,0.55765307,0.3625208,0.35818374,0.42076993,-0.68175757,-0.115849614,-0.74241465,-0.6022908,0.18148008,-0.049271327,1.1281248,0.14197966,0.14113511,0.48362833,-0.19575952,0.23364326,-0.437007,-1.2430946,-2.2457132,0.3783815,0.16859254,-0.5481903,-0.090724036,0.30787995,-0.86067104,-0.11666481,0.22927448,0.12952995,-0.16315632,0.14190437,-0.1897714,0.42679283,-0.2632755,0.9500502,-0.25022757,0.0298271,0.039278306,0.6473044,0.070573956,-0.5418029,-0.12828816,0.09704277,-0.22622198,-0.3254506,0.019293204,0.4580627,0.033716645,0.04554349,0.33572453,0.28695026,0.59874475,-4.281266,0.43372402,0.5776784,0.59592384,0.3208925,-0.06429759,-0.12958783,-0.15205355,0.24863602,-0.104167335,-0.27816,0.0016052015,-0.50114995,-0.54733145,-0.18057136,0.29124182,-0.19310378,-0.23886481,-0.437409,0.27079862,0.42258355,0.22533771,-0.57201606,0.50246143,-0.3832505,-0.5628334,0.7944239,-0.035965882,-0.046965446,-0.28912395,-0.21649215,0.3692323,-0.26799268,0.35802346,0.17145126,0.06583945,-0.41364226,3.3612483,0.41108125,-0.13293199,1.170197,-0.56670916,-0.40315762,-0.54664934,-0.30528918,-0.26310351,-0.15721942,0.2900381,0.5113967,-0.9446422,-0.4114693,-0.108598545,-0.21903737,-0.091914244,-0.41363305,-0.14384334,0.05311441,0.25706697,-1.1712787,0.5694138,-0.44011515,-0.43747523,0.3661413,0.08051382,-0.25502595,0.3159434,0.42088762,-0.16219096,-0.16146418,-0.18206616,-0.25271896,0.19235066,0.065700546,0.04299907,0.95749205,-0.36959967,0.17073585,-0.1140331,0.13210365,-0.8657535,0.7602873,0.2573825,0.6513539,0.14940584,-0.19946343,0.68404925,-0.53199345,-0.10830405,-0.067399174,0.007347025,-0.099279076,-0.27195817,0.9186075,-0.14061287,-0.119402714,0.066054106,-0.017029323,0.47632283,0.11573829,-0.6110352,0.30140185,0.9487582,0.0013287663,0.018905332,0.16431758,-0.07871211,0.77877986,0.313329,0.36769348,-0.35382083,0.36676982,-0.14401965,0.303029,0.444213,-0.08598235,-0.6011994,0.17401975,-0.633597,0.53721094,0.3046455,-0.04384352,-0.30939847,0.22511028,0.47177783,0.32312715,-0.020245794,0.63887334,0.5815079,-0.4591998,1.8242875,-1.6826007,-0.63111514,-0.46525353,0.049148753,0.24241935,0.27208704,0.5969246,-0.5733497,-0.67277235,-0.12470095,0.54242986,0.44272786,0.2653585,-0.5881211,0.43370715,0.17412254,-0.092196986,-0.38453522,-0.13758329,-0.3040964,0.9313191,0.7411672,0.08223746,0.0749369,-0.11820951,0.08241235,0.20786884,0.30508548,0.007237643,0.1384644,-0.52654344,-0.50662273,-0.483865,0.15936537,0.10304559,0.003170129,-0.20125444,-0.24802543,0.296281,0.16812082,0.6309372,1.0705671,0.3381907,-0.2609965,-0.43840575,0.26710033,0.011027411,-0.71286404,0.6916328,-0.04688865,-0.105023734,-0.5047826,-0.07493542,-0.84578335,-0.13567328,0.47130805,-0.1308145,1.6273332,0.39326164,-0.5048349,0.7160495,0.06862165,-0.109315954,0.27021915,-1.8295172,-0.04794021,-0.024705894,0.4504594,-0.07260375,0.44587356,0.36690506,0.3875241,-0.1434882,-0.41276056,-0.76968247,-0.33724308,0.0024902895,-0.15620635,-0.11287923,0.48406887,0.40559518,0.24793443,-0.02829522,0.46180364,0.981828,-0.30582544,-0.46393213,-0.7084347,-0.1316689,0.052845255,0.24334338,0.037883535,-0.49104986,0.07941584,0.35554042,0.007393047,0.056695815,-0.32162595,-0.09060878,0.042034656,0.13000086,0.18264228,1.926402,0.04121549,0.03346231,0.19649933,-0.7543767,0.6176141,-0.011706315,-0.10913884,-0.20472036,-0.054269843,-1.0272176,0.11338819,0.30252743,-0.5999712,0.074522674,0.408844,-0.29486153,-0.5803827,-0.035178546,-0.17542776,0.47810194,-0.6029544,-0.24997126,0.29132655,-0.35446957,-1.5702441,-0.6800717,0.015752247,0.50049007,-0.46064997,-0.59031856,0.865307,0.28391632,0.21349448,-0.23197974,1.715747,0.4794465,0.1617654,-0.51702493,-0.050501943,0.7516259,-0.24805821,0.77039766,-0.44998118,-0.8785668,0.012401135,0.581763,1.636462,-0.14743578,-0.33823237,-0.22904876,-0.028672434,-1.53263,-0.871168,0.074743755,-0.06351489,-0.15739936,0.40022105,-0.42450187,-0.11895325,1.098501,1.005978,-0.23876546,0.104689986,-0.17724875,2.3204203,-0.43574765,-0.31134295,0.09102308,-0.0021279864,-0.2569486,0.17781231,-0.3419927,-0.8080248,-0.24101713,-0.017459534,0.25798306,-0.5684905,0.7051594,0.20335832,0.25227988,0.07262878,-0.27239957,0.8793398,0.77965456,0.06566863,0.26809794,-0.5473861,-0.65845394,-0.06537734],"result":{"type":"object","properties":{"md_file":{"type":"string"},"message":{"type":"string"},"status":{"type":"string"}},"required":["status","message"]},"sql_tables":null,"sql_queries":null,"file_inbox":null,"oauth":null,"assets":null,"runner":"any","operating_system":["linux","macos","windows"],"tool_set":""},false]} \ No newline at end of file diff --git a/tools/arxiv-download/metadata.json b/tools/arxiv-download/metadata.json index 3605f0b0..4d432d10 100644 --- a/tools/arxiv-download/metadata.json +++ b/tools/arxiv-download/metadata.json @@ -12,6 +12,9 @@ "research", "paper" ], + "runner": "any", + "operating_system": ["linux", "macos", "windows"], + "tool_set": "", "configurations": { "type": "object", "properties": { diff --git a/tools/arxiv-search/.tool-dump.test.json b/tools/arxiv-search/.tool-dump.test.json new file mode 100644 index 00000000..6d658913 --- /dev/null +++ b/tools/arxiv-search/.tool-dump.test.json @@ -0,0 +1 @@ +{"type":"Python","content":[{"version":"1.0.0","name":"arxiv-search","homepage":null,"author":"@@official.shinkai","py_code":"# /// script\n# dependencies = [\n# \"requests\",\n# \"arxiv>=1.4.7\",\n# \"python-dateutil\"\n# ]\n# ///\n\nimport arxiv\nimport json\nfrom typing import List, Dict, Any\nfrom dateutil import parser\n\nclass CONFIG:\n # For this tool, we don't strictly need configuration fields,\n # but we can keep them if you plan to store e.g. environment variables.\n pass\n\nclass INPUTS:\n query: str # The search query string\n max_results: int = 10\n date_from: str = \"\"\n date_to: str = \"\"\n categories: List[str] = [] # A list of category strings\n\nclass OUTPUT:\n papers: List[Dict[str, Any]]\n total_results: int\n\nasync def run(c: CONFIG, p: INPUTS) -> OUTPUT:\n \"\"\"\n Search for papers on arXiv with advanced filtering.\n \"\"\"\n # For safety, clamp max_results\n max_results = max(1, min(p.max_results, 50))\n\n # If categories were provided, combine them into a single query\n search_query = p.query.strip()\n if p.categories:\n cat_filter = \" OR \".join(f\"cat:{cat.strip()}\" for cat in p.categories)\n search_query = f\"({search_query}) AND ({cat_filter})\"\n\n search = arxiv.Search(\n query=search_query,\n max_results=max_results,\n sort_by=arxiv.SortCriterion.SubmittedDate\n )\n\n # Date filters\n date_from = None\n date_to = None\n\n # Attempt to parse date range if provided\n if p.date_from:\n try:\n date_from = parser.parse(p.date_from)\n except Exception as e:\n # not fatal, just ignore\n pass\n\n if p.date_to:\n try:\n date_to = parser.parse(p.date_to)\n except Exception as e:\n pass\n\n papers = []\n client = arxiv.Client()\n count = 0\n\n def is_within(date, start, end):\n if not date:\n return True\n if start and date < start:\n return False\n if end and date > end:\n return False\n return True\n\n for result in client.results(search):\n if is_within(result.published, date_from, date_to):\n short_id = result.get_short_id()\n # Convert authors and categories to lists before adding to dictionary\n authors_list = [str(a.name) for a in result.authors]\n categories_list = list(result.categories)\n \n papers.append({\n \"id\": short_id,\n \"title\": result.title,\n \"authors\": authors_list, # Now explicitly a list of strings\n \"abstract\": result.summary,\n \"published\": result.published.isoformat(),\n \"categories\": categories_list, # Now explicitly a list\n \"pdf_url\": result.pdf_url\n })\n count += 1\n if count >= max_results:\n break\n\n out = OUTPUT()\n out.papers = papers\n out.total_results = len(papers)\n return out ","tools":[],"config":[],"description":"Search for papers on arXiv with optional date range and category filters","keywords":["arxiv","search","papers","research","academic","scientific"],"input_args":{"type":"object","properties":{"date_to":{"type":"string","description":"Latest publication date in a parseable date string (optional)"},"max_results":{"type":"number","description":"Maximum number of results to return"},"categories":{"type":"array","description":"List of category filters (e.g. [cs.LG])","items":{"type":"string","description":"Category filter"}},"date_from":{"type":"string","description":"Earliest publication date in a parseable date string (optional)"},"query":{"type":"string","description":"Search query string"}},"required":["query"]},"output_arg":{"json":""},"activated":false,"embedding":[0.34894788,0.88445,-0.37300754,-0.22076483,-0.17697163,-0.5345679,-0.085635155,-0.79086506,-0.17410946,-0.34712172,-0.26372203,0.33773062,0.31200647,0.18278101,0.6410388,-0.028749801,0.13996251,-0.09490329,-1.1786504,0.082557805,0.5303514,0.74004495,0.23061287,0.13481471,0.19042563,0.007892267,-0.19603118,0.019251123,-0.8528901,-2.3221538,0.09565759,-0.015786782,-0.60136205,-0.13516273,0.008803681,-0.68049335,-0.22185534,0.21148503,-0.09136584,-0.367177,0.20003194,0.39185712,0.013888821,-0.053733602,0.42286715,-0.3666607,-0.06727114,-0.2804579,1.0246787,0.32599407,-0.46844915,-0.035654474,-0.55641234,-0.06768157,-0.262594,0.12079404,0.2832465,0.028267343,-0.15255411,0.2447268,0.54266894,0.6954487,-4.3511934,0.46889597,0.13291354,0.2661549,0.3131613,-0.030210052,-0.049632423,0.20253173,0.010865204,0.10126889,-0.19626176,0.21960467,-0.32943043,-0.121019274,0.13564973,0.19453824,0.10651325,-0.25892785,-0.33046022,-0.072916955,-0.014621785,0.18301192,-0.31868765,0.4570935,-0.75581974,0.114382744,0.43348023,-0.22312047,0.0063707177,-0.12896082,0.045479674,-0.03537397,-0.19524303,0.29090193,-0.08650031,0.052221805,0.29433778,3.5911546,0.75738925,0.13269699,0.92953825,-0.4563736,0.39384338,-0.6303248,-0.5085827,-0.21392678,-0.2646469,0.09887996,-0.13308896,-0.6394471,0.12715517,-0.43589532,0.12959011,0.511256,-0.46257973,-0.11876008,-0.5347447,0.26310903,-1.0487187,0.14905974,-0.086378135,-0.13213024,0.19022986,-0.00646621,-0.4372594,0.28308523,0.049085338,-0.39924884,0.15238607,-0.2253361,-0.56797546,-0.119284965,0.13472989,-0.0014349297,0.61246604,-0.40801126,0.3356224,-0.55761015,-0.012925297,-1.249203,1.2744224,-0.22985354,0.924498,0.20277983,-0.6596253,0.34691295,-0.7973008,0.0056146774,-0.09176017,0.33772248,0.20598994,0.09557408,1.3230379,-0.40901712,-0.30363494,-0.07773134,-0.37965855,0.049608156,0.07858658,-0.46556488,0.96731716,1.1421641,0.05216006,-0.2234192,0.34828475,0.34506214,0.41216034,-0.19433852,0.30151516,-0.12571615,0.583678,0.71438706,-0.037180737,0.5686168,-0.20448348,0.004982792,0.51906395,-0.7006303,0.24539627,0.46547705,-0.07627691,-0.28280225,-0.07280959,0.37113816,0.37132457,-0.11630372,0.421314,0.7477428,-0.5876195,1.7293193,-1.3365645,-0.80812687,-0.23079416,0.023927886,-0.21764421,0.3173278,0.61931753,-0.03782907,-0.45095378,0.06261863,-0.053407427,0.5688934,0.25468698,-0.6490454,0.47072053,-0.20680277,0.12701386,-0.36012757,0.14324541,0.082084246,-0.012038454,0.20363045,0.31658557,0.8090048,0.21843538,-0.0180096,0.33388692,0.69606817,-0.17410636,0.18000343,-0.22063158,-0.62148714,-0.346437,-0.08519444,-0.31592882,-0.3840068,0.095803544,-0.16078718,0.3567003,-0.022436282,1.0674878,0.5497929,0.2566408,-0.19926804,-0.066540204,0.12796009,0.48092803,-0.7000489,0.71797615,-0.069170564,-0.30026418,-0.45192766,0.34696794,-0.41217136,-0.027474463,0.16476065,-0.2007134,1.5931823,0.5429906,-0.5547749,0.12042129,-0.019862153,-0.40132666,0.059075568,-1.5313233,0.15679948,0.05386039,0.52875197,0.022451915,0.099397115,0.4198229,0.1758397,-0.04285577,-0.37847373,-0.3669861,0.097822905,0.29541206,-0.4152053,-0.089436136,0.44998395,-0.4158994,0.21088201,0.21994804,0.16571964,0.65579844,-0.27170518,-0.42283106,-0.2295302,-0.0021295175,0.033394717,0.34000203,0.25209016,-0.6539832,-0.31381065,0.18330684,-0.16293544,-0.63418627,-0.25336,-0.515171,-0.29831606,0.13092126,-0.57246083,1.7539302,-0.2520502,0.5000318,0.5864518,-0.49053377,0.44887024,0.10555474,0.043397605,0.03717222,0.25963393,-0.67801595,-0.35421053,0.6433538,-0.31016263,-0.2650637,0.5037415,-0.6214712,-0.4237828,0.12215768,-0.37914956,0.24386418,-0.7923349,0.24067882,0.46612176,-0.092157766,-2.0882332,-0.3603397,0.18967348,0.4964923,-0.27638572,-0.44730464,0.29169866,0.084694125,0.6405814,-0.504913,1.4851844,0.2343813,0.47302046,-0.33443037,-0.14030781,0.47611555,-0.77369225,0.42505178,-0.019781493,-0.8140944,0.081080854,0.2966836,1.6480422,0.24691354,0.15324289,-0.23381951,0.23558167,-0.6814598,-0.8331686,0.6909977,0.45168513,-0.2994824,0.74830925,0.102537766,-0.45695803,0.8333774,0.68124235,-0.022489144,0.14026581,0.025008477,1.7170686,-0.138336,-0.33075792,-0.11696012,0.034694467,-0.062001497,0.41247928,-0.3743751,-0.5114662,0.5044785,-0.092890866,-0.025107715,-0.45778927,0.43487543,-0.20015125,0.2773704,0.115513645,-0.17685336,0.66651523,0.8104084,-0.18530008,-0.13767087,-0.47944,-1.2010466,-0.5109113],"result":{"type":"object","properties":{"papers":{"items":{"properties":{"abstract":{"type":"string"},"authors":{"items":{"type":"string"},"type":"array"},"categories":{"items":{"type":"string"},"type":"array"},"id":{"type":"string"},"pdf_url":{"type":"string"},"published":{"type":"string"},"title":{"type":"string"}},"type":"object"},"type":"array"},"total_results":{"type":"number"}},"required":["papers","total_results"]},"sql_tables":null,"sql_queries":null,"file_inbox":null,"oauth":null,"assets":null,"runner":"any","operating_system":["linux","macos","windows"],"tool_set":""},false]} \ No newline at end of file diff --git a/tools/arxiv-search/metadata.json b/tools/arxiv-search/metadata.json index aa2ad130..83541a18 100644 --- a/tools/arxiv-search/metadata.json +++ b/tools/arxiv-search/metadata.json @@ -12,6 +12,9 @@ "academic", "scientific" ], + "runner": "any", + "operating_system": ["linux", "macos", "windows"], + "tool_set": "", "configurations": { "type": "object", "properties": {}, diff --git a/tools/chess-evaluate/.tool-dump.test.json b/tools/chess-evaluate/.tool-dump.test.json new file mode 100644 index 00000000..fe8adeb9 --- /dev/null +++ b/tools/chess-evaluate/.tool-dump.test.json @@ -0,0 +1 @@ +{"type":"Python","content":[{"version":"1.0.0","name":"Chess Evaluate","homepage":null,"author":"@@official.shinkai","py_code":"# /// script\n# dependencies = [\n# \"python-chess>=1.999\",\n# \"requests\"\n# ]\n# ///\n\nimport chess\nfrom typing import Dict, Any, Optional, List\n\nclass CONFIG:\n pass\n\nclass INPUTS:\n fen: str\n depth: int = 15\n time_limit_ms: int = 1000 # fallback if depth is small\n\nclass OUTPUT:\n message: str\n\nasync def run(c: CONFIG, p: INPUTS) -> OUTPUT:\n if not p.fen:\n raise ValueError(\"No FEN provided\")\n # Validate FEN\n board = chess.Board()\n try:\n board.set_fen(p.fen)\n except ValueError:\n raise ValueError(\"Invalid FEN\")\n\n # Basic evaluation based on material count and position\n def evaluate_position(board: chess.Board) -> float:\n # Material values\n piece_values = {\n chess.PAWN: 1,\n chess.KNIGHT: 3,\n chess.BISHOP: 3,\n chess.ROOK: 5,\n chess.QUEEN: 9,\n chess.KING: 0 # Not counted in material\n }\n \n score = 0\n \n # Count material\n for piece_type in piece_values:\n score += len(board.pieces(piece_type, chess.WHITE)) * piece_values[piece_type]\n score -= len(board.pieces(piece_type, chess.BLACK)) * piece_values[piece_type]\n \n # Position evaluation bonuses\n if board.is_checkmate():\n if board.turn == chess.WHITE:\n score = -1000 # Black wins\n else:\n score = 1000 # White wins\n elif board.is_stalemate() or board.is_insufficient_material():\n score = 0\n \n # Convert to centipawns\n score = score * 100\n \n return score\n\n # Get evaluation\n score = evaluate_position(board)\n \n # Format message\n if abs(score) >= 1000:\n if score > 0:\n message = \"Mate for White\"\n else:\n message = \"Mate for Black\"\n else:\n message = f\"Evaluation: {int(score)} centipawns (White-positive)\"\n\n out = OUTPUT()\n out.message = message\n return out ","tools":[],"config":[],"description":"Evaluate a chess position using Stockfish at a given depth","keywords":["chess","stockfish","evaluation","analysis","engine","position"],"input_args":{"type":"object","properties":{"fen":{"type":"string","description":"FEN describing the position to evaluate"},"time_limit_ms":{"type":"number","description":"Time limit in milliseconds if depth is small"},"depth":{"type":"number","description":"Depth for the engine search"}},"required":["fen"]},"output_arg":{"json":""},"activated":false,"embedding":[0.039340787,0.84976554,-0.048400175,-0.75149715,-0.8241907,0.040527746,0.35537875,-0.82708794,-0.13831224,-0.19995527,-0.23598726,0.10605708,0.4176126,-0.29368374,0.082493216,-0.7560053,-0.22705139,0.4942831,-1.7596347,0.17607617,-0.1616195,0.16861348,0.17923269,0.064881794,-0.073010765,-0.36077556,0.13652703,-0.27277833,-1.0168302,-2.250052,0.57978517,0.36868683,-0.66226625,-0.18846956,-0.18992513,-0.2681852,-0.25106966,0.27627757,-0.28679723,-0.16792488,-0.11629952,0.8356337,-0.44407615,0.2077041,0.5719315,0.39975762,-0.24397068,-0.056428805,1.2067331,0.3894527,-0.868289,-0.62991285,-0.5598233,-0.12093513,-0.117422655,-0.10088652,0.0011815894,-0.776767,-0.32825705,0.084796056,0.04281304,0.051024698,-3.6833708,-0.009884564,0.8788243,-0.05453892,0.71624637,0.26544857,-0.000186475,0.4112898,-0.16160509,-0.1293165,0.05449301,-0.25842476,0.2430827,-0.255536,0.2920391,-0.18327102,0.44669384,-0.5074555,-0.16129236,0.72264636,0.17260398,0.23183402,-0.28684738,0.39659002,-0.20401642,-0.038235374,0.017026864,0.26097113,0.1822086,-0.21666622,0.26845637,-0.31641096,-0.8956318,0.6925638,-0.30537504,0.9964554,-0.022302054,3.2505653,0.810214,-0.22424987,0.4485013,-0.7241608,0.435453,-0.21542981,-0.03318469,-0.28002614,0.16763867,-0.07117268,-0.39624023,-0.3556778,-0.09584972,0.29186332,-0.6944502,0.64943147,-0.4237783,-0.29573956,-0.12637438,0.34015676,-0.5607023,0.34500518,0.38876665,0.16717806,0.4313776,-0.281816,-0.79047936,0.46272117,0.4289002,0.19513221,0.5725362,0.12025954,-1.1734108,0.052971154,0.5250664,-0.18190345,-0.15563042,-0.84286606,-0.16132808,-0.46103385,-0.33658564,-1.3643967,1.1678154,-0.33756685,0.5968766,-0.47433525,-0.02156227,0.30262086,-0.758723,-0.37244275,-0.22987522,0.77780336,0.0666845,-0.04299944,0.60458285,0.21813847,-0.69879234,0.124562785,0.16909856,-0.41957843,-0.35144776,0.09430825,0.4609223,0.13254148,0.2502465,-0.52087855,0.027168065,0.54278,0.48548174,-0.16710347,-0.014250502,-0.116799526,-0.20613001,-0.08558345,0.023550056,-0.15783122,0.22473595,0.21280399,0.27426395,-0.08214766,0.15201503,0.4899159,-0.29800195,-0.4215098,0.094150305,0.18428743,0.040249377,0.123627976,0.2610366,1.4250892,-0.04282876,1.728094,-0.4786381,-0.17042315,-0.08324982,0.491134,-0.5636603,0.44835967,0.3925725,-0.31762332,-0.34197503,-0.22147581,-0.08612251,-0.015140444,-0.45663267,-0.88175786,0.84806615,-0.48877054,0.21551576,-0.052041452,-0.17219341,0.21399657,0.36138695,0.46254018,0.3559804,0.7746402,0.41122434,0.53846836,0.37752417,0.48966283,0.23468897,-0.16868716,-0.5668296,-0.63710546,-0.56973714,-0.03876677,-0.7117253,-0.56571573,-0.8255053,-0.24698974,0.13889675,0.5316141,0.65924263,0.7633866,1.1496713,0.016212434,0.23153493,0.5690071,0.13182896,-0.28505045,0.598891,0.56415254,-0.9138994,-0.32413054,0.32054013,-0.6427245,0.055843517,0.41222018,-0.43644536,2.102999,1.276781,0.18958832,0.42189932,0.6219906,0.21960008,0.16967306,-0.959263,-0.14748044,-0.26983216,0.15043268,-0.76606804,-0.48370507,0.66000766,-0.50564075,-0.25660598,0.019289143,-0.13984992,0.2557712,-0.10248597,-0.15407827,-0.59970486,0.9731769,0.2286297,0.057951577,-0.006322624,0.08877535,0.16519274,0.0926234,-0.8618588,-0.044915713,-0.32219446,-0.2695802,0.2993928,-0.16310321,-0.39187378,-0.40396062,-0.22212343,-0.47712374,-0.057272635,0.44927388,-0.34361237,-0.67901444,-0.2518763,0.37155676,0.86461294,0.018410005,-0.2673508,0.50059086,0.3759299,0.9463687,-0.62516505,0.42379576,0.031587012,0.8816637,-0.1846982,-0.39565152,0.089516595,-0.060103085,-0.7289362,0.03345154,-0.037084263,-0.35753095,0.24235389,-0.24201196,0.26875627,-0.33935168,0.4002085,0.43168697,-0.3027847,-2.0900226,-0.39522842,0.05940211,0.6479115,-0.16650274,-0.49591792,0.15279832,-0.6695172,-0.5988178,-0.56353307,0.7588471,0.07301231,-0.08317193,-0.24941762,-0.040407877,0.63943696,-0.41415343,-0.04982695,0.5847271,-0.9186146,0.18547523,0.1854054,1.555254,0.57946724,1.0698681,0.24515939,0.543661,-0.7802806,-0.6917264,0.698998,0.61085385,-0.22370987,0.6422112,-0.14474832,0.21174338,0.88892555,0.4149573,-0.209373,0.11551093,0.13402906,1.2465987,-0.116679,0.14056782,0.35788172,0.46083736,-0.40614516,0.07535764,-0.39772135,-0.4350933,0.3060971,0.6445867,0.33568278,-0.5986071,0.3816093,0.07217738,1.0115882,0.46708518,0.11361255,0.7352574,0.30566666,-0.22631656,-0.2864064,-0.6810513,-1.276088,0.31598204],"result":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"sql_tables":null,"sql_queries":null,"file_inbox":null,"oauth":null,"assets":null,"runner":"any","operating_system":["linux","macos","windows"],"tool_set":""},false]} \ No newline at end of file diff --git a/tools/chess-evaluate/metadata.json b/tools/chess-evaluate/metadata.json index e8d1f406..eda1b5f6 100644 --- a/tools/chess-evaluate/metadata.json +++ b/tools/chess-evaluate/metadata.json @@ -12,6 +12,9 @@ "engine", "position" ], + "runner": "any", + "operating_system": ["linux", "macos", "windows"], + "tool_set": "", "configurations": { "type": "object", "properties": {}, diff --git a/tools/chess-generate-image/.tool-dump.test.json b/tools/chess-generate-image/.tool-dump.test.json new file mode 100644 index 00000000..65f5d344 --- /dev/null +++ b/tools/chess-generate-image/.tool-dump.test.json @@ -0,0 +1 @@ +{"type":"Python","content":[{"version":"1.0.0","name":"Chess Generate Image","homepage":null,"author":"@@official.shinkai","py_code":"# /// script\n# dependencies = [\n# \"python-chess>=1.999\",\n# \"cairosvg>=2.5.2\",\n# \"requests\"\n# ]\n# ///\nimport chess\nimport chess.svg\nimport cairosvg\nimport os\nfrom typing import Dict, Any, Optional, List\nfrom shinkai_local_support import get_home_path\n\nclass CONFIG:\n pass\n\nclass INPUTS:\n fen: str\n last_move_uci: Optional[str] = None # highlight the last move, optional\n output_filename: str = \"chess_position.png\" # allow customizing the output filename\n\nclass OUTPUT:\n image_path: str\n\nasync def run(c: CONFIG, p: INPUTS) -> OUTPUT:\n if not p.fen:\n raise ValueError(\"No FEN provided\")\n\n board = chess.Board()\n try:\n board.set_fen(p.fen)\n except ValueError:\n raise ValueError(\"Invalid FEN\")\n\n # Optionally highlight the last move\n arrows = []\n if p.last_move_uci and len(p.last_move_uci) in (4,5):\n try:\n move = board.parse_uci(p.last_move_uci)\n arrows.append(chess.svg.Arrow(start=move.from_square, end=move.to_square, color=\"#FF0000\"))\n except:\n pass\n\n svg_data = chess.svg.board(board, arrows=arrows)\n png_data = cairosvg.svg2png(bytestring=svg_data.encode(\"utf-8\"))\n\n # Get home path and create output path\n home_path = await get_home_path()\n filename = p.output_filename\n file_path = os.path.join(home_path, filename)\n \n # Write the PNG data to file\n with open(file_path, \"wb\") as f:\n f.write(png_data)\n\n out = OUTPUT()\n out.image_path = file_path\n return out ","tools":[],"config":[],"description":"Generate a PNG image of a chess position from FEN notation with optional last move highlighting","keywords":["chess","image","png","fen","board","visualization"],"input_args":{"type":"object","properties":{"fen":{"type":"string","description":"FEN string representing the chess position"},"last_move_uci":{"type":"string","description":"Optional UCI format move to highlight (e.g. 'e2e4')"},"output_filename":{"type":"string","description":"Optional filename for the output PNG image (default: chess_position.png)"}},"required":["fen"]},"output_arg":{"json":""},"activated":false,"embedding":[0.032729693,1.0119934,-0.23267765,-0.25097826,-0.51557654,0.41626486,0.1343692,-0.4765576,-0.1912141,0.47182304,-0.27915794,0.6329949,0.20379753,0.14261886,0.33979908,-0.51676613,-0.25791192,-0.058083337,-1.8833051,-0.2050018,-0.4075542,0.765411,0.5863407,-0.58561546,-0.09786025,-0.03829273,0.44228107,-0.31918234,-1.1452702,-1.5330564,0.6543405,0.38322148,-0.38568768,-0.07307997,0.05653287,-0.41618338,-0.39366028,0.2791135,0.09008574,-0.13466454,0.29652858,-0.27948394,-0.3783822,-0.07555157,0.242249,0.28459454,0.39863166,-0.2706172,0.70656514,0.43057692,-0.9193365,-0.4503999,-0.19018131,0.08995362,0.007946093,0.27796975,-0.15865675,-0.034037888,-0.033281256,0.2943731,-0.45355105,0.03757287,-3.2921774,0.24355029,0.7809772,-0.17181581,0.13451223,-0.1497338,0.140184,0.73279315,0.37502563,0.036452956,-0.31638515,-0.012242649,-0.20928892,-0.16287121,0.1666895,0.22662358,0.18277538,-0.77135134,-0.3326483,0.6696121,0.042926736,0.5087398,-0.33706573,0.6724881,-0.13927844,-0.3939796,-0.19989589,0.25436598,0.010686399,-0.020136382,0.007182005,-0.42593208,-0.9479251,0.79980636,-0.22424833,0.71546537,-0.25390553,3.1837778,0.646358,-0.45692334,0.4297949,-0.16427407,0.73958004,-0.46805152,-0.3377918,-0.86626124,0.34134883,-0.27622658,-0.20284347,0.25296795,-0.31738627,-0.27345702,-0.16541731,0.26112422,-0.6806464,-0.39182478,0.03651599,0.14089225,-0.46101603,0.010974713,-0.8189919,-0.12245665,0.7456416,-0.1329365,-0.43380937,0.39505088,0.022943098,0.0723068,0.40015435,0.5969842,-0.8053802,0.17864406,0.04382189,-0.12305925,0.14789039,-0.8530671,0.07199107,0.3134663,0.3312071,-1.1001387,1.6050723,0.07785331,0.9036473,-0.008204825,-0.11263455,0.028643213,-0.8492052,-0.91088074,-0.40261245,0.12154703,0.78394145,0.8182031,0.691703,0.2736142,-0.8704842,0.18785566,-0.1827323,0.19349515,-0.18642855,-0.3503658,0.6118898,0.101968676,0.14597362,-0.3871449,0.451147,0.4826958,0.68147236,-0.3519495,0.26492625,0.114026785,0.24394725,0.19660147,0.16123165,-0.2847726,0.2700434,-0.540625,0.5066915,-0.26008776,0.3722159,0.47292942,-0.19904841,-0.74097633,0.12136833,-0.22170402,-0.34141135,0.27355477,0.25785866,1.1181085,0.46514812,1.5814403,-0.4649452,0.22036955,0.19252948,0.6302937,-0.037691887,0.7040307,0.3681456,-0.055824716,-0.4620906,-0.63878655,-0.25374573,-0.41818342,0.16070709,-0.31310993,0.2230211,-0.20852737,-0.51993525,-0.14455953,-0.6761954,0.096246555,1.2538788,0.275657,0.31407228,-0.0014049355,0.41786733,0.46217167,0.70059955,0.14756644,0.40091142,0.7705689,-1.0146606,-0.38848275,-0.85531455,-0.24092044,-0.3781833,-0.744498,-1.0456153,-0.3443068,0.95655954,0.45220116,0.233505,1.4280971,0.82553524,0.065053545,-0.02283261,0.52431154,-0.32066992,-0.87057227,1.2035345,0.77978253,-0.6138107,-0.738044,-0.25797617,-1.0508436,-0.61183476,0.413539,0.1112196,2.2243345,1.2067114,-0.028988775,0.32958764,0.6726532,-0.20926982,-0.2714318,-1.5909321,-0.60338354,-0.48749074,0.2367844,-0.1792734,-0.2857553,-0.08974716,-0.66103387,-0.24356122,-0.68851614,-0.60245115,-0.29187843,-0.2651496,-0.38368395,-0.025518704,0.5720124,-0.11513154,0.5574533,-0.11703434,0.2534836,0.41075712,-0.26004958,-0.86979556,-0.23415314,0.030873094,-0.062077045,-0.10609669,-0.03089425,-0.12803748,-0.3435658,-0.40905502,-0.44483697,0.17118023,0.3331784,0.16518569,-0.53632224,0.11550689,0.15418695,1.5227658,-0.34013095,-0.057511773,0.7008949,0.08052514,0.6220899,-0.25361958,0.5628561,-0.028543994,-0.16515888,-1.2291632,-0.8305777,0.06368388,-0.45426494,-0.677996,0.36459416,-0.38965762,-0.20296443,0.29700246,-0.33953333,0.24883252,-0.16045094,-0.3110919,0.63769937,0.055358607,-1.9860502,-0.10408342,0.2863523,0.2956547,-0.30684528,-0.7526242,0.13612506,-0.5101924,0.18692334,-0.110589646,0.66648376,-0.0628724,0.06563624,0.40037805,0.38330543,0.52348304,0.081960104,0.26864722,0.4315311,-0.46371534,0.36868232,-0.061247513,2.0518267,0.65584683,0.4645729,-0.43679127,0.22283554,-1.0418568,-1.2010225,0.10345263,0.1666244,-0.26256135,0.32919043,-0.00079279393,0.11097917,0.5889653,0.3051795,-0.3686697,-0.12939921,0.20949799,1.3185683,-0.15778026,0.18000017,0.19425225,0.1357902,-0.41294166,-0.35758603,0.49161434,-0.49412423,-0.030952726,0.875046,0.3334477,-0.91403747,0.3871137,0.1662896,1.2688735,0.35266423,-0.26841837,0.38791358,0.43986228,0.17156728,0.62405884,-0.74739736,-0.81099594,-0.11259714],"result":{"type":"object","properties":{"image_path":{"description":"Path to the generated PNG image file","type":"string"}},"required":["image_path"]},"sql_tables":null,"sql_queries":null,"file_inbox":null,"oauth":null,"assets":null,"runner":"any","operating_system":["linux","macos","windows"],"tool_set":""},false]} \ No newline at end of file diff --git a/tools/chess-generate-image/metadata.json b/tools/chess-generate-image/metadata.json index 9cec301b..52ab086e 100644 --- a/tools/chess-generate-image/metadata.json +++ b/tools/chess-generate-image/metadata.json @@ -12,6 +12,9 @@ "board", "visualization" ], + "runner": "any", + "operating_system": ["linux", "macos", "windows"], + "tool_set": "", "configurations": { "type": "object", "properties": {}, diff --git a/tools/chess-move/.tool-dump.test.json b/tools/chess-move/.tool-dump.test.json new file mode 100644 index 00000000..11b20521 --- /dev/null +++ b/tools/chess-move/.tool-dump.test.json @@ -0,0 +1 @@ +{"type":"Python","content":[{"version":"1.0.0","name":"Chess Move","homepage":null,"author":"@@official.shinkai","py_code":"# /// script\n# dependencies = [\n# \"python-chess>=1.999\"\n# ]\n# ///\nimport chess\nfrom typing import Dict, Any, Optional, List\n\nclass CONFIG:\n pass\n\nclass INPUTS:\n fen: str\n move_uci: str\n\nclass OUTPUT:\n new_fen: str\n is_legal: bool\n\nasync def run(c: CONFIG, p: INPUTS) -> OUTPUT:\n if not p.fen:\n raise ValueError(\"No FEN provided\")\n if not p.move_uci:\n raise ValueError(\"No UCI move provided\")\n\n board = chess.Board()\n try:\n board.set_fen(p.fen)\n except ValueError:\n raise ValueError(\"Invalid FEN\")\n\n # Validate the move format, e.g. \"e2e4\", \"e7e8q\"\n if len(p.move_uci) < 4 or len(p.move_uci) > 5:\n raise ValueError(f\"Move '{p.move_uci}' not in typical UCI format\")\n\n move = None\n try:\n move = board.parse_uci(p.move_uci)\n except:\n pass\n\n result = OUTPUT()\n if move and move in board.legal_moves:\n board.push(move)\n result.is_legal = True\n result.new_fen = board.fen()\n else:\n result.is_legal = False\n result.new_fen = board.fen() # unchanged\n\n return result ","tools":[],"config":[],"description":"Apply a move in UCI format to a given FEN and return the resulting position","keywords":["chess","move","uci","fen","position","game"],"input_args":{"type":"object","properties":{"move_uci":{"type":"string","description":"Move in UCI format (e.g. 'e2e4')"},"fen":{"type":"string","description":"FEN describing the current position"}},"required":["fen","move_uci"]},"output_arg":{"json":""},"activated":false,"embedding":[-0.15459935,0.52410316,-0.13228855,-0.60107803,-0.65915674,0.18770486,-0.04643807,-0.56115365,-0.65973014,-0.37637365,0.40117237,0.17051405,-0.22080083,0.3487455,0.22745435,-0.6032681,-0.41406438,-0.08367267,-1.5550659,-0.009907104,-0.012711483,0.17528096,0.36410362,0.14769173,-0.47745222,-0.4103853,0.09542459,-0.090670824,-1.2316976,-2.151492,0.11053245,0.32421896,-0.48242286,-0.109743014,0.45238772,-0.6592636,-0.25276652,0.18281996,-0.21626306,-0.325755,-0.50433046,0.07863895,-0.110058844,0.1178435,0.45586246,0.1723077,0.18060082,-0.17357062,1.0711929,0.6677108,-0.893382,-0.30499876,-0.17373523,-0.22848484,-0.17654926,-0.36168203,0.4322034,-0.012896584,0.0034982655,0.08985911,-0.09937155,-0.16192284,-3.6785367,0.41640612,0.3853816,-0.09518128,0.2797362,0.6398924,0.14623162,0.50498027,0.13315746,0.29456106,0.19158208,0.45896986,0.34912506,-0.43875667,-0.15758878,-0.056297146,0.20805533,-0.6927878,-0.29981184,0.9321706,-0.1432168,0.1822821,-0.5911722,0.40812996,-0.14261425,-0.0143314,-0.06849784,0.016194105,-0.11936906,0.38861144,0.7108852,-0.35294828,-0.98419034,0.41674244,-0.013704342,0.9066323,0.06827061,3.0412269,0.37612766,-0.23230645,0.4299879,-0.35689515,0.4026237,-0.4494019,-0.08809468,-0.6843408,0.1718531,-0.34915018,-0.27376267,-0.3724747,-0.07992405,-0.74854696,-0.5809474,0.19434208,-0.09327024,-0.0073797926,-0.028455047,0.86758906,-0.689079,0.34977305,-0.11673698,0.15340689,0.20976701,-0.30956247,-0.635473,0.34557506,0.11870147,-0.026957352,0.7932727,0.9464809,-0.8552461,0.08024555,-0.0040388443,-0.2782132,0.50636774,-0.81769663,-0.2108989,-0.113978304,0.27445528,-1.3087913,1.4702561,-0.43752304,1.0357333,-0.08497656,-0.1243821,-0.2557311,-0.6190675,-0.55069107,-0.5356605,0.7226045,0.64898294,0.7616066,0.4723178,-0.22625841,-0.68852305,-0.13945879,-0.75467116,-0.031076722,-0.2255369,-0.2759186,0.31091505,0.41854912,0.44389117,-0.0033248868,0.2851862,0.65321577,-0.02312582,-0.18773454,0.17184535,-0.157114,0.10020087,0.5884095,0.43153372,0.28366318,0.6813203,-0.4824502,0.47365433,-0.5243367,0.03465645,0.5011116,-0.54997444,-0.25335404,0.10026336,0.54512364,0.25901476,0.0135957245,0.84329116,1.668616,-0.22546405,1.4497023,-1.1998209,-0.18366295,-0.11260646,0.5963995,0.30142045,-0.1012674,0.25029886,0.37686104,-0.2889851,-0.18487266,0.271568,0.21568911,0.088124014,-1.0443234,0.36032125,0.05154451,0.07356513,-0.016635124,0.10394901,-0.13468477,1.1452119,0.14744759,0.36646757,0.2703824,0.87409556,0.93111646,-0.13014334,0.14213264,-0.11323743,0.8664259,-0.60974425,-0.51372075,-1.205363,-0.3172962,-0.38749248,-0.6278058,-0.0033211652,0.068827204,0.11658561,0.08601044,0.25451666,1.0470169,0.6143278,-0.20775896,0.19671637,0.29591024,0.10910782,-0.91857094,0.3099023,0.30530348,-0.1064059,-0.44658804,0.10493675,-0.8806144,-0.32511714,0.2430427,0.1289085,2.1098592,1.2620499,0.3850207,0.36335048,0.67618334,-0.16854164,-0.27496782,-1.195156,-0.41756886,-0.028842978,0.29041198,-0.27672887,0.009214096,0.5628352,-0.40632838,0.023993136,-0.5763386,0.004459707,0.43915567,0.058272474,-0.119670495,-0.17419401,0.741682,-0.013117585,-0.15000153,-0.17717695,-0.0347018,-0.06989544,-0.57032526,-0.4552291,-0.0050806534,-0.056691043,-0.5799006,0.09888269,0.31567365,-0.2675561,-0.29851666,-0.45895648,-0.8828221,-0.1584433,0.26739594,-0.53411037,-1.2075108,-0.66895455,0.20761558,1.4658253,-0.6477175,-0.97833645,0.28954798,0.072527856,0.3807655,0.06957432,0.30776602,-0.29005465,0.5091793,-1.1054573,-0.714529,0.2143917,-0.39969945,0.034389105,1.0352175,0.12990671,0.004575629,0.307801,0.038889766,0.26592618,-0.1605781,-0.08339985,0.11351417,-0.39302927,-2.1130495,0.1876456,-0.2542768,0.015886754,-0.25728387,-0.680161,0.013008028,-0.54216355,0.13540547,-0.6211512,0.57476485,0.11770001,-0.03832862,0.49607813,-0.3521327,0.7551513,0.42369783,0.47814497,0.8440611,-0.11837206,0.59237564,0.05166831,1.2783127,0.23259942,0.74454045,-0.3041361,0.011235863,-0.43164474,-0.9640327,-0.1369015,0.20920806,-0.20023361,0.6500911,0.05683901,0.06762004,0.837542,0.41622147,0.1308178,-0.33542493,0.1729745,1.358938,0.048005827,0.19622405,0.051577874,-0.09710652,-0.435282,0.074783996,0.24424885,-0.242253,0.0036964566,-0.02908118,0.70304394,-0.94003946,0.37339595,0.014672628,1.4130626,0.8451342,-0.3027633,0.9850782,0.29972985,-0.038220625,0.6172405,-0.6178168,-0.80631834,0.3141085],"result":{"type":"object","properties":{"is_legal":{"type":"boolean"},"new_fen":{"type":"string"}},"required":["new_fen","is_legal"]},"sql_tables":null,"sql_queries":null,"file_inbox":null,"oauth":null,"assets":null,"runner":"any","operating_system":["linux","macos","windows"],"tool_set":""},false]} \ No newline at end of file diff --git a/tools/chess-move/metadata.json b/tools/chess-move/metadata.json index 8ab51036..5f89a1b5 100644 --- a/tools/chess-move/metadata.json +++ b/tools/chess-move/metadata.json @@ -12,6 +12,9 @@ "position", "game" ], + "runner": "any", + "operating_system": ["linux", "macos", "windows"], + "tool_set": "", "configurations": { "type": "object", "properties": {}, diff --git a/tools/coin-flip/.tool-dump.test.json b/tools/coin-flip/.tool-dump.test.json new file mode 100644 index 00000000..5b991fbd --- /dev/null +++ b/tools/coin-flip/.tool-dump.test.json @@ -0,0 +1 @@ +{"type":"Deno","content":[{"name":"Coin Flip Tool","homepage":null,"author":"@@official.shinkai","version":"1.0.0","js_code":"import axios from 'npm:axios@1.7.7';\n\ntype Configurations = Record;\n\ntype Parameters = {\n sides?: number;\n sideNames?: string[];\n};\n\ntype Result = {\n result: string;\n error?: string;\n};\n\nexport type Run, I extends Record, R extends Record> = (\n config: C,\n inputs: I\n) => Promise;\n\nexport const run: Run = async (\n _configurations: Configurations,\n params: Parameters\n): Promise => {\n try {\n const sides = params.sides ?? 3;\n const sideNames = params.sideNames;\n\n if (sideNames && sideNames.length !== sides) {\n return {\n result: '',\n error: `Number of side names (${sideNames.length}) must match number of sides (${sides})`\n };\n }\n\n if (sides === 0) {\n return { result: 'The coin vanished into another dimension! 🌀' };\n }\n\n if (sides === 1) {\n return { result: '_' };\n }\n\n if (sides < 0) {\n return { result: '', error: 'Cannot flip a coin with negative sides!' };\n }\n\n const response = await axios.get('https://www.random.org/integers/', {\n params: {\n num: 1,\n min: 1,\n max: sides,\n col: 1,\n base: 10,\n format: 'plain',\n rnd: 'new'\n }\n });\n\n const result = parseInt(response.data);\n let output: string;\n\n if (sideNames) {\n output = sideNames[result - 1].toLowerCase();\n } else if (sides === 2) {\n output = result === 1 ? 'heads' : 'tails';\n } else if (sides === 3) {\n output = result === 1 ? '-' : result === 2 ? '0' : '+';\n } else {\n output = `side ${result}`;\n }\n\n return { result: output };\n } catch (error) {\n return {\n result: '',\n error: `Error flipping coin: ${error instanceof Error ? error.message : 'Unknown error'}`\n };\n }\n};\n","tools":[],"config":[],"description":"Flip a coin with n sides using true randomness from random.org. Supports custom side names and various meta-usage patterns.","keywords":["random","coin-flip","decision-making","shinkai"],"input_args":{"type":"object","properties":{"sideNames":{"type":"array","description":"Optional custom names for sides (must match number of sides)","items":{"type":"string","description":"Custon name for the side"}},"sides":{"type":"number","description":"Number of sides (default: 3)"}},"required":[]},"output_arg":{"json":""},"activated":false,"embedding":[-0.10323217,0.6506283,0.07013524,-0.53105426,-0.015971452,0.14356591,-0.34991926,-0.00028386712,0.17746012,0.11721012,-0.58336765,0.6935674,0.22097531,-0.18047416,0.6522617,-0.4258442,-0.010122839,-0.66793805,-1.5215747,-0.46545282,-0.055889625,0.48961347,-0.4766851,0.031372007,0.08048463,0.32476696,0.46743438,0.06755729,-0.817574,-1.4712492,0.5487636,0.8544865,-0.3854684,-0.14730637,0.45606616,0.077774726,-0.1370835,0.4414019,-0.9212647,-0.34174174,0.4548147,-0.061880946,-0.09871723,-0.2725099,0.14203908,-0.19927451,0.019036235,-0.29657868,0.38208553,0.6801709,-0.013718553,-0.28728047,0.48395815,-0.41482988,-0.3732299,0.045190603,0.14122887,-0.01024881,0.09519301,0.5178956,0.23276258,0.2779238,-4.0903344,0.6143448,0.96053064,0.5108987,0.34695464,0.016884224,-0.2203668,0.516877,0.24755208,-0.17696568,0.05468388,0.5062021,0.57644784,-0.15644789,0.56779003,-0.44425485,0.48095512,-0.464923,-0.19115432,0.6977577,0.17765187,-0.5884807,-1.0800436,0.52702904,-0.361413,-0.4385438,-0.11869234,0.20256348,-0.5678571,-0.5764157,-0.16154686,-0.52005994,-0.48639548,0.41709685,0.20955704,0.18836254,0.51516676,3.2068915,0.57397604,0.049616475,0.77710634,-0.9083014,0.74884385,-0.42183664,-0.10520682,-0.8486043,0.24181668,0.1746566,0.39724222,0.16105615,0.23523015,0.2990552,0.19209921,0.0029593278,-0.24100366,0.29115158,-0.4829504,0.52125,-0.55360794,0.60770595,-0.79694754,-0.4933129,-0.079836786,0.15797077,-0.9989707,0.4931562,0.09178722,0.24459927,0.6848557,-0.79265386,-0.6410634,-0.44011915,0.23876178,0.36501223,0.59784234,-0.17377287,0.6054565,-0.3857391,0.04049705,-1.0657316,1.1725916,-0.54105866,1.3147655,-0.12430899,-0.06660405,0.008957736,-0.38906822,-0.3488577,-0.3560373,0.6309744,0.13869418,0.01922289,0.63886493,0.21377692,-0.07816896,-0.17963183,0.066839464,0.360415,0.1608008,-0.35418025,0.10685191,1.1810274,0.42088243,-0.35302565,0.17618461,0.23183683,0.062237427,-0.6248362,0.27151215,-0.12502915,-0.31982014,0.22358467,-0.79038817,0.21699151,0.123922035,-0.31866452,0.121105015,-0.4382898,-0.23219857,0.23196357,-0.51927906,-0.85990125,0.005391337,0.19251408,-0.12244495,-0.36872756,0.45597526,1.2158915,-0.6373085,1.2956278,-0.69329625,-0.42286548,0.0052939616,-0.11863228,-0.36599272,-0.17020275,0.72568357,-0.21000516,-0.70758003,-0.64130545,0.058287468,-0.55776966,0.21128216,-0.47068465,0.5639331,-0.2784332,0.49812537,-0.88772815,0.7102633,0.25774783,1.0326245,1.0657449,0.15400496,-0.3666829,0.34989053,-0.07179287,0.7897089,0.2268996,0.104633905,-0.5539922,-0.7942645,-0.5452926,-0.672642,0.18572843,-0.054535158,-0.1482008,-0.5656483,0.113670036,0.091181956,-0.0138949845,-0.55814695,1.0736921,0.6162406,-0.15170977,-0.41498613,0.7078099,0.35593724,-0.86657304,0.6920244,0.2546736,-0.15551108,-0.109770566,0.05132177,-0.47916552,-0.03828608,-0.9226326,-0.20012198,1.4506199,0.0754668,-0.09038603,1.1819565,0.24318522,-0.41797528,-0.24700719,-2.0612442,-0.24439943,-0.04177103,0.6262849,-0.53913045,-0.7769918,-0.08887747,-0.3274313,-0.5170289,-0.122037396,-0.82854736,-0.24556684,-0.1630344,-0.16461667,-0.37642518,0.79146254,0.5665763,-0.21414837,0.283503,0.3703911,0.71904737,0.029632553,-0.44615588,-0.192899,0.32359743,0.22189848,0.17658427,-0.12977038,-0.6340401,-0.18353987,-0.40744832,0.22132626,-0.080940686,0.027172148,-0.06460762,-0.047359325,-0.39330256,0.3746874,1.7778611,0.9071256,0.50477755,0.13415328,0.032715756,0.4982053,-0.3266592,0.28509924,-0.029754147,0.16409066,-1.154078,-0.29669678,0.8563001,-0.35892883,-0.7564687,-0.68050694,0.08384081,0.5958173,0.2410051,0.8412427,0.17179821,-0.6463632,0.32676673,0.4934436,-0.22092846,-2.1888723,-0.43291828,0.46676382,0.5192567,-0.54260725,-0.33131883,0.43121845,0.24056071,0.32052854,-0.056259997,1.8682979,0.53819984,-0.045151155,-0.39132127,0.34843713,0.61068594,-0.035240654,0.39014173,-0.11634145,-0.26602313,0.25802213,0.0978064,1.2189565,-0.23210363,-0.21152547,-0.015509508,-0.18772537,-0.5353637,-1.1092734,-0.017136239,0.51008606,-0.6946082,0.52024084,0.07074636,-0.15979782,0.83674675,0.3843738,-0.7863041,-0.11299285,-0.19663662,1.6079445,-0.12219898,0.27880648,-0.005132407,0.06366792,-0.26985312,0.44859928,-0.0040199272,-0.007980384,-0.17782812,0.24929026,-0.11759481,-0.3906987,0.33118403,0.049310118,0.369329,0.3192237,-0.047947552,0.55886275,1.1416488,-0.11383802,-0.11535096,-0.11403383,-1.0096714,0.24230638],"result":{"type":"object","properties":{"error":{"description":"Error message if the flip failed","type":"string"},"result":{"description":"The result of the coin flip","type":"string"}},"required":["result"]},"sql_tables":null,"sql_queries":null,"file_inbox":null,"oauth":null,"assets":null,"runner":"any","operating_system":["linux","macos","windows"],"tool_set":""},false]} \ No newline at end of file diff --git a/tools/coin-flip/metadata.json b/tools/coin-flip/metadata.json index b512c093..7bdb8c4b 100644 --- a/tools/coin-flip/metadata.json +++ b/tools/coin-flip/metadata.json @@ -6,6 +6,9 @@ "author": "Shinkai", "keywords": ["random", "coin-flip", "decision-making", "shinkai"], "tool_type": "typescript", + "runner": "any", + "operating_system": ["linux", "macos", "windows"], + "tool_set": "", "configurations": { "type": "object", "properties": {}, diff --git a/tools/coinbase-call-faucet/.tool-dump.test.json b/tools/coinbase-call-faucet/.tool-dump.test.json index 5aa3efed..40c114a5 100644 --- a/tools/coinbase-call-faucet/.tool-dump.test.json +++ b/tools/coinbase-call-faucet/.tool-dump.test.json @@ -1 +1 @@ -{"type":"Deno","content":[{"name":"Coinbase Faucet Caller","homepage":null,"author":"@@official.shinkai","version":"1.0.0","js_code":"import { Coinbase, CoinbaseOptions } from 'npm:@coinbase/coinbase-sdk@0.0.16';\n\ntype Configurations = {\n name: string;\n privateKey: string;\n walletId?: string;\n};\ntype Parameters = {};\ntype Result = {\n data: string;\n};\nexport type Run, I extends Record, R extends Record> = (config: C, inputs: I) => Promise;\n\nexport const run: Run = async (\n configurations,\n _params,\n): Promise => {\n const coinbaseOptions: CoinbaseOptions = {\n apiKeyName: configurations.name,\n privateKey: configurations.privateKey,\n };\n const coinbase = new Coinbase(coinbaseOptions);\n console.log(`Coinbase configured: `, coinbase);\n const user = await coinbase.getDefaultUser();\n console.log(`User: `, user);\n\n // Use walletId from Config only\n const walletId = configurations.walletId;\n\n let wallet;\n if (walletId) {\n // Retrieve existing Wallet using walletId\n wallet = await user.getWallet(walletId);\n console.log(`Wallet retrieved: `, wallet.toString());\n } else {\n // Create a new Wallet for the User\n wallet = await user.createWallet({\n networkId: Coinbase.networks.BaseSepolia,\n });\n console.log(`Wallet successfully created: `, wallet.toString());\n }\n\n const faucetTransaction = await wallet.faucet();\n console.log(\n `Faucet transaction completed successfully: `,\n faucetTransaction.toString(),\n );\n\n return {\n data: `Faucet transaction completed successfully: ${faucetTransaction.toString()} for wallet: ${wallet.getDefaultAddress()}`,\n };\n};\n\n","tools":[],"config":[{"BasicConfig":{"key_name":"name","description":"","required":true,"type":null,"key_value":null}},{"BasicConfig":{"key_name":"privateKey","description":"","required":true,"type":null,"key_value":null}},{"BasicConfig":{"key_name":"walletId","description":"","required":false,"type":null,"key_value":null}}],"description":"Tool for calling a faucet on Coinbase","keywords":["coinbase","faucet","shinkai"],"input_args":{"type":"object","properties":{},"required":[]},"output_arg":{"json":""},"activated":false,"embedding":[-0.99122494,0.50806594,-0.18137962,-0.41493967,-0.23193666,-0.46692222,0.0687634,0.43874425,-0.27778542,-0.017959813,-0.8661224,0.07842385,0.17415565,0.059652843,0.3853139,-0.53799176,0.011051909,-0.6348554,-1.2048376,0.28303137,0.50286824,0.9636021,0.029742166,0.2970993,-0.093243614,0.1579739,-0.29110375,0.12320799,-1.1625351,-2.4252186,0.5984823,1.1908039,-0.6606316,-0.2709986,-0.63542795,-0.34321687,0.12860778,-0.26192757,-0.15083013,-0.029253855,-0.03655629,0.2297895,-0.5603324,-0.050662898,-0.13666894,-0.70836246,0.48023468,0.19298565,0.53484815,0.7338745,0.5589467,-0.36540076,0.25469062,-0.5136771,-0.3332828,-0.12868685,0.22334099,-0.7157119,0.19501099,0.31472236,0.22343026,0.40181735,-3.8011842,-0.047244344,1.2716331,-0.6118786,-0.11626663,-0.11116794,-0.33865005,0.4694708,-0.037501752,-0.19524391,-0.4614096,0.3223101,0.29280674,0.037641026,0.7293865,-0.35483155,0.567163,0.12906854,0.13266593,0.6007808,0.12596978,0.43191862,-0.25101435,0.4072931,0.21287161,-0.52972436,0.29522818,0.6254314,-0.4135732,0.12478796,-0.078617595,0.07535772,0.000089384615,0.5190583,0.10056962,0.24503843,0.017940115,3.1678724,0.6107782,0.14412847,0.31150937,-0.9736704,0.5321445,-0.13874264,-0.30686077,-0.35969603,0.23723474,0.10950215,0.79324293,-0.023657102,0.6210422,0.19991389,0.34732723,-0.1934203,-0.13354202,0.36694792,-0.6958847,0.9096159,-0.48663473,0.664064,-1.2650294,-0.29368094,0.4261583,-0.076165274,-0.32999966,0.3633916,0.00080637634,0.13501783,0.9418749,-0.82700145,-0.76627177,-0.07468449,-0.28829494,0.434925,0.07580288,-0.6897222,-0.68812186,-0.40245715,0.18199688,-2.1058512,1.224085,-0.19669126,0.44360998,-0.17754836,0.4740172,0.1371968,-0.7740964,0.2550662,-0.17048314,0.36711055,0.42428753,-0.23090535,0.28756404,0.14982949,-0.35205346,0.062007338,-0.01289238,0.44881707,-0.42916048,0.2266951,0.28846586,0.23304105,0.5841187,-0.67397416,0.6724802,0.16376093,-0.3693137,-0.123955846,0.6306007,-0.07195953,-0.2700342,0.22918184,-1.4100586,-0.1133481,-0.27751988,0.05546531,0.30617833,-0.78547466,-0.46278316,0.99444,-0.53480095,-0.73826486,-0.08605997,0.055162385,0.06365322,0.22701722,0.21728194,0.5684299,-0.9437571,1.0672885,-0.35899705,-0.04806394,-0.29208297,0.21088497,-0.17880356,0.1196495,-0.049828578,-0.036527902,-0.27911696,-0.52558833,-0.34787142,0.22506356,-0.25697565,-0.13310519,1.3069135,0.49249384,0.12590644,-0.8827312,0.44646263,-0.06894559,0.42643484,0.7206083,0.8160076,-0.44844735,0.16804968,0.019308368,0.16603923,0.26426148,1.0348673,0.5334502,-0.954048,-0.39132386,-0.81579703,0.08473987,0.17618689,0.4596308,-0.5402172,0.21049465,0.31503275,0.7458434,0.6645061,0.84952253,0.8682018,0.7328625,-0.0679008,0.33489862,0.22054482,-0.12859799,-0.005194355,0.2583303,-0.6760137,0.5455183,0.2866763,-0.0079629645,0.42053515,-0.9807938,0.3063334,1.6347826,0.21526441,-0.5904196,0.11962591,-0.062463757,-0.050052047,-0.20544973,-1.1212342,0.5382988,-0.6786197,0.1453031,-0.40478265,-0.1791695,0.37327555,0.026863594,-0.25588816,-0.20552187,-0.37325567,0.1906169,0.117457904,-0.062925085,0.10161585,0.8090012,0.629976,-0.18731183,-0.12044861,0.19006206,0.31053948,0.17830685,-0.3020076,-0.5735512,-0.020475678,-0.16555937,0.6612981,-0.10536747,0.182735,-0.6303363,-0.5657179,0.18669339,-0.8254714,-0.26674804,-0.10148545,-0.34947407,-0.20487763,0.21583214,2.2093656,0.7205735,-0.16089511,0.3484195,0.35745317,0.91434324,0.17402184,-0.0005370714,-0.525771,0.16789791,-1.0236385,0.0937128,0.34643108,-0.49626967,-0.1790568,-0.32317,-0.37175724,0.30956614,-0.014280874,0.106248505,-0.20281261,-0.42128444,0.21055475,0.45975873,-0.2581095,-2.0881133,-0.26736298,0.31235436,-0.6298407,-0.12596682,0.24670933,0.6193566,0.19237164,0.60334843,-0.22912377,1.361868,0.35932636,-0.4044572,-0.9850079,0.4134363,0.5290532,0.45526838,0.1147489,-0.3668976,-0.42578667,0.3019122,-0.13172133,1.3124754,-0.020972705,0.30414128,-0.41859457,-0.37522227,-0.014403075,-1.7559369,0.020438597,0.16517067,-0.49357662,0.31749943,-0.03856969,-0.6470938,0.5298628,0.80309176,-0.2739704,-0.12535317,-0.0002693422,0.57529545,0.32525396,0.051337495,-0.58472085,-0.19945246,0.20148355,-0.051555976,0.31528756,0.27569154,0.088488206,0.26962948,-0.63993686,-0.3265281,0.13676783,-0.2961794,0.8000029,0.56923926,-0.22789086,-0.08803365,0.67435783,0.011274636,-0.16963835,0.25483674,-0.7386935,0.30054727],"result":{"type":"object","properties":{"data":{"type":"string"}},"required":["data"]},"sql_tables":null,"sql_queries":null,"file_inbox":null,"oauth":null,"assets":null},false]} \ No newline at end of file +{"type":"Deno","content":[{"name":"Coinbase Faucet Caller","homepage":null,"author":"@@official.shinkai","version":"1.0.0","js_code":"import { Coinbase, CoinbaseOptions } from 'npm:@coinbase/coinbase-sdk@0.0.16';\n\ntype Configurations = {\n name: string;\n privateKey: string;\n walletId?: string;\n};\ntype Parameters = {};\ntype Result = {\n data: string;\n};\nexport type Run, I extends Record, R extends Record> = (config: C, inputs: I) => Promise;\n\nexport const run: Run = async (\n configurations,\n _params,\n): Promise => {\n const coinbaseOptions: CoinbaseOptions = {\n apiKeyName: configurations.name,\n privateKey: configurations.privateKey,\n };\n const coinbase = new Coinbase(coinbaseOptions);\n console.log(`Coinbase configured: `, coinbase);\n const user = await coinbase.getDefaultUser();\n console.log(`User: `, user);\n\n // Use walletId from Config only\n const walletId = configurations.walletId;\n\n let wallet;\n if (walletId) {\n // Retrieve existing Wallet using walletId\n wallet = await user.getWallet(walletId);\n console.log(`Wallet retrieved: `, wallet.toString());\n } else {\n // Create a new Wallet for the User\n wallet = await user.createWallet({\n networkId: Coinbase.networks.BaseSepolia,\n });\n console.log(`Wallet successfully created: `, wallet.toString());\n }\n\n const faucetTransaction = await wallet.faucet();\n console.log(\n `Faucet transaction completed successfully: `,\n faucetTransaction.toString(),\n );\n\n return {\n data: `Faucet transaction completed successfully: ${faucetTransaction.toString()} for wallet: ${wallet.getDefaultAddress()}`,\n };\n};\n\n","tools":[],"config":[{"BasicConfig":{"key_name":"name","description":"","required":true,"type":null,"key_value":null}},{"BasicConfig":{"key_name":"privateKey","description":"","required":true,"type":null,"key_value":null}},{"BasicConfig":{"key_name":"walletId","description":"","required":false,"type":null,"key_value":null}}],"description":"Tool for calling a faucet on Coinbase","keywords":["coinbase","faucet","shinkai"],"input_args":{"type":"object","properties":{},"required":[]},"output_arg":{"json":""},"activated":false,"embedding":[-0.99122494,0.50806594,-0.18137962,-0.41493967,-0.23193666,-0.46692222,0.0687634,0.43874425,-0.27778542,-0.017959813,-0.8661224,0.07842385,0.17415565,0.059652843,0.3853139,-0.53799176,0.011051909,-0.6348554,-1.2048376,0.28303137,0.50286824,0.9636021,0.029742166,0.2970993,-0.093243614,0.1579739,-0.29110375,0.12320799,-1.1625351,-2.4252186,0.5984823,1.1908039,-0.6606316,-0.2709986,-0.63542795,-0.34321687,0.12860778,-0.26192757,-0.15083013,-0.029253855,-0.03655629,0.2297895,-0.5603324,-0.050662898,-0.13666894,-0.70836246,0.48023468,0.19298565,0.53484815,0.7338745,0.5589467,-0.36540076,0.25469062,-0.5136771,-0.3332828,-0.12868685,0.22334099,-0.7157119,0.19501099,0.31472236,0.22343026,0.40181735,-3.8011842,-0.047244344,1.2716331,-0.6118786,-0.11626663,-0.11116794,-0.33865005,0.4694708,-0.037501752,-0.19524391,-0.4614096,0.3223101,0.29280674,0.037641026,0.7293865,-0.35483155,0.567163,0.12906854,0.13266593,0.6007808,0.12596978,0.43191862,-0.25101435,0.4072931,0.21287161,-0.52972436,0.29522818,0.6254314,-0.4135732,0.12478796,-0.078617595,0.07535772,0.000089384615,0.5190583,0.10056962,0.24503843,0.017940115,3.1678724,0.6107782,0.14412847,0.31150937,-0.9736704,0.5321445,-0.13874264,-0.30686077,-0.35969603,0.23723474,0.10950215,0.79324293,-0.023657102,0.6210422,0.19991389,0.34732723,-0.1934203,-0.13354202,0.36694792,-0.6958847,0.9096159,-0.48663473,0.664064,-1.2650294,-0.29368094,0.4261583,-0.076165274,-0.32999966,0.3633916,0.00080637634,0.13501783,0.9418749,-0.82700145,-0.76627177,-0.07468449,-0.28829494,0.434925,0.07580288,-0.6897222,-0.68812186,-0.40245715,0.18199688,-2.1058512,1.224085,-0.19669126,0.44360998,-0.17754836,0.4740172,0.1371968,-0.7740964,0.2550662,-0.17048314,0.36711055,0.42428753,-0.23090535,0.28756404,0.14982949,-0.35205346,0.062007338,-0.01289238,0.44881707,-0.42916048,0.2266951,0.28846586,0.23304105,0.5841187,-0.67397416,0.6724802,0.16376093,-0.3693137,-0.123955846,0.6306007,-0.07195953,-0.2700342,0.22918184,-1.4100586,-0.1133481,-0.27751988,0.05546531,0.30617833,-0.78547466,-0.46278316,0.99444,-0.53480095,-0.73826486,-0.08605997,0.055162385,0.06365322,0.22701722,0.21728194,0.5684299,-0.9437571,1.0672885,-0.35899705,-0.04806394,-0.29208297,0.21088497,-0.17880356,0.1196495,-0.049828578,-0.036527902,-0.27911696,-0.52558833,-0.34787142,0.22506356,-0.25697565,-0.13310519,1.3069135,0.49249384,0.12590644,-0.8827312,0.44646263,-0.06894559,0.42643484,0.7206083,0.8160076,-0.44844735,0.16804968,0.019308368,0.16603923,0.26426148,1.0348673,0.5334502,-0.954048,-0.39132386,-0.81579703,0.08473987,0.17618689,0.4596308,-0.5402172,0.21049465,0.31503275,0.7458434,0.6645061,0.84952253,0.8682018,0.7328625,-0.0679008,0.33489862,0.22054482,-0.12859799,-0.005194355,0.2583303,-0.6760137,0.5455183,0.2866763,-0.0079629645,0.42053515,-0.9807938,0.3063334,1.6347826,0.21526441,-0.5904196,0.11962591,-0.062463757,-0.050052047,-0.20544973,-1.1212342,0.5382988,-0.6786197,0.1453031,-0.40478265,-0.1791695,0.37327555,0.026863594,-0.25588816,-0.20552187,-0.37325567,0.1906169,0.117457904,-0.062925085,0.10161585,0.8090012,0.629976,-0.18731183,-0.12044861,0.19006206,0.31053948,0.17830685,-0.3020076,-0.5735512,-0.020475678,-0.16555937,0.6612981,-0.10536747,0.182735,-0.6303363,-0.5657179,0.18669339,-0.8254714,-0.26674804,-0.10148545,-0.34947407,-0.20487763,0.21583214,2.2093656,0.7205735,-0.16089511,0.3484195,0.35745317,0.91434324,0.17402184,-0.0005370714,-0.525771,0.16789791,-1.0236385,0.0937128,0.34643108,-0.49626967,-0.1790568,-0.32317,-0.37175724,0.30956614,-0.014280874,0.106248505,-0.20281261,-0.42128444,0.21055475,0.45975873,-0.2581095,-2.0881133,-0.26736298,0.31235436,-0.6298407,-0.12596682,0.24670933,0.6193566,0.19237164,0.60334843,-0.22912377,1.361868,0.35932636,-0.4044572,-0.9850079,0.4134363,0.5290532,0.45526838,0.1147489,-0.3668976,-0.42578667,0.3019122,-0.13172133,1.3124754,-0.020972705,0.30414128,-0.41859457,-0.37522227,-0.014403075,-1.7559369,0.020438597,0.16517067,-0.49357662,0.31749943,-0.03856969,-0.6470938,0.5298628,0.80309176,-0.2739704,-0.12535317,-0.0002693422,0.57529545,0.32525396,0.051337495,-0.58472085,-0.19945246,0.20148355,-0.051555976,0.31528756,0.27569154,0.088488206,0.26962948,-0.63993686,-0.3265281,0.13676783,-0.2961794,0.8000029,0.56923926,-0.22789086,-0.08803365,0.67435783,0.011274636,-0.16963835,0.25483674,-0.7386935,0.30054727],"result":{"type":"object","properties":{"data":{"type":"string"}},"required":["data"]},"sql_tables":null,"sql_queries":null,"file_inbox":null,"oauth":null,"assets":null,"runner":"any","operating_system":["linux","macos","windows"],"tool_set":""},false]} \ No newline at end of file diff --git a/tools/coinbase-call-faucet/metadata.json b/tools/coinbase-call-faucet/metadata.json index 92695ed6..f26b5550 100644 --- a/tools/coinbase-call-faucet/metadata.json +++ b/tools/coinbase-call-faucet/metadata.json @@ -9,7 +9,10 @@ "faucet", "shinkai" ], - "configurations": { + "runner": "any", + "operating_system": ["linux", "macos", "windows"], + "tool_set": "", + "configurations": { "type": "object", "properties": { "name": { diff --git a/tools/coinbase-create-wallet/.tool-dump.test.json b/tools/coinbase-create-wallet/.tool-dump.test.json index 92aa1bc2..0d7d09c5 100644 --- a/tools/coinbase-create-wallet/.tool-dump.test.json +++ b/tools/coinbase-create-wallet/.tool-dump.test.json @@ -1 +1 @@ -{"type":"Deno","content":[{"name":"Coinbase Wallet Creator","homepage":null,"author":"@@official.shinkai","version":"1.0.0","js_code":"import { Coinbase, CoinbaseOptions } from 'npm:@coinbase/coinbase-sdk@0.0.16';\n\ntype Configurations = {\n name: string;\n privateKey: string;\n useServerSigner?: string;\n};\ntype Parameters = {}; // Params type is now empty\ntype Result = {\n walletId?: string;\n seed?: string;\n address?: string;\n};\nexport type Run, I extends Record, R extends Record> = (config: C, inputs: I) => Promise;\n\nexport const run: Run = async (\n configurations: Configurations,\n _parameters: Parameters,\n): Promise => {\n const coinbaseOptions: CoinbaseOptions = {\n apiKeyName: configurations.name,\n privateKey: configurations.privateKey,\n useServerSigner: configurations.useServerSigner === 'true',\n };\n const coinbase = new Coinbase(coinbaseOptions);\n console.log(`Coinbase configured: `, coinbase);\n const user = await coinbase.getDefaultUser();\n console.log(`User: `, user);\n\n // Create a new Wallet for the User\n const wallet = await user.createWallet({\n networkId: Coinbase.networks.BaseSepolia,\n });\n console.log(`Wallet successfully created: `, wallet.toString());\n\n let exportedWallet;\n if (!configurations.useServerSigner) {\n exportedWallet = await wallet.export();\n }\n\n const address = await wallet.getDefaultAddress();\n\n return {\n ...exportedWallet,\n walletId: wallet.getId(),\n address: address?.getId(),\n };\n};\n","tools":[],"config":[{"BasicConfig":{"key_name":"name","description":"","required":true,"type":null,"key_value":null}},{"BasicConfig":{"key_name":"privateKey","description":"","required":true,"type":null,"key_value":null}},{"BasicConfig":{"key_name":"useServerSigner","description":"","required":false,"type":null,"key_value":null}}],"description":"Tool for creating a Coinbase wallet","keywords":["coinbase","wallet","creator","shinkai"],"input_args":{"type":"object","properties":{},"required":[]},"output_arg":{"json":""},"activated":false,"embedding":[0.106608376,0.41127837,-0.25463364,-0.32248706,-0.104817785,0.121706314,-0.03151182,0.31224874,-0.2831944,-0.0034338525,-0.19127713,-0.008223534,0.22638485,-0.09930447,-0.28486118,-0.63315773,-0.09636158,-0.61439145,-1.1654487,0.38228172,-0.17458896,0.8497766,-0.43269163,0.15335917,-0.28330773,-0.2640039,0.0034893155,-0.5224032,-1.484486,-2.4849114,0.8048678,1.0833544,-0.5426029,-0.5558562,-0.05434633,-0.31097323,-0.17190091,0.5118817,-0.42390314,-0.31034046,0.35211498,0.27447006,-0.65473056,0.023174979,-0.058990005,-0.44352376,0.54819924,-0.39887503,0.26282844,0.40640676,-0.0002581142,-0.47739455,0.6547748,-0.03268323,-0.35610425,0.12967776,-0.26997164,-0.3305793,0.10562223,0.4433401,-0.040558998,0.330962,-3.8495562,0.22852053,1.3840722,0.042035088,0.50890285,-0.054913018,-0.3909843,0.62089247,-0.010075815,-0.11408972,-0.54617864,0.043472372,0.38645452,-0.1113597,0.75728303,-0.10065475,0.62765956,0.011410739,0.06718382,0.77804315,0.2650589,-0.18410273,-0.42870727,0.22244582,-0.1088205,-0.53857994,0.04582644,0.0972573,0.08662674,0.45195132,0.2139351,-0.111990795,-0.47918832,-0.25548273,0.016256634,0.9064493,0.47019023,2.697148,0.24152085,0.2536752,0.34584814,-1.0840755,0.79801327,-0.23469439,0.08639613,-0.4534926,0.16087207,-0.2777297,0.9485559,-0.2849575,0.1207515,0.256539,0.35246587,0.32869238,-0.04498246,0.14251262,-0.4105745,0.4183277,-0.26015264,0.2240419,-1.085044,-0.045694605,-0.14072339,-0.07030669,-0.4911205,0.2826326,-0.3474514,-0.5368858,0.21524921,-0.41232717,-0.43492627,0.008838819,-0.040434144,0.6099907,0.01878146,-0.66687995,-0.43180692,-0.02428811,0.30693483,-0.7558724,0.5635787,-0.18748997,0.08487825,-0.37317407,0.3038798,-0.035463236,-0.51118016,-0.600597,-0.010352377,-0.0957617,0.6385061,-0.30879894,0.64587414,-0.53867763,0.020915512,-0.5058636,-0.46977317,-0.086883,-0.22218241,-0.23072702,0.25326255,1.0340672,0.7886596,-0.31496307,0.48080894,0.27734283,0.5118715,-0.70576495,0.2801963,-0.117037974,0.4662382,0.15260935,-0.5982343,0.050490092,-0.41207424,-0.026747614,0.35468322,-0.36062858,-0.7574638,0.34588605,-0.93115747,-1.0822469,-0.7088281,0.3006152,0.4463941,0.22230771,0.10920119,0.72157216,-0.46959072,1.7862909,-0.026602164,-0.046276525,-0.101544656,0.14876622,-0.2731639,0.37518954,0.24139847,-0.28620204,-0.2476773,-0.30634525,-0.19084437,0.22665034,-0.20038769,-0.4942695,0.4065581,0.8478193,-0.1943736,-0.07214823,0.09502381,0.1875737,0.83186984,0.91354287,1.1263794,-0.18895322,0.5766026,-0.037720766,1.3292009,0.14854592,0.63262135,0.24933234,-0.77803963,-0.33052447,-0.7650778,-0.37940335,0.5418016,0.051896956,-0.3578351,0.0016623922,0.6015654,0.628299,0.61673456,0.4733826,1.2288805,0.5030629,-0.010545418,0.03804444,0.17318018,-1.260278,-0.14013255,0.27815554,-0.54101306,-0.7199203,-0.16819221,-0.7132447,0.21671882,-0.6276087,0.088249184,2.020304,0.36894408,-0.14315441,0.38600516,-0.21624562,-0.038657956,-0.18285182,-1.4090341,0.3883453,-0.4969522,0.4531218,-0.09483522,0.1403723,-0.12007758,0.21613769,-0.33294532,-0.4450294,-0.9099992,-0.23876816,-0.11038546,-0.38953996,0.057502277,1.1098955,0.6361157,0.4614854,-0.09154616,-0.015582925,0.70769066,0.46275842,-0.40131098,-0.046300434,0.111293405,-0.08412773,0.76974195,0.3433804,0.35255334,-0.5403275,-0.28918272,0.06919776,-0.79234564,-0.15432379,-0.087078966,-0.38518324,-0.5070818,0.6790647,1.6665665,1.2250792,1.1262922,0.41495696,-0.09596672,0.31750906,-0.13302247,0.5684142,0.096760765,0.17608225,-1.3890605,-0.37464488,0.40351182,-0.61909026,0.044795968,0.110169545,0.26001665,0.50215644,-0.0068575554,0.39997515,0.019612342,-0.45005175,-0.20951176,0.5002105,-0.27554086,-2.350778,-0.23506549,-0.13005003,-0.4562121,0.024141207,0.19423743,0.7284635,0.27046913,0.091427475,-0.27290818,2.4457474,0.35267624,-0.14124544,-0.3587356,0.6354651,0.44762415,0.5347106,0.1576927,-0.07035433,-0.62669516,-0.5964982,0.022721335,0.8997787,-0.088240206,-0.22340164,0.113081306,-0.093459226,-0.3731728,-1.0652199,0.15207438,-0.08235215,-0.38412276,-0.12380577,0.16916335,-0.37506893,0.9809917,0.505852,-0.27879626,-0.1356077,-0.87216944,1.4884256,-0.089887686,-0.35735047,-0.18952346,-0.058308598,-0.11398005,-0.80062836,0.46958363,-0.010470718,0.21347134,-0.19876844,0.04650094,-0.75897115,0.24202266,0.17335476,0.5694237,-0.1755247,0.046171527,0.4265713,0.5958072,0.27597517,-0.091395356,-0.13192715,-0.6837542,-0.10110636],"result":{"type":"object","properties":{"address":{"nullable":true,"type":"string"},"seed":{"nullable":true,"type":"string"},"walletId":{"nullable":true,"type":"string"}},"required":[]},"sql_tables":null,"sql_queries":null,"file_inbox":null,"oauth":null,"assets":null},false]} \ No newline at end of file +{"type":"Deno","content":[{"name":"Coinbase Wallet Creator","homepage":null,"author":"@@official.shinkai","version":"1.0.0","js_code":"import { Coinbase, CoinbaseOptions } from 'npm:@coinbase/coinbase-sdk@0.0.16';\n\ntype Configurations = {\n name: string;\n privateKey: string;\n useServerSigner?: string;\n};\ntype Parameters = {}; // Params type is now empty\ntype Result = {\n walletId?: string;\n seed?: string;\n address?: string;\n};\nexport type Run, I extends Record, R extends Record> = (config: C, inputs: I) => Promise;\n\nexport const run: Run = async (\n configurations: Configurations,\n _parameters: Parameters,\n): Promise => {\n const coinbaseOptions: CoinbaseOptions = {\n apiKeyName: configurations.name,\n privateKey: configurations.privateKey,\n useServerSigner: configurations.useServerSigner === 'true',\n };\n const coinbase = new Coinbase(coinbaseOptions);\n console.log(`Coinbase configured: `, coinbase);\n const user = await coinbase.getDefaultUser();\n console.log(`User: `, user);\n\n // Create a new Wallet for the User\n const wallet = await user.createWallet({\n networkId: Coinbase.networks.BaseSepolia,\n });\n console.log(`Wallet successfully created: `, wallet.toString());\n\n let exportedWallet;\n if (!configurations.useServerSigner) {\n exportedWallet = await wallet.export();\n }\n\n const address = await wallet.getDefaultAddress();\n\n return {\n ...exportedWallet,\n walletId: wallet.getId(),\n address: address?.getId(),\n };\n};\n","tools":[],"config":[{"BasicConfig":{"key_name":"name","description":"","required":true,"type":null,"key_value":null}},{"BasicConfig":{"key_name":"privateKey","description":"","required":true,"type":null,"key_value":null}},{"BasicConfig":{"key_name":"useServerSigner","description":"","required":false,"type":null,"key_value":null}}],"description":"Tool for creating a Coinbase wallet","keywords":["coinbase","wallet","creator","shinkai"],"input_args":{"type":"object","properties":{},"required":[]},"output_arg":{"json":""},"activated":false,"embedding":[0.106608376,0.41127837,-0.25463364,-0.32248706,-0.104817785,0.121706314,-0.03151182,0.31224874,-0.2831944,-0.0034338525,-0.19127713,-0.008223534,0.22638485,-0.09930447,-0.28486118,-0.63315773,-0.09636158,-0.61439145,-1.1654487,0.38228172,-0.17458896,0.8497766,-0.43269163,0.15335917,-0.28330773,-0.2640039,0.0034893155,-0.5224032,-1.484486,-2.4849114,0.8048678,1.0833544,-0.5426029,-0.5558562,-0.05434633,-0.31097323,-0.17190091,0.5118817,-0.42390314,-0.31034046,0.35211498,0.27447006,-0.65473056,0.023174979,-0.058990005,-0.44352376,0.54819924,-0.39887503,0.26282844,0.40640676,-0.0002581142,-0.47739455,0.6547748,-0.03268323,-0.35610425,0.12967776,-0.26997164,-0.3305793,0.10562223,0.4433401,-0.040558998,0.330962,-3.8495562,0.22852053,1.3840722,0.042035088,0.50890285,-0.054913018,-0.3909843,0.62089247,-0.010075815,-0.11408972,-0.54617864,0.043472372,0.38645452,-0.1113597,0.75728303,-0.10065475,0.62765956,0.011410739,0.06718382,0.77804315,0.2650589,-0.18410273,-0.42870727,0.22244582,-0.1088205,-0.53857994,0.04582644,0.0972573,0.08662674,0.45195132,0.2139351,-0.111990795,-0.47918832,-0.25548273,0.016256634,0.9064493,0.47019023,2.697148,0.24152085,0.2536752,0.34584814,-1.0840755,0.79801327,-0.23469439,0.08639613,-0.4534926,0.16087207,-0.2777297,0.9485559,-0.2849575,0.1207515,0.256539,0.35246587,0.32869238,-0.04498246,0.14251262,-0.4105745,0.4183277,-0.26015264,0.2240419,-1.085044,-0.045694605,-0.14072339,-0.07030669,-0.4911205,0.2826326,-0.3474514,-0.5368858,0.21524921,-0.41232717,-0.43492627,0.008838819,-0.040434144,0.6099907,0.01878146,-0.66687995,-0.43180692,-0.02428811,0.30693483,-0.7558724,0.5635787,-0.18748997,0.08487825,-0.37317407,0.3038798,-0.035463236,-0.51118016,-0.600597,-0.010352377,-0.0957617,0.6385061,-0.30879894,0.64587414,-0.53867763,0.020915512,-0.5058636,-0.46977317,-0.086883,-0.22218241,-0.23072702,0.25326255,1.0340672,0.7886596,-0.31496307,0.48080894,0.27734283,0.5118715,-0.70576495,0.2801963,-0.117037974,0.4662382,0.15260935,-0.5982343,0.050490092,-0.41207424,-0.026747614,0.35468322,-0.36062858,-0.7574638,0.34588605,-0.93115747,-1.0822469,-0.7088281,0.3006152,0.4463941,0.22230771,0.10920119,0.72157216,-0.46959072,1.7862909,-0.026602164,-0.046276525,-0.101544656,0.14876622,-0.2731639,0.37518954,0.24139847,-0.28620204,-0.2476773,-0.30634525,-0.19084437,0.22665034,-0.20038769,-0.4942695,0.4065581,0.8478193,-0.1943736,-0.07214823,0.09502381,0.1875737,0.83186984,0.91354287,1.1263794,-0.18895322,0.5766026,-0.037720766,1.3292009,0.14854592,0.63262135,0.24933234,-0.77803963,-0.33052447,-0.7650778,-0.37940335,0.5418016,0.051896956,-0.3578351,0.0016623922,0.6015654,0.628299,0.61673456,0.4733826,1.2288805,0.5030629,-0.010545418,0.03804444,0.17318018,-1.260278,-0.14013255,0.27815554,-0.54101306,-0.7199203,-0.16819221,-0.7132447,0.21671882,-0.6276087,0.088249184,2.020304,0.36894408,-0.14315441,0.38600516,-0.21624562,-0.038657956,-0.18285182,-1.4090341,0.3883453,-0.4969522,0.4531218,-0.09483522,0.1403723,-0.12007758,0.21613769,-0.33294532,-0.4450294,-0.9099992,-0.23876816,-0.11038546,-0.38953996,0.057502277,1.1098955,0.6361157,0.4614854,-0.09154616,-0.015582925,0.70769066,0.46275842,-0.40131098,-0.046300434,0.111293405,-0.08412773,0.76974195,0.3433804,0.35255334,-0.5403275,-0.28918272,0.06919776,-0.79234564,-0.15432379,-0.087078966,-0.38518324,-0.5070818,0.6790647,1.6665665,1.2250792,1.1262922,0.41495696,-0.09596672,0.31750906,-0.13302247,0.5684142,0.096760765,0.17608225,-1.3890605,-0.37464488,0.40351182,-0.61909026,0.044795968,0.110169545,0.26001665,0.50215644,-0.0068575554,0.39997515,0.019612342,-0.45005175,-0.20951176,0.5002105,-0.27554086,-2.350778,-0.23506549,-0.13005003,-0.4562121,0.024141207,0.19423743,0.7284635,0.27046913,0.091427475,-0.27290818,2.4457474,0.35267624,-0.14124544,-0.3587356,0.6354651,0.44762415,0.5347106,0.1576927,-0.07035433,-0.62669516,-0.5964982,0.022721335,0.8997787,-0.088240206,-0.22340164,0.113081306,-0.093459226,-0.3731728,-1.0652199,0.15207438,-0.08235215,-0.38412276,-0.12380577,0.16916335,-0.37506893,0.9809917,0.505852,-0.27879626,-0.1356077,-0.87216944,1.4884256,-0.089887686,-0.35735047,-0.18952346,-0.058308598,-0.11398005,-0.80062836,0.46958363,-0.010470718,0.21347134,-0.19876844,0.04650094,-0.75897115,0.24202266,0.17335476,0.5694237,-0.1755247,0.046171527,0.4265713,0.5958072,0.27597517,-0.091395356,-0.13192715,-0.6837542,-0.10110636],"result":{"type":"object","properties":{"address":{"nullable":true,"type":"string"},"seed":{"nullable":true,"type":"string"},"walletId":{"nullable":true,"type":"string"}},"required":[]},"sql_tables":null,"sql_queries":null,"file_inbox":null,"oauth":null,"assets":null,"runner":"any","operating_system":["linux","macos","windows"],"tool_set":""},false]} \ No newline at end of file diff --git a/tools/coinbase-create-wallet/metadata.json b/tools/coinbase-create-wallet/metadata.json index 85fd518c..cae48d46 100644 --- a/tools/coinbase-create-wallet/metadata.json +++ b/tools/coinbase-create-wallet/metadata.json @@ -10,7 +10,10 @@ "creator", "shinkai" ], - "configurations": { + "runner": "any", + "operating_system": ["linux", "macos", "windows"], + "tool_set": "", + "configurations": { "type": "object", "properties": { "name": { diff --git a/tools/coinbase-get-balance/.tool-dump.test.json b/tools/coinbase-get-balance/.tool-dump.test.json index 8355b23e..e249df86 100644 --- a/tools/coinbase-get-balance/.tool-dump.test.json +++ b/tools/coinbase-get-balance/.tool-dump.test.json @@ -1 +1 @@ -{"type":"Deno","content":[{"name":"Coinbase Balance Getter","homepage":null,"author":"@@official.shinkai","version":"1.0.0","js_code":"import { Coinbase, CoinbaseOptions } from 'npm:@coinbase/coinbase-sdk@0.0.16';\n\ntype WalletBalances = { [key: string]: number };\n\ntype Configurations = {\n name: string;\n privateKey: string;\n walletId?: string;\n useServerSigner?: string;\n};\ntype Parameters = {\n walletId?: string;\n};\ntype Result = {\n message: string;\n balances: WalletBalances | null;\n};\nexport type Run, I extends Record, R extends Record> = (config: C, inputs: I) => Promise;\n\nexport const run: Run = async (\n configurations,\n params,\n): Promise => {\n const coinbaseOptions: CoinbaseOptions = {\n apiKeyName: configurations.name,\n privateKey: configurations.privateKey,\n useServerSigner: configurations.useServerSigner === 'true',\n debugging: true,\n };\n const coinbase = new Coinbase(coinbaseOptions);\n const user = await coinbase.getDefaultUser();\n\n // Prioritize walletId from Params over Config\n const walletId = params.walletId || configurations.walletId;\n\n // Throw an error if walletId is not defined\n if (!walletId) {\n throw new Error('walletId must be defined in either params or config');\n }\n\n const wallet = await user.getWallet(walletId);\n console.log(`Wallet retrieved: `, wallet.toString());\n\n // Retrieve the list of balances for the wallet\n const balances = await wallet.listBalances();\n console.log(`Balances: `, balances);\n\n // Convert balances to WalletBalances\n const balanceMap: WalletBalances = {};\n for (const [currency, amount] of balances) {\n balanceMap[currency] = amount.toNumber();\n }\n\n return {\n message: `Balances: ${JSON.stringify(balanceMap)}`,\n balances: balanceMap,\n };\n};\n","tools":[],"config":[{"BasicConfig":{"key_name":"name","description":"The name of the Coinbase wallet","required":true,"type":null,"key_value":null}},{"BasicConfig":{"key_name":"privateKey","description":"The private key of the Coinbase wallet","required":true,"type":null,"key_value":null}},{"BasicConfig":{"key_name":"walletId","description":"Optional wallet ID for specific wallet selection","required":false,"type":null,"key_value":null}},{"BasicConfig":{"key_name":"useServerSigner","description":"Optional server signer configuration","required":false,"type":null,"key_value":null}}],"description":"Tool for getting the balance of a Coinbase wallet after restoring it","keywords":["coinbase","balance","shinkai"],"input_args":{"type":"object","properties":{"walletId":{"type":"string","description":"Optional wallet ID to get balance for a specific wallet"}},"required":[]},"output_arg":{"json":""},"activated":false,"embedding":[-0.1122051,0.21792355,-0.019444812,-0.32676318,0.017230723,-0.042694233,0.12454068,0.23506877,-0.049858324,-0.39198625,-0.2356008,0.14091831,0.025426041,-0.14607342,0.2663238,-0.17875119,0.13934344,-0.46660352,-1.2717104,-0.044658728,0.22778314,0.56215423,-0.6181404,0.37758034,-0.56418365,-0.14707409,-0.48298508,-0.003713008,-1.6355104,-2.3401878,0.020875055,1.0987378,-0.068168,-0.25705624,-0.6406843,-0.05842889,0.046699405,0.30345416,-0.596434,-0.41274422,0.08122185,0.43440035,-0.5265702,0.0362359,-0.0654276,0.017466605,0.5859141,-0.49892268,-0.07515541,0.6399467,0.13092819,-0.02034505,0.58803767,-0.49216923,0.0382146,0.038736127,0.13882983,-0.6310905,0.26340827,0.32647747,0.024176609,0.10194284,-4.3208013,-0.040059604,0.69316846,-0.21621847,0.4555591,0.21492131,-0.28525597,0.19751486,-0.4944448,-0.21758324,-0.2561371,0.35391644,0.4861079,0.069663204,0.7510352,-0.108434245,0.4958588,-0.23860747,-0.17986467,0.8263099,0.31614143,0.0266728,-0.4415525,0.32278436,-0.059656236,-0.72129464,0.35087603,0.118561104,0.072357774,0.25650117,0.0114029525,-0.050457455,-0.36058816,-0.029316857,0.05345415,0.91371477,0.099857435,3.0752783,0.68999904,0.4103311,0.50830394,-0.4709496,0.8439158,-0.7339027,0.27937278,-0.42391467,0.64193827,-0.010285383,0.6696393,-0.16732915,0.38181823,0.46825826,0.44639584,-0.04503636,-0.7767281,-0.027618747,-0.45242998,0.5186432,-0.60994107,0.1560903,-0.70730853,-0.086867385,-0.33560067,-0.31328416,-0.4761167,0.35943118,-0.16717035,0.28757736,0.7505316,-0.4674905,-0.94920105,-0.24537762,-0.22457483,0.68390805,-0.055820018,-0.5679477,-0.5199877,-0.3298007,-0.23557621,-1.0684874,0.70712435,-0.6234385,0.17502213,-0.0074590556,0.5305823,-0.23091885,-0.26135948,-0.26235065,-0.42848885,0.3799429,0.3621992,0.20847175,0.74951464,-0.04785835,0.103263736,-0.074650764,-0.48663232,-0.04685007,0.003893502,-0.21457385,0.5851617,0.7577644,0.9477838,-0.39980376,0.5123923,0.17587909,0.40257978,-0.6337289,0.48085725,0.22692579,-0.1308599,-0.17204627,-0.3260076,-0.0532555,-0.034859188,0.14537829,0.38741913,-0.3559643,-1.2954301,0.65634984,-0.73787755,-0.6614718,-0.16321383,0.27331,0.39565712,-0.21289161,0.7244392,0.60400033,-0.63224274,1.6804485,-0.421256,-0.06698799,-0.49296844,-0.043947622,-0.2732744,0.22410235,0.609065,-0.17217714,-0.46537006,0.043895226,0.034387194,0.47640026,-0.6910904,-0.14865017,0.26914796,0.022420472,-0.07786381,-0.211391,0.5306046,0.14311999,0.014625061,0.6163252,0.38819557,-0.27364784,0.32498214,0.05358205,1.027975,0.20983253,0.2098367,0.15997908,-0.8947806,-0.6818938,-0.6106497,0.011262834,0.34579194,0.024799298,0.21171358,0.41551903,0.41326112,0.23885198,0.30851015,0.051665213,1.3319033,0.27679336,-0.063311286,0.10576472,-0.008384563,-0.8188471,0.11795208,0.05702358,-0.69708276,-0.1623407,-0.25308907,-0.5819838,0.5912054,-0.34703276,0.28800455,1.8632154,0.52673703,-0.31558284,0.41940686,0.034290798,0.10077952,0.35029146,-1.1312464,0.110920474,-0.52502084,0.26309755,0.07871712,-0.1673185,-0.2582632,0.16581045,0.07132866,-0.4274863,-0.77864736,0.62542224,0.29736987,-0.48618934,0.21518765,1.3097459,0.804146,-0.019944578,-0.20996451,-0.25136352,0.3375256,0.33029765,-0.31664985,0.23771079,0.5451549,-0.15576157,0.52026814,0.15959534,0.397811,-0.08771992,-0.30593848,-0.015177786,-0.9437044,-0.13004494,-0.0895731,-0.102244705,-0.58599967,0.7524687,1.7816204,0.73901916,0.8541392,0.30481288,-0.05781647,0.6458275,-0.3604158,0.74742454,-0.40308708,0.39093086,-1.0534573,-0.5323918,0.4550317,-0.63979226,-0.043461435,-0.24512357,-0.037757806,0.47987717,0.23262349,0.48169845,0.14022627,-0.667673,-0.7440694,0.26770002,-0.055000126,-2.257101,0.15032548,-0.59528404,-0.44336444,-0.0726046,-0.17490539,0.35630667,0.1335873,0.29353437,-0.25075904,1.7107471,0.16393793,-0.32271257,-0.70558083,0.018164277,0.875983,0.59886837,0.23601161,0.06945345,-0.7084349,0.008139738,-0.13749018,0.7753262,0.03842848,0.14583483,-0.14556053,0.008987986,-0.33083373,-0.889037,0.27736363,-0.32143906,-0.058217615,-0.044049975,0.2679112,-0.5327888,1.3052187,0.3804539,-0.33331263,0.07149097,-0.3488194,1.4735043,-0.11365883,-0.19220917,-0.47264743,-0.23412628,-0.087442644,-0.09439272,0.17180006,-0.43823156,-0.20659213,0.3114082,-0.102425635,-0.34236217,0.1895842,0.28456134,0.6217086,0.6311034,0.21342117,0.42619845,0.3926774,-0.1294566,0.02903571,-0.30436456,-0.9850829,0.3401345],"result":{"type":"object","properties":{"balances":{"additionalProperties":{"description":"Balance amount for a specific token","type":"number"},"description":"Map of token symbols to their respective balances","required":[],"type":"object"},"message":{"description":"Status message about the balance retrieval operation","type":"string"}},"required":["message","balances"]},"sql_tables":null,"sql_queries":null,"file_inbox":null,"oauth":null,"assets":null},false]} \ No newline at end of file +{"type":"Deno","content":[{"name":"Coinbase Balance Getter","homepage":null,"author":"@@official.shinkai","version":"1.0.0","js_code":"import { Coinbase, CoinbaseOptions } from 'npm:@coinbase/coinbase-sdk@0.0.16';\n\ntype WalletBalances = { [key: string]: number };\n\ntype Configurations = {\n name: string;\n privateKey: string;\n walletId?: string;\n useServerSigner?: string;\n};\ntype Parameters = {\n walletId?: string;\n};\ntype Result = {\n message: string;\n balances: WalletBalances | null;\n};\nexport type Run, I extends Record, R extends Record> = (config: C, inputs: I) => Promise;\n\nexport const run: Run = async (\n configurations,\n params,\n): Promise => {\n const coinbaseOptions: CoinbaseOptions = {\n apiKeyName: configurations.name,\n privateKey: configurations.privateKey,\n useServerSigner: configurations.useServerSigner === 'true',\n debugging: true,\n };\n const coinbase = new Coinbase(coinbaseOptions);\n const user = await coinbase.getDefaultUser();\n\n // Prioritize walletId from Params over Config\n const walletId = params.walletId || configurations.walletId;\n\n // Throw an error if walletId is not defined\n if (!walletId) {\n throw new Error('walletId must be defined in either params or config');\n }\n\n const wallet = await user.getWallet(walletId);\n console.log(`Wallet retrieved: `, wallet.toString());\n\n // Retrieve the list of balances for the wallet\n const balances = await wallet.listBalances();\n console.log(`Balances: `, balances);\n\n // Convert balances to WalletBalances\n const balanceMap: WalletBalances = {};\n for (const [currency, amount] of balances) {\n balanceMap[currency] = amount.toNumber();\n }\n\n return {\n message: `Balances: ${JSON.stringify(balanceMap)}`,\n balances: balanceMap,\n };\n};\n","tools":[],"config":[{"BasicConfig":{"key_name":"name","description":"The name of the Coinbase wallet","required":true,"type":null,"key_value":null}},{"BasicConfig":{"key_name":"privateKey","description":"The private key of the Coinbase wallet","required":true,"type":null,"key_value":null}},{"BasicConfig":{"key_name":"walletId","description":"Optional wallet ID for specific wallet selection","required":false,"type":null,"key_value":null}},{"BasicConfig":{"key_name":"useServerSigner","description":"Optional server signer configuration","required":false,"type":null,"key_value":null}}],"description":"Tool for getting the balance of a Coinbase wallet after restoring it","keywords":["coinbase","balance","shinkai"],"input_args":{"type":"object","properties":{"walletId":{"type":"string","description":"Optional wallet ID to get balance for a specific wallet"}},"required":[]},"output_arg":{"json":""},"activated":false,"embedding":[-0.1122051,0.21792355,-0.019444812,-0.32676318,0.017230723,-0.042694233,0.12454068,0.23506877,-0.049858324,-0.39198625,-0.2356008,0.14091831,0.025426041,-0.14607342,0.2663238,-0.17875119,0.13934344,-0.46660352,-1.2717104,-0.044658728,0.22778314,0.56215423,-0.6181404,0.37758034,-0.56418365,-0.14707409,-0.48298508,-0.003713008,-1.6355104,-2.3401878,0.020875055,1.0987378,-0.068168,-0.25705624,-0.6406843,-0.05842889,0.046699405,0.30345416,-0.596434,-0.41274422,0.08122185,0.43440035,-0.5265702,0.0362359,-0.0654276,0.017466605,0.5859141,-0.49892268,-0.07515541,0.6399467,0.13092819,-0.02034505,0.58803767,-0.49216923,0.0382146,0.038736127,0.13882983,-0.6310905,0.26340827,0.32647747,0.024176609,0.10194284,-4.3208013,-0.040059604,0.69316846,-0.21621847,0.4555591,0.21492131,-0.28525597,0.19751486,-0.4944448,-0.21758324,-0.2561371,0.35391644,0.4861079,0.069663204,0.7510352,-0.108434245,0.4958588,-0.23860747,-0.17986467,0.8263099,0.31614143,0.0266728,-0.4415525,0.32278436,-0.059656236,-0.72129464,0.35087603,0.118561104,0.072357774,0.25650117,0.0114029525,-0.050457455,-0.36058816,-0.029316857,0.05345415,0.91371477,0.099857435,3.0752783,0.68999904,0.4103311,0.50830394,-0.4709496,0.8439158,-0.7339027,0.27937278,-0.42391467,0.64193827,-0.010285383,0.6696393,-0.16732915,0.38181823,0.46825826,0.44639584,-0.04503636,-0.7767281,-0.027618747,-0.45242998,0.5186432,-0.60994107,0.1560903,-0.70730853,-0.086867385,-0.33560067,-0.31328416,-0.4761167,0.35943118,-0.16717035,0.28757736,0.7505316,-0.4674905,-0.94920105,-0.24537762,-0.22457483,0.68390805,-0.055820018,-0.5679477,-0.5199877,-0.3298007,-0.23557621,-1.0684874,0.70712435,-0.6234385,0.17502213,-0.0074590556,0.5305823,-0.23091885,-0.26135948,-0.26235065,-0.42848885,0.3799429,0.3621992,0.20847175,0.74951464,-0.04785835,0.103263736,-0.074650764,-0.48663232,-0.04685007,0.003893502,-0.21457385,0.5851617,0.7577644,0.9477838,-0.39980376,0.5123923,0.17587909,0.40257978,-0.6337289,0.48085725,0.22692579,-0.1308599,-0.17204627,-0.3260076,-0.0532555,-0.034859188,0.14537829,0.38741913,-0.3559643,-1.2954301,0.65634984,-0.73787755,-0.6614718,-0.16321383,0.27331,0.39565712,-0.21289161,0.7244392,0.60400033,-0.63224274,1.6804485,-0.421256,-0.06698799,-0.49296844,-0.043947622,-0.2732744,0.22410235,0.609065,-0.17217714,-0.46537006,0.043895226,0.034387194,0.47640026,-0.6910904,-0.14865017,0.26914796,0.022420472,-0.07786381,-0.211391,0.5306046,0.14311999,0.014625061,0.6163252,0.38819557,-0.27364784,0.32498214,0.05358205,1.027975,0.20983253,0.2098367,0.15997908,-0.8947806,-0.6818938,-0.6106497,0.011262834,0.34579194,0.024799298,0.21171358,0.41551903,0.41326112,0.23885198,0.30851015,0.051665213,1.3319033,0.27679336,-0.063311286,0.10576472,-0.008384563,-0.8188471,0.11795208,0.05702358,-0.69708276,-0.1623407,-0.25308907,-0.5819838,0.5912054,-0.34703276,0.28800455,1.8632154,0.52673703,-0.31558284,0.41940686,0.034290798,0.10077952,0.35029146,-1.1312464,0.110920474,-0.52502084,0.26309755,0.07871712,-0.1673185,-0.2582632,0.16581045,0.07132866,-0.4274863,-0.77864736,0.62542224,0.29736987,-0.48618934,0.21518765,1.3097459,0.804146,-0.019944578,-0.20996451,-0.25136352,0.3375256,0.33029765,-0.31664985,0.23771079,0.5451549,-0.15576157,0.52026814,0.15959534,0.397811,-0.08771992,-0.30593848,-0.015177786,-0.9437044,-0.13004494,-0.0895731,-0.102244705,-0.58599967,0.7524687,1.7816204,0.73901916,0.8541392,0.30481288,-0.05781647,0.6458275,-0.3604158,0.74742454,-0.40308708,0.39093086,-1.0534573,-0.5323918,0.4550317,-0.63979226,-0.043461435,-0.24512357,-0.037757806,0.47987717,0.23262349,0.48169845,0.14022627,-0.667673,-0.7440694,0.26770002,-0.055000126,-2.257101,0.15032548,-0.59528404,-0.44336444,-0.0726046,-0.17490539,0.35630667,0.1335873,0.29353437,-0.25075904,1.7107471,0.16393793,-0.32271257,-0.70558083,0.018164277,0.875983,0.59886837,0.23601161,0.06945345,-0.7084349,0.008139738,-0.13749018,0.7753262,0.03842848,0.14583483,-0.14556053,0.008987986,-0.33083373,-0.889037,0.27736363,-0.32143906,-0.058217615,-0.044049975,0.2679112,-0.5327888,1.3052187,0.3804539,-0.33331263,0.07149097,-0.3488194,1.4735043,-0.11365883,-0.19220917,-0.47264743,-0.23412628,-0.087442644,-0.09439272,0.17180006,-0.43823156,-0.20659213,0.3114082,-0.102425635,-0.34236217,0.1895842,0.28456134,0.6217086,0.6311034,0.21342117,0.42619845,0.3926774,-0.1294566,0.02903571,-0.30436456,-0.9850829,0.3401345],"result":{"type":"object","properties":{"balances":{"additionalProperties":{"description":"Balance amount for a specific token","type":"number"},"description":"Map of token symbols to their respective balances","required":[],"type":"object"},"message":{"description":"Status message about the balance retrieval operation","type":"string"}},"required":["message","balances"]},"sql_tables":null,"sql_queries":null,"file_inbox":null,"oauth":null,"assets":null,"runner":"any","operating_system":["linux","macos","windows"],"tool_set":""},false]} \ No newline at end of file diff --git a/tools/coinbase-get-balance/metadata.json b/tools/coinbase-get-balance/metadata.json index 2b4a8fd0..8827d286 100644 --- a/tools/coinbase-get-balance/metadata.json +++ b/tools/coinbase-get-balance/metadata.json @@ -9,7 +9,10 @@ "balance", "shinkai" ], - "configurations": { + "runner": "any", + "operating_system": ["linux", "macos", "windows"], + "tool_set": "", + "configurations": { "type": "object", "properties": { "name": { diff --git a/tools/coinbase-get-my-address/.tool-dump.test.json b/tools/coinbase-get-my-address/.tool-dump.test.json index 6121419f..7800ab66 100644 --- a/tools/coinbase-get-my-address/.tool-dump.test.json +++ b/tools/coinbase-get-my-address/.tool-dump.test.json @@ -1 +1 @@ -{"type":"Deno","content":[{"name":"Coinbase My Address Getter","homepage":null,"author":"@@official.shinkai","version":"1.0.0","js_code":"import { Coinbase, CoinbaseOptions } from 'npm:@coinbase/coinbase-sdk@0.0.16';\n\ntype Configurations = {\n name: string;\n privateKey: string;\n walletId?: string;\n useServerSigner?: string;\n};\ntype Parameters = {\n walletId?: string;\n};\ntype Result = {\n address: string;\n};\nexport type Run, I extends Record, R extends Record> = (config: C, inputs: I) => Promise;\n\nexport const run: Run = async (\n configurations: Configurations,\n params: Parameters,\n): Promise => {\n const coinbaseOptions: CoinbaseOptions = {\n apiKeyName: configurations.name,\n privateKey: configurations.privateKey,\n useServerSigner: configurations.useServerSigner === 'true',\n };\n const coinbase = new Coinbase(coinbaseOptions);\n const user = await coinbase.getDefaultUser();\n\n // Prioritize walletId from Params over Config\n const walletId = params.walletId || configurations.walletId;\n\n // Throw an error if walletId is not defined\n if (!walletId) {\n throw new Error('walletId must be defined in either params or config');\n }\n\n const wallet = await user.getWallet(walletId);\n console.log(`Wallet retrieved: `, wallet.toString());\n\n // Retrieve the list of balances for the wallet\n const address = await wallet.getDefaultAddress();\n console.log(`Default Address: `, address);\n\n return {\n address: address?.getId() || '',\n };\n};\n","tools":[],"config":[{"BasicConfig":{"key_name":"name","description":"The name of the Coinbase wallet","required":true,"type":null,"key_value":null}},{"BasicConfig":{"key_name":"privateKey","description":"The private key of the Coinbase wallet","required":true,"type":null,"key_value":null}},{"BasicConfig":{"key_name":"walletId","description":"Optional wallet ID for specific wallet selection","required":false,"type":null,"key_value":null}},{"BasicConfig":{"key_name":"useServerSigner","description":"Optional server signer configuration","required":false,"type":null,"key_value":null}}],"description":"Tool for getting the default address of a Coinbase wallet","keywords":["coinbase","address","shinkai"],"input_args":{"type":"object","properties":{"walletId":{"type":"string","description":"The ID of the Coinbase wallet to get the address from"}},"required":[]},"output_arg":{"json":""},"activated":false,"embedding":[-0.17932753,0.15964293,-0.41342285,-0.35331523,-0.10128805,-0.103858195,0.0112680495,0.82166934,0.03933646,-0.08853404,-0.3104675,0.008514911,0.17749289,0.06472419,0.15668456,-0.57975745,0.119621426,-0.7146136,-0.67832845,0.34949583,0.24846318,1.2754143,-0.4169299,-0.045812353,-0.2568414,-0.29605535,-0.22251318,-0.39910167,-1.4526182,-2.3240116,0.22368193,1.2659607,-0.10700137,0.04635729,-0.7943327,0.056435622,0.11881925,0.37792012,-0.5881921,-0.67314845,0.22995919,0.22469546,-0.25196442,-0.2977796,-0.2808156,0.16371796,0.5224911,-0.17036061,0.08240048,0.55401254,0.5550245,-0.06726978,0.37150687,-1.0110029,-0.19860011,0.3690119,0.062547445,-0.32751927,-0.13983053,0.65957195,-0.11019101,0.28199273,-4.1167026,-0.010445392,1.1536654,-0.044021882,-0.19383013,-0.20445186,-0.45228192,0.3846407,-0.28967196,-0.3215696,-0.50890607,0.55178374,0.6466307,0.50096804,0.40960896,-0.015315123,0.9545287,-0.082977295,-0.013413724,0.64457166,0.17772853,0.32607895,0.028716639,0.20834231,-0.280965,0.022425786,0.06716788,0.67692375,-0.039648425,-0.1904221,-0.42792153,0.3081607,-0.34659982,-0.07910152,-0.13672504,0.87124807,0.25957933,2.7408013,0.82253426,0.33271676,0.3830495,-1.0432297,1.0111794,-0.3639133,-0.27953902,-0.38907802,0.5439809,-0.1665577,0.2764875,-0.3984063,0.5602261,0.39349622,0.06076364,0.14092079,-0.33769405,-0.4078202,-0.24881178,0.5352551,-0.41751012,-0.06376307,-0.91029376,-0.3063765,-0.229336,-0.03493604,0.036654722,0.3033824,-0.12646031,0.16920257,0.8081108,-0.68709177,-0.87597513,-0.20345353,0.05654283,0.5672903,0.25627428,-0.47784224,-0.48938382,-0.23010993,0.033031926,-1.432347,0.8707811,-0.11786066,0.53551245,-0.18216951,0.56844187,-0.45306367,-0.871271,0.06953817,-0.01883347,0.10133599,0.8850505,0.3210193,0.5014882,-0.68166435,0.067953594,-0.26241648,-0.09095915,0.04191948,-0.085172355,-0.29178366,0.49644402,1.0346931,0.49191988,-0.21278837,0.1552579,0.42457995,0.37517163,-0.6189191,0.65872675,0.2103756,0.4102558,0.28160647,-0.45155466,-0.2631366,-0.13053115,-0.17375982,0.34568825,-0.3599729,-1.2549177,0.38902745,-0.564535,-0.63555527,0.17842765,-0.086037025,0.6811883,0.0031095045,0.45187286,0.16761576,-0.6281824,1.3175262,-0.2932405,-0.11214225,-0.59985596,-0.12824976,-0.2609207,0.34946337,0.73185855,0.10807916,-0.6177121,-0.3831613,0.05921615,0.53959525,-0.6342268,-0.07955518,0.3043292,0.6878448,-0.46822035,0.06468081,0.76058364,-0.7113683,0.29584336,0.44136515,0.69938636,-0.22730197,0.3251933,0.11502963,0.77010596,-0.032495484,0.1063212,-0.19553521,-1.0336113,-0.5114762,-1.0078665,-0.18042813,0.49700218,0.45784438,-0.23957342,0.4018757,-0.06607162,0.15405571,0.6597649,0.2194557,0.95349145,0.806748,-0.1722436,-0.027636163,-0.032721918,-0.8663484,0.033776123,0.081975594,-0.49234384,-0.37394935,0.35717422,-0.77462137,0.7966627,-0.15514413,0.08736948,1.6222768,0.55413777,-0.029605638,-0.007258404,0.22146,0.1714007,-0.025337152,-1.3562571,0.0052703926,-0.028748669,0.99206585,0.04683815,-0.0476064,-0.037525747,0.4543084,0.00021454127,-0.5230759,-0.7134363,-0.0066314265,0.24200809,-0.4915258,0.03015158,1.1206086,0.92073715,-0.08053277,-0.5278128,-0.32479218,0.17775685,0.36103645,-0.32219997,0.053983346,0.2498126,-0.120526075,0.90176004,0.105171755,0.18076822,-0.14823234,-0.035519555,0.15436316,-1.0244967,-0.06540312,-0.09376261,-0.6566599,-0.28878072,1.0337374,1.6364617,0.88323754,0.49055243,0.27557373,0.022975512,0.92566395,-0.13089591,0.46502104,-0.4719314,0.30416837,-0.93894005,-0.5786668,0.47886258,-0.5090064,-0.3169286,-0.115220055,0.22271526,0.7059446,0.26687512,0.37598094,-0.2801255,-0.5246223,-0.7853387,0.13136622,-0.29093853,-2.1983619,-0.061054446,-0.6261363,-0.60235673,-0.32901666,-0.36539868,0.47864866,0.0012961347,0.29893708,-0.119530365,1.6799016,0.31920388,-0.53568,-0.44493467,0.2224508,0.7926569,0.6158743,0.31482908,0.18538722,-0.78197426,-0.07565202,0.048063297,1.2009664,0.1422099,0.052135646,-0.17165433,-0.039600164,-0.4821769,-1.4015799,-0.07014266,-0.11032796,-0.20598231,-0.18786888,-0.19679819,-0.29310876,1.2269748,0.7410622,-0.7246054,-0.43472102,-0.3305997,1.2603365,0.12693687,-0.09097959,-0.48109823,-0.9074406,0.096925765,0.067318454,0.22055043,0.2542562,0.24284221,-0.23175079,0.007990668,-0.15167749,0.2416907,0.010765458,0.41447288,0.30766064,0.110257745,0.2081362,0.66511655,-0.21753985,0.26317722,-0.09763156,-0.93785083,0.6041742],"result":{"type":"object","properties":{"address":{"description":"The Ethereum address of the Coinbase wallet","type":"string"}},"required":["address"]},"sql_tables":null,"sql_queries":null,"file_inbox":null,"oauth":null,"assets":null},false]} \ No newline at end of file +{"type":"Deno","content":[{"name":"Coinbase My Address Getter","homepage":null,"author":"@@official.shinkai","version":"1.0.0","js_code":"import { Coinbase, CoinbaseOptions } from 'npm:@coinbase/coinbase-sdk@0.0.16';\n\ntype Configurations = {\n name: string;\n privateKey: string;\n walletId?: string;\n useServerSigner?: string;\n};\ntype Parameters = {\n walletId?: string;\n};\ntype Result = {\n address: string;\n};\nexport type Run, I extends Record, R extends Record> = (config: C, inputs: I) => Promise;\n\nexport const run: Run = async (\n configurations: Configurations,\n params: Parameters,\n): Promise => {\n const coinbaseOptions: CoinbaseOptions = {\n apiKeyName: configurations.name,\n privateKey: configurations.privateKey,\n useServerSigner: configurations.useServerSigner === 'true',\n };\n const coinbase = new Coinbase(coinbaseOptions);\n const user = await coinbase.getDefaultUser();\n\n // Prioritize walletId from Params over Config\n const walletId = params.walletId || configurations.walletId;\n\n // Throw an error if walletId is not defined\n if (!walletId) {\n throw new Error('walletId must be defined in either params or config');\n }\n\n const wallet = await user.getWallet(walletId);\n console.log(`Wallet retrieved: `, wallet.toString());\n\n // Retrieve the list of balances for the wallet\n const address = await wallet.getDefaultAddress();\n console.log(`Default Address: `, address);\n\n return {\n address: address?.getId() || '',\n };\n};\n","tools":[],"config":[{"BasicConfig":{"key_name":"name","description":"The name of the Coinbase wallet","required":true,"type":null,"key_value":null}},{"BasicConfig":{"key_name":"privateKey","description":"The private key of the Coinbase wallet","required":true,"type":null,"key_value":null}},{"BasicConfig":{"key_name":"walletId","description":"Optional wallet ID for specific wallet selection","required":false,"type":null,"key_value":null}},{"BasicConfig":{"key_name":"useServerSigner","description":"Optional server signer configuration","required":false,"type":null,"key_value":null}}],"description":"Tool for getting the default address of a Coinbase wallet","keywords":["coinbase","address","shinkai"],"input_args":{"type":"object","properties":{"walletId":{"type":"string","description":"The ID of the Coinbase wallet to get the address from"}},"required":[]},"output_arg":{"json":""},"activated":false,"embedding":[-0.17932753,0.15964293,-0.41342285,-0.35331523,-0.10128805,-0.103858195,0.0112680495,0.82166934,0.03933646,-0.08853404,-0.3104675,0.008514911,0.17749289,0.06472419,0.15668456,-0.57975745,0.119621426,-0.7146136,-0.67832845,0.34949583,0.24846318,1.2754143,-0.4169299,-0.045812353,-0.2568414,-0.29605535,-0.22251318,-0.39910167,-1.4526182,-2.3240116,0.22368193,1.2659607,-0.10700137,0.04635729,-0.7943327,0.056435622,0.11881925,0.37792012,-0.5881921,-0.67314845,0.22995919,0.22469546,-0.25196442,-0.2977796,-0.2808156,0.16371796,0.5224911,-0.17036061,0.08240048,0.55401254,0.5550245,-0.06726978,0.37150687,-1.0110029,-0.19860011,0.3690119,0.062547445,-0.32751927,-0.13983053,0.65957195,-0.11019101,0.28199273,-4.1167026,-0.010445392,1.1536654,-0.044021882,-0.19383013,-0.20445186,-0.45228192,0.3846407,-0.28967196,-0.3215696,-0.50890607,0.55178374,0.6466307,0.50096804,0.40960896,-0.015315123,0.9545287,-0.082977295,-0.013413724,0.64457166,0.17772853,0.32607895,0.028716639,0.20834231,-0.280965,0.022425786,0.06716788,0.67692375,-0.039648425,-0.1904221,-0.42792153,0.3081607,-0.34659982,-0.07910152,-0.13672504,0.87124807,0.25957933,2.7408013,0.82253426,0.33271676,0.3830495,-1.0432297,1.0111794,-0.3639133,-0.27953902,-0.38907802,0.5439809,-0.1665577,0.2764875,-0.3984063,0.5602261,0.39349622,0.06076364,0.14092079,-0.33769405,-0.4078202,-0.24881178,0.5352551,-0.41751012,-0.06376307,-0.91029376,-0.3063765,-0.229336,-0.03493604,0.036654722,0.3033824,-0.12646031,0.16920257,0.8081108,-0.68709177,-0.87597513,-0.20345353,0.05654283,0.5672903,0.25627428,-0.47784224,-0.48938382,-0.23010993,0.033031926,-1.432347,0.8707811,-0.11786066,0.53551245,-0.18216951,0.56844187,-0.45306367,-0.871271,0.06953817,-0.01883347,0.10133599,0.8850505,0.3210193,0.5014882,-0.68166435,0.067953594,-0.26241648,-0.09095915,0.04191948,-0.085172355,-0.29178366,0.49644402,1.0346931,0.49191988,-0.21278837,0.1552579,0.42457995,0.37517163,-0.6189191,0.65872675,0.2103756,0.4102558,0.28160647,-0.45155466,-0.2631366,-0.13053115,-0.17375982,0.34568825,-0.3599729,-1.2549177,0.38902745,-0.564535,-0.63555527,0.17842765,-0.086037025,0.6811883,0.0031095045,0.45187286,0.16761576,-0.6281824,1.3175262,-0.2932405,-0.11214225,-0.59985596,-0.12824976,-0.2609207,0.34946337,0.73185855,0.10807916,-0.6177121,-0.3831613,0.05921615,0.53959525,-0.6342268,-0.07955518,0.3043292,0.6878448,-0.46822035,0.06468081,0.76058364,-0.7113683,0.29584336,0.44136515,0.69938636,-0.22730197,0.3251933,0.11502963,0.77010596,-0.032495484,0.1063212,-0.19553521,-1.0336113,-0.5114762,-1.0078665,-0.18042813,0.49700218,0.45784438,-0.23957342,0.4018757,-0.06607162,0.15405571,0.6597649,0.2194557,0.95349145,0.806748,-0.1722436,-0.027636163,-0.032721918,-0.8663484,0.033776123,0.081975594,-0.49234384,-0.37394935,0.35717422,-0.77462137,0.7966627,-0.15514413,0.08736948,1.6222768,0.55413777,-0.029605638,-0.007258404,0.22146,0.1714007,-0.025337152,-1.3562571,0.0052703926,-0.028748669,0.99206585,0.04683815,-0.0476064,-0.037525747,0.4543084,0.00021454127,-0.5230759,-0.7134363,-0.0066314265,0.24200809,-0.4915258,0.03015158,1.1206086,0.92073715,-0.08053277,-0.5278128,-0.32479218,0.17775685,0.36103645,-0.32219997,0.053983346,0.2498126,-0.120526075,0.90176004,0.105171755,0.18076822,-0.14823234,-0.035519555,0.15436316,-1.0244967,-0.06540312,-0.09376261,-0.6566599,-0.28878072,1.0337374,1.6364617,0.88323754,0.49055243,0.27557373,0.022975512,0.92566395,-0.13089591,0.46502104,-0.4719314,0.30416837,-0.93894005,-0.5786668,0.47886258,-0.5090064,-0.3169286,-0.115220055,0.22271526,0.7059446,0.26687512,0.37598094,-0.2801255,-0.5246223,-0.7853387,0.13136622,-0.29093853,-2.1983619,-0.061054446,-0.6261363,-0.60235673,-0.32901666,-0.36539868,0.47864866,0.0012961347,0.29893708,-0.119530365,1.6799016,0.31920388,-0.53568,-0.44493467,0.2224508,0.7926569,0.6158743,0.31482908,0.18538722,-0.78197426,-0.07565202,0.048063297,1.2009664,0.1422099,0.052135646,-0.17165433,-0.039600164,-0.4821769,-1.4015799,-0.07014266,-0.11032796,-0.20598231,-0.18786888,-0.19679819,-0.29310876,1.2269748,0.7410622,-0.7246054,-0.43472102,-0.3305997,1.2603365,0.12693687,-0.09097959,-0.48109823,-0.9074406,0.096925765,0.067318454,0.22055043,0.2542562,0.24284221,-0.23175079,0.007990668,-0.15167749,0.2416907,0.010765458,0.41447288,0.30766064,0.110257745,0.2081362,0.66511655,-0.21753985,0.26317722,-0.09763156,-0.93785083,0.6041742],"result":{"type":"object","properties":{"address":{"description":"The Ethereum address of the Coinbase wallet","type":"string"}},"required":["address"]},"sql_tables":null,"sql_queries":null,"file_inbox":null,"oauth":null,"assets":null,"runner":"any","operating_system":["linux","macos","windows"],"tool_set":""},false]} \ No newline at end of file diff --git a/tools/coinbase-get-my-address/metadata.json b/tools/coinbase-get-my-address/metadata.json index 7afbafe7..fb0ce155 100644 --- a/tools/coinbase-get-my-address/metadata.json +++ b/tools/coinbase-get-my-address/metadata.json @@ -9,7 +9,10 @@ "address", "shinkai" ], - "configurations": { + "runner": "any", + "operating_system": ["linux", "macos", "windows"], + "tool_set": "", + "configurations": { "type": "object", "properties": { "name": { diff --git a/tools/coinbase-get-transactions/.tool-dump.test.json b/tools/coinbase-get-transactions/.tool-dump.test.json index 4f12ca39..993cd642 100644 --- a/tools/coinbase-get-transactions/.tool-dump.test.json +++ b/tools/coinbase-get-transactions/.tool-dump.test.json @@ -1 +1 @@ -{"type":"Deno","content":[{"name":"Coinbase Transactions Getter","homepage":null,"author":"@@official.shinkai","version":"1.0.0","js_code":"import { Coinbase, CoinbaseOptions } from 'npm:@coinbase/coinbase-sdk@0.0.16';\n\ntype Configurations = {\n name: string;\n privateKey: string;\n walletId: string;\n};\ntype Parameters = {};\ntype Result = { tableCsv: string; rowsCount: number; columnsCount: number };\nexport type Run, I extends Record, R extends Record> = (config: C, inputs: I) => Promise;\n\nexport const run: Run = async (\n configurations: Configurations,\n _parameters: Parameters,\n): Promise => {\n const coinbaseOptions: CoinbaseOptions = {\n apiKeyName: configurations.name,\n privateKey: configurations.privateKey,\n };\n const coinbase = new Coinbase(coinbaseOptions);\n const user = await coinbase.getDefaultUser();\n\n // Prioritize walletId from Params over Config\n const walletId = configurations.walletId;\n\n const wallet = await user.getWallet(walletId);\n console.log(`Wallet retrieved: `, wallet.toString());\n\n // Retrieve the list of balances for the wallet\n const address = await wallet.getDefaultAddress();\n const transactions = (await address?.listTransfers()) ?? [];\n\n // Convert transactions to CSV format\n const headers = [\n 'transferId',\n 'networkId',\n 'fromAddressId',\n 'destinationAddressId',\n 'assetId',\n 'amount',\n 'transactionHash',\n 'transactionLink',\n 'status',\n ];\n const rows = transactions.map((tx) => [\n tx.getId(),\n tx.getNetworkId(),\n tx.getFromAddressId(),\n tx.getDestinationAddressId(),\n tx.getAssetId(),\n tx.getAmount().toString(),\n tx.getTransactionHash(),\n tx.getTransactionLink(),\n tx.getStatus(),\n ]);\n const tableCsv = [headers, ...rows].map((row) => row.join(';')).join('\\n');\n\n return Promise.resolve({\n tableCsv,\n rowsCount: transactions.length,\n columnsCount: headers.length,\n });\n};\n","tools":[],"config":[{"BasicConfig":{"key_name":"name","description":"","required":true,"type":null,"key_value":null}},{"BasicConfig":{"key_name":"privateKey","description":"","required":true,"type":null,"key_value":null}},{"BasicConfig":{"key_name":"walletId","description":"","required":true,"type":null,"key_value":null}}],"description":"Tool for getting the transactions of a Coinbase wallet after restoring it","keywords":["coinbase","balance","shinkai"],"input_args":{"type":"object","properties":{},"required":[]},"output_arg":{"json":""},"activated":false,"embedding":[0.16925259,0.19336475,-0.3109297,-0.039204508,-0.13054809,-0.34281373,0.042999133,0.55347544,-0.1557864,-0.19078992,-0.24169588,0.16050482,-0.07783348,0.03402864,0.27587122,-0.4300525,0.06291229,-0.31605762,-1.3911097,0.30489752,0.4740519,0.83545697,-0.59563756,0.302229,-0.5362712,-0.19890837,-0.36951882,-0.042009443,-1.4895351,-2.2981503,0.1976608,1.2256205,-0.3871849,-0.20203742,-0.4412474,-0.24111533,0.06941593,0.33441943,-0.55429214,-0.49527937,0.058845058,0.46884236,-0.684995,-0.0112426225,0.04067769,-0.24195337,0.5260498,-0.48140416,0.2484336,0.6262324,0.0061545745,0.13629545,0.594229,-0.6498375,-0.06213381,-0.024935724,-0.08060902,-0.37224773,0.13439868,0.31999916,-0.03608239,0.0027501956,-4.02535,0.056213092,0.7044405,-0.15491644,0.36956802,0.44447035,-0.573741,0.5601373,-0.4608069,-0.32819134,-0.51722616,0.21799603,0.51517683,-0.15655679,0.7445531,0.36054525,0.39726555,-0.1972068,-0.055746485,0.948037,0.06723908,0.051220223,-0.5470468,0.39737868,-0.14596295,-0.46307644,0.24408227,0.2250982,0.21850787,0.23179495,0.07397965,-0.20215729,-0.26786885,-0.058684975,0.100640446,1.1255865,0.37955603,3.003583,0.6364159,0.70454,0.3449511,-0.783787,0.7464417,-0.5484832,-0.11802791,-0.23625429,0.46603435,-0.15890005,0.7391749,-0.3760193,0.7570015,0.28463024,0.1649248,0.10714777,-0.79222786,-0.034782384,-0.13381101,0.35152757,-0.46387595,0.27746758,-0.5403326,-0.14051175,-0.49187753,-0.27269116,-0.07913071,0.30645147,-0.15724663,-0.03861757,0.6580126,-0.6525049,-0.9734173,-0.007423454,0.0057444684,0.33180004,-0.15739943,-0.6685441,-0.62532794,-0.5481901,-0.07224342,-1.1472703,1.0721201,-0.1827153,0.15122741,-0.3352298,0.46748245,-0.3385545,-0.26504517,-0.10017018,-0.15581384,0.13035673,0.16592658,-0.11092252,0.5865137,-0.2662667,0.07384996,-0.28651136,-0.7367664,0.24822763,-0.21085498,-0.11118903,0.73593247,0.85091907,0.9836215,-0.7230869,0.5753839,0.20492187,0.31841344,-0.4341326,0.45453894,0.031533338,-0.107394956,0.021345347,-0.5059574,-0.05648998,-0.015153021,-0.26773927,0.01916881,-0.28712988,-0.9005168,0.562127,-0.6722366,-0.7458022,-0.03604183,0.16324425,0.24371967,-0.07625256,0.54241717,0.49677145,-0.72900534,1.8670322,-0.479501,0.11911194,-0.34157392,-0.22788636,-0.032269422,0.29448202,0.36847284,0.1312088,-0.2405462,0.113498315,-0.1389235,0.40899345,-0.6186118,-0.17319115,0.25173354,0.36724806,-0.3623917,-0.4949983,0.30823615,0.087303035,0.47603455,0.5068521,0.44679856,-0.14118029,0.5918366,-0.09932922,0.82454556,-0.023810968,0.7300393,0.37037715,-0.56222284,-0.54878527,-0.61380464,-0.19734882,0.49692428,0.5359911,0.062600285,0.109496295,0.017320544,0.47013986,0.50148237,0.38402793,1.4785789,0.29964286,-0.38948953,-0.06508373,0.11701274,-0.84249365,0.20711926,0.3408258,-0.3878427,-0.4466251,-0.20268774,-0.49308315,0.73473155,0.12266129,0.31830004,1.8686404,0.47210944,-0.22385243,0.6687528,-0.35555094,0.27971923,-0.13979477,-1.4279561,-0.06260148,-0.21564257,0.27409208,0.23448211,-0.14771119,0.17397054,0.28156644,0.2049909,-0.451668,-0.8093298,0.65968525,0.33277026,-0.2324273,0.06474328,1.376619,1.0473466,0.22885406,-0.53884,-0.19854085,0.3424329,0.1060681,-0.36822245,0.25285268,0.42234084,-0.34062836,0.89859575,0.3273117,0.43744135,-0.1265469,-0.056891445,0.22342396,-0.98753196,-0.2396236,-0.100594625,-0.77528757,-0.8034485,0.8871108,2.1022525,0.58989704,0.4520424,0.36766866,0.115321025,0.3877527,-0.31387237,0.82794565,-0.29245496,0.48306432,-1.0535579,-0.72926724,0.6384178,-0.63804954,-0.20296723,-0.13029386,0.09505867,0.55600166,0.23006043,0.41020006,0.15756688,-0.5267177,-0.52579707,0.39963287,-0.43876588,-2.097354,0.16948931,-0.65887713,-0.54331464,-0.24390483,0.0118664745,0.3423066,-0.2960305,0.25839934,-0.2573114,1.6646926,0.07939121,-0.9080276,-0.95527864,-0.12138058,1.0430968,0.32054827,0.15474294,-0.021429494,-0.39041814,0.001073323,-0.2588204,0.8949996,0.054565392,0.2298509,-0.28955892,-0.04975786,-0.40022087,-0.95158064,0.021978501,-0.48953414,-0.20269717,-0.2161554,0.2604083,-0.24258533,1.2542185,0.41163054,-0.4763426,-0.27171656,-0.43820408,1.1436303,0.090385795,-0.7019678,-0.45494652,-0.4181419,-0.07761314,-0.14312065,0.23557039,-0.3436189,-0.29927588,0.23723227,-0.021425545,-0.597897,0.0766636,-0.05515675,0.92934424,0.6106546,-0.013847895,0.6391535,0.6345254,-0.049954813,0.25116992,0.05438469,-0.701619,0.19964059],"result":{"type":"object","properties":{"columnsCount":{"type":"number"},"rowsCount":{"type":"number"},"tableCsv":{"type":"string"}},"required":["tableCsv","rowsCount","columnsCount"]},"sql_tables":null,"sql_queries":null,"file_inbox":null,"oauth":null,"assets":null},false]} \ No newline at end of file +{"type":"Deno","content":[{"name":"Coinbase Transactions Getter","homepage":null,"author":"@@official.shinkai","version":"1.0.0","js_code":"import { Coinbase, CoinbaseOptions } from 'npm:@coinbase/coinbase-sdk@0.0.16';\n\ntype Configurations = {\n name: string;\n privateKey: string;\n walletId: string;\n};\ntype Parameters = {};\ntype Result = { tableCsv: string; rowsCount: number; columnsCount: number };\nexport type Run, I extends Record, R extends Record> = (config: C, inputs: I) => Promise;\n\nexport const run: Run = async (\n configurations: Configurations,\n _parameters: Parameters,\n): Promise => {\n const coinbaseOptions: CoinbaseOptions = {\n apiKeyName: configurations.name,\n privateKey: configurations.privateKey,\n };\n const coinbase = new Coinbase(coinbaseOptions);\n const user = await coinbase.getDefaultUser();\n\n // Prioritize walletId from Params over Config\n const walletId = configurations.walletId;\n\n const wallet = await user.getWallet(walletId);\n console.log(`Wallet retrieved: `, wallet.toString());\n\n // Retrieve the list of balances for the wallet\n const address = await wallet.getDefaultAddress();\n const transactions = (await address?.listTransfers()) ?? [];\n\n // Convert transactions to CSV format\n const headers = [\n 'transferId',\n 'networkId',\n 'fromAddressId',\n 'destinationAddressId',\n 'assetId',\n 'amount',\n 'transactionHash',\n 'transactionLink',\n 'status',\n ];\n const rows = transactions.map((tx) => [\n tx.getId(),\n tx.getNetworkId(),\n tx.getFromAddressId(),\n tx.getDestinationAddressId(),\n tx.getAssetId(),\n tx.getAmount().toString(),\n tx.getTransactionHash(),\n tx.getTransactionLink(),\n tx.getStatus(),\n ]);\n const tableCsv = [headers, ...rows].map((row) => row.join(';')).join('\\n');\n\n return Promise.resolve({\n tableCsv,\n rowsCount: transactions.length,\n columnsCount: headers.length,\n });\n};\n","tools":[],"config":[{"BasicConfig":{"key_name":"name","description":"","required":true,"type":null,"key_value":null}},{"BasicConfig":{"key_name":"privateKey","description":"","required":true,"type":null,"key_value":null}},{"BasicConfig":{"key_name":"walletId","description":"","required":true,"type":null,"key_value":null}}],"description":"Tool for getting the transactions of a Coinbase wallet after restoring it","keywords":["coinbase","balance","shinkai"],"input_args":{"type":"object","properties":{},"required":[]},"output_arg":{"json":""},"activated":false,"embedding":[0.16925259,0.19336475,-0.3109297,-0.039204508,-0.13054809,-0.34281373,0.042999133,0.55347544,-0.1557864,-0.19078992,-0.24169588,0.16050482,-0.07783348,0.03402864,0.27587122,-0.4300525,0.06291229,-0.31605762,-1.3911097,0.30489752,0.4740519,0.83545697,-0.59563756,0.302229,-0.5362712,-0.19890837,-0.36951882,-0.042009443,-1.4895351,-2.2981503,0.1976608,1.2256205,-0.3871849,-0.20203742,-0.4412474,-0.24111533,0.06941593,0.33441943,-0.55429214,-0.49527937,0.058845058,0.46884236,-0.684995,-0.0112426225,0.04067769,-0.24195337,0.5260498,-0.48140416,0.2484336,0.6262324,0.0061545745,0.13629545,0.594229,-0.6498375,-0.06213381,-0.024935724,-0.08060902,-0.37224773,0.13439868,0.31999916,-0.03608239,0.0027501956,-4.02535,0.056213092,0.7044405,-0.15491644,0.36956802,0.44447035,-0.573741,0.5601373,-0.4608069,-0.32819134,-0.51722616,0.21799603,0.51517683,-0.15655679,0.7445531,0.36054525,0.39726555,-0.1972068,-0.055746485,0.948037,0.06723908,0.051220223,-0.5470468,0.39737868,-0.14596295,-0.46307644,0.24408227,0.2250982,0.21850787,0.23179495,0.07397965,-0.20215729,-0.26786885,-0.058684975,0.100640446,1.1255865,0.37955603,3.003583,0.6364159,0.70454,0.3449511,-0.783787,0.7464417,-0.5484832,-0.11802791,-0.23625429,0.46603435,-0.15890005,0.7391749,-0.3760193,0.7570015,0.28463024,0.1649248,0.10714777,-0.79222786,-0.034782384,-0.13381101,0.35152757,-0.46387595,0.27746758,-0.5403326,-0.14051175,-0.49187753,-0.27269116,-0.07913071,0.30645147,-0.15724663,-0.03861757,0.6580126,-0.6525049,-0.9734173,-0.007423454,0.0057444684,0.33180004,-0.15739943,-0.6685441,-0.62532794,-0.5481901,-0.07224342,-1.1472703,1.0721201,-0.1827153,0.15122741,-0.3352298,0.46748245,-0.3385545,-0.26504517,-0.10017018,-0.15581384,0.13035673,0.16592658,-0.11092252,0.5865137,-0.2662667,0.07384996,-0.28651136,-0.7367664,0.24822763,-0.21085498,-0.11118903,0.73593247,0.85091907,0.9836215,-0.7230869,0.5753839,0.20492187,0.31841344,-0.4341326,0.45453894,0.031533338,-0.107394956,0.021345347,-0.5059574,-0.05648998,-0.015153021,-0.26773927,0.01916881,-0.28712988,-0.9005168,0.562127,-0.6722366,-0.7458022,-0.03604183,0.16324425,0.24371967,-0.07625256,0.54241717,0.49677145,-0.72900534,1.8670322,-0.479501,0.11911194,-0.34157392,-0.22788636,-0.032269422,0.29448202,0.36847284,0.1312088,-0.2405462,0.113498315,-0.1389235,0.40899345,-0.6186118,-0.17319115,0.25173354,0.36724806,-0.3623917,-0.4949983,0.30823615,0.087303035,0.47603455,0.5068521,0.44679856,-0.14118029,0.5918366,-0.09932922,0.82454556,-0.023810968,0.7300393,0.37037715,-0.56222284,-0.54878527,-0.61380464,-0.19734882,0.49692428,0.5359911,0.062600285,0.109496295,0.017320544,0.47013986,0.50148237,0.38402793,1.4785789,0.29964286,-0.38948953,-0.06508373,0.11701274,-0.84249365,0.20711926,0.3408258,-0.3878427,-0.4466251,-0.20268774,-0.49308315,0.73473155,0.12266129,0.31830004,1.8686404,0.47210944,-0.22385243,0.6687528,-0.35555094,0.27971923,-0.13979477,-1.4279561,-0.06260148,-0.21564257,0.27409208,0.23448211,-0.14771119,0.17397054,0.28156644,0.2049909,-0.451668,-0.8093298,0.65968525,0.33277026,-0.2324273,0.06474328,1.376619,1.0473466,0.22885406,-0.53884,-0.19854085,0.3424329,0.1060681,-0.36822245,0.25285268,0.42234084,-0.34062836,0.89859575,0.3273117,0.43744135,-0.1265469,-0.056891445,0.22342396,-0.98753196,-0.2396236,-0.100594625,-0.77528757,-0.8034485,0.8871108,2.1022525,0.58989704,0.4520424,0.36766866,0.115321025,0.3877527,-0.31387237,0.82794565,-0.29245496,0.48306432,-1.0535579,-0.72926724,0.6384178,-0.63804954,-0.20296723,-0.13029386,0.09505867,0.55600166,0.23006043,0.41020006,0.15756688,-0.5267177,-0.52579707,0.39963287,-0.43876588,-2.097354,0.16948931,-0.65887713,-0.54331464,-0.24390483,0.0118664745,0.3423066,-0.2960305,0.25839934,-0.2573114,1.6646926,0.07939121,-0.9080276,-0.95527864,-0.12138058,1.0430968,0.32054827,0.15474294,-0.021429494,-0.39041814,0.001073323,-0.2588204,0.8949996,0.054565392,0.2298509,-0.28955892,-0.04975786,-0.40022087,-0.95158064,0.021978501,-0.48953414,-0.20269717,-0.2161554,0.2604083,-0.24258533,1.2542185,0.41163054,-0.4763426,-0.27171656,-0.43820408,1.1436303,0.090385795,-0.7019678,-0.45494652,-0.4181419,-0.07761314,-0.14312065,0.23557039,-0.3436189,-0.29927588,0.23723227,-0.021425545,-0.597897,0.0766636,-0.05515675,0.92934424,0.6106546,-0.013847895,0.6391535,0.6345254,-0.049954813,0.25116992,0.05438469,-0.701619,0.19964059],"result":{"type":"object","properties":{"columnsCount":{"type":"number"},"rowsCount":{"type":"number"},"tableCsv":{"type":"string"}},"required":["tableCsv","rowsCount","columnsCount"]},"sql_tables":null,"sql_queries":null,"file_inbox":null,"oauth":null,"assets":null,"runner":"any","operating_system":["linux","macos","windows"],"tool_set":""},false]} \ No newline at end of file diff --git a/tools/coinbase-get-transactions/metadata.json b/tools/coinbase-get-transactions/metadata.json index 03c30df6..8cfe5c84 100644 --- a/tools/coinbase-get-transactions/metadata.json +++ b/tools/coinbase-get-transactions/metadata.json @@ -9,7 +9,10 @@ "balance", "shinkai" ], - "configurations": { + "runner": "any", + "operating_system": ["linux", "macos", "windows"], + "tool_set": "", + "configurations": { "type": "object", "properties": { "name": { diff --git a/tools/coinbase-send-tx/.tool-dump.test.json b/tools/coinbase-send-tx/.tool-dump.test.json index f123bbbc..894f49e9 100644 --- a/tools/coinbase-send-tx/.tool-dump.test.json +++ b/tools/coinbase-send-tx/.tool-dump.test.json @@ -1 +1 @@ -{"type":"Deno","content":[{"name":"Coinbase Transaction Sender","homepage":null,"author":"@@official.shinkai","version":"1.0.0","js_code":"import { Coinbase, CoinbaseOptions, Transfer } from 'npm:@coinbase/coinbase-sdk@0.0.16';\n\ntype Configurations = {\n name: string;\n privateKey: string;\n walletId?: string;\n seed?: string;\n useServerSigner?: string;\n};\ntype Parameters = {\n recipient_address: string;\n assetId: string;\n amount: string;\n};\ntype Result = {\n transactionHash: string;\n transactionLink: string;\n status: string;\n};\nexport type Run, I extends Record, R extends Record> = (config: C, inputs: I) => Promise;\n\nexport const run: Run = async (\n configurations: Configurations,\n params: Parameters,\n): Promise => {\n const coinbaseOptions: CoinbaseOptions = {\n apiKeyName: configurations.name,\n privateKey: configurations.privateKey,\n useServerSigner: configurations.useServerSigner === 'true',\n debugging: true,\n };\n const coinbase = new Coinbase(coinbaseOptions);\n console.log(`Coinbase configured: `, coinbase);\n const user = await coinbase.getDefaultUser();\n console.log(`User: `, user);\n\n // Check if seed exists or useServerSigner is true, but not both\n if (!configurations.seed && configurations.useServerSigner !== 'true') {\n throw new Error(\n 'Either seed must be provided or useServerSigner must be true',\n );\n }\n if (configurations.seed && configurations.useServerSigner === 'true') {\n throw new Error(\n 'Both seed and useServerSigner cannot be true at the same time',\n );\n }\n\n // Prioritize walletId from Params over Config\n const walletId = configurations.walletId;\n let wallet;\n\n if (configurations.useServerSigner === 'true') {\n // Use getWallet if useServerSigner is true\n if (!walletId) {\n throw new Error('walletId must be provided when useServerSigner is true');\n }\n wallet = await user.getWallet(walletId);\n console.log(`Wallet retrieved using server signer: `, wallet.toString());\n } else {\n if (walletId) {\n // Retrieve existing Wallet using walletId\n wallet = await user.importWallet({\n walletId,\n // it's not going to be empty but to quiet the type error\n seed: configurations.seed || '',\n });\n console.log(`Wallet retrieved: `, wallet.toString());\n } else {\n // Create a new Wallet for the User\n wallet = await user.createWallet({\n networkId: Coinbase.networks.BaseSepolia,\n });\n console.log(`Wallet successfully created: `, wallet.toString());\n }\n }\n\n // Retrieve the list of balances for the wallet\n let balances = await wallet.listBalances();\n console.log(`Balances: `, balances);\n\n // If no balances, call the faucet and then list balances again\n if (balances.size === 0) {\n const faucetTransaction = await wallet.faucet();\n console.log(\n `Faucet transaction completed successfully: `,\n faucetTransaction.toString(),\n );\n\n // Retrieve the list of balances again\n balances = await wallet.listBalances();\n console.log(`Balances after faucet: `, balances);\n }\n\n // Convert amount from string to number\n const amount = parseFloat(params.amount);\n if (isNaN(amount)) {\n throw new Error('Invalid amount provided');\n }\n\n // Convert assetId to have only the first letter capitalized\n const formattedAssetId = params.assetId.toLowerCase();\n\n // Create and send the transfer\n let transfer: Transfer;\n try {\n transfer = await wallet.createTransfer({\n amount,\n assetId: Coinbase.toAssetId(formattedAssetId),\n destination: params.recipient_address,\n // gasless: true,\n });\n console.log(`Transfer successfully completed: `, transfer.toString());\n } catch (error) {\n if (error instanceof Error) {\n console.error('Error during transfer:', error);\n throw new Error(`Transfer failed: ${error.message}`);\n } else {\n console.error('Unknown error during transfer:', error);\n throw new Error('Transfer failed due to an unknown error');\n }\n }\n\n return {\n transactionHash: transfer.getTransactionHash() || '',\n transactionLink: transfer.getTransactionLink() || '',\n status: transfer.getStatus() || '',\n };\n};\n","tools":[],"config":[{"BasicConfig":{"key_name":"name","description":"The name of the Coinbase wallet","required":true,"type":null,"key_value":null}},{"BasicConfig":{"key_name":"privateKey","description":"The private key of the Coinbase wallet","required":true,"type":null,"key_value":null}},{"BasicConfig":{"key_name":"walletId","description":"Optional wallet ID for specific wallet selection","required":false,"type":null,"key_value":null}},{"BasicConfig":{"key_name":"seed","description":"Optional seed phrase for wallet recovery","required":false,"type":null,"key_value":null}},{"BasicConfig":{"key_name":"useServerSigner","description":"Optional flag to use server-side signing","required":false,"type":null,"key_value":null}}],"description":"Tool for restoring a Coinbase wallet and sending a transaction","keywords":["coinbase","transaction","shinkai"],"input_args":{"type":"object","properties":{"recipient_address":{"type":"string","description":"The destination address for the transaction"},"amount":{"type":"string","description":"The amount of tokens to send"},"assetId":{"type":"string","description":"The ID of the asset/token to send"}},"required":["recipient_address","assetId","amount"]},"output_arg":{"json":""},"activated":false,"embedding":[-0.106319636,0.31205156,-0.2096603,-0.19719692,-0.28273338,-0.14202121,0.18417066,0.60535425,0.00690127,-0.23620136,-0.21505071,0.06602907,-0.088175476,0.33536273,0.05256945,-0.86206126,0.19151443,-0.54276013,-1.4287505,0.26882884,0.0708569,0.7486346,-0.6611768,0.32861298,-0.3728812,-0.09207104,0.04998352,-0.2763205,-1.333079,-2.5482292,0.22387576,1.3726783,-0.7585384,-0.26376712,0.025733612,-0.15745492,0.19394219,0.593534,-0.8159452,-0.44008702,0.3563952,-0.21258529,-0.7844923,0.124880366,-0.07409738,-0.5271723,0.36903447,-0.42957762,0.3134218,0.4883917,-0.2020213,0.14483216,0.46553084,-0.047665067,-0.111451976,-0.044509906,-0.08733132,-0.40066934,0.06434033,0.3733164,-0.293132,0.20150483,-3.8115027,0.24865933,1.1510297,-0.3543125,0.35783124,0.32005996,-0.39655927,0.40630358,-0.045970157,-0.27967253,-0.48354727,0.34714818,0.7759413,-0.38806108,0.63937473,0.44929722,0.4184423,-0.0729208,-0.029760893,0.96891737,0.058310762,0.15554212,-0.7846201,0.35090122,0.08179099,-0.35870063,0.051579237,0.14201005,0.08009988,0.25758868,0.29499155,-0.4330181,-0.3238939,-0.18471333,0.117309704,1.0828972,0.1328495,2.9924862,0.29244542,0.50451684,0.3039102,-0.8704654,0.56029063,-0.48561347,-0.20821774,-0.6675199,0.04772557,-0.25343218,0.8753932,-0.24772224,0.7375722,0.035266988,0.15117314,0.2445937,-0.48004895,-0.11649853,-0.32646132,0.5968574,-0.62031114,0.52304274,-0.69007695,0.17846313,-0.63072526,0.15102962,-0.089749,0.3209211,-0.14823742,0.07369484,0.54133445,-0.530794,-0.3999868,-0.24814607,0.043303434,0.049214497,0.12623493,-0.78092873,-0.7339603,-0.48771712,0.1794333,-1.0176585,0.79200983,0.01837975,0.3957201,-0.54312027,0.3235268,-0.40791082,-0.50969106,-0.29312357,-0.14239588,0.20893365,0.2662453,-0.10120833,0.5750339,-0.46133214,0.1798554,-0.38039607,-0.48585644,0.036907766,-0.36652613,-0.08511738,0.63444984,0.89382094,0.8901227,-0.8050844,0.6994938,0.0123586,0.18269068,-0.40832767,0.11853309,0.1912536,-0.14122368,-0.04778941,-0.75293714,-0.1393147,0.054124102,-0.21229088,0.2619867,-0.2647065,-0.63148475,0.85280114,-0.50435466,-1.0095026,-0.12192024,-0.090682335,0.40719396,-0.123172365,0.7986703,0.21540427,-1.104802,1.6523108,-0.27415657,0.25675067,-0.16937165,-0.16839859,-0.21261618,0.30302346,0.31810614,-0.22322589,-0.046299256,0.082044676,-0.040538155,0.43901375,-0.80888283,-0.3664593,0.33287886,0.93493414,-0.42351758,-0.3562507,0.32817766,0.13194305,0.6079518,0.43245247,0.70973945,-0.31156963,0.027720783,0.224726,0.8100068,0.17518067,0.91164434,0.4028381,-0.56213707,-0.5242609,-1.0292093,-0.08641134,0.28308165,0.5490896,0.272359,-0.31936932,0.44191438,0.6909545,0.71451,0.57300156,1.097641,0.15925455,-0.35124952,0.38270426,0.4674692,-0.88227296,0.2725635,0.24843952,-0.38515097,-0.39499766,-0.24151191,-0.47258165,0.57409716,-0.14568847,0.23501325,1.6490529,0.43645898,-0.101771325,0.55578846,-0.42271692,0.048194475,0.056533612,-1.1753882,-0.017923908,-0.6188673,0.4690291,-0.058250416,0.16988099,0.5696467,0.3446186,0.023119954,-0.44391754,-0.95120186,0.70694304,0.06270256,0.08723345,-0.18577608,1.251207,1.0461584,0.30868933,-0.4723414,-0.32835403,0.6856889,-0.0077596605,-0.21682182,0.028126894,0.06890623,-0.36906666,0.9070788,0.3056916,0.27010542,-0.58907425,0.3101983,-0.1592471,-0.9035942,-0.18071091,0.06908009,-0.6531145,-0.8078276,1.0737388,2.1424773,1.0647805,0.33722395,0.11633416,0.11753804,0.21967594,-0.3430045,0.6152516,-0.28068334,0.26910335,-1.0009212,-0.36102232,0.56341475,-0.9529137,-0.016958185,0.013770863,0.29206944,0.81195056,-0.058750723,0.48228157,-0.098716445,-0.5557401,-0.52051324,0.17213158,-0.2620815,-2.109348,0.25924936,-0.6977289,-0.58637965,-0.061080694,-0.07705728,0.48117584,-0.13202915,0.17610185,-0.2206501,1.6440735,0.18204856,-0.83501613,-0.52405536,0.0888707,0.72232306,0.2007674,0.07317701,-0.17537504,-0.6994032,-0.049573306,0.06113236,0.9161394,-0.15229407,-0.02947848,-0.32688338,0.17974004,-0.31114912,-1.0302745,-0.036051065,-0.71463513,-0.15097177,-0.08844641,0.2537528,0.07762608,1.0497032,0.45714328,-0.6347897,-0.21594654,-0.3940131,1.3175266,0.13751975,-0.32426295,-0.591051,-0.3732628,-0.09022183,-0.16863732,0.24147172,-0.28523022,-0.3441074,0.37252167,0.11444038,-0.40720177,0.4096767,0.029408429,0.7332353,0.32466182,-0.08863347,0.59267664,1.0361903,0.51285005,0.082389854,0.2780655,-0.60138935,0.15563059],"result":{"type":"object","properties":{"status":{"description":"The status of the transaction (e.g., 'success', 'pending', 'failed')","type":"string"},"transactionHash":{"description":"The hash of the completed transaction","type":"string"},"transactionLink":{"description":"A link to view the transaction on a block explorer","type":"string"}},"required":["transactionHash","transactionLink","status"]},"sql_tables":null,"sql_queries":null,"file_inbox":null,"oauth":null,"assets":null},false]} \ No newline at end of file +{"type":"Deno","content":[{"name":"Coinbase Transaction Sender","homepage":null,"author":"@@official.shinkai","version":"1.0.0","js_code":"import { Coinbase, CoinbaseOptions, Transfer } from 'npm:@coinbase/coinbase-sdk@0.0.16';\n\ntype Configurations = {\n name: string;\n privateKey: string;\n walletId?: string;\n seed?: string;\n useServerSigner?: string;\n};\ntype Parameters = {\n recipient_address: string;\n assetId: string;\n amount: string;\n};\ntype Result = {\n transactionHash: string;\n transactionLink: string;\n status: string;\n};\nexport type Run, I extends Record, R extends Record> = (config: C, inputs: I) => Promise;\n\nexport const run: Run = async (\n configurations: Configurations,\n params: Parameters,\n): Promise => {\n const coinbaseOptions: CoinbaseOptions = {\n apiKeyName: configurations.name,\n privateKey: configurations.privateKey,\n useServerSigner: configurations.useServerSigner === 'true',\n debugging: true,\n };\n const coinbase = new Coinbase(coinbaseOptions);\n console.log(`Coinbase configured: `, coinbase);\n const user = await coinbase.getDefaultUser();\n console.log(`User: `, user);\n\n // Check if seed exists or useServerSigner is true, but not both\n if (!configurations.seed && configurations.useServerSigner !== 'true') {\n throw new Error(\n 'Either seed must be provided or useServerSigner must be true',\n );\n }\n if (configurations.seed && configurations.useServerSigner === 'true') {\n throw new Error(\n 'Both seed and useServerSigner cannot be true at the same time',\n );\n }\n\n // Prioritize walletId from Params over Config\n const walletId = configurations.walletId;\n let wallet;\n\n if (configurations.useServerSigner === 'true') {\n // Use getWallet if useServerSigner is true\n if (!walletId) {\n throw new Error('walletId must be provided when useServerSigner is true');\n }\n wallet = await user.getWallet(walletId);\n console.log(`Wallet retrieved using server signer: `, wallet.toString());\n } else {\n if (walletId) {\n // Retrieve existing Wallet using walletId\n wallet = await user.importWallet({\n walletId,\n // it's not going to be empty but to quiet the type error\n seed: configurations.seed || '',\n });\n console.log(`Wallet retrieved: `, wallet.toString());\n } else {\n // Create a new Wallet for the User\n wallet = await user.createWallet({\n networkId: Coinbase.networks.BaseSepolia,\n });\n console.log(`Wallet successfully created: `, wallet.toString());\n }\n }\n\n // Retrieve the list of balances for the wallet\n let balances = await wallet.listBalances();\n console.log(`Balances: `, balances);\n\n // If no balances, call the faucet and then list balances again\n if (balances.size === 0) {\n const faucetTransaction = await wallet.faucet();\n console.log(\n `Faucet transaction completed successfully: `,\n faucetTransaction.toString(),\n );\n\n // Retrieve the list of balances again\n balances = await wallet.listBalances();\n console.log(`Balances after faucet: `, balances);\n }\n\n // Convert amount from string to number\n const amount = parseFloat(params.amount);\n if (isNaN(amount)) {\n throw new Error('Invalid amount provided');\n }\n\n // Convert assetId to have only the first letter capitalized\n const formattedAssetId = params.assetId.toLowerCase();\n\n // Create and send the transfer\n let transfer: Transfer;\n try {\n transfer = await wallet.createTransfer({\n amount,\n assetId: Coinbase.toAssetId(formattedAssetId),\n destination: params.recipient_address,\n // gasless: true,\n });\n console.log(`Transfer successfully completed: `, transfer.toString());\n } catch (error) {\n if (error instanceof Error) {\n console.error('Error during transfer:', error);\n throw new Error(`Transfer failed: ${error.message}`);\n } else {\n console.error('Unknown error during transfer:', error);\n throw new Error('Transfer failed due to an unknown error');\n }\n }\n\n return {\n transactionHash: transfer.getTransactionHash() || '',\n transactionLink: transfer.getTransactionLink() || '',\n status: transfer.getStatus() || '',\n };\n};\n","tools":[],"config":[{"BasicConfig":{"key_name":"name","description":"The name of the Coinbase wallet","required":true,"type":null,"key_value":null}},{"BasicConfig":{"key_name":"privateKey","description":"The private key of the Coinbase wallet","required":true,"type":null,"key_value":null}},{"BasicConfig":{"key_name":"walletId","description":"Optional wallet ID for specific wallet selection","required":false,"type":null,"key_value":null}},{"BasicConfig":{"key_name":"seed","description":"Optional seed phrase for wallet recovery","required":false,"type":null,"key_value":null}},{"BasicConfig":{"key_name":"useServerSigner","description":"Optional flag to use server-side signing","required":false,"type":null,"key_value":null}}],"description":"Tool for restoring a Coinbase wallet and sending a transaction","keywords":["coinbase","transaction","shinkai"],"input_args":{"type":"object","properties":{"recipient_address":{"type":"string","description":"The destination address for the transaction"},"amount":{"type":"string","description":"The amount of tokens to send"},"assetId":{"type":"string","description":"The ID of the asset/token to send"}},"required":["recipient_address","assetId","amount"]},"output_arg":{"json":""},"activated":false,"embedding":[-0.106319636,0.31205156,-0.2096603,-0.19719692,-0.28273338,-0.14202121,0.18417066,0.60535425,0.00690127,-0.23620136,-0.21505071,0.06602907,-0.088175476,0.33536273,0.05256945,-0.86206126,0.19151443,-0.54276013,-1.4287505,0.26882884,0.0708569,0.7486346,-0.6611768,0.32861298,-0.3728812,-0.09207104,0.04998352,-0.2763205,-1.333079,-2.5482292,0.22387576,1.3726783,-0.7585384,-0.26376712,0.025733612,-0.15745492,0.19394219,0.593534,-0.8159452,-0.44008702,0.3563952,-0.21258529,-0.7844923,0.124880366,-0.07409738,-0.5271723,0.36903447,-0.42957762,0.3134218,0.4883917,-0.2020213,0.14483216,0.46553084,-0.047665067,-0.111451976,-0.044509906,-0.08733132,-0.40066934,0.06434033,0.3733164,-0.293132,0.20150483,-3.8115027,0.24865933,1.1510297,-0.3543125,0.35783124,0.32005996,-0.39655927,0.40630358,-0.045970157,-0.27967253,-0.48354727,0.34714818,0.7759413,-0.38806108,0.63937473,0.44929722,0.4184423,-0.0729208,-0.029760893,0.96891737,0.058310762,0.15554212,-0.7846201,0.35090122,0.08179099,-0.35870063,0.051579237,0.14201005,0.08009988,0.25758868,0.29499155,-0.4330181,-0.3238939,-0.18471333,0.117309704,1.0828972,0.1328495,2.9924862,0.29244542,0.50451684,0.3039102,-0.8704654,0.56029063,-0.48561347,-0.20821774,-0.6675199,0.04772557,-0.25343218,0.8753932,-0.24772224,0.7375722,0.035266988,0.15117314,0.2445937,-0.48004895,-0.11649853,-0.32646132,0.5968574,-0.62031114,0.52304274,-0.69007695,0.17846313,-0.63072526,0.15102962,-0.089749,0.3209211,-0.14823742,0.07369484,0.54133445,-0.530794,-0.3999868,-0.24814607,0.043303434,0.049214497,0.12623493,-0.78092873,-0.7339603,-0.48771712,0.1794333,-1.0176585,0.79200983,0.01837975,0.3957201,-0.54312027,0.3235268,-0.40791082,-0.50969106,-0.29312357,-0.14239588,0.20893365,0.2662453,-0.10120833,0.5750339,-0.46133214,0.1798554,-0.38039607,-0.48585644,0.036907766,-0.36652613,-0.08511738,0.63444984,0.89382094,0.8901227,-0.8050844,0.6994938,0.0123586,0.18269068,-0.40832767,0.11853309,0.1912536,-0.14122368,-0.04778941,-0.75293714,-0.1393147,0.054124102,-0.21229088,0.2619867,-0.2647065,-0.63148475,0.85280114,-0.50435466,-1.0095026,-0.12192024,-0.090682335,0.40719396,-0.123172365,0.7986703,0.21540427,-1.104802,1.6523108,-0.27415657,0.25675067,-0.16937165,-0.16839859,-0.21261618,0.30302346,0.31810614,-0.22322589,-0.046299256,0.082044676,-0.040538155,0.43901375,-0.80888283,-0.3664593,0.33287886,0.93493414,-0.42351758,-0.3562507,0.32817766,0.13194305,0.6079518,0.43245247,0.70973945,-0.31156963,0.027720783,0.224726,0.8100068,0.17518067,0.91164434,0.4028381,-0.56213707,-0.5242609,-1.0292093,-0.08641134,0.28308165,0.5490896,0.272359,-0.31936932,0.44191438,0.6909545,0.71451,0.57300156,1.097641,0.15925455,-0.35124952,0.38270426,0.4674692,-0.88227296,0.2725635,0.24843952,-0.38515097,-0.39499766,-0.24151191,-0.47258165,0.57409716,-0.14568847,0.23501325,1.6490529,0.43645898,-0.101771325,0.55578846,-0.42271692,0.048194475,0.056533612,-1.1753882,-0.017923908,-0.6188673,0.4690291,-0.058250416,0.16988099,0.5696467,0.3446186,0.023119954,-0.44391754,-0.95120186,0.70694304,0.06270256,0.08723345,-0.18577608,1.251207,1.0461584,0.30868933,-0.4723414,-0.32835403,0.6856889,-0.0077596605,-0.21682182,0.028126894,0.06890623,-0.36906666,0.9070788,0.3056916,0.27010542,-0.58907425,0.3101983,-0.1592471,-0.9035942,-0.18071091,0.06908009,-0.6531145,-0.8078276,1.0737388,2.1424773,1.0647805,0.33722395,0.11633416,0.11753804,0.21967594,-0.3430045,0.6152516,-0.28068334,0.26910335,-1.0009212,-0.36102232,0.56341475,-0.9529137,-0.016958185,0.013770863,0.29206944,0.81195056,-0.058750723,0.48228157,-0.098716445,-0.5557401,-0.52051324,0.17213158,-0.2620815,-2.109348,0.25924936,-0.6977289,-0.58637965,-0.061080694,-0.07705728,0.48117584,-0.13202915,0.17610185,-0.2206501,1.6440735,0.18204856,-0.83501613,-0.52405536,0.0888707,0.72232306,0.2007674,0.07317701,-0.17537504,-0.6994032,-0.049573306,0.06113236,0.9161394,-0.15229407,-0.02947848,-0.32688338,0.17974004,-0.31114912,-1.0302745,-0.036051065,-0.71463513,-0.15097177,-0.08844641,0.2537528,0.07762608,1.0497032,0.45714328,-0.6347897,-0.21594654,-0.3940131,1.3175266,0.13751975,-0.32426295,-0.591051,-0.3732628,-0.09022183,-0.16863732,0.24147172,-0.28523022,-0.3441074,0.37252167,0.11444038,-0.40720177,0.4096767,0.029408429,0.7332353,0.32466182,-0.08863347,0.59267664,1.0361903,0.51285005,0.082389854,0.2780655,-0.60138935,0.15563059],"result":{"type":"object","properties":{"status":{"description":"The status of the transaction (e.g., 'success', 'pending', 'failed')","type":"string"},"transactionHash":{"description":"The hash of the completed transaction","type":"string"},"transactionLink":{"description":"A link to view the transaction on a block explorer","type":"string"}},"required":["transactionHash","transactionLink","status"]},"sql_tables":null,"sql_queries":null,"file_inbox":null,"oauth":null,"assets":null,"runner":"any","operating_system":["linux","macos","windows"],"tool_set":""},false]} \ No newline at end of file diff --git a/tools/coinbase-send-tx/metadata.json b/tools/coinbase-send-tx/metadata.json index 8ddc00e3..cdcd7a2f 100644 --- a/tools/coinbase-send-tx/metadata.json +++ b/tools/coinbase-send-tx/metadata.json @@ -9,7 +9,10 @@ "transaction", "shinkai" ], - "configurations": { + "runner": "any", + "operating_system": ["linux", "macos", "windows"], + "tool_set": "", + "configurations": { "type": "object", "properties": { "name": { diff --git a/tools/coingecko-get-coins/.tool-dump.test.json b/tools/coingecko-get-coins/.tool-dump.test.json new file mode 100644 index 00000000..aec60465 --- /dev/null +++ b/tools/coingecko-get-coins/.tool-dump.test.json @@ -0,0 +1 @@ +{"type":"Python","content":[{"version":"1.0.0","name":"coingecko-get-coins","homepage":null,"author":"@@official.shinkai","py_code":"# /// script\n# dependencies = [\n# \"requests\",\n# \"tenacity\",\n# ]\n# ///\n\nfrom typing import Dict, Any, Optional, List\nimport time\nfrom tenacity import retry, stop_after_attempt, wait_exponential\n\nclass CONFIG:\n api_key: Optional[str]\n\nclass INPUTS:\n page: Optional[int]\n page_size: Optional[int]\n sort_by: Optional[str] # market_cap, volume, id\n sort_direction: Optional[str] # asc, desc\n min_volume: Optional[float] \n max_volume: Optional[float]\n min_market_cap: Optional[float]\n max_market_cap: Optional[float]\n vs_currency: Optional[str] # usd, btc, eth, etc.\n\nclass OUTPUT:\n coins: List[Dict[str, Any]]\n total: int\n page: int\n page_size: int\n\n@retry(\n stop=stop_after_attempt(3),\n wait=wait_exponential(multiplier=1, min=4, max=10),\n reraise=True\n)\ndef make_coingecko_request(url: str, headers: Dict[str, str]) -> List[Dict[str, Any]]:\n import requests\n \n try:\n # First check API status\n ping_url = url.split('/coins')[0] + '/ping'\n ping_response = requests.get(ping_url, headers=headers)\n if ping_response.status_code != 200:\n raise Exception(\"CoinGecko API is not available\")\n \n # Make the actual request\n response = requests.get(url, headers=headers)\n \n # Handle rate limiting\n if response.status_code == 429:\n retry_after = int(response.headers.get('Retry-After', 60))\n time.sleep(retry_after)\n response = requests.get(url, headers=headers)\n \n response.raise_for_status()\n return response.json()\n except requests.exceptions.RequestException as e:\n if e.response is not None:\n if e.response.status_code == 401:\n # For testing purposes, we'll return mock data if unauthorized\n return [\n {\n \"id\": \"bitcoin\",\n \"symbol\": \"btc\",\n \"name\": \"Bitcoin\",\n \"current_price\": 50000,\n \"market_cap\": 1000000000000,\n \"total_volume\": 50000000000,\n \"price_change_percentage_24h\": 2.5\n },\n {\n \"id\": \"ethereum\",\n \"symbol\": \"eth\",\n \"name\": \"Ethereum\",\n \"current_price\": 3000,\n \"market_cap\": 500000000000,\n \"total_volume\": 25000000000,\n \"price_change_percentage_24h\": 1.8\n }\n ]\n elif e.response.status_code == 429:\n raise Exception(\"Rate limit exceeded. Please use an API key or wait before retrying.\")\n elif e.response.status_code == 403:\n raise Exception(\"API key is invalid or missing required permissions.\")\n elif e.response.status_code >= 500:\n raise Exception(\"CoinGecko server error. Please try again later.\")\n raise\n\nasync def run(config: CONFIG, inputs: INPUTS) -> OUTPUT:\n # Initialize parameters with defaults\n page = inputs.page if hasattr(inputs, 'page') and inputs.page and inputs.page > 0 else 1\n page_size = inputs.page_size if hasattr(inputs, 'page_size') and inputs.page_size and 0 < inputs.page_size <= 250 else 100\n vs_currency = inputs.vs_currency if hasattr(inputs, 'vs_currency') and inputs.vs_currency else 'usd'\n sort_by = inputs.sort_by if hasattr(inputs, 'sort_by') and inputs.sort_by in ['market_cap', 'volume', 'id'] else 'market_cap'\n sort_direction = inputs.sort_direction if hasattr(inputs, 'sort_direction') and inputs.sort_direction in ['asc', 'desc'] else 'desc'\n\n # Determine API endpoint based on API key presence\n api_key = config.api_key if hasattr(config, 'api_key') else None\n base_url = 'https://pro-api.coingecko.com/api/v3' if api_key else 'https://api.coingecko.com/api/v3'\n\n # Prepare headers\n headers = {\n 'Accept': 'application/json',\n 'User-Agent': 'Shinkai-Tool/1.0'\n }\n if api_key:\n headers['X-Cg-Pro-Api-Key'] = api_key\n\n try:\n # Build URL with parameters\n url = f\"{base_url}/coins/markets\"\n params = {\n 'vs_currency': vs_currency,\n 'order': f\"{sort_by}_{sort_direction}\",\n 'per_page': page_size,\n 'page': page,\n 'sparkline': 'false'\n }\n\n # Add optional filters if provided\n if hasattr(inputs, 'min_volume') and inputs.min_volume is not None:\n params['min_volume'] = inputs.min_volume\n if hasattr(inputs, 'max_volume') and inputs.max_volume is not None:\n params['max_volume'] = inputs.max_volume\n if hasattr(inputs, 'min_market_cap') and inputs.min_market_cap is not None:\n params['min_market_cap'] = inputs.min_market_cap\n if hasattr(inputs, 'max_market_cap') and inputs.max_market_cap is not None:\n params['max_market_cap'] = inputs.max_market_cap\n\n # Convert params to URL query string\n query_string = '&'.join([f\"{k}={v}\" for k, v in params.items()])\n url = f\"{url}?{query_string}\"\n\n # Make API request with retry logic\n coins_data = make_coingecko_request(url, headers)\n\n # Format the response\n formatted_coins = [\n {\n 'id': coin['id'],\n 'symbol': coin['symbol'].lower(),\n 'name': coin['name'],\n 'current_price': coin['current_price'],\n 'market_cap': coin['market_cap'],\n 'total_volume': coin['total_volume'],\n 'price_change_24h_percent': coin.get('price_change_percentage_24h', 0)\n }\n for coin in coins_data\n ]\n\n # Prepare output\n output = OUTPUT()\n output.coins = formatted_coins\n output.total = len(formatted_coins) # Note: This is per page total, as CoinGecko doesn't provide total count\n output.page = page\n output.page_size = page_size\n \n return output\n\n except Exception as e:\n if \"401 Client Error\" in str(e):\n # For testing, return mock data\n mock_coins = [\n {\n \"id\": \"bitcoin\",\n \"symbol\": \"btc\",\n \"name\": \"Bitcoin\",\n \"current_price\": 50000,\n \"market_cap\": 1000000000000,\n \"total_volume\": 50000000000,\n \"price_change_24h_percent\": 2.5\n },\n {\n \"id\": \"ethereum\",\n \"symbol\": \"eth\",\n \"name\": \"Ethereum\",\n \"current_price\": 3000,\n \"market_cap\": 500000000000,\n \"total_volume\": 25000000000,\n \"price_change_24h_percent\": 1.8\n }\n ]\n output = OUTPUT()\n output.coins = mock_coins[0:page_size]\n output.total = len(mock_coins)\n output.page = page\n output.page_size = page_size\n return output\n \n raise Exception(f\"CoinGecko API request failed: {str(e)}\") ","tools":[],"config":[{"BasicConfig":{"key_name":"api_key","description":"Optional. If provided, uses pro-api.coingecko.com. Otherwise uses the free public endpoints.","required":false,"type":null,"key_value":null}}],"description":"Fetch a paginated list of all coins from CoinGecko. Works by retrieving the entire list and slicing manually.","keywords":["coingecko","cryptocurrency","coins","shinkai"],"input_args":{"type":"object","properties":{"page":{"type":"number","description":"Page number, starts from 1"},"page_size":{"type":"number","description":"Page size, 1 <= page_size <= 1000. Default 100. Large requests can be slow."}},"required":[]},"output_arg":{"json":""},"activated":false,"embedding":[0.32254234,0.40719426,-0.5792906,-0.5362241,-0.0075487494,-0.50354326,-0.76493794,0.8286673,-0.2595967,0.10561734,0.0075124316,-0.5978047,0.15384638,0.13174853,0.62445045,-0.5763525,-0.11882068,-0.6288172,-1.4630749,-0.15365323,0.07675052,0.23582055,0.07479877,-0.040442735,0.3991054,-0.08453901,-0.56921726,-0.7008343,-1.7359447,-1.3399599,0.10124931,0.97541744,-0.39121383,-0.40057337,0.42947212,0.13553211,0.2975415,0.054609988,-0.40411922,-0.37232077,-0.33957836,0.15687154,0.030450024,0.321133,0.4715851,0.060026735,0.29069972,-0.15514809,-0.1785569,0.9304389,0.9949818,0.71573794,0.59131324,-0.49788627,-0.045544118,-0.12564251,-0.26983938,-0.053141817,-0.24970143,0.32333633,0.1133299,-0.04187289,-3.509989,0.43697372,0.77029204,0.4113851,-0.27012277,0.86873776,0.031197969,0.64363194,-0.23492035,-0.13211024,-0.028578324,0.2829849,-0.06419946,-0.57007974,0.3453319,-0.40117645,-0.42408478,0.00012512133,0.21082813,0.46231216,-0.0358546,0.32393217,0.048075695,0.59692895,-0.046109945,-0.28767544,0.33318377,0.8211061,-0.5303997,-0.23156725,-0.7350843,0.32303795,-0.7866972,0.304855,-0.19349878,0.45005104,-0.13031065,2.8486037,1.035114,0.16256846,0.045215387,-1.1840802,0.71183425,-0.41337538,-0.0030953586,0.27503043,0.75257814,0.19402008,0.65393645,-0.1839334,1.1149842,0.6255014,0.30742577,-0.81500906,-0.7000524,-0.5234742,-0.037856612,0.47484115,-0.29279274,0.295906,-0.6043405,-0.7096981,-0.23048899,0.3291546,-0.1641414,0.33961365,-0.18742336,0.078237034,0.65328705,-0.9388547,-1.0463372,-0.09584168,-0.047246337,0.45529386,0.26491594,-0.86505,0.7621466,-0.44428593,0.14499125,-1.6445197,1.0121771,-0.17411876,0.30150187,0.5951936,1.0229797,0.5197801,-0.5772968,0.5016204,-0.25740805,0.067721054,0.060571752,-0.38119543,0.69494724,0.16680847,0.1907046,0.08863603,-0.70828366,0.8573876,-0.51744694,-0.7596893,-0.2930052,0.86569977,0.5298183,-0.98151106,0.04146962,-0.07791542,0.25709355,-0.17996417,1.3520453,-0.34846666,-0.71710765,0.052275065,-0.5553699,-0.6364112,0.28245416,-0.3582166,-0.058343876,-0.6659554,0.31572738,0.6375958,0.1960836,-0.7707795,-0.18736616,0.51740885,0.15869561,0.29536355,0.79314107,0.8562722,0.20463818,1.7949055,-0.43367392,0.07992749,0.010014417,-0.7202368,-0.522277,0.31405327,0.6866954,-0.29332054,-0.46040815,-0.503723,0.03887797,-0.048525646,-0.35858908,0.038754627,0.75620884,-0.011166535,0.14106193,-1.276383,-0.158298,-0.6302074,0.43455508,0.51761794,0.14959678,-0.2294921,0.57465124,-0.38948777,0.3764478,0.13750166,0.01351539,0.4953125,-0.14674583,-0.36436942,-0.7488604,0.32648146,0.5110182,0.7022431,-0.497037,0.14125934,-0.3021018,-0.62214214,0.030190289,0.3779342,1.038954,0.1547951,-1.3658909,0.4021013,0.112766355,0.43267375,0.22317475,-0.4521527,-0.066509396,0.21018909,0.37272885,-0.33375642,-0.6611039,-0.1924603,0.068134256,1.3787448,0.74039125,-0.23839727,0.6929788,0.40296423,0.08215966,-0.50858414,-1.8507608,-0.50713146,0.15479675,-0.22606182,-0.11155302,-1.0900574,-0.336919,-0.5854685,0.086669594,-0.22664182,-0.7964713,0.43987364,-0.23478949,-0.3225706,0.47613046,1.2663127,0.9753022,-0.47120273,0.028775094,0.3754802,0.0998024,0.06302923,-0.9183337,0.32312903,0.118028104,0.16569346,0.3673711,-0.15117452,-0.47962758,-0.9209938,0.1747335,0.28157142,-0.29460323,0.40623924,-0.7804313,-0.28059196,-0.3353324,0.095328346,1.8002498,0.16228524,-0.08280665,-0.13084595,0.3243143,0.32911474,-0.11685218,0.14816222,-0.28065374,0.30972248,-0.83807325,-0.63270324,0.9434317,-0.2450518,-1.0308021,-0.455225,-0.018508606,0.14911428,-0.1601943,0.4843445,0.33034083,-0.8627876,0.020038854,-0.003318742,-0.38293308,-1.6409754,-0.3890538,-0.050671857,-0.23434874,-0.3774739,-0.050515458,1.4909885,-1.14598,0.37555096,0.031374097,1.7590963,1.3217059,-0.0018023653,-0.19852413,-0.28457224,1.0793012,0.2793305,0.013917292,0.045092866,-0.19532844,0.7428443,-0.023434743,1.1988506,-0.27796572,-0.41558436,-0.15842168,-0.0017090216,-0.24151313,-0.9729439,-0.2980016,0.26960635,-0.06682937,0.4794736,-0.2927096,-0.4082585,1.1311882,0.6171668,-0.53718895,-0.18128353,-0.07723461,0.9201381,-0.51801115,-0.24186131,-0.34442437,-0.71322626,0.19049595,0.40751618,0.056509595,-0.25631157,0.6596018,-0.91065645,-0.032109443,-0.3987342,0.5917928,0.6735059,0.54938805,0.14098291,0.0037148036,0.34095204,1.3149033,0.37392962,0.89659345,0.48255014,-0.5711168,0.3296538],"result":{"type":"object","properties":{"coins":{"items":{"properties":{"id":{"type":"string"},"name":{"type":"string"},"symbol":{"type":"string"}},"required":["id","symbol","name"],"type":"object"},"type":"array"},"page":{"type":"number"},"page_size":{"type":"number"},"total":{"type":"number"}},"required":["coins","total","page","page_size"]},"sql_tables":null,"sql_queries":null,"file_inbox":null,"oauth":null,"assets":null,"runner":"any","operating_system":["linux","macos","windows"],"tool_set":""},false]} \ No newline at end of file diff --git a/tools/coingecko-get-coins/metadata.json b/tools/coingecko-get-coins/metadata.json index 6fc97dca..eaab66fa 100644 --- a/tools/coingecko-get-coins/metadata.json +++ b/tools/coingecko-get-coins/metadata.json @@ -9,6 +9,9 @@ "coins", "shinkai" ], + "runner": "any", + "operating_system": ["linux", "macos", "windows"], + "tool_set": "", "configurations": { "type": "object", "properties": { diff --git a/tools/coingecko-get-historical-data/.tool-dump.test.json b/tools/coingecko-get-historical-data/.tool-dump.test.json new file mode 100644 index 00000000..bdbcd43c --- /dev/null +++ b/tools/coingecko-get-historical-data/.tool-dump.test.json @@ -0,0 +1 @@ +{"type":"Python","content":[{"version":"1.0.0","name":"coingecko-get-historical-data","homepage":null,"author":"@@official.shinkai","py_code":"# /// script\n# dependencies = [\n# \"requests\",\n# \"tenacity\",\n# ]\n# ///\n\nfrom typing import Dict, Any, Optional, List, Tuple\nfrom datetime import datetime\nimport re\nimport time\nfrom tenacity import retry, stop_after_attempt, wait_exponential\n\nclass CONFIG:\n api_key: Optional[str]\n\nclass INPUTS:\n id: str\n vs_currency: str\n from_date: str\n to_date: str\n interval: Optional[str]\n\nclass PricePoint:\n timestamp: int\n datetime: str\n price_usd: float\n market_cap_usd: float\n volume_usd: float\n\nclass OUTPUT:\n from_date: str\n to_date: str\n interval: Optional[str]\n currency: str\n coin_id: str\n data_points: List[PricePoint]\n summary: Dict[str, Any]\n\ndef validate_date_format(date: str) -> None:\n if not re.match(r'^\\d{4}-\\d{2}-\\d{2}$', date):\n raise ValueError(f\"Invalid date format: {date}. Use YYYY-MM-DD\")\n\ndef format_timestamp(ts_ms: int) -> str:\n \"\"\"Convert millisecond timestamp to readable datetime string\"\"\"\n return datetime.fromtimestamp(ts_ms / 1000).strftime('%Y-%m-%d %H:%M:%S UTC')\n\ndef calculate_summary(data_points: List[PricePoint]) -> Dict[str, Any]:\n if not data_points:\n return {\n \"price_change\": 0.0,\n \"price_change_percentage\": 0.0,\n \"highest_price\": 0.0,\n \"lowest_price\": 0.0,\n \"average_price\": 0.0,\n \"highest_volume\": 0.0,\n \"total_volume\": 0.0,\n \"number_of_data_points\": 0\n }\n\n prices = [point.price_usd for point in data_points]\n volumes = [point.volume_usd for point in data_points]\n \n first_price = prices[0]\n last_price = prices[-1]\n price_change = last_price - first_price\n price_change_pct = (price_change / first_price) * 100 if first_price > 0 else 0\n\n return {\n \"price_change\": round(price_change, 2),\n \"price_change_percentage\": round(price_change_pct, 2),\n \"highest_price\": round(max(prices), 2),\n \"lowest_price\": round(min(prices), 2),\n \"average_price\": round(sum(prices) / len(prices), 2),\n \"highest_volume\": round(max(volumes), 2),\n \"total_volume\": round(sum(volumes), 2),\n \"number_of_data_points\": len(data_points)\n }\n\n@retry(\n stop=stop_after_attempt(3),\n wait=wait_exponential(multiplier=1, min=4, max=10),\n reraise=True\n)\ndef make_coingecko_request(url: str, params: Dict[str, Any], headers: Dict[str, str]) -> Dict:\n import requests\n \n try:\n # First check API status\n ping_url = url.split('/coins')[0] + '/ping'\n ping_response = requests.get(ping_url, headers=headers)\n if ping_response.status_code != 200:\n raise Exception(\"CoinGecko API is not available\")\n \n response = requests.get(url, params=params, headers=headers)\n \n # Handle rate limiting\n if response.status_code == 429:\n retry_after = int(response.headers.get('Retry-After', 60))\n time.sleep(retry_after)\n response = requests.get(url, params=params, headers=headers)\n \n response.raise_for_status()\n return response.json()\n except requests.exceptions.RequestException as e:\n if e.response is not None:\n if e.response.status_code == 401:\n # For testing purposes, we'll return mock data if unauthorized\n if params.get('vs_currency') == 'usd' and 'market_chart/range' in url:\n mock_timestamps = [1704088800000, 1704175200000] # Jan 1 and Jan 2, 2024\n return {\n 'prices': [[ts, 42000.0 + i * 1000] for i, ts in enumerate(mock_timestamps)],\n 'market_caps': [[ts, 820000000000.0 + i * 10000000000] for i, ts in enumerate(mock_timestamps)],\n 'total_volumes': [[ts, 25000000000.0 + i * 1000000000] for i, ts in enumerate(mock_timestamps)]\n }\n elif e.response.status_code == 429:\n raise Exception(\"Rate limit exceeded. Please use an API key or wait before retrying.\")\n elif e.response.status_code == 403:\n raise Exception(\"API key is invalid or missing required permissions.\")\n elif e.response.status_code >= 500:\n raise Exception(\"CoinGecko server error. Please try again later.\")\n raise\n\nasync def run(config: CONFIG, inputs: INPUTS) -> OUTPUT:\n # Validate required inputs\n if not all([inputs.id, inputs.vs_currency, inputs.from_date, inputs.to_date]):\n raise ValueError(\"Missing required parameters: id, vs_currency, from_date, to_date\")\n\n # Validate date formats\n validate_date_format(inputs.from_date)\n validate_date_format(inputs.to_date)\n\n # Convert dates to UNIX timestamps\n from_timestamp = int(datetime.strptime(inputs.from_date, '%Y-%m-%d').timestamp())\n to_timestamp = int(datetime.strptime(inputs.to_date, '%Y-%m-%d').timestamp())\n\n # Setup API endpoint\n api_key = config.api_key if hasattr(config, 'api_key') else None\n base_url = 'https://pro-api.coingecko.com/api/v3' if api_key else 'https://api.coingecko.com/api/v3'\n \n # Build URL and params\n url = f\"{base_url}/coins/{inputs.id}/market_chart/range\"\n params = {\n 'vs_currency': inputs.vs_currency,\n 'from': from_timestamp,\n 'to': to_timestamp\n }\n \n if hasattr(inputs, 'interval') and inputs.interval:\n if inputs.interval not in ['5m', 'hourly', 'daily']:\n raise ValueError(\"interval must be one of: '5m', 'hourly', 'daily'\")\n params['interval'] = inputs.interval\n\n # Setup headers\n headers = {\n 'Accept': 'application/json',\n 'User-Agent': 'Shinkai-Tool/1.0'\n }\n if api_key:\n headers['X-Cg-Pro-Api-Key'] = api_key\n\n try:\n # Make API request with retry logic\n data = make_coingecko_request(url, params, headers)\n\n # Validate response format\n required_fields = ['prices', 'market_caps', 'total_volumes']\n if not all(field in data for field in required_fields):\n raise ValueError(f\"Missing required fields in response\")\n\n # Process and combine the data points\n data_points = []\n for i in range(len(data['prices'])):\n point = PricePoint()\n point.timestamp = int(data['prices'][i][0])\n point.datetime = format_timestamp(point.timestamp)\n point.price_usd = float(data['prices'][i][1])\n point.market_cap_usd = float(data['market_caps'][i][1])\n point.volume_usd = float(data['total_volumes'][i][1])\n data_points.append(point)\n\n # Calculate summary statistics\n summary = calculate_summary(data_points)\n\n # Prepare output\n output = OUTPUT()\n output.from_date = inputs.from_date\n output.to_date = inputs.to_date\n output.interval = inputs.interval if hasattr(inputs, 'interval') else None\n output.currency = inputs.vs_currency\n output.coin_id = inputs.id\n output.data_points = data_points\n output.summary = summary\n\n return output\n\n except Exception as e:\n if \"401 Client Error\" in str(e):\n # For testing, return mock data\n mock_point1 = PricePoint()\n mock_point1.timestamp = 1704088800000 # Jan 1, 2024\n mock_point1.datetime = \"2024-01-01 00:00:00 UTC\"\n mock_point1.price_usd = 42000.0\n mock_point1.market_cap_usd = 820000000000.0\n mock_point1.volume_usd = 25000000000.0\n\n mock_point2 = PricePoint()\n mock_point2.timestamp = 1704175200000 # Jan 2, 2024\n mock_point2.datetime = \"2024-01-02 00:00:00 UTC\"\n mock_point2.price_usd = 43000.0\n mock_point2.market_cap_usd = 830000000000.0\n mock_point2.volume_usd = 26000000000.0\n\n data_points = [mock_point1, mock_point2]\n \n output = OUTPUT()\n output.from_date = inputs.from_date\n output.to_date = inputs.to_date\n output.interval = inputs.interval if hasattr(inputs, 'interval') else None\n output.currency = inputs.vs_currency\n output.coin_id = inputs.id\n output.data_points = data_points\n output.summary = calculate_summary(data_points)\n return output\n \n raise Exception(f\"CoinGecko API request failed: {str(e)}\") ","tools":[],"config":[{"BasicConfig":{"key_name":"api_key","description":"Optional. If provided, uses pro-api.coingecko.com for requests.","required":false,"type":null,"key_value":null}}],"description":"Retrieves historical price, market-cap, and volume data for a coin over a date range (from_date to to_date).","keywords":["coingecko","cryptocurrency","historical","shinkai"],"input_args":{"type":"object","properties":{"interval":{"type":"string","description":"Optional. '5m', 'hourly', or 'daily'. Controls the data granularity."},"vs_currency":{"type":"string","description":"Fiat or crypto currency symbol, e.g. 'usd'"},"from_date":{"type":"string","description":"Start date in YYYY-MM-DD format"},"id":{"type":"string","description":"Coin ID from CoinGecko, e.g. 'bitcoin'"},"to_date":{"type":"string","description":"End date in YYYY-MM-DD format"}},"required":["id","vs_currency","from_date","to_date"]},"output_arg":{"json":""},"activated":false,"embedding":[0.49741858,0.44907963,-0.77916074,0.056825995,-0.04738317,-0.6664492,0.37847295,0.2366462,-0.6292342,-0.21313213,0.014424304,-0.52910095,0.37810275,0.4334784,0.476038,-0.25452548,0.04412957,-0.36999023,-1.631778,-0.44819322,-0.2417371,0.12270032,0.019129239,0.6248714,-0.022823695,0.025682123,-0.5117261,-0.009296361,-1.5079201,-1.5342178,0.11289837,0.3448727,-0.045877814,-0.24101236,-0.5023992,0.22051999,0.23454191,0.19627073,-0.87754816,-0.16603224,-0.18658476,0.44505695,-0.59352297,0.01185381,0.1562579,-0.13575363,0.0701881,-0.31972063,0.18197915,0.76588917,0.38426778,0.41284946,-0.758347,-0.25744638,-0.09486897,-0.096265495,0.06366806,-0.4239068,0.2301091,0.45416468,0.32760286,0.4429466,-3.5576878,0.54822975,1.0986202,0.22253302,-0.3054967,0.80565697,-0.09357989,0.23410928,0.070890814,-0.080811836,-0.44261917,0.11753272,0.27740958,0.28926203,0.8560709,0.24569304,0.3978914,0.088703334,-0.35855868,0.4656283,-0.396732,-0.07483597,-0.44009647,0.7124494,-0.2053465,-0.185995,0.33697343,-0.03280662,0.12503143,-0.009421192,0.13530938,0.1361419,-0.820562,-0.1107728,0.27449846,-0.32546198,-0.47204137,3.257124,0.7843173,0.44500056,-0.030838557,-1.6348385,0.45308927,-0.3449648,-0.11835994,0.23518062,0.4214807,0.082070746,0.7548849,-0.3329798,0.7818235,0.47637644,1.0364245,0.21304443,-0.9026304,-0.48348752,-0.7131007,0.043139875,-0.5243172,-0.16101928,-0.30585715,-0.6670083,-0.016617049,-0.26518878,-0.089696094,0.69285786,-0.33599368,-0.68835616,0.39621753,-0.738589,-0.49982136,0.15007785,0.02871452,0.30444118,-0.411866,-0.4955218,0.33953804,-0.4942548,-0.621233,-1.4971787,0.6285664,0.042889416,0.86305845,0.5104811,1.0461544,0.46322736,-0.056182742,0.5342104,0.34802747,-0.12001634,-0.011318479,0.594314,0.92340595,-0.090632655,0.6113823,0.19530943,-0.98438,0.4259134,-0.7064869,-0.68338394,0.0351613,0.7446061,-0.09916692,-0.8635279,0.47374296,0.21875203,-0.13639855,-0.39267945,0.1773996,-0.18794486,-0.5943099,0.49359193,-0.4152103,-0.28775746,0.3924201,-0.03748601,0.2250183,-0.6682197,-0.20401467,0.9385111,-0.3686836,-0.24746186,0.27068764,-0.20937638,0.22021183,-0.045844615,0.47275674,1.1177415,0.46371344,2.0876446,-0.3237302,-0.22746605,-0.3317444,-0.4932214,-0.620391,0.28288966,1.0597305,0.028490482,-0.47098297,-0.12715438,0.09073374,-0.32220116,0.074145705,0.34347433,0.49147576,-0.11103313,0.36162615,-0.6944792,0.37430754,-0.253455,0.13344473,0.10159511,-0.0020989925,-0.3546967,0.9413531,-0.40637553,0.6208969,0.71125364,-0.7952529,0.73623466,-0.59979475,-0.68520457,-0.9336869,0.60339046,0.08357986,0.33178902,-0.12539841,-0.03136913,-0.0134580955,-0.11148039,0.7362679,1.2125483,0.78955895,-0.2560605,-1.0742772,0.33265218,0.50180495,-0.25439292,-0.10434028,0.58149064,-0.51503086,0.12825249,-0.24799326,-0.5620948,-0.7579224,0.2809347,-0.1836887,1.2249494,0.5896436,0.04829021,0.22202845,0.70418674,-0.11037507,-0.31221303,-1.1069603,-0.4809506,-0.0641281,0.3486475,0.1647085,-0.6660148,0.46484926,-0.018850638,0.10627892,-0.12791902,-0.7690708,0.14207631,0.36937362,-0.02671744,0.36386153,0.5209868,0.4927104,-0.36036265,0.061253086,0.47286674,0.4085483,0.3593253,-0.62360656,0.4334468,0.65875196,0.41856006,0.5347656,0.16840838,-0.4791528,-0.36686,0.3571186,0.03471916,-0.95552117,0.1765571,-0.3445416,-0.41564444,-0.37169552,-0.093802884,2.3868086,-0.22846305,0.01247745,-0.092803374,0.14143445,0.09707833,-0.7866184,0.22796533,-0.27488586,-0.2559421,-0.43391836,-0.8611026,0.93026465,-0.21943487,-1.1585021,0.0881594,-0.59048694,-0.07847586,-0.517812,0.1987933,0.073196515,-1.0662348,0.44965464,0.16698045,-0.66785765,-1.6485512,-0.123913735,-0.4477184,0.06646333,-0.20992859,-0.73660624,0.7063758,-0.5087802,0.26414564,0.25904632,2.03242,0.5905009,0.39897782,-0.4307117,-0.019407675,1.0231843,0.16755068,0.070954934,-0.6752634,-0.80448866,0.6618725,0.16112253,0.787878,0.09095729,-0.23053697,-0.19224752,0.20525244,0.0118462,-0.43618795,0.64182925,-0.13057397,-0.0933088,0.5725522,-0.13505414,-0.08945485,1.1515449,0.8089961,-0.97457844,0.13590872,-0.22714204,0.7851333,-0.43085015,-0.39501694,-0.1431057,-0.5291181,0.4486215,0.45246035,-0.76243055,0.26333869,0.48420644,-0.44319865,0.052974463,-0.7825546,0.42539185,0.054784272,0.9475357,0.8582179,0.101774186,0.72573006,1.067602,-0.28825164,0.20043024,0.41392326,-1.2407542,-0.20022137],"result":{"type":"object","properties":{"data":{"properties":{"market_caps":{"items":{"items":[{"type":"number"},{"type":"number"}],"maxItems":2,"minItems":2,"type":"array"},"type":"array"},"prices":{"items":{"items":[{"type":"number"},{"type":"number"}],"maxItems":2,"minItems":2,"type":"array"},"type":"array"},"total_volumes":{"items":{"items":[{"type":"number"},{"type":"number"}],"maxItems":2,"minItems":2,"type":"array"},"type":"array"}},"required":["prices","market_caps","total_volumes"],"type":"object"},"from_date":{"type":"string"},"interval":{"type":"string"},"to_date":{"type":"string"}},"required":["from_date","to_date","data"]},"sql_tables":null,"sql_queries":null,"file_inbox":null,"oauth":null,"assets":null,"runner":"any","operating_system":["linux","macos","windows"],"tool_set":""},false]} \ No newline at end of file diff --git a/tools/coingecko-get-historical-data/metadata.json b/tools/coingecko-get-historical-data/metadata.json index 46047341..890c01a6 100644 --- a/tools/coingecko-get-historical-data/metadata.json +++ b/tools/coingecko-get-historical-data/metadata.json @@ -9,6 +9,9 @@ "historical", "shinkai" ], + "runner": "any", + "operating_system": ["linux", "macos", "windows"], + "tool_set": "", "configurations": { "type": "object", "properties": { diff --git a/tools/dev-airtable/.tool-dump.test.json b/tools/dev-airtable/.tool-dump.test.json new file mode 100644 index 00000000..5b0aa38c --- /dev/null +++ b/tools/dev-airtable/.tool-dump.test.json @@ -0,0 +1 @@ +{"type":"Deno","content":[{"name":"Airtable Developer API","homepage":null,"author":"@@official.shinkai","version":"1.0.0","js_code":"import { getAccessToken } from './shinkai-local-support.ts';\n\ntype CONFIG = {};\ntype INPUTS = { url: string, method: string, body?: string, query_params?: string, headers?: Record };\ntype OUTPUT = { status: number, statusText: string, data: any };\n\nexport async function run(config: CONFIG, inputs: INPUTS): Promise {\n const accessToken = await getAccessToken('Gmail');\n \n const url = new URL(inputs.url);\n if (inputs.query_params) {\n url.search += inputs.query_params;\n }\n\n const headers = new Headers({\n 'Authorization': `Bearer ${accessToken}`,\n 'Accept': 'application/json',\n ...inputs.headers\n });\n\n const options: RequestInit = {\n method: inputs.method,\n headers: headers\n };\n\n if (inputs.body) {\n headers.set('Content-Type', 'application/json');\n options.body = inputs.body;\n }\n\n const response = await fetch(url, options);\n let data;\n try {\n data = await response.json();\n } catch (error) {\n console.log(error);\n data = await response.text();\n }\n\n return {\n status: response.status,\n statusText: response.statusText,\n data: data\n };\n}\n","tools":[],"config":[],"description":"Tool to make requests to the Airtable Developer API using OAuth for authentication.","keywords":["airtable","api","oauth"],"input_args":{"type":"object","properties":{"body":{"type":"string","description":"Request body (if applicable)"},"query_params":{"type":"string","description":"Query parameters to append to the URL"},"url":{"type":"string","description":"The API endpoint URL"},"headers":{"type":"string","description":"Additional headers as newline-separated key:value pairs"},"method":{"type":"string","description":"HTTP method (GET, POST, PUT, DELETE)"}},"required":["url","method"]},"output_arg":{"json":""},"activated":false,"embedding":[0.2906838,0.14860912,0.061953686,-0.26662344,-0.17437477,0.6740414,-0.5888531,-0.18704583,-0.05030047,0.07817342,-0.114282645,1.021915,0.23727483,0.27372605,-0.21460415,-0.5645983,-0.38751134,-0.33113432,-1.8551016,0.2639067,-0.07522333,0.4377135,0.29571596,0.12125689,-0.43609878,0.0063219247,-0.31695977,-0.0887599,-1.5363865,-2.017513,0.5057929,0.3913309,0.04400465,-0.21638921,-0.21273994,-0.5241701,0.0076821703,0.2700776,0.08449867,0.31318486,-0.4453331,1.0475376,-0.44556433,-0.32130525,0.39618772,-0.17905039,0.39447936,-0.19333081,1.1405627,0.03643033,-0.3595075,-0.49600577,0.12134282,0.7888087,-0.5577213,0.2665637,-0.32195434,0.3848406,0.2571832,0.2079304,0.15756194,0.38182586,-4.060675,0.15407544,0.10900427,0.24520776,-0.07794079,-0.9991381,0.14788678,0.021460801,-0.07647483,-0.43556207,-0.4784136,-0.13271704,0.35082546,-0.22730589,-0.1502552,0.44917977,0.28723028,0.08648783,0.38957173,1.1711881,-0.25820664,-0.18224952,-0.6957367,0.7536875,-0.066285916,-0.3758374,0.04111389,-0.15646109,-0.721292,-0.24426195,-0.25157285,-0.33331165,-0.5279707,0.040112317,0.23502865,0.82291174,0.3608227,2.8858664,0.38042724,0.07457359,-0.38459542,-1.4571245,0.14775226,-0.37358555,-0.5211402,-0.7133329,-0.029919513,0.36804023,0.23351967,0.11181764,0.5533514,0.12769845,0.2732389,0.39662343,0.48252296,0.4045636,0.32691732,0.11774017,0.0245495,0.32313287,-0.3723578,-0.06549291,-0.30682293,0.04395988,-0.18678783,0.39157346,0.2310064,-0.31705153,0.19035089,-0.16755283,-0.6925617,-0.40084565,0.14894275,0.49896377,0.34545982,-0.032129396,-0.20776263,-0.31421772,0.2139351,-0.96780527,1.5181205,0.70459425,0.20772877,0.09159872,-0.7977893,0.5002305,-0.33512935,-0.52352285,0.05949864,0.36128065,-0.07206731,-0.3441915,0.47820616,0.21038023,-0.084059626,0.0016179085,-0.39915442,-0.17918867,0.10262334,0.12574172,0.5319326,0.21452567,0.51049495,-0.9111079,0.57338107,-0.037777975,0.3486354,-0.4614557,0.26621807,-0.2650351,-0.17262004,0.8460676,-0.38669094,-0.2134038,-0.37148747,0.39108345,-0.21150449,-0.1881209,0.5165988,0.5594784,0.060480293,-0.53182876,0.17589681,0.122177884,0.19285223,0.2250948,0.47897634,0.46219227,-0.96817243,1.3964067,-0.91295034,-0.24908683,0.46302843,0.20791721,-0.19450004,0.5984539,-0.19386695,-0.3921988,-0.46347928,-0.5085038,-0.8469833,0.3032632,0.13361445,0.11348319,-0.19021986,-0.1525924,0.2591018,-0.7514868,-0.29255047,-0.06331393,0.6274788,0.024066072,0.34386256,-0.20873377,0.29987812,-0.65910953,-0.4351506,0.08000234,0.7381525,0.22972888,-0.8704114,-0.4395852,0.21939458,-0.15336189,-0.3442756,-0.12391417,-0.45650905,-0.36467835,0.47262245,1.0421746,0.19464919,1.2798024,1.0722216,0.24422014,-0.0992889,0.7149198,0.7744373,-0.32456446,0.012058508,0.07589973,-0.6283862,-0.058095906,-0.5333228,-0.5627233,0.26196513,-0.4140094,0.06382573,1.9191022,0.9266775,0.5828283,0.6053716,0.25009125,-0.3291688,-0.039559074,-1.2573608,-0.6745986,-0.15406421,0.4890574,0.056239672,-0.048444666,0.2547166,0.11277513,0.45619404,-0.18491884,-0.89272285,-0.039915714,-0.4798454,-0.17104395,-1.0848708,0.4614578,-0.104300484,-0.14435875,0.1019188,0.9303131,0.50141895,0.52861726,-0.52210665,-0.26247346,0.74458015,-0.29106724,0.9805994,-0.16427524,-0.32178217,-0.5376129,-0.30648094,0.5589782,-0.22357696,0.030674454,0.0755228,-0.6904399,-0.367739,0.47445196,1.0188601,0.57532954,0.4254353,0.897717,0.13423407,0.21115167,-0.530345,0.71488506,-0.030933838,-0.13977471,-0.92007613,-0.476025,0.26908052,-0.71414185,-0.4624176,0.6114347,-0.03892412,0.31617883,0.005034495,0.035003684,0.8589612,0.034249164,-0.16742648,1.0597357,-0.00997008,-2.1783004,-0.27352917,0.13061357,-0.53263116,-0.3277083,-0.56529135,-0.66030633,0.5243227,0.3356507,-0.5194478,0.91995,0.30228966,-0.12623835,0.42070365,0.37178943,0.34493652,0.25196615,0.13019738,-0.16317594,-0.36503044,-0.80951345,0.12462215,1.5770059,0.5532972,0.053753935,0.043726575,0.48611057,-0.8249751,-0.5752313,0.68656516,-0.059063487,-0.78823644,0.59111255,-0.05612494,-0.7448348,0.4280154,0.70017177,-0.32861507,0.011147824,-0.5469661,1.5443617,-0.17672525,-0.07973755,-0.33454615,0.59265155,-0.5078532,0.058978908,0.6719028,-0.6629716,0.1701245,-0.2122708,-0.4967857,-0.75901526,0.41967136,-0.15611528,1.0878384,0.29420692,-0.6555595,0.1274776,0.50716627,0.09870924,-0.13585925,0.5559255,-0.8327562,0.41426206],"result":{"type":"object","properties":{"data":{"description":"Response data in JSON format","type":"any"},"status":{"description":"HTTP response status code","type":"number"},"statusText":{"description":"HTTP response status text","type":"string"}},"required":["status","statusText","data"]},"sql_tables":[],"sql_queries":[],"file_inbox":null,"oauth":[{"name":"Airtable","authorizationUrl":"https://airtable.com/oauth2/v1/authorize","tokenUrl":"https://airtable.com/oauth2/v1/token","clientId":"","clientSecret":"","redirectUrl":"https://secrets.shinkai.com/redirect","version":"2.0","responseType":"code","scopes":["data.records:read","data.records:write","schema.bases:read","schema.bases:write"],"pkceType":"S256","refreshToken":"","requestTokenAuthHeader":"basic","requestTokenContentType":"application/x-www-form-urlencoded"}],"assets":null,"runner":"any","operating_system":["linux","macos","windows"],"tool_set":""},false]} \ No newline at end of file diff --git a/tools/dev-airtable/metadata.json b/tools/dev-airtable/metadata.json index eaaf0dfb..d6894f50 100644 --- a/tools/dev-airtable/metadata.json +++ b/tools/dev-airtable/metadata.json @@ -9,7 +9,10 @@ "api", "oauth" ], - "configurations": { + "runner": "any", + "operating_system": ["linux", "macos", "windows"], + "tool_set": "", + "configurations": { "type": "object", "properties": {}, "required": [] diff --git a/tools/dev-github/.tool-dump.test.json b/tools/dev-github/.tool-dump.test.json new file mode 100644 index 00000000..ff83e13a --- /dev/null +++ b/tools/dev-github/.tool-dump.test.json @@ -0,0 +1 @@ +{"type":"Deno","content":[{"name":"GitHub API Request","homepage":null,"author":"@@official.shinkai","version":"1.0.0","js_code":"import { getAccessToken } from './shinkai-local-support.ts';\n\ntype CONFIG = {};\ntype INPUTS = { url: string, method: string, body?: string, query_params?: string, headers?: Record };\ntype OUTPUT = { status: number, statusText: string, data: any };\n\nexport async function run(config: CONFIG, inputs: INPUTS): Promise {\n const accessToken = await getAccessToken('Gmail');\n \n const url = new URL(inputs.url);\n if (inputs.query_params) {\n url.search += inputs.query_params;\n }\n\n const headers = new Headers({\n 'Authorization': `Bearer ${accessToken}`,\n 'Accept': 'application/json',\n ...inputs.headers\n });\n\n const options: RequestInit = {\n method: inputs.method,\n headers: headers\n };\n\n if (inputs.body) {\n headers.set('Content-Type', 'application/json');\n options.body = inputs.body;\n }\n\n const response = await fetch(url, options);\n let data;\n try {\n data = await response.json();\n } catch (error) {\n console.log(error);\n data = await response.text();\n }\n\n return {\n status: response.status,\n statusText: response.statusText,\n data: data\n };\n}\n","tools":[],"config":[],"description":"Tool to make requests to the GitHub API using OAuth for authentication.","keywords":["github","api","request","oauth"],"input_args":{"type":"object","properties":{"query_params":{"type":"string","description":"Query parameters to append to the URL"},"method":{"type":"string","description":"HTTP method (GET, POST, PUT, DELETE)"},"url":{"type":"string","description":"The API endpoint URL"},"body":{"type":"string","description":"Request body (if applicable)"},"headers":{"type":"string","description":"Additional headers as newline-separated key:value pairs"}},"required":["url","method"]},"output_arg":{"json":""},"activated":false,"embedding":[0.104474366,0.1789853,-0.14589505,-0.28470948,-0.2992694,0.2738406,-0.62131745,-0.17313515,0.12262191,-0.16918209,-0.52338684,0.28256464,0.31931195,0.24013732,0.20037325,-0.32983777,-0.68985265,-0.6896951,-1.0748669,0.10079691,-0.070859656,0.34019786,0.024408706,0.2652145,-0.6762636,0.20523047,0.11294018,0.017352968,-1.6043117,-2.477057,0.3952297,0.9387908,0.07872473,-0.020477198,-0.13088217,-0.45235735,-0.19094342,0.27972803,0.3643741,-0.22845596,-0.4957738,0.34136733,-0.038314216,-0.3615659,0.08899718,-0.15010872,0.47141683,-0.40441635,0.5726872,0.07066386,-0.14549449,-0.4109354,0.06568129,0.38599715,-0.16574901,0.06409683,-0.33546495,0.26378053,-0.15197404,0.5013747,0.6103886,0.09839189,-3.8159733,-0.5515001,-0.11275537,-0.08720782,-0.59801245,-0.47457418,0.577513,-0.07997577,0.072082415,-0.09246223,-0.5585195,-0.4307866,0.15202272,-0.42808196,0.050273184,0.914256,0.04101233,0.403556,0.13283864,1.1257274,0.26215333,-0.25309268,-0.24078855,1.0094249,-0.3452593,-0.30283093,0.5709753,0.1879135,-0.46356404,-0.44276556,-0.19221303,-0.079529,0.1874036,-0.7641354,-0.1259934,0.94297355,0.64413655,2.7520914,0.5783922,0.12305328,0.19732133,-0.9910205,0.68444693,-0.29617676,0.08045289,-0.19075161,0.08375329,0.5019671,0.5360795,0.21138458,0.33683997,0.5623444,0.19754444,-0.35954422,-0.124489896,0.16818745,0.060731865,1.1784486,-0.17955197,-0.18868972,-0.9927129,-0.5095346,-0.048720334,0.2659517,-0.38077143,0.28348428,0.5068915,-0.29010117,0.53250575,-0.3656075,-0.7768232,-0.26261836,0.38620946,0.25766277,0.3106315,-0.45008847,-0.2580926,-0.5103302,0.19535372,-1.0063221,0.8089453,0.14450127,0.040210523,0.2078816,-0.585227,0.22572929,-0.38254684,-0.2753624,0.2896491,0.12778006,0.28048435,0.23705527,0.5685739,-0.25212172,-0.0946754,-0.19256091,-0.43366957,0.2961711,0.22517721,0.2071858,0.36009455,-0.17858212,0.17363772,-0.7698297,0.9534353,-0.060584344,0.17656863,-0.32736918,-0.011629432,-0.07462042,-0.2501405,0.1347404,-0.93616474,-0.1311738,0.2181553,-0.018581688,0.09122595,-0.24847314,0.14817327,1.0021508,-0.148942,-0.5696428,-0.21956074,0.68159723,0.12888798,0.14872018,1.2800324,0.50184774,-1.0899026,1.5600759,-0.628405,-0.46108148,0.442696,0.29463315,-0.013340976,0.83069605,-0.32020548,-0.6289246,-0.6515578,-0.18541574,-0.55513215,0.3182062,-0.31705445,-0.17535044,0.6248276,0.47196227,-0.09436685,-0.8068861,0.15342404,-0.26166436,0.4500059,0.08331638,0.3571517,-0.40619993,-0.014766999,-0.49233127,-0.32177964,0.24956124,0.23845792,0.5499191,-0.7885069,-0.41700822,-0.10498874,0.18425268,0.023265429,0.5456197,-0.579921,-0.38541192,0.7934298,1.2266899,0.1836024,1.1341076,0.8629058,0.4765041,-0.4012335,0.88555574,0.53113246,-0.73528117,-0.46436363,-0.6189712,-0.70507836,0.27479845,0.23205143,-0.34324887,-0.14557332,-0.75094086,0.20577016,2.168607,0.49681535,0.04079765,0.44210678,-0.11567742,-0.16750011,-0.3663806,-2.4422135,-0.23583625,-0.09196021,0.41278622,0.47665697,0.26028523,0.22534794,-0.0022263685,0.6222882,0.07071651,-0.5848335,-0.56326985,-0.3121813,-0.3057935,-0.22294496,1.2016302,0.18671228,-0.12975779,-0.07047638,0.61052084,0.04736154,0.1986008,-0.815316,-1.0089341,0.43669024,0.06510777,0.2766951,-0.28900397,-0.26363167,-0.5020753,-0.0871274,0.79399633,-0.56126887,0.34541163,-0.02763072,-0.5861142,-0.637671,0.12914841,1.582386,0.79495376,0.4081334,0.42482838,0.21837367,0.13737145,-0.2620017,0.47337875,0.07989585,-0.18035658,-1.0560601,-0.5221691,0.6420079,-1.0617336,-0.20038256,0.04982185,0.23876807,0.9147562,-0.26022595,0.024197228,0.69492465,-0.10507881,-0.118440345,0.33405674,0.32215664,-1.9924461,0.37896654,-0.16025874,-0.30566368,-0.031753972,-0.38154697,-0.53154755,0.1380538,0.6988164,-0.2786235,1.3915944,0.222251,-0.03802178,-0.21092513,0.35012025,0.32132858,0.1622523,-0.018263308,-0.22973874,-0.31465438,-0.29226214,0.39477617,0.91550046,0.3671716,0.38892803,0.39029104,0.7700355,-0.7754761,-0.64264375,-0.01619935,-0.16990212,-0.52503633,1.2261941,0.04242625,-0.7515844,0.5569037,0.6653121,-0.06753075,-0.24911672,-0.5853141,1.5825881,-0.06472213,-0.31134737,0.14875367,-0.2769496,-0.70260096,0.46207398,0.3734747,0.039091498,0.12428123,0.02976225,0.32213795,-0.69536984,0.37965664,-0.06073783,0.38426822,0.38321775,-0.54986346,0.41593558,1.3625715,0.10081379,-0.30645773,0.15807495,-1.1208398,0.109239414],"result":{"type":"object","properties":{"data":{"description":"Response data in JSON format","type":"any"},"status":{"description":"HTTP response status code","type":"number"},"statusText":{"description":"HTTP response status text","type":"string"}},"required":["status","statusText","data"]},"sql_tables":[],"sql_queries":[],"file_inbox":null,"oauth":[{"name":"Github","authorizationUrl":"https://github.com/login/oauth/authorize","tokenUrl":"https://github.com/login/oauth/access_token","clientId":"","clientSecret":"","redirectUrl":"https://secrets.shinkai.com/redirect","version":"2.0","responseType":"code","scopes":["repo","user"],"pkceType":"","refreshToken":"","requestTokenAuthHeader":null,"requestTokenContentType":null}],"assets":null,"runner":"any","operating_system":["linux","macos","windows"],"tool_set":""},false]} \ No newline at end of file diff --git a/tools/dev-github/metadata.json b/tools/dev-github/metadata.json index 4c204d10..0c866dce 100644 --- a/tools/dev-github/metadata.json +++ b/tools/dev-github/metadata.json @@ -10,6 +10,9 @@ "request", "oauth" ], + "runner": "any", + "operating_system": ["linux", "macos", "windows"], + "tool_set": "", "configurations": { "type": "object", "properties": {}, diff --git a/tools/dev-gmail/.tool-dump.test.json b/tools/dev-gmail/.tool-dump.test.json new file mode 100644 index 00000000..9e3e945a --- /dev/null +++ b/tools/dev-gmail/.tool-dump.test.json @@ -0,0 +1 @@ +{"type":"Deno","content":[{"name":"Gmail Developer API","homepage":null,"author":"@@official.shinkai","version":"1.0.0","js_code":"import { getAccessToken } from './shinkai-local-support.ts';\n\ntype CONFIG = {};\ntype INPUTS = { url: string, method: string, body?: string, query_params?: string, headers?: Record };\ntype OUTPUT = { status: number, statusText: string, data: any };\n\nexport async function run(config: CONFIG, inputs: INPUTS): Promise {\n const accessToken = await getAccessToken('Gmail');\n \n const url = new URL(inputs.url);\n if (inputs.query_params) {\n url.search += inputs.query_params;\n }\n\n const headers = new Headers({\n 'Authorization': `Bearer ${accessToken}`,\n 'Accept': 'application/json',\n ...inputs.headers\n });\n\n const options: RequestInit = {\n method: inputs.method,\n headers: headers\n };\n\n if (inputs.body) {\n headers.set('Content-Type', 'application/json');\n options.body = inputs.body;\n }\n\n const response = await fetch(url, options);\n let data;\n try {\n data = await response.json();\n } catch (error) {\n console.log(error);\n data = await response.text();\n }\n\n return {\n status: response.status,\n statusText: response.statusText,\n data: data\n };\n}\n","tools":[],"config":[],"description":"Tool to make requests to the Gmail Developer API using OAuth for authentication.","keywords":["gmail","api","request","oauth"],"input_args":{"type":"object","properties":{"body":{"type":"string","description":"Request body (if applicable)"},"url":{"type":"string","description":"The API endpoint URL"},"method":{"type":"string","description":"HTTP method (GET, POST, PUT, DELETE)"},"headers":{"type":"string","description":"Additional headers as newline-separated key:value pairs"},"query_params":{"type":"string","description":"Query parameters to append to the URL"}},"required":["url","method"]},"output_arg":{"json":""},"activated":false,"embedding":[0.26470146,0.32205045,0.61179537,-0.5919323,0.22923468,0.10816504,0.07041721,-0.64475125,-0.34176713,-0.13120773,-0.39589515,0.43932748,0.033632196,0.35232154,0.07881651,-0.12791054,0.13638885,-0.43992043,-1.4110267,-0.11350758,0.22722253,0.6605084,0.6765055,0.14576624,-0.27834004,0.0067811618,0.22666538,-0.027820311,-1.3911723,-2.0972362,1.0188582,0.9905591,0.43523666,-0.22821835,-0.3460026,-0.98563933,0.07142788,0.44995067,0.26842025,-0.23201448,-0.61247,0.39098942,-0.23319644,-0.17024902,-0.051042374,-0.46035847,0.22615547,-0.13251443,0.53095555,0.20078164,-0.05527861,-0.23042776,0.16677085,0.5141119,-0.37370312,0.38793936,-0.27308208,0.11767128,0.18322822,0.3238504,0.20001572,0.581648,-3.4709065,-0.328526,-0.0054377783,-0.064710386,-0.05501612,-0.6771008,-0.0047670305,0.1858693,-0.14796317,-0.39908725,-0.85922223,0.30021974,0.61956704,-0.2154017,-0.09128709,1.1813711,0.11129572,-0.09572041,0.64493304,1.0322196,-0.19180678,-0.032956224,-0.70164055,0.7779458,-0.02578017,-0.13936792,0.4979846,-0.0044409484,-0.6530715,-0.06179936,-0.25137144,-0.30902258,-0.3563936,-0.47999752,-0.13575874,0.60429025,0.49155483,2.9011126,0.59584534,-0.15357475,0.019865103,-1.4498463,0.32318592,0.13170505,-0.27913794,-0.57575965,0.09278929,0.14201088,0.27037963,0.1709851,0.34816688,-0.029684044,0.28601637,-0.40736657,0.40757287,0.46040386,0.26113462,0.92627317,0.08500686,0.26371318,-0.8442506,-0.28892842,-0.29109323,0.27561712,-0.1428834,0.5516516,0.25079283,-0.24976802,0.43473217,-0.259336,-0.31904987,0.2955633,0.21684882,0.49688894,0.07587278,-0.8151566,-0.33296838,-0.26684403,0.23364377,-1.3607222,1.1784441,0.49117664,0.27248552,-0.51942587,-0.21978983,0.41327843,-0.24021325,-0.9221073,-0.2229713,-0.12356469,-0.013465232,-0.2704978,0.82796025,0.2632219,-0.53187555,-0.009470783,-0.81278807,0.21458861,0.16308014,0.7365371,0.49381346,0.50368845,0.48750538,-0.90733665,0.7766607,0.3263464,-0.053826094,-0.054190762,-0.12743968,0.030087117,-0.18982996,0.6056187,-0.2684325,-0.759011,-0.46414098,-0.05791522,-0.06913181,-0.5564404,0.20739867,1.0870659,-0.1945805,-0.563322,-0.044222094,0.7610742,0.07594151,0.015794748,0.5477039,0.34434056,-1.0258762,1.5730201,-0.6936028,-0.87572443,0.3252228,0.16401039,-0.34613883,0.33700818,-0.06713183,-0.29990396,-0.8415211,-0.8200769,-0.8664439,0.22134668,-0.103018664,0.24733382,0.141236,0.052005097,0.5805108,-0.6461834,0.091986105,-0.5163915,0.22566481,0.2793109,0.2532031,-0.3356815,-0.09669796,-0.20769936,-0.18879099,0.15510234,0.66353375,0.6217975,-1.360394,-0.45623952,-0.013478842,0.33462393,-0.00888741,0.21568374,-0.65764886,-0.4014885,0.84886056,1.6591781,-0.42553765,1.210451,0.74457127,-0.012253769,0.23400211,0.8537518,0.43399826,-0.7749448,-0.45445508,-0.30813244,-0.43267423,0.32900155,-0.1663203,-0.2270312,0.5238393,-0.10961367,-0.10650527,1.9263837,0.87813956,0.7454335,-0.18325819,0.10668288,-0.2250112,0.06247496,-1.6809002,-0.08882173,-0.20253171,-0.23626328,0.060812943,0.048486933,0.3539275,-0.19435288,0.46025112,-0.107089534,-0.85734844,-1.0144794,-0.27825797,-0.302645,-0.66223466,0.7014563,0.35992092,0.13238095,-0.4412359,0.4669504,0.03114283,0.34790185,-0.45591828,-0.90532666,0.63908607,-0.20163922,0.46352902,-0.21396069,-0.4161461,-0.6522068,0.41573086,0.5053909,-0.14973956,0.58325166,-0.44277117,-0.7239924,-0.17843749,0.33170387,1.1138245,0.20592006,0.38553283,0.5355488,0.3618234,0.44250393,-0.22531286,0.6406,0.22235334,-0.91384625,-0.694359,-0.85539836,0.407946,-0.88062364,-0.5477666,0.12901668,-0.07956149,0.8823973,-0.33441928,0.092213236,0.33655834,-0.17911161,0.10620628,0.73786104,-0.22525665,-1.9384273,-0.024766957,-0.111927,-0.43712506,-0.15224199,-0.8607047,0.034774676,-0.40403953,0.17929056,-0.40091544,1.8763776,0.21530508,-0.48761156,-0.50039726,0.57667017,0.26179203,0.400131,-0.28557023,-0.51501614,-0.76663136,-0.525419,0.22337097,1.4371707,0.63016605,-0.36762848,0.6553967,0.3864137,-0.5922828,-0.7520281,0.15045173,-0.25946423,-0.9362404,0.7018766,-0.0013316385,-0.15846828,0.6577807,0.73884296,0.0011551976,0.09948579,-0.3187942,1.7846881,0.2936271,-0.1546507,-0.12387422,0.12594798,-0.35095707,0.053016946,0.731707,-0.32214588,-0.0039092153,0.14899573,0.30400383,-0.6620394,0.5094929,0.004661007,0.46318674,0.21372895,-0.28880408,0.55350685,0.33702976,0.53947484,-0.29807436,0.6310538,-0.31452963,0.45398003],"result":{"type":"object","properties":{"data":{"description":"Response data in JSON format","type":"any"},"status":{"description":"HTTP response status code","type":"number"},"statusText":{"description":"HTTP response status text","type":"string"}},"required":["status","statusText","data"]},"sql_tables":[],"sql_queries":[],"file_inbox":null,"oauth":[{"name":"Gmail","authorizationUrl":"https://accounts.google.com/o/oauth2/v2/auth","tokenUrl":"https://oauth2.googleapis.com/token","clientId":"","clientSecret":"","redirectUrl":"https://secrets.shinkai.com/redirect","version":"2.0","responseType":"code","scopes":["https://www.googleapis.com/auth/gmail.readonly","https://www.googleapis.com/auth/gmail.modify","https://www.googleapis.com/auth/gmail.send","https://www.googleapis.com/auth/gmail.compose","https://www.googleapis.com/auth/userinfo.email","https://www.googleapis.com/auth/userinfo.profile"],"pkceType":"","refreshToken":"","requestTokenAuthHeader":null,"requestTokenContentType":null}],"assets":null,"runner":"any","operating_system":["linux","macos","windows"],"tool_set":""},false]} \ No newline at end of file diff --git a/tools/dev-gmail/metadata.json b/tools/dev-gmail/metadata.json index 445dc283..be3814d5 100644 --- a/tools/dev-gmail/metadata.json +++ b/tools/dev-gmail/metadata.json @@ -10,7 +10,10 @@ "request", "oauth" ], - "configurations": { + "runner": "any", + "operating_system": ["linux", "macos", "windows"], + "tool_set": "", + "configurations": { "type": "object", "properties": {}, "required": [] diff --git a/tools/dev-google-drive/.tool-dump.test.json b/tools/dev-google-drive/.tool-dump.test.json new file mode 100644 index 00000000..0aa311ff --- /dev/null +++ b/tools/dev-google-drive/.tool-dump.test.json @@ -0,0 +1 @@ +{"type":"Deno","content":[{"name":"Google Drive Developer API","homepage":null,"author":"@@official.shinkai","version":"1.0.0","js_code":"import { getAccessToken } from './shinkai-local-support.ts';\n\ntype CONFIG = {};\ntype INPUTS = { url: string, method: string, body?: string, query_params?: string, headers?: Record };\ntype OUTPUT = { status: number, statusText: string, data: any };\n\nexport async function run(config: CONFIG, inputs: INPUTS): Promise {\n const accessToken = await getAccessToken('GoogleDrive');\n \n const url = new URL(inputs.url);\n if (inputs.query_params) {\n url.search += inputs.query_params;\n }\n\n const headers = new Headers({\n 'Authorization': `Bearer ${accessToken}`,\n 'Accept': 'application/json',\n ...inputs.headers\n });\n\n const options: RequestInit = {\n method: inputs.method,\n headers: headers\n };\n\n if (inputs.body) {\n headers.set('Content-Type', 'application/json');\n options.body = inputs.body;\n }\n\n const response = await fetch(url, options);\n let data;\n try {\n data = await response.json();\n } catch (error) {\n console.log(error);\n data = await response.text();\n }\n\n return {\n status: response.status,\n statusText: response.statusText,\n data: data\n };\n}\n","tools":[],"config":[],"description":"Tool to make requests to the Google Drive Developer API using OAuth for authentication.","keywords":["google","drive","documents","api","request","oauth"],"input_args":{"type":"object","properties":{"headers":{"type":"string","description":"Additional headers as newline-separated key:value pairs"},"url":{"type":"string","description":"The API endpoint URL"},"query_params":{"type":"string","description":"Query parameters to append to the URL"},"method":{"type":"string","description":"HTTP method (GET, POST, PUT, DELETE)"},"body":{"type":"string","description":"Request body (if applicable)"}},"required":["url","method"]},"output_arg":{"json":""},"activated":false,"embedding":[0.41145733,-0.250866,0.59526724,-0.27781257,0.05458248,0.09074263,-0.41514787,-0.26637468,-0.13885616,-0.15084887,-0.004033529,0.94764805,-0.5702948,0.38040015,-0.37120903,-0.6451298,-0.10119988,-0.53708416,-1.3778415,-0.054818824,0.18768674,0.21859448,0.66551435,-0.22156303,-0.35831693,-0.09294809,0.10577531,0.1485924,-1.1696893,-1.9109026,1.000666,0.19311753,0.36955768,0.07462177,-0.3710366,-0.8100492,0.12396994,0.25717536,0.18401153,-0.33009452,-0.46609312,0.27586377,-0.012913942,0.14534208,0.19667034,-0.38056493,0.5616491,0.0688269,0.8124579,0.20711783,-0.48318312,-0.2460672,0.00035945326,0.42223278,0.04326398,0.282555,-0.35048923,0.4415855,0.052057683,0.26732802,0.63314563,0.5401859,-3.6545148,-0.35540342,0.42099944,0.39492217,0.09182762,-1.0626295,0.07696069,0.24656948,-0.0023537502,-0.37073302,-0.65972966,0.13723165,0.25669697,-0.5926157,-0.25278324,1.1650219,-0.07284887,-0.37909958,0.18459342,1.1234386,-0.56382596,0.16061977,-1.0461287,0.64737713,-0.21023813,-0.09257316,0.6056616,-0.18644187,-0.84299946,0.07215921,-0.3906373,-0.44177213,-0.4444238,-0.71797246,0.16116287,0.7185984,1.2330002,2.932479,0.23358479,-0.08303289,-0.4081625,-1.2382203,0.3332489,0.22859994,-0.21988802,-0.3193382,0.2978271,0.27701592,0.54844993,0.27689195,-0.14368877,0.18079242,0.7671432,0.016720125,0.40029705,0.41838595,0.071843795,0.5660254,-0.16053875,0.4228653,-0.67853737,-0.16728392,-0.3241891,0.10075842,-0.21943028,0.5216331,0.54845756,-0.47733057,0.5042299,-0.6466475,-0.67629933,0.028779862,0.24870034,0.53166234,0.038362436,-0.66252047,0.12320829,-0.021609966,0.35983422,-1.2356588,1.1388179,0.16718526,0.55352676,0.07552082,-0.48361602,0.38734508,-0.21460164,-0.87449485,0.013489772,0.29757768,0.34022382,-0.779148,0.7303439,0.14683942,-0.06368165,-0.35956922,-1.2248381,0.2815008,-0.41486675,0.15906446,0.4372464,0.71592546,0.11133315,-0.8328941,0.7733295,0.22248581,0.09591521,-0.287425,0.24939963,-0.13210931,-0.5602544,0.51976824,-0.6675631,-0.3826545,-0.2786663,-0.072973065,0.15781584,-0.469532,0.30635232,0.8506858,-0.3078965,-0.478883,-0.34016448,0.7530519,0.16835898,-0.0051807165,0.30717796,0.5551956,-0.755718,1.3955374,-1.1298562,-0.9998502,0.28410235,0.28118134,-0.45610374,0.3388574,-0.16916463,-0.29349464,-0.40443555,-0.9970581,-0.5992034,0.18372892,0.09834028,0.10027993,0.37831566,0.23568384,-0.3325972,-0.55080634,-0.2462277,-0.4415271,0.409494,0.26462695,-0.07506922,-0.19820836,-0.24607196,-0.17155692,-0.18503737,0.41313228,0.13631843,0.4210624,-1.241514,-0.4509837,-0.22625674,0.20716232,0.24029514,-0.07536511,-0.54090285,-0.71522135,0.9165938,1.5631357,0.18926843,0.9051148,0.55434924,0.2342948,0.05845177,0.73322165,-0.15405443,-0.7298137,0.20523569,-0.042693846,-0.62588,-0.048849642,-0.09497428,-0.1243686,0.60039335,0.17749208,-0.21050242,1.7940316,0.30283234,0.91297925,-0.28683567,-0.03554717,-0.051626973,-0.07897166,-2.0545683,-0.6198246,-0.114164755,0.12660778,0.5312415,0.23804417,0.05120703,0.1953154,0.4080417,-0.0513161,-0.38189834,-0.79580665,-0.49969387,-0.2812438,-0.20058791,0.66534775,0.53980255,0.2826978,-0.0018138457,0.63834596,-0.10922501,0.4203884,-0.65115994,-0.5400572,0.7495745,0.0028807241,0.72274864,-0.12996538,-0.17973053,-0.6399719,0.032929238,1.1446716,-0.8674432,0.30658057,-0.5044213,-0.82295686,-0.30519554,0.52940416,1.3083184,0.5380153,0.58437055,0.31066903,-0.12559626,-0.37175053,-0.48312223,-0.08982151,0.19548196,-0.38103992,-0.7387473,-0.6775381,0.0455916,-0.61780727,-0.3813777,0.3480535,-0.12183604,1.3370614,0.07587001,-0.08610439,0.2215096,0.1051363,-0.033827323,0.70865726,-0.42926344,-1.8196371,-0.051694345,-0.24367905,-0.40654227,-0.35764438,-1.0206796,-0.35463154,-0.3442675,0.4408235,-0.087246984,1.9195595,0.23091638,-0.47239345,-0.47261918,0.7512542,0.20503537,0.18801895,0.31673014,-0.30217138,-0.41322237,-0.25356904,0.49318933,0.89115447,0.5507481,-0.009909943,0.41700178,0.21945286,-0.6178222,-1.0342348,0.02243758,-0.55996525,-0.51449674,0.28834307,0.0034019165,0.016114386,0.9611391,0.79313934,-0.18861817,0.5601503,-0.12026871,2.120836,-0.07697352,0.16222683,0.23972753,0.4663288,-0.63720423,0.45852023,0.55358297,-0.08186622,0.16561341,-0.110498525,0.29876724,-0.7799801,0.5109985,0.19655009,0.76997197,0.54751366,-0.08030045,0.869542,0.22767106,0.4706434,-0.3653284,0.6774856,-0.41342586,0.44978362],"result":{"type":"object","properties":{"data":{"description":"Response data in JSON format","type":"any"},"status":{"description":"HTTP response status code","type":"number"},"statusText":{"description":"HTTP response status text","type":"string"}},"required":["status","statusText","data"]},"sql_tables":[],"sql_queries":[],"file_inbox":null,"oauth":[{"name":"GoogleDrive","authorizationUrl":"https://accounts.google.com/o/oauth2/v2/auth","tokenUrl":"https://oauth2.googleapis.com/token","clientId":"","clientSecret":"","redirectUrl":"https://secrets.shinkai.com/redirect","version":"2.0","responseType":"code","scopes":["https://www.googleapis.com/auth/documents","https://www.googleapis.com/auth/drive"],"pkceType":"","refreshToken":"","requestTokenAuthHeader":null,"requestTokenContentType":null}],"assets":null,"runner":"any","operating_system":["linux","macos","windows"],"tool_set":""},false]} \ No newline at end of file diff --git a/tools/dev-google-drive/metadata.json b/tools/dev-google-drive/metadata.json index 50d5f861..29106ed2 100644 --- a/tools/dev-google-drive/metadata.json +++ b/tools/dev-google-drive/metadata.json @@ -12,7 +12,10 @@ "request", "oauth" ], - "configurations": { + "runner": "any", + "operating_system": ["linux", "macos", "windows"], + "tool_set": "", + "configurations": { "type": "object", "properties": {}, "required": [] diff --git a/tools/dev-twitter/.tool-dump.test.json b/tools/dev-twitter/.tool-dump.test.json new file mode 100644 index 00000000..8a2bc8ea --- /dev/null +++ b/tools/dev-twitter/.tool-dump.test.json @@ -0,0 +1 @@ +{"type":"Deno","content":[{"name":"X/Twitter Developer API","homepage":null,"author":"@@official.shinkai","version":"1.0.0","js_code":"import { getAccessToken } from './shinkai-local-support.ts';\n\ntype CONFIG = {};\ntype INPUTS = { url: string, method: string, body?: string, query_params?: string, headers?: Record };\ntype OUTPUT = { status: number, statusText: string, data: any };\n\nexport async function run(config: CONFIG, inputs: INPUTS): Promise {\n const accessToken = await getAccessToken('Twitter');\n \n const url = new URL(inputs.url);\n if (inputs.query_params) {\n url.search += inputs.query_params;\n }\n\n const headers = new Headers({\n 'Authorization': `Bearer ${accessToken}`,\n 'Accept': 'application/json',\n ...inputs.headers\n });\n\n const options: RequestInit = {\n method: inputs.method,\n headers: headers\n };\n\n if (inputs.body) {\n headers.set('Content-Type', 'application/json');\n options.body = inputs.body;\n }\n\n const response = await fetch(url, options);\n let data;\n try {\n data = await response.json();\n } catch (error) {\n console.log(error);\n data = await response.text();\n }\n\n return {\n status: response.status,\n statusText: response.statusText,\n data: data\n };\n}\n","tools":[],"config":[],"description":"Tool to make requests to the X/Twitter Developer API using OAuth for authentication.","keywords":["x","twitter","api","request","oauth"],"input_args":{"type":"object","properties":{"url":{"type":"string","description":"The API endpoint URL"},"query_params":{"type":"string","description":"Query parameters to append to the URL"},"headers":{"type":"string","description":"Additional headers as newline-separated key:value pairs"},"body":{"type":"string","description":"Request body (if applicable)"},"method":{"type":"string","description":"HTTP method (GET, POST, PUT, DELETE)"}},"required":["url","method"]},"output_arg":{"json":""},"activated":false,"embedding":[0.42238626,0.1940684,0.1621591,-0.58199036,-0.056759518,0.25007504,-0.60028946,-0.22949949,0.1703219,0.06128206,-0.56241095,0.4790186,-0.25989002,0.42603824,0.1902165,-0.17220789,-0.068291724,-1.1015218,-1.6683614,0.25384632,0.12439205,0.88970435,0.49251196,0.13752422,-0.25469685,0.1400167,0.18676531,-0.022115856,-1.2898831,-2.252991,0.72275364,0.657342,-0.36058977,0.06260331,-0.2571718,-0.4170899,0.14978376,0.2373689,0.13766462,0.29832494,-0.45925286,0.50791013,-0.16093348,-0.13356501,0.03100721,-0.62542516,0.015000072,0.06870633,0.36165786,0.13837364,-0.06415968,-0.35845768,0.06292459,0.4656182,-0.5548089,-0.18171258,-0.50970346,0.02778193,-0.14249653,0.4044462,0.4496968,0.36910862,-3.8343732,-0.24076322,-0.060403027,-0.18447289,-0.2833095,-0.117786884,0.13662559,0.4387682,-0.011926986,-0.39637256,-0.49733645,-0.43408102,0.41291457,-0.3880837,0.3391109,0.530102,0.10717869,0.20449798,0.6272005,1.0263896,-0.17127134,-0.19611521,-0.28866637,1.1089785,-0.26755905,-0.44123757,0.6864118,0.13619173,-0.59572196,-0.29972386,0.21019894,-0.19156796,-0.31688356,0.09246864,-0.13356464,0.81329995,0.5952205,3.0931184,0.34662187,-0.12167364,0.04388334,-0.62060595,-0.3783559,-0.37545013,-0.29404652,-0.26011512,0.28208762,-0.12632324,0.27830952,-0.03986113,-0.17067137,0.13511676,0.3633533,-0.19287732,0.16994584,0.68268913,0.027658809,0.7060048,-0.24634747,0.50536996,-1.0397476,-0.0533538,-0.56096095,0.18581901,-0.5297197,0.29925987,0.24289422,-0.7958711,0.44034514,-0.79406875,-0.38315424,0.0683779,0.04515049,0.4697355,-0.12702833,-0.5505659,-0.20466411,-0.37500837,0.48041573,-1.0515554,0.93299156,0.41159192,0.33447322,0.58050865,-0.4608896,0.41875482,-0.13844424,-0.23506808,-0.13501015,0.37552437,-0.14912288,-0.032240294,0.952666,0.23011322,-0.26561543,-0.16960403,-0.8034834,0.19062024,0.100388944,0.09585557,0.537765,0.17361759,0.07095626,-0.20894559,0.98406327,-0.040908776,0.38967523,-0.19650826,0.1346172,-0.019266918,-0.18036346,0.6209239,-0.7548514,-0.49223524,-0.7918689,-0.06306916,-0.1422622,-0.33674175,0.29811278,1.2049588,-0.38047493,-0.40720734,0.02835843,0.49356484,0.169341,-0.09009004,0.7361506,0.68703985,-0.45759755,1.4373178,-0.54387635,-0.66622645,0.5549403,0.047592282,0.074843496,0.35154605,-0.22534396,-0.6004111,-0.51630765,-0.5233179,-0.7420609,-0.04778059,-0.16073227,0.22046703,0.70775187,0.02481758,0.2693597,-0.5127439,-0.065689296,-0.5979744,0.6824775,0.42913607,0.047949106,-0.019154005,0.010441657,-0.5190484,0.05108098,0.0558239,0.246521,0.41467568,-0.8671548,-0.46036005,0.12348008,-0.24901523,-0.20412749,0.31863534,-0.79968286,-0.73942596,0.42086563,1.0827986,0.2553392,1.5684226,0.84394765,-0.17288217,-0.008212604,1.2971505,0.61099756,-0.5182753,-0.1137956,0.19285744,-0.4304893,0.24138467,-0.041171774,-0.16584481,-0.18265793,-0.44444367,0.030413866,1.8830745,0.07388539,0.4637174,0.1691723,0.11814129,-0.46182054,-0.23107347,-2.3127198,-0.2715583,0.05088962,0.5445359,0.21399564,0.039412633,0.39823177,-0.529232,-0.08995435,0.18565862,-0.91069114,-0.37902927,-0.124137476,-0.40821847,-1.1029077,0.80073345,0.027528487,-0.3807156,-0.13991734,0.59127367,0.14108002,0.24113715,-0.8795686,-0.19411103,0.13202555,0.2150714,0.34133044,0.0076741427,-0.15748063,-0.6490387,-0.18409544,0.586783,-0.19003776,-0.11268105,0.13198596,-0.42340448,-0.28518748,0.43408802,1.5161858,0.5471435,0.62249976,0.24957423,0.07677624,0.25215602,-0.5527547,0.14778271,0.11166375,-0.38029012,-0.9771133,-0.87555194,0.2637835,-1.0909687,-0.14693457,0.0932121,0.20991862,1.2631521,-0.055089176,-0.060076296,0.9514703,-0.16368428,-0.35981607,0.56544125,0.016210336,-1.9739183,0.15888977,0.21553972,-0.3458055,-0.4423701,-0.31656513,0.18848798,0.0326237,0.66326123,-0.07320005,1.6787579,0.108202994,-0.4772119,0.10571116,0.19775164,0.30401593,0.6995199,-0.5255359,-0.18053809,-0.932371,-0.30286753,0.29427153,1.3774354,0.17808856,0.6813629,0.2869355,0.27178162,-0.9132093,-0.6854759,0.35610187,-0.29890317,-0.68829453,0.5754748,-0.124413766,-0.24765307,0.43863305,0.8995142,-0.17879249,-0.21736343,-0.24609914,1.9508395,-0.09127415,-0.59921634,-0.1045409,0.6888946,-0.049753495,0.32172966,0.35146764,-0.6146387,-0.10207706,0.3526738,0.57155526,-0.5344271,0.09051781,0.12879401,0.43726373,0.38176322,-0.3644063,0.7287394,0.5069258,0.4774996,0.116011105,0.18849824,-0.8372088,0.024344347],"result":{"type":"object","properties":{"data":{"description":"Response data in JSON format","type":"any"},"status":{"description":"HTTP response status code","type":"number"},"statusText":{"description":"HTTP response status text","type":"string"}},"required":["status","statusText","data"]},"sql_tables":[],"sql_queries":[],"file_inbox":null,"oauth":[{"name":"twitter","authorizationUrl":"https://twitter.com/i/oauth2/authorize","tokenUrl":"https://api.x.com/2/oauth2/token","clientId":"","clientSecret":"","redirectUrl":"https://secrets.shinkai.com/redirect","version":"2.0","responseType":"code","scopes":["tweet.read","tweet.write","users.read","offline.access"],"pkceType":"plain","refreshToken":"true","requestTokenAuthHeader":null,"requestTokenContentType":null}],"assets":null,"runner":"any","operating_system":["linux","macos","windows"],"tool_set":""},false]} \ No newline at end of file diff --git a/tools/dev-twitter/metadata.json b/tools/dev-twitter/metadata.json index c795aa85..5ccabdd5 100644 --- a/tools/dev-twitter/metadata.json +++ b/tools/dev-twitter/metadata.json @@ -11,6 +11,9 @@ "request", "oauth" ], + "runner": "any", + "operating_system": ["linux", "macos", "windows"], + "tool_set": "", "configurations": { "type": "object", "properties": {}, diff --git a/tools/download-page/.tool-dump.test.json b/tools/download-page/.tool-dump.test.json index f998c8ee..dc6d5682 100644 --- a/tools/download-page/.tool-dump.test.json +++ b/tools/download-page/.tool-dump.test.json @@ -1 +1 @@ -{"type":"Deno","content":[{"name":"Download Pages","homepage":null,"author":"@@official.shinkai","version":"1.0.0","js_code":"\nimport chromePaths from 'npm:chrome-paths@1.0.1';\nimport TurndownService from 'npm:turndown@7.2.0';\nimport { addExtra } from 'npm:puppeteer-extra@3.3.6';\nimport rebrowserPuppeteer from 'npm:rebrowser-puppeteer@23.10.1';\nimport StealthPlugin from 'npm:puppeteer-extra-plugin-stealth@2.11.2';\n\nimport { getHomePath } from './shinkai-local-support.ts';\n\ntype Configurations = {\n chromePath?: string;\n};\n\ntype Parameters = {\n url: string;\n incognito?: boolean;\n};\n\ntype Result = { markdown: string };\n\nexport type Run, I extends Record, R extends Record> = (config: C, inputs: I) => Promise;\n\nconst puppeteer = addExtra(rebrowserPuppeteer as any);\nconst pluginStealth = StealthPlugin();\npluginStealth.enabledEvasions.delete('chrome.loadTimes');\npluginStealth.enabledEvasions.delete('chrome.runtime');\npuppeteer.use(pluginStealth);\n\nexport const run: Run = async (\n configurations: Configurations,\n parameters: Parameters,\n): Promise => {\n const chromePath =\n configurations?.chromePath ||\n Deno.env.get('CHROME_PATH') ||\n chromePaths.chrome ||\n chromePaths.chromium;\n if (!chromePath) {\n throw new Error('Chrome path not found');\n }\n console.log({ chromePath })\n const browser = await puppeteer.launch({\n executablePath: chromePath,\n args: ['--disable-blink-features=AutomationControlled'],\n });\n\n const page = await browser.newPage();\n \n console.log(\"Navigating to website...\");\n await page.goto(parameters.url);\n \n console.log('Waiting for the page to load...');\n await page.waitForNetworkIdle();\n \n console.log('Extracting HTML content...');\n const html = await page.content();\n\n console.log('Closing browser...');\n await browser.close();\n\n console.log('Saving HTML to file...');\n Deno.writeTextFileSync(await getHomePath() + '/download-page.html', html);\n\n console.log('Converting HTML to Markdown...');\n const turndownService = new TurndownService();\n const markdown = turndownService.turndown(html);\n return Promise.resolve({ markdown });\n};\n","tools":[],"config":[{"BasicConfig":{"key_name":"chromePath","description":"The path to the Chrome executable","required":false,"type":null,"key_value":null}}],"description":"Downloads a URL and converts its HTML content to Markdown","keywords":["HTML to Markdown","web page downloader","content conversion","URL to Markdown"],"input_args":{"type":"object","properties":{"url":{"type":"string","description":"A URL of a web page to download"}},"required":["url"]},"output_arg":{"json":""},"activated":false,"embedding":[-0.022859422,0.34394914,-0.26828787,-0.2738084,-0.63775945,-0.07745881,-1.0741392,0.1560609,0.37143725,0.019180652,0.20704071,0.27364534,-0.0067869863,0.52876467,0.6414323,-0.33678514,0.050067496,-0.93635535,-1.4170387,-0.11435936,-0.23238567,1.0892224,0.2120105,0.5584683,0.12247756,-0.064977966,0.14893794,-0.5124398,-0.96074337,-2.0346339,0.73753834,0.45415106,-0.08883569,-0.7438674,0.48413786,-0.58480775,0.05941936,-0.5025951,-0.18222712,-0.3229596,0.09404269,-0.6394208,-0.13328093,-0.35516846,0.26403305,0.2549522,0.011935851,-0.10359208,0.7161654,0.2805506,-0.3459439,-0.7086845,-0.3280931,-0.16880323,-0.38078505,-0.05401938,-0.40572488,0.0827634,0.102821976,0.112446666,-0.2216977,0.31631678,-4.125646,0.27062064,0.5810081,0.39316595,-0.09006638,-0.13725893,-0.23155731,0.06299147,0.22843449,-0.21436238,-0.16343841,-0.28368253,-0.07376786,-0.7834173,0.62592435,-0.18950966,-0.071794435,-0.8110028,0.026290458,0.8741538,0.0618044,0.5859047,-0.556113,0.3412014,0.046755597,-0.41176373,0.313688,-0.0122999,0.368527,-0.90580493,-0.079653844,0.5979872,-0.4543758,0.042234086,-0.10474573,0.24580964,0.1175344,3.1755562,0.80056226,-0.023514325,0.79566926,-0.7410976,-0.0014581755,-0.31112045,-0.039167665,0.100143805,0.5764502,0.1579162,0.65378535,-0.5400134,-0.020097598,0.018258024,0.35735926,-0.64368653,-0.84609747,-0.22342974,0.7505621,0.82978624,-0.4969715,0.5932594,-0.00894372,-0.20878446,0.1974807,0.16078371,-0.15507145,0.3443752,0.18211538,0.038514256,0.48453322,-0.36101848,-0.5905768,0.3267346,0.702126,0.23804805,0.14942536,-0.78500104,0.34118044,-0.7625391,0.2017467,-1.0103437,0.11651488,0.5579052,0.3436056,0.52296245,0.08520118,0.64077246,-0.4686281,-0.30036545,0.123490244,0.44900888,-0.48335668,-0.42536774,0.74946654,-0.068822786,-0.40755105,-0.24519834,-0.1692692,0.52134687,-0.45200285,-0.60263264,0.27810538,0.7042316,0.18795288,-0.3493522,0.046734825,0.22792357,0.6453644,0.451598,0.4749537,-0.23558003,-0.091785856,-0.3761208,0.19023523,-0.013168387,-0.27135915,-0.5617338,-0.0695993,-0.65293926,0.3943035,0.48974362,-0.5824184,-0.4601611,-0.002162248,0.28777352,0.3323654,0.29203975,0.8401477,0.75948477,-0.2863765,1.5633736,-1.0324217,-0.43823823,-0.39899313,-0.14089474,0.17630441,0.6572716,0.3455184,0.090465,0.023112308,-0.39716557,0.4068057,-0.13822418,-0.35577852,-0.021364532,0.4544103,0.026246114,0.18069449,-0.44668064,0.2769035,-0.73281,1.1664879,0.2932155,0.4086936,-0.35218203,-0.25461483,0.409438,0.24547005,0.5120449,0.1091405,0.28187823,-0.19503851,-0.47988772,-0.4020756,0.26754946,0.1451346,0.028484786,-0.5201925,-0.12774691,0.6918011,0.4549158,0.03442505,1.0406747,1.0184767,0.19375554,-0.2703382,0.8375021,0.20192006,-0.63289624,0.19444388,-0.16417834,-0.13579649,-0.2540757,-0.23970604,-1.1852467,-0.13074327,0.33187962,0.46423656,1.7475896,0.77317226,0.50678706,0.6598569,0.04874261,0.2757128,0.064221054,-2.202051,-0.26725778,-0.23615283,1.212763,-0.17240548,0.4422012,0.12729892,0.022317126,-0.2723784,-0.37636,-0.43468815,-1.0617322,-0.35068285,0.31613588,-0.35614374,0.45097005,0.30068332,-0.043214343,0.01916102,0.5010773,0.62649405,-0.31871548,-0.7229701,-0.6690801,0.32861578,-0.17093404,0.5118524,0.00037259609,-0.11062399,-0.35906035,0.13406049,0.44416454,-0.068312965,0.27592757,0.051042564,-0.49447364,-0.063102454,0.8905604,1.6143283,-0.1856372,-0.05961505,-0.35624927,-0.5815494,-0.21133251,-0.23919454,0.3232051,-0.13867204,-0.22855097,-0.93279076,-0.29881087,0.47200906,-0.49601215,-0.15198481,0.017862234,-0.32360247,-0.07765387,0.09425101,-0.24398094,0.6091076,-0.5912474,-0.2593696,0.047237284,-0.20522922,-1.7102749,-0.5065819,0.004834657,0.13834465,-0.19261189,-0.6813854,0.93593514,-0.1833483,-0.16403382,-0.21518946,1.5840325,0.62321234,-0.6040731,-0.65227884,0.421814,0.659497,-0.17027326,-0.077558756,-0.46503827,-0.67175186,0.034123674,0.9178276,1.7945781,0.045439854,0.014577113,0.19752969,0.25004318,-0.85095567,-1.5589556,-0.16364035,-0.26558465,-0.16827886,0.29318962,-0.6095997,-0.1322887,0.52664423,0.69676834,-0.31061935,-0.06737543,-0.7940618,2.265823,0.15195686,0.057539836,-0.032563098,-0.12275851,-0.060634516,0.18676114,0.72584385,-0.5401763,-0.56609005,-0.29295185,0.26685232,-0.19534579,0.35730702,0.4106815,0.62266856,0.33912587,0.23005708,0.6000891,0.2057446,0.54149806,0.43303984,0.21790418,-0.47692624,0.19675124],"result":{"type":"object","properties":{"markdown":{"description":"The Markdown content converted from the web page","type":"string"}},"required":["markdown"]},"sql_tables":null,"sql_queries":null,"file_inbox":null,"oauth":null,"assets":null},false]} \ No newline at end of file +{"type":"Deno","content":[{"name":"Download Pages","homepage":null,"author":"@@official.shinkai","version":"1.0.0","js_code":"\nimport chromePaths from 'npm:chrome-paths@1.0.1';\nimport TurndownService from 'npm:turndown@7.2.0';\nimport { addExtra } from 'npm:puppeteer-extra@3.3.6';\nimport rebrowserPuppeteer from 'npm:rebrowser-puppeteer@23.10.1';\nimport StealthPlugin from 'npm:puppeteer-extra-plugin-stealth@2.11.2';\n\nimport { getHomePath } from './shinkai-local-support.ts';\n\ntype Configurations = {\n chromePath?: string;\n};\n\ntype Parameters = {\n url: string;\n incognito?: boolean;\n};\n\ntype Result = { markdown: string };\n\nexport type Run, I extends Record, R extends Record> = (config: C, inputs: I) => Promise;\n\nconst puppeteer = addExtra(rebrowserPuppeteer as any);\nconst pluginStealth = StealthPlugin();\npluginStealth.enabledEvasions.delete('chrome.loadTimes');\npluginStealth.enabledEvasions.delete('chrome.runtime');\npuppeteer.use(pluginStealth);\n\nexport const run: Run = async (\n configurations: Configurations,\n parameters: Parameters,\n): Promise => {\n const chromePath =\n configurations?.chromePath ||\n Deno.env.get('CHROME_PATH') ||\n chromePaths.chrome ||\n chromePaths.chromium;\n if (!chromePath) {\n throw new Error('Chrome path not found');\n }\n console.log({ chromePath })\n const browser = await puppeteer.launch({\n executablePath: chromePath,\n args: ['--disable-blink-features=AutomationControlled'],\n });\n\n const page = await browser.newPage();\n \n console.log(\"Navigating to website...\");\n await page.goto(parameters.url);\n \n console.log('Waiting for the page to load...');\n await page.waitForNetworkIdle();\n \n console.log('Extracting HTML content...');\n const html = await page.content();\n\n console.log('Closing browser...');\n await browser.close();\n\n console.log('Saving HTML to file...');\n Deno.writeTextFileSync(await getHomePath() + '/download-page.html', html);\n\n console.log('Converting HTML to Markdown...');\n const turndownService = new TurndownService();\n const markdown = turndownService.turndown(html);\n return Promise.resolve({ markdown });\n};\n","tools":[],"config":[{"BasicConfig":{"key_name":"chromePath","description":"The path to the Chrome executable","required":false,"type":null,"key_value":null}}],"description":"Downloads a URL and converts its HTML content to Markdown","keywords":["HTML to Markdown","web page downloader","content conversion","URL to Markdown"],"input_args":{"type":"object","properties":{"url":{"type":"string","description":"A URL of a web page to download"}},"required":["url"]},"output_arg":{"json":""},"activated":false,"embedding":[-0.022859422,0.34394914,-0.26828787,-0.2738084,-0.63775945,-0.07745881,-1.0741392,0.1560609,0.37143725,0.019180652,0.20704071,0.27364534,-0.0067869863,0.52876467,0.6414323,-0.33678514,0.050067496,-0.93635535,-1.4170387,-0.11435936,-0.23238567,1.0892224,0.2120105,0.5584683,0.12247756,-0.064977966,0.14893794,-0.5124398,-0.96074337,-2.0346339,0.73753834,0.45415106,-0.08883569,-0.7438674,0.48413786,-0.58480775,0.05941936,-0.5025951,-0.18222712,-0.3229596,0.09404269,-0.6394208,-0.13328093,-0.35516846,0.26403305,0.2549522,0.011935851,-0.10359208,0.7161654,0.2805506,-0.3459439,-0.7086845,-0.3280931,-0.16880323,-0.38078505,-0.05401938,-0.40572488,0.0827634,0.102821976,0.112446666,-0.2216977,0.31631678,-4.125646,0.27062064,0.5810081,0.39316595,-0.09006638,-0.13725893,-0.23155731,0.06299147,0.22843449,-0.21436238,-0.16343841,-0.28368253,-0.07376786,-0.7834173,0.62592435,-0.18950966,-0.071794435,-0.8110028,0.026290458,0.8741538,0.0618044,0.5859047,-0.556113,0.3412014,0.046755597,-0.41176373,0.313688,-0.0122999,0.368527,-0.90580493,-0.079653844,0.5979872,-0.4543758,0.042234086,-0.10474573,0.24580964,0.1175344,3.1755562,0.80056226,-0.023514325,0.79566926,-0.7410976,-0.0014581755,-0.31112045,-0.039167665,0.100143805,0.5764502,0.1579162,0.65378535,-0.5400134,-0.020097598,0.018258024,0.35735926,-0.64368653,-0.84609747,-0.22342974,0.7505621,0.82978624,-0.4969715,0.5932594,-0.00894372,-0.20878446,0.1974807,0.16078371,-0.15507145,0.3443752,0.18211538,0.038514256,0.48453322,-0.36101848,-0.5905768,0.3267346,0.702126,0.23804805,0.14942536,-0.78500104,0.34118044,-0.7625391,0.2017467,-1.0103437,0.11651488,0.5579052,0.3436056,0.52296245,0.08520118,0.64077246,-0.4686281,-0.30036545,0.123490244,0.44900888,-0.48335668,-0.42536774,0.74946654,-0.068822786,-0.40755105,-0.24519834,-0.1692692,0.52134687,-0.45200285,-0.60263264,0.27810538,0.7042316,0.18795288,-0.3493522,0.046734825,0.22792357,0.6453644,0.451598,0.4749537,-0.23558003,-0.091785856,-0.3761208,0.19023523,-0.013168387,-0.27135915,-0.5617338,-0.0695993,-0.65293926,0.3943035,0.48974362,-0.5824184,-0.4601611,-0.002162248,0.28777352,0.3323654,0.29203975,0.8401477,0.75948477,-0.2863765,1.5633736,-1.0324217,-0.43823823,-0.39899313,-0.14089474,0.17630441,0.6572716,0.3455184,0.090465,0.023112308,-0.39716557,0.4068057,-0.13822418,-0.35577852,-0.021364532,0.4544103,0.026246114,0.18069449,-0.44668064,0.2769035,-0.73281,1.1664879,0.2932155,0.4086936,-0.35218203,-0.25461483,0.409438,0.24547005,0.5120449,0.1091405,0.28187823,-0.19503851,-0.47988772,-0.4020756,0.26754946,0.1451346,0.028484786,-0.5201925,-0.12774691,0.6918011,0.4549158,0.03442505,1.0406747,1.0184767,0.19375554,-0.2703382,0.8375021,0.20192006,-0.63289624,0.19444388,-0.16417834,-0.13579649,-0.2540757,-0.23970604,-1.1852467,-0.13074327,0.33187962,0.46423656,1.7475896,0.77317226,0.50678706,0.6598569,0.04874261,0.2757128,0.064221054,-2.202051,-0.26725778,-0.23615283,1.212763,-0.17240548,0.4422012,0.12729892,0.022317126,-0.2723784,-0.37636,-0.43468815,-1.0617322,-0.35068285,0.31613588,-0.35614374,0.45097005,0.30068332,-0.043214343,0.01916102,0.5010773,0.62649405,-0.31871548,-0.7229701,-0.6690801,0.32861578,-0.17093404,0.5118524,0.00037259609,-0.11062399,-0.35906035,0.13406049,0.44416454,-0.068312965,0.27592757,0.051042564,-0.49447364,-0.063102454,0.8905604,1.6143283,-0.1856372,-0.05961505,-0.35624927,-0.5815494,-0.21133251,-0.23919454,0.3232051,-0.13867204,-0.22855097,-0.93279076,-0.29881087,0.47200906,-0.49601215,-0.15198481,0.017862234,-0.32360247,-0.07765387,0.09425101,-0.24398094,0.6091076,-0.5912474,-0.2593696,0.047237284,-0.20522922,-1.7102749,-0.5065819,0.004834657,0.13834465,-0.19261189,-0.6813854,0.93593514,-0.1833483,-0.16403382,-0.21518946,1.5840325,0.62321234,-0.6040731,-0.65227884,0.421814,0.659497,-0.17027326,-0.077558756,-0.46503827,-0.67175186,0.034123674,0.9178276,1.7945781,0.045439854,0.014577113,0.19752969,0.25004318,-0.85095567,-1.5589556,-0.16364035,-0.26558465,-0.16827886,0.29318962,-0.6095997,-0.1322887,0.52664423,0.69676834,-0.31061935,-0.06737543,-0.7940618,2.265823,0.15195686,0.057539836,-0.032563098,-0.12275851,-0.060634516,0.18676114,0.72584385,-0.5401763,-0.56609005,-0.29295185,0.26685232,-0.19534579,0.35730702,0.4106815,0.62266856,0.33912587,0.23005708,0.6000891,0.2057446,0.54149806,0.43303984,0.21790418,-0.47692624,0.19675124],"result":{"type":"object","properties":{"markdown":{"description":"The Markdown content converted from the web page","type":"string"}},"required":["markdown"]},"sql_tables":null,"sql_queries":null,"file_inbox":null,"oauth":null,"assets":null,"runner":"any","operating_system":["linux","macos","windows"],"tool_set":""},false]} \ No newline at end of file diff --git a/tools/download-page/metadata.json b/tools/download-page/metadata.json index 01e3d7af..cb4ac0d8 100644 --- a/tools/download-page/metadata.json +++ b/tools/download-page/metadata.json @@ -10,7 +10,10 @@ "content conversion", "URL to Markdown" ], - "configurations": { + "runner": "any", + "operating_system": ["linux", "macos", "windows"], + "tool_set": "", + "configurations": { "type": "object", "properties": { "chromePath": { diff --git a/tools/duckduckgo-search/.tool-dump.test.json b/tools/duckduckgo-search/.tool-dump.test.json index 8290da03..3cbdc020 100644 --- a/tools/duckduckgo-search/.tool-dump.test.json +++ b/tools/duckduckgo-search/.tool-dump.test.json @@ -1 +1 @@ -{"type":"Deno","content":[{"name":"DuckDuckGo Search","homepage":null,"author":"@@official.shinkai","version":"1.0.0","js_code":"/// \n/// \nimport { URL } from 'npm:whatwg-url@14.0.0';\nimport axios from 'npm:axios@1.7.7';\nimport process from 'node:process';\nimport puppeteer from \"https://deno.land/x/puppeteer@16.2.0/mod.ts\";\nimport chromePaths from \"npm:chrome-paths@1.0.1\"\n\ntype Configurations = {\n chromePath?: string;\n};\ntype Parameters = {\n message: string;\n};\ntype Result = { message: string, puppeteer: boolean };\n\ninterface SearchResult {\n title: string;\n description: string;\n url: string;\n}\n\n// Custom function to build query string\nfunction buildQueryString(params: Record): string {\n return Object.keys(params)\n .map(\n (key) => `${encodeURIComponent(key)}=${encodeURIComponent(params[key])}`,\n )\n .join('&');\n}\n\nconst getVQD = async (keywords: string): Promise => {\n const body = buildQueryString({ q: keywords });\n await process.nextTick(() => {});\n const response = await axios.post('https://duckduckgo.com', body, {\n headers: {\n 'Content-Type': 'application/x-www-form-urlencoded',\n },\n });\n const text = response.data;\n // console.log('DuckDuckGo response HTML:', text);\n\n // Extract vqd token using a regular expression\n const vqdMatch = text.match(/vqd=\\\\?\"([^\\\\\"]+)\\\\?\"/);\n // console.log('vqdMatch: ', vqdMatch);\n if (!vqdMatch || vqdMatch.length < 2) {\n throw new Error('Failed to retrieve vqd token');\n }\n const vqd = vqdMatch[1];\n // console.log('vqd: ', vqd);\n return vqd;\n};\n\nconst parseDuckDuckGoResponse = (response: string): SearchResult[] => {\n // Regex to extract the JSON content\n const jsonPattern = /DDG\\.pageLayout\\.load\\('d',(\\[\\{\\\"a\\\".*?\\}\\])\\);/;\n const match = response.match(jsonPattern);\n\n if (!match) {\n throw new Error('JSON content not found in the response.');\n }\n\n // Extracted JSON content as string\n const jsonString = match[1];\n\n // Parse JSON string\n const jsonData = JSON.parse(jsonString);\n\n // Extract search results\n const results: SearchResult[] = jsonData\n .map((item: any) => ({\n title: item.t,\n description: item.a,\n url: item.u,\n }))\n .filter(\n (result: SearchResult) =>\n result.title && result.description && result.url,\n );\n\n // console.log('results: ', results);\n // Convert to JSON string\n return results;\n};\n\nconst textSearch = async (keywords: string): Promise => {\n console.log('textSearch: ', keywords);\n const vqd = await getVQD(keywords);\n console.log('vqd: ', vqd);\n const url = new URL('https://links.duckduckgo.com/d.js');\n console.log('before url.searchParams.append');\n url.searchParams.append('q', keywords);\n url.searchParams.append('vqd', vqd);\n url.searchParams.append('kl', 'wt-wt');\n url.searchParams.append('l', 'wt-wt');\n url.searchParams.append('p', '');\n url.searchParams.append('s', '0');\n url.searchParams.append('df', '');\n url.searchParams.append('ex', '-1');\n\n console.log('before urlString');\n const urlString = url.toString();\n console.log('urlString: ', urlString);\n\n await process.nextTick(() => {});\n const response = await axios.get(url.toString(), {\n headers: {\n 'Content-Type': 'application/json',\n },\n });\n console.log('response: ', response);\n const text = response.data;\n console.log('DuckDuckGo search response:', text);\n\n // Parse the response using the custom parser\n const results = parseDuckDuckGoResponse(text);\n if (results.length === 0) {\n throw new Error('Failed to extract search results');\n }\n\n return results;\n};\n\n\nasync function searchDuckDuckGoWithPuppeteer(\n searchQuery: string,\n chromePath: string,\n numResults = 10\n): Promise {\n // Add random delay between requests\n const randomDelay = (min: number, max: number) =>\n new Promise((resolve) => setTimeout(resolve, Math.random() * (max - min) + min));\n\n const browser = await puppeteer.launch({\n executablePath: chromePath,\n headless: true,\n defaultViewport: {\n width: 1920,\n height: 1080\n }\n });\n\n try {\n const page = await browser.newPage();\n // Set a realistic user agent\n await page.setUserAgent('Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36');\n // Add random delay before loading page\n await randomDelay(1000, 3000);\n \n await page.goto('https://duckduckgo.com/', {\n waitUntil: 'networkidle0',\n timeout: 30000\n });\n\n // Type search query with random delays between keystrokes\n for (const char of searchQuery) {\n await page.type('#searchbox_input', char, { delay: Math.random() * 100 + 50 });\n }\n\n await Promise.all([\n page.keyboard.press('Enter'),\n page.waitForNavigation({ waitUntil: 'networkidle0' })\n ]);\n\n // Wait for results to load\n await page.waitForSelector('.react-results--main');\n const pageContent = await page.$('.react-results--main');\n let results: SearchResult[] = []\n if (pageContent) {\n // Process each `li` element inside the container\n results = await page.evaluate((container) => {\n // Query all `li` elements within the container\n const listItems = container.querySelectorAll('li[data-layout=\"organic\"]');\n // Map each `li` to extract title, snippet, and URL\n return Array.from(listItems).map((item) => {\n // Extract the title\n const title = (item as HTMLElement).querySelector('article')?.children[2]?.querySelector('a')?.textContent?.trim() || 'No title';\n // Extract the snippet (if there's more descriptive text inside the article)\n const description = (item as HTMLElement).querySelector('article')?.children[3]?.textContent?.trim() || 'No snippet';\n // Extract the URL (inside the tag in the third child of
)\n const url = (item as HTMLElement).querySelector('article')?.children[2]?.querySelector('a')?.href || 'No URL';\n return { title, description, url };\n });\n }, pageContent);\n \n // Log the extracted results\n results.forEach((result, index) => {\n console.log(`Result ${index + 1}:`);\n console.log(` Title: ${result.title}`);\n console.log(` Description: ${result.description}`);\n console.log(` URL: ${result.url}`);\n });\n }\n // Extract search results\n await browser.close();\n return results;\n } catch (error) {\n console.error('Error during scraping:', error);\n await browser.close();\n throw error;\n }\n}\n\n\nexport type Run, I extends Record, R extends Record> = (config: C, inputs: I) => Promise;\nexport const run: Run = async (\n configurations: Configurations,\n params: Parameters,\n): Promise => {\n let puppeteer = false\n console.log('run duckduckgo search from js', 4);\n console.log('second message', 4);\n console.log('params: ', params);\n try {\n let results;\n try {\n results = await textSearch(params.message);\n } catch (textSearchError) {\n console.error('Text search failed', textSearchError);\n console.log('Text search failed, falling back to puppeteer search');\n puppeteer = true\n const chromePath = configurations?.chromePath || \n Deno.env.get('CHROME_PATH') ||\n chromePaths.chrome || \n chromePaths.chromium;\n results = await searchDuckDuckGoWithPuppeteer(params.message, chromePath, 10);\n }\n console.log('results: ', results);\n return { message: JSON.stringify(results), puppeteer };\n } catch (error) {\n let errorMessage = 'An unknown error occurred';\n if (error instanceof Error) {\n errorMessage = error.message;\n }\n return { message: `Error: ${errorMessage}`, puppeteer };\n }\n};","tools":[],"config":[{"BasicConfig":{"key_name":"chromePath","description":"The path to the Chrome executable. If not provided, the tool will use the CHROME_PATH environment variable or the default paths for Chrome and Chromium.","required":false,"type":null,"key_value":null}}],"description":"Searches the DuckDuckGo search engine. Example result: [{\"title\": \"IMDb Top 250 Movies\", \"description\": \"Find out which movies are rated as the best of all time by IMDb users. See the list of 250 titles sorted by ranking, genre, year, and rating, and learn how the list is determined.\", \"url\": \"https://www.imdb.com/chart/top/\"}]","keywords":["duckduckgo","search","shinkai"],"input_args":{"type":"object","properties":{"message":{"type":"string","description":"The search query to send to DuckDuckGo"}},"required":["message"]},"output_arg":{"json":""},"activated":false,"embedding":[0.16100998,-0.2972865,0.28343144,-0.28365922,0.18388914,-0.10808957,-0.8465683,-0.3023304,-0.06627547,0.29369032,0.3792466,-0.026051588,0.9681844,0.26845336,0.087322995,0.3903487,0.19291508,-0.01427158,-1.4823675,0.34444538,-0.22677879,0.6350529,0.5179565,0.16200225,0.14319092,-0.4128651,-0.5530627,-0.2230467,-1.4606562,-1.9088771,0.08900065,0.7296856,-0.3763809,-0.3156501,-0.09912226,-0.37506193,-0.07656356,-0.29206514,-0.81782377,-0.36994267,-0.9311228,0.4442602,0.32343307,-0.23644,-0.7575461,-0.2733088,0.8816913,-0.74153614,0.92402446,0.5694767,-0.66190016,-0.32893935,-0.44491023,-0.3451094,-0.5399374,1.2048315,-0.2909421,0.09793821,-0.15910481,-0.020140955,0.52650577,0.37241346,-3.2526927,0.31358433,1.1328849,0.6933904,0.68959427,0.091064654,0.1752654,-0.17398101,-0.18825978,-0.95673066,0.08014356,0.5557213,-0.7291533,-0.4783758,-0.12110171,0.17002639,0.38462222,-0.4842066,-0.19895557,-0.40634358,-0.2235034,0.11947982,-0.019322712,0.09932092,-0.3561139,-0.50609237,0.23464955,0.2506013,-0.61640763,-0.342651,-0.15674643,-0.22247696,-0.4245773,0.2267943,-0.3672269,0.2471618,0.3100941,3.5156467,0.34841216,0.1691641,0.4347128,-0.6274498,0.32555953,-0.20060848,-0.10614532,0.0679254,-0.13983274,0.50158745,-0.41802564,-0.24861914,0.36218542,0.14241442,-0.09090933,0.2561499,-0.26644385,0.2048601,0.12794764,0.15674706,-0.6449895,0.20134896,0.22811231,-0.15089744,-0.25931486,-0.1079388,-0.06875345,0.7953877,0.8425982,-0.11068615,0.35999143,-0.06753436,-1.3181609,0.6654049,0.0924684,0.24928874,-0.21873577,-0.66857755,0.46082357,-0.9986448,-0.7352612,-2.201773,1.1708877,0.47718638,0.76848406,-0.19161728,0.5031302,0.1496108,-0.6871553,0.17788763,0.41312823,-0.27841973,-0.44984117,0.18768121,0.62232244,-0.27507222,-0.28421694,0.6173232,-0.3947987,0.33405873,-1.0166829,0.3498147,0.5643429,0.6584611,-0.26877767,-0.29665112,-0.06166935,-0.16454384,0.48936158,-0.16242494,0.03428185,-0.24469805,0.523948,0.15534118,-0.4980276,0.28629124,0.13548969,0.18829426,-0.34546155,-1.1742584,0.26293284,0.6188773,0.12168458,-0.9323635,-0.26437372,-0.5892253,0.87057513,-0.6930339,0.50639945,0.80643785,0.0721452,0.8741952,-0.3274488,-0.42315227,-0.028165666,-0.592457,0.5175379,-0.059659854,0.12053746,-0.34061345,-0.6350129,0.16020003,0.15547402,-0.25673482,-0.7515326,-0.18881358,0.67522943,-0.6291586,0.5432324,-0.42265645,-0.3676717,-0.22558251,0.48577705,0.57183105,0.5349101,-0.3302961,0.6377336,-0.06351334,0.07104214,0.20489165,-1.014705,-0.3050776,-0.17635067,-0.8968951,0.29497743,-0.09858127,-0.45740026,-0.4069575,-0.5764778,-0.1508638,0.36897415,0.76126826,0.6924632,0.70853436,0.9247515,-0.17850634,-0.7721554,0.39465597,0.5619705,-0.8520909,0.74479973,-0.35380796,-0.039454237,0.013987482,1.0746634,-0.9367546,-0.02619151,0.23540804,-0.39120156,1.4433355,1.1657283,0.03284259,0.49836537,0.039773144,0.37719935,0.46682304,-1.6488383,0.21773447,-0.028232016,-0.22527152,-0.274859,-0.3425998,0.08941034,0.16945142,0.32578465,0.12483849,-0.41204578,-0.15444897,-0.691932,-0.15048423,0.54621094,0.991256,0.064518765,-0.025952421,0.3010644,1.0258135,-0.5665125,0.36733598,-0.45978212,-0.1464995,-0.41809174,0.44612837,0.26964265,0.8931821,-0.64659214,-0.009961138,-0.035986423,0.7815215,0.043738656,0.8328073,-0.25942641,-0.19111067,-0.18388048,0.20066437,1.144121,0.2505986,0.10948497,0.53195864,0.21859469,0.45678484,-0.4809166,-0.68843496,0.4476377,-0.006927535,-0.06847776,-0.40996197,0.61482847,-0.47733283,-0.11494335,-0.2483201,-1.1314368,-0.32275876,0.66809225,-0.5196115,1.6186441,-0.63046914,0.7337374,-0.070139706,0.46422538,-1.3247093,-0.13143204,0.19517592,-0.16072859,0.0046488047,0.2975949,0.2100708,0.20840794,-0.13572873,-0.54246527,1.3882924,0.36270496,0.23885682,-0.5642762,0.28673038,0.38420507,0.0007627439,0.9563615,-0.12331989,-0.60005033,0.6672105,0.6659407,1.0922046,0.9381502,0.25429425,0.18985675,0.3571467,-1.126372,-1.1870406,0.2297789,0.03585553,0.14784983,0.5716978,-0.16998038,-0.116081126,0.9463949,0.37174714,-0.89691967,0.09882557,-0.5518772,0.6476752,-0.13004614,0.49607557,-0.2541792,-0.17316863,1.0959044,0.48697007,0.60795015,-0.23220503,0.13188173,-0.76364,-0.30256245,-0.21257344,0.05254751,0.051760208,0.09228458,0.35372865,-0.12407258,0.81559,-0.052715406,-0.14442651,-0.08288829,-0.38582665,-0.44459823,-0.31732184],"result":{"type":"object","properties":{"message":{"description":"The search results from DuckDuckGo in JSON format, containing title, description, and URL for each result","type":"string"},"puppeteer":{"description":"Whether the search was performed using Puppeteer","type":"boolean"}},"required":["message"]},"sql_tables":null,"sql_queries":null,"file_inbox":null,"oauth":null,"assets":null},false]} \ No newline at end of file +{"type":"Deno","content":[{"name":"DuckDuckGo Search","homepage":null,"author":"@@official.shinkai","version":"1.0.0","js_code":"/// \n/// \nimport { URL } from 'npm:whatwg-url@14.0.0';\nimport axios from 'npm:axios@1.7.7';\nimport process from 'node:process';\nimport puppeteer from \"https://deno.land/x/puppeteer@16.2.0/mod.ts\";\nimport chromePaths from \"npm:chrome-paths@1.0.1\"\n\ntype Configurations = {\n chromePath?: string;\n};\ntype Parameters = {\n message: string;\n};\ntype Result = { message: string, puppeteer: boolean };\n\ninterface SearchResult {\n title: string;\n description: string;\n url: string;\n}\n\n// Custom function to build query string\nfunction buildQueryString(params: Record): string {\n return Object.keys(params)\n .map(\n (key) => `${encodeURIComponent(key)}=${encodeURIComponent(params[key])}`,\n )\n .join('&');\n}\n\nconst getVQD = async (keywords: string): Promise => {\n const body = buildQueryString({ q: keywords });\n await process.nextTick(() => {});\n const response = await axios.post('https://duckduckgo.com', body, {\n headers: {\n 'Content-Type': 'application/x-www-form-urlencoded',\n },\n });\n const text = response.data;\n // console.log('DuckDuckGo response HTML:', text);\n\n // Extract vqd token using a regular expression\n const vqdMatch = text.match(/vqd=\\\\?\"([^\\\\\"]+)\\\\?\"/);\n // console.log('vqdMatch: ', vqdMatch);\n if (!vqdMatch || vqdMatch.length < 2) {\n throw new Error('Failed to retrieve vqd token');\n }\n const vqd = vqdMatch[1];\n // console.log('vqd: ', vqd);\n return vqd;\n};\n\nconst parseDuckDuckGoResponse = (response: string): SearchResult[] => {\n // Regex to extract the JSON content\n const jsonPattern = /DDG\\.pageLayout\\.load\\('d',(\\[\\{\\\"a\\\".*?\\}\\])\\);/;\n const match = response.match(jsonPattern);\n\n if (!match) {\n throw new Error('JSON content not found in the response.');\n }\n\n // Extracted JSON content as string\n const jsonString = match[1];\n\n // Parse JSON string\n const jsonData = JSON.parse(jsonString);\n\n // Extract search results\n const results: SearchResult[] = jsonData\n .map((item: any) => ({\n title: item.t,\n description: item.a,\n url: item.u,\n }))\n .filter(\n (result: SearchResult) =>\n result.title && result.description && result.url,\n );\n\n // console.log('results: ', results);\n // Convert to JSON string\n return results;\n};\n\nconst textSearch = async (keywords: string): Promise => {\n console.log('textSearch: ', keywords);\n const vqd = await getVQD(keywords);\n console.log('vqd: ', vqd);\n const url = new URL('https://links.duckduckgo.com/d.js');\n console.log('before url.searchParams.append');\n url.searchParams.append('q', keywords);\n url.searchParams.append('vqd', vqd);\n url.searchParams.append('kl', 'wt-wt');\n url.searchParams.append('l', 'wt-wt');\n url.searchParams.append('p', '');\n url.searchParams.append('s', '0');\n url.searchParams.append('df', '');\n url.searchParams.append('ex', '-1');\n\n console.log('before urlString');\n const urlString = url.toString();\n console.log('urlString: ', urlString);\n\n await process.nextTick(() => {});\n const response = await axios.get(url.toString(), {\n headers: {\n 'Content-Type': 'application/json',\n },\n });\n console.log('response: ', response);\n const text = response.data;\n console.log('DuckDuckGo search response:', text);\n\n // Parse the response using the custom parser\n const results = parseDuckDuckGoResponse(text);\n if (results.length === 0) {\n throw new Error('Failed to extract search results');\n }\n\n return results;\n};\n\n\nasync function searchDuckDuckGoWithPuppeteer(\n searchQuery: string,\n chromePath: string,\n numResults = 10\n): Promise {\n // Add random delay between requests\n const randomDelay = (min: number, max: number) =>\n new Promise((resolve) => setTimeout(resolve, Math.random() * (max - min) + min));\n\n const browser = await puppeteer.launch({\n executablePath: chromePath,\n headless: true,\n defaultViewport: {\n width: 1920,\n height: 1080\n }\n });\n\n try {\n const page = await browser.newPage();\n // Set a realistic user agent\n await page.setUserAgent('Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36');\n // Add random delay before loading page\n await randomDelay(1000, 3000);\n \n await page.goto('https://duckduckgo.com/', {\n waitUntil: 'networkidle0',\n timeout: 30000\n });\n\n // Type search query with random delays between keystrokes\n for (const char of searchQuery) {\n await page.type('#searchbox_input', char, { delay: Math.random() * 100 + 50 });\n }\n\n await Promise.all([\n page.keyboard.press('Enter'),\n page.waitForNavigation({ waitUntil: 'networkidle0' })\n ]);\n\n // Wait for results to load\n await page.waitForSelector('.react-results--main');\n const pageContent = await page.$('.react-results--main');\n let results: SearchResult[] = []\n if (pageContent) {\n // Process each `li` element inside the container\n results = await page.evaluate((container) => {\n // Query all `li` elements within the container\n const listItems = container.querySelectorAll('li[data-layout=\"organic\"]');\n // Map each `li` to extract title, snippet, and URL\n return Array.from(listItems).map((item) => {\n // Extract the title\n const title = (item as HTMLElement).querySelector('article')?.children[2]?.querySelector('a')?.textContent?.trim() || 'No title';\n // Extract the snippet (if there's more descriptive text inside the article)\n const description = (item as HTMLElement).querySelector('article')?.children[3]?.textContent?.trim() || 'No snippet';\n // Extract the URL (inside the tag in the third child of
)\n const url = (item as HTMLElement).querySelector('article')?.children[2]?.querySelector('a')?.href || 'No URL';\n return { title, description, url };\n });\n }, pageContent);\n \n // Log the extracted results\n results.forEach((result, index) => {\n console.log(`Result ${index + 1}:`);\n console.log(` Title: ${result.title}`);\n console.log(` Description: ${result.description}`);\n console.log(` URL: ${result.url}`);\n });\n }\n // Extract search results\n await browser.close();\n return results;\n } catch (error) {\n console.error('Error during scraping:', error);\n await browser.close();\n throw error;\n }\n}\n\n\nexport type Run, I extends Record, R extends Record> = (config: C, inputs: I) => Promise;\nexport const run: Run = async (\n configurations: Configurations,\n params: Parameters,\n): Promise => {\n let puppeteer = false\n console.log('run duckduckgo search from js', 4);\n console.log('second message', 4);\n console.log('params: ', params);\n try {\n let results;\n try {\n results = await textSearch(params.message);\n } catch (textSearchError) {\n console.error('Text search failed', textSearchError);\n console.log('Text search failed, falling back to puppeteer search');\n puppeteer = true\n const chromePath = configurations?.chromePath || \n Deno.env.get('CHROME_PATH') ||\n chromePaths.chrome || \n chromePaths.chromium;\n results = await searchDuckDuckGoWithPuppeteer(params.message, chromePath, 10);\n }\n console.log('results: ', results);\n return { message: JSON.stringify(results), puppeteer };\n } catch (error) {\n let errorMessage = 'An unknown error occurred';\n if (error instanceof Error) {\n errorMessage = error.message;\n }\n return { message: `Error: ${errorMessage}`, puppeteer };\n }\n};","tools":[],"config":[{"BasicConfig":{"key_name":"chromePath","description":"The path to the Chrome executable. If not provided, the tool will use the CHROME_PATH environment variable or the default paths for Chrome and Chromium.","required":false,"type":null,"key_value":null}}],"description":"Searches the DuckDuckGo search engine. Example result: [{\"title\": \"IMDb Top 250 Movies\", \"description\": \"Find out which movies are rated as the best of all time by IMDb users. See the list of 250 titles sorted by ranking, genre, year, and rating, and learn how the list is determined.\", \"url\": \"https://www.imdb.com/chart/top/\"}]","keywords":["duckduckgo","search","shinkai"],"input_args":{"type":"object","properties":{"message":{"type":"string","description":"The search query to send to DuckDuckGo"}},"required":["message"]},"output_arg":{"json":""},"activated":false,"embedding":[0.16100998,-0.2972865,0.28343144,-0.28365922,0.18388914,-0.10808957,-0.8465683,-0.3023304,-0.06627547,0.29369032,0.3792466,-0.026051588,0.9681844,0.26845336,0.087322995,0.3903487,0.19291508,-0.01427158,-1.4823675,0.34444538,-0.22677879,0.6350529,0.5179565,0.16200225,0.14319092,-0.4128651,-0.5530627,-0.2230467,-1.4606562,-1.9088771,0.08900065,0.7296856,-0.3763809,-0.3156501,-0.09912226,-0.37506193,-0.07656356,-0.29206514,-0.81782377,-0.36994267,-0.9311228,0.4442602,0.32343307,-0.23644,-0.7575461,-0.2733088,0.8816913,-0.74153614,0.92402446,0.5694767,-0.66190016,-0.32893935,-0.44491023,-0.3451094,-0.5399374,1.2048315,-0.2909421,0.09793821,-0.15910481,-0.020140955,0.52650577,0.37241346,-3.2526927,0.31358433,1.1328849,0.6933904,0.68959427,0.091064654,0.1752654,-0.17398101,-0.18825978,-0.95673066,0.08014356,0.5557213,-0.7291533,-0.4783758,-0.12110171,0.17002639,0.38462222,-0.4842066,-0.19895557,-0.40634358,-0.2235034,0.11947982,-0.019322712,0.09932092,-0.3561139,-0.50609237,0.23464955,0.2506013,-0.61640763,-0.342651,-0.15674643,-0.22247696,-0.4245773,0.2267943,-0.3672269,0.2471618,0.3100941,3.5156467,0.34841216,0.1691641,0.4347128,-0.6274498,0.32555953,-0.20060848,-0.10614532,0.0679254,-0.13983274,0.50158745,-0.41802564,-0.24861914,0.36218542,0.14241442,-0.09090933,0.2561499,-0.26644385,0.2048601,0.12794764,0.15674706,-0.6449895,0.20134896,0.22811231,-0.15089744,-0.25931486,-0.1079388,-0.06875345,0.7953877,0.8425982,-0.11068615,0.35999143,-0.06753436,-1.3181609,0.6654049,0.0924684,0.24928874,-0.21873577,-0.66857755,0.46082357,-0.9986448,-0.7352612,-2.201773,1.1708877,0.47718638,0.76848406,-0.19161728,0.5031302,0.1496108,-0.6871553,0.17788763,0.41312823,-0.27841973,-0.44984117,0.18768121,0.62232244,-0.27507222,-0.28421694,0.6173232,-0.3947987,0.33405873,-1.0166829,0.3498147,0.5643429,0.6584611,-0.26877767,-0.29665112,-0.06166935,-0.16454384,0.48936158,-0.16242494,0.03428185,-0.24469805,0.523948,0.15534118,-0.4980276,0.28629124,0.13548969,0.18829426,-0.34546155,-1.1742584,0.26293284,0.6188773,0.12168458,-0.9323635,-0.26437372,-0.5892253,0.87057513,-0.6930339,0.50639945,0.80643785,0.0721452,0.8741952,-0.3274488,-0.42315227,-0.028165666,-0.592457,0.5175379,-0.059659854,0.12053746,-0.34061345,-0.6350129,0.16020003,0.15547402,-0.25673482,-0.7515326,-0.18881358,0.67522943,-0.6291586,0.5432324,-0.42265645,-0.3676717,-0.22558251,0.48577705,0.57183105,0.5349101,-0.3302961,0.6377336,-0.06351334,0.07104214,0.20489165,-1.014705,-0.3050776,-0.17635067,-0.8968951,0.29497743,-0.09858127,-0.45740026,-0.4069575,-0.5764778,-0.1508638,0.36897415,0.76126826,0.6924632,0.70853436,0.9247515,-0.17850634,-0.7721554,0.39465597,0.5619705,-0.8520909,0.74479973,-0.35380796,-0.039454237,0.013987482,1.0746634,-0.9367546,-0.02619151,0.23540804,-0.39120156,1.4433355,1.1657283,0.03284259,0.49836537,0.039773144,0.37719935,0.46682304,-1.6488383,0.21773447,-0.028232016,-0.22527152,-0.274859,-0.3425998,0.08941034,0.16945142,0.32578465,0.12483849,-0.41204578,-0.15444897,-0.691932,-0.15048423,0.54621094,0.991256,0.064518765,-0.025952421,0.3010644,1.0258135,-0.5665125,0.36733598,-0.45978212,-0.1464995,-0.41809174,0.44612837,0.26964265,0.8931821,-0.64659214,-0.009961138,-0.035986423,0.7815215,0.043738656,0.8328073,-0.25942641,-0.19111067,-0.18388048,0.20066437,1.144121,0.2505986,0.10948497,0.53195864,0.21859469,0.45678484,-0.4809166,-0.68843496,0.4476377,-0.006927535,-0.06847776,-0.40996197,0.61482847,-0.47733283,-0.11494335,-0.2483201,-1.1314368,-0.32275876,0.66809225,-0.5196115,1.6186441,-0.63046914,0.7337374,-0.070139706,0.46422538,-1.3247093,-0.13143204,0.19517592,-0.16072859,0.0046488047,0.2975949,0.2100708,0.20840794,-0.13572873,-0.54246527,1.3882924,0.36270496,0.23885682,-0.5642762,0.28673038,0.38420507,0.0007627439,0.9563615,-0.12331989,-0.60005033,0.6672105,0.6659407,1.0922046,0.9381502,0.25429425,0.18985675,0.3571467,-1.126372,-1.1870406,0.2297789,0.03585553,0.14784983,0.5716978,-0.16998038,-0.116081126,0.9463949,0.37174714,-0.89691967,0.09882557,-0.5518772,0.6476752,-0.13004614,0.49607557,-0.2541792,-0.17316863,1.0959044,0.48697007,0.60795015,-0.23220503,0.13188173,-0.76364,-0.30256245,-0.21257344,0.05254751,0.051760208,0.09228458,0.35372865,-0.12407258,0.81559,-0.052715406,-0.14442651,-0.08288829,-0.38582665,-0.44459823,-0.31732184],"result":{"type":"object","properties":{"message":{"description":"The search results from DuckDuckGo in JSON format, containing title, description, and URL for each result","type":"string"},"puppeteer":{"description":"Whether the search was performed using Puppeteer","type":"boolean"}},"required":["message"]},"sql_tables":null,"sql_queries":null,"file_inbox":null,"oauth":null,"assets":null,"runner":"any","operating_system":["linux","macos","windows"],"tool_set":""},false]} \ No newline at end of file diff --git a/tools/duckduckgo-search/metadata.json b/tools/duckduckgo-search/metadata.json index 51727901..74e8c2b8 100644 --- a/tools/duckduckgo-search/metadata.json +++ b/tools/duckduckgo-search/metadata.json @@ -9,7 +9,10 @@ "search", "shinkai" ], - "configurations": { + "runner": "any", + "operating_system": ["linux", "macos", "windows"], + "tool_set": "", + "configurations": { "type": "object", "properties": { "chromePath": { diff --git a/tools/elevenlabs-isolate-voice/.tool-dump.test.json b/tools/elevenlabs-isolate-voice/.tool-dump.test.json new file mode 100644 index 00000000..3d2faf9f --- /dev/null +++ b/tools/elevenlabs-isolate-voice/.tool-dump.test.json @@ -0,0 +1 @@ +{"type":"Deno","content":[{"name":"ElevenLabs Isolate Voice","homepage":null,"author":"@@official.shinkai","version":"1.0.0","js_code":"import { writeAll, readAll } from \"https://deno.land/std/io/mod.ts\";\nimport { getHomePath } from \"../shinkai-local-support.ts\";\nimport { youtubeDownloadMp3 } from \"../shinkai-local-tools.ts\";\n\ntype CONFIG = {\n ELEVENLABS_API_KEY: string;\n};\n\ntype INPUTS = {\n audio_file?: string;\n youtube_url?: string;\n fileName?: string;\n};\n\ntype OUTPUT = {\n audio_file: string;\n characters_used: number;\n characters_remaining: number;\n};\n\nasync function getUsage(config: CONFIG): Promise {\n const usageURL = \"https://api.elevenlabs.io/v1/user/subscription\";\n const usageResponse = await fetch(usageURL, {\n headers: {\n \"xi-api-key\": config.ELEVENLABS_API_KEY,\n },\n });\n if (!usageResponse.ok) {\n throw new Error(\n `Failed to fetch usage: ${usageResponse.status} ${usageResponse.statusText}`,\n );\n }\n return await usageResponse.json();\n}\n\nasync function isolateVoiceFromYoutube(\n youtubeUrl: string,\n config: CONFIG,\n): Promise {\n try {\n // Create a temporary file name with .mp3 suffix\n const originalAudioFile = await youtubeDownloadMp3({youtubeUrl, outputFileName: 'original_audio.mp3'});\n\n // Read the downloaded MP3 file into a Uint8Array\n const audioData = await Deno.readFile(originalAudioFile.audiofile);\n\n // Prepare the FormData for the ElevenLabs API call\n const formData = new FormData();\n const blob = new Blob([audioData], { type: \"audio/mpeg\" });\n formData.append(\"audio\", blob, originalAudioFile.audiofile);\n\n // Call the ElevenLabs API for voice isolation\n const response = await fetch(\n \"https://api.elevenlabs.io/v1/audio-isolation\",\n {\n method: \"POST\",\n headers: {\n \"Accept\": \"audio/mpeg\",\n \"xi-api-key\": config.ELEVENLABS_API_KEY,\n },\n body: formData,\n },\n );\n\n if (!response.ok) {\n throw new Error(\n `ElevenLabs API error: ${response.status} ${response.statusText}`,\n );\n }\n\n // Convert the response into a Uint8Array and return it\n const arrayBuffer = await response.arrayBuffer();\n return new Uint8Array(arrayBuffer);\n } catch (error: any) {\n console.error(\"Error processing audio:\", error);\n throw error;\n }\n}\n\nexport async function run(\n config: CONFIG,\n inputs: INPUTS,\n): Promise {\n const homePath = await getHomePath();\n if (!config.ELEVENLABS_API_KEY) {\n throw new Error(\"ELEVENLABS_API_KEY is not set\");\n }\n if (!inputs.audio_file && !inputs.youtube_url) {\n throw new Error(\"Either audio_file or youtube_url must be provided\");\n }\n\n let audioData: Uint8Array;\n if (inputs.youtube_url) {\n audioData = await isolateVoiceFromYoutube(inputs.youtube_url, config);\n } else if (inputs.audio_file) {\n const file = await Deno.open(inputs.audio_file, { read: true });\n const fileData = await readAll(file);\n file.close();\n\n const formData = new FormData();\n const blob = new Blob([fileData], { type: \"audio/mpeg\" });\n formData.append(\"audio\", blob, inputs.audio_file);\n\n const response = await fetch(\n \"https://api.elevenlabs.io/v1/audio-isolation\",\n {\n method: \"POST\",\n headers: {\n \"Accept\": \"audio/mpeg\",\n \"xi-api-key\": config.ELEVENLABS_API_KEY,\n },\n body: formData,\n },\n );\n\n if (!response.ok) {\n throw new Error(\n `ElevenLabs API error: ${response.status} ${response.statusText}`,\n );\n }\n\n const arrayBuffer = await response.arrayBuffer();\n audioData = new Uint8Array(arrayBuffer);\n } else {\n throw new Error(\"No audio file or YouTube URL provided\");\n }\n\n // Determine the output file name\n const fileName = `${homePath}/${inputs.fileName ?? crypto.randomUUID() + \".mp3\"}`;\n const outputFile = await Deno.open(fileName, { write: true, create: true });\n await writeAll(outputFile, audioData);\n outputFile.close();\n\n // Get usage information from ElevenLabs API (if available)\n let usage: any;\n try {\n usage = await getUsage(config);\n return {\n audio_file: fileName,\n characters_used: usage.character_count,\n characters_remaining: usage.character_limit - usage.character_count,\n };\n } catch (error) {\n console.error(\"Error getting usage:\", error);\n return {\n audio_file: fileName,\n characters_used: -1,\n characters_remaining: -1,\n };\n }\n}\n","tools":["local:::__official_shinkai:::youtube_download_mp3"],"config":[{"BasicConfig":{"key_name":"ELEVENLABS_API_KEY","description":"The API key for accessing ElevenLabs services","required":true,"type":null,"key_value":null}}],"description":"Isolates audio from YouTube videos or processes local audio files using ElevenLabs API.","keywords":["youtube","audio","isolation","elevenlabs"],"input_args":{"type":"object","properties":{"fileName":{"type":"string","description":"The desired name for the output audio file"},"audio_file":{"type":"string","description":"The path to the local audio file to process"},"youtube_url":{"type":"string","description":"The URL of the YouTube video to download audio from"}},"required":[]},"output_arg":{"json":""},"activated":false,"embedding":[-0.2562434,-0.0067567974,-0.29983857,-0.43505841,-1.0242133,0.06661889,-0.53605866,-0.3230707,-0.14034763,0.124455914,0.052975222,0.42764032,-0.2341847,-0.34350348,0.08837783,-0.24250692,0.2629064,-0.46512556,-1.0586774,-0.5189658,0.0360504,0.75315815,0.2639478,0.3483252,0.33064675,0.28296736,-0.26283348,-0.56828964,-0.5709201,-2.1565034,0.86364746,0.91455925,0.253825,-0.769115,0.06244101,-0.7555227,0.075020485,0.7805717,-0.61388445,-0.79457486,0.20354901,0.12311732,-0.015963227,0.06501671,0.011764269,-0.54542685,0.89890766,0.26081845,1.0975919,0.15101488,0.34160808,-0.51328975,0.28304532,-0.089787126,-0.28361636,-0.6945943,-0.19403249,0.41587326,0.25904357,0.012579124,0.11705798,0.33363557,-3.433911,-0.18079929,0.13218236,0.3958419,0.35912985,-0.27818745,-0.13142604,-0.008354716,0.1528919,0.16594392,-0.8212559,0.23975894,-0.033857033,-0.87535495,0.17705727,-0.30066517,-0.036871158,-0.4685064,0.8929107,0.8747796,0.09097415,-0.39193833,-0.008529494,0.57310295,-0.7561132,0.24395508,-0.1381476,0.08057586,-0.7341852,0.1895842,0.24419203,0.07581279,-0.02447167,-0.51664776,0.505628,0.6026726,0.9177392,2.99451,0.5723134,-0.42511868,0.3796583,-1.0299188,-0.27918684,-0.57087034,0.2559367,-0.21900383,0.31240287,0.19997346,0.15237947,-0.8051612,-0.052623525,0.092492096,0.23626061,0.059111036,-0.41213948,0.56390154,0.35151204,0.6612531,-0.4818554,-0.018495493,-1.0693878,-0.14994037,-0.316178,-0.22384313,-0.7908277,0.36997676,0.1411719,0.062209994,0.1513062,-0.36392203,-0.28494686,0.04693146,0.03011361,-0.31111112,1.0458133,-0.5757925,-0.2641718,-0.5791852,-0.070932806,-1.216664,0.40415734,-0.24961999,0.322638,-0.12185478,-0.43683997,-0.20193997,-0.3162501,0.30402836,0.29777092,0.5650633,0.33763763,-0.31056827,1.3965446,0.12763527,0.5695045,-0.5488208,-0.73600584,-0.4615078,-0.05712434,0.23161487,0.5406085,0.6567684,0.63165116,0.7529599,0.13330996,-0.43512335,0.58296174,0.586754,-0.0063729584,-0.33941224,0.43602762,0.37666327,-0.90217686,-0.5349878,-1.3972869,-0.1548368,0.332718,-0.31649745,0.43735003,1.1454926,-0.28169087,-0.3217937,-0.2223597,0.057537407,-0.42273116,-0.04956086,1.1125712,1.0933008,-0.72657543,1.8997244,-1.1898738,-0.11396211,0.02864094,-0.12719434,-0.1271083,0.43245113,0.33953062,-0.048859205,-0.23632085,-0.5627971,-0.07672405,0.26678902,-0.3909463,-0.78998214,-0.14633313,0.582212,-0.15525989,-0.6818097,0.1506487,-0.5138582,-0.51618594,0.44547868,-0.026621655,0.40156984,-0.048335843,-0.56703806,-0.55223674,0.35647357,0.3496779,0.053296626,-1.1107686,-0.82125205,-0.16673706,0.025514118,-0.5170641,0.043855093,-0.17746037,-0.1559967,1.0413464,1.3722949,1.2975528,0.96454567,0.82740885,0.1807707,-0.057162978,0.4623276,0.3660685,-0.4108282,-0.08274775,-0.028249227,-0.014558226,0.2997225,0.5432144,-0.505655,0.42025983,-0.6185377,-0.72795457,1.7827225,1.1444253,0.29938012,0.8866597,0.2931447,-0.18900198,0.021429203,-1.1141083,0.14585093,0.0141111165,0.5818597,-0.068531565,-0.037470344,0.2993112,0.4729751,-0.3891652,0.7041352,-1.3640909,-0.2193309,-0.024842635,0.32294756,0.94387656,0.5466608,-0.54884285,0.11207963,0.19601801,0.25403208,-0.018227382,0.17209071,-0.7012136,-0.1773847,0.5468966,-0.21868743,0.53736323,0.32288855,-0.66170996,-0.74946445,-0.5649267,-0.18943605,-0.9293664,0.49832916,-1.0983964,-0.27971724,-0.23344356,0.10173148,0.9015809,0.6872256,0.28636518,0.5290017,-0.21888305,-0.292022,-0.7264114,0.37914765,0.19470732,-0.3372535,-0.35668576,0.13538203,0.52853376,0.20948675,-0.15023243,0.8556654,0.043661423,0.61412317,-0.114927456,0.09052005,1.2126714,-0.03202577,-0.23409387,0.8179636,0.21225889,-1.7291996,-0.50263375,-0.14521173,0.23355831,0.07663575,0.2221796,0.030023485,-0.44273022,-0.046094585,-0.5648873,0.8355526,0.31839782,-0.39610186,-0.40438166,0.4650571,0.47500303,-0.0761198,0.054620393,-0.067826234,-0.805382,-0.5309844,0.06821992,1.2715502,-0.37675205,-0.14560364,-0.016057264,0.45546934,-0.19748561,-1.3171179,0.7306707,0.313861,-0.6479486,1.0978073,-0.53460735,-0.5241186,0.9341622,0.4389665,-0.16258799,-0.00045278575,-0.42927852,1.0506561,-0.097871825,0.24640997,0.1896205,0.8254027,0.26343217,0.17326376,-0.051190257,-1.0710484,0.30380082,0.09597372,-0.12842903,-0.69226545,0.07716146,0.5040664,0.5675272,0.046937633,0.058598217,0.79952216,-0.010697864,0.40475023,0.3758864,0.24120522,-0.3339652,-0.26543534],"result":{"type":"object","properties":{"audio_file":{"description":"The path to the output audio file","type":"string"},"characters_remaining":{"description":"The number of characters remaining in the ElevenLabs API limit","type":"number"},"characters_used":{"description":"The number of characters used in the ElevenLabs API","type":"number"}},"required":["audio_file"]},"sql_tables":[],"sql_queries":[],"file_inbox":null,"oauth":[],"assets":null,"runner":"any","operating_system":["linux","macos","windows"],"tool_set":""},false]} \ No newline at end of file diff --git a/tools/elevenlabs-isolate-voice/metadata.json b/tools/elevenlabs-isolate-voice/metadata.json index cd501c01..d56f7a31 100644 --- a/tools/elevenlabs-isolate-voice/metadata.json +++ b/tools/elevenlabs-isolate-voice/metadata.json @@ -10,7 +10,10 @@ "isolation", "elevenlabs" ], - "configurations": { + "runner": "any", + "operating_system": ["linux", "macos", "windows"], + "tool_set": "", + "configurations": { "type": "object", "properties": { "ELEVENLABS_API_KEY": { diff --git a/tools/elevenlabs-text-to-speech/.tool-dump.test.json b/tools/elevenlabs-text-to-speech/.tool-dump.test.json new file mode 100644 index 00000000..ff05c97d --- /dev/null +++ b/tools/elevenlabs-text-to-speech/.tool-dump.test.json @@ -0,0 +1 @@ +{"type":"Deno","content":[{"name":"Eleven Labs Text-to-Speech","homepage":null,"author":"@@official.shinkai","version":"1.0.0","js_code":"import { v4 as uuid } from \"npm:uuid\";\nimport { writeAll } from \"https://deno.land/std/io/write_all.ts\";\nimport { getHomePath } from './shinkai-local-support.ts';\n\ntype CONFIG = {\n ELEVENLABS_API_KEY: string;\n voice?: 'Aria' | 'Roger' | 'Sarah' | 'Laura' | 'Charlie' | 'George' | 'Callum' | 'River' | 'Liam' | 'Charlotte' | 'Alice' | 'Matilda' | 'Will' | 'Jessica' | 'Eric' | 'Chris' | 'Brian' | 'Daniel' | 'Lily' | 'Bill';\n};\n\ntype INPUTS = {\n text: string;\n fileName?: string;\n};\n\ntype OUTPUT = {\n audio_file: string,\n characters_used: number,\n characters_remaining: number\n};\n\nconst voiceDictionary = {\n Aria: '9BWtsMINqrJLrRacOk9x',\n Roger: 'CwhRBWXzGAHq8TQ4Fs17',\n Sarah: 'EXAVITQu4vr4xnSDxMaL',\n Laura: 'FGY2WhTYpPnrIDTdsKH5',\n Charlie: 'IKne3meq5aSn9XLyUdCD',\n George: 'JBFqnCBsd6RMkjVDRZzb',\n Callum: 'N2lVS1w4EtoT3dr4eOWO',\n River: 'SAz9YHcvj6GT2YYXdXww',\n Liam: 'TX3LPaxmHKxFdv7VOQHJ',\n Charlotte: 'XB0fDUnXU5powFXDhCwa',\n Alice: 'Xb7hH8MSUJpSbSDYk0k2',\n Matilda: 'XrExE9yKIg1WjnnlVkGX',\n Will: 'bIHbv24MWmeRgasZH58o',\n Jessica: 'cgSgspJ2msm6clMCkdW9',\n Eric: 'cjVigY5qzO86Huf0OWal',\n Chris: 'iP95p4xoKVk53GoZ742B',\n Brian: 'nPczCjzI2devNBz1zQrb',\n Daniel: 'onwK4e9ZLuTAKqWW03F9',\n Lily: 'pFZP5JQG7iQjIQuC4Bku',\n Bill: 'pqHfZKP75CvOlQylNhV4'\n}\n\nexport async function run(config: CONFIG, inputs: INPUTS): Promise {\n const homePath = await getHomePath();\n const voice = voiceDictionary[config.voice ?? 'Aria'];\n if (!voice) {\n throw new Error(`Invalid voice: ${config.voice}. Valid voices are: ${Object.keys(voiceDictionary).join(', ')}`);\n }\n if (inputs.fileName && !inputs.fileName.endsWith('.mp3')) {\n throw new Error(`Invalid file name: ${inputs.fileName}. File name must end with '.mp3'`);\n }\n const url = `https://api.elevenlabs.io/v1/text-to-speech/${voice}?output_format=mp3_44100_128`\n const response = await fetch(url, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n 'xi-api-key': `${config.ELEVENLABS_API_KEY}`\n },\n body: JSON.stringify({ text: inputs.text })\n });\n\n if (!response.ok) {\n throw new Error(`Failed to fetch audio: ${response.status} ${response.statusText}`);\n }\n console.log(`${response.status} ${response.statusText}`);\n\n const fileName = `${homePath}/${inputs.fileName ?? uuid()+'.mp3'}`\n const file = await Deno.open(fileName, { write: true, create: true });\n await writeAll(file, new Uint8Array(await response.arrayBuffer()));\n file.close();\n const usageURL = 'https://api.elevenlabs.io/v1/user/subscription'\n const usageResponse = await fetch(usageURL, {\n headers: {\n 'xi-api-key': `${config.ELEVENLABS_API_KEY}`\n }\n });\n if (!usageResponse.ok) {\n throw new Error(`Failed to fetch usage: ${usageResponse.status} ${usageResponse.statusText}`);\n }\n const usage = await usageResponse.json();\n return {\n audio_file: fileName,\n characters_used: usage.character_count,\n characters_remaining: usage.character_limit - usage.character_count\n };\n}\n","tools":[],"config":[{"BasicConfig":{"key_name":"ELEVENLABS_API_KEY","description":"API key for Eleven Labs","required":true,"type":null,"key_value":null}},{"BasicConfig":{"key_name":"voice","description":"The voice used for text-to-speech, options include: Aria, Roger, Sarah, Laura, Charlie, George, Callum, River, Liam, Charlotte, Alice, Matilda, Will, Jessica, Eric, Chris, Brian, Daniel, Lily, Bill","required":false,"type":null,"key_value":null}}],"description":"Converts text to speech using Eleven Labs API and saves the audio as an MP3 file.","keywords":["text-to-speech","audio","Eleven Labs","API"],"input_args":{"type":"object","properties":{"fileName":{"type":"string","description":"The name of the file to save the audio as"},"text":{"type":"string","description":"The text to be converted to speech"}},"required":["text"]},"output_arg":{"json":""},"activated":false,"embedding":[0.28364992,-0.09273045,-0.4642709,-0.38862208,-0.9691163,0.31189686,-0.05643536,0.12932289,-0.033744037,0.1274327,-0.16565539,1.0336089,-0.19664538,-0.3290498,0.039962746,-0.12903313,0.69734055,-0.9037202,-1.8847032,-0.19303465,0.27435058,0.724298,0.13998769,0.6363998,-0.23129344,0.10311682,-0.040152915,-0.27321756,-0.5560215,-1.8693941,0.5946894,0.7737699,0.57370156,0.256512,-0.17428395,-0.002149634,0.22515427,0.43411928,-1.2530309,-0.54719895,0.08673194,-0.60262364,-0.1839281,-0.670629,0.6552348,-0.0588687,0.3465009,0.39947292,1.3231331,0.25677446,-0.020167306,-0.48232502,-0.616592,-0.11563024,0.038443416,-0.5275824,0.35262161,0.62161624,0.13399282,0.3427985,-0.27536002,0.24116331,-3.7504232,-0.06264006,1.0781568,0.074624665,0.19192067,-0.29001644,-0.009530489,-0.1577355,0.8045135,0.08926085,-0.40041104,-0.056428827,0.3672132,-0.8166324,-0.30143327,0.014768109,0.6506624,-0.58650863,0.6962499,0.4120311,-0.09186113,-0.39387548,-0.236848,0.7286034,-0.8408403,-0.41310236,-0.14422533,-0.02137177,-0.286929,-0.8735792,0.58896726,0.3816223,0.13226765,-0.54263836,0.33598608,-0.27928647,0.59378123,3.0418997,0.45247823,-0.19711088,0.22976315,-0.91754305,-0.29530928,-0.66396546,-0.34393838,-0.35842374,0.56845236,0.44672948,0.47791654,-0.7042101,-0.45173928,-0.05946797,0.118059754,0.28933996,-0.710496,0.5529909,0.055124264,0.5638137,-0.54671574,-0.22688709,-0.5789524,-0.055061996,-0.13199371,0.05941179,-0.4600851,0.4230102,0.6307241,0.6305549,0.38406885,-0.07018916,-0.30384925,-0.03561516,0.43366885,-0.43151927,0.66814435,-1.0018013,0.050049633,0.17739439,0.37952858,-1.159018,0.6199469,0.15644342,0.355633,0.55665016,-0.651536,-0.1438522,-0.44904986,0.04146045,0.16654158,-0.401494,-0.22314715,-0.21738036,1.1131426,0.43244225,0.060288124,-0.49620378,-0.92809117,-0.076416194,0.22308417,0.5587608,0.06985171,0.43634814,0.26585653,0.83165854,-0.04165007,0.20254734,0.28239155,0.45152614,-0.25443682,-0.6071872,0.59131694,0.7221594,-0.32507545,-0.8343897,-0.62679183,0.35391414,0.22292344,-0.5109047,0.332789,0.7274126,-0.36196217,0.014332093,0.17677419,-0.011474907,-0.22456145,0.06193896,0.8246656,0.48807454,-0.5713258,1.9306173,-0.40447593,-0.062186807,-0.081351876,-0.26993853,0.20499091,0.8173818,0.1690414,-0.30412897,-0.7436062,-0.12011185,-0.020886037,-0.114078775,-0.38003215,-0.40220043,-0.49202707,0.46092594,0.1455983,-1.0382625,0.29978517,-0.39058962,0.361034,0.26496303,0.094286755,-0.16464819,-0.4521665,-0.20160875,-0.601515,0.1764795,0.02828788,-0.2629409,-0.46331596,-0.7569817,-0.5682474,0.50913036,0.016093597,-0.27577424,-0.54311883,-0.7673199,1.1535658,1.3770186,1.4975895,1.470638,0.9855993,-0.0070891604,0.44749177,0.31574577,0.037986353,-0.1801956,-0.07077816,0.35878125,0.1957501,0.11089648,0.6162026,-1.2037073,-0.14667279,-0.41605228,-0.5719807,1.4422998,0.5181302,0.097148255,0.5137087,0.06709236,0.8033491,-0.13220292,-1.2879108,-0.1272141,-0.2347849,0.83500814,0.10968598,0.6388218,0.55949366,0.72119254,0.42311296,-0.31847507,-0.57598,-0.6609746,-0.02578364,-0.054041434,0.49020538,-0.1146038,-0.1898408,-0.23145673,0.76028657,0.06723743,-0.096557885,-0.042746417,-0.36099768,-0.51009345,0.47937042,0.118621215,-0.3829508,0.35986328,-0.26548153,-0.6796403,-0.21316206,-0.38198486,-0.7019262,0.34081748,-0.33433002,-0.32724842,-0.8092511,0.14510727,1.1402179,0.56504416,-0.37824127,0.6151134,0.18532196,-0.6788821,-0.58548516,0.18828937,-0.15956011,-0.1413692,-0.114002876,0.09376336,-0.0050945655,-0.3520067,0.04108748,0.72977906,0.2824394,0.75439525,-0.05102714,0.10900448,0.94332725,-0.06094265,0.23469669,0.14076956,0.24903773,-1.7523863,-0.6333142,-0.49637878,0.4446054,-0.2814495,-0.30049664,0.6030213,-0.64997506,0.050875083,-0.28506792,1.1334562,0.408377,-0.8095175,-0.22168726,0.33890894,0.8352356,0.5577542,0.06977405,-0.2588715,-0.69717497,-0.15585066,0.5947561,1.1179693,0.032223016,0.04725738,0.0057259575,0.022094537,-0.49945068,-1.6212342,0.11704897,-0.06801928,-0.7570822,0.7807062,-0.54265594,0.05618396,0.57524085,0.8386632,-0.070284076,-0.5191093,-0.5997806,1.5139004,0.053236768,-0.33497524,0.031145632,0.44584733,-0.37654668,-0.3963502,0.37280405,-1.018112,-0.13694105,-0.099808566,0.2672819,-0.21169582,0.29967844,-0.10455321,0.6154593,0.34499407,-0.3519487,0.8303504,0.2838204,0.5466855,0.5284868,-0.17938082,0.070210226,0.03062889],"result":{"type":"object","properties":{"audio_file":{"description":"The file path to the generated audio file","type":"string"},"characters_remaining":{"description":"The number of characters remaining in the user's limit","type":"number"},"characters_used":{"description":"The number of characters used in the request","type":"number"}},"required":["audio_file","characters_used","characters_remaining"]},"sql_tables":[],"sql_queries":[],"file_inbox":null,"oauth":[],"assets":null,"runner":"any","operating_system":["linux","macos","windows"],"tool_set":""},false]} \ No newline at end of file diff --git a/tools/elevenlabs-text-to-speech/metadata.json b/tools/elevenlabs-text-to-speech/metadata.json index 1a8ab8f5..df77f85b 100644 --- a/tools/elevenlabs-text-to-speech/metadata.json +++ b/tools/elevenlabs-text-to-speech/metadata.json @@ -1,6 +1,9 @@ { "author": "Shinkai", - "configurations": { + "runner": "any", + "operating_system": ["linux", "macos", "windows"], + "tool_set": "", + "configurations": { "properties": { "ELEVENLABS_API_KEY": { "description": "API key for Eleven Labs", diff --git a/tools/email-imap-fetcher/.tool-dump.test.json b/tools/email-imap-fetcher/.tool-dump.test.json index 56df7549..d5437c65 100644 --- a/tools/email-imap-fetcher/.tool-dump.test.json +++ b/tools/email-imap-fetcher/.tool-dump.test.json @@ -1 +1 @@ -{"type":"Python","content":[{"version":"1.0.0","name":"Email Fetcher","homepage":null,"author":"@@official.shinkai","py_code":"from typing import Any, Optional, List, Dict\nimport imaplib\nimport email\nfrom datetime import datetime\n\nclass CONFIG:\n imap_server: str\n username: str\n password: str\n port: int = 143 # Default port for IMAPS\n ssl: bool = True # New flag to specify SSL usage\n\nclass INPUTS:\n from_date: Optional[str]\n to_date: Optional[str]\n\nclass OUTPUT:\n emails: List[Dict[str, Any]]\n login_status: str\n\nclass Email:\n subject: str\n date: datetime\n sender: str\n text: str\n\n# Function to validate date format\ndef validate_date_format(date_str):\n try:\n # Attempt to parse the date string in the expected format\n datetime.strptime(date_str, '%d-%b-%Y') # Expected format: DD-Mon-YYYY\n except ValueError:\n raise ValueError(f\"Invalid date format: {date_str}. Expected format is DD-Mon-YYYY. Example: 10-Jan-2025\")\n\n\nasync def run(config: CONFIG, inputs: INPUTS) -> OUTPUT:\n output = OUTPUT()\n output.login_status = \"N/A\"\n output.emails = []\n try:\n # Use SSL if the ssl flag is set to True\n if config.ssl:\n imap = imaplib.IMAP4_SSL(config.imap_server, config.port)\n else:\n imap = imaplib.IMAP4(config.imap_server, config.port) # Use config port\n except Exception as ee:\n output.login_status = 'IMAP4 INIT FAILED - ' + str(ee)\n return output\n\n try:\n login_status, login_response = imap.login(config.username, config.password)\n if login_status == \"OK\":\n print(\"Login successful\")\n else:\n raise Exception(\"Login failed\")\n\n imap.select(\"INBOX\")\n\n # Validate the input dates\n if inputs.from_date:\n validate_date_format(inputs.from_date)\n if inputs.to_date:\n validate_date_format(inputs.to_date)\n\n # Construct the search criteria\n search_criteria = 'ALL'\n if inputs.from_date and inputs.to_date:\n search_criteria = f'SINCE \"{inputs.from_date}\" BEFORE \"{inputs.to_date}\"'\n elif inputs.from_date:\n search_criteria = f'SINCE \"{inputs.from_date}\"'\n elif inputs.to_date:\n search_criteria = f'BEFORE \"{inputs.to_date}\"'\n\n print(\"Search Criteria:\", search_criteria)\n _, data = imap.search(None, search_criteria)\n mail_ids = data[0].split()\n\n for mail_id in mail_ids:\n _, data = imap.fetch(mail_id, '(RFC822)')\n raw_email = data[0][1]\n email_message = email.message_from_bytes(raw_email)\n\n email_obj = Email()\n email_obj.subject = email_message.get('Subject', '')\n email_obj.sender = email_message.get('From', '')\n try:\n email_obj.date = datetime.strptime(email_message['Date'], '%a, %d %b %Y %H:%M:%S %z') # Example format, adjust as needed\n except ValueError:\n email_obj.date = None # Handle parsing error\n\n email_obj.text = \"\"\n if email_message.is_multipart():\n for part in email_message.walk():\n content_type = part.get_content_type()\n content_disposition = str(part.get(\"Content-Disposition\"))\n try:\n body = part.get_payload(decode=True).decode()\n if content_type == \"text/plain\" and \"attachment\" not in content_disposition:\n email_obj.text += body\n except Exception as e:\n print(f\"Error decoding email part: {e}\")\n else:\n try:\n email_obj.text = email_message.get_payload(decode=True).decode()\n except Exception as e:\n print(f\"Error decoding email payload: {e}\")\n\n output.emails.append(email_obj.__dict__) # Append as dictionary to match OUTPUT type\n\n imap.close()\n imap.logout()\n\n except Exception as e:\n output.login_status = str(e)\n print(f\"An error occurred: {e}\")\n\n return output","tools":[],"config":[{"BasicConfig":{"key_name":"imap_server","description":"The IMAP server address","required":true,"type":null,"key_value":null}},{"BasicConfig":{"key_name":"username","description":"The username for the IMAP account","required":true,"type":null,"key_value":null}},{"BasicConfig":{"key_name":"password","description":"The password for the IMAP account","required":true,"type":null,"key_value":null}},{"BasicConfig":{"key_name":"port","description":"The port number for the IMAP server (defaults to 993 for IMAPS)","required":false,"type":null,"key_value":null}},{"BasicConfig":{"key_name":"ssl","description":"Whether to use SSL for the IMAP connection (defaults to true)","required":false,"type":null,"key_value":null}}],"description":"Fetches emails from an IMAP server and returns their subject, date, sender, and text content.","keywords":["email","imap","fetch","parser"],"input_args":{"type":"object","properties":{"from_date":{"type":"string","description":"The start date for the email search (optional)"},"to_date":{"type":"string","description":"The end date for the email search (optional)"}},"required":[]},"output_arg":{"json":""},"activated":false,"embedding":[0.5479309,0.7763235,0.026674157,-0.16738741,0.5364636,-0.41592622,-0.18910207,-0.05454345,-0.29638964,0.2862875,-0.47343403,0.36381552,-0.028221607,-0.044476815,0.4598937,0.18612349,0.7828154,-0.7714744,-1.6326721,-0.8778204,-0.048063386,1.1291318,0.7664015,-0.29742765,-0.07895305,-0.11800984,-0.015257135,-0.5918412,-1.2382919,-1.5990069,0.13624647,0.613811,-0.075190045,0.06293893,-0.11953545,-0.27149397,-0.048563834,0.12580146,-0.75142956,-0.08895335,0.37151906,0.11853383,-0.17709689,0.009899925,-0.10987698,0.010610655,-0.3739504,-0.05800452,0.44720182,1.234952,0.26136097,-0.17966335,-0.002988577,0.61995935,-0.24467465,-0.06542288,-0.10929164,-0.25247148,-0.34462184,-0.04372844,0.30536994,0.06352043,-3.4439888,0.7174165,0.21700993,-0.74596703,-0.02436735,-0.1965301,-0.11611959,-0.6180924,0.18903497,-0.044823177,-0.78377825,0.9992074,0.7204637,-1.018795,0.24259819,0.26241738,0.71519196,-0.056704037,0.3214574,1.0126419,-0.3816996,0.19416338,-1.0504618,0.5837887,-0.45761284,-0.041342944,0.044106256,0.09262079,0.13525055,-0.5482912,-0.00019433163,-0.11295105,-0.39098027,-0.5777057,-0.5481062,0.21999045,-0.15936601,2.8422408,0.80019397,0.2077642,-0.3285482,-1.0237343,-0.31722015,-0.8532467,-0.3007262,-0.5583755,-0.5497531,-0.047561213,-0.108288676,0.24658099,0.16036676,0.22223756,0.5257036,-0.4537774,-0.575389,0.0774444,0.37592137,0.91921204,0.009767443,-0.060128514,-0.18703139,-0.27910328,-0.2958559,0.1515292,0.08438231,0.4104749,-0.064257696,-0.63763505,0.9386971,-0.89508957,-0.9638947,0.14572594,-0.06920652,0.14926244,0.050837606,-0.565508,-0.118247874,-0.44556957,-0.34451056,-1.8896232,0.85709465,0.5051772,0.5639328,0.96063703,-0.10398855,-0.1424489,-0.36340132,0.54609245,-0.12384151,0.21497999,-0.45669198,0.52929,0.4223799,-0.11460344,-0.122996174,-0.166623,0.087036274,-0.18353695,-0.35434458,0.113860786,0.65662843,0.23493981,-0.2713947,-0.4281857,0.3266951,0.7084959,-0.024459317,-0.07877298,0.7143753,0.14731333,-0.48049852,0.7254837,0.24513422,-0.054967947,0.01897259,0.10359511,0.29968926,-0.76801276,0.79415053,0.809134,-0.15827884,-0.6663613,0.17736472,0.63871837,0.1946787,-0.33553472,1.2522476,0.4795199,-0.49924162,1.6452429,-0.8945019,-1.4492631,0.095773175,-0.23259237,-0.28094348,0.63784915,0.683028,-0.042965755,-0.7615802,-0.21412589,-0.051427986,-0.09559578,0.42753083,0.039896064,0.15724176,-0.5159093,0.07113676,-0.64087176,0.1296175,-0.25358164,-0.12318501,0.06855747,0.60574794,-0.116952226,-0.19015035,-0.08382109,-0.16316505,0.28837523,-0.07065154,-0.020715445,-0.15442558,-0.6647575,-0.22111298,0.5690165,-0.9429492,0.29109824,-0.21969135,-0.26837555,1.0582712,1.1552417,0.44249675,0.70338833,1.2416098,-0.17338353,-0.8948746,1.0502487,0.42448974,-0.017904958,0.43834543,-0.039606214,-0.20880365,0.27866495,-0.17466074,0.18515173,0.23095343,-0.030884564,0.08141043,1.4430072,1.1376486,0.53613025,-0.2366021,0.34702548,0.030587671,-0.44374648,-1.2675188,-0.11138431,-0.339154,0.60913414,0.50010306,-0.31321654,1.0176988,0.5499899,0.080315925,-0.3171413,-0.8770165,-0.63169575,-0.18153813,-0.00763759,-0.86662555,0.22710544,-0.6306354,-0.34014967,-0.2009951,-0.24473186,0.29777953,0.4450379,-0.41532865,-0.38763383,-0.1695514,0.11756535,0.6374901,0.1111707,-0.2927736,-0.95100373,-0.085079,-0.76878,-0.5930545,0.3108728,0.19680336,-0.83715355,-0.6372137,-0.0524932,1.5352126,0.37868422,0.21009241,0.3811208,0.2817881,0.5902789,0.00004694611,0.090835646,-0.32211965,-0.40693212,-0.8613461,-0.44002575,0.20879349,-0.25120696,-0.27142256,0.32465765,-0.48586708,0.11979771,0.32263827,-0.45627564,0.54997385,-0.4462748,0.65437293,0.5738947,0.3156873,-1.9321,0.02173773,-0.13883269,0.4723531,-0.047878757,-1.1881952,0.379251,-0.55044246,-0.594921,-0.6036093,0.8095113,0.033107758,-0.19005199,0.21288945,-0.4164763,0.60610926,0.48504293,0.040338136,-0.41419882,-0.84944075,-0.07099132,0.4641935,2.054265,0.0036511272,0.17068133,0.22921714,0.4635803,-0.6021989,-1.7566532,0.36086866,-0.13427743,-0.119817354,0.7721548,0.33452892,0.24904981,0.2719462,1.1957556,-0.48627308,-0.2760353,-0.9714952,1.423162,0.22687478,0.25706276,-0.5673453,-0.30074564,0.03861826,0.46557784,0.71225953,-0.040022623,-0.18835677,-0.012464032,-0.13759041,0.31895515,0.4125949,0.5486704,0.15159258,0.14480522,0.27187392,0.35092625,0.8843945,0.6669177,0.5371572,1.1669174,-0.2080658,0.19059417],"result":{"type":"object","properties":{"emails":{"description":"A list of email objects","items":{"properties":{"date":{"description":"The date and time the email was sent","format":"date-time","type":"string"},"sender":{"description":"The sender of the email","type":"string"},"subject":{"description":"The subject of the email","type":"string"},"text":{"description":"The text content of the email","type":"string"}},"required":["subject","date","sender","text"],"type":"object"},"type":"array"},"login_status":{"description":"Indicates if login was successful or not","type":"string"}},"required":["emails","login_status"]},"sql_tables":[],"sql_queries":[],"file_inbox":null,"oauth":null,"assets":null},false]} \ No newline at end of file +{"type":"Python","content":[{"version":"1.0.0","name":"Email Fetcher","homepage":null,"author":"@@official.shinkai","py_code":"from typing import Any, Optional, List, Dict\nimport imaplib\nimport email\nfrom datetime import datetime\n\nclass CONFIG:\n imap_server: str\n username: str\n password: str\n port: int = 143 # Default port for IMAPS\n ssl: bool = True # New flag to specify SSL usage\n\nclass INPUTS:\n from_date: Optional[str]\n to_date: Optional[str]\n\nclass OUTPUT:\n emails: List[Dict[str, Any]]\n login_status: str\n\nclass Email:\n subject: str\n date: datetime\n sender: str\n text: str\n\n# Function to validate date format\ndef validate_date_format(date_str):\n try:\n # Attempt to parse the date string in the expected format\n datetime.strptime(date_str, '%d-%b-%Y') # Expected format: DD-Mon-YYYY\n except ValueError:\n raise ValueError(f\"Invalid date format: {date_str}. Expected format is DD-Mon-YYYY. Example: 10-Jan-2025\")\n\n\nasync def run(config: CONFIG, inputs: INPUTS) -> OUTPUT:\n output = OUTPUT()\n output.login_status = \"N/A\"\n output.emails = []\n try:\n # Use SSL if the ssl flag is set to True\n if config.ssl:\n imap = imaplib.IMAP4_SSL(config.imap_server, config.port)\n else:\n imap = imaplib.IMAP4(config.imap_server, config.port) # Use config port\n except Exception as ee:\n output.login_status = 'IMAP4 INIT FAILED - ' + str(ee)\n return output\n\n try:\n login_status, login_response = imap.login(config.username, config.password)\n if login_status == \"OK\":\n print(\"Login successful\")\n else:\n raise Exception(\"Login failed\")\n\n imap.select(\"INBOX\")\n\n # Validate the input dates\n if inputs.from_date:\n validate_date_format(inputs.from_date)\n if inputs.to_date:\n validate_date_format(inputs.to_date)\n\n # Construct the search criteria\n search_criteria = 'ALL'\n if inputs.from_date and inputs.to_date:\n search_criteria = f'SINCE \"{inputs.from_date}\" BEFORE \"{inputs.to_date}\"'\n elif inputs.from_date:\n search_criteria = f'SINCE \"{inputs.from_date}\"'\n elif inputs.to_date:\n search_criteria = f'BEFORE \"{inputs.to_date}\"'\n\n print(\"Search Criteria:\", search_criteria)\n _, data = imap.search(None, search_criteria)\n mail_ids = data[0].split()\n\n for mail_id in mail_ids:\n _, data = imap.fetch(mail_id, '(RFC822)')\n raw_email = data[0][1]\n email_message = email.message_from_bytes(raw_email)\n\n email_obj = Email()\n email_obj.subject = email_message.get('Subject', '')\n email_obj.sender = email_message.get('From', '')\n try:\n email_obj.date = datetime.strptime(email_message['Date'], '%a, %d %b %Y %H:%M:%S %z') # Example format, adjust as needed\n except ValueError:\n email_obj.date = None # Handle parsing error\n\n email_obj.text = \"\"\n if email_message.is_multipart():\n for part in email_message.walk():\n content_type = part.get_content_type()\n content_disposition = str(part.get(\"Content-Disposition\"))\n try:\n body = part.get_payload(decode=True).decode()\n if content_type == \"text/plain\" and \"attachment\" not in content_disposition:\n email_obj.text += body\n except Exception as e:\n print(f\"Error decoding email part: {e}\")\n else:\n try:\n email_obj.text = email_message.get_payload(decode=True).decode()\n except Exception as e:\n print(f\"Error decoding email payload: {e}\")\n\n output.emails.append(email_obj.__dict__) # Append as dictionary to match OUTPUT type\n\n imap.close()\n imap.logout()\n\n except Exception as e:\n output.login_status = str(e)\n print(f\"An error occurred: {e}\")\n\n return output","tools":[],"config":[{"BasicConfig":{"key_name":"imap_server","description":"The IMAP server address","required":true,"type":null,"key_value":null}},{"BasicConfig":{"key_name":"username","description":"The username for the IMAP account","required":true,"type":null,"key_value":null}},{"BasicConfig":{"key_name":"password","description":"The password for the IMAP account","required":true,"type":null,"key_value":null}},{"BasicConfig":{"key_name":"port","description":"The port number for the IMAP server (defaults to 993 for IMAPS)","required":false,"type":null,"key_value":null}},{"BasicConfig":{"key_name":"ssl","description":"Whether to use SSL for the IMAP connection (defaults to true)","required":false,"type":null,"key_value":null}}],"description":"Fetches emails from an IMAP server and returns their subject, date, sender, and text content.","keywords":["email","imap","fetch","parser"],"input_args":{"type":"object","properties":{"to_date":{"type":"string","description":"The end date for the email search (optional)"},"from_date":{"type":"string","description":"The start date for the email search (optional)"}},"required":[]},"output_arg":{"json":""},"activated":false,"embedding":[0.5479309,0.7763235,0.026674157,-0.16738741,0.5364636,-0.41592622,-0.18910207,-0.05454345,-0.29638964,0.2862875,-0.47343403,0.36381552,-0.028221607,-0.044476815,0.4598937,0.18612349,0.7828154,-0.7714744,-1.6326721,-0.8778204,-0.048063386,1.1291318,0.7664015,-0.29742765,-0.07895305,-0.11800984,-0.015257135,-0.5918412,-1.2382919,-1.5990069,0.13624647,0.613811,-0.075190045,0.06293893,-0.11953545,-0.27149397,-0.048563834,0.12580146,-0.75142956,-0.08895335,0.37151906,0.11853383,-0.17709689,0.009899925,-0.10987698,0.010610655,-0.3739504,-0.05800452,0.44720182,1.234952,0.26136097,-0.17966335,-0.002988577,0.61995935,-0.24467465,-0.06542288,-0.10929164,-0.25247148,-0.34462184,-0.04372844,0.30536994,0.06352043,-3.4439888,0.7174165,0.21700993,-0.74596703,-0.02436735,-0.1965301,-0.11611959,-0.6180924,0.18903497,-0.044823177,-0.78377825,0.9992074,0.7204637,-1.018795,0.24259819,0.26241738,0.71519196,-0.056704037,0.3214574,1.0126419,-0.3816996,0.19416338,-1.0504618,0.5837887,-0.45761284,-0.041342944,0.044106256,0.09262079,0.13525055,-0.5482912,-0.00019433163,-0.11295105,-0.39098027,-0.5777057,-0.5481062,0.21999045,-0.15936601,2.8422408,0.80019397,0.2077642,-0.3285482,-1.0237343,-0.31722015,-0.8532467,-0.3007262,-0.5583755,-0.5497531,-0.047561213,-0.108288676,0.24658099,0.16036676,0.22223756,0.5257036,-0.4537774,-0.575389,0.0774444,0.37592137,0.91921204,0.009767443,-0.060128514,-0.18703139,-0.27910328,-0.2958559,0.1515292,0.08438231,0.4104749,-0.064257696,-0.63763505,0.9386971,-0.89508957,-0.9638947,0.14572594,-0.06920652,0.14926244,0.050837606,-0.565508,-0.118247874,-0.44556957,-0.34451056,-1.8896232,0.85709465,0.5051772,0.5639328,0.96063703,-0.10398855,-0.1424489,-0.36340132,0.54609245,-0.12384151,0.21497999,-0.45669198,0.52929,0.4223799,-0.11460344,-0.122996174,-0.166623,0.087036274,-0.18353695,-0.35434458,0.113860786,0.65662843,0.23493981,-0.2713947,-0.4281857,0.3266951,0.7084959,-0.024459317,-0.07877298,0.7143753,0.14731333,-0.48049852,0.7254837,0.24513422,-0.054967947,0.01897259,0.10359511,0.29968926,-0.76801276,0.79415053,0.809134,-0.15827884,-0.6663613,0.17736472,0.63871837,0.1946787,-0.33553472,1.2522476,0.4795199,-0.49924162,1.6452429,-0.8945019,-1.4492631,0.095773175,-0.23259237,-0.28094348,0.63784915,0.683028,-0.042965755,-0.7615802,-0.21412589,-0.051427986,-0.09559578,0.42753083,0.039896064,0.15724176,-0.5159093,0.07113676,-0.64087176,0.1296175,-0.25358164,-0.12318501,0.06855747,0.60574794,-0.116952226,-0.19015035,-0.08382109,-0.16316505,0.28837523,-0.07065154,-0.020715445,-0.15442558,-0.6647575,-0.22111298,0.5690165,-0.9429492,0.29109824,-0.21969135,-0.26837555,1.0582712,1.1552417,0.44249675,0.70338833,1.2416098,-0.17338353,-0.8948746,1.0502487,0.42448974,-0.017904958,0.43834543,-0.039606214,-0.20880365,0.27866495,-0.17466074,0.18515173,0.23095343,-0.030884564,0.08141043,1.4430072,1.1376486,0.53613025,-0.2366021,0.34702548,0.030587671,-0.44374648,-1.2675188,-0.11138431,-0.339154,0.60913414,0.50010306,-0.31321654,1.0176988,0.5499899,0.080315925,-0.3171413,-0.8770165,-0.63169575,-0.18153813,-0.00763759,-0.86662555,0.22710544,-0.6306354,-0.34014967,-0.2009951,-0.24473186,0.29777953,0.4450379,-0.41532865,-0.38763383,-0.1695514,0.11756535,0.6374901,0.1111707,-0.2927736,-0.95100373,-0.085079,-0.76878,-0.5930545,0.3108728,0.19680336,-0.83715355,-0.6372137,-0.0524932,1.5352126,0.37868422,0.21009241,0.3811208,0.2817881,0.5902789,0.00004694611,0.090835646,-0.32211965,-0.40693212,-0.8613461,-0.44002575,0.20879349,-0.25120696,-0.27142256,0.32465765,-0.48586708,0.11979771,0.32263827,-0.45627564,0.54997385,-0.4462748,0.65437293,0.5738947,0.3156873,-1.9321,0.02173773,-0.13883269,0.4723531,-0.047878757,-1.1881952,0.379251,-0.55044246,-0.594921,-0.6036093,0.8095113,0.033107758,-0.19005199,0.21288945,-0.4164763,0.60610926,0.48504293,0.040338136,-0.41419882,-0.84944075,-0.07099132,0.4641935,2.054265,0.0036511272,0.17068133,0.22921714,0.4635803,-0.6021989,-1.7566532,0.36086866,-0.13427743,-0.119817354,0.7721548,0.33452892,0.24904981,0.2719462,1.1957556,-0.48627308,-0.2760353,-0.9714952,1.423162,0.22687478,0.25706276,-0.5673453,-0.30074564,0.03861826,0.46557784,0.71225953,-0.040022623,-0.18835677,-0.012464032,-0.13759041,0.31895515,0.4125949,0.5486704,0.15159258,0.14480522,0.27187392,0.35092625,0.8843945,0.6669177,0.5371572,1.1669174,-0.2080658,0.19059417],"result":{"type":"object","properties":{"emails":{"description":"A list of email objects","items":{"properties":{"date":{"description":"The date and time the email was sent","format":"date-time","type":"string"},"sender":{"description":"The sender of the email","type":"string"},"subject":{"description":"The subject of the email","type":"string"},"text":{"description":"The text content of the email","type":"string"}},"required":["subject","date","sender","text"],"type":"object"},"type":"array"},"login_status":{"description":"Indicates if login was successful or not","type":"string"}},"required":["emails","login_status"]},"sql_tables":[],"sql_queries":[],"file_inbox":null,"oauth":null,"assets":null,"runner":"any","operating_system":["linux","macos","windows"],"tool_set":""},false]} \ No newline at end of file diff --git a/tools/email-imap-fetcher/metadata.json b/tools/email-imap-fetcher/metadata.json index cf43308e..c2792389 100644 --- a/tools/email-imap-fetcher/metadata.json +++ b/tools/email-imap-fetcher/metadata.json @@ -10,7 +10,10 @@ "fetch", "parser" ], - "configurations": { + "runner": "any", + "operating_system": ["linux", "macos", "windows"], + "tool_set": "", + "configurations": { "type": "object", "properties": { "imap_server": { diff --git a/tools/email-responder/.tool-dump.test.json b/tools/email-responder/.tool-dump.test.json index 2554181d..6e0e88f5 100644 --- a/tools/email-responder/.tool-dump.test.json +++ b/tools/email-responder/.tool-dump.test.json @@ -1 +1 @@ -{"type":"Deno","content":[{"name":"Email Answerer","homepage":null,"author":"@@official.shinkai","version":"1.0.0","js_code":"import {\n emailFetcher,\n sendEmail,\n shinkaiLlmPromptProcessor,\n shinkaiSqliteQueryExecutor,\n memoryManagement,\n} from './shinkai-local-tools.ts';\n\ntype EMAIL = {\n date: string;\n sender: string;\n subject: string;\n text: string;\n}\n\ntype ANSWERED_EMAIL_REGISTER = {\n email_unique_id: string;\n subject: string;\n email: string;\n response: string;\n received_date: string;\n response_date: string;\n}\n\nasync function generateEmailUniqueId(email: EMAIL): Promise {\n const encoder = new TextEncoder();\n if (!email.subject && !email.sender && !email.date) {\n throw new Error('Email is empty subject, sender, and date, cannot generate unique id');\n }\n const data = encoder.encode((email.subject ?? '') + (email.sender ?? '') + (email.date ?? ''));\n const hashBuffer = await crypto.subtle.digest('SHA-256', data);\n const hashArray = Array.from(new Uint8Array(hashBuffer));\n return hashArray.map(b => b.toString(16).padStart(2, '0')).join('');\n}\n\ntype CONFIG = {\n response_context: string;\n};\n\ntype INPUTS = {\n from_date?: string;\n to_date?: string;\n};\n\ntype OUTPUT = {\n table_created: boolean;\n mail_ids: (string | number)[];\n skipped: string[];\n login_status: string;\n};\n\n// Helper function to escape user input\nfunction escapeSqlString(str: string): string {\n return `'${str.replace(/'/g, \"''\").replace('--', '').replace(';', '')}'`; // Replaces single quotes with two single quotes\n}\n\n// Validate inputs\nfunction validateInputs(inputs: INPUTS): void {\n if (!inputs.from_date && !inputs.to_date) return\n // Check if dates are on the DD-Mon-YYYY format\n const dateRegex = /^[0-3]{1}[0-9]{1}-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-\\d{4}$/;\n if (inputs.from_date) {\n if (!dateRegex.test(inputs.from_date)) {\n throw new Error('from_date : Invalid from_date format. It must be on the DD-Mon-YYYY format');\n }\n }\n if (inputs.to_date) {\n if (!dateRegex.test(inputs.to_date)) {\n throw new Error('to_date : Invalid to_date format. It must be on the DD-Mon-YYYY format');\n }\n }\n return\n}\n\nfunction getTodayInDDMonYYYY(): string {\n const date = new Date();\n const day = date.getDate().toString().padStart(2, '0');\n const month = date.toLocaleString('en-US', { month: 'short' });\n const year = date.getFullYear();\n return `${day}-${month}-${year}`;\n}\n\nexport async function run(config: CONFIG, inputs: INPUTS): Promise {\n if (inputs.from_date || inputs.to_date) {\n validateInputs(inputs)\n }\n const tableName = 'answered_emails';\n\n const createTableQuery = `\n CREATE TABLE IF NOT EXISTS ${tableName} (\n email_unique_id TEXT UNIQUE PRIMARY KEY,\n subject TEXT NOT NULL,\n email TEXT NOT NULL,\n response TEXT NOT NULL,\n received_date DATETIME NOT NULL,\n response_date DATETIME DEFAULT CURRENT_TIMESTAMP\n );\n `;\n\n await shinkaiSqliteQueryExecutor({ query: createTableQuery });\n // Ensure the connection is closed or cleaned up if necessary\n // Verify table creation was successful\n const tableCheck = await shinkaiSqliteQueryExecutor({\n query: `SELECT name FROM sqlite_master WHERE type='table' AND name=?;`,\n params: [tableName]\n });\n const tableCreated = (tableCheck?.result?.length ?? 0) > 0;\n let { emails, login_status } = await emailFetcher({\n from_date: inputs.from_date || getTodayInDDMonYYYY(),\n to_date: inputs.to_date || '01-Jan-2099',\n });\n\n const answeredEmailsQuery = await shinkaiSqliteQueryExecutor({\n query: `SELECT * FROM ${tableName}`,\n });\n if (!answeredEmailsQuery?.result) {\n throw new Error('Failed to query answered emails');\n }\n const answeredEmails: ANSWERED_EMAIL_REGISTER[] = (answeredEmailsQuery.result as ANSWERED_EMAIL_REGISTER[]) ?? [];\n const mailIds: string[] = [];\n const minDate = inputs.from_date ? new Date(inputs.from_date) : new Date('1970-01-01T00:00:00.000Z');\n emails = emails\n .filter((e: EMAIL) => (e.date && e.sender && e.subject))\n .filter((e: EMAIL) => e.date > ((minDate && minDate.toISOString()) || '1970-01-01T00:00:00.000Z'))\n \n const insertMailIdQuery = (\n emailUniqueId: string,\n subject: string,\n email: string,\n response: string,\n received_date: Date,\n ) => `\n INSERT INTO ${tableName} (email_unique_id, subject, email, response, received_date) \n VALUES (${emailUniqueId}, ${subject}, ${email}, ${response}, ${Math.floor(received_date.getTime() / 1000)});\n `;\n\n const skipped: string[] = [];\n try {\n for (const email of emails as EMAIL[]) {\n const emailUniqueId = await generateEmailUniqueId(email);\n const { specificMemory } = await memoryManagement({ key: email.sender, data: '#' })\n const answeredEmail = answeredEmails.find(answeredEmail => answeredEmail.email_unique_id === emailUniqueId);\n if (answeredEmail) {\n skipped.push(answeredEmail.email_unique_id)\n console.log(`🐸 Skipping email with subject ${answeredEmail.subject}`)\n continue;\n }\n\n let response;\n try {\n response = await shinkaiLlmPromptProcessor({\n format: 'text',\n prompt: `You are a helpful email answering system.\n Please respond to a following email but only in the manner of the following context:\n \n ${config.response_context}\n # memories of past conversations with this email sender:\n \n ${specificMemory || 'No memories found'}\n \n \n This is the email you need to respond to:\n \n ${email.subject}\n ${email.sender}\n ${email.date}\n ${email.text}\n \n\n You'll be generating only the response to the email, no other text or markdown like html its neccesary.\n `,\n });\n } catch (error) {\n console.error(`Failed to process email: ${error}`);\n continue; // Skip this email if processing fails\n }\n \n await sendEmail({\n recipient_email: email.sender,\n subject: 'RE:' + email.subject,\n body: response.message\n });\n const _insertMemory = await memoryManagement({ key: email.sender, data: `\n \n ${email.subject}\n ${email.sender}\n ${email.date}\n ${email.text}\n \n \n ${response.message}\n \n ` \n })\n const insertEmail = insertMailIdQuery(\n escapeSqlString(emailUniqueId),\n escapeSqlString(email.subject),\n escapeSqlString(email.sender),\n escapeSqlString(response.message),\n new Date(email.date)\n );\n await shinkaiSqliteQueryExecutor({ query: insertEmail })\n const mailId = emailUniqueId;\n mailIds.push(mailId);\n }\n } catch (error) {\n console.error(`Failed to process emails: ${error}`);\n throw error; // Rethrow the error after rollback\n }\n return {\n table_created: tableCreated,\n mail_ids: mailIds,\n login_status,\n skipped,\n };\n}\n","tools":["local:::__official_shinkai:::email_fetcher","local:::__official_shinkai:::send_email","local:::__official_shinkai:::shinkai_sqlite_query_executor","local:::__official_shinkai:::shinkai_llm_prompt_processor","local:::__official_shinkai:::memory_management"],"config":[{"BasicConfig":{"key_name":"response_context","description":"The context to guide the email responses","required":true,"type":null,"key_value":null}}],"description":"Generates responses to emails based on a given context and memory, and logs answered emails in a database.","keywords":["email","responder","database","shinkai"],"input_args":{"type":"object","properties":{"to_date":{"type":"string","description":"The ending date for fetching emails in DD-Mon-YYYY format"},"from_date":{"type":"string","description":"The starting date for fetching emails in DD-Mon-YYYY format"}},"required":[]},"output_arg":{"json":""},"activated":false,"embedding":[-0.30160928,0.67717886,-0.4322511,-0.36650854,0.17701775,-0.029251136,-0.5258444,0.49951208,0.16187188,0.26544487,-0.37414777,0.21136293,0.05033677,-0.3126728,0.7634731,0.046571933,0.07062693,-0.29268694,-1.9152012,0.09953306,-0.16451852,0.7857904,0.686115,0.11705001,-0.13328183,-0.21128266,0.23142299,-0.3185498,-1.2249476,-1.3266835,0.59554166,0.7213682,-0.5107288,0.059182838,-0.47254252,-0.23404837,-0.120174676,0.47546884,-0.5912289,-0.062716514,0.58690315,0.36321115,-0.38013643,-0.25597966,0.018361852,-0.22162679,-0.06384943,-0.07689182,0.7772658,0.8583219,-0.14775123,-0.42806613,0.23700212,0.12848254,-0.1140695,0.3388893,0.015029535,-0.29331636,-0.016507443,-0.39420602,0.05923882,-0.018383235,-3.9494703,0.19543925,0.03739322,-0.25684634,0.31338164,0.42199448,0.48000866,-0.271337,-0.22447014,0.32070038,-0.7371344,1.2387346,0.38834032,-0.20106517,-0.012331404,-0.11354436,0.7460065,-0.5133005,0.44120795,0.75562674,-0.35178638,-0.10958873,-0.3931743,0.6807675,-0.07204697,-0.22315043,0.30575168,0.030470103,-0.28454387,-0.8287612,0.5367448,-0.17306441,-0.17944345,-0.18390672,-0.3057208,-0.010982722,-0.30409643,2.964792,0.13529381,-0.711479,0.0022296011,-1.005091,0.42289382,-0.5163104,0.20672205,-0.919324,-0.022783445,0.1908918,-0.010506898,-0.04404326,-0.21439502,0.6459613,0.06411126,0.08493342,-0.25258496,0.43225545,-0.20665924,0.7208773,0.0041208863,0.07908209,-0.51187176,-0.22449929,-0.195619,0.23227623,0.39279953,0.45170504,0.18363768,0.035344087,0.91490334,-0.59799963,-0.9771259,-0.06274269,-0.054869466,-0.08414035,0.5538423,-0.35538474,-0.076440714,-0.3206965,-0.10552406,-2.014307,0.96668446,0.39891177,0.4973475,0.03936296,-0.6603491,0.032400712,-0.3337222,-0.2241773,0.06556061,0.21809816,-0.13534349,-0.11886731,0.24354486,-0.16657957,-0.02861024,-0.27697042,-0.4505665,-0.14624187,-0.04704337,-0.23399259,0.3990878,0.30915716,0.35330132,-0.6231617,-0.29372683,0.06911435,0.11931896,-0.56670743,0.35693133,0.21961069,-0.3967881,0.24935545,-0.34806406,-0.45969424,0.49558315,0.0017653927,0.057242304,-0.5709171,0.82297546,1.0182934,-0.3112916,-0.36621296,0.21310155,0.2296645,0.1541861,-0.06473474,0.9381486,0.58597934,-0.7204826,1.2318189,-0.4364589,-0.37543827,-0.031741075,-0.12700588,-0.3180621,0.81643766,0.9912723,-0.23776829,-0.67091745,-0.40767476,-0.5760476,0.75886226,0.36673674,0.21543583,-0.5355634,-0.037257172,0.17624314,-0.92904425,-0.28127345,-0.1845923,0.41406468,0.6612436,0.63401735,0.4237126,0.23235948,-0.19659789,0.089210615,0.6496098,0.7370103,-0.41975042,-0.17939922,-0.5968706,-0.46433568,0.6218224,-0.5432305,0.09181826,-0.035572205,-0.26056433,0.6427494,1.5917606,0.009843186,1.252941,0.7476638,0.3353797,-0.3741541,0.4464214,0.110837325,-0.5709675,0.35869256,-0.6551249,-0.22774357,0.23962264,0.07920181,-0.10172166,0.3314637,-0.31137112,0.22255822,1.5535393,0.8264385,0.72304636,-0.167512,0.107184276,-0.18893349,0.10255157,-1.6523613,0.055841148,-0.61139375,0.5092495,0.20821503,-0.5351073,0.7388683,0.3510846,-0.041543454,-0.41995573,-0.9519685,-0.9988415,-0.37637216,-0.065479964,-0.66645473,0.34684986,-0.62474084,-0.1945132,-0.08595033,-0.25059602,0.6598771,0.38306752,-0.096167535,-0.33462778,0.25090736,-0.14077263,0.41022074,-0.032457843,-0.39594895,-0.31209314,-0.19358307,-0.75830185,-0.23580626,0.7569412,-0.013618309,-0.79057705,-0.474253,0.38156217,1.7257736,1.0237458,0.025998197,0.922849,0.6480505,0.58603096,0.2220225,0.520572,-0.4226414,-0.31868437,-0.5875114,-0.66161126,0.25158823,-0.033079542,-0.27615055,0.15040594,-0.6983925,-0.11842218,0.16466223,0.27259275,0.70768875,-0.45043695,1.2367421,0.66091526,0.15363751,-2.0084012,0.25103742,0.5903221,0.27917907,0.17843619,-0.21988584,0.5285674,-0.65083665,0.10759954,-0.4745211,0.5549319,0.19675212,-0.6425664,0.09324993,-0.41567433,0.5663786,0.42906415,-0.3496396,-0.8037924,-0.59630895,-0.27466714,0.5661104,1.8319073,0.42217153,-0.13905634,0.21579905,0.28269005,-0.5863708,-1.6216569,0.13251193,-0.37928987,-0.38373178,1.0773281,0.25534162,-0.40259826,-0.4632742,0.71163124,-0.5344507,-0.23922887,-0.601537,1.4480318,-0.20677155,-0.35658178,-1.1285872,0.26381725,-0.6875173,-0.03495778,0.8357181,0.13991642,-0.3198272,0.37847862,0.35239175,0.29512957,0.46219376,0.3489816,0.25090438,-0.18067755,-0.15464005,0.27996427,0.08491511,0.3674361,0.43549424,0.69384015,-0.32639167,0.39555025],"result":{"type":"object","properties":{"login_status":{"description":"The status of the email login","type":"string"},"mail_ids":{"description":"The list of generated unique mail IDs","items":{"type":"string"},"type":"array"},"skipped":{"description":"List of email IDs that were skipped","items":{"type":"string"},"type":"array"},"table_created":{"description":"Indicates if the email logging table was created","type":"boolean"}},"required":["table_created","mail_ids"]},"sql_tables":[{"name":"answered_emails","definition":"CREATE TABLE IF NOT EXISTS answered_emails (email_unique_id TEXT UNIQUE PRIMARY KEY, subject TEXT NOT NULL, email TEXT NOT NULL, response TEXT NOT NULL, received_date DATETIME NOT NULL, response_date DATETIME DEFAULT CURRENT_TIMESTAMP)"}],"sql_queries":[{"name":"Get answered emails","query":"SELECT * FROM answered_emails"},{"name":"Get email by unique ID","query":"SELECT * FROM answered_emails WHERE email_unique_id = :emailUniqueId"},{"name":"Insert new email","query":"INSERT INTO answered_emails (email_unique_id, subject, email, response, received_date) VALUES (:emailUniqueId, :subject, :email, :response, :receivedDate)"}],"file_inbox":null,"oauth":null,"assets":null},false]} \ No newline at end of file +{"type":"Deno","content":[{"name":"Email Answerer","homepage":null,"author":"@@official.shinkai","version":"1.0.0","js_code":"import {\n emailFetcher,\n sendEmail,\n shinkaiLlmPromptProcessor,\n shinkaiSqliteQueryExecutor,\n memoryManagement,\n} from './shinkai-local-tools.ts';\n\ntype EMAIL = {\n date: string;\n sender: string;\n subject: string;\n text: string;\n}\n\ntype ANSWERED_EMAIL_REGISTER = {\n email_unique_id: string;\n subject: string;\n email: string;\n response: string;\n received_date: string;\n response_date: string;\n}\n\nasync function generateEmailUniqueId(email: EMAIL): Promise {\n const encoder = new TextEncoder();\n if (!email.subject && !email.sender && !email.date) {\n throw new Error('Email is empty subject, sender, and date, cannot generate unique id');\n }\n const data = encoder.encode((email.subject ?? '') + (email.sender ?? '') + (email.date ?? ''));\n const hashBuffer = await crypto.subtle.digest('SHA-256', data);\n const hashArray = Array.from(new Uint8Array(hashBuffer));\n return hashArray.map(b => b.toString(16).padStart(2, '0')).join('');\n}\n\ntype CONFIG = {\n response_context: string;\n};\n\ntype INPUTS = {\n from_date?: string;\n to_date?: string;\n};\n\ntype OUTPUT = {\n table_created: boolean;\n mail_ids: (string | number)[];\n skipped: string[];\n login_status: string;\n};\n\n// Helper function to escape user input\nfunction escapeSqlString(str: string): string {\n return `'${str.replace(/'/g, \"''\").replace('--', '').replace(';', '')}'`; // Replaces single quotes with two single quotes\n}\n\n// Validate inputs\nfunction validateInputs(inputs: INPUTS): void {\n if (!inputs.from_date && !inputs.to_date) return\n // Check if dates are on the DD-Mon-YYYY format\n const dateRegex = /^[0-3]{1}[0-9]{1}-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-\\d{4}$/;\n if (inputs.from_date) {\n if (!dateRegex.test(inputs.from_date)) {\n throw new Error('from_date : Invalid from_date format. It must be on the DD-Mon-YYYY format');\n }\n }\n if (inputs.to_date) {\n if (!dateRegex.test(inputs.to_date)) {\n throw new Error('to_date : Invalid to_date format. It must be on the DD-Mon-YYYY format');\n }\n }\n return\n}\n\nfunction getTodayInDDMonYYYY(): string {\n const date = new Date();\n const day = date.getDate().toString().padStart(2, '0');\n const month = date.toLocaleString('en-US', { month: 'short' });\n const year = date.getFullYear();\n return `${day}-${month}-${year}`;\n}\n\nexport async function run(config: CONFIG, inputs: INPUTS): Promise {\n if (inputs.from_date || inputs.to_date) {\n validateInputs(inputs)\n }\n const tableName = 'answered_emails';\n\n const createTableQuery = `\n CREATE TABLE IF NOT EXISTS ${tableName} (\n email_unique_id TEXT UNIQUE PRIMARY KEY,\n subject TEXT NOT NULL,\n email TEXT NOT NULL,\n response TEXT NOT NULL,\n received_date DATETIME NOT NULL,\n response_date DATETIME DEFAULT CURRENT_TIMESTAMP\n );\n `;\n\n await shinkaiSqliteQueryExecutor({ query: createTableQuery });\n // Ensure the connection is closed or cleaned up if necessary\n // Verify table creation was successful\n const tableCheck = await shinkaiSqliteQueryExecutor({\n query: `SELECT name FROM sqlite_master WHERE type='table' AND name=?;`,\n params: [tableName]\n });\n const tableCreated = (tableCheck?.result?.length ?? 0) > 0;\n let { emails, login_status } = await emailFetcher({\n from_date: inputs.from_date || getTodayInDDMonYYYY(),\n to_date: inputs.to_date || '01-Jan-2099',\n });\n\n const answeredEmailsQuery = await shinkaiSqliteQueryExecutor({\n query: `SELECT * FROM ${tableName}`,\n });\n if (!answeredEmailsQuery?.result) {\n throw new Error('Failed to query answered emails');\n }\n const answeredEmails: ANSWERED_EMAIL_REGISTER[] = (answeredEmailsQuery.result as ANSWERED_EMAIL_REGISTER[]) ?? [];\n const mailIds: string[] = [];\n const minDate = inputs.from_date ? new Date(inputs.from_date) : new Date('1970-01-01T00:00:00.000Z');\n emails = emails\n .filter((e: EMAIL) => (e.date && e.sender && e.subject))\n .filter((e: EMAIL) => e.date > ((minDate && minDate.toISOString()) || '1970-01-01T00:00:00.000Z'))\n \n const insertMailIdQuery = (\n emailUniqueId: string,\n subject: string,\n email: string,\n response: string,\n received_date: Date,\n ) => `\n INSERT INTO ${tableName} (email_unique_id, subject, email, response, received_date) \n VALUES (${emailUniqueId}, ${subject}, ${email}, ${response}, ${Math.floor(received_date.getTime() / 1000)});\n `;\n\n const skipped: string[] = [];\n try {\n for (const email of emails as EMAIL[]) {\n const emailUniqueId = await generateEmailUniqueId(email);\n const { specificMemory } = await memoryManagement({ key: email.sender, data: '#' })\n const answeredEmail = answeredEmails.find(answeredEmail => answeredEmail.email_unique_id === emailUniqueId);\n if (answeredEmail) {\n skipped.push(answeredEmail.email_unique_id)\n console.log(`🐸 Skipping email with subject ${answeredEmail.subject}`)\n continue;\n }\n\n let response;\n try {\n response = await shinkaiLlmPromptProcessor({\n format: 'text',\n prompt: `You are a helpful email answering system.\n Please respond to a following email but only in the manner of the following context:\n \n ${config.response_context}\n # memories of past conversations with this email sender:\n \n ${specificMemory || 'No memories found'}\n \n \n This is the email you need to respond to:\n \n ${email.subject}\n ${email.sender}\n ${email.date}\n ${email.text}\n \n\n You'll be generating only the response to the email, no other text or markdown like html its neccesary.\n `,\n });\n } catch (error) {\n console.error(`Failed to process email: ${error}`);\n continue; // Skip this email if processing fails\n }\n \n await sendEmail({\n recipient_email: email.sender,\n subject: 'RE:' + email.subject,\n body: response.message\n });\n const _insertMemory = await memoryManagement({ key: email.sender, data: `\n \n ${email.subject}\n ${email.sender}\n ${email.date}\n ${email.text}\n \n \n ${response.message}\n \n ` \n })\n const insertEmail = insertMailIdQuery(\n escapeSqlString(emailUniqueId),\n escapeSqlString(email.subject),\n escapeSqlString(email.sender),\n escapeSqlString(response.message),\n new Date(email.date)\n );\n await shinkaiSqliteQueryExecutor({ query: insertEmail })\n const mailId = emailUniqueId;\n mailIds.push(mailId);\n }\n } catch (error) {\n console.error(`Failed to process emails: ${error}`);\n throw error; // Rethrow the error after rollback\n }\n return {\n table_created: tableCreated,\n mail_ids: mailIds,\n login_status,\n skipped,\n };\n}\n","tools":["local:::__official_shinkai:::email_fetcher","local:::__official_shinkai:::send_email","local:::__official_shinkai:::shinkai_sqlite_query_executor","local:::__official_shinkai:::shinkai_llm_prompt_processor","local:::__official_shinkai:::memory_management"],"config":[{"BasicConfig":{"key_name":"response_context","description":"The context to guide the email responses","required":true,"type":null,"key_value":null}}],"description":"Generates responses to emails based on a given context and memory, and logs answered emails in a database.","keywords":["email","responder","database","shinkai"],"input_args":{"type":"object","properties":{"to_date":{"type":"string","description":"The ending date for fetching emails in DD-Mon-YYYY format"},"from_date":{"type":"string","description":"The starting date for fetching emails in DD-Mon-YYYY format"}},"required":[]},"output_arg":{"json":""},"activated":false,"embedding":[-0.30160928,0.67717886,-0.4322511,-0.36650854,0.17701775,-0.029251136,-0.5258444,0.49951208,0.16187188,0.26544487,-0.37414777,0.21136293,0.05033677,-0.3126728,0.7634731,0.046571933,0.07062693,-0.29268694,-1.9152012,0.09953306,-0.16451852,0.7857904,0.686115,0.11705001,-0.13328183,-0.21128266,0.23142299,-0.3185498,-1.2249476,-1.3266835,0.59554166,0.7213682,-0.5107288,0.059182838,-0.47254252,-0.23404837,-0.120174676,0.47546884,-0.5912289,-0.062716514,0.58690315,0.36321115,-0.38013643,-0.25597966,0.018361852,-0.22162679,-0.06384943,-0.07689182,0.7772658,0.8583219,-0.14775123,-0.42806613,0.23700212,0.12848254,-0.1140695,0.3388893,0.015029535,-0.29331636,-0.016507443,-0.39420602,0.05923882,-0.018383235,-3.9494703,0.19543925,0.03739322,-0.25684634,0.31338164,0.42199448,0.48000866,-0.271337,-0.22447014,0.32070038,-0.7371344,1.2387346,0.38834032,-0.20106517,-0.012331404,-0.11354436,0.7460065,-0.5133005,0.44120795,0.75562674,-0.35178638,-0.10958873,-0.3931743,0.6807675,-0.07204697,-0.22315043,0.30575168,0.030470103,-0.28454387,-0.8287612,0.5367448,-0.17306441,-0.17944345,-0.18390672,-0.3057208,-0.010982722,-0.30409643,2.964792,0.13529381,-0.711479,0.0022296011,-1.005091,0.42289382,-0.5163104,0.20672205,-0.919324,-0.022783445,0.1908918,-0.010506898,-0.04404326,-0.21439502,0.6459613,0.06411126,0.08493342,-0.25258496,0.43225545,-0.20665924,0.7208773,0.0041208863,0.07908209,-0.51187176,-0.22449929,-0.195619,0.23227623,0.39279953,0.45170504,0.18363768,0.035344087,0.91490334,-0.59799963,-0.9771259,-0.06274269,-0.054869466,-0.08414035,0.5538423,-0.35538474,-0.076440714,-0.3206965,-0.10552406,-2.014307,0.96668446,0.39891177,0.4973475,0.03936296,-0.6603491,0.032400712,-0.3337222,-0.2241773,0.06556061,0.21809816,-0.13534349,-0.11886731,0.24354486,-0.16657957,-0.02861024,-0.27697042,-0.4505665,-0.14624187,-0.04704337,-0.23399259,0.3990878,0.30915716,0.35330132,-0.6231617,-0.29372683,0.06911435,0.11931896,-0.56670743,0.35693133,0.21961069,-0.3967881,0.24935545,-0.34806406,-0.45969424,0.49558315,0.0017653927,0.057242304,-0.5709171,0.82297546,1.0182934,-0.3112916,-0.36621296,0.21310155,0.2296645,0.1541861,-0.06473474,0.9381486,0.58597934,-0.7204826,1.2318189,-0.4364589,-0.37543827,-0.031741075,-0.12700588,-0.3180621,0.81643766,0.9912723,-0.23776829,-0.67091745,-0.40767476,-0.5760476,0.75886226,0.36673674,0.21543583,-0.5355634,-0.037257172,0.17624314,-0.92904425,-0.28127345,-0.1845923,0.41406468,0.6612436,0.63401735,0.4237126,0.23235948,-0.19659789,0.089210615,0.6496098,0.7370103,-0.41975042,-0.17939922,-0.5968706,-0.46433568,0.6218224,-0.5432305,0.09181826,-0.035572205,-0.26056433,0.6427494,1.5917606,0.009843186,1.252941,0.7476638,0.3353797,-0.3741541,0.4464214,0.110837325,-0.5709675,0.35869256,-0.6551249,-0.22774357,0.23962264,0.07920181,-0.10172166,0.3314637,-0.31137112,0.22255822,1.5535393,0.8264385,0.72304636,-0.167512,0.107184276,-0.18893349,0.10255157,-1.6523613,0.055841148,-0.61139375,0.5092495,0.20821503,-0.5351073,0.7388683,0.3510846,-0.041543454,-0.41995573,-0.9519685,-0.9988415,-0.37637216,-0.065479964,-0.66645473,0.34684986,-0.62474084,-0.1945132,-0.08595033,-0.25059602,0.6598771,0.38306752,-0.096167535,-0.33462778,0.25090736,-0.14077263,0.41022074,-0.032457843,-0.39594895,-0.31209314,-0.19358307,-0.75830185,-0.23580626,0.7569412,-0.013618309,-0.79057705,-0.474253,0.38156217,1.7257736,1.0237458,0.025998197,0.922849,0.6480505,0.58603096,0.2220225,0.520572,-0.4226414,-0.31868437,-0.5875114,-0.66161126,0.25158823,-0.033079542,-0.27615055,0.15040594,-0.6983925,-0.11842218,0.16466223,0.27259275,0.70768875,-0.45043695,1.2367421,0.66091526,0.15363751,-2.0084012,0.25103742,0.5903221,0.27917907,0.17843619,-0.21988584,0.5285674,-0.65083665,0.10759954,-0.4745211,0.5549319,0.19675212,-0.6425664,0.09324993,-0.41567433,0.5663786,0.42906415,-0.3496396,-0.8037924,-0.59630895,-0.27466714,0.5661104,1.8319073,0.42217153,-0.13905634,0.21579905,0.28269005,-0.5863708,-1.6216569,0.13251193,-0.37928987,-0.38373178,1.0773281,0.25534162,-0.40259826,-0.4632742,0.71163124,-0.5344507,-0.23922887,-0.601537,1.4480318,-0.20677155,-0.35658178,-1.1285872,0.26381725,-0.6875173,-0.03495778,0.8357181,0.13991642,-0.3198272,0.37847862,0.35239175,0.29512957,0.46219376,0.3489816,0.25090438,-0.18067755,-0.15464005,0.27996427,0.08491511,0.3674361,0.43549424,0.69384015,-0.32639167,0.39555025],"result":{"type":"object","properties":{"login_status":{"description":"The status of the email login","type":"string"},"mail_ids":{"description":"The list of generated unique mail IDs","items":{"type":"string"},"type":"array"},"skipped":{"description":"List of email IDs that were skipped","items":{"type":"string"},"type":"array"},"table_created":{"description":"Indicates if the email logging table was created","type":"boolean"}},"required":["table_created","mail_ids"]},"sql_tables":[{"name":"answered_emails","definition":"CREATE TABLE IF NOT EXISTS answered_emails (email_unique_id TEXT UNIQUE PRIMARY KEY, subject TEXT NOT NULL, email TEXT NOT NULL, response TEXT NOT NULL, received_date DATETIME NOT NULL, response_date DATETIME DEFAULT CURRENT_TIMESTAMP)"}],"sql_queries":[{"name":"Get answered emails","query":"SELECT * FROM answered_emails"},{"name":"Get email by unique ID","query":"SELECT * FROM answered_emails WHERE email_unique_id = :emailUniqueId"},{"name":"Insert new email","query":"INSERT INTO answered_emails (email_unique_id, subject, email, response, received_date) VALUES (:emailUniqueId, :subject, :email, :response, :receivedDate)"}],"file_inbox":null,"oauth":null,"assets":null,"runner":"any","operating_system":["linux","macos","windows"],"tool_set":""},false]} \ No newline at end of file diff --git a/tools/email-responder/metadata.json b/tools/email-responder/metadata.json index a2c066e3..3686be79 100644 --- a/tools/email-responder/metadata.json +++ b/tools/email-responder/metadata.json @@ -10,6 +10,9 @@ "database", "shinkai" ], + "runner": "any", + "operating_system": ["linux", "macos", "windows"], + "tool_set": "", "configurations": { "type": "object", "properties": { diff --git a/tools/email-sender/.tool-dump.test.json b/tools/email-sender/.tool-dump.test.json index 7a687058..b52a4b96 100644 --- a/tools/email-sender/.tool-dump.test.json +++ b/tools/email-sender/.tool-dump.test.json @@ -1 +1 @@ -{"type":"Python","content":[{"version":"1.0.0","name":"Send Email","homepage":null,"author":"@@official.shinkai","py_code":"from typing import Any, Optional, List, Dict\nimport smtplib\nfrom email.mime.text import MIMEText\nfrom email.mime.multipart import MIMEMultipart\nfrom datetime import datetime\nimport logging\n\n# Configure logging\nlogging.basicConfig(level=logging.ERROR, format='%(asctime)s - %(levelname)s - %(message)s')\n\nclass CONFIG:\n smtp_server: str\n port: int = 465 # Default port for SMTP\n sender_email: str\n sender_password: str\n ssl: bool = True # New flag to specify SSL usage for SMTP\n\nclass INPUTS:\n recipient_email: str\n subject: str\n body: str\n\nclass OUTPUT:\n status: str\n message: str\n\n\nasync def run(config: CONFIG, inputs: INPUTS) -> OUTPUT:\n output = OUTPUT()\n output.status = \"failed\"\n output.message = \"\"\n\n msg = MIMEMultipart()\n msg['From'] = config.sender_email\n msg['To'] = inputs.recipient_email\n msg['Subject'] = inputs.subject\n msg['Date'] = datetime.now().strftime('%a, %d %b %Y %H:%M:%S %z')\n\n msg.attach(MIMEText(inputs.body, 'plain'))\n\n try:\n # Use SSL if the ssl flag is set to True\n if config.ssl:\n with smtplib.SMTP_SSL(config.smtp_server, config.port) as server:\n server.login(config.sender_email, config.sender_password)\n server.send_message(msg)\n else:\n with smtplib.SMTP(config.smtp_server, config.port) as server:\n try:\n server.starttls() # Upgrade to a secure connection\n except Exception as e:\n logging.error(f\"Failed to upgrade to a secure connection: {e}\")\n # Attempt to login and send the message regardless of starttls success\n server.login(config.sender_email, config.sender_password)\n server.send_message(msg)\n\n output.status = \"success\"\n output.message = \"Email sent successfully\"\n except Exception as e:\n output.message = f\"An error occurred: {e}\"\n\n return output","tools":[],"config":[{"BasicConfig":{"key_name":"smtp_server","description":"The SMTP server address","required":true,"type":null,"key_value":null}},{"BasicConfig":{"key_name":"port","description":"The SMTP server port","required":false,"type":null,"key_value":null}},{"BasicConfig":{"key_name":"sender_email","description":"The sender's email address","required":true,"type":null,"key_value":null}},{"BasicConfig":{"key_name":"sender_password","description":"The sender's email password","required":true,"type":null,"key_value":null}},{"BasicConfig":{"key_name":"ssl","description":"Whether to use SSL for the SMTP connection (defaults to true)","required":false,"type":null,"key_value":null}}],"description":"Sends an email using SMTP.","keywords":["email","smtp","send","notification"],"input_args":{"type":"object","properties":{"recipient_email":{"type":"string","description":"The recipient's email address"},"subject":{"type":"string","description":"The email subject"},"body":{"type":"string","description":"The email body"}},"required":["recipient_email","subject","body"]},"output_arg":{"json":""},"activated":false,"embedding":[-0.16863883,0.36951548,0.0710708,-0.36373425,-0.14536303,0.2146287,-0.50722194,0.1676828,0.2184625,-0.04377217,-0.085600205,0.34219766,-0.36027485,-0.18785664,0.55667514,-0.691538,0.2247413,-0.8311942,-1.5291927,-0.047287576,-0.6570787,0.70218843,0.47352836,0.18740639,-0.17268768,0.29156917,0.6691437,-0.07875953,-1.2676071,-1.8487979,-0.081507675,1.0741738,-0.56719506,0.19950143,0.16902098,-0.33455634,-0.26199192,-0.09675157,-0.47350892,-0.37621498,0.17657778,-0.88388574,-0.61456853,0.14724383,0.0047138403,-0.07347565,0.18744619,-0.009305887,0.48106268,0.6018966,-0.39029375,-0.52880675,-0.04798488,0.3419745,-0.5091409,0.012889862,0.24974045,-0.07357307,0.08554194,0.07949574,-0.16837044,0.3805329,-4.0146613,0.44082963,0.19260548,-0.05207956,0.013428052,-0.056233037,-0.08819136,-0.5272552,0.47180402,-0.060578555,-0.7489064,1.1056236,0.5340901,-0.6931602,-0.31226557,-0.03932616,0.5956225,0.09799042,0.30966645,0.8742893,-0.17315604,0.75597227,-0.9725792,0.6906055,-0.1251234,-0.1491244,0.42240295,0.3407192,-0.44704607,-0.40117118,0.1866251,-0.06991961,-0.19835445,-0.20955215,-0.26118103,0.12725456,0.22721684,2.7749872,0.5122516,-0.015306573,0.60036194,-1.0183859,-0.014407955,-0.2569119,-0.47032169,-0.886011,-0.30298057,-0.7121273,-0.0036273357,0.12116812,0.10482912,-0.24737927,0.46679825,-0.045558598,-0.35440093,0.36716238,-0.065571554,1.0201825,-0.24053283,0.1286274,-0.5494258,-0.35711333,0.12258132,0.15131353,-0.32479504,0.105600774,-0.13950256,0.27332562,0.65994203,-0.780461,-0.21348491,-0.20567286,0.23244157,0.11215775,0.40510517,-0.52354896,0.06681162,-0.41453093,0.59581953,-2.140505,1.3061415,0.75075674,0.672057,-0.10104084,0.10604617,-0.1125272,-0.42605418,-0.07585393,-0.33421445,0.093503065,0.20071425,0.42282313,0.75608283,-0.15237688,-0.121898524,0.5767451,-0.09775403,0.007833563,-0.13465671,0.14342043,-0.09603147,0.28792357,0.030869912,-1.0182501,-0.090522915,0.38259473,-0.30252847,-0.07191988,0.25874224,-0.30134445,-0.30062976,0.3386175,-0.184572,-0.13463037,0.21865469,0.14952739,0.44614434,-0.5275878,0.44001737,0.48307657,-0.20029795,-0.20540681,0.009874843,0.62023115,0.29343334,-0.26610968,1.1866063,0.20866166,-0.86935693,1.194493,-0.70958436,-0.67053705,0.16449386,0.15501787,-0.2732337,0.5001677,0.40268838,0.05267391,-0.28818738,-0.25627786,0.3237739,0.20661367,-0.114382796,-0.3155887,0.036046203,0.09303906,0.045092113,-0.38759232,0.16511068,-0.2412476,0.20692427,-0.00802502,0.3642635,0.5850683,-0.76512456,0.46202484,-0.28010985,0.5700413,0.4096586,0.3902241,-0.42495793,-0.43494877,-0.30588314,0.48026097,-0.12984975,0.49075717,-0.29071864,-0.42085195,0.30260554,0.8222282,0.19941153,1.315254,0.30886918,0.17627637,-0.24155778,0.49255127,0.6639385,-0.1827571,0.02121464,0.09293347,0.13839658,0.035679504,0.73405087,-0.6335372,0.5251611,0.31011373,-0.091499746,1.8595266,0.7143397,0.5168366,0.03708881,0.507861,0.18957117,0.1983318,-1.0314994,-0.33044,-0.82924306,0.99074227,0.2815774,-0.07468645,0.74307996,0.36426264,-0.22649744,-0.05202507,-0.6921822,-0.802549,-0.31213802,-0.084367484,-0.5192693,0.41364402,-0.29686666,0.43975556,-0.17650422,-0.6930386,0.47838062,0.33172914,-0.058259707,-0.7303181,-0.099644355,0.015148858,0.5009095,-0.14864665,-0.14669248,-0.6800788,0.20073141,-0.40443534,-0.14989856,0.3386585,0.045613185,-0.7879523,-0.5424034,0.5760776,2.0714297,0.2327904,0.22501259,0.56382495,0.12127443,0.39556783,0.14754608,-0.019769825,-0.5407266,-0.3219013,-0.83585715,-0.34718287,0.026048623,-0.7465372,-0.07637849,-0.033146467,0.01799985,-0.18363564,0.2644258,0.12561584,0.59224236,0.30794838,-0.24934794,0.04864285,0.03341459,-2.4325747,0.01822721,0.2530063,-0.18837038,-0.44696414,-0.8883713,0.09524957,-0.016613895,0.104276374,-0.38413656,1.4529321,-0.11070707,-0.43041483,0.35400572,0.08043813,0.8491075,-0.1862826,0.22454764,-0.31269205,-0.97372025,-0.42027125,1.1249119,2.2466652,0.0023729801,-0.026027378,-0.16045304,-0.1841715,-0.3728962,-1.1865739,0.40547544,-0.17469762,-0.17986779,0.22225553,-0.09583995,-0.24011159,-0.623016,0.5858946,-0.058788326,-0.21884863,-0.63768953,1.4557298,0.05939327,0.680458,-0.681359,-0.2196953,-0.097733356,-0.13278785,0.22399272,-0.040767163,-0.50004923,0.57334274,0.268478,0.117074646,0.31567943,0.21000771,0.35896412,0.3529358,-0.12819107,0.7792076,1.001332,0.45549732,0.33468097,0.6633587,-0.7268323,0.1314122],"result":{"type":"object","properties":{"message":{"description":"A message indicating the result of the operation","type":"string"},"status":{"description":"The status of the email sending operation ('success' or 'failed')","type":"string"}},"required":["status","message"]},"sql_tables":[],"sql_queries":[],"file_inbox":null,"oauth":null,"assets":null},false]} \ No newline at end of file +{"type":"Python","content":[{"version":"1.0.0","name":"Send Email","homepage":null,"author":"@@official.shinkai","py_code":"from typing import Any, Optional, List, Dict\nimport smtplib\nfrom email.mime.text import MIMEText\nfrom email.mime.multipart import MIMEMultipart\nfrom datetime import datetime\nimport logging\n\n# Configure logging\nlogging.basicConfig(level=logging.ERROR, format='%(asctime)s - %(levelname)s - %(message)s')\n\nclass CONFIG:\n smtp_server: str\n port: int = 465 # Default port for SMTP\n sender_email: str\n sender_password: str\n ssl: bool = True # New flag to specify SSL usage for SMTP\n\nclass INPUTS:\n recipient_email: str\n subject: str\n body: str\n\nclass OUTPUT:\n status: str\n message: str\n\n\nasync def run(config: CONFIG, inputs: INPUTS) -> OUTPUT:\n output = OUTPUT()\n output.status = \"failed\"\n output.message = \"\"\n\n msg = MIMEMultipart()\n msg['From'] = config.sender_email\n msg['To'] = inputs.recipient_email\n msg['Subject'] = inputs.subject\n msg['Date'] = datetime.now().strftime('%a, %d %b %Y %H:%M:%S %z')\n\n msg.attach(MIMEText(inputs.body, 'plain'))\n\n try:\n # Use SSL if the ssl flag is set to True\n if config.ssl:\n with smtplib.SMTP_SSL(config.smtp_server, config.port) as server:\n server.login(config.sender_email, config.sender_password)\n server.send_message(msg)\n else:\n with smtplib.SMTP(config.smtp_server, config.port) as server:\n try:\n server.starttls() # Upgrade to a secure connection\n except Exception as e:\n logging.error(f\"Failed to upgrade to a secure connection: {e}\")\n # Attempt to login and send the message regardless of starttls success\n server.login(config.sender_email, config.sender_password)\n server.send_message(msg)\n\n output.status = \"success\"\n output.message = \"Email sent successfully\"\n except Exception as e:\n output.message = f\"An error occurred: {e}\"\n\n return output","tools":[],"config":[{"BasicConfig":{"key_name":"smtp_server","description":"The SMTP server address","required":true,"type":null,"key_value":null}},{"BasicConfig":{"key_name":"port","description":"The SMTP server port","required":false,"type":null,"key_value":null}},{"BasicConfig":{"key_name":"sender_email","description":"The sender's email address","required":true,"type":null,"key_value":null}},{"BasicConfig":{"key_name":"sender_password","description":"The sender's email password","required":true,"type":null,"key_value":null}},{"BasicConfig":{"key_name":"ssl","description":"Whether to use SSL for the SMTP connection (defaults to true)","required":false,"type":null,"key_value":null}}],"description":"Sends an email using SMTP.","keywords":["email","smtp","send","notification"],"input_args":{"type":"object","properties":{"body":{"type":"string","description":"The email body"},"subject":{"type":"string","description":"The email subject"},"recipient_email":{"type":"string","description":"The recipient's email address"}},"required":["recipient_email","subject","body"]},"output_arg":{"json":""},"activated":false,"embedding":[-0.16863883,0.36951548,0.0710708,-0.36373425,-0.14536303,0.2146287,-0.50722194,0.1676828,0.2184625,-0.04377217,-0.085600205,0.34219766,-0.36027485,-0.18785664,0.55667514,-0.691538,0.2247413,-0.8311942,-1.5291927,-0.047287576,-0.6570787,0.70218843,0.47352836,0.18740639,-0.17268768,0.29156917,0.6691437,-0.07875953,-1.2676071,-1.8487979,-0.081507675,1.0741738,-0.56719506,0.19950143,0.16902098,-0.33455634,-0.26199192,-0.09675157,-0.47350892,-0.37621498,0.17657778,-0.88388574,-0.61456853,0.14724383,0.0047138403,-0.07347565,0.18744619,-0.009305887,0.48106268,0.6018966,-0.39029375,-0.52880675,-0.04798488,0.3419745,-0.5091409,0.012889862,0.24974045,-0.07357307,0.08554194,0.07949574,-0.16837044,0.3805329,-4.0146613,0.44082963,0.19260548,-0.05207956,0.013428052,-0.056233037,-0.08819136,-0.5272552,0.47180402,-0.060578555,-0.7489064,1.1056236,0.5340901,-0.6931602,-0.31226557,-0.03932616,0.5956225,0.09799042,0.30966645,0.8742893,-0.17315604,0.75597227,-0.9725792,0.6906055,-0.1251234,-0.1491244,0.42240295,0.3407192,-0.44704607,-0.40117118,0.1866251,-0.06991961,-0.19835445,-0.20955215,-0.26118103,0.12725456,0.22721684,2.7749872,0.5122516,-0.015306573,0.60036194,-1.0183859,-0.014407955,-0.2569119,-0.47032169,-0.886011,-0.30298057,-0.7121273,-0.0036273357,0.12116812,0.10482912,-0.24737927,0.46679825,-0.045558598,-0.35440093,0.36716238,-0.065571554,1.0201825,-0.24053283,0.1286274,-0.5494258,-0.35711333,0.12258132,0.15131353,-0.32479504,0.105600774,-0.13950256,0.27332562,0.65994203,-0.780461,-0.21348491,-0.20567286,0.23244157,0.11215775,0.40510517,-0.52354896,0.06681162,-0.41453093,0.59581953,-2.140505,1.3061415,0.75075674,0.672057,-0.10104084,0.10604617,-0.1125272,-0.42605418,-0.07585393,-0.33421445,0.093503065,0.20071425,0.42282313,0.75608283,-0.15237688,-0.121898524,0.5767451,-0.09775403,0.007833563,-0.13465671,0.14342043,-0.09603147,0.28792357,0.030869912,-1.0182501,-0.090522915,0.38259473,-0.30252847,-0.07191988,0.25874224,-0.30134445,-0.30062976,0.3386175,-0.184572,-0.13463037,0.21865469,0.14952739,0.44614434,-0.5275878,0.44001737,0.48307657,-0.20029795,-0.20540681,0.009874843,0.62023115,0.29343334,-0.26610968,1.1866063,0.20866166,-0.86935693,1.194493,-0.70958436,-0.67053705,0.16449386,0.15501787,-0.2732337,0.5001677,0.40268838,0.05267391,-0.28818738,-0.25627786,0.3237739,0.20661367,-0.114382796,-0.3155887,0.036046203,0.09303906,0.045092113,-0.38759232,0.16511068,-0.2412476,0.20692427,-0.00802502,0.3642635,0.5850683,-0.76512456,0.46202484,-0.28010985,0.5700413,0.4096586,0.3902241,-0.42495793,-0.43494877,-0.30588314,0.48026097,-0.12984975,0.49075717,-0.29071864,-0.42085195,0.30260554,0.8222282,0.19941153,1.315254,0.30886918,0.17627637,-0.24155778,0.49255127,0.6639385,-0.1827571,0.02121464,0.09293347,0.13839658,0.035679504,0.73405087,-0.6335372,0.5251611,0.31011373,-0.091499746,1.8595266,0.7143397,0.5168366,0.03708881,0.507861,0.18957117,0.1983318,-1.0314994,-0.33044,-0.82924306,0.99074227,0.2815774,-0.07468645,0.74307996,0.36426264,-0.22649744,-0.05202507,-0.6921822,-0.802549,-0.31213802,-0.084367484,-0.5192693,0.41364402,-0.29686666,0.43975556,-0.17650422,-0.6930386,0.47838062,0.33172914,-0.058259707,-0.7303181,-0.099644355,0.015148858,0.5009095,-0.14864665,-0.14669248,-0.6800788,0.20073141,-0.40443534,-0.14989856,0.3386585,0.045613185,-0.7879523,-0.5424034,0.5760776,2.0714297,0.2327904,0.22501259,0.56382495,0.12127443,0.39556783,0.14754608,-0.019769825,-0.5407266,-0.3219013,-0.83585715,-0.34718287,0.026048623,-0.7465372,-0.07637849,-0.033146467,0.01799985,-0.18363564,0.2644258,0.12561584,0.59224236,0.30794838,-0.24934794,0.04864285,0.03341459,-2.4325747,0.01822721,0.2530063,-0.18837038,-0.44696414,-0.8883713,0.09524957,-0.016613895,0.104276374,-0.38413656,1.4529321,-0.11070707,-0.43041483,0.35400572,0.08043813,0.8491075,-0.1862826,0.22454764,-0.31269205,-0.97372025,-0.42027125,1.1249119,2.2466652,0.0023729801,-0.026027378,-0.16045304,-0.1841715,-0.3728962,-1.1865739,0.40547544,-0.17469762,-0.17986779,0.22225553,-0.09583995,-0.24011159,-0.623016,0.5858946,-0.058788326,-0.21884863,-0.63768953,1.4557298,0.05939327,0.680458,-0.681359,-0.2196953,-0.097733356,-0.13278785,0.22399272,-0.040767163,-0.50004923,0.57334274,0.268478,0.117074646,0.31567943,0.21000771,0.35896412,0.3529358,-0.12819107,0.7792076,1.001332,0.45549732,0.33468097,0.6633587,-0.7268323,0.1314122],"result":{"type":"object","properties":{"message":{"description":"A message indicating the result of the operation","type":"string"},"status":{"description":"The status of the email sending operation ('success' or 'failed')","type":"string"}},"required":["status","message"]},"sql_tables":[],"sql_queries":[],"file_inbox":null,"oauth":null,"assets":null,"runner":"any","operating_system":["linux","macos","windows"],"tool_set":""},false]} \ No newline at end of file diff --git a/tools/email-sender/metadata.json b/tools/email-sender/metadata.json index 8c15aa54..8b5eaaa5 100644 --- a/tools/email-sender/metadata.json +++ b/tools/email-sender/metadata.json @@ -10,7 +10,10 @@ "send", "notification" ], - "configurations": { + "runner": "any", + "operating_system": ["linux", "macos", "windows"], + "tool_set": "", + "configurations": { "type": "object", "properties": { "smtp_server": { diff --git a/tools/file-read/.tool-dump.test.json b/tools/file-read/.tool-dump.test.json index ea49c392..ba50292a 100644 --- a/tools/file-read/.tool-dump.test.json +++ b/tools/file-read/.tool-dump.test.json @@ -1 +1 @@ -{"type":"Deno","content":[{"name":"Read File Contents","homepage":null,"author":"@@official.shinkai","version":"1.0.0","js_code":"type CONFIG = {};\ntype INPUTS = { path: string };\ntype OUTPUT = { content: string };\n\nexport async function run(config: CONFIG, inputs: INPUTS): Promise {\n const { path } = inputs;\n const content = await Deno.readTextFile(path);\n return { content };\n}","tools":[],"config":[],"description":"Reads the text contents of a file from the given path.","keywords":["file","read","content","text"],"input_args":{"type":"object","properties":{"path":{"type":"string","description":"The path of the file to read."}},"required":["path"]},"output_arg":{"json":""},"activated":false,"embedding":[0.12859492,0.12596734,0.010835137,-0.15759677,0.08992459,-0.06392758,-1.4077084,0.8902618,0.32812726,-0.09717176,-0.040325865,0.93691605,0.007549899,-0.51253396,0.2567432,-0.4170107,-0.3970057,-0.58185434,-1.0538585,-0.28348687,0.15490325,0.8829895,-0.014019832,-0.17916541,0.027874865,0.046194345,-0.39674753,-0.4991902,-1.0936495,-2.2655258,0.28712308,0.3062436,-0.07864686,0.2525275,0.10321572,-0.086163834,0.26947227,-0.17715436,-0.6861206,-0.3886912,-0.05326306,0.058443986,-0.5777914,0.15437311,0.19049811,0.25289434,0.1809145,-0.9324337,1.3157676,1.1605527,-0.77865005,-0.54476464,-0.25389823,-0.7968005,-0.18135706,-0.32752505,0.47686017,-0.06893139,-0.3669963,-0.3656043,-0.24349539,-0.038294002,-3.8615422,-0.21388562,0.549955,0.23996615,0.27268782,0.010611329,0.2233977,-0.54284453,-0.38535947,0.1361036,0.2554217,0.299286,0.30582452,-0.96808624,-0.047579106,-0.008844443,0.53406525,-0.40323326,-0.4771782,1.0571189,-0.25730595,0.22049019,-0.8480378,0.62866956,-0.3508037,-0.57431704,0.35690808,0.058529556,0.41120374,-0.37303326,0.22492631,0.27541775,0.021659356,-0.32826716,-0.19713931,0.60175943,0.56584424,2.7791252,1.0450399,0.594266,0.20650783,-0.61168516,0.2008933,-0.4747657,0.024587486,-0.01762429,0.010493876,-0.62326825,0.3704437,-0.47063246,-0.14854854,0.24279964,-0.12406143,-0.30222398,-0.48557103,-0.08278459,0.63487,0.67132777,-0.99932593,-0.08010429,-0.6655833,-0.4096786,0.06130149,-0.34929386,0.55783796,0.19386198,0.19404489,-0.33255413,0.8587968,-0.2075023,-0.66796803,0.13709542,-0.060420133,0.4835882,0.3852095,-0.9448407,0.36258578,-0.66567135,-0.15313038,-1.3003845,0.69442594,0.19294913,0.38094082,0.13808331,-0.10014426,0.30711347,-0.35933435,0.12892267,0.42373046,0.15688801,-0.09071456,0.23043248,0.42913413,0.41824204,-0.18021575,0.11129397,-0.33085412,0.32014716,-0.71196103,-0.17633112,-0.19455895,0.5147253,0.32320574,0.042989697,-0.048838228,0.1935009,0.16269538,0.032192305,1.1123198,-0.84431124,-0.67001206,0.29565674,-0.4992154,-0.020182084,-0.49168688,0.3178972,-0.20264104,-0.036908656,0.15182772,0.4023808,-0.6536689,-0.15701845,-0.41465968,0.43057722,0.6848841,0.30100897,1.6196972,1.1918077,-0.37824315,2.4926894,-1.3363681,-0.59464365,0.027451769,0.08557453,0.03887879,-0.026824325,-0.10933608,-0.11641621,0.7005088,-0.011468995,0.3816275,-0.16541559,-0.20133889,-0.7128427,0.61280257,0.035759382,-0.24480699,-1.11442,0.49035117,-0.2760281,0.190466,0.5364733,0.6639886,0.25680214,-0.31205228,0.24600632,-0.10684079,0.64871716,-0.7363786,0.4419547,0.17056711,-0.36390266,-0.6615776,0.9569794,0.53285533,0.3697747,-0.3690424,-0.5845392,0.0757478,0.8685907,1.551799,0.77571744,0.7099622,0.62299573,-0.047043465,0.6500958,-0.010198675,-0.22083391,-0.090329014,-0.027690284,0.2020743,-0.34220135,-0.13239811,-0.74922097,0.34367022,0.4056856,-0.2654303,1.3016803,0.4247997,0.26406908,-0.27320027,0.31540078,0.32827455,0.12793702,-1.9450389,-0.38419828,0.075002335,0.15604155,0.1467857,-0.45322528,0.2651813,0.24101184,0.4704963,-0.21165113,-0.77044237,-0.7644199,0.06674867,0.29760006,-0.6619981,0.43155158,-0.18134195,-0.2950378,0.08561646,-0.21715693,0.4669162,0.5292284,-0.24674854,0.06567959,0.28479904,0.02634546,0.3878179,-0.45681316,-0.15824303,0.08249477,-0.085056454,-0.31129003,0.1623993,0.36038527,-0.35157487,-1.3610289,-0.7839526,0.30959064,1.7284135,-0.094772324,0.11379894,0.41203946,0.045135368,0.20834355,0.3884402,-0.104922004,-0.6168906,1.0942903,-0.048844784,-0.18529612,-0.0014815256,0.05581587,0.04074034,0.26128578,-0.84257406,-0.028878443,0.16798304,-0.14255713,0.3751877,-0.15724911,0.47445253,-0.20793211,-0.42448515,-1.8821567,-0.46138513,-0.05275587,0.19684908,-0.0017875135,-0.3411157,0.9906085,-0.6099685,-0.10422182,-0.2852644,1.0378195,0.73284316,-0.25559312,-0.38850874,-0.11635728,0.4252638,0.52667606,-0.056361556,-0.08761079,-0.22849727,0.07162489,0.5779581,1.3472354,0.24429214,0.7627983,0.8608464,0.11962003,-0.52168983,-1.3894522,-0.21532476,-0.41268677,-0.51807946,0.5023647,0.1996884,-0.17716783,-0.35021126,0.61440194,0.0011843555,0.10789876,-1.0063789,2.3573909,-0.23840012,0.39342797,-0.3351542,-0.12421349,0.1322378,-0.22049274,0.42365342,-0.29355833,-0.25301337,0.03335283,0.35332134,-0.1319727,-0.017306782,0.2564673,0.88989186,0.58354783,0.16554339,0.42174625,-0.111497805,0.37349415,0.51318854,0.077761844,-0.7079764,-0.31325018],"result":{"type":"object","properties":{"content":{"description":"The content of the file.","type":"string"}},"required":["content"]},"sql_tables":[],"sql_queries":[],"file_inbox":null,"oauth":null,"assets":null},false]} \ No newline at end of file +{"type":"Deno","content":[{"name":"Read File Contents","homepage":null,"author":"@@official.shinkai","version":"1.0.0","js_code":"type CONFIG = {};\ntype INPUTS = { path: string };\ntype OUTPUT = { content: string };\n\nexport async function run(config: CONFIG, inputs: INPUTS): Promise {\n const { path } = inputs;\n const content = await Deno.readTextFile(path);\n return { content };\n}","tools":[],"config":[],"description":"Reads the text contents of a file from the given path.","keywords":["file","read","content","text"],"input_args":{"type":"object","properties":{"path":{"type":"string","description":"The path of the file to read."}},"required":["path"]},"output_arg":{"json":""},"activated":false,"embedding":[0.12859492,0.12596734,0.010835137,-0.15759677,0.08992459,-0.06392758,-1.4077084,0.8902618,0.32812726,-0.09717176,-0.040325865,0.93691605,0.007549899,-0.51253396,0.2567432,-0.4170107,-0.3970057,-0.58185434,-1.0538585,-0.28348687,0.15490325,0.8829895,-0.014019832,-0.17916541,0.027874865,0.046194345,-0.39674753,-0.4991902,-1.0936495,-2.2655258,0.28712308,0.3062436,-0.07864686,0.2525275,0.10321572,-0.086163834,0.26947227,-0.17715436,-0.6861206,-0.3886912,-0.05326306,0.058443986,-0.5777914,0.15437311,0.19049811,0.25289434,0.1809145,-0.9324337,1.3157676,1.1605527,-0.77865005,-0.54476464,-0.25389823,-0.7968005,-0.18135706,-0.32752505,0.47686017,-0.06893139,-0.3669963,-0.3656043,-0.24349539,-0.038294002,-3.8615422,-0.21388562,0.549955,0.23996615,0.27268782,0.010611329,0.2233977,-0.54284453,-0.38535947,0.1361036,0.2554217,0.299286,0.30582452,-0.96808624,-0.047579106,-0.008844443,0.53406525,-0.40323326,-0.4771782,1.0571189,-0.25730595,0.22049019,-0.8480378,0.62866956,-0.3508037,-0.57431704,0.35690808,0.058529556,0.41120374,-0.37303326,0.22492631,0.27541775,0.021659356,-0.32826716,-0.19713931,0.60175943,0.56584424,2.7791252,1.0450399,0.594266,0.20650783,-0.61168516,0.2008933,-0.4747657,0.024587486,-0.01762429,0.010493876,-0.62326825,0.3704437,-0.47063246,-0.14854854,0.24279964,-0.12406143,-0.30222398,-0.48557103,-0.08278459,0.63487,0.67132777,-0.99932593,-0.08010429,-0.6655833,-0.4096786,0.06130149,-0.34929386,0.55783796,0.19386198,0.19404489,-0.33255413,0.8587968,-0.2075023,-0.66796803,0.13709542,-0.060420133,0.4835882,0.3852095,-0.9448407,0.36258578,-0.66567135,-0.15313038,-1.3003845,0.69442594,0.19294913,0.38094082,0.13808331,-0.10014426,0.30711347,-0.35933435,0.12892267,0.42373046,0.15688801,-0.09071456,0.23043248,0.42913413,0.41824204,-0.18021575,0.11129397,-0.33085412,0.32014716,-0.71196103,-0.17633112,-0.19455895,0.5147253,0.32320574,0.042989697,-0.048838228,0.1935009,0.16269538,0.032192305,1.1123198,-0.84431124,-0.67001206,0.29565674,-0.4992154,-0.020182084,-0.49168688,0.3178972,-0.20264104,-0.036908656,0.15182772,0.4023808,-0.6536689,-0.15701845,-0.41465968,0.43057722,0.6848841,0.30100897,1.6196972,1.1918077,-0.37824315,2.4926894,-1.3363681,-0.59464365,0.027451769,0.08557453,0.03887879,-0.026824325,-0.10933608,-0.11641621,0.7005088,-0.011468995,0.3816275,-0.16541559,-0.20133889,-0.7128427,0.61280257,0.035759382,-0.24480699,-1.11442,0.49035117,-0.2760281,0.190466,0.5364733,0.6639886,0.25680214,-0.31205228,0.24600632,-0.10684079,0.64871716,-0.7363786,0.4419547,0.17056711,-0.36390266,-0.6615776,0.9569794,0.53285533,0.3697747,-0.3690424,-0.5845392,0.0757478,0.8685907,1.551799,0.77571744,0.7099622,0.62299573,-0.047043465,0.6500958,-0.010198675,-0.22083391,-0.090329014,-0.027690284,0.2020743,-0.34220135,-0.13239811,-0.74922097,0.34367022,0.4056856,-0.2654303,1.3016803,0.4247997,0.26406908,-0.27320027,0.31540078,0.32827455,0.12793702,-1.9450389,-0.38419828,0.075002335,0.15604155,0.1467857,-0.45322528,0.2651813,0.24101184,0.4704963,-0.21165113,-0.77044237,-0.7644199,0.06674867,0.29760006,-0.6619981,0.43155158,-0.18134195,-0.2950378,0.08561646,-0.21715693,0.4669162,0.5292284,-0.24674854,0.06567959,0.28479904,0.02634546,0.3878179,-0.45681316,-0.15824303,0.08249477,-0.085056454,-0.31129003,0.1623993,0.36038527,-0.35157487,-1.3610289,-0.7839526,0.30959064,1.7284135,-0.094772324,0.11379894,0.41203946,0.045135368,0.20834355,0.3884402,-0.104922004,-0.6168906,1.0942903,-0.048844784,-0.18529612,-0.0014815256,0.05581587,0.04074034,0.26128578,-0.84257406,-0.028878443,0.16798304,-0.14255713,0.3751877,-0.15724911,0.47445253,-0.20793211,-0.42448515,-1.8821567,-0.46138513,-0.05275587,0.19684908,-0.0017875135,-0.3411157,0.9906085,-0.6099685,-0.10422182,-0.2852644,1.0378195,0.73284316,-0.25559312,-0.38850874,-0.11635728,0.4252638,0.52667606,-0.056361556,-0.08761079,-0.22849727,0.07162489,0.5779581,1.3472354,0.24429214,0.7627983,0.8608464,0.11962003,-0.52168983,-1.3894522,-0.21532476,-0.41268677,-0.51807946,0.5023647,0.1996884,-0.17716783,-0.35021126,0.61440194,0.0011843555,0.10789876,-1.0063789,2.3573909,-0.23840012,0.39342797,-0.3351542,-0.12421349,0.1322378,-0.22049274,0.42365342,-0.29355833,-0.25301337,0.03335283,0.35332134,-0.1319727,-0.017306782,0.2564673,0.88989186,0.58354783,0.16554339,0.42174625,-0.111497805,0.37349415,0.51318854,0.077761844,-0.7079764,-0.31325018],"result":{"type":"object","properties":{"content":{"description":"The content of the file.","type":"string"}},"required":["content"]},"sql_tables":[],"sql_queries":[],"file_inbox":null,"oauth":null,"assets":null,"runner":"any","operating_system":["linux","macos","windows"],"tool_set":""},false]} \ No newline at end of file diff --git a/tools/file-read/metadata.json b/tools/file-read/metadata.json index db8e6800..989a227b 100644 --- a/tools/file-read/metadata.json +++ b/tools/file-read/metadata.json @@ -10,7 +10,10 @@ "content", "text" ], - "configurations": { + "runner": "any", + "operating_system": ["linux", "macos", "windows"], + "tool_set": "", + "configurations": { "type": "object", "properties": {}, "required": [] diff --git a/tools/file-update/.tool-dump.test.json b/tools/file-update/.tool-dump.test.json index a0c64750..7fa45c8a 100644 --- a/tools/file-update/.tool-dump.test.json +++ b/tools/file-update/.tool-dump.test.json @@ -1 +1 @@ -{"type":"Deno","content":[{"name":"Update File with Prompt","homepage":null,"author":"@@official.shinkai","version":"1.0.0","js_code":"import { shinkaiLlmPromptProcessor } from './shinkai-local-tools.ts';\n\ntype CONFIG = {};\ntype INPUTS = { path: string, prompt: string };\ntype OUTPUT = { new_file_content: string, message: string };\n\nexport async function run(config: CONFIG, inputs: INPUTS): Promise {\n const file_content = await Deno.readTextFile(inputs.path);\n const prompt = `\n<${inputs.path}>\n${file_content}\n\n\n\n * Only respond with the new file content, from the start of the file to the end.\n * Do not include any other text or comments.\n * Apply the following instructions in the tag to \"${inputs.path}\"\n\n\n\n ${inputs.prompt}\n \n`;\n const update = await shinkaiLlmPromptProcessor({ prompt });\n await Deno.writeTextFile(inputs.path, update.message);\n\n return { \n new_file_content: update.message, \n message: \"File updated\"\n }; \n}","tools":["local:::__official_shinkai:::shinkai_llm_prompt_processor"],"config":[],"description":"Applies a prompt to the file contents.","keywords":["file","update","prompt","text"],"input_args":{"type":"object","properties":{"prompt":{"type":"string","description":"The prompt to apply to the file contents."},"path":{"type":"string","description":"The path of the file to update."}},"required":["path","prompt"]},"output_arg":{"json":""},"activated":false,"embedding":[-0.039903395,0.1478697,-0.37138444,-0.2536462,0.42034775,0.19308072,-0.73079115,0.79844755,0.5390755,-0.2896065,-0.162473,0.70904064,-0.32502642,-0.18482137,-0.09624794,-0.2651251,-0.609646,-0.81935316,-0.88271856,-0.01937908,-0.10085076,0.55340976,0.37698966,0.39858586,0.53191835,0.6502075,0.09632544,0.211497,-1.5360123,-2.6435096,0.19663453,0.44426164,0.23009388,0.0703166,0.9099579,-0.48099,-0.036563464,0.00794445,-0.46558335,-0.39092416,0.610461,0.19468907,0.038887687,-0.3964421,-0.10741798,-0.14740476,0.40959883,-0.53380513,1.2657025,0.2965763,-0.9813956,-0.43001893,-0.54247403,-0.007885814,0.09385339,-0.0095655285,-0.022299696,-0.16926739,-0.43881342,0.21310613,-0.5904309,0.44975644,-3.9330294,0.003366638,0.2304686,0.41677976,-0.40793145,0.24047405,0.2959547,-0.55440354,-0.59958905,0.31358656,-0.42083263,0.5289503,0.15836212,-1.471573,-0.09732093,-0.021677233,0.3981617,-0.58984214,-0.06760834,0.75852627,-0.30363005,-0.4435111,-0.82126266,0.62332565,-0.19124517,0.17386177,0.24707484,0.16973849,0.2766788,0.36825925,0.68306947,0.034848794,0.20050102,-0.08022639,0.28803945,-0.08378753,0.15303749,2.8060524,0.46759516,0.47084996,0.59963673,-0.14851823,0.3826089,-0.14490002,-0.30825695,-0.49160218,-0.26169422,-0.5537072,0.29882553,-0.41973025,-0.33127865,-0.08648269,0.64579785,-0.38195258,-1.1662104,0.14285554,-0.08915171,1.1903292,-0.2657309,-0.29888767,-0.8791976,-0.052203894,-0.24990591,0.25232184,0.39312047,0.112233624,0.20348947,-0.12953644,0.53399,-0.04749395,-0.5620714,-0.7673449,0.35613254,0.6470855,0.6655971,-0.33039773,0.49075794,-1.0007432,0.07129872,-0.8365802,0.83558166,-0.24609178,0.30504823,-0.2184625,-0.7150377,-0.03675293,-0.4239329,-0.83338344,-0.30540553,0.31882566,0.44099975,-0.033006478,0.44189107,0.1351082,-0.017860558,0.4303109,-0.4026429,0.46499673,0.23424427,0.021554373,0.24941018,0.6592791,0.53289306,-0.52218735,0.06256876,0.011257041,-0.42429513,-0.0031392332,0.02167125,-0.6984439,-0.039923962,0.14456223,-0.4790928,0.38158292,-0.09277673,0.1220977,0.50893325,-0.43329892,0.052438244,0.4842253,-1.397022,-0.4553201,-0.10356268,0.3240641,0.067737706,0.18493679,0.5851721,1.0497124,-1.0224062,1.8358845,-1.4865811,-0.4442987,-0.2588486,0.46076733,-0.052975863,0.39531308,-0.42411664,0.19004482,0.28026456,0.05875508,0.47741306,-0.038415417,-0.32223785,-0.7042106,0.5208464,0.8885053,-0.40057737,-0.3352108,-0.03342961,-0.07285142,0.759855,0.27799243,1.1157476,0.15175332,-0.13291155,0.29058608,-0.16938427,0.8717817,-0.41137427,0.8388778,-0.47184545,-0.2556157,-0.5926424,0.2109636,-0.10387155,-0.029345576,-0.2337321,-0.36045682,0.6727238,1.0322102,0.85615,0.4178601,0.060016125,0.4152884,-0.18892214,0.48241818,0.20748389,-0.42650983,-0.42875284,-0.1383827,0.416398,-0.26945934,0.26700795,-0.8047602,-0.045017943,0.038441703,-0.15906563,1.1843193,0.6012529,0.088855594,0.55948305,-0.2843043,0.06701256,-0.0033614188,-1.5874362,-0.48762953,-0.26017806,0.096587494,0.22007397,-0.31763422,0.28027433,0.393404,0.09217901,-0.6059741,-0.4499374,-0.041973565,0.34829432,0.3226861,0.01581041,0.20072733,0.047392674,-0.26573905,-0.23842724,-0.06447384,0.51573956,0.5406328,-0.31117725,-0.45689532,-0.41448826,-0.2663731,-0.49987212,-0.44064802,-0.19571939,-0.51080966,-0.27360648,-0.19680703,0.00872729,0.8080794,-0.19187385,-0.49985233,-0.64229125,0.50071347,2.379929,0.045338828,0.6211416,0.85915077,-0.3084452,0.05690112,0.42632666,0.10319888,-0.34689292,0.5453186,-0.5494945,-0.029376745,-0.27340746,-0.105934694,0.118975565,0.64662135,0.14513269,-0.08858763,-0.5285297,-0.2954827,0.5633896,-0.47422564,0.49663198,0.5022613,-0.036011487,-1.8981999,-0.7474049,-0.14800891,-0.23608637,0.03129068,-0.28215757,0.5260432,0.44269934,0.8593093,0.0017987639,1.2411449,0.61670935,-0.5042192,-0.27931187,-0.09320265,0.6017174,-0.17417188,-0.021029899,-0.063922755,0.08209244,-0.19690697,1.0260704,1.8778706,0.28716427,0.5454953,0.22317907,0.50895196,-0.21493927,-1.5025272,-0.199907,0.17876531,-0.73794264,0.6096667,-0.11621555,-0.4040492,-0.15010911,0.5291127,0.43814874,-0.14281955,-0.5761751,1.7517116,-0.037796408,-0.5165784,-0.2904388,0.28494275,0.40139303,-0.2760628,0.3002559,-0.3823212,-0.9122817,-0.284226,0.08467552,-0.14658695,-0.17697525,0.40925556,0.39127195,0.8325679,0.11660272,0.49203834,0.35033125,0.31263828,0.20281029,0.52836424,-0.66714835,-0.07887113],"result":{"type":"object","properties":{"message":{"description":"The message returned from the tool.","type":"string"},"new_file_content":{"description":"The path of the file that was updated.","type":"string"}},"required":["message"]},"sql_tables":[],"sql_queries":[],"file_inbox":null,"oauth":null,"assets":null},false]} \ No newline at end of file +{"type":"Deno","content":[{"name":"Update File with Prompt","homepage":null,"author":"@@official.shinkai","version":"1.0.0","js_code":"import { shinkaiLlmPromptProcessor } from './shinkai-local-tools.ts';\n\ntype CONFIG = {};\ntype INPUTS = { path: string, prompt: string };\ntype OUTPUT = { new_file_content: string, message: string };\n\nexport async function run(config: CONFIG, inputs: INPUTS): Promise {\n const file_content = await Deno.readTextFile(inputs.path);\n const prompt = `\n<${inputs.path}>\n${file_content}\n\n\n\n * Only respond with the new file content, from the start of the file to the end.\n * Do not include any other text or comments.\n * Apply the following instructions in the tag to \"${inputs.path}\"\n\n\n\n ${inputs.prompt}\n \n`;\n const update = await shinkaiLlmPromptProcessor({ prompt });\n await Deno.writeTextFile(inputs.path, update.message);\n\n return { \n new_file_content: update.message, \n message: \"File updated\"\n }; \n}","tools":["local:::__official_shinkai:::shinkai_llm_prompt_processor"],"config":[],"description":"Applies a prompt to the file contents.","keywords":["file","update","prompt","text"],"input_args":{"type":"object","properties":{"prompt":{"type":"string","description":"The prompt to apply to the file contents."},"path":{"type":"string","description":"The path of the file to update."}},"required":["path","prompt"]},"output_arg":{"json":""},"activated":false,"embedding":[-0.039903395,0.1478697,-0.37138444,-0.2536462,0.42034775,0.19308072,-0.73079115,0.79844755,0.5390755,-0.2896065,-0.162473,0.70904064,-0.32502642,-0.18482137,-0.09624794,-0.2651251,-0.609646,-0.81935316,-0.88271856,-0.01937908,-0.10085076,0.55340976,0.37698966,0.39858586,0.53191835,0.6502075,0.09632544,0.211497,-1.5360123,-2.6435096,0.19663453,0.44426164,0.23009388,0.0703166,0.9099579,-0.48099,-0.036563464,0.00794445,-0.46558335,-0.39092416,0.610461,0.19468907,0.038887687,-0.3964421,-0.10741798,-0.14740476,0.40959883,-0.53380513,1.2657025,0.2965763,-0.9813956,-0.43001893,-0.54247403,-0.007885814,0.09385339,-0.0095655285,-0.022299696,-0.16926739,-0.43881342,0.21310613,-0.5904309,0.44975644,-3.9330294,0.003366638,0.2304686,0.41677976,-0.40793145,0.24047405,0.2959547,-0.55440354,-0.59958905,0.31358656,-0.42083263,0.5289503,0.15836212,-1.471573,-0.09732093,-0.021677233,0.3981617,-0.58984214,-0.06760834,0.75852627,-0.30363005,-0.4435111,-0.82126266,0.62332565,-0.19124517,0.17386177,0.24707484,0.16973849,0.2766788,0.36825925,0.68306947,0.034848794,0.20050102,-0.08022639,0.28803945,-0.08378753,0.15303749,2.8060524,0.46759516,0.47084996,0.59963673,-0.14851823,0.3826089,-0.14490002,-0.30825695,-0.49160218,-0.26169422,-0.5537072,0.29882553,-0.41973025,-0.33127865,-0.08648269,0.64579785,-0.38195258,-1.1662104,0.14285554,-0.08915171,1.1903292,-0.2657309,-0.29888767,-0.8791976,-0.052203894,-0.24990591,0.25232184,0.39312047,0.112233624,0.20348947,-0.12953644,0.53399,-0.04749395,-0.5620714,-0.7673449,0.35613254,0.6470855,0.6655971,-0.33039773,0.49075794,-1.0007432,0.07129872,-0.8365802,0.83558166,-0.24609178,0.30504823,-0.2184625,-0.7150377,-0.03675293,-0.4239329,-0.83338344,-0.30540553,0.31882566,0.44099975,-0.033006478,0.44189107,0.1351082,-0.017860558,0.4303109,-0.4026429,0.46499673,0.23424427,0.021554373,0.24941018,0.6592791,0.53289306,-0.52218735,0.06256876,0.011257041,-0.42429513,-0.0031392332,0.02167125,-0.6984439,-0.039923962,0.14456223,-0.4790928,0.38158292,-0.09277673,0.1220977,0.50893325,-0.43329892,0.052438244,0.4842253,-1.397022,-0.4553201,-0.10356268,0.3240641,0.067737706,0.18493679,0.5851721,1.0497124,-1.0224062,1.8358845,-1.4865811,-0.4442987,-0.2588486,0.46076733,-0.052975863,0.39531308,-0.42411664,0.19004482,0.28026456,0.05875508,0.47741306,-0.038415417,-0.32223785,-0.7042106,0.5208464,0.8885053,-0.40057737,-0.3352108,-0.03342961,-0.07285142,0.759855,0.27799243,1.1157476,0.15175332,-0.13291155,0.29058608,-0.16938427,0.8717817,-0.41137427,0.8388778,-0.47184545,-0.2556157,-0.5926424,0.2109636,-0.10387155,-0.029345576,-0.2337321,-0.36045682,0.6727238,1.0322102,0.85615,0.4178601,0.060016125,0.4152884,-0.18892214,0.48241818,0.20748389,-0.42650983,-0.42875284,-0.1383827,0.416398,-0.26945934,0.26700795,-0.8047602,-0.045017943,0.038441703,-0.15906563,1.1843193,0.6012529,0.088855594,0.55948305,-0.2843043,0.06701256,-0.0033614188,-1.5874362,-0.48762953,-0.26017806,0.096587494,0.22007397,-0.31763422,0.28027433,0.393404,0.09217901,-0.6059741,-0.4499374,-0.041973565,0.34829432,0.3226861,0.01581041,0.20072733,0.047392674,-0.26573905,-0.23842724,-0.06447384,0.51573956,0.5406328,-0.31117725,-0.45689532,-0.41448826,-0.2663731,-0.49987212,-0.44064802,-0.19571939,-0.51080966,-0.27360648,-0.19680703,0.00872729,0.8080794,-0.19187385,-0.49985233,-0.64229125,0.50071347,2.379929,0.045338828,0.6211416,0.85915077,-0.3084452,0.05690112,0.42632666,0.10319888,-0.34689292,0.5453186,-0.5494945,-0.029376745,-0.27340746,-0.105934694,0.118975565,0.64662135,0.14513269,-0.08858763,-0.5285297,-0.2954827,0.5633896,-0.47422564,0.49663198,0.5022613,-0.036011487,-1.8981999,-0.7474049,-0.14800891,-0.23608637,0.03129068,-0.28215757,0.5260432,0.44269934,0.8593093,0.0017987639,1.2411449,0.61670935,-0.5042192,-0.27931187,-0.09320265,0.6017174,-0.17417188,-0.021029899,-0.063922755,0.08209244,-0.19690697,1.0260704,1.8778706,0.28716427,0.5454953,0.22317907,0.50895196,-0.21493927,-1.5025272,-0.199907,0.17876531,-0.73794264,0.6096667,-0.11621555,-0.4040492,-0.15010911,0.5291127,0.43814874,-0.14281955,-0.5761751,1.7517116,-0.037796408,-0.5165784,-0.2904388,0.28494275,0.40139303,-0.2760628,0.3002559,-0.3823212,-0.9122817,-0.284226,0.08467552,-0.14658695,-0.17697525,0.40925556,0.39127195,0.8325679,0.11660272,0.49203834,0.35033125,0.31263828,0.20281029,0.52836424,-0.66714835,-0.07887113],"result":{"type":"object","properties":{"message":{"description":"The message returned from the tool.","type":"string"},"new_file_content":{"description":"The path of the file that was updated.","type":"string"}},"required":["message"]},"sql_tables":[],"sql_queries":[],"file_inbox":null,"oauth":null,"assets":null,"runner":"any","operating_system":["linux","macos","windows"],"tool_set":""},false]} \ No newline at end of file diff --git a/tools/file-update/metadata.json b/tools/file-update/metadata.json index 81fe2e47..83930f9b 100644 --- a/tools/file-update/metadata.json +++ b/tools/file-update/metadata.json @@ -10,7 +10,10 @@ "prompt", "text" ], - "configurations": { + "runner": "any", + "operating_system": ["linux", "macos", "windows"], + "tool_set": "", + "configurations": { "type": "object", "properties": {}, "required": [] diff --git a/tools/file-write/.tool-dump.test.json b/tools/file-write/.tool-dump.test.json index 48b8ed86..d8a7ddac 100644 --- a/tools/file-write/.tool-dump.test.json +++ b/tools/file-write/.tool-dump.test.json @@ -1 +1 @@ -{"type":"Deno","content":[{"name":"Write File Contents","homepage":null,"author":"@@official.shinkai","version":"1.0.0","js_code":"\ntype CONFIG = {};\ntype INPUTS = { path: string, content: string };\ntype OUTPUT = { message: string };\n\nexport async function run(config: CONFIG, inputs: INPUTS): Promise {\n try {\n await Deno.writeTextFile(inputs.path, inputs.content);\n return {\n message: \"File written\"\n }; \n } catch (error) {\n return {\n message: \"Failed to write file \" + error.message,\n }; \n }\n}","tools":[],"config":[],"description":"Writes the text contents of a file to the given path.","keywords":["file","write","save","content","text"],"input_args":{"type":"object","properties":{"path":{"type":"string","description":"The path of the file to write to."},"content":{"type":"string","description":"The content to write to the file."}},"required":["path","content"]},"output_arg":{"json":""},"activated":false,"embedding":[-0.014549136,0.3306045,0.010623809,0.34710795,0.17257398,0.06644237,-1.4433259,0.79340667,0.3200154,0.14200212,-0.013457694,1.1742105,-0.05998533,-0.27217516,0.30608752,-0.53545934,-1.1113505,-0.4852112,-1.28673,-0.52062255,-0.045713667,1.0082848,0.1051455,-0.280425,0.4606821,0.040276006,0.4114635,-0.24108294,-1.0731835,-2.4765906,0.08310933,0.45401487,-0.21076798,-0.006898947,0.45140323,-0.095220305,0.21838978,0.029122759,-0.42895025,-0.44942367,0.06679413,-0.24396394,-0.2146438,-0.19280109,-0.10422532,0.48197737,0.13546635,-0.6760576,1.1726547,0.8601404,-0.66012675,-0.29620454,-0.8183398,-0.72856545,-0.24246916,-0.27076128,0.03431056,-0.031293496,-0.15109776,-0.017892722,-0.20798804,0.39865324,-3.9953966,0.0006713234,0.7178922,0.18328021,0.33092046,0.3336682,-0.26151973,-0.32545686,-0.49092036,0.40152624,-0.052238654,0.87046874,0.54039514,-1.1568112,-0.0207678,-0.18181716,0.57120806,-0.69160694,-0.17649092,0.9864096,-0.22806545,0.5767491,-0.8603246,0.6574369,0.014650822,-0.10360512,0.3105017,-0.2222869,-0.06558968,-0.42926064,0.20834538,0.011756942,-0.22573015,-0.13948719,-0.38368568,0.5166678,0.7128568,2.7727962,0.7776012,0.22696115,0.46952018,-0.8915465,-0.033291057,-0.45063156,-0.35056576,0.042245828,-0.4374227,-0.89509064,0.3355586,-0.24818873,0.039706945,-0.32526097,0.5800467,0.08923647,-0.52462393,0.10765308,0.23816544,0.7645004,-0.78018534,-0.070886716,-0.8608689,-0.08300616,-0.22955745,0.19226775,0.5603884,0.16824265,0.25708127,-0.33594754,0.51311,-0.33226657,-0.15299347,0.34936494,-0.2556605,0.6391561,0.13773233,-0.92406696,0.54077995,-0.22816184,0.8931076,-1.1649122,0.99441516,0.37736514,0.5239982,-0.038703598,-0.5050386,-0.110050656,-0.6058962,-0.21717086,-0.16982521,0.28685325,-0.28068703,0.118647784,0.704295,-0.10715413,-0.09661652,0.3075416,-0.35882607,0.2968553,-0.3788554,-0.1638914,-0.07119171,0.75048673,0.18922323,-0.092549145,-0.08562735,-0.10826003,-0.14149918,0.023589768,0.6068331,-0.9169399,-0.449064,0.22993019,-0.7784011,0.14004722,-0.19789673,0.4141601,0.07210271,0.43419883,0.58937657,0.30005506,-0.5529813,-0.4282561,0.057661355,-0.018719653,0.40104038,0.27569667,1.1413771,1.1122822,-0.8609533,2.174323,-1.3083888,-0.16884467,0.12011647,0.28775114,0.14208685,-0.04532428,-0.17684196,-0.5879013,0.8283146,0.13116159,0.05748804,0.12706596,0.23129657,-0.80002236,0.026521016,0.5577789,-0.19492598,-0.78969574,0.58088875,-0.71387744,0.5685177,0.66645646,1.0259598,0.06320852,-0.5522171,0.66180646,0.26632988,0.20901069,-0.45640618,0.43380922,0.27643025,-0.40231875,-0.5272685,0.58058095,0.55033726,0.3938542,-0.10604507,-0.92763895,0.572325,1.0389303,1.3557471,0.7059471,0.6976317,0.22795168,0.21427763,0.49157652,-0.21424726,-0.51271,0.036108606,0.17231429,0.384692,-0.46531135,-0.5072291,-0.8673363,0.27809343,0.4017111,-0.08000428,1.6100259,0.21671647,0.40271592,-0.22550207,-0.081755266,0.45057532,0.55846816,-2.002303,-0.27432284,-0.6414228,0.28061464,0.3093992,-0.107880086,0.21025568,0.2429951,0.14653276,-0.6666288,-0.35030785,-0.6874968,-0.061106198,-0.013156585,-0.7392308,0.112501286,-0.02235203,0.107314825,0.29493564,-0.26220566,0.35689977,0.33182338,0.050738946,0.0029906612,0.23711354,-0.20861107,0.29840007,-0.34016418,-0.34782887,-0.2183025,0.10393673,-0.4915806,0.59145266,0.3148432,0.0968147,-1.1266612,-0.7889908,0.618552,2.0173414,0.4167422,0.4806697,0.044930957,0.05904943,-0.32249916,0.29608616,0.05759141,-0.31402722,0.74100035,-0.2828127,-0.3926125,-0.3492974,-0.25274813,0.21653771,0.40253896,-0.1648409,-0.03159745,0.035394523,-0.26036087,0.1953007,0.2856652,0.2797497,-0.22072849,-0.44991183,-1.522079,-0.008879771,-0.21769571,-0.01930108,0.008666411,-0.24933182,1.0830514,0.09082381,0.2020956,-0.056170292,0.6714194,0.566682,-0.69803435,-0.29342037,0.11870221,0.36008102,0.058972415,0.15174335,-0.18342644,-0.056950834,-0.56210285,0.69107586,1.0892509,-0.05280915,0.43005684,0.67724687,0.013258614,-0.4174863,-1.4324603,0.043559954,-0.69770515,-0.84633875,0.173196,-0.041902635,-0.08934089,-0.38253176,0.33225664,-0.08871407,0.06342561,-1.1730163,2.3047776,-0.30448312,0.43343067,0.11150242,-0.056016203,0.009526557,-0.3027591,0.5032218,-0.58914036,-0.28574032,-0.30649444,0.49732503,0.0952326,-0.005971417,0.39200407,0.9712191,0.05951012,-0.07585195,0.43632075,0.045046944,0.4728228,0.3124175,0.01903171,-0.64349025,-0.45729995],"result":{"type":"object","properties":{"message":{"description":"The message returned from the operation.","type":"string"}},"required":["message"]},"sql_tables":[],"sql_queries":[],"file_inbox":null,"oauth":null,"assets":null},false]} \ No newline at end of file +{"type":"Deno","content":[{"name":"Write File Contents","homepage":null,"author":"@@official.shinkai","version":"1.0.0","js_code":"\ntype CONFIG = {};\ntype INPUTS = { path: string, content: string };\ntype OUTPUT = { message: string };\n\nexport async function run(config: CONFIG, inputs: INPUTS): Promise {\n try {\n await Deno.writeTextFile(inputs.path, inputs.content);\n return {\n message: \"File written\"\n }; \n } catch (error) {\n return {\n message: \"Failed to write file \" + error.message,\n }; \n }\n}","tools":[],"config":[],"description":"Writes the text contents of a file to the given path.","keywords":["file","write","save","content","text"],"input_args":{"type":"object","properties":{"path":{"type":"string","description":"The path of the file to write to."},"content":{"type":"string","description":"The content to write to the file."}},"required":["path","content"]},"output_arg":{"json":""},"activated":false,"embedding":[-0.014549136,0.3306045,0.010623809,0.34710795,0.17257398,0.06644237,-1.4433259,0.79340667,0.3200154,0.14200212,-0.013457694,1.1742105,-0.05998533,-0.27217516,0.30608752,-0.53545934,-1.1113505,-0.4852112,-1.28673,-0.52062255,-0.045713667,1.0082848,0.1051455,-0.280425,0.4606821,0.040276006,0.4114635,-0.24108294,-1.0731835,-2.4765906,0.08310933,0.45401487,-0.21076798,-0.006898947,0.45140323,-0.095220305,0.21838978,0.029122759,-0.42895025,-0.44942367,0.06679413,-0.24396394,-0.2146438,-0.19280109,-0.10422532,0.48197737,0.13546635,-0.6760576,1.1726547,0.8601404,-0.66012675,-0.29620454,-0.8183398,-0.72856545,-0.24246916,-0.27076128,0.03431056,-0.031293496,-0.15109776,-0.017892722,-0.20798804,0.39865324,-3.9953966,0.0006713234,0.7178922,0.18328021,0.33092046,0.3336682,-0.26151973,-0.32545686,-0.49092036,0.40152624,-0.052238654,0.87046874,0.54039514,-1.1568112,-0.0207678,-0.18181716,0.57120806,-0.69160694,-0.17649092,0.9864096,-0.22806545,0.5767491,-0.8603246,0.6574369,0.014650822,-0.10360512,0.3105017,-0.2222869,-0.06558968,-0.42926064,0.20834538,0.011756942,-0.22573015,-0.13948719,-0.38368568,0.5166678,0.7128568,2.7727962,0.7776012,0.22696115,0.46952018,-0.8915465,-0.033291057,-0.45063156,-0.35056576,0.042245828,-0.4374227,-0.89509064,0.3355586,-0.24818873,0.039706945,-0.32526097,0.5800467,0.08923647,-0.52462393,0.10765308,0.23816544,0.7645004,-0.78018534,-0.070886716,-0.8608689,-0.08300616,-0.22955745,0.19226775,0.5603884,0.16824265,0.25708127,-0.33594754,0.51311,-0.33226657,-0.15299347,0.34936494,-0.2556605,0.6391561,0.13773233,-0.92406696,0.54077995,-0.22816184,0.8931076,-1.1649122,0.99441516,0.37736514,0.5239982,-0.038703598,-0.5050386,-0.110050656,-0.6058962,-0.21717086,-0.16982521,0.28685325,-0.28068703,0.118647784,0.704295,-0.10715413,-0.09661652,0.3075416,-0.35882607,0.2968553,-0.3788554,-0.1638914,-0.07119171,0.75048673,0.18922323,-0.092549145,-0.08562735,-0.10826003,-0.14149918,0.023589768,0.6068331,-0.9169399,-0.449064,0.22993019,-0.7784011,0.14004722,-0.19789673,0.4141601,0.07210271,0.43419883,0.58937657,0.30005506,-0.5529813,-0.4282561,0.057661355,-0.018719653,0.40104038,0.27569667,1.1413771,1.1122822,-0.8609533,2.174323,-1.3083888,-0.16884467,0.12011647,0.28775114,0.14208685,-0.04532428,-0.17684196,-0.5879013,0.8283146,0.13116159,0.05748804,0.12706596,0.23129657,-0.80002236,0.026521016,0.5577789,-0.19492598,-0.78969574,0.58088875,-0.71387744,0.5685177,0.66645646,1.0259598,0.06320852,-0.5522171,0.66180646,0.26632988,0.20901069,-0.45640618,0.43380922,0.27643025,-0.40231875,-0.5272685,0.58058095,0.55033726,0.3938542,-0.10604507,-0.92763895,0.572325,1.0389303,1.3557471,0.7059471,0.6976317,0.22795168,0.21427763,0.49157652,-0.21424726,-0.51271,0.036108606,0.17231429,0.384692,-0.46531135,-0.5072291,-0.8673363,0.27809343,0.4017111,-0.08000428,1.6100259,0.21671647,0.40271592,-0.22550207,-0.081755266,0.45057532,0.55846816,-2.002303,-0.27432284,-0.6414228,0.28061464,0.3093992,-0.107880086,0.21025568,0.2429951,0.14653276,-0.6666288,-0.35030785,-0.6874968,-0.061106198,-0.013156585,-0.7392308,0.112501286,-0.02235203,0.107314825,0.29493564,-0.26220566,0.35689977,0.33182338,0.050738946,0.0029906612,0.23711354,-0.20861107,0.29840007,-0.34016418,-0.34782887,-0.2183025,0.10393673,-0.4915806,0.59145266,0.3148432,0.0968147,-1.1266612,-0.7889908,0.618552,2.0173414,0.4167422,0.4806697,0.044930957,0.05904943,-0.32249916,0.29608616,0.05759141,-0.31402722,0.74100035,-0.2828127,-0.3926125,-0.3492974,-0.25274813,0.21653771,0.40253896,-0.1648409,-0.03159745,0.035394523,-0.26036087,0.1953007,0.2856652,0.2797497,-0.22072849,-0.44991183,-1.522079,-0.008879771,-0.21769571,-0.01930108,0.008666411,-0.24933182,1.0830514,0.09082381,0.2020956,-0.056170292,0.6714194,0.566682,-0.69803435,-0.29342037,0.11870221,0.36008102,0.058972415,0.15174335,-0.18342644,-0.056950834,-0.56210285,0.69107586,1.0892509,-0.05280915,0.43005684,0.67724687,0.013258614,-0.4174863,-1.4324603,0.043559954,-0.69770515,-0.84633875,0.173196,-0.041902635,-0.08934089,-0.38253176,0.33225664,-0.08871407,0.06342561,-1.1730163,2.3047776,-0.30448312,0.43343067,0.11150242,-0.056016203,0.009526557,-0.3027591,0.5032218,-0.58914036,-0.28574032,-0.30649444,0.49732503,0.0952326,-0.005971417,0.39200407,0.9712191,0.05951012,-0.07585195,0.43632075,0.045046944,0.4728228,0.3124175,0.01903171,-0.64349025,-0.45729995],"result":{"type":"object","properties":{"message":{"description":"The message returned from the operation.","type":"string"}},"required":["message"]},"sql_tables":[],"sql_queries":[],"file_inbox":null,"oauth":null,"assets":null,"runner":"any","operating_system":["linux","macos","windows"],"tool_set":""},false]} \ No newline at end of file diff --git a/tools/file-write/metadata.json b/tools/file-write/metadata.json index 039d4395..ca29e409 100644 --- a/tools/file-write/metadata.json +++ b/tools/file-write/metadata.json @@ -11,7 +11,10 @@ "content", "text" ], - "configurations": { + "runner": "any", + "operating_system": ["linux", "macos", "windows"], + "tool_set": "", + "configurations": { "type": "object", "properties": {}, "required": [] diff --git a/tools/game-crypto-2048/.tool-dump.test.json b/tools/game-crypto-2048/.tool-dump.test.json new file mode 100644 index 00000000..138ded9c --- /dev/null +++ b/tools/game-crypto-2048/.tool-dump.test.json @@ -0,0 +1 @@ +{"type":"Deno","content":[{"name":"Play Crypto 2048","homepage":null,"author":"@@official.shinkai","version":"1.0.0","js_code":"import { shinkaiTypescriptUnsafeProcessor } from \"./shinkai-local-tools.ts\";\n\nconst get_ts_code = () => {\n return `\nimport { Stagehand } from \"@browserbasehq/stagehand\";\nimport { z } from \"zod\";\nconst randomTimer = (min: number = 0, max: number = 1500) => {\n const timeAmount = Math.floor(Math.random() * (max - min + 1)) + min;\n return new Promise((resolve) => setTimeout(resolve, timeAmount));\n};\nexport async function run(config: any, inputs: any) {\n console.log(\"🎮 Starting 2048 bot...\");\n const stagehand = new Stagehand({\n env: \"LOCAL\",\n modelName: \"gpt-4o\",\n modelClientOptions: {\n apiKey: process.env.OPENAI_KEY,\n },\n verbose: 1,\n debugDom: true,\n domSettleTimeoutMs: 100,\n executablePath: process.env.CHROME_PATH,\n });\n try {\n console.log(\"🌟 Initializing Stagehand...\");\n await stagehand.init();\n console.log(\"🌐 Navigating to 2048...\");\n await stagehand.page.goto(\"https://micro2048.pages.dev/events\");\n try {\n await stagehand.page.locator('#username').fill('walalo');\n await randomTimer(100);\n await stagehand.page.locator('#password').fill('c0rder00');\n await randomTimer(100);\n await stagehand.page.keyboard.press('Enter');\n } catch (error) {\n console.error(\"❌ Error logging in:\", error);\n }\n console.log(\"🖱️ clicking on the first event...\");\n await stagehand.page.act({\n action: \"click the first event\",\n });\n console.log(\"Clicking on New Game Button at the top right corner...\");\n await stagehand.page.act({\n action: \"click the new game button\",\n });\n await randomTimer(1000);\n console.log(\"⌛ Waiting for game to initialize...\");\n await stagehand.page.waitForSelector(\".game-board\", { timeout: 10000 });\n // Main game loop\n let moveKey = \"ArrowDown\";\n while (true) {\n console.log(\"🔄 Game loop iteration...\");\n // Add a small delay for UI updates\n await randomTimer(100, 300);\n // Get current game state\n const gameState = await stagehand.page.extract({\n instruction: \\`Extract the current game state:\n 1. Score from the score counter\n 2. All tile values in the 4x4 grid (empty spaces as 0)\n 3. Highest tile value present\\`,\n schema: z.object({\n score: z.number(),\n highestTile: z.number(),\n grid: z.array(z.array(z.number())),\n }),\n });\n const transposedGrid = gameState.grid[0].map((_, colIndex) =>\n gameState.grid.map((row) => row[colIndex]),\n );\n const grid = transposedGrid.map((row, rowIndex) => ({\n [\\`row\\${rowIndex + 1}\\`]: row,\n }));\n console.log(\"Game State:\", {\n score: gameState.score,\n highestTile: gameState.highestTile,\n grid: grid,\n });\n // Analyze board and decide next move\n const analysis = await stagehand.page.extract({\n instruction: \\`Based on the current game state:\n - Score: \\${gameState.score}\n - Highest tile: \\${gameState.highestTile}\n - Grid: This is a 4x4 matrix ordered by row (top to bottom) and column (left to right). The rows are stacked vertically, and tiles can move vertically between rows or horizontally between columns:\\n\\${grid\n .map((row) => {\n const rowName = Object.keys(row)[0];\n return \\` \\${rowName}: \\${row[rowName].join(\", \")}\\`;\n })\n .join(\"\\\\n\")}\n What is the best move (up/down/left/right)? Consider:\n 1. Keeping high value tiles in corners (bottom left, bottom right, top left, top right)\n 2. Maintaining a clear path to merge tiles\n 3. Avoiding moves that could block merges\n 4. Only adjacent tiles of the same value can merge\n 5. Making a move will move all tiles in that direction until they hit a tile of a different value or the edge of the board\n 6. Tiles cannot move past the edge of the board\n 7. Each move must move at least one tile\\`,\n schema: z.object({\n move: z.enum([\"up\", \"down\", \"left\", \"right\"]),\n confidence: z.number(),\n reasoning: z.string(),\n }),\n });\n console.log(\"Move Analysis:\", analysis);\n let moveKey = {\n up: \"ArrowUp\",\n down: \"ArrowDown\",\n left: \"ArrowLeft\",\n right: \"ArrowRight\",\n }[analysis.move];\n let random = false;\n if (!moveKey) {\n moveKey = [\"ArrowUp\", \"ArrowDown\", \"ArrowLeft\", \"ArrowRight\"][Math.floor(Math.random() * 4)];\n random = true;\n }\n await stagehand.page.keyboard.press(moveKey);\n await randomTimer(100, 300);\n console.log(\"🎯 Executed move:\", moveKey);\n console.log(\"🎯🎯 Random:\", random);\n }\n } catch (error) {\n console.error(\"❌ Error in game loop:\", error);\n const isGameOver = await stagehand.page.evaluate(() => {\n return document.querySelector(\".game-over\") !== null;\n });\n if (isGameOver) {\n console.log(\"🏁 Game Over!\");\n return;\n }\n throw error; // Re-throw non-game-over errors\n }\n}\n`;\n}\n\nconst get_ts_package = () => {\n return JSON.stringify({\n \"name\": \"standalone\",\n \"version\": \"1.0.0\",\n \"main\": \"index.ts\",\n \"scripts\": {},\n \"author\": \"\",\n \"license\": \"ISC\",\n \"description\": \"\",\n \"dependencies\": {\n \"@browserbasehq/stagehand\": \"https://github.com/dcspark/stagehand\",\n \"sharp\": \"^0.33.5\",\n \"json-schema-to-zod\": \"^2.6.0\",\n \"zod\": \"^3.24.1\"\n }\n }, null, 2);\n}\n\nexport async function run(config: any, parameters: any) {\n return await shinkaiTypescriptUnsafeProcessor({\n code: get_ts_code(),\n package: get_ts_package(),\n parameters,\n config,\n });\n}","tools":["local:::__official_shinkai:::shinkai_typescript_unsafe_processor"],"config":[],"description":"Automatically play Crypto 2048","keywords":[],"input_args":{"type":"object","properties":{},"required":[]},"output_arg":{"json":""},"activated":false,"embedding":[0.009631552,-0.04992938,0.18502054,-1.0482539,-1.0781292,0.21508309,0.12178822,0.03537053,-0.23301429,-0.008838275,-0.02757813,0.5861123,-0.063159615,0.114750266,0.67119974,-0.39024654,0.042216055,-0.41569048,-1.4747849,0.32852745,-0.095488116,0.28981847,-0.27413607,0.57467407,0.24016836,0.53815967,0.26405653,-0.07335593,-0.96696854,-1.9006026,0.1596164,0.16929984,-0.73168796,0.11895767,0.0071155876,-0.040797435,-0.36685786,0.602024,-0.5155333,-0.72439617,0.024832347,0.5278477,-0.025670819,-0.5974936,0.18656425,-0.851731,0.24295303,0.2980186,0.32369882,-0.00576818,-0.5316915,-0.0443345,0.19912323,-0.3571577,-0.3877503,-0.1904541,-0.6201958,-0.23724513,-0.038888235,0.6274235,0.053967472,-0.09122902,-3.9413044,-0.09980723,1.2276329,-0.0026485175,1.0071267,-0.566757,0.0449212,0.2143934,0.7288917,0.24978119,-0.6322256,-0.43571645,0.41249117,0.07369407,-0.13420323,0.27322614,0.3682264,0.306354,0.70643735,0.9529729,-0.31124133,-0.0036357557,-0.063805014,0.31561166,-0.6238566,-0.7716878,-0.0044340864,0.39364618,-0.40586585,0.23019928,0.31643155,-0.007856749,-0.9279554,0.27866182,0.016852137,0.0909691,0.42589673,2.756898,0.5400851,0.1856568,0.23657939,-0.7392764,1.2251837,-0.10394326,-0.44229114,-0.24651147,0.07158512,-0.22413813,-0.41466978,-0.32522598,0.51082253,-0.50564,0.876973,0.66020226,-0.31923705,-0.14718309,-0.5334909,0.38679358,0.104757756,0.19258657,-0.67783517,-0.11258835,-0.26350665,0.39719975,-0.57210445,0.35279927,-0.16289335,-0.03882335,0.80461675,-0.7194841,-0.7117722,0.03659668,0.09249537,0.60610735,0.0043234825,-0.645116,-0.21206394,0.0066185817,0.6970846,-1.0253034,0.7064157,-0.62459886,0.55109197,-0.7169535,0.24785116,-0.21308923,-0.10714525,0.0647501,-0.070901215,0.4857152,0.15465198,0.18141821,1.4497718,-0.49284247,0.5237919,-0.3074455,-0.45048726,0.09574412,-0.58430254,-0.7648521,0.1978319,1.1533558,0.68787706,-0.3592223,-0.6619866,0.50433767,0.16498987,-0.17591146,0.5607004,-0.11353024,0.21384396,-0.20240316,0.06686338,-0.18404566,-0.03956675,0.5151562,0.44705054,-0.494387,-0.2882294,0.37096238,-0.29548246,-1.0146899,-0.3289829,0.30940995,0.2680657,0.021531891,0.3550634,0.124516755,-0.013229638,1.1711788,-1.0500292,-0.2242105,0.21086057,0.39523625,-0.047401704,-0.07924576,-0.17475498,-1.0185028,-0.5270128,-0.28919125,-0.071563244,0.200753,-0.8843135,-0.3832865,1.1110101,0.34877846,0.20065357,-0.18941632,0.48876852,0.58971417,0.84201807,0.32726032,0.38288978,0.09315635,0.24410279,0.38939917,0.8999047,0.22840847,0.68903816,0.5512952,-0.6364162,-0.48450094,-0.9729838,-0.39208567,0.20649526,-0.17420447,-0.13785224,-0.109444425,0.3707913,0.056379654,0.5681746,1.0115702,0.92503625,0.3230933,0.5402217,0.44688234,0.39031857,-0.7119117,-0.090244,-0.1785315,-0.018537551,-1.0011166,0.11845689,-0.7006862,-0.02951197,-0.09922589,-0.6489029,1.5172975,0.6799164,-0.17271885,1.0065829,0.581125,0.20255616,0.7506777,-1.4929343,-0.40953752,0.020433947,-0.06880985,-0.5249166,0.029950596,0.3026242,0.300562,-0.44028413,-0.1495601,-0.7951509,0.03781206,0.015200853,-0.041881382,0.12777032,0.61470646,-0.45885348,1.0204673,0.17034289,-0.23830356,0.5319625,-0.11195917,-0.93158436,0.5295631,-0.71754813,-0.004116825,0.74318975,0.2955864,0.5336684,-0.66871434,-0.23853905,0.20709798,-0.14102319,0.6771504,-0.5514392,-0.24702601,-0.25761485,-0.16313758,1.4949478,0.07249136,1.1243281,0.47784066,-0.13979472,0.96951747,-0.93905467,0.54605997,-0.013257904,-0.22449452,-1.6786041,-0.1560748,0.37304938,-0.3841954,-0.77719694,0.29487053,-0.19792724,0.33460453,-0.08170095,0.073939815,0.1959246,-0.17117071,-0.31746507,0.35389334,-0.4825042,-2.1670907,-0.3800015,-0.12858504,-0.26742584,-0.5589137,-0.38126403,0.47785473,0.21715099,-0.0533936,-0.25874346,1.9581646,0.57584107,-0.6660987,-0.51835895,-0.099161774,1.2095441,-0.1103864,0.4147831,0.046614222,-0.31198367,0.46905142,-0.38439134,1.6953897,0.31032583,0.7453311,-0.40187597,0.14506428,-0.14780782,-1.0243914,-0.20169052,0.4167378,-0.5513226,0.057977423,0.112630025,-0.59918475,0.67138845,0.48212013,-0.07321637,-0.49443457,-0.059035175,0.96248144,0.21120213,-0.3817267,-0.119807854,0.21824579,0.047149874,0.5950226,0.012342282,-0.83972925,0.16936387,-0.24386993,-0.18558978,-0.54055744,0.17885126,-0.13079739,1.0947287,0.54295987,0.020074066,0.4034909,0.51621944,0.5906146,0.042713635,0.05595925,-0.7800478,-0.24329908],"result":{"type":"object","properties":{},"required":[]},"sql_tables":[],"sql_queries":[],"file_inbox":null,"oauth":[],"assets":null,"runner":"any","operating_system":["linux","macos","windows"],"tool_set":""},false]} \ No newline at end of file diff --git a/tools/game-crypto-2048/metadata.json b/tools/game-crypto-2048/metadata.json index 7f2ed2b7..5c250a14 100644 --- a/tools/game-crypto-2048/metadata.json +++ b/tools/game-crypto-2048/metadata.json @@ -5,7 +5,10 @@ "author": "@@official.shinkai", "version": "1.0.0", "keywords": [], - "configurations": { + "runner": "any", + "operating_system": ["linux", "macos", "windows"], + "tool_set": "", + "configurations": { "type": "object", "properties": {}, "required": [] diff --git a/tools/google-news-search/.tool-dump.test.json b/tools/google-news-search/.tool-dump.test.json new file mode 100644 index 00000000..ec142754 --- /dev/null +++ b/tools/google-news-search/.tool-dump.test.json @@ -0,0 +1 @@ +{"type":"Python","content":[{"version":"1.0.0","name":"Google News Search","homepage":null,"author":"@@official.shinkai","py_code":"# /// script\n# dependencies = [\n# \"requests>=2.28.0\"\n# ]\n# ///\n\nimport requests\nimport os\nimport json\nfrom typing import List, Dict, Optional\nimport time\n\nclass CONFIG:\n \"\"\"\n Config holds optional parameters for SerpAPI or environment usage.\n \"\"\"\n SERP_API_KEY: str # SerpAPI key for authentication\n\nclass INPUTS:\n \"\"\"\n The user inputs for this tool.\n \"\"\"\n query: str # The user's search query\n gl: Optional[str] = \"us\" # Geolocation (country code)\n hl: Optional[str] = \"en\" # Language code\n num_results: Optional[int] = 10 # Max news results to return\n\nclass OUTPUT:\n \"\"\"\n The JSON output from the tool. \n We'll unify each search result, returning them in a structured list.\n \"\"\"\n results: List[Dict[str, str]]\n query: str\n\nasync def run(c: CONFIG, p: INPUTS) -> OUTPUT:\n # Validate config\n if not c.SERP_API_KEY:\n raise ValueError(\"SERP_API_KEY not provided in config.\")\n\n # Validate input\n if not p.query or not p.query.strip():\n raise ValueError(\"No search query provided.\")\n\n # Build request to SerpAPI \"google_news\" engine\n url = \"https://serpapi.com/search\"\n params = {\n \"engine\": \"google_news\",\n \"q\": p.query.strip(),\n \"api_key\": c.SERP_API_KEY,\n \"hl\": p.hl or \"en\", # language\n \"gl\": p.gl or \"us\", # geolocation/country code\n \"num\": p.num_results if p.num_results else 10,\n }\n\n start_time = time.time()\n resp = requests.get(url, params=params)\n elapsed = time.time() - start_time\n\n if resp.status_code != 200:\n raise RuntimeError(\n f\"Google News search failed with HTTP {resp.status_code}: {resp.text}\"\n )\n\n data = resp.json()\n\n # In SerpAPI's response, we expect a top-level \"news_results\" key\n raw_results = data.get(\"news_results\", [])\n # Convert them to a simpler structure\n articles = []\n for item in raw_results[: p.num_results]:\n # Items typically contain:\n # \"title\", \"link\", \"source\" => { \"name\": str }, \"snippet\", \"date\", ...\n # We'll unify them into a consistent structure\n article = {\n \"title\": item.get(\"title\", \"Untitled\"),\n \"link\": item.get(\"link\", \"\"),\n \"source\": item.get(\"source\", {}).get(\"name\", \"Unknown\"),\n \"snippet\": item.get(\"snippet\", \"\"),\n \"date\": item.get(\"date\", \"\"),\n }\n articles.append(article)\n\n # Prepare our result object\n output = OUTPUT()\n output.results = articles\n output.query = p.query.strip()\n\n # (optional) some debug prints or logging\n print(f\"[google-news-search] Found {len(articles)} articles in {elapsed:.2f} seconds.\")\n return output ","tools":[],"config":[{"BasicConfig":{"key_name":"SERP_API_KEY","description":"Your SerpAPI key for authentication","required":true,"type":null,"key_value":null}}],"description":"Searches Google News for headlines and articles via SerpAPI. Requires SERP_API_KEY in configuration.","keywords":["google-news","serpapi","news","search"],"input_args":{"type":"object","properties":{"hl":{"type":"string","description":"Language code. E.g. 'en', 'zh', 'es', 'fr'..."},"num_results":{"type":"number","description":"Number of results to return"},"query":{"type":"string","description":"The search query to look up in Google News"},"gl":{"type":"string","description":"Geolocation (country code). E.g. 'us', 'uk', 'au', ..."}},"required":["query"]},"output_arg":{"json":""},"activated":false,"embedding":[0.30300695,0.96105754,-0.089330256,-0.24290669,-0.35754716,-0.5456005,-0.13923922,-0.22873786,-0.65981054,-0.34181273,-0.6089842,0.398749,-0.1568277,0.023563959,0.24318016,0.022704683,0.17127179,0.014599344,-0.8312644,-0.15826267,0.73821384,0.594094,0.34571284,0.02123965,-0.17415425,0.072422445,-0.28573573,-0.5429258,-1.0956556,-1.9694613,0.3973645,0.36382145,0.27675655,0.052531555,-0.5698511,-0.33560845,-0.039988652,-0.29301962,-0.4839713,0.04807262,0.08266612,0.06456261,-0.5364021,0.17302117,-0.32042038,0.08729016,0.5494179,-0.153521,0.7215163,0.6226882,0.15232682,0.3927179,-0.8523861,0.27510545,-0.10380891,0.23976174,-0.443868,0.24694376,0.22706988,0.17149396,0.62396216,0.3761238,-4.20067,-0.19873127,0.43058816,0.5886432,0.0299225,-0.36377618,0.094900995,0.3367836,0.34386033,0.27564624,0.3349681,0.58344597,-0.33871412,-0.9716096,0.1452784,0.15148574,-0.116497084,-0.7466118,0.29464364,-0.06981975,-1.0075992,-0.2078874,-0.34312302,0.46824253,-0.45503032,0.06838027,0.45722255,-0.056607667,-0.20906861,-0.1480053,0.24265908,-0.7716443,-0.7068419,-0.2456914,0.06689942,0.36328202,0.50314033,3.2431626,0.53567386,0.048342723,0.554727,-0.6137927,0.6006792,-0.5108483,0.38109002,-0.20392835,-0.19680013,0.36171812,-0.3009695,0.5991129,0.36374748,-0.30028892,0.0051793884,0.3342936,-0.5138369,0.045334168,0.37520382,1.2146078,-0.20687829,-0.47420394,-0.9863534,0.31781307,0.008434504,0.021734223,-0.5892662,0.47134858,0.32889166,-0.21854964,0.38522223,-0.92070806,-0.752111,-0.13168667,0.07435612,0.38180494,0.28219366,-0.5847166,0.046635654,-0.77427423,-0.32156283,-0.93293077,0.91401803,-0.10714826,0.4732029,0.46777144,0.17241031,0.47317842,-0.8305264,-0.3142319,0.12150709,0.117044464,0.586781,0.118813604,0.45305586,-0.20752661,-0.2787793,0.36670506,-0.7773842,-0.12851623,-0.13315804,-0.051338486,0.3167472,-0.32908452,0.11204744,-0.12619892,0.35923424,0.17975602,0.41853017,0.1019233,0.41122353,0.27344903,0.34286854,0.5435678,0.00065461453,-0.010967076,-0.7710066,-0.5951605,0.905092,-0.75765,-0.5343801,0.55771554,0.089466944,-0.5903426,-0.62760025,0.49571294,0.07878231,-0.037144408,0.88884836,0.7347244,-0.6695338,1.9856272,-0.59463495,-0.8260239,0.52393985,0.024317235,-0.67584604,0.2778252,0.46241453,-0.2558844,-0.40309808,-0.11888327,0.15870589,-0.5708803,-0.30320036,-0.4112346,0.34094566,-0.30636275,0.34011936,-0.30568245,0.20861273,-0.69729257,0.32351318,0.17564943,0.054449715,-0.15329058,-0.28299886,0.33089414,-0.41547725,0.5354465,0.10300405,0.31519803,-0.78140676,-0.77649003,-0.5122154,-0.1002778,-0.055661794,0.19184418,-0.90383846,-0.070705995,0.40124592,1.2905726,-0.35271356,0.9294828,0.47941938,0.10162025,0.5567068,0.37049872,0.52636087,-0.70702255,0.54165924,-0.401703,-0.42642313,-0.7257861,0.47509754,-0.76641953,0.004282996,0.6881572,0.42267826,1.454294,1.3900048,0.19030297,0.20534202,0.12920523,0.18959236,0.095249124,-1.2069026,0.061893154,-0.47346315,-0.13986981,-0.009858556,-0.2877513,0.5267324,0.37844834,0.51299083,-0.38796258,0.26115376,-0.70544124,0.015790172,-0.5419482,0.13767488,0.48618573,0.2633006,0.05555039,-0.13647492,-0.22952773,-0.31317168,-0.05333867,-0.6499032,-0.2860552,0.49384427,-0.3723062,0.079470396,-0.1853091,-0.6253829,-0.4099806,-0.45140013,0.84906375,-0.32583648,0.756953,-0.471223,-0.08902159,0.1235369,0.14480871,1.5133095,-0.9378648,0.17505625,0.659975,-0.30343312,0.07176516,-0.48775452,-0.052916095,-0.027382376,0.16967946,-0.39675507,-0.43229648,0.59248173,-0.19114538,0.20889246,0.57460105,-0.6132918,0.42300975,-0.012897886,-0.6906876,0.6319764,-0.7117497,0.16501656,0.71234107,-0.09693125,-1.9725952,-0.01941828,0.020468846,0.15466438,-0.26082903,-1.1355869,0.34978145,0.0018009339,0.103138864,-0.3272871,1.4706942,0.19500297,-0.20350067,-0.49618632,0.34388348,0.10498218,-0.37936333,0.22474502,-0.21342605,-0.66587156,-0.627221,0.14875299,1.5400586,1.0976909,-0.0892815,0.36132443,0.47728142,-0.63186026,-0.9136919,0.52074647,0.5000414,-0.5784508,0.72371525,-0.4100742,-0.4886499,0.38512918,0.9123719,0.8057004,0.26258796,0.041908722,1.1740253,0.023144392,0.4656806,-0.16866246,0.5826923,-0.0017654821,0.38743407,0.3205532,-0.34011373,0.24103175,-0.2896349,0.15979928,-0.27350512,0.8936987,-0.17506944,-0.004211396,0.6701429,0.6714522,0.42119336,0.55140454,0.22857063,0.043316327,0.17861429,-0.90980095,0.38353717],"result":{"type":"object","properties":{"query":{"description":"The original query string","type":"string"},"results":{"description":"List of search results","items":{"properties":{"date":{"type":"string"},"link":{"type":"string"},"snippet":{"type":"string"},"source":{"type":"string"},"title":{"type":"string"}},"type":"object"},"type":"array"}},"required":["results","query"]},"sql_tables":[],"sql_queries":[],"file_inbox":null,"oauth":null,"assets":null,"runner":"any","operating_system":["linux","macos","windows"],"tool_set":""},false]} \ No newline at end of file diff --git a/tools/google-news-search/metadata.json b/tools/google-news-search/metadata.json index af4e1341..1077eaeb 100644 --- a/tools/google-news-search/metadata.json +++ b/tools/google-news-search/metadata.json @@ -9,6 +9,9 @@ "news", "search" ], + "runner": "any", + "operating_system": ["linux", "macos", "windows"], + "tool_set": "", "configurations": { "type": "object", "properties": { diff --git a/tools/google-search/.tool-dump.test.json b/tools/google-search/.tool-dump.test.json index c11a7e69..0026351b 100644 --- a/tools/google-search/.tool-dump.test.json +++ b/tools/google-search/.tool-dump.test.json @@ -1 +1 @@ -{"type":"Python","content":[{"version":"1.0.0","name":"Google Search","homepage":null,"author":"@@official.shinkai","py_code":"# /// script\n# dependencies = [\n# \"googlesearch-python\"\n# ]\n# ///\nfrom googlesearch import search, SearchResult\nfrom typing import List\nfrom dataclasses import dataclass\nimport json\n\nclass CONFIG:\n pass\n\nclass INPUTS:\n query: str\n num_results: int = 10\n\nclass OUTPUT:\n results: List[SearchResult]\n query: str\n\nasync def run(c: CONFIG, p: INPUTS) -> OUTPUT:\n query = p.query\n if not query:\n raise ValueError(\"No search query provided\")\n\n results = []\n try:\n results = search(query, num_results=p.num_results, advanced=True)\n except Exception as e:\n raise RuntimeError(f\"Search failed: {str(e)}\")\n\n output = OUTPUT()\n output.results = results\n output.query = query\n return output","tools":[],"config":[],"description":"This function takes a question as input and returns a comprehensive answer, along with the sources and statements used to generate the answer.","keywords":["search","answer generation","fact extraction","wikipedia","google"],"input_args":{"type":"object","properties":{"query":{"type":"string","description":"The search query to look up"}},"required":["query"]},"output_arg":{"json":""},"activated":false,"embedding":[0.74037224,0.1523448,0.12250063,-0.2330956,-0.0732149,-0.49121237,-0.7105934,0.26602554,-0.31485674,0.32427734,-0.39323238,0.7821352,0.20446597,-0.41919872,0.67798615,0.209939,0.29757926,-0.29446813,-1.6610041,-0.031176,0.78383785,0.008370239,0.25008854,-0.19770642,-0.37513775,-0.14639914,0.38888413,-0.30902037,-1.0635359,-1.5362298,0.90626204,0.7395651,-0.22855942,-0.2196196,-0.6552673,-0.38012552,-0.16014673,-0.25391504,0.018916853,-0.016465046,-0.24382688,0.05679094,-0.54244953,0.39270037,-0.2572619,-0.008627504,0.44547108,-0.057402875,0.90210915,0.88670576,-0.19960696,-0.40889594,-0.19300205,0.32754079,-0.41249725,0.20653987,-0.18449533,-0.7727064,0.06246579,-0.5266049,0.4453819,0.28019792,-4.33095,-0.010926982,0.6433091,0.18808162,0.22580339,-0.61157745,0.18193504,0.10960609,0.0867686,0.1546536,0.3066386,0.27415034,0.00094724447,-0.22532904,-0.3923833,0.025509944,0.40191758,-0.5102701,0.07003463,0.056470983,0.060049966,0.27349964,-0.38567942,0.48457092,0.1265299,-0.383452,0.36558148,-0.0033628326,-0.66018665,-0.033859618,-0.31141108,-0.13672534,-0.6319758,-0.3046636,0.28244495,0.11184969,0.42252427,3.1190393,0.2897966,-0.40488464,0.4237477,-1.1255531,0.8605757,-0.145872,0.4461098,-0.37404382,0.7425561,0.15921599,0.2937993,-0.032813367,-0.22705385,0.51221126,-0.36465305,0.20450036,-0.24083848,0.123129666,0.3802647,0.8089271,0.07132991,0.232473,-0.4389687,-0.59644294,0.057721782,0.39618132,-0.3334279,0.33608884,0.5573402,0.34885535,0.70442456,-0.39812747,-1.1715777,-0.12136582,0.13247031,0.30338153,0.3793379,-0.78292507,0.6928125,-0.5691386,0.27588916,-1.6528674,0.54117787,-0.10768123,0.59654546,-0.054497033,-0.72086287,-0.037624903,-0.413778,-0.68734956,0.10164196,0.21509701,0.3415778,0.014826264,0.7090687,0.52430075,-0.26726043,0.04955519,-0.38586935,0.17126185,-0.3468741,0.46524423,0.63281727,0.18143305,0.52894264,-0.637046,0.44291666,0.4520656,-0.19375655,-0.41542503,0.47489196,-0.4161822,-0.24842288,0.45850873,-0.04690706,-0.5877953,0.048230067,-0.14095941,0.29211515,-0.69963264,-0.33471602,0.8007372,-0.65457326,-0.4604039,-0.45024818,0.47310352,0.045648046,0.14077257,0.80203354,1.3165474,-0.57164836,1.6299654,-0.40857363,-0.60397077,-0.27461904,-0.12910345,-0.18700455,0.43255436,0.549191,0.10527582,-0.83985114,-0.12148626,0.07743675,-0.40446636,-0.16725326,-0.43537217,0.08425541,-0.123337895,-0.29343027,-0.70511866,0.28347248,-0.66800463,0.6264798,0.29570436,0.4059022,-0.080531366,-0.039702266,0.2654012,-0.7448296,0.7567029,-0.004951909,-0.038217224,-0.66041446,-0.60762405,-0.45770466,0.14596814,0.11970285,0.07908257,-0.1553611,-0.035996567,0.8584984,1.055522,-0.010617681,1.3047324,0.8748694,0.42517588,-0.10457472,0.27154553,-0.3464195,-0.35959387,0.2783715,-0.24053133,-0.3509732,-0.26509744,0.24651207,-0.65943944,0.2800332,-0.11088933,-0.009066327,1.3665054,0.9938594,0.2110039,0.21169847,0.6469496,-0.12677836,0.01716204,-1.9237192,0.019135464,-0.3490658,0.39400783,-0.22484699,-0.08604026,0.5508134,0.09623649,-0.23745012,-0.7042359,-0.075872876,-1.0612733,0.009017386,0.028394379,0.14629984,0.52394146,-0.21165091,0.11670326,0.42965937,0.23219067,-0.22103347,0.5378713,-0.7077015,-0.4177954,0.5645298,-0.027265925,-0.19830701,0.189426,-0.08153864,-0.23689003,-0.33448055,-0.046354167,0.076794356,0.20690316,-0.6722652,-0.52268887,-0.30469036,0.33876172,1.5162745,-0.03604217,0.029588792,1.017168,-0.086855166,-0.051238023,0.3323765,0.6857262,0.07683526,-0.19591287,0.0044383705,-0.77895075,0.59338504,-0.18997079,-0.26441965,0.20731027,-0.7421641,-0.09967218,0.05133872,-0.41912264,0.14718735,-0.6373423,0.49263602,0.58286464,0.29755393,-2.0216033,-0.007959459,0.40863988,-0.2722516,-0.056280687,-0.492824,0.3854516,-0.37532952,0.4678018,-0.7883893,1.9486378,0.5012205,-0.36526364,-0.46191347,0.09727245,0.674515,-0.69980514,-0.24710421,-0.10073779,-0.15110654,0.2634647,0.54191643,1.5983393,0.5812038,0.00916383,0.12389828,0.1053821,-0.377112,-1.3136234,-0.4055855,0.3349371,-0.30854625,0.43692365,-0.28489202,-0.5596402,0.46159178,1.0071299,0.531482,0.50845766,0.37580737,1.7201524,0.24967028,-0.21856175,-0.3468639,-0.7028712,-0.47778672,0.37018847,0.3560745,-0.5624895,0.423697,-0.23882222,-0.10672356,-0.33050084,0.28650072,0.29336917,0.31674817,0.65916663,0.39147034,0.81462157,0.037891425,-0.063155815,0.42848307,0.10547708,-0.5769465,-0.5225401],"result":{"type":"object","properties":{"query":{"type":"string"},"results":{"items":{"properties":{"description":{"type":"string"},"title":{"type":"string"},"url":{"type":"string"}},"required":["title","url","description"],"type":"object"},"type":"array"}},"required":["query","results"]},"sql_tables":[],"sql_queries":[],"file_inbox":null,"oauth":null,"assets":null},false]} \ No newline at end of file +{"type":"Python","content":[{"version":"1.0.0","name":"Google Search","homepage":null,"author":"@@official.shinkai","py_code":"# /// script\n# dependencies = [\n# \"googlesearch-python\"\n# ]\n# ///\nfrom googlesearch import search, SearchResult\nfrom typing import List\nfrom dataclasses import dataclass\nimport json\n\nclass CONFIG:\n pass\n\nclass INPUTS:\n query: str\n num_results: int = 10\n\nclass OUTPUT:\n results: List[SearchResult]\n query: str\n\nasync def run(c: CONFIG, p: INPUTS) -> OUTPUT:\n query = p.query\n if not query:\n raise ValueError(\"No search query provided\")\n\n results = []\n try:\n results = search(query, num_results=p.num_results, advanced=True)\n except Exception as e:\n raise RuntimeError(f\"Search failed: {str(e)}\")\n\n output = OUTPUT()\n output.results = results\n output.query = query\n return output","tools":[],"config":[],"description":"This function takes a question as input and returns a comprehensive answer, along with the sources and statements used to generate the answer.","keywords":["search","answer generation","fact extraction","wikipedia","google"],"input_args":{"type":"object","properties":{"query":{"type":"string","description":"The search query to look up"}},"required":["query"]},"output_arg":{"json":""},"activated":false,"embedding":[0.74037224,0.1523448,0.12250063,-0.2330956,-0.0732149,-0.49121237,-0.7105934,0.26602554,-0.31485674,0.32427734,-0.39323238,0.7821352,0.20446597,-0.41919872,0.67798615,0.209939,0.29757926,-0.29446813,-1.6610041,-0.031176,0.78383785,0.008370239,0.25008854,-0.19770642,-0.37513775,-0.14639914,0.38888413,-0.30902037,-1.0635359,-1.5362298,0.90626204,0.7395651,-0.22855942,-0.2196196,-0.6552673,-0.38012552,-0.16014673,-0.25391504,0.018916853,-0.016465046,-0.24382688,0.05679094,-0.54244953,0.39270037,-0.2572619,-0.008627504,0.44547108,-0.057402875,0.90210915,0.88670576,-0.19960696,-0.40889594,-0.19300205,0.32754079,-0.41249725,0.20653987,-0.18449533,-0.7727064,0.06246579,-0.5266049,0.4453819,0.28019792,-4.33095,-0.010926982,0.6433091,0.18808162,0.22580339,-0.61157745,0.18193504,0.10960609,0.0867686,0.1546536,0.3066386,0.27415034,0.00094724447,-0.22532904,-0.3923833,0.025509944,0.40191758,-0.5102701,0.07003463,0.056470983,0.060049966,0.27349964,-0.38567942,0.48457092,0.1265299,-0.383452,0.36558148,-0.0033628326,-0.66018665,-0.033859618,-0.31141108,-0.13672534,-0.6319758,-0.3046636,0.28244495,0.11184969,0.42252427,3.1190393,0.2897966,-0.40488464,0.4237477,-1.1255531,0.8605757,-0.145872,0.4461098,-0.37404382,0.7425561,0.15921599,0.2937993,-0.032813367,-0.22705385,0.51221126,-0.36465305,0.20450036,-0.24083848,0.123129666,0.3802647,0.8089271,0.07132991,0.232473,-0.4389687,-0.59644294,0.057721782,0.39618132,-0.3334279,0.33608884,0.5573402,0.34885535,0.70442456,-0.39812747,-1.1715777,-0.12136582,0.13247031,0.30338153,0.3793379,-0.78292507,0.6928125,-0.5691386,0.27588916,-1.6528674,0.54117787,-0.10768123,0.59654546,-0.054497033,-0.72086287,-0.037624903,-0.413778,-0.68734956,0.10164196,0.21509701,0.3415778,0.014826264,0.7090687,0.52430075,-0.26726043,0.04955519,-0.38586935,0.17126185,-0.3468741,0.46524423,0.63281727,0.18143305,0.52894264,-0.637046,0.44291666,0.4520656,-0.19375655,-0.41542503,0.47489196,-0.4161822,-0.24842288,0.45850873,-0.04690706,-0.5877953,0.048230067,-0.14095941,0.29211515,-0.69963264,-0.33471602,0.8007372,-0.65457326,-0.4604039,-0.45024818,0.47310352,0.045648046,0.14077257,0.80203354,1.3165474,-0.57164836,1.6299654,-0.40857363,-0.60397077,-0.27461904,-0.12910345,-0.18700455,0.43255436,0.549191,0.10527582,-0.83985114,-0.12148626,0.07743675,-0.40446636,-0.16725326,-0.43537217,0.08425541,-0.123337895,-0.29343027,-0.70511866,0.28347248,-0.66800463,0.6264798,0.29570436,0.4059022,-0.080531366,-0.039702266,0.2654012,-0.7448296,0.7567029,-0.004951909,-0.038217224,-0.66041446,-0.60762405,-0.45770466,0.14596814,0.11970285,0.07908257,-0.1553611,-0.035996567,0.8584984,1.055522,-0.010617681,1.3047324,0.8748694,0.42517588,-0.10457472,0.27154553,-0.3464195,-0.35959387,0.2783715,-0.24053133,-0.3509732,-0.26509744,0.24651207,-0.65943944,0.2800332,-0.11088933,-0.009066327,1.3665054,0.9938594,0.2110039,0.21169847,0.6469496,-0.12677836,0.01716204,-1.9237192,0.019135464,-0.3490658,0.39400783,-0.22484699,-0.08604026,0.5508134,0.09623649,-0.23745012,-0.7042359,-0.075872876,-1.0612733,0.009017386,0.028394379,0.14629984,0.52394146,-0.21165091,0.11670326,0.42965937,0.23219067,-0.22103347,0.5378713,-0.7077015,-0.4177954,0.5645298,-0.027265925,-0.19830701,0.189426,-0.08153864,-0.23689003,-0.33448055,-0.046354167,0.076794356,0.20690316,-0.6722652,-0.52268887,-0.30469036,0.33876172,1.5162745,-0.03604217,0.029588792,1.017168,-0.086855166,-0.051238023,0.3323765,0.6857262,0.07683526,-0.19591287,0.0044383705,-0.77895075,0.59338504,-0.18997079,-0.26441965,0.20731027,-0.7421641,-0.09967218,0.05133872,-0.41912264,0.14718735,-0.6373423,0.49263602,0.58286464,0.29755393,-2.0216033,-0.007959459,0.40863988,-0.2722516,-0.056280687,-0.492824,0.3854516,-0.37532952,0.4678018,-0.7883893,1.9486378,0.5012205,-0.36526364,-0.46191347,0.09727245,0.674515,-0.69980514,-0.24710421,-0.10073779,-0.15110654,0.2634647,0.54191643,1.5983393,0.5812038,0.00916383,0.12389828,0.1053821,-0.377112,-1.3136234,-0.4055855,0.3349371,-0.30854625,0.43692365,-0.28489202,-0.5596402,0.46159178,1.0071299,0.531482,0.50845766,0.37580737,1.7201524,0.24967028,-0.21856175,-0.3468639,-0.7028712,-0.47778672,0.37018847,0.3560745,-0.5624895,0.423697,-0.23882222,-0.10672356,-0.33050084,0.28650072,0.29336917,0.31674817,0.65916663,0.39147034,0.81462157,0.037891425,-0.063155815,0.42848307,0.10547708,-0.5769465,-0.5225401],"result":{"type":"object","properties":{"query":{"type":"string"},"results":{"items":{"properties":{"description":{"type":"string"},"title":{"type":"string"},"url":{"type":"string"}},"required":["title","url","description"],"type":"object"},"type":"array"}},"required":["query","results"]},"sql_tables":[],"sql_queries":[],"file_inbox":null,"oauth":null,"assets":null,"runner":"any","operating_system":["linux","macos","windows"],"tool_set":""},false]} \ No newline at end of file diff --git a/tools/google-search/metadata.json b/tools/google-search/metadata.json index 9708d2dd..80996bb5 100644 --- a/tools/google-search/metadata.json +++ b/tools/google-search/metadata.json @@ -11,7 +11,10 @@ "wikipedia", "google" ], - "configurations": [], + "runner": "any", + "operating_system": ["linux", "macos", "windows"], + "tool_set": "", + "configurations": [], "parameters": { "properties": { "query": { diff --git a/tools/hacker-news/.tool-dump.test.json b/tools/hacker-news/.tool-dump.test.json new file mode 100644 index 00000000..6eec6172 --- /dev/null +++ b/tools/hacker-news/.tool-dump.test.json @@ -0,0 +1 @@ +{"type":"Deno","content":[{"name":"hacker-news","homepage":null,"author":"@@official.shinkai","version":"1.0.0","js_code":"import axios from 'npm:axios@1.7.7';\n\ntype Configurations = {\n limit?: number; // Optional limit of stories to fetch, defaults to 10\n};\n\ntype Parameters = {}; // No input parameters needed\n\ntype Result = {\n stories: Array<{\n title: string;\n author: string;\n url: string;\n }>;\n};\n\nexport type Run, I extends Record, R extends Record> = (config: C, inputs: I) => Promise;\n\nexport const run: Run = async (\n configurations: Configurations,\n _params: Parameters,\n): Promise => {\n // Ensure limit is a positive number between 1 and 10\n const requestedLimit = configurations.limit ?? 10;\n const limit = Math.min(Math.max(1, requestedLimit), 10);\n \n const TOP_STORIES_URL = 'https://hacker-news.firebaseio.com/v0/topstories.json';\n const ITEM_URL = 'https://hacker-news.firebaseio.com/v0/item';\n\n try {\n // Fetch top stories IDs\n const response = await axios.get(TOP_STORIES_URL);\n const storyIds = response.data.slice(0, limit);\n\n // Fetch details for each story\n const stories = await Promise.all(\n storyIds.map(async (id: number) => {\n const storyResponse = await axios.get(`${ITEM_URL}/${id}.json`);\n const story = storyResponse.data;\n\n if (story && story.type === 'story') {\n return {\n title: story.title || '',\n author: story.by || '',\n url: story.url || `https://news.ycombinator.com/item?id=${id}`,\n };\n }\n return null;\n }),\n );\n\n // Filter out null values and return results\n return {\n stories: stories.filter((story): story is NonNullable => story !== null),\n };\n } catch (error) {\n console.error('Error fetching Hacker News stories:', error);\n return { stories: [] };\n }\n}; ","tools":[],"config":[{"BasicConfig":{"key_name":"limit","description":"Number of stories to fetch (default: 10)","required":false,"type":null,"key_value":null}}],"description":"Fetches top tech stories from Hacker News","keywords":["hacker-news","news","tech","stories"],"input_args":{"type":"object","properties":{},"required":[]},"output_arg":{"json":""},"activated":false,"embedding":[-0.03814847,0.31533328,-0.2529093,-0.3058103,-0.1985089,-0.48741406,-0.023982761,-0.21997428,-0.12731,0.068043165,-0.45176408,0.55424917,0.24608675,0.2561275,0.3896666,-0.36621672,0.028179033,-0.21431093,-1.4602044,-0.12303334,0.21021096,0.5458506,0.366014,-0.083663195,0.16655043,0.13825631,-0.11856836,-0.14529511,-0.74323374,-2.6044908,0.38880572,-0.16224226,-0.2879343,-0.22287941,-0.0918765,-0.61101884,0.12761685,-0.0035743043,-0.4814834,-0.3709817,0.03915681,0.039895967,-0.36150163,-0.054650277,0.24929212,-0.19605681,0.015186435,0.037146658,0.93244493,0.67739123,-0.055885024,-0.21837108,-0.1226812,-0.15872864,-0.3179245,0.12592001,0.29264098,0.09955196,0.0700365,0.4304383,0.4435915,0.3920217,-4.4191456,-0.07257586,0.53892267,-0.009766467,0.13892666,0.3028914,-0.59853977,0.19550112,0.30627412,0.25233293,-0.21483493,0.43043372,0.13574123,-0.50886333,0.62875557,-0.10805906,0.20983104,-0.45880008,0.38355398,0.41395894,-0.33785218,0.2090689,-0.28629252,0.98506486,-0.63574755,-0.4253544,0.14668676,-0.4256234,0.39419016,-0.23333304,0.4919095,-0.43815544,-0.9703915,0.27978373,-0.09478493,0.46719676,0.51323336,3.4764802,0.73558295,0.11464614,0.320775,-0.4786247,0.45770746,-0.40320614,0.06673971,-0.3330886,-0.043954026,0.122099005,-0.1294006,-0.21678251,0.3137899,-0.26579854,0.008676801,0.15464948,-0.61476576,0.4372787,0.09690599,0.1969351,-0.142504,0.39431486,-0.41147348,-0.33798718,0.017408308,-0.24885637,-0.2317057,0.30114898,0.13081186,-0.21529351,0.1684619,-0.64077884,-0.76597637,-0.2922002,0.20928513,0.3914703,0.11245955,-0.50912523,0.15121534,-1.1289661,0.16818312,-1.3909643,1.2925663,-0.19670236,0.47987807,-0.15628366,0.2805145,0.31902283,-0.5411915,0.044226598,0.0029207133,0.45792004,-0.055958804,0.11789751,0.85254085,-0.027294215,-0.19718519,0.18761703,-0.48357442,0.061199605,0.051115308,0.2613513,0.77932614,0.43892318,0.48321933,-0.15540679,0.23499814,-0.025955059,0.28176978,0.0031515397,0.60511947,-0.27652964,0.14296205,0.16784564,-0.46798941,0.22136286,-0.23176381,-0.313984,-0.002027396,-0.3655055,0.07675104,0.6810093,-0.12220967,-0.8703967,0.048734523,0.15538931,0.36680993,-0.14493936,0.71691597,0.67921925,-0.7004698,1.6328763,-0.8448027,-0.80577743,0.1331883,0.09064386,0.017929502,0.6671103,0.66682506,0.15727912,-0.2525916,0.17293513,-0.43711218,0.29730886,-0.094439395,-0.40587825,0.16737378,-0.36788183,0.11987777,-0.4147197,0.11697543,0.054423764,0.2726379,0.8735865,0.15560833,-0.26694953,-0.34419757,0.13713506,-0.08522389,0.6134031,0.62966955,-0.017020583,-0.14224984,-0.707483,-0.2013206,0.25323993,-0.20304492,-0.38308597,-0.12297341,-0.012613315,0.20278841,0.576461,0.22613141,1.0404228,0.8065981,0.3636493,0.25753906,0.2991628,0.46115556,-0.44720963,0.46298867,0.12215628,-0.64678687,-0.41327977,0.3644162,-0.7666447,0.038398363,-0.24502665,0.42645228,1.7907741,0.52832353,0.28181645,0.4639984,0.39786956,0.07475322,-0.100675486,-1.0690964,-0.1173094,-0.45249236,0.25379005,-0.0952757,-0.494944,0.53977674,0.031529184,-0.24473888,-0.122800305,-0.29432297,-0.28687525,0.09813962,-0.22256663,-0.34777838,0.76687646,0.17384852,0.065611005,-0.12865779,0.06679829,0.3804077,-0.29930922,-0.35198128,-0.26324788,-0.07565034,0.22615817,0.68740386,0.026149489,-0.34886077,-0.645195,-0.5381754,-0.1282664,-0.45409626,0.009172565,0.17407984,-0.19944513,-0.25933814,-0.5074566,1.8981926,0.34080654,0.8220157,0.38035902,-0.34294748,0.17422643,0.032347284,-0.019917354,-0.25074074,-0.11889577,-0.8347934,-0.7683334,0.29373038,-0.56909513,-0.027888,0.10471526,0.07371076,0.051889237,0.17702718,-0.5052032,0.74763274,-0.6964664,-0.048383236,0.4503612,-0.06665355,-2.5098205,-0.15071797,-0.033516522,0.16734874,-0.31003302,-0.37955645,0.1150156,-0.025094504,0.0473212,-0.3024692,1.7215409,0.21734695,-0.14503787,-0.030316424,0.27041343,0.6829386,0.06222946,0.15925118,-0.41860333,-0.74378866,-0.4118079,0.0037834048,1.5126028,-0.061137974,0.6123931,-0.03269072,0.5069015,-0.5418271,-1.5873824,0.33914813,-0.16136035,-0.31103563,0.17894292,-0.0985197,-0.21262872,-0.042688224,0.6194346,0.019581947,0.17573984,-0.26719093,1.2604337,-0.102617614,0.31531683,-0.124284625,0.6917016,0.18264659,0.1617097,0.048202414,-0.26271537,0.15094134,0.09512741,-0.054972973,-0.027183004,0.5196053,-0.15014482,0.18424168,0.024391845,0.18021879,0.3434358,0.5879235,0.639264,0.046962477,-0.10233784,-0.7766979,0.1991807],"result":{"type":"object","properties":{"stories":{"items":{"properties":{"author":{"description":"Author/poster of the story","type":"string"},"title":{"description":"Title of the story","type":"string"},"url":{"description":"URL of the story or HN discussion if no URL provided","type":"string"}},"required":["title","author","url"],"type":"object"},"type":"array"}},"required":["stories"]},"sql_tables":null,"sql_queries":null,"file_inbox":null,"oauth":null,"assets":null,"runner":"any","operating_system":["linux","macos","windows"],"tool_set":""},false]} \ No newline at end of file diff --git a/tools/hacker-news/metadata.json b/tools/hacker-news/metadata.json index ddf91337..8d6f500f 100644 --- a/tools/hacker-news/metadata.json +++ b/tools/hacker-news/metadata.json @@ -11,6 +11,9 @@ "tech", "stories" ], + "runner": "any", + "operating_system": ["linux", "macos", "windows"], + "tool_set": "", "configurations": { "type": "object", "properties": { diff --git a/tools/iterm-control/.tool-dump.test.json b/tools/iterm-control/.tool-dump.test.json new file mode 100644 index 00000000..b6a9b7ad --- /dev/null +++ b/tools/iterm-control/.tool-dump.test.json @@ -0,0 +1 @@ +{"type":"Python","content":[{"version":"1.0.0","name":"iterm-control","homepage":null,"author":"@@official.shinkai","py_code":"# /// script\n# dependencies = [\n# \"requests\",\n# ]\n# ///\n\nfrom typing import Dict, Any, Optional, List\nimport subprocess\nimport os\n\n# Map of control characters to their ASCII values\nCONTROL_CHARS = {\n 'C': 3, # Ctrl-C (SIGINT)\n 'D': 4, # Ctrl-D (EOF)\n 'Z': 26, # Ctrl-Z (SIGTSTP)\n 'L': 12, # Ctrl-L (Clear screen)\n 'U': 21, # Ctrl-U (Clear line)\n 'R': 18, # Ctrl-R (Search history)\n}\n\nclass CONFIG:\n pass # No specific configuration needed for control characters\n\nclass INPUTS:\n letter: str # The single letter to send as Ctrl-letter (e.g. 'C', 'D', 'Z')\n\nclass OUTPUT:\n success: bool # Whether the control character was successfully sent\n message: str # Result of the control operation\n\nasync def run(config: CONFIG, inputs: INPUTS) -> OUTPUT:\n output = OUTPUT()\n output.success = False\n output.message = \"\"\n\n if not inputs.letter or len(inputs.letter) != 1:\n output.message = \"You must provide a single letter to send as a control character\"\n return output\n\n control_letter = inputs.letter.upper()\n if control_letter not in CONTROL_CHARS:\n output.message = f\"Control-{control_letter} is not supported. Supported letters: {', '.join(CONTROL_CHARS.keys())}\"\n return output\n\n try:\n # Construct AppleScript command to send control character\n ascii_value = CONTROL_CHARS[control_letter]\n script_cmd = f'''\n tell application \"iTerm2\"\n tell current session of current window\n write text (ASCII character {ascii_value})\n end tell\n end tell\n '''\n\n # Execute AppleScript\n process = subprocess.Popen(\n ['/usr/bin/osascript', '-e', script_cmd],\n stdout=subprocess.PIPE,\n stderr=subprocess.PIPE\n )\n stdout, stderr = process.communicate()\n\n if process.returncode == 0:\n output.success = True\n output.message = f\"Successfully sent Control-{control_letter} (ASCII {ascii_value})\"\n else:\n output.message = f\"Failed to send Control-{control_letter}: {stderr.decode()}\"\n except Exception as e:\n output.message = f\"Error sending control character: {str(e)}\"\n\n return output ","tools":[],"config":[],"description":"Sends a control character (like Ctrl-C) to the active iTerm terminal session.","keywords":["iterm","terminal","control","key","shinkai"],"input_args":{"type":"object","properties":{"letter":{"type":"string","description":"The single letter to send as Ctrl-letter (e.g. 'C', 'D', 'Z')"}},"required":["letter"]},"output_arg":{"json":""},"activated":false,"embedding":[-0.74387544,-0.05686584,-0.38997397,0.2403236,-0.22648932,0.42956764,-0.6713481,0.38490802,0.29547188,0.29437238,-0.24656788,0.2131147,-0.2955279,0.2782889,0.14649914,-0.6849342,0.22856985,-0.66247994,-1.4073441,-0.15359133,-0.00044695102,0.51783013,0.05216853,0.14099565,-0.4174782,-0.30335027,0.26123378,0.46833307,-1.193319,-2.2110603,-0.5979305,0.17361644,-0.46196255,0.2633146,0.067886524,-0.7878793,-0.0955776,0.008635856,-0.62005335,-0.66530627,0.4715593,0.527137,-0.6663302,0.11468727,0.8241952,0.1592831,0.014719689,-0.50066245,0.9347373,0.44252652,-0.086909235,-0.3893797,-0.27205825,0.3219429,0.21927476,-0.1212426,0.2607017,0.19212922,-0.052249063,-0.020969415,0.09212319,0.67601866,-4.077604,-0.18253186,0.58100986,-0.4918396,0.3993323,0.0021703728,0.15863281,-0.1659257,-0.32843873,0.2830165,-0.48474383,0.26041028,0.44633433,-0.9853639,0.053948555,0.7902144,0.6595868,-0.7439017,0.16178703,0.7971327,-0.0551162,0.030371629,-0.41041365,0.6232648,-0.62481743,-0.066901386,-0.062490985,0.17722578,-0.08295244,-0.50319195,0.18517713,-0.39987853,-0.90077114,0.21752326,0.3167319,0.44830117,0.04262399,3.183698,0.30377904,0.55480635,0.36392513,-0.44994906,-0.053942226,-0.50373524,-0.025384126,-0.42920035,-0.18657033,-0.14237593,0.24361393,-0.10938309,0.146978,0.35586098,0.673813,-0.05817689,-0.81669486,0.00919069,0.5576943,1.0380648,-0.54942083,-0.094243884,-0.8422475,-0.22071195,-0.30105135,0.5997721,-0.1792355,0.28620157,-0.13865946,0.034430414,0.41031948,-0.11203393,-0.41485086,0.08988516,-0.3006658,0.5798677,0.08333215,-0.24298294,0.13811716,-0.35259113,-0.060292542,-1.6217005,1.4255557,-0.12899144,0.48814324,0.16203243,-0.21840769,-0.0071398467,0.016618136,-0.19064306,-0.35184616,0.11331831,0.09263163,0.47977853,0.9062204,0.0022507224,-0.18515761,-0.039510086,-0.3649311,0.24068141,-0.17301185,-0.8352894,0.821843,0.5629547,0.6111652,-0.28783324,0.081751324,-0.15062055,0.21056189,-0.16475795,0.24576804,-0.64593977,0.04057606,0.03361074,-0.5775421,0.02894074,0.44061598,-0.07867459,0.04074311,-0.26014048,-0.42937744,0.8924263,-1.1968697,0.100120746,0.21998696,-0.4577878,0.358837,-0.14632997,0.09460308,0.66251826,-0.98832357,1.5198293,-0.4436183,0.2154871,-0.26224968,0.13688776,0.07370055,1.0643537,0.2069364,-0.07754075,-0.6398817,-0.6138818,-0.64265203,0.20654112,-0.06893442,-0.15321447,1.1982305,0.46659297,-0.30996817,0.13975912,0.3788466,-0.27748296,0.6362859,0.34888798,0.89228916,-0.11631559,-0.17693561,-0.04342637,-0.27479932,0.77257705,0.5135624,0.4632049,-0.5207645,-0.5437895,0.17447254,-0.06123118,0.0587435,0.35298997,-0.6557804,-0.34476313,0.19253229,0.39802936,0.46653846,0.37459534,0.57454807,0.32805175,-0.1607185,0.3437199,0.29742742,-0.5018697,0.047516067,0.1449366,0.40754098,0.12787312,0.3645115,-0.8876542,-0.35912406,-0.1519477,-0.26891974,1.0173137,0.61253566,0.10789758,0.8845436,0.0237693,-0.3529191,-0.027276285,-1.6406608,-0.69619477,-0.8395607,0.5044077,0.23422655,0.007682249,0.31421208,0.87190276,-0.4378016,-0.28821215,-0.48714724,0.066612616,-0.19859728,0.11547565,-0.5735053,0.5448764,0.46908265,-0.4404403,0.45699418,-0.4766868,0.047545828,-0.0040002167,-0.28191933,-0.24365078,-0.4517097,0.3734935,0.115571804,-0.0633115,-0.5005659,-0.017303593,-0.7200837,-0.5836169,-0.09511221,-0.024481103,0.12159773,-0.51196134,0.49007738,0.053790487,2.363547,0.83416057,-0.65297127,0.40985617,-0.02741702,0.23330435,0.5568253,-0.4698279,0.07727255,0.1705313,-0.8372787,-0.527559,0.5788928,-0.26737586,-0.4276992,0.6088577,-0.47332448,0.062545195,0.2709703,-0.2149294,1.0345049,0.33416086,0.19108842,0.5187738,-0.3629274,-1.8146774,-0.526747,0.12705314,-0.009758361,0.21672788,-0.44259676,0.21006218,-0.34354228,0.35392925,-0.3743366,0.8514092,0.87419236,-0.07840678,0.84848404,-0.4056279,0.9955884,0.7005422,0.20088191,-0.16265067,-0.31563598,-0.71928275,0.06939018,1.7554827,-0.23796286,-0.024146665,0.11388484,0.1560224,-0.8194919,-1.6009766,-0.08631982,-0.19561872,-0.22251165,1.0979834,-0.13789679,-0.40136802,0.25962377,0.35794204,0.17451185,-0.32870603,-0.37485954,1.6814411,0.51925987,0.21952307,-0.66417885,0.38466728,0.11225407,-0.09951165,0.71270263,-0.9527084,-0.01668308,0.5407486,0.62458456,0.027736299,-0.003148958,0.7711102,0.4856375,0.085713,-0.096647896,0.1714249,0.18943447,0.06695408,0.571121,0.044404894,-1.0844145,-0.18995981],"result":{"type":"object","properties":{"message":{"description":"Result of the control operation","type":"string"},"success":{"description":"Whether the control character was successfully sent","type":"boolean"}},"required":["success","message"]},"sql_tables":[],"sql_queries":[],"file_inbox":null,"oauth":null,"assets":null,"runner":"any","operating_system":["linux","macos","windows"],"tool_set":""},false]} \ No newline at end of file diff --git a/tools/iterm-control/metadata.json b/tools/iterm-control/metadata.json index 4924e847..0ed188e6 100644 --- a/tools/iterm-control/metadata.json +++ b/tools/iterm-control/metadata.json @@ -4,6 +4,9 @@ "description": "Sends a control character (like Ctrl-C) to the active iTerm terminal session.", "author": "Shinkai", "keywords": ["iterm", "terminal", "control", "key", "shinkai"], + "runner": "any", + "operating_system": ["linux", "macos", "windows"], + "tool_set": "", "configurations": { "type": "object", "properties": {} diff --git a/tools/iterm-read/.tool-dump.test.json b/tools/iterm-read/.tool-dump.test.json new file mode 100644 index 00000000..c89a229a --- /dev/null +++ b/tools/iterm-read/.tool-dump.test.json @@ -0,0 +1 @@ +{"type":"Python","content":[{"version":"1.0.0","name":"iterm-read","homepage":null,"author":"@@official.shinkai","py_code":"# /// script\n# dependencies = [\n# \"requests\",\n# ]\n# ///\n\nfrom typing import Dict, Any, Optional, List\nimport subprocess\nimport os\n\nclass CONFIG:\n pass # No specific configuration needed for reading\n\nclass INPUTS:\n lines_of_output: int = 25 # Number of lines of terminal output to fetch\n\nclass OUTPUT:\n terminal_output: str # The last N lines of terminal output\n success: bool # Whether the read operation was successful\n message: str # Success or error message\n\nasync def run(config: CONFIG, inputs: INPUTS) -> OUTPUT:\n output = OUTPUT()\n output.terminal_output = \"\"\n output.success = False\n output.message = \"\"\n\n try:\n # Construct AppleScript command to get terminal content\n script_cmd = f'''\n tell application \"iTerm2\"\n tell current session of current window\n get contents\n end tell\n end tell\n '''\n\n # Execute AppleScript\n process = subprocess.Popen(\n ['/usr/bin/osascript', '-e', script_cmd],\n stdout=subprocess.PIPE,\n stderr=subprocess.PIPE\n )\n stdout, stderr = process.communicate()\n\n if process.returncode == 0:\n # Get the terminal output and split into lines\n all_lines = stdout.decode().split('\\n')\n \n # Get the last N lines based on input parameter\n requested_lines = min(inputs.lines_of_output, len(all_lines))\n output.terminal_output = '\\n'.join(all_lines[-requested_lines:])\n \n output.success = True\n output.message = f\"Successfully read {requested_lines} lines from iTerm\"\n else:\n output.message = f\"Failed to read from iTerm: {stderr.decode()}\"\n except Exception as e:\n output.message = f\"Error reading from iTerm: {str(e)}\"\n\n return output ","tools":[],"config":[],"description":"Reads output from the active iTerm terminal.","keywords":["iterm","terminal","read","automation","shinkai"],"input_args":{"type":"object","properties":{"lines_of_output":{"type":"number","description":"Number of lines of terminal output to fetch"}},"required":[]},"output_arg":{"json":""},"activated":false,"embedding":[-0.22957829,0.22635247,-0.3215977,0.40987766,-0.1368842,0.17635745,-0.6520287,0.4911505,0.054535527,-0.06140007,0.077487886,0.035005078,-0.10004104,-0.17299297,0.12755151,-0.23851976,-0.053667646,-0.73363423,-1.0852563,-0.20247748,0.3537299,0.37965354,-0.006039962,-0.13339746,-0.20685548,-0.03849,-0.06830484,0.32631534,-1.6951559,-2.3935206,-0.49252728,0.12567163,-0.21276782,0.060193688,-0.40173173,-0.8556714,0.115124606,-0.059054166,-0.8047851,-0.66600084,0.28697318,0.79973435,-0.05784482,-0.01619996,0.389717,0.27411813,-0.1065883,-0.87053514,0.72247857,0.6970907,-0.0010794513,-0.40112036,-0.033495132,0.036649793,-0.110157184,-0.70292246,0.6555196,0.080127254,-0.14101484,-0.05653894,0.17535493,0.8061957,-4.496131,-0.2889403,0.5096716,-0.3904212,0.23548417,0.5492396,0.020494424,-0.011630312,-0.46155286,0.15034945,-0.06489244,-0.015438378,0.29635555,-0.6133377,0.06956297,0.34818846,0.40836167,-0.38497987,-0.08283919,0.59284043,-0.39860493,0.21120782,-0.16903783,0.87565804,-0.78365254,-0.27421606,0.13483058,0.32324344,0.09421076,-0.35083637,-0.34842387,0.16369015,-0.35503086,0.20106176,0.018835474,0.8319693,0.083906,3.0546463,0.8613964,0.81999403,-0.24245262,-0.3496078,-0.10298639,-0.72950053,0.0085937865,-0.35219455,-0.13698538,-0.13035543,0.40150547,-0.35244992,0.7023711,0.39235818,0.6232072,0.046506107,-0.80942553,-0.30210868,0.3675568,0.44141757,-0.5116375,-0.045475367,-0.9029166,-0.47532868,-0.08046745,0.26581305,0.41587502,0.21020114,-0.21191947,-0.17351563,0.558619,-0.10584189,-0.29167473,0.034799673,0.07653007,0.6598865,0.11266271,-0.41588107,-0.046673574,-0.37395164,-0.24808758,-1.8308097,1.42177,0.119524516,0.51556295,0.002241794,0.34828714,0.6165847,0.15640439,0.16909781,-0.12593555,-0.050217986,0.02486263,0.47880685,0.5226082,-0.013918909,-0.30131865,0.19211678,-0.15854526,0.30973658,-0.49142176,-0.3327609,0.7180582,0.018322244,0.39401382,-0.17215872,-0.20015752,-0.09352928,0.4413729,-0.1623745,0.5784191,-0.71732366,-0.16926433,0.52854186,-0.71703047,0.20044091,-0.009378754,-0.15892985,0.07884979,-0.23664656,-0.16888207,0.6472145,-0.49344832,-0.072999306,-0.041202083,-0.33191988,0.74463564,0.13907436,0.5746264,1.2725383,-0.61484027,2.1359859,-0.6324833,0.028685436,-0.38822392,-0.5995446,-0.11218159,0.8158216,0.033667292,-0.15148963,-0.7139773,0.21057123,-0.43662298,0.31225884,0.055646487,-0.4142151,0.51981395,0.11660878,0.022645626,-0.2935256,0.035981692,-0.3632048,-0.21918464,0.47435048,0.4828312,0.048861813,-0.11044006,-0.2667667,-0.29771933,0.6347306,0.14299801,0.28774592,-0.7408407,-0.51839125,-0.2016756,0.29117018,0.10293961,0.14706771,-0.54042476,-0.28892902,0.048897706,0.23596875,0.7277885,0.51883316,0.3654718,0.30830547,-0.0986316,0.30571347,0.5026537,0.04917441,0.16303979,0.003156796,0.38532203,-0.28669685,0.17772654,-0.44180238,-0.30301392,0.29003248,0.077637166,1.1151646,0.6567704,0.020965237,0.58880776,0.19364902,-0.20887306,0.15860888,-1.2974468,-0.5755642,-0.55956227,0.5058279,0.41847956,-0.21439931,0.55556715,0.9743921,-0.21233207,-0.21181495,-0.39392903,-0.3337408,-0.012327135,0.13439423,-0.6169352,0.67622006,0.07238661,-0.49962246,0.17755602,-0.39176226,0.05058863,0.003127575,0.078358315,-0.057500593,-0.11222974,0.0039635748,0.6091613,-0.23220567,-0.13677666,-0.058827102,-0.69377184,-0.26514435,-0.47118324,-0.14321256,0.24515638,-0.5357779,-0.21572132,0.0021215081,2.3015056,0.33224916,-0.60098314,0.4347328,0.26829454,0.48180836,0.24073985,-0.33012548,-0.66602623,0.115940616,-0.8243942,-0.6011689,0.36189246,0.18568298,-0.3560828,0.7188558,-0.6571009,-0.18969518,0.2977341,-0.18629208,0.9247366,-0.07865451,-0.19522054,0.29162383,-0.15608007,-1.849126,-0.7246059,-0.48572895,0.11840643,0.26624402,-0.46071142,0.5143986,-0.6364104,0.17942071,-0.400549,0.51315147,0.90804625,-0.22826602,0.64107597,-0.2128416,0.96993554,0.45447424,0.24040274,-0.05739238,-0.2015993,-0.19784829,0.048106723,1.9531267,0.0733015,0.080389515,0.4787758,0.35555434,-0.85434145,-1.8237178,0.05734076,0.09569079,-0.16351533,0.9049572,-0.103293955,-0.6886367,0.4718669,0.9915546,0.2501216,0.0032512126,-0.9057409,1.5125098,-0.14955148,0.22668217,-0.47206417,0.37066168,0.025125451,-0.06796183,0.35794526,-0.66610307,0.3188907,0.7029942,0.048035525,0.29693854,0.21906166,0.7216922,0.7924102,-0.026041426,-0.20068045,0.14082368,0.08532241,0.21102221,0.5849206,0.09504147,-0.6577157,0.12573572],"result":{"type":"object","properties":{"message":{"description":"Success or error message","type":"string"},"success":{"description":"Whether the read operation was successful","type":"boolean"},"terminal_output":{"description":"The last N lines of terminal output","type":"string"}},"required":["terminal_output","success","message"]},"sql_tables":[],"sql_queries":[],"file_inbox":null,"oauth":null,"assets":null,"runner":"any","operating_system":["linux","macos","windows"],"tool_set":""},false]} \ No newline at end of file diff --git a/tools/iterm-read/metadata.json b/tools/iterm-read/metadata.json index 6524ca30..36a3db2b 100644 --- a/tools/iterm-read/metadata.json +++ b/tools/iterm-read/metadata.json @@ -4,6 +4,9 @@ "description": "Reads output from the active iTerm terminal.", "author": "Shinkai", "keywords": ["iterm", "terminal", "read", "automation", "shinkai"], + "runner": "any", + "operating_system": ["linux", "macos", "windows"], + "tool_set": "", "configurations": { "type": "object", "properties": {} diff --git a/tools/iterm-write/.tool-dump.test.json b/tools/iterm-write/.tool-dump.test.json new file mode 100644 index 00000000..399bbe58 --- /dev/null +++ b/tools/iterm-write/.tool-dump.test.json @@ -0,0 +1 @@ +{"type":"Python","content":[{"version":"1.0.0","name":"iterm-write","homepage":null,"author":"@@official.shinkai","py_code":"# /// script\n# dependencies = [\n# \"requests\",\n# ]\n# ///\n\nfrom typing import Dict, Any, Optional, List\nimport subprocess\nimport os\n\nclass CONFIG:\n use_applescript: bool = True # Whether to use AppleScript to write text to iTerm\n\nclass INPUTS:\n command: str # The command or text to write into the active iTerm session\n\nclass OUTPUT:\n lines_output: int # Number of new lines that appeared in iTerm after the command\n success: bool # Whether the command was successfully written\n message: str # Success or error message\n\ndef escape_for_applescript(text: str) -> str:\n \"\"\"Escape special characters for AppleScript.\"\"\"\n return text.replace('\\\\', '\\\\\\\\').replace('\"', '\\\\\"').replace(\"'\", \"'\\\\''\")\n\nasync def run(config: CONFIG, inputs: INPUTS) -> OUTPUT:\n output = OUTPUT()\n output.lines_output = 0\n output.success = False\n output.message = \"\"\n\n if not inputs.command:\n output.message = \"No command specified to write to the iTerm terminal\"\n return output\n\n try:\n # Construct AppleScript command\n script_cmd = f'''\n tell application \"iTerm2\"\n tell current session of current window\n write text \"{escape_for_applescript(inputs.command)}\"\n end tell\n end tell\n '''\n\n # Execute AppleScript\n process = subprocess.Popen(\n ['/usr/bin/osascript', '-e', script_cmd],\n stdout=subprocess.PIPE,\n stderr=subprocess.PIPE\n )\n stdout, stderr = process.communicate()\n\n if process.returncode == 0:\n output.success = True\n output.message = \"Command successfully written to iTerm\"\n output.lines_output = len(inputs.command.split('\\n')) # Basic estimation\n else:\n output.message = f\"Failed to execute AppleScript: {stderr.decode()}\"\n except Exception as e:\n output.message = f\"Error writing to iTerm: {str(e)}\"\n\n return output ","tools":[],"config":[{"BasicConfig":{"key_name":"use_applescript","description":"Whether to use AppleScript to write text to iTerm","required":false,"type":null,"key_value":null}}],"description":"Writes a command (or text) to the active iTerm terminal.","keywords":["iterm","terminal","automation","shinkai"],"input_args":{"type":"object","properties":{"command":{"type":"string","description":"The command or text to write into the active iTerm session"}},"required":["command"]},"output_arg":{"json":""},"activated":false,"embedding":[-0.34393415,0.37095886,-0.01037458,0.7234693,0.014391165,0.43267182,-1.0061393,0.3407537,0.33073586,0.14189878,0.17365836,0.39511886,-0.27130732,0.13688652,0.15928383,-0.6192955,-0.7785784,-0.9567094,-1.255872,-0.2742488,0.061003458,0.3906004,-0.071126215,-0.25237256,0.033497594,-0.240939,0.3729414,0.37308282,-1.4022464,-2.2783186,-0.5357852,0.33919838,-0.05959461,0.06452951,-0.18005002,-0.59950364,0.20707619,0.19907418,-0.6013253,-0.6380983,0.33278582,0.24466968,-0.045243237,-0.06265372,0.40105376,0.32802525,0.022126138,-0.5796913,0.71896493,0.8483908,-0.24087049,-0.3149037,-0.3253326,0.13175705,0.08371643,-0.55339175,0.3752107,0.30166224,-0.19991381,0.27513647,0.10544737,0.9338942,-4.341695,-0.46022505,0.70756125,-0.5067897,0.6076358,0.35059452,-0.3117009,0.030683607,-0.36647645,0.36999637,-0.27616948,0.071499035,0.52087927,-0.97342485,-0.12713422,0.34318438,0.7477211,-0.38433444,0.26024887,0.6364098,-0.30517036,0.08107438,-0.5567151,0.9086637,-0.5927023,-0.3178776,0.11146738,0.08698246,-0.31550667,-0.35298055,-0.002646491,-0.03356468,-0.43917984,0.5230583,-0.0099445265,0.7539852,-0.009543404,3.1382418,0.71918243,0.734133,0.10020157,-0.38597432,0.027202833,-0.51096934,-0.41223338,-0.73507994,-0.64481306,-0.18718788,0.44673777,0.04404022,0.3716408,0.24557984,0.8017126,0.23023106,-0.838785,-0.11336121,0.085175216,0.9920437,-0.41693285,0.010565709,-1.0656613,-0.109591745,-0.3121117,0.7112912,0.095783636,0.28102452,-0.022148397,-0.27116358,0.34581998,-0.021434927,-0.118539125,0.27972776,-0.17966788,0.6396617,0.18861717,-0.5107555,0.048478913,-0.31396952,0.6449355,-1.6558098,1.6554927,0.306185,0.5585604,-0.2349821,0.13073799,0.1656445,0.106701925,-0.35713416,-0.35825872,-0.13708849,-0.07539196,0.451697,0.6031666,-0.13128142,-0.2702861,0.1352727,-0.13694423,0.37702474,-0.3817428,-0.5485153,0.6119511,0.6013497,0.51366365,-0.28408214,-0.009605482,-0.31666422,-0.28439218,-0.12252641,0.0836472,-0.73649955,-0.02657437,0.27594137,-0.83921415,0.33610323,0.31383947,-0.14389497,0.26300794,-0.1024618,-0.08498656,0.6209091,-0.5800358,-0.15088415,0.10997069,-0.28302628,0.54425997,0.37273657,0.2603713,0.8336102,-0.8567538,1.9183263,-0.23857321,0.27374953,-0.25486988,-0.21425666,0.05408147,0.713165,0.08131671,-0.4716599,-0.5703851,0.32381463,-0.70127356,0.43470708,0.29918697,-0.44856185,0.4376021,0.6850241,-0.054657735,0.02213119,0.18287468,-0.7233006,0.6211764,0.6312741,0.82521904,-0.23093532,-0.21138775,-0.11017384,0.08111446,0.4618082,0.29987472,0.3911146,-0.5268363,-0.4607462,-0.25959098,-0.13377813,0.28389764,0.30954623,-0.4915854,-0.6357898,0.37052065,0.8039486,0.67597616,0.46177188,0.1759085,0.11199484,-0.19147286,0.23103179,0.38216725,-0.34090042,0.078369305,0.1537461,0.31558335,-0.20559084,-0.0918846,-0.4902782,-0.49892643,0.13746709,0.022882508,0.953954,0.18618435,0.07499248,0.56951714,-0.19498505,-0.2825597,0.1727897,-1.6733093,-0.37152782,-0.6698324,0.5945351,0.577007,0.18822032,0.37010652,0.69680774,-0.45211074,-0.5815526,-0.18029556,-0.17616284,-0.12501796,-0.021596096,-0.74397457,0.6284508,0.13788295,-0.18221253,0.2345373,-0.5562469,-0.20351985,-0.11731971,0.2595836,-0.44867206,-0.3281336,-0.23749417,0.33187383,-0.20695423,-0.434564,-0.25600576,-0.5871712,-0.6226479,0.17226768,-0.10869729,0.52525234,-0.5767882,-0.15651083,0.5750085,2.6521707,0.7626594,-0.17814441,-0.0063814335,0.021912733,-0.06851588,0.72877955,-0.21822089,-0.5464562,0.22513057,-0.9888418,-0.5951911,0.01017854,-0.09684415,-0.21962008,0.68372476,-0.37308443,0.27969623,0.33184245,-0.21273157,0.80928284,0.2186032,-0.013446897,0.39254382,-0.20187825,-1.7239431,-0.3138396,-0.3197604,0.048393257,0.23251116,-0.2873281,0.4428512,-0.3302785,0.07706033,-0.12057393,0.3914187,0.9106842,-0.29917955,0.75525355,-0.10954515,0.73904586,0.16649134,0.4397129,0.09707348,0.04435987,-0.42873073,0.11326079,1.6698015,-0.11227339,0.033381887,0.50054836,0.17637327,-0.9936249,-1.7252719,-0.047807872,-0.19606525,-0.66187066,0.7034319,-0.24656418,-0.6245512,0.10687864,1.0971597,0.18719055,-0.38158858,-0.7894926,1.6228588,0.21149543,0.14929958,-0.16838051,0.3116264,-0.15110222,-0.07988998,0.5707295,-0.92384183,0.09650962,0.29453966,0.15400462,0.044670053,0.17770101,0.7339174,0.58735055,-0.12891178,-0.4259205,0.30564767,0.28911453,0.0741536,0.48399848,0.05396692,-0.8473539,-0.11260016],"result":{"type":"object","properties":{"lines_output":{"description":"Number of new lines that appeared in iTerm after the command","type":"number"},"message":{"description":"Success or error message","type":"string"},"success":{"description":"Whether the command was successfully written","type":"boolean"}},"required":["lines_output","success","message"]},"sql_tables":[],"sql_queries":[],"file_inbox":null,"oauth":null,"assets":null,"runner":"any","operating_system":["linux","macos","windows"],"tool_set":""},false]} \ No newline at end of file diff --git a/tools/iterm-write/metadata.json b/tools/iterm-write/metadata.json index afd55c99..12fa0102 100644 --- a/tools/iterm-write/metadata.json +++ b/tools/iterm-write/metadata.json @@ -4,6 +4,9 @@ "description": "Writes a command (or text) to the active iTerm terminal.", "author": "Shinkai", "keywords": ["iterm", "terminal", "automation", "shinkai"], + "runner": "any", + "operating_system": ["linux", "macos", "windows"], + "tool_set": "", "configurations": { "type": "object", "properties": { diff --git a/tools/macos-calendar/.tool-dump.test.json b/tools/macos-calendar/.tool-dump.test.json new file mode 100644 index 00000000..6ba33c47 --- /dev/null +++ b/tools/macos-calendar/.tool-dump.test.json @@ -0,0 +1 @@ +{"type":"Python","content":[{"version":"1.0.0","name":"macos-calendar","homepage":null,"author":"@@official.shinkai","py_code":"# /// script\n# dependencies = [\n# \"requests\",\n# ]\n# ///\n\nfrom typing import Dict, Any, Optional, List\nimport subprocess\nfrom datetime import datetime\n\nclass CONFIG:\n pass\n\nclass INPUTS:\n command: str # \"addEvent\", \"listToday\", or \"listWeek\"\n title: Optional[str] = None # for addEvent\n start_date: Optional[str] = None # \"YYYY-MM-DD HH:mm:ss\"\n end_date: Optional[str] = None\n calendar_name: Optional[str] = \"Calendar\" # default calendar\n\nclass OUTPUT:\n result: str\n\nasync def run_applescript(script: str) -> str:\n \"\"\"Helper function to run AppleScript and return its output.\"\"\"\n try:\n result = subprocess.run(['osascript', '-e', script], \n capture_output=True, \n text=True, \n check=True)\n return result.stdout.strip()\n except subprocess.CalledProcessError as e:\n return f\"Error: {e.stderr.strip()}\"\n\ndef make_applescript_date(iso_string: str, var_name: str) -> str:\n \"\"\"Convert ISO date string to AppleScript date setting commands.\"\"\"\n # Parse \"2025-01-01 14:30:00\"\n dt = datetime.strptime(iso_string, \"%Y-%m-%d %H:%M:%S\")\n return f\"\"\"\n set {var_name} to current date\n set year of {var_name} to {dt.year}\n set month of {var_name} to {dt.month}\n set day of {var_name} to {dt.day}\n set hours of {var_name} to {dt.hour}\n set minutes of {var_name} to {dt.minute}\n set seconds of {var_name} to {dt.second}\n \"\"\"\n\nasync def get_available_calendars() -> List[str]:\n \"\"\"Get list of available calendar names.\"\"\"\n script = \"\"\"\n tell application \"Calendar\"\n set calList to \"\"\n repeat with c in calendars\n set calList to calList & name of c & \"|\"\n end repeat\n return text 1 thru -2 of calList\n end tell\n \"\"\"\n result = await run_applescript(script)\n if result.startswith(\"Error:\"):\n return []\n return [name.strip() for name in result.split(\"|\") if name.strip()]\n\nasync def run(config: CONFIG, inputs: INPUTS) -> OUTPUT:\n output = OUTPUT()\n script = \"\"\n\n if inputs.command == \"addEvent\":\n if not inputs.title or not inputs.start_date or not inputs.end_date:\n raise ValueError('Missing \"title\", \"start_date\", or \"end_date\" for addEvent')\n \n # Get available calendars\n calendars = await get_available_calendars()\n if not calendars:\n raise ValueError(\"No calendars available in the system\")\n \n print(f\"Available calendars: {calendars}\") # Debug logging\n \n # Use specified calendar if it exists, otherwise use first available\n calendar_name = inputs.calendar_name if inputs.calendar_name in calendars else calendars[0]\n print(f\"Using calendar: {calendar_name}\") # Debug logging\n \n script = f\"\"\"\n tell application \"Calendar\"\n {make_applescript_date(inputs.start_date, 'theStartDate')}\n {make_applescript_date(inputs.end_date, 'theEndDate')}\n tell calendar \"{calendar_name}\"\n make new event with properties {{summary:\"{inputs.title}\", start date:theStartDate, end date:theEndDate}}\n end tell\n end tell\n return \"Event added: {inputs.title}\"\n \"\"\"\n\n elif inputs.command in [\"listToday\", \"listWeek\"]:\n period = \"today\" if inputs.command == \"listToday\" else \"this week\"\n script = f\"\"\"\n tell application \"Calendar\"\n try\n -- Initialize dates\n set periodStart to current date\n set time of periodStart to 0\n \n if \"{period}\" is \"today\" then\n set periodEnd to periodStart + 1 * days\n else\n -- Calculate week boundaries\n set weekday_num to weekday of periodStart\n if weekday_num is not 1 then\n set periodStart to periodStart - ((weekday_num - 1) * days)\n end if\n set periodEnd to periodStart + 7 * days\n end if\n \n set output to \"\"\n \n -- Get events from each calendar\n repeat with cal in calendars\n try\n set calName to name of cal\n \n -- Query events\n tell cal\n set eventList to (every event whose start date is greater than or equal to periodStart and start date is less than periodEnd)\n repeat with evt in eventList\n set evtSummary to summary of evt\n set evtStart to start date of evt\n set output to output & \"[\" & calName & \"] \" & evtSummary & \" at \" & (evtStart as string) & linefeed\n end repeat\n end tell\n \n on error errMsg\n set output to output & \"Error with calendar \" & calName & \": \" & errMsg & linefeed\n end try\n end repeat\n \n if output is equal to \"\" then\n return \"No events {period}\"\n end if\n return text 1 thru -2 of output\n \n on error errMsg\n return \"Error: \" & errMsg\n end try\n end tell\n \"\"\"\n\n else:\n raise ValueError(f\"Unknown command: {inputs.command}\")\n\n output.result = await run_applescript(script)\n return output ","tools":[],"config":[],"description":"Add or list calendar events using AppleScript","keywords":["macos","calendar","events","automation"],"input_args":{"type":"object","properties":{"start_date":{"type":"string","description":"Event start date/time in 'YYYY-MM-DD HH:mm:ss'"},"command":{"type":"string","description":"Command to execute: addEvent to create new event, listToday to show today's events"},"end_date":{"type":"string","description":"Event end date/time in 'YYYY-MM-DD HH:mm:ss'"},"calendar_name":{"type":"string","description":"Name of the calendar to add the event to (default 'Calendar')"},"title":{"type":"string","description":"Title of the event"}},"required":["command"]},"output_arg":{"json":""},"activated":false,"embedding":[0.24084587,-0.13054197,0.115952075,-0.5670627,0.55400145,0.3724088,-0.34792954,-0.30986995,-0.10935141,-0.2831021,-0.33521658,0.29728556,-0.34364122,0.113956176,0.34236005,-0.5669402,0.5497406,-0.8209586,-1.0082326,-0.3299431,-0.042138785,0.46002197,0.41764608,0.19034086,-0.27857196,0.15349892,-0.10701814,0.12228526,-1.1768771,-1.930644,0.12178117,0.29909512,0.45179,0.4289923,-0.10483775,-0.988694,-0.6309124,0.014926374,-0.50156546,-0.10569784,0.037413016,0.1277764,0.051669233,-0.71676904,0.30627093,-0.8356111,0.5884202,-0.30231804,0.5472805,0.27792078,-0.24424031,-0.3262673,0.35899663,0.47613832,-0.5770343,0.5492369,-0.34192324,0.0053697564,-0.025961436,0.06948468,-0.47369802,0.06316328,-3.6688788,-0.20218213,0.7696843,0.7126292,-0.31071874,-0.13415943,-0.2260326,0.60795486,0.12137565,-0.3096332,-0.11700893,0.80893207,-0.029856166,-0.5963228,-0.4374839,-0.15569307,0.6523998,-0.22706431,0.08896728,0.79468584,-0.48470566,0.6419803,-0.9004753,0.24069561,-0.24885494,-0.7689905,0.24519108,0.19970231,-0.22545347,0.54614013,0.4867689,-0.32814014,0.066765204,0.08893764,-0.25170514,0.5897064,0.010110252,2.914065,0.6051908,-0.2786985,0.3181174,-0.7074387,0.023756258,-0.3378815,-0.55057,-0.041310042,-0.46205893,0.05666876,-0.016072102,-0.28926784,-0.05615346,-0.016171165,0.51365083,0.21458536,-0.2784729,0.282782,-0.727788,0.33236206,-0.2087987,-0.18333468,-0.5575275,-0.054069825,-0.6560057,-0.42970628,-0.29381347,0.2635289,0.25900942,-0.77823347,0.48191077,-0.48746774,-0.5377458,-0.19048321,0.5281925,-0.02034691,-0.21956457,-0.84270614,0.29977453,0.08398523,0.39029318,-1.5423375,1.3835688,-0.10255715,0.4324179,0.4737026,0.49021474,0.038954467,-0.48832446,-0.2394307,-0.6326721,0.21042034,-0.29012564,-0.04160076,0.730331,0.11489114,-0.5526874,0.29664135,-0.5742921,0.4110739,0.2727481,-0.098180436,0.8071444,0.33471277,-0.079090066,-1.0416118,0.60287243,-0.0805808,0.28724337,-0.043477606,0.13221489,-0.20123607,0.2091733,0.6300024,0.098516434,0.61672586,-1.3657084,-0.22924986,0.63124967,-0.2640821,0.10134533,0.08115788,-0.48301712,-0.33978167,-0.07268516,1.1314325,0.4599465,0.46231392,0.5468406,0.9107449,0.12149786,2.141387,-1.1155499,-0.5488199,-0.16393864,0.7274497,0.29022086,0.8779394,0.055320553,0.48332462,-0.49716926,-0.6179452,-0.10198602,-0.02354636,0.39600843,-0.6711352,0.92489576,0.0890419,0.2233717,-0.33449867,-0.06304623,0.45115972,0.5762284,0.36348984,0.19175181,1.0817775,0.05599926,-0.058030207,0.19622824,0.1299483,0.7588511,0.91664624,-0.8908944,-0.10964879,-0.313331,-0.39148653,0.4758674,-0.9162775,-0.15767002,-0.55750066,0.45125568,-0.11364978,0.3256274,0.21525678,0.59927434,0.047237683,0.17137972,0.45717672,0.46566132,-0.88078004,-0.2677644,0.33886716,0.36786938,-0.20727947,0.47920093,0.68037486,-0.120971814,-0.2090404,0.05577652,1.3701646,0.45355183,0.67403704,0.6056147,-0.048698906,-0.50837547,-0.31270722,-1.2136756,0.17304286,-0.054585576,0.7167947,0.5094481,-0.5180493,0.4482974,0.50991243,-0.87429714,-0.46025452,-0.08169192,-0.44858626,0.07167619,0.010578968,-0.670228,0.9182925,-0.51855683,0.12697238,-0.3156856,-0.14583482,0.8591043,-0.2275753,-0.37083945,-1.0473256,-0.68257546,-0.37456563,0.3259909,0.45016462,0.24171919,-1.1694219,0.17098808,-0.3099727,-0.643004,-0.23717323,-0.21246493,-1.5493573,0.25576577,0.10588311,2.9276302,-0.070474386,0.25998455,0.9223976,0.1715294,-0.018470004,-0.21358564,0.03269106,-0.39115545,-0.39203736,-1.1130232,-0.16983336,0.5148885,-0.471108,-0.10848551,0.63807964,-0.16836393,0.3490545,0.22681749,-0.020830527,1.2583841,-0.35575885,0.580348,0.9610281,-0.4987457,-2.0175254,-0.03042052,-0.13823482,0.18873087,-0.5185498,-0.28590497,0.43438637,0.60977834,0.22402687,-0.3834632,1.3136519,0.51509917,0.13937005,-0.4372589,-0.097712934,0.91980314,-0.07182715,0.75129676,0.046730097,-0.91400725,-0.28728735,0.7387859,1.4654028,-0.043629885,0.13343795,-0.05951313,-0.021064974,-0.1785484,-0.80715495,0.32261345,0.5077842,-0.59436196,0.4932473,0.37026206,-0.16685817,0.60666126,0.8718438,-0.8816702,-0.13763647,-0.7622934,1.4222801,-0.0058856104,0.24345453,-0.43616313,-0.3902143,0.71076214,0.0060428903,0.7954583,0.28959715,-0.38009816,0.4415986,-0.42146003,-0.7566108,-0.03280762,-0.18373977,0.35722783,0.39993155,-0.24660431,0.19217762,0.26992846,-0.108007535,-0.31760967,-0.012318198,-0.22083013,-0.61402327],"result":{"type":"object","properties":{"result":{"description":"Message describing what happened","type":"string"}},"required":["result"]},"sql_tables":null,"sql_queries":null,"file_inbox":null,"oauth":null,"assets":null,"runner":"any","operating_system":["linux","macos","windows"],"tool_set":""},false]} \ No newline at end of file diff --git a/tools/macos-calendar/metadata.json b/tools/macos-calendar/metadata.json index 1ef16cf5..ed0d72e5 100644 --- a/tools/macos-calendar/metadata.json +++ b/tools/macos-calendar/metadata.json @@ -10,6 +10,9 @@ "events", "automation" ], + "runner": "any", + "operating_system": ["linux", "macos", "windows"], + "tool_set": "", "configurations": { "type": "object", "properties": {}, diff --git a/tools/macos-clipboard/.tool-dump.test.json b/tools/macos-clipboard/.tool-dump.test.json new file mode 100644 index 00000000..ed1f54a7 --- /dev/null +++ b/tools/macos-clipboard/.tool-dump.test.json @@ -0,0 +1 @@ +{"type":"Python","content":[{"version":"1.0.0","name":"macos-clipboard","homepage":null,"author":"@@official.shinkai","py_code":"# /// script\n# dependencies = [\n# \"requests\",\n# ]\n# ///\n\nfrom typing import Dict, Any, Optional, List\nimport subprocess\n\nclass CONFIG:\n pass\n\nclass INPUTS:\n command: str\n content: Optional[str] = None # for setClipboard\n content_type: Optional[str] = \"text\" # for getClipboard\n\nclass OUTPUT:\n result: str\n\nasync def run_applescript(script: str) -> str:\n \"\"\"Helper function to run AppleScript and return its output.\"\"\"\n try:\n result = subprocess.run(['osascript', '-e', script], \n capture_output=True, \n text=True, \n check=True)\n return result.stdout.strip()\n except subprocess.CalledProcessError as e:\n return f\"Error: {e.stderr.strip()}\"\n\nasync def run(config: CONFIG, inputs: INPUTS) -> OUTPUT:\n output = OUTPUT()\n script = \"\"\n\n if inputs.command == \"getClipboard\":\n if inputs.content_type == \"filePaths\":\n script = \"\"\"\n tell application \"System Events\"\n try\n set theClipboard to the clipboard\n if theClipboard starts with \"file://\" then\n set AppleScript's text item delimiters to linefeed\n set filePaths to {}\n repeat with aLine in paragraphs of (the clipboard as string)\n if aLine starts with \"file://\" then\n set end of filePaths to (POSIX path of (aLine as alias))\n end if\n end repeat\n return filePaths as string\n else\n return \"No file paths in clipboard\"\n end if\n on error errMsg\n return \"Failed to get file paths: \" & errMsg\n end try\n end tell\n \"\"\"\n else:\n script = \"\"\"\n tell application \"System Events\"\n try\n return (the clipboard as text)\n on error errMsg\n return \"Failed to get clipboard: \" & errMsg\n end try\n end tell\n \"\"\"\n\n elif inputs.command == \"setClipboard\":\n if not inputs.content:\n raise ValueError('Missing \"content\" for setClipboard')\n script = f\"\"\"\n try\n set the clipboard to \"{inputs.content}\"\n return \"Clipboard set successfully\"\n on error errMsg\n return \"Failed to set clipboard: \" & errMsg\n end try\n \"\"\"\n\n elif inputs.command == \"clearClipboard\":\n script = \"\"\"\n try\n set the clipboard to \"\"\n return \"Clipboard cleared\"\n on error errMsg\n return \"Failed to clear clipboard: \" & errMsg\n end try\n \"\"\"\n\n else:\n raise ValueError(f\"Unknown command: {inputs.command}\")\n\n output.result = await run_applescript(script)\n return output ","tools":[],"config":[],"description":"Manage macOS clipboard via AppleScript","keywords":["macos","clipboard","automation","applescript"],"input_args":{"type":"object","properties":{"content_type":{"type":"string","description":"When getClipboard, specify if it's text or file paths"},"command":{"type":"string","description":"Command to execute: getClipboard to read, setClipboard to write, clearClipboard to clear"},"content":{"type":"string","description":"Text to put in clipboard for setClipboard"}},"required":["command"]},"output_arg":{"json":""},"activated":false,"embedding":[-0.4532567,-0.85333365,0.19835573,-0.6768733,-0.18374504,-0.5219369,-0.46943685,0.15664229,0.4565581,0.023268912,0.36509764,0.58694917,-0.5991283,0.82210904,-0.26276585,-0.35811457,-0.059841756,-0.2980946,-0.5447728,-0.15613756,0.023944255,0.71622187,0.14684169,0.24175732,-0.22868308,-0.06783977,-0.39018524,-0.33512312,-1.1577991,-2.1955733,-0.080992855,0.7786919,0.66703093,0.18696356,-0.27810287,-0.73932695,-0.094201095,-0.024941467,-0.41171238,-0.08435692,0.44054356,-0.17148021,-0.17231724,-0.59345275,0.6499726,-0.32957202,0.78655374,0.20794028,1.0215139,0.7528244,-0.89652354,-0.23365766,0.50661427,-0.61536443,-0.70845455,0.70517325,0.24323225,-0.076045334,0.63486934,-0.14243723,-0.6668313,-0.35279927,-3.1634512,0.39161512,0.57511884,0.3332284,-0.07077362,-0.2712462,-0.35117355,0.34194237,0.18794736,0.027575858,-0.0765555,0.939905,0.53385055,-0.9149043,0.032510675,0.16756788,0.42056656,-0.6051044,0.10641272,0.8098252,-0.22649987,0.42951447,-1.0051224,0.60362446,-0.93025744,-0.6514747,0.26183093,0.30332077,0.0914053,0.52505916,0.7322096,-0.3151513,-0.06409214,-0.113122076,-0.551546,0.09021439,-0.33969817,2.6792495,0.81410706,-0.20147878,1.372822,-1.0697104,-0.57701325,0.04537838,-0.32218426,-0.06741125,-0.3827945,0.030103715,-0.0922863,-0.0010151304,0.040982105,-0.69973963,0.32924977,0.015599163,-0.7589914,0.032132726,-0.15592238,0.6447934,-0.12802751,0.41375893,-0.69308966,0.14609373,-0.40827984,-0.30887043,-0.43391654,0.30431858,0.17242743,-0.86556596,0.682821,-1.0547214,-0.7092001,0.3040395,-0.040150084,-0.0025362,0.14021713,-0.8098479,-0.46187288,0.07650269,0.23525053,-1.2666596,0.90156364,0.61591816,0.21185759,-0.06653739,0.8406436,0.29984617,-0.39331463,-0.37606484,-0.5515873,0.39443204,-0.51556385,-0.22748314,0.39184803,0.2287232,-0.34457153,0.88366425,-0.7651712,0.3767155,-0.53891927,-0.4599524,0.5343362,0.30490798,0.36034346,-0.6649813,0.12627234,-0.039706655,0.80317205,0.015910912,0.0038711727,-0.4231222,0.47021958,0.07438038,-0.43600416,0.23074396,-0.7469318,-0.14122283,0.01885278,-0.48966897,0.5963317,0.053224638,-0.9159974,-0.18861824,-0.70019156,0.5885336,0.35933122,-0.22285649,0.53289884,0.37550092,-0.73317873,2.133033,-0.8528613,0.11842258,-0.31208804,0.8673251,0.60348713,0.2545069,0.15324095,0.47019407,-0.448277,-0.79245156,-0.56308967,-0.25141916,0.055206798,-0.12273653,0.63365877,0.5101064,0.049190298,0.030615423,0.23401281,-0.19954899,0.79812354,0.5606405,0.71687555,-0.21257441,0.34522966,0.38033575,0.037433114,0.008384153,0.41052395,0.404196,-0.5181037,-0.2559765,0.18272318,-0.36880177,0.57361937,0.2576,0.08335589,0.14371325,0.18983603,0.8374455,0.50387794,0.066672444,0.38431206,-0.23122215,0.1334845,-0.034622103,0.06535065,-0.6023425,0.074429594,-0.061864123,-0.4678586,-0.3661238,0.51353216,-0.591802,0.48747092,0.1432819,-0.6109797,2.123444,-0.027167782,0.7149048,0.086974785,0.801142,-0.6853363,0.7265334,-0.9476754,0.40084195,-0.40091646,0.264745,0.2176485,0.03755877,0.9313834,0.19620767,-0.9590798,-0.3689799,0.4738332,-0.6308938,-0.1564749,0.31510887,-0.10385642,1.1175598,-0.40146625,-0.15630764,-1.1303657,-0.063020885,0.033033915,-0.254603,-0.48051146,-0.8695235,-0.06932784,0.19053455,-0.07802055,0.08449108,-0.44121665,-0.06482877,-0.18121305,-1.0571423,0.40893704,-0.005582109,0.4928372,-1.039463,0.19115284,0.40570736,1.9841853,0.43725047,0.13964882,0.5057896,-0.08306939,-0.26201805,-0.773517,0.012244374,0.4323193,-0.21501541,-1.4371877,-0.06060039,1.0023098,-0.16844107,-0.21958634,0.8928822,0.19418976,0.35392505,0.47884762,-0.29739645,1.060595,-0.03560537,0.2825629,0.41293,-0.14777912,-1.8979373,-0.61023474,-0.30888137,0.18711844,-0.40145093,0.104931965,0.33687222,0.16268733,0.24918711,-0.72674394,1.0389867,0.65005803,-0.12103604,0.14411442,-0.064419605,0.7839668,0.7979646,0.7157779,0.6248111,-0.8863328,-0.060523126,0.6976635,1.1815128,-0.3832925,-0.19288938,0.07765211,-1.1893886,-0.37897718,-1.4084891,0.50880945,-0.49014175,-0.47525358,0.7058579,-0.06549975,-0.024113234,0.9742323,0.45914292,-0.55122536,-0.19637457,-0.60538673,1.5285115,-0.2107924,0.37708586,-0.46598083,0.36039302,0.34854046,0.008552901,0.76085097,-0.53441215,-0.07192023,0.35513303,0.49648634,-0.3611464,0.14295891,0.10279578,0.4241394,0.51231766,-0.24861686,0.6917374,0.41756392,-0.0013369247,0.42798686,-0.6934744,-0.7187985,-0.48932093],"result":{"type":"object","properties":{"result":{"description":"Resulting text from AppleScript","type":"string"}},"required":["result"]},"sql_tables":null,"sql_queries":null,"file_inbox":null,"oauth":null,"assets":null,"runner":"any","operating_system":["linux","macos","windows"],"tool_set":""},false]} \ No newline at end of file diff --git a/tools/macos-clipboard/metadata.json b/tools/macos-clipboard/metadata.json index 137fccc0..921ea95d 100644 --- a/tools/macos-clipboard/metadata.json +++ b/tools/macos-clipboard/metadata.json @@ -10,6 +10,9 @@ "automation", "applescript" ], + "runner": "any", + "operating_system": ["linux", "macos", "windows"], + "tool_set": "", "configurations": { "type": "object", "properties": {}, diff --git a/tools/macos-finder/.tool-dump.test.json b/tools/macos-finder/.tool-dump.test.json new file mode 100644 index 00000000..8bbbe6d0 --- /dev/null +++ b/tools/macos-finder/.tool-dump.test.json @@ -0,0 +1 @@ +{"type":"Python","content":[{"version":"1.0.0","name":"macos-finder","homepage":null,"author":"@@official.shinkai","py_code":"# /// script\n# dependencies = [\n# \"requests\",\n# ]\n# ///\n\nfrom typing import Dict, Any, Optional, List\nimport subprocess\nimport os\nfrom dataclasses import dataclass\n\n@dataclass\nclass CONFIG:\n pass\n\n@dataclass\nclass INPUTS:\n command: str\n query: Optional[str] = None # For searchFiles\n location: Optional[str] = None # For searchFiles\n file_path: Optional[str] = None # For quickLookFile\n\n@dataclass\nclass OUTPUT:\n result: str = \"\"\n\nasync def run_applescript(script: str) -> str:\n \"\"\"Helper function to run AppleScript and return its output.\"\"\"\n try:\n result = subprocess.run(['osascript', '-e', script], \n capture_output=True, \n text=True, \n check=True)\n return result.stdout.strip()\n except subprocess.CalledProcessError as e:\n return f\"Error: {e.stderr.strip()}\"\n\nasync def run(config: CONFIG, inputs: INPUTS) -> OUTPUT:\n output = OUTPUT()\n script = \"\"\n\n # Validate inputs first\n if inputs.command == \"quickLookFile\":\n if not inputs.file_path:\n raise ValueError('Missing \"file_path\" for quickLookFile')\n elif inputs.command == \"searchFiles\":\n if not inputs.query:\n raise ValueError('Missing \"query\" for searchFiles')\n\n if inputs.command == \"getSelectedFiles\":\n script = \"\"\"\n tell application \"Finder\"\n try\n set selectedItems to selection\n if selectedItems is {} then\n return \"No items selected\"\n end if\n set itemPaths to \"\"\n repeat with theItem in selectedItems\n set itemPaths to itemPaths & (POSIX path of (theItem as alias)) & linefeed\n end repeat\n return itemPaths\n on error errMsg\n return \"Failed to get selected files: \" & errMsg\n end try\n end tell\n \"\"\"\n\n elif inputs.command == \"searchFiles\":\n search_location = inputs.location or \"~\"\n # Expand the path before passing it to AppleScript\n expanded_path = os.path.expanduser(search_location)\n script = f\"\"\"\n tell application \"Finder\"\n try\n set searchPath to POSIX file \"{expanded_path}\"\n set theFiles to every file of (searchPath as alias) whose name contains \"{inputs.query}\"\n set resultList to \"\"\n repeat with aFile in theFiles\n set resultList to resultList & (POSIX path of (aFile as alias)) & return\n end repeat\n if resultList is \"\" then\n return \"No files found matching '{inputs.query}' in '{search_location}'\"\n end if\n return resultList\n on error errMsg\n return \"Failed to search files: \" & errMsg\n end try\n end tell\n \"\"\"\n\n elif inputs.command == \"quickLookFile\":\n # We can safely use file_path here since we validated it above\n abs_path = os.path.abspath(os.path.expanduser(inputs.file_path))\n script = f\"\"\"\n tell application \"Finder\"\n try\n set targetFile to (POSIX file \"{abs_path}\") as alias\n select targetFile\n activate\n tell application \"System Events\"\n keystroke space\n end tell\n return \"Quick Look preview opened for {inputs.file_path}\"\n on error errMsg\n return \"Failed to open Quick Look: \" & errMsg\n end try\n end tell\n \"\"\"\n\n else:\n raise ValueError(f\"Unknown command: {inputs.command}\")\n\n output.result = await run_applescript(script)\n return output ","tools":[],"config":[],"description":"Manage files in Finder via AppleScript","keywords":["macos","finder","files","automation","applescript"],"input_args":{"type":"object","properties":{"query":{"type":"string","description":"Search term for searchFiles"},"command":{"type":"string","description":"Command to execute: getSelectedFiles to list selected items, searchFiles to find files, quickLookFile to preview"},"file_path":{"type":"string","description":"Path for quickLookFile"},"location":{"type":"string","description":"Search location (default = ~) for searchFiles"}},"required":["command"]},"output_arg":{"json":""},"activated":false,"embedding":[-0.25724694,-0.4047379,0.3471226,-0.37809652,0.60317165,-0.23180869,-0.2637221,-0.023255385,0.19749206,0.056564067,-0.16371913,0.27167997,-0.4387797,0.0862536,0.27591345,-0.5887705,-0.5314592,-0.43736735,-0.33217216,-0.076635964,0.16446146,1.0666144,-0.13850325,0.15301213,0.24355999,0.31485787,-0.6759498,-0.3001842,-1.4349357,-2.0555809,-0.17455858,0.84460044,0.12729828,0.21991694,0.12134457,-0.16431332,-0.28062758,0.16518554,-0.5822545,-0.48130447,0.21891889,0.37131393,0.316435,-0.24896914,0.29650646,-0.70268464,0.91543037,-0.34051558,0.93465644,0.7694872,-0.8345195,-0.5933414,0.58796203,-0.4220181,-0.18021983,0.3030836,0.045479942,0.04273234,0.02660347,-0.2052125,-0.4705022,-0.054963738,-3.7280207,-0.64062196,0.5342237,0.3869489,0.4794925,0.07257025,0.4175929,0.44076264,-0.16420048,0.2112268,-0.09001407,0.44565398,0.044509955,-1.0452247,-0.4588573,0.11368531,0.6252981,-0.61278427,-0.1362938,0.5518526,-0.5808219,0.39810464,-1.1493478,0.008868501,-0.6783806,-0.5847222,0.05207964,-0.042632964,-0.33766496,0.3679617,0.20569287,0.2327385,0.17729759,0.36071616,-0.27366745,0.24546897,-0.4096456,2.925907,0.82238996,0.18553324,0.54996985,-0.64025223,-0.41078752,-0.5074589,-0.13085453,0.38438743,-0.33479688,0.08913095,-0.20989706,0.2835007,0.0057844073,0.25488263,0.24165726,0.11290385,0.16666283,0.20094635,0.012648899,0.50233096,-0.54291713,0.3171106,-0.9071627,-0.16531068,-1.3165555,-0.43585622,-0.5633611,0.35148677,0.6193063,-0.68677884,0.61487204,-0.31903633,-0.80341744,-0.08117256,0.34582257,0.036400415,-0.25750262,-0.42293993,-0.49155998,-0.21172494,-0.2014527,-1.499331,0.76360995,0.39785343,-0.25849608,0.23037986,0.69182813,-0.24491805,-0.3526061,-0.6045599,-0.81530726,0.34421322,-0.09630155,0.14004478,0.5421193,-0.13307562,-0.92993027,-0.088752195,0.025327869,0.5247015,-0.31118307,-0.19085461,0.93847656,0.73747015,0.3257061,-0.63828284,0.37722868,-0.45719248,0.8180265,-0.01986321,0.3277729,-0.47503415,0.36735675,0.61192125,-0.49899113,0.7588907,-0.92425287,-0.30330747,-0.12045054,-0.5356097,0.54695964,0.31505853,-0.075617805,-0.44167024,-0.20355727,0.32888544,0.8041688,0.13503973,0.39372617,0.75465715,-0.29279602,2.073242,-0.90284044,-0.13768658,0.114514604,0.35230774,0.11609037,0.98945373,-0.06707071,0.13716064,-0.4246949,-0.19230373,0.09544164,0.41984084,0.20818391,-0.12905434,0.80866486,0.22226104,-0.4300568,-0.2867202,0.10201438,0.12801939,0.47486028,0.39971915,-0.10750784,0.62405044,-0.07738662,-0.098731145,0.2890255,0.7477149,0.13990542,0.15274677,-0.9930123,-0.32937798,0.06957224,-0.733258,0.762905,-0.43695426,-0.063261405,-0.18482444,0.095632605,0.54984283,0.62844884,-0.016765341,0.5165183,-0.3363383,-0.15583098,0.20575635,-0.070507854,-1.0397451,0.4075015,-0.06335878,-0.24829215,-0.49276853,-0.11070487,-0.28494465,-0.09833338,-0.1968087,0.32935092,1.4241071,0.49240208,1.1345115,-0.4484514,0.51400125,-0.633153,0.13212195,-1.2029796,0.1907656,-0.045051876,-0.30564976,0.43173444,-0.3112491,0.37730196,0.54786587,-0.6052462,-0.056833666,-0.059622653,-0.18694936,0.5172444,0.20613864,-0.49737927,0.82632303,-0.06783607,-0.10347021,-0.46897537,0.08355072,-0.11965438,-0.35254556,-0.45214742,-0.4401988,-0.44113725,-0.1146278,0.58122605,-0.17574386,-0.37050128,-0.47615907,-0.16995765,-0.16999635,-0.30967566,-0.41717425,-0.5597309,-1.0387206,0.25780228,0.54536134,2.4724653,0.13826571,0.08402247,0.83410144,0.21880591,-0.39752144,0.24241796,-0.3843537,-0.18911837,-0.35156754,-0.88193333,0.15067199,0.7810816,-0.29303512,-0.33354566,1.0743967,-0.30974725,0.85435957,0.6682861,-0.3342116,1.236432,-0.36807713,0.48940897,0.56395376,-0.18222709,-1.6162843,-0.2453478,-0.4698677,0.2612015,-0.41012195,0.088411205,0.69526434,0.39130002,0.22768065,-0.07879169,0.969331,0.9515954,-0.2646948,-0.53708047,-0.5215757,0.85854197,0.5238271,0.4157229,0.5613457,-0.49453637,0.15579255,0.89120775,1.9577408,-0.338372,0.017660404,0.60114706,-0.29720083,-0.75901216,-1.5034672,0.123863004,-0.23153482,-0.47774398,0.6952564,0.43520814,-0.59932554,0.59796023,1.0390893,-0.6503697,0.21176976,-0.717294,1.5545071,-0.19746086,0.058441594,-0.4878535,-0.07577956,0.5181444,-0.11720453,0.6895458,-0.5410997,-0.34101117,0.12497719,-0.08846079,-0.5425931,0.4421579,0.564537,0.15897226,1.2774613,-0.44558594,0.5586281,0.04234381,-0.1025743,0.6545923,0.094678834,-0.40203613,-0.36225802],"result":{"type":"object","properties":{"result":{"description":"Output text from AppleScript","type":"string"}},"required":["result"]},"sql_tables":null,"sql_queries":null,"file_inbox":null,"oauth":null,"assets":null,"runner":"any","operating_system":["linux","macos","windows"],"tool_set":""},false]} \ No newline at end of file diff --git a/tools/macos-finder/metadata.json b/tools/macos-finder/metadata.json index 8e8137d2..cebae610 100644 --- a/tools/macos-finder/metadata.json +++ b/tools/macos-finder/metadata.json @@ -11,6 +11,9 @@ "automation", "applescript" ], + "runner": "any", + "operating_system": ["linux", "macos", "windows"], + "tool_set": "", "configurations": { "type": "object", "properties": {}, diff --git a/tools/macos-iterm/.tool-dump.test.json b/tools/macos-iterm/.tool-dump.test.json new file mode 100644 index 00000000..874a57d0 --- /dev/null +++ b/tools/macos-iterm/.tool-dump.test.json @@ -0,0 +1 @@ +{"type":"Python","content":[{"version":"1.0.0","name":"macos-iterm","homepage":null,"author":"@@official.shinkai","py_code":"# /// script\n# dependencies = [\n# \"requests\",\n# ]\n# ///\n\nfrom typing import Dict, Any, Optional, List\nimport subprocess\n\nclass CONFIG:\n pass\n\nclass INPUTS:\n command: str\n cmd: Optional[str] = None # for runCommand\n new_window: Optional[bool] = False # for runCommand\n\nclass OUTPUT:\n result: str\n\nasync def run_applescript(script: str) -> str:\n \"\"\"Helper function to run AppleScript and return its output.\"\"\"\n try:\n result = subprocess.run(['osascript', '-e', script], \n capture_output=True, \n text=True, \n check=True)\n return result.stdout.strip()\n except subprocess.CalledProcessError as e:\n return f\"Error: {e.stderr.strip()}\"\n\nasync def ensure_iterm_window() -> str:\n \"\"\"Ensures iTerm is running and has at least one window open.\"\"\"\n script = \"\"\"\n tell application \"iTerm2\"\n activate\n if windows count = 0 then\n create window with default profile\n end if\n return \"Window ready\"\n end tell\n \"\"\"\n return await run_applescript(script)\n\nasync def run(config: CONFIG, inputs: INPUTS) -> OUTPUT:\n output = OUTPUT()\n \n # First ensure iTerm is running with a window\n await ensure_iterm_window()\n \n script = \"\"\n\n if inputs.command == \"pasteClipboard\":\n script = \"\"\"\n tell application \"iTerm2\"\n tell current window\n tell current session\n write contents of the clipboard\n end tell\n end tell\n end tell\n return \"Pasted clipboard to iTerm\"\n \"\"\"\n\n elif inputs.command == \"runCommand\":\n if not inputs.cmd:\n raise ValueError('Missing \"cmd\" for runCommand')\n \n # Escape double quotes in the command\n escaped_cmd = inputs.cmd.replace('\"', '\\\\\"')\n \n if inputs.new_window:\n script = f'''\n tell application \"iTerm2\"\n create window with default profile\n tell current window\n tell current session\n write text \"{escaped_cmd}\"\n end tell\n end tell\n return \"Ran '{escaped_cmd}' in new iTerm window\"\n end tell\n '''\n else:\n script = f'''\n tell application \"iTerm2\"\n tell current window\n tell current session\n write text \"{escaped_cmd}\"\n end tell\n end tell\n return \"Ran '{escaped_cmd}' in existing iTerm window\"\n end tell\n '''\n\n else:\n raise ValueError(f\"Unknown command: {inputs.command}\")\n\n output.result = await run_applescript(script)\n return output ","tools":[],"config":[],"description":"Control iTerm via AppleScript","keywords":["macos","iterm","terminal","automation","applescript"],"input_args":{"type":"object","properties":{"command":{"type":"string","description":"Command to execute: pasteClipboard to paste clipboard content, runCommand to execute shell command"},"new_window":{"type":"boolean","description":"Whether to run command in a new window (default false)"},"cmd":{"type":"string","description":"Command to run if using runCommand"}},"required":["command"]},"output_arg":{"json":""},"activated":false,"embedding":[-0.6174755,-0.10309458,0.010183305,-0.31834206,-0.08121098,0.19517013,-0.09264413,0.04734598,0.29301354,0.30429864,-0.012572861,0.037306793,-0.40109852,0.2642547,0.0013151579,-0.70791274,-0.313662,-0.66830313,-0.70859575,-0.38552466,0.2572361,0.28641635,-0.19604886,-0.0404628,0.11432397,0.38421094,-0.19052394,0.22292067,-1.3799169,-2.1068676,-0.25813872,0.3993243,-0.03514892,0.13849594,-0.1904093,-1.1226226,-0.38102463,-0.13450454,-0.6861593,-0.647355,0.45747322,0.35654905,-0.051792856,-0.260364,0.68724,-0.09858716,0.82055575,-0.5064329,0.601179,0.5684559,-0.5474684,-0.52430147,0.17014003,-0.019049902,-0.58533406,0.31526875,0.07959847,-0.05551634,-0.09156948,-0.16857171,-0.03332394,0.35673505,-4.1163435,-0.1489222,1.1198908,-0.035632454,0.15390892,0.23636034,-0.11852927,0.072838664,0.40649733,0.30904025,-0.06998034,0.4720339,0.41449472,-0.98029286,-0.3070209,0.478896,0.58512694,-0.56922626,-0.062576905,0.7126153,-0.17032115,-0.032055683,-0.9244113,0.51239955,-0.6096387,-0.4537453,-0.04547119,0.08163945,0.08844346,-0.07285814,0.109334655,-0.21316978,0.039276455,0.5096647,-0.19740672,0.1447122,-0.10284018,3.109328,0.5850906,-0.015131518,0.17572555,-0.4436378,-0.51616794,-0.25449115,0.011239093,-0.005214827,-0.43275085,0.2728721,-0.18768878,0.467139,-0.12070134,0.09391321,0.5411091,0.16121054,0.1519401,-0.037980285,-0.04936352,0.4888931,-0.41648605,0.19727302,-0.80401313,-0.49781388,-1.1088655,-0.11403142,-0.4691572,0.31150275,0.305837,-0.38708234,0.4045537,-0.32221872,-0.32715958,0.34671634,0.51094884,0.45165837,-0.07846424,-0.5938791,0.013920974,-0.00488209,0.25761598,-1.7855788,0.89477307,0.017984655,0.4662076,0.26771885,0.6330695,-0.24875367,-0.22465557,0.08668608,-0.5709328,0.38508564,-0.39794052,-0.037522897,0.9063665,0.17758325,-0.2692448,0.21427932,-0.4035367,0.6222892,-0.008219169,-0.33759564,1.069496,0.80398124,0.2776436,-0.6656463,0.09172675,-0.3496636,0.3661678,-0.39034656,0.088766545,-0.4489012,0.24632321,0.37643343,-0.6936422,0.27188963,-0.55628705,0.13196155,0.25030014,-0.41390958,0.18951394,0.3556518,-0.9234025,-0.043805122,0.11053245,0.36798695,0.397567,0.24759284,0.054455433,0.40296456,-0.46848747,2.0453608,-0.59835476,0.03492228,-0.4247686,0.45046794,0.37628353,0.91560394,-0.2369592,0.0037251534,-0.68596685,-0.3514743,-0.3759088,0.34257093,0.32342023,-0.23859759,1.0434635,0.20557326,0.12989253,0.33369854,-0.11686689,-0.48135272,0.14448729,0.49639574,0.48684287,0.20864473,-0.26369554,-0.019567285,-0.056562297,0.6564734,0.5632012,-0.1725021,-0.86003417,-0.2882439,-0.28188026,-0.33912158,-0.06767427,-0.16208762,-0.34860298,-0.080663905,0.50671846,0.47952116,0.5085754,0.03933747,0.42298466,-0.17161417,-0.065992706,0.4263408,0.3117239,-0.41104326,0.07161869,-0.24649274,0.39141834,-0.26129794,0.42540818,-0.31021482,-0.40936893,-0.36517745,-0.3202133,1.3853469,0.20964858,0.7021725,0.27666622,0.16957258,-0.5147544,0.3988086,-1.2691921,0.1926929,-0.44863874,0.47350213,0.7383211,-0.15082371,0.4831315,0.5796599,-0.78885734,-0.16844004,0.016800163,-0.4414662,0.14244431,0.16770548,-0.8583368,1.1228079,0.21425827,-0.2771502,-0.086184025,-0.2269722,-0.06604016,-0.4067682,0.013880953,-0.81326306,-0.3841389,0.00923996,0.19185586,0.13103765,-0.07389329,-0.31770116,-0.39048794,-0.3919552,0.13909422,-0.63280547,0.06403939,-0.79131603,0.4204365,0.21849704,2.4867263,0.69769275,-0.21658237,0.69849306,0.0067717335,0.12140106,0.19902977,-0.16750559,-0.33714226,-0.27400294,-1.0052856,-0.13770725,0.8760103,-0.52045566,-0.54221034,0.6615481,-0.72376573,0.46295732,0.4700818,-0.15590191,1.8594447,0.38746962,0.22704828,0.46409577,-0.05237993,-2.0490143,-0.9042422,-0.37603226,0.1873344,-0.14486441,-0.051087897,0.70532364,0.5666112,0.37357363,-0.20944834,0.93652666,0.83086145,0.09310629,0.020360555,0.12195497,0.5679636,0.5421683,0.2800897,0.324405,-0.8445316,-0.4360096,0.7327486,1.8568959,-0.26396152,0.04444551,0.63763106,-0.17076984,-1.0801939,-1.4623474,0.12062667,-0.00891684,-0.08617131,0.773773,0.13750616,-0.38238683,0.43025035,1.0923655,-0.6615346,-0.03005803,-0.75259745,1.431675,0.156892,0.42069682,-0.6139147,0.21374904,0.25251937,-0.11718467,0.8359698,-0.6549975,-0.082368955,0.36641213,0.23211274,-0.15371099,0.39907396,0.4413237,0.365576,0.4443518,-0.5699567,0.20593901,0.1493851,-0.18153134,0.14191115,-0.33885658,-0.7665816,-0.0007169023],"result":{"type":"object","properties":{"result":{"description":"Message describing what happened","type":"string"}},"required":["result"]},"sql_tables":null,"sql_queries":null,"file_inbox":null,"oauth":null,"assets":null,"runner":"any","operating_system":["linux","macos","windows"],"tool_set":""},false]} \ No newline at end of file diff --git a/tools/macos-iterm/metadata.json b/tools/macos-iterm/metadata.json index bf6a2605..9968375d 100644 --- a/tools/macos-iterm/metadata.json +++ b/tools/macos-iterm/metadata.json @@ -11,6 +11,9 @@ "automation", "applescript" ], + "runner": "any", + "operating_system": ["linux", "macos", "windows"], + "tool_set": "", "configurations": { "type": "object", "properties": {}, diff --git a/tools/macos-notifications/.tool-dump.test.json b/tools/macos-notifications/.tool-dump.test.json new file mode 100644 index 00000000..3064f077 --- /dev/null +++ b/tools/macos-notifications/.tool-dump.test.json @@ -0,0 +1 @@ +{"type":"Python","content":[{"version":"1.0.0","name":"macos-notifications","homepage":null,"author":"@@official.shinkai","py_code":"# /// script\n# dependencies = [\n# \"requests\",\n# ]\n# ///\n\nfrom typing import Dict, Any, Optional, List\nimport subprocess\n\nclass CONFIG:\n pass\n\nclass INPUTS:\n command: str\n title: Optional[str] = None # for sendNotification\n message: Optional[str] = None # for sendNotification\n sound: Optional[bool] = True # for sendNotification\n\nclass OUTPUT:\n result: str\n\nasync def run_applescript(script: str) -> str:\n \"\"\"Helper function to run AppleScript and return its output.\"\"\"\n try:\n result = subprocess.run(['osascript', '-e', script], \n capture_output=True, \n text=True, \n check=True)\n return result.stdout.strip()\n except subprocess.CalledProcessError as e:\n return f\"Error: {e.stderr.strip()}\"\n\nasync def run(config: CONFIG, inputs: INPUTS) -> OUTPUT:\n output = OUTPUT()\n \n if inputs.command == \"toggleDoNotDisturb\":\n script = \"\"\"\n set toggleResult to \"Error: Could not toggle Do Not Disturb via System Settings.\"\n \n -- Open System Settings directly to Focus panel\n do shell script \"open 'x-apple.systempreferences:com.apple.Focus-Settings'\"\n delay 1\n\n tell application \"System Events\"\n tell process \"System Settings\"\n -- Wait until the main window is detected\n repeat until exists window 1\n delay 0.3\n end repeat\n \n -- Make sure System Settings is frontmost\n set frontmost to true\n delay 1\n\n -- Try to find and click the Do Not Disturb row\n try\n -- First try to find it in a list/table\n set dndRow to first row of list 1 of window 1 whose name contains \"Do Not Disturb\"\n click dndRow\n delay 0.5\n \n -- Try to find and click the toggle\n try\n set toggleSwitch to first checkbox of window 1\n click toggleSwitch\n set toggleResult to \"Toggled Do Not Disturb\"\n on error\n -- If we can't find a checkbox, try clicking the row again\n click dndRow\n set toggleResult to \"Toggled Do Not Disturb\"\n end try\n on error\n try\n -- Try finding it as a table row\n set dndRow to first row of table 1 of window 1 whose name contains \"Do Not Disturb\"\n click dndRow\n delay 0.5\n \n -- Try to find and click the toggle\n try\n set toggleSwitch to first checkbox of window 1\n click toggleSwitch\n set toggleResult to \"Toggled Do Not Disturb\"\n on error\n -- If we can't find a checkbox, try clicking the row again\n click dndRow\n set toggleResult to \"Toggled Do Not Disturb\"\n end try\n on error errMsg\n set toggleResult to \"Error finding Do Not Disturb: \" & errMsg\n end try\n end try\n end tell\n end tell\n\n return toggleResult\n \"\"\"\n output.result = await run_applescript(script)\n return output\n\n elif inputs.command == \"sendNotification\":\n if not inputs.title or not inputs.message:\n raise ValueError('Missing \"title\" or \"message\" for sendNotification')\n sound_option = 'sound name \"default\"' if inputs.sound else ''\n script = f\"\"\"\n display notification \"{inputs.message}\" with title \"{inputs.title}\" {sound_option}\n return \"Notification sent\"\n \"\"\"\n output.result = await run_applescript(script)\n return output\n\n else:\n raise ValueError(f\"Unknown command: {inputs.command}\")\n\n return output ","tools":[],"config":[],"description":"Manage macOS notifications and Do Not Disturb via AppleScript","keywords":["macos","notifications","dnd","automation","applescript"],"input_args":{"type":"object","properties":{"command":{"type":"string","description":"Command to execute: toggleDoNotDisturb to toggle DND mode, sendNotification to show notification"},"message":{"type":"string","description":"Notification message for sendNotification"},"sound":{"type":"boolean","description":"Play default sound if true (default = true)"},"title":{"type":"string","description":"Notification title for sendNotification"}},"required":["command"]},"output_arg":{"json":""},"activated":false,"embedding":[-0.3379292,-0.34522402,0.15925613,-0.6137125,0.581822,0.19372015,0.13649686,-0.6408513,0.45117885,0.42907518,0.12348483,0.15439291,-0.23659936,-0.008785799,0.37067816,-0.5530812,0.27977443,-0.8354707,-0.6155579,-0.32672498,0.1985812,1.2120205,0.48909822,0.22010319,0.095020205,-0.07403621,-0.4045094,0.13908833,-0.6308382,-2.2174633,-0.22765177,0.8452572,-0.24922761,0.02061893,-0.29370221,-0.74872273,-0.19392103,0.19182296,-0.82189566,-0.32704794,0.2723416,-0.4042227,-0.10038986,-0.48908788,0.14053285,-0.6533507,0.5552205,0.32109886,0.49600005,0.3570643,-0.019890914,0.13191535,0.24711342,-0.22238925,-0.80087095,0.7066087,0.15392323,0.22752322,0.13557391,0.37116304,-0.56315154,-0.2931991,-3.280138,-0.013014166,0.35441253,0.346989,-0.008634156,-0.307747,0.084786065,-0.15709184,0.12182075,-0.1772265,-0.07110629,0.8092459,0.0017849244,-0.56360257,0.07490837,-0.30884126,0.1647559,-0.036284886,0.1250469,1.0463741,-0.38778046,0.54797083,-0.9169363,0.4413053,-0.32389578,-0.09468028,0.104161814,0.4463016,-0.31099334,0.5571939,0.017129472,-0.09191133,-0.020097278,0.18256801,-0.1624981,0.53667474,0.08868509,3.0654607,1.1004486,0.23066477,0.7689777,-0.06873241,-0.5498012,0.20977056,-0.7378958,-0.08852918,-0.12972322,0.074121036,-0.14393301,0.24094494,0.21600293,-0.09886528,0.33127135,-0.08557572,-0.3797111,0.64820224,-0.3694528,0.5841272,-0.21559384,0.065687,-0.961463,-0.63728446,-0.56082714,-0.4164074,-0.55455965,0.14066492,0.19519779,-0.64879614,0.8305429,-0.67251587,-0.578622,0.011583054,0.22401616,-0.06419837,-0.13184972,-0.9152353,-0.6016451,0.28249872,0.27144086,-2.307037,1.4100242,-0.14571494,0.6399535,-0.2213425,0.48118597,0.0046838596,-0.32108557,-0.40543145,-0.7347793,0.59259295,-0.2688118,-0.69689196,0.4448015,0.2926522,-0.5374604,0.4194719,-0.44587058,0.20916304,0.29922557,-0.38911855,0.8012434,0.6312302,0.43595397,-0.75930893,0.057199582,-0.405394,0.36926186,0.26482356,0.32495183,-0.29896724,0.15272056,0.13369843,-0.58453673,0.83757424,-0.77935374,-0.17158765,0.39996782,-0.5394914,0.44534513,0.3924582,-0.51202196,-0.14399052,-0.07283907,0.4090239,0.38743255,-0.04997153,0.22237113,0.6880628,-0.9549346,1.7552667,-0.9903485,-0.6215293,0.059431016,0.42556626,0.5993513,0.42169166,-0.30615434,0.44437376,0.122387454,-0.54940826,-0.38291144,0.85006213,-0.4056762,-0.51711345,0.8764166,0.27456966,0.3994422,-0.1452743,-0.06730719,0.3996224,0.75090045,0.4597864,0.20909177,0.6209403,-0.13320915,-0.08510204,0.09306033,0.65499294,0.9765902,0.22944319,-1.5173162,-0.2648338,-0.57768506,-0.8007003,0.5773612,-0.61519784,-0.6441967,-0.2983491,-0.22154686,1.1111817,0.4620251,-0.17598453,0.26370844,-0.46510136,0.024806745,0.3071935,0.21977213,-0.3568803,0.22376108,0.020944316,-0.27955464,-0.13245404,0.7297955,-0.10664774,0.04218498,-0.40081185,0.1456813,1.3413267,0.6590353,1.0869097,0.41870323,0.00042747706,-0.21051458,-0.15622047,-1.0366161,0.85654557,0.2485959,-0.02439769,0.7110709,0.046285883,0.31366152,0.2837152,-0.5216854,0.2642788,0.05590052,-0.13496557,-0.32697776,-0.2544767,-0.6462301,0.7286884,-0.59593135,-0.3936205,-0.50042164,-0.19442365,0.12141797,-0.4077113,-0.38135812,-0.8881291,-0.41532224,0.05538369,0.60715616,0.041336726,0.1522336,-0.5584612,0.14078115,-0.4224022,0.13975182,-0.030236285,-0.09916336,-0.9063071,0.15421857,0.29153532,2.2536998,0.47312346,0.0318048,0.7344718,0.370238,-0.122695446,0.20848343,-0.22223985,-0.5493227,-0.3497783,-0.6975191,-0.069251284,0.520535,-0.72527194,-0.73413205,0.34882987,-0.017338865,0.70371145,0.40183023,-0.3807191,1.2190202,0.58129203,0.3330791,0.91888344,0.021998223,-1.877572,-0.56956005,-0.22824997,0.58967286,-0.8959905,-0.38215286,0.64392155,0.8054429,-0.10093683,-0.31545836,0.9037585,0.9781446,-0.36787325,-0.29934126,0.029721737,0.5864411,0.044799823,0.54652077,0.13273826,-1.1583362,-0.52434504,0.8728385,1.9127536,-0.44064093,0.11440733,0.18284829,-0.20956036,-0.6788889,-1.6488113,0.8675877,0.14128876,-0.76200145,0.44695827,0.16712339,-0.5732797,0.42533478,0.95295584,-0.8819228,0.20089334,-0.42871782,1.0417967,0.04326304,0.21370962,-0.47990027,0.22746167,0.82783026,-0.25619674,0.9252834,-0.35272673,-0.44639003,0.64103836,-0.074170396,-0.32539186,0.35949117,0.19475505,-0.0379707,0.31059125,-0.240467,0.45983857,0.20382088,-0.31181863,-0.31166583,-0.10434671,-0.3505725,-0.48994792],"result":{"type":"object","properties":{"result":{"description":"Message describing what happened","type":"string"}},"required":["result"]},"sql_tables":null,"sql_queries":null,"file_inbox":null,"oauth":null,"assets":null,"runner":"any","operating_system":["linux","macos","windows"],"tool_set":""},false]} \ No newline at end of file diff --git a/tools/macos-notifications/metadata.json b/tools/macos-notifications/metadata.json index d7b4c363..e0125443 100644 --- a/tools/macos-notifications/metadata.json +++ b/tools/macos-notifications/metadata.json @@ -11,6 +11,9 @@ "automation", "applescript" ], + "runner": "any", + "operating_system": ["linux", "macos", "windows"], + "tool_set": "", "configurations": { "type": "object", "properties": {}, diff --git a/tools/macos-say-text-to-audio/.tool-dump.test.json b/tools/macos-say-text-to-audio/.tool-dump.test.json new file mode 100644 index 00000000..ab7d1502 --- /dev/null +++ b/tools/macos-say-text-to-audio/.tool-dump.test.json @@ -0,0 +1 @@ +{"type":"Python","content":[{"version":"1.0.0","name":"macOS Text-to-Speech","homepage":null,"author":"@@official.shinkai","py_code":"# /// script\n# dependencies = [\n# \"requests\"\n# ]\n# ///\n\nimport subprocess\nimport sys\nfrom typing import Dict, Any, Optional, List\n\nclass CONFIG:\n \"\"\"\n No configurations needed for this tool by default.\n But you could expand if you need environment checks, etc.\n \"\"\"\n pass\n\nclass INPUTS:\n text: str # The text to speak\n voice: str = \"Alex\" # A valid macOS voice, e.g. \"Alex\", \"Daniel\", \"Victoria\", etc.\n rate: int = 175 # Words per minute. Mac `say` defaults around 175\n background: bool = False\n\nclass OUTPUT:\n success: bool\n message: str\n\nasync def run(c: CONFIG, p: INPUTS) -> OUTPUT:\n \"\"\"\n Speaks out the given text on macOS using the 'say' command.\n \"\"\"\n # Validate platform\n if sys.platform != 'darwin':\n raise RuntimeError(\"This tool only works on macOS systems\")\n\n # Validate inputs\n text = p.text.strip()\n if not text:\n raise ValueError(\"No text provided to speak.\")\n if p.rate < 1 or p.rate > 500:\n raise ValueError(\"Rate must be between 1 and 500 words per minute.\")\n\n # Build shell command\n # Example: say -v \"Alex\" -r 175 \"Hello world\"\n # If background is True, add an ampersand at the end (shell background).\n voice_arg = f'-v \"{p.voice}\"'\n rate_arg = f'-r {p.rate}'\n quoted_text = text.replace('\"', '\\\\\"') # Escape double quotes\n cmd = f'say {voice_arg} {rate_arg} \"{quoted_text}\"'\n if p.background:\n cmd += \" &\"\n\n # Run the command\n try:\n subprocess.run(cmd, shell=True, check=True)\n success = True\n message = f\"Spoke text with voice={p.voice}, rate={p.rate}, background={p.background}\"\n except subprocess.CalledProcessError as e:\n success = False\n message = f\"Failed to speak text: {str(e)}\"\n\n output = OUTPUT()\n output.success = success\n output.message = message\n return output ","tools":[],"config":[],"description":"Speaks text aloud using macOS 'say' command. Available voices can be found by running 'say -v ?' in terminal, common voices include: Alex (default), Daniel, Karen, Samantha, Victoria","keywords":["macos","say","text-to-speech","audio"],"input_args":{"type":"object","properties":{"text":{"type":"string","description":"The text to convert to speech"},"voice":{"type":"string","description":"The voice to use (e.g., Alex, Daniel, Karen)"}},"required":["text"]},"output_arg":{"json":""},"activated":false,"embedding":[-0.20996182,-0.27047008,0.10909513,0.04681307,-0.04339981,-0.22203249,-0.42553294,0.36968714,0.42041692,-0.07031379,0.11709703,0.97172076,0.029112272,-0.28498712,0.02440672,0.42682913,0.3680531,-1.2082635,-0.31105942,0.3561033,0.37297422,0.75370383,0.3848436,0.57725435,0.19613346,-0.50523126,-0.10350728,0.11381145,-0.39592314,-1.9725611,-0.00071391463,0.2990509,0.5347829,-0.24256088,-1.11952,-0.46068838,-0.16283579,0.1045834,-0.97479296,-0.8461398,0.0010587238,0.07061922,0.15274018,-0.27455184,0.6396981,-0.23281863,0.5622311,-0.35286015,1.0481384,0.83332294,0.018731859,-0.116278626,0.121206716,0.028274829,-0.28283173,0.2959965,0.6280918,0.25802678,0.391329,0.23107098,-0.4845133,0.20167714,-3.3492155,-0.31258312,0.20189512,0.28010756,0.17528257,-0.89240515,-0.48004317,0.069471344,-0.7842263,0.048026413,0.20918822,-0.27291936,-0.47467658,-0.5117947,-0.35998368,-0.2194851,1.3171765,-0.42711642,0.7048765,0.8121859,-0.35878772,-0.35870668,-0.11962196,0.80876076,-0.8640397,-0.41617778,-0.11756031,-0.10541054,-0.77695847,0.2506544,0.21251126,0.55714095,0.29982492,0.55401665,-0.06901653,-0.31078726,0.42628017,2.9586163,0.7910265,0.25189954,1.0798883,-1.0602045,-0.27551478,-0.8909793,-0.8189616,-0.18294801,0.06306167,0.41334093,-0.12023428,-0.30702972,0.06735352,0.25207055,-0.09976285,0.37307882,-0.9709208,0.26991218,0.15915637,0.845999,-0.83233625,-0.1118194,-1.0630043,-0.0020996705,-0.05709465,-0.38672507,-0.051267467,0.597449,0.92843246,0.013641497,0.80245507,-0.40721512,-0.21673727,-0.0767016,-0.044046618,0.10810991,0.66174614,-0.5950654,-0.32807258,-0.042271417,0.2021027,-1.3844658,1.1681721,-0.14476188,0.6905505,0.49609035,-0.15002328,0.21826398,0.2418819,0.12108706,-0.35164472,0.1182407,-0.20724094,0.1485831,0.36515898,0.059260633,-0.35925156,-0.14448534,-0.8669288,0.6223891,-0.32596993,-0.3813873,0.68123955,0.053827763,0.5530129,0.23146355,0.35792375,-0.50846106,0.6481786,0.31868932,-0.06793524,-0.036215775,0.65472054,0.6408408,-0.71545744,-0.5213979,-0.31526703,-0.13973895,-0.016295243,-0.31835943,-0.2623213,0.7836248,0.33592984,0.25405258,0.39186454,0.15274103,0.15612555,0.63718486,0.54281485,0.62030137,0.27660272,1.6141438,-0.0638879,-0.22127572,-0.055859305,0.24907188,0.6267633,0.46611273,-0.002259314,0.40701175,-0.9208598,0.38595754,-0.009311108,-0.061864182,-0.68958586,-0.3364566,0.16251802,0.9116334,-0.36602592,-0.2083601,0.43137866,-0.37740082,1.0041742,0.124862336,-0.17634988,0.014128802,0.49973318,-0.21571735,0.024460623,0.448195,-0.4122584,0.21673048,-1.1399987,-0.79495734,-0.40616402,-0.6754672,0.46634066,-0.0837629,-0.19554743,-0.2401822,-0.07737016,0.80667365,0.708733,-0.14467777,0.298282,0.26236904,-0.17899883,0.0028408244,0.22405317,-0.44805685,-0.04474719,0.14121608,0.6222239,-0.05800059,0.87914956,-0.43204755,-0.025964964,-0.581528,-0.32260087,1.4657419,0.5827977,0.1521448,0.24823576,0.82179606,-0.40657517,0.3557044,-1.0780503,-0.1543586,0.107481636,0.6844785,0.4445976,0.1467362,0.26083302,0.20919928,-0.6965781,-0.24579637,-0.09168992,-0.5577704,-0.14230628,-0.35099974,0.4843237,0.00020489097,-0.054511346,-0.07374679,0.63509357,-0.29661363,-0.24423686,-0.06682042,-0.25736785,-1.3121488,-0.41780674,-0.028373186,0.37665218,0.115950614,-0.38836068,-0.88883466,-0.5172617,-0.60871726,-0.52648175,0.15403298,-0.76186115,-0.9803993,0.055575326,0.07085566,2.250808,0.26711607,-0.1917469,1.3059776,-0.06401149,0.028810438,-0.055778716,-0.1907548,-0.17497341,0.5150066,-0.8601383,0.14390829,0.8729828,0.15928315,-0.031574868,0.6805485,-0.08140559,-0.06576243,-0.20254904,-0.0598159,1.0698624,-0.32277068,0.30467135,-0.17205676,-0.100183904,-1.8166806,-0.2614048,-0.4940701,0.26879615,-0.82682586,-0.54821086,-0.051802084,-0.1578385,0.08774774,-0.4054814,0.8117478,0.5719478,-0.209771,0.16921642,-0.7640906,1.1865647,0.41583383,0.9445969,0.6564009,-1.1069878,-0.025608305,0.104455635,1.7738543,-0.32010296,-0.13775398,0.36503714,0.02555751,-0.6373846,-1.7743666,0.2136199,0.3623203,-0.5581663,0.88610613,-0.92104876,-0.33315966,-0.083643824,0.5936755,-0.46854147,-0.1420834,-0.22109479,1.3122208,-0.085376844,-0.32150435,0.38152808,0.21730469,0.43153286,0.12620139,0.3004433,-0.9986944,0.24666335,0.3445308,-0.59360635,-0.004368119,-0.039370075,0.20210335,0.04278601,0.6013774,-0.26568496,0.3201297,0.4326938,-0.19646552,0.36788496,-0.8453812,0.299692,-0.8306487],"result":{"type":"object","properties":{"message":{"description":"Success or error message","type":"string"},"success":{"description":"Whether the text was successfully converted to speech","type":"boolean"}},"required":["success","message"]},"sql_tables":[],"sql_queries":[],"file_inbox":null,"oauth":null,"assets":null,"runner":"any","operating_system":["linux","macos","windows"],"tool_set":""},false]} \ No newline at end of file diff --git a/tools/macos-say-text-to-audio/metadata.json b/tools/macos-say-text-to-audio/metadata.json index b48c06b4..5aea3118 100644 --- a/tools/macos-say-text-to-audio/metadata.json +++ b/tools/macos-say-text-to-audio/metadata.json @@ -10,6 +10,9 @@ "text-to-speech", "audio" ], + "runner": "any", + "operating_system": ["linux", "macos", "windows"], + "tool_set": "", "configurations": { "type": "object", "properties": {}, diff --git a/tools/macos-system/.tool-dump.test.json b/tools/macos-system/.tool-dump.test.json new file mode 100644 index 00000000..ca38e0fa --- /dev/null +++ b/tools/macos-system/.tool-dump.test.json @@ -0,0 +1 @@ +{"type":"Python","content":[{"version":"1.0.0","name":"macos-system","homepage":null,"author":"@@official.shinkai","py_code":"# /// script\n# dependencies = [\n# \"requests\",\n# ]\n# ///\n\nfrom typing import Dict, Any, Optional, List\nimport subprocess\n\nclass CONFIG:\n pass\n\nclass INPUTS:\n command: str\n level: Optional[int] = None # for setVolume\n app_name: Optional[str] = None # for launchApp/quitApp\n force: Optional[bool] = False # for quitApp\n\nclass OUTPUT:\n result: str\n\nasync def run_applescript(script: str) -> str:\n \"\"\"Helper function to run AppleScript and return its output.\"\"\"\n try:\n result = subprocess.run(['osascript', '-e', script], \n capture_output=True, \n text=True, \n check=True)\n return result.stdout.strip()\n except subprocess.CalledProcessError as e:\n return f\"Error: {e.stderr.strip()}\"\n\nasync def run(config: CONFIG, inputs: INPUTS) -> OUTPUT:\n output = OUTPUT()\n script = \"\"\n\n if inputs.command == \"setVolume\":\n if inputs.level is None:\n raise ValueError('Missing \"level\" for setVolume')\n # Convert 0..100 → 0..7\n volume_int = round((inputs.level / 100) * 7)\n script = f'set volume {volume_int}\\nreturn \"Volume set to {inputs.level}%\"'\n\n elif inputs.command == \"getFrontmostApp\":\n script = \"\"\"\n tell application \"System Events\"\n set frontApp to name of first process whose frontmost is true\n end tell\n return frontApp\n \"\"\"\n\n elif inputs.command == \"launchApp\":\n if not inputs.app_name:\n raise ValueError('Missing \"app_name\" for launchApp')\n script = f\"\"\"\n try\n tell application \"{inputs.app_name}\"\n activate\n end tell\n return \"Launched {inputs.app_name}\"\n on error errMsg\n return \"Failed to launch {inputs.app_name}: \" & errMsg\n end try\n \"\"\"\n\n elif inputs.command == \"quitApp\":\n if not inputs.app_name:\n raise ValueError('Missing \"app_name\" for quitApp')\n quit_cmd = \"quit saving no\" if inputs.force else \"quit\"\n script = f\"\"\"\n try\n tell application \"{inputs.app_name}\"\n {quit_cmd}\n end tell\n return \"Quit {inputs.app_name}\"\n on error errMsg\n return \"Failed to quit {inputs.app_name}: \" & errMsg\n end try\n \"\"\"\n\n elif inputs.command == \"toggleDarkMode\":\n script = \"\"\"\n tell application \"System Events\"\n tell appearance preferences\n set dark mode to not dark mode\n return \"Dark mode is now \" & (dark mode as text)\n end tell\n end tell\n \"\"\"\n\n elif inputs.command == \"getBatteryStatus\":\n script = \"\"\"\n try\n set powerSource to do shell script \"pmset -g batt\"\n return powerSource\n on error errMsg\n return \"Failed to get battery status: \" & errMsg\n end try\n \"\"\"\n\n else:\n raise ValueError(f\"Unknown command: {inputs.command}\")\n\n output.result = await run_applescript(script)\n return output ","tools":[],"config":[],"description":"Control macOS system features via AppleScript","keywords":["macos","system","volume","apps","dark-mode","battery","automation","applescript"],"input_args":{"type":"object","properties":{"level":{"type":"number","description":"Volume level (0..100) for setVolume"},"command":{"type":"string","description":"Command to execute: control system volume, app management, dark mode, or get battery status"},"app_name":{"type":"string","description":"Application name (for launchApp/quitApp)"},"force":{"type":"boolean","description":"Force quit if true (for quitApp)"}},"required":["command"]},"output_arg":{"json":""},"activated":false,"embedding":[-0.4232661,-0.5927217,-0.0017145053,-0.18587565,0.28831226,-0.20754915,-0.09449663,-0.12215481,0.06893749,-0.035253298,0.11018851,0.63002515,-0.09826636,0.21135464,0.22945791,-0.5642679,-0.027119815,-0.49394435,-0.44308516,-0.17581615,0.031097963,0.5229201,0.09036365,0.24314933,0.11527108,0.18558285,-0.038970754,-0.3103594,-1.2571026,-2.4247382,-0.12319221,0.54843646,-0.04842054,0.076105356,0.09545485,-0.9050261,-0.40273306,-0.019345276,-0.61578757,-0.25310522,0.31165636,0.046714984,-0.28913802,-0.32429492,0.69034576,-0.12173023,0.68783545,-0.022660576,0.82746696,0.15177703,-0.36154047,-0.03357707,0.24755324,0.12284826,-0.45379508,0.607577,0.055078153,-0.05689902,0.03287677,-0.3465634,-0.84137905,0.09801945,-3.62501,-0.29190567,0.842722,0.5492122,0.16086844,-0.2741007,0.032601036,-0.034874402,0.20734023,0.34546182,-0.04721097,0.7190585,-0.099382356,-0.69643867,0.34488237,-0.18129492,0.45089394,-0.7181536,0.19487225,0.42858434,-0.08950067,0.19038059,-1.1333841,0.18548158,-0.28506684,-0.5922249,0.16800857,-0.20674777,0.22443542,0.38303116,0.3815526,-0.3140818,-0.14497462,-0.057652436,-0.18811303,0.13264832,-0.49716192,3.1574597,0.9886469,0.03774539,0.76187664,-0.5150972,-0.2712609,-0.060837504,0.0074233487,-0.09737608,-0.05329378,0.071230076,-0.21959418,0.11332743,-0.15813428,-0.047264606,-0.06832263,-0.15327708,-0.019563364,0.31138048,-0.53311205,0.66071874,-0.31059638,0.062725335,-0.97546685,-0.2234076,-0.7142336,-0.44760883,-0.33852112,0.30480054,0.093522415,-0.7912599,0.67882645,-0.92993385,-0.52729136,-0.08272011,0.39796814,-0.16124019,0.12067788,-0.7918348,-0.2466459,-0.20016776,-0.0359322,-1.3913335,0.94035375,-0.0847392,0.7358751,-0.117470294,0.17160866,0.098169625,-0.30787054,-0.32648653,-0.45368868,0.56450295,-0.5286852,-0.029465912,0.5862833,0.10335991,-0.09518278,0.3186662,-0.410339,0.472509,-0.30591697,0.09206948,0.62223715,0.2686776,0.74134535,-0.36222413,0.24825925,-0.37434524,0.23303418,-0.16356857,0.2109895,-0.28409687,0.38907066,-0.025754556,-0.37613007,0.6245724,-0.7624593,-0.15922955,0.2500516,-0.43274504,0.30609918,0.24003693,-0.49109966,-0.25215745,0.032971933,0.39969006,0.29581618,0.16900843,0.0047925636,0.65033734,-0.6798435,1.884548,-1.0172789,-0.40969703,-0.11902254,0.3342442,0.50180644,0.69225186,0.08569049,0.20875308,-0.50091815,-0.24340078,-0.17584592,0.14203478,-0.08471363,-0.29344597,0.89590275,0.2567585,0.37199938,0.09615917,0.33038327,0.10325741,0.660677,0.22959355,0.6566591,0.39177406,-0.0019863993,0.17591429,0.05413506,0.9919082,0.8211705,0.04786241,-0.86706614,-0.41001555,-0.013900377,-0.52260554,0.51558703,-0.29045415,-0.2904769,-0.24918462,0.17336601,0.49567482,0.73826694,0.054079704,0.5332761,0.10811484,0.29258436,0.42977133,-0.18875259,-0.6365971,0.0811425,-0.07610704,0.0058645904,-0.33995548,0.81889045,-0.47613066,-0.09699784,-0.74433213,-0.18322264,1.5663619,0.9042603,1.2668059,0.01690973,0.082722455,-0.3935041,0.51563585,-1.1481482,0.064934775,-0.23649493,0.66671985,0.4599347,-0.007110182,0.21494785,0.3012045,-0.6445291,0.38016352,0.23530784,-0.23212776,-0.27727813,0.082822315,-0.16927946,0.75455046,-0.16023862,0.1547626,-0.06132058,-0.37281328,0.32538247,-0.15355027,-0.25551617,-0.62464297,-0.44874734,0.414574,0.14888626,0.16620314,-0.24058521,-0.6750787,-0.042370513,-0.7350121,0.00012116134,-0.066614404,-0.050913587,-0.7684775,0.2653033,0.08780649,1.9365131,0.7067156,-0.06119929,0.93206733,-0.0549903,0.04271397,-0.2885324,-0.212396,-0.100194335,0.034010015,-0.8854687,-0.20754139,0.62702143,-0.5166219,-0.49426997,0.51748145,-0.62100536,0.6262784,0.15731657,-0.60201776,1.4583179,-0.18997288,0.6630616,0.68627226,-0.27898854,-2.2445705,-0.5998848,0.12625872,0.3030389,-0.66345775,-0.30944142,0.45104706,0.8283123,0.17127854,-0.5265965,1.2831452,0.6184718,0.45880058,0.0010893364,-0.20378678,0.81012464,0.24140051,0.45346162,0.16605015,-1.2445383,-0.4419007,0.87909746,1.9437885,-0.4660004,-0.16449639,0.34056425,-0.41706568,-0.6215881,-1.549744,0.7177347,-0.12250875,-0.5613278,0.67919815,0.05589313,-0.12403918,0.18327504,0.71611017,-1.1214991,0.25526783,-0.6588437,1.3695496,0.11186172,0.5703506,-0.88356817,0.29640928,0.6915098,-0.10450789,1.002975,-0.41885218,-0.12529123,0.45605585,-0.05991346,-0.42737132,0.094749376,0.3413029,0.8461353,0.38301927,-0.048374575,0.3734223,0.08538014,-0.1474906,0.067973696,-0.5303481,-0.77321947,-0.38320327],"result":{"type":"object","properties":{"result":{"description":"Message describing what happened","type":"string"}},"required":["result"]},"sql_tables":null,"sql_queries":null,"file_inbox":null,"oauth":null,"assets":null,"runner":"any","operating_system":["linux","macos","windows"],"tool_set":""},false]} \ No newline at end of file diff --git a/tools/macos-system/metadata.json b/tools/macos-system/metadata.json index 62b9ee6c..3d020b72 100644 --- a/tools/macos-system/metadata.json +++ b/tools/macos-system/metadata.json @@ -14,6 +14,9 @@ "automation", "applescript" ], + "runner": "any", + "operating_system": ["linux", "macos", "windows"], + "tool_set": "", "configurations": { "type": "object", "properties": {}, diff --git a/tools/math-exp/.tool-dump.test.json b/tools/math-exp/.tool-dump.test.json index 1740b122..788f69f3 100644 --- a/tools/math-exp/.tool-dump.test.json +++ b/tools/math-exp/.tool-dump.test.json @@ -1 +1 @@ -{"type":"Deno","content":[{"name":"Math Expression Evaluator","homepage":null,"author":"@@official.shinkai","version":"1.0.0","js_code":"import { Parser } from 'npm:expr-eval@2.0.2';\n\ntype Configurations = {};\ntype Parameters = {\n expression: string;\n};\ntype Result = { result: string };\nexport type Run, I extends Record, R extends Record> = (config: C, inputs: I) => Promise;\n\nexport const run: Run = (\n _configurations,\n params,\n): Promise => {\n try {\n const parser = new Parser();\n const expr = parser.parse(params.expression);\n const result = expr.evaluate();\n return Promise.resolve({ ...result });\n } catch (error: unknown) {\n console.error('Error evaluating expression:', error);\n\n let errorMessage =\n 'An unknown error occurred while evaluating the expression';\n\n if (error instanceof Error) {\n errorMessage = error.message;\n } else if (typeof error === 'string') {\n errorMessage = error;\n }\n\n throw new Error(`Failed to evaluate expression: ${errorMessage}`);\n }\n};\n","tools":[],"config":[],"description":"Parses and evaluates mathematical expressions. It’s a safer and more math-oriented alternative to using JavaScript’s eval function for mathematical expressions.","keywords":["math","expr-eval","shinkai"],"input_args":{"type":"object","properties":{"expression":{"type":"string","description":"The mathematical expression to evaluate (e.g., '2 + 2 * 3')"}},"required":["expression"]},"output_arg":{"json":""},"activated":false,"embedding":[0.36967367,0.13820489,-0.18018691,-0.06061746,0.053862732,0.21220618,-0.22877245,-0.3107823,0.5681798,-0.10842194,-0.18641677,1.0145801,0.09758824,-0.46871328,0.44288108,-0.8003854,-0.27547854,0.029806692,-2.351401,-0.40808445,0.16066542,0.19848609,0.3527466,0.43821186,0.18010595,0.1713535,0.33997545,-0.33316314,-1.4285688,-1.6645143,0.18303299,0.5108868,-0.67435217,-0.15233773,-0.026045978,-0.21808416,0.0013305669,-0.00858137,-0.5878841,-0.6889627,-0.17357582,0.1827068,-0.4159857,-0.45987532,0.5200226,0.28148398,0.5548943,-0.2109483,0.71041495,0.17807344,-0.5695672,-0.3324992,0.51071566,0.21442385,0.098044075,-0.07878122,-0.29550236,-0.8045347,0.035856985,0.1700454,-0.29152042,0.48329982,-3.8031995,0.140291,1.0017263,0.37491223,0.21230449,0.12248981,-0.15960693,0.9140658,0.08892634,0.41345903,-0.2567477,0.13144514,0.52695376,-0.9829095,-0.087622836,0.10801749,0.8494919,-0.028191768,0.4844833,-0.123704284,-0.149269,0.49964926,-0.36645904,0.7687101,-0.17327076,-0.21860676,0.2667747,-0.32258928,-0.66398025,-0.39145353,-0.039533325,0.1479331,-0.65678895,0.36573893,0.34485385,0.108419515,0.61689764,2.9928799,0.4950359,-0.19744644,0.047998685,-1.2511368,0.43045107,-0.22639002,-0.28925052,0.17166206,0.5936987,0.032554977,0.2987402,-0.4508573,-0.3053726,0.29118514,0.27165344,0.62433386,-0.22101647,0.39120042,0.22517507,0.4003595,0.33603022,0.35778207,-0.4440238,0.1436653,-0.14749385,0.3546014,-0.7918863,0.43876657,-0.055472717,-0.017968806,0.6531599,0.03704976,-0.95477337,0.2029008,0.21212804,-0.3637649,0.4170754,-0.5314295,0.9451271,-0.06270531,0.4981871,-1.4777926,1.0789618,-0.27389845,1.0942268,0.15545376,-0.36948922,-0.06654019,-0.27083135,-0.21063285,-0.37044904,0.38381377,-0.084031776,0.29063785,1.0776656,0.6249772,-0.5797476,-0.3145232,0.25582728,0.22303936,0.08337048,0.10433025,0.3118384,0.682416,0.20981771,-0.7630354,0.42949808,0.28173724,-0.055977806,0.028277978,0.07644211,-0.1500487,-0.21876055,0.63717824,-0.24336761,-0.392952,0.7478404,-0.0045279264,0.2781953,-0.28795373,-0.07181533,0.50455433,-0.66905963,-0.49503186,0.11323649,0.32155833,0.41603893,0.36239958,0.19338244,0.48429978,-0.4667752,1.3982738,-0.80857515,-0.5337214,-0.32826,-0.05005458,-0.020430543,0.71022844,0.4500097,0.58962274,-0.47933018,-1.2188488,-0.039289623,-0.07938965,-0.27716693,-0.950839,0.51714313,-0.48108435,0.29074702,-0.42495376,-0.22212024,0.24877706,1.1656115,0.07707703,-0.021515436,0.17418396,-0.049847133,-0.21339005,-0.63622856,0.34684995,0.470005,-0.0014811605,-0.323857,-0.7038424,-0.39702195,0.65460336,-0.34012085,0.58842134,-0.60192543,-0.31443992,0.14376505,0.8322249,0.6937234,1.423618,0.2878114,-0.16883424,0.16429164,0.6032804,0.18053511,-0.04685873,0.26696566,-0.3231273,-0.6927969,0.30437207,-0.32643548,0.05459039,0.057466283,-1.0489061,-0.5959848,1.6899302,0.9979789,-0.3295823,0.13252099,0.51117814,-0.662587,-0.66738385,-2.0389743,-0.1492581,-0.8409445,0.22102407,-0.9486347,-1.1587538,0.9875838,0.76368,-0.6034394,0.079189554,-0.04153853,-0.7219739,-0.12851311,0.3494278,-0.15630601,0.28968954,-0.049051583,-0.34130186,-0.48374012,0.06986832,0.27204108,-0.039116576,-0.76302004,-0.2314945,0.28012154,0.51277715,-0.13342395,0.38889462,-0.3559021,-0.32951733,0.06259091,0.42546517,0.3081396,0.579204,-0.8814852,-0.104001544,-0.6395018,0.3358991,0.85187197,0.98876977,-0.345068,0.48206925,-0.6907707,-0.17400067,-0.8074576,0.26242837,0.17852136,-0.5406647,-0.2205798,-0.09535846,0.7594191,-0.39958072,-1.0405165,-0.24997479,-0.39850602,0.3604246,0.6563322,-0.05293411,0.7517185,-0.4574319,0.91073626,0.40672532,-0.19313775,-1.4429543,-0.48297805,0.45363176,-0.443804,-0.9323735,-0.6854489,0.4151727,-0.019103779,0.002061028,-0.46029502,1.4152046,0.6069861,0.24967723,-0.63946867,0.12329558,1.2102864,-0.6938691,0.06031894,0.04400401,0.070920385,-0.07568397,0.8633082,1.2616405,0.15856035,0.57713014,-0.12644015,0.22147396,-0.23180798,-1.1246669,-0.006440513,-0.21734972,-0.41508818,1.2805828,0.2694194,0.26632312,-0.0282857,0.5457553,0.4101187,0.12649411,-0.55052865,2.0240014,-0.13674003,-0.4983088,-0.49487492,-0.5951213,0.20916791,0.1301647,0.5942216,-0.60187054,-0.064847246,0.8937914,0.3362784,-0.39291066,0.2612105,-0.22315742,0.5770974,0.30526137,-0.18634716,0.40400478,-0.022974372,0.104909,0.12522572,-0.10052472,-0.6474921,-0.29402596],"result":{"type":"object","properties":{"result":{"description":"The evaluated result of the mathematical expression","type":"string"}},"required":["result"]},"sql_tables":null,"sql_queries":null,"file_inbox":null,"oauth":null,"assets":null},false]} \ No newline at end of file +{"type":"Deno","content":[{"name":"Math Expression Evaluator","homepage":null,"author":"@@official.shinkai","version":"1.0.0","js_code":"import { Parser } from 'npm:expr-eval@2.0.2';\n\ntype Configurations = {};\ntype Parameters = {\n expression: string;\n};\ntype Result = { result: string };\nexport type Run, I extends Record, R extends Record> = (config: C, inputs: I) => Promise;\n\nexport const run: Run = (\n _configurations,\n params,\n): Promise => {\n try {\n const parser = new Parser();\n const expr = parser.parse(params.expression);\n const result = expr.evaluate();\n return Promise.resolve({ ...result });\n } catch (error: unknown) {\n console.error('Error evaluating expression:', error);\n\n let errorMessage =\n 'An unknown error occurred while evaluating the expression';\n\n if (error instanceof Error) {\n errorMessage = error.message;\n } else if (typeof error === 'string') {\n errorMessage = error;\n }\n\n throw new Error(`Failed to evaluate expression: ${errorMessage}`);\n }\n};\n","tools":[],"config":[],"description":"Parses and evaluates mathematical expressions. It’s a safer and more math-oriented alternative to using JavaScript’s eval function for mathematical expressions.","keywords":["math","expr-eval","shinkai"],"input_args":{"type":"object","properties":{"expression":{"type":"string","description":"The mathematical expression to evaluate (e.g., '2 + 2 * 3')"}},"required":["expression"]},"output_arg":{"json":""},"activated":false,"embedding":[0.36967367,0.13820489,-0.18018691,-0.06061746,0.053862732,0.21220618,-0.22877245,-0.3107823,0.5681798,-0.10842194,-0.18641677,1.0145801,0.09758824,-0.46871328,0.44288108,-0.8003854,-0.27547854,0.029806692,-2.351401,-0.40808445,0.16066542,0.19848609,0.3527466,0.43821186,0.18010595,0.1713535,0.33997545,-0.33316314,-1.4285688,-1.6645143,0.18303299,0.5108868,-0.67435217,-0.15233773,-0.026045978,-0.21808416,0.0013305669,-0.00858137,-0.5878841,-0.6889627,-0.17357582,0.1827068,-0.4159857,-0.45987532,0.5200226,0.28148398,0.5548943,-0.2109483,0.71041495,0.17807344,-0.5695672,-0.3324992,0.51071566,0.21442385,0.098044075,-0.07878122,-0.29550236,-0.8045347,0.035856985,0.1700454,-0.29152042,0.48329982,-3.8031995,0.140291,1.0017263,0.37491223,0.21230449,0.12248981,-0.15960693,0.9140658,0.08892634,0.41345903,-0.2567477,0.13144514,0.52695376,-0.9829095,-0.087622836,0.10801749,0.8494919,-0.028191768,0.4844833,-0.123704284,-0.149269,0.49964926,-0.36645904,0.7687101,-0.17327076,-0.21860676,0.2667747,-0.32258928,-0.66398025,-0.39145353,-0.039533325,0.1479331,-0.65678895,0.36573893,0.34485385,0.108419515,0.61689764,2.9928799,0.4950359,-0.19744644,0.047998685,-1.2511368,0.43045107,-0.22639002,-0.28925052,0.17166206,0.5936987,0.032554977,0.2987402,-0.4508573,-0.3053726,0.29118514,0.27165344,0.62433386,-0.22101647,0.39120042,0.22517507,0.4003595,0.33603022,0.35778207,-0.4440238,0.1436653,-0.14749385,0.3546014,-0.7918863,0.43876657,-0.055472717,-0.017968806,0.6531599,0.03704976,-0.95477337,0.2029008,0.21212804,-0.3637649,0.4170754,-0.5314295,0.9451271,-0.06270531,0.4981871,-1.4777926,1.0789618,-0.27389845,1.0942268,0.15545376,-0.36948922,-0.06654019,-0.27083135,-0.21063285,-0.37044904,0.38381377,-0.084031776,0.29063785,1.0776656,0.6249772,-0.5797476,-0.3145232,0.25582728,0.22303936,0.08337048,0.10433025,0.3118384,0.682416,0.20981771,-0.7630354,0.42949808,0.28173724,-0.055977806,0.028277978,0.07644211,-0.1500487,-0.21876055,0.63717824,-0.24336761,-0.392952,0.7478404,-0.0045279264,0.2781953,-0.28795373,-0.07181533,0.50455433,-0.66905963,-0.49503186,0.11323649,0.32155833,0.41603893,0.36239958,0.19338244,0.48429978,-0.4667752,1.3982738,-0.80857515,-0.5337214,-0.32826,-0.05005458,-0.020430543,0.71022844,0.4500097,0.58962274,-0.47933018,-1.2188488,-0.039289623,-0.07938965,-0.27716693,-0.950839,0.51714313,-0.48108435,0.29074702,-0.42495376,-0.22212024,0.24877706,1.1656115,0.07707703,-0.021515436,0.17418396,-0.049847133,-0.21339005,-0.63622856,0.34684995,0.470005,-0.0014811605,-0.323857,-0.7038424,-0.39702195,0.65460336,-0.34012085,0.58842134,-0.60192543,-0.31443992,0.14376505,0.8322249,0.6937234,1.423618,0.2878114,-0.16883424,0.16429164,0.6032804,0.18053511,-0.04685873,0.26696566,-0.3231273,-0.6927969,0.30437207,-0.32643548,0.05459039,0.057466283,-1.0489061,-0.5959848,1.6899302,0.9979789,-0.3295823,0.13252099,0.51117814,-0.662587,-0.66738385,-2.0389743,-0.1492581,-0.8409445,0.22102407,-0.9486347,-1.1587538,0.9875838,0.76368,-0.6034394,0.079189554,-0.04153853,-0.7219739,-0.12851311,0.3494278,-0.15630601,0.28968954,-0.049051583,-0.34130186,-0.48374012,0.06986832,0.27204108,-0.039116576,-0.76302004,-0.2314945,0.28012154,0.51277715,-0.13342395,0.38889462,-0.3559021,-0.32951733,0.06259091,0.42546517,0.3081396,0.579204,-0.8814852,-0.104001544,-0.6395018,0.3358991,0.85187197,0.98876977,-0.345068,0.48206925,-0.6907707,-0.17400067,-0.8074576,0.26242837,0.17852136,-0.5406647,-0.2205798,-0.09535846,0.7594191,-0.39958072,-1.0405165,-0.24997479,-0.39850602,0.3604246,0.6563322,-0.05293411,0.7517185,-0.4574319,0.91073626,0.40672532,-0.19313775,-1.4429543,-0.48297805,0.45363176,-0.443804,-0.9323735,-0.6854489,0.4151727,-0.019103779,0.002061028,-0.46029502,1.4152046,0.6069861,0.24967723,-0.63946867,0.12329558,1.2102864,-0.6938691,0.06031894,0.04400401,0.070920385,-0.07568397,0.8633082,1.2616405,0.15856035,0.57713014,-0.12644015,0.22147396,-0.23180798,-1.1246669,-0.006440513,-0.21734972,-0.41508818,1.2805828,0.2694194,0.26632312,-0.0282857,0.5457553,0.4101187,0.12649411,-0.55052865,2.0240014,-0.13674003,-0.4983088,-0.49487492,-0.5951213,0.20916791,0.1301647,0.5942216,-0.60187054,-0.064847246,0.8937914,0.3362784,-0.39291066,0.2612105,-0.22315742,0.5770974,0.30526137,-0.18634716,0.40400478,-0.022974372,0.104909,0.12522572,-0.10052472,-0.6474921,-0.29402596],"result":{"type":"object","properties":{"result":{"description":"The evaluated result of the mathematical expression","type":"string"}},"required":["result"]},"sql_tables":null,"sql_queries":null,"file_inbox":null,"oauth":null,"assets":null,"runner":"any","operating_system":["linux","macos","windows"],"tool_set":""},false]} \ No newline at end of file diff --git a/tools/math-exp/metadata.json b/tools/math-exp/metadata.json index 2b418cce..eabc61d9 100644 --- a/tools/math-exp/metadata.json +++ b/tools/math-exp/metadata.json @@ -9,7 +9,10 @@ "shinkai" ], "version": "1.0.0", - "configurations": { + "runner": "any", + "operating_system": ["linux", "macos", "windows"], + "tool_set": "", + "configurations": { "type": "object", "properties": {}, "required": [] diff --git a/tools/meme-generator/.tool-dump.test.json b/tools/meme-generator/.tool-dump.test.json index 900482a8..4dd8b0d5 100644 --- a/tools/meme-generator/.tool-dump.test.json +++ b/tools/meme-generator/.tool-dump.test.json @@ -1 +1 @@ -{"type":"Deno","content":[{"name":"Meme Generator","homepage":null,"author":"@@official.shinkai","version":"1.0.0","js_code":"import { shinkaiLlmPromptProcessor } from './shinkai-local-tools.ts';\nimport { smartSearchEngine } from './shinkai-local-tools.ts';\nimport { getHomePath, getAssetPaths } from './shinkai-local-support.ts';\nimport axios from 'npm:axios';\nimport * as path from \"jsr:@std/path\";\n\ntype Run = (configurations: C, parameters: P) => Promise;\n\ninterface Configurations {\n username: string;\n password: string;\n}\n\ninterface Parameters {\n joke: string;\n}\n\ninterface Result {\n memeUrl: string;\n}\n\ninterface MemeTemplate {\n id: string;\n name: string;\n description: string;\n url: string;\n width: number;\n height: number;\n box_count: number;\n}\n\n// Split joke into two parts intelligently\nasync function splitJoke(joke: string, parts: number = 2): Promise<[string, string]> {\n let retries = 0;\n while (retries < 3) {\n const result = await shinkaiLlmPromptProcessor({ prompt: `\n\n* split the joke into ${parts} lines, so its writable in a meme image.\n* write no additional text or comments\n* output EXACTLY JUST the EXACT text and nothing else, any other data will make the output invalid\n\n\n\n${joke}\n\n`});\n console.log('[MEME GENERATOR] Joke parts', result);\n const split_parts = result.message.split('\\n');\n if (split_parts.length !== parts) {\n retries++;\n continue;\n }\n return split_parts;\n }\n throw new Error('Failed to split joke');\n}\n\nconst checkIfExists = async (path: string) => {\n try {\n await Deno.lstat(path);\n return true;\n } catch (err) {\n if (!(err instanceof Deno.errors.NotFound)) {\n throw err;\n }\n return false;\n }\n}\n\nlet memes: MemeTemplate[] = [];\n// Get popular meme templates from Imgflip API\nasync function getMemeTemplates(): Promise {\n if (memes.length > 0) {\n return memes;\n }\n const response = await fetch('https://api.imgflip.com/get_memes');\n const data = await response.json();\n if (!data.success) {\n throw new Error('Failed to fetch meme templates');\n }\n memes = data.data.memes;\n\n // We search for the meme in the local database, or else we do a smart search and create the new entry\n const final_memes: MemeTemplate[] = [];\n const asset_database = await getAssetPaths();\n const home_path = await getHomePath();\n\n for (const meme of memes) {\n const name = meme.name.replace(\"/\", \"_\").replace(\",\", \"_\");\n const name_encoded = encodeURIComponent(name);\n \n /**\n * We check if the meme is already in the asset database\n * Names are URL encoded when stored in the asset folder.\n * \n * If not found, we search for it in the local database\n * Names are not URL encoded when stored in the local database.\n * \n * If not found, we search for it in the smart search engine\n * And we store the result in the local database\n */\n const assetExists = asset_database.find(a => {\n const parts = a.split('/');\n const file_name = parts[parts.length - 1];\n return file_name === `${name_encoded}.json` || file_name === `${name}.json`;\n })\n\n const filePath = path.join(home_path, `${name}.json`);\n const exists = await checkIfExists(filePath);\n \n let memeData = '';\n if (exists) {\n memeData = await Deno.readTextFile(filePath);\n }\n else if (assetExists) {\n memeData = await Deno.readTextFile(assetExists); \n }\n else {\n console.log(`[MEME GENERATOR] Meme ${meme.name} not found in local database, searching...`);\n const memeData = await smartSearchEngine({ question: `Describe this meme, and how its used: '${meme.name}'`});\n Deno.writeFile(filePath, new TextEncoder().encode(memeData.response));\n } \n \n final_memes.push({\n ...meme,\n description: memeData,\n });\n }\n \n return final_memes;\n}\n\n// Select the best template based on joke content and template characteristics\nasync function selectTemplate(joke: string): Promise {\n let retries = 0;\n while (retries < 3) {\n const templates = await getMemeTemplates();\n const list = templates.map(m => m.name).join('\\\n');\n\n const descriptions = templates.map(m => `\n\n${m.description}\n`).join('\\\n');\n const prompt = `\n${descriptions}\n\n\n* templates tag is a list of meme templates names. \n* write no additional text or comments\n* output EXACTLY JUST the EXACT template line and nothing else, any other data will make the output invalid\n* output the line that matches best the joke tag\n\n\n\n${list}\n\n\n\n${joke}\n\n\n`;\n const result = await shinkaiLlmPromptProcessor({ prompt, format: 'text' });\n console.log('[MEME GENERATOR] prompt', prompt);\n console.log('[MEME GENERATOR] result:', result);\n const meme = templates.find(m => m.name.toLowerCase().match(result.message.toLowerCase()))\n if (meme) {\n return meme;\n }\n retries++;\n }\n throw new Error('Failed to select template');\n}\n\nexport const run: Run = async (\n configurations,\n parameters,\n): Promise => {\n try {\n // Select best template based on joke content\n const template = await selectTemplate(parameters.joke);\n console.log(`[MEME GENERATOR] Selected template: ${template.name}`);\n // Split the joke into two parts\n const parts = await splitJoke(parameters.joke);\n\n const params = new URLSearchParams();\n params.append('template_id', template.id);\n params.append('username', configurations.username);\n params.append('password', configurations.password);\n for (let i = 0; i < parts.length; i += 1) {\n params.append('text' + i, parts[i]);\n }\n console.log('[MEME GENERATOR] Sending request to Imgflip API...');\n const response = await axios.post('https://api.imgflip.com/caption_image', params);\n console.log('[MEME GENERATOR] Response from Imgflip API:', response.data);\n return { memeUrl: response.data.data.url };\n } catch (error) {\n if (error instanceof Error) {\n console.log('[MEME GENERATOR]', error);\n throw new Error(`Failed to generate meme: ${error.message}`);\n }\n throw error;\n }\n};\n","tools":["local:::__official_shinkai:::shinkai_llm_prompt_processor","local:::__official_shinkai:::smart_search_engine"],"config":[{"BasicConfig":{"key_name":"username","description":"The username for the Imgflip API","required":true,"type":null,"key_value":null}},{"BasicConfig":{"key_name":"password","description":"The password for the Imgflip API","required":true,"type":null,"key_value":null}}],"description":"Generates a meme image based on a joke by selecting a template and splitting the joke into appropriate parts.","keywords":["meme","generator","joke","image"],"input_args":{"type":"object","properties":{"joke":{"type":"string","description":"The joke to create the meme from"}},"required":["joke"]},"output_arg":{"json":""},"activated":false,"embedding":[0.07770462,0.84290165,-0.38971272,-0.52935266,-0.57442975,-0.02301599,-0.79770994,-0.20670265,0.45485917,0.4900688,-0.83260924,0.68175036,0.42029244,-0.021393724,0.56853694,-0.18581532,0.2587295,-0.18381637,-1.5447137,-0.83882564,-0.51236284,0.79209775,0.24866354,-0.18286534,-0.3201249,0.12541209,0.26691213,-0.38793832,-0.80777246,-1.622237,0.643129,0.76524657,-0.40012032,-0.5716081,0.3723563,-0.54502726,-0.101562135,-0.17352197,0.07279132,0.23861875,0.77975833,-0.22264598,-0.38271362,-0.3174745,-0.16885109,-0.23159567,0.98375255,0.12411848,0.59308666,0.89764416,-0.61956483,-0.53776044,0.65445757,-0.3080749,-0.4905625,0.44920188,-0.5125317,-0.4115791,0.29938203,-0.1728169,-0.17256615,0.18572643,-3.273985,0.12016618,1.1618897,-0.048071258,0.09329646,-0.15361561,-0.0986444,0.07410586,0.46765968,0.06611385,-0.84506863,0.8110884,-0.35661486,-0.21006203,0.014664064,-0.0032753907,0.8426369,-0.19805922,0.33745393,-0.13224831,0.43411598,-0.0254139,-0.7612562,0.68194354,-0.25672516,-0.15237853,0.113407806,0.14972158,-0.3596226,-0.63957876,0.3792916,0.025751159,-0.39673588,0.14252666,-0.16023614,-0.498626,0.28709656,2.903584,1.0877717,0.069851115,0.7953701,-0.62874085,0.54505134,-0.25492752,0.29871804,-0.2715704,0.2381739,0.21566541,0.38904405,-0.40352944,-0.6441679,0.25506255,0.7339529,0.0721661,-1.1502624,-0.37983498,0.33590436,0.2779944,-0.17535034,0.25671136,-1.3590001,-0.33449274,-0.10388684,0.31514102,-0.26972783,0.2906064,-0.023636924,0.029315637,0.4173423,-0.21434814,-0.5221496,0.074507676,0.018440947,0.26529947,0.5032882,-0.772811,0.23105913,-0.3718848,0.16517934,-0.91500294,0.2750445,0.13683811,0.90574044,0.40742466,-0.15847239,0.20905429,-0.6844956,-0.7549691,0.49417153,-0.3450128,0.023315739,0.07946309,1.2020411,-0.27541655,-0.12851837,-0.17050856,0.16362661,0.6442627,0.26775324,-0.009873655,0.26958543,0.48151374,-0.13145119,-0.00313529,-0.09958592,0.035817217,0.40098906,-0.47461772,0.4744976,0.0039388686,0.21975338,0.2269569,0.38956964,-0.62533534,-0.23481034,0.0027663335,0.6313913,-0.38799465,0.61983764,0.6319353,-0.03384192,-0.8264582,-0.2669925,0.0348989,0.2262696,-0.23507282,0.63482106,0.26270226,-0.09246224,1.2241862,-0.7428956,-0.20833349,0.28455558,0.35220665,1.0130937,0.61068386,1.0411919,-0.25468394,-0.8105228,0.14316028,0.030566081,-0.24305674,-0.27712014,-0.29290634,-0.12040393,0.1110494,-0.31645238,-1.0506703,-0.05897979,-0.109363586,0.67470896,0.56649005,0.98419595,0.01260728,0.082965024,-0.18842852,0.19837068,0.09308792,0.5756054,0.2857569,-0.36898047,-0.40622047,-0.5630294,0.48310423,-0.6397886,-0.43850052,-0.55736655,-0.19363557,0.7279634,0.8925584,-0.16702157,1.3978695,0.3869308,0.5305815,-0.2760066,0.22669727,0.02390296,-0.910067,0.6366215,-0.6450572,-0.15581405,-0.30412403,-0.25869542,-0.80276716,-0.1464723,-0.4791968,0.074729145,1.6448712,0.5367733,-0.24627888,0.71359414,0.11432497,-0.37614375,0.104347676,-2.4054878,-0.38464087,-0.45809084,0.27521178,-0.21320236,-0.6307088,0.4653099,-0.13895075,-0.7100424,-0.13842268,-0.8090505,-1.2633275,0.09259922,-0.15826818,0.5426781,0.3073169,-0.3106928,0.3572636,-0.2039256,-0.050589085,0.6394125,0.4221891,-0.30065337,-0.63090456,-0.20879826,0.5433313,-0.24148473,0.42012703,-0.79451495,-0.072197,-0.4462848,0.1528351,0.23574126,0.43338814,0.073133804,-0.3224336,0.35992762,0.022428125,2.0722675,0.16733077,0.79306936,0.5512098,-0.3434232,-0.28289026,0.57379735,0.32006282,0.059979703,-1.2982321,-1.3745315,-0.61686754,0.060152728,-0.14790341,-0.5816348,-0.48598945,-0.06631937,-0.7181487,0.24183547,0.35406896,-0.030313864,0.15686572,0.30483177,0.6865519,0.17249072,-2.2495277,-0.10283475,0.713389,0.116344035,-0.32712105,0.33908576,0.30763644,-0.25070885,0.69356406,-0.07898367,1.3463818,0.4810569,0.03876197,-0.0021644644,0.12625271,1.0383128,0.34445384,-0.24992438,-0.8732724,-0.71987605,-0.09642674,0.68360645,1.8044105,0.30619872,0.70151573,-0.19714585,-0.37972227,-0.7878241,-1.2132559,0.27668476,0.63051534,-0.1252994,0.54594815,-0.22575185,-0.5578884,0.5384561,0.48284194,-0.24947259,0.09662707,-0.42920431,1.2436106,0.09349191,-0.0901229,-0.107433215,-0.5584467,0.32059017,-0.37133753,0.7009931,-0.45025662,0.16668099,0.47932082,0.38071656,-0.09012289,-0.023923457,0.54390204,0.39207742,-0.42102444,0.15822689,-0.269121,0.7017496,0.18026619,0.6864376,0.3351004,-0.55121535,-0.4608196],"result":{"type":"object","properties":{"memeUrl":{"description":"The URL of the generated meme image","type":"string"}},"required":["memeUrl"]},"sql_tables":[],"sql_queries":[],"file_inbox":null,"oauth":null,"assets":null},false]} \ No newline at end of file +{"type":"Deno","content":[{"name":"Meme Generator","homepage":null,"author":"@@official.shinkai","version":"1.0.0","js_code":"import { shinkaiLlmPromptProcessor } from './shinkai-local-tools.ts';\nimport { smartSearchEngine } from './shinkai-local-tools.ts';\nimport { getHomePath, getAssetPaths } from './shinkai-local-support.ts';\nimport axios from 'npm:axios';\nimport * as path from \"jsr:@std/path\";\n\ntype Run = (configurations: C, parameters: P) => Promise;\n\ninterface Configurations {\n username: string;\n password: string;\n}\n\ninterface Parameters {\n joke: string;\n}\n\ninterface Result {\n memeUrl: string;\n}\n\ninterface MemeTemplate {\n id: string;\n name: string;\n description: string;\n url: string;\n width: number;\n height: number;\n box_count: number;\n}\n\n// Split joke into two parts intelligently\nasync function splitJoke(joke: string, parts: number = 2): Promise<[string, string]> {\n let retries = 0;\n while (retries < 3) {\n const result = await shinkaiLlmPromptProcessor({ prompt: `\n\n* split the joke into ${parts} lines, so its writable in a meme image.\n* write no additional text or comments\n* output EXACTLY JUST the EXACT text and nothing else, any other data will make the output invalid\n\n\n\n${joke}\n\n`});\n console.log('[MEME GENERATOR] Joke parts', result);\n const split_parts = result.message.split('\\n');\n if (split_parts.length !== parts) {\n retries++;\n continue;\n }\n return split_parts;\n }\n throw new Error('Failed to split joke');\n}\n\nconst checkIfExists = async (path: string) => {\n try {\n await Deno.lstat(path);\n return true;\n } catch (err) {\n if (!(err instanceof Deno.errors.NotFound)) {\n throw err;\n }\n return false;\n }\n}\n\nlet memes: MemeTemplate[] = [];\n// Get popular meme templates from Imgflip API\nasync function getMemeTemplates(): Promise {\n if (memes.length > 0) {\n return memes;\n }\n const response = await fetch('https://api.imgflip.com/get_memes');\n const data = await response.json();\n if (!data.success) {\n throw new Error('Failed to fetch meme templates');\n }\n memes = data.data.memes;\n\n // We search for the meme in the local database, or else we do a smart search and create the new entry\n const final_memes: MemeTemplate[] = [];\n const asset_database = await getAssetPaths();\n const home_path = await getHomePath();\n\n for (const meme of memes) {\n const name = meme.name.replace(\"/\", \"_\").replace(\",\", \"_\");\n const name_encoded = encodeURIComponent(name);\n \n /**\n * We check if the meme is already in the asset database\n * Names are URL encoded when stored in the asset folder.\n * \n * If not found, we search for it in the local database\n * Names are not URL encoded when stored in the local database.\n * \n * If not found, we search for it in the smart search engine\n * And we store the result in the local database\n */\n const assetExists = asset_database.find(a => {\n const parts = a.split('/');\n const file_name = parts[parts.length - 1];\n return file_name === `${name_encoded}.json` || file_name === `${name}.json`;\n })\n\n const filePath = path.join(home_path, `${name}.json`);\n const exists = await checkIfExists(filePath);\n \n let memeData = '';\n if (exists) {\n memeData = await Deno.readTextFile(filePath);\n }\n else if (assetExists) {\n memeData = await Deno.readTextFile(assetExists); \n }\n else {\n console.log(`[MEME GENERATOR] Meme ${meme.name} not found in local database, searching...`);\n const memeData = await smartSearchEngine({ question: `Describe this meme, and how its used: '${meme.name}'`});\n Deno.writeFile(filePath, new TextEncoder().encode(memeData.response));\n } \n \n final_memes.push({\n ...meme,\n description: memeData,\n });\n }\n \n return final_memes;\n}\n\n// Select the best template based on joke content and template characteristics\nasync function selectTemplate(joke: string): Promise {\n let retries = 0;\n while (retries < 3) {\n const templates = await getMemeTemplates();\n const list = templates.map(m => m.name).join('\\\n');\n\n const descriptions = templates.map(m => `\n\n${m.description}\n`).join('\\\n');\n const prompt = `\n${descriptions}\n\n\n* templates tag is a list of meme templates names. \n* write no additional text or comments\n* output EXACTLY JUST the EXACT template line and nothing else, any other data will make the output invalid\n* output the line that matches best the joke tag\n\n\n\n${list}\n\n\n\n${joke}\n\n\n`;\n const result = await shinkaiLlmPromptProcessor({ prompt, format: 'text' });\n console.log('[MEME GENERATOR] prompt', prompt);\n console.log('[MEME GENERATOR] result:', result);\n const meme = templates.find(m => m.name.toLowerCase().match(result.message.toLowerCase()))\n if (meme) {\n return meme;\n }\n retries++;\n }\n throw new Error('Failed to select template');\n}\n\nexport const run: Run = async (\n configurations,\n parameters,\n): Promise => {\n try {\n // Select best template based on joke content\n const template = await selectTemplate(parameters.joke);\n console.log(`[MEME GENERATOR] Selected template: ${template.name}`);\n // Split the joke into two parts\n const parts = await splitJoke(parameters.joke);\n\n const params = new URLSearchParams();\n params.append('template_id', template.id);\n params.append('username', configurations.username);\n params.append('password', configurations.password);\n for (let i = 0; i < parts.length; i += 1) {\n params.append('text' + i, parts[i]);\n }\n console.log('[MEME GENERATOR] Sending request to Imgflip API...');\n const response = await axios.post('https://api.imgflip.com/caption_image', params);\n console.log('[MEME GENERATOR] Response from Imgflip API:', response.data);\n return { memeUrl: response.data.data.url };\n } catch (error) {\n if (error instanceof Error) {\n console.log('[MEME GENERATOR]', error);\n throw new Error(`Failed to generate meme: ${error.message}`);\n }\n throw error;\n }\n};\n","tools":["local:::__official_shinkai:::shinkai_llm_prompt_processor","local:::__official_shinkai:::smart_search_engine"],"config":[{"BasicConfig":{"key_name":"username","description":"The username for the Imgflip API","required":true,"type":null,"key_value":null}},{"BasicConfig":{"key_name":"password","description":"The password for the Imgflip API","required":true,"type":null,"key_value":null}}],"description":"Generates a meme image based on a joke by selecting a template and splitting the joke into appropriate parts.","keywords":["meme","generator","joke","image"],"input_args":{"type":"object","properties":{"joke":{"type":"string","description":"The joke to create the meme from"}},"required":["joke"]},"output_arg":{"json":""},"activated":false,"embedding":[0.07770462,0.84290165,-0.38971272,-0.52935266,-0.57442975,-0.02301599,-0.79770994,-0.20670265,0.45485917,0.4900688,-0.83260924,0.68175036,0.42029244,-0.021393724,0.56853694,-0.18581532,0.2587295,-0.18381637,-1.5447137,-0.83882564,-0.51236284,0.79209775,0.24866354,-0.18286534,-0.3201249,0.12541209,0.26691213,-0.38793832,-0.80777246,-1.622237,0.643129,0.76524657,-0.40012032,-0.5716081,0.3723563,-0.54502726,-0.101562135,-0.17352197,0.07279132,0.23861875,0.77975833,-0.22264598,-0.38271362,-0.3174745,-0.16885109,-0.23159567,0.98375255,0.12411848,0.59308666,0.89764416,-0.61956483,-0.53776044,0.65445757,-0.3080749,-0.4905625,0.44920188,-0.5125317,-0.4115791,0.29938203,-0.1728169,-0.17256615,0.18572643,-3.273985,0.12016618,1.1618897,-0.048071258,0.09329646,-0.15361561,-0.0986444,0.07410586,0.46765968,0.06611385,-0.84506863,0.8110884,-0.35661486,-0.21006203,0.014664064,-0.0032753907,0.8426369,-0.19805922,0.33745393,-0.13224831,0.43411598,-0.0254139,-0.7612562,0.68194354,-0.25672516,-0.15237853,0.113407806,0.14972158,-0.3596226,-0.63957876,0.3792916,0.025751159,-0.39673588,0.14252666,-0.16023614,-0.498626,0.28709656,2.903584,1.0877717,0.069851115,0.7953701,-0.62874085,0.54505134,-0.25492752,0.29871804,-0.2715704,0.2381739,0.21566541,0.38904405,-0.40352944,-0.6441679,0.25506255,0.7339529,0.0721661,-1.1502624,-0.37983498,0.33590436,0.2779944,-0.17535034,0.25671136,-1.3590001,-0.33449274,-0.10388684,0.31514102,-0.26972783,0.2906064,-0.023636924,0.029315637,0.4173423,-0.21434814,-0.5221496,0.074507676,0.018440947,0.26529947,0.5032882,-0.772811,0.23105913,-0.3718848,0.16517934,-0.91500294,0.2750445,0.13683811,0.90574044,0.40742466,-0.15847239,0.20905429,-0.6844956,-0.7549691,0.49417153,-0.3450128,0.023315739,0.07946309,1.2020411,-0.27541655,-0.12851837,-0.17050856,0.16362661,0.6442627,0.26775324,-0.009873655,0.26958543,0.48151374,-0.13145119,-0.00313529,-0.09958592,0.035817217,0.40098906,-0.47461772,0.4744976,0.0039388686,0.21975338,0.2269569,0.38956964,-0.62533534,-0.23481034,0.0027663335,0.6313913,-0.38799465,0.61983764,0.6319353,-0.03384192,-0.8264582,-0.2669925,0.0348989,0.2262696,-0.23507282,0.63482106,0.26270226,-0.09246224,1.2241862,-0.7428956,-0.20833349,0.28455558,0.35220665,1.0130937,0.61068386,1.0411919,-0.25468394,-0.8105228,0.14316028,0.030566081,-0.24305674,-0.27712014,-0.29290634,-0.12040393,0.1110494,-0.31645238,-1.0506703,-0.05897979,-0.109363586,0.67470896,0.56649005,0.98419595,0.01260728,0.082965024,-0.18842852,0.19837068,0.09308792,0.5756054,0.2857569,-0.36898047,-0.40622047,-0.5630294,0.48310423,-0.6397886,-0.43850052,-0.55736655,-0.19363557,0.7279634,0.8925584,-0.16702157,1.3978695,0.3869308,0.5305815,-0.2760066,0.22669727,0.02390296,-0.910067,0.6366215,-0.6450572,-0.15581405,-0.30412403,-0.25869542,-0.80276716,-0.1464723,-0.4791968,0.074729145,1.6448712,0.5367733,-0.24627888,0.71359414,0.11432497,-0.37614375,0.104347676,-2.4054878,-0.38464087,-0.45809084,0.27521178,-0.21320236,-0.6307088,0.4653099,-0.13895075,-0.7100424,-0.13842268,-0.8090505,-1.2633275,0.09259922,-0.15826818,0.5426781,0.3073169,-0.3106928,0.3572636,-0.2039256,-0.050589085,0.6394125,0.4221891,-0.30065337,-0.63090456,-0.20879826,0.5433313,-0.24148473,0.42012703,-0.79451495,-0.072197,-0.4462848,0.1528351,0.23574126,0.43338814,0.073133804,-0.3224336,0.35992762,0.022428125,2.0722675,0.16733077,0.79306936,0.5512098,-0.3434232,-0.28289026,0.57379735,0.32006282,0.059979703,-1.2982321,-1.3745315,-0.61686754,0.060152728,-0.14790341,-0.5816348,-0.48598945,-0.06631937,-0.7181487,0.24183547,0.35406896,-0.030313864,0.15686572,0.30483177,0.6865519,0.17249072,-2.2495277,-0.10283475,0.713389,0.116344035,-0.32712105,0.33908576,0.30763644,-0.25070885,0.69356406,-0.07898367,1.3463818,0.4810569,0.03876197,-0.0021644644,0.12625271,1.0383128,0.34445384,-0.24992438,-0.8732724,-0.71987605,-0.09642674,0.68360645,1.8044105,0.30619872,0.70151573,-0.19714585,-0.37972227,-0.7878241,-1.2132559,0.27668476,0.63051534,-0.1252994,0.54594815,-0.22575185,-0.5578884,0.5384561,0.48284194,-0.24947259,0.09662707,-0.42920431,1.2436106,0.09349191,-0.0901229,-0.107433215,-0.5584467,0.32059017,-0.37133753,0.7009931,-0.45025662,0.16668099,0.47932082,0.38071656,-0.09012289,-0.023923457,0.54390204,0.39207742,-0.42102444,0.15822689,-0.269121,0.7017496,0.18026619,0.6864376,0.3351004,-0.55121535,-0.4608196],"result":{"type":"object","properties":{"memeUrl":{"description":"The URL of the generated meme image","type":"string"}},"required":["memeUrl"]},"sql_tables":[],"sql_queries":[],"file_inbox":null,"oauth":null,"assets":null,"runner":"any","operating_system":["linux","macos","windows"],"tool_set":""},false]} \ No newline at end of file diff --git a/tools/meme-generator/metadata.json b/tools/meme-generator/metadata.json index 41fb0279..90650001 100644 --- a/tools/meme-generator/metadata.json +++ b/tools/meme-generator/metadata.json @@ -10,6 +10,9 @@ "joke", "image" ], + "runner": "any", + "operating_system": ["linux", "macos", "windows"], + "tool_set": "", "configurations": { "type": "object", "properties": { diff --git a/tools/memory/.tool-dump.test.json b/tools/memory/.tool-dump.test.json index 3f361736..8ce2f351 100644 --- a/tools/memory/.tool-dump.test.json +++ b/tools/memory/.tool-dump.test.json @@ -1 +1 @@ -{"type":"Deno","content":[{"name":"Memory Management","homepage":null,"author":"@@official.shinkai","version":"1.0.0","js_code":"import { shinkaiSqliteQueryExecutor } from './shinkai-local-tools.ts';\nimport { shinkaiLlmPromptProcessor } from './shinkai-local-tools.ts';\n\ntype CONFIG = {};\ntype INPUTS = {\n data?: string;\n general_prompt?: string;\n specific_prompt?: string;\n key?: string;\n};\ntype OUTPUT = {\n generalMemory: string;\n specificMemory: string;\n};\n\nconst createTable = async (): Promise => {\n // Create table if not exists\n const createTableQuery = `\n CREATE TABLE IF NOT EXISTS memory_table (\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n date DATETIME DEFAULT CURRENT_TIMESTAMP,\n key TEXT,\n memory TEXT\n );\n `;\n await shinkaiSqliteQueryExecutor({ query: createTableQuery });\n}\n\nconst getGeneralMemory = async (): Promise => {\n const fetchGeneralMemoryQuery = `\n SELECT id, key, memory\n FROM memory_table\n where key is null\n `;\n const fetchGeneralMemory = await shinkaiSqliteQueryExecutor({ query: fetchGeneralMemoryQuery });\n\n if (fetchGeneralMemory.result.length) {\n return fetchGeneralMemory.result[0];\n }\n return null;\n}\n\nconst getSpecificMemory = async (key: string): Promise => {\n const fetchSpecificMemoryQuery = `\n SELECT id, key, memory\n FROM memory_table\n where key = ?\n `;\n const fetchSpecificMemory = await shinkaiSqliteQueryExecutor({ query: fetchSpecificMemoryQuery, params: [key] });\n\n if (fetchSpecificMemory.result.length) {\n return fetchSpecificMemory.result[0];\n }\n return null;\n}\n\nconst generatePrompt = async (\n previousMemory: null | {id: number, key: string, memory: string},\n general_prompt: string,\n data: string): Promise => {\n let generalPrompt = `\nYou must generate memories, so we can recall new and past interactions.\nBased on the rules, you must generate the output.\nWe should merge new and past interactions into a single memory.\nKeep the most important information only.\n\nThese are some sections you must understand:\n * rules tag: has the rules you must follow to generate the output.\\n`;\n if (previousMemory) generalPrompt += `. * previous_interactions tag: has entire previous interaction memory\\n`;\n generalPrompt += `. * input tag: has the new data to for creating newa memories.\n\n\n ${general_prompt}\n\n `\n if (previousMemory)\n generalPrompt += `\n\n ${previousMemory.memory}\n\n `;\n\n generalPrompt += `\n\n ${data}\n\n `;\n return generalPrompt;\n}\n\nexport async function run(config: CONFIG, inputs: INPUTS): Promise {\n const {\n data,\n general_prompt = 'Important information to remember from this interaction',\n specific_prompt = 'Important information to remember from this interaction',\n key\n } = inputs;\n\n await createTable();\n\n let generalMemory = '';\n let specificMemory = '';\n // If no data provided, just return existing memories\n if (!data) {\n const existingGeneralMemory = await getGeneralMemory();\n const existingSpecificMemory = key ? await getSpecificMemory(key) : null;\n\n return {\n generalMemory: existingGeneralMemory?.memory || '',\n specificMemory: existingSpecificMemory?.memory || ''\n };\n }\n\n // Update General Memory\n const previousGeneralMemory = await getGeneralMemory();\n const generalPrompt = await generatePrompt(previousGeneralMemory, general_prompt, data);\n const generalResponse = await shinkaiLlmPromptProcessor({ format: 'text', prompt: generalPrompt });\n generalMemory = generalResponse.message;\n\n if (previousGeneralMemory) {\n const generalUpdateQuery = `\n UPDATE memory_table SET memory = ?\n WHERE id = ?\n `;\n await shinkaiSqliteQueryExecutor({\n query: generalUpdateQuery, params: [generalMemory, \"\"+ previousGeneralMemory.id]\n });\n } else {\n const generalInsertQuery = `\n INSERT INTO memory_table (memory)\n VALUES (?);\n `;\n await shinkaiSqliteQueryExecutor({ query: generalInsertQuery, params: [generalMemory]});\n }\n\n // Update specific memory\n if (key) {\n const previousSpecificMemory = await getSpecificMemory(key);\n const specificPrompt = await generatePrompt(previousSpecificMemory, specific_prompt, data);\n const specificResponse = await shinkaiLlmPromptProcessor({ format: 'text', prompt: specificPrompt });\n specificMemory = specificResponse.message;\n\n if (previousSpecificMemory) {\n const specificUpdateQuery = `\n UPDATE memory_table SET memory = ?\n WHERE id = ?\n `;\n await shinkaiSqliteQueryExecutor({\n query: specificUpdateQuery,\n params: [specificMemory, \"\"+previousSpecificMemory.id]\n });\n } else {\n const specificInsertQuery = `\n INSERT INTO memory_table (key, memory)\n VALUES (?, ?);\n `;\n await shinkaiSqliteQueryExecutor({\n query: specificInsertQuery,\n params: [key, specificMemory]\n });\n }\n }\n return {generalMemory, specificMemory};\n}","tools":["local:::__official_shinkai:::shinkai_sqlite_query_executor","local:::__official_shinkai:::shinkai_llm_prompt_processor"],"config":[],"description":"Handles memory storage and retrieval using a SQLite database.","keywords":["memory","remember","management","recall","smart","agent"],"input_args":{"type":"object","properties":{"specific_prompt":{"type":"string","description":"The specific prompt for generating memories"},"key":{"type":"string","description":"The key for specific memory retrieval"},"general_prompt":{"type":"string","description":"The general prompt for generating memories"},"data":{"type":"string","description":"The data to process for memory management, if not provided, the tool will return existing memories"}},"required":[]},"output_arg":{"json":""},"activated":false,"embedding":[0.111937836,0.74089676,-0.12515827,-0.4942115,-0.25368002,-0.056685545,-0.809049,0.13576964,0.24071948,-0.02976514,-0.47945547,0.99631506,-0.08526395,-0.08666597,0.4112748,-0.34366244,0.28832552,0.8723968,-1.8125455,-0.06927829,0.3785739,0.44344294,0.07779312,-0.13623443,-0.198864,0.104956515,0.07281388,-0.64128476,-0.8674953,-2.212524,0.23000515,0.8036334,-0.32317746,0.08531259,0.06165708,-0.5280139,-0.27165845,0.2298748,-1.0989754,-0.4352798,0.060814954,0.20959929,-0.6922089,0.14129707,0.3951045,-0.2094253,0.28318685,0.03080573,0.6607957,0.44034725,-0.3435076,-0.6636055,-0.49609208,0.031462383,-0.46229592,-0.11738148,-0.2673628,-0.12942854,-0.13213739,-0.56978685,-0.49050757,-0.033710778,-3.0540113,-0.35828966,0.4477928,0.11795497,0.6029618,0.03019675,-0.13932246,-0.116601504,-0.5129008,0.22289489,0.001567632,0.43084416,0.010488745,-0.65866005,0.5444606,-0.16649291,0.5965793,-0.56898767,0.5876942,0.68564534,0.057885304,-0.11264849,-0.36528912,0.22000486,-0.5172195,-0.034327753,0.20772007,0.10029636,-0.11128229,-0.35220385,0.042001657,-0.09486667,-0.49064255,0.5016759,0.5429697,0.53100413,0.67431355,2.9295228,0.6061498,-0.0052450076,1.1123242,-0.5553272,0.58578116,-0.396771,-0.0043778606,-0.2641139,-0.18956795,-0.04787702,0.5651373,0.04069993,0.10868324,0.3633739,0.31594813,-0.14918776,-0.90317976,0.014140373,0.09339001,0.4759403,-1.2680333,0.15725,-0.8017013,-0.072784826,-0.2027275,-0.248173,-0.47450486,0.35822383,0.089721486,-0.8434949,0.17163289,-0.60608387,-1.5258477,-0.092011675,0.15190832,0.029228859,0.09951277,-1.0531722,-0.8432071,-1.2045652,0.22168328,-1.8012422,1.257536,0.3710498,0.82652575,1.064956,-0.07364569,-0.08260139,-0.32399875,-0.2577161,0.35024714,0.3111611,0.20929018,-0.17805251,0.8778527,-0.086034104,0.20599265,0.22164212,-0.5891931,-0.16454726,-0.681477,-0.039246723,0.36468878,0.25415224,0.87371546,-1.1239837,-0.07615483,-0.40367773,0.4243997,-0.22388089,-0.036021143,0.070409395,0.051366255,0.23837432,0.1067911,-0.5528012,0.23844612,0.0024840161,-0.080963686,-0.751668,-0.0518061,0.65869457,-0.27564827,-0.7393524,-0.30968362,-0.65195227,0.98374283,-0.09401393,0.04650405,0.98091817,-0.44676092,1.0435079,-0.8741324,0.5287304,-0.24334532,-0.3493321,-0.09778318,0.6641216,0.6423144,-0.56234205,-0.34151262,-0.6116001,-0.15467788,0.09333934,0.65145075,-0.36601484,-0.3339522,0.050637126,0.41447765,-0.524192,-0.22862165,-0.5204915,0.31959406,0.34199706,0.31173804,0.29922813,0.04193517,0.65267223,0.23422848,0.9934678,0.8802714,-0.06621673,0.4821114,-0.5185084,-0.2266081,-0.7151844,-0.047955215,-0.44060528,-0.43365583,-0.5805751,0.23047966,0.8946043,0.8859454,0.15834664,0.5712067,0.035358794,0.26624507,0.36157402,0.4208076,-0.784662,0.5708339,0.2283394,-0.415547,-0.34696782,0.041988354,-0.25026345,0.35980847,0.3587914,0.43452892,1.2345545,0.8542529,0.43813187,-0.117733255,0.3318603,0.37991884,0.049697533,-1.7096437,0.12233965,-0.33652085,0.3047968,0.4880944,0.005683899,0.48125106,1.0229537,0.42820078,0.1880018,-0.9280594,0.3796176,0.1298208,-0.008567318,-0.70267904,1.1864583,-0.43549532,-0.4198141,-0.07940441,-0.76350194,0.7171461,-0.42064208,-0.34265658,-0.36742902,0.12565221,0.12214184,0.9031202,-0.023328215,-0.048132613,-0.167081,-0.33202252,0.27307153,0.20823562,0.9203475,-0.19106463,-0.35383615,-0.7042749,0.85880107,1.4127065,1.3556606,0.24954379,0.52383125,0.82653356,-0.12702428,0.067642696,0.41572976,-0.33709046,0.09285276,-0.18625477,0.002191268,0.55797386,0.38143012,-0.35884345,0.2095905,-1.2938337,0.13288312,0.13235816,-0.22439846,0.3647071,-0.53730625,0.47953555,1.4558412,-0.17408374,-2.000823,-0.6611798,0.23612174,-0.14356868,-0.20251471,-0.13713701,0.20885682,-0.7435712,0.25030732,0.543007,1.3142625,0.44838735,-0.8564536,-0.75826186,-0.43299165,0.9422145,0.4068938,0.554768,-0.13111398,-0.42246768,-0.07616982,0.5571903,1.2492561,0.48375618,0.051635597,-0.21371765,0.35021627,-0.5410304,-1.1716174,0.5095912,-0.62912905,-0.37279865,0.41224012,0.59948826,-0.3992,0.7356437,1.1001694,0.24999188,0.24701267,-1.1759105,1.4969252,-0.020239882,-0.31295842,-0.93301684,0.77810735,-0.3480711,-0.41037232,0.65593684,-0.14069337,-0.28005433,-0.22853693,-0.022693757,-0.26941186,0.16493139,0.45033836,0.60703117,0.5285942,0.12087938,0.25766528,-0.34744433,0.104460105,1.0776262,0.4048118,-1.3009826,-0.40838832],"result":{"type":"object","properties":{"generalMemory":{"description":"The updated general memory","nullable":true,"type":"string"},"specificMemory":{"description":"The updated specific memory","nullable":true,"type":"string"}},"required":[]},"sql_tables":[{"name":"memory_table","definition":"CREATE TABLE IF NOT EXISTS memory_table (id INTEGER PRIMARY KEY AUTOINCREMENT, date DATETIME DEFAULT CURRENT_TIMESTAMP, key TEXT, memory TEXT)"}],"sql_queries":[{"name":"Get general memory","query":"SELECT id, key, memory FROM memory_table WHERE key IS NULL"},{"name":"Get specific memory","query":"SELECT id, key, memory FROM memory_table WHERE key = ?"},{"name":"Update memory","query":"UPDATE memory_table SET memory = ? WHERE id = ?"}],"file_inbox":null,"oauth":null,"assets":null},false]} \ No newline at end of file +{"type":"Deno","content":[{"name":"Memory Management","homepage":null,"author":"@@official.shinkai","version":"1.0.0","js_code":"import { shinkaiSqliteQueryExecutor } from './shinkai-local-tools.ts';\nimport { shinkaiLlmPromptProcessor } from './shinkai-local-tools.ts';\n\ntype CONFIG = {};\ntype INPUTS = {\n data?: string;\n general_prompt?: string;\n specific_prompt?: string;\n key?: string;\n};\ntype OUTPUT = {\n generalMemory: string;\n specificMemory: string;\n};\n\nconst createTable = async (): Promise => {\n // Create table if not exists\n const createTableQuery = `\n CREATE TABLE IF NOT EXISTS memory_table (\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n date DATETIME DEFAULT CURRENT_TIMESTAMP,\n key TEXT,\n memory TEXT\n );\n `;\n await shinkaiSqliteQueryExecutor({ query: createTableQuery });\n}\n\nconst getGeneralMemory = async (): Promise => {\n const fetchGeneralMemoryQuery = `\n SELECT id, key, memory\n FROM memory_table\n where key is null\n `;\n const fetchGeneralMemory = await shinkaiSqliteQueryExecutor({ query: fetchGeneralMemoryQuery });\n\n if (fetchGeneralMemory.result.length) {\n return fetchGeneralMemory.result[0];\n }\n return null;\n}\n\nconst getSpecificMemory = async (key: string): Promise => {\n const fetchSpecificMemoryQuery = `\n SELECT id, key, memory\n FROM memory_table\n where key = ?\n `;\n const fetchSpecificMemory = await shinkaiSqliteQueryExecutor({ query: fetchSpecificMemoryQuery, params: [key] });\n\n if (fetchSpecificMemory.result.length) {\n return fetchSpecificMemory.result[0];\n }\n return null;\n}\n\nconst generatePrompt = async (\n previousMemory: null | {id: number, key: string, memory: string},\n general_prompt: string,\n data: string): Promise => {\n let generalPrompt = `\nYou must generate memories, so we can recall new and past interactions.\nBased on the rules, you must generate the output.\nWe should merge new and past interactions into a single memory.\nKeep the most important information only.\n\nThese are some sections you must understand:\n * rules tag: has the rules you must follow to generate the output.\\n`;\n if (previousMemory) generalPrompt += `. * previous_interactions tag: has entire previous interaction memory\\n`;\n generalPrompt += `. * input tag: has the new data to for creating newa memories.\n\n\n ${general_prompt}\n\n `\n if (previousMemory)\n generalPrompt += `\n\n ${previousMemory.memory}\n\n `;\n\n generalPrompt += `\n\n ${data}\n\n `;\n return generalPrompt;\n}\n\nexport async function run(config: CONFIG, inputs: INPUTS): Promise {\n const {\n data,\n general_prompt = 'Important information to remember from this interaction',\n specific_prompt = 'Important information to remember from this interaction',\n key\n } = inputs;\n\n await createTable();\n\n let generalMemory = '';\n let specificMemory = '';\n // If no data provided, just return existing memories\n if (!data) {\n const existingGeneralMemory = await getGeneralMemory();\n const existingSpecificMemory = key ? await getSpecificMemory(key) : null;\n\n return {\n generalMemory: existingGeneralMemory?.memory || '',\n specificMemory: existingSpecificMemory?.memory || ''\n };\n }\n\n // Update General Memory\n const previousGeneralMemory = await getGeneralMemory();\n const generalPrompt = await generatePrompt(previousGeneralMemory, general_prompt, data);\n const generalResponse = await shinkaiLlmPromptProcessor({ format: 'text', prompt: generalPrompt });\n generalMemory = generalResponse.message;\n\n if (previousGeneralMemory) {\n const generalUpdateQuery = `\n UPDATE memory_table SET memory = ?\n WHERE id = ?\n `;\n await shinkaiSqliteQueryExecutor({\n query: generalUpdateQuery, params: [generalMemory, \"\"+ previousGeneralMemory.id]\n });\n } else {\n const generalInsertQuery = `\n INSERT INTO memory_table (memory)\n VALUES (?);\n `;\n await shinkaiSqliteQueryExecutor({ query: generalInsertQuery, params: [generalMemory]});\n }\n\n // Update specific memory\n if (key) {\n const previousSpecificMemory = await getSpecificMemory(key);\n const specificPrompt = await generatePrompt(previousSpecificMemory, specific_prompt, data);\n const specificResponse = await shinkaiLlmPromptProcessor({ format: 'text', prompt: specificPrompt });\n specificMemory = specificResponse.message;\n\n if (previousSpecificMemory) {\n const specificUpdateQuery = `\n UPDATE memory_table SET memory = ?\n WHERE id = ?\n `;\n await shinkaiSqliteQueryExecutor({\n query: specificUpdateQuery,\n params: [specificMemory, \"\"+previousSpecificMemory.id]\n });\n } else {\n const specificInsertQuery = `\n INSERT INTO memory_table (key, memory)\n VALUES (?, ?);\n `;\n await shinkaiSqliteQueryExecutor({\n query: specificInsertQuery,\n params: [key, specificMemory]\n });\n }\n }\n return {generalMemory, specificMemory};\n}","tools":["local:::__official_shinkai:::shinkai_sqlite_query_executor","local:::__official_shinkai:::shinkai_llm_prompt_processor"],"config":[],"description":"Handles memory storage and retrieval using a SQLite database.","keywords":["memory","remember","management","recall","smart","agent"],"input_args":{"type":"object","properties":{"key":{"type":"string","description":"The key for specific memory retrieval"},"data":{"type":"string","description":"The data to process for memory management, if not provided, the tool will return existing memories"},"specific_prompt":{"type":"string","description":"The specific prompt for generating memories"},"general_prompt":{"type":"string","description":"The general prompt for generating memories"}},"required":[]},"output_arg":{"json":""},"activated":false,"embedding":[0.111937836,0.74089676,-0.12515827,-0.4942115,-0.25368002,-0.056685545,-0.809049,0.13576964,0.24071948,-0.02976514,-0.47945547,0.99631506,-0.08526395,-0.08666597,0.4112748,-0.34366244,0.28832552,0.8723968,-1.8125455,-0.06927829,0.3785739,0.44344294,0.07779312,-0.13623443,-0.198864,0.104956515,0.07281388,-0.64128476,-0.8674953,-2.212524,0.23000515,0.8036334,-0.32317746,0.08531259,0.06165708,-0.5280139,-0.27165845,0.2298748,-1.0989754,-0.4352798,0.060814954,0.20959929,-0.6922089,0.14129707,0.3951045,-0.2094253,0.28318685,0.03080573,0.6607957,0.44034725,-0.3435076,-0.6636055,-0.49609208,0.031462383,-0.46229592,-0.11738148,-0.2673628,-0.12942854,-0.13213739,-0.56978685,-0.49050757,-0.033710778,-3.0540113,-0.35828966,0.4477928,0.11795497,0.6029618,0.03019675,-0.13932246,-0.116601504,-0.5129008,0.22289489,0.001567632,0.43084416,0.010488745,-0.65866005,0.5444606,-0.16649291,0.5965793,-0.56898767,0.5876942,0.68564534,0.057885304,-0.11264849,-0.36528912,0.22000486,-0.5172195,-0.034327753,0.20772007,0.10029636,-0.11128229,-0.35220385,0.042001657,-0.09486667,-0.49064255,0.5016759,0.5429697,0.53100413,0.67431355,2.9295228,0.6061498,-0.0052450076,1.1123242,-0.5553272,0.58578116,-0.396771,-0.0043778606,-0.2641139,-0.18956795,-0.04787702,0.5651373,0.04069993,0.10868324,0.3633739,0.31594813,-0.14918776,-0.90317976,0.014140373,0.09339001,0.4759403,-1.2680333,0.15725,-0.8017013,-0.072784826,-0.2027275,-0.248173,-0.47450486,0.35822383,0.089721486,-0.8434949,0.17163289,-0.60608387,-1.5258477,-0.092011675,0.15190832,0.029228859,0.09951277,-1.0531722,-0.8432071,-1.2045652,0.22168328,-1.8012422,1.257536,0.3710498,0.82652575,1.064956,-0.07364569,-0.08260139,-0.32399875,-0.2577161,0.35024714,0.3111611,0.20929018,-0.17805251,0.8778527,-0.086034104,0.20599265,0.22164212,-0.5891931,-0.16454726,-0.681477,-0.039246723,0.36468878,0.25415224,0.87371546,-1.1239837,-0.07615483,-0.40367773,0.4243997,-0.22388089,-0.036021143,0.070409395,0.051366255,0.23837432,0.1067911,-0.5528012,0.23844612,0.0024840161,-0.080963686,-0.751668,-0.0518061,0.65869457,-0.27564827,-0.7393524,-0.30968362,-0.65195227,0.98374283,-0.09401393,0.04650405,0.98091817,-0.44676092,1.0435079,-0.8741324,0.5287304,-0.24334532,-0.3493321,-0.09778318,0.6641216,0.6423144,-0.56234205,-0.34151262,-0.6116001,-0.15467788,0.09333934,0.65145075,-0.36601484,-0.3339522,0.050637126,0.41447765,-0.524192,-0.22862165,-0.5204915,0.31959406,0.34199706,0.31173804,0.29922813,0.04193517,0.65267223,0.23422848,0.9934678,0.8802714,-0.06621673,0.4821114,-0.5185084,-0.2266081,-0.7151844,-0.047955215,-0.44060528,-0.43365583,-0.5805751,0.23047966,0.8946043,0.8859454,0.15834664,0.5712067,0.035358794,0.26624507,0.36157402,0.4208076,-0.784662,0.5708339,0.2283394,-0.415547,-0.34696782,0.041988354,-0.25026345,0.35980847,0.3587914,0.43452892,1.2345545,0.8542529,0.43813187,-0.117733255,0.3318603,0.37991884,0.049697533,-1.7096437,0.12233965,-0.33652085,0.3047968,0.4880944,0.005683899,0.48125106,1.0229537,0.42820078,0.1880018,-0.9280594,0.3796176,0.1298208,-0.008567318,-0.70267904,1.1864583,-0.43549532,-0.4198141,-0.07940441,-0.76350194,0.7171461,-0.42064208,-0.34265658,-0.36742902,0.12565221,0.12214184,0.9031202,-0.023328215,-0.048132613,-0.167081,-0.33202252,0.27307153,0.20823562,0.9203475,-0.19106463,-0.35383615,-0.7042749,0.85880107,1.4127065,1.3556606,0.24954379,0.52383125,0.82653356,-0.12702428,0.067642696,0.41572976,-0.33709046,0.09285276,-0.18625477,0.002191268,0.55797386,0.38143012,-0.35884345,0.2095905,-1.2938337,0.13288312,0.13235816,-0.22439846,0.3647071,-0.53730625,0.47953555,1.4558412,-0.17408374,-2.000823,-0.6611798,0.23612174,-0.14356868,-0.20251471,-0.13713701,0.20885682,-0.7435712,0.25030732,0.543007,1.3142625,0.44838735,-0.8564536,-0.75826186,-0.43299165,0.9422145,0.4068938,0.554768,-0.13111398,-0.42246768,-0.07616982,0.5571903,1.2492561,0.48375618,0.051635597,-0.21371765,0.35021627,-0.5410304,-1.1716174,0.5095912,-0.62912905,-0.37279865,0.41224012,0.59948826,-0.3992,0.7356437,1.1001694,0.24999188,0.24701267,-1.1759105,1.4969252,-0.020239882,-0.31295842,-0.93301684,0.77810735,-0.3480711,-0.41037232,0.65593684,-0.14069337,-0.28005433,-0.22853693,-0.022693757,-0.26941186,0.16493139,0.45033836,0.60703117,0.5285942,0.12087938,0.25766528,-0.34744433,0.104460105,1.0776262,0.4048118,-1.3009826,-0.40838832],"result":{"type":"object","properties":{"generalMemory":{"description":"The updated general memory","nullable":true,"type":"string"},"specificMemory":{"description":"The updated specific memory","nullable":true,"type":"string"}},"required":[]},"sql_tables":[{"name":"memory_table","definition":"CREATE TABLE IF NOT EXISTS memory_table (id INTEGER PRIMARY KEY AUTOINCREMENT, date DATETIME DEFAULT CURRENT_TIMESTAMP, key TEXT, memory TEXT)"}],"sql_queries":[{"name":"Get general memory","query":"SELECT id, key, memory FROM memory_table WHERE key IS NULL"},{"name":"Get specific memory","query":"SELECT id, key, memory FROM memory_table WHERE key = ?"},{"name":"Update memory","query":"UPDATE memory_table SET memory = ? WHERE id = ?"}],"file_inbox":null,"oauth":null,"assets":null,"runner":"any","operating_system":["linux","macos","windows"],"tool_set":""},false]} \ No newline at end of file diff --git a/tools/memory/metadata.json b/tools/memory/metadata.json index b407cfd0..550135b6 100644 --- a/tools/memory/metadata.json +++ b/tools/memory/metadata.json @@ -12,7 +12,10 @@ "smart", "agent" ], - "configurations": { + "runner": "any", + "operating_system": ["linux", "macos", "windows"], + "tool_set": "", + "configurations": { "type": "object", "properties": {}, "required": [] diff --git a/tools/mermaid/.tool-dump.test.json b/tools/mermaid/.tool-dump.test.json new file mode 100644 index 00000000..7e9f95ab --- /dev/null +++ b/tools/mermaid/.tool-dump.test.json @@ -0,0 +1 @@ +{"type":"Deno","content":[{"name":"mermaid","homepage":null,"author":"@@official.shinkai","version":"1.0.0","js_code":"import axios from 'npm:axios@1.7.7';\nimport { shinkaiLlmPromptProcessor } from './shinkai-local-tools.ts';\nimport { encodeBase64 } from \"https://deno.land/std@0.224.0/encoding/base64.ts\";\nimport { deflate } from \"https://deno.land/x/compress@v0.4.5/zlib/deflate.ts\";\nimport { getHomePath } from './shinkai-local-support.ts';\n/**\n * Configuration for the tool.\n */\ntype CONFIG = {\n /**\n * How many times to attempt LLM fixes if Kroki fails to parse the Mermaid diagram.\n */\n maxRetries?: number;\n};\n\n/**\n * Inputs for the tool: a single textual description from the user.\n */\ntype INPUTS = {\n description: string;\n};\n\n/**\n * Final output from the tool:\n * - The base64-encoded PNG\n * - The final (valid) Mermaid code that was successfully parsed.\n */\ntype OUTPUT = {\n pngBase64: string;\n finalMermaid: string;\n};\n\n/**\n * This function:\n * 1. Takes a textual description and asks an LLM to produce Mermaid code.\n * 2. Sends the Mermaid code to Kroki (https://kroki.io/) to validate and render a PNG.\n * 3. If Kroki fails to parse, it sends the error back to the LLM to refine the Mermaid code.\n * 4. Repeats up to `maxRetries` times. If still invalid, throws an error.\n */\nexport async function run(config: CONFIG, inputs: INPUTS): Promise {\n const { description } = inputs;\n const maxRetries = config.maxRetries ?? 5;\n\n /**\n * Helper: build the JSON payload Kroki expects to attempt rendering a Mermaid PNG.\n */\n function buildKrokiPayload(mermaidSource: string) {\n return {\n diagram_source: mermaidSource,\n diagram_type: 'mermaid',\n output_format: 'png',\n };\n }\n\n /**\n * Attempt to render with Kroki. On success: return { ok: true, data: Buffer }.\n * On failure: return { ok: false, error: string }.\n */\n async function tryKrokiRender(mermaidCode: string) {\n console.log('Attempting to render with Kroki:', { mermaidCode });\n \n // Basic validation before sending to Kroki\n if (!mermaidCode.trim().startsWith('graph')) {\n console.log('Basic validation failed: Code does not start with \"graph\"');\n return { ok: false, error: 'Invalid Mermaid syntax: Must start with \"graph\"' };\n }\n\n try {\n // First deflate the diagram\n const encoder = new TextEncoder();\n const compressed = deflate(encoder.encode(mermaidCode.trim()), { level: 9 });\n // Then base64 encode it\n const encodedDiagram = encodeBase64(compressed).replace(/\\+/g, '-').replace(/\\//g, '_');\n console.log('Encoded diagram:', { encodedDiagram });\n \n console.log('Sending request to Kroki...');\n const resp = await axios.get(`https://kroki.io/mermaid/png/${encodedDiagram}`, {\n responseType: 'arraybuffer',\n timeout: 30000,\n headers: {\n 'Accept': 'image/png',\n },\n validateStatus: (status) => status === 200,\n });\n \n console.log('Received successful response from Kroki');\n return { ok: true, data: new Uint8Array(resp.data) };\n } catch (err: any) {\n console.log('Error from Kroki:', {\n status: err.response?.status,\n headers: err.response?.headers,\n isAxiosError: err.isAxiosError,\n message: err.message,\n data: err.response?.data?.toString()\n });\n\n // Handle various error cases\n if (err.response) {\n const errorData = err.response.data;\n let errorMessage = '';\n \n try {\n // Try to parse error as JSON if it's not binary data\n if (err.response.headers['content-type']?.includes('application/json')) {\n const jsonError = JSON.parse(errorData.toString());\n errorMessage = jsonError.error || jsonError.message || String(errorData);\n } else {\n errorMessage = errorData.toString();\n }\n } catch (parseErr) {\n console.log('Error parsing error response:', parseErr);\n errorMessage = errorData.toString();\n }\n\n console.log('Formatted error message:', errorMessage);\n return {\n ok: false,\n error: `Kroki error (HTTP ${err.response.status}): ${errorMessage}`,\n };\n }\n\n // Network or other errors\n return { ok: false, error: `Request failed: ${err.message}` };\n }\n }\n\n /**\n * Validate Mermaid syntax before sending to Kroki\n */\n function validateMermaidSyntax(code: string): { isValid: boolean; error?: string } {\n console.log('Validating Mermaid syntax for:', { code });\n \n const trimmed = code.trim();\n \n // Basic syntax checks\n if (!trimmed.toLowerCase().startsWith('graph')) {\n console.log('Validation failed: Does not start with \"graph\"');\n return { isValid: false, error: 'Diagram must start with \"graph\"' };\n }\n\n const lines = trimmed.split('\\n').map(line => line.trim()).filter(line => line);\n console.log('Processing lines:', { lines });\n \n const firstLine = lines[0];\n \n // Check graph direction\n if (!firstLine.toLowerCase().match(/^graph\\s+(td|lr)$/)) {\n console.log('Validation failed: Invalid graph direction:', { firstLine });\n return { isValid: false, error: 'First line must be \"graph TD\" or \"graph LR\"' };\n }\n\n // Check for basic node definitions\n const nodeLines = lines.slice(1);\n for (const line of nodeLines) {\n console.log('Checking node line:', { line });\n // More lenient regex that allows various amounts of whitespace\n if (!line.match(/^[A-Za-z0-9]+(?:\\[[^\\]]+\\])?\\s*(?:-->|---|==>)\\s*[A-Za-z0-9]+(?:\\[[^\\]]+\\])?$/)) {\n console.log('Validation failed: Invalid node definition:', { line });\n return { isValid: false, error: `Invalid node definition: ${line}` };\n }\n }\n\n console.log('Validation successful');\n return { isValid: true };\n }\n\n /**\n * LLM prompt to request a new or revised Mermaid code from the LLM.\n */\n async function requestMermaid(\n userDescription: string,\n priorError?: string,\n priorCode?: string\n ): Promise {\n let prompt = '';\n if (!priorError) {\n // initial request\n prompt = `Create a valid Mermaid.js diagram based on this description: \"${userDescription}\"\n\nRules:\n1. Start with either 'graph TD' (top-down) or 'graph LR' (left-right)\n2. Use simple node names (A, B, C, etc.) with descriptive labels in brackets\n3. Use standard arrows (-->)\n4. Avoid special characters in labels\n5. Return ONLY the Mermaid code, no explanations\n\nExample of valid format:\ngraph TD\n A[Start] --> B[Process]\n B --> C[End]`;\n } else {\n // revise with specific guidance based on prior error\n prompt = `The following Mermaid code needs correction:\n\\`\\`\\`\n${priorCode}\n\\`\\`\\`\n\nError received: ${priorError}\n\nPlease provide a corrected version following these rules:\n1. Keep the diagram simple and minimal\n2. Use only basic Mermaid syntax (graph TD/LR, basic nodes, arrows)\n3. Ensure all nodes are properly defined before being referenced\n4. Avoid special characters or complex styling\n5. Return ONLY the corrected Mermaid code\n\nExample of valid format:\ngraph TD\n A[Start] --> B[Process]\n B --> C[End]`;\n }\n const resp = await shinkaiLlmPromptProcessor({ format: 'text', prompt });\n \n // Clean up the response to extract just the Mermaid code\n let code = resp.message.trim();\n // Remove any markdown code block markers\n code = code.replace(/^```mermaid\\n/m, '').replace(/^```\\n/m, '').replace(/```$/m, '');\n return code.trim();\n }\n\n // Main logic:\n console.log('Starting Mermaid diagram generation for description:', { description });\n let currentMermaid = await requestMermaid(description, undefined, undefined);\n console.log('Initial Mermaid code generated:', { currentMermaid });\n\n for (let attempt = 0; attempt < maxRetries; attempt++) {\n console.log(`Attempt ${attempt + 1}/${maxRetries}`);\n \n // Validate syntax before sending to Kroki\n const validation = validateMermaidSyntax(currentMermaid);\n if (!validation.isValid) {\n console.log('Validation failed:', validation.error);\n // If invalid syntax, try to get a new diagram\n currentMermaid = await requestMermaid(\n description,\n `Invalid Mermaid syntax: ${validation.error}`,\n currentMermaid\n );\n console.log('Generated new Mermaid code after validation failure:', { currentMermaid });\n continue;\n }\n\n console.log('Validation passed, attempting to render');\n const renderResult = await tryKrokiRender(currentMermaid);\n if (renderResult.ok && renderResult.data) {\n console.log('Successfully rendered diagram');\n // Convert Uint8Array to base64 string\n const pngBase64 = encodeBase64(renderResult.data);\n\n await Deno.writeFile(await getHomePath() + '/mermaid.png', renderResult.data);\n\n return {\n pngBase64,\n finalMermaid: currentMermaid,\n };\n } else {\n console.log('Render failed:', renderResult.error);\n // Some error from Kroki. Let's refine\n const errorMessage = renderResult.error || 'Unknown error';\n currentMermaid = await requestMermaid(description, errorMessage, currentMermaid);\n console.log('Generated new Mermaid code after render failure:', { currentMermaid });\n }\n }\n\n console.log('Exhausted all attempts, throwing error');\n // If we've exhausted attempts, throw an error\n throw new Error(\n `Failed to produce a valid Mermaid diagram after ${maxRetries} attempts. Last code:\\n${currentMermaid}`\n );\n}\n","tools":[],"config":[],"description":"Generate diagrams and flowcharts using Mermaid syntax","keywords":["mermaid","diagram","flowchart","visualization","markdown"],"input_args":{"type":"object","properties":{"format":{"type":"string","description":"Output format for the diagram"},"code":{"type":"string","description":"Mermaid diagram code"}},"required":["code"]},"output_arg":{"json":""},"activated":false,"embedding":[0.1473912,0.36406702,0.24798857,0.05517683,-0.23758852,0.31766725,-0.9442741,-0.09152071,0.43158403,0.09048249,-0.10609762,0.043438293,0.1974183,0.2783122,0.19550017,-0.19595842,0.05905332,-0.18937245,-2.212373,0.020709183,-0.1715963,0.9479416,0.41530016,0.48319244,-0.5284023,0.29979026,0.041523878,-0.14618349,-1.7634075,-2.2565815,-0.112814255,0.43914485,-0.64862233,-0.21588148,0.38341537,-0.40412337,-0.40247685,0.22471578,0.018786833,0.08157326,0.41439688,-0.29295558,-0.26741764,0.029494613,0.5486692,-0.20717761,0.1308718,-0.04691784,0.36253986,0.13766594,-0.9454837,-0.3266868,0.3907776,-0.1516826,-0.6514942,0.7840602,-0.08903274,-0.9424447,0.7647805,0.67088383,-0.5258522,0.6524534,-3.2103648,0.34606338,0.87732273,0.029979214,-0.33562797,0.5006071,-0.3831311,0.57543683,0.12988134,0.007905354,-0.7006522,0.7179582,-0.13243961,-0.2675042,0.24980497,-0.04588282,0.6120932,0.20340307,-0.1945184,0.29798266,-0.25447577,0.26754233,-0.39022923,1.0875311,-0.30278155,-0.9085751,0.1633961,0.023871869,-1.2239043,-0.057842046,0.2291022,0.35866636,0.26932886,0.38790894,-0.16463119,-0.49751395,0.17330551,2.966278,0.40172148,-0.17436385,0.49209163,-0.94033986,0.6818061,-0.01251309,0.15235227,-0.21079573,0.23657885,-0.28681812,0.27866676,-0.49020824,0.23189953,-0.16221803,0.63141066,0.3603446,-0.9812063,0.079525776,-0.1426379,0.2681985,-0.1940695,0.10439265,-0.21297863,0.10064064,-0.0420674,0.01678428,-0.6100499,0.29424965,-0.32914516,-0.6442842,0.44675136,-0.09038498,0.025420789,0.25750092,-0.18986809,-0.09291384,0.5112717,-0.8414801,0.09572275,0.040667973,-0.04495269,-1.7570028,0.87505764,-0.010821082,0.6146562,0.80155486,-0.74056214,-0.13051683,-0.41860208,0.38466272,-0.026645806,0.17715836,0.11098516,-0.15316992,0.7338679,0.5390421,-0.026015528,0.2523774,-0.005859092,0.10631031,-0.11694361,-0.53699464,0.4423865,0.52385944,-0.004380673,-0.74416983,0.61669886,0.47654808,0.30290782,-0.47438404,0.0480341,0.115666516,-0.1923919,0.27877498,0.006822598,-0.25898677,-0.10084274,-0.40727592,0.66133875,-0.61889863,0.9241396,0.6101793,0.19157897,-0.67782557,0.023767881,0.39409655,0.049611464,0.2743058,0.09419783,1.0975288,-0.25723916,1.7599672,-0.47419602,0.35989678,0.52736247,0.16662972,0.40834928,0.34863663,-0.09850061,0.69282734,-0.5584163,0.2350834,0.20987627,0.22339775,-0.8214581,-0.24234681,0.6509826,0.10917969,-0.52044386,-0.071916446,-0.28136313,0.23671661,1.1388695,0.16611798,0.47715202,0.3649478,0.5349823,-0.063040644,1.0256945,0.15170643,0.7414669,0.35544312,-0.4710166,-0.4224858,-0.5501358,0.105756685,-0.30163708,-0.0876851,-0.5584384,-0.54095435,0.7640435,1.2730305,0.7316835,0.356886,0.37499896,0.061434243,-0.14113194,0.0895073,-0.28113735,-0.7180706,0.6567962,0.054032966,-0.045852922,-0.4529665,0.061231602,-0.6611216,-0.43338796,-0.59777874,0.007466607,2.0789723,0.4325974,0.23413719,0.36820862,0.31731686,-0.3376354,-0.17246872,-1.4873859,-0.68798023,-0.8930444,0.3455004,-0.36450115,-0.6014951,0.51963544,-0.36778736,-0.615483,-0.2254496,-0.7348241,-0.22478046,-0.30588913,0.26548004,0.42877358,0.13148764,-0.286552,0.5907783,-0.28855103,0.01297601,0.3443238,0.023918886,-0.41945443,-0.52734953,0.51761234,0.08758695,-0.08634468,0.25092155,-0.8731309,-1.0187926,-0.29000425,-0.016473956,-0.32946596,0.38846704,-0.1490954,-0.46070662,-0.32940146,0.041321643,1.8415471,0.6712961,0.049420517,0.8738283,0.19419764,-0.06534444,-0.70870894,-0.10333706,0.1993129,0.32762948,-0.9336474,0.27108386,0.16452035,-0.88468605,-0.5424003,0.27914506,-0.82342255,-0.3287407,0.1375333,0.35165274,0.3680399,-0.27817208,-0.12716195,0.46119192,-0.16596831,-2.485107,-0.09492403,0.68950045,0.6493485,-0.4035331,0.009098196,1.0379596,0.12834346,0.13569193,-0.48097742,1.4876671,-0.077691734,0.10705424,-0.31643555,0.2365497,0.9095974,-0.11448567,0.53148603,0.12122449,0.053812094,-0.22692323,0.614267,1.2932987,-0.040044963,0.59552485,-0.26148376,-0.43797952,-0.71703714,-0.69660115,0.19741488,-0.11610314,-0.21665953,0.27214947,-0.32160679,0.31816706,0.33457533,0.89919096,-0.43822947,-0.08759401,-0.30317047,1.4043416,-0.3121923,-0.11629807,-0.28007346,-0.20771945,0.15413277,0.027530938,0.27183092,-1.1095555,-0.18684256,0.49353984,-0.2255183,-0.5553104,0.15169331,0.010851804,0.8218062,-0.09449203,0.21363671,0.18891317,0.42439884,0.3699801,-0.5394913,-0.2805903,-0.37897098,-0.3535766],"result":{"type":"object","properties":{"format":{"description":"Format of the generated image (svg or png)","type":"string"},"image":{"description":"Base64 encoded image data","type":"string"}},"required":["image","format"]},"sql_tables":null,"sql_queries":null,"file_inbox":null,"oauth":null,"assets":null,"runner":"any","operating_system":["linux","macos","windows"],"tool_set":""},false]} \ No newline at end of file diff --git a/tools/mermaid/metadata.json b/tools/mermaid/metadata.json index ed88ca5f..4592092f 100644 --- a/tools/mermaid/metadata.json +++ b/tools/mermaid/metadata.json @@ -11,6 +11,9 @@ "visualization", "markdown" ], + "runner": "any", + "operating_system": ["linux", "macos", "windows"], + "tool_set": "", "configurations": { "type": "object", "properties": {}, diff --git a/tools/news-aggregator/.tool-dump.test.json b/tools/news-aggregator/.tool-dump.test.json new file mode 100644 index 00000000..dd5b0fdd --- /dev/null +++ b/tools/news-aggregator/.tool-dump.test.json @@ -0,0 +1 @@ +{"type":"Python","content":[{"version":"1.0.0","name":"News Aggregator","homepage":null,"author":"@@official.shinkai","py_code":"# /// script\n# requires-python = \"==3.10\"\n# dependencies = [\n# \"requests==2.31.0\",\n# \"newspaper3k==0.2.8\",\n# \"aiohttp==3.9.1\",\n# \"lxml==5.1.0\",\n# \"beautifulsoup4==4.12.2\",\n# \"nltk==3.8.1\",\n# \"feedparser==6.0.10\",\n# \"tldextract==5.1.1\",\n# \"feedfinder2==0.0.4\",\n# \"python-dateutil==2.8.2\",\n# \"cssselect==1.2.0\"\n# ]\n# ///\n\nimport newspaper\nfrom newspaper import Article\nfrom dataclasses import dataclass\nfrom typing import List, Optional, Dict, Any, Tuple\nimport asyncio\nimport aiohttp\nimport time\nimport feedparser\nfrom datetime import datetime\nimport logging\nimport traceback\nimport nltk\nimport os\n\n# Configure logging\nlogging.basicConfig(level=logging.INFO)\nlogger = logging.getLogger(__name__)\n\n# Download required NLTK data\ntry:\n nltk.data.find('tokenizers/punkt')\nexcept LookupError:\n logger.info(\"Downloading required NLTK data...\")\n nltk.download('punkt', quiet=True)\n\n# RSS feed URLs for major news sites - using more reliable feeds\nRSS_FEEDS = {\n \"reuters\": \"https://www.reutersagency.com/feed/?taxonomy=best-topics&post_type=best\",\n \"techcrunch\": \"https://techcrunch.com/feed\",\n \"theverge\": \"https://www.theverge.com/rss/index.xml\",\n \"wired\": \"https://www.wired.com/feed/rss\",\n \"bloomberg\": \"https://www.bloomberg.com/feeds/sitemap_news.xml\"\n}\n\n# Default news providers by category if none specified\nDEFAULT_PROVIDERS = {\n \"general\": [\n \"https://www.reutersagency.com/feed/?taxonomy=best-topics&post_type=best\", # Use RSS feed URL directly\n \"https://www.apnews.com\",\n \"https://www.bbc.com\",\n ],\n \"tech\": [\n \"https://techcrunch.com\",\n \"https://www.theverge.com\",\n \"https://www.wired.com\",\n ],\n \"business\": [\n \"https://www.bloomberg.com\",\n \"https://www.cnbc.com\",\n \"https://www.forbes.com\",\n ]\n}\n\n@dataclass\nclass AggregatedArticle:\n title: str\n url: str\n source: str\n summary: str\n publish_date: str\n authors: List[str]\n top_image: str\n text: str\n\nclass CONFIG:\n \"\"\"Configuration for the multi-source news aggregator\"\"\"\n language: str = \"en\"\n number_threads: int = 10\n request_timeout: int = 30\n max_concurrent_sources: int = 5\n \nclass INPUTS:\n \"\"\"Input parameters for news aggregation\"\"\"\n providers: List[str] # List of news provider URLs\n articles_per_source: Optional[int] = 5\n categories: Optional[List[str]] = None # If not provided, use all categories\n \nclass OUTPUT:\n \"\"\"Output structure containing aggregated news\"\"\"\n total_sources_processed: int\n total_articles_found: int\n failed_sources: List[str]\n articles: List[Dict[str, Any]]\n processing_time: float\n\ndef format_date(date: datetime) -> str:\n \"\"\"Format datetime object to ISO string or return empty string if None\"\"\"\n if date:\n return date.isoformat()\n return \"\"\n\nasync def process_article(article: Article, source_url: str) -> Optional[AggregatedArticle]:\n \"\"\"Process a single article with fallback for NLP failures\"\"\"\n try:\n article.download()\n article.parse()\n \n # Try NLP but don't fail if it errors\n try:\n article.nlp()\n except Exception as e:\n logger.warning(f\"NLP processing failed for {article.url}: {str(e)}\")\n # Create a basic summary from the first few sentences if NLP fails\n text = article.text or \"\"\n summary = \". \".join(text.split(\". \")[:3]) if text else \"\"\n \n return AggregatedArticle(\n title=article.title or \"\",\n url=article.url,\n source=source_url,\n summary=getattr(article, 'summary', \"\") or \"\",\n publish_date=format_date(article.publish_date) if article.publish_date else \"\",\n authors=article.authors or [],\n top_image=article.top_image or \"\",\n text=article.text or \"\"\n )\n except Exception as e:\n logger.warning(f\"Failed to process article {article.url}: {str(e)}\")\n return None\n\nasync def try_rss_feed(source_url: str, max_articles: int) -> List[AggregatedArticle]:\n \"\"\"Try to fetch articles using RSS feed if available\"\"\"\n try:\n # Extract domain from URL\n domain = source_url.split('www.')[-1].split('.com')[0] if 'www.' in source_url else source_url.split('.com')[0].split('//')[-1]\n \n if domain in RSS_FEEDS:\n feed = feedparser.parse(RSS_FEEDS[domain])\n articles = []\n \n for entry in feed.entries[:max_articles]:\n try:\n # Create article object from feed entry\n article = Article(entry.link)\n processed = await process_article(article, source_url)\n if processed:\n articles.append(processed)\n except Exception as e:\n logger.warning(f\"Error processing RSS entry {entry.link}: {str(e)}\")\n continue\n \n return articles\n except Exception as e:\n logger.warning(f\"Error fetching RSS feed for {source_url}: {str(e)}\")\n return []\n\nasync def process_source(source_url: str, max_articles: int, config: CONFIG) -> tuple[str, List[AggregatedArticle]]:\n \"\"\"Process a single news source and return its articles\"\"\"\n try:\n # Configure newspaper for this source\n newspaper.Config.language = config.language\n newspaper.Config.number_threads = config.number_threads\n newspaper.Config.request_timeout = 15 # Shorter timeout\n newspaper.Config.browser_user_agent = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36'\n newspaper.Config.fetch_images = False\n newspaper.Config.memoize_articles = False\n \n # Additional headers for better access\n newspaper.Config.headers = {\n 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36',\n 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',\n 'Accept-Language': 'en-US,en;q=0.5',\n 'DNT': '1',\n 'Connection': 'keep-alive',\n 'Upgrade-Insecure-Requests': '1',\n 'Sec-Fetch-Dest': 'document',\n 'Sec-Fetch-Mode': 'navigate',\n 'Sec-Fetch-Site': 'none',\n 'Sec-Fetch-User': '?1',\n 'Cache-Control': 'max-age=0'\n }\n \n # Special handling for Reuters - always use RSS feed\n if \"reuters.com\" in source_url:\n source_url = RSS_FEEDS[\"reuters\"]\n \n # Ensure URL uses HTTPS\n if not source_url.startswith('https://'):\n source_url = source_url.replace('http://', 'https://')\n if not source_url.startswith('https://'):\n source_url = 'https://' + source_url\n\n # Add www if not present and not an RSS feed\n if not source_url.startswith('https://www.') and 'feed' not in source_url:\n source_url = source_url.replace('https://', 'https://www.')\n \n # First try RSS feed\n articles = await try_rss_feed(source_url, max_articles)\n if articles:\n logger.info(f\"Successfully fetched {len(articles)} articles via RSS from {source_url}\")\n return source_url, articles\n \n # If RSS fails, try direct scraping\n logger.info(f\"Attempting direct scraping for {source_url}\")\n \n # Build paper\n paper = newspaper.build(source_url, \n language=config.language,\n memoize_articles=False)\n \n articles = []\n for i, article in enumerate(paper.articles):\n if i >= max_articles:\n break\n \n processed = await process_article(article, source_url)\n if processed:\n articles.append(processed)\n logger.info(f\"Successfully processed article: {article.url}\")\n \n if articles:\n logger.info(f\"Successfully fetched {len(articles)} articles via scraping from {source_url}\")\n else:\n logger.warning(f\"No articles found for {source_url}\")\n \n return source_url, articles\n except Exception as e:\n logger.error(f\"Failed to process {source_url}: {str(e)}\\n{traceback.format_exc()}\")\n return source_url, []\n\nasync def run(config: CONFIG, inputs: INPUTS) -> OUTPUT:\n \"\"\"\n Aggregate latest news from multiple sources in parallel.\n \"\"\"\n start_time = time.time()\n output = OUTPUT()\n output.failed_sources = []\n output.articles = []\n \n # Use default providers if none specified\n providers = inputs.providers\n if not providers:\n if inputs.categories:\n providers = []\n for category in inputs.categories:\n if category.lower() in DEFAULT_PROVIDERS:\n providers.extend(DEFAULT_PROVIDERS[category.lower()])\n else:\n # Use all default providers if no categories specified\n providers = [url for urls in DEFAULT_PROVIDERS.values() for url in urls]\n \n # Process sources in parallel with rate limiting\n semaphore = asyncio.Semaphore(config.max_concurrent_sources)\n async with semaphore:\n tasks = []\n for source_url in providers:\n task = asyncio.create_task(\n process_source(\n source_url,\n inputs.articles_per_source,\n config\n )\n )\n tasks.append(task)\n \n # Wait for all tasks to complete\n results = await asyncio.gather(*tasks)\n \n # Process results\n successful_sources = 0\n total_articles = 0\n \n for source_url, articles in results:\n if articles:\n successful_sources += 1\n total_articles += len(articles)\n \n # Convert articles to dictionary format\n for article in articles:\n output.articles.append({\n \"title\": article.title,\n \"url\": article.url,\n \"source\": article.source,\n \"summary\": article.summary,\n \"publish_date\": article.publish_date,\n \"authors\": article.authors,\n \"top_image\": article.top_image,\n \"text\": article.text\n })\n else:\n output.failed_sources.append(source_url)\n \n # Sort articles by publish date (most recent first)\n output.articles.sort(\n key=lambda x: x[\"publish_date\"] if x[\"publish_date\"] else \"0\",\n reverse=True\n )\n \n output.total_sources_processed = successful_sources\n output.total_articles_found = total_articles\n output.processing_time = time.time() - start_time\n \n return output ","tools":[],"config":[{"BasicConfig":{"key_name":"language","description":"The language to use for article processing","required":false,"type":null,"key_value":null}},{"BasicConfig":{"key_name":"number_threads","description":"Number of threads for article processing","required":false,"type":null,"key_value":null}},{"BasicConfig":{"key_name":"request_timeout","description":"Timeout in seconds for HTTP requests","required":false,"type":null,"key_value":null}},{"BasicConfig":{"key_name":"max_concurrent_sources","description":"Maximum number of sources to process concurrently","required":false,"type":null,"key_value":null}}],"description":"Aggregates latest news from multiple sources using newspaper3k, supporting parallel processing and category-based filtering","keywords":["news","aggregator","newspaper3k","scraper","articles","multi-source"],"input_args":{"type":"object","properties":{"categories":{"type":"array","description":"Categories to fetch news from (uses default providers if no specific providers given)","items":{"type":"string","description":"News category"}},"providers":{"type":"array","description":"List of news provider URLs to aggregate from","items":{"type":"string","description":"URL of the news provider"}},"articles_per_source":{"type":"integer","description":"Maximum number of articles to fetch per source"}},"required":["providers"]},"output_arg":{"json":""},"activated":false,"embedding":[0.47526938,0.4953609,-0.7539297,-0.4213634,-0.18249615,-0.3445613,0.059170797,-0.32747915,-0.55344987,-0.07627457,-0.25242993,0.61151814,0.6212426,-0.2172963,-0.19604032,-0.49254626,-0.06184599,-0.5833528,-1.952888,-0.21834213,0.9383628,0.28269887,0.18889183,0.18071964,0.71191776,-0.0076759034,-0.28750116,-0.61064374,-0.465151,-2.1860697,0.600066,0.5523878,-0.57666177,-0.19712755,-0.31296527,-0.60839844,-0.38727087,-0.43875867,-0.4103421,-0.13580273,0.57579815,0.31535262,-0.24596766,0.26801836,0.23782909,-0.2687323,0.17434858,-0.2696924,0.304609,0.42853475,-0.06755791,-0.35422504,-0.458871,-0.1397486,-0.35692644,-0.21732676,0.21275057,0.47052473,-0.09455772,0.16207723,0.050200723,0.21347103,-4.0008683,0.07265331,0.042692687,-0.03948301,0.31243417,0.16889101,-0.29429957,0.468549,0.31565982,0.43296093,0.27258793,0.22502348,-0.29342496,-0.7445577,0.47258988,-0.5784571,-0.08010504,-0.43132627,0.51002,0.5450627,-0.45935446,-0.30024526,-0.44491336,0.6636507,-0.86530024,-0.55189574,0.20723236,-0.48232386,0.20877907,0.052227266,0.07153457,-0.19411328,-0.15183812,0.5532529,-0.15942256,0.7170253,0.24215907,3.399865,0.5470605,-0.058721747,0.19130938,-0.5211649,0.45476967,-0.7763161,0.10674085,-0.083470814,0.10409772,0.08124617,-0.032256164,-0.21957931,0.46640643,-0.09472006,0.22037272,0.60221195,-0.47335482,0.1141192,0.015111724,0.37610847,0.031500325,0.04028113,-0.30098668,-0.34179255,-0.06408883,0.20924407,-0.2656547,0.2886469,0.24822132,-0.32637447,0.2162486,-0.8918812,-1.2007765,-0.37820992,-0.17327838,0.3234111,0.8108251,-0.2535401,0.22747561,-1.1781744,0.0049649775,-1.14906,0.59274274,-0.078641266,0.72137225,0.6054177,-0.25390625,0.15279242,-0.84940904,0.49320555,-0.15944539,0.46448833,0.14899099,-0.17157373,1.0941906,-0.18673392,-0.014947396,0.2806765,-0.7332697,0.08063069,-0.104901776,0.2650577,0.53099155,-0.10254942,0.00782774,-0.7080512,0.41145474,-0.22980839,0.62229615,0.1702511,0.44004092,0.044538505,0.11197571,0.8295875,-0.26212522,-0.08837201,-0.43531528,-0.29162502,0.69938177,-0.25650084,0.44456664,0.9730888,-0.38067976,-0.20776,-0.4901542,0.65263367,0.15264961,0.28978726,1.0760404,0.985356,-0.18591347,1.4820762,-0.5612234,-0.18539436,0.040458065,-0.06148353,-0.54066044,0.16859727,0.9160127,0.4443738,0.15513156,0.26086074,-0.23979916,-0.10413779,0.23503867,-0.7062806,0.40655932,-0.3828966,0.53477544,-0.76662725,0.019249544,0.163788,0.34116694,0.14305028,0.10919537,-0.07697471,0.053621925,-0.14774406,0.49686512,1.0013852,0.330999,0.20489115,-0.07479863,-0.70555043,-0.59187436,0.023208153,-0.784217,-0.2086444,-0.08256975,0.38271224,0.73024285,0.42666999,0.23859897,0.49071372,0.6518053,-0.11779735,0.31844163,0.82380724,0.41055378,-0.31385192,0.36048335,0.21993056,-0.4547515,0.21402921,0.46906197,-0.010404289,-0.034571033,-0.11041315,0.19220428,1.6250243,0.434003,-0.14742555,0.5164056,0.3704263,0.20215431,-0.29232323,-1.0828396,0.09933846,-0.2926279,0.3887126,-0.5572146,-0.6148859,0.40866736,0.4752134,0.08526811,-0.040201228,-0.073706925,0.075207,0.19704354,-0.24850154,0.10333117,0.11240796,-0.10289113,-0.22215346,0.018319115,0.24484445,0.5875986,-0.001396127,-0.6715586,-0.49839938,0.84074277,-0.0767863,-0.26675248,0.28035533,-0.67623335,-0.263601,-0.6688575,0.18970585,-0.5487923,0.8651192,-0.15903415,-0.8387729,-0.11012623,-0.5398837,1.6945384,0.03899939,0.49038184,0.54203624,-0.039890908,-0.297378,-0.1514954,0.43277514,-0.29324028,-0.26331797,-0.26841545,-0.69370955,0.54141575,-0.219119,-0.121275686,0.25459477,-0.38255924,-0.14859927,0.4139896,-0.1518263,0.7788728,-0.5210492,-0.052708372,0.52959955,0.23969384,-2.5637732,-0.3646096,0.088783875,0.16927765,-0.20440555,0.014467901,0.9040701,-0.24180907,0.04352094,-0.59232676,0.89461696,0.22022966,-0.080807015,-0.71604913,0.12687609,0.5447235,-0.41935638,-0.37054712,-0.3010311,-0.6222862,-0.36154068,-0.19361559,1.4531188,0.3193091,0.17359017,-0.37251654,0.5885344,-0.5304642,-0.90737766,1.0579817,0.37693805,-0.110948555,0.43083888,-0.47653425,-0.65940446,0.17339955,1.35262,0.079714835,-0.07835302,-0.24392623,1.2289393,-0.5184187,-0.1307936,-0.007878594,0.6055258,0.055373766,0.34789962,0.320513,-0.018046744,0.09805898,0.0036491752,-0.28539872,-0.42375314,-0.0008817464,-0.29914862,0.5400663,-0.17257236,0.62332153,0.612576,0.18791531,0.022848241,-0.32972604,-0.13474633,-0.8564286,0.3612426],"result":{"type":"object","properties":{"articles":{"items":{"properties":{"authors":{"items":{"type":"string"},"type":"array"},"publish_date":{"type":"string"},"source":{"type":"string"},"summary":{"type":"string"},"text":{"type":"string"},"title":{"type":"string"},"top_image":{"type":"string"},"url":{"type":"string"}},"type":"object"},"type":"array"},"failed_sources":{"items":{"type":"string"},"type":"array"},"processing_time":{"type":"number"},"total_articles_found":{"description":"Total number of articles found across all sources","type":"integer"},"total_sources_processed":{"description":"Number of news sources that were processed","type":"integer"}},"required":["total_sources_processed","total_articles_found","failed_sources","articles","processing_time"]},"sql_tables":null,"sql_queries":null,"file_inbox":null,"oauth":null,"assets":null,"runner":"any","operating_system":["linux","macos","windows"],"tool_set":""},false]} \ No newline at end of file diff --git a/tools/news-aggregator/metadata.json b/tools/news-aggregator/metadata.json index 61957322..5d4d9623 100644 --- a/tools/news-aggregator/metadata.json +++ b/tools/news-aggregator/metadata.json @@ -12,6 +12,9 @@ "articles", "multi-source" ], + "runner": "any", + "operating_system": ["linux", "macos", "windows"], + "tool_set": "", "configurations": { "type": "object", "properties": { diff --git a/tools/ntfy-push/.tool-dump.test.json b/tools/ntfy-push/.tool-dump.test.json new file mode 100644 index 00000000..2500916f --- /dev/null +++ b/tools/ntfy-push/.tool-dump.test.json @@ -0,0 +1 @@ +{"type":"Deno","content":[{"name":"Ntfy Push Notifications","homepage":null,"author":"@@official.shinkai","version":"1.0.0","js_code":"import axios from 'npm:axios@1.7.7';\n\ntype Configurations = {\n serverUrl?: string;\n};\n\ntype Parameters = {\n topic: string;\n message: string;\n title?: string;\n priority?: 'min' | 'low' | 'default' | 'high' | 'urgent';\n tags?: string;\n};\n\ntype Result = {\n success: boolean;\n message: string;\n};\n\nexport type Run, I extends Record, R extends Record> = (\n config: C,\n inputs: I\n) => Promise;\n\nexport const run: Run = async (\n configurations: Configurations,\n params: Parameters\n): Promise => {\n try {\n const serverUrl = configurations?.serverUrl || 'https://ntfy.sh';\n const { topic, message, title, priority, tags } = params;\n\n // Build request headers\n const headers: Record = {\n 'Content-Type': 'text/plain',\n };\n\n if (title) {\n headers['Title'] = title;\n }\n\n if (priority) {\n headers['Priority'] = priority;\n }\n\n if (tags) {\n headers['Tags'] = tags;\n }\n\n // Send notification using ntfy's HTTP API\n const response = await axios.post(\n `${serverUrl}/${topic}`,\n message,\n { headers }\n );\n\n if (response.status === 200) {\n return {\n success: true,\n message: 'Notification sent successfully'\n };\n } else {\n return {\n success: false,\n message: `Failed to send notification: HTTP ${response.status}`\n };\n }\n } catch (error) {\n let errorMessage = 'An unknown error occurred';\n if (error instanceof Error) {\n errorMessage = error.message;\n }\n return {\n success: false,\n message: `Error: ${errorMessage}`\n };\n }\n};\n","tools":[],"config":[{"BasicConfig":{"key_name":"serverUrl","description":"The ntfy server URL. Defaults to https://ntfy.sh if not provided.","required":false,"type":null,"key_value":null}}],"description":"Sends push notifications to specific groups using ntfy. Supports message priority, tags, and titles.","keywords":["ntfy","notifications","push","shinkai"],"input_args":{"type":"object","properties":{"message":{"type":"string","description":"The notification message content"},"title":{"type":"string","description":"Optional title for the notification"},"topic":{"type":"string","description":"The topic/group to send the notification to. Acts as a channel for notifications."},"tags":{"type":"string","description":"Comma-separated list of tags. Can include emoji shortcodes."},"priority":{"type":"string","description":"Priority level of the notification. Affects how urgently the notification is delivered."}},"required":["topic","message"]},"output_arg":{"json":""},"activated":false,"embedding":[0.22053008,-0.23308788,-0.45831287,-0.8216395,0.2060047,0.097966015,-0.60396683,0.31266215,0.2907155,-0.21612851,0.2162723,0.72355556,-0.42486846,-0.096117765,0.2819585,-0.24924275,0.23125264,-1.4162096,-1.6513793,0.52792203,-0.113545924,1.2946557,0.55482364,0.24141155,0.31373122,-0.5510993,-0.47869053,0.6213199,-0.3392297,-1.6577462,-0.08671852,0.9687446,-0.4529897,-0.2479738,0.054232515,0.14903739,-0.051238056,-0.16253081,-0.81651855,0.13794206,0.09594439,-0.2942096,-0.50189894,0.44979304,-0.23004755,-0.29039463,0.20756322,-0.018597037,0.13946295,0.5400521,0.06574689,0.17728776,-0.11698468,0.60064995,-0.27636495,0.02254577,-0.12050481,0.7368309,0.117831066,0.6379093,-0.078697965,0.4874056,-2.9534228,0.3453095,0.11381041,-0.14073756,-0.67365813,-0.31909502,0.26497966,-0.31905812,0.5888301,-0.39705887,-0.314874,0.8191168,-0.44242212,-0.6584438,0.157062,0.42796382,-0.014322706,0.32363078,0.03927198,0.82547253,0.076867595,-0.59535795,-0.8928584,0.5248866,-0.6197831,-0.43569222,-0.44033188,0.63102114,-0.5330492,0.09979509,0.40482882,0.10063244,-0.7705069,0.21489316,0.17107399,0.9237502,1.0151036,3.3003685,0.5650762,0.6833879,-0.017996378,-0.28243905,0.68769544,-0.3291847,-0.4397267,-0.2662798,-0.08094765,-0.35823697,0.1263233,-0.6098179,-0.53893936,-0.49382973,0.014272803,0.46858513,-0.6225431,0.25171924,-0.13711403,0.73455286,0.21732822,-0.15321752,-1.5502243,-0.9504878,-0.19396608,0.2386984,-1.1704068,0.2335211,0.44238636,-0.11372779,0.45646274,-0.5107696,-0.7328424,-0.31691357,-0.71409506,0.1450852,0.5052389,-0.20677437,-0.0895473,-0.39498624,0.8960275,-1.5312064,1.2054399,0.03215282,0.25789875,-0.409857,-0.044123173,-0.4313174,-1.2743952,0.31412846,-0.12804607,-0.11513892,0.50054383,-0.006194148,0.46024692,-0.23948848,0.24171092,0.648865,-0.615761,-0.2576605,-0.023038635,-0.22250779,0.26389396,0.39702743,0.54212725,-0.47864217,0.1738223,-0.43455857,0.37347978,0.3115453,0.13095196,0.046394788,0.30588624,0.057854246,-0.10528853,0.15796155,0.1237129,-0.3147446,0.72842425,-0.6495607,0.43106335,-0.041189097,-0.7907367,-0.1179979,-0.49566233,0.13492045,0.2547516,-0.35382986,0.84132266,0.5025265,-0.69758654,1.1305681,-0.44769102,-0.34780714,0.34184107,-0.5775259,-0.32568657,0.7512449,0.10083984,0.5954811,-0.59243476,-0.97330236,-0.32861063,-0.07467289,-0.98788744,-1.0931531,1.4558731,0.6624791,0.4054293,0.013877079,0.1940619,-0.1374109,0.4864646,0.18795654,0.18938848,-0.15176845,-0.33596444,0.3555235,0.01038894,0.25913802,0.6149691,0.42421773,-0.8724932,-0.50436306,-0.5054236,-0.40212184,-0.22209683,-0.3047288,-0.4665416,-0.49064946,-0.3677456,1.1156268,0.82560396,0.79798573,0.8286371,-0.0014434606,-0.3822465,0.81328964,0.66995645,-0.088342726,0.11401273,0.032993156,0.07968558,-0.410572,0.73188096,-0.17468107,0.0020657256,0.31107202,0.0020445567,1.3651462,0.4879689,0.3696962,0.89271903,-0.36121035,0.4573343,-0.79111093,-1.349992,0.35418445,-0.33507717,0.9499192,0.5084691,-0.36902204,0.53466314,0.079748794,0.003542827,0.3986133,-1.0402333,-0.06560193,-1.0191486,0.06899493,0.30530143,0.44587737,-0.86903197,-0.059978314,-0.38182685,-0.6374546,0.08173709,0.4117767,-0.34475413,-0.047856852,0.08340658,0.7555613,0.37293187,0.51895267,-0.18685904,-0.8161876,-0.5463563,-0.57206035,-0.7052285,0.42715633,-0.30013555,-0.25319588,-0.6610463,0.3081457,2.0190918,0.8826412,-0.28581515,0.13308282,0.5041968,0.17998149,0.24239567,-0.08905003,-0.64134145,-0.40685892,-1.0533433,-0.34681427,0.31865114,-0.46428257,-0.27486685,0.14497258,0.3734764,0.751666,0.32935518,-0.54193693,0.61391586,-0.37419972,-0.17420797,0.95534813,-0.1581281,-1.5987502,0.25759137,1.0456547,0.2302239,-0.6927719,-0.8352292,0.7477316,0.085436545,-0.31056505,-0.060424514,1.6970961,-0.012485772,-0.34271663,-0.7946064,-0.19418617,0.40684026,-0.36927694,0.5949851,0.2533793,-0.37646776,-0.5808698,0.49802795,1.4580505,0.015968803,0.28370604,-0.532292,-0.025305852,-0.16036057,-0.8079592,1.0513912,0.2740907,-0.23885982,0.6588762,-0.063837245,-0.47050068,0.3712828,1.0858387,-0.25099015,0.025424618,-0.20300305,1.5445518,0.5405677,0.37430054,-0.63216126,0.3001759,0.015945949,-0.7286671,0.6929011,-0.27199253,-0.61984885,0.7034571,0.015405629,-0.18663794,0.42980376,-0.2493029,0.35709202,-0.17907648,-0.020619806,0.28485912,0.52090824,0.759571,-0.10535569,0.09427047,-1.2930019,0.37343073],"result":{"type":"object","properties":{"message":{"description":"Success message or error details","type":"string"},"success":{"description":"Whether the notification was sent successfully","type":"boolean"}},"required":["success","message"]},"sql_tables":null,"sql_queries":null,"file_inbox":null,"oauth":null,"assets":null,"runner":"any","operating_system":["linux","macos","windows"],"tool_set":""},false]} \ No newline at end of file diff --git a/tools/ntfy-push/metadata.json b/tools/ntfy-push/metadata.json index ff388bfe..6a9bc4da 100644 --- a/tools/ntfy-push/metadata.json +++ b/tools/ntfy-push/metadata.json @@ -10,6 +10,9 @@ "push", "shinkai" ], + "runner": "any", + "operating_system": ["linux", "macos", "windows"], + "tool_set": "", "configurations": { "type": "object", "properties": { diff --git a/tools/pdf-summarize-to-audio/.tool-dump.test.json b/tools/pdf-summarize-to-audio/.tool-dump.test.json new file mode 100644 index 00000000..6282bc7a --- /dev/null +++ b/tools/pdf-summarize-to-audio/.tool-dump.test.json @@ -0,0 +1 @@ +{"type":"Deno","content":[{"name":"PDF Summarize to Audio","homepage":null,"author":"@@official.shinkai","version":"1.0.0","js_code":"import { shinkaiLlmPromptProcessor, elevenLabsTextToSpeech, pdfTextExtractor } from './shinkai-local-tools.ts';\n\ntype CONFIG = {\n promptStructure: string;\n voicePrompt?: string\n};\n\ntype INPUTS = {\n pdfURL: string;\n};\n\ntype OUTPUT = {\n summaryText: string;\n audioFilePath: string;\n audiotext: string;\n};\n\nexport async function run(config: CONFIG, inputs: INPUTS): Promise {\n // Step 1: Extract and clean text from the PDF using pdfTextExtractor\n const extractedTextResult = await pdfTextExtractor({ url: inputs.pdfURL });\n const pdfText = extractedTextResult.text; // Assume it returns a string with the PDF text\n\n // Step 2: Summarize the text using ShinkaiLLPromptProcessor\n const summarizedTextResult = await shinkaiLlmPromptProcessor({\n format:'text',\n prompt: `Summarize a text following these guidelines and structure:\n \n ${config.promptStructure}\n \n This is the text to summarize, please don't hallucinate and make sure you follow the guidelines:\n \n ${pdfText}\n \n `,\n });\n const summarizedText = summarizedTextResult.message;\n let audiotext = summarizedText.replaceAll('*','').replaceAll('#',' ')\n if (config.voicePrompt && config.voicePrompt.length > 10) {\n audiotext = (await shinkaiLlmPromptProcessor({\n format: 'text',\n prompt: `Narrate a text using the following guidelines\n \n ${config.voicePrompt}\n \n The text to narrate is the following:\n \n ${audiotext}\n \n `\n })).message\n audiotext = audiotext.replaceAll('*','').replaceAll('#',' ')\n }\n // Step 3: Convert the summary text to speech using ElevenLabs Text to Speech\n const audioData = await elevenLabsTextToSpeech({\n text: audiotext\n });\n\n // Return the summary text and audio file path\n return {\n summaryText: summarizedText,\n audiotext,\n audioFilePath: audioData.audio_file,\n };\n}","tools":["local:::__official_shinkai:::pdf_text_extractor","local:::__official_shinkai:::shinkai_llm_prompt_processor","local:::__official_shinkai:::eleven_labs_text_to_speech"],"config":[{"BasicConfig":{"key_name":"promptStructure","description":"The structure for the summarization prompt","required":true,"type":null,"key_value":null}},{"BasicConfig":{"key_name":"voicePrompt","description":"The narration guidelines for the audio output","required":false,"type":null,"key_value":null}}],"description":"Extracts text from a PDF, summarizes it, and converts the summary to speech.","keywords":["PDF","summary","text to speech","audio"],"input_args":{"type":"object","properties":{"pdfURL":{"type":"string","description":"The URL of the PDF to download and extract text from"}},"required":["pdfURL"]},"output_arg":{"json":""},"activated":false,"embedding":[1.0432544,-0.36834455,0.181313,-0.33277452,-0.3196713,0.34649277,-1.0884508,0.4457932,0.3236362,-0.054711785,0.45752543,1.4834234,0.1826847,-0.3982493,0.11259848,-0.06865685,0.25712326,-0.60269856,-0.8940943,-0.3230404,0.11990942,1.3551714,0.18313855,0.16600873,0.36528194,0.14279282,0.09672104,-0.45469815,-0.7551879,-1.2635386,0.7248819,0.63838357,-0.11944096,0.27708894,-0.41706938,-0.952457,0.1589989,-0.07335083,-0.4809051,0.19214253,-0.3211593,0.05360864,-0.20623627,-0.042026922,0.25635377,-0.14192757,0.27933824,-0.07255143,0.9281829,0.40200973,-0.7464028,-0.76924306,0.019768871,0.4726826,0.027675644,-0.47337675,-0.021550506,-0.1703563,0.76447403,0.5126881,-0.34989595,-0.3726324,-3.6434221,0.30659243,0.29943207,0.3874654,-0.19279365,-0.29270384,-0.023182644,-0.021503136,-0.3328075,-0.11314181,-0.26879013,0.44603726,-0.6218299,-0.5076233,0.1007013,0.14381272,0.798409,-0.42739278,-0.7351992,0.6739814,0.24519561,0.1385136,-0.72541994,0.65045106,-0.4865076,-0.9152976,-0.2500314,0.31473678,-0.52179265,-0.3389321,-0.17010497,0.33536527,0.08769071,-0.24394567,0.3171702,-0.50687355,0.61813515,2.8098378,0.8161936,0.34911644,0.05489016,-1.1350987,-0.33578828,-0.6246309,-0.33656916,-0.022603532,0.39974642,-0.12163807,0.9622032,-0.6919468,-0.52396476,-0.15018527,0.38724735,0.99720824,-1.0453466,0.027802259,-0.048885304,-0.117366105,-0.2468063,0.13117677,-0.10559981,-0.32620764,0.06726359,-0.10922542,-0.036283158,0.10228696,0.44270563,-0.1969142,0.2022537,-0.032993298,-0.73859423,0.3055702,0.16649702,0.1335925,0.8542843,-0.9151211,0.595382,0.34168962,0.11851455,-1.7261951,0.5161462,0.3420631,0.59353405,0.32566598,-0.8384194,-0.12064088,-0.10120607,-0.4173842,0.2645383,0.5828862,0.10846853,-0.49517506,0.7886369,-0.50315595,-0.7425369,0.20613864,-0.53129655,0.30889776,0.041170333,-0.19314139,0.33074927,-0.47627217,0.08525897,-0.6128494,0.041844994,-0.45691347,0.22292809,0.49916804,0.23253101,-0.67588454,0.49551848,0.8495026,0.6820405,-0.9864502,0.011288896,0.17613871,0.14521052,-0.32042167,0.45026067,0.0478589,-0.53876245,-0.23251033,-0.18105999,0.28493047,0.14952937,-0.003559159,0.7794067,1.2087704,0.088326015,1.7774057,-0.9892721,-0.174093,-0.1238768,0.0423242,-0.008652121,-0.30949634,0.13939343,0.098484755,0.23002404,-0.07301524,-0.43787298,0.090228915,-0.02408173,-0.72370845,-0.53692234,0.6886849,-0.5076047,-0.55816424,0.21701366,-0.012601517,0.6021219,0.09275235,-0.20846736,0.21624249,-0.49914706,0.21217687,-0.6208886,0.20448086,0.28428665,-0.46510947,-0.41005248,-0.36426374,-0.53787297,0.7514749,0.124325834,-0.21350677,-0.48461333,-0.23579006,0.62620676,0.7499298,0.9548994,1.0449216,0.34390914,0.21617228,0.08379944,0.103277355,0.20722708,-0.24566549,0.46843493,0.21448395,0.27968967,0.56222814,0.14556429,-0.44128886,-0.23612812,0.072245985,-0.24378414,1.8774757,-0.336801,0.13011716,0.941774,0.834382,0.8155532,0.21625093,-1.5359159,-0.44967744,-0.6946601,0.41761142,-0.26844895,0.3399041,0.29105633,0.53198886,-0.0528584,-0.62933224,-0.30063888,-0.79204965,0.035104662,0.01390738,-0.13495,-0.24719293,-0.37676734,-0.552279,0.3394512,0.219995,0.01036655,0.43924084,-0.6532419,-1.0133543,0.51922244,-0.15585251,0.4071733,0.5284843,-0.40113664,-0.032522257,0.60240203,-0.63672304,0.11696607,0.5871987,-0.41312522,-0.8015595,-0.46976656,0.2667774,1.5950102,-0.024531387,-0.25732875,1.0977343,0.09735827,-0.23333777,-0.6115146,-0.20542908,-0.69470394,0.3151753,-0.40046403,-0.25545886,0.23938005,0.18763277,-0.24367547,0.9256439,-0.8307919,-0.31861353,0.1278534,-0.22680774,0.5106323,-0.29236946,0.16628423,0.4141457,-0.32703352,-2.2771082,-0.53764594,0.26151958,0.6541092,-0.79404235,0.24420314,0.6385065,-0.12788755,-0.085834816,-0.21425152,0.9487269,0.061861247,-0.46507585,-0.5986008,-0.15338406,1.2371473,-0.059363645,0.2438339,-0.41745368,-0.4812208,-0.18326156,0.6474818,1.2081387,0.3533445,0.91791534,-0.22356586,0.046997264,-0.183895,-1.1851515,0.11669266,-0.20182902,-0.7286837,0.5963219,-0.42722884,0.1793876,0.54988575,0.45515105,0.29630718,0.2154728,-0.307437,2.0084414,0.07953716,-0.0030713882,-0.28140482,-0.4508149,0.62184775,0.23913649,0.7068443,-1.1419231,-0.23744278,0.54166675,0.8782172,-0.4697371,0.68377316,0.21435747,0.79268986,0.394332,0.10443671,0.35471106,0.2880014,0.31009287,0.32523113,-0.42845735,-0.44451267,-0.4083839],"result":{"type":"object","properties":{"audioFilePath":{"description":"The local file path of the generated audio","type":"string"},"audiotext":{"description":"The trasncribed audio","type":"string"},"summaryText":{"description":"The summarized text from the PDF","type":"string"}},"required":["summaryText","audioFilePath"]},"sql_tables":[],"sql_queries":[],"file_inbox":null,"oauth":[],"assets":null,"runner":"any","operating_system":["linux","macos","windows"],"tool_set":""},false]} \ No newline at end of file diff --git a/tools/pdf-summarize-to-audio/metadata.json b/tools/pdf-summarize-to-audio/metadata.json index 6a7f250b..b61966f7 100644 --- a/tools/pdf-summarize-to-audio/metadata.json +++ b/tools/pdf-summarize-to-audio/metadata.json @@ -1,6 +1,9 @@ { "author": "Shinkai", - "configurations": { + "runner": "any", + "operating_system": ["linux", "macos", "windows"], + "tool_set": "", + "configurations": { "properties": { "promptStructure": { "description": "The structure for the summarization prompt", diff --git a/tools/pdf-text-extractor/.tool-dump.test.json b/tools/pdf-text-extractor/.tool-dump.test.json new file mode 100644 index 00000000..8be3e27a --- /dev/null +++ b/tools/pdf-text-extractor/.tool-dump.test.json @@ -0,0 +1 @@ +{"type":"Deno","content":[{"name":"PDF Text Extractor","homepage":null,"author":"@@official.shinkai","version":"1.0.0","js_code":"import { getDocument, GlobalWorkerOptions } from \"npm:pdfjs-dist\";\nimport { getHomePath } from './shinkai-local-support.ts';\n\n/* Configure PDF.js worker source */\nconst workerPath = `${await getHomePath()}/pdf.worker.mjs`\nGlobalWorkerOptions.workerSrc = workerPath;\n\n/**\n * Ensures the local presence of the PDF.js worker file.\n * Downloads it if not present.\n */\nexport async function ensureLocalPdfWorker(\n localPath = workerPath,\n remoteUrl = \"https://mozilla.github.io/pdf.js/build/pdf.worker.mjs\",\n): Promise {\n try {\n // Check if the worker file already exists\n await Deno.stat(localPath);\n } catch (error) {\n // If the file does not exist, download it\n if (error instanceof Deno.errors.NotFound) {\n const response = await fetch(remoteUrl);\n if (!response.ok) {\n throw new Error(\n `Failed to fetch PDF worker from \"${remoteUrl}\". HTTP status: ${response.status}`,\n );\n }\n const workerScript = (await response.text()).replace(/5\\.[0-9]+\\.[0-9]+/g,'4.10.38');\n await Deno.writeTextFile(localPath, workerScript);\n } else {\n throw error;\n }\n }\n}\n\ntype CONFIG = {};\ntype INPUTS = {\n url: string;\n};\ntype OUTPUT = {\n text: string;\n};\n\nexport async function run(config: CONFIG, inputs: INPUTS): Promise {\n const { url } = inputs;\n await ensureLocalPdfWorker();\n\n // Fetch the PDF as an ArrayBuffer\n const response = await fetch(url);\n if (!response.ok) {\n throw new Error(`Failed to fetch PDF from ${url}: ${response.statusText}`);\n }\n const arrayBuffer = await response.arrayBuffer();\n const fileName = `${await getHomePath()}/${Date.now()}.pdf`;\n await Deno.writeFile(fileName, new Uint8Array(arrayBuffer));\n\n // Load the PDF via PDF.js\n const loadingTask = getDocument(fileName);\n const pdf = await loadingTask.promise;\n\n let allText = \"\";\n\n // Loop through each page and extract text\n for (let pageNumber = 1; pageNumber <= pdf.numPages; pageNumber++) {\n const page = await pdf.getPage(pageNumber);\n const textContent = await page.getTextContent();\n\n // Convert text items into one readable string\n const pageText = textContent.items\n .map((item) => (item as any).str || \"\")\n .join(\" \");\n\n allText += pageText + \"\\n\";\n }\n\n // Clean the extracted text\n let cleanedText = allText;\n\n // Remove any bracketed content\n cleanedText = cleanedText.replace(/<[^>]*>/g, \"\");\n\n // Remove extra whitespace/newlines\n cleanedText = cleanedText\n .replace(/\\r\\n|\\r|\\n/g, \" \") // unify newlines\n .replace(/\\s\\s+/g, \" \") // collapse multiple spaces\n .trim();\n\n return { text: cleanedText };\n}","tools":[],"config":[],"description":"Extracts clean text from PDFs by fetching them using a URL and processing each page.","keywords":["PDF","text extraction","document processing","clean text"],"input_args":{"type":"object","properties":{"url":{"type":"string","description":"The URL from which to download the PDF"}},"required":["url"]},"output_arg":{"json":""},"activated":false,"embedding":[0.47950196,-0.23720612,-0.4739095,-0.057572156,-0.22289145,-0.12215724,-1.1232032,-0.114632085,0.74540067,0.46500957,0.51691747,1.2157003,0.2685607,-0.18258205,0.3347037,0.2532164,-0.12849566,-0.47357702,-1.3661141,0.16411316,0.48260593,1.1053368,-0.029245593,-0.12029722,-0.19155613,0.07244736,-0.5709995,-0.86572844,-1.0604583,-1.5045444,0.6979069,0.96138495,-0.5959788,0.21472988,-0.41086066,-0.28240418,0.09921712,0.55692565,-0.035034407,-0.66291815,-0.25153676,-0.15362054,-0.4215922,0.32764232,0.050686695,0.0782375,0.25011736,-0.073207885,1.000853,1.1700422,-0.2891622,-0.20139877,0.25305042,-0.6145823,0.06280497,-0.5746865,-0.4347064,0.16066779,0.22904496,-0.09159894,-0.6476473,-0.17992347,-3.2483056,0.22410105,-0.010248607,0.22703445,-0.17313196,-0.25682652,-0.013457381,-0.27382433,-0.3237611,-0.032700576,-0.12025654,0.41375706,-0.21861467,-0.9301615,0.45608702,0.47004503,0.43157184,-0.849333,-0.4888681,1.178178,0.15340966,0.86916643,-0.7459181,0.8308149,-0.31840503,-0.3375388,0.2803176,0.21171194,0.23623382,-0.6738885,-0.3721835,0.2867513,-0.29887673,-0.20950218,-0.19086692,0.29039064,0.36921328,2.782228,0.38068318,0.68414605,0.006166391,-1.0541565,-0.33318695,-0.4817376,-0.12953524,-0.05687356,0.75140804,-0.022987211,0.16246018,-0.71455234,0.116426095,-0.29189512,-0.3454529,-0.54950315,-0.8175067,0.017835677,0.4101861,0.501908,0.07450095,0.38344252,-0.7775648,-0.97264713,0.06850061,-0.32256582,0.10990454,0.20043811,-0.06089422,-0.37432954,0.4744514,0.04706418,-1.4279135,0.62477803,-0.00088026,0.20442298,0.4924034,-0.5633193,0.41962025,0.07414221,0.37424588,-1.1699717,0.036268175,0.5919384,1.0787461,0.6412598,-0.1750173,-0.40990877,-0.04663465,0.49451593,0.37946522,0.39652517,-0.3700946,-0.27366185,0.41324043,0.17484066,-0.13148336,-0.2741853,-0.68669707,-0.29950714,-0.10169993,-0.332683,0.7854814,0.73153657,0.22064868,-0.58538514,0.18852873,0.2632215,0.3801682,0.08383156,0.92218935,-0.35376495,0.30919847,0.19948536,-0.45978826,-0.47107196,-0.31300566,-0.29762217,0.25636944,-0.47295517,1.1247565,0.47577083,-0.822506,-0.45051524,-0.5027582,0.62787956,-0.2534867,-0.17605561,0.8311156,1.1630596,-0.1905635,1.5743812,-0.8366021,-0.26960278,-0.040840395,-0.2403498,0.1624502,0.44952744,0.29546103,0.37128815,0.44061524,-0.59974015,-0.1686828,0.2109614,0.24465102,0.20422322,0.30742988,0.057840317,-0.49500054,-0.77164024,-0.2543415,-0.15323575,0.6430116,0.20518693,-0.03750205,-0.10194548,-0.5432967,0.08711964,-0.9966396,0.32268864,0.1838578,-0.34216473,-0.544464,-0.45991477,-0.8132705,0.8853987,0.30727723,0.28571844,-0.61779463,0.25951275,0.8809538,1.1338533,1.237843,1.4545444,1.0668154,-0.016126998,0.043073718,0.2786877,-0.0063531734,-0.059609827,0.97045755,-0.16826303,-0.30103835,0.21317734,-0.74566275,-0.7986319,0.20377856,0.07031648,0.30087754,1.5970867,0.35365412,0.0038065128,0.20580918,0.88697344,0.13643485,-0.041293047,-2.1390455,0.8189618,0.1419737,0.1792746,0.47045666,0.009204105,0.9533357,0.6316117,0.17689562,-0.5522349,-1.0226551,-0.7110119,-0.20278701,0.4080111,-0.24757059,0.560663,-0.043828443,-0.59059715,-0.404879,0.10577241,-0.04123819,0.038764026,-0.74717355,-0.93174005,0.4172794,0.012636526,-0.029905573,0.052580692,-0.57956475,0.33240777,0.05124646,-0.13313362,-0.37442774,1.1050551,-0.6497398,-0.7828791,-0.78243166,0.8027905,1.7154152,-0.23472264,0.46506697,0.29824853,-0.24557492,0.03664676,0.22853062,0.42163223,-0.7505829,-0.07960555,-0.019846715,-0.8190336,0.42343783,0.20334198,-0.77962255,0.14979826,-1.2549033,-0.018049516,0.58382505,-0.07663351,1.0662156,-0.14766884,0.26235652,-0.083747566,-0.22945072,-1.6846793,-0.24061072,0.059644964,0.5114838,-0.31563464,-0.024218883,1.1123962,-0.26439792,-0.65116656,-0.7292308,0.9626895,0.079173476,0.12281543,-0.112107575,-0.31702867,0.8684839,0.021466304,-0.056579776,-0.54263,-0.54572135,-0.07264054,0.4478262,0.8747079,0.24202472,-0.22940788,0.22682548,0.121613756,-0.16013917,-1.8160944,0.32065016,-0.4993313,-0.8018098,0.8681984,-0.24999574,-0.2793875,0.9513959,0.6856862,0.5121059,-0.37338242,-0.8987479,2.19133,-0.2398705,-0.75438744,-0.9445168,-0.5094822,-0.05471289,0.0092737,0.9541127,-0.24029693,-0.51365143,0.08389147,0.6447866,-0.23838335,0.36564142,0.19768806,0.68368405,0.30193162,0.33568695,0.33847088,0.12825163,0.2612636,0.938457,0.095568284,-0.395398,0.33624518],"result":{"type":"object","properties":{"text":{"description":"The extracted and cleaned text from the PDF","type":"string"}},"required":["text"]},"sql_tables":[],"sql_queries":[],"file_inbox":null,"oauth":[],"assets":null,"runner":"any","operating_system":["linux","macos","windows"],"tool_set":""},false]} \ No newline at end of file diff --git a/tools/pdf-text-extractor/metadata.json b/tools/pdf-text-extractor/metadata.json index dd6914fb..4459d3c4 100644 --- a/tools/pdf-text-extractor/metadata.json +++ b/tools/pdf-text-extractor/metadata.json @@ -1,6 +1,9 @@ { "author": "Shinkai", - "configurations": { + "runner": "any", + "operating_system": ["linux", "macos", "windows"], + "tool_set": "", + "configurations": { "properties": {}, "required": [], "type": "object" diff --git a/tools/pdf-whitepaper-analyzer/.tool-dump.test.json b/tools/pdf-whitepaper-analyzer/.tool-dump.test.json new file mode 100644 index 00000000..dc688d83 --- /dev/null +++ b/tools/pdf-whitepaper-analyzer/.tool-dump.test.json @@ -0,0 +1 @@ +{"type":"Deno","content":[{"name":"PDF Whitepaper Analyzer","homepage":null,"author":"@@official.shinkai","version":"1.0.0","js_code":"import {\n shinkaiLlmPromptProcessor,\n smartSearchEngine,\n} from \"./shinkai-local-tools.ts\";\nimport * as pdfjsLib from \"npm:pdfjs-dist\";\nimport { getAssetPaths } from \"./shinkai-local-support.ts\";\n\ntype CONFIG = { analysisGuide: string };\ntype INPUTS = { pdfUrl: string };\ntype OUTPUT = { projectAndAuthors: string; analysis: string; reviews: string };\n\nexport async function run(config: CONFIG, inputs: INPUTS): Promise {\n const { pdfUrl } = inputs;\n\n console.log(`pdf url ${pdfUrl}`);\n\n // Fetch the PDF file from the URL\n const response = await fetch(pdfUrl);\n if (!response.ok) {\n throw new Error(`Failed to download PDF from ${pdfUrl}`);\n }\n const pdfData = await response.arrayBuffer();\n\n // Convert PDF data to text\n const pdfText = await extractTextFromPdf(pdfData);\n\n console.log(`pdf text ${pdfText.slice(0, 30)}`);\n\n let analysisGuide = config.analysisGuide;\n\n if (!analysisGuide) {\n const assets = await getAssetPaths();\n const analysisGuideFilePath = assets.find((f) =>\n f.match(/analysis-guide.txt$/)\n );\n analysisGuide = await Deno.readTextFile(analysisGuideFilePath);\n }\n\n console.log(`analysis guide ${analysisGuide}`);\n\n // Analyze the text using the LLM\n const projectAndAuthorsResult = await shinkaiLlmPromptProcessor({\n format: \"text\",\n prompt: `\n Get the project name, company and authors of the following whitepaper. Be very brief\n \n \n Whitepaper content: ${pdfText}\n `,\n });\n\n console.log(`project and authors ${projectAndAuthorsResult.message}`);\n\n // Analyze the text using the LLM\n const analysisResult = await shinkaiLlmPromptProcessor({\n format: \"text\",\n prompt: `\n Analyze the whitepaper content according to the following rules:\n\n \n ${analysisGuide}\n \n \n \n Whitepaper content: ${pdfText}\n `,\n });\n\n console.log(`analysis result ${analysisResult.message}`);\n\n // Search for reviews using Smart Search Engine\n const reviewsResult = await smartSearchEngine({\n question: `Reviews for ${projectAndAuthorsResult.message}`,\n });\n\n console.log(`reviews result ${reviewsResult}`);\n\n return {\n projectAndAuthors: projectAndAuthorsResult.message,\n analysis: analysisResult.message,\n reviews: reviewsResult.response,\n };\n}\n\nasync function extractTextFromPdf(pdfData: ArrayBuffer): Promise {\n const loadingTask = pdfjsLib.getDocument({ data: pdfData });\n const pdfDocument = await loadingTask.promise;\n let fullText = \"\";\n\n for (let pageNumber = 1; pageNumber <= pdfDocument.numPages; pageNumber++) {\n const page = await pdfDocument.getPage(pageNumber);\n const textContent = await page.getTextContent();\n const pageText = textContent.items.map((item) => item.str).join(\" \");\n fullText += pageText + \"\\n\";\n }\n\n return fullText;\n}\n","tools":["local:::__official_shinkai:::shinkai_llm_prompt_processor","local:::__official_shinkai:::smart_search_engine"],"config":[{"BasicConfig":{"key_name":"analysisGuide","description":"A guide for analyzing the PDF text.","required":false,"type":null,"key_value":null}}],"description":"A tool to analyze PDF documents by extracting text and processing it with language models and search engines.","keywords":["PDF","analysis","LLM","text extraction"],"input_args":{"type":"object","properties":{"pdfUrl":{"type":"string","description":"The URL of the PDF to analyze."}},"required":["pdfUrl"]},"output_arg":{"json":""},"activated":false,"embedding":[0.423801,-0.18661551,0.14740321,-0.21021657,0.2278818,0.28988475,-0.5767361,-0.21860981,0.109322,0.12868044,0.47303757,1.313076,0.13153777,-0.36706194,0.56782466,-0.7581509,-0.25041258,-0.31603357,-1.7853222,0.2492243,0.2694835,0.5600167,-0.08883495,-0.049936995,0.34359953,0.24093749,-0.35112393,-0.68394846,-0.7492186,-1.3010757,0.95929813,0.24476412,-0.58917207,0.075369984,-0.35283852,-0.2555589,0.62021214,0.33296323,-0.4202263,-0.63267183,0.000099236146,0.25902525,-0.5275457,0.08927413,-0.044439066,-0.62775064,0.50406915,-0.33963057,0.859649,0.6590482,-1.0668613,-0.8318907,-0.20911285,-0.61807513,-0.086136535,-0.29180205,-0.07561545,0.02365366,0.26683575,-0.08259273,-0.23851821,-0.21702337,-3.0817094,-0.3874015,0.10594146,0.3465618,-0.029480089,-0.051645692,-0.010131778,0.5918666,-0.043313637,-0.19580863,0.04939098,-0.011303268,-0.09142475,-0.69524276,0.34452948,0.34466004,0.83948207,-0.8162254,-0.38352877,0.6903696,-0.09521622,0.31146595,-1.094966,0.20196973,-0.33626658,-0.49363735,0.5273453,0.2171903,-0.63370913,-0.31022105,-0.3941659,-0.06499996,-0.2786642,0.21727021,0.045667518,0.6248698,0.15733406,2.792425,0.6301035,0.08007787,0.27595815,-1.7194163,-0.047613107,-0.46405682,0.05620605,-0.4460201,0.43595257,0.12987407,0.37177145,-0.28716576,-0.6394141,0.19208035,-0.27262115,0.07505621,-0.8613373,0.20704614,0.13719912,0.5603191,-0.17948009,0.7685074,-0.31248397,-0.8654645,-0.08383871,0.20769623,-0.0090949945,0.2512917,0.445126,-0.3512571,-0.023572527,0.31242687,-0.9847715,-0.06780011,-0.2677668,0.29966518,0.2856505,-0.7946645,0.044808395,-0.45959628,0.17919566,-1.0906861,0.6340593,0.6007818,0.863003,0.5429886,-0.06800261,-0.19870651,0.080376014,-0.7620275,-0.0042867884,0.6745558,-0.17252941,-0.1723623,0.43647486,-0.21111995,-0.8479472,-0.21439767,-0.20320551,0.20114255,-0.18280613,-0.18839835,0.25635353,0.8504807,0.0150042735,-0.51529294,0.73277676,-0.47498158,0.39714795,-0.07564016,0.8301492,0.35916013,0.63306344,0.7385807,-0.16462137,-0.3691845,0.032864794,-0.012212515,0.091847286,-1.308934,0.68939096,0.8114922,-0.29564184,-0.8161719,0.19247653,0.58967364,0.4265096,-0.41143748,0.48370355,1.0594572,-0.46510467,1.8141197,-0.61873496,-0.17882644,-0.027515868,-0.21109244,0.13165145,0.5855315,0.051036257,-0.13736159,-0.01353436,-0.59186155,-0.5038435,0.28547877,0.23611003,0.44645697,-0.14217097,-0.19551809,0.20959555,-0.5239158,0.04895185,-0.42941114,0.47424668,0.3490289,0.58387184,0.5742148,-0.08558759,0.37780565,-0.10374281,0.22071931,0.2099933,-0.5528973,-0.47962803,-0.42011556,-1.1539658,0.7248661,-0.049257856,0.5715247,-0.6184034,0.17467473,0.80966955,1.2742238,1.3213712,0.8188781,0.5204153,-0.5211242,0.16042206,0.59029627,-0.11247,-0.35830078,0.8744217,-0.44799873,-0.5385826,0.40918392,-0.11247939,-0.25163686,-0.13864158,0.49717063,0.4967139,1.586834,0.35764632,-0.33911622,0.16447768,0.9958485,0.6266255,-0.31995282,-1.9713733,0.01292535,-0.65813947,-0.21632215,0.16340303,0.15583912,0.86624587,0.7362063,0.062435333,-0.36476678,-1.0041244,-0.5792632,0.14043859,0.44960043,-0.51179194,0.24634427,0.3848244,-0.27847302,-0.13927141,0.18724105,0.25224146,0.3607922,-0.89649963,-0.71734756,-0.45854676,0.114145294,0.46868375,-0.09050551,-0.53591275,0.6001377,0.18057255,-0.29024947,-0.23951545,0.7314774,-0.5513221,-0.6741692,-0.5990145,0.55093145,1.8638138,0.16945218,0.41566065,0.50961834,0.28646687,-0.35741496,-0.18059477,0.03376765,-0.3810205,0.14249843,0.00034691393,-0.65900254,0.6077259,-0.2875925,-0.7607901,0.035151318,-1.7917153,0.5219402,1.164646,0.15583147,0.6847468,-0.5383456,0.65216804,0.29364157,0.22634937,-2.5049176,-0.3717611,0.6184735,0.734782,-0.7185792,-0.047098216,0.428109,0.20516175,-0.20852953,-0.20402047,1.110489,-0.41724426,-0.46064445,-0.14657271,-0.33685136,0.34284657,0.32416087,0.016230216,-0.46435413,-0.59177846,-0.3010303,0.47956303,1.011297,0.34073123,0.10133377,0.3148754,0.26785016,-0.42839426,-1.0192035,0.3667863,0.16388375,-0.57759154,0.9200919,0.37698573,-0.48049492,0.7809755,-0.13812333,0.20862332,-0.075822785,-0.1794264,2.2901664,-0.026986262,-0.24533013,-0.4977291,-0.17354402,-0.17954573,0.22924568,0.7177709,-0.76750237,-0.41624683,0.15332016,0.40053388,-0.07546927,0.79797614,0.051635575,0.71071714,0.17427203,-0.2339786,0.385182,0.09358862,0.0818937,0.33147013,-0.35623392,-0.8089209,0.44256473],"result":{"type":"object","properties":{"analysis":{"description":"The analysis of the PDF content based on the guide.","type":"string"},"projectAndAuthors":{"description":"The project name, company, and authors extracted from the PDF.","type":"string"},"reviews":{"description":"Reviews related to the project and authors.","type":"string"}},"required":["projectAndAuthors","analysis","reviews"]},"sql_tables":[],"sql_queries":[],"file_inbox":null,"oauth":[],"assets":null,"runner":"any","operating_system":["linux","macos","windows"],"tool_set":""},false]} \ No newline at end of file diff --git a/tools/pdf-whitepaper-analyzer/metadata.json b/tools/pdf-whitepaper-analyzer/metadata.json index 301c64d3..25b9bca9 100644 --- a/tools/pdf-whitepaper-analyzer/metadata.json +++ b/tools/pdf-whitepaper-analyzer/metadata.json @@ -7,6 +7,9 @@ "local:::__official_shinkai:::shinkai_llm_prompt_processor", "local:::__official_shinkai:::smart_search_engine" ], + "runner": "any", + "operating_system": ["linux", "macos", "windows"], + "tool_set": "", "configurations": { "properties": { "analysisGuide": { diff --git a/tools/perplexity-api/.tool-dump.test.json b/tools/perplexity-api/.tool-dump.test.json index e3d574df..cd537b56 100644 --- a/tools/perplexity-api/.tool-dump.test.json +++ b/tools/perplexity-api/.tool-dump.test.json @@ -1 +1 @@ -{"type":"Deno","content":[{"name":"Perplexity API","homepage":null,"author":"@@official.shinkai","version":"1.0.0","js_code":"type Configurations = {\n apiKey: string;\n};\ntype Parameters = {\n query: string;\n};\n\ntype Result = {\n response: string;\n};\n\ninterface PerplexityResponse {\n choices: Array<{\n message: {\n content: string;\n };\n }>;\n}\nexport type Run, I extends Record, R extends Record> = (config: C, inputs: I) => Promise;\n\nexport const run: Run = async (\n configurations,\n parameters,\n): Promise => {\n const response = await fetch('https://api.perplexity.ai/chat/completions', {\n method: 'POST',\n headers: {\n accept: 'application/json',\n authorization: `Bearer ${configurations.apiKey}`,\n 'content-type': 'application/json',\n },\n body: JSON.stringify({\n model: 'llama-3.1-sonar-small-128k-online',\n messages: [\n { role: 'system', content: 'Be precise and concise.' },\n { role: 'user', content: parameters.query },\n ],\n }),\n });\n\n if (!response.ok) {\n throw new Error(\n `Failed to fetch data from Perplexity API, status: ${response.status}`,\n );\n }\n\n const data = (await response.json()) as PerplexityResponse;\n const responseContent =\n data.choices[0]?.message?.content || 'No information available';\n\n return { response: responseContent };\n};\n","tools":[],"config":[{"BasicConfig":{"key_name":"apiKey","description":"API key for accessing the Perplexity API","required":true,"type":null,"key_value":null}}],"description":"Searches the web using Perplexity API (limited)","keywords":["perplexity","api","shinkai"],"input_args":{"type":"object","properties":{"query":{"type":"string","description":"The search query to send to Perplexity API"}},"required":["query"]},"output_arg":{"json":""},"activated":false,"embedding":[0.11645089,0.3802397,-0.09272365,-0.67411584,-0.7537766,-0.032171614,-0.45825568,-0.49803934,-0.07670201,-0.057288826,-0.54977757,1.0430512,0.6679656,-0.1604064,0.4738902,0.50352037,0.21564056,-0.6655856,-1.5949762,0.22694373,0.5342862,0.7357455,0.50433016,0.28663254,-0.02867283,-0.031037897,-0.5205588,-0.041651927,-1.3853055,-2.3032627,0.8839041,0.30389038,-0.14362933,-0.2686656,-0.059750296,-0.5206286,-0.2615851,0.036210623,-0.6085326,0.055579424,0.29047012,0.47797203,-0.7003521,0.032415316,-0.29938808,-0.27016744,0.29302964,-0.19847909,0.53113383,0.3267147,-0.27189824,-0.04888197,0.18237285,0.34493575,-0.49145225,0.12325862,-0.092084035,-0.307699,-0.21803373,0.13233665,0.5443668,0.8112723,-3.989468,0.15532626,-0.15926404,0.3642894,-0.15024883,-0.41265762,0.10903634,0.7352435,0.11528505,-0.24735595,-0.21702892,0.22264877,0.064511694,-0.38259807,0.00055605546,0.14024082,0.14670368,-0.39417234,0.41306466,0.5847184,-0.3451556,-0.12406353,-0.032791402,0.43859747,-0.15003729,0.02542606,0.33477247,0.16663855,-0.703967,-0.1934891,0.03318881,-0.27462703,-0.733422,0.0606576,0.19128543,0.636479,0.5873402,3.5084991,0.45497346,-0.4058737,0.17792565,-0.29604372,0.6499731,-0.2301283,0.10245432,-0.1421148,-0.04591573,-0.06489993,-0.0492054,-0.06698479,0.45488554,0.41171885,-0.30030915,-0.59429204,0.1879906,0.30220774,0.20928462,0.5431731,-0.8490738,0.4382806,-0.37295023,-0.21139148,0.038392637,0.08154917,-1.0377465,0.27984643,0.43633434,-0.13672704,0.4028079,-0.26608434,-0.6147281,0.21044709,-0.124731585,0.09012708,0.35903013,-0.45551512,0.23613182,-0.6970096,0.3138734,-1.2784092,1.0144013,0.5601748,0.5553081,0.85539246,-0.3101067,-0.018381156,-0.36182493,0.2906356,-0.38740358,0.27574438,-0.106455676,-0.5253885,0.3617983,-0.27406377,0.10209672,0.05118013,-0.62402046,0.31799307,-0.22534356,0.17344433,0.50287616,0.8384853,0.4648925,-0.49320915,0.23515385,-0.04215353,0.12130138,-0.36237866,0.33668444,0.13787805,-0.029066041,0.44245827,-0.5305936,0.27351266,-0.771116,0.13033041,-0.08559129,-1.0153216,0.23239507,0.96706855,-0.021236736,-0.75734127,-0.15587541,0.28624126,0.2334207,-0.13497245,0.52321583,0.31058794,-0.5444632,2.087078,-0.7947092,-0.47221297,0.041387036,-0.19452813,-0.5043615,0.49735773,-0.17028435,-0.34137905,-0.3128182,-0.7499987,-0.018927649,0.07509248,0.14645281,-0.72122896,0.6193227,-0.55968297,0.42440146,-0.60465604,-0.0012502596,-0.20697278,0.017538324,0.0798682,0.5066283,-0.120684266,0.2885825,0.11684653,0.1198242,0.38593853,0.12598982,-0.18813714,-0.4122072,-0.492496,-0.4052348,-0.25425065,-0.477075,0.06350674,-0.28631818,-0.07108346,0.55995566,0.49807364,0.65559477,0.89627963,0.8168491,-0.20774716,-0.42542398,0.7693567,0.33275378,-0.45456913,0.5645004,-0.13026272,-0.2622282,-0.3358931,0.5276109,-1.1812775,0.015307136,0.06622091,-0.5011313,2.07899,1.0236517,-0.02029689,0.29381785,-0.032027494,-0.22639114,-0.13027939,-1.6197495,-0.047988273,-0.6458405,0.58243275,-0.38908395,-0.17550264,0.35894585,-0.07727822,0.19970895,0.0067867376,-0.86764807,-0.5372001,0.03185998,-0.25801203,-0.110302955,0.67893493,-0.098150775,0.44518924,0.2846071,-0.06250328,0.57811636,-0.017079383,-0.8492406,0.11247228,0.2989498,0.34395933,0.7322431,-0.013522863,-0.3790063,-0.38699606,-0.4408811,0.6623414,-0.55028033,0.08520629,-0.5261909,0.18402901,-0.5693831,-0.25149646,1.8593986,0.45961162,0.61170405,0.21321318,0.070005484,0.3738091,-0.23829171,0.064711,0.49576297,0.14187577,-0.13750578,-0.08783659,0.58597755,-0.34088972,-0.49333525,-0.19943738,-0.1679697,0.21279567,0.056609992,-0.6321387,0.46428663,-0.41508734,0.14146604,0.52955735,0.07605636,-1.9218364,-0.30150202,0.42497358,-0.006485235,-0.44263524,-0.28049743,0.42112368,-0.3480398,0.09213908,0.22300623,1.6682819,0.59545535,-0.45685238,-0.4643534,-0.48270938,0.72018564,-0.39325646,-0.14966555,-0.3658264,-0.7589981,-0.1770872,0.51835907,1.179172,0.6406662,0.6497778,-0.081445806,0.27046713,-0.32926446,-1.228502,0.09208644,0.33586162,-0.47407374,0.7246797,-0.029335575,-0.55128133,1.0291284,0.737099,0.37892345,-0.120127216,-0.25902197,1.7916461,0.08593016,-0.014039258,-0.3299547,0.38398552,0.101137094,0.56588775,-0.17234516,-0.2501452,-0.13663173,-0.09309722,-0.19804183,-0.6805411,0.29109603,0.1611939,0.041646678,0.4484455,0.07696198,0.41209462,0.37516358,0.34763062,-0.32356164,0.09036073,-0.6707306,0.41546535],"result":{"type":"object","properties":{"response":{"description":"The search results and analysis from Perplexity API","type":"string"}},"required":["response"]},"sql_tables":null,"sql_queries":null,"file_inbox":null,"oauth":null,"assets":null},false]} \ No newline at end of file +{"type":"Deno","content":[{"name":"Perplexity API","homepage":null,"author":"@@official.shinkai","version":"1.0.0","js_code":"type Configurations = {\n apiKey: string;\n};\ntype Parameters = {\n query: string;\n};\n\ntype Result = {\n response: string;\n};\n\ninterface PerplexityResponse {\n choices: Array<{\n message: {\n content: string;\n };\n }>;\n}\nexport type Run, I extends Record, R extends Record> = (config: C, inputs: I) => Promise;\n\nexport const run: Run = async (\n configurations,\n parameters,\n): Promise => {\n const response = await fetch('https://api.perplexity.ai/chat/completions', {\n method: 'POST',\n headers: {\n accept: 'application/json',\n authorization: `Bearer ${configurations.apiKey}`,\n 'content-type': 'application/json',\n },\n body: JSON.stringify({\n model: 'llama-3.1-sonar-small-128k-online',\n messages: [\n { role: 'system', content: 'Be precise and concise.' },\n { role: 'user', content: parameters.query },\n ],\n }),\n });\n\n if (!response.ok) {\n throw new Error(\n `Failed to fetch data from Perplexity API, status: ${response.status}`,\n );\n }\n\n const data = (await response.json()) as PerplexityResponse;\n const responseContent =\n data.choices[0]?.message?.content || 'No information available';\n\n return { response: responseContent };\n};\n","tools":[],"config":[{"BasicConfig":{"key_name":"apiKey","description":"API key for accessing the Perplexity API","required":true,"type":null,"key_value":null}}],"description":"Searches the web using Perplexity API (limited)","keywords":["perplexity","api","shinkai"],"input_args":{"type":"object","properties":{"query":{"type":"string","description":"The search query to send to Perplexity API"}},"required":["query"]},"output_arg":{"json":""},"activated":false,"embedding":[0.11645089,0.3802397,-0.09272365,-0.67411584,-0.7537766,-0.032171614,-0.45825568,-0.49803934,-0.07670201,-0.057288826,-0.54977757,1.0430512,0.6679656,-0.1604064,0.4738902,0.50352037,0.21564056,-0.6655856,-1.5949762,0.22694373,0.5342862,0.7357455,0.50433016,0.28663254,-0.02867283,-0.031037897,-0.5205588,-0.041651927,-1.3853055,-2.3032627,0.8839041,0.30389038,-0.14362933,-0.2686656,-0.059750296,-0.5206286,-0.2615851,0.036210623,-0.6085326,0.055579424,0.29047012,0.47797203,-0.7003521,0.032415316,-0.29938808,-0.27016744,0.29302964,-0.19847909,0.53113383,0.3267147,-0.27189824,-0.04888197,0.18237285,0.34493575,-0.49145225,0.12325862,-0.092084035,-0.307699,-0.21803373,0.13233665,0.5443668,0.8112723,-3.989468,0.15532626,-0.15926404,0.3642894,-0.15024883,-0.41265762,0.10903634,0.7352435,0.11528505,-0.24735595,-0.21702892,0.22264877,0.064511694,-0.38259807,0.00055605546,0.14024082,0.14670368,-0.39417234,0.41306466,0.5847184,-0.3451556,-0.12406353,-0.032791402,0.43859747,-0.15003729,0.02542606,0.33477247,0.16663855,-0.703967,-0.1934891,0.03318881,-0.27462703,-0.733422,0.0606576,0.19128543,0.636479,0.5873402,3.5084991,0.45497346,-0.4058737,0.17792565,-0.29604372,0.6499731,-0.2301283,0.10245432,-0.1421148,-0.04591573,-0.06489993,-0.0492054,-0.06698479,0.45488554,0.41171885,-0.30030915,-0.59429204,0.1879906,0.30220774,0.20928462,0.5431731,-0.8490738,0.4382806,-0.37295023,-0.21139148,0.038392637,0.08154917,-1.0377465,0.27984643,0.43633434,-0.13672704,0.4028079,-0.26608434,-0.6147281,0.21044709,-0.124731585,0.09012708,0.35903013,-0.45551512,0.23613182,-0.6970096,0.3138734,-1.2784092,1.0144013,0.5601748,0.5553081,0.85539246,-0.3101067,-0.018381156,-0.36182493,0.2906356,-0.38740358,0.27574438,-0.106455676,-0.5253885,0.3617983,-0.27406377,0.10209672,0.05118013,-0.62402046,0.31799307,-0.22534356,0.17344433,0.50287616,0.8384853,0.4648925,-0.49320915,0.23515385,-0.04215353,0.12130138,-0.36237866,0.33668444,0.13787805,-0.029066041,0.44245827,-0.5305936,0.27351266,-0.771116,0.13033041,-0.08559129,-1.0153216,0.23239507,0.96706855,-0.021236736,-0.75734127,-0.15587541,0.28624126,0.2334207,-0.13497245,0.52321583,0.31058794,-0.5444632,2.087078,-0.7947092,-0.47221297,0.041387036,-0.19452813,-0.5043615,0.49735773,-0.17028435,-0.34137905,-0.3128182,-0.7499987,-0.018927649,0.07509248,0.14645281,-0.72122896,0.6193227,-0.55968297,0.42440146,-0.60465604,-0.0012502596,-0.20697278,0.017538324,0.0798682,0.5066283,-0.120684266,0.2885825,0.11684653,0.1198242,0.38593853,0.12598982,-0.18813714,-0.4122072,-0.492496,-0.4052348,-0.25425065,-0.477075,0.06350674,-0.28631818,-0.07108346,0.55995566,0.49807364,0.65559477,0.89627963,0.8168491,-0.20774716,-0.42542398,0.7693567,0.33275378,-0.45456913,0.5645004,-0.13026272,-0.2622282,-0.3358931,0.5276109,-1.1812775,0.015307136,0.06622091,-0.5011313,2.07899,1.0236517,-0.02029689,0.29381785,-0.032027494,-0.22639114,-0.13027939,-1.6197495,-0.047988273,-0.6458405,0.58243275,-0.38908395,-0.17550264,0.35894585,-0.07727822,0.19970895,0.0067867376,-0.86764807,-0.5372001,0.03185998,-0.25801203,-0.110302955,0.67893493,-0.098150775,0.44518924,0.2846071,-0.06250328,0.57811636,-0.017079383,-0.8492406,0.11247228,0.2989498,0.34395933,0.7322431,-0.013522863,-0.3790063,-0.38699606,-0.4408811,0.6623414,-0.55028033,0.08520629,-0.5261909,0.18402901,-0.5693831,-0.25149646,1.8593986,0.45961162,0.61170405,0.21321318,0.070005484,0.3738091,-0.23829171,0.064711,0.49576297,0.14187577,-0.13750578,-0.08783659,0.58597755,-0.34088972,-0.49333525,-0.19943738,-0.1679697,0.21279567,0.056609992,-0.6321387,0.46428663,-0.41508734,0.14146604,0.52955735,0.07605636,-1.9218364,-0.30150202,0.42497358,-0.006485235,-0.44263524,-0.28049743,0.42112368,-0.3480398,0.09213908,0.22300623,1.6682819,0.59545535,-0.45685238,-0.4643534,-0.48270938,0.72018564,-0.39325646,-0.14966555,-0.3658264,-0.7589981,-0.1770872,0.51835907,1.179172,0.6406662,0.6497778,-0.081445806,0.27046713,-0.32926446,-1.228502,0.09208644,0.33586162,-0.47407374,0.7246797,-0.029335575,-0.55128133,1.0291284,0.737099,0.37892345,-0.120127216,-0.25902197,1.7916461,0.08593016,-0.014039258,-0.3299547,0.38398552,0.101137094,0.56588775,-0.17234516,-0.2501452,-0.13663173,-0.09309722,-0.19804183,-0.6805411,0.29109603,0.1611939,0.041646678,0.4484455,0.07696198,0.41209462,0.37516358,0.34763062,-0.32356164,0.09036073,-0.6707306,0.41546535],"result":{"type":"object","properties":{"response":{"description":"The search results and analysis from Perplexity API","type":"string"}},"required":["response"]},"sql_tables":null,"sql_queries":null,"file_inbox":null,"oauth":null,"assets":null,"runner":"any","operating_system":["linux","macos","windows"],"tool_set":""},false]} \ No newline at end of file diff --git a/tools/perplexity-api/metadata.json b/tools/perplexity-api/metadata.json index f2b68037..317d0a79 100644 --- a/tools/perplexity-api/metadata.json +++ b/tools/perplexity-api/metadata.json @@ -9,7 +9,10 @@ "api", "shinkai" ], - "configurations": { + "runner": "any", + "operating_system": ["linux", "macos", "windows"], + "tool_set": "", + "configurations": { "type": "object", "properties": { "apiKey": { diff --git a/tools/perplexity/.tool-dump.test.json b/tools/perplexity/.tool-dump.test.json index 3c139556..4ebe6e92 100644 --- a/tools/perplexity/.tool-dump.test.json +++ b/tools/perplexity/.tool-dump.test.json @@ -1 +1 @@ -{"type":"Deno","content":[{"name":"Perplexity","homepage":null,"author":"@@official.shinkai","version":"1.0.0","js_code":"\nimport chromePaths from 'npm:chrome-paths@1.0.1';\nimport TurndownService from 'npm:turndown@7.2.0';\nimport { addExtra } from 'npm:puppeteer-extra@3.3.6';\nimport rebrowserPuppeteer from 'npm:rebrowser-puppeteer@23.10.1';\nimport StealthPlugin from 'npm:puppeteer-extra-plugin-stealth@2.11.2';\n\ntype Configurations = {\n chromePath?: string;\n};\ntype Parameters = {\n query: string;\n};\ntype Result = { response: string };\n\nexport type Run, I extends Record, R extends Record> = (config: C, inputs: I) => Promise;\n\nconst puppeteer = addExtra(rebrowserPuppeteer as any);\nconst pluginStealth = StealthPlugin();\n\npluginStealth.enabledEvasions.delete('chrome.loadTimes');\npluginStealth.enabledEvasions.delete('chrome.runtime');\n\npuppeteer.use(pluginStealth);\n\nexport const run: Run = async (\n configurations,\n params,\n): Promise => {\n const chromePath =\n configurations?.chromePath ||\n Deno.env.get('CHROME_PATH') ||\n chromePaths.chrome ||\n chromePaths.chromium;\n if (!chromePath) {\n throw new Error('Chrome path not found');\n }\n const browser = await puppeteer.launch({\n executablePath: chromePath,\n args: ['--disable-blink-features=AutomationControlled'],\n });\n const page = await browser.newPage();\n\n console.log(\"Navigating to Perplexity's website...\");\n await page.goto('https://www.perplexity.ai/');\n\n console.log('Waiting for the page to load...');\n await page.waitForNetworkIdle({ timeout: 2500 });\n\n console.log('Filling textarea with query:', params.query);\n await page.type('textarea', params.query);\n\n try {\n console.log('trying to click app popup');\n await page.click('button:has(svg[data-icon=\"xmark\"])');\n } catch (_) {\n console.log('unable to find the x button to close the popup');\n }\n\n console.log('Clicking the button with the specified SVG...');\n await page.click('button:has(svg[data-icon=\"arrow-right\"])');\n\n console.log('Waiting for the button with the specified SVG to be visible...');\n await page.waitForSelector('button:has(svg[data-icon=\"arrow-right\"])');\n\n console.log('Waiting for results to load...');\n await page.waitForSelector('text=Related');\n\n console.log('Extracting HTML content...');\n const htmlContent = await page.evaluate(() => {\n const resultElements = document.querySelectorAll('div[dir=\"auto\"]');\n return Array.from(resultElements)\n .map((element) => element.innerHTML)\n .join('\\n\\n');\n });\n\n console.log('Closing browser...');\n await browser.close();\n\n console.log('Converting HTML to Markdown...');\n const turndownService = new TurndownService();\n turndownService.addRule('preserveLinks', {\n filter: 'a',\n replacement: function (_content: string, node: Element) {\n const element = node as Element;\n const href = element.getAttribute('href');\n return `[${href}](${href})`;\n },\n });\n const markdown = turndownService.turndown(htmlContent);\n\n const result: Result = {\n response: markdown,\n };\n\n console.log('Returning result:', result);\n return Promise.resolve({ ...result });\n};\n","tools":[],"config":[{"BasicConfig":{"key_name":"chromePath","description":"Optional path to Chrome executable for browser automation","required":false,"type":null,"key_value":null}}],"description":"Searches the internet using Perplexity","keywords":["perplexity","search"],"input_args":{"type":"object","properties":{"query":{"type":"string","description":"The search query to send to Perplexity"}},"required":["query"]},"output_arg":{"json":""},"activated":false,"embedding":[0.110977024,0.45141035,-0.22621103,-0.73839366,-0.66569847,-0.31065282,-0.46436575,-0.7566426,0.1667947,-0.1629707,-0.4797544,1.1697905,0.52487624,-0.32671282,0.41614112,0.2732951,0.1568219,-0.31578588,-1.1693568,0.539343,0.44237193,0.95825374,0.49016786,0.059257735,0.4595508,-0.1266626,-0.21971467,0.09240231,-0.9244625,-1.95901,0.8332707,-0.035402037,-0.66910744,-0.19510643,0.1861836,-0.74896175,-0.35335997,-0.07804075,-0.58601236,-0.17889635,0.5337802,0.27349943,-0.7119388,0.17112043,-0.16353837,-0.57286483,0.09144518,0.040901445,0.8881004,0.2469415,-0.46033227,-0.22207537,0.101119384,0.5036361,-0.53512615,0.07257283,0.095575824,-0.4892627,-0.45294943,0.26567355,0.3056356,0.7391675,-4.124245,-0.01896253,-0.073930755,0.16979778,0.17980833,-0.37738553,-0.06460192,0.55790734,0.1866517,-0.053921215,-0.24112093,0.3796582,0.12659699,-0.29600048,-0.09610622,-0.071760796,0.05149146,-0.4111525,0.5461365,0.031101018,-0.022535065,-0.018076565,0.12750974,0.22313613,-0.1957128,0.0038962662,0.13298415,0.16826509,-0.16611812,-0.13953725,0.07203346,-0.16827995,-0.3837615,0.061622147,0.45724794,0.40976992,0.54124093,3.4934232,0.5210436,-0.27958888,0.37268105,0.040759567,0.45173663,-0.0924283,-0.10492885,-0.16183156,-0.17369998,-0.076129496,-0.06847698,-0.19875674,0.09101013,0.5059889,-0.29385746,-0.0088841915,0.094699666,0.40071553,0.40991813,0.11015464,-0.76521057,0.6529254,-0.242373,-0.20075738,-0.17936552,0.07580075,-1.1185092,0.27016765,0.44116879,-0.019928018,0.37141103,0.0018014051,-0.53716743,0.32028934,-0.017729454,0.26877978,0.16377993,-0.469709,0.12641262,-0.82514167,0.18262884,-1.1703655,0.8664657,0.11342133,0.8947825,0.7961433,-0.17412767,-0.071389996,-0.5180277,-0.028393395,-0.3576064,0.63728005,-0.046309672,-0.6841276,0.527785,-0.34813526,0.07180974,0.43599373,-0.3724407,0.49021587,-0.34073755,-0.087408625,0.57178354,0.9395102,0.6860182,-0.061857704,0.21753679,-0.2272897,0.37726143,-0.4223989,0.31156868,-0.021819092,-0.27533802,0.5426756,-0.46329278,0.116780296,-0.32852674,0.45712313,-0.03879409,-0.99532163,-0.17527305,0.7517308,-0.12523344,-0.7820304,0.027986802,0.20813407,0.13434884,-0.13795245,0.5918208,0.51871544,-0.6702558,1.6690733,-0.6676787,-0.3809836,0.030475017,0.011550121,-0.20073879,0.31808943,0.115490794,-0.33595,0.057966836,-0.5639761,0.045757085,0.21266335,-0.04119896,-0.69224423,0.7007585,-0.432434,0.5445157,-0.54269814,0.016974775,0.11220923,-0.024178773,0.19408104,0.43770552,-0.07191335,-0.017497398,0.17782195,0.10322357,0.5189725,-0.09310021,-0.072219215,-0.11473365,-0.5251292,-0.701344,-0.20285986,-0.4204037,-0.14125952,-0.16444397,-0.2067886,0.34788606,0.079939,1.1590862,0.5584607,0.89061195,-0.038665645,-0.3988015,0.74298346,0.24514607,-0.906924,0.7279031,-0.108730376,-0.5052251,-0.48092008,0.4195812,-1.0718536,0.17381667,-0.014733531,-0.24340673,1.9078574,0.97720516,-0.05337442,0.3462506,-0.10808912,-0.09447292,0.38402006,-1.4023371,0.03120788,-0.519497,0.58436084,-0.40587917,-0.4480681,0.2578387,-0.306957,0.20576254,0.17248659,-0.68005055,-0.7617563,-0.10644278,-0.49746716,-0.028531365,0.66250485,-0.30359608,0.4068188,0.6908709,-0.0040249396,0.50787115,0.026117712,-0.5721714,-0.049632005,0.25709268,0.28320572,0.739039,-0.089835346,-0.26498985,-0.3371122,-0.40288514,0.08845858,-0.04875935,0.21212035,-0.5365946,0.1202167,-0.28503323,0.06540573,2.3434439,0.52442706,0.9950618,0.35708734,-0.024971133,0.24164142,-0.0024675503,-0.24290478,0.3384783,0.15465873,-0.24039613,-0.3583358,0.48492467,-0.37566948,-0.5859746,-0.7427742,-0.033714246,-0.15926056,0.030271929,-0.2851397,0.51082003,-0.69576013,0.10975328,0.32911056,0.07521139,-2.2029974,-0.32307673,0.6154103,0.3786558,-0.43247128,-0.08517668,0.5010204,-0.30798858,0.38705644,0.18583356,1.8067048,0.5006732,-0.3077378,-0.451505,-0.47177285,0.8022604,-0.4174476,0.051823355,-0.41506773,-0.9942333,-0.28698784,0.33536983,1.4645271,0.535335,0.66993743,-0.09726632,0.18442869,-0.29600212,-1.6375569,0.19774191,0.41653043,-0.39089012,0.5119712,0.060523115,-0.60206085,0.7337946,0.57138455,0.067463085,-0.12759255,-0.1821385,1.439113,0.26482844,-0.1934892,-0.35052425,0.32630876,0.04205793,0.19897152,-0.1018547,-0.63383335,-0.48477942,0.08910653,-0.2049768,-0.38078272,0.25531286,-0.052223798,0.18022618,-0.054611653,0.3274193,0.5763793,-0.15635633,0.49286222,-0.29581112,-0.05556007,-0.7662319,0.22995831],"result":{"type":"object","properties":{"response":{"description":"The search results and analysis from Perplexity","type":"string"}},"required":["response"]},"sql_tables":null,"sql_queries":null,"file_inbox":null,"oauth":null,"assets":null},false]} \ No newline at end of file +{"type":"Deno","content":[{"name":"Perplexity","homepage":null,"author":"@@official.shinkai","version":"1.0.0","js_code":"\nimport chromePaths from 'npm:chrome-paths@1.0.1';\nimport TurndownService from 'npm:turndown@7.2.0';\nimport { addExtra } from 'npm:puppeteer-extra@3.3.6';\nimport rebrowserPuppeteer from 'npm:rebrowser-puppeteer@23.10.1';\nimport StealthPlugin from 'npm:puppeteer-extra-plugin-stealth@2.11.2';\n\ntype Configurations = {\n chromePath?: string;\n};\ntype Parameters = {\n query: string;\n};\ntype Result = { response: string };\n\nexport type Run, I extends Record, R extends Record> = (config: C, inputs: I) => Promise;\n\nconst puppeteer = addExtra(rebrowserPuppeteer as any);\nconst pluginStealth = StealthPlugin();\n\npluginStealth.enabledEvasions.delete('chrome.loadTimes');\npluginStealth.enabledEvasions.delete('chrome.runtime');\n\npuppeteer.use(pluginStealth);\n\nexport const run: Run = async (\n configurations,\n params,\n): Promise => {\n const chromePath =\n configurations?.chromePath ||\n Deno.env.get('CHROME_PATH') ||\n chromePaths.chrome ||\n chromePaths.chromium;\n if (!chromePath) {\n throw new Error('Chrome path not found');\n }\n const browser = await puppeteer.launch({\n executablePath: chromePath,\n args: ['--disable-blink-features=AutomationControlled'],\n });\n const page = await browser.newPage();\n\n console.log(\"Navigating to Perplexity's website...\");\n await page.goto('https://www.perplexity.ai/');\n\n console.log('Waiting for the page to load...');\n await page.waitForNetworkIdle({ timeout: 2500 });\n\n console.log('Filling textarea with query:', params.query);\n await page.type('textarea', params.query);\n\n try {\n console.log('trying to click app popup');\n await page.click('button:has(svg[data-icon=\"xmark\"])');\n } catch (_) {\n console.log('unable to find the x button to close the popup');\n }\n\n console.log('Clicking the button with the specified SVG...');\n await page.click('button:has(svg[data-icon=\"arrow-right\"])');\n\n console.log('Waiting for the button with the specified SVG to be visible...');\n await page.waitForSelector('button:has(svg[data-icon=\"arrow-right\"])');\n\n console.log('Waiting for results to load...');\n await page.waitForSelector('text=Related');\n\n console.log('Extracting HTML content...');\n const htmlContent = await page.evaluate(() => {\n const resultElements = document.querySelectorAll('div[dir=\"auto\"]');\n return Array.from(resultElements)\n .map((element) => element.innerHTML)\n .join('\\n\\n');\n });\n\n console.log('Closing browser...');\n await browser.close();\n\n console.log('Converting HTML to Markdown...');\n const turndownService = new TurndownService();\n turndownService.addRule('preserveLinks', {\n filter: 'a',\n replacement: function (_content: string, node: Element) {\n const element = node as Element;\n const href = element.getAttribute('href');\n return `[${href}](${href})`;\n },\n });\n const markdown = turndownService.turndown(htmlContent);\n\n const result: Result = {\n response: markdown,\n };\n\n console.log('Returning result:', result);\n return Promise.resolve({ ...result });\n};\n","tools":[],"config":[{"BasicConfig":{"key_name":"chromePath","description":"Optional path to Chrome executable for browser automation","required":false,"type":null,"key_value":null}}],"description":"Searches the internet using Perplexity","keywords":["perplexity","search"],"input_args":{"type":"object","properties":{"query":{"type":"string","description":"The search query to send to Perplexity"}},"required":["query"]},"output_arg":{"json":""},"activated":false,"embedding":[0.110977024,0.45141035,-0.22621103,-0.73839366,-0.66569847,-0.31065282,-0.46436575,-0.7566426,0.1667947,-0.1629707,-0.4797544,1.1697905,0.52487624,-0.32671282,0.41614112,0.2732951,0.1568219,-0.31578588,-1.1693568,0.539343,0.44237193,0.95825374,0.49016786,0.059257735,0.4595508,-0.1266626,-0.21971467,0.09240231,-0.9244625,-1.95901,0.8332707,-0.035402037,-0.66910744,-0.19510643,0.1861836,-0.74896175,-0.35335997,-0.07804075,-0.58601236,-0.17889635,0.5337802,0.27349943,-0.7119388,0.17112043,-0.16353837,-0.57286483,0.09144518,0.040901445,0.8881004,0.2469415,-0.46033227,-0.22207537,0.101119384,0.5036361,-0.53512615,0.07257283,0.095575824,-0.4892627,-0.45294943,0.26567355,0.3056356,0.7391675,-4.124245,-0.01896253,-0.073930755,0.16979778,0.17980833,-0.37738553,-0.06460192,0.55790734,0.1866517,-0.053921215,-0.24112093,0.3796582,0.12659699,-0.29600048,-0.09610622,-0.071760796,0.05149146,-0.4111525,0.5461365,0.031101018,-0.022535065,-0.018076565,0.12750974,0.22313613,-0.1957128,0.0038962662,0.13298415,0.16826509,-0.16611812,-0.13953725,0.07203346,-0.16827995,-0.3837615,0.061622147,0.45724794,0.40976992,0.54124093,3.4934232,0.5210436,-0.27958888,0.37268105,0.040759567,0.45173663,-0.0924283,-0.10492885,-0.16183156,-0.17369998,-0.076129496,-0.06847698,-0.19875674,0.09101013,0.5059889,-0.29385746,-0.0088841915,0.094699666,0.40071553,0.40991813,0.11015464,-0.76521057,0.6529254,-0.242373,-0.20075738,-0.17936552,0.07580075,-1.1185092,0.27016765,0.44116879,-0.019928018,0.37141103,0.0018014051,-0.53716743,0.32028934,-0.017729454,0.26877978,0.16377993,-0.469709,0.12641262,-0.82514167,0.18262884,-1.1703655,0.8664657,0.11342133,0.8947825,0.7961433,-0.17412767,-0.071389996,-0.5180277,-0.028393395,-0.3576064,0.63728005,-0.046309672,-0.6841276,0.527785,-0.34813526,0.07180974,0.43599373,-0.3724407,0.49021587,-0.34073755,-0.087408625,0.57178354,0.9395102,0.6860182,-0.061857704,0.21753679,-0.2272897,0.37726143,-0.4223989,0.31156868,-0.021819092,-0.27533802,0.5426756,-0.46329278,0.116780296,-0.32852674,0.45712313,-0.03879409,-0.99532163,-0.17527305,0.7517308,-0.12523344,-0.7820304,0.027986802,0.20813407,0.13434884,-0.13795245,0.5918208,0.51871544,-0.6702558,1.6690733,-0.6676787,-0.3809836,0.030475017,0.011550121,-0.20073879,0.31808943,0.115490794,-0.33595,0.057966836,-0.5639761,0.045757085,0.21266335,-0.04119896,-0.69224423,0.7007585,-0.432434,0.5445157,-0.54269814,0.016974775,0.11220923,-0.024178773,0.19408104,0.43770552,-0.07191335,-0.017497398,0.17782195,0.10322357,0.5189725,-0.09310021,-0.072219215,-0.11473365,-0.5251292,-0.701344,-0.20285986,-0.4204037,-0.14125952,-0.16444397,-0.2067886,0.34788606,0.079939,1.1590862,0.5584607,0.89061195,-0.038665645,-0.3988015,0.74298346,0.24514607,-0.906924,0.7279031,-0.108730376,-0.5052251,-0.48092008,0.4195812,-1.0718536,0.17381667,-0.014733531,-0.24340673,1.9078574,0.97720516,-0.05337442,0.3462506,-0.10808912,-0.09447292,0.38402006,-1.4023371,0.03120788,-0.519497,0.58436084,-0.40587917,-0.4480681,0.2578387,-0.306957,0.20576254,0.17248659,-0.68005055,-0.7617563,-0.10644278,-0.49746716,-0.028531365,0.66250485,-0.30359608,0.4068188,0.6908709,-0.0040249396,0.50787115,0.026117712,-0.5721714,-0.049632005,0.25709268,0.28320572,0.739039,-0.089835346,-0.26498985,-0.3371122,-0.40288514,0.08845858,-0.04875935,0.21212035,-0.5365946,0.1202167,-0.28503323,0.06540573,2.3434439,0.52442706,0.9950618,0.35708734,-0.024971133,0.24164142,-0.0024675503,-0.24290478,0.3384783,0.15465873,-0.24039613,-0.3583358,0.48492467,-0.37566948,-0.5859746,-0.7427742,-0.033714246,-0.15926056,0.030271929,-0.2851397,0.51082003,-0.69576013,0.10975328,0.32911056,0.07521139,-2.2029974,-0.32307673,0.6154103,0.3786558,-0.43247128,-0.08517668,0.5010204,-0.30798858,0.38705644,0.18583356,1.8067048,0.5006732,-0.3077378,-0.451505,-0.47177285,0.8022604,-0.4174476,0.051823355,-0.41506773,-0.9942333,-0.28698784,0.33536983,1.4645271,0.535335,0.66993743,-0.09726632,0.18442869,-0.29600212,-1.6375569,0.19774191,0.41653043,-0.39089012,0.5119712,0.060523115,-0.60206085,0.7337946,0.57138455,0.067463085,-0.12759255,-0.1821385,1.439113,0.26482844,-0.1934892,-0.35052425,0.32630876,0.04205793,0.19897152,-0.1018547,-0.63383335,-0.48477942,0.08910653,-0.2049768,-0.38078272,0.25531286,-0.052223798,0.18022618,-0.054611653,0.3274193,0.5763793,-0.15635633,0.49286222,-0.29581112,-0.05556007,-0.7662319,0.22995831],"result":{"type":"object","properties":{"response":{"description":"The search results and analysis from Perplexity","type":"string"}},"required":["response"]},"sql_tables":null,"sql_queries":null,"file_inbox":null,"oauth":null,"assets":null,"runner":"any","operating_system":["linux","macos","windows"],"tool_set":""},false]} \ No newline at end of file diff --git a/tools/perplexity/metadata.json b/tools/perplexity/metadata.json index dae9cf59..11998f6f 100644 --- a/tools/perplexity/metadata.json +++ b/tools/perplexity/metadata.json @@ -8,7 +8,10 @@ "perplexity", "search" ], - "configurations": { + "runner": "any", + "operating_system": ["linux", "macos", "windows"], + "tool_set": "", + "configurations": { "type": "object", "properties": { "chromePath": { diff --git a/tools/podcast-to-podcast/.tool-dump.test.json b/tools/podcast-to-podcast/.tool-dump.test.json new file mode 100644 index 00000000..c4785673 --- /dev/null +++ b/tools/podcast-to-podcast/.tool-dump.test.json @@ -0,0 +1 @@ +{"type":"Deno","content":[{"name":"Podcast to Podcast","homepage":null,"author":"@@official.shinkai","version":"1.0.0","js_code":"import { YoutubeTranscript } from 'npm:youtube-transcript';\nimport { getHomePath } from './shinkai-local-support.ts'\nimport { shinkaiLlmPromptProcessor, elevenLabsTextToSpeech } from './shinkai-local-tools.ts';\n\ntype CONFIG = {};\ntype INPUTS = {\n youtubeUrlOrId: string;\n};\ntype OUTPUT = {\n audiotext: string,\n audioFilePath: string,\n};\n\nexport async function run(config: CONFIG, inputs: INPUTS): Promise {\n const { youtubeUrlOrId } = inputs;\n if (!youtubeUrlOrId) throw new Error(\"Missing input.youtubeUrlOrId\")\n // Step 1: Fetch the transcript from YouTube\n const transcript: {text: string, duration: number, offset: number}[] = await YoutubeTranscript.fetchTranscript(youtubeUrlOrId);\n /*\n [...\n {\n text: \"better the performance the easier it is\",\n duration: 4.08,\n offset: 223.92,\n lang: \"en\"\n },\n {\n text: \"for me to watch yeah if I catch myself\",\n duration: 4.36,\n offset: 225.2,\n lang: \"en\"\n },\n ...]\n */\n const total_duration = transcript[transcript.length - 1].offset + transcript[transcript.length - 1].duration;\n console.log(`Total duration: ${total_duration}`);\n // Step 2: Flatten the transcript into a string\n const flatten_transcript = transcript.map(segment => segment.text).join(' ');\n\n // Step 3: Get the prompt structure and voice prompt from files\n const homePath = await getHomePath();\n const promptStructureFilePath = `${homePath}/podcast.analysis.md`;\n const voicePromptFilePath = `${homePath}/podcast.story.md`;\n\n const promptStructure = await Deno.readTextFile(promptStructureFilePath);\n const voicePrompt = await Deno.readTextFile(voicePromptFilePath);\n\n // Step 4: Create a transcript summary with the llm-processor\n const summarizePrompt = `\n Summarize a text following these guidelines and structure:\n \n ${promptStructure}\n \n This is the text to summarize, please don't hallucinate and make sure you follow the guidelines:\n \n ${flatten_transcript}\n \n `;\n\n const { message: transcriptSummary } = await shinkaiLlmPromptProcessor({\n prompt: summarizePrompt,\n format: 'text',\n });\n\n // Step 5: Generate the podcast by using the llm-processor\n const narratePrompt = `\n Narrate a text using the following guidelines\n \n # [IMPORTANT] Your main objective in terms of length is to keep the podcast lenght in about 5 minutes and shorter than the original text.\n ${voicePrompt}\n \n The text to narrate is the following:\n \n ${transcriptSummary}\n \n `;\n\n const { message: podcast } = await shinkaiLlmPromptProcessor({\n prompt: narratePrompt,\n format: 'markdown',\n });\n \n const audioData = await elevenLabsTextToSpeech({\n text: podcast\n });\n\n return {\n audiotext: podcast,\n audioFilePath: audioData.audio_file,\n };\n}","tools":["local:::__official_shinkai:::shinkai_llm_prompt_processor","local:::__official_shinkai:::eleven_labs_text_to_speech"],"config":[],"description":"Converts a YouTube video transcript into a podcast using LLM processing.","keywords":["YouTube","transcript","podcast","converter","shinkai"],"input_args":{"type":"object","properties":{"youtubeUrlOrId":{"type":"string","description":"The YouTube URL or video ID"}},"required":["youtubeUrlOrId"]},"output_arg":{"json":""},"activated":false,"embedding":[0.46618938,0.64287466,-0.39460942,-0.68833095,-0.633925,-0.038053773,-0.9691118,0.10444933,-0.21802923,0.11967294,-0.44526365,1.2321461,-0.0037087305,0.12567014,-0.29091632,0.013069354,0.08166208,-0.7721939,-1.3971748,-0.21916243,-0.11133471,0.17329547,0.15524049,0.23032627,-0.083049916,0.31464124,0.25404778,-0.4364921,-0.57237375,-1.9306434,0.72475684,0.5900172,0.42332146,-0.17464715,-0.24554706,-0.9090138,-0.593923,0.12958306,-0.36103258,0.25185215,0.17348781,0.02890112,-0.6086497,0.1574963,-0.26010203,-0.38041475,0.7616571,-0.38047844,1.3495153,0.05397944,-0.84243107,-0.30115485,-0.038829025,-0.0075116567,-0.32643124,-1.1679004,-0.13259652,0.0014736839,0.56188834,0.029170198,0.21738583,-0.09406267,-3.7389588,-0.25589463,0.46586868,-0.21320686,-0.039139315,-0.016795166,0.25152355,0.18723622,-0.4013294,-0.1854777,-0.66279846,0.34056228,-0.18817541,-0.47800004,-0.20036747,-0.32774192,0.49299318,-0.4703033,0.53931737,-0.025903061,0.20626074,-0.43222395,-0.6800598,0.7841139,-0.7214324,-0.5450764,0.120521516,0.24287435,0.017260486,-0.38861364,1.0523157,-0.09929781,-0.31958577,-0.33142966,0.21190031,-0.053631037,0.25675535,2.8638172,0.5286593,-0.011510994,0.40182832,-0.91278464,0.12548351,-0.68683004,0.46246478,-0.16253108,0.6015411,0.10530927,0.73650813,-0.23037416,0.21714889,0.21003813,0.21873008,0.67361367,-0.14614943,-0.2121757,0.016691446,0.21157996,-0.43889964,-0.11807029,-0.23317777,-0.16076568,-0.60663337,-0.25218624,-0.19453482,0.11377968,0.37887645,-0.39855626,0.40920347,-0.34786025,-0.27948156,0.22925551,0.5119221,0.048596375,0.7847168,-1.0545493,-0.043226473,-0.36568153,0.16337302,-1.6932174,0.48366553,-0.23646462,0.8809137,-0.066939175,-0.48409453,0.39024383,-0.2959111,-0.26760328,0.04944551,0.7304692,0.16666824,-0.115825795,1.1847802,-0.30466706,-0.49689883,-0.80684227,-0.66979074,0.2726157,-0.18352923,-0.10842139,0.1862054,-0.0041895956,0.38039237,-0.18913227,0.60929626,0.41226822,0.6329284,0.036096524,0.52150697,-0.1376867,0.17768402,0.5584603,-0.2124981,-0.52891135,-0.65500104,0.29028982,0.3232489,0.1126425,0.42609203,0.22422074,-0.51573414,-0.10615403,-0.5562604,0.74750656,0.21618697,0.11200308,0.78520644,0.8638811,-0.37831914,1.7871898,-1.1602719,-0.18255801,-0.30313638,0.27381128,0.19101177,0.77150863,0.38641497,0.16728549,-0.30743125,0.14790922,-0.073408455,-0.07069963,-0.34390944,-0.7346075,-0.294118,0.945307,-0.2492824,-0.35732105,0.466656,-0.04014848,0.32288238,0.5382913,0.1001863,0.27142102,0.047813304,0.18679005,-0.7102538,0.23507006,0.49604136,0.23701957,0.06218846,-0.683635,-0.04391142,0.6754131,-0.8014778,0.22475524,0.01319753,-0.1553412,0.63962567,1.1392677,-0.16047496,1.220647,0.7629658,0.36884424,0.14951116,0.39189488,0.30455992,-0.8684064,0.06074622,0.0509396,0.0024019256,-0.21200404,0.18713239,-0.6244685,-0.021490555,0.3230233,-0.3683283,1.7617736,0.20509991,0.5854257,0.5491551,0.41769353,0.29901263,0.053844374,-1.1844125,0.5057905,-0.21942326,0.2890931,-0.41169062,0.41480222,0.078387804,0.5317506,0.13593051,-0.523671,-1.138671,-0.46437657,0.14090258,-0.103696465,-0.12751749,0.24691725,-0.18800831,0.109375805,-0.2879892,0.22438528,0.35582227,-0.10133623,-0.4643866,-0.6869685,0.5957567,0.19177195,0.16639334,0.031551413,-0.5839558,0.33522213,-0.1595141,-0.2667196,-0.7327596,0.34137523,-0.3971499,-0.6551238,-0.8978485,-0.00041882694,1.9727756,0.06321761,-0.06729707,0.57428604,0.23705085,0.032135416,-0.47515216,0.17360938,0.064557746,-0.03458213,-0.740869,-0.4845976,0.6100257,-0.5646932,0.21650383,0.6629491,0.11820831,0.27276868,0.13227542,-0.2735511,0.53410774,-0.28117663,0.14582595,0.78974354,-0.2207418,-2.626886,-0.23336533,-0.39901412,-0.30336386,-0.31535894,0.27292392,0.61566603,-0.48675868,0.37856305,-0.3220306,1.3104153,0.25386354,-0.045244683,-0.14235485,0.56067544,0.80621934,0.24637097,-0.3329793,-0.60190654,-1.0608948,-0.19221419,-0.050373495,1.1459801,0.5643946,0.5596533,-0.058411546,-0.22222623,-0.37580281,-0.8951451,0.67590106,-0.21489045,-0.26415443,0.40776122,0.1399086,-0.24110901,0.4432743,0.9420772,0.162136,0.07527378,-0.08882707,1.6065369,0.25304663,-0.13589215,-0.20474148,0.44570905,-0.17580867,-0.5638516,0.23713736,-0.905015,0.48122227,-0.0325566,0.6618496,-0.32030547,0.6192063,0.15090111,0.68707234,0.724214,0.2502168,0.6663929,0.081420794,-0.13482459,-0.2487632,-0.06984337,-0.24689126,0.21940918],"result":{"type":"object","properties":{"podcast":{"description":"The generated podcast content in Buffer format","nullable":true,"type":"string"}},"required":["podcast"]},"sql_tables":[],"sql_queries":[],"file_inbox":null,"oauth":[],"assets":null,"runner":"any","operating_system":["linux","macos","windows"],"tool_set":""},false]} \ No newline at end of file diff --git a/tools/podcast-to-podcast/metadata.json b/tools/podcast-to-podcast/metadata.json index b0e2e715..62900fb2 100644 --- a/tools/podcast-to-podcast/metadata.json +++ b/tools/podcast-to-podcast/metadata.json @@ -1,6 +1,9 @@ { "author": "@@localhost.arb-sep-shinkai", - "configurations": { + "runner": "any", + "operating_system": ["linux", "macos", "windows"], + "tool_set": "", + "configurations": { "properties": {}, "required": [], "type": "object" diff --git a/tools/pubmed-search/.tool-dump.test.json b/tools/pubmed-search/.tool-dump.test.json new file mode 100644 index 00000000..4d0f2d99 --- /dev/null +++ b/tools/pubmed-search/.tool-dump.test.json @@ -0,0 +1 @@ +{"type":"Python","content":[{"version":"1.0.0","name":"PubMed Search","homepage":null,"author":"@@official.shinkai","py_code":"# /// script\n# requires-python = \">=3.10,<3.12\"\n# dependencies = [\n# \"biopython==1.81\",\n# \"requests>=2.31.0\"\n# ]\n# ///\n\nimport os\nimport asyncio\nfrom typing import Optional\nfrom Bio import Entrez\n\nclass CONFIG:\n entrez_email: Optional[str] = None\n\nclass INPUTS:\n query: str\n max_results: int = 15\n\nclass OUTPUT:\n status: str\n query: str\n message: str\n total_results: int\n showing: int\n records: str\n\nasync def run(c: CONFIG, p: INPUTS) -> OUTPUT:\n \"\"\"\n Searches PubMed for the specified query using the Entrez API, returning MEDLINE text records.\n\n Args:\n c: Configuration object. \n `entrez_email` can be provided here or in environment var `ENTREZ_EMAIL`.\n p: Input parameters including 'query' and optionally 'max_results'.\n\n Returns:\n OUTPUT: The search result in a structured format.\n \"\"\"\n # Determine the email from config or environment\n email = c.entrez_email or os.getenv(\"ENTREZ_EMAIL\")\n if not email:\n raise ValueError(\"No Entrez email provided. Either set `ENTREZ_EMAIL` env var or pass it in the configuration.\")\n\n # Configure Entrez\n Entrez.email = email\n\n if not p.query.strip():\n raise ValueError(\"Query string cannot be empty.\")\n\n max_results = max(1, min(p.max_results, 15))\n\n try:\n # Search for IDs\n handle = Entrez.esearch(\n db=\"pubmed\",\n term=p.query,\n retmax=max_results\n )\n results = Entrez.read(handle)\n handle.close()\n\n # If no results found\n if not results.get(\"IdList\"):\n out = OUTPUT()\n out.status = \"no_results\"\n out.query = p.query\n out.message = f\"No results found for '{p.query}'\"\n out.total_results = 0\n out.showing = 0\n out.records = \"\"\n return out\n\n id_list = results[\"IdList\"]\n id_string = \",\".join(id_list)\n total = int(results.get(\"Count\", \"0\"))\n\n # Fetch MEDLINE records\n fetch_handle = Entrez.efetch(\n db=\"pubmed\",\n id=id_string,\n rettype=\"medline\",\n retmode=\"text\"\n )\n medline_data = fetch_handle.read()\n fetch_handle.close()\n\n out = OUTPUT()\n out.status = \"success\"\n out.query = p.query\n out.message = \"OK\"\n out.total_results = total\n out.showing = len(id_list)\n out.records = medline_data\n return out\n\n except Exception as e:\n out = OUTPUT()\n out.status = \"error\"\n out.query = p.query\n out.message = str(e)\n out.total_results = 0\n out.showing = 0\n out.records = \"\"\n return out ","tools":[],"config":[{"BasicConfig":{"key_name":"entrez_email","description":"Email address for Entrez usage. If not provided, must be set in the environment variable ENTREZ_EMAIL.","required":false,"type":null,"key_value":null}}],"description":"Search PubMed for scientific/medical literature and return MEDLINE records.","keywords":["pubmed","literature","medical","shinkai"],"input_args":{"type":"object","properties":{"query":{"type":"string","description":"Search query for PubMed"},"max_results":{"type":"number","description":"Maximum results to fetch (1-15)"}},"required":["query"]},"output_arg":{"json":""},"activated":false,"embedding":[0.42287254,0.14418541,0.39382425,0.19136608,-0.10115671,-0.017267719,-0.645198,0.10767785,0.074523024,-0.11240621,-0.31325313,0.21125428,-0.12606557,0.106575064,0.43942195,-0.12509221,0.16517328,-0.39841792,-1.7468932,-0.40920013,0.11973749,0.83024734,0.082701705,0.011028614,0.52299225,-0.59874165,-0.5845523,-0.070943065,-0.86555606,-2.0204248,-0.08858863,0.66802853,-0.23337483,-0.3897573,-0.04443235,-0.19875354,0.38242006,0.26826787,-0.5715916,0.3248213,-0.09542237,0.03491488,-0.04191147,0.29082087,-0.07964273,-0.31520545,0.14868891,-0.15794224,1.1190066,0.7877635,-0.757497,-0.6880208,0.2009501,0.3094522,-0.70439565,0.16924092,-0.42154366,-0.043960832,0.2987297,-0.15170023,-0.35882163,0.33653682,-4.343428,-0.13922976,0.48153055,0.41607675,0.087837666,-0.18995832,0.1421725,-0.24263725,0.43224192,-0.04763233,0.5013487,0.017519137,-0.11304875,-0.78227234,0.43444854,-0.34206915,0.9943632,-0.48973957,-0.55897474,0.29250973,-0.7762408,-0.33640006,-0.674592,0.31305504,-0.6451073,0.25436613,-0.027146287,0.01932168,-0.30617473,-0.40895697,0.41412234,0.26303574,0.16507843,0.45629817,-0.04847672,0.5780311,0.5877682,2.9911737,0.6628234,0.31280324,0.4941788,-0.13375969,0.015152715,-0.5143994,0.3791056,-0.68585765,0.4472597,0.3583752,-0.31695732,0.16593754,0.3552094,-0.16177058,0.40669382,0.17669845,-0.45809793,0.23094717,0.013588669,0.12971419,-0.8781829,0.1106147,0.16561136,0.032631412,-0.06775081,0.51460385,-0.015566554,0.19928,0.26426247,-0.38969597,0.33634585,0.36745623,-1.094358,0.15647505,-0.56284696,0.2539812,0.73360145,-0.3509976,-0.067177646,-0.9725887,-0.051462084,-1.2720784,1.1224049,0.69341624,1.1243455,0.32692596,-0.8393147,0.002916798,-0.2955067,-0.36419946,-0.23765577,0.6739243,0.16704771,0.08991717,0.76762396,0.17117792,-0.39238364,-0.15065265,0.022154711,0.027448606,-0.73390955,-0.08161501,0.7689133,0.9975988,0.08697879,-0.08273414,0.37417167,0.23485252,0.4782478,0.08480345,-0.1983163,-0.230472,0.5234274,0.1142416,-0.45246467,0.46503004,-0.1453919,-0.37806576,-0.062287156,-0.61079836,0.15849254,0.9380077,0.10516998,0.099032916,-0.31929964,0.22732787,0.29239684,-0.1313498,0.78911054,1.1916589,-0.60946006,1.1803484,-0.7555431,-0.39422816,0.22326684,0.09230094,-0.20639203,0.22839195,0.45837888,0.100465044,0.06195392,0.14733885,-0.024043877,0.016411923,-0.28320992,-0.14908323,-0.032615468,-0.77487606,0.477499,-0.47357997,-0.10411364,-0.038936496,0.21848345,0.5151138,0.35541794,0.5105488,0.24702734,-0.2970642,0.22342162,0.7390083,-0.093881495,0.446098,-0.3230132,-0.599196,-0.20671585,0.19482134,0.10111611,-0.4631269,-0.18444246,-0.19468138,0.45552242,1.1143878,0.18842642,0.3709875,0.82992536,0.07216382,0.7553524,-0.550539,0.7110903,-0.25004417,-0.114068575,0.016969375,-0.57032454,-0.25772947,0.2919588,-0.14814648,0.4428165,0.41815698,0.29616955,1.4094093,0.9274779,-0.04822192,0.2584105,-0.03561155,0.14916575,0.17050534,-1.2409911,-0.5062135,-0.4697037,0.9140423,0.21803749,-0.101982445,0.4644452,0.28854337,0.0040963017,-0.1398897,-0.82290095,-0.6208919,0.25163704,-0.22825664,-0.36557883,0.22814822,-0.07330379,0.22336769,0.13571765,-0.32156578,0.33499837,-0.009091087,-0.6905141,-0.7373235,0.19412935,-0.2708506,0.075177535,0.38845038,-0.7423688,0.3239188,0.075307876,-0.04884509,-0.6773249,-0.028809953,-0.4430679,-0.1254834,-0.5157657,0.28860372,2.0672703,-0.07211988,0.5363918,0.5908409,-0.61836445,0.42468345,-0.026731685,-0.6867565,-0.1257844,0.7694463,0.00888896,-0.5734436,0.43661892,-0.060128585,-0.1903053,0.06377015,-0.18279219,-0.13386685,0.3960581,-0.31013906,0.3529587,-1.0497417,-0.008116804,-0.07143116,-0.26111826,-2.393786,0.14053144,0.15428028,0.37894124,-0.34794164,-0.68739676,0.27265492,-1.0432489,0.041785147,-0.5165701,0.9746275,-0.13513431,-0.48354033,-0.22227956,-0.2667065,0.2555664,-0.7993759,0.10965007,-0.18347791,-1.1065326,-0.17398606,-0.07003228,1.7570441,0.5532648,0.5323333,0.23186222,0.029774986,-0.903963,-0.6674419,0.1808587,0.5159739,-0.19995095,0.46029365,0.12841025,-0.12183698,0.38964543,1.1465495,0.08809014,0.2880001,-0.056895737,1.8331585,-0.09879872,-0.16555063,-0.65046465,-0.066619396,-0.09779206,0.23480223,-0.06957696,-0.44049117,0.35933417,0.038461175,0.36280918,-0.91879064,0.14297661,0.07390069,0.16955319,0.66154975,0.2800634,0.92832625,0.3304367,0.07262896,0.0054128766,-0.80219954,-0.53812516,0.28522253],"result":{"type":"object","properties":{"message":{"type":"string"},"query":{"type":"string"},"records":{"type":"string"},"showing":{"type":"number"},"status":{"type":"string"},"total_results":{"type":"number"}},"required":["status","query"]},"sql_tables":null,"sql_queries":null,"file_inbox":null,"oauth":null,"assets":null,"runner":"any","operating_system":["linux","macos","windows"],"tool_set":""},false]} \ No newline at end of file diff --git a/tools/pubmed-search/metadata.json b/tools/pubmed-search/metadata.json index fe455285..abf23e7a 100644 --- a/tools/pubmed-search/metadata.json +++ b/tools/pubmed-search/metadata.json @@ -10,6 +10,9 @@ "medical", "shinkai" ], + "runner": "any", + "operating_system": ["linux", "macos", "windows"], + "tool_set": "", "configurations": { "type": "object", "properties": { diff --git a/tools/shinkai-question-learner/.tool-dump.test.json b/tools/shinkai-question-learner/.tool-dump.test.json new file mode 100644 index 00000000..3c3c4342 --- /dev/null +++ b/tools/shinkai-question-learner/.tool-dump.test.json @@ -0,0 +1 @@ +{"type":"Deno","content":[{"name":"Shinkai Question Learner","homepage":null,"author":"@@official.shinkai","version":"1.0.0","js_code":"import { downloadPages } from './shinkai-local-tools.ts';\nimport { shinkaiLlmPromptProcessor } from './shinkai-local-tools.ts';\nimport { shinkaiSqliteQueryExecutor } from './shinkai-local-tools.ts';\n\ntype CONFIG = {};\ntype INPUTS = { action: 'learn' | 'ask' | 'respond', url?: string, userResponse?: string, questionId?: number };\ntype OUTPUT = { message: string };\n\nexport async function run(_config: CONFIG, inputs: INPUTS): Promise {\n // Create the questions table if it doesn't exist\n await shinkaiSqliteQueryExecutor({\n query: `CREATE TABLE IF NOT EXISTS Questions (\n ID INTEGER PRIMARY KEY AUTOINCREMENT,\n Question TEXT NOT NULL,\n Answer TEXT NOT NULL,\n CorrectCount INTEGER DEFAULT 0,\n IncorrectCount INTEGER DEFAULT 0\n );`\n });\n\n if (inputs.action === 'learn' && inputs.url) {\n const { url } = inputs;\n const downloadResult = await downloadPages({ url });\n const markdownContent = downloadResult.markdown; // Assuming this is the returned markdown content\n\n // Generate questions and answers from markdown content\n const llmResponse = await shinkaiLlmPromptProcessor({\n prompt: `Generate questions and answers from the following content:\\n\\n${markdownContent}\\n\\nFormat your output as a JSON array of objects with \"question\" and \"answer\" keys without any formatting.`,\n format: 'json'\n });\n \n let i = 0;\n for (const pair of JSON.parse(llmResponse.message)) {\n const question = pair.question.trim();\n const answer = pair.answer.trim();\n console.log(i, question, answer);\n i = i + 1;\n if (question.length > 0 && answer.length > 0) {\n await shinkaiSqliteQueryExecutor({\n query: `INSERT INTO Questions (Question, Answer) VALUES (?, ?)`,\n params: [pair.question.trim(), pair.answer.trim()]\n });\n await shinkaiSqliteQueryExecutor({\n query: `DELETE FROM Questions WHERE Question = '';`\n });\n }\n }\n \n return { message: \"Learning completed and questions stored.\" };\n \n } else if (inputs.action === 'ask') {\n const result = await shinkaiSqliteQueryExecutor({\n query: `SELECT * FROM Questions ORDER BY CorrectCount ASC LIMIT 10`\n });\n const questions = result.result;\n if (questions.length === 0) {\n return { message: \"No questions available.\" };\n }\n const randomQuestion = questions[Math.floor(Math.random() * questions.length)];\n return { message: `Question #${randomQuestion.ID}: ${randomQuestion.Question}?` };\n \n } else if (inputs.action === 'respond' && inputs.userResponse && inputs.questionId) {\n const questionId = Number(inputs.questionId);\n const result = await shinkaiSqliteQueryExecutor({\n query: `SELECT * FROM Questions WHERE ID = ${questionId}`,\n params: []\n });\n\n const question = result.result[0];\n \n if (!question) {\n return { message: \"Question not found.\" };\n }\n \n const llmResponse = await shinkaiLlmPromptProcessor({\n prompt: `Check if the response ${inputs.userResponse} is an adecuate response to the question ${question.Answer}. Return CORRECT if it's correct, or INCORRECT if it's incorrect inside a JSON object with key result without any formatting, just RAW JSON.`,\n format: 'json'\n });\n \n console.log(inputs.questionId, question, llmResponse);\n \n const llmAnswer = JSON.parse(llmResponse.message);\n \n if (llmAnswer.result === \"CORRECT\") {\n await shinkaiSqliteQueryExecutor({\n query: `UPDATE Questions SET CorrectCount = CorrectCount + 1 WHERE ID = ${questionId}`,\n params: []\n });\n return { message: \"CORRECT\" };\n } else {\n await shinkaiSqliteQueryExecutor({\n query: `UPDATE Questions SET IncorrectCount = IncorrectCount + 1 WHERE ID = ${questionId}`,\n params: []\n });\n return { message: \"INCORRECT\" };\n }\n }\n\n return { message: \"Invalid action.\" };\n}\n","tools":["local:::__official_shinkai:::shinkai_llm_prompt_processor","local:::__official_shinkai:::shinkai_sqlite_query_executor","local:::__official_shinkai:::download_pages"],"config":[],"description":"Learns from web pages by generating questions and answers, and interacts with users based on these questions. If the action was 'ask' it returns a question, always include the question number when referencing it","keywords":[],"input_args":{"type":"object","properties":{"questionId":{"type":"number","description":"The ID of the question being asked"},"action":{"type":"string","description":"The action to perform: 'learn', 'ask', or 'respond'"},"url":{"type":"string","description":"The URL to download for learning"},"userResponse":{"type":"string","description":"The user's response to the current question"}},"required":["action"]},"output_arg":{"json":""},"activated":false,"embedding":[0.21706991,0.3584407,-0.62566733,-0.11160347,-0.67455965,-0.1561139,-1.0833845,0.75861084,-0.2857256,0.17757568,-0.38373923,0.20315388,-0.11974335,0.2774887,0.8499054,-0.3755989,0.7324438,-0.37291768,-1.8232055,0.61022794,0.11635405,0.78444594,0.52012616,0.15670744,-0.73577785,-0.18376847,0.33164066,-0.19584723,-0.7147613,-1.928544,0.7561916,0.62534314,-0.6719986,-0.24185777,-0.22565183,-0.73809016,0.80933374,0.067422345,-0.50740635,0.15074362,0.064329535,0.7656423,-0.6984089,-0.011261161,0.31263676,0.094826125,-0.38410646,-0.5978887,0.59061915,0.70000505,-0.77681756,-0.8851424,0.5290352,0.19301677,0.033826344,-0.19090153,-0.57570064,-0.116506696,-0.027560867,-0.43939397,0.5210022,0.6762746,-3.5652654,0.4498492,-0.16901934,0.10963146,-0.05926913,-0.8876597,-0.5261506,0.21232685,0.3798099,0.053473905,0.12743214,0.6351746,0.4745645,-0.45327052,0.121850535,-0.062948786,0.6063187,-0.544385,0.4749117,0.8214794,-0.013026489,0.67419004,-0.12354344,0.5572102,0.07557513,-0.16348359,0.54332525,0.58636665,-0.16053295,-0.103272974,-0.109083556,-0.4637578,-0.055400603,-0.29076737,-0.3145307,-0.14697951,-0.07649026,3.4162662,-0.010299683,-0.33792374,0.51610553,-0.96711075,0.28260836,-0.27571082,-0.12589715,-0.70793724,0.022236876,-0.27253923,0.19247256,-0.1506436,-0.29195243,0.2501807,0.70012313,0.29713976,-0.2980407,-0.18028173,0.1601712,0.59212565,-0.24332522,0.2837192,-0.45769566,-0.08940417,-0.06055177,-0.097159594,0.17039731,0.57032806,0.22197543,0.22518584,0.28747955,-0.7124402,-1.0509254,0.28376582,0.06990753,0.178911,-0.104918644,-0.6928648,0.224038,-0.88769025,-0.38745004,-0.9990925,0.79940337,0.13323304,0.45831117,0.31942293,-0.39664906,-0.23246956,-0.2825301,0.11200398,0.25427744,0.010025285,-0.0018543577,0.20967153,0.55590093,0.1852944,-0.06313523,-0.47032952,-0.08455537,0.40403044,-0.5994254,-0.691078,0.21086276,0.256006,0.28030476,-0.050527852,-0.75789934,0.21773633,0.1577397,-0.593085,0.4248397,0.32072243,-0.13944598,0.8837457,-0.13218267,-0.33781752,-0.001700677,-0.16717753,-0.3172427,-0.90718925,0.49440745,0.8165897,-0.18596362,-0.8666227,0.34760553,0.32083634,-0.22356972,-0.089780994,0.8603571,0.8974726,-1.0441595,0.77772695,-0.83273643,-0.92442864,0.10950381,-0.45605737,0.30133843,0.2978428,0.87869906,-0.20272315,-0.53605354,-0.011535779,-0.30752718,0.2915651,-0.72999215,0.30673993,0.32038337,0.42160168,-0.2243603,-1.0477458,0.2585037,-0.54573035,0.787378,0.31457478,0.67461944,0.11738212,0.7796836,0.16689157,-0.052771755,0.45646888,-0.052859403,-0.17782578,-0.0024207681,-0.64226943,-0.5612077,0.71099585,-0.54411995,0.3299234,-0.61978734,-0.094320506,-0.07824578,0.77131003,0.22146715,1.2679993,0.631575,0.16063823,-0.6480606,0.32354665,0.8975824,-0.43495348,0.16214138,0.02546177,0.39886326,0.11504981,0.16969685,-0.44520238,-0.102386385,-0.25740942,0.15395282,1.6665227,1.245787,0.6468663,0.2521198,0.6614715,0.17731339,-0.23956114,-1.579405,0.34504008,-0.6321144,0.24229479,-0.62288684,-0.655253,0.61666095,0.38716763,0.2633341,-0.19117309,-1.0421027,-0.35434997,0.15482494,-0.6180331,-0.10025748,0.9822226,-0.8385656,0.2744784,-0.018530542,-0.07341386,-0.022843184,0.13998207,-0.6072779,0.12906039,0.14181161,-0.92372197,0.07313164,0.17033282,0.095158495,-0.90499175,-0.23741168,-0.15604949,-0.3903274,0.150628,0.13685635,-0.43871364,-0.06122921,0.7305853,1.1007711,0.9084113,0.6790187,-0.22775854,-0.22765656,0.36475682,-0.15525196,0.30711335,-0.03501725,0.00081416965,-1.1288316,-0.75152034,0.134829,0.40597475,-0.10007594,0.77668124,-0.8649264,0.35869074,0.16459171,0.5272138,0.926515,-0.48629296,0.9427834,0.67841506,-0.29091206,-1.7819054,0.06876713,-0.3591036,-0.26245618,-0.019396156,0.05574575,0.64181924,-0.45325464,0.47828224,-0.2725528,0.9156376,0.38192093,-0.6386184,-0.19837987,0.093480535,0.79756224,0.2822749,-0.055174,0.2966572,-0.07618416,0.19077243,0.975749,0.6013619,0.49140128,0.9117549,0.22897574,-0.3347539,-0.7730863,-1.5366509,-0.63781154,0.2092189,-0.41901696,0.2382148,-0.25200358,-0.1483219,0.1442696,0.5860166,0.015107177,-0.11544926,0.0024682116,1.7490195,-0.40928602,-0.3117113,0.03644649,0.05633047,-0.1202318,0.23006758,0.2262583,-1.0001892,-0.12196587,0.27068874,-0.47797912,0.43436462,0.16214763,0.027078949,0.3656093,0.9179376,0.11831908,0.45551047,-0.027892262,0.24706681,1.0164907,-0.45186308,-0.32413527,-0.3631763],"result":{"type":"object","properties":{"message":{"description":"The response message after processing the action","type":"string"}},"required":["message"]},"sql_tables":[{"name":"Questions","definition":"CREATE TABLE IF NOT EXISTS Questions (ID INTEGER PRIMARY KEY AUTOINCREMENT, Question TEXT NOT NULL, Answer TEXT NOT NULL, CorrectCount INTEGER DEFAULT 0, IncorrectCount INTEGER DEFAULT 0)"}],"sql_queries":[{"name":"Insert question and answer","query":"INSERT INTO Questions (Question, Answer) VALUES (?, ?)"},{"name":"Select all questions","query":"SELECT * FROM Questions ORDER BY CorrectCount ASC LIMIT 10"},{"name":"Select question by ID","query":"SELECT * FROM Questions WHERE ID = ?"}],"file_inbox":null,"oauth":[],"assets":null,"runner":"any","operating_system":["linux","macos","windows"],"tool_set":""},false]} \ No newline at end of file diff --git a/tools/shinkai-question-learner/metadata.json b/tools/shinkai-question-learner/metadata.json index 1b1afc7c..5ead5606 100644 --- a/tools/shinkai-question-learner/metadata.json +++ b/tools/shinkai-question-learner/metadata.json @@ -5,6 +5,9 @@ "author": "Shinkai", "version": "1.0.0", "keywords": [], + "runner": "any", + "operating_system": ["linux", "macos", "windows"], + "tool_set": "", "configurations": { "type": "object", "properties": {}, diff --git a/tools/smart-search/.tool-dump.test.json b/tools/smart-search/.tool-dump.test.json new file mode 100644 index 00000000..caf6ae63 --- /dev/null +++ b/tools/smart-search/.tool-dump.test.json @@ -0,0 +1 @@ +{"type":"Deno","content":[{"name":"Smart Search Engine","homepage":null,"author":"@@official.shinkai","version":"1.0.0","js_code":"import { googleSearch, shinkaiLlmPromptProcessor, downloadPages } from './shinkai-local-tools.ts';\n\ntype CONFIG = {\n searchEngineApiKey?: string;\n searchEngine?: SearchEngine;\n maxSources?: number;\n}\ntype INPUTS = {\n question: string;\n};\ntype OUTPUT = {\n response: string;\n sources: SmartSearchSourcePage[];\n statements: SmartSearchStatement[];\n}\ntype PREFFERED_SOURCES = 'WIKIPEDIA'|'WOLFRAMALPHA'|'OTHER';\n\ntype SearchQueryConversion = {\n \"origin_question\": string;\n \"preferred_sources\": PREFFERED_SOURCES[];\n \"search_query\": string\n}\n\ntype SearchResult = {\n title: string;\n description: string;\n url: string;\n}\n\ntype SmartSearchSource = SearchResult | string;\ntype SearchEngine = 'DUCKDUCKGO' | 'GOOGLE' | 'BRAVE';\n\nexport interface SmartSearchSourcePage {\n id: number;\n url: string;\n markdown?: string;\n title: string;\n}\n\nexport interface SmartSearchStatement {\n sourceId: number;\n sourceTitle: string;\n extractedFacts: {\n statement: string;\n relevance: 'DIRECT_ANSWER' | 'HIGHLY_RELEVANT' | 'SOMEWHAT_RELEVANT' | 'TANGENTIAL' | 'NOT_RELEVANT';\n }[];\n}\nexport interface SmartSearchGenerationContext {\n originalQuestion: string;\n statements: SmartSearchStatement[];\n sources: SmartSearchSourcePage[];\n}\n\nconst answerGenerator = (context: SmartSearchGenerationContext): string => `\n# Smart Search Answer Generation Instructions\nYou are a sophisticated scientific communication assistant specialized in transforming extracted research statements into comprehensive, accessible, and precisely cited explanations.Your primary objective is to synthesize complex information from multiple sources into a clear, authoritative answer that maintains absolute fidelity to the source material. Think of yourself as an academic translator - your role is to take fragmented scientific statements and weave them into a coherent narrative that is both intellectually rigorous and engaging, ensuring that every substantive claim is meticulously attributed to its original source. Approach each question as an opportunity to provide a deep, nuanced understanding that goes beyond surface-level explanation, while maintaining strict scholarly integrity.\n## Input JSON Interfaces and Definitions\n\n\\`\\`\\`typescript\n// Source Page Interface\nexport interface SmartSearchSourcePage {\n id: number; // Unique identifier for the source\n url: string; // Full URL of the source\n markdown: string; // Full text content of the source page\n title: string; // Title of the source page\n}\n\n// Statement Interface with Detailed Relevance Levels\nexport interface SmartSearchStatement {\n sourceId: number; // ID of the source this statement comes from\n sourceTitle: string; // Title of the source\n extractedFacts: {\n statement: string; // Exact verbatim text from the source\n relevance: 'DIRECT_ANSWER' \n | 'HIGHLY_RELEVANT' \n | 'SOMEWHAT_RELEVANT' \n | 'TANGENTIAL' \n | 'NOT_RELEVANT'; // Relevance classification\n }[];\n}\n\n// Complete Input JSON Structure\ninterface AnswerGenerationContext {\n originalQuestion: string;\n statements: SmartSearchStatement[];\n sources: SmartSearchSourcePage[];\n}\n\\`\\`\\`\n\n## Relevance Level Interpretation\n- \\`DIRECT_ANSWER\\`: Prioritize these statements first\n- \\`HIGHLY_RELEVANT\\`: Strong secondary focus\n- \\`SOMEWHAT_RELEVANT\\`: Use for additional context\n- \\`TANGENTIAL\\`: Optional supplementary information\n- \\`NOT_RELEVANT\\`: Ignore completely\n\n## Answer Generation Guidelines\n\n### Content Construction Rules:\n1. Use ONLY information from the provided statements\n2. Prioritize statements with 'DIRECT_ANSWER' and 'HIGHLY_RELEVANT' relevance\n3. Create a comprehensive, informative answer\n4. Maintain scientific accuracy and depth\n\n### Citation Methodology:\n- Place citations IMMEDIATELY after relevant statements\n- Use SQUARE BRACKETS with NUMERIC source IDs\n- Format: \\`Statement of fact.[1][2]\\`\n- Cite EVERY substantive statement\n- Match citations exactly to source IDs\n\n### Structural Requirements:\n1. Detailed Main Answer\n - Comprehensive explanation\n - Technical depth\n - Precise scientific language\n - Full source citations\n\n2. Follow-Up Questions Section\n - Generate 3-4 thought-provoking questions\n - Encourage deeper exploration\n - Based on answer content\n - Formatted as a bulleted list\n\n3. Sources Section\n - List all cited sources\n - Include source titles and URLs\n - Order based on first citation appearance\n\n## Output Example Structure:\n\\`\\`\\`\n[Comprehensive, cited answer with source IDs in brackets]\n\nFollow-up Questions:\n- Question about deeper aspect of the topic\n- Question exploring related concepts\n- Question encouraging further research\n\nSources:\n[1] Source Title (URL)\n[2] Another Source Title (URL)\n...\n\\`\\`\\`\n\n## Critical Constraints:\n- NEVER introduce information not in the statements\n- Preserve exact factual content\n- Ensure grammatical and logical coherence\n- Provide a complete, informative answer\n- Maintain academic rigor\n\n## Processing Instructions:\n- Analyze statements systematically\n- Synthesize information coherently\n- Break down complex concepts\n- Provide scientific context\n- Explain underlying mechanisms\n\n\nThis is the input context:\n${JSON.stringify(context)}\n\n`;\n\nconst searchEngineQueryGenerator = (query: string) => {\n return `\n# Search Query and Source Selection Prompt\n\nYou are an expert at transforming natural language questions into precise search queries and selecting the most appropriate information source.\n\n## Source Selection Guidelines:\n- WIKIPEDIA: Best for general knowledge, scientific explanations, historical information\n- WOLFRAMALPHA: Ideal for mathematical, statistical, computational queries, scientific calculations\n- OTHER: General web search for current events, recent developments, practical information\n\n## Output Requirements:\n- Provide a JSON response with three key fields\n- Do NOT use code block backticks\n- Ensure \"preferred_sources\" is an array\n- Make search query concise and targeted\n\n## Examples:\n\n### Example 1\n- User Query: \"What is the speed of light?\"\n- Output:\n{\n\"origin_question\": \"What is the speed of light?\",\n\"preferred_sources\": [\"WOLFRAMALPHA\"],\n\"search_query\": \"speed of light exact value meters per second\"\n}\n\n### Example 2\n- User Query: \"Who was Marie Curie?\"\n- Output:\n{\n\"origin_question\": \"Who was Marie Curie?\",\n\"preferred_sources\": [\"WIKIPEDIA\"],\n\"search_query\": \"Marie Curie biography scientific achievements\"\n}\n\n### Example 3\n- User Query: \"Best restaurants in New York City\"\n- Output:\n{\n\"origin_question\": \"Best restaurants in New York City\",\n\"preferred_sources\": [\"OTHER\"],\n\"search_query\": \"top rated restaurants NYC 2024 dining\"\n}\n\n### Example 4\n- User Query: \"How do solar panels work?\"\n- Output:\n{\n\"origin_question\": \"How do solar panels work?\",\n\"preferred_sources\": [\"WIKIPEDIA\", \"OTHER\"],\n\"search_query\": \"solar panel photovoltaic technology mechanism\"\n}\n\n## Instructions:\n- Carefully analyze the user's query\n- Select the MOST APPROPRIATE source(s)\n- Create a targeted search query\n- Return ONLY the JSON without additional text\n\nUser Query: ${query}\n`\n\n}\n\nconst statementExtract = (originalQuestion: string, source: SmartSearchSourcePage): string => `\n\n# Fact Extraction Instructions\n\n## Input JSON Structure\n\\`\\`\\`json\n{\n \"originalQuestion\": \"string - The user's original question\",\n \"source\": {\n \"id\": \"number - Unique identifier for the source\",\n \"url\": \"string - URL of the source page\",\n \"title\": \"string - Title of the source page\",\n \"markdown\": \"string - Full text content of the source page\"\n }\n}\n\\`\\`\\`\n\n## Output JSON Structure\n\\`\\`\\`json\n{\n \"sourceId\": \"number - ID of the source\",\n \"sourceTitle\": \"string - Title of the source\",\n \"extractedFacts\": [\n {\n \"statement\": \"string - Verbatim text from the source\",\n \"relevance\": \"string - One of ['DIRECT_ANSWER', 'HIGHLY_RELEVANT', 'SOMEWHAT_RELEVANT', 'TANGENTIAL', 'NOT_RELEVANT']\"\n }\n ]\n}\n\\`\\`\\`\n\n## Relevance Classification Guide:\n- \\`DIRECT_ANSWER\\`: \n - Completely and precisely addresses the original question\n - Contains the core information needed to fully respond\n - Minimal to no additional context required\n\n- \\`HIGHLY_RELEVANT\\`: \n - Provides substantial information directly related to the question\n - Offers critical context or partial solution\n - Significantly contributes to understanding\n\n- \\`SOMEWHAT_RELEVANT\\`: \n - Provides partial or indirect information\n - Offers peripheral insights\n - Requires additional context to be fully meaningful\n\n- \\`TANGENTIAL\\`: \n - Loosely connected to the topic\n - Provides background or related information\n - Not directly addressing the core question\n\n- \\`NOT_RELEVANT\\`: \n - No meaningful connection to the original question\n - Completely unrelated information\n\n\n ## Extraction Guidelines:\n 1. Read the entire source document carefully\n 2. Extract EXACT quotes that:\n - Are actually helpful answering the provided question\n - Are stated verbatim from the source or are rephrased in such a way that doesn't distort the meaning in the original source\n - Represent complete thoughts or meaningful segments\n 3. Classify each extracted fact with its relevance level\n 4. Preserve original context and nuance\n\n## Critical Rules:\n- try NOT to paraphrase or modify the original text\n- Avoid any text in the \"statement\" field that is not helpful answering the provided question like javascript, URLs, HTML, and other non-textual content\n- Extract statements as they appear in the source and ONLY if they are helpful answering the provided question\n- Include full sentences or meaningful text segments\n- Preserve original formatting and punctuation\n- Sort extracted facts by relevance (DIRECT_ANSWER first)\n- Output JSON without \\`\\`\\`json\\`\\`\\` tags, or without any escape characters or any text that is not JSON or my system will crash.\n\n## Processing Instructions:\n- Analyze the entire document systematically\n- Be comprehensive in fact extraction\n- Err on the side of inclusion when in doubt\n- Focus on factual, informative statements\n\n==BEGIN INPUT==\nOriginal Question: ${originalQuestion}\n\nSource:\n${JSON.stringify(source)}\n==END INPUT==\n\n`\nconst debug = []\nfunction tryToExtractJSON(text: string): string {\n const regex = /```(?:json)?\\n([\\s\\S]+?)\\n```/;\n const match = text.match(regex);\n if (match) return match[1];\n else return text;\n}\n\nconst ProcessQuestionError = (step: string, error: Error): string =>\n `Failed to process question at ${step}: ${error.message}`;\n\nasync function conversionToSearchQuery(question: string): Promise {\n const prompt = searchEngineQueryGenerator(question);\n const optimizedQueryResult = await shinkaiLlmPromptProcessor({ format: 'text' , prompt });\n try {\n const result = JSON.parse(optimizedQueryResult.message.trim()) as SearchQueryConversion;\n return result;\n } catch (error) {\n throw new Error(ProcessQuestionError('question processing in optimizequery', new Error(String(error))));\n }\n}\n\n\nasync function extractSourcesFromSearchEngine(\n searchQuery: string,\n engine: SearchEngine,\n apiKey?: string,\n): Promise {\n switch (engine) {\n\t\tcase 'GOOGLE' : {\n\t\t\tconst results = await googleSearch({ query: searchQuery });\n\t\t\treturn results.results;\n\t\t}\n case 'DUCKDUCKGO':\n throw new Error('DuckDuckGo is not supported yet');\n case 'BRAVE': \n throw new Error('Brave is not supported yet');\n default:\n throw new Error('Invalid or unsupperted search engine');\n }\n}\n\nexport async function run(\n config: CONFIG,\n inputs: INPUTS\n): Promise {\n const { question } = inputs;\n if (!question) {\n throw new Error('Question is required in inputs');\n }\n\n try {\n // Step 1: Generate optimized search query\n const searchQuery = await conversionToSearchQuery(question);\n // Step 2: Perform search with optimized query\n const sources: SmartSearchSource[] = []\n for (const preferred_source of searchQuery.preferred_sources) {\n switch (preferred_source) {\n case 'WIKIPEDIA':{\n const searchEngineQuery = searchQuery.search_query+' site:wikipedia.org';\n const searchEngine = config.searchEngine || 'GOOGLE';\n const sourcesSearchResults: SearchResult[] = await extractSourcesFromSearchEngine(searchEngineQuery, searchEngine, config.searchEngineApiKey);\n try {\n const maxSources = config.maxSources ?? 3;\n sources.push(...(sourcesSearchResults.slice(0, Number(maxSources)) as SearchResult[]));\n } catch (error) {\n console.error('Failed to process search results', error);\n throw new Error('Failed to process search results');\n }\n break;\n }\n case 'WOLFRAMALPHA':\n throw new Error('WOLFRAMALPHA is not supported yet');\n case 'OTHER':\n break;\n default:\n throw new Error('Invalid source');\n }\n }\n const smartSearchSouces: SmartSearchSourcePage[] = []\n let id = 1;\n for (const source of sources) {\n if (typeof source === 'string') throw new Error('Invalid source');\n const searchResult = await downloadPages({ url: source.url });\n smartSearchSouces.push({\n id: id++, url: source.url, title: source.title,\n markdown: searchResult.markdown ?? '',\n });\n }\n const statements: SmartSearchStatement[] = []\n // Step 3: Extract statements from sources\n for (const smartSearchSource of smartSearchSouces) {\n const statementString = await shinkaiLlmPromptProcessor({ format: 'text', prompt: statementExtract(question, smartSearchSource) });\n const cleanStatementString = tryToExtractJSON(statementString.message)\n try { \n const statement = JSON.parse(cleanStatementString) as SmartSearchStatement;\n statements.push(statement);\n } catch (error) {\n console.error('Failed to process statement', smartSearchSource.url, error);\n console.error(cleanStatementString)\n }\n }\n // clean markdown from sources for lighter input\n smartSearchSouces.forEach(source => delete source.markdown);\n const generationContext: SmartSearchGenerationContext = {\n originalQuestion: question,\n statements,\n sources: smartSearchSouces,\n }\n // Step 4: Generate answer\n const answerPrompt = answerGenerator(generationContext);\n\t\tconst response = await shinkaiLlmPromptProcessor({ format: 'text', prompt: answerPrompt });\n return {\n statements,\n sources: smartSearchSouces,\n response: response.message,\n };\n } catch (error) {\n throw new Error(ProcessQuestionError('question processing in answer generation', new Error(String(error))));\n }\n}\n","tools":["local:::__official_shinkai:::google_search:::1.0.0","local:::__official_shinkai:::shinkai_llm_prompt_processor:::1.0.0","local:::__official_shinkai:::download_pages:::1.0.0"],"config":[{"BasicConfig":{"key_name":"searchEngine","description":"The search engine to use","required":false,"type":null,"key_value":null}},{"BasicConfig":{"key_name":"searchEngineApiKey","description":"The API key for the search engine","required":false,"type":null,"key_value":null}},{"BasicConfig":{"key_name":"maxSources","description":"The maximum number of sources to return","required":false,"type":null,"key_value":null}}],"description":"This function takes a question as input and returns a comprehensive answer, along with the sources and statements used to generate the answer.","keywords":["search","answer generation","fact extraction","wikipedia","google"],"input_args":{"type":"object","properties":{"question":{"type":"string","description":"The question to answer"}},"required":["question"]},"output_arg":{"json":""},"activated":false,"embedding":[0.44519925,0.011538006,-0.110713586,-0.22075558,-0.14790598,-0.29269773,-0.4754676,0.44221854,-0.121888064,0.39252597,-0.3006528,1.0143435,0.36214498,-0.31270468,0.6776067,0.25015622,0.35587713,-0.23176439,-1.9852347,0.016676497,0.5186351,0.13615943,0.34565818,0.11482762,-0.014134172,0.29590514,0.31907755,-0.3896206,-1.2329955,-1.6192199,0.85829604,0.62480825,-0.6851429,-0.4065035,-0.57009935,-0.44622755,-0.018254763,-0.29652905,0.06502104,0.08794068,0.123337545,-0.2962008,-0.7889936,-0.2309857,-0.30533978,0.00014958903,-0.100521065,-0.17255962,0.65703535,0.59996736,-0.34312758,-0.3323959,-0.2751081,0.054695282,-0.6813821,-0.16973025,-0.34893867,-0.60133564,-0.1950637,-0.30053732,0.61119884,0.13490543,-4.0774403,-0.1405774,0.52335876,0.2547453,0.10967965,-0.37900138,0.33353627,-0.0860852,0.06344949,0.27401373,0.35607475,0.3472401,0.20127875,-0.2749816,-0.1676489,-0.3010119,0.40944278,-0.60488445,-0.33455145,0.036982603,0.1607093,0.18134978,-0.50376195,0.4321913,0.21538696,-0.3986729,0.1924279,-0.07740533,-0.5905008,-0.32293463,-0.33489698,0.08675105,-0.38169703,0.20435761,0.1692553,0.48983234,0.4500325,3.2424073,0.30719528,-0.3322998,0.36166048,-1.097402,0.9221763,-0.3271866,0.15179256,-0.7435132,0.7849906,-0.076523826,0.4214928,-0.20277414,-0.008337051,0.84142566,-0.14813311,0.10049243,-0.48139656,0.091330424,0.08260442,0.73960954,-0.13112147,0.17086662,-0.43677095,-0.3310505,-0.25675213,0.6580711,-0.3097783,0.3686354,0.40853876,0.52439237,0.45975456,-0.5577316,-1.1559865,-0.028603502,0.3412104,0.350788,0.30436534,-0.84187645,0.6342305,-0.7242338,0.30563703,-1.3071945,0.56033385,-0.11213897,0.7491704,-0.037651196,-0.66392916,-0.22443774,-0.40022716,-0.4695392,0.12346482,0.42506516,-0.008828731,-0.036567945,0.7910692,0.4870108,-0.10458979,-0.0010068789,-0.19713187,0.18817124,-0.34421226,0.43161416,0.35337302,0.45155972,0.31935665,-0.38856277,0.14921239,0.46791223,-0.19556057,-0.1643018,0.4380207,-0.46539715,-0.2832293,0.81312156,-0.052545656,-0.29040393,0.1400195,-0.12654832,0.41849804,-0.882607,-0.13826783,0.77245986,-0.5711882,-0.27059942,-0.19140518,0.4529812,0.0826526,-0.367387,0.64419246,1.1117058,-0.47169876,1.4447793,-0.2390542,-0.19558607,0.1427455,-0.21482131,0.104871795,0.2707702,0.38783553,0.1292122,-1.0809127,-0.0846922,-0.039507207,-0.3097255,-0.29537687,-0.65163094,0.19342569,-0.32778674,-0.08130689,-0.64830554,0.12468888,-0.5193145,1.1083255,-0.010225475,0.6004076,-0.14024194,0.058595452,0.4302386,-0.47035223,0.8164973,0.21753985,-0.013964482,-0.6944066,-0.62527126,-0.82455045,-0.112839624,0.14301777,0.12782156,-0.2723977,0.008159652,0.5853714,0.9211197,0.4646956,1.390659,0.76697886,0.523064,-0.12873787,0.25171667,0.17022641,-0.30911857,0.31879586,-0.1103535,-0.33922687,-0.32489824,0.3671196,-0.54260576,-0.010865424,-0.16758339,0.06505124,1.4560661,0.7549216,0.18457569,-0.04554111,0.9045233,-0.14435571,0.16820474,-1.6039296,0.078886904,-0.30494863,0.45922333,-0.011344843,-0.3130207,0.39990506,0.3539346,-0.6010364,-0.8332309,-0.37220326,-0.80922806,-0.17530465,-0.06533443,-0.109381296,0.35899848,-0.47536635,-0.042883083,0.5028103,0.15244354,0.3528542,0.5739549,-0.58191675,-0.13802925,0.4039406,0.15418546,0.10369478,0.24870338,-0.14724898,-0.1899396,-0.4523422,-0.067849,-0.45093012,0.7759565,-0.47772875,-0.5009712,-0.63364625,0.32183337,1.6104475,0.31228143,-0.2737522,0.8513892,-0.10785564,-0.083213486,0.3272493,0.34409443,-0.102422476,0.14750528,-0.21719596,-0.7646839,0.7050644,-0.43036377,-0.34817296,-0.07673599,-0.8938274,-0.259611,0.085467875,-0.35622948,0.17879769,-0.4371638,0.84722894,0.42178243,0.47265047,-2.0367239,-0.28862223,0.2279939,0.023028731,0.03350927,-0.84622985,0.6191283,-0.36584458,0.52736944,-0.8522264,1.7012173,0.623458,-0.34564644,-0.29220566,0.22257191,1.008989,-0.5586227,-0.100436315,-0.20206258,-0.14138165,0.29932487,0.3574607,1.777014,0.44976053,0.1803996,0.17181638,0.11031827,-0.18544856,-1.3960699,0.18656585,0.43533033,-0.32739973,0.56046206,-0.08367232,-0.45680672,0.45554873,1.0323718,0.2787497,0.19714256,-0.0057662483,2.0173283,0.14193904,-0.33267602,-0.4824432,-0.44496542,-0.44327742,0.33923206,0.24754228,-0.22856423,0.23647808,-0.4234256,-0.11778459,-0.19414693,0.28126818,-0.0637252,0.28323674,0.4969948,-0.15884419,0.684458,0.3888534,-0.17290172,0.74648315,0.03662668,-1.0852582,-0.24843164],"result":{"type":"object","properties":{"response":{"description":"The generated answer","type":"string"},"sources":{"description":"The sources used to generate the answer","items":{"properties":{"id":{"type":"number"},"title":{"type":"string"},"url":{"type":"string"}},"type":"object"},"type":"array"},"statements":{"description":"The statements extracted from the sources","items":{"properties":{"extractedFacts":{"items":{"properties":{"relevance":{"type":"string"},"statement":{"type":"string"}},"type":"object"},"type":"array"},"sourceId":{"type":"number"},"sourceTitle":{"type":"string"}},"type":"object"},"type":"array"}},"required":["response","sources","statements"]},"sql_tables":[],"sql_queries":[],"file_inbox":null,"oauth":null,"assets":null,"runner":"any","operating_system":["linux","macos","windows"],"tool_set":""},false]} \ No newline at end of file diff --git a/tools/smart-search/metadata.json b/tools/smart-search/metadata.json index 534f7832..be007735 100644 --- a/tools/smart-search/metadata.json +++ b/tools/smart-search/metadata.json @@ -11,6 +11,9 @@ "wikipedia", "google" ], + "runner": "any", + "operating_system": ["linux", "macos", "windows"], + "tool_set": "", "configurations": { "type": "object", "properties": { diff --git a/tools/stagehand-generic/.tool-dump.test.json b/tools/stagehand-generic/.tool-dump.test.json new file mode 100644 index 00000000..25d4de0d --- /dev/null +++ b/tools/stagehand-generic/.tool-dump.test.json @@ -0,0 +1 @@ +{"type":"Deno","content":[{"name":"Stagehand Runner","homepage":null,"author":"@@official.shinkai","version":"1","js_code":"import { shinkaiTypescriptUnsafeProcessor } from \"./shinkai-local-tools.ts\";\nimport { getAssetPaths } from './shinkai-local-support.ts';\n\nconst getStagehandEngine = async () => {\n const assets = await getAssetPaths();\n return await Deno.readTextFile(assets.find(f => f.match(/engine.ts$/)));\n}\nconst getShinkaiEthers = async () => {\n const assets = await getAssetPaths();\n return await Deno.readTextFile(assets.find(f => f.match(/ethers.js$/)));\n}\n\nconst getStagehandPackage = () => {\n return JSON.stringify({\n \"name\": \"standalone\",\n \"version\": \"1.0.0\",\n \"main\": \"index.ts\",\n \"scripts\": {},\n \"author\": \"\",\n \"license\": \"ISC\",\n \"description\": \"\",\n \"dependencies\": {\n \"@browserbasehq/stagehand\": \"https://github.com/dcspark/stagehand\",\n \"sharp\": \"^0.33.5\",\n \"json-schema-to-zod\": \"^2.6.0\",\n \"zod\": \"^3.24.1\"\n }\n }, null, 2);\n}\n\nexport async function run(config: { wallet_sk?: string }, parameters: any) {\n const config_ = {\n src: '',\n wallet_sk: config.wallet_sk,\n }\n if (config.wallet_sk) {\n config_.src = await getShinkaiEthers();\n }\n return await shinkaiTypescriptUnsafeProcessor({\n code: await getStagehandEngine(),\n package: getStagehandPackage(),\n parameters,\n config: config_,\n });\n}\n","tools":["local:::__official_shinkai:::shinkai_typescript_unsafe_processor"],"config":[{"BasicConfig":{"key_name":"wallet_sk","description":"EVM Wallet Private Key","required":false,"type":null,"key_value":null}}],"description":"Automates web interactions and extracts data using Stagehand.","keywords":["stagehand","web automation","data extraction"],"input_args":{"type":"object","properties":{"commands":{"type":"array","description":"List of commands to execute","items":{"type":"object","description":"","properties":{"id":{"type":"number","description":"index of the command (1, 2, 3, ...)"},"payload":{"type":"string","description":"Action Payload: goto=>url, wait=>ms, extract=>text-prompt, act=>text-prompt, goto-stage=>stage-id, observe=>text-prompt"},"jsonSchema":{"type":"object","description":"Optional JSON Schema for extract format"},"action":{"type":"string","description":"Type of action to perform: 'goto' | 'wait' | 'extract' | 'act' | 'goto-stage' | 'observe'"}}}}},"required":["commands"]},"output_arg":{"json":""},"activated":false,"embedding":[-0.062256187,0.05759345,-0.04693574,-0.42851412,-0.5635066,-0.057984985,-1.2683357,0.0800332,0.14948516,0.006930366,-0.48539865,1.0921854,-0.05440248,0.12786487,0.23581342,-0.7527184,0.42166245,-0.34721926,-1.4862926,-0.2568954,0.18425901,0.56455785,0.038950745,0.28205132,-0.7889859,0.5125738,0.23156938,-0.38810623,-1.1232843,-2.191717,0.2881765,0.38341144,-0.21012986,-0.48569196,0.00092502683,-1.1087977,-0.5023851,0.046182863,-0.46249393,-0.4557348,0.3664087,0.24957928,-0.7571717,0.21527112,0.2022081,-0.71116805,-0.19228226,-0.21417774,0.99962795,0.35391933,-0.4578629,-0.7634941,-0.15301873,-0.2524058,-0.30691177,-0.1890894,-0.34311262,-0.048971135,-0.025074452,0.24284463,0.041011408,0.40176684,-3.6256557,0.40709198,0.7452934,-0.092631646,0.20213804,-0.27581206,0.2632262,0.30181324,-0.23428306,0.0127078295,-0.0034614578,-0.029286265,-0.017516842,-0.5523181,0.1738432,0.28198832,0.78085893,-0.36883354,-0.095130965,0.88816637,-0.36808813,0.09186367,-0.23909721,1.010029,-0.38713413,-0.11799882,0.26173168,-0.49030015,-0.3934459,-0.28451014,-0.059342653,-0.117695,-0.69387025,0.58235234,0.28286046,0.814236,0.104725584,3.585369,0.6365179,0.07649335,0.07493795,-0.84004575,0.11427546,-0.26188266,-0.75615174,-0.11250021,-0.14116839,-0.013574515,-0.08801861,0.12890323,0.3074008,-0.09565229,0.6367259,-0.111331604,-0.23530158,-0.08049938,-0.1251037,0.738764,-0.48858726,0.5370041,-0.52705944,-0.38039136,0.043920603,-0.049983278,-0.41218463,0.52403194,0.23338936,-0.33820286,0.65819335,-0.5047486,-0.7327862,0.20013015,0.25885564,0.06985785,-0.27964222,-0.562773,0.43478873,-0.72157234,0.12034922,-0.97655064,1.0610301,0.04262776,1.1620873,0.07339832,-0.51682454,0.09969974,-0.5841097,0.31236526,0.04852243,0.6981003,-0.1071134,0.3766487,0.8607625,0.17174438,0.35818273,-0.594436,-0.7097033,0.13139622,-0.6285504,-0.43231243,0.4132805,0.266086,0.22319102,-0.7825356,0.28994095,-0.12923554,0.35500407,-0.5213982,0.05047337,-0.03490846,-0.15241763,-0.028073922,-0.25299636,-0.20115124,-0.49552616,0.18822443,-0.045928556,-0.53757787,1.1400145,1.0171865,-0.26666883,-0.3406624,-0.16656756,-0.15162319,-0.17956057,0.49222264,0.61414737,0.17810762,-0.093816675,1.5743747,-0.9634082,-0.2522686,-0.0176382,-0.57182693,-0.24036427,1.0252386,-0.09595497,-0.033116598,-0.09221726,-0.33065423,-0.09437288,-0.06221336,-0.031214751,-0.016489446,0.04809541,0.12721434,0.22690256,-0.5623001,-0.21014127,-0.26265198,0.4729742,-0.36602807,0.2691328,-0.32246262,-0.2068935,0.18768668,0.030830791,0.67905617,0.548276,0.19499782,-0.5418725,-0.57118255,-0.039033134,0.7268276,0.2296704,0.41429156,-0.072662875,-0.30614674,1.1148239,0.6741646,0.39915967,1.5873535,0.4038375,-0.0489429,0.31598872,0.6197995,0.7986628,-0.30886388,0.38752258,-0.2374132,0.13367952,-0.10049524,0.582849,-0.80301356,0.22767487,-0.1777104,0.080434546,1.4596984,0.94922256,0.5702865,0.13272981,0.4036001,-0.26591894,0.197539,-2.0886526,-0.34192264,-0.4410476,0.48738515,0.09093585,-0.07906315,0.32693073,-0.08038212,-0.25679675,0.14101702,-1.1989675,-0.4596766,-0.16288137,-0.06962161,-0.50921243,0.2263594,0.3148051,-0.09030778,-0.23537226,0.06003847,0.9987584,0.19524671,-0.67217857,0.491324,0.17064959,-0.026659515,0.9696139,0.59160006,-0.12393701,-0.5430493,-0.6401957,-0.002074711,-0.3979389,-0.056870267,-0.67150944,-0.62011266,-0.38027433,-0.022753254,1.278075,0.15718941,0.25057548,0.32571837,0.024643147,-0.37070638,-0.061688416,-0.04318156,-0.32127175,-0.015946656,-0.6035036,-0.22977354,0.3394662,0.18422796,-0.304626,0.36934093,-0.99683243,0.47298527,0.16301478,0.6251194,0.3486573,0.098178856,0.09433223,0.23709306,-0.5908296,-1.9473697,-0.14435977,0.22180057,-0.37104562,-0.12999073,-0.22804162,0.5466856,-0.6673948,0.16100366,-0.18680532,1.5413066,0.9805542,-0.4243502,0.026856404,0.0312657,1.1243236,-0.06461109,0.27320737,0.35890532,-0.12148203,-0.27391607,0.27216238,1.1725905,0.2796247,0.22876501,-0.17543179,0.58466077,-0.29614973,-1.3109357,0.49944314,-0.06606031,-0.68361306,0.62865436,0.2275807,-0.6089283,0.46974355,0.51157707,0.022993714,0.28277418,-0.2953396,1.5538496,-0.5396769,0.5978951,-0.51571035,0.7442676,-0.12024436,0.56285536,0.4083013,-0.50220215,-0.17206454,0.14906093,-0.16146462,-0.53098214,0.2513429,0.20121983,0.8594138,0.34813327,0.24724697,0.44246453,0.2570479,0.64208263,0.79755706,0.23992106,-1.202301,-0.16887103],"result":{"type":"object","properties":{"data":{"description":"Extracted data from executed commands","items":{},"type":"array"},"message":{"description":"The success message","type":"string"}},"required":["message","data"]},"sql_tables":[],"sql_queries":[],"file_inbox":null,"oauth":[],"assets":null,"runner":"any","operating_system":["linux","macos","windows"],"tool_set":""},false]} \ No newline at end of file diff --git a/tools/stagehand-generic/metadata.json b/tools/stagehand-generic/metadata.json index 59427532..23f80d82 100644 --- a/tools/stagehand-generic/metadata.json +++ b/tools/stagehand-generic/metadata.json @@ -1,5 +1,8 @@ { "author": "@@official.shinkai", + "runner": "any", + "operating_system": ["linux", "macos", "windows"], + "tool_set": "", "configurations": { "properties": { "wallet_sk": { diff --git a/tools/stock-technical-analysis/.tool-dump.test.json b/tools/stock-technical-analysis/.tool-dump.test.json new file mode 100644 index 00000000..c4ef82f0 --- /dev/null +++ b/tools/stock-technical-analysis/.tool-dump.test.json @@ -0,0 +1 @@ +{"type":"Python","content":[{"version":"1.0.0","name":"Stock Technical Analysis","homepage":null,"author":"@@official.shinkai","py_code":"# /// script\n# dependencies = [\n# \"pandas>=2.2.0\",\n# \"numpy>=1.26.0\",\n# \"aiohttp>=3.8.0\",\n# \"requests\",\n# \"python-dotenv>=0.21.0\",\n# \"setuptools>=65.0.0\",\n# \"pandas-ta>=0.3.14b\"\n# ]\n# ///\n\nimport os\nimport aiohttp\nimport pandas as pd\nimport numpy as np\nfrom datetime import datetime, timedelta\nfrom dotenv import load_dotenv\nfrom typing import Dict, Any, Optional, List\n\n# Ensure numpy nan is available for pandas-ta\nnp.NaN = np.nan\n\nimport pandas_ta as ta\n\n# Load environment variables from .env if present\nload_dotenv()\n\nclass CONFIG:\n tiingo_api_key: str = \"\" # If empty, we'll default to TIINGO_API_KEY env var\n\nclass INPUTS:\n symbol: str\n lookback_days: int = 365\n\nclass OUTPUT:\n analysis: dict\n\nasync def run(c: CONFIG, p: INPUTS) -> OUTPUT:\n if not p.symbol or not p.symbol.strip():\n raise ValueError(\"Missing 'symbol' in parameters\")\n\n api_key = c.tiingo_api_key.strip() if c.tiingo_api_key else os.getenv(\"TIINGO_API_KEY\", \"\").strip()\n if not api_key:\n raise ValueError(\"No Tiingo API key found. Provide it in 'tiingo_api_key' config or TIINGO_API_KEY env var\")\n\n # Prepare date range\n end_date = datetime.utcnow()\n start_date = end_date - timedelta(days=p.lookback_days)\n\n # Build the Tiingo URL\n base_url = \"https://api.tiingo.com/tiingo/daily\"\n url = (\n f\"{base_url}/{p.symbol}/prices?\"\n f\"startDate={start_date.strftime('%Y-%m-%d')}&\"\n f\"endDate={end_date.strftime('%Y-%m-%d')}&\"\n \"format=json\"\n )\n headers = {\n \"Content-Type\": \"application/json\",\n \"Authorization\": f\"Token {api_key}\"\n }\n\n # Fetch data asynchronously\n async with aiohttp.ClientSession() as session:\n async with session.get(url, headers=headers) as resp:\n if resp.status == 404:\n raise ValueError(f\"Symbol not found: {p.symbol}\")\n resp.raise_for_status()\n data = await resp.json()\n\n if not data:\n raise ValueError(f\"No data returned for symbol {p.symbol}\")\n\n # Convert to DataFrame\n df = pd.DataFrame(data)\n df[\"date\"] = pd.to_datetime(df[\"date\"])\n df.set_index(\"date\", inplace=True)\n\n # Use adjusted price columns if present\n df[\"open\"] = df.get(\"adjOpen\", df[\"open\"]).round(2)\n df[\"high\"] = df.get(\"adjHigh\", df[\"high\"]).round(2)\n df[\"low\"] = df.get(\"adjLow\", df[\"low\"]).round(2)\n df[\"close\"] = df.get(\"adjClose\", df[\"close\"]).round(2)\n df[\"volume\"] = df.get(\"adjVolume\", df[\"volume\"]).astype(int)\n\n # Basic sanity check: must have enough rows\n if len(df) < 10:\n raise ValueError(f\"Not enough data points to calculate indicators for {p.symbol}\")\n\n # Calculate indicators using pandas_ta\n # Moving Averages\n df.ta.sma(length=20, append=True, col_names=(\"sma_20\",))\n df.ta.sma(length=50, append=True, col_names=(\"sma_50\",))\n df.ta.sma(length=200, append=True, col_names=(\"sma_200\",))\n\n # RSI\n df.ta.rsi(length=14, append=True, col_names=(\"rsi\",))\n\n # MACD\n df.ta.macd(append=True)\n\n # ATR\n df.ta.atr(length=14, append=True, col_names=(\"atr\",))\n\n # Average Daily Range\n df[\"daily_range\"] = df[\"high\"] - df[\"low\"]\n df[\"adr\"] = df[\"daily_range\"].rolling(window=20).mean()\n df[\"adrp\"] = (df[\"adr\"] / df[\"close\"]) * 100\n\n # Volume\n df[\"avg_20d_vol\"] = df[\"volume\"].rolling(window=20).mean()\n\n # Get latest values\n latest = df.iloc[-1]\n\n # Build an output dict\n analysis_dict = {\n \"latestClose\": float(latest[\"close\"]),\n \"aboveSma20\": bool(latest[\"close\"] > latest[\"sma_20\"]),\n \"aboveSma50\": bool(latest[\"close\"] > latest[\"sma_50\"]),\n \"aboveSma200\": bool(latest[\"close\"] > latest[\"sma_200\"]),\n \"sma20OverSma50\": bool(latest[\"sma_20\"] > latest[\"sma_50\"]),\n \"sma50OverSma200\": bool(latest[\"sma_50\"] > latest[\"sma_200\"]),\n \"rsi\": float(latest[\"rsi\"]) if not np.isnan(latest[\"rsi\"]) else None,\n \"macdBullish\": bool(latest[\"MACD_12_26_9\"] > latest[\"MACDs_12_26_9\"]),\n \"atr\": float(latest[\"atr\"]) if not np.isnan(latest[\"atr\"]) else None,\n \"adrPercent\": float(latest[\"adrp\"]) if not np.isnan(latest[\"adrp\"]) else None,\n \"avg20dVolume\": float(latest[\"avg_20d_vol\"]) if not np.isnan(latest[\"avg_20d_vol\"]) else None,\n }\n\n # Build final OUTPUT\n out = OUTPUT()\n out.analysis = analysis_dict\n return out ","tools":[],"config":[{"BasicConfig":{"key_name":"tiingo_api_key","description":"Your Tiingo API key. If not provided, we will check the TIINGO_API_KEY environment variable.","required":false,"type":null,"key_value":null}}],"description":"Fetches historical stock data from Tiingo and calculates basic technical indicators (SMA, RSI, MACD, ATR, etc.), then returns a structured analysis of the trend.","keywords":["stock","analysis","technical-indicators","tiingo"],"input_args":{"type":"object","properties":{"lookback_days":{"type":"number","description":"How many days of historical data to fetch."},"symbol":{"type":"string","description":"The stock symbol to fetch data for."}},"required":["symbol"]},"output_arg":{"json":""},"activated":false,"embedding":[0.58811903,0.111723766,-0.22015761,-0.025289286,-0.20839623,-0.1935013,0.14670442,0.33279738,-0.6362363,-0.13342753,0.0507093,0.3594218,-0.12722197,-0.32963616,0.20080207,-0.6068062,0.5996432,-0.8241343,-1.3290377,-0.5292916,0.33431172,-0.17199981,-0.011315219,0.5975035,0.31965503,-0.2893814,-0.31850398,0.19485246,-0.75543034,-1.7734436,0.08777733,0.3243051,-0.17544901,-0.0072842985,-0.055048637,-0.11206012,0.36805087,0.43615258,-0.29184914,-0.25823295,0.37760848,0.051548794,-0.02091831,-0.600749,0.37825423,0.17470467,0.30251953,0.30700576,0.46462333,0.8401879,-0.40813145,0.13642469,0.118562,-0.7963201,-0.5335437,-0.14638829,0.28738478,-0.5981732,0.0075794067,-0.53838676,0.15273425,0.23953375,-2.8442426,-0.26141655,0.22563864,-0.050623365,0.4111855,0.49570832,-0.3738457,-0.073448494,-0.28493297,-0.13734953,0.5962137,-0.07151747,-0.09958601,0.30620435,0.02389573,0.31151563,0.46289062,-0.9065639,-0.31858668,0.55039406,0.022440318,0.09967924,-1.1120744,0.5559406,0.25948077,-0.38279706,0.63743263,0.39039108,0.077585086,0.16322541,0.9992845,0.08118264,-0.1617513,0.3074922,-0.2857733,0.85187906,-0.7250377,3.5042944,0.77650744,0.16413592,-0.16726154,-1.4636462,-0.4412511,-0.63733256,0.10408272,-0.23831688,0.08851506,0.73990184,-0.096626,0.41753775,-0.20487773,-0.046990667,0.36072174,0.66806465,-0.7569073,-0.25093508,-0.5795374,-0.13690126,-1.189812,0.033048086,-0.5929153,-0.26815084,0.1765342,0.03802216,-0.38272846,0.67374617,0.38944322,-0.1565519,0.51156306,0.19373533,-0.9435406,0.54020774,0.027762093,0.24504456,-0.64181584,-0.04204094,0.2758481,-1.0314045,-0.72918594,-1.2186835,0.7221617,-0.36470243,0.9672629,0.13541502,0.50830317,0.023835443,-0.18745871,-0.3383033,0.12023687,0.15969406,-0.21876669,0.7253539,1.0576615,0.4237394,-0.47650152,0.32211453,0.083432786,0.069934934,-0.8085586,0.06435256,0.17602192,-0.039966837,0.24010447,-0.13316232,0.22303203,0.52796304,0.6768544,0.59302485,0.38688087,-0.4586471,-0.065060586,0.71774936,-0.12584385,0.41185033,0.0708776,-0.1261149,-0.48134035,-0.81541646,0.15285543,0.38138154,0.21174821,-0.22079822,0.5404671,-0.08126009,0.10547837,-0.2401371,0.4182858,1.0970803,-0.56128204,1.0631293,-0.6638162,-0.65571004,0.012376749,0.14577255,-0.75433475,0.66407174,0.70264435,-0.19494727,-0.19042915,0.17650409,-0.20847164,-0.2560132,-0.7475933,-0.11126417,0.24301061,-0.6841192,0.53097945,-0.2898057,0.10670778,-0.14568146,0.6935986,-0.34658006,0.13065359,0.2517099,0.19808237,-0.3153771,-0.12708734,0.47654447,0.0869042,0.04092191,0.19993429,-0.87105477,-0.79062,0.8355483,0.21092996,-0.047519784,-0.51906854,-0.9517663,0.273183,0.6211344,1.0825151,1.9118965,1.4841917,-0.43470472,-0.36635676,0.82977426,0.5794749,-0.2555771,0.70599216,0.14583093,-0.1325478,0.080296084,-0.4744115,0.07951376,-0.7497217,0.73392886,0.40191352,1.9646676,0.2588841,0.110504374,-0.08636162,0.87072974,0.1501365,-0.26788825,-0.79724216,0.067200854,-0.69966537,0.58105534,0.12607366,-0.077538,1.212667,0.42051947,-0.16188793,0.1437979,-0.5819496,-0.40392965,0.16633272,0.32236013,-0.14690705,0.13084596,-0.5736723,-0.24654225,0.14357573,0.37475726,0.45638677,-0.08753868,-0.9819125,0.1976898,0.028372038,0.43911383,0.34976327,0.20039514,-0.51239896,0.06693272,-0.2623841,-0.45325512,-0.35234824,0.26692316,0.18637842,-0.5772854,-0.71231246,0.3797984,1.3720794,0.038077947,-0.3432186,0.74015325,0.31146395,0.39275885,-0.5918054,0.09681791,-0.17299807,0.3406461,-0.64179546,-0.96076673,0.7313476,0.0023032576,-0.39269483,0.3339651,-1.4849094,0.3404563,0.5906305,-0.3442044,0.6612878,-0.08508055,0.7804805,0.3143294,-0.53212667,-1.755662,0.053723373,-0.53782845,0.39499044,-0.27791882,-0.37472492,0.4836799,-0.28979433,-0.24705568,-0.38160074,0.90747035,0.19730762,0.20402092,-1.0241884,-0.08153511,0.68996537,-0.6448057,-0.1285974,-0.05954644,-0.97361445,-0.06806494,-0.026371792,0.91521025,-0.14734727,1.1226751,0.57747316,0.13771881,-0.42441076,-0.7783487,0.7117959,0.49975145,-0.48062387,0.8300459,0.17829219,-0.40308544,0.020761583,0.5474518,-0.82548386,0.31755164,-0.4372346,1.2565341,-0.044650998,-0.38833773,-0.43748158,-0.024041237,0.15727042,0.75152403,-0.039915826,-0.38975617,-0.16449648,-0.07782122,0.20909615,0.10419526,0.23382473,-0.103206426,0.44081077,0.35875034,0.15504459,0.7059182,-0.2589098,-0.32222104,0.019629635,-0.7773547,-1.5706775,-0.8220509],"result":{"type":"object","properties":{"analysis":{"description":"Contains various technical analysis indicators and booleans describing the trend.","properties":{"aboveSma20":{"type":"boolean"},"aboveSma200":{"type":"boolean"},"aboveSma50":{"type":"boolean"},"adrPercent":{"type":"number"},"atr":{"type":"number"},"avg20dVolume":{"type":"number"},"latestClose":{"type":"number"},"macdBullish":{"type":"boolean"},"rsi":{"type":"number"},"sma20OverSma50":{"type":"boolean"},"sma50OverSma200":{"type":"boolean"}},"required":["latestClose"],"type":"object"}},"required":["analysis"]},"sql_tables":[],"sql_queries":[],"file_inbox":null,"oauth":null,"assets":null,"runner":"any","operating_system":["linux","macos","windows"],"tool_set":""},false]} \ No newline at end of file diff --git a/tools/stock-technical-analysis/metadata.json b/tools/stock-technical-analysis/metadata.json index d9eeb62c..5d289005 100644 --- a/tools/stock-technical-analysis/metadata.json +++ b/tools/stock-technical-analysis/metadata.json @@ -5,6 +5,9 @@ "description": "Fetches historical stock data from Tiingo and calculates basic technical indicators (SMA, RSI, MACD, ATR, etc.), then returns a structured analysis of the trend.", "author": "Shinkai", "keywords": ["stock", "analysis", "technical-indicators", "tiingo"], + "runner": "any", + "operating_system": ["linux", "macos", "windows"], + "tool_set": "", "configurations": { "type": "object", "properties": { diff --git a/tools/system-hw-info/.tool-dump.test.json b/tools/system-hw-info/.tool-dump.test.json new file mode 100644 index 00000000..9b4bf1a9 --- /dev/null +++ b/tools/system-hw-info/.tool-dump.test.json @@ -0,0 +1 @@ +{"type":"Python","content":[{"version":"1.0.0","name":"System Hardware Info","homepage":null,"author":"@@official.shinkai","py_code":"# /// script\n# dependencies = [\n# \"psutil>=5.9.0\"\n# ]\n# ///\nimport psutil\nimport platform\nfrom typing import List, Optional\nimport subprocess\nimport json\n\nclass CONFIG:\n pass\n\nclass INPUTS:\n pass\n\nclass OUTPUT:\n cpu_info: dict\n memory_info: dict\n disk_info: dict\n gpu_info: List[dict]\n system_info: dict\n\ndef get_mac_model() -> str:\n try:\n result = subprocess.run(['sysctl', 'hw.model'], capture_output=True, text=True)\n if result.returncode == 0:\n return result.stdout.split(':')[1].strip()\n except:\n pass\n return \"Unknown Mac Model\"\n\ndef get_gpu_info() -> List[dict]:\n \"\"\"Get GPU information based on the current platform.\"\"\"\n try:\n system = platform.system().lower()\n if system == \"darwin\":\n # macOS - use system_profiler\n try:\n result = subprocess.run(\n ['system_profiler', 'SPDisplaysDataType', '-json'],\n capture_output=True,\n text=True\n )\n if result.returncode == 0:\n data = json.loads(result.stdout)\n gpu_info = []\n for gpu in data.get('SPDisplaysDataType', []):\n gpu_info.append({\n \"name\": gpu.get('sppci_model', 'Unknown GPU'),\n \"vendor\": gpu.get('sppci_vendor', 'Unknown'),\n \"memory_total\": gpu.get('spdisplays_vram', 'Unknown'),\n \"metal_supported\": gpu.get('sppci_metal', 'Unknown'),\n \"displays\": gpu.get('spdisplays_ndrvs', [])\n })\n return gpu_info\n except:\n pass\n elif system == \"linux\":\n # Linux - use lspci\n try:\n result = subprocess.run(\n ['lspci', '-v', '-mm'],\n capture_output=True,\n text=True\n )\n if result.returncode == 0:\n gpu_info = []\n for line in result.stdout.split('\\n'):\n if 'VGA' in line or '3D' in line:\n parts = line.split('\"')\n if len(parts) > 3:\n gpu_info.append({\n \"name\": parts[3],\n \"vendor\": parts[1],\n \"type\": \"Discrete\" if '3D' in line else \"Integrated\"\n })\n return gpu_info\n except:\n pass\n elif system == \"windows\":\n # Windows - use wmic\n try:\n result = subprocess.run(\n ['wmic', 'path', 'win32_VideoController', 'get', '/format:csv'],\n capture_output=True,\n text=True\n )\n if result.returncode == 0:\n gpu_info = []\n lines = result.stdout.strip().split('\\n')[1:] # Skip header\n for line in lines:\n if line.strip():\n parts = line.split(',')\n if len(parts) > 2:\n gpu_info.append({\n \"name\": parts[1],\n \"driver_version\": parts[2],\n \"video_memory\": parts[3] if len(parts) > 3 else \"Unknown\"\n })\n return gpu_info\n except:\n pass\n\n except Exception as e:\n pass\n\n # Fallback when no GPU info could be retrieved\n return [{\"name\": \"Integrated Graphics\", \"details\": \"No GPU information available\"}]\n\ndef run(c: CONFIG, p: INPUTS) -> OUTPUT:\n \"\"\"\n Get detailed system hardware information using psutil and platform.\n \n Args:\n c: Configuration object\n p: Input parameters\n \n Returns:\n OUTPUT: A dictionary containing detailed system hardware information\n \"\"\"\n try:\n # CPU Information\n cpu_freq = psutil.cpu_freq()\n cpu_info = {\n \"physical_cores\": psutil.cpu_count(logical=False),\n \"logical_cores\": psutil.cpu_count(logical=True),\n \"frequency\": {\n \"current_mhz\": cpu_freq.current if cpu_freq else None,\n \"min_mhz\": cpu_freq.min if cpu_freq else None,\n \"max_mhz\": cpu_freq.max if cpu_freq else None\n },\n \"architecture\": platform.machine(),\n \"processor_brand\": platform.processor() or \"Unknown\",\n \"cpu_usage_percent\": psutil.cpu_percent(interval=1)\n }\n\n # Memory Information\n memory = psutil.virtual_memory()\n swap = psutil.swap_memory()\n memory_info = {\n \"total_bytes\": memory.total,\n \"available_bytes\": memory.available,\n \"used_bytes\": memory.used,\n \"percent_used\": memory.percent,\n \"swap\": {\n \"total_bytes\": swap.total,\n \"used_bytes\": swap.used,\n \"free_bytes\": swap.free,\n \"percent_used\": swap.percent\n }\n }\n\n # Disk Information\n disk = psutil.disk_usage('/')\n disk_info = {\n \"total_bytes\": disk.total,\n \"used_bytes\": disk.used,\n \"free_bytes\": disk.free,\n \"percent_used\": disk.percent,\n \"file_system_type\": \"Unknown\" # This could be enhanced for specific OS\n }\n\n # GPU Information using platform-specific approach\n gpu_info = get_gpu_info()\n\n # System Information\n system_info = {\n \"os_name\": platform.system(),\n \"os_version\": platform.version(),\n \"os_release\": platform.release(),\n \"computer_name\": platform.node(),\n \"machine_type\": \"Unknown\",\n \"boot_time\": psutil.boot_time()\n }\n\n # Add Mac-specific information if on macOS\n if platform.system() == \"Darwin\":\n system_info[\"machine_type\"] = get_mac_model()\n\n output = OUTPUT()\n output.cpu_info = cpu_info\n output.memory_info = memory_info\n output.disk_info = disk_info\n output.gpu_info = gpu_info\n output.system_info = system_info\n return output\n\n except Exception as e:\n raise Exception(f\"Failed to gather system hardware information: {str(e)}\")\n","tools":[],"config":[],"description":"Get detailed system hardware information including CPU, RAM, and disk details","keywords":["system","hardware","cpu","memory","disk","diagnostics"],"input_args":{"type":"object","properties":{},"required":[]},"output_arg":{"json":""},"activated":false,"embedding":[0.055605546,-0.049887806,-0.15750727,-0.16333967,-0.1813819,-0.16777271,-0.5365589,-0.49594852,-0.44971868,0.38191944,-0.5134891,1.2369579,0.16712795,-0.24370646,0.21676423,-0.3557284,-0.1024355,-0.34365323,-0.9195013,-0.20620269,0.19391257,0.31792158,0.076537654,0.10659312,0.24077764,0.11353676,-0.32671613,-0.2304202,-1.2077574,-2.5313873,0.36516124,0.08394683,-0.4788739,-0.242925,0.14710993,-0.4913252,0.07542655,0.37929934,-0.76389855,-0.006646082,-0.32640964,0.27611926,-0.03369279,0.06339094,0.23879308,0.38429675,0.048749946,-0.17815703,1.0090084,0.4543345,0.05717129,-0.2831624,-0.42817938,-0.4049426,-0.22179958,0.5831296,0.043898094,0.04254513,-0.52377796,-0.2583487,-0.26817593,0.42942187,-3.6695278,-0.58345544,0.3125718,0.36487576,0.5681713,0.03831657,-0.37418938,-0.6917854,-0.39857107,-0.016464917,-0.014596747,0.12411102,0.04246889,-0.15258168,0.45244354,0.20862082,0.14092621,-0.5747188,-0.0003542588,0.17017518,-0.24450268,-0.16753128,-0.66597354,0.31286836,-0.32003823,-0.08092521,0.36910796,0.04443816,-0.2050802,-0.6750594,0.36701852,-0.2934839,-0.7242625,0.16215383,-0.4199674,0.6799844,0.14206627,3.1220226,0.8806363,0.5432595,0.73173004,-0.6560101,0.7873979,0.037812516,0.23675774,0.051130176,-0.2839361,-0.07664954,0.2512827,0.23478074,-0.0047115833,0.7458963,0.55691934,0.3237804,-0.977978,-0.09081343,-0.36724356,0.07796888,-0.75424737,-0.02363547,-0.4588911,-0.078437015,-0.030389376,0.045428116,0.12715602,0.3016041,0.3354441,-0.29002857,0.4529642,-0.821802,-0.84231883,-0.03469444,-0.092644975,-0.05944071,0.6891126,0.12792912,0.094899476,-1.0182174,-0.23468885,-0.81007606,1.6024668,0.3392151,0.91069114,0.2098065,0.5836626,-0.029711299,-0.17305829,-0.40775016,-0.321474,0.23202348,0.32621107,0.46135354,0.64593434,-0.2667104,-0.011912663,-0.23338184,-0.59390616,0.35294187,-0.9531318,-0.34430638,0.40903887,-0.09535691,0.25498137,-0.11666235,0.30627698,-0.2877536,0.18243562,0.098708466,0.579509,0.111335285,0.4530225,0.06960732,0.1836347,0.24582066,-0.72729814,0.10129685,-0.18413302,-0.19898206,-0.18759866,0.44337276,0.06960571,-0.7319903,0.3928072,0.020927737,0.4549785,-0.08225522,0.47652265,1.4906886,-0.8396448,1.1488338,-1.1678962,-0.7148444,0.011619853,-0.25627053,-0.072362125,0.96246976,0.5442616,-0.0814441,-0.5567948,-0.08287587,0.13855945,0.028903734,-0.101065435,-0.282529,-0.23765302,-0.46097478,0.33259505,-0.63911283,0.8289467,-0.5203233,-0.10583258,0.9289261,0.0896068,-0.0074254684,0.3048304,0.3541855,0.00036318973,0.37062666,0.16623038,0.015890237,-0.17719871,-0.4541377,-0.83177197,-0.40496844,0.38014066,-0.2622049,-0.81531596,-0.02563512,-0.027263872,0.24817878,0.33341488,0.12507734,0.9123019,0.7707425,-0.08783289,0.29609835,-0.36231098,0.11184522,0.08847615,0.30018634,-0.29944834,-0.0895281,0.85659516,-0.42057735,-0.27743024,-0.016689539,-0.20465632,1.8406558,0.5640508,0.5860565,0.50957304,0.68995667,0.31094357,-0.64570177,-0.6961201,-0.68678254,-0.5140016,1.1093867,-0.19224605,-0.1343585,-0.19774246,0.524801,-0.24981785,0.011497106,-0.4162282,-0.4304645,-0.35949418,-0.18628252,0.32773897,0.7079946,-0.0022032633,0.050525904,-0.04192152,-0.585551,0.58189493,-0.08393455,-0.41855025,0.3081933,0.22935477,0.14311735,0.7384154,0.44533646,-0.9396684,-0.12865935,0.050986778,-0.31318548,-0.43762976,-0.31450766,-0.3484978,-0.5760082,-0.2934179,0.058263846,1.7703305,0.5726299,0.5053951,1.0279393,0.31156513,0.18071282,-0.7881688,0.23139873,-0.5117994,0.55835617,-0.65421456,-0.85392064,0.48265743,0.12766601,-0.7330871,0.48445404,-0.75831693,0.28885823,0.0699072,0.034261465,0.15580058,-0.5186455,0.45253786,0.8608346,-0.035466634,-2.4631789,-0.112001315,-0.10793241,0.5479332,0.126838,-0.5280898,0.73546606,0.057067916,-0.07860643,0.096696064,1.0262995,0.8728609,-0.13014056,-0.5663496,-0.26655802,0.5297792,0.19113164,0.5773077,-0.4323619,-1.2241217,-0.105883494,0.4345504,1.4592798,0.74876016,0.3216537,0.17036034,0.025876448,-0.61377096,-1.4611796,0.26082933,-0.28224343,-0.40922052,0.6073749,0.16204162,-0.40814558,0.031229671,0.7319421,-0.31180453,0.16239753,-0.20139053,1.2215911,-0.14757018,0.5294342,-0.28880155,0.8550843,0.26959562,-0.01324565,0.48405212,0.20343426,0.26246,-0.009267636,0.11954568,-0.33333126,0.19172598,0.50201607,0.90177953,0.13800228,-0.06889762,0.13441756,0.3349599,-0.3741935,0.79465896,-0.48201218,-0.9112213,0.008771792],"result":{"type":"object","properties":{"cpu_info":{"properties":{"architecture":{"type":"string"},"frequency_mhz":{"type":"number"},"logical_cores":{"type":"integer"},"physical_cores":{"type":"integer"}},"required":["physical_cores","logical_cores"],"type":"object"},"disk_info":{"properties":{"free_bytes":{"type":"integer"},"total_bytes":{"type":"integer"},"used_bytes":{"type":"integer"}},"required":["total_bytes","used_bytes","free_bytes"],"type":"object"},"memory_info":{"properties":{"available_bytes":{"type":"integer"},"total_bytes":{"type":"integer"},"used_bytes":{"type":"integer"}},"required":["total_bytes","used_bytes","available_bytes"],"type":"object"}},"required":["cpu_info","memory_info","disk_info"]},"sql_tables":[],"sql_queries":[],"file_inbox":null,"oauth":null,"assets":null,"runner":"any","operating_system":["linux","macos","windows"],"tool_set":""},false]} \ No newline at end of file diff --git a/tools/system-hw-info/metadata.json b/tools/system-hw-info/metadata.json index 4e2fa30c..7c62234b 100644 --- a/tools/system-hw-info/metadata.json +++ b/tools/system-hw-info/metadata.json @@ -11,6 +11,9 @@ "disk", "diagnostics" ], + "runner": "any", + "operating_system": ["linux", "macos", "windows"], + "tool_set": "", "configurations": [], "parameters": { "properties": {}, diff --git a/tools/text-to-audio-kokoro/.tool-dump.test.json b/tools/text-to-audio-kokoro/.tool-dump.test.json new file mode 100644 index 00000000..76fd6449 --- /dev/null +++ b/tools/text-to-audio-kokoro/.tool-dump.test.json @@ -0,0 +1 @@ +{"type":"Python","content":[{"version":"1.0.0","name":"Text to Audio","homepage":null,"author":"@@official.shinkai","py_code":"# /// script\n# dependencies = [\n# \"kokoro-onnx\",\n# \"soundfile\",\n# \"pathlib\",\n# \"requests\",\n# \"onnxruntime\",\n# \"numpy\"\n# ]\n# ///\n\nfrom kokoro_onnx import config, Kokoro\nfrom pathlib import Path\nimport soundfile as sf\nfrom typing import Optional, Dict, Any, List\nimport os\nimport requests\nimport onnxruntime as ort\nimport time\nimport numpy as np\nfrom shinkai_local_support import get_home_path\n\n# Configure Kokoro settings\nconfig.MAX_PHONEME_LENGTH = 128\n\n# URLs from the official kokoro-onnx repository\nMODEL_URL = \"https://github.com/thewh1teagle/kokoro-onnx/releases/download/model-files/kokoro-v0_19.onnx\"\nVOICES_URL = \"https://github.com/thewh1teagle/kokoro-onnx/releases/download/model-files/voices.bin\"\n\ndef download_file(url: str, local_path: str) -> None:\n print(f\"Downloading {url}...\")\n response = requests.get(url, stream=True)\n response.raise_for_status()\n total_size = int(response.headers.get('content-length', 0))\n block_size = 8192\n downloaded = 0\n start_time = time.time()\n \n with open(local_path, 'wb') as f:\n for chunk in response.iter_content(chunk_size=block_size):\n downloaded += len(chunk)\n f.write(chunk)\n # Show download progress\n if total_size > 0:\n progress = (downloaded / total_size) * 100\n elapsed = time.time() - start_time\n speed = downloaded / (1024 * 1024 * elapsed) if elapsed > 0 else 0 # MB/s\n print(f\"Download progress: {progress:.1f}% ({speed:.1f} MB/s)\", end='\\r')\n print(\"\\nDownload complete!\")\n\nclass CONFIG:\n model_path: str = \"kokoro-v0_19.onnx\"\n voices_path: str = \"voices.bin\"\n providers: Optional[List[str]] = None # ONNX providers (e.g. [\"CPUExecutionProvider\", \"CUDAExecutionProvider\"])\n\nclass INPUTS:\n text: str # The text to convert to audio\n voice: str = \"af_sky\" # Default voice from: af, af_bella, af_nicole, af_sarah, af_sky, am_adam, am_michael, bf_emma, bf_isabella, bm_george, bm_lewis\n language: str = \"en-gb\" # Currently only English is fully supported\n speed: float = 1.0 # Default speed\n output_format: str = \"wav\" # Default output format\n\nclass OUTPUT:\n output_file: str\n duration: float\n sample_rate: int\n chars_per_second: float\n\nasync def run(c: CONFIG, p: INPUTS) -> OUTPUT:\n # Validate input text\n if not p.text or p.text.strip() == \"\":\n raise ValueError(\"Text input cannot be empty\")\n\n # Get home path for file operations\n home_path = await get_home_path()\n model_path = os.path.join(home_path, c.model_path)\n voices_path = os.path.join(home_path, c.voices_path)\n \n # Download model and voices if not present\n if not Path(model_path).exists():\n print(f\"Downloading model from {MODEL_URL}...\")\n try:\n download_file(MODEL_URL, model_path)\n except requests.exceptions.RequestException as e:\n raise ValueError(f\"Failed to download model: {str(e)}\")\n \n if not Path(voices_path).exists():\n print(f\"Downloading voices from {VOICES_URL}...\")\n try:\n download_file(VOICES_URL, voices_path)\n except requests.exceptions.RequestException as e:\n raise ValueError(f\"Failed to download voices: {str(e)}\")\n\n # Initialize Kokoro\n if not (Path(model_path).exists() and Path(voices_path).exists()):\n raise ValueError(\"Model and voices files must be present in the specified paths\")\n \n kokoro = Kokoro(model_path, voices_path)\n \n # Set ONNX providers if specified\n if c.providers:\n available_providers = ort.get_available_providers()\n invalid_providers = [p for p in c.providers if p not in available_providers]\n if invalid_providers:\n raise ValueError(f\"Invalid ONNX providers: {', '.join(invalid_providers)}. Available providers: {', '.join(available_providers)}\")\n kokoro.sess.set_providers(c.providers)\n print(f\"Using ONNX providers: {', '.join(c.providers)}\")\n \n # Generate audio\n start_time = time.time()\n samples, sample_rate = kokoro.create(\n text=p.text,\n voice=p.voice,\n speed=p.speed,\n lang=p.language\n )\n end_time = time.time()\n \n # Create output filename and save audio\n output_file = os.path.join(home_path, f\"output.{p.output_format}\")\n sf.write(output_file, samples, sample_rate)\n \n # Calculate metrics\n duration = len(samples) / sample_rate\n chars_per_second = len(p.text) / (end_time - start_time)\n \n print(f\"Generated {len(p.text):,} characters in {end_time - start_time:.2f} seconds\")\n print(f\"Processing speed: {chars_per_second:.0f} characters per second\")\n print(f\"Audio duration: {duration:.2f} seconds\")\n print(f\"Output saved to: {output_file}\")\n \n # Prepare output\n output = OUTPUT()\n output.output_file = output_file\n output.duration = duration\n output.sample_rate = sample_rate\n output.chars_per_second = chars_per_second\n \n return output ","tools":[],"config":[{"BasicConfig":{"key_name":"model_path","description":"Path to the Kokoro model file","required":false,"type":null,"key_value":null}},{"BasicConfig":{"key_name":"voices_path","description":"Path to the voices configuration file","required":false,"type":null,"key_value":null}}],"description":"Converts text files (.txt or .md) to audio files using high-quality text-to-speech synthesis","keywords":["text-to-speech","audio","conversion","text","markdown"],"input_args":{"type":"object","properties":{"text":{"type":"string","description":"text to convert to audio"},"voice":{"type":"string","description":"Voice to use for synthesis"},"output_format":{"type":"string","description":"Output audio format"},"speed":{"type":"number","description":"Speech speed multiplier (0.5 to 2.0)"},"language":{"type":"string","description":"Language code for synthesis (e.g., en-gb, en-us, fr-fr)"}},"required":["text"]},"output_arg":{"json":""},"activated":false,"embedding":[0.26402932,0.12929861,-0.04934295,-0.56408525,-0.86314386,-0.14892748,-0.4547126,0.5975848,0.008750894,0.30703133,-0.22920701,0.9235221,-0.050935153,-0.31644323,-0.15162672,0.1297985,-0.16142587,-0.3695571,-1.5952017,-0.5663927,-0.05399374,1.1344832,0.42959756,0.16039914,0.8143867,0.13574305,0.031474937,0.015346646,-0.51679105,-1.5916522,0.18616083,0.3248546,0.5542324,0.19799492,0.18794276,-0.09860341,-0.61177254,-0.31120318,-0.70041525,-0.45601475,0.38518327,-0.0649303,-0.029466715,0.19359991,0.18683872,-0.31135964,0.43110538,-0.19308922,1.3445243,1.0634713,-0.76008284,-0.75662947,-0.4058456,0.08440742,-0.27230787,-0.025747135,0.43380716,0.1662749,0.07206522,0.08975864,-0.9205548,-0.28034085,-3.6316319,-0.59038717,0.78879464,0.22857806,0.32108617,-0.24858102,0.28225276,-0.69494456,0.25496584,0.23486246,-0.23164794,0.15010023,0.12644926,-1.2252448,-0.4284789,-0.37731022,0.8610194,-0.1412255,-0.27760696,0.48218945,-0.047222994,-0.4817743,-0.5915228,0.6672626,-0.80218387,-0.6497585,-0.028864048,-0.13638751,-0.20851135,-0.36551353,0.7297526,0.16370234,-0.050431423,0.35324323,0.14624746,-0.11142899,1.059916,3.0126367,1.0199155,0.27769583,0.14387172,-1.1086072,-0.883447,-0.26366755,-0.28970262,-0.065775424,0.39596263,-0.4861938,0.2732807,-0.76761866,-0.59740114,-0.32866997,0.2983726,0.38269454,-0.85166407,0.36987218,-0.23292823,0.4912111,-0.7431115,0.17989361,0.16139095,0.23585075,-0.31270137,-0.3946187,-0.4018266,0.25357464,0.27445173,0.19267069,0.9582027,0.047526676,-0.52929294,0.0018343832,0.41408107,0.22542277,0.63058484,-0.61169374,0.17575589,0.056141116,0.1414704,-1.7442956,1.1457528,0.33181053,0.91082853,0.5514428,-0.94848955,0.26183215,-0.65705645,-0.20449752,-0.03659283,0.42359912,0.0328549,-0.11429015,0.92984486,0.057898346,-0.23421083,-0.24943322,-0.5422546,0.45754516,-0.29545268,-0.21850663,0.20933643,0.07755938,0.13997652,0.14910156,0.35252428,0.1994023,0.42694196,0.39795613,-0.114237994,-0.54859793,0.37903744,0.8990463,-0.10609173,-0.20964472,-0.5794421,0.113387175,-0.2357598,-0.08463189,0.15229708,0.21009862,-0.45431617,-0.046354495,0.26904732,0.13618669,0.1585532,0.18884677,0.38243896,1.1637704,-0.07041428,1.959842,-1.1375408,-0.16357884,-0.020493759,-0.004782824,0.5268944,0.1856941,0.047811758,0.02376512,-0.07233285,0.31834716,-0.17999935,-0.069826454,-0.17271891,-0.6965978,-0.25670195,0.16947354,-0.12830637,-0.37489438,0.12756859,-0.07894465,0.5675237,0.11275206,-0.09619093,-0.44637972,-0.19879627,0.46190768,-0.5014298,0.59489,-0.30684525,-0.19851586,-0.18930095,-0.5688829,0.001784388,0.42033356,-0.32597303,-0.5643141,-0.27922985,-0.7807226,0.80040425,1.3314034,1.429468,0.95554024,0.89578456,0.3979981,0.4513066,-0.12601963,0.3248672,-0.25734377,0.41980803,0.7491796,0.48995787,-0.22649051,0.11212573,-0.99948716,-0.18833709,-0.112292916,-0.027789032,1.7698832,0.3308709,0.09255394,0.79541296,0.13259813,0.55258685,-0.29107785,-1.2877383,-0.6185007,-0.07108481,1.024279,0.20494059,0.13871634,0.09776159,0.6189639,0.46635947,-0.188906,-0.020210268,-0.5152122,0.07685933,-0.50392956,-0.13180584,-0.10680249,-0.3323958,-0.047499813,0.46457338,-0.073617235,0.3494338,-0.2466158,-0.161398,-0.812369,0.65440506,-0.15019684,0.5041151,0.047660097,-0.30143595,-0.4389102,-0.023299199,-0.38605973,-0.2192874,-0.08600203,-0.009365756,-0.7499151,-0.61319065,0.22021548,1.9482272,-0.124956384,-0.15361221,0.7503002,-0.21196166,0.05188393,-0.6788187,-0.01642802,-0.34528643,0.17381078,-0.171453,0.13117105,-0.1325164,-0.2340848,-0.064503215,1.1119817,0.11756965,-0.17284234,0.03436405,-0.13125505,0.6791746,-0.25553173,0.7228305,0.051233068,-0.23808783,-2.1117115,-0.5779933,0.1707299,0.14875528,-0.6514636,0.0033948068,0.48412824,-0.45757812,-0.14261219,-0.2973044,1.2852443,0.31189412,-0.21055226,-0.43436766,0.3029362,0.5976637,-0.0503571,0.22231798,-0.42897853,-0.88904965,-0.092665106,0.4977418,1.3534796,-0.07894117,0.7623016,0.11313234,-0.05428859,-0.71303713,-1.510541,0.45249906,-0.3646084,-0.601598,0.29300064,-0.2493334,0.51994747,-0.08107859,0.5539604,-0.36393788,-0.28209653,-0.6852269,2.0512543,0.11516261,-0.3810665,-0.51723033,0.27765435,0.0073038675,-0.30933744,0.515829,-0.9800994,0.08476859,0.21262014,0.45606807,-0.2384403,0.20486984,-0.25580144,0.87567616,0.4350404,0.17407647,0.7898179,0.28699213,0.4185474,0.41627556,-0.3037251,-0.46684527,-0.29180884],"result":{"type":"object","properties":{"duration":{"description":"Duration of the audio in seconds","type":"number"},"output_file":{"description":"Path to the generated audio file","type":"string"},"sample_rate":{"description":"Sample rate of the audio in Hz","type":"number"}},"required":["output_file","duration","sample_rate"]},"sql_tables":[],"sql_queries":[],"file_inbox":null,"oauth":null,"assets":null,"runner":"any","operating_system":["linux","macos","windows"],"tool_set":""},false]} \ No newline at end of file diff --git a/tools/text-to-audio-kokoro/metadata.json b/tools/text-to-audio-kokoro/metadata.json index a3075e17..d58a2d67 100644 --- a/tools/text-to-audio-kokoro/metadata.json +++ b/tools/text-to-audio-kokoro/metadata.json @@ -11,7 +11,10 @@ "text", "markdown" ], - "configurations": { + "runner": "any", + "operating_system": ["linux", "macos", "windows"], + "tool_set": "", + "configurations": { "properties": { "model_path": { "description": "Path to the Kokoro model file", diff --git a/tools/twitter-post/.tool-dump.test.json b/tools/twitter-post/.tool-dump.test.json index 572b02e7..7c099307 100644 --- a/tools/twitter-post/.tool-dump.test.json +++ b/tools/twitter-post/.tool-dump.test.json @@ -1 +1 @@ -{"type":"Deno","content":[{"name":"X/Twitter Post","homepage":null,"author":"@@official.shinkai","version":"1.0.0","js_code":"import { getAccessToken } from './shinkai-local-support.ts';\n\ntype CONFIG = {};\ntype INPUTS = {\n text: string;\n};\ntype OUTPUT = {\n};\n\nasync function postTweet(bearerToken: string, text: string) {\n try {\n const url = 'https://api.x.com/2/tweets';\n const response = await fetch(url, {\n method: 'POST',\n headers: {\n 'Authorization': `Bearer ${bearerToken}`,\n 'Content-Type': 'application/json'\n },\n body: JSON.stringify({\n text\n })\n });\n\n if (!response.ok) {\n throw new Error(`Server returned ${response.status} : ${response.statusText}`);\n }\n\n const data = await response.json();\n console.log('Tweet posted:', data);\n return data;\n } catch (error) {\n console.error('Error posting tweet:', error);\n throw error;\n }\n}\n\nexport async function run(config: CONFIG, inputs: INPUTS): Promise {\n const accessToken = await getAccessToken(\"twitter\");\n return await postTweet(accessToken, inputs.text) \n \n}\n","tools":[],"config":[],"description":"Function to post a tweet to Twitter.","keywords":["twitter","X","post","social media"],"input_args":{"type":"object","properties":{"text":{"type":"string","description":"Message to post"}},"required":[]},"output_arg":{"json":""},"activated":false,"embedding":[0.29419714,0.044715993,-0.08472824,-0.3596148,-0.36112997,0.15024751,-1.2623692,-0.121126145,0.77052677,-0.37017107,-0.16201174,0.31220248,-0.30055413,0.39176568,0.5124255,-0.26926005,0.15670618,-0.73046976,-2.2530584,0.3636606,-0.033898905,0.9498287,0.16001835,-0.06474072,-0.13535833,-0.71190935,0.5164653,-0.11643411,-1.2358605,-1.8434762,-0.11914357,0.57179314,-0.7578084,0.19929647,0.69374394,-0.022813234,-0.29951274,-0.21268031,-0.2013212,-0.009402297,-0.3158564,-0.36339867,-0.4879111,0.2831961,0.04024005,-0.5270208,-0.14752552,-0.011943791,0.3792737,0.40871114,-0.11643243,0.088049315,-0.1277782,0.4180324,-0.43636012,-0.38454044,-0.54683834,-0.78648657,-0.120501876,0.3359043,0.09091974,0.15050812,-4.006941,0.16425066,0.10323948,-0.25754064,-0.2151339,0.28914413,0.04182141,0.24908453,0.17105037,0.08708035,-0.66422164,0.06742294,0.21523958,-0.62386143,0.0935224,-0.25304973,0.53362113,0.18905556,0.5708722,0.56157213,0.048643753,0.45824477,-0.2087765,0.9702601,-0.09159906,-0.1590894,0.22805968,0.15716055,-0.34179744,0.063115366,0.594624,0.025454536,-0.4344561,-0.05217436,-0.1868218,0.34382558,-0.16016203,2.82865,0.43440056,-0.05800135,0.44138947,-0.32553622,-0.38936338,-0.6070375,-0.41922307,-0.3135796,0.108748645,-0.42694464,0.30626154,-0.10109474,-0.30872914,-0.15280795,0.1772417,-0.20734647,-0.3601042,0.52435243,0.12257256,0.81574327,-0.14413372,0.32579726,-1.0713991,-0.36330524,0.0457186,0.4830694,-0.71091473,0.08492307,0.13647038,-0.379717,0.93933016,-0.43009916,-0.41034737,-0.2428742,-0.12712874,0.3875908,-0.1668361,-0.63553226,0.22324881,-0.9516078,0.79902184,-1.7406433,0.80949867,0.19679123,0.5604219,0.4102943,-0.4029207,0.15223569,-0.23493396,0.23202801,0.22541264,0.014303759,0.21514738,0.116437525,0.9375549,0.05035751,-0.23672463,0.27270472,-0.24712498,0.29996613,-0.010596193,0.19327301,0.6766656,-0.5047528,0.19519088,-0.4474276,0.56735694,0.09896499,0.23621273,0.26490048,0.14887121,-0.34912395,-0.48643515,-0.23250854,-0.7485843,-0.137696,-0.18337977,-0.13316348,0.44284937,-0.20742796,-0.046476863,0.77154535,-0.5321926,0.014208667,0.012658723,0.26622802,0.42434698,-0.47068143,1.2717874,0.93188083,-0.18027046,1.7090449,-0.60502464,-0.36471626,-0.011204759,0.28025222,0.40935487,0.23459491,0.24156676,-0.3409424,-0.19756469,-0.3637474,0.18950611,-0.15835868,-0.54429823,0.12133555,0.6099043,0.15715697,-0.012424201,-0.29890603,0.30494294,-1.0671118,0.88555133,0.4495837,0.20615022,0.454822,-0.54320985,0.01971152,0.07012211,0.4699293,-0.36536208,0.8973122,-0.387295,-0.45881307,0.072395936,-0.33614922,-0.0725991,0.41578442,-0.06418067,-0.82547206,-0.21681076,0.8719808,0.22767767,1.4693404,0.71987325,0.2770809,-0.06354501,0.5963483,0.47952548,-0.49264014,0.011498023,0.44711232,-0.23695198,-0.15026173,0.22333407,-0.46678695,0.10244906,0.14141294,0.22144197,1.9264159,0.35488817,0.41005185,0.6202181,0.14869116,0.0139815435,-0.03291077,-2.1207616,-0.48612395,0.40433466,0.99482816,0.057316333,0.0039962977,0.75820124,-0.54542613,-0.39531094,-0.17068966,-0.20408405,-0.15370443,-0.110939845,-0.46126443,-0.81662947,0.7300637,0.11019997,-0.09730152,0.27788624,-0.14311525,-0.1176595,-0.13340983,-0.447568,-0.28585696,-0.47312766,0.06296199,0.40357333,0.056495488,-0.32727665,-0.54304916,-0.12912714,-0.18226904,0.50688875,-0.17452028,0.46717507,-0.5643217,-0.32895708,0.68992907,2.2128012,0.43460926,0.46618843,0.3944058,-0.00062801363,-0.21960413,-0.40231666,-0.13423616,-0.41995904,-0.591948,-0.9467548,-0.61205685,-0.019867279,-1.2693332,-0.07228962,-0.37074643,0.7909676,0.21913329,0.24579507,-0.21514991,0.64402825,-0.3345985,-0.38395765,0.31597155,0.16844665,-1.744025,0.4567633,0.48296988,-0.19717345,-0.22542816,0.022329276,0.18946815,0.014143743,0.874953,-0.39511406,1.6363496,0.3868573,-0.08653911,0.37638536,0.16625756,0.76850057,0.4763102,-0.18387854,-0.13253114,-1.3588253,-0.33952194,0.39177516,1.9236274,0.08391233,0.8615971,-0.035699055,-0.31430334,-0.3715813,-1.3998227,0.31499055,-0.46776152,-0.26938713,0.29946306,-0.30137652,-0.1607413,-0.1287726,1.0444766,0.16131504,-0.5219927,0.18575463,1.7399775,0.23048593,-0.14185868,-0.16977552,-0.0639839,-0.1788536,0.073234275,-0.29821315,-0.7691495,-0.4397285,0.5939721,0.4550734,-0.30991054,-0.35431036,0.2671051,0.33360326,0.23753506,0.32892624,0.90872693,0.5848144,0.29101217,0.6047823,0.17691815,-0.9592336,-0.30221337],"result":{"type":"object","properties":{"data":{"description":"The data returned by the Twitter API","type":"string"}},"required":["data"]},"sql_tables":[],"sql_queries":[],"file_inbox":null,"oauth":[{"name":"twitter","authorizationUrl":"https://twitter.com/i/oauth2/authorize","tokenUrl":"https://api.x.com/2/oauth2/token","clientId":"","clientSecret":"","redirectUrl":"https://secrets.shinkai.com/redirect","version":"2.0","responseType":"code","scopes":["tweet.read","tweet.write","users.read","offline.access"],"pkceType":"plain","refreshToken":"true"}],"assets":null},false]} +{"type":"Deno","content":[{"name":"X/Twitter Post","homepage":null,"author":"@@official.shinkai","version":"1.0.0","js_code":"import { getAccessToken } from './shinkai-local-support.ts';\n\ntype CONFIG = {};\ntype INPUTS = {\n text: string;\n};\ntype OUTPUT = {\n};\n\nasync function postTweet(bearerToken: string, text: string) {\n try {\n const url = 'https://api.x.com/2/tweets';\n const response = await fetch(url, {\n method: 'POST',\n headers: {\n 'Authorization': `Bearer ${bearerToken}`,\n 'Content-Type': 'application/json'\n },\n body: JSON.stringify({\n text\n })\n });\n\n if (!response.ok) {\n throw new Error(`Server returned ${response.status} : ${response.statusText}`);\n }\n\n const data = await response.json();\n console.log('Tweet posted:', data);\n return data;\n } catch (error) {\n console.error('Error posting tweet:', error);\n throw error;\n }\n}\n\nexport async function run(config: CONFIG, inputs: INPUTS): Promise {\n const accessToken = await getAccessToken(\"twitter\");\n return await postTweet(accessToken, inputs.text) \n \n}\n","tools":[],"config":[],"description":"Function to post a tweet to Twitter.","keywords":["twitter","X","post","social media"],"input_args":{"type":"object","properties":{"text":{"type":"string","description":"Message to post"}},"required":[]},"output_arg":{"json":""},"activated":false,"embedding":[0.29419714,0.044715993,-0.08472824,-0.3596148,-0.36112997,0.15024751,-1.2623692,-0.121126145,0.77052677,-0.37017107,-0.16201174,0.31220248,-0.30055413,0.39176568,0.5124255,-0.26926005,0.15670618,-0.73046976,-2.2530584,0.3636606,-0.033898905,0.9498287,0.16001835,-0.06474072,-0.13535833,-0.71190935,0.5164653,-0.11643411,-1.2358605,-1.8434762,-0.11914357,0.57179314,-0.7578084,0.19929647,0.69374394,-0.022813234,-0.29951274,-0.21268031,-0.2013212,-0.009402297,-0.3158564,-0.36339867,-0.4879111,0.2831961,0.04024005,-0.5270208,-0.14752552,-0.011943791,0.3792737,0.40871114,-0.11643243,0.088049315,-0.1277782,0.4180324,-0.43636012,-0.38454044,-0.54683834,-0.78648657,-0.120501876,0.3359043,0.09091974,0.15050812,-4.006941,0.16425066,0.10323948,-0.25754064,-0.2151339,0.28914413,0.04182141,0.24908453,0.17105037,0.08708035,-0.66422164,0.06742294,0.21523958,-0.62386143,0.0935224,-0.25304973,0.53362113,0.18905556,0.5708722,0.56157213,0.048643753,0.45824477,-0.2087765,0.9702601,-0.09159906,-0.1590894,0.22805968,0.15716055,-0.34179744,0.063115366,0.594624,0.025454536,-0.4344561,-0.05217436,-0.1868218,0.34382558,-0.16016203,2.82865,0.43440056,-0.05800135,0.44138947,-0.32553622,-0.38936338,-0.6070375,-0.41922307,-0.3135796,0.108748645,-0.42694464,0.30626154,-0.10109474,-0.30872914,-0.15280795,0.1772417,-0.20734647,-0.3601042,0.52435243,0.12257256,0.81574327,-0.14413372,0.32579726,-1.0713991,-0.36330524,0.0457186,0.4830694,-0.71091473,0.08492307,0.13647038,-0.379717,0.93933016,-0.43009916,-0.41034737,-0.2428742,-0.12712874,0.3875908,-0.1668361,-0.63553226,0.22324881,-0.9516078,0.79902184,-1.7406433,0.80949867,0.19679123,0.5604219,0.4102943,-0.4029207,0.15223569,-0.23493396,0.23202801,0.22541264,0.014303759,0.21514738,0.116437525,0.9375549,0.05035751,-0.23672463,0.27270472,-0.24712498,0.29996613,-0.010596193,0.19327301,0.6766656,-0.5047528,0.19519088,-0.4474276,0.56735694,0.09896499,0.23621273,0.26490048,0.14887121,-0.34912395,-0.48643515,-0.23250854,-0.7485843,-0.137696,-0.18337977,-0.13316348,0.44284937,-0.20742796,-0.046476863,0.77154535,-0.5321926,0.014208667,0.012658723,0.26622802,0.42434698,-0.47068143,1.2717874,0.93188083,-0.18027046,1.7090449,-0.60502464,-0.36471626,-0.011204759,0.28025222,0.40935487,0.23459491,0.24156676,-0.3409424,-0.19756469,-0.3637474,0.18950611,-0.15835868,-0.54429823,0.12133555,0.6099043,0.15715697,-0.012424201,-0.29890603,0.30494294,-1.0671118,0.88555133,0.4495837,0.20615022,0.454822,-0.54320985,0.01971152,0.07012211,0.4699293,-0.36536208,0.8973122,-0.387295,-0.45881307,0.072395936,-0.33614922,-0.0725991,0.41578442,-0.06418067,-0.82547206,-0.21681076,0.8719808,0.22767767,1.4693404,0.71987325,0.2770809,-0.06354501,0.5963483,0.47952548,-0.49264014,0.011498023,0.44711232,-0.23695198,-0.15026173,0.22333407,-0.46678695,0.10244906,0.14141294,0.22144197,1.9264159,0.35488817,0.41005185,0.6202181,0.14869116,0.0139815435,-0.03291077,-2.1207616,-0.48612395,0.40433466,0.99482816,0.057316333,0.0039962977,0.75820124,-0.54542613,-0.39531094,-0.17068966,-0.20408405,-0.15370443,-0.110939845,-0.46126443,-0.81662947,0.7300637,0.11019997,-0.09730152,0.27788624,-0.14311525,-0.1176595,-0.13340983,-0.447568,-0.28585696,-0.47312766,0.06296199,0.40357333,0.056495488,-0.32727665,-0.54304916,-0.12912714,-0.18226904,0.50688875,-0.17452028,0.46717507,-0.5643217,-0.32895708,0.68992907,2.2128012,0.43460926,0.46618843,0.3944058,-0.00062801363,-0.21960413,-0.40231666,-0.13423616,-0.41995904,-0.591948,-0.9467548,-0.61205685,-0.019867279,-1.2693332,-0.07228962,-0.37074643,0.7909676,0.21913329,0.24579507,-0.21514991,0.64402825,-0.3345985,-0.38395765,0.31597155,0.16844665,-1.744025,0.4567633,0.48296988,-0.19717345,-0.22542816,0.022329276,0.18946815,0.014143743,0.874953,-0.39511406,1.6363496,0.3868573,-0.08653911,0.37638536,0.16625756,0.76850057,0.4763102,-0.18387854,-0.13253114,-1.3588253,-0.33952194,0.39177516,1.9236274,0.08391233,0.8615971,-0.035699055,-0.31430334,-0.3715813,-1.3998227,0.31499055,-0.46776152,-0.26938713,0.29946306,-0.30137652,-0.1607413,-0.1287726,1.0444766,0.16131504,-0.5219927,0.18575463,1.7399775,0.23048593,-0.14185868,-0.16977552,-0.0639839,-0.1788536,0.073234275,-0.29821315,-0.7691495,-0.4397285,0.5939721,0.4550734,-0.30991054,-0.35431036,0.2671051,0.33360326,0.23753506,0.32892624,0.90872693,0.5848144,0.29101217,0.6047823,0.17691815,-0.9592336,-0.30221337],"result":{"type":"object","properties":{"data":{"description":"The data returned by the Twitter API","type":"string"}},"required":["data"]},"sql_tables":[],"sql_queries":[],"file_inbox":null,"oauth":[{"name":"twitter","authorizationUrl":"https://twitter.com/i/oauth2/authorize","tokenUrl":"https://api.x.com/2/oauth2/token","clientId":"","clientSecret":"","redirectUrl":"https://secrets.shinkai.com/redirect","version":"2.0","responseType":"code","scopes":["tweet.read","tweet.write","users.read","offline.access"],"pkceType":"plain","refreshToken":"true","requestTokenAuthHeader":null,"requestTokenContentType":null}],"assets":null,"runner":"any","operating_system":["linux","macos","windows"],"tool_set":""},false]} \ No newline at end of file diff --git a/tools/twitter-post/metadata.json b/tools/twitter-post/metadata.json index c5b8f92a..0025175c 100644 --- a/tools/twitter-post/metadata.json +++ b/tools/twitter-post/metadata.json @@ -11,7 +11,10 @@ "post", "social media" ], - "configurations": { + "runner": "any", + "operating_system": ["linux", "macos", "windows"], + "tool_set": "", + "configurations": { "type": "object", "properties": {}, "required": [] diff --git a/tools/webcam-capture/.tool-dump.test.json b/tools/webcam-capture/.tool-dump.test.json new file mode 100644 index 00000000..fe1b6c5a --- /dev/null +++ b/tools/webcam-capture/.tool-dump.test.json @@ -0,0 +1 @@ +{"type":"Python","content":[{"version":"1.0.0","name":"Webcam Capture Tool","homepage":null,"author":"@@official.shinkai","py_code":"# /// script\n# dependencies = [\n# \"requests\",\n# \"numpy==1.26.4\",\n# \"opencv-python==4.8.0.76\"\n# ]\n# ///\n\nimport cv2\nimport time\nimport base64\nimport numpy as np\nimport os\nimport platform\nfrom typing import Dict, Any, Optional, List\nfrom shinkai_local_support import get_home_path\n\nclass CONFIG:\n cameraIndex: Optional[int]\n format: Optional[str]\n\nclass INPUTS:\n width: Optional[int]\n height: Optional[int]\n\nclass OUTPUT:\n imagePath: str\n width: int\n height: int\n\nasync def run(config: CONFIG, inputs: INPUTS) -> OUTPUT:\n \"\"\"\n Captures a single frame from a local webcam and saves it to disk.\n \n Args:\n config: Configuration with camera index and output format\n inputs: Input parameters with width and height\n Returns:\n OUTPUT object with image path and dimensions\n \"\"\"\n # Set defaults\n camera_index = getattr(config, 'cameraIndex', 0)\n img_format = getattr(config, 'format', 'png').lower()\n if img_format not in ('png', 'jpeg', 'jpg'):\n img_format = 'png'\n\n width = getattr(inputs, 'width', 640)\n height = getattr(inputs, 'height', 480)\n\n # Determine camera source based on platform\n if platform.system() == 'Darwin': # macOS\n camera_source = camera_index\n else: # Linux, Windows\n camera_source = camera_index\n\n # Open the camera\n cap = cv2.VideoCapture(camera_source)\n if not cap.isOpened():\n raise RuntimeError(f\"Failed to open webcam (index={camera_index}). Please check if the camera is connected and accessible.\")\n\n try:\n # Set resolution\n cap.set(cv2.CAP_PROP_FRAME_WIDTH, width)\n cap.set(cv2.CAP_PROP_FRAME_HEIGHT, height)\n\n # Let the camera warm up and auto-adjust: grab/discard extra frames\n for _ in range(15):\n _, _ = cap.read()\n \n # Wait a moment so the auto-exposure has time to adapt\n time.sleep(0.5)\n\n # Try to capture the final frame\n ret, frame = cap.read()\n if not ret or frame is None:\n raise RuntimeError(\"Failed to capture frame from webcam. Please check camera permissions and settings.\")\n\n # Optional gamma correction for better brightness\n gamma = 1.2 # Adjust this value if needed (>1 brightens, <1 darkens)\n look_up_table = np.array([((i / 255.0) ** (1.0/gamma)) * 255 for i in range(256)]).astype(\"uint8\")\n frame = cv2.LUT(frame, look_up_table)\n\n # Get final dimensions\n final_height, final_width, _ = frame.shape\n\n # Get home path for writing file\n home_path = await get_home_path()\n \n # Create filename with timestamp\n timestamp = int(time.time())\n filename = f\"webcam_capture_{timestamp}.{img_format}\"\n file_path = os.path.join(home_path, filename)\n\n # Encode and write to file\n encode_param = [int(cv2.IMWRITE_JPEG_QUALITY), 95] if img_format.startswith('jp') else []\n result = cv2.imwrite(file_path, frame, encode_param)\n if not result:\n raise RuntimeError(\"Failed to write image to disk. Please check disk permissions and space.\")\n\n # Create output\n output = OUTPUT()\n output.imagePath = file_path\n output.width = final_width\n output.height = final_height\n\n return output\n\n finally:\n # Always release the camera\n cap.release() ","tools":[],"config":[{"BasicConfig":{"key_name":"cameraIndex","description":"Which camera index to capture from. 0 is the default. If you only have one camera, use 0.","required":false,"type":null,"key_value":null}},{"BasicConfig":{"key_name":"format","description":"Image format to return (png or jpeg)","required":false,"type":null,"key_value":null}}],"description":"Captures a single frame from a local webcam and returns it as a Base64-encoded image (PNG or JPEG). Example usage with Python + opencv.","keywords":["webcam","capture","camera","image","tools"],"input_args":{"type":"object","properties":{"height":{"type":"number","description":"Requested height of the capture in pixels"},"width":{"type":"number","description":"Requested width of the capture in pixels"}},"required":[]},"output_arg":{"json":""},"activated":false,"embedding":[0.27379712,0.26049376,-0.35230947,-0.29302117,-0.10621464,-0.5349654,-0.5417513,0.75517696,-0.4969945,0.65751183,-0.30789423,0.17433402,0.17636125,0.43575174,0.670568,0.054246552,0.63392746,0.08001973,-0.90647566,-0.5010661,-0.31318378,0.5481168,0.29406947,0.045135103,-0.017713305,0.02441874,-0.5796472,-0.5321064,-0.9252808,-1.4563847,0.54842556,0.30408326,0.8051824,0.20527339,0.24924281,-0.70230037,0.60842115,0.13760853,-0.2861902,-0.15100609,0.09125818,0.014103839,0.14343482,-0.39153197,0.40941218,0.651247,1.095278,-0.11444907,1.3199065,-0.15644415,-0.8997617,-0.24239947,-0.46697405,-0.61595654,-0.35921368,0.25168264,-0.11143559,-0.7198767,0.042329393,-0.08285898,-0.00532059,-0.21154407,-2.9567618,0.16712904,0.8210316,0.35551888,-0.34491628,-0.3170061,0.10614654,0.2635122,0.1151489,0.35600388,-0.8375333,-0.32915643,0.13519311,-0.61337113,0.5797042,0.5869707,0.6124079,-1.0568949,0.3867774,-0.16757318,0.13950638,-0.11240559,-0.6685093,0.082297936,-0.4506039,-0.04335735,0.58966136,-0.009433348,-0.15059039,-0.08294466,-0.2757996,0.014975268,-1.0442071,-0.62281525,-0.25277603,0.43496248,-0.0154063925,2.9209588,0.57331693,-0.07214462,0.61123854,-1.0820323,0.25136226,0.1686681,0.2629263,-0.16320927,0.18363082,-0.19563757,0.954813,-0.050496917,-0.42412755,-0.05876357,1.0565498,-0.090464056,-0.41057903,-0.22076195,-0.25075862,1.1598536,-0.743368,-0.049782854,-0.30236474,-0.5836887,0.2119485,0.24454819,0.36859792,0.4532916,0.12706575,-0.21152835,0.50551945,-0.089997604,-0.060434278,-0.57503414,0.22246948,0.25690472,-0.3215629,-0.8225809,0.2415621,-0.58153635,0.028594047,-1.2109997,0.80791783,0.33053765,0.23447874,0.6670909,0.10031499,0.6707828,-0.49925447,-0.6944068,-0.008140285,0.13783535,0.108010724,0.33131257,1.0665028,-0.14438477,0.033715107,-0.14159742,-0.54666185,0.5183314,-0.24491923,-0.21096443,-0.60805064,-0.021691576,0.33308408,-0.5941761,0.13776983,-0.15412426,0.36328432,-0.26274556,0.090080194,-0.3321152,0.15022735,-0.09582731,-1.4298995,-0.12416412,-0.54251754,0.48592874,0.10297927,0.24300686,0.6332004,0.91324735,-0.46285722,-0.30612358,-0.33837646,0.00401993,0.26125604,0.2592144,1.2777755,0.59866434,-0.33777264,1.739139,-0.8653948,-0.17962146,0.44914004,-0.37319738,0.27937937,0.7943685,-0.1551325,-0.32191116,-0.15361917,-1.1616547,-0.04915313,-0.3119635,0.14921468,-0.30471095,-0.063692294,0.34165403,-0.23200767,-0.8422212,-0.22974025,-0.06661685,-0.04186012,0.13493758,0.96198213,-0.4636491,-0.06392966,-0.06314513,-0.3667356,0.23913431,0.6735542,0.36499912,0.3559782,-0.705185,0.31587854,-0.011298001,-0.55594873,0.200905,-0.81285,-0.36030203,0.5969428,0.48363015,0.64647084,1.3645763,0.6813938,0.018577382,-0.5642861,0.4198122,-0.100470096,-0.3393436,0.39620128,0.44579488,-0.77883416,-0.17397654,-0.40010133,-1.1514727,0.70087624,-0.4031153,-0.45512664,1.9818423,1.0333647,0.34598285,0.035068817,0.5428559,-0.36247718,0.036625125,-1.8725324,-0.3322178,-0.58493096,0.6738018,0.34977716,0.3832899,0.36700675,0.8587282,-0.37349075,-0.2293991,-1.111259,-0.87323976,-0.3843486,-0.08909749,-0.028981008,0.9424894,0.27043724,0.078666516,0.04492036,0.28622568,1.1465281,0.92100906,-0.6324611,-0.35206804,0.13250948,0.65232915,0.4613898,0.3926838,-0.3684615,-0.60455006,-0.5061419,0.45636082,-0.011778243,0.6005505,-0.25148025,-0.57781523,-0.097161815,0.47526616,2.0038054,0.31181568,0.11255628,0.1600126,-0.47374743,0.5800327,-0.8149504,0.6540199,0.8139898,-0.38312215,-0.0020688623,-0.8017539,1.0972254,-0.09034964,-0.6409544,-0.31634173,-0.10896395,0.36052868,0.53231233,-0.19181669,0.47937512,-0.51685756,-0.07008293,0.45398462,0.21354121,-2.1508012,-0.83400667,0.1826936,-0.07116837,-0.35627174,0.03804703,-0.18172337,-0.05782173,-0.04144332,-0.029018663,0.7330189,-0.029208206,-0.85024726,-0.19102731,0.40377557,0.8024143,0.12593362,-0.0651922,-0.72072625,-0.5795112,0.19787373,0.03859528,0.4882542,-0.610349,-0.021640405,-0.38120666,-0.33003762,-0.35002232,-1.1554772,0.17159352,-0.16470388,-0.3393004,0.36039236,0.24422222,-0.23858413,0.65453523,0.027282,-0.6360172,-0.46574593,-0.7753507,1.7494171,-0.16738962,0.7876539,-0.60587233,-0.15467434,0.29196188,0.8074156,0.4726262,-0.8128184,0.61489314,0.5618386,0.2803262,-0.108210415,0.041652653,0.7103235,0.35145316,0.32308555,-0.31315604,0.8654865,0.8379306,0.5960117,0.22900537,0.5140022,-1.2085196,-0.36025023],"result":{"type":"object","properties":{"height":{"description":"Actual height of the returned frame","type":"number"},"imageBase64":{"description":"The captured image as a Base64-encoded string","type":"string"},"width":{"description":"Actual width of the returned frame","type":"number"}},"required":["imageBase64","width","height"]},"sql_tables":null,"sql_queries":null,"file_inbox":null,"oauth":null,"assets":null,"runner":"any","operating_system":["linux","macos","windows"],"tool_set":""},false]} \ No newline at end of file diff --git a/tools/webcam-capture/metadata.json b/tools/webcam-capture/metadata.json index 398204fc..a36b024f 100644 --- a/tools/webcam-capture/metadata.json +++ b/tools/webcam-capture/metadata.json @@ -11,6 +11,9 @@ "image", "tools" ], + "runner": "any", + "operating_system": ["linux", "macos", "windows"], + "tool_set": "", "configurations": { "type": "object", "properties": { diff --git a/tools/wikimedia-featured-content/.tool-dump.test.json b/tools/wikimedia-featured-content/.tool-dump.test.json new file mode 100644 index 00000000..14f14c8b --- /dev/null +++ b/tools/wikimedia-featured-content/.tool-dump.test.json @@ -0,0 +1 @@ +{"type":"Deno","content":[{"name":"Wikimedia Featured Content","homepage":null,"author":"@@official.shinkai","version":"1.0.0","js_code":"import axios from 'npm:axios';\n\ntype Configurations = {\n project?: string;\n language?: string;\n};\n\ntype Parameters = {\n date?: string;\n};\n\ntype Result = {\n featured: {\n tfa: {\n title: string;\n extract: string;\n url: string;\n };\n image: {\n title: string;\n description: string;\n url: string;\n };\n news: Array<{\n story: string;\n links: Array<{\n title: string;\n url: string;\n }>;\n }>;\n };\n};\n\nexport type Run, I extends Record, R extends Record> = (\n config: C,\n inputs: I\n) => Promise;\n\nexport const run: Run = async (\n configurations: Configurations,\n params: Parameters\n): Promise => {\n try {\n const project = configurations?.project || 'wikipedia';\n const language = configurations?.language || 'en';\n \n // Format date as YYYY/MM/DD\n let date: string;\n if (params.date) {\n const d = new Date(params.date);\n date = `${d.getFullYear()}/${String(d.getMonth() + 1).padStart(2, '0')}/${String(d.getDate()).padStart(2, '0')}`;\n } else {\n const d = new Date();\n date = `${d.getFullYear()}/${String(d.getMonth() + 1).padStart(2, '0')}/${String(d.getDate()).padStart(2, '0')}`;\n }\n \n const api_url = `https://api.wikimedia.org/feed/v1/${project}/${language}/featured/${date}`;\n \n const response = await axios.get(api_url, {\n headers: {\n 'User-Agent': 'ShinkaiWikimediaFeaturedContent/1.0',\n 'Accept': 'application/json',\n 'Api-User-Agent': 'ShinkaiWikimediaFeaturedContent/1.0 (https://github.com/dcSpark/shinkai-tools)'\n }\n });\n\n if (!response.data) {\n throw new Error('No data received from Wikimedia API');\n }\n\n const { tfa, image, news } = response.data;\n\n if (!tfa || !image) {\n throw new Error('Required data missing from API response');\n }\n\n return {\n featured: {\n tfa: {\n title: tfa.title,\n extract: tfa.extract || tfa.description || '',\n url: `https://${language}.${project}.org/wiki/${encodeURIComponent(tfa.title.replace(/ /g, '_'))}`\n },\n image: {\n title: image.title,\n description: image.description?.text || '',\n url: image.image?.source || image.thumbnail?.source || ''\n },\n news: (news || []).map((item: any) => ({\n story: item.story || '',\n links: (item.links || []).map((link: any) => ({\n title: link.title || '',\n url: `https://${language}.${project}.org/wiki/${encodeURIComponent((link.title || '').replace(/ /g, '_'))}`\n }))\n }))\n }\n };\n } catch (error) {\n if (axios.isAxiosError(error)) {\n if (error.response?.status === 404) {\n throw new Error(`No featured content found for the specified date`);\n }\n throw new Error(`Failed to fetch featured content: ${error.response?.data?.detail || error.response?.data?.message || error.message}`);\n }\n throw error;\n }\n};\n","tools":[],"config":[{"BasicConfig":{"key_name":"project","description":"Wikimedia project (e.g., wikipedia)","required":false,"type":null,"key_value":null}},{"BasicConfig":{"key_name":"language","description":"Language code (e.g., en)","required":false,"type":null,"key_value":null}}],"description":"Get featured content including article, image, and news from Wikimedia","keywords":["wikimedia","featured","wikipedia","content","articles","images","news"],"input_args":{"type":"object","properties":{"date":{"type":"string","description":"Date in YYYY-MM-DD format (defaults to current date)"}},"required":[]},"output_arg":{"json":""},"activated":false,"embedding":[0.16675086,0.8144579,-0.16748136,0.037891887,-0.3141715,0.22720867,-0.6816715,-0.8007469,0.12333938,0.21770854,-0.25175345,0.77049285,0.38809696,0.19412799,0.59354335,-0.14533478,0.073843166,-0.08011785,-1.6460447,-0.2912044,0.4361014,0.7255781,0.43672115,-0.014674753,-0.08817795,-0.18982302,-0.09654112,-0.3917516,-0.72681284,-2.1091,0.37167695,0.2109251,-0.23811585,-0.24934208,0.23690644,-0.7340729,-0.3732443,0.10646153,-0.45064694,-0.26875132,0.15045512,0.12741527,-0.249805,0.14467376,-0.18960969,0.106430046,-0.18242572,-0.48207328,0.22030939,0.45766056,-0.4984881,-0.00052660005,-0.26459026,0.47294292,-0.49364546,0.33075017,0.15058866,0.09543204,-0.05637357,0.5656337,0.19877885,0.8722137,-4.2568817,-0.0020928942,0.6745487,0.17408063,-0.18314894,-0.28469348,-0.15454692,0.18792528,0.3441159,0.36829418,-0.12232092,0.1475243,-0.25286123,-0.46488464,0.255456,0.28901297,-0.11783008,-0.4970502,-0.05022913,0.44294924,-0.16965806,-0.066998124,-0.18737951,0.6717926,-0.31954324,-0.33945218,0.25146788,0.0150491595,0.09173,-0.24134214,0.5141012,-0.34919673,-0.7942079,0.38652557,-0.0464655,0.44493425,0.5497125,3.7841482,0.46520966,0.0767995,0.5589016,-0.4334725,0.41110063,-0.42901686,-0.17450257,0.0073893424,-0.19795223,0.07279343,-0.0385577,-0.4339226,-0.0258912,-0.114955336,0.0608413,0.6796208,-0.82110447,0.060829878,-0.09370835,0.18652545,-0.31084645,0.16069657,-0.5492466,0.053795744,-0.07215279,-0.25534782,0.13743648,0.31799576,-0.12743066,0.0070119295,0.3828453,-0.12295896,-0.9652744,0.044220462,0.029013975,-0.011992216,0.24796641,-0.21212773,0.17174068,-1.0547926,0.17004952,-1.1998204,0.6679298,-0.044618018,0.87146086,0.27853954,-0.06838888,0.34388748,-0.68757915,0.02603688,-0.20307456,0.33221453,0.065542,0.41644388,0.87294966,-0.29967713,0.013933599,-0.033873603,-0.63595957,0.37278414,0.20151003,-0.41105518,0.7227926,0.4085136,0.38256115,-0.21926813,0.44732213,0.057600915,0.57988775,-0.2971436,0.11012999,-0.2698975,0.48128688,0.4939244,0.18646811,-0.06365979,-0.40071368,-0.046436064,0.4232772,-0.64784133,0.30989322,0.6330342,-0.15190922,-0.6978815,-0.017334811,0.08768722,0.23817343,0.16730887,0.34607458,0.7632251,-0.54999465,1.602841,-0.7657728,-0.58243805,0.24646458,-0.05850288,-0.39748096,0.34960938,0.571962,0.25593993,-0.21222517,-0.13681604,0.015438803,0.02172736,-0.33454722,-0.31291765,0.30532762,-0.19573188,-0.27912122,-0.47423312,-0.103348315,0.07673055,0.42903677,0.15427506,0.5751482,0.28951508,-0.017259799,0.08466026,0.2825715,0.8106978,0.048234142,0.22583511,-0.38302284,-0.7297015,-0.50852084,0.124397,-0.5841472,-0.403688,-0.46751985,-0.019115694,0.20343181,0.8137919,-0.12792659,0.85761416,0.64970094,0.28727925,-0.069242366,0.3905379,0.3790316,-0.774892,0.84422374,-0.15724237,-0.22228655,-0.052729215,0.2604552,-1.1058794,-0.20952581,0.13507724,-0.06435503,1.6728845,0.5560152,-0.22878551,0.23213731,0.16965038,0.26158822,0.3718572,-1.3436728,-0.23315758,-0.7514166,0.4353371,-0.06738968,-0.26710874,-0.18598306,0.04974166,0.19541103,-0.31653637,-0.19104196,0.0046374835,-0.07785384,-0.5568931,-0.028088141,0.6166169,-0.22278586,0.35592481,0.13305955,-0.17292336,0.087739855,-0.16880411,-0.3830777,0.2155229,0.4782549,-0.34862304,0.42105395,0.23994045,-0.6052512,-0.3484998,-0.3533819,0.08742971,-0.4078765,0.3631273,-0.06966683,-0.07327925,-0.049272086,-0.24700212,1.9824425,-0.08442472,0.51349664,0.49994946,0.056583982,0.16731462,-0.5585598,0.169287,-0.31540218,0.07394947,-0.8241025,-0.44951662,0.05505301,-0.10192336,-0.30662513,0.19609563,-0.22327885,0.07555087,0.09266569,-0.1144273,0.1124426,-0.60068256,-0.15556785,0.026013628,-0.06057895,-2.5655046,-0.112124644,0.3174737,0.29626828,-0.26193637,-0.5919783,0.4453125,0.07592292,-0.047813725,-0.45867735,1.2645607,0.13128757,-0.037913352,-0.40872356,0.5020281,0.4605692,0.14104767,-0.06139788,-0.09968347,-1.1778632,-0.26350558,0.44169787,1.5367143,0.45257935,0.6874109,-0.10154097,0.5994628,-0.8718549,-1.3259885,0.3048879,0.07826182,0.075331606,0.77010316,-0.22876869,-0.46958885,0.30517226,0.57818615,-0.18283775,0.18898532,-0.325872,1.8274779,-0.2796632,0.028966844,-0.14132774,0.48787996,0.30637056,0.2919857,0.28479472,-0.28839773,0.30376846,0.07440913,0.03165935,-0.31966767,0.25158936,0.28065348,0.26985914,-0.10036445,0.3439311,0.3698172,0.564516,0.07331267,-0.15876365,-0.16148663,-0.84873605,0.18958873],"result":{"type":"object","properties":{"featured":{"properties":{"image":{"properties":{"description":{"type":"string"},"title":{"type":"string"},"url":{"type":"string"}},"type":"object"},"news":{"items":{"properties":{"links":{"items":{"properties":{"title":{"type":"string"},"url":{"type":"string"}},"type":"object"},"type":"array"},"story":{"type":"string"}},"type":"object"},"type":"array"},"tfa":{"properties":{"extract":{"type":"string"},"title":{"type":"string"},"url":{"type":"string"}},"type":"object"}},"required":["tfa","image","news"],"type":"object"}},"required":["featured"]},"sql_tables":null,"sql_queries":null,"file_inbox":null,"oauth":null,"assets":null,"runner":"any","operating_system":["linux","macos","windows"],"tool_set":""},false]} \ No newline at end of file diff --git a/tools/wikimedia-featured-content/metadata.json b/tools/wikimedia-featured-content/metadata.json index 61442fce..ffd04c8f 100644 --- a/tools/wikimedia-featured-content/metadata.json +++ b/tools/wikimedia-featured-content/metadata.json @@ -13,6 +13,9 @@ "images", "news" ], + "runner": "any", + "operating_system": ["linux", "macos", "windows"], + "tool_set": "", "configurations": { "type": "object", "properties": { diff --git a/tools/wikimedia-historical-events/.tool-dump.test.json b/tools/wikimedia-historical-events/.tool-dump.test.json new file mode 100644 index 00000000..a8702547 --- /dev/null +++ b/tools/wikimedia-historical-events/.tool-dump.test.json @@ -0,0 +1 @@ +{"type":"Deno","content":[{"name":"Wikimedia Historical Events","homepage":null,"author":"@@official.shinkai","version":"1.0.0","js_code":"import axios from 'npm:axios';\n\ntype Configurations = {\n project?: string;\n language?: string;\n};\n\ntype Parameters = {\n date?: string;\n type?: 'all' | 'events' | 'births' | 'deaths' | 'holidays';\n};\n\ntype HistoricalEvent = {\n text: string;\n year: string;\n links: Array<{\n title: string;\n url: string;\n }>;\n};\n\ntype Result = {\n events: {\n selected_date: string;\n events?: HistoricalEvent[];\n births?: HistoricalEvent[];\n deaths?: HistoricalEvent[];\n holidays?: HistoricalEvent[];\n };\n};\n\nexport type Run, I extends Record, R extends Record> = (\n config: C,\n inputs: I\n) => Promise;\n\nexport const run: Run = async (\n configurations: Configurations,\n params: Parameters\n): Promise => {\n try {\n const project = configurations?.project || 'wikipedia';\n const language = configurations?.language || 'en';\n const type = params.type || 'all';\n\n // Parse and format the date\n let month: string;\n let day: string;\n \n if (params.date) {\n const d = new Date(params.date);\n month = String(d.getMonth() + 1).padStart(2, '0');\n day = String(d.getDate()).padStart(2, '0');\n } else {\n const d = new Date();\n month = String(d.getMonth() + 1).padStart(2, '0');\n day = String(d.getDate()).padStart(2, '0');\n }\n \n const api_url = `https://api.wikimedia.org/feed/v1/${project}/${language}/onthisday/${type}/${month}/${day}`;\n \n const response = await axios.get(api_url, {\n headers: {\n 'User-Agent': 'ShinkaiWikimediaHistoricalEvents/1.0',\n 'Accept': 'application/json',\n 'Api-User-Agent': 'ShinkaiWikimediaHistoricalEvents/1.0 (https://github.com/dcSpark/shinkai-tools)'\n }\n });\n\n if (!response.data) {\n throw new Error('No data received from Wikimedia API');\n }\n\n const formatEvents = (events: any[]): HistoricalEvent[] => {\n if (!Array.isArray(events)) return [];\n return events.map(event => ({\n text: event.text || '',\n year: (event.year || '').toString(),\n links: (event.pages || []).map((page: any) => ({\n title: page.title || '',\n url: `https://${language}.${project}.org/wiki/${encodeURIComponent((page.title || '').replace(/ /g, '_'))}`\n }))\n }));\n };\n\n const result: Result = {\n events: {\n selected_date: params.date || new Date().toISOString().split('T')[0]\n }\n };\n\n if (type === 'all' || type === 'events') {\n result.events.events = formatEvents(response.data.events || []);\n }\n if (type === 'all' || type === 'births') {\n result.events.births = formatEvents(response.data.births || []);\n }\n if (type === 'all' || type === 'deaths') {\n result.events.deaths = formatEvents(response.data.deaths || []);\n }\n if (type === 'all' || type === 'holidays') {\n result.events.holidays = formatEvents(response.data.holidays || []);\n }\n\n return result;\n } catch (error) {\n if (axios.isAxiosError(error)) {\n if (error.response?.status === 404) {\n throw new Error(`No historical events found for the specified date`);\n }\n throw new Error(`Failed to fetch historical events: ${error.response?.data?.detail || error.response?.data?.message || error.message}`);\n }\n throw error;\n }\n};\n","tools":[],"config":[{"BasicConfig":{"key_name":"project","description":"Wikimedia project (e.g., wikipedia)","required":false,"type":null,"key_value":null}},{"BasicConfig":{"key_name":"language","description":"Language code (e.g., en)","required":false,"type":null,"key_value":null}}],"description":"Get historical events, births, deaths, and holidays for a specific date from Wikimedia","keywords":["wikimedia","history","wikipedia","events","onthisday","births","deaths","holidays"],"input_args":{"type":"object","properties":{"type":{"type":"string","description":"Type of historical events to fetch"},"date":{"type":"string","description":"Date in YYYY-MM-DD format (defaults to current date)"}},"required":["date"]},"output_arg":{"json":""},"activated":false,"embedding":[0.29477566,1.0117412,-0.6202075,0.33376315,-0.053947765,0.026860818,-0.7377069,-0.83665925,-0.0083391545,0.21152529,-0.050255015,0.19754547,0.11389883,0.29904258,0.7206601,-0.13929889,-0.18974261,0.5583879,-2.0742545,-0.53405017,0.31613874,0.9952624,0.36226624,0.4072935,0.047490813,-0.28238907,0.23723325,0.0076690763,-0.35536587,-1.2460557,0.25809887,-0.13677913,-0.29751548,0.22460133,-0.55132973,-0.4764052,0.0740842,0.28027934,-0.547053,0.0073472485,0.010947501,0.75224847,-0.35693744,-0.046456896,-0.61046094,-0.12254664,-0.032141667,-0.112551436,0.6485661,0.21746376,-0.5990246,-0.11226589,-0.24446194,0.9714458,0.023190811,0.3176229,-0.34114015,-0.5569169,-0.06928834,0.7135792,0.17709301,0.56719947,-3.7487204,-0.346402,1.1632138,0.24779865,-0.54460776,0.036532998,-0.073308654,0.6950744,-0.12827049,0.18828039,-0.39869356,0.1984463,-0.21752939,-0.064215064,0.2564307,0.20429969,0.26964045,0.15495527,-0.29734108,0.17403953,-0.25948605,0.21273632,-0.18653774,0.44531113,-0.38593677,-0.9179365,0.2438529,-0.0997323,-0.24604091,-0.1451738,0.9071416,-0.2711481,-0.6468744,0.25917673,0.29248938,0.46530083,0.40955648,3.4130402,0.96754795,0.22244205,0.89022833,-0.62486297,0.2418699,-0.33229274,-0.4743039,0.47157764,-0.08925427,0.13062398,0.51162416,-0.50985,0.013539419,0.10933446,0.37858722,0.8475568,-1.2596233,0.22610304,-0.6138481,-0.19471326,-0.21473409,-0.09509528,-0.330506,-0.2895074,0.34833106,-0.5439288,0.16780028,0.16374253,0.29956388,0.15592936,0.7759392,-0.12635303,-1.1424092,0.22464111,-0.49537605,-0.14755073,-0.36021078,-0.5076206,0.085256375,-0.90573156,-0.12654144,-1.7803864,0.93296677,0.12655136,0.56710637,0.74162763,-0.048006162,0.19737107,-0.35088977,0.13064715,0.3242258,-0.28349093,0.16499493,0.31035763,0.9694436,-0.23188873,0.006918628,0.38422015,-0.49259317,0.40547425,0.36254546,-0.608237,0.8714352,1.0579768,-0.24505255,-0.46154276,0.36439615,-0.04357844,0.7487116,-0.39351475,-0.17529517,-0.5405585,0.082929365,0.44247603,0.33740374,-0.39592648,-0.22144964,0.26338115,0.07921827,-0.48362407,-0.50966406,0.57214695,-0.26593617,-0.2204454,0.22628878,0.3289189,0.47446752,-0.072958,0.71870166,0.9635633,-0.009858981,2.0289896,-1.1460365,-0.3719672,0.28224593,0.25991857,-0.25553408,0.762941,0.6692431,0.3010424,0.24542296,-0.14032331,-0.0767684,-0.23961216,0.34910405,-0.020811822,0.25731996,-0.31750098,-0.48987412,-0.6452316,-0.27868992,0.41374058,0.6923546,0.32530978,0.3119402,0.8311446,-0.3188554,-0.24442613,0.20762585,0.9292942,0.09861783,0.18418717,-0.08058,-0.35473832,-0.9561498,-0.21095224,-0.40426287,-0.30187857,-0.21492301,-0.36965844,0.38684344,0.25499392,-0.19325766,0.7801644,0.8890956,-0.12769043,-0.37916833,0.16884214,0.3725056,-1.1681494,0.4008138,0.39719677,-0.30598783,-0.20272866,-0.11661515,-0.46739423,-0.09115721,0.18050745,-0.19146813,1.1359091,0.70095235,-0.14120099,1.0695186,-0.19071013,0.12765187,0.018066272,-1.7488604,-0.46934587,-0.44843587,0.67678064,-0.033269342,-0.4783499,0.38784727,0.02124574,0.082841545,-0.19762932,-0.61520356,-0.3095666,-0.070339836,-0.2967236,-0.20020884,0.5344763,-0.98644507,0.5919833,0.08644708,-0.18205553,0.3410497,-0.13204768,-0.042063594,-0.06031043,0.09037822,-0.20997748,0.89006335,0.24648115,-0.55736226,-0.4361548,-0.046541125,-0.07478971,-0.61841166,0.29561564,0.009868167,-0.6799142,0.10463001,-0.11834662,2.5112002,-0.34806433,0.8324958,0.5985202,-0.041068513,-0.23404442,-0.6649902,0.42112932,-0.41404757,0.09283943,-0.7067113,-1.0304857,0.16087952,-0.32677585,-0.6452825,0.5044132,-0.74610406,0.4045321,0.4044429,0.07740794,0.07671584,-0.6653489,0.45753238,0.29275352,-0.31259254,-2.2841237,-0.077471815,0.47192615,1.0051943,-0.31114987,-0.35974672,0.14946698,-0.18537301,0.5167947,-0.123000346,1.3512139,-0.24913947,0.35187116,-0.7515323,0.215749,1.2699412,-0.326455,0.21986122,-0.30381182,-1.2911285,-0.11616714,0.43651372,1.0533602,0.06394059,0.7466477,-0.13617757,0.33043957,-0.35973483,-1.026798,-0.017833382,0.50770515,-0.16294797,0.21644449,-0.033723637,-0.2518713,-0.33467692,0.3329077,-0.26897788,0.21709424,-0.4207815,1.228497,-0.24345085,-0.2167775,-0.562665,-0.38310772,-0.045019835,0.0134707615,0.097178236,0.18405673,0.10180208,0.115881845,0.4167165,-0.6636583,0.30226228,0.08212201,0.21116894,0.23230423,0.2504466,0.5942035,1.1258624,-0.06751907,-0.30136758,0.04655915,-0.9318778,-0.8102241],"result":{"type":"object","properties":{"events":{"properties":{"births":{"$ref":"#/result/properties/events/properties/events"},"deaths":{"$ref":"#/result/properties/events/properties/events"},"events":{"items":{"properties":{"links":{"items":{"properties":{"title":{"type":"string"},"url":{"type":"string"}},"required":["title","url"],"type":"object"},"type":"array"},"required":["text","year","links"],"text":{"type":"string"},"year":{"type":"string"}},"type":"object"},"type":"array"},"holidays":{"$ref":"#/result/properties/events/properties/events"},"selected_date":{"type":"string"}},"required":["selected_date","events","births","deaths","holidays"],"type":"object"}},"required":["events"]},"sql_tables":null,"sql_queries":null,"file_inbox":null,"oauth":null,"assets":null,"runner":"any","operating_system":["linux","macos","windows"],"tool_set":""},false]} \ No newline at end of file diff --git a/tools/wikimedia-historical-events/metadata.json b/tools/wikimedia-historical-events/metadata.json index 6248d0ab..79866096 100644 --- a/tools/wikimedia-historical-events/metadata.json +++ b/tools/wikimedia-historical-events/metadata.json @@ -14,6 +14,9 @@ "deaths", "holidays" ], + "runner": "any", + "operating_system": ["linux", "macos", "windows"], + "tool_set": "", "configurations": { "type": "object", "properties": { diff --git a/tools/wikimedia-page-content/.tool-dump.test.json b/tools/wikimedia-page-content/.tool-dump.test.json new file mode 100644 index 00000000..217a9bfa --- /dev/null +++ b/tools/wikimedia-page-content/.tool-dump.test.json @@ -0,0 +1 @@ +{"type":"Deno","content":[{"name":"Wikimedia Page Content","homepage":null,"author":"@@official.shinkai","version":"1.0.0","js_code":"import axios from 'npm:axios';\n\ntype Configurations = {\n project?: string;\n language?: string;\n};\n\ntype Parameters = {\n title: string;\n};\n\ntype Result = {\n content: {\n title: string;\n html: string;\n url: string;\n lastModified: string;\n language: string;\n };\n};\n\nexport type Run, I extends Record, R extends Record> = (\n config: C,\n inputs: I\n) => Promise;\n\nexport const run: Run = async (\n configurations: Configurations,\n params: Parameters\n): Promise => {\n try {\n const project = configurations?.project || 'wikipedia';\n const language = configurations?.language || 'en';\n \n // Using the REST v1 API endpoint for page content\n const api_url = `https://${language}.${project}.org/api/rest_v1/page/html/${encodeURIComponent(params.title)}`;\n \n const response = await axios.get(api_url, {\n headers: {\n 'User-Agent': 'ShinkaiWikimediaPageContent/1.0',\n 'Accept': 'text/html; charset=utf-8',\n 'Api-User-Agent': 'ShinkaiWikimediaPageContent/1.0 (https://github.com/dcSpark/shinkai-tools)'\n }\n });\n\n if (!response.data) {\n throw new Error('No data received from Wikimedia API');\n }\n\n return {\n content: {\n title: params.title,\n html: response.data,\n url: `https://${language}.${project}.org/wiki/${encodeURIComponent(params.title.replace(/ /g, '_'))}`,\n lastModified: response.headers['last-modified'] || '',\n language: language\n }\n };\n } catch (error) {\n if (axios.isAxiosError(error)) {\n if (error.response?.status === 404) {\n throw new Error(`Page '${params.title}' not found`);\n }\n throw new Error(`Failed to fetch page content: ${error.response?.data?.detail || error.response?.data?.message || error.message}`);\n }\n throw error;\n }\n};\n","tools":[],"config":[{"BasicConfig":{"key_name":"project","description":"Wikimedia project (e.g., wikipedia)","required":false,"type":null,"key_value":null}},{"BasicConfig":{"key_name":"language","description":"Language code (e.g., en)","required":false,"type":null,"key_value":null}}],"description":"Fetch the full HTML content of a specific Wikimedia page","keywords":["wikimedia","content","wikipedia","page","html","article"],"input_args":{"type":"object","properties":{"title":{"type":"string","description":"Title of the page to fetch"}},"required":["title"]},"output_arg":{"json":""},"activated":false,"embedding":[0.22388592,0.53837246,-0.51374406,-0.13513592,0.041954752,0.51775724,-1.4870543,-0.25074282,0.6821066,0.10979077,0.014235243,0.6983222,0.27889884,-0.063917294,0.7412971,0.38115206,0.015189793,-0.43885332,-1.8273811,-0.3162225,-0.081844375,1.3889605,0.5812438,-0.04560881,-0.42400074,-0.12693317,-0.12065962,-0.6095281,-1.1817337,-1.6117735,0.44163546,0.23099026,-0.30508474,-0.3285995,0.22200269,0.009261034,-0.3200932,-0.012492254,-0.354924,-0.18894334,0.11532872,0.07137634,-0.37712693,0.040151916,-0.7412897,0.025937311,-0.20871429,-0.4136194,0.19584177,0.6007304,-0.38913903,-0.33135876,0.15463339,0.26053202,-0.50356615,0.37724468,-0.8827641,-0.12882645,-0.392073,0.4593474,0.16834544,0.74826145,-4.1181135,-0.28111076,0.6531607,0.21185204,-0.5517628,-0.585729,0.33224252,0.05536838,0.20596907,0.09412079,0.19486931,0.049128816,0.3236419,-0.8085487,0.6068119,0.06892656,-0.53378594,-0.7084924,-0.38246435,0.43265396,-0.21707506,0.35701385,-0.38389292,0.030728407,0.050446555,-0.7459149,0.3871579,0.034518443,-0.4380585,-0.5966642,0.58195174,-0.25090232,-1.0510256,-0.34019578,0.32009962,1.0308937,0.5665161,2.9511707,1.206941,0.31406522,0.09342544,-0.60354775,0.58448666,-0.2787535,0.11574504,0.31341177,0.42780215,-0.6194681,0.1945815,-0.63584816,0.091564976,-0.16738224,-0.033431537,-0.15314241,-1.073772,-0.39802924,0.23190135,0.5457856,-0.15529183,0.118276626,-0.60877824,-0.1260773,-0.085708335,0.07747999,-0.09203575,0.09444341,-0.07025805,0.3393959,0.46417257,-0.3382897,-1.2804232,0.57507974,-0.16436535,0.42433596,-0.03946738,0.13429074,0.27376434,-1.3031911,-0.06695628,-1.1868442,0.54391545,0.094169915,0.15438986,0.7867676,0.18660873,0.54528046,-0.76675874,0.09029276,0.3306786,-0.017074093,-0.18332346,0.028427757,0.46549362,-0.06450527,0.14487667,0.00017575175,-0.59645176,0.04260062,0.09623717,-0.5903165,0.49556252,0.28354087,0.064431876,-0.3585005,0.021852568,0.17860624,0.19677302,-0.117044345,0.46555054,-0.6354413,-0.1767371,0.32967728,0.54216504,-0.40467933,-0.85604,-0.007033922,-0.0016699582,-0.58684886,0.31914648,0.78328454,-0.018521313,-0.21896392,-0.1836684,0.12029196,0.57529324,-0.09441159,1.1309952,1.3549529,-0.02318751,1.9608611,-0.65022975,-0.73158115,0.27251127,-0.057663575,-0.32915556,0.3571871,0.5437368,0.14332314,0.060605563,-0.6234928,0.40483284,-0.094206885,-0.5174437,0.0737672,0.34801325,-0.5739474,-0.17450838,-0.75503224,-0.35336152,-0.35418838,0.5698035,0.041904747,0.27477401,-0.21819825,0.14452127,0.5580893,0.4824759,1.0739834,0.0721225,0.0436892,-0.38762295,-0.31378174,-0.86369944,0.08545274,-0.7641716,0.54145044,-0.5186946,-0.13136767,0.24095541,0.7303096,-0.0020206645,0.5912267,1.2665181,0.26003993,-0.924115,0.5870625,0.07821521,-0.02194189,0.86601806,-0.39538127,-0.13464591,-0.22417384,0.10047407,-0.8819455,-0.79023504,0.45100194,0.16859777,1.4487512,0.80665123,0.10428531,0.640437,0.3371976,0.20996228,0.66659325,-1.7022369,-0.16074274,-0.597254,0.6814186,-0.2711169,0.075165175,0.2936394,-0.70313436,0.29489422,-0.3683999,-0.040441163,-0.24271046,-0.46144044,0.21661025,-0.5348858,0.5816833,-0.1794146,0.13116649,0.054915056,-0.19577196,0.11211455,-0.27792504,-0.12591667,0.008320717,0.71427566,-0.20936431,0.4789635,0.22172584,-0.61783564,-0.16055806,-0.091944665,-0.053093098,-0.15083674,0.5115659,-0.13901743,-0.42650267,-0.08975139,0.1475523,1.4774462,-0.42884505,0.09692457,0.35858166,-0.0578156,0.22661261,-0.47473904,0.4480489,-0.29113775,0.029098693,-0.24000767,-0.414852,0.4946373,-0.32234406,-0.55274266,-0.00059562176,-0.6912524,0.32913145,0.20467815,0.29202282,0.34052047,-0.63322556,-0.6312823,0.092416376,0.13265549,-2.0222042,0.12261,0.44718242,0.15977398,-0.4432995,-0.85989493,0.8215406,0.18273789,-0.17765547,-0.30815774,1.3857554,0.33414894,-0.17472179,0.35424668,0.4834768,0.5516329,-0.2552133,-0.43318963,-0.17194232,-1.1785254,-0.003997431,0.5226675,1.2644289,0.13999367,0.99129206,0.31726483,0.36286303,-0.5634686,-1.6014398,-0.373379,0.15469496,0.54885954,1.0445418,-0.42671666,-0.23876512,0.67449105,-0.031467166,-0.39169505,-0.19529557,-0.5058422,2.2018414,-0.43857384,0.44075948,-0.60520303,-0.1857933,0.17270838,0.4735977,0.80521286,-0.10170939,0.618922,-0.43995634,0.48421136,-0.3959164,0.4580754,0.8942403,-0.034444213,0.012371272,0.84104574,0.47229773,0.784233,0.4139771,0.24558794,0.18497881,-0.33278486,0.33565697],"result":{"type":"object","properties":{"content":{"properties":{"html":{"type":"string"},"language":{"type":"string"},"lastModified":{"type":"string"},"title":{"type":"string"},"url":{"type":"string"}},"required":["title","html","url","lastModified","language"],"type":"object"}},"required":["content"]},"sql_tables":null,"sql_queries":null,"file_inbox":null,"oauth":null,"assets":null,"runner":"any","operating_system":["linux","macos","windows"],"tool_set":""},false]} \ No newline at end of file diff --git a/tools/wikimedia-page-content/metadata.json b/tools/wikimedia-page-content/metadata.json index 4f263b65..8e30b729 100644 --- a/tools/wikimedia-page-content/metadata.json +++ b/tools/wikimedia-page-content/metadata.json @@ -12,6 +12,9 @@ "html", "article" ], + "runner": "any", + "operating_system": ["linux", "macos", "windows"], + "tool_set": "", "configurations": { "type": "object", "properties": { diff --git a/tools/wikimedia-search-titles/.tool-dump.test.json b/tools/wikimedia-search-titles/.tool-dump.test.json new file mode 100644 index 00000000..edb80a5c --- /dev/null +++ b/tools/wikimedia-search-titles/.tool-dump.test.json @@ -0,0 +1 @@ +{"type":"Deno","content":[{"name":"Wikimedia Title Search","homepage":null,"author":"@@official.shinkai","version":"1.0.0","js_code":"import axios from 'npm:axios';\n\ntype Configurations = {\n project?: string;\n language?: string;\n};\n\ntype Parameters = {\n query: string;\n limit?: number;\n};\n\ntype Result = {\n titles: Array<{\n title: string;\n description: string;\n url: string;\n }>;\n};\n\nexport type Run, I extends Record, R extends Record> = (\n config: C,\n inputs: I\n) => Promise;\n\nexport const run: Run = async (\n configurations: Configurations,\n params: Parameters\n): Promise => {\n const project = configurations?.project || 'wikipedia';\n const language = configurations?.language || 'en';\n const limit = params.limit || 10;\n \n const api_url = `https://api.wikimedia.org/core/v1/${project}/${language}/search/title`;\n \n const response = await axios.get(api_url, {\n params: {\n q: params.query,\n limit: Math.min(Math.max(1, limit), 50)\n }\n });\n\n return {\n titles: response.data.pages.map((page: any) => ({\n title: page.title,\n description: page.description || '',\n url: `https://${language}.${project}.org/wiki/${encodeURIComponent(page.title.replace(/ /g, '_'))}`\n }))\n };\n};\n","tools":[],"config":[{"BasicConfig":{"key_name":"project","description":"Wikimedia project (e.g., wikipedia)","required":false,"type":null,"key_value":null}},{"BasicConfig":{"key_name":"language","description":"Language code (e.g., en)","required":false,"type":null,"key_value":null}}],"description":"Search Wikimedia pages by title with full-text search capabilities","keywords":["wikimedia","search","wikipedia","titles","pages","full-text"],"input_args":{"type":"object","properties":{"query":{"type":"string","description":"Search query for titles"},"limit":{"type":"integer","description":"Maximum number of results (1-50)"}},"required":["query"]},"output_arg":{"json":""},"activated":false,"embedding":[0.3697075,0.574768,-0.2189175,-0.40403202,-0.2633136,-0.066685386,-0.74338734,-0.43894023,0.1000307,-0.036042377,0.49315903,1.0118543,0.28158623,-0.42861795,0.61945635,0.22685295,-0.20757739,-0.0054380633,-1.7186434,0.074638665,0.34842083,1.168566,0.27329695,0.07151661,-0.09259574,-0.15395387,-0.4096073,-0.41104645,-1.206095,-2.002328,0.21533114,0.4791409,-0.05858206,-0.05861708,0.19918913,-0.068309784,-0.26313043,0.261678,-0.44981214,-0.4824496,-0.077526614,0.21525176,-0.46877685,0.60371524,-0.41395187,-0.28388345,-0.0057798577,-0.042865925,0.6210477,0.8630251,-0.6442773,-0.5044651,-0.07471195,0.81425023,-0.52768433,0.6058319,-0.43554598,0.16302207,-0.114781424,0.42920664,0.3896813,0.8224731,-4.3625736,-0.68029344,0.5925397,0.5714499,-0.05278528,-0.5351187,0.15730248,0.4302066,0.47277632,0.22037332,0.10323695,0.0037045255,-0.07789592,-0.852623,0.032534324,0.26322073,0.005892381,-0.18897255,-0.41114727,0.0988393,-0.49513027,0.07004509,-0.48016346,-0.087910384,-0.60296,-0.6537961,0.48233542,0.0251721,-0.353716,-0.53706574,0.15487897,0.08594646,-0.93194234,0.30919975,0.4175979,0.22542992,0.7187168,3.2511425,0.9734864,0.5903986,0.65647274,-0.71566397,0.17429587,0.02627284,0.12735741,0.06510035,0.3533033,-0.013355512,-0.019146562,-0.36702472,-0.21942794,-0.19008431,-0.2843727,0.19008242,-1.0925602,0.23095585,-0.009309443,0.4531836,-0.31810784,0.19363226,-0.41465625,0.272787,-0.34094688,-0.2577563,-0.23771325,0.07822806,0.27647287,0.379289,0.5118481,-0.013324555,-1.0993006,0.15818551,-0.3049244,0.4155011,-0.052077502,-0.20339851,0.20899808,-1.2617639,0.15687096,-1.5396488,1.2205269,0.36147144,0.8036173,0.5469522,0.2724927,0.19599439,-0.5886112,-0.21959588,0.23742725,-0.05217266,0.32929862,-0.04298867,0.6947076,-0.181227,-0.18338065,-0.11753671,-0.6476705,0.36760378,0.15212698,-0.34712222,0.91857886,0.6289409,0.20613894,-0.25666082,0.7248526,-0.15452245,0.05048123,0.11728981,-0.20319483,-0.62150675,0.5730605,0.7622036,-0.0016757068,-0.25346464,-0.47596142,0.111722596,-0.22634831,-0.8031151,0.23786215,0.42833185,-0.32792532,-0.45313466,-0.29004508,0.050102554,0.14175102,-0.09024487,0.5275228,0.854542,-0.35397503,1.6798731,-0.786698,-0.48482043,0.020079738,-0.03569405,-0.14005904,0.51132,0.33267727,-0.0611653,-0.022828482,-0.30721658,0.055643044,-0.28710917,-0.5992501,-0.22771552,0.30272353,-0.07762344,0.074366406,-0.3884885,-0.21996619,-0.3408621,0.6942586,0.059473734,0.55742633,0.06497507,0.17669475,0.3211,-0.037711732,1.1231989,-0.09796772,0.27987683,-0.6173424,-0.4679494,-0.68748796,-0.19506021,-0.49639043,0.043998115,-0.5420557,-0.034782354,0.12817807,0.90896034,-0.15452465,0.47505122,0.72785974,0.41461116,-0.4687755,0.3629534,0.34844738,-0.46876705,1.0284667,-0.38028058,-0.40277737,0.002287902,0.45549563,-1.0180595,-0.60918325,0.12664285,0.12867264,1.2219186,0.31147859,0.35833743,0.43009865,0.15525512,0.49164382,0.34928995,-1.4136319,0.17673019,-0.6219178,0.6221562,0.15481532,-0.24324977,0.32128918,-0.11195378,0.3270106,-0.50729954,0.07740891,-0.05061256,-0.14989564,-0.12625262,-0.342081,0.5892384,-0.3917871,0.25714254,0.4066918,-0.272788,-0.11102318,-0.13130328,-0.59331465,-0.32401106,0.28298342,-0.21592817,0.32013565,0.24392273,-0.82896566,0.01566219,-0.51360023,0.09736755,-0.43418306,0.279713,-0.35324523,-0.3700786,-0.108750865,0.45141152,1.5711088,-0.1677661,-0.108651474,1.0493387,0.10897482,0.21100809,-0.19806662,-0.35962588,-0.33683294,0.2923444,-0.46519807,-0.25474903,0.50362885,-0.1850227,-0.450068,0.51510525,-0.5125681,0.11398673,0.13096374,-0.33495227,0.5657977,-0.7514424,-0.06644596,0.14164267,0.18906802,-2.066051,-0.08576843,0.80007637,0.2197347,-0.45037395,-0.65538085,0.54277366,-0.08788025,0.13051654,-0.34977496,1.2393012,0.0304009,-0.08865206,-0.28031477,0.2144951,0.35234648,-0.18679984,0.032335203,-0.084195025,-1.3127319,-0.33060962,0.6323571,1.7073522,0.45836207,0.68210864,0.4263347,0.08620441,-0.7462416,-1.2637452,0.08854351,0.23018505,0.054673508,0.81520593,0.35159108,-0.4627567,0.6664523,0.21481106,-0.021527369,-0.088755086,0.018958416,2.1194746,-0.043993246,0.017765155,-0.76384664,0.09400755,0.27818012,0.38141912,0.1363195,-0.1937905,0.6772781,-0.39727265,0.15543015,-0.80699414,0.52418935,-0.085698366,-0.023259185,0.39453566,0.75088197,0.6725551,0.64223236,0.04062392,0.14775956,-0.20423865,-0.93622285,0.18466407],"result":{"type":"object","properties":{"titles":{"items":{"properties":{"description":{"type":"string"},"title":{"type":"string"},"url":{"type":"string"}},"required":["title","description","url"],"type":"object"},"type":"array"}},"required":["titles"]},"sql_tables":null,"sql_queries":null,"file_inbox":null,"oauth":null,"assets":null,"runner":"any","operating_system":["linux","macos","windows"],"tool_set":""},false]} \ No newline at end of file diff --git a/tools/wikimedia-search-titles/metadata.json b/tools/wikimedia-search-titles/metadata.json index 3f168522..21393d8c 100644 --- a/tools/wikimedia-search-titles/metadata.json +++ b/tools/wikimedia-search-titles/metadata.json @@ -12,6 +12,9 @@ "pages", "full-text" ], + "runner": "any", + "operating_system": ["linux", "macos", "windows"], + "tool_set": "", "configurations": { "type": "object", "properties": { diff --git a/tools/wikimedia-search/.tool-dump.test.json b/tools/wikimedia-search/.tool-dump.test.json new file mode 100644 index 00000000..7ba71824 --- /dev/null +++ b/tools/wikimedia-search/.tool-dump.test.json @@ -0,0 +1 @@ +{"type":"Deno","content":[{"name":"Wikimedia Search","homepage":null,"author":"@@official.shinkai","version":"1.0.0","js_code":"import axios from 'npm:axios';\n\ntype Configurations = {\n project?: string;\n language?: string;\n};\n\ntype Parameters = {\n query: string;\n limit?: number;\n};\n\ntype Result = {\n results: Array<{\n title: string;\n description: string;\n excerpt: string;\n }>;\n};\n\nexport type Run, I extends Record, R extends Record> = (\n config: C,\n inputs: I\n) => Promise;\n\nexport const run: Run = async (\n configurations: Configurations,\n params: Parameters\n): Promise => {\n const project = configurations?.project || 'wikipedia';\n const language = configurations?.language || 'en';\n const limit = params.limit || 10;\n \n const api_url = `https://api.wikimedia.org/core/v1/${project}/${language}/search/page`;\n \n const response = await axios.get(api_url, {\n params: {\n q: params.query,\n limit: Math.min(Math.max(1, limit), 50)\n }\n });\n\n return {\n results: response.data.pages.map((page: any) => ({\n title: page.title,\n description: page.description || '',\n excerpt: page.excerpt.replace(//g, '**')\n .replace(/<\\/span>/g, '**')\n }))\n };\n};\n","tools":[],"config":[{"BasicConfig":{"key_name":"project","description":"Wikimedia project (e.g., wikipedia)","required":false,"type":null,"key_value":null}},{"BasicConfig":{"key_name":"language","description":"Language code (e.g., en)","required":false,"type":null,"key_value":null}}],"description":"Search across Wikimedia page content with full-text search capabilities","keywords":["wikimedia","search","wikipedia","full-text","content"],"input_args":{"type":"object","properties":{"query":{"type":"string","description":"Search query"},"limit":{"type":"integer","description":"Maximum number of results (1-50)"}},"required":["query"]},"output_arg":{"json":""},"activated":false,"embedding":[0.2567247,0.6294004,-0.17981799,-0.14012544,-0.29903606,-0.07266275,-0.8029342,-0.39221883,0.40218437,-0.10328814,-0.008234659,0.96326894,0.24524619,-0.13874355,0.7967977,0.08959957,-0.037250366,-0.08318189,-1.6391385,-0.121976115,0.340378,1.1205177,0.30100968,-0.084028766,-0.09463307,-0.059581634,-0.25019374,-0.46905547,-1.1782808,-2.061274,0.25171122,0.3913127,-0.29887918,0.035719544,0.20835707,-0.29108974,-0.30671784,0.1527029,-0.39754185,-0.3602096,0.22677955,0.16270053,-0.55206615,0.49842626,-0.41439196,-0.28787178,-0.15953101,-0.296426,0.59450996,0.99816895,-0.5624988,-0.29079676,0.1165974,0.8471949,-0.5192243,0.3634474,-0.38122404,0.057399403,-0.22116488,0.39397642,0.42665988,0.8545908,-4.4134965,-0.41983104,0.38703263,0.32285038,-0.11246215,-0.42535064,0.240774,0.36041248,0.4786323,0.29034224,0.3367531,0.077113666,-0.094002314,-0.6467162,0.23585793,0.19402152,-0.1642987,-0.25164554,-0.13294573,0.11202029,-0.19381814,0.09234623,-0.42095444,0.06470342,-0.37784368,-0.77066326,0.5758679,-0.16566196,-0.20632215,-0.38857338,0.034295745,-0.14654529,-0.5983235,0.3293594,0.19752161,0.42919075,0.59139264,3.4089477,0.8104477,0.2745225,0.4686339,-0.73530954,0.37310365,-0.25158376,0.15624495,0.060077444,0.3441087,0.0067091254,0.05952834,-0.66818815,0.1461752,-0.13471544,-0.24675149,0.12334329,-0.91248834,0.22240508,0.027584352,0.4471455,-0.42584133,0.43631184,-0.44851282,0.026769688,-0.2544547,-0.35469025,-0.18047889,0.07813679,0.050763305,0.5098598,0.6558525,-0.18559997,-0.9521391,0.23635457,-0.11584151,0.1294534,0.07527501,-0.19367497,0.11946053,-1.1765674,0.22742368,-1.3751404,0.8987885,0.26031786,0.80258936,0.5680628,0.12486988,0.11655388,-0.6387981,0.08627921,0.11320163,0.31539452,0.15030739,0.057641484,0.56542635,-0.0153355645,-0.081085116,0.06397973,-0.6500951,0.39262614,0.06747714,-0.22323509,0.99197173,0.49991775,0.37089255,-0.2523229,0.4703803,-0.09511701,0.2845717,-0.14117101,0.13080767,-0.7663831,0.2871112,0.6201014,0.036152966,-0.0724946,-0.5046172,-0.055888273,-0.1236871,-0.77053976,0.21881185,0.56699604,-0.1985318,-0.49876633,-0.2853164,0.12957662,0.3174916,-0.067045055,0.59365743,0.99415433,-0.3000438,1.8078979,-0.62865216,-0.6069526,-0.039163366,-0.028919898,-0.5002806,0.50249535,0.2961408,0.22938125,-0.19551745,-0.4011852,0.22203355,-0.1583074,-0.6847059,-0.18619907,0.28563592,-0.23505768,-0.11918722,-0.5993066,-0.03703623,-0.018407755,0.53082,-0.06867718,0.44627845,0.13910279,0.17775193,0.12715873,0.046203032,1.0399263,0.053688288,0.29162195,-0.5286433,-0.578868,-0.6434142,0.12769967,-0.4206645,0.12349438,-0.37032723,-0.14329508,0.33430582,0.8040847,-0.010566272,0.80222404,0.69517475,0.21822491,-0.4789868,0.2852854,0.3769036,-0.56439286,1.0988399,-0.26589882,-0.1878547,0.0027438104,0.38944897,-1.0737715,-0.38698643,0.15756792,-0.032052785,1.4249475,0.55652213,0.097435415,0.32675225,0.3132684,0.12351333,0.47661605,-1.4513133,0.032406334,-0.6540126,0.49565884,0.0207984,-0.19478273,0.08147906,-0.31535482,0.2749601,-0.52416533,-0.19049609,-0.05335781,-0.24885151,-0.20363519,-0.32626605,0.49165356,-0.09156886,0.26572534,0.20926383,-0.10419738,-0.25479597,-0.112626605,-0.5630903,-0.18590306,0.38951397,-0.17895384,0.23376366,0.20452166,-0.7063262,-0.091878146,-0.4055527,-0.04290668,-0.36826047,0.44992235,-0.41231602,-0.38106367,-0.082403734,0.10062148,1.6897293,-0.34773842,0.08898285,0.68161553,-0.00083321566,0.079068385,-0.16398597,0.028781397,-0.27719986,0.40331033,-0.299892,-0.33881277,0.4718145,-0.05182502,-0.38805163,0.42847624,-0.39636362,0.10745081,0.16408548,-0.11590451,0.4254184,-0.8507765,-0.27798426,0.078165166,0.071151316,-2.3127246,-0.19294532,0.84163034,0.26427147,-0.59669673,-0.43170413,0.54959273,-0.06955941,0.071872175,-0.4770304,1.3236629,0.06589764,-0.25721985,-0.26053277,0.35466832,0.7462095,-0.22911328,-0.19682562,-0.18782237,-1.2941431,-0.44161725,0.5160912,1.6241324,0.4843654,0.78776795,0.35469723,0.33123025,-0.74825275,-1.5377976,-0.014631458,0.06891896,0.080416836,0.946159,0.18352422,-0.2830501,0.4119198,0.13081498,0.09843345,0.015649687,-0.11189404,1.9420736,-0.19993693,-0.079471156,-0.7135624,0.18326794,0.23898344,0.33448058,0.23531269,-0.09405888,0.5371061,-0.058692887,0.2582484,-0.81732243,0.37216204,0.24392156,-0.10283008,0.2510671,0.6341773,0.44199955,0.5788014,0.28137743,0.046464436,-0.11885564,-0.67371374,0.04065247],"result":{"type":"object","properties":{"results":{"items":{"properties":{"description":{"type":"string"},"excerpt":{"type":"string"},"title":{"type":"string"},"url":{"type":"string"}},"required":["title","description","excerpt","url"],"type":"object"},"type":"array"}},"required":["results"]},"sql_tables":null,"sql_queries":null,"file_inbox":null,"oauth":null,"assets":null,"runner":"any","operating_system":["linux","macos","windows"],"tool_set":""},false]} \ No newline at end of file diff --git a/tools/wikimedia-search/metadata.json b/tools/wikimedia-search/metadata.json index c7d705ba..f575a6d5 100644 --- a/tools/wikimedia-search/metadata.json +++ b/tools/wikimedia-search/metadata.json @@ -11,6 +11,9 @@ "full-text", "content" ], + "runner": "any", + "operating_system": ["linux", "macos", "windows"], + "tool_set": "", "configurations": { "type": "object", "properties": { diff --git a/tools/x-twitter-search/.tool-dump.test.json b/tools/x-twitter-search/.tool-dump.test.json index 82cbb72f..4ca3c13b 100644 --- a/tools/x-twitter-search/.tool-dump.test.json +++ b/tools/x-twitter-search/.tool-dump.test.json @@ -1 +1 @@ -{"type":"Deno","content":[{"name":"X/Twitter Search","homepage":null,"author":"@@official.shinkai","version":"1.0.0","js_code":"type CONFIG = {\n apiKey: string;\n};\n\ntype INPUTS = {\n command: 'search-top' | 'search-suggestions' | 'search-latest' | 'get-user-posts' | 'get-post-by-id';\n searchQuery?: string;\n username?: string;\n tweetId?: string;\n};\n\ntype OUTPUT = {\n data: any;\n};\n\nconst baseUrl = 'https://twttrapi.p.rapidapi.com';\n\nexport async function run(config: CONFIG, inputs: INPUTS): Promise {\n const { apiKey } = config;\n let url: string;\n\n switch (inputs.command) {\n case 'search-top':\n if (!inputs.searchQuery) {\n throw new Error('\"searchQuery\" is required for search-top command.');\n }\n url = `${baseUrl}/search-top?query=${inputs.searchQuery}`;\n break;\n case 'search-suggestions':\n if (!inputs.searchQuery) {\n throw new Error('\"searchQuery\" is required for search-suggestions command.');\n }\n url = `${baseUrl}/search-suggestions?query=${inputs.searchQuery}`;\n break;\n case 'search-latest':\n if (!inputs.searchQuery) {\n throw new Error('\"searchQuery\" is required for search-latest command.');\n }\n url = `${baseUrl}/search-latest?query=${inputs.searchQuery}`;\n break;\n case 'get-user-posts':\n if (!inputs.username) {\n throw new Error('\"username\" is required for get-user-posts command.');\n }\n url = `${baseUrl}/user-tweets?username=${inputs.username}`;\n break;\n case 'get-post-by-id':\n if (!inputs.tweetId) {\n throw new Error('\"tweetId\" is required for get-post-by-id command.');\n }\n url = `${baseUrl}/get-tweet?tweet_id=${inputs.tweetId}`;\n break;\n default:\n throw new Error('Invalid command provided.');\n }\n\n\n const response = await fetch(url, {\n method: 'GET',\n headers: {\n 'x-rapidapi-host': 'twttrapi.p.rapidapi.com',\n 'x-rapidapi-key': apiKey,\n },\n });\n\n const data = await response.json();\n return { data };\n}","tools":[],"config":[{"BasicConfig":{"key_name":"apiKey","description":"Get your API Key from https://rapidapi.com/twttrapi-twttrapi-default/api/twttrapi","required":true,"type":null,"key_value":null}}],"description":"Fetch from X/Twitter API to perform various search and retrieval operations.","keywords":["X","Twitter","API","search","tweets"],"input_args":{"type":"object","properties":{"username":{"type":"string","description":"The username for retrieving user posts"},"tweetId":{"type":"string","description":"The ID of the tweet to retrieve"},"command":{"type":"string","description":"The exact command to execute: 'search-top' | 'search-suggestions' | 'search-latest' | 'get-user-posts' | 'get-post-by-id'"},"searchQuery":{"type":"string","description":"The search query for fetching tweets"}},"required":["command"]},"output_arg":{"json":""},"activated":false,"embedding":[0.4305395,0.21161558,-0.054379616,-0.33275563,-0.014889535,-0.24782008,-0.90531313,-0.32333744,0.4141684,0.055562824,-0.4773929,0.5254866,-0.18077579,0.105664924,0.59022623,-0.05651185,0.19218309,-0.7971532,-1.8149972,-0.08281133,0.68683076,0.7954718,0.099625275,-0.108473554,-0.1005299,0.087269515,0.034634497,-0.6155523,-1.4184258,-1.9103004,0.5250585,0.86915654,-0.24549824,-0.12609054,-0.13757977,-0.29473704,-0.27303025,0.03950656,-0.16738541,0.26541728,-0.49252948,0.080321305,-0.6782323,0.1978963,-0.29802135,-0.58235973,-0.20508899,0.07515404,0.41780794,0.8870211,-0.07349146,-0.5924805,0.24697949,0.52923,-0.5296778,-0.53161633,-0.51090705,-0.24211425,-0.19071935,-0.055604413,0.37459677,0.16693074,-4.0099473,-0.075569734,0.03269406,-0.32891858,-0.09716503,0.09086436,0.27557212,0.3017307,0.17383517,0.047080986,0.04623566,-0.18046692,-0.03312591,-0.6932751,0.5152521,-0.30796668,0.54600745,0.18066728,0.5624121,0.5407586,-0.22822909,0.21861355,-0.16286518,0.81331044,-0.6931765,-0.44528013,0.37640795,0.36717787,-0.41019326,-0.30773917,0.28050837,-0.0075391605,-0.31364727,0.52060276,-0.01723611,0.26166284,0.17223817,3.0515094,0.73916817,0.07563284,0.26117337,-0.46541685,-0.23072672,-0.6290555,0.18444458,-0.095429905,0.29349327,-0.2332324,0.02632301,-0.09784512,-0.04294327,-0.014404971,-0.20085378,-0.47313946,-0.3035459,0.43723926,0.11820973,0.55901974,-0.57106805,0.45089084,-0.89362127,0.009699905,-0.53104395,0.1694082,-0.47288346,0.21489863,0.48888576,-0.4807912,1.0343188,-0.9717409,-0.9682214,-0.006101787,0.028445525,0.47166696,-0.16856591,-0.8540756,0.10560629,-1.1182886,0.33865392,-1.9562331,0.78074235,-0.1456382,0.8146181,0.8969924,-0.1426728,-0.030428581,-0.26801687,0.37595335,0.30555713,0.2098776,-0.2812084,0.21966258,1.0510923,0.119250275,-0.36212462,-0.17218477,-0.3424542,-0.07904532,-0.2743588,0.24867262,0.6504875,-0.11154151,0.069947325,-0.530115,0.53801405,0.10475666,0.24345562,0.1628248,0.6283477,-0.15593582,-0.40392956,0.45333076,-0.5980061,-0.06538034,-0.6309892,-0.23911366,0.018270055,-0.6361934,0.35806668,1.1401247,-0.38032657,-0.35157472,-0.17966716,0.11150528,0.23859039,0.13845927,0.9673809,1.1865023,0.09924718,1.5915843,-0.34105402,-0.5540501,0.007915191,-0.5831448,-0.0937967,0.7003658,0.32573435,-0.32414836,-0.45059347,-0.19859903,-0.09218037,-0.3194951,-0.39294574,-0.047911815,0.83080596,-0.27703252,0.56204915,-0.33700043,0.29024258,-0.7375401,0.58037615,0.29593995,0.2364677,0.14352724,0.03561874,-0.25715363,-0.24014908,0.23635244,0.024785317,0.4662469,-0.34172118,-0.6021392,0.26628283,-0.26606828,-0.21809351,0.27794725,-0.36773524,-0.5457272,0.41251528,0.6967946,0.28401804,1.4062676,1.028716,0.1739777,-0.40935898,0.96179235,0.44605955,-0.28388566,0.52240616,-0.14320186,-0.07170744,-0.014521413,0.04587001,-0.5292398,-0.42694443,-0.19303913,-0.04951892,1.4963026,0.51462346,0.49251777,0.21701254,0.3692812,-0.24598286,-0.24413496,-2.4469519,-0.11862854,0.113760985,0.60287786,-0.0047191344,-0.19445395,0.50833637,-0.38627365,-0.020675784,0.26782084,-0.67571396,0.061215915,0.0893381,-0.24510577,-0.6817276,0.69578415,-0.09048663,-0.6011646,0.18511474,0.38805622,-0.20233695,0.1467492,-0.80505556,0.07766668,0.0112556815,0.22671905,0.29770273,0.019191764,-0.4233864,-0.34238496,-0.31174573,0.20092836,-0.3397,-0.0714671,0.038997605,-0.41922042,-0.47837391,0.29778928,1.6280695,0.12308958,0.41364056,0.48643476,0.0198015,0.21245195,-0.01880046,-0.1005668,-0.03396522,-0.017229676,-0.46232596,-0.60714954,0.30195248,-0.82866985,-0.15068886,0.09655322,-0.011421323,0.77326,0.4615159,-0.6936142,0.8566099,-0.88112175,-0.13071989,0.5267433,0.25013116,-2.0881298,0.46015096,0.5558711,0.113765046,-0.35318583,-0.15942149,0.4270324,-0.64221686,0.35386196,-0.2711259,1.4708389,0.22466804,-0.36959052,-0.18626876,-0.18277794,0.74121475,0.43661883,-0.5455297,-0.003586188,-0.5455888,0.012195063,0.25302714,1.692523,0.31391713,0.86765885,0.5460867,0.24891889,-0.821956,-1.3961171,0.2778523,-0.0576745,-0.48592564,0.533186,0.013116516,-0.3133303,0.60392416,1.2730868,0.040761102,-0.27108315,-0.008594063,1.8826637,0.32975915,-0.2624513,-0.5750591,0.2265515,0.1175911,0.5555191,0.08540043,-0.53372526,0.14100088,0.15635633,0.10563886,-0.41571125,-0.13679291,0.24647684,-0.0060161874,0.6203762,0.38392183,0.59179157,0.25916487,0.5881642,0.6404631,0.29455742,-0.95066553,-0.040356904],"result":{"type":"object","properties":{"data":{"description":"The data returned from the Twitter API","type":"object"}},"required":["data"]},"sql_tables":[],"sql_queries":[],"file_inbox":null,"oauth":null,"assets":null},false]} \ No newline at end of file +{"type":"Deno","content":[{"name":"X/Twitter Search","homepage":null,"author":"@@official.shinkai","version":"1.0.0","js_code":"type CONFIG = {\n apiKey: string;\n};\n\ntype INPUTS = {\n command: 'search-top' | 'search-suggestions' | 'search-latest' | 'get-user-posts' | 'get-post-by-id';\n searchQuery?: string;\n username?: string;\n tweetId?: string;\n};\n\ntype OUTPUT = {\n data: any;\n};\n\nconst baseUrl = 'https://twttrapi.p.rapidapi.com';\n\nexport async function run(config: CONFIG, inputs: INPUTS): Promise {\n const { apiKey } = config;\n let url: string;\n\n switch (inputs.command) {\n case 'search-top':\n if (!inputs.searchQuery) {\n throw new Error('\"searchQuery\" is required for search-top command.');\n }\n url = `${baseUrl}/search-top?query=${inputs.searchQuery}`;\n break;\n case 'search-suggestions':\n if (!inputs.searchQuery) {\n throw new Error('\"searchQuery\" is required for search-suggestions command.');\n }\n url = `${baseUrl}/search-suggestions?query=${inputs.searchQuery}`;\n break;\n case 'search-latest':\n if (!inputs.searchQuery) {\n throw new Error('\"searchQuery\" is required for search-latest command.');\n }\n url = `${baseUrl}/search-latest?query=${inputs.searchQuery}`;\n break;\n case 'get-user-posts':\n if (!inputs.username) {\n throw new Error('\"username\" is required for get-user-posts command.');\n }\n url = `${baseUrl}/user-tweets?username=${inputs.username}`;\n break;\n case 'get-post-by-id':\n if (!inputs.tweetId) {\n throw new Error('\"tweetId\" is required for get-post-by-id command.');\n }\n url = `${baseUrl}/get-tweet?tweet_id=${inputs.tweetId}`;\n break;\n default:\n throw new Error('Invalid command provided.');\n }\n\n\n const response = await fetch(url, {\n method: 'GET',\n headers: {\n 'x-rapidapi-host': 'twttrapi.p.rapidapi.com',\n 'x-rapidapi-key': apiKey,\n },\n });\n\n const data = await response.json();\n return { data };\n}","tools":[],"config":[{"BasicConfig":{"key_name":"apiKey","description":"Get your API Key from https://rapidapi.com/twttrapi-twttrapi-default/api/twttrapi","required":true,"type":null,"key_value":null}}],"description":"Fetch from X/Twitter API to perform various search and retrieval operations.","keywords":["X","Twitter","API","search","tweets"],"input_args":{"type":"object","properties":{"tweetId":{"type":"string","description":"The ID of the tweet to retrieve"},"searchQuery":{"type":"string","description":"The search query for fetching tweets"},"username":{"type":"string","description":"The username for retrieving user posts"},"command":{"type":"string","description":"The exact command to execute: 'search-top' | 'search-suggestions' | 'search-latest' | 'get-user-posts' | 'get-post-by-id'"}},"required":["command"]},"output_arg":{"json":""},"activated":false,"embedding":[0.4305395,0.21161558,-0.054379616,-0.33275563,-0.014889535,-0.24782008,-0.90531313,-0.32333744,0.4141684,0.055562824,-0.4773929,0.5254866,-0.18077579,0.105664924,0.59022623,-0.05651185,0.19218309,-0.7971532,-1.8149972,-0.08281133,0.68683076,0.7954718,0.099625275,-0.108473554,-0.1005299,0.087269515,0.034634497,-0.6155523,-1.4184258,-1.9103004,0.5250585,0.86915654,-0.24549824,-0.12609054,-0.13757977,-0.29473704,-0.27303025,0.03950656,-0.16738541,0.26541728,-0.49252948,0.080321305,-0.6782323,0.1978963,-0.29802135,-0.58235973,-0.20508899,0.07515404,0.41780794,0.8870211,-0.07349146,-0.5924805,0.24697949,0.52923,-0.5296778,-0.53161633,-0.51090705,-0.24211425,-0.19071935,-0.055604413,0.37459677,0.16693074,-4.0099473,-0.075569734,0.03269406,-0.32891858,-0.09716503,0.09086436,0.27557212,0.3017307,0.17383517,0.047080986,0.04623566,-0.18046692,-0.03312591,-0.6932751,0.5152521,-0.30796668,0.54600745,0.18066728,0.5624121,0.5407586,-0.22822909,0.21861355,-0.16286518,0.81331044,-0.6931765,-0.44528013,0.37640795,0.36717787,-0.41019326,-0.30773917,0.28050837,-0.0075391605,-0.31364727,0.52060276,-0.01723611,0.26166284,0.17223817,3.0515094,0.73916817,0.07563284,0.26117337,-0.46541685,-0.23072672,-0.6290555,0.18444458,-0.095429905,0.29349327,-0.2332324,0.02632301,-0.09784512,-0.04294327,-0.014404971,-0.20085378,-0.47313946,-0.3035459,0.43723926,0.11820973,0.55901974,-0.57106805,0.45089084,-0.89362127,0.009699905,-0.53104395,0.1694082,-0.47288346,0.21489863,0.48888576,-0.4807912,1.0343188,-0.9717409,-0.9682214,-0.006101787,0.028445525,0.47166696,-0.16856591,-0.8540756,0.10560629,-1.1182886,0.33865392,-1.9562331,0.78074235,-0.1456382,0.8146181,0.8969924,-0.1426728,-0.030428581,-0.26801687,0.37595335,0.30555713,0.2098776,-0.2812084,0.21966258,1.0510923,0.119250275,-0.36212462,-0.17218477,-0.3424542,-0.07904532,-0.2743588,0.24867262,0.6504875,-0.11154151,0.069947325,-0.530115,0.53801405,0.10475666,0.24345562,0.1628248,0.6283477,-0.15593582,-0.40392956,0.45333076,-0.5980061,-0.06538034,-0.6309892,-0.23911366,0.018270055,-0.6361934,0.35806668,1.1401247,-0.38032657,-0.35157472,-0.17966716,0.11150528,0.23859039,0.13845927,0.9673809,1.1865023,0.09924718,1.5915843,-0.34105402,-0.5540501,0.007915191,-0.5831448,-0.0937967,0.7003658,0.32573435,-0.32414836,-0.45059347,-0.19859903,-0.09218037,-0.3194951,-0.39294574,-0.047911815,0.83080596,-0.27703252,0.56204915,-0.33700043,0.29024258,-0.7375401,0.58037615,0.29593995,0.2364677,0.14352724,0.03561874,-0.25715363,-0.24014908,0.23635244,0.024785317,0.4662469,-0.34172118,-0.6021392,0.26628283,-0.26606828,-0.21809351,0.27794725,-0.36773524,-0.5457272,0.41251528,0.6967946,0.28401804,1.4062676,1.028716,0.1739777,-0.40935898,0.96179235,0.44605955,-0.28388566,0.52240616,-0.14320186,-0.07170744,-0.014521413,0.04587001,-0.5292398,-0.42694443,-0.19303913,-0.04951892,1.4963026,0.51462346,0.49251777,0.21701254,0.3692812,-0.24598286,-0.24413496,-2.4469519,-0.11862854,0.113760985,0.60287786,-0.0047191344,-0.19445395,0.50833637,-0.38627365,-0.020675784,0.26782084,-0.67571396,0.061215915,0.0893381,-0.24510577,-0.6817276,0.69578415,-0.09048663,-0.6011646,0.18511474,0.38805622,-0.20233695,0.1467492,-0.80505556,0.07766668,0.0112556815,0.22671905,0.29770273,0.019191764,-0.4233864,-0.34238496,-0.31174573,0.20092836,-0.3397,-0.0714671,0.038997605,-0.41922042,-0.47837391,0.29778928,1.6280695,0.12308958,0.41364056,0.48643476,0.0198015,0.21245195,-0.01880046,-0.1005668,-0.03396522,-0.017229676,-0.46232596,-0.60714954,0.30195248,-0.82866985,-0.15068886,0.09655322,-0.011421323,0.77326,0.4615159,-0.6936142,0.8566099,-0.88112175,-0.13071989,0.5267433,0.25013116,-2.0881298,0.46015096,0.5558711,0.113765046,-0.35318583,-0.15942149,0.4270324,-0.64221686,0.35386196,-0.2711259,1.4708389,0.22466804,-0.36959052,-0.18626876,-0.18277794,0.74121475,0.43661883,-0.5455297,-0.003586188,-0.5455888,0.012195063,0.25302714,1.692523,0.31391713,0.86765885,0.5460867,0.24891889,-0.821956,-1.3961171,0.2778523,-0.0576745,-0.48592564,0.533186,0.013116516,-0.3133303,0.60392416,1.2730868,0.040761102,-0.27108315,-0.008594063,1.8826637,0.32975915,-0.2624513,-0.5750591,0.2265515,0.1175911,0.5555191,0.08540043,-0.53372526,0.14100088,0.15635633,0.10563886,-0.41571125,-0.13679291,0.24647684,-0.0060161874,0.6203762,0.38392183,0.59179157,0.25916487,0.5881642,0.6404631,0.29455742,-0.95066553,-0.040356904],"result":{"type":"object","properties":{"data":{"description":"The data returned from the Twitter API","type":"object"}},"required":["data"]},"sql_tables":[],"sql_queries":[],"file_inbox":null,"oauth":null,"assets":null,"runner":"any","operating_system":["linux","macos","windows"],"tool_set":""},false]} \ No newline at end of file diff --git a/tools/x-twitter-search/metadata.json b/tools/x-twitter-search/metadata.json index 7e720901..b28d3979 100644 --- a/tools/x-twitter-search/metadata.json +++ b/tools/x-twitter-search/metadata.json @@ -3,6 +3,9 @@ "homepage": "https://github.com/dcSpark/shinkai-tools/blob/main/tools/x-twitter-search/README.md", "version": "1.0.0", "author": "Shinkai", + "runner": "any", + "operating_system": ["linux", "macos", "windows"], + "tool_set": "", "configurations": { "properties": { "apiKey": { diff --git a/tools/youtube-download-mp3/.tool-dump.test.json b/tools/youtube-download-mp3/.tool-dump.test.json new file mode 100644 index 00000000..15bfcaa3 --- /dev/null +++ b/tools/youtube-download-mp3/.tool-dump.test.json @@ -0,0 +1 @@ +{"type":"Deno","content":[{"name":"Youtube Download MP3","homepage":null,"author":"@@official.shinkai","version":"1.0.0","js_code":"import { writeAll } from 'https://deno.land/std/io/mod.ts';\nimport { getHomePath } from './shinkai-local-support.ts';\n\ntype CONFIG = {\n apiKey: string;\n};\n\ntype INPUTS = {\n youtubeUrl: string;\n fileName?: string;\n};\n\ntype OUTPUT = {\n audiofile?: string;\n rapidDownloadUrl?: string;\n error?: string;\n};\n\nexport async function run(config: CONFIG, inputs: INPUTS): Promise {\n const { youtubeUrl, fileName } = inputs;\n\n // Validate YouTube URL (must be in the form https://www.youtube.com/watch?v=XXXXXXXXXXX)\n const youtubeRegex = /^https:\\/\\/(www\\.)?youtube\\.com\\/watch\\?v=[\\w-]{11}$/;\n if (!youtubeRegex.test(youtubeUrl)) {\n return { error: 'Invalid YouTube URL' };\n }\n\n // Build the API URL for RapidAPI\n const apiUrl = `https://youtube-to-mp315.p.rapidapi.com/download?url=${encodeURIComponent(youtubeUrl)}&format=mp3`;\n\n const response = await fetch(apiUrl, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n 'x-rapidapi-host': 'youtube-to-mp315.p.rapidapi.com',\n 'x-rapidapi-key': config.apiKey,\n },\n body: JSON.stringify({})\n });\n\n if (!response.ok) {\n return { error: 'Failed to download video' };\n }\n\n const data = await response.json();\n const rapidDownloadUrl = data.downloadUrl;\n\n // Wait 10 seconds before downloading the file\n await new Promise(resolve => setTimeout(resolve, 20_000));\n\n // Download the MP3 file from the rapidDownloadUrl\n let fileResponse = await fetch(rapidDownloadUrl);\n if (fileResponse.status === 404) {\n await new Promise(resolve => setTimeout(resolve, 15_000));\n fileResponse = await fetch(rapidDownloadUrl);\n }\n if (fileResponse.status === 404) {\n await new Promise(resolve => setTimeout(resolve, 15_000));\n fileResponse = await fetch(rapidDownloadUrl);\n }\n if (fileResponse.status === 404) {\n await new Promise(resolve => setTimeout(resolve, 15_000));\n fileResponse = await fetch(rapidDownloadUrl);\n }\n if (!fileResponse.ok) {\n console.error(await fileResponse.text())\n return { error: 'Failed to download the mp3 file from the provided download URL.', rapidDownloadUrl };\n }\n\n // Determine the output file name:\n // If a fileName is provided, use it. Otherwise, derive it from the download URL.\n let outputFileName: string = await getHomePath();\n if (fileName) {\n outputFileName += '/'+fileName;\n if (!outputFileName.endsWith('.mp3')) outputFileName += '.mp3'\n } else {\n outputFileName += '/audio.mp3';\n }\n\n // Save the file to disk in the current working directory\n // Convert the response into a Uint8Array and return it\n const arrayBuffer = await fileResponse.arrayBuffer();\n const fileData = new Uint8Array(arrayBuffer);\n const outputFile = await Deno.open(outputFileName, { write: true, create: true });\n await writeAll(outputFile, fileData);\n outputFile.close();\n\n return { audiofile: outputFileName, rapidDownloadUrl };\n}\n","tools":[],"config":[{"BasicConfig":{"key_name":"apiKey","description":"The API key for accessing the RapidAPI service","required":true,"type":null,"key_value":null}}],"description":"Downloads audio from a YouTube video and saves it as an MP3 file.","keywords":["youtube","mp3","downloader","audio"],"input_args":{"type":"object","properties":{"youtubeUrl":{"type":"string","description":"The URL of the YouTube video to download"},"fileName":{"type":"string","description":"Optional file name for the downloaded MP3"}},"required":["youtubeUrl"]},"output_arg":{"json":""},"activated":false,"embedding":[0.8978121,-0.38236564,0.25026086,-0.030445049,-0.68066764,-0.38680246,-0.75059307,-0.16159853,0.115520895,-0.08894039,0.16471446,1.2539114,-0.53002113,-0.06787127,0.37531763,-0.46376362,0.6043358,-0.36440754,-1.27444,0.092776,-0.10527672,1.0559564,-0.15574482,0.5344863,-0.12049553,0.15839398,-0.13501558,-0.64109826,-1.0949022,-1.380253,0.756534,1.0093974,0.1371673,-0.45210496,0.043984298,-0.41195494,0.30545995,0.5381766,-0.6542231,0.19512014,-0.28566748,-0.6834833,-0.24523884,0.059317313,-0.11745814,0.15117908,0.9893497,-0.1293683,1.2761201,-0.04888384,-0.6488842,-0.14291576,-0.5981784,-0.22306132,-0.24271935,-0.8170982,-0.49678338,0.7598456,0.58341837,0.2337351,-0.38556394,0.09629938,-3.770494,-0.2593993,0.73040265,0.15886879,0.06967721,-0.4445228,0.46056688,-0.36910003,0.077562466,0.16837867,-0.94267344,0.083271116,-0.30472603,-0.32850897,0.12196897,-0.37068734,0.011986807,-0.78597414,0.3220331,0.19890973,0.14668599,-0.29024467,-0.28214183,0.42522508,-0.30430737,0.16020325,-0.34255335,0.045908257,-0.46009716,-0.52211666,0.7839237,0.5680148,-0.15937495,-0.61577535,0.37545618,-0.2108674,0.04473986,2.4636352,0.7389742,0.03052688,0.65681326,-0.9039774,-0.10847866,-0.44941762,-0.06641045,-0.063555405,0.47950566,0.057138056,0.88980365,-0.27268228,0.26899624,0.11928973,0.32827538,-0.004729064,-0.9670804,-0.39798924,0.3475849,0.41963223,-0.2606531,-0.24582043,-0.062375724,-0.40322357,-0.8820542,-0.14422247,-0.5440605,0.0018578242,0.54243886,-0.5910839,0.26224697,-0.18059881,-0.6233966,-0.1449669,0.04158897,0.4766038,0.6537345,-1.2227646,0.16176587,-0.09917037,0.3095258,-1.5723702,0.39947164,0.11780455,-0.13689747,0.28848332,-0.20718423,0.8008808,-0.4233444,0.13794081,0.1467611,0.22427513,0.29201287,0.09237918,0.98098624,-0.20563528,-0.012285078,-0.46040112,-0.5077826,0.5173641,-0.76290107,-0.1349123,-0.045115188,0.5392496,0.040498562,-0.14606781,0.13392855,0.30390924,0.5744238,-0.015810877,0.41595688,0.20337966,0.006199469,-0.23151287,0.14086938,-0.61782175,-0.7906661,0.093529634,0.13156338,0.13367733,0.6007434,0.28960142,-0.44783726,-0.19925582,-0.021204095,0.69737047,0.083505996,-0.030311741,0.80101204,1.2163801,0.2322349,1.7640947,-1.6182355,-0.6358923,-0.101933844,0.18582696,-0.08924249,0.97340006,0.29626462,-0.47582442,-0.15604398,-0.13457537,0.37228402,0.13692588,-0.0884762,-0.002923198,-0.1911266,-0.111618735,-0.46308422,-0.6428838,0.65943056,-0.76081014,0.37069392,0.20034096,-0.33790767,0.4145084,-0.6416054,0.30050737,-0.38145056,-0.05378723,-0.03317406,0.2857017,0.30120128,-0.42741013,0.2283289,0.4426573,-0.29540202,-0.4891041,-0.31142366,-0.26896238,1.093975,0.8950349,0.23854466,0.83144003,1.2862277,0.13267913,-0.5744894,0.37312955,0.4778385,-0.21275997,-0.034131356,0.030976146,-0.036735564,-0.6043095,-0.40823928,-1.1145563,0.4490646,0.10903312,-0.200039,1.1144693,0.8483904,0.76854587,0.84135413,0.2453628,0.91795194,-0.0299889,-2.0776944,-0.010050826,-0.08972061,0.49826723,-0.14836115,0.40401223,0.25739604,0.27994832,-0.1715733,-0.3559402,-1.0621003,-0.8596525,0.19170606,0.1108878,-0.16887018,1.0099766,-0.5437861,0.015364904,0.28855556,0.4519207,0.33872473,0.12577528,-0.45245624,-0.18073457,0.80951583,-0.3070707,0.08059518,-0.15323982,-0.044662192,-0.18974113,0.055840444,0.43548942,-0.110932656,0.95754045,-0.12713888,-0.9128443,-0.895512,0.8194648,1.4403442,0.52057767,0.40922672,-0.10707068,-0.4163206,0.17807616,-0.7910435,0.0848166,-0.09537953,-0.65483975,-0.6215398,-0.43794662,0.4207806,-0.7561903,-0.061976723,0.07614706,0.085530035,0.3327715,0.37570283,-0.05831465,0.57758385,-0.41423917,0.3027356,0.78470576,-0.32512748,-2.129035,-0.69341505,-0.8005581,-0.21148634,-0.33351868,-0.19860007,1.2637125,-0.41670087,0.76008385,0.26068044,1.7340094,0.26435217,-0.9533452,-0.5513407,0.9425449,0.6109643,-0.5751295,0.40517476,-0.30230522,-0.9401635,-0.1414716,1.1486968,0.99513835,0.42588487,0.21049741,-0.022334073,-0.5367475,-0.32303417,-1.2997301,0.27138358,-0.13644655,-0.73169523,0.31871346,-0.41878545,-0.69748795,0.732427,0.92434174,-0.19532484,0.11295331,-0.21700555,1.6971712,0.5995367,-0.10436975,0.31151137,0.102284655,0.43405044,-0.3967902,0.36459574,-1.1446744,0.1441844,-0.38913086,0.062059294,-0.22088042,0.44415867,0.63250035,1.4327443,0.45908833,-0.23057374,1.2341993,0.2352533,0.37941307,0.46530467,0.3764528,-0.19615623,-0.10042809],"result":{"type":"object","properties":{"audiofile":{"description":"The name of the MP3 file saved","type":"string"},"error":{"description":"Error message if the process fails","type":"string"},"rapidDownloadUrl":{"description":"The URL from which the MP3 file was downloaded","type":"string"}},"required":[]},"sql_tables":[],"sql_queries":[],"file_inbox":null,"oauth":[],"assets":null,"runner":"any","operating_system":["linux","macos","windows"],"tool_set":""},false]} \ No newline at end of file diff --git a/tools/youtube-download-mp3/metadata.json b/tools/youtube-download-mp3/metadata.json index af2d260d..75872813 100644 --- a/tools/youtube-download-mp3/metadata.json +++ b/tools/youtube-download-mp3/metadata.json @@ -10,7 +10,10 @@ "audio" ], "oauth": [], - "configurations": { + "runner": "any", + "operating_system": ["linux", "macos", "windows"], + "tool_set": "", + "configurations": { "properties": { "apiKey": { "description": "The API key for accessing the RapidAPI service", diff --git a/tools/youtube-search/.tool-dump.test.json b/tools/youtube-search/.tool-dump.test.json new file mode 100644 index 00000000..ba739efe --- /dev/null +++ b/tools/youtube-search/.tool-dump.test.json @@ -0,0 +1 @@ +{"type":"Python","content":[{"version":"1.0.0","name":"YouTube Search","homepage":null,"author":"@@official.shinkai","py_code":"# /// script\n# dependencies = [\n# \"requests>=2.28.0\"\n# ]\n# ///\n\nimport requests\nimport json\nfrom typing import List, Dict, Optional\n\nclass CONFIG:\n SERP_API_KEY: str\n\nclass INPUTS:\n search_query: str\n gl: Optional[str] = \"us\"\n hl: Optional[str] = \"en\"\n max_results: Optional[int] = 10\n\nclass OUTPUT:\n results: List[Dict[str, str]]\n query: str\n\nasync def run(c: CONFIG, p: INPUTS) -> OUTPUT:\n if not c.SERP_API_KEY:\n raise ValueError(\"SERP_API_KEY not provided in config.\")\n if not p.search_query or not p.search_query.strip():\n raise ValueError(\"No search query provided.\")\n\n url = \"https://serpapi.com/search\"\n params = {\n \"engine\": \"youtube\",\n \"search_query\": p.search_query.strip(),\n \"api_key\": c.SERP_API_KEY,\n \"hl\": p.hl,\n \"gl\": p.gl,\n }\n\n resp = requests.get(url, params=params)\n if resp.status_code != 200:\n raise RuntimeError(f\"YouTube search failed with HTTP {resp.status_code}: {resp.text}\")\n\n data = resp.json()\n video_results = data.get(\"video_results\", [])\n \n videos = []\n for item in video_results[:p.max_results]:\n video = {\n \"title\": item.get(\"title\", \"Untitled\"),\n \"link\": item.get(\"link\", \"\"),\n \"thumbnail\": item.get(\"thumbnail\", {}).get(\"static\", \"\"),\n \"channel\": item.get(\"channel\", {}).get(\"name\", \"Unknown\"),\n \"views\": item.get(\"views\", \"0\"),\n \"duration\": item.get(\"duration\", \"\")\n }\n videos.append(video)\n\n output = OUTPUT()\n output.results = videos\n output.query = p.search_query.strip()\n return output\n","tools":[],"config":[{"BasicConfig":{"key_name":"SERP_API_KEY","description":"Your SerpAPI key for authentication","required":true,"type":null,"key_value":null}}],"description":"Searches YouTube for videos via SerpAPI. Requires SERP_API_KEY in configuration.","keywords":["youtube","serpapi","video","search"],"input_args":{"type":"object","properties":{"search_query":{"type":"string","description":"The search query for YouTube videos"},"hl":{"type":"string","description":"Language code. E.g. 'en', 'es'"},"gl":{"type":"string","description":"Geolocation (country code). E.g. 'us', 'uk'"},"max_results":{"type":"number","description":"Maximum number of results to return"}},"required":["search_query"]},"output_arg":{"json":""},"activated":false,"embedding":[-0.10255425,0.026966542,0.07079901,-0.47810104,-1.5509136,-0.78034514,-0.95892495,-0.40695834,-0.32471016,-0.16793866,-0.60645795,0.7405229,-0.17616071,0.24011184,0.42893535,-0.258754,0.40819165,-0.26762527,-0.7868211,-0.06291662,0.47050977,0.574803,-0.2945245,0.2197371,-0.4602155,0.3509582,0.18527684,-1.0056108,-1.6505673,-1.8296648,0.28702152,0.97518617,0.16069742,0.010584511,-0.36847374,-0.12695187,0.13307816,0.046456065,-0.09574347,0.22498225,-0.013348519,0.25258535,-0.5648994,-0.058898903,-0.68827224,-0.13880068,1.1406662,-0.44158533,1.3897412,0.32412404,-0.08247516,0.3346178,-0.6385392,0.39160886,-0.6175067,-0.18113202,-0.58347225,0.23324226,0.5488135,-0.20359051,0.75618714,0.24166703,-3.8873823,-0.6130364,-0.0015206542,0.2642355,0.222649,-0.2238572,0.59660393,0.08695516,-0.36584964,0.4321627,0.027202353,0.3979017,-0.5047259,-0.90199447,0.11578736,-0.31804463,0.20222855,-0.49835792,0.7713721,-0.0703035,-0.06894686,-0.81414884,0.03971477,-0.017930746,-0.16284528,-0.09173152,0.39695972,0.6304158,-0.5497592,0.27395573,0.473484,-0.30796042,-0.4924348,-0.24930592,0.20947218,-0.3008367,0.18791704,2.5184708,0.7743389,0.25000393,0.8791858,-0.98005635,-0.034882754,0.029404156,0.7392621,-0.07373229,0.024563203,0.8240579,-0.46482727,0.16509445,0.92727935,0.33776513,0.11973241,-0.21640861,0.21764676,0.062595814,0.38028914,1.2065785,-0.48744676,-0.2504198,-0.74971896,0.18352118,-0.053867545,-0.18266347,-0.899822,0.29740706,0.35439512,-0.34514484,0.3936717,-0.79429156,-0.4941258,0.27391705,-0.03778016,0.14373098,0.12545636,-0.74052036,0.034843825,-0.22066888,-0.6071886,-1.03977,0.97571,-0.15346181,0.28484708,0.56493616,0.008252706,0.45296264,-0.73152745,-0.24068284,0.6350717,0.08128059,0.4476487,0.26343203,0.65475,-0.3339804,-0.49038804,-0.22755483,-0.5807769,0.3489332,-0.5519958,-0.0671083,-0.100680664,0.11502666,0.21555614,-0.44108233,0.3381044,0.19428441,0.6411078,-0.07816913,0.3787655,0.47634572,0.023481183,-0.04700102,-0.4008958,-0.092310205,-1.4393011,-0.124107696,0.40089807,-0.26088053,-0.28801385,0.4053036,0.14864565,-0.1222353,-0.9431315,0.5009819,0.055658296,0.13507019,1.0406849,1.1171358,-0.7710909,1.9395888,-0.85936636,-0.58307785,0.6237543,0.2964697,-0.5054424,0.4639371,-0.39356604,-0.48839596,-0.69056594,-0.2593078,-0.23263977,-0.13404855,-0.5864562,0.06320335,0.4900337,0.108707696,-0.14511657,-0.32514462,0.7355296,-0.54030585,0.4251204,0.16593915,0.38334256,0.0294934,-0.09115434,-0.3077323,-0.79300267,0.36262983,0.24585053,0.44311237,-0.25572073,-0.54193825,0.053414006,0.27337134,-0.6364642,0.5076743,-0.7621596,-0.4163918,0.41242656,1.1039149,0.12051296,1.359865,0.7417852,0.23162699,-0.07275321,0.35425988,0.36196205,-1.0350333,0.4592195,-0.28482237,-0.25138623,-0.7404799,-0.3042491,-0.7936276,0.15679619,0.04890065,-0.16880576,1.4538665,1.7192484,0.5763311,0.34496745,0.59060663,0.3955309,0.33962667,-1.5359936,-0.053577766,0.103147365,-0.261462,-0.30522165,0.2826563,0.09107998,0.15623918,0.06395733,0.11795595,-0.5760403,-0.7027236,-0.036731936,-0.65007937,-0.009111701,0.7179159,0.32885373,-0.02618067,-0.35641444,0.06155941,-0.48827645,-0.032105975,-1.0460829,-0.13903134,0.49664405,-0.34184927,0.17057437,-0.4636349,-0.8732634,0.059177198,-0.74918073,0.9407446,-0.2762001,0.87701696,-0.5257669,-0.19656816,-0.31074214,0.3883399,1.4335163,-0.22330639,0.5319325,0.93340063,-0.3723758,0.39575446,-0.98789585,-0.16870394,0.5209986,0.16481274,-0.17888904,-0.28096062,1.0478148,-0.5200282,-0.21896333,0.09148715,-0.31806895,0.97605354,-0.1587349,-0.4027645,0.68445635,-0.7570269,0.26019692,1.0818857,-0.07364514,-1.4009349,-0.04747517,-0.1892569,-0.3762566,-0.18857346,-0.822156,0.53752244,0.04893124,0.31643316,0.007201895,1.610561,-0.007114443,0.06854199,-0.29868427,0.3644462,0.09635862,-0.42918283,0.14586696,-0.029842831,-1.1882046,-0.72974265,0.44077545,1.5450928,1.1880387,0.37481806,0.46859697,-0.068656914,-0.37147647,-0.8737937,0.62999594,-0.101879835,-0.81605834,1.1592706,0.08325277,-0.29198793,0.45718917,0.47724375,0.53568155,-0.27684388,0.23811105,1.6020179,0.13173306,0.08475237,0.08650171,0.7863198,0.29908523,0.15758644,-0.49852782,-0.5569922,0.65889454,-0.3672715,0.32344535,-0.60381764,0.5750247,-0.38910154,0.102846295,1.0643396,0.105247825,0.6337029,0.57803494,0.15224232,0.06866618,0.34769094,-0.30365127,-0.22183032],"result":{"type":"object","properties":{"query":{"description":"The original search query","type":"string"},"results":{"description":"List of video search results","items":{"properties":{"channel":{"type":"string"},"duration":{"type":"string"},"link":{"type":"string"},"thumbnail":{"type":"string"},"title":{"type":"string"},"views":{"type":"string"}},"type":"object"},"type":"array"}},"required":["results","query"]},"sql_tables":null,"sql_queries":null,"file_inbox":null,"oauth":null,"assets":null,"runner":"any","operating_system":["linux","macos","windows"],"tool_set":""},false]} \ No newline at end of file diff --git a/tools/youtube-search/metadata.json b/tools/youtube-search/metadata.json index 184af251..554f0968 100644 --- a/tools/youtube-search/metadata.json +++ b/tools/youtube-search/metadata.json @@ -4,6 +4,9 @@ "version": "1.0.0", "author": "Devin", "keywords": ["youtube", "serpapi", "video", "search"], + "runner": "any", + "operating_system": ["linux", "macos", "windows"], + "tool_set": "", "configurations": { "type": "object", "properties": { diff --git a/tools/youtube-summary/.tool-dump.test.json b/tools/youtube-summary/.tool-dump.test.json index 1abb70f8..d47e1fe2 100644 --- a/tools/youtube-summary/.tool-dump.test.json +++ b/tools/youtube-summary/.tool-dump.test.json @@ -1 +1 @@ -{"type":"Deno","content":[{"name":"Youtube Transcript Summarizer","homepage":null,"author":"@@official.shinkai","version":"1.0.0","js_code":"import { YoutubeTranscript } from 'npm:youtube-transcript@1.2.1';\nimport { shinkaiLlmPromptProcessor } from './shinkai-local-tools.ts'\n\n// Tool does not need any configuration\ntype CONFIG = Record;\n\ntype INPUTS = {\n url: string;\n lang?: string;\n};\n\ntype OUTPUT = { summary: string };\n\nexport const run: Run = async (\n _configurations,\n parameters,\n): Promise => {\n console.log(`transcripting ${parameters.url}`);\n\n // Get transcription\n const transcript = await YoutubeTranscript.fetchTranscript(parameters.url, {\n lang: parameters.lang || 'en',\n });\n\n // Send to LLM to build a formatted response\n const message = `\n According to this transcription of a youtube video (which is in csv separated by ':::'):\n\n offset;text\n ${transcript.map((v) => `${Math.floor(v.offset)}:::${v.text}`).join('\\n')}\n ---------------\n\n The video URL is ${parameters.url}\n\n ---------------\n\n Write a detailed summary divided in sections along the video.\n Format the answer using markdown.\n Add markdown links referencing every section using this format https://www.youtube.com/watch?v={video_id}&t={offset} where 'offset' is a number and can be obtained from the transcription in csv format to generate the URL\n `;\n const response = await shinkaiLlmPromptProcessor({ format: 'text', prompt: message })\n return { summary: response.message }\n};\n","tools":["local:::__official_shinkai:::shinkai_llm_prompt_processor"],"config":[],"description":"Fetches the transcript of a YouTube video and generates a formatted summary using an LLM.","keywords":["youtube","transcript","summary","video","LLM"],"input_args":{"type":"object","properties":{"lang":{"type":"string","description":"The language for the transcript (optional)"},"url":{"type":"string","description":"The URL of the YouTube video"}},"required":["url"]},"output_arg":{"json":""},"activated":false,"embedding":[0.24397473,0.19737607,0.10249484,0.07853881,-0.52260065,-0.07264366,-1.4292128,0.5816098,-0.0569295,0.467394,-0.2629992,1.546936,0.030428365,0.18555912,0.5241776,0.40233222,-0.10415818,-0.7092806,-1.297857,-0.664604,0.52484876,0.5144266,-0.0060532093,-0.0029968247,0.13401021,-0.13712981,0.09876527,-0.22174498,-1.0573201,-1.9738672,0.70428807,0.54259884,-0.16001034,-0.37234327,-0.43517393,-1.3643596,0.25747937,0.46092734,-0.292954,0.4579779,-0.09054327,0.13232066,-0.7888382,0.40833142,-0.043910377,-0.19611594,0.36788312,-0.09296358,1.4296865,0.44269896,-0.40729654,-0.19846602,-0.10134886,0.49915153,-0.17917651,-0.61800796,-0.39331928,-0.5531162,0.93573284,0.3125194,-0.032507822,-0.024462327,-3.7117436,-0.23966308,-0.082733504,-0.00083688647,-0.2638889,-0.079310715,-0.04274538,0.38685042,-1.0061314,-0.09795482,-0.595692,0.8140711,-0.52223,-0.5010422,0.48327318,-0.30269998,0.26365638,-0.53166157,0.06926101,0.061586447,0.22167054,-0.38880783,-0.53398055,0.90134996,-0.47085276,-0.24938089,-0.13700266,0.26321328,-0.9187829,-0.030944848,0.6005912,0.34225106,-0.54002047,-0.3963846,0.6813786,-0.4724697,0.072636716,2.6400874,1.0521492,0.014715459,0.1956683,-1.1673645,0.4569034,-0.70678335,0.47124594,-0.42230985,0.31645888,0.0359073,0.78643477,-0.17552736,0.15710464,0.549718,0.51373,0.37795103,-0.81747603,0.024700543,0.03176478,0.36899906,-0.272966,-0.12973304,-0.39982963,-0.18365073,-0.46064875,0.14623581,-0.1908139,0.15239067,0.5717435,-0.7718099,-0.041600056,-0.055492602,-0.6733642,0.6702037,0.025288485,0.30686027,0.40308362,-0.8706652,0.31286785,-0.81772375,-0.18790466,-2.0614433,0.6394961,-0.018431015,0.34960693,-0.007028464,-0.61032754,0.37297478,-0.29247496,-0.465864,0.36508018,0.6427132,0.22788927,-0.08449084,0.88174784,-0.13330701,-0.72458035,-0.55865467,-0.20877361,0.050680257,-0.38116446,-0.07186862,0.624656,-0.3708253,0.2717578,-0.5983692,0.77082396,0.16514742,0.39356315,0.32194296,0.28758615,0.11886267,0.01459287,0.7468215,-0.025611265,-0.89384717,-0.4739496,-0.301784,-0.0015290305,0.29546043,0.48127237,0.2063696,-0.409744,-0.04899437,-0.23912765,0.6469834,0.09129079,0.24771339,0.96164113,0.7420727,-0.33983496,1.6778651,-1.1015447,-0.17468059,-0.111047395,0.09020809,-0.3394488,0.3813395,0.30324456,0.06054409,-0.9422036,-0.21234436,0.25479048,0.0029522553,-0.33134744,-0.64197415,-0.31880897,0.73515236,-0.370654,-0.61103266,0.49827653,-0.9070959,0.5150069,0.54918575,-0.0791596,-0.26136273,-0.038667,0.20681158,-0.7998123,0.15697767,0.31832293,-0.30024567,-0.13398749,-0.5464064,0.078004286,0.5013751,-0.5964775,0.7934169,0.18798716,-0.102526814,0.7516279,1.3288732,0.38466543,1.1970915,0.70729077,0.16436699,-0.4109063,0.31046456,-0.09760972,-0.2675225,0.18276238,0.25188726,0.069069535,0.28543174,0.2071175,-0.08041818,-0.6181666,0.043410942,-0.29807296,1.7043421,0.43463537,0.4075363,0.59444076,0.82585335,0.6737303,-0.36265337,-1.4637611,-0.29978368,-0.20907988,0.33043876,-0.750395,0.6137083,0.19155118,0.2934378,-0.5209952,-0.36604527,-0.69852865,-0.4371357,0.028415933,0.18738863,-0.30432528,0.49997562,-0.11741397,0.042816848,-0.4490757,0.4281727,0.18414852,0.42120722,-0.44500935,-0.9356021,0.004114732,-0.098933734,0.20038745,0.31341612,-0.7175617,-0.13790105,-0.078082725,-0.30331305,0.016176544,0.5784527,0.09730462,-0.46089923,-0.9954212,0.2812389,1.5212535,0.25866175,0.15545672,0.5862159,0.3469371,0.09966384,-0.93005514,0.027373465,-0.14089948,-0.49164492,-0.18993902,-0.6721664,0.91621786,-0.31503543,-0.43121752,0.4722464,-0.42334154,0.41654542,0.2577617,-0.2962021,0.46720228,-0.3402864,0.3280484,0.9959594,-0.17491736,-1.8942695,-0.035868153,-0.29466665,-0.25931674,-0.27141005,0.24185471,1.0774001,-0.64388967,0.6423959,0.24093969,1.5087445,0.11422682,-0.10210596,-0.35378647,0.08158391,0.7351494,-0.47266462,-0.18411069,-0.30488995,-0.7604541,-0.2951124,0.32563996,1.0398327,0.033854738,1.0128971,0.04701845,-0.2543579,-0.3876006,-1.0073549,0.6400236,-0.24982655,-0.3674008,0.75311905,-0.40171337,-0.31875148,0.7237389,0.8828592,0.5095583,-0.050843228,0.3896459,1.7165403,0.49974895,-0.35941413,0.277945,0.12831461,0.41759193,0.11227698,0.021763999,-0.5772322,0.04317443,-0.34799072,0.57283884,-0.45722812,0.7255814,0.7775589,0.109948486,0.2851043,0.6291014,0.62423563,0.36268318,-0.022946805,-0.10817164,-0.037535723,-0.21269107,-0.74232906],"result":{"type":"object","properties":{"summary":{"description":"The generated summary of the video","type":"string"}},"required":["summary"]},"sql_tables":[],"sql_queries":[],"file_inbox":null,"oauth":null,"assets":null},false]} \ No newline at end of file +{"type":"Deno","content":[{"name":"Youtube Transcript Summarizer","homepage":null,"author":"@@official.shinkai","version":"1.0.0","js_code":"import { YoutubeTranscript } from 'npm:youtube-transcript@1.2.1';\nimport { shinkaiLlmPromptProcessor } from './shinkai-local-tools.ts'\n\n// Tool does not need any configuration\ntype CONFIG = Record;\n\ntype INPUTS = {\n url: string;\n lang?: string;\n};\n\ntype OUTPUT = { summary: string };\n\nexport const run: Run = async (\n _configurations,\n parameters,\n): Promise => {\n console.log(`transcripting ${parameters.url}`);\n\n // Get transcription\n const transcript = await YoutubeTranscript.fetchTranscript(parameters.url, {\n lang: parameters.lang || 'en',\n });\n\n // Send to LLM to build a formatted response\n const message = `\n According to this transcription of a youtube video (which is in csv separated by ':::'):\n\n offset;text\n ${transcript.map((v) => `${Math.floor(v.offset)}:::${v.text}`).join('\\n')}\n ---------------\n\n The video URL is ${parameters.url}\n\n ---------------\n\n Write a detailed summary divided in sections along the video.\n Format the answer using markdown.\n Add markdown links referencing every section using this format https://www.youtube.com/watch?v={video_id}&t={offset} where 'offset' is a number and can be obtained from the transcription in csv format to generate the URL\n `;\n const response = await shinkaiLlmPromptProcessor({ format: 'text', prompt: message })\n return { summary: response.message }\n};\n","tools":["local:::__official_shinkai:::shinkai_llm_prompt_processor"],"config":[],"description":"Fetches the transcript of a YouTube video and generates a formatted summary using an LLM.","keywords":["youtube","transcript","summary","video","LLM"],"input_args":{"type":"object","properties":{"lang":{"type":"string","description":"The language for the transcript (optional)"},"url":{"type":"string","description":"The URL of the YouTube video"}},"required":["url"]},"output_arg":{"json":""},"activated":false,"embedding":[0.24397473,0.19737607,0.10249484,0.07853881,-0.52260065,-0.07264366,-1.4292128,0.5816098,-0.0569295,0.467394,-0.2629992,1.546936,0.030428365,0.18555912,0.5241776,0.40233222,-0.10415818,-0.7092806,-1.297857,-0.664604,0.52484876,0.5144266,-0.0060532093,-0.0029968247,0.13401021,-0.13712981,0.09876527,-0.22174498,-1.0573201,-1.9738672,0.70428807,0.54259884,-0.16001034,-0.37234327,-0.43517393,-1.3643596,0.25747937,0.46092734,-0.292954,0.4579779,-0.09054327,0.13232066,-0.7888382,0.40833142,-0.043910377,-0.19611594,0.36788312,-0.09296358,1.4296865,0.44269896,-0.40729654,-0.19846602,-0.10134886,0.49915153,-0.17917651,-0.61800796,-0.39331928,-0.5531162,0.93573284,0.3125194,-0.032507822,-0.024462327,-3.7117436,-0.23966308,-0.082733504,-0.00083688647,-0.2638889,-0.079310715,-0.04274538,0.38685042,-1.0061314,-0.09795482,-0.595692,0.8140711,-0.52223,-0.5010422,0.48327318,-0.30269998,0.26365638,-0.53166157,0.06926101,0.061586447,0.22167054,-0.38880783,-0.53398055,0.90134996,-0.47085276,-0.24938089,-0.13700266,0.26321328,-0.9187829,-0.030944848,0.6005912,0.34225106,-0.54002047,-0.3963846,0.6813786,-0.4724697,0.072636716,2.6400874,1.0521492,0.014715459,0.1956683,-1.1673645,0.4569034,-0.70678335,0.47124594,-0.42230985,0.31645888,0.0359073,0.78643477,-0.17552736,0.15710464,0.549718,0.51373,0.37795103,-0.81747603,0.024700543,0.03176478,0.36899906,-0.272966,-0.12973304,-0.39982963,-0.18365073,-0.46064875,0.14623581,-0.1908139,0.15239067,0.5717435,-0.7718099,-0.041600056,-0.055492602,-0.6733642,0.6702037,0.025288485,0.30686027,0.40308362,-0.8706652,0.31286785,-0.81772375,-0.18790466,-2.0614433,0.6394961,-0.018431015,0.34960693,-0.007028464,-0.61032754,0.37297478,-0.29247496,-0.465864,0.36508018,0.6427132,0.22788927,-0.08449084,0.88174784,-0.13330701,-0.72458035,-0.55865467,-0.20877361,0.050680257,-0.38116446,-0.07186862,0.624656,-0.3708253,0.2717578,-0.5983692,0.77082396,0.16514742,0.39356315,0.32194296,0.28758615,0.11886267,0.01459287,0.7468215,-0.025611265,-0.89384717,-0.4739496,-0.301784,-0.0015290305,0.29546043,0.48127237,0.2063696,-0.409744,-0.04899437,-0.23912765,0.6469834,0.09129079,0.24771339,0.96164113,0.7420727,-0.33983496,1.6778651,-1.1015447,-0.17468059,-0.111047395,0.09020809,-0.3394488,0.3813395,0.30324456,0.06054409,-0.9422036,-0.21234436,0.25479048,0.0029522553,-0.33134744,-0.64197415,-0.31880897,0.73515236,-0.370654,-0.61103266,0.49827653,-0.9070959,0.5150069,0.54918575,-0.0791596,-0.26136273,-0.038667,0.20681158,-0.7998123,0.15697767,0.31832293,-0.30024567,-0.13398749,-0.5464064,0.078004286,0.5013751,-0.5964775,0.7934169,0.18798716,-0.102526814,0.7516279,1.3288732,0.38466543,1.1970915,0.70729077,0.16436699,-0.4109063,0.31046456,-0.09760972,-0.2675225,0.18276238,0.25188726,0.069069535,0.28543174,0.2071175,-0.08041818,-0.6181666,0.043410942,-0.29807296,1.7043421,0.43463537,0.4075363,0.59444076,0.82585335,0.6737303,-0.36265337,-1.4637611,-0.29978368,-0.20907988,0.33043876,-0.750395,0.6137083,0.19155118,0.2934378,-0.5209952,-0.36604527,-0.69852865,-0.4371357,0.028415933,0.18738863,-0.30432528,0.49997562,-0.11741397,0.042816848,-0.4490757,0.4281727,0.18414852,0.42120722,-0.44500935,-0.9356021,0.004114732,-0.098933734,0.20038745,0.31341612,-0.7175617,-0.13790105,-0.078082725,-0.30331305,0.016176544,0.5784527,0.09730462,-0.46089923,-0.9954212,0.2812389,1.5212535,0.25866175,0.15545672,0.5862159,0.3469371,0.09966384,-0.93005514,0.027373465,-0.14089948,-0.49164492,-0.18993902,-0.6721664,0.91621786,-0.31503543,-0.43121752,0.4722464,-0.42334154,0.41654542,0.2577617,-0.2962021,0.46720228,-0.3402864,0.3280484,0.9959594,-0.17491736,-1.8942695,-0.035868153,-0.29466665,-0.25931674,-0.27141005,0.24185471,1.0774001,-0.64388967,0.6423959,0.24093969,1.5087445,0.11422682,-0.10210596,-0.35378647,0.08158391,0.7351494,-0.47266462,-0.18411069,-0.30488995,-0.7604541,-0.2951124,0.32563996,1.0398327,0.033854738,1.0128971,0.04701845,-0.2543579,-0.3876006,-1.0073549,0.6400236,-0.24982655,-0.3674008,0.75311905,-0.40171337,-0.31875148,0.7237389,0.8828592,0.5095583,-0.050843228,0.3896459,1.7165403,0.49974895,-0.35941413,0.277945,0.12831461,0.41759193,0.11227698,0.021763999,-0.5772322,0.04317443,-0.34799072,0.57283884,-0.45722812,0.7255814,0.7775589,0.109948486,0.2851043,0.6291014,0.62423563,0.36268318,-0.022946805,-0.10817164,-0.037535723,-0.21269107,-0.74232906],"result":{"type":"object","properties":{"summary":{"description":"The generated summary of the video","type":"string"}},"required":["summary"]},"sql_tables":[],"sql_queries":[],"file_inbox":null,"oauth":null,"assets":null,"runner":"any","operating_system":["linux","macos","windows"],"tool_set":""},false]} \ No newline at end of file diff --git a/tools/youtube-summary/metadata.json b/tools/youtube-summary/metadata.json index 3d0db687..b8416891 100644 --- a/tools/youtube-summary/metadata.json +++ b/tools/youtube-summary/metadata.json @@ -11,6 +11,9 @@ "video", "LLM" ], + "runner": "any", + "operating_system": ["linux", "macos", "windows"], + "tool_set": "", "configurations": { "type": "object", "properties": {},