for assorted things

fix update-lights: use claude-sonnet-4-5 and add --once flag

updates:
- change default model from gpt-4.1-mini to anthropic:claude-sonnet-4-5
- add anthropic_api_key to settings and set in environment
- add --once flag for single execution without interactive loop
- simplify main loop logic (remove first flag pattern)

tested and confirmed marvin.Thread() maintains context across messages
in interactive mode (e.g., "make them even dimmer" correctly references
previous office lights command).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

Changed files
+17 -8
+17 -8
update-lights
··· 35 35 36 36 hue_bridge_ip: str = Field(default=...) 37 37 hue_bridge_username: str = Field(default=...) 38 + anthropic_api_key: str | None = Field(default=None) 38 39 39 - ai_model: KnownModelName = Field(default="gpt-4.1-mini") 40 + ai_model: KnownModelName = Field(default="anthropic:claude-sonnet-4-5") 40 41 41 42 42 43 settings = Settings() ··· 55 56 56 57 57 58 if __name__ == "__main__": 59 + import os 60 + 61 + if settings.anthropic_api_key: 62 + os.environ["ANTHROPIC_API_KEY"] = settings.anthropic_api_key 63 + 58 64 parser = argparse.ArgumentParser(description="Send a command to the Marvin agent.") 59 65 parser.add_argument( 60 66 "--message", ··· 62 68 type=str, 63 69 default="soft and dim - Jessica Pratt energy, all areas", 64 70 help="The message to send to the agent (defaults to 'soft and dim - Jessica Pratt energy, all areas').", 71 + ) 72 + parser.add_argument( 73 + "--once", 74 + action="store_true", 75 + help="Run once and exit instead of entering interactive mode.", 65 76 ) 66 77 args = parser.parse_args() 67 78 ··· 79 90 ) 80 91 81 92 with marvin.Thread(): 82 - first = True 83 - while True: 84 - if first: 85 - console.print(f"\n[bold yellow]→[/bold yellow] {args.message}") 86 - agent.run(str(args.message)) 87 - first = False 88 - else: 93 + console.print(f"\n[bold yellow]→[/bold yellow] {args.message}") 94 + agent.run(str(args.message)) 95 + 96 + if not args.once: 97 + while True: 89 98 try: 90 99 user_input = Prompt.ask( 91 100 "\n[bold green]enter a message[/bold green]"