Class: Protege::DevSetup
- Inherits:
-
Object
- Object
- Protege::DevSetup
- Defined in:
- app/services/protege/dev_setup.rb
Overview
One-command development bootstrap — the service behind bin/rails protege:setup:dev. Provisions
everything a fresh host app needs to start chatting locally, except the provider API key:
- the system toolkits (via
SystemToolkits.sync!, run first so Default Tools exists to auto-attach), - the
protege.localemail domain (DKIM keypair minted on create), - the
ExecutiveAgentclass itself when the host doesn't have one — generated through the sameprotege:agentgenerator the installer uses, never guessed at or resolved from configuration, - Phoenix, an
ExecutiveAgentrecord atphoenix@protege.localwith starter instructions, - a proactive, open-gated All Tools grant, so every registered tool is exercisable in development.
Idempotent throughout — records are found-or-created, so re-running never duplicates or clobbers. Environment gating (this seeds play data) is the rake task's concern, not this service's.
Constant Summary collapse
- DOMAIN =
The development email domain. Registering it is what routes inbound mail; sharing a domain with the default
console_address(+console@protege.local+) is safe — console-local delivery is decided by address match, not domain registration. 'protege.local'- AGENT_NAME =
The development agent's identity.
'Phoenix'- AGENT_EMAIL =
"phoenix@#{DOMAIN}".freeze
- INSTRUCTIONS =
The starter system prompt — enough personality to be pleasant and enough direction to exercise tools, while staying generic (Phoenix knows nothing about any particular host app).
<<~TEXT.strip You are Phoenix, a general-purpose agent running in a development environment. You communicate by email: read what you receive, use your tools whenever they help you act or answer accurately, and reply with send_email. Keep replies short, concrete, and friendly. When asked to demonstrate a capability, actually exercise the tool and report what happened. TEXT
Class Method Summary collapse
-
.run! ⇒ Protege::Agent
Provision the full development setup.
Instance Method Summary collapse
-
#run! ⇒ Protege::Agent
Provision the full development setup.
Class Method Details
.run! ⇒ Protege::Agent
Provision the full development setup.
41 42 43 |
# File 'app/services/protege/dev_setup.rb', line 41 def run! new.run! end |
Instance Method Details
#run! ⇒ Protege::Agent
Provision the full development setup.
49 50 51 52 53 54 55 56 57 |
# File 'app/services/protege/dev_setup.rb', line 49 def run! SystemToolkits.sync! ensure_domain agent = ensure_phoenix ensure_all_tools_grant(agent:) agent end |