@dsh-agentic-roleplay/core 0.4.1 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/compaction.js CHANGED
@@ -1,4 +1,4 @@
1
- import { r as roleplaySessionOf, t as promptFor } from "./access-EbNdZFbk.js";
1
+ import { _ as roleplaySessionOf, h as tokensOf, n as childModel, o as runChild, r as childSampling, t as promptFor } from "./access-tN5D3WI8.js";
2
2
  import { a as liveSettings, t as decodeOutput } from "./narration-DstnwrvX.js";
3
3
  import { join } from "node:path";
4
4
  import { sessionFolder } from "@dsh-agentic-roleplay/state";
@@ -137,30 +137,23 @@ const SUMMARY_SCHEMA = {
137
137
  required: ["summary"],
138
138
  additionalProperties: false
139
139
  };
140
- /** Writes each passage with a one-shot sub-agent of the game master that has the chronicler's persona and no tools. */
141
- function subagentChronicler(subagents, parent, language) {
140
+ /** Writes each passage with a one-shot child of the game master that has the chronicler's persona and no tools of its own. */
141
+ function childChronicler(parent, settings) {
142
+ const language = settings.prompts.language;
142
143
  return { async write({ task, material, words }, signal) {
143
- const run = await subagents.start("spawn", {
144
+ const estimate = tokensOf(words * (language.toLowerCase().startsWith("zh") ? 1 : 6), language) + 8;
145
+ return (await runChild({
144
146
  parent,
145
147
  signal,
146
- label: "Chronicler",
147
- prompt: [{
148
- type: "text",
149
- text: `${task}\n\nWrite at most ${words} words.\n\n${material}`
150
- }],
148
+ reasoningEffort: settings.reasoning.children,
149
+ sampling: childSampling(settings, "records", estimate),
150
+ ...childModel(settings, "records"),
151
151
  persona: promptFor(parent, "roleplay/chronicler", language),
152
- toolFilter: { allow: [] },
153
- outputSchema: SUMMARY_SCHEMA
154
- });
155
- try {
156
- const result = await run.result;
157
- if (result.stopReason !== "completed") throw new Error(`the chronicler did not finish (${result.stopReason})`);
158
- const text = result.structured?.summary;
159
- if (typeof text !== "string" || text.trim() === "") throw new Error("the chronicler wrote nothing");
160
- return text;
161
- } finally {
162
- await run.dispose();
163
- }
152
+ prompt: `${task}\n\nWrite at most ${words} words.\n\n${material}`,
153
+ result: SUMMARY_SCHEMA,
154
+ beforeSubmit: (value) => value.summary?.trim() === "" ? "the passage is empty: write it" : void 0,
155
+ maxCalls: 3
156
+ })).summary;
164
157
  } };
165
158
  }
166
159
  //#endregion
@@ -299,8 +292,9 @@ var RoleplayCompaction = class extends BasicCompactionEngine {
299
292
  const fold = this.folds.get(agent.session.id);
300
293
  if (fold === void 0) return super.summarize(input, agent, signal);
301
294
  const story = this.ctx.roleplayState.openSession(this.sessionsDir(), fold.id);
302
- const { context, prompts } = liveSettings(fold.folder);
303
- const chronicler = subagentChronicler(this.ctx.subagents, agent, prompts.language);
295
+ const settings = liveSettings(fold.folder);
296
+ const { context, prompts } = settings;
297
+ const chronicler = childChronicler(agent, settings);
304
298
  const { playerInputs, transcript } = readFolded(input.messages);
305
299
  await foldSummaries({
306
300
  story,
package/lib/doctor.js CHANGED
@@ -1,6 +1,6 @@
1
- import { n as chatSessionId } from "./access-EbNdZFbk.js";
1
+ import { g as chatSessionId } from "./access-tN5D3WI8.js";
2
2
  import { a as liveSettings } from "./narration-DstnwrvX.js";
3
- import { i as externalTools, t as externalToolLimit } from "./hooks-CHmUksFS.js";
3
+ import { i as externalTools, t as externalToolLimit } from "./hooks-C7gt2c01.js";
4
4
  import { n as doctorSessionOf } from "./doctor-chat-ByDfCMeo.js";
5
5
  import { join } from "node:path";
6
6
  import { existsSync } from "node:fs";
@@ -1,4 +1,4 @@
1
- import { f as mediaTypeOf, h as writeImageFileMetadata, m as sidecarOf, p as readImageFileMetadata, r as LIBRARY_FOLDER, v as mapLimit } from "./library-COIktKBa.js";
1
+ import { f as mediaTypeOf, h as writeImageFileMetadata, m as sidecarOf, p as readImageFileMetadata, r as LIBRARY_FOLDER, v as mapLimit } from "./library-DsDc6fQa.js";
2
2
  import { join, sep } from "node:path";
3
3
  import { randomUUID } from "node:crypto";
4
4
  import { lstat, mkdir, readFile, readdir, realpath, rename, stat, writeFile } from "node:fs/promises";
@@ -192,4 +192,4 @@ async function updateImage(sessionFolder, path, update) {
192
192
  //#endregion
193
193
  export { updateImage as i, galleryFile as n, listGallery as r, describeGalleryImage as t };
194
194
 
195
- //# sourceMappingURL=gallery-CDYKJf_O.js.map
195
+ //# sourceMappingURL=gallery-C7VOJ3xH.js.map
@@ -1,4 +1,4 @@
1
- import { c as referenceImagePath, l as sceneImagePath, u as writeImage } from "./library-COIktKBa.js";
1
+ import { c as referenceImagePath, l as sceneImagePath, u as writeImage } from "./library-DsDc6fQa.js";
2
2
  //#region 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. */
@@ -142,4 +142,4 @@ async function generateTransientImage(service, request) {
142
142
  //#endregion
143
143
  export { uploadReferenceImage as a, transientPrompt as i, generateTransientImage as n, referencePrompt as r, generateReferenceImage as t };
144
144
 
145
- //# sourceMappingURL=generator-BR1ugzln.js.map
145
+ //# sourceMappingURL=generator-CO8usAjE.js.map
@@ -1,6 +1,6 @@
1
- import { r as roleplaySessionOf, t as promptFor } from "./access-EbNdZFbk.js";
1
+ import { _ as roleplaySessionOf, a as childTrace, d as NO_TOKENS, f as addTokens, m as estimateAnswer, n as childModel, o as runChild, r as childSampling, t as promptFor, u as tokensOf } from "./access-tN5D3WI8.js";
2
2
  import { a as liveSettings, m as rulesOf, n as encodeOutput, p as WORLD_RULES_KEY, r as encodePreview } from "./narration-DstnwrvX.js";
3
- import { a as runChild, d as addTokens, h as trimCharacters, i as childTrace, l as tokensOf, n as childSampling, p as estimateAnswer, t as childModel, u as NO_TOKENS } from "./child-DsixtqTw.js";
3
+ import { t as trimCharacters } from "./text-CT1re6XT.js";
4
4
  import { dirname, join } from "node:path";
5
5
  import { copyFileSync, cpSync, existsSync, mkdirSync, readFileSync, readdirSync, renameSync, rmSync, statSync, writeFileSync } from "node:fs";
6
6
  import { createUserMessage } from "@deepseek-ai/dsh-llm";
@@ -3691,4 +3691,4 @@ function installHooks(ctx, deps) {
3691
3691
  //#endregion
3692
3692
  export { promptProblem as $, PLOTS_METADATA_KEY as A, parsePlotsFile as B, observeAsPlayer as C, zoneOf as D, describeWhen as E, isStoryLanguage as F, errorMessage as G, readDocument as H, textLanguage as I, PromptLibrary as J, LANGUAGE_FOLDER as K, wrongLanguage as L, populatePlots as M, LANGUAGE_NAMES as N, RESULTS as O, STORY_LANGUAGES as P, listFiles as Q, PLOTS_FILE_NAME as R, readNotes as S, describeTime as T, Reader as U, plotReferenceProblems as V, formatIssue as W, inheritPrompts as X, copyWorldPrompts as Y, languageOf as Z, readVerdicts as _, externalWithheld as a, ReflectionRefusedError as at, addToNote as b, record as c, WorldNotFoundError as ct, toolEnabled as d, shippedLanguages as et, MAX_OOC_ANSWER as f, readRunDetail as g, readActivity as h, externalTools as i, InvalidWorldError as it, plotProgressOf as j, answerLimits as k, AUTHORING_NEEDS as l, languageOf$1 as lt, readUsage as m, installHooks as n, AgentUnavailableError as nt, PREVIEW_TOOL as o, SessionArchivedError as ot, storesOf as p, PROMPTS_FOLDER as q, externalGiven as r, InvalidStartError as rt, createTools$1 as s, SessionNotFoundError as st, externalToolLimit as t, shippedPromptsDirectory as tt, characterRunner as u, translator as ut, writeVerdicts as v, ClockError as w, notesOfSession as x, readWithdrawn as y, loadPlots as z };
3693
3693
 
3694
- //# sourceMappingURL=hooks-CHmUksFS.js.map
3694
+ //# sourceMappingURL=hooks-C7gt2c01.js.map
package/lib/images.js CHANGED
@@ -1,5 +1,5 @@
1
- import { _ as withPngMetadata, a as inheritImages, c as referenceImagePath, g as readPngMetadata, i as entityImageDirectory, l as sceneImagePath, o as nextSceneSerial, s as readImageMetadata, t as addToLibrary } from "./library-COIktKBa.js";
2
- import { i as transientPrompt, n as generateTransientImage, r as referencePrompt, t as generateReferenceImage } from "./generator-BR1ugzln.js";
3
- import { i as updateImage, r as listGallery } from "./gallery-CDYKJf_O.js";
4
- import { a as tokensOf, i as searchImages, n as interpretImage, o as present, r as imageTools, s as presentedFor, t as runImagePresenter } from "./presenter-agent-Gu34bZwd.js";
1
+ import { _ as withPngMetadata, a as inheritImages, c as referenceImagePath, g as readPngMetadata, i as entityImageDirectory, l as sceneImagePath, o as nextSceneSerial, s as readImageMetadata, t as addToLibrary } from "./library-DsDc6fQa.js";
2
+ import { i as transientPrompt, n as generateTransientImage, r as referencePrompt, t as generateReferenceImage } from "./generator-CO8usAjE.js";
3
+ import { i as updateImage, r as listGallery } from "./gallery-C7VOJ3xH.js";
4
+ import { a as tokensOf, i as searchImages, n as interpretImage, o as present, r as imageTools, s as presentedFor, t as runImagePresenter } from "./presenter-agent-BsC6Vftz.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,19 +1,19 @@
1
- import { n as chatSessionId, r as roleplaySessionOf } from "./access-EbNdZFbk.js";
2
- import { B as loadItems, Bt as ImportCardError, C as populateLocations, D as populateVariables, E as populateTriggers, Et as writeLorebookEntry, F as loadCalendar, Ft as parseLoreEdit, Gt as LORE_SCOPES, Ht as pictureOf, I as parseCalendarFile, It as parsePlaceEdit, J as withPlayer, Jt as DICE_RESULTS, Kt as DICE_COMPARISONS, Lt as parseRelationEdit, M as loadDice, Mt as InvalidEditProblems, N as parseDiceFile, Nt as parseCharacterEdit, O as routineProblems, P as CALENDAR_FILE_NAME, Pt as parseFactionEdit, Q as variableProblems, R as loadLocations, Rt as parseThingEdit, S as populateKnowledge, St as lorebookDirectory, T as populateRoutines, Tt as updateLorebookInfo, U as CHARACTERS_DIR, Ut as readCard, Vt as isPng, W as loadCharacters, Wt as LORE_KINDS, X as loadVariables, Y as VARIABLES_FILE_NAME, Z as parseVariablesFile, _ as populateCharacters, _t as deleteLorebookEntry, at as CHARACTER_FILE_NAME, b as populateFactions, bt as listLorebooks, ct as ImportNotFoundError, d as markReady, dt as WORLD_FILE_NAME, f as guardedLookup, ft as parseWorldFile, g as populateCalendar, gt as deleteLorebook, h as knowsCharacter, ht as createLorebook, j as DICE_FILE_NAME, jt as subfolders, k as TRIGGERS_FILE_NAME, l as authoringChatSessionId, lt as ImportStore, m as loadValidatedWorld, mt as addLorebookEntries, ot as parseCharacterFile, p as vetUrl, pt as parseWorldInfoEdit, q as partsOf, qt as DICE_READINGS, st as IMPORT_FOLDER, t as AuthoringTools, ut as parseChoices, v as populateClock, vt as entriesOf, w as populateLore, wt as reserveLorebook, x as populateItems, xt as loadLorebook, y as populateDice, yt as isLorebookName, zt as IMPORT_COMMAND } from "./authoring-tools-C2BHkEFP.js";
3
- import { _ as readWorldPrompt, a as isPresetName, c as presetDirectory, d as savePresetFromWorld, g as listWorldPrompts, h as deleteWorldPrompt, i as deletePreset, o as listPresets, p as updatePresetInfo, r as createPresetFromShipped, s as loadPreset, t as PRESET_FILE, u as reservePreset, v as writeWorldPrompt } from "./presets-Dc15L6OU.js";
4
- import { c as copyPreset, d as switchPreset, f as readTimeline, i as reflectionStatus, l as presetStatus, m as defaultBoundaries, o as TimelineError, p as pathTo, u as recordPreset } from "./reflection-BWMVdHhR.js";
1
+ import { _ as roleplaySessionOf, c as parseSampling, g as chatSessionId, i as childSamplingOf, l as sharedSamplingOf } from "./access-tN5D3WI8.js";
2
+ import { B as loadItems, Bt as ImportCardError, C as populateLocations, D as populateVariables, E as populateTriggers, Et as writeLorebookEntry, F as loadCalendar, Ft as parseLoreEdit, Gt as LORE_SCOPES, Ht as pictureOf, I as parseCalendarFile, It as parsePlaceEdit, J as withPlayer, Jt as DICE_RESULTS, Kt as DICE_COMPARISONS, Lt as parseRelationEdit, M as loadDice, Mt as InvalidEditProblems, N as parseDiceFile, Nt as parseCharacterEdit, O as routineProblems, P as CALENDAR_FILE_NAME, Pt as parseFactionEdit, Q as variableProblems, R as loadLocations, Rt as parseThingEdit, S as populateKnowledge, St as lorebookDirectory, T as populateRoutines, Tt as updateLorebookInfo, U as CHARACTERS_DIR, Ut as readCard, Vt as isPng, W as loadCharacters, Wt as LORE_KINDS, X as loadVariables, Y as VARIABLES_FILE_NAME, Z as parseVariablesFile, _ as populateCharacters, _t as deleteLorebookEntry, at as CHARACTER_FILE_NAME, b as populateFactions, bt as listLorebooks, ct as ImportNotFoundError, d as markReady, dt as WORLD_FILE_NAME, f as guardedLookup, ft as parseWorldFile, g as populateCalendar, gt as deleteLorebook, h as knowsCharacter, ht as createLorebook, j as DICE_FILE_NAME, jt as subfolders, k as TRIGGERS_FILE_NAME, l as authoringChatSessionId, lt as ImportStore, m as loadValidatedWorld, mt as addLorebookEntries, ot as parseCharacterFile, p as vetUrl, pt as parseWorldInfoEdit, q as partsOf, qt as DICE_READINGS, st as IMPORT_FOLDER, t as AuthoringTools, ut as parseChoices, v as populateClock, vt as entriesOf, w as populateLore, wt as reserveLorebook, x as populateItems, xt as loadLorebook, y as populateDice, yt as isLorebookName, zt as IMPORT_COMMAND } from "./authoring-tools-Ch_3oIKC.js";
3
+ import { _ as readWorldPrompt, a as isPresetName, c as presetDirectory, d as savePresetFromWorld, g as listWorldPrompts, h as deleteWorldPrompt, i as deletePreset, o as listPresets, p as updatePresetInfo, r as createPresetFromShipped, s as loadPreset, t as PRESET_FILE, u as reservePreset, v as writeWorldPrompt } from "./presets-CADd77WB.js";
4
+ import { c as copyPreset, d as switchPreset, f as readTimeline, i as reflectionStatus, l as presetStatus, m as defaultBoundaries, o as TimelineError, p as pathTo, u as recordPreset } from "./reflection-CUGuPAZR.js";
5
5
  import { _ as VARIABLE_VISIBILITIES, a as liveSettings, c as writeSettings, d as parseSettings, g as VARIABLE_SUBJECTS, h as VARIABLE_KINDS, i as InvalidSettingsError, l as DEFAULT_SETTINGS, n as encodeOutput, o as readSettings, p as WORLD_RULES_KEY, s as useChildReasoning, u as SETTINGS_SPEC } from "./narration-DstnwrvX.js";
6
- import { A as PLOTS_METADATA_KEY, B as parsePlotsFile, C as observeAsPlayer, D as zoneOf, G as errorMessage, H as readDocument, J as PromptLibrary, M as populatePlots, S as readNotes, V as plotReferenceProblems, W as formatIssue, Y as copyWorldPrompts, Z as languageOf, at as ReflectionRefusedError, b as addToNote, ct as WorldNotFoundError, et as shippedLanguages, g as readRunDetail, h as readActivity, i as externalTools, it as InvalidWorldError, j as plotProgressOf, m as readUsage, nt as AgentUnavailableError, ot as SessionArchivedError, rt as InvalidStartError, st as SessionNotFoundError, x as notesOfSession, y as readWithdrawn } from "./hooks-CHmUksFS.js";
7
- import { c as sharedSamplingOf, h as trimCharacters, r as childSamplingOf, s as parseSampling } from "./child-DsixtqTw.js";
8
- import { a as inheritImages, b as slug, c as referenceImagePath, l as sceneImagePath, t as addToLibrary, x as uniqueKey } from "./library-COIktKBa.js";
9
- import { A as worldEntityImageFile, B as readWorldInfo, C as readWorldEditor, D as uploadWorldCharacterPortrait, E as replaceFile, F as loadWorldParts, I as PRESET_FILE$1, L as presetMessage, O as uploadWorldEntityImage, S as generateWorldEntityImage, T as removeWorldTrigger, U as languageOfDocuments, V as translateMessage, W as readWorldDocuments, _ as editWorldPlots$1, a as deleteWorldPackFile, b as entityFolder, c as createAuthoredEntity, f as editWorldCharacter$1, g as editWorldPlace$1, h as editWorldNarrationVoice, j as writeWorldTrigger, k as worldCharacterPortraitFile, l as deleteAuthoredEntity, m as editWorldLore$1, n as packFileProblem, p as editWorldFaction$1, t as MAX_PACK_TEXT, u as readAuthoredEntityDocument, v as editWorldRelation$1, w as readWorldTrigger, x as generateWorldCharacterPortrait, y as editWorldThing$1, z as editWorldInfo } from "./pack-jail-CEDDI4Xw.js";
10
- import { n as readPreset, r as selectPrompts, t as previewPreset } from "./preset-BL1d40oG.js";
11
- import { a as lorebookImportMessage, d as selectEntries, l as previewLorebook, s as lorebookChatSessionId, t as LOREBOOK_UPLOAD, u as readLorebook } from "./lorebook-author-tools-CaT74Q7v.js";
12
- import { a as presetChatSessionId, n as narrationImportMessage } from "./preset-author-tools-B2wZXKZo.js";
6
+ import { A as PLOTS_METADATA_KEY, B as parsePlotsFile, C as observeAsPlayer, D as zoneOf, G as errorMessage, H as readDocument, J as PromptLibrary, M as populatePlots, S as readNotes, V as plotReferenceProblems, W as formatIssue, Y as copyWorldPrompts, Z as languageOf, at as ReflectionRefusedError, b as addToNote, ct as WorldNotFoundError, et as shippedLanguages, g as readRunDetail, h as readActivity, i as externalTools, it as InvalidWorldError, j as plotProgressOf, m as readUsage, nt as AgentUnavailableError, ot as SessionArchivedError, rt as InvalidStartError, st as SessionNotFoundError, x as notesOfSession, y as readWithdrawn } from "./hooks-C7gt2c01.js";
7
+ import { t as trimCharacters } from "./text-CT1re6XT.js";
8
+ import { a as inheritImages, b as slug, c as referenceImagePath, l as sceneImagePath, t as addToLibrary, x as uniqueKey } from "./library-DsDc6fQa.js";
9
+ import { A as worldEntityImageFile, B as readWorldInfo, C as readWorldEditor, D as uploadWorldCharacterPortrait, E as replaceFile, F as loadWorldParts, I as PRESET_FILE$1, L as presetMessage, O as uploadWorldEntityImage, S as generateWorldEntityImage, T as removeWorldTrigger, U as languageOfDocuments, V as translateMessage, W as readWorldDocuments, _ as editWorldPlots$1, a as deleteWorldPackFile, b as entityFolder, c as createAuthoredEntity, f as editWorldCharacter$1, g as editWorldPlace$1, h as editWorldNarrationVoice, j as writeWorldTrigger, k as worldCharacterPortraitFile, l as deleteAuthoredEntity, m as editWorldLore$1, n as packFileProblem, p as editWorldFaction$1, t as MAX_PACK_TEXT, u as readAuthoredEntityDocument, v as editWorldRelation$1, w as readWorldTrigger, x as generateWorldCharacterPortrait, y as editWorldThing$1, z as editWorldInfo } from "./pack-jail-AzR6dCNm.js";
10
+ import { n as readPreset, r as selectPrompts, t as previewPreset } from "./preset-Drfu_K-H.js";
11
+ import { a as lorebookImportMessage, d as selectEntries, l as previewLorebook, s as lorebookChatSessionId, t as LOREBOOK_UPLOAD, u as readLorebook } from "./lorebook-author-tools-DII7Xt7Q.js";
12
+ import { a as presetChatSessionId, n as narrationImportMessage } from "./preset-author-tools-CdIsFhQw.js";
13
13
  import { t as doctorChatSessionId } from "./doctor-chat-ByDfCMeo.js";
14
- 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-DB_9xiCp.js";
15
- import { a as uploadReferenceImage, t as generateReferenceImage } from "./generator-BR1ugzln.js";
16
- import { i as updateImage, n as galleryFile, r as listGallery } from "./gallery-CDYKJf_O.js";
14
+ 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-C7g534Mi.js";
15
+ import { a as uploadReferenceImage, t as generateReferenceImage } from "./generator-CO8usAjE.js";
16
+ import { i as updateImage, n as galleryFile, r as listGallery } from "./gallery-C7VOJ3xH.js";
17
17
  import { basename, dirname, extname, isAbsolute, join, normalize, relative, resolve, sep } from "node:path";
18
18
  import { cpSync, createReadStream, existsSync, mkdirSync, readFileSync, readdirSync, renameSync, statSync, writeFileSync } from "node:fs";
19
19
  import { createHash, randomBytes, randomUUID } from "node:crypto";
@@ -215,20 +215,30 @@ const AGENT_PRESET = "roleplay";
215
215
  async function isStored(persistence, sessionId) {
216
216
  return persistence?.stat !== void 0 && await persistence.stat(SessionId(sessionId)) !== void 0;
217
217
  }
218
- /** Create or adopt one named preset chat and only name it on first creation. */
218
+ /**
219
+ * Make sure one named preset chat belongs to its project, and only name it on first creation. DSH's `create` reuses a stored chat only while
220
+ * it has no turn and mints another id otherwise, so a chat that exists is never created again: one that is stored (it holds an opening) is
221
+ * attached to the project, and only a chat that does not exist is created.
222
+ */
219
223
  async function ensureAgentChat(services, request, knownProject) {
220
224
  const project = knownProject ?? await services.registry.create(request.projectPath, request.projectTitle);
221
225
  const existed = project.sessionIds.includes(request.sessionId);
222
- const { sessionId } = await services.controller.create({
223
- workspaceId: project.id,
224
- sessionId: request.sessionId,
225
- agentPreset: request.agentPreset
226
- });
226
+ if (!existed) {
227
+ if (await isStored(services.persistence, request.sessionId)) await project.attachSession(request.sessionId);
228
+ else {
229
+ const { sessionId } = await services.controller.create({
230
+ workspaceId: project.id,
231
+ sessionId: request.sessionId,
232
+ agentPreset: request.agentPreset
233
+ });
234
+ if (sessionId !== request.sessionId) throw new Error(`DSH made the chat "${sessionId}" instead of "${request.sessionId}", so the chat cannot be found again`);
235
+ }
236
+ }
227
237
  if (!existed || request.renameExisting === true) await services.controller.rename({
228
- sessionId,
238
+ sessionId: request.sessionId,
229
239
  title: request.title
230
240
  });
231
- return sessionId;
241
+ return request.sessionId;
232
242
  }
233
243
  /** Looks the services up on first use: profiles without the web app do not have them. */
234
244
  function agentServicesOf(ctx) {
@@ -1,4 +1,4 @@
1
- import { g as withoutExtension, h as trimCharacters } from "./child-DsixtqTw.js";
1
+ import { n as withoutExtension, t as trimCharacters } from "./text-CT1re6XT.js";
2
2
  import { dirname, extname, join } from "node:path";
3
3
  import { existsSync } from "node:fs";
4
4
  import { randomUUID } from "node:crypto";
@@ -332,4 +332,4 @@ async function addToLibrary(sessionFolder, bytes, originalName) {
332
332
  //#endregion
333
333
  export { withPngMetadata as _, inheritImages as a, slug as b, referenceImagePath as c, MEDIA_TYPES as d, mediaTypeOf as f, readPngMetadata as g, writeImageFileMetadata as h, entityImageDirectory as i, sceneImagePath as l, sidecarOf as m, imageExtensionOf as n, nextSceneSerial as o, readImageFileMetadata as p, LIBRARY_FOLDER as r, readImageMetadata as s, addToLibrary as t, writeImage as u, mapLimit as v, uniqueKey as x, norm as y };
334
334
 
335
- //# sourceMappingURL=library-COIktKBa.js.map
335
+ //# sourceMappingURL=library-DsDc6fQa.js.map
@@ -1,8 +1,8 @@
1
- import { Bt as ImportCardError, Ct as readLorebook$1, Et as writeLorebookEntry, Gt as LORE_SCOPES, J as withPlayer, K as cleanText, St as lorebookDirectory, Tt as updateLorebookInfo, Wt as LORE_KINDS, _t as deleteLorebookEntry, i as contextOf, q as partsOf, r as MAX_PREVIEW_TEXT, st as IMPORT_FOLDER, vt as entriesOf, xt as loadLorebook } from "./authoring-tools-C2BHkEFP.js";
2
- import { n as createPresetFromGuidance } from "./presets-Dc15L6OU.js";
1
+ import { Bt as ImportCardError, Ct as readLorebook$1, Et as writeLorebookEntry, Gt as LORE_SCOPES, J as withPlayer, K as cleanText, St as lorebookDirectory, Tt as updateLorebookInfo, Wt as LORE_KINDS, _t as deleteLorebookEntry, i as contextOf, q as partsOf, r as MAX_PREVIEW_TEXT, st as IMPORT_FOLDER, vt as entriesOf, xt as loadLorebook } from "./authoring-tools-Ch_3oIKC.js";
2
+ import { n as createPresetFromGuidance } from "./presets-CADd77WB.js";
3
3
  import "./narration-DstnwrvX.js";
4
- import { tt as shippedPromptsDirectory } from "./hooks-CHmUksFS.js";
5
- import { b as slug, v as mapLimit, x as uniqueKey } from "./library-COIktKBa.js";
4
+ import { tt as shippedPromptsDirectory } from "./hooks-C7gt2c01.js";
5
+ import { b as slug, v as mapLimit, x as uniqueKey } from "./library-DsDc6fQa.js";
6
6
  import { join } from "node:path";
7
7
  import { existsSync, readFileSync } from "node:fs";
8
8
  import { defineTool } from "@deepseek-ai/dsh-tools";
@@ -691,4 +691,4 @@ async function lorebookApproval(exec, next, state) {
691
691
  //#endregion
692
692
  export { lorebookImportMessage as a, lorebookOfChat as c, selectEntries as d, lorebookAuthorTools as i, previewLorebook as l, LorebookReader as n, pendingTargets as o, lorebookApproval as r, lorebookChatSessionId as s, LOREBOOK_UPLOAD as t, readLorebook as u };
693
693
 
694
- //# sourceMappingURL=lorebook-author-tools-CaT74Q7v.js.map
694
+ //# sourceMappingURL=lorebook-author-tools-DII7Xt7Q.js.map
@@ -1,6 +1,6 @@
1
- import { St as lorebookDirectory, n as limitAuthoringAgents } from "./authoring-tools-C2BHkEFP.js";
2
- import "./hooks-CHmUksFS.js";
3
- import { c as lorebookOfChat, i as lorebookAuthorTools, n as LorebookReader, o as pendingTargets, r as lorebookApproval } from "./lorebook-author-tools-CaT74Q7v.js";
1
+ import { St as lorebookDirectory, n as limitAuthoringAgents } from "./authoring-tools-Ch_3oIKC.js";
2
+ import "./hooks-C7gt2c01.js";
3
+ import { c as lorebookOfChat, i as lorebookAuthorTools, n as LorebookReader, o as pendingTargets, r as lorebookApproval } from "./lorebook-author-tools-DII7Xt7Q.js";
4
4
  import { join } from "node:path";
5
5
  import { existsSync, readdirSync } from "node:fs";
6
6
  //#region src/lorebook-authoring.ts
@@ -1,13 +1,12 @@
1
- import { n as chatSessionId, r as roleplaySessionOf, t as promptFor } from "./access-EbNdZFbk.js";
2
- import { b as INTENT_STATUSES } from "./presets-Dc15L6OU.js";
3
- import { a as whereabouts, g as referent, h as sameWords, n as memoryReflector, r as recordFailure, s as Timelines, t as dueReflection } from "./reflection-BWMVdHhR.js";
1
+ import { _ as roleplaySessionOf, a as childTrace, g as chatSessionId, h as tokensOf, m as estimateAnswer, n as childModel, o as runChild, p as currentTurn, r as childSampling, t as promptFor } from "./access-tN5D3WI8.js";
2
+ import { b as INTENT_STATUSES } from "./presets-CADd77WB.js";
3
+ import { a as whereabouts, g as referent, h as sameWords, n as memoryReflector, r as recordFailure, s as Timelines, t as dueReflection } from "./reflection-CUGuPAZR.js";
4
4
  import { a as liveSettings, n as encodeOutput } from "./narration-DstnwrvX.js";
5
- import { D as zoneOf, E as describeWhen, L as wrongLanguage, O as RESULTS, _ as readVerdicts, at as ReflectionRefusedError, c as record, d as toolEnabled, f as MAX_OOC_ANSWER, l as AUTHORING_NEEDS, lt as languageOf, n as installHooks, o as PREVIEW_TOOL, p as storesOf, r as externalGiven, s as createTools$1, u as characterRunner, ut as translator, v as writeVerdicts, w as ClockError } from "./hooks-CHmUksFS.js";
6
- import { a as runChild, f as currentTurn, i as childTrace, m as tokensOf, n as childSampling, p as estimateAnswer, t as childModel } from "./child-DsixtqTw.js";
7
- import { b as slug, t as addToLibrary, x as uniqueKey } from "./library-COIktKBa.js";
8
- import { _ as API_PREFIX } from "./packs-DB_9xiCp.js";
9
- import { i as updateImage, r as listGallery, t as describeGalleryImage } from "./gallery-CDYKJf_O.js";
10
- import { n as interpretImage, s as presentedFor, t as runImagePresenter } from "./presenter-agent-Gu34bZwd.js";
5
+ import { D as zoneOf, E as describeWhen, L as wrongLanguage, O as RESULTS, _ as readVerdicts, at as ReflectionRefusedError, c as record, d as toolEnabled, f as MAX_OOC_ANSWER, l as AUTHORING_NEEDS, lt as languageOf, n as installHooks, o as PREVIEW_TOOL, p as storesOf, r as externalGiven, s as createTools$1, u as characterRunner, ut as translator, v as writeVerdicts, w as ClockError } from "./hooks-C7gt2c01.js";
6
+ import { b as slug, t as addToLibrary, x as uniqueKey } from "./library-DsDc6fQa.js";
7
+ import { _ as API_PREFIX } from "./packs-C7g534Mi.js";
8
+ import { i as updateImage, r as listGallery, t as describeGalleryImage } from "./gallery-C7VOJ3xH.js";
9
+ import { n as interpretImage, s as presentedFor, t as runImagePresenter } from "./presenter-agent-BsC6Vftz.js";
11
10
  import { join } from "node:path";
12
11
  import { existsSync } from "node:fs";
13
12
  import { SessionId } from "@deepseek-ai/dsh-session";
@@ -3150,6 +3149,7 @@ var ImageJobs = class {
3150
3149
  };
3151
3150
  //#endregion
3152
3151
  //#region src/orchestration.ts
3152
+ const WORKING_DIRECTORY_CONTEXT = "working-directory:current";
3153
3153
  const name = "@dsh-agentic-roleplay/core/orchestration";
3154
3154
  /**
3155
3155
  * Mounted by the `roleplay` agent preset, so it applies to roleplay chats only.
@@ -3271,6 +3271,12 @@ function apply(ctx) {
3271
3271
  return resourceHint(ctx.tools.schemas(context.scope).map((tool) => tool.name), ctx.tools.schemas().map((tool) => tool.name), translator(languageOf(chat?.settings.prompts.language ?? "en")));
3272
3272
  }
3273
3273
  });
3274
+ ctx.systemPrompt.context({
3275
+ name: WORKING_DIRECTORY_CONTEXT,
3276
+ order: ctx.systemPrompt.getContextOrder("WORKING_DIRECTORY"),
3277
+ interpolate: false,
3278
+ text: ""
3279
+ });
3274
3280
  const toolDeps = {
3275
3281
  engine,
3276
3282
  boundaries,
@@ -1,12 +1,12 @@
1
- import { $ as LOCATION_FILE_NAME, A as loadTriggers, At as parseLoreFile, B as loadItems, C as populateLocations, D as populateVariables, Dt as LORE_DIR, F as loadCalendar, G as extractStyleFrom, H as loadFactions, J as withPlayer, L as LOCATIONS_DIR, Mt as InvalidEditProblems, Ot as loadLore, R as loadLocations, U as CHARACTERS_DIR, V as FACTIONS_DIR, W as loadCharacters, X as loadVariables, _ as populateCharacters, at as CHARACTER_FILE_NAME, c as authoredWorldOf, dt as WORLD_FILE_NAME, et as parseLocationFile, ft as parseWorldFile, h as knowsCharacter, i as contextOf, it as parseFactionFile, jt as subfolders, k as TRIGGERS_FILE_NAME, kt as LORE_FILE_NAME, m as loadValidatedWorld, nt as parseItemFile, ot as parseCharacterFile, rt as FACTION_FILE_NAME, s as worldOf, st as IMPORT_FOLDER, tt as ITEM_FILE_NAME, x as populateItems, z as ITEMS_DIR } from "./authoring-tools-C2BHkEFP.js";
2
- import { v as writeWorldPrompt } from "./presets-Dc15L6OU.js";
1
+ import { c as parseSampling } from "./access-tN5D3WI8.js";
2
+ import { $ as LOCATION_FILE_NAME, A as loadTriggers, At as parseLoreFile, B as loadItems, C as populateLocations, D as populateVariables, Dt as LORE_DIR, F as loadCalendar, G as extractStyleFrom, H as loadFactions, J as withPlayer, L as LOCATIONS_DIR, Mt as InvalidEditProblems, Ot as loadLore, R as loadLocations, U as CHARACTERS_DIR, V as FACTIONS_DIR, W as loadCharacters, X as loadVariables, _ as populateCharacters, at as CHARACTER_FILE_NAME, c as authoredWorldOf, dt as WORLD_FILE_NAME, et as parseLocationFile, ft as parseWorldFile, h as knowsCharacter, i as contextOf, it as parseFactionFile, jt as subfolders, k as TRIGGERS_FILE_NAME, kt as LORE_FILE_NAME, m as loadValidatedWorld, nt as parseItemFile, ot as parseCharacterFile, rt as FACTION_FILE_NAME, s as worldOf, st as IMPORT_FOLDER, tt as ITEM_FILE_NAME, x as populateItems, z as ITEMS_DIR } from "./authoring-tools-Ch_3oIKC.js";
3
+ import { v as writeWorldPrompt } from "./presets-CADd77WB.js";
3
4
  import { f as parseSwitchboard } from "./narration-DstnwrvX.js";
4
- import { B as parsePlotsFile, F as isStoryLanguage, I as textLanguage, N as LANGUAGE_NAMES, P as STORY_LANGUAGES, R as PLOTS_FILE_NAME, V as plotReferenceProblems, W as formatIssue, et as shippedLanguages, it as InvalidWorldError, q as PROMPTS_FOLDER, z as loadPlots } from "./hooks-CHmUksFS.js";
5
- import { s as parseSampling } from "./child-DsixtqTw.js";
6
- import { c as referenceImagePath, v as mapLimit } from "./library-COIktKBa.js";
7
- import { n as readPreset } from "./preset-BL1d40oG.js";
8
- import { _ as API_PREFIX, a as packIds, d as packPath, f as readPack, h as PACK_MEDIA_TYPES, l as isPackId } from "./packs-DB_9xiCp.js";
9
- import { a as uploadReferenceImage, t as generateReferenceImage } from "./generator-BR1ugzln.js";
5
+ import { B as parsePlotsFile, F as isStoryLanguage, I as textLanguage, N as LANGUAGE_NAMES, P as STORY_LANGUAGES, R as PLOTS_FILE_NAME, V as plotReferenceProblems, W as formatIssue, et as shippedLanguages, it as InvalidWorldError, q as PROMPTS_FOLDER, z as loadPlots } from "./hooks-C7gt2c01.js";
6
+ import { c as referenceImagePath, v as mapLimit } from "./library-DsDc6fQa.js";
7
+ import { n as readPreset } from "./preset-Drfu_K-H.js";
8
+ import { _ as API_PREFIX, a as packIds, d as packPath, f as readPack, h as PACK_MEDIA_TYPES, l as isPackId } from "./packs-C7g534Mi.js";
9
+ import { a as uploadReferenceImage, t as generateReferenceImage } from "./generator-CO8usAjE.js";
10
10
  import { basename, dirname, extname, isAbsolute, join, relative, resolve, sep } from "node:path";
11
11
  import { existsSync, lstatSync, statSync } from "node:fs";
12
12
  import { randomUUID } from "node:crypto";
@@ -2134,4 +2134,4 @@ function registerPackJail(ctx, deps) {
2134
2134
  //#endregion
2135
2135
  export { worldEntityImageFile as A, readWorldInfo as B, readWorldEditor as C, uploadWorldCharacterPortrait as D, replaceFile$1 as E, loadWorldParts as F, translateTools as H, PRESET_FILE as I, presetMessage as L, deleteTriggerDocument as M, readTriggerDocuments as N, uploadWorldEntityImage as O, writeTriggerDocument as P, presetTools as R, generateWorldEntityImage as S, removeWorldTrigger as T, languageOfDocuments as U, translateMessage as V, readWorldDocuments as W, editWorldPlots as _, deleteWorldPackFile as a, entityFolder as b, createAuthoredEntity as c, replaceAuthoredEntity as d, 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, registerPackJail as r, AUTHORED_ENTITY_KINDS as s, MAX_PACK_TEXT as t, readAuthoredEntityDocument as u, editWorldRelation as v, readWorldTrigger as w, generateWorldCharacterPortrait as x, editWorldThing as y, editWorldInfo as z };
2136
2136
 
2137
- //# sourceMappingURL=pack-jail-CEDDI4Xw.js.map
2137
+ //# sourceMappingURL=pack-jail-AzR6dCNm.js.map
@@ -1,4 +1,4 @@
1
- import { U as Reader } from "./hooks-CHmUksFS.js";
1
+ import { U as Reader } from "./hooks-C7gt2c01.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";
@@ -840,4 +840,4 @@ function anyTab(bases) {
840
840
  //#endregion
841
841
  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 };
842
842
 
843
- //# sourceMappingURL=packs-DB_9xiCp.js.map
843
+ //# sourceMappingURL=packs-C7g534Mi.js.map
@@ -1,8 +1,7 @@
1
- import { t as promptFor } from "./access-EbNdZFbk.js";
2
- import { a as runChild } from "./child-DsixtqTw.js";
3
- import { c as referenceImagePath, o as nextSceneSerial } from "./library-COIktKBa.js";
4
- import { n as generateTransientImage, t as generateReferenceImage } from "./generator-BR1ugzln.js";
5
- import { i as updateImage, n as galleryFile, r as listGallery } from "./gallery-CDYKJf_O.js";
1
+ import { o as runChild, t as promptFor } from "./access-tN5D3WI8.js";
2
+ import { c as referenceImagePath, o as nextSceneSerial } from "./library-DsDc6fQa.js";
3
+ import { n as generateTransientImage, t as generateReferenceImage } from "./generator-CO8usAjE.js";
4
+ import { i as updateImage, n as galleryFile, r as listGallery } from "./gallery-C7VOJ3xH.js";
6
5
  import { dirname, join, relative } from "node:path";
7
6
  import { existsSync } from "node:fs";
8
7
  import { createHash, randomUUID } from "node:crypto";
@@ -852,4 +851,4 @@ async function runImagePresenter(job) {
852
851
  //#endregion
853
852
  export { tokensOf as a, searchImages as i, interpretImage as n, present as o, imageTools as r, presentedFor as s, runImagePresenter as t };
854
853
 
855
- //# sourceMappingURL=presenter-agent-Gu34bZwd.js.map
854
+ //# sourceMappingURL=presenter-agent-BsC6Vftz.js.map
@@ -1,5 +1,5 @@
1
- import { Bt as ImportCardError, K as cleanText, r as MAX_PREVIEW_TEXT } from "./authoring-tools-C2BHkEFP.js";
2
- import { o as SAMPLING_RANGES } from "./child-DsixtqTw.js";
1
+ import { s as SAMPLING_RANGES } from "./access-tN5D3WI8.js";
2
+ import { Bt as ImportCardError, K as cleanText, r as MAX_PREVIEW_TEXT } from "./authoring-tools-Ch_3oIKC.js";
3
3
  //#region src/host/import/preset.ts
4
4
  /** The older preset layout keeps its texts under fixed keys. */
5
5
  const LEGACY_KEYS = [
@@ -239,4 +239,4 @@ function selectPrompts(file, enabled, keepSampling) {
239
239
  //#endregion
240
240
  export { readPreset as n, selectPrompts as r, previewPreset as t };
241
241
 
242
- //# sourceMappingURL=preset-BL1d40oG.js.map
242
+ //# sourceMappingURL=preset-Drfu_K-H.js.map
@@ -1,7 +1,7 @@
1
- import { G as extractStyleFrom, J as withPlayer, i as contextOf, st as IMPORT_FOLDER } from "./authoring-tools-C2BHkEFP.js";
2
- import { _ as readWorldPrompt, c as presetDirectory, g as listWorldPrompts, h as deleteWorldPrompt, l as readPreset, m as PROSE_PROMPTS, p as updatePresetInfo, t as PRESET_FILE, v as writeWorldPrompt } from "./presets-Dc15L6OU.js";
3
- import { Z as languageOf, et as shippedLanguages, tt as shippedPromptsDirectory } from "./hooks-CHmUksFS.js";
4
- import { n as readPreset$1 } from "./preset-BL1d40oG.js";
1
+ import { G as extractStyleFrom, J as withPlayer, i as contextOf, st as IMPORT_FOLDER } from "./authoring-tools-Ch_3oIKC.js";
2
+ import { _ as readWorldPrompt, c as presetDirectory, g as listWorldPrompts, h as deleteWorldPrompt, l as readPreset, m as PROSE_PROMPTS, p as updatePresetInfo, t as PRESET_FILE, v as writeWorldPrompt } from "./presets-CADd77WB.js";
3
+ import { Z as languageOf, et as shippedLanguages, tt as shippedPromptsDirectory } from "./hooks-C7gt2c01.js";
4
+ import { n as readPreset$1 } from "./preset-Drfu_K-H.js";
5
5
  import { join } from "node:path";
6
6
  import { existsSync } from "node:fs";
7
7
  import { defineTool } from "@deepseek-ai/dsh-tools";
@@ -273,4 +273,4 @@ async function presetApproval(exec, next, carries) {
273
273
  //#endregion
274
274
  export { presetChatSessionId as a, presetAuthorTools as i, narrationImportMessage as n, presetOfChat as o, presetApproval as r, PresetReader as t };
275
275
 
276
- //# sourceMappingURL=preset-author-tools-B2wZXKZo.js.map
276
+ //# sourceMappingURL=preset-author-tools-CdIsFhQw.js.map
@@ -1,7 +1,7 @@
1
- import { n as limitAuthoringAgents } from "./authoring-tools-C2BHkEFP.js";
2
- import { c as presetDirectory } from "./presets-Dc15L6OU.js";
3
- import "./hooks-CHmUksFS.js";
4
- import { i as presetAuthorTools, o as presetOfChat, r as presetApproval, t as PresetReader } from "./preset-author-tools-B2wZXKZo.js";
1
+ import { n as limitAuthoringAgents } from "./authoring-tools-Ch_3oIKC.js";
2
+ import { c as presetDirectory } from "./presets-CADd77WB.js";
3
+ import "./hooks-C7gt2c01.js";
4
+ import { i as presetAuthorTools, o as presetOfChat, r as presetApproval, t as PresetReader } from "./preset-author-tools-CdIsFhQw.js";
5
5
  import { join } from "node:path";
6
6
  import { existsSync } from "node:fs";
7
7
  //#region src/preset-authoring.ts
@@ -1,5 +1,5 @@
1
- import { $ as promptProblem, K as LANGUAGE_FOLDER, Q as listFiles, Z as languageOf, et as shippedLanguages, q as PROMPTS_FOLDER, tt as shippedPromptsDirectory } from "./hooks-CHmUksFS.js";
2
- import { s as parseSampling } from "./child-DsixtqTw.js";
1
+ import { c as parseSampling } from "./access-tN5D3WI8.js";
2
+ import { $ as promptProblem, K as LANGUAGE_FOLDER, Q as listFiles, Z as languageOf, et as shippedLanguages, q as PROMPTS_FOLDER, tt as shippedPromptsDirectory } from "./hooks-C7gt2c01.js";
3
3
  import { dirname, join } from "node:path";
4
4
  import { existsSync, readFileSync, readdirSync } from "node:fs";
5
5
  import { createHash } from "node:crypto";
@@ -354,4 +354,4 @@ async function createPresetFromGuidance(root, request, guidance, shipped = shipp
354
354
  //#endregion
355
355
  export { readWorldPrompt as _, isPresetName as a, INTENT_STATUSES as b, presetDirectory as c, savePresetFromWorld as d, sha as f, listWorldPrompts as g, deleteWorldPrompt as h, deletePreset as i, readPreset as l, PROSE_PROMPTS as m, createPresetFromGuidance as n, listPresets as o, updatePresetInfo as p, createPresetFromShipped as r, loadPreset as s, PRESET_FILE as t, reservePreset as u, writeWorldPrompt as v, INTENT_TYPES as x, INTENT_HORIZONS as y };
356
356
 
357
- //# sourceMappingURL=presets-Dc15L6OU.js.map
357
+ //# sourceMappingURL=presets-CADd77WB.js.map
@@ -1,10 +1,10 @@
1
- import { r as roleplaySessionOf, t as promptFor } from "./access-EbNdZFbk.js";
2
- import { f as sha, o as listPresets, s as loadPreset } from "./presets-Dc15L6OU.js";
1
+ import { _ as roleplaySessionOf, a as childTrace, m as estimateAnswer, n as childModel, o as runChild, r as childSampling, t as promptFor } from "./access-tN5D3WI8.js";
2
+ import { f as sha, o as listPresets, s as loadPreset } from "./presets-CADd77WB.js";
3
3
  import "./narration-DstnwrvX.js";
4
- import { E as describeWhen, L as wrongLanguage, T as describeTime, X as inheritPrompts, k as answerLimits, lt as languageOf, q as PROMPTS_FOLDER, ut as translator } from "./hooks-CHmUksFS.js";
5
- import { a as runChild, h as trimCharacters, i as childTrace, n as childSampling, p as estimateAnswer, t as childModel } from "./child-DsixtqTw.js";
6
- import { a as inheritImages } from "./library-COIktKBa.js";
7
- import { i as inheritPacks } from "./packs-DB_9xiCp.js";
4
+ import { E as describeWhen, L as wrongLanguage, T as describeTime, X as inheritPrompts, k as answerLimits, lt as languageOf, q as PROMPTS_FOLDER, ut as translator } from "./hooks-C7gt2c01.js";
5
+ import { t as trimCharacters } from "./text-CT1re6XT.js";
6
+ import { a as inheritImages } from "./library-DsDc6fQa.js";
7
+ import { i as inheritPacks } from "./packs-C7g534Mi.js";
8
8
  import { dirname, join } from "node:path";
9
9
  import { copyFileSync, existsSync, mkdirSync, readFileSync, renameSync, rmSync, writeFileSync } from "node:fs";
10
10
  import { createUserMessage } from "@deepseek-ai/dsh-llm";
@@ -1996,4 +1996,4 @@ function memoryReflector(deps) {
1996
1996
  //#endregion
1997
1997
  export { whereabouts as a, copyPreset as c, switchPreset as d, readTimeline as f, referent as g, sameWords as h, reflectionStatus as i, presetStatus as l, defaultBoundaries as m, memoryReflector as n, TimelineError as o, pathTo as p, recordFailure as r, Timelines as s, dueReflection as t, recordPreset as u };
1998
1998
 
1999
- //# sourceMappingURL=reflection-BWMVdHhR.js.map
1999
+ //# sourceMappingURL=reflection-CUGuPAZR.js.map
@@ -0,0 +1,18 @@
1
+ //#region src/shared/text.ts
2
+ /** Remove characters from either end without a backtracking regular expression. */
3
+ function trimCharacters(value, characters, edge = "both") {
4
+ let start = 0;
5
+ let end = value.length;
6
+ if (edge !== "end") while (start < end && characters.includes(value[start])) start += 1;
7
+ if (edge !== "start") while (end > start && characters.includes(value[end - 1])) end -= 1;
8
+ return value.slice(start, end);
9
+ }
10
+ /** A path-like name without its last extension. */
11
+ function withoutExtension(value) {
12
+ const dot = value.lastIndexOf(".");
13
+ return dot < 0 ? value : value.slice(0, dot);
14
+ }
15
+ //#endregion
16
+ export { withoutExtension as n, trimCharacters as t };
17
+
18
+ //# sourceMappingURL=text-CT1re6XT.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dsh-agentic-roleplay/core",
3
- "version": "0.4.1",
3
+ "version": "0.5.0",
4
4
  "description": "Core plugin of the agentic roleplay bundle for DeepSeek Harness: roleplay UI, orchestration and storage.",
5
5
  "author": {
6
6
  "name": "Firefox2100",
@@ -21,9 +21,6 @@
21
21
  "./package.json": "./package.json"
22
22
  },
23
23
  "dsh": {
24
- "engines": {
25
- "dsh": ">=0.2.0-rc.2 <0.2.1"
26
- },
27
24
  "bundle": {
28
25
  "patch": "./cordis.patch.yml"
29
26
  },
@@ -38,7 +35,8 @@
38
35
  }
39
36
  },
40
37
  "engines": {
41
- "node": ">=22"
38
+ "node": ">=22",
39
+ "dsh": ">=0.2.1-rc.2 <0.2.2"
42
40
  },
43
41
  "repository": {
44
42
  "type": "git",
@@ -73,46 +71,44 @@
73
71
  ],
74
72
  "license": "GPL-3.0-only",
75
73
  "peerDependencies": {
76
- "@deepseek-ai/dsh": ">=0.2.0-rc.2 <0.2.1",
77
- "@deepseek-ai/schemastery": "^3.18.4"
74
+ "@deepseek-ai/dsh": ">=0.2.1-rc.2 <0.2.2",
75
+ "@deepseek-ai/schemastery": "^3.18.5"
78
76
  },
79
77
  "dependencies": {
80
- "@dsh-agentic-roleplay/state": "0.4.1",
81
- "@dsh-ai-providers/core": "^0.1.2"
78
+ "@dsh-agentic-roleplay/state": "0.5.0",
79
+ "@dsh-ai-providers/core": "^0.3.0"
82
80
  },
83
81
  "devDependencies": {
84
- "@deepseek-ai/cordis": "^4.0.4",
85
- "@deepseek-ai/cordis-plugin-loader": "^1.0.5",
86
- "@deepseek-ai/dsh-agent": "0.2.0-rc.2",
87
- "@deepseek-ai/dsh-agent-loop": "0.2.0-rc.2",
88
- "@deepseek-ai/dsh-api-remotes": "0.2.0-rc.2",
89
- "@deepseek-ai/dsh-client-locale": "0.2.0-rc.2",
90
- "@deepseek-ai/dsh-client-store": "0.2.0-rc.2",
91
- "@deepseek-ai/dsh-client-ui-chat": "0.2.0-rc.2",
92
- "@deepseek-ai/dsh-client-ui-conversation": "0.2.0-rc.2",
93
- "@deepseek-ai/dsh-client-ui-layout": "0.2.0-rc.2",
94
- "@deepseek-ai/dsh-client-ui-primitives": "0.2.0-rc.2",
95
- "@deepseek-ai/dsh-client-ui-renderer": "0.2.0-rc.2",
96
- "@deepseek-ai/dsh-client-ui-session": "0.2.0-rc.2",
97
- "@deepseek-ai/dsh-client-ui-settings": "0.2.0-rc.2",
98
- "@deepseek-ai/dsh-client-ui-sidebar": "0.2.0-rc.2",
99
- "@deepseek-ai/dsh-client-ui-sidebar-right": "0.2.0-rc.2",
100
- "@deepseek-ai/dsh-client-ui-slots": "0.2.0-rc.2",
101
- "@deepseek-ai/dsh-compaction": "0.2.0-rc.2",
102
- "@deepseek-ai/dsh-compaction-basic": "0.2.0-rc.2",
103
- "@deepseek-ai/dsh-host-webserver": "0.2.0-rc.2",
104
- "@deepseek-ai/dsh-invariants": "0.2.0-rc.2",
105
- "@deepseek-ai/dsh-llm": "0.2.0-rc.2",
106
- "@deepseek-ai/dsh-session": "0.2.0-rc.2",
107
- "@deepseek-ai/dsh-session-projection": "0.2.0-rc.2",
108
- "@deepseek-ai/dsh-subagent": "0.2.0-rc.2",
109
- "@deepseek-ai/dsh-subagent-in-process-driver": "0.2.0-rc.2",
110
- "@deepseek-ai/dsh-subagent-spawn-in-process": "0.2.0-rc.2",
111
- "@deepseek-ai/dsh-system-prompt": "0.2.0-rc.2",
112
- "@deepseek-ai/dsh-token-meter": "0.2.0-rc.2",
113
- "@deepseek-ai/dsh-tools": "0.2.0-rc.2",
114
- "@deepseek-ai/dsh-user-approval": "0.2.0-rc.2",
115
- "@deepseek-ai/schemastery": "^3.18.4",
82
+ "@deepseek-ai/cordis": "^4.0.5",
83
+ "@deepseek-ai/cordis-plugin-loader": "^1.0.6",
84
+ "@deepseek-ai/dsh-agent": "0.2.1-rc.2",
85
+ "@deepseek-ai/dsh-agent-loop": "0.2.1-rc.2",
86
+ "@deepseek-ai/dsh-api-remotes": "0.2.1-rc.2",
87
+ "@deepseek-ai/dsh-client-locale": "0.2.1-rc.2",
88
+ "@deepseek-ai/dsh-client-store": "0.2.1-rc.2",
89
+ "@deepseek-ai/dsh-client-ui-chat": "0.2.1-rc.2",
90
+ "@deepseek-ai/dsh-client-ui-conversation": "0.2.1-rc.2",
91
+ "@deepseek-ai/dsh-client-ui-layout": "0.2.1-rc.2",
92
+ "@deepseek-ai/dsh-client-ui-primitives": "0.2.1-rc.2",
93
+ "@deepseek-ai/dsh-client-ui-renderer": "0.2.1-rc.2",
94
+ "@deepseek-ai/dsh-client-ui-session": "0.2.1-rc.2",
95
+ "@deepseek-ai/dsh-client-ui-settings": "0.2.1-rc.2",
96
+ "@deepseek-ai/dsh-client-ui-sidebar": "0.2.1-rc.2",
97
+ "@deepseek-ai/dsh-client-ui-sidebar-right": "0.2.1-rc.2",
98
+ "@deepseek-ai/dsh-client-ui-slots": "0.2.1-rc.2",
99
+ "@deepseek-ai/dsh-compaction": "0.2.1-rc.2",
100
+ "@deepseek-ai/dsh-compaction-basic": "0.2.1-rc.2",
101
+ "@deepseek-ai/dsh-host-webserver": "0.2.1-rc.2",
102
+ "@deepseek-ai/dsh-llm": "0.2.1-rc.2",
103
+ "@deepseek-ai/dsh-session": "0.2.1-rc.2",
104
+ "@deepseek-ai/dsh-session-projection": "0.2.1-rc.2",
105
+ "@deepseek-ai/dsh-subagent": "0.2.1-rc.2",
106
+ "@deepseek-ai/dsh-subagent-spawn-in-process": "0.2.1-rc.2",
107
+ "@deepseek-ai/dsh-system-prompt": "0.2.1-rc.2",
108
+ "@deepseek-ai/dsh-token-meter": "0.2.1-rc.2",
109
+ "@deepseek-ai/dsh-tools": "0.2.1-rc.2",
110
+ "@deepseek-ai/dsh-user-approval": "0.2.1-rc.2",
111
+ "@deepseek-ai/schemastery": "^3.18.5",
116
112
  "@types/node": "^22.20.0",
117
113
  "@types/react": "~18.3.1",
118
114
  "dsh-roleplay-model": "0.0.0",