@dsh-agentic-roleplay/core 0.10.2 → 0.11.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 (43) hide show
  1. package/lib/{access-CXtaZNbx.js → access-Md1YTSX1.js} +4 -1
  2. package/lib/{authoring-tools-C9cmcUbD.js → authoring-tools-BFdw7ahj.js} +72 -9
  3. package/lib/authoring.js +38 -8
  4. package/lib/client.js +777 -427
  5. package/lib/client.js.map +1 -1
  6. package/lib/compaction.js +2 -2
  7. package/lib/doctor.js +3 -3
  8. package/lib/{gallery-CtG-bDzz.js → gallery-BWHmjogd.js} +3 -3
  9. package/lib/{generator-nLoPM5MF.js → generator-QCdm8nUh.js} +9 -3
  10. package/lib/helper.js +9 -0
  11. package/lib/{hooks-BpLN_hhT.js → hooks-C2U1-8ur.js} +709 -67
  12. package/lib/images.js +4 -4
  13. package/lib/index.js +225 -19
  14. package/lib/{library-CH-ahlm0.js → library-4zmCAshR.js} +3 -3
  15. package/lib/{lorebook-author-tools-Cg7QQemi.js → lorebook-author-tools-Bjfjt3bg.js} +7 -7
  16. package/lib/lorebook-authoring.js +4 -4
  17. package/lib/{narration-B0hConSw.js → narration-b_VBEUWn.js} +7 -3
  18. package/lib/orchestration.js +338 -28
  19. package/lib/{pack-jail-D5j5mIq6.js → pack-jail-Ci9bIeDI.js} +25 -15
  20. package/lib/{packs-Cc05FrId.js → packs-CYkozh8Q.js} +2 -2
  21. package/lib/{presenter-agent-UKbKYXMO.js → presenter-agent-CqkAL03Q.js} +10 -7
  22. package/lib/{preset-Be4lz6vB.js → preset-B-35yUmt.js} +3 -3
  23. package/lib/{preset-author-tools-C3s0iSfv.js → preset-author-tools-BUymqZM5.js} +7 -7
  24. package/lib/preset-authoring.js +5 -5
  25. package/lib/{presets-Cl9sU3Qs.js → presets-_U-xroo0.js} +27 -8
  26. package/lib/{reflection-I9z-PvFK.js → reflection-B9N0z3KY.js} +9 -608
  27. package/lib/{text-CzqhC8sT.js → text-C2AGl7Je.js} +11 -2
  28. package/lib/{turn-guard-B9pGCeir.js → turn-guard-C0M3rXEN.js} +10 -10
  29. package/package.json +33 -32
  30. package/prompts/en/import/variables.md +1 -0
  31. package/prompts/en/roleplay/character-decide.md +1 -1
  32. package/prompts/en/roleplay/decide-reuse.md +3 -0
  33. package/prompts/en/roleplay/decide-variable.md +1 -0
  34. package/prompts/en/roleplay/image-presenter.md +1 -0
  35. package/prompts/en/roleplay/track-values.md +1 -0
  36. package/prompts/en/roleplay/track-variables.md +1 -0
  37. package/prompts/zh/import/variables.md +1 -0
  38. package/prompts/zh/roleplay/character-decide.md +1 -1
  39. package/prompts/zh/roleplay/decide-reuse.md +3 -0
  40. package/prompts/zh/roleplay/decide-variable.md +1 -0
  41. package/prompts/zh/roleplay/image-presenter.md +1 -0
  42. package/prompts/zh/roleplay/track-values.md +1 -0
  43. package/prompts/zh/roleplay/track-variables.md +1 -0
@@ -1,14 +1,14 @@
1
- import { c as chatSessionId, l as roleplaySessionOf, t as promptFor } from "./access-CXtaZNbx.js";
2
- import { B as COMMANDS_KEY, H as commandsOf, P as wrongLanguage, T as RESULTS, V as commandFlagKey, c as record, dt as ClockError, f as MAX_OOC_ANSWER, ht as AUTHORING_NEEDS, l as characterRunner, mt as zoneOf, n as installHooks, o as PREVIEW_TOOL, p as storesOf, pt as describeWhen, r as externalGiven, rt as shippedText, s as createTools$1, st as ReflectionRefusedError, u as toolEnabled, v as readVerdicts, y as writeVerdicts } from "./hooks-BpLN_hhT.js";
1
+ import { c as chatSessionId, l as roleplaySessionOf, t as promptFor } from "./access-Md1YTSX1.js";
2
+ import { D as referent, E as sameWords, H as COMMANDS_KEY, I as wrongLanguage, O as RESULTS, U as commandFlagKey, W as commandsOf, at as shippedText, c as record, f as MAX_OOC_ANSWER, gt as AUTHORING_NEEDS, ht as zoneOf, l as characterRunner, lt as ReflectionRefusedError, mt as describeWhen, n as installHooks, o as PREVIEW_TOOL, p as storesOf, pt as ClockError, r as externalGiven, s as createTools$1, u as toolEnabled, v as readVerdicts, y as writeVerdicts } from "./hooks-C2U1-8ur.js";
3
3
  import { E as tokensOf, S as currentTurn, T as estimateAnswer, a as childTrace, l as runChild, n as childModel, r as childSampling } from "./child-C9nPIy9j.js";
4
- import { a as whereabouts, m as referent, n as memoryReflector, p as sameWords, r as recordFailure, s as Timelines, t as dueReflection } from "./reflection-I9z-PvFK.js";
5
- import { B as modeFor, H as routeVerdicts, L as announceProblem, R as askYesNo, U as yesAt, V as noAt, Vt as INTENT_STATUSES, m as STANDING_PROMPT } from "./presets-Cl9sU3Qs.js";
6
- import { i as translator, r as languageOf } from "./text-CzqhC8sT.js";
7
- import { a as liveSettings, g as GATE_SITES, n as encodeOutput } from "./narration-B0hConSw.js";
8
- import { C as slug, T as uniqueKey, t as addToLibrary } from "./library-CH-ahlm0.js";
9
- import { _ as API_PREFIX } from "./packs-Cc05FrId.js";
10
- import { i as updateImage, r as listGallery, t as describeGalleryImage } from "./gallery-CtG-bDzz.js";
11
- import { n as interpretImage, s as presentedFor, t as runImagePresenter } from "./presenter-agent-UKbKYXMO.js";
4
+ import { a as whereabouts, n as memoryReflector, r as recordFailure, s as Timelines, t as dueReflection } from "./reflection-B9N0z3KY.js";
5
+ import { B as modeFor, H as routeVerdicts, Ht as INTENT_STATUSES, L as announceProblem, Lt as guarded, R as askYesNo, U as yesAt, V as noAt, m as STANDING_PROMPT } from "./presets-_U-xroo0.js";
6
+ import { i as translator, r as languageOf } from "./text-C2AGl7Je.js";
7
+ import { a as liveSettings, g as GATE_SITES, n as encodeOutput } from "./narration-b_VBEUWn.js";
8
+ import { C as slug, T as uniqueKey, t as addToLibrary } from "./library-4zmCAshR.js";
9
+ import { _ as API_PREFIX } from "./packs-CYkozh8Q.js";
10
+ import { i as updateImage, r as listGallery, t as describeGalleryImage } from "./gallery-BWHmjogd.js";
11
+ import { c as presentedFor, i as findImages, n as interpretImage, s as present, t as runImagePresenter } from "./presenter-agent-CqkAL03Q.js";
12
12
  import { join } from "node:path";
13
13
  import { InvalidEditError, characterKey, createDiceTools, createTools, dayPart, describeDuration, describeHolder, describeInstant, describeValue, itemKey, judgedStatements, lintWorld, localTime, locationKey, mentioned, parseRecordsEdit, rollForCheck, sessionDatabase, sessionFolder, systemRoller } from "@dsh-agentic-roleplay/state";
14
14
  import { existsSync } from "node:fs";
@@ -396,11 +396,13 @@ function promptOf(job) {
396
396
  ].join("\n");
397
397
  }
398
398
  /** Offers the player what to do next from what they just read, with an agent of its own, in the background of the story. */
399
+ /** The first `count` lines, tidied. */
400
+ const wanted = (options, count) => tidySuggestions(options).slice(0, count);
399
401
  function suggestionWriter(deps) {
400
402
  return { async suggest(job, signal) {
401
403
  const parent = deps.agentOf(job.chat);
402
404
  if (parent === void 0) throw new Error(`no agent for chat ${job.chat}`);
403
- return (await runChild({
405
+ const result = await runChild({
404
406
  parent,
405
407
  signal,
406
408
  reasoningEffort: job.store.settings().reasoning.children,
@@ -411,12 +413,14 @@ function suggestionWriter(deps) {
411
413
  persona: promptFor(parent, "roleplay/suggester", job.store.settings().prompts.language, { max: 200 }),
412
414
  prompt: promptOf(job),
413
415
  result: RESULT$3,
416
+ structured: true,
414
417
  beforeSubmit: (value) => {
415
- const problems = suggestionProblems(tidySuggestions(value.options), job.count);
418
+ const problems = suggestionProblems(wanted(value.options, job.count), job.count);
416
419
  return problems.length === 0 ? void 0 : `not acceptable: ${problems.join("; ")}`;
417
420
  },
418
421
  maxCalls: 3
419
- })).options;
422
+ });
423
+ return wanted(result.options, job.count);
420
424
  } };
421
425
  }
422
426
  // src/host/triggers/judge.ts
@@ -462,7 +466,7 @@ function sceneOf(job) {
462
466
  cast: job.store.cast().map((member) => `${member.character.name}${member.place === void 0 ? "" : ` (at ${member.place.location.name})`}${member.state === void 0 ? "" : `: ${[member.state.publicState, member.state.activity].filter((text) => text !== "").join("; ")}`}`)
463
467
  };
464
468
  }
465
- function brief$1(scene, statements) {
469
+ function brief$2(scene, statements) {
466
470
  return [
467
471
  "Statements to judge:",
468
472
  ...statements.map((statement, index) => `${index + 1}. ${statement}`),
@@ -506,7 +510,7 @@ function triggerJudge(deps) {
506
510
  ...childModel(settings, "records"),
507
511
  trace: childTrace(store, "records", "trigger judge"),
508
512
  persona: promptFor(parent, "roleplay/trigger-judge", settings.prompts.language),
509
- prompt: brief$1(scene, subset),
513
+ prompt: brief$2(scene, subset),
510
514
  result: RESULT$2,
511
515
  beforeSubmit: (value) => {
512
516
  const numbers = value.verdicts.map((verdict) => verdict.number);
@@ -753,6 +757,194 @@ async function secretFindings(job, decisions, service, seen, signal, say) {
753
757
  message: `the output may give away what ${job.player === "" ? "the player's character" : job.player} does not know yet (${titles.join("; ")}): show only what can be seen or heard, and let the rest be learned in the story; if this is meant to be revealed now, deliver it again unchanged`
754
758
  }];
755
759
  }
760
+ // src/host/variables/tracker.ts
761
+ /** How far below the threshold a probability may fall and still be not sure: the same band as the other checks of what happened. */
762
+ const BAND = .15;
763
+ /** What the models are shown of the turn, in characters: enough for what happened, never the whole story. */
764
+ const NARRATION_CHARS = 2400;
765
+ const DEEDS_CHARS = 2400;
766
+ /** One true-or-false for each key, named by the key: a list of {key, changed} was written by the server with `changed` before `key` (alphabetical), so the answer came before the question and was no for all of them. */
767
+ const verdictSchema = (keys) => ({
768
+ type: "object",
769
+ properties: Object.fromEntries(keys.map((key) => [key, { type: "boolean" }])),
770
+ required: [...keys],
771
+ additionalProperties: false
772
+ });
773
+ /** The new value of each changed key, typed by what the value is: a free choice of types let the model write a number as text, which the story refused. */
774
+ const valuesSchema = (items) => ({
775
+ type: "object",
776
+ properties: Object.fromEntries(items.map((item) => {
777
+ const { variable } = item;
778
+ if (variable.kind === "flag") return [item.key, { type: "boolean" }];
779
+ if (variable.kind === "choice") return [item.key, {
780
+ type: "string",
781
+ enum: [...variable.options]
782
+ }];
783
+ return [item.key, { type: variable.integer ? "integer" : "number" }];
784
+ })),
785
+ required: items.map((item) => item.key),
786
+ additionalProperties: false
787
+ });
788
+ const shown = (value) => typeof value === "boolean" ? value ? "true" : "false" : String(value);
789
+ /**
790
+ * The values to look at after a turn: every value the world declared (not the built-in feelings, which the characters' own answers carry) for the world and for the player's character and the
791
+ * characters the turn names (`scene` is what it said), where it applies.
792
+ */
793
+ function trackedItems(store, scene = "") {
794
+ const { variables } = store.story;
795
+ const cast = store.cast().filter((member) => member.character.control === "player" || scene.toLowerCase().includes(member.character.name.toLowerCase())).map((member) => ({
796
+ key: member.key,
797
+ name: member.character.name,
798
+ id: member.character.id
799
+ }));
800
+ return variables.defs().filter((def) => !def.builtin).flatMap((def) => {
801
+ return (def.subject === "world" ? [{
802
+ key: "world",
803
+ name: "",
804
+ id: 0
805
+ }] : def.subject === "character" ? cast : []).filter((subject) => variables.applies(def, def.subject, subject.id)).map((subject) => ({
806
+ key: `${def.key}:${subject.key}`,
807
+ variable: def,
808
+ subject: {
809
+ key: subject.key,
810
+ name: subject.name
811
+ },
812
+ value: variables.value(def.key, def.subject, subject.id)
813
+ }));
814
+ });
815
+ }
816
+ /** How the value changes, as the world says it, with the space that sets it apart from the description; nothing when the world gives no rule. */
817
+ const ruleOf = (def, tr) => def.update.trim() === "" ? "" : ` ${tr("Changes: {rule}", { rule: def.update.trim() })}`;
818
+ const ownerOf = (item, tr) => item.subject.key === "world" ? tr("the story") : item.subject.name;
819
+ function question(store, item, tr) {
820
+ return store.text("roleplay/decide-variable", {
821
+ subject: ownerOf(item, tr),
822
+ name: item.variable.name,
823
+ description: item.variable.description,
824
+ update: ruleOf(item.variable, tr),
825
+ value: shown(item.value)
826
+ });
827
+ }
828
+ /** What the language model is told of the turn, then the values it is asked about. */
829
+ function brief$1(job, items, tr, heading) {
830
+ const range = (def) => def.kind === "number" ? ` (${def.min ?? "…"} to ${def.max ?? "…"}${def.integer ? ", whole numbers" : ""})` : def.kind === "choice" ? ` (${def.options.join(", ")})` : "";
831
+ return [
832
+ job.input.trim() === "" ? void 0 : `${tr("What the player wrote:")}\n${job.input.slice(0, NARRATION_CHARS)}`,
833
+ `${tr("What the characters did and said:")}\n${job.deeds.join("\n").slice(0, DEEDS_CHARS)}`,
834
+ `${tr("What the player read:")}\n${job.narration.slice(0, NARRATION_CHARS)}`,
835
+ `${heading}\n${items.map((item) => `- ${item.key}: ${ownerOf(item, tr)}, ${item.variable.name}${range(item.variable)}. ${item.variable.description}${ruleOf(item.variable, tr)} ${tr("Now: {value}.", { value: shown(item.value) })}`).join("\n")}`
836
+ ].filter((part) => part !== void 0).join("\n\n");
837
+ }
838
+ /**
839
+ * Looks at the values the story tracks after each turn (`decisions.variables`): one question for each value and each person it applies to, whether what happened changed it, put to the
840
+ * language model, the decision model or both as the setting says; the language model then gives the new value of those that did. The game master changes a value only when it thinks of
841
+ * it; this makes sure every value is looked at. A failure is reported and leaves the values as they were.
842
+ */
843
+ function variableTracker(deps) {
844
+ const seen = /* @__PURE__ */ new Map();
845
+ return { async track(job, signal) {
846
+ const settings = job.store.settings();
847
+ const mode = settings.decisions.variables;
848
+ if (mode === "off") return 0;
849
+ const items = trackedItems(job.store, `${job.input}\n${job.deeds.join("\n")}\n${job.narration}`);
850
+ if (items.length === 0) return 0;
851
+ const parent = deps.agentOf(job.chat);
852
+ const tr = translator(languageOf(settings.prompts.language));
853
+ const byKey = new Map(items.map((item) => [item.key, item]));
854
+ const personaOf = (id) => parent === void 0 ? job.store.text(id) : promptFor(parent, id, settings.prompts.language);
855
+ const ask = async (persona, prompt, result, answers, label) => {
856
+ if (deps.ask !== void 0) return await deps.ask({
857
+ persona,
858
+ prompt,
859
+ result,
860
+ label
861
+ });
862
+ if (parent === void 0) throw new Error(`no agent for chat ${job.chat}`);
863
+ return await runChild({
864
+ parent,
865
+ signal,
866
+ reasoningEffort: settings.reasoning.children,
867
+ sampling: childSampling(settings, "records", estimateAnswer(Array.from({ length: answers }, () => 40), settings.prompts.language)),
868
+ ...childModel(settings, "records"),
869
+ trace: childTrace(job.store, "records", label),
870
+ turn: job.turn,
871
+ structured: true,
872
+ persona,
873
+ prompt,
874
+ result,
875
+ maxCalls: 2
876
+ });
877
+ };
878
+ try {
879
+ const routed = await routeVerdicts({
880
+ mode,
881
+ yesAt: settings.decisions.gateThreshold,
882
+ noAt: Math.max(0, settings.decisions.gateThreshold - BAND),
883
+ turn: job.turn,
884
+ keys: items.map((item) => item.key),
885
+ what: (key) => `${byKey.get(key).variable.name}: ${byKey.get(key).subject.name}`,
886
+ probabilities: async (keys) => {
887
+ const service = deps.decisions?.();
888
+ if (service === void 0) throw new Error("no decision service is selected, or the selected one is not loaded");
889
+ const state = {
890
+ happened: job.deeds.join("\n").slice(0, DEEDS_CHARS),
891
+ narration: job.narration.slice(0, NARRATION_CHARS),
892
+ ...job.input.trim() === "" ? {} : { player_wrote: job.input }
893
+ };
894
+ return await askYesNo(service, state, keys.map((key) => ({
895
+ key,
896
+ instructions: question(job.store, byKey.get(key), tr)
897
+ })), signal);
898
+ },
899
+ llm: async (keys) => {
900
+ const asked = keys.map((key) => byKey.get(key));
901
+ const answer = await ask(personaOf("roleplay/track-variables"), brief$1(job, asked, tr, tr("The values to look at:")), verdictSchema(keys), asked.length, "tracked values");
902
+ return new Map(keys.map((key) => [key, answer[key] === true]));
903
+ }
904
+ }, signal);
905
+ announceProblem(seen, `${job.chat}:variables`, routed.report, deps.problem);
906
+ job.store.recordDecisions?.("variables", routed.report);
907
+ const changed = items.filter((item) => routed.verdicts.get(item.key) === true);
908
+ if (changed.length === 0) return 0;
909
+ const answer = await ask(personaOf("roleplay/track-values"), brief$1(job, changed, tr, tr("The values that changed, to be given a new value:")), valuesSchema(changed), changed.length, "new values");
910
+ let set = 0;
911
+ const made = [];
912
+ for (const item of changed) {
913
+ const change = {
914
+ key: item.key,
915
+ to: answer[item.key]
916
+ };
917
+ if (change.to === void 0 || change.to === item.value) continue;
918
+ try {
919
+ job.store.story.edit({
920
+ turn: job.turn,
921
+ variableChanges: [{
922
+ variable: item.variable.key,
923
+ subject: item.subject.key,
924
+ to: change.to
925
+ }]
926
+ });
927
+ set += 1;
928
+ made.push({
929
+ key: item.key,
930
+ from: shown(item.value),
931
+ to: shown(change.to)
932
+ });
933
+ } catch (error) {
934
+ deps.problem?.(`the tracked value ${item.key} of turn ${job.turn} was not set to ${shown(change.to)}: ${error instanceof Error ? error.message : String(error)}`);
935
+ }
936
+ }
937
+ if (made.length > 0) try {
938
+ job.store.recordTrace?.(job.turn, { tracked: made });
939
+ } catch {}
940
+ return set;
941
+ } catch (error) {
942
+ if (signal.aborted) throw error;
943
+ deps.problem?.(`the tracked values of turn ${job.turn} could not be looked at: ${error instanceof Error ? error.message : String(error)}`);
944
+ return 0;
945
+ }
946
+ } };
947
+ }
756
948
  // src/host/factions/strategist.ts
757
949
  const LAST_KEY = "strategy.last";
758
950
  const DAY_MS = 864e5;
@@ -1514,6 +1706,7 @@ function createCheckNarrateTool(deps) {
1514
1706
  if (check === void 0) throw new Error(`there is no check "${args.check}"; list_checks shows the story's checks`);
1515
1707
  const problem = deps.engine.soloCheckProblem(owner, args.character);
1516
1708
  if (problem !== void 0) throw new Error(problem);
1709
+ deps.engine.withoutPreview(owner);
1517
1710
  const given = {
1518
1711
  succeeded: args.on_success,
1519
1712
  partial: args.on_partial,
@@ -1727,10 +1920,12 @@ var AfterTurnJobs = class {
1727
1920
  judging = /* @__PURE__ */ new Set();
1728
1921
  reflecting = /* @__PURE__ */ new Set();
1729
1922
  casting = /* @__PURE__ */ new Set();
1923
+ tracking = /* @__PURE__ */ new Set();
1730
1924
  constructor(deps) {
1731
1925
  this.deps = deps;
1732
1926
  }
1733
- start(owner, cancel) {
1927
+ start(owner, cancel, facts) {
1928
+ if (facts !== void 0) this.trackVariables(owner, cancel, facts);
1734
1929
  this.consolidate(owner, cancel);
1735
1930
  this.strategize(owner, cancel);
1736
1931
  this.judge(owner, cancel);
@@ -1738,6 +1933,24 @@ var AfterTurnJobs = class {
1738
1933
  const reason = this.reflectionDue(owner);
1739
1934
  if (reason !== void 0) this.reflect(owner, reason, cancel);
1740
1935
  }
1936
+ /** The values the story tracks are looked at once the turn is over, and set when what happened changed them. */
1937
+ trackVariables(owner, cancel, facts) {
1938
+ const store = this.deps.stores(owner.chat);
1939
+ if (store === void 0 || store.settings().decisions.variables === "off" || this.tracking.has(owner.chat)) return;
1940
+ this.tracking.add(owner.chat);
1941
+ this.deps.track(owner.chat, this.deps.boundaries().variableTracker.track({
1942
+ chat: owner.chat,
1943
+ turn: owner.turn,
1944
+ store,
1945
+ ...facts
1946
+ }, cancel).then((set) => {
1947
+ if (set > 0) this.deps.written(owner.chat);
1948
+ }).catch((error) => {
1949
+ if (!cancel.aborted) this.deps.problem(`the tracked values were not looked at: ${messageOf(error)}`);
1950
+ }).finally(() => {
1951
+ this.tracking.delete(owner.chat);
1952
+ }));
1953
+ }
1741
1954
  /** Whether a reflection is running for the chat. */
1742
1955
  isReflecting(chat) {
1743
1956
  return this.reflecting.has(chat);
@@ -1999,9 +2212,23 @@ function checkOutcomes(attempt, outcomes, store, player, decreed, state) {
1999
2212
  ...outcomes.flatMap((outcome) => store.checkVariableChanges(outcome.variableChanges ?? []).map((problem) => `${outcome.character}: ${problem}`)),
2000
2213
  ...state === void 0 ? [] : rollProblems(outcomes, store, state)
2001
2214
  ];
2002
- if (problems.length > 0) throw new Error(`the outcomes are not acceptable: ${problems.join("; ")} (expected exactly: ${expected.join(", ")})`);
2215
+ if (problems.length > 0) throw new Error(`the outcomes are not acceptable: ${problems.join("; ")} ${expected.length === 0 ? "" : ` (expected exactly: ${expected.join(", ")})`}`);
2003
2216
  for (const outcome of outcomes) if (outcome.roll !== void 0) state?.cited.add(outcome.roll);
2004
2217
  }
2218
+ /** An outcome that gives a rolled-for character the dice's own result but leaves out the citation is mended, not refused: the model was seen to resend the same call nine times while naming the missing field. */
2219
+ function mendRolls(outcomes, store, state) {
2220
+ if (outcomes.every((outcome) => outcome.roll !== void 0)) return outcomes;
2221
+ const open = store.story.dice.rolls({ turn: state.turn }).filter((roll) => roll.readout !== void 0 && roll.character !== void 0 && !state.cited.has(roll.id) && !outcomes.some((outcome) => outcome.roll === roll.id));
2222
+ return outcomes.map((outcome) => {
2223
+ if (outcome.roll !== void 0) return outcome;
2224
+ const own = open.filter((roll) => roll.character === outcome.character);
2225
+ const [only] = own;
2226
+ return own.length === 1 && only?.readout?.result === outcome.result ? {
2227
+ ...outcome,
2228
+ roll: only.id
2229
+ } : outcome;
2230
+ });
2231
+ }
2005
2232
  /**
2006
2233
  * Why an outcome does not follow the dice, if it does not. A roll decides what it was rolled for: the result of the outcome is the roll's own, a roll serves one outcome,
2007
2234
  * and a character a check was rolled for cannot be given an outcome without it.
@@ -2888,6 +3115,7 @@ var TurnEngine = class {
2888
3115
  async resolve(owner, outcomes, run, signal, elapsedSeconds) {
2889
3116
  const state = this.stateFor(owner);
2890
3117
  const store = this.storeOf(owner);
3118
+ outcomes = mendRolls(outcomes, store, state);
2891
3119
  if (state.ooc !== void 0) return { done: this.decree(owner, state, outcomes, elapsedSeconds) };
2892
3120
  if (state.phase === "idle" || state.phase === "between") {
2893
3121
  if (judgeDue(state) || previewDue(state)) throw new Error(explainPhase(state, "resolve_round"));
@@ -2959,13 +3187,17 @@ var TurnEngine = class {
2959
3187
  };
2960
3188
  return recordRound(this.storeOf(owner), owner, state, (round) => this.fire(owner, round));
2961
3189
  }
3190
+ /** The turn settles a lone attempt in one step: nobody is asked to act, so there is no scene to preview. */
3191
+ withoutPreview(owner) {
3192
+ this.stateFor(owner).previewWanted = false;
3193
+ }
2962
3194
  /** Why a lone check of the player's character cannot be rolled, recorded and narrated in one call, if it cannot: nothing is rolled until this is clear. */
2963
3195
  soloCheckProblem(owner, character) {
2964
3196
  const state = this.stateFor(owner);
2965
3197
  const store = this.storeOf(owner);
2966
3198
  if (state.ooc !== void 0) return "this turn is an out-of-character one: use ooc_ruling or ooc_answer";
2967
3199
  if (state.phase !== "idle" || state.rounds > 0) return "characters were already played in this turn: roll with roll_check, decide with resolve_round and deliver with narrate";
2968
- if (judgeDue(state) || previewDue(state)) return explainPhase(state, "resolve_round");
3200
+ if (judgeDue(state)) return explainPhase(state, "resolve_round");
2969
3201
  if (state.judgement?.allowed === false) return `the action cannot work (${state.judgement.reason}): play it as a failed attempt with resolve_round, then narrate`;
2970
3202
  const player = store.cast().find((member) => member.character.control === "player");
2971
3203
  return player?.key === character ? void 0 : `this is only for the player's character${player === void 0 ? "" : ` (${player.key})`}: anyone else's attempt goes through activate_characters`;
@@ -3273,9 +3505,11 @@ var TurnEngine = class {
3273
3505
  }
3274
3506
  /**
3275
3507
  * Whether the game master may still be turned back, counting this objection. Only objections that get nowhere count: a turn that has moved on since the
3276
- * last one (what is missing changed) starts the count again, because a turn cut short by a model's output limit has to be steered through every step.
3508
+ * last one (what is missing changed) starts the count again, because a turn cut short by a model's output limit has to be steered through every step. A step that
3509
+ * made tool calls (`progressing`) is not an objection that gets nowhere and is not counted.
3277
3510
  */
3278
- object(owner, missing) {
3511
+ object(owner, missing, progressing = false) {
3512
+ if (progressing) return true;
3279
3513
  const key = `${owner.chat}#${owner.turn}`;
3280
3514
  const last = this.objections.get(key);
3281
3515
  const count = last?.missing === missing ? last.count + 1 : 1;
@@ -3511,7 +3745,11 @@ var TurnEngine = class {
3511
3745
  this.suggestAfter(owner, state, output);
3512
3746
  this.startDueWrite(owner, state);
3513
3747
  this.delivered.set(owner.chat, state);
3514
- this.afterTurn.start(owner, state.cancel.signal);
3748
+ this.afterTurn.start(owner, state.cancel.signal, {
3749
+ input: state.input ?? "",
3750
+ deeds: state.history.flatMap((entry) => [`${entry.name}: ${entry.summary}`, ...entry.utterance === void 0 ? [] : [`${entry.name}: "${entry.utterance}"`]]),
3751
+ narration: output.segments.map((segment) => segment.type === "narration" ? segment.text : `${segment.name}: ${segment.text}`).join("\n")
3752
+ });
3515
3753
  if (run !== void 0) this.offSceneIfDue(owner, state, run);
3516
3754
  return output;
3517
3755
  }
@@ -3580,7 +3818,7 @@ var ImageJobs = class {
3580
3818
  this.failures.delete(this.key(id, node));
3581
3819
  const request = output.segments.map((segment) => segment.type === "utterance" ? `${segment.name}: “${segment.text}”` : segment.text).join("\n");
3582
3820
  const reuse = automatic && settings.images.reuse;
3583
- const present = () => (this.deps.presenter ?? runImagePresenter)({
3821
+ const present$1 = () => (this.deps.presenter ?? runImagePresenter)({
3584
3822
  parent,
3585
3823
  signal: controller.signal,
3586
3824
  service: withPriority(service, priority, settings.images.highRes),
@@ -3598,7 +3836,27 @@ var ImageJobs = class {
3598
3836
  ...reuse && this.deps.embedder?.() !== void 0 ? { embedder: this.deps.embedder() } : {},
3599
3837
  ...settings.reasoning.children === "" ? {} : { reasoningEffort: settings.reasoning.children }
3600
3838
  });
3601
- const promise = (reuse && settings.images.interpret && this.deps.attachments?.() !== void 0 ? this.describePending(id, controller.signal).then(present) : present()).then(() => void 0).catch((error) => {
3839
+ const store = () => this.deps.turnStore?.(chatSessionId(id));
3840
+ const begin = () => {
3841
+ const make = () => reuse && settings.images.interpret && this.deps.attachments?.() !== void 0 ? this.describePending(id, controller.signal).then(present$1) : present$1();
3842
+ const waiting = this.deps.beforeGeneration?.(chatSessionId(id), controller.signal);
3843
+ return waiting === void 0 ? make() : waiting.then(make);
3844
+ };
3845
+ const makeOrShow = async () => {
3846
+ const turns = store();
3847
+ const picked = automatic && reuse && turns !== void 0 && this.deps.reuseExisting !== void 0 ? await this.deps.reuseExisting({
3848
+ chat: chatSessionId(id),
3849
+ store: turns,
3850
+ root: sessionFolder(this.deps.sessionsDir(), id),
3851
+ moment: request
3852
+ }, controller.signal) : void 0;
3853
+ if (picked === void 0) return await begin();
3854
+ await present(sessionFolder(this.deps.sessionsDir(), id), node, {
3855
+ path: picked,
3856
+ reason: "a stored picture that shows this moment"
3857
+ });
3858
+ };
3859
+ const promise = makeOrShow().then(() => void 0).catch((error) => {
3602
3860
  if (controller.signal.aborted) return;
3603
3861
  const message = error instanceof Error ? error.message : String(error);
3604
3862
  this.failures.set(this.key(id, node), message);
@@ -3735,6 +3993,38 @@ var ImageJobs = class {
3735
3993
  return `${id}/${node}`;
3736
3994
  }
3737
3995
  };
3996
+ // src/host/images/reuse.ts
3997
+ /** How many close candidates are put to the decision model, and how much of the moment it is shown. */
3998
+ const CANDIDATES = 6;
3999
+ const MOMENT_CHARS = 1500;
4000
+ /**
4001
+ * Looks for a stored picture that shows the moment, before one is made (`decisions.reuse`): the close candidates by words and meaning, each put to the decision model with its description,
4002
+ * the first it says fits taken. A picture of the same place at another moment, or with something else in it, is what the decision model is told to refuse. Nothing is found without a
4003
+ * decision model; a failure is reported once and a picture is made as before.
4004
+ * @returns the path of the picture to show again, if there is one.
4005
+ */
4006
+ function pictureReuse(deps) {
4007
+ const seen = /* @__PURE__ */ new Map();
4008
+ return async (job, signal) => {
4009
+ const settings = job.store.settings();
4010
+ if (settings.decisions.reuse === "off") return void 0;
4011
+ const stored = (await listGallery(job.root)).filter((image) => image.reusable && image.pending !== true && (image.description ?? "").trim() !== "");
4012
+ if (stored.length === 0) return void 0;
4013
+ const { matches } = await findImages(job.root, stored, {
4014
+ text: job.moment,
4015
+ limit: CANDIDATES
4016
+ }, deps.embedder?.(), signal);
4017
+ if (matches.length === 0) return void 0;
4018
+ const asks = matches.map(({ image }, index) => ({
4019
+ key: `picture${index}`,
4020
+ instructions: job.store.text("roleplay/decide-reuse", { description: image.description.trim() })
4021
+ }));
4022
+ const { found, report } = await askExtra(deps.decisions?.(), { moment: job.moment.slice(0, MOMENT_CHARS) }, asks, settings.decisions.gateThreshold, signal);
4023
+ noteExtra("reuse", job.chat, job.store, report, seen, deps.problem);
4024
+ const first = found[0];
4025
+ return first === void 0 ? void 0 : matches[Number(first.slice(7))].image.path;
4026
+ };
4027
+ }
3738
4028
  // src/orchestration.ts
3739
4029
  const WORKING_DIRECTORY_CONTEXT = "working-directory:current";
3740
4030
  const name = "@dsh-agentic-roleplay/core/orchestration";
@@ -3758,9 +4048,11 @@ function apply(ctx) {
3758
4048
  ctx.logger.warn(`roleplay: ${message}`);
3759
4049
  };
3760
4050
  const sessionsDir = () => join(ctx.roleplayRoot.path, "sessions");
3761
- const decisions = () => ctx.get("decisions");
4051
+ const residency = () => ctx.roleplayOrchestration.residency;
4052
+ const decisions = () => guarded(residency(), "decision", ctx.get("decisions"), ["decide"]);
4053
+ const embeddings = () => guarded(residency(), "embedding", ctx.get("embeddings"), ["embed"]);
3762
4054
  const index = new EmbeddingIndex({
3763
- embedder: () => ctx.get("embeddings"),
4055
+ embedder: embeddings,
3764
4056
  story: (chat) => {
3765
4057
  const id = roleplaySessionOf(chat);
3766
4058
  if (id === void 0) return void 0;
@@ -3778,7 +4070,7 @@ function apply(ctx) {
3778
4070
  });
3779
4071
  ctx.inject(["rerankers"], (scope) => {
3780
4072
  scope.effect(() => ctx.roleplayState.rankMemories(rerankMemories({
3781
- reranker: () => scope.rerankers,
4073
+ reranker: () => guarded(residency(), "reranker", scope.rerankers, ["rerank"]),
3782
4074
  problem
3783
4075
  })), "roleplay: rerank memories");
3784
4076
  });
@@ -3807,6 +4099,11 @@ function apply(ctx) {
3807
4099
  agentOf: (chat) => ctx.agents.get(SessionId(chat)),
3808
4100
  external: (parent) => ctx.get("roleplayAuthoringTools")?.given(parent.ctx.tools, "worldAuthor") ?? []
3809
4101
  }) }), "roleplay: world author");
4102
+ ctx.effect(() => ctx.roleplayOrchestration.replace({ variableTracker: variableTracker({
4103
+ agentOf: (chat) => ctx.agents.get(SessionId(chat)),
4104
+ decisions,
4105
+ problem
4106
+ }) }), "roleplay: tracked values");
3810
4107
  ctx.effect(() => ctx.roleplayOrchestration.replace({ suggester: suggestionWriter({ agentOf: (chat) => ctx.agents.get(SessionId(chat)) }) }), "roleplay: suggestions");
3811
4108
  ctx.effect(() => ctx.roleplayState.bind((agentSessionId) => {
3812
4109
  const id = roleplaySessionOf(agentSessionId);
@@ -3936,11 +4233,24 @@ function apply(ctx) {
3936
4233
  state: ctx.roleplayState,
3937
4234
  sessionsDir,
3938
4235
  timelines,
3939
- service: () => ctx.get("imageGeneration"),
4236
+ service: () => guarded(residency(), "image", ctx.get("imageGeneration"), ["generate"]),
4237
+ turnStore: (chat) => stores(chat),
4238
+ reuseExisting: pictureReuse({
4239
+ decisions,
4240
+ embedder: embeddings,
4241
+ problem
4242
+ }),
4243
+ beforeGeneration: async (chat, signal) => {
4244
+ if (residency()?.conflicts("image", "main") === true) await Promise.race([engine.quiesce(chat), new Promise((resolve) => {
4245
+ signal.addEventListener("abort", () => {
4246
+ resolve();
4247
+ }, { once: true });
4248
+ })]);
4249
+ },
3940
4250
  agentOf: (chat) => ctx.agents.get(SessionId(chat)),
3941
4251
  settings: (id) => liveSettings(sessionFolder(sessionsDir(), id), problem),
3942
4252
  attachments: () => ctx.get("attachments"),
3943
- embedder: () => ctx.get("embeddings"),
4253
+ embedder: embeddings,
3944
4254
  problem
3945
4255
  });
3946
4256
  imageJobs = images;
@@ -1,13 +1,13 @@
1
- import { c as chatSessionId, n as atomicWrite, r as atomicWriteJson } from "./access-CXtaZNbx.js";
2
- import { $t as subfolders, A as editsSince, B as addressesToFetch, Bt as loadLocations, C as worldFieldChanges, E as loadWorldParts, Ft as TRIGGERS_FILE_NAME, H as fetchPictures, Ht as loadItems, It as loadTriggers, J as UPDATE_FOLDER, K as cardCharacter, Lt as LORE_DIR, Qt as loadCharacters, Rt as loadLore, Ut as FACTIONS_DIR, V as candidateUrls, Vt as ITEMS_DIR, W as mergeReports, Wt as loadFactions, X as cardPieces, Y as baseId, Yt as loadCalendar, Zt as CHARACTERS_DIR, bt as withScratchStory, c as importPhase, i as contextOf, j as writeSnapshot, k as recordProvenance, ln as authoredWorldOf, q as writePortrait, s as worldOf, un as authoringChatSessionId, w as editWorldInfo, x as matchPieces, xt as knowsCharacter, yt as loadValidatedWorld, z as addressKey, zt as LOCATIONS_DIR } from "./authoring-tools-C9cmcUbD.js";
3
- import { $ as IMPORT_FOLDER, At as InvalidEditProblems, Dt as parseCharacterFile, Et as CHARACTER_FILE_NAME, J as writeWorldPrompt, Q as withPlayer, St as parseItemFile, Tt as parseFactionFile, _t as parseLoreFile, at as readImportFolder, bt as ITEM_FILE_NAME, gt as LORE_FILE_NAME, nt as PICTURE_FILE, ot as writeChoices, pt as loadVariables, vt as LOCATION_FILE_NAME, wt as FACTION_FILE_NAME, x as extractStyleFrom, yt as parseLocationFile } from "./presets-Cl9sU3Qs.js";
4
- import { n as encodeOutput } from "./narration-B0hConSw.js";
5
- import { A as LANGUAGE_NAMES, G as formatIssue, I as PLOTS_FILE_NAME, J as PROMPTS_FOLDER, L as loadPlots, M as isStoryLanguage, N as textLanguage, R as parsePlotsFile, W as Reader, it as AgentUnavailableError, j as STORY_LANGUAGES, ot as InvalidWorldError, tt as shippedLanguages, ut as WorldNotFoundError, z as plotReferenceProblems } from "./hooks-BpLN_hhT.js";
6
- import { i as translator, r as languageOf } from "./text-CzqhC8sT.js";
7
- import { h as readImageFileMetadata, u as referenceImagePath, x as mapLimit } from "./library-CH-ahlm0.js";
8
- import { n as readPreset } from "./preset-Be4lz6vB.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-Cc05FrId.js";
10
- import { a as uploadReferenceImage, t as generateReferenceImage } from "./generator-nLoPM5MF.js";
1
+ import { c as chatSessionId, n as atomicWrite, r as atomicWriteJson } from "./access-Md1YTSX1.js";
2
+ import { $t as subfolders, A as editsSince, B as addressesToFetch, Bt as loadLocations, C as worldFieldChanges, E as loadWorldParts, Ft as TRIGGERS_FILE_NAME, H as fetchPictures, Ht as loadItems, It as loadTriggers, J as UPDATE_FOLDER, K as cardCharacter, Lt as LORE_DIR, Qt as loadCharacters, Rt as loadLore, Ut as FACTIONS_DIR, V as candidateUrls, Vt as ITEMS_DIR, W as mergeReports, Wt as loadFactions, X as cardPieces, Y as baseId, Yt as loadCalendar, Zt as CHARACTERS_DIR, bt as withScratchStory, c as importPhase, i as contextOf, j as writeSnapshot, k as recordProvenance, ln as authoredWorldOf, q as writePortrait, s as worldOf, un as authoringChatSessionId, w as editWorldInfo, x as matchPieces, xt as knowsCharacter, yt as loadValidatedWorld, z as addressKey, zt as LOCATIONS_DIR } from "./authoring-tools-BFdw7ahj.js";
3
+ import { $ as IMPORT_FOLDER, At as InvalidEditProblems, Dt as parseCharacterFile, Et as CHARACTER_FILE_NAME, J as writeWorldPrompt, Q as withPlayer, St as parseItemFile, Tt as parseFactionFile, _t as parseLoreFile, at as readImportFolder, bt as ITEM_FILE_NAME, gt as LORE_FILE_NAME, nt as PICTURE_FILE, ot as writeChoices, pt as loadVariables, vt as LOCATION_FILE_NAME, wt as FACTION_FILE_NAME, x as extractStyleFrom, yt as parseLocationFile } from "./presets-_U-xroo0.js";
4
+ import { n as encodeOutput } from "./narration-b_VBEUWn.js";
5
+ import { B as parsePlotsFile, F as textLanguage, K as Reader, M as LANGUAGE_NAMES, N as STORY_LANGUAGES, P as isStoryLanguage, R as PLOTS_FILE_NAME, V as plotReferenceProblems, X as PROMPTS_FOLDER, ct as InvalidWorldError, ft as WorldNotFoundError, ot as AgentUnavailableError, q as formatIssue, rt as shippedLanguages, z as loadPlots } from "./hooks-C2U1-8ur.js";
6
+ import { i as translator, r as languageOf } from "./text-C2AGl7Je.js";
7
+ import { h as readImageFileMetadata, u as referenceImagePath, x as mapLimit } from "./library-4zmCAshR.js";
8
+ import { n as readPreset } from "./preset-B-35yUmt.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-CYkozh8Q.js";
10
+ import { a as uploadReferenceImage, t as generateReferenceImage } from "./generator-QCdm8nUh.js";
11
11
  import { basename, dirname, extname, isAbsolute, join, relative, resolve, sep } from "node:path";
12
12
  import { readTriggerDefinition, triggerReferenceProblems } from "@dsh-agentic-roleplay/state";
13
13
  import { existsSync, lstatSync, statSync } from "node:fs";
@@ -1463,7 +1463,7 @@ function waitsFor(condition) {
1463
1463
  * what it names that the world does not have is refused, with every problem; nothing is written then.
1464
1464
  * @throws {InvalidEditProblems}
1465
1465
  */
1466
- async function writeTriggerDocument(directory, parts, key, document) {
1466
+ async function writeTriggerDocument(directory, parts, key, document, options = {}) {
1467
1467
  if (!isDocument(document)) throw new InvalidEditProblems(["document must be a JSON object"]);
1468
1468
  const unknown = Object.keys(document).filter((field) => !FIELDS.has(field));
1469
1469
  if (unknown.length > 0) throw new InvalidEditProblems(unknown.map((field) => `"${field}" is not a field of a trigger (${[...FIELDS].join(", ")})`));
@@ -1480,7 +1480,7 @@ async function writeTriggerDocument(directory, parts, key, document) {
1480
1480
  return "definition" in read ? [read.definition] : [];
1481
1481
  }), parsed.definition]).get(key) ?? [];
1482
1482
  if (problems.length > 0) throw new InvalidEditProblems(problems);
1483
- await writeDocuments(directory, at < 0 ? [...documents, written] : documents.map((entry, index) => index === at ? written : entry));
1483
+ if (options.dryRun !== true) await writeDocuments(directory, at < 0 ? [...documents, written] : documents.map((entry, index) => index === at ? written : entry));
1484
1484
  return at < 0 ? "created" : "replaced";
1485
1485
  }
1486
1486
  /**
@@ -2482,6 +2482,7 @@ async function createAuthoredEntity(world, kind, key, document, options = {}) {
2482
2482
  const root = join(world.directory, format.directory);
2483
2483
  const folder = join(root, key);
2484
2484
  const text = serializeDocument(kind, key, document, options);
2485
+ if (options.dryRun === true) return;
2485
2486
  await mkdir(root, { recursive: true });
2486
2487
  await mkdir(folder, { recursive: false });
2487
2488
  try {
@@ -2497,7 +2498,9 @@ async function createAuthoredEntity(world, kind, key, document, options = {}) {
2497
2498
  async function replaceAuthoredEntity(world, kind, key, document, options = {}) {
2498
2499
  const found = await find(world, kind, key);
2499
2500
  if (found === void 0) throw new InvalidEditProblems([`there is no ${kind} "${key}"`]);
2500
- await atomicWrite(found.file, serializeDocument(kind, key, document, options));
2501
+ const text = serializeDocument(kind, key, document, options);
2502
+ if (options.dryRun === true) return;
2503
+ await atomicWrite(found.file, text);
2501
2504
  }
2502
2505
  /** Deletions remain recoverable without making the trash visible to the world loaders. */
2503
2506
  async function deleteAuthoredEntity(world, kind, key) {
@@ -2569,6 +2572,8 @@ const PACK_FILE_TOOLS = [
2569
2572
  "edit"
2570
2573
  ];
2571
2574
  const WRITING = ["write", "edit"];
2575
+ /** A patch names its files inside its own text, so it cannot be held to the packs: it is refused, and `write` and `edit` do the same work. */
2576
+ const PATCHING = "apply_patch";
2572
2577
  /** The most text a call may carry. */
2573
2578
  const MAX_PACK_TEXT = 204800;
2574
2579
  function unsafePath(ui, path) {
@@ -2612,7 +2617,12 @@ const textOf = (value) => typeof value === "string" ? [value] : [];
2612
2617
  */
2613
2618
  async function packJail(exec, next, deps) {
2614
2619
  const chat = exec.agent?.session.id;
2615
- if (!PACK_FILE_TOOLS.includes(exec.name) || chat === void 0 || authoredWorldOf(chat) === void 0) return await next();
2620
+ if (chat === void 0 || authoredWorldOf(chat) === void 0) return await next();
2621
+ if (exec.name === PATCHING) return {
2622
+ kind: "deny",
2623
+ reason: "apply_patch is not available in this chat: change an interface pack file with write or edit"
2624
+ };
2625
+ if (!PACK_FILE_TOOLS.includes(exec.name)) return await next();
2616
2626
  const world = await deps.worldDirectory(chat);
2617
2627
  if (world === void 0) return {
2618
2628
  kind: "deny",
@@ -2653,4 +2663,4 @@ function registerPackJail(ctx, deps) {
2653
2663
  }
2654
2664
  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 };
2655
2665
 
2656
- //# sourceMappingURL=pack-jail-D5j5mIq6.js.map
2666
+ //# sourceMappingURL=pack-jail-Ci9bIeDI.js.map
@@ -1,4 +1,4 @@
1
- import { W as Reader } from "./hooks-BpLN_hhT.js";
1
+ import { K as Reader } from "./hooks-C2U1-8ur.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-Cc05FrId.js.map
839
+ //# sourceMappingURL=packs-CYkozh8Q.js.map