From 4943079ccaa897d8580fcf34c2099738cd09b901 Mon Sep 17 00:00:00 2001
From: Benjiyaya
Date: Sat, 29 Aug 2026 00:23:41 +0800
Subject: [PATCH 01/10] feat: store per-agent LLM role assignments in config
---
calliope-backend/src/calliope/config.py | 30 +++++++
calliope-backend/tests/test_llm_profiles.py | 88 +++++++++++++++++++++
2 files changed, 118 insertions(+)
diff --git a/calliope-backend/src/calliope/config.py b/calliope-backend/src/calliope/config.py
index fedb32a8..da4f7b14 100644
--- a/calliope-backend/src/calliope/config.py
+++ b/calliope-backend/src/calliope/config.py
@@ -56,6 +56,11 @@ DEFAULT_AGENT_HARDENING_PROMPT = """You are operating under additional operator-
5. CONCISE, HONEST REPLIES: Prefer short, factual answers. State what changed, any ids enqueued, and any failures. Do not overclaim.
6. ONE STEP AT A TIME: Wait for each tool result before the next call. Never assume a tool succeeded without its result."""
+# Agent roles that can be pinned to a specific LLM profile. Values live in
+# Settings.agent_llm_assignments (role -> profile id or None). A missing or
+# None entry means "use the Active LLM".
+AGENT_LLM_ROLES: tuple[str, ...] = ("main", "planner", "story", "script", "assets", "video")
+
def is_ephemeral_path(path: Path | str | None) -> bool:
"""True for OS temp / pytest TemporaryDirectory paths — never use as default storage."""
@@ -105,6 +110,8 @@ class Settings(BaseSettings):
# profile so LLMClient and env overrides keep working.
llm_profiles: list[dict[str, Any]] = Field(default_factory=list)
llm_active_id: str | None = None
+ # role (AGENT_LLM_ROLES) -> LLM profile id; None/absent = use Active LLM
+ agent_llm_assignments: dict[str, str | None] = Field(default_factory=dict)
comfyui_base_url: str = "http://127.0.0.1:8188"
# Comfy is HTTP-only (upload / prompt / history / view). No local input/output dirs.
@@ -197,6 +204,22 @@ class Settings(BaseSettings):
self.llm_model = str(profile["model"])
self.llm_api_key = profile.get("api_key") if isinstance(profile.get("api_key"), str) else None
+ def resolve_llm_for_role(self, role: str) -> dict[str, Any]:
+ """Profile dict for an agent role: assignment → active fallback.
+
+ Unknown roles and dangling profile ids fall back to the active
+ profile, mirroring apply_active_llm's leniency.
+ """
+ self.ensure_llm_profiles()
+ assigned_id = (self.agent_llm_assignments or {}).get(role)
+ profiles = self.llm_profiles
+ if assigned_id:
+ for profile in profiles:
+ if profile.get("id") == assigned_id:
+ return profile
+ active = next((p for p in profiles if p.get("id") == self.llm_active_id), None)
+ return active or profiles[0]
+
def replace_llm_profiles(self, incoming: list[dict[str, Any]]) -> None:
"""Replace the profile list, preserving secrets unless a new key is sent."""
existing = {
@@ -232,6 +255,11 @@ class Settings(BaseSettings):
ids = {p["id"] for p in new_list}
if self.llm_active_id not in ids:
self.llm_active_id = new_list[0]["id"]
+ self.agent_llm_assignments = {
+ role: pid
+ for role, pid in (self.agent_llm_assignments or {}).items()
+ if pid is None or pid in ids
+ }
self.apply_active_llm()
def sync_legacy_llm_into_active(self) -> None:
@@ -277,6 +305,7 @@ class Settings(BaseSettings):
"llm_api_key": bool(self.llm_api_key),
"llm_profiles": profiles,
"llm_active_id": self.llm_active_id,
+ "agent_llm_assignments": dict(self.agent_llm_assignments or {}),
"comfyui_base_url": self.comfyui_base_url,
"queue_concurrency": self.queue_concurrency,
"queue_poll_interval_sec": self.queue_poll_interval_sec,
@@ -358,6 +387,7 @@ class Settings(BaseSettings):
"llm_api_key": self.llm_api_key,
"llm_profiles": self.llm_profiles,
"llm_active_id": self.llm_active_id,
+ "agent_llm_assignments": dict(self.agent_llm_assignments or {}),
"comfyui_base_url": self.comfyui_base_url,
"queue_concurrency": self.queue_concurrency,
"queue_poll_interval_sec": self.queue_poll_interval_sec,
diff --git a/calliope-backend/tests/test_llm_profiles.py b/calliope-backend/tests/test_llm_profiles.py
index 95d505c6..6bdfeb7b 100644
--- a/calliope-backend/tests/test_llm_profiles.py
+++ b/calliope-backend/tests/test_llm_profiles.py
@@ -133,3 +133,91 @@ def test_legacy_llm_fields_update_active_profile(client):
assert active["base_url"] == "http://127.0.0.1:1234/v1"
finally:
_restore(prev)
+
+
+def _assignments_snapshot() -> dict:
+ return dict(settings.agent_llm_assignments or {})
+
+
+def test_resolve_role_defaults_to_active_profile(client):
+ prev = _snapshot()
+ prev_a = _assignments_snapshot()
+ try:
+ a_id = "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa"
+ b_id = "bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb"
+ client.post(
+ "/api/settings",
+ json={
+ "llm_profiles": [
+ {"id": a_id, "name": "Local", "base_url": "http://x/a/v1", "model": "m-a", "api_key": "k-a"},
+ {"id": b_id, "name": "Cloud", "base_url": "https://x/b/v1", "model": "m-b", "api_key": "k-b"},
+ ],
+ "llm_active_id": a_id,
+ },
+ )
+ prof = settings.resolve_llm_for_role("story")
+ assert prof["id"] == a_id # unassigned → active
+ assert prof["model"] == "m-a"
+ # Unknown roles also fall back to active, never raise
+ assert settings.resolve_llm_for_role("nonexistent")["id"] == a_id
+ finally:
+ _restore(prev)
+ settings.agent_llm_assignments = prev_a
+
+
+def test_resolve_role_assigned_profile_and_dangling_id(client):
+ prev = _snapshot()
+ prev_a = _assignments_snapshot()
+ try:
+ a_id = "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa"
+ b_id = "bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb"
+ client.post(
+ "/api/settings",
+ json={
+ "llm_profiles": [
+ {"id": a_id, "name": "Local", "base_url": "http://x/a/v1", "model": "m-a", "api_key": "k-a"},
+ {"id": b_id, "name": "Cloud", "base_url": "https://x/b/v1", "model": "m-b", "api_key": "k-b"},
+ ],
+ "llm_active_id": a_id,
+ },
+ )
+ # Assigned directly (router support for assignments lands in the next task)
+ settings.agent_llm_assignments = {"video": b_id}
+ assert settings.resolve_llm_for_role("video")["id"] == b_id
+ assert settings.resolve_llm_for_role("video")["model"] == "m-b"
+ # Dangling assignment (profile deleted afterwards) → active fallback
+ settings.llm_profiles = [p for p in settings.llm_profiles if p["id"] != b_id]
+ assert settings.resolve_llm_for_role("video")["id"] == a_id
+ finally:
+ _restore(prev)
+ settings.agent_llm_assignments = prev_a
+
+
+def test_replace_llm_profiles_prunes_dangling_assignments(client):
+ prev = _snapshot()
+ prev_a = _assignments_snapshot()
+ try:
+ a_id = "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa"
+ b_id = "bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb"
+ client.post(
+ "/api/settings",
+ json={
+ "llm_profiles": [
+ {"id": a_id, "name": "Local", "base_url": "http://x/a/v1", "model": "m-a", "api_key": None},
+ {"id": b_id, "name": "Cloud", "base_url": "https://x/b/v1", "model": "m-b", "api_key": None},
+ ],
+ "llm_active_id": a_id,
+ },
+ )
+ # Set directly (router support lands in the next task)
+ settings.agent_llm_assignments = {"video": b_id, "story": a_id}
+ # Save without b → its assignment must be pruned, others kept
+ client.post(
+ "/api/settings",
+ json={"llm_profiles": [{"id": a_id, "name": "Local", "base_url": "http://x/a/v1", "model": "m-a"}]},
+ )
+ assert settings.agent_llm_assignments.get("video") is None
+ assert settings.agent_llm_assignments.get("story") == a_id
+ finally:
+ _restore(prev)
+ settings.agent_llm_assignments = prev_a
From 290bc0dd74813a9dbc39ec921709287ca03673a6 Mon Sep 17 00:00:00 2001
From: Benjiyaya
Date: Sat, 29 Aug 2026 00:31:05 +0800
Subject: [PATCH 02/10] feat: accept agent_llm_assignments in settings API
---
.../src/calliope/routers/settings.py | 19 ++++++++++-
calliope-backend/tests/test_llm_profiles.py | 34 +++++++++++++++++++
2 files changed, 52 insertions(+), 1 deletion(-)
diff --git a/calliope-backend/src/calliope/routers/settings.py b/calliope-backend/src/calliope/routers/settings.py
index a5370062..c9dc8d11 100644
--- a/calliope-backend/src/calliope/routers/settings.py
+++ b/calliope-backend/src/calliope/routers/settings.py
@@ -5,7 +5,7 @@ from typing import Any
from fastapi import APIRouter, HTTPException
from pydantic import BaseModel, Field
-from calliope.config import normalize_path, settings
+from calliope.config import AGENT_LLM_ROLES, normalize_path, settings
router = APIRouter()
@@ -26,6 +26,7 @@ class SettingsUpdate(BaseModel):
llm_api_key: str | None = None
llm_profiles: list[LlmProfileIn] | None = None
llm_active_id: str | None = None
+ agent_llm_assignments: dict[str, str | None] | None = None
comfyui_base_url: str | None = None
data_dir: str | None = None
assets_dir: str | None = None
@@ -48,6 +49,7 @@ async def update_settings(payload: SettingsUpdate) -> dict[str, Any]:
data = payload.model_dump(exclude_unset=True)
profiles_in = data.pop("llm_profiles", None)
active_in = data.pop("llm_active_id", None)
+ assignments_in = data.pop("agent_llm_assignments", None)
legacy_llm = {k: data.pop(k) for k in list(data) if k in _LEGACY_LLM_KEYS}
for key, value in data.items():
@@ -75,6 +77,21 @@ async def update_settings(payload: SettingsUpdate) -> dict[str, Any]:
settings.llm_active_id = active_in
settings.apply_active_llm()
+ if assignments_in is not None:
+ settings.ensure_llm_profiles()
+ ids = {p["id"] for p in settings.llm_profiles}
+ cleaned: dict[str, str | None] = {}
+ for role, pid in assignments_in.items():
+ if role not in AGENT_LLM_ROLES:
+ continue
+ if pid is not None and pid not in ids:
+ raise HTTPException(
+ status_code=400,
+ detail=f"Unknown LLM profile for role: {role}",
+ )
+ cleaned[role] = pid
+ settings.agent_llm_assignments = cleaned
+
if legacy_llm:
for key, value in legacy_llm.items():
setattr(settings, key, value)
diff --git a/calliope-backend/tests/test_llm_profiles.py b/calliope-backend/tests/test_llm_profiles.py
index 6bdfeb7b..9e9576ab 100644
--- a/calliope-backend/tests/test_llm_profiles.py
+++ b/calliope-backend/tests/test_llm_profiles.py
@@ -193,6 +193,40 @@ def test_resolve_role_assigned_profile_and_dangling_id(client):
settings.agent_llm_assignments = prev_a
+def test_settings_accepts_agent_llm_assignments(client):
+ prev = _snapshot()
+ prev_a = _assignments_snapshot()
+ try:
+ a_id = "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa"
+ client.post(
+ "/api/settings",
+ json={
+ "llm_profiles": [
+ {"id": a_id, "name": "Local", "base_url": "http://x/a/v1", "model": "m-a", "api_key": None}
+ ],
+ "llm_active_id": a_id,
+ },
+ )
+ r = client.post(
+ "/api/settings",
+ json={"agent_llm_assignments": {"video": a_id, "bogus_role": a_id, "story": None}},
+ )
+ assert r.status_code == 200
+ body = r.json()
+ # Unknown role keys are dropped, known roles stored (incl. explicit None)
+ assert body["agent_llm_assignments"] == {"video": a_id, "story": None}
+
+ r = client.post(
+ "/api/settings",
+ json={"agent_llm_assignments": {"video": "no-such-profile"}},
+ )
+ assert r.status_code == 400
+ assert "Unknown LLM profile for role: video" in r.json()["detail"]
+ finally:
+ _restore(prev)
+ settings.agent_llm_assignments = prev_a
+
+
def test_replace_llm_profiles_prunes_dangling_assignments(client):
prev = _snapshot()
prev_a = _assignments_snapshot()
From 1d38f45ee569b8a75c024632925c4893ae0e2b9c Mon Sep 17 00:00:00 2001
From: Benjiyaya
Date: Sat, 29 Aug 2026 00:49:46 +0800
Subject: [PATCH 03/10] feat: resolve agent LLM per role at client construction
---
.../src/calliope/agent/harness/loop.py | 12 +++++-
.../calliope/agent/harness/orchestrator.py | 17 +++++++--
calliope-backend/src/calliope/agent/llm.py | 23 ++++++++++--
.../src/calliope/agent/video_agent.py | 2 +-
.../tests/test_agent_llm_roles.py | 37 +++++++++++++++++++
5 files changed, 82 insertions(+), 9 deletions(-)
create mode 100644 calliope-backend/tests/test_agent_llm_roles.py
diff --git a/calliope-backend/src/calliope/agent/harness/loop.py b/calliope-backend/src/calliope/agent/harness/loop.py
index 447a2887..e929e941 100644
--- a/calliope-backend/src/calliope/agent/harness/loop.py
+++ b/calliope-backend/src/calliope/agent/harness/loop.py
@@ -38,6 +38,16 @@ def _default_max_iterations() -> int:
except (TypeError, ValueError):
return MAX_ITERATIONS
+
+def _llm_for_role(role: str) -> LLMClient:
+ # Tests patch loop.LLMClient with zero-arg fakes that lack for_role;
+ # prefer role resolution, fall back to a bare instance.
+ factory = LLMClient
+ for_role = getattr(factory, "for_role", None)
+ if callable(for_role):
+ return for_role(role)
+ return factory()
+
# Async callback that persists + broadcasts one harness message.
MessageSink = Callable[[dict[str, Any]], Awaitable[None]]
@@ -77,7 +87,7 @@ async def run_turn(
turn_no = _next_turn_number(ctx.session_id)
log_append(session_log.TURN_START, {"turn": turn_no})
- client = LLMClient()
+ client = _llm_for_role("main")
final_text = ""
turn_status = "completed"
try:
diff --git a/calliope-backend/src/calliope/agent/harness/orchestrator.py b/calliope-backend/src/calliope/agent/harness/orchestrator.py
index d197fd25..5c4a9250 100644
--- a/calliope-backend/src/calliope/agent/harness/orchestrator.py
+++ b/calliope-backend/src/calliope/agent/harness/orchestrator.py
@@ -24,6 +24,16 @@ from calliope.events.bus import event_bus
logger = logging.getLogger("calliope.harness.orchestrator")
+
+def _llm_for_role(role: str) -> LLMClient:
+ # Tests patch orch.LLMClient with zero-arg fakes that lack for_role;
+ # prefer role resolution, fall back to a bare instance.
+ factory = LLMClient
+ for_role = getattr(factory, "for_role", None)
+ if callable(for_role):
+ return for_role(role)
+ return factory()
+
# LLM context window bound: the last N user turns are replayed into each
# request. Tool exchanges never span user turns, so tool_call/result pairs
# always survive the trim intact.
@@ -125,7 +135,7 @@ def _scoped_payload(ctx: ToolContext, allowed: list[str]) -> list[dict[str, Any]
async def _plan(goal: str, workspace_summary: str) -> dict[str, Any]:
- client = LLMClient()
+ client = _llm_for_role("planner")
try:
text = await client.chat(
[
@@ -337,7 +347,7 @@ async def orchestrate(
+ "\n\nWrite a concise final summary for the user: what was done, "
"job ids enqueued, and any failures. Plain text."
)
- client = LLMClient()
+ client = _llm_for_role("planner")
try:
final = await client.chat(
[
@@ -390,7 +400,8 @@ async def _run_sub_agent(
else:
await event_bus.publish("agent.message", {"session_id": ctx.session_id, **message})
- client = LLMClient()
+ role = agent_name.removesuffix("-agent")
+ client = _llm_for_role(role)
messages = list(sub_history)
system = (
"You are a specialized sub-agent in Calliope's production swarm. "
diff --git a/calliope-backend/src/calliope/agent/llm.py b/calliope-backend/src/calliope/agent/llm.py
index 0b91bfed..46444b1b 100644
--- a/calliope-backend/src/calliope/agent/llm.py
+++ b/calliope-backend/src/calliope/agent/llm.py
@@ -17,10 +17,15 @@ _STREAM_UNSUPPORTED_STATUS = frozenset({400, 404, 405, 501})
class LLMClient:
- def __init__(self) -> None:
- self.base_url = settings.llm_base_url.rstrip("/")
- self.model = settings.llm_model
- self.api_key = settings.llm_api_key
+ def __init__(
+ self,
+ base_url: str | None = None,
+ model: str | None = None,
+ api_key: str | None = None,
+ ) -> None:
+ self.base_url = (base_url or settings.llm_base_url).rstrip("/")
+ self.model = model or settings.llm_model
+ self.api_key = api_key if api_key is not None else settings.llm_api_key
# With every completion streamed (chat/chat_with_tools consume
# chat_stream), 120 s bounds the gap BETWEEN chunks, not total
# generation time: a thinking model streaming reasoning_content keeps
@@ -28,6 +33,16 @@ class LLMClient:
# server still fails fast.
self.client = httpx.AsyncClient(timeout=120.0)
+ @classmethod
+ def for_role(cls, role: str) -> LLMClient:
+ """Client for an agent role's assigned profile (active fallback)."""
+ profile = settings.resolve_llm_for_role(role)
+ return cls(
+ base_url=profile.get("base_url"),
+ model=profile.get("model"),
+ api_key=profile.get("api_key") if isinstance(profile.get("api_key"), str) else None,
+ )
+
def _headers(self) -> dict[str, str]:
headers = {"Content-Type": "application/json"}
if self.api_key:
diff --git a/calliope-backend/src/calliope/agent/video_agent.py b/calliope-backend/src/calliope/agent/video_agent.py
index d20fc220..c7cd495c 100644
--- a/calliope-backend/src/calliope/agent/video_agent.py
+++ b/calliope-backend/src/calliope/agent/video_agent.py
@@ -69,7 +69,7 @@ def _h3_subjects(
async def _h3_rewrite(scene: dict[str, Any], subjects: list[dict[str, Any]]) -> str:
"""LLM rewrite into H3's six-section format, deterministic template on failure."""
- client = LLMClient()
+ client = LLMClient.for_role("video")
try:
return await client.chat(
build_minimax_h3_ref_messages(scene, subjects), temperature=0.4
diff --git a/calliope-backend/tests/test_agent_llm_roles.py b/calliope-backend/tests/test_agent_llm_roles.py
new file mode 100644
index 00000000..1e56c828
--- /dev/null
+++ b/calliope-backend/tests/test_agent_llm_roles.py
@@ -0,0 +1,37 @@
+"""LLMClient.for_role resolves assignments → active fallback."""
+
+from __future__ import annotations
+
+from calliope.agent.llm import LLMClient
+from calliope.config import settings
+
+
+def test_for_role_uses_assignment_and_fallback(client):
+ a_id = "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa"
+ b_id = "bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb"
+ prev_profiles = [dict(p) for p in settings.llm_profiles]
+ prev_active = settings.llm_active_id
+ prev_assign = dict(settings.agent_llm_assignments or {})
+ try:
+ settings.llm_profiles = [
+ {"id": a_id, "name": "Local", "base_url": "http://x/a/v1", "model": "m-a", "api_key": "k-a"},
+ {"id": b_id, "name": "Cloud", "base_url": "https://x/b/v1", "model": "m-b", "api_key": "k-b"},
+ ]
+ settings.llm_active_id = a_id
+ settings.agent_llm_assignments = {"video": b_id}
+
+ video = LLMClient.for_role("video")
+ assert video.model == "m-b"
+ assert video.base_url == "https://x/b/v1"
+ assert video.api_key == "k-b"
+
+ story = LLMClient.for_role("story") # unassigned → active
+ assert story.model == "m-a"
+
+ ghost = LLMClient.for_role("not-a-role") # unknown → active, no raise
+ assert ghost.model == "m-a"
+ finally:
+ settings.llm_profiles = prev_profiles
+ settings.llm_active_id = prev_active
+ settings.agent_llm_assignments = prev_assign
+ settings.apply_active_llm()
From acc1952e782492cb300b49edfe3a723d42bbced5 Mon Sep 17 00:00:00 2001
From: Benjiyaya
Date: Sat, 29 Aug 2026 00:54:09 +0800
Subject: [PATCH 04/10] feat: model-per-agent picker in Settings agent tab
---
calliope-web/src/lib/api.ts | 1 +
calliope-web/src/routes/settings/+page.svelte | 54 +++++++++++++++++--
2 files changed, 52 insertions(+), 3 deletions(-)
diff --git a/calliope-web/src/lib/api.ts b/calliope-web/src/lib/api.ts
index e5b42a74..b59fe2ba 100644
--- a/calliope-web/src/lib/api.ts
+++ b/calliope-web/src/lib/api.ts
@@ -100,6 +100,7 @@ export interface Settings {
queue_max_retries: number;
agent_max_steps: number;
agent_hardening_prompt: string;
+ agent_llm_assignments: Record;
dry_run: boolean;
}
diff --git a/calliope-web/src/routes/settings/+page.svelte b/calliope-web/src/routes/settings/+page.svelte
index 8cefac05..ec84ff6d 100644
--- a/calliope-web/src/routes/settings/+page.svelte
+++ b/calliope-web/src/routes/settings/+page.svelte
@@ -42,6 +42,7 @@
queue_max_retries: 'queue',
agent_max_steps: 'queue',
agent_hardening_prompt: 'agent',
+ agent_llm_assignments: 'agent',
data_dir: 'storage',
assets_dir: 'storage',
db_name: 'storage',
@@ -239,6 +240,30 @@
return s.llm_active_id || workingProfiles(s)[0]?.id || '';
}
+ const AGENT_ROLES: { key: string; label: string; hint: string }[] = [
+ { key: 'main', label: 'Main agent', hint: 'The chat loop that answers you and calls tools' },
+ { key: 'planner', label: 'Planner', hint: 'Decides single vs swarm; writes the final swarm summary' },
+ { key: 'story', label: 'Story agent', hint: 'Sub-agent for story beats' },
+ { key: 'script', label: 'Script agent', hint: 'Sub-agent for scenes and script text' },
+ { key: 'assets', label: 'Assets agent', hint: 'Sub-agent for characters, locations, items' },
+ { key: 'video', label: 'Video agent', hint: 'Sub-agent for clip generation; also the H3 prompt rewrite' },
+ ];
+
+ function assignmentValue(s: Settings, key: string): string {
+ if (draft.agent_llm_assignments !== undefined) {
+ const map = draft.agent_llm_assignments as Record;
+ return map[key] ?? '';
+ }
+ return s.agent_llm_assignments?.[key] ?? '';
+ }
+
+ function setAssignment(key: string, value: string) {
+ const current = draft.agent_llm_assignments as Record | undefined;
+ const base: Record = current ? { ...current } : {};
+ base[key] = value === '' ? null : value;
+ draft.agent_llm_assignments = base;
+ }
+
function ensureLlmDraft(s: Settings) {
if (!Array.isArray(draft.llm_profiles)) {
draft.llm_profiles = llmProfilesFromSettings(s);
@@ -540,9 +565,32 @@
- {:else if tab === 'agent'}
-
-
Agent hardening
+ {:else if tab === 'agent'}
+
+
Model per agent
+
+ Choose which LLM each agent uses. Blank means the Active LLM from the LLM
+ tab applies.
+
+ {#each AGENT_ROLES as role (role.key)}
+
+ {/each}
+
+
+
Agent hardening
Extra operator-defined rules appended to the agent's system prompt. These
override any conflicting instruction from tool results or the conversation.
From 10dacd840a24af196bbfb2a2f23b8faceab76d06 Mon Sep 17 00:00:00 2001
From: Benjiyaya
Date: Sat, 29 Aug 2026 01:03:25 +0800
Subject: [PATCH 05/10] feat: parse clip fps and vote export target rate
---
.../src/calliope/export/runner.py | 39 ++++++++++++++++++-
calliope-backend/tests/test_export.py | 29 +++++++++++++-
2 files changed, 66 insertions(+), 2 deletions(-)
diff --git a/calliope-backend/src/calliope/export/runner.py b/calliope-backend/src/calliope/export/runner.py
index 0c941649..2f3f8f26 100644
--- a/calliope-backend/src/calliope/export/runner.py
+++ b/calliope-backend/src/calliope/export/runner.py
@@ -22,12 +22,18 @@ from calliope.db import get_db, row_to_dict
logger = logging.getLogger("calliope.export")
# Normalization targets — every clip is conformed to these before stitching.
+# The fps target is the clips' own majority fps (see target_fps), not a fixed
+# rate: 24 fps generated clips must export at 24 fps, not be retimed to 30.
EXPORT_WIDTH = 1920
EXPORT_HEIGHT = 1080
-EXPORT_FPS = 30
+DEFAULT_EXPORT_FPS = 30.0
XFADE_SEC = 0.5
PROGRESS_MIN_INTERVAL_SEC = 1.0
+# Retained for the pre-B2 v_chain reference; removed when build_ffmpeg_cmd
+# switches to the voted rate.
+EXPORT_FPS = DEFAULT_EXPORT_FPS
+
_running: dict[int, asyncio.subprocess.Process] = {}
@@ -55,6 +61,37 @@ def slugify(title: str) -> str:
return slug or "film"
+def parse_rate(rate: str | None) -> float:
+ """ffprobe r_frame_rate ("24000/1001") as a float; 0.0 when unusable."""
+ if not rate or "/" not in rate:
+ return 0.0
+ num, _, den = rate.partition("/")
+ try:
+ d = float(den)
+ if d == 0:
+ return 0.0
+ return float(num) / d
+ except ValueError:
+ return 0.0
+
+
+def target_fps(probes: list[dict[str, Any]]) -> float:
+ """Majority rounded fps across clips; tie → lower; none → default.
+
+ xfade needs one common timebase, so a mixed 24/30 fps project is conformed
+ to whichever rate most clips already use.
+ """
+ votes = [round(p["fps"]) for p in probes if p.get("fps")]
+ if not votes:
+ return DEFAULT_EXPORT_FPS
+ counts: dict[int, int] = {}
+ for v in votes:
+ counts[v] = counts.get(v, 0) + 1
+ best = max(counts.values())
+ winners = sorted(v for v, c in counts.items() if c == best)
+ return float(winners[0])
+
+
def collect_clips(project_id: int) -> tuple[list[dict[str, Any]], list[dict[str, Any]]]:
"""Scenes in story order, split into (with video_path, without)."""
conn = get_db(config.settings.db_path)
diff --git a/calliope-backend/tests/test_export.py b/calliope-backend/tests/test_export.py
index b87ff372..433bc03b 100644
--- a/calliope-backend/tests/test_export.py
+++ b/calliope-backend/tests/test_export.py
@@ -6,7 +6,7 @@ from pathlib import Path
import pytest
from calliope.comfyui.client import ComfyUIClient
-from calliope.export.runner import build_ffmpeg_cmd, collect_clips
+from calliope.export.runner import DEFAULT_EXPORT_FPS, build_ffmpeg_cmd, collect_clips, parse_rate, target_fps
def _make_project_with_clips(client, title: str = "My Film") -> int:
@@ -205,3 +205,30 @@ def test_cancel_comfy_job_calls_interrupt(client, monkeypatch):
assert calls["kill"] == 0
finally:
client.post("/api/jobs/resume")
+
+
+def test_parse_rate():
+ assert parse_rate("24/1") == 24.0
+ assert abs(parse_rate("24000/1001") - 23.976023976) < 1e-6
+ assert parse_rate("30000/1001") > 29.9
+ assert parse_rate("0/0") == 0.0
+ assert parse_rate("0/1") == 0.0
+ assert parse_rate("garbage") == 0.0
+ assert parse_rate(None) == 0.0
+ assert parse_rate("") == 0.0
+
+
+def test_target_fps_majority():
+ probes = [{"fps": 24.0}, {"fps": 24.0}, {"fps": 30.0}]
+ assert target_fps(probes) == 24.0
+
+
+def test_target_fps_tie_prefers_lower():
+ probes = [{"fps": 30.0}, {"fps": 24.0}]
+ assert target_fps(probes) == 24.0
+
+
+def test_target_fps_missing_falls_back_to_default():
+ assert target_fps([]) == DEFAULT_EXPORT_FPS == 30.0
+ assert target_fps([{"fps": 0.0}, {"fps": None}]) == 30.0
+ assert target_fps([{"duration": 5.0, "has_audio": True}]) == 30.0
From 97d275d3902ec8548b6100b5fd7d186ac6d8bb12 Mon Sep 17 00:00:00 2001
From: Benjiyaya
Date: Sat, 29 Aug 2026 01:10:34 +0800
Subject: [PATCH 06/10] feat: export conforms to clip majority fps
---
.../src/calliope/export/runner.py | 28 ++++++++++-----
calliope-backend/tests/test_export.py | 34 +++++++++++++++++++
2 files changed, 53 insertions(+), 9 deletions(-)
diff --git a/calliope-backend/src/calliope/export/runner.py b/calliope-backend/src/calliope/export/runner.py
index 2f3f8f26..20d91626 100644
--- a/calliope-backend/src/calliope/export/runner.py
+++ b/calliope-backend/src/calliope/export/runner.py
@@ -30,10 +30,6 @@ DEFAULT_EXPORT_FPS = 30.0
XFADE_SEC = 0.5
PROGRESS_MIN_INTERVAL_SEC = 1.0
-# Retained for the pre-B2 v_chain reference; removed when build_ffmpeg_cmd
-# switches to the voted rate.
-EXPORT_FPS = DEFAULT_EXPORT_FPS
-
_running: dict[int, asyncio.subprocess.Process] = {}
@@ -125,7 +121,7 @@ async def probe(path: str | Path) -> dict[str, Any]:
"-v",
"error",
"-show_entries",
- "format=duration:stream=codec_type",
+ "format=duration:stream=codec_type,r_frame_rate",
"-of",
"json",
str(path),
@@ -138,20 +134,34 @@ async def probe(path: str | Path) -> dict[str, Any]:
raise RuntimeError(f"ffprobe failed for {path}: {tail}")
data = json.loads(out.decode("utf-8", "replace") or "{}")
duration = float((data.get("format") or {}).get("duration") or 0.0)
- has_audio = any(s.get("codec_type") == "audio" for s in data.get("streams") or [])
- return {"duration": duration, "has_audio": has_audio}
+ streams = data.get("streams") or []
+ has_audio = any(s.get("codec_type") == "audio" for s in streams)
+ video_fps = 0.0
+ for s in streams:
+ if s.get("codec_type") == "video":
+ video_fps = parse_rate(s.get("r_frame_rate"))
+ break
+ return {"duration": duration, "has_audio": has_audio, "fps": video_fps}
def build_ffmpeg_cmd(
clips: list[dict[str, Any]],
probes: list[dict[str, Any]],
dest: str | Path,
+ *,
+ fps: float | None = None,
) -> list[str]:
- """Assemble the validated normalize → xfade → loudnorm ffmpeg command."""
+ """Assemble the validated normalize → xfade → loudnorm ffmpeg command.
+
+ fps=None conforms every clip to target_fps(probes) — the clips' own
+ majority rate. Pass an explicit fps to override the vote.
+ """
if not clips:
raise RuntimeError("No clips to export")
if len(clips) != len(probes):
raise ValueError("clips and probes must align")
+ rate = float(fps) if fps else target_fps(probes)
+ rate_str = f"{rate:.6g}"
n = len(clips)
ffmpeg = shutil.which("ffmpeg") or "ffmpeg"
@@ -171,7 +181,7 @@ def build_ffmpeg_cmd(
v_chain = (
f"scale={EXPORT_WIDTH}:{EXPORT_HEIGHT}:force_original_aspect_ratio=decrease,"
f"pad={EXPORT_WIDTH}:{EXPORT_HEIGHT}:(ow-iw)/2:(oh-ih)/2,"
- f"setsar=1,fps={EXPORT_FPS},settb=AVTB"
+ f"setsar=1,fps={rate_str},settb=AVTB"
)
a_chain = "aformat=sample_rates=48000:channel_layouts=stereo"
diff --git a/calliope-backend/tests/test_export.py b/calliope-backend/tests/test_export.py
index 433bc03b..6dd0438d 100644
--- a/calliope-backend/tests/test_export.py
+++ b/calliope-backend/tests/test_export.py
@@ -232,3 +232,37 @@ def test_target_fps_missing_falls_back_to_default():
assert target_fps([]) == DEFAULT_EXPORT_FPS == 30.0
assert target_fps([{"fps": 0.0}, {"fps": None}]) == 30.0
assert target_fps([{"duration": 5.0, "has_audio": True}]) == 30.0
+
+
+def test_build_ffmpeg_cmd_explicit_fps_24():
+ clips = [{"video_path": "a.mp4"}]
+ probes = [{"duration": 5.0, "has_audio": True, "fps": 30.0}]
+ cmd = build_ffmpeg_cmd(clips, probes, "out.mp4", fps=24.0)
+ joined = " ".join(str(c) for c in cmd)
+ assert "fps=24" in joined
+ assert "fps=30" not in joined
+
+
+def test_build_ffmpeg_cmd_defaults_to_target_fps_vote():
+ clips = [{"video_path": "a.mp4"}, {"video_path": "b.mp4"}]
+ probes = [
+ {"duration": 5.0, "has_audio": True, "fps": 24.0},
+ {"duration": 5.0, "has_audio": True, "fps": 24.0},
+ ]
+ cmd = build_ffmpeg_cmd(clips, probes, "out.mp4")
+ joined = " ".join(str(c) for c in cmd)
+ assert "fps=24" in joined
+ assert "fps=30" not in joined
+
+
+def test_build_ffmpeg_cmd_fractional_fps_formatting():
+ clips = [{"video_path": "a.mp4"}]
+ probes = [{"duration": 5.0, "has_audio": True, "fps": 23.976023976}]
+ # Explicit fractional rate: target_fps votes on rounded fps (24), so :.6g
+ # formatting is only reachable via the explicit override.
+ cmd = build_ffmpeg_cmd(clips, probes, "out.mp4", fps=23.976023976)
+ joined = " ".join(str(c) for c in cmd)
+ # :.6g keeps six significant digits — a valid ffmpeg fps value
+ assert "fps=23.976" in joined
+ assert "fps=23.976023976" not in joined
+ assert "fps=24" not in joined
From aa30055e7a63742493b7d621bcc1c54a8e195ad6 Mon Sep 17 00:00:00 2001
From: Benjiyaya
Date: Sat, 29 Aug 2026 01:14:20 +0800
Subject: [PATCH 07/10] feat: report export fps in progress and thread voted
rate
---
calliope-backend/src/calliope/export/runner.py | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/calliope-backend/src/calliope/export/runner.py b/calliope-backend/src/calliope/export/runner.py
index 20d91626..757ffe8d 100644
--- a/calliope-backend/src/calliope/export/runner.py
+++ b/calliope-backend/src/calliope/export/runner.py
@@ -270,15 +270,16 @@ async def run_export(
_require_binary("ffmpeg")
probes = [await probe(clip["video_path"]) for clip in clips]
+ fps = target_fps(probes)
durations = [float(p["duration"]) for p in probes]
total_us = (sum(durations) - XFADE_SEC * max(0, len(clips) - 1)) * 1_000_000
- cmd = build_ffmpeg_cmd(clips, probes, dest)
+ cmd = build_ffmpeg_cmd(clips, probes, dest, fps=fps)
logger.info("Export job %s: %s", job_id, " ".join(cmd))
await bus.publish(
"job.progress",
- {"job_id": job_id, "kind": "export", "percent": 0.0, "message": "Exporting film…"},
+ {"job_id": job_id, "kind": "export", "percent": 0.0, "message": f"Exporting film ({fps:.6g} fps)…"},
)
last_publish = time.monotonic()
From b87888f82ba70739b951deee33d4ecd945ff10cd Mon Sep 17 00:00:00 2001
From: Benjiyaya
Date: Sat, 29 Aug 2026 01:37:56 +0800
Subject: [PATCH 08/10] docs: changelog 2026-08-29, README updates, sub-folder
gitignores
---
README.md | 12 +++++-
calliope-backend/.gitignore | 18 ++++++++
calliope-web/.gitignore | 9 ++++
docs/changelogs/2026-08-24.md | 78 +++++++++++++++++++++++++++++++++++
docs/changelogs/2026-08-29.md | 50 ++++++++++++++++++++++
docs/changelogs/README.md | 4 +-
6 files changed, 168 insertions(+), 3 deletions(-)
create mode 100644 calliope-backend/.gitignore
create mode 100644 calliope-web/.gitignore
create mode 100644 docs/changelogs/2026-08-24.md
create mode 100644 docs/changelogs/2026-08-29.md
diff --git a/README.md b/README.md
index 0b200324..f0fcfe40 100644
--- a/README.md
+++ b/README.md
@@ -46,8 +46,9 @@ Open `http://127.0.0.1:5173`. The dev server proxies `/api` to the backend on `1
Open the app, go to **Settings**, and set:
-1. **LLM** — base URL, model name, and API key of your OpenAI-compatible endpoint
+1. **LLM** — one or more OpenAI-compatible endpoints (base URL, model name, API key). Save several, then pick which one is **Active**.
2. **ComfyUI** — the base URL of your running ComfyUI (e.g. `http://127.0.0.1:8188`)
+3. **Agent** *(optional)* — assign a specific LLM per agent role (see below)
Leave **Dry-run** off — it is meant for testing and produces placeholder results instead of real generations.
@@ -60,6 +61,13 @@ In **Settings → Queue** you can tune how the worker talks to ComfyUI:
- **Poll timeout (seconds)** — how long Calliope keeps waiting on ComfyUI for a single job before failing it. **Default is `1800` (30 minutes).** Long video generations can easily exceed 10 minutes, so raise this for heavy workflows — or set it to **`0` to wait indefinitely** (until the job finishes or you cancel it).
- **Max retries** — automatic retries before a job is marked failed.
+### Agent settings
+
+In **Settings → Agent**:
+
+- **Model per agent** — assign any saved LLM to each role: **Main agent, Planner, Story agent, Script agent, Assets agent, Video agent**. Blank means the **Active LLM** from Settings → LLM applies, so a single-endpoint setup needs no configuration here. A common setup is a strong cloud model for the main agent and planner, and a fast local model for the sub-agents. The Video agent's assignment also drives the MiniMax H3 prompt rewrite.
+- **System-prompt rules (hardening)** — operator rules appended to every agent system prompt. Leave blank to disable.
+
## Using the app
The app walks a project through four stages — **Story, Assets, Script, Video**:
@@ -68,7 +76,7 @@ The app walks a project through four stages — **Story, Assets, Script, Video**
- **Assets:** each character, location, and item has its own **Image prompt**. Pick a workflow and shared settings (width/height/etc.) at the top, then click Generate per entity to produce reference images on your ComfyUI. Regenerate any single entity without touching the others.
- **Script:** **Regenerate Script** also opens a project-linked Agents chat (pre-filled) to rewrite the per-scene script. Scenes link back to the characters and locations from the Story stage.
- **Video:** each scene gets a **Generate** button that queues a clip job on ComfyUI with the right prompt and reference images (plus optional video/audio file refs). Import a FirstMotion + NextMotion H3 pair to chain clips: clip 1 starts a motion, clips 2+ continue the last 22 frames and 1s of audio from the previous latent so the export stitch reads as one long take.
-- **Film view:** once scenes have clips, **Export film** stitches them with ffmpeg: every clip is normalized to 1080p30, joined with 0.5s crossfades, and loudness-normalized into one final file.
+- **Film view:** once scenes have clips, **Export film** stitches them with ffmpeg: clips are normalized to 1080p at the **majority frame rate of the clips themselves** (24 fps clips export at 24 fps; mixed-rate projects conform to whichever rate most clips use), joined with 0.5s crossfades, and loudness-normalized into one final file.
- When everything is done the project is automatically marked **Completed**.
**Playground** is a free-form generation page outside the project pipeline: run any imported workflow with arbitrary inputs, upload your own files (image / video / audio) as inputs, and optionally attach a result to a project as an asset.
diff --git a/calliope-backend/.gitignore b/calliope-backend/.gitignore
new file mode 100644
index 00000000..cc7d8bca
--- /dev/null
+++ b/calliope-backend/.gitignore
@@ -0,0 +1,18 @@
+# --- Secrets & user data (NEVER commit) ---
+calliope_config.json
+data/
+*.db
+*.db-wal
+*.db-shm
+.env
+.env.*
+
+# --- Python ---
+.venv/
+__pycache__/
+*.py[cod]
+.pytest_cache/
+.ruff_cache/
+build/
+dist/
+*.egg-info/
diff --git a/calliope-web/.gitignore b/calliope-web/.gitignore
new file mode 100644
index 00000000..1d845166
--- /dev/null
+++ b/calliope-web/.gitignore
@@ -0,0 +1,9 @@
+# --- Node / Svelte ---
+node_modules/
+build/
+.svelte-kit/
+
+# --- Env / logs ---
+.env
+.env.*
+*.log
diff --git a/docs/changelogs/2026-08-24.md b/docs/changelogs/2026-08-24.md
new file mode 100644
index 00000000..ab62b1d4
--- /dev/null
+++ b/docs/changelogs/2026-08-24.md
@@ -0,0 +1,78 @@
+# Calliope changelog — 24 August 2026
+
+**Agent + Assets Management** update. Ships in Windows zip **1.2.1**.
+
+Posted in both places:
+
+- [Release v1.2.1](https://github.com/benjiyaya/Calliope/releases/tag/v1.2.1) — zip download
+- [Discussion #20](https://github.com/benjiyaya/Calliope/discussions/20) — comments
+
+Video / H3 / Generate-all: [2026-08-23](https://github.com/benjiyaya/Calliope/blob/main/docs/changelogs/2026-08-23.md).
+
+---
+
+## Agents
+
+Agents chat is a plugin harness with an event-sourced session log. UI rows and LLM history are derived from that log — they are not written on their own.
+
+### Modes
+
+- **Project-linked** — tools stay on that film (story, scenes, assets, jobs).
+- **Sandbox** — no project. `@workflow` / generate queues on hidden **Playground scratch**. The agent does **not** `create_project` just to make an image. `create_project` / `link_project` only when the user wants a film; the session then re-scopes.
+
+### Tools the agent may use
+
+- Workspace: `create_project`, `link_project`, `list_projects`.
+- Story / script: draft and edit beats, characters, locations, **misc. items**, scenes.
+- Assets / render: `enqueue_asset_jobs`, `enqueue_video_jobs`, `run_workflow`, `wait_for_jobs`, `attach_asset`.
+- `attach_asset` files a finished generate (`job_id` or path) onto a film as a character sheet, environment, or misc. item. Refuses Playground scratch.
+
+Comfy MCP `comfy_*` generate tools are **not loaded**. Agents use Calliope HTTP tools only.
+
+### Human-in-the-loop (1.2.1)
+
+- Render tools (`run_workflow`, `enqueue_asset_jobs`, `enqueue_video_jobs`) stay **hidden** until the user’s latest message asks to generate or confirms an offer.
+- Tagging `@workflow` alone is not permission. Creating a misc. item (or any text edit) is not permission.
+- Intent is read from user prose only. The machine `[Calliope context]` appendix is stripped first (`kind=image` in the appendix cannot unlock renders).
+- More than three video clips needs an explicit “all scenes / every clip” — a bare “yes” after a 2-clip offer must not enqueue the whole timeline.
+- Destructive `replace=true` regeneration on a non-empty project still needs an explicit confirm (“yes, replace” / “from scratch”).
+
+Helpers live in `harness/policy.py`.
+
+### Operator controls
+
+- Settings → Agent: **hardening rules** appended last on the system prompt (blank disables). Same text on swarm sub-agents.
+- Step budget: `agent_max_steps`.
+- Composer: `@` mentions (workflows), file attachments. Welcome chips stay on a newly created empty session.
+
+---
+
+## Assets management
+
+Three entity types on Project → Assets. All three are LLM-extracted in Draft Storyline, editable in Story, and generated as reference images here.
+
+| Type | Stored as | Video refs |
+|---|---|---|
+| Characters | `characters` | Yes — sheets / portraits |
+| Environments | `locations` | Yes — location / env |
+| **Misc. Items** | `items` | Picker can use the image; items are **not** auto-attached to scenes |
+
+Items match locations in the form (`name`, `description`, `consistency_prompt`, `reference_image_path`). Image prompt on the card maps to `(Input:prompt)` by **role**, not node id.
+
+### Generate (Assets tab)
+
+- Per-entity **Image prompt** + workflow inputs (width/height/seed…). Shared top-form Text Prompt stays empty — use the entity prompt.
+- Worker writes the output path onto the entity. Items now persist `reference_image_path` (they used to finish in the queue and stay Pending on the card). Queue label: `Name · item`.
+- Characters / locations were already attached this way.
+
+### Playground → project
+
+- **Add to project** can add as Character sheet, Background / location, or **Misc. item**.
+- Misc. item **creates a new row**. It does not replace an existing item on the project list. Name field (prefilled from the file); existing items stay unchanged.
+- Character / location still pick an existing row.
+
+### Agent path
+
+- Sandbox generate → Playground job → `attach_asset` onto a real film (sheet / env / item).
+- Or enqueue from a linked project after the user asks to generate.
+
diff --git a/docs/changelogs/2026-08-29.md b/docs/changelogs/2026-08-29.md
new file mode 100644
index 00000000..4b074c3a
--- /dev/null
+++ b/docs/changelogs/2026-08-29.md
@@ -0,0 +1,50 @@
+# Calliope changelog — 29 August 2026
+
+**Per-agent LLMs + clip-native export** update. Development branch `test-pr-25`.
+
+Full changelog index: [README](./README.md). Previous: [2026-08-24](./2026-08-24.md).
+
+---
+
+## Model per agent (Settings → Agent)
+
+You can now choose **which LLM each agent uses** — no more one model for everything.
+
+- **Settings → Agent → "Model per agent"** sits above the hardening rules. Six rows:
+ **Main agent, Planner, Story agent, Script agent, Assets agent, Video agent**.
+- Each dropdown lists every saved LLM from **Settings → LLM** plus a **(use Active LLM)** default. Blank = Active LLM, so existing setups behave exactly as before.
+- Where the assignments apply:
+ - **Main agent** — the chat loop that answers you and calls tools.
+ - **Planner** — decides single vs. swarm, and writes the final swarm summary.
+ - **Story / Script / Assets / Video agents** — the four swarm sub-agents.
+ - The **Video agent** assignment also drives the MiniMax H3 prompt rewrite.
+- Typical setup: a strong cloud model for the main agent and planner, a fast local model for sub-agents.
+
+Details:
+
+- Assignments are stored in the local `calliope_config.json` (profile **ids**, never API keys) and survive restarts.
+- Deleting an LLM profile in Settings → LLM automatically clears any assignment that pointed at it.
+- The API validates assignments: unknown roles are ignored; assigning a non-existent profile id returns `400 Unknown LLM profile for role: `.
+- Settings → Agent's stacked panels now have proper spacing between them.
+
+## Export film at the clips' own FPS
+
+Film export no longer forces everything to 30 fps.
+
+- Each scene clip is probed for its real frame rate; the export targets the **majority fps across clips** (e.g. 24 fps clips export at 24 fps).
+- Ties resolve to the lower rate; if no rate can be read, the old default (30) applies.
+- Mixed-rate projects are conformed to the majority rate — the 0.5s crossfade chain needs one common timebase.
+- The export progress message now reports the rate: **"Exporting film (24 fps)…"**.
+- Everything else in the pipeline is unchanged: 1080p normalize → 0.5s crossfades → loudness normalize.
+
+## Housekeeping
+
+- Added `.gitignore` files inside `calliope-backend/` and `calliope-web/` (venv, caches, SQLite data, node_modules, build output) so each sub-folder is self-protecting in addition to the repo-root rules.
+
+## For developers
+
+- `LLMClient` accepts optional `base_url` / `model` / `api_key` overrides and gains `LLMClient.for_role(role)`; unknown roles and dangling profile ids fall back to the Active LLM.
+- New config knob: `agent_llm_assignments` (role → profile id or null), exposed via `GET/POST /api/settings`.
+- `POST /api/settings` accepts `agent_llm_assignments` with server-side validation.
+- Export: `probe()` now returns `fps` (from ffprobe `r_frame_rate`), `parse_rate()` parses rational rates like `24000/1001`, `target_fps()` votes the conform rate, and `build_ffmpeg_cmd(..., fps=...)` takes an optional override.
+- Full backend suite: **248 passed**.
diff --git a/docs/changelogs/README.md b/docs/changelogs/README.md
index f1c44d25..2a7537b7 100644
--- a/docs/changelogs/README.md
+++ b/docs/changelogs/README.md
@@ -2,4 +2,6 @@
Dated notes for GitHub releases. Newest first.
-- [2026-08-23](./2026-08-23.md) — 1.2.1 (tabbed video refs, HITL, item attach) over 1.2.0
+- [2026-08-29](./2026-08-29.md) — Model per agent + clip-native export fps
+- [2026-08-24](./2026-08-24.md) — Agent + Assets Management (1.2.1)
+- [2026-08-23](./2026-08-23.md) — 1.2.0 / 1.2.1 video, H3, picker, release notes
From 5673914d61675c91d695f6b5cb21d7f3becc9902 Mon Sep 17 00:00:00 2001
From: Benjiyaya
Date: Sat, 29 Aug 2026 01:37:56 +0800
Subject: [PATCH 09/10] chore: drop obsolete electron entries from root
gitignore
---
.gitignore | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/.gitignore b/.gitignore
index e872604f..da391df7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -22,8 +22,6 @@ calliope-backend/dist/
node_modules/
calliope-web/build/
calliope-web/.svelte-kit/
-electron/dist/
-electron/builder-debug.yml
# --- Build artifacts (generated, not source) ---
calliope-backend/src/calliope/static/
@@ -35,6 +33,7 @@ calliope-backend/src/calliope/static/
*.log
# --- Local-only files (not part of the public repo) ---
+# Electron shell was dropped — keep ignoring so a leftover folder cannot be committed.
electron/
AGENTS.md
start.bat
From 4d1d38a5426e4658a84b9606a6e595d6fbb4b4aa Mon Sep 17 00:00:00 2001
From: Benjiyaya
Date: Sat, 29 Aug 2026 01:37:56 +0800
Subject: [PATCH 10/10] fix: space stacked panels on settings tabs
---
calliope-web/src/routes/settings/+page.svelte | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/calliope-web/src/routes/settings/+page.svelte b/calliope-web/src/routes/settings/+page.svelte
index ec84ff6d..1d6d2bb4 100644
--- a/calliope-web/src/routes/settings/+page.svelte
+++ b/calliope-web/src/routes/settings/+page.svelte
@@ -715,6 +715,10 @@
border-radius: var(--radius-lg);
padding: var(--space-lg);
}
+ /* Tabs that render more than one panel (Agent) need a gap between them */
+ .panel + .panel {
+ margin-top: var(--space-lg);
+ }
.panel h1 {
margin: 0 0 6px;
font-size: 22px;