@rslsp1/fa-app-tools 2.0.85 → 2.0.86
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/{chunk-MILMVOK7.mjs → chunk-DGFMONWO.mjs} +226 -59
- package/dist/hfEventTypes-C_PX6RFR.d.ts +241 -0
- package/dist/hfEventTypes-Dkfrcd_t.d.mts +241 -0
- package/dist/index.d.mts +4 -172
- package/dist/index.d.ts +4 -172
- package/dist/index.js +157 -65
- package/dist/index.mjs +3 -71
- package/dist/szenen.d.mts +99 -5
- package/dist/szenen.d.ts +99 -5
- package/dist/szenen.js +230 -61
- package/dist/szenen.mjs +7 -1
- package/package.json +1 -1
- package/dist/flowTextGenerationPort-CeDUFutP.d.mts +0 -73
- package/dist/flowTextGenerationPort-KHjCGt_S.d.ts +0 -73
package/dist/szenen.d.ts
CHANGED
|
@@ -2,8 +2,8 @@ import { ac as SchemaError, Z as PublishFinding, Y as PublishCheckResult, aj as
|
|
|
2
2
|
export { A as ALL_PUBLISH_RULES, C as CHAIN_EDGES, b as CHAIN_LINK_FIELDS, c as CatalogueEntry, d as ChainLinkField, e as ChainTarget, f as ChainVerdict, g as CompiledSchemas, i as ContractCheck, j as ContractCheckResult, k as ContractRunResult, l as ContractViolation, m as CreateElementInput, D as DERIVABLE_TYPES, r as DerivationEnvelope, t as DerivationFailureClass, x as DerivationPolicyPayload, y as DerivationProposal, z as DraftChainLink, E as DraftFork, F as DraftRecord, G as ElementMetadata, H as ElementRecord, J as ElementStoreContractHarness, K as ElementVersionValidation, L as FindingSeverity, O as OptionalCommand, P as PROBE_VERSION_ID, Q as ParentRelation, R as PreferredHeadOutcome, S as PreferredHeadResolution, T as PreferredHeadSelection, U as PreferredHeadSource, V as ProjectionState, W as ProjectionStatus, X as PublishCheckInput, _ as PublishRejected, $ as PublishVersionInput, a0 as PublishedVersion, a1 as REFERENCE_FIELD, a3 as ResolvePreferredHeadOptions, a4 as ResolvedVersion, a5 as ReviseMetadataInput, a6 as STYLE_PAYLOAD, a7 as STYLE_PAYLOAD_V2, a8 as SZENEN_ELEMENT_TYPES, a9 as SceneDerivationInput, aa as SceneDerivationOutcome, ab as SceneDerivationOutput, ad as SchemaValidationResult, ae as SetPreferredHeadInput, af as StoreAuthority, ag as SzenenCommandResult, ak as SzenenProjection, am as TargetModelCandidate, an as TargetModelQueries, ao as TargetModelQuery, aq as UnsupportedSchemaError, as as VersionDag, at as VersionDagError, au as VersionNode, av as VersionParentLink, aw as WriteConflict, ax as WriteDraftInput, ay as assessDerivationResponse, az as buildDerivationSystemInstruction, aA as buildDerivationUserPrompt, aB as buildVersionDag, aC as checkChainTargets, aD as checkDerivationResponse, aE as checkDraftChainMeta, aF as collectVersionRefs, aG as compileSchemas, aH as createSimulationSceneDerivationPort, aI as describeTargetModelFailure, aJ as elementStoreContractChecks, aK as formatSchemaErrors, aL as getSzenenSchemas, aM as isOk, aN as isProjectionCurrent, aO as linkFor, aP as parseDerivationResponse, aQ as preferredVersionId, aR as resolvePreferredHead, aS as resolveTargetModelOver, aT as resolverFromQueries, aU as runElementStoreContract, aV as runPublishChecks, aW as runSceneDerivation, aX as showChain, aY as validateAgainst, aZ as validateDerivationInput, a_ as validateElementVersion, a$ as validatePayload, b0 as withReference } from './storeContract-D7vBM8nv.js';
|
|
3
3
|
import { T as TextGenerationPort, Q as QueryResult, C as CommandResult } from './contracts-DdYOMBl9.js';
|
|
4
4
|
export { S as SIMULATION_PROVIDER, c as TextGenerationRequest, d as TextGenerationResult, g as createFakeTextGenerationPort, h as createSimulationTextGenerationPort, s as simulatedAnswerFor } from './contracts-DdYOMBl9.js';
|
|
5
|
-
import { F as FlowGenerateText } from './
|
|
6
|
-
export { C as CreateFlowTextGenerationPortOptions,
|
|
5
|
+
import { g as HFStateSnapshot, F as FlowGenerateText } from './hfEventTypes-C_PX6RFR.js';
|
|
6
|
+
export { C as CreateFlowTextGenerationPortOptions, t as createFlowTextGenerationPort } from './hfEventTypes-C_PX6RFR.js';
|
|
7
7
|
import React__default from 'react';
|
|
8
8
|
|
|
9
9
|
/** Rohes JSON-Schema, wie es in der Spezifikation steht. */
|
|
@@ -662,6 +662,19 @@ interface ImageBatchPersistedImage {
|
|
|
662
662
|
media_ref: string;
|
|
663
663
|
/** Fachlich stabile Identität, soweit bekannt — hier identisch mit `media_ref` (D-118). */
|
|
664
664
|
asset_id?: string;
|
|
665
|
+
/**
|
|
666
|
+
* Der **bestätigte** MIME-Typ der abgelegten Datei — Review 2026-08-18 §5 P2.
|
|
667
|
+
*
|
|
668
|
+
* Additiv nachgetragen, weil der Batch ihn beim Schreiben kennt, ihn aber
|
|
669
|
+
* nicht führte: Der Lesepfad musste die Dateiendung deshalb über zwei
|
|
670
|
+
* Varianten erraten. Geraten wird nichts mehr — der Typ stammt aus den
|
|
671
|
+
* tatsächlichen Bildbytes (`typAusBytes`), nicht aus einer Annahme, und
|
|
672
|
+
* bestimmt den Pfad `images/<id>.<ext>`, unter dem die Datei liegt.
|
|
673
|
+
*
|
|
674
|
+
* Optional, weil ältere Ereignisse ihn nicht tragen; für die fällt der
|
|
675
|
+
* Lesepfad auf den Bestandseintrag zurück.
|
|
676
|
+
*/
|
|
677
|
+
mime_type?: string | null;
|
|
665
678
|
model?: string | null;
|
|
666
679
|
/** Nur gesetzt, wenn der Provider ihn tatsächlich zurückliefert (D-107). */
|
|
667
680
|
seed?: number | null;
|
|
@@ -2121,8 +2134,16 @@ interface SzenenImageLibraryPort {
|
|
|
2121
2134
|
search?: string;
|
|
2122
2135
|
limit?: number;
|
|
2123
2136
|
}): Promise<QueryResult<readonly LibraryImage[]>>;
|
|
2124
|
-
/**
|
|
2125
|
-
|
|
2137
|
+
/**
|
|
2138
|
+
* Base64 **ohne** `data:`-Präfix und der MIME-Typ — die Modelleingabe.
|
|
2139
|
+
*
|
|
2140
|
+
* `mimeTypeHinweis` ist ein **Hinweis**, kein Zwang: Kennt der Aufrufer den
|
|
2141
|
+
* bestätigten Typ aus dem Batch-Nachweis (`PromptBatchImageRef.mime_type`,
|
|
2142
|
+
* Review 2026-08-18 §5 P2), erspart er dem Host das Raten der Dateiendung,
|
|
2143
|
+
* solange der Bestand das Bild noch nicht führt. Ein Host, der ihn nicht
|
|
2144
|
+
* braucht, ignoriert ihn.
|
|
2145
|
+
*/
|
|
2146
|
+
resolveImage(mediaRef: string, mimeTypeHinweis?: string | null): Promise<QueryResult<{
|
|
2126
2147
|
data: string;
|
|
2127
2148
|
mime_type: string;
|
|
2128
2149
|
}>>;
|
|
@@ -2183,6 +2204,14 @@ interface PromptBatchImageRef {
|
|
|
2183
2204
|
media_ref: string;
|
|
2184
2205
|
position: number;
|
|
2185
2206
|
file?: string;
|
|
2207
|
+
/**
|
|
2208
|
+
* Der bestätigte MIME-Typ der abgelegten Datei, soweit der Nachweis ihn führt
|
|
2209
|
+
* (Review 2026-08-18 §5 P2).
|
|
2210
|
+
*
|
|
2211
|
+
* Der Lesepfad bildet daraus den Dateipfad, statt zwischen den Endungen zu
|
|
2212
|
+
* raten. Optional, weil ältere Batches ihn nicht tragen.
|
|
2213
|
+
*/
|
|
2214
|
+
mime_type?: string | null;
|
|
2186
2215
|
model?: string | null;
|
|
2187
2216
|
seed?: number | null;
|
|
2188
2217
|
width?: number | null;
|
|
@@ -2391,6 +2420,54 @@ declare function unsupportedReason(capability: string): string;
|
|
|
2391
2420
|
*/
|
|
2392
2421
|
declare function callOptional<T>(capability: string, operation: (() => Promise<CommandResult<T>>) | undefined): Promise<CommandResult<T>>;
|
|
2393
2422
|
|
|
2423
|
+
interface HfImageStoreOptions {
|
|
2424
|
+
namespace: string;
|
|
2425
|
+
token: string;
|
|
2426
|
+
now?: () => number;
|
|
2427
|
+
/**
|
|
2428
|
+
* Wie oft ein Bild, das im Bestand fehlt, direkt von HF geholt wird, und wie
|
|
2429
|
+
* lange dazwischen gewartet wird.
|
|
2430
|
+
*
|
|
2431
|
+
* Der Verzug ist real, aber kurz. Ersetzbar, damit ein Test ihn nicht
|
|
2432
|
+
* aussitzen muss.
|
|
2433
|
+
*/
|
|
2434
|
+
leseVersuche?: number;
|
|
2435
|
+
leseBasisMs?: number;
|
|
2436
|
+
schlafen?: (ms: number) => Promise<void>;
|
|
2437
|
+
}
|
|
2438
|
+
interface AufgeloestesBild {
|
|
2439
|
+
data: string;
|
|
2440
|
+
mimeType: string;
|
|
2441
|
+
}
|
|
2442
|
+
interface HfImageStore {
|
|
2443
|
+
/**
|
|
2444
|
+
* Legt ein Bild unter einer **vorgegebenen** Kennung ab.
|
|
2445
|
+
*
|
|
2446
|
+
* Reihenfolge zwingend: erst die Datei, dann das Ereignis (R3 der
|
|
2447
|
+
* 6.9.2-Spezifikation). Ein Nachweis, der auf eine fehlende Datei zeigt,
|
|
2448
|
+
* wäre für jeden Leser ein Fehler; umgekehrt ist es nur eine Datei, die noch
|
|
2449
|
+
* kein Ereignis kennt.
|
|
2450
|
+
*/
|
|
2451
|
+
putWithId(id: string, base64: string, mimeType: string, titel?: string): Promise<void>;
|
|
2452
|
+
/** Löst eine Kennung auf. `mimeType` ist ein Hinweis, kein Zwang. */
|
|
2453
|
+
resolve(id: string, mimeType?: string | null): Promise<AufgeloestesBild>;
|
|
2454
|
+
/** Der aktuelle Bestand — Schnappschuss plus die Ereignisse danach. */
|
|
2455
|
+
bestand(): Promise<HFStateSnapshot>;
|
|
2456
|
+
}
|
|
2457
|
+
/** Der HF-Pfad einer Bildkennung — für die Fehlermeldung, die ihn nennen muss (R7). */
|
|
2458
|
+
declare function bildPfad(id: string, mimeType: string | null | undefined): string;
|
|
2459
|
+
/**
|
|
2460
|
+
* Der MIME-Typ aus den tatsächlichen Bildbytes.
|
|
2461
|
+
*
|
|
2462
|
+
* Review §5 P2: `image/png` einfach anzunehmen genügt nicht — für importierte
|
|
2463
|
+
* oder künftig anders kodierte Bilder wäre der Typ dann falsch deklariert, und
|
|
2464
|
+
* die Datei läge unter einer Endung, unter der sie niemand sucht. Geprüft
|
|
2465
|
+
* werden die Signaturen am Anfang der Daten; nur wenn keine passt, bleibt es
|
|
2466
|
+
* bei der Angabe des Aufrufers.
|
|
2467
|
+
*/
|
|
2468
|
+
declare function typAusBytes(base64: string, vorgabe?: string): string;
|
|
2469
|
+
declare function createHfImageStore(options: HfImageStoreOptions): HfImageStore;
|
|
2470
|
+
|
|
2394
2471
|
interface CreateHfImageLibraryOptions {
|
|
2395
2472
|
namespace: string;
|
|
2396
2473
|
token: string;
|
|
@@ -2398,6 +2475,15 @@ interface CreateHfImageLibraryOptions {
|
|
|
2398
2475
|
newImageId?: () => string;
|
|
2399
2476
|
/** Die Uhr — dieselbe Begründung. */
|
|
2400
2477
|
now?: () => number;
|
|
2478
|
+
/**
|
|
2479
|
+
* Der gemeinsame Bildspeicher (Review §5 P1).
|
|
2480
|
+
*
|
|
2481
|
+
* Wird er übergeben, teilen sich Bildbestand und Batch-Persistenz **eine**
|
|
2482
|
+
* Instanz — nur dann ist ein gerade erzeugtes Bild hier sofort auflösbar.
|
|
2483
|
+
* Fehlt er, baut dieser Adapter sich einen eigenen; das ist für den
|
|
2484
|
+
* Alleinbetrieb richtig und für den Flow-Port ausdrücklich nicht gewollt.
|
|
2485
|
+
*/
|
|
2486
|
+
store?: HfImageStore;
|
|
2401
2487
|
}
|
|
2402
2488
|
declare function createHfImageLibrary(options: CreateHfImageLibraryOptions): SzenenImageLibraryPort;
|
|
2403
2489
|
|
|
@@ -2836,6 +2922,14 @@ interface CreateHfImageBatchPersistenceOptions {
|
|
|
2836
2922
|
/** Kennung je abgelegtem Bild. Ersetzbar, damit ein Test nicht würfelt. */
|
|
2837
2923
|
newImageId?: (generationBatchId: string, position: number) => string;
|
|
2838
2924
|
now?: () => Date;
|
|
2925
|
+
/**
|
|
2926
|
+
* Der gemeinsame Bildspeicher (Review §5 P1).
|
|
2927
|
+
*
|
|
2928
|
+
* Dieselbe Instanz wie im Bildbestand: nur dadurch ist ein hier abgelegtes
|
|
2929
|
+
* Bild dort sofort auflösbar. Fehlt er, entsteht ein eigener — dann gilt die
|
|
2930
|
+
* Sofortauflösung nur innerhalb dieses Adapters.
|
|
2931
|
+
*/
|
|
2932
|
+
store?: HfImageStore;
|
|
2839
2933
|
}
|
|
2840
2934
|
/**
|
|
2841
2935
|
* `ImageGenerationBatchPersistence` für Flow — derselbe kanonische Weg wie
|
|
@@ -2929,4 +3023,4 @@ interface SzenenViewProps {
|
|
|
2929
3023
|
}
|
|
2930
3024
|
declare const SzenenView: React__default.FC<SzenenViewProps>;
|
|
2931
3025
|
|
|
2932
|
-
export { type AttachLibraryItemInput, type AttachLibraryItemResult, AuthoritativeSzenenStore, CATALOGUE_TYPES, type CallableImageModel, CapabilityAnchorError, type CapabilityFlag, type CapabilityReason, type CapabilityReport, type CapabilityReportInput, type CapabilityScope, type CapabilityState, type ChainQueries, type ClientDerivationChannel, type ClientDerivationStore, ContextChainPort, type CreateBrowserTextGenerationPortOptions, type CreateClientDerivationPortOptions, type CreateClientRunPortOptions, type CreateFlowSzenenViewPortOptions, type CreateHfElementStoreOptions, type CreateHfEventChannelOptions, type CreateHfImageBatchHistoryOptions, type CreateHfImageBatchPersistenceOptions, type CreateImageGenerationPortOptions, type CreateMemoryViewPortOptions, DerivableType, DerivationAssessment, DerivationConflict, DerivationDiagnostic, DerivationFailure, DerivationImage, DerivationInputMode, type DeriveItemInput, type DerivedItem, type DerivedLineage, type DerivedRelationship, type DerivedSzenenReference, type DifferentialResult, type DifferentialStep, type Divergence, DraftChainMeta, ELEMENT_VERSION_SCHEMA_FILE, type ElementEvent, type ElementEventChannel, ElementSnapshot, type ElementStoreState, type ExistingSzenenItem, FLOW_MODEL_DISPLAY_NAMES, type FlowGenerateImage, type FlowGenerateImageParams, FlowGenerateText, type FreezeDraftChainInput, type FreezeFailure, type FreezeResult, type FreezeSuccess, type FrozenChainNode, type GeneratedImage, type IdFactory, type ImageBatchPersistedImage, type ImageBatchPersistedPayload, type ImageGenerationBatchPersistence, type ImageGenerationCapability, type ImageGenerationEventChannel, type ImageGenerationFinishedPayload, type ImageGenerationOrder, type ImageGenerationProviderPort, type ImageGenerationResult, type ImageGenerationRunReader, type ImageGenerationStartedPayload, ImageProvenance, type ImageProviderAccessCheck, type ImageProviderInput, type ImportBatchImageInput, type ImportBatchInput, type InMemoryEventChannel, type InputError, type IntegrityVerdict, type ItemDerivationFailure, type ItemDerivationFailureClass, type ItemDerivationResult, type ItemMedium, type LibraryImage, type NodeContribution, NotDerivable, type Notice, type NoticeTone, type PromptBatchImageRef, type PromptImageBatch, type PromptRunOutcome, type PromptRunOutput, type PromptRunPersistencePort, type PromptRunRecord, type PromptRunRecordedPayload, type ProviderCheckRecord, type ProviderCheckRecordedPayload, type ProviderCheckResult, PublishCheckResult, PublishFinding, RULES_WITHOUT_CAPABILITY_EFFECT, RULE_SCOPES, type RawSchema, type RecordedDerivationInput, type RecordedProposal, type RecoveryStatus, type ReducerFinding, ReferenceResolver, type RendererInput, type ResolveFailure, type ResolveResult, type ResolveShotInput, type ResolveShotPayloadInput, ResolveTechnicalError, type ResolvedCamera, type ResolvedNode, type ResolvedPlacement, type RunEventChannel, type RunFailure, type RunFailureClass, type RunItemReference, SZENEN_EVENT_PREFIX, SZENEN_EVENT_TYPES, SZENEN_ITEM_PREFIX, SZENEN_SCHEMAS, type SaveRunAsItemInput, type SceneDerivationPersistencePort, type SceneDerivationRecord, type SceneDerivationRecordedPayload, type SceneDerivationRecoveryRecord, type SceneDerivationRecoveryRecordedPayload, SchemaError, type StartImageGenerationInput, type StartRunInput, type StepState, type SzenenArea, type SzenenAreaId, type SzenenBatchOrigin, type SzenenBatchOriginFailure, type SzenenBatchOriginVerdict, SzenenCommands, SzenenElementStore, SzenenElementType, type SzenenImageBatchHistoryPort, type SzenenImageBatchWritePort, type SzenenImageGenerationPort as SzenenImageGenerationPortContract, type SzenenImageLibraryPort, type SzenenItemPort, type SzenenMediaPort, SzenenQueries, type SzenenRunPort, SzenenView, type SzenenViewCapabilities, type SzenenViewPort, type SzenenViewProps, TargetModelResolution, TextGenerationPort, UNCHECKED_PUBLISH_RULES, UnusableProposal, type VersionMedium, type VisibilityNode, areasFor, batchesForPromptRun, buildSystemInstruction, buildUserPrompt, callOptional, callableImageModelFor, capabilitiesOf, capabilityForTargetModel, capabilityGate, capabilityReport, catalogueFor, checkCreateElementInput, checkElementType, checkOptionalId, checkParents, checkPayloadPresent, checkPromptRunRecord, checkPublishVersionInput, checkRequiredId, checkReviseMetadataInput, checkRevision, checkRunResponse, checkSceneDerivationRecord, checkSceneDerivationRecoveryRecord, checkSetPreferredHeadInput, checkSzenenBatchOrigin, checkTitle, checkWriteDraftInput, collectImageBatches, collectImageGenerationOrders, collectPromptRuns, collectProviderChecks, collectSceneDerivationRecoveries, collectSceneDerivations, createBrowserTextGenerationPort, createClientDerivationPort, createClientRunPort, createEventLogDerivationPersistence, createEventLogRunPersistence, createFlowImageProvider, createFlowSzenenViewPort, createHfElementStore, createHfEventChannel, createHfImageBatchHistory, createHfImageBatchWrite, createHfImageGenerationBatchPersistence, createHfImageLibrary, createImageGenerationPort, createInMemoryEventChannel, createMemoryViewPort, derivationPoliciesOf, deriveItemFromRun, deriveLineage, differentialSteps, draftRevisionOf, findImageBatch, findImageGenerationOrder, findPromptRun, findProviderCheck, findSceneDerivation, findSceneDerivationRecovery, firstError, flowImageProviderHasAccess, freezeDraftChain, hasPlacementCapability, isKnownElementType, isSzenenItemId, itemIdForRun, logRevisionOf, mergeSzenenBatchOrigin, noticeFor, ordersForPromptRun, parseRunResponse, preferredHeadRevisionOf, publishedHeadsOf, recoveriesForRun, recoveryStatusOf, reduceElementEvents, resolveArea, resolveShot, resolveShotPayload, roundOfRun, runPromptDerivation, runStoreDifferential, scopeOfPath, totalModelCalls, unclassifiedPublishRules, unsupportedReason };
|
|
3026
|
+
export { type AttachLibraryItemInput, type AttachLibraryItemResult, AuthoritativeSzenenStore, CATALOGUE_TYPES, type CallableImageModel, CapabilityAnchorError, type CapabilityFlag, type CapabilityReason, type CapabilityReport, type CapabilityReportInput, type CapabilityScope, type CapabilityState, type ChainQueries, type ClientDerivationChannel, type ClientDerivationStore, ContextChainPort, type CreateBrowserTextGenerationPortOptions, type CreateClientDerivationPortOptions, type CreateClientRunPortOptions, type CreateFlowSzenenViewPortOptions, type CreateHfElementStoreOptions, type CreateHfEventChannelOptions, type CreateHfImageBatchHistoryOptions, type CreateHfImageBatchPersistenceOptions, type CreateImageGenerationPortOptions, type CreateMemoryViewPortOptions, DerivableType, DerivationAssessment, DerivationConflict, DerivationDiagnostic, DerivationFailure, DerivationImage, DerivationInputMode, type DeriveItemInput, type DerivedItem, type DerivedLineage, type DerivedRelationship, type DerivedSzenenReference, type DifferentialResult, type DifferentialStep, type Divergence, DraftChainMeta, ELEMENT_VERSION_SCHEMA_FILE, type ElementEvent, type ElementEventChannel, ElementSnapshot, type ElementStoreState, type ExistingSzenenItem, FLOW_MODEL_DISPLAY_NAMES, type FlowGenerateImage, type FlowGenerateImageParams, FlowGenerateText, type FreezeDraftChainInput, type FreezeFailure, type FreezeResult, type FreezeSuccess, type FrozenChainNode, type GeneratedImage, type HfImageStore, type HfImageStoreOptions, type IdFactory, type ImageBatchPersistedImage, type ImageBatchPersistedPayload, type ImageGenerationBatchPersistence, type ImageGenerationCapability, type ImageGenerationEventChannel, type ImageGenerationFinishedPayload, type ImageGenerationOrder, type ImageGenerationProviderPort, type ImageGenerationResult, type ImageGenerationRunReader, type ImageGenerationStartedPayload, ImageProvenance, type ImageProviderAccessCheck, type ImageProviderInput, type ImportBatchImageInput, type ImportBatchInput, type InMemoryEventChannel, type InputError, type IntegrityVerdict, type ItemDerivationFailure, type ItemDerivationFailureClass, type ItemDerivationResult, type ItemMedium, type LibraryImage, type NodeContribution, NotDerivable, type Notice, type NoticeTone, type PromptBatchImageRef, type PromptImageBatch, type PromptRunOutcome, type PromptRunOutput, type PromptRunPersistencePort, type PromptRunRecord, type PromptRunRecordedPayload, type ProviderCheckRecord, type ProviderCheckRecordedPayload, type ProviderCheckResult, PublishCheckResult, PublishFinding, RULES_WITHOUT_CAPABILITY_EFFECT, RULE_SCOPES, type RawSchema, type RecordedDerivationInput, type RecordedProposal, type RecoveryStatus, type ReducerFinding, ReferenceResolver, type RendererInput, type ResolveFailure, type ResolveResult, type ResolveShotInput, type ResolveShotPayloadInput, ResolveTechnicalError, type ResolvedCamera, type ResolvedNode, type ResolvedPlacement, type RunEventChannel, type RunFailure, type RunFailureClass, type RunItemReference, SZENEN_EVENT_PREFIX, SZENEN_EVENT_TYPES, SZENEN_ITEM_PREFIX, SZENEN_SCHEMAS, type SaveRunAsItemInput, type SceneDerivationPersistencePort, type SceneDerivationRecord, type SceneDerivationRecordedPayload, type SceneDerivationRecoveryRecord, type SceneDerivationRecoveryRecordedPayload, SchemaError, type StartImageGenerationInput, type StartRunInput, type StepState, type SzenenArea, type SzenenAreaId, type SzenenBatchOrigin, type SzenenBatchOriginFailure, type SzenenBatchOriginVerdict, SzenenCommands, SzenenElementStore, SzenenElementType, type SzenenImageBatchHistoryPort, type SzenenImageBatchWritePort, type SzenenImageGenerationPort as SzenenImageGenerationPortContract, type SzenenImageLibraryPort, type SzenenItemPort, type SzenenMediaPort, SzenenQueries, type SzenenRunPort, SzenenView, type SzenenViewCapabilities, type SzenenViewPort, type SzenenViewProps, TargetModelResolution, TextGenerationPort, UNCHECKED_PUBLISH_RULES, UnusableProposal, type VersionMedium, type VisibilityNode, areasFor, batchesForPromptRun, bildPfad, buildSystemInstruction, buildUserPrompt, callOptional, callableImageModelFor, capabilitiesOf, capabilityForTargetModel, capabilityGate, capabilityReport, catalogueFor, checkCreateElementInput, checkElementType, checkOptionalId, checkParents, checkPayloadPresent, checkPromptRunRecord, checkPublishVersionInput, checkRequiredId, checkReviseMetadataInput, checkRevision, checkRunResponse, checkSceneDerivationRecord, checkSceneDerivationRecoveryRecord, checkSetPreferredHeadInput, checkSzenenBatchOrigin, checkTitle, checkWriteDraftInput, collectImageBatches, collectImageGenerationOrders, collectPromptRuns, collectProviderChecks, collectSceneDerivationRecoveries, collectSceneDerivations, createBrowserTextGenerationPort, createClientDerivationPort, createClientRunPort, createEventLogDerivationPersistence, createEventLogRunPersistence, createFlowImageProvider, createFlowSzenenViewPort, createHfElementStore, createHfEventChannel, createHfImageBatchHistory, createHfImageBatchWrite, createHfImageGenerationBatchPersistence, createHfImageLibrary, createHfImageStore, createImageGenerationPort, createInMemoryEventChannel, createMemoryViewPort, derivationPoliciesOf, deriveItemFromRun, deriveLineage, differentialSteps, draftRevisionOf, findImageBatch, findImageGenerationOrder, findPromptRun, findProviderCheck, findSceneDerivation, findSceneDerivationRecovery, firstError, flowImageProviderHasAccess, freezeDraftChain, hasPlacementCapability, isKnownElementType, isSzenenItemId, itemIdForRun, logRevisionOf, mergeSzenenBatchOrigin, noticeFor, ordersForPromptRun, parseRunResponse, preferredHeadRevisionOf, publishedHeadsOf, recoveriesForRun, recoveryStatusOf, reduceElementEvents, resolveArea, resolveShot, resolveShotPayload, roundOfRun, runPromptDerivation, runStoreDifferential, scopeOfPath, totalModelCalls, typAusBytes, unclassifiedPublishRules, unsupportedReason };
|
package/dist/szenen.js
CHANGED
|
@@ -59,6 +59,7 @@ __export(szenen_exports, {
|
|
|
59
59
|
areasFor: () => areasFor,
|
|
60
60
|
assessDerivationResponse: () => assessDerivationResponse,
|
|
61
61
|
batchesForPromptRun: () => batchesForPromptRun,
|
|
62
|
+
bildPfad: () => bildPfad,
|
|
62
63
|
buildDerivationSystemInstruction: () => buildSystemInstruction2,
|
|
63
64
|
buildDerivationUserPrompt: () => buildUserPrompt2,
|
|
64
65
|
buildSystemInstruction: () => buildSystemInstruction,
|
|
@@ -114,6 +115,7 @@ __export(szenen_exports, {
|
|
|
114
115
|
createHfImageBatchWrite: () => createHfImageBatchWrite,
|
|
115
116
|
createHfImageGenerationBatchPersistence: () => createHfImageGenerationBatchPersistence,
|
|
116
117
|
createHfImageLibrary: () => createHfImageLibrary,
|
|
118
|
+
createHfImageStore: () => createHfImageStore,
|
|
117
119
|
createImageGenerationPort: () => createImageGenerationPort,
|
|
118
120
|
createInMemoryEventChannel: () => createInMemoryEventChannel,
|
|
119
121
|
createMemoryViewPort: () => createMemoryViewPort,
|
|
@@ -172,6 +174,7 @@ __export(szenen_exports, {
|
|
|
172
174
|
showChain: () => showChain,
|
|
173
175
|
simulatedAnswerFor: () => simulatedAnswerFor,
|
|
174
176
|
totalModelCalls: () => totalModelCalls,
|
|
177
|
+
typAusBytes: () => typAusBytes,
|
|
175
178
|
unclassifiedPublishRules: () => unclassifiedPublishRules,
|
|
176
179
|
unsupportedReason: () => unsupportedReason,
|
|
177
180
|
validateAgainst: () => validateAgainst,
|
|
@@ -7595,8 +7598,8 @@ async function mitGeduld(anfrage) {
|
|
|
7595
7598
|
letzte = res;
|
|
7596
7599
|
if (versuch === DROSSEL_VERSUCHE - 1) break;
|
|
7597
7600
|
const angesagt = Number(res.headers.get("retry-after"));
|
|
7598
|
-
const
|
|
7599
|
-
await schlafen(
|
|
7601
|
+
const warten2 = Number.isFinite(angesagt) && angesagt > 0 ? angesagt * 1e3 : DROSSEL_BASIS_MS * 2 ** versuch;
|
|
7602
|
+
await schlafen(warten2);
|
|
7600
7603
|
}
|
|
7601
7604
|
return letzte;
|
|
7602
7605
|
}
|
|
@@ -9352,6 +9355,179 @@ async function hfLoadImageAsBase64(id, token, namespace, filename, on404, mimeTy
|
|
|
9352
9355
|
return result === "ABORT" ? null : result;
|
|
9353
9356
|
}
|
|
9354
9357
|
|
|
9358
|
+
// src/lib/hfReducer.ts
|
|
9359
|
+
function applyEvent(state, event) {
|
|
9360
|
+
if (event.v.major > 1) return state;
|
|
9361
|
+
switch (event.type) {
|
|
9362
|
+
// SPEZ: image_added (state/spez/hf-state.spez.yaml)
|
|
9363
|
+
case "image_added": {
|
|
9364
|
+
const p = event.payload;
|
|
9365
|
+
if (state.metadata.some((m) => m.id === p.id)) return state;
|
|
9366
|
+
return { ...state, metadata: [...state.metadata, p] };
|
|
9367
|
+
}
|
|
9368
|
+
// SPEZ: task_requested (global/spez/task-queue.spez.yaml)
|
|
9369
|
+
case "task_requested": {
|
|
9370
|
+
const p = event.payload;
|
|
9371
|
+
if (p.expiresAt && p.expiresAt < event.ts) return state;
|
|
9372
|
+
const openTasks = { ...state.openTasks || {} };
|
|
9373
|
+
openTasks[p.taskId] = p;
|
|
9374
|
+
return { ...state, openTasks };
|
|
9375
|
+
}
|
|
9376
|
+
// SPEZ: task_completed (global/spez/task-queue.spez.yaml)
|
|
9377
|
+
case "task_completed": {
|
|
9378
|
+
const p = event.payload;
|
|
9379
|
+
if (!state.openTasks || !state.openTasks[p.taskId]) return state;
|
|
9380
|
+
const openTasks = { ...state.openTasks };
|
|
9381
|
+
delete openTasks[p.taskId];
|
|
9382
|
+
return { ...state, openTasks };
|
|
9383
|
+
}
|
|
9384
|
+
// SPEZ: tag_upserted (state/spez/hf-state.spez.yaml) — Legacy, wird nicht mehr erzeugt
|
|
9385
|
+
case "tag_upserted": {
|
|
9386
|
+
const p = event.payload;
|
|
9387
|
+
const tags = state.tags;
|
|
9388
|
+
const cat = tags.by_category[p.category] || [];
|
|
9389
|
+
const existing = cat.find((t) => t.value === p.value);
|
|
9390
|
+
const updated = { label: p.label, value: p.value, is_user_created: p.is_user_created, is_deleted: p.is_deleted };
|
|
9391
|
+
const newCat = existing ? cat.map((t) => t.value === p.value ? { ...t, ...updated } : t) : [...cat, updated];
|
|
9392
|
+
const newAll = tags.all.some((t) => t.value === p.value && t.category === p.category) ? tags.all.map((t) => t.value === p.value && t.category === p.category ? { ...t, ...updated, category: p.category } : t) : [...tags.all, { ...updated, category: p.category }];
|
|
9393
|
+
return { ...state, tags: { by_category: { ...tags.by_category, [p.category]: newCat }, all: newAll } };
|
|
9394
|
+
}
|
|
9395
|
+
// SPEZ: thumb_added (state/spez/hf-state.spez.yaml)
|
|
9396
|
+
case "thumb_added": {
|
|
9397
|
+
const p = event.payload;
|
|
9398
|
+
return {
|
|
9399
|
+
...state,
|
|
9400
|
+
metadata: state.metadata.map((m) => m.id === p.id ? { ...m, hasThumb: true } : m)
|
|
9401
|
+
};
|
|
9402
|
+
}
|
|
9403
|
+
// SPEZ: metadata_updated (state/spez/hf-state.spez.yaml)
|
|
9404
|
+
case "metadata_updated": {
|
|
9405
|
+
const p = event.payload;
|
|
9406
|
+
return {
|
|
9407
|
+
...state,
|
|
9408
|
+
metadata: state.metadata.map((m) => m.id === p.id ? { ...m, ...p.delta } : m)
|
|
9409
|
+
};
|
|
9410
|
+
}
|
|
9411
|
+
// SPEZ: title_set (state/spez/hf-state.spez.yaml)
|
|
9412
|
+
case "title_set": {
|
|
9413
|
+
const p = event.payload;
|
|
9414
|
+
return {
|
|
9415
|
+
...state,
|
|
9416
|
+
metadata: state.metadata.map((m) => m.id === p.id ? { ...m, titleTs: event.ts } : m)
|
|
9417
|
+
};
|
|
9418
|
+
}
|
|
9419
|
+
default:
|
|
9420
|
+
return state;
|
|
9421
|
+
}
|
|
9422
|
+
}
|
|
9423
|
+
function applyEvents(state, events) {
|
|
9424
|
+
return events.reduce(applyEvent, state);
|
|
9425
|
+
}
|
|
9426
|
+
|
|
9427
|
+
// src/lib/szenen/hfImageStore.ts
|
|
9428
|
+
var LEERER_BESTAND = {
|
|
9429
|
+
metadata: [],
|
|
9430
|
+
tags: { by_category: {}, all: [] },
|
|
9431
|
+
meta: { consolidatedAt: 0, version: 1 }
|
|
9432
|
+
};
|
|
9433
|
+
function endungFuer(mimeType) {
|
|
9434
|
+
return mimeType === "image/png" ? "png" : "jpg";
|
|
9435
|
+
}
|
|
9436
|
+
function bildPfad(id, mimeType) {
|
|
9437
|
+
return `images/${id}.${endungFuer(mimeType)}`;
|
|
9438
|
+
}
|
|
9439
|
+
function typAusBytes(base64, vorgabe = "image/png") {
|
|
9440
|
+
const kopf = base64.slice(0, 16);
|
|
9441
|
+
if (kopf.startsWith("iVBORw0KGgo")) return "image/png";
|
|
9442
|
+
if (kopf.startsWith("/9j/")) return "image/jpeg";
|
|
9443
|
+
if (kopf.startsWith("UklGR")) return "image/webp";
|
|
9444
|
+
if (kopf.startsWith("R0lGOD")) return "image/gif";
|
|
9445
|
+
return vorgabe;
|
|
9446
|
+
}
|
|
9447
|
+
var warten = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
9448
|
+
function createHfImageStore(options) {
|
|
9449
|
+
const { namespace, token } = options;
|
|
9450
|
+
const now = options.now ?? (() => Date.now());
|
|
9451
|
+
const versuche = options.leseVersuche ?? 4;
|
|
9452
|
+
const basisMs = options.leseBasisMs ?? 400;
|
|
9453
|
+
const schlafen2 = options.schlafen ?? warten;
|
|
9454
|
+
const abgelegt = /* @__PURE__ */ new Map();
|
|
9455
|
+
const bekanntePfade = /* @__PURE__ */ new Set();
|
|
9456
|
+
let gefalteterBestand = null;
|
|
9457
|
+
let laufenderAbgleich = null;
|
|
9458
|
+
async function bestandLesen() {
|
|
9459
|
+
const grundlage = gefalteterBestand ?? await loadHFState(namespace, token) ?? LEERER_BESTAND;
|
|
9460
|
+
const neue = await loadPendingEvents(
|
|
9461
|
+
namespace,
|
|
9462
|
+
token,
|
|
9463
|
+
grundlage.meta.consolidatedAt,
|
|
9464
|
+
bekanntePfade
|
|
9465
|
+
);
|
|
9466
|
+
const danach = neue.filter((e) => e.ts > grundlage.meta.consolidatedAt);
|
|
9467
|
+
gefalteterBestand = danach.length ? applyEvents(grundlage, danach) : grundlage;
|
|
9468
|
+
return gefalteterBestand;
|
|
9469
|
+
}
|
|
9470
|
+
function bestandAbgleichen() {
|
|
9471
|
+
if (!laufenderAbgleich) {
|
|
9472
|
+
laufenderAbgleich = bestandLesen().finally(() => {
|
|
9473
|
+
laufenderAbgleich = null;
|
|
9474
|
+
});
|
|
9475
|
+
}
|
|
9476
|
+
return laufenderAbgleich;
|
|
9477
|
+
}
|
|
9478
|
+
return {
|
|
9479
|
+
bestand: bestandAbgleichen,
|
|
9480
|
+
async putWithId(id, base64, mimeType, titel) {
|
|
9481
|
+
const echterTyp = typAusBytes(base64, mimeType);
|
|
9482
|
+
await hfUploadImage(base64, id, token, echterTyp);
|
|
9483
|
+
await writeHFEvent(namespace, token, "image_added", {
|
|
9484
|
+
id,
|
|
9485
|
+
prompt: titel ?? id,
|
|
9486
|
+
tags: [],
|
|
9487
|
+
timestamp: now(),
|
|
9488
|
+
mimeType: echterTyp
|
|
9489
|
+
}, []);
|
|
9490
|
+
abgelegt.set(id, { data: base64, mimeType: echterTyp });
|
|
9491
|
+
},
|
|
9492
|
+
async resolve(id, mimeType) {
|
|
9493
|
+
const eben = abgelegt.get(id);
|
|
9494
|
+
if (eben) return eben;
|
|
9495
|
+
const zustand = await bestandAbgleichen();
|
|
9496
|
+
const eintrag = zustand.metadata.find((e) => e.id === id);
|
|
9497
|
+
const typ = eintrag?.mimeType || mimeType || null;
|
|
9498
|
+
if (eintrag) {
|
|
9499
|
+
const base64 = await hfLoadImageAsBase64(
|
|
9500
|
+
id,
|
|
9501
|
+
token,
|
|
9502
|
+
void 0,
|
|
9503
|
+
eintrag.filename,
|
|
9504
|
+
void 0,
|
|
9505
|
+
eintrag.mimeType,
|
|
9506
|
+
false
|
|
9507
|
+
);
|
|
9508
|
+
if (base64) return { data: base64, mimeType: eintrag.mimeType || "image/jpeg" };
|
|
9509
|
+
}
|
|
9510
|
+
const pfadTyp = typ ?? "image/png";
|
|
9511
|
+
for (let versuch = 0; versuch < versuche; versuch += 1) {
|
|
9512
|
+
if (versuch > 0) await schlafen2(basisMs * 2 ** (versuch - 1));
|
|
9513
|
+
const base64 = await hfLoadImageAsBase64(
|
|
9514
|
+
id,
|
|
9515
|
+
token,
|
|
9516
|
+
void 0,
|
|
9517
|
+
void 0,
|
|
9518
|
+
void 0,
|
|
9519
|
+
pfadTyp,
|
|
9520
|
+
false
|
|
9521
|
+
);
|
|
9522
|
+
if (base64) return { data: base64, mimeType: pfadTyp };
|
|
9523
|
+
}
|
|
9524
|
+
throw new Error(
|
|
9525
|
+
`Das Bild ${id} ist auf HF nicht auffindbar. Geprueft: ${bildPfad(id, pfadTyp)} in ${versuche} Versuchen` + (eintrag ? " (im Bestand verzeichnet, aber nicht ladbar)." : " (nicht im Bestand verzeichnet).")
|
|
9526
|
+
);
|
|
9527
|
+
}
|
|
9528
|
+
};
|
|
9529
|
+
}
|
|
9530
|
+
|
|
9355
9531
|
// src/lib/szenen/hfImageLibrary.ts
|
|
9356
9532
|
function fehler(nachricht, retryable = false) {
|
|
9357
9533
|
return { kind: "error", message: nachricht, retryable };
|
|
@@ -9367,14 +9543,16 @@ function alsBild(eintrag) {
|
|
|
9367
9543
|
};
|
|
9368
9544
|
}
|
|
9369
9545
|
function createHfImageLibrary(options) {
|
|
9370
|
-
const { namespace, token } = options;
|
|
9371
9546
|
const newImageId = options.newImageId ?? (() => crypto.randomUUID());
|
|
9372
|
-
const
|
|
9373
|
-
|
|
9547
|
+
const store = options.store ?? createHfImageStore({
|
|
9548
|
+
namespace: options.namespace,
|
|
9549
|
+
token: options.token,
|
|
9550
|
+
...options.now ? { now: options.now } : {}
|
|
9551
|
+
});
|
|
9374
9552
|
return {
|
|
9375
9553
|
async listImages(query) {
|
|
9376
9554
|
try {
|
|
9377
|
-
const zustand = await
|
|
9555
|
+
const zustand = await store.bestand();
|
|
9378
9556
|
const eintraege = zustand?.metadata ?? [];
|
|
9379
9557
|
const gesucht = query?.search?.trim().toLowerCase();
|
|
9380
9558
|
const gefiltert = gesucht ? eintraege.filter((e) => (e.prompt ?? "").toLowerCase().includes(gesucht) || e.id.toLowerCase().includes(gesucht)) : eintraege;
|
|
@@ -9388,54 +9566,18 @@ function createHfImageLibrary(options) {
|
|
|
9388
9566
|
);
|
|
9389
9567
|
}
|
|
9390
9568
|
},
|
|
9391
|
-
async resolveImage(mediaRef) {
|
|
9392
|
-
const eben = frisch.get(mediaRef);
|
|
9393
|
-
if (eben) return { kind: "ok", value: { data: eben.data, mime_type: eben.mimeType } };
|
|
9569
|
+
async resolveImage(mediaRef, mimeTypeHinweis) {
|
|
9394
9570
|
try {
|
|
9395
|
-
const
|
|
9396
|
-
|
|
9397
|
-
if (eintrag) {
|
|
9398
|
-
const base64 = await hfLoadImageAsBase64(
|
|
9399
|
-
mediaRef,
|
|
9400
|
-
token,
|
|
9401
|
-
void 0,
|
|
9402
|
-
eintrag.filename,
|
|
9403
|
-
void 0,
|
|
9404
|
-
eintrag.mimeType,
|
|
9405
|
-
false
|
|
9406
|
-
);
|
|
9407
|
-
if (!base64) {
|
|
9408
|
-
return fehler(`Das Bild ${mediaRef} ist im Bestand verzeichnet, aber nicht ladbar.`, true);
|
|
9409
|
-
}
|
|
9410
|
-
return { kind: "ok", value: { data: base64, mime_type: eintrag.mimeType || "image/jpeg" } };
|
|
9411
|
-
}
|
|
9412
|
-
for (const mimeType of ["image/png", "image/jpeg"]) {
|
|
9413
|
-
const base64 = await hfLoadImageAsBase64(mediaRef, token, void 0, void 0, void 0, mimeType, false);
|
|
9414
|
-
if (base64) return { kind: "ok", value: { data: base64, mime_type: mimeType } };
|
|
9415
|
-
}
|
|
9416
|
-
return fehler(
|
|
9417
|
-
`Das Bild ${mediaRef} steht nicht im Bestand. Moeglicherweise hat der Abgleich es noch nicht uebertragen.`,
|
|
9418
|
-
true
|
|
9419
|
-
);
|
|
9571
|
+
const bild = await store.resolve(mediaRef, mimeTypeHinweis);
|
|
9572
|
+
return { kind: "ok", value: { data: bild.data, mime_type: bild.mimeType } };
|
|
9420
9573
|
} catch (error) {
|
|
9421
|
-
return fehler(
|
|
9422
|
-
`Das Bild ${mediaRef} konnte nicht geladen werden: ${error instanceof Error ? error.message : String(error)}`,
|
|
9423
|
-
true
|
|
9424
|
-
);
|
|
9574
|
+
return fehler(error instanceof Error ? error.message : String(error), true);
|
|
9425
9575
|
}
|
|
9426
9576
|
},
|
|
9427
9577
|
async putImage(input) {
|
|
9428
9578
|
const id = newImageId();
|
|
9429
9579
|
try {
|
|
9430
|
-
await
|
|
9431
|
-
await writeHFEvent(namespace, token, "image_added", {
|
|
9432
|
-
id,
|
|
9433
|
-
prompt: input.title,
|
|
9434
|
-
tags: [],
|
|
9435
|
-
timestamp: now(),
|
|
9436
|
-
mimeType: input.mime_type
|
|
9437
|
-
}, []);
|
|
9438
|
-
frisch.set(id, { mimeType: input.mime_type, data: input.data });
|
|
9580
|
+
await store.putWithId(id, input.data, input.mime_type, input.title);
|
|
9439
9581
|
return {
|
|
9440
9582
|
kind: "ok",
|
|
9441
9583
|
value: { mediaRef: id, title: input.title, mimeType: input.mime_type, thumbUrl: null }
|
|
@@ -11142,6 +11284,11 @@ function alsBilder(rohe) {
|
|
|
11142
11284
|
media_ref: b.media_ref,
|
|
11143
11285
|
position: b.position,
|
|
11144
11286
|
...istText4(b.asset_id) ? { asset_id: b.asset_id } : {},
|
|
11287
|
+
// Der bestätigte MIME-Typ (Review 2026-08-18 §5 P2) muss durch das
|
|
11288
|
+
// Rücklesen hindurch: Genau hier braucht ihn der Lesepfad, um den
|
|
11289
|
+
// Dateipfad `images/<id>.<ext>` zu bilden, statt ihn zu erraten. Nur
|
|
11290
|
+
// gesetzt, wenn er im Ereignis steht — ältere Batches tragen ihn nicht.
|
|
11291
|
+
...istText4(b.mime_type) ? { mime_type: b.mime_type } : {},
|
|
11145
11292
|
model: b.model ?? null,
|
|
11146
11293
|
seed: b.seed ?? null,
|
|
11147
11294
|
width: b.width ?? null,
|
|
@@ -11230,6 +11377,7 @@ async function legeBatchAb(options, input) {
|
|
|
11230
11377
|
const { namespace, token, channel } = options;
|
|
11231
11378
|
const newImageId = options.newImageId ?? ((batchId, position) => `${batchId}-${position}`);
|
|
11232
11379
|
const now = options.now ?? (() => /* @__PURE__ */ new Date());
|
|
11380
|
+
const store = options.store ?? createHfImageStore({ namespace, token });
|
|
11233
11381
|
const itemId = itemIdForRun(input.runId);
|
|
11234
11382
|
let vorhandeneEvents;
|
|
11235
11383
|
try {
|
|
@@ -11248,15 +11396,14 @@ async function legeBatchAb(options, input) {
|
|
|
11248
11396
|
for (let offset = 0; offset < input.images.length; offset++) {
|
|
11249
11397
|
const bild = input.images[offset];
|
|
11250
11398
|
const id = newImageId(input.generationBatchId, startPosition + offset);
|
|
11399
|
+
const echterTyp = typAusBytes(bild.imageBase64, bild.mimeType);
|
|
11251
11400
|
try {
|
|
11252
|
-
await
|
|
11253
|
-
await writeHFEvent(namespace, token, "image_added", {
|
|
11401
|
+
await store.putWithId(
|
|
11254
11402
|
id,
|
|
11255
|
-
|
|
11256
|
-
|
|
11257
|
-
|
|
11258
|
-
|
|
11259
|
-
}, []);
|
|
11403
|
+
bild.imageBase64,
|
|
11404
|
+
echterTyp,
|
|
11405
|
+
input.title ?? `Batch ${input.generationBatchId}`
|
|
11406
|
+
);
|
|
11260
11407
|
} catch (error) {
|
|
11261
11408
|
return fehler3(
|
|
11262
11409
|
`Bild ${offset + 1}/${input.images.length} des Batches ${input.generationBatchId} konnte nicht im Bildbestand abgelegt werden: ${error instanceof Error ? error.message : String(error)}. Bereits abgelegte Bilder dieses Versuchs (${abgelegt.length}) bleiben im Bestand, geh\xF6ren aber zu keinem Batch, solange das Batch-Ereignis nicht geschrieben ist.`
|
|
@@ -11266,6 +11413,7 @@ async function legeBatchAb(options, input) {
|
|
|
11266
11413
|
position: startPosition + offset,
|
|
11267
11414
|
media_ref: id,
|
|
11268
11415
|
asset_id: id,
|
|
11416
|
+
mime_type: echterTyp,
|
|
11269
11417
|
model: bild.model ?? null,
|
|
11270
11418
|
seed: bild.seed ?? null,
|
|
11271
11419
|
width: bild.width ?? null,
|
|
@@ -11309,8 +11457,11 @@ function createHfImageGenerationBatchPersistence(options) {
|
|
|
11309
11457
|
images: input.images.map((bild) => ({
|
|
11310
11458
|
imageBase64: bild.imageBase64,
|
|
11311
11459
|
// Flow liefert PNG-Base64 (bestehende Konvention, s. AvatarArchitectApp.tsx
|
|
11312
|
-
// `data:image/png;base64,${base64}`)
|
|
11313
|
-
// keinen MIME-Typ je Bild.
|
|
11460
|
+
// `data:image/png;base64,${base64}`), und der gemeinsame Vertrag führt
|
|
11461
|
+
// keinen MIME-Typ je Bild. Das ist deshalb nur die **Vorgabe**:
|
|
11462
|
+
// Entschieden wird nach den echten Bytes (Review §5 P2) — ein künftig
|
|
11463
|
+
// anders kodiertes Bild läge sonst unter einer Endung, unter der es
|
|
11464
|
+
// niemand sucht.
|
|
11314
11465
|
mimeType: "image/png",
|
|
11315
11466
|
model: bild.model ?? null,
|
|
11316
11467
|
seed: bild.seed ?? null,
|
|
@@ -11331,6 +11482,8 @@ function createHfImageBatchWrite(options) {
|
|
|
11331
11482
|
title: input.title,
|
|
11332
11483
|
images: input.images.map((bild) => ({
|
|
11333
11484
|
imageBase64: bild.imageBase64,
|
|
11485
|
+
// Vorgabe, kein Urteil — der Import bringt beliebig kodierte Bilder
|
|
11486
|
+
// mit, und der Typ wird aus den Bytes bestimmt (Review §5 P2).
|
|
11334
11487
|
mimeType: "image/png",
|
|
11335
11488
|
model: bild.model ?? null,
|
|
11336
11489
|
seed: bild.seed ?? null,
|
|
@@ -11404,7 +11557,17 @@ function createFlowSzenenViewPort(options) {
|
|
|
11404
11557
|
...options.newRunId ? { newRunId: options.newRunId } : {},
|
|
11405
11558
|
...options.now ? { now: options.now } : {}
|
|
11406
11559
|
});
|
|
11407
|
-
const
|
|
11560
|
+
const hatHfZugangsdaten = Boolean(options.namespace?.trim() && options.token?.trim());
|
|
11561
|
+
const bildSpeicher = hatHfZugangsdaten ? createHfImageStore({
|
|
11562
|
+
namespace: options.namespace,
|
|
11563
|
+
token: options.token,
|
|
11564
|
+
...options.now ? { now: () => options.now().getTime() } : {}
|
|
11565
|
+
}) : void 0;
|
|
11566
|
+
const imageLibrary = options.imageLibrary ?? (bildSpeicher ? createHfImageLibrary({
|
|
11567
|
+
namespace: options.namespace,
|
|
11568
|
+
token: options.token,
|
|
11569
|
+
store: bildSpeicher
|
|
11570
|
+
}) : void 0);
|
|
11408
11571
|
const derivation = createClientDerivationPort({
|
|
11409
11572
|
store: elements,
|
|
11410
11573
|
derivations: createEventLogDerivationPersistence(channel),
|
|
@@ -11414,11 +11577,11 @@ function createFlowSzenenViewPort(options) {
|
|
|
11414
11577
|
...options.now ? { now: options.now } : {}
|
|
11415
11578
|
});
|
|
11416
11579
|
const imageBatchHistory = createHfImageBatchHistory({ channel });
|
|
11417
|
-
const
|
|
11418
|
-
const imageBatchWrite = hatHfZugangsdaten ? createHfImageBatchWrite({
|
|
11580
|
+
const imageBatchWrite = bildSpeicher ? createHfImageBatchWrite({
|
|
11419
11581
|
namespace: options.namespace,
|
|
11420
11582
|
token: options.token,
|
|
11421
11583
|
channel,
|
|
11584
|
+
store: bildSpeicher,
|
|
11422
11585
|
...options.newBatchImageId ? { newImageId: options.newBatchImageId } : {},
|
|
11423
11586
|
...options.now ? { now: options.now } : {}
|
|
11424
11587
|
}) : void 0;
|
|
@@ -11432,6 +11595,9 @@ function createFlowSzenenViewPort(options) {
|
|
|
11432
11595
|
namespace: options.namespace,
|
|
11433
11596
|
token: options.token,
|
|
11434
11597
|
channel,
|
|
11598
|
+
// Dieselbe Instanz wie der Bildbestand — sonst wäre das gerade
|
|
11599
|
+
// erzeugte Bild in der Laufansicht wieder unauffindbar (R1).
|
|
11600
|
+
store: bildSpeicher,
|
|
11435
11601
|
...options.newBatchImageId ? { newImageId: options.newBatchImageId } : {},
|
|
11436
11602
|
...options.now ? { now: options.now } : {}
|
|
11437
11603
|
}),
|
|
@@ -12915,8 +13081,8 @@ var BestandsBild = ({ port, mediaRef }) => {
|
|
|
12915
13081
|
};
|
|
12916
13082
|
var BatchBild = ({ port, bild }) => {
|
|
12917
13083
|
const [phase] = usePortQuery(
|
|
12918
|
-
() => port.imageLibrary ? port.imageLibrary.resolveImage(bild.media_ref) : Promise.resolve({ kind: "ok", value: null }),
|
|
12919
|
-
[port, bild.media_ref]
|
|
13084
|
+
() => port.imageLibrary ? port.imageLibrary.resolveImage(bild.media_ref, bild.mime_type ?? null) : Promise.resolve({ kind: "ok", value: null }),
|
|
13085
|
+
[port, bild.media_ref, bild.mime_type]
|
|
12920
13086
|
);
|
|
12921
13087
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("li", { "data-testid": `batchbild-${bild.media_ref}`, children: [
|
|
12922
13088
|
phase.status === "ready" && phase.value && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
@@ -14961,6 +15127,7 @@ var SzenenView = ({
|
|
|
14961
15127
|
areasFor,
|
|
14962
15128
|
assessDerivationResponse,
|
|
14963
15129
|
batchesForPromptRun,
|
|
15130
|
+
bildPfad,
|
|
14964
15131
|
buildDerivationSystemInstruction,
|
|
14965
15132
|
buildDerivationUserPrompt,
|
|
14966
15133
|
buildSystemInstruction,
|
|
@@ -15016,6 +15183,7 @@ var SzenenView = ({
|
|
|
15016
15183
|
createHfImageBatchWrite,
|
|
15017
15184
|
createHfImageGenerationBatchPersistence,
|
|
15018
15185
|
createHfImageLibrary,
|
|
15186
|
+
createHfImageStore,
|
|
15019
15187
|
createImageGenerationPort,
|
|
15020
15188
|
createInMemoryEventChannel,
|
|
15021
15189
|
createMemoryViewPort,
|
|
@@ -15074,6 +15242,7 @@ var SzenenView = ({
|
|
|
15074
15242
|
showChain,
|
|
15075
15243
|
simulatedAnswerFor,
|
|
15076
15244
|
totalModelCalls,
|
|
15245
|
+
typAusBytes,
|
|
15077
15246
|
unclassifiedPublishRules,
|
|
15078
15247
|
unsupportedReason,
|
|
15079
15248
|
validateAgainst,
|
package/dist/szenen.mjs
CHANGED
|
@@ -26,6 +26,7 @@ import {
|
|
|
26
26
|
areasFor,
|
|
27
27
|
assessDerivationResponse,
|
|
28
28
|
batchesForPromptRun,
|
|
29
|
+
bildPfad,
|
|
29
30
|
buildSystemInstruction,
|
|
30
31
|
buildSystemInstruction2,
|
|
31
32
|
buildUserPrompt,
|
|
@@ -75,6 +76,7 @@ import {
|
|
|
75
76
|
createHfImageBatchWrite,
|
|
76
77
|
createHfImageGenerationBatchPersistence,
|
|
77
78
|
createHfImageLibrary,
|
|
79
|
+
createHfImageStore,
|
|
78
80
|
createImageGenerationPort,
|
|
79
81
|
createSimulationSceneDerivationPort,
|
|
80
82
|
createSimulationTextGenerationPort,
|
|
@@ -123,6 +125,7 @@ import {
|
|
|
123
125
|
scopeOfPath,
|
|
124
126
|
showChain,
|
|
125
127
|
simulatedAnswerFor,
|
|
128
|
+
typAusBytes,
|
|
126
129
|
unclassifiedPublishRules,
|
|
127
130
|
unsupportedReason,
|
|
128
131
|
validateAgainst,
|
|
@@ -130,7 +133,7 @@ import {
|
|
|
130
133
|
validateElementVersion,
|
|
131
134
|
validatePayload,
|
|
132
135
|
withReference
|
|
133
|
-
} from "./chunk-
|
|
136
|
+
} from "./chunk-DGFMONWO.mjs";
|
|
134
137
|
import {
|
|
135
138
|
ContractViolation,
|
|
136
139
|
STYLE_PAYLOAD,
|
|
@@ -1477,6 +1480,7 @@ export {
|
|
|
1477
1480
|
areasFor,
|
|
1478
1481
|
assessDerivationResponse,
|
|
1479
1482
|
batchesForPromptRun,
|
|
1483
|
+
bildPfad,
|
|
1480
1484
|
buildSystemInstruction as buildDerivationSystemInstruction,
|
|
1481
1485
|
buildUserPrompt as buildDerivationUserPrompt,
|
|
1482
1486
|
buildSystemInstruction2 as buildSystemInstruction,
|
|
@@ -1532,6 +1536,7 @@ export {
|
|
|
1532
1536
|
createHfImageBatchWrite,
|
|
1533
1537
|
createHfImageGenerationBatchPersistence,
|
|
1534
1538
|
createHfImageLibrary,
|
|
1539
|
+
createHfImageStore,
|
|
1535
1540
|
createImageGenerationPort,
|
|
1536
1541
|
createInMemoryEventChannel,
|
|
1537
1542
|
createMemoryViewPort,
|
|
@@ -1590,6 +1595,7 @@ export {
|
|
|
1590
1595
|
showChain,
|
|
1591
1596
|
simulatedAnswerFor,
|
|
1592
1597
|
totalModelCalls,
|
|
1598
|
+
typAusBytes,
|
|
1593
1599
|
unclassifiedPublishRules,
|
|
1594
1600
|
unsupportedReason,
|
|
1595
1601
|
validateAgainst,
|