Your packages now use the standard library pattern - all exports go through the main entry point.
// ✅ CORRECT - Import from package root
import { UtcpClient, ToolDefinition, CallTemplate } from '@utcp/sdk';
import { McpCommunicationProtocol } from '@utcp/mcp';
import { TextCallTemplate } from '@utcp/text';
import { HttpCommunicationProtocol } from '@utcp/http';
import { CliCallTemplate } from '@utcp/cli';// ❌ WRONG - Don't import from dist or subpaths
import { ToolDefinition } from '@utcp/sdk';
import { ToolDefinition } from '@utcp/sdk/data';This is how all major libraries work:
import { z } from 'zod'(not'zod/types')import { format } from 'date-fns'(not'date-fns/format')import React from 'react'(not'react/components')
Users only need to remember one import path per package.
Modern bundlers can tree-shake unused exports from the main entry point automatically.
Internal file structure can change without breaking user code.
import {
// Client
UtcpClient,
UtcpClientConfig,
// Data Models
Auth,
CallTemplate,
Tool,
ToolDefinition,
UtcpManual,
RegisterManualResult,
// Interfaces
CommunicationProtocol,
ConcurrentToolRepository,
Serializer,
ToolSearchStrategy,
VariableSubstitutor,
// Implementations
InMemConcurrentToolRepository,
TagSearchStrategy,
// Plugins
PluginLoader
} from '@utcp/sdk';import {
McpCommunicationProtocol,
McpCallTemplate
} from '@utcp/mcp';import {
TextCommunicationProtocol,
TextCallTemplate,
TextCallTemplateSerializer
} from '@utcp/text';import {
HttpCommunicationProtocol,
HttpCallTemplate,
OpenApiConverter,
SseCommunicationProtocol,
SseCallTemplate,
StreamableHttpCommunicationProtocol,
StreamableHttpCallTemplate
} from '@utcp/http';import {
CliCommunicationProtocol,
CliCallTemplate
} from '@utcp/cli';Your IDE will show all available exports when you start typing:
import { /* Ctrl+Space to see all exports */ } from '@utcp/sdk';{
"exports": {
".": {
"import": "./dist/index.js"
},
"./*": {
"import": "./dist/*.js" // ❌ This caused @utcp/sdk/dist/ imports
}
}
}{
"exports": {
".": {
"import": "./dist/index.js",
"types": "./dist/index.d.ts"
}
}
}After these changes, you should publish new patch versions:
# Update version in each package.json (1.0.1 -> 1.0.2)
bun run rebuild
bun run publish:allIf users were importing from subpaths, they need to update:
// Before
import { ToolDefinition } from '@utcp/sdk';
// After
import { ToolDefinition } from '@utcp/sdk';This is a one-line change and follows standard npm package conventions.