Files
RoboMovel/simulacao/robo-movel-godot/addons/claude_godot/agent/agent_config.gd
T
mguinhosandClaude Opus 5.5 393019705c Projeto: app demo, servidor/firmware em software/, simulacao Godot, planta do bloco D, chapas MDF da base, renders e slides
- app/: app demo (Kivy/buildozer) da API do robo
- software/: servidor RoboMovel (SLAM, profundidade, navegacao) e firmware da base movel (movido de firmware/)
- simulacao/: projeto Godot do robo e script de lancamento servidor + simulacao
- modelos/: planta do 5o andar do bloco D, cena Blender do corredor e modelo real do robo
- partes/mdf/: chapas identificadas e nesting da base do robo (DXF/SVG/FCStd)
- projeto/render, relatorio/imagens, slides: renders finais e apresentacoes de progresso
- ferramentas/scripts: encaixe de chapas, planta do bloco D e render do corredor no Blender
- .gitignore: ignora backups do Blender/FreeCAD e .godot/

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 23:38:16 -03:00

62 lines
3.6 KiB
GDScript

## What makes a run *this* agent rather than some other one: the prompt it
## starts from, how its provider is built, and the limit on what a single tool
## may put into a context.
##
## It sits apart from agent.gd because two things need it. The chat agent owns
## the dock and the session; a background task run owns neither, but has to be
## the same agent underneath — same prompt, same provider, same guard rails.
## Having both reach for agent.gd instead would make the dependency circular,
## and GDScript resolves class_name cycles badly.
class_name ClaudeGodotAgentConfig
extends RefCounted
const SYSTEM_PROMPT := "You are an open-source coding agent embedded in the Godot editor, similar in spirit to Cursor but for GDScript. You can list, read and write files in the current Godot project; read, discover and change ProjectSettings (project.godot); read, discover and change the global EditorSettings (editor-wide preferences, not specific to this project); and list/enable/disable addons that already have a plugin.cfg. The file tools also reach your memory directory, which is outside the project. Use list_project_settings / list_editor_settings to find the exact setting path before reading or writing one — don't guess paths. Be concise, and briefly explain what you changed after editing files or settings, especially before changing a setting or enabling/disabling an addon. EditorSettings changes affect every project opened with this editor install, not just this one, so call that out explicitly when it applies. When the user asks to compact, clear or shrink the context, call the compact tool rather than trying to prune the conversation yourself."
## A tool can return more than a context can hold — a session .chat full of
## base64 images did exactly that. Results are clipped before they reach the
## history, since once an oversized one is in there every later request in
## the conversation repeats it.
const MAX_TOOL_RESULT_CHARS := 60_000
## A provider node for a preset, not attached to anything.
##
## Two conversations cannot share a provider: each keeps its whole history on
## the instance, so a background run needs one of its own even when it is
## pointed at the same model as the chat.
##
## Returns untyped for the same reason the agent's `provider` is untyped — the
## three provider classes are duck-typed, not siblings under a base class.
static func build_provider(preset: Dictionary, model_override: String, api_key: String, use_streaming: bool):
var p
match preset["kind"]:
"anthropic":
p = ClaudeGodotProviderAnthropic.new()
p.env_var = preset["env_var"]
"responses_api":
p = ClaudeGodotProviderResponsesAPI.new()
p.base_url = preset["base_url"]
p.env_var = preset["env_var"]
p.extra_headers = preset.get("extra_headers", [])
_:
p = ClaudeGodotProviderOpenAICompatible.new()
p.base_url = preset["base_url"]
p.env_var = preset["env_var"]
p.extra_headers = preset.get("extra_headers", [])
p.streaming = use_streaming
p.preset_label = preset["label"]
p.model = model_override if model_override != "" else preset["default_model"]
p.api_key = api_key
p.http_timeout = request_timeout()
return p
## Seconds to wait on a provider request. There is no fixed default: 0 means
## no timeout, because a reasoning model can legitimately take minutes and the
## dock's Stop button cancels a request that is stuck, so a deadline is not
## the only way out. Set request_timeout in preferences.csv to bound it.
static func request_timeout() -> float:
var raw := ClaudeGodotPreferences.get_value("request_timeout", "").strip_edges()
if raw == "" or not raw.is_valid_float():
return 0.0
return maxf(float(raw), 0.0)