Skip to content

[AgentOps][BugFix] Make sure the development mode auto load mechanism works#474

Merged
XinweiHe merged 1 commit intopivot/agentopsfrom
xinwei_tmux_tool_autoreload_support_v3
Mar 2, 2026
Merged

[AgentOps][BugFix] Make sure the development mode auto load mechanism works#474
XinweiHe merged 1 commit intopivot/agentopsfrom
xinwei_tmux_tool_autoreload_support_v3

Conversation

@XinweiHe
Copy link
Collaborator

@XinweiHe XinweiHe commented Mar 2, 2026

Summary

Fix development mode auto-reload mechanism and resolve TypeScript build issues across the monorepo.

Type of Change

  • feat - A new feature
  • fix - A bug fix
  • refactor - A code change that neither fixes a bug nor adds a feature

Details

1. Core Package: Switch to Bundler Mode

frontend/packages/core

  • Changed moduleResolution from NodeNextbundler in tsconfig
  • Updated package.json exports to use src/ directly instead of dist/
  • Removed .js extensions from all imports (bundler mode handles resolution)

This enables hot-reload for the core package during development — changes are picked up immediately without rebuilding.

2. Agent Package: Fix TypeBox Type Resolution

frontend/packages/agent

  • Changed import { Type } from "@sinclair/typebox"import { Type } from "@mariozechner/pi-ai" in 5 tool files
  • Removed direct @sinclair/typebox dependency

Why: pi-agent-core exports AgentTool<TSchema> where TSchema comes from pi-ai's typebox. Importing Type directly from a separate @sinclair/typebox dependency caused TypeScript to see two different TSchema types (even though same version), failing tsc with [Kind] symbol missing errors. Using pi-ai's re-export ensures type identity.

3. Billing Worker: Use Dev Mode

tmux_tools/launcher.py

  • Changed from pnpm build && node dist/index.jspnpm dev
  • Enables hot-reload for local development

Verification

Both consumer packages now build successfully:

cd frontend/worker && pnpm build  # ✅ Pass
cd frontend/packages/agent && pnpm build  # ✅ Pass

Files Changed

Path Change
frontend/packages/core/package.json Exports point to src/
frontend/packages/core/tsconfig.json moduleResolution: bundler
frontend/packages/core/src/*.ts Remove .js extensions
frontend/packages/agent/package.json Remove @sinclair/typebox dep
frontend/packages/agent/src/tools/*.ts Import Type from pi-ai
tmux_tools/launcher.py Use pnpm dev for Billing Worker

Checklist

  • I have read the CONTRIBUTING.md
  • I have added/updated tests where applicable
  • I have added screenshots or recordings for UI changes (if applicable)
  • I have updated documentation where necessary

@XinweiHe XinweiHe requested a review from a team as a code owner March 2, 2026 19:20
@greptile-apps
Copy link

greptile-apps bot commented Mar 2, 2026

Greptile Summary

This PR enables development mode hot-reload by configuring the @traceroot/core package to export source files directly instead of built files, eliminating the need to rebuild after changes.

Key Changes:

  • Consolidated dependencies by removing @sinclair/typebox and using @mariozechner/pi-ai which re-exports Type from typebox
  • Changed @traceroot/core package to point to source .ts files for development mode
  • Updated TypeScript config from NodeNext to bundler module resolution with ESNext modules
  • Removed .js extensions from imports (correct for bundler resolution)
  • Modified billing worker launcher command from pnpm build && node dist/index.js to pnpm dev for hot-reload support

Implementation Notes:

  • The core package maintains its build script for production deployments
  • Agent and worker packages continue using NodeNext resolution, but tsx handles the TypeScript imports from core correctly
  • This change significantly improves developer experience by eliminating rebuild cycles during development

Confidence Score: 4/5

  • This PR is safe to merge with low risk - changes are well-scoped to enable development mode
  • Score of 4 reflects that the changes are appropriate and well-implemented for enabling development mode hot-reload. The changes are consistent and follow best practices for bundler-based development. Minor concern is the mixed module resolution strategies between packages (core uses bundler, agent/worker use NodeNext), but this works correctly with tsx in development mode.
  • No files require special attention - all changes are straightforward configuration updates

Important Files Changed

Filename Overview
frontend/packages/agent/package.json Removed @sinclair/typebox dependency and alphabetically sorted dependencies
frontend/packages/core/package.json Changed main/types/exports to point to source files instead of built dist files for development mode
frontend/packages/core/src/index.ts Removed .js extensions from all imports (correct for bundler moduleResolution)
frontend/packages/core/tsconfig.json Changed module from NodeNext to ESNext and moduleResolution from NodeNext to bundler for development mode
tmux_tools/launcher.py Changed billing worker command from build+run to pnpm dev for hot-reload support

Last reviewed commit: 409c187

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

14 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

@XinweiHe XinweiHe merged commit 0f8396b into pivot/agentops Mar 2, 2026
7 checks passed
@XinweiHe XinweiHe deleted the xinwei_tmux_tool_autoreload_support_v3 branch March 2, 2026 20:24
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.

1 participant