kubiya-control-plane-api 0.1.0__py3-none-any.whl → 0.3.4__py3-none-any.whl

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.

Potentially problematic release.


This version of kubiya-control-plane-api might be problematic. Click here for more details.

Files changed (185) hide show
  1. control_plane_api/README.md +266 -0
  2. control_plane_api/__init__.py +0 -0
  3. control_plane_api/__version__.py +1 -0
  4. control_plane_api/alembic/README +1 -0
  5. control_plane_api/alembic/env.py +98 -0
  6. control_plane_api/alembic/script.py.mako +28 -0
  7. control_plane_api/alembic/versions/1382bec74309_initial_migration_with_all_models.py +251 -0
  8. control_plane_api/alembic/versions/1f54bc2a37e3_add_analytics_tables.py +162 -0
  9. control_plane_api/alembic/versions/2e4cb136dc10_rename_toolset_ids_to_skill_ids_in_teams.py +30 -0
  10. control_plane_api/alembic/versions/31cd69a644ce_add_skill_templates_table.py +28 -0
  11. control_plane_api/alembic/versions/89e127caa47d_add_jobs_and_job_executions_tables.py +161 -0
  12. control_plane_api/alembic/versions/add_llm_models_table.py +51 -0
  13. control_plane_api/alembic/versions/b0e10697f212_add_runtime_column_to_teams_simple.py +42 -0
  14. control_plane_api/alembic/versions/ce43b24b63bf_add_execution_trigger_source_and_fix_.py +155 -0
  15. control_plane_api/alembic/versions/d4eaf16e3f8d_rename_toolsets_to_skills.py +84 -0
  16. control_plane_api/alembic/versions/efa2dc427da1_rename_metadata_to_custom_metadata.py +32 -0
  17. control_plane_api/alembic/versions/f973b431d1ce_add_workflow_executor_to_skill_types.py +44 -0
  18. control_plane_api/alembic.ini +148 -0
  19. control_plane_api/api/index.py +12 -0
  20. control_plane_api/app/__init__.py +11 -0
  21. control_plane_api/app/activities/__init__.py +20 -0
  22. control_plane_api/app/activities/agent_activities.py +379 -0
  23. control_plane_api/app/activities/team_activities.py +410 -0
  24. control_plane_api/app/activities/temporal_cloud_activities.py +577 -0
  25. control_plane_api/app/config/__init__.py +35 -0
  26. control_plane_api/app/config/api_config.py +354 -0
  27. control_plane_api/app/config/model_pricing.py +318 -0
  28. control_plane_api/app/config.py +95 -0
  29. control_plane_api/app/database.py +135 -0
  30. control_plane_api/app/exceptions.py +408 -0
  31. control_plane_api/app/lib/__init__.py +11 -0
  32. control_plane_api/app/lib/job_executor.py +312 -0
  33. control_plane_api/app/lib/kubiya_client.py +235 -0
  34. control_plane_api/app/lib/litellm_pricing.py +166 -0
  35. control_plane_api/app/lib/planning_tools/__init__.py +22 -0
  36. control_plane_api/app/lib/planning_tools/agents.py +155 -0
  37. control_plane_api/app/lib/planning_tools/base.py +189 -0
  38. control_plane_api/app/lib/planning_tools/environments.py +214 -0
  39. control_plane_api/app/lib/planning_tools/resources.py +240 -0
  40. control_plane_api/app/lib/planning_tools/teams.py +198 -0
  41. control_plane_api/app/lib/policy_enforcer_client.py +939 -0
  42. control_plane_api/app/lib/redis_client.py +436 -0
  43. control_plane_api/app/lib/supabase.py +71 -0
  44. control_plane_api/app/lib/temporal_client.py +138 -0
  45. control_plane_api/app/lib/validation/__init__.py +20 -0
  46. control_plane_api/app/lib/validation/runtime_validation.py +287 -0
  47. control_plane_api/app/main.py +128 -0
  48. control_plane_api/app/middleware/__init__.py +8 -0
  49. control_plane_api/app/middleware/auth.py +513 -0
  50. control_plane_api/app/middleware/exception_handler.py +267 -0
  51. control_plane_api/app/middleware/rate_limiting.py +384 -0
  52. control_plane_api/app/middleware/request_id.py +202 -0
  53. control_plane_api/app/models/__init__.py +27 -0
  54. control_plane_api/app/models/agent.py +79 -0
  55. control_plane_api/app/models/analytics.py +206 -0
  56. control_plane_api/app/models/associations.py +81 -0
  57. control_plane_api/app/models/environment.py +63 -0
  58. control_plane_api/app/models/execution.py +93 -0
  59. control_plane_api/app/models/job.py +179 -0
  60. control_plane_api/app/models/llm_model.py +75 -0
  61. control_plane_api/app/models/presence.py +49 -0
  62. control_plane_api/app/models/project.py +47 -0
  63. control_plane_api/app/models/session.py +38 -0
  64. control_plane_api/app/models/team.py +66 -0
  65. control_plane_api/app/models/workflow.py +55 -0
  66. control_plane_api/app/policies/README.md +121 -0
  67. control_plane_api/app/policies/approved_users.rego +62 -0
  68. control_plane_api/app/policies/business_hours.rego +51 -0
  69. control_plane_api/app/policies/rate_limiting.rego +100 -0
  70. control_plane_api/app/policies/tool_restrictions.rego +86 -0
  71. control_plane_api/app/routers/__init__.py +4 -0
  72. control_plane_api/app/routers/agents.py +364 -0
  73. control_plane_api/app/routers/agents_v2.py +1260 -0
  74. control_plane_api/app/routers/analytics.py +1014 -0
  75. control_plane_api/app/routers/context_manager.py +562 -0
  76. control_plane_api/app/routers/environment_context.py +270 -0
  77. control_plane_api/app/routers/environments.py +715 -0
  78. control_plane_api/app/routers/execution_environment.py +517 -0
  79. control_plane_api/app/routers/executions.py +1911 -0
  80. control_plane_api/app/routers/health.py +92 -0
  81. control_plane_api/app/routers/health_v2.py +326 -0
  82. control_plane_api/app/routers/integrations.py +274 -0
  83. control_plane_api/app/routers/jobs.py +1344 -0
  84. control_plane_api/app/routers/models.py +82 -0
  85. control_plane_api/app/routers/models_v2.py +361 -0
  86. control_plane_api/app/routers/policies.py +639 -0
  87. control_plane_api/app/routers/presence.py +234 -0
  88. control_plane_api/app/routers/projects.py +902 -0
  89. control_plane_api/app/routers/runners.py +379 -0
  90. control_plane_api/app/routers/runtimes.py +172 -0
  91. control_plane_api/app/routers/secrets.py +155 -0
  92. control_plane_api/app/routers/skills.py +1001 -0
  93. control_plane_api/app/routers/skills_definitions.py +140 -0
  94. control_plane_api/app/routers/task_planning.py +1256 -0
  95. control_plane_api/app/routers/task_queues.py +654 -0
  96. control_plane_api/app/routers/team_context.py +270 -0
  97. control_plane_api/app/routers/teams.py +1400 -0
  98. control_plane_api/app/routers/worker_queues.py +1545 -0
  99. control_plane_api/app/routers/workers.py +935 -0
  100. control_plane_api/app/routers/workflows.py +204 -0
  101. control_plane_api/app/runtimes/__init__.py +6 -0
  102. control_plane_api/app/runtimes/validation.py +344 -0
  103. control_plane_api/app/schemas/job_schemas.py +295 -0
  104. control_plane_api/app/services/__init__.py +1 -0
  105. control_plane_api/app/services/agno_service.py +619 -0
  106. control_plane_api/app/services/litellm_service.py +190 -0
  107. control_plane_api/app/services/policy_service.py +525 -0
  108. control_plane_api/app/services/temporal_cloud_provisioning.py +150 -0
  109. control_plane_api/app/skills/__init__.py +44 -0
  110. control_plane_api/app/skills/base.py +229 -0
  111. control_plane_api/app/skills/business_intelligence.py +189 -0
  112. control_plane_api/app/skills/data_visualization.py +154 -0
  113. control_plane_api/app/skills/docker.py +104 -0
  114. control_plane_api/app/skills/file_generation.py +94 -0
  115. control_plane_api/app/skills/file_system.py +110 -0
  116. control_plane_api/app/skills/python.py +92 -0
  117. control_plane_api/app/skills/registry.py +65 -0
  118. control_plane_api/app/skills/shell.py +102 -0
  119. control_plane_api/app/skills/workflow_executor.py +469 -0
  120. control_plane_api/app/utils/workflow_executor.py +354 -0
  121. control_plane_api/app/workflows/__init__.py +11 -0
  122. control_plane_api/app/workflows/agent_execution.py +507 -0
  123. control_plane_api/app/workflows/agent_execution_with_skills.py +222 -0
  124. control_plane_api/app/workflows/namespace_provisioning.py +326 -0
  125. control_plane_api/app/workflows/team_execution.py +399 -0
  126. control_plane_api/scripts/seed_models.py +239 -0
  127. control_plane_api/worker/__init__.py +0 -0
  128. control_plane_api/worker/activities/__init__.py +0 -0
  129. control_plane_api/worker/activities/agent_activities.py +1241 -0
  130. control_plane_api/worker/activities/approval_activities.py +234 -0
  131. control_plane_api/worker/activities/runtime_activities.py +388 -0
  132. control_plane_api/worker/activities/skill_activities.py +267 -0
  133. control_plane_api/worker/activities/team_activities.py +1217 -0
  134. control_plane_api/worker/config/__init__.py +31 -0
  135. control_plane_api/worker/config/worker_config.py +275 -0
  136. control_plane_api/worker/control_plane_client.py +529 -0
  137. control_plane_api/worker/examples/analytics_integration_example.py +362 -0
  138. control_plane_api/worker/models/__init__.py +1 -0
  139. control_plane_api/worker/models/inputs.py +89 -0
  140. control_plane_api/worker/runtimes/__init__.py +31 -0
  141. control_plane_api/worker/runtimes/base.py +789 -0
  142. control_plane_api/worker/runtimes/claude_code_runtime.py +1443 -0
  143. control_plane_api/worker/runtimes/default_runtime.py +617 -0
  144. control_plane_api/worker/runtimes/factory.py +173 -0
  145. control_plane_api/worker/runtimes/validation.py +93 -0
  146. control_plane_api/worker/services/__init__.py +1 -0
  147. control_plane_api/worker/services/agent_executor.py +422 -0
  148. control_plane_api/worker/services/agent_executor_v2.py +383 -0
  149. control_plane_api/worker/services/analytics_collector.py +457 -0
  150. control_plane_api/worker/services/analytics_service.py +464 -0
  151. control_plane_api/worker/services/approval_tools.py +310 -0
  152. control_plane_api/worker/services/approval_tools_agno.py +207 -0
  153. control_plane_api/worker/services/cancellation_manager.py +177 -0
  154. control_plane_api/worker/services/data_visualization.py +827 -0
  155. control_plane_api/worker/services/jira_tools.py +257 -0
  156. control_plane_api/worker/services/runtime_analytics.py +328 -0
  157. control_plane_api/worker/services/session_service.py +194 -0
  158. control_plane_api/worker/services/skill_factory.py +175 -0
  159. control_plane_api/worker/services/team_executor.py +574 -0
  160. control_plane_api/worker/services/team_executor_v2.py +465 -0
  161. control_plane_api/worker/services/workflow_executor_tools.py +1418 -0
  162. control_plane_api/worker/tests/__init__.py +1 -0
  163. control_plane_api/worker/tests/e2e/__init__.py +0 -0
  164. control_plane_api/worker/tests/e2e/test_execution_flow.py +571 -0
  165. control_plane_api/worker/tests/integration/__init__.py +0 -0
  166. control_plane_api/worker/tests/integration/test_control_plane_integration.py +308 -0
  167. control_plane_api/worker/tests/unit/__init__.py +0 -0
  168. control_plane_api/worker/tests/unit/test_control_plane_client.py +401 -0
  169. control_plane_api/worker/utils/__init__.py +1 -0
  170. control_plane_api/worker/utils/chunk_batcher.py +305 -0
  171. control_plane_api/worker/utils/retry_utils.py +60 -0
  172. control_plane_api/worker/utils/streaming_utils.py +373 -0
  173. control_plane_api/worker/worker.py +753 -0
  174. control_plane_api/worker/workflows/__init__.py +0 -0
  175. control_plane_api/worker/workflows/agent_execution.py +589 -0
  176. control_plane_api/worker/workflows/team_execution.py +429 -0
  177. kubiya_control_plane_api-0.3.4.dist-info/METADATA +229 -0
  178. kubiya_control_plane_api-0.3.4.dist-info/RECORD +182 -0
  179. kubiya_control_plane_api-0.3.4.dist-info/entry_points.txt +2 -0
  180. kubiya_control_plane_api-0.3.4.dist-info/top_level.txt +1 -0
  181. kubiya_control_plane_api-0.1.0.dist-info/METADATA +0 -66
  182. kubiya_control_plane_api-0.1.0.dist-info/RECORD +0 -5
  183. kubiya_control_plane_api-0.1.0.dist-info/top_level.txt +0 -1
  184. {kubiya_control_plane_api-0.1.0.dist-info/licenses → control_plane_api}/LICENSE +0 -0
  185. {kubiya_control_plane_api-0.1.0.dist-info → kubiya_control_plane_api-0.3.4.dist-info}/WHEEL +0 -0
@@ -0,0 +1,154 @@
1
+ """
2
+ Data Visualization Skill
3
+
4
+ Provides data visualization and diagramming capabilities using Mermaid syntax.
5
+ Agents can create flowcharts, sequence diagrams, class diagrams, ER diagrams,
6
+ and other visualizations for data intelligence and business intelligence use cases.
7
+ """
8
+ from typing import Dict, Any, List
9
+ from .base import SkillDefinition, SkillType, SkillCategory, SkillVariant
10
+ from .registry import register_skill
11
+
12
+
13
+ class DataVisualizationSkill(SkillDefinition):
14
+ """Data visualization and diagramming skill"""
15
+
16
+ @property
17
+ def type(self) -> SkillType:
18
+ return SkillType.DATA_VISUALIZATION
19
+
20
+ @property
21
+ def name(self) -> str:
22
+ return "Data Visualization"
23
+
24
+ @property
25
+ def description(self) -> str:
26
+ return "Create diagrams and visualizations using Mermaid syntax for data analysis and BI intelligence"
27
+
28
+ @property
29
+ def icon(self) -> str:
30
+ return "BarChart3"
31
+
32
+ def get_variants(self) -> List[SkillVariant]:
33
+ return [
34
+ SkillVariant(
35
+ id="diagramming_full",
36
+ name="Full Diagramming Suite",
37
+ description="All diagram types: flowcharts, sequences, class diagrams, ER diagrams, Gantt charts, and more",
38
+ category=SkillCategory.COMMON,
39
+ badge="Recommended",
40
+ icon="BarChart3",
41
+ configuration={
42
+ "enable_flowchart": True,
43
+ "enable_sequence": True,
44
+ "enable_class_diagram": True,
45
+ "enable_er_diagram": True,
46
+ "enable_gantt": True,
47
+ "enable_pie_chart": True,
48
+ "enable_state_diagram": True,
49
+ "enable_git_graph": True,
50
+ "enable_user_journey": True,
51
+ "enable_quadrant_chart": True,
52
+ "max_diagram_size": 50000, # Max characters per diagram
53
+ },
54
+ is_default=True,
55
+ ),
56
+ SkillVariant(
57
+ id="diagramming_data_viz",
58
+ name="Data Visualization",
59
+ description="Focus on data visualization: charts, ER diagrams, and analytics diagrams",
60
+ category=SkillCategory.COMMON,
61
+ badge="Analytics",
62
+ icon="PieChart",
63
+ configuration={
64
+ "enable_flowchart": False,
65
+ "enable_sequence": False,
66
+ "enable_class_diagram": False,
67
+ "enable_er_diagram": True,
68
+ "enable_gantt": True,
69
+ "enable_pie_chart": True,
70
+ "enable_state_diagram": False,
71
+ "enable_git_graph": False,
72
+ "enable_user_journey": False,
73
+ "enable_quadrant_chart": True,
74
+ "max_diagram_size": 30000,
75
+ },
76
+ is_default=False,
77
+ ),
78
+ SkillVariant(
79
+ id="diagramming_technical",
80
+ name="Technical Diagrams",
81
+ description="Technical diagrams: flowcharts, sequences, class diagrams, state machines",
82
+ category=SkillCategory.ADVANCED,
83
+ badge="Engineering",
84
+ icon="GitBranch",
85
+ configuration={
86
+ "enable_flowchart": True,
87
+ "enable_sequence": True,
88
+ "enable_class_diagram": True,
89
+ "enable_er_diagram": True,
90
+ "enable_gantt": False,
91
+ "enable_pie_chart": False,
92
+ "enable_state_diagram": True,
93
+ "enable_git_graph": True,
94
+ "enable_user_journey": False,
95
+ "enable_quadrant_chart": False,
96
+ "max_diagram_size": 50000,
97
+ },
98
+ is_default=False,
99
+ ),
100
+ ]
101
+
102
+ def validate_configuration(self, config: Dict[str, Any]) -> Dict[str, Any]:
103
+ """Validate diagramming configuration"""
104
+ validated = {
105
+ "enable_flowchart": config.get("enable_flowchart", True),
106
+ "enable_sequence": config.get("enable_sequence", True),
107
+ "enable_class_diagram": config.get("enable_class_diagram", True),
108
+ "enable_er_diagram": config.get("enable_er_diagram", True),
109
+ "enable_gantt": config.get("enable_gantt", True),
110
+ "enable_pie_chart": config.get("enable_pie_chart", True),
111
+ "enable_state_diagram": config.get("enable_state_diagram", True),
112
+ "enable_git_graph": config.get("enable_git_graph", True),
113
+ "enable_user_journey": config.get("enable_user_journey", True),
114
+ "enable_quadrant_chart": config.get("enable_quadrant_chart", True),
115
+ }
116
+
117
+ # Add max_diagram_size if specified
118
+ max_size = config.get("max_diagram_size", 50000)
119
+ validated["max_diagram_size"] = min(max_size, 100000) # Cap at 100k characters
120
+
121
+ # Add optional theme settings
122
+ if "theme" in config:
123
+ theme = config["theme"]
124
+ if theme in ["default", "dark", "forest", "neutral"]:
125
+ validated["theme"] = theme
126
+
127
+ return validated
128
+
129
+ def get_default_configuration(self) -> Dict[str, Any]:
130
+ """Default: all diagram types enabled"""
131
+ return {
132
+ "enable_flowchart": True,
133
+ "enable_sequence": True,
134
+ "enable_class_diagram": True,
135
+ "enable_er_diagram": True,
136
+ "enable_gantt": True,
137
+ "enable_pie_chart": True,
138
+ "enable_state_diagram": True,
139
+ "enable_git_graph": True,
140
+ "enable_user_journey": True,
141
+ "enable_quadrant_chart": True,
142
+ "max_diagram_size": 50000,
143
+ }
144
+
145
+ def get_framework_class_name(self) -> str:
146
+ """
147
+ Get the underlying framework tool class name.
148
+ Returns the class name for DiagrammingTools.
149
+ """
150
+ return "DataVisualizationTools"
151
+
152
+
153
+ # Auto-register this skill
154
+ register_skill(DataVisualizationSkill())
@@ -0,0 +1,104 @@
1
+ """
2
+ Docker Skill
3
+
4
+ Provides Docker management capabilities (containers, images, volumes, networks).
5
+ """
6
+ from typing import Dict, Any, List
7
+ from .base import SkillDefinition, SkillType, SkillCategory, SkillVariant, SkillRequirements
8
+ from .registry import register_skill
9
+
10
+
11
+ class DockerSkill(SkillDefinition):
12
+ """Docker management skill"""
13
+
14
+ @property
15
+ def type(self) -> SkillType:
16
+ return SkillType.DOCKER
17
+
18
+ @property
19
+ def name(self) -> str:
20
+ return "Docker"
21
+
22
+ @property
23
+ def description(self) -> str:
24
+ return "Manage Docker containers, images, volumes, and networks on the local system"
25
+
26
+ @property
27
+ def icon(self) -> str:
28
+ return "FaDocker"
29
+
30
+ @property
31
+ def icon_type(self) -> str:
32
+ return "react-icon"
33
+
34
+ def get_variants(self) -> List[SkillVariant]:
35
+ return [
36
+ SkillVariant(
37
+ id="docker_containers",
38
+ name="Docker - Containers",
39
+ description="Manage Docker containers on local system (start, stop, inspect)",
40
+ category=SkillCategory.COMMON,
41
+ badge="Safe",
42
+ icon="FaDocker",
43
+ configuration={
44
+ "enable_container_management": True,
45
+ "enable_image_management": False,
46
+ "enable_volume_management": False,
47
+ "enable_network_management": False,
48
+ },
49
+ is_default=True,
50
+ ),
51
+ SkillVariant(
52
+ id="docker_full_control",
53
+ name="Docker - Full Control",
54
+ description="Complete Docker management: containers, images, volumes, and networks",
55
+ category=SkillCategory.ADVANCED,
56
+ badge="Advanced",
57
+ icon="FaDocker",
58
+ configuration={
59
+ "enable_container_management": True,
60
+ "enable_image_management": True,
61
+ "enable_volume_management": True,
62
+ "enable_network_management": True,
63
+ },
64
+ is_default=False,
65
+ ),
66
+ ]
67
+
68
+ def validate_configuration(self, config: Dict[str, Any]) -> Dict[str, Any]:
69
+ """Validate Docker configuration"""
70
+ validated = {
71
+ "enable_container_management": config.get("enable_container_management", True),
72
+ "enable_image_management": config.get("enable_image_management", False),
73
+ "enable_volume_management": config.get("enable_volume_management", False),
74
+ "enable_network_management": config.get("enable_network_management", False),
75
+ }
76
+
77
+ # Add docker_host if specified (e.g., "unix:///var/run/docker.sock")
78
+ if "docker_host" in config:
79
+ validated["docker_host"] = str(config["docker_host"])
80
+
81
+ return validated
82
+
83
+ def get_default_configuration(self) -> Dict[str, Any]:
84
+ """Default: container management only"""
85
+ return {
86
+ "enable_container_management": True,
87
+ "enable_image_management": False,
88
+ "enable_volume_management": False,
89
+ "enable_network_management": False,
90
+ }
91
+
92
+ def get_requirements(self) -> SkillRequirements:
93
+ """Docker skill requires docker package and Docker daemon"""
94
+ return SkillRequirements(
95
+ python_packages=["docker>=6.0.0"],
96
+ system_packages=["docker"],
97
+ supported_os=["linux", "darwin", "windows"],
98
+ external_dependencies=["Docker daemon must be running"],
99
+ notes="Requires Docker to be installed and the Docker daemon to be accessible"
100
+ )
101
+
102
+
103
+ # Auto-register this skill
104
+ register_skill(DockerSkill())
@@ -0,0 +1,94 @@
1
+ """
2
+ File Generation Skill
3
+
4
+ Provides file generation capabilities for various formats (JSON, CSV, PDF, TXT).
5
+ """
6
+ from typing import Dict, Any, List
7
+ from .base import SkillDefinition, SkillType, SkillCategory, SkillVariant
8
+ from .registry import register_skill
9
+
10
+
11
+ class FileGenerationSkill(SkillDefinition):
12
+ """File generation skill"""
13
+
14
+ @property
15
+ def type(self) -> SkillType:
16
+ return SkillType.FILE_GENERATION
17
+
18
+ @property
19
+ def name(self) -> str:
20
+ return "File Generator"
21
+
22
+ @property
23
+ def description(self) -> str:
24
+ return "Generate and save files in various formats (JSON, CSV, PDF, TXT)"
25
+
26
+ @property
27
+ def icon(self) -> str:
28
+ return "FileOutput"
29
+
30
+ def get_variants(self) -> List[SkillVariant]:
31
+ return [
32
+ SkillVariant(
33
+ id="file_generator",
34
+ name="File Generator",
35
+ description="Generate and save files locally: JSON, CSV, PDF, and TXT formats",
36
+ category=SkillCategory.COMMON,
37
+ badge="Recommended",
38
+ icon="FileOutput",
39
+ configuration={
40
+ "enable_json_generation": True,
41
+ "enable_csv_generation": True,
42
+ "enable_pdf_generation": True,
43
+ "enable_txt_generation": True,
44
+ },
45
+ is_default=True,
46
+ ),
47
+ SkillVariant(
48
+ id="file_generator_data_only",
49
+ name="File Generator - Data Only",
50
+ description="Generate data files only (JSON, CSV) without document formats",
51
+ category=SkillCategory.COMMON,
52
+ badge="Safe",
53
+ icon="FileText",
54
+ configuration={
55
+ "enable_json_generation": True,
56
+ "enable_csv_generation": True,
57
+ "enable_pdf_generation": False,
58
+ "enable_txt_generation": True,
59
+ },
60
+ is_default=False,
61
+ ),
62
+ ]
63
+
64
+ def validate_configuration(self, config: Dict[str, Any]) -> Dict[str, Any]:
65
+ """Validate file generation configuration"""
66
+ validated = {
67
+ "enable_json_generation": config.get("enable_json_generation", True),
68
+ "enable_csv_generation": config.get("enable_csv_generation", True),
69
+ "enable_pdf_generation": config.get("enable_pdf_generation", True),
70
+ "enable_txt_generation": config.get("enable_txt_generation", True),
71
+ }
72
+
73
+ # Add output_directory if specified
74
+ if "output_directory" in config:
75
+ validated["output_directory"] = str(config["output_directory"])
76
+
77
+ # Add max_file_size if specified (in MB)
78
+ if "max_file_size" in config:
79
+ validated["max_file_size"] = min(config.get("max_file_size", 10), 100) # Max 100MB
80
+
81
+ return validated
82
+
83
+ def get_default_configuration(self) -> Dict[str, Any]:
84
+ """Default: all formats enabled"""
85
+ return {
86
+ "enable_json_generation": True,
87
+ "enable_csv_generation": True,
88
+ "enable_pdf_generation": True,
89
+ "enable_txt_generation": True,
90
+ }
91
+
92
+
93
+ # Auto-register this skill
94
+ register_skill(FileGenerationSkill())
@@ -0,0 +1,110 @@
1
+ """
2
+ File System Skill
3
+
4
+ Provides file system access capabilities (read, write, list, search files).
5
+ """
6
+ from typing import Dict, Any, List
7
+ from .base import SkillDefinition, SkillType, SkillCategory, SkillVariant
8
+ from .registry import register_skill
9
+
10
+
11
+ class FileSystemSkill(SkillDefinition):
12
+ """File system access skill"""
13
+
14
+ @property
15
+ def type(self) -> SkillType:
16
+ return SkillType.FILE_SYSTEM
17
+
18
+ @property
19
+ def name(self) -> str:
20
+ return "File System"
21
+
22
+ @property
23
+ def description(self) -> str:
24
+ return "Access and manipulate files and directories on the local file system"
25
+
26
+ @property
27
+ def icon(self) -> str:
28
+ return "FolderOpen"
29
+
30
+ def get_variants(self) -> List[SkillVariant]:
31
+ return [
32
+ SkillVariant(
33
+ id="file_system_read_only",
34
+ name="File System - Read Only",
35
+ description="Access local file system for reading, listing, and searching files safely",
36
+ category=SkillCategory.COMMON,
37
+ badge="Safe",
38
+ icon="FolderOpen",
39
+ configuration={
40
+ "enable_save_file": False,
41
+ "enable_read_file": True,
42
+ "enable_list_files": True,
43
+ "enable_search_files": True,
44
+ },
45
+ is_default=False,
46
+ ),
47
+ SkillVariant(
48
+ id="file_system_full_access",
49
+ name="File System - Full Access",
50
+ description="Complete file system access: read, write, create, and modify local files",
51
+ category=SkillCategory.COMMON,
52
+ badge="Recommended",
53
+ icon="HardDrive",
54
+ configuration={
55
+ "enable_save_file": True,
56
+ "enable_read_file": True,
57
+ "enable_list_files": True,
58
+ "enable_search_files": True,
59
+ },
60
+ is_default=True,
61
+ ),
62
+ SkillVariant(
63
+ id="file_system_sandboxed",
64
+ name="File System - Sandboxed",
65
+ description="Isolated file access limited to /sandbox directory only",
66
+ category=SkillCategory.SECURITY,
67
+ badge="Secure",
68
+ icon="Shield",
69
+ configuration={
70
+ "base_dir": "/sandbox",
71
+ "enable_save_file": True,
72
+ "enable_read_file": True,
73
+ "enable_list_files": True,
74
+ "enable_search_files": False,
75
+ },
76
+ is_default=False,
77
+ ),
78
+ ]
79
+
80
+ def validate_configuration(self, config: Dict[str, Any]) -> Dict[str, Any]:
81
+ """Validate file system configuration"""
82
+ validated = {
83
+ "enable_save_file": config.get("enable_save_file", False),
84
+ "enable_read_file": config.get("enable_read_file", True),
85
+ "enable_list_files": config.get("enable_list_files", True),
86
+ "enable_search_files": config.get("enable_search_files", True),
87
+ }
88
+
89
+ # Add base_dir if specified
90
+ if "base_dir" in config:
91
+ validated["base_dir"] = str(config["base_dir"])
92
+
93
+ # Add allowed_extensions if specified
94
+ if "allowed_extensions" in config:
95
+ validated["allowed_extensions"] = list(config["allowed_extensions"])
96
+
97
+ return validated
98
+
99
+ def get_default_configuration(self) -> Dict[str, Any]:
100
+ """Default: full access"""
101
+ return {
102
+ "enable_save_file": True,
103
+ "enable_read_file": True,
104
+ "enable_list_files": True,
105
+ "enable_search_files": True,
106
+ }
107
+
108
+
109
+ # Auto-register this skill
110
+ register_skill(FileSystemSkill())
@@ -0,0 +1,92 @@
1
+ """
2
+ Python Skill
3
+
4
+ Provides Python code execution capabilities with configurable restrictions.
5
+ """
6
+ from typing import Dict, Any, List
7
+ from .base import SkillDefinition, SkillType, SkillCategory, SkillVariant
8
+ from .registry import register_skill
9
+
10
+
11
+ class PythonSkill(SkillDefinition):
12
+ """Python code execution skill"""
13
+
14
+ @property
15
+ def type(self) -> SkillType:
16
+ return SkillType.PYTHON
17
+
18
+ @property
19
+ def name(self) -> str:
20
+ return "Python"
21
+
22
+ @property
23
+ def description(self) -> str:
24
+ return "Execute Python code locally with configurable import restrictions"
25
+
26
+ @property
27
+ def icon(self) -> str:
28
+ return "FaPython"
29
+
30
+ @property
31
+ def icon_type(self) -> str:
32
+ return "react-icon"
33
+
34
+ def get_variants(self) -> List[SkillVariant]:
35
+ return [
36
+ SkillVariant(
37
+ id="python_runtime",
38
+ name="Python Runtime",
39
+ description="Execute Python code locally with restricted imports for security",
40
+ category=SkillCategory.COMMON,
41
+ badge="Safe",
42
+ icon="FaPython",
43
+ configuration={
44
+ "enable_code_execution": True,
45
+ "blocked_imports": ["os", "subprocess", "sys", "socket", "shutil"],
46
+ },
47
+ is_default=True,
48
+ ),
49
+ SkillVariant(
50
+ id="python_unrestricted",
51
+ name="Python - Unrestricted",
52
+ description="Execute Python code without import restrictions or sandboxing",
53
+ category=SkillCategory.ADVANCED,
54
+ badge="Advanced",
55
+ icon="FaPython",
56
+ configuration={
57
+ "enable_code_execution": True,
58
+ },
59
+ is_default=False,
60
+ ),
61
+ ]
62
+
63
+ def validate_configuration(self, config: Dict[str, Any]) -> Dict[str, Any]:
64
+ """Validate Python configuration"""
65
+ validated = {
66
+ "enable_code_execution": config.get("enable_code_execution", True),
67
+ }
68
+
69
+ # Add blocked_imports if specified
70
+ if "blocked_imports" in config:
71
+ validated["blocked_imports"] = list(config["blocked_imports"])
72
+
73
+ # Add allowed_imports if specified (whitelist mode)
74
+ if "allowed_imports" in config:
75
+ validated["allowed_imports"] = list(config["allowed_imports"])
76
+
77
+ # Add timeout if specified
78
+ if "timeout" in config:
79
+ validated["timeout"] = min(config.get("timeout", 30), 300) # Max 5 minutes
80
+
81
+ return validated
82
+
83
+ def get_default_configuration(self) -> Dict[str, Any]:
84
+ """Default: restricted imports"""
85
+ return {
86
+ "enable_code_execution": True,
87
+ "blocked_imports": ["os", "subprocess", "sys", "socket", "shutil"],
88
+ }
89
+
90
+
91
+ # Auto-register this skill
92
+ register_skill(PythonSkill())
@@ -0,0 +1,65 @@
1
+ """
2
+ Skill Registry
3
+
4
+ Central registry for all available skills. Skills self-register
5
+ when their modules are imported.
6
+ """
7
+ from typing import Dict, List, Optional
8
+ from .base import SkillDefinition, SkillType
9
+ import logging
10
+
11
+ logger = logging.getLogger(__name__)
12
+
13
+
14
+ class SkillRegistry:
15
+ """Registry for all available skill definitions"""
16
+
17
+ def __init__(self):
18
+ self._skills: Dict[SkillType, SkillDefinition] = {}
19
+
20
+ def register(self, skill: SkillDefinition):
21
+ """Register a skill definition"""
22
+ if skill.type in self._skills:
23
+ logger.warning(f"Skill {skill.type} is already registered, overwriting")
24
+
25
+ self._skills[skill.type] = skill
26
+ logger.info(f"Registered skill: {skill.type} - {skill.name}")
27
+
28
+ def get(self, skill_type: SkillType) -> Optional[SkillDefinition]:
29
+ """Get a skill definition by type"""
30
+ return self._skills.get(skill_type)
31
+
32
+ def get_all(self) -> List[SkillDefinition]:
33
+ """Get all registered skills"""
34
+ return list(self._skills.values())
35
+
36
+ def get_by_name(self, name: str) -> Optional[SkillDefinition]:
37
+ """Get a skill by name"""
38
+ for skill in self._skills.values():
39
+ if skill.name.lower() == name.lower():
40
+ return skill
41
+ return None
42
+
43
+ def list_types(self) -> List[SkillType]:
44
+ """List all registered skill types"""
45
+ return list(self._skills.keys())
46
+
47
+
48
+ # Global registry instance
49
+ skill_registry = SkillRegistry()
50
+
51
+
52
+ def register_skill(skill: SkillDefinition):
53
+ """Decorator or function to register a skill"""
54
+ skill_registry.register(skill)
55
+ return skill
56
+
57
+
58
+ def get_skill(skill_type: SkillType) -> Optional[SkillDefinition]:
59
+ """Get a skill definition by type"""
60
+ return skill_registry.get(skill_type)
61
+
62
+
63
+ def get_all_skills() -> List[SkillDefinition]:
64
+ """Get all registered skills"""
65
+ return skill_registry.get_all()