@imgly/plugin-ai-apps-web 0.1.0-rc.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 ADDED
@@ -0,0 +1,147 @@
1
+ # IMG.LY AI Apps for Web
2
+
3
+ A plugin for orchestrating all AI generation capabilities in CreativeEditor SDK.
4
+
5
+ ## Overview
6
+
7
+ The `@imgly/plugin-ai-apps-web` package provides a unified interface for accessing and organizing all AI generation features within the CreativeEditor SDK. It combines image, video, audio, and text generation capabilities into a single cohesive user experience.
8
+
9
+ Features include:
10
+
11
+ - Central AI dock component with loading indicators
12
+ - AI apps menu for quick access to all AI features
13
+ - Integrated history management for generated assets
14
+ - Automatic integration with asset libraries
15
+ - Support for both Design and Video modes
16
+
17
+ ## Installation
18
+
19
+ ```bash
20
+ npm install @imgly/plugin-ai-apps-web
21
+ ```
22
+
23
+ ## Usage
24
+
25
+ To use the plugin, import it and configure it with your preferred providers:
26
+
27
+ ```typescript
28
+ import CreativeEditorSDK from '@cesdk/cesdk-js';
29
+ import AiApps from '@imgly/plugin-ai-apps-web';
30
+
31
+ // Import providers from individual AI generation packages
32
+ import { AnthropicProvider } from '@imgly/plugin-ai-text-generation-web/anthropic';
33
+ import FalAiImage from '@imgly/plugin-ai-image-generation-web/fal-ai';
34
+ import FalAiVideo from '@imgly/plugin-ai-video-generation-web/fal-ai';
35
+ import ElevenLabs from '@imgly/plugin-ai-audio-generation-web/elevenlabs';
36
+
37
+ // Initialize CreativeEditor SDK
38
+ CreativeEditorSDK.create(domElement, {
39
+ license: 'your-license-key'
40
+ // Other configuration options...
41
+ }).then(async (cesdk) => {
42
+ // Add the AI Apps plugin
43
+ cesdk.addPlugin(
44
+ AiApps({
45
+ providers: {
46
+ // Text generation
47
+ text2text: AnthropicProvider({
48
+ proxyUrl: 'https://your-anthropic-proxy.example.com'
49
+ }),
50
+
51
+ // Image generation
52
+ text2image: FalAiImage.RecraftV3({
53
+ proxyUrl: 'https://your-fal-ai-proxy.example.com'
54
+ }),
55
+ image2image: FalAiImage.GeminiFlashEdit({
56
+ proxyUrl: 'https://your-fal-ai-proxy.example.com'
57
+ }),
58
+
59
+ // Video generation (used in video mode)
60
+ text2video: FalAiVideo.MinimaxVideo01Live({
61
+ proxyUrl: 'https://your-fal-ai-proxy.example.com'
62
+ }),
63
+ image2video: FalAiVideo.MinimaxVideo01LiveImageToVideo({
64
+ proxyUrl: 'https://your-fal-ai-proxy.example.com'
65
+ }),
66
+
67
+ // Audio generation (used in video mode)
68
+ text2speech: ElevenLabs.MonolingualV1({
69
+ proxyUrl: 'https://your-elevenlabs-proxy.example.com'
70
+ }),
71
+ text2sound: ElevenLabs.SoundEffects({
72
+ proxyUrl: 'https://your-elevenlabs-proxy.example.com'
73
+ })
74
+ }
75
+ })
76
+ );
77
+
78
+ // Position the AI dock button in the dock order
79
+ cesdk.ui.setDockOrder(['ly.img.ai/apps.dock', ...cesdk.ui.getDockOrder()]);
80
+ });
81
+ ```
82
+
83
+ ## Configuration Options
84
+
85
+ The plugin accepts the following configuration options:
86
+
87
+ | Option | Type | Description |
88
+ | ----------- | ----------- | --------------------------------------------- |
89
+ | `providers` | `Providers` | Object containing all AI providers to be used |
90
+ | `debug` | `boolean` | Print debug messages |
91
+
92
+ ### Providers Configuration
93
+
94
+ The `providers` object can include the following provider functions:
95
+
96
+ | Provider | Type | Description |
97
+ | ------------- | ------------------- | -------------------------------------------------------- |
98
+ | `text2text` | `Provider<'text'>` | Provider for text generation and transformation |
99
+ | `text2image` | `Provider<'image'>` | Provider for text-to-image generation |
100
+ | `image2image` | `Provider<'image'>` | Provider for image-to-image transformation |
101
+ | `text2video` | `Provider<'video'>` | Provider for text-to-video generation (video mode only) |
102
+ | `image2video` | `Provider<'video'>` | Provider for image-to-video generation (video mode only) |
103
+ | `text2speech` | `Provider<'audio'>` | Provider for text-to-speech generation (video mode only) |
104
+ | `text2sound` | `Provider<'audio'>` | Provider for sound effects generation (video mode only) |
105
+
106
+ ## UI Integration
107
+
108
+ The plugin adds the following UI components:
109
+
110
+ 1. **AI Dock Button**: Access point for all AI features
111
+ 2. **AI Apps Menu**: In video mode, shows cards for all available AI generation types
112
+
113
+ ### Dock Integration
114
+
115
+ To position the AI dock button in your editor's dock, use the `setDockOrder` method:
116
+
117
+ ```typescript
118
+ // Add the AI dock component to the beginning of the dock
119
+ cesdk.ui.setDockOrder(['ly.img.ai/apps.dock', ...cesdk.ui.getDockOrder()]);
120
+
121
+ // Or add it at a specific position
122
+ const currentOrder = cesdk.ui.getDockOrder();
123
+ currentOrder.splice(2, 0, 'ly.img.ai/apps.dock');
124
+ cesdk.ui.setDockOrder(currentOrder);
125
+ ```
126
+
127
+ ## Asset History Integration
128
+
129
+ The plugin automatically integrates generated assets into the appropriate asset libraries:
130
+
131
+ - AI-generated images appear in the standard image library
132
+ - AI-generated videos appear in the standard video library
133
+ - AI-generated audio appears in the standard audio library
134
+
135
+ This integration creates a seamless experience where users can easily find and reuse their AI-generated assets.
136
+
137
+ ## Related Packages
138
+
139
+ - [@imgly/plugin-ai-generation-web](https://github.com/imgly/plugin-ai-generation-web) - Core utilities for AI generation
140
+ - [@imgly/plugin-ai-image-generation-web](https://github.com/imgly/plugin-ai-image-generation-web) - AI image generation
141
+ - [@imgly/plugin-ai-video-generation-web](https://github.com/imgly/plugin-ai-video-generation-web) - AI video generation
142
+ - [@imgly/plugin-ai-audio-generation-web](https://github.com/imgly/plugin-ai-audio-generation-web) - AI audio generation
143
+ - [@imgly/plugin-ai-text-generation-web](https://github.com/imgly/plugin-ai-text-generation-web) - AI text generation
144
+
145
+ ## License
146
+
147
+ This plugin is part of the IMG.LY plugin ecosystem for CreativeEditor SDK. Please refer to the license terms in the package.
@@ -0,0 +1,90 @@
1
+ import CreativeEditorSDK from '@cesdk/cesdk-js';
2
+ import type { AssetDefinition, AssetQueryData, AssetSource, AssetsQueryResult } from '@cesdk/engine';
3
+ /**
4
+ * A custom AssetSource implementation that manages assets from an array
5
+ * and provides functionality to mark assets as active.
6
+ */
7
+ export declare class CustomAssetSource implements AssetSource {
8
+ /** The unique id of the asset source */
9
+ id: string;
10
+ /** Array of assets to be served by this source */
11
+ private assets;
12
+ /** Set of IDs for active assets */
13
+ private activeAssetIds;
14
+ private loaderDisposer;
15
+ private cesdk;
16
+ /**
17
+ * Creates a new instance of CustomAssetSource
18
+ *
19
+ * @param id - The unique identifier for this asset source
20
+ * @param assets - Array of asset definitions to include in this source
21
+ */
22
+ constructor(id: string, cesdk: CreativeEditorSDK, assets?: AssetDefinition[]);
23
+ /**
24
+ * Find assets based on the provided query data
25
+ * Supports pagination, searching, filtering, and active-first sorting
26
+ *
27
+ * @param queryData - Query parameters to filter and sort assets
28
+ * @returns Promise with the query results
29
+ */
30
+ findAssets(queryData: AssetQueryData): Promise<AssetsQueryResult | undefined>;
31
+ updateLabel(assetId: string, label: (currentLabel: string) => string, locale: string): void;
32
+ getLabel(assetId: string, locale: string): string | undefined;
33
+ /**
34
+ * Set an asset as active by its ID
35
+ *
36
+ * @param assetId - The ID of the asset to mark as active
37
+ */
38
+ setAssetActive(assetId: string): void;
39
+ setAssetLoading(assetId: string, loading: boolean): void;
40
+ /**
41
+ * Set an asset as inactive by its ID
42
+ *
43
+ * @param assetId - The ID of the asset to mark as inactive
44
+ */
45
+ setAssetInactive(assetId: string): void;
46
+ /**
47
+ * Clear all active assets
48
+ */
49
+ clearActiveAssets(): void;
50
+ /**
51
+ * Check if an asset is marked as active
52
+ *
53
+ * @param assetId - The ID of the asset to check
54
+ * @returns True if the asset is active, false otherwise
55
+ */
56
+ isAssetActive(assetId: string): boolean;
57
+ /**
58
+ * Add an asset to this source
59
+ *
60
+ * @param asset - The asset definition to add
61
+ */
62
+ addAsset(asset: AssetDefinition): void;
63
+ /**
64
+ * Remove an asset from this source
65
+ *
66
+ * @param assetId - The ID of the asset to remove
67
+ */
68
+ removeAsset(assetId: string): void;
69
+ /**
70
+ * Get all available groups from the assets
71
+ *
72
+ * @returns Array of unique group names
73
+ */
74
+ getGroups(): Promise<string[]>;
75
+ /**
76
+ * Returns the supported MIME types for this asset source
77
+ *
78
+ * @returns Array of supported MIME types
79
+ */
80
+ getSupportedMimeTypes(): string[];
81
+ }
82
+ /**
83
+ * Helper function to create a CustomAssetSource instance
84
+ *
85
+ * @param id - The unique identifier for this asset source
86
+ * @param assets - Array of asset definitions to include in this source
87
+ * @returns A new CustomAssetSource instance
88
+ */
89
+ export declare function createCustomAssetSource(id: string, cesdk: CreativeEditorSDK, assets?: AssetDefinition[]): CustomAssetSource;
90
+ export default CustomAssetSource;
@@ -0,0 +1 @@
1
+ export declare const PLUGIN_ID = "ly.img.ai.apps";
@@ -0,0 +1,9 @@
1
+ import { type PluginConfiguration } from './types';
2
+ declare const Plugin: (pluginConfiguration: PluginConfiguration) => {
3
+ initialize: (context: import("@cesdk/engine").EnginePluginContext & {
4
+ cesdk?: import("@cesdk/cesdk-js").default;
5
+ }) => void;
6
+ name: string;
7
+ version: string;
8
+ };
9
+ export default Plugin;