feat: add Thenvoi Platform channel integration#2
feat: add Thenvoi Platform channel integration#2darvell-thenvoi wants to merge 3 commits intothenvoi:feat/thenvoi-channelfrom
Conversation
Replace manual tool registration (thenvoi-tools.ts) with the SDK's createThenvoiSdkMcpServer() from @thenvoi/sdk/mcp/claude. Thenvoi platform tools now run as an in-process MCP server managed by the SDK, keeping tool schemas and dispatch in sync automatically. - Add SDK MCP bridge setup in container agent runner - Register thenvoi as separate MCP server alongside nanoclaw IPC server - Remove manual JSON Schema-to-Zod conversion and tool dispatch - Delete thenvoi-tools.ts (120 lines replaced by SDK bridge) - Add add-thenvoi-memory skill for enabling platform memory tools Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
**Tried this out, and Claude spiraled for ~17 minutes, repeatedly fixing and re-fixing things. Can you review its summary of what it did? It really should be much simpler than this.** Here's a comprehensive summary of every issue that deviated from the standard install process, in Issue #1: Container build fails — @thenvoi/rest-client tarball missing Error: ENOENT: no such file or directory, open '/app/vendor/thenvoi-rest-client.tgz' Cause: container/build.sh tries to npm pack the rest-client from ../fern-javascript-sdk, which Fix applied: Changed the container's package.json to use the npm registry version Ticket: build.sh should handle missing fern-javascript-sdk gracefully (either fail with clear error Issue #2: SDK missing mcp/claude subpath export Error: Cannot find module '@thenvoi/sdk/mcp/claude' (container TypeScript build) Cause: The container code imports createThenvoiMcpBridge from @thenvoi/sdk/mcp/claude, but the SDK
Fix applied (SDK source change): Added "mcp/claude": "src/adapters/claude-sdk/mcp.ts" to Ticket: SDK needs mcp/claude subpath export in tsup.config.ts and package.json exports Issue #3: Published SDK v0.1.3 crashes NanoClaw at startup Error: ERR_MODULE_NOT_FOUND: Cannot find package '@agentclientprotocol/sdk' then Cannot find package Cause: The npm-published @thenvoi/sdk@0.1.3 bundles all adapter code (OpenAI, Anthropic, LangGraph, Fix applied: Switched from npm v0.1.3 to the local SDK build (npm install Ticket: Published SDK v0.1.3 ESM chunks cause crashes when optional peer deps are missing. Need Issue #4: Local SDK install creates broken @thenvoi/rest-client symlink Error: REST API calls fail at runtime — symlink at node_modules/@thenvoi/rest-client points to Cause: When installing the local SDK via npm install /path/to/thenvoi-sdk-typescript, npm resolves Fix applied: Manually removed the broken symlink and installed npm install Ticket: SDK's dev setup leaks local filesystem paths into dependency resolution when installed as a Issue #5: AgentIdentity.ownerUuid type mismatch Error: TS2339: Property 'ownerUuid' does not exist on type 'AgentIdentity' Cause: src/channels/thenvoi.ts:381 accesses identity.ownerUuid which exists in published SDK v0.1.3 Fix applied: Cast to unknown as Record<string, unknown> for safe property access. Ticket: Either ownerUuid needs to be added to the local SDK's AgentIdentity type, or the channel code Issue #6: UnsupportedFeatureError: Fern client missing next-message endpoint Error: Fatal runtime error on every incoming message — Execution.processLoop crashes Cause: The SDK's execution loop calls ThenvoiLink.getNextMessage() → RestFacade.getNextMessage() → The ThenvoiLink.getNextMessage has a guard if (!this.rest.getNextMessage) that's useless because Fix applied (SDK source change): Changed ThenvoiLink.getNextMessage to catch UnsupportedFeatureError Ticket: ThenvoiLink.getNextMessage must gracefully handle UnsupportedFeatureError from the REST Issue #7: REST API 404 on /api/v1/chats?page=1 Warning: Thenvoi: failed to sync rooms via agent API (non-fatal) Cause: Room sync calls link.rest.listChats() which sends a GET to No fix applied — the warning is non-fatal. Rooms register via WebSocket instead. Ticket: Rest-client listChats endpoint returns 404 from the platform. Either the endpoint path Issue #8: Room deregistration on failed REST sync Bug: Previously registered rooms get deregistered on service restart Cause: In connect(): activeRoomIds.clear() runs before syncRoomsFromApi(). When the sync fails (404), Fix applied: Made syncRoomsFromApi() return a boolean; cleanup loop only runs when sync succeeds. Ticket: src/channels/thenvoi.ts — stale group cleanup should be skipped when room sync fails Summary of SDK source changes I made (should be tickets) All in /Users/roishikler/codebase/thenvoi-sdk-typescript:
|
Summary
Adds Thenvoi Platform as a NanoClaw channel with full extension support, installable via the
/add-thenvoiskill.src/channels/thenvoi.ts): WebSocket connection via SDK'sAgentRuntime, room subscription, message routing to/from NanoClaw's container agentscreateThenvoiSdkMcpServer()from@thenvoi/sdk/mcp/claude— tool schemas and dispatch stay in sync with the SDK automaticallyTHENVOI_CONTACT_STRATEGYTHENVOI_MEMORY_TOOLS=true/add-thenvoi,/add-thenvoi-contacts,/add-thenvoi-memoryfor guided setupUses
@thenvoi/sdk@0.1.3from npm. Owner identity resolved via SDK'sgetAgentMe().ownerUuidwithTHENVOI_OWNER_IDas an explicit override.Test plan
/add-thenvoiskill on a fresh NanoClaw instancenpm test🤖 Generated with Claude Code