New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

@agentuity/coder-tui

Package Overview
Dependencies
Maintainers
3
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@agentuity/coder-tui

Agentuity Coder Hub extension for Pi coding agent

latest
npmnpm
Version
2.0.11
Version published
Weekly downloads
2.3K
41.13%
Maintainers
3
Weekly downloads
 
Created
Source

@agentuity/coder

Lightweight Pi TUI extension that connects to the Agentuity Coder Hub.

Purpose

This package is a pure protocol adapter between Pi's extension API and the Coder Hub server. It contains zero hardcoded tool schemas or agent definitions — everything is driven by the server's InitMessage at startup.

The extension runs inside Pi's Node.js process, not the Agentuity runtime.

Architecture

FileLinesRole
src/index.ts~660Main extension entry — tool/event registration, sub-agent execution
src/handlers.ts~100Action processing (ACK, BLOCK, RETURN, NOTIFY, CONFIRM, etc.)
src/protocol.ts~130TypeBox protocol types (InitMessage, requests, actions, responses)
src/client.ts~145HubClient — WebSocket client with request/response correlation

Connection Flow

  • Extension loadsagentuityCoderHub(pi) is called by Pi
  • Sync bootstrapfetchInitMessageSync() calls Hub's REST /api/hub/init endpoint via curl + execFileSync to discover available tools and agents before registration returns
  • Tool registration — Hub tools (memory, context7, etc.) are registered with Pi using server-provided JSON Schemas
  • Lazy WebSocket — On first event (session_start), a persistent WebSocket connection is established for runtime communication
  • Event proxy — Pi lifecycle events are forwarded to Hub; Hub responds with actions (ACK, BLOCK, SYSTEM_PROMPT, etc.)
  • Tool execution — When Pi invokes a Hub tool, the request is sent over WebSocket and the RETURN action result is passed back

Sub-Agent Flow

  • Lead delegates — Lead agent calls the task or parallel_tasks tool
  • In-process sessionrunSubAgent() creates a Pi createAgentSession() inside the same process (no subprocess spawning)
  • Hub tools via extensionFactories — Sub-agents receive Hub tools (memory, context7, etc.) through Pi's extensionFactories mechanism, sharing the parent's WebSocket connection
  • Isolation — Sub-agents run with noExtensions: true to prevent recursive task tool registration
  • Output limits — Results are truncated to 200KB / 5K lines to prevent context bloat

Requirements

  • curl binary — Required for the synchronous REST bootstrap (fetchInitMessageSync). Available by default on macOS, Linux, and Windows 10+.
  • Pi coding agent — This extension is loaded by Pi's extension system.

Environment Variables

VariableRequiredDescription
AGENTUITY_CODER_HUB_URLYesWebSocket URL for the Coder Hub (e.g., ws://localhost:3000/api/ws)
AGENTUITY_CODER_AGENTNoAgent role name. If set, the extension runs as a sub-agent (not lead).

Design Decisions

Why curl + execFileSync?

Pi's extension registration is synchronous — tools must be registered before the extension function returns. Node's fetch() is async-only, and Bun.spawnSync isn't available in Pi's Node.js runtime. Using curl via execFileSync is the simplest way to make a synchronous HTTP request without adding dependencies.

Why no hardcoded schemas?

The Hub server is the single source of truth for tool definitions, agent configurations, and system prompts. This keeps the extension thin and allows the Hub to evolve without extension updates.

FAQs

Package last updated on 08 Apr 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts