feat(weather): KMA current weather inside Korea with the app's stored key

The 기능 screen's 기상청 날씨 card stores the KMA API hub key encrypted
(kmaApiKey, masked in logs). On start the app passes it to the worker in
JARVIS_KMA_API_KEY; the worker takes it out of its environment before any
child process starts. Inside Korea getWeather reads 초단기실황 and the
coming hour's sky from 초단기예보, and falls back to open-meteo, then
met.no, on any KMA failure. The key is in KMA's URLs, so failures are
logged by their kind only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
javis-bot
2026-11-18 10:05:31 +09:00
parent e99831e540
commit 282f114e60
10 changed files with 383 additions and 22 deletions

View File

@@ -38,10 +38,12 @@ def main() -> int:
print("JARVIS_VOICE_TOKEN is not set", file=sys.stderr)
return 2
# The MCP servers' secrets leave the environment before any child process (MeloTTS) starts;
# The MCP servers' secrets and the KMA key leave the environment before any child process (MeloTTS) starts;
# only the brain gets them (voice_worker.spec.md, "Tools").
from .brain import take_mcp_env
mcp_env = take_mcp_env()
from jarvis.tools.builtin.weather import take_kma_key
take_kma_key()
from .server import VoiceWorker, is_loopback, nvidia_card
from .stt_whisper import WhisperTranscriber

View File

@@ -288,6 +288,11 @@ which carry Discord's own time.
environment at start, before any child process (MeloTTS) runs, hands it to the brain, and the
brain adds each server's values to that server's environment only. Each server's outcome is printed without debug logging (category `llm`):
`MCP server <name>: <n> tool(s)`, or `Warning: MCP server <name> failed: <reason>`.
The KMA key (`JARVIS_KMA_API_KEY`, `app/src/admin.spec.md`) leaves the environment at the same
point; the weather tool keeps it and uses it only for the current weather inside Korea
(geocoded or detected country `KR`): KMA's 초단기실황 (temperature, humidity, wind,
precipitation) and 초단기예보 (the coming hour's sky). Any KMA failure falls back to open-meteo,
then met.no; the key is in KMA's URLs, so a failure is logged by its kind only.
- `prepare` tells the brain that `user` is saying a call whose partial transcript is `text` (the app
sends it while the speaker is still talking, `app/src/conversation.spec.md`). The brain runs the
intent judge's tool pick for it on its own thread, with the asker's dialogue memory and the tool