@dsh-agentic-roleplay/core 0.12.4 → 0.12.5

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 (31) hide show
  1. package/lib/{access-Csp80TFX.js → access-DjA0kvPM.js} +2 -2
  2. package/lib/{authoring-tools-B_qYKK8c.js → authoring-tools-DqAttdUN.js} +21 -14
  3. package/lib/authoring.js +8 -8
  4. package/lib/{child-DTdY14S9.js → child-SMvjNsb8.js} +63 -9
  5. package/lib/client.js +1637 -1189
  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-Bu6eZMKk.js → gallery-Dahi5TkO.js} +3 -3
  10. package/lib/{generator-CTWQWbSW.js → generator-BvSZGpzy.js} +2 -2
  11. package/lib/helper.js +2 -2
  12. package/lib/{hooks-YXQZ9G2d.js → hooks-OLl-1AOS.js} +67 -28
  13. package/lib/images.js +4 -4
  14. package/lib/index.js +24 -18
  15. package/lib/{jail-DVbPSC0R.js → jail-CDW5iymd.js} +2 -2
  16. package/lib/{library-BmlHNCah.js → library-D6AcyxGZ.js} +3 -3
  17. package/lib/{lorebook-author-tools-C3rRpMt7.js → lorebook-author-tools-CXV1KD4Q.js} +7 -7
  18. package/lib/lorebook-authoring.js +5 -5
  19. package/lib/{narration--K2XVIHI.js → narration-Bnrvl0UQ.js} +2 -2
  20. package/lib/orchestration.js +37 -38
  21. package/lib/{pack-jail-VbcXiukr.js → pack-jail-CZAmlgE1.js} +15 -15
  22. package/lib/{packs-CzVh2ZNe.js → packs-DUVCSHqi.js} +2 -2
  23. package/lib/{presenter-agent-CF3fneuJ.js → presenter-agent-CGCJrg7V.js} +7 -6
  24. package/lib/{preset-C595KRUM.js → preset-BYfXYvp0.js} +4 -4
  25. package/lib/{preset-author-tools-CF_JKKTE.js → preset-author-tools-DYxTLm9U.js} +7 -7
  26. package/lib/preset-authoring.js +5 -5
  27. package/lib/{reflection-ByIQSOKC.js → reflection-C3zdufN9.js} +8 -8
  28. package/lib/{serial-ULGUKWsu.js → serial-Bh6gqb3f.js} +114 -25
  29. package/lib/{text-hiKTooVb.js → text-B-HsLdb-.js} +2 -1
  30. package/lib/{turn-guard-DXMeAJdv.js → turn-guard-CNFvmz_F.js} +3 -3
  31. package/package.json +2 -2
package/lib/compaction.js CHANGED
@@ -1,6 +1,6 @@
1
- import { a as liveSettings, t as decodeOutput } from "./narration--K2XVIHI.js";
2
- import { j as roleplaySessionOf, k as tokensOf, l as runChild, n as childModel, r as childSampling } from "./child-DTdY14S9.js";
3
- import { t as promptFor } from "./access-Csp80TFX.js";
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";
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-DTdY14S9.js";
2
+ import { A as chatSessionId } from "./child-SMvjNsb8.js";
3
3
  import { n as doctorSessionOf } from "./doctor-chat-hL1a61hp.js";
4
- import { s as externalTools, t as externalToolLimit } from "./hooks-YXQZ9G2d.js";
5
- import { a as liveSettings } from "./narration--K2XVIHI.js";
4
+ import { s as externalTools, t as externalToolLimit } from "./hooks-OLl-1AOS.js";
5
+ import { a as liveSettings } from "./narration-Bnrvl0UQ.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-Csp80TFX.js";
2
- import { _ as writeImageFileMetadata, a as LIBRARY_FOLDER, g as sidecarOf, h as readImageFileMetadata, m as mediaTypeOf, x as mapLimit } from "./library-BmlHNCah.js";
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";
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-Bu6eZMKk.js.map
190
+ //# sourceMappingURL=gallery-Dahi5TkO.js.map
@@ -1,4 +1,4 @@
1
- import { d as sceneImagePath, f as writeImage, u as referenceImagePath } from "./library-BmlHNCah.js";
1
+ import { d as sceneImagePath, f as writeImage, u as referenceImagePath } from "./library-D6AcyxGZ.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-CTWQWbSW.js.map
150
+ //# sourceMappingURL=generator-BvSZGpzy.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-DTdY14S9.js";
2
+ import { o as helpers } from "./child-SMvjNsb8.js";
3
3
  import { a as workspaceOf, n as storyRoots } from "./service-mRKwpWjX.js";
4
- import { t as registerFoldersJail } from "./jail-DVbPSC0R.js";
4
+ import { t as registerFoldersJail } from "./jail-CDW5iymd.js";
5
5
  import { join } from "node:path";
6
6
  import { sessionFolder } from "@dsh-agentic-roleplay/state";
7
7
  // src/helper.ts
@@ -1,12 +1,13 @@
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-DTdY14S9.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--K2XVIHI.js";
3
- import { t as promptFor } from "./access-Csp80TFX.js";
4
- import { i as translator, r as languageOf$1, t as trimCharacters } from "./text-hiKTooVb.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-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";
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";
7
7
  import { DAY, ENGAGEMENT_GRACE, ITEM_ACTIONS, MINUTE, SECOND, addLocalDays, agendaAt, announcements, applyItemPlan, changeItem, changeVariable, clockTime, createCharacterTools, createDiceTools, createTools, dayPart, describeDuration, describeInstant, describeValue, holidaysOn, inAudience, isSessionId, itemKey, localTime, locationKey, mentioned, nextOccurrence, nextTimeOfDay, occurrenceAt, overlap, parseInstant, planItemChange, planVariableChange, readCalendar, rollPlain, seasonOf, sessionDatabase, sessionFolder, shownVariables, tokens } from "@dsh-agentic-roleplay/state";
8
8
  import { copyFileSync, cpSync, existsSync, mkdirSync, readFileSync, readdirSync, renameSync, rmSync, statSync, writeFileSync } from "node:fs";
9
9
  import { readFile, stat } from "node:fs/promises";
10
+ import { parseCommand } from "@deepseek-ai/dsh-commands";
10
11
  import { ReasoningEffortId, createUserMessage } from "@deepseek-ai/dsh-llm";
11
12
  import { defineTool } from "@deepseek-ai/dsh-tools";
12
13
  import { fileURLToPath } from "node:url";
@@ -195,29 +196,44 @@ function skipTime(session, config, turn, round, wall, request) {
195
196
  }
196
197
  // src/host/commands/registry.ts
197
198
  /**
199
+ * The handlers this plugin registered. A caller outside the input box runs a line only when the command it names is one of ours: a slash line of the profile's own (DSH's `/compact`,
200
+ * `/goal`) stays a message there, so an API call or a benchmark script cannot compact a story by saying something that looks like a command.
201
+ */
202
+ const ownHandlers = /* @__PURE__ */ new WeakSet();
203
+ /** The registration of one spec, with the handler marked as the plugin's own. */
204
+ function definitionOf(spec) {
205
+ const handler = (call) => spec.handler(call);
206
+ ownHandlers.add(handler);
207
+ return {
208
+ name: spec.name,
209
+ description: spec.description,
210
+ input: { hint: spec.hint },
211
+ ...spec.recordInput === void 0 ? {} : { recordInput: spec.recordInput },
212
+ handler
213
+ };
214
+ }
215
+ /**
198
216
  * Registers the commands of the plugin's scope with DSH while the registry exists: they are listed, completed and run by the interface, and a command is not sent to the model.
199
217
  * A plugin mounted by an agent preset registers them for that preset's agents only.
200
218
  */
201
219
  function registerCommands(ctx, specs) {
202
220
  ctx.inject(["commands"], (scope) => {
203
- for (const spec of specs) scope.effect(() => scope.commands.register({
204
- name: spec.name,
205
- description: spec.description,
206
- input: { hint: spec.hint },
207
- ...spec.recordInput === void 0 ? {} : { recordInput: spec.recordInput },
208
- handler: (call) => spec.handler(call)
209
- }), `roleplay: /${spec.name}`);
221
+ for (const spec of specs) scope.effect(() => scope.commands.register(definitionOf(spec)), `roleplay: /${spec.name}`);
210
222
  });
211
223
  }
212
224
  /** The registry of the running profile, or nothing when it has none. */
213
225
  const registryOf = (ctx) => ctx.get("commands");
214
226
  /**
215
227
  * Runs a line the way the input box does when the agent knows the command it starts, for callers that are not the input box (the plugin's own starts, the HTTP API, the benchmark).
216
- * Nothing when the line is no command of this agent; the caller then sends it on as a message.
228
+ * Nothing when the line is not a command of this plugin for this agent; the caller then sends it on as a message.
217
229
  */
218
230
  async function runCommandLine(ctx, agent, line, signal) {
219
231
  const registry = registryOf(ctx);
220
232
  if (registry === void 0) return void 0;
233
+ const parsed = parseCommand(line);
234
+ if (parsed === void 0) return void 0;
235
+ const found = registry.find(agent, parsed.name);
236
+ if (found === void 0 || !ownHandlers.has(found.handler)) return void 0;
221
237
  return (await registry.execute(agent, line, [], signal))?.result;
222
238
  }
223
239
  /** A command that was run from outside the input box and refused: what it says is for the person. */
@@ -225,18 +241,16 @@ var CommandRefusedError = class extends Error {};
225
241
  /**
226
242
  * Registers commands for one agent only, through the agent's own context: they are listed and run for that chat and for no other, and go with the agent. For commands that depend on
227
243
  * what the chat holds (the commands a world defines).
244
+ *
245
+ * The registration has two owners on purpose: the agent's context ends it with the chat, and the plugin's own effect ends it when the plugin unloads while the chat is still open. Without
246
+ * the second, a reloaded plugin would leave a command of the previous copy answering in that chat.
228
247
  */
229
- function registerAgentCommands(agent, specs) {
248
+ function registerAgentCommands(ctx, agent, specs) {
230
249
  if (specs.length === 0) return;
231
- agent.ctx.inject(["commands"], (scope) => {
232
- for (const spec of specs) scope.effect(() => scope.commands.register({
233
- name: spec.name,
234
- description: spec.description,
235
- input: { hint: spec.hint },
236
- ...spec.recordInput === void 0 ? {} : { recordInput: spec.recordInput },
237
- handler: (call) => spec.handler(call)
238
- }), `roleplay: /${spec.name}`);
250
+ const registration = agent.ctx.inject(["commands"], (scope) => {
251
+ for (const spec of specs) scope.effect(() => scope.commands.register(definitionOf(spec)), `roleplay: /${spec.name}`);
239
252
  });
253
+ ctx.effect(() => () => registration.dispose().catch(() => void 0), "roleplay: agent commands");
240
254
  }
241
255
  // src/host/sessions/errors.ts
242
256
  var WorldNotFoundError = class extends Error {};
@@ -4369,22 +4383,47 @@ const UNITS = [
4369
4383
  /**
4370
4384
  * The wait in what a player typed after `/wait` (`2 hours`, `30m until the ferry`, `3天`). The time may be missing or unreadable, and is then `undefined` in `minutes`.
4371
4385
  */
4386
+ const isDigit = (char) => char >= "0" && char <= "9";
4387
+ const isSpace = (char) => char.trim() === "";
4388
+ const LETTER = /^\p{L}$/u;
4389
+ const isLetter = (char) => LETTER.test(char);
4390
+ /**
4391
+ * The wait in what a player typed after `/wait` (`2 hours`, `30m until the ferry`, `3天`). The time may be missing or unreadable, and is then `undefined` in `minutes`.
4392
+ * Read by scanning rather than by one regular expression, so that a long line of digits cannot make the matcher backtrack over itself.
4393
+ */
4372
4394
  function waitArguments(rawInput) {
4373
4395
  const body = rawInput.trim();
4374
- const match = /^(\d+(?:\.\d+)?)\s*([\p{L}]+)\s*(.*)$/su.exec(body);
4375
- if (match === null) return {
4396
+ let at = 0;
4397
+ while (at < body.length && isDigit(body[at])) at += 1;
4398
+ if (at === 0) return {
4399
+ minutes: void 0,
4400
+ reason: body
4401
+ };
4402
+ let whole = body.slice(0, at);
4403
+ if (body[at] === ".") {
4404
+ let fraction = at + 1;
4405
+ while (fraction < body.length && isDigit(body[fraction])) fraction += 1;
4406
+ if (fraction > at + 1) {
4407
+ whole = body.slice(0, fraction);
4408
+ at = fraction;
4409
+ }
4410
+ }
4411
+ while (at < body.length && isSpace(body[at])) at += 1;
4412
+ const unitStart = at;
4413
+ while (at < body.length && isLetter(body[at])) at += 1;
4414
+ if (at === unitStart) return {
4376
4415
  minutes: void 0,
4377
4416
  reason: body
4378
4417
  };
4379
- const unit = UNITS.find(([pattern]) => pattern.test(match[2]));
4418
+ const unit = UNITS.find(([pattern]) => pattern.test(body.slice(unitStart, at)));
4380
4419
  if (unit === void 0) return {
4381
4420
  minutes: void 0,
4382
4421
  reason: body
4383
4422
  };
4384
- const minutes = Math.round(Number(match[1]) * unit[1]);
4423
+ const minutes = Math.round(Number(whole) * unit[1]);
4385
4424
  return {
4386
4425
  minutes: minutes >= 1 && minutes <= 525600 ? minutes : void 0,
4387
- reason: match[3].trim()
4426
+ reason: body.slice(at).trim()
4388
4427
  };
4389
4428
  }
4390
4429
  // src/host/orchestration/player-commands.ts
@@ -4720,7 +4759,7 @@ function installHooks(ctx, deps) {
4720
4759
  if (store === void 0) return;
4721
4760
  registerConditionalTools(agent, conditionsOf(agent.session.id));
4722
4761
  applyLimit(agent, store);
4723
- registerAgentCommands(agent, worldCommands(intents, store.commands?.() ?? []));
4762
+ registerAgentCommands(ctx, agent, worldCommands(intents, store.commands?.() ?? []));
4724
4763
  });
4725
4764
  /** Where the open turn of each chat began, so its own events can be read back without walking the whole log. */
4726
4765
  const openTurns = /* @__PURE__ */ new Map();
@@ -5010,4 +5049,4 @@ function installHooks(ctx, deps) {
5010
5049
  }
5011
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 };
5012
5051
 
5013
- //# sourceMappingURL=hooks-YXQZ9G2d.js.map
5052
+ //# sourceMappingURL=hooks-OLl-1AOS.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-CF3fneuJ.js";
2
- import { i as updateImage, r as listGallery } from "./gallery-Bu6eZMKk.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-BmlHNCah.js";
4
- import { i as transientPrompt, n as generateTransientImage, r as referencePrompt, t as generateReferenceImage } from "./generator-CTWQWbSW.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-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";
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-DTdY14S9.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-B_qYKK8c.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-C3rRpMt7.js";
4
- import { a as presetChatSessionId, n as narrationImportMessage, o as presetOfChat } from "./preset-author-tools-CF_JKKTE.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-YXQZ9G2d.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--K2XVIHI.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-ULGUKWsu.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-VbcXiukr.js";
9
- import { i as atomicWriteSync, n as atomicWrite, r as atomicWriteJson } from "./access-Csp80TFX.js";
10
- import { i as translator, r as languageOf$1, t as trimCharacters } from "./text-hiKTooVb.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-ByIQSOKC.js";
12
- import { n as readPreset, r as selectPrompts, t as previewPreset } from "./preset-C595KRUM.js";
13
- import { C as slug, T as uniqueKey, d as sceneImagePath, s as inheritImages, t as addToLibrary, u as referenceImagePath } from "./library-BmlHNCah.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-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";
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";
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-CzVh2ZNe.js";
17
- import { a as uploadReferenceImage, t as generateReferenceImage } from "./generator-CTWQWbSW.js";
18
- import { i as updateImage, n as galleryFile, r as listGallery } from "./gallery-Bu6eZMKk.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";
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";
@@ -3119,7 +3119,11 @@ async function sendPackFile(api, path, res) {
3119
3119
  function speechRoutes({ speech }) {
3120
3120
  return {
3121
3121
  "/speech/capabilities": { GET: async (_req, res) => {
3122
- sendJson(res, 200, { streaming: speech.streaming() });
3122
+ sendJson(res, 200, {
3123
+ streaming: speech.streaming(),
3124
+ synthesis: speech.synthesis(),
3125
+ images: speech.images()
3126
+ });
3123
3127
  } },
3124
3128
  "/speech/voices": { GET: async (_req, res) => {
3125
3129
  sendJson(res, 200, await speech.voices());
@@ -10052,7 +10056,9 @@ function apply(ctx, config) {
10052
10056
  speech: {
10053
10057
  voices: async () => await voicesOf(textToSpeechOf(ctx)),
10054
10058
  speak: async (parts) => await speakParts(textToSpeechOf(ctx), parts),
10055
- streaming: () => streamingSpeechToTextOf(ctx) !== void 0
10059
+ streaming: () => streamingSpeechToTextOf(ctx) !== void 0,
10060
+ synthesis: () => ctx.get("textToSpeech") !== void 0,
10061
+ images: () => ctx.get("imageGeneration") !== void 0
10056
10062
  },
10057
10063
  worlds,
10058
10064
  createWorld: (input) => createWorld(worlds, input),
@@ -1,4 +1,4 @@
1
- import { j as roleplaySessionOf } from "./child-DTdY14S9.js";
1
+ import { j as roleplaySessionOf } from "./child-SMvjNsb8.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-DVbPSC0R.js.map
107
+ //# sourceMappingURL=jail-CDW5iymd.js.map
@@ -1,5 +1,5 @@
1
- import { n as atomicWrite } from "./access-Csp80TFX.js";
2
- import { i as translator, n as withoutExtension, r as languageOf, t as trimCharacters } from "./text-hiKTooVb.js";
1
+ import { n as atomicWrite } from "./access-DjA0kvPM.js";
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";
5
5
  import { createHash } from "node:crypto";
@@ -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-BmlHNCah.js.map
377
+ //# sourceMappingURL=library-D6AcyxGZ.js.map
@@ -1,9 +1,9 @@
1
- import "./access-Csp80TFX.js";
2
- import { Wt as ImportCardError, o as contextOf, r as MAX_PREVIEW_TEXT } from "./authoring-tools-B_qYKK8c.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-ULGUKWsu.js";
4
- import { F as textLanguage, I as wrongLanguage, at as shippedPromptsDirectory } from "./hooks-YXQZ9G2d.js";
5
- import { i as translator, r as languageOf } from "./text-hiKTooVb.js";
6
- import { C as slug, T as uniqueKey, w as trOf, x as mapLimit } from "./library-BmlHNCah.js";
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";
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";
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-C3rRpMt7.js.map
712
+ //# sourceMappingURL=lorebook-author-tools-CXV1KD4Q.js.map
@@ -1,9 +1,9 @@
1
- import { n as limitAuthoringAgents } from "./authoring-tools-B_qYKK8c.js";
2
- import { t as guardAuthoringTurns } from "./turn-guard-DXMeAJdv.js";
1
+ import { n as limitAuthoringAgents } from "./authoring-tools-DqAttdUN.js";
2
+ import { t as guardAuthoringTurns } from "./turn-guard-CNFvmz_F.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-C3rRpMt7.js";
5
- import "./hooks-YXQZ9G2d.js";
6
- import { mt as lorebookDirectory } from "./serial-ULGUKWsu.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";
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-Csp80TFX.js";
1
+ import { i as atomicWriteSync } from "./access-DjA0kvPM.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--K2XVIHI.js.map
488
+ //# sourceMappingURL=narration-Bnrvl0UQ.js.map
@@ -1,17 +1,17 @@
1
- import { t as silenceHarnessDevContext } from "./dev-context-Cgv_wZbG.js";
2
- import { t as promptFor } from "./access-Csp80TFX.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-YXQZ9G2d.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-DTdY14S9.js";
5
- import { a as whereabouts, n as memoryReflector, r as recordFailure, s as Timelines, t as dueReflection } from "./reflection-ByIQSOKC.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-ULGUKWsu.js";
7
- import { i as translator, r as languageOf$1 } from "./text-hiKTooVb.js";
8
- import { a as liveSettings, g as GATE_SITES, n as encodeOutput } from "./narration--K2XVIHI.js";
9
- import { t as registerFoldersJail } from "./jail-DVbPSC0R.js";
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";
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";
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-BmlHNCah.js";
12
- import { _ as API_PREFIX } from "./packs-CzVh2ZNe.js";
13
- import { i as updateImage, r as listGallery, t as describeGalleryImage } from "./gallery-Bu6eZMKk.js";
14
- import { c as presentedFor, i as findImages, n as interpretImage, s as present, t as runImagePresenter } from "./presenter-agent-CF3fneuJ.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";
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";
@@ -4328,24 +4328,29 @@ var ImageJobs = class {
4328
4328
  this.failures.delete(this.key(id, node));
4329
4329
  const request = output.segments.map((segment) => segment.type === "utterance" ? `${segment.name}: “${segment.text}”` : segment.text).join("\n");
4330
4330
  const reuse = automatic && settings.images.reuse;
4331
- const present$1 = () => (this.deps.presenter ?? runImagePresenter)({
4332
- parent,
4333
- signal: controller.signal,
4334
- service: withPriority(service, priority, settings.images.highRes),
4335
- story: this.deps.state.openSession(this.deps.sessionsDir(), id),
4336
- root: sessionFolder(this.deps.sessionsDir(), id),
4337
- turn,
4338
- timelineNode: node,
4339
- request,
4340
- purpose: "transient",
4341
- reuse,
4342
- language: settings.prompts.language,
4343
- sampling: childSampling(settings, "records"),
4344
- referenceMode: settings.images.references,
4345
- ...reuse && this.deps.attachments?.() !== void 0 ? { attachments: this.deps.attachments() } : {},
4346
- ...reuse && this.deps.embedder?.() !== void 0 ? { embedder: this.deps.embedder() } : {},
4347
- ...settings.reasoning.children === "" ? {} : { reasoningEffort: settings.reasoning.children }
4348
- });
4331
+ const tr = translator(languageOf$1(settings.prompts.language));
4332
+ const present$1 = () => {
4333
+ const turns = store();
4334
+ return (this.deps.presenter ?? runImagePresenter)({
4335
+ parent,
4336
+ signal: controller.signal,
4337
+ service: withPriority(service, priority, settings.images.highRes),
4338
+ story: this.deps.state.openSession(this.deps.sessionsDir(), id),
4339
+ root: sessionFolder(this.deps.sessionsDir(), id),
4340
+ turn,
4341
+ timelineNode: node,
4342
+ request,
4343
+ purpose: "transient",
4344
+ reuse,
4345
+ language: settings.prompts.language,
4346
+ ...turns === void 0 ? {} : { trace: childTrace(turns, "records", tr("Scene picture")) },
4347
+ sampling: childSampling(settings, "records"),
4348
+ referenceMode: settings.images.references,
4349
+ ...reuse && this.deps.attachments?.() !== void 0 ? { attachments: this.deps.attachments() } : {},
4350
+ ...reuse && this.deps.embedder?.() !== void 0 ? { embedder: this.deps.embedder() } : {},
4351
+ ...settings.reasoning.children === "" ? {} : { reasoningEffort: settings.reasoning.children }
4352
+ });
4353
+ };
4349
4354
  const store = () => this.deps.turnStore?.(chatSessionId(id));
4350
4355
  const begin = () => {
4351
4356
  const make = () => reuse && settings.images.interpret && this.deps.attachments?.() !== void 0 ? this.describePending(id, controller.signal).then(present$1) : present$1();
@@ -4536,7 +4541,6 @@ function pictureReuse(deps) {
4536
4541
  };
4537
4542
  }
4538
4543
  // src/orchestration.ts
4539
- const WORKING_DIRECTORY_CONTEXT = "working-directory:current";
4540
4544
  const name = "@dsh-agentic-roleplay/core/orchestration";
4541
4545
  /**
4542
4546
  * Mounted by the `roleplay` agent preset, so it applies to roleplay chats only.
@@ -4697,12 +4701,7 @@ function apply(ctx) {
4697
4701
  return resourceHint(ctx.tools.schemas(context.scope).map((tool) => tool.name), ctx.tools.schemas().map((tool) => tool.name), translator(languageOf$1(chat?.settings.prompts.language ?? "en")));
4698
4702
  }
4699
4703
  });
4700
- ctx.systemPrompt.context({
4701
- name: WORKING_DIRECTORY_CONTEXT,
4702
- order: ctx.systemPrompt.getContextOrder("WORKING_DIRECTORY"),
4703
- interpolate: false,
4704
- text: ""
4705
- });
4704
+ silenceRuntimeContext(ctx);
4706
4705
  const rolls = new RollReplay((chat) => stores(chat)?.settings().rewind.rolls ?? "reroll");
4707
4706
  const turnTraces = new TurnTraces(() => tracerOf(ctx));
4708
4707
  const toolDeps = {
@@ -1,14 +1,14 @@
1
- import { A as chatSessionId } from "./child-DTdY14S9.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-B_qYKK8c.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-ULGUKWsu.js";
4
- import { n as encodeOutput } from "./narration--K2XVIHI.js";
5
- import { a as VARIABLE_KINDS, n as atomicWrite, o as VARIABLE_SUBJECTS, r as atomicWriteJson, s as VARIABLE_VISIBILITIES } from "./access-Csp80TFX.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-YXQZ9G2d.js";
7
- import { i as translator, r as languageOf } from "./text-hiKTooVb.js";
8
- import { h as readImageFileMetadata, u as referenceImagePath, x as mapLimit } from "./library-BmlHNCah.js";
9
- import { n as readPreset } from "./preset-C595KRUM.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-CzVh2ZNe.js";
11
- import { a as uploadReferenceImage, t as generateReferenceImage } from "./generator-CTWQWbSW.js";
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";
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";
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";
@@ -257,7 +257,7 @@ function agentServicesOf(ctx) {
257
257
  const persistence = ctx.get("sessionPersistence");
258
258
  const agents = ctx.get("agents");
259
259
  const command = agents === void 0 ? void 0 : async (chat, line) => {
260
- const live = agents.get(chat);
260
+ const live = agents.get(SessionId(chat));
261
261
  return live === void 0 ? void 0 : await runCommandLine(ctx, live, line, new AbortController().signal);
262
262
  };
263
263
  return {
@@ -278,7 +278,7 @@ const UNLOAD_WAIT_MS = 5e3;
278
278
  */
279
279
  function unloader(ctx, agents) {
280
280
  return async (chat) => {
281
- const live = agents.get(chat);
281
+ const live = agents.get(SessionId(chat));
282
282
  if (live === void 0) return;
283
283
  let off = () => {};
284
284
  try {
@@ -302,7 +302,7 @@ function unloader(ctx, agents) {
302
302
  } finally {
303
303
  off();
304
304
  }
305
- if (agents.get(chat) !== void 0) throw new Error(`the chat ${chat} is still loaded and cannot be replaced`);
305
+ if (agents.get(SessionId(chat)) !== void 0) throw new Error(`the chat ${chat} is still loaded and cannot be replaced`);
306
306
  };
307
307
  }
308
308
  /**
@@ -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-VbcXiukr.js.map
3230
+ //# sourceMappingURL=pack-jail-CZAmlgE1.js.map
@@ -1,4 +1,4 @@
1
- import { K as Reader } from "./hooks-YXQZ9G2d.js";
1
+ import { K as Reader } from "./hooks-OLl-1AOS.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-CzVh2ZNe.js.map
839
+ //# sourceMappingURL=packs-DUVCSHqi.js.map