@rslsp1/fa-app-tools 2.0.82 → 2.0.84
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-GEGJD43Y.mjs → chunk-4FOEFCKM.mjs} +630 -10
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +622 -13
- package/dist/index.mjs +5 -4
- package/dist/szenen.d.mts +193 -8
- package/dist/szenen.d.ts +193 -8
- package/dist/szenen.js +416 -28
- package/dist/szenen.mjs +47 -258
- package/package.json +1 -1
package/dist/szenen.mjs
CHANGED
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
CapabilityAnchorError,
|
|
7
7
|
DERIVABLE_TYPES,
|
|
8
8
|
ELEMENT_VERSION_SCHEMA_FILE,
|
|
9
|
+
FLOW_MODEL_DISPLAY_NAMES,
|
|
9
10
|
MAX_PROPOSAL_TITLE_LENGTH,
|
|
10
11
|
PROBE_VERSION_ID,
|
|
11
12
|
REFERENCE_FIELD,
|
|
@@ -24,12 +25,15 @@ import {
|
|
|
24
25
|
acceptProposalTitle,
|
|
25
26
|
areasFor,
|
|
26
27
|
assessDerivationResponse,
|
|
28
|
+
batchesForPromptRun,
|
|
27
29
|
buildSystemInstruction,
|
|
28
30
|
buildSystemInstruction2,
|
|
29
31
|
buildUserPrompt,
|
|
30
32
|
buildUserPrompt2,
|
|
31
33
|
callOptional,
|
|
34
|
+
callableImageModelFor,
|
|
32
35
|
capabilitiesOf,
|
|
36
|
+
capabilityForTargetModel,
|
|
33
37
|
capabilityGate,
|
|
34
38
|
capabilityReport,
|
|
35
39
|
catalogueFor,
|
|
@@ -50,6 +54,8 @@ import {
|
|
|
50
54
|
checkSzenenBatchOrigin,
|
|
51
55
|
checkTitle,
|
|
52
56
|
checkWriteDraftInput,
|
|
57
|
+
collectImageBatches,
|
|
58
|
+
collectImageGenerationOrders,
|
|
53
59
|
collectPromptRuns,
|
|
54
60
|
collectSceneDerivationRecoveries,
|
|
55
61
|
collectSceneDerivations,
|
|
@@ -60,11 +66,16 @@ import {
|
|
|
60
66
|
createEventLogDerivationPersistence,
|
|
61
67
|
createEventLogRunPersistence,
|
|
62
68
|
createFakeTextGenerationPort,
|
|
69
|
+
createFlowImageProvider,
|
|
63
70
|
createFlowSzenenViewPort,
|
|
64
71
|
createFlowTextGenerationPort,
|
|
65
72
|
createHfElementStore,
|
|
66
73
|
createHfEventChannel,
|
|
74
|
+
createHfImageBatchHistory,
|
|
75
|
+
createHfImageBatchWrite,
|
|
76
|
+
createHfImageGenerationBatchPersistence,
|
|
67
77
|
createHfImageLibrary,
|
|
78
|
+
createImageGenerationPort,
|
|
68
79
|
createSimulationSceneDerivationPort,
|
|
69
80
|
createSimulationTextGenerationPort,
|
|
70
81
|
derivationPoliciesOf,
|
|
@@ -72,10 +83,13 @@ import {
|
|
|
72
83
|
deriveLineage,
|
|
73
84
|
describeTargetModelFailure,
|
|
74
85
|
draftRevisionOf,
|
|
86
|
+
findImageBatch,
|
|
87
|
+
findImageGenerationOrder,
|
|
75
88
|
findPromptRun,
|
|
76
89
|
findSceneDerivation,
|
|
77
90
|
findSceneDerivationRecovery,
|
|
78
91
|
firstError,
|
|
92
|
+
flowImageProviderHasAccess,
|
|
79
93
|
formatSchemaErrors,
|
|
80
94
|
freezeDraftChain,
|
|
81
95
|
getSzenenSchemas,
|
|
@@ -89,6 +103,7 @@ import {
|
|
|
89
103
|
logRevisionOf,
|
|
90
104
|
mergeSzenenBatchOrigin,
|
|
91
105
|
noticeFor,
|
|
106
|
+
ordersForPromptRun,
|
|
92
107
|
parseDerivationResponse,
|
|
93
108
|
parseRunResponse,
|
|
94
109
|
preferredHeadRevisionOf,
|
|
@@ -115,7 +130,7 @@ import {
|
|
|
115
130
|
validateElementVersion,
|
|
116
131
|
validatePayload,
|
|
117
132
|
withReference
|
|
118
|
-
} from "./chunk-
|
|
133
|
+
} from "./chunk-4FOEFCKM.mjs";
|
|
119
134
|
import {
|
|
120
135
|
ContractViolation,
|
|
121
136
|
STYLE_PAYLOAD,
|
|
@@ -149,52 +164,6 @@ function totalModelCalls(checks) {
|
|
|
149
164
|
return checks.reduce((summe, check) => summe + (Number(check.model_calls) || 0), 0);
|
|
150
165
|
}
|
|
151
166
|
|
|
152
|
-
// src/lib/szenen/imageGenerationOrderStore.ts
|
|
153
|
-
function istText(wert) {
|
|
154
|
-
return typeof wert === "string" && wert.trim().length > 0;
|
|
155
|
-
}
|
|
156
|
-
function collectImageGenerationOrders(events) {
|
|
157
|
-
const byBatchId = /* @__PURE__ */ new Map();
|
|
158
|
-
for (const event of events) {
|
|
159
|
-
if (event.type !== SZENEN_EVENT_TYPES.imageGenerationStarted) continue;
|
|
160
|
-
const payload = event.payload;
|
|
161
|
-
if (!payload || !istText(payload.generation_batch_id) || !istText(payload.prompt_run_id)) continue;
|
|
162
|
-
if (byBatchId.has(payload.generation_batch_id)) continue;
|
|
163
|
-
byBatchId.set(payload.generation_batch_id, {
|
|
164
|
-
generation_batch_id: payload.generation_batch_id,
|
|
165
|
-
prompt_run_id: payload.prompt_run_id,
|
|
166
|
-
source_kind: "generated_in_app",
|
|
167
|
-
request: payload.request,
|
|
168
|
-
created_at: payload.created_at ?? "",
|
|
169
|
-
status: "started"
|
|
170
|
-
});
|
|
171
|
-
}
|
|
172
|
-
for (const event of events) {
|
|
173
|
-
if (event.type !== SZENEN_EVENT_TYPES.imageGenerationFinished) continue;
|
|
174
|
-
const payload = event.payload;
|
|
175
|
-
if (!payload || !istText(payload.generation_batch_id)) continue;
|
|
176
|
-
const auftrag = byBatchId.get(payload.generation_batch_id);
|
|
177
|
-
if (!auftrag) continue;
|
|
178
|
-
if (auftrag.status !== "started") continue;
|
|
179
|
-
if (payload.status !== "succeeded" && payload.status !== "partial" && payload.status !== "failed") continue;
|
|
180
|
-
byBatchId.set(payload.generation_batch_id, {
|
|
181
|
-
...auftrag,
|
|
182
|
-
status: payload.status,
|
|
183
|
-
...payload.item_id ? { item_id: payload.item_id } : {},
|
|
184
|
-
produced_count: payload.produced_count ?? 0,
|
|
185
|
-
...payload.diagnostic ? { diagnostic: payload.diagnostic } : {},
|
|
186
|
-
finished_at: payload.finished_at ?? ""
|
|
187
|
-
});
|
|
188
|
-
}
|
|
189
|
-
return [...byBatchId.values()];
|
|
190
|
-
}
|
|
191
|
-
function ordersForPromptRun(events, runId) {
|
|
192
|
-
return collectImageGenerationOrders(events).filter((o) => o.prompt_run_id === runId);
|
|
193
|
-
}
|
|
194
|
-
function findImageGenerationOrder(events, batchId) {
|
|
195
|
-
return collectImageGenerationOrders(events).find((o) => o.generation_batch_id === batchId) ?? null;
|
|
196
|
-
}
|
|
197
|
-
|
|
198
167
|
// src/lib/szenen/inMemoryEventChannel.ts
|
|
199
168
|
function createInMemoryEventChannel(options = {}) {
|
|
200
169
|
const log = options.shared ?? [];
|
|
@@ -415,195 +384,6 @@ async function runStoreDifferential(left, right) {
|
|
|
415
384
|
return { steps: steps.length, divergences, identical: divergences.length === 0 };
|
|
416
385
|
}
|
|
417
386
|
|
|
418
|
-
// src/lib/szenen/imageGenerationCapability.ts
|
|
419
|
-
var isObject = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
420
|
-
var IMAGE_MODEL_CATALOGUE = {
|
|
421
|
-
imagen_4: {
|
|
422
|
-
callable_model_id: "imagen-4.0-generate-001",
|
|
423
|
-
provider: "google",
|
|
424
|
-
max_images: 4,
|
|
425
|
-
aspect_ratios: ["1:1", "3:4", "4:3", "9:16", "16:9"],
|
|
426
|
-
supports_seed: true
|
|
427
|
-
},
|
|
428
|
-
imagen_3: {
|
|
429
|
-
callable_model_id: "imagen-3.0-generate-001",
|
|
430
|
-
provider: "google",
|
|
431
|
-
max_images: 4,
|
|
432
|
-
aspect_ratios: ["1:1", "3:4", "4:3", "9:16", "16:9"],
|
|
433
|
-
supports_seed: true
|
|
434
|
-
}
|
|
435
|
-
};
|
|
436
|
-
function callableImageModelFor(targetModelKey) {
|
|
437
|
-
return IMAGE_MODEL_CATALOGUE[targetModelKey] ?? null;
|
|
438
|
-
}
|
|
439
|
-
function targetModelKeyOf(targetModel) {
|
|
440
|
-
if (!isObject(targetModel)) return null;
|
|
441
|
-
return typeof targetModel.key === "string" && targetModel.key.length > 0 ? targetModel.key : null;
|
|
442
|
-
}
|
|
443
|
-
function capabilityForTargetModel(targetModel, hasAccess) {
|
|
444
|
-
const key = targetModelKeyOf(targetModel);
|
|
445
|
-
if (!key) {
|
|
446
|
-
return {
|
|
447
|
-
kind: "unsupported",
|
|
448
|
-
target_model_key: "(unbekannt)",
|
|
449
|
-
reason: 'Der eingefrorene Lauf tr\xE4gt kein "target_model.key" \u2014 es gibt nichts zuzuordnen.'
|
|
450
|
-
};
|
|
451
|
-
}
|
|
452
|
-
const modell = callableImageModelFor(key);
|
|
453
|
-
if (!modell) {
|
|
454
|
-
return {
|
|
455
|
-
kind: "unsupported",
|
|
456
|
-
target_model_key: key,
|
|
457
|
-
reason: `F\xFCr das Zielmodell "${key}" ist in diesem Host kein Bildpfad katalogisiert.`
|
|
458
|
-
};
|
|
459
|
-
}
|
|
460
|
-
if (!hasAccess(modell)) {
|
|
461
|
-
return {
|
|
462
|
-
kind: "unsupported",
|
|
463
|
-
target_model_key: key,
|
|
464
|
-
reason: `Dieser Host hat keinen Zugang zu ${modell.callable_model_id} (${modell.provider}).`
|
|
465
|
-
};
|
|
466
|
-
}
|
|
467
|
-
return {
|
|
468
|
-
kind: "supported",
|
|
469
|
-
target_model_key: key,
|
|
470
|
-
provider: modell.provider,
|
|
471
|
-
callable_model_id: modell.callable_model_id,
|
|
472
|
-
max_images: modell.max_images,
|
|
473
|
-
aspect_ratios: modell.aspect_ratios,
|
|
474
|
-
supports_seed: modell.supports_seed
|
|
475
|
-
};
|
|
476
|
-
}
|
|
477
|
-
|
|
478
|
-
// src/lib/szenen/imageGenerationPort.ts
|
|
479
|
-
function queryError(error, action) {
|
|
480
|
-
return {
|
|
481
|
-
kind: "error",
|
|
482
|
-
message: `${action}: ${error instanceof Error ? error.message : String(error)}`,
|
|
483
|
-
retryable: true
|
|
484
|
-
};
|
|
485
|
-
}
|
|
486
|
-
function createImageGenerationPort(options) {
|
|
487
|
-
const { runs, provider, batches, events, hasAccess } = options;
|
|
488
|
-
const now = options.now ?? (() => /* @__PURE__ */ new Date());
|
|
489
|
-
async function readRun(runId) {
|
|
490
|
-
try {
|
|
491
|
-
return await runs.getRun(runId);
|
|
492
|
-
} catch (error) {
|
|
493
|
-
return queryError(error, `Lauf ${runId} konnte nicht gelesen werden`);
|
|
494
|
-
}
|
|
495
|
-
}
|
|
496
|
-
return {
|
|
497
|
-
async capabilityForRun(runId) {
|
|
498
|
-
const gelesen = await readRun(runId);
|
|
499
|
-
if (gelesen.kind !== "ok") return gelesen;
|
|
500
|
-
if (!gelesen.value) {
|
|
501
|
-
return { kind: "error", message: `Lauf ${runId} ist unbekannt.`, retryable: false };
|
|
502
|
-
}
|
|
503
|
-
const targetModel = gelesen.value.input_payload?.target_model;
|
|
504
|
-
return { kind: "ok", value: capabilityForTargetModel(targetModel, hasAccess) };
|
|
505
|
-
},
|
|
506
|
-
async startFromPromptRun(input) {
|
|
507
|
-
const gelesen = await readRun(input.runId);
|
|
508
|
-
if (gelesen.kind !== "ok") return { kind: "rejected", message: gelesen.message };
|
|
509
|
-
if (!gelesen.value) {
|
|
510
|
-
return { kind: "rejected", message: `Lauf ${input.runId} ist unbekannt.` };
|
|
511
|
-
}
|
|
512
|
-
const run = gelesen.value;
|
|
513
|
-
if (run.status !== "succeeded" || !run.output) {
|
|
514
|
-
return {
|
|
515
|
-
kind: "rejected",
|
|
516
|
-
message: `Lauf ${input.runId} ist nicht erfolgreich \u2014 ein Bildauftrag braucht einen eingefrorenen Prompt (D-103).`
|
|
517
|
-
};
|
|
518
|
-
}
|
|
519
|
-
const targetModel = run.input_payload?.target_model;
|
|
520
|
-
const capability = capabilityForTargetModel(targetModel, hasAccess);
|
|
521
|
-
if (capability.kind !== "supported") {
|
|
522
|
-
return { kind: "unsupported", targetModelKey: capability.target_model_key, reason: capability.reason };
|
|
523
|
-
}
|
|
524
|
-
const startedPayload = {
|
|
525
|
-
generation_batch_id: input.generationBatchId,
|
|
526
|
-
prompt_run_id: input.runId,
|
|
527
|
-
source_kind: "generated_in_app",
|
|
528
|
-
request: {
|
|
529
|
-
image_count: input.imageCount,
|
|
530
|
-
...input.aspectRatio ? { aspect_ratio: input.aspectRatio } : {},
|
|
531
|
-
...input.seeds ? { seeds: input.seeds } : {},
|
|
532
|
-
callable_model_id: capability.callable_model_id
|
|
533
|
-
},
|
|
534
|
-
created_at: now().toISOString()
|
|
535
|
-
};
|
|
536
|
-
try {
|
|
537
|
-
await events.appendEvent(SZENEN_EVENT_TYPES.imageGenerationStarted, startedPayload);
|
|
538
|
-
} catch (error) {
|
|
539
|
-
return {
|
|
540
|
-
kind: "failed",
|
|
541
|
-
message: `Der Auftrag ${input.generationBatchId} konnte nicht protokolliert werden: ${error instanceof Error ? error.message : String(error)}`
|
|
542
|
-
};
|
|
543
|
-
}
|
|
544
|
-
let produced = [];
|
|
545
|
-
let providerFehler = null;
|
|
546
|
-
try {
|
|
547
|
-
const antwort = await provider.generate({
|
|
548
|
-
callableModelId: capability.callable_model_id,
|
|
549
|
-
provider: capability.provider,
|
|
550
|
-
positivePrompt: run.output.positive,
|
|
551
|
-
negativePrompt: run.output.negative,
|
|
552
|
-
imageCount: input.imageCount,
|
|
553
|
-
...input.aspectRatio ? { aspectRatio: input.aspectRatio } : {},
|
|
554
|
-
...input.seeds ? { seeds: input.seeds } : {}
|
|
555
|
-
});
|
|
556
|
-
produced = antwort.images;
|
|
557
|
-
} catch (error) {
|
|
558
|
-
providerFehler = error instanceof Error ? error.message : String(error);
|
|
559
|
-
}
|
|
560
|
-
if (providerFehler || produced.length === 0) {
|
|
561
|
-
const finishedPayload2 = {
|
|
562
|
-
generation_batch_id: input.generationBatchId,
|
|
563
|
-
status: "failed",
|
|
564
|
-
produced_count: 0,
|
|
565
|
-
diagnostic: providerFehler ?? "Der Provider hat kein verwertbares Bild geliefert.",
|
|
566
|
-
finished_at: now().toISOString()
|
|
567
|
-
};
|
|
568
|
-
await events.appendEvent(SZENEN_EVENT_TYPES.imageGenerationFinished, finishedPayload2).catch(() => {
|
|
569
|
-
});
|
|
570
|
-
return {
|
|
571
|
-
kind: "failed",
|
|
572
|
-
message: finishedPayload2.diagnostic
|
|
573
|
-
};
|
|
574
|
-
}
|
|
575
|
-
const persistiert = await batches.persist({
|
|
576
|
-
runId: input.runId,
|
|
577
|
-
generationBatchId: input.generationBatchId,
|
|
578
|
-
images: produced
|
|
579
|
-
});
|
|
580
|
-
if (persistiert.kind !== "ok") {
|
|
581
|
-
const finishedPayload2 = {
|
|
582
|
-
generation_batch_id: input.generationBatchId,
|
|
583
|
-
status: "failed",
|
|
584
|
-
produced_count: 0,
|
|
585
|
-
diagnostic: persistiert.kind === "error" ? persistiert.message : `Batch ${input.generationBatchId} konnte nicht gespeichert werden (${persistiert.kind}).`,
|
|
586
|
-
finished_at: now().toISOString()
|
|
587
|
-
};
|
|
588
|
-
await events.appendEvent(SZENEN_EVENT_TYPES.imageGenerationFinished, finishedPayload2).catch(() => {
|
|
589
|
-
});
|
|
590
|
-
return { kind: "failed", message: finishedPayload2.diagnostic };
|
|
591
|
-
}
|
|
592
|
-
const istPartial = produced.length < input.imageCount;
|
|
593
|
-
const finishedPayload = {
|
|
594
|
-
generation_batch_id: input.generationBatchId,
|
|
595
|
-
status: istPartial ? "partial" : "succeeded",
|
|
596
|
-
item_id: persistiert.value.item_id,
|
|
597
|
-
produced_count: produced.length,
|
|
598
|
-
finished_at: now().toISOString()
|
|
599
|
-
};
|
|
600
|
-
await events.appendEvent(SZENEN_EVENT_TYPES.imageGenerationFinished, finishedPayload).catch(() => {
|
|
601
|
-
});
|
|
602
|
-
return istPartial ? { kind: "partial", batch: persistiert.value, requested: input.imageCount, produced: produced.length } : { kind: "succeeded", batch: persistiert.value };
|
|
603
|
-
}
|
|
604
|
-
};
|
|
605
|
-
}
|
|
606
|
-
|
|
607
387
|
// src/lib/szenen/memoryViewPort.ts
|
|
608
388
|
function ok(value) {
|
|
609
389
|
return { kind: "ok", value };
|
|
@@ -1209,21 +989,21 @@ var PFLICHTFELDER = [
|
|
|
1209
989
|
"system_prompt",
|
|
1210
990
|
"created_at"
|
|
1211
991
|
];
|
|
1212
|
-
function
|
|
992
|
+
function istText(wert) {
|
|
1213
993
|
return typeof wert === "string" && wert.trim().length > 0;
|
|
1214
994
|
}
|
|
1215
|
-
function
|
|
995
|
+
function isObject(wert) {
|
|
1216
996
|
return typeof wert === "object" && wert !== null && !Array.isArray(wert);
|
|
1217
997
|
}
|
|
1218
998
|
var VERSIONSFELDER = ["shot_version_id", "scene_setup_version_id"];
|
|
1219
999
|
var KETTEN_TYPEN = ["scene", "scene_setup", "shot"];
|
|
1220
1000
|
function pruefeLaufherkunft(quelle) {
|
|
1221
|
-
if (!
|
|
1001
|
+
if (!isObject(quelle)) {
|
|
1222
1002
|
return { ok: false, message: '"source" muss ein Objekt sein.' };
|
|
1223
1003
|
}
|
|
1224
1004
|
if (quelle.kind === "published") {
|
|
1225
1005
|
for (const feld of VERSIONSFELDER) {
|
|
1226
|
-
if (!
|
|
1006
|
+
if (!istText(quelle[feld])) {
|
|
1227
1007
|
return { ok: false, message: `"source.${feld}" fehlt oder ist leer.` };
|
|
1228
1008
|
}
|
|
1229
1009
|
}
|
|
@@ -1235,7 +1015,7 @@ function pruefeLaufherkunft(quelle) {
|
|
|
1235
1015
|
message: `"source.kind" ist unbekannt: ${JSON.stringify(quelle.kind)}. Erlaubt: published, draft_chain.`
|
|
1236
1016
|
};
|
|
1237
1017
|
}
|
|
1238
|
-
if (!
|
|
1018
|
+
if (!istText(quelle.chain_id)) {
|
|
1239
1019
|
return { ok: false, message: '"source.chain_id" fehlt oder ist leer.' };
|
|
1240
1020
|
}
|
|
1241
1021
|
if (!Array.isArray(quelle.nodes) || quelle.nodes.length === 0) {
|
|
@@ -1245,7 +1025,7 @@ function pruefeLaufherkunft(quelle) {
|
|
|
1245
1025
|
};
|
|
1246
1026
|
}
|
|
1247
1027
|
for (const [index, knoten] of quelle.nodes.entries()) {
|
|
1248
|
-
if (!
|
|
1028
|
+
if (!isObject(knoten)) {
|
|
1249
1029
|
return { ok: false, message: `"source.nodes[${index}]" ist kein Objekt.` };
|
|
1250
1030
|
}
|
|
1251
1031
|
if (!KETTEN_TYPEN.includes(knoten.type)) {
|
|
@@ -1254,7 +1034,7 @@ function pruefeLaufherkunft(quelle) {
|
|
|
1254
1034
|
message: `"source.nodes[${index}].type" ist unbekannt: ${JSON.stringify(knoten.type)}.`
|
|
1255
1035
|
};
|
|
1256
1036
|
}
|
|
1257
|
-
if (!
|
|
1037
|
+
if (!istText(knoten.element_id) || !istText(knoten.draft_id)) {
|
|
1258
1038
|
return {
|
|
1259
1039
|
ok: false,
|
|
1260
1040
|
message: `"source.nodes[${index}]" braucht element_id und draft_id.`
|
|
@@ -1267,10 +1047,10 @@ function pruefeLaufherkunft(quelle) {
|
|
|
1267
1047
|
};
|
|
1268
1048
|
}
|
|
1269
1049
|
}
|
|
1270
|
-
if (quelle.derivation_run_id !== void 0 && !
|
|
1050
|
+
if (quelle.derivation_run_id !== void 0 && !istText(quelle.derivation_run_id)) {
|
|
1271
1051
|
return { ok: false, message: '"source.derivation_run_id" ist gesetzt, aber leer.' };
|
|
1272
1052
|
}
|
|
1273
|
-
if (quelle.derivation_recovery_id !== void 0 && !
|
|
1053
|
+
if (quelle.derivation_recovery_id !== void 0 && !istText(quelle.derivation_recovery_id)) {
|
|
1274
1054
|
return { ok: false, message: '"source.derivation_recovery_id" ist gesetzt, aber leer.' };
|
|
1275
1055
|
}
|
|
1276
1056
|
return { ok: true };
|
|
@@ -1284,20 +1064,20 @@ function checkPromptRunRecord(candidate) {
|
|
|
1284
1064
|
}
|
|
1285
1065
|
const record = candidate;
|
|
1286
1066
|
const quelle = record.source;
|
|
1287
|
-
const ausKette =
|
|
1067
|
+
const ausKette = isObject(quelle) && quelle.kind === "draft_chain";
|
|
1288
1068
|
if (quelle !== void 0) {
|
|
1289
1069
|
const urteil2 = pruefeLaufherkunft(quelle);
|
|
1290
1070
|
if (!urteil2.ok) return urteil2;
|
|
1291
1071
|
}
|
|
1292
1072
|
const pflicht = ausKette ? PFLICHTFELDER.filter((f) => !VERSIONSFELDER.includes(f)) : PFLICHTFELDER;
|
|
1293
1073
|
for (const feld of pflicht) {
|
|
1294
|
-
if (!
|
|
1074
|
+
if (!istText(record[feld])) {
|
|
1295
1075
|
return { ok: false, message: `"${feld}" fehlt oder ist leer.` };
|
|
1296
1076
|
}
|
|
1297
1077
|
}
|
|
1298
1078
|
if (ausKette) {
|
|
1299
1079
|
for (const feld of VERSIONSFELDER) {
|
|
1300
|
-
if (
|
|
1080
|
+
if (istText(record[feld])) {
|
|
1301
1081
|
return {
|
|
1302
1082
|
ok: false,
|
|
1303
1083
|
message: `"${feld}" ist bei einem Lauf aus einer Draft-Kette gesetzt. Dort gibt es keine Versionen, und erfundene sind unzulaessig (D-98).`
|
|
@@ -1335,7 +1115,7 @@ function checkPromptRunRecord(candidate) {
|
|
|
1335
1115
|
message: `"failure.class" ist unbekannt: ${JSON.stringify(failure.class)}. Erlaubt sind ${FAILURE_CLASSES.join(", ")}.`
|
|
1336
1116
|
};
|
|
1337
1117
|
}
|
|
1338
|
-
if (!
|
|
1118
|
+
if (!istText(failure.message)) {
|
|
1339
1119
|
return { ok: false, message: '"failure.message" fehlt oder ist leer.' };
|
|
1340
1120
|
}
|
|
1341
1121
|
return { ok: true };
|
|
@@ -1377,7 +1157,7 @@ function checkSceneDerivationRecord(candidate) {
|
|
|
1377
1157
|
}
|
|
1378
1158
|
const record = candidate;
|
|
1379
1159
|
for (const feld of DERIVATION_PFLICHTFELDER) {
|
|
1380
|
-
if (!
|
|
1160
|
+
if (!istText(record[feld])) {
|
|
1381
1161
|
return { ok: false, message: `"${feld}" fehlt oder ist leer.` };
|
|
1382
1162
|
}
|
|
1383
1163
|
}
|
|
@@ -1432,13 +1212,13 @@ function checkSceneDerivationRecord(candidate) {
|
|
|
1432
1212
|
return { ok: false, message: '"follows" muss ein Objekt sein.' };
|
|
1433
1213
|
}
|
|
1434
1214
|
const f = folgt;
|
|
1435
|
-
if (!
|
|
1215
|
+
if (!istText(f.run_id)) {
|
|
1436
1216
|
return { ok: false, message: '"follows.run_id" fehlt oder ist leer.' };
|
|
1437
1217
|
}
|
|
1438
1218
|
if (f.run_id === record.run_id) {
|
|
1439
1219
|
return { ok: false, message: '"follows.run_id" zeigt auf den Lauf selbst.' };
|
|
1440
1220
|
}
|
|
1441
|
-
if (!
|
|
1221
|
+
if (!istText(f.note)) {
|
|
1442
1222
|
return {
|
|
1443
1223
|
ok: false,
|
|
1444
1224
|
message: '"follows.note" fehlt oder ist leer \u2014 ohne Beanstandung ist ein Folgelauf nicht nachvollziehbar (D-89).'
|
|
@@ -1452,7 +1232,7 @@ function checkSceneDerivationRecord(candidate) {
|
|
|
1452
1232
|
}
|
|
1453
1233
|
}
|
|
1454
1234
|
const reply = record.reply;
|
|
1455
|
-
if (reply !== void 0 && !
|
|
1235
|
+
if (reply !== void 0 && !istText(reply)) {
|
|
1456
1236
|
return {
|
|
1457
1237
|
ok: false,
|
|
1458
1238
|
message: `"reply" ist unbrauchbar: erwartet wird eine nicht leere Zeichenkette, angekommen ist ${JSON.stringify(reply)}. Ohne "reply" einreichen ist zulaessig.`
|
|
@@ -1472,7 +1252,7 @@ function checkSceneDerivationRecord(candidate) {
|
|
|
1472
1252
|
message: `"failure.class" ist unbekannt: ${JSON.stringify(failure.class)}. Erlaubt sind ${FAILURE_CLASSES.join(", ")}.`
|
|
1473
1253
|
};
|
|
1474
1254
|
}
|
|
1475
|
-
if (!
|
|
1255
|
+
if (!istText(failure.message)) {
|
|
1476
1256
|
return { ok: false, message: '"failure.message" fehlt oder ist leer.' };
|
|
1477
1257
|
}
|
|
1478
1258
|
if (Array.isArray(record.proposals) && record.proposals.length > 0) {
|
|
@@ -1527,7 +1307,7 @@ function checkSceneDerivationRecord(candidate) {
|
|
|
1527
1307
|
};
|
|
1528
1308
|
}
|
|
1529
1309
|
for (const [gapIndex, luecke] of gaps.entries()) {
|
|
1530
|
-
if (!luecke || typeof luecke !== "object" || !
|
|
1310
|
+
if (!luecke || typeof luecke !== "object" || !istText(luecke.pointer) || !istText(luecke.reason)) {
|
|
1531
1311
|
return {
|
|
1532
1312
|
ok: false,
|
|
1533
1313
|
message: `"proposals[${index}].gaps[${gapIndex}]" braucht pointer und reason.`
|
|
@@ -1553,7 +1333,7 @@ function checkSceneDerivationRecoveryRecord(candidate) {
|
|
|
1553
1333
|
}
|
|
1554
1334
|
const record = candidate;
|
|
1555
1335
|
for (const feld of ["recovery_id", "run_id", "created_at"]) {
|
|
1556
|
-
if (!
|
|
1336
|
+
if (!istText(record[feld])) {
|
|
1557
1337
|
return { ok: false, message: `"${feld}" fehlt oder ist leer.` };
|
|
1558
1338
|
}
|
|
1559
1339
|
}
|
|
@@ -1580,7 +1360,7 @@ function checkSceneDerivationRecoveryRecord(candidate) {
|
|
|
1580
1360
|
return { ok: false, message: '"diagnostics" muss ein Array sein (auch ein leeres).' };
|
|
1581
1361
|
}
|
|
1582
1362
|
for (const [index, befund] of record.diagnostics.entries()) {
|
|
1583
|
-
if (!befund || typeof befund !== "object" || !
|
|
1363
|
+
if (!befund || typeof befund !== "object" || !istText(befund.code) || !istText(befund.message)) {
|
|
1584
1364
|
return {
|
|
1585
1365
|
ok: false,
|
|
1586
1366
|
message: `"diagnostics[${index}]" braucht code und message.`
|
|
@@ -1632,7 +1412,7 @@ function checkSceneDerivationRecoveryRecord(candidate) {
|
|
|
1632
1412
|
}
|
|
1633
1413
|
if (Array.isArray(gaps)) {
|
|
1634
1414
|
for (const [gapIndex, luecke] of gaps.entries()) {
|
|
1635
|
-
if (!luecke || typeof luecke !== "object" || !
|
|
1415
|
+
if (!luecke || typeof luecke !== "object" || !istText(luecke.pointer) || !istText(luecke.reason)) {
|
|
1636
1416
|
return {
|
|
1637
1417
|
ok: false,
|
|
1638
1418
|
message: `"proposals[${index}].gaps[${gapIndex}]" braucht pointer und reason.`
|
|
@@ -1676,6 +1456,7 @@ export {
|
|
|
1676
1456
|
ContractViolation,
|
|
1677
1457
|
DERIVABLE_TYPES,
|
|
1678
1458
|
ELEMENT_VERSION_SCHEMA_FILE,
|
|
1459
|
+
FLOW_MODEL_DISPLAY_NAMES,
|
|
1679
1460
|
PROBE_VERSION_ID,
|
|
1680
1461
|
REFERENCE_FIELD,
|
|
1681
1462
|
RULES_WITHOUT_CAPABILITY_EFFECT,
|
|
@@ -1695,6 +1476,7 @@ export {
|
|
|
1695
1476
|
VersionDagError,
|
|
1696
1477
|
areasFor,
|
|
1697
1478
|
assessDerivationResponse,
|
|
1479
|
+
batchesForPromptRun,
|
|
1698
1480
|
buildSystemInstruction as buildDerivationSystemInstruction,
|
|
1699
1481
|
buildUserPrompt as buildDerivationUserPrompt,
|
|
1700
1482
|
buildSystemInstruction2 as buildSystemInstruction,
|
|
@@ -1727,6 +1509,7 @@ export {
|
|
|
1727
1509
|
checkSzenenBatchOrigin,
|
|
1728
1510
|
checkTitle,
|
|
1729
1511
|
checkWriteDraftInput,
|
|
1512
|
+
collectImageBatches,
|
|
1730
1513
|
collectImageGenerationOrders,
|
|
1731
1514
|
collectPromptRuns,
|
|
1732
1515
|
collectProviderChecks,
|
|
@@ -1740,10 +1523,14 @@ export {
|
|
|
1740
1523
|
createEventLogDerivationPersistence,
|
|
1741
1524
|
createEventLogRunPersistence,
|
|
1742
1525
|
createFakeTextGenerationPort,
|
|
1526
|
+
createFlowImageProvider,
|
|
1743
1527
|
createFlowSzenenViewPort,
|
|
1744
1528
|
createFlowTextGenerationPort,
|
|
1745
1529
|
createHfElementStore,
|
|
1746
1530
|
createHfEventChannel,
|
|
1531
|
+
createHfImageBatchHistory,
|
|
1532
|
+
createHfImageBatchWrite,
|
|
1533
|
+
createHfImageGenerationBatchPersistence,
|
|
1747
1534
|
createHfImageLibrary,
|
|
1748
1535
|
createImageGenerationPort,
|
|
1749
1536
|
createInMemoryEventChannel,
|
|
@@ -1757,12 +1544,14 @@ export {
|
|
|
1757
1544
|
differentialSteps,
|
|
1758
1545
|
draftRevisionOf,
|
|
1759
1546
|
elementStoreContractChecks,
|
|
1547
|
+
findImageBatch,
|
|
1760
1548
|
findImageGenerationOrder,
|
|
1761
1549
|
findPromptRun,
|
|
1762
1550
|
findProviderCheck,
|
|
1763
1551
|
findSceneDerivation,
|
|
1764
1552
|
findSceneDerivationRecovery,
|
|
1765
1553
|
firstError,
|
|
1554
|
+
flowImageProviderHasAccess,
|
|
1766
1555
|
formatSchemaErrors,
|
|
1767
1556
|
freezeDraftChain,
|
|
1768
1557
|
getSzenenSchemas,
|