language-operator 0.1.31 → 0.1.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +7 -8
- data/CHANGELOG.md +14 -0
- data/CI_STATUS.md +56 -0
- data/Gemfile.lock +2 -2
- data/Makefile +22 -6
- data/lib/language_operator/agent/base.rb +10 -6
- data/lib/language_operator/agent/executor.rb +19 -97
- data/lib/language_operator/agent/safety/ast_validator.rb +62 -43
- data/lib/language_operator/agent/safety/safe_executor.rb +27 -2
- data/lib/language_operator/agent/scheduler.rb +60 -0
- data/lib/language_operator/agent/task_executor.rb +548 -0
- data/lib/language_operator/agent.rb +90 -27
- data/lib/language_operator/cli/base_command.rb +117 -0
- data/lib/language_operator/cli/commands/agent.rb +339 -407
- data/lib/language_operator/cli/commands/cluster.rb +274 -290
- data/lib/language_operator/cli/commands/install.rb +110 -119
- data/lib/language_operator/cli/commands/model.rb +284 -184
- data/lib/language_operator/cli/commands/persona.rb +218 -284
- data/lib/language_operator/cli/commands/quickstart.rb +4 -5
- data/lib/language_operator/cli/commands/status.rb +31 -35
- data/lib/language_operator/cli/commands/system.rb +221 -233
- data/lib/language_operator/cli/commands/tool.rb +356 -422
- data/lib/language_operator/cli/commands/use.rb +19 -22
- data/lib/language_operator/cli/helpers/resource_dependency_checker.rb +0 -18
- data/lib/language_operator/cli/wizards/quickstart_wizard.rb +0 -1
- data/lib/language_operator/client/config.rb +20 -21
- data/lib/language_operator/config.rb +115 -3
- data/lib/language_operator/constants.rb +54 -0
- data/lib/language_operator/dsl/agent_context.rb +7 -7
- data/lib/language_operator/dsl/agent_definition.rb +111 -26
- data/lib/language_operator/dsl/config.rb +30 -66
- data/lib/language_operator/dsl/main_definition.rb +114 -0
- data/lib/language_operator/dsl/schema.rb +84 -43
- data/lib/language_operator/dsl/task_definition.rb +315 -0
- data/lib/language_operator/dsl.rb +0 -1
- data/lib/language_operator/instrumentation/task_tracer.rb +285 -0
- data/lib/language_operator/logger.rb +4 -4
- data/lib/language_operator/synthesis_test_harness.rb +324 -0
- data/lib/language_operator/templates/examples/agent_synthesis.tmpl +26 -8
- data/lib/language_operator/templates/schema/CHANGELOG.md +26 -0
- data/lib/language_operator/templates/schema/agent_dsl_openapi.yaml +1 -1
- data/lib/language_operator/templates/schema/agent_dsl_schema.json +84 -42
- data/lib/language_operator/type_coercion.rb +250 -0
- data/lib/language_operator/ux/base.rb +81 -0
- data/lib/language_operator/ux/concerns/README.md +155 -0
- data/lib/language_operator/ux/concerns/headings.rb +90 -0
- data/lib/language_operator/ux/concerns/input_validation.rb +146 -0
- data/lib/language_operator/ux/concerns/provider_helpers.rb +167 -0
- data/lib/language_operator/ux/create_agent.rb +252 -0
- data/lib/language_operator/ux/create_model.rb +267 -0
- data/lib/language_operator/ux/quickstart.rb +594 -0
- data/lib/language_operator/version.rb +1 -1
- data/lib/language_operator.rb +2 -0
- data/requirements/ARCHITECTURE.md +1 -0
- data/requirements/SCRATCH.md +153 -0
- data/requirements/dsl.md +0 -0
- data/requirements/features +1 -0
- data/requirements/personas +1 -0
- data/requirements/proposals +1 -0
- data/requirements/tasks/iterate.md +14 -15
- data/requirements/tasks/optimize.md +13 -4
- data/synth/001/Makefile +90 -0
- data/synth/001/agent.rb +26 -0
- data/synth/001/agent.yaml +7 -0
- data/synth/001/output.log +44 -0
- data/synth/Makefile +39 -0
- data/synth/README.md +342 -0
- metadata +37 -10
- data/lib/language_operator/dsl/workflow_definition.rb +0 -259
- data/test_agent_dsl.rb +0 -108
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
require_relative '../base_command'
|
|
4
4
|
require 'open3'
|
|
5
5
|
require_relative '../formatters/progress_formatter'
|
|
6
6
|
require_relative '../helpers/cluster_validator'
|
|
@@ -10,7 +10,7 @@ module LanguageOperator
|
|
|
10
10
|
module CLI
|
|
11
11
|
module Commands
|
|
12
12
|
# Install, upgrade, and uninstall commands for the language-operator
|
|
13
|
-
class Install <
|
|
13
|
+
class Install < BaseCommand
|
|
14
14
|
HELM_REPO_NAME = 'language-operator'
|
|
15
15
|
HELM_REPO_URL = 'https://language-operator.github.io/charts'
|
|
16
16
|
CHART_NAME = 'language-operator/language-operator'
|
|
@@ -113,56 +113,53 @@ module LanguageOperator
|
|
|
113
113
|
option :wait, type: :boolean, default: true, desc: 'Wait for deployment to complete'
|
|
114
114
|
option :create_namespace, type: :boolean, default: true, desc: 'Create namespace if it does not exist'
|
|
115
115
|
def install
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
116
|
+
handle_command_error('install') do
|
|
117
|
+
# Check if helm is available
|
|
118
|
+
check_helm_installed!
|
|
119
|
+
|
|
120
|
+
# Check if operator is already installed
|
|
121
|
+
if operator_installed? && !options[:dry_run]
|
|
122
|
+
Formatters::ProgressFormatter.warn('Language operator is already installed')
|
|
123
|
+
puts
|
|
124
|
+
puts 'To upgrade, use:'
|
|
125
|
+
puts ' aictl upgrade'
|
|
126
|
+
return
|
|
127
|
+
end
|
|
127
128
|
|
|
128
|
-
|
|
129
|
+
namespace = options[:namespace]
|
|
129
130
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
131
|
+
puts 'Installing language-operator...'
|
|
132
|
+
puts " Namespace: #{namespace}"
|
|
133
|
+
puts " Chart: #{CHART_NAME}"
|
|
134
|
+
puts
|
|
134
135
|
|
|
135
|
-
|
|
136
|
-
|
|
136
|
+
# Add Helm repository
|
|
137
|
+
add_helm_repo unless options[:dry_run]
|
|
137
138
|
|
|
138
|
-
|
|
139
|
-
|
|
139
|
+
# Build helm install command
|
|
140
|
+
cmd = build_helm_command('install', namespace)
|
|
140
141
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
success, output = run_helm_command(cmd)
|
|
147
|
-
puts output
|
|
148
|
-
else
|
|
149
|
-
Formatters::ProgressFormatter.with_spinner('Installing language-operator') do
|
|
142
|
+
# Execute helm install
|
|
143
|
+
if options[:dry_run]
|
|
144
|
+
puts 'Dry run - would execute:'
|
|
145
|
+
puts " #{cmd}"
|
|
146
|
+
puts
|
|
150
147
|
success, output = run_helm_command(cmd)
|
|
151
|
-
|
|
152
|
-
|
|
148
|
+
puts output
|
|
149
|
+
else
|
|
150
|
+
Formatters::ProgressFormatter.with_spinner('Installing language-operator') do
|
|
151
|
+
success, output = run_helm_command(cmd)
|
|
152
|
+
raise "Helm install failed: #{output}" unless success
|
|
153
|
+
end
|
|
153
154
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
155
|
+
Formatters::ProgressFormatter.success('Language operator installed successfully!')
|
|
156
|
+
puts
|
|
157
|
+
puts 'Next steps:'
|
|
158
|
+
puts ' 1. Create a cluster: aictl cluster create my-cluster'
|
|
159
|
+
puts ' 2. Create a model: aictl model create gpt4 --provider openai --model gpt-4-turbo'
|
|
160
|
+
puts ' 3. Create an agent: aictl agent create "your agent description"'
|
|
161
|
+
end
|
|
160
162
|
end
|
|
161
|
-
rescue StandardError => e
|
|
162
|
-
Formatters::ProgressFormatter.error("Installation failed: #{e.message}")
|
|
163
|
-
raise if ENV['DEBUG']
|
|
164
|
-
|
|
165
|
-
exit 1
|
|
166
163
|
end
|
|
167
164
|
|
|
168
165
|
desc 'upgrade', 'Upgrade the language-operator using Helm'
|
|
@@ -191,51 +188,48 @@ module LanguageOperator
|
|
|
191
188
|
option :dry_run, type: :boolean, default: false, desc: 'Preview upgrade without applying'
|
|
192
189
|
option :wait, type: :boolean, default: true, desc: 'Wait for deployment to complete'
|
|
193
190
|
def upgrade
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
191
|
+
handle_command_error('upgrade') do
|
|
192
|
+
# Check if helm is available
|
|
193
|
+
check_helm_installed!
|
|
194
|
+
|
|
195
|
+
# Check if operator is installed
|
|
196
|
+
unless operator_installed?
|
|
197
|
+
Formatters::ProgressFormatter.error('Language operator is not installed')
|
|
198
|
+
puts
|
|
199
|
+
puts 'To install, use:'
|
|
200
|
+
puts ' aictl install'
|
|
201
|
+
exit 1
|
|
202
|
+
end
|
|
205
203
|
|
|
206
|
-
|
|
204
|
+
namespace = options[:namespace]
|
|
207
205
|
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
206
|
+
puts 'Upgrading language-operator...'
|
|
207
|
+
puts " Namespace: #{namespace}"
|
|
208
|
+
puts " Chart: #{CHART_NAME}"
|
|
209
|
+
puts
|
|
212
210
|
|
|
213
|
-
|
|
214
|
-
|
|
211
|
+
# Update Helm repository
|
|
212
|
+
update_helm_repo unless options[:dry_run]
|
|
215
213
|
|
|
216
|
-
|
|
217
|
-
|
|
214
|
+
# Build helm upgrade command
|
|
215
|
+
cmd = build_helm_command('upgrade', namespace)
|
|
218
216
|
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
success, output = run_helm_command(cmd)
|
|
225
|
-
puts output
|
|
226
|
-
else
|
|
227
|
-
Formatters::ProgressFormatter.with_spinner('Upgrading language-operator') do
|
|
217
|
+
# Execute helm upgrade
|
|
218
|
+
if options[:dry_run]
|
|
219
|
+
puts 'Dry run - would execute:'
|
|
220
|
+
puts " #{cmd}"
|
|
221
|
+
puts
|
|
228
222
|
success, output = run_helm_command(cmd)
|
|
229
|
-
|
|
230
|
-
|
|
223
|
+
puts output
|
|
224
|
+
else
|
|
225
|
+
Formatters::ProgressFormatter.with_spinner('Upgrading language-operator') do
|
|
226
|
+
success, output = run_helm_command(cmd)
|
|
227
|
+
raise "Helm upgrade failed: #{output}" unless success
|
|
228
|
+
end
|
|
231
229
|
|
|
232
|
-
|
|
230
|
+
Formatters::ProgressFormatter.success('Language operator upgraded successfully!')
|
|
231
|
+
end
|
|
233
232
|
end
|
|
234
|
-
rescue StandardError => e
|
|
235
|
-
Formatters::ProgressFormatter.error("Upgrade failed: #{e.message}")
|
|
236
|
-
raise if ENV['DEBUG']
|
|
237
|
-
|
|
238
|
-
exit 1
|
|
239
233
|
end
|
|
240
234
|
|
|
241
235
|
desc 'uninstall', 'Uninstall the language-operator using Helm'
|
|
@@ -258,49 +252,46 @@ module LanguageOperator
|
|
|
258
252
|
option :namespace, type: :string, default: DEFAULT_NAMESPACE, desc: 'Kubernetes namespace'
|
|
259
253
|
option :force, type: :boolean, default: false, desc: 'Skip confirmation prompt'
|
|
260
254
|
def uninstall
|
|
261
|
-
|
|
262
|
-
|
|
255
|
+
handle_command_error('uninstall') do
|
|
256
|
+
# Check if helm is available
|
|
257
|
+
check_helm_installed!
|
|
258
|
+
|
|
259
|
+
# Check if operator is installed
|
|
260
|
+
unless operator_installed?
|
|
261
|
+
Formatters::ProgressFormatter.warn('Language operator is not installed')
|
|
262
|
+
return
|
|
263
|
+
end
|
|
263
264
|
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
265
|
+
namespace = options[:namespace]
|
|
266
|
+
|
|
267
|
+
# Confirm deletion unless --force
|
|
268
|
+
unless options[:force]
|
|
269
|
+
puts "This will uninstall the language-operator from namespace '#{namespace}'"
|
|
270
|
+
puts
|
|
271
|
+
puts 'WARNING: This will NOT delete:'
|
|
272
|
+
puts ' - CRDs (CustomResourceDefinitions)'
|
|
273
|
+
puts ' - LanguageAgent resources'
|
|
274
|
+
puts ' - LanguageTool resources'
|
|
275
|
+
puts ' - LanguageModel resources'
|
|
276
|
+
puts ' - LanguagePersona resources'
|
|
277
|
+
puts
|
|
278
|
+
return unless Helpers::UserPrompts.confirm('Continue with uninstall?')
|
|
279
|
+
end
|
|
269
280
|
|
|
270
|
-
|
|
281
|
+
# Build helm uninstall command
|
|
282
|
+
cmd = "helm uninstall #{RELEASE_NAME} --namespace #{namespace}"
|
|
271
283
|
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
puts ' - CRDs (CustomResourceDefinitions)'
|
|
278
|
-
puts ' - LanguageAgent resources'
|
|
279
|
-
puts ' - LanguageTool resources'
|
|
280
|
-
puts ' - LanguageModel resources'
|
|
281
|
-
puts ' - LanguagePersona resources'
|
|
282
|
-
puts
|
|
283
|
-
return unless Helpers::UserPrompts.confirm('Continue with uninstall?')
|
|
284
|
-
end
|
|
285
|
-
|
|
286
|
-
# Build helm uninstall command
|
|
287
|
-
cmd = "helm uninstall #{RELEASE_NAME} --namespace #{namespace}"
|
|
284
|
+
# Execute helm uninstall
|
|
285
|
+
Formatters::ProgressFormatter.with_spinner('Uninstalling language-operator') do
|
|
286
|
+
success, output = run_helm_command(cmd)
|
|
287
|
+
raise "Helm uninstall failed: #{output}" unless success
|
|
288
|
+
end
|
|
288
289
|
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
290
|
+
Formatters::ProgressFormatter.success('Language operator uninstalled successfully!')
|
|
291
|
+
puts
|
|
292
|
+
puts 'Note: CRDs and custom resources remain in the cluster.'
|
|
293
|
+
puts 'To completely remove all resources, you must manually delete them.'
|
|
293
294
|
end
|
|
294
|
-
|
|
295
|
-
Formatters::ProgressFormatter.success('Language operator uninstalled successfully!')
|
|
296
|
-
puts
|
|
297
|
-
puts 'Note: CRDs and custom resources remain in the cluster.'
|
|
298
|
-
puts 'To completely remove all resources, you must manually delete them.'
|
|
299
|
-
rescue StandardError => e
|
|
300
|
-
Formatters::ProgressFormatter.error("Uninstall failed: #{e.message}")
|
|
301
|
-
raise if ENV['DEBUG']
|
|
302
|
-
|
|
303
|
-
exit 1
|
|
304
295
|
end
|
|
305
296
|
|
|
306
297
|
private
|