@dsh-agentic-roleplay/core 0.12.2 → 0.12.3

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/doctor.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { n as silenceRuntimeContext, t as silenceHarnessDevContext } from "./dev-context-Cgv_wZbG.js";
2
2
  import { A as chatSessionId } from "./child-DTdY14S9.js";
3
3
  import { n as doctorSessionOf } from "./doctor-chat-hL1a61hp.js";
4
- import { o as externalTools, t as externalToolLimit } from "./hooks-Dtq5KZQX.js";
4
+ import { s as externalTools, t as externalToolLimit } from "./hooks-DlrFO4aQ.js";
5
5
  import { a as liveSettings } from "./narration--K2XVIHI.js";
6
6
  import { join } from "node:path";
7
7
  import { createTools, isSessionId, sessionDatabase, sessionFolder } from "@dsh-agentic-roleplay/state";
@@ -193,6 +193,51 @@ function skipTime(session, config, turn, round, wall, request) {
193
193
  };
194
194
  });
195
195
  }
196
+ // src/host/commands/registry.ts
197
+ /**
198
+ * 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
+ * A plugin mounted by an agent preset registers them for that preset's agents only.
200
+ */
201
+ function registerCommands(ctx, specs) {
202
+ 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}`);
210
+ });
211
+ }
212
+ /** The registry of the running profile, or nothing when it has none. */
213
+ const registryOf = (ctx) => ctx.get("commands");
214
+ /**
215
+ * 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.
217
+ */
218
+ async function runCommandLine(ctx, agent, line, signal) {
219
+ const registry = registryOf(ctx);
220
+ if (registry === void 0) return void 0;
221
+ return (await registry.execute(agent, line, [], signal))?.result;
222
+ }
223
+ /** A command that was run from outside the input box and refused: what it says is for the person. */
224
+ var CommandRefusedError = class extends Error {};
225
+ /**
226
+ * 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
+ * what the chat holds (the commands a world defines).
228
+ */
229
+ function registerAgentCommands(agent, specs) {
230
+ 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}`);
239
+ });
240
+ }
196
241
  // src/host/sessions/errors.ts
197
242
  var WorldNotFoundError = class extends Error {};
198
243
  /** The world cannot be played as it is; `problems` say what to fix. */
@@ -2944,6 +2989,7 @@ function storeOf(session, folder, problem, queryVector, wall, prompt) {
2944
2989
  recordDecisions: (site, report) => {
2945
2990
  recordDecisions(folder, site, report);
2946
2991
  },
2992
+ commands: () => commandsOf(session.metadata.getValue(COMMANDS_KEY)),
2947
2993
  raiseCommand: (word, turn) => {
2948
2994
  const commands = commandsOf(session.metadata.getValue(COMMANDS_KEY));
2949
2995
  const used = word === void 0 ? void 0 : commands.find((command) => command.word === word.toLowerCase());
@@ -3059,20 +3105,6 @@ function storesOf(state, sessionsDir, problem = () => void 0, queryVector = () =
3059
3105
  }
3060
3106
  };
3061
3107
  }
3062
- // src/shared/ooc.ts
3063
- /** The command or question in a player's message, or nothing when the message is an ordinary action. The request may be empty. */
3064
- function parseOoc(text) {
3065
- const value = text.trimStart();
3066
- const boundary = value.search(/\s/u);
3067
- const command = value.slice(0, boundary < 0 ? value.length : boundary).toLowerCase();
3068
- if (command !== "/ooc" && command !== "/ask") return void 0;
3069
- return {
3070
- request: value.slice(command.length).trim(),
3071
- question: command === "/ask"
3072
- };
3073
- }
3074
- /** The longest answer to an out-of-character question. */
3075
- const MAX_OOC_ANSWER = 1200;
3076
3108
  // src/shared/tools.ts
3077
3109
  /** What this version can offer. A name in a settings file or a world that is not here is kept and ignored. */
3078
3110
  const OPTIONAL_TOOLS = [
@@ -4130,6 +4162,9 @@ function externalWithheld(registry, board, agent) {
4130
4162
  function charactersGiven(registry, board, away) {
4131
4163
  return away ? [] : externalGiven(registry, board, "characters");
4132
4164
  }
4165
+ // src/shared/ooc.ts
4166
+ /** The longest answer to an out-of-character question. */
4167
+ const MAX_OOC_ANSWER = 1200;
4133
4168
  // src/host/workspace/describe.ts
4134
4169
  /** What an agent with file tools is told of where they reach: the shared workspace first, then the folders given to this story. Nothing for a story with no workspace. */
4135
4170
  function foldersLine(roots, language) {
@@ -4312,19 +4347,10 @@ function answerRunner(deps) {
4312
4347
  })).answer;
4313
4348
  };
4314
4349
  }
4315
- // src/shared/dream.ts
4316
- /** The dream a player asks to enter (`/dream`, `/dream Clara`, `/dream 做梦的人`), or nothing when the message does not start with `/dream`. `who` is empty when no one is named. */
4317
- function parseDream(text) {
4318
- const value = text.trimStart();
4319
- if (value.slice(0, 6).toLowerCase() !== "/dream" || value.length > 6 && !/\s/u.test(value[6])) return void 0;
4320
- return { who: value.slice(6).trim() };
4321
- }
4322
4350
  // src/shared/roll.ts
4323
- /** The roll in a player's message, or nothing when the message does not start with `/roll`. The notation may be empty, and is then refused. */
4324
- function parseRoll(text) {
4325
- const value = text.trimStart();
4326
- if (value.slice(0, 5).toLowerCase() !== "/roll" || value.length > 5 && !/\s/u.test(value[5])) return void 0;
4327
- const body = value.slice(5).trimStart();
4351
+ /** The dice and the reason in what a player typed after `/roll`. The notation may be empty, and is then refused. */
4352
+ function rollArguments(rawInput) {
4353
+ const body = rawInput.trimStart();
4328
4354
  const boundary = body.search(/\s/u);
4329
4355
  return boundary < 0 ? {
4330
4356
  expression: body,
@@ -4341,13 +4367,10 @@ const UNITS = [
4341
4367
  [/^(?:d|day|days|天|日)$/iu, 1440]
4342
4368
  ];
4343
4369
  /**
4344
- * The wait in a player's message (`/wait 2 hours`, `/wait 30m until the ferry`, `/wait 3天`), or nothing when the message does not start with `/wait`. The time may be missing or
4345
- * unreadable, and is then `undefined` in `minutes`.
4370
+ * 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`.
4346
4371
  */
4347
- function parseWait(text) {
4348
- const value = text.trimStart();
4349
- if (value.slice(0, 5).toLowerCase() !== "/wait" || value.length > 5 && !/\s/u.test(value[5])) return void 0;
4350
- const body = value.slice(5).trim();
4372
+ function waitArguments(rawInput) {
4373
+ const body = rawInput.trim();
4351
4374
  const match = /^(\d+(?:\.\d+)?)\s*([\p{L}]+)\s*(.*)$/su.exec(body);
4352
4375
  if (match === null) return {
4353
4376
  minutes: void 0,
@@ -4364,6 +4387,139 @@ function parseWait(text) {
4364
4387
  reason: match[3].trim()
4365
4388
  };
4366
4389
  }
4390
+ // src/host/orchestration/player-commands.ts
4391
+ /** The most commands waiting for their turn to start: a command is taken the moment its message begins a turn, so this is only a bound. */
4392
+ const MAX_WAITING = 200;
4393
+ /**
4394
+ * What each command message was meant to do, by the id of the message the command sent: the turn that message begins takes it. Nothing reads the words of a message to tell a command from a move.
4395
+ */
4396
+ var PlayerIntents = class {
4397
+ byMessage = /* @__PURE__ */ new Map();
4398
+ intend(messageId, command) {
4399
+ this.byMessage.set(messageId, command);
4400
+ for (const key of this.byMessage.keys()) {
4401
+ if (this.byMessage.size <= MAX_WAITING) break;
4402
+ this.byMessage.delete(key);
4403
+ }
4404
+ }
4405
+ /** The command of the first of these messages that has one, which is then forgotten. */
4406
+ take(messageIds) {
4407
+ for (const id of messageIds) {
4408
+ const command = this.byMessage.get(id);
4409
+ if (command !== void 0) {
4410
+ this.byMessage.delete(id);
4411
+ return command;
4412
+ }
4413
+ }
4414
+ }
4415
+ };
4416
+ /** The game master of a roleplay chat: the agent a player's command is for. */
4417
+ const isGameMaster = (agent) => agent.session.header.origin !== "subagent" && roleplaySessionOf(agent.session.id) !== void 0;
4418
+ /** Sends the command to the game master as the player's own message, which is what the turn it begins is the answer to. */
4419
+ function play(intents, agent, name, rawInput, command) {
4420
+ if (!isGameMaster(agent)) return {
4421
+ kind: "error",
4422
+ text: `/${name} is played in a roleplay chat`
4423
+ };
4424
+ const message = createUserMessage({
4425
+ content: [{
4426
+ type: "text",
4427
+ text: `/${name}${rawInput}`
4428
+ }],
4429
+ source: { kind: "user" }
4430
+ });
4431
+ intents.intend(String(message.id), command);
4432
+ agent.followup(message);
4433
+ return { kind: "success" };
4434
+ }
4435
+ /** The commands every roleplay chat has: out-of-character commands and questions, dice, time and dreams. */
4436
+ function playerCommands(intents) {
4437
+ const ooc = (name, description) => ({
4438
+ name,
4439
+ description,
4440
+ hint: name === "ooc" ? "<what to change in the story>" : "<what to ask>",
4441
+ recordInput: false,
4442
+ handler: ({ agent, rawInput }) => {
4443
+ const request = rawInput.trim();
4444
+ if (request === "") return {
4445
+ kind: "error",
4446
+ text: name === "ooc" ? "Say what to change: /ooc <what the story should do>" : "Say what to ask: /ask <your question>"
4447
+ };
4448
+ return play(intents, agent, name, rawInput, {
4449
+ kind: "ooc",
4450
+ request,
4451
+ question: name === "ask"
4452
+ });
4453
+ }
4454
+ });
4455
+ return [
4456
+ ooc("ooc", "Give the story an out-of-character instruction, outside what your character does"),
4457
+ ooc("ask", "Ask the story a question out of character; nothing in the story changes"),
4458
+ {
4459
+ name: "roll",
4460
+ description: "Roll dice as yourself: the result is told to the game master as a fact",
4461
+ hint: "<dice, for example 2d6+1> [why]",
4462
+ recordInput: false,
4463
+ handler: ({ agent, rawInput }) => {
4464
+ const roll = rollArguments(rawInput);
4465
+ if (roll.expression === "") return {
4466
+ kind: "error",
4467
+ text: "Say what to roll, for example /roll 2d6"
4468
+ };
4469
+ return play(intents, agent, "roll", rawInput, {
4470
+ kind: "roll",
4471
+ ...roll
4472
+ });
4473
+ }
4474
+ },
4475
+ {
4476
+ name: "wait",
4477
+ description: "Let time pass in the story",
4478
+ hint: "<how long, for example 2 hours> [until what]",
4479
+ recordInput: false,
4480
+ handler: ({ agent, rawInput }) => {
4481
+ const wait = waitArguments(rawInput);
4482
+ if (wait.minutes === void 0) return {
4483
+ kind: "error",
4484
+ text: "Say how long, for example /wait 2 hours or /wait 30 minutes until the ferry"
4485
+ };
4486
+ return play(intents, agent, "wait", rawInput, {
4487
+ kind: "wait",
4488
+ minutes: wait.minutes,
4489
+ reason: wait.reason
4490
+ });
4491
+ }
4492
+ },
4493
+ {
4494
+ name: "dream",
4495
+ description: "Enter the dream of a character who is asleep",
4496
+ hint: "[whose dream]",
4497
+ recordInput: false,
4498
+ handler: ({ agent, rawInput }) => play(intents, agent, "dream", rawInput, {
4499
+ kind: "dream",
4500
+ who: rawInput.trim()
4501
+ })
4502
+ }
4503
+ ];
4504
+ }
4505
+ /** DSH names a command with lower case ASCII letters, digits, `_` and `-`; a world's word may be in any script, and is then offered under the key of its flag, which is always such a name. */
4506
+ const COMMAND_NAME = /^[a-z][a-z0-9_-]*$/;
4507
+ /** The commands a world defines, for its chat: each is the player's move in the story, and raises the world's flag for the turn. */
4508
+ function worldCommands(intents, defined) {
4509
+ return defined.map((command) => {
4510
+ const name = COMMAND_NAME.test(command.word) ? command.word : command.key;
4511
+ return {
4512
+ name,
4513
+ description: name === command.word ? command.description : `/${command.word}: ${command.description}`,
4514
+ hint: "[what you do]",
4515
+ recordInput: false,
4516
+ handler: ({ agent, rawInput }) => play(intents, agent, name, rawInput, {
4517
+ kind: "world",
4518
+ word: command.word
4519
+ })
4520
+ };
4521
+ });
4522
+ }
4367
4523
  // src/host/agents/repeat-guard.ts
4368
4524
  /**
4369
4525
  * Keeps an agent that is stuck from making the same call again and again (found live: an assistant made one create-and-list pair 47 times in a review, a game master repeated one
@@ -4498,6 +4654,8 @@ function commandBringsPeopleIn(store, command) {
4498
4654
  }
4499
4655
  function installHooks(ctx, deps) {
4500
4656
  const { engine, boundaries, stores, timelines, previewTool } = deps;
4657
+ const intents = deps.intents ?? new PlayerIntents();
4658
+ registerCommands(ctx, playerCommands(intents));
4501
4659
  /** The tools of the game master as the chat's settings say: its optional ones, and none of other plugins' that it was not given. */
4502
4660
  const applyLimit = (agent, store) => {
4503
4661
  externalToolLimit(agent, externalWithheld(agent.ctx.tools, store.settings().tools, "gameMaster"));
@@ -4562,6 +4720,7 @@ function installHooks(ctx, deps) {
4562
4720
  if (store === void 0) return;
4563
4721
  registerConditionalTools(agent, conditionsOf(agent.session.id));
4564
4722
  applyLimit(agent, store);
4723
+ registerAgentCommands(agent, worldCommands(intents, store.commands?.() ?? []));
4565
4724
  });
4566
4725
  /** Where the open turn of each chat began, so its own events can be read back without walking the whole log. */
4567
4726
  const openTurns = /* @__PURE__ */ new Map();
@@ -4645,10 +4804,10 @@ function installHooks(ctx, deps) {
4645
4804
  turns.begin(owner.chat, payload.turn, text);
4646
4805
  deps.rolls?.begin(owner.chat, store.story.metadata.get().id, began.parent);
4647
4806
  const cast = store.cast();
4648
- const ooc = parseOoc(text);
4649
- const command = ooc === void 0 ? /^\/([\p{L}\p{N}_]+)/u.exec(text.trim())?.[1] : void 0;
4650
- const used = store.raiseCommand?.(command, payload.turn);
4651
- const dream = ooc === void 0 ? parseDream(text) : void 0;
4807
+ const intent = intents.take(payload.messages.filter((message) => message.source.kind === "user").map((message) => String(message.id)));
4808
+ const ooc = intent?.kind === "ooc" ? intent : void 0;
4809
+ const used = store.raiseCommand?.(intent?.kind === "world" ? intent.word : void 0, payload.turn);
4810
+ const dream = intent?.kind === "dream" ? intent : void 0;
4652
4811
  const verdict = ooc === void 0 ? boundaries().inputValidator.validate({
4653
4812
  text,
4654
4813
  turn: payload.turn,
@@ -4730,7 +4889,7 @@ function installHooks(ctx, deps) {
4730
4889
  if (arrived.length > 0) addLine("messages", tr("While the player was away, these messages reached their character, who has read them: {messages}. Refer to them only if the player does.", { messages: arrived.map((message) => `${message.name}: "${message.text}"`).join(" ") }));
4731
4890
  const rules = store.rules();
4732
4891
  if (rules.length > 0) addLine("rules", store.text("roleplay/rules", { rules: rules.map((rule) => `- ${rule}`).join("\n") }));
4733
- const wanted = ooc === void 0 && dream === void 0 ? parseRoll(text) : void 0;
4892
+ const wanted = intent?.kind === "roll" ? intent : void 0;
4734
4893
  if (wanted !== void 0) try {
4735
4894
  const made = rollPlain(wanted.expression, deps.rolls?.roller(owner.chat));
4736
4895
  const roll = store.story.dice.record({
@@ -4785,7 +4944,7 @@ function installHooks(ctx, deps) {
4785
4944
  }));
4786
4945
  }
4787
4946
  }
4788
- const waiting = ooc === void 0 && wanted === void 0 && dream === void 0 ? parseWait(text) : void 0;
4947
+ const waiting = intent?.kind === "wait" ? intent : void 0;
4789
4948
  if (waiting !== void 0) {
4790
4949
  const clock = store.settings().clock;
4791
4950
  const refusal = clock.mode === "real" ? tr("this chat follows the clock on the wall, so time cannot be skipped") : waiting.minutes === void 0 ? tr("say how long, for example /wait 2 hours or /wait 30 minutes until the ferry") : waiting.minutes > clock.maxSkipDays * 1440 ? tr("that is more than the {days} days this chat allows in one skip", { days: clock.maxSkipDays }) : void 0;
@@ -4849,6 +5008,6 @@ function installHooks(ctx, deps) {
4849
5008
  };
4850
5009
  });
4851
5010
  }
4852
- 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 _, AUTHORING_NEEDS as _t, externalGiven as a, shippedPromptsDirectory as at, readWithdrawn as b, PREVIEW_TOOL as c, InvalidStartError as ct, toolEnabled as d, SessionArchivedError as dt, inheritPrompts as et, MAX_OOC_ANSWER as f, SessionNotFoundError as ft, readRunDetail as g, zoneOf as gt, readActivity as h, describeWhen as ht, characterRunner as i, shippedLanguages as it, populatePlots as j, PLOTS_METADATA_KEY as k, createTools$1 as l, InvalidWorldError as lt, readDecisionStats as m, ClockError as mt, installHooks as n, listFiles as nt, externalTools as o, shippedText as ot, storesOf as p, WorldNotFoundError as pt, formatIssue as q, guardRepeatedCalls as r, promptProblem as rt, externalWithheld as s, AgentUnavailableError as st, externalToolLimit as t, languageOf as tt, record as u, ReflectionRefusedError as ut, readVerdicts as v, COMPARISONS as vt, observeAsPlayer as w, addToNote as x, writeVerdicts as y, loadPlots as z };
5011
+ 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 };
4853
5012
 
4854
- //# sourceMappingURL=hooks-Dtq5KZQX.js.map
5013
+ //# sourceMappingURL=hooks-DlrFO4aQ.js.map
package/lib/index.js CHANGED
@@ -1,19 +1,19 @@
1
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 { Bt as isPng, E as loadWorldParts, F as localChanges, Ft as CHARACTERS_DIR, G as vetUrl, Ht as readCard, I as readOrigin, It as loadCharacters, Kt as authoredWorldOf, L as writeOrigin, Lt as knownOutputCeiling, M as describeChanges, N as hashWorld, P as isUnchanged, R as CatalogueError, Rt as ImportCardError, T as readWorldInfo, U as guardedLookup, Vt as pictureOf, _ as runChecks, at as populateCharacters, bt as loadLocations, c as importPhase, ct as populateFactions, d as markReady, dt as populateLocations, et as checkWorld, f as settleDraft, ft as populateLore, ht as populateVariables, it as populateCalendar, lt as populateItems, mt as populateTriggers, ot as populateClock, p as structureImport, pt as populateRoutines, qt as authoringChatSessionId, rt as knowsCharacter, st as populateDice, t as AuthoringTools, tt as loadValidatedWorld, u as keepDraft, ut as populateKnowledge, w as editWorldInfo, zt as cardFormat } from "./authoring-tools-BZr4bgBy.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-BjcEUo22.js";
4
- import { a as presetChatSessionId, n as narrationImportMessage, o as presetOfChat } from "./preset-author-tools-BUzO9mTW.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, gt as zoneOf, h as readActivity, it as shippedLanguages, j as populatePlots, k as PLOTS_METADATA_KEY, lt as InvalidWorldError, m as readDecisionStats, nt as listFiles, o as externalTools, pt as WorldNotFoundError, q as formatIssue, rt as promptProblem, st as AgentUnavailableError, tt as languageOf, ut as ReflectionRefusedError, w as observeAsPlayer, x as addToNote } from "./hooks-Dtq5KZQX.js";
2
+ import { $ as checkWorld, A as loadWorldParts, B as localChanges, Gt as pictureOf, H as writeOrigin, Ht as ImportCardError, J as guardedLookup, Kt as readCard, L as describeChanges, O as editWorldInfo, Ot as CHARACTERS_DIR, R as hashWorld, U as CatalogueError, Ut as cardFormat, V as readOrigin, Wt as isPng, X as vetUrl, Xt as authoredWorldOf, Zt as authoringChatSessionId, _ 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, rt as populateCalendar, st as populateFactions, t as AuthoringTools, ut as populateLocations, x as runChecks, z as isUnchanged } from "./authoring-tools-hacA5fG-.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-dupq-kb_.js";
4
+ import { a as presetChatSessionId, n as narrationImportMessage, o as presetOfChat } from "./preset-author-tools-Dwxnpv6V.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-DlrFO4aQ.js";
6
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 { $ as deleteWorldPrompt, $t as subfolders, Et as readImportFolder, F as parseWorldInfoEdit, G as loadPreset, H as deletePreset, I as combineAnswers, J as reservePreset, K as presetDirectory, L as questionView, M as WORLD_FILE_NAME, N as parseWorldFile, Ot as IMPORT_COMMAND, Pt as sourceSummary, Qt as parseCharacterFile, St as ImportStore, Tt as parseChoices, U as isPresetName, V as createPresetFromShipped, W as listPresets, Y as savePresetFromWorld, Z as updatePresetInfo, an as parseRelationEdit, at as deleteLorebook, bt as IMPORT_FOLDER, cn as LORE_KINDS, ct as isLorebookName, dt as lorebookDirectory, en as InvalidEditProblems, et as listWorldPrompts, ht as writeLorebookEntry, in as parsePlaceEdit, it as createLorebook, ln as LORE_SCOPES, lt as listLorebooks, mt as updateLorebookInfo, nn as parseFactionEdit, nt as writeWorldPrompt, on as parseThingEdit, ot as deleteLorebookEntry, pt as reserveLorebook, rn as parseLoreEdit, rt as addLorebookEntries, sn as guarded, st as entriesOf, tn as parseCharacterEdit, tt as readWorldPrompt, ut as loadLorebook, vt as partsOf, xt as ImportNotFoundError, yt as withPlayer, z as PRESET_FILE } from "./serial-BUaJGwVy.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-Dt0VTsu0.js";
7
+ import { $ as deleteWorldPrompt, Ct as IMPORT_FOLDER, F as parseWorldInfoEdit, Ft as parsePlaceEdit, G as loadPreset, H as deletePreset, I as combineAnswers, It as parseRelationEdit, J as reservePreset, K as presetDirectory, L as questionView, Lt as parseThingEdit, M as WORLD_FILE_NAME, Mt as parseCharacterEdit, N as parseWorldFile, Nt as parseFactionEdit, Ot as parseChoices, Pt as parseLoreEdit, St as withPlayer, Tt as ImportStore, U as isPresetName, Ut as sourceSummary, V as createPresetFromShipped, W as listPresets, Y as savePresetFromWorld, Z as updatePresetInfo, an as parseCharacterFile, at as deleteLorebook, cn as LORE_SCOPES, ct as isLorebookName, dt as lorebookDirectory, et as listWorldPrompts, ht as writeLorebookEntry, it as createLorebook, jt as InvalidEditProblems, kt as readImportFolder, lt as listLorebooks, mt as updateLorebookInfo, nt as writeWorldPrompt, on as guarded, ot as deleteLorebookEntry, pt as reserveLorebook, rt as addLorebookEntries, sn as LORE_KINDS, st as entriesOf, tt as readWorldPrompt, ut as loadLorebook, vt as subfolders, wt as ImportNotFoundError, xt as partsOf, z as PRESET_FILE } from "./serial-CDGoXYh-.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-Bq0fzKi4.js";
9
9
  import { i as atomicWriteSync, n as atomicWrite, r as atomicWriteJson } from "./access-Csp80TFX.js";
10
10
  import { i as translator, r as languageOf$1, t as trimCharacters } from "./text-Dfv8S8eq.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-Dd3pEiZB.js";
12
- import { n as readPreset, r as selectPrompts, t as previewPreset } from "./preset-Dv5YF2qj.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-DibpEUQK.js";
12
+ import { n as readPreset, r as selectPrompts, t as previewPreset } from "./preset-RHcOG55T.js";
13
13
  import { C as slug, T as uniqueKey, d as sceneImagePath, s as inheritImages, t as addToLibrary, u as referenceImagePath } from "./library-DTxakw0z.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-DWfR2Ted.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-D-7EU3yU.js";
17
17
  import { a as uploadReferenceImage, t as generateReferenceImage } from "./generator-9-5at9cZ.js";
18
18
  import { i as updateImage, n as galleryFile, r as listGallery } from "./gallery-BNg0rPTp.js";
19
19
  import { basename, dirname, extname, isAbsolute, join, normalize, relative, resolve, sep } from "node:path";
@@ -330,6 +330,16 @@ var AuthoringLanguages = class extends Service {
330
330
  return join(this.worldsDirectory(), ".authoring", `${encodeURIComponent(worldId)}.json`);
331
331
  }
332
332
  };
333
+ // src/host/worlds/draft.ts
334
+ /** Whether the world is an import that was written but would not start yet: its import state (kept in the world's `.import` folder) says it is being repaired. */
335
+ async function isDraftWorld(directory) {
336
+ try {
337
+ return JSON.parse(await readFile(join(directory, ".import", "state.json"), "utf8")).phase === "repair";
338
+ } catch (error) {
339
+ if (error.code === "ENOENT") return false;
340
+ throw error;
341
+ }
342
+ }
333
343
  // src/host/import/service.ts
334
344
  /** What an import is configured to do, for the parts of the plugin that run in other scopes (the authoring chat's tools). */
335
345
  var RoleplayImport = class extends Service {
@@ -339,6 +349,8 @@ var RoleplayImport = class extends Service {
339
349
  this.read = read;
340
350
  }
341
351
  turns = /* @__PURE__ */ new Map();
352
+ /** The imports the authoring chats are running; shared by the chats' command and gate and by the plugin's own starts. */
353
+ state = new ImportState();
342
354
  /** Notes that a turn of a chat ended; the authoring chats are the ones that report here. */
343
355
  turnEnded(chat) {
344
356
  this.turns.set(chat, (this.turns.get(chat) ?? 0) + 1);
@@ -352,16 +364,6 @@ var RoleplayImport = class extends Service {
352
364
  return this.read();
353
365
  }
354
366
  };
355
- // src/host/worlds/draft.ts
356
- /** Whether the world is an import that was written but would not start yet: its import state (kept in the world's `.import` folder) says it is being repaired. */
357
- async function isDraftWorld(directory) {
358
- try {
359
- return JSON.parse(await readFile(join(directory, ".import", "state.json"), "utf8")).phase === "repair";
360
- } catch (error) {
361
- if (error.code === "ENOENT") return false;
362
- throw error;
363
- }
364
- }
365
367
  // src/host/worlds/create-world.ts
366
368
  const FOLDER = /^[\p{L}\p{N}][\p{L}\p{N}._ -]{0,99}$/u;
367
369
  var WorldFolderExistsError = class extends Error {};
@@ -413,10 +415,10 @@ function folderNameOf(name) {
413
415
  const folder = trimCharacters(cleaned, ". ", "end").slice(0, 90).trim();
414
416
  return folder === "" ? "imported world" : folder;
415
417
  }
416
- /** The command that starts the import, for a card kept in the world's import folder. */
417
- function importMessage(language, card) {
418
+ /** What the person asks of the import of the card kept in the world's import folder: the request, and a summary of the card when it can be read. */
419
+ function importRequest(language, card) {
418
420
  const request = translator(languageOf$1(language))("Import this card into this newly created world.");
419
- return `${IMPORT_COMMAND} ${IMPORT_FOLDER}/card.json ${card === void 0 ? request : `${request} ${sourceSummary(card, language)}`}`;
421
+ return card === void 0 ? request : `${request} ${sourceSummary(card, language)}`;
420
422
  }
421
423
  /** The card kept in a world's import folder, when it can be read; the message then carries a summary of it. */
422
424
  async function cardOf(directory) {
@@ -427,7 +429,7 @@ async function cardOf(directory) {
427
429
  }
428
430
  }
429
431
  /**
430
- * Has the chat of a world whose import stopped before it was done carry on from the step it reached (the import hooks tell the chat which step that is). An import is lost
432
+ * Has the chat of a world whose import stopped before it was done carry on from the step it reached (the import command tells the chat which step that is). An import is lost
431
433
  * to a server restart, a refused finish or a chat that ended early; the card and what was extracted stay in the world's import folder.
432
434
  * @throws {WorldNotFoundError} when the world is gone. @throws {InvalidEditProblems} when no import is waiting in it.
433
435
  */
@@ -439,7 +441,7 @@ async function resumeImport(deps, worldId, language) {
439
441
  const chatSessionId = await deps.authoring.ensure(record.summary.id, record.summary.name, authoringTitle(record.summary.name, language), language);
440
442
  let failure;
441
443
  try {
442
- await deps.authoring.send(chatSessionId, importMessage(language, await cardOf(record.directory)));
444
+ await deps.authoring.startImport(chatSessionId, importRequest(language, await cardOf(record.directory)));
443
445
  } catch (error) {
444
446
  failure = error instanceof Error ? error.message : String(error);
445
447
  }
@@ -484,7 +486,7 @@ async function startImport(deps, id, choices, language) {
484
486
  const chatSessionId = await deps.authoring.ensure(world.id, world.name, authoringTitle(world.name, language), language);
485
487
  let failure;
486
488
  try {
487
- await deps.authoring.send(chatSessionId, importMessage(language, await cardOf(directory)));
489
+ await deps.authoring.startImport(chatSessionId, importRequest(language, await cardOf(directory)));
488
490
  } catch (error) {
489
491
  failure = error instanceof Error ? error.message : String(error);
490
492
  }
@@ -3348,6 +3350,7 @@ function worldsRoutes({ worlds, createWorld, starter, authorWorld, sayToAuthor,
3348
3350
  } catch (error) {
3349
3351
  if (error instanceof WorldNotFoundError) return sendError(res, 404, error.message);
3350
3352
  if (error instanceof AgentUnavailableError) return sendError(res, 503, error.message);
3353
+ if (error instanceof CommandRefusedError) return sendError(res, 422, error.message);
3351
3354
  throw error;
3352
3355
  }
3353
3356
  } },
@@ -5101,6 +5104,7 @@ function sessionsRoutes({ sessions, externalTools, redundantLayers }) {
5101
5104
  if (error instanceof SessionNotFoundError) return sendError(res, 404, error.message);
5102
5105
  if (error instanceof SessionArchivedError) return sendError(res, 409, error.message);
5103
5106
  if (error instanceof AgentUnavailableError) return sendError(res, 503, error.message);
5107
+ if (error instanceof CommandRefusedError) return sendError(res, 422, error.message);
5104
5108
  throw error;
5105
5109
  }
5106
5110
  } },
@@ -9827,7 +9831,14 @@ function apply(ctx, config) {
9827
9831
  if (timer !== void 0) clearTimeout(timer);
9828
9832
  };
9829
9833
  }, "roleplay: stories that go on while the player is away");
9830
- const authoring = new AuthoringSessions(agentServicesOf(ctx), () => root.path, prompts, languages);
9834
+ const authoring = new AuthoringSessions(agentServicesOf(ctx), () => root.path, prompts, languages, (chat, request) => beginImport({
9835
+ worlds: ctx.roleplayWorlds,
9836
+ text: importTextFor({
9837
+ prompts: () => prompts,
9838
+ languages: () => languages
9839
+ }),
9840
+ state: ctx.roleplayImport.state
9841
+ }, chat, request));
9831
9842
  const presetAuthoring = new PresetAuthoringSessions(agentServicesOf(ctx), () => root.path, prompts, languages);
9832
9843
  const lorebookAuthoring = new LorebookAuthoringSessions(agentServicesOf(ctx), () => root.path, prompts, languages);
9833
9844
  const doctors = new DoctorSessions(agentServicesOf(ctx), () => root.path, prompts);
@@ -1,7 +1,7 @@
1
1
  import "./access-Csp80TFX.js";
2
- import { Rt as ImportCardError, i as contextOf, r as MAX_PREVIEW_TEXT } from "./authoring-tools-BZr4bgBy.js";
3
- import { B as createPresetFromGuidance, bt as IMPORT_FOLDER, cn as LORE_KINDS, dt as lorebookDirectory, ft as readLorebook$1, gt as cleanText, ht as writeLorebookEntry, ln as LORE_SCOPES, mt as updateLorebookInfo, ot as deleteLorebookEntry, st as entriesOf, ut as loadLorebook, vt as partsOf, yt as withPlayer } from "./serial-BUaJGwVy.js";
4
- import { F as textLanguage, I as wrongLanguage, at as shippedPromptsDirectory } from "./hooks-Dtq5KZQX.js";
2
+ import { Ht as ImportCardError, o as contextOf, r as MAX_PREVIEW_TEXT } from "./authoring-tools-hacA5fG-.js";
3
+ import { B as createPresetFromGuidance, Ct as IMPORT_FOLDER, St as withPlayer, cn as LORE_SCOPES, dt as lorebookDirectory, ft as readLorebook$1, ht as writeLorebookEntry, mt as updateLorebookInfo, ot as deleteLorebookEntry, sn as LORE_KINDS, st as entriesOf, ut as loadLorebook, xt as partsOf, yt as cleanText } from "./serial-CDGoXYh-.js";
4
+ import { F as textLanguage, I as wrongLanguage, at as shippedPromptsDirectory } from "./hooks-DlrFO4aQ.js";
5
5
  import { i as translator, r as languageOf } from "./text-Dfv8S8eq.js";
6
6
  import { C as slug, T as uniqueKey, w as trOf, x as mapLimit } from "./library-DTxakw0z.js";
7
7
  import { join } from "node:path";
@@ -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-BjcEUo22.js.map
712
+ //# sourceMappingURL=lorebook-author-tools-dupq-kb_.js.map
@@ -1,9 +1,9 @@
1
- import { n as limitAuthoringAgents } from "./authoring-tools-BZr4bgBy.js";
2
- import { t as guardAuthoringTurns } from "./turn-guard-87NE-Cnp.js";
1
+ import { n as limitAuthoringAgents } from "./authoring-tools-hacA5fG-.js";
2
+ import { t as guardAuthoringTurns } from "./turn-guard-DDxikrq7.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-BjcEUo22.js";
5
- import "./hooks-Dtq5KZQX.js";
6
- import { dt as lorebookDirectory } from "./serial-BUaJGwVy.js";
4
+ import { d as lorebookOfChat, i as lorebookAuthorTools, n as LorebookReader, o as pendingTargets, r as lorebookApproval } from "./lorebook-author-tools-dupq-kb_.js";
5
+ import "./hooks-DlrFO4aQ.js";
6
+ import { dt as lorebookDirectory } from "./serial-CDGoXYh-.js";
7
7
  import { join } from "node:path";
8
8
  import { existsSync, readdirSync } from "node:fs";
9
9
  // src/lorebook-authoring.ts
@@ -1,15 +1,15 @@
1
1
  import { t as silenceHarnessDevContext } from "./dev-context-Cgv_wZbG.js";
2
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 AUTHORING_NEEDS, a as externalGiven, c as PREVIEW_TOOL, d as toolEnabled, f as MAX_OOC_ANSWER, gt as zoneOf, ht as describeWhen, i as characterRunner, l as createTools$1, mt as ClockError, n as installHooks, ot as shippedText, p as storesOf, tt as languageOf, u as record, ut as ReflectionRefusedError, v as readVerdicts, y as writeVerdicts } from "./hooks-Dtq5KZQX.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-DlrFO4aQ.js";
4
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-Dd3pEiZB.js";
6
- import { A as routeVerdicts, E as askYesNo, Mt as splitPanels, O as modeFor, T as announceProblem, fn as INTENT_STATUSES, j as yesAt, k as noAt, n as STANDING_PROMPT, sn as guarded } from "./serial-BUaJGwVy.js";
5
+ import { a as whereabouts, n as memoryReflector, r as recordFailure, s as Timelines, t as dueReflection } from "./reflection-DibpEUQK.js";
6
+ import { A as routeVerdicts, E as askYesNo, O as modeFor, T as announceProblem, Vt as splitPanels, dn as INTENT_STATUSES, j as yesAt, k as noAt, n as STANDING_PROMPT, on as guarded } from "./serial-CDGoXYh-.js";
7
7
  import { i as translator, r as languageOf$1 } from "./text-Dfv8S8eq.js";
8
8
  import { a as liveSettings, g as GATE_SITES, n as encodeOutput } from "./narration--K2XVIHI.js";
9
9
  import { t as registerFoldersJail } from "./jail-DVbPSC0R.js";
10
10
  import { a as workspaceOf, n as storyRoots } from "./service-mRKwpWjX.js";
11
11
  import { C as slug, T as uniqueKey, t as addToLibrary } from "./library-DTxakw0z.js";
12
- import { _ as API_PREFIX } from "./packs-DWfR2Ted.js";
12
+ import { _ as API_PREFIX } from "./packs-D-7EU3yU.js";
13
13
  import { i as updateImage, r as listGallery, t as describeGalleryImage } from "./gallery-BNg0rPTp.js";
14
14
  import { c as presentedFor, i as findImages, n as interpretImage, s as present, t as runImagePresenter } from "./presenter-agent-vFOxIuWv.js";
15
15
  import { join } from "node:path";