From e3fa1aad91c96a480983b79951ba7e4b0fd03e47 Mon Sep 17 00:00:00 2001 From: Ajeet Prabu Date: Mon, 10 Aug 2026 18:15:37 +0100 Subject: [PATCH 1/2] feat: add randomize to @func_latency_control Expose latencyControl.randomize on the ADK decorator so projects can opt into shuffling delay responses per call via push/pull. Co-authored-by: Cursor --- docs/docs/reference/functions.md | 4 ++ src/poly/docs/functions.md | 2 + src/poly/handlers/protobuf/functions_pb2.py | 2 +- src/poly/handlers/protobuf/functions_pb2.pyi | 18 ++++-- src/poly/resources/function.py | 11 ++++ src/poly/tests/resources_test.py | 57 +++++++++++++++++++ .../test_project/_gen/decorators.py | 5 ++ src/poly/utils/decorators.py | 5 ++ 8 files changed, 97 insertions(+), 7 deletions(-) diff --git a/docs/docs/reference/functions.md b/docs/docs/reference/functions.md index 948dac00..9a9e232f 100644 --- a/docs/docs/reference/functions.md +++ b/docs/docs/reference/functions.md @@ -103,6 +103,10 @@ Global and transition functions use decorators to describe themselves to the mod | `@func_parameter("name", "...")` | Describes a parameter | | `@func_latency_control(...)` | Configures delay messaging while the function runs | +`@func_latency_control` accepts `delay_before_responses_start`, `silence_after_each_response`, +`delay_responses`, and optional `randomize=True` to shuffle delay response order on each +function invocation (timing slots are preserved). + Function steps do not support `@func_description` or `@func_parameter`. !!! warning "All parameters must have a type annotation and no default value" diff --git a/src/poly/docs/functions.md b/src/poly/docs/functions.md index 3acb17e9..15c8faf7 100644 --- a/src/poly/docs/functions.md +++ b/src/poly/docs/functions.md @@ -40,6 +40,8 @@ flows/{flow_name}/ - **`@func_description('...')`** (required for global and transition functions): Description shown to the LLM to decide when to call the function. - **`@func_parameter('param_name', '...')`** (required for each parameter except `conv` and `flow`): Description of the parameter shown to the LLM. All parameters must also have a typed Python annotation (e.g. `booking_ref: str`) - **`@func_latency_control(...)`** (optional): Configure delay messages while the function runs. + Supports `delay_before_responses_start`, `silence_after_each_response`, `delay_responses`, and + `randomize` (shuffle delay response order on each invocation; default `False`). Function steps do not support `@func_parameter` or `@func_description`. diff --git a/src/poly/handlers/protobuf/functions_pb2.py b/src/poly/handlers/protobuf/functions_pb2.py index dc893a7b..87f3290a 100644 --- a/src/poly/handlers/protobuf/functions_pb2.py +++ b/src/poly/handlers/protobuf/functions_pb2.py @@ -15,7 +15,7 @@ from google.protobuf import timestamp_pb2 as google_dot_protobuf_dot_timestamp__pb2 -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x0f\x66unctions.proto\x12\tfunctions\x1a\x1fgoogle/protobuf/timestamp.proto\"\xd8\x01\n\x11\x46unctionParameter\x12\n\n\x02id\x18\x01 \x01(\t\x12\x0c\n\x04name\x18\x02 \x01(\t\x12\x13\n\x0b\x64\x65scription\x18\x03 \x01(\t\x12\x0c\n\x04type\x18\x04 \x01(\t\x12.\n\ncreated_at\x18\x05 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x12\n\ncreated_by\x18\x06 \x01(\t\x12.\n\nupdated_at\x18\x07 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x12\n\nupdated_by\x18\x08 \x01(\t\">\n\rFunctionError\x12\x0e\n\x06lineno\x18\x01 \x01(\x05\x12\x0f\n\x07message\x18\x02 \x01(\t\x12\x0c\n\x04text\x18\x03 \x01(\t\"\xaa\x02\n\x1f\x46unctionDelayResponseReferences\x12L\n\tvariables\x18\x01 \x03(\x0b\x32\x39.functions.FunctionDelayResponseReferences.VariablesEntry\x12R\n\x0ctranslations\x18\x02 \x03(\x0b\x32<.functions.FunctionDelayResponseReferences.TranslationsEntry\x1a\x30\n\x0eVariablesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\x08:\x02\x38\x01\x1a\x33\n\x11TranslationsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\x08:\x02\x38\x01\"\xa2\x02\n\x15\x46unctionDelayResponse\x12\n\n\x02id\x18\x01 \x01(\t\x12\x0f\n\x07message\x18\x02 \x01(\t\x12\x10\n\x08\x64uration\x18\x03 \x01(\x05\x12.\n\ncreated_at\x18\x04 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x12\n\ncreated_by\x18\x05 \x01(\t\x12.\n\nupdated_at\x18\x06 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x12\n\nupdated_by\x18\x07 \x01(\t\x12\x43\n\nreferences\x18\x08 \x01(\x0b\x32*.functions.FunctionDelayResponseReferencesH\x00\x88\x01\x01\x42\r\n\x0b_references\"\x95\x02\n\x16\x46unctionLatencyControl\x12\x0f\n\x07\x65nabled\x18\x01 \x01(\x08\x12\x39\n\x0f\x64\x65lay_responses\x18\x02 \x03(\x0b\x32 .functions.FunctionDelayResponse\x12\x15\n\rinitial_delay\x18\x03 \x01(\x05\x12\x10\n\x08interval\x18\x04 \x01(\x05\x12.\n\ncreated_at\x18\x05 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x12\n\ncreated_by\x18\x06 \x01(\t\x12.\n\nupdated_at\x18\x07 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x12\n\nupdated_by\x18\x08 \x01(\t\"\xd5\x04\n\x12\x46unctionReferences\x12@\n\nflow_steps\x18\x01 \x03(\x0b\x32,.functions.FunctionReferences.FlowStepsEntry\x12\x39\n\x06topics\x18\x02 \x03(\x0b\x32).functions.FunctionReferences.TopicsEntry\x12\x46\n\rstop_keywords\x18\x03 \x03(\x0b\x32/.functions.FunctionReferences.StopKeywordsEntry\x12?\n\tbehaviour\x18\x04 \x03(\x0b\x32,.functions.FunctionReferences.BehaviourEntry\x12?\n\tvariables\x18\x05 \x03(\x0b\x32,.functions.FunctionReferences.VariablesEntry\x1a\x30\n\x0e\x46lowStepsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\x08:\x02\x38\x01\x1a-\n\x0bTopicsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\x08:\x02\x38\x01\x1a\x33\n\x11StopKeywordsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\x08:\x02\x38\x01\x1a\x30\n\x0e\x42\x65haviourEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\x08:\x02\x38\x01\x1a\x30\n\x0eVariablesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\x08:\x02\x38\x01\"\xac\x03\n\x08\x46unction\x12\n\n\x02id\x18\x01 \x01(\t\x12\x0c\n\x04name\x18\x02 \x01(\t\x12\x13\n\x0b\x64\x65scription\x18\x03 \x01(\t\x12\x30\n\nparameters\x18\x04 \x03(\x0b\x32\x1c.functions.FunctionParameter\x12\x0c\n\x04\x63ode\x18\x05 \x01(\t\x12(\n\x06\x65rrors\x18\x06 \x03(\x0b\x32\x18.functions.FunctionError\x12:\n\x0flatency_control\x18\x07 \x01(\x0b\x32!.functions.FunctionLatencyControl\x12.\n\ncreated_at\x18\x08 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x12\n\ncreated_by\x18\t \x01(\t\x12.\n\nupdated_at\x18\n \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x12\n\nupdated_by\x18\x0b \x01(\t\x12\x10\n\x08\x61rchived\x18\x0c \x01(\x08\x12\x31\n\nreferences\x18\r \x01(\x0b\x32\x1d.functions.FunctionReferences\"3\n\tFunctions\x12&\n\tfunctions\x18\x01 \x03(\x0b\x32\x13.functions.Function\"V\n\x17\x46unctionParameterUpdate\x12\n\n\x02id\x18\x01 \x01(\t\x12\x0c\n\x04name\x18\x02 \x01(\t\x12\x13\n\x0b\x64\x65scription\x18\x03 \x01(\t\x12\x0c\n\x04type\x18\x04 \x01(\t\"\x93\x01\n\x1c\x46unctionCreateLatencyControl\x12\x0f\n\x07\x65nabled\x18\x01 \x01(\x08\x12\x39\n\x0f\x64\x65lay_responses\x18\x02 \x03(\x0b\x32 .functions.FunctionDelayResponse\x12\x15\n\rinitial_delay\x18\x03 \x01(\x05\x12\x10\n\x08interval\x18\x04 \x01(\x05\"\xfe\x02\n\x17\x46unction_CreateFunction\x12\n\n\x02id\x18\x01 \x01(\t\x12\x0c\n\x04name\x18\x02 \x01(\t\x12\x13\n\x0b\x64\x65scription\x18\x03 \x01(\t\x12\x36\n\nparameters\x18\x04 \x03(\x0b\x32\".functions.FunctionParameterUpdate\x12\x0c\n\x04\x63ode\x18\x05 \x01(\t\x12(\n\x06\x65rrors\x18\x06 \x03(\x0b\x32\x18.functions.FunctionError\x12\x45\n\x0flatency_control\x18\x07 \x01(\x0b\x32\'.functions.FunctionCreateLatencyControlH\x00\x88\x01\x01\x12\x36\n\nreferences\x18\x08 \x01(\x0b\x32\x1d.functions.FunctionReferencesH\x01\x88\x01\x01\x12\x15\n\x08\x61rchived\x18\t \x01(\x08H\x02\x88\x01\x01\x42\x12\n\x10_latency_controlB\r\n\x0b_referencesB\x0b\n\t_archived\"J\n\x10ParametersUpdate\x12\x36\n\nparameters\x18\x01 \x03(\x0b\x32\".functions.FunctionParameterUpdate\"8\n\x0c\x45rrorsUpdate\x12(\n\x06\x65rrors\x18\x01 \x03(\x0b\x32\x18.functions.FunctionError\"\xf0\x02\n\x17\x46unction_UpdateFunction\x12\n\n\x02id\x18\x01 \x01(\t\x12\x11\n\x04name\x18\x02 \x01(\tH\x00\x88\x01\x01\x12\x18\n\x0b\x64\x65scription\x18\x03 \x01(\tH\x01\x88\x01\x01\x12\x34\n\nparameters\x18\x04 \x01(\x0b\x32\x1b.functions.ParametersUpdateH\x02\x88\x01\x01\x12\x11\n\x04\x63ode\x18\x05 \x01(\tH\x03\x88\x01\x01\x12,\n\x06\x65rrors\x18\x06 \x01(\x0b\x32\x17.functions.ErrorsUpdateH\x04\x88\x01\x01\x12\x36\n\nreferences\x18\x07 \x01(\x0b\x32\x1d.functions.FunctionReferencesH\x05\x88\x01\x01\x12\x15\n\x08\x61rchived\x18\x08 \x01(\x08H\x06\x88\x01\x01\x42\x07\n\x05_nameB\x0e\n\x0c_descriptionB\r\n\x0b_parametersB\x07\n\x05_codeB\t\n\x07_errorsB\r\n\x0b_referencesB\x0b\n\t_archived\"%\n\x17\x46unction_DeleteFunction\x12\n\n\x02id\x18\x01 \x01(\t\"\x98\x01\n\x13\x44\x65layResponseUpdate\x12\n\n\x02id\x18\x01 \x01(\t\x12\x0f\n\x07message\x18\x02 \x01(\t\x12\x10\n\x08\x64uration\x18\x03 \x01(\x05\x12\x43\n\nreferences\x18\x04 \x01(\x0b\x32*.functions.FunctionDelayResponseReferencesH\x00\x88\x01\x01\x42\r\n\x0b_references\"O\n\x14\x44\x65layResponsesUpdate\x12\x37\n\x0f\x64\x65lay_responses\x18\x01 \x03(\x0b\x32\x1e.functions.DelayResponseUpdate\"\xea\x01\n\x1d\x46unction_UpdateLatencyControl\x12\x13\n\x0b\x66unction_id\x18\x01 \x01(\t\x12\x0f\n\x07\x65nabled\x18\x02 \x01(\x08\x12=\n\x0f\x64\x65lay_responses\x18\x03 \x01(\x0b\x32\x1f.functions.DelayResponsesUpdateH\x00\x88\x01\x01\x12\x1a\n\rinitial_delay\x18\x04 \x01(\x05H\x01\x88\x01\x01\x12\x15\n\x08interval\x18\x05 \x01(\x05H\x02\x88\x01\x01\x42\x12\n\x10_delay_responsesB\x10\n\x0e_initial_delayB\x0b\n\t_intervalb\x06proto3') +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x0ffunctions.proto\x12\tfunctions\x1a\x1fgoogle/protobuf/timestamp.proto"\xd8\x01\n\x11FunctionParameter\x12\n\n\x02id\x18\x01 \x01(\t\x12\x0c\n\x04name\x18\x02 \x01(\t\x12\x13\n\x0bdescription\x18\x03 \x01(\t\x12\x0c\n\x04type\x18\x04 \x01(\t\x12.\n\ncreated_at\x18\x05 \x01(\x0b2\x1a.google.protobuf.Timestamp\x12\x12\n\ncreated_by\x18\x06 \x01(\t\x12.\n\nupdated_at\x18\x07 \x01(\x0b2\x1a.google.protobuf.Timestamp\x12\x12\n\nupdated_by\x18\x08 \x01(\t">\n\rFunctionError\x12\x0e\n\x06lineno\x18\x01 \x01(\x05\x12\x0f\n\x07message\x18\x02 \x01(\t\x12\x0c\n\x04text\x18\x03 \x01(\t"\xaa\x02\n\x1fFunctionDelayResponseReferences\x12L\n\tvariables\x18\x01 \x03(\x0b29.functions.FunctionDelayResponseReferences.VariablesEntry\x12R\n\x0ctranslations\x18\x02 \x03(\x0b2<.functions.FunctionDelayResponseReferences.TranslationsEntry\x1a0\n\x0eVariablesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\x08:\x028\x01\x1a3\n\x11TranslationsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\x08:\x028\x01"\xa2\x02\n\x15FunctionDelayResponse\x12\n\n\x02id\x18\x01 \x01(\t\x12\x0f\n\x07message\x18\x02 \x01(\t\x12\x10\n\x08duration\x18\x03 \x01(\x05\x12.\n\ncreated_at\x18\x04 \x01(\x0b2\x1a.google.protobuf.Timestamp\x12\x12\n\ncreated_by\x18\x05 \x01(\t\x12.\n\nupdated_at\x18\x06 \x01(\x0b2\x1a.google.protobuf.Timestamp\x12\x12\n\nupdated_by\x18\x07 \x01(\t\x12C\n\nreferences\x18\x08 \x01(\x0b2*.functions.FunctionDelayResponseReferencesH\x00\x88\x01\x01B\r\n\x0b_references"\xa8\x02\n\x16FunctionLatencyControl\x12\x0f\n\x07enabled\x18\x01 \x01(\x08\x129\n\x0fdelay_responses\x18\x02 \x03(\x0b2 .functions.FunctionDelayResponse\x12\x15\n\rinitial_delay\x18\x03 \x01(\x05\x12\x10\n\x08interval\x18\x04 \x01(\x05\x12.\n\ncreated_at\x18\x05 \x01(\x0b2\x1a.google.protobuf.Timestamp\x12\x12\n\ncreated_by\x18\x06 \x01(\t\x12.\n\nupdated_at\x18\x07 \x01(\x0b2\x1a.google.protobuf.Timestamp\x12\x12\n\nupdated_by\x18\x08 \x01(\t\x12\x11\n\trandomize\x18\t \x01(\x08"\xd5\x04\n\x12FunctionReferences\x12@\n\nflow_steps\x18\x01 \x03(\x0b2,.functions.FunctionReferences.FlowStepsEntry\x129\n\x06topics\x18\x02 \x03(\x0b2).functions.FunctionReferences.TopicsEntry\x12F\n\rstop_keywords\x18\x03 \x03(\x0b2/.functions.FunctionReferences.StopKeywordsEntry\x12?\n\tbehaviour\x18\x04 \x03(\x0b2,.functions.FunctionReferences.BehaviourEntry\x12?\n\tvariables\x18\x05 \x03(\x0b2,.functions.FunctionReferences.VariablesEntry\x1a0\n\x0eFlowStepsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\x08:\x028\x01\x1a-\n\x0bTopicsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\x08:\x028\x01\x1a3\n\x11StopKeywordsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\x08:\x028\x01\x1a0\n\x0eBehaviourEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\x08:\x028\x01\x1a0\n\x0eVariablesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\x08:\x028\x01"\xac\x03\n\x08Function\x12\n\n\x02id\x18\x01 \x01(\t\x12\x0c\n\x04name\x18\x02 \x01(\t\x12\x13\n\x0bdescription\x18\x03 \x01(\t\x120\n\nparameters\x18\x04 \x03(\x0b2\x1c.functions.FunctionParameter\x12\x0c\n\x04code\x18\x05 \x01(\t\x12(\n\x06errors\x18\x06 \x03(\x0b2\x18.functions.FunctionError\x12:\n\x0flatency_control\x18\x07 \x01(\x0b2!.functions.FunctionLatencyControl\x12.\n\ncreated_at\x18\x08 \x01(\x0b2\x1a.google.protobuf.Timestamp\x12\x12\n\ncreated_by\x18\t \x01(\t\x12.\n\nupdated_at\x18\n \x01(\x0b2\x1a.google.protobuf.Timestamp\x12\x12\n\nupdated_by\x18\x0b \x01(\t\x12\x10\n\x08archived\x18\x0c \x01(\x08\x121\n\nreferences\x18\r \x01(\x0b2\x1d.functions.FunctionReferences"3\n\tFunctions\x12&\n\tfunctions\x18\x01 \x03(\x0b2\x13.functions.Function"V\n\x17FunctionParameterUpdate\x12\n\n\x02id\x18\x01 \x01(\t\x12\x0c\n\x04name\x18\x02 \x01(\t\x12\x13\n\x0bdescription\x18\x03 \x01(\t\x12\x0c\n\x04type\x18\x04 \x01(\t"\xa6\x01\n\x1cFunctionCreateLatencyControl\x12\x0f\n\x07enabled\x18\x01 \x01(\x08\x129\n\x0fdelay_responses\x18\x02 \x03(\x0b2 .functions.FunctionDelayResponse\x12\x15\n\rinitial_delay\x18\x03 \x01(\x05\x12\x10\n\x08interval\x18\x04 \x01(\x05\x12\x11\n\trandomize\x18\x05 \x01(\x08"\xfe\x02\n\x17Function_CreateFunction\x12\n\n\x02id\x18\x01 \x01(\t\x12\x0c\n\x04name\x18\x02 \x01(\t\x12\x13\n\x0bdescription\x18\x03 \x01(\t\x126\n\nparameters\x18\x04 \x03(\x0b2".functions.FunctionParameterUpdate\x12\x0c\n\x04code\x18\x05 \x01(\t\x12(\n\x06errors\x18\x06 \x03(\x0b2\x18.functions.FunctionError\x12E\n\x0flatency_control\x18\x07 \x01(\x0b2\'.functions.FunctionCreateLatencyControlH\x00\x88\x01\x01\x126\n\nreferences\x18\x08 \x01(\x0b2\x1d.functions.FunctionReferencesH\x01\x88\x01\x01\x12\x15\n\x08archived\x18\t \x01(\x08H\x02\x88\x01\x01B\x12\n\x10_latency_controlB\r\n\x0b_referencesB\x0b\n\t_archived"J\n\x10ParametersUpdate\x126\n\nparameters\x18\x01 \x03(\x0b2".functions.FunctionParameterUpdate"8\n\x0cErrorsUpdate\x12(\n\x06errors\x18\x01 \x03(\x0b2\x18.functions.FunctionError"\xf0\x02\n\x17Function_UpdateFunction\x12\n\n\x02id\x18\x01 \x01(\t\x12\x11\n\x04name\x18\x02 \x01(\tH\x00\x88\x01\x01\x12\x18\n\x0bdescription\x18\x03 \x01(\tH\x01\x88\x01\x01\x124\n\nparameters\x18\x04 \x01(\x0b2\x1b.functions.ParametersUpdateH\x02\x88\x01\x01\x12\x11\n\x04code\x18\x05 \x01(\tH\x03\x88\x01\x01\x12,\n\x06errors\x18\x06 \x01(\x0b2\x17.functions.ErrorsUpdateH\x04\x88\x01\x01\x126\n\nreferences\x18\x07 \x01(\x0b2\x1d.functions.FunctionReferencesH\x05\x88\x01\x01\x12\x15\n\x08archived\x18\x08 \x01(\x08H\x06\x88\x01\x01B\x07\n\x05_nameB\x0e\n\x0c_descriptionB\r\n\x0b_parametersB\x07\n\x05_codeB\t\n\x07_errorsB\r\n\x0b_referencesB\x0b\n\t_archived"%\n\x17Function_DeleteFunction\x12\n\n\x02id\x18\x01 \x01(\t"\x98\x01\n\x13DelayResponseUpdate\x12\n\n\x02id\x18\x01 \x01(\t\x12\x0f\n\x07message\x18\x02 \x01(\t\x12\x10\n\x08duration\x18\x03 \x01(\x05\x12C\n\nreferences\x18\x04 \x01(\x0b2*.functions.FunctionDelayResponseReferencesH\x00\x88\x01\x01B\r\n\x0b_references"O\n\x14DelayResponsesUpdate\x127\n\x0fdelay_responses\x18\x01 \x03(\x0b2\x1e.functions.DelayResponseUpdate"\x90\x02\n\x1dFunction_UpdateLatencyControl\x12\x13\n\x0bfunction_id\x18\x01 \x01(\t\x12\x0f\n\x07enabled\x18\x02 \x01(\x08\x12=\n\x0fdelay_responses\x18\x03 \x01(\x0b2\x1f.functions.DelayResponsesUpdateH\x00\x88\x01\x01\x12\x1a\n\rinitial_delay\x18\x04 \x01(\x05H\x01\x88\x01\x01\x12\x15\n\x08interval\x18\x05 \x01(\x05H\x02\x88\x01\x01\x12\x16\n\trandomize\x18\x06 \x01(\x08H\x03\x88\x01\x01B\x12\n\x10_delay_responsesB\x10\n\x0e_initial_delayB\x0b\n\t_intervalB\x0c\n\n_randomizeb\x06proto3') _globals = globals() _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) diff --git a/src/poly/handlers/protobuf/functions_pb2.pyi b/src/poly/handlers/protobuf/functions_pb2.pyi index 7a0b4da9..c09320f7 100644 --- a/src/poly/handlers/protobuf/functions_pb2.pyi +++ b/src/poly/handlers/protobuf/functions_pb2.pyi @@ -79,7 +79,7 @@ class FunctionDelayResponse(_message.Message): def __init__(self, id: _Optional[str] = ..., message: _Optional[str] = ..., duration: _Optional[int] = ..., created_at: _Optional[_Union[_timestamp_pb2.Timestamp, _Mapping]] = ..., created_by: _Optional[str] = ..., updated_at: _Optional[_Union[_timestamp_pb2.Timestamp, _Mapping]] = ..., updated_by: _Optional[str] = ..., references: _Optional[_Union[FunctionDelayResponseReferences, _Mapping]] = ...) -> None: ... class FunctionLatencyControl(_message.Message): - __slots__ = ("enabled", "delay_responses", "initial_delay", "interval", "created_at", "created_by", "updated_at", "updated_by") + __slots__ = ("enabled", "delay_responses", "initial_delay", "interval", "created_at", "created_by", "updated_at", "updated_by", "randomize") ENABLED_FIELD_NUMBER: _ClassVar[int] DELAY_RESPONSES_FIELD_NUMBER: _ClassVar[int] INITIAL_DELAY_FIELD_NUMBER: _ClassVar[int] @@ -88,6 +88,7 @@ class FunctionLatencyControl(_message.Message): CREATED_BY_FIELD_NUMBER: _ClassVar[int] UPDATED_AT_FIELD_NUMBER: _ClassVar[int] UPDATED_BY_FIELD_NUMBER: _ClassVar[int] + RANDOMIZE_FIELD_NUMBER: _ClassVar[int] enabled: bool delay_responses: _containers.RepeatedCompositeFieldContainer[FunctionDelayResponse] initial_delay: int @@ -96,7 +97,8 @@ class FunctionLatencyControl(_message.Message): created_by: str updated_at: _timestamp_pb2.Timestamp updated_by: str - def __init__(self, enabled: bool = ..., delay_responses: _Optional[_Iterable[_Union[FunctionDelayResponse, _Mapping]]] = ..., initial_delay: _Optional[int] = ..., interval: _Optional[int] = ..., created_at: _Optional[_Union[_timestamp_pb2.Timestamp, _Mapping]] = ..., created_by: _Optional[str] = ..., updated_at: _Optional[_Union[_timestamp_pb2.Timestamp, _Mapping]] = ..., updated_by: _Optional[str] = ...) -> None: ... + randomize: bool + def __init__(self, enabled: bool = ..., delay_responses: _Optional[_Iterable[_Union[FunctionDelayResponse, _Mapping]]] = ..., initial_delay: _Optional[int] = ..., interval: _Optional[int] = ..., created_at: _Optional[_Union[_timestamp_pb2.Timestamp, _Mapping]] = ..., created_by: _Optional[str] = ..., updated_at: _Optional[_Union[_timestamp_pb2.Timestamp, _Mapping]] = ..., updated_by: _Optional[str] = ..., randomize: bool = ...) -> None: ... class FunctionReferences(_message.Message): __slots__ = ("flow_steps", "topics", "stop_keywords", "behaviour", "variables") @@ -196,16 +198,18 @@ class FunctionParameterUpdate(_message.Message): def __init__(self, id: _Optional[str] = ..., name: _Optional[str] = ..., description: _Optional[str] = ..., type: _Optional[str] = ...) -> None: ... class FunctionCreateLatencyControl(_message.Message): - __slots__ = ("enabled", "delay_responses", "initial_delay", "interval") + __slots__ = ("enabled", "delay_responses", "initial_delay", "interval", "randomize") ENABLED_FIELD_NUMBER: _ClassVar[int] DELAY_RESPONSES_FIELD_NUMBER: _ClassVar[int] INITIAL_DELAY_FIELD_NUMBER: _ClassVar[int] INTERVAL_FIELD_NUMBER: _ClassVar[int] + RANDOMIZE_FIELD_NUMBER: _ClassVar[int] enabled: bool delay_responses: _containers.RepeatedCompositeFieldContainer[FunctionDelayResponse] initial_delay: int interval: int - def __init__(self, enabled: bool = ..., delay_responses: _Optional[_Iterable[_Union[FunctionDelayResponse, _Mapping]]] = ..., initial_delay: _Optional[int] = ..., interval: _Optional[int] = ...) -> None: ... + randomize: bool + def __init__(self, enabled: bool = ..., delay_responses: _Optional[_Iterable[_Union[FunctionDelayResponse, _Mapping]]] = ..., initial_delay: _Optional[int] = ..., interval: _Optional[int] = ..., randomize: bool = ...) -> None: ... class Function_CreateFunction(_message.Message): __slots__ = ("id", "name", "description", "parameters", "code", "errors", "latency_control", "references", "archived") @@ -286,15 +290,17 @@ class DelayResponsesUpdate(_message.Message): def __init__(self, delay_responses: _Optional[_Iterable[_Union[DelayResponseUpdate, _Mapping]]] = ...) -> None: ... class Function_UpdateLatencyControl(_message.Message): - __slots__ = ("function_id", "enabled", "delay_responses", "initial_delay", "interval") + __slots__ = ("function_id", "enabled", "delay_responses", "initial_delay", "interval", "randomize") FUNCTION_ID_FIELD_NUMBER: _ClassVar[int] ENABLED_FIELD_NUMBER: _ClassVar[int] DELAY_RESPONSES_FIELD_NUMBER: _ClassVar[int] INITIAL_DELAY_FIELD_NUMBER: _ClassVar[int] INTERVAL_FIELD_NUMBER: _ClassVar[int] + RANDOMIZE_FIELD_NUMBER: _ClassVar[int] function_id: str enabled: bool delay_responses: DelayResponsesUpdate initial_delay: int interval: int - def __init__(self, function_id: _Optional[str] = ..., enabled: bool = ..., delay_responses: _Optional[_Union[DelayResponsesUpdate, _Mapping]] = ..., initial_delay: _Optional[int] = ..., interval: _Optional[int] = ...) -> None: ... + randomize: bool + def __init__(self, function_id: _Optional[str] = ..., enabled: bool = ..., delay_responses: _Optional[_Union[DelayResponsesUpdate, _Mapping]] = ..., initial_delay: _Optional[int] = ..., interval: _Optional[int] = ..., randomize: bool = ...) -> None: ... diff --git a/src/poly/resources/function.py b/src/poly/resources/function.py index e5ddfa5c..b0f6c8a1 100644 --- a/src/poly/resources/function.py +++ b/src/poly/resources/function.py @@ -105,6 +105,7 @@ class FunctionLatencyControl: initial_delay: int = 0 interval: int = 0 delay_responses: list[FunctionDelayResponse] = field(default_factory=list) + randomize: bool = False def __post_init__(self): self.delay_responses = [ @@ -147,6 +148,7 @@ def parse_latency_control(latency_control_data: dict) -> FunctionLatencyControl: ), interval=latency_control_data.get("interval", 0), delay_responses=delay_responses, + randomize=latency_control_data.get("randomize", False), ) @@ -193,6 +195,7 @@ def to_proto(self, enabled_override: Optional[bool] = None) -> Function_UpdateLa delay_responses=delay_responses, initial_delay=self.latency_control.initial_delay if enabled else 0, interval=self.latency_control.interval if enabled else 0, + randomize=self.latency_control.randomize if enabled else False, ) def build_update_proto(self) -> Message: @@ -265,6 +268,7 @@ def _parse_latency_control(value) -> FunctionLatencyControl: initial_delay=value.get("initial_delay", value.get("initialDelay", 0)), interval=value.get("interval", 0), delay_responses=value.get("delay_responses", []), + randomize=value.get("randomize", False), ) return FunctionLatencyControl() @@ -568,6 +572,8 @@ def _render_latency_control_decorator(lc: FunctionLatencyControl, indent: str) - if lc.delay_responses: dr_items = ", ".join(f"({dr.message!r}, {dr.duration!r})" for dr in lc.delay_responses) parts.append(f"delay_responses=[{dr_items}]") + if lc.randomize: + parts.append("randomize=True") return f"{indent}@func_latency_control({', '.join(parts)})\n" def validate(self, **kwargs) -> None: @@ -775,12 +781,15 @@ def _parse_latency_control_decorator( interval = 0 delay_responses: list[FunctionDelayResponse] = [] used_delay_response_ids: set[str] = set() + randomize = False for kw in decorator.keywords: if kw.arg == "delay_before_responses_start" and isinstance(kw.value, ast.Constant): initial_delay = kw.value.value elif kw.arg == "silence_after_each_response" and isinstance(kw.value, ast.Constant): interval = kw.value.value + elif kw.arg == "randomize" and isinstance(kw.value, ast.Constant): + randomize = bool(kw.value.value) elif kw.arg == "delay_responses" and isinstance(kw.value, ast.List): for elt in kw.value.elts: if isinstance(elt, ast.Tuple) and len(elt.elts) == 2: @@ -812,6 +821,7 @@ def _parse_latency_control_decorator( initial_delay=initial_delay, interval=interval, delay_responses=delay_responses, + randomize=randomize, ) @staticmethod @@ -964,6 +974,7 @@ def _build_create_latency_control_proto(self) -> FunctionCreateLatencyControl: delay_responses=delay_responses, initial_delay=self.latency_control.initial_delay, interval=self.latency_control.interval, + randomize=self.latency_control.randomize, ) def build_create_proto(self) -> Message: diff --git a/src/poly/tests/resources_test.py b/src/poly/tests/resources_test.py index 6623af12..4932fc3f 100644 --- a/src/poly/tests/resources_test.py +++ b/src/poly/tests/resources_test.py @@ -52,6 +52,7 @@ FunctionLatencyControl, FunctionParameters, FunctionType, + LatencyControl, ) from poly.resources.handoff import Handoff from poly.resources.keyphrase_boosting import KeyphraseBoosting @@ -503,6 +504,30 @@ def test_raw_includes_latency_control_decorator(self): self.assertIn("silence_after_each_response=3000", raw) self.assertIn("('Please hold...', 5000)", raw) self.assertIn("('Still looking...', 8000)", raw) + self.assertNotIn("randomize=", raw) + + def test_raw_includes_randomize_when_enabled(self): + """randomize=True is rendered on @func_latency_control when set.""" + func = Function( + resource_id="123", + name="test_code", + description="A test function", + code=TEST_CODE, + parameters=[], + latency_control=FunctionLatencyControl( + enabled=True, + initial_delay=0, + interval=2, + delay_responses=[ + FunctionDelayResponse(message="One...", duration=3000), + FunctionDelayResponse(message="Two...", duration=2000), + ], + randomize=True, + ), + function_type=FunctionType.GLOBAL, + ) + raw = func.raw + self.assertIn("randomize=True", raw) def test_raw_omits_latency_control_when_disabled(self): """When latency_control.enabled is False, no decorator is rendered.""" @@ -530,12 +555,23 @@ def my_func(conv: Conversation): self.assertTrue(lc.enabled) self.assertEqual(lc.initial_delay, 5000) self.assertEqual(lc.interval, 3000) + self.assertFalse(lc.randomize) self.assertEqual(len(lc.delay_responses), 1) self.assertEqual(lc.delay_responses[0].message, "Hold on...") self.assertEqual(lc.delay_responses[0].duration, 5000) # Decorator should be stripped from code self.assertNotIn("func_latency_control", code) + def test_extract_latency_control_randomize(self): + """_extract_decorators parses randomize from @func_latency_control.""" + code_with_decorator = """@func_latency_control(delay_before_responses_start=0, silence_after_each_response=2, delay_responses=[('Hold on...', 3000)], randomize=True) +def my_func(conv: Conversation): + pass +""" + _, _, _, lc = Function._extract_decorators(code_with_decorator, "my_func", []) + self.assertTrue(lc.enabled) + self.assertTrue(lc.randomize) + def test_extract_preserves_known_delay_response_ids(self): """Existing delay-response IDs are preserved by message match.""" code_with_decorator = """@func_latency_control(delay_before_responses_start=1000, silence_after_each_response=2000, delay_responses=[('Hold on...', 5000)]) @@ -563,6 +599,7 @@ def test_latency_control_roundtrip(self): FunctionDelayResponse(id="DR-1", message="One moment...", duration=4000), FunctionDelayResponse(id="DR-2", message="Almost there...", duration=6000), ], + randomize=True, ) func = Function( resource_id="123", @@ -576,6 +613,7 @@ def test_latency_control_roundtrip(self): function_type=FunctionType.GLOBAL, ) pretty = func.to_pretty(resource_mappings=[]) + self.assertIn("randomize=True", pretty) reverted = Function.from_pretty(pretty, resource_mappings=[]) code, params, desc, extracted_lc = Function._extract_decorators( reverted, "test_code", [], lc @@ -583,6 +621,7 @@ def test_latency_control_roundtrip(self): self.assertTrue(extracted_lc.enabled) self.assertEqual(extracted_lc.initial_delay, 4000) self.assertEqual(extracted_lc.interval, 2000) + self.assertTrue(extracted_lc.randomize) self.assertEqual(len(extracted_lc.delay_responses), 2) self.assertEqual(extracted_lc.delay_responses[0].message, "One moment...") self.assertEqual(extracted_lc.delay_responses[1].message, "Almost there...") @@ -590,6 +629,24 @@ def test_latency_control_roundtrip(self): self.assertEqual(extracted_lc.delay_responses[0].id, "DR-1") self.assertEqual(extracted_lc.delay_responses[1].id, "DR-2") + def test_latency_control_to_proto_includes_randomize(self): + """LatencyControl.to_proto sets randomize on the update command.""" + sub = LatencyControl( + function_id="fn-1", + latency_control=FunctionLatencyControl( + enabled=True, + initial_delay=0, + interval=2, + delay_responses=[ + FunctionDelayResponse(id="DR-1", message="One...", duration=3000), + ], + randomize=True, + ), + ) + proto = sub.to_proto() + self.assertTrue(proto.randomize) + self.assertTrue(proto.HasField("randomize")) + def test_read_local_resource_with_latency_control(self): """read_local_resource correctly extracts latency control from file.""" test_file_content = """from _gen import * # diff --git a/src/poly/tests/test_projects/test_project/_gen/decorators.py b/src/poly/tests/test_projects/test_project/_gen/decorators.py index 7379d028..97139ea2 100644 --- a/src/poly/tests/test_projects/test_project/_gen/decorators.py +++ b/src/poly/tests/test_projects/test_project/_gen/decorators.py @@ -40,6 +40,7 @@ def func_latency_control( delay_before_responses_start: int = 0, silence_after_each_response: int = 0, delay_responses: Optional[list[tuple[str, int]]] = None, + randomize: bool = False, ) -> Callable: """Configure latency control for a function. @@ -50,6 +51,10 @@ def func_latency_control( delay response. Must be between 0 and 10. delay_responses: A list of (message, duration_ms) tuples that are played while the function is executing. + randomize: When True, shuffle delay_responses order on each function + invocation. Timing slots are preserved (first uses + delay_before_responses_start; later slots use + silence_after_each_response). """ def decorator(func: Callable) -> Callable: diff --git a/src/poly/utils/decorators.py b/src/poly/utils/decorators.py index 3c56ff66..cd4f9edd 100644 --- a/src/poly/utils/decorators.py +++ b/src/poly/utils/decorators.py @@ -16,6 +16,7 @@ def func_latency_control( delay_before_responses_start: int = 0, silence_after_each_response: int = 0, delay_responses: Optional[list[tuple[str, int]]] = None, + randomize: bool = False, ) -> Callable: """Configure latency control for a function. @@ -26,6 +27,10 @@ def func_latency_control( delay response. Must be between 0 and 10. delay_responses: A list of (message, duration_ms) tuples that are played while the function is executing. + randomize: When True, shuffle delay_responses order on each function + invocation. Timing slots are preserved (first uses + delay_before_responses_start; later slots use + silence_after_each_response). """ def decorator(func: Callable) -> Callable: From 24a767887cf8453eafa5bee50e0b2f1b9232f0c7 Mon Sep 17 00:00:00 2001 From: Ajeet Prabu Date: Tue, 11 Aug 2026 10:37:00 +0100 Subject: [PATCH 2/2] chore(protos): refresh functions_pb2 from platform_ui generation Copy regenerated Sourcerer SDK bindings so ADK matches the canonical functions.proto randomize fields. Co-authored-by: Cursor --- src/poly/handlers/protobuf/functions_pb2.py | 72 ++++++++++----------- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/src/poly/handlers/protobuf/functions_pb2.py b/src/poly/handlers/protobuf/functions_pb2.py index 87f3290a..181b2d1f 100644 --- a/src/poly/handlers/protobuf/functions_pb2.py +++ b/src/poly/handlers/protobuf/functions_pb2.py @@ -15,7 +15,7 @@ from google.protobuf import timestamp_pb2 as google_dot_protobuf_dot_timestamp__pb2 -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x0ffunctions.proto\x12\tfunctions\x1a\x1fgoogle/protobuf/timestamp.proto"\xd8\x01\n\x11FunctionParameter\x12\n\n\x02id\x18\x01 \x01(\t\x12\x0c\n\x04name\x18\x02 \x01(\t\x12\x13\n\x0bdescription\x18\x03 \x01(\t\x12\x0c\n\x04type\x18\x04 \x01(\t\x12.\n\ncreated_at\x18\x05 \x01(\x0b2\x1a.google.protobuf.Timestamp\x12\x12\n\ncreated_by\x18\x06 \x01(\t\x12.\n\nupdated_at\x18\x07 \x01(\x0b2\x1a.google.protobuf.Timestamp\x12\x12\n\nupdated_by\x18\x08 \x01(\t">\n\rFunctionError\x12\x0e\n\x06lineno\x18\x01 \x01(\x05\x12\x0f\n\x07message\x18\x02 \x01(\t\x12\x0c\n\x04text\x18\x03 \x01(\t"\xaa\x02\n\x1fFunctionDelayResponseReferences\x12L\n\tvariables\x18\x01 \x03(\x0b29.functions.FunctionDelayResponseReferences.VariablesEntry\x12R\n\x0ctranslations\x18\x02 \x03(\x0b2<.functions.FunctionDelayResponseReferences.TranslationsEntry\x1a0\n\x0eVariablesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\x08:\x028\x01\x1a3\n\x11TranslationsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\x08:\x028\x01"\xa2\x02\n\x15FunctionDelayResponse\x12\n\n\x02id\x18\x01 \x01(\t\x12\x0f\n\x07message\x18\x02 \x01(\t\x12\x10\n\x08duration\x18\x03 \x01(\x05\x12.\n\ncreated_at\x18\x04 \x01(\x0b2\x1a.google.protobuf.Timestamp\x12\x12\n\ncreated_by\x18\x05 \x01(\t\x12.\n\nupdated_at\x18\x06 \x01(\x0b2\x1a.google.protobuf.Timestamp\x12\x12\n\nupdated_by\x18\x07 \x01(\t\x12C\n\nreferences\x18\x08 \x01(\x0b2*.functions.FunctionDelayResponseReferencesH\x00\x88\x01\x01B\r\n\x0b_references"\xa8\x02\n\x16FunctionLatencyControl\x12\x0f\n\x07enabled\x18\x01 \x01(\x08\x129\n\x0fdelay_responses\x18\x02 \x03(\x0b2 .functions.FunctionDelayResponse\x12\x15\n\rinitial_delay\x18\x03 \x01(\x05\x12\x10\n\x08interval\x18\x04 \x01(\x05\x12.\n\ncreated_at\x18\x05 \x01(\x0b2\x1a.google.protobuf.Timestamp\x12\x12\n\ncreated_by\x18\x06 \x01(\t\x12.\n\nupdated_at\x18\x07 \x01(\x0b2\x1a.google.protobuf.Timestamp\x12\x12\n\nupdated_by\x18\x08 \x01(\t\x12\x11\n\trandomize\x18\t \x01(\x08"\xd5\x04\n\x12FunctionReferences\x12@\n\nflow_steps\x18\x01 \x03(\x0b2,.functions.FunctionReferences.FlowStepsEntry\x129\n\x06topics\x18\x02 \x03(\x0b2).functions.FunctionReferences.TopicsEntry\x12F\n\rstop_keywords\x18\x03 \x03(\x0b2/.functions.FunctionReferences.StopKeywordsEntry\x12?\n\tbehaviour\x18\x04 \x03(\x0b2,.functions.FunctionReferences.BehaviourEntry\x12?\n\tvariables\x18\x05 \x03(\x0b2,.functions.FunctionReferences.VariablesEntry\x1a0\n\x0eFlowStepsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\x08:\x028\x01\x1a-\n\x0bTopicsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\x08:\x028\x01\x1a3\n\x11StopKeywordsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\x08:\x028\x01\x1a0\n\x0eBehaviourEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\x08:\x028\x01\x1a0\n\x0eVariablesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\x08:\x028\x01"\xac\x03\n\x08Function\x12\n\n\x02id\x18\x01 \x01(\t\x12\x0c\n\x04name\x18\x02 \x01(\t\x12\x13\n\x0bdescription\x18\x03 \x01(\t\x120\n\nparameters\x18\x04 \x03(\x0b2\x1c.functions.FunctionParameter\x12\x0c\n\x04code\x18\x05 \x01(\t\x12(\n\x06errors\x18\x06 \x03(\x0b2\x18.functions.FunctionError\x12:\n\x0flatency_control\x18\x07 \x01(\x0b2!.functions.FunctionLatencyControl\x12.\n\ncreated_at\x18\x08 \x01(\x0b2\x1a.google.protobuf.Timestamp\x12\x12\n\ncreated_by\x18\t \x01(\t\x12.\n\nupdated_at\x18\n \x01(\x0b2\x1a.google.protobuf.Timestamp\x12\x12\n\nupdated_by\x18\x0b \x01(\t\x12\x10\n\x08archived\x18\x0c \x01(\x08\x121\n\nreferences\x18\r \x01(\x0b2\x1d.functions.FunctionReferences"3\n\tFunctions\x12&\n\tfunctions\x18\x01 \x03(\x0b2\x13.functions.Function"V\n\x17FunctionParameterUpdate\x12\n\n\x02id\x18\x01 \x01(\t\x12\x0c\n\x04name\x18\x02 \x01(\t\x12\x13\n\x0bdescription\x18\x03 \x01(\t\x12\x0c\n\x04type\x18\x04 \x01(\t"\xa6\x01\n\x1cFunctionCreateLatencyControl\x12\x0f\n\x07enabled\x18\x01 \x01(\x08\x129\n\x0fdelay_responses\x18\x02 \x03(\x0b2 .functions.FunctionDelayResponse\x12\x15\n\rinitial_delay\x18\x03 \x01(\x05\x12\x10\n\x08interval\x18\x04 \x01(\x05\x12\x11\n\trandomize\x18\x05 \x01(\x08"\xfe\x02\n\x17Function_CreateFunction\x12\n\n\x02id\x18\x01 \x01(\t\x12\x0c\n\x04name\x18\x02 \x01(\t\x12\x13\n\x0bdescription\x18\x03 \x01(\t\x126\n\nparameters\x18\x04 \x03(\x0b2".functions.FunctionParameterUpdate\x12\x0c\n\x04code\x18\x05 \x01(\t\x12(\n\x06errors\x18\x06 \x03(\x0b2\x18.functions.FunctionError\x12E\n\x0flatency_control\x18\x07 \x01(\x0b2\'.functions.FunctionCreateLatencyControlH\x00\x88\x01\x01\x126\n\nreferences\x18\x08 \x01(\x0b2\x1d.functions.FunctionReferencesH\x01\x88\x01\x01\x12\x15\n\x08archived\x18\t \x01(\x08H\x02\x88\x01\x01B\x12\n\x10_latency_controlB\r\n\x0b_referencesB\x0b\n\t_archived"J\n\x10ParametersUpdate\x126\n\nparameters\x18\x01 \x03(\x0b2".functions.FunctionParameterUpdate"8\n\x0cErrorsUpdate\x12(\n\x06errors\x18\x01 \x03(\x0b2\x18.functions.FunctionError"\xf0\x02\n\x17Function_UpdateFunction\x12\n\n\x02id\x18\x01 \x01(\t\x12\x11\n\x04name\x18\x02 \x01(\tH\x00\x88\x01\x01\x12\x18\n\x0bdescription\x18\x03 \x01(\tH\x01\x88\x01\x01\x124\n\nparameters\x18\x04 \x01(\x0b2\x1b.functions.ParametersUpdateH\x02\x88\x01\x01\x12\x11\n\x04code\x18\x05 \x01(\tH\x03\x88\x01\x01\x12,\n\x06errors\x18\x06 \x01(\x0b2\x17.functions.ErrorsUpdateH\x04\x88\x01\x01\x126\n\nreferences\x18\x07 \x01(\x0b2\x1d.functions.FunctionReferencesH\x05\x88\x01\x01\x12\x15\n\x08archived\x18\x08 \x01(\x08H\x06\x88\x01\x01B\x07\n\x05_nameB\x0e\n\x0c_descriptionB\r\n\x0b_parametersB\x07\n\x05_codeB\t\n\x07_errorsB\r\n\x0b_referencesB\x0b\n\t_archived"%\n\x17Function_DeleteFunction\x12\n\n\x02id\x18\x01 \x01(\t"\x98\x01\n\x13DelayResponseUpdate\x12\n\n\x02id\x18\x01 \x01(\t\x12\x0f\n\x07message\x18\x02 \x01(\t\x12\x10\n\x08duration\x18\x03 \x01(\x05\x12C\n\nreferences\x18\x04 \x01(\x0b2*.functions.FunctionDelayResponseReferencesH\x00\x88\x01\x01B\r\n\x0b_references"O\n\x14DelayResponsesUpdate\x127\n\x0fdelay_responses\x18\x01 \x03(\x0b2\x1e.functions.DelayResponseUpdate"\x90\x02\n\x1dFunction_UpdateLatencyControl\x12\x13\n\x0bfunction_id\x18\x01 \x01(\t\x12\x0f\n\x07enabled\x18\x02 \x01(\x08\x12=\n\x0fdelay_responses\x18\x03 \x01(\x0b2\x1f.functions.DelayResponsesUpdateH\x00\x88\x01\x01\x12\x1a\n\rinitial_delay\x18\x04 \x01(\x05H\x01\x88\x01\x01\x12\x15\n\x08interval\x18\x05 \x01(\x05H\x02\x88\x01\x01\x12\x16\n\trandomize\x18\x06 \x01(\x08H\x03\x88\x01\x01B\x12\n\x10_delay_responsesB\x10\n\x0e_initial_delayB\x0b\n\t_intervalB\x0c\n\n_randomizeb\x06proto3') +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x0f\x66unctions.proto\x12\tfunctions\x1a\x1fgoogle/protobuf/timestamp.proto\"\xd8\x01\n\x11\x46unctionParameter\x12\n\n\x02id\x18\x01 \x01(\t\x12\x0c\n\x04name\x18\x02 \x01(\t\x12\x13\n\x0b\x64\x65scription\x18\x03 \x01(\t\x12\x0c\n\x04type\x18\x04 \x01(\t\x12.\n\ncreated_at\x18\x05 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x12\n\ncreated_by\x18\x06 \x01(\t\x12.\n\nupdated_at\x18\x07 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x12\n\nupdated_by\x18\x08 \x01(\t\">\n\rFunctionError\x12\x0e\n\x06lineno\x18\x01 \x01(\x05\x12\x0f\n\x07message\x18\x02 \x01(\t\x12\x0c\n\x04text\x18\x03 \x01(\t\"\xaa\x02\n\x1f\x46unctionDelayResponseReferences\x12L\n\tvariables\x18\x01 \x03(\x0b\x32\x39.functions.FunctionDelayResponseReferences.VariablesEntry\x12R\n\x0ctranslations\x18\x02 \x03(\x0b\x32<.functions.FunctionDelayResponseReferences.TranslationsEntry\x1a\x30\n\x0eVariablesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\x08:\x02\x38\x01\x1a\x33\n\x11TranslationsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\x08:\x02\x38\x01\"\xa2\x02\n\x15\x46unctionDelayResponse\x12\n\n\x02id\x18\x01 \x01(\t\x12\x0f\n\x07message\x18\x02 \x01(\t\x12\x10\n\x08\x64uration\x18\x03 \x01(\x05\x12.\n\ncreated_at\x18\x04 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x12\n\ncreated_by\x18\x05 \x01(\t\x12.\n\nupdated_at\x18\x06 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x12\n\nupdated_by\x18\x07 \x01(\t\x12\x43\n\nreferences\x18\x08 \x01(\x0b\x32*.functions.FunctionDelayResponseReferencesH\x00\x88\x01\x01\x42\r\n\x0b_references\"\xa8\x02\n\x16\x46unctionLatencyControl\x12\x0f\n\x07\x65nabled\x18\x01 \x01(\x08\x12\x39\n\x0f\x64\x65lay_responses\x18\x02 \x03(\x0b\x32 .functions.FunctionDelayResponse\x12\x15\n\rinitial_delay\x18\x03 \x01(\x05\x12\x10\n\x08interval\x18\x04 \x01(\x05\x12.\n\ncreated_at\x18\x05 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x12\n\ncreated_by\x18\x06 \x01(\t\x12.\n\nupdated_at\x18\x07 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x12\n\nupdated_by\x18\x08 \x01(\t\x12\x11\n\trandomize\x18\t \x01(\x08\"\xd5\x04\n\x12\x46unctionReferences\x12@\n\nflow_steps\x18\x01 \x03(\x0b\x32,.functions.FunctionReferences.FlowStepsEntry\x12\x39\n\x06topics\x18\x02 \x03(\x0b\x32).functions.FunctionReferences.TopicsEntry\x12\x46\n\rstop_keywords\x18\x03 \x03(\x0b\x32/.functions.FunctionReferences.StopKeywordsEntry\x12?\n\tbehaviour\x18\x04 \x03(\x0b\x32,.functions.FunctionReferences.BehaviourEntry\x12?\n\tvariables\x18\x05 \x03(\x0b\x32,.functions.FunctionReferences.VariablesEntry\x1a\x30\n\x0e\x46lowStepsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\x08:\x02\x38\x01\x1a-\n\x0bTopicsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\x08:\x02\x38\x01\x1a\x33\n\x11StopKeywordsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\x08:\x02\x38\x01\x1a\x30\n\x0e\x42\x65haviourEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\x08:\x02\x38\x01\x1a\x30\n\x0eVariablesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\x08:\x02\x38\x01\"\xac\x03\n\x08\x46unction\x12\n\n\x02id\x18\x01 \x01(\t\x12\x0c\n\x04name\x18\x02 \x01(\t\x12\x13\n\x0b\x64\x65scription\x18\x03 \x01(\t\x12\x30\n\nparameters\x18\x04 \x03(\x0b\x32\x1c.functions.FunctionParameter\x12\x0c\n\x04\x63ode\x18\x05 \x01(\t\x12(\n\x06\x65rrors\x18\x06 \x03(\x0b\x32\x18.functions.FunctionError\x12:\n\x0flatency_control\x18\x07 \x01(\x0b\x32!.functions.FunctionLatencyControl\x12.\n\ncreated_at\x18\x08 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x12\n\ncreated_by\x18\t \x01(\t\x12.\n\nupdated_at\x18\n \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x12\n\nupdated_by\x18\x0b \x01(\t\x12\x10\n\x08\x61rchived\x18\x0c \x01(\x08\x12\x31\n\nreferences\x18\r \x01(\x0b\x32\x1d.functions.FunctionReferences\"3\n\tFunctions\x12&\n\tfunctions\x18\x01 \x03(\x0b\x32\x13.functions.Function\"V\n\x17\x46unctionParameterUpdate\x12\n\n\x02id\x18\x01 \x01(\t\x12\x0c\n\x04name\x18\x02 \x01(\t\x12\x13\n\x0b\x64\x65scription\x18\x03 \x01(\t\x12\x0c\n\x04type\x18\x04 \x01(\t\"\xa6\x01\n\x1c\x46unctionCreateLatencyControl\x12\x0f\n\x07\x65nabled\x18\x01 \x01(\x08\x12\x39\n\x0f\x64\x65lay_responses\x18\x02 \x03(\x0b\x32 .functions.FunctionDelayResponse\x12\x15\n\rinitial_delay\x18\x03 \x01(\x05\x12\x10\n\x08interval\x18\x04 \x01(\x05\x12\x11\n\trandomize\x18\x05 \x01(\x08\"\xfe\x02\n\x17\x46unction_CreateFunction\x12\n\n\x02id\x18\x01 \x01(\t\x12\x0c\n\x04name\x18\x02 \x01(\t\x12\x13\n\x0b\x64\x65scription\x18\x03 \x01(\t\x12\x36\n\nparameters\x18\x04 \x03(\x0b\x32\".functions.FunctionParameterUpdate\x12\x0c\n\x04\x63ode\x18\x05 \x01(\t\x12(\n\x06\x65rrors\x18\x06 \x03(\x0b\x32\x18.functions.FunctionError\x12\x45\n\x0flatency_control\x18\x07 \x01(\x0b\x32\'.functions.FunctionCreateLatencyControlH\x00\x88\x01\x01\x12\x36\n\nreferences\x18\x08 \x01(\x0b\x32\x1d.functions.FunctionReferencesH\x01\x88\x01\x01\x12\x15\n\x08\x61rchived\x18\t \x01(\x08H\x02\x88\x01\x01\x42\x12\n\x10_latency_controlB\r\n\x0b_referencesB\x0b\n\t_archived\"J\n\x10ParametersUpdate\x12\x36\n\nparameters\x18\x01 \x03(\x0b\x32\".functions.FunctionParameterUpdate\"8\n\x0c\x45rrorsUpdate\x12(\n\x06\x65rrors\x18\x01 \x03(\x0b\x32\x18.functions.FunctionError\"\xf0\x02\n\x17\x46unction_UpdateFunction\x12\n\n\x02id\x18\x01 \x01(\t\x12\x11\n\x04name\x18\x02 \x01(\tH\x00\x88\x01\x01\x12\x18\n\x0b\x64\x65scription\x18\x03 \x01(\tH\x01\x88\x01\x01\x12\x34\n\nparameters\x18\x04 \x01(\x0b\x32\x1b.functions.ParametersUpdateH\x02\x88\x01\x01\x12\x11\n\x04\x63ode\x18\x05 \x01(\tH\x03\x88\x01\x01\x12,\n\x06\x65rrors\x18\x06 \x01(\x0b\x32\x17.functions.ErrorsUpdateH\x04\x88\x01\x01\x12\x36\n\nreferences\x18\x07 \x01(\x0b\x32\x1d.functions.FunctionReferencesH\x05\x88\x01\x01\x12\x15\n\x08\x61rchived\x18\x08 \x01(\x08H\x06\x88\x01\x01\x42\x07\n\x05_nameB\x0e\n\x0c_descriptionB\r\n\x0b_parametersB\x07\n\x05_codeB\t\n\x07_errorsB\r\n\x0b_referencesB\x0b\n\t_archived\"%\n\x17\x46unction_DeleteFunction\x12\n\n\x02id\x18\x01 \x01(\t\"\x98\x01\n\x13\x44\x65layResponseUpdate\x12\n\n\x02id\x18\x01 \x01(\t\x12\x0f\n\x07message\x18\x02 \x01(\t\x12\x10\n\x08\x64uration\x18\x03 \x01(\x05\x12\x43\n\nreferences\x18\x04 \x01(\x0b\x32*.functions.FunctionDelayResponseReferencesH\x00\x88\x01\x01\x42\r\n\x0b_references\"O\n\x14\x44\x65layResponsesUpdate\x12\x37\n\x0f\x64\x65lay_responses\x18\x01 \x03(\x0b\x32\x1e.functions.DelayResponseUpdate\"\x90\x02\n\x1d\x46unction_UpdateLatencyControl\x12\x13\n\x0b\x66unction_id\x18\x01 \x01(\t\x12\x0f\n\x07\x65nabled\x18\x02 \x01(\x08\x12=\n\x0f\x64\x65lay_responses\x18\x03 \x01(\x0b\x32\x1f.functions.DelayResponsesUpdateH\x00\x88\x01\x01\x12\x1a\n\rinitial_delay\x18\x04 \x01(\x05H\x01\x88\x01\x01\x12\x15\n\x08interval\x18\x05 \x01(\x05H\x02\x88\x01\x01\x12\x16\n\trandomize\x18\x06 \x01(\x08H\x03\x88\x01\x01\x42\x12\n\x10_delay_responsesB\x10\n\x0e_initial_delayB\x0b\n\t_intervalB\x0c\n\n_randomizeb\x06proto3') _globals = globals() _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) @@ -49,41 +49,41 @@ _globals['_FUNCTIONDELAYRESPONSE']._serialized_start=648 _globals['_FUNCTIONDELAYRESPONSE']._serialized_end=938 _globals['_FUNCTIONLATENCYCONTROL']._serialized_start=941 - _globals['_FUNCTIONLATENCYCONTROL']._serialized_end=1218 - _globals['_FUNCTIONREFERENCES']._serialized_start=1221 - _globals['_FUNCTIONREFERENCES']._serialized_end=1818 - _globals['_FUNCTIONREFERENCES_FLOWSTEPSENTRY']._serialized_start=1570 - _globals['_FUNCTIONREFERENCES_FLOWSTEPSENTRY']._serialized_end=1618 - _globals['_FUNCTIONREFERENCES_TOPICSENTRY']._serialized_start=1620 - _globals['_FUNCTIONREFERENCES_TOPICSENTRY']._serialized_end=1665 - _globals['_FUNCTIONREFERENCES_STOPKEYWORDSENTRY']._serialized_start=1667 - _globals['_FUNCTIONREFERENCES_STOPKEYWORDSENTRY']._serialized_end=1718 - _globals['_FUNCTIONREFERENCES_BEHAVIOURENTRY']._serialized_start=1720 - _globals['_FUNCTIONREFERENCES_BEHAVIOURENTRY']._serialized_end=1768 + _globals['_FUNCTIONLATENCYCONTROL']._serialized_end=1237 + _globals['_FUNCTIONREFERENCES']._serialized_start=1240 + _globals['_FUNCTIONREFERENCES']._serialized_end=1837 + _globals['_FUNCTIONREFERENCES_FLOWSTEPSENTRY']._serialized_start=1589 + _globals['_FUNCTIONREFERENCES_FLOWSTEPSENTRY']._serialized_end=1637 + _globals['_FUNCTIONREFERENCES_TOPICSENTRY']._serialized_start=1639 + _globals['_FUNCTIONREFERENCES_TOPICSENTRY']._serialized_end=1684 + _globals['_FUNCTIONREFERENCES_STOPKEYWORDSENTRY']._serialized_start=1686 + _globals['_FUNCTIONREFERENCES_STOPKEYWORDSENTRY']._serialized_end=1737 + _globals['_FUNCTIONREFERENCES_BEHAVIOURENTRY']._serialized_start=1739 + _globals['_FUNCTIONREFERENCES_BEHAVIOURENTRY']._serialized_end=1787 _globals['_FUNCTIONREFERENCES_VARIABLESENTRY']._serialized_start=544 _globals['_FUNCTIONREFERENCES_VARIABLESENTRY']._serialized_end=592 - _globals['_FUNCTION']._serialized_start=1821 - _globals['_FUNCTION']._serialized_end=2249 - _globals['_FUNCTIONS']._serialized_start=2251 - _globals['_FUNCTIONS']._serialized_end=2302 - _globals['_FUNCTIONPARAMETERUPDATE']._serialized_start=2304 - _globals['_FUNCTIONPARAMETERUPDATE']._serialized_end=2390 - _globals['_FUNCTIONCREATELATENCYCONTROL']._serialized_start=2393 - _globals['_FUNCTIONCREATELATENCYCONTROL']._serialized_end=2540 - _globals['_FUNCTION_CREATEFUNCTION']._serialized_start=2543 - _globals['_FUNCTION_CREATEFUNCTION']._serialized_end=2925 - _globals['_PARAMETERSUPDATE']._serialized_start=2927 - _globals['_PARAMETERSUPDATE']._serialized_end=3001 - _globals['_ERRORSUPDATE']._serialized_start=3003 - _globals['_ERRORSUPDATE']._serialized_end=3059 - _globals['_FUNCTION_UPDATEFUNCTION']._serialized_start=3062 - _globals['_FUNCTION_UPDATEFUNCTION']._serialized_end=3430 - _globals['_FUNCTION_DELETEFUNCTION']._serialized_start=3432 - _globals['_FUNCTION_DELETEFUNCTION']._serialized_end=3469 - _globals['_DELAYRESPONSEUPDATE']._serialized_start=3472 - _globals['_DELAYRESPONSEUPDATE']._serialized_end=3624 - _globals['_DELAYRESPONSESUPDATE']._serialized_start=3626 - _globals['_DELAYRESPONSESUPDATE']._serialized_end=3705 - _globals['_FUNCTION_UPDATELATENCYCONTROL']._serialized_start=3708 - _globals['_FUNCTION_UPDATELATENCYCONTROL']._serialized_end=3942 + _globals['_FUNCTION']._serialized_start=1840 + _globals['_FUNCTION']._serialized_end=2268 + _globals['_FUNCTIONS']._serialized_start=2270 + _globals['_FUNCTIONS']._serialized_end=2321 + _globals['_FUNCTIONPARAMETERUPDATE']._serialized_start=2323 + _globals['_FUNCTIONPARAMETERUPDATE']._serialized_end=2409 + _globals['_FUNCTIONCREATELATENCYCONTROL']._serialized_start=2412 + _globals['_FUNCTIONCREATELATENCYCONTROL']._serialized_end=2578 + _globals['_FUNCTION_CREATEFUNCTION']._serialized_start=2581 + _globals['_FUNCTION_CREATEFUNCTION']._serialized_end=2963 + _globals['_PARAMETERSUPDATE']._serialized_start=2965 + _globals['_PARAMETERSUPDATE']._serialized_end=3039 + _globals['_ERRORSUPDATE']._serialized_start=3041 + _globals['_ERRORSUPDATE']._serialized_end=3097 + _globals['_FUNCTION_UPDATEFUNCTION']._serialized_start=3100 + _globals['_FUNCTION_UPDATEFUNCTION']._serialized_end=3468 + _globals['_FUNCTION_DELETEFUNCTION']._serialized_start=3470 + _globals['_FUNCTION_DELETEFUNCTION']._serialized_end=3507 + _globals['_DELAYRESPONSEUPDATE']._serialized_start=3510 + _globals['_DELAYRESPONSEUPDATE']._serialized_end=3662 + _globals['_DELAYRESPONSESUPDATE']._serialized_start=3664 + _globals['_DELAYRESPONSESUPDATE']._serialized_end=3743 + _globals['_FUNCTION_UPDATELATENCYCONTROL']._serialized_start=3746 + _globals['_FUNCTION_UPDATELATENCYCONTROL']._serialized_end=4018 # @@protoc_insertion_point(module_scope)