settings update + version adjustment
frdel committed
Jun 25, 2025 at 14:45 UTC
cbda9f00d895d0b75a7613c21aa7535b40b3d8bf
4 files changed
+31
-8
prompts/researcher/_context.md
renamed
prompts/researcher/agent.system.main.communication.md
renamed
prompts/researcher/agent.system.main.role.md
renamed
python/helpers/settings.py
+31
-8
@@ -7,12 +7,14 @@ import subprocess
7
from typing import Any, Literal, TypedDict
8
9
import models
10
-from python.helpers import runtime, whisper, defer
10
+from python.helpers import runtime, whisper, defer, git
11
from . import files, dotenv
12
from python.helpers.print_style import PrintStyle
13
14
15
class Settings(TypedDict):
16
+ version: str
17
+
18
chat_model_provider: str
19
chat_model_name: str
20
chat_model_kwargs: dict[str, str]
@@ -502,8 +504,8 @@ def convert_out(settings: Settings) -> SettingsOutput:
504
agent_fields.append(
505
{
506
"id": "agent_prompts_subdir",
505
- "title": "Prompts Subdirectory",
506
- "description": "Subdirectory of /prompts folder to use for agent prompts. Used to adjust agent behaviour.",
507
+ "title": "A0 Prompts Subdirectory",
508
+ "description": "Subdirectory of /prompts folder to be used by default agent no. 0. Subordinate agents can be spawned with other subdirectories, that is on their superior agent to decide. This setting affects the behaviour of the top level agent you communicate with.",
509
"type": "select",
510
"value": settings["agent_prompts_subdir"],
511
"options": [
@@ -879,6 +881,11 @@ def normalize_settings(settings: Settings) -> Settings:
881
copy = settings.copy()
882
default = get_default_settings()
883
884
+ # adjust settings values to match current version if needed
885
+ if "version" not in copy or copy["version"] != default["version"]:
886
+ _adjust_to_version(copy, default)
887
+ copy["version"] = default["version"] # sync version
888
+
889
# remove keys that are not in default
890
keys_to_remove = [key for key in copy if key not in default]
891
for key in keys_to_remove:
@@ -900,6 +907,13 @@ def normalize_settings(settings: Settings) -> Settings:
907
return copy
908
909
910
+def _adjust_to_version(settings: Settings, default: Settings):
911
+ # starting with 0.9, the default prompt subfolder for agent no. 0 is agent0
912
+ # switch to agent0 if the old default is used from v0.8
913
+ if "version" not in settings or settings["version"].startswith("v0.8"):
914
+ if "agent_prompts_subdir" not in settings or settings["agent_prompts_subdir"] == "default":
915
+ settings["agent_prompts_subdir"] = "agent0"
916
+
917
def _read_settings_file() -> Settings | None:
918
if os.path.exists(SETTINGS_FILE):
919
content = files.read_file(SETTINGS_FILE)
@@ -945,6 +959,7 @@ def get_default_settings() -> Settings:
959
from models import ModelProvider
960
961
return Settings(
962
+ version=_get_version(),
963
chat_model_provider=ModelProvider.OPENAI.name,
964
chat_model_name="gpt-4.1",
965
chat_model_kwargs={"temperature": "0"},
@@ -1076,14 +1091,14 @@ def _apply_settings(previous: Settings | None):
1091
) # TODO overkill, replace with background task
1092
1093
# update token in mcp server
1079
- current_token = create_auth_token() #TODO - ugly, token in settings is generated from dotenv and does not always correspond
1080
- if (
1081
- not previous
1082
- or current_token != previous["mcp_server_token"]
1083
- ):
1094
+ current_token = (
1095
+ create_auth_token()
1096
+ ) # TODO - ugly, token in settings is generated from dotenv and does not always correspond
1097
+ if not previous or current_token != previous["mcp_server_token"]:
1098
1099
async def update_mcp_token(token: str):
1100
from python.helpers.mcp_server import DynamicMcpProxy
1101
+
1102
DynamicMcpProxy.get_instance().reconfigure(token=token)
1103
1104
task3 = defer.DeferredTask().start_task(
@@ -1161,3 +1176,11 @@ def create_auth_token() -> str:
1176
# encode as base64 and remove any non-alphanumeric chars (like +, /, =)
1177
b64_token = base64.urlsafe_b64encode(hash_bytes).decode().replace("=", "")
1178
return b64_token[:16]
1179
+
1180
+
1181
+def _get_version():
1182
+ try:
1183
+ git_info = git.get_git_info()
1184
+ return str(git_info.get("short_tag", "")).strip() or "unknown"
1185
+ except Exception:
1186
+ return "unknown"