Skip to content

Conversation

@h3xxit
Copy link
Member

@h3xxit h3xxit commented Nov 30, 2025

Summary by cubic

Updates UTCP core and all communication protocol plugins to 1.1, introduces a new file protocol, and makes the text protocol content-based for browser environments. Improves variable substitution to safely handle OpenAPI specs.

  • New Features

    • New utcp-file plugin: loads manuals/OpenAPI from local files and returns file content for tool calls.
    • Text plugin now accepts direct content via the content field, parses JSON/YAML, and supports OpenAPI with optional base_url.
    • Variable substitution: skips strings containing $ref, uses a stricter variable regex, and returns unique, correctly namespaced variables.
  • Migration

    • Replace TextCallTemplate.file_path with content. For file-based manuals/tools, use call_template_type "file" and install utcp-file (pip install utcp-file).
    • Update dependencies to utcp>=1.1 (and utcp-http>=1.1 where used).

Written for commit e722413. Summary will update automatically on new commits.

@h3xxit h3xxit merged commit a9df439 into main Nov 30, 2025
18 checks passed
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3 issues found across 19 files

Prompt for AI agents (all 3 issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name="plugins/communication_protocols/text/src/utcp_text/text_communication_protocol.py">

<violation number="1" location="plugins/communication_protocols/text/src/utcp_text/text_communication_protocol.py:71">
P1: `OpenApiConverter` does not accept a `base_url` keyword argument, so registering OpenAPI manuals now crashes with `TypeError`.</violation>
</file>

<file name="plugins/communication_protocols/file/src/utcp_file/file_communication_protocol.py">

<violation number="1" location="plugins/communication_protocols/file/src/utcp_file/file_communication_protocol.py:27">
P2: Library modules should not call `logging.basicConfig`, as it reconfigures the root logger for every importing application and can break existing logging settings.</violation>
</file>

<file name="core/src/utcp/implementations/default_variable_substitutor.py">

<violation number="1" location="core/src/utcp/implementations/default_variable_substitutor.py:104">
P1: Strings such as `$refresh_token` now bypass substitution entirely because they contain the substring `$ref`, so legitimate variables that merely start with “ref” are no longer resolved.</violation>
</file>

Reply to cubic to teach it or ask questions. Re-run a review with @cubic-dev-ai review this PR

call_template_name=manual_call_template.name,
auth_tools=manual_call_template.auth_tools
auth_tools=manual_call_template.auth_tools,
base_url=manual_call_template.base_url
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Nov 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1: OpenApiConverter does not accept a base_url keyword argument, so registering OpenAPI manuals now crashes with TypeError.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At plugins/communication_protocols/text/src/utcp_text/text_communication_protocol.py, line 71:

<comment>`OpenApiConverter` does not accept a `base_url` keyword argument, so registering OpenAPI manuals now crashes with `TypeError`.</comment>

<file context>
@@ -47,63 +46,52 @@ async def register_manual(self, caller: &#39;UtcpClient&#39;, manual_call_template: Call
                     call_template_name=manual_call_template.name,
-                    auth_tools=manual_call_template.auth_tools
+                    auth_tools=manual_call_template.auth_tools,
+                    base_url=manual_call_template.base_url
                 )
                 utcp_manual = converter.convert()
</file context>
Fix with Cubic


import logging

logging.basicConfig(
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Nov 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: Library modules should not call logging.basicConfig, as it reconfigures the root logger for every importing application and can break existing logging settings.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At plugins/communication_protocols/file/src/utcp_file/file_communication_protocol.py, line 27:

<comment>Library modules should not call `logging.basicConfig`, as it reconfigures the root logger for every importing application and can break existing logging settings.</comment>

<file context>
@@ -0,0 +1,140 @@
+
+import logging
+
+logging.basicConfig(
+    level=logging.INFO,
+    format=&quot;%(asctime)s [%(levelname)s] %(filename)s:%(lineno)d - %(message)s&quot;
</file context>
Fix with Cubic

elif isinstance(obj, str):
if isinstance(obj, str):
# Skip substitution for JSON $ref strings
if '$ref' in obj:
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Nov 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1: Strings such as $refresh_token now bypass substitution entirely because they contain the substring $ref, so legitimate variables that merely start with “ref” are no longer resolved.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At core/src/utcp/implementations/default_variable_substitutor.py, line 104:

<comment>Strings such as `$refresh_token` now bypass substitution entirely because they contain the substring `$ref`, so legitimate variables that merely start with “ref” are no longer resolved.</comment>

<file context>
@@ -95,18 +99,22 @@ def substitute(self, obj: dict | list | str, config: UtcpClientConfig, variable_
-        elif isinstance(obj, str):
+        if isinstance(obj, str):
+            # Skip substitution for JSON $ref strings
+            if &#39;$ref&#39; in obj:
+                return obj
+
</file context>
Suggested change
if '$ref' in obj:
if '"$ref"' in obj:
Fix with Cubic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants