Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# OpenRouter API Key
OPENROUTER_API_KEY=your_openrouter_api_key_here

# PostgreSQL Database
DATABASE_URL=postgresql://user:password@localhost:5432/autonomoussphere

# S3 / MinIO Object Storage
S3_ENDPOINT=http://localhost:9000
S3_BUCKET=artifacts
S3_ACCESS_KEY=minioadmin
S3_SECRET_KEY=minioadmin

# Redis
REDIS_URL=redis://localhost:6379

# Security
JWT_SECRET=a_very_secret_key_for_jwt

# CORS Origin
ORIGIN=http://localhost:3000
31 changes: 0 additions & 31 deletions Dockerfile

This file was deleted.

66 changes: 0 additions & 66 deletions api/api.py

This file was deleted.

20 changes: 20 additions & 0 deletions apps/agents/prose/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Use an official Python runtime as a parent image
FROM python:3.9-slim

# Set the working directory in the container
WORKDIR /app

# Copy the requirements file into the container
COPY requirements.txt .

# Install any needed packages specified in requirements.txt
RUN pip install --no-cache-dir -r requirements.txt

# Copy the rest of the application code into the container
COPY . .

# Expose port 8000 to the outside world
EXPOSE 8000

# Run main.py when the container launches
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]
50 changes: 50 additions & 0 deletions apps/agents/prose/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
from fastapi import FastAPI
from pydantic import BaseModel
from typing import Dict, Any

app = FastAPI(
title="Prose Agent",
description="Drafts scenes based on a provided bundle of inputs.",
version="0.1.0"
)

class TaskEnvelope(BaseModel):
# A simplified version of the contract for now
task_id: str
goal: str
inputs: Dict[str, Any]

@app.get("/health")
async def health_check():
"""Basic health check endpoint."""
return {"status": "ok"}

@app.post("/v1/draft")
async def draft_scene(task: TaskEnvelope):
"""
(Placeholder) Receives a task envelope and drafts a scene.

In a real implementation, this would:
1. Use the openrouter-client to call an LLM.
2. Pass the inputs (lore, voice, outline) to the LLM.
3. Use the prompt template from the blueprint.
4. Return an AgentReport with the generated artifact.
"""
print(f"Prose agent received task: {task.goal}")

# Placeholder for the generated markdown
scene_md = f"---\nscene_id: placeholder\n---\n\nThis is a placeholder scene for goal: {task.goal}"

# Placeholder for the AgentReport
report = {
"type": "report.v1",
"task_id": task.task_id,
"artifact": {
"type": "scene_draft",
"content": scene_md, # In reality, this would be a path to S3
"meta": { "agent_role": "prose" }
},
"logs": ["Drafted scene using placeholder logic."],
"needs": []
}
return report
3 changes: 3 additions & 0 deletions apps/agents/prose/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
fastapi==0.110.0
uvicorn[standard]==0.29.0
pydantic==2.6.4
20 changes: 20 additions & 0 deletions apps/showrunner/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Use an official Python runtime as a parent image
FROM python:3.9-slim

# Set the working directory in the container
WORKDIR /app

# Copy the requirements file into the container
COPY requirements.txt .

# Install any needed packages specified in requirements.txt
RUN pip install --no-cache-dir -r requirements.txt

# Copy the rest of the application code into the container
COPY . .

# Expose port 8000 to the outside world
EXPOSE 8000

# Run main.py when the container launches
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]
40 changes: 40 additions & 0 deletions apps/showrunner/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
from fastapi import FastAPI
from pydantic import BaseModel
import httpx # To call other agents/tools

app = FastAPI(
title="Showrunner",
description="Orchestrates the novel-writing process by routing tasks to specialized agents.",
version="0.1.0"
)

# We can re-use the contract definitions later, for now a simple model
class Task(BaseModel):
task_id: str
goal: str

@app.get("/health")
async def health_check():
"""Basic health check endpoint."""
return {"status": "ok"}

@app.post("/v1/tasks")
async def process_task(task: Task):
"""
(Placeholder) Receives a task and orchestrates the workflow.

In a real implementation, this would:
1. Look up the project and session.
2. Freeze the inputs into a "bundle".
3. Call the appropriate agent (e.g., 'prose' agent) with a TaskEnvelope.
4. Aggregate reviews and control canon bumps.
"""
print(f"Showrunner received task: {task.goal}")

# Example of calling another service (e.g., prose agent)
# prose_agent_url = "http://prose:8000/v1/draft"
# async with httpx.AsyncClient() as client:
# response = await client.post(prose_agent_url, json=task.dict())
# print(f"Prose agent responded: {response.json()}")

return {"status": "task received", "task_id": task.task_id}
4 changes: 4 additions & 0 deletions apps/showrunner/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
fastapi==0.110.0
uvicorn[standard]==0.29.0
pydantic==2.6.4
httpx==0.27.0
20 changes: 20 additions & 0 deletions apps/tools/files-mcp/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Use an official Python runtime as a parent image
FROM python:3.9-slim

# Set the working directory in the container
WORKDIR /app

# Copy the requirements file into the container
COPY requirements.txt .

# Install any needed packages specified in requirements.txt
RUN pip install --no-cache-dir -r requirements.txt

# Copy the rest of the application code into the container
COPY . .

# Expose port 8000 to the outside world
EXPOSE 8000

# Run main.py when the container launches
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]
84 changes: 84 additions & 0 deletions apps/tools/files-mcp/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
from fastapi import FastAPI, HTTPException
from pydantic import BaseModel
from typing import List, Dict, Any

app = FastAPI(
title="Files MCP (Master Control Program)",
description="A tool for reading and writing artifacts to an object store.",
version="0.1.0"
)

# --- Pydantic Models for Request/Response ---

class ReadRequest(BaseModel):
path: str

class ReadResponse(BaseModel):
path: str
content_b64: str # Content will be base64 encoded

class WriteRequest(BaseModel):
path: str
content_b64: str
meta: Dict[str, Any]

class WriteResponse(BaseModel):
path: str
version: str # e.g., an S3 versionId
size_bytes: int

class ListRequest(BaseModel):
prefix: str

class ListResponse(BaseModel):
prefix: str
files: List[str]

class DiffRequest(BaseModel):
path_a: str
path_b: str

class DiffResponse(BaseModel):
diff: str # A unified diff format string

# --- API Endpoints ---

@app.get("/health")
async def health_check():
"""Basic health check endpoint."""
return {"status": "ok"}

@app.post("/read")
async def read_file(request: ReadRequest):
"""(Placeholder) Reads a file from the object store."""
print(f"Reading path: {request.path}")
# In a real implementation, this would connect to S3/MinIO
# and fetch the file bytes, then base64 encode them.
return ReadResponse(path=request.path, content_b64="c2FtcGxlIGNvbnRlbnQ=") # "sample content"

@app.post("/write")
async def write_file(request: WriteRequest):
"""(Placeholder) Writes a file to the object store."""
print(f"Writing to path: {request.path} with meta: {request.meta}")
# In a real implementation, this would decode the content
# and upload it to S3/MinIO.
return WriteResponse(path=request.path, version="v1.0.0-placeholder", size_bytes=len(request.content_b64))

@app.post("/list")
async def list_files(request: ListRequest):
"""(Placeholder) Lists files with a given prefix."""
print(f"Listing files with prefix: {request.prefix}")
return ListResponse(prefix=request.prefix, files=[f"{request.prefix}/file1.txt", f"{request.prefix}/file2.txt"])

@app.post("/version")
async def version_file(request: ReadRequest):
"""(Placeholder) Gets versions of a file."""
print(f"Versioning path: {request.path}")
return {"path": request.path, "versions": ["v1.0.0-placeholder", "v0.9.0-placeholder"]}

@app.post("/diff")
async def diff_files(request: DiffRequest):
"""(Placeholder) Diffs two files."""
print(f"Diffing {request.path_a} and {request.path_b}")
diff_text = f"--- {request.path_a}\n+++ {request.path_b}\n@@ -1 +1 @@\n-old content\n+new content"
return DiffResponse(diff=diff_text)
3 changes: 3 additions & 0 deletions apps/tools/files-mcp/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
fastapi==0.110.0
uvicorn[standard]==0.29.0
pydantic==2.6.4
20 changes: 20 additions & 0 deletions apps/tools/metrics-mcp/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Use an official Python runtime as a parent image
FROM python:3.9-slim

# Set the working directory in the container
WORKDIR /app

# Copy the requirements file into the container
COPY requirements.txt .

# Install any needed packages specified in requirements.txt
RUN pip install --no-cache-dir -r requirements.txt

# Copy the rest of the application code into the container
COPY . .

# Expose port 8000 to the outside world
EXPOSE 8000

# Run main.py when the container launches
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]
Binary file not shown.
Loading