@fias/arche-sdk 1.11.0 → 1.13.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 +42 -0
- package/dist/coverage-fills.test.d.ts +8 -0
- package/dist/coverage-fills.test.d.ts.map +1 -0
- package/dist/coverage-fills.test.js +302 -0
- package/dist/coverage-fills.test.js.map +1 -0
- package/dist/hooks.d.ts +38 -1
- package/dist/hooks.d.ts.map +1 -1
- package/dist/hooks.js +198 -1
- package/dist/hooks.js.map +1 -1
- package/dist/hooks.test.js +631 -0
- package/dist/hooks.test.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +175 -3
- package/dist/types.d.ts +258 -5
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/templates/default/AGENTS.md +130 -4
- package/templates/default/CLAUDE.md +130 -4
|
@@ -207,7 +207,43 @@ The `entityId` references a published model entity. Browse available models with
|
|
|
207
207
|
**Permission:** `entities:image_generate`
|
|
208
208
|
**Returns:** `ImageGenerationApi`
|
|
209
209
|
|
|
210
|
-
Generate images using platform image models. Images are saved to the user's Fias file system and a display URL is returned.
|
|
210
|
+
Generate images using platform image models. Images are saved to the user's Fias file system and a display URL is returned.
|
|
211
|
+
|
|
212
|
+
#### Choosing an image model
|
|
213
|
+
|
|
214
|
+
The `entityId` parameter accepts three forms. **Prefer the selector forms** (`platformRecommended` / `providerRecommended`) over hardcoded entity IDs: the platform's recommendations evolve, models get retired, and a selector lets your plugin pick up the current best automatically without a code edit. Hardcoded IDs are still supported for back-compat and for cases where you want a specific model — but if the platform retires that exact entity, your plugin breaks unless the platform has registered a successor.
|
|
215
|
+
|
|
216
|
+
```tsx
|
|
217
|
+
// 1. Platform's blessed pick for a workflow + optional style (RECOMMENDED).
|
|
218
|
+
// Asking for `image-to-image` will never return a model that can't do it.
|
|
219
|
+
generate({
|
|
220
|
+
entityId: { platformRecommended: { mode: 'text-to-image', style: 'illustration' } },
|
|
221
|
+
prompt: "A child's storybook page of a fox in the forest",
|
|
222
|
+
});
|
|
223
|
+
|
|
224
|
+
// 2. A specific provider's blessed pick. Use when your plugin's value prop
|
|
225
|
+
// depends on a particular provider's quirks (e.g., "best OpenAI image model").
|
|
226
|
+
generate({
|
|
227
|
+
entityId: { providerRecommended: { provider: 'openai', mode: 'image-to-image' } },
|
|
228
|
+
prompt: 'Make it look like an oil painting',
|
|
229
|
+
referenceImage: { fileId: previousImage.fileId },
|
|
230
|
+
});
|
|
231
|
+
|
|
232
|
+
// 3. Explicit entityId — back-compat path. Use only when you want a
|
|
233
|
+
// specific model. If the entity has been deprecated, the response
|
|
234
|
+
// includes `deprecation: { requestedEntityId, resolvedEntityId,
|
|
235
|
+
// deprecatedAt }` and you get the successor.
|
|
236
|
+
generate({
|
|
237
|
+
entityId: 'ent_modeldef_gpt_image_1_5',
|
|
238
|
+
prompt: 'A serene mountain landscape at sunset',
|
|
239
|
+
});
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
Mode values: `'text-to-image'` (the baseline), `'image-to-image'` (requires `referenceImage`), `'vector'` (SVG output). Style values: `'illustration'` (stylized/kids/digital-art) or `'photoreal'`.
|
|
243
|
+
|
|
244
|
+
Use `npx fias-dev entities --detail <entityId>` to check supported sizes, qualities, and styles for each model.
|
|
245
|
+
|
|
246
|
+
#### Full example
|
|
211
247
|
|
|
212
248
|
```tsx
|
|
213
249
|
import { useImageGeneration } from '@fias/arche-sdk';
|
|
@@ -220,9 +256,9 @@ function ImageMaker() {
|
|
|
220
256
|
<button
|
|
221
257
|
onClick={() =>
|
|
222
258
|
generate({
|
|
223
|
-
entityId: '
|
|
259
|
+
entityId: { platformRecommended: { mode: 'text-to-image' } },
|
|
224
260
|
prompt: 'A serene mountain landscape at sunset',
|
|
225
|
-
size: '
|
|
261
|
+
size: '16:9',
|
|
226
262
|
quality: 'high',
|
|
227
263
|
})
|
|
228
264
|
}
|
|
@@ -230,13 +266,58 @@ function ImageMaker() {
|
|
|
230
266
|
>
|
|
231
267
|
{isLoading ? 'Generating...' : 'Generate Image'}
|
|
232
268
|
</button>
|
|
233
|
-
{result &&
|
|
269
|
+
{result && (
|
|
270
|
+
<>
|
|
271
|
+
<img src={result.imageUrl} alt="Generated" />
|
|
272
|
+
{result.deprecation && (
|
|
273
|
+
<p style={{ color: 'orange' }}>
|
|
274
|
+
Note: requested entity "{result.deprecation.requestedEntityId}" is deprecated;
|
|
275
|
+
auto-substituted "{result.deprecation.resolvedEntityId}". Update your code.
|
|
276
|
+
</p>
|
|
277
|
+
)}
|
|
278
|
+
</>
|
|
279
|
+
)}
|
|
234
280
|
{error && <p>Error: {error.message}</p>}
|
|
235
281
|
</div>
|
|
236
282
|
);
|
|
237
283
|
}
|
|
238
284
|
```
|
|
239
285
|
|
|
286
|
+
### `useImageEntities()` — Discover image models for a picker
|
|
287
|
+
|
|
288
|
+
**Permission:** `entities:image_generate` (same scope as generation)
|
|
289
|
+
**Returns:** `{ entities, isLoading, error, refetch }`
|
|
290
|
+
|
|
291
|
+
When you want to let the user pick a model — instead of letting the platform pick — call `useImageEntities(filter)` and render the results.
|
|
292
|
+
|
|
293
|
+
```tsx
|
|
294
|
+
import { useImageEntities, useImageGeneration } from '@fias/arche-sdk';
|
|
295
|
+
|
|
296
|
+
function ImageModelPicker() {
|
|
297
|
+
const { entities, isLoading } = useImageEntities({
|
|
298
|
+
modes: ['image-to-image'],
|
|
299
|
+
supportsReferenceImage: true,
|
|
300
|
+
});
|
|
301
|
+
const { generate } = useImageGeneration();
|
|
302
|
+
|
|
303
|
+
if (isLoading) return <p>Loading models…</p>;
|
|
304
|
+
return (
|
|
305
|
+
<ul>
|
|
306
|
+
{entities.map((e) => (
|
|
307
|
+
<li key={e.entityId}>
|
|
308
|
+
<button onClick={() => generate({ entityId: e.entityId, prompt: '…' })}>
|
|
309
|
+
{e.displayName} ({e.provider})
|
|
310
|
+
{e.isPlatformRecommended && ' ⭐ platform pick'}
|
|
311
|
+
</button>
|
|
312
|
+
</li>
|
|
313
|
+
))}
|
|
314
|
+
</ul>
|
|
315
|
+
);
|
|
316
|
+
}
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
Filter fields: `provider`, `modes` (OR-match by default; set `requireAllModes: true` for AND), `styles`, `supportsReferenceImage`, `platformRecommendedOnly`, `providerRecommendedOnly`, `includeDeprecated`. Defaults exclude deprecated entities.
|
|
320
|
+
|
|
240
321
|
### `useFiasFiles()` — User-files filesystem (SDK ≥ 1.9.0)
|
|
241
322
|
|
|
242
323
|
**Permissions:** `files:read` for `list`/`read`/`getDownloadUrl`; add `files:write` for `write`/`update`/`delete`
|
|
@@ -446,6 +527,18 @@ If newer package versions are available, tell the user and ask if they want to u
|
|
|
446
527
|
|
|
447
528
|
If `sync --dry-run` shows pending changes, tell the user and offer to run `npx fias-dev sync` to update AI instruction files and config from the latest SDK templates. This never touches source code or project-specific files (`package.json`, `fias-plugin.json`, `src/`).
|
|
448
529
|
|
|
530
|
+
#### UI cache after a harness upgrade
|
|
531
|
+
|
|
532
|
+
The harness pulls its host-page UI (toolbar, mode toggle, sign-in modal) from a CDN and caches it in `~/.fias/harness-cache/`. The cached UI takes priority over the bundled copy that ships in the npm package.
|
|
533
|
+
|
|
534
|
+
When you upgrade `@fias/plugin-dev-harness` but the CDN hasn't been redeployed yet, the cached UI can be older than the CLI. fias-dev now detects this case automatically and falls back to the bundled UI — look for this line in the startup log:
|
|
535
|
+
|
|
536
|
+
```
|
|
537
|
+
ℹ Cached harness UI v1.14.3 is older than CLI v1.18.0 — using bundled UI.
|
|
538
|
+
```
|
|
539
|
+
|
|
540
|
+
That message means everything is fine; the bundled UI exactly matches your CLI version. If you ever see stale behavior persist across an upgrade (and the line above didn't appear), delete `~/.fias/harness-cache/` and restart.
|
|
541
|
+
|
|
449
542
|
### Starting Development
|
|
450
543
|
|
|
451
544
|
```bash
|
|
@@ -482,6 +575,39 @@ npx fias-dev entities --type "model-definition" # Filter by type
|
|
|
482
575
|
npx fias-dev entities --detail ent_modeldef_gpt_image_1_5 # Full entity details (capabilities, sizes, pricing)
|
|
483
576
|
```
|
|
484
577
|
|
|
578
|
+
### Debugging — Read the Browser's View Directly
|
|
579
|
+
|
|
580
|
+
The harness mirrors every browser-side event to a per-port log file at `/tmp/fias-dev-<port>.log` (so usually `/tmp/fias-dev-3200.log`). The file path is also printed at startup:
|
|
581
|
+
|
|
582
|
+
```
|
|
583
|
+
Browser dev-log mirror: /tmp/fias-dev-3200.log
|
|
584
|
+
```
|
|
585
|
+
|
|
586
|
+
What's captured:
|
|
587
|
+
|
|
588
|
+
- Every Dev Console entry (`send` / `recv` / `info` / `error` / `toast` / `cost` / `nav`)
|
|
589
|
+
- Every uncaught JS error (`window.error`)
|
|
590
|
+
- Every unhandled promise rejection (`unhandledrejection`)
|
|
591
|
+
- Bridge requests + responses with payload previews
|
|
592
|
+
|
|
593
|
+
Format is one line per event:
|
|
594
|
+
|
|
595
|
+
```
|
|
596
|
+
2026-05-24T07:14:33.123Z [ERROR] window.error {"message":"...","file":"...","line":42}
|
|
597
|
+
2026-05-24T07:14:35.456Z [SEND] image_generate {"entityId":"ent_modeldef_..."}
|
|
598
|
+
2026-05-24T07:14:36.789Z [RECV] response {...}
|
|
599
|
+
```
|
|
600
|
+
|
|
601
|
+
**For AI agents pair-debugging with a developer:** tail this file instead of asking the developer to open DevTools and copy-paste output. Reproduce the failing action in the browser, then read the file — you'll see exactly what the iframe and harness exchanged.
|
|
602
|
+
|
|
603
|
+
```bash
|
|
604
|
+
tail -f /tmp/fias-dev-3200.log
|
|
605
|
+
```
|
|
606
|
+
|
|
607
|
+
The file is truncated on every `fias-dev` start, so it always reflects the current session.
|
|
608
|
+
|
|
609
|
+
The mirror uses `navigator.sendBeacon` (with a `fetch` fallback) so there's a sub-second delay before the most recent events land in the file. If you're chasing a race, give it a beat before reading.
|
|
610
|
+
|
|
485
611
|
### Validating the Manifest
|
|
486
612
|
|
|
487
613
|
```bash
|