@idiomark/projectors 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,3 +1,254 @@
1
- # Temporary Holding Version
1
+ # @idiomark/projectors
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ > Apply Idiomark personalities to external systems - MCP servers, shopping agents, HTTP APIs, gaming bots, and more.
4
+
5
+ ## Overview
6
+
7
+ **Projectors** are adapters that **project** Idiomark personalities **onto** external systems (the opposite of adapters which **extract** personalities **from** platforms).
8
+
9
+ ```
10
+ ┌─────────────────────┐ ┌──────────────────────┐
11
+ │ Idiomark Personality │────────▶│ External System │
12
+ │ (voice, values) │ Apply │ (MCP, UCP, Games) │
13
+ └─────────────────────┘ └──────────────────────┘
14
+ ```
15
+
16
+ ## Available Projectors
17
+
18
+ | Projector | Description | Export |
19
+ |-----------|-------------|--------|
20
+ | **MCP Server** | Model Context Protocol server with personality-driven tools | `@idiomark/projectors/mcp` |
21
+ | **UCP Adapter** | Universal Commerce Protocol shopping agent | `@idiomark/projectors/ucp` |
22
+ | **HTTP Server** | REST API that responds with personality | `@idiomark/projectors/http` |
23
+ | **Gaming** | In-game NPCs and chat bots (Minecraft, Roblox, VRChat, Fortnite) | `@idiomark/projectors/gaming` |
24
+
25
+ ## Installation
26
+
27
+ ```bash
28
+ npm install @idiomark/projectors
29
+ ```
30
+
31
+ Or install individual packages:
32
+
33
+ ```bash
34
+ npm install @idiomark/projectors/mcp
35
+ npm install @idiomark/projectors/ucp
36
+ npm install @idiomark/projectors/http
37
+ npm install @idiomark/projectors/gaming
38
+ ```
39
+
40
+ ## Quick Start
41
+
42
+ ### MCP Server
43
+
44
+ Create an MCP server that exposes your personality as tools:
45
+
46
+ ```typescript
47
+ import { MCPServer } from '@idiomark/projectors/mcp'
48
+ import myPersonality from './my-personality.idiomark'
49
+
50
+ const server = new MCPServer({
51
+ transport: 'stdio', // or 'http'
52
+ port: 3000, // required for http transport
53
+ personality: myPersonality
54
+ })
55
+
56
+ await server.start()
57
+ ```
58
+
59
+ **Exposed Tools:**
60
+ - `generate_response` - Generate responses with your personality
61
+ - `get_personality` - Query personality metadata
62
+ - `get_system_prompt` - Get the system prompt encoding
63
+ - `get_health` - Health check with metrics
64
+
65
+ **Exposed Resources:**
66
+ - `idiomark:///personality` - Full Idiomark file
67
+ - `idiomark:///voice` - Voice profile
68
+ - `idiomark:///values` - Core values
69
+ - `idiomark:///domains` - Domain knowledge
70
+
71
+ ### UCP Adapter
72
+
73
+ Create a shopping agent with personality:
74
+
75
+ ```typescript
76
+ import { UCPAdapter } from '@idiomark/projectors/ucp'
77
+ import myPersonality from './my-personality.idiomark'
78
+
79
+ const adapter = new UCPAdapter({
80
+ merchantId: 'merchant-123',
81
+ businessName: 'My Store',
82
+ personality: myPersonality,
83
+ port: 3000
84
+ })
85
+
86
+ const result = await adapter.start()
87
+ console.log(`Profile at: ${result.profileUrl}`)
88
+ ```
89
+
90
+ **Personality Integration:**
91
+ - Interaction style (tone, formality, humor)
92
+ - Values-aligned product recommendations
93
+ - Domain-based product matching
94
+
95
+ ### HTTP Server
96
+
97
+ Simple REST API with personality:
98
+
99
+ ```typescript
100
+ import { HTTPServerAdapter } from '@idiomark/projectors/http'
101
+ import myPersonality from './my-personality.idiomark'
102
+
103
+ const server = new HTTPServerAdapter({
104
+ port: 3000,
105
+ personality: myPersonality,
106
+ provider: 'anthropic', // or 'openai'
107
+ model: 'claude-3-opus-20240229'
108
+ })
109
+
110
+ await server.start()
111
+ ```
112
+
113
+ **Endpoints:**
114
+ - `POST /generate` - Generate response with personality
115
+ - `POST /stream` - Stream response (SSE)
116
+ - `GET /personality` - View personality JSON
117
+ - `GET /system-prompt` - View system prompt
118
+ - `GET /health` - Health check
119
+
120
+ ### Gaming Adapters
121
+
122
+ Create personality-powered in-game bots:
123
+
124
+ ```typescript
125
+ import { MinecraftAdapter } from '@idiomark/projectors/gaming/minecraft'
126
+ import myPersonality from './my-personality.idiomark'
127
+
128
+ const bot = new MinecraftAdapter({
129
+ name: 'MyBot',
130
+ serverConfig: {
131
+ host: 'mc.hypixel.net',
132
+ port: 25565
133
+ },
134
+ personality: myPersonality
135
+ })
136
+
137
+ await bot.connect()
138
+ ```
139
+
140
+ **Supported Games:**
141
+ - Minecraft ([`minecraft`](./src/gaming/minecraft.ts))
142
+ - Roblox ([`roblox`](./src/gaming/roblox.ts))
143
+ - VRChat ([`vrchat`](./src/gaming/vrchat.ts))
144
+ - Fortnite ([`fortnite`](./src/gaming/fortnite.ts))
145
+
146
+ ## Base Adapter
147
+
148
+ All projectors extend [`BaseProjectionAdapter`](./src/base.ts), which provides:
149
+
150
+ | Feature | Description |
151
+ |---------|-------------|
152
+ | Rate Limiting | Configurable request throttling |
153
+ | Caching | Cache personality applications |
154
+ | Retry Logic | Automatic retry with exponential backoff |
155
+ | Metrics | Request counting, latency tracking |
156
+ | Events | Event emission for observability |
157
+
158
+ ### Events
159
+
160
+ ```typescript
161
+ adapter.on('projectionStart', (data) => console.log('Starting', data))
162
+ adapter.on('projectionComplete', (data) => console.log('Complete', data))
163
+ adapter.on('projectionError', (data) => console.log('Error', data))
164
+ adapter.on('rateLimit', (data) => console.log('Rate limited', data))
165
+ adapter.on('cacheHit', (data) => console.log('Cache hit', data))
166
+ ```
167
+
168
+ ## Personality Modes
169
+
170
+ All projectors support three personality application modes:
171
+
172
+ | Mode | Description |
173
+ |------|-------------|
174
+ | `strict` | Maximum personality application |
175
+ | `balanced` | Balanced personality (default) |
176
+ | `subtle` | Subtle personality hints |
177
+
178
+ ```typescript
179
+ // Use mode parameter
180
+ await server.generateResponse({
181
+ message: 'Hello!',
182
+ mode: 'strict'
183
+ })
184
+ ```
185
+
186
+ ## CLI Usage
187
+
188
+ The Idiomark CLI includes projector scaffolding:
189
+
190
+ ```bash
191
+ # Create a new MCP server
192
+ idiomark projector create my-server --type mcp --personality me.idiomark
193
+
194
+ # Create a gaming bot
195
+ idiomark projector create mc-bot --type minecraft --personality gamer.idiomark
196
+
197
+ # Validate a projector
198
+ idiomark projector validate ./my-server
199
+
200
+ # Test a projector
201
+ idiomark projector test ./my-server
202
+ ```
203
+
204
+ See [CLI Documentation](../../docs-site/docs/projectors.md) for full command reference.
205
+
206
+ ## API Reference
207
+
208
+ ### Types
209
+
210
+ ```typescript
211
+ import type {
212
+ ProjectionInput,
213
+ ProjectionOutput,
214
+ ProjectionOptions,
215
+ ResponseResult,
216
+ PersonalityMode
217
+ } from '@idiomark/projectors'
218
+ ```
219
+
220
+ ### Configuration
221
+
222
+ ```typescript
223
+ interface ProjectionAdapterConfig {
224
+ name: string
225
+ rateLimiter?: {
226
+ maxRequests: number
227
+ windowDuration: number
228
+ }
229
+ cache?: {
230
+ enabled: boolean
231
+ ttl: number
232
+ }
233
+ retry?: {
234
+ maxRetries: number
235
+ baseDelay: number
236
+ maxDelay: number
237
+ }
238
+ }
239
+ ```
240
+
241
+ ## Examples
242
+
243
+ - [`examples/mcp-server.ts`](./examples/mcp-server.ts) - MCP server example
244
+ - [`examples/ucp-agent.ts`](./examples/ucp-agent.ts) - UCP shopping agent
245
+ - [`examples/http-api.ts`](./examples/http-api.ts) - HTTP API server
246
+ - [`examples/minecraft-bot.ts`](./examples/minecraft-bot.ts) - Minecraft bot
247
+
248
+ ## Contributing
249
+
250
+ See [CONTRIBUTING.md](../../CONTRIBUTING.md) for guidelines on adding new projectors.
251
+
252
+ ## License
253
+
254
+ MIT
@@ -0,0 +1,241 @@
1
+ import {
2
+ BaseProjectionAdapter
3
+ } from "./chunk-NWOITAMN.js";
4
+
5
+ // src/ucp/adapter.ts
6
+ import { createServer as createHttpServer } from "http";
7
+ var UCPAdapter = class extends BaseProjectionAdapter {
8
+ server = null;
9
+ config;
10
+ personality = null;
11
+ constructor(config) {
12
+ super("ucp-adapter", { name: "ucp-adapter" });
13
+ this.config = config;
14
+ this.personality = config.personality;
15
+ }
16
+ // ============================================================
17
+ // UCP Profile Generation
18
+ // ============================================================
19
+ /**
20
+ * Generate UCP Profile with Idiomark personality integration
21
+ */
22
+ async generateProfile() {
23
+ if (!this.personality) {
24
+ throw new Error("Personality not loaded");
25
+ }
26
+ const { personality, metadata } = this.personality;
27
+ const { merchantId, businessName, website, customerServiceEmail } = this.config;
28
+ const { buildSystemPrompt } = await import("@idiomark/inference");
29
+ const systemPrompt = buildSystemPrompt(this.personality, "balanced");
30
+ const values = personality?.values?.map((v) => v.name) || [];
31
+ const domains = personality?.domains?.map((d) => d.name) || [];
32
+ return {
33
+ ucp_version: "1.0",
34
+ merchant_id: merchantId,
35
+ business_name: businessName,
36
+ website,
37
+ customer_service_email: customerServiceEmail,
38
+ // Standard UCP capabilities
39
+ capabilities: {
40
+ product_search: true,
41
+ inventory_check: true,
42
+ checkout: true,
43
+ payment_tokenization: true,
44
+ order_tracking: true,
45
+ returns: true,
46
+ gift_options: true
47
+ },
48
+ // Idiomark personality integration
49
+ personality_integration: {
50
+ enabled: true,
51
+ interaction_style: {
52
+ tone: personality?.voice?.tone?.primary,
53
+ secondary_tone: personality?.voice?.tone?.secondary,
54
+ formality: personality?.voice?.formality,
55
+ directness: personality?.voice?.directness,
56
+ humor: personality?.voice?.humor,
57
+ enthusiasm: personality?.voice?.enthusiasm,
58
+ emoji_usage: personality?.voice?.emoji_usage?.frequency
59
+ },
60
+ recommendation_strategy: {
61
+ values_alignment: values,
62
+ domain_preferences: domains,
63
+ voice_matching: true,
64
+ // Add personality domains to improve product matching
65
+ personality_domains: domains
66
+ },
67
+ system_prompt: systemPrompt
68
+ },
69
+ // Standard fields
70
+ supported_locales: ["en-US"],
71
+ tax_calculation: {
72
+ calculate_before_checkout: true,
73
+ supported_regions: ["US", "CA", "GB", "EU"]
74
+ },
75
+ shipping_options: [
76
+ {
77
+ id: "standard",
78
+ name: "Standard Shipping",
79
+ estimated_days: 5,
80
+ cost_usd: 5.99,
81
+ international: false
82
+ },
83
+ {
84
+ id: "express",
85
+ name: "Express Shipping",
86
+ estimated_days: 2,
87
+ cost_usd: 14.99,
88
+ international: true
89
+ }
90
+ ]
91
+ };
92
+ }
93
+ // ============================================================
94
+ // Serve UCP Profile
95
+ // ============================================================
96
+ /**
97
+ * Start serving UCP profile (and optionally MCP server)
98
+ */
99
+ async start() {
100
+ const port = this.config.port || 3e3;
101
+ const profile = await this.generateProfile();
102
+ this.server = createHttpServer(async (req, res) => {
103
+ res.setHeader("Access-Control-Allow-Origin", "*");
104
+ res.setHeader("Access-Control-Allow-Methods", "GET, POST, OPTIONS");
105
+ res.setHeader("Access-Control-Allow-Headers", "Content-Type");
106
+ if (req.method === "OPTIONS") {
107
+ res.writeHead(204);
108
+ res.end();
109
+ return;
110
+ }
111
+ if (req.method === "GET" && req.url === "/.well-known/ucp-profile.json") {
112
+ res.writeHead(200, {
113
+ "Content-Type": "application/json",
114
+ "Access-Control-Expose-Headers": "Content-Type"
115
+ });
116
+ res.end(JSON.stringify(profile, null, 2));
117
+ return;
118
+ }
119
+ if (req.method === "GET" && req.url === "/ucp/profile") {
120
+ res.writeHead(200, { "Content-Type": "application/json" });
121
+ res.end(JSON.stringify(profile, null, 2));
122
+ return;
123
+ }
124
+ if (req.method === "GET" && req.url === "/") {
125
+ await this.handleRoot(req, res, profile);
126
+ return;
127
+ }
128
+ if (req.method === "GET" && req.url === "/health") {
129
+ const health = await this.healthCheck();
130
+ res.writeHead(200, { "Content-Type": "application/json" });
131
+ res.end(JSON.stringify(health));
132
+ return;
133
+ }
134
+ if (this.config.enableMCP && req.url?.startsWith("/mcp")) {
135
+ res.writeHead(501);
136
+ res.end(JSON.stringify({ error: "MCP integration not yet implemented" }));
137
+ return;
138
+ }
139
+ res.writeHead(404);
140
+ res.end(JSON.stringify({ error: "Not found" }));
141
+ });
142
+ this.server.listen(port, () => {
143
+ console.error(`UCP Profile server listening on port ${port}`);
144
+ console.error(`Profile available at: http://localhost:${port}/.well-known/ucp-profile.json`);
145
+ this.emitter.emit("serverStart", { port, profile });
146
+ });
147
+ return {
148
+ profileUrl: `http://localhost:${port}/.well-known/ucp-profile.json`,
149
+ mcpServer: this.config.enableMCP ? {
150
+ transport: "http",
151
+ port
152
+ } : void 0
153
+ };
154
+ }
155
+ /**
156
+ * Handle root endpoint with info
157
+ */
158
+ async handleRoot(req, res, profile) {
159
+ const html = `
160
+ <!DOCTYPE html>
161
+ <html>
162
+ <head>
163
+ <title>UCP Profile - ${profile.business_name}</title>
164
+ <meta name="description" content="UCP Profile for ${profile.business_name}">
165
+ <style>
166
+ body { font-family: system-ui; max-width: 800px; margin: 40px auto; }
167
+ .badge { display: inline-block; background: #4285f4; color: white; padding: 4px 12px; border-radius: 20px; font-size: 12px; font-weight: bold; }
168
+ .section { background: #f5f5f5; padding: 20px; margin: 16px 0; border-radius: 8px; }
169
+ h1 { color: #333; }
170
+ .endpoint { background: #e8f5e9; border-left: 4px solid #4285f4; padding: 12px; margin: 8px 0; }
171
+ code { background: #333; color: #4ade80; padding: 2px 6px; border-radius: 4px; }
172
+ </style>
173
+ </head>
174
+ <body>
175
+ <h1><span class="badge">UCP</span> ${profile.business_name}</h1>
176
+
177
+ <div class="section">
178
+ <h3>\u{1F3AD} Idiomark Personality Integration</h3>
179
+ <p><strong>Tone:</strong> ${profile.personality_integration?.interaction_style?.tone || "Not specified"}</p>
180
+ <p><strong>Formality:</strong> ${profile.personality_integration?.interaction_style?.formality?.toFixed(2) || "N/A"}</p>
181
+ <p><strong>Values:</strong> ${profile.personality_integration?.recommendation_strategy?.values_alignment?.join(", ") || "None"}</p>
182
+ </div>
183
+
184
+ <div class="section">
185
+ <h3>\u{1F4E6} UCP Capabilities</h3>
186
+ <ul>
187
+ ${Object.entries(profile.capabilities).filter(([_, enabled]) => enabled).map(([key, _]) => `<li>${key.replace(/_/g, " ").replace(/\b\w/g, (word) => word.charAt(0).toUpperCase() + word.slice(1))}</li>`).join("")}
188
+ </ul>
189
+ </div>
190
+
191
+ <div class="section">
192
+ <h3>\u{1F517} Endpoints</h3>
193
+ <div class="endpoint">
194
+ <strong>UCP Profile:</strong><br>
195
+ <code>/.well-known/ucp-profile.json</code>
196
+ <code>/ucp/profile</code>
197
+ </div>
198
+ <div class="endpoint">
199
+ <strong>Health:</strong><br>
200
+ <code>/health</code>
201
+ </div>
202
+ </div>
203
+
204
+ <p style="color: #666; font-size: 14px; margin-top: 24px;">
205
+ \u{1F4D6} Learn more about UCP at <a href="https://ucp.dev/" target="_blank" style="color: #4285f4;">ucp.dev</a>
206
+ </p>
207
+ </body>
208
+ </html>
209
+ `;
210
+ res.writeHead(200, { "Content-Type": "text/html" });
211
+ res.end(html);
212
+ }
213
+ // ============================================================
214
+ // BaseAdapter Implementation
215
+ // ============================================================
216
+ async transform(input) {
217
+ const profile = await this.generateProfile();
218
+ return {
219
+ content: JSON.stringify(profile, null, 2),
220
+ format: "json"
221
+ };
222
+ }
223
+ async send(output) {
224
+ return {
225
+ success: true,
226
+ content: output.content
227
+ };
228
+ }
229
+ async stop() {
230
+ if (this.server) {
231
+ this.server.close();
232
+ this.server = null;
233
+ }
234
+ await this.dispose();
235
+ }
236
+ };
237
+
238
+ export {
239
+ UCPAdapter
240
+ };
241
+ //# sourceMappingURL=chunk-2DZ2XQGO.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/ucp/adapter.ts"],"sourcesContent":["/**\n * UCP (Universal Commerce Protocol) Adapter\n *\n * Generates UCP Profiles infused with Idiomark personality.\n * Can also serve as MCP server (UCP supports MCP as transport).\n *\n * References:\n * - https://ucp.dev/\n * - https://developers.google.com/merchant/ucp\n * - https://support.google.com/merchants/answer/16837055\n */\n\nimport { createServer as createHttpServer } from 'http'\nimport type { IncomingMessage, ServerResponse } from 'http'\n\nimport type {\n UCPAdapterOptions,\n UCPProfile,\n UCPServeResult\n} from './types'\nimport type { IdiomarkFile } from '@idiomark/core'\nimport { BaseProjectionAdapter } from '../base'\n\n// ============================================================\n// UCP Adapter Implementation\n// ============================================================\n\nexport class UCPAdapter extends BaseProjectionAdapter {\n private server: any = null\n private config: UCPAdapterOptions\n private personality: IdiomarkFile | null = null\n\n constructor(config: UCPAdapterOptions) {\n super('ucp-adapter', { name: 'ucp-adapter' })\n this.config = config\n this.personality = config.personality\n }\n\n // ============================================================\n // UCP Profile Generation\n // ============================================================\n\n /**\n * Generate UCP Profile with Idiomark personality integration\n */\n async generateProfile(): Promise<UCPProfile> {\n if (!this.personality) {\n throw new Error('Personality not loaded')\n }\n\n const { personality, metadata } = this.personality\n const { merchantId, businessName, website, customerServiceEmail } = this.config\n\n // Build system prompt for AI agent interactions\n const { buildSystemPrompt } = await import('@idiomark/inference')\n const systemPrompt = buildSystemPrompt(this.personality, 'balanced')\n\n // Extract values and domains\n const values = personality?.values?.map((v: any) => v.name) || []\n const domains = personality?.domains?.map((d: any) => d.name) || []\n\n return {\n ucp_version: '1.0',\n merchant_id: merchantId,\n business_name: businessName,\n website,\n customer_service_email: customerServiceEmail,\n\n // Standard UCP capabilities\n capabilities: {\n product_search: true,\n inventory_check: true,\n checkout: true,\n payment_tokenization: true,\n order_tracking: true,\n returns: true,\n gift_options: true\n },\n\n // Idiomark personality integration\n personality_integration: {\n enabled: true,\n interaction_style: {\n tone: personality?.voice?.tone?.primary,\n secondary_tone: personality?.voice?.tone?.secondary,\n formality: personality?.voice?.formality,\n directness: personality?.voice?.directness,\n humor: personality?.voice?.humor,\n enthusiasm: personality?.voice?.enthusiasm,\n emoji_usage: personality?.voice?.emoji_usage?.frequency\n },\n recommendation_strategy: {\n values_alignment: values,\n domain_preferences: domains,\n voice_matching: true,\n // Add personality domains to improve product matching\n personality_domains: domains\n },\n system_prompt: systemPrompt\n },\n\n // Standard fields\n supported_locales: ['en-US'],\n tax_calculation: {\n calculate_before_checkout: true,\n supported_regions: ['US', 'CA', 'GB', 'EU']\n },\n shipping_options: [\n {\n id: 'standard',\n name: 'Standard Shipping',\n estimated_days: 5,\n cost_usd: 5.99,\n international: false\n },\n {\n id: 'express',\n name: 'Express Shipping',\n estimated_days: 2,\n cost_usd: 14.99,\n international: true\n }\n ]\n }\n }\n\n // ============================================================\n // Serve UCP Profile\n // ============================================================\n\n /**\n * Start serving UCP profile (and optionally MCP server)\n */\n async start(): Promise<UCPServeResult> {\n const port = this.config.port || 3000\n\n // Generate the profile\n const profile = await this.generateProfile()\n\n this.server = createHttpServer(async (req, res) => {\n // CORS\n res.setHeader('Access-Control-Allow-Origin', '*')\n res.setHeader('Access-Control-Allow-Methods', 'GET, POST, OPTIONS')\n res.setHeader('Access-Control-Allow-Headers', 'Content-Type')\n\n if (req.method === 'OPTIONS') {\n res.writeHead(204)\n res.end()\n return\n }\n\n // UCP Profile endpoint (standard location)\n if (req.method === 'GET' && req.url === '/.well-known/ucp-profile.json') {\n res.writeHead(200, {\n 'Content-Type': 'application/json',\n 'Access-Control-Expose-Headers': 'Content-Type'\n })\n res.end(JSON.stringify(profile, null, 2))\n return\n }\n\n // Alternative UCP profile endpoint\n if (req.method === 'GET' && req.url === '/ucp/profile') {\n res.writeHead(200, { 'Content-Type': 'application/json' })\n res.end(JSON.stringify(profile, null, 2))\n return\n }\n\n // Root endpoint\n if (req.method === 'GET' && req.url === '/') {\n await this.handleRoot(req, res, profile)\n return\n }\n\n // Health check\n if (req.method === 'GET' && req.url === '/health') {\n const health = await this.healthCheck()\n res.writeHead(200, { 'Content-Type': 'application/json' })\n res.end(JSON.stringify(health))\n return\n }\n\n // If MCP is enabled, forward MCP traffic\n // (This would integrate with the MCP server adapter)\n if (this.config.enableMCP && req.url?.startsWith('/mcp')) {\n // TODO: Integrate with MCPServer\n res.writeHead(501)\n res.end(JSON.stringify({ error: 'MCP integration not yet implemented' }))\n return\n }\n\n // 404\n res.writeHead(404)\n res.end(JSON.stringify({ error: 'Not found' }))\n })\n\n this.server.listen(port, () => {\n console.error(`UCP Profile server listening on port ${port}`)\n console.error(`Profile available at: http://localhost:${port}/.well-known/ucp-profile.json`)\n this.emitter.emit('serverStart', { port, profile })\n })\n\n return {\n profileUrl: `http://localhost:${port}/.well-known/ucp-profile.json`,\n mcpServer: this.config.enableMCP ? {\n transport: 'http',\n port\n } : undefined\n }\n }\n\n /**\n * Handle root endpoint with info\n */\n private async handleRoot(req: IncomingMessage, res: ServerResponse, profile: UCPProfile): Promise<void> {\n const html = `\n<!DOCTYPE html>\n<html>\n<head>\n <title>UCP Profile - ${profile.business_name}</title>\n <meta name=\"description\" content=\"UCP Profile for ${profile.business_name}\">\n <style>\n body { font-family: system-ui; max-width: 800px; margin: 40px auto; }\n .badge { display: inline-block; background: #4285f4; color: white; padding: 4px 12px; border-radius: 20px; font-size: 12px; font-weight: bold; }\n .section { background: #f5f5f5; padding: 20px; margin: 16px 0; border-radius: 8px; }\n h1 { color: #333; }\n .endpoint { background: #e8f5e9; border-left: 4px solid #4285f4; padding: 12px; margin: 8px 0; }\n code { background: #333; color: #4ade80; padding: 2px 6px; border-radius: 4px; }\n </style>\n</head>\n<body>\n <h1><span class=\"badge\">UCP</span> ${profile.business_name}</h1>\n\n <div class=\"section\">\n <h3>🎭 Idiomark Personality Integration</h3>\n <p><strong>Tone:</strong> ${profile.personality_integration?.interaction_style?.tone || 'Not specified'}</p>\n <p><strong>Formality:</strong> ${profile.personality_integration?.interaction_style?.formality?.toFixed(2) || 'N/A'}</p>\n <p><strong>Values:</strong> ${profile.personality_integration?.recommendation_strategy?.values_alignment?.join(', ') || 'None'}</p>\n </div>\n\n <div class=\"section\">\n <h3>📦 UCP Capabilities</h3>\n <ul>\n ${Object.entries(profile.capabilities)\n .filter(([_, enabled]) => enabled)\n .map(([key, _]) => `<li>${key.replace(/_/g, ' ').replace(/\\b\\w/g, (word) => word.charAt(0).toUpperCase() + word.slice(1))}</li>`)\n .join('')}\n </ul>\n </div>\n\n <div class=\"section\">\n <h3>🔗 Endpoints</h3>\n <div class=\"endpoint\">\n <strong>UCP Profile:</strong><br>\n <code>/.well-known/ucp-profile.json</code>\n <code>/ucp/profile</code>\n </div>\n <div class=\"endpoint\">\n <strong>Health:</strong><br>\n <code>/health</code>\n </div>\n </div>\n\n <p style=\"color: #666; font-size: 14px; margin-top: 24px;\">\n 📖 Learn more about UCP at <a href=\"https://ucp.dev/\" target=\"_blank\" style=\"color: #4285f4;\">ucp.dev</a>\n </p>\n</body>\n</html>\n `\n res.writeHead(200, { 'Content-Type': 'text/html' })\n res.end(html)\n }\n\n // ============================================================\n // BaseAdapter Implementation\n // ============================================================\n\n async transform(input: { message: string }): Promise<{ content: string; format: string }> {\n // For UCP, we transform into profile format\n const profile = await this.generateProfile()\n return {\n content: JSON.stringify(profile, null, 2),\n format: 'json'\n }\n }\n\n async send(output: { content: string }): Promise<{ success: boolean; content?: string; error?: string }> {\n // For UCP, \"sending\" means serving the profile\n return {\n success: true,\n content: output.content\n }\n }\n\n async stop(): Promise<void> {\n if (this.server) {\n this.server.close()\n this.server = null\n }\n await this.dispose()\n }\n}\n"],"mappings":";;;;;AAYA,SAAS,gBAAgB,wBAAwB;AAe1C,IAAM,aAAN,cAAyB,sBAAsB;AAAA,EAC5C,SAAc;AAAA,EACd;AAAA,EACA,cAAmC;AAAA,EAE3C,YAAY,QAA2B;AACrC,UAAM,eAAe,EAAE,MAAM,cAAc,CAAC;AAC5C,SAAK,SAAS;AACd,SAAK,cAAc,OAAO;AAAA,EAC5B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,MAAM,kBAAuC;AAC3C,QAAI,CAAC,KAAK,aAAa;AACrB,YAAM,IAAI,MAAM,wBAAwB;AAAA,IAC1C;AAEA,UAAM,EAAE,aAAa,SAAS,IAAI,KAAK;AACvC,UAAM,EAAE,YAAY,cAAc,SAAS,qBAAqB,IAAI,KAAK;AAGzE,UAAM,EAAE,kBAAkB,IAAI,MAAM,OAAO,qBAAqB;AAChE,UAAM,eAAe,kBAAkB,KAAK,aAAa,UAAU;AAGnE,UAAM,SAAS,aAAa,QAAQ,IAAI,CAAC,MAAW,EAAE,IAAI,KAAK,CAAC;AAChE,UAAM,UAAU,aAAa,SAAS,IA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