@dsh-agentic-roleplay/core 0.9.0 → 0.9.1

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.
Files changed (37) hide show
  1. package/lib/{authoring-tools-CdHlvx32.js → authoring-tools-C_l07RYn.js} +1168 -509
  2. package/lib/authoring.js +22 -18
  3. package/lib/client.js +338 -338
  4. package/lib/doctor.js +1 -1
  5. package/lib/{gallery-BKh7eu80.js → gallery-q7niLtWn.js} +2 -2
  6. package/lib/{generator-DdZ1-sgv.js → generator-BpjPrvHe.js} +2 -2
  7. package/lib/{hooks-CcQj_dJo.js → hooks-DNaDzMjW.js} +37 -4
  8. package/lib/images.js +4 -4
  9. package/lib/index.js +12 -12
  10. package/lib/{library-QFL6Z_Nr.js → library-CIkxhf_R.js} +4 -2
  11. package/lib/{lorebook-author-tools-DWBnYo1E.js → lorebook-author-tools-BiMDmdFi.js} +5 -5
  12. package/lib/lorebook-authoring.js +4 -4
  13. package/lib/orchestration.js +7 -7
  14. package/lib/{pack-jail-BMy6NcCY.js → pack-jail-B35Vx3hT.js} +23 -13
  15. package/lib/{packs-BREPSfHy.js → packs-BajKw7S9.js} +2 -2
  16. package/lib/{presenter-agent-B49-_iUm.js → presenter-agent-jgtuTwZr.js} +4 -4
  17. package/lib/{preset-BqgY1Tz4.js → preset-DWgkcPau.js} +3 -3
  18. package/lib/{preset-author-tools-BB_Dcv2o.js → preset-author-tools-BhuYIKms.js} +5 -5
  19. package/lib/preset-authoring.js +5 -5
  20. package/lib/{presets-Bwnrx7p0.js → presets-9GzaSELc.js} +13 -4
  21. package/lib/{reflection-CUWG-6Qg.js → reflection-4L0Plvct.js} +5 -5
  22. package/lib/{turn-guard-Bb8Ew-1z.js → turn-guard-sCUXmp-5.js} +2 -2
  23. package/package.json +2 -2
  24. package/prompts/en/checks/conflict.md +1 -0
  25. package/prompts/en/checks/decide-conflict.md +1 -0
  26. package/prompts/en/checks/decide-covered.md +1 -0
  27. package/prompts/en/checks/decide-opening.md +1 -0
  28. package/prompts/en/checks/decide-same-thing.md +1 -0
  29. package/prompts/en/checks/decide-same-value.md +1 -0
  30. package/prompts/en/checks/notice.md +2 -2
  31. package/prompts/zh/checks/conflict.md +1 -0
  32. package/prompts/zh/checks/decide-conflict.md +1 -0
  33. package/prompts/zh/checks/decide-covered.md +1 -0
  34. package/prompts/zh/checks/decide-opening.md +1 -0
  35. package/prompts/zh/checks/decide-same-thing.md +1 -0
  36. package/prompts/zh/checks/decide-same-value.md +1 -0
  37. package/prompts/zh/checks/notice.md +2 -2
package/lib/doctor.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { a as chatSessionId } from "./access-CfQWbNZP.js";
2
2
  import { n as doctorSessionOf } from "./doctor-chat-hL1a61hp.js";
3
- import { i as externalTools, t as externalToolLimit } from "./hooks-CcQj_dJo.js";
3
+ import { i as externalTools, t as externalToolLimit } from "./hooks-DNaDzMjW.js";
4
4
  import { a as liveSettings } from "./narration-CjB_KwwY.js";
5
5
  import { join } from "node:path";
6
6
  import { existsSync } from "node:fs";
@@ -1,4 +1,4 @@
1
- import { _ as writeImageFileMetadata, a as LIBRARY_FOLDER, b as mapLimit, g as sidecarOf, h as readImageFileMetadata, m as mediaTypeOf } from "./library-QFL6Z_Nr.js";
1
+ import { _ as writeImageFileMetadata, a as LIBRARY_FOLDER, g as sidecarOf, h as readImageFileMetadata, m as mediaTypeOf, x as mapLimit } from "./library-CIkxhf_R.js";
2
2
  import { join, sep } from "node:path";
3
3
  import { randomUUID } from "node:crypto";
4
4
  import { lstat, mkdir, readFile, readdir, realpath, rename, stat, writeFile } from "node:fs/promises";
@@ -191,4 +191,4 @@ async function updateImage(sessionFolder, path, update) {
191
191
  }
192
192
  export { updateImage as i, galleryFile as n, listGallery as r, describeGalleryImage as t };
193
193
 
194
- //# sourceMappingURL=gallery-BKh7eu80.js.map
194
+ //# sourceMappingURL=gallery-q7niLtWn.js.map
@@ -1,4 +1,4 @@
1
- import { d as sceneImagePath, f as writeImage, u as referenceImagePath } from "./library-QFL6Z_Nr.js";
1
+ import { d as sceneImagePath, f as writeImage, u as referenceImagePath } from "./library-CIkxhf_R.js";
2
2
  // src/host/images/generator.ts
3
3
  const unique = (values) => [...new Set(values.map((value) => value.trim()).filter((value) => value !== ""))];
4
4
  /** What a reference image shows: the subject and its stable look. */
@@ -141,4 +141,4 @@ async function generateTransientImage(service, request) {
141
141
  }
142
142
  export { uploadReferenceImage as a, transientPrompt as i, generateTransientImage as n, referencePrompt as r, generateReferenceImage as t };
143
143
 
144
- //# sourceMappingURL=generator-DdZ1-sgv.js.map
144
+ //# sourceMappingURL=generator-BpjPrvHe.js.map
@@ -268,6 +268,30 @@ var Reader = class Reader {
268
268
  data;
269
269
  path;
270
270
  issues;
271
+ static watched;
272
+ looked = /* @__PURE__ */ new Set();
273
+ inner = [];
274
+ /**
275
+ * Runs a parse and returns what it never looked at: the fields of the document (and of the objects inside it) that nothing reads, as paths, and the top-level fields it did look at. A parser that gave up
276
+ * early has not looked at the rest, so only a parse that succeeded says anything.
277
+ */
278
+ static unreadBy(parse) {
279
+ const outer = Reader.watched;
280
+ const roots = [];
281
+ Reader.watched = roots;
282
+ try {
283
+ parse();
284
+ } finally {
285
+ Reader.watched = outer;
286
+ }
287
+ return {
288
+ unread: roots.flatMap((root) => root.unread()),
289
+ read: roots.flatMap((root) => [...root.looked])
290
+ };
291
+ }
292
+ unread() {
293
+ return [...Object.keys(this.data).filter((key) => !this.looked.has(key)).map((key) => this.child(key)), ...this.inner.flatMap((reader) => reader.unread())];
294
+ }
271
295
  constructor(data, path, issues) {
272
296
  this.data = data;
273
297
  this.path = path;
@@ -292,7 +316,9 @@ var Reader = class Reader {
292
316
  });
293
317
  return;
294
318
  }
295
- return new Reader(data, "", issues);
319
+ const reader = new Reader(data, "", issues);
320
+ Reader.watched?.push(reader);
321
+ return reader;
296
322
  }
297
323
  fail(key, message) {
298
324
  this.issues.push({
@@ -302,6 +328,7 @@ var Reader = class Reader {
302
328
  }
303
329
  /** The value as written, with `null` read as absent. */
304
330
  raw(key) {
331
+ this.looked.add(key);
305
332
  const value = this.data[key];
306
333
  return value === null ? void 0 : value;
307
334
  }
@@ -367,7 +394,9 @@ var Reader = class Reader {
367
394
  this.fail(key, "must be an object");
368
395
  return;
369
396
  }
370
- return new Reader(value, this.child(key), this.issues);
397
+ const reader = new Reader(value, this.child(key), this.issues);
398
+ this.inner.push(reader);
399
+ return reader;
371
400
  }
372
401
  objects(key) {
373
402
  const value = this.raw(key);
@@ -377,7 +406,11 @@ var Reader = class Reader {
377
406
  return [];
378
407
  }
379
408
  return value.flatMap((entry, index) => {
380
- if (isRecord(entry)) return [new Reader(entry, this.child(`${key}[${index}]`), this.issues)];
409
+ if (isRecord(entry)) {
410
+ const reader = new Reader(entry, this.child(`${key}[${index}]`), this.issues);
411
+ this.inner.push(reader);
412
+ return [reader];
413
+ }
381
414
  this.fail(`${key}[${index}]`, "must be an object");
382
415
  return [];
383
416
  });
@@ -3579,4 +3612,4 @@ function installHooks(ctx, deps) {
3579
3612
  }
3580
3613
  export { copyWorldPrompts as $, answerLimits as A, loadPlots as B, readNotes as C, describeWhen as D, describeTime as E, STORY_LANGUAGES as F, commandsOf as G, plotReferenceProblems as H, isStoryLanguage as I, formatIssue as J, readDocument as K, textLanguage as L, plotProgressOf as M, populatePlots as N, zoneOf as O, LANGUAGE_NAMES as P, PromptLibrary as Q, wrongLanguage as R, notesOfSession as S, ClockError as T, COMMANDS_KEY as U, parsePlotsFile as V, commandFlagKey as W, LANGUAGE_FOLDER as X, errorMessage as Y, PROMPTS_FOLDER as Z, readRunDetail as _, externalWithheld as a, shippedPromptsDirectory as at, readWithdrawn as b, record as c, InvalidStartError as ct, guardRepeatedCalls as d, SessionArchivedError as dt, inheritPrompts as et, MAX_OOC_ANSWER as f, SessionNotFoundError as ft, readActivity as g, readDecisionStats as h, COMPARISONS as ht, externalTools as i, shippedLanguages as it, PLOTS_METADATA_KEY as j, RESULTS as k, characterRunner as l, InvalidWorldError as lt, readUsage as m, AUTHORING_NEEDS as mt, installHooks as n, listFiles as nt, PREVIEW_TOOL as o, shippedText as ot, storesOf as p, WorldNotFoundError as pt, Reader as q, externalGiven as r, promptProblem as rt, createTools$1 as s, AgentUnavailableError as st, externalToolLimit as t, languageOf as tt, toolEnabled as u, ReflectionRefusedError as ut, readVerdicts as v, observeAsPlayer as w, addToNote as x, writeVerdicts as y, PLOTS_FILE_NAME as z };
3581
3614
 
3582
- //# sourceMappingURL=hooks-CcQj_dJo.js.map
3615
+ //# sourceMappingURL=hooks-DNaDzMjW.js.map
package/lib/images.js CHANGED
@@ -1,5 +1,5 @@
1
- import { a as tokensOf, i as searchImages, n as interpretImage, o as present, r as imageTools, s as presentedFor, t as runImagePresenter } from "./presenter-agent-B49-_iUm.js";
2
- import { i as updateImage, r as listGallery } from "./gallery-BKh7eu80.js";
3
- import { c as nextSceneSerial, d as sceneImagePath, l as readImageMetadata, o as entityImageDirectory, s as inheritImages, t as addToLibrary, u as referenceImagePath, v as readPngMetadata, y as withPngMetadata } from "./library-QFL6Z_Nr.js";
4
- import { i as transientPrompt, n as generateTransientImage, r as referencePrompt, t as generateReferenceImage } from "./generator-DdZ1-sgv.js";
1
+ import { a as tokensOf, i as searchImages, n as interpretImage, o as present, r as imageTools, s as presentedFor, t as runImagePresenter } from "./presenter-agent-jgtuTwZr.js";
2
+ import { i as updateImage, r as listGallery } from "./gallery-q7niLtWn.js";
3
+ import { c as nextSceneSerial, d as sceneImagePath, l as readImageMetadata, o as entityImageDirectory, s as inheritImages, t as addToLibrary, u as referenceImagePath, v as readPngMetadata, y as withPngMetadata } from "./library-CIkxhf_R.js";
4
+ import { i as transientPrompt, n as generateTransientImage, r as referencePrompt, t as generateReferenceImage } from "./generator-BpjPrvHe.js";
5
5
  export { addToLibrary, entityImageDirectory, generateReferenceImage, generateTransientImage, imageTools, inheritImages, interpretImage, listGallery, nextSceneSerial, present, presentedFor, readImageMetadata, readPngMetadata, referenceImagePath, referencePrompt, runImagePresenter, sceneImagePath, searchImages, tokensOf, transientPrompt, updateImage, withPngMetadata };
package/lib/index.js CHANGED
@@ -1,20 +1,20 @@
1
1
  import { a as chatSessionId, i as VARIABLE_VISIBILITIES, n as VARIABLE_KINDS, o as roleplaySessionOf, r as VARIABLE_SUBJECTS } from "./access-CfQWbNZP.js";
2
- import { $ as WORLD_FILE_NAME, $t as pictureOf, At as routineProblems, B as localChanges, Ct as populateItems, Dt as populateRoutines, Et as populateLore, Gt as loadCalendar, H as writeOrigin, Ht as loadDice, It as loadLocations, J as guardedLookup, Jt as loadCharacters, Kt as parseCalendarFile, L as describeChanges, Ot as populateTriggers, Qt as isPng, R as hashWorld, Rt as loadItems, St as populateFactions, T as loadWorldParts, Tt as populateLocations, U as CatalogueError, Ut as parseDiceFile, V as readOrigin, Vt as DICE_FILE_NAME, Wt as CALENDAR_FILE_NAME, X as vetUrl, Xt as knownOutputCeiling, Yt as subfolders, Zt as ImportCardError, _t as knowsCharacter, at as deleteLorebookEntry, bt as populateClock, c as importPhase, ct as listLorebooks, d as markReady, en as readCard, et as parseWorldFile, f as settleDraft, ft as reserveLorebook, gt as loadValidatedWorld, ht as checkWorld, in as authoredWorldOf, it as deleteLorebook, jt as TRIGGERS_FILE_NAME, kt as populateVariables, lt as loadLorebook, mt as writeLorebookEntry, nn as DICE_READINGS, nt as addLorebookEntries, ot as entriesOf, p as structureImport, pt as updateLorebookInfo, qt as CHARACTERS_DIR, rn as DICE_RESULTS, rt as createLorebook, st as isLorebookName, t as AuthoringTools, tn as DICE_COMPARISONS, tt as parseWorldInfoEdit, u as keepDraft, ut as lorebookDirectory, v as editWorldInfo, vt as populateCalendar, wt as populateKnowledge, xt as populateDice, y as readWorldInfo, yt as populateCharacters, z as isUnchanged } from "./authoring-tools-CdHlvx32.js";
3
- import { a as lorebookImportMessage, c as readLorebook, d as lorebookOfChat, l as selectEntries, s as previewLorebook, t as LOREBOOK_UPLOAD, u as lorebookChatSessionId } from "./lorebook-author-tools-DWBnYo1E.js";
4
- import { a as presetChatSessionId, n as narrationImportMessage, o as presetOfChat } from "./preset-author-tools-BB_Dcv2o.js";
2
+ import { $ as WORLD_FILE_NAME, $t as pictureOf, At as routineProblems, B as localChanges, C as readWorldInfo, Ct as populateItems, Dt as populateRoutines, Et as populateLore, Gt as loadCalendar, H as writeOrigin, Ht as loadDice, It as loadLocations, J as guardedLookup, Jt as loadCharacters, Kt as parseCalendarFile, L as describeChanges, Ot as populateTriggers, Qt as isPng, R as hashWorld, Rt as loadItems, S as editWorldInfo, St as populateFactions, T as loadWorldParts, Tt as populateLocations, U as CatalogueError, Ut as parseDiceFile, V as readOrigin, Vt as DICE_FILE_NAME, Wt as CALENDAR_FILE_NAME, X as vetUrl, Xt as knownOutputCeiling, Yt as subfolders, Zt as ImportCardError, _t as knowsCharacter, at as deleteLorebookEntry, bt as populateClock, c as importPhase, ct as listLorebooks, d as markReady, en as readCard, et as parseWorldFile, f as settleDraft, ft as reserveLorebook, gt as loadValidatedWorld, ht as checkWorld, in as authoredWorldOf, it as deleteLorebook, jt as TRIGGERS_FILE_NAME, kt as populateVariables, lt as loadLorebook, mt as writeLorebookEntry, nn as DICE_READINGS, nt as addLorebookEntries, ot as entriesOf, p as structureImport, pt as updateLorebookInfo, qt as CHARACTERS_DIR, rn as DICE_RESULTS, rt as createLorebook, st as isLorebookName, t as AuthoringTools, tn as DICE_COMPARISONS, tt as parseWorldInfoEdit, u as keepDraft, ut as lorebookDirectory, vt as populateCalendar, wt as populateKnowledge, xt as populateDice, yt as populateCharacters, z as isUnchanged } from "./authoring-tools-C_l07RYn.js";
3
+ import { a as lorebookImportMessage, c as readLorebook, d as lorebookOfChat, l as selectEntries, s as previewLorebook, t as LOREBOOK_UPLOAD, u as lorebookChatSessionId } from "./lorebook-author-tools-BiMDmdFi.js";
4
+ import { a as presetChatSessionId, n as narrationImportMessage, o as presetOfChat } from "./preset-author-tools-BhuYIKms.js";
5
5
  import { a as liveSettings, c as writeSettings, d as DEFAULT_SETTINGS, f as SETTINGS_SPEC, h as WORLD_RULES_KEY, i as InvalidSettingsError, l as atomicWrite, o as readSettings, p as parseSettings, s as useChildReasoning } from "./narration-CjB_KwwY.js";
6
- import { $ as DOCTOR_OPENING_SOURCE, A as worldEntityImageFile, B as languageOfDocuments, C as readWorldEditor, D as uploadWorldCharacterPortrait, E as replaceFile, F as PRESET_FILE, G as revertUpdate, H as findTargets, I as presetMessage, J as AuthoringSessions, K as startUpdate, O as uploadWorldEntityImage, Q as agentServicesOf, R as translateMessage, S as generateWorldEntityImage, T as removeWorldTrigger, V as readWorldDocuments, X as ensureAuthoringChat, Y as authoringTitle, Z as AgentSessions, _ as editWorldPlots$1, a as deleteWorldPackFile, b as entityFolder, c as createAuthoredEntity, et as appendEmptyTurn, f as editWorldCharacter$1, g as editWorldPlace$1, h as editWorldNarrationVoice, j as writeWorldTrigger, k as worldCharacterPortraitFile, l as deleteAuthoredEntity, m as editWorldLore$1, n as packFileProblem, p as editWorldFaction$1, q as updateStatus, t as MAX_PACK_TEXT, tt as appendNarratedTurn, u as readAuthoredEntityDocument, v as editWorldRelation$1, w as readWorldTrigger, x as generateWorldCharacterPortrait, y as editWorldThing$1 } from "./pack-jail-BMy6NcCY.js";
6
+ import { $ as DOCTOR_OPENING_SOURCE, A as worldEntityImageFile, B as languageOfDocuments, C as readWorldEditor, D as uploadWorldCharacterPortrait, E as replaceFile, F as PRESET_FILE, G as revertUpdate, H as findTargets, I as presetMessage, J as AuthoringSessions, K as startUpdate, O as uploadWorldEntityImage, Q as agentServicesOf, R as translateMessage, S as generateWorldEntityImage, T as removeWorldTrigger, V as readWorldDocuments, X as ensureAuthoringChat, Y as authoringTitle, Z as AgentSessions, _ as editWorldPlots$1, a as deleteWorldPackFile, b as entityFolder, c as createAuthoredEntity, et as appendEmptyTurn, f as editWorldCharacter$1, g as editWorldPlace$1, h as editWorldNarrationVoice, j as writeWorldTrigger, k as worldCharacterPortraitFile, l as deleteAuthoredEntity, m as editWorldLore$1, n as packFileProblem, p as editWorldFaction$1, q as updateStatus, t as MAX_PACK_TEXT, tt as appendNarratedTurn, u as readAuthoredEntityDocument, v as editWorldRelation$1, w as readWorldTrigger, x as generateWorldCharacterPortrait, y as editWorldThing$1 } from "./pack-jail-B35Vx3hT.js";
7
7
  import { d as sharedSamplingOf, i as childSamplingOf, u as parseSampling } from "./child-lYYeOwl2.js";
8
- import { $ as copyWorldPrompts, C as readNotes, H as plotReferenceProblems, J as formatIssue, K as readDocument, M as plotProgressOf, N as populatePlots, O as zoneOf, Q as PromptLibrary, S as notesOfSession, U as COMMANDS_KEY, V as parsePlotsFile, Y as errorMessage, _ as readRunDetail, b as readWithdrawn, ct as InvalidStartError, dt as SessionArchivedError, ft as SessionNotFoundError, g as readActivity, h as readDecisionStats, i as externalTools, it as shippedLanguages, j as PLOTS_METADATA_KEY, lt as InvalidWorldError, m as readUsage, pt as WorldNotFoundError, st as AgentUnavailableError, tt as languageOf, ut as ReflectionRefusedError, w as observeAsPlayer, x as addToNote } from "./hooks-CcQj_dJo.js";
9
- import { $ as ImportNotFoundError, At as parseLoreEdit, Ct as CHARACTER_FILE_NAME, Dt as InvalidEditProblems, Ft as LORE_SCOPES, G as listWorldPrompts, K as readWorldPrompt, Mt as parseRelationEdit, Nt as parseThingEdit, Ot as parseCharacterEdit, Pt as LORE_KINDS, Q as IMPORT_FOLDER, W as deleteWorldPrompt, X as partsOf, Z as withPlayer, a as isPresetName, c as presetDirectory, d as savePresetFromWorld, dt as parseVariablesFile, et as ImportStore, ft as variableProblems, i as deletePreset, jt as parsePlaceEdit, kt as parseFactionEdit, lt as VARIABLES_FILE_NAME, o as listPresets, ot as IMPORT_COMMAND, p as updatePresetInfo, q as writeWorldPrompt, r as createPresetFromShipped, rt as parseChoices, s as loadPreset, t as PRESET_FILE$1, u as reservePreset, ut as loadVariables, wt as parseCharacterFile } from "./presets-Bwnrx7p0.js";
8
+ import { $ as copyWorldPrompts, C as readNotes, H as plotReferenceProblems, J as formatIssue, K as readDocument, M as plotProgressOf, N as populatePlots, O as zoneOf, Q as PromptLibrary, S as notesOfSession, U as COMMANDS_KEY, V as parsePlotsFile, Y as errorMessage, _ as readRunDetail, b as readWithdrawn, ct as InvalidStartError, dt as SessionArchivedError, ft as SessionNotFoundError, g as readActivity, h as readDecisionStats, i as externalTools, it as shippedLanguages, j as PLOTS_METADATA_KEY, lt as InvalidWorldError, m as readUsage, pt as WorldNotFoundError, st as AgentUnavailableError, tt as languageOf, ut as ReflectionRefusedError, w as observeAsPlayer, x as addToNote } from "./hooks-DNaDzMjW.js";
9
+ import { $ as ImportNotFoundError, At as parseLoreEdit, Ct as CHARACTER_FILE_NAME, Dt as InvalidEditProblems, Ft as LORE_SCOPES, G as listWorldPrompts, K as readWorldPrompt, Mt as parseRelationEdit, Nt as parseThingEdit, Ot as parseCharacterEdit, Pt as LORE_KINDS, Q as IMPORT_FOLDER, W as deleteWorldPrompt, X as partsOf, Z as withPlayer, a as isPresetName, c as presetDirectory, d as savePresetFromWorld, dt as parseVariablesFile, et as ImportStore, ft as variableProblems, i as deletePreset, jt as parsePlaceEdit, kt as parseFactionEdit, lt as VARIABLES_FILE_NAME, o as listPresets, ot as IMPORT_COMMAND, p as updatePresetInfo, q as writeWorldPrompt, r as createPresetFromShipped, rt as parseChoices, s as loadPreset, t as PRESET_FILE$1, u as reservePreset, ut as loadVariables, wt as parseCharacterFile } from "./presets-9GzaSELc.js";
10
10
  import { i as translator, r as languageOf$1, t as trimCharacters } from "./text-CbGQhK1-.js";
11
- import { n as readPreset, r as selectPrompts, t as previewPreset } from "./preset-BqgY1Tz4.js";
12
- import { S as slug, d as sceneImagePath, s as inheritImages, t as addToLibrary, u as referenceImagePath, w as uniqueKey } from "./library-QFL6Z_Nr.js";
11
+ import { n as readPreset, r as selectPrompts, t as previewPreset } from "./preset-DWgkcPau.js";
12
+ import { C as slug, T as uniqueKey, d as sceneImagePath, s as inheritImages, t as addToLibrary, u as referenceImagePath } from "./library-CIkxhf_R.js";
13
13
  import { t as doctorChatSessionId } from "./doctor-chat-hL1a61hp.js";
14
- import { c as readTimeline, d as copyPreset, f as presetStatus, h as defaultBoundaries, i as reflectionStatus, l as writeTimeline, m as switchPreset, o as TimelineError, p as recordPreset, u as pathTo } from "./reflection-CUWG-6Qg.js";
15
- import { _ as API_PREFIX, a as packIds, c as describePack, d as packPath, f as readPack, l as isPackId, m as PACK_LIMITS, n as anyTab, o as syncWorldPacks, r as copyWorldPacks, s as worldPackStates, t as activePack, u as packFile } from "./packs-BREPSfHy.js";
16
- import { a as uploadReferenceImage, t as generateReferenceImage } from "./generator-DdZ1-sgv.js";
17
- import { i as updateImage, n as galleryFile, r as listGallery } from "./gallery-BKh7eu80.js";
14
+ import { c as readTimeline, d as copyPreset, f as presetStatus, h as defaultBoundaries, i as reflectionStatus, l as writeTimeline, m as switchPreset, o as TimelineError, p as recordPreset, u as pathTo } from "./reflection-4L0Plvct.js";
15
+ import { _ as API_PREFIX, a as packIds, c as describePack, d as packPath, f as readPack, l as isPackId, m as PACK_LIMITS, n as anyTab, o as syncWorldPacks, r as copyWorldPacks, s as worldPackStates, t as activePack, u as packFile } from "./packs-BajKw7S9.js";
16
+ import { a as uploadReferenceImage, t as generateReferenceImage } from "./generator-BpjPrvHe.js";
17
+ import { i as updateImage, n as galleryFile, r as listGallery } from "./gallery-q7niLtWn.js";
18
18
  import { basename, dirname, extname, isAbsolute, join, normalize, relative, resolve, sep } from "node:path";
19
19
  import { cpSync, createReadStream, existsSync, mkdirSync, readFileSync, readdirSync, renameSync, statSync, writeFileSync } from "node:fs";
20
20
  import { createHash, randomBytes, randomUUID } from "node:crypto";
@@ -5,6 +5,8 @@ import { existsSync } from "node:fs";
5
5
  import { createHash, randomUUID } from "node:crypto";
6
6
  import { copyFile, link, mkdir, readFile, readdir, rename, unlink, writeFile } from "node:fs/promises";
7
7
  // src/host/import/run.ts
8
+ /** What `ImportContext.embed` rejects with when no embedding provider is selected or loaded: the checks that would use it go without. */
9
+ var NoEmbeddingService = class extends Error {};
8
10
  /** The labels of a job's prompt, in the language of the import. */
9
11
  const trOf = (ctx) => translator(languageOf(ctx.language));
10
12
  /** Runs `work` on every item, at most `limit` at a time, and returns the results in the order of the items. */
@@ -377,6 +379,6 @@ async function addToLibraryOnce(sessionFolder, bytes, originalName, known) {
377
379
  async function addToLibrary(sessionFolder, bytes, originalName) {
378
380
  return (await addToLibraryOnce(sessionFolder, bytes, originalName)).path;
379
381
  }
380
- export { trOf as C, slug as S, writeImageFileMetadata as _, LIBRARY_FOLDER as a, mapLimit as b, nextSceneSerial as c, sceneImagePath as d, writeImage as f, sidecarOf as g, readImageFileMetadata as h, libraryHashes as i, readImageMetadata as l, mediaTypeOf as m, addToLibraryOnce as n, entityImageDirectory as o, MEDIA_TYPES as p, imageExtensionOf as r, inheritImages as s, addToLibrary as t, referenceImagePath as u, readPngMetadata as v, uniqueKey as w, norm as x, withPngMetadata as y };
382
+ export { slug as C, norm as S, uniqueKey as T, writeImageFileMetadata as _, LIBRARY_FOLDER as a, NoEmbeddingService as b, nextSceneSerial as c, sceneImagePath as d, writeImage as f, sidecarOf as g, readImageFileMetadata as h, libraryHashes as i, readImageMetadata as l, mediaTypeOf as m, addToLibraryOnce as n, entityImageDirectory as o, MEDIA_TYPES as p, imageExtensionOf as r, inheritImages as s, addToLibrary as t, referenceImagePath as u, readPngMetadata as v, trOf as w, mapLimit as x, withPngMetadata as y };
381
383
 
382
- //# sourceMappingURL=library-QFL6Z_Nr.js.map
384
+ //# sourceMappingURL=library-CIkxhf_R.js.map
@@ -1,9 +1,9 @@
1
1
  import "./access-CfQWbNZP.js";
2
- import { Zt as ImportCardError, at as deleteLorebookEntry, dt as readLorebook$1, i as contextOf, lt as loadLorebook, mt as writeLorebookEntry, ot as entriesOf, pt as updateLorebookInfo, r as MAX_PREVIEW_TEXT, ut as lorebookDirectory } from "./authoring-tools-CdHlvx32.js";
3
- import { Ft as LORE_SCOPES, J as cleanText, Pt as LORE_KINDS, Q as IMPORT_FOLDER, X as partsOf, Z as withPlayer, n as createPresetFromGuidance } from "./presets-Bwnrx7p0.js";
4
- import { C as trOf, S as slug, b as mapLimit, w as uniqueKey } from "./library-QFL6Z_Nr.js";
2
+ import { Zt as ImportCardError, at as deleteLorebookEntry, dt as readLorebook$1, i as contextOf, lt as loadLorebook, mt as writeLorebookEntry, ot as entriesOf, pt as updateLorebookInfo, r as MAX_PREVIEW_TEXT, ut as lorebookDirectory } from "./authoring-tools-C_l07RYn.js";
3
+ import { Ft as LORE_SCOPES, J as cleanText, Pt as LORE_KINDS, Q as IMPORT_FOLDER, X as partsOf, Z as withPlayer, n as createPresetFromGuidance } from "./presets-9GzaSELc.js";
4
+ import { C as slug, T as uniqueKey, w as trOf, x as mapLimit } from "./library-CIkxhf_R.js";
5
5
  import { i as translator, r as languageOf } from "./text-CbGQhK1-.js";
6
- import { at as shippedPromptsDirectory } from "./hooks-CcQj_dJo.js";
6
+ import { at as shippedPromptsDirectory } from "./hooks-DNaDzMjW.js";
7
7
  import { join } from "node:path";
8
8
  import { existsSync, readFileSync } from "node:fs";
9
9
  import { readFile, rm, writeFile } from "node:fs/promises";
@@ -696,4 +696,4 @@ async function lorebookApproval(exec, next, state) {
696
696
  }
697
697
  export { lorebookImportMessage as a, readLorebook as c, lorebookOfChat as d, lorebookAuthorTools as i, selectEntries as l, LorebookReader as n, pendingTargets as o, lorebookApproval as r, previewLorebook as s, LOREBOOK_UPLOAD as t, lorebookChatSessionId as u };
698
698
 
699
- //# sourceMappingURL=lorebook-author-tools-DWBnYo1E.js.map
699
+ //# sourceMappingURL=lorebook-author-tools-BiMDmdFi.js.map
@@ -1,7 +1,7 @@
1
- import { n as limitAuthoringAgents, ut as lorebookDirectory } from "./authoring-tools-CdHlvx32.js";
2
- import { t as guardAuthoringTurns } from "./turn-guard-Bb8Ew-1z.js";
3
- import { d as lorebookOfChat, i as lorebookAuthorTools, n as LorebookReader, o as pendingTargets, r as lorebookApproval } from "./lorebook-author-tools-DWBnYo1E.js";
4
- import "./hooks-CcQj_dJo.js";
1
+ import { n as limitAuthoringAgents, ut as lorebookDirectory } from "./authoring-tools-C_l07RYn.js";
2
+ import { t as guardAuthoringTurns } from "./turn-guard-sCUXmp-5.js";
3
+ import { d as lorebookOfChat, i as lorebookAuthorTools, n as LorebookReader, o as pendingTargets, r as lorebookApproval } from "./lorebook-author-tools-BiMDmdFi.js";
4
+ import "./hooks-DNaDzMjW.js";
5
5
  import { join } from "node:path";
6
6
  import { existsSync, readdirSync } from "node:fs";
7
7
  // src/lorebook-authoring.ts
@@ -1,14 +1,14 @@
1
1
  import { a as chatSessionId, o as roleplaySessionOf, t as promptFor } from "./access-CfQWbNZP.js";
2
- import { D as describeWhen, G as commandsOf, O as zoneOf, R as wrongLanguage, T as ClockError, U as COMMANDS_KEY, W as commandFlagKey, c as record, f as MAX_OOC_ANSWER, k as RESULTS, l as characterRunner, mt as AUTHORING_NEEDS, n as installHooks, o as PREVIEW_TOOL, ot as shippedText, p as storesOf, r as externalGiven, s as createTools$1, u as toolEnabled, ut as ReflectionRefusedError, v as readVerdicts, y as writeVerdicts } from "./hooks-CcQj_dJo.js";
2
+ import { D as describeWhen, G as commandsOf, O as zoneOf, R as wrongLanguage, T as ClockError, U as COMMANDS_KEY, W as commandFlagKey, c as record, f as MAX_OOC_ANSWER, k as RESULTS, l as characterRunner, mt as AUTHORING_NEEDS, n as installHooks, o as PREVIEW_TOOL, ot as shippedText, p as storesOf, r as externalGiven, s as createTools$1, u as toolEnabled, ut as ReflectionRefusedError, v as readVerdicts, y as writeVerdicts } from "./hooks-DNaDzMjW.js";
3
3
  import { a as childTrace, c as runChild, h as currentTurn, n as childModel, r as childSampling, v as estimateAnswer, y as tokensOf } from "./child-lYYeOwl2.js";
4
- import { _ as referent, a as whereabouts, g as sameWords, n as memoryReflector, r as recordFailure, s as Timelines, t as dueReflection } from "./reflection-CUWG-6Qg.js";
5
- import { B as noAt, H as yesAt, I as announceProblem, L as askYesNo, Rt as INTENT_STATUSES, V as routeVerdicts, m as STANDING_PROMPT, z as modeFor } from "./presets-Bwnrx7p0.js";
4
+ import { _ as referent, a as whereabouts, g as sameWords, n as memoryReflector, r as recordFailure, s as Timelines, t as dueReflection } from "./reflection-4L0Plvct.js";
5
+ import { B as noAt, H as yesAt, I as announceProblem, L as askYesNo, Rt as INTENT_STATUSES, V as routeVerdicts, m as STANDING_PROMPT, z as modeFor } from "./presets-9GzaSELc.js";
6
6
  import { i as translator, r as languageOf } from "./text-CbGQhK1-.js";
7
7
  import { a as liveSettings, n as encodeOutput, v as GATE_SITES } from "./narration-CjB_KwwY.js";
8
- import { S as slug, t as addToLibrary, w as uniqueKey } from "./library-QFL6Z_Nr.js";
9
- import { _ as API_PREFIX } from "./packs-BREPSfHy.js";
10
- import { i as updateImage, r as listGallery, t as describeGalleryImage } from "./gallery-BKh7eu80.js";
11
- import { n as interpretImage, s as presentedFor, t as runImagePresenter } from "./presenter-agent-B49-_iUm.js";
8
+ import { C as slug, T as uniqueKey, t as addToLibrary } from "./library-CIkxhf_R.js";
9
+ import { _ as API_PREFIX } from "./packs-BajKw7S9.js";
10
+ import { i as updateImage, r as listGallery, t as describeGalleryImage } from "./gallery-q7niLtWn.js";
11
+ import { n as interpretImage, s as presentedFor, t as runImagePresenter } from "./presenter-agent-jgtuTwZr.js";
12
12
  import { join } from "node:path";
13
13
  import { existsSync } from "node:fs";
14
14
  import { readdir } from "node:fs/promises";
@@ -1,13 +1,13 @@
1
1
  import { a as chatSessionId } from "./access-CfQWbNZP.js";
2
- import { Bt as loadFactions, C as worldFieldChanges, D as UPDATE_FOLDER, F as editsSince, Ft as LOCATIONS_DIR, G as addressesToFetch, Gt as loadCalendar, I as writeSnapshot, It as loadLocations, Jt as loadCharacters, K as candidateUrls, Lt as ITEMS_DIR, Mt as loadTriggers, Nt as LORE_DIR, O as baseId, P as recordProvenance, Pt as loadLore, Q as writePortrait, Rt as loadItems, S as matchPieces, T as loadWorldParts, W as addressKey, Y as mergeReports, Yt as subfolders, Z as cardCharacter, _t as knowsCharacter, an as authoringChatSessionId, c as importPhase, gt as loadValidatedWorld, i as contextOf, in as authoredWorldOf, jt as TRIGGERS_FILE_NAME, k as cardPieces, q as fetchPictures, qt as CHARACTERS_DIR, s as worldOf, v as editWorldInfo, w as withScratchStory, zt as FACTIONS_DIR } from "./authoring-tools-CdHlvx32.js";
3
- import { Ct as CHARACTER_FILE_NAME, Dt as InvalidEditProblems, Q as IMPORT_FOLDER, St as parseFactionFile, Z as withPlayer, _t as ITEM_FILE_NAME, at as writeChoices, gt as parseLocationFile, ht as LOCATION_FILE_NAME, it as readImportFolder, mt as parseLoreFile, pt as LORE_FILE_NAME, q as writeWorldPrompt, tt as PICTURE_FILE, ut as loadVariables, wt as parseCharacterFile, x as extractStyleFrom, xt as FACTION_FILE_NAME, yt as parseItemFile } from "./presets-Bwnrx7p0.js";
2
+ import { Bt as loadFactions, D as UPDATE_FOLDER, F as editsSince, Ft as LOCATIONS_DIR, G as addressesToFetch, Gt as loadCalendar, I as writeSnapshot, It as loadLocations, Jt as loadCharacters, K as candidateUrls, Lt as ITEMS_DIR, Mt as loadTriggers, Nt as LORE_DIR, O as baseId, P as recordProvenance, Pt as loadLore, Q as writePortrait, Rt as loadItems, S as editWorldInfo, T as loadWorldParts, W as addressKey, Y as mergeReports, Yt as subfolders, Z as cardCharacter, _t as knowsCharacter, an as authoringChatSessionId, b as matchPieces, c as importPhase, gt as loadValidatedWorld, i as contextOf, in as authoredWorldOf, jt as TRIGGERS_FILE_NAME, k as cardPieces, q as fetchPictures, qt as CHARACTERS_DIR, s as worldOf, w as withScratchStory, x as worldFieldChanges, zt as FACTIONS_DIR } from "./authoring-tools-C_l07RYn.js";
3
+ import { Ct as CHARACTER_FILE_NAME, Dt as InvalidEditProblems, Q as IMPORT_FOLDER, St as parseFactionFile, Z as withPlayer, _t as ITEM_FILE_NAME, at as writeChoices, gt as parseLocationFile, ht as LOCATION_FILE_NAME, it as readImportFolder, mt as parseLoreFile, pt as LORE_FILE_NAME, q as writeWorldPrompt, tt as PICTURE_FILE, ut as loadVariables, wt as parseCharacterFile, x as extractStyleFrom, xt as FACTION_FILE_NAME, yt as parseItemFile } from "./presets-9GzaSELc.js";
4
4
  import { l as atomicWrite, n as encodeOutput, u as atomicWriteJson } from "./narration-CjB_KwwY.js";
5
- import { B as loadPlots, F as STORY_LANGUAGES, H as plotReferenceProblems, I as isStoryLanguage, J as formatIssue, L as textLanguage, P as LANGUAGE_NAMES, V as parsePlotsFile, Z as PROMPTS_FOLDER, it as shippedLanguages, lt as InvalidWorldError, pt as WorldNotFoundError, st as AgentUnavailableError, z as PLOTS_FILE_NAME } from "./hooks-CcQj_dJo.js";
5
+ import { B as loadPlots, F as STORY_LANGUAGES, H as plotReferenceProblems, I as isStoryLanguage, J as formatIssue, L as textLanguage, P as LANGUAGE_NAMES, V as parsePlotsFile, Z as PROMPTS_FOLDER, it as shippedLanguages, lt as InvalidWorldError, pt as WorldNotFoundError, q as Reader, st as AgentUnavailableError, z as PLOTS_FILE_NAME } from "./hooks-DNaDzMjW.js";
6
6
  import { i as translator, r as languageOf } from "./text-CbGQhK1-.js";
7
- import { b as mapLimit, h as readImageFileMetadata, u as referenceImagePath } from "./library-QFL6Z_Nr.js";
8
- import { n as readPreset } from "./preset-BqgY1Tz4.js";
9
- import { _ as API_PREFIX, a as packIds, d as packPath, f as readPack, h as PACK_MEDIA_TYPES, l as isPackId } from "./packs-BREPSfHy.js";
10
- import { a as uploadReferenceImage, t as generateReferenceImage } from "./generator-DdZ1-sgv.js";
7
+ import { h as readImageFileMetadata, u as referenceImagePath, x as mapLimit } from "./library-CIkxhf_R.js";
8
+ import { n as readPreset } from "./preset-DWgkcPau.js";
9
+ import { _ as API_PREFIX, a as packIds, d as packPath, f as readPack, h as PACK_MEDIA_TYPES, l as isPackId } from "./packs-BajKw7S9.js";
10
+ import { a as uploadReferenceImage, t as generateReferenceImage } from "./generator-BpjPrvHe.js";
11
11
  import { basename, dirname, extname, isAbsolute, join, relative, resolve, sep } from "node:path";
12
12
  import { existsSync, lstatSync, statSync } from "node:fs";
13
13
  import { randomUUID } from "node:crypto";
@@ -2445,7 +2445,15 @@ async function find(world, kind, key) {
2445
2445
  }
2446
2446
  }
2447
2447
  }
2448
- function serializeDocument(kind, key, value) {
2448
+ function unreadProblem(kind, text, key) {
2449
+ let parsed = false;
2450
+ const { unread, read } = Reader.unreadBy(() => {
2451
+ parsed = formats[kind].parse(text, key).ok;
2452
+ });
2453
+ if (!parsed || unread.length === 0) return void 0;
2454
+ return `${unread.join(", ")} ${unread.length === 1 ? "is" : "are"} not read by anything, so a story would never see ${unread.length === 1 ? "it" : "them"}: put the words in the field that holds them. The fields a ${kind} reads: ${read.join(", ")}`;
2455
+ }
2456
+ function serializeDocument(kind, key, value, options = {}) {
2449
2457
  if (typeof value !== "object" || value === null || Array.isArray(value)) throw new InvalidEditProblems(["document must be a JSON object"]);
2450
2458
  const document = {
2451
2459
  ...value,
@@ -2454,6 +2462,8 @@ function serializeDocument(kind, key, value) {
2454
2462
  const text = `${JSON.stringify(document, null, 2)}\n`;
2455
2463
  const parsed = formats[kind].parse(text, key);
2456
2464
  if (!parsed.ok) throw new InvalidEditProblems(parsed.issues.map(formatIssue));
2465
+ const unread = options.refuseUnread === true ? unreadProblem(kind, text, key) : void 0;
2466
+ if (unread !== void 0) throw new InvalidEditProblems([unread]);
2457
2467
  return text;
2458
2468
  }
2459
2469
  async function readAuthoredEntityDocument(world, kind, key) {
@@ -2461,13 +2471,13 @@ async function readAuthoredEntityDocument(world, kind, key) {
2461
2471
  if (found === void 0) throw new InvalidEditProblems([`there is no ${kind} "${key}"`]);
2462
2472
  return JSON.parse((await readFile(found.file, "utf8")).replace(/^/, ""));
2463
2473
  }
2464
- async function createAuthoredEntity(world, kind, key, document) {
2474
+ async function createAuthoredEntity(world, kind, key, document, options = {}) {
2465
2475
  if (!validNewKey(key)) throw new InvalidEditProblems(["key must be letters (any script), digits, \".\", \"_\" or \"-\", starting with a letter or digit, at most 100 characters (no brackets, spaces or slashes)"]);
2466
2476
  if (await find(world, kind, key) !== void 0) throw new InvalidEditProblems([`the ${kind} "${key}" already exists`]);
2467
2477
  const format = formats[kind];
2468
2478
  const root = join(world.directory, format.directory);
2469
2479
  const folder = join(root, key);
2470
- const text = serializeDocument(kind, key, document);
2480
+ const text = serializeDocument(kind, key, document, options);
2471
2481
  await mkdir(root, { recursive: true });
2472
2482
  await mkdir(folder, { recursive: false });
2473
2483
  try {
@@ -2480,10 +2490,10 @@ async function createAuthoredEntity(world, kind, key, document) {
2480
2490
  throw error;
2481
2491
  }
2482
2492
  }
2483
- async function replaceAuthoredEntity(world, kind, key, document) {
2493
+ async function replaceAuthoredEntity(world, kind, key, document, options = {}) {
2484
2494
  const found = await find(world, kind, key);
2485
2495
  if (found === void 0) throw new InvalidEditProblems([`there is no ${kind} "${key}"`]);
2486
- await atomicWrite(found.file, serializeDocument(kind, key, document));
2496
+ await atomicWrite(found.file, serializeDocument(kind, key, document, options));
2487
2497
  }
2488
2498
  /** Deletions remain recoverable without making the trash visible to the world loaders. */
2489
2499
  async function deleteAuthoredEntity(world, kind, key) {
@@ -2639,4 +2649,4 @@ function registerPackJail(ctx, deps) {
2639
2649
  }
2640
2650
  export { DOCTOR_OPENING_SOURCE as $, worldEntityImageFile as A, languageOfDocuments as B, readWorldEditor as C, uploadWorldCharacterPortrait as D, replaceFile as E, PRESET_FILE as F, revertUpdate as G, findTargets as H, presetMessage as I, AuthoringSessions as J, startUpdate as K, presetTools as L, deleteTriggerDocument as M, readTriggerDocuments as N, uploadWorldEntityImage as O, writeTriggerDocument as P, agentServicesOf as Q, translateMessage as R, generateWorldEntityImage as S, removeWorldTrigger as T, finishUpdate as U, readWorldDocuments as V, pendingUpdate as W, ensureAuthoringChat as X, authoringTitle as Y, AgentSessions as Z, editWorldPlots as _, deleteWorldPackFile as a, entityFolder as b, createAuthoredEntity as c, replaceAuthoredEntity as d, appendEmptyTurn as et, editWorldCharacter as f, editWorldPlace as g, editWorldNarrationVoice as h, checkWorldPack as i, writeWorldTrigger as j, worldCharacterPortraitFile as k, deleteAuthoredEntity as l, editWorldLore as m, packFileProblem as n, listWorldPacks as o, editWorldFaction as p, updateStatus as q, registerPackJail as r, AUTHORED_ENTITY_KINDS as s, MAX_PACK_TEXT as t, appendNarratedTurn as tt, readAuthoredEntityDocument as u, editWorldRelation as v, readWorldTrigger as w, generateWorldCharacterPortrait as x, editWorldThing as y, translateTools as z };
2641
2651
 
2642
- //# sourceMappingURL=pack-jail-BMy6NcCY.js.map
2652
+ //# sourceMappingURL=pack-jail-B35Vx3hT.js.map
@@ -1,4 +1,4 @@
1
- import { q as Reader } from "./hooks-CcQj_dJo.js";
1
+ import { q as Reader } from "./hooks-DNaDzMjW.js";
2
2
  import { dirname, extname, join, posix, sep } from "node:path";
3
3
  import { copyFileSync, cpSync, existsSync, lstatSync, mkdirSync, readFileSync, readdirSync, renameSync } from "node:fs";
4
4
  import { createHash } from "node:crypto";
@@ -836,4 +836,4 @@ function anyTab(bases) {
836
836
  }
837
837
  export { API_PREFIX as _, packIds as a, describePack as c, packPath as d, readPack as f, SURFACE_NAMES as g, PACK_MEDIA_TYPES as h, inheritPacks as i, isPackId as l, PACK_LIMITS as m, anyTab as n, syncWorldPacks as o, PACK_ACTIONS as p, copyWorldPacks as r, worldPackStates as s, activePack as t, packFile as u };
838
838
 
839
- //# sourceMappingURL=packs-BREPSfHy.js.map
839
+ //# sourceMappingURL=packs-BajKw7S9.js.map
@@ -1,8 +1,8 @@
1
1
  import { t as promptFor } from "./access-CfQWbNZP.js";
2
2
  import { c as runChild } from "./child-lYYeOwl2.js";
3
- import { n as generateTransientImage, t as generateReferenceImage } from "./generator-DdZ1-sgv.js";
4
- import { i as updateImage, n as galleryFile, r as listGallery } from "./gallery-BKh7eu80.js";
5
- import { c as nextSceneSerial, u as referenceImagePath } from "./library-QFL6Z_Nr.js";
3
+ import { n as generateTransientImage, t as generateReferenceImage } from "./generator-BpjPrvHe.js";
4
+ import { i as updateImage, n as galleryFile, r as listGallery } from "./gallery-q7niLtWn.js";
5
+ import { c as nextSceneSerial, u as referenceImagePath } from "./library-CIkxhf_R.js";
6
6
  import { dirname, join, relative } from "node:path";
7
7
  import { existsSync } from "node:fs";
8
8
  import { createHash, randomUUID } from "node:crypto";
@@ -846,4 +846,4 @@ async function runImagePresenter(job) {
846
846
  }
847
847
  export { tokensOf as a, searchImages as i, interpretImage as n, present as o, imageTools as r, presentedFor as s, runImagePresenter as t };
848
848
 
849
- //# sourceMappingURL=presenter-agent-B49-_iUm.js.map
849
+ //# sourceMappingURL=presenter-agent-jgtuTwZr.js.map
@@ -1,6 +1,6 @@
1
- import { Zt as ImportCardError, r as MAX_PREVIEW_TEXT } from "./authoring-tools-CdHlvx32.js";
1
+ import { Zt as ImportCardError, r as MAX_PREVIEW_TEXT } from "./authoring-tools-C_l07RYn.js";
2
2
  import { l as SAMPLING_RANGES } from "./child-lYYeOwl2.js";
3
- import { J as cleanText } from "./presets-Bwnrx7p0.js";
3
+ import { J as cleanText } from "./presets-9GzaSELc.js";
4
4
  // src/host/import/preset.ts
5
5
  /** The older preset layout keeps its texts under fixed keys. */
6
6
  const LEGACY_KEYS = [
@@ -239,4 +239,4 @@ function selectPrompts(file, enabled, keepSampling) {
239
239
  }
240
240
  export { readPreset as n, selectPrompts as r, previewPreset as t };
241
241
 
242
- //# sourceMappingURL=preset-BqgY1Tz4.js.map
242
+ //# sourceMappingURL=preset-DWgkcPau.js.map
@@ -1,9 +1,9 @@
1
1
  import "./access-CfQWbNZP.js";
2
- import { G as listWorldPrompts, K as readWorldPrompt, Q as IMPORT_FOLDER, U as PROSE_PROMPTS, W as deleteWorldPrompt, Z as withPlayer, c as presetDirectory, l as readPreset, p as updatePresetInfo, q as writeWorldPrompt, t as PRESET_FILE, x as extractStyleFrom } from "./presets-Bwnrx7p0.js";
3
- import { n as readPreset$1 } from "./preset-BqgY1Tz4.js";
4
- import { i as contextOf } from "./authoring-tools-CdHlvx32.js";
2
+ import { G as listWorldPrompts, K as readWorldPrompt, Q as IMPORT_FOLDER, U as PROSE_PROMPTS, W as deleteWorldPrompt, Z as withPlayer, c as presetDirectory, l as readPreset, p as updatePresetInfo, q as writeWorldPrompt, t as PRESET_FILE, x as extractStyleFrom } from "./presets-9GzaSELc.js";
3
+ import { n as readPreset$1 } from "./preset-DWgkcPau.js";
4
+ import { i as contextOf } from "./authoring-tools-C_l07RYn.js";
5
5
  import { i as translator, r as languageOf } from "./text-CbGQhK1-.js";
6
- import { at as shippedPromptsDirectory, it as shippedLanguages, tt as languageOf$1 } from "./hooks-CcQj_dJo.js";
6
+ import { at as shippedPromptsDirectory, it as shippedLanguages, tt as languageOf$1 } from "./hooks-DNaDzMjW.js";
7
7
  import { join } from "node:path";
8
8
  import { existsSync } from "node:fs";
9
9
  import { readFile, rm } from "node:fs/promises";
@@ -278,4 +278,4 @@ async function presetApproval(exec, next, carries) {
278
278
  }
279
279
  export { presetChatSessionId as a, presetAuthorTools as i, narrationImportMessage as n, presetOfChat as o, presetApproval as r, PresetReader as t };
280
280
 
281
- //# sourceMappingURL=preset-author-tools-BB_Dcv2o.js.map
281
+ //# sourceMappingURL=preset-author-tools-BhuYIKms.js.map
@@ -1,8 +1,8 @@
1
- import { n as limitAuthoringAgents } from "./authoring-tools-CdHlvx32.js";
2
- import { t as guardAuthoringTurns } from "./turn-guard-Bb8Ew-1z.js";
3
- import { i as presetAuthorTools, o as presetOfChat, r as presetApproval, t as PresetReader } from "./preset-author-tools-BB_Dcv2o.js";
4
- import "./hooks-CcQj_dJo.js";
5
- import { c as presetDirectory } from "./presets-Bwnrx7p0.js";
1
+ import { n as limitAuthoringAgents } from "./authoring-tools-C_l07RYn.js";
2
+ import { t as guardAuthoringTurns } from "./turn-guard-sCUXmp-5.js";
3
+ import { i as presetAuthorTools, o as presetOfChat, r as presetApproval, t as PresetReader } from "./preset-author-tools-BhuYIKms.js";
4
+ import "./hooks-DNaDzMjW.js";
5
+ import { c as presetDirectory } from "./presets-9GzaSELc.js";
6
6
  import { join } from "node:path";
7
7
  import { existsSync } from "node:fs";
8
8
  // src/preset-authoring.ts
@@ -1,8 +1,8 @@
1
1
  import { i as VARIABLE_VISIBILITIES, n as VARIABLE_KINDS, r as VARIABLE_SUBJECTS } from "./access-CfQWbNZP.js";
2
2
  import "./narration-CjB_KwwY.js";
3
- import { J as formatIssue, K as readDocument, X as LANGUAGE_FOLDER, Y as errorMessage, Z as PROMPTS_FOLDER, at as shippedPromptsDirectory, it as shippedLanguages, nt as listFiles, q as Reader, rt as promptProblem, tt as languageOf } from "./hooks-CcQj_dJo.js";
3
+ import { J as formatIssue, K as readDocument, X as LANGUAGE_FOLDER, Y as errorMessage, Z as PROMPTS_FOLDER, at as shippedPromptsDirectory, it as shippedLanguages, nt as listFiles, q as Reader, rt as promptProblem, tt as languageOf } from "./hooks-DNaDzMjW.js";
4
4
  import { u as parseSampling } from "./child-lYYeOwl2.js";
5
- import { C as trOf, S as slug, b as mapLimit, w as uniqueKey, x as norm } from "./library-QFL6Z_Nr.js";
5
+ import { C as slug, S as norm, T as uniqueKey, w as trOf, x as mapLimit } from "./library-CIkxhf_R.js";
6
6
  import { dirname, join } from "node:path";
7
7
  import { existsSync, readFileSync, readdirSync } from "node:fs";
8
8
  import { createHash, randomUUID } from "node:crypto";
@@ -2494,6 +2494,15 @@ const objects = (value) => Array.isArray(value) ? value.filter((entry) => typeof
2494
2494
  const put = (document, key, value) => {
2495
2495
  if (value !== void 0 && value !== "" && !(Array.isArray(value) && value.length === 0)) document[key] = value;
2496
2496
  };
2497
+ const normalisedText = /* @__PURE__ */ new WeakMap();
2498
+ const normalised = (item) => {
2499
+ let folded = normalisedText.get(item);
2500
+ if (folded === void 0) {
2501
+ folded = norm(item.text);
2502
+ normalisedText.set(item, folded);
2503
+ }
2504
+ return folded;
2505
+ };
2497
2506
  /** The pieces an entity is made from: the ones about it, then others that name it, within a budget of text. */
2498
2507
  function sourcesFor(entity, items, classified) {
2499
2508
  const names = [entity.name, ...entity.aliases].map(norm).filter((name) => name.length >= MIN_MENTION_CHARS);
@@ -2506,7 +2515,7 @@ function sourcesFor(entity, items, classified) {
2506
2515
  const mentions = items.filter((item) => !taken.has(item.id) && !isLeftOut(classified[item.id] ?? {
2507
2516
  roles: ["world"],
2508
2517
  targets: []
2509
- }) && names.some((name) => norm(item.text).includes(name))).slice(0, MAX_MENTIONS);
2518
+ }) && names.some((name) => normalised(item).includes(name))).slice(0, MAX_MENTIONS);
2510
2519
  const chosen = [];
2511
2520
  let used = 0;
2512
2521
  for (const item of [...tagged, ...mentions]) {
@@ -4001,4 +4010,4 @@ async function createPresetFromGuidance(root, request, guidance, shipped = shipp
4001
4010
  }
4002
4011
  export { ImportNotFoundError as $, sourcesFor as A, parseLoreEdit as At, noAt as B, inert as C, CHARACTER_FILE_NAME as Ct, pruneLoreSubjects as D, InvalidEditProblems as Dt, pruneLinks as E, readIdentifier as Et, isLeftOut as F, LORE_SCOPES as Ft, listWorldPrompts as G, yesAt as H, announceProblem as I, WEEKDAY_NAMES as It, cleanText as J, readWorldPrompt as K, askYesNo as L, DEFAULT_SLOTS as Lt, classifyItems as M, parseRelationEdit as Mt, findEntity as N, parseThingEdit as Nt, pruneMembers as O, parseCharacterEdit as Ot, ROLES as P, LORE_KINDS as Pt, IMPORT_FOLDER as Q, mergeReports as R, INTENT_STATUSES as Rt, extractVariables as S, parseFactionFile as St, pruneKnowledge as T, readVariableValues as Tt, PROSE_PROMPTS as U, routeVerdicts as V, deleteWorldPrompt as W, partsOf as X, itemise as Y, withPlayer as Z, characterDocument as _, ITEM_FILE_NAME as _t, isPresetName as a, writeChoices as at, extractStyle as b, parseSlotsFile as bt, presetDirectory as c, parseAuthoringCommand as ct, savePresetFromWorld as d, parseVariablesFile as dt, ImportStore as et, sha as f, variableProblems as ft, asWritten as g, parseLocationFile as gt, addLore as h, LOCATION_FILE_NAME as ht, deletePreset as i, readImportFolder as it, buildRoster as j, parsePlaceEdit as jt, pruneRelationships as k, parseFactionEdit as kt, readPreset as l, VARIABLES_FILE_NAME as lt, STANDING_PROMPT as m, parseLoreFile as mt, createPresetFromGuidance as n, openingText as nt, listPresets as o, IMPORT_COMMAND as ot, updatePresetInfo as p, LORE_FILE_NAME as pt, writeWorldPrompt as q, createPresetFromShipped as r, parseChoices as rt, loadPreset as s, parseImportCommand as st, PRESET_FILE as t, PICTURE_FILE as tt, reservePreset as u, loadVariables as ut, emptyExtracted as v, SLOTS_FILE_NAME as vt, loreDocuments as w, parseCharacterFile as wt, extractStyleFrom as x, FACTION_FILE_NAME as xt, extractEntities as y, parseItemFile as yt, modeFor as z };
4003
4012
 
4004
- //# sourceMappingURL=presets-Bwnrx7p0.js.map
4013
+ //# sourceMappingURL=presets-9GzaSELc.js.map
@@ -1,10 +1,10 @@
1
1
  import { o as roleplaySessionOf, t as promptFor } from "./access-CfQWbNZP.js";
2
- import { B as noAt, H as yesAt, I as announceProblem, L as askYesNo, R as mergeReports, V as routeVerdicts, f as sha, o as listPresets, s as loadPreset } from "./presets-Bwnrx7p0.js";
3
- import { A as answerLimits, D as describeWhen, E as describeTime, R as wrongLanguage, Z as PROMPTS_FOLDER, et as inheritPrompts } from "./hooks-CcQj_dJo.js";
2
+ import { B as noAt, H as yesAt, I as announceProblem, L as askYesNo, R as mergeReports, V as routeVerdicts, f as sha, o as listPresets, s as loadPreset } from "./presets-9GzaSELc.js";
3
+ import { A as answerLimits, D as describeWhen, E as describeTime, R as wrongLanguage, Z as PROMPTS_FOLDER, et as inheritPrompts } from "./hooks-DNaDzMjW.js";
4
4
  import { i as translator, r as languageOf, t as trimCharacters } from "./text-CbGQhK1-.js";
5
5
  import { a as childTrace, c as runChild, n as childModel, r as childSampling, v as estimateAnswer } from "./child-lYYeOwl2.js";
6
- import { s as inheritImages } from "./library-QFL6Z_Nr.js";
7
- import { i as inheritPacks } from "./packs-BREPSfHy.js";
6
+ import { s as inheritImages } from "./library-CIkxhf_R.js";
7
+ import { i as inheritPacks } from "./packs-BajKw7S9.js";
8
8
  import { dirname, join } from "node:path";
9
9
  import { copyFileSync, existsSync, mkdirSync, readFileSync, renameSync, rmSync, writeFileSync } from "node:fs";
10
10
  import { createUserMessage } from "@deepseek-ai/dsh-llm";
@@ -2028,4 +2028,4 @@ function memoryReflector(deps) {
2028
2028
  }
2029
2029
  export { referent as _, whereabouts as a, readTimeline as c, copyPreset as d, presetStatus as f, sameWords as g, defaultBoundaries as h, reflectionStatus as i, writeTimeline as l, switchPreset as m, memoryReflector as n, TimelineError as o, recordPreset as p, recordFailure as r, Timelines as s, dueReflection as t, pathTo as u };
2030
2030
 
2031
- //# sourceMappingURL=reflection-CUWG-6Qg.js.map
2031
+ //# sourceMappingURL=reflection-4L0Plvct.js.map
@@ -1,5 +1,5 @@
1
1
  import { _ as finishOf, g as cutOff } from "./child-lYYeOwl2.js";
2
- import { d as guardRepeatedCalls } from "./hooks-CcQj_dJo.js";
2
+ import { d as guardRepeatedCalls } from "./hooks-DNaDzMjW.js";
3
3
  import { ReasoningEffortId, createUserMessage } from "@deepseek-ai/dsh-llm";
4
4
  // src/host/authoring/turn-guard.ts
5
5
  /**
@@ -49,4 +49,4 @@ function guardAuthoringTurns(ctx, prompts, languageOf, reasoning = () => "") {
49
49
  }
50
50
  export { guardAuthoringTurns as t };
51
51
 
52
- //# sourceMappingURL=turn-guard-Bb8Ew-1z.js.map
52
+ //# sourceMappingURL=turn-guard-sCUXmp-5.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dsh-agentic-roleplay/core",
3
- "version": "0.9.0",
3
+ "version": "0.9.1",
4
4
  "description": "Core plugin of the agentic roleplay bundle for DeepSeek Harness: roleplay UI, orchestration and storage.",
5
5
  "author": {
6
6
  "name": "Firefox2100",
@@ -76,7 +76,7 @@
76
76
  "@deepseek-ai/schemastery": "^3.18.5"
77
77
  },
78
78
  "dependencies": {
79
- "@dsh-agentic-roleplay/state": "0.9.0",
79
+ "@dsh-agentic-roleplay/state": "0.9.1",
80
80
  "@dsh-ai-providers/core": "^0.5.0"
81
81
  },
82
82
  "devDependencies": {
@@ -0,0 +1 @@
1
+ Two background entries of a story world are given. Find whether they say things that cannot both be true at the same time (different dates for one event, different causes, a person alive in one and dead in the other, a place in two incompatible spots). Details that only add to each other, statements about different times, and the differing beliefs of different people are not conflicts. If they conflict, answer conflict true and quote, exactly as written, the passage of the first entry and the passage of the second that rule each other out, and say in a sentence why. If not, answer conflict false with empty quotes. Never conclude a conflict you cannot quote. A title or heading is not a statement, and two entries with similar titles are not in conflict for that reason; quote the clauses that disagree.
@@ -0,0 +1 @@
1
+ Two background entries of a story world are given below. Do they say things that cannot both be true at the same time: two different dates for one event, two different causes, a person alive in one and dead in the other, a place in two incompatible spots? They do not conflict when one only adds detail to the other, when they speak of different times, or when they are two people's differing beliefs. Answer yes only when you can point to a statement in each that rules out the other, and give the reason in a sentence.
@@ -0,0 +1 @@
1
+ A passage of a source card and a document of a story world are given. Does the document say what the passage says: the same facts, in any wording or language? A document that only mentions the same person or place without stating the passage's facts does not. A document that states most of the passage's facts, in other words, does. Answer yes when the document says it, and give the reason in a sentence.
@@ -0,0 +1 @@
1
+ A person is about to start a story as the character described below. Read the opening and the first scene: where the character is, who and what is there, what the character is doing or wants. Is it enough for the person to know where they are and to have something to do, a person to talk to, a problem to face or a want to follow, for the first move? It is not enough when the opening is missing or only sets a mood, when nothing in the place invites action, or when it is unclear who the player is. Answer yes when it is enough, and give the reason in a sentence.
@@ -0,0 +1 @@
1
+ Two entries of a story world are described below, of the same kind (character, place, organisation or thing). Are they the same one, written twice under different names or wordings, so that the world has a copy of something it already has? They are when the sheets describe the same person, place, group or object, even if the names differ or one is shorter. They are not when they are two different ones that merely resemble each other: siblings, rivals, two guards, two rooms of one building, a place and a part of it. A place inside a larger place (a station in a region, a district of a city, a room of a building) is not the same as the larger one. The entries are labelled A and B: say in the reason what A is and what B is. Answer yes when they are one, and give the reason in a sentence.
@@ -0,0 +1 @@
1
+ Two values a story keeps track of are described below, each with its name, key and what it means. Do they measure the same thing, so that keeping both would record one fact twice and let the two drift apart? They do when one is another name, abbreviation or translation of the other (health and hit points, gold and coins). They do not when they are related but different (health and stamina, trust and affection, hunger and thirst), or measure the same thing for different subjects. Answer yes when they are the same value, and give the reason in a sentence.
@@ -1,3 +1,3 @@
1
- The person ran ${command} (what they added: ${request}). Run the checks of this world with ${tools} and read every finding it returns.
2
- Then act on them as a careful editor. Fix what is plainly wrong with your editing tools, one fix at a time; each edit asks the person as usual. Where a finding needs a choice (which of two duplicates to keep, what a missing thing should be), ask before changing anything. Leave what is acceptable as it is and say why. Do not invent facts to fill a gap; if the world's card is kept, read it (card_read, card_search) first. If a tool says the world has no card, skip it and say so instead of guessing what the card held. A finding that compares with the card is a pointer, not a verdict: read the piece with card_read before you change anything. Start with the quick checks. Call a tool with deep true when the request says deep or thorough, when the quick findings suggest the world is thin, or to confirm an import: that is where a model compares and judges, so it takes longer.
1
+ The person ran ${command} (what they added: ${request}). Run the checks of this world with ${tools} now, even if you ran them earlier in this chat (the world may have changed, and what you remember of a result is not a result), and read every finding it returns.
2
+ Then act on them as a careful editor: every finding gets a fix, a question to the person, or a stated reason to leave it; none is skipped. Fix what is plainly wrong with your editing tools, one fix at a time; each edit asks the person as usual. Where a finding needs a choice (which of two duplicates to keep, what a missing thing should be), ask before changing anything. Leave what is acceptable as it is and say why. Do not invent facts to fill a gap; if the world's card is kept, read it (card_read, card_search) first. If a tool says the world has no card, skip it and say so instead of guessing what the card held. A finding that compares with the card is a pointer, not a verdict: read the piece with card_read before you change anything. Start with the quick checks. Call a tool with deep true when the request says deep or thorough, when the quick findings suggest the world is thin, or to confirm an import: that is where a model compares and judges, so it takes longer.
3
3
  After your fixes run the same tool again and check that what you fixed is gone and nothing new appeared. Then tell the person in a few short sentences how many findings there were by severity, what you changed, and what is left and why. Then stop.
@@ -0,0 +1 @@
1
+ 下面给出故事世界的两条背景条目。判断它们说的事情能否同时成立(同一件事的不同日期、不同起因,一个人在一条里活着而在另一条里已死,一个地方处于两个互不相容的位置)。只是互相补充的细节、关于不同时间的陈述、不同人的不同看法,都不算冲突。如果冲突,就把 conflict 填 true,并逐字引用第一条和第二条中互相排斥的那两段原文,再用一句话说明原因。如果不冲突,conflict 填 false,两个引文留空。不能引用出来的冲突,不要下结论。标题或小标题不是陈述;两个条目标题相近,不构成冲突;请引用互相矛盾的那几句话。
@@ -0,0 +1 @@
1
+ 下面给出故事世界的两条背景条目。它们说的事情能同时成立吗?例如同一件事有两个不同的日期、两种不同的起因,一个人在一条里活着而在另一条里已死,一个地方处于两个互不相容的位置。一条只是给另一条补充细节、说的是不同时间、或者是两个人各自不同的看法时,不算冲突。只有当你能指出两条里各有一句话互相排斥时才回答是,并用一句话说明理由。
@@ -0,0 +1 @@
1
+ 下面给出来源卡片的一段文字和故事世界的一份文档。文档说出了这段文字所说的内容吗?即相同的事实,不论措辞或语言。文档只是提到同一个人或地点、却没有陈述这段文字的事实,不算。文档用别的说法陈述了这段文字的大部分事实,则算。文档说了就回答是,并用一句话说明理由。
@@ -0,0 +1 @@
1
+ 有人即将以下面描述的角色开始一个故事。请读开场白和第一个场景:角色在哪里,那里有谁、有什么,角色正在做什么或想要什么。对这个人来说,这些够不够让他知道自己身在何处,并为第一步找到事做——一个可以交谈的人、一个要面对的问题,或一个可以追随的愿望?不够,是指开场白缺失或只渲染气氛、地点里没有任何东西引人行动,或者看不出玩家是谁。足够就回答是,并用一句话说明理由。
@@ -0,0 +1 @@
1
+ 下面描述了故事世界里同一类(角色、地点、组织或物品)的两个条目。它们是同一个,只是用不同的名称或说法写了两遍吗?也就是世界里是否有一份已有内容的副本。两份描述的是同一个人、地点、团体或物品,即使名称不同或其中一个更短,就是同一个。只是彼此相像的两个不同条目则不是:兄弟姐妹、对手、两名守卫、同一栋楼里的两个房间、一个地方和它的一部分。位于更大地点之内的地方(区域中的一座站点、城市的一个街区、建筑里的一个房间)与那个更大的地点不是同一个。条目分别标为 A 和 B:请在理由里说明 A 是什么、B 是什么。是同一个就回答是,并用一句话说明理由。
@@ -0,0 +1 @@
1
+ 下面描述了故事要记录的两个数值,各有名称、键和含义。它们衡量的是同一件事吗?也就是说,两个都保留会把同一个事实记两遍,并且两者会渐渐不一致。一个是另一个的别名、缩写或译名时(生命值和体力点数、金币和钱币),它们就是同一件事。相关但不同时(生命和耐力、信任和好感、饥饿和口渴),或者衡量的是不同对象的同一件事时,则不是。是同一个数值就回答是,并用一句话说明理由。