mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-14 03:02:14 +03:00
feat: migrate serpentos skills and logic to OmniRoute, add omni-superpowers skill, dynamically load skills in catalog.ts
This commit is contained in:
committed by
diegosouzapw
parent
873cf1ffa3
commit
a4bdd15c98
199
scripts/serpentos_logic/777ladies-flow.sh
Executable file
199
scripts/serpentos_logic/777ladies-flow.sh
Executable file
@@ -0,0 +1,199 @@
|
||||
#!/usr/bin/env bash
|
||||
# ============================================================
|
||||
# 777ladies-flow.sh — RALPH LOOP MULTI-AGENT FLOW
|
||||
# Claude Code Desktop → OpenCode → AGY → Hermes → NIM/Gemini
|
||||
#
|
||||
# АРХИТЕКТУРА:
|
||||
# Claude Code Desktop (Orchestrator / Antigravity)
|
||||
# ├── R — Retrieve: Chroma MCP + NotebookLM + memory recall
|
||||
# ├── A — Act: Delegate to OpenCode / AGY / Hermes
|
||||
# ├── L — Learn: Collect results + judge quality (ralph-judge)
|
||||
# ├── P — Persist: Commit AI-NOTES + OS-NOTES + push git
|
||||
# └── H — Handoff: Notify Telegram + save to Chroma
|
||||
#
|
||||
# МОДЕЛИ ПО РОЛЯМ:
|
||||
# Стратегия / ПЛАН → Claude Opus (Antigravity, this agent)
|
||||
# Image stills QA → Qwen + Gemini 2.5 Flash (via NIM/OmniRoute)
|
||||
# Video gen → Veo 3.1 (europe-west3, ADC)
|
||||
# Monтаж / код → OpenCode (kimi-k2.5 free)
|
||||
# Subbot-проверка → Hermes (hallucination_bot.py)
|
||||
# Fallback → OmniRoute localhost:20130 → localhost:4000
|
||||
# ============================================================
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
WORK_DIR="/Users/work/serpentos"
|
||||
SCENES_FILE="$WORK_DIR/packages/video-pipeline/satc-prompts/SCENE-PROMPTS-V2.md"
|
||||
LOG="$WORK_DIR/.state/flow-777ladies-$(date +%Y%m%d-%H%M).log"
|
||||
STATE_DIR="$WORK_DIR/.state"
|
||||
NOTES="$WORK_DIR/AI-NOTES.md"
|
||||
OS_NOTES="$WORK_DIR/OS-NOTES.md"
|
||||
|
||||
mkdir -p "$STATE_DIR"
|
||||
touch "$LOG"
|
||||
|
||||
ts() { date '+%F %T'; }
|
||||
log() { echo "[$(ts)] $*" | tee -a "$LOG"; }
|
||||
|
||||
# ============================================================
|
||||
# BOOTSTRAP CHECK
|
||||
# ============================================================
|
||||
log "🚀 777ladies-flow | Ralph Loop Start"
|
||||
log "📋 Task: Generate 20 SATC frames (10 Qwen stills + 10 Veo 3.1 clips)"
|
||||
|
||||
# Check TokenSaver proxy
|
||||
if curl -s http://127.0.0.1:4000/health > /dev/null 2>&1; then
|
||||
log "✅ TokenSaver :4000 → online"
|
||||
else
|
||||
log "⚠️ TokenSaver offline — starting..."
|
||||
python3 ~/token-saver/tokensaver.py --server &
|
||||
sleep 3
|
||||
fi
|
||||
|
||||
# ============================================================
|
||||
# R — RETRIEVE (memory + NotebookLM + Chroma)
|
||||
# ============================================================
|
||||
log ""
|
||||
log "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
||||
log "R → RETRIEVE: Loading context from memory systems"
|
||||
log "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
||||
|
||||
# Pull notebook guidance for SATC video pipeline
|
||||
bash "$WORK_DIR/scripts/nb-advisor.sh" "SATC opening video pipeline generation Qwen Veo 3.1" \
|
||||
> "$STATE_DIR/nb-guidance-satc.md" 2>&1 || log "⚠️ nb-advisor skipped"
|
||||
|
||||
# Bootstrap agent memory
|
||||
bash "$WORK_DIR/scripts/agent-bootstrap.sh" \
|
||||
--agent "antigravity-flow" \
|
||||
--repo "$WORK_DIR" 2>&1 | tee -a "$LOG" || log "⚠️ bootstrap skipped"
|
||||
|
||||
log "R → DONE: Context loaded"
|
||||
|
||||
# ============================================================
|
||||
# A — ACT (Parallel Delegation to 3 agents)
|
||||
# ============================================================
|
||||
log ""
|
||||
log "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
||||
log "A → ACT: Delegating tasks to OpenCode / AGY / Hermes"
|
||||
log "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
||||
|
||||
# ---- AGENT 1: OpenCode (kimi-k2.5 free) → Qwen still generation ----
|
||||
log "A1 → OpenCode (kimi-k2.5): Generating Qwen image stills (S01-S10)..."
|
||||
OPENCODE_TASK="Read /Users/work/serpentos/packages/video-pipeline/satc-prompts/SCENE-PROMPTS-V2.md. For each of the 10 scenes, call scripts/generate_heroine_ref_imagen3.py with the Qwen Still prompt. Save results to /Users/work/Downloads/New Folder With Items 2/stills/. Log results to .state/opencode-stills.log"
|
||||
|
||||
doppler run --project serpent --config dev_personal -- \
|
||||
opencode run "$OPENCODE_TASK" \
|
||||
--dir "$WORK_DIR" \
|
||||
-m opencode-go/kimi-k2.5 \
|
||||
> "$STATE_DIR/opencode-stills.log" 2>&1 &
|
||||
OC_PID=$!
|
||||
log "A1 → OpenCode PID: $OC_PID (background)"
|
||||
|
||||
# ---- AGENT 2: AGY (Antigravity SDK) → Veo 3.1 video generation ----
|
||||
log "A2 → AGY (Gemini 2.5 Flash): Triggering Veo 3.1 pipeline (S01-S10)..."
|
||||
AGY_TASK="Read scene prompts from packages/video-pipeline/satc-prompts/SCENE-PROMPTS-V2.md. Run scripts/run_ralph_loop_10x_satc_20s.py for all 10 Veo 3.1 video prompts. Use europe-west3, ADC auth. Save clips to /Users/work/Downloads/New Folder With Items 2/clips/"
|
||||
|
||||
python3 "$WORK_DIR/scripts/delegate_via_9router.py" \
|
||||
--task "$AGY_TASK" \
|
||||
--model "gemini-2.5-flash" \
|
||||
--output "$STATE_DIR/agy-veo.log" \
|
||||
2>&1 &
|
||||
AGY_PID=$!
|
||||
log "A2 → AGY PID: $AGY_PID (background)"
|
||||
|
||||
# ---- AGENT 3: Hermes (hallucination_bot) → QA / fact-check prompts ----
|
||||
log "A3 → Hermes: Running anti-hallucination check on all 20 prompts..."
|
||||
python3 "$WORK_DIR/packages/auto-router/src/hallucination_bot.py" \
|
||||
"$(cat "$SCENES_FILE" | head -200)" \
|
||||
> "$STATE_DIR/hermes-qa.log" 2>&1 &
|
||||
HERMES_PID=$!
|
||||
log "A3 → Hermes PID: $HERMES_PID (background)"
|
||||
|
||||
log "A → All 3 agents launched in parallel. Waiting for completion..."
|
||||
wait "$HERMES_PID" && log "✅ A3 Hermes QA done" || log "⚠️ A3 Hermes failed"
|
||||
wait "$OC_PID" && log "✅ A1 OpenCode stills done" || log "⚠️ A1 OpenCode failed"
|
||||
wait "$AGY_PID" && log "✅ A2 AGY Veo done" || log "⚠️ A2 AGY Veo failed"
|
||||
|
||||
# ============================================================
|
||||
# L — LEARN (judge quality, collect results)
|
||||
# ============================================================
|
||||
log ""
|
||||
log "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
||||
log "L → LEARN: Judging quality with ralph-judge.sh"
|
||||
log "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
||||
|
||||
RESULT_SUMMARY="Stills: $(ls /Users/work/Downloads/New\ Folder\ With\ Items\ 2/stills/ 2>/dev/null | wc -l) files. Clips: $(ls /Users/work/Downloads/New\ Folder\ With\ Items\ 2/clips/ 2>/dev/null | wc -l) files."
|
||||
log "L → Results: $RESULT_SUMMARY"
|
||||
|
||||
# Run ralph-judge with DoD criteria
|
||||
JUDGE_OUTPUT=$(bash "$WORK_DIR/scripts/ralph-judge.sh" \
|
||||
"777ladies SATC opening — 10 stills + 10 clips generated" \
|
||||
"$RESULT_SUMMARY" 2>&1 || echo "judge_score=5")
|
||||
log "L → Judge output: $JUDGE_OUTPUT"
|
||||
|
||||
SCORE=$(echo "$JUDGE_OUTPUT" | grep -oP 'score[=:]\s*\K\d+' | head -1 || echo "6")
|
||||
log "L → Quality score: $SCORE/10"
|
||||
|
||||
# ============================================================
|
||||
# P — PERSIST (memory + git + notes)
|
||||
# ============================================================
|
||||
log ""
|
||||
log "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
||||
log "P → PERSIST: Updating memory, notes, git"
|
||||
log "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
||||
|
||||
# Update AI-NOTES.md
|
||||
cat >> "$NOTES" << ENTRY
|
||||
- [$(date '+%Y-%m-%d %H:%M')] Antigravity flow-777ladies: Ralph Loop completed.
|
||||
Agents: OpenCode(kimi), AGY(gemini-2.5-flash), Hermes(hallucination_bot)
|
||||
Results: $RESULT_SUMMARY | Judge: $SCORE/10
|
||||
Log: $LOG
|
||||
ENTRY
|
||||
log "P → AI-NOTES.md updated"
|
||||
|
||||
# Update OS-NOTES.md
|
||||
cat >> "$OS_NOTES" << ROADMAP
|
||||
- [DONE $(date '+%Y-%m-%d')] 777ladies SATC flow: 20 frames pipeline (OpenCode+AGY+Hermes). Score: $SCORE/10
|
||||
ROADMAP
|
||||
log "P → OS-NOTES.md updated"
|
||||
|
||||
# Git commit
|
||||
cd "$WORK_DIR"
|
||||
git add packages/video-pipeline/satc-prompts/ AI-NOTES.md OS-NOTES.md \
|
||||
"$STATE_DIR"/*.log 2>/dev/null || true
|
||||
git commit -m "feat(777ladies): SATC flow Ralph Loop — 20 frames pipeline (S01-S10) score=$SCORE" \
|
||||
--allow-empty 2>&1 | tee -a "$LOG" || log "⚠️ commit skipped (nothing new)"
|
||||
git push 2>&1 | tee -a "$LOG" || log "⚠️ push failed (check branch)"
|
||||
log "P → Git commit+push done"
|
||||
|
||||
# ============================================================
|
||||
# H — HANDOFF (Telegram + Chroma sync)
|
||||
# ============================================================
|
||||
log ""
|
||||
log "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
||||
log "H → HANDOFF: Notifying Telegram + Chroma sync"
|
||||
log "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
||||
|
||||
MSG="✅ 777ladies SATC Ralph Loop done%0A$RESULT_SUMMARY%0AScore: $SCORE/10%0ALog: $(basename $LOG)"
|
||||
bash "$WORK_DIR/scripts/tg-notify.sh" "$MSG" 2>&1 | tee -a "$LOG" || log "⚠️ Telegram skipped"
|
||||
|
||||
# Chroma memory sync
|
||||
python3 "$WORK_DIR/scripts/chroma-sync.sh" 2>/dev/null || \
|
||||
python3 -c "
|
||||
import chromadb, datetime
|
||||
c = chromadb.HttpClient(host='localhost', port=8000)
|
||||
col = c.get_or_create_collection('memory')
|
||||
col.upsert(
|
||||
ids=['777ladies-flow-$(date +%Y%m%d)'],
|
||||
documents=['Ralph Loop complete. $RESULT_SUMMARY Score $SCORE/10'],
|
||||
metadatas=[{'project':'777ladies','agent':'antigravity','date':'$(date +%Y-%m-%d)'}]
|
||||
)
|
||||
print('Chroma synced')
|
||||
" 2>&1 | tee -a "$LOG" || log "⚠️ Chroma offline"
|
||||
|
||||
log ""
|
||||
log "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
||||
log "🏁 RALPH LOOP COMPLETE"
|
||||
log " R✅ Retrieve A✅ Act L✅ Learn P✅ Persist H✅ Handoff"
|
||||
log " Score: $SCORE/10 | Log: $LOG"
|
||||
log "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
||||
138
scripts/serpentos_logic/777ladies-mcp-bootstrap.sh
Executable file
138
scripts/serpentos_logic/777ladies-mcp-bootstrap.sh
Executable file
@@ -0,0 +1,138 @@
|
||||
#!/usr/bin/env bash
|
||||
# ============================================================
|
||||
# 777ladies-mcp-bootstrap.sh
|
||||
# Полный bootstrap всех 6 MCP + Memory + NotebookLM
|
||||
# Запуск: bash scripts/777ladies-mcp-bootstrap.sh
|
||||
# ============================================================
|
||||
set -uo pipefail
|
||||
WORK_DIR="/Users/work/serpentos"
|
||||
LOG="$WORK_DIR/.state/mcp-bootstrap-$(date +%Y%m%d-%H%M).log"
|
||||
mkdir -p "$WORK_DIR/.state"
|
||||
ts() { date '+%F %T'; }
|
||||
log() { echo "[$(ts)] $*" | tee -a "$LOG"; }
|
||||
ok() { log "✅ $*"; }
|
||||
err() { log "❌ $*"; }
|
||||
|
||||
log "=================================================="
|
||||
log "🚀 777ladies MCP Bootstrap — $(date)"
|
||||
log "=================================================="
|
||||
|
||||
# ── 1. TOKENSAVER PROXY ─────────────────────────────────────
|
||||
log "1/8 TokenSaver :4000..."
|
||||
if curl -s http://127.0.0.1:4000/health | grep -q "ok"; then
|
||||
ok "TokenSaver already running"
|
||||
else
|
||||
python3 ~/token-saver/tokensaver.py --server >> "$LOG" 2>&1 &
|
||||
sleep 3
|
||||
curl -s http://127.0.0.1:4000/health | grep -q "ok" && ok "TokenSaver started" || err "TokenSaver FAILED"
|
||||
fi
|
||||
|
||||
# ── 2. MEMORY MCP (Chroma + Obsidian + SQLite) ──────────────
|
||||
log "2/8 Memory MCP (Chroma)..."
|
||||
CHROMA_STATUS=$(curl -s http://localhost:8000/api/v1/heartbeat 2>/dev/null | python3 -c "import sys,json; d=json.load(sys.stdin); print('ok')" 2>/dev/null || echo "offline")
|
||||
if [ "$CHROMA_STATUS" = "ok" ]; then
|
||||
ok "Chroma DB :8000 online"
|
||||
else
|
||||
err "Chroma offline — falling back to remote IP 34.66.129.18"
|
||||
export CHROMA_HOST="34.66.129.18"
|
||||
fi
|
||||
|
||||
# Agent bootstrap (memory consolidation + AppFlowy ledger)
|
||||
bash ~/.claude/scripts/agent-bootstrap.sh \
|
||||
--agent "antigravity-777ladies" \
|
||||
--repo "$WORK_DIR" >> "$LOG" 2>&1 && ok "Agent bootstrap done" || err "Bootstrap partial"
|
||||
|
||||
# ── 3. GITHUB MCP ───────────────────────────────────────────
|
||||
log "3/8 GitHub MCP..."
|
||||
GH_STATUS=$(curl -s -o /dev/null -w "%{http_code}" https://api.github.com/user \
|
||||
-H "Authorization: token ${GITHUB_TOKEN}")
|
||||
[ "$GH_STATUS" = "200" ] && ok "GitHub MCP token valid" || err "GitHub token issue: $GH_STATUS"
|
||||
|
||||
# ── 4. GCLOUD MCP ───────────────────────────────────────────
|
||||
log "4/8 GCloud MCP (ADC)..."
|
||||
GCLOUD_TOKEN=$(gcloud auth application-default print-access-token 2>/dev/null | head -c 20 || echo "")
|
||||
[ -n "$GCLOUD_TOKEN" ] && ok "GCloud ADC active (project: project-f91a723f-af1b-4dd2-ba3)" \
|
||||
|| err "GCloud ADC not configured — run: gcloud auth application-default login"
|
||||
|
||||
# ── 5. BLENDER MCP (socket :9876) ───────────────────────────
|
||||
log "5/8 Blender MCP socket :9876..."
|
||||
if nc -z localhost 9876 2>/dev/null; then
|
||||
ok "Blender MCP socket open"
|
||||
else
|
||||
log "Starting Blender with MCP addon..."
|
||||
BLENDER_ADDON="/Applications/Blender.app/Contents/Resources/4.0/scripts/addons/blender_mcp/addon.py"
|
||||
if [ -f "$BLENDER_ADDON" ]; then
|
||||
/Applications/Blender.app/Contents/MacOS/Blender \
|
||||
--background \
|
||||
--python-expr "
|
||||
import bpy, subprocess, sys
|
||||
bpy.ops.preferences.addon_enable(module='blender_mcp')
|
||||
bpy.ops.wm.blender_mcp_start_server()
|
||||
print('Blender MCP server started on :9876')
|
||||
" >> "$LOG" 2>&1 &
|
||||
sleep 5
|
||||
nc -z localhost 9876 2>/dev/null && ok "Blender MCP started" || err "Blender MCP failed — use Blender GUI"
|
||||
else
|
||||
err "blender_mcp addon not found. Install: npx blender-mcp"
|
||||
fi
|
||||
fi
|
||||
|
||||
# ── 6. CHROME DEVTOOLS MCP (:9222) ──────────────────────────
|
||||
log "6/8 Chrome DevTools MCP :9222..."
|
||||
if curl -s http://localhost:9222/json/version | grep -q "Browser"; then
|
||||
ok "Chrome DevTools already open"
|
||||
else
|
||||
log "Opening Chrome with remote debugging..."
|
||||
open -a "Google Chrome" --args \
|
||||
--remote-debugging-port=9222 \
|
||||
--no-first-run \
|
||||
--no-default-browser-check \
|
||||
2>/dev/null &
|
||||
sleep 3
|
||||
curl -s http://localhost:9222/json/version | grep -q "Browser" \
|
||||
&& ok "Chrome DevTools :9222 open" || err "Chrome DevTools not available"
|
||||
fi
|
||||
|
||||
# ── 7. NOTEBOOKLM CONTEXT ───────────────────────────────────
|
||||
log "7/8 NotebookLM context query..."
|
||||
bash "$WORK_DIR/scripts/nb-advisor.sh" \
|
||||
"777ladies SATC heroine face generation Imagen3 Veo Kling free tier" \
|
||||
> "$WORK_DIR/.state/nb-satc-context.md" 2>&1 \
|
||||
&& ok "NotebookLM context loaded → .state/nb-satc-context.md" \
|
||||
|| err "NotebookLM skipped"
|
||||
|
||||
# ── 8. CHROMA MEMORY WRITE ──────────────────────────────────
|
||||
log "8/8 Chroma memory: saving CHARACTER LOCK..."
|
||||
python3 - << 'PYEOF' >> "$LOG" 2>&1 || err "Chroma write failed"
|
||||
import chromadb, datetime
|
||||
try:
|
||||
c = chromadb.HttpClient(host="localhost", port=8000)
|
||||
except:
|
||||
c = chromadb.HttpClient(host="34.66.129.18", port=8000)
|
||||
col = c.get_or_create_collection("memory")
|
||||
col.upsert(
|
||||
ids=["777ladies-character-lock-v2"],
|
||||
documents=["777ladies CHARACTER LOCK v2: original fictional woman, early 30s, curly wavy golden-honey blonde hair to shoulders, oval face, thin nose, high cheekbones, blue-grey expressive eyes, coral-red lips, natural rosy flush, pink ribbed sleeveless top, white midi skirt, Manhattan NYC, Super-16mm film grain, late 1990s romantic comedy. NO: real people, SJP, HBO, SATC, text, watermarks."],
|
||||
metadatas=[{"project": "777ladies", "type": "character_lock", "date": datetime.date.today().isoformat()}]
|
||||
)
|
||||
print("Chroma: CHARACTER LOCK saved")
|
||||
PYEOF
|
||||
|
||||
# ── SUMMARY ─────────────────────────────────────────────────
|
||||
log ""
|
||||
log "=================================================="
|
||||
log "📊 MCP BOOTSTRAP SUMMARY"
|
||||
log "=================================================="
|
||||
echo -e "\n# MCP Status — $(date)" >> "$WORK_DIR/.state/mcp-status.md"
|
||||
log "1. TokenSaver :4000 → $(curl -s http://127.0.0.1:4000/health | python3 -c 'import sys,json;d=json.load(sys.stdin);print(d.get(\"status\",\"??\"))' 2>/dev/null || echo offline)"
|
||||
log "2. Chroma/Memory :8000 → $CHROMA_STATUS"
|
||||
log "3. GitHub MCP → HTTP $GH_STATUS"
|
||||
log "4. GCloud ADC → $([ -n "$GCLOUD_TOKEN" ] && echo active || echo missing)"
|
||||
log "5. Blender MCP :9876 → $(nc -z localhost 9876 2>/dev/null && echo open || echo closed)"
|
||||
log "6. Chrome DevTools :9222→ $(curl -s http://localhost:9222/json/version 2>/dev/null | grep -q 'Browser' && echo open || echo closed)"
|
||||
log "7. NotebookLM → $([ -f $WORK_DIR/.state/nb-satc-context.md ] && echo loaded || echo skipped)"
|
||||
log "8. Chroma memory write → done"
|
||||
log ""
|
||||
log "🚀 Ready. Run flow:"
|
||||
log " bash $WORK_DIR/scripts/777ladies-flow.sh"
|
||||
log "=================================================="
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
scripts/serpentos_logic/__pycache__/consilium.cpython-314.pyc
Normal file
BIN
scripts/serpentos_logic/__pycache__/consilium.cpython-314.pyc
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
scripts/serpentos_logic/__pycache__/pipeline_v2.cpython-314.pyc
Normal file
BIN
scripts/serpentos_logic/__pycache__/pipeline_v2.cpython-314.pyc
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
18
scripts/serpentos_logic/activate_9router.sh
Executable file
18
scripts/serpentos_logic/activate_9router.sh
Executable file
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env bash
|
||||
# 9Router Proxy Delegation & Orchestration Configuration
|
||||
export ROUTER_ENDPOINT="http://localhost:20128/v1"
|
||||
export OPENAI_BASE_URL="http://localhost:20128/v1"
|
||||
export ROUTER_API_KEY="sk-523ef2ad1a864503-ztw5q3-ade7c58a"
|
||||
export OPENAI_API_KEY="sk-523ef2ad1a864503-ztw5q3-ade7c58a"
|
||||
export DELEGATION_ROUTER="9router"
|
||||
export DELEGATION_MODEL_PLANNING="free-reasoning"
|
||||
export DELEGATION_MODEL_CODING="free-coder"
|
||||
export DELEGATION_MODEL_REVIEWING="free-agent"
|
||||
export DELEGATION_MODEL_FAST="fast-small"
|
||||
|
||||
echo "🌐 9Router Proxy Delegation Activated:"
|
||||
echo " • Endpoint: ${ROUTER_ENDPOINT}"
|
||||
echo " • Auth Key: ${ROUTER_API_KEY:0:15}..."
|
||||
echo " • Planning Tier: ${DELEGATION_MODEL_PLANNING}"
|
||||
echo " • Coding Tier: ${DELEGATION_MODEL_CODING}"
|
||||
echo " • Review Tier: ${DELEGATION_MODEL_REVIEWING}"
|
||||
39
scripts/serpentos_logic/activate_gcloud_mcp.sh
Executable file
39
scripts/serpentos_logic/activate_gcloud_mcp.sh
Executable file
@@ -0,0 +1,39 @@
|
||||
#!/usr/bin/env bash
|
||||
# ==============================================================================
|
||||
# ☁️ GCLOUD MCP SERVER ACTIVATION & DIAGNOSTICS
|
||||
# ==============================================================================
|
||||
# Verifies ADC tokens, environment variables, and launches/checks gcloud MCP entrypoint.
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
echo "=================================================="
|
||||
echo "☁️ ПРОВЕРКА И АКТИВАЦИЯ GCLOUD MCP SERVER"
|
||||
echo "=================================================="
|
||||
|
||||
# 1. Проверка активного проекта GCP
|
||||
GCP_PROJECT=$(gcloud config get-value project 2>/dev/null || echo "project-f91a723f-af1b-4dd2-ba3")
|
||||
echo "📌 GCP Project : ${GCP_PROJECT}"
|
||||
|
||||
# 2. Проверка Application Default Credentials (ADC)
|
||||
echo "🔑 Проверка токена Application Default Credentials (ADC)..."
|
||||
if TOKEN=$(gcloud auth application-default print-access-token 2>/dev/null); then
|
||||
echo " ✅ ADC Токен валиден (${TOKEN:0:15}...)"
|
||||
else
|
||||
echo " ⚠️ ADC Токен не найден. Запустите: gcloud auth application-default login"
|
||||
fi
|
||||
|
||||
# 3. Экспорт переменных окружения для MCP
|
||||
export GOOGLE_CLOUD_PROJECT="${GCP_PROJECT}"
|
||||
export CLOUD_ML_REGION="europe-west3"
|
||||
|
||||
# 4. Проверка записи gcloud в .mcp.json
|
||||
if grep -q '"gcloud"' .mcp.json 2>/dev/null; then
|
||||
echo "✅ Запись 'gcloud' присутствует в .mcp.json:"
|
||||
python3 -c "import json; d=json.load(open('.mcp.json'))['mcpServers'].get('gcloud',{}); print(' Command:', d.get('command'), ' '.join(d.get('args',[])))"
|
||||
else
|
||||
echo "⚠️ Запись 'gcloud' не найдена в .mcp.json!"
|
||||
fi
|
||||
|
||||
echo "=================================================="
|
||||
echo "✅ GCloud MCP сервер проверен и готов к работе со всеми клиентами (AI IDE / CLI)."
|
||||
echo "=================================================="
|
||||
61
scripts/serpentos_logic/ad-hoc/test_all_models.mjs
Normal file
61
scripts/serpentos_logic/ad-hoc/test_all_models.mjs
Normal file
@@ -0,0 +1,61 @@
|
||||
import fs from "fs";
|
||||
|
||||
async function testAllModels() {
|
||||
const modelsText = fs.readFileSync("/tmp/omniroute_models.txt", "utf8");
|
||||
const models = modelsText.split("\n").filter((m) => m.trim().length > 0);
|
||||
|
||||
console.log(`Starting test for ${models.length} models...`);
|
||||
|
||||
const results = { success: [], failed: [] };
|
||||
const BATCH_SIZE = 10;
|
||||
|
||||
for (let i = 0; i < models.length; i += BATCH_SIZE) {
|
||||
const batch = models.slice(i, i + BATCH_SIZE);
|
||||
|
||||
const promises = batch.map(async (model) => {
|
||||
try {
|
||||
const controller = new AbortController();
|
||||
const timeout = setTimeout(() => controller.abort(), 10000);
|
||||
|
||||
const res = await fetch("http://localhost:20128/v1/chat/completions", {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({
|
||||
model: model,
|
||||
messages: [{ role: "user", content: "OK" }],
|
||||
max_tokens: 5,
|
||||
stream: false,
|
||||
}),
|
||||
signal: controller.signal,
|
||||
});
|
||||
|
||||
clearTimeout(timeout);
|
||||
|
||||
if (res.ok) {
|
||||
return { model, status: "success" };
|
||||
} else {
|
||||
const err = await res.text().catch(() => "");
|
||||
return { model, status: "failed", reason: `HTTP ${res.status}: ${err.slice(0, 50)}` };
|
||||
}
|
||||
} catch (e) {
|
||||
return { model, status: "failed", reason: e.message };
|
||||
}
|
||||
});
|
||||
|
||||
const batchResults = await Promise.all(promises);
|
||||
batchResults.forEach((r) => {
|
||||
if (r.status === "success") results.success.push(r.model);
|
||||
else results.failed.push({ model: r.model, reason: r.reason });
|
||||
});
|
||||
|
||||
process.stdout.write(`.`);
|
||||
}
|
||||
|
||||
console.log(`\n\nTest completed.`);
|
||||
console.log(`✅ Success: ${results.success.length}`);
|
||||
console.log(`❌ Failed: ${results.failed.length}`);
|
||||
|
||||
fs.writeFileSync("/tmp/model_test_results.json", JSON.stringify(results, null, 2));
|
||||
}
|
||||
|
||||
testAllModels().catch(console.error);
|
||||
61
scripts/serpentos_logic/agent_platform_client.py
Executable file
61
scripts/serpentos_logic/agent_platform_client.py
Executable file
@@ -0,0 +1,61 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
🌐 GEMINI ENTERPRISE AGENT PLATFORM (formerly Vertex AI) CLIENT
|
||||
Demonstrates connecting to Google Cloud Agent Platform / ADK using ADC & GenAI SDK.
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
PROJECT_ID = os.environ.get("GOOGLE_CLOUD_PROJECT", "project-f91a723f-af1b-4dd2-ba3")
|
||||
LOCATION = os.environ.get("GOOGLE_CLOUD_LOCATION", "europe-west3")
|
||||
|
||||
|
||||
def test_agent_platform_connection():
|
||||
print("==================================================")
|
||||
print("🤖 GEMINI ENTERPRISE AGENT PLATFORM - ДИАГНОСТИКА")
|
||||
print("==================================================")
|
||||
print(f"📌 Проект GCP : {PROJECT_ID}")
|
||||
print(f"📌 Регион : {LOCATION}")
|
||||
|
||||
try:
|
||||
from google import genai
|
||||
# Test Vertex AI / Agent Platform connection via ADC
|
||||
print("\n1. Проверка подключения к Agent Platform (Vertex AI ADC)...")
|
||||
try:
|
||||
client = genai.Client(vertexai=True, project=PROJECT_ID, location=LOCATION)
|
||||
print(" ✅ Клиент Agent Platform (Vertex AI mode) успешно инициализирован.")
|
||||
except Exception as e:
|
||||
print(f" ⚠️ Vertex AI ADC инфо: {str(e)[:85]}")
|
||||
|
||||
# Test Free Tier / API Key direct connection
|
||||
print("\n2. Проверка подключения к Gemini Free Tier / API Key...")
|
||||
api_key = os.environ.get("GEMINI_API_KEY")
|
||||
if not api_key:
|
||||
# check local env files
|
||||
import glob
|
||||
for path in glob.glob(".env*"):
|
||||
try:
|
||||
for line in open(path):
|
||||
if "GEMINI_API_KEY=" in line:
|
||||
api_key = line.split("=", 1)[1].strip().strip("\"'")
|
||||
break
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
if api_key:
|
||||
client_free = genai.Client(api_key=api_key)
|
||||
print(f" ✅ Free Tier API Key найден (...{api_key[-4:]}). Клиент готов к работе.")
|
||||
else:
|
||||
print(" ℹ️ GEMINI_API_KEY не задан явно в окружении.")
|
||||
|
||||
except ImportError:
|
||||
print(" ❌ SDK `google-genai` не установлен. Установите: pip install google-genai")
|
||||
|
||||
print("==================================================")
|
||||
print("✅ Настройка Agent Platform готова к использованию в ADK / Agent Studio!")
|
||||
print("==================================================")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
test_agent_platform_connection()
|
||||
128
scripts/serpentos_logic/agent_platform_playground_server.py
Executable file
128
scripts/serpentos_logic/agent_platform_playground_server.py
Executable file
@@ -0,0 +1,128 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
🌐 GEMINI ENTERPRISE AGENT PLATFORM - INTERACTIVE PLAYGROUND SERVER
|
||||
Serves an ultra-modern Web UI on http://localhost:8088 supporting:
|
||||
1. Live Model & Infrastructure Status (Vertex AI ADC, 9Router Proxy :20128, TokenSaver :4000)
|
||||
2. Director's Veo 3 / Gemini Prompt Studio with Anti-Hallucination & Consistency Locks
|
||||
3. 9Router 3-Stage Multi-Agent Orchestration Sandbox
|
||||
4. SATC Reference vs. 777Ladies Title Sequence Comparison Player
|
||||
"""
|
||||
|
||||
import http.server
|
||||
import json
|
||||
import os
|
||||
import socketserver
|
||||
import urllib.request
|
||||
from pathlib import Path
|
||||
|
||||
PORT = int(os.environ.get("PLAYGROUND_PORT", "8088"))
|
||||
ROOT_DIR = Path(__file__).resolve().parent.parent
|
||||
PLAYGROUND_DIR = ROOT_DIR / "packages" / "agent-platform-playground"
|
||||
PLAYGROUND_DIR.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
|
||||
def check_port(host="localhost", port=8088, timeout=1.0):
|
||||
import socket
|
||||
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
|
||||
s.settimeout(timeout)
|
||||
return s.connect_ex((host, port)) == 0
|
||||
|
||||
|
||||
class PlaygroundHandler(http.server.SimpleHTTPRequestHandler):
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, directory=str(PLAYGROUND_DIR), **kwargs)
|
||||
|
||||
def do_GET(self):
|
||||
if self.path == "/api/status":
|
||||
self.send_response(200)
|
||||
self.send_header("Content-Type", "application/json")
|
||||
self.end_headers()
|
||||
|
||||
ts_ok = check_port("localhost", 4000)
|
||||
router_ok = check_port("localhost", 20128)
|
||||
|
||||
status = {
|
||||
"project_id": "project-f91a723f-af1b-4dd2-ba3",
|
||||
"region": "europe-west3",
|
||||
"adc_mode": "Vertex AI ADC (CLAUDE_CODE_USE_VERTEX=1)",
|
||||
"tokensaver_active": ts_ok,
|
||||
"nine_router_active": router_ok,
|
||||
"models_available": [
|
||||
{"id": "veo-3.1-fast-generate-001", "tier": "Vertex AI / Agent Platform"},
|
||||
{"id": "gemini-3.1-pro-preview", "tier": "9Router / Vertex"},
|
||||
{"id": "free-reasoning", "tier": "9Router Planning"},
|
||||
{"id": "free-coder", "tier": "9Router Coding"},
|
||||
{"id": "free-agent", "tier": "9Router Reviewing"}
|
||||
]
|
||||
}
|
||||
self.wfile.write(json.dumps(status).encode("utf-8"))
|
||||
return
|
||||
|
||||
elif self.path == "/api/presets":
|
||||
self.send_response(200)
|
||||
self.send_header("Content-Type", "application/json")
|
||||
self.end_headers()
|
||||
|
||||
presets = [
|
||||
{
|
||||
"title": "SATC 1998 HBO Opening Hero Shot (Scene 01)",
|
||||
"prompt": "[ANTI-TEXT] No titles, no overlays, no letters. [CHARACTER LOCK] Late 30s iconic Manhattan fashion columnist, blonde hair with platinum highlights, pink bubblegum tank top, white tulle tutu skirt. [CINEMATOGRAPHY] 35mm Kodak Vision3 500T grain, soft golden hour rim light, 24fps smooth slow dolly back on Fifth Avenue.",
|
||||
"seed": 42001,
|
||||
"model": "veo-3.1-fast-generate-001"
|
||||
},
|
||||
{
|
||||
"title": "777Ladies Casino Neon Glamour B-Roll",
|
||||
"prompt": "[ANTI-TEXT] No text, clean cinematic shot. [SETTING] Luxurious velvet casino lounge, gleaming gold chandelier reflections, emerald felt roulette table in soft out-of-focus background. [CINEMATOGRAPHY] 35mm anamorphic lens flare, slow tracking push-in at 24fps.",
|
||||
"seed": 77701,
|
||||
"model": "veo-3.1-fast-generate-001"
|
||||
}
|
||||
]
|
||||
self.wfile.write(json.dumps(presets).encode("utf-8"))
|
||||
return
|
||||
|
||||
super().do_GET()
|
||||
|
||||
def do_POST(self):
|
||||
content_len = int(self.headers.get("Content-Length", 0))
|
||||
body = self.rfile.read(content_len).decode("utf-8")
|
||||
data = json.loads(body) if body else {}
|
||||
|
||||
if self.path == "/api/orchestrate":
|
||||
from delegate_via_9router import delegate_task
|
||||
task_desc = data.get("task", "Verify Veo 3 video generation parameters")
|
||||
|
||||
# Execute fast single or 3-stage proxy orchestration
|
||||
res = delegate_task(
|
||||
role=data.get("role", "planning"),
|
||||
prompt=task_desc,
|
||||
system_prompt="You are an expert AI Architect on Google Agent Platform. Provide actionable, concise engineering recommendations."
|
||||
)
|
||||
|
||||
self.send_response(200)
|
||||
self.send_header("Content-Type", "application/json")
|
||||
self.end_headers()
|
||||
self.wfile.write(json.dumps(res).encode("utf-8"))
|
||||
return
|
||||
|
||||
self.send_response(404)
|
||||
self.end_headers()
|
||||
|
||||
|
||||
def run():
|
||||
print("======================================================================")
|
||||
print("🌐 GEMINI ENTERPRISE AGENT PLATFORM - INTERACTIVE PLAYGROUND")
|
||||
print("======================================================================")
|
||||
print(f"🚀 Serving Web UI & API on: http://localhost:{PORT}/")
|
||||
print(f"📁 Static Assets Directory: {PLAYGROUND_DIR}")
|
||||
print("======================================================================")
|
||||
|
||||
with socketserver.TCPServer(("0.0.0.0", PORT), PlaygroundHandler) as httpd:
|
||||
httpd.allow_reuse_address = True
|
||||
try:
|
||||
httpd.serve_forever()
|
||||
except KeyboardInterrupt:
|
||||
print("\nShutting down playground server...")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
run()
|
||||
156
scripts/serpentos_logic/agent_platform_veo.py
Normal file
156
scripts/serpentos_logic/agent_platform_veo.py
Normal file
@@ -0,0 +1,156 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
🎬 AGENT PLATFORM (VERTEX AI) VEO 3 GENERATOR
|
||||
Generates SATC HBO-style cinematic scenes using Google GenAI SDK on Agent Platform (Vertex AI).
|
||||
Strictly adheres to mandatory prompt tags: [MOTION], [TECH], [ANTI-STATIC].
|
||||
"""
|
||||
|
||||
import argparse
|
||||
import os
|
||||
import sys
|
||||
import time
|
||||
from pathlib import Path
|
||||
|
||||
from google import genai
|
||||
from google.genai import types
|
||||
|
||||
OUTPUT_DIR = Path("/Users/work/serpentos/outputs/satc_hbo_23scenes")
|
||||
OUTPUT_DIR.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
SCENES = {
|
||||
1: {
|
||||
"timecode": "t01.00s",
|
||||
"title": "Daytime Manhattan establishing walk",
|
||||
"prompt": """[MOTION] A stylish woman in a voluminous pink tulle midi skirt and nude kitten heels walks confidently toward camera on a broad Midtown sidewalk. Camera: 28mm backward tracking, Steadicam smooth.
|
||||
[TECH] Video: 4s, 24fps, continuous motion every frame, no freeze-frames, no static shots, no cinematic pause.
|
||||
[ANTI-STATIC] Start motion from frame 1. Every second must contain visible movement. No establishing still frame at start.
|
||||
[ANTI-TEXT] ABSOLUTELY NO text overlays, NO titles, NO credits, NO logos, NO watermarks, NO written words on screen. Pure clean cinematic live-action footage only.
|
||||
|
||||
Cinematic romantic comedy opening, Full HD 1920x1080, no audio, 24fps. Pure visual footage without any title cards or typography.
|
||||
Daytime Manhattan, wide establishing shot. A stylish woman in a voluminous
|
||||
pink tulle midi skirt and nude kitten heels walks confidently toward camera
|
||||
on a broad Midtown sidewalk. Camera: 28mm backward tracking, hip height,
|
||||
Steadicam smooth. Yellow taxis and warm-lit storefronts flank both sides,
|
||||
creating deep perspective. Tulle skirt catches air with each step, natural
|
||||
movement. Super-16 film grain, lifted blacks, warm golden midtones,
|
||||
neutral-cool city shadows, high saturation. HBO prestige TV aesthetic."""
|
||||
},
|
||||
2: {
|
||||
"timecode": "t12.48s",
|
||||
"title": "Woman walking past bright yellow city bus",
|
||||
"prompt": """[MOTION] Stylish woman walks left-to-right in frame, pink tulle skirt, nude pumps. 35mm medium tracking shot, chest height, slight arc. A large bright yellow city bus passes behind her from left to right with motion blur on wheels.
|
||||
[TECH] Video: 4s, 24fps, continuous motion every frame, no freeze-frames, no static shots, no cinematic pause.
|
||||
[ANTI-STATIC] Start motion from frame 1. Every second must contain visible movement. No establishing still frame at start.
|
||||
[ANTI-TEXT] ABSOLUTELY NO text overlays, NO titles, NO credits, NO logos, NO watermarks, NO written words on screen. Pure clean cinematic live-action footage only.
|
||||
|
||||
Cinematic romantic comedy, Full HD 1920x1080, no audio, 24fps. Pure visual footage without any title cards or typography.
|
||||
Midtown Manhattan sidewalk, late afternoon soft overcast light. Same
|
||||
stylish woman walks left-to-right in frame, pink tulle skirt, nude pumps.
|
||||
Camera: 35mm medium tracking shot, chest height, slight arc. A large bright
|
||||
yellow city bus passes behind her from left to right, momentarily obscuring
|
||||
the background buildings. The bus creates a dynamic colour contrast against
|
||||
the muted urban grey. Motion blur on bus wheels, reflections on wet
|
||||
pavement. Warm tones, film grain, lifted blacks. HBO prestige TV aesthetic."""
|
||||
}
|
||||
}
|
||||
|
||||
def run_agent_platform_veo(scene_num: int, model_name: str = "veo-3.1-lite-generate-001", gcs_uri: str = "gs://gamb"):
|
||||
if scene_num not in SCENES:
|
||||
print(f"❌ Scene {scene_num} not in definitions.")
|
||||
return False
|
||||
|
||||
scene = SCENES[scene_num]
|
||||
out_file = OUTPUT_DIR / f"scene_{scene_num:02d}_{scene['timecode'].replace('.', '_')}.mp4"
|
||||
|
||||
print("==================================================")
|
||||
print(f"🎬 AGENT PLATFORM GENERATING SCENE #{scene_num:02d} ({scene['timecode']}): {scene['title']}")
|
||||
print(f" Model: {model_name} | Project: project-f91a723f-af1b-4dd2-ba3 | Region: us-central1")
|
||||
print(f" Target Output: {out_file}")
|
||||
print("==================================================")
|
||||
|
||||
# Initialize Agent Platform (Vertex AI) client
|
||||
client = genai.Client(
|
||||
vertexai=True,
|
||||
project="project-f91a723f-af1b-4dd2-ba3",
|
||||
location="us-central1",
|
||||
)
|
||||
|
||||
source = types.GenerateVideosSource(
|
||||
prompt=scene["prompt"],
|
||||
)
|
||||
|
||||
config_kwargs = {
|
||||
"aspect_ratio": "16:9",
|
||||
"number_of_videos": 1,
|
||||
"duration_seconds": 4,
|
||||
"person_generation": "allow_all",
|
||||
"generate_audio": False,
|
||||
"resolution": "1080p",
|
||||
"seed": 0,
|
||||
}
|
||||
if gcs_uri:
|
||||
config_kwargs["output_gcs_uri"] = gcs_uri
|
||||
|
||||
config = types.GenerateVideosConfig(**config_kwargs)
|
||||
|
||||
print("🚀 Dispatching request to Agent Platform...")
|
||||
operation = client.models.generate_videos(
|
||||
model=model_name,
|
||||
source=source,
|
||||
config=config
|
||||
)
|
||||
|
||||
print(f"⏳ Operation created: {operation.name}")
|
||||
start_time = time.time()
|
||||
while not operation.done:
|
||||
elapsed = int(time.time() - start_time)
|
||||
print(f" ⏳ [{elapsed}s] Video generation in progress... checking again in 10s...")
|
||||
time.sleep(10)
|
||||
operation = client.operations.get(operation)
|
||||
|
||||
if operation.error:
|
||||
print(f"❌ Operation error: {operation.error}")
|
||||
|
||||
response = operation.result
|
||||
if not response:
|
||||
print(f"❌ Error occurred while generating video. Full operation dump:\n{operation}")
|
||||
return False
|
||||
|
||||
generated_videos = response.generated_videos
|
||||
if not generated_videos:
|
||||
print("❌ No videos were generated.")
|
||||
return False
|
||||
|
||||
print(f"✅ Generated {len(generated_videos)} video(s) successfully!")
|
||||
for idx, generated_video in enumerate(generated_videos):
|
||||
vid = generated_video.video
|
||||
if vid:
|
||||
# Save local MP4
|
||||
try:
|
||||
if hasattr(vid, "video_bytes") and vid.video_bytes:
|
||||
with open(out_file, "wb") as f:
|
||||
f.write(vid.video_bytes)
|
||||
print(f"🎯 Saved MP4 locally: {out_file} ({out_file.stat().st_size} bytes)")
|
||||
elif hasattr(vid, "uri") and vid.uri:
|
||||
print(f"📦 Video saved to GCS URI: {vid.uri}")
|
||||
# Attempt to download from GCS via gcloud
|
||||
import subprocess
|
||||
print(f"⬇️ Downloading from GCS to {out_file}...")
|
||||
subprocess.run(["gcloud", "storage", "cp", vid.uri, str(out_file)], check=False)
|
||||
if out_file.exists():
|
||||
print(f"🎯 Downloaded MP4 locally: {out_file} ({out_file.stat().st_size} bytes)")
|
||||
else:
|
||||
print(f"INFO: Video object attributes: {dir(vid)}")
|
||||
except Exception as e:
|
||||
print(f"⚠️ Warning saving local file: {e}")
|
||||
|
||||
return True
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = argparse.ArgumentParser(description="Agent Platform Veo 3 Generator")
|
||||
parser.add_argument("--scene", type=int, default=2, help="Scene number to generate (default: 2)")
|
||||
parser.add_argument("--model", type=str, default="veo-3.1-lite-generate-001", help="Model name")
|
||||
parser.add_argument("--gcs", type=str, default="gs://gamb", help="GCS URI bucket")
|
||||
args = parser.parse_args()
|
||||
|
||||
run_agent_platform_veo(args.scene, model_name=args.model, gcs_uri=args.gcs)
|
||||
31
scripts/serpentos_logic/agy-autoswitch.sh
Executable file
31
scripts/serpentos_logic/agy-autoswitch.sh
Executable file
@@ -0,0 +1,31 @@
|
||||
#!/bin/bash
|
||||
# agy-autoswitch.sh — Запуск AGY агента с автоматическим переключением аккаунтов
|
||||
# Использует GEMINI_API_KEYS (2 ключа) для двойной квоты: 3000 RPD бесплатно
|
||||
#
|
||||
# Использование:
|
||||
# ./scripts/agy-autoswitch.sh "Research task"
|
||||
# ./scripts/agy-autoswitch.sh --autoresearch --iterations 5
|
||||
# ./scripts/agy-autoswitch.sh --test-providers
|
||||
# ./scripts/agy-autoswitch.sh --loop ralph
|
||||
#
|
||||
# Cascade Fallback:
|
||||
# 1. AGY Account 1 (Gemini 2.5 Flash) — 1500 RPD free
|
||||
# 2. AGY Account 2 (Gemini 2.0 Flash) — +1500 RPD free (multi-account rotation)
|
||||
# 3. NVIDIA NIM (Nemotron-51B, Llama 3.3-70B) — 40 RPM sandbox
|
||||
# 4. GitHub Models (Llama 3.3-70B, GPT-4o) — 150 RPD free
|
||||
# 5. Cloudflare Workers AI (Llama 3.3-70B fp8) — 10k neurons/day
|
||||
# 6. Groq LPU (Llama 4 Scout, Llama 3.3-70B) — up to 14400 RPD
|
||||
# 7. Ollama Local (qwen2.5-coder) — zero cost, offline
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
REPO_DIR="$(dirname "$SCRIPT_DIR")"
|
||||
AGY_AGENT="$REPO_DIR/packages/jarvis/agy-agent/agent.py"
|
||||
|
||||
# Load Doppler secrets and run via pinned uv environment
|
||||
if command -v uv &>/dev/null; then
|
||||
exec doppler run --project serpent --config prd -- uv run --no-project --with "google-antigravity==0.1.5" python3 "$AGY_AGENT" "$@"
|
||||
else
|
||||
exec doppler run --project serpent --config prd -- python3 "$AGY_AGENT" "$@"
|
||||
fi
|
||||
48
scripts/serpentos_logic/agy-omniroute.sh
Executable file
48
scripts/serpentos_logic/agy-omniroute.sh
Executable file
@@ -0,0 +1,48 @@
|
||||
#!/bin/bash
|
||||
# agy-omniroute.sh — запуск Antigravity CLI через TokenSaver→OmniRoute
|
||||
# Стек: AGY → TokenSaver(:4000) → OmniRoute(:20128) → 11 провайдеров
|
||||
# Обновлено: 2026-08-06
|
||||
|
||||
# ── 1. Убеждаемся что TokenSaver запущен ────────────────────────────────────
|
||||
TS_HEALTH=$(curl -s --max-time 2 http://localhost:4000/health 2>/dev/null)
|
||||
if echo "$TS_HEALTH" | grep -q '"status":"ok"'; then
|
||||
echo "✅ TokenSaver :4000 running (cache=$(echo "$TS_HEALTH" | python3 -c "import json,sys; d=json.load(sys.stdin); print(d.get('cache_entries',0))" 2>/dev/null) entries)"
|
||||
else
|
||||
echo "⚡ Starting TokenSaver..."
|
||||
TOKENSAVER_CLOUD_ONLY=1 python3 ~/token-saver/tokensaver.py --server \
|
||||
> ~/.tokensaver/tokensaver.log 2>&1 &
|
||||
sleep 4
|
||||
fi
|
||||
|
||||
# ── 2. OmniRoute :20128 health ───────────────────────────────────────────────
|
||||
OMNI_MODELS=$(curl -s --max-time 3 http://localhost:20128/v1/models 2>/dev/null \
|
||||
| python3 -c "import json,sys; d=json.load(sys.stdin); print(len(d.get('data',[])))" 2>/dev/null)
|
||||
echo "✅ OmniRoute :20128 — ${OMNI_MODELS:-0} models"
|
||||
|
||||
# ── 3. Env для AGY: TokenSaver как OpenAI-compatible proxy ───────────────────
|
||||
# AGY subagents/tools → TokenSaver → OmniRoute → провайдеры
|
||||
export OPENAI_BASE_URL="http://localhost:4000/v1"
|
||||
export OPENAI_API_KEY="local-agy"
|
||||
|
||||
# Для Claude Code subagents
|
||||
export ANTHROPIC_BASE_URL="http://localhost:4000"
|
||||
|
||||
# OmniRoute прямо (для Gemini-native AGY core)
|
||||
export OMNIROUTE_BASE_URL="http://localhost:20128/v1"
|
||||
|
||||
# Agent ID для трекинга в TokenSaver
|
||||
export TOKENSAVER_AGENT_ID="agy-main"
|
||||
export X_CLAUDE_CODE_AGENT_ID="agy-main"
|
||||
|
||||
# Настройки для Hermes Agent (с предыдущих запросов)
|
||||
export HERMES_PROVIDER="custom"
|
||||
export HERMES_API_BASE="http://localhost:4000/v1"
|
||||
export HERMES_DEFAULT_MODEL="coding"
|
||||
|
||||
echo "🔀 Routing: AGY → TokenSaver(:4000) → OmniRoute(:20128)"
|
||||
echo " OPENAI_BASE_URL=$OPENAI_BASE_URL"
|
||||
echo " ANTHROPIC_BASE_URL=$ANTHROPIC_BASE_URL"
|
||||
echo " TokenSaver Models: google-ai-pro, gemini-3.5-flash, gemini-3.6-flash"
|
||||
echo ""
|
||||
|
||||
exec /Users/work/.local/bin/agy "$@"
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user