@rslsp1/fa-app-tools 9.0.0 → 9.1.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/szenen.mjs CHANGED
@@ -9,6 +9,10 @@ import {
9
9
  ELEMENT_VERSION_SCHEMA_FILE,
10
10
  FLOW_EXECUTION_PATH,
11
11
  GENERAL_POLICY_SUBTYPE,
12
+ MANUAL_MODEL_ID,
13
+ MANUAL_NODE_STATE,
14
+ MANUAL_PROVIDER,
15
+ MANUAL_VISIBILITY_BASIS,
12
16
  MAX_PROPOSAL_TITLE_LENGTH,
13
17
  PROBE_VERSION_ID,
14
18
  PROMPT_RULE_EFFECT,
@@ -34,6 +38,7 @@ import {
34
38
  assessDerivationResponse,
35
39
  batchesForPromptRun,
36
40
  bildPfad,
41
+ buildManualPromptRunRecord,
37
42
  buildSystemInstruction,
38
43
  buildSystemInstruction2,
39
44
  buildSzenenSnapshot,
@@ -136,6 +141,7 @@ import {
136
141
  locatorAus,
137
142
  locatorTeile,
138
143
  logRevisionOf,
144
+ manualEntryOf,
139
145
  mergeSnapshotAndPending,
140
146
  mergeSzenenBatchOrigin,
141
147
  mimeTypAus,
@@ -186,7 +192,7 @@ import {
186
192
  validateElementVersion,
187
193
  validatePayload,
188
194
  withReference
189
- } from "./chunk-2ADFDRFX.mjs";
195
+ } from "./chunk-33L6XAHI.mjs";
190
196
  import {
191
197
  ContractViolation,
192
198
  STYLE_PAYLOAD,
@@ -605,6 +611,34 @@ function createMemoryViewPort(options = {}) {
605
611
  laeufe.push(lauf);
606
612
  return done(lauf);
607
613
  },
614
+ // ── Der manuell erfasste Lauf derselben Szene (Schritt 01) ────────────
615
+ //
616
+ // Auch hier nur die **Form**, und zwar ueber `buildManualPromptRunRecord()`
617
+ // — dieselbe Funktion, die der echte Port benutzt. Ein hier nachgebauter
618
+ // Datensatz waere die zweite Wahrheit, an der eine Ansicht gruen testete
619
+ // und im Host scheiterte. Was der Speicherport nicht abbildet, ist das
620
+ // Einfrieren: Es braucht einen echten Bestand.
621
+ async addManualSceneRun(input) {
622
+ const gebaut = buildManualPromptRunRecord({
623
+ runId: ids(),
624
+ scene: {
625
+ element_id: input.sceneElementId,
626
+ draft_id: `draft-${input.sceneElementId}`,
627
+ revision: 1,
628
+ version_id: null
629
+ },
630
+ input: {
631
+ scene: { nodes: [] }
632
+ },
633
+ promptText: input.promptText,
634
+ note: input.note ?? null,
635
+ derivedFromRunId: input.derivedFromRunId ?? null,
636
+ enteredBy: input.enteredBy
637
+ });
638
+ if (gebaut.kind !== "ok") return { kind: "rejected", message: gebaut.message };
639
+ laeufe.push(gebaut.record);
640
+ return done(gebaut.record);
641
+ },
608
642
  async listRunsForScene(sceneElementId) {
609
643
  return ok(laeufe.filter(
610
644
  (r) => r.source?.kind === "scene_direct" && r.source.scene.element_id === sceneElementId
@@ -1271,6 +1305,47 @@ function pruefeLaufherkunft(quelle) {
1271
1305
  }
1272
1306
  return { ok: true };
1273
1307
  }
1308
+ function pruefeHandeingabe(record) {
1309
+ const block = record.manual_entry;
1310
+ if (block === void 0) return { ok: true };
1311
+ if (!isObject(block)) {
1312
+ return { ok: false, message: '"manual_entry" muss ein Objekt sein.' };
1313
+ }
1314
+ if (block.entered_manually !== true) {
1315
+ return {
1316
+ ok: false,
1317
+ message: '"manual_entry.entered_manually" muss true sein. Ein Block, der das nicht sagt, ist kein Nachweis einer Handeingabe.'
1318
+ };
1319
+ }
1320
+ if (!istText(block.entered_by)) {
1321
+ return { ok: false, message: '"manual_entry.entered_by" fehlt oder ist leer.' };
1322
+ }
1323
+ if (block.note !== null && typeof block.note !== "string") {
1324
+ return {
1325
+ ok: false,
1326
+ message: '"manual_entry.note" muss eine Zeichenkette oder null sein \u2014 ohne Notiz gehoert null hin, kein fehlendes Feld.'
1327
+ };
1328
+ }
1329
+ if (block.derived_from_run_id !== null && !istText(block.derived_from_run_id)) {
1330
+ return {
1331
+ ok: false,
1332
+ message: '"manual_entry.derived_from_run_id" muss eine run_id oder null sein. Eine leere Kennung belegt keinen Ursprung.'
1333
+ };
1334
+ }
1335
+ if (record.status !== "succeeded") {
1336
+ return {
1337
+ ok: false,
1338
+ message: `Ein manuell erfasster Lauf hat den Status "succeeded" \u2014 er traegt einen vorgegebenen Prompttext. Angekommen ist ${JSON.stringify(record.status)}.`
1339
+ };
1340
+ }
1341
+ if (record.provider !== MANUAL_PROVIDER || record.model_id !== MANUAL_MODEL_ID) {
1342
+ return {
1343
+ ok: false,
1344
+ message: `Ein manuell erfasster Lauf traegt provider "${MANUAL_PROVIDER}" und model_id "${MANUAL_MODEL_ID}"; angekommen sind ${JSON.stringify(record.provider)} und ${JSON.stringify(record.model_id)}. Formuliert hat ein Mensch \u2014 ein Modell als Urheber waere eine Falschaussage.`
1345
+ };
1346
+ }
1347
+ return { ok: true };
1348
+ }
1274
1349
  function checkPromptRunRecord(candidate) {
1275
1350
  if (candidate === null || typeof candidate !== "object" || Array.isArray(candidate)) {
1276
1351
  return {
@@ -1320,6 +1395,8 @@ function checkPromptRunRecord(candidate) {
1320
1395
  message: `"status" muss succeeded oder failed sein, angekommen ist ${JSON.stringify(record.status)}.`
1321
1396
  };
1322
1397
  }
1398
+ const handeingabe = pruefeHandeingabe(record);
1399
+ if (!handeingabe.ok) return handeingabe;
1323
1400
  const eingabe = record.input_payload;
1324
1401
  if (eingabe === null || typeof eingabe !== "object") {
1325
1402
  return { ok: false, message: '"input_payload" fehlt \u2014 ohne sie ist der Lauf nicht pruefbar.' };
@@ -1702,7 +1779,8 @@ async function preparePromptOperation(input) {
1702
1779
  store: input.store,
1703
1780
  resolver: input.resolver,
1704
1781
  contextChain: input.contextChain,
1705
- userInstruction: input.userInstruction ?? null
1782
+ userInstruction: input.userInstruction ?? null,
1783
+ targetModelElementId: input.targetModelElementId ?? null
1706
1784
  });
1707
1785
  if (eingefroren.kind !== "ok") return eingefroren;
1708
1786
  const rendererInput = eingefroren.input;
@@ -1802,6 +1880,10 @@ export {
1802
1880
  ELEMENT_VERSION_SCHEMA_FILE,
1803
1881
  FLOW_EXECUTION_PATH,
1804
1882
  GENERAL_POLICY_SUBTYPE,
1883
+ MANUAL_MODEL_ID,
1884
+ MANUAL_NODE_STATE,
1885
+ MANUAL_PROVIDER,
1886
+ MANUAL_VISIBILITY_BASIS,
1805
1887
  MCP_CLIENT_PROVIDER,
1806
1888
  PROBE_VERSION_ID,
1807
1889
  PROMPT_RULE_EFFECT,
@@ -1832,6 +1914,7 @@ export {
1832
1914
  bildPfad,
1833
1915
  buildSystemInstruction as buildDerivationSystemInstruction,
1834
1916
  buildUserPrompt as buildDerivationUserPrompt,
1917
+ buildManualPromptRunRecord,
1835
1918
  buildSystemInstruction2 as buildSystemInstruction,
1836
1919
  buildSzenenSnapshot,
1837
1920
  buildUserPrompt2 as buildUserPrompt,
@@ -1946,6 +2029,7 @@ export {
1946
2029
  locatorAus,
1947
2030
  locatorTeile,
1948
2031
  logRevisionOf,
2032
+ manualEntryOf,
1949
2033
  mergeSnapshotAndPending,
1950
2034
  mergeSzenenBatchOrigin,
1951
2035
  mimeTypAus,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rslsp1/fa-app-tools",
3
- "version": "9.0.0",
3
+ "version": "9.1.0",
4
4
  "description": "Shared tools and hooks for Fine Art flow apps",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",