Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/sovereign-intelligence/blob/main/docs/archive/drakestapleton.com-old/scripts/symphony_dispatch.py # sovereign-intelligence Front door to Drake Stapleton's sovereign stack. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `sovereign-intelligence / docs / archive / drakestapleton.com-old / scripts / symphony_dispatch.py` 92 lines ยท 3163 bytes Raw Blame History 1 #!/usr/bin/env python3 2 import sys 3 import json 4 import urllib.request 5 import time 6 7 def dispatch(prompt: str, system_prompt: str = None, target_file: str = None): 8 url = "http://127.0.0.1:18006/v1/chat/completions" 9 10 if not system_prompt: 11 system_prompt = ( 12 "You are AIEN, sovereign cognitive architecture on Grace Blackwell GB10. " 13 "Generate verified, high-performance native Rust code. " 14 "Strictly follow the unslop standard: zero em dashes, zero en dashes, affirmative voice." 15 ) 16 17 payload = { 18 "model": "atlas-lightning-omni", 19 "messages": [ 20 {"role": "system", "content": system_prompt}, 21 {"role": "user", "content": prompt} 22 ], 23 "max_tokens": 4096, 24 "temperature": 0.2, 25 "stream": True 26 } 27 28 req = urllib.request.Request( 29 url, 30 data=json.dumps(payload).encode("utf-8"), 31 headers={"Content-Type": "application/json"} 32 ) 33 34 print("=== AIEN ON SPARK (GB10) DISPATCH START ===") 35 print(f"Target: {target_file or stdout}") 36 37 reasoning_tokens = [] 38 content_tokens = [] 39 start_time = time.time() 40 41 with urllib.request.urlopen(req, timeout=120) as resp: 42 for line in resp: 43 line_str = line.decode("utf-8").strip() 44 if not line_str.startswith("data: "): 45 continue 46 data_str = line_str[6:] 47 if data_str == "[DONE]": 48 break 49 try: 50 chunk = json.loads(data_str) 51 delta = chunk["choices"][0].get("delta", {}) 52 if "reasoning" in delta and delta["reasoning"]: 53 sys.stdout.write(delta["reasoning"]) 54 sys.stdout.flush() 55 reasoning_tokens.append(delta["reasoning"]) 56 elif "content" in delta and delta["content"]: 57 content_tokens.append(delta["content"]) 58 except Exception: 59 pass 60 61 elapsed = time.time() - start_time 62 full_content = "".join(content_tokens) 63 print("\n=== AIEN REASONING COMPLETE ===") 64 print(f"Elapsed: {elapsed:.2f}s | Content length: {len(full_content)} chars") 65 66 if target_file and full_content: 67 # Strip markdown fences if present 68 clean_code = full_content.strip() 69 if clean_code.startswith("```"): 70 lines = clean_code.split("\n") 71 if lines[0].startswith("```"): 72 lines = lines[1:] 73 if lines and lines[-1].startswith("```"): 74 lines = lines[:-1] 75 clean_code = "\n".join(lines) 76 77 with open(target_file, "w", encoding="utf-8") as f: 78 f.write(clean_code) 79 print(f"Saved generated code to: {target_file}") 80 elif full_content: 81 print("=== AIEN FINAL OUTPUT ===") 82 print(full_content) 83 84 return full_content 85 86 if __name__ == "__main__": 87 if len(sys.argv) < 2: 88 print("Usage: symphony_dispatch.py [target_file]") 89 sys.exit(1) 90 prompt = sys.argv[1] 91 target = sys.argv[2] if len(sys.argv) > 2 else None 92 dispatch(prompt, target_file=target)