@rslsp1/fa-app-tools 2.0.73 → 2.0.81

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/index.d.ts CHANGED
@@ -1,6 +1,12 @@
1
1
  import * as React from 'react';
2
2
  import React__default, { RefObject, ReactNode } from 'react';
3
+ import { F as FlowGenerateText, b as FlowTextGenerationOptions, S as SelectedTag } from './flowTextGenerationPort-KHjCGt_S.js';
4
+ export { a as FlowSdk, c as buildFallbackPrompt, d as buildGenerationPrompt, e as buildImageGenerationOptions, f as buildPromptTabPayload, g as cleanAiResponse, h as createFlowServices, j as interpretSdkError, p as parsePromptResponse } from './flowTextGenerationPort-KHjCGt_S.js';
3
5
  import { Node, Edge } from '@xyflow/react';
6
+ import * as zustand_vanilla from 'zustand/vanilla';
7
+ import { F as FeatureSliceId, b as SliceContract, a as PersistenceDescriptor, W as WorkspacePersistence, P as PersistedSlice, L as LoadResult, f as WriteResult, e as WorkspaceTabId, C as CommandResult, R as RequestContext, Q as QueryResult } from './contracts-DdYOMBl9.js';
8
+
9
+ var version = "2.0.81";
4
10
 
5
11
  declare function useOnClickOutside(ref: RefObject<HTMLElement | null>, handler: (e: MouseEvent | TouchEvent) => void): void;
6
12
 
@@ -130,7 +136,7 @@ declare const getFormattedTimestamp: () => string;
130
136
  /**
131
137
  * Hilfskonstante für CSS-Styles (Dark Scrollbar etc.)
132
138
  */
133
- declare const GLOBAL_STYLES = "\n .dark-scrollbar::-webkit-scrollbar { width: 4px; height: 4px; }\n .dark-scrollbar::-webkit-scrollbar-track { background: transparent; }\n .dark-scrollbar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 10px; }\n html, body, #root { margin: 0; padding: 0; width: 100%; height: 100%; background: #0e0e0e; font-family: 'Google Sans Text', sans-serif; overflow: hidden; }\n @keyframes prompt-shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }\n .prompt-loading { background: linear-gradient(90deg, rgba(255,255,255,0.02) 25%, rgba(255,255,255,0.05) 50%, rgba(255,255,255,0.02) 75%); background-size: 200% 100%; animation: prompt-shimmer 2s infinite linear; }\n @keyframes dropdown-enter { from { opacity: 0; transform: scale(0.95) translateY(-5px); } to { opacity: 1; transform: scale(1) translateY(0); } }\n .animate-dropdown { animation: dropdown-enter 0.1s ease-out forwards; }\n";
139
+ declare const GLOBAL_STYLES: string;
134
140
 
135
141
  declare function injectXMPMetadata(base64: string, prompt: string, seed?: number, model?: string, id?: string, tags?: string[], hierarchy?: string): string;
136
142
 
@@ -142,61 +148,6 @@ declare function exportProjectToZip(nodes: any[], edges: any[], history: any[],
142
148
  }>;
143
149
  declare function importProjectFromZip(file: File): Promise<any>;
144
150
 
145
- declare function buildGenerationPrompt(hierarchyText: string, mode?: 'literal' | 'creative'): string;
146
- declare function buildFallbackPrompt(hierarchyText: string): string;
147
- declare function cleanAiResponse(text: string): string;
148
- declare function buildImageGenerationOptions(prompt: string, aspectRatio: string, model: string, referenceMediaId?: string): Record<string, any>;
149
- interface SelectedTag {
150
- label: string;
151
- value: string;
152
- category: string;
153
- }
154
- declare function buildPromptTabPayload(selectedTags: SelectedTag[], instructions: string, rules: string, treeText?: string): string;
155
- declare function parsePromptResponse(raw: string): {
156
- prompt: string;
157
- feedback: string | null;
158
- };
159
- interface FlowSdkImage {
160
- base64: string;
161
- mimeType: string;
162
- }
163
- interface FlowSdk {
164
- generate: {
165
- image: (options: Record<string, any>) => Promise<{
166
- base64: string;
167
- mediaId: string;
168
- }>;
169
- text: (prompt: string, options?: {
170
- systemInstruction?: string;
171
- thinkingLevel?: string;
172
- images?: FlowSdkImage[];
173
- }) => Promise<{
174
- text: string;
175
- }>;
176
- };
177
- download: (args: {
178
- base64: string;
179
- mimeType: string;
180
- filename: string;
181
- }) => Promise<void>;
182
- media: {
183
- selectMultiple: (args: {
184
- filter: string;
185
- }) => Promise<any[]>;
186
- };
187
- }
188
- declare function createFlowServices(Flow: FlowSdk): {
189
- generateImage: (options: Record<string, any>) => Promise<{
190
- base64: string;
191
- mediaId: string;
192
- }>;
193
- generateText: (text: string, options?: {
194
- images?: FlowSdkImage[];
195
- systemInstruction?: string;
196
- }) => Promise<string>;
197
- };
198
- declare function interpretSdkError(err: any): Error;
199
-
200
151
  interface ExtractedCharacter {
201
152
  name: string;
202
153
  prompts: {
@@ -265,6 +216,8 @@ interface TagBaseUser {
265
216
  id: number;
266
217
  username: string;
267
218
  active_context_id?: number;
219
+ /** Exakte Context-Zugriffe wie Context.listForUser (explizit + Eigentum). */
220
+ context_ids: number[];
268
221
  }
269
222
  interface TagBaseContext {
270
223
  id: number;
@@ -426,39 +379,29 @@ interface AvatarArchitectAppProps {
426
379
  base64: string;
427
380
  mediaId?: string;
428
381
  }>;
429
- onGeneratePrompt: (text: string, options?: {
430
- images?: {
431
- base64: string;
432
- mimeType: string;
433
- }[];
434
- systemInstruction?: string;
435
- }) => Promise<string>;
382
+ onGeneratePrompt: FlowGenerateText;
436
383
  onDownload: (base64: string, mimeType: string, filename: string) => Promise<void>;
437
384
  onSelectMedia: () => Promise<MediaItem[]>;
438
385
  buildInfo?: string;
439
386
  initialHfToken?: string;
440
387
  hfNamespace?: string;
441
388
  allowDevNamespace?: boolean;
389
+ /** Flow-Host verlangt vor der App dieselbe User-/Context-Auswahl wie React. */
390
+ requireWorkspaceSelection?: boolean;
442
391
  serverBaseUrl?: string;
443
392
  onFetchServerProjects?: () => Promise<ProjectMeta[]>;
444
393
  onServerSave?: (zipBase64: string, name: string) => Promise<ProjectMeta>;
445
394
  onServerLoad?: (id: string) => Promise<File>;
446
395
  onServerDelete?: (id: string) => Promise<void>;
447
396
  }
448
- declare function AvatarArchitectApp({ onGenerateImage, onGeneratePrompt, onDownload, onSelectMedia, buildInfo, initialHfToken, hfNamespace, allowDevNamespace, serverBaseUrl, onFetchServerProjects, onServerSave, onServerLoad, onServerDelete }: AvatarArchitectAppProps): React__default.JSX.Element;
397
+ declare function AvatarArchitectApp({ onGenerateImage, onGeneratePrompt, onDownload, onSelectMedia, buildInfo, initialHfToken, hfNamespace, allowDevNamespace, requireWorkspaceSelection, serverBaseUrl, onFetchServerProjects, onServerSave, onServerLoad, onServerDelete }: AvatarArchitectAppProps): React__default.JSX.Element;
449
398
 
450
399
  interface FaAppProps {
451
400
  onGenerateImage: (params: Record<string, any>) => Promise<{
452
401
  base64: string;
453
402
  mediaId?: string;
454
403
  }>;
455
- onGeneratePrompt: (prompt: string, options?: {
456
- images?: {
457
- base64: string;
458
- mimeType: string;
459
- }[];
460
- systemInstruction?: string;
461
- }) => Promise<{
404
+ onGeneratePrompt: (prompt: string, options?: FlowTextGenerationOptions) => Promise<{
462
405
  text: string;
463
406
  }>;
464
407
  onGenerateVideo?: (params: Record<string, any>) => Promise<{
@@ -487,6 +430,20 @@ interface FaAppProps {
487
430
  }
488
431
  declare function FaApp({ onGenerateImage, onGeneratePrompt, onGenerateVideo: _onGenerateVideo, onDownload, onSelectMedia, onFlowSave: _onFlowSave, onFlowUpload: _onFlowUpload, onFlowMediaUpload: _onFlowMediaUpload, libToken, allowDevNamespace, serverBaseUrl, onFetchServerProjects, onServerSave, onServerLoad, onServerDelete, buildInfo, }: FaAppProps): React.JSX.Element;
489
432
 
433
+ interface FlowWorkspacePickerProps {
434
+ tagBase: TagBase;
435
+ selectedUserId: number | null;
436
+ message?: string | null;
437
+ onSelectUser: (userId: number) => void;
438
+ onSelectContext: (contextId: number) => void;
439
+ }
440
+ /**
441
+ * Flow-Einstieg wie in React: zuerst User, danach genau einer seiner Contexts.
442
+ * Die Zuordnung kommt aus der Server-generierten Tag-Base; die UI leitet
443
+ * weder Rechte aus owner_id ab noch zeigt sie pauschal alle Contexts.
444
+ */
445
+ declare function FlowWorkspacePicker({ tagBase, selectedUserId, message, onSelectUser, onSelectContext, }: FlowWorkspacePickerProps): React.JSX.Element;
446
+
490
447
  interface CollapsibleCardProps {
491
448
  title: string;
492
449
  icon?: ReactNode;
@@ -563,6 +520,338 @@ interface TagManagerPanelProps {
563
520
  }
564
521
  declare function TagManagerPanel({ workspaceTags, onTagCreate, onTagUpdate, onTagDelete, onTagReorder, onTagMove }: TagManagerPanelProps): React__default.JSX.Element;
565
522
 
523
+ type SaveState = 'idle' | 'saving' | 'restoring' | 'conflict';
524
+ interface SliceMeta {
525
+ revision: number;
526
+ dirty: boolean;
527
+ saveState: SaveState;
528
+ conflict: PersistedSlice<unknown> | null;
529
+ loadRequestId: string | null;
530
+ }
531
+ interface FaStoreState {
532
+ workspaceId: string;
533
+ slices: Partial<Record<FeatureSliceId, unknown>>;
534
+ meta: Partial<Record<FeatureSliceId, SliceMeta>>;
535
+ loadSlice(sliceId: FeatureSliceId, signal?: AbortSignal, requestId?: string): Promise<LoadResult<unknown>>;
536
+ updateSlice<T>(sliceId: FeatureSliceId, updater: (current: T) => T): void;
537
+ saveSlice(sliceId: FeatureSliceId, signal?: AbortSignal): Promise<WriteResult<unknown>>;
538
+ resetSlice(sliceId: FeatureSliceId, signal?: AbortSignal, options?: {
539
+ confirmed?: boolean;
540
+ }): Promise<WriteResult<unknown>>;
541
+ acceptRemote(sliceId: FeatureSliceId): void;
542
+ overwriteRemote(sliceId: FeatureSliceId, signal?: AbortSignal): Promise<WriteResult<unknown>>;
543
+ }
544
+ interface CreateFaStoreOptions {
545
+ contracts: Partial<Record<FeatureSliceId, SliceContract<unknown>>>;
546
+ descriptors: Partial<Record<FeatureSliceId, PersistenceDescriptor>>;
547
+ persistence: WorkspacePersistence;
548
+ workspaceId: string;
549
+ }
550
+ type FaStore = ReturnType<typeof createFaStore>;
551
+ declare function createFaStore({ contracts, descriptors, persistence, workspaceId }: CreateFaStoreOptions): zustand_vanilla.StoreApi<FaStoreState>;
552
+
553
+ interface InMemoryWorkspacePersistence extends WorkspacePersistence {
554
+ /** Nur für Tests: rohen Persistenz-Eintrag lesen, ohne Kopie-Semantik zu brechen. */
555
+ peek(workspaceId: string, tabId: WorkspaceTabId): PersistedSlice<unknown> | undefined;
556
+ }
557
+ declare function createInMemoryWorkspacePersistence(now?: () => number): InMemoryWorkspacePersistence;
558
+
559
+ declare function useFaSlice<T>(store: FaStore, sliceId: FeatureSliceId): T;
560
+ declare function useFaSliceMeta(store: FaStore, sliceId: FeatureSliceId): SliceMeta | undefined;
561
+
562
+ interface CreatePersistenceCoordinatorOptions {
563
+ store: FaStore;
564
+ /**
565
+ * Muss derselbe Adapter sein, der in den Store injiziert wurde. Der
566
+ * Coordinator ruft die Persistenz nicht direkt auf (alle IO-Aktionen
567
+ * laufen über die Store-Actions); der Parameter macht die Kopplung an
568
+ * der Konstruktionsstelle sichtbar und ist für spätere Direktzugriffe
569
+ * (z.B. Batch-Restore) reserviert.
570
+ */
571
+ persistence: WorkspacePersistence;
572
+ debounceMs?: number;
573
+ now?: () => number;
574
+ requestId?: () => string;
575
+ }
576
+ interface PersistenceCoordinator {
577
+ load(sliceId: FeatureSliceId): Promise<LoadResult<unknown>>;
578
+ scheduleSave(sliceId: FeatureSliceId): void;
579
+ flush(sliceId: FeatureSliceId): Promise<void>;
580
+ retry(sliceId: FeatureSliceId): Promise<void>;
581
+ dispose(): void;
582
+ }
583
+ declare function createPersistenceCoordinator({ store, debounceMs, requestId, }: CreatePersistenceCoordinatorOptions): PersistenceCoordinator;
584
+
585
+ type LegacySourceResult<S> = {
586
+ kind: 'found';
587
+ value: S;
588
+ version: number;
589
+ } | {
590
+ kind: 'notFound';
591
+ };
592
+ type LegacyMigrationResult = {
593
+ kind: 'migrated';
594
+ } | {
595
+ kind: 'alreadyMigrated';
596
+ } | {
597
+ kind: 'markedExistingTarget';
598
+ } | {
599
+ kind: 'nothingToMigrate';
600
+ } | {
601
+ kind: 'unsupportedVersion';
602
+ found: number;
603
+ supported: number[];
604
+ };
605
+ interface LegacyMigrationOptions<S, T> {
606
+ migrationId: string;
607
+ readSource(): Promise<LegacySourceResult<S>>;
608
+ transform(source: S, version: number): T;
609
+ writeTarget(value: T): Promise<void>;
610
+ readMarker(): Promise<boolean>;
611
+ writeMarker(): Promise<void>;
612
+ /** Optional: Ziel lesen, um teilweise erfolgte Läufe zu erkennen und das Ergebnis zu validieren. */
613
+ readTarget?(): Promise<T | undefined>;
614
+ /** Optional: wirft bei ungültigem Ziel; Default akzeptiert jeden Wert ungleich undefined. */
615
+ validateTarget?(value: unknown): T;
616
+ /** Zulässige Quellversionen; Default [1]. */
617
+ supportedVersions?: number[];
618
+ }
619
+ declare function runLegacyMigration<S, T>(options: LegacyMigrationOptions<S, T>): Promise<LegacyMigrationResult>;
620
+
621
+ interface LibraryWorkspaceState {
622
+ filterTagIds: string[];
623
+ filterMode: 'and' | 'or';
624
+ selectedItemId: string | null;
625
+ galleryIndex: number;
626
+ /** Zuletzt umgeschaltete Filter-Tags (max 5, jüngster zuerst). */
627
+ recentFilterTagIds: string[];
628
+ }
629
+ declare const LIBRARY_SLICE_SCHEMA_VERSION = 1;
630
+ declare function createLibraryDefault(): LibraryWorkspaceState;
631
+ declare const libraryContract: SliceContract<LibraryWorkspaceState>;
632
+ declare const libraryReactDescriptor: PersistenceDescriptor<'library'>;
633
+ declare const LIBRARY_CUTOVER_MARKER = "cutover.library.v1";
634
+ interface LibraryLegacySource {
635
+ /** Rohwert von localStorage 'libraryFilterTags' (JSON) oder null. */
636
+ filterTagsRaw: string | null;
637
+ /** Rohwert von localStorage 'libraryFilterMode' oder null. */
638
+ filterModeRaw: string | null;
639
+ /** Rohwert von localStorage 'fineart_recent_filters' (JSON) oder null. */
640
+ recentFiltersRaw?: string | null;
641
+ }
642
+ interface RunLibraryLegacyImportOptions {
643
+ readLocalStorage(key: string): string | null;
644
+ /** IDs/Labels der tatsächlich existierenden Tags — nur diese werden übernommen. */
645
+ knownTagIds: Set<string>;
646
+ readTarget(): Promise<LibraryWorkspaceState | undefined>;
647
+ writeTarget(value: LibraryWorkspaceState): Promise<void>;
648
+ readMarker(): Promise<boolean>;
649
+ writeMarker(): Promise<void>;
650
+ }
651
+ declare function parseLegacyLibraryFilters(source: LibraryLegacySource, knownTagIds: Set<string>): LibraryWorkspaceState | null;
652
+ declare function runLibraryLegacyImport(options: RunLibraryLegacyImportOptions): Promise<LegacyMigrationResult>;
653
+
654
+ interface LibraryViewTag {
655
+ label: string;
656
+ category?: string;
657
+ inherited?: boolean;
658
+ }
659
+ interface LibraryViewItem {
660
+ /** Stabile Host-Referenz (Library-ID bzw. Gruppen-Repräsentant). */
661
+ id: string;
662
+ title: string;
663
+ timestamp: number;
664
+ rating?: number;
665
+ notes?: string;
666
+ tags: LibraryViewTag[];
667
+ /** Fertige Thumb-Quelle (URL oder data:-URI); Auflösung ist Host-Sache. */
668
+ thumbUrl?: string | null;
669
+ /** Anzahl Bilder der Gruppe/Galerie (Badge ab 2). */
670
+ galleryCount?: number;
671
+ }
672
+ interface LibraryListQuery {
673
+ filterTagIds: string[];
674
+ filterMode: 'and' | 'or';
675
+ sortBy: 'rating' | 'timestamp' | 'title';
676
+ sortOrder: 'asc' | 'desc';
677
+ limit: number;
678
+ }
679
+ interface LibraryPage {
680
+ items: LibraryViewItem[];
681
+ /** Gesamtzahl nach Filter (für "weitere laden"). */
682
+ total: number;
683
+ }
684
+ interface LibraryDataSource {
685
+ listLibraryItems(query: LibraryListQuery, ctx: RequestContext): Promise<QueryResult<LibraryPage>>;
686
+ }
687
+ type LabSlotId = 'A' | 'B';
688
+ /** Optionale Commands; jeder fehlende Key ist eine im Host nicht vorhandene Capability. */
689
+ interface LibraryCommands {
690
+ deleteItem?: (item: LibraryViewItem) => Promise<CommandResult<void>>;
691
+ setCover?: (item: LibraryViewItem) => Promise<CommandResult<void>>;
692
+ assignToLab?: (slot: LabSlotId, item: LibraryViewItem) => Promise<CommandResult<void>>;
693
+ editMetadata?: (item: LibraryViewItem) => Promise<CommandResult<void>>;
694
+ }
695
+ type LibraryCommandName = keyof LibraryCommands;
696
+ /**
697
+ * In-Memory-DataSource über bereits geladene Items: wendet Tag-Filter,
698
+ * Sortierung und Limit deterministisch an. Für Hosts, die ihre Items selbst
699
+ * beschaffen (React: Server-Fetch im Host; Flow: HF-Snapshot/Projekt).
700
+ */
701
+ declare function createInMemoryLibraryDataSource(getItems: () => LibraryViewItem[]): LibraryDataSource;
702
+
703
+ interface LibraryViewProps {
704
+ dataSource: LibraryDataSource;
705
+ query: LibraryListQuery;
706
+ onQueryChange: (next: LibraryListQuery) => void;
707
+ commands?: LibraryCommands;
708
+ onSelectItem?: (item: LibraryViewItem) => void;
709
+ selectedItemId?: string | null;
710
+ /** Aktuelle Lab-Slot-Belegung (Item-IDs) zur Markierung von A/B. */
711
+ labAssignments?: Partial<Record<LabSlotId, string>>;
712
+ layout?: 'list' | 'grid';
713
+ emptyText?: string;
714
+ /** Host-gerenderte Zusatzaktionen je Item (z.B. Flow-Referenzgenerierung). */
715
+ renderItemExtras?: (item: LibraryViewItem) => React__default.ReactNode;
716
+ /** Host-Datenversion: Änderung erzwingt Re-Query (z.B. nach Reload/Import). */
717
+ dataVersion?: number;
718
+ /** Schrittweite für "weitere laden" (Default 20). */
719
+ pageStep?: number;
720
+ }
721
+ declare const LibraryView: React__default.FC<LibraryViewProps>;
722
+
723
+ /** Kanonischer flacher Tag (Server = Master; Flow-TagBase trägt dieselben Felder). */
724
+ interface TagEntry {
725
+ id: string;
726
+ context_id: string | null;
727
+ category: string;
728
+ label: string;
729
+ value: string;
730
+ ord: number;
731
+ enabled: boolean;
732
+ }
733
+ /**
734
+ * Eingabeform für den Selector: flache Rows aus /api/v2/tags bzw. TagBase.
735
+ * `id` ist Pflicht (fehlend → Selector wirft); Zusatzfelder wie
736
+ * `is_inherited`/`context_name` reicht die Ableitung durch.
737
+ */
738
+ interface TagEntryInput {
739
+ id?: string | number | null;
740
+ category?: string | null;
741
+ label?: string | null;
742
+ value?: string | null;
743
+ ord?: number;
744
+ enabled?: boolean;
745
+ is_inherited?: boolean;
746
+ context_name?: string;
747
+ }
748
+ interface TagViewOption {
749
+ /** Pflicht-ID (Entscheidung Nr. 4: Fail fast statt „Cannot move tag"). */
750
+ id: string;
751
+ l: string;
752
+ v: string;
753
+ /** Originale DB-Kategorie (mit Prefix) für Edit/Clone/Move. */
754
+ cat: string;
755
+ is_inherited?: boolean;
756
+ context_name?: string;
757
+ }
758
+ interface TagViewCategory {
759
+ title: string;
760
+ type: 'multi' | 'single';
761
+ options: TagViewOption[];
762
+ }
763
+ type TagViewScope = Record<string, TagViewCategory>;
764
+ type TagViewModel = Record<string, TagViewScope>;
765
+ interface TagQueries {
766
+ listTags(ctx: RequestContext): Promise<QueryResult<TagEntry[]>>;
767
+ }
768
+ interface TagUpdateDelta {
769
+ label?: string;
770
+ value?: string;
771
+ category?: string;
772
+ ord?: number;
773
+ enabled?: boolean;
774
+ }
775
+ /**
776
+ * Optionale Commands; fehlender Key = Capability im Host nicht vorhanden.
777
+ * React-Adapter schreibt `/api/v2/tags` (Master), Flow-Adapter schreibt
778
+ * Workspace-Tags bzw. Vorschlags-Events (Follower, HF_TAG_SYNC.md) — der
779
+ * Vertrag ist identisch, die Schreibwege liegen im jeweiligen Host.
780
+ */
781
+ interface TagCommands {
782
+ createTag?: (input: {
783
+ category: string;
784
+ label: string;
785
+ value: string;
786
+ }) => Promise<CommandResult<void>>;
787
+ updateTag?: (id: string, delta: TagUpdateDelta) => Promise<CommandResult<void>>;
788
+ deleteTag?: (id: string) => Promise<CommandResult<void>>;
789
+ moveTag?: (id: string, targetCategory: string) => Promise<CommandResult<void>>;
790
+ reorderTags?: (category: string, orderedIds: string[]) => Promise<CommandResult<void>>;
791
+ }
792
+ type TagCommandName = keyof TagCommands;
793
+
794
+ interface TagManagerSelection {
795
+ scopeKey: string | null;
796
+ categoryKey: string | null;
797
+ }
798
+ interface TagManagerProps {
799
+ tags: TagEntryInput[];
800
+ commands?: TagCommands;
801
+ /** Optional kontrollierte Auswahl (Host bindet sie an den tags-Slice). */
802
+ selection?: TagManagerSelection;
803
+ onSelectionChange?: (next: TagManagerSelection) => void;
804
+ emptyText?: string;
805
+ /**
806
+ * Wenn gesetzt, bietet das Create-Formular ein „Neue Kategorie"-Feld an;
807
+ * der Host bestimmt das DB-Kategorie-Format (React: `${scope}:${name}`).
808
+ */
809
+ newCategoryName?: (scopeKey: string, name: string) => string;
810
+ /** Diese Scopes sind immer als Tab wählbar, auch ohne vorhandene Tags. */
811
+ ensureScopes?: string[];
812
+ }
813
+ declare const TagManager: React__default.FC<TagManagerProps>;
814
+
815
+ /** DB-Kategorien (Subkategorien) → App-Scopes. Nicht gemappte Kategorien sind selbst Scope. */
816
+ declare const SCOPE_MAP: Record<string, string>;
817
+ declare function deriveTagViewModel(tags: TagEntryInput[]): TagViewModel;
818
+ /** Flache Kategorie-Liste eines View-Models (für Kategorie-Auswahl im Manager). */
819
+ declare function listCategories(model: TagViewModel): {
820
+ scopeKey: string;
821
+ categoryKey: string;
822
+ title: string;
823
+ dbCategory: string | null;
824
+ }[];
825
+
826
+ interface TagsWorkspaceState {
827
+ /** Aktiver Scope-Tab im Manager (null = erster verfügbarer). */
828
+ selectedScopeKey: string | null;
829
+ /** Aktive Kategorie im Scope (null = erste verfügbare). */
830
+ selectedCategoryKey: string | null;
831
+ /** Zuletzt vergebene Tags als ID-Referenzliste (max 10, jüngste zuerst). */
832
+ recentAssignedTagIds: string[];
833
+ }
834
+ declare const TAGS_SLICE_SCHEMA_VERSION = 1;
835
+ declare function createTagsDefault(): TagsWorkspaceState;
836
+ declare const tagsContract: SliceContract<TagsWorkspaceState>;
837
+ declare const tagsReactDescriptor: PersistenceDescriptor<'tags'>;
838
+ declare const TAGS_CUTOVER_MARKER = "cutover.tags.v1";
839
+ interface LegacyRecentTagRef {
840
+ label: string;
841
+ category: string | null;
842
+ }
843
+ declare function parseLegacyRecentTags(raw: string | null): LegacyRecentTagRef[];
844
+ interface RunTagsLegacyImportOptions {
845
+ readLocalStorage(key: string): string | null;
846
+ /** Label(+Kategorie) → existierende Tag-ID; null = nicht auflösbar (fällt weg). */
847
+ resolveTagId(ref: LegacyRecentTagRef): string | null;
848
+ readTarget(): Promise<TagsWorkspaceState | undefined>;
849
+ writeTarget(value: TagsWorkspaceState): Promise<void>;
850
+ readMarker(): Promise<boolean>;
851
+ writeMarker(): Promise<void>;
852
+ }
853
+ declare function runTagsLegacyImport(options: RunTagsLegacyImportOptions): Promise<LegacyMigrationResult>;
854
+
566
855
  interface LabsTabProps {
567
856
  services: LabServices;
568
857
  onResult?: (item: LabItem) => void;
@@ -665,6 +954,7 @@ interface HFStateSnapshot {
665
954
  metadata: HFMetadataEntry[];
666
955
  tags: WorkspaceTags;
667
956
  meta: HFStateMeta;
957
+ openTasks?: Record<string, TaskRequestedPayload>;
668
958
  }
669
959
  interface HFFileInfo$1 {
670
960
  type: 'file' | 'directory';
@@ -672,6 +962,7 @@ interface HFFileInfo$1 {
672
962
  size: number;
673
963
  }
674
964
  interface ImageAddedPayload extends HFMetadataEntry {
965
+ taskId?: string;
675
966
  }
676
967
  interface TagUpsertedPayload {
677
968
  category: string;
@@ -684,16 +975,21 @@ interface MetadataUpdatedPayload {
684
975
  id: string;
685
976
  delta: Partial<HFMetadataEntry>;
686
977
  }
687
-
688
- declare function getHFToken(): string | null;
689
- declare function setHFToken(token: string): void;
690
- interface HFProjectMeta {
691
- id: string;
692
- name: string;
693
- path: string;
694
- size: number;
695
- isLfs: boolean;
978
+ interface TaskRequestedPayload {
979
+ taskId: string;
980
+ taskType: string;
981
+ params: {
982
+ prompt: string;
983
+ tags?: string[];
984
+ book?: string;
985
+ kapitel?: string;
986
+ ankerId?: string;
987
+ promptVersion?: number;
988
+ [key: string]: any;
989
+ };
990
+ expiresAt?: number;
696
991
  }
992
+
697
993
  interface HFFileInfo {
698
994
  type: 'file' | 'directory';
699
995
  path: string;
@@ -707,10 +1003,28 @@ declare function hfBatchArchive(moves: Array<{
707
1003
  content: string;
708
1004
  }>, token: string, summary: string): Promise<void>;
709
1005
  declare function tsFromEventPath(repoPath: string): number;
710
- declare function loadHFState(namespace: string, token: string): Promise<HFStateSnapshot | null>;
711
1006
  declare function loadPendingEvents(namespace: string, token: string, sinceTs: number, knownPaths?: Set<string>): Promise<HFEvent[]>;
712
1007
  declare function getSessionClientId(): string;
713
- declare function writeHFEvent<P>(namespace: string, token: string, type: string, payload: P, prevTs: number[]): Promise<HFEvent<P>>;
1008
+ declare function writeHFEvent<P>(namespace: string, token: string, type: string, payload: P, prevTs: number[], options?: {
1009
+ /**
1010
+ * Schreibreihenfolge innerhalb einer Millisekunde erhalten.
1011
+ *
1012
+ * Vorgabe `false` — der Dateiname bleibt dann Byte für Byte der bisherige.
1013
+ * Domains, für die die Logreihenfolge fachlich zählt, schalten es ein.
1014
+ */
1015
+ ordered?: boolean;
1016
+ }): Promise<HFEvent<P>>;
1017
+
1018
+ declare function getHFToken(): string | null;
1019
+ declare function setHFToken(token: string): void;
1020
+ interface HFProjectMeta {
1021
+ id: string;
1022
+ name: string;
1023
+ path: string;
1024
+ size: number;
1025
+ isLfs: boolean;
1026
+ }
1027
+ declare function loadHFState(namespace: string, token: string): Promise<HFStateSnapshot | null>;
714
1028
  declare function hfBootstrapFromLegacy(namespace: string, token: string, onProgress?: (msg: string) => void): Promise<void>;
715
1029
  declare function hfListProjects(token: string): Promise<HFProjectMeta[]>;
716
1030
  declare function hfDownloadProject(path: string, token: string): Promise<File>;
@@ -743,23 +1057,6 @@ interface HFStateResult {
743
1057
  }
744
1058
  declare function useHFState(token: string, namespace: string): HFStateResult;
745
1059
 
746
- declare function applyEvent(state: HFStateSnapshot, event: HFEvent): HFStateSnapshot;
747
- declare function applyEvents(state: HFStateSnapshot, events: HFEvent[]): HFStateSnapshot;
748
-
749
- interface DagNode {
750
- event: HFEvent;
751
- children: number[];
752
- }
753
- interface DagFork {
754
- parentTs: number;
755
- childTs: number[];
756
- }
757
- type Dag = Map<number, DagNode>;
758
- declare function buildDag(events: HFEvent[]): Dag;
759
- declare function findTips(dag: Dag): number[];
760
- declare function findForks(dag: Dag): DagFork[];
761
- declare function topoSort(events: HFEvent[]): HFEvent[];
762
-
763
1060
  interface UseTagBaseResult {
764
1061
  tagBase: TagBase | null;
765
1062
  isLoading: boolean;
@@ -783,6 +1080,4 @@ interface UseTagBaseResult {
783
1080
  }
784
1081
  declare function useTagBase(token: string, namespace: string): UseTagBaseResult;
785
1082
 
786
- declare const LIB_VERSION = "2.0.73";
787
-
788
- export { AvatarArchitectApp, type AvatarArchitectAppProps, CURRENT_TAG_EVENT_VERSION, CollapsibleCard, CompactDropdown, type DagFork, type ExtractedCharacter, FaApp, type FaAppProps, FaToolsBadge, type FlowSdk, GLOBAL_STYLES, type Generation, type HFEvent, type HFEventVersion, type HFFileInfo$1 as HFFileInfo, type HFMetadataEntry, type HFStateMeta, type HFStateResult, type HFStateSnapshot, HistoryPanel, type ImageAddedPayload, InspectPanel, LIB_VERSION, LabBlend, LabCompare, type LabFrame, LabFrameExtractor, type LabFrameExtractorProps, LabImagePicker, type LabItem, LabLoop, LabRemix, type LabServices, LabsTab, ListView, type MediaItem, MediaLibrary, type MetadataUpdatedPayload, PillButton, type ProjectMeta, type ProjectSettings, ProjectSyncTab, PromptTab, SectionLabel, type SelectedLabImage, type SelectedTag, type SelectionValidation, ServerTab, SetupPanel, type SyncDiff, type TagBase, type TagBaseContext, type TagBaseEvent, type TagBaseMeta, TagBaseSection, type TagBaseSectionProps, type TagBaseTagEntry, type TagBaseTagOption, type TagBaseUser, type TagBaseWorkspaceTags, type TagCreatedEvent, type TagCreatedPayload, TagManagerPanel, type TagOption, type TagUpdatedDelta, type TagUpdatedEvent, type TagUpdatedPayload, type TagUpsertedPayload, type UseTagBaseResult, type WorkspaceTags, applyEvent, applyEvents, autoLabel, buildBlendInstruction, buildCompareInstruction, buildDag, buildFallbackPrompt, buildGenerationPrompt, buildImageGenerationOptions, buildLoopInstruction, buildPromptTabPayload, buildReferenceImageMediaIds, buildRemixInstruction, buildScanInstruction, cleanAiResponse, createFlowServices, createTagCreatedEvent, createTagUpdatedEvent, deriveTagBaseWorkspaceTags, exportProjectToZip, findForks, findTips, formatTreeToMarkdown, frameToGeneration, getFormattedTimestamp, getHFToken, getSessionClientId, groupGenerationsToLabItems, hfBatchArchive, hfBootstrapFromLegacy, hfDeleteProject, hfDownloadProject, hfListDir, hfListProjects, hfLoadImageAsBase64, hfUploadImage, hfUploadProjectForm, hfUploadSmallFile, importProjectFromZip, injectXMPMetadata, interpretSdkError, loadHFState, loadPendingEvents, loadTagBase, parsePromptFile, parsePromptResponse, setHFToken, topoSort, tsFromEventPath, useHFState, useKeyboardNavigation, useOnClickOutside, useTagBase, validateTagBaseSelection, writeHFEvent, writeTagEvent };
1083
+ export { AvatarArchitectApp, type AvatarArchitectAppProps, CURRENT_TAG_EVENT_VERSION, CollapsibleCard, CommandResult, CompactDropdown, type CreateFaStoreOptions, type CreatePersistenceCoordinatorOptions, type ExtractedCharacter, FaApp, type FaAppProps, type FaStore, type FaStoreState, FaToolsBadge, FeatureSliceId, FlowTextGenerationOptions, FlowWorkspacePicker, type FlowWorkspacePickerProps, GLOBAL_STYLES, type Generation, type HFEvent, type HFEventVersion, type HFFileInfo$1 as HFFileInfo, type HFMetadataEntry, type HFStateMeta, type HFStateResult, type HFStateSnapshot, HistoryPanel, type ImageAddedPayload, type InMemoryWorkspacePersistence, InspectPanel, LIBRARY_CUTOVER_MARKER, LIBRARY_SLICE_SCHEMA_VERSION, version as LIB_VERSION, LabBlend, LabCompare, type LabFrame, LabFrameExtractor, type LabFrameExtractorProps, LabImagePicker, type LabItem, LabLoop, LabRemix, type LabServices, type LabSlotId, LabsTab, type LegacyMigrationOptions, type LegacyMigrationResult, type LegacyRecentTagRef, type LegacySourceResult, type LibraryCommandName, type LibraryCommands, type LibraryDataSource, type LibraryLegacySource, type LibraryListQuery, type LibraryPage, LibraryView, type LibraryViewItem, type LibraryViewProps, type LibraryViewTag, type LibraryWorkspaceState, ListView, LoadResult, type MediaItem, MediaLibrary, type MetadataUpdatedPayload, PersistedSlice, type PersistenceCoordinator, PersistenceDescriptor, PillButton, type ProjectMeta, type ProjectSettings, ProjectSyncTab, PromptTab, QueryResult, RequestContext, type RunLibraryLegacyImportOptions, type RunTagsLegacyImportOptions, SCOPE_MAP, type SaveState, SectionLabel, type SelectedLabImage, SelectedTag, type SelectionValidation, ServerTab, SetupPanel, SliceContract, type SliceMeta, type SyncDiff, TAGS_CUTOVER_MARKER, TAGS_SLICE_SCHEMA_VERSION, type TagBase, type TagBaseContext, type TagBaseEvent, type TagBaseMeta, TagBaseSection, type TagBaseSectionProps, type TagBaseTagEntry, type TagBaseTagOption, type TagBaseUser, type TagBaseWorkspaceTags, type TagCommandName, type TagCommands, type TagCreatedEvent, type TagCreatedPayload, type TagEntry, type TagEntryInput, TagManager, TagManagerPanel, type TagManagerProps, type TagManagerSelection, type TagOption, type TagQueries, type TagUpdateDelta, type TagUpdatedDelta, type TagUpdatedEvent, type TagUpdatedPayload, type TagUpsertedPayload, type TagViewCategory, type TagViewModel, type TagViewOption, type TagViewScope, type TagsWorkspaceState, type UseTagBaseResult, WorkspacePersistence, WorkspaceTabId, type WorkspaceTags, WriteResult, autoLabel, buildBlendInstruction, buildCompareInstruction, buildLoopInstruction, buildReferenceImageMediaIds, buildRemixInstruction, buildScanInstruction, createFaStore, createInMemoryLibraryDataSource, createInMemoryWorkspacePersistence, createLibraryDefault, createPersistenceCoordinator, createTagCreatedEvent, createTagUpdatedEvent, createTagsDefault, deriveTagBaseWorkspaceTags, deriveTagViewModel, exportProjectToZip, formatTreeToMarkdown, frameToGeneration, getFormattedTimestamp, getHFToken, getSessionClientId, groupGenerationsToLabItems, hfBatchArchive, hfBootstrapFromLegacy, hfDeleteProject, hfDownloadProject, hfListDir, hfListProjects, hfLoadImageAsBase64, hfUploadImage, hfUploadProjectForm, hfUploadSmallFile, importProjectFromZip, injectXMPMetadata, libraryContract, libraryReactDescriptor, listCategories, loadHFState, loadPendingEvents, loadTagBase, parseLegacyLibraryFilters, parseLegacyRecentTags, parsePromptFile, runLegacyMigration, runLibraryLegacyImport, runTagsLegacyImport, setHFToken, tagsContract, tagsReactDescriptor, tsFromEventPath, useFaSlice, useFaSliceMeta, useHFState, useKeyboardNavigation, useOnClickOutside, useTagBase, validateTagBaseSelection, writeHFEvent, writeTagEvent };