language-operator 0.1.30 → 0.1.31
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/CHANGELOG.md +35 -0
- data/Gemfile.lock +1 -1
- data/Makefile +7 -2
- data/Rakefile +29 -0
- data/docs/dsl/SCHEMA_VERSION.md +250 -0
- data/docs/dsl/agent-reference.md +13 -0
- data/lib/language_operator/agent/safety/safe_executor.rb +12 -0
- data/lib/language_operator/cli/commands/agent.rb +54 -101
- data/lib/language_operator/cli/commands/cluster.rb +37 -1
- data/lib/language_operator/cli/commands/persona.rb +2 -5
- data/lib/language_operator/cli/commands/status.rb +5 -18
- data/lib/language_operator/cli/commands/system.rb +772 -0
- data/lib/language_operator/cli/formatters/code_formatter.rb +3 -7
- data/lib/language_operator/cli/formatters/log_formatter.rb +3 -5
- data/lib/language_operator/cli/formatters/progress_formatter.rb +3 -7
- data/lib/language_operator/cli/formatters/status_formatter.rb +37 -0
- data/lib/language_operator/cli/formatters/table_formatter.rb +10 -26
- data/lib/language_operator/cli/helpers/pastel_helper.rb +24 -0
- data/lib/language_operator/cli/main.rb +4 -0
- data/lib/language_operator/dsl/schema.rb +1102 -0
- data/lib/language_operator/dsl.rb +1 -0
- data/lib/language_operator/logger.rb +4 -4
- data/lib/language_operator/templates/README.md +23 -0
- data/lib/language_operator/templates/examples/agent_synthesis.tmpl +115 -0
- data/lib/language_operator/templates/examples/persona_distillation.tmpl +19 -0
- data/lib/language_operator/templates/schema/.gitkeep +0 -0
- data/lib/language_operator/templates/schema/CHANGELOG.md +93 -0
- data/lib/language_operator/templates/schema/agent_dsl_openapi.yaml +306 -0
- data/lib/language_operator/templates/schema/agent_dsl_schema.json +452 -0
- data/lib/language_operator/version.rb +1 -1
- data/requirements/tasks/iterate.md +2 -2
- metadata +13 -9
- data/examples/README.md +0 -569
- data/examples/agent_example.rb +0 -86
- data/examples/chat_endpoint_agent.rb +0 -118
- data/examples/github_webhook_agent.rb +0 -171
- data/examples/mcp_agent.rb +0 -158
- data/examples/oauth_callback_agent.rb +0 -296
- data/examples/stripe_webhook_agent.rb +0 -219
- data/examples/webhook_agent.rb +0 -80
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require 'rouge'
|
|
4
|
-
|
|
4
|
+
require_relative '../helpers/pastel_helper'
|
|
5
5
|
|
|
6
6
|
module LanguageOperator
|
|
7
7
|
module CLI
|
|
@@ -9,6 +9,8 @@ module LanguageOperator
|
|
|
9
9
|
# Formatter for displaying syntax-highlighted code in the terminal
|
|
10
10
|
class CodeFormatter
|
|
11
11
|
class << self
|
|
12
|
+
include Helpers::PastelHelper
|
|
13
|
+
|
|
12
14
|
# Display Ruby code with syntax highlighting
|
|
13
15
|
#
|
|
14
16
|
# @param code_content [String] The Ruby code to display
|
|
@@ -68,12 +70,6 @@ module LanguageOperator
|
|
|
68
70
|
puts highlighted
|
|
69
71
|
puts
|
|
70
72
|
end
|
|
71
|
-
|
|
72
|
-
private
|
|
73
|
-
|
|
74
|
-
def pastel
|
|
75
|
-
@pastel ||= Pastel.new
|
|
76
|
-
end
|
|
77
73
|
end
|
|
78
74
|
end
|
|
79
75
|
end
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
require_relative '../helpers/pastel_helper'
|
|
4
4
|
require 'json'
|
|
5
5
|
require 'time'
|
|
6
6
|
|
|
@@ -10,6 +10,8 @@ module LanguageOperator
|
|
|
10
10
|
# Formatter for displaying agent execution logs with color and icons
|
|
11
11
|
class LogFormatter
|
|
12
12
|
class << self
|
|
13
|
+
include Helpers::PastelHelper
|
|
14
|
+
|
|
13
15
|
# Format a single log line from kubectl output
|
|
14
16
|
#
|
|
15
17
|
# @param line [String] Raw log line from kubectl (with [pod/container] prefix)
|
|
@@ -33,10 +35,6 @@ module LanguageOperator
|
|
|
33
35
|
|
|
34
36
|
private
|
|
35
37
|
|
|
36
|
-
def pastel
|
|
37
|
-
@pastel ||= Pastel.new
|
|
38
|
-
end
|
|
39
|
-
|
|
40
38
|
# Parse the kubectl prefix from the log line
|
|
41
39
|
# Returns [prefix, content] or [nil, original_line]
|
|
42
40
|
def parse_kubectl_prefix(line)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require 'tty-spinner'
|
|
4
|
-
|
|
4
|
+
require_relative '../helpers/pastel_helper'
|
|
5
5
|
|
|
6
6
|
module LanguageOperator
|
|
7
7
|
module CLI
|
|
@@ -9,6 +9,8 @@ module LanguageOperator
|
|
|
9
9
|
# Beautiful progress output for CLI operations
|
|
10
10
|
class ProgressFormatter
|
|
11
11
|
class << self
|
|
12
|
+
include Helpers::PastelHelper
|
|
13
|
+
|
|
12
14
|
def with_spinner(message, success_msg: nil, &block)
|
|
13
15
|
spinner = TTY::Spinner.new("[:spinner] #{message}...", format: :dots, success_mark: pastel.green('✔'))
|
|
14
16
|
spinner.auto_spin
|
|
@@ -40,12 +42,6 @@ module LanguageOperator
|
|
|
40
42
|
def warn(message)
|
|
41
43
|
puts "[#{pastel.yellow('⚠')}] #{message}"
|
|
42
44
|
end
|
|
43
|
-
|
|
44
|
-
private
|
|
45
|
-
|
|
46
|
-
def pastel
|
|
47
|
-
@pastel ||= Pastel.new
|
|
48
|
-
end
|
|
49
45
|
end
|
|
50
46
|
end
|
|
51
47
|
end
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative '../helpers/pastel_helper'
|
|
4
|
+
|
|
5
|
+
module LanguageOperator
|
|
6
|
+
module CLI
|
|
7
|
+
module Formatters
|
|
8
|
+
# Unified formatter for status indicators across all commands
|
|
9
|
+
#
|
|
10
|
+
# Provides consistent colored status dots (●) for resource states
|
|
11
|
+
class StatusFormatter
|
|
12
|
+
extend Helpers::PastelHelper
|
|
13
|
+
|
|
14
|
+
# Format a status string with colored indicator
|
|
15
|
+
#
|
|
16
|
+
# @param status [String, Symbol] The status to format
|
|
17
|
+
# @return [String] Formatted status with colored dot
|
|
18
|
+
def self.format(status)
|
|
19
|
+
status_str = status.to_s
|
|
20
|
+
|
|
21
|
+
case status_str.downcase
|
|
22
|
+
when 'ready', 'running', 'active'
|
|
23
|
+
"#{pastel.green('●')} #{status_str}"
|
|
24
|
+
when 'pending', 'creating', 'synthesizing'
|
|
25
|
+
"#{pastel.yellow('●')} #{status_str}"
|
|
26
|
+
when 'failed', 'error'
|
|
27
|
+
"#{pastel.red('●')} #{status_str}"
|
|
28
|
+
when 'paused', 'stopped', 'suspended'
|
|
29
|
+
"#{pastel.dim('●')} #{status_str}"
|
|
30
|
+
else
|
|
31
|
+
"#{pastel.dim('●')} #{status_str}"
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require 'tty-table'
|
|
4
|
-
|
|
4
|
+
require_relative '../helpers/pastel_helper'
|
|
5
|
+
require_relative 'status_formatter'
|
|
5
6
|
|
|
6
7
|
module LanguageOperator
|
|
7
8
|
module CLI
|
|
@@ -9,6 +10,8 @@ module LanguageOperator
|
|
|
9
10
|
# Table output for CLI list commands
|
|
10
11
|
class TableFormatter
|
|
11
12
|
class << self
|
|
13
|
+
include Helpers::PastelHelper
|
|
14
|
+
|
|
12
15
|
def clusters(clusters)
|
|
13
16
|
return ProgressFormatter.info('No clusters found') if clusters.empty?
|
|
14
17
|
|
|
@@ -20,7 +23,7 @@ module LanguageOperator
|
|
|
20
23
|
cluster[:agents] || 0,
|
|
21
24
|
cluster[:tools] || 0,
|
|
22
25
|
cluster[:models] || 0,
|
|
23
|
-
|
|
26
|
+
StatusFormatter.format(cluster[:status] || 'Unknown')
|
|
24
27
|
]
|
|
25
28
|
end
|
|
26
29
|
|
|
@@ -36,7 +39,7 @@ module LanguageOperator
|
|
|
36
39
|
[
|
|
37
40
|
agent[:name],
|
|
38
41
|
agent[:mode],
|
|
39
|
-
|
|
42
|
+
StatusFormatter.format(agent[:status]),
|
|
40
43
|
agent[:next_run] || 'N/A',
|
|
41
44
|
agent[:executions] || 0
|
|
42
45
|
]
|
|
@@ -58,7 +61,7 @@ module LanguageOperator
|
|
|
58
61
|
cluster_name,
|
|
59
62
|
agent[:name],
|
|
60
63
|
agent[:mode],
|
|
61
|
-
|
|
64
|
+
StatusFormatter.format(agent[:status]),
|
|
62
65
|
agent[:next_run] || 'N/A',
|
|
63
66
|
agent[:executions] || 0
|
|
64
67
|
]
|
|
@@ -77,7 +80,7 @@ module LanguageOperator
|
|
|
77
80
|
[
|
|
78
81
|
tool[:name],
|
|
79
82
|
tool[:type],
|
|
80
|
-
|
|
83
|
+
StatusFormatter.format(tool[:status]),
|
|
81
84
|
tool[:agents_using] || 0
|
|
82
85
|
]
|
|
83
86
|
end
|
|
@@ -112,7 +115,7 @@ module LanguageOperator
|
|
|
112
115
|
model[:name],
|
|
113
116
|
model[:provider],
|
|
114
117
|
model[:model],
|
|
115
|
-
|
|
118
|
+
StatusFormatter.format(model[:status])
|
|
116
119
|
]
|
|
117
120
|
end
|
|
118
121
|
|
|
@@ -133,7 +136,7 @@ module LanguageOperator
|
|
|
133
136
|
cluster[:agents] || 0,
|
|
134
137
|
cluster[:tools] || 0,
|
|
135
138
|
cluster[:models] || 0,
|
|
136
|
-
|
|
139
|
+
StatusFormatter.format(cluster[:status] || 'Unknown')
|
|
137
140
|
]
|
|
138
141
|
end
|
|
139
142
|
|
|
@@ -148,30 +151,11 @@ module LanguageOperator
|
|
|
148
151
|
|
|
149
152
|
private
|
|
150
153
|
|
|
151
|
-
def status_indicator(status)
|
|
152
|
-
case status&.downcase
|
|
153
|
-
when 'ready', 'running', 'active'
|
|
154
|
-
"#{pastel.green('●')} #{status}"
|
|
155
|
-
when 'pending', 'creating', 'synthesizing'
|
|
156
|
-
"#{pastel.yellow('●')} #{status}"
|
|
157
|
-
when 'failed', 'error'
|
|
158
|
-
"#{pastel.red('●')} #{status}"
|
|
159
|
-
when 'paused', 'stopped'
|
|
160
|
-
"#{pastel.dim('●')} #{status}"
|
|
161
|
-
else
|
|
162
|
-
"#{pastel.dim('●')} #{status || 'Unknown'}"
|
|
163
|
-
end
|
|
164
|
-
end
|
|
165
|
-
|
|
166
154
|
def truncate(text, length)
|
|
167
155
|
return text if text.nil? || text.length <= length
|
|
168
156
|
|
|
169
157
|
"#{text[0...(length - 3)]}..."
|
|
170
158
|
end
|
|
171
|
-
|
|
172
|
-
def pastel
|
|
173
|
-
@pastel ||= Pastel.new
|
|
174
|
-
end
|
|
175
159
|
end
|
|
176
160
|
end
|
|
177
161
|
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'pastel'
|
|
4
|
+
|
|
5
|
+
module LanguageOperator
|
|
6
|
+
module CLI
|
|
7
|
+
module Helpers
|
|
8
|
+
# Shared module providing Pastel color functionality
|
|
9
|
+
# to CLI commands, formatters, and helpers.
|
|
10
|
+
#
|
|
11
|
+
# Usage:
|
|
12
|
+
# include PastelHelper
|
|
13
|
+
# puts pastel.green("Success!")
|
|
14
|
+
module PastelHelper
|
|
15
|
+
# Returns a memoized Pastel instance for colorizing terminal output
|
|
16
|
+
#
|
|
17
|
+
# @return [Pastel] Pastel instance
|
|
18
|
+
def pastel
|
|
19
|
+
@pastel ||= Pastel.new
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
@@ -11,6 +11,7 @@ require_relative 'commands/tool'
|
|
|
11
11
|
require_relative 'commands/model'
|
|
12
12
|
require_relative 'commands/quickstart'
|
|
13
13
|
require_relative 'commands/install'
|
|
14
|
+
require_relative 'commands/system'
|
|
14
15
|
require_relative 'formatters/progress_formatter'
|
|
15
16
|
require_relative '../config/cluster_config'
|
|
16
17
|
require_relative '../kubernetes/client'
|
|
@@ -88,6 +89,9 @@ module LanguageOperator
|
|
|
88
89
|
desc 'model SUBCOMMAND ...ARGS', 'Manage language models'
|
|
89
90
|
subcommand 'model', Commands::Model
|
|
90
91
|
|
|
92
|
+
desc 'system SUBCOMMAND ...ARGS', 'System commands for schema and metadata'
|
|
93
|
+
subcommand 'system', Commands::System
|
|
94
|
+
|
|
91
95
|
desc 'quickstart', 'Interactive setup wizard for first-time users'
|
|
92
96
|
def quickstart
|
|
93
97
|
Commands::Quickstart.new.invoke(:start)
|