@leanmcp/ui 0.3.6 → 0.3.7-alpha.6.6dae082

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/dist/server.js CHANGED
@@ -1,57 +1,57 @@
1
1
  'use strict';
2
2
 
3
- var chunk57VDL5UC_js = require('./chunk-57VDL5UC.js');
3
+ var chunk55345F7G_js = require('./chunk-55345F7G.js');
4
4
  var server = require('@modelcontextprotocol/ext-apps/server');
5
5
 
6
6
 
7
7
 
8
8
  Object.defineProperty(exports, "GPTApp", {
9
9
  enumerable: true,
10
- get: function () { return chunk57VDL5UC_js.GPTApp; }
10
+ get: function () { return chunk55345F7G_js.GPTApp; }
11
11
  });
12
12
  Object.defineProperty(exports, "GPT_APP_COMPONENT_KEY", {
13
13
  enumerable: true,
14
- get: function () { return chunk57VDL5UC_js.GPT_APP_COMPONENT_KEY; }
14
+ get: function () { return chunk55345F7G_js.GPT_APP_COMPONENT_KEY; }
15
15
  });
16
16
  Object.defineProperty(exports, "GPT_APP_OPTIONS_KEY", {
17
17
  enumerable: true,
18
- get: function () { return chunk57VDL5UC_js.GPT_APP_OPTIONS_KEY; }
18
+ get: function () { return chunk55345F7G_js.GPT_APP_OPTIONS_KEY; }
19
19
  });
20
20
  Object.defineProperty(exports, "GPT_APP_URI_KEY", {
21
21
  enumerable: true,
22
- get: function () { return chunk57VDL5UC_js.GPT_APP_URI_KEY; }
22
+ get: function () { return chunk55345F7G_js.GPT_APP_URI_KEY; }
23
23
  });
24
24
  Object.defineProperty(exports, "UIApp", {
25
25
  enumerable: true,
26
- get: function () { return chunk57VDL5UC_js.UIApp; }
26
+ get: function () { return chunk55345F7G_js.UIApp; }
27
27
  });
28
28
  Object.defineProperty(exports, "UI_APP_COMPONENT_KEY", {
29
29
  enumerable: true,
30
- get: function () { return chunk57VDL5UC_js.UI_APP_COMPONENT_KEY; }
30
+ get: function () { return chunk55345F7G_js.UI_APP_COMPONENT_KEY; }
31
31
  });
32
32
  Object.defineProperty(exports, "UI_APP_OPTIONS_KEY", {
33
33
  enumerable: true,
34
- get: function () { return chunk57VDL5UC_js.UI_APP_OPTIONS_KEY; }
34
+ get: function () { return chunk55345F7G_js.UI_APP_OPTIONS_KEY; }
35
35
  });
36
36
  Object.defineProperty(exports, "UI_APP_URI_KEY", {
37
37
  enumerable: true,
38
- get: function () { return chunk57VDL5UC_js.UI_APP_URI_KEY; }
38
+ get: function () { return chunk55345F7G_js.UI_APP_URI_KEY; }
39
39
  });
40
40
  Object.defineProperty(exports, "getGPTAppMetadata", {
41
41
  enumerable: true,
42
- get: function () { return chunk57VDL5UC_js.getGPTAppMetadata; }
42
+ get: function () { return chunk55345F7G_js.getGPTAppMetadata; }
43
43
  });
44
44
  Object.defineProperty(exports, "getGPTAppUri", {
45
45
  enumerable: true,
46
- get: function () { return chunk57VDL5UC_js.getGPTAppUri; }
46
+ get: function () { return chunk55345F7G_js.getGPTAppUri; }
47
47
  });
48
48
  Object.defineProperty(exports, "getUIAppMetadata", {
49
49
  enumerable: true,
50
- get: function () { return chunk57VDL5UC_js.getUIAppMetadata; }
50
+ get: function () { return chunk55345F7G_js.getUIAppMetadata; }
51
51
  });
52
52
  Object.defineProperty(exports, "getUIAppUri", {
53
53
  enumerable: true,
54
- get: function () { return chunk57VDL5UC_js.getUIAppUri; }
54
+ get: function () { return chunk55345F7G_js.getUIAppUri; }
55
55
  });
56
56
  Object.defineProperty(exports, "RESOURCE_MIME_TYPE", {
57
57
  enumerable: true,
package/dist/server.mjs CHANGED
@@ -1,4 +1,4 @@
1
- export { GPTApp, GPT_APP_COMPONENT_KEY, GPT_APP_OPTIONS_KEY, GPT_APP_URI_KEY, UIApp, UI_APP_COMPONENT_KEY, UI_APP_OPTIONS_KEY, UI_APP_URI_KEY, getGPTAppMetadata, getGPTAppUri, getUIAppMetadata, getUIAppUri } from './chunk-5RGEQPF3.mjs';
1
+ export { GPTApp, GPT_APP_COMPONENT_KEY, GPT_APP_OPTIONS_KEY, GPT_APP_URI_KEY, UIApp, UI_APP_COMPONENT_KEY, UI_APP_OPTIONS_KEY, UI_APP_URI_KEY, getGPTAppMetadata, getGPTAppUri, getUIAppMetadata, getUIAppUri } from './chunk-XLPJFQ74.mjs';
2
2
  export { RESOURCE_MIME_TYPE, RESOURCE_URI_META_KEY, registerAppResource, registerAppTool } from '@modelcontextprotocol/ext-apps/server';
3
3
  //# sourceMappingURL=server.mjs.map
4
4
  //# sourceMappingURL=server.mjs.map
package/package.json CHANGED
@@ -1,111 +1,111 @@
1
1
  {
2
- "name": "@leanmcp/ui",
3
- "version": "0.3.6",
4
- "description": "MCP-Native UI SDK - React components with first-class tool integration for building MCP Apps",
5
- "main": "dist/index.js",
6
- "module": "dist/index.mjs",
7
- "types": "dist/index.d.ts",
8
- "exports": {
9
- ".": {
10
- "types": "./dist/index.d.ts",
11
- "require": "./dist/index.js",
12
- "import": "./dist/index.mjs"
13
- },
14
- "./client": {
15
- "types": "./dist/index.d.ts",
16
- "require": "./dist/index.js",
17
- "import": "./dist/index.mjs"
18
- },
19
- "./server": {
20
- "types": "./dist/server.d.ts",
21
- "require": "./dist/server.js",
22
- "import": "./dist/server.mjs"
23
- },
24
- "./styles.css": "./dist/index.css"
2
+ "name": "@leanmcp/ui",
3
+ "version": "0.3.7-alpha.6.6dae082",
4
+ "description": "MCP-Native UI SDK - React components with first-class tool integration for building MCP Apps",
5
+ "main": "dist/index.js",
6
+ "module": "dist/index.mjs",
7
+ "types": "dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "require": "./dist/index.js",
12
+ "import": "./dist/index.mjs"
25
13
  },
26
- "sideEffects": [
27
- "*.css"
28
- ],
29
- "files": [
30
- "dist",
31
- "README.md",
32
- "LICENSE"
33
- ],
34
- "scripts": {
35
- "build": "tsup src/index.ts src/server.ts --format esm,cjs --dts",
36
- "dev": "tsup src/index.ts src/server.ts --format esm,cjs --dts --watch",
37
- "showcase": "vite --config vite.showcase.config.ts",
38
- "test": "jest --passWithNoTests",
39
- "clean": "rm -rf dist"
14
+ "./client": {
15
+ "types": "./dist/index.d.ts",
16
+ "require": "./dist/index.js",
17
+ "import": "./dist/index.mjs"
40
18
  },
41
- "peerDependencies": {
42
- "react": "^18.0.0 || ^19.0.0",
43
- "react-dom": "^18.0.0 || ^19.0.0"
19
+ "./server": {
20
+ "types": "./dist/server.d.ts",
21
+ "require": "./dist/server.js",
22
+ "import": "./dist/server.mjs"
44
23
  },
45
- "dependencies": {
46
- "@hookform/resolvers": "^5.2.2",
47
- "@modelcontextprotocol/ext-apps": "^0.2.2",
48
- "@modelcontextprotocol/sdk": "^1.23.0",
49
- "@radix-ui/react-checkbox": "^1.3.3",
50
- "@radix-ui/react-dialog": "^1.1.15",
51
- "@radix-ui/react-dropdown-menu": "^2.1.16",
52
- "@radix-ui/react-label": "^2.1.8",
53
- "@radix-ui/react-popover": "^1.1.15",
54
- "@radix-ui/react-progress": "^1.1.8",
55
- "@radix-ui/react-scroll-area": "^1.2.10",
56
- "@radix-ui/react-select": "^2.2.6",
57
- "@radix-ui/react-separator": "^1.1.8",
58
- "@radix-ui/react-slider": "^1.3.6",
59
- "@radix-ui/react-slot": "^1.2.4",
60
- "@radix-ui/react-switch": "^1.2.6",
61
- "@radix-ui/react-tabs": "^1.1.13",
62
- "@radix-ui/react-tooltip": "^1.2.8",
63
- "@tanstack/react-table": "^8.20.6",
64
- "autoprefixer": "^10.4.23",
65
- "chart.js": "^4.4.7",
66
- "class-variance-authority": "^0.7.1",
67
- "clsx": "^2.1.1",
68
- "cmdk": "^1.1.1",
69
- "lucide-react": "^0.561.0",
70
- "next-themes": "^0.4.6",
71
- "postcss": "^8.5.6",
72
- "prism-react-renderer": "^2.4.1",
73
- "react-chartjs-2": "^5.3.0",
74
- "react-hook-form": "^7.68.0",
75
- "reflect-metadata": "^0.2.2",
76
- "sonner": "^2.0.7",
77
- "tailwind-merge": "^3.4.0",
78
- "tailwindcss": "^3.4.17",
79
- "tailwindcss-animate": "^1.0.7",
80
- "zod": "^4.2.1"
81
- },
82
- "devDependencies": {
83
- "@types/react": "^18.3.0",
84
- "@types/react-dom": "^18.3.0",
85
- "react": "^18.3.0",
86
- "react-dom": "^18.3.0",
87
- "tsup": "^8.5.1"
88
- },
89
- "repository": {
90
- "type": "git",
91
- "url": "git+https://github.com/LeanMCP/leanmcp-sdk.git",
92
- "directory": "packages/ui"
93
- },
94
- "homepage": "https://github.com/LeanMCP/leanmcp-sdk#readme",
95
- "bugs": {
96
- "url": "https://github.com/LeanMCP/leanmcp-sdk/issues"
97
- },
98
- "keywords": [
99
- "mcp",
100
- "mcp-apps",
101
- "model-context-protocol",
102
- "react",
103
- "ui",
104
- "components"
105
- ],
106
- "author": "LeanMCP <admin@leanmcp.com>",
107
- "license": "MIT",
108
- "publishConfig": {
109
- "access": "public"
110
- }
24
+ "./styles.css": "./dist/index.css"
25
+ },
26
+ "sideEffects": [
27
+ "*.css"
28
+ ],
29
+ "files": [
30
+ "dist",
31
+ "README.md",
32
+ "LICENSE"
33
+ ],
34
+ "scripts": {
35
+ "build": "tsup src/index.ts src/server.ts --format esm,cjs --dts",
36
+ "dev": "tsup src/index.ts src/server.ts --format esm,cjs --dts --watch",
37
+ "showcase": "vite --config vite.showcase.config.ts",
38
+ "test": "jest --passWithNoTests",
39
+ "clean": "rm -rf dist"
40
+ },
41
+ "peerDependencies": {
42
+ "react": "^18.0.0 || ^19.0.0",
43
+ "react-dom": "^18.0.0 || ^19.0.0"
44
+ },
45
+ "dependencies": {
46
+ "@hookform/resolvers": "^5.2.2",
47
+ "@modelcontextprotocol/ext-apps": "^0.2.2",
48
+ "@modelcontextprotocol/sdk": "^1.23.0",
49
+ "@radix-ui/react-checkbox": "^1.3.3",
50
+ "@radix-ui/react-dialog": "^1.1.15",
51
+ "@radix-ui/react-dropdown-menu": "^2.1.16",
52
+ "@radix-ui/react-label": "^2.1.8",
53
+ "@radix-ui/react-popover": "^1.1.15",
54
+ "@radix-ui/react-progress": "^1.1.8",
55
+ "@radix-ui/react-scroll-area": "^1.2.10",
56
+ "@radix-ui/react-select": "^2.2.6",
57
+ "@radix-ui/react-separator": "^1.1.8",
58
+ "@radix-ui/react-slider": "^1.3.6",
59
+ "@radix-ui/react-slot": "^1.2.4",
60
+ "@radix-ui/react-switch": "^1.2.6",
61
+ "@radix-ui/react-tabs": "^1.1.13",
62
+ "@radix-ui/react-tooltip": "^1.2.8",
63
+ "@tanstack/react-table": "^8.20.6",
64
+ "autoprefixer": "^10.4.23",
65
+ "chart.js": "^4.4.7",
66
+ "class-variance-authority": "^0.7.1",
67
+ "clsx": "^2.1.1",
68
+ "cmdk": "^1.1.1",
69
+ "lucide-react": "^0.561.0",
70
+ "next-themes": "^0.4.6",
71
+ "postcss": "^8.5.6",
72
+ "prism-react-renderer": "^2.4.1",
73
+ "react-chartjs-2": "^5.3.0",
74
+ "react-hook-form": "^7.68.0",
75
+ "reflect-metadata": "^0.2.2",
76
+ "sonner": "^2.0.7",
77
+ "tailwind-merge": "^3.4.0",
78
+ "tailwindcss": "^3.4.17",
79
+ "tailwindcss-animate": "^1.0.7",
80
+ "zod": "^4.2.1"
81
+ },
82
+ "devDependencies": {
83
+ "@types/react": "^18.3.0",
84
+ "@types/react-dom": "^18.3.0",
85
+ "react": "^18.3.0",
86
+ "react-dom": "^18.3.0",
87
+ "tsup": "^8.5.1"
88
+ },
89
+ "repository": {
90
+ "type": "git",
91
+ "url": "git+https://github.com/LeanMCP/leanmcp-sdk.git",
92
+ "directory": "packages/ui"
93
+ },
94
+ "homepage": "https://github.com/LeanMCP/leanmcp-sdk#readme",
95
+ "bugs": {
96
+ "url": "https://github.com/LeanMCP/leanmcp-sdk/issues"
97
+ },
98
+ "keywords": [
99
+ "mcp",
100
+ "mcp-apps",
101
+ "model-context-protocol",
102
+ "react",
103
+ "ui",
104
+ "components"
105
+ ],
106
+ "author": "LeanMCP <admin@leanmcp.com>",
107
+ "license": "MIT",
108
+ "publishConfig": {
109
+ "access": "public"
110
+ }
111
111
  }
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/decorator/UIApp.ts","../src/decorator/GPTApp.ts"],"names":["UI_APP_COMPONENT_KEY","UI_APP_URI_KEY","UI_APP_OPTIONS_KEY","UIApp","options","target","propertyKey","descriptor","methodName","String","className","name","toLowerCase","replace","uri","Reflect","defineMetadata","component","value","existingMeta","getMetadata","ui","resourceUri","getUIAppMetadata","undefined","getUIAppUri","GPT_APP_COMPONENT_KEY","GPT_APP_URI_KEY","GPT_APP_OPTIONS_KEY","GPTApp","uiMeta","visibility","openAiMeta","widgetAccessible","prefersBorder","widgetDomain","widgetDescription","csp","fileParams","invocation","invoking","invoked","getGPTAppMetadata","getGPTAppUri"],"mappings":";;;;;;AAcO,IAAMA,oBAAAA,GAAuB;AAC7B,IAAMC,cAAAA,GAAiB;AACvB,IAAMC,kBAAAA,GAAqB;AA0C3B,SAASC,MAAMC,OAAAA,EAAqB;AACvC,EAAA,OAAO,CAACC,MAAAA,EAAgBC,WAAAA,EAA8BC,UAAAA,KAAAA;AAClD,IAAA,MAAMC,UAAAA,GAAaC,OAAOH,WAAAA,CAAAA;AAE1B,IAAA,MAAMI,SAAAA,GAAYL,OAAO,WAAA,CAAYM,IAAAA,CAAKC,aAAW,CAAGC,OAAAA,CAAQ,WAAW,EAAA,CAAA;AAG3E,IAAA,MAAMC,MAAMV,OAAAA,CAAQU,GAAAA,IAAO,CAAA,KAAA,EAAQJ,SAAAA,IAAaF,UAAAA,CAAAA,CAAAA;AAGhDO,IAAAA,OAAAA,CAAQC,cAAAA,CAAehB,oBAAAA,EAAsBI,OAAAA,CAAQa,SAAAA,EAAWV,WAAWW,KAAK,CAAA;AAChFH,IAAAA,OAAAA,CAAQC,cAAAA,CAAef,cAAAA,EAAgBa,GAAAA,EAAKP,UAAAA,CAAWW,KAAK,CAAA;AAC5DH,IAAAA,OAAAA,CAAQC,cAAAA,CAAed,kBAAAA,EAAoBE,OAAAA,EAASG,UAAAA,CAAWW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A,CAAAA;AAgFT,SAASa,kBAAkBrC,MAAAA,EAAgB;AAC9C,EAAA,MAAMY,SAAAA,GAAYF,OAAAA,CAAQK,WAAAA,CAAYM,qBAAAA,EAAuBrB,MAAAA,CAAAA;AAC7D,EAAA,IAAI,CAACY,WAAW,OAAOO,MAAAA;AAEvB,EAAA,OAAO;AACHP,IAAAA,SAAAA;IACAH,GAAAA,EAAKC,OAAAA,CAAQK,WAAAA,CAAYO,eAAAA,EAAiBtB,MAAAA,CAAAA;IAC1C,GAAGU,OAAAA,CAAQK,WAAAA,CAAYQ,mBAAAA,EAAqBvB,MAAAA;AAChD,GAAA;AACJ;AATgBqC,MAAAA,CAAAA,iBAAAA,EAAAA,mBAAAA,CAAAA;AAcT,SAASC,aAAatC,MAAAA,EAAgB;AACzC,EAAA,OAAOU,OAAAA,CAAQK,WAAAA,CAAYO,eAAAA,EAAiBtB,MAAAA,CAAAA;AAChD;AAFgBsC,MAAAA,CAAAA,YAAAA,EAAAA,cAAAA,CAAAA","file":"chunk-57VDL5UC.js","sourcesContent":["/**\n * @UIApp Decorator\n * \n * Links an MCP tool to a React UI component.\n * When applied to a tool method, it:\n * 1. Adds _meta.ui/resourceUri to the tool definition\n * 2. Auto-registers a resource that renders the component to HTML\n * \n * This decorator is designed to work with @leanmcp/core decorators.\n */\nimport 'reflect-metadata';\nimport type React from 'react';\n\n// Metadata keys\nexport const UI_APP_COMPONENT_KEY = 'ui:app:component';\nexport const UI_APP_URI_KEY = 'ui:app:uri';\nexport const UI_APP_OPTIONS_KEY = 'ui:app:options';\n\n/**\n * Options for @UIApp decorator\n */\nexport interface UIAppOptions {\n /** \n * React component or path to component file (relative to service file).\n * - Use path string (e.g., './WeatherCard') for CLI build - avoids importing browser code in server\n * - Use component reference for direct SSR rendering\n */\n component: React.ComponentType<any> | string;\n /** Custom resource URI (auto-generated if not provided) */\n uri?: string;\n /** HTML document title */\n title?: string;\n /** Additional CSS styles */\n styles?: string;\n}\n\n\n/**\n * Decorator that links a tool to a UI component.\n * \n * When the tool is called, the host will fetch the UI resource\n * which returns the component rendered as HTML.\n * \n * @example\n * ```typescript\n * import { Tool } from '@leanmcp/core';\n * import { UIApp } from '@leanmcp/ui';\n * import { WeatherCard } from './WeatherCard';\n * \n * class WeatherService {\n * @Tool({ description: 'Get weather for a city' })\n * @UIApp({ component: WeatherCard })\n * async getWeather(args: { city: string }) {\n * return { city: args.city, temp: 22 };\n * }\n * }\n * ```\n */\nexport function UIApp(options: UIAppOptions): MethodDecorator {\n return (target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor) => {\n const methodName = String(propertyKey);\n // Use same pattern as @Resource in @leanmcp/core: className without 'service' suffix\n const className = target.constructor.name.toLowerCase().replace('service', '');\n\n // Generate URI using ui:// scheme (required by ext-apps hosts)\n const uri = options.uri ?? `ui://${className}/${methodName}`;\n\n // Store metadata on the method\n Reflect.defineMetadata(UI_APP_COMPONENT_KEY, options.component, descriptor.value!);\n Reflect.defineMetadata(UI_APP_URI_KEY, uri, descriptor.value!);\n Reflect.defineMetadata(UI_APP_OPTIONS_KEY, options, descriptor.value!);\n\n // Also store the resource URI for the @Tool decorator to pick up\n // The @Tool decorator in @leanmcp/core should check for this\n const existingMeta = Reflect.getMetadata('tool:meta', descriptor.value) || {};\n Reflect.defineMetadata('tool:meta', {\n ...existingMeta,\n // New nested format (preferred by ext-apps 0.2.2)\n ui: {\n resourceUri: uri,\n },\n // Legacy flat format (for backwards compatibility)\n 'ui/resourceUri': uri,\n }, descriptor.value!);\n\n return descriptor;\n };\n}\n\n/**\n * Helper to get UIApp metadata from a method\n */\nexport function getUIAppMetadata(target: Function): UIAppOptions | undefined {\n const component = Reflect.getMetadata(UI_APP_COMPONENT_KEY, target);\n if (!component) return undefined;\n\n return {\n component,\n uri: Reflect.getMetadata(UI_APP_URI_KEY, target),\n ...Reflect.getMetadata(UI_APP_OPTIONS_KEY, target),\n };\n}\n\n/**\n * Helper to get the resource URI from a method\n */\nexport function getUIAppUri(target: Function): string | undefined {\n return Reflect.getMetadata(UI_APP_URI_KEY, target);\n}\n","/**\n * @GPTApp Decorator\n * \n * Links an MCP tool to a React UI component compliant with ChatGPT Apps SDK.\n * \n * When applied to a tool method, it:\n * 1. Adds _meta.ui/resourceUri to the tool definition\n * 2. Adds OpenAI-specific metadata (widgetAccessible, outputTemplate, etc.)\n * 3. Auto-registers a resource that renders the component to HTML with 'text/html+skybridge' mimeType\n */\nimport 'reflect-metadata';\nimport type React from 'react';\n\n// Metadata keys\nexport const GPT_APP_COMPONENT_KEY = 'gptapp:component';\nexport const GPT_APP_URI_KEY = 'gptapp:uri';\nexport const GPT_APP_OPTIONS_KEY = 'gptapp:options';\n\n/**\n * Options for @GPTApp decorator\n */\nexport interface GPTAppOptions {\n /** \n * React component or path to component file (relative to service file).\n * - Use path string (e.g., './WeatherCard') for CLI build - avoids importing browser code in server\n * - Use component reference for direct SSR rendering\n */\n component: React.ComponentType<any> | string;\n\n /** Custom resource URI (auto-generated ui://... if not provided) */\n uri?: string;\n\n /** HTML document title */\n title?: string;\n\n /** Additional CSS styles */\n styles?: string;\n\n // ========== GPT-specific options ==========\n\n /** \n * Allow widget to call tools via window.openai.callTool.\n * Maps to _meta[\"openai/widgetAccessible\"]\n */\n widgetAccessible?: boolean;\n\n /** \n * Tool visibility: 'public' (default) or 'private'.\n * 'private' hides the tool from the model but keeps it callable by the widget.\n * Maps to _meta[\"openai/visibility\"]\n */\n visibility?: 'public' | 'private';\n\n /** \n * Widget prefers border around iframe.\n * Maps to _meta[\"openai/widgetPrefersBorder\"]\n */\n prefersBorder?: boolean;\n\n /** \n * Widget domain for API allowlists.\n * Maps to _meta[\"openai/widgetDomain\"]\n */\n widgetDomain?: string;\n\n /** \n * Widget description for the model.\n * Maps to _meta[\"openai/widgetDescription\"]\n */\n widgetDescription?: string;\n\n /** \n * Content Security Policy configuration.\n * Maps to _meta[\"openai/widgetCSP\"]\n */\n csp?: {\n connect_domains?: string[];\n resource_domains?: string[];\n redirect_domains?: string[];\n frame_domains?: string[];\n };\n\n /** \n * File parameters (fields treated as file uploads).\n * Maps to _meta[\"openai/fileParams\"]\n */\n fileParams?: string[];\n\n /** \n * Invocation messages shown during tool call.\n * Maps to _meta[\"openai/toolInvocation\"]\n */\n invocation?: {\n invoking?: string; // e.g., \"Preparing the board…\"\n invoked?: string; // e.g., \"Board ready.\"\n };\n}\n\n\n/**\n * Decorator that links a tool to a UI component for ChatGPT Apps.\n * \n * When the tool is called, the host will fetch the UI resource\n * which returns the component rendered as HTML with 'text/html+skybridge'.\n * \n * @example\n * ```typescript\n * import { Tool } from '@leanmcp/core';\n * import { GPTApp } from '@leanmcp/ui';\n * import { KanbanBoard } from './KanbanBoard';\n * \n * class KanbanService {\n * @Tool({ description: 'Show Kanban Board' })\n * @GPTApp({ \n * component: KanbanBoard,\n * widgetAccessible: true,\n * invocation: { invoking: 'Loading board...' }\n * })\n * async showBoard() { ... }\n * }\n * ```\n */\nexport function GPTApp(options: GPTAppOptions): MethodDecorator {\n return (target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor) => {\n const methodName = String(propertyKey);\n // Use same pattern as @Resource in @leanmcp/core: className without 'service' suffix\n const className = target.constructor.name.toLowerCase().replace('service', '');\n\n // Generate URI using ui:// scheme (required by ext-apps hosts)\n const uri = options.uri ?? `ui://${className}/${methodName}`;\n\n // Store metadata on the method\n Reflect.defineMetadata(GPT_APP_COMPONENT_KEY, options.component, descriptor.value!);\n Reflect.defineMetadata(GPT_APP_URI_KEY, uri, descriptor.value!);\n Reflect.defineMetadata(GPT_APP_OPTIONS_KEY, options, descriptor.value!);\n\n // Also store the resource URI and OpenAI-specific metadata for the @Tool decorator to pick up\n const existingMeta = Reflect.getMetadata('tool:meta', descriptor.value) || {};\n\n // Build nested ui metadata (preferred by ext-apps 0.2.2)\n const uiMeta: Record<string, any> = {\n resourceUri: uri,\n };\n\n // Map visibility to ext-apps format\n if (options.visibility) {\n uiMeta.visibility = options.visibility === 'private' ? ['app'] : ['model', 'app'];\n }\n\n const openAiMeta: Record<string, any> = {\n // New nested format (preferred by ext-apps 0.2.2)\n ui: uiMeta,\n // Legacy flat format (for backwards compatibility)\n 'ui/resourceUri': uri,\n 'openai/outputTemplate': uri,\n };\n\n if (options.widgetAccessible !== undefined) {\n openAiMeta['openai/widgetAccessible'] = options.widgetAccessible;\n }\n\n if (options.visibility) {\n openAiMeta['openai/visibility'] = options.visibility;\n }\n\n if (options.prefersBorder !== undefined) {\n openAiMeta['openai/widgetPrefersBorder'] = options.prefersBorder;\n }\n\n if (options.widgetDomain) {\n openAiMeta['openai/widgetDomain'] = options.widgetDomain;\n }\n\n if (options.widgetDescription) {\n openAiMeta['openai/widgetDescription'] = options.widgetDescription;\n }\n\n if (options.csp) {\n openAiMeta['openai/widgetCSP'] = options.csp;\n }\n\n if (options.fileParams) {\n openAiMeta['openai/fileParams'] = options.fileParams;\n }\n\n if (options.invocation) {\n if (options.invocation.invoking) openAiMeta['openai/toolInvocation/invoking'] = options.invocation.invoking;\n if (options.invocation.invoked) openAiMeta['openai/toolInvocation/invoked'] = options.invocation.invoked;\n }\n\n Reflect.defineMetadata('tool:meta', {\n ...existingMeta,\n ...openAiMeta,\n }, descriptor.value!);\n\n return descriptor;\n };\n}\n\n/**\n * Helper to get GPTApp metadata from a method\n */\nexport function getGPTAppMetadata(target: Function): GPTAppOptions | undefined {\n const component = Reflect.getMetadata(GPT_APP_COMPONENT_KEY, target);\n if (!component) return undefined;\n\n return {\n component,\n uri: Reflect.getMetadata(GPT_APP_URI_KEY, target),\n ...Reflect.getMetadata(GPT_APP_OPTIONS_KEY, target),\n };\n}\n\n/**\n * Helper to get the resource URI from a method\n */\nexport function getGPTAppUri(target: Function): string | undefined {\n return Reflect.getMetadata(GPT_APP_URI_KEY, target);\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/decorator/UIApp.ts","../src/decorator/GPTApp.ts"],"names":["UI_APP_COMPONENT_KEY","UI_APP_URI_KEY","UI_APP_OPTIONS_KEY","UIApp","options","target","propertyKey","descriptor","methodName","String","className","name","toLowerCase","replace","uri","Reflect","defineMetadata","component","value","existingMeta","getMetadata","ui","resourceUri","getUIAppMetadata","undefined","getUIAppUri","GPT_APP_COMPONENT_KEY","GPT_APP_URI_KEY","GPT_APP_OPTIONS_KEY","GPTApp","uiMeta","visibility","openAiMeta","widgetAccessible","prefersBorder","widgetDomain","widgetDescription","csp","fileParams","invocation","invoking","invoked","getGPTAppMetadata","getGPTAppUri"],"mappings":";;;;AAcO,IAAMA,oBAAAA,GAAuB;AAC7B,IAAMC,cAAAA,GAAiB;AACvB,IAAMC,kBAAAA,GAAqB;AA0C3B,SAASC,MAAMC,OAAAA,EAAqB;AACvC,EAAA,OAAO,CAACC,MAAAA,EAAgBC,WAAAA,EAA8BC,UAAAA,KAAAA;AAClD,IAAA,MAAMC,UAAAA,GAAaC,OAAOH,WAAAA,CAAAA;AAE1B,IAAA,MAAMI,SAAAA,GAAYL,OAAO,WAAA,CAAYM,IAAAA,CAAKC,aAAW,CAAGC,OAAAA,CAAQ,WAAW,EAAA,CAAA;AAG3E,IAAA,MAAMC,MAAMV,OAAAA,CAAQU,GAAAA,IAAO,CAAA,KAAA,EAAQJ,SAAAA,IAAaF,UAAAA,CAAAA,CAAAA;AAGhDO,IAAAA,OAAAA,CAAQC,cAAAA,CAAehB,oBAAAA,EAAsBI,OAAAA,CAAQa,SAAAA,EAAWV,WAAWW,KAAK,CAAA;AAChFH,IAAAA,OAAAA,CAAQC,cAAAA,CAAef,cAAAA,EAAgBa,GAAAA,EAAKP,UAAAA,CAAWW,KAAK,CAAA;AAC5DH,IAAAA,OAAAA,CAAQC,cAAAA,CAAed,kBAAAA,EAAoBE,OAAAA,EAASG,UAAAA,CAAWW,KAAK,CAAA;AAIpE,IAAA,MAAMC,eAAeJ,OAAAA,CAAQK,WAAAA,CAAY,aAAab,UAAAA,CAAWW,KAAK,KAAK,EAAC;AAC5EH,IAAAA,OAAAA,CAAQC,eAAe,WAAA,EA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AAA,IAAI,CAACY,WAAW,OAAOO,MAAAA;AAEvB,EAAA,OAAO;AACHP,IAAAA,SAAAA;IACAH,GAAAA,EAAKC,OAAAA,CAAQK,WAAAA,CAAYO,eAAAA,EAAiBtB,MAAAA,CAAAA;IAC1C,GAAGU,OAAAA,CAAQK,WAAAA,CAAYQ,mBAAAA,EAAqBvB,MAAAA;AAChD,GAAA;AACJ;AATgBqC,MAAAA,CAAAA,iBAAAA,EAAAA,mBAAAA,CAAAA;AAcT,SAASC,aAAatC,MAAAA,EAAgB;AACzC,EAAA,OAAOU,OAAAA,CAAQK,WAAAA,CAAYO,eAAAA,EAAiBtB,MAAAA,CAAAA;AAChD;AAFgBsC,MAAAA,CAAAA,YAAAA,EAAAA,cAAAA,CAAAA","file":"chunk-5RGEQPF3.mjs","sourcesContent":["/**\n * @UIApp Decorator\n * \n * Links an MCP tool to a React UI component.\n * When applied to a tool method, it:\n * 1. Adds _meta.ui/resourceUri to the tool definition\n * 2. Auto-registers a resource that renders the component to HTML\n * \n * This decorator is designed to work with @leanmcp/core decorators.\n */\nimport 'reflect-metadata';\nimport type React from 'react';\n\n// Metadata keys\nexport const UI_APP_COMPONENT_KEY = 'ui:app:component';\nexport const UI_APP_URI_KEY = 'ui:app:uri';\nexport const UI_APP_OPTIONS_KEY = 'ui:app:options';\n\n/**\n * Options for @UIApp decorator\n */\nexport interface UIAppOptions {\n /** \n * React component or path to component file (relative to service file).\n * - Use path string (e.g., './WeatherCard') for CLI build - avoids importing browser code in server\n * - Use component reference for direct SSR rendering\n */\n component: React.ComponentType<any> | string;\n /** Custom resource URI (auto-generated if not provided) */\n uri?: string;\n /** HTML document title */\n title?: string;\n /** Additional CSS styles */\n styles?: string;\n}\n\n\n/**\n * Decorator that links a tool to a UI component.\n * \n * When the tool is called, the host will fetch the UI resource\n * which returns the component rendered as HTML.\n * \n * @example\n * ```typescript\n * import { Tool } from '@leanmcp/core';\n * import { UIApp } from '@leanmcp/ui';\n * import { WeatherCard } from './WeatherCard';\n * \n * class WeatherService {\n * @Tool({ description: 'Get weather for a city' })\n * @UIApp({ component: WeatherCard })\n * async getWeather(args: { city: string }) {\n * return { city: args.city, temp: 22 };\n * }\n * }\n * ```\n */\nexport function UIApp(options: UIAppOptions): MethodDecorator {\n return (target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor) => {\n const methodName = String(propertyKey);\n // Use same pattern as @Resource in @leanmcp/core: className without 'service' suffix\n const className = target.constructor.name.toLowerCase().replace('service', '');\n\n // Generate URI using ui:// scheme (required by ext-apps hosts)\n const uri = options.uri ?? `ui://${className}/${methodName}`;\n\n // Store metadata on the method\n Reflect.defineMetadata(UI_APP_COMPONENT_KEY, options.component, descriptor.value!);\n Reflect.defineMetadata(UI_APP_URI_KEY, uri, descriptor.value!);\n Reflect.defineMetadata(UI_APP_OPTIONS_KEY, options, descriptor.value!);\n\n // Also store the resource URI for the @Tool decorator to pick up\n // The @Tool decorator in @leanmcp/core should check for this\n const existingMeta = Reflect.getMetadata('tool:meta', descriptor.value) || {};\n Reflect.defineMetadata('tool:meta', {\n ...existingMeta,\n // New nested format (preferred by ext-apps 0.2.2)\n ui: {\n resourceUri: uri,\n },\n // Legacy flat format (for backwards compatibility)\n 'ui/resourceUri': uri,\n }, descriptor.value!);\n\n return descriptor;\n };\n}\n\n/**\n * Helper to get UIApp metadata from a method\n */\nexport function getUIAppMetadata(target: Function): UIAppOptions | undefined {\n const component = Reflect.getMetadata(UI_APP_COMPONENT_KEY, target);\n if (!component) return undefined;\n\n return {\n component,\n uri: Reflect.getMetadata(UI_APP_URI_KEY, target),\n ...Reflect.getMetadata(UI_APP_OPTIONS_KEY, target),\n };\n}\n\n/**\n * Helper to get the resource URI from a method\n */\nexport function getUIAppUri(target: Function): string | undefined {\n return Reflect.getMetadata(UI_APP_URI_KEY, target);\n}\n","/**\n * @GPTApp Decorator\n * \n * Links an MCP tool to a React UI component compliant with ChatGPT Apps SDK.\n * \n * When applied to a tool method, it:\n * 1. Adds _meta.ui/resourceUri to the tool definition\n * 2. Adds OpenAI-specific metadata (widgetAccessible, outputTemplate, etc.)\n * 3. Auto-registers a resource that renders the component to HTML with 'text/html+skybridge' mimeType\n */\nimport 'reflect-metadata';\nimport type React from 'react';\n\n// Metadata keys\nexport const GPT_APP_COMPONENT_KEY = 'gptapp:component';\nexport const GPT_APP_URI_KEY = 'gptapp:uri';\nexport const GPT_APP_OPTIONS_KEY = 'gptapp:options';\n\n/**\n * Options for @GPTApp decorator\n */\nexport interface GPTAppOptions {\n /** \n * React component or path to component file (relative to service file).\n * - Use path string (e.g., './WeatherCard') for CLI build - avoids importing browser code in server\n * - Use component reference for direct SSR rendering\n */\n component: React.ComponentType<any> | string;\n\n /** Custom resource URI (auto-generated ui://... if not provided) */\n uri?: string;\n\n /** HTML document title */\n title?: string;\n\n /** Additional CSS styles */\n styles?: string;\n\n // ========== GPT-specific options ==========\n\n /** \n * Allow widget to call tools via window.openai.callTool.\n * Maps to _meta[\"openai/widgetAccessible\"]\n */\n widgetAccessible?: boolean;\n\n /** \n * Tool visibility: 'public' (default) or 'private'.\n * 'private' hides the tool from the model but keeps it callable by the widget.\n * Maps to _meta[\"openai/visibility\"]\n */\n visibility?: 'public' | 'private';\n\n /** \n * Widget prefers border around iframe.\n * Maps to _meta[\"openai/widgetPrefersBorder\"]\n */\n prefersBorder?: boolean;\n\n /** \n * Widget domain for API allowlists.\n * Maps to _meta[\"openai/widgetDomain\"]\n */\n widgetDomain?: string;\n\n /** \n * Widget description for the model.\n * Maps to _meta[\"openai/widgetDescription\"]\n */\n widgetDescription?: string;\n\n /** \n * Content Security Policy configuration.\n * Maps to _meta[\"openai/widgetCSP\"]\n */\n csp?: {\n connect_domains?: string[];\n resource_domains?: string[];\n redirect_domains?: string[];\n frame_domains?: string[];\n };\n\n /** \n * File parameters (fields treated as file uploads).\n * Maps to _meta[\"openai/fileParams\"]\n */\n fileParams?: string[];\n\n /** \n * Invocation messages shown during tool call.\n * Maps to _meta[\"openai/toolInvocation\"]\n */\n invocation?: {\n invoking?: string; // e.g., \"Preparing the board…\"\n invoked?: string; // e.g., \"Board ready.\"\n };\n}\n\n\n/**\n * Decorator that links a tool to a UI component for ChatGPT Apps.\n * \n * When the tool is called, the host will fetch the UI resource\n * which returns the component rendered as HTML with 'text/html+skybridge'.\n * \n * @example\n * ```typescript\n * import { Tool } from '@leanmcp/core';\n * import { GPTApp } from '@leanmcp/ui';\n * import { KanbanBoard } from './KanbanBoard';\n * \n * class KanbanService {\n * @Tool({ description: 'Show Kanban Board' })\n * @GPTApp({ \n * component: KanbanBoard,\n * widgetAccessible: true,\n * invocation: { invoking: 'Loading board...' }\n * })\n * async showBoard() { ... }\n * }\n * ```\n */\nexport function GPTApp(options: GPTAppOptions): MethodDecorator {\n return (target: Object, propertyKey: string | symbol, descriptor: PropertyDescriptor) => {\n const methodName = String(propertyKey);\n // Use same pattern as @Resource in @leanmcp/core: className without 'service' suffix\n const className = target.constructor.name.toLowerCase().replace('service', '');\n\n // Generate URI using ui:// scheme (required by ext-apps hosts)\n const uri = options.uri ?? `ui://${className}/${methodName}`;\n\n // Store metadata on the method\n Reflect.defineMetadata(GPT_APP_COMPONENT_KEY, options.component, descriptor.value!);\n Reflect.defineMetadata(GPT_APP_URI_KEY, uri, descriptor.value!);\n Reflect.defineMetadata(GPT_APP_OPTIONS_KEY, options, descriptor.value!);\n\n // Also store the resource URI and OpenAI-specific metadata for the @Tool decorator to pick up\n const existingMeta = Reflect.getMetadata('tool:meta', descriptor.value) || {};\n\n // Build nested ui metadata (preferred by ext-apps 0.2.2)\n const uiMeta: Record<string, any> = {\n resourceUri: uri,\n };\n\n // Map visibility to ext-apps format\n if (options.visibility) {\n uiMeta.visibility = options.visibility === 'private' ? ['app'] : ['model', 'app'];\n }\n\n const openAiMeta: Record<string, any> = {\n // New nested format (preferred by ext-apps 0.2.2)\n ui: uiMeta,\n // Legacy flat format (for backwards compatibility)\n 'ui/resourceUri': uri,\n 'openai/outputTemplate': uri,\n };\n\n if (options.widgetAccessible !== undefined) {\n openAiMeta['openai/widgetAccessible'] = options.widgetAccessible;\n }\n\n if (options.visibility) {\n openAiMeta['openai/visibility'] = options.visibility;\n }\n\n if (options.prefersBorder !== undefined) {\n openAiMeta['openai/widgetPrefersBorder'] = options.prefersBorder;\n }\n\n if (options.widgetDomain) {\n openAiMeta['openai/widgetDomain'] = options.widgetDomain;\n }\n\n if (options.widgetDescription) {\n openAiMeta['openai/widgetDescription'] = options.widgetDescription;\n }\n\n if (options.csp) {\n openAiMeta['openai/widgetCSP'] = options.csp;\n }\n\n if (options.fileParams) {\n openAiMeta['openai/fileParams'] = options.fileParams;\n }\n\n if (options.invocation) {\n if (options.invocation.invoking) openAiMeta['openai/toolInvocation/invoking'] = options.invocation.invoking;\n if (options.invocation.invoked) openAiMeta['openai/toolInvocation/invoked'] = options.invocation.invoked;\n }\n\n Reflect.defineMetadata('tool:meta', {\n ...existingMeta,\n ...openAiMeta,\n }, descriptor.value!);\n\n return descriptor;\n };\n}\n\n/**\n * Helper to get GPTApp metadata from a method\n */\nexport function getGPTAppMetadata(target: Function): GPTAppOptions | undefined {\n const component = Reflect.getMetadata(GPT_APP_COMPONENT_KEY, target);\n if (!component) return undefined;\n\n return {\n component,\n uri: Reflect.getMetadata(GPT_APP_URI_KEY, target),\n ...Reflect.getMetadata(GPT_APP_OPTIONS_KEY, target),\n };\n}\n\n/**\n * Helper to get the resource URI from a method\n */\nexport function getGPTAppUri(target: Function): string | undefined {\n return Reflect.getMetadata(GPT_APP_URI_KEY, target);\n}\n"]}