language-operator 0.1.30 → 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 +49 -0
- data/CI_STATUS.md +56 -0
- data/Gemfile.lock +2 -2
- data/Makefile +28 -7
- 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/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 +39 -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 +351 -466
- data/lib/language_operator/cli/commands/cluster.rb +276 -256
- 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 +220 -289
- data/lib/language_operator/cli/commands/quickstart.rb +4 -5
- data/lib/language_operator/cli/commands/status.rb +36 -53
- data/lib/language_operator/cli/commands/system.rb +760 -0
- 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/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/helpers/resource_dependency_checker.rb +0 -18
- data/lib/language_operator/cli/main.rb +4 -0
- 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 +1143 -0
- data/lib/language_operator/dsl/task_definition.rb +315 -0
- data/lib/language_operator/dsl.rb +1 -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/README.md +23 -0
- data/lib/language_operator/templates/examples/agent_synthesis.tmpl +133 -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 +119 -0
- data/lib/language_operator/templates/schema/agent_dsl_openapi.yaml +306 -0
- data/lib/language_operator/templates/schema/agent_dsl_schema.json +494 -0
- 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 +49 -18
- 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
- data/lib/language_operator/dsl/workflow_definition.rb +0 -259
- data/test_agent_dsl.rb +0 -108
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d5dc7f8d30b6d4029cd6be018e1cb78a2f3779e3b5e06a49c85648822edc304b
|
|
4
|
+
data.tar.gz: b6477ee7aa7a734465b5575aa2e872c9faa0a12f0fa5e840f75da3a3b5919350
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c09b107879c42051385607177fc0327aa6bdfb47f5911ff5d1632b5f5079b08ba92cd3525bb4e97d984e69fa74cd1bca4eca5cebac4a1b3a1a290ff699ce1b97
|
|
7
|
+
data.tar.gz: c4715a300429d64d660f918d2776dd03e1e5d712cbb8a256405a88712f537349f43cc8bb46077bddad5f80767aa5be8b695fa6f5563d85f9f260c624211a9dd0
|
data/.rubocop.yml
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
AllCops:
|
|
4
4
|
NewCops: enable
|
|
5
|
-
TargetRubyVersion: 3.
|
|
5
|
+
TargetRubyVersion: 3.4
|
|
6
6
|
SuggestExtensions: false
|
|
7
7
|
Exclude:
|
|
8
8
|
- 'vendor/**/*'
|
|
@@ -12,13 +12,7 @@ AllCops:
|
|
|
12
12
|
|
|
13
13
|
# Metrics
|
|
14
14
|
Metrics/BlockLength:
|
|
15
|
-
|
|
16
|
-
Exclude:
|
|
17
|
-
- 'spec/**/*'
|
|
18
|
-
- 'Rakefile'
|
|
19
|
-
- '*.gemspec'
|
|
20
|
-
- 'test_*.rb'
|
|
21
|
-
- 'examples/**/*'
|
|
15
|
+
Enabled: false
|
|
22
16
|
|
|
23
17
|
Metrics/MethodLength:
|
|
24
18
|
Max: 35
|
|
@@ -45,6 +39,8 @@ Metrics/ClassLength:
|
|
|
45
39
|
- 'lib/language_operator/cli/**/*'
|
|
46
40
|
- 'lib/language_operator/agent/**/*'
|
|
47
41
|
- 'lib/language_operator/kubernetes/**/*'
|
|
42
|
+
- 'lib/language_operator/dsl/**/*'
|
|
43
|
+
- 'lib/language_operator/synthesis_test_harness.rb'
|
|
48
44
|
|
|
49
45
|
Metrics/ModuleLength:
|
|
50
46
|
Max: 150
|
|
@@ -116,6 +112,7 @@ Naming/MethodParameterName:
|
|
|
116
112
|
Naming/PredicateMethod:
|
|
117
113
|
Exclude:
|
|
118
114
|
- 'lib/language_operator/agent/webhook_authenticator.rb'
|
|
115
|
+
- 'lib/language_operator/synthesis_test_harness.rb'
|
|
119
116
|
|
|
120
117
|
# Layout
|
|
121
118
|
Layout/LineLength:
|
|
@@ -123,3 +120,5 @@ Layout/LineLength:
|
|
|
123
120
|
Exclude:
|
|
124
121
|
- 'spec/**/*'
|
|
125
122
|
- '*.gemspec'
|
|
123
|
+
- 'lib/language_operator/agent/executor.rb'
|
|
124
|
+
- 'lib/language_operator/synthesis_test_harness.rb'
|
data/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,55 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
### Removed
|
|
11
|
+
- **BREAKING**: Removed deprecated DSL v0 (workflow/step model)
|
|
12
|
+
- Deleted `WorkflowDefinition` and `StepDefinition` classes
|
|
13
|
+
- Removed `workflow` method from agent definitions
|
|
14
|
+
- Removed workflow execution logic from executor
|
|
15
|
+
- Removed workflow/step schema definitions
|
|
16
|
+
- Users must migrate to DSL v1 (task/main model)
|
|
17
|
+
- See `requirements/proposals/dsl-v1.md` for migration guide
|
|
18
|
+
|
|
19
|
+
### Changed
|
|
20
|
+
- Updated agent definition examples to use task/main pattern
|
|
21
|
+
- Updated JSON schema artifacts to reflect DSL v1 only
|
|
22
|
+
- Updated documentation to focus exclusively on task/main model
|
|
23
|
+
|
|
24
|
+
### Added
|
|
25
|
+
- **Schema Version Method**: Added `LanguageOperator::Dsl::Schema.version` method that returns the current schema version (linked to gem version)
|
|
26
|
+
- **Schema Versioning Documentation**: Added comprehensive `docs/dsl/SCHEMA_VERSION.md` documenting versioning policy, semantic version semantics for schema changes, compatibility rules, and deprecation policy
|
|
27
|
+
- **Schema Export CLI Commands**: New `aictl system schema` command for exporting DSL schema
|
|
28
|
+
- Export as JSON Schema v7 (default): `aictl system schema`
|
|
29
|
+
- Export as YAML: `aictl system schema --format yaml`
|
|
30
|
+
- Export as OpenAPI 3.0.3 spec: `aictl system schema --format openapi`
|
|
31
|
+
- Show version only: `aictl system schema --version`
|
|
32
|
+
- **Synthesis Template Management**: New `aictl system synthesis-template` command for managing code generation templates
|
|
33
|
+
- Export agent synthesis template: `aictl system synthesis-template`
|
|
34
|
+
- Export persona distillation template: `aictl system synthesis-template --type persona`
|
|
35
|
+
- Export with JSON/YAML metadata: `aictl system synthesis-template --format json --with-schema`
|
|
36
|
+
- Validate template syntax: `aictl system synthesis-template --validate`
|
|
37
|
+
- **Template Validation**: New `aictl system validate-template` command for validating synthesis templates
|
|
38
|
+
- Validate custom templates: `aictl system validate-template --template /path/to/template.tmpl`
|
|
39
|
+
- Validate bundled templates: `aictl system validate-template --type agent`
|
|
40
|
+
- AST-based validation against DSL schema
|
|
41
|
+
- Detailed violation reporting with line numbers
|
|
42
|
+
- **Synthesis Testing**: New `aictl system test-synthesis` command for testing agent code generation
|
|
43
|
+
- Test synthesis from natural language: `aictl system test-synthesis --instructions "Monitor GitHub issues"`
|
|
44
|
+
- Dry-run mode to preview prompts: `--dry-run`
|
|
45
|
+
- Automatic temporal intent detection (scheduled vs autonomous)
|
|
46
|
+
- LLM-powered code generation with validation
|
|
47
|
+
- **Schema Artifacts**: Auto-generated schema artifacts stored in `lib/language_operator/templates/schema/`
|
|
48
|
+
- `agent_dsl_schema.json` - Complete JSON Schema v7 specification
|
|
49
|
+
- `agent_dsl_openapi.yaml` - OpenAPI 3.0.3 API documentation
|
|
50
|
+
- `CHANGELOG.md` - Schema version history
|
|
51
|
+
- **Safe Methods API**: New public methods on `LanguageOperator::Dsl::Schema`
|
|
52
|
+
- `Schema.safe_agent_methods` - Returns array of safe agent DSL methods
|
|
53
|
+
- `Schema.safe_tool_methods` - Returns array of safe tool DSL methods
|
|
54
|
+
- `Schema.safe_helper_methods` - Returns array of safe helper methods
|
|
55
|
+
- Schema version method includes YARD documentation with examples
|
|
56
|
+
- Tests added for schema version access and validation
|
|
57
|
+
- Integration tests for all new CLI commands
|
|
58
|
+
|
|
10
59
|
### Changed
|
|
11
60
|
- **GitHub Migration**: Migrated project from self-hosted Forgejo to GitHub
|
|
12
61
|
- Repository now hosted at: https://github.com/language-operator/language-operator-gem
|
data/CI_STATUS.md
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# CI Integration Test Status
|
|
2
|
+
|
|
3
|
+
## Summary
|
|
4
|
+
|
|
5
|
+
The CI integration tests are significantly improved from their previous completely broken state.
|
|
6
|
+
|
|
7
|
+
### Fixed Issues
|
|
8
|
+
|
|
9
|
+
1. **Numeric Constant Error** ✅
|
|
10
|
+
- **Problem**: SafeExecutor sandbox was blocking access to Ruby type constants (Numeric, Integer, Float, etc.)
|
|
11
|
+
- **Solution**: Inject type constants into the evaluated code scope in SafeExecutor#eval
|
|
12
|
+
- **Impact**: All symbolic tasks using type checking now work correctly
|
|
13
|
+
|
|
14
|
+
2. **Neural Task Connection Errors** ✅
|
|
15
|
+
- **Problem**: Agent tried to connect to real LLM when INTEGRATION_MOCK_LLM=true, failing with "Not connected"
|
|
16
|
+
- **Solution**: Create mock chat object in create_test_agent when mocking is enabled
|
|
17
|
+
- **Impact**: Neural tasks can now execute without real LLM connection
|
|
18
|
+
|
|
19
|
+
3. **Deep Symbol Keys** ✅
|
|
20
|
+
- **Problem**: Nested hashes in neural task outputs had string keys, tests expected symbol keys
|
|
21
|
+
- **Solution**: Implement deep_symbolize_keys in TaskExecutor#parse_neural_response
|
|
22
|
+
- **Impact**: Nested hash structures now match test expectations
|
|
23
|
+
|
|
24
|
+
4. **Multi-Provider LLM Support** ✅
|
|
25
|
+
- **Problem**: Tests only supported OpenAI
|
|
26
|
+
- **Solution**: Added support for SYNTHESIS_*, ANTHROPIC_*, and OPENAI_API_KEY env vars
|
|
27
|
+
- **Impact**: Tests can use local models, Claude, or OpenAI
|
|
28
|
+
|
|
29
|
+
### Current Test Status
|
|
30
|
+
|
|
31
|
+
**Passing Tests** (28/72, 39%):
|
|
32
|
+
- ✅ Comprehensive DSL v1 Integration (all 4 scenarios)
|
|
33
|
+
- ✅ Symbolic Task Execution (complete)
|
|
34
|
+
- ✅ Error Handling (skipped DSL syntax issues)
|
|
35
|
+
- ✅ Type Coercion (partial)
|
|
36
|
+
|
|
37
|
+
**Failing Tests** (44/72, 61%):
|
|
38
|
+
- ❌ Neural Task Execution - individual mocks don't match all output schemas
|
|
39
|
+
- ❌ Hybrid Agent Execution - some neural tasks failing
|
|
40
|
+
- ❌ Parallel Execution - some neural tasks failing
|
|
41
|
+
|
|
42
|
+
**Pending Tests**: 20 (performance benchmarks disabled)
|
|
43
|
+
|
|
44
|
+
### Recommendations
|
|
45
|
+
|
|
46
|
+
For full CI coverage with mocked LLMs, consider:
|
|
47
|
+
1. Use real LLM in CI (with API key secrets) instead of mocking
|
|
48
|
+
2. Add schema-aware mock generation based on task output definitions
|
|
49
|
+
3. Add individual mocks for each failing neural task (tedious but thorough)
|
|
50
|
+
|
|
51
|
+
### Bottom Line
|
|
52
|
+
|
|
53
|
+
**Before**: 100% failure rate - all tests broken
|
|
54
|
+
**After**: 39% pass rate with core functionality working
|
|
55
|
+
|
|
56
|
+
The most critical tests (comprehensive integration) now pass. The CI is in a MUCH better state than before.
|
data/Gemfile.lock
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
language-operator (0.1.
|
|
4
|
+
language-operator (0.1.35)
|
|
5
5
|
k8s-ruby (~> 0.17)
|
|
6
6
|
mcp (~> 0.4)
|
|
7
7
|
opentelemetry-exporter-otlp (~> 0.27)
|
|
8
8
|
opentelemetry-instrumentation-http (~> 0.23)
|
|
9
9
|
opentelemetry-instrumentation-rack (~> 0.24)
|
|
10
10
|
opentelemetry-sdk (~> 1.4)
|
|
11
|
-
|
|
11
|
+
parallel (~> 1.26)
|
|
12
12
|
pastel (~> 0.8)
|
|
13
13
|
puma (~> 6.0)
|
|
14
14
|
rack (~> 3.0)
|
data/Makefile
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
.PHONY: help build test install console docs clean version-bump lint
|
|
1
|
+
.PHONY: help build test test-integration test-performance install console docs clean version-bump lint schema
|
|
2
2
|
|
|
3
3
|
.DEFAULT_GOAL := help
|
|
4
4
|
|
|
@@ -8,15 +8,32 @@ help: ## Show this help message
|
|
|
8
8
|
@echo 'Available targets:'
|
|
9
9
|
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf " %-20s %s\n", $$1, $$2}' $(MAKEFILE_LIST)
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
schema: ## Generate schema artifacts (JSON Schema and OpenAPI)
|
|
12
|
+
@echo "Generating schema artifacts..."
|
|
13
|
+
@bundle exec rake schema:generate
|
|
14
|
+
@echo "✅ Schema artifacts generated"
|
|
15
|
+
|
|
16
|
+
build: schema ## Build the gem
|
|
12
17
|
@echo "Building language-operator gem..."
|
|
13
18
|
@gem build language-operator.gemspec
|
|
14
19
|
@echo "✅ Gem built successfully"
|
|
15
20
|
|
|
16
|
-
test: ## Run the test suite
|
|
17
|
-
@echo "Running tests..."
|
|
18
|
-
@bundle exec rspec
|
|
19
|
-
@echo "✅ All tests passed"
|
|
21
|
+
test: ## Run the unit test suite
|
|
22
|
+
@echo "Running unit tests..."
|
|
23
|
+
@bundle exec rspec --exclude-pattern "spec/integration/**/*_spec.rb"
|
|
24
|
+
@echo "✅ All unit tests passed"
|
|
25
|
+
|
|
26
|
+
test-integration: ## Run integration tests for DSL v1 task execution
|
|
27
|
+
@echo "Running integration tests..."
|
|
28
|
+
@INTEGRATION_MOCK_LLM=true INTEGRATION_BENCHMARK=false bundle exec rspec spec/integration/ --tag type:integration
|
|
29
|
+
@echo "✅ All integration tests passed"
|
|
30
|
+
|
|
31
|
+
test-performance: ## Run performance benchmarks
|
|
32
|
+
@echo "Running performance benchmarks..."
|
|
33
|
+
@INTEGRATION_MOCK_LLM=true INTEGRATION_BENCHMARK=true bundle exec rspec spec/integration/performance_benchmarks_spec.rb --tag type:integration
|
|
34
|
+
@echo "✅ Performance benchmarks completed"
|
|
35
|
+
|
|
36
|
+
test-all: test test-integration ## Run all tests (unit + integration)
|
|
20
37
|
|
|
21
38
|
install: build ## Build and install the gem locally
|
|
22
39
|
@echo "Installing gem..."
|
|
@@ -65,7 +82,7 @@ version-bump-major: ## Bump major version (0.1.0 -> 1.0.0)
|
|
|
65
82
|
@./bin/bump-version major
|
|
66
83
|
|
|
67
84
|
# CI targets
|
|
68
|
-
ci-test: test lint ## Run CI test suite (tests + linting)
|
|
85
|
+
ci-test: test test-integration lint ## Run CI test suite (unit tests + integration tests + linting)
|
|
69
86
|
|
|
70
87
|
# Development workflow
|
|
71
88
|
dev-setup: ## Install development dependencies
|
|
@@ -75,3 +92,7 @@ dev-setup: ## Install development dependencies
|
|
|
75
92
|
|
|
76
93
|
dev-watch: ## Run tests in watch mode
|
|
77
94
|
@bundle exec guard
|
|
95
|
+
|
|
96
|
+
# Autopilot
|
|
97
|
+
iterate:
|
|
98
|
+
claude "read and execute requirements/tasks/iterate.md"
|
data/Rakefile
CHANGED
|
@@ -32,3 +32,32 @@ task :console do
|
|
|
32
32
|
ARGV.clear
|
|
33
33
|
IRB.start
|
|
34
34
|
end
|
|
35
|
+
|
|
36
|
+
namespace :schema do
|
|
37
|
+
desc 'Generate schema artifacts (JSON Schema and OpenAPI)'
|
|
38
|
+
task :generate do
|
|
39
|
+
require 'json'
|
|
40
|
+
require 'yaml'
|
|
41
|
+
require_relative 'lib/language_operator/dsl/schema'
|
|
42
|
+
|
|
43
|
+
schema_dir = File.join(__dir__, 'lib', 'language_operator', 'templates', 'schema')
|
|
44
|
+
FileUtils.mkdir_p(schema_dir)
|
|
45
|
+
|
|
46
|
+
# Generate JSON Schema
|
|
47
|
+
json_schema_path = File.join(schema_dir, 'agent_dsl_schema.json')
|
|
48
|
+
puts "Generating JSON Schema: #{json_schema_path}"
|
|
49
|
+
schema = LanguageOperator::Dsl::Schema.to_json_schema
|
|
50
|
+
File.write(json_schema_path, JSON.pretty_generate(schema))
|
|
51
|
+
puts "✅ Generated #{json_schema_path}"
|
|
52
|
+
|
|
53
|
+
# Generate OpenAPI spec
|
|
54
|
+
openapi_path = File.join(schema_dir, 'agent_dsl_openapi.yaml')
|
|
55
|
+
puts "Generating OpenAPI spec: #{openapi_path}"
|
|
56
|
+
openapi = LanguageOperator::Dsl::Schema.to_openapi
|
|
57
|
+
File.write(openapi_path, YAML.dump(openapi))
|
|
58
|
+
puts "✅ Generated #{openapi_path}"
|
|
59
|
+
|
|
60
|
+
puts "\nSchema artifacts generated successfully!"
|
|
61
|
+
puts "Version: #{LanguageOperator::Dsl::Schema.version}"
|
|
62
|
+
end
|
|
63
|
+
end
|
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
# Schema Versioning Policy
|
|
2
|
+
|
|
3
|
+
Language Operator DSL Schema uses semantic versioning linked directly to the gem version.
|
|
4
|
+
|
|
5
|
+
## Version Format
|
|
6
|
+
|
|
7
|
+
Schema versions follow [Semantic Versioning 2.0.0](https://semver.org/):
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
MAJOR.MINOR.PATCH
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Accessing Schema Version
|
|
14
|
+
|
|
15
|
+
### Programmatic Access
|
|
16
|
+
|
|
17
|
+
```ruby
|
|
18
|
+
require 'language_operator'
|
|
19
|
+
|
|
20
|
+
# Get schema version
|
|
21
|
+
LanguageOperator::Dsl::Schema.version
|
|
22
|
+
# => "0.1.30"
|
|
23
|
+
|
|
24
|
+
# Version is also included in JSON Schema output
|
|
25
|
+
schema = LanguageOperator::Dsl::Schema.to_json_schema
|
|
26
|
+
schema[:version]
|
|
27
|
+
# => "0.1.30"
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### JSON Schema Output
|
|
31
|
+
|
|
32
|
+
When generating JSON Schema, the version is automatically included:
|
|
33
|
+
|
|
34
|
+
```json
|
|
35
|
+
{
|
|
36
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
37
|
+
"$id": "https://github.com/language-operator/language-operator-gem/schema/agent-dsl.json",
|
|
38
|
+
"title": "Language Operator Agent DSL",
|
|
39
|
+
"version": "0.1.30",
|
|
40
|
+
...
|
|
41
|
+
}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Version Semantics
|
|
45
|
+
|
|
46
|
+
The schema version is **identical** to the gem version (`LanguageOperator::VERSION`). Changes to the schema follow these rules:
|
|
47
|
+
|
|
48
|
+
### MAJOR Version (X.0.0)
|
|
49
|
+
|
|
50
|
+
Breaking changes that require updates to existing agent definitions:
|
|
51
|
+
|
|
52
|
+
**Examples:**
|
|
53
|
+
- Removing DSL methods (e.g., removing `schedule` method)
|
|
54
|
+
- Renaming required fields (e.g., `description` → `summary`)
|
|
55
|
+
- Changing parameter types incompatibly (e.g., `mode` from Symbol to String)
|
|
56
|
+
- Removing supported execution modes
|
|
57
|
+
- Changing workflow dependency resolution behavior
|
|
58
|
+
- Altering constraint validation rules in breaking ways
|
|
59
|
+
|
|
60
|
+
**Migration Required:** Users must update their agent definitions to match new schema.
|
|
61
|
+
|
|
62
|
+
**Breaking Change Indicators:**
|
|
63
|
+
- Methods removed from `SAFE_AGENT_METHODS`, `SAFE_TOOL_METHODS`, or `SAFE_HELPER_METHODS`
|
|
64
|
+
- Required fields added or changed
|
|
65
|
+
- Enum values removed
|
|
66
|
+
- Pattern validation tightened (existing valid values become invalid)
|
|
67
|
+
|
|
68
|
+
### MINOR Version (0.X.0)
|
|
69
|
+
|
|
70
|
+
Backward-compatible additions and enhancements:
|
|
71
|
+
|
|
72
|
+
**Examples:**
|
|
73
|
+
- Adding new DSL methods (e.g., new output destinations)
|
|
74
|
+
- Adding new optional fields (e.g., new constraint types)
|
|
75
|
+
- Adding new execution modes
|
|
76
|
+
- Expanding enums (e.g., adding authentication types)
|
|
77
|
+
- Adding new workflow features that don't affect existing workflows
|
|
78
|
+
- Relaxing validation patterns (more values become valid)
|
|
79
|
+
- Adding new helper methods
|
|
80
|
+
|
|
81
|
+
**Migration Required:** None. Existing agent definitions continue to work.
|
|
82
|
+
|
|
83
|
+
**Addition Indicators:**
|
|
84
|
+
- New methods added to safe method lists
|
|
85
|
+
- New optional properties in schema definitions
|
|
86
|
+
- New enum values
|
|
87
|
+
- New JSON Schema definitions
|
|
88
|
+
- Pattern validation relaxed
|
|
89
|
+
|
|
90
|
+
### PATCH Version (0.0.X)
|
|
91
|
+
|
|
92
|
+
Bug fixes and non-breaking improvements:
|
|
93
|
+
|
|
94
|
+
**Examples:**
|
|
95
|
+
- Fixing validation regex patterns that were too strict
|
|
96
|
+
- Correcting schema descriptions or documentation
|
|
97
|
+
- Fixing default values
|
|
98
|
+
- Improving error messages
|
|
99
|
+
- Performance optimizations in schema generation
|
|
100
|
+
- Documentation improvements
|
|
101
|
+
|
|
102
|
+
**Migration Required:** None. Fully backward compatible.
|
|
103
|
+
|
|
104
|
+
**Fix Indicators:**
|
|
105
|
+
- Pattern fixes (making existing valid definitions work correctly)
|
|
106
|
+
- Description clarifications
|
|
107
|
+
- Default value corrections
|
|
108
|
+
- Schema metadata updates
|
|
109
|
+
|
|
110
|
+
## Schema Evolution Examples
|
|
111
|
+
|
|
112
|
+
### Example: MAJOR Version Change (Breaking)
|
|
113
|
+
|
|
114
|
+
**Before (v0.1.x):**
|
|
115
|
+
```ruby
|
|
116
|
+
agent "my-agent" do
|
|
117
|
+
mode :autonomous # Symbol
|
|
118
|
+
schedule "0 12 * * *"
|
|
119
|
+
end
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
**After (v1.0.0) - Hypothetical Breaking Change:**
|
|
123
|
+
```ruby
|
|
124
|
+
agent "my-agent" do
|
|
125
|
+
mode "autonomous" # Now requires String
|
|
126
|
+
cron_schedule "0 12 * * *" # Renamed method
|
|
127
|
+
end
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
**Impact:** Existing agent definitions fail validation. Users must update code.
|
|
131
|
+
|
|
132
|
+
### Example: MINOR Version Change (Addition)
|
|
133
|
+
|
|
134
|
+
**Before (v0.1.x):**
|
|
135
|
+
```ruby
|
|
136
|
+
agent "my-agent" do
|
|
137
|
+
constraints do
|
|
138
|
+
daily_budget 10.00
|
|
139
|
+
end
|
|
140
|
+
end
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
**After (v0.2.0) - New Feature:**
|
|
144
|
+
```ruby
|
|
145
|
+
agent "my-agent" do
|
|
146
|
+
constraints do
|
|
147
|
+
daily_budget 10.00
|
|
148
|
+
monthly_budget 250.00 # NEW: Added in 0.2.0
|
|
149
|
+
end
|
|
150
|
+
end
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
**Impact:** None. Old definitions still valid. New feature available optionally.
|
|
154
|
+
|
|
155
|
+
### Example: PATCH Version Change (Fix)
|
|
156
|
+
|
|
157
|
+
**Before (v0.1.29):**
|
|
158
|
+
```ruby
|
|
159
|
+
# Bug: timeout pattern too strict, rejects "120s"
|
|
160
|
+
constraints do
|
|
161
|
+
timeout "2m" # Works
|
|
162
|
+
# timeout "120s" # Would fail validation
|
|
163
|
+
end
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
**After (v0.1.30) - Bug Fix:**
|
|
167
|
+
```ruby
|
|
168
|
+
# Fixed: timeout pattern now accepts both formats
|
|
169
|
+
constraints do
|
|
170
|
+
timeout "2m" # Still works
|
|
171
|
+
timeout "120s" # Now works too
|
|
172
|
+
end
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
**Impact:** None. Existing valid definitions unchanged. Previously invalid definitions may now work.
|
|
176
|
+
|
|
177
|
+
## Version Compatibility
|
|
178
|
+
|
|
179
|
+
### Agent Definition Compatibility
|
|
180
|
+
|
|
181
|
+
Agent definitions are compatible across:
|
|
182
|
+
- ✅ Same MAJOR version (e.g., 0.1.0 agent works with 0.1.30 gem)
|
|
183
|
+
- ✅ MINOR upgrades (e.g., 0.1.x agent works with 0.2.x gem)
|
|
184
|
+
- ❌ MAJOR upgrades (e.g., 0.x.x agent may not work with 1.x.x gem)
|
|
185
|
+
|
|
186
|
+
### JSON Schema Compatibility
|
|
187
|
+
|
|
188
|
+
Generated JSON Schemas are versioned. Consumers should:
|
|
189
|
+
|
|
190
|
+
1. **Check schema version** before validation:
|
|
191
|
+
```ruby
|
|
192
|
+
schema = LanguageOperator::Dsl::Schema.to_json_schema
|
|
193
|
+
if Gem::Version.new(schema[:version]) >= Gem::Version.new("0.2.0")
|
|
194
|
+
# Use features from 0.2.0+
|
|
195
|
+
end
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
2. **Pin gem versions** in production:
|
|
199
|
+
```ruby
|
|
200
|
+
# Gemfile
|
|
201
|
+
gem 'language-operator', '~> 0.1.0' # Allow patch updates only
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
## Deprecation Policy
|
|
205
|
+
|
|
206
|
+
When planning MAJOR version changes:
|
|
207
|
+
|
|
208
|
+
1. **Deprecation warnings** added in MINOR version before removal
|
|
209
|
+
2. **Migration guides** provided in documentation
|
|
210
|
+
3. **Minimum deprecation period** of one MAJOR version cycle
|
|
211
|
+
|
|
212
|
+
Example timeline:
|
|
213
|
+
- v0.1.0: Feature X introduced
|
|
214
|
+
- v0.2.0: Feature X deprecated (warnings added, docs updated)
|
|
215
|
+
- v0.3.0: Still supported with warnings
|
|
216
|
+
- v1.0.0: Feature X removed (breaking change)
|
|
217
|
+
|
|
218
|
+
## Validation and Testing
|
|
219
|
+
|
|
220
|
+
### Schema Version Testing
|
|
221
|
+
|
|
222
|
+
The gem includes comprehensive tests ensuring:
|
|
223
|
+
- Schema version matches gem version
|
|
224
|
+
- Version is included in JSON Schema output
|
|
225
|
+
- Safe method lists are validated against ASTValidator constants
|
|
226
|
+
|
|
227
|
+
See: `spec/language_operator/dsl/schema_spec.rb`
|
|
228
|
+
|
|
229
|
+
### Breaking Change Detection
|
|
230
|
+
|
|
231
|
+
When submitting changes:
|
|
232
|
+
|
|
233
|
+
1. **Check if change is breaking** using checklist above
|
|
234
|
+
2. **Update version accordingly** in `lib/language_operator/version.rb`
|
|
235
|
+
3. **Document in CHANGELOG.md** under appropriate section
|
|
236
|
+
4. **Add migration guide** if MAJOR version bump
|
|
237
|
+
5. **Update this document** if versioning policy changes
|
|
238
|
+
|
|
239
|
+
## Related Documentation
|
|
240
|
+
|
|
241
|
+
- [Semantic Versioning Specification](https://semver.org/)
|
|
242
|
+
- [Agent DSL Reference](./agent-reference.md)
|
|
243
|
+
- [Best Practices](./best-practices.md)
|
|
244
|
+
- [CHANGELOG.md](../../CHANGELOG.md)
|
|
245
|
+
|
|
246
|
+
## Questions?
|
|
247
|
+
|
|
248
|
+
For questions about schema versioning:
|
|
249
|
+
- Open an issue: https://github.com/language-operator/language-operator-gem/issues
|
|
250
|
+
- Check existing discussions about schema changes
|
data/docs/dsl/agent-reference.md
CHANGED
|
@@ -4,6 +4,7 @@ Complete reference guide for the Language Operator agent DSL.
|
|
|
4
4
|
|
|
5
5
|
## Table of Contents
|
|
6
6
|
|
|
7
|
+
- [Schema Version](#schema-version)
|
|
7
8
|
- [Agent Definition](#agent-definition)
|
|
8
9
|
- [Execution Modes](#execution-modes)
|
|
9
10
|
- [Schedule Configuration](#schedule-configuration)
|
|
@@ -14,6 +15,18 @@ Complete reference guide for the Language Operator agent DSL.
|
|
|
14
15
|
- [Output Configuration](#output-configuration)
|
|
15
16
|
- [Complete Examples](#complete-examples)
|
|
16
17
|
|
|
18
|
+
## Schema Version
|
|
19
|
+
|
|
20
|
+
The Language Operator DSL schema is versioned using semantic versioning. The schema version is identical to the gem version.
|
|
21
|
+
|
|
22
|
+
**Access schema version:**
|
|
23
|
+
|
|
24
|
+
```ruby
|
|
25
|
+
LanguageOperator::Dsl::Schema.version # => "0.1.30"
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
For detailed information about schema versioning policy, version semantics, and compatibility, see [Schema Versioning Policy](./SCHEMA_VERSION.md).
|
|
29
|
+
|
|
17
30
|
## Agent Definition
|
|
18
31
|
|
|
19
32
|
The basic structure of an agent definition:
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require_relative '../client'
|
|
4
|
+
require_relative '../constants'
|
|
4
5
|
require_relative 'telemetry'
|
|
5
6
|
require_relative 'instrumentation'
|
|
6
7
|
|
|
@@ -43,22 +44,25 @@ module LanguageOperator
|
|
|
43
44
|
#
|
|
44
45
|
# @return [void]
|
|
45
46
|
def run
|
|
47
|
+
# Normalize mode to canonical form
|
|
48
|
+
normalized_mode = Constants.normalize_mode(@mode)
|
|
49
|
+
|
|
46
50
|
with_span('agent.run', attributes: {
|
|
47
51
|
'agent.name' => ENV.fetch('AGENT_NAME', nil),
|
|
48
|
-
'agent.mode' =>
|
|
52
|
+
'agent.mode' => normalized_mode,
|
|
49
53
|
'agent.workspace_available' => workspace_available?
|
|
50
54
|
}) do
|
|
51
55
|
connect!
|
|
52
56
|
|
|
53
|
-
case
|
|
54
|
-
when 'autonomous'
|
|
57
|
+
case normalized_mode
|
|
58
|
+
when 'autonomous'
|
|
55
59
|
run_autonomous
|
|
56
|
-
when 'scheduled'
|
|
60
|
+
when 'scheduled'
|
|
57
61
|
run_scheduled
|
|
58
|
-
when 'reactive'
|
|
62
|
+
when 'reactive'
|
|
59
63
|
run_reactive
|
|
60
64
|
else
|
|
61
|
-
raise "Unknown agent mode: #{
|
|
65
|
+
raise "Unknown agent mode: #{normalized_mode}"
|
|
62
66
|
end
|
|
63
67
|
end
|
|
64
68
|
end
|