@fias/create-fias-plugin 1.10.1 → 1.11.1
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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<!-- fias-sdk-guide-version: 2.
|
|
1
|
+
<!-- fias-sdk-guide-version: 2.19.0 -->
|
|
2
2
|
|
|
3
3
|
# FIAS Plugin Development Guide
|
|
4
4
|
|
|
@@ -545,11 +545,34 @@ const { entities, isLoading } = useImageEntities({
|
|
|
545
545
|
supportsReferenceImage: true,
|
|
546
546
|
});
|
|
547
547
|
// entities[i]: { entityId, displayName, provider, modes, supportedSizes,
|
|
548
|
-
// supportsReferenceImage, isPlatformRecommended,
|
|
548
|
+
// supportsReferenceImage, isPlatformRecommended,
|
|
549
|
+
// creditsPerImage, estimatedDurationMs, company, strengths,
|
|
550
|
+
// providerParams, ... }
|
|
549
551
|
```
|
|
550
552
|
|
|
551
553
|
Each entry is scrubbed — only fields a UI legitimately needs (no provider model strings, no endpoints, no execution config).
|
|
552
554
|
|
|
555
|
+
`creditsPerImage` is what one image costs the user in credits, markup already included — it matches what the ledger deducts, so it is the figure to show. `estimatedDurationMs` sizes a progress indicator; `company` and `strengths` are model-info copy. All optional: absent means the model has nothing to declare, not that the data is missing.
|
|
556
|
+
|
|
557
|
+
**Tunable engine parameters.** `providerParams` describes what a model exposes for tuning — enough to render a settings panel without hardcoding a thing:
|
|
558
|
+
|
|
559
|
+
```tsx
|
|
560
|
+
// param: { key, label, description, controlType, defaultValue,
|
|
561
|
+
// min?, max?, step?, options?, category? }
|
|
562
|
+
// controlType: 'slider' | 'number' | 'select' | 'checkbox' | 'textarea'
|
|
563
|
+
const seed = entity.providerParams?.find((p) => p.key === 'seed');
|
|
564
|
+
await generate({ entityId, prompt, providerParams: { seed: 42 } });
|
|
565
|
+
```
|
|
566
|
+
|
|
567
|
+
**The `category` trap.** A param carrying `category: 'quality'` or `'style'` does NOT belong in `providerParams` — send it on the matching top-level field. Providers read those two from the top level only, and an unrecognized `providerParams` key is dropped without an error, so the image generates at the model's default **and you are billed for it anyway**:
|
|
568
|
+
|
|
569
|
+
```tsx
|
|
570
|
+
generate({ entityId, prompt, quality: 'high' }); // honoured
|
|
571
|
+
generate({ entityId, prompt, providerParams: { gpt_quality: 'high' } }); // SILENTLY IGNORED
|
|
572
|
+
```
|
|
573
|
+
|
|
574
|
+
Its `options` are still how you build the control — only the destination differs.
|
|
575
|
+
|
|
553
576
|
### Image-editing capability hooks (auto-generated)
|
|
554
577
|
|
|
555
578
|
**Permission:** `entities:image_edit`
|
|
@@ -665,7 +688,7 @@ await invoke({ query: 'latest EU AI Act enforcement dates' });
|
|
|
665
688
|
|
|
666
689
|
### `useVaultDocuments()` — User-owned Vault documents
|
|
667
690
|
|
|
668
|
-
**Permissions:** `vault:documents:read` (list / read / readBytes / getDownloadUrl / search), `vault:documents:write` (write / update / delete / attach / detach / upload)
|
|
691
|
+
**Permissions:** `vault:documents:read` (list / read / readBytes / getDownloadUrl / search), `vault:documents:write` (write / saveContent / update / delete / attach / detach / upload)
|
|
669
692
|
**Returns:** `VaultDocumentsApi`
|
|
670
693
|
|
|
671
694
|
The Vault is the platform's persistent document store for the signed-in user. Distinct from `useFiasStorage` (per-plugin sandbox): Vault docs live in the user's My Data, survive plugin uninstall, and can be cross-referenced from other arches. Documents this arche creates are scoped to it (`source_arche_id`) and surfaced to the user under `/My-Fias/Arches/<archeId>/`.
|
|
@@ -709,6 +732,15 @@ const result = await vault.upload(bytes, {
|
|
|
709
732
|
// but still appears in list() — don't assume every listed doc has bytes.
|
|
710
733
|
const { bytes: saved } = await vault.readBytes(documentId);
|
|
711
734
|
|
|
735
|
+
// Overwrite a document THIS arche created IN PLACE — same documentId, bytes
|
|
736
|
+
// replaced, no version history. The autosave path (a spreadsheet saving as
|
|
737
|
+
// the user works); to publish a distinct new version use write({
|
|
738
|
+
// replacesDocumentId }) instead. UTF-8 text, ≤ 200 KB (OWN_DOCUMENT_SAVE_TOO_LARGE
|
|
739
|
+
// names the cap). Debounce: a few seconds of idle plus blur/close — never per
|
|
740
|
+
// keystroke — and surface RATE_LIMIT verbatim rather than retrying. A save
|
|
741
|
+
// drops the document's search index and does not re-run extraction.
|
|
742
|
+
await vault.saveContent({ documentId, content: JSON.stringify(sheet) });
|
|
743
|
+
|
|
712
744
|
// Semantic search across documents this arche owns
|
|
713
745
|
// (burns user credits per the AI Markup Invariant — call sparingly)
|
|
714
746
|
const { matches } = await vault.search('quarterly revenue', { topK: 5 });
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<!-- fias-sdk-guide-version: 2.
|
|
1
|
+
<!-- fias-sdk-guide-version: 2.19.0 -->
|
|
2
2
|
|
|
3
3
|
# FIAS Plugin Development Guide
|
|
4
4
|
|
|
@@ -545,11 +545,34 @@ const { entities, isLoading } = useImageEntities({
|
|
|
545
545
|
supportsReferenceImage: true,
|
|
546
546
|
});
|
|
547
547
|
// entities[i]: { entityId, displayName, provider, modes, supportedSizes,
|
|
548
|
-
// supportsReferenceImage, isPlatformRecommended,
|
|
548
|
+
// supportsReferenceImage, isPlatformRecommended,
|
|
549
|
+
// creditsPerImage, estimatedDurationMs, company, strengths,
|
|
550
|
+
// providerParams, ... }
|
|
549
551
|
```
|
|
550
552
|
|
|
551
553
|
Each entry is scrubbed — only fields a UI legitimately needs (no provider model strings, no endpoints, no execution config).
|
|
552
554
|
|
|
555
|
+
`creditsPerImage` is what one image costs the user in credits, markup already included — it matches what the ledger deducts, so it is the figure to show. `estimatedDurationMs` sizes a progress indicator; `company` and `strengths` are model-info copy. All optional: absent means the model has nothing to declare, not that the data is missing.
|
|
556
|
+
|
|
557
|
+
**Tunable engine parameters.** `providerParams` describes what a model exposes for tuning — enough to render a settings panel without hardcoding a thing:
|
|
558
|
+
|
|
559
|
+
```tsx
|
|
560
|
+
// param: { key, label, description, controlType, defaultValue,
|
|
561
|
+
// min?, max?, step?, options?, category? }
|
|
562
|
+
// controlType: 'slider' | 'number' | 'select' | 'checkbox' | 'textarea'
|
|
563
|
+
const seed = entity.providerParams?.find((p) => p.key === 'seed');
|
|
564
|
+
await generate({ entityId, prompt, providerParams: { seed: 42 } });
|
|
565
|
+
```
|
|
566
|
+
|
|
567
|
+
**The `category` trap.** A param carrying `category: 'quality'` or `'style'` does NOT belong in `providerParams` — send it on the matching top-level field. Providers read those two from the top level only, and an unrecognized `providerParams` key is dropped without an error, so the image generates at the model's default **and you are billed for it anyway**:
|
|
568
|
+
|
|
569
|
+
```tsx
|
|
570
|
+
generate({ entityId, prompt, quality: 'high' }); // honoured
|
|
571
|
+
generate({ entityId, prompt, providerParams: { gpt_quality: 'high' } }); // SILENTLY IGNORED
|
|
572
|
+
```
|
|
573
|
+
|
|
574
|
+
Its `options` are still how you build the control — only the destination differs.
|
|
575
|
+
|
|
553
576
|
### Image-editing capability hooks (auto-generated)
|
|
554
577
|
|
|
555
578
|
**Permission:** `entities:image_edit`
|
|
@@ -665,7 +688,7 @@ await invoke({ query: 'latest EU AI Act enforcement dates' });
|
|
|
665
688
|
|
|
666
689
|
### `useVaultDocuments()` — User-owned Vault documents
|
|
667
690
|
|
|
668
|
-
**Permissions:** `vault:documents:read` (list / read / readBytes / getDownloadUrl / search), `vault:documents:write` (write / update / delete / attach / detach / upload)
|
|
691
|
+
**Permissions:** `vault:documents:read` (list / read / readBytes / getDownloadUrl / search), `vault:documents:write` (write / saveContent / update / delete / attach / detach / upload)
|
|
669
692
|
**Returns:** `VaultDocumentsApi`
|
|
670
693
|
|
|
671
694
|
The Vault is the platform's persistent document store for the signed-in user. Distinct from `useFiasStorage` (per-plugin sandbox): Vault docs live in the user's My Data, survive plugin uninstall, and can be cross-referenced from other arches. Documents this arche creates are scoped to it (`source_arche_id`) and surfaced to the user under `/My-Fias/Arches/<archeId>/`.
|
|
@@ -709,6 +732,15 @@ const result = await vault.upload(bytes, {
|
|
|
709
732
|
// but still appears in list() — don't assume every listed doc has bytes.
|
|
710
733
|
const { bytes: saved } = await vault.readBytes(documentId);
|
|
711
734
|
|
|
735
|
+
// Overwrite a document THIS arche created IN PLACE — same documentId, bytes
|
|
736
|
+
// replaced, no version history. The autosave path (a spreadsheet saving as
|
|
737
|
+
// the user works); to publish a distinct new version use write({
|
|
738
|
+
// replacesDocumentId }) instead. UTF-8 text, ≤ 200 KB (OWN_DOCUMENT_SAVE_TOO_LARGE
|
|
739
|
+
// names the cap). Debounce: a few seconds of idle plus blur/close — never per
|
|
740
|
+
// keystroke — and surface RATE_LIMIT verbatim rather than retrying. A save
|
|
741
|
+
// drops the document's search index and does not re-run extraction.
|
|
742
|
+
await vault.saveContent({ documentId, content: JSON.stringify(sheet) });
|
|
743
|
+
|
|
712
744
|
// Semantic search across documents this arche owns
|
|
713
745
|
// (burns user credits per the AI Markup Invariant — call sparingly)
|
|
714
746
|
const { matches } = await vault.search('quarterly revenue', { topK: 5 });
|