code0-hercules 1.6.0__tar.gz → 1.7.0__tar.gz
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.
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/PKG-INFO +2 -2
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/code0_hercules.egg-info/PKG-INFO +2 -2
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/code0_hercules.egg-info/SOURCES.txt +3 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/code0_hercules.egg-info/requires.txt +1 -1
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/__init__.py +11 -2
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/action.py +37 -1
- code0_hercules-1.7.0/hercules/actions/execution.py +194 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/internal/schema.py +10 -0
- code0_hercules-1.7.0/hercules/internal/sub_flow_function.py +86 -0
- code0_hercules-1.7.0/hercules/manager/sub_flow_function.py +93 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/models/runtime_function.py +8 -3
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/types.py +39 -1
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/pyproject.toml +2 -2
- code0_hercules-1.7.0/tests/test_execution.py +309 -0
- code0_hercules-1.6.0/hercules/actions/execution.py +0 -121
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/README.md +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/code0_hercules.egg-info/dependency_links.txt +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/code0_hercules.egg-info/entry_points.txt +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/code0_hercules.egg-info/top_level.txt +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/_metadata.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/_tsgen/convert.mjs +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/_tsgen/package-lock.json +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/_tsgen/package.json +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/_tucana/__init__.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/_tucana/helpers.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/actions/__init__.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/actions/flow_execution.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/actions/flow_update.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/actions/module_configurations.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/actions/sub_flow_execution.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/cli.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/decorators/__init__.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/decorators/datatype.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/decorators/event.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/decorators/function.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/decorators/meta.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/decorators/runtime_event.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/decorators/runtime_function.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/__init__.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/cron_action/__init__.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/cron_action/data_types/__init__.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/cron_action/data_types/cron_day_of_month.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/cron_action/data_types/cron_day_of_week.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/cron_action/data_types/cron_hour.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/cron_action/data_types/cron_minute.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/cron_action/data_types/cron_month.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/cron_action/runtime_flow_types/__init__.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/cron_action/runtime_flow_types/cron.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/rest_action/__init__.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/rest_action/data_types/__init__.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/rest_action/data_types/rest_adapter_input.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/rest_action/data_types/rest_auth_type.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/rest_action/data_types/rest_auth_value.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/rest_action/runtime_flow_types/__init__.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/rest_action/runtime_flow_types/rest.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/rest_action/runtime_functions/__init__.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/rest_action/runtime_functions/rest_control_respond.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_boolean/__init__.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_boolean/data_types/__init__.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_boolean/data_types/boolean.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_boolean/runtime_functions/__init__.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_boolean/runtime_functions/std_boolean_as_number.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_boolean/runtime_functions/std_boolean_as_text.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_boolean/runtime_functions/std_boolean_from_number.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_boolean/runtime_functions/std_boolean_from_text.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_boolean/runtime_functions/std_boolean_is_equal.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_boolean/runtime_functions/std_boolean_negate.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_color/__init__.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_color/data_types/__init__.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_color/data_types/color.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_color/runtime_functions/__init__.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_color/runtime_functions/std_color_as_hex.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_color/runtime_functions/std_color_as_hsl.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_color/runtime_functions/std_color_as_rgb.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_color/runtime_functions/std_color_from_hex.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_color/runtime_functions/std_color_from_hsl.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_color/runtime_functions/std_color_from_rgb.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_control/__init__.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_control/data_types/__init__.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_control/data_types/comparator.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_control/data_types/consumer.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_control/data_types/predicate.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_control/data_types/runnable.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_control/data_types/transform.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_control/runtime_functions/__init__.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_control/runtime_functions/std_control_if.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_control/runtime_functions/std_control_if_else.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_control/runtime_functions/std_control_return.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_control/runtime_functions/std_control_stop.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_control/runtime_functions/std_control_value.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_date/__init__.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_date/data_types/__init__.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_date/data_types/date.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_date/data_types/hour.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_date/data_types/minute.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_date/data_types/month.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_date/runtime_functions/__init__.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_date/runtime_functions/std_date_format.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_date/runtime_functions/std_date_from.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_date/runtime_functions/std_date_from_text.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_date/runtime_functions/std_date_from_unix.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_date/runtime_functions/std_date_now.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_file/__init__.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_file/data_types/__init__.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_file/data_types/file.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_file/runtime_functions/__init__.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_file/runtime_functions/std_file_size.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_http/__init__.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_http/data_types/__init__.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_http/data_types/http_auth_place.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_http/data_types/http_auth_type.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_http/data_types/http_auth_value.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_http/data_types/http_method.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_http/data_types/http_payload.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_http/data_types/http_request.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_http/data_types/http_response.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_http/data_types/http_schema.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_http/data_types/http_status_code.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_http/data_types/http_url.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_http/runtime_functions/__init__.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_http/runtime_functions/http_request_send.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_list/__init__.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_list/data_types/__init__.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_list/data_types/list.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_list/runtime_functions/__init__.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_list/runtime_functions/std_list_at.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_list/runtime_functions/std_list_concat.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_list/runtime_functions/std_list_filter.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_list/runtime_functions/std_list_find.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_list/runtime_functions/std_list_find_index.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_list/runtime_functions/std_list_find_last.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_list/runtime_functions/std_list_first.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_list/runtime_functions/std_list_flat.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_list/runtime_functions/std_list_for_each.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_list/runtime_functions/std_list_index_of.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_list/runtime_functions/std_list_is_empty.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_list/runtime_functions/std_list_join.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_list/runtime_functions/std_list_last.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_list/runtime_functions/std_list_map.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_list/runtime_functions/std_list_max.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_list/runtime_functions/std_list_min.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_list/runtime_functions/std_list_pop.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_list/runtime_functions/std_list_push.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_list/runtime_functions/std_list_remove.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_list/runtime_functions/std_list_reverse.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_list/runtime_functions/std_list_size.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_list/runtime_functions/std_list_sort.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_list/runtime_functions/std_list_sort_reverse.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_list/runtime_functions/std_list_sum.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_list/runtime_functions/std_list_to_unique.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_number/__init__.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_number/data_types/__init__.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_number/data_types/number.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_number/runtime_functions/__init__.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_number/runtime_functions/std_number_abs.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_number/runtime_functions/std_number_add.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_number/runtime_functions/std_number_arccos.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_number/runtime_functions/std_number_arcsin.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_number/runtime_functions/std_number_arctan.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_number/runtime_functions/std_number_as_text.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_number/runtime_functions/std_number_clamp.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_number/runtime_functions/std_number_cos.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_number/runtime_functions/std_number_cosh.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_number/runtime_functions/std_number_divide.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_number/runtime_functions/std_number_euler.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_number/runtime_functions/std_number_exponential.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_number/runtime_functions/std_number_from_text.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_number/runtime_functions/std_number_has_digits.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_number/runtime_functions/std_number_is_equal.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_number/runtime_functions/std_number_is_greater.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_number/runtime_functions/std_number_is_less.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_number/runtime_functions/std_number_is_positive.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_number/runtime_functions/std_number_is_zero.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_number/runtime_functions/std_number_ln.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_number/runtime_functions/std_number_log.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_number/runtime_functions/std_number_max.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_number/runtime_functions/std_number_min.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_number/runtime_functions/std_number_modulo.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_number/runtime_functions/std_number_multiply.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_number/runtime_functions/std_number_negate.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_number/runtime_functions/std_number_pi.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_number/runtime_functions/std_number_random_number.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_number/runtime_functions/std_number_remove_digits.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_number/runtime_functions/std_number_root.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_number/runtime_functions/std_number_round.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_number/runtime_functions/std_number_round_down.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_number/runtime_functions/std_number_round_up.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_number/runtime_functions/std_number_sin.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_number/runtime_functions/std_number_sinh.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_number/runtime_functions/std_number_square.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_number/runtime_functions/std_number_square_root.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_number/runtime_functions/std_number_subtract.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_number/runtime_functions/std_number_tan.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_object/__init__.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_object/data_types/__init__.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_object/data_types/object.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_object/data_types/type.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_object/runtime_functions/__init__.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_object/runtime_functions/std_object_contains_key.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_object/runtime_functions/std_object_get.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_object/runtime_functions/std_object_keys.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_object/runtime_functions/std_object_set.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_object/runtime_functions/std_object_size.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_text/__init__.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_text/data_types/__init__.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_text/data_types/text.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_text/data_types/text_encoding.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_text/runtime_functions/__init__.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_text/runtime_functions/std_text_append.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_text/runtime_functions/std_text_as_bytes.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_text/runtime_functions/std_text_at.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_text/runtime_functions/std_text_byte_size.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_text/runtime_functions/std_text_capitalize.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_text/runtime_functions/std_text_chars.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_text/runtime_functions/std_text_contains.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_text/runtime_functions/std_text_decode.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_text/runtime_functions/std_text_encode.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_text/runtime_functions/std_text_ends_with.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_text/runtime_functions/std_text_from_ascii.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_text/runtime_functions/std_text_hex.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_text/runtime_functions/std_text_index_of.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_text/runtime_functions/std_text_insert.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_text/runtime_functions/std_text_is_equal.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_text/runtime_functions/std_text_length.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_text/runtime_functions/std_text_lowercase.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_text/runtime_functions/std_text_octal.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_text/runtime_functions/std_text_prepend.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_text/runtime_functions/std_text_remove.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_text/runtime_functions/std_text_replace.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_text/runtime_functions/std_text_replace_first.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_text/runtime_functions/std_text_replace_last.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_text/runtime_functions/std_text_reverse.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_text/runtime_functions/std_text_split.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_text/runtime_functions/std_text_starts_with.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_text/runtime_functions/std_text_swapcase.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_text/runtime_functions/std_text_to_ascii.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_text/runtime_functions/std_text_trim.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/definitions/taurus_text/runtime_functions/std_text_uppercase.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/events.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/internal/__init__.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/internal/connection.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/internal/jwt.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/internal/literal.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/internal/module_builder.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/internal/pydantic_codegen.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/internal/tsgen.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/manager/__init__.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/manager/base.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/manager/config.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/manager/datatype.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/manager/event.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/manager/flow.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/manager/function.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/manager/runtime_event.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/manager/runtime_function.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/map/__init__.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/map/datatype.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/map/event.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/map/function.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/map/runtime_event.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/map/runtime_function.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/models/__init__.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/models/datatype.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/models/event.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/models/function.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/models/runtime_event.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/hercules/schema.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/setup.cfg +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/tests/test_datatype.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/tests/test_export.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/tests/test_index.py +0 -0
- {code0_hercules-1.6.0 → code0_hercules-1.7.0}/tests/test_literal.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: code0-hercules
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.7.0
|
|
4
4
|
Summary: Python SDK for the hercules action runner
|
|
5
5
|
License-Expression: MIT
|
|
6
6
|
Project-URL: Repository, https://github.com/code0-tech/hercules
|
|
@@ -8,7 +8,7 @@ Requires-Python: >=3.10
|
|
|
8
8
|
Description-Content-Type: text/markdown
|
|
9
9
|
Requires-Dist: grpcio>=1.64
|
|
10
10
|
Requires-Dist: protobuf>=5.0
|
|
11
|
-
Requires-Dist: tucana>=0.0.
|
|
11
|
+
Requires-Dist: tucana>=0.0.83
|
|
12
12
|
Requires-Dist: pydantic>=2
|
|
13
13
|
Provides-Extra: codegen
|
|
14
14
|
Requires-Dist: datamodel-code-generator>=0.25; extra == "codegen"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: code0-hercules
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.7.0
|
|
4
4
|
Summary: Python SDK for the hercules action runner
|
|
5
5
|
License-Expression: MIT
|
|
6
6
|
Project-URL: Repository, https://github.com/code0-tech/hercules
|
|
@@ -8,7 +8,7 @@ Requires-Python: >=3.10
|
|
|
8
8
|
Description-Content-Type: text/markdown
|
|
9
9
|
Requires-Dist: grpcio>=1.64
|
|
10
10
|
Requires-Dist: protobuf>=5.0
|
|
11
|
-
Requires-Dist: tucana>=0.0.
|
|
11
|
+
Requires-Dist: tucana>=0.0.83
|
|
12
12
|
Requires-Dist: pydantic>=2
|
|
13
13
|
Provides-Extra: codegen
|
|
14
14
|
Requires-Dist: datamodel-code-generator>=0.25; extra == "codegen"
|
|
@@ -238,6 +238,7 @@ hercules/internal/literal.py
|
|
|
238
238
|
hercules/internal/module_builder.py
|
|
239
239
|
hercules/internal/pydantic_codegen.py
|
|
240
240
|
hercules/internal/schema.py
|
|
241
|
+
hercules/internal/sub_flow_function.py
|
|
241
242
|
hercules/internal/tsgen.py
|
|
242
243
|
hercules/manager/__init__.py
|
|
243
244
|
hercules/manager/base.py
|
|
@@ -248,6 +249,7 @@ hercules/manager/flow.py
|
|
|
248
249
|
hercules/manager/function.py
|
|
249
250
|
hercules/manager/runtime_event.py
|
|
250
251
|
hercules/manager/runtime_function.py
|
|
252
|
+
hercules/manager/sub_flow_function.py
|
|
251
253
|
hercules/map/__init__.py
|
|
252
254
|
hercules/map/datatype.py
|
|
253
255
|
hercules/map/event.py
|
|
@@ -261,6 +263,7 @@ hercules/models/function.py
|
|
|
261
263
|
hercules/models/runtime_event.py
|
|
262
264
|
hercules/models/runtime_function.py
|
|
263
265
|
tests/test_datatype.py
|
|
266
|
+
tests/test_execution.py
|
|
264
267
|
tests/test_export.py
|
|
265
268
|
tests/test_index.py
|
|
266
269
|
tests/test_literal.py
|
|
@@ -18,6 +18,8 @@ from hercules.types import (
|
|
|
18
18
|
RuntimeError,
|
|
19
19
|
RuntimeFlowTypeSetting_UniquenessScope,
|
|
20
20
|
SubFlow,
|
|
21
|
+
SubFlowFunctionDefinition,
|
|
22
|
+
SubFlowFunctionSchema,
|
|
21
23
|
Translation,
|
|
22
24
|
)
|
|
23
25
|
from hercules.events import CodeZeroEvent
|
|
@@ -55,6 +57,10 @@ from hercules.manager.flow import FlowManager
|
|
|
55
57
|
from hercules.manager.function import FunctionManager
|
|
56
58
|
from hercules.manager.runtime_event import RuntimeEventManager
|
|
57
59
|
from hercules.manager.runtime_function import RuntimeFunctionManager
|
|
60
|
+
from hercules.manager.sub_flow_function import (
|
|
61
|
+
SUB_FLOW_FUNCTION_TTL_SECONDS,
|
|
62
|
+
SubFlowFunctionManager,
|
|
63
|
+
)
|
|
58
64
|
from hercules.models.datatype import DataTypeProps, DataTypeRunnable
|
|
59
65
|
from hercules.models.event import EventModel, EventSettingProps
|
|
60
66
|
from hercules.models.function import FunctionParameterProps, FunctionProps
|
|
@@ -63,7 +69,8 @@ from hercules.models.runtime_function import RuntimeFunctionProps, RuntimeFuncti
|
|
|
63
69
|
from hercules.action import Action, is_export_mode, registered_actions
|
|
64
70
|
|
|
65
71
|
__all__ = [
|
|
66
|
-
"Translation", "PlainValue", "SubFlow", "
|
|
72
|
+
"Translation", "PlainValue", "SubFlow", "SubFlowFunctionDefinition",
|
|
73
|
+
"SubFlowFunctionSchema", "FunctionContext",
|
|
67
74
|
"ProjectConfiguration", "ConfigurationDefinition", "RuntimeError",
|
|
68
75
|
"FlowTypeSetting_UniquenessScope", "RuntimeFlowTypeSetting_UniquenessScope",
|
|
69
76
|
"CodeZeroEvent", "SchemaType",
|
|
@@ -73,7 +80,9 @@ __all__ = [
|
|
|
73
80
|
"OmitFunction", "Design", "ThrowsError", "Parameter", "Schema", "TypeString",
|
|
74
81
|
"EventSetting", "OmitEvent", "OmitRuntimeFunction",
|
|
75
82
|
"BaseManager", "ConfigManager", "FlowManager", "FunctionManager",
|
|
76
|
-
"RuntimeFunctionManager", "
|
|
83
|
+
"RuntimeFunctionManager", "SubFlowFunctionManager",
|
|
84
|
+
"SUB_FLOW_FUNCTION_TTL_SECONDS", "DataTypeManager",
|
|
85
|
+
"EventManager", "RuntimeEventManager",
|
|
77
86
|
"FunctionProps", "FunctionParameterProps", "RuntimeFunctionProps",
|
|
78
87
|
"RuntimeFunctionRunnable", "DataTypeProps", "DataTypeRunnable", "EventModel",
|
|
79
88
|
"EventSettingProps", "RuntimeEventProps", "RuntimeEventRunnable",
|
|
@@ -22,6 +22,7 @@ from hercules.manager.flow import FlowManager
|
|
|
22
22
|
from hercules.manager.function import FunctionManager
|
|
23
23
|
from hercules.manager.runtime_event import RuntimeEventManager
|
|
24
24
|
from hercules.manager.runtime_function import RuntimeFunctionManager
|
|
25
|
+
from hercules.manager.sub_flow_function import SubFlowFunctionManager
|
|
25
26
|
from hercules.map.datatype import data_type_map
|
|
26
27
|
from hercules.map.event import event_map
|
|
27
28
|
from hercules.map.function import function_map
|
|
@@ -29,7 +30,12 @@ from hercules.map.runtime_event import runtime_event_map
|
|
|
29
30
|
from hercules.map.runtime_function import runtime_function_map
|
|
30
31
|
from hercules.models.event import EventModel
|
|
31
32
|
from hercules.models.function import FunctionProps
|
|
32
|
-
from hercules.types import
|
|
33
|
+
from hercules.types import (
|
|
34
|
+
ConfigurationDefinition,
|
|
35
|
+
RuntimeError,
|
|
36
|
+
SubFlowFunctionDefinition,
|
|
37
|
+
Translation,
|
|
38
|
+
)
|
|
33
39
|
|
|
34
40
|
# Registry of actions constructed while exporting, so the CLI can find them.
|
|
35
41
|
_REGISTERED_ACTIONS: List["Action"] = []
|
|
@@ -114,6 +120,7 @@ class Action(EventEmitter):
|
|
|
114
120
|
self.flows = FlowManager()
|
|
115
121
|
self.functions = FunctionManager()
|
|
116
122
|
self.runtime_functions = RuntimeFunctionManager()
|
|
123
|
+
self.sub_flow_functions = SubFlowFunctionManager()
|
|
117
124
|
self.data_types = DataTypeManager()
|
|
118
125
|
self.events = EventManager()
|
|
119
126
|
self.runtime_events = RuntimeEventManager()
|
|
@@ -165,6 +172,35 @@ class Action(EventEmitter):
|
|
|
165
172
|
),
|
|
166
173
|
)
|
|
167
174
|
|
|
175
|
+
def register_sub_flow_function(self, definition: SubFlowFunctionDefinition) -> str:
|
|
176
|
+
"""Register a sub flow function returned from a ``run`` block.
|
|
177
|
+
|
|
178
|
+
Returns the identifier Aquila invokes it by. Each returned function gets its
|
|
179
|
+
own identifier, so repeatedly returning one (e.g. once per execution) never
|
|
180
|
+
overwrites a function a running flow still holds.
|
|
181
|
+
|
|
182
|
+
Aquila gives no signal that a flow is done with a function, so a registration
|
|
183
|
+
expires on its own 30 minutes after it was registered and can no longer be
|
|
184
|
+
invoked (see :class:`~hercules.manager.sub_flow_function.SubFlowFunctionManager`).
|
|
185
|
+
Call ``sub_flow_functions.delete(identifier)`` to drop one earlier.
|
|
186
|
+
"""
|
|
187
|
+
identifier = f"{self._sub_flow_function_prefix}{definition.name}::{uuid.uuid4()}"
|
|
188
|
+
self.sub_flow_functions.set(identifier, definition)
|
|
189
|
+
return identifier
|
|
190
|
+
|
|
191
|
+
def is_sub_flow_function_identifier(self, identifier: str) -> bool:
|
|
192
|
+
"""True for an identifier this action minted for a sub flow function.
|
|
193
|
+
|
|
194
|
+
Holds whether or not it is still registered. An execution request naming one
|
|
195
|
+
that is gone addresses a function that expired (or was deleted) rather than an
|
|
196
|
+
unknown one, which lets the execution handler report it as such.
|
|
197
|
+
"""
|
|
198
|
+
return identifier.startswith(self._sub_flow_function_prefix)
|
|
199
|
+
|
|
200
|
+
@property
|
|
201
|
+
def _sub_flow_function_prefix(self) -> str:
|
|
202
|
+
return f"{self._identifier}::"
|
|
203
|
+
|
|
168
204
|
def register_data_type_class(self, klass: type) -> None:
|
|
169
205
|
definition = data_type_map(klass)
|
|
170
206
|
self.data_types.set(definition.identifier, definition)
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
"""Execution request handler (port of ``src/actions/Execution.ts``)."""
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
import asyncio
|
|
5
|
+
import inspect
|
|
6
|
+
import time
|
|
7
|
+
from dataclasses import dataclass
|
|
8
|
+
from typing import Callable, Optional
|
|
9
|
+
|
|
10
|
+
from hercules._tucana.helpers import construct_value
|
|
11
|
+
from tucana.generated.aquila import action_pb2
|
|
12
|
+
from tucana.generated.shared import errors_pb2, execution_result_pb2
|
|
13
|
+
from hercules.events import CodeZeroEvent
|
|
14
|
+
from hercules.internal.literal import resolve_node_value
|
|
15
|
+
from hercules.internal.sub_flow_function import (
|
|
16
|
+
as_sub_flow_function_definition,
|
|
17
|
+
build_sub_flow_function_result,
|
|
18
|
+
)
|
|
19
|
+
from hercules.types import ProjectConfiguration, RuntimeError
|
|
20
|
+
|
|
21
|
+
packet_type = "execution"
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
@dataclass
|
|
25
|
+
class _ExecutionTarget:
|
|
26
|
+
"""A function an execution request may address.
|
|
27
|
+
|
|
28
|
+
Either a registered runtime function or a sub flow function returned by one.
|
|
29
|
+
``parameter_count`` is ``None`` for a sub flow function, which has no definition
|
|
30
|
+
declaring its parameters, so every parameter of the request is passed through.
|
|
31
|
+
"""
|
|
32
|
+
|
|
33
|
+
handler: Callable[..., object]
|
|
34
|
+
parameter_count: Optional[int] = None
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def _now_micros() -> int:
|
|
38
|
+
return time.time_ns() // 1000
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def _resolve_target(action, identifier: str) -> Optional[_ExecutionTarget]:
|
|
42
|
+
func = action.runtime_functions.get(identifier)
|
|
43
|
+
if func is not None:
|
|
44
|
+
return _ExecutionTarget(func.handler, len(func.parameters or []))
|
|
45
|
+
|
|
46
|
+
sub_flow_function = action.sub_flow_functions.get(identifier)
|
|
47
|
+
if sub_flow_function is not None:
|
|
48
|
+
return _ExecutionTarget(sub_flow_function.run)
|
|
49
|
+
|
|
50
|
+
return None
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def _build_params(action, execution, target: _ExecutionTarget):
|
|
54
|
+
count = (
|
|
55
|
+
target.parameter_count
|
|
56
|
+
if target.parameter_count is not None
|
|
57
|
+
else len(execution.parameters)
|
|
58
|
+
)
|
|
59
|
+
params = []
|
|
60
|
+
for index in range(count):
|
|
61
|
+
field = execution.parameters[index] if index < len(execution.parameters) else None
|
|
62
|
+
params.append(resolve_node_value(action, field))
|
|
63
|
+
return params
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
def _wants_context(handler, param_count: int) -> bool:
|
|
67
|
+
try:
|
|
68
|
+
sig = inspect.signature(handler)
|
|
69
|
+
except (TypeError, ValueError):
|
|
70
|
+
return False
|
|
71
|
+
positional = [
|
|
72
|
+
p
|
|
73
|
+
for p in sig.parameters.values()
|
|
74
|
+
if p.kind in (p.POSITIONAL_ONLY, p.POSITIONAL_OR_KEYWORD)
|
|
75
|
+
]
|
|
76
|
+
# A `*args` handler has no fixed positionals and never gets a context.
|
|
77
|
+
return len(positional) == param_count + 1
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
def _to_node_value(action, value) -> execution_result_pb2.NodeValueExecutionResult:
|
|
81
|
+
"""Wrap a handler's return value in a ``NodeValueExecutionResult``.
|
|
82
|
+
|
|
83
|
+
Raw data goes out as a value; a returned sub flow function is registered on the
|
|
84
|
+
action and reported as a ``SubFlowFunctionResult`` so the flow can invoke it later.
|
|
85
|
+
"""
|
|
86
|
+
definition = as_sub_flow_function_definition(value)
|
|
87
|
+
if definition is not None:
|
|
88
|
+
return execution_result_pb2.NodeValueExecutionResult(
|
|
89
|
+
sub_flow_function_result=build_sub_flow_function_result(action, definition)
|
|
90
|
+
)
|
|
91
|
+
return execution_result_pb2.NodeValueExecutionResult(
|
|
92
|
+
raw_value=construct_value(value if value is not None else None)
|
|
93
|
+
)
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
def handle(action, execution) -> None:
|
|
97
|
+
action.emit(CodeZeroEvent.execution_request_received, execution)
|
|
98
|
+
|
|
99
|
+
target = _resolve_target(action, execution.function_identifier)
|
|
100
|
+
if target is None:
|
|
101
|
+
if action.is_sub_flow_function_identifier(execution.function_identifier):
|
|
102
|
+
# A sub flow function this action returned earlier, whose maximum
|
|
103
|
+
# lifetime has passed (or which was deleted). Fail the node rather than
|
|
104
|
+
# staying silent, so the flow does not wait for a result that cannot come.
|
|
105
|
+
asyncio.ensure_future(
|
|
106
|
+
_send_error(
|
|
107
|
+
action,
|
|
108
|
+
execution,
|
|
109
|
+
RuntimeError(
|
|
110
|
+
"SUB_FLOW_FUNCTION_EXPIRED",
|
|
111
|
+
f"Sub flow function {execution.function_identifier} is no "
|
|
112
|
+
f"longer registered: its maximum lifetime has passed",
|
|
113
|
+
),
|
|
114
|
+
_now_micros(),
|
|
115
|
+
)
|
|
116
|
+
)
|
|
117
|
+
return
|
|
118
|
+
print("Received execution request for unknown function:", execution.function_identifier)
|
|
119
|
+
return
|
|
120
|
+
|
|
121
|
+
params = _build_params(action, execution, target)
|
|
122
|
+
|
|
123
|
+
conf = action.configs.get(execution.project_id) or ProjectConfiguration(
|
|
124
|
+
project_id=0,
|
|
125
|
+
config_values=[],
|
|
126
|
+
find_config=lambda identifier: None,
|
|
127
|
+
)
|
|
128
|
+
|
|
129
|
+
from hercules.types import FunctionContext
|
|
130
|
+
|
|
131
|
+
context = FunctionContext(
|
|
132
|
+
project_id=execution.project_id,
|
|
133
|
+
execution_id=execution.execution_identifier,
|
|
134
|
+
matched_config=conf,
|
|
135
|
+
execute_flow=lambda flow_id, payload=None: action.execute_flow(flow_id, payload),
|
|
136
|
+
)
|
|
137
|
+
|
|
138
|
+
started_at = _now_micros()
|
|
139
|
+
handler = target.handler
|
|
140
|
+
all_params = (
|
|
141
|
+
[context, *params] if _wants_context(handler, len(params)) else params
|
|
142
|
+
)
|
|
143
|
+
|
|
144
|
+
asyncio.ensure_future(_run(action, execution, handler, all_params, started_at))
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
async def _run(action, execution, handler, all_params, started_at) -> None:
|
|
148
|
+
try:
|
|
149
|
+
value = handler(*all_params)
|
|
150
|
+
if inspect.isawaitable(value):
|
|
151
|
+
value = await value
|
|
152
|
+
finished_at = _now_micros()
|
|
153
|
+
request = action_pb2.ActionTransferRequest(
|
|
154
|
+
result=action_pb2.ActionExecutionResponse(
|
|
155
|
+
execution_identifier=execution.execution_identifier,
|
|
156
|
+
node_result=execution_result_pb2.NodeExecutionResult(
|
|
157
|
+
started_at=started_at,
|
|
158
|
+
finished_at=finished_at,
|
|
159
|
+
parameter_results=[],
|
|
160
|
+
success=_to_node_value(action, value),
|
|
161
|
+
),
|
|
162
|
+
)
|
|
163
|
+
)
|
|
164
|
+
await action.send(request)
|
|
165
|
+
except Exception as error: # noqa: BLE001
|
|
166
|
+
await _send_error(action, execution, error, started_at)
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
async def _send_error(action, execution, error, started_at) -> None:
|
|
170
|
+
"""Report a failed execution back to Aquila."""
|
|
171
|
+
finished_at = _now_micros()
|
|
172
|
+
is_runtime_error = isinstance(error, RuntimeError)
|
|
173
|
+
proto_error = errors_pb2.Error(
|
|
174
|
+
code=error.code if is_runtime_error else "UNKNOWN_ERROR",
|
|
175
|
+
category="RUNTIME",
|
|
176
|
+
message=(error.description or str(error)) if is_runtime_error else str(error),
|
|
177
|
+
timestamp=finished_at,
|
|
178
|
+
version=action.version,
|
|
179
|
+
)
|
|
180
|
+
request = action_pb2.ActionTransferRequest(
|
|
181
|
+
result=action_pb2.ActionExecutionResponse(
|
|
182
|
+
execution_identifier=execution.execution_identifier,
|
|
183
|
+
node_result=execution_result_pb2.NodeExecutionResult(
|
|
184
|
+
started_at=started_at,
|
|
185
|
+
finished_at=finished_at,
|
|
186
|
+
parameter_results=[],
|
|
187
|
+
error=proto_error,
|
|
188
|
+
),
|
|
189
|
+
)
|
|
190
|
+
)
|
|
191
|
+
try:
|
|
192
|
+
await action.send(request)
|
|
193
|
+
except Exception as err: # noqa: BLE001
|
|
194
|
+
print("Failed to send execution error:", err)
|
|
@@ -133,6 +133,16 @@ def pydantic_to_type_string(model: SchemaModel) -> str:
|
|
|
133
133
|
return json_schema_to_ts(resolved, name)
|
|
134
134
|
|
|
135
135
|
|
|
136
|
+
def pydantic_to_json_schema(model: SchemaModel, mode: str) -> Dict[str, Any]:
|
|
137
|
+
"""Convert a Pydantic model into a plain JSON schema dict.
|
|
138
|
+
|
|
139
|
+
``mode`` picks which side of the model is described: ``"validation"`` for the
|
|
140
|
+
input it accepts, ``"serialization"`` for the output it produces (the Python
|
|
141
|
+
counterpart of the TypeScript SDK's zod ``io`` option).
|
|
142
|
+
"""
|
|
143
|
+
return model.model_json_schema(mode=mode)
|
|
144
|
+
|
|
145
|
+
|
|
136
146
|
def pydantic_to_rules(model: SchemaModel) -> List[data_type_pb2.DefinitionDataTypeRule]:
|
|
137
147
|
schema = model.model_json_schema()
|
|
138
148
|
rules: List[data_type_pb2.DefinitionDataTypeRule] = []
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"""Sub flow function support (port of ``src/internal/sub-flow-function.ts``).
|
|
2
|
+
|
|
3
|
+
A runtime function's ``run`` may return a sub flow function instead of raw data.
|
|
4
|
+
Hercules registers it on the action and reports it to Aquila as a
|
|
5
|
+
``shared.SubFlowFunctionResult``, which the flow can then invoke like any sub flow.
|
|
6
|
+
"""
|
|
7
|
+
from __future__ import annotations
|
|
8
|
+
|
|
9
|
+
from typing import Mapping, Optional
|
|
10
|
+
|
|
11
|
+
from pydantic import BaseModel
|
|
12
|
+
|
|
13
|
+
from hercules._tucana.helpers import construct_value
|
|
14
|
+
from hercules.internal.schema import pydantic_to_json_schema
|
|
15
|
+
from hercules.types import (
|
|
16
|
+
RuntimeError,
|
|
17
|
+
SubFlowFunctionDefinition,
|
|
18
|
+
SubFlowFunctionSchema,
|
|
19
|
+
)
|
|
20
|
+
from tucana.generated.shared import execution_result_pb2, flow_pb2, struct_pb2
|
|
21
|
+
|
|
22
|
+
__all__ = ["as_sub_flow_function_definition", "build_sub_flow_function_result", "to_struct"]
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def as_sub_flow_function_definition(value) -> Optional[SubFlowFunctionDefinition]:
|
|
26
|
+
"""Return ``value`` as a definition if ``run`` returned a sub flow function.
|
|
27
|
+
|
|
28
|
+
A sub flow function is told apart from raw data by its callable ``run``, which a
|
|
29
|
+
plain value never carries. Both a :class:`SubFlowFunctionDefinition` and a plain
|
|
30
|
+
mapping with the same keys are accepted.
|
|
31
|
+
"""
|
|
32
|
+
if isinstance(value, SubFlowFunctionDefinition):
|
|
33
|
+
return value
|
|
34
|
+
if isinstance(value, Mapping) and callable(value.get("run")):
|
|
35
|
+
return SubFlowFunctionDefinition(
|
|
36
|
+
name=value.get("name"),
|
|
37
|
+
description=value.get("description") or "",
|
|
38
|
+
input_schema=value.get("input_schema") or {},
|
|
39
|
+
output_schema=value.get("output_schema") or {},
|
|
40
|
+
run=value["run"],
|
|
41
|
+
)
|
|
42
|
+
return None
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def _is_model(schema) -> bool:
|
|
46
|
+
return isinstance(schema, type) and issubclass(schema, BaseModel)
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def to_struct(schema: Optional[SubFlowFunctionSchema], mode: str) -> struct_pb2.Struct:
|
|
50
|
+
"""Convert a declared schema into the ``shared.Struct`` the protobuf field expects.
|
|
51
|
+
|
|
52
|
+
A Pydantic model becomes a JSON schema first: ``mode`` is ``"validation"`` for a
|
|
53
|
+
function's input schema (what it accepts) and ``"serialization"`` for its output
|
|
54
|
+
schema (what it produces).
|
|
55
|
+
"""
|
|
56
|
+
if isinstance(schema, struct_pb2.Struct):
|
|
57
|
+
return schema
|
|
58
|
+
if _is_model(schema):
|
|
59
|
+
return construct_value(pydantic_to_json_schema(schema, mode)).struct_value
|
|
60
|
+
return construct_value(schema or {}).struct_value
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
def build_sub_flow_function_result(
|
|
64
|
+
action, definition: SubFlowFunctionDefinition
|
|
65
|
+
) -> execution_result_pb2.SubFlowFunctionResult:
|
|
66
|
+
"""Register the sub flow function and build the result reported back to Aquila.
|
|
67
|
+
|
|
68
|
+
The identifier in the result is the one Aquila sends back on an execution request
|
|
69
|
+
when the flow invokes the function.
|
|
70
|
+
"""
|
|
71
|
+
if not definition.name:
|
|
72
|
+
raise RuntimeError(
|
|
73
|
+
"SUB_FLOW_FUNCTION_MISSING_NAME",
|
|
74
|
+
"A sub flow function returned from a run block must declare a name",
|
|
75
|
+
)
|
|
76
|
+
function_identifier = action.register_sub_flow_function(definition)
|
|
77
|
+
return execution_result_pb2.SubFlowFunctionResult(
|
|
78
|
+
function=flow_pb2.SubFlowFunction(
|
|
79
|
+
function_identifier=function_identifier,
|
|
80
|
+
definition_source="action",
|
|
81
|
+
),
|
|
82
|
+
name=definition.name,
|
|
83
|
+
description=definition.description or "",
|
|
84
|
+
input_schema=to_struct(definition.input_schema, "validation"),
|
|
85
|
+
output_schema=to_struct(definition.output_schema, "serialization"),
|
|
86
|
+
)
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"""Sub flow function manager (port of ``src/manager/SubFlowFunctionManager.ts``)."""
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
import asyncio
|
|
5
|
+
import time
|
|
6
|
+
from typing import Dict, Optional
|
|
7
|
+
|
|
8
|
+
from hercules.manager.base import BaseManager
|
|
9
|
+
|
|
10
|
+
#: How long a returned sub flow function stays in memory and invocable: 30 minutes.
|
|
11
|
+
SUB_FLOW_FUNCTION_TTL_SECONDS = 30 * 60
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class SubFlowFunctionManager(BaseManager):
|
|
15
|
+
"""Sub flow functions a runtime function returned at execution time.
|
|
16
|
+
|
|
17
|
+
Keyed by the identifier reported to Aquila. Unlike the other managers this one is
|
|
18
|
+
not filled by registering classes up front: entries appear while the action runs
|
|
19
|
+
(see :meth:`hercules.action.Action.register_sub_flow_function`).
|
|
20
|
+
|
|
21
|
+
Each entry has a maximum lifetime of :data:`SUB_FLOW_FUNCTION_TTL_SECONDS`,
|
|
22
|
+
counted from when it was registered and never extended by an invocation, so a flow
|
|
23
|
+
that holds a function forever cannot grow the registry without bound. Expired
|
|
24
|
+
entries are dropped by a sweep scheduled for the next expiry, and on any read or
|
|
25
|
+
write, so an expired function is never invoked even if the sweep could not run
|
|
26
|
+
(there is no running event loop to schedule it on, for instance).
|
|
27
|
+
"""
|
|
28
|
+
|
|
29
|
+
def __init__(self, ttl_seconds: float = SUB_FLOW_FUNCTION_TTL_SECONDS) -> None:
|
|
30
|
+
super().__init__()
|
|
31
|
+
self._ttl_seconds = ttl_seconds
|
|
32
|
+
# Expiry per key. Insertion order is expiry order, since the TTL is fixed.
|
|
33
|
+
self._expiries: Dict[str, float] = {}
|
|
34
|
+
self._sweep_handle: Optional[asyncio.TimerHandle] = None
|
|
35
|
+
|
|
36
|
+
@staticmethod
|
|
37
|
+
def _now() -> float:
|
|
38
|
+
# Monotonic, so a system clock change cannot postpone or trigger an expiry.
|
|
39
|
+
return time.monotonic()
|
|
40
|
+
|
|
41
|
+
def set(self, key, value):
|
|
42
|
+
# Re-insert the expiry so a replaced key moves to the back and the dict stays
|
|
43
|
+
# ordered by expiry.
|
|
44
|
+
self._expiries.pop(key, None)
|
|
45
|
+
super().set(key, value)
|
|
46
|
+
self._expiries[key] = self._now() + self._ttl_seconds
|
|
47
|
+
self.prune()
|
|
48
|
+
return self
|
|
49
|
+
|
|
50
|
+
def get(self, key):
|
|
51
|
+
self.prune()
|
|
52
|
+
return super().get(key)
|
|
53
|
+
|
|
54
|
+
def has(self, key) -> bool:
|
|
55
|
+
self.prune()
|
|
56
|
+
return super().has(key)
|
|
57
|
+
|
|
58
|
+
def delete(self, key) -> bool:
|
|
59
|
+
self._expiries.pop(key, None)
|
|
60
|
+
deleted = super().delete(key)
|
|
61
|
+
self._schedule_sweep(self._now())
|
|
62
|
+
return deleted
|
|
63
|
+
|
|
64
|
+
def clear(self) -> None:
|
|
65
|
+
self._expiries.clear()
|
|
66
|
+
super().clear()
|
|
67
|
+
self._schedule_sweep(self._now())
|
|
68
|
+
|
|
69
|
+
def prune(self, now: Optional[float] = None) -> None:
|
|
70
|
+
"""Drop every entry whose lifetime has passed, then schedule the next sweep."""
|
|
71
|
+
if now is None:
|
|
72
|
+
now = self._now()
|
|
73
|
+
for key, expires_at in list(self._expiries.items()):
|
|
74
|
+
# Ordered by expiry, so the first entry still alive ends the sweep.
|
|
75
|
+
if expires_at > now:
|
|
76
|
+
break
|
|
77
|
+
del self._expiries[key]
|
|
78
|
+
super().delete(key)
|
|
79
|
+
self._schedule_sweep(now)
|
|
80
|
+
|
|
81
|
+
def _schedule_sweep(self, now: float) -> None:
|
|
82
|
+
if self._sweep_handle is not None:
|
|
83
|
+
self._sweep_handle.cancel()
|
|
84
|
+
self._sweep_handle = None
|
|
85
|
+
next_expiry = next(iter(self._expiries.values()), None)
|
|
86
|
+
if next_expiry is None:
|
|
87
|
+
return
|
|
88
|
+
try:
|
|
89
|
+
loop = asyncio.get_running_loop()
|
|
90
|
+
except RuntimeError:
|
|
91
|
+
# No loop to schedule on; pruning on the next read or write still applies.
|
|
92
|
+
return
|
|
93
|
+
self._sweep_handle = loop.call_later(max(0.0, next_expiry - now), self.prune)
|
|
@@ -2,11 +2,16 @@
|
|
|
2
2
|
from __future__ import annotations
|
|
3
3
|
|
|
4
4
|
from dataclasses import dataclass
|
|
5
|
-
from typing import Callable, List, Optional
|
|
5
|
+
from typing import Callable, List, Optional, Union
|
|
6
6
|
|
|
7
7
|
from hercules._tucana.helpers import PlainValue
|
|
8
8
|
from hercules.models.function import FunctionParameterProps
|
|
9
|
-
from hercules.types import Translation
|
|
9
|
+
from hercules.types import SubFlowFunctionDefinition, Translation
|
|
10
|
+
|
|
11
|
+
#: What a runtime function's ``run`` may produce: raw data, or a
|
|
12
|
+
#: :class:`~hercules.types.SubFlowFunctionDefinition` that Hercules registers and
|
|
13
|
+
#: reports to Aquila as a ``shared.SubFlowFunctionResult``.
|
|
14
|
+
RuntimeFunctionReturn = Union[PlainValue, SubFlowFunctionDefinition]
|
|
10
15
|
|
|
11
16
|
|
|
12
17
|
class RuntimeFunctionRunnable:
|
|
@@ -20,7 +25,7 @@ class RuntimeFunctionRunnable:
|
|
|
20
25
|
class RuntimeFunctionProps:
|
|
21
26
|
runtime_name: str
|
|
22
27
|
signature: str
|
|
23
|
-
handler: Callable[...,
|
|
28
|
+
handler: Callable[..., RuntimeFunctionReturn]
|
|
24
29
|
parameters: Optional[List[FunctionParameterProps]] = None
|
|
25
30
|
throws_error: Optional[bool] = None
|
|
26
31
|
name: Optional[List[Translation]] = None
|
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
from __future__ import annotations
|
|
3
3
|
|
|
4
4
|
from dataclasses import dataclass, field
|
|
5
|
-
from typing import Any, Awaitable, Callable, List, Optional, Protocol, Union
|
|
5
|
+
from typing import Any, Awaitable, Callable, List, Optional, Protocol, Type, Union
|
|
6
|
+
|
|
7
|
+
from pydantic import BaseModel
|
|
6
8
|
|
|
7
9
|
from hercules._tucana.helpers import PlainValue
|
|
8
10
|
from tucana.generated.shared.flow_type_pb2 import FlowTypeSetting
|
|
@@ -20,6 +22,8 @@ __all__ = [
|
|
|
20
22
|
"RuntimeFlowTypeSetting_UniquenessScope",
|
|
21
23
|
"Translation",
|
|
22
24
|
"SubFlow",
|
|
25
|
+
"SubFlowFunctionSchema",
|
|
26
|
+
"SubFlowFunctionDefinition",
|
|
23
27
|
"FunctionContext",
|
|
24
28
|
"ProjectConfiguration",
|
|
25
29
|
"ConfigurationDefinition",
|
|
@@ -48,6 +52,40 @@ class SubFlow(Protocol):
|
|
|
48
52
|
def __call__(self, *args: PlainValue) -> Awaitable[PlainValue]: ...
|
|
49
53
|
|
|
50
54
|
|
|
55
|
+
#: Describes a sub flow function's input or output. Normally a Pydantic model, which
|
|
56
|
+
#: is converted to a JSON schema while the result is sent (the counterpart of the
|
|
57
|
+
#: TypeScript SDK's zod schemas). A plain JSON schema dict or a ready-made ``Struct``
|
|
58
|
+
#: (e.g. one taken from a :class:`SubFlow`) is passed through unchanged.
|
|
59
|
+
SubFlowFunctionSchema = Union[Type[BaseModel], Struct, dict]
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
@dataclass
|
|
63
|
+
class SubFlowFunctionDefinition:
|
|
64
|
+
"""A sub flow function returned from a runtime function's ``run`` in place of raw data.
|
|
65
|
+
|
|
66
|
+
Hercules registers :attr:`run` internally and reports the function to Aquila as a
|
|
67
|
+
``shared.SubFlowFunctionResult``, so the flow can invoke it later like any other
|
|
68
|
+
sub flow. Name, description and I/O schema have to be declared here, because
|
|
69
|
+
nothing in the action's module definition describes a function created at runtime.
|
|
70
|
+
|
|
71
|
+
May also be returned as a plain dict with the same keys::
|
|
72
|
+
|
|
73
|
+
return SubFlowFunctionDefinition(
|
|
74
|
+
name="greet",
|
|
75
|
+
description="Greets a name",
|
|
76
|
+
input_schema=GreetInput,
|
|
77
|
+
output_schema=GreetOutput,
|
|
78
|
+
run=lambda name: f"Hello {name}",
|
|
79
|
+
)
|
|
80
|
+
"""
|
|
81
|
+
|
|
82
|
+
name: str
|
|
83
|
+
description: str
|
|
84
|
+
input_schema: SubFlowFunctionSchema
|
|
85
|
+
output_schema: SubFlowFunctionSchema
|
|
86
|
+
run: Callable[..., Any]
|
|
87
|
+
|
|
88
|
+
|
|
51
89
|
@dataclass
|
|
52
90
|
class ProjectConfiguration:
|
|
53
91
|
project_id: int
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "code0-hercules"
|
|
7
|
-
version = "1.
|
|
7
|
+
version = "1.7.0"
|
|
8
8
|
description = "Python SDK for the hercules action runner"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.10"
|
|
@@ -12,7 +12,7 @@ license = "MIT"
|
|
|
12
12
|
dependencies = [
|
|
13
13
|
"grpcio>=1.64",
|
|
14
14
|
"protobuf>=5.0",
|
|
15
|
-
"tucana>=0.0.
|
|
15
|
+
"tucana>=0.0.83",
|
|
16
16
|
"pydantic>=2",
|
|
17
17
|
]
|
|
18
18
|
|