@dsh-agentic-roleplay/core 0.12.5 → 0.12.6

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 (30) hide show
  1. package/lib/{access-DjA0kvPM.js → access-5vtPAT3O.js} +2 -2
  2. package/lib/{authoring-tools-DqAttdUN.js → authoring-tools-BpkpGMSO.js} +7 -7
  3. package/lib/authoring.js +7 -7
  4. package/lib/{child-SMvjNsb8.js → child-Bfj7-Iuo.js} +11 -13
  5. package/lib/client.js +487 -460
  6. package/lib/client.js.map +1 -1
  7. package/lib/compaction.js +3 -3
  8. package/lib/doctor.js +3 -3
  9. package/lib/{gallery-Dahi5TkO.js → gallery-D0h0X7Jy.js} +3 -3
  10. package/lib/{generator-BvSZGpzy.js → generator-CAJkevKl.js} +2 -2
  11. package/lib/helper.js +2 -2
  12. package/lib/{hooks-OLl-1AOS.js → hooks-P_--KSFl.js} +4 -4
  13. package/lib/images.js +4 -4
  14. package/lib/index.js +61 -15
  15. package/lib/{jail-CDW5iymd.js → jail-D83JnxKg.js} +2 -2
  16. package/lib/{library-D6AcyxGZ.js → library-CnWOHwQl.js} +2 -2
  17. package/lib/{lorebook-author-tools-CXV1KD4Q.js → lorebook-author-tools-CWZ6WRN-.js} +6 -6
  18. package/lib/lorebook-authoring.js +5 -5
  19. package/lib/{narration-Bnrvl0UQ.js → narration-DAHmte8p.js} +2 -2
  20. package/lib/orchestration.js +11 -11
  21. package/lib/{pack-jail-CZAmlgE1.js → pack-jail-DSTyLhMc.js} +11 -11
  22. package/lib/{packs-DUVCSHqi.js → packs-D9_N8kDF.js} +2 -2
  23. package/lib/{presenter-agent-CGCJrg7V.js → presenter-agent-BTpJxmGi.js} +6 -6
  24. package/lib/{preset-BYfXYvp0.js → preset-B69AXtip.js} +4 -4
  25. package/lib/{preset-author-tools-DYxTLm9U.js → preset-author-tools-BJtt7D0J.js} +6 -6
  26. package/lib/preset-authoring.js +5 -5
  27. package/lib/{reflection-C3zdufN9.js → reflection-2uzE3U-v.js} +8 -8
  28. package/lib/{serial-Bh6gqb3f.js → serial-DnVqMDe5.js} +6 -6
  29. package/lib/{turn-guard-CNFvmz_F.js → turn-guard-D4YHE00t.js} +3 -3
  30. package/package.json +31 -31
package/lib/compaction.js CHANGED
@@ -1,6 +1,6 @@
1
- import { a as liveSettings, t as decodeOutput } from "./narration-Bnrvl0UQ.js";
2
- import { j as roleplaySessionOf, k as tokensOf, l as runChild, n as childModel, r as childSampling } from "./child-SMvjNsb8.js";
3
- import { t as promptFor } from "./access-DjA0kvPM.js";
1
+ import { a as liveSettings, t as decodeOutput } from "./narration-DAHmte8p.js";
2
+ import { j as roleplaySessionOf, k as tokensOf, l as runChild, n as childModel, r as childSampling } from "./child-Bfj7-Iuo.js";
3
+ import { t as promptFor } from "./access-5vtPAT3O.js";
4
4
  import { join } from "node:path";
5
5
  import { sessionFolder } from "@dsh-agentic-roleplay/state";
6
6
  import BasicCompactionEngine from "@deepseek-ai/dsh-compaction-basic";
package/lib/doctor.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import { n as silenceRuntimeContext, t as silenceHarnessDevContext } from "./dev-context-Cgv_wZbG.js";
2
- import { A as chatSessionId } from "./child-SMvjNsb8.js";
2
+ import { A as chatSessionId } from "./child-Bfj7-Iuo.js";
3
3
  import { n as doctorSessionOf } from "./doctor-chat-hL1a61hp.js";
4
- import { s as externalTools, t as externalToolLimit } from "./hooks-OLl-1AOS.js";
5
- import { a as liveSettings } from "./narration-Bnrvl0UQ.js";
4
+ import { s as externalTools, t as externalToolLimit } from "./hooks-P_--KSFl.js";
5
+ import { a as liveSettings } from "./narration-DAHmte8p.js";
6
6
  import { join } from "node:path";
7
7
  import { createTools, isSessionId, sessionDatabase, sessionFolder } from "@dsh-agentic-roleplay/state";
8
8
  import { existsSync } from "node:fs";
@@ -1,5 +1,5 @@
1
- import { n as atomicWrite } from "./access-DjA0kvPM.js";
2
- import { _ as writeImageFileMetadata, a as LIBRARY_FOLDER, g as sidecarOf, h as readImageFileMetadata, m as mediaTypeOf, x as mapLimit } from "./library-D6AcyxGZ.js";
1
+ import { n as atomicWrite } from "./access-5vtPAT3O.js";
2
+ import { _ as writeImageFileMetadata, a as LIBRARY_FOLDER, g as sidecarOf, h as readImageFileMetadata, m as mediaTypeOf, x as mapLimit } from "./library-CnWOHwQl.js";
3
3
  import { join, sep } from "node:path";
4
4
  import { lstat, readFile, readdir, realpath, stat } from "node:fs/promises";
5
5
  // src/host/images/gallery.ts
@@ -187,4 +187,4 @@ async function updateImage(sessionFolder, path, update) {
187
187
  }
188
188
  export { updateImage as i, galleryFile as n, listGallery as r, describeGalleryImage as t };
189
189
 
190
- //# sourceMappingURL=gallery-Dahi5TkO.js.map
190
+ //# sourceMappingURL=gallery-D0h0X7Jy.js.map
@@ -1,4 +1,4 @@
1
- import { d as sceneImagePath, f as writeImage, u as referenceImagePath } from "./library-D6AcyxGZ.js";
1
+ import { d as sceneImagePath, f as writeImage, u as referenceImagePath } from "./library-CnWOHwQl.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. */
@@ -147,4 +147,4 @@ async function generateTransientImage(service, request) {
147
147
  }
148
148
  export { uploadReferenceImage as a, transientPrompt as i, generateTransientImage as n, referencePrompt as r, generateReferenceImage as t };
149
149
 
150
- //# sourceMappingURL=generator-BvSZGpzy.js.map
150
+ //# sourceMappingURL=generator-CAJkevKl.js.map
package/lib/helper.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { n as silenceRuntimeContext, t as silenceHarnessDevContext } from "./dev-context-Cgv_wZbG.js";
2
- import { o as helpers } from "./child-SMvjNsb8.js";
2
+ import { o as helpers } from "./child-Bfj7-Iuo.js";
3
3
  import { a as workspaceOf, n as storyRoots } from "./service-mRKwpWjX.js";
4
- import { t as registerFoldersJail } from "./jail-CDW5iymd.js";
4
+ import { t as registerFoldersJail } from "./jail-D83JnxKg.js";
5
5
  import { join } from "node:path";
6
6
  import { sessionFolder } from "@dsh-agentic-roleplay/state";
7
7
  // src/helper.ts
@@ -1,6 +1,6 @@
1
- import { C as addTokens, D as finishOf, E as cutOff, O as estimateAnswer, S as NO_TOKENS, a as childTrace, b as estimateTokens, f as tracerOf, j as roleplaySessionOf, l as runChild, n as childModel, r as childSampling, u as TurnTraces, v as requestsOf, x as tokensOf, y as blockText } from "./child-SMvjNsb8.js";
2
- import { _ as emptyStats, a as liveSettings, h as DECISION_SITES, m as rulesOf, n as encodeOutput, p as WORLD_RULES_KEY, r as encodePreview } from "./narration-Bnrvl0UQ.js";
3
- import { t as promptFor } from "./access-DjA0kvPM.js";
1
+ import { C as addTokens, D as finishOf, E as cutOff, O as estimateAnswer, S as NO_TOKENS, a as childTrace, b as estimateTokens, f as tracerOf, j as roleplaySessionOf, l as runChild, n as childModel, r as childSampling, u as TurnTraces, v as requestsOf, x as tokensOf, y as blockText } from "./child-Bfj7-Iuo.js";
2
+ import { _ as emptyStats, a as liveSettings, h as DECISION_SITES, m as rulesOf, n as encodeOutput, p as WORLD_RULES_KEY, r as encodePreview } from "./narration-DAHmte8p.js";
3
+ import { t as promptFor } from "./access-5vtPAT3O.js";
4
4
  import { i as translator, r as languageOf$1, t as trimCharacters } from "./text-B-HsLdb-.js";
5
5
  import { n as storyRoots } from "./service-mRKwpWjX.js";
6
6
  import { dirname, join } from "node:path";
@@ -5049,4 +5049,4 @@ function installHooks(ctx, deps) {
5049
5049
  }
5050
5050
  export { copyWorldPrompts as $, plotProgressOf as A, parsePlotsFile as B, readNotes as C, referent as D, sameWords as E, textLanguage as F, readDocument as G, COMMANDS_KEY as H, wrongLanguage as I, errorMessage as J, Reader as K, readUsage as L, LANGUAGE_NAMES as M, STORY_LANGUAGES as N, RESULTS as O, isStoryLanguage as P, PromptLibrary as Q, PLOTS_FILE_NAME as R, notesOfSession as S, defaultBoundaries as T, commandFlagKey as U, plotReferenceProblems as V, commandsOf as W, LANGUAGE_TAG as X, LANGUAGE_FOLDER as Y, PROMPTS_FOLDER as Z, readTraces as _, ClockError as _t, MAX_OOC_ANSWER as a, shippedPromptsDirectory as at, readWithdrawn as b, AUTHORING_NEEDS as bt, externalWithheld as c, InvalidStartError as ct, record as d, SessionArchivedError as dt, inheritPrompts as et, toolEnabled as f, SessionNotFoundError as ft, readRunDetail as g, runCommandLine as gt, readActivity as h, registerCommands as ht, characterRunner as i, shippedLanguages as it, populatePlots as j, PLOTS_METADATA_KEY as k, PREVIEW_TOOL as l, InvalidWorldError as lt, readDecisionStats as m, CommandRefusedError as mt, installHooks as n, listFiles as nt, externalGiven as o, shippedText as ot, storesOf as p, WorldNotFoundError as pt, formatIssue as q, guardRepeatedCalls as r, promptProblem as rt, externalTools as s, AgentUnavailableError as st, externalToolLimit as t, languageOf as tt, createTools$1 as u, ReflectionRefusedError as ut, readVerdicts as v, describeWhen as vt, observeAsPlayer as w, addToNote as x, COMPARISONS as xt, writeVerdicts as y, zoneOf as yt, loadPlots as z };
5051
5051
 
5052
- //# sourceMappingURL=hooks-OLl-1AOS.js.map
5052
+ //# sourceMappingURL=hooks-P_--KSFl.js.map
package/lib/images.js CHANGED
@@ -1,5 +1,5 @@
1
- import { a as searchImages, c as presentedFor, n as interpretImage, o as tokensOf, r as imageTools, s as present, t as runImagePresenter } from "./presenter-agent-CGCJrg7V.js";
2
- import { i as updateImage, r as listGallery } from "./gallery-Dahi5TkO.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-D6AcyxGZ.js";
4
- import { i as transientPrompt, n as generateTransientImage, r as referencePrompt, t as generateReferenceImage } from "./generator-BvSZGpzy.js";
1
+ import { a as searchImages, c as presentedFor, n as interpretImage, o as tokensOf, r as imageTools, s as present, t as runImagePresenter } from "./presenter-agent-BTpJxmGi.js";
2
+ import { i as updateImage, r as listGallery } from "./gallery-D0h0X7Jy.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-CnWOHwQl.js";
4
+ import { i as transientPrompt, n as generateTransientImage, r as referencePrompt, t as generateReferenceImage } from "./generator-CAJkevKl.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,21 +1,21 @@
1
- import { A as chatSessionId, _ as RECOVERY_SHRINK, g as RECOVERY_FLOOR, h as sharedSamplingOf, i as childSamplingOf, j as roleplaySessionOf, m as parseSampling, s as isUnfinishedCall, w as totalTokens } from "./child-SMvjNsb8.js";
2
- import { $ as checkWorld, $t as authoringChatSessionId, A as loadWorldParts, B as localChanges, Gt as cardFormat, H as writeOrigin, J as guardedLookup, Jt as readCard, Kt as isPng, L as describeChanges, O as editWorldInfo, Ot as CHARACTERS_DIR, Qt as authoredWorldOf, R as hashWorld, U as CatalogueError, V as readOrigin, Wt as ImportCardError, X as vetUrl, _ as structureImport, _t as loadLocations, a as beginImport, at as populateClock, c as importTextFor, ct as populateItems, d as knownOutputCeiling, dt as populateLore, et as loadValidatedWorld, f as importPhase, ft as populateRoutines, g as settleDraft, h as markReady, i as ImportState, it as populateCharacters, k as readWorldInfo, kt as loadCharacters, lt as populateKnowledge, m as keepDraft, mt as populateVariables, nt as knowsCharacter, ot as populateDice, pt as populateTriggers, qt as pictureOf, rt as populateCalendar, st as populateFactions, t as AuthoringTools, ut as populateLocations, x as runChecks, z as isUnchanged } from "./authoring-tools-DqAttdUN.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-CXV1KD4Q.js";
4
- import { a as presetChatSessionId, n as narrationImportMessage, o as presetOfChat } from "./preset-author-tools-DYxTLm9U.js";
5
- import { $ as copyWorldPrompts, A as plotProgressOf, B as parsePlotsFile, C as readNotes, G as readDocument, H as COMMANDS_KEY, J as errorMessage, L as readUsage, Q as PromptLibrary, S as notesOfSession, T as defaultBoundaries, V as plotReferenceProblems, Y as LANGUAGE_FOLDER, Z as PROMPTS_FOLDER, _ as readTraces, b as readWithdrawn, ct as InvalidStartError, dt as SessionArchivedError, ft as SessionNotFoundError, g as readRunDetail, h as readActivity, it as shippedLanguages, j as populatePlots, k as PLOTS_METADATA_KEY, lt as InvalidWorldError, m as readDecisionStats, mt as CommandRefusedError, nt as listFiles, pt as WorldNotFoundError, q as formatIssue, rt as promptProblem, s as externalTools, st as AgentUnavailableError, tt as languageOf, ut as ReflectionRefusedError, w as observeAsPlayer, x as addToNote, yt as zoneOf } from "./hooks-OLl-1AOS.js";
6
- import { a as liveSettings, c as writeSettings, d as parseSettings, i as InvalidSettingsError, l as DEFAULT_SETTINGS, o as readSettings, p as WORLD_RULES_KEY, s as useChildReasoning, u as SETTINGS_SPEC } from "./narration-Bnrvl0UQ.js";
7
- import { B as questionView, Bt as parseThingEdit, Dt as ImportNotFoundError, Et as IMPORT_FOLDER, F as parseWorldInfoEdit, Ft as parseCharacterEdit, G as deletePreset, H as PRESET_FILE, It as parseFactionEdit, J as loadPreset, K as isPresetName, Kt as sourceSummary, Lt as parseLoreEdit, M as WORLD_FILE_NAME, Mt as readImportFolder, N as parseWorldFile, Ot as ImportStore, Pt as InvalidEditProblems, Q as savePresetFromWorld, Rt as parsePlaceEdit, Tt as withPlayer, W as createPresetFromShipped, Y as presetDirectory, Z as reservePreset, _t as updateLorebookInfo, at as writeWorldPrompt, cn as parseCharacterFile, ct as deleteLorebook, dn as LORE_SCOPES, dt as isLorebookName, et as updatePresetInfo, ft as listLorebooks, gt as reserveLorebook, it as readWorldPrompt, jt as parseChoices, ln as guarded, lt as deleteLorebookEntry, mt as lorebookDirectory, nt as deleteWorldPrompt, ot as addLorebookEntries, pt as loadLorebook, q as listPresets, rt as listWorldPrompts, st as createLorebook, un as LORE_KINDS, ut as entriesOf, vt as writeLorebookEntry, wt as partsOf, xt as subfolders, z as combineAnswers, zt as parseRelationEdit } from "./serial-Bh6gqb3f.js";
8
- import { $ as languageOfDocuments, A as generateWorldCharacterPortrait, C as editWorldFaction$1, D as editWorldPlots$1, E as editWorldPlace$1, F as uploadWorldCharacterPortrait, G as parseVariablesEdit, I as uploadWorldEntityImage, J as PRESET_FILE$1, K as parseDiceEdit, L as worldCharacterPortraitFile, M as readWorldEditor, N as readWorldTrigger, O as editWorldRelation$1, P as removeWorldTrigger, R as worldEntityImageFile, S as editWorldCharacter$1, T as editWorldNarrationVoice, U as parseCalendarEdit, W as parseRoutineEdit, Y as presetMessage, Z as translateMessage, _ as readCalendarDocument, a as deleteWorldPackFile, at as startUpdate, b as readRoutines, c as createAuthoredEntity, ct as authoringTitle, dt as agentServicesOf, et as readWorldDocuments, f as editCalendar, ft as DOCTOR_OPENING_SOURCE, g as editVariables, h as editRoutine, it as revertUpdate, j as generateWorldEntityImage, k as editWorldThing$1, l as deleteAuthoredEntity, lt as ensureAuthoringChat, m as editDice, mt as appendNarratedTurn, n as packFileProblem, ot as updateStatus, p as editCommands, pt as appendEmptyTurn, q as parseCommandsEdit, st as AuthoringSessions, t as MAX_PACK_TEXT, tt as findTargets, u as readAuthoredEntityDocument, ut as AgentSessions, v as readCommandsDocument, w as editWorldLore$1, x as readVariables, y as readDiceDocument, z as writeWorldTrigger } from "./pack-jail-CZAmlgE1.js";
9
- import { i as atomicWriteSync, n as atomicWrite, r as atomicWriteJson } from "./access-DjA0kvPM.js";
1
+ import { A as chatSessionId, _ as RECOVERY_SHRINK, g as RECOVERY_FLOOR, h as sharedSamplingOf, i as childSamplingOf, j as roleplaySessionOf, m as parseSampling, s as isUnfinishedCall, w as totalTokens } from "./child-Bfj7-Iuo.js";
2
+ import { $ as checkWorld, $t as authoringChatSessionId, A as loadWorldParts, B as localChanges, Gt as cardFormat, H as writeOrigin, J as guardedLookup, Jt as readCard, Kt as isPng, L as describeChanges, O as editWorldInfo, Ot as CHARACTERS_DIR, Qt as authoredWorldOf, R as hashWorld, U as CatalogueError, V as readOrigin, Wt as ImportCardError, X as vetUrl, _ as structureImport, _t as loadLocations, a as beginImport, at as populateClock, c as importTextFor, ct as populateItems, d as knownOutputCeiling, dt as populateLore, et as loadValidatedWorld, f as importPhase, ft as populateRoutines, g as settleDraft, h as markReady, i as ImportState, it as populateCharacters, k as readWorldInfo, kt as loadCharacters, lt as populateKnowledge, m as keepDraft, mt as populateVariables, nt as knowsCharacter, ot as populateDice, pt as populateTriggers, qt as pictureOf, rt as populateCalendar, st as populateFactions, t as AuthoringTools, ut as populateLocations, x as runChecks, z as isUnchanged } from "./authoring-tools-BpkpGMSO.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-CWZ6WRN-.js";
4
+ import { a as presetChatSessionId, n as narrationImportMessage, o as presetOfChat } from "./preset-author-tools-BJtt7D0J.js";
5
+ import { $ as copyWorldPrompts, A as plotProgressOf, B as parsePlotsFile, C as readNotes, G as readDocument, H as COMMANDS_KEY, J as errorMessage, L as readUsage, Q as PromptLibrary, S as notesOfSession, T as defaultBoundaries, V as plotReferenceProblems, Y as LANGUAGE_FOLDER, Z as PROMPTS_FOLDER, _ as readTraces, b as readWithdrawn, ct as InvalidStartError, dt as SessionArchivedError, ft as SessionNotFoundError, g as readRunDetail, h as readActivity, it as shippedLanguages, j as populatePlots, k as PLOTS_METADATA_KEY, lt as InvalidWorldError, m as readDecisionStats, mt as CommandRefusedError, nt as listFiles, pt as WorldNotFoundError, q as formatIssue, rt as promptProblem, s as externalTools, st as AgentUnavailableError, tt as languageOf, ut as ReflectionRefusedError, w as observeAsPlayer, x as addToNote, yt as zoneOf } from "./hooks-P_--KSFl.js";
6
+ import { a as liveSettings, c as writeSettings, d as parseSettings, i as InvalidSettingsError, l as DEFAULT_SETTINGS, o as readSettings, p as WORLD_RULES_KEY, s as useChildReasoning, u as SETTINGS_SPEC } from "./narration-DAHmte8p.js";
7
+ import { B as questionView, Bt as parseThingEdit, Dt as ImportNotFoundError, Et as IMPORT_FOLDER, F as parseWorldInfoEdit, Ft as parseCharacterEdit, G as deletePreset, H as PRESET_FILE, It as parseFactionEdit, J as loadPreset, K as isPresetName, Kt as sourceSummary, Lt as parseLoreEdit, M as WORLD_FILE_NAME, Mt as readImportFolder, N as parseWorldFile, Ot as ImportStore, Pt as InvalidEditProblems, Q as savePresetFromWorld, Rt as parsePlaceEdit, Tt as withPlayer, W as createPresetFromShipped, Y as presetDirectory, Z as reservePreset, _t as updateLorebookInfo, at as writeWorldPrompt, cn as parseCharacterFile, ct as deleteLorebook, dn as LORE_SCOPES, dt as isLorebookName, et as updatePresetInfo, ft as listLorebooks, gt as reserveLorebook, it as readWorldPrompt, jt as parseChoices, ln as guarded, lt as deleteLorebookEntry, mt as lorebookDirectory, nt as deleteWorldPrompt, ot as addLorebookEntries, pt as loadLorebook, q as listPresets, rt as listWorldPrompts, st as createLorebook, un as LORE_KINDS, ut as entriesOf, vt as writeLorebookEntry, wt as partsOf, xt as subfolders, z as combineAnswers, zt as parseRelationEdit } from "./serial-DnVqMDe5.js";
8
+ import { $ as languageOfDocuments, A as generateWorldCharacterPortrait, C as editWorldFaction$1, D as editWorldPlots$1, E as editWorldPlace$1, F as uploadWorldCharacterPortrait, G as parseVariablesEdit, I as uploadWorldEntityImage, J as PRESET_FILE$1, K as parseDiceEdit, L as worldCharacterPortraitFile, M as readWorldEditor, N as readWorldTrigger, O as editWorldRelation$1, P as removeWorldTrigger, R as worldEntityImageFile, S as editWorldCharacter$1, T as editWorldNarrationVoice, U as parseCalendarEdit, W as parseRoutineEdit, Y as presetMessage, Z as translateMessage, _ as readCalendarDocument, a as deleteWorldPackFile, at as startUpdate, b as readRoutines, c as createAuthoredEntity, ct as authoringTitle, dt as agentServicesOf, et as readWorldDocuments, f as editCalendar, ft as DOCTOR_OPENING_SOURCE, g as editVariables, h as editRoutine, it as revertUpdate, j as generateWorldEntityImage, k as editWorldThing$1, l as deleteAuthoredEntity, lt as ensureAuthoringChat, m as editDice, mt as appendNarratedTurn, n as packFileProblem, ot as updateStatus, p as editCommands, pt as appendEmptyTurn, q as parseCommandsEdit, st as AuthoringSessions, t as MAX_PACK_TEXT, tt as findTargets, u as readAuthoredEntityDocument, ut as AgentSessions, v as readCommandsDocument, w as editWorldLore$1, x as readVariables, y as readDiceDocument, z as writeWorldTrigger } from "./pack-jail-DSTyLhMc.js";
9
+ import { i as atomicWriteSync, n as atomicWrite, r as atomicWriteJson } from "./access-5vtPAT3O.js";
10
10
  import { i as translator, r as languageOf$1, t as trimCharacters } from "./text-B-HsLdb-.js";
11
- import { _ as snapshotOf, c as copyPreset, d as switchPreset, f as readTimeline, g as pathTo, h as childrenOf, i as reflectionStatus, l as presetStatus, m as START_SNAPSHOT, o as TimelineError, p as writeTimeline, u as recordPreset } from "./reflection-C3zdufN9.js";
12
- import { n as readPreset, r as selectPrompts, t as previewPreset } from "./preset-BYfXYvp0.js";
13
- import { C as slug, T as uniqueKey, d as sceneImagePath, s as inheritImages, t as addToLibrary, u as referenceImagePath } from "./library-D6AcyxGZ.js";
11
+ import { _ as pathTo, c as BranchError, d as recordPreset, f as switchPreset, g as childrenOf, h as START_SNAPSHOT, i as reflectionStatus, l as copyPreset, m as writeTimeline, o as TimelineError, p as readTimeline, u as presetStatus, v as snapshotOf } from "./reflection-2uzE3U-v.js";
12
+ import { n as readPreset, r as selectPrompts, t as previewPreset } from "./preset-B69AXtip.js";
13
+ import { C as slug, T as uniqueKey, d as sceneImagePath, s as inheritImages, t as addToLibrary, u as referenceImagePath } from "./library-CnWOHwQl.js";
14
14
  import { o as FOLDER_ACCESS, r as InvalidFoldersError, t as StoryFoldersService } from "./service-mRKwpWjX.js";
15
15
  import { t as doctorChatSessionId } from "./doctor-chat-hL1a61hp.js";
16
- 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-DUVCSHqi.js";
17
- import { a as uploadReferenceImage, t as generateReferenceImage } from "./generator-BvSZGpzy.js";
18
- import { i as updateImage, n as galleryFile, r as listGallery } from "./gallery-Dahi5TkO.js";
16
+ 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-D9_N8kDF.js";
17
+ import { a as uploadReferenceImage, t as generateReferenceImage } from "./generator-CAJkevKl.js";
18
+ import { i as updateImage, n as galleryFile, r as listGallery } from "./gallery-D0h0X7Jy.js";
19
19
  import { basename, dirname, extname, isAbsolute, join, normalize, relative, resolve, sep } from "node:path";
20
20
  import { SESSION_DATABASE_FILE, addLocalDays, createSessionStore, describeInstant, describeValue, holidaysOn, isSessionId, itemKey, lintWorld, locationKey, openSessionStore, parseInstant, readCalendar, seasonOf, sessionDatabase, sessionFolder, shownVariables, systemTimeZone } from "@dsh-agentic-roleplay/state";
21
21
  import { copyFileSync, cpSync, createReadStream, existsSync, lstatSync, mkdirSync, readFileSync, readdirSync, renameSync, rmSync, statSync, writeFileSync } from "node:fs";
@@ -5131,6 +5131,19 @@ function sessionsRoutes({ sessions, externalTools, redundantLayers }) {
5131
5131
  throw error;
5132
5132
  }
5133
5133
  } },
5134
+ "/sessions/branch": { POST: async (req, res) => {
5135
+ const body = await readJsonBody(req);
5136
+ const { chat, parent, atSeq } = typeof body === "object" && body !== null ? body : {};
5137
+ if (typeof chat !== "string" || typeof parent !== "string" || typeof atSeq !== "number" || !Number.isSafeInteger(atSeq) || atSeq < 0) return sendError(res, 400, "the request needs \"chat\", \"parent\" and a whole number \"atSeq\"");
5138
+ try {
5139
+ sendJson(res, 200, await sessions.branch(chat, parent, atSeq));
5140
+ } catch (error) {
5141
+ if (error instanceof SessionNotFoundError) return sendError(res, 404, error.message);
5142
+ if (error instanceof BranchError || error instanceof TimelineError) return sendError(res, 409, error.message);
5143
+ if (error instanceof AgentUnavailableError) return sendError(res, 503, error.message);
5144
+ throw error;
5145
+ }
5146
+ } },
5134
5147
  "/sessions/timeline/move": { POST: async (_req, res, url) => {
5135
5148
  try {
5136
5149
  sendJson(res, 200, await sessions.moveTimeline(url.searchParams.get("id") ?? "", url.searchParams.get("to") ?? ""));
@@ -5694,6 +5707,32 @@ async function deleteSession(deps, id) {
5694
5707
  await deps.purgeChat(chatSessionId(id));
5695
5708
  deps.state.deleteSession(directory, id);
5696
5709
  }
5710
+ // src/host/sessions/branch-session.ts
5711
+ /**
5712
+ * Adopts the story of `parent` into the chat DSH forked for it.
5713
+ *
5714
+ * The fork already made a copy by the time this runs, so a branch that cannot be adopted would leave
5715
+ * a chat with no story behind: it cannot be opened as a story and nothing would ever adopt it. Such a
5716
+ * copy is discarded. An unavailable agent is the exception — the copy is intact and the branch can be
5717
+ * tried again — so it is left in place.
5718
+ *
5719
+ * @throws {SessionNotFoundError} when either chat is not a chat of a story.
5720
+ * @throws {AgentUnavailableError} when the orchestration or the chat of the branch is not running.
5721
+ */
5722
+ async function branchSession(deps, chat, parent, atSeq) {
5723
+ const id = roleplaySessionOf(chat);
5724
+ if (id === void 0 || roleplaySessionOf(parent) === void 0) throw new SessionNotFoundError(`"${chat}" and "${parent}" are not both chats of stories`);
5725
+ const timelines = deps.timelines;
5726
+ const forked = deps.agentOf(chat);
5727
+ if (timelines === void 0 || forked === void 0) throw new AgentUnavailableError("the branch cannot be made: the orchestration or the chat of the branch is not running");
5728
+ try {
5729
+ await timelines.adopt(chat, parent, atSeq, forked);
5730
+ } catch (error) {
5731
+ if (!(error instanceof AgentUnavailableError)) await deps.discard(chat).catch(() => void 0);
5732
+ throw error;
5733
+ }
5734
+ return { id };
5735
+ }
5697
5736
  // src/host/storage/root-path.ts
5698
5737
  /** Directories every roleplay root contains. */
5699
5738
  const ROOT_LAYOUT = [
@@ -10344,6 +10383,13 @@ function apply(ctx, config) {
10344
10383
  readSettings: (id) => readChatSettings(settingsDeps, id),
10345
10384
  writeSettings: (id, value) => writeChatSettings(settingsDeps, id, value),
10346
10385
  timeline: (id) => timelinesOf(ctx, deps.sessionsDir, id).view(id),
10386
+ branch: async (chat, parent, atSeq) => {
10387
+ return await branchSession({
10388
+ timelines: ctx.roleplayOrchestration.timelines,
10389
+ agentOf: (chat) => ctx.get("agents")?.get(SessionId(chat)),
10390
+ discard: purgeChat
10391
+ }, chat, parent, atSeq);
10392
+ },
10347
10393
  moveTimeline: (id, to) => timelinesOf(ctx, deps.sessionsDir, id).move(chatSessionId(id), to === "start" ? null : to),
10348
10394
  markCheckpoint: (id, turn, label, note) => label.trim() === "" ? timelinesOf(ctx, deps.sessionsDir, id).unmark(chatSessionId(id), turn) : timelinesOf(ctx, deps.sessionsDir, id).mark(chatSessionId(id), turn, label, note),
10349
10395
  statistics: (id) => statisticsOfSession({
@@ -1,4 +1,4 @@
1
- import { j as roleplaySessionOf } from "./child-SMvjNsb8.js";
1
+ import { j as roleplaySessionOf } from "./child-Bfj7-Iuo.js";
2
2
  import { i as isInside } from "./service-mRKwpWjX.js";
3
3
  import { dirname, isAbsolute, resolve } from "node:path";
4
4
  import { readdirSync, realpathSync, statSync } from "node:fs";
@@ -104,4 +104,4 @@ function registerFoldersJail(ctx, deps) {
104
104
  }
105
105
  export { registerFoldersJail as t };
106
106
 
107
- //# sourceMappingURL=jail-CDW5iymd.js.map
107
+ //# sourceMappingURL=jail-D83JnxKg.js.map
@@ -1,4 +1,4 @@
1
- import { n as atomicWrite } from "./access-DjA0kvPM.js";
1
+ import { n as atomicWrite } from "./access-5vtPAT3O.js";
2
2
  import { i as translator, n as withoutExtension, r as languageOf, t as trimCharacters } from "./text-B-HsLdb-.js";
3
3
  import { dirname, extname, join } from "node:path";
4
4
  import { existsSync } from "node:fs";
@@ -374,4 +374,4 @@ async function addToLibrary(sessionFolder, bytes, originalName) {
374
374
  }
375
375
  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 };
376
376
 
377
- //# sourceMappingURL=library-D6AcyxGZ.js.map
377
+ //# sourceMappingURL=library-CnWOHwQl.js.map
@@ -1,9 +1,9 @@
1
- import "./access-DjA0kvPM.js";
2
- import { Wt as ImportCardError, o as contextOf, r as MAX_PREVIEW_TEXT } from "./authoring-tools-DqAttdUN.js";
3
- import { Et as IMPORT_FOLDER, St as cleanText, Tt as withPlayer, U as createPresetFromGuidance, _t as updateLorebookInfo, dn as LORE_SCOPES, ht as readLorebook$1, lt as deleteLorebookEntry, mt as lorebookDirectory, pt as loadLorebook, un as LORE_KINDS, ut as entriesOf, vt as writeLorebookEntry, wt as partsOf } from "./serial-Bh6gqb3f.js";
4
- import { F as textLanguage, I as wrongLanguage, at as shippedPromptsDirectory } from "./hooks-OLl-1AOS.js";
1
+ import "./access-5vtPAT3O.js";
2
+ import { Wt as ImportCardError, o as contextOf, r as MAX_PREVIEW_TEXT } from "./authoring-tools-BpkpGMSO.js";
3
+ import { Et as IMPORT_FOLDER, St as cleanText, Tt as withPlayer, U as createPresetFromGuidance, _t as updateLorebookInfo, dn as LORE_SCOPES, ht as readLorebook$1, lt as deleteLorebookEntry, mt as lorebookDirectory, pt as loadLorebook, un as LORE_KINDS, ut as entriesOf, vt as writeLorebookEntry, wt as partsOf } from "./serial-DnVqMDe5.js";
4
+ import { F as textLanguage, I as wrongLanguage, at as shippedPromptsDirectory } from "./hooks-P_--KSFl.js";
5
5
  import { i as translator, r as languageOf } from "./text-B-HsLdb-.js";
6
- import { C as slug, T as uniqueKey, w as trOf, x as mapLimit } from "./library-D6AcyxGZ.js";
6
+ import { C as slug, T as uniqueKey, w as trOf, x as mapLimit } from "./library-CnWOHwQl.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";
@@ -709,4 +709,4 @@ async function lorebookApproval(exec, next, state) {
709
709
  }
710
710
  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 };
711
711
 
712
- //# sourceMappingURL=lorebook-author-tools-CXV1KD4Q.js.map
712
+ //# sourceMappingURL=lorebook-author-tools-CWZ6WRN-.js.map
@@ -1,9 +1,9 @@
1
- import { n as limitAuthoringAgents } from "./authoring-tools-DqAttdUN.js";
2
- import { t as guardAuthoringTurns } from "./turn-guard-CNFvmz_F.js";
1
+ import { n as limitAuthoringAgents } from "./authoring-tools-BpkpGMSO.js";
2
+ import { t as guardAuthoringTurns } from "./turn-guard-D4YHE00t.js";
3
3
  import { n as silenceRuntimeContext, t as silenceHarnessDevContext } from "./dev-context-Cgv_wZbG.js";
4
- import { d as lorebookOfChat, i as lorebookAuthorTools, n as LorebookReader, o as pendingTargets, r as lorebookApproval } from "./lorebook-author-tools-CXV1KD4Q.js";
5
- import "./hooks-OLl-1AOS.js";
6
- import { mt as lorebookDirectory } from "./serial-Bh6gqb3f.js";
4
+ import { d as lorebookOfChat, i as lorebookAuthorTools, n as LorebookReader, o as pendingTargets, r as lorebookApproval } from "./lorebook-author-tools-CWZ6WRN-.js";
5
+ import "./hooks-P_--KSFl.js";
6
+ import { mt as lorebookDirectory } from "./serial-DnVqMDe5.js";
7
7
  import { join } from "node:path";
8
8
  import { existsSync, readdirSync } from "node:fs";
9
9
  // src/lorebook-authoring.ts
@@ -1,4 +1,4 @@
1
- import { i as atomicWriteSync } from "./access-DjA0kvPM.js";
1
+ import { i as atomicWriteSync } from "./access-5vtPAT3O.js";
2
2
  import { join } from "node:path";
3
3
  import { existsSync, readFileSync, statSync } from "node:fs";
4
4
  // ../dsh-roleplay-model/src/clock.ts
@@ -485,4 +485,4 @@ function decodeOutput(text) {
485
485
  }
486
486
  export { emptyStats as _, liveSettings as a, writeSettings as c, parseSettings as d, parseSwitchboard as f, GATE_SITES as g, DECISION_SITES as h, InvalidSettingsError as i, DEFAULT_SETTINGS as l, rulesOf as m, encodeOutput as n, readSettings as o, WORLD_RULES_KEY as p, encodePreview as r, useChildReasoning as s, decodeOutput as t, SETTINGS_SPEC as u };
487
487
 
488
- //# sourceMappingURL=narration-Bnrvl0UQ.js.map
488
+ //# sourceMappingURL=narration-DAHmte8p.js.map
@@ -1,17 +1,17 @@
1
1
  import { n as silenceRuntimeContext, t as silenceHarnessDevContext } from "./dev-context-Cgv_wZbG.js";
2
- import { t as promptFor } from "./access-DjA0kvPM.js";
3
- import { D as referent, E as sameWords, H as COMMANDS_KEY, I as wrongLanguage, O as RESULTS, U as commandFlagKey, W as commandsOf, _t as ClockError, a as MAX_OOC_ANSWER, bt as AUTHORING_NEEDS, d as record, f as toolEnabled, i as characterRunner, l as PREVIEW_TOOL, n as installHooks, o as externalGiven, ot as shippedText, p as storesOf, tt as languageOf, u as createTools$1, ut as ReflectionRefusedError, v as readVerdicts, vt as describeWhen, y as writeVerdicts, yt as zoneOf } from "./hooks-OLl-1AOS.js";
4
- import { A as chatSessionId, O as estimateAnswer, T as currentTurn, a as childTrace, d as sessionOfChat, f as tracerOf, j as roleplaySessionOf, k as tokensOf, l as runChild, n as childModel, r as childSampling, u as TurnTraces } from "./child-SMvjNsb8.js";
5
- import { a as whereabouts, n as memoryReflector, r as recordFailure, s as Timelines, t as dueReflection } from "./reflection-C3zdufN9.js";
6
- import { A as routeVerdicts, E as askYesNo, O as modeFor, T as announceProblem, Wt as splitPanels, j as yesAt, k as noAt, ln as guarded, mn as INTENT_STATUSES, n as STANDING_PROMPT } from "./serial-Bh6gqb3f.js";
2
+ import { t as promptFor } from "./access-5vtPAT3O.js";
3
+ import { D as referent, E as sameWords, H as COMMANDS_KEY, I as wrongLanguage, O as RESULTS, U as commandFlagKey, W as commandsOf, _t as ClockError, a as MAX_OOC_ANSWER, bt as AUTHORING_NEEDS, d as record, f as toolEnabled, i as characterRunner, l as PREVIEW_TOOL, n as installHooks, o as externalGiven, ot as shippedText, p as storesOf, tt as languageOf, u as createTools$1, ut as ReflectionRefusedError, v as readVerdicts, vt as describeWhen, y as writeVerdicts, yt as zoneOf } from "./hooks-P_--KSFl.js";
4
+ import { A as chatSessionId, O as estimateAnswer, T as currentTurn, a as childTrace, d as sessionOfChat, f as tracerOf, j as roleplaySessionOf, k as tokensOf, l as runChild, n as childModel, r as childSampling, u as TurnTraces } from "./child-Bfj7-Iuo.js";
5
+ import { a as whereabouts, n as memoryReflector, r as recordFailure, s as Timelines, t as dueReflection } from "./reflection-2uzE3U-v.js";
6
+ import { A as routeVerdicts, E as askYesNo, O as modeFor, T as announceProblem, Wt as splitPanels, j as yesAt, k as noAt, ln as guarded, mn as INTENT_STATUSES, n as STANDING_PROMPT } from "./serial-DnVqMDe5.js";
7
7
  import { i as translator, r as languageOf$1 } from "./text-B-HsLdb-.js";
8
- import { a as liveSettings, g as GATE_SITES, n as encodeOutput } from "./narration-Bnrvl0UQ.js";
9
- import { t as registerFoldersJail } from "./jail-CDW5iymd.js";
8
+ import { a as liveSettings, g as GATE_SITES, n as encodeOutput } from "./narration-DAHmte8p.js";
9
+ import { t as registerFoldersJail } from "./jail-D83JnxKg.js";
10
10
  import { a as workspaceOf, n as storyRoots } from "./service-mRKwpWjX.js";
11
- import { C as slug, T as uniqueKey, t as addToLibrary } from "./library-D6AcyxGZ.js";
12
- import { _ as API_PREFIX } from "./packs-DUVCSHqi.js";
13
- import { i as updateImage, r as listGallery, t as describeGalleryImage } from "./gallery-Dahi5TkO.js";
14
- import { c as presentedFor, i as findImages, n as interpretImage, s as present, t as runImagePresenter } from "./presenter-agent-CGCJrg7V.js";
11
+ import { C as slug, T as uniqueKey, t as addToLibrary } from "./library-CnWOHwQl.js";
12
+ import { _ as API_PREFIX } from "./packs-D9_N8kDF.js";
13
+ import { i as updateImage, r as listGallery, t as describeGalleryImage } from "./gallery-D0h0X7Jy.js";
14
+ import { c as presentedFor, i as findImages, n as interpretImage, s as present, t as runImagePresenter } from "./presenter-agent-BTpJxmGi.js";
15
15
  import { join } from "node:path";
16
16
  import { InvalidEditError, characterKey, createDiceTools, createTools, dayPart, describeDuration, describeHolder, describeInstant, describeValue, itemKey, judgedStatements, lintWorld, localTime, locationKey, mentioned, parseRecordsEdit, rollForCheck, seededRoll, sessionDatabase, sessionFolder, systemRoller } from "@dsh-agentic-roleplay/state";
17
17
  import { existsSync } from "node:fs";
@@ -1,14 +1,14 @@
1
- import { A as chatSessionId } from "./child-SMvjNsb8.js";
2
- import { $t as authoringChatSessionId, A as loadWorldParts, Bt as loadCommands, Ct as loadDice, D as worldFieldChanges, Dt as parseCalendarFile, Et as loadCalendar, F as editsSince, G as addressesToFetch, Ht as TRIGGERS_FILE_NAME, I as writeSnapshot, K as candidateUrls, Mt as UPDATE_FOLDER, Nt as baseId, O as editWorldInfo, Ot as CHARACTERS_DIR, P as recordProvenance, Pt as cardPieces, Q as writePortrait, Qt as authoredWorldOf, Rt as COMMANDS_FILE_NAME, St as DICE_FILE_NAME, T as matchPieces, Tt as CALENDAR_FILE_NAME, Ut as loadTriggers, Vt as parseCommandsFile, W as addressKey, Xt as DICE_READINGS, Y as mergeReports, Yt as DICE_COMPARISONS, Z as cardCharacter, Zt as DICE_RESULTS, _t as loadLocations, bt as FACTIONS_DIR, et as loadValidatedWorld, f as importPhase, gt as LOCATIONS_DIR, ht as routineProblems, kt as loadCharacters, nt as knowsCharacter, o as contextOf, q as fetchPictures, tt as withScratchStory, u as worldOf, vt as ITEMS_DIR, wt as parseDiceFile, xt as loadFactions, yt as loadItems, zt as commandVariable } from "./authoring-tools-DqAttdUN.js";
3
- import { $t as LOCATION_FILE_NAME, Et as IMPORT_FOLDER, Jt as loadVariables, M as WORLD_FILE_NAME, Mt as readImportFolder, N as parseWorldFile, Nt as writeChoices, Pt as InvalidEditProblems, Qt as parseLoreFile, Tt as withPlayer, Xt as variableProblems, Yt as parseVariablesFile, Zt as LORE_FILE_NAME, an as FACTION_FILE_NAME, at as writeWorldPrompt, bt as loadLore, cn as parseCharacterFile, en as parseLocationFile, kt as PICTURE_FILE, l as extractStyleFrom, on as parseFactionFile, qt as VARIABLES_FILE_NAME, rn as parseItemFile, sn as CHARACTER_FILE_NAME, tn as ITEM_FILE_NAME, xt as subfolders, yt as LORE_DIR } from "./serial-Bh6gqb3f.js";
4
- import { n as encodeOutput } from "./narration-Bnrvl0UQ.js";
5
- import { a as VARIABLE_KINDS, n as atomicWrite, o as VARIABLE_SUBJECTS, r as atomicWriteJson, s as VARIABLE_VISIBILITIES } from "./access-DjA0kvPM.js";
6
- 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, Z as PROMPTS_FOLDER, gt as runCommandLine, it as shippedLanguages, lt as InvalidWorldError, mt as CommandRefusedError, pt as WorldNotFoundError, q as formatIssue, st as AgentUnavailableError, z as loadPlots } from "./hooks-OLl-1AOS.js";
1
+ import { A as chatSessionId } from "./child-Bfj7-Iuo.js";
2
+ import { $t as authoringChatSessionId, A as loadWorldParts, Bt as loadCommands, Ct as loadDice, D as worldFieldChanges, Dt as parseCalendarFile, Et as loadCalendar, F as editsSince, G as addressesToFetch, Ht as TRIGGERS_FILE_NAME, I as writeSnapshot, K as candidateUrls, Mt as UPDATE_FOLDER, Nt as baseId, O as editWorldInfo, Ot as CHARACTERS_DIR, P as recordProvenance, Pt as cardPieces, Q as writePortrait, Qt as authoredWorldOf, Rt as COMMANDS_FILE_NAME, St as DICE_FILE_NAME, T as matchPieces, Tt as CALENDAR_FILE_NAME, Ut as loadTriggers, Vt as parseCommandsFile, W as addressKey, Xt as DICE_READINGS, Y as mergeReports, Yt as DICE_COMPARISONS, Z as cardCharacter, Zt as DICE_RESULTS, _t as loadLocations, bt as FACTIONS_DIR, et as loadValidatedWorld, f as importPhase, gt as LOCATIONS_DIR, ht as routineProblems, kt as loadCharacters, nt as knowsCharacter, o as contextOf, q as fetchPictures, tt as withScratchStory, u as worldOf, vt as ITEMS_DIR, wt as parseDiceFile, xt as loadFactions, yt as loadItems, zt as commandVariable } from "./authoring-tools-BpkpGMSO.js";
3
+ import { $t as LOCATION_FILE_NAME, Et as IMPORT_FOLDER, Jt as loadVariables, M as WORLD_FILE_NAME, Mt as readImportFolder, N as parseWorldFile, Nt as writeChoices, Pt as InvalidEditProblems, Qt as parseLoreFile, Tt as withPlayer, Xt as variableProblems, Yt as parseVariablesFile, Zt as LORE_FILE_NAME, an as FACTION_FILE_NAME, at as writeWorldPrompt, bt as loadLore, cn as parseCharacterFile, en as parseLocationFile, kt as PICTURE_FILE, l as extractStyleFrom, on as parseFactionFile, qt as VARIABLES_FILE_NAME, rn as parseItemFile, sn as CHARACTER_FILE_NAME, tn as ITEM_FILE_NAME, xt as subfolders, yt as LORE_DIR } from "./serial-DnVqMDe5.js";
4
+ import { n as encodeOutput } from "./narration-DAHmte8p.js";
5
+ import { a as VARIABLE_KINDS, n as atomicWrite, o as VARIABLE_SUBJECTS, r as atomicWriteJson, s as VARIABLE_VISIBILITIES } from "./access-5vtPAT3O.js";
6
+ 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, Z as PROMPTS_FOLDER, gt as runCommandLine, it as shippedLanguages, lt as InvalidWorldError, mt as CommandRefusedError, pt as WorldNotFoundError, q as formatIssue, st as AgentUnavailableError, z as loadPlots } from "./hooks-P_--KSFl.js";
7
7
  import { i as translator, r as languageOf } from "./text-B-HsLdb-.js";
8
- import { h as readImageFileMetadata, u as referenceImagePath, x as mapLimit } from "./library-D6AcyxGZ.js";
9
- import { n as readPreset } from "./preset-BYfXYvp0.js";
10
- import { _ as API_PREFIX, a as packIds, d as packPath, f as readPack, h as PACK_MEDIA_TYPES, l as isPackId } from "./packs-DUVCSHqi.js";
11
- import { a as uploadReferenceImage, t as generateReferenceImage } from "./generator-BvSZGpzy.js";
8
+ import { h as readImageFileMetadata, u as referenceImagePath, x as mapLimit } from "./library-CnWOHwQl.js";
9
+ import { n as readPreset } from "./preset-B69AXtip.js";
10
+ import { _ as API_PREFIX, a as packIds, d as packPath, f as readPack, h as PACK_MEDIA_TYPES, l as isPackId } from "./packs-D9_N8kDF.js";
11
+ import { a as uploadReferenceImage, t as generateReferenceImage } from "./generator-CAJkevKl.js";
12
12
  import { basename, dirname, extname, isAbsolute, join, relative, resolve, sep } from "node:path";
13
13
  import { readTriggerDefinition, triggerReferenceProblems } from "@dsh-agentic-roleplay/state";
14
14
  import { existsSync, lstatSync, statSync } from "node:fs";
@@ -3227,4 +3227,4 @@ function registerPackJail(ctx, deps) {
3227
3227
  }
3228
3228
  export { languageOfDocuments as $, generateWorldCharacterPortrait as A, deleteTriggerDocument as B, editWorldFaction as C, editWorldPlots as D, editWorldPlace as E, uploadWorldCharacterPortrait as F, parseVariablesEdit as G, writeTriggerDocument as H, uploadWorldEntityImage as I, PRESET_FILE as J, parseDiceEdit as K, worldCharacterPortraitFile as L, readWorldEditor as M, readWorldTrigger as N, editWorldRelation as O, removeWorldTrigger as P, translateTools as Q, worldEntityImageFile as R, editWorldCharacter as S, editWorldNarrationVoice as T, parseCalendarEdit as U, readTriggerDocuments as V, parseRoutineEdit as W, presetTools as X, presetMessage as Y, translateMessage as Z, readCalendarDocument as _, deleteWorldPackFile as a, startUpdate as at, readRoutines as b, createAuthoredEntity as c, authoringTitle as ct, replaceAuthoredEntity as d, agentServicesOf as dt, readWorldDocuments as et, editCalendar as f, DOCTOR_OPENING_SOURCE as ft, editVariables as g, editRoutine as h, checkWorldPack as i, revertUpdate as it, generateWorldEntityImage as j, editWorldThing as k, deleteAuthoredEntity as l, ensureAuthoringChat as lt, editDice as m, appendNarratedTurn as mt, packFileProblem as n, finishUpdate as nt, listWorldPacks as o, updateStatus as ot, editCommands as p, appendEmptyTurn as pt, parseCommandsEdit as q, registerPackJail as r, pendingUpdate as rt, AUTHORED_ENTITY_KINDS as s, AuthoringSessions as st, MAX_PACK_TEXT as t, findTargets as tt, readAuthoredEntityDocument as u, AgentSessions as ut, readCommandsDocument as v, editWorldLore as w, readVariables as x, readDiceDocument as y, writeWorldTrigger as z };
3229
3229
 
3230
- //# sourceMappingURL=pack-jail-CZAmlgE1.js.map
3230
+ //# sourceMappingURL=pack-jail-DSTyLhMc.js.map
@@ -1,4 +1,4 @@
1
- import { K as Reader } from "./hooks-OLl-1AOS.js";
1
+ import { K as Reader } from "./hooks-P_--KSFl.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-DUVCSHqi.js.map
839
+ //# sourceMappingURL=packs-D9_N8kDF.js.map
@@ -1,8 +1,8 @@
1
- import { n as atomicWrite, t as promptFor } from "./access-DjA0kvPM.js";
2
- import { l as runChild } from "./child-SMvjNsb8.js";
3
- import { n as generateTransientImage, t as generateReferenceImage } from "./generator-BvSZGpzy.js";
4
- import { i as updateImage, n as galleryFile, r as listGallery } from "./gallery-Dahi5TkO.js";
5
- import { c as nextSceneSerial, u as referenceImagePath } from "./library-D6AcyxGZ.js";
1
+ import { n as atomicWrite, t as promptFor } from "./access-5vtPAT3O.js";
2
+ import { l as runChild } from "./child-Bfj7-Iuo.js";
3
+ import { n as generateTransientImage, t as generateReferenceImage } from "./generator-CAJkevKl.js";
4
+ import { i as updateImage, n as galleryFile, r as listGallery } from "./gallery-D0h0X7Jy.js";
5
+ import { c as nextSceneSerial, u as referenceImagePath } from "./library-CnWOHwQl.js";
6
6
  import { join, relative, sep } from "node:path";
7
7
  import { characterKey, itemKey, locationKey } from "@dsh-agentic-roleplay/state";
8
8
  import { existsSync } from "node:fs";
@@ -845,4 +845,4 @@ async function runImagePresenter(job) {
845
845
  }
846
846
  export { searchImages as a, presentedFor as c, findImages as i, interpretImage as n, tokensOf as o, imageTools as r, present as s, runImagePresenter as t };
847
847
 
848
- //# sourceMappingURL=presenter-agent-CGCJrg7V.js.map
848
+ //# sourceMappingURL=presenter-agent-BTpJxmGi.js.map
@@ -1,6 +1,6 @@
1
- import { Wt as ImportCardError, r as MAX_PREVIEW_TEXT } from "./authoring-tools-DqAttdUN.js";
2
- import { p as SAMPLING_RANGES } from "./child-SMvjNsb8.js";
3
- import { St as cleanText } from "./serial-Bh6gqb3f.js";
1
+ import { Wt as ImportCardError, r as MAX_PREVIEW_TEXT } from "./authoring-tools-BpkpGMSO.js";
2
+ import { p as SAMPLING_RANGES } from "./child-Bfj7-Iuo.js";
3
+ import { St as cleanText } from "./serial-DnVqMDe5.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-BYfXYvp0.js.map
242
+ //# sourceMappingURL=preset-B69AXtip.js.map
@@ -1,9 +1,9 @@
1
- import "./access-DjA0kvPM.js";
2
- import { Et as IMPORT_FOLDER, H as PRESET_FILE, Tt as withPlayer, X as readPreset, Y as presetDirectory, at as writeWorldPrompt, et as updatePresetInfo, it as readWorldPrompt, l as extractStyleFrom, nt as deleteWorldPrompt, rt as listWorldPrompts, tt as PROSE_PROMPTS } from "./serial-Bh6gqb3f.js";
3
- import { n as readPreset$1 } from "./preset-BYfXYvp0.js";
4
- import { o as contextOf } from "./authoring-tools-DqAttdUN.js";
1
+ import "./access-5vtPAT3O.js";
2
+ import { Et as IMPORT_FOLDER, H as PRESET_FILE, Tt as withPlayer, X as readPreset, Y as presetDirectory, at as writeWorldPrompt, et as updatePresetInfo, it as readWorldPrompt, l as extractStyleFrom, nt as deleteWorldPrompt, rt as listWorldPrompts, tt as PROSE_PROMPTS } from "./serial-DnVqMDe5.js";
3
+ import { n as readPreset$1 } from "./preset-B69AXtip.js";
4
+ import { o as contextOf } from "./authoring-tools-BpkpGMSO.js";
5
5
  import { i as translator, r as languageOf } from "./text-B-HsLdb-.js";
6
- import { at as shippedPromptsDirectory, it as shippedLanguages, tt as languageOf$1 } from "./hooks-OLl-1AOS.js";
6
+ import { at as shippedPromptsDirectory, it as shippedLanguages, tt as languageOf$1 } from "./hooks-P_--KSFl.js";
7
7
  import { join } from "node:path";
8
8
  import { existsSync } from "node:fs";
9
9
  import { readFile, rm } from "node:fs/promises";
@@ -279,4 +279,4 @@ async function presetApproval(exec, next, carries, auto = () => false) {
279
279
  }
280
280
  export { presetChatSessionId as a, presetAuthorTools as i, narrationImportMessage as n, presetOfChat as o, presetApproval as r, PresetReader as t };
281
281
 
282
- //# sourceMappingURL=preset-author-tools-DYxTLm9U.js.map
282
+ //# sourceMappingURL=preset-author-tools-BJtt7D0J.js.map
@@ -1,9 +1,9 @@
1
- import { n as limitAuthoringAgents } from "./authoring-tools-DqAttdUN.js";
2
- import { t as guardAuthoringTurns } from "./turn-guard-CNFvmz_F.js";
1
+ import { n as limitAuthoringAgents } from "./authoring-tools-BpkpGMSO.js";
2
+ import { t as guardAuthoringTurns } from "./turn-guard-D4YHE00t.js";
3
3
  import { n as silenceRuntimeContext, t as silenceHarnessDevContext } from "./dev-context-Cgv_wZbG.js";
4
- import { i as presetAuthorTools, o as presetOfChat, r as presetApproval, t as PresetReader } from "./preset-author-tools-DYxTLm9U.js";
5
- import "./hooks-OLl-1AOS.js";
6
- import { Y as presetDirectory } from "./serial-Bh6gqb3f.js";
4
+ import { i as presetAuthorTools, o as presetOfChat, r as presetApproval, t as PresetReader } from "./preset-author-tools-BJtt7D0J.js";
5
+ import "./hooks-P_--KSFl.js";
6
+ import { Y as presetDirectory } from "./serial-DnVqMDe5.js";
7
7
  import { join } from "node:path";
8
8
  import { existsSync } from "node:fs";
9
9
  // src/preset-authoring.ts
@@ -1,10 +1,10 @@
1
- import { O as estimateAnswer, a as childTrace, j as roleplaySessionOf, l as runChild, n as childModel, r as childSampling } from "./child-SMvjNsb8.js";
2
- import { $ as sha, A as routeVerdicts, D as mergeReports, E as askYesNo, J as loadPreset, T as announceProblem, j as yesAt, k as noAt, q as listPresets, t as SerialQueue } from "./serial-Bh6gqb3f.js";
3
- import { t as promptFor } from "./access-DjA0kvPM.js";
4
- import { D as referent, I as wrongLanguage, Z as PROMPTS_FOLDER, et as inheritPrompts, vt as describeWhen } from "./hooks-OLl-1AOS.js";
1
+ import { O as estimateAnswer, a as childTrace, j as roleplaySessionOf, l as runChild, n as childModel, r as childSampling } from "./child-Bfj7-Iuo.js";
2
+ import { $ as sha, A as routeVerdicts, D as mergeReports, E as askYesNo, J as loadPreset, T as announceProblem, j as yesAt, k as noAt, q as listPresets, t as SerialQueue } from "./serial-DnVqMDe5.js";
3
+ import { t as promptFor } from "./access-5vtPAT3O.js";
4
+ import { D as referent, I as wrongLanguage, Z as PROMPTS_FOLDER, et as inheritPrompts, vt as describeWhen } from "./hooks-P_--KSFl.js";
5
5
  import { i as translator, r as languageOf } from "./text-B-HsLdb-.js";
6
- import { s as inheritImages } from "./library-D6AcyxGZ.js";
7
- import { i as inheritPacks } from "./packs-DUVCSHqi.js";
6
+ import { s as inheritImages } from "./library-CnWOHwQl.js";
7
+ import { i as inheritPacks } from "./packs-D9_N8kDF.js";
8
8
  import { dirname, join } from "node:path";
9
9
  import { characterKey, locationKey, sessionDatabase, sessionFolder, tokens } from "@dsh-agentic-roleplay/state";
10
10
  import { copyFileSync, existsSync, mkdirSync, readFileSync, renameSync, rmSync, writeFileSync } from "node:fs";
@@ -1502,6 +1502,6 @@ function memoryReflector(deps) {
1502
1502
  return { characters };
1503
1503
  } };
1504
1504
  }
1505
- export { snapshotOf as _, whereabouts as a, copyPreset as c, switchPreset as d, readTimeline as f, pathTo as g, childrenOf as h, reflectionStatus as i, presetStatus as l, START_SNAPSHOT as m, memoryReflector as n, TimelineError as o, writeTimeline as p, recordFailure as r, Timelines as s, dueReflection as t, recordPreset as u };
1505
+ export { pathTo as _, whereabouts as a, BranchError as c, recordPreset as d, switchPreset as f, childrenOf as g, START_SNAPSHOT as h, reflectionStatus as i, copyPreset as l, writeTimeline as m, memoryReflector as n, TimelineError as o, readTimeline as p, recordFailure as r, Timelines as s, dueReflection as t, presetStatus as u, snapshotOf as v };
1506
1506
 
1507
- //# sourceMappingURL=reflection-C3zdufN9.js.map
1507
+ //# sourceMappingURL=reflection-2uzE3U-v.js.map
@@ -1,9 +1,9 @@
1
- import { m as parseSampling } from "./child-SMvjNsb8.js";
2
- import { f as parseSwitchboard } from "./narration-Bnrvl0UQ.js";
3
- import { a as VARIABLE_KINDS, n as atomicWrite, o as VARIABLE_SUBJECTS, s as VARIABLE_VISIBILITIES } from "./access-DjA0kvPM.js";
4
- import { G as readDocument, J as errorMessage, K as Reader, X as LANGUAGE_TAG, Y as LANGUAGE_FOLDER, Z as PROMPTS_FOLDER, at as shippedPromptsDirectory, it as shippedLanguages, nt as listFiles, q as formatIssue, rt as promptProblem, tt as languageOf } from "./hooks-OLl-1AOS.js";
1
+ import { m as parseSampling } from "./child-Bfj7-Iuo.js";
2
+ import { f as parseSwitchboard } from "./narration-DAHmte8p.js";
3
+ import { a as VARIABLE_KINDS, n as atomicWrite, o as VARIABLE_SUBJECTS, s as VARIABLE_VISIBILITIES } from "./access-5vtPAT3O.js";
4
+ import { G as readDocument, J as errorMessage, K as Reader, X as LANGUAGE_TAG, Y as LANGUAGE_FOLDER, Z as PROMPTS_FOLDER, at as shippedPromptsDirectory, it as shippedLanguages, nt as listFiles, q as formatIssue, rt as promptProblem, tt as languageOf } from "./hooks-P_--KSFl.js";
5
5
  import { i as translator, r as languageOf$1 } from "./text-B-HsLdb-.js";
6
- import { C as slug, S as norm, T as uniqueKey, w as trOf, x as mapLimit } from "./library-D6AcyxGZ.js";
6
+ import { C as slug, S as norm, T as uniqueKey, w as trOf, x as mapLimit } from "./library-CnWOHwQl.js";
7
7
  import { dirname, join } from "node:path";
8
8
  import { MAX_ROUTINE_WINDOWS, createSessionStore, dayTokenProblems, isTimeZone, parseInstant, valueIssue } from "@dsh-agentic-roleplay/state";
9
9
  import { existsSync, readFileSync, readdirSync } from "node:fs";
@@ -5369,4 +5369,4 @@ var SerialQueue = class {
5369
5369
  };
5370
5370
  export { sha as $, LOCATION_FILE_NAME as $t, routeVerdicts as A, openingText as At, questionView as B, parseThingEdit as Bt, ROLE_TABLE as C, itemise as Ct, mergeReports as D, ImportNotFoundError as Dt, askYesNo as E, IMPORT_FOLDER as Et, parseWorldInfoEdit as F, parseCharacterEdit as Ft, deletePreset as G, dialectOf as Gt, PRESET_FILE as H, importRequestOf as Ht, hasSpeech as I, parseFactionEdit as It, loadPreset as J, loadVariables as Jt, isPresetName as K, sourceSummary as Kt, parseOpeningParts as L, parseLoreEdit as Lt, WORLD_FILE_NAME as M, readImportFolder as Mt, parseWorldFile as N, writeChoices as Nt, modeFor as O, ImportStore as Ot, MAX_OPENING_CHARS as P, InvalidEditProblems as Pt, savePresetFromWorld as Q, parseLoreFile as Qt, partsText as R, parsePlaceEdit as Rt, ROLES as S, cleanText as St, announceProblem as T, withPlayer as Tt, createPresetFromGuidance as U, findPanel as Ut, startQuestionsToFile as V, IMPORT_COMMAND as Vt, createPresetFromShipped as W, splitPanels as Wt, readPreset as X, variableProblems as Xt, presetDirectory as Y, parseVariablesFile as Yt, reservePreset as Z, LORE_FILE_NAME as Zt, pruneRelationships as _, updateLorebookInfo as _t, characterDocument as a, FACTION_FILE_NAME as an, writeWorldPrompt as at, classifyItems as b, loadLore as bt, extractStyle as c, parseCharacterFile as cn, deleteLorebook as ct, inert as d, LORE_SCOPES as dn, isLorebookName as dt, parseLocationFile as en, updatePresetInfo as et, loreDocuments as f, WEEKDAY_NAMES as fn, listLorebooks as ft, pruneMembers as g, reserveLorebook as gt, pruneLoreSubjects as h, readLorebook as ht, asWritten as i, parseSlotsFile as in, readWorldPrompt as it, yesAt as j, parseChoices as jt, noAt as k, PICTURE_FILE as kt, extractStyleFrom as l, guarded as ln, deleteLorebookEntry as lt, pruneLinks as m, INTENT_STATUSES as mn, lorebookDirectory as mt, STANDING_PROMPT as n, SLOTS_FILE_NAME as nn, deleteWorldPrompt as nt, emptyExtracted as o, parseFactionFile as on, addLorebookEntries as ot, pruneKnowledge as p, DEFAULT_SLOTS as pn, loadLorebook as pt, listPresets as q, VARIABLES_FILE_NAME as qt, addLore as r, parseItemFile as rn, listWorldPrompts as rt, extractEntities as s, CHARACTER_FILE_NAME as sn, createLorebook as st, SerialQueue as t, ITEM_FILE_NAME as tn, PROSE_PROMPTS as tt, extractVariables as u, LORE_KINDS as un, entriesOf as ut, sourcesFor as v, writeLorebookEntry as vt, isLeftOut as w, partsOf as wt, findEntity as x, subfolders as xt, buildRoster as y, LORE_DIR as yt, combineAnswers as z, parseRelationEdit as zt };
5371
5371
 
5372
- //# sourceMappingURL=serial-Bh6gqb3f.js.map
5372
+ //# sourceMappingURL=serial-DnVqMDe5.js.map
@@ -1,5 +1,5 @@
1
- import { D as finishOf, E as cutOff } from "./child-SMvjNsb8.js";
2
- import { r as guardRepeatedCalls } from "./hooks-OLl-1AOS.js";
1
+ import { D as finishOf, E as cutOff } from "./child-Bfj7-Iuo.js";
2
+ import { r as guardRepeatedCalls } from "./hooks-P_--KSFl.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-CNFvmz_F.js.map
52
+ //# sourceMappingURL=turn-guard-D4YHE00t.js.map