@rslsp1/fa-app-tools 3.0.0 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-TCJ3CMCK.mjs → chunk-TW4IDHAN.mjs} +1660 -604
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1699 -693
- package/dist/index.mjs +9 -8
- package/dist/szenen.d.mts +501 -23
- package/dist/szenen.d.ts +501 -23
- package/dist/szenen.js +1905 -734
- package/dist/szenen.mjs +169 -29
- package/package.json +1 -1
package/dist/szenen.mjs
CHANGED
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
FLOW_EXECUTION_PATH,
|
|
10
10
|
MAX_PROPOSAL_TITLE_LENGTH,
|
|
11
11
|
PROBE_VERSION_ID,
|
|
12
|
+
PROMPT_RULE_EFFECT,
|
|
12
13
|
REFERENCE_FIELD,
|
|
13
14
|
RULES_WITHOUT_CAPABILITY_EFFECT,
|
|
14
15
|
RULE_SCOPES,
|
|
@@ -42,6 +43,7 @@ import {
|
|
|
42
43
|
checkDraftChainMeta,
|
|
43
44
|
checkElementType,
|
|
44
45
|
checkImageExecutionProfile,
|
|
46
|
+
checkImageExecutionProfiles,
|
|
45
47
|
checkImageModelParameters,
|
|
46
48
|
checkOptionalId,
|
|
47
49
|
checkParents,
|
|
@@ -83,7 +85,10 @@ import {
|
|
|
83
85
|
derivationPoliciesOf,
|
|
84
86
|
deriveItemFromRun,
|
|
85
87
|
deriveLineage,
|
|
88
|
+
describableContent,
|
|
86
89
|
describeTargetModelFailure,
|
|
90
|
+
diagnosticOfFinding,
|
|
91
|
+
diagnosticOfSchemaError,
|
|
87
92
|
draftRevisionOf,
|
|
88
93
|
executableImageModels,
|
|
89
94
|
findExecutableImageModel,
|
|
@@ -95,14 +100,18 @@ import {
|
|
|
95
100
|
firstError,
|
|
96
101
|
formatSchemaErrors,
|
|
97
102
|
freezeDraftChain,
|
|
103
|
+
freezeSceneWorkingState,
|
|
98
104
|
getSzenenSchemas,
|
|
105
|
+
gruppiereZuItems,
|
|
99
106
|
hasPlacementCapability,
|
|
100
107
|
isKnownElementType,
|
|
101
108
|
isOk,
|
|
102
109
|
isProjectionCurrent,
|
|
103
110
|
isSzenenItemId,
|
|
104
111
|
itemIdForRun,
|
|
112
|
+
ladeVorschauen,
|
|
105
113
|
linkFor,
|
|
114
|
+
locatorTeile,
|
|
106
115
|
logRevisionOf,
|
|
107
116
|
mergeSzenenBatchOrigin,
|
|
108
117
|
noticeFor,
|
|
@@ -110,19 +119,23 @@ import {
|
|
|
110
119
|
parseDerivationResponse,
|
|
111
120
|
parseRunResponse,
|
|
112
121
|
preferredHeadRevisionOf,
|
|
122
|
+
promptDiagnosticsOf,
|
|
113
123
|
publishedHeadsOf,
|
|
114
124
|
recoveriesForRun,
|
|
115
125
|
recoveryStatusOf,
|
|
116
126
|
reduceElementEvents,
|
|
117
127
|
resolveArea,
|
|
128
|
+
resolveScenePayload,
|
|
118
129
|
resolveShot,
|
|
119
130
|
resolveShotPayload,
|
|
120
131
|
resolveTargetModelOver,
|
|
121
132
|
resolverFromQueries,
|
|
122
133
|
roundOfRun,
|
|
134
|
+
rulesWithoutPromptEffect,
|
|
123
135
|
runPromptDerivation,
|
|
124
136
|
runPublishChecks,
|
|
125
137
|
runSceneDerivation,
|
|
138
|
+
sceneOnlyCapabilities,
|
|
126
139
|
scopeOfPath,
|
|
127
140
|
selectableTargetModels,
|
|
128
141
|
showChain,
|
|
@@ -135,7 +148,7 @@ import {
|
|
|
135
148
|
validateElementVersion,
|
|
136
149
|
validatePayload,
|
|
137
150
|
withReference
|
|
138
|
-
} from "./chunk-
|
|
151
|
+
} from "./chunk-TW4IDHAN.mjs";
|
|
139
152
|
import {
|
|
140
153
|
ContractViolation,
|
|
141
154
|
STYLE_PAYLOAD,
|
|
@@ -392,7 +405,7 @@ async function runStoreDifferential(left, right) {
|
|
|
392
405
|
// src/lib/szenen/memoryViewPort.ts
|
|
393
406
|
var MEMORY_IMAGE_CAPABILITY = {
|
|
394
407
|
environment_id: "memory",
|
|
395
|
-
execution_paths: ["memory"]
|
|
408
|
+
execution_paths: [{ execution_path: "memory", provider: "google" }]
|
|
396
409
|
};
|
|
397
410
|
function ok(value) {
|
|
398
411
|
return { kind: "ok", value };
|
|
@@ -519,6 +532,44 @@ function createMemoryViewPort(options = {}) {
|
|
|
519
532
|
return ok(laeufe.filter(
|
|
520
533
|
(r) => r.source?.kind === "draft_chain" && r.source.chain_id === chainId
|
|
521
534
|
));
|
|
535
|
+
},
|
|
536
|
+
// ── Der Lauf direkt aus einer Szene (D-135) ───────────────────────────
|
|
537
|
+
//
|
|
538
|
+
// Wie beim Kettenlauf bildet der Speicherport nur die **Form** ab: ein
|
|
539
|
+
// Lauf mit `source.kind === 'scene_direct'`, ohne Shot und ohne
|
|
540
|
+
// Versionskennungen. Ob ein Arbeitsstand einfrierbar ist, entscheidet
|
|
541
|
+
// `clientRunPort` gegen einen echten Speicher — hier waere es eine zweite
|
|
542
|
+
// Wahrheit.
|
|
543
|
+
async startRunFromScene(input) {
|
|
544
|
+
const runId = ids();
|
|
545
|
+
const basis = (options.deriveRun ?? simulierterLauf)(
|
|
546
|
+
{ shotVersionId: "", ...input.userInstruction ? { userInstruction: input.userInstruction } : {} },
|
|
547
|
+
runId
|
|
548
|
+
);
|
|
549
|
+
const lauf = {
|
|
550
|
+
...basis,
|
|
551
|
+
shot_version_id: "",
|
|
552
|
+
shot_element_id: "",
|
|
553
|
+
scene_setup_version_id: "",
|
|
554
|
+
camera_id: "",
|
|
555
|
+
target_model_version_id: "",
|
|
556
|
+
source: {
|
|
557
|
+
kind: "scene_direct",
|
|
558
|
+
scene: {
|
|
559
|
+
element_id: input.sceneElementId,
|
|
560
|
+
draft_id: `draft-${input.sceneElementId}`,
|
|
561
|
+
revision: 1,
|
|
562
|
+
version_id: null
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
};
|
|
566
|
+
laeufe.push(lauf);
|
|
567
|
+
return done(lauf);
|
|
568
|
+
},
|
|
569
|
+
async listRunsForScene(sceneElementId) {
|
|
570
|
+
return ok(laeufe.filter(
|
|
571
|
+
(r) => r.source?.kind === "scene_direct" && r.source.scene.element_id === sceneElementId
|
|
572
|
+
));
|
|
522
573
|
}
|
|
523
574
|
};
|
|
524
575
|
const itemPort = {
|
|
@@ -701,15 +752,26 @@ function createMemoryViewPort(options = {}) {
|
|
|
701
752
|
}
|
|
702
753
|
};
|
|
703
754
|
const bilder = /* @__PURE__ */ new Map();
|
|
755
|
+
const werke = [];
|
|
704
756
|
for (const bild of options.images ?? []) {
|
|
705
757
|
bilder.set(bild.mediaRef, { bild, data: "AAAA" });
|
|
758
|
+
werke.push({ itemRef: bild.mediaRef, title: bild.title, images: [bild] });
|
|
759
|
+
}
|
|
760
|
+
for (const werk of options.imageItems ?? []) {
|
|
761
|
+
for (const bild of werk.images) bilder.set(bild.mediaRef, { bild, data: "AAAA" });
|
|
762
|
+
werke.push(werk);
|
|
706
763
|
}
|
|
764
|
+
const vorschauLazy = options.imagePreviewLazy === true;
|
|
707
765
|
const imageLibraryPort = {
|
|
708
|
-
async
|
|
709
|
-
const alle = [...bilder.values()].map((e) => e.bild);
|
|
766
|
+
async listItems(query) {
|
|
710
767
|
const gesucht = query?.search?.trim().toLowerCase();
|
|
711
|
-
const gefiltert = gesucht ?
|
|
712
|
-
|
|
768
|
+
const gefiltert = gesucht ? werke.filter((w) => w.title.toLowerCase().includes(gesucht)) : werke;
|
|
769
|
+
const sichtbar = query?.limit ? gefiltert.slice(0, query.limit) : gefiltert;
|
|
770
|
+
if (!vorschauLazy) return ok(sichtbar);
|
|
771
|
+
return ok(sichtbar.map((w) => ({
|
|
772
|
+
...w,
|
|
773
|
+
images: w.images.map((b) => ({ ...b, thumbUrl: null }))
|
|
774
|
+
})));
|
|
713
775
|
},
|
|
714
776
|
async resolveImage(mediaRef) {
|
|
715
777
|
const eintrag = bilder.get(mediaRef);
|
|
@@ -727,9 +789,19 @@ function createMemoryViewPort(options = {}) {
|
|
|
727
789
|
thumbUrl: null
|
|
728
790
|
};
|
|
729
791
|
bilder.set(mediaRef, { bild, data: input.data });
|
|
792
|
+
werke.unshift({ itemRef: mediaRef, title: bild.title, images: [bild] });
|
|
730
793
|
return done(bild);
|
|
731
794
|
}
|
|
732
795
|
};
|
|
796
|
+
if (vorschauLazy) {
|
|
797
|
+
imageLibraryPort.loadPreview = async (mediaRef) => {
|
|
798
|
+
const eintrag = bilder.get(mediaRef);
|
|
799
|
+
if (!eintrag) {
|
|
800
|
+
return { kind: "error", message: `Bild ${mediaRef} ist unbekannt.`, retryable: false };
|
|
801
|
+
}
|
|
802
|
+
return ok(`data:${eintrag.bild.mimeType};base64,${eintrag.data}`);
|
|
803
|
+
};
|
|
804
|
+
}
|
|
733
805
|
const batches = [...options.batches ?? []];
|
|
734
806
|
const imageGenerationEvents = createInMemoryEventChannel();
|
|
735
807
|
const imageBatchHistoryPort = {
|
|
@@ -996,41 +1068,83 @@ var FAILURE_CLASSES = [
|
|
|
996
1068
|
];
|
|
997
1069
|
var PFLICHTFELDER = [
|
|
998
1070
|
"run_id",
|
|
999
|
-
"shot_version_id",
|
|
1000
|
-
"shot_element_id",
|
|
1001
|
-
"scene_setup_version_id",
|
|
1002
|
-
"camera_id",
|
|
1003
|
-
"target_model_version_id",
|
|
1004
1071
|
"provider",
|
|
1005
1072
|
"model_id",
|
|
1006
1073
|
"system_prompt",
|
|
1007
1074
|
"created_at"
|
|
1008
1075
|
];
|
|
1076
|
+
var TEXTFELDER = [
|
|
1077
|
+
"shot_version_id",
|
|
1078
|
+
"shot_element_id",
|
|
1079
|
+
"scene_setup_version_id",
|
|
1080
|
+
"camera_id",
|
|
1081
|
+
"target_model_version_id"
|
|
1082
|
+
];
|
|
1083
|
+
var PFLICHT_JE_HERKUNFT = {
|
|
1084
|
+
published: ["shot_version_id", "shot_element_id", "scene_setup_version_id"],
|
|
1085
|
+
draft_chain: ["shot_element_id"],
|
|
1086
|
+
scene_direct: []
|
|
1087
|
+
};
|
|
1088
|
+
var VERBOTEN_JE_HERKUNFT = {
|
|
1089
|
+
published: [],
|
|
1090
|
+
draft_chain: ["shot_version_id", "scene_setup_version_id"],
|
|
1091
|
+
scene_direct: ["shot_version_id", "shot_element_id", "scene_setup_version_id", "camera_id"]
|
|
1092
|
+
};
|
|
1009
1093
|
function istText(wert) {
|
|
1010
1094
|
return typeof wert === "string" && wert.trim().length > 0;
|
|
1011
1095
|
}
|
|
1012
1096
|
function isObject(wert) {
|
|
1013
1097
|
return typeof wert === "object" && wert !== null && !Array.isArray(wert);
|
|
1014
1098
|
}
|
|
1015
|
-
var VERSIONSFELDER = ["shot_version_id", "scene_setup_version_id"];
|
|
1016
1099
|
var KETTEN_TYPEN = ["scene", "scene_setup", "shot"];
|
|
1100
|
+
var HERKUENFTE = ["published", "draft_chain", "scene_direct"];
|
|
1017
1101
|
function pruefeLaufherkunft(quelle) {
|
|
1018
1102
|
if (!isObject(quelle)) {
|
|
1019
1103
|
return { ok: false, message: '"source" muss ein Objekt sein.' };
|
|
1020
1104
|
}
|
|
1105
|
+
if (!HERKUENFTE.includes(quelle.kind)) {
|
|
1106
|
+
return {
|
|
1107
|
+
ok: false,
|
|
1108
|
+
message: `"source.kind" ist unbekannt: ${JSON.stringify(quelle.kind)}. Erlaubt: ${HERKUENFTE.join(", ")}.`
|
|
1109
|
+
};
|
|
1110
|
+
}
|
|
1021
1111
|
if (quelle.kind === "published") {
|
|
1022
|
-
for (const feld of
|
|
1112
|
+
for (const feld of ["shot_version_id", "scene_setup_version_id"]) {
|
|
1023
1113
|
if (!istText(quelle[feld])) {
|
|
1024
1114
|
return { ok: false, message: `"source.${feld}" fehlt oder ist leer.` };
|
|
1025
1115
|
}
|
|
1026
1116
|
}
|
|
1027
1117
|
return { ok: true };
|
|
1028
1118
|
}
|
|
1029
|
-
if (quelle.kind
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
message:
|
|
1033
|
-
}
|
|
1119
|
+
if (quelle.kind === "scene_direct") {
|
|
1120
|
+
const szene = quelle.scene;
|
|
1121
|
+
if (!isObject(szene)) {
|
|
1122
|
+
return { ok: false, message: '"source.scene" muss ein Objekt sein.' };
|
|
1123
|
+
}
|
|
1124
|
+
if (!istText(szene.element_id)) {
|
|
1125
|
+
return { ok: false, message: '"source.scene.element_id" fehlt oder ist leer.' };
|
|
1126
|
+
}
|
|
1127
|
+
const ausEntwurf = istText(szene.draft_id);
|
|
1128
|
+
const ausVersion = istText(szene.version_id);
|
|
1129
|
+
if (ausEntwurf === ausVersion) {
|
|
1130
|
+
return {
|
|
1131
|
+
ok: false,
|
|
1132
|
+
message: ausEntwurf ? '"source.scene" nennt draft_id und version_id zugleich. Eingefroren wurde genau ein Stand (D-135).' : '"source.scene" nennt weder draft_id noch version_id. Ohne den eingefrorenen Stand ist der Lauf nicht nachvollziehbar (D-97).'
|
|
1133
|
+
};
|
|
1134
|
+
}
|
|
1135
|
+
if (ausEntwurf && (typeof szene.revision !== "number" || !Number.isInteger(szene.revision))) {
|
|
1136
|
+
return {
|
|
1137
|
+
ok: false,
|
|
1138
|
+
message: '"source.scene.revision" muss eine ganze Zahl sein \u2014 ohne sie ist der eingefrorene Entwurfsstand nicht benennbar (D-97).'
|
|
1139
|
+
};
|
|
1140
|
+
}
|
|
1141
|
+
if (ausVersion && szene.revision !== null && szene.revision !== void 0) {
|
|
1142
|
+
return {
|
|
1143
|
+
ok: false,
|
|
1144
|
+
message: '"source.scene.revision" ist bei einer veroeffentlichten Version gesetzt. Eine Version ist unveraenderlich und hat keine Revision (D-02).'
|
|
1145
|
+
};
|
|
1146
|
+
}
|
|
1147
|
+
return { ok: true };
|
|
1034
1148
|
}
|
|
1035
1149
|
if (!istText(quelle.chain_id)) {
|
|
1036
1150
|
return { ok: false, message: '"source.chain_id" fehlt oder ist leer.' };
|
|
@@ -1081,25 +1195,38 @@ function checkPromptRunRecord(candidate) {
|
|
|
1081
1195
|
}
|
|
1082
1196
|
const record = candidate;
|
|
1083
1197
|
const quelle = record.source;
|
|
1084
|
-
const ausKette = isObject(quelle) && quelle.kind === "draft_chain";
|
|
1085
1198
|
if (quelle !== void 0) {
|
|
1086
1199
|
const urteil2 = pruefeLaufherkunft(quelle);
|
|
1087
1200
|
if (!urteil2.ok) return urteil2;
|
|
1088
1201
|
}
|
|
1089
|
-
const
|
|
1090
|
-
for (const feld of
|
|
1202
|
+
const herkunft = isObject(quelle) && typeof quelle.kind === "string" ? quelle.kind : "published";
|
|
1203
|
+
for (const feld of PFLICHTFELDER) {
|
|
1091
1204
|
if (!istText(record[feld])) {
|
|
1092
1205
|
return { ok: false, message: `"${feld}" fehlt oder ist leer.` };
|
|
1093
1206
|
}
|
|
1094
1207
|
}
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1208
|
+
for (const feld of TEXTFELDER) {
|
|
1209
|
+
if (typeof record[feld] !== "string") {
|
|
1210
|
+
return {
|
|
1211
|
+
ok: false,
|
|
1212
|
+
message: `"${feld}" fehlt. Wo es keinen Wert gibt, gehoert eine leere Zeichenkette hin \u2014 kein fehlendes Feld (D-135).`
|
|
1213
|
+
};
|
|
1214
|
+
}
|
|
1215
|
+
}
|
|
1216
|
+
for (const feld of PFLICHT_JE_HERKUNFT[herkunft] ?? []) {
|
|
1217
|
+
if (!istText(record[feld])) {
|
|
1218
|
+
return {
|
|
1219
|
+
ok: false,
|
|
1220
|
+
message: `"${feld}" fehlt oder ist leer, wird bei Herkunft "${herkunft}" aber gebraucht.`
|
|
1221
|
+
};
|
|
1222
|
+
}
|
|
1223
|
+
}
|
|
1224
|
+
for (const feld of VERBOTEN_JE_HERKUNFT[herkunft] ?? []) {
|
|
1225
|
+
if (istText(record[feld])) {
|
|
1226
|
+
return {
|
|
1227
|
+
ok: false,
|
|
1228
|
+
message: `"${feld}" ist bei einem Lauf der Herkunft "${herkunft}" gesetzt. Dort gibt es diesen Wert nicht, und erfundene sind unzulaessig (D-98/D-135).`
|
|
1229
|
+
};
|
|
1103
1230
|
}
|
|
1104
1231
|
}
|
|
1105
1232
|
if (record.status !== "succeeded" && record.status !== "failed") {
|
|
@@ -1475,6 +1602,7 @@ export {
|
|
|
1475
1602
|
ELEMENT_VERSION_SCHEMA_FILE,
|
|
1476
1603
|
FLOW_EXECUTION_PATH,
|
|
1477
1604
|
PROBE_VERSION_ID,
|
|
1605
|
+
PROMPT_RULE_EFFECT,
|
|
1478
1606
|
REFERENCE_FIELD,
|
|
1479
1607
|
RULES_WITHOUT_CAPABILITY_EFFECT,
|
|
1480
1608
|
RULE_SCOPES,
|
|
@@ -1511,6 +1639,7 @@ export {
|
|
|
1511
1639
|
checkDraftChainMeta,
|
|
1512
1640
|
checkElementType,
|
|
1513
1641
|
checkImageExecutionProfile,
|
|
1642
|
+
checkImageExecutionProfiles,
|
|
1514
1643
|
checkImageModelParameters,
|
|
1515
1644
|
checkOptionalId,
|
|
1516
1645
|
checkParents,
|
|
@@ -1559,7 +1688,10 @@ export {
|
|
|
1559
1688
|
derivationPoliciesOf,
|
|
1560
1689
|
deriveItemFromRun,
|
|
1561
1690
|
deriveLineage,
|
|
1691
|
+
describableContent,
|
|
1562
1692
|
describeTargetModelFailure,
|
|
1693
|
+
diagnosticOfFinding,
|
|
1694
|
+
diagnosticOfSchemaError,
|
|
1563
1695
|
differentialSteps,
|
|
1564
1696
|
draftRevisionOf,
|
|
1565
1697
|
elementStoreContractChecks,
|
|
@@ -1574,14 +1706,18 @@ export {
|
|
|
1574
1706
|
firstError,
|
|
1575
1707
|
formatSchemaErrors,
|
|
1576
1708
|
freezeDraftChain,
|
|
1709
|
+
freezeSceneWorkingState,
|
|
1577
1710
|
getSzenenSchemas,
|
|
1711
|
+
gruppiereZuItems,
|
|
1578
1712
|
hasPlacementCapability,
|
|
1579
1713
|
isKnownElementType,
|
|
1580
1714
|
isOk,
|
|
1581
1715
|
isProjectionCurrent,
|
|
1582
1716
|
isSzenenItemId,
|
|
1583
1717
|
itemIdForRun,
|
|
1718
|
+
ladeVorschauen,
|
|
1584
1719
|
linkFor,
|
|
1720
|
+
locatorTeile,
|
|
1585
1721
|
logRevisionOf,
|
|
1586
1722
|
mergeSzenenBatchOrigin,
|
|
1587
1723
|
noticeFor,
|
|
@@ -1590,22 +1726,26 @@ export {
|
|
|
1590
1726
|
parseRunResponse,
|
|
1591
1727
|
preferredHeadRevisionOf,
|
|
1592
1728
|
preferredVersionId,
|
|
1729
|
+
promptDiagnosticsOf,
|
|
1593
1730
|
publishedHeadsOf,
|
|
1594
1731
|
recoveriesForRun,
|
|
1595
1732
|
recoveryStatusOf,
|
|
1596
1733
|
reduceElementEvents,
|
|
1597
1734
|
resolveArea,
|
|
1598
1735
|
resolvePreferredHead,
|
|
1736
|
+
resolveScenePayload,
|
|
1599
1737
|
resolveShot,
|
|
1600
1738
|
resolveShotPayload,
|
|
1601
1739
|
resolveTargetModelOver,
|
|
1602
1740
|
resolverFromQueries,
|
|
1603
1741
|
roundOfRun,
|
|
1742
|
+
rulesWithoutPromptEffect,
|
|
1604
1743
|
runElementStoreContract,
|
|
1605
1744
|
runPromptDerivation,
|
|
1606
1745
|
runPublishChecks,
|
|
1607
1746
|
runSceneDerivation,
|
|
1608
1747
|
runStoreDifferential,
|
|
1748
|
+
sceneOnlyCapabilities,
|
|
1609
1749
|
scopeOfPath,
|
|
1610
1750
|
selectableTargetModels,
|
|
1611
1751
|
showChain,
|