Class: AgentHarness::Providers::OhMyPi
- Inherits:
-
Base
- Object
- Base
- AgentHarness::Providers::OhMyPi
show all
- Defined in:
- lib/agent_harness/providers/omp.rb
Overview
Oh My Pi coding agent CLI provider
Provides integration with the Oh My Pi (can1357/oh-my-pi) terminal
coding agent, a Bun-based fork of the Pi coding agent. Distinct from
the Pi provider, which targets the upstream @mariozechner/pi-coding-agent
CLI.
Constant Summary
collapse
- CLI_PACKAGE =
"@oh-my-pi/pi-coding-agent"
- SUPPORTED_CLI_VERSION =
"17.0.1"
- SUPPORTED_CLI_REQUIREMENT =
Gem::Requirement.new("= #{SUPPORTED_CLI_VERSION}").freeze
- BUN_BINARY =
Bun runtime requirements. The omp entrypoint is
#!/usr/bin/env bun and the published package metadata requires
Bun >= 1.3.14. Consumers must provision a compatible Bun runtime
before installing the @oh-my-pi/pi-coding-agent package.
The bun npm package relies on its postinstall script to fetch the
platform binary; installing it with npm install --ignore-scripts
ships only the Windows shims (bin/bun.exe, bunx.exe) and leaves
Linux/macOS without a working bun binary. Provision Bun via the
official installer script instead, which fetches the correct
platform binary directly.
"bun"
- BUN_INSTALL_SCRIPT_URL =
"https://bun.sh/install"
- SUPPORTED_BUN_VERSION =
"1.3.14"
- BUN_REQUIREMENT_STRING =
">= #{SUPPORTED_BUN_VERSION}".freeze
Constants inherited
from Base
Base::COMMON_ERROR_PATTERNS, Base::DEFAULT_SMOKE_TEST_CONTRACT
Instance Attribute Summary
Attributes inherited from Base
#config, #executor, #logger
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
#api_key_env_var_names, #api_key_unset_vars, #cli_env_overrides, #configure, #initialize, #parse_container_output, #parse_test_error, #plan_execution, #preflight_check, #sandboxed_environment?, #send_chat_message, #send_message, #subscription_unset_vars, #test_command_overrides
#parse_rate_limit_reset
Methods included from Adapter
#auth_lock_config, #build_mcp_flags, #chat_transport, #chat_transport_type, #config_file_content, #dangerous_mode_flags, #error_classification_patterns, #fetch_mcp_servers, #health_status, #heartbeat_integration, included, metadata_package_name, #noisy_error_patterns, normalize_metadata_installation, normalize_metadata_runtime_requirements, normalize_metadata_source_type, normalize_metadata_version_requirement, #notify_hook_content, #parse_rate_limit_reset, #plan_execution, #preflight_check, #send_message, #session_flags, #smoke_test, #smoke_test_contract, #supported_mcp_transports, #supports_activity_heartbeat?, #supports_chat?, #supports_dangerous_mode?, #supports_mcp?, #supports_message_tool_injection?, #supports_sessions?, #supports_text_mode?, #supports_token_counting?, #token_usage_from_api_response, #translate_error, #validate_config, #validate_mcp_servers!
Class Method Details
.binary_name ⇒ Object
39
40
41
|
# File 'lib/agent_harness/providers/omp.rb', line 39
def binary_name
"omp"
end
|
.bun_runtime_contract ⇒ Object
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
|
# File 'lib/agent_harness/providers/omp.rb', line 86
def bun_runtime_contract
install_command_prefix = ["sh", "-c"].freeze
inner_script = "curl -fsSL #{BUN_INSTALL_SCRIPT_URL} | " \
"BUN_VERSION=#{SUPPORTED_BUN_VERSION} bash"
install_command = (install_command_prefix + [inner_script]).freeze
{
name: :bun,
binary_name: BUN_BINARY,
pinned_version: SUPPORTED_BUN_VERSION,
version_requirement: BUN_REQUIREMENT_STRING,
source: :script,
install_script_url: BUN_INSTALL_SCRIPT_URL,
install_command_prefix: install_command_prefix,
install_command: install_command,
install_command_string: inner_script,
rationale: "omp entrypoint is #!/usr/bin/env bun; the bun npm package relies on " \
"its postinstall script to fetch the platform binary, so install Bun " \
"via the official installer script rather than npm --ignore-scripts"
}.freeze
end
|
.discover_models ⇒ Object
81
82
83
84
|
# File 'lib/agent_harness/providers/omp.rb', line 81
def discover_models
return [] unless available?
[]
end
|
.firewall_requirements ⇒ Object
57
58
59
60
61
62
63
64
|
# File 'lib/agent_harness/providers/omp.rb', line 57
def firewall_requirements
{
domains: [
"pi.dev"
],
ip_ranges: []
}
end
|
.installation_contract(version: SUPPORTED_CLI_VERSION) ⇒ Object
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
|
# File 'lib/agent_harness/providers/omp.rb', line 110
def installation_contract(version: SUPPORTED_CLI_VERSION)
version = version.strip if version.respond_to?(:strip)
unless version.is_a?(String) && !version.empty?
raise ArgumentError,
"Unsupported Oh My Pi CLI version #{version.inspect}; " \
"supported versions must satisfy #{SUPPORTED_CLI_REQUIREMENT}"
end
parsed_version = begin
Gem::Version.new(version)
rescue ArgumentError
raise ArgumentError,
"Unsupported Oh My Pi CLI version #{version.inspect}; " \
"supported versions must satisfy #{SUPPORTED_CLI_REQUIREMENT}"
end
unless SUPPORTED_CLI_REQUIREMENT.satisfied_by?(parsed_version)
raise ArgumentError,
"Unsupported Oh My Pi CLI version #{version.inspect}; " \
"supported versions must satisfy #{SUPPORTED_CLI_REQUIREMENT}"
end
package = "#{CLI_PACKAGE}@#{version}".freeze
install_command_prefix = ["npm", "install", "-g", "--ignore-scripts"].freeze
install_command = (install_command_prefix + [package]).freeze
supported_versions = [version].freeze
version_requirement = SUPPORTED_CLI_REQUIREMENT.requirements
.map { |op, ver| "#{op} #{ver}".freeze }
.freeze
contract = {
source: :npm,
package: package,
package_name: CLI_PACKAGE,
version: version,
version_requirement: version_requirement,
binary_name: binary_name,
install_command_prefix: install_command_prefix,
install_command: install_command,
supported_versions: supported_versions,
runtime_requirements: [bun_runtime_contract]
}
contract.each_value do |value|
value.freeze if value.is_a?(String)
end
contract.freeze
end
|
.instruction_file_paths ⇒ Object
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
# File 'lib/agent_harness/providers/omp.rb', line 66
def instruction_file_paths
[
{
path: "AGENTS.md",
description: "Oh My Pi agent instructions",
symlink: false
},
{
path: "SYSTEM.md",
description: "Oh My Pi system prompt override",
symlink: false
}
]
end
|
48
49
50
51
52
53
54
55
|
# File 'lib/agent_harness/providers/omp.rb', line 48
def provider_metadata_overrides
{
auth: {
service: :omp,
api_family: :multi_provider
}
}
end
|
.provider_name ⇒ Object
35
36
37
|
# File 'lib/agent_harness/providers/omp.rb', line 35
def provider_name
:omp
end
|
.smoke_test_contract ⇒ Object
Instance Method Details
#auth_type ⇒ Object
218
219
220
|
# File 'lib/agent_harness/providers/omp.rb', line 218
def auth_type
:oauth
end
|
#capabilities ⇒ Object
196
197
198
199
200
201
202
203
204
205
206
207
208
|
# File 'lib/agent_harness/providers/omp.rb', line 196
def capabilities
{
streaming: false,
file_upload: true,
vision: true,
tool_use: true,
json_mode: false,
mcp: false,
dangerous_mode: false
}
end
|
#configuration_schema ⇒ Object
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
|
# File 'lib/agent_harness/providers/omp.rb', line 173
def configuration_schema
{
fields: [
{
name: :model,
type: :string,
label: "Model",
required: false,
hint: "Oh My Pi model pattern or ID passed to --model"
},
{
name: :provider,
type: :string,
label: "Provider",
required: false,
hint: "Oh My Pi provider name passed to --provider"
}
],
auth_modes: %i[api_key oauth],
openai_compatible: false
}
end
|
#display_name ⇒ Object
169
170
171
|
# File 'lib/agent_harness/providers/omp.rb', line 169
def display_name
"Oh My Pi"
end
|
#error_patterns ⇒ Object
210
211
212
|
# File 'lib/agent_harness/providers/omp.rb', line 210
def error_patterns
COMMON_ERROR_PATTERNS
end
|
#execution_semantics ⇒ Object
222
223
224
225
226
227
228
229
230
231
232
233
|
# File 'lib/agent_harness/providers/omp.rb', line 222
def execution_semantics
{
prompt_delivery: :flag,
output_format: :text,
sandbox_aware: false,
uses_subcommand: false,
non_interactive_flag: "-p",
legitimate_exit_codes: [0],
stderr_is_diagnostic: true,
parses_rate_limit_reset: false
}
end
|
#name ⇒ Object
165
166
167
|
# File 'lib/agent_harness/providers/omp.rb', line 165
def name
"omp"
end
|
214
215
216
|
# File 'lib/agent_harness/providers/omp.rb', line 214
def supports_tool_control?
true
end
|