language-operator 0.0.1 → 0.1.30

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.
Files changed (116) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +125 -0
  3. data/CHANGELOG.md +53 -0
  4. data/Gemfile +8 -0
  5. data/Gemfile.lock +284 -0
  6. data/LICENSE +229 -21
  7. data/Makefile +77 -0
  8. data/README.md +3 -11
  9. data/Rakefile +34 -0
  10. data/bin/aictl +7 -0
  11. data/completions/_aictl +232 -0
  12. data/completions/aictl.bash +121 -0
  13. data/completions/aictl.fish +114 -0
  14. data/docs/architecture/agent-runtime.md +585 -0
  15. data/docs/dsl/agent-reference.md +591 -0
  16. data/docs/dsl/best-practices.md +1078 -0
  17. data/docs/dsl/chat-endpoints.md +895 -0
  18. data/docs/dsl/constraints.md +671 -0
  19. data/docs/dsl/mcp-integration.md +1177 -0
  20. data/docs/dsl/webhooks.md +932 -0
  21. data/docs/dsl/workflows.md +744 -0
  22. data/examples/README.md +569 -0
  23. data/examples/agent_example.rb +86 -0
  24. data/examples/chat_endpoint_agent.rb +118 -0
  25. data/examples/github_webhook_agent.rb +171 -0
  26. data/examples/mcp_agent.rb +158 -0
  27. data/examples/oauth_callback_agent.rb +296 -0
  28. data/examples/stripe_webhook_agent.rb +219 -0
  29. data/examples/webhook_agent.rb +80 -0
  30. data/lib/language_operator/agent/base.rb +110 -0
  31. data/lib/language_operator/agent/executor.rb +440 -0
  32. data/lib/language_operator/agent/instrumentation.rb +54 -0
  33. data/lib/language_operator/agent/metrics_tracker.rb +183 -0
  34. data/lib/language_operator/agent/safety/ast_validator.rb +272 -0
  35. data/lib/language_operator/agent/safety/audit_logger.rb +104 -0
  36. data/lib/language_operator/agent/safety/budget_tracker.rb +175 -0
  37. data/lib/language_operator/agent/safety/content_filter.rb +93 -0
  38. data/lib/language_operator/agent/safety/manager.rb +207 -0
  39. data/lib/language_operator/agent/safety/rate_limiter.rb +150 -0
  40. data/lib/language_operator/agent/safety/safe_executor.rb +115 -0
  41. data/lib/language_operator/agent/scheduler.rb +183 -0
  42. data/lib/language_operator/agent/telemetry.rb +116 -0
  43. data/lib/language_operator/agent/web_server.rb +610 -0
  44. data/lib/language_operator/agent/webhook_authenticator.rb +226 -0
  45. data/lib/language_operator/agent.rb +149 -0
  46. data/lib/language_operator/cli/commands/agent.rb +1252 -0
  47. data/lib/language_operator/cli/commands/cluster.rb +335 -0
  48. data/lib/language_operator/cli/commands/install.rb +404 -0
  49. data/lib/language_operator/cli/commands/model.rb +266 -0
  50. data/lib/language_operator/cli/commands/persona.rb +396 -0
  51. data/lib/language_operator/cli/commands/quickstart.rb +22 -0
  52. data/lib/language_operator/cli/commands/status.rb +156 -0
  53. data/lib/language_operator/cli/commands/tool.rb +537 -0
  54. data/lib/language_operator/cli/commands/use.rb +47 -0
  55. data/lib/language_operator/cli/errors/handler.rb +180 -0
  56. data/lib/language_operator/cli/errors/suggestions.rb +176 -0
  57. data/lib/language_operator/cli/formatters/code_formatter.rb +81 -0
  58. data/lib/language_operator/cli/formatters/log_formatter.rb +290 -0
  59. data/lib/language_operator/cli/formatters/progress_formatter.rb +53 -0
  60. data/lib/language_operator/cli/formatters/table_formatter.rb +179 -0
  61. data/lib/language_operator/cli/formatters/value_formatter.rb +113 -0
  62. data/lib/language_operator/cli/helpers/cluster_context.rb +62 -0
  63. data/lib/language_operator/cli/helpers/cluster_validator.rb +101 -0
  64. data/lib/language_operator/cli/helpers/editor_helper.rb +58 -0
  65. data/lib/language_operator/cli/helpers/kubeconfig_validator.rb +167 -0
  66. data/lib/language_operator/cli/helpers/resource_dependency_checker.rb +74 -0
  67. data/lib/language_operator/cli/helpers/schedule_builder.rb +108 -0
  68. data/lib/language_operator/cli/helpers/user_prompts.rb +69 -0
  69. data/lib/language_operator/cli/main.rb +232 -0
  70. data/lib/language_operator/cli/templates/tools/generic.yaml +66 -0
  71. data/lib/language_operator/cli/wizards/agent_wizard.rb +246 -0
  72. data/lib/language_operator/cli/wizards/quickstart_wizard.rb +588 -0
  73. data/lib/language_operator/client/base.rb +214 -0
  74. data/lib/language_operator/client/config.rb +136 -0
  75. data/lib/language_operator/client/cost_calculator.rb +37 -0
  76. data/lib/language_operator/client/mcp_connector.rb +123 -0
  77. data/lib/language_operator/client.rb +19 -0
  78. data/lib/language_operator/config/cluster_config.rb +101 -0
  79. data/lib/language_operator/config/tool_patterns.yaml +57 -0
  80. data/lib/language_operator/config/tool_registry.rb +96 -0
  81. data/lib/language_operator/config.rb +138 -0
  82. data/lib/language_operator/dsl/adapter.rb +124 -0
  83. data/lib/language_operator/dsl/agent_context.rb +90 -0
  84. data/lib/language_operator/dsl/agent_definition.rb +427 -0
  85. data/lib/language_operator/dsl/chat_endpoint_definition.rb +115 -0
  86. data/lib/language_operator/dsl/config.rb +119 -0
  87. data/lib/language_operator/dsl/context.rb +50 -0
  88. data/lib/language_operator/dsl/execution_context.rb +47 -0
  89. data/lib/language_operator/dsl/helpers.rb +109 -0
  90. data/lib/language_operator/dsl/http.rb +184 -0
  91. data/lib/language_operator/dsl/mcp_server_definition.rb +73 -0
  92. data/lib/language_operator/dsl/parameter_definition.rb +124 -0
  93. data/lib/language_operator/dsl/registry.rb +36 -0
  94. data/lib/language_operator/dsl/shell.rb +125 -0
  95. data/lib/language_operator/dsl/tool_definition.rb +112 -0
  96. data/lib/language_operator/dsl/webhook_authentication.rb +114 -0
  97. data/lib/language_operator/dsl/webhook_definition.rb +106 -0
  98. data/lib/language_operator/dsl/workflow_definition.rb +259 -0
  99. data/lib/language_operator/dsl.rb +160 -0
  100. data/lib/language_operator/errors.rb +60 -0
  101. data/lib/language_operator/kubernetes/client.rb +279 -0
  102. data/lib/language_operator/kubernetes/resource_builder.rb +194 -0
  103. data/lib/language_operator/loggable.rb +47 -0
  104. data/lib/language_operator/logger.rb +141 -0
  105. data/lib/language_operator/retry.rb +123 -0
  106. data/lib/language_operator/retryable.rb +132 -0
  107. data/lib/language_operator/tool_loader.rb +242 -0
  108. data/lib/language_operator/validators.rb +170 -0
  109. data/lib/language_operator/version.rb +1 -1
  110. data/lib/language_operator.rb +65 -3
  111. data/requirements/tasks/challenge.md +9 -0
  112. data/requirements/tasks/iterate.md +36 -0
  113. data/requirements/tasks/optimize.md +21 -0
  114. data/requirements/tasks/tag.md +5 -0
  115. data/test_agent_dsl.rb +108 -0
  116. metadata +503 -20
@@ -0,0 +1,121 @@
1
+ # bash completion for aictl
2
+
3
+ _aictl_completions() {
4
+ local cur prev words cword
5
+ _init_completion || return
6
+
7
+ # Helper function to get clusters
8
+ _aictl_clusters() {
9
+ aictl cluster list 2>/dev/null | tail -n +2 | awk '{print $1}' | grep -v '^─' | grep -v '^NAME'
10
+ }
11
+
12
+ # Helper function to get agents
13
+ _aictl_agents() {
14
+ aictl agent list 2>/dev/null | tail -n +2 | awk '{print $1}' | grep -v '^─' | grep -v '^NAME'
15
+ }
16
+
17
+ # Helper function to get personas
18
+ _aictl_personas() {
19
+ aictl persona list 2>/dev/null | tail -n +2 | awk '{print $1}' | grep -v '^─' | grep -v '^NAME'
20
+ }
21
+
22
+ # Helper function to get tools
23
+ _aictl_tools() {
24
+ aictl tool list 2>/dev/null | tail -n +2 | awk '{print $1}' | grep -v '^─' | grep -v '^NAME'
25
+ }
26
+
27
+ # Top-level commands
28
+ local commands="cluster use agent persona tool status version new serve test run console help"
29
+
30
+ # Cluster subcommands
31
+ local cluster_commands="create list current inspect delete"
32
+
33
+ # Agent subcommands
34
+ local agent_commands="create list inspect delete logs code edit pause resume"
35
+
36
+ # Persona subcommands
37
+ local persona_commands="list show create edit delete"
38
+
39
+ # Tool subcommands
40
+ local tool_commands="list install auth test delete"
41
+
42
+ # If we're at the first argument
43
+ if [[ $cword -eq 1 ]]; then
44
+ COMPREPLY=($(compgen -W "$commands" -- "$cur"))
45
+ return
46
+ fi
47
+
48
+ # Get the main command
49
+ local cmd="${words[1]}"
50
+
51
+ case "$cmd" in
52
+ cluster)
53
+ if [[ $cword -eq 2 ]]; then
54
+ COMPREPLY=($(compgen -W "$cluster_commands" -- "$cur"))
55
+ elif [[ $cword -eq 3 ]]; then
56
+ case "${words[2]}" in
57
+ inspect|delete|current)
58
+ COMPREPLY=($(compgen -W "$(_aictl_clusters)" -- "$cur"))
59
+ ;;
60
+ esac
61
+ fi
62
+ ;;
63
+ use)
64
+ if [[ $cword -eq 2 ]]; then
65
+ COMPREPLY=($(compgen -W "$(_aictl_clusters)" -- "$cur"))
66
+ fi
67
+ ;;
68
+ agent)
69
+ if [[ $cword -eq 2 ]]; then
70
+ COMPREPLY=($(compgen -W "$agent_commands" -- "$cur"))
71
+ elif [[ $cword -eq 3 ]]; then
72
+ case "${words[2]}" in
73
+ inspect|delete|logs|code|edit|pause|resume)
74
+ COMPREPLY=($(compgen -W "$(_aictl_agents)" -- "$cur"))
75
+ ;;
76
+ list)
77
+ COMPREPLY=($(compgen -W "--all-clusters --cluster=" -- "$cur"))
78
+ ;;
79
+ create)
80
+ COMPREPLY=($(compgen -W "--cluster= --create-cluster= --persona= --dry-run" -- "$cur"))
81
+ ;;
82
+ esac
83
+ fi
84
+ ;;
85
+ persona)
86
+ if [[ $cword -eq 2 ]]; then
87
+ COMPREPLY=($(compgen -W "$persona_commands" -- "$cur"))
88
+ elif [[ $cword -eq 3 ]]; then
89
+ case "${words[2]}" in
90
+ show|edit|delete)
91
+ COMPREPLY=($(compgen -W "$(_aictl_personas)" -- "$cur"))
92
+ ;;
93
+ create)
94
+ COMPREPLY=($(compgen -W "--from= --cluster=" -- "$cur"))
95
+ ;;
96
+ esac
97
+ fi
98
+ ;;
99
+ tool)
100
+ if [[ $cword -eq 2 ]]; then
101
+ COMPREPLY=($(compgen -W "$tool_commands" -- "$cur"))
102
+ elif [[ $cword -eq 3 ]]; then
103
+ case "${words[2]}" in
104
+ auth|test|delete)
105
+ COMPREPLY=($(compgen -W "$(_aictl_tools)" -- "$cur"))
106
+ ;;
107
+ list)
108
+ COMPREPLY=($(compgen -W "--cluster=" -- "$cur"))
109
+ ;;
110
+ esac
111
+ fi
112
+ ;;
113
+ new)
114
+ if [[ $cword -eq 2 ]]; then
115
+ COMPREPLY=($(compgen -W "tool agent" -- "$cur"))
116
+ fi
117
+ ;;
118
+ esac
119
+ }
120
+
121
+ complete -F _aictl_completions aictl
@@ -0,0 +1,114 @@
1
+ # fish completion for aictl
2
+
3
+ # Helper functions for dynamic completion
4
+ function __aictl_clusters
5
+ aictl cluster list 2>/dev/null | tail -n +2 | awk '{print $1}' | grep -v '^─' | grep -v '^NAME'
6
+ end
7
+
8
+ function __aictl_agents
9
+ aictl agent list 2>/dev/null | tail -n +2 | awk '{print $1}' | grep -v '^─' | grep -v '^NAME'
10
+ end
11
+
12
+ function __aictl_personas
13
+ aictl persona list 2>/dev/null | tail -n +2 | awk '{print $1}' | grep -v '^─' | grep -v '^NAME'
14
+ end
15
+
16
+ function __aictl_tools
17
+ aictl tool list 2>/dev/null | tail -n +2 | awk '{print $1}' | grep -v '^─' | grep -v '^NAME'
18
+ end
19
+
20
+ # Disable file completion by default
21
+ complete -c aictl -f
22
+
23
+ # Top-level commands
24
+ complete -c aictl -n "__fish_use_subcommand" -a "cluster" -d "Manage language clusters"
25
+ complete -c aictl -n "__fish_use_subcommand" -a "use" -d "Switch to a different cluster context"
26
+ complete -c aictl -n "__fish_use_subcommand" -a "agent" -d "Manage autonomous agents"
27
+ complete -c aictl -n "__fish_use_subcommand" -a "persona" -d "Manage agent personas"
28
+ complete -c aictl -n "__fish_use_subcommand" -a "tool" -d "Manage MCP tools"
29
+ complete -c aictl -n "__fish_use_subcommand" -a "status" -d "Show system status and overview"
30
+ complete -c aictl -n "__fish_use_subcommand" -a "version" -d "Show aictl and operator version"
31
+ complete -c aictl -n "__fish_use_subcommand" -a "new" -d "Generate a new tool or agent project"
32
+ complete -c aictl -n "__fish_use_subcommand" -a "serve" -d "Start an MCP server for tools"
33
+ complete -c aictl -n "__fish_use_subcommand" -a "test" -d "Test tool definitions"
34
+ complete -c aictl -n "__fish_use_subcommand" -a "run" -d "Run an agent"
35
+ complete -c aictl -n "__fish_use_subcommand" -a "console" -d "Start an interactive Ruby console"
36
+ complete -c aictl -n "__fish_use_subcommand" -a "help" -d "Show help"
37
+
38
+ # cluster subcommands
39
+ complete -c aictl -n "__fish_seen_subcommand_from cluster" -a "create" -d "Create a new language cluster"
40
+ complete -c aictl -n "__fish_seen_subcommand_from cluster" -a "list" -d "List all language clusters"
41
+ complete -c aictl -n "__fish_seen_subcommand_from cluster" -a "current" -d "Show current cluster context"
42
+ complete -c aictl -n "__fish_seen_subcommand_from cluster" -a "inspect" -d "Show detailed cluster information"
43
+ complete -c aictl -n "__fish_seen_subcommand_from cluster" -a "delete" -d "Delete a language cluster"
44
+
45
+ # cluster inspect/delete - complete with cluster names
46
+ complete -c aictl -n "__fish_seen_subcommand_from cluster; and __fish_seen_subcommand_from inspect delete" -a "(__aictl_clusters)"
47
+
48
+ # use command - complete with cluster names
49
+ complete -c aictl -n "__fish_seen_subcommand_from use" -a "(__aictl_clusters)"
50
+
51
+ # agent subcommands
52
+ complete -c aictl -n "__fish_seen_subcommand_from agent" -a "create" -d "Create a new autonomous agent"
53
+ complete -c aictl -n "__fish_seen_subcommand_from agent" -a "list" -d "List agents in current cluster"
54
+ complete -c aictl -n "__fish_seen_subcommand_from agent" -a "inspect" -d "Show detailed agent information"
55
+ complete -c aictl -n "__fish_seen_subcommand_from agent" -a "delete" -d "Delete an agent"
56
+ complete -c aictl -n "__fish_seen_subcommand_from agent" -a "logs" -d "View agent execution logs"
57
+ complete -c aictl -n "__fish_seen_subcommand_from agent" -a "code" -d "Display synthesized agent code"
58
+ complete -c aictl -n "__fish_seen_subcommand_from agent" -a "edit" -d "Edit agent instructions"
59
+ complete -c aictl -n "__fish_seen_subcommand_from agent" -a "pause" -d "Pause scheduled agent execution"
60
+ complete -c aictl -n "__fish_seen_subcommand_from agent" -a "resume" -d "Resume paused agent"
61
+
62
+ # agent create options
63
+ complete -c aictl -n "__fish_seen_subcommand_from agent; and __fish_seen_subcommand_from create" -l cluster -d "Override current cluster context" -a "(__aictl_clusters)"
64
+ complete -c aictl -n "__fish_seen_subcommand_from agent; and __fish_seen_subcommand_from create" -l create-cluster -d "Create cluster inline"
65
+ complete -c aictl -n "__fish_seen_subcommand_from agent; and __fish_seen_subcommand_from create" -l persona -d "Use specific persona" -a "(__aictl_personas)"
66
+ complete -c aictl -n "__fish_seen_subcommand_from agent; and __fish_seen_subcommand_from create" -l dry-run -d "Preview without creating"
67
+
68
+ # agent list options
69
+ complete -c aictl -n "__fish_seen_subcommand_from agent; and __fish_seen_subcommand_from list" -l all-clusters -d "Show agents from all clusters"
70
+ complete -c aictl -n "__fish_seen_subcommand_from agent; and __fish_seen_subcommand_from list" -l cluster -d "Show agents from specific cluster" -a "(__aictl_clusters)"
71
+
72
+ # agent inspect/delete/logs/code/edit/pause/resume - complete with agent names
73
+ complete -c aictl -n "__fish_seen_subcommand_from agent; and __fish_seen_subcommand_from inspect delete logs code edit pause resume" -a "(__aictl_agents)"
74
+
75
+ # agent logs options
76
+ complete -c aictl -n "__fish_seen_subcommand_from agent; and __fish_seen_subcommand_from logs" -s f -l follow -d "Follow log output"
77
+
78
+ # persona subcommands
79
+ complete -c aictl -n "__fish_seen_subcommand_from persona" -a "list" -d "List available personas"
80
+ complete -c aictl -n "__fish_seen_subcommand_from persona" -a "show" -d "Display full persona details"
81
+ complete -c aictl -n "__fish_seen_subcommand_from persona" -a "create" -d "Create a new custom persona"
82
+ complete -c aictl -n "__fish_seen_subcommand_from persona" -a "edit" -d "Edit an existing persona"
83
+ complete -c aictl -n "__fish_seen_subcommand_from persona" -a "delete" -d "Delete a persona"
84
+
85
+ # persona create options
86
+ complete -c aictl -n "__fish_seen_subcommand_from persona; and __fish_seen_subcommand_from create" -l from -d "Inherit from existing persona" -a "(__aictl_personas)"
87
+ complete -c aictl -n "__fish_seen_subcommand_from persona; and __fish_seen_subcommand_from create" -l cluster -d "Override current cluster" -a "(__aictl_clusters)"
88
+
89
+ # persona show/edit/delete - complete with persona names
90
+ complete -c aictl -n "__fish_seen_subcommand_from persona; and __fish_seen_subcommand_from show edit delete" -a "(__aictl_personas)"
91
+
92
+ # tool subcommands
93
+ complete -c aictl -n "__fish_seen_subcommand_from tool" -a "list" -d "List tools in current cluster"
94
+ complete -c aictl -n "__fish_seen_subcommand_from tool" -a "install" -d "Install a new MCP tool"
95
+ complete -c aictl -n "__fish_seen_subcommand_from tool" -a "auth" -d "Configure tool authentication"
96
+ complete -c aictl -n "__fish_seen_subcommand_from tool" -a "test" -d "Test tool connectivity"
97
+ complete -c aictl -n "__fish_seen_subcommand_from tool" -a "delete" -d "Delete a tool"
98
+
99
+ # tool list options
100
+ complete -c aictl -n "__fish_seen_subcommand_from tool; and __fish_seen_subcommand_from list" -l cluster -d "Override current cluster" -a "(__aictl_clusters)"
101
+
102
+ # tool auth/test/delete - complete with tool names
103
+ complete -c aictl -n "__fish_seen_subcommand_from tool; and __fish_seen_subcommand_from auth test delete" -a "(__aictl_tools)"
104
+
105
+ # new command
106
+ complete -c aictl -n "__fish_seen_subcommand_from new" -a "tool" -d "Generate a new tool project"
107
+ complete -c aictl -n "__fish_seen_subcommand_from new" -a "agent" -d "Generate a new agent project"
108
+
109
+ # serve options
110
+ complete -c aictl -n "__fish_seen_subcommand_from serve" -l port -d "Port to listen on"
111
+ complete -c aictl -n "__fish_seen_subcommand_from serve" -l host -d "Host to bind to"
112
+
113
+ # run options
114
+ complete -c aictl -n "__fish_seen_subcommand_from run" -l config -d "Path to configuration file" -r