@fias/create-fias-plugin 1.0.1 → 1.0.3
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/package.json
CHANGED
|
@@ -82,6 +82,8 @@ const user = useFiasUser();
|
|
|
82
82
|
**Permission:** `storage:sandbox`
|
|
83
83
|
**Returns:** `FiasStorageApi`
|
|
84
84
|
|
|
85
|
+
Storage is S3-backed and scoped per plugin + user. Data persists across sessions, browsers, and devices in live mode (staging/production). In mock mode, storage is in-memory and resets when the dev server restarts.
|
|
86
|
+
|
|
85
87
|
```tsx
|
|
86
88
|
import { useFiasStorage } from '@fias/arche-sdk';
|
|
87
89
|
|
|
@@ -129,6 +131,41 @@ function AISummarizer() {
|
|
|
129
131
|
|
|
130
132
|
The `entityId` references a published model entity. Browse available models with `npx fias-dev entities`. The `systemPrompt` tells the AI how to behave — this is where your plugin's intelligence lives.
|
|
131
133
|
|
|
134
|
+
### `useImageGeneration()` — Generate images via AI models
|
|
135
|
+
|
|
136
|
+
**Permission:** `entities:image_generate`
|
|
137
|
+
**Returns:** `ImageGenerationApi`
|
|
138
|
+
|
|
139
|
+
Generate images using platform image models. Images are saved to the user's Fias file system and a display URL is returned. Use `npx fias-dev entities --detail <entityId>` to check supported sizes, qualities, and styles for each model.
|
|
140
|
+
|
|
141
|
+
```tsx
|
|
142
|
+
import { useImageGeneration } from '@fias/arche-sdk';
|
|
143
|
+
|
|
144
|
+
function ImageMaker() {
|
|
145
|
+
const { generate, isLoading, result, error } = useImageGeneration();
|
|
146
|
+
|
|
147
|
+
return (
|
|
148
|
+
<div>
|
|
149
|
+
<button
|
|
150
|
+
onClick={() =>
|
|
151
|
+
generate({
|
|
152
|
+
entityId: 'ent_modeldef_dalle3',
|
|
153
|
+
prompt: 'A serene mountain landscape at sunset',
|
|
154
|
+
size: '1024x1024',
|
|
155
|
+
quality: 'hd',
|
|
156
|
+
})
|
|
157
|
+
}
|
|
158
|
+
disabled={isLoading}
|
|
159
|
+
>
|
|
160
|
+
{isLoading ? 'Generating...' : 'Generate Image'}
|
|
161
|
+
</button>
|
|
162
|
+
{result && <img src={result.imageUrl} alt="Generated" />}
|
|
163
|
+
{error && <p>Error: {error.message}</p>}
|
|
164
|
+
</div>
|
|
165
|
+
);
|
|
166
|
+
}
|
|
167
|
+
```
|
|
168
|
+
|
|
132
169
|
### `useFiasNavigation()` — In-plugin routing
|
|
133
170
|
|
|
134
171
|
**Permission:** None required
|
|
@@ -155,6 +192,8 @@ const { currentStep, setCurrentStep } = useStepNavigation('step-1');
|
|
|
155
192
|
|
|
156
193
|
**Permission:** `storage:sandbox`
|
|
157
194
|
|
|
195
|
+
Uses `useFiasStorage` under the hood — same persistence rules apply (durable in live mode, in-memory in mock mode).
|
|
196
|
+
|
|
158
197
|
```tsx
|
|
159
198
|
import { usePersistentState } from '@fias/arche-sdk';
|
|
160
199
|
|
|
@@ -203,7 +242,7 @@ fias.showToast('Saved!', 'success'); // Toast: 'info' | 'success' | 'warning' |
|
|
|
203
242
|
| `sdk` | Yes | SDK version range |
|
|
204
243
|
| `dependencies` | No | npm packages with **exact** versions (max 20) |
|
|
205
244
|
|
|
206
|
-
**Permissions:** `theme:read`, `user:profile:read`, `storage:sandbox`, `entities:invoke`
|
|
245
|
+
**Permissions:** `theme:read`, `user:profile:read`, `storage:sandbox`, `entities:invoke`, `entities:image_generate`
|
|
207
246
|
|
|
208
247
|
**Using AI:** Add `"entities:invoke"` to permissions, then use `useEntityInvocation()` with a model entity ID and your own `systemPrompt`. Browse available models with `npx fias-dev entities`.
|
|
209
248
|
|
|
@@ -279,9 +318,10 @@ npx fias-dev login --env production # Authenticate with production
|
|
|
279
318
|
### Browsing Available Entities
|
|
280
319
|
|
|
281
320
|
```bash
|
|
282
|
-
npx fias-dev entities
|
|
283
|
-
npx fias-dev entities --search "
|
|
284
|
-
npx fias-dev entities --type "
|
|
321
|
+
npx fias-dev entities # List all
|
|
322
|
+
npx fias-dev entities --search "image" # Search by keyword
|
|
323
|
+
npx fias-dev entities --type "model-definition" # Filter by type
|
|
324
|
+
npx fias-dev entities --detail ent_modeldef_dalle3 # Full entity details (capabilities, sizes, pricing)
|
|
285
325
|
```
|
|
286
326
|
|
|
287
327
|
### Validating the Manifest
|
|
@@ -82,6 +82,8 @@ const user = useFiasUser();
|
|
|
82
82
|
**Permission:** `storage:sandbox`
|
|
83
83
|
**Returns:** `FiasStorageApi`
|
|
84
84
|
|
|
85
|
+
Storage is S3-backed and scoped per plugin + user. Data persists across sessions, browsers, and devices in live mode (staging/production). In mock mode, storage is in-memory and resets when the dev server restarts.
|
|
86
|
+
|
|
85
87
|
```tsx
|
|
86
88
|
import { useFiasStorage } from '@fias/arche-sdk';
|
|
87
89
|
|
|
@@ -129,6 +131,41 @@ function AISummarizer() {
|
|
|
129
131
|
|
|
130
132
|
The `entityId` references a published model entity. Browse available models with `npx fias-dev entities`. The `systemPrompt` tells the AI how to behave — this is where your plugin's intelligence lives.
|
|
131
133
|
|
|
134
|
+
### `useImageGeneration()` — Generate images via AI models
|
|
135
|
+
|
|
136
|
+
**Permission:** `entities:image_generate`
|
|
137
|
+
**Returns:** `ImageGenerationApi`
|
|
138
|
+
|
|
139
|
+
Generate images using platform image models. Images are saved to the user's Fias file system and a display URL is returned. Use `npx fias-dev entities --detail <entityId>` to check supported sizes, qualities, and styles for each model.
|
|
140
|
+
|
|
141
|
+
```tsx
|
|
142
|
+
import { useImageGeneration } from '@fias/arche-sdk';
|
|
143
|
+
|
|
144
|
+
function ImageMaker() {
|
|
145
|
+
const { generate, isLoading, result, error } = useImageGeneration();
|
|
146
|
+
|
|
147
|
+
return (
|
|
148
|
+
<div>
|
|
149
|
+
<button
|
|
150
|
+
onClick={() =>
|
|
151
|
+
generate({
|
|
152
|
+
entityId: 'ent_modeldef_dalle3',
|
|
153
|
+
prompt: 'A serene mountain landscape at sunset',
|
|
154
|
+
size: '1024x1024',
|
|
155
|
+
quality: 'hd',
|
|
156
|
+
})
|
|
157
|
+
}
|
|
158
|
+
disabled={isLoading}
|
|
159
|
+
>
|
|
160
|
+
{isLoading ? 'Generating...' : 'Generate Image'}
|
|
161
|
+
</button>
|
|
162
|
+
{result && <img src={result.imageUrl} alt="Generated" />}
|
|
163
|
+
{error && <p>Error: {error.message}</p>}
|
|
164
|
+
</div>
|
|
165
|
+
);
|
|
166
|
+
}
|
|
167
|
+
```
|
|
168
|
+
|
|
132
169
|
### `useFiasNavigation()` — In-plugin routing
|
|
133
170
|
|
|
134
171
|
**Permission:** None required
|
|
@@ -155,6 +192,8 @@ const { currentStep, setCurrentStep } = useStepNavigation('step-1');
|
|
|
155
192
|
|
|
156
193
|
**Permission:** `storage:sandbox`
|
|
157
194
|
|
|
195
|
+
Uses `useFiasStorage` under the hood — same persistence rules apply (durable in live mode, in-memory in mock mode).
|
|
196
|
+
|
|
158
197
|
```tsx
|
|
159
198
|
import { usePersistentState } from '@fias/arche-sdk';
|
|
160
199
|
|
|
@@ -203,7 +242,7 @@ fias.showToast('Saved!', 'success'); // Toast: 'info' | 'success' | 'warning' |
|
|
|
203
242
|
| `sdk` | Yes | SDK version range |
|
|
204
243
|
| `dependencies` | No | npm packages with **exact** versions (max 20) |
|
|
205
244
|
|
|
206
|
-
**Permissions:** `theme:read`, `user:profile:read`, `storage:sandbox`, `entities:invoke`
|
|
245
|
+
**Permissions:** `theme:read`, `user:profile:read`, `storage:sandbox`, `entities:invoke`, `entities:image_generate`
|
|
207
246
|
|
|
208
247
|
**Using AI:** Add `"entities:invoke"` to permissions, then use `useEntityInvocation()` with a model entity ID and your own `systemPrompt`. Browse available models with `npx fias-dev entities`.
|
|
209
248
|
|
|
@@ -279,9 +318,10 @@ npx fias-dev login --env production # Authenticate with production
|
|
|
279
318
|
### Browsing Available Entities
|
|
280
319
|
|
|
281
320
|
```bash
|
|
282
|
-
npx fias-dev entities
|
|
283
|
-
npx fias-dev entities --search "
|
|
284
|
-
npx fias-dev entities --type "
|
|
321
|
+
npx fias-dev entities # List all
|
|
322
|
+
npx fias-dev entities --search "image" # Search by keyword
|
|
323
|
+
npx fias-dev entities --type "model-definition" # Filter by type
|
|
324
|
+
npx fias-dev entities --detail ent_modeldef_dalle3 # Full entity details (capabilities, sizes, pricing)
|
|
285
325
|
```
|
|
286
326
|
|
|
287
327
|
### Validating the Manifest
|