Module: Envoy
- Defined in:
- lib/envoy.rb,
lib/envoy/llm.rb,
lib/envoy/guard.rb,
lib/envoy/badges.rb,
lib/envoy/engine.rb,
lib/envoy/errors.rb,
lib/envoy/prompt.rb,
lib/envoy/runner.rb,
lib/envoy/library.rb,
lib/envoy/surface.rb,
lib/envoy/toolset.rb,
lib/envoy/version.rb,
lib/envoy/markdown.rb,
app/jobs/envoy/run_job.rb,
lib/envoy/page_surface.rb,
lib/envoy/compiled_tool.rb,
lib/envoy/configuration.rb,
app/models/envoy/message.rb,
lib/envoy/tool_definition.rb,
app/models/envoy/tool_call.rb,
lib/envoy/testing/fake_llm.rb,
app/models/envoy/conversation.rb,
app/jobs/envoy/application_job.rb,
app/models/envoy/application_record.rb,
app/controllers/envoy/panels_controller.rb,
app/controllers/envoy/messages_controller.rb,
app/controllers/envoy/application_controller.rb,
app/controllers/envoy/conversations_controller.rb
Defined Under Namespace
Modules: Badges, CompiledTool, Guard, Markdown, PageSurface, Testing
Classes: ApplicationController, ApplicationJob, ApplicationRecord, Configuration, Conversation, ConversationsController, Engine, Error, Forbidden, LLM, Library, Message, MessagesController, PanelsController, Prompt, PromptCycle, RunJob, Runner, Surface, ToolCall, ToolDefinition, Toolset, ToolsetCycle, UnknownLibrary, UnknownPrompt, UnknownSurface, UnknownToolset
Constant Summary
collapse
- VERSION =
"0.0.2"
Class Method Summary
collapse
Class Method Details
.config ⇒ Object
22
23
24
|
# File 'lib/envoy.rb', line 22
def config
@config ||= Configuration.new
end
|
26
27
28
|
# File 'lib/envoy.rb', line 26
def configure
yield config
end
|
.define_library(key, &block) ⇒ Object
Registers both the Library (for introspection) and its compiled Toolset
under the same key, so use :principles works like any other toolset.
69
70
71
72
73
74
75
|
# File 'lib/envoy.rb', line 69
def define_library(key, &block)
library = Library.new(key)
library.instance_eval(&block)
libraries[library.key] = library
toolsets[library.key] = library.to_toolset
library
end
|
.define_prompt(key, &block) ⇒ Object
53
54
55
56
57
|
# File 'lib/envoy.rb', line 53
def define_prompt(key, &block)
prompt = Prompt.new(key)
prompt.instance_eval(&block)
prompts[prompt.key] = prompt
end
|
.define_surface(key, &block) ⇒ Object
85
86
87
88
89
|
# File 'lib/envoy.rb', line 85
def define_surface(key, &block)
surface = Surface.new(key)
surface.instance_eval(&block)
surfaces[surface.key] = surface
end
|
39
40
41
42
43
|
# File 'lib/envoy.rb', line 39
def define_toolset(key, &block)
toolset = Toolset.new(key)
toolset.instance_eval(&block)
toolsets[toolset.key] = toolset
end
|
.libraries ⇒ Object
63
64
65
|
# File 'lib/envoy.rb', line 63
def libraries
@libraries ||= {}
end
|
.library(key) ⇒ Object
77
78
79
|
# File 'lib/envoy.rb', line 77
def library(key)
libraries.fetch(key.to_s) { raise UnknownLibrary, "no library #{key.inspect}" }
end
|
.llm(**opts) ⇒ Object
Build an LLM runner for a turn.
31
32
33
|
# File 'lib/envoy.rb', line 31
def llm(**opts)
config.llm.call(**opts)
end
|
.prompt(key) ⇒ Object
59
60
61
|
# File 'lib/envoy.rb', line 59
def prompt(key)
prompts.fetch(key.to_s) { raise UnknownPrompt, "no prompt #{key.inspect}" }
end
|
.prompts ⇒ Object
49
50
51
|
# File 'lib/envoy.rb', line 49
def prompts
@prompts ||= {}
end
|
.surface(key) ⇒ Object
91
92
93
|
# File 'lib/envoy.rb', line 91
def surface(key)
surfaces.fetch(key.to_s) { raise UnknownSurface, "no surface #{key.inspect}" }
end
|
.surfaces ⇒ Object
81
82
83
|
# File 'lib/envoy.rb', line 81
def surfaces
@surfaces ||= {}
end
|
45
46
47
|
# File 'lib/envoy.rb', line 45
def toolset(key)
toolsets.fetch(key.to_s) { raise UnknownToolset, "no toolset #{key.inspect}" }
end
|
35
36
37
|
# File 'lib/envoy.rb', line 35
def toolsets
@toolsets ||= {}
end
|
.validate! ⇒ Object
Resolve every surface's lazy references in one pass. Hosts call this at the
end of the to_prepare block that loads their definitions, so a typo fails
on boot rather than inside a job — where the failure is invisible and the
user watches "working…" forever.
99
100
101
102
|
# File 'lib/envoy.rb', line 99
def validate!
surfaces.each_value(&:validate!)
true
end
|