Skip to content

Conversation

@h3xxit
Copy link
Member

@h3xxit h3xxit commented Nov 7, 2025

Summary by cubic

Adds Code Mode to UTCP, enabling execution of TypeScript code that directly calls registered tools via manual.tool namespaces. Introduces the @utcp/code-mode package, secure execution, type-safe interfaces, and full test coverage.

  • New Features

    • New @utcp/code-mode package with CodeModeUtcpClient.
    • Execute TypeScript chains via callToolChain() in a secure VM with timeout; captures console output (log/error/warn/info).
    • Hierarchical tool access (manual.tool) with generated, namespaced TypeScript interfaces.
    • Runtime introspection via __interfaces and __getToolInterface, plus an AGENT_PROMPT_TEMPLATE for AI agents; comprehensive tests for chaining, errors, arrays, and timeouts.
  • Refactors

    • UtcpClient constructor changed from private to protected to allow subclassing.
    • Root build/publish scripts updated to include code-mode.

Written for commit 811669b. Summary will update automatically on new commits.

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.

1 issue found across 12 files

Prompt for AI agents (all 1 issues)

Understand the root cause of the following 1 issues and fix them.


<file name="packages/code-mode/README.md">

<violation number="1" location="packages/code-mode/README.md:275">
The runtime timeout relies on setTimeout around runInContext, so a synchronous infinite loop will never yield and the timeout cannot fire. The documentation should not promise prevention of infinite loops.</violation>
</file>

React with 👍 or 👎 to teach cubic. Mention @cubic-dev-ai to give feedback, ask questions, or re-run the review.


- Code execution happens in a secure Node.js VM context
- No access to Node.js modules or filesystem by default
- Timeout protection prevents infinite loops
Copy link
Contributor

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

Choose a reason for hiding this comment

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

The runtime timeout relies on setTimeout around runInContext, so a synchronous infinite loop will never yield and the timeout cannot fire. The documentation should not promise prevention of infinite loops.

Prompt for AI agents
Address the following comment on packages/code-mode/README.md at line 275:

<comment>The runtime timeout relies on setTimeout around runInContext, so a synchronous infinite loop will never yield and the timeout cannot fire. The documentation should not promise prevention of infinite loops.</comment>

<file context>
@@ -0,0 +1,306 @@
+
+- Code execution happens in a secure Node.js VM context
+- No access to Node.js modules or filesystem by default
+- Timeout protection prevents infinite loops
+- Only registered tools are accessible in the execution context
+
</file context>
Suggested change
- Timeout protection prevents infinite loops
- Timeout protection helps abort asynchronous executions that exceed the configured time limit
Fix with Cubic

@h3xxit h3xxit merged commit a16d622 into main Nov 10, 2025
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